From patchwork Thu Aug 8 20:52:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: velocityra@gmail.com X-Patchwork-Id: 14333 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 780F044A056 for ; Thu, 8 Aug 2019 23:55:45 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6057068ABF3; Thu, 8 Aug 2019 23:55:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A7BDB68ABBA for ; Thu, 8 Aug 2019 23:55:40 +0300 (EEST) Received: by mail-wr1-f50.google.com with SMTP id t16so6104368wra.6 for ; Thu, 08 Aug 2019 13:55:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zMZi7pksRZLOUFqEby2VIl40D0f9Qn0wqrP2P9JGCX8=; b=cadWsOkCk07LvdRURBVDCG7WZW306CKPf4IN8IeJ2E4D6zQYCudu0t4ul0hRjI0SGm fEQRLZiyNm8aGM451OWY8H8fFPyxaM4hqBdVb/ZEDDM3Z1Njg41TpwGpOvnmKHMvOEeo 6VV4NHqygC8vRtYMkouPsBywrP4boQHrEW6D8pcKqiDBPli9Y/UrWlUst7X9E33u1mna RQuHysI5D2jeSNRjT4HIHechFZu+TFbpcTaevedL4kQSLLYOu3cI3nAYCKpYI926emI+ K+zzs3MWB7jd9unKdaSt15JCTRH9qtxe7FCOROJirrAIfgYPgy+w3VopLPbkzR6jDmKR oI3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zMZi7pksRZLOUFqEby2VIl40D0f9Qn0wqrP2P9JGCX8=; b=oYoJ4lDUtpOjzDeye6lSvYaoCDbeVhSZ+cfX/I9ItPXyzu360SJuXfVDfxHX0C/PBK kVi+C9t6NDCWhhAiIaVCxssulNBN3jDKwqfweFbWdKxPwh+ZsP1ZwprtLktQ/gEhM2EX axtsr9iCTQgvAWAlwlU104CHmY4n23m4pRqG5hzdL2JkQLm5/JORhNF5kMZMhE905BgA MZSAJdujwAvJm9o6RpIWeebZ/F7RZKyOhfAOKrLs5h+EaV5SWVfswZ9OZVLdkVwaLh7e RbILSGheyL2raMAxOWx65L2g/V1mCNYoLTJAFaXnt+y0Bjqi2Ari0/4iavCsAH1OJSYu zQgQ== X-Gm-Message-State: APjAAAUHF4TMzhKAVsO2x0lhrQlXuTb8D9ltopF/pYqrwiCo4s7IjrSH NYk19bOQx4PpEcVz4OzhEkalAbagd3Q= X-Google-Smtp-Source: APXvYqxIwdLLUPossoqwuWWvghkCOKtmxx2I3pzIDv3UenhU253X2H/V+ZN0WsIhqILNGG3Nma6zPw== X-Received: by 2002:adf:da4d:: with SMTP id r13mr20210674wrl.281.1565297739800; Thu, 08 Aug 2019 13:55:39 -0700 (PDT) Received: from localhost.localdomain ([2a02:587:2409:5200:1de8:6b2e:8289:ee0e]) by smtp.gmail.com with ESMTPSA id g25sm3446686wmk.18.2019.08.08.13.55.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Aug 2019 13:55:39 -0700 (PDT) From: velocityra@gmail.com X-Google-Original-From: velocityra@gmail To: ffmpeg-devel@ffmpeg.org Date: Thu, 8 Aug 2019 23:52:33 +0300 Message-Id: <20190808205233.16368-14-velocityra@gmail.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20190808205233.16368-1-velocityra@gmail.com> References: <20190808205233.16368-1-velocityra@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v11 14/14] lavc/tiff: Initialize WhiteLevel DNG tag value 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 Cc: Nick Renieris Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Nick Renieris Inited to (2^BitsPerSample)-1 as per the DNG Specification This fixes decoding for "X7 CinemaDNG" samples here: - https://www.dji.com/gr/zenmuse-x7/info#downloads Signed-off-by: Nick Renieris --- libavcodec/tiff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 47140cddbc..47f2a5a441 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -1787,7 +1787,7 @@ again: s->photometric = TIFF_PHOTOMETRIC_NONE; s->compr = TIFF_RAW; s->fill_order = 0; - s->white_level = 0; + s->white_level = (1 << s->bpp) - 1; /* Default value as per the spec */ s->is_bayer = 0; s->is_tiled = 0; s->is_jpeg = 0; @@ -2044,7 +2044,7 @@ again: FFSWAP(int, p->linesize[0], p->linesize[1]); } - if (s->is_bayer && s->white_level && s->bpp == 16 && + if (s->is_bayer && (s->white_level != (1 << s->bpp) - 1) && s->bpp == 16 && !(s->tiff_type == TIFF_TYPE_DNG || s->tiff_type == TIFF_TYPE_CINEMADNG)) { uint16_t *dst = (uint16_t *)p->data[0]; for (i = 0; i < s->height; i++) {