FFmpeg
Loading...
Searching...
No Matches
proresdec.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010-2011 Maxim Poliakovski
3 * Copyright (c) 2010-2011 Elvis Presley
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22/**
23 * @file
24 * Known FOURCCs: 'apch' (HQ), 'apcn' (SD), 'apcs' (LT), 'apco' (Proxy), 'ap4h' (4444), 'ap4x' (4444 XQ)
25 */
26
27//#define DEBUG
28
29#include "config_components.h"
30
31#include "libavutil/internal.h"
32#include "libavutil/mem.h"
34#include "libavutil/pixdesc.h"
35
36#include "avcodec.h"
37#include "codec_internal.h"
38#include "decode.h"
39#define CACHED_BITSTREAM_READER 1
40#include "get_bits.h"
41#include "hwaccel_internal.h"
42#include "hwconfig.h"
43#include "idctdsp.h"
44#include "profiles.h"
45#include "proresdec.h"
46#include "proresdata.h"
47#include "thread.h"
48
49#define ALPHA_SHIFT_16_TO_10(alpha_val) (alpha_val >> 6)
50#define ALPHA_SHIFT_8_TO_10(alpha_val) ((alpha_val << 2) | (alpha_val >> 6))
51#define ALPHA_SHIFT_16_TO_12(alpha_val) (alpha_val >> 4)
52#define ALPHA_SHIFT_8_TO_12(alpha_val) ((alpha_val << 4) | (alpha_val >> 4))
53
54static void inline unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs,
55 const int num_bits, const int decode_precision) {
56 const int mask = (1 << num_bits) - 1;
57 int i, idx, val, alpha_val;
58
59 idx = 0;
60 alpha_val = mask;
61 do {
62 do {
63 if (get_bits1(gb)) {
64 val = get_bits(gb, num_bits);
65 } else {
66 int sign;
67 val = get_bits(gb, num_bits == 16 ? 7 : 4);
68 sign = val & 1;
69 val = (val + 2) >> 1;
70 if (sign)
71 val = -val;
72 }
73 alpha_val = (alpha_val + val) & mask;
74 if (num_bits == 16) {
75 if (decode_precision == 10) {
76 dst[idx++] = ALPHA_SHIFT_16_TO_10(alpha_val);
77 } else { /* 12b */
78 dst[idx++] = ALPHA_SHIFT_16_TO_12(alpha_val);
79 }
80 } else {
81 if (decode_precision == 10) {
82 dst[idx++] = ALPHA_SHIFT_8_TO_10(alpha_val);
83 } else { /* 12b */
84 dst[idx++] = ALPHA_SHIFT_8_TO_12(alpha_val);
85 }
86 }
87 if (idx >= num_coeffs)
88 break;
89 } while (get_bits_left(gb)>0 && get_bits1(gb));
90 val = get_bits(gb, 4);
91 if (!val)
92 val = get_bits(gb, 11);
93 if (idx + val > num_coeffs)
94 val = num_coeffs - idx;
95 if (num_bits == 16) {
96 for (i = 0; i < val; i++) {
97 if (decode_precision == 10) {
98 dst[idx++] = ALPHA_SHIFT_16_TO_10(alpha_val);
99 } else { /* 12b */
100 dst[idx++] = ALPHA_SHIFT_16_TO_12(alpha_val);
101 }
102 }
103 } else {
104 for (i = 0; i < val; i++) {
105 if (decode_precision == 10) {
106 dst[idx++] = ALPHA_SHIFT_8_TO_10(alpha_val);
107 } else { /* 12b */
108 dst[idx++] = ALPHA_SHIFT_8_TO_12(alpha_val);
109 }
110 }
111 }
112 } while (idx < num_coeffs);
113}
114
115static void unpack_alpha_10(GetBitContext *gb, uint16_t *dst, int num_coeffs,
116 const int num_bits)
117{
118 if (num_bits == 16) {
119 unpack_alpha(gb, dst, num_coeffs, 16, 10);
120 } else { /* 8 bits alpha */
121 unpack_alpha(gb, dst, num_coeffs, 8, 10);
122 }
123}
124
125static void unpack_alpha_12(GetBitContext *gb, uint16_t *dst, int num_coeffs,
126 const int num_bits)
127{
128 if (num_bits == 16) {
129 unpack_alpha(gb, dst, num_coeffs, 16, 12);
130 } else { /* 8 bits alpha */
131 unpack_alpha(gb, dst, num_coeffs, 8, 12);
132 }
133}
134
136{
137 ProresContext *ctx = avctx->priv_data;
138
139 avctx->bits_per_raw_sample = 10;
140
141 ctx->container_color_primaries = avctx->color_primaries;
142 ctx->container_color_trc = avctx->color_trc;
143 ctx->container_colorspace = avctx->colorspace;
144
145 switch (avctx->codec_tag) {
146 case MKTAG('a','p','c','o'):
148 break;
149 case MKTAG('a','p','c','s'):
151 break;
152 case MKTAG('a','p','c','n'):
154 break;
155 case MKTAG('a','p','c','h'):
157 break;
158 case MKTAG('a','p','4','h'):
160 avctx->bits_per_raw_sample = 12;
161 break;
162 case MKTAG('a','p','4','x'):
164 avctx->bits_per_raw_sample = 12;
165 break;
166 default:
168 av_log(avctx, AV_LOG_WARNING, "Unknown prores profile %d\n", avctx->codec_tag);
169 }
170
171 ctx->unpack_alpha = avctx->bits_per_raw_sample == 10 ?
173
174 av_log(avctx, AV_LOG_DEBUG,
175 "Auto bitdepth precision. Use %db decoding based on codec tag.\n",
176 avctx->bits_per_raw_sample);
177
178 ff_blockdsp_init(&ctx->bdsp);
179 ff_proresdsp_init(&ctx->prodsp, avctx->bits_per_raw_sample);
180
182 ctx->prodsp.idct_permutation);
184 ctx->prodsp.idct_permutation);
185
186 ctx->pix_fmt = AV_PIX_FMT_NONE;
187
188 return 0;
189}
190
191/**
192 * Whether a frame header colour value describes a colour. 0 and 2 both mean
193 * unknown in all three fields (RDD 36), unlike 0 in H.273; 3 is reserved.
194 *
195 * @param name FFmpeg name of the value, NULL if it has none
196 */
197static int describes_colour(int value, const char *name)
198{
199 return value != 0 && value != 2 && value != 3 && name;
200}
201
202static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
203 const int data_size, AVCodecContext *avctx)
204{
205 int hdr_size, width, height, flags, dimensions_changed = 0;
206 int version;
207 const uint8_t *ptr;
209 int old_frame_type = ctx->frame_type;
210
211 hdr_size = AV_RB16(buf);
212 ff_dlog(avctx, "header size %d\n", hdr_size);
213 if (hdr_size > data_size) {
214 av_log(avctx, AV_LOG_ERROR, "error, wrong header size\n");
215 return AVERROR_INVALIDDATA;
216 }
217
218 version = AV_RB16(buf + 2);
219 ff_dlog(avctx, "%.4s version %d\n", buf+4, version);
220 if (version > 1) {
221 av_log(avctx, AV_LOG_ERROR, "unsupported version: %d\n", version);
223 }
224
225 width = AV_RB16(buf + 8);
226 height = AV_RB16(buf + 10);
227
228 if (width != avctx->width || height != avctx->height) {
229 int ret;
230
231 av_log(avctx, AV_LOG_WARNING, "picture resolution change: %dx%d -> %dx%d\n",
232 avctx->width, avctx->height, width, height);
233 if ((ret = ff_set_dimensions(avctx, width, height)) < 0)
234 return ret;
235 dimensions_changed = 1;
236 }
237
238 ctx->frame_type = (buf[12] >> 2) & 3;
239 ctx->alpha_info = buf[17] & 0xf;
240
241 if (ctx->alpha_info > 2) {
242 av_log(avctx, AV_LOG_ERROR, "Invalid alpha mode %d\n", ctx->alpha_info);
243 return AVERROR_INVALIDDATA;
244 }
245 if (avctx->skip_alpha) ctx->alpha_info = 0;
246
247 ff_dlog(avctx, "frame type %d\n", ctx->frame_type);
248
249 if (ctx->frame_type == 0) {
250 ctx->scan = ctx->progressive_scan; // permuted
251 } else {
252 ctx->scan = ctx->interlaced_scan; // permuted
253 ctx->frame->flags |= AV_FRAME_FLAG_INTERLACED;
254 if (ctx->frame_type == 1)
255 ctx->frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
256 }
257
258 if (ctx->alpha_info) {
259 if (avctx->bits_per_raw_sample == 10) {
260 pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUVA444P10 : AV_PIX_FMT_YUVA422P10;
261 } else { /* 12b */
262 pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUVA444P12 : AV_PIX_FMT_YUVA422P12;
263 }
264 } else {
265 if (avctx->bits_per_raw_sample == 10) {
266 pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P10 : AV_PIX_FMT_YUV422P10;
267 } else { /* 12b */
268 pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P12 : AV_PIX_FMT_YUV422P12;
269 }
270 }
271
272 if (pix_fmt != ctx->pix_fmt || dimensions_changed ||
273 ctx->frame_type != old_frame_type) {
274#define HWACCEL_MAX (CONFIG_PRORES_VIDEOTOOLBOX_HWACCEL + CONFIG_PRORES_VULKAN_HWACCEL)
275#if HWACCEL_MAX
276 enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;
277 int ret;
278
279 ctx->pix_fmt = pix_fmt;
280
281#if CONFIG_PRORES_VIDEOTOOLBOX_HWACCEL
282 *fmtp++ = AV_PIX_FMT_VIDEOTOOLBOX;
283#endif
284#if CONFIG_PRORES_VULKAN_HWACCEL
285 *fmtp++ = AV_PIX_FMT_VULKAN;
286#endif
287 *fmtp++ = ctx->pix_fmt;
288 *fmtp = AV_PIX_FMT_NONE;
289
290 if ((ret = ff_get_format(avctx, pix_fmts)) < 0)
291 return ret;
292
293 avctx->pix_fmt = ret;
294#else
295 avctx->pix_fmt = ctx->pix_fmt = pix_fmt;
296#endif
297 }
298
299 avctx->color_primaries = describes_colour(buf[14], av_color_primaries_name(buf[14])) ?
300 buf[14] : ctx->container_color_primaries;
301 avctx->color_trc = describes_colour(buf[15], av_color_transfer_name(buf[15])) ?
302 buf[15] : ctx->container_color_trc;
303 avctx->colorspace = describes_colour(buf[16], av_color_space_name(buf[16])) ?
304 buf[16] : ctx->container_colorspace;
306
307 ptr = buf + 20;
308 flags = buf[19];
309 ff_dlog(avctx, "flags %x\n", flags);
310
311 if (flags & 2) {
312 if(buf + data_size - ptr < 64) {
313 av_log(avctx, AV_LOG_ERROR, "Header truncated\n");
314 return AVERROR_INVALIDDATA;
315 }
316 ff_permute_scantable(ctx->qmat_luma, ctx->prodsp.idct_permutation, ptr);
317 ptr += 64;
318 } else {
319 memset(ctx->qmat_luma, 4, 64);
320 }
321
322 if (flags & 1) {
323 if(buf + data_size - ptr < 64) {
324 av_log(avctx, AV_LOG_ERROR, "Header truncated\n");
325 return AVERROR_INVALIDDATA;
326 }
327 ff_permute_scantable(ctx->qmat_chroma, ctx->prodsp.idct_permutation, ptr);
328 } else {
329 memcpy(ctx->qmat_chroma, ctx->qmat_luma, 64);
330 }
331
332 return hdr_size;
333}
334
335static int decode_picture_header(AVCodecContext *avctx, const uint8_t *buf, const int buf_size)
336{
337 ProresContext *ctx = avctx->priv_data;
338 int i, hdr_size, slice_count;
339 unsigned pic_data_size;
340 int log2_slice_mb_width, log2_slice_mb_height;
341 int slice_mb_count, mb_x, mb_y;
342 const uint8_t *data_ptr, *index_ptr;
343
344 hdr_size = buf[0] >> 3;
345 if (hdr_size < 8 || hdr_size > buf_size) {
346 av_log(avctx, AV_LOG_ERROR, "error, wrong picture header size\n");
347 return AVERROR_INVALIDDATA;
348 }
349
350 pic_data_size = AV_RB32(buf + 1);
351 if (pic_data_size > buf_size) {
352 av_log(avctx, AV_LOG_ERROR, "error, wrong picture data size\n");
353 return AVERROR_INVALIDDATA;
354 }
355
356 log2_slice_mb_width = buf[7] >> 4;
357 log2_slice_mb_height = buf[7] & 0xF;
358 if (log2_slice_mb_width > 3 || log2_slice_mb_height) {
359 av_log(avctx, AV_LOG_ERROR, "unsupported slice resolution: %dx%d\n",
360 1 << log2_slice_mb_width, 1 << log2_slice_mb_height);
361 return AVERROR_INVALIDDATA;
362 }
363
364 ctx->slice_mb_width = 1 << log2_slice_mb_width;
365 ctx->slice_mb_height = 1 << log2_slice_mb_height;
366
367 ctx->mb_width = (avctx->width + 15) >> 4;
368 if (ctx->frame_type)
369 ctx->mb_height = (avctx->height + 31) >> 5;
370 else
371 ctx->mb_height = (avctx->height + 15) >> 4;
372
373 // QT ignores the written value
374 // slice_count = AV_RB16(buf + 5);
375 slice_count = ctx->mb_height * ((ctx->mb_width >> log2_slice_mb_width) +
376 av_popcount(ctx->mb_width & ctx->slice_mb_width - 1));
377
378 if (ctx->slice_count != slice_count || !ctx->slices) {
379 av_freep(&ctx->slices);
380 ctx->slice_count = 0;
381 ctx->slices = av_calloc(slice_count, sizeof(*ctx->slices));
382 if (!ctx->slices)
383 return AVERROR(ENOMEM);
384 ctx->slice_count = slice_count;
385 }
386
387 if (!slice_count)
388 return AVERROR(EINVAL);
389
390 if (hdr_size + slice_count*2 > buf_size) {
391 av_log(avctx, AV_LOG_ERROR, "error, wrong slice count\n");
392 return AVERROR_INVALIDDATA;
393 }
394
395 // parse slice information
396 index_ptr = buf + hdr_size;
397 data_ptr = index_ptr + slice_count*2;
398
399 slice_mb_count = ctx->slice_mb_width;
400 mb_x = 0;
401 mb_y = 0;
402
403 for (i = 0; i < slice_count; i++) {
404 SliceContext *slice = &ctx->slices[i];
405
406 slice->data = data_ptr;
407 data_ptr += AV_RB16(index_ptr + i*2);
408
409 while (ctx->mb_width - mb_x < slice_mb_count)
410 slice_mb_count >>= 1;
411
412 slice->mb_x = mb_x;
413 slice->mb_y = mb_y;
414 slice->mb_count = slice_mb_count;
415 slice->data_size = data_ptr - slice->data;
416
417 if (slice->data_size < 6) {
418 av_log(avctx, AV_LOG_ERROR, "error, wrong slice data size\n");
419 return AVERROR_INVALIDDATA;
420 }
421
422 mb_x += slice_mb_count;
423 if (mb_x == ctx->mb_width) {
424 slice_mb_count = ctx->slice_mb_width;
425 mb_x = 0;
426 mb_y++;
427 }
428 if (data_ptr > buf + buf_size) {
429 av_log(avctx, AV_LOG_ERROR, "error, slice out of bounds\n");
430 return AVERROR_INVALIDDATA;
431 }
432 }
433
434 if (mb_x || mb_y != ctx->mb_height) {
435 av_log(avctx, AV_LOG_ERROR, "error wrong mb count y %d h %d\n",
436 mb_y, ctx->mb_height);
437 return AVERROR_INVALIDDATA;
438 }
439
440 return pic_data_size;
441}
442
443#define DECODE_CODEWORD(val, codebook, gb) \
444 do { \
445 unsigned int rice_order, exp_order, switch_bits; \
446 unsigned int q, buf, bits; \
447 \
448 buf = show_bits(gb, 32); /* We really need 32 bits */ \
449 \
450 /* number of bits to switch between rice and exp golomb */ \
451 switch_bits = codebook & 3; \
452 rice_order = codebook >> 5; \
453 exp_order = (codebook >> 2) & 7; \
454 \
455 q = 31 - av_log2(buf); \
456 \
457 if (q > switch_bits) { /* exp golomb */ \
458 bits = exp_order - switch_bits + (q<<1); \
459 if (bits > 31) \
460 return AVERROR_INVALIDDATA; \
461 val = (buf >> (32 - bits)) - (1 << exp_order) + \
462 ((switch_bits + 1) << rice_order); \
463 skip_bits(gb, bits); \
464 } else if (rice_order) { \
465 bits = q + 1 + rice_order; \
466 val = (q << rice_order) + \
467 ((buf >> (32 - bits)) & ((1u << rice_order) - 1)); \
468 skip_bits(gb, bits); \
469 } else { \
470 val = q; \
471 skip_bits(gb, q + 1); \
472 } \
473 } while (0)
474
475#define TOSIGNED(x) (((x) >> 1) ^ (-((x) & 1)))
476
477#define FIRST_DC_CB 0xB8
478
479static const uint8_t dc_codebook[7] = { 0x04, 0x28, 0x28, 0x4D, 0x4D, 0x70, 0x70};
480
482 int blocks_per_slice)
483{
484 int16_t prev_dc;
485 int code, i, sign;
486
488 prev_dc = TOSIGNED(code);
489 out[0] = prev_dc;
490
491 out += 64; // dc coeff for the next block
492
493 code = 5;
494 sign = 0;
495 for (i = 1; i < blocks_per_slice; i++, out += 64) {
497 if(code) sign ^= -(code & 1);
498 else sign = 0;
499 prev_dc += (((code + 1) >> 1) ^ sign) - sign;
500 out[0] = prev_dc;
501 }
502 return 0;
503}
504
505// adaptive codebook switching lut according to previous run/level values
506static const uint8_t run_to_cb[16] = { 0x06, 0x06, 0x05, 0x05, 0x04, 0x29, 0x29, 0x29, 0x29, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x4C };
507static const uint8_t lev_to_cb[10] = { 0x04, 0x0A, 0x05, 0x06, 0x04, 0x28, 0x28, 0x28, 0x28, 0x4C };
508
510 int16_t *out, int blocks_per_slice)
511{
512 const ProresContext *ctx = avctx->priv_data;
513 int block_mask, sign;
514 unsigned pos, run, level;
515 int max_coeffs, i, left_bits;
516 int log2_block_count = av_log2(blocks_per_slice);
517
518 run = 4;
519 level = 2;
520
521 max_coeffs = 64 << log2_block_count;
522 block_mask = blocks_per_slice - 1;
523
524 for (pos = block_mask;;) {
525 left_bits = get_bits_left(gb);
526 if (left_bits <= 0 || (left_bits < 32 && !show_bits(gb, left_bits)))
527 break;
528
530 pos += run + 1;
531 if (pos >= max_coeffs) {
532 av_log(avctx, AV_LOG_ERROR, "ac tex damaged %d, %d\n", pos, max_coeffs);
533 return AVERROR_INVALIDDATA;
534 }
535
537 level += 1;
538
539 i = pos >> log2_block_count;
540
541 sign = -(int)get_bits1(gb);
542 out[((pos & block_mask) << 6) + ctx->scan[i]] = ((level ^ sign) - sign);
543 }
544
545 return 0;
546}
547
549 uint16_t *dst, int dst_stride,
550 const uint8_t *buf, unsigned buf_size,
551 const int16_t *qmat)
552{
553 const ProresContext *ctx = avctx->priv_data;
554 LOCAL_ALIGNED_32(int16_t, blocks, [8*4*64]);
555 int16_t *block;
556 GetBitContext gb;
557 int i, blocks_per_slice = slice->mb_count<<2;
558 int ret;
559
560 for (i = 0; i < blocks_per_slice; i++)
561 ctx->bdsp.clear_block(blocks+(i<<6));
562
563 init_get_bits(&gb, buf, buf_size << 3);
564
565 if ((ret = decode_dc_coeffs(&gb, blocks, blocks_per_slice)) < 0)
566 return ret;
567 if ((ret = decode_ac_coeffs(avctx, &gb, blocks, blocks_per_slice)) < 0)
568 return ret;
569
570 block = blocks;
571 for (i = 0; i < slice->mb_count; i++) {
572 ctx->prodsp.idct_put(dst, dst_stride, block+(0<<6), qmat);
573 ctx->prodsp.idct_put(dst +8, dst_stride, block+(1<<6), qmat);
574 ctx->prodsp.idct_put(dst+4*dst_stride , dst_stride, block+(2<<6), qmat);
575 ctx->prodsp.idct_put(dst+4*dst_stride+8, dst_stride, block+(3<<6), qmat);
576 block += 4*64;
577 dst += 16;
578 }
579 return 0;
580}
581
583 uint16_t *dst, int dst_stride,
584 const uint8_t *buf, unsigned buf_size,
585 const int16_t *qmat, int log2_blocks_per_mb)
586{
587 ProresContext *ctx = avctx->priv_data;
588 LOCAL_ALIGNED_32(int16_t, blocks, [8*4*64]);
589 int16_t *block;
590 GetBitContext gb;
591 int i, j, blocks_per_slice = slice->mb_count << log2_blocks_per_mb;
592 int ret;
593
594 for (i = 0; i < blocks_per_slice; i++)
595 ctx->bdsp.clear_block(blocks+(i<<6));
596
597 /* Some encodes have empty chroma scans to simulate grayscale */
598 if (buf_size) {
599 init_get_bits(&gb, buf, buf_size << 3);
600
601 if ((ret = decode_dc_coeffs(&gb, blocks, blocks_per_slice)) < 0)
602 return ret;
603 if ((ret = decode_ac_coeffs(avctx, &gb, blocks, blocks_per_slice)) < 0)
604 return ret;
605 }
606
607 block = blocks;
608 for (i = 0; i < slice->mb_count; i++) {
609 for (j = 0; j < log2_blocks_per_mb; j++) {
610 ctx->prodsp.idct_put(dst, dst_stride, block+(0<<6), qmat);
611 ctx->prodsp.idct_put(dst+4*dst_stride, dst_stride, block+(1<<6), qmat);
612 block += 2*64;
613 dst += 8;
614 }
615 }
616 return 0;
617}
618
619/**
620 * Decode alpha slice plane.
621 */
623 uint16_t *dst, int dst_stride,
624 const uint8_t *buf, int buf_size,
625 int blocks_per_slice)
626{
627 GetBitContext gb;
628 int i;
629 LOCAL_ALIGNED_32(int16_t, blocks, [8*4*64]);
630 int16_t *block;
631
632 for (i = 0; i < blocks_per_slice<<2; i++)
633 ctx->bdsp.clear_block(blocks+(i<<6));
634
635 init_get_bits(&gb, buf, buf_size << 3);
636
637 if (ctx->alpha_info == 2) {
638 ctx->unpack_alpha(&gb, blocks, blocks_per_slice * 4 * 64, 16);
639 } else {
640 ctx->unpack_alpha(&gb, blocks, blocks_per_slice * 4 * 64, 8);
641 }
642
643 block = blocks;
644
645 for (i = 0; i < 16; i++) {
646 memcpy(dst, block, 16 * blocks_per_slice * sizeof(*dst));
647 dst += dst_stride >> 1;
648 block += 16 * blocks_per_slice;
649 }
650}
651
652static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
653{
654 const ProresContext *ctx = avctx->priv_data;
655 SliceContext *slice = &ctx->slices[jobnr];
656 const uint8_t *buf = slice->data;
657 AVFrame *pic = ctx->frame;
658 int i, hdr_size, qscale, log2_chroma_blocks_per_mb;
659 int luma_stride, chroma_stride;
660 int y_data_size, u_data_size, v_data_size, a_data_size, offset;
661 uint8_t *dest_y, *dest_u, *dest_v;
662 LOCAL_ALIGNED_16(int16_t, qmat_luma_scaled, [64]);
663 LOCAL_ALIGNED_16(int16_t, qmat_chroma_scaled,[64]);
664 int mb_x_shift;
665 int ret;
666
667 slice->ret = -1;
668 //av_log(avctx, AV_LOG_INFO, "slice %d mb width %d mb x %d y %d\n",
669 // jobnr, slice->mb_count, slice->mb_x, slice->mb_y);
670
671 // slice header
672 hdr_size = buf[0] >> 3;
673 qscale = av_clip(buf[1], 1, 224);
674 qscale = qscale > 128 ? qscale - 96 << 2: qscale;
675 y_data_size = AV_RB16(buf + 2);
676 u_data_size = AV_RB16(buf + 4);
677 v_data_size = slice->data_size - y_data_size - u_data_size - hdr_size;
678 if (hdr_size > 7) v_data_size = AV_RB16(buf + 6);
679 a_data_size = slice->data_size - y_data_size - u_data_size -
680 v_data_size - hdr_size;
681
682 if (y_data_size < 0 || u_data_size < 0 || v_data_size < 0
683 || hdr_size+y_data_size+u_data_size+v_data_size > slice->data_size){
684 av_log(avctx, AV_LOG_ERROR, "invalid plane data size\n");
685 return AVERROR_INVALIDDATA;
686 }
687
688 buf += hdr_size;
689
690 for (i = 0; i < 64; i++) {
691 qmat_luma_scaled [i] = ctx->qmat_luma [i] * qscale;
692 qmat_chroma_scaled[i] = ctx->qmat_chroma[i] * qscale;
693 }
694
695 if (ctx->frame_type == 0) {
696 luma_stride = pic->linesize[0];
697 chroma_stride = pic->linesize[1];
698 } else {
699 luma_stride = pic->linesize[0] << 1;
700 chroma_stride = pic->linesize[1] << 1;
701 }
702
703 if (avctx->pix_fmt == AV_PIX_FMT_YUV444P10 || avctx->pix_fmt == AV_PIX_FMT_YUVA444P10 ||
705 mb_x_shift = 5;
706 log2_chroma_blocks_per_mb = 2;
707 } else {
708 mb_x_shift = 4;
709 log2_chroma_blocks_per_mb = 1;
710 }
711
712 offset = (slice->mb_y << 4) * luma_stride + (slice->mb_x << 5);
713 dest_y = pic->data[0] + offset;
714 dest_u = pic->data[1] + (slice->mb_y << 4) * chroma_stride + (slice->mb_x << mb_x_shift);
715 dest_v = pic->data[2] + (slice->mb_y << 4) * chroma_stride + (slice->mb_x << mb_x_shift);
716
717 if (ctx->frame_type && ctx->first_field ^ !!(ctx->frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)) {
718 dest_y += pic->linesize[0];
719 dest_u += pic->linesize[1];
720 dest_v += pic->linesize[2];
721 offset += pic->linesize[3];
722 }
723
724 ret = decode_slice_luma(avctx, slice, (uint16_t*)dest_y, luma_stride,
725 buf, y_data_size, qmat_luma_scaled);
726 if (ret < 0)
727 return ret;
728
729 if (!(avctx->flags & AV_CODEC_FLAG_GRAY)) {
730 ret = decode_slice_chroma(avctx, slice, (uint16_t*)dest_u, chroma_stride,
731 buf + y_data_size, u_data_size,
732 qmat_chroma_scaled, log2_chroma_blocks_per_mb);
733 if (ret < 0)
734 return ret;
735
736 ret = decode_slice_chroma(avctx, slice, (uint16_t*)dest_v, chroma_stride,
737 buf + y_data_size + u_data_size, v_data_size,
738 qmat_chroma_scaled, log2_chroma_blocks_per_mb);
739 if (ret < 0)
740 return ret;
741 }
742
743 /* decode alpha plane if available */
744 if (ctx->alpha_info && pic->data[3] && a_data_size) {
745 uint8_t *dest_a = pic->data[3] + offset;
746 decode_slice_alpha(ctx, (uint16_t*)dest_a, luma_stride,
747 buf + y_data_size + u_data_size + v_data_size,
748 a_data_size, slice->mb_count);
749 }
750
751 slice->ret = 0;
752 return 0;
753}
754
756{
757 ProresContext *ctx = avctx->priv_data;
758 int i;
759 int error = 0;
760
761 avctx->execute2(avctx, decode_slice_thread, NULL, NULL, ctx->slice_count);
762
763 for (i = 0; i < ctx->slice_count; i++)
764 error += ctx->slices[i].ret < 0;
765
766 if (error)
767 ctx->frame->decode_error_flags = FF_DECODE_ERROR_INVALID_BITSTREAM;
768 if (error < ctx->slice_count)
769 return 0;
770
771 return ctx->slices[0].ret;
772}
773
775 int *got_frame, AVPacket *avpkt)
776{
777 ProresContext *ctx = avctx->priv_data;
778 const uint8_t *buf = avpkt->data;
779 int buf_size = avpkt->size;
780 int frame_hdr_size, pic_size, ret;
781 int i;
782
783 if (buf_size < 28 || AV_RL32(buf + 4) != AV_RL32("icpf")) {
784 av_log(avctx, AV_LOG_ERROR, "invalid frame header\n");
785 return AVERROR_INVALIDDATA;
786 }
787
788 ctx->frame = frame;
789 ctx->first_field = 1;
790
791 buf += 8;
792 buf_size -= 8;
793
794 frame_hdr_size = decode_frame_header(ctx, buf, buf_size, avctx);
795 if (frame_hdr_size < 0)
796 return frame_hdr_size;
797
798 if (avctx->skip_frame == AVDISCARD_ALL)
799 return 0;
800
801 buf += frame_hdr_size;
802 buf_size -= frame_hdr_size;
803
804 if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0)
805 return ret;
806
807 av_refstruct_unref(&ctx->hwaccel_picture_private);
808
809 if ((ret = ff_hwaccel_frame_priv_alloc(avctx, &ctx->hwaccel_picture_private)) < 0)
810 return ret;
811
813
815 pic_size = decode_picture_header(avctx, buf, buf_size);
816 if (pic_size < 0) {
817 av_log(avctx, AV_LOG_ERROR, "error decoding picture header\n");
818 return pic_size;
819 }
820
821 if (HWACCEL_MAX && avctx->hwaccel) {
822 const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel);
823
824 ret = hwaccel->start_frame(avctx, avpkt->buf, avpkt->data, avpkt->size);
825 if (ret < 0)
826 return ret;
827
828 for (i = 0; i < ctx->slice_count; ++i) {
829 ret = hwaccel->decode_slice(avctx, ctx->slices[i].data, ctx->slices[i].data_size);
830 if (ret < 0)
831 return ret;
832 }
833
834 ret = hwaccel->end_frame(avctx);
835 if (ret < 0)
836 return ret;
837 } else if ((ret = decode_picture(avctx)) < 0) {
838 av_log(avctx, AV_LOG_ERROR, "error decoding picture\n");
839 return ret;
840 }
841
842 buf += pic_size;
843 buf_size -= pic_size;
844
845 if (ctx->frame_type && buf_size > 0 && ctx->first_field) {
846 ctx->first_field = 0;
847 goto decode_picture;
848 }
849
850 av_refstruct_unref(&ctx->hwaccel_picture_private);
851
852 *got_frame = 1;
853
854 return avpkt->size;
855}
856
858{
859 ProresContext *ctx = avctx->priv_data;
860
861 av_freep(&ctx->slices);
862 av_refstruct_unref(&ctx->hwaccel_picture_private);
863
864 return 0;
865}
866
867#if HAVE_THREADS
868static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
869{
870 ProresContext *csrc = src->priv_data;
871 ProresContext *cdst = dst->priv_data;
872
873 cdst->pix_fmt = csrc->pix_fmt;
874 cdst->frame_type = csrc->frame_type;
875
876 return 0;
877}
878#endif
879
881 .p.name = "prores",
882 CODEC_LONG_NAME("Apple ProRes (iCodec Pro)"),
883 .p.type = AVMEDIA_TYPE_VIDEO,
884 .p.id = AV_CODEC_ID_PRORES,
885 .priv_data_size = sizeof(ProresContext),
886 .init = decode_init,
889 UPDATE_THREAD_CONTEXT(update_thread_context),
891 .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
893#if HWACCEL_MAX
894 .hw_configs = (const AVCodecHWConfigInternal *const []) {
895#if CONFIG_PRORES_VIDEOTOOLBOX_HWACCEL
896 HWACCEL_VIDEOTOOLBOX(prores),
897#endif
898#if CONFIG_PRORES_VULKAN_HWACCEL
899 HWACCEL_VULKAN(prores),
900#endif
901 NULL
902 },
903#endif
904};
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:97
static double val(void *priv, double ch)
Definition aeval.c:77
const FFCodec ff_prores_decoder
Definition proresdec.c:880
static FILE * out
static AVFormatContext * ctx
Libavcodec external API header.
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define UPDATE_THREAD_CONTEXT(func)
#define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
The decoder extracts and fills its parameters if all frames are skipped due to the skip_frame setting...
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define av_popcount
Definition common.h:154
#define av_clip
Definition common.h:100
#define NULL
Definition coverity.c:32
static int16_t block[64]
Definition dct.c:125
int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Select the (possibly hardware accelerated) pixel format.
Definition decode.c:1248
int ff_hwaccel_frame_priv_alloc(AVCodecContext *avctx, void **hwaccel_picture_private)
Allocate a hwaccel frame private data if the provided avctx uses a hwaccel method that needs it.
Definition decode.c:2383
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Definition utils.c:91
#define AV_PROFILE_PRORES_STANDARD
Definition defs.h:197
#define AV_PROFILE_PRORES_4444
Definition defs.h:199
#define AV_PROFILE_PRORES_LT
Definition defs.h:196
#define AV_PROFILE_UNKNOWN
Definition defs.h:65
#define AV_PROFILE_PRORES_PROXY
Definition defs.h:195
#define AV_PROFILE_PRORES_XQ
Definition defs.h:200
#define AV_PROFILE_PRORES_HQ
Definition defs.h:198
static enum AVPixelFormat pix_fmt
static AVFrame * frame
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:613
double value
Definition eval.c:102
static const char * hwaccel
Definition ffplay.c:406
int ret
Definition ffplay.c:391
#define FF_DECODE_ERROR_INVALID_BITSTREAM
Definition frame.h:770
bitstream reader API header.
static int get_bits_left(GetBitContext *gb)
Definition get_bits.h:688
static unsigned int get_bits1(GetBitContext *s)
Definition get_bits.h:391
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition get_bits.h:337
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
Definition get_bits.h:373
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition get_bits.h:517
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
Definition avcodec.h:302
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
Definition codec.h:102
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition codec.h:98
@ AV_CODEC_ID_PRORES
Definition codec_id.h:198
@ AVDISCARD_ALL
discard all
Definition defs.h:248
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition error.h:64
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition error.h:61
#define AVERROR(e)
Definition error.h:45
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
Definition frame.h:702
#define AV_FRAME_FLAG_TOP_FIELD_FIRST
A flag to mark frames where the top field is displayed first if the content is interlaced.
Definition frame.h:707
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition log.h:231
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition log.h:216
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static int decode_slice_thread(AVCodecContext *avctx, void *arg, int slice_no, int threadnr)
Definition hqx.c:403
static const FFHWAccel * ffhwaccel(const AVHWAccel *codec)
#define HWACCEL_VULKAN(codec)
Definition hwconfig.h:78
#define HWACCEL_VIDEOTOOLBOX(codec)
Definition hwconfig.h:76
#define av_log2
Definition intmath.h:84
#define AV_RL32(p)
#define AV_RB32(p)
#define AV_RB16(p)
unsigned offset
Definition libaomenc.c:763
static av_cold int decode_init(AVCodecContext *avctx)
Definition 4xm.c:1000
static int decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
Definition 4xm.c:839
static av_cold int decode_close(AVCodecContext *avctx)
Definition aacdec.c:1222
#define HWACCEL_MAX
av_cold void ff_blockdsp_init(BlockDSPContext *c)
Definition blockdsp.c:58
av_cold void CBS_FUNC close(CodedBitstreamContext **ctx_ptr)
Close a context and free all internal state.
Definition cbs.c:118
av_cold void ff_permute_scantable(uint8_t dst[64], const uint8_t src[64], const uint8_t permutation[64])
Definition idctdsp.c:30
const char * arg
Definition jacosubdec.c:66
av_cold void ff_proresdsp_init(ProresDSPContext *dsp, int bits_per_raw_sample)
Definition proresdsp.c:172
Multithreading API for decoders.
#define av_always_inline
Definition attributes.h:72
#define av_cold
Definition attributes.h:117
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:97
version
Definition libkvazaar.c:313
static enum AVPixelFormat pix_fmts[]
Definition libkvazaar.c:296
static const uint16_t mask[17]
Definition lzw.c:38
#define FFMIN(a, b)
Definition macros.h:49
#define MKTAG(a, b, c, d)
Definition macros.h:55
void * av_calloc(size_t nmemb, size_t size)
Definition mem.c:370
Memory handling functions.
#define LOCAL_ALIGNED_32(t, v,...)
#define LOCAL_ALIGNED_16(t, v,...)
const char * av_color_space_name(enum AVColorSpace space)
Definition pixdesc.c:3884
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
Definition pixdesc.c:3851
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
Definition pixdesc.c:3818
#define AV_PIX_FMT_YUV444P12
Definition pixfmt.h:555
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition pixfmt.h:775
#define AV_PIX_FMT_YUVA444P10
Definition pixfmt.h:601
#define AV_PIX_FMT_YUV422P12
Definition pixfmt.h:553
#define AV_PIX_FMT_YUV422P10
Definition pixfmt.h:549
#define AV_PIX_FMT_YUVA422P10
Definition pixfmt.h:600
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Definition pixfmt.h:379
@ AV_PIX_FMT_VIDEOTOOLBOX
hardware decoding through Videotoolbox
Definition pixfmt.h:305
#define AV_PIX_FMT_YUVA422P12
Definition pixfmt.h:602
#define AV_PIX_FMT_YUVA444P12
Definition pixfmt.h:603
#define AV_PIX_FMT_YUV444P10
Definition pixfmt.h:551
const AVProfile ff_prores_profiles[]
Definition profiles.c:189
const uint8_t ff_prores_progressive_scan[64]
Definition proresdata.c:25
const uint8_t ff_prores_interlaced_scan[64]
Definition proresdata.c:36
#define FIRST_DC_CB
Definition proresdata.h:36
#define ALPHA_SHIFT_16_TO_12(alpha_val)
Definition proresdec.c:51
#define DECODE_CODEWORD(val, codebook, gb)
Definition proresdec.c:443
static av_always_inline int decode_dc_coeffs(GetBitContext *gb, int16_t *out, int blocks_per_slice)
Definition proresdec.c:481
static av_always_inline int decode_ac_coeffs(AVCodecContext *avctx, GetBitContext *gb, int16_t *out, int blocks_per_slice)
Definition proresdec.c:509
static void unpack_alpha_10(GetBitContext *gb, uint16_t *dst, int num_coeffs, const int num_bits)
Definition proresdec.c:115
static int decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
Definition proresdec.c:774
static av_cold int decode_close(AVCodecContext *avctx)
Definition proresdec.c:857
static const uint8_t run_to_cb[16]
Definition proresdec.c:506
static void unpack_alpha_12(GetBitContext *gb, uint16_t *dst, int num_coeffs, const int num_bits)
Definition proresdec.c:125
static av_cold int decode_init(AVCodecContext *avctx)
Definition proresdec.c:135
static int decode_picture(AVCodecContext *avctx)
Definition proresdec.c:755
#define ALPHA_SHIFT_16_TO_10(alpha_val)
Definition proresdec.c:49
static const uint8_t dc_codebook[7]
Definition proresdec.c:479
static void unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs, const int num_bits, const int decode_precision)
Definition proresdec.c:54
#define TOSIGNED(x)
Definition proresdec.c:475
static int decode_slice_luma(AVCodecContext *avctx, SliceContext *slice, uint16_t *dst, int dst_stride, const uint8_t *buf, unsigned buf_size, const int16_t *qmat)
Definition proresdec.c:548
static int describes_colour(int value, const char *name)
Whether a frame header colour value describes a colour.
Definition proresdec.c:197
static void decode_slice_alpha(const ProresContext *ctx, uint16_t *dst, int dst_stride, const uint8_t *buf, int buf_size, int blocks_per_slice)
Decode alpha slice plane.
Definition proresdec.c:622
static int decode_frame_header(ProresContext *ctx, const uint8_t *buf, const int data_size, AVCodecContext *avctx)
Definition proresdec.c:202
static const uint8_t lev_to_cb[10]
Definition proresdec.c:507
static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
Definition proresdec.c:652
#define ALPHA_SHIFT_8_TO_10(alpha_val)
Definition proresdec.c:50
static int decode_slice_chroma(AVCodecContext *avctx, SliceContext *slice, uint16_t *dst, int dst_stride, const uint8_t *buf, unsigned buf_size, const int16_t *qmat, int log2_blocks_per_mb)
Definition proresdec.c:582
static int decode_picture_header(AVCodecContext *avctx, const uint8_t *buf, const int buf_size)
Definition proresdec.c:335
#define ALPHA_SHIFT_8_TO_12(alpha_val)
Definition proresdec.c:52
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
void ff_thread_finish_setup(AVCodecContext *avctx)
If the codec defines update_thread_context(), call this when they are ready for the next thread to st...
const char * name
Definition qsvenc.c:142
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
Definition refstruct.c:121
const uint8_t * code
Definition spdifenc.c:433
unsigned int pos
Definition spdifenc.c:431
main external API structure.
Definition avcodec.h:443
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition avcodec.h:644
int width
picture width / height.
Definition avcodec.h:605
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition avcodec.h:685
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Definition avcodec.h:468
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
Definition avcodec.h:658
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
Definition avcodec.h:1429
int profile
profile
Definition avcodec.h:1646
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Definition avcodec.h:1581
enum AVColorSpace colorspace
YUV colorspace type.
Definition avcodec.h:672
int skip_alpha
Skip processing alpha if supported by codec.
Definition avcodec.h:1691
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
Definition avcodec.h:665
int flags
AV_CODEC_FLAG_*.
Definition avcodec.h:500
int(* execute2)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count)
The codec may call this to execute several independent things.
Definition avcodec.h:1638
void * priv_data
Definition avcodec.h:470
enum AVDiscard skip_frame
Skip decoding for selected frames.
Definition avcodec.h:1677
This structure describes decoded (raw) audio or video data.
Definition frame.h:479
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition frame.h:500
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition frame.h:524
This structure stores compressed data.
Definition packet.h:587
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
Definition packet.h:593
int size
Definition packet.h:611
uint8_t * data
Definition packet.h:610
enum AVPixelFormat pix_fmt
Definition proresdec.h:63
int frame_type
0 = progressive, 1 = tff, 2 = bff
Definition proresdec.h:48
unsigned mb_y
Definition proresdec.h:37
unsigned data_size
Definition proresdec.h:39
const uint8_t * data
Definition proresdec.h:35
unsigned mb_count
Definition proresdec.h:38
unsigned mb_x
Definition proresdec.h:36
uint8_t run
Definition svq3.c:207
uint8_t level
Definition svq3.c:208
#define ff_dlog(a,...)
#define av_freep(p)
#define av_log(a,...)
static void error(const char *err)
#define src
Definition vp8dsp.c:248
#define height
Definition dsp.h:99
#define width
Definition dsp.h:99