* [FFmpeg-devel] [PATCH] add yuv444p support to mcdeint
@ 2025-05-27 18:24 Ethan Halsall
2025-05-30 0:58 ` Michael Niedermayer
0 siblings, 1 reply; 9+ messages in thread
From: Ethan Halsall @ 2025-05-27 18:24 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: Ethan Halsall <ethanhalsall11@augustana.edu>
---
libavfilter/vf_mcdeint.c | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c
index 82048b51d0..11ad19f5cd 100644
--- a/libavfilter/vf_mcdeint.c
+++ b/libavfilter/vf_mcdeint.c
@@ -51,8 +51,10 @@
#include "libavutil/opt.h"
#include "libavcodec/avcodec.h"
+#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.h"
+#include "formats.h"
#include "video.h"
enum MCDeintMode {
@@ -76,6 +78,7 @@ typedef struct MCDeintContext {
AVPacket *pkt;
AVFrame *frame_dec;
AVCodecContext *enc_ctx;
+ const AVPixFmtDescriptor *pix_fmt_desc;
} MCDeintContext;
#define OFFSET(x) offsetof(MCDeintContext, x)
@@ -99,6 +102,17 @@ static const AVOption mcdeint_options[] = {
AVFILTER_DEFINE_CLASS(mcdeint);
+static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_NONE
+};
+
+static int query_formats(AVFilterContext *ctx)
+{
+ return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
+}
+
static int config_props(AVFilterLink *inlink)
{
AVFilterContext *ctx = inlink->dst;
@@ -122,13 +136,16 @@ static int config_props(AVFilterLink *inlink)
mcdeint->enc_ctx = avcodec_alloc_context3(enc);
if (!mcdeint->enc_ctx)
return AVERROR(ENOMEM);
+ mcdeint->pix_fmt_desc = av_pix_fmt_desc_get(inlink->format);
+ if (!mcdeint->pix_fmt_desc)
+ return AVERROR(ENOMEM);
enc_ctx = mcdeint->enc_ctx;
enc_ctx->width = inlink->w;
enc_ctx->height = inlink->h;
enc_ctx->time_base = (AVRational){1,25}; // meaningless
enc_ctx->gop_size = INT_MAX;
enc_ctx->max_b_frames = 0;
- enc_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ enc_ctx->pix_fmt = inlink->format;
enc_ctx->flags = AV_CODEC_FLAG_QSCALE | AV_CODEC_FLAG_LOW_DELAY |
AV_CODEC_FLAG_RECON_FRAME;
enc_ctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
enc_ctx->global_quality = 1;
@@ -201,8 +218,14 @@ static int filter_frame(AVFilterLink *inlink,
AVFrame *inpic)
for (i = 0; i < 3; i++) {
int is_chroma = !!i;
- int w = AV_CEIL_RSHIFT(inlink->w, is_chroma);
- int h = AV_CEIL_RSHIFT(inlink->h, is_chroma);
+ int w, h;
+ if (is_chroma) {
+ w = inlink->w >> mcdeint->pix_fmt_desc->log2_chroma_w;
+ h = inlink->h >> mcdeint->pix_fmt_desc->log2_chroma_h;
+ } else {
+ w = inlink->w;
+ h = inlink->h;
+ }
int fils = frame_dec->linesize[i];
int srcs = inpic ->linesize[i];
int dsts = outpic ->linesize[i];
@@ -307,5 +330,6 @@ const FFFilter ff_vf_mcdeint = {
.uninit = uninit,
FILTER_INPUTS(mcdeint_inputs),
FILTER_OUTPUTS(ff_video_default_filterpad),
- FILTER_SINGLE_PIXFMT(AV_PIX_FMT_YUV420P),
+ FILTER_QUERY_FUNC(query_formats),
};
+
--
2.43.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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH] add yuv444p support to mcdeint
2025-05-27 18:24 [FFmpeg-devel] [PATCH] add yuv444p support to mcdeint Ethan Halsall
@ 2025-05-30 0:58 ` Michael Niedermayer
2025-05-30 5:29 ` Ethan Halsall
0 siblings, 1 reply; 9+ messages in thread
From: Michael Niedermayer @ 2025-05-30 0:58 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 1711 bytes --]
On Tue, May 27, 2025 at 01:24:57PM -0500, Ethan Halsall wrote:
> Signed-off-by: Ethan Halsall <ethanhalsall11@augustana.edu>
> ---
> libavfilter/vf_mcdeint.c | 32 ++++++++++++++++++++++++++++----
> 1 file changed, 28 insertions(+), 4 deletions(-)
>
> diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c
> index 82048b51d0..11ad19f5cd 100644
> --- a/libavfilter/vf_mcdeint.c
> +++ b/libavfilter/vf_mcdeint.c
> @@ -51,8 +51,10 @@
> #include "libavutil/opt.h"
> #include "libavcodec/avcodec.h"
> +#include "libavutil/pixdesc.h"
> #include "avfilter.h"
> #include "filters.h"
> +#include "formats.h"
> #include "video.h"
> enum MCDeintMode {
> @@ -76,6 +78,7 @@ typedef struct MCDeintContext {
> AVPacket *pkt;
> AVFrame *frame_dec;
> AVCodecContext *enc_ctx;
> + const AVPixFmtDescriptor *pix_fmt_desc;
> } MCDeintContext;
> #define OFFSET(x) offsetof(MCDeintContext, x)
> @@ -99,6 +102,17 @@ static const AVOption mcdeint_options[] = {
> AVFILTER_DEFINE_CLASS(mcdeint);
> +static const enum AVPixelFormat pix_fmts[] = {
> + AV_PIX_FMT_YUV420P,
> + AV_PIX_FMT_YUV444P,
> + AV_PIX_FMT_NONE
> +};
> +
Applying: add yuv444p support to mcdeint
error: corrupt patch at line 18
this patch is somehow corrupted, that above is not a valid diff
make sure the output of git format-patch is not modified
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH] add yuv444p support to mcdeint
2025-05-30 0:58 ` Michael Niedermayer
@ 2025-05-30 5:29 ` Ethan Halsall
2025-06-02 18:39 ` Michael Niedermayer
2025-06-02 23:27 ` Ethan Halsall
0 siblings, 2 replies; 9+ messages in thread
From: Ethan Halsall @ 2025-05-30 5:29 UTC (permalink / raw)
To: ffmpeg-devel
On 5/29/25 7:58 PM, Michael Niedermayer wrote:
> On Tue, May 27, 2025 at 01:24:57PM -0500, Ethan Halsall wrote:
>> Signed-off-by: Ethan Halsall <ethanhalsall11@augustana.edu>
>> ---
>> libavfilter/vf_mcdeint.c | 32 ++++++++++++++++++++++++++++----
>> 1 file changed, 28 insertions(+), 4 deletions(-)
>>
>> diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c
>> index 82048b51d0..11ad19f5cd 100644
>> --- a/libavfilter/vf_mcdeint.c
>> +++ b/libavfilter/vf_mcdeint.c
>> @@ -51,8 +51,10 @@
>> #include "libavutil/opt.h"
>> #include "libavcodec/avcodec.h"
>> +#include "libavutil/pixdesc.h"
>> #include "avfilter.h"
>> #include "filters.h"
>> +#include "formats.h"
>> #include "video.h"
>> enum MCDeintMode {
>> @@ -76,6 +78,7 @@ typedef struct MCDeintContext {
>> AVPacket *pkt;
>> AVFrame *frame_dec;
>> AVCodecContext *enc_ctx;
>> + const AVPixFmtDescriptor *pix_fmt_desc;
>> } MCDeintContext;
>> #define OFFSET(x) offsetof(MCDeintContext, x)
>> @@ -99,6 +102,17 @@ static const AVOption mcdeint_options[] = {
>> AVFILTER_DEFINE_CLASS(mcdeint);
>> +static const enum AVPixelFormat pix_fmts[] = {
>> + AV_PIX_FMT_YUV420P,
>> + AV_PIX_FMT_YUV444P,
>> + AV_PIX_FMT_NONE
>> +};
>> +
>
> Applying: add yuv444p support to mcdeint
> error: corrupt patch at line 18
>
> this patch is somehow corrupted, that above is not a valid diff
> make sure the output of git format-patch is not modified
>
> thx
>
>
> [...]
>
>
>
> _______________________________________________
> 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".
I followed the instructions on the "Sending patches from email clients"
section of https://ffmpeg.org/developer.html#Submitting-patches-1. I
think Thunderbird removed some line breaks in the patch though when I
opened the .eml file.
Let's try this one:
Signed-off-by: Ethan Halsall <ethanhalsall11@augustana.edu>
---
libavfilter/vf_mcdeint.c | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c
index 82048b51d0..11ad19f5cd 100644
--- a/libavfilter/vf_mcdeint.c
+++ b/libavfilter/vf_mcdeint.c
@@ -51,8 +51,10 @@
#include "libavutil/opt.h"
#include "libavcodec/avcodec.h"
+#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.h"
+#include "formats.h"
#include "video.h"
enum MCDeintMode {
@@ -76,6 +78,7 @@ typedef struct MCDeintContext {
AVPacket *pkt;
AVFrame *frame_dec;
AVCodecContext *enc_ctx;
+ const AVPixFmtDescriptor *pix_fmt_desc;
} MCDeintContext;
#define OFFSET(x) offsetof(MCDeintContext, x)
@@ -99,6 +102,17 @@ static const AVOption mcdeint_options[] = {
AVFILTER_DEFINE_CLASS(mcdeint);
+static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_NONE
+};
+
+static int query_formats(AVFilterContext *ctx)
+{
+ return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
+}
+
static int config_props(AVFilterLink *inlink)
{
AVFilterContext *ctx = inlink->dst;
@@ -122,13 +136,16 @@ static int config_props(AVFilterLink *inlink)
mcdeint->enc_ctx = avcodec_alloc_context3(enc);
if (!mcdeint->enc_ctx)
return AVERROR(ENOMEM);
+ mcdeint->pix_fmt_desc = av_pix_fmt_desc_get(inlink->format);
+ if (!mcdeint->pix_fmt_desc)
+ return AVERROR(ENOMEM);
enc_ctx = mcdeint->enc_ctx;
enc_ctx->width = inlink->w;
enc_ctx->height = inlink->h;
enc_ctx->time_base = (AVRational){1,25}; // meaningless
enc_ctx->gop_size = INT_MAX;
enc_ctx->max_b_frames = 0;
- enc_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ enc_ctx->pix_fmt = inlink->format;
enc_ctx->flags = AV_CODEC_FLAG_QSCALE | AV_CODEC_FLAG_LOW_DELAY |
AV_CODEC_FLAG_RECON_FRAME;
enc_ctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
enc_ctx->global_quality = 1;
@@ -201,8 +218,14 @@ static int filter_frame(AVFilterLink *inlink,
AVFrame *inpic)
for (i = 0; i < 3; i++) {
int is_chroma = !!i;
- int w = AV_CEIL_RSHIFT(inlink->w, is_chroma);
- int h = AV_CEIL_RSHIFT(inlink->h, is_chroma);
+ int w, h;
+ if (is_chroma) {
+ w = inlink->w >> mcdeint->pix_fmt_desc->log2_chroma_w;
+ h = inlink->h >> mcdeint->pix_fmt_desc->log2_chroma_h;
+ } else {
+ w = inlink->w;
+ h = inlink->h;
+ }
int fils = frame_dec->linesize[i];
int srcs = inpic ->linesize[i];
int dsts = outpic ->linesize[i];
@@ -307,5 +330,6 @@ const FFFilter ff_vf_mcdeint = {
.uninit = uninit,
FILTER_INPUTS(mcdeint_inputs),
FILTER_OUTPUTS(ff_video_default_filterpad),
- FILTER_SINGLE_PIXFMT(AV_PIX_FMT_YUV420P),
+ FILTER_QUERY_FUNC(query_formats),
};
+
--
2.43.0
-Ethan
_______________________________________________
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH] add yuv444p support to mcdeint
2025-05-30 5:29 ` Ethan Halsall
@ 2025-06-02 18:39 ` Michael Niedermayer
2025-06-07 17:15 ` Ethan Halsall
2025-06-02 23:27 ` Ethan Halsall
1 sibling, 1 reply; 9+ messages in thread
From: Michael Niedermayer @ 2025-06-02 18:39 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 5745 bytes --]
Hi Ethan
On Fri, May 30, 2025 at 12:29:19AM -0500, Ethan Halsall wrote:
> On 5/29/25 7:58 PM, Michael Niedermayer wrote:
> > On Tue, May 27, 2025 at 01:24:57PM -0500, Ethan Halsall wrote:
> > > Signed-off-by: Ethan Halsall <ethanhalsall11@augustana.edu>
> > > ---
> > > libavfilter/vf_mcdeint.c | 32 ++++++++++++++++++++++++++++----
> > > 1 file changed, 28 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c
> > > index 82048b51d0..11ad19f5cd 100644
> > > --- a/libavfilter/vf_mcdeint.c
> > > +++ b/libavfilter/vf_mcdeint.c
> > > @@ -51,8 +51,10 @@
> > > #include "libavutil/opt.h"
> > > #include "libavcodec/avcodec.h"
> > > +#include "libavutil/pixdesc.h"
> > > #include "avfilter.h"
> > > #include "filters.h"
> > > +#include "formats.h"
> > > #include "video.h"
> > > enum MCDeintMode {
> > > @@ -76,6 +78,7 @@ typedef struct MCDeintContext {
> > > AVPacket *pkt;
> > > AVFrame *frame_dec;
> > > AVCodecContext *enc_ctx;
> > > + const AVPixFmtDescriptor *pix_fmt_desc;
> > > } MCDeintContext;
> > > #define OFFSET(x) offsetof(MCDeintContext, x)
> > > @@ -99,6 +102,17 @@ static const AVOption mcdeint_options[] = {
> > > AVFILTER_DEFINE_CLASS(mcdeint);
> > > +static const enum AVPixelFormat pix_fmts[] = {
> > > + AV_PIX_FMT_YUV420P,
> > > + AV_PIX_FMT_YUV444P,
> > > + AV_PIX_FMT_NONE
> > > +};
> > > +
> >
> > Applying: add yuv444p support to mcdeint
> > error: corrupt patch at line 18
> >
> > this patch is somehow corrupted, that above is not a valid diff
> > make sure the output of git format-patch is not modified
> >
> > thx
> >
> >
> > [...]
> >
> >
> >
> > _______________________________________________
> > 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".
>
> I followed the instructions on the "Sending patches from email clients"
> section of https://ffmpeg.org/developer.html#Submitting-patches-1. I think
> Thunderbird removed some line breaks in the patch though when I opened the
> .eml file.
>
> Let's try this one:
>
>
> Signed-off-by: Ethan Halsall <ethanhalsall11@augustana.edu>
> ---
> libavfilter/vf_mcdeint.c | 32 ++++++++++++++++++++++++++++----
> 1 file changed, 28 insertions(+), 4 deletions(-)
>
> diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c
> index 82048b51d0..11ad19f5cd 100644
> --- a/libavfilter/vf_mcdeint.c
> +++ b/libavfilter/vf_mcdeint.c
> @@ -51,8 +51,10 @@
>
> #include "libavutil/opt.h"
> #include "libavcodec/avcodec.h"
> +#include "libavutil/pixdesc.h"
> #include "avfilter.h"
> #include "filters.h"
> +#include "formats.h"
> #include "video.h"
>
> enum MCDeintMode {
> @@ -76,6 +78,7 @@ typedef struct MCDeintContext {
> AVPacket *pkt;
> AVFrame *frame_dec;
> AVCodecContext *enc_ctx;
> + const AVPixFmtDescriptor *pix_fmt_desc;
> } MCDeintContext;
>
> #define OFFSET(x) offsetof(MCDeintContext, x)
> @@ -99,6 +102,17 @@ static const AVOption mcdeint_options[] = {
>
> AVFILTER_DEFINE_CLASS(mcdeint);
>
> +static const enum AVPixelFormat pix_fmts[] = {
> + AV_PIX_FMT_YUV420P,
> + AV_PIX_FMT_YUV444P,
> + AV_PIX_FMT_NONE
> +};
> +
> +static int query_formats(AVFilterContext *ctx)
> +{
> + return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
> +}
why not use FILTER_PIXFMTS ?
> +
> static int config_props(AVFilterLink *inlink)
> {
> AVFilterContext *ctx = inlink->dst;
> @@ -122,13 +136,16 @@ static int config_props(AVFilterLink *inlink)
> mcdeint->enc_ctx = avcodec_alloc_context3(enc);
> if (!mcdeint->enc_ctx)
> return AVERROR(ENOMEM);
> + mcdeint->pix_fmt_desc = av_pix_fmt_desc_get(inlink->format);
> + if (!mcdeint->pix_fmt_desc)
> + return AVERROR(ENOMEM);
> enc_ctx = mcdeint->enc_ctx;
> enc_ctx->width = inlink->w;
> enc_ctx->height = inlink->h;
> enc_ctx->time_base = (AVRational){1,25}; // meaningless
> enc_ctx->gop_size = INT_MAX;
> enc_ctx->max_b_frames = 0;
> - enc_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
> + enc_ctx->pix_fmt = inlink->format;
> enc_ctx->flags = AV_CODEC_FLAG_QSCALE | AV_CODEC_FLAG_LOW_DELAY |
> AV_CODEC_FLAG_RECON_FRAME;
> enc_ctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
> enc_ctx->global_quality = 1;
> @@ -201,8 +218,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
> *inpic)
>
> for (i = 0; i < 3; i++) {
> int is_chroma = !!i;
> - int w = AV_CEIL_RSHIFT(inlink->w, is_chroma);
> - int h = AV_CEIL_RSHIFT(inlink->h, is_chroma);
> + int w, h;
> + if (is_chroma) {
> + w = inlink->w >> mcdeint->pix_fmt_desc->log2_chroma_w;
> + h = inlink->h >> mcdeint->pix_fmt_desc->log2_chroma_h;
> + } else {
> + w = inlink->w;
> + h = inlink->h;
> + }
> int fils = frame_dec->linesize[i];
> int srcs = inpic ->linesize[i];
> int dsts = outpic ->linesize[i];
pix_fmt_desc could be a local variable in filter_frame()
which would avoid adding it to the context
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
than the original author, trying to rewrite it will not make it better.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH] add yuv444p support to mcdeint
2025-05-30 5:29 ` Ethan Halsall
2025-06-02 18:39 ` Michael Niedermayer
@ 2025-06-02 23:27 ` Ethan Halsall
1 sibling, 0 replies; 9+ messages in thread
From: Ethan Halsall @ 2025-06-02 23:27 UTC (permalink / raw)
To: ffmpeg-devel
[-- Attachment #1: Type: text/plain, Size: 4500 bytes --]
Just a friendly follow up on this patch. I've attached the patch in case
something else was wrong with the formatting with my previous reply.
Ethan
On 5/30/25 12:29 AM, Ethan Halsall wrote:
> On 5/29/25 7:58 PM, Michael Niedermayer wrote:
>> On Tue, May 27, 2025 at 01:24:57PM -0500, Ethan Halsall wrote:
>>> Signed-off-by: Ethan Halsall <ethanhalsall11@augustana.edu>
>>> ---
>>> libavfilter/vf_mcdeint.c | 32 ++++++++++++++++++++++++++++----
>>> 1 file changed, 28 insertions(+), 4 deletions(-)
>>>
>>
>> Applying: add yuv444p support to mcdeint
>> error: corrupt patch at line 18
>>
>> this patch is somehow corrupted, that above is not a valid diff
>> make sure the output of git format-patch is not modified
>>
>> thx
>>
>>
>> [...]
>>
>
> I followed the instructions on the "Sending patches from email clients"
> section of https://ffmpeg.org/developer.html#Submitting-patches-1. I
> think Thunderbird removed some line breaks in the patch though when I
> opened the .eml file.
>
> Let's try this one:
>
>
> Signed-off-by: Ethan Halsall <ethanhalsall11@augustana.edu>
> ---
> libavfilter/vf_mcdeint.c | 32 ++++++++++++++++++++++++++++----
> 1 file changed, 28 insertions(+), 4 deletions(-)
>
> diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c
> index 82048b51d0..11ad19f5cd 100644
> --- a/libavfilter/vf_mcdeint.c
> +++ b/libavfilter/vf_mcdeint.c
> @@ -51,8 +51,10 @@
>
> #include "libavutil/opt.h"
> #include "libavcodec/avcodec.h"
> +#include "libavutil/pixdesc.h"
> #include "avfilter.h"
> #include "filters.h"
> +#include "formats.h"
> #include "video.h"
>
> enum MCDeintMode {
> @@ -76,6 +78,7 @@ typedef struct MCDeintContext {
> AVPacket *pkt;
> AVFrame *frame_dec;
> AVCodecContext *enc_ctx;
> + const AVPixFmtDescriptor *pix_fmt_desc;
> } MCDeintContext;
>
> #define OFFSET(x) offsetof(MCDeintContext, x)
> @@ -99,6 +102,17 @@ static const AVOption mcdeint_options[] = {
>
> AVFILTER_DEFINE_CLASS(mcdeint);
>
> +static const enum AVPixelFormat pix_fmts[] = {
> + AV_PIX_FMT_YUV420P,
> + AV_PIX_FMT_YUV444P,
> + AV_PIX_FMT_NONE
> +};
> +
> +static int query_formats(AVFilterContext *ctx)
> +{
> + return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
> +}
> +
> static int config_props(AVFilterLink *inlink)
> {
> AVFilterContext *ctx = inlink->dst;
> @@ -122,13 +136,16 @@ static int config_props(AVFilterLink *inlink)
> mcdeint->enc_ctx = avcodec_alloc_context3(enc);
> if (!mcdeint->enc_ctx)
> return AVERROR(ENOMEM);
> + mcdeint->pix_fmt_desc = av_pix_fmt_desc_get(inlink->format);
> + if (!mcdeint->pix_fmt_desc)
> + return AVERROR(ENOMEM);
> enc_ctx = mcdeint->enc_ctx;
> enc_ctx->width = inlink->w;
> enc_ctx->height = inlink->h;
> enc_ctx->time_base = (AVRational){1,25}; // meaningless
> enc_ctx->gop_size = INT_MAX;
> enc_ctx->max_b_frames = 0;
> - enc_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
> + enc_ctx->pix_fmt = inlink->format;
> enc_ctx->flags = AV_CODEC_FLAG_QSCALE | AV_CODEC_FLAG_LOW_DELAY |
> AV_CODEC_FLAG_RECON_FRAME;
> enc_ctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
> enc_ctx->global_quality = 1;
> @@ -201,8 +218,14 @@ static int filter_frame(AVFilterLink *inlink,
> AVFrame *inpic)
>
> for (i = 0; i < 3; i++) {
> int is_chroma = !!i;
> - int w = AV_CEIL_RSHIFT(inlink->w, is_chroma);
> - int h = AV_CEIL_RSHIFT(inlink->h, is_chroma);
> + int w, h;
> + if (is_chroma) {
> + w = inlink->w >> mcdeint->pix_fmt_desc->log2_chroma_w;
> + h = inlink->h >> mcdeint->pix_fmt_desc->log2_chroma_h;
> + } else {
> + w = inlink->w;
> + h = inlink->h;
> + }
> int fils = frame_dec->linesize[i];
> int srcs = inpic ->linesize[i];
> int dsts = outpic ->linesize[i];
> @@ -307,5 +330,6 @@ const FFFilter ff_vf_mcdeint = {
> .uninit = uninit,
> FILTER_INPUTS(mcdeint_inputs),
> FILTER_OUTPUTS(ff_video_default_filterpad),
> - FILTER_SINGLE_PIXFMT(AV_PIX_FMT_YUV420P),
> + FILTER_QUERY_FUNC(query_formats),
> };
> +
[-- Attachment #2: 0001-add-yuv444p-support-to-mcdeint.patch --]
[-- Type: text/x-patch, Size: 3207 bytes --]
From 0563143f20f127d7162ce854f03a08708c7f66cf Mon Sep 17 00:00:00 2001
From: Ethan Halsall <ethanhalsall11@augustana.edu>
Date: Sun, 25 May 2025 00:51:05 -0500
Subject: [PATCH] add yuv444p support to mcdeint
Signed-off-by: Ethan Halsall <ethanhalsall11@augustana.edu>
---
libavfilter/vf_mcdeint.c | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c
index 82048b51d0..11ad19f5cd 100644
--- a/libavfilter/vf_mcdeint.c
+++ b/libavfilter/vf_mcdeint.c
@@ -51,8 +51,10 @@
#include "libavutil/opt.h"
#include "libavcodec/avcodec.h"
+#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.h"
+#include "formats.h"
#include "video.h"
enum MCDeintMode {
@@ -76,6 +78,7 @@ typedef struct MCDeintContext {
AVPacket *pkt;
AVFrame *frame_dec;
AVCodecContext *enc_ctx;
+ const AVPixFmtDescriptor *pix_fmt_desc;
} MCDeintContext;
#define OFFSET(x) offsetof(MCDeintContext, x)
@@ -99,6 +102,17 @@ static const AVOption mcdeint_options[] = {
AVFILTER_DEFINE_CLASS(mcdeint);
+static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_NONE
+};
+
+static int query_formats(AVFilterContext *ctx)
+{
+ return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
+}
+
static int config_props(AVFilterLink *inlink)
{
AVFilterContext *ctx = inlink->dst;
@@ -122,13 +136,16 @@ static int config_props(AVFilterLink *inlink)
mcdeint->enc_ctx = avcodec_alloc_context3(enc);
if (!mcdeint->enc_ctx)
return AVERROR(ENOMEM);
+ mcdeint->pix_fmt_desc = av_pix_fmt_desc_get(inlink->format);
+ if (!mcdeint->pix_fmt_desc)
+ return AVERROR(ENOMEM);
enc_ctx = mcdeint->enc_ctx;
enc_ctx->width = inlink->w;
enc_ctx->height = inlink->h;
enc_ctx->time_base = (AVRational){1,25}; // meaningless
enc_ctx->gop_size = INT_MAX;
enc_ctx->max_b_frames = 0;
- enc_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ enc_ctx->pix_fmt = inlink->format;
enc_ctx->flags = AV_CODEC_FLAG_QSCALE | AV_CODEC_FLAG_LOW_DELAY | AV_CODEC_FLAG_RECON_FRAME;
enc_ctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
enc_ctx->global_quality = 1;
@@ -201,8 +218,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
for (i = 0; i < 3; i++) {
int is_chroma = !!i;
- int w = AV_CEIL_RSHIFT(inlink->w, is_chroma);
- int h = AV_CEIL_RSHIFT(inlink->h, is_chroma);
+ int w, h;
+ if (is_chroma) {
+ w = inlink->w >> mcdeint->pix_fmt_desc->log2_chroma_w;
+ h = inlink->h >> mcdeint->pix_fmt_desc->log2_chroma_h;
+ } else {
+ w = inlink->w;
+ h = inlink->h;
+ }
int fils = frame_dec->linesize[i];
int srcs = inpic ->linesize[i];
int dsts = outpic ->linesize[i];
@@ -307,5 +330,6 @@ const FFFilter ff_vf_mcdeint = {
.uninit = uninit,
FILTER_INPUTS(mcdeint_inputs),
FILTER_OUTPUTS(ff_video_default_filterpad),
- FILTER_SINGLE_PIXFMT(AV_PIX_FMT_YUV420P),
+ FILTER_QUERY_FUNC(query_formats),
};
+
--
2.43.0
[-- Attachment #3: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH] add yuv444p support to mcdeint
2025-06-02 18:39 ` Michael Niedermayer
@ 2025-06-07 17:15 ` Ethan Halsall
2025-06-07 23:25 ` Michael Niedermayer
0 siblings, 1 reply; 9+ messages in thread
From: Ethan Halsall @ 2025-06-07 17:15 UTC (permalink / raw)
To: ffmpeg-devel
[-- Attachment #1: Type: text/plain, Size: 6558 bytes --]
Hi Michael,
Apologies for the late response, I missed this message.
On 6/2/25 1:39 PM, Michael Niedermayer wrote:
> Hi Ethan
>
> On Fri, May 30, 2025 at 12:29:19AM -0500, Ethan Halsall wrote:
>> On 5/29/25 7:58 PM, Michael Niedermayer wrote:
>>> On Tue, May 27, 2025 at 01:24:57PM -0500, Ethan Halsall wrote:
>>>> Signed-off-by: Ethan Halsall <ethanhalsall11@augustana.edu>
>>>> ---
>>>> libavfilter/vf_mcdeint.c | 32 ++++++++++++++++++++++++++++----
>>>> 1 file changed, 28 insertions(+), 4 deletions(-)
>>>
>>> Applying: add yuv444p support to mcdeint
>>> error: corrupt patch at line 18
>>>
>>> this patch is somehow corrupted, that above is not a valid diff
>>> make sure the output of git format-patch is not modified
>>>
>>> thx
>>>
>>> [...]
>>
>> I followed the instructions on the "Sending patches from email clients"
>> section of https://ffmpeg.org/developer.html#Submitting-patches-1. I think
>> Thunderbird removed some line breaks in the patch though when I opened the
>> .eml file.
>>
>> Let's try this one:
>>
>>
>> Signed-off-by: Ethan Halsall <ethanhalsall11@augustana.edu>
>> ---
>> libavfilter/vf_mcdeint.c | 32 ++++++++++++++++++++++++++++----
>> 1 file changed, 28 insertions(+), 4 deletions(-)
>>
>> diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c
>> index 82048b51d0..11ad19f5cd 100644
>> --- a/libavfilter/vf_mcdeint.c
>> +++ b/libavfilter/vf_mcdeint.c
>> @@ -51,8 +51,10 @@
>>
>> #include "libavutil/opt.h"
>> #include "libavcodec/avcodec.h"
>> +#include "libavutil/pixdesc.h"
>> #include "avfilter.h"
>> #include "filters.h"
>> +#include "formats.h"
>> #include "video.h"
>>
>> enum MCDeintMode {
>> @@ -76,6 +78,7 @@ typedef struct MCDeintContext {
>> AVPacket *pkt;
>> AVFrame *frame_dec;
>> AVCodecContext *enc_ctx;
>> + const AVPixFmtDescriptor *pix_fmt_desc;
>> } MCDeintContext;
>>
>> #define OFFSET(x) offsetof(MCDeintContext, x)
>
>> @@ -99,6 +102,17 @@ static const AVOption mcdeint_options[] = {
>>
>> AVFILTER_DEFINE_CLASS(mcdeint);
>>
>> +static const enum AVPixelFormat pix_fmts[] = {
>> + AV_PIX_FMT_YUV420P,
>> + AV_PIX_FMT_YUV444P,
>> + AV_PIX_FMT_NONE
>> +};
>> +
>> +static int query_formats(AVFilterContext *ctx)
>> +{
>> + return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
>> +}
>
> why not use FILTER_PIXFMTS ?
>
>
>> +
>> static int config_props(AVFilterLink *inlink)
>> {
>> AVFilterContext *ctx = inlink->dst;
>> @@ -122,13 +136,16 @@ static int config_props(AVFilterLink *inlink)
>> mcdeint->enc_ctx = avcodec_alloc_context3(enc);
>> if (!mcdeint->enc_ctx)
>> return AVERROR(ENOMEM);
>> + mcdeint->pix_fmt_desc = av_pix_fmt_desc_get(inlink->format);
>> + if (!mcdeint->pix_fmt_desc)
>> + return AVERROR(ENOMEM);
>> enc_ctx = mcdeint->enc_ctx;
>> enc_ctx->width = inlink->w;
>> enc_ctx->height = inlink->h;
>> enc_ctx->time_base = (AVRational){1,25}; // meaningless
>> enc_ctx->gop_size = INT_MAX;
>> enc_ctx->max_b_frames = 0;
>> - enc_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
>> + enc_ctx->pix_fmt = inlink->format;
>> enc_ctx->flags = AV_CODEC_FLAG_QSCALE | AV_CODEC_FLAG_LOW_DELAY |
>> AV_CODEC_FLAG_RECON_FRAME;
>> enc_ctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
>> enc_ctx->global_quality = 1;
>> @@ -201,8 +218,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
>> *inpic)
>>
>> for (i = 0; i < 3; i++) {
>> int is_chroma = !!i;
>> - int w = AV_CEIL_RSHIFT(inlink->w, is_chroma);
>> - int h = AV_CEIL_RSHIFT(inlink->h, is_chroma);
>> + int w, h;
>> + if (is_chroma) {
>> + w = inlink->w >> mcdeint->pix_fmt_desc->log2_chroma_w;
>> + h = inlink->h >> mcdeint->pix_fmt_desc->log2_chroma_h;
>> + } else {
>> + w = inlink->w;
>> + h = inlink->h;
>> + }
>> int fils = frame_dec->linesize[i];
>> int srcs = inpic ->linesize[i];
>> int dsts = outpic ->linesize[i];
>
> pix_fmt_desc could be a local variable in filter_frame()
> which would avoid adding it to the context
>
>
> thx
>
> [...]
>
Here is the patch updated with your suggestions (also attached):
Signed-off-by: Ethan Halsall <ethanhalsall11@augustana.edu>
---
libavfilter/vf_mcdeint.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c
index 82048b51d0..33df331e08 100644
--- a/libavfilter/vf_mcdeint.c
+++ b/libavfilter/vf_mcdeint.c
@@ -51,6 +51,7 @@
#include "libavutil/opt.h"
#include "libavcodec/avcodec.h"
+#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.h"
#include "video.h"
@@ -128,7 +129,7 @@ static int config_props(AVFilterLink *inlink)
enc_ctx->time_base = (AVRational){1,25}; // meaningless
enc_ctx->gop_size = INT_MAX;
enc_ctx->max_b_frames = 0;
- enc_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ enc_ctx->pix_fmt = inlink->format;
enc_ctx->flags = AV_CODEC_FLAG_QSCALE | AV_CODEC_FLAG_LOW_DELAY | AV_CODEC_FLAG_RECON_FRAME;
enc_ctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
enc_ctx->global_quality = 1;
@@ -172,6 +173,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *outpic, *frame_dec = mcdeint->frame_dec;
AVPacket *pkt = mcdeint->pkt;
+ const AVPixFmtDescriptor *pix_fmt_desc = av_pix_fmt_desc_get(inlink->format);
int x, y, i, ret;
outpic = ff_get_video_buffer(outlink, outlink->w, outlink->h);
@@ -201,8 +203,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
for (i = 0; i < 3; i++) {
int is_chroma = !!i;
- int w = AV_CEIL_RSHIFT(inlink->w, is_chroma);
- int h = AV_CEIL_RSHIFT(inlink->h, is_chroma);
+ int w, h;
+ if (is_chroma) {
+ w = inlink->w >> pix_fmt_desc->log2_chroma_w;
+ h = inlink->h >> pix_fmt_desc->log2_chroma_h;
+ } else {
+ w = inlink->w;
+ h = inlink->h;
+ }
int fils = frame_dec->linesize[i];
int srcs = inpic ->linesize[i];
int dsts = outpic ->linesize[i];
@@ -307,5 +315,5 @@ const FFFilter ff_vf_mcdeint = {
.uninit = uninit,
FILTER_INPUTS(mcdeint_inputs),
FILTER_OUTPUTS(ff_video_default_filterpad),
- FILTER_SINGLE_PIXFMT(AV_PIX_FMT_YUV420P),
+ FILTER_PIXFMTS(AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P)
};
--
2.43.0
Ethan
[-- Attachment #2: 0001-add-yuv444p-support-to-mcdeint.patch --]
[-- Type: text/x-patch, Size: 2518 bytes --]
From ffc42f0db5232c5d43c5e67e37b33a22136c44bc Mon Sep 17 00:00:00 2001
From: Ethan Halsall <ethanhalsall11@augustana.edu>
Date: Sun, 25 May 2025 00:51:05 -0500
Subject: [PATCH] add yuv444p support to mcdeint
Signed-off-by: Ethan Halsall <ethanhalsall11@augustana.edu>
---
libavfilter/vf_mcdeint.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c
index 82048b51d0..33df331e08 100644
--- a/libavfilter/vf_mcdeint.c
+++ b/libavfilter/vf_mcdeint.c
@@ -51,6 +51,7 @@
#include "libavutil/opt.h"
#include "libavcodec/avcodec.h"
+#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.h"
#include "video.h"
@@ -128,7 +129,7 @@ static int config_props(AVFilterLink *inlink)
enc_ctx->time_base = (AVRational){1,25}; // meaningless
enc_ctx->gop_size = INT_MAX;
enc_ctx->max_b_frames = 0;
- enc_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ enc_ctx->pix_fmt = inlink->format;
enc_ctx->flags = AV_CODEC_FLAG_QSCALE | AV_CODEC_FLAG_LOW_DELAY | AV_CODEC_FLAG_RECON_FRAME;
enc_ctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
enc_ctx->global_quality = 1;
@@ -172,6 +173,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *outpic, *frame_dec = mcdeint->frame_dec;
AVPacket *pkt = mcdeint->pkt;
+ const AVPixFmtDescriptor *pix_fmt_desc = av_pix_fmt_desc_get(inlink->format);
int x, y, i, ret;
outpic = ff_get_video_buffer(outlink, outlink->w, outlink->h);
@@ -201,8 +203,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
for (i = 0; i < 3; i++) {
int is_chroma = !!i;
- int w = AV_CEIL_RSHIFT(inlink->w, is_chroma);
- int h = AV_CEIL_RSHIFT(inlink->h, is_chroma);
+ int w, h;
+ if (is_chroma) {
+ w = inlink->w >> pix_fmt_desc->log2_chroma_w;
+ h = inlink->h >> pix_fmt_desc->log2_chroma_h;
+ } else {
+ w = inlink->w;
+ h = inlink->h;
+ }
int fils = frame_dec->linesize[i];
int srcs = inpic ->linesize[i];
int dsts = outpic ->linesize[i];
@@ -307,5 +315,5 @@ const FFFilter ff_vf_mcdeint = {
.uninit = uninit,
FILTER_INPUTS(mcdeint_inputs),
FILTER_OUTPUTS(ff_video_default_filterpad),
- FILTER_SINGLE_PIXFMT(AV_PIX_FMT_YUV420P),
+ FILTER_PIXFMTS(AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P)
};
--
2.43.0
[-- Attachment #3: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH] add yuv444p support to mcdeint
2025-06-07 17:15 ` Ethan Halsall
@ 2025-06-07 23:25 ` Michael Niedermayer
2025-06-08 6:07 ` Ethan Halsall
0 siblings, 1 reply; 9+ messages in thread
From: Michael Niedermayer @ 2025-06-07 23:25 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 767 bytes --]
Hi Ethan
On Sat, Jun 07, 2025 at 12:15:06PM -0500, Ethan Halsall wrote:
> Hi Michael,
[...]
> @@ -201,8 +203,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
>
> for (i = 0; i < 3; i++) {
> int is_chroma = !!i;
> - int w = AV_CEIL_RSHIFT(inlink->w, is_chroma);
> - int h = AV_CEIL_RSHIFT(inlink->h, is_chroma);
> + int w, h;
> + if (is_chroma) {
> + w = inlink->w >> pix_fmt_desc->log2_chroma_w;
> + h = inlink->h >> pix_fmt_desc->log2_chroma_h;
why is this not using AV_CEIL_RSHIFT() ?
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
What is money laundering? Its paying someone and not telling the government.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH] add yuv444p support to mcdeint
2025-06-07 23:25 ` Michael Niedermayer
@ 2025-06-08 6:07 ` Ethan Halsall
2025-06-14 20:52 ` Michael Niedermayer
0 siblings, 1 reply; 9+ messages in thread
From: Ethan Halsall @ 2025-06-08 6:07 UTC (permalink / raw)
To: ffmpeg-devel
[-- Attachment #1: Type: text/plain, Size: 3449 bytes --]
Hi Michael,
On 6/7/25 6:25 PM, Michael Niedermayer wrote:
> Hi Ethan
>
> On Sat, Jun 07, 2025 at 12:15:06PM -0500, Ethan Halsall wrote:
>> Hi Michael,
> [...]
>> @@ -201,8 +203,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
>>
>> for (i = 0; i < 3; i++) {
>> int is_chroma = !!i;
>> - int w = AV_CEIL_RSHIFT(inlink->w, is_chroma);
>> - int h = AV_CEIL_RSHIFT(inlink->h, is_chroma);
>> + int w, h;
>> + if (is_chroma) {
>> + w = inlink->w >> pix_fmt_desc->log2_chroma_w;
>> + h = inlink->h >> pix_fmt_desc->log2_chroma_h;
>
> why is this not using AV_CEIL_RSHIFT() ?
>
> thx
>
> [...]
>
>
> _______________________________________________
> 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".
I was just using a plain right shift as I was experimenting with this. Seems to work fine with the macro so I can put it back if that's more conventional.
Signed-off-by: Ethan Halsall <ethanhalsall11@augustana.edu>
---
libavfilter/vf_mcdeint.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c
index 82048b51d0..f87f441861 100644
--- a/libavfilter/vf_mcdeint.c
+++ b/libavfilter/vf_mcdeint.c
@@ -51,6 +51,7 @@
#include "libavutil/opt.h"
#include "libavcodec/avcodec.h"
+#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.h"
#include "video.h"
@@ -128,7 +129,7 @@ static int config_props(AVFilterLink *inlink)
enc_ctx->time_base = (AVRational){1,25}; // meaningless
enc_ctx->gop_size = INT_MAX;
enc_ctx->max_b_frames = 0;
- enc_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ enc_ctx->pix_fmt = inlink->format;
enc_ctx->flags = AV_CODEC_FLAG_QSCALE | AV_CODEC_FLAG_LOW_DELAY | AV_CODEC_FLAG_RECON_FRAME;
enc_ctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
enc_ctx->global_quality = 1;
@@ -172,6 +173,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *outpic, *frame_dec = mcdeint->frame_dec;
AVPacket *pkt = mcdeint->pkt;
+ const AVPixFmtDescriptor *pix_fmt_desc = av_pix_fmt_desc_get(inlink->format);
int x, y, i, ret;
outpic = ff_get_video_buffer(outlink, outlink->w, outlink->h);
@@ -201,8 +203,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
for (i = 0; i < 3; i++) {
int is_chroma = !!i;
- int w = AV_CEIL_RSHIFT(inlink->w, is_chroma);
- int h = AV_CEIL_RSHIFT(inlink->h, is_chroma);
+ int w, h;
+ if (is_chroma) {
+ w = AV_CEIL_RSHIFT(inlink->w, pix_fmt_desc->log2_chroma_w);
+ h = AV_CEIL_RSHIFT(inlink->h, pix_fmt_desc->log2_chroma_h);
+ } else {
+ w = inlink->w;
+ h = inlink->h;
+ }
int fils = frame_dec->linesize[i];
int srcs = inpic ->linesize[i];
int dsts = outpic ->linesize[i];
@@ -307,5 +315,5 @@ const FFFilter ff_vf_mcdeint = {
.uninit = uninit,
FILTER_INPUTS(mcdeint_inputs),
FILTER_OUTPUTS(ff_video_default_filterpad),
- FILTER_SINGLE_PIXFMT(AV_PIX_FMT_YUV420P),
+ FILTER_PIXFMTS(AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P),
};
--
2.43.0
Ethan
[-- Attachment #2: 0001-add-yuv444p-support-to-mcdeint.patch --]
[-- Type: text/x-patch, Size: 2547 bytes --]
From ce191d0355d603ca03211f62f5c17a9304142c99 Mon Sep 17 00:00:00 2001
From: Ethan Halsall <ethanhalsall11@augustana.edu>
Date: Sun, 25 May 2025 00:51:05 -0500
Subject: [PATCH] add yuv444p support to mcdeint
Signed-off-by: Ethan Halsall <ethanhalsall11@augustana.edu>
---
libavfilter/vf_mcdeint.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c
index 82048b51d0..f87f441861 100644
--- a/libavfilter/vf_mcdeint.c
+++ b/libavfilter/vf_mcdeint.c
@@ -51,6 +51,7 @@
#include "libavutil/opt.h"
#include "libavcodec/avcodec.h"
+#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.h"
#include "video.h"
@@ -128,7 +129,7 @@ static int config_props(AVFilterLink *inlink)
enc_ctx->time_base = (AVRational){1,25}; // meaningless
enc_ctx->gop_size = INT_MAX;
enc_ctx->max_b_frames = 0;
- enc_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ enc_ctx->pix_fmt = inlink->format;
enc_ctx->flags = AV_CODEC_FLAG_QSCALE | AV_CODEC_FLAG_LOW_DELAY | AV_CODEC_FLAG_RECON_FRAME;
enc_ctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
enc_ctx->global_quality = 1;
@@ -172,6 +173,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *outpic, *frame_dec = mcdeint->frame_dec;
AVPacket *pkt = mcdeint->pkt;
+ const AVPixFmtDescriptor *pix_fmt_desc = av_pix_fmt_desc_get(inlink->format);
int x, y, i, ret;
outpic = ff_get_video_buffer(outlink, outlink->w, outlink->h);
@@ -201,8 +203,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
for (i = 0; i < 3; i++) {
int is_chroma = !!i;
- int w = AV_CEIL_RSHIFT(inlink->w, is_chroma);
- int h = AV_CEIL_RSHIFT(inlink->h, is_chroma);
+ int w, h;
+ if (is_chroma) {
+ w = AV_CEIL_RSHIFT(inlink->w, pix_fmt_desc->log2_chroma_w);
+ h = AV_CEIL_RSHIFT(inlink->h, pix_fmt_desc->log2_chroma_h);
+ } else {
+ w = inlink->w;
+ h = inlink->h;
+ }
int fils = frame_dec->linesize[i];
int srcs = inpic ->linesize[i];
int dsts = outpic ->linesize[i];
@@ -307,5 +315,5 @@ const FFFilter ff_vf_mcdeint = {
.uninit = uninit,
FILTER_INPUTS(mcdeint_inputs),
FILTER_OUTPUTS(ff_video_default_filterpad),
- FILTER_SINGLE_PIXFMT(AV_PIX_FMT_YUV420P),
+ FILTER_PIXFMTS(AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P),
};
--
2.43.0
[-- Attachment #3: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH] add yuv444p support to mcdeint
2025-06-08 6:07 ` Ethan Halsall
@ 2025-06-14 20:52 ` Michael Niedermayer
0 siblings, 0 replies; 9+ messages in thread
From: Michael Niedermayer @ 2025-06-14 20:52 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 1617 bytes --]
On Sun, Jun 08, 2025 at 01:07:37AM -0500, Ethan Halsall wrote:
> Hi Michael,
>
> On 6/7/25 6:25 PM, Michael Niedermayer wrote:
> > Hi Ethan
> >
> > On Sat, Jun 07, 2025 at 12:15:06PM -0500, Ethan Halsall wrote:
> >> Hi Michael,
> > [...]
> >> @@ -201,8 +203,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
> >>
> >> for (i = 0; i < 3; i++) {
> >> int is_chroma = !!i;
> >> - int w = AV_CEIL_RSHIFT(inlink->w, is_chroma);
> >> - int h = AV_CEIL_RSHIFT(inlink->h, is_chroma);
> >> + int w, h;
> >> + if (is_chroma) {
> >> + w = inlink->w >> pix_fmt_desc->log2_chroma_w;
> >> + h = inlink->h >> pix_fmt_desc->log2_chroma_h;
> >
> > why is this not using AV_CEIL_RSHIFT() ?
> >
> > thx
> >
> > [...]
> >
> >
> > _______________________________________________
> > 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".
>
> I was just using a plain right shift as I was experimenting with this. Seems to work fine with the macro so I can put it back if that's more conventional.
will apply
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The day soldiers stop bringing you their problems is the day you have stopped
leading them. They have either lost confidence that you can help or concluded
you do not care. Either case is a failure of leadership. - Colin Powell
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-06-14 20:52 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-27 18:24 [FFmpeg-devel] [PATCH] add yuv444p support to mcdeint Ethan Halsall
2025-05-30 0:58 ` Michael Niedermayer
2025-05-30 5:29 ` Ethan Halsall
2025-06-02 18:39 ` Michael Niedermayer
2025-06-07 17:15 ` Ethan Halsall
2025-06-07 23:25 ` Michael Niedermayer
2025-06-08 6:07 ` Ethan Halsall
2025-06-14 20:52 ` Michael Niedermayer
2025-06-02 23:27 ` Ethan Halsall
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