aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-04-11 14:48:21 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-04-11 14:48:27 +0200
commit5ec016ad0b29beecc663fbc746b10a970cf341d2 (patch)
treeda4c2a4963ecc41af9afa18a82a4e014e161f8db
parentab4afcb85b3ac23da3bce7fd9bc70d11b8bb28a4 (diff)
parent20429ba96e55db17ac57f6c0e330914287f1f614 (diff)
downloadffmpeg-5ec016ad0b29beecc663fbc746b10a970cf341d2.tar.gz
Merge commit '20429ba96e55db17ac57f6c0e330914287f1f614'
* commit '20429ba96e55db17ac57f6c0e330914287f1f614': h261: Move encoder/decoder shared table init to common code Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/h261.c11
-rw-r--r--libavcodec/h261.h1
-rw-r--r--libavcodec/h261dec.c2
-rw-r--r--libavcodec/h261enc.c7
4 files changed, 14 insertions, 7 deletions
diff --git a/libavcodec/h261.c b/libavcodec/h261.c
index efda3d03dd..9836905d93 100644
--- a/libavcodec/h261.c
+++ b/libavcodec/h261.c
@@ -79,3 +79,14 @@ void ff_h261_loop_filter(MpegEncContext *s)
h261_loop_filter(dest_cb, uvlinesize);
h261_loop_filter(dest_cr, uvlinesize);
}
+
+av_cold void ff_h261_common_init(void)
+{
+ static int done = 0;
+
+ if (done)
+ return;
+
+ ff_init_rl(&ff_h261_rl_tcoeff, ff_h261_rl_table_store);
+ done = 1;
+}
diff --git a/libavcodec/h261.h b/libavcodec/h261.h
index ff549628a3..597bf7efaa 100644
--- a/libavcodec/h261.h
+++ b/libavcodec/h261.h
@@ -61,6 +61,7 @@ extern const uint8_t ff_h261_cbp_tab[63][2];
extern RLTable ff_h261_rl_tcoeff;
void ff_h261_loop_filter(MpegEncContext *s);
+void ff_h261_common_init(void);
int ff_h261_get_picture_format(int width, int height);
void ff_h261_reorder_mb_index(MpegEncContext *s);
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 3341522bc1..8ed16bd4b1 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -62,7 +62,6 @@ static av_cold void h261_decode_init_vlc(H261Context *h)
INIT_VLC_STATIC(&h261_cbp_vlc, H261_CBP_VLC_BITS, 63,
&ff_h261_cbp_tab[0][1], 2, 1,
&ff_h261_cbp_tab[0][0], 2, 1, 512);
- ff_init_rl(&ff_h261_rl_tcoeff, ff_h261_rl_table_store);
INIT_VLC_RL(ff_h261_rl_tcoeff, 552);
}
}
@@ -83,6 +82,7 @@ static av_cold int h261_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
s->codec_id = avctx->codec->id;
+ ff_h261_common_init();
h261_decode_init_vlc(h);
h->gob_start_code_skipped = 0;
diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c
index 23b8964dcc..84a8816022 100644
--- a/libavcodec/h261enc.c
+++ b/libavcodec/h261enc.c
@@ -314,12 +314,7 @@ void ff_h261_encode_mb(MpegEncContext *s, int16_t block[6][64],
void ff_h261_encode_init(MpegEncContext *s)
{
- static int done = 0;
-
- if (!done) {
- done = 1;
- ff_init_rl(&ff_h261_rl_tcoeff, ff_h261_rl_table_store);
- }
+ ff_h261_common_init();
s->min_qcoeff = -127;
s->max_qcoeff = 127;