diff mbox

[FFmpeg-devel,1/4] avfilter/vf_interlace: restore lowpass mode constants

Message ID 20191206225207.27755-1-cus@passwd.hu
State Accepted
Commit 28b5dc6199ed7b4f62e345865fe28142b9cbf9e0
Headers show

Commit Message

Marton Balint Dec. 6, 2019, 10:52 p.m. UTC
The documentation still mentions numerical constants in addition to textual
ones. It is also wrong to use distinct modes as flags and it disallows us to
actually use the flags field for real flags in the future.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavfilter/tinterlace.h    |  7 +++++++
 libavfilter/vf_tinterlace.c | 13 +++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

Comments

Marton Balint Dec. 13, 2019, 11:35 a.m. UTC | #1
On Fri, 6 Dec 2019, Marton Balint wrote:

> The documentation still mentions numerical constants in addition to textual
> ones. It is also wrong to use distinct modes as flags and it disallows us to
> actually use the flags field for real flags in the future.

Ping for the series. Will apply soon.

Thanks,
Marton

>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> libavfilter/tinterlace.h    |  7 +++++++
> libavfilter/vf_tinterlace.c | 13 +++++++++----
> 2 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/libavfilter/tinterlace.h b/libavfilter/tinterlace.h
> index 5bcb9a583a..e204b61aa0 100644
> --- a/libavfilter/tinterlace.h
> +++ b/libavfilter/tinterlace.h
> @@ -37,6 +37,12 @@
> #define TINTERLACE_FLAG_CVLPF 2
> #define TINTERLACE_FLAG_EXACT_TB 4
> 
> +enum VLPFilter {
> +    VLPF_OFF = 0,
> +    VLPF_LIN = 1,
> +    VLPF_CMP = 2,
> +};
> +
> enum TInterlaceMode {
>     MODE_MERGE = 0,
>     MODE_DROP_EVEN,
> @@ -59,6 +65,7 @@ typedef struct TInterlaceContext {
>     int mode;                   ///< TInterlaceMode, interlace mode selected
>     AVRational preout_time_base;
>     int flags;                  ///< flags affecting interlacing algorithm
> +    int lowpass;                ///< legacy interlace filter lowpass mode
>     int frame;                  ///< number of the output frame
>     int vsub;                   ///< chroma vertical subsampling
>     AVFrame *cur;
> diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c
> index fc5d11e053..32b2ff9f5a 100644
> --- a/libavfilter/vf_tinterlace.c
> +++ b/libavfilter/vf_tinterlace.c
> @@ -63,10 +63,10 @@ static const AVOption interlace_options[] = {
>    { "scan",              "scanning mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = MODE_TFF}, 0, 1, FLAGS, "mode"},
>    { "tff",               "top field first",                              0, AV_OPT_TYPE_CONST, {.i64 = MODE_TFF}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
>    { "bff",               "bottom field first",                           0, AV_OPT_TYPE_CONST, {.i64 = MODE_BFF}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
> -   { "lowpass",           "set vertical low-pass filter", OFFSET(flags), AV_OPT_TYPE_FLAGS,   {.i64 = TINTERLACE_FLAG_VLPF}, 0, 2, FLAGS, "flags" },
> -   { "off",               "disable vertical low-pass filter",             0, AV_OPT_TYPE_CONST, {.i64 = 0}, INT_MIN, INT_MAX, FLAGS, "flags" },
> -   { "linear",            "linear vertical low-pass filter",              0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_VLPF}, INT_MIN, INT_MAX, FLAGS, "flags" },
> -   { "complex",           "complex vertical low-pass filter",             0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_CVLPF},INT_MIN, INT_MAX, FLAGS, "flags" },
> +   { "lowpass",           "set vertical low-pass filter", OFFSET(lowpass), AV_OPT_TYPE_INT,   {.i64 = VLPF_LIN}, 0, 2, FLAGS, "lowpass" },
> +   {     "off",           "disable vertical low-pass filter",             0, AV_OPT_TYPE_CONST, {.i64 = VLPF_OFF}, INT_MIN, INT_MAX, FLAGS, "lowpass" },
> +   {     "linear",        "linear vertical low-pass filter",              0, AV_OPT_TYPE_CONST, {.i64 = VLPF_LIN}, INT_MIN, INT_MAX, FLAGS, "lowpass" },
> +   {     "complex",       "complex vertical low-pass filter",             0, AV_OPT_TYPE_CONST, {.i64 = VLPF_CMP}, INT_MIN, INT_MAX, FLAGS, "lowpass" },
>
>    { NULL }
> };
> @@ -518,6 +518,11 @@ static int init_interlace(AVFilterContext *ctx)
>     if (tinterlace->mode <= MODE_BFF)
>         tinterlace->mode += MODE_INTERLEAVE_TOP;
> 
> +    if (tinterlace->lowpass == VLPF_LIN)
> +        tinterlace->flags |= TINTERLACE_FLAG_VLPF;
> +    if (tinterlace->lowpass == VLPF_CMP)
> +        tinterlace->flags |= TINTERLACE_FLAG_CVLPF;
> +
>     return 0;
> }
> 
> -- 
> 2.16.4
>
> _______________________________________________
> 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".
Marton Balint Dec. 15, 2019, 1:48 p.m. UTC | #2
On Fri, 13 Dec 2019, Marton Balint wrote:

>
>
> On Fri, 6 Dec 2019, Marton Balint wrote:
>
>> The documentation still mentions numerical constants in addition to textual
>> ones. It is also wrong to use distinct modes as flags and it disallows us 
> to
>> actually use the flags field for real flags in the future.
>
> Ping for the series. Will apply soon.

Applied.

Regards,
Marton

>>
>> Signed-off-by: Marton Balint <cus@passwd.hu>
>> ---
>> libavfilter/tinterlace.h    |  7 +++++++
>> libavfilter/vf_tinterlace.c | 13 +++++++++----
>> 2 files changed, 16 insertions(+), 4 deletions(-)
>>
>> diff --git a/libavfilter/tinterlace.h b/libavfilter/tinterlace.h
>> index 5bcb9a583a..e204b61aa0 100644
>> --- a/libavfilter/tinterlace.h
>> +++ b/libavfilter/tinterlace.h
>> @@ -37,6 +37,12 @@
>> #define TINTERLACE_FLAG_CVLPF 2
>> #define TINTERLACE_FLAG_EXACT_TB 4
>> 
>> +enum VLPFilter {
>> +    VLPF_OFF = 0,
>> +    VLPF_LIN = 1,
>> +    VLPF_CMP = 2,
>> +};
>> +
>> enum TInterlaceMode {
>>     MODE_MERGE = 0,
>>     MODE_DROP_EVEN,
>> @@ -59,6 +65,7 @@ typedef struct TInterlaceContext {
>>     int mode;                   ///< TInterlaceMode, interlace mode 
> selected
>>     AVRational preout_time_base;
>>     int flags;                  ///< flags affecting interlacing algorithm
>> +    int lowpass;                ///< legacy interlace filter lowpass mode
>>     int frame;                  ///< number of the output frame
>>     int vsub;                   ///< chroma vertical subsampling
>>     AVFrame *cur;
>> diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c
>> index fc5d11e053..32b2ff9f5a 100644
>> --- a/libavfilter/vf_tinterlace.c
>> +++ b/libavfilter/vf_tinterlace.c
>> @@ -63,10 +63,10 @@ static const AVOption interlace_options[] = {
>>    { "scan",              "scanning mode", OFFSET(mode), AV_OPT_TYPE_INT, 
> {.i64 = MODE_TFF}, 0, 1, FLAGS, "mode"},
>>    { "tff",               "top field first", 
> 0, AV_OPT_TYPE_CONST, {.i64 = MODE_TFF}, INT_MIN, INT_MAX, FLAGS, .unit = 
> "mode"},
>>    { "bff",               "bottom field first", 
> 0, AV_OPT_TYPE_CONST, {.i64 = MODE_BFF}, INT_MIN, INT_MAX, FLAGS, .unit = 
> "mode"},
>> -   { "lowpass",           "set vertical low-pass filter", OFFSET(flags), 
> AV_OPT_TYPE_FLAGS,   {.i64 = TINTERLACE_FLAG_VLPF}, 0, 2, FLAGS, "flags" },
>> -   { "off",               "disable vertical low-pass filter", 
> 0, AV_OPT_TYPE_CONST, {.i64 = 0}, INT_MIN, INT_MAX, FLAGS, "flags" },
>> -   { "linear",            "linear vertical low-pass filter", 
> 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_VLPF}, INT_MIN, INT_MAX, FLAGS, 
> "flags" },
>> -   { "complex",           "complex vertical low-pass filter", 
> 0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_CVLPF},INT_MIN, INT_MAX, FLAGS, 
> "flags" },
>> +   { "lowpass",           "set vertical low-pass filter", OFFSET(lowpass), 
> AV_OPT_TYPE_INT,   {.i64 = VLPF_LIN}, 0, 2, FLAGS, "lowpass" },
>> +   {     "off",           "disable vertical low-pass filter", 
> 0, AV_OPT_TYPE_CONST, {.i64 = VLPF_OFF}, INT_MIN, INT_MAX, FLAGS, "lowpass" 
> },
>> +   {     "linear",        "linear vertical low-pass filter", 
> 0, AV_OPT_TYPE_CONST, {.i64 = VLPF_LIN}, INT_MIN, INT_MAX, FLAGS, "lowpass" 
> },
>> +   {     "complex",       "complex vertical low-pass filter", 
> 0, AV_OPT_TYPE_CONST, {.i64 = VLPF_CMP}, INT_MIN, INT_MAX, FLAGS, "lowpass" 
> },
>>
>>    { NULL }
>> };
>> @@ -518,6 +518,11 @@ static int init_interlace(AVFilterContext *ctx)
>>     if (tinterlace->mode <= MODE_BFF)
>>         tinterlace->mode += MODE_INTERLEAVE_TOP;
>> 
>> +    if (tinterlace->lowpass == VLPF_LIN)
>> +        tinterlace->flags |= TINTERLACE_FLAG_VLPF;
>> +    if (tinterlace->lowpass == VLPF_CMP)
>> +        tinterlace->flags |= TINTERLACE_FLAG_CVLPF;
>> +
>>     return 0;
>> }
>> 
>> -- 
>> 2.16.4
>>
>> _______________________________________________
>> 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".
> _______________________________________________
> 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".
diff mbox

Patch

diff --git a/libavfilter/tinterlace.h b/libavfilter/tinterlace.h
index 5bcb9a583a..e204b61aa0 100644
--- a/libavfilter/tinterlace.h
+++ b/libavfilter/tinterlace.h
@@ -37,6 +37,12 @@ 
 #define TINTERLACE_FLAG_CVLPF 2
 #define TINTERLACE_FLAG_EXACT_TB 4
 
+enum VLPFilter {
+    VLPF_OFF = 0,
+    VLPF_LIN = 1,
+    VLPF_CMP = 2,
+};
+
 enum TInterlaceMode {
     MODE_MERGE = 0,
     MODE_DROP_EVEN,
@@ -59,6 +65,7 @@  typedef struct TInterlaceContext {
     int mode;                   ///< TInterlaceMode, interlace mode selected
     AVRational preout_time_base;
     int flags;                  ///< flags affecting interlacing algorithm
+    int lowpass;                ///< legacy interlace filter lowpass mode
     int frame;                  ///< number of the output frame
     int vsub;                   ///< chroma vertical subsampling
     AVFrame *cur;
diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c
index fc5d11e053..32b2ff9f5a 100644
--- a/libavfilter/vf_tinterlace.c
+++ b/libavfilter/vf_tinterlace.c
@@ -63,10 +63,10 @@  static const AVOption interlace_options[] = {
    { "scan",              "scanning mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = MODE_TFF}, 0, 1, FLAGS, "mode"},
    { "tff",               "top field first",                              0, AV_OPT_TYPE_CONST, {.i64 = MODE_TFF}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
    { "bff",               "bottom field first",                           0, AV_OPT_TYPE_CONST, {.i64 = MODE_BFF}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"},
-   { "lowpass",           "set vertical low-pass filter", OFFSET(flags), AV_OPT_TYPE_FLAGS,   {.i64 = TINTERLACE_FLAG_VLPF}, 0, 2, FLAGS, "flags" },
-   { "off",               "disable vertical low-pass filter",             0, AV_OPT_TYPE_CONST, {.i64 = 0}, INT_MIN, INT_MAX, FLAGS, "flags" },
-   { "linear",            "linear vertical low-pass filter",              0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_VLPF}, INT_MIN, INT_MAX, FLAGS, "flags" },
-   { "complex",           "complex vertical low-pass filter",             0, AV_OPT_TYPE_CONST, {.i64 = TINTERLACE_FLAG_CVLPF},INT_MIN, INT_MAX, FLAGS, "flags" },
+   { "lowpass",           "set vertical low-pass filter", OFFSET(lowpass), AV_OPT_TYPE_INT,   {.i64 = VLPF_LIN}, 0, 2, FLAGS, "lowpass" },
+   {     "off",           "disable vertical low-pass filter",             0, AV_OPT_TYPE_CONST, {.i64 = VLPF_OFF}, INT_MIN, INT_MAX, FLAGS, "lowpass" },
+   {     "linear",        "linear vertical low-pass filter",              0, AV_OPT_TYPE_CONST, {.i64 = VLPF_LIN}, INT_MIN, INT_MAX, FLAGS, "lowpass" },
+   {     "complex",       "complex vertical low-pass filter",             0, AV_OPT_TYPE_CONST, {.i64 = VLPF_CMP}, INT_MIN, INT_MAX, FLAGS, "lowpass" },
 
    { NULL }
 };
@@ -518,6 +518,11 @@  static int init_interlace(AVFilterContext *ctx)
     if (tinterlace->mode <= MODE_BFF)
         tinterlace->mode += MODE_INTERLEAVE_TOP;
 
+    if (tinterlace->lowpass == VLPF_LIN)
+        tinterlace->flags |= TINTERLACE_FLAG_VLPF;
+    if (tinterlace->lowpass == VLPF_CMP)
+        tinterlace->flags |= TINTERLACE_FLAG_CVLPF;
+
     return 0;
 }