[FFmpeg-devel,21/24] avfilter/vf_blackdetect: use color_range from inlink

Submitted by Paul B Mahol on May 1, 2018, 7:40 p.m.

Details

Message ID 20180501194013.9552-21-onemda@gmail.com
State New
Headers show

Commit Message

Paul B Mahol May 1, 2018, 7:40 p.m.
Remove YUVJ pixel format usage.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavfilter/vf_blackdetect.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavfilter/vf_blackdetect.c b/libavfilter/vf_blackdetect.c
index 06ef9988d1..ff4b9eebb9 100644
--- a/libavfilter/vf_blackdetect.c
+++ b/libavfilter/vf_blackdetect.c
@@ -61,13 +61,6 @@  static const AVOption blackdetect_options[] = {
 
 AVFILTER_DEFINE_CLASS(blackdetect);
 
-#define YUVJ_FORMATS \
-    AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P
-
-static const enum AVPixelFormat yuvj_formats[] = {
-    YUVJ_FORMATS, AV_PIX_FMT_NONE
-};
-
 static int query_formats(AVFilterContext *ctx)
 {
     static const enum AVPixelFormat pix_fmts[] = {
@@ -76,7 +69,6 @@  static int query_formats(AVFilterContext *ctx)
         AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P,
         AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P,
         AV_PIX_FMT_NV12, AV_PIX_FMT_NV21,
-        YUVJ_FORMATS,
         AV_PIX_FMT_NONE
     };
 
@@ -94,7 +86,7 @@  static int config_input(AVFilterLink *inlink)
     blackdetect->black_min_duration =
         blackdetect->black_min_duration_time / av_q2d(inlink->time_base);
 
-    blackdetect->pixel_black_th_i = ff_fmt_is_in(inlink->format, yuvj_formats) ?
+    blackdetect->pixel_black_th_i = inlink->color_range == AVCOL_RANGE_JPEG ?
         // luminance_minimum_value + pixel_black_th * luminance_range_size
              blackdetect->pixel_black_th *  255 :
         16 + blackdetect->pixel_black_th * (235 - 16);