mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/mjpegenc_common: Use ff_mpv_reallocate_putbitbuffer()
Fixes assertion failure Fixes Ticket4396 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
00f3bb2ef2
commit
c50904fd78
@ -342,20 +342,30 @@ void ff_mjpeg_escape_FF(PutBitContext *pb, int start)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_mjpeg_encode_stuffing(MpegEncContext *s)
|
int ff_mjpeg_encode_stuffing(MpegEncContext *s)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
PutBitContext *pbc = &s->pb;
|
PutBitContext *pbc = &s->pb;
|
||||||
int mb_y = s->mb_y - !s->mb_x;
|
int mb_y = s->mb_y - !s->mb_x;
|
||||||
|
|
||||||
|
int ret = ff_mpv_reallocate_putbitbuffer(s, put_bits_count(&s->pb) / 8 + 100,
|
||||||
|
put_bits_count(&s->pb) / 4 + 1000);
|
||||||
|
if (ret < 0) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "Buffer reallocation failed\n");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
ff_mjpeg_escape_FF(pbc, s->esc_pos);
|
ff_mjpeg_escape_FF(pbc, s->esc_pos);
|
||||||
|
|
||||||
if((s->avctx->active_thread_type & FF_THREAD_SLICE) && mb_y < s->mb_height)
|
if((s->avctx->active_thread_type & FF_THREAD_SLICE) && mb_y < s->mb_height)
|
||||||
put_marker(pbc, RST0 + (mb_y&7));
|
put_marker(pbc, RST0 + (mb_y&7));
|
||||||
s->esc_pos = put_bits_count(pbc) >> 3;
|
s->esc_pos = put_bits_count(pbc) >> 3;
|
||||||
|
fail:
|
||||||
|
|
||||||
for(i=0; i<3; i++)
|
for(i=0; i<3; i++)
|
||||||
s->last_dc[i] = 128 << s->intra_dc_precision;
|
s->last_dc[i] = 128 << s->intra_dc_precision;
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits)
|
void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits)
|
||||||
|
@ -34,7 +34,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
|
|||||||
uint16_t chroma_intra_matrix[64]);
|
uint16_t chroma_intra_matrix[64]);
|
||||||
void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits);
|
void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits);
|
||||||
void ff_mjpeg_escape_FF(PutBitContext *pb, int start);
|
void ff_mjpeg_escape_FF(PutBitContext *pb, int start);
|
||||||
void ff_mjpeg_encode_stuffing(MpegEncContext *s);
|
int ff_mjpeg_encode_stuffing(MpegEncContext *s);
|
||||||
void ff_mjpeg_init_hvsample(AVCodecContext *avctx, int hsample[3], int vsample[3]);
|
void ff_mjpeg_init_hvsample(AVCodecContext *avctx, int hsample[3], int vsample[3]);
|
||||||
|
|
||||||
void ff_mjpeg_encode_dc(PutBitContext *pb, int val,
|
void ff_mjpeg_encode_dc(PutBitContext *pb, int val,
|
||||||
|
Loading…
Reference in New Issue
Block a user