Namely use avctx directly instead of s->avctx. While just at it, also move the switch to the other checks involving avctx.
Unified · Split
| @@ -112,6 +112,20 @@ static av_cold int speedhq_encode_init(AVCodecContext *avctx) · 111 unmodified lines | |||
| 112 | return AVERROR_PATCHWELCOME; | 112 | return AVERROR_PATCHWELCOME; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 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 | |||
| 115 | s->min_qcoeff = -2048; | 129 | s->min_qcoeff = -2048; |
| 116 | s->max_qcoeff = 2047; | 130 | s->max_qcoeff = 2047; |
| 117 | 131 | ||
| @@ -129,20 +143,6 @@ static av_cold int speedhq_encode_init(AVCodecContext *avctx) · 11 unmodified lines | |||
| 129 | 143 | ||
| 130 | ff_thread_once(&init_static_once, speedhq_init_static_data); | 144 | ff_thread_once(&init_static_once, speedhq_init_static_data); |
| 131 | 145 | ||
| 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 | |||
| 146 | return 0; | 146 | return 0; |
| 147 | } | 147 | } |
| 148 | 148 | ||