1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index f6c79af..70522ee 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -414,17 +414,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if (!s->context_initialized)
// we need the idct permutaton for reading a custom matrix
- if ((ret = ff_MPV_common_init(s)) < 0)
- return ret;
-
- /* We need to set current_picture_ptr before reading the header,
- * otherwise we cannot store anyting in there */
- if (s->current_picture_ptr == NULL || s->current_picture_ptr->f.data[0]) {
- int i = ff_find_unused_picture(s, 0);
- if (i < 0)
- return i;
- s->current_picture_ptr = &s->picture[i];
- }
+ ff_dsputil_init(&s->dsp, avctx);
/* let's go :-) */
if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) {
@@ -459,6 +449,17 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return ret;
}
+ if (!s->context_initialized)
+ if ((ret = ff_MPV_common_init(s)) < 0)
+ return ret;
+
+ if (s->current_picture_ptr == NULL || s->current_picture_ptr->f.data[0]) {
+ int i = ff_find_unused_picture(s, 0);
+ if (i < 0)
+ return i;
+ s->current_picture_ptr = &s->picture[i];
+ }
+
avctx->has_b_frames = !s->low_delay;
#define SET_QPEL_FUNC(postfix1, postfix2) \
|