51 0x1, 0x0, 0x2, 0x5, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF
54 0x0, 0x2, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF, 0x3FF
76 for (
int i = -255;
i < 256;
i++) {
111 ctx->slice_start = 4;
134 unsigned int diff_u =
diff + 255;
168 int alevel,
level, last_non_zero, dc,
i, j,
run, last_index, sign;
173 component = (n <= 3 ? 0 : (n&1) + 1);
175 val =
s->last_dc[component] - dc;
177 s->last_dc[component] = dc;
181 last_index =
s->c.block_last_index[n];
183 for (
i = 1;
i <= last_index;
i++) {
184 j =
s->c.intra_scantable.permutated[
i];
189 run =
i - last_non_zero - 1;
205 (
level + 2048) << 12);
215 int unused_x,
int unused_y)
245 if (avctx->
width > 65500 || avctx->
height > 65500) {
246 av_log(avctx,
AV_LOG_ERROR,
"SpeedHQ does not support resolutions above 65500x65500\n");
251 if (avctx->
width % 16) {
273 s->min_qcoeff = -2048;
274 s->max_qcoeff = 2047;
276 s->intra_ac_vlc_length =
277 s->intra_ac_vlc_last_length =
278 s->intra_chroma_ac_vlc_length =
281 s->c.y_dc_scale_table =
static double val(void *priv, double ch)
const FFCodec ff_speedhq_encoder
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_unreachable(msg)
Asserts that are used as compiler optimization hints depending upon ASSERT_LEVEL and NBDEBUG.
Libavcodec external API header.
#define i(width, name, range_min, range_max)
#define CODEC_PIXFMTS(...)
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
int(* init)(AVBSFContext *ctx)
static const uint8_t bits[8]
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int ff_thread_once(char *control, void(*routine)(void))
#define MKTAG(a, b, c, d)
#define MASK_ABS(mask, level)
const unsigned char ff_mpeg12_vlc_dc_chroma_bits[12]
const unsigned char ff_mpeg12_vlc_dc_lum_bits[12]
av_cold void ff_mpeg1_init_uni_ac_vlc(const int8_t max_level[], const uint8_t index_run[], const uint16_t table_vlc[][2], uint8_t uni_ac_vlc_len[])
const AVClass ff_mpv_enc_class
av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic_arg, int *got_packet)
av_cold int ff_mpv_encode_end(AVCodecContext *avctx)
const uint8_t ff_mpeg12_dc_scale_table[4][32]
static int get_bits_diff(MPVEncContext *s)
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static void put_bits_le(PutBitContext *s, int n, BitBuf value)
static void flush_put_bits_le(PutBitContext *s)
static int put_bytes_output(const PutBitContext *s)
static void put_bits_assume_flushed(const PutBitContext *s)
Inform the compiler that a PutBitContext is flushed (i.e.
av_cold void ff_rl_init_level_run(uint8_t max_level[MAX_LEVEL+1], uint8_t index_run[MAX_RUN+1], const uint8_t table_run[], const uint8_t table_level[], int n)
Initialize max_level and index_run from table_run and table_level; this is equivalent to initializing...
const uint8_t ff_speedhq_level[121]
const uint16_t ff_speedhq_vlc_table[SPEEDHQ_RL_NB_ELEMS+2][2]
const uint8_t ff_speedhq_run[121]
#define SPEEDHQ_RL_NB_ELEMS
static uint8_t speedhq_index_run[MAX_RUN+1]
static uint32_t speedhq_lum_dc_uni[512]
static av_cold int speedhq_encode_init(AVCodecContext *avctx)
static void encode_dc(PutBitContext *pb, int diff, int component)
static int speedhq_encode_picture_header(MPVMainEncContext *const m)
static void encode_block(MPVEncContext *const s, const int16_t block[], int n)
static const uint16_t mpeg12_vlc_dc_lum_code_reversed[12]
static uint8_t speedhq_max_level[MAX_LEVEL+1]
static av_cold void speedhq_init_static_data(void)
void ff_speedhq_end_slice(MPVEncContext *const s)
static const uint16_t mpeg12_vlc_dc_chroma_code_reversed[12]
static uint8_t uni_speedhq_ac_vlc_len[64 *64 *2]
static void speedhq_encode_mb(MPVEncContext *const s, int16_t block[12][64], int unused_x, int unused_y)
static uint32_t speedhq_chr_dc_uni[512]
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
MPVEncContext s
The main slicecontext.
int(* encode_picture_header)(struct MPVMainEncContext *m)
static AVFormatContext * ctx
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)