From patchwork Sat Jan 27 03:51:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhong Li X-Patchwork-Id: 7425 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.156.27 with SMTP id q27csp1456268jak; Fri, 26 Jan 2018 19:53:53 -0800 (PST) X-Google-Smtp-Source: AH8x227f4Y3K9gO2dRw4Mo3e+1g4rz7p6Pj0znn9J9jRqUib3o66t+VHxSxhI71WDPofn7N25PT6 X-Received: by 10.223.145.9 with SMTP id j9mr13221205wrj.128.1517025233760; Fri, 26 Jan 2018 19:53:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517025233; cv=none; d=google.com; s=arc-20160816; b=Bea/3GbqZxfS1mGUKe0tkMDqo+IsuO9Z0WN6FgsZ7IL7CsgFiEZu4CnJWZ4snoS/d1 6fNjdLK3stTKsKitJNSx61nFW3VJY57KklqRmeByTFP/gq//Af8NfGCORyrhb/6jVm7B L9JN9m6kYnyzGx0/d2UqH4L3A80xlgwJSoy6VN4wz4aTmf4mvfz5WJNeG1aIEjEkpeHg PfCWGAAbrH+RNDFE9BCd2g7oW8895wANLAqaF2Hiqc+VCUXpXwEa2/DUoQD2RQ0g4+HK 8H/jAJzkBWT0xZ+qEyhUahGjr5/szsKirOKco/mS0BR8s9Axf+nrlQLm+qFWnMubdCV7 lByA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=8qYokhE2x+MA2GSnxUkCtS7YKmXzJSoId1evXLNxRFE=; b=PXTwBIOibG0CbubgHJDSi4s0i/cUWXPSr+Vp8t4vZ9tbnU6KBjjHS2mptY3YQPjVS2 azQEgQxAbpqZdVBGvs2ehDzRx7xED1/LINwi58ogQdXloGQFet1D+Dpdi7O1+eUFaIzy sUJwjBZir+JhjIi/ytYec5/cyhmOVqsX+Z5ipbCmYXnl+sGODhPMp+YRiRysX0WBJ+f6 8qZP9rK0wuEuKGhde/ABb1Sb8l1NW4V6SjSQB3VlvrjZ23vTJbobtywWnNzRSKdw/tCV gJ1PXidlukN03Md5ll8F8nchv5xAxii7N2g2xR/oBiePCUgMIVfZZmgKF7X2c9r/IjwM eqXw== ARC-Authentication-Results: i=1; mx.google.com; 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 s10si6567333wrs.372.2018.01.26.19.53.52; Fri, 26 Jan 2018 19:53:53 -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; 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 84511680475; Sat, 27 Jan 2018 05:53:47 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E0D70680475 for ; Sat, 27 Jan 2018 05:53:39 +0200 (EET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jan 2018 19:53:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,420,1511856000"; d="scan'208";a="22892925" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.239.13.18]) by FMSMGA003.fm.intel.com with ESMTP; 26 Jan 2018 19:53:39 -0800 From: Zhong Li To: ffmpeg-devel@ffmpeg.org Date: Sat, 27 Jan 2018 11:51:54 +0800 Message-Id: <1517025114-20080-1-git-send-email-zhong.li@intel.com> X-Mailer: git-send-email 1.8.3.1 Subject: [FFmpeg-devel] [PATCH V3] lavc: Don't overwrite previously setup dimensions for all codecs 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: Zhong Li MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Currently a hacky way is used for some specific codecs such as H264/VP6F/DXV. Replace with a more generic way(an evolution based on a libav commit 9de9b828 but hasn't been merged since it breaks lowres). Verified it won't introduce regression of original ticket #1386 fixing. V2: add "lowres" handle code V3: fix the typo Signed-off-by: Zhong Li --- libavcodec/utils.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 4c71843..8fe20d9 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -684,16 +684,12 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code goto free_and_end; } - // only call ff_set_dimensions() for non H.264/VP6F/DXV codecs so as not to overwrite previously setup dimensions - if (!(avctx->coded_width && avctx->coded_height && avctx->width && avctx->height && - (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_VP6F || avctx->codec_id == AV_CODEC_ID_DXV))) { - if (avctx->coded_width && avctx->coded_height) + if (avctx->coded_width && avctx->coded_height && (!avctx->width && !avctx->height || avctx->lowres)) ret = ff_set_dimensions(avctx, avctx->coded_width, avctx->coded_height); - else if (avctx->width && avctx->height) + else if (avctx->width && avctx->height && (!avctx->coded_width && !avctx->coded_height || avctx->lowres)) ret = ff_set_dimensions(avctx, avctx->width, avctx->height); if (ret < 0) goto free_and_end; - } if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height) && ( av_image_check_size2(avctx->coded_width, avctx->coded_height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0