av_frame_free(&s->last_frame.f);
av_frame_free(&s->golden_frame.f);
- if (avctx->internal->is_copy)
- return 0;
-
for (i = 0; i < 16; i++) {
ff_free_vlc(&s->dc_vlc[i]);
ff_free_vlc(&s->ac_vlc_1[i]);
if (ret < 0)
return ret;
- avctx->internal->allocate_progress = 1;
-
if (avctx->codec_tag == MKTAG('V', 'P', '4', '0'))
s->version = 3;
else if (avctx->codec_tag == MKTAG('V', 'P', '3', '0'))
/* init VLC tables */
if (s->version < 2) {
- for (i = 0; i < 16; i++) {
- /* DC histograms */
- init_vlc(&s->dc_vlc[i], 11, 32,
- &dc_bias[i][0][1], 4, 2,
- &dc_bias[i][0][0], 4, 2, 0);
+ for (i = 0; i < 16; i++) {
+ /* DC histograms */
+ init_vlc(&s->dc_vlc[i], 11, 32,
+ &dc_bias[i][0][1], 4, 2,
+ &dc_bias[i][0][0], 4, 2, 0);
- /* group 1 AC histograms */
- init_vlc(&s->ac_vlc_1[i], 11, 32,
- &ac_bias_0[i][0][1], 4, 2,
- &ac_bias_0[i][0][0], 4, 2, 0);
+ /* group 1 AC histograms */
+ init_vlc(&s->ac_vlc_1[i], 11, 32,
+ &ac_bias_0[i][0][1], 4, 2,
+ &ac_bias_0[i][0][0], 4, 2, 0);
- /* group 2 AC histograms */
- init_vlc(&s->ac_vlc_2[i], 11, 32,
- &ac_bias_1[i][0][1], 4, 2,
- &ac_bias_1[i][0][0], 4, 2, 0);
+ /* group 2 AC histograms */
+ init_vlc(&s->ac_vlc_2[i], 11, 32,
+ &ac_bias_1[i][0][1], 4, 2,
+ &ac_bias_1[i][0][0], 4, 2, 0);
- /* group 3 AC histograms */
- init_vlc(&s->ac_vlc_3[i], 11, 32,
- &ac_bias_2[i][0][1], 4, 2,
- &ac_bias_2[i][0][0], 4, 2, 0);
+ /* group 3 AC histograms */
+ init_vlc(&s->ac_vlc_3[i], 11, 32,
+ &ac_bias_2[i][0][1], 4, 2,
+ &ac_bias_2[i][0][0], 4, 2, 0);
- /* group 4 AC histograms */
- init_vlc(&s->ac_vlc_4[i], 11, 32,
- &ac_bias_3[i][0][1], 4, 2,
- &ac_bias_3[i][0][0], 4, 2, 0);
- }
+ /* group 4 AC histograms */
+ init_vlc(&s->ac_vlc_4[i], 11, 32,
+ &ac_bias_3[i][0][1], 4, 2,
+ &ac_bias_3[i][0][0], 4, 2, 0);
+ }
#if CONFIG_VP4_DECODER
} else { /* version >= 2 */
for (i = 0; i < 16; i++) {
}
if (s != s1) {
- if (!s->current_frame.f)
- return AVERROR(ENOMEM);
- // init tables if the first frame hasn't been decoded
- if (!s->current_frame.f->data[0]) {
- int y_fragment_count, c_fragment_count;
- s->avctx = dst;
- err = allocate_tables(dst);
- if (err)
- return err;
- y_fragment_count = s->fragment_width[0] * s->fragment_height[0];
- c_fragment_count = s->fragment_width[1] * s->fragment_height[1];
- memcpy(s->motion_val[0], s1->motion_val[0],
- y_fragment_count * sizeof(*s->motion_val[0]));
- memcpy(s->motion_val[1], s1->motion_val[1],
- c_fragment_count * sizeof(*s->motion_val[1]));
- }
-
// copy previous frame data
if ((err = ref_frames(s, s1)) < 0)
return err;
ff_thread_finish_setup(avctx);
if (s->version < 2) {
- if ((ret = unpack_superblocks(s, &gb)) < 0) {
- av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n");
- goto error;
- }
+ if ((ret = unpack_superblocks(s, &gb)) < 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n");
+ goto error;
+ }
#if CONFIG_VP4_DECODER
} else {
if ((ret = vp4_unpack_macroblocks(s, &gb)) < 0) {
}
if (s->version < 2) {
- if ((ret = unpack_dct_coeffs(s, &gb)) < 0) {
- av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\n");
- goto error;
- }
+ if ((ret = unpack_dct_coeffs(s, &gb)) < 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\n");
+ goto error;
+ }
#if CONFIG_VP4_DECODER
} else {
if ((ret = vp4_unpack_dct_coeffs(s, &gb)) < 0) {
// filter the last row
if (s->version < 2)
- for (i = 0; i < 3; i++) {
- int row = (s->height >> (3 + (i && s->chroma_y_shift))) - 1;
- apply_loop_filter(s, i, row, row + 1);
- }
+ for (i = 0; i < 3; i++) {
+ int row = (s->height >> (3 + (i && s->chroma_y_shift))) - 1;
+ apply_loop_filter(s, i, row, row + 1);
+ }
vp3_draw_horiz_band(s, s->height);
/* output frame, offset as needed */
return 0;
}
-#if HAVE_THREADS
-static int vp3_init_thread_copy(AVCodecContext *avctx)
-{
- Vp3DecodeContext *s = avctx->priv_data;
-
- s->superblock_coding = NULL;
- s->all_fragments = NULL;
- s->coded_fragment_list[0] = NULL;
- s-> kf_coded_fragment_list= NULL;
- s->nkf_coded_fragment_list= NULL;
- s->dct_tokens_base = NULL;
- s->superblock_fragments = NULL;
- s->macroblock_coding = NULL;
- s->motion_val[0] = NULL;
- s->motion_val[1] = NULL;
- s->edge_emu_buffer = NULL;
- s->dc_pred_row = NULL;
-
- return init_frames(s);
-}
-#endif
-
#if CONFIG_THEORA_DECODER
static const enum AVPixelFormat theora_pix_fmts[4] = {
AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DRAW_HORIZ_BAND |
AV_CODEC_CAP_FRAME_THREADS,
.flush = vp3_decode_flush,
- .init_thread_copy = ONLY_IF_THREADS_ENABLED(vp3_init_thread_copy),
.update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context),
- .caps_internal = FF_CODEC_CAP_EXPORTS_CROPPING,
+ .caps_internal = FF_CODEC_CAP_EXPORTS_CROPPING | FF_CODEC_CAP_ALLOCATE_PROGRESS,
};
#endif
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DRAW_HORIZ_BAND |
AV_CODEC_CAP_FRAME_THREADS,
.flush = vp3_decode_flush,
- .init_thread_copy = ONLY_IF_THREADS_ENABLED(vp3_init_thread_copy),
.update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context),
+ .caps_internal = FF_CODEC_CAP_ALLOCATE_PROGRESS,
};
#if CONFIG_VP4_DECODER
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DRAW_HORIZ_BAND |
AV_CODEC_CAP_FRAME_THREADS,
.flush = vp3_decode_flush,
- .init_thread_copy = ONLY_IF_THREADS_ENABLED(vp3_init_thread_copy),
.update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context),
+ .caps_internal = FF_CODEC_CAP_ALLOCATE_PROGRESS,
};
#endif