From patchwork Thu Oct 10 00:05:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Skakov Pavel X-Patchwork-Id: 15643 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 E390544A01E for ; Thu, 10 Oct 2019 03:05:20 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C553768812E; Thu, 10 Oct 2019 03:05:20 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E1524680B4C for ; Thu, 10 Oct 2019 03:05:13 +0300 (EEST) Received: by mail-lf1-f46.google.com with SMTP id u3so2951974lfl.10 for ; Wed, 09 Oct 2019 17:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:message-id:date:user-agent:mime-version :content-language; bh=ZatnjvmjyJMDRlpNxZEHCnMshf8FKzfO0+fEQ1Y7NBs=; b=aK2tur3TwDg79xG7/RHs/0PR0legNbVcupOy6XKpEtQzlX0Fh74U195N5AZRZ6oiR2 5zeL4rHcOx54Hkf15tl3CacyQ2QZD3dQfUHSTCuL6FnOJHql97fJBXQ9jd9LOPvcmjE/ +qvpGOBJtWMidybJCHhKYa4lgwPG2xW6Pmby9hRaP5Ly3hbojdbTy0G4n1sU0vKv2Kro FJeM2Hz/OUYPOg8T4P3bJyBGc5U4UEkMRDDs657SxDKTsv+bqDftpYifV4ucGS+k5MA5 sZ7fHrm593GMDE1THlyQkDQtCGfm3s6m3/HiGjinkMqs1GQz5lnKG0uItKoh4GW4S2hC NDeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:message-id:date:user-agent :mime-version:content-language; bh=ZatnjvmjyJMDRlpNxZEHCnMshf8FKzfO0+fEQ1Y7NBs=; b=VbGObb7k+qvURJho0npN3r4LSjgen/UyfWFIxJ8jrn/psIBN7KfqN1vZyWSleNg5GW PAW8dJKJ8AhFeh9hgg9nFYoiQVxYZgZEVuYHHrJmybVcWCpCd2H3opoJsvBwGCWXr6Qe 60yk6ckbOJeU5oCnuAHBmzJ+9SwvtI5SuzTHqNjTRxvfd/25A1hRCyZF0oJpNPh5tkXW W2rMOoOR/GH341brIddOuIqsgICtnWIWuNSBIbdk0CzV7J3mU+AU2H4J9gxscd/L5beX xfW0iKIN5NHL8UqXnzL9UFbGdbQeKtYWIwJhfLQJxWCmLNP7QkI6iK+uo1D+0nXJ2Oti r0Yg== X-Gm-Message-State: APjAAAVDpcC9vdtPd91uSfv1R+WJTFFUGT+9/cVPvyKFBKnvrHDHIWQ/ LuR6cw+g78rygpuMKKYMtH/F4gQw X-Google-Smtp-Source: APXvYqwLy8kv1RluwPruys4lfErBL9GMxc0+F0oBoMN6rxez/MGXCZ2Ugv4BXdqImKGrm6rpbqt1RA== X-Received: by 2002:a19:a40b:: with SMTP id q11mr3377527lfc.45.1570665912973; Wed, 09 Oct 2019 17:05:12 -0700 (PDT) Received: from [10.1.0.176] ([5.18.248.33]) by smtp.gmail.com with ESMTPSA id c21sm808565lff.61.2019.10.09.17.05.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Oct 2019 17:05:12 -0700 (PDT) From: Skakov Pavel To: FFmpeg development discussions and patches Message-ID: <5bb1e2e7-faf8-7244-b48b-9bc21842b010@gmail.com> Date: Thu, 10 Oct 2019 03:05:11 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 Content-Language: en-US Subject: [FFmpeg-devel] [PATCH v2 1/4] avcodec/tiff: correct unpacking of border YUV pixels 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" Corrected handling of border pixels when unpacking YUV. Example (bottom line): https://github.com/BitMiracle/libtiff.net/blob/master/TestCase/ycbcr-cat.tif From 09f9822d8d38f26ff386df3d01794fcafe3f3869 Mon Sep 17 00:00:00 2001 From: Pavel Skakov Date: Thu, 10 Oct 2019 02:21:06 +0300 Subject: [PATCH 1/4] avcodec/tiff: correct unpacking of border YUV pixels Signed-off-by: Pavel Skakov --- libavcodec/tiff.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 069792b4c3..70c49f7d44 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -369,8 +369,11 @@ static void unpack_yuv(TiffContext *s, AVFrame *p, for (i = 0; i < w; i++) { for (j = 0; j < s->subsampling[1]; j++) for (k = 0; k < s->subsampling[0]; k++) - p->data[0][FFMIN(lnum + j, s->height-1) * p->linesize[0] + - FFMIN(i * s->subsampling[0] + k, s->width-1)] = *src++; + if (j < s->height - lnum && i * s->subsampling[0] + k < s->width) { + p->data[0][(lnum + j) * p->linesize[0] + i * s->subsampling[0] + k] = *src++; + } else { + src++; + } *pu++ = *src++; *pv++ = *src++; } -- 2.13.2.windows.1