/src/aom/aom_scale/yv12config.h
Line | Count | Source (jump to first uncovered line) |
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 | | #ifndef AOM_AOM_SCALE_YV12CONFIG_H_ |
13 | | #define AOM_AOM_SCALE_YV12CONFIG_H_ |
14 | | |
15 | | #ifdef __cplusplus |
16 | | extern "C" { |
17 | | #endif |
18 | | |
19 | | #include "config/aom_config.h" |
20 | | |
21 | | #include "aom/aom_codec.h" |
22 | | #include "aom/aom_frame_buffer.h" |
23 | | #include "aom/aom_integer.h" |
24 | | #include "aom/internal/aom_image_internal.h" |
25 | | |
26 | | /*!\cond */ |
27 | | |
28 | 0 | #define AOMINNERBORDERINPIXELS 160 |
29 | 2.04M | #define AOM_INTERP_EXTEND 4 |
30 | 0 | #define AOM_BORDER_IN_PIXELS 288 |
31 | 7.79k | #define AOM_ENC_NO_SCALE_BORDER 160 |
32 | 7.79k | #define AOM_ENC_ALLINTRA_BORDER 64 |
33 | 0 | #define AOM_DEC_BORDER_IN_PIXELS 64 |
34 | | |
35 | | /*!\endcond */ |
36 | | /*! |
37 | | * \brief YV12 frame buffer data structure |
38 | | */ |
39 | | typedef struct yv12_buffer_config { |
40 | | /*!\cond */ |
41 | | union { |
42 | | struct { |
43 | | int y_width; |
44 | | int uv_width; |
45 | | }; |
46 | | int widths[2]; |
47 | | }; |
48 | | union { |
49 | | struct { |
50 | | int y_height; |
51 | | int uv_height; |
52 | | }; |
53 | | int heights[2]; |
54 | | }; |
55 | | union { |
56 | | struct { |
57 | | int y_crop_width; |
58 | | int uv_crop_width; |
59 | | }; |
60 | | int crop_widths[2]; |
61 | | }; |
62 | | union { |
63 | | struct { |
64 | | int y_crop_height; |
65 | | int uv_crop_height; |
66 | | }; |
67 | | int crop_heights[2]; |
68 | | }; |
69 | | union { |
70 | | struct { |
71 | | int y_stride; |
72 | | int uv_stride; |
73 | | }; |
74 | | int strides[2]; |
75 | | }; |
76 | | union { |
77 | | struct { |
78 | | uint8_t *y_buffer; |
79 | | uint8_t *u_buffer; |
80 | | uint8_t *v_buffer; |
81 | | }; |
82 | | uint8_t *buffers[3]; |
83 | | }; |
84 | | |
85 | | // Indicate whether y_buffer, u_buffer, and v_buffer points to the internally |
86 | | // allocated memory or external buffers. |
87 | | int use_external_reference_buffers; |
88 | | // This is needed to store y_buffer, u_buffer, and v_buffer when set reference |
89 | | // uses an external refernece, and restore those buffer pointers after the |
90 | | // external reference frame is no longer used. |
91 | | uint8_t *store_buf_adr[3]; |
92 | | |
93 | | // If the frame is stored in a 16-bit buffer, this stores an 8-bit version |
94 | | // for use in global motion detection. It is allocated on-demand. |
95 | | uint8_t *y_buffer_8bit; |
96 | | int buf_8bit_valid; |
97 | | |
98 | | uint8_t *buffer_alloc; |
99 | | size_t buffer_alloc_sz; |
100 | | int border; |
101 | | size_t frame_size; |
102 | | int subsampling_x; |
103 | | int subsampling_y; |
104 | | unsigned int bit_depth; |
105 | | aom_color_primaries_t color_primaries; |
106 | | aom_transfer_characteristics_t transfer_characteristics; |
107 | | aom_matrix_coefficients_t matrix_coefficients; |
108 | | uint8_t monochrome; |
109 | | aom_chroma_sample_position_t chroma_sample_position; |
110 | | aom_color_range_t color_range; |
111 | | int render_width; |
112 | | int render_height; |
113 | | |
114 | | int corrupted; |
115 | | int flags; |
116 | | aom_metadata_array_t *metadata; |
117 | | /*!\endcond */ |
118 | | } YV12_BUFFER_CONFIG; |
119 | | |
120 | | /*!\cond */ |
121 | | |
122 | 238M | #define YV12_FLAG_HIGHBITDEPTH 8 |
123 | | |
124 | | int aom_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, |
125 | | int ss_x, int ss_y, int use_highbitdepth, int border, |
126 | | int byte_alignment); |
127 | | |
128 | | // Updates the yv12 buffer config with the frame buffer. |byte_alignment| must |
129 | | // be a power of 2, from 32 to 1024. 0 sets legacy alignment. If cb is not |
130 | | // NULL, then libaom is using the frame buffer callbacks to handle memory. |
131 | | // If cb is not NULL, libaom will call cb with minimum size in bytes needed |
132 | | // to decode the current frame. If cb is NULL, libaom will allocate memory |
133 | | // internally to decode the current frame. Returns 0 on success. Returns < 0 |
134 | | // on failure. |
135 | | int aom_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, |
136 | | int ss_x, int ss_y, int use_highbitdepth, |
137 | | int border, int byte_alignment, |
138 | | aom_codec_frame_buffer_t *fb, |
139 | | aom_get_frame_buffer_cb_fn_t cb, void *cb_priv, |
140 | | int alloc_y_buffer_8bit); |
141 | | |
142 | | int aom_free_frame_buffer(YV12_BUFFER_CONFIG *ybf); |
143 | | |
144 | | /*!\endcond */ |
145 | | /*!\brief Removes metadata from YUV_BUFFER_CONFIG struct. |
146 | | * |
147 | | * Frees metadata in frame buffer. |
148 | | * Frame buffer metadata pointer will be set to NULL. |
149 | | * |
150 | | * \param[in] ybf Frame buffer struct pointer |
151 | | */ |
152 | | void aom_remove_metadata_from_frame_buffer(YV12_BUFFER_CONFIG *ybf); |
153 | | |
154 | | /*!\brief Copy metadata to YUV_BUFFER_CONFIG struct. |
155 | | * |
156 | | * Copies metadata to frame buffer. |
157 | | * Frame buffer will clear any previous metadata and will reallocate the |
158 | | * metadata array to the new metadata size. Then, it will copy the new metadata |
159 | | * array into it. |
160 | | * If arr metadata pointer points to the same address as current metadata in the |
161 | | * frame buffer, function will do nothing and return 0. |
162 | | * Returns 0 on success or -1 on failure. |
163 | | * |
164 | | * \param[in] ybf Frame buffer struct pointer |
165 | | * \param[in] arr Metadata array struct pointer |
166 | | */ |
167 | | int aom_copy_metadata_to_frame_buffer(YV12_BUFFER_CONFIG *ybf, |
168 | | const aom_metadata_array_t *arr); |
169 | | |
170 | | /*!\brief Calculate the stride required for the image. |
171 | | * |
172 | | * Calculates the stride value for an image from aligned width and border. |
173 | | * Returns the y stride value. |
174 | | * |
175 | | * \param[in] aligned_width Aligned width of the image |
176 | | * \param[in] border Border in pixels |
177 | | */ |
178 | 8.60k | static AOM_INLINE int aom_calc_y_stride(int aligned_width, int border) { |
179 | 8.60k | return ((aligned_width + 2 * border) + 31) & ~31; |
180 | 8.60k | } Unexecuted instantiation: av1_dx_iface.c:aom_calc_y_stride Unexecuted instantiation: decodeframe.c:aom_calc_y_stride Unexecuted instantiation: decodemv.c:aom_calc_y_stride Unexecuted instantiation: decoder.c:aom_calc_y_stride Unexecuted instantiation: decodetxb.c:aom_calc_y_stride Unexecuted instantiation: detokenize.c:aom_calc_y_stride Unexecuted instantiation: obu.c:aom_calc_y_stride Unexecuted instantiation: av1_cx_iface.c:aom_calc_y_stride Unexecuted instantiation: av1_quantize.c:aom_calc_y_stride Unexecuted instantiation: bitstream.c:aom_calc_y_stride Unexecuted instantiation: encodemv.c:aom_calc_y_stride encoder.c:aom_calc_y_stride Line | Count | Source | 178 | 3.78k | static AOM_INLINE int aom_calc_y_stride(int aligned_width, int border) { | 179 | 3.78k | return ((aligned_width + 2 * border) + 31) & ~31; | 180 | 3.78k | } |
Unexecuted instantiation: encoder_utils.c:aom_calc_y_stride Unexecuted instantiation: encodetxb.c:aom_calc_y_stride Unexecuted instantiation: ethread.c:aom_calc_y_stride Unexecuted instantiation: firstpass.c:aom_calc_y_stride Unexecuted instantiation: global_motion_facade.c:aom_calc_y_stride Unexecuted instantiation: hash_motion.c:aom_calc_y_stride Unexecuted instantiation: level.c:aom_calc_y_stride Unexecuted instantiation: lookahead.c:aom_calc_y_stride Unexecuted instantiation: mcomp.c:aom_calc_y_stride Unexecuted instantiation: mv_prec.c:aom_calc_y_stride Unexecuted instantiation: palette.c:aom_calc_y_stride Unexecuted instantiation: pass2_strategy.c:aom_calc_y_stride Unexecuted instantiation: pickcdef.c:aom_calc_y_stride Unexecuted instantiation: picklpf.c:aom_calc_y_stride Unexecuted instantiation: pickrst.c:aom_calc_y_stride Unexecuted instantiation: ratectrl.c:aom_calc_y_stride Unexecuted instantiation: rd.c:aom_calc_y_stride Unexecuted instantiation: rdopt.c:aom_calc_y_stride Unexecuted instantiation: reconinter_enc.c:aom_calc_y_stride Unexecuted instantiation: segmentation.c:aom_calc_y_stride Unexecuted instantiation: speed_features.c:aom_calc_y_stride Unexecuted instantiation: superres_scale.c:aom_calc_y_stride Unexecuted instantiation: svc_layercontext.c:aom_calc_y_stride Unexecuted instantiation: temporal_filter.c:aom_calc_y_stride Unexecuted instantiation: thirdpass.c:aom_calc_y_stride Unexecuted instantiation: tokenize.c:aom_calc_y_stride Unexecuted instantiation: tpl_model.c:aom_calc_y_stride Unexecuted instantiation: tx_search.c:aom_calc_y_stride Unexecuted instantiation: txb_rdopt.c:aom_calc_y_stride Unexecuted instantiation: intra_mode_search.c:aom_calc_y_stride Unexecuted instantiation: var_based_part.c:aom_calc_y_stride Unexecuted instantiation: av1_noise_estimate.c:aom_calc_y_stride Unexecuted instantiation: dwt.c:aom_calc_y_stride Unexecuted instantiation: aom_dsp_rtcd.c:aom_calc_y_stride Unexecuted instantiation: av1_rtcd.c:aom_calc_y_stride Unexecuted instantiation: aom_convolve.c:aom_calc_y_stride Unexecuted instantiation: blend_a64_mask.c:aom_calc_y_stride Unexecuted instantiation: avg.c:aom_calc_y_stride Unexecuted instantiation: blk_sse_sum.c:aom_calc_y_stride Unexecuted instantiation: noise_model.c:aom_calc_y_stride Unexecuted instantiation: noise_util.c:aom_calc_y_stride Unexecuted instantiation: psnr.c:aom_calc_y_stride Unexecuted instantiation: sad.c:aom_calc_y_stride Unexecuted instantiation: sad_av1.c:aom_calc_y_stride Unexecuted instantiation: sse.c:aom_calc_y_stride Unexecuted instantiation: sum_squares.c:aom_calc_y_stride Unexecuted instantiation: variance.c:aom_calc_y_stride yv12config.c:aom_calc_y_stride Line | Count | Source | 178 | 4.82k | static AOM_INLINE int aom_calc_y_stride(int aligned_width, int border) { | 179 | 4.82k | return ((aligned_width + 2 * border) + 31) & ~31; | 180 | 4.82k | } |
Unexecuted instantiation: yv12extend.c:aom_calc_y_stride Unexecuted instantiation: alloccommon.c:aom_calc_y_stride Unexecuted instantiation: av1_loopfilter.c:aom_calc_y_stride Unexecuted instantiation: blockd.c:aom_calc_y_stride Unexecuted instantiation: cdef.c:aom_calc_y_stride Unexecuted instantiation: cdef_block.c:aom_calc_y_stride Unexecuted instantiation: cfl.c:aom_calc_y_stride Unexecuted instantiation: debugmodes.c:aom_calc_y_stride Unexecuted instantiation: entropy.c:aom_calc_y_stride Unexecuted instantiation: entropymode.c:aom_calc_y_stride Unexecuted instantiation: entropymv.c:aom_calc_y_stride Unexecuted instantiation: idct.c:aom_calc_y_stride Unexecuted instantiation: mvref_common.c:aom_calc_y_stride Unexecuted instantiation: pred_common.c:aom_calc_y_stride Unexecuted instantiation: quant_common.c:aom_calc_y_stride Unexecuted instantiation: reconinter.c:aom_calc_y_stride Unexecuted instantiation: reconintra.c:aom_calc_y_stride Unexecuted instantiation: resize.c:aom_calc_y_stride Unexecuted instantiation: restoration.c:aom_calc_y_stride Unexecuted instantiation: scale.c:aom_calc_y_stride Unexecuted instantiation: scan.c:aom_calc_y_stride Unexecuted instantiation: seg_common.c:aom_calc_y_stride Unexecuted instantiation: thread_common.c:aom_calc_y_stride Unexecuted instantiation: tile_common.c:aom_calc_y_stride Unexecuted instantiation: txb_common.c:aom_calc_y_stride Unexecuted instantiation: warped_motion.c:aom_calc_y_stride Unexecuted instantiation: aq_complexity.c:aom_calc_y_stride Unexecuted instantiation: aq_cyclicrefresh.c:aom_calc_y_stride Unexecuted instantiation: aq_variance.c:aom_calc_y_stride Unexecuted instantiation: allintra_vis.c:aom_calc_y_stride Unexecuted instantiation: av1_fwd_txfm2d.c:aom_calc_y_stride Unexecuted instantiation: compound_type.c:aom_calc_y_stride Unexecuted instantiation: context_tree.c:aom_calc_y_stride Unexecuted instantiation: encodeframe.c:aom_calc_y_stride Unexecuted instantiation: encodeframe_utils.c:aom_calc_y_stride Unexecuted instantiation: encodemb.c:aom_calc_y_stride Unexecuted instantiation: encode_strategy.c:aom_calc_y_stride Unexecuted instantiation: extend.c:aom_calc_y_stride Unexecuted instantiation: global_motion.c:aom_calc_y_stride Unexecuted instantiation: gop_structure.c:aom_calc_y_stride Unexecuted instantiation: hybrid_fwd_txfm.c:aom_calc_y_stride Unexecuted instantiation: interp_search.c:aom_calc_y_stride Unexecuted instantiation: ml.c:aom_calc_y_stride Unexecuted instantiation: motion_search_facade.c:aom_calc_y_stride Unexecuted instantiation: partition_search.c:aom_calc_y_stride Unexecuted instantiation: partition_strategy.c:aom_calc_y_stride Unexecuted instantiation: ransac.c:aom_calc_y_stride Unexecuted instantiation: nonrd_pickmode.c:aom_calc_y_stride Unexecuted instantiation: wedge_utils.c:aom_calc_y_stride Unexecuted instantiation: blend_a64_hmask.c:aom_calc_y_stride Unexecuted instantiation: blend_a64_vmask.c:aom_calc_y_stride Unexecuted instantiation: intrapred.c:aom_calc_y_stride Unexecuted instantiation: loopfilter.c:aom_calc_y_stride Unexecuted instantiation: subtract.c:aom_calc_y_stride Unexecuted instantiation: fwd_txfm.c:aom_calc_y_stride Unexecuted instantiation: av1_inv_txfm2d.c:aom_calc_y_stride Unexecuted instantiation: av1_txfm.c:aom_calc_y_stride Unexecuted instantiation: convolve.c:aom_calc_y_stride Unexecuted instantiation: av1_fwd_txfm1d.c:aom_calc_y_stride Unexecuted instantiation: cnn.c:aom_calc_y_stride Unexecuted instantiation: corner_match.c:aom_calc_y_stride Unexecuted instantiation: av1_inv_txfm1d.c:aom_calc_y_stride |
181 | | |
182 | | #ifdef __cplusplus |
183 | | } |
184 | | #endif |
185 | | |
186 | | #endif // AOM_AOM_SCALE_YV12CONFIG_H_ |