From patchwork Wed Jan 10 08:10:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhong Li X-Patchwork-Id: 7246 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.78.2 with SMTP id r2csp4892679jaa; Wed, 10 Jan 2018 00:12:03 -0800 (PST) X-Google-Smtp-Source: ACJfBosDJBUMp5uca3VdWnMkO8Syh2spR1OfKdBb49noZiIBgWQ1ekuvmTLFWx+kajnYb6G6tr5N X-Received: by 10.28.135.142 with SMTP id j136mr12892137wmd.132.1515571923748; Wed, 10 Jan 2018 00:12:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515571923; cv=none; d=google.com; s=arc-20160816; b=UCVX1Qsi95mxk70SREeAAvrDZcvcXRkE8Ppf2YyWM4waMFaXIPV06LqiA4K49AHo9D WbEPxC6nMtfm/9dsQ66WCZoirpz0gvPVYa7ASNfYQ8x2GJjKqvtvdy0vKKY+SzsXpxry zANgzvsJe4utiNtDhMrP4AEzhXo4GgPbPeDAxhy0Kd2Cts7I+i4Pmw5E+jsClcqExBDU FsWYFT04h1gheXJMoB9FXqu/TnKKiXINCiI/ejhKhm8tgfkbDutrG34YeduZkHfw05j2 UfuGVxDjUuidc6SlmX3p+vze23iCXDo2rpgSx/sYWLaAkdwVRyuobaRcmTZXRq4k/v/p T3LA== 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=DMIfwB36abo3GcTTnomYBRIppRn6bneCpHDwVdVSiWI=; b=lw3qdLlA6AlYBXChsyMCAEf880QQB/+Y8kOy9rjwZfw9M1FUZAMC6rgVLT+zF1w9GR EHMc4qZoHoefO0MnouGNsHvZHIBM3vPMZbw0kahTVtUgRxkKzPEsrdqQFwsIqs8wQKRC HUTDQDsZjpN9TYeeKsHltpFWL76N4X7XYZiu3C+3rhS685ZdUvCVvAmgXRxjkwEA9KWx 1mgUO2ilZPreGymTM3BWV8tiklZfR0DIyEHEw/TsjGqcw3DuhRhmZ10oLJ9ALDjlN/Zi meBUgZKCHW2dJx/0ASKiKHHoUB9bnGx9yuH7Wl4qxjqF4EMrWYzCF2BK/5/j+ezSm6Qz 70og== 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 71si10586857wma.109.2018.01.10.00.12.03; Wed, 10 Jan 2018 00:12:03 -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 B1E9968A0F1; Wed, 10 Jan 2018 10:12:00 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 78847689EC7 for ; Wed, 10 Jan 2018 10:11:54 +0200 (EET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2018 00:11:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,339,1511856000"; d="scan'208";a="9245160" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.239.13.18]) by orsmga007.jf.intel.com with ESMTP; 10 Jan 2018 00:11:52 -0800 From: Zhong Li To: ffmpeg-devel@ffmpeg.org Date: Wed, 10 Jan 2018 16:10:15 +0800 Message-Id: <1515571815-24627-1-git-send-email-zhong.li@intel.com> X-Mailer: git-send-email 1.8.3.1 Subject: [FFmpeg-devel] [PATCH] 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 history commit 9de9b828ef005dec37052548c195a6b4f18fc701 but reverted somehow) to handle these cases. 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 4d736d2..3f3f3db 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) 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) 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