From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 3/3] fftools/ffmpeg: auto insert enhancement filters when available
Date: Tue, 19 Mar 2024 12:08:46 -0300
Message-ID: <e1598f25-3d62-4147-a913-cd3522cd2e69@gmail.com> (raw)
In-Reply-To: <AS8P250MB07446045CCD06BB1EF5CA6518F2C2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>
On 3/19/2024 12:01 PM, Andreas Rheinhardt wrote:
> James Almer:
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>> fftools/ffmpeg.h | 3 +++
>> fftools/ffmpeg_demux.c | 4 ++++
>> fftools/ffmpeg_filter.c | 28 +++++++++++++++++++++++++++-
>> fftools/ffmpeg_opt.c | 3 +++
>> 4 files changed, 37 insertions(+), 1 deletion(-)
>>
>> diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
>> index 7454089c2d..8d54affc0a 100644
>> --- a/fftools/ffmpeg.h
>> +++ b/fftools/ffmpeg.h
>> @@ -155,6 +155,7 @@ typedef struct OptionsContext {
>> SpecifierOptList hwaccel_devices;
>> SpecifierOptList hwaccel_output_formats;
>> SpecifierOptList autorotate;
>> + SpecifierOptList autoenhance;
>>
>> /* output options */
>> StreamMap *stream_maps;
>> @@ -239,6 +240,7 @@ enum IFilterFlags {
>> IFILTER_FLAG_AUTOROTATE = (1 << 0),
>> IFILTER_FLAG_REINIT = (1 << 1),
>> IFILTER_FLAG_CFR = (1 << 2),
>> + IFILTER_FLAG_AUTOENHANCE = (1 << 3),
>> };
>>
>> typedef struct InputFilterOptions {
>> @@ -369,6 +371,7 @@ typedef struct InputStream {
>> #endif
>>
>> int autorotate;
>> + int autoenhance;
>>
>> int fix_sub_duration;
>>
>> diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
>> index 47312c9fe1..0b4ab3d7ec 100644
>> --- a/fftools/ffmpeg_demux.c
>> +++ b/fftools/ffmpeg_demux.c
>> @@ -1056,6 +1056,7 @@ int ist_filter_add(InputStream *ist, InputFilter *ifilter, int is_simple,
>> return AVERROR(ENOMEM);
>>
>> opts->flags |= IFILTER_FLAG_AUTOROTATE * !!(ist->autorotate) |
>> + IFILTER_FLAG_AUTOENHANCE * !!(ist->autoenhance) |
>> IFILTER_FLAG_REINIT * !!(ds->reinit_filters);
>>
>> return ds->sch_idx_dec;
>> @@ -1238,6 +1239,9 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st)
>> ist->autorotate = 1;
>> MATCH_PER_STREAM_OPT(autorotate, i, ist->autorotate, ic, st);
>>
>> + ist->autoenhance = 1;
>> + MATCH_PER_STREAM_OPT(autoenhance, i, ist->autoenhance, ic, st);
>> +
>> MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, ic, st);
>> if (codec_tag) {
>> uint32_t tag = strtol(codec_tag, &next, 0);
>> diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
>> index 3d88482d07..c4d900d95b 100644
>> --- a/fftools/ffmpeg_filter.c
>> +++ b/fftools/ffmpeg_filter.c
>> @@ -18,6 +18,8 @@
>> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>> */
>>
>> +#include "config_components.h"
>> +
>> #include <stdint.h>
>>
>> #include "ffmpeg.h"
>> @@ -145,6 +147,8 @@ typedef struct InputFilterPriv {
>> int displaymatrix_present;
>> int32_t displaymatrix[9];
>>
>> + int enhancement_present;
>> +
>> // fallback parameters to use when no input is ever sent
>> struct {
>> AVRational time_base;
>> @@ -1567,6 +1571,15 @@ static int configure_input_video_filter(FilterGraph *fg, AVFilterGraph *graph,
>> desc = av_pix_fmt_desc_get(ifp->format);
>> av_assert0(desc);
>>
>> +#if CONFIG_LCEVC_FILTER
>> + if ((ifp->opts.flags & IFILTER_FLAG_AUTOENHANCE) &&
>> + !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
>> + ret = insert_filter(&last_filter, &pad_idx, "lcevc", NULL);
>> + if (ret < 0)
>> + return ret;
>> + }
>
> If I see this correctly, this will add this filter automatically for all
> videos when this filter is present, although it will be unneeded in the
> vast majority of cases. I am against this.
Yeah, good catch. Missed a ifp->enhancement_present check here.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
prev parent reply other threads:[~2024-03-19 15:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-19 14:06 [FFmpeg-devel] [PATCH 1/3] libavcodec/h2645_sei: export raw LCEVC metadata James Almer
2024-03-19 14:06 ` [FFmpeg-devel] [PATCH 2/3] avfilter: add an LCEVC decoding filter James Almer
2024-03-19 14:56 ` Andreas Rheinhardt
2024-03-19 15:05 ` James Almer
2024-03-19 15:20 ` Kieran Kunhya
2024-03-19 15:28 ` James Almer
2024-03-19 17:21 ` Kieran Kunhya
[not found] ` <BB9E2F8E-6821-43B7-9021-C264A8AFCE35@cosmin.at>
2024-03-19 19:07 ` Cosmin Stejerean via ffmpeg-devel
2024-03-19 15:00 ` Stefano Sabatini
2024-03-19 14:06 ` [FFmpeg-devel] [PATCH 3/3] fftools/ffmpeg: auto insert enhancement filters when available James Almer
2024-03-19 15:01 ` Andreas Rheinhardt
2024-03-19 15:08 ` James Almer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e1598f25-3d62-4147-a913-cd3522cd2e69@gmail.com \
--to=jamrial@gmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git