[FFmpeg-cvslog] h264: eliminate default_ref_list
ffmpeg | branch: master | Anton Khirnov | Mon Nov 30 17:51:48 2015 +0100| [741b494fa8cd28a7d096349bac183893c236e3f9] | committer: Anton Khirnov h264: eliminate default_ref_list According to the spec, the reference list for a slice should be constructed by first generating an initial (what we now call "default") reference list and then optionally applying modifications to it. Our code has an optimization where the initial reference list is constructed for the first inter slice and then rebuilt for other slices if needed. This, however, adds complexity to the code, requires an extra 2.5kB array in the codec context and there is no reason to think that it has any positive effect on performance. Therefore, simplify the code by generating the reference list from scratch for each slice. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=741b494fa8cd28a7d096349bac183893c236e3f9 --- libavcodec/h264.h |7 --- libavcodec/h264_refs.c | 46 +- libavcodec/h264_slice.c | 18 +- 3 files changed, 22 insertions(+), 49 deletions(-) diff --git a/libavcodec/h264.h b/libavcodec/h264.h index e9fd9cc..13b149f 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -600,7 +600,6 @@ typedef struct H264Context { */ int max_pic_num; -H264Ref default_ref_list[2][32]; ///< base reference list for all slices of a coded picture H264Picture *short_ref[32]; H264Picture *long_ref[32]; H264Picture *delayed_pic[MAX_DELAYED_PIC_COUNT + 2]; // FIXME size? @@ -645,7 +644,6 @@ typedef struct H264Context { enum AVPictureType pict_type; -int last_slice_type; /** @} */ /** @@ -804,11 +802,6 @@ int ff_h264_get_slice_type(const H264SliceContext *sl); */ int ff_h264_alloc_tables(H264Context *h); -/** - * Fill the default_ref_list. - */ -int ff_h264_fill_default_ref_list(H264Context *h, H264SliceContext *sl); - int ff_h264_decode_ref_pic_list_reordering(H264Context *h, H264SliceContext *sl); void ff_h264_fill_mbaff_ref_list(H264Context *h, H264SliceContext *sl); void ff_h264_remove_all_refs(H264Context *h); diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index adc2213..46b51e0 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -119,7 +119,7 @@ static int add_sorted(H264Picture **sorted, H264Picture **src, int len, int limi return out_i; } -int ff_h264_fill_default_ref_list(H264Context *h, H264SliceContext *sl) +static void h264_initialise_ref_list(H264Context *h, H264SliceContext *sl) { int i, len; @@ -138,52 +138,51 @@ int ff_h264_fill_default_ref_list(H264Context *h, H264SliceContext *sl) len += add_sorted(sorted + len, h->short_ref, h->short_ref_count, cur_poc, 0 ^ list); assert(len <= 32); -len = build_def_list(h->default_ref_list[list], FF_ARRAY_ELEMS(h->default_ref_list[0]), +len = build_def_list(sl->ref_list[list], FF_ARRAY_ELEMS(sl->ref_list[0]), sorted, len, 0, h->picture_structure); -len += build_def_list(h->default_ref_list[list] + len, - FF_ARRAY_ELEMS(h->default_ref_list[0]) - len, +len += build_def_list(sl->ref_list[list] + len, + FF_ARRAY_ELEMS(sl->ref_list[0]) - len, h->long_ref, 16, 1, h->picture_structure); if (len < sl->ref_count[list]) -memset(&h->default_ref_list[list][len], 0, sizeof(H264Ref) * (sl->ref_count[list] - len)); +memset(&sl->ref_list[list][len], 0, sizeof(H264Ref) * (sl->ref_count[list] - len)); lens[list] = len; } if (lens[0] == lens[1] && lens[1] > 1) { for (i = 0; i < lens[0] && -h->default_ref_list[0][i].parent->f->buf[0]->buffer == -h->default_ref_list[1][i].parent->f->buf[0]->buffer; i++); +sl->ref_list[0][i].parent->f->buf[0]->buffer == +sl->ref_list[1][i].parent->f->buf[0]->buffer; i++); if (i == lens[0]) { -FFSWAP(H264Ref, h->default_ref_list[1][0], h->default_ref_list[1][1]); +FFSWAP(H264Ref, sl->ref_list[1][0], sl->ref_list[1][1]); } } } else { -len = build_def_list(h->default_ref_list[0], FF_ARRAY_ELEMS(h->default_ref_list[0]), +len = build_def_list(sl->ref_list[0], FF_ARRAY_ELEMS(sl->ref_list[0]), h->short_ref, h->short_ref_count, 0, h->picture_structure); -len += build_def_list(h->default_ref_list[0] + len, - FF_ARRAY_ELEMS(h->default_ref_list[0]) - len, +len += build_def_list(sl->ref_list[0] + len, + FF_ARRAY_ELEMS(sl->ref_list[0]) - len, h-> long_ref, 16, 1, h->pictu
[FFmpeg-cvslog] Merge commit '741b494fa8cd28a7d096349bac183893c236e3f9'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 12:45:28 2015 +0100| [bc66451e5e903698ee0500faf04c1214f3dd157f] | committer: Hendrik Leppkes Merge commit '741b494fa8cd28a7d096349bac183893c236e3f9' * commit '741b494fa8cd28a7d096349bac183893c236e3f9': h264: eliminate default_ref_list Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bc66451e5e903698ee0500faf04c1214f3dd157f --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] h264: set frame_num in start_frame(), not decode_slice_header()
ffmpeg | branch: master | Anton Khirnov | Mon Nov 30 22:52:36 2015 +0100| [792b9c9dfcf44b657d7854368d975b5ca3bc22ca] | committer: Anton Khirnov h264: set frame_num in start_frame(), not decode_slice_header() That is a more appropriate place for it, since it is not allowed to change between slices. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=792b9c9dfcf44b657d7854368d975b5ca3bc22ca --- libavcodec/h264_slice.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 4c82588..4f2d6a8 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -553,6 +553,7 @@ static int h264_frame_start(H264Context *h) pic->reference = h->droppable ? 0 : h->picture_structure; pic->f->coded_picture_number = h->coded_picture_number++; pic->field_picture = h->picture_structure != PICT_FRAME; +pic->frame_num = h->frame_num; /* * Zero key_frame here; IDR markings per slice in frame or fields are ORed * in later. @@ -1418,9 +1419,6 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl) } } -if (!h->setup_finished) -h->cur_pic_ptr->frame_num = h->frame_num; // FIXME frame_num cleanup - assert(h->mb_num == h->mb_width * h->mb_height); if (first_mb_in_slice << FIELD_OR_MBAFF_PICTURE(h) >= h->mb_num || first_mb_in_slice >= h->mb_num) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '792b9c9dfcf44b657d7854368d975b5ca3bc22ca'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 12:59:25 2015 +0100| [c6f1f334cbc50b1821b92afaee13abcd3502b34a] | committer: Hendrik Leppkes Merge commit '792b9c9dfcf44b657d7854368d975b5ca3bc22ca' * commit '792b9c9dfcf44b657d7854368d975b5ca3bc22ca': h264: set frame_num in start_frame(), not decode_slice_header() Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c6f1f334cbc50b1821b92afaee13abcd3502b34a --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] h264: derive the delay from the level when it's not present
ffmpeg | branch: master | Anton Khirnov | Tue Oct 20 19:04:57 2015 +0200| [b09ad37c83841c399abb7f2503a2ab214d0c2d48] | committer: Anton Khirnov h264: derive the delay from the level when it's not present Fall back to maximum DPB size if the level is unknown. This should be more spec-compliant and does not depend on the caller setting has_b_frames before opening the decoder. The old behaviour, when the delay is supplied by the caller setting has_b_frames, can still be obtained by setting strict_std_compliance below normal. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b09ad37c83841c399abb7f2503a2ab214d0c2d48 --- libavcodec/h264.c| 15 --- libavcodec/h264_ps.c | 33 + 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index ec57d6d..6b12b30 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -851,18 +851,11 @@ static void decode_postinit(H264Context *h, int setup_finished) // FIXME do something with unavailable reference frames /* Sort B-frames into display order */ - -if (h->sps.bitstream_restriction_flag && -h->avctx->has_b_frames < h->sps.num_reorder_frames) { -h->avctx->has_b_frames = h->sps.num_reorder_frames; -h->low_delay = 0; -} - -if (h->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT && -!h->sps.bitstream_restriction_flag) { -h->avctx->has_b_frames = MAX_DELAYED_PIC_COUNT - 1; -h->low_delay = 0; +if (h->sps.bitstream_restriction_flag || +h->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL) { +h->avctx->has_b_frames = FFMAX(h->avctx->has_b_frames, h->sps.num_reorder_frames); } +h->low_delay = !h->avctx->has_b_frames; pics = 0; while (h->delayed_pic[pics]) diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c index fa9fa7d..6b29966 100644 --- a/libavcodec/h264_ps.c +++ b/libavcodec/h264_ps.c @@ -105,6 +105,26 @@ static const uint8_t default_scaling8[2][64] = { 24, 25, 27, 28, 30, 32, 33, 35 } }; +/* maximum number of MBs in the DPB for a given level */ +static const int level_max_dpb_mbs[][2] = { +{ 10, 396 }, +{ 11, 900 }, +{ 12, 2376 }, +{ 13, 2376 }, +{ 20, 2376 }, +{ 21, 4752 }, +{ 22, 8100 }, +{ 30, 8100 }, +{ 31, 18000 }, +{ 32, 20480 }, +{ 40, 32768 }, +{ 41, 32768 }, +{ 42, 34816 }, +{ 50, 110400}, +{ 51, 184320}, +{ 52, 184320}, +}; + static inline int decode_hrd_parameters(H264Context *h, SPS *sps) { int cpb_count, i; @@ -501,6 +521,19 @@ int ff_h264_decode_seq_parameter_set(H264Context *h) goto fail; } +/* if the maximum delay is not stored in the SPS, derive it based on the + * level */ +if (!sps->bitstream_restriction_flag) { +sps->num_reorder_frames = MAX_DELAYED_PIC_COUNT - 1; +for (i = 0; i < FF_ARRAY_ELEMS(level_max_dpb_mbs); i++) { +if (level_max_dpb_mbs[i][0] == sps->level_idc) { +sps->num_reorder_frames = FFMIN(level_max_dpb_mbs[i][1] / (sps->mb_width * sps->mb_height), +sps->num_reorder_frames); +break; +} +} +} + if (!sps->sar.den) sps->sar.den = 1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'b09ad37c83841c399abb7f2503a2ab214d0c2d48'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 13:00:37 2015 +0100| [10e55bd658b06034d700553190b419b1af92b7cb] | committer: Hendrik Leppkes Merge commit 'b09ad37c83841c399abb7f2503a2ab214d0c2d48' * commit 'b09ad37c83841c399abb7f2503a2ab214d0c2d48': h264: derive the delay from the level when it's not present Merged without changing the strict_std_compliance check, as it breaks FATE and changes decoding behavior. Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=10e55bd658b06034d700553190b419b1af92b7cb --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avpacket: add a function for wrapping existing data as side data
ffmpeg | branch: master | Anton Khirnov | Sun Oct 4 12:08:20 2015 +0200| [31c51f7441de07b88cfea2550245bf1f5140cb8f] | committer: Anton Khirnov avpacket: add a function for wrapping existing data as side data > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=31c51f7441de07b88cfea2550245bf1f5140cb8f --- doc/APIchanges|3 +++ libavcodec/avcodec.h | 16 libavcodec/avpacket.c | 38 -- libavcodec/version.h |2 +- 4 files changed, 48 insertions(+), 11 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index ecbe8b5..0979930 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2015-08-28 API changes, most recent first: +2015-xx-xx - xxx - lavc 57.11.0 - avcodec.h + Add av_packet_add_side_data(). + 2015-xx-xx - xxx - lavc 57.9.1 - avcodec.h Deprecate rtp_callback without replacement, i.e. it won't be possible to get image slices before the full frame is encoded any more. The libavformat diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index e888952..5ed13de 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3557,6 +3557,22 @@ uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int size); /** + * Wrap an existing array as a packet side data. + * + * @param pkt packet + * @param type side information type + * @param data the side data array. It must be allocated with the av_malloc() + * family of functions. The ownership of the data is transferred to + * pkt. + * @param size side information size + * @return a non-negative number on success, a negative AVERROR code on + * failure. On failure, the packet is unchanged and the data remains + * owned by the caller. + */ +int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, +uint8_t *data, size_t size); + +/** * Shrink the already allocated side data buffer * * @param pkt packet diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index a6eb241..f8268b9 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -237,29 +237,47 @@ void av_free_packet(AVPacket *pkt) FF_ENABLE_DEPRECATION_WARNINGS #endif -uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, - int size) +int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, +uint8_t *data, size_t size) { int elems = pkt->side_data_elems; if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data)) -return NULL; -if ((unsigned)size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) -return NULL; +return AVERROR(EOVERFLOW); pkt->side_data = av_realloc(pkt->side_data, (elems + 1) * sizeof(*pkt->side_data)); if (!pkt->side_data) -return NULL; +return AVERROR(ENOMEM); -pkt->side_data[elems].data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE); -if (!pkt->side_data[elems].data) -return NULL; +pkt->side_data[elems].data = data; pkt->side_data[elems].size = size; pkt->side_data[elems].type = type; pkt->side_data_elems++; -return pkt->side_data[elems].data; +return 0; +} + + +uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int size) +{ +int ret; +uint8_t *data; + +if ((unsigned)size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) +return NULL; +data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE); +if (!data) +return NULL; + +ret = av_packet_add_side_data(pkt, type, data, size); +if (ret < 0) { +av_freep(&data); +return NULL; +} + +return data; } uint8_t *av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, diff --git a/libavcodec/version.h b/libavcodec/version.h index 29bc4b7..0e42e6c 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 57 -#define LIBAVCODEC_VERSION_MINOR 10 +#define LIBAVCODEC_VERSION_MINOR 11 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '31c51f7441de07b88cfea2550245bf1f5140cb8f'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 13:12:07 2015 +0100| [30833d121e24fc644c9c4e6ca07df3e9e4963180] | committer: Hendrik Leppkes Merge commit '31c51f7441de07b88cfea2550245bf1f5140cb8f' * commit '31c51f7441de07b88cfea2550245bf1f5140cb8f': avpacket: add a function for wrapping existing data as side data Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=30833d121e24fc644c9c4e6ca07df3e9e4963180 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '84adab333cddeefc3cfd843089dee23f58bd372c'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 13:18:18 2015 +0100| [a7d5b9f1c3ca2e63b0eb882eabadfa1461d17a2d] | committer: Hendrik Leppkes Merge commit '84adab333cddeefc3cfd843089dee23f58bd372c' * commit '84adab333cddeefc3cfd843089dee23f58bd372c': lavc: add stream-global packet side data Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a7d5b9f1c3ca2e63b0eb882eabadfa1461d17a2d --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc: add stream-global packet side data
ffmpeg | branch: master | Anton Khirnov | Wed Jul 22 14:39:30 2015 +0200| [84adab333cddeefc3cfd843089dee23f58bd372c] | committer: Anton Khirnov lavc: add stream-global packet side data This is similar to what is done for AVStream. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=84adab333cddeefc3cfd843089dee23f58bd372c --- doc/APIchanges |3 ++- libavcodec/avcodec.h | 10 ++ libavcodec/utils.c |9 - 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 0979930..bd7323c 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,7 +14,8 @@ libavutil: 2015-08-28 API changes, most recent first: 2015-xx-xx - xxx - lavc 57.11.0 - avcodec.h - Add av_packet_add_side_data(). + xxx - Add av_packet_add_side_data(). + xxx - Add AVCodecContext.coded_side_data. 2015-xx-xx - xxx - lavc 57.9.1 - avcodec.h Deprecate rtp_callback without replacement, i.e. it won't be possible to diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 5ed13de..80cf644 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2925,6 +2925,16 @@ typedef struct AVCodecContext { * - decoding: Set by libavcodec before calling get_format() */ enum AVPixelFormat sw_pix_fmt; + +/** + * Additional data associated with the entire coded stream. + * + * - decoding: unused + * - encoding: may be set by libavcodec after avcodec_open2(). + */ +AVPacketSideData *coded_side_data; +intnb_coded_side_data; + } AVCodecContext; /** diff --git a/libavcodec/utils.c b/libavcodec/utils.c index ad00a92..f3361a0 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1603,9 +1603,11 @@ void avsubtitle_free(AVSubtitle *sub) av_cold int avcodec_close(AVCodecContext *avctx) { +int i; + if (avcodec_is_open(avctx)) { FramePool *pool = avctx->internal->pool; -int i; + if (HAVE_THREADS && avctx->internal->thread_ctx) ff_thread_free(avctx); if (avctx->codec && avctx->codec->close) @@ -1622,6 +1624,11 @@ av_cold int avcodec_close(AVCodecContext *avctx) av_freep(&avctx->internal); } +for (i = 0; i < avctx->nb_coded_side_data; i++) +av_freep(&avctx->coded_side_data[i].data); +av_freep(&avctx->coded_side_data); +avctx->nb_coded_side_data = 0; + if (avctx->priv_data && avctx->codec && avctx->codec->priv_class) av_opt_free(avctx->priv_data); av_opt_free(avctx); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'e63e3797a1ed9346f529848e6ba3d27fd2d2cc8d'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 13:20:37 2015 +0100| [be52b95d311bb392fe99a6bb3b8db74e255043e3] | committer: Hendrik Leppkes Merge commit 'e63e3797a1ed9346f529848e6ba3d27fd2d2cc8d' * commit 'e63e3797a1ed9346f529848e6ba3d27fd2d2cc8d': avconv: pass the global codec side data to the muxer Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=be52b95d311bb392fe99a6bb3b8db74e255043e3 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avconv: pass the global codec side data to the muxer
ffmpeg | branch: master | Anton Khirnov | Sun Oct 4 13:17:41 2015 +0200| [e63e3797a1ed9346f529848e6ba3d27fd2d2cc8d] | committer: Anton Khirnov avconv: pass the global codec side data to the muxer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e63e3797a1ed9346f529848e6ba3d27fd2d2cc8d --- avconv.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/avconv.c b/avconv.c index 7334851..57a3718 100644 --- a/avconv.c +++ b/avconv.c @@ -1602,6 +1602,28 @@ static int init_output_stream(OutputStream *ost, char *error, int error_len) exit_program(1); } +if (ost->enc_ctx->nb_coded_side_data) { +int i; + +ost->st->side_data = av_realloc_array(NULL, ost->enc_ctx->nb_coded_side_data, + sizeof(*ost->st->side_data)); +if (!ost->st->side_data) +return AVERROR(ENOMEM); + +for (i = 0; i < ost->enc_ctx->nb_coded_side_data; i++) { +const AVPacketSideData *sd_src = &ost->enc_ctx->coded_side_data[i]; +AVPacketSideData *sd_dst = &ost->st->side_data[i]; + +sd_dst->data = av_malloc(sd_src->size); +if (!sd_dst->data) +return AVERROR(ENOMEM); +memcpy(sd_dst->data, sd_src->data, sd_src->size); +sd_dst->size = sd_src->size; +sd_dst->type = sd_src->type; +ost->st->nb_side_data++; +} +} + ost->st->time_base = ost->enc_ctx->time_base; } else { ret = av_opt_set_dict(ost->enc_ctx, &ost->encoder_opts); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'f0b769c16daafa64720dcba7fa81a9f5255e1d29'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 13:25:52 2015 +0100| [dd6ee019ea828a2700e38366983ef343612021c6] | committer: Hendrik Leppkes Merge commit 'f0b769c16daafa64720dcba7fa81a9f5255e1d29' * commit 'f0b769c16daafa64720dcba7fa81a9f5255e1d29': lavc: add a packet side data type for VBV-like parameters Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dd6ee019ea828a2700e38366983ef343612021c6 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc: add a packet side data type for VBV-like parameters
ffmpeg | branch: master | Anton Khirnov | Wed Jul 22 14:04:20 2015 +0200| [f0b769c16daafa64720dcba7fa81a9f5255e1d29] | committer: Anton Khirnov lavc: add a packet side data type for VBV-like parameters > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f0b769c16daafa64720dcba7fa81a9f5255e1d29 --- doc/APIchanges |1 + libavcodec/avcodec.h | 54 ++ libavcodec/utils.c | 14 + 3 files changed, 69 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index bd7323c..8ae8be4 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -16,6 +16,7 @@ API changes, most recent first: 2015-xx-xx - xxx - lavc 57.11.0 - avcodec.h xxx - Add av_packet_add_side_data(). xxx - Add AVCodecContext.coded_side_data. + xxx - Add AVCPBProperties API. 2015-xx-xx - xxx - lavc 57.9.1 - avcodec.h Deprecate rtp_callback without replacement, i.e. it won't be possible to diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 80cf644..dacbcd3 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1036,6 +1036,44 @@ typedef struct AVPanScan{ int16_t position[3][2]; }AVPanScan; +/** + * This structure describes the bitrate properties of an encoded bitstream. It + * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD + * parameters for H.264/HEVC. + */ +typedef struct AVCPBProperties { +/** + * Maximum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ +int max_bitrate; +/** + * Minimum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ +int min_bitrate; +/** + * Average bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ +int avg_bitrate; + +/** + * The size of the buffer to which the ratecontrol is applied, in bits. + * Zero if unknown or unspecified. + */ +int buffer_size; + +/** + * The delay between the time the packet this structure is associated with + * is received and the time when it should be decoded, in periods of a 27MHz + * clock. + * + * UINT64_MAX when unknown or unspecified. + */ +uint64_t vbv_delay; +} AVCPBProperties; + #if FF_API_QSCALE_TYPE #define FF_QSCALE_TYPE_MPEG1 0 #define FF_QSCALE_TYPE_MPEG2 1 @@ -1137,6 +1175,11 @@ enum AVPacketSideDataType { * e.g. no decoder available for codec. */ AV_PKT_DATA_FALLBACK_TRACK, + +/** + * This side data corresponds to the AVCPBProperties struct. + */ +AV_PKT_DATA_CPB_PROPERTIES, }; typedef struct AVPacketSideData { @@ -4631,6 +4674,17 @@ const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev); const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name); /** + * Allocate a CPB properties structure and initialize its fields to default + * values. + * + * @param size if non-NULL, the size of the allocated struct will be written + * here. This is useful for embedding it in side data. + * + * @return the newly allocated struct or NULL on failure + */ +AVCPBProperties *av_cpb_properties_alloc(size_t *size); + +/** * @} */ diff --git a/libavcodec/utils.c b/libavcodec/utils.c index f3361a0..d2f4de7 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -2369,3 +2369,17 @@ const uint8_t *avpriv_find_start_code(const uint8_t *restrict p, return p + 4; } + +AVCPBProperties *av_cpb_properties_alloc(size_t *size) +{ +AVCPBProperties *props = av_mallocz(sizeof(AVCPBProperties)); +if (!props) +return NULL; + +if (size) +*size = sizeof(*props); + +props->vbv_delay = UINT64_MAX; + +return props; +} ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '11c9bd633f635f07a762be1ecd672de55daf4edc'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 13:31:21 2015 +0100| [f49264a1c5912ee2bc23e7a09ded1024a178cf04] | committer: Hendrik Leppkes Merge commit '11c9bd633f635f07a762be1ecd672de55daf4edc' * commit '11c9bd633f635f07a762be1ecd672de55daf4edc': libopenh264enc: export CPB props side data Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f49264a1c5912ee2bc23e7a09ded1024a178cf04 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] libopenh264enc: export CPB props side data
ffmpeg | branch: master | Anton Khirnov | Sat Oct 3 15:19:10 2015 +0200| [11c9bd633f635f07a762be1ecd672de55daf4edc] | committer: Anton Khirnov libopenh264enc: export CPB props side data > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=11c9bd633f635f07a762be1ecd672de55daf4edc --- libavcodec/internal.h |5 + libavcodec/libopenh264enc.c |9 + libavcodec/utils.c | 26 ++ 3 files changed, 40 insertions(+) diff --git a/libavcodec/internal.h b/libavcodec/internal.h index adec523..7f12344 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -240,4 +240,9 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt); */ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame); +/** + * Add a CPB properties side data to an encoding context. + */ +AVCPBProperties *ff_add_cpb_side_data(AVCodecContext *avctx); + #endif /* AVCODEC_INTERNAL_H */ diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c index 0671c6f..da03b29 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -108,6 +108,7 @@ static av_cold int svc_encode_init(AVCodecContext *avctx) int err = AVERROR_UNKNOWN; int log_level; WelsTraceCallback callback_function; +AVCPBProperties *props; // Mingw GCC < 4.7 on x86_32 uses an incorrect/buggy ABI for the WelsGetCodecVersion // function (for functions returning larger structs), thus skip the check in those @@ -223,6 +224,14 @@ static av_cold int svc_encode_init(AVCodecContext *avctx) memcpy(avctx->extradata, fbi.sLayerInfo[0].pBsBuf, size); } +props = ff_add_cpb_side_data(avctx); +if (!props) { +err = AVERROR(ENOMEM); +goto fail; +} +props->max_bitrate = param.iMaxBitrate; +props->avg_bitrate = param.iTargetBitrate; + return 0; fail: diff --git a/libavcodec/utils.c b/libavcodec/utils.c index d2f4de7..4f2f951 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -2383,3 +2383,29 @@ AVCPBProperties *av_cpb_properties_alloc(size_t *size) return props; } + +AVCPBProperties *ff_add_cpb_side_data(AVCodecContext *avctx) +{ +AVPacketSideData *tmp; +AVCPBProperties *props; +size_t size; + +props = av_cpb_properties_alloc(&size); +if (!props) +return NULL; + +tmp = av_realloc_array(avctx->coded_side_data, avctx->nb_coded_side_data + 1, sizeof(*tmp)); +if (!tmp) { +av_freep(&props); +return NULL; +} + +avctx->coded_side_data = tmp; +avctx->nb_coded_side_data++; + +avctx->coded_side_data[avctx->nb_coded_side_data - 1].type = AV_PKT_DATA_CPB_PROPERTIES; +avctx->coded_side_data[avctx->nb_coded_side_data - 1].data = (uint8_t*)props; +avctx->coded_side_data[avctx->nb_coded_side_data - 1].size = size; + +return props; +} ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] libvpxenc: export CPB props side data
ffmpeg | branch: master | Anton Khirnov | Sat Oct 3 15:19:10 2015 +0200| [03afb62e83516141ba999536fc97575faefb98af] | committer: Anton Khirnov libvpxenc: export CPB props side data > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=03afb62e83516141ba999536fc97575faefb98af --- libavcodec/libvpxenc.c | 13 + 1 file changed, 13 insertions(+) diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index d1e2523..a3f7b6c 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -212,6 +212,7 @@ static av_cold int vpx_init(AVCodecContext *avctx, { VP8Context *ctx = avctx->priv_data; struct vpx_codec_enc_cfg enccfg = { 0 }; +AVCPBProperties *cpb_props; int res; av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str()); @@ -362,6 +363,18 @@ static av_cold int vpx_init(AVCodecContext *avctx, vpx_img_wrap(&ctx->rawimg, ff_vpx_pixfmt_to_imgfmt(avctx->pix_fmt), avctx->width, avctx->height, 1, (unsigned char *)1); +cpb_props = ff_add_cpb_side_data(avctx); +if (!cpb_props) +return AVERROR(ENOMEM); + +if (enccfg.rc_end_usage == VPX_CBR || +enccfg.g_pass != VPX_RC_ONE_PASS) { +cpb_props->max_bitrate = avctx->rc_max_rate; +cpb_props->min_bitrate = avctx->rc_min_rate; +cpb_props->avg_bitrate = avctx->bit_rate; +} +cpb_props->buffer_size = avctx->rc_buffer_size; + return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '03afb62e83516141ba999536fc97575faefb98af'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 13:33:20 2015 +0100| [d6322710c5ec51086aefef9037311922c7aa646c] | committer: Hendrik Leppkes Merge commit '03afb62e83516141ba999536fc97575faefb98af' * commit '03afb62e83516141ba999536fc97575faefb98af': libvpxenc: export CPB props side data Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d6322710c5ec51086aefef9037311922c7aa646c --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] libx264: export CPB props side data
ffmpeg | branch: master | Anton Khirnov | Sat Oct 3 15:19:10 2015 +0200| [732a37d1466d45b3812509d68c82e783530e291a] | committer: Anton Khirnov libx264: export CPB props side data > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=732a37d1466d45b3812509d68c82e783530e291a --- libavcodec/libx264.c |8 1 file changed, 8 insertions(+) diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index bcbdf84..e2648f3 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -351,6 +351,7 @@ static int convert_pix_fmt(enum AVPixelFormat pix_fmt) static av_cold int X264_init(AVCodecContext *avctx) { X264Context *x4 = avctx->priv_data; +AVCPBProperties *cpb_props; #if CONFIG_LIBX262_ENCODER if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) { @@ -610,6 +611,13 @@ FF_ENABLE_DEPRECATION_WARNINGS avctx->extradata_size = p - avctx->extradata; } +cpb_props = ff_add_cpb_side_data(avctx); +if (!cpb_props) +return AVERROR(ENOMEM); +cpb_props->buffer_size = x4->params.rc.i_vbv_buffer_size * 1000; +cpb_props->max_bitrate = x4->params.rc.i_vbv_max_bitrate * 1000; +cpb_props->avg_bitrate = x4->params.rc.i_bitrate * 1000; + return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '732a37d1466d45b3812509d68c82e783530e291a'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 13:34:51 2015 +0100| [b77061b5caceb07b4487a08e48f78a5b24c15959] | committer: Hendrik Leppkes Merge commit '732a37d1466d45b3812509d68c82e783530e291a' * commit '732a37d1466d45b3812509d68c82e783530e291a': libx264: export CPB props side data Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b77061b5caceb07b4487a08e48f78a5b24c15959 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] mpegvideo_enc: export CPB props side data
ffmpeg | branch: master | Anton Khirnov | Sat Oct 3 15:19:10 2015 +0200| [3f5c99fcbb2c366d7bdef8500c19f43a33bdb6b9] | committer: Anton Khirnov mpegvideo_enc: export CPB props side data > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3f5c99fcbb2c366d7bdef8500c19f43a33bdb6b9 --- libavcodec/mpegvideo_enc.c |9 + 1 file changed, 9 insertions(+) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index b76d0ad..9336051 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -241,6 +241,7 @@ static void mpv_encode_defaults(MpegEncContext *s) av_cold int ff_mpv_encode_init(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; +AVCPBProperties *cpb_props; int i, ret, format_supported; mpv_encode_defaults(s); @@ -882,6 +883,14 @@ FF_ENABLE_DEPRECATION_WARNINGS } } +cpb_props = ff_add_cpb_side_data(avctx); +if (!cpb_props) +return AVERROR(ENOMEM); +cpb_props->max_bitrate = avctx->rc_max_rate; +cpb_props->min_bitrate = avctx->rc_min_rate; +cpb_props->avg_bitrate = avctx->bit_rate; +cpb_props->buffer_size = avctx->rc_buffer_size; + return 0; fail: ff_mpv_encode_end(avctx); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '3f5c99fcbb2c366d7bdef8500c19f43a33bdb6b9'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 13:35:34 2015 +0100| [b799619f48ba5fd07e91243f27f74638bcb875fb] | committer: Hendrik Leppkes Merge commit '3f5c99fcbb2c366d7bdef8500c19f43a33bdb6b9' * commit '3f5c99fcbb2c366d7bdef8500c19f43a33bdb6b9': mpegvideo_enc: export CPB props side data Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b799619f48ba5fd07e91243f27f74638bcb875fb --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] mpegvideo_enc: export vbv_delay in side data
ffmpeg | branch: master | Anton Khirnov | Sun Oct 4 12:19:26 2015 +0200| [2507b5dd674834be7261772996f47ae3b95cca69] | committer: Anton Khirnov mpegvideo_enc: export vbv_delay in side data Deprecate AVCodecContext.vbv_delay > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2507b5dd674834be7261772996f47ae3b95cca69 --- libavcodec/avcodec.h |5 + libavcodec/mpegvideo_enc.c | 13 + libavcodec/version.h |3 +++ 3 files changed, 21 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index dacbcd3..64328c8 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2914,13 +2914,18 @@ typedef struct AVCodecContext { int error_rate; #endif +#if FF_API_VBV_DELAY /** * VBV delay coded in the last frame (in periods of a 27 MHz clock). * Used for compliant TS muxing. * - encoding: Set by libavcodec. * - decoding: unused. + * @deprecated this value is now exported as a part of + * AV_PKT_DATA_CPB_PROPERTIES packet side data */ +attribute_deprecated uint64_t vbv_delay; +#endif #if FF_API_SIDEDATA_ONLY_PKT /** diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 9336051..4e97f4d 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1769,6 +1769,9 @@ vbv_retry: s->out_format == FMT_MPEG1 && 9LL * (avctx->rc_buffer_size - 1) <= s->avctx->rc_max_rate * 0xLL) { +AVCPBProperties *props; +size_t props_size; + int vbv_delay, min_delay; double inbits = s->avctx->rc_max_rate * av_q2d(s->avctx->time_base); @@ -1795,7 +1798,17 @@ vbv_retry: s->vbv_delay_ptr[1] = vbv_delay >> 5; s->vbv_delay_ptr[2] &= 0x07; s->vbv_delay_ptr[2] |= vbv_delay << 3; + +props = av_cpb_properties_alloc(&props_size); +if (!props) +return AVERROR(ENOMEM); +props->vbv_delay = vbv_delay * 300; + +#if FF_API_VBV_DELAY +FF_DISABLE_DEPRECATION_WARNINGS avctx->vbv_delay = vbv_delay * 300; +FF_ENABLE_DEPRECATION_WARNINGS +#endif } s->total_bits += s->frame_bits; avctx->frame_bits = s->frame_bits; diff --git a/libavcodec/version.h b/libavcodec/version.h index 0e42e6c..afa7600 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -180,5 +180,8 @@ #ifndef FF_API_RTP_CALLBACK #define FF_API_RTP_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 59) #endif +#ifndef FF_API_VBV_DELAY +#define FF_API_VBV_DELAY (LIBAVCODEC_VERSION_MAJOR < 59) +#endif #endif /* AVCODEC_VERSION_H */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '2507b5dd674834be7261772996f47ae3b95cca69'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 13:36:09 2015 +0100| [31ae2308b3f6c1021d79da69c504490239895d60] | committer: Hendrik Leppkes Merge commit '2507b5dd674834be7261772996f47ae3b95cca69' * commit '2507b5dd674834be7261772996f47ae3b95cca69': mpegvideo_enc: export vbv_delay in side data Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=31ae2308b3f6c1021d79da69c504490239895d60 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '1520c6ff05d835da4b793318fc88bbbc129c86a1'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 13:41:29 2015 +0100| [5fc17edc7dcec5ea2989a0d764f3cfb666a7e663] | committer: Hendrik Leppkes Merge commit '1520c6ff05d835da4b793318fc88bbbc129c86a1' * commit '1520c6ff05d835da4b793318fc88bbbc129c86a1': nvenc: export CPB props side data Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5fc17edc7dcec5ea2989a0d764f3cfb666a7e663 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] nvenc: export CPB props side data
ffmpeg | branch: master | Anton Khirnov | Sat Oct 3 15:19:10 2015 +0200| [1520c6ff05d835da4b793318fc88bbbc129c86a1] | committer: Anton Khirnov nvenc: export CPB props side data > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1520c6ff05d835da4b793318fc88bbbc129c86a1 --- libavcodec/nvenc.c |9 + 1 file changed, 9 insertions(+) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 3f19ed0..92686c3 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -559,6 +559,7 @@ static int nvenc_setup_encoder(AVCodecContext *avctx) NVENCContext *ctx = avctx->priv_data; NV_ENCODE_API_FUNCTION_LIST *nv = &ctx->nvel.nvenc_funcs; NV_ENC_PRESET_CONFIG preset_cfg = { 0 }; +AVCPBProperties *cpb_props; int ret; ctx->params.version = NV_ENC_INITIALIZE_PARAMS_VER; @@ -644,6 +645,14 @@ static int nvenc_setup_encoder(AVCodecContext *avctx) return AVERROR_UNKNOWN; } +cpb_props = ff_add_cpb_side_data(avctx); +if (!cpb_props) +return AVERROR(ENOMEM); +cpb_props->max_bitrate = avctx->rc_max_rate; +cpb_props->min_bitrate = avctx->rc_min_rate; +cpb_props->avg_bitrate = avctx->bit_rate; +cpb_props->buffer_size = avctx->rc_buffer_size; + return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] qsvenc: export CPB props side data
ffmpeg | branch: master | Anton Khirnov | Sat Oct 3 15:19:10 2015 +0200| [825900248b4053515803152d3165efdb034b660b] | committer: Anton Khirnov qsvenc: export CPB props side data > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=825900248b4053515803152d3165efdb034b660b --- libavcodec/qsvenc.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 4fc3861..f19ca76 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -523,6 +523,8 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q) { +AVCPBProperties *cpb_props; + uint8_t sps_buf[128]; uint8_t pps_buf[128]; @@ -589,6 +591,14 @@ static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q) avctx->extradata_size = extradata.SPSBufSize + need_pps * extradata.PPSBufSize; memset(avctx->extradata + avctx->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); +cpb_props = ff_add_cpb_side_data(avctx); +if (!cpb_props) +return AVERROR(ENOMEM); +cpb_props->max_bitrate = avctx->rc_max_rate; +cpb_props->min_bitrate = avctx->rc_min_rate; +cpb_props->avg_bitrate = avctx->bit_rate; +cpb_props->buffer_size = avctx->rc_buffer_size; + dump_video_param(avctx, q, ext_buffers + 1); return 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '825900248b4053515803152d3165efdb034b660b'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 13:42:53 2015 +0100| [b2d8b91cf0a21537c893d52dc487bfd79988f234] | committer: Hendrik Leppkes Merge commit '825900248b4053515803152d3165efdb034b660b' * commit '825900248b4053515803152d3165efdb034b660b': qsvenc: export CPB props side data Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b2d8b91cf0a21537c893d52dc487bfd79988f234 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] movenc: use the CPB props side data
ffmpeg | branch: master | Anton Khirnov | Sun Oct 4 12:27:10 2015 +0200| [5845a8273e4694e0254ad728970b82bb64fd8bc0] | committer: Anton Khirnov movenc: use the CPB props side data Do not access the encoder options, since it makes no sense when the AVStream codec context is not the encoding context. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5845a8273e4694e0254ad728970b82bb64fd8bc0 --- libavformat/movenc.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index a940b45..1026bae 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -305,6 +305,7 @@ static void put_descr(AVIOContext *pb, int tag, unsigned int size) static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic { +AVCPBProperties *props; int64_t pos = avio_tell(pb); int decoder_specific_info_len = track->vos_len ? 5 + track->vos_len : 0; @@ -337,14 +338,16 @@ static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic else avio_w8(pb, 0x11); // flags (= Visualstream) -avio_wb24(pb, track->enc->rc_buffer_size >> 3); // Buffersize DB +props = (AVCPBProperties*)av_stream_get_side_data(track->st, AV_PKT_DATA_CPB_PROPERTIES, + NULL); -avio_wb32(pb, FFMAX(track->enc->bit_rate, track->enc->rc_max_rate)); // maxbitrate (FIXME should be max rate in any 1 sec window) -if (track->enc->rc_max_rate != track->enc->rc_min_rate || -track->enc->rc_min_rate == 0) +avio_wb24(pb, props ? props->buffer_size / 8 : 0); // Buffersize DB + +avio_wb32(pb, props ? FFMAX(props->max_bitrate, props->avg_bitrate) : track->enc->bit_rate); // maxbitrate (FIXME should be max rate in any 1 sec window) +if (!props || !props->min_bitrate || props->max_bitrate != props->min_bitrate) avio_wb32(pb, 0); // vbr else -avio_wb32(pb, track->enc->rc_max_rate); // avg bitrate +avio_wb32(pb, props->max_bitrate); // avg bitrate if (track->vos_len) { // DecoderSpecific info descriptor ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '5845a8273e4694e0254ad728970b82bb64fd8bc0'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 13:50:36 2015 +0100| [f95385dd580604aa287b41093edd692f34c7613b] | committer: Hendrik Leppkes Merge commit '5845a8273e4694e0254ad728970b82bb64fd8bc0' * commit '5845a8273e4694e0254ad728970b82bb64fd8bc0': movenc: use the CPB props side data Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f95385dd580604aa287b41093edd692f34c7613b --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '8bcadaacc2b8dc3c5d6569835a5ca20e62d3efca'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 13:55:39 2015 +0100| [079b5d4ef888bd42bf0147a6d964b8bc9ec0f3c5] | committer: Hendrik Leppkes Merge commit '8bcadaacc2b8dc3c5d6569835a5ca20e62d3efca' * commit '8bcadaacc2b8dc3c5d6569835a5ca20e62d3efca': mpegenc: use the CPB props side data Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=079b5d4ef888bd42bf0147a6d964b8bc9ec0f3c5 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] mpegenc: use the CPB props side data
ffmpeg | branch: master | Anton Khirnov | Sun Oct 4 12:27:10 2015 +0200| [8bcadaacc2b8dc3c5d6569835a5ca20e62d3efca] | committer: Anton Khirnov mpegenc: use the CPB props side data Do not access the encoder options, since it makes no sense when the AVStream codec context is not the encoding context. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8bcadaacc2b8dc3c5d6569835a5ca20e62d3efca --- libavformat/mpegenc.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 33eaefd..ac5a83c 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -341,6 +341,8 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx) lpcm_id = LPCM_ID; for (i = 0; i < ctx->nb_streams; i++) { +AVCPBProperties *props; + st = ctx->streams[i]; stream = av_mallocz(sizeof(StreamInfo)); if (!stream) @@ -383,8 +385,10 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx) stream->id = h264_id++; else stream->id = mpv_id++; -if (st->codec->rc_buffer_size) -stream->max_buffer_size = 6 * 1024 + st->codec->rc_buffer_size / 8; + +props = (AVCPBProperties*)av_stream_get_side_data(st, AV_PKT_DATA_CPB_PROPERTIES, NULL); +if (props && props->buffer_size) +stream->max_buffer_size = 6 * 1024 + props->buffer_size / 8; else { av_log(ctx, AV_LOG_WARNING, "VBV buffer size not set, muxing may fail\n"); @@ -408,13 +412,14 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx) audio_bitrate = 0; video_bitrate = 0; for (i = 0; i < ctx->nb_streams; i++) { +AVCPBProperties *props; int codec_rate; st = ctx->streams[i]; stream = (StreamInfo *)st->priv_data; -if (st->codec->rc_max_rate || -st->codec->codec_type == AVMEDIA_TYPE_VIDEO) -codec_rate = st->codec->rc_max_rate; +props = (AVCPBProperties*)av_stream_get_side_data(st, AV_PKT_DATA_CPB_PROPERTIES, NULL); +if (props) +codec_rate = props->max_bitrate; else codec_rate = st->codec->bit_rate; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc: export Dirac parsing API used by the ogg demuxer as public
ffmpeg | branch: master | Anton Khirnov | Sat Jul 5 09:09:15 2014 +| [e02de9df4b218bd6e1e927b67fd4075741545688] | committer: Anton Khirnov lavc: export Dirac parsing API used by the ogg demuxer as public Also, stop using AVCodecContext for storing the stream parameters. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e02de9df4b218bd6e1e927b67fd4075741545688 --- configure |4 +- doc/APIchanges |4 +- libavcodec/Makefile |2 + libavcodec/dirac.c | 222 +++ libavcodec/dirac.h | 33 ++- libavformat/oggparsedirac.c | 31 -- 6 files changed, 200 insertions(+), 96 deletions(-) diff --git a/configure b/configure index 30db632..23e4037 100755 --- a/configure +++ b/configure @@ -1646,6 +1646,7 @@ CONFIG_EXTRA=" blockdsp bswapdsp cabac +dirac_parse dvprofile faandct faanidct @@ -1850,6 +1851,7 @@ threads_if_any="$THREADS_LIST" # subsystems dct_select="rdft" +dirac_parse_select="golomb" error_resilience_select="me_cmp" faandct_deps="faan fdctdsp" faanidct_deps="faan idctdsp" @@ -2241,7 +2243,7 @@ mxf_d10_muxer_select="mxf_muxer" nut_muxer_select="riffenc" nuv_demuxer_select="riffdec" oga_muxer_select="ogg_muxer" -ogg_demuxer_select="golomb" +ogg_demuxer_select="dirac_parse" opus_muxer_select="ogg_muxer" psp_muxer_select="mov_muxer" rtp_demuxer_select="sdp_demuxer" diff --git a/doc/APIchanges b/doc/APIchanges index 8ae8be4..4c5e32e 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,10 +13,12 @@ libavutil: 2015-08-28 API changes, most recent first: -2015-xx-xx - xxx - lavc 57.11.0 - avcodec.h +2015-xx-xx - xxx - lavc 57.11.0 - avcodec.h dirac.h xxx - Add av_packet_add_side_data(). xxx - Add AVCodecContext.coded_side_data. xxx - Add AVCPBProperties API. + xxx - Add a new public header dirac.h containing +av_dirac_parse_sequence_header() 2015-xx-xx - xxx - lavc 57.9.1 - avcodec.h Deprecate rtp_callback without replacement, i.e. it won't be possible to diff --git a/libavcodec/Makefile b/libavcodec/Makefile index ee76315..f3a05d0 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -4,6 +4,7 @@ HEADERS = avcodec.h \ avfft.h \ dv_profile.h \ d3d11va.h \ + dirac.h \ dxva2.h \ qsv.h \ vaapi.h \ @@ -20,6 +21,7 @@ OBJS = allcodecs.o \ bitstream_filter.o \ codec_desc.o \ d3d11va.o\ + dirac.o \ dv_profile.o \ imgconvert.o \ log2_tab.o \ diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c index 5e13a84..aced2ac 100644 --- a/libavcodec/dirac.c +++ b/libavcodec/dirac.c @@ -33,6 +33,28 @@ #include "internal.h" #include "mpeg12data.h" +#if CONFIG_DIRAC_PARSE + +typedef struct dirac_source_params { +unsigned width; +unsigned height; +uint8_t chroma_format; ///< 0: 444 1: 422 2: 420 + +uint8_t interlaced; +uint8_t top_field_first; + +uint8_t frame_rate_index; ///< index into dirac_frame_rate[] +uint8_t aspect_ratio_index; ///< index into dirac_aspect_ratio[] + +uint16_t clean_width; +uint16_t clean_height; +uint16_t clean_left_offset; +uint16_t clean_right_offset; + +uint8_t pixel_range_index; ///< index into dirac_pixel_range_presets[] +uint8_t color_spec_index; ///< index into dirac_color_spec_presets[] +} dirac_source_params; + // defaults for source parameters static const dirac_source_params dirac_source_parameters_defaults[] = { { 640, 480, 2, 0, 0, 1, 1, 640, 480, 0, 0, 1, 0 }, @@ -116,8 +138,8 @@ static const enum AVPixelFormat dirac_pix_fmt[2][3] = { /* [DIRAC_STD] 10.3 Parse Source Parameters. * source_parameters(base_video_format) */ -static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb, - dirac_source_params *source) +static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb, + void *log
[FFmpeg-cvslog] Merge commit 'e02de9df4b218bd6e1e927b67fd4075741545688'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 14:48:46 2015 +0100| [efcc8fddd6b7d1f931ff349e195d78c3c943d7fd] | committer: Hendrik Leppkes Merge commit 'e02de9df4b218bd6e1e927b67fd4075741545688' * commit 'e02de9df4b218bd6e1e927b67fd4075741545688': lavc: export Dirac parsing API used by the ogg demuxer as public Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=efcc8fddd6b7d1f931ff349e195d78c3c943d7fd --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'b8b21dee0f0b4bcc1888067c497d6e838859d2cd'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 14:49:24 2015 +0100| [bd88914b15e77a4bdc5fb26882a0b4208fdfb727] | committer: Hendrik Leppkes Merge commit 'b8b21dee0f0b4bcc1888067c497d6e838859d2cd' * commit 'b8b21dee0f0b4bcc1888067c497d6e838859d2cd': mxfenc: always assume long gop Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bd88914b15e77a4bdc5fb26882a0b4208fdfb727 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] mxfenc: always assume long gop
ffmpeg | branch: master | Anton Khirnov | Sat Nov 15 10:41:02 2014 +0100| [b8b21dee0f0b4bcc1888067c497d6e838859d2cd] | committer: Anton Khirnov mxfenc: always assume long gop Checking the codec context parameters to find out this information is far too unreliable to be useful, so it is safer to assume B-frames are always present. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b8b21dee0f0b4bcc1888067c497d6e838859d2cd --- libavformat/mxfenc.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 0f4155a..3a3008b 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -1295,7 +1295,7 @@ static const UID mxf_mpeg2_codec_uls[] = { static const UID *mxf_get_mpeg2_codec_ul(AVCodecContext *avctx) { -int long_gop = avctx->gop_size > 1 || avctx->has_b_frames; +int long_gop = 1; if (avctx->profile == 4) { // Main if (avctx->level == 8) // Main ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] movenc-test: add a missing va_end call
ffmpeg | branch: master | Ganesh Ajjanagadde | Fri Dec 4 01:03:26 2015 -0500| [8df8f0c70c9c2085d9ca186b7cbf43656c4412eb] | committer: Martin Storsjö movenc-test: add a missing va_end call Signed-off-by: Martin Storsjö > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8df8f0c70c9c2085d9ca186b7cbf43656c4412eb --- libavformat/movenc-test.c |1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/movenc-test.c b/libavformat/movenc-test.c index 0c40b3a..6520aea 100644 --- a/libavformat/movenc-test.c +++ b/libavformat/movenc-test.c @@ -137,6 +137,7 @@ static void check_func(int value, int line, const char *msg, ...) vprintf(msg, ap); printf("\n"); check_faults++; +va_end(ap); } } #define check(value, ...) check_func(value, __LINE__, __VA_ARGS__) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '68e547ae8b455e5e2b60839f35c359d77a6d94bc'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 14:52:28 2015 +0100| [74b8fa103d6345c0859434447b0a66aaf5608bd0] | committer: Hendrik Leppkes Merge commit '68e547ae8b455e5e2b60839f35c359d77a6d94bc' * commit '68e547ae8b455e5e2b60839f35c359d77a6d94bc': avpacket: use ERANGE instead of EOVERFLOW Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=74b8fa103d6345c0859434447b0a66aaf5608bd0 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avpacket: use ERANGE instead of EOVERFLOW
ffmpeg | branch: master | Anton Khirnov | Sun Dec 6 10:59:51 2015 +0100| [68e547ae8b455e5e2b60839f35c359d77a6d94bc] | committer: Anton Khirnov avpacket: use ERANGE instead of EOVERFLOW EOVERFLOW seems to be unavailable on certain platforms. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=68e547ae8b455e5e2b60839f35c359d77a6d94bc --- libavcodec/avpacket.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index f8268b9..87454d5 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -243,7 +243,7 @@ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int elems = pkt->side_data_elems; if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data)) -return AVERROR(EOVERFLOW); +return AVERROR(ERANGE); pkt->side_data = av_realloc(pkt->side_data, (elems + 1) * sizeof(*pkt->side_data)); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'd5f5c90be9ec120f1320dcdd808b7bd917dee47c'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 14:52:15 2015 +0100| [ea1000b9fe68f33b93cf1a104eb3feacb0867e88] | committer: Hendrik Leppkes Merge commit 'd5f5c90be9ec120f1320dcdd808b7bd917dee47c' * commit 'd5f5c90be9ec120f1320dcdd808b7bd917dee47c': rtsp: free opts dictionary on failure of getnameinfo Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ea1000b9fe68f33b93cf1a104eb3feacb0867e88 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] rtsp: free opts dictionary on failure of getnameinfo
ffmpeg | branch: master | Ganesh Ajjanagadde | Fri Dec 4 01:11:10 2015 -0500| [d5f5c90be9ec120f1320dcdd808b7bd917dee47c] | committer: Martin Storsjö rtsp: free opts dictionary on failure of getnameinfo Signed-off-by: Martin Storsjö > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d5f5c90be9ec120f1320dcdd808b7bd917dee47c --- libavformat/rtsp.c |1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 2c616e8..4beb275 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -2279,6 +2279,7 @@ static int sdp_read_header(AVFormatContext *s) if (err) { av_log(s, AV_LOG_ERROR, "getnameinfo: %s\n", gai_strerror(err)); err = AVERROR(EIO); +av_dict_free(&opts); goto fail; } ff_url_join(url, sizeof(url), "rtp", NULL, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '8df8f0c70c9c2085d9ca186b7cbf43656c4412eb'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 14:52:05 2015 +0100| [fd6c5285f97f2662f256982127f7a4e8288f14ba] | committer: Hendrik Leppkes Merge commit '8df8f0c70c9c2085d9ca186b7cbf43656c4412eb' * commit '8df8f0c70c9c2085d9ca186b7cbf43656c4412eb': movenc-test: add a missing va_end call Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fd6c5285f97f2662f256982127f7a4e8288f14ba --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'd6dc5d15af0d8617611281a34a2c3f9ced149ccf'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 14:53:37 2015 +0100| [49507f1d1731585ce10c4a797c6c55e72c694ecb] | committer: Hendrik Leppkes Merge commit 'd6dc5d15af0d8617611281a34a2c3f9ced149ccf' * commit 'd6dc5d15af0d8617611281a34a2c3f9ced149ccf': aacdec: fix aac_static_table_init() prototype Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=49507f1d1731585ce10c4a797c6c55e72c694ecb --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] aacdec: fix aac_static_table_init() prototype
ffmpeg | branch: master | Anton Khirnov | Sun Dec 6 11:02:17 2015 +0100| [d6dc5d15af0d8617611281a34a2c3f9ced149ccf] | committer: Anton Khirnov aacdec: fix aac_static_table_init() prototype > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d6dc5d15af0d8617611281a34a2c3f9ced149ccf --- libavcodec/aacdec.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index e2e02b4..966a2ee 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -1005,7 +1005,7 @@ static void reset_predictor_group(PredictorState *ps, int group_num) sizeof(ff_aac_spectral_codes[num][0]), \ size); -static av_cold void aac_static_table_init() +static av_cold void aac_static_table_init(void) { AAC_INIT_VLC_STATIC( 0, 304); AAC_INIT_VLC_STATIC( 1, 270); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] h264: do not call frame_start() for missing frames
ffmpeg | branch: master | Anton Khirnov | Mon Nov 30 10:44:39 2015 +0100| [f1ccd076801444ab7f524cb13e0886faaf10fd50] | committer: Anton Khirnov h264: do not call frame_start() for missing frames We do not need to do a full setup like for a real frame, just allocate a buffer and set cur_pic(_ptr). > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f1ccd076801444ab7f524cb13e0886faaf10fd50 --- libavcodec/h264_slice.c | 50 ++- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 4f2d6a8..48d520b 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -290,6 +290,33 @@ static int find_unused_picture(H264Context *h) return i; } +static int initialize_cur_frame(H264Context *h) +{ +H264Picture *cur; +int ret; + +release_unused_pictures(h, 1); +ff_h264_unref_picture(h, &h->cur_pic); +h->cur_pic_ptr = NULL; + +ret = find_unused_picture(h); +if (ret < 0) { +av_log(h->avctx, AV_LOG_ERROR, "no frame buffer available\n"); +return ret; +} +cur = &h->DPB[ret]; + +ret = alloc_picture(h, cur); +if (ret < 0) +return ret; + +ret = ff_h264_ref_picture(h, &h->cur_pic, cur); +if (ret < 0) +return ret; +h->cur_pic_ptr = cur; + +return 0; +} static void init_dequant8_coeff_table(H264Context *h) { @@ -540,16 +567,11 @@ static int h264_frame_start(H264Context *h) int i, ret; const int pixel_shift = h->pixel_shift; -release_unused_pictures(h, 1); -h->cur_pic_ptr = NULL; - -i = find_unused_picture(h); -if (i < 0) { -av_log(h->avctx, AV_LOG_ERROR, "no frame buffer available\n"); -return i; -} -pic = &h->DPB[i]; +ret = initialize_cur_frame(h); +if (ret < 0) +return ret; +pic = h->cur_pic_ptr; pic->reference = h->droppable ? 0 : h->picture_structure; pic->f->coded_picture_number = h->coded_picture_number++; pic->field_picture = h->picture_structure != PICT_FRAME; @@ -563,14 +585,6 @@ static int h264_frame_start(H264Context *h) pic->mmco_reset = 0; pic->recovered = 0; -if ((ret = alloc_picture(h, pic)) < 0) -return ret; - -h->cur_pic_ptr = pic; -ff_h264_unref_picture(h, &h->cur_pic); -if ((ret = ff_h264_ref_picture(h, &h->cur_pic, h->cur_pic_ptr)) < 0) -return ret; - if (CONFIG_ERROR_RESILIENCE && h->enable_er) ff_er_frame_start(&h->slice_ctx[0].er); @@ -1336,7 +1350,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl) H264Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL; av_log(h->avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n", h->frame_num, h->prev_frame_num); -ret = h264_frame_start(h); +ret = initialize_cur_frame(h); if (ret < 0) { h->first_field = 0; return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'f1ccd076801444ab7f524cb13e0886faaf10fd50'
ffmpeg | branch: master | Hendrik Leppkes | Thu Dec 17 15:03:50 2015 +0100| [7b880464cb31b779259d56123e03cf3903d476e5] | committer: Hendrik Leppkes Merge commit 'f1ccd076801444ab7f524cb13e0886faaf10fd50' * commit 'f1ccd076801444ab7f524cb13e0886faaf10fd50': h264: do not call frame_start() for missing frames Not merged, FFmpeg does a lot more in frame_start to setup missing frames as well (like coloring them), and the overhead of the other setup is minimal. Merged-by: Hendrik Leppkes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7b880464cb31b779259d56123e03cf3903d476e5 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavu/random_seed: use arc4random() when available
ffmpeg | branch: master | Ganesh Ajjanagadde | Sun Dec 6 21:10:21 2015 -0500| [39f8c7961dcd530e88d13c600145097106647d2e] | committer: Ganesh Ajjanagadde lavu/random_seed: use arc4random() when available arc4random() was designed as a superior interface for system random number generation, designed for OpenBSD and subsequently incorporated by other BSD's, Mac OS X, and some non-standard libc's. It is thus an improvement to use it whenever available. As a side note, this may or may not get included in glibc, and there is a proposal to create a posix_random family based on these ideas: http://austingroupbugs.net/view.php?id=859. Tested on Mac OS X. Signed-off-by: Ganesh Ajjanagadde > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=39f8c7961dcd530e88d13c600145097106647d2e --- configure |2 ++ libavutil/random_seed.c |4 2 files changed, 6 insertions(+) diff --git a/configure b/configure index 7662f37..dc1d2eb 100755 --- a/configure +++ b/configure @@ -1841,6 +1841,7 @@ MATH_FUNCS=" SYSTEM_FUNCS=" access aligned_malloc +arc4random clock_gettime closesocket CommandLineToArgvW @@ -5232,6 +5233,7 @@ check_func ${malloc_prefix}memalign&& enable memalign check_func ${malloc_prefix}posix_memalign && enable posix_memalign check_func access +check_func arc4random check_func_headers time.h clock_gettime || { check_func_headers time.h clock_gettime -lrt && add_extralibs -lrt && LIBRT="-lrt"; } check_func fcntl check_func fork diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c index 8aa8c38..205a636 100644 --- a/libavutil/random_seed.c +++ b/libavutil/random_seed.c @@ -121,6 +121,10 @@ uint32_t av_get_random_seed(void) } #endif +#if HAVE_ARC4RANDOM +return arc4random(); +#endif + if (read_random(&seed, "/dev/urandom") == sizeof(seed)) return seed; if (read_random(&seed, "/dev/random") == sizeof(seed)) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/nellymoserenc: avoid wasteful pow
ffmpeg | branch: master | Ganesh Ajjanagadde | Wed Dec 9 18:50:28 2015 -0500| [07a8fbaa553205b496b68a62cb7bf7a968d0281b] | committer: Ganesh Ajjanagadde lavc/nellymoserenc: avoid wasteful pow exp2 suffices here. Some trivial speedup is done in addition here by reusing results. This retains accuracy, and in particular results in identical values with GNU libm + gcc/clang. sample benchmark (Haswell, GNU/Linux): proposed : 424160 decicycles in pow_table, 512 runs, 0 skips exp2 only: 1262093 decicycles in pow_table, 512 runs, 0 skips old : 2849085 decicycles in pow_table, 512 runs, 0 skips Reviewed-by: Michael Niedermayer Signed-off-by: Ganesh Ajjanagadde > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=07a8fbaa553205b496b68a62cb7bf7a968d0281b --- libavcodec/nellymoserenc.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libavcodec/nellymoserenc.c b/libavcodec/nellymoserenc.c index d998dba..9d22ac8 100644 --- a/libavcodec/nellymoserenc.c +++ b/libavcodec/nellymoserenc.c @@ -179,8 +179,18 @@ static av_cold int encode_init(AVCodecContext *avctx) /* Generate overlap window */ ff_init_ff_sine_windows(7); +/* faster way of doing for (i = 0; i < POW_TABLE_SIZE; i++) -pow_table[i] = pow(2, -i / 2048.0 - 3.0 + POW_TABLE_OFFSET); + pow_table[i] = 2^(-i / 2048.0 - 3.0 + POW_TABLE_OFFSET); */ +pow_table[0] = 1; +pow_table[1024] = M_SQRT1_2; +for (i = 1; i < 513; i++) { +double tmp = exp2(-i / 2048.0); +pow_table[i] = tmp; +pow_table[1024-i] = M_SQRT1_2 / tmp; +pow_table[1024+i] = tmp * M_SQRT1_2; +pow_table[2048-i] = 0.5 / tmp; +} if (s->avctx->trellis) { s->opt = av_malloc(NELLY_BANDS * OPT_SIZE * sizeof(float )); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/xmv: Add *.xmv to the recognized extensions for the XMV format.
ffmpeg | branch: master | rsn8887 | Wed Dec 16 17:08:23 2015 -0600| [02e9ba42eb36c587bf83ba3d38ff591a4df6ba8f] | committer: Michael Niedermayer avformat/xmv: Add *.xmv to the recognized extensions for the XMV format. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=02e9ba42eb36c587bf83ba3d38ff591a4df6ba8f --- libavformat/xmv.c |1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/xmv.c b/libavformat/xmv.c index 14d007a..45e5ebc 100644 --- a/libavformat/xmv.c +++ b/libavformat/xmv.c @@ -573,6 +573,7 @@ static int xmv_read_packet(AVFormatContext *s, AVInputFormat ff_xmv_demuxer = { .name = "xmv", .long_name = NULL_IF_CONFIG_SMALL("Microsoft XMV"), +.extensions = "xmv", .priv_data_size = sizeof(XMVDemuxContext), .read_probe = xmv_probe, .read_header= xmv_read_header, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/af_sofalizer: Fix occured typo
ffmpeg | branch: master | Michael Niedermayer | Thu Dec 17 18:58:53 2015 +0100| [c67cf84d7c65fc4894db3133cabbbe0ac0aa1cb0] | committer: Michael Niedermayer avfilter/af_sofalizer: Fix occured typo Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c67cf84d7c65fc4894db3133cabbbe0ac0aa1cb0 --- libavfilter/af_sofalizer.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/af_sofalizer.c b/libavfilter/af_sofalizer.c index b2ba525..76bf7de 100644 --- a/libavfilter/af_sofalizer.c +++ b/libavfilter/af_sofalizer.c @@ -830,7 +830,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } emms_c(); -/* display error message if clipping occured */ +/* display error message if clipping occurred */ if (n_clippings[0] + n_clippings[1] > 0) { av_log(ctx, AV_LOG_WARNING, "%d of %d samples clipped. Please reduce gain.\n", n_clippings[0] + n_clippings[1], out->nb_samples * 2); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/diracdec: Check ff_set_dimensions() for failure
ffmpeg | branch: master | Michael Niedermayer | Thu Dec 17 17:02:14 2015 +0100| [73840bbe4eea1e99807bc6bcc4cbe5188025ff1d] | committer: Michael Niedermayer avcodec/diracdec: Check ff_set_dimensions() for failure Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=73840bbe4eea1e99807bc6bcc4cbe5188025ff1d --- libavcodec/diracdec.c |7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index f35fe45..486c1b3 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -1989,7 +1989,12 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int return ret; } -ff_set_dimensions(avctx, dsh->width, dsh->height); +ret = ff_set_dimensions(avctx, dsh->width, dsh->height); +if (ret < 0) { +av_freep(&dsh); +return ret; +} + ff_set_sar(avctx, dsh->sample_aspect_ratio); avctx->pix_fmt = dsh->pix_fmt; avctx->color_range = dsh->color_range; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/diracdec: fix aspect ratio ( it was lost after efcc8fddd6b7d1f931ff349e195d78c3c943d7fd)
ffmpeg | branch: master | Michael Niedermayer | Thu Dec 17 16:01:21 2015 +0100| [ffad6f6b89624c1df163cb81846ca1d9b7363e2e] | committer: Michael Niedermayer avcodec/diracdec: fix aspect ratio (it was lost after efcc8fddd6b7d1f931ff349e195d78c3c943d7fd) Reviewed-by: Hendrik Leppkes Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ffad6f6b89624c1df163cb81846ca1d9b7363e2e --- libavcodec/diracdec.c |1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index 000abf7..f35fe45 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -1990,6 +1990,7 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int } ff_set_dimensions(avctx, dsh->width, dsh->height); +ff_set_sar(avctx, dsh->sample_aspect_ratio); avctx->pix_fmt = dsh->pix_fmt; avctx->color_range = dsh->color_range; avctx->color_trc = dsh->color_trc; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/oggparsedirac: Export sample aspect ratio
ffmpeg | branch: master | Michael Niedermayer | Thu Dec 17 16:01:43 2015 +0100| [e839db2288447db471af3e4643d1f350265cd1ac] | committer: Michael Niedermayer avformat/oggparsedirac: Export sample aspect ratio Reviewed-by: Hendrik Leppkes Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e839db2288447db471af3e4643d1f350265cd1ac --- libavformat/oggparsedirac.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/oggparsedirac.c b/libavformat/oggparsedirac.c index a39ea4a..3e5e393 100644 --- a/libavformat/oggparsedirac.c +++ b/libavformat/oggparsedirac.c @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/imgutils.h" #include "libavutil/intreadwrite.h" #include "libavcodec/dirac.h" #include "avformat.h" @@ -51,6 +52,8 @@ static int dirac_header(AVFormatContext *s, int idx) st->codec->colorspace = dsh->colorspace; st->codec->profile = dsh->profile; st->codec->level = dsh->level; +if (av_image_check_sar(st->codec->width, st->codec->height, dsh->sample_aspect_ratio) >= 0) +st->sample_aspect_ratio = dsh->sample_aspect_ratio; // dirac in ogg always stores timestamps as though the video were interlaced avpriv_set_pts_info(st, 64, dsh->framerate.den, 2 * dsh->framerate.num); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] sonic: make sure num_taps * channels is not larger than frame_size
ffmpeg | branch: master | Andreas Cadhalpun | Tue Dec 15 23:43:03 2015 +0100| [9637c2531f7eb040ad1c3cb46cb40a63dfc77b80] | committer: Andreas Cadhalpun sonic: make sure num_taps * channels is not larger than frame_size If that is the case, the loop setting predictor_state in sonic_decode_frame causes out of bounds reads of int_samples, which has only frame_size number of elements. Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9637c2531f7eb040ad1c3cb46cb40a63dfc77b80 --- libavcodec/sonic.c |7 +++ 1 file changed, 7 insertions(+) diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c index 4ec7d89..2e3ca79 100644 --- a/libavcodec/sonic.c +++ b/libavcodec/sonic.c @@ -928,6 +928,13 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx) s->frame_size = s->channels*s->block_align*s->downsampling; //avctx->frame_size = s->block_align; +if (s->num_taps * s->channels > s->frame_size) { +av_log(avctx, AV_LOG_ERROR, + "number of taps times channels (%d * %d) larger than frame size %d\n", + s->num_taps, s->channels, s->frame_size); +return AVERROR_INVALIDDATA; +} + av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d.%d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n", s->version, s->minor_version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] aacenc: update max_sfb when num_swb changes
ffmpeg | branch: release/2.8 | Andreas Cadhalpun | Sun Dec 6 21:35:08 2015 +0100| [dcd837e41c83c6eac52d64b8d8f6a96aacf674cb] | committer: Andreas Cadhalpun aacenc: update max_sfb when num_swb changes This fixes out-of-bounds reads in avoid_clipping. Reviewed-by: Rostislav Pehlivanov Signed-off-by: Andreas Cadhalpun (cherry picked from commit 5b0da6999fdd0135b6f269d3691d74720f773c85) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dcd837e41c83c6eac52d64b8d8f6a96aacf674cb --- libavcodec/aacenc.c |1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 9cce1a2..a7c7336 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -547,6 +547,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, ics->num_windows= wi[ch].num_windows; ics->swb_sizes = s->psy.bands[ics->num_windows == 8]; ics->num_swb= tag == TYPE_LFE ? ics->num_swb : s->psy.num_bands[ics->num_windows == 8]; +ics->max_sfb= FFMIN(ics->max_sfb, ics->num_swb); ics->swb_offset = wi[ch].window_type[0] == EIGHT_SHORT_SEQUENCE ? ff_swb_offset_128 [s->samplerate_index]: ff_swb_offset_1024[s->samplerate_index]; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] golomb: always check for invalid UE golomb codes in get_ue_golomb
ffmpeg | branch: release/2.8 | Andreas Cadhalpun | Sun Dec 13 21:02:16 2015 +0100| [a79a5c32f92400fda48e2b6c5372a0d49ace4f7a] | committer: Andreas Cadhalpun golomb: always check for invalid UE golomb codes in get_ue_golomb Also correct the check to reject log < 7, because UPDATE_CACHE only guarantees 25 meaningful bits. This fixes undefined behavior: runtime error: shift exponent is negative Testing with START/STOP timers in get_ue_golomb, one for the first branch (A) and one for the second (B), shows that there is practically no slowdown, e.g. for the cavs decoder: With the check in the B branch: 629 decicycles in get_ue_golomb B, 4194260 runs, 44 skips 433 decicycles in get_ue_golomb A,268434102 runs, 1354 skips Without the check: 624 decicycles in get_ue_golomb B, 4194273 runs, 31 skips 433 decicycles in get_ue_golomb A,268434203 runs, 1253 skips Since the B branch is executed far less often than the A branch, this change is negligible, even more so for the h264 decoder, where the ratio B/A is a lot smaller. Fixes: mozilla bug 1230239 Fixes: fbeb8b2c7c996e9b91c6b1af319d7ebc/asan_heap-oob_195450f_2743_e8856ece4579ea486670be2b236099a0.bit Found-by: Tyson Smith Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun (cherry picked from commit 22e960ad478e568f4094971a58c6ad8f549c0180) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a79a5c32f92400fda48e2b6c5372a0d49ace4f7a --- libavcodec/golomb.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h index d30bb6b..5136a04 100644 --- a/libavcodec/golomb.h +++ b/libavcodec/golomb.h @@ -68,7 +68,7 @@ static inline int get_ue_golomb(GetBitContext *gb) int log = 2 * av_log2(buf) - 31; LAST_SKIP_BITS(re, gb, 32 - log); CLOSE_READER(re, gb); -if (CONFIG_FTRAPV && log < 0) { +if (log < 7) { av_log(NULL, AV_LOG_ERROR, "Invalid UE golomb code\n"); return AVERROR_INVALIDDATA; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] ffmdec: reject zero-sized chunks
ffmpeg | branch: release/2.8 | Andreas Cadhalpun | Wed Dec 2 22:47:12 2015 +0100| [76af12f5429b72820afd3b448cb38e9709993b03] | committer: Andreas Cadhalpun ffmdec: reject zero-sized chunks If size is zero, avio_get_str fails, leaving the buffer uninitialized. This causes invalid reads in av_set_options_string. Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun (cherry picked from commit a611375db532c3d5363d97b10fadd0211811a4fd) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=76af12f5429b72820afd3b448cb38e9709993b03 --- libavformat/ffmdec.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index b743c87..7fa66ba 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -415,7 +415,7 @@ static int ffm2_read_header(AVFormatContext *s) } break; case MKBETAG('S', '2', 'V', 'I'): -if (f_stvi++) { +if (f_stvi++ || !size) { ret = AVERROR(EINVAL); goto fail; } @@ -430,7 +430,7 @@ static int ffm2_read_header(AVFormatContext *s) goto fail; break; case MKBETAG('S', '2', 'A', 'U'): -if (f_stau++) { +if (f_stau++ || !size) { ret = AVERROR(EINVAL); goto fail; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] ffm: reject invalid codec_id and codec_type
ffmpeg | branch: release/2.8 | Andreas Cadhalpun | Mon Dec 14 22:11:55 2015 +0100| [0b24a0e0f12f0a57a54bfbbf9637855ef8b2f698] | committer: Andreas Cadhalpun ffm: reject invalid codec_id and codec_type A negative codec_id cannot be handled by the found_decoder API of AVStream->info: if the codec_id is not recognized, found_decoder is set to -codec_id, which has to be '<0' according to the API documentation. This can cause NULL pointer dereferencing in try_decode_frame. Also make sure the codec_type matches the expected one for codec_id. Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun (cherry picked from commit ecf63b7cc24b9fd3e6d604313325dd1ada4db662) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0b24a0e0f12f0a57a54bfbbf9637855ef8b2f698 --- libavformat/ffmdec.c | 28 1 file changed, 28 insertions(+) diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 7fa66ba..db9fb6b 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -268,6 +268,7 @@ static int ffm2_read_header(AVFormatContext *s) AVStream *st; AVIOContext *pb = s->pb; AVCodecContext *codec; +const AVCodecDescriptor *codec_desc; int ret; int f_main = 0, f_cprv = -1, f_stvi = -1, f_stau = -1; AVCodec *enc; @@ -322,7 +323,20 @@ static int ffm2_read_header(AVFormatContext *s) codec = st->codec; /* generic info */ codec->codec_id = avio_rb32(pb); +codec_desc = avcodec_descriptor_get(codec->codec_id); +if (!codec_desc) { +av_log(s, AV_LOG_ERROR, "Invalid codec id: %d\n", codec->codec_id); +codec->codec_id = AV_CODEC_ID_NONE; +goto fail; +} codec->codec_type = avio_r8(pb); +if (codec->codec_type != codec_desc->type) { +av_log(s, AV_LOG_ERROR, "Codec type mismatch: expected %d, found %d\n", + codec_desc->type, codec->codec_type); +codec->codec_id = AV_CODEC_ID_NONE; +codec->codec_type = AVMEDIA_TYPE_UNKNOWN; +goto fail; +} codec->bit_rate = avio_rb32(pb); codec->flags = avio_rb32(pb); codec->flags2 = avio_rb32(pb); @@ -471,6 +485,7 @@ static int ffm_read_header(AVFormatContext *s) AVStream *st; AVIOContext *pb = s->pb; AVCodecContext *codec; +const AVCodecDescriptor *codec_desc; int i, nb_streams; uint32_t tag; @@ -508,7 +523,20 @@ static int ffm_read_header(AVFormatContext *s) codec = st->codec; /* generic info */ codec->codec_id = avio_rb32(pb); +codec_desc = avcodec_descriptor_get(codec->codec_id); +if (!codec_desc) { +av_log(s, AV_LOG_ERROR, "Invalid codec id: %d\n", codec->codec_id); +codec->codec_id = AV_CODEC_ID_NONE; +goto fail; +} codec->codec_type = avio_r8(pb); /* codec_type */ +if (codec->codec_type != codec_desc->type) { +av_log(s, AV_LOG_ERROR, "Codec type mismatch: expected %d, found %d\n", + codec_desc->type, codec->codec_type); +codec->codec_id = AV_CODEC_ID_NONE; +codec->codec_type = AVMEDIA_TYPE_UNKNOWN; +goto fail; +} codec->bit_rate = avio_rb32(pb); codec->flags = avio_rb32(pb); codec->flags2 = avio_rb32(pb); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] opus_silk: fix typo causing overflow in silk_stabilize_lsf
ffmpeg | branch: release/2.8 | Andreas Cadhalpun | Tue Dec 15 22:00:31 2015 +0100| [796f1a24f59b55cebea779e8360a50f56f3f20fe] | committer: Andreas Cadhalpun opus_silk: fix typo causing overflow in silk_stabilize_lsf Due to this typo max_center can be too large, causing nlsf to be set to too large values, which in turn can cause nlsf[i - 1] + min_delta[i] to overflow to a negative value, which is not allowed for nlsf and can cause an out of bounds read in silk_lsf2lpc. Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun (cherry picked from commit f61d44b74aaae1d306d8a0d38b7b3d4292c89ced) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=796f1a24f59b55cebea779e8360a50f56f3f20fe --- libavcodec/opus_silk.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/opus_silk.c b/libavcodec/opus_silk.c index 841d1ed..73526f9 100644 --- a/libavcodec/opus_silk.c +++ b/libavcodec/opus_silk.c @@ -824,7 +824,7 @@ static inline void silk_stabilize_lsf(int16_t nlsf[16], int order, const uint16_ /* upper extent */ for (i = order; i > k; i--) -max_center -= min_delta[k]; +max_center -= min_delta[i]; max_center -= min_delta[k] >> 1; /* move apart */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] sbr_qmf_analysis: sanitize input for 32-bit imdct
ffmpeg | branch: release/2.8 | Andreas Cadhalpun | Wed Nov 18 13:43:01 2015 +0100| [b9087aa651674ce94853d824aedb1691d75bd9fd] | committer: Andreas Cadhalpun sbr_qmf_analysis: sanitize input for 32-bit imdct If the input contains too many too large values, the imdct can overflow. Even if it didn't, the output would be larger than the valid range of 29 bits. Note that this is a very delicate limit: Allowing values up to 1<<25 does not prevent input larger than 1<<29 from arriving at sbr_sum_square, while limiting values to 1<<23 breaks the fate-aac-fixed-al_sbr_hq_cm_48_5.1 test. Signed-off-by: Andreas Cadhalpun (cherry picked from commit fdc94db37e89165964fdf34f1cd7632e44108bd0) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b9087aa651674ce94853d824aedb1691d75bd9fd --- libavcodec/aacsbr_template.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c index 4f845ee..b36c266 100644 --- a/libavcodec/aacsbr_template.c +++ b/libavcodec/aacsbr_template.c @@ -1154,6 +1154,9 @@ static void sbr_qmf_analysis(AVFloatDSPContext *dsp, FFTContext *mdct, INTFLOAT z[320], INTFLOAT W[2][32][32][2], int buf_idx) { int i; +#if USE_FIXED +int j; +#endif memcpy(x, x+1024, (320-32)*sizeof(x[0])); memcpy(x+288, in, 1024*sizeof(x[0])); for (i = 0; i < 32; i++) { // numTimeSlots*RATE = 16*2 as 960 sample frames @@ -1161,6 +1164,21 @@ static void sbr_qmf_analysis(AVFloatDSPContext *dsp, FFTContext *mdct, dsp->vector_fmul_reverse(z, sbr_qmf_window_ds, x, 320); sbrdsp->sum64x5(z); sbrdsp->qmf_pre_shuffle(z); +#if USE_FIXED +for (j = 64; j < 128; j++) { +if (z[j] > 1<<24) { +av_log(NULL, AV_LOG_WARNING, + "sbr_qmf_analysis: value %09d too large, setting to %09d\n", + z[j], 1<<24); +z[j] = 1<<24; +} else if (z[j] < -(1<<24)) { +av_log(NULL, AV_LOG_WARNING, + "sbr_qmf_analysis: value %09d too small, setting to %09d\n", + z[j], -(1<<24)); +z[j] = -(1<<24); +} +} +#endif mdct->imdct_half(mdct, z, z+64); sbrdsp->qmf_post_shuffle(W[buf_idx][i], z); x += 32; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] aacsbr: ensure strictly monotone time borders
ffmpeg | branch: release/2.8 | Andreas Cadhalpun | Sun Nov 8 19:31:00 2015 +0100| [cb44683a8c5cb0effdf99cc1378e998e5c86d271] | committer: Andreas Cadhalpun aacsbr: ensure strictly monotone time borders This fixes a division by zero in the aac_fixed decoder. Signed-off-by: Andreas Cadhalpun (cherry picked from commit ff8816f7172b94028131ee2426ba35e875d973ae) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cb44683a8c5cb0effdf99cc1378e998e5c86d271 --- libavcodec/aacsbr_template.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c index a49940a..4f845ee 100644 --- a/libavcodec/aacsbr_template.c +++ b/libavcodec/aacsbr_template.c @@ -718,8 +718,8 @@ static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr, } for (i = 1; i <= ch_data->bs_num_env; i++) { -if (ch_data->t_env[i-1] > ch_data->t_env[i]) { -av_log(ac->avctx, AV_LOG_ERROR, "Non monotone time borders\n"); +if (ch_data->t_env[i-1] >= ch_data->t_env[i]) { +av_log(ac->avctx, AV_LOG_ERROR, "Not strictly monotone time borders\n"); return -1; } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] sonic: make sure num_taps * channels is not larger than frame_size
ffmpeg | branch: release/2.8 | Andreas Cadhalpun | Tue Dec 15 23:43:03 2015 +0100| [748d5fa2edfe93e6e584853883402f64a831c23f] | committer: Andreas Cadhalpun sonic: make sure num_taps * channels is not larger than frame_size If that is the case, the loop setting predictor_state in sonic_decode_frame causes out of bounds reads of int_samples, which has only frame_size number of elements. Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun (cherry picked from commit 9637c2531f7eb040ad1c3cb46cb40a63dfc77b80) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=748d5fa2edfe93e6e584853883402f64a831c23f --- libavcodec/sonic.c |7 +++ 1 file changed, 7 insertions(+) diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c index 4ec7d89..2e3ca79 100644 --- a/libavcodec/sonic.c +++ b/libavcodec/sonic.c @@ -928,6 +928,13 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx) s->frame_size = s->channels*s->block_align*s->downsampling; //avctx->frame_size = s->block_align; +if (s->num_taps * s->channels > s->frame_size) { +av_log(avctx, AV_LOG_ERROR, + "number of taps times channels (%d * %d) larger than frame size %d\n", + s->num_taps, s->channels, s->frame_size); +return AVERROR_INVALIDDATA; +} + av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d.%d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n", s->version, s->minor_version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] sbrdsp_fixed: assert that input values are in the valid range
ffmpeg | branch: release/2.8 | Andreas Cadhalpun | Tue Nov 17 22:58:27 2015 +0100| [7e94ea3dd1e5cbf56926c2b769738a0a51bd35bc] | committer: Andreas Cadhalpun sbrdsp_fixed: assert that input values are in the valid range Signed-off-by: Andreas Cadhalpun (cherry picked from commit a9c20e922cee435c9ad2dc78f6c50651f353329c) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e94ea3dd1e5cbf56926c2b769738a0a51bd35bc --- libavcodec/sbrdsp_fixed.c |5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/sbrdsp_fixed.c b/libavcodec/sbrdsp_fixed.c index 5b7b7a6..f4e3de0 100644 --- a/libavcodec/sbrdsp_fixed.c +++ b/libavcodec/sbrdsp_fixed.c @@ -38,9 +38,14 @@ static SoftFloat sbr_sum_square_c(int (*x)[2], int n) int i, nz, round; for (i = 0; i < n; i += 2) { +// Larger values are inavlid and could cause overflows of accu. +av_assert2(FFABS(x[i + 0][0]) >> 29 == 0); accu += (int64_t)x[i + 0][0] * x[i + 0][0]; +av_assert2(FFABS(x[i + 0][1]) >> 29 == 0); accu += (int64_t)x[i + 0][1] * x[i + 0][1]; +av_assert2(FFABS(x[i + 1][0]) >> 29 == 0); accu += (int64_t)x[i + 1][0] * x[i + 1][0]; +av_assert2(FFABS(x[i + 1][1]) >> 29 == 0); accu += (int64_t)x[i + 1][1] * x[i + 1][1]; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] aaccoder: prevent crash of anmr coder
ffmpeg | branch: release/2.8 | Andreas Cadhalpun | Fri Dec 4 18:13:07 2015 +0100| [507e0314c0d9107f6e17753950f9aceb6ed3b8d5] | committer: Andreas Cadhalpun aaccoder: prevent crash of anmr coder If minq is negative, the range of sf_idx can be larger than SCALE_MAX_DIFF allows, causing assertion failures later in encode_scale_factors. Reviewed-by: Claudio Freire Signed-off-by: Andreas Cadhalpun (cherry picked from commit 7a4652dd5da0502ff21c183b5ca7d76b1cfd6c51) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=507e0314c0d9107f6e17753950f9aceb6ed3b8d5 --- libavcodec/aaccoder.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index 86d598f..e6b57aa 100644 --- a/libavcodec/aaccoder.c +++ b/libavcodec/aaccoder.c @@ -499,7 +499,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, } while (idx) { sce->sf_idx[bandaddr[idx]] = minq + q0; -minq = paths[idx][minq].prev; +minq = FFMAX(paths[idx][minq].prev, 0); idx--; } //set the same quantizers inside window groups ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Revert "avcodec/aarch64/neon.S: Update neon.s for transpose_4x4H"
ffmpeg | branch: master | Michael Niedermayer | Thu Dec 17 21:14:45 2015 +0100| [95b59bfb9d9e47de8438183a035e02667946f27c] | committer: Michael Niedermayer Revert "avcodec/aarch64/neon.S: Update neon.s for transpose_4x4H" The change was not correct and broke H264 This reverts commit cd83f899c94f691b045697d12efa21f83eb2329f. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=95b59bfb9d9e47de8438183a035e02667946f27c --- libavcodec/aarch64/neon.S |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/aarch64/neon.S b/libavcodec/aarch64/neon.S index a227cbd..619aec6 100644 --- a/libavcodec/aarch64/neon.S +++ b/libavcodec/aarch64/neon.S @@ -107,8 +107,8 @@ .macro transpose_4x4H r0, r1, r2, r3, r4, r5, r6, r7 trn1\r4\().4H, \r0\().4H, \r1\().4H trn2\r5\().4H, \r0\().4H, \r1\().4H -trn1\r7\().4H, \r2\().4H, \r3\().4H -trn2\r6\().4H, \r2\().4H, \r3\().4H +trn1\r7\().4H, \r3\().4H, \r2\().4H +trn2\r6\().4H, \r3\().4H, \r2\().4H trn1\r0\().2S, \r4\().2S, \r7\().2S trn2\r3\().2S, \r4\().2S, \r7\().2S trn1\r1\().2S, \r5\().2S, \r6\().2S ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] sonic: make sure num_taps * channels is not larger than frame_size
ffmpeg | branch: release/2.7 | Andreas Cadhalpun | Tue Dec 15 23:43:03 2015 +0100| [34b9c7612d1a8c48590f54d38d042de7a3082d9a] | committer: Andreas Cadhalpun sonic: make sure num_taps * channels is not larger than frame_size If that is the case, the loop setting predictor_state in sonic_decode_frame causes out of bounds reads of int_samples, which has only frame_size number of elements. Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun (cherry picked from commit 9637c2531f7eb040ad1c3cb46cb40a63dfc77b80) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=34b9c7612d1a8c48590f54d38d042de7a3082d9a --- libavcodec/sonic.c |7 +++ 1 file changed, 7 insertions(+) diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c index c5076f9..ab947c4 100644 --- a/libavcodec/sonic.c +++ b/libavcodec/sonic.c @@ -925,6 +925,13 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx) s->frame_size = s->channels*s->block_align*s->downsampling; //avctx->frame_size = s->block_align; +if (s->num_taps * s->channels > s->frame_size) { +av_log(avctx, AV_LOG_ERROR, + "number of taps times channels (%d * %d) larger than frame size %d\n", + s->num_taps, s->channels, s->frame_size); +return AVERROR_INVALIDDATA; +} + av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d.%d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n", s->version, s->minor_version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] opus_silk: fix typo causing overflow in silk_stabilize_lsf
ffmpeg | branch: release/2.7 | Andreas Cadhalpun | Tue Dec 15 22:00:31 2015 +0100| [ea4b99f82cbe77b72d6f090b267e78acb1981a37] | committer: Andreas Cadhalpun opus_silk: fix typo causing overflow in silk_stabilize_lsf Due to this typo max_center can be too large, causing nlsf to be set to too large values, which in turn can cause nlsf[i - 1] + min_delta[i] to overflow to a negative value, which is not allowed for nlsf and can cause an out of bounds read in silk_lsf2lpc. Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun (cherry picked from commit f61d44b74aaae1d306d8a0d38b7b3d4292c89ced) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ea4b99f82cbe77b72d6f090b267e78acb1981a37 --- libavcodec/opus_silk.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/opus_silk.c b/libavcodec/opus_silk.c index 841d1ed..73526f9 100644 --- a/libavcodec/opus_silk.c +++ b/libavcodec/opus_silk.c @@ -824,7 +824,7 @@ static inline void silk_stabilize_lsf(int16_t nlsf[16], int order, const uint16_ /* upper extent */ for (i = order; i > k; i--) -max_center -= min_delta[k]; +max_center -= min_delta[i]; max_center -= min_delta[k] >> 1; /* move apart */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] aaccoder: prevent crash of anmr coder
ffmpeg | branch: release/2.7 | Andreas Cadhalpun | Fri Dec 4 18:13:07 2015 +0100| [c78d268e9fa84fefe4d25af57801c6468d02dac3] | committer: Andreas Cadhalpun aaccoder: prevent crash of anmr coder If minq is negative, the range of sf_idx can be larger than SCALE_MAX_DIFF allows, causing assertion failures later in encode_scale_factors. Reviewed-by: Claudio Freire Signed-off-by: Andreas Cadhalpun (cherry picked from commit 7a4652dd5da0502ff21c183b5ca7d76b1cfd6c51) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c78d268e9fa84fefe4d25af57801c6468d02dac3 --- libavcodec/aaccoder.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index 2929f3a..2ab67f6 100644 --- a/libavcodec/aaccoder.c +++ b/libavcodec/aaccoder.c @@ -728,7 +728,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, } while (idx) { sce->sf_idx[bandaddr[idx]] = minq + q0; -minq = paths[idx][minq].prev; +minq = FFMAX(paths[idx][minq].prev, 0); idx--; } //set the same quantizers inside window groups ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] ffm: reject invalid codec_id and codec_type
ffmpeg | branch: release/2.7 | Andreas Cadhalpun | Mon Dec 14 22:11:55 2015 +0100| [8b30abd0201a24f57f786a3225194d37de0afff5] | committer: Andreas Cadhalpun ffm: reject invalid codec_id and codec_type A negative codec_id cannot be handled by the found_decoder API of AVStream->info: if the codec_id is not recognized, found_decoder is set to -codec_id, which has to be '<0' according to the API documentation. This can cause NULL pointer dereferencing in try_decode_frame. Also make sure the codec_type matches the expected one for codec_id. Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun (cherry picked from commit ecf63b7cc24b9fd3e6d604313325dd1ada4db662) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b30abd0201a24f57f786a3225194d37de0afff5 --- libavformat/ffmdec.c | 28 1 file changed, 28 insertions(+) diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 0c5865c..1d1a9ae 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -267,6 +267,7 @@ static int ffm2_read_header(AVFormatContext *s) AVStream *st; AVIOContext *pb = s->pb; AVCodecContext *codec; +const AVCodecDescriptor *codec_desc; int ret; int f_main = 0, f_cprv = -1, f_stvi = -1, f_stau = -1; AVCodec *enc; @@ -321,7 +322,20 @@ static int ffm2_read_header(AVFormatContext *s) codec = st->codec; /* generic info */ codec->codec_id = avio_rb32(pb); +codec_desc = avcodec_descriptor_get(codec->codec_id); +if (!codec_desc) { +av_log(s, AV_LOG_ERROR, "Invalid codec id: %d\n", codec->codec_id); +codec->codec_id = AV_CODEC_ID_NONE; +goto fail; +} codec->codec_type = avio_r8(pb); +if (codec->codec_type != codec_desc->type) { +av_log(s, AV_LOG_ERROR, "Codec type mismatch: expected %d, found %d\n", + codec_desc->type, codec->codec_type); +codec->codec_id = AV_CODEC_ID_NONE; +codec->codec_type = AVMEDIA_TYPE_UNKNOWN; +goto fail; +} codec->bit_rate = avio_rb32(pb); codec->flags = avio_rb32(pb); codec->flags2 = avio_rb32(pb); @@ -470,6 +484,7 @@ static int ffm_read_header(AVFormatContext *s) AVStream *st; AVIOContext *pb = s->pb; AVCodecContext *codec; +const AVCodecDescriptor *codec_desc; int i, nb_streams; uint32_t tag; @@ -507,7 +522,20 @@ static int ffm_read_header(AVFormatContext *s) codec = st->codec; /* generic info */ codec->codec_id = avio_rb32(pb); +codec_desc = avcodec_descriptor_get(codec->codec_id); +if (!codec_desc) { +av_log(s, AV_LOG_ERROR, "Invalid codec id: %d\n", codec->codec_id); +codec->codec_id = AV_CODEC_ID_NONE; +goto fail; +} codec->codec_type = avio_r8(pb); /* codec_type */ +if (codec->codec_type != codec_desc->type) { +av_log(s, AV_LOG_ERROR, "Codec type mismatch: expected %d, found %d\n", + codec_desc->type, codec->codec_type); +codec->codec_id = AV_CODEC_ID_NONE; +codec->codec_type = AVMEDIA_TYPE_UNKNOWN; +goto fail; +} codec->bit_rate = avio_rb32(pb); codec->flags = avio_rb32(pb); codec->flags2 = avio_rb32(pb); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] ffmdec: reject zero-sized chunks
ffmpeg | branch: release/2.7 | Andreas Cadhalpun | Wed Dec 2 22:47:12 2015 +0100| [e56d32203289e579959f4097ad67d8305a952d7b] | committer: Andreas Cadhalpun ffmdec: reject zero-sized chunks If size is zero, avio_get_str fails, leaving the buffer uninitialized. This causes invalid reads in av_set_options_string. Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun (cherry picked from commit a611375db532c3d5363d97b10fadd0211811a4fd) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e56d32203289e579959f4097ad67d8305a952d7b --- libavformat/ffmdec.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 9b50c9f..0c5865c 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -414,7 +414,7 @@ static int ffm2_read_header(AVFormatContext *s) } break; case MKBETAG('S', '2', 'V', 'I'): -if (f_stvi++) { +if (f_stvi++ || !size) { ret = AVERROR(EINVAL); goto fail; } @@ -429,7 +429,7 @@ static int ffm2_read_header(AVFormatContext *s) goto fail; break; case MKBETAG('S', '2', 'A', 'U'): -if (f_stau++) { +if (f_stau++ || !size) { ret = AVERROR(EINVAL); goto fail; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] golomb: always check for invalid UE golomb codes in get_ue_golomb
ffmpeg | branch: release/2.7 | Andreas Cadhalpun | Sun Dec 13 21:02:16 2015 +0100| [435b0ab96977f92b34e84cc1ab316ce6448e987d] | committer: Andreas Cadhalpun golomb: always check for invalid UE golomb codes in get_ue_golomb Also correct the check to reject log < 7, because UPDATE_CACHE only guarantees 25 meaningful bits. This fixes undefined behavior: runtime error: shift exponent is negative Testing with START/STOP timers in get_ue_golomb, one for the first branch (A) and one for the second (B), shows that there is practically no slowdown, e.g. for the cavs decoder: With the check in the B branch: 629 decicycles in get_ue_golomb B, 4194260 runs, 44 skips 433 decicycles in get_ue_golomb A,268434102 runs, 1354 skips Without the check: 624 decicycles in get_ue_golomb B, 4194273 runs, 31 skips 433 decicycles in get_ue_golomb A,268434203 runs, 1253 skips Since the B branch is executed far less often than the A branch, this change is negligible, even more so for the h264 decoder, where the ratio B/A is a lot smaller. Fixes: mozilla bug 1230239 Fixes: fbeb8b2c7c996e9b91c6b1af319d7ebc/asan_heap-oob_195450f_2743_e8856ece4579ea486670be2b236099a0.bit Found-by: Tyson Smith Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun (cherry picked from commit 22e960ad478e568f4094971a58c6ad8f549c0180) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=435b0ab96977f92b34e84cc1ab316ce6448e987d --- libavcodec/golomb.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h index d30bb6b..5136a04 100644 --- a/libavcodec/golomb.h +++ b/libavcodec/golomb.h @@ -68,7 +68,7 @@ static inline int get_ue_golomb(GetBitContext *gb) int log = 2 * av_log2(buf) - 31; LAST_SKIP_BITS(re, gb, 32 - log); CLOSE_READER(re, gb); -if (CONFIG_FTRAPV && log < 0) { +if (log < 7) { av_log(NULL, AV_LOG_ERROR, "Invalid UE golomb code\n"); return AVERROR_INVALIDDATA; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
Re: [FFmpeg-cvslog] avformat/hlsenc: Check the return code of avformat_write_header()
On Sun, Dec 13, 2015 at 07:04:54AM -0500, Ganesh Ajjanagadde wrote: > On Sat, Dec 12, 2015 at 9:30 PM, Michael Niedermayer > wrote: > > ffmpeg | branch: release/2.8 | Michael Niedermayer > > | Sun Dec 13 02:28:13 2015 +0100| > > [d07f6582018d3388716340b08f1b1461c2f05bda] | committer: Michael Niedermayer > > > > avformat/hlsenc: Check the return code of avformat_write_header() > > > > Fixes: segfault > > Fixes: Ticket5067 > > > > Signed-off-by: Michael Niedermayer > > (cherry picked from commit c62d1780fff8a1997dd1707bbc557efc8fe41e3c) > > > > Signed-off-by: Michael Niedermayer > > > >> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d07f6582018d3388716340b08f1b1461c2f05bda > > --- > > > > libavformat/hlsenc.c |7 +-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > > index 6827b79..ebc5e11 100644 > > --- a/libavformat/hlsenc.c > > +++ b/libavformat/hlsenc.c > > @@ -548,8 +548,11 @@ static int hls_start(AVFormatContext *s) > > if (oc->oformat->priv_class && oc->priv_data) > > av_opt_set(oc->priv_data, "mpegts_flags", "resend_headers", 0); > > > > -if (c->vtt_basename) > > -avformat_write_header(vtt_oc,NULL); > > +if (c->vtt_basename) { > > +err = avformat_write_header(vtt_oc,NULL); > > +if (err < 0) > > +return err; > > +} > > > > return 0; > > } > > > > ___ > > ffmpeg-cvslog mailing list > > ffmpeg-cvslog@ffmpeg.org > > http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog > > any reason why we can't use av_warn_unused_result to help for the future here? it might be a good idea, i dont know [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 2 "100% positive feedback" - "All either got their money back or didnt complain" "Best seller ever, very honest" - "Seller refunded buyer after failed scam" signature.asc Description: Digital signature ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Revert "avcodec/aarch64/neon.S: Update neon.s for transpose_4x4H"
ffmpeg | branch: release/2.8 | Michael Niedermayer | Thu Dec 17 21:14:45 2015 +0100| [15371a6a60525e9c9c4f5e2534456f84b9d6] | committer: Michael Niedermayer Revert "avcodec/aarch64/neon.S: Update neon.s for transpose_4x4H" The change was not correct and broke H264 This reverts commit cd83f899c94f691b045697d12efa21f83eb2329f. (cherry picked from commit 95b59bfb9d9e47de8438183a035e02667946f27c) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=15371a6a60525e9c9c4f5e2534456f84b9d6 --- libavcodec/aarch64/neon.S |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/aarch64/neon.S b/libavcodec/aarch64/neon.S index a227cbd..619aec6 100644 --- a/libavcodec/aarch64/neon.S +++ b/libavcodec/aarch64/neon.S @@ -107,8 +107,8 @@ .macro transpose_4x4H r0, r1, r2, r3, r4, r5, r6, r7 trn1\r4\().4H, \r0\().4H, \r1\().4H trn2\r5\().4H, \r0\().4H, \r1\().4H -trn1\r7\().4H, \r2\().4H, \r3\().4H -trn2\r6\().4H, \r2\().4H, \r3\().4H +trn1\r7\().4H, \r3\().4H, \r2\().4H +trn2\r6\().4H, \r3\().4H, \r2\().4H trn1\r0\().2S, \r4\().2S, \r7\().2S trn2\r3\().2S, \r4\().2S, \r7\().2S trn1\r1\().2S, \r5\().2S, \r6\().2S ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/vf_mpdecimate: Add missing emms_c()
ffmpeg | branch: release/2.8 | Michael Niedermayer | Mon Dec 14 18:56:13 2015 +0100| [e4a6a8553ed800601298b0cca76ce1d674ec9fa5] | committer: Michael Niedermayer avfilter/vf_mpdecimate: Add missing emms_c() Signed-off-by: Michael Niedermayer (cherry picked from commit 997de2e8107cc4256e50611463d609b18fe9619f) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e4a6a8553ed800601298b0cca76ce1d674ec9fa5 --- libavfilter/vf_mpdecimate.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_mpdecimate.c b/libavfilter/vf_mpdecimate.c index 25efacf..20b15a2 100644 --- a/libavfilter/vf_mpdecimate.c +++ b/libavfilter/vf_mpdecimate.c @@ -131,10 +131,13 @@ static int decimate_frame(AVFilterContext *ctx, cur->data[plane], cur->linesize[plane], ref->data[plane], ref->linesize[plane], FF_CEIL_RSHIFT(ref->width, hsub), -FF_CEIL_RSHIFT(ref->height, vsub))) +FF_CEIL_RSHIFT(ref->height, vsub))) { +emms_c(); return 0; +} } +emms_c(); return 1; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] sonic: make sure num_taps * channels is not larger than frame_size
ffmpeg | branch: release/2.6 | Andreas Cadhalpun | Tue Dec 15 23:43:03 2015 +0100| [ff663ae464c17150f9a2cdb7a0e549e266d5bac6] | committer: Andreas Cadhalpun sonic: make sure num_taps * channels is not larger than frame_size If that is the case, the loop setting predictor_state in sonic_decode_frame causes out of bounds reads of int_samples, which has only frame_size number of elements. Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun (cherry picked from commit 9637c2531f7eb040ad1c3cb46cb40a63dfc77b80) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ff663ae464c17150f9a2cdb7a0e549e266d5bac6 --- libavcodec/sonic.c |7 +++ 1 file changed, 7 insertions(+) diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c index c5076f9..ab947c4 100644 --- a/libavcodec/sonic.c +++ b/libavcodec/sonic.c @@ -925,6 +925,13 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx) s->frame_size = s->channels*s->block_align*s->downsampling; //avctx->frame_size = s->block_align; +if (s->num_taps * s->channels > s->frame_size) { +av_log(avctx, AV_LOG_ERROR, + "number of taps times channels (%d * %d) larger than frame size %d\n", + s->num_taps, s->channels, s->frame_size); +return AVERROR_INVALIDDATA; +} + av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d.%d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n", s->version, s->minor_version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] aaccoder: prevent crash of anmr coder
ffmpeg | branch: release/2.6 | Andreas Cadhalpun | Fri Dec 4 18:13:07 2015 +0100| [4733060ef39466a443680e4f453e06d375844294] | committer: Andreas Cadhalpun aaccoder: prevent crash of anmr coder If minq is negative, the range of sf_idx can be larger than SCALE_MAX_DIFF allows, causing assertion failures later in encode_scale_factors. Reviewed-by: Claudio Freire Signed-off-by: Andreas Cadhalpun (cherry picked from commit 7a4652dd5da0502ff21c183b5ca7d76b1cfd6c51) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4733060ef39466a443680e4f453e06d375844294 --- libavcodec/aaccoder.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index 64eee32..c9a7253 100644 --- a/libavcodec/aaccoder.c +++ b/libavcodec/aaccoder.c @@ -691,7 +691,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, } while (idx) { sce->sf_idx[bandaddr[idx]] = minq + q0; -minq = paths[idx][minq].prev; +minq = FFMAX(paths[idx][minq].prev, 0); idx--; } //set the same quantizers inside window groups ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] ffmdec: reject zero-sized chunks
ffmpeg | branch: release/2.6 | Andreas Cadhalpun | Wed Dec 2 22:47:12 2015 +0100| [e1b38b36853b67428447c1ea483bd27db7534e15] | committer: Andreas Cadhalpun ffmdec: reject zero-sized chunks If size is zero, avio_get_str fails, leaving the buffer uninitialized. This causes invalid reads in av_set_options_string. Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun (cherry picked from commit a611375db532c3d5363d97b10fadd0211811a4fd) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e1b38b36853b67428447c1ea483bd27db7534e15 --- libavformat/ffmdec.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 57df43b..87cf546 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -414,7 +414,7 @@ static int ffm2_read_header(AVFormatContext *s) } break; case MKBETAG('S', '2', 'V', 'I'): -if (f_stvi++) { +if (f_stvi++ || !size) { ret = AVERROR(EINVAL); goto fail; } @@ -429,7 +429,7 @@ static int ffm2_read_header(AVFormatContext *s) goto fail; break; case MKBETAG('S', '2', 'A', 'U'): -if (f_stau++) { +if (f_stau++ || !size) { ret = AVERROR(EINVAL); goto fail; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/dirac_parser: Check that there is a previous PU before accessing it
ffmpeg | branch: release/2.6 | Michael Niedermayer | Sat Dec 5 17:15:38 2015 +0100| [7db1014b314abe4f5eaf9ae7f7de5d030b09a6a1] | committer: Andreas Cadhalpun avcodec/dirac_parser: Check that there is a previous PU before accessing it Fixes out of array read Fixes: 99d142c47e6ba3510a74b872a1a2ae72/asan_heap-oob_11b36f4_3811_0f5c69e7609a88a580135678de1df844.dxa Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit a08681f1e614152184615e2bcd71c3d63835f810) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7db1014b314abe4f5eaf9ae7f7de5d030b09a6a1 --- libavcodec/dirac_parser.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/dirac_parser.c b/libavcodec/dirac_parser.c index 83c35a2..61a978d 100644 --- a/libavcodec/dirac_parser.c +++ b/libavcodec/dirac_parser.c @@ -190,7 +190,7 @@ static int dirac_combine_frame(AVCodecParserContext *s, AVCodecContext *avctx, } /* Get the picture number to set the pts and dts*/ -if (parse_timing_info) { +if (parse_timing_info && pu1.prev_pu_offset >= 13) { uint8_t *cur_pu = pc->buffer + pc->index - 13 - pu1.prev_pu_offset; int pts = AV_RB32(cur_pu + 13); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] opus_silk: fix typo causing overflow in silk_stabilize_lsf
ffmpeg | branch: release/2.6 | Andreas Cadhalpun | Tue Dec 15 22:00:31 2015 +0100| [d8c70ebd2c538d5349aadc0808950820d2dc447c] | committer: Andreas Cadhalpun opus_silk: fix typo causing overflow in silk_stabilize_lsf Due to this typo max_center can be too large, causing nlsf to be set to too large values, which in turn can cause nlsf[i - 1] + min_delta[i] to overflow to a negative value, which is not allowed for nlsf and can cause an out of bounds read in silk_lsf2lpc. Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun (cherry picked from commit f61d44b74aaae1d306d8a0d38b7b3d4292c89ced) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d8c70ebd2c538d5349aadc0808950820d2dc447c --- libavcodec/opus_silk.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/opus_silk.c b/libavcodec/opus_silk.c index 841d1ed..73526f9 100644 --- a/libavcodec/opus_silk.c +++ b/libavcodec/opus_silk.c @@ -824,7 +824,7 @@ static inline void silk_stabilize_lsf(int16_t nlsf[16], int order, const uint16_ /* upper extent */ for (i = order; i > k; i--) -max_center -= min_delta[k]; +max_center -= min_delta[i]; max_center -= min_delta[k] >> 1; /* move apart */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] golomb: always check for invalid UE golomb codes in get_ue_golomb
ffmpeg | branch: release/2.6 | Andreas Cadhalpun | Sun Dec 13 21:02:16 2015 +0100| [1828abb7449a06c71a6f1199efc9b5e480502603] | committer: Andreas Cadhalpun golomb: always check for invalid UE golomb codes in get_ue_golomb Also correct the check to reject log < 7, because UPDATE_CACHE only guarantees 25 meaningful bits. This fixes undefined behavior: runtime error: shift exponent is negative Testing with START/STOP timers in get_ue_golomb, one for the first branch (A) and one for the second (B), shows that there is practically no slowdown, e.g. for the cavs decoder: With the check in the B branch: 629 decicycles in get_ue_golomb B, 4194260 runs, 44 skips 433 decicycles in get_ue_golomb A,268434102 runs, 1354 skips Without the check: 624 decicycles in get_ue_golomb B, 4194273 runs, 31 skips 433 decicycles in get_ue_golomb A,268434203 runs, 1253 skips Since the B branch is executed far less often than the A branch, this change is negligible, even more so for the h264 decoder, where the ratio B/A is a lot smaller. Fixes: mozilla bug 1230239 Fixes: fbeb8b2c7c996e9b91c6b1af319d7ebc/asan_heap-oob_195450f_2743_e8856ece4579ea486670be2b236099a0.bit Found-by: Tyson Smith Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun (cherry picked from commit 22e960ad478e568f4094971a58c6ad8f549c0180) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1828abb7449a06c71a6f1199efc9b5e480502603 --- libavcodec/golomb.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h index 8976bd8..86cd357 100644 --- a/libavcodec/golomb.h +++ b/libavcodec/golomb.h @@ -68,7 +68,7 @@ static inline int get_ue_golomb(GetBitContext *gb) int log = 2 * av_log2(buf) - 31; LAST_SKIP_BITS(re, gb, 32 - log); CLOSE_READER(re, gb); -if (CONFIG_FTRAPV && log < 0) { +if (log < 7) { av_log(NULL, AV_LOG_ERROR, "Invalid UE golomb code\n"); return AVERROR_INVALIDDATA; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/mpeg4videodec: Check available data before reading custom matrix
ffmpeg | branch: release/2.6 | Michael Niedermayer | Sun Nov 29 23:44:40 2015 +0100| [43bd666fb4d41a31a0a1817f1e3c5913dc135a5c] | committer: Andreas Cadhalpun avcodec/mpeg4videodec: Check available data before reading custom matrix Fixes: out of array read Fixes: 76c515fc3779d1b838667c61ea13ce92/asan_heap-oob_1fc0d07_8913_794a4629a264ebdb25b58d3a94ed1785.bit Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 891dc8f87536ac2ec695c70d081345224524ad99) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=43bd666fb4d41a31a0a1817f1e3c5913dc135a5c --- libavcodec/mpeg4videodec.c |8 1 file changed, 8 insertions(+) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 9974302..395559f 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -1874,6 +1874,10 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) int last = 0; for (i = 0; i < 64; i++) { int j; +if (get_bits_left(gb) < 8) { +av_log(s->avctx, AV_LOG_ERROR, "insufficient data for custom matrix\n"); +return AVERROR_INVALIDDATA; +} v = get_bits(gb, 8); if (v == 0) break; @@ -1897,6 +1901,10 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) int last = 0; for (i = 0; i < 64; i++) { int j; +if (get_bits_left(gb) < 8) { +av_log(s->avctx, AV_LOG_ERROR, "insufficient data for custom matrix\n"); +return AVERROR_INVALIDDATA; +} v = get_bits(gb, 8); if (v == 0) break; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] mjpegdec: consider chroma subsampling in size check
ffmpeg | branch: release/2.6 | Andreas Cadhalpun | Wed Dec 2 21:52:23 2015 +0100| [a90967013b1c2519cd7f7969ba29562cf37565c4] | committer: Andreas Cadhalpun mjpegdec: consider chroma subsampling in size check If the chroma components are subsampled, smaller buffers are allocated for them. In that case the maximal block_offset for the chroma components is not as large as for the luma component. This fixes out of bounds writes causing segmentation faults or memory corruption. Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun (cherry picked from commit 5adb5d9d894aa495e7bf9557b4c78350cbfc9d32) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a90967013b1c2519cd7f7969ba29562cf37565c4 --- libavcodec/mjpegdec.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 42767bc..8a190fc 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1219,7 +1219,7 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, int mb_bitmask_size, const AVFrame *reference) { -int i, mb_x, mb_y; +int i, mb_x, mb_y, chroma_h_shift, chroma_v_shift, chroma_width, chroma_height; uint8_t *data[MAX_COMPONENTS]; const uint8_t *reference_data[MAX_COMPONENTS]; int linesize[MAX_COMPONENTS]; @@ -1236,6 +1236,11 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, s->restart_count = 0; +av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, &chroma_h_shift, + &chroma_v_shift); +chroma_width = FF_CEIL_RSHIFT(s->width, chroma_h_shift); +chroma_height = FF_CEIL_RSHIFT(s->height, chroma_v_shift); + for (i = 0; i < nb_components; i++) { int c = s->comp_index[i]; data[c] = s->picture_ptr->data[c]; @@ -1272,8 +1277,8 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, if (s->interlaced && s->bottom_field) block_offset += linesize[c] >> 1; -if ( 8*(h * mb_x + x) < s->width -&& 8*(v * mb_y + y) < s->height) { +if ( 8*(h * mb_x + x) < ((c == 1) || (c == 2) ? chroma_width : s->width) +&& 8*(v * mb_y + y) < ((c == 1) || (c == 2) ? chroma_height : s->height)) { ptr = data[c] + block_offset; } else ptr = NULL; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] ffm: reject invalid codec_id and codec_type
ffmpeg | branch: release/2.6 | Andreas Cadhalpun | Mon Dec 14 22:11:55 2015 +0100| [f7b4e4625120867a277cec9647392700fafedfcc] | committer: Andreas Cadhalpun ffm: reject invalid codec_id and codec_type A negative codec_id cannot be handled by the found_decoder API of AVStream->info: if the codec_id is not recognized, found_decoder is set to -codec_id, which has to be '<0' according to the API documentation. This can cause NULL pointer dereferencing in try_decode_frame. Also make sure the codec_type matches the expected one for codec_id. Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun (cherry picked from commit ecf63b7cc24b9fd3e6d604313325dd1ada4db662) Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f7b4e4625120867a277cec9647392700fafedfcc --- libavformat/ffmdec.c | 28 1 file changed, 28 insertions(+) diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 87cf546..b1cc14a 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -267,6 +267,7 @@ static int ffm2_read_header(AVFormatContext *s) AVStream *st; AVIOContext *pb = s->pb; AVCodecContext *codec; +const AVCodecDescriptor *codec_desc; int ret; int f_main = 0, f_cprv = -1, f_stvi = -1, f_stau = -1; AVCodec *enc; @@ -321,7 +322,20 @@ static int ffm2_read_header(AVFormatContext *s) codec = st->codec; /* generic info */ codec->codec_id = avio_rb32(pb); +codec_desc = avcodec_descriptor_get(codec->codec_id); +if (!codec_desc) { +av_log(s, AV_LOG_ERROR, "Invalid codec id: %d\n", codec->codec_id); +codec->codec_id = AV_CODEC_ID_NONE; +goto fail; +} codec->codec_type = avio_r8(pb); +if (codec->codec_type != codec_desc->type) { +av_log(s, AV_LOG_ERROR, "Codec type mismatch: expected %d, found %d\n", + codec_desc->type, codec->codec_type); +codec->codec_id = AV_CODEC_ID_NONE; +codec->codec_type = AVMEDIA_TYPE_UNKNOWN; +goto fail; +} codec->bit_rate = avio_rb32(pb); codec->flags = avio_rb32(pb); codec->flags2 = avio_rb32(pb); @@ -469,6 +483,7 @@ static int ffm_read_header(AVFormatContext *s) AVStream *st; AVIOContext *pb = s->pb; AVCodecContext *codec; +const AVCodecDescriptor *codec_desc; int i, nb_streams; uint32_t tag; @@ -506,7 +521,20 @@ static int ffm_read_header(AVFormatContext *s) codec = st->codec; /* generic info */ codec->codec_id = avio_rb32(pb); +codec_desc = avcodec_descriptor_get(codec->codec_id); +if (!codec_desc) { +av_log(s, AV_LOG_ERROR, "Invalid codec id: %d\n", codec->codec_id); +codec->codec_id = AV_CODEC_ID_NONE; +goto fail; +} codec->codec_type = avio_r8(pb); /* codec_type */ +if (codec->codec_type != codec_desc->type) { +av_log(s, AV_LOG_ERROR, "Codec type mismatch: expected %d, found %d\n", + codec_desc->type, codec->codec_type); +codec->codec_id = AV_CODEC_ID_NONE; +codec->codec_type = AVMEDIA_TYPE_UNKNOWN; +goto fail; +} codec->bit_rate = avio_rb32(pb); codec->flags = avio_rb32(pb); codec->flags2 = avio_rb32(pb); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
Re: [FFmpeg-cvslog] avformat/hlsenc: Check the return code of avformat_write_header()
On Thu, Dec 17, 2015 at 12:54 PM, Michael Niedermayer wrote: > On Sun, Dec 13, 2015 at 07:04:54AM -0500, Ganesh Ajjanagadde wrote: >> On Sat, Dec 12, 2015 at 9:30 PM, Michael Niedermayer >> wrote: >> > ffmpeg | branch: release/2.8 | Michael Niedermayer >> > | Sun Dec 13 02:28:13 2015 +0100| >> > [d07f6582018d3388716340b08f1b1461c2f05bda] | committer: Michael Niedermayer >> > >> > avformat/hlsenc: Check the return code of avformat_write_header() >> > >> > Fixes: segfault >> > Fixes: Ticket5067 >> > >> > Signed-off-by: Michael Niedermayer >> > (cherry picked from commit c62d1780fff8a1997dd1707bbc557efc8fe41e3c) >> > >> > Signed-off-by: Michael Niedermayer >> > >> >> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d07f6582018d3388716340b08f1b1461c2f05bda >> > --- >> > >> > libavformat/hlsenc.c |7 +-- >> > 1 file changed, 5 insertions(+), 2 deletions(-) >> > >> > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c >> > index 6827b79..ebc5e11 100644 >> > --- a/libavformat/hlsenc.c >> > +++ b/libavformat/hlsenc.c >> > @@ -548,8 +548,11 @@ static int hls_start(AVFormatContext *s) >> > if (oc->oformat->priv_class && oc->priv_data) >> > av_opt_set(oc->priv_data, "mpegts_flags", "resend_headers", 0); >> > >> > -if (c->vtt_basename) >> > -avformat_write_header(vtt_oc,NULL); >> > +if (c->vtt_basename) { >> > +err = avformat_write_header(vtt_oc,NULL); >> > +if (err < 0) >> > +return err; >> > +} >> > >> > return 0; >> > } >> > >> > ___ >> > ffmpeg-cvslog mailing list >> > ffmpeg-cvslog@ffmpeg.org >> > http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog >> >> any reason why we can't use av_warn_unused_result to help for the future >> here? > > it might be a good idea, i dont know Should be a good idea IMHO, patch posted. > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > The real ebay dictionary, page 2 > "100% positive feedback" - "All either got their money back or didnt complain" > "Best seller ever, very honest" - "Seller refunded buyer after failed scam" > > ___ > ffmpeg-cvslog mailing list > ffmpeg-cvslog@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog > ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/opus_celt: replace pow by exp2
ffmpeg | branch: master | Ganesh Ajjanagadde | Wed Dec 9 18:23:00 2015 -0500| [97d2c2d678f6aa4ba5178a5bd16094e73e118ff6] | committer: Ganesh Ajjanagadde lavc/opus_celt: replace pow by exp2 exp2 is faster. It may be possible to optimize further; e.g the exponents seem to be multiples of 0.25. This requires study though. Reviewed-by: Paul B Mahol Signed-off-by: Ganesh Ajjanagadde > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=97d2c2d678f6aa4ba5178a5bd16094e73e118ff6 --- libavcodec/opus_celt.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/opus_celt.c b/libavcodec/opus_celt.c index 9911de3..474452f 100644 --- a/libavcodec/opus_celt.c +++ b/libavcodec/opus_celt.c @@ -1677,7 +1677,7 @@ static void celt_denormalize(CeltContext *s, CeltFrame *frame, float *data) for (i = s->startband; i < s->endband; i++) { float *dst = data + (celt_freq_bands[i] << s->duration); -float norm = pow(2, frame->energy[i] + celt_mean_energy[i]); +float norm = exp2(frame->energy[i] + celt_mean_energy[i]); for (j = 0; j < celt_freq_range[i] << s->duration; j++) dst[j] *= norm; @@ -1857,7 +1857,7 @@ static void process_anticollapse(CeltContext *s, CeltFrame *frame, float *X) /* r needs to be multiplied by 2 or 2*sqrt(2) depending on LM because short blocks don't have the same energy as long */ -r = pow(2, 1 - Ediff); +r = exp2(1 - Ediff); if (s->duration == 3) r *= M_SQRT2; r = FFMIN(thresh, r) * sqrt_1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/h264_slice: Simplify ref2frm indexing
ffmpeg | branch: master | Michael Niedermayer | Thu Dec 17 22:51:00 2015 +0100| [ef8f6464a55db730cab8c48a1a51fa4e6ca12107] | committer: Michael Niedermayer avcodec/h264_slice: Simplify ref2frm indexing This also suppresses a ubsan warning Fixes Mozilla bug 1230247 Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ef8f6464a55db730cab8c48a1a51fa4e6ca12107 --- libavcodec/h264_slice.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index c63e6d6..2db7ca2 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1976,12 +1976,12 @@ static av_always_inline void fill_filter_caches_inter(const H264Context *h, if (USES_LIST(top_type, list)) { const int b_xy = h->mb2b_xy[top_xy] + 3 * b_stride; const int b8_xy = 4 * top_xy + 2; -int (*ref2frm)[64] = (void*)(sl->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2)); +int *ref2frm = sl->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 1)][list] + (MB_MBAFF(sl) ? 20 : 2); AV_COPY128(mv_dst - 1 * 8, h->cur_pic.motion_val[list][b_xy + 0]); ref_cache[0 - 1 * 8] = -ref_cache[1 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 0]]; +ref_cache[1 - 1 * 8] = ref2frm[h->cur_pic.ref_index[list][b8_xy + 0]]; ref_cache[2 - 1 * 8] = -ref_cache[3 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 1]]; +ref_cache[3 - 1 * 8] = ref2frm[h->cur_pic.ref_index[list][b8_xy + 1]]; } else { AV_ZERO128(mv_dst - 1 * 8); AV_WN32A(&ref_cache[0 - 1 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u); @@ -1991,15 +1991,15 @@ static av_always_inline void fill_filter_caches_inter(const H264Context *h, if (USES_LIST(left_type[LTOP], list)) { const int b_xy = h->mb2b_xy[left_xy[LTOP]] + 3; const int b8_xy = 4 * left_xy[LTOP] + 1; -int (*ref2frm)[64] =(void*)( sl->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2)); +int *ref2frm = sl->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][list] + (MB_MBAFF(sl) ? 20 : 2); AV_COPY32(mv_dst - 1 + 0, h->cur_pic.motion_val[list][b_xy + b_stride * 0]); AV_COPY32(mv_dst - 1 + 8, h->cur_pic.motion_val[list][b_xy + b_stride * 1]); AV_COPY32(mv_dst - 1 + 16, h->cur_pic.motion_val[list][b_xy + b_stride * 2]); AV_COPY32(mv_dst - 1 + 24, h->cur_pic.motion_val[list][b_xy + b_stride * 3]); ref_cache[-1 + 0] = -ref_cache[-1 + 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 0]]; +ref_cache[-1 + 8] = ref2frm[h->cur_pic.ref_index[list][b8_xy + 2 * 0]]; ref_cache[-1 + 16] = -ref_cache[-1 + 24] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 1]]; +ref_cache[-1 + 24] = ref2frm[h->cur_pic.ref_index[list][b8_xy + 2 * 1]]; } else { AV_ZERO32(mv_dst - 1 + 0); AV_ZERO32(mv_dst - 1 + 8); @@ -2024,9 +2024,9 @@ static av_always_inline void fill_filter_caches_inter(const H264Context *h, { int8_t *ref = &h->cur_pic.ref_index[list][4 * mb_xy]; -int (*ref2frm)[64] = (void*)(sl->ref2frm[sl->slice_num & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2)); -uint32_t ref01 = (pack16to32(ref2frm[list][ref[0]], ref2frm[list][ref[1]]) & 0x00FF00FF) * 0x0101; -uint32_t ref23 = (pack16to32(ref2frm[list][ref[2]], ref2frm[list][ref[3]]) & 0x00FF00FF) * 0x0101; +int *ref2frm = sl->ref2frm[sl->slice_num & (MAX_SLICES - 1)][list] + (MB_MBAFF(sl) ? 20 : 2); +uint32_t ref01 = (pack16to32(ref2frm[ref[0]], ref2frm[ref[1]]) & 0x00FF00FF) * 0x0101; +uint32_t ref23 = (pack16to32(ref2frm[ref[2]], ref2frm[ref[3]]) & 0x00FF00FF) * 0x0101; AV_WN32A(&ref_cache[0 * 8], ref01); AV_WN32A(&ref_cache[1 * 8], ref01); AV_WN32A(&ref_cache[2 * 8], ref23); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/h264_mc_template: prefetch list1 only if it is used in the MB
ffmpeg | branch: master | Michael Niedermayer | Fri Dec 18 00:20:51 2015 +0100| [c8ea57664fe3ad611c9ecd234670544ddff7ca55] | committer: Michael Niedermayer avcodec/h264_mc_template: prefetch list1 only if it is used in the MB Fixes ubsan warning Fixes Mozilla bug 1230276 Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c8ea57664fe3ad611c9ecd234670544ddff7ca55 --- libavcodec/h264_mc_template.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/h264_mc_template.c b/libavcodec/h264_mc_template.c index eaead35..e4333a7 100644 --- a/libavcodec/h264_mc_template.c +++ b/libavcodec/h264_mc_template.c @@ -158,6 +158,7 @@ static void MCFUNC(hl_motion)(const H264Context *h, H264SliceContext *sl, } } -prefetch_motion(h, sl, 1, PIXEL_SHIFT, CHROMA_IDC); +if (USES_LIST(mb_type, 1)) +prefetch_motion(h, sl, 1, PIXEL_SHIFT, CHROMA_IDC); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/h264_mc_template: prefetch list1 only if it is used in the MB
ffmpeg | branch: release/2.8 | Michael Niedermayer | Fri Dec 18 00:20:51 2015 +0100| [cabd9ae5be8797bbafb8db15be5edd266d9efd7a] | committer: Michael Niedermayer avcodec/h264_mc_template: prefetch list1 only if it is used in the MB Fixes ubsan warning Fixes Mozilla bug 1230276 Signed-off-by: Michael Niedermayer (cherry picked from commit c8ea57664fe3ad611c9ecd234670544ddff7ca55) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cabd9ae5be8797bbafb8db15be5edd266d9efd7a --- libavcodec/h264_mc_template.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/h264_mc_template.c b/libavcodec/h264_mc_template.c index eaead35..e4333a7 100644 --- a/libavcodec/h264_mc_template.c +++ b/libavcodec/h264_mc_template.c @@ -158,6 +158,7 @@ static void MCFUNC(hl_motion)(const H264Context *h, H264SliceContext *sl, } } -prefetch_motion(h, sl, 1, PIXEL_SHIFT, CHROMA_IDC); +if (USES_LIST(mb_type, 1)) +prefetch_motion(h, sl, 1, PIXEL_SHIFT, CHROMA_IDC); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/h264_slice: Simplify ref2frm indexing
ffmpeg | branch: release/2.8 | Michael Niedermayer | Thu Dec 17 22:51:00 2015 +0100| [cfbf608c0af6e45254e7d66903a31daf5452c2de] | committer: Michael Niedermayer avcodec/h264_slice: Simplify ref2frm indexing This also suppresses a ubsan warning Fixes Mozilla bug 1230247 Signed-off-by: Michael Niedermayer (cherry picked from commit ef8f6464a55db730cab8c48a1a51fa4e6ca12107) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cfbf608c0af6e45254e7d66903a31daf5452c2de --- libavcodec/h264_slice.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 843cfd0..8be803b 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1993,12 +1993,12 @@ static av_always_inline void fill_filter_caches_inter(const H264Context *h, if (USES_LIST(top_type, list)) { const int b_xy = h->mb2b_xy[top_xy] + 3 * b_stride; const int b8_xy = 4 * top_xy + 2; -int (*ref2frm)[64] = (void*)(sl->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2)); +int *ref2frm = sl->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 1)][list] + (MB_MBAFF(sl) ? 20 : 2); AV_COPY128(mv_dst - 1 * 8, h->cur_pic.motion_val[list][b_xy + 0]); ref_cache[0 - 1 * 8] = -ref_cache[1 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 0]]; +ref_cache[1 - 1 * 8] = ref2frm[h->cur_pic.ref_index[list][b8_xy + 0]]; ref_cache[2 - 1 * 8] = -ref_cache[3 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 1]]; +ref_cache[3 - 1 * 8] = ref2frm[h->cur_pic.ref_index[list][b8_xy + 1]]; } else { AV_ZERO128(mv_dst - 1 * 8); AV_WN32A(&ref_cache[0 - 1 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u); @@ -2008,15 +2008,15 @@ static av_always_inline void fill_filter_caches_inter(const H264Context *h, if (USES_LIST(left_type[LTOP], list)) { const int b_xy = h->mb2b_xy[left_xy[LTOP]] + 3; const int b8_xy = 4 * left_xy[LTOP] + 1; -int (*ref2frm)[64] =(void*)( sl->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2)); +int *ref2frm = sl->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][list] + (MB_MBAFF(sl) ? 20 : 2); AV_COPY32(mv_dst - 1 + 0, h->cur_pic.motion_val[list][b_xy + b_stride * 0]); AV_COPY32(mv_dst - 1 + 8, h->cur_pic.motion_val[list][b_xy + b_stride * 1]); AV_COPY32(mv_dst - 1 + 16, h->cur_pic.motion_val[list][b_xy + b_stride * 2]); AV_COPY32(mv_dst - 1 + 24, h->cur_pic.motion_val[list][b_xy + b_stride * 3]); ref_cache[-1 + 0] = -ref_cache[-1 + 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 0]]; +ref_cache[-1 + 8] = ref2frm[h->cur_pic.ref_index[list][b8_xy + 2 * 0]]; ref_cache[-1 + 16] = -ref_cache[-1 + 24] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 1]]; +ref_cache[-1 + 24] = ref2frm[h->cur_pic.ref_index[list][b8_xy + 2 * 1]]; } else { AV_ZERO32(mv_dst - 1 + 0); AV_ZERO32(mv_dst - 1 + 8); @@ -2041,9 +2041,9 @@ static av_always_inline void fill_filter_caches_inter(const H264Context *h, { int8_t *ref = &h->cur_pic.ref_index[list][4 * mb_xy]; -int (*ref2frm)[64] = (void*)(sl->ref2frm[sl->slice_num & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2)); -uint32_t ref01 = (pack16to32(ref2frm[list][ref[0]], ref2frm[list][ref[1]]) & 0x00FF00FF) * 0x0101; -uint32_t ref23 = (pack16to32(ref2frm[list][ref[2]], ref2frm[list][ref[3]]) & 0x00FF00FF) * 0x0101; +int *ref2frm = sl->ref2frm[sl->slice_num & (MAX_SLICES - 1)][list] + (MB_MBAFF(sl) ? 20 : 2); +uint32_t ref01 = (pack16to32(ref2frm[ref[0]], ref2frm[ref[1]]) & 0x00FF00FF) * 0x0101; +uint32_t ref23 = (pack16to32(ref2frm[ref[2]], ref2frm[ref[3]]) & 0x00FF00FF) * 0x0101; AV_WN32A(&ref_cache[0 * 8], ref01); AV_WN32A(&ref_cache[1 * 8], ref01); AV_WN32A(&ref_cache[2 * 8], ref23); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavu/error: add missing error messages for errors supported on all platforms
ffmpeg | branch: master | Marton Balint | Wed Dec 9 21:45:01 2015 +0100| [752ab408b456af87b66d9dec7c3bb5ad3d564379] | committer: Marton Balint lavu/error: add missing error messages for errors supported on all platforms We need these if we have no strerror_r. Descriptions are taken from doc/errno.txt except for ENOMEM. Signed-off-by: Marton Balint > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=752ab408b456af87b66d9dec7c3bb5ad3d564379 --- libavutil/error.c | 37 + 1 file changed, 37 insertions(+) diff --git a/libavutil/error.c b/libavutil/error.c index 4425968..8df73db 100644 --- a/libavutil/error.c +++ b/libavutil/error.c @@ -61,7 +61,44 @@ static const struct error_entry error_entries[] = { { ERROR_TAG(HTTP_OTHER_4XX), "Server returned 4XX Client Error, but not one of 40{0,1,3,4}" }, { ERROR_TAG(HTTP_SERVER_ERROR), "Server returned 5XX Server Error reply" }, #if !HAVE_STRERROR_R +{ EERROR_TAG(E2BIG), "Argument list too long" }, +{ EERROR_TAG(EACCES),"Permission denied" }, +{ EERROR_TAG(EAGAIN),"Resource temporarily unavailable" }, +{ EERROR_TAG(EBADF), "Bad file descriptor" }, +{ EERROR_TAG(EBUSY), "Device or resource busy" }, +{ EERROR_TAG(ECHILD),"No child processes" }, +{ EERROR_TAG(EDEADLK), "Resource deadlock avoided" }, +{ EERROR_TAG(EDOM), "Numerical argument out of domain" }, +{ EERROR_TAG(EEXIST),"File exists" }, +{ EERROR_TAG(EFAULT),"Bad address" }, +{ EERROR_TAG(EFBIG), "File too large" }, +{ EERROR_TAG(EILSEQ),"Illegal byte sequence" }, +{ EERROR_TAG(EINTR), "Interrupted system call" }, { EERROR_TAG(EINVAL),"Invalid argument" }, +{ EERROR_TAG(EIO), "I/O error" }, +{ EERROR_TAG(EISDIR),"Is a directory" }, +{ EERROR_TAG(EMFILE),"Too many open files" }, +{ EERROR_TAG(EMLINK),"Too many links" }, +{ EERROR_TAG(ENAMETOOLONG), "File name too long" }, +{ EERROR_TAG(ENFILE),"Too many open files in system" }, +{ EERROR_TAG(ENODEV),"No such device" }, +{ EERROR_TAG(ENOENT),"No such file or directory" }, +{ EERROR_TAG(ENOEXEC), "Exec format error" }, +{ EERROR_TAG(ENOLCK),"No locks available" }, +{ EERROR_TAG(ENOMEM),"Cannot allocate memory" }, +{ EERROR_TAG(ENOSPC),"No space left on device" }, +{ EERROR_TAG(ENOSYS),"Function not implemented" }, +{ EERROR_TAG(ENOTDIR), "Not a directory" }, +{ EERROR_TAG(ENOTEMPTY), "Directory not empty" }, +{ EERROR_TAG(ENOTTY),"Inappropriate I/O control operation" }, +{ EERROR_TAG(ENXIO), "No such device or address" }, +{ EERROR_TAG(EPERM), "Operation not permitted" }, +{ EERROR_TAG(EPIPE), "Broken pipe" }, +{ EERROR_TAG(ERANGE),"Result too large" }, +{ EERROR_TAG(EROFS), "Read-only file system" }, +{ EERROR_TAG(ESPIPE),"Illegal seek" }, +{ EERROR_TAG(ESRCH), "No such process" }, +{ EERROR_TAG(EXDEV), "Cross-device link" }, #endif }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] doc/errno: fix description typo for ENAMETOOLONG
ffmpeg | branch: master | Marton Balint | Wed Dec 9 21:45:54 2015 +0100| [b25adbaaf67f5882b6f75e3b9b35122777161fd2] | committer: Marton Balint doc/errno: fix description typo for ENAMETOOLONG Signed-off-by: Marton Balint > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b25adbaaf67f5882b6f75e3b9b35122777161fd2 --- doc/errno.txt |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/errno.txt b/doc/errno.txt index 31cab26..933a4de 100644 --- a/doc/errno.txt +++ b/doc/errno.txt @@ -76,7 +76,7 @@ EMFILE POSIX ++ Too many open files EMLINK POSIX ++ Too many links EMSGSIZE POSIX +++..+ Message too long EMULTIHOPPOSIX ++4... Multihop attempted -ENAMETOOLONG POSIX - ++ Filen ame too long +ENAMETOOLONG POSIX - ++ File name too long ENAVAIL+. No XENIX semaphores available ENEEDAUTH .++... Need authenticator ENETDOWN POSIX +++..+ Network is down ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog