Re: [FFmpeg-devel] [PATCH 4/4] lavfi/opencl: remove peak option of tonemap_opencl
On Mon, Oct 29, 2018 at 1:21 PM Ruiling Song wrote: > > Since the filter use auto-calculate the peak value, > the option does not work as expected. So, remove it. > > Signed-off-by: Ruiling Song > --- > libavfilter/vf_tonemap_opencl.c | 7 ++- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/libavfilter/vf_tonemap_opencl.c b/libavfilter/vf_tonemap_opencl.c > index cd293c2..88b3107 100644 > --- a/libavfilter/vf_tonemap_opencl.c > +++ b/libavfilter/vf_tonemap_opencl.c > @@ -62,7 +62,6 @@ typedef struct TonemapOpenCLContext { > > enum TonemapAlgorithm tonemap; > enum AVPixelFormatformat; > -doublepeak; > doubleparam; > doubledesat_param; > doubletarget_peak; > @@ -349,7 +348,7 @@ static int tonemap_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input) > AVFrame *output = NULL; > cl_int cle; > int err; > -double peak = ctx->peak; > +double peak; > > AVHWFramesContext *input_frames_ctx = > (AVHWFramesContext*)input->hw_frames_ctx->data; > @@ -371,8 +370,7 @@ static int tonemap_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input) > if (err < 0) > goto fail; > > -if (!peak) > -peak = ff_determine_signal_peak(input); > +peak = ff_determine_signal_peak(input); > > if (ctx->trc != -1) > output->color_trc = ctx->trc; > @@ -518,7 +516,6 @@ static const AVOption tonemap_opencl_options[] = { > { "limited", 0, 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_RANGE_MPEG}, 0, 0, FLAGS, "range" }, > { "full", 0, 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_RANGE_JPEG}, 0, 0, FLAGS, "range" }, > { "format","output pixel format", OFFSET(format), AV_OPT_TYPE_PIXEL_FMT, {.i64 = AV_PIX_FMT_NONE}, AV_PIX_FMT_NONE, INT_MAX, FLAGS, "fmt" }, > -{ "peak", "signal peak override", OFFSET(peak), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, DBL_MAX, FLAGS }, > { "param", "tonemap parameter", OFFSET(param), AV_OPT_TYPE_DOUBLE, {.dbl = NAN}, DBL_MIN, DBL_MAX, FLAGS }, > { "desat", "desaturation parameter", OFFSET(desat_param), AV_OPT_TYPE_DOUBLE, {.dbl = 0.5}, 0, DBL_MAX, FLAGS }, > { "threshold", "scene detection threshold", OFFSET(scene_threshold), AV_OPT_TYPE_DOUBLE, {.dbl = 0.2}, 0, DBL_MAX, FLAGS }, > -- LGTM if we don't use this option ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] add an option to forbid the fallback to sw when hardware init fails
Currently ff_get_format will go through all usable choices if the chosen format was not supported. It will fallback to software if the hardware init fails. According to the comment in ticket #7519, provided an option "-fallback_forbid 1" to return directly if hardware init fails and forbid the fallback to software. Signed-off-by: Linjie Fu --- libavcodec/avcodec.h | 8 libavcodec/decode.c| 11 +-- libavcodec/options_table.h | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 705a3ce4f3..fac3c6acb2 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3312,6 +3312,14 @@ typedef struct AVCodecContext { * used as reference pictures). */ int extra_hw_frames; + +/** + * - forbid the fallback to software path in ff_get_format + * - when the hardware init fails. (0 -> disabled) + * - encoding: unused. + * - decoding: Set by user. + */ +int fallback_forbid; } AVCodecContext; #if FF_API_CODEC_GET_SET diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 4607e9f318..edadbd7e03 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1441,8 +1441,15 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt) av_log(avctx, AV_LOG_DEBUG, "Format %s requires hwaccel " "initialisation.\n", desc->name); err = hwaccel_init(avctx, hw_config); -if (err < 0) -goto try_again; +if (err < 0) { +if (avctx->fallback_forbid) { +av_log(avctx, AV_LOG_ERROR, "Format %s not usable, fallback " +"was forbidden.\n", desc->name); +ret = AV_PIX_FMT_NONE; +break; +} else +goto try_again; +} } ret = user_choice; break; diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index 099261e168..73f0333eeb 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -479,6 +479,7 @@ static const AVOption avcodec_options[] = { {"allow_high_depth", "allow to output YUV pixel formats with a different chroma sampling than 4:2:0 and/or other than 8 bits per component", 0, AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH }, INT_MIN, INT_MAX, V | D, "hwaccel_flags"}, {"allow_profile_mismatch", "attempt to decode anyway if HW accelerated decoder's supported profiles do not exactly match the stream", 0, AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH }, INT_MIN, INT_MAX, V | D, "hwaccel_flags"}, {"extra_hw_frames", "Number of extra hardware frames to allocate for the user", OFFSET(extra_hw_frames), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, V|D }, +{"fallback_forbid", "forbid the fallback to software path when hardware init fails", OFFSET(fallback_forbid), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, V|D }, {NULL}, }; -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] add an option to forbid the fallback to sw when hardware init fails
On Tue, Oct 30, 2018 at 10:08 AM Linjie Fu wrote: > > Currently ff_get_format will go through all usable choices if the > chosen format was not supported. It will fallback to software if > the hardware init fails. > > According to the comment in ticket #7519, provided an option > "-fallback_forbid 1" to return directly if hardware init fails > and forbid the fallback to software. > > Signed-off-by: Linjie Fu > --- > libavcodec/avcodec.h | 8 > libavcodec/decode.c| 11 +-- > libavcodec/options_table.h | 1 + > 3 files changed, 18 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index 705a3ce4f3..fac3c6acb2 100644 > --- a/libavcodec/avcodec.h > +++ b/libavcodec/avcodec.h > @@ -3312,6 +3312,14 @@ typedef struct AVCodecContext { > * used as reference pictures). > */ > int extra_hw_frames; > + > +/** > + * - forbid the fallback to software path in ff_get_format > + * - when the hardware init fails. (0 -> disabled) > + * - encoding: unused. > + * - decoding: Set by user. > + */ > +int fallback_forbid; > } AVCodecContext; > This is really something user-code should implement, its easy enough to detect in eg. get_buffer2, and return an error from there. - Hendrik ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/5] lavc/qsvenc: add an option to set h264 pps for every frame
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf > Of Moritz Barsnick > Sent: Friday, October 26, 2018 7:49 PM > To: FFmpeg development discussions and patches > > Subject: Re: [FFmpeg-devel] [PATCH 4/5] lavc/qsvenc: add an option to set > h264 pps for every frame > > On Thu, Oct 25, 2018 at 20:36:10 +0800, Zhong Li wrote: > > RepeatPPS is enabled by default in mfx. It is not necessary mostly and > > wasting encoding bits. > > Add an option to control it and disable it by default. > > Could this change in behavior surprise anyone? If it's okay to change, > perhaps at least bump lavc's micro version? > > Moritz I doubt how many people would like to repeat every frame's pps. Most codecs (x264/x265, and nvenc) won't do that by default. Bumping lavc micro version should be a good suggestion. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/5] lavc/qsvenc: add forced_idr opiton
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf > Of Mark Thompson > Sent: Tuesday, October 30, 2018 5:06 AM > To: ffmpeg-devel@ffmpeg.org > Subject: Re: [FFmpeg-devel] [PATCH 1/5] lavc/qsvenc: add forced_idr opiton > > On 25/10/18 13:36, Zhong Li wrote: > > This option can be used to repect original input I/IDR frame type. > > > > Signed-off-by: Zhong Li > > --- > > libavcodec/qsvenc.c | 7 +++ > > libavcodec/qsvenc.h | 2 ++ > > 2 files changed, 9 insertions(+) > > > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index > > 948751d..e534dcf 100644 > > --- a/libavcodec/qsvenc.c > > +++ b/libavcodec/qsvenc.c > > @@ -1192,6 +1192,13 @@ static int encode_frame(AVCodecContext > *avctx, QSVEncContext *q, > > if (qsv_frame) { > > surf = &qsv_frame->surface; > > enc_ctrl = &qsv_frame->enc_ctrl; > > + > > +if (q->forced_idr >= 0 && frame->pict_type == > AV_PICTURE_TYPE_I) { > > +enc_ctrl->FrameType = MFX_FRAMETYPE_I | > MFX_FRAMETYPE_REF; > > +if (q->forced_idr || frame->key_frame) > > +enc_ctrl->FrameType |= MFX_FRAMETYPE_IDR; > > +} else > > +enc_ctrl->FrameType = MFX_FRAMETYPE_UNKNOWN; > > } > > > > ret = av_new_packet(&new_pkt, q->packet_size); diff --git > > a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index 055b4a6..1f97f77 > > 100644 > > --- a/libavcodec/qsvenc.h > > +++ b/libavcodec/qsvenc.h > > @@ -87,6 +87,7 @@ > > { "adaptive_i", "Adaptive I-frame placement", > OFFSET(qsv.adaptive_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, > 1, VE }, \ > > { "adaptive_b", "Adaptive B-frame placement", > OFFSET(qsv.adaptive_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, > 1, VE }, \ > > { "b_strategy", "Strategy to choose between I/P/B-frames", > OFFSET(qsv.b_strategy),AV_OPT_TYPE_INT, { .i64 = -1 }, -1, > 1, VE }, \ > > +{ "forced_idr", "Forcing I frames as IDR frames", > OFFSET(qsv.forced_idr), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, > 1, VE }, \ > > > > typedef int SetEncodeCtrlCB (AVCodecContext *avctx, > > const AVFrame *frame, > mfxEncodeCtrl* > > enc_ctrl); @@ -168,6 +169,7 @@ typedef struct QSVEncContext { #endif > > char *load_plugins; > > SetEncodeCtrlCB *set_encode_ctrl_cb; > > +int forced_idr; > > } QSVEncContext; > > > > int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q); > > > > This seems confusing, because it doesn't match what forced_idr does in any > other encoder. > > Checking of pict_type for AV_PICTURE_TYPE_I in order to get a key frame > (of whatever kind) is always enabled if supported (many encoders). The > "forced_idr" option to H.26[45] encoders (libx264, libx265) then forces that > to be an IDR frame, not just an I frame. > > - Mark Yup, I know it doesn’t match other encoders such as libx264/libx265/nvenc. However, it is my intentional behavior. I believe current implement in libx264/libx265 is not complete. One case is ignored: user just want to keep the gop structure as input, not to force all I frames as IDR frames. So I have an idea: Default value = -1, ignore the input gop structure. 0: respect input gop structure but don't force I frame as IDR frame. 1: force all I frame as IDR frame. Since this is a qsv encoder private option, I just changed qsv implementation. But I believe it should be a good to make other encoders follow such a way with separated patches. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avfilter: add tpad filter
Signed-off-by: Paul B Mahol --- doc/filters.texi | 22 ++ libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/vf_tpad.c| 166 +++ 4 files changed, 190 insertions(+) create mode 100644 libavfilter/vf_tpad.c diff --git a/doc/filters.texi b/doc/filters.texi index 9b84b1145b..6dda780aa0 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -16676,6 +16676,28 @@ embedded peak information in display metadata is not reliable or when tone mapping from a lower range to a higher range. @end table +@section tpad + +Temporarily pad video frames. + +The filter accepts the following options: + +@table @option +@item start +Specify number of delay frames before input video stream. + +@item stop +Specify number of padding frames after input video stream. +Set to -1 to pad indefinitely. + +@item color +Specify the color of the padded area. For the syntax of this option, +check the @ref{color syntax,,"Color" section in the ffmpeg-utils +manual,ffmpeg-utils}. + +The default value of @var{color} is "black". +@end table + @anchor{transpose} @section transpose diff --git a/libavfilter/Makefile b/libavfilter/Makefile index c35cd8f422..51e48efc2e 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -383,6 +383,7 @@ OBJS-$(CONFIG_TMIX_FILTER) += vf_mix.o framesync.o OBJS-$(CONFIG_TONEMAP_FILTER)+= vf_tonemap.o colorspace.o OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) += vf_tonemap_opencl.o colorspace.o opencl.o \ opencl/tonemap.o opencl/colorspace_common.o +OBJS-$(CONFIG_TPAD_FILTER) += vf_tpad.o OBJS-$(CONFIG_TRANSPOSE_FILTER) += vf_transpose.o OBJS-$(CONFIG_TRANSPOSE_NPP_FILTER) += vf_transpose_npp.o OBJS-$(CONFIG_TRIM_FILTER) += trim.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index d5a211bda5..6052cb8c3c 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -365,6 +365,7 @@ extern AVFilter ff_vf_tlut2; extern AVFilter ff_vf_tmix; extern AVFilter ff_vf_tonemap; extern AVFilter ff_vf_tonemap_opencl; +extern AVFilter ff_vf_tpad; extern AVFilter ff_vf_transpose; extern AVFilter ff_vf_transpose_npp; extern AVFilter ff_vf_trim; diff --git a/libavfilter/vf_tpad.c b/libavfilter/vf_tpad.c new file mode 100644 index 00..e59037ca56 --- /dev/null +++ b/libavfilter/vf_tpad.c @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2018 Paul B Mahol + * + * 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 + */ + +#include "libavutil/avassert.h" +#include "libavutil/channel_layout.h" +#include "libavutil/opt.h" +#include "avfilter.h" +#include "audio.h" +#include "filters.h" +#include "internal.h" +#include "formats.h" +#include "drawutils.h" + +typedef struct TPadContext { +const AVClass *class; +int pad_start; +int pad_stop; +uint8_t rgba_color[4]; ///< color for the padding area + +FFDrawContext draw; +FFDrawColor color; +int64_t pts; +int eof; +} TPadContext; + +#define OFFSET(x) offsetof(TPadContext, x) +#define VF AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM + +static const AVOption tpad_options[] = { +{ "start", "set the number of frames to delay input", OFFSET(pad_start), AV_OPT_TYPE_INT, {.i64=0},0, INT_MAX, VF }, +{ "stop", "set the number of frames to add after input finished", OFFSET(pad_stop), AV_OPT_TYPE_INT, {.i64=0}, -1, INT_MAX, VF }, +{ "color", "set the color of the added frames", OFFSET(rgba_color), AV_OPT_TYPE_COLOR, {.str="black"}, 0, 0, VF }, +{ NULL } +}; + +AVFILTER_DEFINE_CLASS(tpad); + +static int query_formats(AVFilterContext *ctx) +{ +return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0)); +} + +static int activate(AVFilterContext *ctx) +{ +AVFilterLink *inlink = ctx->inputs[0]; +AVFilterLink *outlink = ctx->outputs[0]; +TPadContext *s = ctx->priv; +AVFrame *frame = NULL; +int ret, status; +int64_t pts; + +FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); + +if (s->pad_start > 0 && ff_outlink_frame_wanted(outlink)) { +frame = ff_get_video_buffer(o
Re: [FFmpeg-devel] [PATCH 1/5] lavc/qsvenc: add forced_idr opiton
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf > Of Moritz Barsnick > Sent: Friday, October 26, 2018 7:46 PM > To: FFmpeg development discussions and patches > > Subject: Re: [FFmpeg-devel] [PATCH 1/5] lavc/qsvenc: add forced_idr opiton > > On Thu, Oct 25, 2018 at 20:36:07 +0800, Zhong Li wrote: > > +{ "forced_idr", "Forcing I frames as IDR frames", > OFFSET(qsv.forced_idr), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, > 1, VE }, \ > > ffmpeg uses imperative (mostly): "Force I frames as IDR frames". > > Moritz Agree. Will update. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/5] lavc/qsvenc: add forced_idr opiton
> From: Rogozhkin, Dmitry V > Sent: Tuesday, October 30, 2018 5:07 AM > To: ffmpeg-devel@ffmpeg.org > Cc: Li, Zhong > Subject: Re: [FFmpeg-devel] [PATCH 1/5] lavc/qsvenc: add forced_idr opiton > > On Thu, 2018-10-25 at 20:36 +0800, Zhong Li wrote: > > This option can be used to repect original input I/IDR frame type. > > > > Signed-off-by: Zhong Li > > --- > > libavcodec/qsvenc.c | 7 +++ > > libavcodec/qsvenc.h | 2 ++ > > 2 files changed, 9 insertions(+) > > > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index > > 948751d..e534dcf 100644 > > --- a/libavcodec/qsvenc.c > > +++ b/libavcodec/qsvenc.c > > @@ -1192,6 +1192,13 @@ static int encode_frame(AVCodecContext > *avctx, > > QSVEncContext *q, > > if (qsv_frame) { > > surf = &qsv_frame->surface; > > enc_ctrl = &qsv_frame->enc_ctrl; > > + > > +if (q->forced_idr >= 0 && frame->pict_type == > > AV_PICTURE_TYPE_I) { > > +enc_ctrl->FrameType = MFX_FRAMETYPE_I | > > MFX_FRAMETYPE_REF; > > +if (q->forced_idr || frame->key_frame) > > +enc_ctrl->FrameType |= MFX_FRAMETYPE_IDR; > > Hm. There is another option "-force_key_frames" which looks unhandled > here. At least I don't understand "|| frame->key_frame"... > > > > +} else > > +enc_ctrl->FrameType = MFX_FRAMETYPE_UNKNOWN; > > "else" block don't make much sense to me. You eventually already had > enc_ctrl structure passed to the encoder. Thus, it should be initialized to > default (already). And you don't make anything specific/new in the "else". > From my perspective "else" just obscures the code and should be dropped. This was a case I had concern. I doubt the default initialization is always zero (you know MFX_FRAMETYPE_UNKNOWN is zero). Isn't it possible? Please check the regression case I fixed: https://patchwork.ffmpeg.org/patch/10517/ > > } > > > > ret = av_new_packet(&new_pkt, q->packet_size); diff --git > > a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index 055b4a6..1f97f77 > > 100644 > > --- a/libavcodec/qsvenc.h > > +++ b/libavcodec/qsvenc.h > > @@ -87,6 +87,7 @@ > > { "adaptive_i", "Adaptive I-frame placement", > > OFFSET(qsv.adaptive_i), AV_OPT_TYPE_INT, { .i64 = -1 }, > -1, > > 1, VE }, \ > > { "adaptive_b", "Adaptive B-frame > placement", > > OFFSET(qsv.adaptive_b), AV_OPT_TYPE_INT, { .i64 = -1 }, > -1, > > 1, VE }, \ > > { "b_strategy", "Strategy to choose between I/P/B-frames", > > OFFSET(qsv.b_strategy),AV_OPT_TYPE_INT, { .i64 = -1 }, > -1, > > 1, VE }, \ > > +{ "forced_idr", "Forcing I frames as IDR > > frames", OFFSET(qsv.forced_idr), AV_OPT_TYPE_INT, > { .i64 = > > -1 }, -1, 1, VE }, \ > > As pointed out in other mail, I think this should be "force_idr" option and > "Force I frames as IDR frames" as an option description. Secondly, why > there are 3 values accepted: -1, 0, 1? I can understand 1 as enable the > feature and 0 as don't enable, but what is -1? Please check my reply to Mark. And grep forced_idr implementation in nvenc. >Also, how the option correlates with "-force_key_frames"? > > From this perspective shouldn't the code be: > > { "force_idr", "Force I frames as IDR > frames", OFFSET(qsv.force_idr), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, > > if (frame->pict_type == AV_PICTURE_TYPE_I && (frame->key_frame || q- > >force_idr)) { > enc_ctrl->FrameType = MFX_FRAMETYPE_I | MFX_FRAMETYPE_REF; > if (q->force_idr) > enc_ctrl->FrameType |= MFX_FRAMETYPE_IDR; } > > This assumes that frame->key_frame corresponds to "-force_key_frames" > in which I am not quite sure... > > > > > typedef int SetEncodeCtrlCB (AVCodecContext *avctx, > > const AVFrame *frame, > mfxEncodeCtrl* > > enc_ctrl); @@ -168,6 +169,7 @@ typedef struct QSVEncContext { > > #endif > > char *load_plugins; > > SetEncodeCtrlCB *set_encode_ctrl_cb; > > +int forced_idr; > > int force_idr; > > if agreed on the above... > > > } QSVEncContext; > > > > int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q); I assume the reset of your comments have been replied by others. No? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add tpad filter
On Tue, Oct 30, 2018 at 3:27 PM Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > doc/filters.texi | 22 ++ > libavfilter/Makefile | 1 + > libavfilter/allfilters.c | 1 + > libavfilter/vf_tpad.c| 166 +++ > 4 files changed, 190 insertions(+) > create mode 100644 libavfilter/vf_tpad.c > > diff --git a/doc/filters.texi b/doc/filters.texi > index 9b84b1145b..6dda780aa0 100644 > --- a/doc/filters.texi > +++ b/doc/filters.texi > @@ -16676,6 +16676,28 @@ embedded peak information in display metadata is > not reliable or when tone > mapping from a lower range to a higher range. > @end table > > +@section tpad > + > +Temporarily pad video frames. > + > +The filter accepts the following options: > + > +@table @option > +@item start > +Specify number of delay frames before input video stream. > + > +@item stop > +Specify number of padding frames after input video stream. > +Set to -1 to pad indefinitely. > + > +@item color > +Specify the color of the padded area. For the syntax of this option, > +check the @ref{color syntax,,"Color" section in the ffmpeg-utils > +manual,ffmpeg-utils}. > + > +The default value of @var{color} is "black". > +@end table > + > @anchor{transpose} > @section transpose > > diff --git a/libavfilter/Makefile b/libavfilter/Makefile > index c35cd8f422..51e48efc2e 100644 > --- a/libavfilter/Makefile > +++ b/libavfilter/Makefile > @@ -383,6 +383,7 @@ OBJS-$(CONFIG_TMIX_FILTER) += > vf_mix.o framesync.o > OBJS-$(CONFIG_TONEMAP_FILTER)+= vf_tonemap.o colorspace.o > OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) += vf_tonemap_opencl.o > colorspace.o opencl.o \ > opencl/tonemap.o > opencl/colorspace_common.o > +OBJS-$(CONFIG_TPAD_FILTER) += vf_tpad.o > OBJS-$(CONFIG_TRANSPOSE_FILTER) += vf_transpose.o > OBJS-$(CONFIG_TRANSPOSE_NPP_FILTER) += vf_transpose_npp.o > OBJS-$(CONFIG_TRIM_FILTER) += trim.o > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c > index d5a211bda5..6052cb8c3c 100644 > --- a/libavfilter/allfilters.c > +++ b/libavfilter/allfilters.c > @@ -365,6 +365,7 @@ extern AVFilter ff_vf_tlut2; > extern AVFilter ff_vf_tmix; > extern AVFilter ff_vf_tonemap; > extern AVFilter ff_vf_tonemap_opencl; > +extern AVFilter ff_vf_tpad; > extern AVFilter ff_vf_transpose; > extern AVFilter ff_vf_transpose_npp; > extern AVFilter ff_vf_trim; > diff --git a/libavfilter/vf_tpad.c b/libavfilter/vf_tpad.c > new file mode 100644 > index 00..e59037ca56 > --- /dev/null > +++ b/libavfilter/vf_tpad.c > @@ -0,0 +1,166 @@ > +/* > + * Copyright (c) 2018 Paul B Mahol > + * > + * 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 > + */ > + > +#include "libavutil/avassert.h" > +#include "libavutil/channel_layout.h" > +#include "libavutil/opt.h" > +#include "avfilter.h" > +#include "audio.h" > +#include "filters.h" > +#include "internal.h" > +#include "formats.h" > +#include "drawutils.h" > + > +typedef struct TPadContext { > +const AVClass *class; > +int pad_start; > +int pad_stop; > +uint8_t rgba_color[4]; ///< color for the padding area > + > +FFDrawContext draw; > +FFDrawColor color; > +int64_t pts; > +int eof; > +} TPadContext; > + > +#define OFFSET(x) offsetof(TPadContext, x) > +#define VF AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM > + > +static const AVOption tpad_options[] = { > +{ "start", "set the number of frames to delay input", > OFFSET(pad_start), AV_OPT_TYPE_INT, {.i64=0},0, INT_MAX, VF }, > +{ "stop", "set the number of frames to add after input finished", > OFFSET(pad_stop), AV_OPT_TYPE_INT, {.i64=0}, -1, INT_MAX, VF }, > +{ "color", "set the color of the added frames", > OFFSET(rgba_color), AV_OPT_TYPE_COLOR, {.str="black"}, 0, 0, VF }, > +{ NULL } > +}; > + > +AVFILTER_DEFINE_CLASS(tpad); > + > +static int query_formats(AVFilterContext *ctx) > +{ > +return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0)); > +} > + > +static int activate(AVFilterContext *ctx) > +{ > +AVFilterLink *inlink = ctx->inputs[0]; > +AVFilt
[FFmpeg-devel] [PATCH] correct the max value of swscale option with type AV_OPT_TYPE_PIXEL_FMT
Signed-off-by: Guo, Yejun --- libswscale/options.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libswscale/options.c b/libswscale/options.c index 7eb2752..db8210b 100644 --- a/libswscale/options.c +++ b/libswscale/options.c @@ -57,8 +57,8 @@ static const AVOption swscale_options[] = { { "srch","source height", OFFSET(srcH), AV_OPT_TYPE_INT,{ .i64 = 16 }, 1, INT_MAX,VE }, { "dstw","destination width", OFFSET(dstW), AV_OPT_TYPE_INT,{ .i64 = 16 }, 1, INT_MAX,VE }, { "dsth","destination height",OFFSET(dstH), AV_OPT_TYPE_INT,{ .i64 = 16 }, 1, INT_MAX,VE }, -{ "src_format", "source format", OFFSET(srcFormat), AV_OPT_TYPE_PIXEL_FMT,{ .i64 = DEFAULT }, 0, INT_MAX, VE }, -{ "dst_format", "destination format",OFFSET(dstFormat), AV_OPT_TYPE_PIXEL_FMT,{ .i64 = DEFAULT }, 0, INT_MAX, VE }, +{ "src_format", "source format", OFFSET(srcFormat), AV_OPT_TYPE_PIXEL_FMT,{ .i64 = DEFAULT }, 0, AV_PIX_FMT_NB, VE }, +{ "dst_format", "destination format",OFFSET(dstFormat), AV_OPT_TYPE_PIXEL_FMT,{ .i64 = DEFAULT }, 0, AV_PIX_FMT_NB, VE }, { "src_range", "source is full range", OFFSET(srcRange), AV_OPT_TYPE_BOOL, { .i64 = DEFAULT}, 0, 1, VE }, { "dst_range", "destination is full range", OFFSET(dstRange), AV_OPT_TYPE_BOOL, { .i64 = DEFAULT}, 0, 1, VE }, { "param0", "scaler param 0",OFFSET(param[0]), AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT }, INT_MIN, INT_MAX,VE }, -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] correct the max value of swscale option with type AV_OPT_TYPE_PIXEL_FMT
On 10/30/18, Guo, Yejun wrote: > Signed-off-by: Guo, Yejun > --- > libswscale/options.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libswscale/options.c b/libswscale/options.c > index 7eb2752..db8210b 100644 > --- a/libswscale/options.c > +++ b/libswscale/options.c > @@ -57,8 +57,8 @@ static const AVOption swscale_options[] = { > { "srch","source height", OFFSET(srcH), > AV_OPT_TYPE_INT,{ .i64 = 16 }, 1, INT_MAX, > VE }, > { "dstw","destination width", OFFSET(dstW), > AV_OPT_TYPE_INT,{ .i64 = 16 }, 1, INT_MAX, > VE }, > { "dsth","destination height",OFFSET(dstH), > AV_OPT_TYPE_INT,{ .i64 = 16 }, 1, INT_MAX, > VE }, > -{ "src_format", "source format", > OFFSET(srcFormat), AV_OPT_TYPE_PIXEL_FMT,{ .i64 = DEFAULT }, 0, > INT_MAX, VE }, > -{ "dst_format", "destination format", > OFFSET(dstFormat), AV_OPT_TYPE_PIXEL_FMT,{ .i64 = DEFAULT }, 0, > INT_MAX, VE }, > +{ "src_format", "source format", > OFFSET(srcFormat), AV_OPT_TYPE_PIXEL_FMT,{ .i64 = DEFAULT }, 0, > AV_PIX_FMT_NB, VE }, > +{ "dst_format", "destination format", > OFFSET(dstFormat), AV_OPT_TYPE_PIXEL_FMT,{ .i64 = DEFAULT }, 0, > AV_PIX_FMT_NB, VE }, > { "src_range", "source is full range", OFFSET(srcRange), > AV_OPT_TYPE_BOOL, { .i64 = DEFAULT}, 0, 1, > VE }, > { "dst_range", "destination is full range", OFFSET(dstRange), > AV_OPT_TYPE_BOOL, { .i64 = DEFAULT}, 0, 1, > VE }, > { "param0", "scaler param 0",OFFSET(param[0]), > AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT }, INT_MIN, INT_MAX, > VE }, > -- > 2.7.4 This is wrong, First it does not uses NB-1 and second it is not needed at all. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avfilter: add tpad filter
Signed-off-by: Paul B Mahol --- doc/filters.texi | 40 +++ libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/vf_tpad.c| 218 +++ 4 files changed, 260 insertions(+) create mode 100644 libavfilter/vf_tpad.c diff --git a/doc/filters.texi b/doc/filters.texi index 9b84b1145b..76eec2e918 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -16676,6 +16676,46 @@ embedded peak information in display metadata is not reliable or when tone mapping from a lower range to a higher range. @end table +@section tpad + +Temporarily pad video frames. + +The filter accepts the following options: + +@table @option +@item start +Specify number of delay frames before input video stream. + +@item stop +Specify number of padding frames after input video stream. +Set to -1 to pad indefinitely. + +@item start_mode +Set kind of frames added to beginning of stream. +Can be either @var{add} or @var{clone}. +With @var{add} frames of solid-color are added. +With @var{clone} frames are clones of first frame. + +@item stop_mode +Set kind of frames added to end of stream. +Can be either @var{add} or @var{clone}. +With @var{add} frames of solid-color are added. +With @var{clone} frames are clones of last frame. + +@item start_duration, stop_duration +Specify the duration of the start/stop delay. See +@ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils} +for the accepted syntax. +These options override @var{start} and @var{stop}. + +@item color +Specify the color of the padded area. For the syntax of this option, +check the @ref{color syntax,,"Color" section in the ffmpeg-utils +manual,ffmpeg-utils}. + +The default value of @var{color} is "black". +@end table + @anchor{transpose} @section transpose diff --git a/libavfilter/Makefile b/libavfilter/Makefile index c35cd8f422..51e48efc2e 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -383,6 +383,7 @@ OBJS-$(CONFIG_TMIX_FILTER) += vf_mix.o framesync.o OBJS-$(CONFIG_TONEMAP_FILTER)+= vf_tonemap.o colorspace.o OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) += vf_tonemap_opencl.o colorspace.o opencl.o \ opencl/tonemap.o opencl/colorspace_common.o +OBJS-$(CONFIG_TPAD_FILTER) += vf_tpad.o OBJS-$(CONFIG_TRANSPOSE_FILTER) += vf_transpose.o OBJS-$(CONFIG_TRANSPOSE_NPP_FILTER) += vf_transpose_npp.o OBJS-$(CONFIG_TRIM_FILTER) += trim.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index d5a211bda5..6052cb8c3c 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -365,6 +365,7 @@ extern AVFilter ff_vf_tlut2; extern AVFilter ff_vf_tmix; extern AVFilter ff_vf_tonemap; extern AVFilter ff_vf_tonemap_opencl; +extern AVFilter ff_vf_tpad; extern AVFilter ff_vf_transpose; extern AVFilter ff_vf_transpose_npp; extern AVFilter ff_vf_trim; diff --git a/libavfilter/vf_tpad.c b/libavfilter/vf_tpad.c new file mode 100644 index 00..86e063090b --- /dev/null +++ b/libavfilter/vf_tpad.c @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2018 Paul B Mahol + * + * 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 + */ + +#include "libavutil/avassert.h" +#include "libavutil/channel_layout.h" +#include "libavutil/opt.h" +#include "avfilter.h" +#include "audio.h" +#include "filters.h" +#include "internal.h" +#include "formats.h" +#include "drawutils.h" + +typedef struct TPadContext { +const AVClass *class; +int pad_start; +int pad_stop; +int start_mode; +int stop_mode; +int64_t start_duration; +int64_t stop_duration; +uint8_t rgba_color[4]; ///< color for the padding area + +FFDrawContext draw; +FFDrawColor color; +int64_t pts; +int eof; +AVFrame *cache_start; +AVFrame *cache_stop; +} TPadContext; + +#define OFFSET(x) offsetof(TPadContext, x) +#define VF AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM + +static const AVOption tpad_options[] = { +{ "start", "set the number of frames to delay input", OFFSET(pad_start), AV_OPT_TYPE_INT, {.i64=0},0, INT_MAX, VF }, +{ "stop", "set the number of fra
[FFmpeg-devel] [PATCH 2/2] lavc/libdavs2: fix sequence incomplete output error
Signed-off-by: hwren --- libavcodec/libdavs2.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c index 581d568..b05bdef 100644 --- a/libavcodec/libdavs2.c +++ b/libavcodec/libdavs2.c @@ -122,7 +122,16 @@ static int davs2_decode_frame(AVCodecContext *avctx, void *data, int ret = DAVS2_DEFAULT; if (!buf_size) { -return 0; +ret = davs2_decoder_flush(cad->decoder, &cad->headerset, &cad->out_frame); +if (ret == DAVS2_END) { +return 0; +} else if (ret == DAVS2_GOT_FRAME) { +*got_frame = davs2_dump_frames(avctx, &cad->out_frame, &cad->headerset, ret, frame); +davs2_decoder_frame_unref(cad->decoder, &cad->out_frame); +return ret; +} else { +return AVERROR_EXTERNAL; +} } cad->packet.data = buf_ptr; -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] lavc/libdavs2: remove incorrect frame settings
Signed-off-by: hwren --- libavcodec/libdavs2.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c index cadf995..581d568 100644 --- a/libavcodec/libdavs2.c +++ b/libavcodec/libdavs2.c @@ -96,13 +96,6 @@ static int davs2_dump_frames(AVCodecContext *avctx, davs2_picture_t *pic, pic->widths[plane] * bytes_per_sample); } -frame->width = cad->headerset.width; -frame->height= cad->headerset.height; -frame->pts = cad->out_frame.pts; -frame->pict_type = pic->type; -frame->format= avctx->pix_fmt; - -cad->decoded_frames++; return 1; } -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/3] lavc/libdavs2: remove unused context parameter
Signed-off-by: hwren --- libavcodec/libdavs2.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c index b05bdef..ee52043 100644 --- a/libavcodec/libdavs2.c +++ b/libavcodec/libdavs2.c @@ -32,8 +32,6 @@ typedef struct DAVS2Context { davs2_param_tparam; // decoding parameters davs2_packet_t packet; // input bitstream -int decoded_frames; - davs2_picture_t out_frame; // output data, frame data davs2_seq_info_t headerset; // output data, sequence header -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v3] fate/api-h264-slice-test: use cleaner error handling
From: Josh de Kock Fix ticket #7521 --- tests/api/api-h264-slice-test.c | 88 +++-- 1 file changed, 51 insertions(+), 37 deletions(-) diff --git a/tests/api/api-h264-slice-test.c b/tests/api/api-h264-slice-test.c index 57e7dc79c3..ebc90b5b57 100644 --- a/tests/api/api-h264-slice-test.c +++ b/tests/api/api-h264-slice-test.c @@ -48,7 +48,7 @@ static int header = 0; -static void decode(AVCodecContext *dec_ctx, AVFrame *frame, +static int decode(AVCodecContext *dec_ctx, AVFrame *frame, AVPacket *pkt) { static uint64_t frame_cnt = 0; @@ -57,20 +57,20 @@ static void decode(AVCodecContext *dec_ctx, AVFrame *frame, ret = avcodec_send_packet(dec_ctx, pkt); if (ret < 0) { fprintf(stderr, "Error sending a packet for decoding: %s\n", av_err2str(ret)); -exit(1); +return ret; } while (ret >= 0) { const AVPixFmtDescriptor *desc; -char *sum; +char sum[AV_HASH_MAX_SIZE * 2 + 1]; struct AVHashContext *hash; ret = avcodec_receive_frame(dec_ctx, frame); if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { -return; +return 0; } else if (ret < 0) { fprintf(stderr, "Error during decoding: %s\n", av_err2str(ret)); -exit(1); +return ret; } if (!header) { @@ -87,9 +87,10 @@ static void decode(AVCodecContext *dec_ctx, AVFrame *frame, header = 1; } desc = av_pix_fmt_desc_get(dec_ctx->pix_fmt); -av_hash_alloc(&hash, "md5"); +if ((ret = av_hash_alloc(&hash, "md5")) < 0) { +return ret; +} av_hash_init(hash); -sum = av_mallocz(av_hash_get_size(hash) * 2 + 1); for (int i = 0; i < frame->height; i++) av_hash_update(hash, &frame->data[0][i * frame->linesize[0]], frame->width); @@ -104,25 +105,25 @@ static void decode(AVCodecContext *dec_ctx, AVFrame *frame, (frame->width * frame->height + 2 * (frame->height >> desc->log2_chroma_h) * (frame->width >> desc->log2_chroma_w)), sum); frame_cnt += 1; av_hash_freep(&hash); -av_free(sum); } +return 0; } int main(int argc, char **argv) { -const AVCodec *codec; +const AVCodec *codec = NULL; AVCodecContext *c = NULL; -AVFrame *frame; +AVFrame *frame = NULL; unsigned int threads; AVPacket *pkt; -FILE *fd; +FILE *file = NULL; char nal[MAX_SLICES * UINT16_MAX + AV_INPUT_BUFFER_PADDING_SIZE]; -int nals = 0; +int nals = 0, ret = 0; char *p = nal; if (argc < 4) { fprintf(stderr, "Usage: %s \n", argv[0]); -exit(1); +return -1; } if (!(threads = strtoul(argv[1], NULL, 0))) @@ -134,17 +135,20 @@ int main(int argc, char **argv) setmode(fileno(stdout), O_BINARY); #endif -if (!(pkt = av_packet_alloc())) -exit(1); +if (!(pkt = av_packet_alloc())) { +return -1; +} if (!(codec = avcodec_find_decoder(AV_CODEC_ID_H264))) { fprintf(stderr, "Codec not found\n"); -exit(1); +ret = -1; +goto err; } if (!(c = avcodec_alloc_context3(codec))) { fprintf(stderr, "Could not allocate video codec context\n"); -exit(1); +ret = -1; +goto err; } c->width = 352; @@ -154,15 +158,16 @@ int main(int argc, char **argv) c->thread_type = FF_THREAD_SLICE; c->thread_count = threads; -if (avcodec_open2(c, codec, NULL) < 0) { +if ((ret = avcodec_open2(c, codec, NULL)) < 0) { fprintf(stderr, "Could not open codec\n"); -exit(1); +goto err; } #if HAVE_THREADS if (c->active_thread_type != FF_THREAD_SLICE) { fprintf(stderr, "Couldn't activate slice threading: %d\n", c->active_thread_type); -exit(1); +ret = -1; +goto err; } #else fprintf(stderr, "WARN: not using threads, only checking decoding slice NALUs\n"); @@ -170,34 +175,39 @@ int main(int argc, char **argv) if (!(frame = av_frame_alloc())) { fprintf(stderr, "Could not allocate video frame\n"); -exit(1); +ret = -1; +goto err; } -if (!(fd = fopen(argv[2], "rb"))) { +if (!(file = fopen(argv[2], "rb"))) { fprintf(stderr, "Couldn't open NALU file: %s\n", argv[2]); -exit(1); +ret = -1; +goto err; } while(1) { uint16_t size = 0; -ssize_t ret = fread(&size, 1, sizeof(uint16_t), fd); -if (ret < 0) { -perror("Couldn't read size"); -exit(1); -} else if (ret != sizeof(uint16_t)) + +size_t ret = fread(&size, 1, sizeof(uint16_t), file); +if (ret != sizeof(uint16_t)) break; + size = ntohs(size); -ret = fread(p, 1, size, fd); -if (ret < 0 || ret != size) { + +
Re: [FFmpeg-devel] [PATCH 2/2] libx264: Pass the reordered_opaque field through the encoder
On 29/10/2018 21:06, Martin Storsjö wrote: > As I guess there can be old frames in flight, the only safe option is to > enlarge, not to shrink it. But in case a realloc moves the array, the old > pointers end up pretty useless. Just always allocate the max (which is known for H.264), and adjust nb_reordered_opaque as need be, on reconfig, no? - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/5] lavc/qsvenc: add forced_idr opiton
On Tue, 2018-10-30 at 18:05 +0800, Li, Zhong wrote: > > > +} else > > > +enc_ctrl->FrameType = MFX_FRAMETYPE_UNKNOWN; > > > > "else" block don't make much sense to me. You eventually already > > had > > enc_ctrl structure passed to the encoder. Thus, it should be > > initialized to > > default (already). And you don't make anything specific/new in the > > "else". > > From my perspective "else" just obscures the code and should be > > dropped. > > This was a case I had concern. I doubt the default initialization is > always zero > (you know MFX_FRAMETYPE_UNKNOWN is zero). Isn't it possible? > Please check the regression case I fixed: https://patchwork.ffmpeg.or > g/patch/10517/ Patch 10517 deals with unitialized variable on a compilation level. As for the enc_ctrl I very much hope that ffmpeg-qsv code takes care to memset the mfcEncodeCtrl (as well as all other mediasdk structures) _before_ usage. I.e. there should be a code somewhere similar to: memset(enc_ctrl, 0, sizeof(mfxEncodeCtrl)); If this is missing, there is a VERY big problem in the QSV code since indeed compiler may initialize structures to everything it wants and there will be very bad consequences. As for the usage of mfxEncodeCtrl, the idea is the following. User allocates this control and memsets it to 0. If this will be passed in that way mediasdk will change nothing to encode the frame. If user wants to change some parameter, it can do this changing only the parameter it wants to take effect. So, the "else" should really not be needed. Dmitry. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/5] lavc/qsvenc: add forced_idr opiton
On Tue, 2018-10-30 at 09:49 +, Li, Zhong wrote: > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On > > Behalf > > Of Mark Thompson > > Sent: Tuesday, October 30, 2018 5:06 AM > > To: ffmpeg-devel@ffmpeg.org > > Subject: Re: [FFmpeg-devel] [PATCH 1/5] lavc/qsvenc: add forced_idr > > opiton > > > > On 25/10/18 13:36, Zhong Li wrote: > > > This option can be used to repect original input I/IDR frame > > > type. > > > > > > Signed-off-by: Zhong Li > > > --- > > > libavcodec/qsvenc.c | 7 +++ > > > libavcodec/qsvenc.h | 2 ++ > > > 2 files changed, 9 insertions(+) > > > > > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index > > > 948751d..e534dcf 100644 > > > --- a/libavcodec/qsvenc.c > > > +++ b/libavcodec/qsvenc.c > > > @@ -1192,6 +1192,13 @@ static int encode_frame(AVCodecContext > > > > *avctx, QSVEncContext *q, > > > if (qsv_frame) { > > > surf = &qsv_frame->surface; > > > enc_ctrl = &qsv_frame->enc_ctrl; > > > + > > > +if (q->forced_idr >= 0 && frame->pict_type == > > > > AV_PICTURE_TYPE_I) { > > > +enc_ctrl->FrameType = MFX_FRAMETYPE_I | > > > > MFX_FRAMETYPE_REF; > > > +if (q->forced_idr || frame->key_frame) > > > +enc_ctrl->FrameType |= MFX_FRAMETYPE_IDR; > > > +} else > > > +enc_ctrl->FrameType = MFX_FRAMETYPE_UNKNOWN; > > > } > > > > > > ret = av_new_packet(&new_pkt, q->packet_size); diff --git > > > a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index > > > 055b4a6..1f97f77 > > > 100644 > > > --- a/libavcodec/qsvenc.h > > > +++ b/libavcodec/qsvenc.h > > > @@ -87,6 +87,7 @@ > > > { "adaptive_i", "Adaptive I-frame placement", > > > > OFFSET(qsv.adaptive_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, > > 1, VE }, \ > > > { "adaptive_b", "Adaptive B-frame placement", > > > > OFFSET(qsv.adaptive_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, > > 1, VE }, \ > > > { "b_strategy", "Strategy to choose between I/P/B-frames", > > > > OFFSET(qsv.b_strategy),AV_OPT_TYPE_INT, { .i64 = -1 }, -1, > > 1, VE }, \ > > > +{ "forced_idr", "Forcing I frames as IDR frames", > > > > OFFSET(qsv.forced_idr), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, > > 1, VE }, \ > > > > > > typedef int SetEncodeCtrlCB (AVCodecContext *avctx, > > > const AVFrame *frame, > > > > mfxEncodeCtrl* > > > enc_ctrl); @@ -168,6 +169,7 @@ typedef struct QSVEncContext > > > { #endif > > > char *load_plugins; > > > SetEncodeCtrlCB *set_encode_ctrl_cb; > > > +int forced_idr; > > > } QSVEncContext; > > > > > > int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q); > > > > > > > This seems confusing, because it doesn't match what forced_idr does > > in any > > other encoder. > > > > Checking of pict_type for AV_PICTURE_TYPE_I in order to get a key > > frame > > (of whatever kind) is always enabled if supported (many > > encoders). The > > "forced_idr" option to H.26[45] encoders (libx264, libx265) then > > forces that > > to be an IDR frame, not just an I frame. > > > > - Mark > > Yup, I know it doesn’t match other encoders such as > libx264/libx265/nvenc. > However, it is my intentional behavior. I believe current implement > in libx264/libx265 is not complete. > One case is ignored: user just want to keep the gop structure as > input, not to force all I frames as IDR frames. > So I have an idea: > Default value = -1, ignore the input gop structure. I see the idea now, but I very much would like to see this at least somehow reflected in ffmpeg option documentation. To me your interpretation of -1, 0, 1 is quite non-intuitive. As you can see from my other comments I did not guess your intent from the patch. End-users will have even more problems with this option since a little of them will take care to look into the sources themselves. Besides, I am still feeling that you try to mix 2 different options together: one which will permit to follow (or not) input stream gop structure and another which forces IDR frames for each I frame. > 0: respect input gop structure but don't force I frame as IDR frame. > 1: force all I frame as IDR frame. > > Since this is a qsv encoder private option, I just changed qsv > implementation. > But I believe it should be a good to make other encoders follow such > a way with separated patches. > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/mjpegdec: fix VA-API MJPEG decoding uninitialized huffman table
> -Original Message- > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of > myp...@gmail.com > Sent: Monday, October 29, 2018 10:52 PM > To: FFmpeg development discussions and patches > Cc: Zhao, Jun ; Lin, Decai > Subject: Re: [FFmpeg-devel] [PATCH] lavc/mjpegdec: fix VA-API MJPEG decoding > uninitialized huffman table > > On Tue, Oct 30, 2018 at 11:41 AM Eoff, Ullysses A > wrote: > > > > > -Original Message- > > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of > > > myp...@gmail.com > > > Sent: Monday, October 29, 2018 8:10 PM > > > To: FFmpeg development discussions and patches > > > Cc: Zhao, Jun ; Lin, Decai > > > Subject: Re: [FFmpeg-devel] [PATCH] lavc/mjpegdec: fix VA-API MJPEG > > > decoding uninitialized huffman table > > > > > > On Tue, Oct 30, 2018 at 10:41 AM Li, Zhong wrote: > > > > > > > > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf > > > > > Of myp...@gmail.com > > > > > Sent: Tuesday, October 30, 2018 9:02 AM > > > > > To: FFmpeg development discussions and patches > > > > > > > > > > Cc: Zhao, Jun ; Lin, Decai > > > > > Subject: Re: [FFmpeg-devel] [PATCH] lavc/mjpegdec: fix VA-API MJPEG > > > > > decoding uninitialized huffman table > > > > > > > > > > On Mon, Oct 29, 2018 at 6:39 PM Li, Zhong wrote: > > > > > > > > > > > > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On > > > > > > > Behalf Of Jun Zhao > > > > > > > Sent: Monday, October 29, 2018 6:26 PM > > > > > > > To: ffmpeg-devel@ffmpeg.org > > > > > > > Cc: Zhao, Jun ; Lin, Decai > > > > > > > > > > > > > > Subject: [FFmpeg-devel] [PATCH] lavc/mjpegdec: fix VA-API MJPEG > > > > > > > decoding uninitialized huffman table > > > > > > > > > > > > > > From: Jun Zhao > > > > > > > > > > > > > > Now VA-API HWAccel MJPEG decoding uninitialized huffman table, > > > > > > > it's > > > > > > > will lead to the decoding error like"Failed to sync surface 0x5: > > > > > > > 23 > > > > > > > (internal decoding error)." in iHD open source driver. > > > > > > > > > > > > > > Signed-off-by: dlin2 > > > > > > > Signed-off-by: Jun Zhao > > > > > > > --- > > > > > > > libavcodec/mjpegdec.c | 19 +++ > > > > > > > 1 files changed, 19 insertions(+), 0 deletions(-) > > > > > > > > > > > > > > diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index > > > > > > > b0cb3ff..89effb6 100644 > > > > > > > --- a/libavcodec/mjpegdec.c > > > > > > > +++ b/libavcodec/mjpegdec.c > > > > > > > @@ -75,6 +75,25 @@ static int build_vlc(VLC *vlc, const uint8_t > > > > > > > *bits_table, static int build_basic_mjpeg_vlc(MJpegDecodeContext > > > > > > > *s) > > > > > { > > > > > > > int ret; > > > > > > > +int i; > > > > > > > + > > > > > > > +/* initialize default huffman tables */ > > > > > > > +for (i = 0; i < 16; i++) > > > > > > > +s->raw_huffman_lengths[0][0][i] = > > > > > > > avpriv_mjpeg_bits_dc_luminance[i + 1]; > > > > > > > +for (i = 0; i < 12; i++) > > > > > > > +s->raw_huffman_values[0][0][i] = avpriv_mjpeg_val_dc[i]; > > > > > > > +for (i = 0; i < 16; i++) > > > > > > > +s->raw_huffman_lengths[0][1][i] = > > > > > > > avpriv_mjpeg_bits_dc_chrominance[i + 1]; > > > > > > > +for (i = 0; i < 12; i++) > > > > > > > +s->raw_huffman_values[0][1][i] = avpriv_mjpeg_val_dc[i]; > > > > > > > +for (i = 0; i < 16; i++) > > > > > > > +s->raw_huffman_lengths[1][0][i] = > > > > > > > avpriv_mjpeg_bits_ac_luminance[i + 1]; > > > > > > > +for (i = 0; i < 162; i++) > > > > > > > +s->raw_huffman_values[1][0][i] = > > > > > > > avpriv_mjpeg_val_ac_luminance[i]; > > > > > > > +for (i = 0; i < 16; i++) > > > > > > > +s->raw_huffman_lengths[1][1][i] = > > > > > > > avpriv_mjpeg_bits_ac_chrominance[i + 1]; > > > > > > > +for (i = 0; i < 162; i++) > > > > > > > +s->raw_huffman_values[1][1][i] = > > > > > > > + avpriv_mjpeg_val_ac_chrominance[i]; > > > > > > > > > > > > > > if ((ret = build_vlc(&s->vlcs[0][0], > > > > > avpriv_mjpeg_bits_dc_luminance, > > > > > > > avpriv_mjpeg_val_dc, 12, 0, 0)) < 0) > > > > > > > -- > > > > > > > 1.7.1 > > > > > > > > > > > > Should this be fixed in iHD driver instead of ffmpeg? > > > > > No, I don't think driver is a good place to initialize the huffman > > > > > table. > > > > > > > > For the default Huffman table, thus should be initialized by driver > > > > itself. > > > > For non-default case, thus should be passed from ffmpeg. > > > > So, what is the case you want to fix? Both (if so, no need to mention > > > > iHD driver)? > > > Both, now HWAccel MJPEG always setting the huffman table and > > > can't distinguish the HWaccel JPEG whether default Huffman table. > > > > If your VA-API HWAccel MJPEG decoding case(s) work with i965 driver > > and not iHD then I would assume iHD needs fixing. > > > i965 must be have some issue if MJPEG decoding, whe
[FFmpeg-devel] [PATCH 2/3] avcodec/cbs_vp9: store profile in the private context
Derived from profile_low_bit and profile_high_bit. Signed-off-by: James Almer --- libavcodec/cbs_vp9.h | 2 ++ libavcodec/cbs_vp9_syntax_template.c | 13 ++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libavcodec/cbs_vp9.h b/libavcodec/cbs_vp9.h index 12689e51cc..3f1473c9f8 100644 --- a/libavcodec/cbs_vp9.h +++ b/libavcodec/cbs_vp9.h @@ -192,6 +192,8 @@ typedef struct VP9ReferenceFrameState { } VP9ReferenceFrameState; typedef struct CodedBitstreamVP9Context { +int profile; + // Frame dimensions in 8x8 mode info blocks. uint16_t mi_cols; uint16_t mi_rows; diff --git a/libavcodec/cbs_vp9_syntax_template.c b/libavcodec/cbs_vp9_syntax_template.c index 7b90775ed6..28f95dcd32 100644 --- a/libavcodec/cbs_vp9_syntax_template.c +++ b/libavcodec/cbs_vp9_syntax_template.c @@ -278,15 +278,14 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw, VP9RawFrameHeader *current) { CodedBitstreamVP9Context *vp9 = ctx->priv_data; -int profile, i; -int err; +int err, i; f(2, frame_marker); f(1, profile_low_bit); f(1, profile_high_bit); -profile = (current->profile_high_bit << 1) + current->profile_low_bit; -if (profile == 3) +vp9->profile = (current->profile_high_bit << 1) + current->profile_low_bit; +if (vp9->profile == 3) f(1, profile_reserved_zero); f(1, show_existing_frame); @@ -304,7 +303,7 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw, if (current->frame_type == VP9_KEY_FRAME) { CHECK(FUNC(frame_sync_code)(ctx, rw, current)); -CHECK(FUNC(color_config)(ctx, rw, current, profile)); +CHECK(FUNC(color_config)(ctx, rw, current, vp9->profile)); CHECK(FUNC(frame_size)(ctx, rw, current)); CHECK(FUNC(render_size)(ctx, rw, current)); @@ -324,8 +323,8 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw, if (current->intra_only == 1) { CHECK(FUNC(frame_sync_code)(ctx, rw, current)); - if (profile > 0) { - CHECK(FUNC(color_config)(ctx, rw, current, profile)); + if (vp9->profile > 0) { + CHECK(FUNC(color_config)(ctx, rw, current, vp9->profile)); } else { infer(color_space, 1); infer(subsampling_x, 1); -- 2.19.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/3] avcodec/cbs_vp9: keep track of reference frames
Signed-off-by: James Almer --- libavcodec/cbs_vp9.h | 16 libavcodec/cbs_vp9_syntax_template.c | 60 ++-- 2 files changed, 72 insertions(+), 4 deletions(-) diff --git a/libavcodec/cbs_vp9.h b/libavcodec/cbs_vp9.h index 5b99c90c2e..12689e51cc 100644 --- a/libavcodec/cbs_vp9.h +++ b/libavcodec/cbs_vp9.h @@ -183,6 +183,13 @@ typedef struct VP9RawSuperframe { VP9RawSuperframeIndex index; } VP9RawSuperframe; +typedef struct VP9ReferenceFrameState { +int frame_width;// RefFrameWidth +int frame_height; // RefFrameHeight +int subsampling_x; // RefSubsamplingX +int subsampling_y; // RefSubsamplingY +int bit_depth; // RefBitDepth +} VP9ReferenceFrameState; typedef struct CodedBitstreamVP9Context { // Frame dimensions in 8x8 mode info blocks. @@ -192,6 +199,15 @@ typedef struct CodedBitstreamVP9Context { uint16_t sb64_cols; uint16_t sb64_rows; +int frame_width; +int frame_height; + +uint8_t subsampling_x; +uint8_t subsampling_y; +int bit_depth; + +VP9ReferenceFrameState ref[VP9_NUM_REF_FRAMES]; + // Write buffer. uint8_t *write_buffer; size_t write_buffer_size; diff --git a/libavcodec/cbs_vp9_syntax_template.c b/libavcodec/cbs_vp9_syntax_template.c index b4a7f65e85..7b90775ed6 100644 --- a/libavcodec/cbs_vp9_syntax_template.c +++ b/libavcodec/cbs_vp9_syntax_template.c @@ -43,10 +43,14 @@ static int FUNC(frame_sync_code)(CodedBitstreamContext *ctx, RWContext *rw, static int FUNC(color_config)(CodedBitstreamContext *ctx, RWContext *rw, VP9RawFrameHeader *current, int profile) { +CodedBitstreamVP9Context *vp9 = ctx->priv_data; int err; -if (profile >= 2) +if (profile >= 2) { f(1, ten_or_twelve_bit); +vp9->bit_depth = current->ten_or_twelve_bit ? 12 : 10; +} else +vp9->bit_depth = 8; f(3, color_space); @@ -69,6 +73,9 @@ static int FUNC(color_config)(CodedBitstreamContext *ctx, RWContext *rw, } } +vp9->subsampling_x = current->subsampling_x; +vp9->subsampling_y = current->subsampling_y; + return 0; } @@ -81,8 +88,11 @@ static int FUNC(frame_size)(CodedBitstreamContext *ctx, RWContext *rw, f(16, frame_width_minus_1); f(16, frame_height_minus_1); -vp9->mi_cols = (current->frame_width_minus_1 + 8) >> 3; -vp9->mi_rows = (current->frame_height_minus_1 + 8) >> 3; +vp9->frame_width = current->frame_width_minus_1 + 1; +vp9->frame_height = current->frame_height_minus_1 + 1; + +vp9->mi_cols = (vp9->frame_width + 7) >> 3; +vp9->mi_rows = (vp9->frame_height + 7) >> 3; vp9->sb64_cols = (vp9->mi_cols + 7) >> 3; vp9->sb64_rows = (vp9->mi_rows + 7) >> 3; @@ -107,15 +117,33 @@ static int FUNC(render_size)(CodedBitstreamContext *ctx, RWContext *rw, static int FUNC(frame_size_with_refs)(CodedBitstreamContext *ctx, RWContext *rw, VP9RawFrameHeader *current) { +CodedBitstreamVP9Context *vp9 = ctx->priv_data; int err, i; for (i = 0; i < VP9_REFS_PER_FRAME; i++) { fs(1, found_ref[i], 1, i); -if (current->found_ref[i]) +if (current->found_ref[i]) { +VP9ReferenceFrameState *ref = +&vp9->ref[current->ref_frame_idx[i]]; + +vp9->frame_width = ref->frame_width; +vp9->frame_height = ref->frame_height; + +vp9->subsampling_x = ref->subsampling_x; +vp9->subsampling_y = ref->subsampling_y; +vp9->bit_depth = ref->bit_depth; + break; +} } if (i >= VP9_REFS_PER_FRAME) CHECK(FUNC(frame_size)(ctx, rw, current)); +else { +vp9->mi_cols = (vp9->frame_width + 7) >> 3; +vp9->mi_rows = (vp9->frame_height + 7) >> 3; +vp9->sb64_cols = (vp9->mi_cols + 7) >> 3; +vp9->sb64_rows = (vp9->mi_rows + 7) >> 3; +} CHECK(FUNC(render_size)(ctx, rw, current)); return 0; @@ -249,6 +277,7 @@ static int FUNC(tile_info)(CodedBitstreamContext *ctx, RWContext *rw, static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw, VP9RawFrameHeader *current) { +CodedBitstreamVP9Context *vp9 = ctx->priv_data; int profile, i; int err; @@ -301,6 +330,10 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw, infer(color_space, 1); infer(subsampling_x, 1); infer(subsampling_y, 1); + vp9->bit_depth = 8; + + vp9->subsampling_x = current->subsampling_x; + vp9->subsampling_y = current->subsampling_y; } f(8, refresh_frame_flags); @@ -339,6 +372,25 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw, f(16, header_size_in_bytes); +for (i
[FFmpeg-devel] [PATCH 3/3] avcodec/cbs_vp9: discard empty fragments
Signed-off-by: James Almer --- libavcodec/cbs_vp9.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c index 7498be4b73..812be4ddd5 100644 --- a/libavcodec/cbs_vp9.c +++ b/libavcodec/cbs_vp9.c @@ -403,6 +403,9 @@ static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx, uint8_t superframe_header; int err; +if (frag->data_size <= 0) +return 0; + // Last byte in the packet. superframe_header = frag->data[frag->data_size - 1]; -- 2.19.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/4] cbs_h264: Include SEI type names in trace output
On 10/27/2018 6:39 PM, Mark Thompson wrote: > --- > libavcodec/cbs_h264_syntax_template.c | 16 > 1 file changed, 16 insertions(+) > > diff --git a/libavcodec/cbs_h264_syntax_template.c > b/libavcodec/cbs_h264_syntax_template.c > index 9e29132fec..dbf9ff1268 100644 > --- a/libavcodec/cbs_h264_syntax_template.c > +++ b/libavcodec/cbs_h264_syntax_template.c > @@ -513,6 +513,8 @@ static int > FUNC(sei_buffering_period)(CodedBitstreamContext *ctx, RWContext *rw, > const H264RawSPS *sps; > int err, i, length; > > +HEADER("Buffering Period"); > + > ue(seq_parameter_set_id, 0, 31); > > sps = h264->sps[current->seq_parameter_set_id]; > @@ -605,6 +607,8 @@ static int FUNC(sei_pic_timing)(CodedBitstreamContext > *ctx, RWContext *rw, > const H264RawSPS *sps; > int err; > > +HEADER("Picture Timing"); > + > sps = h264->active_sps; > if (!sps) { > // If there is exactly one possible SPS but it is not yet active > @@ -674,6 +678,8 @@ static int FUNC(sei_pan_scan_rect)(CodedBitstreamContext > *ctx, RWContext *rw, > { > int err, i; > > +HEADER("Pan-Scan Rectangle"); > + > ue(pan_scan_rect_id, 0, UINT32_MAX - 1); > flag(pan_scan_rect_cancel_flag); > > @@ -699,6 +705,8 @@ static int > FUNC(sei_user_data_registered)(CodedBitstreamContext *ctx, RWContext > { > int err, i, j; > > +HEADER("User Data Registered ITU-T T.35"); > + > u(8, itu_t_t35_country_code, 0x00, 0xff); > if (current->itu_t_t35_country_code != 0xff) > i = 1; > @@ -731,6 +739,8 @@ static int > FUNC(sei_user_data_unregistered)(CodedBitstreamContext *ctx, RWContex > { > int err, i; > > +HEADER("User Data Unregistered"); > + > #ifdef READ > if (*payload_size < 16) { > av_log(ctx->log_ctx, AV_LOG_ERROR, > @@ -758,6 +768,8 @@ static int FUNC(sei_recovery_point)(CodedBitstreamContext > *ctx, RWContext *rw, > { > int err; > > +HEADER("Recovery Point"); > + > ue(recovery_frame_cnt, 0, 65535); > flag(exact_match_flag); > flag(broken_link_flag); > @@ -771,6 +783,8 @@ static int > FUNC(sei_display_orientation)(CodedBitstreamContext *ctx, RWContext * > { > int err; > > +HEADER("Display Orientation"); > + > flag(display_orientation_cancel_flag); > if (!current->display_orientation_cancel_flag) { > flag(hor_flip); > @@ -788,6 +802,8 @@ static int > FUNC(sei_mastering_display_colour_volume)(CodedBitstreamContext *ctx, > { > int err, c; > > +HEADER("Mastering Display Colour Volume"); > + > for (c = 0; c < 3; c++) { > us(16, display_primaries_x[c], 0, 5, 1, c); > us(16, display_primaries_y[c], 0, 5, 1, c); LGTM. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] libx264: Pass the reordered_opaque field through the encoder
On Tue, 30 Oct 2018, Derek Buitenhuis wrote: On 29/10/2018 21:06, Martin Storsjö wrote: As I guess there can be old frames in flight, the only safe option is to enlarge, not to shrink it. But in case a realloc moves the array, the old pointers end up pretty useless. Just always allocate the max (which is known for H.264), and adjust nb_reordered_opaque as need be, on reconfig, no? Hmm, that might make sense, but with a little twist. The max reordered frames for H.264 is known, but onto that you also get more delay due to frame threads and other details that this function within x264 knows about. So that would make it [H264 max reordering] + [threads] + [constant] or something such? // Martin ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/4] cbs_h265: Add PTL parsing for Main 10 Still Picture profile
On 10/27/2018 6:39 PM, Mark Thompson wrote: > This was added in the 2018 version of the standard. > --- > libavcodec/cbs_h265_syntax_template.c | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/libavcodec/cbs_h265_syntax_template.c > b/libavcodec/cbs_h265_syntax_template.c > index d4e4f7b1c2..e43f3caf99 100644 > --- a/libavcodec/cbs_h265_syntax_template.c > +++ b/libavcodec/cbs_h265_syntax_template.c > @@ -130,6 +130,11 @@ static int > FUNC(profile_tier_level)(CodedBitstreamContext *ctx, RWContext *rw, > fixed(24, general_reserved_zero_34bits, 0); > fixed(10, general_reserved_zero_34bits, 0); > } > +} else if (profile_compatible(2)) { > +fixed(7, general_reserved_zero_7bits, 0); > +flag(general_one_picture_only_constraint_flag); > +fixed(24, general_reserved_zero_35bits, 0); > +fixed(11, general_reserved_zero_35bits, 0); Fun get_bits() constrain :p It may be worth looking at enabling CACHED_BITSTREAM_READER. get_bits() can read up 32 bits with it, and it may be faster overall. > } else { > fixed(24, general_reserved_zero_43bits, 0); > fixed(19, general_reserved_zero_43bits, 0); > LGTM. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD driver
On Mon, Oct 29, 2018 at 01:42:55AM +, Zhou, Zachary wrote: > > > > -Original Message- > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of > > Michael Niedermayer > > Sent: Saturday, October 27, 2018 5:16 AM > > To: FFmpeg development discussions and patches > > Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi > > rotation feature via call Intel iHD driver > > > > On Thu, Oct 25, 2018 at 02:52:01PM +0800, Zachary Zhou wrote: > > > It supports clockwise rotation by 0/90/180/270 degrees defined in > > > va/va_vpp.h, tested following command line on SKL platform > > > > > > dir=0 for 0 degree > > > dir=1 for 90 degree > > > dir=2 for 180 degree > > > dir=3 for 270 degree > > > > > > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 > > > -hwaccel_output_format vaapi -i input.264 -vf "rotation_vaapi=dir=1" > > > -c:v h264_vaapi output.h264 > > > > > > Signed-off-by: Zachary Zhou > > > --- > > > configure | 3 + > > > libavfilter/Makefile | 1 + > > > libavfilter/allfilters.c | 1 + > > > libavfilter/vaapi_vpp.h | 1 + > > > libavfilter/vf_rotate_vaapi.c | 252 > > > ++ > > > 5 files changed, 258 insertions(+) > > > create mode 100644 libavfilter/vf_rotate_vaapi.c > > > > still fails to build on 32bit x86 > > > > src/libavfilter/vf_rotate_vaapi.c: In function > > ‘rotation_vaapi_build_filter_params’: > > src/libavfilter/vf_rotate_vaapi.c:69:23: error: ‘VAProcPipelineCaps’ has no > > member named ‘rotation_flags’ > > if (!pipeline_caps.rotation_flags) { > >^ > > src/libavfilter/vf_rotate_vaapi.c:95:33: error: ‘VAProcPipelineCaps’ has no > > member named ‘rotation_flags’ > > support_flag = pipeline_caps.rotation_flags & > > ^ > > src/libavfilter/vf_rotate_vaapi.c: In function > > ‘rotation_vaapi_filter_frame’: > > src/libavfilter/vf_rotate_vaapi.c:152:15: error: > > ‘VAProcPipelineParameterBuffer’ has no member named ‘rotation_state’ > > params.rotation_state = vpp_ctx->rotation_state; > >^ > > make: *** [libavfilter/vf_rotate_vaapi.o] Error 1 > > make: *** Waiting for unfinished jobs > > > > grep VAAPI ffbuild/config.mak > > !HAVE_VAAPI_DRM=yes > > !HAVE_VAAPI_X11=yes > > !HAVE_OPENCL_VAAPI_BEIGNET=yes > > !HAVE_OPENCL_VAAPI_INTEL_MEDIA=yes > > !CONFIG_VAAPI_ENCODE_EXAMPLE=yes > > !CONFIG_VAAPI_TRANSCODE_EXAMPLE=yes > > !CONFIG_VAAPI=yes > > !CONFIG_VAAPI_1=yes > > !CONFIG_VAAPI_ENCODE=yes > > !CONFIG_H264_VAAPI_ENCODER=yes > > !CONFIG_HEVC_VAAPI_ENCODER=yes > > !CONFIG_MJPEG_VAAPI_ENCODER=yes > > !CONFIG_MPEG2_VAAPI_ENCODER=yes > > !CONFIG_VP8_VAAPI_ENCODER=yes > > !CONFIG_VP9_VAAPI_ENCODER=yes > > !CONFIG_H263_VAAPI_HWACCEL=yes > > !CONFIG_H264_VAAPI_HWACCEL=yes > > !CONFIG_HEVC_VAAPI_HWACCEL=yes > > !CONFIG_MJPEG_VAAPI_HWACCEL=yes > > !CONFIG_MPEG2_VAAPI_HWACCEL=yes > > !CONFIG_MPEG4_VAAPI_HWACCEL=yes > > !CONFIG_VC1_VAAPI_HWACCEL=yes > > !CONFIG_VP8_VAAPI_HWACCEL=yes > > !CONFIG_VP9_VAAPI_HWACCEL=yes > > !CONFIG_WMV3_VAAPI_HWACCEL=yes > > !CONFIG_DEINTERLACE_VAAPI_FILTER=yes > > !CONFIG_DENOISE_VAAPI_FILTER=yes > > !CONFIG_PROCAMP_VAAPI_FILTER=yes > > !CONFIG_SCALE_VAAPI_FILTER=yes > > !CONFIG_SHARPNESS_VAAPI_FILTER=yes > > CONFIG_ROTATION_VAAPI_FILTER=yes > > > > [...] > > Thanks Michael, Can you share your command line for the build script > configure ? > Do I need more setting on the configure file ? i simplified it a bit, this can still reproduce it: make distclean ; ../configure --cc='ccache gcc -m32' && make -j12 src/libavfilter/vf_rotate_vaapi.c: In function ‘rotation_vaapi_build_filter_params’: src/libavfilter/vf_rotate_vaapi.c:69:23: error: ‘VAProcPipelineCaps’ has no member named ‘rotation_flags’ if (!pipeline_caps.rotation_flags) { ^ src/libavfilter/vf_rotate_vaapi.c:95:33: error: ‘VAProcPipelineCaps’ has no member named ‘rotation_flags’ support_flag = pipeline_caps.rotation_flags & ^ src/libavfilter/vf_rotate_vaapi.c: In function ‘rotation_vaapi_filter_frame’: src/libavfilter/vf_rotate_vaapi.c:152:15: error: ‘VAProcPipelineParameterBuffer’ has no member named ‘rotation_state’ params.rotation_state = vpp_ctx->rotation_state; ^ make: *** [libavfilter/vf_rotate_vaapi.o] Error 1 make: *** Waiting for unfinished jobs [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The worst form of inequality is to try to make unequal things equal. -- Aristotle signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] doc/hls: fix grammar for HLS options
0001-doc-hls-fix-grammar-for-HLS-options.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add (a)graphmonitor filter(s)
On 10/29/18, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > libavfilter/Makefile | 2 + > libavfilter/allfilters.c | 2 + > libavfilter/f_graphmonitor.c | 417 +++ > 3 files changed, 421 insertions(+) > create mode 100644 libavfilter/f_graphmonitor.c Will apply soon. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] doc/hls: fix grammar for HLS options
On Tue, 30 Oct 2018 21:07:16 +0100 Werner Robitza wrote: > From 7da20791b3d146e49855f975c8b5102e8cbfd9f2 Mon Sep 17 00:00:00 2001 > From: Werner Robitza > Date: Tue, 30 Oct 2018 20:22:55 +0100 > Subject: [PATCH] doc/hls: fix grammar for HLS options > > This fixes the grammar of two HLS option descriptions and makes them less > ambiguous. > > Signed-off-by: Werner Robitza > --- > doc/muxers.texi | 9 - > 1 file changed, 4 insertions(+), 5 deletions(-) Pushed with a few minor changes. Thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add (a)graphmonitor filter(s)
On Tue, Oct 30, 2018, at 12:30 PM, Paul B Mahol wrote: > > Will apply soon. Are you going to add any documentation? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavf/hlsenc: Fix mixed declarations and code
--- libavformat/hlsenc.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index f8f060d065..73282ed31a 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -2348,26 +2348,31 @@ static int hls_write_trailer(struct AVFormatContext *s) return AVERROR(ENOMEM); } if ( hls->segment_type == SEGMENT_TYPE_FMP4) { +int range_length; + if (!vs->init_range_length) { +uint8_t *buffer; +int byterange_mode; + av_write_frame(vs->avf, NULL); /* Flush any buffered data */ avio_flush(oc->pb); -uint8_t *buffer = NULL; -int range_length = avio_close_dyn_buf(oc->pb, &buffer); +buffer = NULL; +range_length = avio_close_dyn_buf(oc->pb, &buffer); avio_write(vs->out, buffer, range_length); av_free(buffer); vs->init_range_length = range_length; avio_open_dyn_buf(&oc->pb); vs->packets_written = 0; vs->start_pos = range_length; -int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0); +byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0); if (!byterange_mode) { ff_format_io_close(s, &vs->out); hlsenc_io_close(s, &vs->out, vs->base_output_dirname); } } -int range_length = 0; +range_length = 0; if (!(hls->flags & HLS_SINGLE_FILE)) { ret = hlsenc_io_open(s, &vs->out, vs->avf->url, NULL); if (ret < 0) { -- 2.19.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] avcodec/cbs_vp9: discard empty fragments
On 30/10/18 19:21, James Almer wrote: > Signed-off-by: James Almer > --- > libavcodec/cbs_vp9.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c > index 7498be4b73..812be4ddd5 100644 > --- a/libavcodec/cbs_vp9.c > +++ b/libavcodec/cbs_vp9.c > @@ -403,6 +403,9 @@ static int cbs_vp9_split_fragment(CodedBitstreamContext > *ctx, > uint8_t superframe_header; > int err; > > +if (frag->data_size <= 0) > +return 0; > + > // Last byte in the packet. > superframe_header = frag->data[frag->data_size - 1]; > > Seems fine, but why would an empty fragment appear here? (Given that H.26[45] has pretty much the same check, maybe it should be in the generic code.) Thanks, - Mark ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] avcodec/cbs_vp9: keep track of reference frames
On 30/10/18 19:21, James Almer wrote: > Signed-off-by: James Almer > --- > libavcodec/cbs_vp9.h | 16 > libavcodec/cbs_vp9_syntax_template.c | 60 ++-- > 2 files changed, 72 insertions(+), 4 deletions(-) > On 30/10/18 19:21, James Almer wrote: > Derived from profile_low_bit and profile_high_bit. > > Signed-off-by: James Almer > --- > libavcodec/cbs_vp9.h | 2 ++ > libavcodec/cbs_vp9_syntax_template.c | 13 ++--- > 2 files changed, 8 insertions(+), 7 deletions(-) Both LGTM. Thanks! - Mark ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/5] lavc/qsvenc: add forced_idr opiton
On 30/10/18 09:49, Li, Zhong wrote: >> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf >> Of Mark Thompson >> Sent: Tuesday, October 30, 2018 5:06 AM >> To: ffmpeg-devel@ffmpeg.org >> Subject: Re: [FFmpeg-devel] [PATCH 1/5] lavc/qsvenc: add forced_idr opiton >> >> On 25/10/18 13:36, Zhong Li wrote: >>> This option can be used to repect original input I/IDR frame type. >>> >>> Signed-off-by: Zhong Li >>> --- >>> libavcodec/qsvenc.c | 7 +++ >>> libavcodec/qsvenc.h | 2 ++ >>> 2 files changed, 9 insertions(+) >>> >>> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index >>> 948751d..e534dcf 100644 >>> --- a/libavcodec/qsvenc.c >>> +++ b/libavcodec/qsvenc.c >>> @@ -1192,6 +1192,13 @@ static int encode_frame(AVCodecContext >> *avctx, QSVEncContext *q, >>> if (qsv_frame) { >>> surf = &qsv_frame->surface; >>> enc_ctrl = &qsv_frame->enc_ctrl; >>> + >>> +if (q->forced_idr >= 0 && frame->pict_type == >> AV_PICTURE_TYPE_I) { >>> +enc_ctrl->FrameType = MFX_FRAMETYPE_I | >> MFX_FRAMETYPE_REF; >>> +if (q->forced_idr || frame->key_frame) >>> +enc_ctrl->FrameType |= MFX_FRAMETYPE_IDR; >>> +} else >>> +enc_ctrl->FrameType = MFX_FRAMETYPE_UNKNOWN; >>> } >>> >>> ret = av_new_packet(&new_pkt, q->packet_size); diff --git >>> a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index 055b4a6..1f97f77 >>> 100644 >>> --- a/libavcodec/qsvenc.h >>> +++ b/libavcodec/qsvenc.h >>> @@ -87,6 +87,7 @@ >>> { "adaptive_i", "Adaptive I-frame placement", >> OFFSET(qsv.adaptive_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, >> 1, VE }, \ >>> { "adaptive_b", "Adaptive B-frame placement", >> OFFSET(qsv.adaptive_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, >> 1, VE }, \ >>> { "b_strategy", "Strategy to choose between I/P/B-frames", >> OFFSET(qsv.b_strategy),AV_OPT_TYPE_INT, { .i64 = -1 }, -1, >> 1, VE }, \ >>> +{ "forced_idr", "Forcing I frames as IDR frames", >> OFFSET(qsv.forced_idr), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, >> 1, VE }, \ >>> >>> typedef int SetEncodeCtrlCB (AVCodecContext *avctx, >>> const AVFrame *frame, >> mfxEncodeCtrl* >>> enc_ctrl); @@ -168,6 +169,7 @@ typedef struct QSVEncContext { #endif >>> char *load_plugins; >>> SetEncodeCtrlCB *set_encode_ctrl_cb; >>> +int forced_idr; >>> } QSVEncContext; >>> >>> int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q); >>> >> >> This seems confusing, because it doesn't match what forced_idr does in any >> other encoder. >> >> Checking of pict_type for AV_PICTURE_TYPE_I in order to get a key frame >> (of whatever kind) is always enabled if supported (many encoders). The >> "forced_idr" option to H.26[45] encoders (libx264, libx265) then forces that >> to be an IDR frame, not just an I frame. >> >> - Mark > Yup, I know it doesn’t match other encoders such as libx264/libx265/nvenc. > However, it is my intentional behavior. I believe current implement in > libx264/libx265 is not complete. > One case is ignored: user just want to keep the gop structure as input, not > to force all I frames as IDR frames. > So I have an idea: > Default value = -1, ignore the input gop structure. > 0: respect input gop structure but don't force I frame as IDR frame. > 1: force all I frame as IDR frame. This sounds like two independent options. One is the "forced-idr" option implemented by several other encoders (notably libx264, which is the most commonly-used external encoder), which looks like a sensible addition to me. The second is an "ignore user-set pict_type" option, which I don't understand the need for at all - it's never set unless the user deliberately wants to use that feature (e.g. by using the force_key_frames option in the ffmpeg utility), so why would you want to have a special way to override that? Thanks, - Mark ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] avcodec/cbs_vp9: discard empty fragments
On 10/30/2018 8:19 PM, Mark Thompson wrote: > On 30/10/18 19:21, James Almer wrote: >> Signed-off-by: James Almer >> --- >> libavcodec/cbs_vp9.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c >> index 7498be4b73..812be4ddd5 100644 >> --- a/libavcodec/cbs_vp9.c >> +++ b/libavcodec/cbs_vp9.c >> @@ -403,6 +403,9 @@ static int cbs_vp9_split_fragment(CodedBitstreamContext >> *ctx, >> uint8_t superframe_header; >> int err; >> >> +if (frag->data_size <= 0) >> +return 0; >> + >> // Last byte in the packet. >> superframe_header = frag->data[frag->data_size - 1]; >> >> > > Seems fine, but why would an empty fragment appear here? I noticed this when i tried to reimplement the vp9 parser using cbs_vp9. Libavformat passed dummy zero sized packets that resulted in cbs errors trying to read the frame header. > > (Given that H.26[45] has pretty much the same check, maybe it should be in > the generic code.) And AV1 has a while (size > 0), so yeah, it may be a good idea. > > Thanks, > > - Mark > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] lavc/libdavs2: remove incorrect frame settings
On 30/10/18 14:01, hwren wrote: > Signed-off-by: hwren > --- > libavcodec/libdavs2.c | 7 --- > 1 file changed, 7 deletions(-) > > diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c > index cadf995..581d568 100644 > --- a/libavcodec/libdavs2.c > +++ b/libavcodec/libdavs2.c > @@ -96,13 +96,6 @@ static int davs2_dump_frames(AVCodecContext *avctx, > davs2_picture_t *pic, > pic->widths[plane] * bytes_per_sample); > } > > -frame->width = cad->headerset.width; > -frame->height= cad->headerset.height; > -frame->pts = cad->out_frame.pts; > -frame->pict_type = pic->type; > -frame->format= avctx->pix_fmt; > - > -cad->decoded_frames++; > return 1; > } > > This seems like it loses track of the timestamps? Output pts is always AV_NOPTS_VALUE after this change. (Patch 3/3 should also be squashed into this one, since this is removing the last use of the decoded_frames counter.) Thanks, - Mark ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/5] lavc/qsvenc: add an option to set h264 pps for every frame
On 30/10/18 09:21, Li, Zhong wrote: >> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf >> Of Moritz Barsnick >> Sent: Friday, October 26, 2018 7:49 PM >> To: FFmpeg development discussions and patches >> >> Subject: Re: [FFmpeg-devel] [PATCH 4/5] lavc/qsvenc: add an option to set >> h264 pps for every frame >> >> On Thu, Oct 25, 2018 at 20:36:10 +0800, Zhong Li wrote: >>> RepeatPPS is enabled by default in mfx. It is not necessary mostly and >>> wasting encoding bits. >>> Add an option to control it and disable it by default. >> >> Could this change in behavior surprise anyone? If it's okay to change, >> perhaps at least bump lavc's micro version? >> >> Moritz > > I doubt how many people would like to repeat every frame's pps. > Most codecs (x264/x265, and nvenc) won't do that by default. Huh, right. I feel like I must be missing something here - why would anyone ever want this option enabled? It doesn't even help with seeking to arbitrary points in streams without global headers because you don't have the SPS as well. If there isn't some hidden reason for this, it sounds fine to just switch it off completely without an option to reenable. Thanks, - Mark ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Revert "lavc/v4l2_m2m_enc: Add missing braces around initializers."
> On Oct 27, 2018, at 5:25 PM, Carl Eugen Hoyos wrote: > > 2018-10-27 20:50 GMT+02:00, Mark Thompson : >> This reverts commit 6dbb64fdccafe846aaec75d3784f7ad49d8af5df. >> >> The additional braces cause build errors with Linux headers earlier >> than 4.5 because the first element of the structure was not originally >> a union. > >> Not sure what compiler was warning about these, but it's definitely >> incorrect for it to do so. > > Must have been NDK clang. This fix isn’t enough for this. The references to the variables in the union fail to compile. This doesn’t fix that. > > Sorry, Carl Eugen > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] doc/fate.texi: Mention that samples should be uploaded before pushing dependant commits
On Wed, Oct 24, 2018 at 10:34:39AM +0530, Gyan wrote: > On Wed, Oct 24, 2018 at 3:09 AM Michael Niedermayer > wrote: > > > Signed-off-by: Michael Niedermayer > > --- > > doc/fate.texi | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/doc/fate.texi b/doc/fate.texi > > index a352994230..9ca77f7772 100644 > > --- a/doc/fate.texi > > +++ b/doc/fate.texi > > @@ -155,6 +155,8 @@ space on each client, network bandwidth and so on > > benefit from smaller test case > > Also keep in mind older checkouts use existing sample files, that means in > > practice generally do not replace, remove or overwrite files as it likely > > would > > break older checkouts or releases. > > +Also all needed samples for a commit should be uploaded before the commit > > is > > +pushed. Ideally 24h before. > > > > Nit: merge the 2nd sentence into the first. can you suggest a exact wording for that ? The sentance seems already a bit long to me and describing a slightly different area of potential issues > > Also, dependant -> dependent. locally fixed thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you fake or manipulate statistics in a paper in physics you will never get a job again. If you fake or manipulate statistics in a paper in medicin you will get a job for life at the pharma industry. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH V3] libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD driver
It supports clockwise rotation by 0/90/180/270 degrees defined in va/va_vpp.h, tested following command line on SKL platform ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i input.264 -vf "rotation_vaapi=angle=180" -c:v h264_vaapi output.h264 Signed-off-by: Zachary Zhou --- configure | 4 + libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/vaapi_vpp.h | 1 + libavfilter/vf_rotate_vaapi.c | 252 ++ 5 files changed, 259 insertions(+) create mode 100644 libavfilter/vf_rotate_vaapi.c diff --git a/configure b/configure index 85d5dd5962..4b5718135e 100755 --- a/configure +++ b/configure @@ -3439,6 +3439,7 @@ scale_filter_deps="swscale" scale_qsv_filter_deps="libmfx" select_filter_select="pixelutils" sharpness_vaapi_filter_deps="vaapi" +rotation_vaapi_filter_deps="vaapi" showcqt_filter_deps="avcodec avformat swscale" showcqt_filter_suggest="libfontconfig libfreetype" showcqt_filter_select="fft" @@ -6390,6 +6391,9 @@ if enabled vaapi; then fi check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0, 0)" +if ! check_struct "va/va.h" "struct _VAProcPipelineCaps" rotation_flags; then +disable rotation_vaapi_filter +fi fi if enabled_all opencl libdrm ; then diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 108a2f87d7..534650364a 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -349,6 +349,7 @@ OBJS-$(CONFIG_SETRANGE_FILTER) += vf_setparams.o OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o OBJS-$(CONFIG_SETTB_FILTER) += settb.o OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER)+= vf_misc_vaapi.o vaapi_vpp.o +OBJS-$(CONFIG_ROTATION_VAAPI_FILTER) += vf_rotate_vaapi.o vaapi_vpp.o OBJS-$(CONFIG_SHOWINFO_FILTER) += vf_showinfo.o OBJS-$(CONFIG_SHOWPALETTE_FILTER)+= vf_showpalette.o OBJS-$(CONFIG_SHUFFLEFRAMES_FILTER) += vf_shuffleframes.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 557590850b..4b90a7f440 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -333,6 +333,7 @@ extern AVFilter ff_vf_setrange; extern AVFilter ff_vf_setsar; extern AVFilter ff_vf_settb; extern AVFilter ff_vf_sharpness_vaapi; +extern AVFilter ff_vf_rotation_vaapi; extern AVFilter ff_vf_showinfo; extern AVFilter ff_vf_showpalette; extern AVFilter ff_vf_shuffleframes; diff --git a/libavfilter/vaapi_vpp.h b/libavfilter/vaapi_vpp.h index 0bc31018d4..cfe19b689f 100644 --- a/libavfilter/vaapi_vpp.h +++ b/libavfilter/vaapi_vpp.h @@ -44,6 +44,7 @@ typedef struct VAAPIVPPContext { int output_width; // computed width int output_height; // computed height +int rotation_state; VABufferID filter_buffers[VAProcFilterCount]; intnb_filter_buffers; diff --git a/libavfilter/vf_rotate_vaapi.c b/libavfilter/vf_rotate_vaapi.c new file mode 100644 index 00..82e2a0fce4 --- /dev/null +++ b/libavfilter/vf_rotate_vaapi.c @@ -0,0 +1,252 @@ +/* + * 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 + */ +#include + +#include "libavutil/avassert.h" +#include "libavutil/mem.h" +#include "libavutil/opt.h" +#include "libavutil/pixdesc.h" + +#include "avfilter.h" +#include "formats.h" +#include "internal.h" +#include "vaapi_vpp.h" + +// Rotation angle values +enum RotationAngle { +ROTATION_0 = 0, +ROTATION_90 = 90, +ROTATION_180 = 180, +ROTATION_270 = 270, + +ROTATION_MIN = ROTATION_0, +ROTATION_MAX = ROTATION_270, +ROTATION_DEFAULT = ROTATION_0, +}; + +typedef struct RotationVAAPIContext { +VAAPIVPPContext vpp_ctx; // must be the first field + +int rotation; +} RotationVAAPIContext; + +static int rotation_vaapi_build_filter_params(AVFilterContext *avctx) +{ +VAAPIVPPContext *vpp_ctx = avctx->priv; +RotationVAAPIContext *ctx = avctx->priv; + +VAStatus vas; +int support_flag; + +VAProcPipelineCaps pipeline_caps; + +memset(&pipeline_caps, 0, sizeof(pipeline_caps)); +vas = vaQueryVideoProcPipelineCaps(vpp_ctx->hwctx->display, + vpp_ctx->va_context, +
Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD driver
> -Original Message- > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of > Michael Niedermayer > Sent: Wednesday, October 31, 2018 3:53 AM > To: FFmpeg development discussions and patches > Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi > rotation feature via call Intel iHD driver > > On Mon, Oct 29, 2018 at 01:42:55AM +, Zhou, Zachary wrote: > > > > > > > -Original Message- > > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On > > > Behalf Of Michael Niedermayer > > > Sent: Saturday, October 27, 2018 5:16 AM > > > To: FFmpeg development discussions and patches > > > > > > Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable > > > vaapi rotation feature via call Intel iHD driver > > > > > > On Thu, Oct 25, 2018 at 02:52:01PM +0800, Zachary Zhou wrote: > > > > It supports clockwise rotation by 0/90/180/270 degrees defined in > > > > va/va_vpp.h, tested following command line on SKL platform > > > > > > > > dir=0 for 0 degree > > > > dir=1 for 90 degree > > > > dir=2 for 180 degree > > > > dir=3 for 270 degree > > > > > > > > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 > > > > -hwaccel_output_format vaapi -i input.264 -vf "rotation_vaapi=dir=1" > > > > -c:v h264_vaapi output.h264 > > > > > > > > Signed-off-by: Zachary Zhou > > > > --- > > > > configure | 3 + > > > > libavfilter/Makefile | 1 + > > > > libavfilter/allfilters.c | 1 + > > > > libavfilter/vaapi_vpp.h | 1 + > > > > libavfilter/vf_rotate_vaapi.c | 252 > > > > ++ > > > > 5 files changed, 258 insertions(+) create mode 100644 > > > > libavfilter/vf_rotate_vaapi.c > > > > > > still fails to build on 32bit x86 > > > > > > src/libavfilter/vf_rotate_vaapi.c: In function > > > ‘rotation_vaapi_build_filter_params’: > > > src/libavfilter/vf_rotate_vaapi.c:69:23: error: ‘VAProcPipelineCaps’ > > > has no member named ‘rotation_flags’ > > > if (!pipeline_caps.rotation_flags) { > > >^ > > > src/libavfilter/vf_rotate_vaapi.c:95:33: error: ‘VAProcPipelineCaps’ > > > has no member named ‘rotation_flags’ > > > support_flag = pipeline_caps.rotation_flags & > > > ^ > > > src/libavfilter/vf_rotate_vaapi.c: In function > > > ‘rotation_vaapi_filter_frame’: > > > src/libavfilter/vf_rotate_vaapi.c:152:15: error: > > > ‘VAProcPipelineParameterBuffer’ has no member named ‘rotation_state’ > > > params.rotation_state = vpp_ctx->rotation_state; > > >^ > > > make: *** [libavfilter/vf_rotate_vaapi.o] Error 1 > > > make: *** Waiting for unfinished jobs > > > > > > grep VAAPI ffbuild/config.mak > > > !HAVE_VAAPI_DRM=yes > > > !HAVE_VAAPI_X11=yes > > > !HAVE_OPENCL_VAAPI_BEIGNET=yes > > > !HAVE_OPENCL_VAAPI_INTEL_MEDIA=yes > > > !CONFIG_VAAPI_ENCODE_EXAMPLE=yes > > > !CONFIG_VAAPI_TRANSCODE_EXAMPLE=yes > > > !CONFIG_VAAPI=yes > > > !CONFIG_VAAPI_1=yes > > > !CONFIG_VAAPI_ENCODE=yes > > > !CONFIG_H264_VAAPI_ENCODER=yes > > > !CONFIG_HEVC_VAAPI_ENCODER=yes > > > !CONFIG_MJPEG_VAAPI_ENCODER=yes > > > !CONFIG_MPEG2_VAAPI_ENCODER=yes > > > !CONFIG_VP8_VAAPI_ENCODER=yes > > > !CONFIG_VP9_VAAPI_ENCODER=yes > > > !CONFIG_H263_VAAPI_HWACCEL=yes > > > !CONFIG_H264_VAAPI_HWACCEL=yes > > > !CONFIG_HEVC_VAAPI_HWACCEL=yes > > > !CONFIG_MJPEG_VAAPI_HWACCEL=yes > > > !CONFIG_MPEG2_VAAPI_HWACCEL=yes > > > !CONFIG_MPEG4_VAAPI_HWACCEL=yes > > > !CONFIG_VC1_VAAPI_HWACCEL=yes > > > !CONFIG_VP8_VAAPI_HWACCEL=yes > > > !CONFIG_VP9_VAAPI_HWACCEL=yes > > > !CONFIG_WMV3_VAAPI_HWACCEL=yes > > > !CONFIG_DEINTERLACE_VAAPI_FILTER=yes > > > !CONFIG_DENOISE_VAAPI_FILTER=yes > > > !CONFIG_PROCAMP_VAAPI_FILTER=yes > > > !CONFIG_SCALE_VAAPI_FILTER=yes > > > !CONFIG_SHARPNESS_VAAPI_FILTER=yes > > > CONFIG_ROTATION_VAAPI_FILTER=yes > > > > > > [...] > > > > Thanks Michael, Can you share your command line for the build script > configure ? > > Do I need more setting on the configure file ? > > i simplified it a bit, this can still reproduce it: > make distclean ; ../configure --cc='ccache gcc -m32' && make -j12 > > > src/libavfilter/vf_rotate_vaapi.c: In function > ‘rotation_vaapi_build_filter_params’: > src/libavfilter/vf_rotate_vaapi.c:69:23: error: ‘VAProcPipelineCaps’ has no > member named ‘rotation_flags’ > if (!pipeline_caps.rotation_flags) { >^ > src/libavfilter/vf_rotate_vaapi.c:95:33: error: ‘VAProcPipelineCaps’ has no > member named ‘rotation_flags’ > support_flag = pipeline_caps.rotation_flags & > ^ > src/libavfilter/vf_rotate_vaapi.c: In function ‘rotation_vaapi_filter_frame’: > src/libavfilter/vf_rotate_vaapi.c:152:15: error: > ‘VAProcPipelineParameterBuffer’ has no member named ‘rotation_state’ > params.rotation_state = vpp_ctx->rotation_state; >^ > make: *** [libavfilter/vf_rotate_vaapi.o] Error 1 > make: *** Waiti