OSDN Git Service

Merge commit '35e0833d410e31d9fd35695ad798c5d13de2af58'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 29 Nov 2013 21:27:28 +0000 (22:27 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 29 Nov 2013 21:27:28 +0000 (22:27 +0100)
* commit '35e0833d410e31d9fd35695ad798c5d13de2af58':
  mpeg4videodec: add a mpeg4-specific private context.

Conflicts:
libavcodec/mpeg4video_parser.c
libavcodec/mpeg4videodec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/mpeg4video.h
libavcodec/mpeg4video_parser.c
libavcodec/mpeg4videodec.c

Simple merge
@@@ -114,12 -106,8 +115,12 @@@ static av_cold int mpeg4video_parse_ini
  {
      struct Mp4vParseContext *pc = s->priv_data;
  
 +    ff_mpeg4videodec_static_init();
 +
      pc->first_picture           = 1;
-     pc->enc.quant_precision     = 5;
-     pc->enc.slice_context_count = 1;
-     pc->enc.showed_packed_warning = 1;
++    pc->dec_ctx.m.quant_precision     = 5;
+     pc->dec_ctx.m.slice_context_count = 1;
++    pc->dec_ctx.m.showed_packed_warning = 1;
      return 0;
  }
  
      return decode_vop_header(s, gb);
  }
  
 +av_cold void ff_mpeg4videodec_static_init(void) {
 +    static int done = 0;
 +
 +    if (!done) {
 +        ff_init_rl(&ff_mpeg4_rl_intra, ff_mpeg4_static_rl_table_store[0]);
 +        ff_init_rl(&ff_rvlc_rl_inter, ff_mpeg4_static_rl_table_store[1]);
 +        ff_init_rl(&ff_rvlc_rl_intra, ff_mpeg4_static_rl_table_store[2]);
 +        INIT_VLC_RL(ff_mpeg4_rl_intra, 554);
 +        INIT_VLC_RL(ff_rvlc_rl_inter, 1072);
 +        INIT_VLC_RL(ff_rvlc_rl_intra, 1072);
 +        INIT_VLC_STATIC(&dc_lum, DC_VLC_BITS, 10 /* 13 */,
 +                        &ff_mpeg4_DCtab_lum[0][1], 2, 1,
 +                        &ff_mpeg4_DCtab_lum[0][0], 2, 1, 512);
 +        INIT_VLC_STATIC(&dc_chrom, DC_VLC_BITS, 10 /* 13 */,
 +                        &ff_mpeg4_DCtab_chrom[0][1], 2, 1,
 +                        &ff_mpeg4_DCtab_chrom[0][0], 2, 1, 512);
 +        INIT_VLC_STATIC(&sprite_trajectory, SPRITE_TRAJ_VLC_BITS, 15,
 +                        &ff_sprite_trajectory_tab[0][1], 4, 2,
 +                        &ff_sprite_trajectory_tab[0][0], 4, 2, 128);
 +        INIT_VLC_STATIC(&mb_type_b_vlc, MB_TYPE_B_VLC_BITS, 4,
 +                        &ff_mb_type_b_tab[0][1], 2, 1,
 +                        &ff_mb_type_b_tab[0][0], 2, 1, 16);
 +        done = 1;
 +    }
 +}
 +
+ 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)
  {
-     MpegEncContext *s = avctx->priv_data;
+     Mpeg4DecContext *ctx = avctx->priv_data;
+     MpegEncContext *s = &ctx->m;
      int ret;
 -    static int done = 0;
  
      s->divx_version =
      s->divx_build   =
@@@ -2580,28 -2492,7 +2595,28 @@@ AVCodec ff_mpeg4_decoder = 
                               CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY |
                               CODEC_CAP_FRAME_THREADS,
      .flush                 = ff_mpeg_flush,
 +    .max_lowres            = 3,
      .pix_fmts              = ff_h263_hwaccel_pixfmt_list_420,
      .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,
 +};
 +
 +
 +#if CONFIG_MPEG4_VDPAU_DECODER
 +AVCodec ff_mpeg4_vdpau_decoder = {
 +    .name           = "mpeg4_vdpau",
 +    .long_name      = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 (VDPAU)"),
 +    .type           = AVMEDIA_TYPE_VIDEO,
 +    .id             = AV_CODEC_ID_MPEG4,
 +    .priv_data_size = sizeof(MpegEncContext),
 +    .init           = decode_init,
 +    .close          = ff_h263_decode_end,
 +    .decode         = ff_h263_decode_frame,
 +    .capabilities   = CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY |
 +                      CODEC_CAP_HWACCEL_VDPAU,
 +    .pix_fmts       = (const enum AVPixelFormat[]) { AV_PIX_FMT_VDPAU_MPEG4,
 +                                                  AV_PIX_FMT_NONE },
 +    .priv_class     = &mpeg4_vdpau_class,
  };
 +#endif