[FFmpeg-devel,3/3] lavf/f_select: make the more pixel format usable to avoid autoscale to rgb

Submitted by lance.lmwang@gmail.com on July 15, 2019, 10:53 p.m.

Details

Message ID 1563231238-20966-3-git-send-email-lance.lmwang@gmail.com
State New
Headers show

Commit Message

lance.lmwang@gmail.com July 15, 2019, 10:53 p.m.
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavfilter/f_select.c                     |  6 ++++++
 tests/ref/fate/filter-metadata-scenedetect | 16 ++++++++--------
 2 files changed, 14 insertions(+), 8 deletions(-)

Comments

Paul B Mahol July 16, 2019, 7:49 a.m.
Please nobody commit this, unless it is tested with every mentioned
pixel format.

On 7/16/19, lance.lmwang@gmail.com <lance.lmwang@gmail.com> wrote:
> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  libavfilter/f_select.c                     |  6 ++++++
>  tests/ref/fate/filter-metadata-scenedetect | 16 ++++++++--------
>  2 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
> index eed8df3..35aed3f 100644
> --- a/libavfilter/f_select.c
> +++ b/libavfilter/f_select.c
> @@ -499,6 +499,12 @@ static int query_formats(AVFilterContext *ctx)
>          int ret;
>          static const enum AVPixelFormat pix_fmts[] = {
>              AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
> +            AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_RGBA,
> +            AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8,
> +            AV_PIX_FMT_GRAY16, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P10,
> +            AV_PIX_FMT_YUYV422, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P10,
> +            AV_PIX_FMT_NV12, AV_PIX_FMT_NV21, AV_PIX_FMT_P010,
> +            AV_PIX_FMT_P016, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P,
>              AV_PIX_FMT_NONE
>          };
>          AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
> diff --git a/tests/ref/fate/filter-metadata-scenedetect
> b/tests/ref/fate/filter-metadata-scenedetect
> index 67c23b3..7ce2d67 100644
> --- a/tests/ref/fate/filter-metadata-scenedetect
> +++ b/tests/ref/fate/filter-metadata-scenedetect
> @@ -1,11 +1,11 @@
>  pkt_pts=1620|tag:lavfi.scene_score=1.000000
> -pkt_pts=4140|tag:lavfi.scene_score=0.875036
> -pkt_pts=5800|tag:lavfi.scene_score=1.000000
> -pkt_pts=6720|tag:lavfi.scene_score=0.461625
> -pkt_pts=8160|tag:lavfi.scene_score=1.000000
> -pkt_pts=9760|tag:lavfi.scene_score=1.000000
> -pkt_pts=14080|tag:lavfi.scene_score=0.838916
> +pkt_pts=4140|tag:lavfi.scene_score=0.668643
> +pkt_pts=5800|tag:lavfi.scene_score=0.996721
> +pkt_pts=6720|tag:lavfi.scene_score=0.357390
> +pkt_pts=8160|tag:lavfi.scene_score=0.886268
> +pkt_pts=9760|tag:lavfi.scene_score=0.926219
> +pkt_pts=14080|tag:lavfi.scene_score=0.650033
>  pkt_pts=15700|tag:lavfi.scene_score=1.000000
> -pkt_pts=18500|tag:lavfi.scene_score=0.474948
> -pkt_pts=20040|tag:lavfi.scene_score=0.379700
> +pkt_pts=18500|tag:lavfi.scene_score=0.316402
> +pkt_pts=20040|tag:lavfi.scene_score=0.269509
>  pkt_pts=21760|tag:lavfi.scene_score=1.000000
> --
> 2.6.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 July 16, 2019, 10:59 p.m.
On Tue, 16 Jul 2019, lance.lmwang@gmail.com wrote:

> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> libavfilter/f_select.c                     |  6 ++++++
> tests/ref/fate/filter-metadata-scenedetect | 16 ++++++++--------
> 2 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
> index eed8df3..35aed3f 100644
> --- a/libavfilter/f_select.c
> +++ b/libavfilter/f_select.c
> @@ -499,6 +499,12 @@ static int query_formats(AVFilterContext *ctx)
>         int ret;
>         static const enum AVPixelFormat pix_fmts[] = {
>             AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
> +            AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_RGBA,
> +            AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8,
> +            AV_PIX_FMT_GRAY16, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P10,
> +            AV_PIX_FMT_YUYV422, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P10,
> +            AV_PIX_FMT_NV12, AV_PIX_FMT_NV21, AV_PIX_FMT_P010,
> +            AV_PIX_FMT_P016, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P,

AV_PIX_FMT_P010 is tricky, because in this format data is in the high 
bits. So scores should be normalized as if it would be 16 bit.

Regards,
Marton

>             AV_PIX_FMT_NONE
>         };
>         AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
> diff --git a/tests/ref/fate/filter-metadata-scenedetect b/tests/ref/fate/filter-metadata-scenedetect
> index 67c23b3..7ce2d67 100644
> --- a/tests/ref/fate/filter-metadata-scenedetect
> +++ b/tests/ref/fate/filter-metadata-scenedetect
> @@ -1,11 +1,11 @@
> pkt_pts=1620|tag:lavfi.scene_score=1.000000
> -pkt_pts=4140|tag:lavfi.scene_score=0.875036
> -pkt_pts=5800|tag:lavfi.scene_score=1.000000
> -pkt_pts=6720|tag:lavfi.scene_score=0.461625
> -pkt_pts=8160|tag:lavfi.scene_score=1.000000
> -pkt_pts=9760|tag:lavfi.scene_score=1.000000
> -pkt_pts=14080|tag:lavfi.scene_score=0.838916
> +pkt_pts=4140|tag:lavfi.scene_score=0.668643
> +pkt_pts=5800|tag:lavfi.scene_score=0.996721
> +pkt_pts=6720|tag:lavfi.scene_score=0.357390
> +pkt_pts=8160|tag:lavfi.scene_score=0.886268
> +pkt_pts=9760|tag:lavfi.scene_score=0.926219
> +pkt_pts=14080|tag:lavfi.scene_score=0.650033
> pkt_pts=15700|tag:lavfi.scene_score=1.000000
> -pkt_pts=18500|tag:lavfi.scene_score=0.474948
> -pkt_pts=20040|tag:lavfi.scene_score=0.379700
> +pkt_pts=18500|tag:lavfi.scene_score=0.316402
> +pkt_pts=20040|tag:lavfi.scene_score=0.269509
> pkt_pts=21760|tag:lavfi.scene_score=1.000000
> -- 
> 2.6.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".

Patch hide | download patch | download mbox

diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
index eed8df3..35aed3f 100644
--- a/libavfilter/f_select.c
+++ b/libavfilter/f_select.c
@@ -499,6 +499,12 @@  static int query_formats(AVFilterContext *ctx)
         int ret;
         static const enum AVPixelFormat pix_fmts[] = {
             AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
+            AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_RGBA,
+            AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8,
+            AV_PIX_FMT_GRAY16, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P10,
+            AV_PIX_FMT_YUYV422, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P10,
+            AV_PIX_FMT_NV12, AV_PIX_FMT_NV21, AV_PIX_FMT_P010,
+            AV_PIX_FMT_P016, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P,
             AV_PIX_FMT_NONE
         };
         AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
diff --git a/tests/ref/fate/filter-metadata-scenedetect b/tests/ref/fate/filter-metadata-scenedetect
index 67c23b3..7ce2d67 100644
--- a/tests/ref/fate/filter-metadata-scenedetect
+++ b/tests/ref/fate/filter-metadata-scenedetect
@@ -1,11 +1,11 @@ 
 pkt_pts=1620|tag:lavfi.scene_score=1.000000
-pkt_pts=4140|tag:lavfi.scene_score=0.875036
-pkt_pts=5800|tag:lavfi.scene_score=1.000000
-pkt_pts=6720|tag:lavfi.scene_score=0.461625
-pkt_pts=8160|tag:lavfi.scene_score=1.000000
-pkt_pts=9760|tag:lavfi.scene_score=1.000000
-pkt_pts=14080|tag:lavfi.scene_score=0.838916
+pkt_pts=4140|tag:lavfi.scene_score=0.668643
+pkt_pts=5800|tag:lavfi.scene_score=0.996721
+pkt_pts=6720|tag:lavfi.scene_score=0.357390
+pkt_pts=8160|tag:lavfi.scene_score=0.886268
+pkt_pts=9760|tag:lavfi.scene_score=0.926219
+pkt_pts=14080|tag:lavfi.scene_score=0.650033
 pkt_pts=15700|tag:lavfi.scene_score=1.000000
-pkt_pts=18500|tag:lavfi.scene_score=0.474948
-pkt_pts=20040|tag:lavfi.scene_score=0.379700
+pkt_pts=18500|tag:lavfi.scene_score=0.316402
+pkt_pts=20040|tag:lavfi.scene_score=0.269509
 pkt_pts=21760|tag:lavfi.scene_score=1.000000