[FFmpeg-cvslog] avcodec/scpr: use correct linesize for prev frame
ffmpeg | branch: master | Paul B Mahol | Sun Mar 12 12:34:55 2017 +0100| [807d5dcde9d83dca48f8dfc5c98bbc2be6fdc61c] | committer: Paul B Mahol avcodec/scpr: use correct linesize for prev frame Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=807d5dcde9d83dca48f8dfc5c98bbc2be6fdc61c --- libavcodec/scpr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/scpr.c b/libavcodec/scpr.c index 1fc0593..465926a 100644 --- a/libavcodec/scpr.c +++ b/libavcodec/scpr.c @@ -656,7 +656,7 @@ static int decompress_p(AVCodecContext *avctx, if (by >= avctx->height) return AVERROR_INVALIDDATA; -clr = prev[by * linesize + bx]; +clr = prev[by * plinesize + bx]; dst[by * linesize + bx] = clr; bx++; if (bx >= x * 16 + sx2 || bx >= avctx->width) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avconv: stop using setpts for input framerate forced with -r
ffmpeg | branch: master | Anton Khirnov | Fri Jul 15 06:50:47 2016 +0200| [b0f36a0043d76436cc7ab8ff92ab99c94595d3c0] | committer: Anton Khirnov avconv: stop using setpts for input framerate forced with -r The setpts filter does not signal to the rest of the filtergraph that the stream is CFR. Just generate the timestamps manually instead. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b0f36a0043d76436cc7ab8ff92ab99c94595d3c0 --- avconv.c| 2 ++ avconv.h| 5 + avconv_filter.c | 19 ++- configure | 2 +- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/avconv.c b/avconv.c index 3a7a898..57c02ac 100644 --- a/avconv.c +++ b/avconv.c @@ -1392,6 +1392,8 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output) decoded_frame->pts = guess_correct_pts(&ist->pts_ctx, decoded_frame->pts, decoded_frame->pkt_dts); +if (ist->framerate.num) +decoded_frame->pts = ist->cfr_next_pts++; if (ist->st->sample_aspect_ratio.num) decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio; diff --git a/avconv.h b/avconv.h index cffe114..fcdf3d0 100644 --- a/avconv.h +++ b/avconv.h @@ -269,6 +269,11 @@ typedef struct InputStream { int64_t last_dts; int64_t min_pts; /* pts with the smallest value in a current stream */ int64_t max_pts; /* pts with the higher value in a current stream */ + +// when forcing constant input framerate through -r, +// this contains the pts that will be given to the next decoded frame +int64_t cfr_next_pts; + int64_t nb_samples; /* number of samples in the last decoded audio frame before looping */ PtsCorrectionContext pts_ctx; double ts_scale; diff --git a/avconv_filter.c b/avconv_filter.c index 96277f8..b78d3bd 100644 --- a/avconv_filter.c +++ b/avconv_filter.c @@ -519,6 +519,8 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, par->height = ifilter->height; par->format = ifilter->format; par->time_base = tb; +if (ist->framerate.num) +par->frame_rate = ist->framerate; par->hw_frames_ctx = ifilter->hw_frames_ctx; ret = av_buffersrc_parameters_set(ifilter->filter, par); @@ -552,23 +554,6 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, } } -if (ist->framerate.num) { -AVFilterContext *setpts; - -snprintf(name, sizeof(name), "force CFR for input from stream %d:%d", - ist->file_index, ist->st->index); -if ((ret = avfilter_graph_create_filter(&setpts, -avfilter_get_by_name("setpts"), -name, "N", NULL, -fg->graph)) < 0) -return ret; - -if ((ret = avfilter_link(last_filter, 0, setpts, 0)) < 0) -return ret; - -last_filter = setpts; -} - snprintf(name, sizeof(name), "trim for input stream %d:%d", ist->file_index, ist->st->index); ret = insert_trim(((f->start_time == AV_NOPTS_VALUE) || !f->accurate_seek) ? diff --git a/configure b/configure index 37c5611..5885519 100755 --- a/configure +++ b/configure @@ -2436,7 +2436,7 @@ swscale_deps="avutil" avconv_deps="avcodec avfilter avformat avresample swscale" avconv_select="aformat_filter anull_filter asyncts_filter atrim_filter format_filter fps_filter null_filter resample_filter scale_filter - setpts_filter trim_filter" + trim_filter" avplay_deps="avcodec avfilter avformat avresample sdl" avplay_libs='$sdl_libs' avplay_select="rdft format_filter transpose_filter hflip_filter vflip_filter" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '6f40181cad8ac04adff7bd10e1e1ab65f22bc1f0'
ffmpeg | branch: master | Clément Bœsch | Sun Mar 12 13:13:05 2017 +0100| [e514309a916e295c5b49c6c83e93ffc15a12317d] | committer: Clément Bœsch Merge commit '6f40181cad8ac04adff7bd10e1e1ab65f22bc1f0' * commit '6f40181cad8ac04adff7bd10e1e1ab65f22bc1f0': avconv_qsv: align the surface size to 32 This commit is a noop, see 03cef34aa66 Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e514309a916e295c5b49c6c83e93ffc15a12317d --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avconv_qsv: align the surface size to 32
ffmpeg | branch: master | Anton Khirnov | Wed Jul 13 09:15:56 2016 +0200| [6f40181cad8ac04adff7bd10e1e1ab65f22bc1f0] | committer: Anton Khirnov avconv_qsv: align the surface size to 32 This is required e.g. by HEVC. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6f40181cad8ac04adff7bd10e1e1ab65f22bc1f0 --- avconv_qsv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/avconv_qsv.c b/avconv_qsv.c index 8272f17..400cf22 100644 --- a/avconv_qsv.c +++ b/avconv_qsv.c @@ -76,8 +76,8 @@ int qsv_init(AVCodecContext *s) frames_ctx = (AVHWFramesContext*)ist->hw_frames_ctx->data; frames_hwctx = frames_ctx->hwctx; -frames_ctx->width = s->coded_width; -frames_ctx->height= s->coded_height; +frames_ctx->width = FFALIGN(s->coded_width, 32); +frames_ctx->height= FFALIGN(s->coded_height, 32); frames_ctx->format= AV_PIX_FMT_QSV; frames_ctx->sw_format = AV_PIX_FMT_NV12; frames_ctx->initial_pool_size = 32; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avconv_qsv: use the actual pixel format provided by lavc
ffmpeg | branch: master | Anton Khirnov | Wed Jul 13 09:16:35 2016 +0200| [8b7a9729aa162e2bbd571933f1aa40767f1ff47b] | committer: Anton Khirnov avconv_qsv: use the actual pixel format provided by lavc Do not hardcode NV12. This allows 10bit decoding with -hwaccel qsv. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b7a9729aa162e2bbd571933f1aa40767f1ff47b --- avconv_qsv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/avconv_qsv.c b/avconv_qsv.c index 400cf22..723c6e0 100644 --- a/avconv_qsv.c +++ b/avconv_qsv.c @@ -79,7 +79,7 @@ int qsv_init(AVCodecContext *s) frames_ctx->width = FFALIGN(s->coded_width, 32); frames_ctx->height= FFALIGN(s->coded_height, 32); frames_ctx->format= AV_PIX_FMT_QSV; -frames_ctx->sw_format = AV_PIX_FMT_NV12; +frames_ctx->sw_format = s->sw_pix_fmt; frames_ctx->initial_pool_size = 32; frames_hwctx->frame_type = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '8b7a9729aa162e2bbd571933f1aa40767f1ff47b'
ffmpeg | branch: master | Clément Bœsch | Sun Mar 12 13:13:55 2017 +0100| [15f6e5f2a9568226a853880ab5f0d8e6e7d77544] | committer: Clément Bœsch Merge commit '8b7a9729aa162e2bbd571933f1aa40767f1ff47b' * commit '8b7a9729aa162e2bbd571933f1aa40767f1ff47b': avconv_qsv: use the actual pixel format provided by lavc This commit is a noop, see 03cef34aa66 Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=15f6e5f2a9568226a853880ab5f0d8e6e7d77544 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'f65285aba0df7d46298abe0c945dfee05cbc6028'
ffmpeg | branch: master | Clément Bœsch | Sun Mar 12 13:21:01 2017 +0100| [5e193daaa28d2fca34ad21d11d58f0b135388246] | committer: Clément Bœsch Merge commit 'f65285aba0df7d46298abe0c945dfee05cbc6028' * commit 'f65285aba0df7d46298abe0c945dfee05cbc6028': lavc: set sw_pix_fmt for hwaccel encoding Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5e193daaa28d2fca34ad21d11d58f0b135388246 --- libavcodec/utils.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 3c8a9cc..4d1b632 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1593,6 +1593,17 @@ FF_ENABLE_DEPRECATION_WARNINGS ret = AVERROR(EINVAL); goto free_and_end; } +if (avctx->sw_pix_fmt != AV_PIX_FMT_NONE && +avctx->sw_pix_fmt != frames_ctx->sw_format) { +av_log(avctx, AV_LOG_ERROR, + "Mismatching AVCodecContext.sw_pix_fmt (%s) " + "and AVHWFramesContext.sw_format (%s)\n", + av_get_pix_fmt_name(avctx->sw_pix_fmt), + av_get_pix_fmt_name(frames_ctx->sw_format)); +ret = AVERROR(EINVAL); +goto free_and_end; +} +avctx->sw_pix_fmt = frames_ctx->sw_format; } } == ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc: initialize AVCodecContext.sw_pix_fmt properly
ffmpeg | branch: master | Anton Khirnov | Thu Jul 14 12:16:17 2016 +0200| [d59641abfd25a1007bdf4723d952887b1e3619c6] | committer: Anton Khirnov lavc: initialize AVCodecContext.sw_pix_fmt properly Currently it's memset to 0, which is YUV420P. It should be initialized to none. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d59641abfd25a1007bdf4723d952887b1e3619c6 --- libavcodec/options.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/options.c b/libavcodec/options.c index 18613ac..00921fb 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -98,6 +98,7 @@ static int init_context_defaults(AVCodecContext *s, const AVCodec *codec) s->execute2= avcodec_default_execute2; s->sample_aspect_ratio = (AVRational){0,1}; s->pix_fmt = AV_PIX_FMT_NONE; +s->sw_pix_fmt = AV_PIX_FMT_NONE; s->sample_fmt = AV_SAMPLE_FMT_NONE; s->reordered_opaque= AV_NOPTS_VALUE; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc: set sw_pix_fmt for hwaccel encoding
ffmpeg | branch: master | Anton Khirnov | Thu Jul 14 12:13:53 2016 +0200| [f65285aba0df7d46298abe0c945dfee05cbc6028] | committer: Anton Khirnov lavc: set sw_pix_fmt for hwaccel encoding > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f65285aba0df7d46298abe0c945dfee05cbc6028 --- libavcodec/utils.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index bc1beee..4184b95 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1113,6 +1113,17 @@ FF_ENABLE_DEPRECATION_WARNINGS ret = AVERROR(EINVAL); goto free_and_end; } +if (avctx->sw_pix_fmt != AV_PIX_FMT_NONE && +avctx->sw_pix_fmt != frames_ctx->sw_format) { +av_log(avctx, AV_LOG_ERROR, + "Mismatching AVCodecContext.sw_pix_fmt (%s) " + "and AVHWFramesContext.sw_format (%s)\n", + av_get_pix_fmt_name(avctx->sw_pix_fmt), + av_get_pix_fmt_name(frames_ctx->sw_format)); +ret = AVERROR(EINVAL); +goto free_and_end; +} +avctx->sw_pix_fmt = frames_ctx->sw_format; } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'd59641abfd25a1007bdf4723d952887b1e3619c6'
ffmpeg | branch: master | Clément Bœsch | Sun Mar 12 13:20:57 2017 +0100| [8d2d81709882a72ba5fbeccd3ce3da48ff258e96] | committer: Clément Bœsch Merge commit 'd59641abfd25a1007bdf4723d952887b1e3619c6' * commit 'd59641abfd25a1007bdf4723d952887b1e3619c6': lavc: initialize AVCodecContext.sw_pix_fmt properly Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8d2d81709882a72ba5fbeccd3ce3da48ff258e96 --- libavcodec/options.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/options.c b/libavcodec/options.c index d8e3dbf..7bdb0be 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -119,6 +119,7 @@ static int init_context_defaults(AVCodecContext *s, const AVCodec *codec) s->execute2= avcodec_default_execute2; s->sample_aspect_ratio = (AVRational){0,1}; s->pix_fmt = AV_PIX_FMT_NONE; +s->sw_pix_fmt = AV_PIX_FMT_NONE; s->sample_fmt = AV_SAMPLE_FMT_NONE; s->reordered_opaque= AV_NOPTS_VALUE; == ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '21962261c74aed4df00ae8348a5e2d1ecb67c52d'
ffmpeg | branch: master | Mark Thompson | Sun Mar 12 14:21:37 2017 +| [210dd7bbb2c0e4013fd8519d3b20e3032f0beb18] | committer: Mark Thompson Merge commit '21962261c74aed4df00ae8348a5e2d1ecb67c52d' * commit '21962261c74aed4df00ae8348a5e2d1ecb67c52d': qsv: handle the semi-packed formats in map_fourcc as well Merged-by: Mark Thompson > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=210dd7bbb2c0e4013fd8519d3b20e3032f0beb18 --- libavcodec/qsv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index aac6ce6..028a496 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -110,9 +110,11 @@ int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc) switch (format) { case AV_PIX_FMT_YUV420P: case AV_PIX_FMT_YUVJ420P: +case AV_PIX_FMT_NV12: *fourcc = MFX_FOURCC_NV12; return AV_PIX_FMT_NV12; case AV_PIX_FMT_YUV420P10: +case AV_PIX_FMT_P010: *fourcc = MFX_FOURCC_P010; return AV_PIX_FMT_P010; default: == ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] qsv: handle the semi-packed formats in map_fourcc as well
ffmpeg | branch: master | Anton Khirnov | Thu Jul 14 12:31:47 2016 +0200| [21962261c74aed4df00ae8348a5e2d1ecb67c52d] | committer: Anton Khirnov qsv: handle the semi-packed formats in map_fourcc as well This will allow using this function for encoding as well, where the input format is already the semi-packed version. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=21962261c74aed4df00ae8348a5e2d1ecb67c52d --- libavcodec/qsv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 5f7653a..c8b3978 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -94,9 +94,11 @@ int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc) switch (format) { case AV_PIX_FMT_YUV420P: case AV_PIX_FMT_YUVJ420P: +case AV_PIX_FMT_NV12: *fourcc = MFX_FOURCC_NV12; return AV_PIX_FMT_NV12; case AV_PIX_FMT_YUV420P10: +case AV_PIX_FMT_P010: *fourcc = MFX_FOURCC_P010; return AV_PIX_FMT_P010; default: ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavfi: add a QSV scaling filter
ffmpeg | branch: master | Anton Khirnov | Sat Mar 26 12:39:58 2016 +0100| [807a3b30d29128773ca433dac530d440638bbbf3] | committer: Mark Thompson lavfi: add a QSV scaling filter This merges libav commit ac7bfd69678f3966e38debdb27f4bde94dc0345c, which was previously skipped. (cherry picked from commit ac7bfd69678f3966e38debdb27f4bde94dc0345c) Signed-off-by: Mark Thompson > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=807a3b30d29128773ca433dac530d440638bbbf3 --- Changelog | 1 + configure | 1 + doc/libav-merge.txt| 1 - libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/version.h | 2 +- libavfilter/vf_scale_qsv.c | 635 + 7 files changed, 640 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index 13628ca..ac9998e 100644 --- a/Changelog +++ b/Changelog @@ -26,6 +26,7 @@ version : - native Opus encoder - ScreenPressor decoder - incomplete ClearVideo decoder +- Intel QSV video scaling filter version 3.2: - libopenmpt demuxer diff --git a/configure b/configure index 707b980..dc18bfa 100755 --- a/configure +++ b/configure @@ -3127,6 +3127,7 @@ rubberband_filter_deps="librubberband" sab_filter_deps="gpl swscale" scale2ref_filter_deps="swscale" scale_filter_deps="swscale" +scale_qsv_filter_deps="libmfx" select_filter_select="pixelutils" showcqt_filter_deps="avcodec avformat swscale" showcqt_filter_select="fft" diff --git a/doc/libav-merge.txt b/doc/libav-merge.txt index 39d846f..50eb34f 100644 --- a/doc/libav-merge.txt +++ b/doc/libav-merge.txt @@ -94,7 +94,6 @@ Stuff that didn't reach the codebase: - a853388d2 hevc: change the stride of the MC buffer to be in bytes instead of elements - 0cef06df0 checkasm: add HEVC MC tests - e7078e842 hevcdsp: add x86 SIMD for MC -- QSV scaling filter (62c58c5) Collateral damage that needs work locally: -- diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 0ba1c74..4d1180b 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -261,6 +261,7 @@ OBJS-$(CONFIG_ROTATE_FILTER) += vf_rotate.o OBJS-$(CONFIG_SAB_FILTER)+= vf_sab.o OBJS-$(CONFIG_SCALE_FILTER) += vf_scale.o scale.o OBJS-$(CONFIG_SCALE_NPP_FILTER) += vf_scale_npp.o scale.o +OBJS-$(CONFIG_SCALE_QSV_FILTER) += vf_scale_qsv.o OBJS-$(CONFIG_SCALE_VAAPI_FILTER)+= vf_scale_vaapi.o scale.o OBJS-$(CONFIG_SCALE2REF_FILTER) += vf_scale.o scale.o OBJS-$(CONFIG_SELECT_FILTER) += f_select.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index df1af8d..6aa482d 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -271,6 +271,7 @@ static void register_all(void) REGISTER_FILTER(SAB,sab,vf); REGISTER_FILTER(SCALE, scale, vf); REGISTER_FILTER(SCALE_NPP, scale_npp, vf); +REGISTER_FILTER(SCALE_QSV, scale_qsv, vf); REGISTER_FILTER(SCALE_VAAPI,scale_vaapi,vf); REGISTER_FILTER(SCALE2REF, scale2ref, vf); REGISTER_FILTER(SELECT, select, vf); diff --git a/libavfilter/version.h b/libavfilter/version.h index 11db8d5..878711d 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -30,7 +30,7 @@ #include "libavutil/version.h" #define LIBAVFILTER_VERSION_MAJOR 6 -#define LIBAVFILTER_VERSION_MINOR 74 +#define LIBAVFILTER_VERSION_MINOR 75 #define LIBAVFILTER_VERSION_MICRO 100 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c new file mode 100644 index 000..88fca8b --- /dev/null +++ b/libavfilter/vf_scale_qsv.c @@ -0,0 +1,635 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * scale video filter - QSV + */ + +#include + +#include +#include + +#include "libavutil/avstring.h" +#include "libavutil/common.h" +#include "libavutil/eval.h" +#include "libavutil/hwcontext.h" +#include "libavutil/hwcontext_qsv.h" +#include "libavutil/internal.h" +#include "libavutil
[FFmpeg-cvslog] qsvenc: add support for p010
ffmpeg | branch: master | Anton Khirnov | Wed Jun 22 19:57:28 2016 +0200| [37a9015ee84c15fec5247ba8f6577351a25fa8d2] | committer: Anton Khirnov qsvenc: add support for p010 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=37a9015ee84c15fec5247ba8f6577351a25fa8d2 --- libavcodec/qsvenc.c | 16 +--- libavcodec/qsvenc_h264.c | 1 + libavcodec/qsvenc_hevc.c | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 2bb7a1d..e28f354 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -385,7 +385,16 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; q->param.mfx.FrameInfo = frames_hwctx->surfaces[0].Info; } else { -q->param.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12; +enum AVPixelFormat sw_format = avctx->pix_fmt == AV_PIX_FMT_QSV ? + avctx->sw_pix_fmt : avctx->pix_fmt; +const AVPixFmtDescriptor *desc; + +desc = av_pix_fmt_desc_get(sw_format); +if (!desc) +return AVERROR_BUG; + +ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC); + q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, q->width_align); q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, 32); q->param.mfx.FrameInfo.CropX = 0; @@ -396,8 +405,9 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->param.mfx.FrameInfo.AspectRatioH = avctx->sample_aspect_ratio.den; q->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE; q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; -q->param.mfx.FrameInfo.BitDepthLuma = 8; -q->param.mfx.FrameInfo.BitDepthChroma = 8; +q->param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth; +q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth; +q->param.mfx.FrameInfo.Shift = desc->comp[0].depth > 8; } if (avctx->framerate.den > 0 && avctx->framerate.num > 0) { diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c index fc4e0b2..a968dcf 100644 --- a/libavcodec/qsvenc_h264.c +++ b/libavcodec/qsvenc_h264.c @@ -126,6 +126,7 @@ AVCodec ff_h264_qsv_encoder = { .close = qsv_enc_close, .capabilities = AV_CODEC_CAP_DELAY, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, +AV_PIX_FMT_P010, AV_PIX_FMT_QSV, AV_PIX_FMT_NONE }, .priv_class = &class, diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c index 706191d..ddb2a42 100644 --- a/libavcodec/qsvenc_hevc.c +++ b/libavcodec/qsvenc_hevc.c @@ -262,6 +262,7 @@ AVCodec ff_hevc_qsv_encoder = { .close = qsv_enc_close, .capabilities = AV_CODEC_CAP_DELAY, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, +AV_PIX_FMT_P010, AV_PIX_FMT_QSV, AV_PIX_FMT_NONE }, .priv_class = &class, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '37a9015ee84c15fec5247ba8f6577351a25fa8d2'
ffmpeg | branch: master | Mark Thompson | Sun Mar 12 15:04:45 2017 +| [562f386c77151d5d59151071106170589bce8e63] | committer: Mark Thompson Merge commit '37a9015ee84c15fec5247ba8f6577351a25fa8d2' * commit '37a9015ee84c15fec5247ba8f6577351a25fa8d2': qsvenc: add support for p010 Merged-by: Mark Thompson > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=562f386c77151d5d59151071106170589bce8e63 --- libavcodec/qsvenc.c | 16 +--- libavcodec/qsvenc_h264.c | 1 + libavcodec/qsvenc_hevc.c | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index ac443c1..f794e3a 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -377,7 +377,16 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; q->param.mfx.FrameInfo = frames_hwctx->surfaces[0].Info; } else { -q->param.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12; +enum AVPixelFormat sw_format = avctx->pix_fmt == AV_PIX_FMT_QSV ? + avctx->sw_pix_fmt : avctx->pix_fmt; +const AVPixFmtDescriptor *desc; + +desc = av_pix_fmt_desc_get(sw_format); +if (!desc) +return AVERROR_BUG; + +ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC); + q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, q->width_align); q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, 32); q->param.mfx.FrameInfo.CropX = 0; @@ -388,8 +397,9 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->param.mfx.FrameInfo.AspectRatioH = avctx->sample_aspect_ratio.den; q->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE; q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; -q->param.mfx.FrameInfo.BitDepthLuma = 8; -q->param.mfx.FrameInfo.BitDepthChroma = 8; +q->param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth; +q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth; +q->param.mfx.FrameInfo.Shift = desc->comp[0].depth > 8; } if (avctx->framerate.den > 0 && avctx->framerate.num > 0) { diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c index 7ff1a98..389335f 100644 --- a/libavcodec/qsvenc_h264.c +++ b/libavcodec/qsvenc_h264.c @@ -174,6 +174,7 @@ AVCodec ff_h264_qsv_encoder = { .close = qsv_enc_close, .capabilities = AV_CODEC_CAP_DELAY, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, +AV_PIX_FMT_P010, AV_PIX_FMT_QSV, AV_PIX_FMT_NONE }, .priv_class = &class, diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c index b775ef1..55e2e25 100644 --- a/libavcodec/qsvenc_hevc.c +++ b/libavcodec/qsvenc_hevc.c @@ -262,6 +262,7 @@ AVCodec ff_hevc_qsv_encoder = { .close = qsv_enc_close, .capabilities = AV_CODEC_CAP_DELAY, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, +AV_PIX_FMT_P010, AV_PIX_FMT_QSV, AV_PIX_FMT_NONE }, .priv_class = &class, == ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] qsv: print more complete error messages
ffmpeg | branch: master | Anton Khirnov | Sat Jun 25 21:38:10 2016 +0200| [95414eb2dc63a6f934275b4ed33dedd4369f2c49] | committer: Anton Khirnov qsv: print more complete error messages Include the libmfx error code and its description > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=95414eb2dc63a6f934275b4ed33dedd4369f2c49 --- libavcodec/qsv.c | 133 +++--- libavcodec/qsv_internal.h | 5 +- libavcodec/qsvdec.c | 11 ++-- libavcodec/qsvenc.c | 20 +++ 4 files changed, 97 insertions(+), 72 deletions(-) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index c8b3978..14f16bc 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -54,39 +54,67 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id) return AVERROR(ENOSYS); } -int ff_qsv_error(int mfx_err) +static const struct { +mfxStatus mfxerr; +int averr; +const char *desc; +} qsv_errors[] = { +{ MFX_ERR_NONE, 0, "success" }, +{ MFX_ERR_UNKNOWN, AVERROR_UNKNOWN, "unknown error" }, +{ MFX_ERR_NULL_PTR, AVERROR(EINVAL), "NULL pointer" }, +{ MFX_ERR_UNSUPPORTED, AVERROR(ENOSYS), "unsupported" }, +{ MFX_ERR_MEMORY_ALLOC, AVERROR(ENOMEM), "failed to allocate memory"}, +{ MFX_ERR_NOT_ENOUGH_BUFFER,AVERROR(ENOMEM), "insufficient input/output buffer" }, +{ MFX_ERR_INVALID_HANDLE, AVERROR(EINVAL), "invalid handle" }, +{ MFX_ERR_LOCK_MEMORY, AVERROR(EIO),"failed to lock the memory block" }, +{ MFX_ERR_NOT_INITIALIZED, AVERROR_BUG, "not initialized" }, +{ MFX_ERR_NOT_FOUND,AVERROR(ENOSYS), "specified object was not found" }, +{ MFX_ERR_MORE_DATA,AVERROR(EAGAIN), "expect more data at input"}, +{ MFX_ERR_MORE_SURFACE, AVERROR(EAGAIN), "expect more surface at output"}, +{ MFX_ERR_ABORTED, AVERROR_UNKNOWN, "operation aborted" }, +{ MFX_ERR_DEVICE_LOST, AVERROR(EIO),"device lost" }, +{ MFX_ERR_INCOMPATIBLE_VIDEO_PARAM, AVERROR(EINVAL), "incompatible video parameters"}, +{ MFX_ERR_INVALID_VIDEO_PARAM, AVERROR(EINVAL), "invalid video parameters" }, +{ MFX_ERR_UNDEFINED_BEHAVIOR, AVERROR_BUG, "undefined behavior" }, +{ MFX_ERR_DEVICE_FAILED,AVERROR(EIO),"device failed" }, +{ MFX_ERR_MORE_BITSTREAM, AVERROR(EAGAIN), "expect more bitstream at output" }, +{ MFX_ERR_INCOMPATIBLE_AUDIO_PARAM, AVERROR(EINVAL), "incompatible audio parameters"}, +{ MFX_ERR_INVALID_AUDIO_PARAM, AVERROR(EINVAL), "invalid audio parameters" }, + +{ MFX_WRN_IN_EXECUTION, 0, "operation in execution" }, +{ MFX_WRN_DEVICE_BUSY, 0, "device busy" }, +{ MFX_WRN_VIDEO_PARAM_CHANGED, 0, "video parameters changed" }, +{ MFX_WRN_PARTIAL_ACCELERATION, 0, "partial acceleration" }, +{ MFX_WRN_INCOMPATIBLE_VIDEO_PARAM, 0, "incompatible video parameters"}, +{ MFX_WRN_VALUE_NOT_CHANGED,0, "value is saturated" }, +{ MFX_WRN_OUT_OF_RANGE, 0, "value out of range" }, +{ MFX_WRN_FILTER_SKIPPED, 0, "filter skipped" }, +{ MFX_WRN_INCOMPATIBLE_AUDIO_PARAM, 0, "incompatible audio parameters"}, +}; + +int ff_qsv_map_error(mfxStatus mfx_err, const char **desc) { -switch (mfx_err) { -case MFX_ERR_NONE: -return 0; -case MFX_ERR_MEMORY_ALLOC: -case MFX_ERR_NOT_ENOUGH_BUFFER: -return AVERROR(ENOMEM); -case MFX_ERR_INVALID_HANDLE: -return AVERROR(EINVAL); -case MFX_ERR_DEVICE_FAILED: -case MFX_ERR_DEVICE_LOST: -case MFX_ERR_LOCK_MEMORY: -return AVERROR(EIO); -case MFX_ERR_NULL_PTR: -case MFX_ERR_UNDEFINED_BEHAVIOR: -case MFX_ERR_NOT_INITIALIZED: -return AVERROR_BUG; -case MFX_ERR_UNSUPPORTED: -case MFX_ERR_NOT_FOUND: -return AVERROR(ENOSYS); -case MFX_ERR_MORE_DATA: -case MFX_ERR_MORE_SURFACE: -case MFX_ERR_MORE_BITSTREAM: -return AVERROR(EAGAIN); -case MFX_ERR_INCOMPATIBLE_VIDEO_PARAM: -case MFX_ERR_INVALID_VIDEO_PARAM: -return AVERROR(EINVAL); -case MFX_ERR_ABORTED: -case MFX_ERR_UNKNOWN: -default: -return AVERROR_UNKNOWN
[FFmpeg-cvslog] Merge commit '95414eb2dc63a6f934275b4ed33dedd4369f2c49'
ffmpeg | branch: master | Mark Thompson | Sun Mar 12 15:19:05 2017 +| [15887a410c5ae271c59e5bc6d60ae443e6c40ac7] | committer: Mark Thompson Merge commit '95414eb2dc63a6f934275b4ed33dedd4369f2c49' * commit '95414eb2dc63a6f934275b4ed33dedd4369f2c49': qsv: print more complete error messages Merged-by: Mark Thompson > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=15887a410c5ae271c59e5bc6d60ae443e6c40ac7 --- libavcodec/qsv.c | 133 +++--- libavcodec/qsv_internal.h | 5 +- libavcodec/qsvdec.c | 17 ++ libavcodec/qsvenc.c | 22 4 files changed, 97 insertions(+), 80 deletions(-) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 028a496..76c7826 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -70,39 +70,67 @@ int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile) return MFX_PROFILE_UNKNOWN; } -int ff_qsv_error(int mfx_err) +static const struct { +mfxStatus mfxerr; +int averr; +const char *desc; +} qsv_errors[] = { +{ MFX_ERR_NONE, 0, "success" }, +{ MFX_ERR_UNKNOWN, AVERROR_UNKNOWN, "unknown error" }, +{ MFX_ERR_NULL_PTR, AVERROR(EINVAL), "NULL pointer" }, +{ MFX_ERR_UNSUPPORTED, AVERROR(ENOSYS), "unsupported" }, +{ MFX_ERR_MEMORY_ALLOC, AVERROR(ENOMEM), "failed to allocate memory"}, +{ MFX_ERR_NOT_ENOUGH_BUFFER,AVERROR(ENOMEM), "insufficient input/output buffer" }, +{ MFX_ERR_INVALID_HANDLE, AVERROR(EINVAL), "invalid handle" }, +{ MFX_ERR_LOCK_MEMORY, AVERROR(EIO),"failed to lock the memory block" }, +{ MFX_ERR_NOT_INITIALIZED, AVERROR_BUG, "not initialized" }, +{ MFX_ERR_NOT_FOUND,AVERROR(ENOSYS), "specified object was not found" }, +{ MFX_ERR_MORE_DATA,AVERROR(EAGAIN), "expect more data at input"}, +{ MFX_ERR_MORE_SURFACE, AVERROR(EAGAIN), "expect more surface at output"}, +{ MFX_ERR_ABORTED, AVERROR_UNKNOWN, "operation aborted" }, +{ MFX_ERR_DEVICE_LOST, AVERROR(EIO),"device lost" }, +{ MFX_ERR_INCOMPATIBLE_VIDEO_PARAM, AVERROR(EINVAL), "incompatible video parameters"}, +{ MFX_ERR_INVALID_VIDEO_PARAM, AVERROR(EINVAL), "invalid video parameters" }, +{ MFX_ERR_UNDEFINED_BEHAVIOR, AVERROR_BUG, "undefined behavior" }, +{ MFX_ERR_DEVICE_FAILED,AVERROR(EIO),"device failed" }, +{ MFX_ERR_MORE_BITSTREAM, AVERROR(EAGAIN), "expect more bitstream at output" }, +{ MFX_ERR_INCOMPATIBLE_AUDIO_PARAM, AVERROR(EINVAL), "incompatible audio parameters"}, +{ MFX_ERR_INVALID_AUDIO_PARAM, AVERROR(EINVAL), "invalid audio parameters" }, + +{ MFX_WRN_IN_EXECUTION, 0, "operation in execution" }, +{ MFX_WRN_DEVICE_BUSY, 0, "device busy" }, +{ MFX_WRN_VIDEO_PARAM_CHANGED, 0, "video parameters changed" }, +{ MFX_WRN_PARTIAL_ACCELERATION, 0, "partial acceleration" }, +{ MFX_WRN_INCOMPATIBLE_VIDEO_PARAM, 0, "incompatible video parameters"}, +{ MFX_WRN_VALUE_NOT_CHANGED,0, "value is saturated" }, +{ MFX_WRN_OUT_OF_RANGE, 0, "value out of range" }, +{ MFX_WRN_FILTER_SKIPPED, 0, "filter skipped" }, +{ MFX_WRN_INCOMPATIBLE_AUDIO_PARAM, 0, "incompatible audio parameters"}, +}; + +int ff_qsv_map_error(mfxStatus mfx_err, const char **desc) { -switch (mfx_err) { -case MFX_ERR_NONE: -return 0; -case MFX_ERR_MEMORY_ALLOC: -case MFX_ERR_NOT_ENOUGH_BUFFER: -return AVERROR(ENOMEM); -case MFX_ERR_INVALID_HANDLE: -return AVERROR(EINVAL); -case MFX_ERR_DEVICE_FAILED: -case MFX_ERR_DEVICE_LOST: -case MFX_ERR_LOCK_MEMORY: -return AVERROR(EIO); -case MFX_ERR_NULL_PTR: -case MFX_ERR_UNDEFINED_BEHAVIOR: -case MFX_ERR_NOT_INITIALIZED: -return AVERROR_BUG; -case MFX_ERR_UNSUPPORTED: -case MFX_ERR_NOT_FOUND: -return AVERROR(ENOSYS); -case MFX_ERR_MORE_DATA: -case MFX_ERR_MORE_SURFACE: -case MFX_ERR_MORE_BITSTREAM: -return AVERROR(EAGAIN); -case MFX_ERR_INCOMPATIBLE_VIDEO_PARAM: -case MFX_ERR_INVALID_VIDEO_PARAM: -return AVERROR(
[FFmpeg-cvslog] Merge commit '0956fd460681e8ccbdae19f135f0d3970bf95c2f'
ffmpeg | branch: master | Mark Thompson | Sun Mar 12 15:19:52 2017 +| [80fa5a0bcc13375711d9901f6ac7d8bdcc10a883] | committer: Mark Thompson Merge commit '0956fd460681e8ccbdae19f135f0d3970bf95c2f' * commit '0956fd460681e8ccbdae19f135f0d3970bf95c2f': qsvenc: do not re-execute encoding on all positive status codes Noop, see fb240a6276fa36fe120aadd67b4ca774e354f22b. Merged-by: Mark Thompson > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=80fa5a0bcc13375711d9901f6ac7d8bdcc10a883 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '8e07c22e508b349d145b9f142aa3ee8b3ce1d3a4'
ffmpeg | branch: master | Mark Thompson | Sun Mar 12 15:21:41 2017 +| [a7434ef19585f3af9ec168ec2db3db299f447285] | committer: Mark Thompson Merge commit '8e07c22e508b349d145b9f142aa3ee8b3ce1d3a4' * commit '8e07c22e508b349d145b9f142aa3ee8b3ce1d3a4': qsvenc: print warnings from encode/init Merged-by: Mark Thompson > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a7434ef19585f3af9ec168ec2db3db299f447285 --- libavcodec/qsv.c | 10 ++ libavcodec/qsv_internal.h | 3 +++ libavcodec/qsvenc.c | 6 ++ 3 files changed, 19 insertions(+) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 76c7826..d9a041c 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -133,6 +133,16 @@ int ff_qsv_print_error(void *log_ctx, mfxStatus err, return ret; } +int ff_qsv_print_warning(void *log_ctx, mfxStatus err, + const char *warning_string) +{ +const char *desc; +int ret; +ret = ff_qsv_map_error(err, &desc); +av_log(log_ctx, AV_LOG_WARNING, "%s: %s (%d)\n", warning_string, desc, err); +return ret; +} + int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc) { switch (format) { diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h index eb8e3a5..6ccb72a 100644 --- a/libavcodec/qsv_internal.h +++ b/libavcodec/qsv_internal.h @@ -65,6 +65,9 @@ int ff_qsv_map_error(mfxStatus mfx_err, const char **desc); int ff_qsv_print_error(void *log_ctx, mfxStatus err, const char *error_string); +int ff_qsv_print_warning(void *log_ctx, mfxStatus err, + const char *warning_string); + int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id); int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile); diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index a0ea965..2e59150 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -784,6 +784,9 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q) if (ret < 0) return ff_qsv_print_error(avctx, ret, "Error initializing the encoder"); +else if (ret > 0) +ff_qsv_print_warning(avctx, ret, + "Warning in encoder initialization"); ret = qsv_retrieve_enc_params(avctx, q); if (ret < 0) { @@ -991,6 +994,9 @@ static int encode_frame(AVCodecContext *avctx, QSVEncContext *q, av_usleep(500); } while (ret == MFX_WRN_DEVICE_BUSY || ret == MFX_WRN_IN_EXECUTION); +if (ret > 0) +ff_qsv_print_warning(avctx, ret, "Warning during encoding"); + if (ret < 0) { av_packet_unref(&new_pkt); av_freep(&bs); == diff --cc libavcodec/qsv_internal.h index eb8e3a5,41f4c3d..6ccb72a --- a/libavcodec/qsv_internal.h +++ b/libavcodec/qsv_internal.h @@@ -65,8 -62,10 +65,11 @@@ int ff_qsv_map_error(mfxStatus mfx_err int ff_qsv_print_error(void *log_ctx, mfxStatus err, const char *error_string); + int ff_qsv_print_warning(void *log_ctx, mfxStatus err, + const char *warning_string); + int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id); +int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile); int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc); diff --cc libavcodec/qsvenc.c index a0ea965,ba07db6..2e59150 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@@ -986,11 -972,14 +989,14 @@@ static int encode_frame(AVCodecContext } do { -ret = MFXVideoENCODE_EncodeFrameAsync(q->session, NULL, surf, bs, sync); +ret = MFXVideoENCODE_EncodeFrameAsync(q->session, enc_ctrl, surf, bs, sync); if (ret == MFX_WRN_DEVICE_BUSY) -av_usleep(1); +av_usleep(500); } while (ret == MFX_WRN_DEVICE_BUSY || ret == MFX_WRN_IN_EXECUTION); + if (ret > 0) + ff_qsv_print_warning(avctx, ret, "Warning during encoding"); + if (ret < 0) { av_packet_unref(&new_pkt); av_freep(&bs); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] qsvenc: print warnings from encode/init
ffmpeg | branch: master | Anton Khirnov | Thu Jul 14 12:56:35 2016 +0200| [8e07c22e508b349d145b9f142aa3ee8b3ce1d3a4] | committer: Anton Khirnov qsvenc: print warnings from encode/init > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8e07c22e508b349d145b9f142aa3ee8b3ce1d3a4 --- libavcodec/qsv.c | 10 ++ libavcodec/qsv_internal.h | 3 +++ libavcodec/qsvenc.c | 6 ++ 3 files changed, 19 insertions(+) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 14f16bc..9119586 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -117,6 +117,16 @@ int ff_qsv_print_error(void *log_ctx, mfxStatus err, return ret; } +int ff_qsv_print_warning(void *log_ctx, mfxStatus err, + const char *warning_string) +{ +const char *desc; +int ret; +ret = ff_qsv_map_error(err, &desc); +av_log(log_ctx, AV_LOG_WARNING, "%s: %s (%d)\n", warning_string, desc, err); +return ret; +} + int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc) { switch (format) { diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h index 03b2f65..41f4c3d 100644 --- a/libavcodec/qsv_internal.h +++ b/libavcodec/qsv_internal.h @@ -62,6 +62,9 @@ int ff_qsv_map_error(mfxStatus mfx_err, const char **desc); int ff_qsv_print_error(void *log_ctx, mfxStatus err, const char *error_string); +int ff_qsv_print_warning(void *log_ctx, mfxStatus err, + const char *warning_string); + int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id); int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc); diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 4697e1d..ba07db6 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -794,6 +794,9 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q) if (ret < 0) return ff_qsv_print_error(avctx, ret, "Error initializing the encoder"); +else if (ret > 0) +ff_qsv_print_warning(avctx, ret, + "Warning in encoder initialization"); ret = qsv_retrieve_enc_params(avctx, q); if (ret < 0) { @@ -974,6 +977,9 @@ static int encode_frame(AVCodecContext *avctx, QSVEncContext *q, av_usleep(1); } while (ret == MFX_WRN_DEVICE_BUSY || ret == MFX_WRN_IN_EXECUTION); +if (ret > 0) +ff_qsv_print_warning(avctx, ret, "Warning during encoding"); + if (ret < 0) { av_packet_unref(&new_pkt); av_freep(&bs); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'd9ec3c60143babe1bb77c268e1d5547d15acd69b'
ffmpeg | branch: master | Mark Thompson | Sun Mar 12 15:06:07 2017 +| [723a542d6c67de2946dbb7f782393c8c2bee8e0b] | committer: Mark Thompson Merge commit 'd9ec3c60143babe1bb77c268e1d5547d15acd69b' * commit 'd9ec3c60143babe1bb77c268e1d5547d15acd69b': qsvenc: take only the allocated dimensions from the frames context Merged-by: Mark Thompson > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=723a542d6c67de2946dbb7f782393c8c2bee8e0b --- libavcodec/qsvenc.c | 50 +- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index f794e3a..6e67a24 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -347,6 +347,9 @@ static int rc_supported(QSVEncContext *q) static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) { +enum AVPixelFormat sw_format = avctx->pix_fmt == AV_PIX_FMT_QSV ? + avctx->sw_pix_fmt : avctx->pix_fmt; +const AVPixFmtDescriptor *desc; float quant; int ret; @@ -372,34 +375,31 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->param.mfx.EncodedOrder = 0; q->param.mfx.BufferSizeInKB = 0; +desc = av_pix_fmt_desc_get(sw_format); +if (!desc) +return AVERROR_BUG; + +ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC); + +q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, q->width_align); +q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, 32); +q->param.mfx.FrameInfo.CropX = 0; +q->param.mfx.FrameInfo.CropY = 0; +q->param.mfx.FrameInfo.CropW = avctx->width; +q->param.mfx.FrameInfo.CropH = avctx->height; +q->param.mfx.FrameInfo.AspectRatioW = avctx->sample_aspect_ratio.num; +q->param.mfx.FrameInfo.AspectRatioH = avctx->sample_aspect_ratio.den; +q->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE; +q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; +q->param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth; +q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth; +q->param.mfx.FrameInfo.Shift = desc->comp[0].depth > 8; + if (avctx->hw_frames_ctx) { AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; -q->param.mfx.FrameInfo = frames_hwctx->surfaces[0].Info; -} else { -enum AVPixelFormat sw_format = avctx->pix_fmt == AV_PIX_FMT_QSV ? - avctx->sw_pix_fmt : avctx->pix_fmt; -const AVPixFmtDescriptor *desc; - -desc = av_pix_fmt_desc_get(sw_format); -if (!desc) -return AVERROR_BUG; - -ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC); - -q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, q->width_align); -q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, 32); -q->param.mfx.FrameInfo.CropX = 0; -q->param.mfx.FrameInfo.CropY = 0; -q->param.mfx.FrameInfo.CropW = avctx->width; -q->param.mfx.FrameInfo.CropH = avctx->height; -q->param.mfx.FrameInfo.AspectRatioW = avctx->sample_aspect_ratio.num; -q->param.mfx.FrameInfo.AspectRatioH = avctx->sample_aspect_ratio.den; -q->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE; -q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; -q->param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth; -q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth; -q->param.mfx.FrameInfo.Shift = desc->comp[0].depth > 8; +q->param.mfx.FrameInfo.Width = frames_hwctx->surfaces[0].Info.Width; +q->param.mfx.FrameInfo.Height = frames_hwctx->surfaces[0].Info.Height; } if (avctx->framerate.den > 0 && avctx->framerate.num > 0) { == ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] qsvenc: do not re-execute encoding on all positive status codes
ffmpeg | branch: master | Anton Khirnov | Thu Jul 14 12:52:20 2016 +0200| [0956fd460681e8ccbdae19f135f0d3970bf95c2f] | committer: Anton Khirnov qsvenc: do not re-execute encoding on all positive status codes It should only be done for DEVICE_BUSY/IN_EXECUTION > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0956fd460681e8ccbdae19f135f0d3970bf95c2f --- libavcodec/qsvenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index fbbe23c..4697e1d 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -972,7 +972,7 @@ static int encode_frame(AVCodecContext *avctx, QSVEncContext *q, ret = MFXVideoENCODE_EncodeFrameAsync(q->session, NULL, surf, bs, sync); if (ret == MFX_WRN_DEVICE_BUSY) av_usleep(1); -} while (ret > 0); +} while (ret == MFX_WRN_DEVICE_BUSY || ret == MFX_WRN_IN_EXECUTION); if (ret < 0) { av_packet_unref(&new_pkt); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] qsvenc: take only the allocated dimensions from the frames context
ffmpeg | branch: master | Anton Khirnov | Thu Jul 14 12:05:58 2016 +0200| [d9ec3c60143babe1bb77c268e1d5547d15acd69b] | committer: Anton Khirnov qsvenc: take only the allocated dimensions from the frames context Other parameters, like the display size, should still be taken from the codec context. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d9ec3c60143babe1bb77c268e1d5547d15acd69b --- libavcodec/qsvenc.c | 50 +- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index e28f354..cd321d3 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -355,6 +355,9 @@ static int rc_supported(QSVEncContext *q) static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) { +enum AVPixelFormat sw_format = avctx->pix_fmt == AV_PIX_FMT_QSV ? + avctx->sw_pix_fmt : avctx->pix_fmt; +const AVPixFmtDescriptor *desc; float quant; int ret; @@ -380,34 +383,31 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->param.mfx.EncodedOrder = 0; q->param.mfx.BufferSizeInKB = 0; +desc = av_pix_fmt_desc_get(sw_format); +if (!desc) +return AVERROR_BUG; + +ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC); + +q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, q->width_align); +q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, 32); +q->param.mfx.FrameInfo.CropX = 0; +q->param.mfx.FrameInfo.CropY = 0; +q->param.mfx.FrameInfo.CropW = avctx->width; +q->param.mfx.FrameInfo.CropH = avctx->height; +q->param.mfx.FrameInfo.AspectRatioW = avctx->sample_aspect_ratio.num; +q->param.mfx.FrameInfo.AspectRatioH = avctx->sample_aspect_ratio.den; +q->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE; +q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; +q->param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth; +q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth; +q->param.mfx.FrameInfo.Shift = desc->comp[0].depth > 8; + if (avctx->hw_frames_ctx) { AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; -q->param.mfx.FrameInfo = frames_hwctx->surfaces[0].Info; -} else { -enum AVPixelFormat sw_format = avctx->pix_fmt == AV_PIX_FMT_QSV ? - avctx->sw_pix_fmt : avctx->pix_fmt; -const AVPixFmtDescriptor *desc; - -desc = av_pix_fmt_desc_get(sw_format); -if (!desc) -return AVERROR_BUG; - -ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC); - -q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, q->width_align); -q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, 32); -q->param.mfx.FrameInfo.CropX = 0; -q->param.mfx.FrameInfo.CropY = 0; -q->param.mfx.FrameInfo.CropW = avctx->width; -q->param.mfx.FrameInfo.CropH = avctx->height; -q->param.mfx.FrameInfo.AspectRatioW = avctx->sample_aspect_ratio.num; -q->param.mfx.FrameInfo.AspectRatioH = avctx->sample_aspect_ratio.den; -q->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE; -q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; -q->param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth; -q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth; -q->param.mfx.FrameInfo.Shift = desc->comp[0].depth > 8; +q->param.mfx.FrameInfo.Width = frames_hwctx->surfaces[0].Info.Width; +q->param.mfx.FrameInfo.Height = frames_hwctx->surfaces[0].Info.Height; } if (avctx->framerate.den > 0 && avctx->framerate.num > 0) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'ad71d3276fef0ee7e791e62bbfe9c4e540047417'
ffmpeg | branch: master | Mark Thompson | Sun Mar 12 16:55:32 2017 +| [b9acc7fbd9fe6aeb76c9c91a65f1f5dab141fce4] | committer: Mark Thompson Merge commit 'ad71d3276fef0ee7e791e62bbfe9c4e540047417' * commit 'ad71d3276fef0ee7e791e62bbfe9c4e540047417': lavfi: add a QSV deinterlacing filter Minor fixup for lavfi differences. Merged-by: Mark Thompson > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b9acc7fbd9fe6aeb76c9c91a65f1f5dab141fce4 --- Changelog| 2 +- configure| 1 + libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/version.h| 2 +- libavfilter/vf_deinterlace_qsv.c | 575 +++ 6 files changed, 580 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index ac9998e..8cefcb5 100644 --- a/Changelog +++ b/Changelog @@ -26,7 +26,7 @@ version : - native Opus encoder - ScreenPressor decoder - incomplete ClearVideo decoder -- Intel QSV video scaling filter +- Intel QSV video scaling and deinterlacing filters version 3.2: - libopenmpt demuxer diff --git a/configure b/configure index dc18bfa..1e2e774 100755 --- a/configure +++ b/configure @@ -3083,6 +3083,7 @@ bs2b_filter_deps="libbs2b" colormatrix_filter_deps="gpl" cover_rect_filter_deps="avcodec avformat gpl" cropdetect_filter_deps="gpl" +deinterlace_qsv_filter_deps="libmfx" deinterlace_vaapi_filter_deps="vaapi" delogo_filter_deps="gpl" deshake_filter_select="pixelutils" diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 4d1180b..428251f 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -156,6 +156,7 @@ OBJS-$(CONFIG_DCTDNOIZ_FILTER) += vf_dctdnoiz.o OBJS-$(CONFIG_DEBAND_FILTER) += vf_deband.o OBJS-$(CONFIG_DECIMATE_FILTER) += vf_decimate.o OBJS-$(CONFIG_DEFLATE_FILTER)+= vf_neighbor.o +OBJS-$(CONFIG_DEINTERLACE_QSV_FILTER)+= vf_deinterlace_qsv.o OBJS-$(CONFIG_DEINTERLACE_VAAPI_FILTER) += vf_deinterlace_vaapi.o OBJS-$(CONFIG_DEJUDDER_FILTER) += vf_dejudder.o OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 6aa482d..2bf34ef 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -167,6 +167,7 @@ static void register_all(void) REGISTER_FILTER(DEBAND, deband, vf); REGISTER_FILTER(DECIMATE, decimate, vf); REGISTER_FILTER(DEFLATE,deflate,vf); +REGISTER_FILTER(DEINTERLACE_QSV,deinterlace_qsv,vf); REGISTER_FILTER(DEINTERLACE_VAAPI, deinterlace_vaapi, vf); REGISTER_FILTER(DEJUDDER, dejudder, vf); REGISTER_FILTER(DELOGO, delogo, vf); diff --git a/libavfilter/version.h b/libavfilter/version.h index 878711d..e67f34b 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -30,7 +30,7 @@ #include "libavutil/version.h" #define LIBAVFILTER_VERSION_MAJOR 6 -#define LIBAVFILTER_VERSION_MINOR 75 +#define LIBAVFILTER_VERSION_MINOR 76 #define LIBAVFILTER_VERSION_MICRO 100 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c new file mode 100644 index 000..e7491e1 --- /dev/null +++ b/libavfilter/vf_deinterlace_qsv.c @@ -0,0 +1,575 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * deinterlace video filter - QSV + */ + +#include + +#include +#include + +#include "libavutil/avstring.h" +#include "libavutil/common.h" +#include "libavutil/hwcontext.h" +#include "libavutil/hwcontext_qsv.h" +#include "libavutil/internal.h" +#include "libavutil/mathematics.h" +#include "libavutil/opt.h" +#include "libavutil/pixdesc.h" +#include "libavutil/time.h" + +#include "avfilter.h" +#include "formats.h" +#include "internal.h" +#include "video.h" + +enum { +QSVDEINT_MORE_OUTPUT = 1, +QSVDEINT_MORE_INPUT, +}; + +typedef struct QSVFrame { +AVFrame *frame; +mfxFrameSurface1 surface; +int used; + +struct QSVFrame *next; +} QSVFrame; + +typedef struct QSVDeintContext { +const AVClass *class; + +
[FFmpeg-cvslog] lavfi: add a QSV deinterlacing filter
ffmpeg | branch: master | Anton Khirnov | Sat Jul 2 12:12:36 2016 +0200| [ad71d3276fef0ee7e791e62bbfe9c4e540047417] | committer: Anton Khirnov lavfi: add a QSV deinterlacing filter > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ad71d3276fef0ee7e791e62bbfe9c4e540047417 --- Changelog| 2 +- configure| 1 + libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/version.h| 2 +- libavfilter/vf_deinterlace_qsv.c | 580 +++ 6 files changed, 585 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index b21f447..d3201b3 100644 --- a/Changelog +++ b/Changelog @@ -59,7 +59,7 @@ version : - G.729 raw demuxer - MagicYUV decoder - Duck TrueMotion 2.0 Real Time decoder -- Intel QSV video scaling filter +- Intel QSV video scaling and deinterlacing filter - OpenH264 decoder wrapper diff --git a/configure b/configure index 5885519..f12fa6f 100755 --- a/configure +++ b/configure @@ -2402,6 +2402,7 @@ blackframe_filter_deps="gpl" boxblur_filter_deps="gpl" bs2b_filter_deps="libbs2b" cropdetect_filter_deps="gpl" +deinterlace_qsv_filter_deps="libmfx" delogo_filter_deps="gpl" drawtext_filter_deps="libfreetype" frei0r_filter_deps="frei0r dlopen" diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 21515fe..dea8ffa 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -47,6 +47,7 @@ OBJS-$(CONFIG_BOXBLUR_FILTER)+= vf_boxblur.o OBJS-$(CONFIG_COPY_FILTER) += vf_copy.o OBJS-$(CONFIG_CROP_FILTER) += vf_crop.o OBJS-$(CONFIG_CROPDETECT_FILTER) += vf_cropdetect.o +OBJS-$(CONFIG_DEINTERLACE_QSV_FILTER)+= vf_deinterlace_qsv.o OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o OBJS-$(CONFIG_DRAWBOX_FILTER)+= vf_drawbox.o OBJS-$(CONFIG_DRAWTEXT_FILTER) += vf_drawtext.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index e3858d8..de49d65 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -70,6 +70,7 @@ void avfilter_register_all(void) REGISTER_FILTER(COPY, copy, vf); REGISTER_FILTER(CROP, crop, vf); REGISTER_FILTER(CROPDETECT, cropdetect, vf); +REGISTER_FILTER(DEINTERLACE_QSV,deinterlace_qsv,vf); REGISTER_FILTER(DELOGO, delogo, vf); REGISTER_FILTER(DRAWBOX,drawbox,vf); REGISTER_FILTER(DRAWTEXT, drawtext, vf); diff --git a/libavfilter/version.h b/libavfilter/version.h index e91c6e2..7f3ede2 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -30,7 +30,7 @@ #include "libavutil/version.h" #define LIBAVFILTER_VERSION_MAJOR 6 -#define LIBAVFILTER_VERSION_MINOR 5 +#define LIBAVFILTER_VERSION_MINOR 6 #define LIBAVFILTER_VERSION_MICRO 0 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c new file mode 100644 index 000..b26a900 --- /dev/null +++ b/libavfilter/vf_deinterlace_qsv.c @@ -0,0 +1,580 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * deinterlace video filter - QSV + */ + +#include + +#include +#include + +#include "libavutil/avstring.h" +#include "libavutil/common.h" +#include "libavutil/hwcontext.h" +#include "libavutil/hwcontext_qsv.h" +#include "libavutil/internal.h" +#include "libavutil/mathematics.h" +#include "libavutil/opt.h" +#include "libavutil/pixdesc.h" +#include "libavutil/time.h" + +#include "avfilter.h" +#include "formats.h" +#include "internal.h" +#include "video.h" + +enum { +QSVDEINT_MORE_OUTPUT = 1, +QSVDEINT_MORE_INPUT, +}; + +typedef struct QSVFrame { +AVFrame *frame; +mfxFrameSurface1 surface; +int used; + +struct QSVFrame *next; +} QSVFrame; + +typedef struct QSVDeintContext { +const AVClass *class; + +AVBufferRef *hw_frames_ctx; +/* a clone of the main session, used internally for deinterlacing */ +mfxSession session; + +mfxMemId *mem_ids; +intnb_mem_ids; + +mfxFrameSurface1 **surface_ptrs; +int
[FFmpeg-cvslog] avcodec/codec_desc: add mime type for X-PixMap
ffmpeg | branch: master | Paul B Mahol | Sun Mar 12 14:49:26 2017 +0100| [404d2b977fde6018affef80255f2f0578be5dace] | committer: Paul B Mahol avcodec/codec_desc: add mime type for X-PixMap Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=404d2b977fde6018affef80255f2f0578be5dace --- libavcodec/codec_desc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 88cfddb..75a69c5 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1596,6 +1596,7 @@ static const AVCodecDescriptor codec_descriptors[] = { .name = "xpm", .long_name = NULL_IF_CONFIG_SMALL("XPM (X PixMap) image"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, +.mime_types= MT("image/x-xpixmap"), }, { .id= AV_CODEC_ID_XWD, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/codec_desc: add mime type for X-BitMap
ffmpeg | branch: master | Paul B Mahol | Sun Mar 12 14:50:33 2017 +0100| [01b069c1b81f68373f4401a611f1b8a4ad552895] | committer: Paul B Mahol avcodec/codec_desc: add mime type for X-BitMap Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=01b069c1b81f68373f4401a611f1b8a4ad552895 --- libavcodec/codec_desc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 75a69c5..c0418e4 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1589,6 +1589,7 @@ static const AVCodecDescriptor codec_descriptors[] = { .name = "xbm", .long_name = NULL_IF_CONFIG_SMALL("XBM (X BitMap) image"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, +.mime_types= MT("image/x-xbitmap"), }, { .id= AV_CODEC_ID_XPM, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/xpmdec: make convert function more picky about its input
ffmpeg | branch: master | Paul B Mahol | Sun Mar 12 12:48:01 2017 +0100| [eda78c8b7f8a0e4728344f97700960f022eee6d2] | committer: Paul B Mahol avcodec/xpmdec: make convert function more picky about its input Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eda78c8b7f8a0e4728344f97700960f022eee6d2 --- libavcodec/xpmdec.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c index 3f01a8f..8d5bc76 100644 --- a/libavcodec/xpmdec.c +++ b/libavcodec/xpmdec.c @@ -185,15 +185,16 @@ static const ColorEntry color_table[] = { { "YellowGreen", 0xFF9ACD32 } }; -static int convert(uint8_t x) +static unsigned convert(uint8_t x) { -if (x >= 'a') { +if (x >= 'a' && x <= 'f') x -= 87; -} else if (x >= 'A') { +else if (x >= 'A' && x <= 'F') x -= 55; -} else { +else if (x >= '0' && x <= '9') x -= '0'; -} +else +x = 0; return x; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec: add XPM decoder and demuxer
ffmpeg | branch: master | Paras Chadha | Sun Mar 12 02:49:23 2017 +0530| [5dab7b91adf65eb35d4ae0e76fbd988d55b0d764] | committer: Paul B Mahol avcodec: add XPM decoder and demuxer Signed-off-by: Paras Chadha > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5dab7b91adf65eb35d4ae0e76fbd988d55b0d764 --- Changelog| 1 + doc/general.texi | 2 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/avcodec.h | 1 + libavcodec/codec_desc.c | 7 + libavcodec/version.h | 4 +- libavcodec/xpmdec.c | 425 +++ libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/img2.c | 1 + libavformat/img2dec.c| 10 ++ 12 files changed, 453 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index 8cefcb5..b9d1a3c 100644 --- a/Changelog +++ b/Changelog @@ -27,6 +27,7 @@ version : - ScreenPressor decoder - incomplete ClearVideo decoder - Intel QSV video scaling and deinterlacing filters +- XPM decoder version 3.2: - libopenmpt demuxer diff --git a/doc/general.texi b/doc/general.texi index 30450c0..80eaace 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -609,6 +609,8 @@ following image formats are supported: @tab X BitMap image format @item XFace @tab X @tab X @tab X-Face image format +@item XPM @tab @tab X +@tab X PixMap image format @item XWD @tab X @tab X @tab X Window Dump image format @end multitable diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 65ccbad..b8d7a00 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -650,6 +650,7 @@ OBJS-$(CONFIG_XFACE_ENCODER) += xfaceenc.o xface.o OBJS-$(CONFIG_XL_DECODER) += xl.o OBJS-$(CONFIG_XMA1_DECODER)+= wmaprodec.o wma.o wma_common.o OBJS-$(CONFIG_XMA2_DECODER)+= wmaprodec.o wma.o wma_common.o +OBJS-$(CONFIG_XPM_DECODER) += xpmdec.o OBJS-$(CONFIG_XSUB_DECODER)+= xsubdec.o OBJS-$(CONFIG_XSUB_ENCODER)+= xsubenc.o OBJS-$(CONFIG_XWD_DECODER) += xwddec.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 074efd4..b7d03ad 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -378,6 +378,7 @@ static void register_all(void) REGISTER_ENCDEC (XBM, xbm); REGISTER_ENCDEC (XFACE, xface); REGISTER_DECODER(XL,xl); +REGISTER_DECODER(XPM, xpm); REGISTER_ENCDEC (XWD, xwd); REGISTER_ENCDEC (Y41P, y41p); REGISTER_DECODER(YLC, ylc); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 30ac236..e32f579 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -439,6 +439,7 @@ enum AVCodecID { AV_CODEC_ID_FMVC, AV_CODEC_ID_SCPR, AV_CODEC_ID_CLEARVIDEO, +AV_CODEC_ID_XPM, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the start of audio codecs diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 06bcfc3..88cfddb 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1591,6 +1591,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { +.id= AV_CODEC_ID_XPM, +.type = AVMEDIA_TYPE_VIDEO, +.name = "xpm", +.long_name = NULL_IF_CONFIG_SMALL("XPM (X PixMap) image"), +.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, +}, +{ .id= AV_CODEC_ID_XWD, .type = AVMEDIA_TYPE_VIDEO, .name = "xwd", diff --git a/libavcodec/version.h b/libavcodec/version.h index b00e011..3ed5a71 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,8 +28,8 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 57 -#define LIBAVCODEC_VERSION_MINOR 82 -#define LIBAVCODEC_VERSION_MICRO 102 +#define LIBAVCODEC_VERSION_MINOR 83 +#define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c new file mode 100644 index 000..3f01a8f --- /dev/null +++ b/libavcodec/xpmdec.c @@ -0,0 +1,425 @@ +/* + * XPM image format + * + * Copyright (c) 2012 Paul B Mahol + * Copyright (c) 2017 Paras Chadha + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the imp
[FFmpeg-cvslog] avcodec/xpmdec: skip everything before signature
ffmpeg | branch: master | Paul B Mahol | Sun Mar 12 15:07:02 2017 +0100| [e73325b971b37dd4741c49541c74cde0739dab8c] | committer: Paul B Mahol avcodec/xpmdec: skip everything before signature Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e73325b971b37dd4741c49541c74cde0739dab8c --- libavcodec/xpmdec.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c index 8d5bc76..6cd7bde 100644 --- a/libavcodec/xpmdec.c +++ b/libavcodec/xpmdec.c @@ -309,7 +309,10 @@ static int xpm_decode_frame(AVCodecContext *avctx, void *data, avctx->pix_fmt = AV_PIX_FMT_BGRA; end = avpkt->data + avpkt->size; -if (memcmp(ptr, "/* XPM */", 9)) { +while (memcmp(ptr, "/* XPM */\n", 10) && ptr < end - 10) +ptr++; + +if (ptr >= end) { av_log(avctx, AV_LOG_ERROR, "missing signature\n"); return AVERROR_INVALIDDATA; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] tests/api-seek: fix memory leak on realloc() failure
ffmpeg | branch: master | James Almer | Sat Mar 11 20:29:40 2017 -0300| [ff17c76e92cd9a9072a8771cad73c96cd620040b] | committer: James Almer tests/api-seek: fix memory leak on realloc() failure Reviewed-by: Michael Niedermayer Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ff17c76e92cd9a9072a8771cad73c96cd620040b --- tests/api/api-seek-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/api/api-seek-test.c b/tests/api/api-seek-test.c index e4276eb..4fd1e6e 100644 --- a/tests/api/api-seek-test.c +++ b/tests/api/api-seek-test.c @@ -40,8 +40,8 @@ static int add_crc_to_array(uint32_t crc, int64_t pts) if (size_of_array == 0) size_of_array = 10; size_of_array *= 2; -crc_array = av_realloc(crc_array, size_of_array * sizeof(uint32_t)); -pts_array = av_realloc(pts_array, size_of_array * sizeof(int64_t)); +crc_array = av_realloc_f(crc_array, size_of_array, sizeof(uint32_t)); +pts_array = av_realloc_f(pts_array, size_of_array, sizeof(int64_t)); if ((crc_array == NULL) || (pts_array == NULL)) { av_log(NULL, AV_LOG_ERROR, "Can't allocate array to store crcs\n"); return AVERROR(ENOMEM); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] tests/api-seek: make the crc array uint32_t
ffmpeg | branch: master | James Almer | Sat Mar 11 20:24:53 2017 -0300| [88deeb3eba00271e9fb82177860c743fc564e8c0] | committer: James Almer tests/api-seek: make the crc array uint32_t Reviewed-by: Michael Niedermayer Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=88deeb3eba00271e9fb82177860c743fc564e8c0 --- tests/api/api-seek-test.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/api/api-seek-test.c b/tests/api/api-seek-test.c index cc3287b..6ef3b91 100644 --- a/tests/api/api-seek-test.c +++ b/tests/api/api-seek-test.c @@ -30,17 +30,17 @@ #include "libavutil/imgutils.h" int64_t *pts_array; -int64_t *crc_array; +uint32_t *crc_array; int size_of_array; int number_of_elements; -static int add_crc_to_array(int64_t crc, int64_t pts) +static int add_crc_to_array(uint32_t crc, int64_t pts) { if (size_of_array <= number_of_elements) { if (size_of_array == 0) size_of_array = 10; size_of_array *= 2; -crc_array = av_realloc(crc_array, size_of_array * sizeof(int64_t)); +crc_array = av_realloc(crc_array, size_of_array * sizeof(uint32_t)); pts_array = av_realloc(pts_array, size_of_array * sizeof(int64_t)); if ((crc_array == NULL) || (pts_array == NULL)) { av_log(NULL, AV_LOG_ERROR, "Can't allocate array to store crcs\n"); @@ -53,13 +53,13 @@ static int add_crc_to_array(int64_t crc, int64_t pts) return 0; } -static int compare_crc_in_array(int64_t crc, int64_t pts) +static int compare_crc_in_array(uint32_t crc, int64_t pts) { int i; for (i = 0; i < number_of_elements; i++) { if (pts_array[i] == pts) { if (crc_array[i] == crc) { -printf("Comparing 0x%08lx %"PRId64" %d is OK\n", crc, pts, i); +printf("Comparing 0x%08"PRIx32" %"PRId64" %d is OK\n", crc, pts, i); return 0; } else { @@ -81,7 +81,7 @@ static int compute_crc_of_packets(AVFormatContext *fmt_ctx, int video_stream, int end_of_stream = 0; int byte_buffer_size; uint8_t *byte_buffer; -int64_t crc; +uint32_t crc; AVPacket pkt; byte_buffer_size = av_image_get_buffer_size(ctx->pix_fmt, ctx->width, ctx->height, 16); @@ -132,7 +132,7 @@ static int compute_crc_of_packets(AVFormatContext *fmt_ctx, int video_stream, if ((!no_seeking) && (fr->pts > ts_end)) break; crc = av_adler32_update(0, (const uint8_t*)byte_buffer, number_of_written_bytes); -printf("%10"PRId64", 0x%08lx\n", fr->pts, crc); +printf("%10"PRId64", 0x%08"PRIx32"\n", fr->pts, crc); if (no_seeking) { if (add_crc_to_array(crc, fr->pts) < 0) return -1; @@ -185,7 +185,8 @@ static int seek_test(const char *input_filename, const char *start, const char * size_of_array = 0; number_of_elements = 0; -crc_array = pts_array = NULL; +crc_array = NULL; +pts_array = NULL; result = avformat_open_input(&fmt_ctx, input_filename, NULL, NULL); if (result < 0) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] test/api-seek: clean up properly on failure
ffmpeg | branch: master | James Almer | Sun Mar 12 10:36:44 2017 -0300| [bdd07d7796e939e920842eb7280e1bce488fb95d] | committer: James Almer test/api-seek: clean up properly on failure Also propagate better error values. Reviewed-by: Michael Niedermayer Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bdd07d7796e939e920842eb7280e1bce488fb95d --- tests/api/api-seek-test.c | 31 +++ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/tests/api/api-seek-test.c b/tests/api/api-seek-test.c index 6ef3b91..e4276eb 100644 --- a/tests/api/api-seek-test.c +++ b/tests/api/api-seek-test.c @@ -197,19 +197,22 @@ static int seek_test(const char *input_filename, const char *start, const char * result = avformat_find_stream_info(fmt_ctx, NULL); if (result < 0) { av_log(NULL, AV_LOG_ERROR, "Can't get stream info\n"); -return result; +goto end; } start_ts = read_seek_range(start); end_ts = read_seek_range(end); -if ((start_ts < 0) || (end_ts < 0)) -return -1; +if ((start_ts < 0) || (end_ts < 0)) { +result = -1; +goto end; +} //TODO: add ability to work with audio format video_stream = av_find_best_stream(fmt_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0); if (video_stream < 0) { av_log(NULL, AV_LOG_ERROR, "Can't find video stream in input file\n"); - return -1; + result = video_stream; + goto end; } origin_par = fmt_ctx->streams[video_stream]->codecpar; @@ -217,52 +220,56 @@ static int seek_test(const char *input_filename, const char *start, const char * codec = avcodec_find_decoder(origin_par->codec_id); if (!codec) { av_log(NULL, AV_LOG_ERROR, "Can't find decoder\n"); -return -1; +result = AVERROR_DECODER_NOT_FOUND; +goto end; } ctx = avcodec_alloc_context3(codec); if (!ctx) { av_log(NULL, AV_LOG_ERROR, "Can't allocate decoder context\n"); -return AVERROR(ENOMEM); +result = AVERROR(ENOMEM); +goto end; } result = avcodec_parameters_to_context(ctx, origin_par); if (result) { av_log(NULL, AV_LOG_ERROR, "Can't copy decoder context\n"); -return result; +goto end; } result = avcodec_open2(ctx, codec, NULL); if (result < 0) { av_log(ctx, AV_LOG_ERROR, "Can't open decoder\n"); -return result; +goto end; } fr = av_frame_alloc(); if (!fr) { av_log(NULL, AV_LOG_ERROR, "Can't allocate frame\n"); -return AVERROR(ENOMEM); +result = AVERROR(ENOMEM); +goto end; } result = compute_crc_of_packets(fmt_ctx, video_stream, ctx, fr, 0, 0, 1); if (result != 0) -return -1; +goto end; for (i = start_ts; i < end_ts; i += 100) { for (j = i + 100; j < end_ts; j += 100) { result = compute_crc_of_packets(fmt_ctx, video_stream, ctx, fr, i, j, 0); if (result != 0) -return -1; +break; } } +end: av_freep(&crc_array); av_freep(&pts_array); av_frame_free(&fr); avcodec_close(ctx); avformat_close_input(&fmt_ctx); avcodec_free_context(&ctx); -return 0; +return result; } int main(int argc, char **argv) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] vf_hwupload: Add missing return value check
ffmpeg | branch: master | Jun Zhao | Fri Mar 3 09:25:53 2017 +0800| [bf238a6a3ca92de686e0e103135c1336f33f685b] | committer: Mark Thompson vf_hwupload: Add missing return value check Add missing return value checks to suppress build warning and remove noop ff_formats_unref() calling. Note: most filters using ff_formats_ref() didn't have a suitable error handling, it's a potential memory leak issue. Signed-off-by: Jun Zhao Signed-off-by: Mark Thompson > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bf238a6a3ca92de686e0e103135c1336f33f685b --- libavfilter/vf_hwupload.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/libavfilter/vf_hwupload.c b/libavfilter/vf_hwupload.c index 08af2dd..f54ce9f 100644 --- a/libavfilter/vf_hwupload.c +++ b/libavfilter/vf_hwupload.c @@ -74,17 +74,15 @@ static int hwupload_query_formats(AVFilterContext *avctx) if (input_pix_fmts) { for (i = 0; input_pix_fmts[i] != AV_PIX_FMT_NONE; i++) { err = ff_add_format(&input_formats, input_pix_fmts[i]); -if (err < 0) { -ff_formats_unref(&input_formats); +if (err < 0) goto fail; -} } } -ff_formats_ref(input_formats, &avctx->inputs[0]->out_formats); - -ff_formats_ref(ff_make_format_list(output_pix_fmts), - &avctx->outputs[0]->in_formats); +if ((err = ff_formats_ref(input_formats, &avctx->inputs[0]->out_formats)) < 0 || +(err = ff_formats_ref(ff_make_format_list(output_pix_fmts), + &avctx->outputs[0]->in_formats)) < 0) +goto fail; av_hwframe_constraints_free(&constraints); return 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swresample/swresample: do not reset tsf on swr_alloc_set_opts
ffmpeg | branch: master | Muhammad Faiz | Sun Mar 12 00:24:21 2017 +0700| [6c7a0876fefdd3c919afcabf493492cb4946ca6a] | committer: Muhammad Faiz swresample/swresample: do not reset tsf on swr_alloc_set_opts so tsf option in aresample will have effect previously tsf/internal_sample_format had no effect fate is updated s32p previously used fltp internally dblp previously used fltp/dblp internally Reviewed-by: Michael Niedermayer Signed-off-by: Muhammad Faiz > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6c7a0876fefdd3c919afcabf493492cb4946ca6a --- libswresample/swresample.c | 3 -- tests/fate/libswresample.mak | 80 ++-- 2 files changed, 40 insertions(+), 43 deletions(-) diff --git a/libswresample/swresample.c b/libswresample/swresample.c index dea6139..f2e6600 100644 --- a/libswresample/swresample.c +++ b/libswresample/swresample.c @@ -84,9 +84,6 @@ struct SwrContext *swr_alloc_set_opts(struct SwrContext *s, if (av_opt_set_int(s, "isr", in_sample_rate, 0) < 0) goto fail; -if (av_opt_set_int(s, "tsf", AV_SAMPLE_FMT_NONE, 0) < 0) -goto fail; - if (av_opt_set_int(s, "ich", av_get_channel_layout_nb_channels(s-> user_in_ch_layout), 0) < 0) goto fail; diff --git a/tests/fate/libswresample.mak b/tests/fate/libswresample.mak index 78dbde7..d9e0fa9 100644 --- a/tests/fate/libswresample.mak +++ b/tests/fate/libswresample.mak @@ -218,28 +218,28 @@ fate-swr-resample-s32p-2626-8000: SIZE_TOLERANCE = 31512 - 20482 fate-swr-resample-s32p-2626-96000: CMP_TARGET = 1393.00 fate-swr-resample-s32p-2626-96000: SIZE_TOLERANCE = 31512 - 20480 -fate-swr-resample-s32p-44100-2626: CMP_TARGET = 185.82 +fate-swr-resample-s32p-44100-2626: CMP_TARGET = 185.81 fate-swr-resample-s32p-44100-2626: SIZE_TOLERANCE = 529200 - 20490 -fate-swr-resample-s32p-44100-48000: CMP_TARGET = 9.69 +fate-swr-resample-s32p-44100-48000: CMP_TARGET = 9.70 fate-swr-resample-s32p-44100-48000: SIZE_TOLERANCE = 529200 - 20482 fate-swr-resample-s32p-44100-8000: CMP_TARGET = 75.45 fate-swr-resample-s32p-44100-8000: SIZE_TOLERANCE = 529200 - 20486 -fate-swr-resample-s32p-44100-96000: CMP_TARGET = 11.46 +fate-swr-resample-s32p-44100-96000: CMP_TARGET = 11.47 fate-swr-resample-s32p-44100-96000: SIZE_TOLERANCE = 529200 - 20482 -fate-swr-resample-s32p-48000-2626: CMP_TARGET = 456.51 +fate-swr-resample-s32p-48000-2626: CMP_TARGET = 456.49 fate-swr-resample-s32p-48000-2626: SIZE_TOLERANCE = 576000 - 20510 -fate-swr-resample-s32p-48000-44100: CMP_TARGET = 1.00 +fate-swr-resample-s32p-48000-44100: CMP_TARGET = 1.12 fate-swr-resample-s32p-48000-44100: SIZE_TOLERANCE = 576000 - 20480 -fate-swr-resample-s32p-48000-8000: CMP_TARGET = 62.38 +fate-swr-resample-s32p-48000-8000: CMP_TARGET = 62.37 fate-swr-resample-s32p-48000-8000: SIZE_TOLERANCE = 576000 - 20484 -fate-swr-resample-s32p-48000-96000: CMP_TARGET = 0.47 +fate-swr-resample-s32p-48000-96000: CMP_TARGET = 0.85 fate-swr-resample-s32p-48000-96000: SIZE_TOLERANCE = 576000 - 20480 fate-swr-resample-s32p-8000-2626: CMP_TARGET = 2503.33 @@ -248,22 +248,22 @@ fate-swr-resample-s32p-8000-2626: SIZE_TOLERANCE = 96000 - 20486 fate-swr-resample-s32p-8000-44100: CMP_TARGET = 15.09 fate-swr-resample-s32p-8000-44100: SIZE_TOLERANCE = 96000 - 20480 -fate-swr-resample-s32p-8000-48000: CMP_TARGET = 14.69 +fate-swr-resample-s32p-8000-48000: CMP_TARGET = 14.68 fate-swr-resample-s32p-8000-48000: SIZE_TOLERANCE = 96000 - 20480 fate-swr-resample-s32p-8000-96000: CMP_TARGET = 13.81 fate-swr-resample-s32p-8000-96000: SIZE_TOLERANCE = 96000 - 20480 -fate-swr-resample-s32p-96000-2626: CMP_TARGET = 675.07 +fate-swr-resample-s32p-96000-2626: CMP_TARGET = 675.05 fate-swr-resample-s32p-96000-2626: SIZE_TOLERANCE = 1152000 - 20474 -fate-swr-resample-s32p-96000-44100: CMP_TARGET = 1.44 +fate-swr-resample-s32p-96000-44100: CMP_TARGET = 1.54 fate-swr-resample-s32p-96000-44100: SIZE_TOLERANCE = 1152000 - 20480 -fate-swr-resample-s32p-96000-48000: CMP_TARGET = 0.99 +fate-swr-resample-s32p-96000-48000: CMP_TARGET = 1.21 fate-swr-resample-s32p-96000-48000: SIZE_TOLERANCE = 1152000 - 20480 -fate-swr-resample-s32p-96000-8000: CMP_TARGET = 58.57 +fate-swr-resample-s32p-96000-8000: CMP_TARGET = 58.59 fate-swr-resample-s32p-96000-8000: SIZE_TOLERANCE = 1152000 - 20496 @@ -440,7 +440,7 @@ fate-swr-resample_exact-dblp-8000-96000: SIZE_TOLERANCE = 96000 - 20480 fate-swr-resample_exact-dblp-96000-2626: CMP_TARGET = 675.07 fate-swr-resample_exact-dblp-96000-2626: SIZE_TOLERANCE = 1152000 - 20474 -fate-swr-resample_exact-dblp-96000-44100: CMP_TARGET = 1.23 +fate-swr-resample_exact-dblp-96000-44100: CMP_TARGET = 1.24 fate-swr-resample_exact-dblp-96000-44100: SIZE_TOLERANCE = 1152000 - 20480 fate-swr-resample_exact-dblp-96000-48000: CMP_TARGET = 0.99 @@ -581,52 +581,52 @@ fate-swr-resample_exact-s32p-2626-8000: SIZE_TOLERANCE = 31512 - 20482 fate-swr-resample_exact-s32p-2626-96000: CMP_TARG
[FFmpeg-cvslog] avcodec/xpmdec: do not allow number of colors to be higher than allocated
ffmpeg | branch: master | Paul B Mahol | Sun Mar 12 22:51:00 2017 +0100| [2b790b1c9e3bf8f4fbc56fc3a071f2015b58de21] | committer: Paul B Mahol avcodec/xpmdec: do not allow number of colors to be higher than allocated Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2b790b1c9e3bf8f4fbc56fc3a071f2015b58de21 --- libavcodec/xpmdec.c | 23 --- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c index 25ef992..592f81a 100644 --- a/libavcodec/xpmdec.c +++ b/libavcodec/xpmdec.c @@ -328,29 +328,22 @@ static int xpm_decode_frame(AVCodecContext *avctx, void *data, if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; -if (ncolors <= 0) { -av_log(avctx, AV_LOG_ERROR, "invalid number of colors: %d\n", ncolors); +if (cpp <= 0 || cpp >= 5) { +av_log(avctx, AV_LOG_ERROR, "unsupported/invalid number of chars per pixel: %d\n", cpp); return AVERROR_INVALIDDATA; } -if (cpp <= 0) { -av_log(avctx, AV_LOG_ERROR, "invalid number of chars per pixel: %d\n", cpp); +size = 1; +for (i = 0; i < cpp; i++) +size *= 94; + +if (ncolors <= 0 || ncolors > size) { +av_log(avctx, AV_LOG_ERROR, "invalid number of colors: %d\n", ncolors); return AVERROR_INVALIDDATA; } -size = 1; -j = 1; -for (i = 0; i < cpp; i++) { -size += j * 94; -j *= 95; -} size *= 4; -if (size < 0) { -av_log(avctx, AV_LOG_ERROR, "unsupported number of chars per pixel: %d\n", cpp); -return AVERROR(ENOMEM); -} - av_fast_padded_malloc(&x->pixels, &x->pixels_size, size); if (!x->pixels) return AVERROR(ENOMEM); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/xpmdec: rename yet another function
ffmpeg | branch: master | Paul B Mahol | Sun Mar 12 22:43:49 2017 +0100| [fbc1f323dbda521a693737fd9d98ce1640e9a3de] | committer: Paul B Mahol avcodec/xpmdec: rename yet another function Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fbc1f323dbda521a693737fd9d98ce1640e9a3de --- libavcodec/xpmdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c index 7edb04c..25ef992 100644 --- a/libavcodec/xpmdec.c +++ b/libavcodec/xpmdec.c @@ -227,7 +227,7 @@ static size_t mod_strcspn(const char *string, const char *reject) return i; } -static uint32_t hexstring_to_rgba(const char *p, int len) +static uint32_t color_string_to_rgba(const char *p, int len) { uint32_t ret = 0xFF00; const ColorEntry *entry; @@ -378,7 +378,7 @@ static int xpm_decode_frame(AVCodecContext *avctx, void *data, if ((ret = ascii2index(index, cpp)) < 0) return ret; -x->pixels[ret] = hexstring_to_rgba(ptr, len); +x->pixels[ret] = color_string_to_rgba(ptr, len); ptr += mod_strcspn(ptr, ",") + 1; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/xpmdec: fix colors values which are different for X11
ffmpeg | branch: master | Paul B Mahol | Sun Mar 12 22:56:58 2017 +0100| [dd0090eb211219377bf43a034749d8e6524015eb] | committer: Paul B Mahol avcodec/xpmdec: fix colors values which are different for X11 Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dd0090eb211219377bf43a034749d8e6524015eb --- libavcodec/xpmdec.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c index 592f81a..b9b2551 100644 --- a/libavcodec/xpmdec.c +++ b/libavcodec/xpmdec.c @@ -92,8 +92,8 @@ static const ColorEntry color_table[] = { { "GhostWhite", 0xFFF8F8FF }, { "Gold", 0xD700 }, { "GoldenRod",0xFFDAA520 }, -{ "Gray", 0xFF808080 }, -{ "Green",0xFF008000 }, +{ "Gray", 0xFFBEBEBE }, +{ "Green",0xFF00FF00 }, { "GreenYellow", 0xFFADFF2F }, { "HoneyDew", 0xFFF0FFF0 }, { "HotPink", 0x69B4 }, @@ -122,7 +122,7 @@ static const ColorEntry color_table[] = { { "LimeGreen",0xFF32CD32 }, { "Linen",0xFFFAF0E6 }, { "Magenta", 0x00FF }, -{ "Maroon", 0xFF80 }, +{ "Maroon", 0xFFB03060 }, { "MediumAquaMarine", 0xFF66CDAA }, { "MediumBlue", 0xFFCD }, { "MediumOrchid", 0xFFBA55D3 }, @@ -155,7 +155,7 @@ static const ColorEntry color_table[] = { { "Pink", 0xC0CB }, { "Plum", 0xFFDDA0DD }, { "PowderBlue", 0xFFB0E0E6 }, -{ "Purple", 0xFF800080 }, +{ "Purple", 0xFFA020F0 }, { "Red", 0x }, { "RosyBrown",0xFFBC8F8F }, { "RoyalBlue",0xFF4169E1 }, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/xpmdec: rename convert to hex_char_to_number
ffmpeg | branch: master | Paul B Mahol | Sun Mar 12 22:42:05 2017 +0100| [9d7e71a233e33a3f1bf9a2b5a69f22dfa3613610] | committer: Paul B Mahol avcodec/xpmdec: rename convert to hex_char_to_number Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9d7e71a233e33a3f1bf9a2b5a69f22dfa3613610 --- libavcodec/xpmdec.c | 44 ++-- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c index ad6de3d..7edb04c 100644 --- a/libavcodec/xpmdec.c +++ b/libavcodec/xpmdec.c @@ -185,7 +185,7 @@ static const ColorEntry color_table[] = { { "YellowGreen", 0xFF9ACD32 } }; -static unsigned convert(uint8_t x) +static unsigned hex_char_to_number(uint8_t x) { if (x >= 'a' && x <= 'f') x -= 87; @@ -237,30 +237,30 @@ static uint32_t hexstring_to_rgba(const char *p, int len) p++; len--; if (len == 3) { -ret |= (convert(p[2]) << 4) | - (convert(p[1]) << 12) | - (convert(p[0]) << 20); +ret |= (hex_char_to_number(p[2]) << 4) | + (hex_char_to_number(p[1]) << 12) | + (hex_char_to_number(p[0]) << 20); } else if (len == 4) { -ret = (convert(p[3]) << 4) | - (convert(p[2]) << 12) | - (convert(p[1]) << 20) | - (convert(p[0]) << 28); +ret = (hex_char_to_number(p[3]) << 4) | + (hex_char_to_number(p[2]) << 12) | + (hex_char_to_number(p[1]) << 20) | + (hex_char_to_number(p[0]) << 28); } else if (len == 6) { -ret |= convert(p[5])| - (convert(p[4]) << 4) | - (convert(p[3]) << 8) | - (convert(p[2]) << 12) | - (convert(p[1]) << 16) | - (convert(p[0]) << 20); +ret |= hex_char_to_number(p[5])| + (hex_char_to_number(p[4]) << 4) | + (hex_char_to_number(p[3]) << 8) | + (hex_char_to_number(p[2]) << 12) | + (hex_char_to_number(p[1]) << 16) | + (hex_char_to_number(p[0]) << 20); } else if (len == 8) { -ret = convert(p[7])| - (convert(p[6]) << 4) | - (convert(p[5]) << 8) | - (convert(p[4]) << 12) | - (convert(p[3]) << 16) | - (convert(p[2]) << 20) | - (convert(p[1]) << 24) | - (convert(p[0]) << 28); +ret = hex_char_to_number(p[7])| + (hex_char_to_number(p[6]) << 4) | + (hex_char_to_number(p[5]) << 8) | + (hex_char_to_number(p[4]) << 12) | + (hex_char_to_number(p[3]) << 16) | + (hex_char_to_number(p[2]) << 20) | + (hex_char_to_number(p[1]) << 24) | + (hex_char_to_number(p[0]) << 28); } } else { strncpy(color_name, p, len); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/xpmdec: avoid "magic" numbers in function hex_char_to_number()
ffmpeg | branch: master | Paul B Mahol | Sun Mar 12 22:58:49 2017 +0100| [58f0bbc1eafbe21197bc53ad263005093182a7f2] | committer: Paul B Mahol avcodec/xpmdec: avoid "magic" numbers in function hex_char_to_number() Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=58f0bbc1eafbe21197bc53ad263005093182a7f2 --- libavcodec/xpmdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c index b9b2551..605a09d 100644 --- a/libavcodec/xpmdec.c +++ b/libavcodec/xpmdec.c @@ -188,9 +188,9 @@ static const ColorEntry color_table[] = { static unsigned hex_char_to_number(uint8_t x) { if (x >= 'a' && x <= 'f') -x -= 87; +x -= 'a' - 10; else if (x >= 'A' && x <= 'F') -x -= 55; +x -= 'A' - 10; else if (x >= '0' && x <= '9') x -= '0'; else ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/xpmdec: improve comment for one function and also fix 2 identation issues
ffmpeg | branch: master | Paul B Mahol | Sun Mar 12 22:37:53 2017 +0100| [7133ab435abb3e7ae1a7e6d9570343d07d0b0d87] | committer: Paul B Mahol avcodec/xpmdec: improve comment for one function and also fix 2 identation issues Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7133ab435abb3e7ae1a7e6d9570343d07d0b0d87 --- libavcodec/xpmdec.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c index 6cd7bde..ad6de3d 100644 --- a/libavcodec/xpmdec.c +++ b/libavcodec/xpmdec.c @@ -28,11 +28,11 @@ typedef struct XPMContext { uint32_t *pixels; -int pixels_size; +intpixels_size; } XPMDecContext; typedef struct ColorEntry { -const char *name;///< a string representing the name of the color +const char *name; ///< a string representing the name of the color uint32_trgb_color;///< RGB values for the color } ColorEntry; @@ -199,10 +199,8 @@ static unsigned convert(uint8_t x) } /* -** functions same as strcspn but ignores characters in reject if they are inside a C style comment... -** @param string, reject - same as that of strcspn -** @return length till any character in reject does not occur in string -*/ + * Function same as strcspn but ignores characters if they are inside a C style comments + */ static size_t mod_strcspn(const char *string, const char *reject) { int i, j; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/vp6: clear dimensions on failed resolution change in vp6_parse_header()
ffmpeg | branch: master | Michael Niedermayer | Sun Mar 12 03:04:06 2017 +0100| [967feea5ebb744dce97ab327d33502b43fca0c7f] | committer: Michael Niedermayer avcodec/vp6: clear dimensions on failed resolution change in vp6_parse_header() Fixes: 807/clusterfuzz-testcase-6470061042696192 Fixes null pointer dereference Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=967feea5ebb744dce97ab327d33502b43fca0c7f --- libavcodec/vp6.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c index f0e60a3..4afd67b 100644 --- a/libavcodec/vp6.c +++ b/libavcodec/vp6.c @@ -108,7 +108,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size) ret = ff_vp56_init_range_decoder(c, buf+6, buf_size-6); if (ret < 0) -return ret; +goto fail; vp56_rac_gets(c, 2); parse_filter_info = s->filter_header; @@ -162,9 +162,8 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size) buf += coeff_offset; buf_size -= coeff_offset; if (buf_size < 0) { -if (s->frames[VP56_FRAME_CURRENT]->key_frame) -ff_set_dimensions(s->avctx, 0, 0); -return AVERROR_INVALIDDATA; +ret = AVERROR_INVALIDDATA; +goto fail; } if (s->use_huffman) { s->parse_coeff = vp6_parse_coeff_huffman; @@ -172,7 +171,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size) } else { ret = ff_vp56_init_range_decoder(&s->cc, buf, buf_size); if (ret < 0) -return ret; +goto fail; s->ccp = &s->cc; } } else { @@ -180,6 +179,10 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size) } return res; +fail: +if (res == VP56_SIZE_CHANGE) +ff_set_dimensions(s->avctx, 0, 0); +return ret; } static void vp6_coeff_order_table_init(VP56Context *s) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/mpeg12dec: Fix runtime error: left shift of negative value -1
ffmpeg | branch: master | Michael Niedermayer | Sun Mar 12 03:04:04 2017 +0100| [a720b854b0d3f0fae2b1eac644dd39e5821cacb1] | committer: Michael Niedermayer avcodec/mpeg12dec: Fix runtime error: left shift of negative value -1 Fixes: 764/clusterfuzz-testcase-6273034652483584 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a720b854b0d3f0fae2b1eac644dd39e5821cacb1 --- libavcodec/mpeg12dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 27db14c..e49167f 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -994,7 +994,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64]) cbp = get_vlc2(&s->gb, ff_mb_pat_vlc.table, MB_PAT_VLC_BITS, 1); if (mb_block_count > 6) { -cbp <<= mb_block_count - 6; +cbp *= 1 << mb_block_count - 6; cbp |= get_bits(&s->gb, mb_block_count - 6); s->bdsp.clear_blocks(s->block[6]); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/rv34: Fix runtime error: signed integer overflow: 36880 * 66288 cannot be represented in type 'int'
ffmpeg | branch: master | Michael Niedermayer | Sun Mar 12 03:04:05 2017 +0100| [a66c6e28b543804f50df1c6083a204219b6b1daa] | committer: Michael Niedermayer avcodec/rv34: Fix runtime error: signed integer overflow: 36880 * 66288 cannot be represented in type 'int' Fixes: 768/clusterfuzz-testcase-4807444305805312 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a66c6e28b543804f50df1c6083a204219b6b1daa --- libavcodec/rv34.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index be49804..d2d676a 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -1636,7 +1636,7 @@ static AVRational update_sar(int old_w, int old_h, AVRational sar, int new_w, in if (!sar.num) sar = (AVRational){1, 1}; -sar = av_mul_q(sar, (AVRational){new_h * old_w, new_w * old_h}); +sar = av_mul_q(sar, av_mul_q((AVRational){new_h, new_w}, (AVRational){old_w, old_h})); return sar; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/hlsenc: second_levels flags process function extract
ffmpeg | branch: master | Steven Liu | Mon Mar 13 11:58:34 2017 +0800| [33e997d992ccd4e93b57fa7dfb478fc6a67ce4ac] | committer: Steven Liu avformat/hlsenc: second_levels flags process function extract the SECOND_LEVEL* flags process and name is too long extract all of them output to funtions, make code clear Signed-off-by: Steven Liu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=33e997d992ccd4e93b57fa7dfb478fc6a67ce4ac --- libavformat/hlsenc.c | 239 +-- 1 file changed, 136 insertions(+), 103 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index b8122f1..5df2514 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -470,17 +470,9 @@ static HLSSegment *find_segment_by_filename(HLSSegment *segment, const char *fil return (HLSSegment *) NULL; } -/* Create a new segment and append it to the segment list */ -static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double duration, - int64_t pos, int64_t size) +static int sls_flags_filename_process(struct AVFormatContext *s, HLSContext *hls, HLSSegment *en, double duration, + int64_t pos, int64_t size) { -HLSSegment *en = av_malloc(sizeof(*en)); -const char *filename; -int ret; - -if (!en) -return AVERROR(ENOMEM); - if ((hls->flags & (HLS_SECOND_LEVEL_SEGMENT_SIZE | HLS_SECOND_LEVEL_SEGMENT_DURATION)) && strlen(hls->current_segment_final_filename_fmt)) { av_strlcpy(hls->avf->filename, hls->current_segment_final_filename_fmt, sizeof(hls->avf->filename)); @@ -521,7 +513,127 @@ static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double av_free(filename); } } +return 0; +} + +static int sls_flag_check_duration_size_index(HLSContext *hls) +{ +int ret = 0; + +if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_DURATION) { + av_log(hls, AV_LOG_ERROR, +"second_level_segment_duration hls_flag requires use_localtime to be true\n"); + ret = AVERROR(EINVAL); +} +if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_SIZE) { + av_log(hls, AV_LOG_ERROR, +"second_level_segment_size hls_flag requires use_localtime to be true\n"); + ret = AVERROR(EINVAL); +} +if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_INDEX) { +av_log(hls, AV_LOG_ERROR, + "second_level_segment_index hls_flag requires use_localtime to be true\n"); +ret = AVERROR(EINVAL); +} + +return ret; +} + +static int sls_flag_check_duration_size(HLSContext *hls) +{ +const char *proto = avio_find_protocol_name(hls->basename); +int segment_renaming_ok = proto && !strcmp(proto, "file"); +int ret = 0; + +if ((hls->flags & HLS_SECOND_LEVEL_SEGMENT_DURATION) && !segment_renaming_ok) { + av_log(hls, AV_LOG_ERROR, +"second_level_segment_duration hls_flag works only with file protocol segment names\n"); + ret = AVERROR(EINVAL); +} +if ((hls->flags & HLS_SECOND_LEVEL_SEGMENT_SIZE) && !segment_renaming_ok) { + av_log(hls, AV_LOG_ERROR, +"second_level_segment_size hls_flag works only with file protocol segment names\n"); + ret = AVERROR(EINVAL); +} + +return ret; +} + +static void sls_flag_file_rename(HLSContext *hls, char *old_filename) { +if ((hls->flags & (HLS_SECOND_LEVEL_SEGMENT_SIZE | HLS_SECOND_LEVEL_SEGMENT_DURATION)) && +strlen(hls->current_segment_final_filename_fmt)) { +ff_rename(old_filename, hls->avf->filename, hls); +} +} + +static int sls_flag_use_localtime_filename(AVFormatContext *oc, HLSContext *c) +{ +if (c->flags & HLS_SECOND_LEVEL_SEGMENT_INDEX) { +char * filename = av_strdup(oc->filename); // %%d will be %d after strftime +if (!filename) +return AVERROR(ENOMEM); +if (replace_int_data_in_filename(oc->filename, sizeof(oc->filename), +#if FF_API_HLS_WRAP +filename, 'd', c->wrap ? c->sequence % c->wrap : c->sequence) < 1) { +#else +filename, 'd', c->sequence) < 1) { +#endif +av_log(c, AV_LOG_ERROR, "Invalid second level segment filename template '%s', " +"you can try to remove second_level_segment_index flag\n", + filename); +av_free(filename); +return AVERROR(EINVAL); +} +av_free(filename); +} +if (c->flags & (HLS_SECOND_LEVEL_SEGMENT_SIZE | HLS_SECOND_LEVEL_SEGMENT_DURATION)) { +av_strlcpy(c->current_segment_final_filename_fmt, oc->filename, + sizeof(c->current_segment_final_filename_fmt)); +if (c->flags & HLS_SECOND_LEVEL_SEGMENT_SIZE) { +char * filename = av_strdup(oc->filename); // %%s will be %s after strftime +if (!filename) +return AVERROR(ENOMEM);