From patchwork Mon Dec 7 10:32:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Mallon X-Patchwork-Id: 24431 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:c00a:0:0:0:0:0 with SMTP id c10csp2499267ybf; Mon, 7 Dec 2020 02:38:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyH5AUFeWm60S2o99ThEUiSWH40fhx+FgKqNO0Y+KWR1FR9ccWvkrYDyqOZmouXfmf7p36s X-Received: by 2002:adf:c449:: with SMTP id a9mr10299365wrg.281.1607337499248; Mon, 07 Dec 2020 02:38:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607337499; cv=none; d=google.com; s=arc-20160816; b=SajKqAJ/ZN7HJH0Q26dyPwvU5O0z6vyezQwY/8ffgIlIwjXnseyqeCnlc+jpnIDfB2 bJFRKOWjiapd6tDYcrATGvaSti6EhksGZbhgOWfM7z+lw+NRz77aFfWuLTp6JOev5GYe xCKs8dVE7ZD0kPEMfq4z8pkyhnC+agJXhsXzI3VlMFx/+9qMlfU924XYOEaFFFqYzf8e cyN46/Rfa0yhkfCWbTMpb+mcHJmseoGcT3iJ3P+gpBKZ1V8l+gSKExdmiuR6IFRLrflt o7fjW8Z3hyQNGeHG+JoTDQI+YbfbnO+P37Wj/9itxLISwOQ+lMBiTrUCJdJAYpxWAzvj OJ9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=Fq0gp5FOTacYMm0dEhfhE+H7ZTdNlAWMUoSqbJ5EMqk=; b=Wzgu87Kuv5DjULJNAGiD5UA0b8SWpxlYN9AMmKstFS5EC/+ZqZ+0YnTihFxOfKstl+ TDYdeKjC4NR5oOBy7uoWB/HWlOeJv9vCzGoZRrvchddh7v0cnfOPX0BaqgyRAVC3+jwa uCkcBLqdVmiLkvF7SKyW8I/Ir2vyst4RSJm+Vte4oFgo/Wbqo9jbHw5Sd51LedxT8FbX caTG2fh04G0MaFXDV3qPUf5GSE6RPXtgVZUsO9aSUcIk0u8CR7znhVVtNBe0lH++knf2 gowo/4pOz29Jhcd34TlmFiX1asaudRjBQKNy4TkIQTx7wgU3/s7XCD3mlbLzfkCRrw2E PABg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@codex.online header.s=google header.b=YaX6QtUH; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id s1si10446917wmj.75.2020.12.07.02.38.18; Mon, 07 Dec 2020 02:38:19 -0800 (PST) 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=@codex.online header.s=google header.b=YaX6QtUH; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 788A9689B6C; Mon, 7 Dec 2020 12:38:09 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A59AC689B33 for ; Mon, 7 Dec 2020 12:38:00 +0200 (EET) Received: by mail-wm1-f68.google.com with SMTP id c198so11076497wmd.0 for ; Mon, 07 Dec 2020 02:38:00 -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=YaX6QtUHbiqx2o+QGJdDhdHSCFpqtrqW10LWnKHEVOVSg91AOUYJwkaNeZMfRlyro/ 3SyqaHRTQvJRtdmkMMeSCeDxqO1Eh3mGDS/SvGMnIX1TYexL1/Cq6yB+iFmt7YoVDCdF UTXkK0Zj1MeuT+8KwziSCWGkcmy3ez/OnNSb0= 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=ZEQolYux0rsl646xg0k/QQZVvp/FZ0QhQfw63GZhebr5a1+YqsUKusuQA8OqK3SnMt F8odFwVDqVy1iTRYNg0tP1qksu95OAbgkefTpls1Zd4oar5SLwce+Br8nUgXFxFl9Y/t jK7ww9Sg3NpZ0rK6PgG/aqwGM/mbqs1bIXgaC2ydyJ5lbU3Qd+WNOxHyxlwDkZiZ3gVb 5+uOCHlt8hvWTmSf3yvFu+OuX7nksTq8Db3EzN50wkCOIFYL0H5AMf599B0iAYAHNkJP fkNUlAn2dmdj4opIbbpjsCdgv9z9zAwjAxjgG5xHBppf4XORcrKnms6AZOH6KL8kKBW6 qc5w== X-Gm-Message-State: AOAM530BX01UZ9BEOSOmmvY9qLOdKAJpktXgARfbtLGiJMwgYCHdJ4uS uy11S/i4MThLFRZpfFLwf9WIIsRzM/+l590r X-Received: by 2002:a1c:4e0a:: with SMTP id g10mr17741927wmh.51.1607337153152; Mon, 07 Dec 2020 02:32:33 -0800 (PST) Received: from localhost ([66.159.216.147]) by smtp.gmail.com with ESMTPSA id r13sm14168702wrs.6.2020.12.07.02.32.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Dec 2020 02:32:32 -0800 (PST) From: Harry Mallon To: ffmpeg-devel@ffmpeg.org Date: Mon, 7 Dec 2020 10:32:14 +0000 Message-Id: <20201207103214.75790-6-harry.mallon@codex.online> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201207103214.75790-1-harry.mallon@codex.online> References: <20201207103214.75790-1-harry.mallon@codex.online> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 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" X-TUID: V+kohXmzTFvS Content-Length: 2359 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];