FFmpeg
vqcdec.c
Go to the documentation of this file.
1 /*
2  * ViewQuest VQC decoder
3  * Copyright (C) 2022 Peter Ross
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "avcodec.h"
23 #include "get_bits.h"
24 #include "codec_internal.h"
25 #include "decode.h"
26 #include "libavutil/thread.h"
27 
28 #define VECTOR_VLC_BITS 6
29 
30 static const uint8_t vector_nbits[] = {
31  2, 4, 4, 4, 4, 2, 4, 4,
32  6, 6, 6, 6, 6, 6, 6, 6
33 };
34 
35 enum {
36  SKIP_3 = 0x10,
43 };
44 
45 /* vector symbols are signed, but returned unsigned by get_vlc2()
46  codebook indexes are cast as uint8_t in seed_codebook() to compensate */
47 static const int8_t vector_symbols[] = {
48  0, SKIP_3, SKIP_4, SKIP_5, SKIP_6, STOP_RUN, 1, -1,
49  2, 3, 4, SIGNED_8BIT, -2, -3, -4, SIGNED_6BIT
50 };
51 
53 
54 static av_cold void vqc_init_static_data(void)
55 {
58  vector_nbits, 1,
59  vector_symbols, 1, 1,
60  0, 0);
61 }
62 
63 typedef struct VqcContext {
65  uint8_t * vectors;
66  int16_t * coeff, *tmp1, *tmp2;
67  int16_t codebook[4][256];
68 } VqcContext;
69 
71 {
72  static AVOnce init_static_once = AV_ONCE_INIT;
73  VqcContext *s = avctx->priv_data;
74 
75  if (avctx->width & 15)
76  return AVERROR_PATCHWELCOME;
77 
78  s->vectors = av_malloc((avctx->width * avctx->height * 3) / 2);
79  if (!s->vectors)
80  return AVERROR(ENOMEM);
81 
82  s->coeff = av_malloc_array(2 * avctx->width, sizeof(s->coeff[0]));
83  if (!s->coeff)
84  return AVERROR(ENOMEM);
85 
86  s->tmp1 = av_malloc_array(avctx->width / 2, sizeof(s->tmp1[0]));
87  if (!s->tmp1)
88  return AVERROR(ENOMEM);
89 
90  s->tmp2 = av_malloc_array(avctx->width / 2, sizeof(s->tmp2[0]));
91  if (!s->tmp2)
92  return AVERROR(ENOMEM);
93 
94  avctx->pix_fmt = AV_PIX_FMT_YUV420P;
95  s->frame = av_frame_alloc();
96  if (!s->frame)
97  return AVERROR(ENOMEM);
98 
99  ff_thread_once(&init_static_once, vqc_init_static_data);
100 
101  return 0;
102 }
103 
104 static int seed_pow1(int x)
105 {
106  return x >= 1 && x <= 5 ? 1 << x : 0;
107 }
108 
109 static int seed_pow2(int x)
110 {
111  return x >= 1 && x <= 4 ? 1 << x : 1;
112 }
113 
114 static int bias(int x, int c)
115 {
116  if (x < 0)
117  return x - c;
118  else if (x > 0)
119  return x + c;
120  else
121  return 0;
122 }
123 
124 static void seed_codebooks(VqcContext * s, const int * seed)
125 {
126  int book1 = -256 * seed[3];
127  int book2 = -128 * seed[4];
128  int book3 = -128 * seed[5];
129  int book4 = -128 * seed[6];
130 
131  for (int i = -128; i < 128; i++) {
132  s->codebook[0][(uint8_t)i] = book1;
133  s->codebook[1][(uint8_t)i] = bias(book2, seed[0]);
134  s->codebook[2][(uint8_t)i] = bias(book3, seed[1]);
135  s->codebook[3][(uint8_t)i] = bias(book4, seed[2]);
136 
137  book1 += 2 * seed[3];
138  book2 += seed[4];
139  book3 += seed[5];
140  book4 += seed[6];
141  }
142 }
143 
144 static int decode_vectors(VqcContext * s, const uint8_t * buf, int size, int width, int height)
145 {
146  GetBitContext gb;
147  uint8_t * vectors = s->vectors;
148  uint8_t * vectors_end = s->vectors + (width * height * 3) / 2;
149  int ret;
150 
151  memset(vectors, 0, 3 * width * height / 2);
152 
153  ret = init_get_bits8(&gb, buf, size);
154  if (ret < 0)
155  return ret;
156 
157  for (int i = 0; i < 3 * width * height / 2 / 32; i++) {
158  uint8_t * dst = vectors;
159  int symbol;
160 
161  *dst++ = get_bits(&gb, 8);
162  *dst++ = get_bits(&gb, 8);
163 
164  while (show_bits(&gb, 2) != 2) {
165  if (dst >= vectors_end - 1)
166  return 0;
167 
168  if (get_bits_left(&gb) < 4)
169  return AVERROR_INVALIDDATA;
170 
171  if (!show_bits(&gb, 4)) {
172  *dst++ = 0;
173  *dst++ = 0;
174  skip_bits(&gb, 4);
175  continue;
176  }
177 
178  symbol = get_vlc2(&gb, vector_vlc, VECTOR_VLC_BITS, 1);
179  switch(symbol) {
180  case SKIP_3: dst += 3; break;
181  case SKIP_4: dst += 4; break;
182  case SKIP_5: dst += 5; break;
183  case SKIP_6: dst += 6; break;
184  case SIGNED_8BIT: *dst++ = get_sbits(&gb, 8); break;
185  case SIGNED_6BIT: *dst++ = get_sbits(&gb, 6); break;
186  default:
187  *dst++ = symbol;
188  }
189  }
190 
191  skip_bits(&gb, 2);
192  vectors += 32;
193  }
194 
195  return 0;
196 }
197 
198 static void load_coeffs(VqcContext * s, const uint8_t * v, int width, int coeff_width)
199 {
200  int16_t * c0 = s->coeff;
201  int16_t * c1 = s->coeff + coeff_width;
202  int16_t * c0_125 = s->coeff + (coeff_width >> 3);
203  int16_t * c1_125 = s->coeff + coeff_width + (coeff_width >> 3);
204  int16_t * c0_25 = s->coeff + (coeff_width >> 2);
205  int16_t * c1_25 = s->coeff + coeff_width + (coeff_width >> 2);
206  int16_t * c0_5 = s->coeff + (coeff_width >> 1);
207  int16_t * c1_5 = s->coeff + coeff_width + (coeff_width >> 1);
208 
209  for (int i = 0; i < width; i++) {
210  c0[0] = s->codebook[0][v[0]];
211  c0[1] = s->codebook[0][v[1]];
212  c0 += 2;
213 
214  c1[0] = s->codebook[0][v[2]];
215  c1[1] = s->codebook[0][v[3]];
216  c1 += 2;
217 
218  c0_125[0] = s->codebook[1][v[4]];
219  c0_125[1] = s->codebook[1][v[5]];
220  c0_125 += 2;
221 
222  c1_125[0] = s->codebook[1][v[6]];
223  c1_125[1] = s->codebook[1][v[7]];
224  c1_125 += 2;
225 
226  c0_25[0] = s->codebook[2][v[8]];
227  c0_25[1] = s->codebook[2][v[9]];
228  c0_25[2] = s->codebook[2][v[10]];
229  c0_25[3] = s->codebook[2][v[11]];
230  c0_25 += 4;
231 
232  c1_25[0] = s->codebook[2][v[12]];
233  c1_25[1] = s->codebook[2][v[13]];
234  c1_25[2] = s->codebook[2][v[14]];
235  c1_25[3] = s->codebook[2][v[15]];
236  c1_25 += 4;
237 
238  if (v[16] | v[17] | v[18] | v[19]) {
239  c0_5[0] = s->codebook[3][v[16]];
240  c0_5[1] = s->codebook[3][v[17]];
241  c0_5[2] = s->codebook[3][v[18]];
242  c0_5[3] = s->codebook[3][v[19]];
243  } else {
244  c0_5[0] = c0_5[1] = c0_5[2] = c0_5[3] = 0;
245  }
246 
247  if (v[20] | v[21] | v[22] | v[23]) {
248  c0_5[4] = s->codebook[3][v[20]];
249  c0_5[5] = s->codebook[3][v[21]];
250  c0_5[6] = s->codebook[3][v[22]];
251  c0_5[7] = s->codebook[3][v[23]];
252  } else {
253  c0_5[4] = c0_5[5] = c0_5[6] = c0_5[7] = 0;
254  }
255  c0_5 += 8;
256 
257  if (v[24] | v[25] | v[26] | v[27]) {
258  c1_5[0] = s->codebook[3][v[24]];
259  c1_5[1] = s->codebook[3][v[25]];
260  c1_5[2] = s->codebook[3][v[26]];
261  c1_5[3] = s->codebook[3][v[27]];
262  } else {
263  c1_5[0] = c1_5[1] = c1_5[2] = c1_5[3] = 0;
264  }
265 
266  if (v[28] | v[29] | v[30] | v[31]) {
267  c1_5[4] = s->codebook[3][v[28]];
268  c1_5[5] = s->codebook[3][v[29]];
269  c1_5[6] = s->codebook[3][v[30]];
270  c1_5[7] = s->codebook[3][v[31]];
271  } else {
272  c1_5[4] = c1_5[5] = c1_5[6] = c1_5[7] = 0;
273  }
274  c1_5 += 8;
275 
276  v += 32;
277  }
278 }
279 
280 static void transform1(const int16_t * a, const int16_t * b, int16_t * dst, int width)
281 {
282  int s0 = a[0] + (b[0] >> 1);
283 
284  for (int i = 0; i < width / 2 - 1; i++) {
285  dst[i * 2] = s0;
286  s0 = a[i + 1] + ((b[i] + b[i + 1]) >> 1);
287  dst[i * 2 + 1] = ((dst[i * 2] + s0) >> 1) - 2 * b[i];
288  }
289 
290  dst[width - 2] = s0;
291  dst[width - 1] = a[width / 2 - 1] + ((b[width / 2 - 2] - 2 * b[width / 2 - 1]) >> 2) - b[width / 2 - 1];
292 }
293 
294 static uint8_t clip(int x)
295 {
296  return x >= -128 ? x <= 127 ? x + 0x80 : 0x00 : 0xFF;
297 }
298 
299 static void transform2(const int16_t * a, const int16_t * b, uint8_t * dst, int width)
300 {
301  int s0 = a[0] + (b[0] >> 1);
302  int tmp;
303 
304  for (int i = 0; i < width / 2 - 1; i++) {
305  dst[i * 2] = av_clip_uint8(s0 + 0x80);
306  tmp = a[i + 1] + ((b[i] + b[i + 1]) >> 1);
307  dst[i * 2 + 1] = av_clip_uint8(((tmp + s0) >> 1) - 2 * b[i] + 0x80);
308  s0 = tmp;
309  }
310 
311  dst[width - 2] = clip(s0);
312  dst[width - 1] = clip(a[width / 2 - 1] + ((b[width / 2 - 2] - 2 * b[width / 2 - 1]) >> 2) - b[width / 2 - 1]);
313 }
314 
315 static void decode_strip(VqcContext * s, uint8_t * dst, int stride, int width)
316 {
317  const int16_t * coeff;
318 
319  for (int i = 0; i < width; i++) {
320  int v0 = s->coeff[i];
321  int v1 = s->coeff[width + i];
322  s->coeff[i] = v0 - v1;
323  s->coeff[width + i] = v0 + v1;
324  }
325 
326  coeff = s->coeff;
327 
328  transform1(coeff, coeff + width / 8, s->tmp1, width / 4);
329  transform1(s->tmp1, coeff + width / 4, s->tmp2, width / 2);
330  transform2(s->tmp2, coeff + width / 2, dst, width);
331 
332  coeff += width;
333  dst += stride;
334 
335  transform1(coeff, coeff + width / 8, s->tmp1, width / 4);
336  transform1(s->tmp1, coeff + width / 4, s->tmp2, width / 2);
337  transform2(s->tmp2, coeff + width / 2, dst, width);
338 }
339 
340 static void decode_frame(VqcContext * s, int width, int height)
341 {
342  uint8_t * vectors = s->vectors;
343  uint8_t * y = s->frame->data[0];
344  uint8_t * u = s->frame->data[1];
345  uint8_t * v = s->frame->data[2];
346 
347  for (int j = 0; j < height / 4; j++) {
348  load_coeffs(s, vectors, width / 16, width);
349  decode_strip(s, y, s->frame->linesize[0], width);
350  vectors += 2 * width;
351  y += 2 * s->frame->linesize[0];
352 
353  load_coeffs(s, vectors, width / 32, width / 2);
354  decode_strip(s, u, s->frame->linesize[1], width / 2);
355  vectors += width;
356  u += 2 * s->frame->linesize[1];
357 
358  load_coeffs(s, vectors, width / 16, width);
359  decode_strip(s, y, s->frame->linesize[0], width);
360  vectors += 2 * width;
361  y += 2 * s->frame->linesize[0];
362 
363  load_coeffs(s, vectors, width / 32, width / 2);
364  decode_strip(s, v, s->frame->linesize[2], width / 2);
365  vectors += width;
366  v += 2 * s->frame->linesize[2];
367  }
368 }
369 
370 static int vqc_decode_frame(AVCodecContext *avctx, AVFrame * rframe,
371  int * got_frame, AVPacket * avpkt)
372 {
373  VqcContext *s = avctx->priv_data;
374  int ret;
375  const uint8_t * buf = avpkt->data;
376  int cache, seed[7], gamma, contrast;
377 
378  if (avpkt->size < 7)
379  return AVERROR_INVALIDDATA;
380 
381  if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
382  return ret;
383 
384  av_log(avctx, AV_LOG_DEBUG, "VQC%d format\n", (buf[2] & 1) + 1);
385 
386  if (((buf[0] >> 1) & 7) != 5) {
387  avpriv_request_sample(avctx, "subversion != 5\n");
388  return AVERROR_PATCHWELCOME;
389  }
390 
391  cache = AV_RL24(buf + 4);
392  seed[2] = seed_pow1((cache >> 1) & 7);
393  seed[1] = seed_pow1((cache >> 4) & 7);
394  seed[0] = seed_pow1((cache >> 7) & 7);
395  seed[6] = seed_pow2((cache >> 10) & 7);
396  seed[5] = seed_pow2((cache >> 13) & 7);
397  seed[4] = seed_pow2((cache >> 16) & 7);
398  seed[3] = seed_pow2((cache >> 19) & 7);
399 
400  gamma = buf[0] >> 4;
401  contrast = AV_RL16(buf + 2) >> 1;
402  if (gamma || contrast)
403  avpriv_request_sample(avctx, "gamma=0x%x, contrast=0x%x\n", gamma, contrast);
404 
406  ret = decode_vectors(s, buf + 7, avpkt->size - 7, avctx->width, avctx->height);
407  if (ret < 0)
408  return ret;
409  decode_frame(s, avctx->width, avctx->height);
410 
411  if ((ret = av_frame_ref(rframe, s->frame)) < 0)
412  return ret;
413 
414  *got_frame = 1;
415 
416  return avpkt->size;
417 }
418 
420 {
421  VqcContext *s = avctx->priv_data;
422 
423  av_freep(&s->vectors);
424  av_freep(&s->coeff);
425  av_freep(&s->tmp1);
426  av_freep(&s->tmp2);
427  av_frame_free(&s->frame);
428 
429  return 0;
430 }
431 
433  .p.name = "vqc",
434  CODEC_LONG_NAME("ViewQuest VQC"),
435  .p.type = AVMEDIA_TYPE_VIDEO,
436  .p.id = AV_CODEC_ID_VQC,
437  .priv_data_size = sizeof(VqcContext),
439  .close = vqc_decode_end,
441  .p.capabilities = AV_CODEC_CAP_DR1,
442  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
443 };
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
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:695
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
seed_codebooks
static void seed_codebooks(VqcContext *s, const int *seed)
Definition: vqcdec.c:124
u
#define u(width, name, range_min, range_max)
Definition: cbs_h2645.c:250
thread.h
VECTOR_VLC_BITS
#define VECTOR_VLC_BITS
Definition: vqcdec.c:28
AV_CODEC_ID_VQC
@ AV_CODEC_ID_VQC
Definition: codec_id.h:319
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:130
vqc_decode_end
static av_cold int vqc_decode_end(AVCodecContext *avctx)
Definition: vqcdec.c:419
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:344
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:28
VqcContext
Definition: vqcdec.c:63
AVPacket::data
uint8_t * data
Definition: packet.h:522
b
#define b
Definition: input.c:41
FFCodec
Definition: codec_internal.h:127
ff_vqc_decoder
const FFCodec ff_vqc_decoder
Definition: vqcdec.c:432
VqcContext::coeff
int16_t * coeff
Definition: vqcdec.c:66
c1
static const uint64_t c1
Definition: murmur3.c:52
load_coeffs
static void load_coeffs(VqcContext *s, const uint8_t *v, int width, int coeff_width)
Definition: vqcdec.c:198
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:30
skip_bits
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:381
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:335
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
transform2
static void transform2(const int16_t *a, const int16_t *b, uint8_t *dst, int width)
Definition: vqcdec.c:299
v0
#define v0
Definition: regdef.h:26
GetBitContext
Definition: get_bits.h:108
av_frame_alloc
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:118
ff_thread_once
static int ff_thread_once(char *control, void(*routine)(void))
Definition: thread.h:205
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
av_cold
#define av_cold
Definition: attributes.h:90
init_get_bits8
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
Definition: get_bits.h:545
VqcContext::frame
AVFrame * frame
Definition: vqcdec.c:64
width
#define width
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:287
vector_nbits
static const uint8_t vector_nbits[]
Definition: vqcdec.c:30
s
#define s(width, name)
Definition: cbs_vp9.c:198
seed_pow2
static int seed_pow2(int x)
Definition: vqcdec.c:109
get_sbits
static int get_sbits(GetBitContext *s, int n)
Definition: get_bits.h:320
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
decode.h
get_bits.h
AV_RL16
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
Definition: bytestream.h:94
SKIP_3
@ SKIP_3
Definition: vqcdec.c:36
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
decode_strip
static void decode_strip(VqcContext *s, uint8_t *dst, int stride, int width)
Definition: vqcdec.c:315
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
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
bias
static int bias(int x, int c)
Definition: vqcdec.c:114
VqcContext::tmp1
int16_t * tmp1
Definition: vqcdec.c:66
SIGNED_8BIT
@ SIGNED_8BIT
Definition: vqcdec.c:41
SKIP_6
@ SKIP_6
Definition: vqcdec.c:39
VqcContext::codebook
int16_t codebook[4][256]
Definition: vqcdec.c:67
seed
static unsigned int seed
Definition: videogen.c:78
get_vlc2
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
Definition: get_bits.h:652
AVOnce
#define AVOnce
Definition: thread.h:202
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
vqc_decode_init
static av_cold int vqc_decode_init(AVCodecContext *avctx)
Definition: vqcdec.c:70
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
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
VqcContext::vectors
uint8_t * vectors
Definition: vqcdec.c:65
AVPacket::size
int size
Definition: packet.h:523
av_frame_ref
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
Definition: frame.c:354
codec_internal.h
seed_pow1
static int seed_pow1(int x)
Definition: vqcdec.c:104
transform1
static void transform1(const int16_t *a, const int16_t *b, int16_t *dst, int width)
Definition: vqcdec.c:280
size
int size
Definition: twinvq_data.h:10344
VLCElem
Definition: vlc.h:32
AV_RL24
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_RL24
Definition: bytestream.h:93
vector_symbols
static const int8_t vector_symbols[]
Definition: vqcdec.c:47
STOP_RUN
@ STOP_RUN
Definition: vqcdec.c:40
height
#define height
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
clip
static uint8_t clip(int x)
Definition: vqcdec.c:294
VqcContext::tmp2
int16_t * tmp2
Definition: vqcdec.c:66
decode_frame
static void decode_frame(VqcContext *s, int width, int height)
Definition: vqcdec.c:340
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
show_bits
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
Definition: get_bits.h:371
av_malloc_array
#define av_malloc_array(a, b)
Definition: tableprint_vlc.h:31
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
AVCodecContext::height
int height
Definition: avcodec.h:618
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:657
avcodec.h
stride
#define stride
Definition: h264pred_template.c:537
decode_vectors
static int decode_vectors(VqcContext *s, const uint8_t *buf, int size, int width, int height)
Definition: vqcdec.c:144
ff_reget_buffer
int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Identical in function to ff_get_buffer(), except it reuses the existing buffer if available.
Definition: decode.c:1678
ret
ret
Definition: filter_design.txt:187
vqc_decode_frame
static int vqc_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, AVPacket *avpkt)
Definition: vqcdec.c:370
SKIP_4
@ SKIP_4
Definition: vqcdec.c:37
AVCodecContext
main external API structure.
Definition: avcodec.h:445
vector_vlc
static VLCElem vector_vlc[1<< VECTOR_VLC_BITS]
Definition: vqcdec.c:52
av_clip_uint8
#define av_clip_uint8
Definition: common.h:104
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
SKIP_5
@ SKIP_5
Definition: vqcdec.c:38
s0
#define s0
Definition: regdef.h:37
avpriv_request_sample
#define avpriv_request_sample(...)
Definition: tableprint_vlc.h:36
VLC_INIT_STATIC_TABLE_FROM_LENGTHS
#define VLC_INIT_STATIC_TABLE_FROM_LENGTHS(vlc_table, nb_bits, nb_codes, lens, lens_wrap, syms, syms_wrap, syms_size, offset, flags)
Definition: vlc.h:277
AVPacket
This structure stores compressed data.
Definition: packet.h:499
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:472
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:618
coeff
static const double coeff[2][5]
Definition: vf_owdenoise.c:79
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
SIGNED_6BIT
@ SIGNED_6BIT
Definition: vqcdec.c:42
vqc_init_static_data
static av_cold void vqc_init_static_data(void)
Definition: vqcdec.c:54