From: Anton Khirnov <anton@khirnov.net> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 01/36] fftools/ffmpeg: shorten a variable name Date: Wed, 17 May 2023 12:19:54 +0200 Message-ID: <20230517102029.541-1-anton@khirnov.net> (raw) 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; } -- 2.39.2 _______________________________________________ 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".
next reply other threads:[~2023-05-17 10:21 UTC|newest] Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-17 10:19 Anton Khirnov [this message] 2023-05-17 10:19 ` [FFmpeg-devel] [PATCH 02/36] fftools/ffmpeg: drop a useless local variable Anton Khirnov 2023-05-17 10:19 ` [FFmpeg-devel] [PATCH 03/36] fftools/ffmpeg: replace stream timebase with decoded frame one Anton Khirnov 2023-05-17 10:19 ` [FFmpeg-devel] [PATCH 04/36] fftools/ffmpeg_filter: convert input frame timestamps Anton Khirnov 2023-05-17 10:19 ` [FFmpeg-devel] [PATCH 05/36] fftools/ffmpeg_filter: make sure pkt_duration matches duration Anton Khirnov 2023-05-17 10:19 ` [FFmpeg-devel] [PATCH 06/36] fftools/ffmpeg: rework applying input -r Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 07/36] tests/fate/ffmpeg: move a misplaced line Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 08/36] tests/fate/ffmpeg: add a test for input -r option Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 09/36] fftools/ffmpeg_filter: split finding an unused stream into a function Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 10/36] fftools/ffmpeg: return error codes from ist_*_add() Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 11/36] fftools/ffmpeg_demux: disallow using disabled input streams Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 12/36] fftools/ffmpeg_filter: only use fallback parameters when necessary Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 13/36] fftools/ffmpeg_filter: try configuring graphs from input EOF Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 14/36] fftools/ffmpeg: move ifilter_has_all_input_formats() to ffmpeg_filter Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 15/36] fftools/ffmpeg_filter: make input filter configured parameters private Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 16/36] fftools/ffmpeg_filter: drop a redundant error message Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 17/36] fftools/ffmpeg_filter: move InputFilter.ist to private data Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 18/36] fftools/ffmpeg_filter: move InputFilter.type " Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 19/36] fftools/ffmpeg_filter: keep track of the real filter input type Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 20/36] fftools/ffmpeg_filter: embed displaymatrix into private context Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 21/36] fftools/cmdutils: constify the argument of get_rotation() Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 22/36] fftools/ffmpeg: drop an obsolete hack Anton Khirnov 2023-05-26 6:22 ` Wang, Fei W 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 23/36] fftools/ffmpeg: eliminate InputStream.got_output Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 24/36] fftools/ffmpeg: replace an unreachable return with av_assert0(0) Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 25/36] fftools/ffmpeg: deobfuscate check_decode_result() call Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 26/36] fftools/ffmpeg: rework handling -max_error_rate Anton Khirnov 2023-05-18 6:19 ` [FFmpeg-devel] [PATCH] " Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 27/36] fftools/ffmpeg: move a block to a more appropriate place Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 28/36] fftools/ffmpeg: split decoding loop out of process_input_packet() Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 29/36] fftools/ffmpeg: move decoding code to ffmpeg_dec Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 30/36] fftools/ffmpeg_dec: deobfuscate subtitle decoding Anton Khirnov 2023-05-17 20:15 ` Michael Niedermayer 2023-05-18 14:34 ` Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 31/36] fftools/ffmpeg_dec: restructure audio/video decoding loop Anton Khirnov 2023-05-17 20:04 ` Michael Niedermayer 2023-05-17 20:06 ` Michael Niedermayer 2023-05-18 6:41 ` Anton Khirnov 2023-05-18 6:36 ` [FFmpeg-devel] [PATCH] " Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 32/36] fftools/ffmpeg: reindent after previous commit Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 33/36] fftools/ffmpeg_dec: merge check_decode_result() into its callers Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 34/36] fftools/ffmpeg_dec: deduplicate code in decode_audio/video() Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 35/36] fftools/ffmpeg_dec: inline decode_audio() into dec_packet() Anton Khirnov 2023-05-17 10:20 ` [FFmpeg-devel] [PATCH 36/36] fftools/ffmpeg_dec: rename decode_video() to video_frame_process() Anton Khirnov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230517102029.541-1-anton@khirnov.net \ --to=anton@khirnov.net \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git