[FFmpeg-cvslog] Fix buffer_size argument to init_put_bits() in multiple encoders.
ffmpeg | branch: release/2.4 | Dyami Caliri dy...@dragonframe.com | Thu Feb 26 10:17:01 2015 -0800| [bcbae2d95fc5e5df6116200f7a249ebb4805e415] | committer: Michael Niedermayer Fix buffer_size argument to init_put_bits() in multiple encoders. Several encoders were multiplying the buffer size by 8, in order to get a bit size. However, the buffer_size argument is for the byte size of the buffer. We had experienced crashes encoding prores (Anatoliy) at size 4096x4096. (cherry picked from commit 50833c9f7b4e1922197a8955669f8ab3589c8cef) Signed-off-by: Michael Niedermayer michae...@gmx.at http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bcbae2d95fc5e5df6116200f7a249ebb4805e415 --- libavcodec/aacenc.c |2 +- libavcodec/adpcmenc.c |4 ++-- libavcodec/faxcompr.c |2 +- libavcodec/flashsv2enc.c|2 +- libavcodec/flashsvenc.c |2 +- libavcodec/nellymoserenc.c |2 +- libavcodec/proresenc_anatoliy.c |2 +- libavcodec/proresenc_kostya.c |2 +- libavcodec/s302menc.c |2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index b3bd9c8..94d54eb 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -165,7 +165,7 @@ static void put_audio_specific_config(AVCodecContext *avctx) PutBitContext pb; AACEncContext *s = avctx-priv_data; -init_put_bits(pb, avctx-extradata, avctx-extradata_size*8); +init_put_bits(pb, avctx-extradata, avctx-extradata_size); put_bits(pb, 5, 2); //object type - AAC-LC put_bits(pb, 4, s-samplerate_index); //sample rate index put_bits(pb, 4, s-channels); diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c index ea6cc23..7692db4 100644 --- a/libavcodec/adpcmenc.c +++ b/libavcodec/adpcmenc.c @@ -541,7 +541,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, case AV_CODEC_ID_ADPCM_IMA_QT: { PutBitContext pb; -init_put_bits(pb, dst, pkt_size * 8); +init_put_bits(pb, dst, pkt_size); for (ch = 0; ch avctx-channels; ch++) { ADPCMChannelStatus *status = c-status[ch]; @@ -571,7 +571,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, case AV_CODEC_ID_ADPCM_SWF: { PutBitContext pb; -init_put_bits(pb, dst, pkt_size * 8); +init_put_bits(pb, dst, pkt_size); n = frame-nb_samples - 1; diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c index 155f78d..ba7096d 100644 --- a/libavcodec/faxcompr.c +++ b/libavcodec/faxcompr.c @@ -251,7 +251,7 @@ static void put_line(uint8_t *dst, int size, int width, const int *runs) PutBitContext pb; int run, mode = ~0, pix_left = width, run_idx = 0; -init_put_bits(pb, dst, size * 8); +init_put_bits(pb, dst, size); while (pix_left 0) { run = runs[run_idx++]; mode = ~mode; diff --git a/libavcodec/flashsv2enc.c b/libavcodec/flashsv2enc.c index 9735a13..b6c9453 100644 --- a/libavcodec/flashsv2enc.c +++ b/libavcodec/flashsv2enc.c @@ -287,7 +287,7 @@ static int write_header(FlashSV2Context * s, uint8_t * buf, int buf_size) if (buf_size 5) return -1; -init_put_bits(pb, buf, buf_size * 8); +init_put_bits(pb, buf, buf_size); put_bits(pb, 4, (s-block_width 4) - 1); put_bits(pb, 12, s-image_width); diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c index 7ad15f1..6d406e9 100644 --- a/libavcodec/flashsvenc.c +++ b/libavcodec/flashsvenc.c @@ -151,7 +151,7 @@ static int encode_bitstream(FlashSVContext *s, const AVFrame *p, uint8_t *buf, int buf_pos, res; int pred_blocks = 0; -init_put_bits(pb, buf, buf_size * 8); +init_put_bits(pb, buf, buf_size); put_bits(pb, 4, block_width / 16 - 1); put_bits(pb, 12, s-image_width); diff --git a/libavcodec/nellymoserenc.c b/libavcodec/nellymoserenc.c index 98e33f0..e879d57 100644 --- a/libavcodec/nellymoserenc.c +++ b/libavcodec/nellymoserenc.c @@ -303,7 +303,7 @@ static void encode_block(NellyMoserEncodeContext *s, unsigned char *output, int apply_mdct(s); -init_put_bits(pb, output, output_size * 8); +init_put_bits(pb, output, output_size); i = 0; for (band = 0; band NELLY_BANDS; band++) { diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index f471f49..801d58e 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -304,7 +304,7 @@ static int encode_slice_plane(AVCodecContext *avctx, int mb_count, } blocks_per_slice = mb_count (2 - chroma); -init_put_bits(pb, buf, buf_size 3); +init_put_bits(pb, buf, buf_size); encode_dc_coeffs(pb, blocks, blocks_per_slice, qmat); encode_ac_coeffs(avctx, pb, blocks, blocks_per_slice, qmat); diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c index c9cb063..2ad7f74
[FFmpeg-cvslog] Fix buffer_size argument to init_put_bits() in multiple encoders.
ffmpeg | branch: release/2.2 | Dyami Caliri dy...@dragonframe.com | Thu Feb 26 10:17:01 2015 -0800| [265ad094a8cbf071f24a32370a7ed3e2e7539e5a] | committer: Michael Niedermayer Fix buffer_size argument to init_put_bits() in multiple encoders. Several encoders were multiplying the buffer size by 8, in order to get a bit size. However, the buffer_size argument is for the byte size of the buffer. We had experienced crashes encoding prores (Anatoliy) at size 4096x4096. (cherry picked from commit 50833c9f7b4e1922197a8955669f8ab3589c8cef) Conflicts: libavcodec/proresenc_kostya.c http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=265ad094a8cbf071f24a32370a7ed3e2e7539e5a --- libavcodec/aacenc.c |2 +- libavcodec/adpcmenc.c |4 ++-- libavcodec/faxcompr.c |2 +- libavcodec/flashsv2enc.c|2 +- libavcodec/flashsvenc.c |2 +- libavcodec/nellymoserenc.c |2 +- libavcodec/proresenc_anatoliy.c |2 +- libavcodec/proresenc_kostya.c |2 +- libavcodec/s302menc.c |2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 5596b4b..24de94f 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -165,7 +165,7 @@ static void put_audio_specific_config(AVCodecContext *avctx) PutBitContext pb; AACEncContext *s = avctx-priv_data; -init_put_bits(pb, avctx-extradata, avctx-extradata_size*8); +init_put_bits(pb, avctx-extradata, avctx-extradata_size); put_bits(pb, 5, 2); //object type - AAC-LC put_bits(pb, 4, s-samplerate_index); //sample rate index put_bits(pb, 4, s-channels); diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c index da149a3..e0737e2 100644 --- a/libavcodec/adpcmenc.c +++ b/libavcodec/adpcmenc.c @@ -541,7 +541,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, case AV_CODEC_ID_ADPCM_IMA_QT: { PutBitContext pb; -init_put_bits(pb, dst, pkt_size * 8); +init_put_bits(pb, dst, pkt_size); for (ch = 0; ch avctx-channels; ch++) { ADPCMChannelStatus *status = c-status[ch]; @@ -571,7 +571,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, case AV_CODEC_ID_ADPCM_SWF: { PutBitContext pb; -init_put_bits(pb, dst, pkt_size * 8); +init_put_bits(pb, dst, pkt_size); n = frame-nb_samples - 1; diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c index 900851b..d2ba706 100644 --- a/libavcodec/faxcompr.c +++ b/libavcodec/faxcompr.c @@ -251,7 +251,7 @@ static void put_line(uint8_t *dst, int size, int width, const int *runs) PutBitContext pb; int run, mode = ~0, pix_left = width, run_idx = 0; -init_put_bits(pb, dst, size * 8); +init_put_bits(pb, dst, size); while (pix_left 0) { run = runs[run_idx++]; mode = ~mode; diff --git a/libavcodec/flashsv2enc.c b/libavcodec/flashsv2enc.c index 436daa4..5fff04c 100644 --- a/libavcodec/flashsv2enc.c +++ b/libavcodec/flashsv2enc.c @@ -287,7 +287,7 @@ static int write_header(FlashSV2Context * s, uint8_t * buf, int buf_size) if (buf_size 5) return -1; -init_put_bits(pb, buf, buf_size * 8); +init_put_bits(pb, buf, buf_size); put_bits(pb, 4, (s-block_width 4) - 1); put_bits(pb, 12, s-image_width); diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c index 7ad15f1..6d406e9 100644 --- a/libavcodec/flashsvenc.c +++ b/libavcodec/flashsvenc.c @@ -151,7 +151,7 @@ static int encode_bitstream(FlashSVContext *s, const AVFrame *p, uint8_t *buf, int buf_pos, res; int pred_blocks = 0; -init_put_bits(pb, buf, buf_size * 8); +init_put_bits(pb, buf, buf_size); put_bits(pb, 4, block_width / 16 - 1); put_bits(pb, 12, s-image_width); diff --git a/libavcodec/nellymoserenc.c b/libavcodec/nellymoserenc.c index f9d1389..8f15757 100644 --- a/libavcodec/nellymoserenc.c +++ b/libavcodec/nellymoserenc.c @@ -301,7 +301,7 @@ static void encode_block(NellyMoserEncodeContext *s, unsigned char *output, int apply_mdct(s); -init_put_bits(pb, output, output_size * 8); +init_put_bits(pb, output, output_size); i = 0; for (band = 0; band NELLY_BANDS; band++) { diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index 80ce135..da25b6b 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -304,7 +304,7 @@ static int encode_slice_plane(AVCodecContext *avctx, int mb_count, } blocks_per_slice = mb_count (2 - chroma); -init_put_bits(pb, buf, buf_size 3); +init_put_bits(pb, buf, buf_size); encode_dc_coeffs(pb, blocks, blocks_per_slice, qmat); encode_ac_coeffs(avctx, pb, blocks, blocks_per_slice, qmat); diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c index e263bb9..6b084a5
[FFmpeg-cvslog] Fix buffer_size argument to init_put_bits() in multiple encoders.
ffmpeg | branch: release/0.10 | Dyami Caliri dy...@dragonframe.com | Thu Feb 26 10:17:01 2015 -0800| [c89645c3ef4b975aac0b25a5a8c1707a2567d7da] | committer: Michael Niedermayer Fix buffer_size argument to init_put_bits() in multiple encoders. Several encoders were multiplying the buffer size by 8, in order to get a bit size. However, the buffer_size argument is for the byte size of the buffer. We had experienced crashes encoding prores (Anatoliy) at size 4096x4096. (cherry picked from commit 50833c9f7b4e1922197a8955669f8ab3589c8cef) Conflicts: libavcodec/proresenc_kostya.c Conflicts: libavcodec/faxcompr.c libavcodec/s302menc.c Conflicts: libavcodec/adpcmenc.c http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c89645c3ef4b975aac0b25a5a8c1707a2567d7da --- libavcodec/aacenc.c|2 +- libavcodec/adpcmenc.c |4 ++-- libavcodec/faxcompr.c |2 +- libavcodec/flashsv2enc.c |2 +- libavcodec/flashsvenc.c|2 +- libavcodec/nellymoserenc.c |2 +- libavcodec/proresenc.c |2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 2ff6f9c..d66dcfd 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -164,7 +164,7 @@ static void put_audio_specific_config(AVCodecContext *avctx) PutBitContext pb; AACEncContext *s = avctx-priv_data; -init_put_bits(pb, avctx-extradata, avctx-extradata_size*8); +init_put_bits(pb, avctx-extradata, avctx-extradata_size); put_bits(pb, 5, 2); //object type - AAC-LC put_bits(pb, 4, s-samplerate_index); //sample rate index put_bits(pb, 4, s-channels); diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c index 1b3d1bc..73da927 100644 --- a/libavcodec/adpcmenc.c +++ b/libavcodec/adpcmenc.c @@ -551,7 +551,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, { int ch, i; PutBitContext pb; -init_put_bits(pb, dst, buf_size * 8); +init_put_bits(pb, dst, buf_size); for (ch = 0; ch avctx-channels; ch++) { put_bits(pb, 9, (c-status[ch].prev_sample 0x) 7); @@ -582,7 +582,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, { int i; PutBitContext pb; -init_put_bits(pb, dst, buf_size * 8); +init_put_bits(pb, dst, buf_size); n = avctx-frame_size - 1; diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c index d358940..01c8c61 100644 --- a/libavcodec/faxcompr.c +++ b/libavcodec/faxcompr.c @@ -243,7 +243,7 @@ static void put_line(uint8_t *dst, int size, int width, const int *runs) PutBitContext pb; int run, mode = ~0, pix_left = width, run_idx = 0; -init_put_bits(pb, dst, size*8); +init_put_bits(pb, dst, size); while(pix_left 0){ run = runs[run_idx++]; mode = ~mode; diff --git a/libavcodec/flashsv2enc.c b/libavcodec/flashsv2enc.c index 6466be7..dd477d4 100644 --- a/libavcodec/flashsv2enc.c +++ b/libavcodec/flashsv2enc.c @@ -270,7 +270,7 @@ static int write_header(FlashSV2Context * s, uint8_t * buf, int buf_size) if (buf_size 5) return -1; -init_put_bits(pb, buf, buf_size * 8); +init_put_bits(pb, buf, buf_size); put_bits(pb, 4, (s-block_width 4) - 1); put_bits(pb, 12, s-image_width); diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c index 7e21e7d..8ed92a6 100644 --- a/libavcodec/flashsvenc.c +++ b/libavcodec/flashsvenc.c @@ -130,7 +130,7 @@ static int encode_bitstream(FlashSVContext *s, AVFrame *p, uint8_t *buf, int buf_pos, res; int pred_blocks = 0; -init_put_bits(pb, buf, buf_size * 8); +init_put_bits(pb, buf, buf_size); put_bits(pb, 4, block_width / 16 - 1); put_bits(pb, 12, s-image_width); diff --git a/libavcodec/nellymoserenc.c b/libavcodec/nellymoserenc.c index 725270c..54820ad 100644 --- a/libavcodec/nellymoserenc.c +++ b/libavcodec/nellymoserenc.c @@ -288,7 +288,7 @@ static void encode_block(NellyMoserEncodeContext *s, unsigned char *output, int apply_mdct(s); -init_put_bits(pb, output, output_size * 8); +init_put_bits(pb, output, output_size); i = 0; for (band = 0; band NELLY_BANDS; band++) { diff --git a/libavcodec/proresenc.c b/libavcodec/proresenc.c index 09678a0..26afe59 100644 --- a/libavcodec/proresenc.c +++ b/libavcodec/proresenc.c @@ -302,7 +302,7 @@ static int encode_slice_plane(AVCodecContext *avctx, int mb_count, } blocks_per_slice = mb_count (2 - chroma); -init_put_bits(pb, buf, buf_size 3); +init_put_bits(pb, buf, buf_size); encode_dc_coeffs(pb, blocks, blocks_per_slice, qmat); encode_ac_coeffs(avctx, pb, blocks, blocks_per_slice, qmat); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Fix buffer_size argument to init_put_bits() in multiple encoders.
ffmpeg | branch: master | Dyami Caliri dy...@dragonframe.com | Thu Feb 26 10:17:01 2015 -0800| [50833c9f7b4e1922197a8955669f8ab3589c8cef] | committer: Michael Niedermayer Fix buffer_size argument to init_put_bits() in multiple encoders. Several encoders were multiplying the buffer size by 8, in order to get a bit size. However, the buffer_size argument is for the byte size of the buffer. We had experienced crashes encoding prores (Anatoliy) at size 4096x4096. http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=50833c9f7b4e1922197a8955669f8ab3589c8cef --- libavcodec/aacenc.c |2 +- libavcodec/adpcmenc.c |4 ++-- libavcodec/faxcompr.c |2 +- libavcodec/flashsv2enc.c|2 +- libavcodec/flashsvenc.c |2 +- libavcodec/nellymoserenc.c |2 +- libavcodec/proresenc_anatoliy.c |2 +- libavcodec/proresenc_kostya.c |2 +- libavcodec/s302menc.c |2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index aa6a56a..9c910b7 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -165,7 +165,7 @@ static void put_audio_specific_config(AVCodecContext *avctx) PutBitContext pb; AACEncContext *s = avctx-priv_data; -init_put_bits(pb, avctx-extradata, avctx-extradata_size*8); +init_put_bits(pb, avctx-extradata, avctx-extradata_size); put_bits(pb, 5, 2); //object type - AAC-LC put_bits(pb, 4, s-samplerate_index); //sample rate index put_bits(pb, 4, s-channels); diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c index 6816463..50872c3 100644 --- a/libavcodec/adpcmenc.c +++ b/libavcodec/adpcmenc.c @@ -541,7 +541,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, case AV_CODEC_ID_ADPCM_IMA_QT: { PutBitContext pb; -init_put_bits(pb, dst, pkt_size * 8); +init_put_bits(pb, dst, pkt_size); for (ch = 0; ch avctx-channels; ch++) { ADPCMChannelStatus *status = c-status[ch]; @@ -571,7 +571,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, case AV_CODEC_ID_ADPCM_SWF: { PutBitContext pb; -init_put_bits(pb, dst, pkt_size * 8); +init_put_bits(pb, dst, pkt_size); n = frame-nb_samples - 1; diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c index b65f2e2..eb39ae0 100644 --- a/libavcodec/faxcompr.c +++ b/libavcodec/faxcompr.c @@ -251,7 +251,7 @@ static void put_line(uint8_t *dst, int size, int width, const int *runs) PutBitContext pb; int run, mode = ~0, pix_left = width, run_idx = 0; -init_put_bits(pb, dst, size * 8); +init_put_bits(pb, dst, size); while (pix_left 0) { run = runs[run_idx++]; mode = ~mode; diff --git a/libavcodec/flashsv2enc.c b/libavcodec/flashsv2enc.c index f74160a..a8bcaa2 100644 --- a/libavcodec/flashsv2enc.c +++ b/libavcodec/flashsv2enc.c @@ -287,7 +287,7 @@ static int write_header(FlashSV2Context * s, uint8_t * buf, int buf_size) if (buf_size 5) return -1; -init_put_bits(pb, buf, buf_size * 8); +init_put_bits(pb, buf, buf_size); put_bits(pb, 4, (s-block_width 4) - 1); put_bits(pb, 12, s-image_width); diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c index a6d7caa..14e8ada 100644 --- a/libavcodec/flashsvenc.c +++ b/libavcodec/flashsvenc.c @@ -151,7 +151,7 @@ static int encode_bitstream(FlashSVContext *s, const AVFrame *p, uint8_t *buf, int buf_pos, res; int pred_blocks = 0; -init_put_bits(pb, buf, buf_size * 8); +init_put_bits(pb, buf, buf_size); put_bits(pb, 4, block_width / 16 - 1); put_bits(pb, 12, s-image_width); diff --git a/libavcodec/nellymoserenc.c b/libavcodec/nellymoserenc.c index 1d046ec..7c77ff7 100644 --- a/libavcodec/nellymoserenc.c +++ b/libavcodec/nellymoserenc.c @@ -308,7 +308,7 @@ static void encode_block(NellyMoserEncodeContext *s, unsigned char *output, int apply_mdct(s); -init_put_bits(pb, output, output_size * 8); +init_put_bits(pb, output, output_size); i = 0; for (band = 0; band NELLY_BANDS; band++) { diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index f471f49..801d58e 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -304,7 +304,7 @@ static int encode_slice_plane(AVCodecContext *avctx, int mb_count, } blocks_per_slice = mb_count (2 - chroma); -init_put_bits(pb, buf, buf_size 3); +init_put_bits(pb, buf, buf_size); encode_dc_coeffs(pb, blocks, blocks_per_slice, qmat); encode_ac_coeffs(avctx, pb, blocks, blocks_per_slice, qmat); diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c index 3418b46..59f73fb 100644 --- a/libavcodec/proresenc_kostya.c +++ b/libavcodec/proresenc_kostya.c @@ -1057,7 +1057,7 @@ static int