MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / dv_init_weight_tables

Function dv_init_weight_tables

libavcodec/dvdec.c:201–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201static void dv_init_weight_tables(DVDecContext *ctx, const AVDVProfile *d)
202{
203 int j, i, c, s;
204 uint32_t *factor1 = &ctx->idct_factor[0],
205 *factor2 = &ctx->idct_factor[DV_PROFILE_IS_HD(d) ? 4096 : 2816];
206
207 if (DV_PROFILE_IS_HD(d)) {
208 /* quantization quanta by QNO for DV100 */
209 static const uint8_t dv100_qstep[16] = {
210 1, /* QNO = 0 and 1 both have no quantization */
211 1,
212 2, 3, 4, 5, 6, 7, 8, 16, 18, 20, 22, 24, 28, 52
213 };
214 const uint16_t *iweight1, *iweight2;
215
216 if (d->height == 720) {
217 iweight1 = &dv_iweight_720_y[0];
218 iweight2 = &dv_iweight_720_c[0];
219 } else {
220 iweight1 = &dv_iweight_1080_y[0];
221 iweight2 = &dv_iweight_1080_c[0];
222 }
223 for (c = 0; c < 4; c++) {
224 for (s = 0; s < 16; s++) {
225 for (i = 0; i < 64; i++) {
226 *factor1++ = (dv100_qstep[s] << (c + 9)) * iweight1[i];
227 *factor2++ = (dv100_qstep[s] << (c + 9)) * iweight2[i];
228 }
229 }
230 }
231 } else {
232 static const uint8_t dv_quant_areas[4] = { 6, 21, 43, 64 };
233 const uint16_t *iweight1 = &dv_iweight_88[0];
234 for (j = 0; j < 2; j++, iweight1 = &dv_iweight_248[0]) {
235 for (s = 0; s < 22; s++) {
236 for (i = c = 0; c < 4; c++) {
237 for (; i < dv_quant_areas[c]; i++) {
238 *factor1 = iweight1[i] << (ff_dv_quant_shifts[s][c] + 1);
239 *factor2++ = (*factor1++) << 1;
240 }
241 }
242 }
243 }
244 }
245}
246
247static av_cold int dvvideo_decode_init(AVCodecContext *avctx)
248{

Callers 1

dvvideo_decode_frameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected