History

avcodec/mpegvideo: Only allocate coded_block when needed

It is only needed for msmpeg4v3, wmv1, wmv2 and VC-1.

Andreas Rheinhardt committed 2 years ago

Commit ba033ac1 parent 1a5c21d1 file · +8 −3Browse files

Unified · Split

libavcodec/mpegvideo.c+8−3
@@ -596,11 +596,16 @@ int ff_mpv_init_context_frame(MpegEncContext *s) · 595 unmodified lines
596596 }
597597
598598 if (s->out_format == FMT_H263) {
599− /* cbp values, cbp, ac_pred, pred_dir */
600− if (!(s->coded_block_base = av_mallocz(y_size + (s->mb_height&1)*2*s->b8_stride)) ||
601− !(s->cbp_table = av_mallocz(mb_array_size)) ||
599+ /* cbp, ac_pred, pred_dir */
600+ if (!(s->cbp_table = av_mallocz(mb_array_size)) ||
602601 !(s->pred_dir_table = av_mallocz(mb_array_size)))
603602 return AVERROR(ENOMEM);
603+ }
604+
605+ if (s->msmpeg4_version >= 3) {
606+ s->coded_block_base = av_mallocz(y_size + (s->mb_height&1)*2*s->b8_stride);
607+ if (!s->coded_block_base)
608+ return AVERROR(ENOMEM);
604609 s->coded_block = s->coded_block_base + s->b8_stride + 1;
605610 }
606611

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