FFmpeg
speedhqenc.c
Go to the documentation of this file.
1 /*
2  * SpeedHQ encoder
3  * Copyright (c) 2000, 2001 Fabrice Bellard
4  * Copyright (c) 2003 Alex Beregszaszi
5  * Copyright (c) 2003-2004 Michael Niedermayer
6  * Copyright (c) 2020 FFmpeg
7  *
8  * This file is part of FFmpeg.
9  *
10  * FFmpeg is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * FFmpeg is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with FFmpeg; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  */
24 
25 /**
26  * @file
27  * SpeedHQ encoder.
28  */
29 
30 #include "libavutil/avassert.h"
31 #include "libavutil/thread.h"
32 
33 #include "avcodec.h"
34 #include "codec_internal.h"
35 #include "mathops.h"
36 #include "mpeg12data.h"
37 #include "mpeg12vlc.h"
38 #include "mpegvideo.h"
39 #include "mpegvideodata.h"
40 #include "mpegvideoenc.h"
41 #include "put_bits.h"
42 #include "rl.h"
43 #include "speedhq.h"
44 #include "speedhqenc.h"
45 
46 static uint8_t speedhq_max_level[MAX_LEVEL + 1];
47 static uint8_t speedhq_index_run[MAX_RUN + 1];
48 
49 /* Exactly the same as MPEG-2, except little-endian. */
50 static const uint16_t mpeg12_vlc_dc_lum_code_reversed[12] = {
51  0x1, 0x0, 0x2, 0x5, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF
52 };
53 static const uint16_t mpeg12_vlc_dc_chroma_code_reversed[12] = {
54  0x0, 0x2, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF, 0x3FF
55 };
56 
57 /* simple include everything table for dc, first byte is bits
58  * number next 3 are code */
59 static uint32_t speedhq_lum_dc_uni[512];
60 static uint32_t speedhq_chr_dc_uni[512];
61 
62 static uint8_t uni_speedhq_ac_vlc_len[64 * 64 * 2];
63 
64 typedef struct SpeedHQEncContext {
66 
69 
71 {
74 
75  /* build unified dc encoding tables */
76  for (int i = -255; i < 256; i++) {
77  int adiff, index;
78  int bits, code;
79  int diff = i;
80 
81  adiff = FFABS(diff);
82  if (diff < 0)
83  diff--;
84  index = av_log2(2 * adiff);
85 
89  speedhq_lum_dc_uni[i + 255] = bits + (code << 8);
90 
94  speedhq_chr_dc_uni[i + 255] = bits + (code << 8);
95  }
96 
99 }
100 
102 {
104  MPVEncContext *const s = &m->s;
105 
107 
108  put_bits_le(&s->pb, 8, 100 - s->c.qscale * 2); /* FIXME why doubled */
109  put_bits_le(&s->pb, 24, 4); /* no second field */
110 
111  ctx->slice_start = 4;
112  /* length of first slice, will be filled out later */
113  put_bits_le(&s->pb, 24, 0);
114 
115  return 0;
116 }
117 
119 {
121  int slice_len;
122 
123  flush_put_bits_le(&s->pb);
124  slice_len = put_bytes_output(&s->pb) - ctx->slice_start;
125  AV_WL24(s->pb.buf + ctx->slice_start, slice_len);
126 
127  /* length of next slice, will be filled out later */
128  ctx->slice_start = put_bytes_output(&s->pb);
129  put_bits_le(&s->pb, 24, 0);
130 }
131 
132 static inline void encode_dc(PutBitContext *pb, int diff, int component)
133 {
134  unsigned int diff_u = diff + 255;
135  if (diff_u >= 511) {
136  int index;
137 
138  if (diff < 0) {
139  index = av_log2_16bit(-2 * diff);
140  diff--;
141  } else {
142  index = av_log2_16bit(2 * diff);
143  }
144  if (component == 0)
145  put_bits_le(pb,
149  else
150  put_bits_le(pb,
154  } else {
155  if (component == 0)
156  put_bits_le(pb,
157  speedhq_lum_dc_uni[diff + 255] & 0xFF,
158  speedhq_lum_dc_uni[diff + 255] >> 8);
159  else
160  put_bits_le(pb,
161  speedhq_chr_dc_uni[diff + 255] & 0xFF,
162  speedhq_chr_dc_uni[diff + 255] >> 8);
163  }
164 }
165 
166 static void encode_block(MPVEncContext *const s, const int16_t block[], int n)
167 {
168  int alevel, level, last_non_zero, dc, i, j, run, last_index, sign;
169  int code;
170  int component, val;
171 
172  /* DC coef */
173  component = (n <= 3 ? 0 : (n&1) + 1);
174  dc = block[0]; /* overflow is impossible */
175  val = s->c.last_dc[component] - dc; /* opposite of most codecs */
176  encode_dc(&s->pb, val, component);
177  s->c.last_dc[component] = dc;
178 
179  /* now quantify & encode AC coefs */
180  last_non_zero = 0;
181  last_index = s->c.block_last_index[n];
182 
183  for (i = 1; i <= last_index; i++) {
184  j = s->c.intra_scantable.permutated[i];
185  level = block[j];
186 
187  /* encode using VLC */
188  if (level != 0) {
189  run = i - last_non_zero - 1;
190 
191  alevel = level;
192  MASK_ABS(sign, alevel);
193  sign &= 1;
194 
195  if (alevel <= speedhq_max_level[run]) {
196  code = speedhq_index_run[run] + alevel - 1;
197  /* store the VLC & sign at once */
198  put_bits_le(&s->pb, ff_speedhq_vlc_table[code][1] + 1,
199  ff_speedhq_vlc_table[code][0] | (sign << ff_speedhq_vlc_table[code][1]));
200  } else {
201  /* escape seems to be pretty rare <5% so I do not optimize it;
202  * The following encodes the escape value 100000b together with
203  * run and level. */
204  put_bits_le(&s->pb, 6 + 6 + 12, 0x20 | run << 6 |
205  (level + 2048) << 12);
206  }
207  last_non_zero = i;
208  }
209  }
210  /* end of block; the values correspond to ff_speedhq_vlc_table[122] */
211  put_bits_le(&s->pb, 4, 6);
212 }
213 
214 static void speedhq_encode_mb(MPVEncContext *const s, int16_t block[12][64],
215  int unused_x, int unused_y)
216 {
217  int i;
218  for(i=0;i<6;i++) {
219  encode_block(s, block[i], i);
220  }
221  if (s->c.chroma_format == CHROMA_444) {
222  encode_block(s, block[8], 8);
223  encode_block(s, block[9], 9);
224 
225  encode_block(s, block[6], 6);
226  encode_block(s, block[7], 7);
227 
228  encode_block(s, block[10], 10);
229  encode_block(s, block[11], 11);
230  } else if (s->c.chroma_format == CHROMA_422) {
231  encode_block(s, block[6], 6);
232  encode_block(s, block[7], 7);
233  }
234 
235  s->i_tex_bits += get_bits_diff(s);
236 }
237 
239 {
240  static AVOnce init_static_once = AV_ONCE_INIT;
241  MPVMainEncContext *const m = avctx->priv_data;
242  MPVEncContext *const s = &m->s;
243  int ret;
244 
245  if (avctx->width > 65500 || avctx->height > 65500) {
246  av_log(avctx, AV_LOG_ERROR, "SpeedHQ does not support resolutions above 65500x65500\n");
247  return AVERROR(EINVAL);
248  }
249 
250  // border is not implemented correctly at the moment, see ticket #10078
251  if (avctx->width % 16) {
252  av_log(avctx, AV_LOG_ERROR, "width must be a multiple of 16\n");
253  return AVERROR_PATCHWELCOME;
254  }
255 
256  switch (avctx->pix_fmt) {
257  case AV_PIX_FMT_YUV420P:
258  avctx->codec_tag = MKTAG('S','H','Q','0');
259  break;
260  case AV_PIX_FMT_YUV422P:
261  avctx->codec_tag = MKTAG('S','H','Q','2');
262  break;
263  case AV_PIX_FMT_YUV444P:
264  avctx->codec_tag = MKTAG('S','H','Q','4');
265  break;
266  default:
267  av_unreachable("Already checked via CODEC_PIXFMTS");
268  }
269 
271  s->encode_mb = speedhq_encode_mb;
272 
273  s->min_qcoeff = -2048;
274  s->max_qcoeff = 2047;
275 
276  s->intra_ac_vlc_length =
277  s->intra_ac_vlc_last_length =
278  s->intra_chroma_ac_vlc_length =
279  s->intra_chroma_ac_vlc_last_length = uni_speedhq_ac_vlc_len;
280 
281  s->c.y_dc_scale_table =
282  s->c.c_dc_scale_table = ff_mpeg12_dc_scale_table[3];
283 
284  ret = ff_mpv_encode_init(avctx);
285  if (ret < 0)
286  return ret;
287 
288  ff_thread_once(&init_static_once, speedhq_init_static_data);
289 
290  return 0;
291 }
292 
294  .p.name = "speedhq",
295  CODEC_LONG_NAME("NewTek SpeedHQ"),
296  .p.type = AVMEDIA_TYPE_VIDEO,
297  .p.id = AV_CODEC_ID_SPEEDHQ,
298  .p.priv_class = &ff_mpv_enc_class,
300  .priv_data_size = sizeof(SpeedHQEncContext),
303  .close = ff_mpv_encode_end,
304  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
305  .color_ranges = AVCOL_RANGE_MPEG,
307 };
CODEC_PIXFMTS
#define CODEC_PIXFMTS(...)
Definition: codec_internal.h:386
ff_mpv_enc_class
const AVClass ff_mpv_enc_class
Definition: mpegvideo_enc.c:104
level
uint8_t level
Definition: svq3.c:208
MPVEncContext
Definition: mpegvideoenc.h:46
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:42
uni_speedhq_ac_vlc_len
static uint8_t uni_speedhq_ac_vlc_len[64 *64 *2]
Definition: speedhqenc.c:62
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
put_bytes_output
static int put_bytes_output(const PutBitContext *s)
Definition: put_bits.h:99
thread.h
ff_speedhq_end_slice
void ff_speedhq_end_slice(MPVEncContext *const s)
Definition: speedhqenc.c:118
mpegvideoenc.h
ff_rl_init_level_run
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...
Definition: rl.c:26
MAX_RUN
#define MAX_RUN
Definition: rl.h:35
av_log2_16bit
int av_log2_16bit(unsigned v)
Definition: intmath.c:31
FFCodec
Definition: codec_internal.h:127
MASK_ABS
#define MASK_ABS(mask, level)
Definition: mathops.h:166
speedhqenc.h
SpeedHQEncContext::m
MPVMainEncContext m
Definition: speedhqenc.c:65
ff_mpeg12_dc_scale_table
const uint8_t ff_mpeg12_dc_scale_table[4][32]
Definition: mpegvideodata.c:33
mpegvideo.h
speedhq_encode_picture_header
static int speedhq_encode_picture_header(MPVMainEncContext *const m)
Definition: speedhqenc.c:101
ff_mpeg12_vlc_dc_chroma_bits
const unsigned char ff_mpeg12_vlc_dc_chroma_bits[12]
Definition: mpeg12data.c:63
MPVMainEncContext::encode_picture_header
int(* encode_picture_header)(struct MPVMainEncContext *m)
Definition: mpegvideoenc.h:248
ff_mpeg12_vlc_dc_lum_bits
const unsigned char ff_mpeg12_vlc_dc_lum_bits[12]
Definition: mpeg12data.c:56
ff_mpv_encode_picture
int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic_arg, int *got_packet)
Definition: mpegvideo_enc.c:1942
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
speedhq_lum_dc_uni
static uint32_t speedhq_lum_dc_uni[512]
Definition: speedhqenc.c:59
SpeedHQEncContext
Definition: speedhqenc.c:64
mpeg12vlc.h
val
static double val(void *priv, double ch)
Definition: aeval.c:77
FF_CODEC_ENCODE_CB
#define FF_CODEC_ENCODE_CB(func)
Definition: codec_internal.h:353
mpeg12_vlc_dc_chroma_code_reversed
static const uint16_t mpeg12_vlc_dc_chroma_code_reversed[12]
Definition: speedhqenc.c:53
speedhq_max_level
static uint8_t speedhq_max_level[MAX_LEVEL+1]
Definition: speedhqenc.c:46
SpeedHQEncContext::slice_start
int slice_start
Definition: speedhqenc.c:67
avassert.h
ff_thread_once
static int ff_thread_once(char *control, void(*routine)(void))
Definition: thread.h:205
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
av_cold
#define av_cold
Definition: attributes.h:90
s
#define s(width, name)
Definition: cbs_vp9.c:198
CHROMA_422
#define CHROMA_422
Definition: mpegvideo.h:265
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
Definition: codec.h:144
bits
uint8_t bits
Definition: vp3data.h:128
encode_block
static void encode_block(MPVEncContext *const s, const int16_t block[], int n)
Definition: speedhqenc.c:166
ctx
AVFormatContext * ctx
Definition: movenc.c:49
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
PutBitContext
Definition: put_bits.h:50
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:326
FFABS
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:74
AV_ONCE_INIT
#define AV_ONCE_INIT
Definition: thread.h:203
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:64
run
uint8_t run
Definition: svq3.c:207
av_unreachable
#define av_unreachable(msg)
Asserts that are used as compiler optimization hints depending upon ASSERT_LEVEL and NBDEBUG.
Definition: avassert.h:109
AV_WL24
#define AV_WL24(p, d)
Definition: intreadwrite.h:460
AV_CODEC_ID_SPEEDHQ
@ AV_CODEC_ID_SPEEDHQ
Definition: codec_id.h:279
mathops.h
ff_mpv_encode_end
av_cold int ff_mpv_encode_end(AVCodecContext *avctx)
Definition: mpegvideo_enc.c:1122
flush_put_bits_le
static void flush_put_bits_le(PutBitContext *s)
Definition: put_bits.h:174
MPVMainEncContext
Definition: mpegvideoenc.h:199
AVOnce
#define AVOnce
Definition: thread.h:202
index
int index
Definition: gxfenc.c:90
MAX_LEVEL
#define MAX_LEVEL
Definition: rl.h:36
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
dc
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2] ... the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so ...,+,-,+,-,+,+,-,+,-,+,... hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32 - hcoeff[1] - hcoeff[2] - ... a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2} an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||......... intra?||||:Block01 :yes no||||:Block02 :....... ..........||||:Block03 ::y DC ::ref index:||||:Block04 ::cb DC ::motion x :||||......... :cr DC ::motion y :||||....... ..........|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------ ------------ ------------|||Y subbands||Cb subbands||Cr subbands||||--- ---||--- ---||--- ---|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------ ------------ ------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction ------------|\ Dequantization ------------------- \||Reference frames|\ IDWT|------- -------|Motion \|||Frame 0||Frame 1||Compensation . OBMC v -------|------- -------|--------------. \------> Frame n output Frame Frame<----------------------------------/|...|------------------- Range Coder:============Binary Range Coder:------------------- The implemented range coder is an adapted version based upon "Range encoding: an algorithm for removing redundancy from a digitised message." by G. N. N. Martin. The symbols encoded by the Snow range coder are bits(0|1). The associated probabilities are not fix but change depending on the symbol mix seen so far. bit seen|new state ---------+----------------------------------------------- 0|256 - state_transition_table[256 - old_state];1|state_transition_table[old_state];state_transition_table={ 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:------------------------- FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1. the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled top and top right vectors is used as motion vector prediction the used motion vector is the sum of the predictor and(mvx_diff, mvy_diff) *mv_scale Intra DC Prediction block[y][x] dc[1]
Definition: snow.txt:400
codec_internal.h
put_bits_assume_flushed
static void put_bits_assume_flushed(const PutBitContext *s)
Inform the compiler that a PutBitContext is flushed (i.e.
Definition: put_bits.h:82
diff
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
Definition: vf_paletteuse.c:166
speedhq_index_run
static uint8_t speedhq_index_run[MAX_RUN+1]
Definition: speedhqenc.c:47
mpegvideodata.h
speedhq_encode_mb
static void speedhq_encode_mb(MPVEncContext *const s, int16_t block[12][64], int unused_x, int unused_y)
Definition: speedhqenc.c:214
av_zero_extend
#define av_zero_extend
Definition: common.h:151
encode_dc
static void encode_dc(PutBitContext *pb, int diff, int component)
Definition: speedhqenc.c:132
speedhq.h
CHROMA_444
#define CHROMA_444
Definition: mpegvideo.h:266
get_bits_diff
static int get_bits_diff(MPVEncContext *s)
Definition: mpegvideoenc.h:409
speedhq_chr_dc_uni
static uint32_t speedhq_chr_dc_uni[512]
Definition: speedhqenc.c:60
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
code
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
Definition: filter_design.txt:178
ff_speedhq_vlc_table
const uint16_t ff_speedhq_vlc_table[SPEEDHQ_RL_NB_ELEMS+2][2]
Definition: speedhq.c:26
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:179
AVCodecContext::height
int height
Definition: avcodec.h:592
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:631
AVCOL_RANGE_MPEG
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition: pixfmt.h:750
speedhq_init_static_data
static av_cold void speedhq_init_static_data(void)
Definition: speedhqenc.c:70
ff_mpeg1_init_uni_ac_vlc
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[])
Definition: mpeg12enc.c:102
avcodec.h
ret
ret
Definition: filter_design.txt:187
mpeg12data.h
AVCodecContext
main external API structure.
Definition: avcodec.h:431
ff_speedhq_encoder
const FFCodec ff_speedhq_encoder
Definition: speedhqenc.c:293
ff_speedhq_level
const uint8_t ff_speedhq_level[121]
Definition: speedhq.c:62
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
mpeg12_vlc_dc_lum_code_reversed
static const uint16_t mpeg12_vlc_dc_lum_code_reversed[12]
Definition: speedhqenc.c:50
ff_speedhq_run
const uint8_t ff_speedhq_run[121]
Definition: speedhq.c:81
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
ff_mpv_encode_init
av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
Definition: mpegvideo_enc.c:559
AVCodecContext::codec_tag
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Definition: avcodec.h:456
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:458
rl.h
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:592
speedhq_encode_init
static av_cold int speedhq_encode_init(AVCodecContext *avctx)
Definition: speedhqenc.c:238
block
The exact code depends on how similar the blocks are and how related they are to the block
Definition: filter_design.txt:207
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
put_bits_le
static void put_bits_le(PutBitContext *s, int n, BitBuf value)
Definition: put_bits.h:263
MKTAG
#define MKTAG(a, b, c, d)
Definition: macros.h:55
put_bits.h
av_log2
int av_log2(unsigned v)
Definition: intmath.c:26
MPVMainEncContext::s
MPVEncContext s
The main slicecontext.
Definition: mpegvideoenc.h:200
SPEEDHQ_RL_NB_ELEMS
#define SPEEDHQ_RL_NB_ELEMS
Definition: speedhq.h:27