[FFmpeg-devel] [PATCH 8/9] ffmpeg: drop a useless assignment

Anton Khirnov anton at khirnov.net
Mon Nov 15 17:23:59 EET 2021


bits_per_raw_sample is already set in new_video_stream(), so this code
has no effect.
---
 fftools/ffmpeg.c     | 7 -------
 fftools/ffmpeg.h     | 1 -
 fftools/ffmpeg_opt.c | 2 +-
 3 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 0f2fe192ac..c0ab78608a 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3451,13 +3451,6 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame)
 
         ost->st->avg_frame_rate = ost->frame_rate;
 
-        if (!dec_ctx ||
-            enc_ctx->width   != dec_ctx->width  ||
-            enc_ctx->height  != dec_ctx->height ||
-            enc_ctx->pix_fmt != dec_ctx->pix_fmt) {
-            enc_ctx->bits_per_raw_sample = frame_bits_per_raw_sample;
-        }
-
         // Field order: autodetection
         if (frame) {
             if (enc_ctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME) &&
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 30225e9ffe..2da7b1b7df 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -625,7 +625,6 @@ extern int print_stats;
 extern int64_t stats_period;
 extern int qp_hist;
 extern int stdin_interaction;
-extern int frame_bits_per_raw_sample;
 extern AVIOContext *progress_avio;
 extern float max_error_rate;
 extern char *videotoolbox_pixfmt;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 54f6279bf5..c16f5e8672 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -166,7 +166,7 @@ int abort_on_flags    = 0;
 int print_stats       = -1;
 int qp_hist           = 0;
 int stdin_interaction = 1;
-int frame_bits_per_raw_sample = 0;
+static int frame_bits_per_raw_sample = 0;
 float max_error_rate  = 2.0/3;
 char *filter_nbthreads;
 int filter_complex_nbthreads = 0;
-- 
2.33.0



More information about the ffmpeg-devel mailing list