chromium/third_party/dav1d/libdav1d/src/filmgrain_tmpl.c

/*
 * Copyright © 2018, Niklas Haas
 * Copyright © 2018, VideoLAN and dav1d authors
 * Copyright © 2018, Two Orioles, LLC
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "common/attributes.h"
#include "common/intops.h"

#include "src/filmgrain.h"
#include "src/tables.h"

#define SUB_GRAIN_WIDTH
#define SUB_GRAIN_HEIGHT

static inline int get_random_number(const int bits, unsigned *const state) {}

static inline int round2(const int x, const uint64_t shift) {}

static void generate_grain_y_c(entry buf[][GRAIN_WIDTH],
                               const Dav1dFilmGrainData *const data
                               HIGHBD_DECL_SUFFIX)
{}

static NOINLINE void
generate_grain_uv_c(entry buf[][GRAIN_WIDTH],
                    const entry buf_y[][GRAIN_WIDTH],
                    const Dav1dFilmGrainData *const data, const intptr_t uv,
                    const int subx, const int suby HIGHBD_DECL_SUFFIX)
{}

#define gnuv_ss_fn(nm, ss_x, ss_y)

gnuv_ss_fn(420, 1, 1);
gnuv_ss_fn(422, 1, 0);
gnuv_ss_fn(444, 0, 0);

// samples from the correct block of a grain LUT, while taking into account the
// offsets provided by the offsets cache
static inline entry sample_lut(const entry grain_lut[][GRAIN_WIDTH],
                               const int offsets[2][2], const int subx, const int suby,
                               const int bx, const int by, const int x, const int y)
{}

static void fgy_32x32xn_c(pixel *const dst_row, const pixel *const src_row,
                          const ptrdiff_t stride,
                          const Dav1dFilmGrainData *const data, const size_t pw,
                          const uint8_t scaling[SCALING_SIZE],
                          const entry grain_lut[][GRAIN_WIDTH],
                          const int bh, const int row_num HIGHBD_DECL_SUFFIX)
{}

static NOINLINE void
fguv_32x32xn_c(pixel *const dst_row, const pixel *const src_row,
               const ptrdiff_t stride, const Dav1dFilmGrainData *const data,
               const size_t pw, const uint8_t scaling[SCALING_SIZE],
               const entry grain_lut[][GRAIN_WIDTH], const int bh,
               const int row_num, const pixel *const luma_row,
               const ptrdiff_t luma_stride, const int uv, const int is_id,
               const int sx, const int sy HIGHBD_DECL_SUFFIX)
{}

#define fguv_ss_fn(nm, ss_x, ss_y)

fguv_ss_fn(420, 1, 1);
fguv_ss_fn(422, 1, 0);
fguv_ss_fn(444, 0, 0);

#if HAVE_ASM
#if ARCH_AARCH64 || ARCH_ARM
#include "src/arm/filmgrain.h"
#elif ARCH_X86
#include "src/x86/filmgrain.h"
#endif
#endif

COLD void bitfn(dav1d_film_grain_dsp_init)(Dav1dFilmGrainDSPContext *const c) {}