xref: /aosp_15_r20/external/libaom/av1/decoder/grain_synthesis.h (revision 77c1e3ccc04c968bd2bc212e87364f250e820521)
1 /*
2  * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
3  *
4  * This source code is subject to the terms of the BSD 2 Clause License and
5  * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6  * was not distributed with this source code in the LICENSE file, you can
7  * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8  * Media Patent License 1.0 was not distributed with this source code in the
9  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10  */
11 
12 /*!\file
13  * \brief Describes film grain synthesis
14  *
15  */
16 #ifndef AOM_AV1_DECODER_GRAIN_SYNTHESIS_H_
17 #define AOM_AV1_DECODER_GRAIN_SYNTHESIS_H_
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #include <stdint.h>
24 
25 #include "aom_dsp/grain_params.h"
26 #include "aom/aom_image.h"
27 
28 /*!\brief Add film grain
29  *
30  * Add film grain to an image
31  *
32  * Returns 0 for success, -1 for failure
33  *
34  * \param[in]    grain_params     Grain parameters
35  * \param[in]    luma             luma plane
36  * \param[in]    cb               cb plane
37  * \param[in]    cr               cr plane
38  * \param[in]    height           luma plane height
39  * \param[in]    width            luma plane width
40  * \param[in]    luma_stride      luma plane stride
41  * \param[in]    chroma_stride    chroma plane stride
42  */
43 int av1_add_film_grain_run(const aom_film_grain_t *grain_params, uint8_t *luma,
44                            uint8_t *cb, uint8_t *cr, int height, int width,
45                            int luma_stride, int chroma_stride,
46                            int use_high_bit_depth, int chroma_subsamp_y,
47                            int chroma_subsamp_x, int mc_identity);
48 
49 /*!\brief Add film grain
50  *
51  * Add film grain to an image
52  *
53  * Returns 0 for success, -1 for failure
54  *
55  * \param[in]    grain_params     Grain parameters
56  * \param[in]    src              Source image
57  * \param[out]   dst              Resulting image with grain
58  */
59 int av1_add_film_grain(const aom_film_grain_t *grain_params,
60                        const aom_image_t *src, aom_image_t *dst);
61 
62 #ifdef __cplusplus
63 }  // extern "C"
64 #endif
65 
66 #endif  // AOM_AV1_DECODER_GRAIN_SYNTHESIS_H_
67