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/pixdesc.h"
31 #include "libavutil/thread.h"
32 
33 #include "avcodec.h"
34 #include "mpeg12.h"
35 #include "mpegvideo.h"
36 #include "speedhqenc.h"
37 
38 extern RLTable ff_rl_speedhq;
40 
41 static uint16_t mpeg12_vlc_dc_lum_code_reversed[12];
43 
44 /* simple include everything table for dc, first byte is bits
45  * number next 3 are code */
46 static uint32_t speedhq_lum_dc_uni[512];
47 static uint32_t speedhq_chr_dc_uni[512];
48 
49 static uint8_t speedhq_index_run[2][64];
50 static int8_t speedhq_max_level[2][64];
51 
52 static uint8_t uni_speedhq_ac_vlc_len[64 * 64 * 2];
53 
54 static uint32_t reverse(uint32_t num, int bits)
55 {
56  return bitswap_32(num) >> (32 - bits);
57 }
58 
59 static void reverse_code(const uint16_t *code, const uint8_t *bits,
60  uint16_t *reversed_code, int num_entries)
61 {
62  for (int i = 0; i < num_entries; i++)
63  reversed_code[i] = reverse(code[i], bits[i]);
64 }
65 
67 {
68  /* Exactly the same as MPEG-2, except little-endian. */
72  12);
76  12);
77 
79 
80  for (int i = 0; i < 64; i++) {
81  speedhq_max_level[0][i] = ff_rl_speedhq.max_level[0][i];
82  speedhq_index_run[0][i] = ff_rl_speedhq.index_run[0][i];
83  }
84 
85  /* build unified dc encoding tables */
86  for (int i = -255; i < 256; i++) {
87  int adiff, index;
88  int bits, code;
89  int diff = i;
90 
91  adiff = FFABS(diff);
92  if (diff < 0)
93  diff--;
94  index = av_log2(2 * adiff);
95 
98  (av_mod_uintp2(diff, index) << ff_mpeg12_vlc_dc_lum_bits[index]);
99  speedhq_lum_dc_uni[i + 255] = bits + (code << 8);
100 
103  (av_mod_uintp2(diff, index) << ff_mpeg12_vlc_dc_chroma_bits[index]);
104  speedhq_chr_dc_uni[i + 255] = bits + (code << 8);
105  }
106 
108 }
109 
111 {
112  static AVOnce init_static_once = AV_ONCE_INIT;
113 
115 
116  if (s->width > 65500 || s->height > 65500) {
117  av_log(s, AV_LOG_ERROR, "SpeedHQ does not support resolutions above 65500x65500\n");
118  return AVERROR(EINVAL);
119  }
120 
121  s->min_qcoeff = -2048;
122  s->max_qcoeff = 2047;
123 
124  ff_thread_once(&init_static_once, speedhq_init_static_data);
125 
130 
131  switch (s->avctx->pix_fmt) {
132  case AV_PIX_FMT_YUV420P:
133  s->avctx->codec_tag = MKTAG('S','H','Q','0');
134  break;
135  case AV_PIX_FMT_YUV422P:
136  s->avctx->codec_tag = MKTAG('S','H','Q','2');
137  break;
138  case AV_PIX_FMT_YUV444P:
139  s->avctx->codec_tag = MKTAG('S','H','Q','4');
140  break;
141  default:
142  av_assert0(0);
143  }
144 
145  return 0;
146 }
147 
149 {
150  put_bits_le(&s->pb, 8, 100 - s->qscale * 2); /* FIXME why doubled */
151  put_bits_le(&s->pb, 24, 4); /* no second field */
152 
153  /* length of first slice, will be filled out later */
154  s->slice_start = 4;
155  put_bits_le(&s->pb, 24, 0);
156 }
157 
159 {
160  int slice_len;
161 
162  flush_put_bits_le(&s->pb);
163  slice_len = s->pb.buf_ptr - (s->pb.buf + s->slice_start);
164  AV_WL24(s->pb.buf + s->slice_start, slice_len);
165 
166  /* length of next slice, will be filled out later */
167  s->slice_start = s->pb.buf_ptr - s->pb.buf;
168  put_bits_le(&s->pb, 24, 0);
169 }
170 
171 static inline void encode_dc(PutBitContext *pb, int diff, int component)
172 {
173  unsigned int diff_u = diff + 255;
174  if (diff_u >= 511) {
175  int index;
176 
177  if (diff < 0) {
178  index = av_log2_16bit(-2 * diff);
179  diff--;
180  } else {
181  index = av_log2_16bit(2 * diff);
182  }
183  if (component == 0)
184  put_bits_le(pb,
185  ff_mpeg12_vlc_dc_lum_bits[index] + index,
187  (av_mod_uintp2(diff, index) << ff_mpeg12_vlc_dc_lum_bits[index]));
188  else
189  put_bits_le(pb,
190  ff_mpeg12_vlc_dc_chroma_bits[index] + index,
192  (av_mod_uintp2(diff, index) << ff_mpeg12_vlc_dc_chroma_bits[index]));
193  } else {
194  if (component == 0)
195  put_bits_le(pb,
196  speedhq_lum_dc_uni[diff + 255] & 0xFF,
197  speedhq_lum_dc_uni[diff + 255] >> 8);
198  else
199  put_bits_le(pb,
200  speedhq_chr_dc_uni[diff + 255] & 0xFF,
201  speedhq_chr_dc_uni[diff + 255] >> 8);
202  }
203 }
204 
205 static void encode_block(MpegEncContext *s, int16_t *block, int n)
206 {
207  int alevel, level, last_non_zero, dc, i, j, run, last_index, sign;
208  int code;
209  int component, val;
210 
211  /* DC coef */
212  component = (n <= 3 ? 0 : (n&1) + 1);
213  dc = block[0]; /* overflow is impossible */
214  val = s->last_dc[component] - dc; /* opposite of most codecs */
215  encode_dc(&s->pb, val, component);
216  s->last_dc[component] = dc;
217 
218  /* now quantify & encode AC coefs */
219  last_non_zero = 0;
220  last_index = s->block_last_index[n];
221 
222  for (i = 1; i <= last_index; i++) {
223  j = s->intra_scantable.permutated[i];
224  level = block[j];
225 
226  /* encode using VLC */
227  if (level != 0) {
228  run = i - last_non_zero - 1;
229 
230  alevel = level;
231  MASK_ABS(sign, alevel);
232  sign &= 1;
233 
234  if (alevel <= speedhq_max_level[0][run]) {
235  code = speedhq_index_run[0][run] + alevel - 1;
236  /* store the VLC & sign at once */
237  put_bits_le(&s->pb, ff_rl_speedhq.table_vlc[code][1] + 1,
238  ff_rl_speedhq.table_vlc[code][0] + (sign << ff_rl_speedhq.table_vlc[code][1]));
239  } else {
240  /* escape seems to be pretty rare <5% so I do not optimize it */
241  put_bits_le(&s->pb, ff_rl_speedhq.table_vlc[121][1], ff_rl_speedhq.table_vlc[121][0]);
242  /* escape: only clip in this case */
243  put_bits_le(&s->pb, 6, run);
244  put_bits_le(&s->pb, 12, level + 2048);
245  }
246  last_non_zero = i;
247  }
248  }
249  /* end of block */
250  put_bits_le(&s->pb, ff_rl_speedhq.table_vlc[122][1], ff_rl_speedhq.table_vlc[122][0]);
251 }
252 
254 {
255  int i;
256  for(i=0;i<6;i++) {
257  encode_block(s, block[i], i);
258  }
259  if (s->chroma_format == CHROMA_444) {
260  encode_block(s, block[8], 8);
261  encode_block(s, block[9], 9);
262 
263  encode_block(s, block[6], 6);
264  encode_block(s, block[7], 7);
265 
266  encode_block(s, block[10], 10);
267  encode_block(s, block[11], 11);
268  } else if (s->chroma_format == CHROMA_422) {
269  encode_block(s, block[6], 6);
270  encode_block(s, block[7], 7);
271  }
272 
273  s->i_tex_bits += get_bits_diff(s);
274 }
275 
276 static int ff_speedhq_mb_rows_in_slice(int slice_num, int mb_height)
277 {
278  return mb_height / 4 + (slice_num < (mb_height % 4));
279 }
280 
281 int ff_speedhq_mb_y_order_to_mb(int mb_y_order, int mb_height, int *first_in_slice)
282 {
283  int slice_num = 0;
284  while (mb_y_order >= ff_speedhq_mb_rows_in_slice(slice_num, mb_height)) {
285  mb_y_order -= ff_speedhq_mb_rows_in_slice(slice_num, mb_height);
286  slice_num++;
287  }
288  *first_in_slice = (mb_y_order == 0);
289  return mb_y_order * 4 + slice_num;
290 }
291 
292 #if CONFIG_SPEEDHQ_ENCODER
293 static const AVClass speedhq_class = {
294  .class_name = "speedhq encoder",
295  .item_name = av_default_item_name,
296  .option = ff_mpv_generic_options,
297  .version = LIBAVUTIL_VERSION_INT,
298 };
299 
301  .name = "speedhq",
302  .long_name = NULL_IF_CONFIG_SMALL("NewTek SpeedHQ"),
303  .type = AVMEDIA_TYPE_VIDEO,
304  .id = AV_CODEC_ID_SPEEDHQ,
305  .priv_data_size = sizeof(MpegEncContext),
307  .encode2 = ff_mpv_encode_picture,
308  .close = ff_mpv_encode_end,
309  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
310  .pix_fmts = (const enum AVPixelFormat[]) {
313  },
314  .priv_class = &speedhq_class,
315 };
316 #endif
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: internal.h:48
#define MASK_ABS(mask, level)
Definition: mathops.h:155
static uint8_t uni_speedhq_ac_vlc_len[64 *64 *2]
Definition: speedhqenc.c:52
void ff_mpeg1_init_uni_ac_vlc(const RLTable *rl, uint8_t *uni_ac_vlc_len)
Definition: mpeg12enc.c:71
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
void ff_speedhq_encode_picture_header(MpegEncContext *s)
Definition: speedhqenc.c:148
static av_always_inline uint32_t bitswap_32(uint32_t x)
Definition: mathops.h:243
const unsigned char ff_mpeg12_vlc_dc_lum_bits[12]
Definition: mpeg12data.c:55
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
int av_log2(unsigned v)
Definition: intmath.c:26
void ff_speedhq_end_slice(MpegEncContext *s)
Definition: speedhqenc.c:158
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:741
int min_qcoeff
minimum encodable coefficient
Definition: mpegvideo.h:308
mpegvideo header.
uint8_t permutated[64]
Definition: idctdsp.h:33
const uint16_t ff_mpeg12_vlc_dc_lum_code[12]
Definition: mpeg12data.c:52
uint8_t run
Definition: svq3.c:205
uint8_t * intra_ac_vlc_length
Definition: mpegvideo.h:311
int av_log2_16bit(unsigned v)
Definition: intmath.c:31
AVCodec.
Definition: codec.h:190
int qscale
QP.
Definition: mpegvideo.h:204
RLTable.
Definition: rl.h:39
static void encode_block(MpegEncContext *s, int16_t *block, int n)
Definition: speedhqenc.c:205
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:72
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
#define AV_WL24(p, d)
Definition: intreadwrite.h:464
const AVOption ff_mpv_generic_options[]
Definition: mpegvideo_enc.c:87
The exact code depends on how similar the blocks are and how related they are to the block
uint8_t
#define av_cold
Definition: attributes.h:88
static uint32_t speedhq_lum_dc_uni[512]
Definition: speedhqenc.c:46
int8_t * max_level[2]
encoding & decoding
Definition: rl.h:46
static uint32_t reverse(uint32_t num, int bits)
Definition: speedhqenc.c:54
int max_qcoeff
maximum encodable coefficient
Definition: mpegvideo.h:309
#define AVOnce
Definition: thread.h:172
#define MAX_LEVEL
Definition: rl.h:36
#define CHROMA_444
Definition: mpegvideo.h:488
#define av_log(a,...)
static int get_bits_diff(MpegEncContext *s)
Definition: mpegvideo.h:757
int slice_context_count
number of used thread_contexts
Definition: mpegvideo.h:156
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:194
int last_dc[3]
last DC values for MPEG-1
Definition: mpegvideo.h:185
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:115
static uint8_t speedhq_index_run[2][64]
Definition: speedhqenc.c:49
const uint16_t ff_mpeg12_vlc_dc_chroma_code[12]
Definition: mpeg12data.c:59
uint8_t * intra_chroma_ac_vlc_length
Definition: mpegvideo.h:313
uint8_t * buf
Definition: put_bits.h:54
static int8_t speedhq_max_level[2][64]
Definition: speedhqenc.c:50
const char * name
Name of the codec implementation.
Definition: codec.h:197
uint8_t bits
Definition: vp3data.h:141
RLTable ff_rl_speedhq
Definition: speedhq.c:137
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
static void flush_put_bits_le(PutBitContext *s)
Definition: put_bits.h:138
uint8_t * intra_ac_vlc_last_length
Definition: mpegvideo.h:312
static void put_bits_le(PutBitContext *s, int n, BitBuf value)
Definition: put_bits.h:232
#define CHROMA_422
Definition: mpegvideo.h:487
const uint16_t(* table_vlc)[2]
Definition: rl.h:42
SpeedHQ encoder.
static uint16_t mpeg12_vlc_dc_chroma_code_reversed[12]
Definition: speedhqenc.c:42
const unsigned char ff_mpeg12_vlc_dc_chroma_bits[12]
Definition: mpeg12data.c:62
static uint8_t speedhq_static_rl_table_store[2][2 *MAX_RUN+MAX_LEVEL+3]
Definition: speedhqenc.c:39
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:72
#define s(width, name)
Definition: cbs_vp9.c:257
int block_last_index[12]
last non zero coefficient in block
Definition: mpegvideo.h:86
static uint32_t speedhq_chr_dc_uni[512]
Definition: speedhqenc.c:47
av_cold void ff_rl_init(RLTable *rl, uint8_t static_store[2][2 *MAX_RUN+MAX_LEVEL+3])
Definition: rl.c:28
#define AV_ONCE_INIT
Definition: thread.h:173
AVCodec ff_speedhq_encoder
Libavcodec external API header.
static int ff_speedhq_mb_rows_in_slice(int slice_num, int mb_height)
Definition: speedhqenc.c:276
uint8_t * intra_chroma_ac_vlc_last_length
Definition: mpegvideo.h:314
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
ScanTable intra_scantable
Definition: mpegvideo.h:91
int height
picture size. must be a multiple of 16
Definition: mpegvideo.h:100
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> (&#39;D&#39;<<24) + (&#39;C&#39;<<16) + (&#39;B&#39;<<8) + &#39;A&#39;).
Definition: avcodec.h:556
static void encode_dc(PutBitContext *pb, int diff, int component)
Definition: speedhqenc.c:171
int ff_mpv_encode_init(AVCodecContext *avctx)
uint8_t * buf_ptr
Definition: put_bits.h:54
void ff_speedhq_encode_mb(MpegEncContext *s, int16_t block[12][64])
Definition: speedhqenc.c:253
Describe the class of an AVClass context structure.
Definition: log.h:67
int index
Definition: gxfenc.c:89
uint8_t * index_run[2]
encoding only
Definition: rl.h:45
int ff_speedhq_mb_y_order_to_mb(int mb_y_order, int mb_height, int *first_in_slice)
Definition: speedhqenc.c:281
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:303
static av_cold void speedhq_init_static_data(void)
Definition: speedhqenc.c:66
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
uint8_t level
Definition: svq3.c:206
MpegEncContext.
Definition: mpegvideo.h:81
#define MAX_RUN
Definition: rl.h:35
struct AVCodecContext * avctx
Definition: mpegvideo.h:98
PutBitContext pb
bit output
Definition: mpegvideo.h:151
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
static void reverse_code(const uint16_t *code, const uint8_t *bits, uint16_t *reversed_code, int num_entries)
Definition: speedhqenc.c:59
int ff_mpv_encode_end(AVCodecContext *avctx)
static av_always_inline int diff(const uint32_t a, const uint32_t b)
static int ff_thread_once(char *control, void(*routine)(void))
Definition: thread.h:175
av_cold int ff_speedhq_encode_init(MpegEncContext *s)
Definition: speedhqenc.c:110
static uint16_t mpeg12_vlc_dc_lum_code_reversed[12]
Definition: speedhqenc.c:41
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
#define MKTAG(a, b, c, d)
Definition: common.h:405
int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
static double val(void *priv, double ch)
Definition: aeval.c:76
int i
Definition: input.c:407