You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/msmpeg4dec: Add MSMPEG4DecContext
This is in preparation for further commits. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -845,7 +845,7 @@ const FFCodec ff_msmpeg4v1_decoder = {
|
|||||||
CODEC_LONG_NAME("MPEG-4 part 2 Microsoft variant version 1"),
|
CODEC_LONG_NAME("MPEG-4 part 2 Microsoft variant version 1"),
|
||||||
.p.type = AVMEDIA_TYPE_VIDEO,
|
.p.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.p.id = AV_CODEC_ID_MSMPEG4V1,
|
.p.id = AV_CODEC_ID_MSMPEG4V1,
|
||||||
.priv_data_size = sizeof(MpegEncContext),
|
.priv_data_size = sizeof(MSMP4DecContext),
|
||||||
.init = ff_msmpeg4_decode_init,
|
.init = ff_msmpeg4_decode_init,
|
||||||
FF_CODEC_DECODE_CB(ff_h263_decode_frame),
|
FF_CODEC_DECODE_CB(ff_h263_decode_frame),
|
||||||
.close = ff_mpv_decode_close,
|
.close = ff_mpv_decode_close,
|
||||||
@ -860,7 +860,7 @@ const FFCodec ff_msmpeg4v2_decoder = {
|
|||||||
CODEC_LONG_NAME("MPEG-4 part 2 Microsoft variant version 2"),
|
CODEC_LONG_NAME("MPEG-4 part 2 Microsoft variant version 2"),
|
||||||
.p.type = AVMEDIA_TYPE_VIDEO,
|
.p.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.p.id = AV_CODEC_ID_MSMPEG4V2,
|
.p.id = AV_CODEC_ID_MSMPEG4V2,
|
||||||
.priv_data_size = sizeof(MpegEncContext),
|
.priv_data_size = sizeof(MSMP4DecContext),
|
||||||
.init = ff_msmpeg4_decode_init,
|
.init = ff_msmpeg4_decode_init,
|
||||||
FF_CODEC_DECODE_CB(ff_h263_decode_frame),
|
FF_CODEC_DECODE_CB(ff_h263_decode_frame),
|
||||||
.close = ff_mpv_decode_close,
|
.close = ff_mpv_decode_close,
|
||||||
@ -875,7 +875,7 @@ const FFCodec ff_msmpeg4v3_decoder = {
|
|||||||
CODEC_LONG_NAME("MPEG-4 part 2 Microsoft variant version 3"),
|
CODEC_LONG_NAME("MPEG-4 part 2 Microsoft variant version 3"),
|
||||||
.p.type = AVMEDIA_TYPE_VIDEO,
|
.p.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.p.id = AV_CODEC_ID_MSMPEG4V3,
|
.p.id = AV_CODEC_ID_MSMPEG4V3,
|
||||||
.priv_data_size = sizeof(MpegEncContext),
|
.priv_data_size = sizeof(MSMP4DecContext),
|
||||||
.init = ff_msmpeg4_decode_init,
|
.init = ff_msmpeg4_decode_init,
|
||||||
FF_CODEC_DECODE_CB(ff_h263_decode_frame),
|
FF_CODEC_DECODE_CB(ff_h263_decode_frame),
|
||||||
.close = ff_mpv_decode_close,
|
.close = ff_mpv_decode_close,
|
||||||
@ -890,7 +890,7 @@ const FFCodec ff_wmv1_decoder = {
|
|||||||
CODEC_LONG_NAME("Windows Media Video 7"),
|
CODEC_LONG_NAME("Windows Media Video 7"),
|
||||||
.p.type = AVMEDIA_TYPE_VIDEO,
|
.p.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.p.id = AV_CODEC_ID_WMV1,
|
.p.id = AV_CODEC_ID_WMV1,
|
||||||
.priv_data_size = sizeof(MpegEncContext),
|
.priv_data_size = sizeof(MSMP4DecContext),
|
||||||
.init = ff_msmpeg4_decode_init,
|
.init = ff_msmpeg4_decode_init,
|
||||||
FF_CODEC_DECODE_CB(ff_h263_decode_frame),
|
FF_CODEC_DECODE_CB(ff_h263_decode_frame),
|
||||||
.close = ff_mpv_decode_close,
|
.close = ff_mpv_decode_close,
|
||||||
|
@ -28,6 +28,16 @@
|
|||||||
#define INTER_INTRA_VLC_BITS 3
|
#define INTER_INTRA_VLC_BITS 3
|
||||||
#define MB_NON_INTRA_VLC_BITS 9
|
#define MB_NON_INTRA_VLC_BITS 9
|
||||||
|
|
||||||
|
typedef struct MSMP4DecContext {
|
||||||
|
MpegEncContext m;
|
||||||
|
} MSMP4DecContext;
|
||||||
|
|
||||||
|
static inline MSMP4DecContext *mpv_to_msmpeg4(MpegEncContext *s)
|
||||||
|
{
|
||||||
|
// Only legal because no MSMPEG-4 decoder uses slice-threading.
|
||||||
|
return (MSMP4DecContext*)s;
|
||||||
|
}
|
||||||
|
|
||||||
extern const VLCElem *ff_mb_non_intra_vlc[4];
|
extern const VLCElem *ff_mb_non_intra_vlc[4];
|
||||||
extern VLCElem ff_inter_intra_vlc[8];
|
extern VLCElem ff_inter_intra_vlc[8];
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "wmv2dec.h"
|
#include "wmv2dec.h"
|
||||||
|
|
||||||
typedef struct WMV2DecContext {
|
typedef struct WMV2DecContext {
|
||||||
MpegEncContext s;
|
MSMP4DecContext ms;
|
||||||
WMV2Context common;
|
WMV2Context common;
|
||||||
IntraX8Context x8;
|
IntraX8Context x8;
|
||||||
int j_type_bit;
|
int j_type_bit;
|
||||||
@ -59,7 +59,7 @@ typedef struct WMV2DecContext {
|
|||||||
static void wmv2_add_block(WMV2DecContext *w, int16_t *block1,
|
static void wmv2_add_block(WMV2DecContext *w, int16_t *block1,
|
||||||
uint8_t *dst, int stride, int n)
|
uint8_t *dst, int stride, int n)
|
||||||
{
|
{
|
||||||
MpegEncContext *const s = &w->s;
|
MpegEncContext *const s = &w->ms.m;
|
||||||
|
|
||||||
if (s->block_last_index[n] >= 0) {
|
if (s->block_last_index[n] >= 0) {
|
||||||
switch (w->abt_type_table[n]) {
|
switch (w->abt_type_table[n]) {
|
||||||
@ -103,7 +103,7 @@ static int parse_mb_skip(WMV2DecContext *w)
|
|||||||
{
|
{
|
||||||
int mb_x, mb_y;
|
int mb_x, mb_y;
|
||||||
int coded_mb_count = 0;
|
int coded_mb_count = 0;
|
||||||
MpegEncContext *const s = &w->s;
|
MpegEncContext *const s = &w->ms.m;
|
||||||
uint32_t *const mb_type = s->cur_pic.mb_type;
|
uint32_t *const mb_type = s->cur_pic.mb_type;
|
||||||
|
|
||||||
w->skip_type = get_bits(&s->gb, 2);
|
w->skip_type = get_bits(&s->gb, 2);
|
||||||
@ -166,7 +166,7 @@ static int parse_mb_skip(WMV2DecContext *w)
|
|||||||
|
|
||||||
static int decode_ext_header(WMV2DecContext *w)
|
static int decode_ext_header(WMV2DecContext *w)
|
||||||
{
|
{
|
||||||
MpegEncContext *const s = &w->s;
|
MpegEncContext *const s = &w->ms.m;
|
||||||
GetBitContext gb;
|
GetBitContext gb;
|
||||||
int fps;
|
int fps;
|
||||||
int code;
|
int code;
|
||||||
@ -336,8 +336,8 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
|
|||||||
2 * s->qscale, (s->qscale - 1) | 1,
|
2 * s->qscale, (s->qscale - 1) | 1,
|
||||||
s->loop_filter, s->low_delay);
|
s->loop_filter, s->low_delay);
|
||||||
|
|
||||||
ff_er_add_slice(&w->s.er, 0, 0,
|
ff_er_add_slice(&s->er, 0, 0,
|
||||||
(w->s.mb_x >> 1) - 1, (w->s.mb_y >> 1) - 1,
|
(s->mb_x >> 1) - 1, (s->mb_y >> 1) - 1,
|
||||||
ER_MB_END);
|
ER_MB_END);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -347,7 +347,7 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
|
|||||||
|
|
||||||
static inline void wmv2_decode_motion(WMV2DecContext *w, int *mx_ptr, int *my_ptr)
|
static inline void wmv2_decode_motion(WMV2DecContext *w, int *mx_ptr, int *my_ptr)
|
||||||
{
|
{
|
||||||
MpegEncContext *const s = &w->s;
|
MpegEncContext *const s = &w->ms.m;
|
||||||
|
|
||||||
ff_msmpeg4_decode_motion(s, mx_ptr, my_ptr);
|
ff_msmpeg4_decode_motion(s, mx_ptr, my_ptr);
|
||||||
|
|
||||||
@ -359,7 +359,7 @@ static inline void wmv2_decode_motion(WMV2DecContext *w, int *mx_ptr, int *my_pt
|
|||||||
|
|
||||||
static int16_t *wmv2_pred_motion(WMV2DecContext *w, int *px, int *py)
|
static int16_t *wmv2_pred_motion(WMV2DecContext *w, int *px, int *py)
|
||||||
{
|
{
|
||||||
MpegEncContext *const s = &w->s;
|
MpegEncContext *const s = &w->ms.m;
|
||||||
int xy, wrap, diff, type;
|
int xy, wrap, diff, type;
|
||||||
int16_t *A, *B, *C, *mot_val;
|
int16_t *A, *B, *C, *mot_val;
|
||||||
|
|
||||||
@ -405,7 +405,7 @@ static int16_t *wmv2_pred_motion(WMV2DecContext *w, int *px, int *py)
|
|||||||
static inline int wmv2_decode_inter_block(WMV2DecContext *w, int16_t *block,
|
static inline int wmv2_decode_inter_block(WMV2DecContext *w, int16_t *block,
|
||||||
int n, int cbp)
|
int n, int cbp)
|
||||||
{
|
{
|
||||||
MpegEncContext *const s = &w->s;
|
MpegEncContext *const s = &w->ms.m;
|
||||||
static const int sub_cbp_table[3] = { 2, 3, 1 };
|
static const int sub_cbp_table[3] = { 2, 3, 1 };
|
||||||
int sub_cbp, ret;
|
int sub_cbp, ret;
|
||||||
|
|
||||||
@ -561,7 +561,7 @@ static int wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64])
|
|||||||
static av_cold int wmv2_decode_init(AVCodecContext *avctx)
|
static av_cold int wmv2_decode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
WMV2DecContext *const w = avctx->priv_data;
|
WMV2DecContext *const w = avctx->priv_data;
|
||||||
MpegEncContext *const s = &w->s;
|
MpegEncContext *const s = &w->ms.m;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
s->private_ctx = &w->common;
|
s->private_ctx = &w->common;
|
||||||
@ -575,8 +575,8 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
decode_ext_header(w);
|
decode_ext_header(w);
|
||||||
|
|
||||||
return ff_intrax8_common_init(avctx, &w->x8, w->s.block,
|
return ff_intrax8_common_init(avctx, &w->x8, s->block,
|
||||||
w->s.mb_width, w->s.mb_height);
|
s->mb_width, s->mb_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold int wmv2_decode_end(AVCodecContext *avctx)
|
static av_cold int wmv2_decode_end(AVCodecContext *avctx)
|
||||||
|
Reference in New Issue
Block a user