From patchwork Thu Dec 10 11:16:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 24482 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 95E1A44AF7C for ; Thu, 10 Dec 2020 13:19:05 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7E16168A4BE; Thu, 10 Dec 2020 13:19:05 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9D1F868A0C3 for ; Thu, 10 Dec 2020 13:19:01 +0200 (EET) Received: by mail-wr1-f65.google.com with SMTP id r14so5068959wrn.0 for ; Thu, 10 Dec 2020 03:19:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=ZmHQRmRhGGNW1dq9UpnIRYlY2q3+jxpMwXIGz8GxMyk=; b=Wp0rvb7PC8QS95a5k9nkBLf8l03NEYg92anZc7IMEBX6LyQIrnYS/mi2Zd3I7GEAsX nOJ12FriOGI2pXHwzor6nG6uSpMAw6CNgkoc3mJa8VvSLx3YsLUGQLYbvlE3i5OLgJYg 0IYNpnyQ2TedAn+ygxs7Ltd9t0+1Atu2QRdPYc3fYM9Ra8WRwRxWy/z7aWdEGOn3LFVE FDp/mT1ul+wo2CRTCtBLqvuyelUtrqA4mmgvaU2OQJfzz+HWl8FrpqMbMxEJ9vGL98Bi R8higeIac3jXucA46xENf+sJ+18AFwe7BdMvuP7dsZ60ZJNUj2bfAjddUuuuIaQnazOV 5aKg== 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:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=ZmHQRmRhGGNW1dq9UpnIRYlY2q3+jxpMwXIGz8GxMyk=; b=gk7Zr59VpvqniyCBOkxLI2fRk/JvQSdmzpqZx/RWeVwdFwuLwAx7LQ7vmgHoMGfCQL cBmDRLL/3oshn4k7Hi62vmTJIcvko0bABSu4xRoNvA7Vjs8BFYWs/w6wArZsMStEMqoR Xtkzj50M7JgSbLvdC0YagA6tAzjZx+xSKARZCKjqYawMs91MdKqLYhsuZTOSTkuFnItE HPzkbg2bhQs09c3mdR7j8GLdMOTfesV5PMUqcQejefBvyhYE6gtBE19NtZPoxTglUi2m fGuKpCWqf/MOA0h2B36LAraMMgakTIhPfX7h1oLWsIxPJRl2m1dutdYjTBGSvNKKHAjU DIhQ== X-Gm-Message-State: AOAM531ZsCOMM1wLP/+iZGv7jmRj61vTCQaMiidz3nTGr2GNV6woF2KG byfw12qK5CmhtPUEjL3lJ65smCCNLfrVKQ== X-Google-Smtp-Source: ABdhPJxHKR/OrZWOlC6JzPJ1/bRQBNPUHSJzDEu/DNNlyoxSL4JWt1vLBDEieuBhFdZkDFNjvNMEew== X-Received: by 2002:a5d:5044:: with SMTP id h4mr7731262wrt.149.1607599140903; Thu, 10 Dec 2020 03:19:00 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id s133sm8942330wmf.38.2020.12.10.03.18.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Dec 2020 03:19:00 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 10 Dec 2020 12:16:33 +0100 Message-Id: <20201210111657.2276739-16-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201210111657.2276739-1-andreas.rheinhardt@gmail.com> References: <20201210111657.2276739-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 15/39] avcodec/mpegvideo: Merge ff_mpv_decode_defaults into ff_mpv_decode_init 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" These two are always called directly after each other (with the exception of the calls in mpeg_decode_init() where some irrelevant modifications of the avctx (which could just as well be done before ff_mpv_decode_defaults(), because it doesn't have a pointer to the AVCodecContext at all and therefore can't see these modifications at all) are performed in between), so merge ff_mpv_decode() in ff_mpv_decode_init(). Signed-off-by: Andreas Rheinhardt --- libavcodec/h261dec.c | 1 - libavcodec/h263dec.c | 1 - libavcodec/mpeg12dec.c | 3 --- libavcodec/mpegvideo.c | 7 ++----- libavcodec/mpegvideo.h | 1 - libavcodec/rv10.c | 1 - libavcodec/rv34.c | 1 - 7 files changed, 2 insertions(+), 13 deletions(-) diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index 374d17dfba..2dc2fb30f2 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -75,7 +75,6 @@ static av_cold int h261_decode_init(AVCodecContext *avctx) MpegEncContext *const s = &h->s; // set defaults - ff_mpv_decode_defaults(s); ff_mpv_decode_init(s, avctx); s->out_format = FMT_H261; diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 32e26a57de..8b441b2951 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -73,7 +73,6 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx) s->out_format = FMT_H263; // set defaults - ff_mpv_decode_defaults(s); ff_mpv_decode_init(s, avctx); s->quant_precision = 5; diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 7d797c259a..123ede4704 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1050,8 +1050,6 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx) Mpeg1Context *s = avctx->priv_data; MpegEncContext *s2 = &s->mpeg_enc_ctx; - ff_mpv_decode_defaults(s2); - if ( avctx->codec_tag != AV_RL32("VCR2") && avctx->codec_tag != AV_RL32("BW10")) avctx->coded_width = avctx->coded_height = 0; // do not trust dimensions from input @@ -3099,7 +3097,6 @@ static av_cold int ipu_decode_init(AVCodecContext *avctx) avctx->pix_fmt = AV_PIX_FMT_YUV420P; - ff_mpv_decode_defaults(m); ff_mpv_decode_init(m, avctx); s->m.avctx = avctx; ff_mpv_idct_init(m); diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index c28d1adef7..f92792ae98 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -660,17 +660,14 @@ void ff_mpv_common_defaults(MpegEncContext *s) } /** - * Set the given MpegEncContext to defaults for decoding. + * Initialize the given MpegEncContext for decoding. * the changed fields will not depend upon * the prior state of the MpegEncContext. */ -void ff_mpv_decode_defaults(MpegEncContext *s) +void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx) { ff_mpv_common_defaults(s); -} -void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx) -{ s->avctx = avctx; s->width = avctx->coded_width; s->height = avctx->coded_height; diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 974c71b6bd..aa84449c2d 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -694,7 +694,6 @@ void ff_mpv_common_init_mips(MpegEncContext *s); int ff_mpv_common_frame_size_change(MpegEncContext *s); void ff_mpv_common_end(MpegEncContext *s); -void ff_mpv_decode_defaults(MpegEncContext *s); void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx); void ff_mpv_reconstruct_mb(MpegEncContext *s, int16_t block[12][64]); void ff_mpv_report_decode_progress(MpegEncContext *s); diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index d118515c3b..d5c7480611 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -374,7 +374,6 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx) avctx->coded_height, 0, avctx)) < 0) return ret; - ff_mpv_decode_defaults(s); ff_mpv_decode_init(s, avctx); s->out_format = FMT_H263; diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index 13f9b609e2..f8cc837985 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -1487,7 +1487,6 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx) MpegEncContext *s = &r->s; int ret; - ff_mpv_decode_defaults(s); ff_mpv_decode_init(s, avctx); s->out_format = FMT_H263;