FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/proresdec.c
Date: 2026-09-16 18:55:35
Exec Total Coverage
Lines: 341 425 80.2%
Functions: 14 16 87.5%
Branches: 180 261 69.0%

Line Branch Exec Source
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"
33 #include "libavutil/mem_internal.h"
34
35 #include "avcodec.h"
36 #include "codec_internal.h"
37 #include "decode.h"
38 #define CACHED_BITSTREAM_READER 1
39 #include "get_bits.h"
40 #include "hwaccel_internal.h"
41 #include "hwconfig.h"
42 #include "idctdsp.h"
43 #include "profiles.h"
44 #include "proresdec.h"
45 #include "proresdata.h"
46 #include "thread.h"
47
48 #define ALPHA_SHIFT_16_TO_10(alpha_val) (alpha_val >> 6)
49 #define ALPHA_SHIFT_8_TO_10(alpha_val) ((alpha_val << 2) | (alpha_val >> 6))
50 #define ALPHA_SHIFT_16_TO_12(alpha_val) (alpha_val >> 4)
51 #define ALPHA_SHIFT_8_TO_12(alpha_val) ((alpha_val << 4) | (alpha_val >> 4))
52
53 3060 static void inline unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs,
54 const int num_bits, const int decode_precision) {
55 3060 const int mask = (1 << num_bits) - 1;
56 int i, idx, val, alpha_val;
57
58 3060 idx = 0;
59 3060 alpha_val = mask;
60 do {
61 do {
62
2/2
✓ Branch 1 taken 22212 times.
✓ Branch 2 taken 44560 times.
66772 if (get_bits1(gb)) {
63 22212 val = get_bits(gb, num_bits);
64 } else {
65 int sign;
66
1/2
✓ Branch 0 taken 44560 times.
✗ Branch 1 not taken.
44560 val = get_bits(gb, num_bits == 16 ? 7 : 4);
67 44560 sign = val & 1;
68 44560 val = (val + 2) >> 1;
69
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 44546 times.
44560 if (sign)
70 14 val = -val;
71 }
72 66772 alpha_val = (alpha_val + val) & mask;
73
1/2
✓ Branch 0 taken 66772 times.
✗ Branch 1 not taken.
66772 if (num_bits == 16) {
74
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 66772 times.
66772 if (decode_precision == 10) {
75 dst[idx++] = ALPHA_SHIFT_16_TO_10(alpha_val);
76 } else { /* 12b */
77 66772 dst[idx++] = ALPHA_SHIFT_16_TO_12(alpha_val);
78 }
79 } else {
80 if (decode_precision == 10) {
81 dst[idx++] = ALPHA_SHIFT_8_TO_10(alpha_val);
82 } else { /* 12b */
83 dst[idx++] = ALPHA_SHIFT_8_TO_12(alpha_val);
84 }
85 }
86
2/2
✓ Branch 0 taken 89 times.
✓ Branch 1 taken 66683 times.
66772 if (idx >= num_coeffs)
87 89 break;
88
4/4
✓ Branch 1 taken 23158 times.
✓ Branch 2 taken 43525 times.
✓ Branch 4 taken 10424 times.
✓ Branch 5 taken 12734 times.
66683 } while (get_bits_left(gb)>0 && get_bits1(gb));
89 56348 val = get_bits(gb, 4);
90
2/2
✓ Branch 0 taken 55377 times.
✓ Branch 1 taken 971 times.
56348 if (!val)
91 55377 val = get_bits(gb, 11);
92
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 56334 times.
56348 if (idx + val > num_coeffs)
93 14 val = num_coeffs - idx;
94
1/2
✓ Branch 0 taken 56348 times.
✗ Branch 1 not taken.
56348 if (num_bits == 16) {
95
2/2
✓ Branch 0 taken 6200108 times.
✓ Branch 1 taken 56348 times.
6256456 for (i = 0; i < val; i++) {
96
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6200108 times.
6200108 if (decode_precision == 10) {
97 dst[idx++] = ALPHA_SHIFT_16_TO_10(alpha_val);
98 } else { /* 12b */
99 6200108 dst[idx++] = ALPHA_SHIFT_16_TO_12(alpha_val);
100 }
101 }
102 } else {
103 for (i = 0; i < val; i++) {
104 if (decode_precision == 10) {
105 dst[idx++] = ALPHA_SHIFT_8_TO_10(alpha_val);
106 } else { /* 12b */
107 dst[idx++] = ALPHA_SHIFT_8_TO_12(alpha_val);
108 }
109 }
110 }
111
2/2
✓ Branch 0 taken 53288 times.
✓ Branch 1 taken 3060 times.
56348 } while (idx < num_coeffs);
112 3060 }
113
114 static void unpack_alpha_10(GetBitContext *gb, uint16_t *dst, int num_coeffs,
115 const int num_bits)
116 {
117 if (num_bits == 16) {
118 unpack_alpha(gb, dst, num_coeffs, 16, 10);
119 } else { /* 8 bits alpha */
120 unpack_alpha(gb, dst, num_coeffs, 8, 10);
121 }
122 }
123
124 3060 static void unpack_alpha_12(GetBitContext *gb, uint16_t *dst, int num_coeffs,
125 const int num_bits)
126 {
127
1/2
✓ Branch 0 taken 3060 times.
✗ Branch 1 not taken.
3060 if (num_bits == 16) {
128 3060 unpack_alpha(gb, dst, num_coeffs, 16, 12);
129 } else { /* 8 bits alpha */
130 unpack_alpha(gb, dst, num_coeffs, 8, 12);
131 }
132 3060 }
133
134 76 static av_cold int decode_init(AVCodecContext *avctx)
135 {
136 76 ProresContext *ctx = avctx->priv_data;
137
138 76 avctx->bits_per_raw_sample = 10;
139
140
5/7
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 21 times.
✓ Branch 3 taken 15 times.
✓ Branch 4 taken 24 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
76 switch (avctx->codec_tag) {
141 14 case MKTAG('a','p','c','o'):
142 14 avctx->profile = AV_PROFILE_PRORES_PROXY;
143 14 break;
144 2 case MKTAG('a','p','c','s'):
145 2 avctx->profile = AV_PROFILE_PRORES_LT;
146 2 break;
147 21 case MKTAG('a','p','c','n'):
148 21 avctx->profile = AV_PROFILE_PRORES_STANDARD;
149 21 break;
150 15 case MKTAG('a','p','c','h'):
151 15 avctx->profile = AV_PROFILE_PRORES_HQ;
152 15 break;
153 24 case MKTAG('a','p','4','h'):
154 24 avctx->profile = AV_PROFILE_PRORES_4444;
155 24 avctx->bits_per_raw_sample = 12;
156 24 break;
157 case MKTAG('a','p','4','x'):
158 avctx->profile = AV_PROFILE_PRORES_XQ;
159 avctx->bits_per_raw_sample = 12;
160 break;
161 default:
162 avctx->profile = AV_PROFILE_UNKNOWN;
163 av_log(avctx, AV_LOG_WARNING, "Unknown prores profile %d\n", avctx->codec_tag);
164 }
165
166 152 ctx->unpack_alpha = avctx->bits_per_raw_sample == 10 ?
167
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 24 times.
76 unpack_alpha_10 : unpack_alpha_12;
168
169 76 av_log(avctx, AV_LOG_DEBUG,
170 "Auto bitdepth precision. Use %db decoding based on codec tag.\n",
171 avctx->bits_per_raw_sample);
172
173 76 ff_blockdsp_init(&ctx->bdsp);
174 76 ff_proresdsp_init(&ctx->prodsp, avctx->bits_per_raw_sample);
175
176 76 ff_permute_scantable(ctx->progressive_scan, ff_prores_progressive_scan,
177 76 ctx->prodsp.idct_permutation);
178 76 ff_permute_scantable(ctx->interlaced_scan, ff_prores_interlaced_scan,
179 76 ctx->prodsp.idct_permutation);
180
181 76 ctx->pix_fmt = AV_PIX_FMT_NONE;
182
183 76 return 0;
184 }
185
186 1065 static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
187 const int data_size, AVCodecContext *avctx)
188 {
189 1065 int hdr_size, width, height, flags, dimensions_changed = 0;
190 int version;
191 const uint8_t *ptr;
192 enum AVPixelFormat pix_fmt;
193 1065 int old_frame_type = ctx->frame_type;
194
195 1065 hdr_size = AV_RB16(buf);
196 ff_dlog(avctx, "header size %d\n", hdr_size);
197
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1065 times.
1065 if (hdr_size > data_size) {
198 av_log(avctx, AV_LOG_ERROR, "error, wrong header size\n");
199 return AVERROR_INVALIDDATA;
200 }
201
202 1065 version = AV_RB16(buf + 2);
203 ff_dlog(avctx, "%.4s version %d\n", buf+4, version);
204
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1065 times.
1065 if (version > 1) {
205 av_log(avctx, AV_LOG_ERROR, "unsupported version: %d\n", version);
206 return AVERROR_PATCHWELCOME;
207 }
208
209 1065 width = AV_RB16(buf + 8);
210 1065 height = AV_RB16(buf + 10);
211
212
2/4
✓ Branch 0 taken 1065 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1065 times.
1065 if (width != avctx->width || height != avctx->height) {
213 int ret;
214
215 av_log(avctx, AV_LOG_WARNING, "picture resolution change: %dx%d -> %dx%d\n",
216 avctx->width, avctx->height, width, height);
217 if ((ret = ff_set_dimensions(avctx, width, height)) < 0)
218 return ret;
219 dimensions_changed = 1;
220 }
221
222 1065 ctx->frame_type = (buf[12] >> 2) & 3;
223 1065 ctx->alpha_info = buf[17] & 0xf;
224
225
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1065 times.
1065 if (ctx->alpha_info > 2) {
226 av_log(avctx, AV_LOG_ERROR, "Invalid alpha mode %d\n", ctx->alpha_info);
227 return AVERROR_INVALIDDATA;
228 }
229
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1060 times.
1065 if (avctx->skip_alpha) ctx->alpha_info = 0;
230
231 ff_dlog(avctx, "frame type %d\n", ctx->frame_type);
232
233
2/2
✓ Branch 0 taken 633 times.
✓ Branch 1 taken 432 times.
1065 if (ctx->frame_type == 0) {
234 633 ctx->scan = ctx->progressive_scan; // permuted
235 } else {
236 432 ctx->scan = ctx->interlaced_scan; // permuted
237 432 ctx->frame->flags |= AV_FRAME_FLAG_INTERLACED;
238
2/2
✓ Branch 0 taken 408 times.
✓ Branch 1 taken 24 times.
432 if (ctx->frame_type == 1)
239 408 ctx->frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
240 }
241
242
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1060 times.
1065 if (ctx->alpha_info) {
243
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (avctx->bits_per_raw_sample == 10) {
244 pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUVA444P10 : AV_PIX_FMT_YUVA422P10;
245 } else { /* 12b */
246
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUVA444P12 : AV_PIX_FMT_YUVA422P12;
247 }
248 } else {
249
2/2
✓ Branch 0 taken 647 times.
✓ Branch 1 taken 413 times.
1060 if (avctx->bits_per_raw_sample == 10) {
250
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 647 times.
647 pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P10 : AV_PIX_FMT_YUV422P10;
251 } else { /* 12b */
252
1/2
✓ Branch 0 taken 413 times.
✗ Branch 1 not taken.
413 pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P12 : AV_PIX_FMT_YUV422P12;
253 }
254 }
255
256
3/4
✓ Branch 0 taken 992 times.
✓ Branch 1 taken 73 times.
✓ Branch 2 taken 992 times.
✗ Branch 3 not taken.
1065 if (pix_fmt != ctx->pix_fmt || dimensions_changed ||
257
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 992 times.
992 ctx->frame_type != old_frame_type) {
258 #define HWACCEL_MAX (CONFIG_PRORES_VIDEOTOOLBOX_HWACCEL + CONFIG_PRORES_VULKAN_HWACCEL)
259 #if HWACCEL_MAX
260 enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;
261 int ret;
262
263 ctx->pix_fmt = pix_fmt;
264
265 #if CONFIG_PRORES_VIDEOTOOLBOX_HWACCEL
266 *fmtp++ = AV_PIX_FMT_VIDEOTOOLBOX;
267 #endif
268 #if CONFIG_PRORES_VULKAN_HWACCEL
269 *fmtp++ = AV_PIX_FMT_VULKAN;
270 #endif
271 *fmtp++ = ctx->pix_fmt;
272 *fmtp = AV_PIX_FMT_NONE;
273
274 if ((ret = ff_get_format(avctx, pix_fmts)) < 0)
275 return ret;
276
277 avctx->pix_fmt = ret;
278 #else
279 73 avctx->pix_fmt = ctx->pix_fmt = pix_fmt;
280 #endif
281 }
282
283 1065 avctx->color_primaries = buf[14];
284 1065 avctx->color_trc = buf[15];
285 1065 avctx->colorspace = buf[16];
286 1065 avctx->color_range = AVCOL_RANGE_MPEG;
287
288 1065 ptr = buf + 20;
289 1065 flags = buf[19];
290 ff_dlog(avctx, "flags %x\n", flags);
291
292
1/2
✓ Branch 0 taken 1065 times.
✗ Branch 1 not taken.
1065 if (flags & 2) {
293
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1065 times.
1065 if(buf + data_size - ptr < 64) {
294 av_log(avctx, AV_LOG_ERROR, "Header truncated\n");
295 return AVERROR_INVALIDDATA;
296 }
297 1065 ff_permute_scantable(ctx->qmat_luma, ctx->prodsp.idct_permutation, ptr);
298 1065 ptr += 64;
299 } else {
300 memset(ctx->qmat_luma, 4, 64);
301 }
302
303
1/2
✓ Branch 0 taken 1065 times.
✗ Branch 1 not taken.
1065 if (flags & 1) {
304
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1065 times.
1065 if(buf + data_size - ptr < 64) {
305 av_log(avctx, AV_LOG_ERROR, "Header truncated\n");
306 return AVERROR_INVALIDDATA;
307 }
308 1065 ff_permute_scantable(ctx->qmat_chroma, ctx->prodsp.idct_permutation, ptr);
309 } else {
310 memcpy(ctx->qmat_chroma, ctx->qmat_luma, 64);
311 }
312
313 1065 return hdr_size;
314 }
315
316 1437 static int decode_picture_header(AVCodecContext *avctx, const uint8_t *buf, const int buf_size)
317 {
318 1437 ProresContext *ctx = avctx->priv_data;
319 int i, hdr_size, slice_count;
320 unsigned pic_data_size;
321 int log2_slice_mb_width, log2_slice_mb_height;
322 int slice_mb_count, mb_x, mb_y;
323 const uint8_t *data_ptr, *index_ptr;
324
325 1437 hdr_size = buf[0] >> 3;
326
2/4
✓ Branch 0 taken 1437 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1437 times.
1437 if (hdr_size < 8 || hdr_size > buf_size) {
327 av_log(avctx, AV_LOG_ERROR, "error, wrong picture header size\n");
328 return AVERROR_INVALIDDATA;
329 }
330
331 1437 pic_data_size = AV_RB32(buf + 1);
332
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1437 times.
1437 if (pic_data_size > buf_size) {
333 av_log(avctx, AV_LOG_ERROR, "error, wrong picture data size\n");
334 return AVERROR_INVALIDDATA;
335 }
336
337 1437 log2_slice_mb_width = buf[7] >> 4;
338 1437 log2_slice_mb_height = buf[7] & 0xF;
339
2/4
✓ Branch 0 taken 1437 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1437 times.
1437 if (log2_slice_mb_width > 3 || log2_slice_mb_height) {
340 av_log(avctx, AV_LOG_ERROR, "unsupported slice resolution: %dx%d\n",
341 1 << log2_slice_mb_width, 1 << log2_slice_mb_height);
342 return AVERROR_INVALIDDATA;
343 }
344
345 1437 ctx->slice_mb_width = 1 << log2_slice_mb_width;
346 1437 ctx->slice_mb_height = 1 << log2_slice_mb_height;
347
348 1437 ctx->mb_width = (avctx->width + 15) >> 4;
349
2/2
✓ Branch 0 taken 828 times.
✓ Branch 1 taken 609 times.
1437 if (ctx->frame_type)
350 828 ctx->mb_height = (avctx->height + 31) >> 5;
351 else
352 609 ctx->mb_height = (avctx->height + 15) >> 4;
353
354 // QT ignores the written value
355 // slice_count = AV_RB16(buf + 5);
356 1437 slice_count = ctx->mb_height * ((ctx->mb_width >> log2_slice_mb_width) +
357 1437 av_popcount(ctx->mb_width & ctx->slice_mb_width - 1));
358
359
3/4
✓ Branch 0 taken 1406 times.
✓ Branch 1 taken 31 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1406 times.
1437 if (ctx->slice_count != slice_count || !ctx->slices) {
360 31 av_freep(&ctx->slices);
361 31 ctx->slice_count = 0;
362 31 ctx->slices = av_calloc(slice_count, sizeof(*ctx->slices));
363
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 31 times.
31 if (!ctx->slices)
364 return AVERROR(ENOMEM);
365 31 ctx->slice_count = slice_count;
366 }
367
368
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1437 times.
1437 if (!slice_count)
369 return AVERROR(EINVAL);
370
371
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1437 times.
1437 if (hdr_size + slice_count*2 > buf_size) {
372 av_log(avctx, AV_LOG_ERROR, "error, wrong slice count\n");
373 return AVERROR_INVALIDDATA;
374 }
375
376 // parse slice information
377 1437 index_ptr = buf + hdr_size;
378 1437 data_ptr = index_ptr + slice_count*2;
379
380 1437 slice_mb_count = ctx->slice_mb_width;
381 1437 mb_x = 0;
382 1437 mb_y = 0;
383
384
2/2
✓ Branch 0 taken 74774 times.
✓ Branch 1 taken 1437 times.
76211 for (i = 0; i < slice_count; i++) {
385 74774 SliceContext *slice = &ctx->slices[i];
386
387 74774 slice->data = data_ptr;
388 74774 data_ptr += AV_RB16(index_ptr + i*2);
389
390
2/2
✓ Branch 0 taken 29766 times.
✓ Branch 1 taken 74774 times.
104540 while (ctx->mb_width - mb_x < slice_mb_count)
391 29766 slice_mb_count >>= 1;
392
393 74774 slice->mb_x = mb_x;
394 74774 slice->mb_y = mb_y;
395 74774 slice->mb_count = slice_mb_count;
396 74774 slice->data_size = data_ptr - slice->data;
397
398
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 74774 times.
74774 if (slice->data_size < 6) {
399 av_log(avctx, AV_LOG_ERROR, "error, wrong slice data size\n");
400 return AVERROR_INVALIDDATA;
401 }
402
403 74774 mb_x += slice_mb_count;
404
2/2
✓ Branch 0 taken 15735 times.
✓ Branch 1 taken 59039 times.
74774 if (mb_x == ctx->mb_width) {
405 15735 slice_mb_count = ctx->slice_mb_width;
406 15735 mb_x = 0;
407 15735 mb_y++;
408 }
409
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 74774 times.
74774 if (data_ptr > buf + buf_size) {
410 av_log(avctx, AV_LOG_ERROR, "error, slice out of bounds\n");
411 return AVERROR_INVALIDDATA;
412 }
413 }
414
415
2/4
✓ Branch 0 taken 1437 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1437 times.
1437 if (mb_x || mb_y != ctx->mb_height) {
416 av_log(avctx, AV_LOG_ERROR, "error wrong mb count y %d h %d\n",
417 mb_y, ctx->mb_height);
418 return AVERROR_INVALIDDATA;
419 }
420
421 1437 return pic_data_size;
422 }
423
424 #define DECODE_CODEWORD(val, codebook, gb) \
425 do { \
426 unsigned int rice_order, exp_order, switch_bits; \
427 unsigned int q, buf, bits; \
428 \
429 buf = show_bits(gb, 32); /* We really need 32 bits */ \
430 \
431 /* number of bits to switch between rice and exp golomb */ \
432 switch_bits = codebook & 3; \
433 rice_order = codebook >> 5; \
434 exp_order = (codebook >> 2) & 7; \
435 \
436 q = 31 - av_log2(buf); \
437 \
438 if (q > switch_bits) { /* exp golomb */ \
439 bits = exp_order - switch_bits + (q<<1); \
440 if (bits > 31) \
441 return AVERROR_INVALIDDATA; \
442 val = (buf >> (32 - bits)) - (1 << exp_order) + \
443 ((switch_bits + 1) << rice_order); \
444 skip_bits(gb, bits); \
445 } else if (rice_order) { \
446 bits = q + 1 + rice_order; \
447 val = (q << rice_order) + \
448 ((buf >> (32 - bits)) & ((1u << rice_order) - 1)); \
449 skip_bits(gb, bits); \
450 } else { \
451 val = q; \
452 skip_bits(gb, q + 1); \
453 } \
454 } while (0)
455
456 #define TOSIGNED(x) (((x) >> 1) ^ (-((x) & 1)))
457
458 #define FIRST_DC_CB 0xB8
459
460 static const uint8_t dc_codebook[7] = { 0x04, 0x28, 0x28, 0x4D, 0x4D, 0x70, 0x70};
461
462 223314 static av_always_inline int decode_dc_coeffs(GetBitContext *gb, int16_t *out,
463 int blocks_per_slice)
464 {
465 int16_t prev_dc;
466 int code, i, sign;
467
468
4/6
✓ Branch 1 taken 194784 times.
✓ Branch 2 taken 28530 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 194784 times.
✓ Branch 6 taken 28530 times.
✗ Branch 7 not taken.
223314 DECODE_CODEWORD(code, FIRST_DC_CB, gb);
469 223314 prev_dc = TOSIGNED(code);
470 223314 out[0] = prev_dc;
471
472 223314 out += 64; // dc coeff for the next block
473
474 223314 code = 5;
475 223314 sign = 0;
476
2/2
✓ Branch 0 taken 4049766 times.
✓ Branch 1 taken 223314 times.
4273080 for (i = 1; i < blocks_per_slice; i++, out += 64) {
477
5/6
✓ Branch 1 taken 2694902 times.
✓ Branch 2 taken 1354864 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2694902 times.
✓ Branch 6 taken 301338 times.
✓ Branch 7 taken 1053526 times.
4049766 DECODE_CODEWORD(code, dc_codebook[FFMIN(code, 6U)], gb);
478
2/2
✓ Branch 0 taken 2870012 times.
✓ Branch 1 taken 1179754 times.
4049766 if(code) sign ^= -(code & 1);
479 1179754 else sign = 0;
480 4049766 prev_dc += (((code + 1) >> 1) ^ sign) - sign;
481 4049766 out[0] = prev_dc;
482 }
483 223314 return 0;
484 }
485
486 // adaptive codebook switching lut according to previous run/level values
487 static const uint8_t run_to_cb[16] = { 0x06, 0x06, 0x05, 0x05, 0x04, 0x29, 0x29, 0x29, 0x29, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x4C };
488 static const uint8_t lev_to_cb[10] = { 0x04, 0x0A, 0x05, 0x06, 0x04, 0x28, 0x28, 0x28, 0x28, 0x4C };
489
490 223314 static av_always_inline int decode_ac_coeffs(AVCodecContext *avctx, GetBitContext *gb,
491 int16_t *out, int blocks_per_slice)
492 {
493 223314 const ProresContext *ctx = avctx->priv_data;
494 int block_mask, sign;
495 unsigned pos, run, level;
496 int max_coeffs, i, left_bits;
497 223314 int log2_block_count = av_log2(blocks_per_slice);
498
499 223314 run = 4;
500 223314 level = 2;
501
502 223314 max_coeffs = 64 << log2_block_count;
503 223314 block_mask = blocks_per_slice - 1;
504
505 223314 for (pos = block_mask;;) {
506 82640304 left_bits = get_bits_left(gb);
507
6/6
✓ Branch 0 taken 82601981 times.
✓ Branch 1 taken 38323 times.
✓ Branch 2 taken 771624 times.
✓ Branch 3 taken 81830357 times.
✓ Branch 5 taken 586633 times.
✓ Branch 6 taken 184991 times.
82640304 if (left_bits <= 0 || (left_bits < 32 && !show_bits(gb, left_bits)))
508 break;
509
510
5/6
✓ Branch 1 taken 7719704 times.
✓ Branch 2 taken 74697286 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7719704 times.
✓ Branch 6 taken 2313063 times.
✓ Branch 7 taken 72384223 times.
82416990 DECODE_CODEWORD(run, run_to_cb[FFMIN(run, 15)], gb);
511 82416990 pos += run + 1;
512
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 82416990 times.
82416990 if (pos >= max_coeffs) {
513 av_log(avctx, AV_LOG_ERROR, "ac tex damaged %d, %d\n", pos, max_coeffs);
514 return AVERROR_INVALIDDATA;
515 }
516
517
5/6
✓ Branch 1 taken 44505518 times.
✓ Branch 2 taken 37911472 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 44505518 times.
✓ Branch 6 taken 9270643 times.
✓ Branch 7 taken 28640829 times.
82416990 DECODE_CODEWORD(level, lev_to_cb[FFMIN(level, 9)], gb);
518 82416990 level += 1;
519
520 82416990 i = pos >> log2_block_count;
521
522 82416990 sign = -(int)get_bits1(gb);
523 82416990 out[((pos & block_mask) << 6) + ctx->scan[i]] = ((level ^ sign) - sign);
524 }
525
526 223314 return 0;
527 }
528
529 74774 static int decode_slice_luma(AVCodecContext *avctx, SliceContext *slice,
530 uint16_t *dst, int dst_stride,
531 const uint8_t *buf, unsigned buf_size,
532 const int16_t *qmat)
533 {
534 74774 const ProresContext *ctx = avctx->priv_data;
535 74774 LOCAL_ALIGNED_32(int16_t, blocks, [8*4*64]);
536 int16_t *block;
537 GetBitContext gb;
538 74774 int i, blocks_per_slice = slice->mb_count<<2;
539 int ret;
540
541
2/2
✓ Branch 0 taken 1805400 times.
✓ Branch 1 taken 74774 times.
1880174 for (i = 0; i < blocks_per_slice; i++)
542 1805400 ctx->bdsp.clear_block(blocks+(i<<6));
543
544 74774 init_get_bits(&gb, buf, buf_size << 3);
545
546
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 74774 times.
74774 if ((ret = decode_dc_coeffs(&gb, blocks, blocks_per_slice)) < 0)
547 return ret;
548
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 74774 times.
74774 if ((ret = decode_ac_coeffs(avctx, &gb, blocks, blocks_per_slice)) < 0)
549 return ret;
550
551 74774 block = blocks;
552
2/2
✓ Branch 0 taken 451350 times.
✓ Branch 1 taken 74774 times.
526124 for (i = 0; i < slice->mb_count; i++) {
553 451350 ctx->prodsp.idct_put(dst, dst_stride, block+(0<<6), qmat);
554 451350 ctx->prodsp.idct_put(dst +8, dst_stride, block+(1<<6), qmat);
555 451350 ctx->prodsp.idct_put(dst+4*dst_stride , dst_stride, block+(2<<6), qmat);
556 451350 ctx->prodsp.idct_put(dst+4*dst_stride+8, dst_stride, block+(3<<6), qmat);
557 451350 block += 4*64;
558 451350 dst += 16;
559 }
560 74774 return 0;
561 }
562
563 149548 static int decode_slice_chroma(AVCodecContext *avctx, SliceContext *slice,
564 uint16_t *dst, int dst_stride,
565 const uint8_t *buf, unsigned buf_size,
566 const int16_t *qmat, int log2_blocks_per_mb)
567 {
568 149548 ProresContext *ctx = avctx->priv_data;
569 149548 LOCAL_ALIGNED_32(int16_t, blocks, [8*4*64]);
570 int16_t *block;
571 GetBitContext gb;
572 149548 int i, j, blocks_per_slice = slice->mb_count << log2_blocks_per_mb;
573 int ret;
574
575
2/2
✓ Branch 0 taken 2480640 times.
✓ Branch 1 taken 149548 times.
2630188 for (i = 0; i < blocks_per_slice; i++)
576 2480640 ctx->bdsp.clear_block(blocks+(i<<6));
577
578 /* Some encodes have empty chroma scans to simulate grayscale */
579
2/2
✓ Branch 0 taken 148540 times.
✓ Branch 1 taken 1008 times.
149548 if (buf_size) {
580 148540 init_get_bits(&gb, buf, buf_size << 3);
581
582
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 148540 times.
148540 if ((ret = decode_dc_coeffs(&gb, blocks, blocks_per_slice)) < 0)
583 return ret;
584
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 148540 times.
148540 if ((ret = decode_ac_coeffs(avctx, &gb, blocks, blocks_per_slice)) < 0)
585 return ret;
586 }
587
588 149548 block = blocks;
589
2/2
✓ Branch 0 taken 902700 times.
✓ Branch 1 taken 149548 times.
1052248 for (i = 0; i < slice->mb_count; i++) {
590
2/2
✓ Branch 0 taken 1240320 times.
✓ Branch 1 taken 902700 times.
2143020 for (j = 0; j < log2_blocks_per_mb; j++) {
591 1240320 ctx->prodsp.idct_put(dst, dst_stride, block+(0<<6), qmat);
592 1240320 ctx->prodsp.idct_put(dst+4*dst_stride, dst_stride, block+(1<<6), qmat);
593 1240320 block += 2*64;
594 1240320 dst += 8;
595 }
596 }
597 149548 return 0;
598 }
599
600 /**
601 * Decode alpha slice plane.
602 */
603 3060 static void decode_slice_alpha(const ProresContext *ctx,
604 uint16_t *dst, int dst_stride,
605 const uint8_t *buf, int buf_size,
606 int blocks_per_slice)
607 {
608 GetBitContext gb;
609 int i;
610 3060 LOCAL_ALIGNED_32(int16_t, blocks, [8*4*64]);
611 int16_t *block;
612
613
2/2
✓ Branch 0 taken 97920 times.
✓ Branch 1 taken 3060 times.
100980 for (i = 0; i < blocks_per_slice<<2; i++)
614 97920 ctx->bdsp.clear_block(blocks+(i<<6));
615
616 3060 init_get_bits(&gb, buf, buf_size << 3);
617
618
1/2
✓ Branch 0 taken 3060 times.
✗ Branch 1 not taken.
3060 if (ctx->alpha_info == 2) {
619 3060 ctx->unpack_alpha(&gb, blocks, blocks_per_slice * 4 * 64, 16);
620 } else {
621 ctx->unpack_alpha(&gb, blocks, blocks_per_slice * 4 * 64, 8);
622 }
623
624 3060 block = blocks;
625
626
2/2
✓ Branch 0 taken 48960 times.
✓ Branch 1 taken 3060 times.
52020 for (i = 0; i < 16; i++) {
627 48960 memcpy(dst, block, 16 * blocks_per_slice * sizeof(*dst));
628 48960 dst += dst_stride >> 1;
629 48960 block += 16 * blocks_per_slice;
630 }
631 3060 }
632
633 74774 static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
634 {
635 74774 const ProresContext *ctx = avctx->priv_data;
636 74774 SliceContext *slice = &ctx->slices[jobnr];
637 74774 const uint8_t *buf = slice->data;
638 74774 AVFrame *pic = ctx->frame;
639 int i, hdr_size, qscale, log2_chroma_blocks_per_mb;
640 int luma_stride, chroma_stride;
641 int y_data_size, u_data_size, v_data_size, a_data_size, offset;
642 uint8_t *dest_y, *dest_u, *dest_v;
643 74774 LOCAL_ALIGNED_16(int16_t, qmat_luma_scaled, [64]);
644 74774 LOCAL_ALIGNED_16(int16_t, qmat_chroma_scaled,[64]);
645 int mb_x_shift;
646 int ret;
647
648 74774 slice->ret = -1;
649 //av_log(avctx, AV_LOG_INFO, "slice %d mb width %d mb x %d y %d\n",
650 // jobnr, slice->mb_count, slice->mb_x, slice->mb_y);
651
652 // slice header
653 74774 hdr_size = buf[0] >> 3;
654 74774 qscale = av_clip(buf[1], 1, 224);
655
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 74774 times.
74774 qscale = qscale > 128 ? qscale - 96 << 2: qscale;
656 74774 y_data_size = AV_RB16(buf + 2);
657 74774 u_data_size = AV_RB16(buf + 4);
658 74774 v_data_size = slice->data_size - y_data_size - u_data_size - hdr_size;
659
2/2
✓ Branch 0 taken 6120 times.
✓ Branch 1 taken 68654 times.
74774 if (hdr_size > 7) v_data_size = AV_RB16(buf + 6);
660 74774 a_data_size = slice->data_size - y_data_size - u_data_size -
661 74774 v_data_size - hdr_size;
662
663
3/6
✓ Branch 0 taken 74774 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 74774 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 74774 times.
✗ Branch 5 not taken.
74774 if (y_data_size < 0 || u_data_size < 0 || v_data_size < 0
664
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 74774 times.
74774 || hdr_size+y_data_size+u_data_size+v_data_size > slice->data_size){
665 av_log(avctx, AV_LOG_ERROR, "invalid plane data size\n");
666 return AVERROR_INVALIDDATA;
667 }
668
669 74774 buf += hdr_size;
670
671
2/2
✓ Branch 0 taken 4785536 times.
✓ Branch 1 taken 74774 times.
4860310 for (i = 0; i < 64; i++) {
672 4785536 qmat_luma_scaled [i] = ctx->qmat_luma [i] * qscale;
673 4785536 qmat_chroma_scaled[i] = ctx->qmat_chroma[i] * qscale;
674 }
675
676
2/2
✓ Branch 0 taken 38094 times.
✓ Branch 1 taken 36680 times.
74774 if (ctx->frame_type == 0) {
677 38094 luma_stride = pic->linesize[0];
678 38094 chroma_stride = pic->linesize[1];
679 } else {
680 36680 luma_stride = pic->linesize[0] << 1;
681 36680 chroma_stride = pic->linesize[1] << 1;
682 }
683
684
2/4
✓ Branch 0 taken 74774 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 74774 times.
✗ Branch 3 not taken.
74774 if (avctx->pix_fmt == AV_PIX_FMT_YUV444P10 || avctx->pix_fmt == AV_PIX_FMT_YUVA444P10 ||
685
4/4
✓ Branch 0 taken 49414 times.
✓ Branch 1 taken 25360 times.
✓ Branch 2 taken 3060 times.
✓ Branch 3 taken 46354 times.
74774 avctx->pix_fmt == AV_PIX_FMT_YUV444P12 || avctx->pix_fmt == AV_PIX_FMT_YUVA444P12) {
686 28420 mb_x_shift = 5;
687 28420 log2_chroma_blocks_per_mb = 2;
688 } else {
689 46354 mb_x_shift = 4;
690 46354 log2_chroma_blocks_per_mb = 1;
691 }
692
693 74774 offset = (slice->mb_y << 4) * luma_stride + (slice->mb_x << 5);
694 74774 dest_y = pic->data[0] + offset;
695 74774 dest_u = pic->data[1] + (slice->mb_y << 4) * chroma_stride + (slice->mb_x << mb_x_shift);
696 74774 dest_v = pic->data[2] + (slice->mb_y << 4) * chroma_stride + (slice->mb_x << mb_x_shift);
697
698
4/4
✓ Branch 0 taken 36680 times.
✓ Branch 1 taken 38094 times.
✓ Branch 2 taken 18340 times.
✓ Branch 3 taken 18340 times.
74774 if (ctx->frame_type && ctx->first_field ^ !!(ctx->frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)) {
699 18340 dest_y += pic->linesize[0];
700 18340 dest_u += pic->linesize[1];
701 18340 dest_v += pic->linesize[2];
702 18340 offset += pic->linesize[3];
703 }
704
705 74774 ret = decode_slice_luma(avctx, slice, (uint16_t*)dest_y, luma_stride,
706 buf, y_data_size, qmat_luma_scaled);
707
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 74774 times.
74774 if (ret < 0)
708 return ret;
709
710
1/2
✓ Branch 0 taken 74774 times.
✗ Branch 1 not taken.
74774 if (!(avctx->flags & AV_CODEC_FLAG_GRAY)) {
711 74774 ret = decode_slice_chroma(avctx, slice, (uint16_t*)dest_u, chroma_stride,
712 buf + y_data_size, u_data_size,
713 qmat_chroma_scaled, log2_chroma_blocks_per_mb);
714
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 74774 times.
74774 if (ret < 0)
715 return ret;
716
717 74774 ret = decode_slice_chroma(avctx, slice, (uint16_t*)dest_v, chroma_stride,
718 74774 buf + y_data_size + u_data_size, v_data_size,
719 qmat_chroma_scaled, log2_chroma_blocks_per_mb);
720
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 74774 times.
74774 if (ret < 0)
721 return ret;
722 }
723
724 /* decode alpha plane if available */
725
4/6
✓ Branch 0 taken 3060 times.
✓ Branch 1 taken 71714 times.
✓ Branch 2 taken 3060 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3060 times.
✗ Branch 5 not taken.
74774 if (ctx->alpha_info && pic->data[3] && a_data_size) {
726 3060 uint8_t *dest_a = pic->data[3] + offset;
727 3060 decode_slice_alpha(ctx, (uint16_t*)dest_a, luma_stride,
728 3060 buf + y_data_size + u_data_size + v_data_size,
729 3060 a_data_size, slice->mb_count);
730 }
731
732 74774 slice->ret = 0;
733 74774 return 0;
734 }
735
736 1437 static int decode_picture(AVCodecContext *avctx)
737 {
738 1437 ProresContext *ctx = avctx->priv_data;
739 int i;
740 1437 int error = 0;
741
742 1437 avctx->execute2(avctx, decode_slice_thread, NULL, NULL, ctx->slice_count);
743
744
2/2
✓ Branch 0 taken 74774 times.
✓ Branch 1 taken 1437 times.
76211 for (i = 0; i < ctx->slice_count; i++)
745 74774 error += ctx->slices[i].ret < 0;
746
747
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1437 times.
1437 if (error)
748 ctx->frame->decode_error_flags = FF_DECODE_ERROR_INVALID_BITSTREAM;
749
1/2
✓ Branch 0 taken 1437 times.
✗ Branch 1 not taken.
1437 if (error < ctx->slice_count)
750 1437 return 0;
751
752 return ctx->slices[0].ret;
753 }
754
755 1065 static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
756 int *got_frame, AVPacket *avpkt)
757 {
758 1065 ProresContext *ctx = avctx->priv_data;
759 1065 const uint8_t *buf = avpkt->data;
760 1065 int buf_size = avpkt->size;
761 int frame_hdr_size, pic_size, ret;
762 int i;
763
764
2/4
✓ Branch 0 taken 1065 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1065 times.
1065 if (buf_size < 28 || AV_RL32(buf + 4) != AV_RL32("icpf")) {
765 av_log(avctx, AV_LOG_ERROR, "invalid frame header\n");
766 return AVERROR_INVALIDDATA;
767 }
768
769 1065 ctx->frame = frame;
770 1065 ctx->first_field = 1;
771
772 1065 buf += 8;
773 1065 buf_size -= 8;
774
775 1065 frame_hdr_size = decode_frame_header(ctx, buf, buf_size, avctx);
776
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1065 times.
1065 if (frame_hdr_size < 0)
777 return frame_hdr_size;
778
779
2/2
✓ Branch 0 taken 42 times.
✓ Branch 1 taken 1023 times.
1065 if (avctx->skip_frame == AVDISCARD_ALL)
780 42 return 0;
781
782 1023 buf += frame_hdr_size;
783 1023 buf_size -= frame_hdr_size;
784
785
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1023 times.
1023 if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0)
786 return ret;
787
788 1023 av_refstruct_unref(&ctx->hwaccel_picture_private);
789
790
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1023 times.
1023 if ((ret = ff_hwaccel_frame_priv_alloc(avctx, &ctx->hwaccel_picture_private)) < 0)
791 return ret;
792
793 1023 ff_thread_finish_setup(avctx);
794
795 1437 decode_picture:
796 1437 pic_size = decode_picture_header(avctx, buf, buf_size);
797
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1437 times.
1437 if (pic_size < 0) {
798 av_log(avctx, AV_LOG_ERROR, "error decoding picture header\n");
799 return pic_size;
800 }
801
802 if (HWACCEL_MAX && avctx->hwaccel) {
803 const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel);
804
805 ret = hwaccel->start_frame(avctx, avpkt->buf, avpkt->data, avpkt->size);
806 if (ret < 0)
807 return ret;
808
809 for (i = 0; i < ctx->slice_count; ++i) {
810 ret = hwaccel->decode_slice(avctx, ctx->slices[i].data, ctx->slices[i].data_size);
811 if (ret < 0)
812 return ret;
813 }
814
815 ret = hwaccel->end_frame(avctx);
816 if (ret < 0)
817 return ret;
818
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1437 times.
1437 } else if ((ret = decode_picture(avctx)) < 0) {
819 av_log(avctx, AV_LOG_ERROR, "error decoding picture\n");
820 return ret;
821 }
822
823 1437 buf += pic_size;
824 1437 buf_size -= pic_size;
825
826
6/6
✓ Branch 0 taken 828 times.
✓ Branch 1 taken 609 times.
✓ Branch 2 taken 428 times.
✓ Branch 3 taken 400 times.
✓ Branch 4 taken 414 times.
✓ Branch 5 taken 14 times.
1437 if (ctx->frame_type && buf_size > 0 && ctx->first_field) {
827 414 ctx->first_field = 0;
828 414 goto decode_picture;
829 }
830
831 1023 av_refstruct_unref(&ctx->hwaccel_picture_private);
832
833 1023 *got_frame = 1;
834
835 1023 return avpkt->size;
836 }
837
838 76 static av_cold int decode_close(AVCodecContext *avctx)
839 {
840 76 ProresContext *ctx = avctx->priv_data;
841
842 76 av_freep(&ctx->slices);
843 76 av_refstruct_unref(&ctx->hwaccel_picture_private);
844
845 76 return 0;
846 }
847
848 #if HAVE_THREADS
849 static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
850 {
851 ProresContext *csrc = src->priv_data;
852 ProresContext *cdst = dst->priv_data;
853
854 cdst->pix_fmt = csrc->pix_fmt;
855 cdst->frame_type = csrc->frame_type;
856
857 return 0;
858 }
859 #endif
860
861 const FFCodec ff_prores_decoder = {
862 .p.name = "prores",
863 CODEC_LONG_NAME("Apple ProRes (iCodec Pro)"),
864 .p.type = AVMEDIA_TYPE_VIDEO,
865 .p.id = AV_CODEC_ID_PRORES,
866 .priv_data_size = sizeof(ProresContext),
867 .init = decode_init,
868 .close = decode_close,
869 FF_CODEC_DECODE_CB(decode_frame),
870 UPDATE_THREAD_CONTEXT(update_thread_context),
871 .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS,
872 .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
873 .p.profiles = NULL_IF_CONFIG_SMALL(ff_prores_profiles),
874 #if HWACCEL_MAX
875 .hw_configs = (const AVCodecHWConfigInternal *const []) {
876 #if CONFIG_PRORES_VIDEOTOOLBOX_HWACCEL
877 HWACCEL_VIDEOTOOLBOX(prores),
878 #endif
879 #if CONFIG_PRORES_VULKAN_HWACCEL
880 HWACCEL_VULKAN(prores),
881 #endif
882 NULL
883 },
884 #endif
885 };
886