diff mbox

[FFmpeg-devel] avfilter/vf_lut: add support for gray formats

Message ID 20171222095728.16829-1-onemda@gmail.com
State Accepted
Commit d2a2bc9a9f305008e417d72432322fcf48400b33
Headers show

Commit Message

Paul B Mahol Dec. 22, 2017, 9:57 a.m. UTC
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavfilter/vf_lut.c              | 6 +++++-
 tests/ref/fate/filter-pixfmts-lut | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)

Comments

James Darnley Dec. 22, 2017, 11:51 a.m. UTC | #1
On 2017-12-22 10:57, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavfilter/vf_lut.c              | 6 +++++-
>  tests/ref/fate/filter-pixfmts-lut | 5 +++++
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c
> index 11c039ead7..26f2945c84 100644
> --- a/libavfilter/vf_lut.c
> +++ b/libavfilter/vf_lut.c
> @@ -135,9 +135,13 @@ static av_cold void uninit(AVFilterContext *ctx)
>      AV_PIX_FMT_GBRP16LE,     AV_PIX_FMT_GBRAP12LE,    \
>      AV_PIX_FMT_GBRAP16LE
>  
> +#define GRAY_FORMATS                            \
> +    AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9LE, AV_PIX_FMT_GRAY10LE, \
> +    AV_PIX_FMT_GRAY12LE, AV_PIX_FMT_GRAY16LE
> +
>  static const enum AVPixelFormat yuv_pix_fmts[] = { YUV_FORMATS, AV_PIX_FMT_NONE };
>  static const enum AVPixelFormat rgb_pix_fmts[] = { RGB_FORMATS, AV_PIX_FMT_NONE };
> -static const enum AVPixelFormat all_pix_fmts[] = { RGB_FORMATS, YUV_FORMATS, AV_PIX_FMT_NONE };
> +static const enum AVPixelFormat all_pix_fmts[] = { RGB_FORMATS, YUV_FORMATS, GRAY_FORMATS, AV_PIX_FMT_NONE };
>  
>  static int query_formats(AVFilterContext *ctx)
>  {
> diff --git a/tests/ref/fate/filter-pixfmts-lut b/tests/ref/fate/filter-pixfmts-lut
> index db3fd417b7..6cf798ad77 100644
> --- a/tests/ref/fate/filter-pixfmts-lut
> +++ b/tests/ref/fate/filter-pixfmts-lut
> @@ -12,6 +12,11 @@ gbrp12le            c5a4b89571f7095eb737ad9fd6b1ee08
>  gbrp14le            bdfdfd6f36c60497d1cdae791f3cc117
>  gbrp16le            df095ef3a20995935cfcaf144afc68b6
>  gbrp9le             a8c4e29f4cb627db81ba053e0853e702
> +gray                20b14b5e26cd11300ed1249e04082170
> +gray10le            8f4140b55e847cc423002b89666db5ea
> +gray12le            ea89c02f6b3af49ddaf13364ed33d86d
> +gray16le            aa10599924fb2440fa12b76e90f57dcb
> +gray9le             7d9cc9ad6118674c547a54281d10cf05
>  rgb24               a356171207723a580e7d277078072005
>  rgb48le             5c7dd8575836d18c91e09f1915cf9aa9
>  rgba                7bc854c2698b78af3e9159a19c2d9d21
> 

Yeah, LGTM.
diff mbox

Patch

diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c
index 11c039ead7..26f2945c84 100644
--- a/libavfilter/vf_lut.c
+++ b/libavfilter/vf_lut.c
@@ -135,9 +135,13 @@  static av_cold void uninit(AVFilterContext *ctx)
     AV_PIX_FMT_GBRP16LE,     AV_PIX_FMT_GBRAP12LE,    \
     AV_PIX_FMT_GBRAP16LE
 
+#define GRAY_FORMATS                            \
+    AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9LE, AV_PIX_FMT_GRAY10LE, \
+    AV_PIX_FMT_GRAY12LE, AV_PIX_FMT_GRAY16LE
+
 static const enum AVPixelFormat yuv_pix_fmts[] = { YUV_FORMATS, AV_PIX_FMT_NONE };
 static const enum AVPixelFormat rgb_pix_fmts[] = { RGB_FORMATS, AV_PIX_FMT_NONE };
-static const enum AVPixelFormat all_pix_fmts[] = { RGB_FORMATS, YUV_FORMATS, AV_PIX_FMT_NONE };
+static const enum AVPixelFormat all_pix_fmts[] = { RGB_FORMATS, YUV_FORMATS, GRAY_FORMATS, AV_PIX_FMT_NONE };
 
 static int query_formats(AVFilterContext *ctx)
 {
diff --git a/tests/ref/fate/filter-pixfmts-lut b/tests/ref/fate/filter-pixfmts-lut
index db3fd417b7..6cf798ad77 100644
--- a/tests/ref/fate/filter-pixfmts-lut
+++ b/tests/ref/fate/filter-pixfmts-lut
@@ -12,6 +12,11 @@  gbrp12le            c5a4b89571f7095eb737ad9fd6b1ee08
 gbrp14le            bdfdfd6f36c60497d1cdae791f3cc117
 gbrp16le            df095ef3a20995935cfcaf144afc68b6
 gbrp9le             a8c4e29f4cb627db81ba053e0853e702
+gray                20b14b5e26cd11300ed1249e04082170
+gray10le            8f4140b55e847cc423002b89666db5ea
+gray12le            ea89c02f6b3af49ddaf13364ed33d86d
+gray16le            aa10599924fb2440fa12b76e90f57dcb
+gray9le             7d9cc9ad6118674c547a54281d10cf05
 rgb24               a356171207723a580e7d277078072005
 rgb48le             5c7dd8575836d18c91e09f1915cf9aa9
 rgba                7bc854c2698b78af3e9159a19c2d9d21