From patchwork Wed May 17 10:19:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41659 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id fb17csp1077999pzb; Wed, 17 May 2023 03:21:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4BXylzG4Z31BdESnm8+DeP3oxYjgp+HDaF6OgKAKS37m2Qcn6fJcUTNfAzu4wxqPkshDlc X-Received: by 2002:a17:907:9710:b0:96a:ee54:9f2b with SMTP id jg16-20020a170907971000b0096aee549f2bmr13305589ejc.29.1684318887677; Wed, 17 May 2023 03:21:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684318887; cv=none; d=google.com; s=arc-20160816; b=rJfUfb/qlNimeQ9/fpNdEg2MPzo8tzLB2X3UyFz0jLcXmDYNpBYwMMLgLVcZKqcMVj pnWsKO792P08atqyzobwm4NQwjnvpDJ0FyqxLTJIEq17T1mC5P6vMEb5Gix5Zb9aGFHL K0k0waQ67J2jD/PPdFFNSDqFVC6rx/01/+NrD/z5QJi+xDxqm+/fCIqU3pcjDzy9Fqv+ dshO8mqoSoXSZ8actC5WqSkvxZj6tQROC92xsPNuTCwWt8dnBVJ57YKXuK39ILAqW7fl 7r4VNa6Vvf4bZLyJXXZFq0csTOUSdtge45ARpfuYx2VcV4C8pvyW+M5MEggWQEYatCsj fFKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=DXEAx1Jg2Y1dY0Rf9OCfitnen/TCs/OQdiOnK4w9Fnk=; b=IWYzXu+KBlAIXG63q7PfGiLnv1SAjHPpIw9Qg0CWZAaOOpI6Oa4spptfjRIgON/F2F 5DrRyf8/n+XY+bEd1cEVoRBE6kQsFjzGbNnnrio23HOCScliFifwuyXOGnlxHNjUOuth XHg41fCIdP+qPDmfVgQuSkz6Sw94+3KRhnR6YvrKk4B83GuXdwGJLiZV+0u2Yj6f+Ssx aAcTMTocoPxem+tKa2P0PrFFxSv1ZNFZF+gVssz6GWfHz/v9oE265AUcDpdwd6pY99HA vyiXRF41qMtbOFiZkXaRn85FczKYl2bAl6t1ZOxIxwZAUDeTOEehrhmos6OvEBG5udZu 7ejw== 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 ja3-20020a170907988300b0094ee039da42si17060459ejc.751.2023.05.17.03.21.27; Wed, 17 May 2023 03:21:27 -0700 (PDT) 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 D82B968C12A; Wed, 17 May 2023 13:20:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F145968C0FF for ; Wed, 17 May 2023 13:20:47 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id B8A692404EE for ; Wed, 17 May 2023 12:20:47 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id dep6NHaWb_o6 for ; Wed, 17 May 2023 12:20:45 +0200 (CEST) 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 CDE6F240177 for ; Wed, 17 May 2023 12:20:45 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 636773A031B for ; Wed, 17 May 2023 12:20:39 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 May 2023 12:19:54 +0200 Message-Id: <20230517102029.541-1-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 01/36] fftools/ffmpeg: shorten a variable name 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: dO8Zvpj0QFgR There is only one frame used in decode_video() -- the one output by the decoder. So there is no point in explicitly calling it the _decoded_ frame. --- fftools/ffmpeg.c | 52 ++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index ebd793a98c..084192f270 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1027,7 +1027,7 @@ static int64_t video_duration_estimate(const InputStream *ist, const AVFrame *fr static int decode_video(InputStream *ist, const AVPacket *pkt, int *got_output, int eof, int *decode_failed) { - AVFrame *decoded_frame = ist->decoded_frame; + AVFrame *frame = ist->decoded_frame; int ret = 0, err = 0; int64_t best_effort_timestamp; @@ -1038,7 +1038,7 @@ static int decode_video(InputStream *ist, const AVPacket *pkt, int *got_output, return 0; update_benchmark(NULL); - ret = decode(ist, ist->dec_ctx, decoded_frame, got_output, pkt); + ret = decode(ist, ist->dec_ctx, frame, got_output, pkt); update_benchmark("decode_video %d.%d", ist->file_index, ist->st->index); if (ret < 0) *decode_failed = 1; @@ -1062,13 +1062,13 @@ static int decode_video(InputStream *ist, const AVPacket *pkt, int *got_output, check_decode_result(ist, got_output, ret); if (*got_output && ret >= 0) { - if (ist->dec_ctx->width != decoded_frame->width || - ist->dec_ctx->height != decoded_frame->height || - ist->dec_ctx->pix_fmt != decoded_frame->format) { + if (ist->dec_ctx->width != frame->width || + ist->dec_ctx->height != frame->height || + ist->dec_ctx->pix_fmt != frame->format) { av_log(NULL, AV_LOG_DEBUG, "Frame parameters mismatch context %d,%d,%d != %d,%d,%d\n", - decoded_frame->width, - decoded_frame->height, - decoded_frame->format, + frame->width, + frame->height, + frame->format, ist->dec_ctx->width, ist->dec_ctx->height, ist->dec_ctx->pix_fmt); @@ -1079,17 +1079,17 @@ static int decode_video(InputStream *ist, const AVPacket *pkt, int *got_output, return ret; if(ist->top_field_first>=0) - decoded_frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST; + frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST; ist->frames_decoded++; - if (ist->hwaccel_retrieve_data && decoded_frame->format == ist->hwaccel_pix_fmt) { - err = ist->hwaccel_retrieve_data(ist->dec_ctx, decoded_frame); + if (ist->hwaccel_retrieve_data && frame->format == ist->hwaccel_pix_fmt) { + err = ist->hwaccel_retrieve_data(ist->dec_ctx, frame); if (err < 0) goto fail; } - best_effort_timestamp= decoded_frame->best_effort_timestamp; + best_effort_timestamp = frame->best_effort_timestamp; if (ist->framerate.num) best_effort_timestamp = ist->cfr_next_pts++; @@ -1100,13 +1100,13 @@ static int decode_video(InputStream *ist, const AVPacket *pkt, int *got_output, ist->last_frame_pts + ist->last_frame_duration_est; if(best_effort_timestamp != AV_NOPTS_VALUE) { - decoded_frame->pts = best_effort_timestamp; + frame->pts = best_effort_timestamp; } // update timestamp history - ist->last_frame_duration_est = video_duration_estimate(ist, decoded_frame); - ist->last_frame_pts = decoded_frame->pts; - ist->last_frame_tb = decoded_frame->time_base; + ist->last_frame_duration_est = video_duration_estimate(ist, frame); + ist->last_frame_pts = frame->pts; + ist->last_frame_tb = frame->time_base; if (debug_ts) { av_log(ist, AV_LOG_INFO, @@ -1115,25 +1115,25 @@ static int decode_video(InputStream *ist, const AVPacket *pkt, int *got_output, "best_effort_ts:%"PRId64" best_effort_ts_time:%s " "duration:%s duration_time:%s " "keyframe:%d frame_type:%d time_base:%d/%d\n", - av_ts2str(decoded_frame->pts), - av_ts2timestr(decoded_frame->pts, &ist->st->time_base), - av_ts2str(decoded_frame->pkt_dts), - av_ts2timestr(decoded_frame->pkt_dts, &ist->st->time_base), + av_ts2str(frame->pts), + av_ts2timestr(frame->pts, &ist->st->time_base), + av_ts2str(frame->pkt_dts), + av_ts2timestr(frame->pkt_dts, &ist->st->time_base), best_effort_timestamp, av_ts2timestr(best_effort_timestamp, &ist->st->time_base), - av_ts2str(decoded_frame->duration), - av_ts2timestr(decoded_frame->duration, &ist->st->time_base), - !!(decoded_frame->flags & AV_FRAME_FLAG_KEY), decoded_frame->pict_type, + av_ts2str(frame->duration), + av_ts2timestr(frame->duration, &ist->st->time_base), + !!(frame->flags & AV_FRAME_FLAG_KEY), frame->pict_type, ist->st->time_base.num, ist->st->time_base.den); } if (ist->st->sample_aspect_ratio.num) - decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio; + frame->sample_aspect_ratio = ist->st->sample_aspect_ratio; - err = send_frame_to_filters(ist, decoded_frame); + err = send_frame_to_filters(ist, frame); fail: - av_frame_unref(decoded_frame); + av_frame_unref(frame); return err < 0 ? err : ret; }