History

avcodec/msmpeg4dec: Add MSMPEG4DecContext

This is in preparation for further commits.

Andreas Rheinhardt committed 1 year ago

Commit f733cfc1 parent 0a9f58a3 files · +26 −16Browse files

Unified · Split

3 files
  1. libavcodec/msmpeg4dec.c +4 −4
  2. libavcodec/msmpeg4dec.h +10 −0
  3. libavcodec/wmv2dec.c +12 −12
libavcodec/msmpeg4dec.c+4−4
@@ -845,7 +845,7 @@ const FFCodec ff_msmpeg4v1_decoder = { · 844 unmodified lines
845845 CODEC_LONG_NAME("MPEG-4 part 2 Microsoft variant version 1"),
846846 .p.type = AVMEDIA_TYPE_VIDEO,
847847 .p.id = AV_CODEC_ID_MSMPEG4V1,
848− .priv_data_size = sizeof(MpegEncContext),
848+ .priv_data_size = sizeof(MSMP4DecContext),
849849 .init = ff_msmpeg4_decode_init,
850850 FF_CODEC_DECODE_CB(ff_h263_decode_frame),
851851 .close = ff_mpv_decode_close,
@@ -860,7 +860,7 @@ const FFCodec ff_msmpeg4v2_decoder = { · 8 unmodified lines
860860 CODEC_LONG_NAME("MPEG-4 part 2 Microsoft variant version 2"),
861861 .p.type = AVMEDIA_TYPE_VIDEO,
862862 .p.id = AV_CODEC_ID_MSMPEG4V2,
863− .priv_data_size = sizeof(MpegEncContext),
863+ .priv_data_size = sizeof(MSMP4DecContext),
864864 .init = ff_msmpeg4_decode_init,
865865 FF_CODEC_DECODE_CB(ff_h263_decode_frame),
866866 .close = ff_mpv_decode_close,
@@ -875,7 +875,7 @@ const FFCodec ff_msmpeg4v3_decoder = { · 8 unmodified lines
875875 CODEC_LONG_NAME("MPEG-4 part 2 Microsoft variant version 3"),
876876 .p.type = AVMEDIA_TYPE_VIDEO,
877877 .p.id = AV_CODEC_ID_MSMPEG4V3,
878− .priv_data_size = sizeof(MpegEncContext),
878+ .priv_data_size = sizeof(MSMP4DecContext),
879879 .init = ff_msmpeg4_decode_init,
880880 FF_CODEC_DECODE_CB(ff_h263_decode_frame),
881881 .close = ff_mpv_decode_close,
@@ -890,7 +890,7 @@ const FFCodec ff_wmv1_decoder = { · 8 unmodified lines
890890 CODEC_LONG_NAME("Windows Media Video 7"),
891891 .p.type = AVMEDIA_TYPE_VIDEO,
892892 .p.id = AV_CODEC_ID_WMV1,
893− .priv_data_size = sizeof(MpegEncContext),
893+ .priv_data_size = sizeof(MSMP4DecContext),
894894 .init = ff_msmpeg4_decode_init,
895895 FF_CODEC_DECODE_CB(ff_h263_decode_frame),
896896 .close = ff_mpv_decode_close,
libavcodec/msmpeg4dec.h+10−0
@@ -28,6 +28,16 @@ · 27 unmodified lines
2828 #define INTER_INTRA_VLC_BITS 3
2929 #define MB_NON_INTRA_VLC_BITS 9
3030
31+typedef struct MSMP4DecContext {
32+ MpegEncContext m;
33+} MSMP4DecContext;
34+
35+static inline MSMP4DecContext *mpv_to_msmpeg4(MpegEncContext *s)
36+{
37+ // Only legal because no MSMPEG-4 decoder uses slice-threading.
38+ return (MSMP4DecContext*)s;
39+}
40+
3141 extern const VLCElem *ff_mb_non_intra_vlc[4];
3242 extern VLCElem ff_inter_intra_vlc[8];
3343
libavcodec/wmv2dec.c+12−12
@@ -37,7 +37,7 @@ · 36 unmodified lines
3737 #include "wmv2dec.h"
3838
3939 typedef struct WMV2DecContext {
40− MpegEncContext s;
40+ MSMP4DecContext ms;
4141 WMV2Context common;
4242 IntraX8Context x8;
4343 int j_type_bit;
@@ -59,7 +59,7 @@ typedef struct WMV2DecContext { · 15 unmodified lines
5959 static void wmv2_add_block(WMV2DecContext *w, int16_t *block1,
6060 uint8_t *dst, int stride, int n)
6161 {
62− MpegEncContext *const s = &w->s;
62+ MpegEncContext *const s = &w->ms.m;
6363
6464 if (s->block_last_index[n] >= 0) {
6565 switch (w->abt_type_table[n]) {
@@ -103,7 +103,7 @@ static int parse_mb_skip(WMV2DecContext *w) · 37 unmodified lines
103103 {
104104 int mb_x, mb_y;
105105 int coded_mb_count = 0;
106− MpegEncContext *const s = &w->s;
106+ MpegEncContext *const s = &w->ms.m;
107107 uint32_t *const mb_type = s->cur_pic.mb_type;
108108
109109 w->skip_type = get_bits(&s->gb, 2);
@@ -166,7 +166,7 @@ static int parse_mb_skip(WMV2DecContext *w) · 56 unmodified lines
166166
167167 static int decode_ext_header(WMV2DecContext *w)
168168 {
169− MpegEncContext *const s = &w->s;
169+ MpegEncContext *const s = &w->ms.m;
170170 GetBitContext gb;
171171 int fps;
172172 int code;
@@ -336,8 +336,8 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s) · 163 unmodified lines
336336 2 * s->qscale, (s->qscale - 1) | 1,
337337 s->loop_filter, s->low_delay);
338338
339− ff_er_add_slice(&w->s.er, 0, 0,
340− (w->s.mb_x >> 1) - 1, (w->s.mb_y >> 1) - 1,
339+ ff_er_add_slice(&s->er, 0, 0,
340+ (s->mb_x >> 1) - 1, (s->mb_y >> 1) - 1,
341341 ER_MB_END);
342342 return 1;
343343 }
@@ -347,7 +347,7 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s) · 3 unmodified lines
347347
348348 static inline void wmv2_decode_motion(WMV2DecContext *w, int *mx_ptr, int *my_ptr)
349349 {
350− MpegEncContext *const s = &w->s;
350+ MpegEncContext *const s = &w->ms.m;
351351
352352 ff_msmpeg4_decode_motion(s, mx_ptr, my_ptr);
353353
@@ -359,7 +359,7 @@ static inline void wmv2_decode_motion(WMV2DecContext *w, int *mx_ptr, int *my_pt · 5 unmodified lines
359359
360360 static int16_t *wmv2_pred_motion(WMV2DecContext *w, int *px, int *py)
361361 {
362− MpegEncContext *const s = &w->s;
362+ MpegEncContext *const s = &w->ms.m;
363363 int xy, wrap, diff, type;
364364 int16_t *A, *B, *C, *mot_val;
365365
@@ -405,7 +405,7 @@ static int16_t *wmv2_pred_motion(WMV2DecContext *w, int *px, int *py) · 39 unmodified lines
405405 static inline int wmv2_decode_inter_block(WMV2DecContext *w, int16_t *block,
406406 int n, int cbp)
407407 {
408− MpegEncContext *const s = &w->s;
408+ MpegEncContext *const s = &w->ms.m;
409409 static const int sub_cbp_table[3] = { 2, 3, 1 };
410410 int sub_cbp, ret;
411411
@@ -561,7 +561,7 @@ static int wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64]) · 149 unmodified lines
561561 static av_cold int wmv2_decode_init(AVCodecContext *avctx)
562562 {
563563 WMV2DecContext *const w = avctx->priv_data;
564− MpegEncContext *const s = &w->s;
564+ MpegEncContext *const s = &w->ms.m;
565565 int ret;
566566
567567 s->private_ctx = &w->common;
@@ -575,8 +575,8 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx) · 7 unmodified lines
575575
576576 decode_ext_header(w);
577577
578− return ff_intrax8_common_init(avctx, &w->x8, w->s.block,
579− w->s.mb_width, w->s.mb_height);
578+ return ff_intrax8_common_init(avctx, &w->x8, s->block,
579+ s->mb_width, s->mb_height);
580580 }
581581
582582 static av_cold int wmv2_decode_end(AVCodecContext *avctx)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t