From patchwork Thu Dec 10 12:27:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Mallon X-Patchwork-Id: 24516 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 2E21A44A7BE for ; Thu, 10 Dec 2020 14:34:23 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 057E9689C68; Thu, 10 Dec 2020 14:34:23 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 92F0A688134 for ; Thu, 10 Dec 2020 14:34:16 +0200 (EET) Received: by mail-ej1-f54.google.com with SMTP id b9so7114878ejy.0 for ; Thu, 10 Dec 2020 04:34:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codex.online; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Aj9QAoWdNn2lziUwAh0/DKAV17sH36yKjhM9QpGL8lU=; b=VpMoy6cChnDusGmIKCP2VC4Ra6r1pAx/jCUGpWhffLGpfbIBoyffXA72wrrsOC59id OzquWzTXu9f4KfoIVGzefqajraagriYegvPEVbrs1A637NrRSuGC92W0wwx50+o4eemy +Byclqc9BHbTmTWENV62KXQ9MRPNRoYxJAcX4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Aj9QAoWdNn2lziUwAh0/DKAV17sH36yKjhM9QpGL8lU=; b=WXbuSDsNYBbd9Pd9q/vFmPe186E3X3eMkYT+lo/gefKNpLEAGcMYzqizrwF8tYd+wj VOqhSnXHKrjIihLfcKWu0LTxBxZfuIDE8eqXF14M6fLMNQyjMV+PHdv2IGjB8ug9ijp7 rvqC3AK8YVWFgTMeo5KoC4/5fXlS9bX9hyFdTEsKmgYej0vdrDTb0OaLb2+cYolNj9p7 ImhqDYZszc4lDzoSWGCcMT+x/o3gB/5wOMehLQaVgANhdQLFj6ktzAiuF+ucY+VaeXAg R97aiiXFmxhsd6axXGIoasDy2C4Bl4Yoe+mEqJrelTrM9sFrkcXBpZFz53Nf1lS/hHhj eiKQ== X-Gm-Message-State: AOAM532Df1h3+mWOAHuACI/eUsbG5eM3cltZOYTG3P0qOq4KkO4EflR+ 2wUYv3t7pDx/2BZzd7KqyHYCLeJgdPCDCoqG X-Google-Smtp-Source: ABdhPJzmLQ2SCBQ7JP4WnOePY7bqX/TAvDeA/pQQsygETNxJo97CkG/TQoArxuW08ZGUTCDpu2VyUw== X-Received: by 2002:adf:c702:: with SMTP id k2mr8169872wrg.156.1607603249452; Thu, 10 Dec 2020 04:27:29 -0800 (PST) Received: from localhost ([66.159.216.147]) by smtp.gmail.com with ESMTPSA id p9sm3803190wmm.17.2020.12.10.04.27.28 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Dec 2020 04:27:28 -0800 (PST) From: Harry Mallon To: ffmpeg-devel@ffmpeg.org Date: Thu, 10 Dec 2020 12:27:18 +0000 Message-Id: <20201210122718.74374-6-harry.mallon@codex.online> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201210122718.74374-1-harry.mallon@codex.online> References: <20201207103214.75790-1-harry.mallon@codex.online> <20201210122718.74374-1-harry.mallon@codex.online> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 6/6] avcodec/dpx: Fix B&W film scans from Lasergraphics Inc 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Harry Mallon --- libavcodec/dpx.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c index 7b18141f97..bd431ccbcb 100644 --- a/libavcodec/dpx.c +++ b/libavcodec/dpx.c @@ -167,7 +167,7 @@ static int decode_frame(AVCodecContext *avctx, int x, y, stride, i, j, ret; int w, h, bits_per_color, descriptor, elements, packing; int yuv, color_trc, color_spec; - int encoding, need_align = 0; + int encoding, need_align = 0, unpadded_10bit = 0; unsigned int rgbBuffer = 0; int n_datum = 0; @@ -574,6 +574,12 @@ static int decode_frame(AVCodecContext *avctx, input_device[32] = '\0'; av_dict_set(&p->metadata, "Input Device", input_device, 0); + // Some devices do not pad 10bit samples to whole 32bit words per row + if (!memcmp(input_device, "Scanity", 7) || + !memcmp(creator, "Lasergraphics Inc.", 18)) { + unpadded_10bit = 1; + } + // Move pointer to offset from start of file buf = avpkt->data + offset; @@ -606,7 +612,7 @@ static int decode_frame(AVCodecContext *avctx, read10in32(&buf, &rgbBuffer, &n_datum, endian, shift); } - if (memcmp(input_device, "Scanity", 7)) + if (!unpadded_10bit) n_datum = 0; for (i = 0; i < elements; i++) ptr[i] += p->linesize[i];