History

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.

Andreas Rheinhardt committed 1 year ago

Commit 9928b9e1 parent 565e57e1 file · +14 −14Browse files

Unified · Split

libavcodec/speedhqenc.c+14−14
@@ -112,6 +112,20 @@ static av_cold int speedhq_encode_init(AVCodecContext *avctx) · 111 unmodified lines
112112 return AVERROR_PATCHWELCOME;
113113 }
114114
115+ switch (avctx->pix_fmt) {
116+ case AV_PIX_FMT_YUV420P:
117+ avctx->codec_tag = MKTAG('S','H','Q','0');
118+ break;
119+ case AV_PIX_FMT_YUV422P:
120+ avctx->codec_tag = MKTAG('S','H','Q','2');
121+ break;
122+ case AV_PIX_FMT_YUV444P:
123+ avctx->codec_tag = MKTAG('S','H','Q','4');
124+ break;
125+ default:
126+ av_assert0(0);
127+ }
128+
115129 s->min_qcoeff = -2048;
116130 s->max_qcoeff = 2047;
117131
@@ -129,20 +143,6 @@ static av_cold int speedhq_encode_init(AVCodecContext *avctx) · 11 unmodified lines
129143
130144 ff_thread_once(&init_static_once, speedhq_init_static_data);
131145
132− switch (s->avctx->pix_fmt) {
133− case AV_PIX_FMT_YUV420P:
134− s->avctx->codec_tag = MKTAG('S','H','Q','0');
135− break;
136− case AV_PIX_FMT_YUV422P:
137− s->avctx->codec_tag = MKTAG('S','H','Q','2');
138− break;
139− case AV_PIX_FMT_YUV444P:
140− s->avctx->codec_tag = MKTAG('S','H','Q','4');
141− break;
142− default:
143− av_assert0(0);
144− }
145−
146146 return 0;
147147 }
148148

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t