From patchwork Thu May 9 14:37:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Roche X-Patchwork-Id: 13041 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 B5E534481DF for ; Thu, 9 May 2019 17:37:32 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 941196882B9; Thu, 9 May 2019 17:37:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E04C76804F1 for ; Thu, 9 May 2019 17:37:25 +0300 (EEST) Received: by mail-qk1-f181.google.com with SMTP id j1so1551779qkk.12 for ; Thu, 09 May 2019 07:37:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=giphy.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pc5PVz2fpHRich5+H38ywx8hcsYhzzyy6d8FF1CRAcA=; b=RM1aAQ0/2clZnScCuqdPWP57dN94p6rHLP1VmVtQxj8FmrlkHDmmqcE9DTpWP6wW/I U3FlsUNIJMj3JrFcou18dcPBAE+5KIJ3Fn72Fs9wYR6EBm9JzOisM8URpclxLpKgVxem VD0e64C31HKYXyGYd1LVp5HZmtZIWcmUipbhk= 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:mime-version :content-transfer-encoding; bh=pc5PVz2fpHRich5+H38ywx8hcsYhzzyy6d8FF1CRAcA=; b=opp28JHn2CyG+tvDsnzTEjxasdfcNjHO7IAiSXJrBJaqqh+NdlMm2j9DU/ZBfoRp/2 HxDHbrbdgZP0GKrpZekhYA4d33Vh6Y+pXN4P1+8OvOHEj6bc+I0KUenVLq2GQWwNEkIw GNfWGVO3JhLrYAQOZKh9hooivSuvuuPzKJup4H0J7X6WLuUzJVwvFiemgbz7PUGNtjIX ZoG2eW/OY62qvSn9vL8DFbrU1wNqhCvazHhSQK4EmHOVMBnnBLRTQzgMmeIwovT1Q7wy twvK5ILDLQOEYReQjMzD9M75Vz1ls1MQpB+CHtorb5DfsjZBmsUN4ytoHm/4Pk/zqG8R cBGw== X-Gm-Message-State: APjAAAUHNHSHrofbEDcyQZiR+cg9ZTpJrbHnDFZdxj1+Tyq6V9FEJ6jR AnCpL8w0nce9Lw2jT2CfjjllXEVmG/g= X-Google-Smtp-Source: APXvYqxLyEvQ2xz4/kSXkVzN/2mLiDMYRXuiy2fOlyWWZH0KJAjpiaybcElGvsq6y0Y9NXzrdTuV9Q== X-Received: by 2002:ae9:e911:: with SMTP id x17mr3713526qkf.191.1557412643967; Thu, 09 May 2019 07:37:23 -0700 (PDT) Received: from localhost.localdomain ([158.106.201.22]) by smtp.gmail.com with ESMTPSA id r6sm1141506qkm.42.2019.05.09.07.37.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 May 2019 07:37:23 -0700 (PDT) From: Bjorn Roche To: ffmpeg-devel@ffmpeg.org Date: Thu, 9 May 2019 10:37:01 -0400 Message-Id: <20190509143701.20636-1-bjorn@giphy.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] fix issues with transparent crop. (see https://trac.ffmpeg.org/ticket/7890) 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: Bjorn Roche Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Bjorn Roche --- libavcodec/gif.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/gif.c b/libavcodec/gif.c index 94c8b1af49..d7768b4426 100644 --- a/libavcodec/gif.c +++ b/libavcodec/gif.c @@ -136,7 +136,7 @@ static void gif_crop_translucent(AVCodecContext *avctx, while (*y_start < y_end) { int is_trans = 1; for (int i = 0; i < w; i++) { - if (buf[w * *y_start + i] != trans) { + if (buf[linesize * *y_start + i] != trans) { is_trans = 0; break; } @@ -148,10 +148,10 @@ static void gif_crop_translucent(AVCodecContext *avctx, } // crop bottom - while (y_end < h) { + while (y_end > *y_start) { int is_trans = 1; for (int i = 0; i < w; i++) { - if (buf[w * y_end + i] != trans) { + if (buf[linesize * y_end + i] != trans) { is_trans = 0; break; } @@ -165,7 +165,7 @@ static void gif_crop_translucent(AVCodecContext *avctx, while (*x_start < x_end) { int is_trans = 1; for (int i = *y_start; i < y_end; i++) { - if (buf[w * i + *x_start] != trans) { + if (buf[linesize * i + *x_start] != trans) { is_trans = 0; break; } @@ -176,10 +176,10 @@ static void gif_crop_translucent(AVCodecContext *avctx, } // crop right - while (x_end < w) { + while (x_end > *x_start) { int is_trans = 1; for (int i = *y_start; i < y_end; i++) { - if (buf[w * i + x_end] != trans) { + if (buf[linesize * i + x_end] != trans) { is_trans = 0; break; }