History

avcodec/h263dec, mpeg4videodec: Parse extradata during init

Possible now that the IDCT is already initialized at this point.

Andreas Rheinhardt committed 3 years ago

Commit ca3dea81 parent 49b4ed73 files · +9 −8Browse files

Unified · Split

3 files
  1. libavcodec/h263dec.c +0 −7
  2. libavcodec/mpeg4videodec.c +9 −0
  3. libavcodec/mpegvideo.h +0 −1
libavcodec/h263dec.c+0−7
@@ -464,13 +464,6 @@ retry: · 463 unmodified lines
464 } else if (CONFIG_MSMPEG4DEC && s->msmpeg4_version) {464 } else if (CONFIG_MSMPEG4DEC && s->msmpeg4_version) {
465 ret = ff_msmpeg4_decode_picture_header(s);465 ret = ff_msmpeg4_decode_picture_header(s);
466 } else if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {466 } else if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {
467 if (s->avctx->extradata_size && !s->extradata_parsed) {
468 GetBitContext gb;
469
470 if (init_get_bits8(&gb, s->avctx->extradata, s->avctx->extradata_size) >= 0 )
471 ff_mpeg4_decode_picture_header(avctx->priv_data, &gb, 1, 0);
472 s->extradata_parsed = 1;
473 }
474 ret = ff_mpeg4_decode_picture_header(avctx->priv_data, &s->gb, 0, 0);467 ret = ff_mpeg4_decode_picture_header(avctx->priv_data, &s->gb, 0, 0);
475 s->skipped_last_frame = (ret == FRAME_SKIPPED);468 s->skipped_last_frame = (ret == FRAME_SKIPPED);
476 } else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) {469 } else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) {
libavcodec/mpeg4videodec.c+9−0
@@ -42,6 +42,7 @@ · 41 unmodified lines
42#include "h263.h"42#include "h263.h"
43#include "h263data.h"43#include "h263data.h"
44#include "h263dec.h"44#include "h263dec.h"
45#include "internal.h"
45#include "profiles.h"46#include "profiles.h"
46#include "qpeldsp.h"47#include "qpeldsp.h"
47#include "threadframe.h"48#include "threadframe.h"
@@ -3828,6 +3829,14 @@ static av_cold int decode_init(AVCodecContext *avctx) · 3780 unmodified lines
3828 3829
3829 ff_thread_once(&init_static_once, mpeg4_init_static);3830 ff_thread_once(&init_static_once, mpeg4_init_static);
3830 3831
3832 /* Must be after initializing the MPEG-4 static tables */
3833 if (avctx->extradata_size && !avctx->internal->is_copy) {
3834 GetBitContext gb;
3835
3836 if (init_get_bits8(&gb, avctx->extradata, avctx->extradata_size) >= 0)
3837 ff_mpeg4_decode_picture_header(ctx, &gb, 1, 0);
3838 }
3839
3831 return 0;3840 return 0;
3832}3841}
3833 3842
libavcodec/mpegvideo.h+0−1
@@ -114,7 +114,6 @@ typedef struct MpegEncContext { · 113 unmodified lines
114 int input_picture_number; ///< used to set pic->display_picture_number, should not be used for/by anything else114 int input_picture_number; ///< used to set pic->display_picture_number, should not be used for/by anything else
115 int coded_picture_number; ///< used to set pic->coded_picture_number, should not be used for/by anything else115 int coded_picture_number; ///< used to set pic->coded_picture_number, should not be used for/by anything else
116 int picture_number; //FIXME remove, unclear definition116 int picture_number; //FIXME remove, unclear definition
117 int extradata_parsed;
118 int picture_in_gop_number; ///< 0-> first pic in gop, ...117 int picture_in_gop_number; ///< 0-> first pic in gop, ...
119 int mb_width, mb_height; ///< number of MBs horizontally & vertically118 int mb_width, mb_height; ///< number of MBs horizontally & vertically
120 int mb_stride; ///< mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11119 int mb_stride; ///< mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11

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