00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00031 #define LONG_BITSTREAM_READER // some ProRes vlc codes require up to 28 bits to be read at once
00032
00033 #include <stdint.h>
00034
00035 #include "libavutil/intmath.h"
00036 #include "avcodec.h"
00037 #include "proresdata.h"
00038 #include "proresdsp.h"
00039 #include "get_bits.h"
00040
00041 typedef struct {
00042 const uint8_t *index;
00043 int slice_num;
00044 int x_pos, y_pos;
00045 int slice_width;
00046 int prev_slice_sf;
00047 DECLARE_ALIGNED(16, DCTELEM, blocks)[8 * 4 * 64];
00048 DECLARE_ALIGNED(16, int16_t, qmat_luma_scaled)[64];
00049 DECLARE_ALIGNED(16, int16_t, qmat_chroma_scaled)[64];
00050 } ProresThreadData;
00051
00052 typedef struct {
00053 ProresDSPContext dsp;
00054 AVFrame picture;
00055 ScanTable scantable;
00056 int scantable_type;
00057
00058 int frame_type;
00059 int pic_format;
00060 uint8_t qmat_luma[64];
00061 uint8_t qmat_chroma[64];
00062 int qmat_changed;
00063 int total_slices;
00064 ProresThreadData *slice_data;
00065 int pic_num;
00066 int chroma_factor;
00067 int mb_chroma_factor;
00068 int num_chroma_blocks;
00069 int num_x_slices;
00070 int num_y_slices;
00071 int slice_width_factor;
00072 int slice_height_factor;
00073 int num_x_mbs;
00074 int num_y_mbs;
00075 int alpha_info;
00076 } ProresContext;
00077
00078
00079 static av_cold int decode_init(AVCodecContext *avctx)
00080 {
00081 ProresContext *ctx = avctx->priv_data;
00082
00083 ctx->total_slices = 0;
00084 ctx->slice_data = NULL;
00085
00086 avctx->bits_per_raw_sample = PRORES_BITS_PER_SAMPLE;
00087 ff_proresdsp_init(&ctx->dsp, avctx);
00088
00089 avctx->coded_frame = &ctx->picture;
00090 avcodec_get_frame_defaults(&ctx->picture);
00091 ctx->picture.type = AV_PICTURE_TYPE_I;
00092 ctx->picture.key_frame = 1;
00093
00094 ctx->scantable_type = -1;
00095 memset(ctx->qmat_luma, 4, 64);
00096 memset(ctx->qmat_chroma, 4, 64);
00097
00098 return 0;
00099 }
00100
00101
00102 static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
00103 const int data_size, AVCodecContext *avctx)
00104 {
00105 int hdr_size, version, width, height, flags;
00106 const uint8_t *ptr;
00107
00108 hdr_size = AV_RB16(buf);
00109 if (hdr_size > data_size) {
00110 av_log(avctx, AV_LOG_ERROR, "frame data too small\n");
00111 return AVERROR_INVALIDDATA;
00112 }
00113
00114 version = AV_RB16(buf + 2);
00115 if (version >= 2) {
00116 av_log(avctx, AV_LOG_ERROR,
00117 "unsupported header version: %d\n", version);
00118 return AVERROR_INVALIDDATA;
00119 }
00120
00121 width = AV_RB16(buf + 8);
00122 height = AV_RB16(buf + 10);
00123 if (width != avctx->width || height != avctx->height) {
00124 av_log(avctx, AV_LOG_ERROR,
00125 "picture dimension changed: old: %d x %d, new: %d x %d\n",
00126 avctx->width, avctx->height, width, height);
00127 return AVERROR_INVALIDDATA;
00128 }
00129
00130 ctx->frame_type = (buf[12] >> 2) & 3;
00131 if (ctx->frame_type > 2) {
00132 av_log(avctx, AV_LOG_ERROR,
00133 "unsupported frame type: %d\n", ctx->frame_type);
00134 return AVERROR_INVALIDDATA;
00135 }
00136
00137 ctx->chroma_factor = (buf[12] >> 6) & 3;
00138 ctx->mb_chroma_factor = ctx->chroma_factor + 2;
00139 ctx->num_chroma_blocks = (1 << ctx->chroma_factor) >> 1;
00140 switch (ctx->chroma_factor) {
00141 case 2:
00142 avctx->pix_fmt = PIX_FMT_YUV422P10;
00143 break;
00144 case 3:
00145 avctx->pix_fmt = PIX_FMT_YUV444P10;
00146 break;
00147 default:
00148 av_log(avctx, AV_LOG_ERROR,
00149 "unsupported picture format: %d\n", ctx->pic_format);
00150 return AVERROR_INVALIDDATA;
00151 }
00152
00153 if (ctx->scantable_type != ctx->frame_type) {
00154 if (!ctx->frame_type)
00155 ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable,
00156 ff_prores_progressive_scan);
00157 else
00158 ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable,
00159 ff_prores_interlaced_scan);
00160 ctx->scantable_type = ctx->frame_type;
00161 }
00162
00163 if (ctx->frame_type) {
00164 ctx->picture.interlaced_frame = 1;
00165 ctx->picture.top_field_first = ctx->frame_type & 1;
00166 }
00167
00168 avctx->color_primaries = buf[14];
00169 avctx->color_trc = buf[15];
00170 avctx->colorspace = buf[16];
00171
00172 ctx->alpha_info = buf[17] & 0xf;
00173 if (ctx->alpha_info)
00174 av_log_missing_feature(avctx, "alpha channel", 0);
00175
00176 ctx->qmat_changed = 0;
00177 ptr = buf + 20;
00178 flags = buf[19];
00179 if (flags & 2) {
00180 if (ptr - buf > hdr_size - 64) {
00181 av_log(avctx, AV_LOG_ERROR, "header data too small\n");
00182 return AVERROR_INVALIDDATA;
00183 }
00184 if (memcmp(ctx->qmat_luma, ptr, 64)) {
00185 memcpy(ctx->qmat_luma, ptr, 64);
00186 ctx->qmat_changed = 1;
00187 }
00188 ptr += 64;
00189 } else {
00190 memset(ctx->qmat_luma, 4, 64);
00191 ctx->qmat_changed = 1;
00192 }
00193
00194 if (flags & 1) {
00195 if (ptr - buf > hdr_size - 64) {
00196 av_log(avctx, AV_LOG_ERROR, "header data too small\n");
00197 return -1;
00198 }
00199 if (memcmp(ctx->qmat_chroma, ptr, 64)) {
00200 memcpy(ctx->qmat_chroma, ptr, 64);
00201 ctx->qmat_changed = 1;
00202 }
00203 } else {
00204 memset(ctx->qmat_chroma, 4, 64);
00205 ctx->qmat_changed = 1;
00206 }
00207
00208 return hdr_size;
00209 }
00210
00211
00212 static int decode_picture_header(ProresContext *ctx, const uint8_t *buf,
00213 const int data_size, AVCodecContext *avctx)
00214 {
00215 int i, hdr_size, pic_data_size, num_slices;
00216 int slice_width_factor, slice_height_factor;
00217 int remainder, num_x_slices;
00218 const uint8_t *data_ptr, *index_ptr;
00219
00220 hdr_size = data_size > 0 ? buf[0] >> 3 : 0;
00221 if (hdr_size < 8 || hdr_size > data_size) {
00222 av_log(avctx, AV_LOG_ERROR, "picture header too small\n");
00223 return AVERROR_INVALIDDATA;
00224 }
00225
00226 pic_data_size = AV_RB32(buf + 1);
00227 if (pic_data_size > data_size) {
00228 av_log(avctx, AV_LOG_ERROR, "picture data too small\n");
00229 return AVERROR_INVALIDDATA;
00230 }
00231
00232 slice_width_factor = buf[7] >> 4;
00233 slice_height_factor = buf[7] & 0xF;
00234 if (slice_width_factor > 3 || slice_height_factor) {
00235 av_log(avctx, AV_LOG_ERROR,
00236 "unsupported slice dimension: %d x %d\n",
00237 1 << slice_width_factor, 1 << slice_height_factor);
00238 return AVERROR_INVALIDDATA;
00239 }
00240
00241 ctx->slice_width_factor = slice_width_factor;
00242 ctx->slice_height_factor = slice_height_factor;
00243
00244 ctx->num_x_mbs = (avctx->width + 15) >> 4;
00245 ctx->num_y_mbs = (avctx->height +
00246 (1 << (4 + ctx->picture.interlaced_frame)) - 1) >>
00247 (4 + ctx->picture.interlaced_frame);
00248
00249 remainder = ctx->num_x_mbs & ((1 << slice_width_factor) - 1);
00250 num_x_slices = (ctx->num_x_mbs >> slice_width_factor) + (remainder & 1) +
00251 ((remainder >> 1) & 1) + ((remainder >> 2) & 1);
00252
00253 num_slices = num_x_slices * ctx->num_y_mbs;
00254 if (num_slices != AV_RB16(buf + 5)) {
00255 av_log(avctx, AV_LOG_ERROR, "invalid number of slices\n");
00256 return AVERROR_INVALIDDATA;
00257 }
00258
00259 if (ctx->total_slices != num_slices) {
00260 av_freep(&ctx->slice_data);
00261 ctx->slice_data = av_malloc((num_slices + 1) * sizeof(ctx->slice_data[0]));
00262 if (!ctx->slice_data)
00263 return AVERROR(ENOMEM);
00264 ctx->total_slices = num_slices;
00265 }
00266
00267 if (hdr_size + num_slices * 2 > data_size) {
00268 av_log(avctx, AV_LOG_ERROR, "slice table too small\n");
00269 return AVERROR_INVALIDDATA;
00270 }
00271
00272
00273 index_ptr = buf + hdr_size;
00274 data_ptr = index_ptr + num_slices * 2;
00275
00276 for (i = 0; i < num_slices; i++) {
00277 ctx->slice_data[i].index = data_ptr;
00278 ctx->slice_data[i].prev_slice_sf = 0;
00279 data_ptr += AV_RB16(index_ptr + i * 2);
00280 }
00281 ctx->slice_data[i].index = data_ptr;
00282 ctx->slice_data[i].prev_slice_sf = 0;
00283
00284 if (data_ptr > buf + data_size) {
00285 av_log(avctx, AV_LOG_ERROR, "out of slice data\n");
00286 return -1;
00287 }
00288
00289 return pic_data_size;
00290 }
00291
00292
00296 static inline int decode_vlc_codeword(GetBitContext *gb, unsigned codebook)
00297 {
00298 unsigned int rice_order, exp_order, switch_bits;
00299 unsigned int buf, code;
00300 int log, prefix_len, len;
00301
00302 OPEN_READER(re, gb);
00303 UPDATE_CACHE(re, gb);
00304 buf = GET_CACHE(re, gb);
00305
00306
00307 switch_bits = (codebook & 3) + 1;
00308 rice_order = codebook >> 5;
00309 exp_order = (codebook >> 2) & 7;
00310
00311 log = 31 - av_log2(buf);
00312
00313 if (log < switch_bits) {
00314 if (!rice_order) {
00315
00316 code = log;
00317 LAST_SKIP_BITS(re, gb, log + 1);
00318 } else {
00319 prefix_len = log + 1;
00320 code = (log << rice_order) + NEG_USR32(buf << prefix_len, rice_order);
00321 LAST_SKIP_BITS(re, gb, prefix_len + rice_order);
00322 }
00323 } else {
00324 len = (log << 1) - switch_bits + exp_order + 1;
00325 code = NEG_USR32(buf, len) - (1 << exp_order) + (switch_bits << rice_order);
00326 LAST_SKIP_BITS(re, gb, len);
00327 }
00328
00329 CLOSE_READER(re, gb);
00330
00331 return code;
00332 }
00333
00334 #define LSB2SIGN(x) (-((x) & 1))
00335 #define TOSIGNED(x) (((x) >> 1) ^ LSB2SIGN(x))
00336
00340 static inline void decode_dc_coeffs(GetBitContext *gb, DCTELEM *out,
00341 int nblocks)
00342 {
00343 DCTELEM prev_dc;
00344 int i, sign;
00345 int16_t delta;
00346 unsigned int code;
00347
00348 code = decode_vlc_codeword(gb, FIRST_DC_CB);
00349 out[0] = prev_dc = TOSIGNED(code);
00350
00351 out += 64;
00352 delta = 3;
00353
00354 for (i = 1; i < nblocks; i++, out += 64) {
00355 code = decode_vlc_codeword(gb, ff_prores_dc_codebook[FFMIN(FFABS(delta), 3)]);
00356
00357 sign = -(((delta >> 15) & 1) ^ (code & 1));
00358 delta = (((code + 1) >> 1) ^ sign) - sign;
00359 prev_dc += delta;
00360 out[0] = prev_dc;
00361 }
00362 }
00363
00364
00368 static inline void decode_ac_coeffs(GetBitContext *gb, DCTELEM *out,
00369 int blocks_per_slice,
00370 int plane_size_factor,
00371 const uint8_t *scan)
00372 {
00373 int pos, block_mask, run, level, sign, run_cb_index, lev_cb_index;
00374 int max_coeffs, bits_left;
00375
00376
00377 run = 4;
00378 level = 2;
00379
00380 max_coeffs = blocks_per_slice << 6;
00381 block_mask = blocks_per_slice - 1;
00382
00383 for (pos = blocks_per_slice - 1; pos < max_coeffs;) {
00384 run_cb_index = ff_prores_run_to_cb_index[FFMIN(run, 15)];
00385 lev_cb_index = ff_prores_lev_to_cb_index[FFMIN(level, 9)];
00386
00387 bits_left = get_bits_left(gb);
00388 if (bits_left <= 0 || (bits_left <= 8 && !show_bits(gb, bits_left)))
00389 return;
00390
00391 run = decode_vlc_codeword(gb, ff_prores_ac_codebook[run_cb_index]);
00392
00393 bits_left = get_bits_left(gb);
00394 if (bits_left <= 0 || (bits_left <= 8 && !show_bits(gb, bits_left)))
00395 return;
00396
00397 level = decode_vlc_codeword(gb, ff_prores_ac_codebook[lev_cb_index]) + 1;
00398
00399 pos += run + 1;
00400 if (pos >= max_coeffs)
00401 break;
00402
00403 sign = get_sbits(gb, 1);
00404 out[((pos & block_mask) << 6) + scan[pos >> plane_size_factor]] =
00405 (level ^ sign) - sign;
00406 }
00407 }
00408
00409
00413 static void decode_slice_plane(ProresContext *ctx, ProresThreadData *td,
00414 const uint8_t *buf,
00415 int data_size, uint16_t *out_ptr,
00416 int linesize, int mbs_per_slice,
00417 int blocks_per_mb, int plane_size_factor,
00418 const int16_t *qmat, int is_chroma)
00419 {
00420 GetBitContext gb;
00421 DCTELEM *block_ptr;
00422 int mb_num, blocks_per_slice;
00423
00424 blocks_per_slice = mbs_per_slice * blocks_per_mb;
00425
00426 memset(td->blocks, 0, 8 * 4 * 64 * sizeof(*td->blocks));
00427
00428 init_get_bits(&gb, buf, data_size << 3);
00429
00430 decode_dc_coeffs(&gb, td->blocks, blocks_per_slice);
00431
00432 decode_ac_coeffs(&gb, td->blocks, blocks_per_slice,
00433 plane_size_factor, ctx->scantable.permutated);
00434
00435
00436 block_ptr = td->blocks;
00437
00438 if (!is_chroma) {
00439 for (mb_num = 0; mb_num < mbs_per_slice; mb_num++, out_ptr += blocks_per_mb * 4) {
00440 ctx->dsp.idct_put(out_ptr, linesize, block_ptr, qmat);
00441 block_ptr += 64;
00442 if (blocks_per_mb > 2) {
00443 ctx->dsp.idct_put(out_ptr + 8, linesize, block_ptr, qmat);
00444 block_ptr += 64;
00445 }
00446 ctx->dsp.idct_put(out_ptr + linesize * 4, linesize, block_ptr, qmat);
00447 block_ptr += 64;
00448 if (blocks_per_mb > 2) {
00449 ctx->dsp.idct_put(out_ptr + linesize * 4 + 8, linesize, block_ptr, qmat);
00450 block_ptr += 64;
00451 }
00452 }
00453 } else {
00454 for (mb_num = 0; mb_num < mbs_per_slice; mb_num++, out_ptr += blocks_per_mb * 4) {
00455 ctx->dsp.idct_put(out_ptr, linesize, block_ptr, qmat);
00456 block_ptr += 64;
00457 ctx->dsp.idct_put(out_ptr + linesize * 4, linesize, block_ptr, qmat);
00458 block_ptr += 64;
00459 if (blocks_per_mb > 2) {
00460 ctx->dsp.idct_put(out_ptr + 8, linesize, block_ptr, qmat);
00461 block_ptr += 64;
00462 ctx->dsp.idct_put(out_ptr + linesize * 4 + 8, linesize, block_ptr, qmat);
00463 block_ptr += 64;
00464 }
00465 }
00466 }
00467 }
00468
00469
00470 static int decode_slice(AVCodecContext *avctx, void *tdata)
00471 {
00472 ProresThreadData *td = tdata;
00473 ProresContext *ctx = avctx->priv_data;
00474 int mb_x_pos = td->x_pos;
00475 int mb_y_pos = td->y_pos;
00476 int pic_num = ctx->pic_num;
00477 int slice_num = td->slice_num;
00478 int mbs_per_slice = td->slice_width;
00479 const uint8_t *buf;
00480 uint8_t *y_data, *u_data, *v_data;
00481 AVFrame *pic = avctx->coded_frame;
00482 int i, sf, slice_width_factor;
00483 int slice_data_size, hdr_size, y_data_size, u_data_size, v_data_size;
00484 int y_linesize, u_linesize, v_linesize;
00485
00486 buf = ctx->slice_data[slice_num].index;
00487 slice_data_size = ctx->slice_data[slice_num + 1].index - buf;
00488
00489 slice_width_factor = av_log2(mbs_per_slice);
00490
00491 y_data = pic->data[0];
00492 u_data = pic->data[1];
00493 v_data = pic->data[2];
00494 y_linesize = pic->linesize[0];
00495 u_linesize = pic->linesize[1];
00496 v_linesize = pic->linesize[2];
00497
00498 if (pic->interlaced_frame) {
00499 if (!(pic_num ^ pic->top_field_first)) {
00500 y_data += y_linesize;
00501 u_data += u_linesize;
00502 v_data += v_linesize;
00503 }
00504 y_linesize <<= 1;
00505 u_linesize <<= 1;
00506 v_linesize <<= 1;
00507 }
00508
00509 if (slice_data_size < 6) {
00510 av_log(avctx, AV_LOG_ERROR, "slice data too small\n");
00511 return AVERROR_INVALIDDATA;
00512 }
00513
00514
00515 hdr_size = buf[0] >> 3;
00516 y_data_size = AV_RB16(buf + 2);
00517 u_data_size = AV_RB16(buf + 4);
00518 v_data_size = hdr_size > 7 ? AV_RB16(buf + 6) :
00519 slice_data_size - y_data_size - u_data_size - hdr_size;
00520
00521 if (hdr_size + y_data_size + u_data_size + v_data_size > slice_data_size ||
00522 v_data_size < 0 || hdr_size < 6) {
00523 av_log(avctx, AV_LOG_ERROR, "invalid data size\n");
00524 return AVERROR_INVALIDDATA;
00525 }
00526
00527 sf = av_clip(buf[1], 1, 224);
00528 sf = sf > 128 ? (sf - 96) << 2 : sf;
00529
00530
00531
00532 if (ctx->qmat_changed || sf != td->prev_slice_sf) {
00533 td->prev_slice_sf = sf;
00534 for (i = 0; i < 64; i++) {
00535 td->qmat_luma_scaled[ctx->dsp.idct_permutation[i]] = ctx->qmat_luma[i] * sf;
00536 td->qmat_chroma_scaled[ctx->dsp.idct_permutation[i]] = ctx->qmat_chroma[i] * sf;
00537 }
00538 }
00539
00540
00541 decode_slice_plane(ctx, td, buf + hdr_size, y_data_size,
00542 (uint16_t*) (y_data + (mb_y_pos << 4) * y_linesize +
00543 (mb_x_pos << 5)), y_linesize,
00544 mbs_per_slice, 4, slice_width_factor + 2,
00545 td->qmat_luma_scaled, 0);
00546
00547
00548 decode_slice_plane(ctx, td, buf + hdr_size + y_data_size, u_data_size,
00549 (uint16_t*) (u_data + (mb_y_pos << 4) * u_linesize +
00550 (mb_x_pos << ctx->mb_chroma_factor)),
00551 u_linesize, mbs_per_slice, ctx->num_chroma_blocks,
00552 slice_width_factor + ctx->chroma_factor - 1,
00553 td->qmat_chroma_scaled, 1);
00554
00555
00556 decode_slice_plane(ctx, td, buf + hdr_size + y_data_size + u_data_size,
00557 v_data_size,
00558 (uint16_t*) (v_data + (mb_y_pos << 4) * v_linesize +
00559 (mb_x_pos << ctx->mb_chroma_factor)),
00560 v_linesize, mbs_per_slice, ctx->num_chroma_blocks,
00561 slice_width_factor + ctx->chroma_factor - 1,
00562 td->qmat_chroma_scaled, 1);
00563
00564 return 0;
00565 }
00566
00567
00568 static int decode_picture(ProresContext *ctx, int pic_num,
00569 AVCodecContext *avctx)
00570 {
00571 int slice_num, slice_width, x_pos, y_pos;
00572
00573 slice_num = 0;
00574
00575 ctx->pic_num = pic_num;
00576 for (y_pos = 0; y_pos < ctx->num_y_mbs; y_pos++) {
00577 slice_width = 1 << ctx->slice_width_factor;
00578
00579 for (x_pos = 0; x_pos < ctx->num_x_mbs && slice_width;
00580 x_pos += slice_width) {
00581 while (ctx->num_x_mbs - x_pos < slice_width)
00582 slice_width >>= 1;
00583
00584 ctx->slice_data[slice_num].slice_num = slice_num;
00585 ctx->slice_data[slice_num].x_pos = x_pos;
00586 ctx->slice_data[slice_num].y_pos = y_pos;
00587 ctx->slice_data[slice_num].slice_width = slice_width;
00588
00589 slice_num++;
00590 }
00591 }
00592
00593 return avctx->execute(avctx, decode_slice,
00594 ctx->slice_data, NULL, slice_num,
00595 sizeof(ctx->slice_data[0]));
00596 }
00597
00598
00599 #define MOVE_DATA_PTR(nbytes) buf += (nbytes); buf_size -= (nbytes)
00600
00601 static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
00602 AVPacket *avpkt)
00603 {
00604 ProresContext *ctx = avctx->priv_data;
00605 AVFrame *picture = avctx->coded_frame;
00606 const uint8_t *buf = avpkt->data;
00607 int buf_size = avpkt->size;
00608 int frame_hdr_size, pic_num, pic_data_size;
00609
00610
00611 if (buf_size < 28 || buf_size < AV_RB32(buf) ||
00612 AV_RB32(buf + 4) != FRAME_ID) {
00613 av_log(avctx, AV_LOG_ERROR, "invalid frame\n");
00614 return AVERROR_INVALIDDATA;
00615 }
00616
00617 MOVE_DATA_PTR(8);
00618
00619 frame_hdr_size = decode_frame_header(ctx, buf, buf_size, avctx);
00620 if (frame_hdr_size < 0)
00621 return AVERROR_INVALIDDATA;
00622
00623 MOVE_DATA_PTR(frame_hdr_size);
00624
00625 if (picture->data[0])
00626 avctx->release_buffer(avctx, picture);
00627
00628 picture->reference = 0;
00629 if (avctx->get_buffer(avctx, picture) < 0)
00630 return -1;
00631
00632 for (pic_num = 0; ctx->picture.interlaced_frame - pic_num + 1; pic_num++) {
00633 pic_data_size = decode_picture_header(ctx, buf, buf_size, avctx);
00634 if (pic_data_size < 0)
00635 return AVERROR_INVALIDDATA;
00636
00637 if (decode_picture(ctx, pic_num, avctx))
00638 return -1;
00639
00640 MOVE_DATA_PTR(pic_data_size);
00641 }
00642
00643 *data_size = sizeof(AVPicture);
00644 *(AVFrame*) data = *avctx->coded_frame;
00645
00646 return avpkt->size;
00647 }
00648
00649
00650 static av_cold int decode_close(AVCodecContext *avctx)
00651 {
00652 ProresContext *ctx = avctx->priv_data;
00653
00654 if (ctx->picture.data[0])
00655 avctx->release_buffer(avctx, &ctx->picture);
00656
00657 av_freep(&ctx->slice_data);
00658
00659 return 0;
00660 }
00661
00662
00663 AVCodec ff_prores_lgpl_decoder = {
00664 .name = "prores_lgpl",
00665 .type = AVMEDIA_TYPE_VIDEO,
00666 .id = CODEC_ID_PRORES,
00667 .priv_data_size = sizeof(ProresContext),
00668 .init = decode_init,
00669 .close = decode_close,
00670 .decode = decode_frame,
00671 .capabilities = CODEC_CAP_DR1 | CODEC_CAP_SLICE_THREADS,
00672 .long_name = NULL_IF_CONFIG_SMALL("Apple ProRes (iCodec Pro)")
00673 };