Commit be0b869b authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '35e0833d'

* commit '35e0833d':
  mpeg4videodec: add a mpeg4-specific private context.

Conflicts:
	libavcodec/mpeg4video_parser.c
	libavcodec/mpeg4videodec.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents f924d6e4 35e0833d
...@@ -59,6 +59,10 @@ ...@@ -59,6 +59,10 @@
#define VISUAL_OBJ_STARTCODE 0x1B5 #define VISUAL_OBJ_STARTCODE 0x1B5
#define VOP_STARTCODE 0x1B6 #define VOP_STARTCODE 0x1B6
typedef struct Mpeg4DecContext {
MpegEncContext m;
} Mpeg4DecContext;
/* dc encoding for mpeg4 */ /* dc encoding for mpeg4 */
extern const uint8_t ff_mpeg4_DCtab_lum[13][2]; extern const uint8_t ff_mpeg4_DCtab_lum[13][2];
extern const uint8_t ff_mpeg4_DCtab_chrom[13][2]; extern const uint8_t ff_mpeg4_DCtab_chrom[13][2];
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
struct Mp4vParseContext { struct Mp4vParseContext {
ParseContext pc; ParseContext pc;
struct MpegEncContext enc; Mpeg4DecContext dec_ctx;
int first_picture; int first_picture;
}; };
...@@ -78,7 +78,8 @@ static int av_mpeg4_decode_header(AVCodecParserContext *s1, ...@@ -78,7 +78,8 @@ static int av_mpeg4_decode_header(AVCodecParserContext *s1,
const uint8_t *buf, int buf_size) const uint8_t *buf, int buf_size)
{ {
struct Mp4vParseContext *pc = s1->priv_data; struct Mp4vParseContext *pc = s1->priv_data;
MpegEncContext *s = &pc->enc; Mpeg4DecContext *dec_ctx = &pc->dec_ctx;
MpegEncContext *s = &dec_ctx->m;
GetBitContext gb1, *gb = &gb1; GetBitContext gb1, *gb = &gb1;
int ret; int ret;
...@@ -117,9 +118,9 @@ static av_cold int mpeg4video_parse_init(AVCodecParserContext *s) ...@@ -117,9 +118,9 @@ static av_cold int mpeg4video_parse_init(AVCodecParserContext *s)
ff_mpeg4videodec_static_init(); ff_mpeg4videodec_static_init();
pc->first_picture = 1; pc->first_picture = 1;
pc->enc.quant_precision = 5; pc->dec_ctx.m.quant_precision = 5;
pc->enc.slice_context_count = 1; pc->dec_ctx.m.slice_context_count = 1;
pc->enc.showed_packed_warning = 1; pc->dec_ctx.m.showed_packed_warning = 1;
return 0; return 0;
} }
......
...@@ -2501,9 +2501,24 @@ av_cold void ff_mpeg4videodec_static_init(void) { ...@@ -2501,9 +2501,24 @@ av_cold void ff_mpeg4videodec_static_init(void) {
} }
} }
static int mpeg4_update_thread_context(AVCodecContext *dst,
const AVCodecContext *src)
{
Mpeg4DecContext *s = dst->priv_data;
const Mpeg4DecContext *s1 = src->priv_data;
int ret = ff_mpeg_update_thread_context(dst, src);
if (ret < 0)
return ret;
return 0;
}
static av_cold int decode_init(AVCodecContext *avctx) static av_cold int decode_init(AVCodecContext *avctx)
{ {
MpegEncContext *s = avctx->priv_data; Mpeg4DecContext *ctx = avctx->priv_data;
MpegEncContext *s = &ctx->m;
int ret; int ret;
s->divx_version = s->divx_version =
...@@ -2572,7 +2587,7 @@ AVCodec ff_mpeg4_decoder = { ...@@ -2572,7 +2587,7 @@ AVCodec ff_mpeg4_decoder = {
.long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"), .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_MPEG4, .id = AV_CODEC_ID_MPEG4,
.priv_data_size = sizeof(MpegEncContext), .priv_data_size = sizeof(Mpeg4DecContext),
.init = decode_init, .init = decode_init,
.close = ff_h263_decode_end, .close = ff_h263_decode_end,
.decode = ff_h263_decode_frame, .decode = ff_h263_decode_frame,
...@@ -2583,7 +2598,7 @@ AVCodec ff_mpeg4_decoder = { ...@@ -2583,7 +2598,7 @@ AVCodec ff_mpeg4_decoder = {
.max_lowres = 3, .max_lowres = 3,
.pix_fmts = ff_h263_hwaccel_pixfmt_list_420, .pix_fmts = ff_h263_hwaccel_pixfmt_list_420,
.profiles = NULL_IF_CONFIG_SMALL(mpeg4_video_profiles), .profiles = NULL_IF_CONFIG_SMALL(mpeg4_video_profiles),
.update_thread_context = ONLY_IF_THREADS_ENABLED(ff_mpeg_update_thread_context), .update_thread_context = ONLY_IF_THREADS_ENABLED(mpeg4_update_thread_context),
.priv_class = &mpeg4_class, .priv_class = &mpeg4_class,
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment