From patchwork Fri Sep 16 13:20:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vittorio Giovara X-Patchwork-Id: 602 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.134 with SMTP id o128csp457733vsd; Fri, 16 Sep 2016 06:21:05 -0700 (PDT) X-Received: by 10.28.107.22 with SMTP id g22mr7664240wmc.31.1474032065363; Fri, 16 Sep 2016 06:21:05 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ls3si8242043wjb.22.2016.09.16.06.21.04; Fri, 16 Sep 2016 06:21:05 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3359668A0D0; Fri, 16 Sep 2016 16:20:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk0-f195.google.com (mail-qk0-f195.google.com [209.85.220.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F2A0568A082 for ; Fri, 16 Sep 2016 16:20:41 +0300 (EEST) Received: by mail-qk0-f195.google.com with SMTP id z143so5448556qka.3 for ; Fri, 16 Sep 2016 06:20:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=Jg2ocn/knaR897R5+in+KvBZmMczO/qBwLss1vLjnLI=; b=zZ+HxWEaquwRFTmzjkW0DVAzbTA7GbISuSEZQsSuw9hfPcAvZnUPlqf4sF+/QKJmRP eM6hFsRJvW/sFNflO+RyZm+Se5IylM2Y06JA6kmTAq+5D2mPj12z55e/XYt9BTrSsig1 L1mBmSDbGXv+uO206B6KpQbURRrSy9cAA1ypoRZG+G4G16yWpgJsRVQIXLWdmu15pD/5 +RVbv0JcNIu50+IJkgQit8GsFEwvICgI2q+CjXZVT+JaxWB63O785JqOHqB6NL8rxi3y 1QSp0OCqD6E5QNngV1fIrPMLrftmjqAeZV8q1E8yjNqqKjsgDo4NGSJskPY88JmvIRs9 qRbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Jg2ocn/knaR897R5+in+KvBZmMczO/qBwLss1vLjnLI=; b=ahaUhYuLJnhX+TBqV9UgTWucEnEshM0ilBDUBWO+v3Ouy7wOHqmMdENedQGIco0o5l TXdbAps9dbWKONAf5uWzdOLcf800/Gmo2VC8L6sVKS9JSmRb7ODbWcqkg6OKAWQqwJpk ZoVBvlwQbt1Ys9MfWrigxr10Q6lL7dzdLRTGWf11rEX45GVJmIg+JsksPuwrNqp2NXjO FsHvVKDtGS3SWy3tn5n8ZlVCCqaGLViG9fjLugxZyq30zpKN+fExx5KlyIQ7V7ElStQ4 4lYqrYuoCU4NKxIljwu4/MuLkbV8YjaP3pvSlvtP1rv8JWVMGQ0VrLJEYwzhAwUYNPMy MMdw== X-Gm-Message-State: AE9vXwP6DYJjfdQGpylgY49hWh+NftMldaMXrrDEczH/QKePgXMxudFca4CVSHs6wnvvBA== X-Received: by 10.55.65.139 with SMTP id o133mr14709129qka.191.1474032054003; Fri, 16 Sep 2016 06:20:54 -0700 (PDT) Received: from vimacbookpro.iac.corp (93-33-58-241.ip43.fastwebnet.it. [93.33.58.241]) by smtp.gmail.com with ESMTPSA id 35sm4679051qtn.35.2016.09.16.06.20.51 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 16 Sep 2016 06:20:51 -0700 (PDT) From: Vittorio Giovara To: ffmpeg-devel@ffmpeg.org Date: Fri, 16 Sep 2016 15:20:49 +0200 Message-Id: <20160916132049.26957-1-vittorio.giovara@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <1063D6AF-EAF2-435C-8295-AD5F2EDC47BF@gmail.com> References: <1063D6AF-EAF2-435C-8295-AD5F2EDC47BF@gmail.com> Subject: [FFmpeg-devel] [PATCHv2] vf_colorspace: Interpret unspecified color range as limited range X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This is the assumption that is made in pixel format conversion do throughout the code (in particular swscale), and BT-specifications mandate. Add a warning to inform the user that an automatic selection is being made. Signed-off-by: Vittorio Giovara --- libavfilter/vf_colorspace.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c index e69be50..41d1692 100644 --- a/libavfilter/vf_colorspace.c +++ b/libavfilter/vf_colorspace.c @@ -518,10 +518,13 @@ static int convert(AVFilterContext *ctx, void *data, int job_nr, int n_jobs) return 0; } -static int get_range_off(int *off, int *y_rng, int *uv_rng, +static int get_range_off(AVFilterContext *ctx, int *off, + int *y_rng, int *uv_rng, enum AVColorRange rng, int depth) { switch (rng) { + case AVCOL_RANGE_UNSPECIFIED: + av_log(ctx, AV_LOG_WARNING, "Input range not set, assuming tv/mpeg\n"); case AVCOL_RANGE_MPEG: *off = 16 << (depth - 8); *y_rng = 219 << (depth - 8); @@ -740,7 +743,7 @@ static int create_filtergraph(AVFilterContext *ctx, double rgb2yuv[3][3], (*yuv2rgb)[3] = s->yuv2rgb_dbl_coeffs; int off, bits, in_rng; - res = get_range_off(&off, &s->in_y_rng, &s->in_uv_rng, + res = get_range_off(ctx, &off, &s->in_y_rng, &s->in_uv_rng, s->in_rng, in_desc->comp[0].depth); if (res < 0) { av_log(ctx, AV_LOG_ERROR, @@ -773,7 +776,7 @@ static int create_filtergraph(AVFilterContext *ctx, double (*rgb2yuv)[3] = s->rgb2yuv_dbl_coeffs; int off, out_rng, bits; - res = get_range_off(&off, &s->out_y_rng, &s->out_uv_rng, + res = get_range_off(ctx, &off, &s->out_y_rng, &s->out_uv_rng, s->out_rng, out_desc->comp[0].depth); if (res < 0) { av_log(ctx, AV_LOG_ERROR,