From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 7726340738 for ; Sun, 27 Nov 2022 17:06:11 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2F7ED68B82B; Sun, 27 Nov 2022 19:06:00 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 48B9068AE59 for ; Sun, 27 Nov 2022 19:05:53 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 059622400F5 for ; Sun, 27 Nov 2022 18:05:53 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id yb9agdCkUbi1 for ; Sun, 27 Nov 2022 18:05:52 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 621AF2404F7 for ; Sun, 27 Nov 2022 18:05:51 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id DEF7B3A1A3B for ; Sun, 27 Nov 2022 18:05:45 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sun, 27 Nov 2022 18:03:24 +0100 Message-Id: <20221127170351.11477-3-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221127170351.11477-1-anton@khirnov.net> References: <20221127170351.11477-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 03/30] lavc/libx264: use a local variable for input frame in setup_frame() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --- libavcodec/libx264.c | 50 ++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 36c36d0e09..8f03eecabf 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -337,7 +337,8 @@ static int setup_frame(AVCodecContext *ctx, const AVFrame *frame, x264_picture_t **ppic) { X264Context *x4 = ctx->priv_data; - x264_sei_t *sei = &x4->pic.extra_sei; + x264_picture_t *pic = &x4->pic; + x264_sei_t *sei = &pic->extra_sei; unsigned int sei_data_size = 0; int64_t wallclock = 0; int bit_depth, ret; @@ -347,45 +348,44 @@ static int setup_frame(AVCodecContext *ctx, const AVFrame *frame, if (!frame) return 0; - x264_picture_init( &x4->pic ); - x4->pic.img.i_csp = x4->params.i_csp; + x264_picture_init(pic); + pic->img.i_csp = x4->params.i_csp; #if X264_BUILD >= 153 bit_depth = x4->params.i_bitdepth; #else bit_depth = x264_bit_depth; #endif if (bit_depth > 8) - x4->pic.img.i_csp |= X264_CSP_HIGH_DEPTH; - x4->pic.img.i_plane = avfmt2_num_planes(ctx->pix_fmt); + pic->img.i_csp |= X264_CSP_HIGH_DEPTH; + pic->img.i_plane = avfmt2_num_planes(ctx->pix_fmt); - for (int i = 0; i < x4->pic.img.i_plane; i++) { - x4->pic.img.plane[i] = frame->data[i]; - x4->pic.img.i_stride[i] = frame->linesize[i]; + for (int i = 0; i < pic->img.i_plane; i++) { + pic->img.plane[i] = frame->data[i]; + pic->img.i_stride[i] = frame->linesize[i]; } - x4->pic.i_pts = frame->pts; + pic->i_pts = frame->pts; x4->reordered_opaque[x4->next_reordered_opaque].reordered_opaque = frame->reordered_opaque; x4->reordered_opaque[x4->next_reordered_opaque].wallclock = wallclock; if (ctx->export_side_data & AV_CODEC_EXPORT_DATA_PRFT) x4->reordered_opaque[x4->next_reordered_opaque].wallclock = av_gettime(); - x4->pic.opaque = &x4->reordered_opaque[x4->next_reordered_opaque]; + pic->opaque = &x4->reordered_opaque[x4->next_reordered_opaque]; x4->next_reordered_opaque++; x4->next_reordered_opaque %= x4->nb_reordered_opaque; switch (frame->pict_type) { case AV_PICTURE_TYPE_I: - x4->pic.i_type = x4->forced_idr > 0 ? X264_TYPE_IDR - : X264_TYPE_KEYFRAME; + pic->i_type = x4->forced_idr > 0 ? X264_TYPE_IDR : X264_TYPE_KEYFRAME; break; case AV_PICTURE_TYPE_P: - x4->pic.i_type = X264_TYPE_P; + pic->i_type = X264_TYPE_P; break; case AV_PICTURE_TYPE_B: - x4->pic.i_type = X264_TYPE_B; + pic->i_type = X264_TYPE_B; break; default: - x4->pic.i_type = X264_TYPE_AUTO; + pic->i_type = X264_TYPE_AUTO; break; } reconfig_encoder(ctx, frame); @@ -398,17 +398,17 @@ static int setup_frame(AVCodecContext *ctx, const AVFrame *frame, if (ret < 0) { av_log(ctx, AV_LOG_ERROR, "Not enough memory for closed captions, skipping\n"); } else if (sei_data) { - x4->pic.extra_sei.payloads = av_mallocz(sizeof(x4->pic.extra_sei.payloads[0])); - if (x4->pic.extra_sei.payloads == NULL) { + pic->extra_sei.payloads = av_mallocz(sizeof(pic->extra_sei.payloads[0])); + if (pic->extra_sei.payloads == NULL) { av_log(ctx, AV_LOG_ERROR, "Not enough memory for closed captions, skipping\n"); av_free(sei_data); } else { - x4->pic.extra_sei.sei_free = av_free; + pic->extra_sei.sei_free = av_free; - x4->pic.extra_sei.payloads[0].payload_size = sei_size; - x4->pic.extra_sei.payloads[0].payload = sei_data; - x4->pic.extra_sei.num_payloads = 1; - x4->pic.extra_sei.payloads[0].payload_type = 4; + pic->extra_sei.payloads[0].payload_size = sei_size; + pic->extra_sei.payloads[0].payload = sei_data; + pic->extra_sei.num_payloads = 1; + pic->extra_sei.payloads[0].payload_type = 4; } } } @@ -473,8 +473,8 @@ static int setup_frame(AVCodecContext *ctx, const AVFrame *frame, } } - x4->pic.prop.quant_offsets = qoffsets; - x4->pic.prop.quant_offsets_free = av_free; + pic->prop.quant_offsets = qoffsets; + pic->prop.quant_offsets_free = av_free; } else { if (!x4->roi_warned) { x4->roi_warned = 1; @@ -510,7 +510,7 @@ static int setup_frame(AVCodecContext *ctx, const AVFrame *frame, } } - *ppic = &x4->pic; + *ppic = pic; return 0; } -- 2.35.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".