Re: [FFmpeg-devel] [PATCH 1/3] avformat/rtsp: Fix floating point exception for low min/max port range
> On Apr 4, 2021, at 11:36 PM, Andriy Gelman wrote: > > From: Andriy Gelman > > Fixed by setting port offset to zero when it cannot be computed. > > To reproduce: > $ ffmpeg -min_port 32000 -max_port 32001 -i > rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov -f null - > [1]303871 floating point exception (core dumped) > > Signed-off-by: Andriy Gelman > --- > libavformat/rtsp.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c > index 25bdf475b3..76efbf42cd 100644 > --- a/libavformat/rtsp.c > +++ b/libavformat/rtsp.c > @@ -1446,7 +1446,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, > const char *host, int port, > int lower_transport, const char *real_challenge) > { > RTSPState *rt = s->priv_data; > -int rtx = 0, j, i, err, interleave = 0, port_off; > +int rtx = 0, j, i, err, interleave = 0, port_off = 0; > RTSPStream *rtsp_st; > RTSPMessageHeader reply1, *reply = &reply1; > char cmd[MAX_URL_SIZE]; > @@ -1465,9 +1465,11 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, > const char *host, int port, > /* Choose a random starting offset within the first half of the > * port range, to allow for a number of ports to try even if the offset > * happens to be at the end of the random range. */ > +if (rt->rtp_port_max - rt->rtp_port_min > 1) { > port_off = av_get_random_seed() % ((rt->rtp_port_max - > rt->rtp_port_min)/2); > /* even random offset */ > port_off -= port_off & 0x01; > +} (rt->rtp_port_max - rt->rtp_port_min)/2 should larger than one, otherwise port_off is always zero. So how about `if (rt->rtp_port_max - rt->rtp_port_min >= 4)`? > > for (j = rt->rtp_port_min + port_off, i = 0; i < rt->nb_rtsp_streams; > ++i) { > char transport[MAX_URL_SIZE]; > -- > 2.31.0 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] lavfi/dnn_backend_openvino.c: Fix Memory Leak in execute_model_ov
> -Original Message- > From: ffmpeg-devel On Behalf Of > Shubhanshu Saxena > Sent: 2021年6月19日 0:23 > To: ffmpeg-devel@ffmpeg.org > Cc: Shubhanshu Saxena > Subject: [FFmpeg-devel] [PATCH] lavfi/dnn_backend_openvino.c: Fix > Memory Leak in execute_model_ov > > In cases where the execution inside the function execute_model_ov fails, > push the RequestItem back to the request_queue before returning the error. > In case pushing back fails, release the allocated memory. > > Signed-off-by: Shubhanshu Saxena > --- > libavfilter/dnn/dnn_backend_openvino.c | 12 +--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/libavfilter/dnn/dnn_backend_openvino.c > b/libavfilter/dnn/dnn_backend_openvino.c > index 702c4fb9ee..29ec8f6a8f 100644 > --- a/libavfilter/dnn/dnn_backend_openvino.c > +++ b/libavfilter/dnn/dnn_backend_openvino.c > @@ -448,12 +448,12 @@ static DNNReturnType > execute_model_ov(RequestItem *request, Queue *inferenceq) > status = ie_infer_set_completion_callback(request->infer_request, > &request->callback); > if (status != OK) { > av_log(ctx, AV_LOG_ERROR, "Failed to set completion callback for > inference\n"); > -return DNN_ERROR; > +goto err; > } > status = ie_infer_request_infer_async(request->infer_request); > if (status != OK) { > av_log(ctx, AV_LOG_ERROR, "Failed to start async inference\n"); > -return DNN_ERROR; > +goto err; > } > return DNN_SUCCESS; > } else { > @@ -464,11 +464,17 @@ static DNNReturnType > execute_model_ov(RequestItem *request, Queue *inferenceq) > status = ie_infer_request_infer(request->infer_request); > if (status != OK) { > av_log(ctx, AV_LOG_ERROR, "Failed to start synchronous model > inference\n"); > -return DNN_ERROR; > +goto err; > } > infer_completion_callback(request); > return (task->inference_done == task->inference_todo) ? > DNN_SUCCESS : DNN_ERROR; > } > +err: > +if (ff_safe_queue_push_back(ov_model->request_queue, request) < 0) > { > +ie_infer_request_free(&request->infer_request); > +av_freep(&request); > +} > +return DNN_ERROR; > } > > static DNNReturnType get_input_ov(void *model, DNNData *input, const > char *input_name) > -- LGTM, will push soon, thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/3] lavc/libsvtav1: Enable svtav1-params like x264-params in libx264
4 Jul 2021, 03:40 by mypopy...@gmail.com: > From: Jun Zhao > > Enabled the svtav1-params, then we can set all the params > The whole purpose of the params field was to give it off to the encoder and have it do its own parsing, such that we wouldn't have to keep up adding more and more options. But svt-av1 cannot parse a generic option field on its own, so no, add those as separate options rather than a generic text field. > Signed-off-by: Jun Zhao > --- > libavcodec/libsvtav1.c | 337 + > 1 file changed, 337 insertions(+) > > diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c > index fabc4e6428..9d72a35f6c 100644 > --- a/libavcodec/libsvtav1.c > +++ b/libavcodec/libsvtav1.c > @@ -71,6 +71,8 @@ typedef struct SvtContext { > > int tile_columns; > int tile_rows; > + > +AVDictionary *svt_av1_params; > } SvtContext; > > static const struct { > @@ -146,11 +148,334 @@ static int alloc_buffer(EbSvtAv1EncConfiguration > *config, SvtContext *svt_enc) > > } > > +static void set_asm_type(EbSvtAv1EncConfiguration *p, const char *value) > +{ > +const struct { > +const char *name; > +CPU_FLAGS flags; > +} param_maps[] = { > +{"c", 0}, > +{"0", 0}, > + > +{"mmx", (CPU_FLAGS_MMX << 1) - 1}, > +{"1", (CPU_FLAGS_MMX << 1) - 1}, > + > +{"sse", (CPU_FLAGS_SSE << 1) - 1}, > +{"2", (CPU_FLAGS_SSE << 1) - 1}, > + > +{"sse2", (CPU_FLAGS_SSE2 << 1) - 1}, > +{"3",(CPU_FLAGS_SSE2 << 1) - 1}, > + > +{"sse3", (CPU_FLAGS_SSE3 << 1) - 1}, > +{"4",(CPU_FLAGS_SSE3 << 1) - 1}, > + > +{"ssse3", (CPU_FLAGS_SSSE3 << 1) - 1}, > +{"5", (CPU_FLAGS_SSSE3 << 1) - 1}, > + > +{"sse4_1", (CPU_FLAGS_SSE4_1 << 1) - 1}, > +{"6", (CPU_FLAGS_SSE4_1 << 1) - 1}, > + > +{"sse4_2", (CPU_FLAGS_SSE4_2 << 1) - 1}, > +{"7", (CPU_FLAGS_SSE4_2 << 1) - 1}, > + > +{"avx", (CPU_FLAGS_AVX << 1) - 1}, > +{"8", (CPU_FLAGS_AVX << 1) - 1}, > + > +{"avx2", (CPU_FLAGS_AVX2 << 1) - 1}, > +{"9",(CPU_FLAGS_AVX2 << 1) - 1}, > + > +{"avx512", (CPU_FLAGS_AVX512VL << 1) - 1}, > +{"10", (CPU_FLAGS_AVX512VL << 1) - 1}, > + > +{"max", CPU_FLAGS_ALL}, > +{"11", CPU_FLAGS_ALL}, > +}; > We already have a generic way to set up cpuflags, you should use that instead of adding another field. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] lavd/lavfi.c: Set time_base for 608 cc to container time_base.
Am 28.06.21 um 15:12 schrieb Thilo Borgmann: > Hi, > >> when transcoding 608 cc, the cc stream frame pts is set to the same value as >> its container frame's pts. However, the time_base is always set to 1/9 >> (default) in the initialization stage. Which causes timing issues when the >> container time_base is actually not 1/9. > > identical v2 attached that also includes updates to the FATE references > affected by the patch (and failed with patchwork of course). Ping for review. -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: Add new variant source_no_drop to the force_key_frames option
Hi, > adds a new variant to the -force_key_frames option "source_no_drop" to make > sure whenever a key frame in the source is dropped, we choose the next frame > in the output stream as a key frame. ping for review. -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] fftools/cmdutils.c: Add cmd line option to override detection of cpu count
Hi, >>> add an option to override auto-detection of cpu count. Defaults to >>> auto-detection, of course. >>> >>> -Thilo >>> >> >>> >>> doc/fftools-common-opts.texi | 7 +++ >>> fftools/cmdutils.c | 27 +++ >>> fftools/cmdutils.h | 7 +++ >>> libavutil/cpu.c | 14 ++ >>> libavutil/cpu.h | 6 ++ >> >> The changes to libavutil and cmdutils should be in separate patches; and >> of course the commit message should mention that you are changing >> libavutil -- I would have nearly missed this patch (given that I don't >> pay much attention to fftools in general). >> >>> >>> diff --git a/libavutil/cpu.c b/libavutil/cpu.c >>> index 52f6b9a3bf..ccd5b5adac 100644 >>> --- a/libavutil/cpu.c >>> +++ b/libavutil/cpu.c >> >> 52f6b9a3bf is the state of cpu.c after >> e387fcd01cb84d9493f3b96158addd2a85f086c6. This is completely outdated. > > Yes, messed up branches for the patch, thx! > > >>> >>> @@ -306,14 +307,27 @@ int av_cpu_count(void) >>> nb_cpus = sysinfo.dwNumberOfProcessors; >>> #endif >>> >>> +int count = atomic_load_explicit(&cpu_count, memory_order_relaxed); >>> + >>> if (!printed) { >>> av_log(NULL, AV_LOG_DEBUG, "detected %d logical cores\n", nb_cpus); >>> +if (count > 0) { >>> +av_log(NULL, AV_LOG_DEBUG, "overriding to %d logical cores\n", >>> count); >>> +} >>> printed = 1; >>> } >>> >>> +if (count > 0) { >>> +nb_cpus = count; >>> +} >>> + >>> return nb_cpus; >>> } >>> >> In particular, this hunk doesn't apply to git master at all any more >> (did I already mention that cpu.c only has 245 lines atm, not >300?). >> And the declaration of count would lead to a statement-after-declaration >> warning. > > Done locally to apply to today's HEAD. I think I'll wait with sending both > patches once we decided on atomic loads in "[PATCH] Stop using _explicit > atomic operations where not necessary.". Discussion on atomic loads appear to have stalled mid-June... If there are no hard feeling, I'll push this version soon as the explicit (or not) loads can then be changed later. -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/setts_bsf: actually store the current packet's timestamps to be usable by the next
LGTM ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/2] avcodec/setts_bsf: add a NOPTS constant
LGTM, please update documentation. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/2] avcodec/setts_bsf: add a NOPTS constant
On 7/4/2021 10:17 AM, Paul B Mahol wrote: LGTM, please update documentation. Done and pushed. Thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] fftools/ffmpeg: accelerate seeking while reading input at native frame rate
From: Linjie Fu Skip the logic of frame rate emulation until the input reaches the specified start time. Test CMD: $ffmpeg -re -ss 30 -i input.mp4 -pix_fmt yuv420p -f sdl2 - Before the patch: first time to got frame, it takes 257305 us After this patch: first time to got frame, it takes 48879 us Signed-off-by: Linjie Fu --- [v2]: fixed the mixed declaration and code warning Calculate the time to get the first frame: https://github.com/fulinjie/ffmpeg/commit/2aa4762e1e65709997b1ab9dd596332244db80ed fftools/ffmpeg.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index e97d879cb3..c8849e4250 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -4221,10 +4221,14 @@ static int get_input_packet(InputFile *f, AVPacket **pkt) { if (f->rate_emu) { int i; +int64_t pts; +int64_t now; for (i = 0; i < f->nb_streams; i++) { InputStream *ist = input_streams[f->ist_index + i]; -int64_t pts = av_rescale(ist->dts, 100, AV_TIME_BASE); -int64_t now = av_gettime_relative() - ist->start; +if (!ist->got_output) +continue; +pts = av_rescale(ist->dts, 100, AV_TIME_BASE); +now = av_gettime_relative() - ist->start; if (pts > now) return AVERROR(EAGAIN); } -- 2.31.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/3] avformat/rtsp: Fix floating point exception for low min/max port range
Hi Zhili, On Sun, 04. Jul 19:00, "zhilizhao(赵志立)" wrote: > > > > On Apr 4, 2021, at 11:36 PM, Andriy Gelman wrote: > > > > From: Andriy Gelman > > > > Fixed by setting port offset to zero when it cannot be computed. > > > > To reproduce: > > $ ffmpeg -min_port 32000 -max_port 32001 -i > > rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov -f null - > > [1]303871 floating point exception (core dumped) > > > > Signed-off-by: Andriy Gelman > > --- > > libavformat/rtsp.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c > > index 25bdf475b3..76efbf42cd 100644 > > --- a/libavformat/rtsp.c > > +++ b/libavformat/rtsp.c > > @@ -1446,7 +1446,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, > > const char *host, int port, > > int lower_transport, const char > > *real_challenge) > > { > > RTSPState *rt = s->priv_data; > > -int rtx = 0, j, i, err, interleave = 0, port_off; > > +int rtx = 0, j, i, err, interleave = 0, port_off = 0; > > RTSPStream *rtsp_st; > > RTSPMessageHeader reply1, *reply = &reply1; > > char cmd[MAX_URL_SIZE]; > > @@ -1465,9 +1465,11 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, > > const char *host, int port, > > /* Choose a random starting offset within the first half of the > > * port range, to allow for a number of ports to try even if the offset > > * happens to be at the end of the random range. */ > > +if (rt->rtp_port_max - rt->rtp_port_min > 1) { > > port_off = av_get_random_seed() % ((rt->rtp_port_max - > > rt->rtp_port_min)/2); > > /* even random offset */ > > port_off -= port_off & 0x01; > > +} > > (rt->rtp_port_max - rt->rtp_port_min)/2 should larger than one, otherwise > port_off is always zero. > > So how about `if (rt->rtp_port_max - rt->rtp_port_min >= 4)`? > Sure, this way works too. I don't mind either way. Thanks, -- Andriy ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] Fwd: Re: [PATCH] mxfdec.c: prefer metadata from Footer
On Sat, 3 Jul 2021, Tomas Härdin wrote: lör 2021-07-03 klockan 15:13 +0200 skrev emco...@ffastrans.com: Unfortunately the wetransfer link for the fate samples expired, so i thought it might be a good idea to resend it as link to gdrive: https://drive.google.com/file/d/1yXTdS9RfOsduzg49vBLEshdmIzdaVQfd/view?usp=sharing Also attached the 2 patches: 1 from cus for mxfdec.c and one from myself for the corresponding fate samples. After applying the mxfdec.c patch, fate will pass with the currently existing tests but the files in the zip must be uploaded to the fate suite before applying my corresponding patch of course (otherwise the files don't exist). It would be cool if someone found the time and wants to apply this. The patch works (except for the samples not being in FATE) Actually I found one file where the packetization behaviour changes, because after the patch a fake index is generated based of the now recognized duration: samples/MXF/freemxf/freeMXF-mxf-dv-1.mxf but I guess the file is wrong because clip wrapped UL is used when the file seems frame wrapped instead? +// Index Table is special because it might be added manually without +// partition and we iterate thorugh all instances of them. Also some files +// use the same Instance UID for different index tables... +if (type != IndexTableSegment) { +for (int i = 0; i < mxf->metadata_sets_count; i++) { +if (!memcmp((*metadata_set)->uid, mxf->metadata_sets[i]->uid, 16) && type == mxf->metadata_sets[i]->type) { +MXFPartition *old_p = mxf->metadata_sets[i]->partition; +int old_s = partition_score(old_p); +int new_s = partition_score(new_p); +if (old_s > new_s || old_s == new_s && old_p->this_partition > new_p->this_partition) { + mxf_free_metadataset(metadata_set, 1); + return 0; This seems asymmetric. Shouldn't this also delete metadata sets that metadata_set scores higher than? I was uneasy about deleting existing metadata sets because I thought various MXF structs might already have pointers to existing metadata sets, or some allocated members of existing metadata sets. On the other hand, when adding a new set, we can free it without the risk of having refences to it. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 1/3] avformat/rtsp: Set port_off to zero for low min/max port range
From: Andriy Gelman Fixes: $ ffmpeg -min_port 32000 -max_port 32001 -i rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov -f null - [1]303871 floating point exception (core dumped) Signed-off-by: Andriy Gelman --- libavformat/rtsp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 9f509a229f..0185baca8e 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1438,7 +1438,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, int lower_transport, const char *real_challenge) { RTSPState *rt = s->priv_data; -int rtx = 0, j, i, err, interleave = 0, port_off; +int rtx = 0, j, i, err, interleave = 0, port_off = 0; RTSPStream *rtsp_st; RTSPMessageHeader reply1, *reply = &reply1; char cmd[MAX_URL_SIZE]; @@ -1457,9 +1457,11 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, /* Choose a random starting offset within the first half of the * port range, to allow for a number of ports to try even if the offset * happens to be at the end of the random range. */ +if (rt->rtp_port_max - rt->rtp_port_min >= 4) { port_off = av_get_random_seed() % ((rt->rtp_port_max - rt->rtp_port_min)/2); /* even random offset */ port_off -= port_off & 0x01; +} for (j = rt->rtp_port_min + port_off, i = 0; i < rt->nb_rtsp_streams; ++i) { char transport[MAX_URL_SIZE]; -- 2.32.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 2/3] avformat/rtsp: Reindent after previous commit
From: Andriy Gelman Signed-off-by: Andriy Gelman --- libavformat/rtsp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 0185baca8e..bedb75c7bd 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1458,9 +1458,9 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, * port range, to allow for a number of ports to try even if the offset * happens to be at the end of the random range. */ if (rt->rtp_port_max - rt->rtp_port_min >= 4) { -port_off = av_get_random_seed() % ((rt->rtp_port_max - rt->rtp_port_min)/2); -/* even random offset */ -port_off -= port_off & 0x01; +port_off = av_get_random_seed() % ((rt->rtp_port_max - rt->rtp_port_min)/2); +/* even random offset */ +port_off -= port_off & 0x01; } for (j = rt->rtp_port_min + port_off, i = 0; i < rt->nb_rtsp_streams; ++i) { -- 2.32.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 3/3] avformat/rtsp: Include rtcp in port range check
From: Andriy Gelman Currently it is only checked that the rtp port does not exceed rtp_port_max. Signed-off-by: Andriy Gelman --- libavformat/rtsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index bedb75c7bd..a3026f8b73 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1500,7 +1500,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, } /* first try in specified port range */ -while (j <= rt->rtp_port_max) { +while (j + 1 <= rt->rtp_port_max) { AVDictionary *opts = map_to_opts(rt); ff_url_join(buf, sizeof(buf), "rtp", NULL, host, -1, -- 2.32.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 2/2] avfilter/vf_subtitles: Added shift option for subtitles/ass filters.
Allows shifting of subtitle display times to align them with the video. This avoids having to rewrite the subtitle file in order to display subtitles correctly when input is seeked (-ss). Also handy for minor subtitle timing corrections without rewriting the subtitles file. Signed-off-by: Manolis Stamatogiannakis --- doc/filters.texi | 11 libavfilter/vf_subtitles.c | 55 +- 2 files changed, 59 insertions(+), 7 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 61c4cfc150..eebf455692 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -19474,6 +19474,9 @@ Common @ref{subtitles}/@ref{ass} filter options: @item filename, f Set the filename of the subtitle file to read. It must be specified. +@item shift +Shift subtitles timings by the specified amount. + @item original_size Specify the size of the original video, the video for which the ASS file was composed. For the syntax of this option, check the @@ -19487,6 +19490,9 @@ These fonts will be used in addition to whatever the font provider uses. @item alpha Process alpha channel, by default alpha channel is untouched. + +@item shift +Shift subtitles timings by the specified amount. @end table Additional options for @ref{subtitles} filter: @@ -19533,6 +19539,11 @@ To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF' @end example +To re-sync subtitles after seeking the input e.g. with @code{-ss 20:20}, use: +@example +subtitles=filename=sub.srt:shift='-20\:20' +@end example + @section super2xsai Scale the input by 2x and smooth using the Super2xSaI (Scale and diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c index ab32e1b7f3..2c7ce267e1 100644 --- a/libavfilter/vf_subtitles.c +++ b/libavfilter/vf_subtitles.c @@ -52,6 +52,7 @@ typedef struct AssContext { char *filename; char *fontsdir; char *charenc; +int64_t shift; char *force_style; int stream_index; int alpha; @@ -66,11 +67,12 @@ typedef struct AssContext { #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM #define COMMON_OPTIONS \ -{"filename", "set the filename of file to read", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS }, \ -{"f", "set the filename of file to read", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS }, \ -{"original_size", "set the size of the original video (used to scale fonts)", OFFSET(original_w), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, FLAGS }, \ -{"fontsdir", "set the directory containing the fonts to read", OFFSET(fontsdir), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS }, \ -{"alpha", "enable processing of alpha channel", OFFSET(alpha), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, FLAGS }, \ +{"filename", "set the filename of file to read", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS }, \ +{"f", "set the filename of file to read", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS }, \ +{"original_size", "set the size of the original video (used to scale fonts)", OFFSET(original_w), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, FLAGS }, \ +{"fontsdir", "set the directory containing the fonts to read", OFFSET(fontsdir), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS }, \ +{"alpha", "enable processing of alpha channel", OFFSET(alpha), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, FLAGS }, \ +{"shift", "shift subtitles timing", OFFSET(shift), AV_OPT_TYPE_DURATION, {.i64 = 0 }, INT64_MIN, INT64_MAX, FLAGS }, \ /* libass supports a log level ranging from 0 to 7 */ static const int ass_libavfilter_log_level_map[] = { @@ -103,6 +105,11 @@ static av_cold int init(AVFilterContext *ctx) return AVERROR(EINVAL); } +if (ass->shift != 0) { +ass->shift = av_rescale_q(ass->shift, AV_TIME_BASE_Q, av_make_q(1, 1000)); +av_log(ctx, AV_LOG_INFO, "Shifting subtitles by %0.3fsec.\n", ass->shift/1000.0); +} + ass->library = ass_library_init(); if (!ass->library) { av_log(ctx, AV_LOG_ERROR, "Could not initialize libass.\n"); @@ -228,6 +235,8 @@ AVFILTER_DEFINE_CLASS(ass); static av_cold int init_ass(AVFilterContext *ctx) { +int eid, nskip; +ASS_Event *event; AssContext *ass = ctx->priv; int ret = init(ctx); @@ -244,6 +253,25 @@ static av_cold int init_ass(AVFilterContext *ctx)
[FFmpeg-devel] [PATCH v1 1/2] avfilter/vf_subtitles: Reorganized subtitles filter options.
Some options are common between subtitles/ass filters. Rather than mentioning for each option whether it is common or not, the options are now displayed in two separate tables. Signed-off-by: Manolis Stamatogiannakis --- doc/filters.texi | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index eaf23e3736..61c4cfc150 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -7093,6 +7093,7 @@ This filter supports the following @ref{commands} that corresponds to option of @item planes @end table +@anchor{ass} @section ass Same as the @ref{subtitles} filter, except that it doesn't require libavcodec @@ -19467,7 +19468,7 @@ To enable compilation of this filter you need to configure FFmpeg with libavformat to convert the passed subtitles file to ASS (Advanced Substation Alpha) subtitles format. -The filter accepts the following options: +Common @ref{subtitles}/@ref{ass} filter options: @table @option @item filename, f @@ -19486,13 +19487,16 @@ These fonts will be used in addition to whatever the font provider uses. @item alpha Process alpha channel, by default alpha channel is untouched. +@end table +Additional options for @ref{subtitles} filter: + +@table @option @item charenc -Set subtitles input character encoding. @code{subtitles} filter only. Only -useful if not UTF-8. +Set subtitles input character encoding. Only useful if not UTF-8. @item stream_index, si -Set subtitles stream index. @code{subtitles} filter only. +Set subtitles stream index. @item force_style Override default style or script info parameters of the subtitles. It accepts a -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avfilter/f_metadata: do not return the frame early if there is no metadata
On Wed, 23 Jun 2021, Marton Balint wrote: On Wed, 23 Jun 2021, Gyan Doshi wrote: On 2021-06-23 06:11, Marton Balint wrote: The early return caused isses for the "add" mode (got fixed in c95dfe5cce98cde3e7fb14fbd04b3897f3927cec) and the "select" mode needs a similar fix. It is probably better to fully remove the check, since all modes work correctly with NULL metadata. Doesn't select mode imply the presence of a dictionary? Select mode selects frames with metadata, if there is no metadata the frame should NOT be selected, but currently it is. Will apply. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] Fwd: Re: [PATCH] mxfdec.c: prefer metadata from Footer
Am 2021-07-04 17:28, schrieb Marton Balint: On Sat, 3 Jul 2021, Tomas Härdin wrote: lör 2021-07-03 klockan 15:13 +0200 skrev emco...@ffastrans.com: Unfortunately the wetransfer link for the fate samples expired, so i thought it might be a good idea to resend it as link to gdrive: https://drive.google.com/file/d/1yXTdS9RfOsduzg49vBLEshdmIzdaVQfd/view?usp=sharing Also attached the 2 patches: 1 from cus for mxfdec.c and one from myself for the corresponding fate samples. After applying the mxfdec.c patch, fate will pass with the currently existing tests but the files in the zip must be uploaded to the fate suite before applying my corresponding patch of course (otherwise the files don't exist). It would be cool if someone found the time and wants to apply this. The patch works (except for the samples not being in FATE) Actually I found one file where the packetization behaviour changes, because after the patch a fake index is generated based of the now recognized duration: samples/MXF/freemxf/freeMXF-mxf-dv-1.mxf but I guess the file is wrong because clip wrapped UL is used when the file seems frame wrapped instead? Nice finding! I can confirm this, it is actually clip wrapped looking at the mxf dump from bmx. These samples are pretty outdated anyway :D Unfortunately i don't have enough insight on the internals yet on the topic about adding/freeing/deleting metadata sets :-( ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] Fwd: Re: [PATCH] mxfdec.c: prefer metadata from Footer
Am 2021-07-04 20:28, schrieb emco...@ffastrans.com: Am 2021-07-04 17:28, schrieb Marton Balint: On Sat, 3 Jul 2021, Tomas Härdin wrote: lör 2021-07-03 klockan 15:13 +0200 skrev emco...@ffastrans.com: Unfortunately the wetransfer link for the fate samples expired, so i thought it might be a good idea to resend it as link to gdrive: https://drive.google.com/file/d/1yXTdS9RfOsduzg49vBLEshdmIzdaVQfd/view?usp=sharing Also attached the 2 patches: 1 from cus for mxfdec.c and one from myself for the corresponding fate samples. After applying the mxfdec.c patch, fate will pass with the currently existing tests but the files in the zip must be uploaded to the fate suite before applying my corresponding patch of course (otherwise the files don't exist). It would be cool if someone found the time and wants to apply this. The patch works (except for the samples not being in FATE) Actually I found one file where the packetization behaviour changes, because after the patch a fake index is generated based of the now recognized duration: samples/MXF/freemxf/freeMXF-mxf-dv-1.mxf but I guess the file is wrong because clip wrapped UL is used when the file seems frame wrapped instead? Nice finding! I can confirm this, it is actually clip wrapped looking at the mxf dump from bmx. These samples are pretty outdated anyway :D Unfortunately i don't have enough insight on the internals yet on the topic about adding/freeing/deleting metadata sets :-( FRAME Wrapped it is, not clip wrapped :rolleyes: ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: Add new variant source_no_drop to the force_key_frames option
On Sun, Jun 20, 2021 at 09:48:29PM +0200, Thilo Borgmann wrote: > Hi, > > adds a new variant to the -force_key_frames option "source_no_drop" to make > sure whenever a key frame in the source is dropped, we choose the next frame > in the output stream as a key frame. > > -Thilo > doc/ffmpeg.texi |7 +++ > fftools/ffmpeg.c |6 ++ > fftools/ffmpeg.h |1 + > 3 files changed, 14 insertions(+) > e8ffd04204a6cc243b2f98858ec1f1afe44ff8e8 > 0001-fftools-ffmpeg-Add-new-variant-source_no_drop-to-the.patch > From b37c854e7d48b538537b2c9c5e9651ba2ead3e52 Mon Sep 17 00:00:00 2001 > From: Keyun Tong > Date: Sun, 20 Jun 2021 21:42:29 +0200 > Subject: [PATCH] fftools/ffmpeg: Add new variant source_no_drop to the > force_key_frames option LGTM if both variants have a use case thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Let us carefully observe those good qualities wherein our enemies excel us and endeavor to excel them, by avoiding what is faulty, and imitating what is excellent in them. -- Plutarch signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/mjpegdec: Try to continue decoding on zero quant matrix value
On Sat, Jul 03, 2021 at 12:25:28PM -0400, Andriy Gelman wrote: > From: Andriy Gelman > > A zero value in the quantization matrix is invalid but in practice will > just set the transform coefficient to zero after inverse quantization. > Try to continue decoding if the AV_EF_EXPLODE flag is not set. > > Fixes ticket #9287. > > Signed-off-by: Andriy Gelman > --- > > The last frame in the sample of the ticket does not decode because the > input file appears truncated. > Something like the following patch would still be needed to output the final > frame: > https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210627135307.14008-1-mich...@niedermayer.cc/ > > libavcodec/mjpegdec.c | 6 -- > 1 file changed, 4 insertions(+), 2 deletions(-) LGTM thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Never trust a computer, one day, it may think you are the virus. -- Compn signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2 3/3] avformat/rtsp: Include rtcp in port range check
On Sun, 4 Jul 2021, Andriy Gelman wrote: From: Andriy Gelman Currently it is only checked that the rtp port does not exceed rtp_port_max. Signed-off-by: Andriy Gelman --- libavformat/rtsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index bedb75c7bd..a3026f8b73 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1500,7 +1500,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, } /* first try in specified port range */ -while (j <= rt->rtp_port_max) { +while (j + 1 <= rt->rtp_port_max) { AVDictionary *opts = map_to_opts(rt); ff_url_join(buf, sizeof(buf), "rtp", NULL, host, -1, -- 2.32.0 These three patches seem ok to me, assuming you've tested them. // Martin ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/9] cbs_av1: fix incorrect data type
On Fri, 2021-07-02 at 08:29 -0300, James Almer wrote: > On 7/2/2021 2:55 AM, Wang, Fei W wrote: > > On Thu, 2021-07-01 at 09:41 -0300, James Almer wrote: > > > On 6/17/2021 3:10 AM, Fei Wang wrote: > > > > shifted_order_hints is computed by data with int plus data with > > > > int. > > > > Switch to int8_t may lose its precision. > > > > > > > > Signed-off-by: Fei Wang > > > > --- > > > >libavcodec/cbs_av1_syntax_template.c | 2 +- > > > >1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/libavcodec/cbs_av1_syntax_template.c > > > > b/libavcodec/cbs_av1_syntax_template.c > > > > index 6fe6e9a4f3..956d45e132 100644 > > > > --- a/libavcodec/cbs_av1_syntax_template.c > > > > +++ b/libavcodec/cbs_av1_syntax_template.c > > > > @@ -355,7 +355,7 @@ static int > > > > FUNC(set_frame_refs)(CodedBitstreamContext *ctx, RWContext *rw, > > > >AV1_REF_FRAME_ALTREF2, AV1_REF_FRAME_ALTREF > > > >}; > > > >int8_t ref_frame_idx[AV1_REFS_PER_FRAME], > > > > used_frame[AV1_NUM_REF_FRAMES]; > > > > -int8_t shifted_order_hints[AV1_NUM_REF_FRAMES]; > > > > +int shifted_order_hints[AV1_NUM_REF_FRAMES]; > > > > > > Would int16_t be enough? If so, use that. > > > > int16_t can fixed my clip. But as I mentioned in commit message, > > this > > variable is get with int plus int, switch to int16_t may still has > > potential threat. > > It wont since seq->order_hint_bits_minus_1 has a range of 0-7, > meaning > cur_frame_hint can be at most 128. Similar situation for the return > value of cbs_av1_get_relative_dist(). That's make sense. Thanks James. I will submit V2 to use int16_t. Thanks Fei > > > > > Also when shifted_order_hints is called, it turns back to int > > again: > > > > int hint = shifted_order_hints[i]; > > For arrays we prefer fixed size types, whereas for scalars native > sizes > are better. > > > > > Thanks > > Fei > > > > > > > > LGTM either way. > > > > > > >int cur_frame_hint, latest_order_hint, > > > > earliest_order_hint, > > > > ref; > > > >int i, j; > > > > > > > > > > > > > > ___ > > > ffmpeg-devel mailing list > > > ffmpeg-devel@ffmpeg.org > > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > > > To unsubscribe, visit link above, or email > > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > > > > ___ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > To unsubscribe, visit link above, or email > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH][libavcodec] Duckduckgo Truemotion 1 - some code cleanup and preparation for addition of sprite support
These are some cosmetic changes and also priming the decoder for sprite support (which i plan on adding). This patch was mainly for me to get used to the git email patch flow, if anything. Of course the decoder still works as it was before (i tested it). --- libavcodec/truemotion1.c | 41 +--- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c index 32d8fb4005..80946a405f 100644 --- a/libavcodec/truemotion1.c +++ b/libavcodec/truemotion1.c @@ -23,10 +23,10 @@ * @file * Duck TrueMotion v1 Video Decoder by * Alex Beregszaszi and - * Mike Melanson (melan...@pcisys.net) + * Mike Melanson (m...@multimedia.cx) * * The TrueMotion v1 decoder presently only decodes 16-bit TM1 data and - * outputs RGB555 (or RGB565) data. 24-bit TM1 data is not supported yet. + * outputs RGB555 (or RGB565) data. */ #include @@ -360,8 +360,12 @@ static int truemotion1_decode_header(TrueMotion1Context *s) s->flags = FLAG_KEYFRAME; if (s->flags & FLAG_SPRITE) { +// https://wiki.multimedia.cx/index.php/Duck_TrueMotion_1 +header.xoffset = AV_RL16(&header_buffer[13]); +header.yoffset = AV_RL16(&header_buffer[15]); +header.width = AV_RL16(&header_buffer[17]); +header.height = AV_RL16(&header_buffer[19]); avpriv_request_sample(s->avctx, "Frame with sprite"); -/* FIXME header.width, height, xoffset and yoffset aren't initialized */ return AVERROR_PATCHWELCOME; } else { s->w = header.xsize; @@ -660,20 +664,15 @@ static void truemotion1_decode_16bit(TrueMotion1Context *s) case 0: /* if macroblock width is 2, apply C-Y-C-Y; else * apply C-Y-Y */ +APPLY_C_PREDICTOR(); +APPLY_Y_PREDICTOR(); +OUTPUT_PIXEL_PAIR(); if (s->block_width == 2) { APPLY_C_PREDICTOR(); -APPLY_Y_PREDICTOR(); -OUTPUT_PIXEL_PAIR(); -APPLY_C_PREDICTOR(); -APPLY_Y_PREDICTOR(); -OUTPUT_PIXEL_PAIR(); -} else { -APPLY_C_PREDICTOR(); -APPLY_Y_PREDICTOR(); -OUTPUT_PIXEL_PAIR(); -APPLY_Y_PREDICTOR(); OUTPUT_PIXEL_PAIR(); } +APPLY_Y_PREDICTOR(); +OUTPUT_PIXEL_PAIR(); break; case 1: @@ -786,20 +785,14 @@ static void truemotion1_decode_24bit(TrueMotion1Context *s) case 0: /* if macroblock width is 2, apply C-Y-C-Y; else * apply C-Y-Y */ +APPLY_C_PREDICTOR_24(); +APPLY_Y_PREDICTOR_24(); +OUTPUT_PIXEL_PAIR(); if (s->block_width == 2) { APPLY_C_PREDICTOR_24(); -APPLY_Y_PREDICTOR_24(); -OUTPUT_PIXEL_PAIR(); -APPLY_C_PREDICTOR_24(); -APPLY_Y_PREDICTOR_24(); -OUTPUT_PIXEL_PAIR(); -} else { -APPLY_C_PREDICTOR_24(); -APPLY_Y_PREDICTOR_24(); -OUTPUT_PIXEL_PAIR(); -APPLY_Y_PREDICTOR_24(); -OUTPUT_PIXEL_PAIR(); } +APPLY_Y_PREDICTOR_24(); +OUTPUT_PIXEL_PAIR(); break; case 1: -- ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 2/9] avcodec/av1: extend some definitions in spec section 3
Signed-off-by: Fei Wang --- libavcodec/av1.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/libavcodec/av1.h b/libavcodec/av1.h index 0f99ae4829..951a18ecb2 100644 --- a/libavcodec/av1.h +++ b/libavcodec/av1.h @@ -114,6 +114,13 @@ enum { AV1_WARP_MODEL_TRANSLATION = 1, AV1_WARP_MODEL_ROTZOOM = 2, AV1_WARP_MODEL_AFFINE = 3, +AV1_WARP_PARAM_REDUCE_BITS = 6, + +AV1_DIV_LUT_BITS = 8, +AV1_DIV_LUT_PREC_BITS = 14, +AV1_DIV_LUT_NUM = 257, + +AV1_MAX_LOOP_FILTER = 63, }; -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 1/9] cbs_av1: fix incorrect data type
Since order_hint_bits_minus_1 range is 0~7, cur_frame_hint can be most 128. And similar return value for cbs_av1_get_relative_dist. So if plus them and use int8_t for the result may lose its precision. Signed-off-by: Fei Wang --- v2 update: 1. use int16_t instead of int. 2. updated commit message. libavcodec/cbs_av1_syntax_template.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c index 6fe6e9a4f3..d98d3d42de 100644 --- a/libavcodec/cbs_av1_syntax_template.c +++ b/libavcodec/cbs_av1_syntax_template.c @@ -355,7 +355,7 @@ static int FUNC(set_frame_refs)(CodedBitstreamContext *ctx, RWContext *rw, AV1_REF_FRAME_ALTREF2, AV1_REF_FRAME_ALTREF }; int8_t ref_frame_idx[AV1_REFS_PER_FRAME], used_frame[AV1_NUM_REF_FRAMES]; -int8_t shifted_order_hints[AV1_NUM_REF_FRAMES]; +int16_t shifted_order_hints[AV1_NUM_REF_FRAMES]; int cur_frame_hint, latest_order_hint, earliest_order_hint, ref; int i, j; -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 3/9] avcodec/av1dec: support setup shear process
Defined in spec 7.11.3.6/7.11.3.7. Signed-off-by: Fei Wang --- libavcodec/av1dec.c | 97 + libavcodec/av1dec.h | 1 + 2 files changed, 98 insertions(+) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index 1dda0f9160..3fca17e84b 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -28,6 +28,33 @@ #include "internal.h" #include "profiles.h" +static const uint16_t div_lut[AV1_DIV_LUT_NUM] = { + 16384, 16320, 16257, 16194, 16132, 16070, 16009, 15948, 15888, 15828, 15768, + 15709, 15650, 15592, 15534, 15477, 15420, 15364, 15308, 15252, 15197, 15142, + 15087, 15033, 14980, 14926, 14873, 14821, 14769, 14717, 14665, 14614, 14564, + 14513, 14463, 14413, 14364, 14315, 14266, 14218, 14170, 14122, 14075, 14028, + 13981, 13935, 13888, 13843, 13797, 13752, 13707, 13662, 13618, 13574, 13530, + 13487, 13443, 13400, 13358, 13315, 13273, 13231, 13190, 13148, 13107, 13066, + 13026, 12985, 12945, 12906, 12866, 12827, 12788, 12749, 12710, 12672, 12633, + 12596, 12558, 12520, 12483, 12446, 12409, 12373, 12336, 12300, 12264, 12228, + 12193, 12157, 12122, 12087, 12053, 12018, 11984, 11950, 11916, 11882, 11848, + 11815, 11782, 11749, 11716, 11683, 11651, 11619, 11586, 11555, 11523, 11491, + 11460, 11429, 11398, 11367, 11336, 11305, 11275, 11245, 11215, 11185, 11155, + 11125, 11096, 11067, 11038, 11009, 10980, 10951, 10923, 10894, 10866, 10838, + 10810, 10782, 10755, 10727, 10700, 10673, 10645, 10618, 10592, 10565, 10538, + 10512, 10486, 10460, 10434, 10408, 10382, 10356, 10331, 10305, 10280, 10255, + 10230, 10205, 10180, 10156, 10131, 10107, 10082, 10058, 10034, 10010, 9986, + 9963, 9939, 9916, 9892, 9869, 9846, 9823, 9800, 9777, 9754, 9732, + 9709, 9687, 9664, 9642, 9620, 9598, 9576, 9554, 9533, 9511, 9489, + 9468, 9447, 9425, 9404, 9383, 9362, 9341, 9321, 9300, 9279, 9259, + 9239, 9218, 9198, 9178, 9158, 9138, 9118, 9098, 9079, 9059, 9039, + 9020, 9001, 8981, 8962, 8943, 8924, 8905, 8886, 8867, 8849, 8830, + 8812, 8793, 8775, 8756, 8738, 8720, 8702, 8684, 8666, 8648, 8630, + 8613, 8595, 8577, 8560, 8542, 8525, 8508, 8490, 8473, 8456, 8439, + 8422, 8405, 8389, 8372, 8355, 8339, 8322, 8306, 8289, 8273, 8257, + 8240, 8224, 8208, 8192 +}; + static uint32_t inverse_recenter(int r, uint32_t v) { if (v > 2 * r) @@ -97,6 +124,70 @@ static void read_global_param(AV1DecContext *s, int type, int ref, int idx) -mx, mx + 1, r) << prec_diff) + round; } +static uint64_t round_two(uint64_t x, uint16_t n) +{ +if (n == 0) +return x; +return ((x + (1 << (n - 1))) >> n); +} + +static int64_t round_two_signed(int64_t x, uint16_t n) +{ +return ((x<0) ? -round_two(-x, n) : round_two(x, n)); +} + +/** + * Resolve divisor process. + * see spec 7.11.3.7 + */ +static int16_t resolve_divisor(uint32_t d, uint16_t *shift) +{ +int32_t e, f; + +*shift = av_log2(d); +e = d - (1 << (*shift)); +if (*shift > AV1_DIV_LUT_BITS) +f = round_two(e, *shift - AV1_DIV_LUT_BITS); +else +f = e << (AV1_DIV_LUT_BITS - (*shift)); + +*shift += AV1_DIV_LUT_PREC_BITS; + +return div_lut[f]; +} + +/** + * check if global motion params is valid. + * see spec 7.11.3.6 + */ +static uint8_t get_shear_params_valid(AV1DecContext *s, int idx) +{ +int16_t alpha, beta, gamma, delta, divf, divs; +int64_t v, w; +int32_t *param = &s->cur_frame.gm_params[idx][0]; +if (param[2] < 0) +return 0; + +alpha = av_clip_int16(param[2] - (1 << AV1_WARPEDMODEL_PREC_BITS)); +beta = av_clip_int16(param[3]); +divf = resolve_divisor(abs(param[2]), &divs); +v = param[4] * (1 << AV1_WARPEDMODEL_PREC_BITS); +w = param[3] * param[4]; +gamma = av_clip_int16(round_two_signed((v * divf), divs)); +delta = av_clip_int16(param[5] - round_two_signed((w * divf), divs) - (1 << AV1_WARPEDMODEL_PREC_BITS)); + +alpha = round_two_signed(alpha, AV1_WARP_PARAM_REDUCE_BITS) << AV1_WARP_PARAM_REDUCE_BITS; +beta = round_two_signed(beta, AV1_WARP_PARAM_REDUCE_BITS) << AV1_WARP_PARAM_REDUCE_BITS; +gamma = round_two_signed(gamma, AV1_WARP_PARAM_REDUCE_BITS) << AV1_WARP_PARAM_REDUCE_BITS; +delta = round_two_signed(delta, AV1_WARP_PARAM_REDUCE_BITS) << AV1_WARP_PARAM_REDUCE_BITS; + +if ((4 * abs(alpha) + 7 * abs(beta)) >= (1 << AV1_WARPEDMODEL_PREC_BITS) || +(4 * abs(gamma) + 4 * abs(delta)) >= (1 << AV1_WARPEDMODEL_PREC_BITS)) +return 0; + +return 1; +} + /** * update gm type/params, since cbs already implemented part of this funcation, * so we don't need to full implement spec. @@ -144,6 +235,9 @@ static void global_motion_params(AV1DecContext *s) read_global_param(s, type, ref, 0); read_global_param(s, type, ref, 1); } +if (type <= AV1_WARP_MODEL_AFFINE) { +s->cur_frame.gm_invalid[r
[FFmpeg-devel] [PATCH v2 4/9] avcodec/av1_vaapi: add gm params valid check
Signed-off-by: Fei Wang --- libavcodec/vaapi_av1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c index 16b7e35747..f577447be4 100644 --- a/libavcodec/vaapi_av1.c +++ b/libavcodec/vaapi_av1.c @@ -213,7 +213,8 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx, frame_header->height_in_sbs_minus_1[i]; } for (int i = AV1_REF_FRAME_LAST; i <= AV1_REF_FRAME_ALTREF; i++) { -pic_param.wm[i - 1].wmtype = s->cur_frame.gm_type[i]; +pic_param.wm[i - 1].invalid = s->cur_frame.gm_invalid[i]; +pic_param.wm[i - 1].wmtype = s->cur_frame.gm_type[i]; for (int j = 0; j < 6; j++) pic_param.wm[i - 1].wmmat[j] = s->cur_frame.gm_params[i][j]; } -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 5/9] avcodec/vaapi: increase av1 decode pool size
For film grain clip, vaapi_av1 decoder will cache additional 8 surfaces that will be used to store frames which apply film grain. So increase the pool size by plus 8 to avoid leak of surface. Signed-off-by: Fei Wang --- libavcodec/vaapi_decode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index 958ddf49da..665af370ed 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -577,10 +577,10 @@ static int vaapi_decode_make_config(AVCodecContext *avctx, switch (avctx->codec_id) { case AV_CODEC_ID_H264: case AV_CODEC_ID_HEVC: +case AV_CODEC_ID_AV1: frames->initial_pool_size += 16; break; case AV_CODEC_ID_VP9: -case AV_CODEC_ID_AV1: frames->initial_pool_size += 8; break; case AV_CODEC_ID_VP8: -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 6/9] avcodec/av1dec: add display frame for film grain usage
Make it flexible if decode frame(without apply film grain) and display frame(applied film grain) both needed when decode film grain clips. Signed-off-by: Fei Wang --- libavcodec/av1dec.c | 43 ++- libavcodec/av1dec.h | 3 +++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index 3fca17e84b..af2ecb4f0c 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -569,6 +569,8 @@ static int get_pixel_format(AVCodecContext *avctx) static void av1_frame_unref(AVCodecContext *avctx, AV1Frame *f) { ff_thread_release_buffer(avctx, &f->tf); +if (f->tf_display.f->buf[0]) +ff_thread_release_buffer(avctx, &f->tf_display); av_buffer_unref(&f->hwaccel_priv_buf); f->hwaccel_picture_private = NULL; av_buffer_unref(&f->header_ref); @@ -588,6 +590,12 @@ static int av1_frame_ref(AVCodecContext *avctx, AV1Frame *dst, const AV1Frame *s if (ret < 0) return ret; +if (src->tf_display.f->buf[0]) { +ret = ff_thread_ref_frame(&dst->tf_display, &src->tf_display); +if (ret < 0) +return ret; +} + dst->header_ref = av_buffer_ref(src->header_ref); if (!dst->header_ref) goto fail; @@ -634,9 +642,11 @@ static av_cold int av1_decode_free(AVCodecContext *avctx) for (int i = 0; i < FF_ARRAY_ELEMS(s->ref); i++) { av1_frame_unref(avctx, &s->ref[i]); av_frame_free(&s->ref[i].tf.f); +av_frame_free(&s->ref[i].tf_display.f); } av1_frame_unref(avctx, &s->cur_frame); av_frame_free(&s->cur_frame.tf.f); +av_frame_free(&s->cur_frame.tf_display.f); av_buffer_unref(&s->seq_ref); av_buffer_unref(&s->header_ref); @@ -738,6 +748,13 @@ static av_cold int av1_decode_init(AVCodecContext *avctx) "Failed to allocate reference frame buffer %d.\n", i); return AVERROR(ENOMEM); } + +s->ref[i].tf_display.f = av_frame_alloc(); +if (!s->ref[i].tf_display.f) { +av_log(avctx, AV_LOG_ERROR, + "Failed to allocate display frame buffer %d.\n", i); +return AVERROR(ENOMEM); +} } s->cur_frame.tf.f = av_frame_alloc(); @@ -747,6 +764,13 @@ static av_cold int av1_decode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); } +s->cur_frame.tf_display.f = av_frame_alloc(); +if (!s->cur_frame.tf_display.f) { +av_log(avctx, AV_LOG_ERROR, + "Failed to allocate current display frame buffer.\n"); +return AVERROR(ENOMEM); +} + ret = ff_cbs_init(&s->cbc, AV_CODEC_ID_AV1, avctx); if (ret < 0) return ret; @@ -819,6 +843,16 @@ static int av1_frame_alloc(AVCodecContext *avctx, AV1Frame *f) break; } +if (header->film_grain.apply_grain && +(avctx->pix_fmt == AV_PIX_FMT_VAAPI) && +!(avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN)) { +if ((ret = ff_thread_get_buffer(avctx, &f->tf_display, AV_GET_BUFFER_FLAG_REF)) < 0) +goto fail; + +f->tf_display.f->key_frame = frame->key_frame; +f->tf_display.f->pict_type = frame->pict_type; +} + if (avctx->hwaccel) { const AVHWAccel *hwaccel = avctx->hwaccel; if (hwaccel->frame_priv_data_size) { @@ -902,9 +936,16 @@ static int set_output_frame(AVCodecContext *avctx, AVFrame *frame, const AVPacket *pkt, int *got_frame) { AV1DecContext *s = avctx->priv_data; -const AVFrame *srcframe = s->cur_frame.tf.f; +const AVFrame *srcframe; int ret; +/* Use tf_display as output when it is available. */ +if (s->cur_frame.tf_display.f->buf[0]) { +srcframe = s->cur_frame.tf_display.f; +} else { +srcframe= s->cur_frame.tf.f; +} + // TODO: all layers if (s->operating_point_idc && av_log2(s->operating_point_idc >> 8) > s->cur_frame.spatial_id) diff --git a/libavcodec/av1dec.h b/libavcodec/av1dec.h index 4e140588b9..5af3dfc867 100644 --- a/libavcodec/av1dec.h +++ b/libavcodec/av1dec.h @@ -33,6 +33,9 @@ typedef struct AV1Frame { ThreadFrame tf; +/** current tf_display is only used for VA-API to apply film grain */ +ThreadFrame tf_display; + AVBufferRef *hwaccel_priv_buf; void *hwaccel_picture_private; -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 7/9] avcodec/av1_vaapi: set display surface when apply film grain
Signed-off-by: Fei Wang --- libavcodec/vaapi_av1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c index f577447be4..81b13bb1aa 100644 --- a/libavcodec/vaapi_av1.c +++ b/libavcodec/vaapi_av1.c @@ -76,7 +76,7 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx, .order_hint_bits_minus_1 = seq->order_hint_bits_minus_1, .bit_depth_idx = bit_depth_idx, .current_frame = pic->output_surface, -.current_display_picture = pic->output_surface, +.current_display_picture = apply_grain ? ff_vaapi_get_surface_id(s->cur_frame.tf_display.f) : pic->output_surface, .frame_width_minus1 = frame_header->frame_width_minus_1, .frame_height_minus1 = frame_header->frame_height_minus_1, .primary_ref_frame = frame_header->primary_ref_frame, -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 8/9] avcodec/av1_vaapi: enable segmentation features
Signed-off-by: Fei Wang --- libavcodec/vaapi_av1.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c index 81b13bb1aa..6aaabed2c1 100644 --- a/libavcodec/vaapi_av1.c +++ b/libavcodec/vaapi_av1.c @@ -63,6 +63,9 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx, int err = 0; int apply_grain = !(avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN) && film_grain->apply_grain; uint8_t remap_lr_type[4] = {AV1_RESTORE_NONE, AV1_RESTORE_SWITCHABLE, AV1_RESTORE_WIENER, AV1_RESTORE_SGRPROJ}; +uint8_t segmentation_feature_signed[AV1_SEG_LVL_MAX] = {1, 1, 1, 1, 1, 0, 0, 0}; +uint8_t segmentation_feature_max[AV1_SEG_LVL_MAX] = {255, AV1_MAX_LOOP_FILTER, +AV1_MAX_LOOP_FILTER, AV1_MAX_LOOP_FILTER, AV1_MAX_LOOP_FILTER, 7 , 0 , 0 }; pic->output_surface = vaapi_av1_surface_id(&s->cur_frame); @@ -218,6 +221,17 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx, for (int j = 0; j < 6; j++) pic_param.wm[i - 1].wmmat[j] = s->cur_frame.gm_params[i][j]; } +for (int i = 0; i < AV1_MAX_SEGMENTS; i++) { +for (int j = 0; j < AV1_SEG_LVL_MAX; j++) { +pic_param.seg_info.feature_mask[i] |= (frame_header->feature_enabled[i][j] << j); +if (segmentation_feature_signed[j]) +pic_param.seg_info.feature_data[i][j] = av_clip(frame_header->feature_value[i][j], +-segmentation_feature_max[j], segmentation_feature_max[j]); +else +pic_param.seg_info.feature_data[i][j] = av_clip(frame_header->feature_value[i][j], +0, segmentation_feature_max[j]); +} +} if (apply_grain) { for (int i = 0; i < film_grain->num_y_points; i++) { pic_param.film_grain_info.point_y_value[i] = -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 9/9] avcodec/av1_vaapi: improve decode quality
- quantizer delta and matrix level specific. - support loop filter delta. - support use superres. Signed-off-by: Fei Wang --- libavcodec/vaapi_av1.c | 67 ++ 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c index 6aaabed2c1..2d0f0a76ad 100644 --- a/libavcodec/vaapi_av1.c +++ b/libavcodec/vaapi_av1.c @@ -75,26 +75,35 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx, memset(&pic_param, 0, sizeof(VADecPictureParameterBufferAV1)); pic_param = (VADecPictureParameterBufferAV1) { -.profile = seq->seq_profile, -.order_hint_bits_minus_1 = seq->order_hint_bits_minus_1, -.bit_depth_idx = bit_depth_idx, -.current_frame = pic->output_surface, -.current_display_picture = apply_grain ? ff_vaapi_get_surface_id(s->cur_frame.tf_display.f) : pic->output_surface, -.frame_width_minus1 = frame_header->frame_width_minus_1, -.frame_height_minus1 = frame_header->frame_height_minus_1, -.primary_ref_frame = frame_header->primary_ref_frame, -.order_hint = frame_header->order_hint, -.tile_cols = frame_header->tile_cols, -.tile_rows = frame_header->tile_rows, -.context_update_tile_id = frame_header->context_update_tile_id, -.interp_filter = frame_header->interpolation_filter, -.filter_level[0] = frame_header->loop_filter_level[0], -.filter_level[1] = frame_header->loop_filter_level[1], -.filter_level_u = frame_header->loop_filter_level[2], -.filter_level_v = frame_header->loop_filter_level[3], -.base_qindex = frame_header->base_q_idx, -.cdef_damping_minus_3= frame_header->cdef_damping_minus_3, -.cdef_bits = frame_header->cdef_bits, +.profile= seq->seq_profile, +.order_hint_bits_minus_1= seq->order_hint_bits_minus_1, +.bit_depth_idx = bit_depth_idx, +.matrix_coefficients= seq->color_config.matrix_coefficients, +.current_frame = pic->output_surface, +.current_display_picture= apply_grain ? ff_vaapi_get_surface_id(s->cur_frame.tf_display.f) : pic->output_surface, +.frame_width_minus1 = frame_header->frame_width_minus_1, +.frame_height_minus1= frame_header->frame_height_minus_1, +.primary_ref_frame = frame_header->primary_ref_frame, +.order_hint = frame_header->order_hint, +.tile_cols = frame_header->tile_cols, +.tile_rows = frame_header->tile_rows, +.context_update_tile_id = frame_header->context_update_tile_id, +.superres_scale_denominator = frame_header->use_superres ? +frame_header->coded_denom + AV1_SUPERRES_DENOM_MIN : +AV1_SUPERRES_NUM, +.interp_filter = frame_header->interpolation_filter, +.filter_level[0]= frame_header->loop_filter_level[0], +.filter_level[1]= frame_header->loop_filter_level[1], +.filter_level_u = frame_header->loop_filter_level[2], +.filter_level_v = frame_header->loop_filter_level[3], +.base_qindex= frame_header->base_q_idx, +.y_dc_delta_q = frame_header->delta_q_y_dc, +.u_dc_delta_q = frame_header->delta_q_u_dc, +.u_ac_delta_q = frame_header->delta_q_u_ac, +.v_dc_delta_q = frame_header->delta_q_v_dc, +.v_ac_delta_q = frame_header->delta_q_v_ac, +.cdef_damping_minus_3 = frame_header->cdef_damping_minus_3, +.cdef_bits = frame_header->cdef_bits, .seq_info_fields.fields = { .still_picture = seq->still_picture, .use_128x128_superblock = seq->use_128x128_superblock, @@ -165,12 +174,15 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx, .mode_ref_delta_update = frame_header->loop_filter_delta_update, }, .mode_control_fields.bits = { -.delta_q_present_flag = frame_header->delta_q_present, -.log2_delta_q_res = frame_header->delta_q_res, -.tx_mode = frame_header->tx_mode, -.reference_select = frame_header->reference_select, -.reduced_tx_set_used = frame_header->reduced_tx_set, -.skip_mode_present= frame_header->skip_mode_present, +.delta_q_present_flag = frame_header->delta_q_present, +.log2_delta_q_res = frame_header->delta_q_res, +.delta_lf_present_
Re: [FFmpeg-devel] [PATCH v2 3/9] avcodec/av1dec: support setup shear process
On Mon, 5 Jul 2021, at 04:29, Fei Wang wrote: > Defined in spec 7.11.3.6/7.11.3.7. ... > +static const uint16_t div_lut[AV1_DIV_LUT_NUM] = { > + 16384, 16320, 16257, 16194, 16132, 16070, 16009, 15948, 15888, > 15828, 15768, Where are those numbers coming from? From the spec? From an annex? Then add a comment in the code for this, and not just in the commit log. -- Jean-Baptiste Kempf - President +33 672 704 734 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2 3/9] avcodec/av1dec: support setup shear process
On Mon, 2021-07-05 at 07:12 +0200, Jean-Baptiste Kempf wrote: > On Mon, 5 Jul 2021, at 04:29, Fei Wang wrote: > > Defined in spec 7.11.3.6/7.11.3.7. > > ... > > +static const uint16_t div_lut[AV1_DIV_LUT_NUM] = { > > + 16384, 16320, 16257, 16194, 16132, 16070, 16009, 15948, 15888, > > 15828, 15768, > > Where are those numbers coming from? From the spec? From an annex? > Then add a comment in the code for this, and not just in the commit > log. It's defined in spec 7.11.3.7. I will add the comment into the code. Thanks Fei ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH V3] lavf/vf_ocr: add subregion support
On Fri, 18 Jun 2021 23:56:56 +0800 Lingjiang Fang wrote: ping for review, thanks > fix doc errors, ping for review, thanks :) > --- > doc/filters.texi | 8 > libavfilter/vf_ocr.c | 35 ++- > 2 files changed, 42 insertions(+), 1 deletion(-) > > diff --git a/doc/filters.texi b/doc/filters.texi > index da8f7d7726..041fd28c57 100644 > --- a/doc/filters.texi > +++ b/doc/filters.texi > @@ -15451,6 +15451,14 @@ Set character whitelist. > > @item blacklist > Set character blacklist. > + > +@item x, y > +Set top-left corner of the subregion, in pixels, default is (0,0). > + > +@item w, h > +Set width and height of the subregion, in pixels, > +default is the bottom-right part from given top-left corner. > + > @end table > > The filter exports recognized text as the frame metadata > @code{lavfi.ocr.text}. diff --git a/libavfilter/vf_ocr.c > b/libavfilter/vf_ocr.c index 6de474025a..e96dce2d87 100644 > --- a/libavfilter/vf_ocr.c > +++ b/libavfilter/vf_ocr.c > @@ -33,6 +33,8 @@ typedef struct OCRContext { > char *language; > char *whitelist; > char *blacklist; > +int x, y; > +int w, h; > > TessBaseAPI *tess; > } OCRContext; > @@ -45,6 +47,10 @@ static const AVOption ocr_options[] = { > { "language", "set language",OFFSET(language), > AV_OPT_TYPE_STRING, {.str="eng"}, 0, 0, FLAGS }, { "whitelist", "set > character whitelist", OFFSET(whitelist), AV_OPT_TYPE_STRING, > {.str="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.:;,-+_!?\"'[]{}()<>|/\\=*&%$#@!~ > "}, 0, 0, FLAGS }, { "blacklist", "set character blacklist", > OFFSET(blacklist), AV_OPT_TYPE_STRING, {.str=""},0, 0, FLAGS }, > +{ "x", "top x of sub region", OFFSET(x), > AV_OPT_TYPE_INT,{.i64=0}, 0, INT_MAX, FLAGS }, > +{ "y", "top y of sub region", OFFSET(y), > AV_OPT_TYPE_INT,{.i64=0}, 0, INT_MAX, FLAGS }, > +{ "w", "width of sub region", OFFSET(w), > AV_OPT_TYPE_INT,{.i64=0}, 0, INT_MAX, FLAGS }, > +{ "h", "height of sub region",OFFSET(h), > AV_OPT_TYPE_INT,{.i64=0}, 0, INT_MAX, FLAGS }, { NULL } > }; > > @@ -93,6 +99,21 @@ static int query_formats(AVFilterContext *ctx) > return ff_set_common_formats(ctx, fmts_list); > } > > +static void check_fix(int *x, int *y, int *w, int *h, int pic_w, int > pic_h) +{ > +// 0 <= x < pic_w > +if (*x >= pic_w) > +*x = 0; > +// 0 <= y < pic_h > +if (*y >= pic_h) > +*y = 0; > + > +if (*w == 0 || *w + *x > pic_w) > +*w = pic_w - *x; > +if (*h == 0 || *h + *y > pic_h) > +*h = pic_h - *y; > +} > + > static int filter_frame(AVFilterLink *inlink, AVFrame *in) > { > AVDictionary **metadata = &in->metadata; > @@ -102,8 +123,20 @@ static int filter_frame(AVFilterLink *inlink, > AVFrame *in) char *result; > int *confs; > > +// TODO(vacing): support expression > +int x = s->x; > +int y = s->y; > +int w = s->w; > +int h = s->h; > +check_fix(&x, &y, &w, &h, in->width, in->height); > +if ( x != s->x || y != s->y || > +(s->w != 0 && w != s->w) || (s->h != 0 && h != s->h)) { > +av_log(s, AV_LOG_WARNING, "config error, subregion changed > to x=%d, y=%d, w=%d, h=%d\n", > + > x, y, w, h); > +} > + > result = TessBaseAPIRect(s->tess, in->data[0], 1, > - in->linesize[0], 0, 0, in->width, > in->height); > + in->linesize[0], x, y, w, h); > confs = TessBaseAPIAllWordConfidences(s->tess); > av_dict_set(metadata, "lavfi.ocr.text", result, 0); > for (int i = 0; confs[i] != -1; i++) { Regards, Lingjiang Fang ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".