aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/dvdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-20 18:00:42 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-20 18:00:42 +0200
commitb0fdc76600a17a39b18deb7a1754246a973f3a98 (patch)
tree60bb91d079843904d38b5e7df8786a8cde37eeb0 /libavcodec/dvdec.c
parentc2b1225c16f14a23a89c3eedbae51e6bc5667bc8 (diff)
parent650dee63c8b1e6693c6cf5983f4a5ed3f571379f (diff)
downloadffmpeg-b0fdc76600a17a39b18deb7a1754246a973f3a98.tar.gz
Merge commit '650dee63c8b1e6693c6cf5983f4a5ed3f571379f'
* commit '650dee63c8b1e6693c6cf5983f4a5ed3f571379f': dv: get rid of global non-const tables Conflicts: libavcodec/dv_profile.h libavcodec/dvdec.c libavcodec/dvenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dvdec.c')
-rw-r--r--libavcodec/dvdec.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index 727f91d65c..e555f31edf 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -179,12 +179,12 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
if (DV_PROFILE_IS_HD(s->sys)) {
mb->idct_put = s->idct_put[0];
mb->scan_table = s->dv_zigzag[0];
- mb->factor_table = &s->sys->idct_factor[(j >= 4)*4*16*64 + class1*16*64 + quant*64];
+ mb->factor_table = &s->idct_factor[(j >= 4)*4*16*64 + class1*16*64 + quant*64];
is_field_mode[mb_index] |= !j && dct_mode;
} else {
mb->idct_put = s->idct_put[dct_mode && log2_blocksize == 3];
mb->scan_table = s->dv_zigzag[dct_mode];
- mb->factor_table = &s->sys->idct_factor[(class1 == 3)*2*22*64 + dct_mode*22*64 +
+ mb->factor_table = &s->idct_factor[(class1 == 3)*2*22*64 + dct_mode*22*64 +
(quant + ff_dv_quant_offset[class1])*64];
}
dc = dc << 2;
@@ -321,13 +321,23 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
DVVideoContext *s = avctx->priv_data;
const uint8_t* vsc_pack;
int apt, is16_9, ret;
+ const DVprofile *sys;
- s->sys = avpriv_dv_frame_profile2(avctx, s->sys, buf, buf_size);
- if (!s->sys || buf_size < s->sys->frame_size || ff_dv_init_dynamic_tables(s->sys)) {
+ sys = avpriv_dv_frame_profile2(avctx, s->sys, buf, buf_size);
+ if (!sys || buf_size < sys->frame_size) {
av_log(avctx, AV_LOG_ERROR, "could not find dv frame profile\n");
return -1; /* NOTE: we only accept several full frames */
}
+ if (sys != s->sys) {
+ ret = ff_dv_init_dynamic_tables(s, sys);
+ if (ret < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error initializing the work tables.\n");
+ return ret;
+ }
+ s->sys = sys;
+ }
+
s->frame = data;
s->frame->key_frame = 1;
s->frame->pict_type = AV_PICTURE_TYPE_I;
@@ -353,7 +363,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
}
s->buf = buf;
- avctx->execute(avctx, dv_decode_video_segment, s->sys->work_chunks, NULL,
+ avctx->execute(avctx, dv_decode_video_segment, s->work_chunks, NULL,
dv_work_pool_size(s->sys), sizeof(DVwork_chunk));
emms_c();