Commit b465449e authored by Michael Niedermayer's avatar Michael Niedermayer

dynamic alloc of picture structs instead of putting them in MpegEncContext

Originally committed as revision 2410 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 7f96ed5b
...@@ -444,6 +444,8 @@ int MPV_common_init(MpegEncContext *s) ...@@ -444,6 +444,8 @@ int MPV_common_init(MpegEncContext *s)
CHECKED_ALLOCZ(s->lambda_table, mb_array_size * sizeof(int)) CHECKED_ALLOCZ(s->lambda_table, mb_array_size * sizeof(int))
} }
CHECKED_ALLOCZ(s->picture, MAX_PICTURE_COUNT * sizeof(Picture))
CHECKED_ALLOCZ(s->error_status_table, mb_array_size*sizeof(uint8_t)) CHECKED_ALLOCZ(s->error_status_table, mb_array_size*sizeof(uint8_t))
if (s->out_format == FMT_H263 || s->encoding) { if (s->out_format == FMT_H263 || s->encoding) {
...@@ -562,6 +564,7 @@ void MPV_common_end(MpegEncContext *s) ...@@ -562,6 +564,7 @@ void MPV_common_end(MpegEncContext *s)
for(i=0; i<MAX_PICTURE_COUNT; i++){ for(i=0; i<MAX_PICTURE_COUNT; i++){
free_picture(s, &s->picture[i]); free_picture(s, &s->picture[i]);
} }
av_freep(&s->picture);
avcodec_default_free_buffers(s->avctx); avcodec_default_free_buffers(s->avctx);
s->context_initialized = 0; s->context_initialized = 0;
s->last_picture_ptr= s->last_picture_ptr=
......
...@@ -301,7 +301,7 @@ typedef struct MpegEncContext { ...@@ -301,7 +301,7 @@ typedef struct MpegEncContext {
int mb_num; ///< number of MBs of a picture int mb_num; ///< number of MBs of a picture
int linesize; ///< line size, in bytes, may be different from width int linesize; ///< line size, in bytes, may be different from width
int uvlinesize; ///< line size, for chroma in bytes, may be different from width int uvlinesize; ///< line size, for chroma in bytes, may be different from width
Picture picture[MAX_PICTURE_COUNT]; ///< main picture buffer Picture *picture; ///< main picture buffer
Picture *input_picture[MAX_PICTURE_COUNT]; ///< next pictures on display order for encoding Picture *input_picture[MAX_PICTURE_COUNT]; ///< next pictures on display order for encoding
Picture *reordered_input_picture[MAX_PICTURE_COUNT]; ///< pointer to the next pictures in codedorder for encoding Picture *reordered_input_picture[MAX_PICTURE_COUNT]; ///< pointer to the next pictures in codedorder for encoding
......
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