[FFmpeg-cvslog] avcodec/aacdec_fixed: Fix integer overflow in apply_independent_coupling_fixed()
ffmpeg | branch: master | Michael Niedermayer| Sat Mar 31 21:19:19 2018 +0200| [197a4e8feed45b2e5868760240e83636818f32a9] | committer: Michael Niedermayer avcodec/aacdec_fixed: Fix integer overflow in apply_independent_coupling_fixed() I was not able to reproduce this, this fix is based on just the fuzzer log. Fixes: 4959/clusterfuzz-testcase-minimized-6035350934781952 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=197a4e8feed45b2e5868760240e83636818f32a9 --- libavcodec/aacdec_fixed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c index f96999efb4..5c3613e06c 100644 --- a/libavcodec/aacdec_fixed.c +++ b/libavcodec/aacdec_fixed.c @@ -417,7 +417,7 @@ static void apply_independent_coupling_fixed(AACContext *ac, int i, c, shift, round, tmp; const int gain = cce->coup.gain[index][0]; const int *src = cce->ch[0].ret; -int *dest = target->ret; +unsigned int *dest = target->ret; const int len = 1024 << (ac->oc[1].m4ac.sbr == 1); c = cce_scale_fixed[gain & 7]; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/cscd: Error out when LZ* decompression fails
ffmpeg | branch: master | Michael Niedermayer| Mon Mar 12 00:05:04 2018 +0100| [d52be5d4e91871a22dac70af3e0ab429e95a2d10] | committer: Michael Niedermayer avcodec/cscd: Error out when LZ* decompression fails Fixes: Timeout Fixes: 6304/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CSCD_fuzzer-5754772461191168 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d52be5d4e91871a22dac70af3e0ab429e95a2d10 --- libavcodec/cscd.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavcodec/cscd.c b/libavcodec/cscd.c index 9e1dec9d96..35c4ee08c3 100644 --- a/libavcodec/cscd.c +++ b/libavcodec/cscd.c @@ -81,15 +81,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, switch ((buf[0] >> 1) & 7) { case 0: { // lzo compression int outlen = c->decomp_size, inlen = buf_size - 2; -if (av_lzo1x_decode(c->decomp_buf, , [2], )) +if (av_lzo1x_decode(c->decomp_buf, , [2], )) { av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n"); +return AVERROR_INVALIDDATA; +} break; } case 1: { // zlib compression #if CONFIG_ZLIB unsigned long dlen = c->decomp_size; -if (uncompress(c->decomp_buf, , [2], buf_size - 2) != Z_OK) +if (uncompress(c->decomp_buf, , [2], buf_size - 2) != Z_OK) { av_log(avctx, AV_LOG_ERROR, "error during zlib decompression\n"); +return AVERROR_INVALIDDATA; +} break; #else av_log(avctx, AV_LOG_ERROR, "compiled without zlib support\n"); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/options_table: Change the seek2any location in opt table.
ffmpeg | branch: master | Jun Zhao| Sun Apr 1 15:53:11 2018 +0800| [c6c20249e724e1db37af72815742c0cd520d4756] | committer: Michael Niedermayer avformat/options_table: Change the seek2any location in opt table. Change the seek2any location in avformat_options to make code more readable. Signed-off-by: Jun Zhao Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c6c20249e724e1db37af72815742c0cd520d4756 --- libavformat/options_table.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/options_table.h b/libavformat/options_table.h index b8fa47c6fd..7c4d84798e 100644 --- a/libavformat/options_table.h +++ b/libavformat/options_table.h @@ -54,10 +54,10 @@ static const AVOption avformat_options[] = { {"fastseek", "fast but inaccurate seeks", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_FAST_SEEK }, INT_MIN, INT_MAX, D, "fflags"}, {"latm", "enable RTP MP4A-LATM payload", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_MP4A_LATM }, INT_MIN, INT_MAX, E, "fflags"}, {"nobuffer", "reduce the latency introduced by optional buffering", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_NOBUFFER }, 0, INT_MAX, D, "fflags"}, -{"seek2any", "allow seeking to non-keyframes on demuxer level when supported", OFFSET(seek2any), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, D}, {"bitexact", "do not write random/volatile data", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_BITEXACT }, 0, 0, E, "fflags" }, {"shortest", "stop muxing with the shortest stream", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_SHORTEST }, 0, 0, E, "fflags" }, {"autobsf", "add needed bsfs automatically", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_AUTO_BSF }, 0, 0, E, "fflags" }, +{"seek2any", "allow seeking to non-keyframes on demuxer level when supported", OFFSET(seek2any), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, D}, {"analyzeduration", "specify how many microseconds are analyzed to probe the input", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT64_MAX, D}, {"cryptokey", "decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, {.dbl = 0}, 0, 0, D}, {"indexmem", "max memory used for timestamp index (per stream)", OFFSET(max_index_size), AV_OPT_TYPE_INT, {.i64 = 1<<20 }, 0, INT_MAX, D}, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/libaomenc: remove references to gbrp pixfmt
ffmpeg | branch: master | James Almer| Mon Apr 2 16:44:05 2018 -0300| [877aff2beacbb3c238d23be9606467ca661e0609] | committer: James Almer avcodec/libaomenc: remove references to gbrp pixfmt Support for this needs testing, so remove for now. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=877aff2beacbb3c238d23be9606467ca661e0609 --- libavcodec/libaomenc.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index 8ebdcc20e3..41b05dc1c0 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -220,7 +220,6 @@ static int set_pix_fmt(AVCodecContext *avctx, aom_codec_caps_t codec_caps, enccfg->g_profile = FF_PROFILE_AV1_PROFESSIONAL; *img_fmt = AOM_IMG_FMT_I422; return 0; -case AV_PIX_FMT_GBRP: case AV_PIX_FMT_YUV444P: enccfg->g_profile = FF_PROFILE_AV1_HIGH; *img_fmt = AOM_IMG_FMT_I444; @@ -248,14 +247,11 @@ static int set_pix_fmt(AVCodecContext *avctx, aom_codec_caps_t codec_caps, return 0; } break; -case AV_PIX_FMT_GBRP10: -case AV_PIX_FMT_GBRP12: case AV_PIX_FMT_YUV444P10: case AV_PIX_FMT_YUV444P12: if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH) { enccfg->g_bit_depth = enccfg->g_input_bit_depth = -avctx->pix_fmt == AV_PIX_FMT_YUV444P10 || -avctx->pix_fmt == AV_PIX_FMT_GBRP10 ? 10 : 12; +avctx->pix_fmt == AV_PIX_FMT_YUV444P10 ? 10 : 12; enccfg->g_profile = enccfg->g_bit_depth == 10 ? FF_PROFILE_AV1_HIGH : FF_PROFILE_AV1_PROFESSIONAL; *img_fmt = AOM_IMG_FMT_I44416; @@ -661,7 +657,6 @@ static const enum AVPixelFormat av1_pix_fmts[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, -AV_PIX_FMT_GBRP, AV_PIX_FMT_NONE }; @@ -675,9 +670,6 @@ static const enum AVPixelFormat av1_pix_fmts_highbd[] = { AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12, -AV_PIX_FMT_GBRP, -AV_PIX_FMT_GBRP10, -AV_PIX_FMT_GBRP12, AV_PIX_FMT_NONE }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/libaomdec: remove references to gbrp pixfmt
ffmpeg | branch: master | James Almer| Mon Apr 2 16:44:18 2018 -0300| [4897c80cc6eb50357503d5ced4b2443b39fa4263] | committer: James Almer avcodec/libaomdec: remove references to gbrp pixfmt Support for this needs testing, so remove for now. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4897c80cc6eb50357503d5ced4b2443b39fa4263 --- libavcodec/libaomdec.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c index 1352b421d9..a9fd6215fc 100644 --- a/libavcodec/libaomdec.c +++ b/libavcodec/libaomdec.c @@ -103,8 +103,7 @@ static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img) avctx->profile = FF_PROFILE_AV1_PROFESSIONAL; return 0; case AOM_IMG_FMT_I444: -avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ? - AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P; +avctx->pix_fmt = AV_PIX_FMT_YUV444P; avctx->profile = FF_PROFILE_AV1_HIGH; return 0; case AOM_IMG_FMT_I42016: @@ -141,18 +140,15 @@ static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img) } case AOM_IMG_FMT_I44416: if (img->bit_depth == 8) { -avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ? - AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P; +avctx->pix_fmt = AV_PIX_FMT_YUV444P; avctx->profile = FF_PROFILE_AV1_HIGH; return 0; } else if (img->bit_depth == 10) { -avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ? - AV_PIX_FMT_GBRP10 : AV_PIX_FMT_YUV444P10; +avctx->pix_fmt = AV_PIX_FMT_YUV444P10; avctx->profile = FF_PROFILE_AV1_HIGH; return 0; } else if (img->bit_depth == 12) { -avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ? - AV_PIX_FMT_GBRP12 : AV_PIX_FMT_YUV444P12; +avctx->pix_fmt = AV_PIX_FMT_YUV444P12; avctx->profile = FF_PROFILE_AV1_PROFESSIONAL; return 0; } else { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/rmdec: make use of avio_get_str()
ffmpeg | branch: master | Paul B Mahol| Mon Apr 2 22:09:59 2018 +0200| [46129b40446a802b0b5da4797709f552b68b48f5] | committer: Paul B Mahol avformat/rmdec: make use of avio_get_str() Also do not set empty metadata. Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=46129b40446a802b0b5da4797709f552b68b48f5 --- libavformat/rmdec.c | 18 +++--- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index fea71a2fc9..ac61723c66 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -70,16 +70,10 @@ static int rm_read_close(AVFormatContext *s); static inline void get_strl(AVIOContext *pb, char *buf, int buf_size, int len) { -int i; -char *q, r; +int read = avio_get_str(pb, len, buf, buf_size); -q = buf; -for(i=0;i 0) *q = '\0'; +if (read > 0) +avio_skip(pb, len - read); } static void get_str8(AVIOContext *pb, char *buf, int buf_size) @@ -105,8 +99,10 @@ static void rm_read_metadata(AVFormatContext *s, AVIOContext *pb, int wide) for (i=0; i metadata, ff_rm_metadata[i], buf, 0); +if (len > 0) { +get_strl(pb, buf, sizeof(buf), len); +av_dict_set(>metadata, ff_rm_metadata[i], buf, 0); +} } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/concatdec: only set output stream index before returning packet
ffmpeg | branch: master | Marton Balint| Sun Mar 25 22:19:28 2018 +0200| [37d472a906bd9112225129fc35d9c94ae2ee9c3e] | committer: Marton Balint avformat/concatdec: only set output stream index before returning packet Fixes ticket #6434. Reviewed-by: Nicolas George Signed-off-by: Marton Balint > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=37d472a906bd9112225129fc35d9c94ae2ee9c3e --- libavformat/concatdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 8fff9cc2cb..bbe13136fa 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -603,7 +603,6 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt) av_packet_unref(pkt); continue; } -pkt->stream_index = cs->out_stream_index; break; } if ((ret = filter_packet(avf, cs, pkt))) @@ -646,6 +645,7 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt) } } +pkt->stream_index = cs->out_stream_index; return ret; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/aic: fix decoding of videos which height is not multiple of 16
ffmpeg | branch: master | Paul B Mahol| Fri Mar 30 21:08:47 2018 +0200| [5710fdaeae09529282862c984317bd9347d0865d] | committer: Paul B Mahol avcodec/aic: fix decoding of videos which height is not multiple of 16 Fate output changes and under close inspection looks more correct. Fixes #6187. Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5710fdaeae09529282862c984317bd9347d0865d --- libavcodec/aic.c | 14 +- tests/ref/fate/aic | 30 ++-- tests/ref/fate/aic-oddsize | 114 ++--- 3 files changed, 84 insertions(+), 74 deletions(-) diff --git a/libavcodec/aic.c b/libavcodec/aic.c index 67d78c5ddd..9c6f806655 100644 --- a/libavcodec/aic.c +++ b/libavcodec/aic.c @@ -308,6 +308,8 @@ static int aic_decode_slice(AICContext *ctx, int mb_x, int mb_y, GetBitContext gb; int ret, i, mb, blk; int slice_width = FFMIN(ctx->slice_width, ctx->mb_width - mb_x); +int last_row = mb_y && mb_y == ctx->mb_height - 1; +int y_pos, c_pos; uint8_t *Y, *C[2]; uint8_t *dst; int16_t *base_y = ctx->data_ptr[COEFF_LUMA]; @@ -316,10 +318,18 @@ static int aic_decode_slice(AICContext *ctx, int mb_x, int mb_y, int16_t *ext_c = ctx->data_ptr[COEFF_CHROMA_EXT]; const int ystride = ctx->frame->linesize[0]; -Y = ctx->frame->data[0] + mb_x * 16 + mb_y * 16 * ystride; +if (last_row) { +y_pos = (ctx->avctx->height - 16); +c_pos = ((ctx->avctx->height+1)/2 - 8); +} else { +y_pos = mb_y * 16; +c_pos = mb_y * 8; +} + +Y = ctx->frame->data[0] + mb_x * 16 + y_pos * ystride; for (i = 0; i < 2; i++) C[i] = ctx->frame->data[i + 1] + mb_x * 8 - + mb_y * 8 * ctx->frame->linesize[i + 1]; + + c_pos * ctx->frame->linesize[i + 1]; init_get_bits(, src, src_size * 8); memset(ctx->slice_data, 0, diff --git a/tests/ref/fate/aic b/tests/ref/fate/aic index 1f50350b96..244ea25967 100644 --- a/tests/ref/fate/aic +++ b/tests/ref/fate/aic @@ -3,18 +3,18 @@ #codec_id 0: rawvideo #dimensions 0: 1440x1080 #sar 0: 4/3 -0, 0, 0,1, 2332800, 0xd941b42f -0, 1, 1,1, 2332800, 0xd941b42f -0, 2, 2,1, 2332800, 0xae0f5983 -0, 3, 3,1, 2332800, 0x51cfc127 -0, 4, 4,1, 2332800, 0x24d40447 -0, 5, 5,1, 2332800, 0x858a9f51 -0, 6, 6,1, 2332800, 0x533b48e8 -0, 7, 7,1, 2332800, 0x2fd73267 -0, 8, 8,1, 2332800, 0x153566c7 -0, 9, 9,1, 2332800, 0xa1c49c45 -0, 10, 10,1, 2332800, 0xb966e25a -0, 11, 11,1, 2332800, 0xd0ce5985 -0, 12, 12,1, 2332800, 0x0029a52e -0, 13, 13,1, 2332800, 0x893116c5 -0, 14, 14,1, 2332800, 0x073d2491 +0, 0, 0,1, 2332800, 0xc22b8485 +0, 1, 1,1, 2332800, 0xc22b8485 +0, 2, 2,1, 2332800, 0xe0c21bd8 +0, 3, 3,1, 2332800, 0x3e1a8fa0 +0, 4, 4,1, 2332800, 0xbcb3f235 +0, 5, 5,1, 2332800, 0x1a7cabd6 +0, 6, 6,1, 2332800, 0xc0136ba8 +0, 7, 7,1, 2332800, 0x295e59a6 +0, 8, 8,1, 2332800, 0xf9c09288 +0, 9, 9,1, 2332800, 0x0518cc8f +0, 10, 10,1, 2332800, 0x9ad3068e +0, 11, 11,1, 2332800, 0x5a8b7af1 +0, 12, 12,1, 2332800, 0x7b35a8fa +0, 13, 13,1, 2332800, 0xbe5801eb +0, 14, 14,1, 2332800, 0x31ca019f diff --git a/tests/ref/fate/aic-oddsize b/tests/ref/fate/aic-oddsize index 3763e32b2c..be4346a204 100644 --- a/tests/ref/fate/aic-oddsize +++ b/tests/ref/fate/aic-oddsize @@ -3,60 +3,60 @@ #codec_id 0: rawvideo #dimensions 0: 481x241 #sar 0: 0/1 -0, 0, 0,1, 174243, 0xa40491e1 -0, 1, 1,1, 174243, 0xa12cbb56 -0, 2, 2,1, 174243, 0xa12cbb56 -0, 3, 3,1, 174243, 0xa12cbb56 -0, 4, 4,1, 174243, 0xa12cbb56 -0, 5, 5,1, 174243, 0xa12cbb56 -0, 6, 6,1, 174243, 0xa12cbb56 -0, 7, 7,1, 174243, 0xa12cbb56 -0, 8, 8,1, 174243, 0xa12cbb56 -0, 9, 9,1, 174243, 0x4e7b7299 -0, 10, 10,1, 174243, 0x31573b99 -0, 11, 11,1, 174243, 0x013397b6 -0, 12, 12,1, 174243, 0xdd988ab8 -0,
[FFmpeg-cvslog] avcodec/scpr: fix decoding of prev+top-topleft prediction in keyframes
ffmpeg | branch: master | Paul B Mahol| Mon Apr 2 16:03:03 2018 +0200| [324954cf960eb098929f4c610f60f5e1547609f6] | committer: Paul B Mahol avcodec/scpr: fix decoding of prev+top-topleft prediction in keyframes Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=324954cf960eb098929f4c610f60f5e1547609f6 --- libavcodec/scpr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/scpr.c b/libavcodec/scpr.c index 3c797d55f5..72f59d5917 100644 --- a/libavcodec/scpr.c +++ b/libavcodec/scpr.c @@ -446,13 +446,13 @@ static int decompress_i(AVCodecContext *avctx, uint32_t *dst, int linesize) } r = odst[(ly * linesize + lx) * 4] + -odst[((y * linesize + x) + off - z) * 4 + 4] - +odst[((y * linesize + x) + off) * 4 + 4] - odst[((y * linesize + x) + off - z) * 4]; g = odst[(ly * linesize + lx) * 4 + 1] + -odst[((y * linesize + x) + off - z) * 4 + 5] - +odst[((y * linesize + x) + off) * 4 + 5] - odst[((y * linesize + x) + off - z) * 4 + 1]; b = odst[(ly * linesize + lx) * 4 + 2] + -odst[((y * linesize + x) + off - z) * 4 + 6] - +odst[((y * linesize + x) + off) * 4 + 6] - odst[((y * linesize + x) + off - z) * 4 + 2]; clr = ((b & 0xFF) << 16) + ((g & 0xFF) << 8) + (r & 0xFF); dst[y * linesize + x] = clr; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] mpeg4video: Add support for MPEG-4 Simple Studio Profile.
ffmpeg | branch: master | Kieran Kunhya| Fri Dec 29 15:42:14 2017 +| [f9d3841ae6147eaa51c57c574cd81e9ce9566e3a] | committer: Kieran Kunhya mpeg4video: Add support for MPEG-4 Simple Studio Profile. This is a profile supporting > 8-bit video and has a higher quality DCT > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f9d3841ae6147eaa51c57c574cd81e9ce9566e3a --- libavcodec/error_resilience.c | 3 +- libavcodec/h263dec.c | 11 + libavcodec/idctdsp.c | 12 +- libavcodec/ituh263dec.c | 17 +- libavcodec/mpeg12dec.c| 18 +- libavcodec/mpeg4data.h| 116 + libavcodec/mpeg4video.h | 17 ++ libavcodec/mpeg4videodec.c| 536 +- libavcodec/mpegvideo.c| 52 +++- libavcodec/mpegvideo.h| 26 +- libavcodec/x86/idctdsp_init.c | 1 + 11 files changed, 763 insertions(+), 46 deletions(-) diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index 55f77961c5..25e54a535b 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -814,7 +814,8 @@ static int er_supported(ERContext *s) { if(s->avctx->hwaccel && s->avctx->hwaccel->decode_slice || !s->cur_pic.f || - s->cur_pic.field_picture + s->cur_pic.field_picture || + s->avctx->profile == FF_PROFILE_MPEG4_SIMPLE_STUDIO ) return 0; return 1; diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 5608b63245..484bf39578 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -47,6 +47,12 @@ static enum AVPixelFormat h263_get_format(AVCodecContext *avctx) { +/* MPEG-4 Studio Profile only, not supported by hardware */ +if (avctx->bits_per_raw_sample > 8) { +av_assert1(avctx->profile == FF_PROFILE_MPEG4_SIMPLE_STUDIO); +return avctx->pix_fmt; +} + if (avctx->codec->id == AV_CODEC_ID_MSS2) return AV_PIX_FMT_YUV420P; @@ -197,6 +203,11 @@ static int decode_slice(MpegEncContext *s) ff_set_qscale(s, s->qscale); +if (s->studio_profile) { +if ((ret = ff_mpeg4_decode_studio_slice_header(s->avctx->priv_data)) < 0) +return ret; +} + if (s->avctx->hwaccel) { const uint8_t *start = s->gb.buffer + get_bits_count(>gb) / 8; ret = s->avctx->hwaccel->decode_slice(s->avctx, start, s->gb.buffer_end - start); diff --git a/libavcodec/idctdsp.c b/libavcodec/idctdsp.c index 1de372d2b9..662033bd78 100644 --- a/libavcodec/idctdsp.c +++ b/libavcodec/idctdsp.c @@ -256,9 +256,15 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx) c->perm_type = FF_IDCT_PERM_NONE; } else { if (avctx->bits_per_raw_sample == 10 || avctx->bits_per_raw_sample == 9) { -c->idct_put = ff_simple_idct_put_int16_10bit; -c->idct_add = ff_simple_idct_add_int16_10bit; -c->idct = ff_simple_idct_int16_10bit; +/* 10-bit MPEG-4 Simple Studio Profile requires a higher precision IDCT + However, it only uses idct_put */ +if (avctx->codec_id == AV_CODEC_ID_MPEG4 && avctx->profile == FF_PROFILE_MPEG4_SIMPLE_STUDIO) +c->idct_put = ff_simple_idct_put_int32_10bit; +else { +c->idct_put = ff_simple_idct_put_int16_10bit; +c->idct_add = ff_simple_idct_add_int16_10bit; +c->idct = ff_simple_idct_int16_10bit; +} c->perm_type = FF_IDCT_PERM_NONE; } else if (avctx->bits_per_raw_sample == 12) { c->idct_put = ff_simple_idct_put_int16_12bit; diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index fc95a532ce..1b57e53cad 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -207,12 +207,27 @@ static int h263_decode_gob_header(MpegEncContext *s) } /** - * Decode the group of blocks / video packet header. + * Decode the group of blocks / video packet header / slice header (MPEG-4 Studio). * @return bit position of the resync_marker, or <0 if none was found */ int ff_h263_resync(MpegEncContext *s){ int left, pos, ret; +/* In MPEG-4 studio mode look for a new slice startcode + * and decode slice header */ +if(s->codec_id==AV_CODEC_ID_MPEG4 && s->studio_profile) { +align_get_bits(>gb); + +while (get_bits_left(>gb) >= 32 && show_bits_long(>gb, 32) != SLICE_START_CODE) { +get_bits(>gb, 8); +} + +if (show_bits_long(>gb, 32) == SLICE_START_CODE) +return get_bits_count(>gb); +else +return -1; +} + if(s->codec_id==AV_CODEC_ID_MPEG4){ skip_bits1(>gb); align_get_bits(>gb); diff --git
[FFmpeg-cvslog] simple_idct: Template functions to support an input bitdepth parameter
ffmpeg | branch: master | Kieran Kunhya| Wed Dec 27 01:08:39 2017 +| [699fa8f382704acdbdf720042dd7b21df2eb7558] | committer: Kieran Kunhya simple_idct: Template functions to support an input bitdepth parameter > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=699fa8f382704acdbdf720042dd7b21df2eb7558 --- libavcodec/bit_depth_template.c | 17 ++- libavcodec/idctdsp.c | 18 libavcodec/me_cmp.c | 2 +- libavcodec/simple_idct.c | 15 ++--- libavcodec/simple_idct.h | 24 - libavcodec/simple_idct_template.c | 44 ++- libavcodec/tests/dct.c| 6 +++--- libavcodec/vc1.c | 4 ++-- 8 files changed, 86 insertions(+), 44 deletions(-) diff --git a/libavcodec/bit_depth_template.c b/libavcodec/bit_depth_template.c index 80184892f5..d44d47ea45 100644 --- a/libavcodec/bit_depth_template.c +++ b/libavcodec/bit_depth_template.c @@ -29,6 +29,7 @@ # undef pixel2 # undef pixel4 # undef dctcoef +# undef idctin # undef INIT_CLIP # undef no_rnd_avg_pixel4 # undef rnd_avg_pixel4 @@ -53,6 +54,16 @@ # define pixel4 uint64_t # define dctcoef int32_t +#ifdef IN_IDCT_DEPTH +#if IN_IDCT_DEPTH == 32 +# define idctin int32_t +#else +# define idctin int16_t +#endif +#else +# define idctin int16_t +#endif + # define INIT_CLIP # define no_rnd_avg_pixel4 no_rnd_avg64 # definernd_avg_pixel4rnd_avg64 @@ -71,6 +82,7 @@ # define pixel2 uint16_t # define pixel4 uint32_t # define dctcoef int16_t +# define idctin int16_t # define INIT_CLIP # define no_rnd_avg_pixel4 no_rnd_avg32 @@ -87,7 +99,10 @@ # define CLIP(a) av_clip_uint8(a) #endif -#define FUNC3(a, b, c) a ## _ ## b ## c +#define FUNC3(a, b, c) a ## _ ## b ## c #define FUNC2(a, b, c) FUNC3(a, b, c) #define FUNC(a) FUNC2(a, BIT_DEPTH,) #define FUNCC(a) FUNC2(a, BIT_DEPTH, _c) +#define FUNC4(a, b, c) a ## _int ## b ## _ ## c ## bit +#define FUNC5(a, b, c) FUNC4(a, b, c) +#define FUNC6(a) FUNC5(a, IN_IDCT_DEPTH, BIT_DEPTH) diff --git a/libavcodec/idctdsp.c b/libavcodec/idctdsp.c index 0122d29efa..1de372d2b9 100644 --- a/libavcodec/idctdsp.c +++ b/libavcodec/idctdsp.c @@ -256,14 +256,14 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx) c->perm_type = FF_IDCT_PERM_NONE; } else { if (avctx->bits_per_raw_sample == 10 || avctx->bits_per_raw_sample == 9) { -c->idct_put = ff_simple_idct_put_10; -c->idct_add = ff_simple_idct_add_10; -c->idct = ff_simple_idct_10; +c->idct_put = ff_simple_idct_put_int16_10bit; +c->idct_add = ff_simple_idct_add_int16_10bit; +c->idct = ff_simple_idct_int16_10bit; c->perm_type = FF_IDCT_PERM_NONE; } else if (avctx->bits_per_raw_sample == 12) { -c->idct_put = ff_simple_idct_put_12; -c->idct_add = ff_simple_idct_add_12; -c->idct = ff_simple_idct_12; +c->idct_put = ff_simple_idct_put_int16_12bit; +c->idct_add = ff_simple_idct_add_int16_12bit; +c->idct = ff_simple_idct_int16_12bit; c->perm_type = FF_IDCT_PERM_NONE; } else { if (avctx->idct_algo == FF_IDCT_INT) { @@ -280,9 +280,9 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx) #endif /* CONFIG_FAANIDCT */ } else { // accurate/default /* Be sure FF_IDCT_NONE will select this one, since it uses FF_IDCT_PERM_NONE */ -c->idct_put = ff_simple_idct_put_8; -c->idct_add = ff_simple_idct_add_8; -c->idct = ff_simple_idct_8; +c->idct_put = ff_simple_idct_put_int16_8bit; +c->idct_add = ff_simple_idct_add_int16_8bit; +c->idct = ff_simple_idct_int16_8bit; c->perm_type = FF_IDCT_PERM_NONE; } } diff --git a/libavcodec/me_cmp.c b/libavcodec/me_cmp.c index 465d3ccb2a..ae248c52f8 100644 --- a/libavcodec/me_cmp.c +++ b/libavcodec/me_cmp.c @@ -755,7 +755,7 @@ static int quant_psnr8x8_c(MpegEncContext *s, uint8_t *src1, s->block_last_index[0 /* FIXME */] = s->fast_dct_quantize(s, temp, 0 /* FIXME */, s->qscale, ); s->dct_unquantize_inter(s, temp, 0, s->qscale); -ff_simple_idct_8(temp); // FIXME +ff_simple_idct_int16_8bit(temp); // FIXME for (i = 0; i < 64; i++) sum += (temp[i] - bak[i]) * (temp[i] - bak[i]); diff --git a/libavcodec/simple_idct.c b/libavcodec/simple_idct.c index 1d05b2fe08..78b29c0fe3 100644 --- a/libavcodec/simple_idct.c +++ b/libavcodec/simple_idct.c @@ -30,6
[FFmpeg-cvslog] avcodec/scpr: check for possible out of array access
ffmpeg | branch: master | Paul B Mahol| Mon Apr 2 08:59:20 2018 +0200| [22a878ecd1c1d67ea985e998d9c0493795b86427] | committer: Paul B Mahol avcodec/scpr: check for possible out of array access Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=22a878ecd1c1d67ea985e998d9c0493795b86427 --- libavcodec/scpr.c | 4 1 file changed, 4 insertions(+) diff --git a/libavcodec/scpr.c b/libavcodec/scpr.c index ad6073dbf0..3c797d55f5 100644 --- a/libavcodec/scpr.c +++ b/libavcodec/scpr.c @@ -211,6 +211,10 @@ static int decode_value(SCPRContext *s, unsigned *cnt, unsigned maxc, unsigned s break; c++; } + +if (c >= maxc) +return AVERROR_INVALIDDATA; + if ((ret = s->decode(gb, rc, cumfr, cnt_c, totfr)) < 0) return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog