[FFmpeg-cvslog] avcodec/speedhqenc: Avoid indirection
Andreas Rheinhardt
git at videolan.org
Wed Mar 26 06:08:51 EET 2025
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Mar 2 00:34:19 2025 +0100| [9928b9e9faefc88ca0efe39e2a4a6302966eeb76] | committer: Andreas Rheinhardt
avcodec/speedhqenc: Avoid indirection
Namely use avctx directly instead of s->avctx. While just at it,
also move the switch to the other checks involving avctx.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9928b9e9faefc88ca0efe39e2a4a6302966eeb76
---
libavcodec/speedhqenc.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/libavcodec/speedhqenc.c b/libavcodec/speedhqenc.c
index de1bc0cfca..2e09016935 100644
--- a/libavcodec/speedhqenc.c
+++ b/libavcodec/speedhqenc.c
@@ -112,6 +112,20 @@ static av_cold int speedhq_encode_init(AVCodecContext *avctx)
return AVERROR_PATCHWELCOME;
}
+ switch (avctx->pix_fmt) {
+ case AV_PIX_FMT_YUV420P:
+ avctx->codec_tag = MKTAG('S','H','Q','0');
+ break;
+ case AV_PIX_FMT_YUV422P:
+ avctx->codec_tag = MKTAG('S','H','Q','2');
+ break;
+ case AV_PIX_FMT_YUV444P:
+ avctx->codec_tag = MKTAG('S','H','Q','4');
+ break;
+ default:
+ av_assert0(0);
+ }
+
s->min_qcoeff = -2048;
s->max_qcoeff = 2047;
@@ -129,20 +143,6 @@ static av_cold int speedhq_encode_init(AVCodecContext *avctx)
ff_thread_once(&init_static_once, speedhq_init_static_data);
- switch (s->avctx->pix_fmt) {
- case AV_PIX_FMT_YUV420P:
- s->avctx->codec_tag = MKTAG('S','H','Q','0');
- break;
- case AV_PIX_FMT_YUV422P:
- s->avctx->codec_tag = MKTAG('S','H','Q','2');
- break;
- case AV_PIX_FMT_YUV444P:
- s->avctx->codec_tag = MKTAG('S','H','Q','4');
- break;
- default:
- av_assert0(0);
- }
-
return 0;
}
More information about the ffmpeg-cvslog
mailing list