You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/speedhqenc: Make speedhq_encode_init() call ff_mpv_encode_init()
Right now, ff_mpv_encode_init() is set as FFCodec.init and calls ff_speedhq_encode_init(). The opposite is more natural and avoids a non-static function. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -774,10 +774,6 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
|
||||
case AV_CODEC_ID_SPEEDHQ:
|
||||
s->out_format = FMT_SPEEDHQ;
|
||||
s->intra_only = 1; /* force intra only for SHQ */
|
||||
if (!CONFIG_SPEEDHQ_ENCODER)
|
||||
return AVERROR_ENCODER_NOT_FOUND;
|
||||
if ((ret = ff_speedhq_encode_init(s)) < 0)
|
||||
return ret;
|
||||
avctx->delay = 0;
|
||||
s->low_delay = 1;
|
||||
break;
|
||||
|
@ -95,26 +95,26 @@ static av_cold void speedhq_init_static_data(void)
|
||||
ff_speedhq_vlc_table, uni_speedhq_ac_vlc_len);
|
||||
}
|
||||
|
||||
av_cold int ff_speedhq_encode_init(MpegEncContext *s)
|
||||
static av_cold int speedhq_encode_init(AVCodecContext *avctx)
|
||||
{
|
||||
static AVOnce init_static_once = AV_ONCE_INIT;
|
||||
MpegEncContext *const s = avctx->priv_data;
|
||||
int ret;
|
||||
|
||||
if (s->width > 65500 || s->height > 65500) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "SpeedHQ does not support resolutions above 65500x65500\n");
|
||||
if (avctx->width > 65500 || avctx->height > 65500) {
|
||||
av_log(avctx, AV_LOG_ERROR, "SpeedHQ does not support resolutions above 65500x65500\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
// border is not implemented correctly at the moment, see ticket #10078
|
||||
if (s->width % 16) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "width must be a multiple of 16\n");
|
||||
if (avctx->width % 16) {
|
||||
av_log(avctx, AV_LOG_ERROR, "width must be a multiple of 16\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
s->min_qcoeff = -2048;
|
||||
s->max_qcoeff = 2047;
|
||||
|
||||
ff_thread_once(&init_static_once, speedhq_init_static_data);
|
||||
|
||||
s->intra_ac_vlc_length =
|
||||
s->intra_ac_vlc_last_length =
|
||||
s->intra_chroma_ac_vlc_length =
|
||||
@ -123,6 +123,12 @@ av_cold int ff_speedhq_encode_init(MpegEncContext *s)
|
||||
s->y_dc_scale_table =
|
||||
s->c_dc_scale_table = ff_mpeg12_dc_scale_table[3];
|
||||
|
||||
ret = ff_mpv_encode_init(avctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
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');
|
||||
@ -280,7 +286,7 @@ const FFCodec ff_speedhq_encoder = {
|
||||
.p.priv_class = &ff_mpv_enc_class,
|
||||
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
|
||||
.priv_data_size = sizeof(SpeedHQEncContext),
|
||||
.init = ff_mpv_encode_init,
|
||||
.init = speedhq_encode_init,
|
||||
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
|
||||
.close = ff_mpv_encode_end,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
|
@ -33,7 +33,6 @@
|
||||
|
||||
#include "mpegvideo.h"
|
||||
|
||||
int ff_speedhq_encode_init(MpegEncContext *s);
|
||||
void ff_speedhq_encode_close(MpegEncContext *s);
|
||||
void ff_speedhq_encode_mb(MpegEncContext *s, int16_t block[12][64]);
|
||||
|
||||
|
Reference in New Issue
Block a user