FFmpeg
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
hq_hqa.c
Go to the documentation of this file.
1 /*
2  * Canopus HQ/HQA decoder
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include <stdint.h>
22 
23 #include "libavutil/attributes.h"
24 #include "libavutil/mem_internal.h"
25 #include "libavutil/thread.h"
26 
27 #include "avcodec.h"
28 #include "bytestream.h"
29 #include "canopus.h"
30 #include "codec_internal.h"
31 #include "decode.h"
32 #include "get_bits.h"
33 #include "hq_common.h"
34 #include "hq_hqadata.h"
35 #include "hq_hqadsp.h"
36 #include "vlc.h"
37 
38 /* HQ/HQA slices are a set of macroblocks belonging to a frame, and
39  * they usually form a pseudorandom pattern (probably because it is
40  * nicer to display on partial decode).
41  *
42  * For HQA it just happens that each slice is on every 8th macroblock,
43  * but they can be on any frame width like
44  * X.......X.
45  * ......X...
46  * ....X.....
47  * ..X.......
48  * etc.
49  *
50  * The original decoder has special handling for edge macroblocks,
51  * while lavc simply aligns coded_width and coded_height.
52  */
53 
54 typedef struct HQContext {
57 
58  DECLARE_ALIGNED(16, int16_t, block)[12][64];
59 } HQContext;
60 
61 static const int32_t *hq_quants[NUM_HQ_QUANTS][2][4];
62 
63 static RL_VLC_ELEM hq_ac_rvlc[1184];
64 
65 static inline void put_blocks(HQContext *c, AVFrame *pic,
66  int plane, int x, int y, int ilace,
67  int16_t *block0, int16_t *block1)
68 {
69  uint8_t *p = pic->data[plane] + x;
70 
71  c->hqhqadsp.idct_put(p + y * pic->linesize[plane],
72  pic->linesize[plane] << ilace, block0);
73  c->hqhqadsp.idct_put(p + (y + (ilace ? 1 : 8)) * pic->linesize[plane],
74  pic->linesize[plane] << ilace, block1);
75 }
76 
77 static int hq_decode_block(HQContext *c, GetBitContext *gb, int16_t block[64],
78  int qsel, int is_chroma, int is_hqa)
79 {
80  const int32_t *q;
81 
82  if (!is_hqa) {
83  block[0] = get_sbits(gb, 9) * 64;
84  q = hq_quants[qsel][is_chroma][get_bits(gb, 2)];
85  } else {
86  q = hq_quants[qsel][is_chroma][get_bits(gb, 2)];
87  block[0] = get_sbits(gb, 9) * 64;
88  }
89 
90  OPEN_READER(re, gb);
91  for (int pos = 0;;) {
92  int level, run;
93  UPDATE_CACHE(re, gb);
94  GET_RL_VLC(level, run, re, gb, hq_ac_rvlc, 9, 2, 0);
95  if (run == HQ_AC_INVALID_RUN) {
96  CLOSE_READER(re, gb);
97  return AVERROR_INVALIDDATA;
98  }
99 
100  pos += run;
101  if (pos >= 64)
102  break;
103  block[ff_zigzag_direct[pos]] = (int)(level * (unsigned)q[pos]) >> 12;
104  }
105  CLOSE_READER(re, gb);
106 
107  return 0;
108 }
109 
110 static int hq_decode_mb(HQContext *c, AVFrame *pic,
111  GetBitContext *gb, int x, int y)
112 {
113  int qgroup, flag;
114  int i, ret;
115 
116  memset(c->block, 0, 8 * sizeof(c->block[0]));
117 
118  qgroup = get_bits(gb, 4);
119  flag = get_bits1(gb);
120 
121  for (i = 0; i < 8; i++) {
122  ret = hq_decode_block(c, gb, c->block[i], qgroup, i >= 4, 0);
123  if (ret < 0)
124  return ret;
125  }
126 
127  put_blocks(c, pic, 0, x, y, flag, c->block[0], c->block[2]);
128  put_blocks(c, pic, 0, x + 8, y, flag, c->block[1], c->block[3]);
129  put_blocks(c, pic, 2, x >> 1, y, flag, c->block[4], c->block[5]);
130  put_blocks(c, pic, 1, x >> 1, y, flag, c->block[6], c->block[7]);
131 
132  return 0;
133 }
134 
136  int prof_num, size_t data_size)
137 {
138  const HQProfile *profile;
139  GetBitContext gb;
140  const uint8_t *perm, *src = gbc->buffer;
141  uint32_t slice_off[21];
142  int slice, start_off, next_off, i, ret;
143 
144  if ((unsigned)prof_num >= NUM_HQ_PROFILES) {
145  profile = &hq_profile[0];
146  avpriv_request_sample(ctx->avctx, "HQ Profile %d", prof_num);
147  } else {
148  profile = &hq_profile[prof_num];
149  av_log(ctx->avctx, AV_LOG_VERBOSE, "HQ Profile %d\n", prof_num);
150  }
151 
152  if (bytestream2_get_bytes_left(gbc) < 3 * (profile->num_slices + 1))
153  return AVERROR_INVALIDDATA;
154 
155  ctx->avctx->coded_width = FFALIGN(profile->width, 16);
156  ctx->avctx->coded_height = FFALIGN(profile->height, 16);
157  ctx->avctx->width = profile->width;
158  ctx->avctx->height = profile->height;
159  ctx->avctx->bits_per_raw_sample = 8;
160  ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P;
161 
162  ret = ff_get_buffer(ctx->avctx, pic, 0);
163  if (ret < 0)
164  return ret;
165 
166  /* Offsets are stored from CUV position, so adjust them accordingly. */
167  for (i = 0; i < profile->num_slices + 1; i++)
168  slice_off[i] = bytestream2_get_be24u(gbc) - 4;
169 
170  next_off = 0;
171  for (slice = 0; slice < profile->num_slices; slice++) {
172  start_off = next_off;
173  next_off = profile->tab_h * (slice + 1) / profile->num_slices;
174  perm = profile->perm_tab + start_off * profile->tab_w * 2;
175 
176  if (slice_off[slice] < (profile->num_slices + 1) * 3 ||
177  slice_off[slice] >= slice_off[slice + 1] ||
178  slice_off[slice + 1] > data_size) {
179  av_log(ctx->avctx, AV_LOG_ERROR,
180  "Invalid slice size %"SIZE_SPECIFIER".\n", data_size);
181  break;
182  }
183  init_get_bits(&gb, src + slice_off[slice],
184  (slice_off[slice + 1] - slice_off[slice]) * 8);
185 
186  for (i = 0; i < (next_off - start_off) * profile->tab_w; i++) {
187  ret = hq_decode_mb(ctx, pic, &gb, perm[0] * 16, perm[1] * 16);
188  if (ret < 0) {
189  av_log(ctx->avctx, AV_LOG_ERROR,
190  "Error decoding macroblock %d at slice %d.\n", i, slice);
191  return ret;
192  }
193  perm += 2;
194  }
195  }
196 
197  return 0;
198 }
199 
200 static int hqa_decode_mb(HQContext *c, AVFrame *pic, int qgroup,
201  GetBitContext *gb, int x, int y)
202 {
203  int flag = 0;
204  int i, ret;
205 
206  if (get_bits_left(gb) < 1)
207  return AVERROR_INVALIDDATA;
208 
209  memset(c->block, 0, 12 * sizeof(c->block[0]));
210  for (i = 0; i < 12; i++)
211  c->block[i][0] = -128 * (1 << 6);
212 
213  int cbp = get_vlc2(gb, ff_hq_cbp_vlc, HQ_CBP_VLC_BITS, 1);
214  if (cbp) {
215  flag = get_bits1(gb);
216 
217  if (cbp & 0x3)
218  cbp |= 0x500;
219  if (cbp & 0xC)
220  cbp |= 0xA00;
221  for (i = 0; i < 12; i++) {
222  if (!(cbp & (1 << i)))
223  continue;
224  ret = hq_decode_block(c, gb, c->block[i], qgroup, i >= 8, 1);
225  if (ret < 0)
226  return ret;
227  }
228  }
229 
230  put_blocks(c, pic, 3, x, y, flag, c->block[ 0], c->block[ 2]);
231  put_blocks(c, pic, 3, x + 8, y, flag, c->block[ 1], c->block[ 3]);
232  put_blocks(c, pic, 0, x, y, flag, c->block[ 4], c->block[ 6]);
233  put_blocks(c, pic, 0, x + 8, y, flag, c->block[ 5], c->block[ 7]);
234  put_blocks(c, pic, 2, x >> 1, y, flag, c->block[ 8], c->block[ 9]);
235  put_blocks(c, pic, 1, x >> 1, y, flag, c->block[10], c->block[11]);
236 
237  return 0;
238 }
239 
241  int quant, int slice_no, int w, int h)
242 {
243  int i, j, off;
244  int ret;
245 
246  for (i = 0; i < h; i += 16) {
247  off = (slice_no * 16 + i * 3) & 0x70;
248  for (j = off; j < w; j += 128) {
249  ret = hqa_decode_mb(ctx, pic, quant, gb, j, i);
250  if (ret < 0) {
251  av_log(ctx->avctx, AV_LOG_ERROR,
252  "Error decoding macroblock at %dx%d.\n", i, j);
253  return ret;
254  }
255  }
256  }
257 
258  return 0;
259 }
260 
261 static int hqa_decode_frame(HQContext *ctx, AVFrame *pic, GetByteContext *gbc, size_t data_size)
262 {
263  GetBitContext gb;
264  const int num_slices = 8;
265  uint32_t slice_off[9];
266  int i, slice, ret;
267  const uint8_t *src = gbc->buffer;
268 
269  if (bytestream2_get_bytes_left(gbc) < 8 + 4*(num_slices + 1))
270  return AVERROR_INVALIDDATA;
271 
272  int width = bytestream2_get_be16u(gbc);
273  int height = bytestream2_get_be16u(gbc);
274 
275  ret = ff_set_dimensions(ctx->avctx, width, height);
276  if (ret < 0)
277  return ret;
278 
279  ctx->avctx->coded_width = FFALIGN(width, 16);
280  ctx->avctx->coded_height = FFALIGN(height, 16);
281  ctx->avctx->bits_per_raw_sample = 8;
282  ctx->avctx->pix_fmt = AV_PIX_FMT_YUVA422P;
283 
284  av_log(ctx->avctx, AV_LOG_VERBOSE, "HQA Profile\n");
285 
286  int quant = bytestream2_get_byteu(gbc);
287  bytestream2_skipu(gbc, 3);
288  if (quant >= NUM_HQ_QUANTS) {
289  av_log(ctx->avctx, AV_LOG_ERROR,
290  "Invalid quantization matrix %d.\n", quant);
291  return AVERROR_INVALIDDATA;
292  }
293 
294  ret = ff_get_buffer(ctx->avctx, pic, 0);
295  if (ret < 0)
296  return ret;
297 
298  /* Offsets are stored from HQA1 position, so adjust them accordingly. */
299  for (i = 0; i < num_slices + 1; i++)
300  slice_off[i] = bytestream2_get_be32u(gbc) - 4;
301 
302  for (slice = 0; slice < num_slices; slice++) {
303  if (slice_off[slice] < (num_slices + 1) * 3 ||
304  slice_off[slice] >= slice_off[slice + 1] ||
305  slice_off[slice + 1] > data_size) {
306  av_log(ctx->avctx, AV_LOG_ERROR,
307  "Invalid slice size %"SIZE_SPECIFIER".\n", data_size);
308  break;
309  }
310  init_get_bits(&gb, src + slice_off[slice],
311  (slice_off[slice + 1] - slice_off[slice]) * 8);
312 
313  ret = hqa_decode_slice(ctx, pic, &gb, quant, slice, width, height);
314  if (ret < 0)
315  return ret;
316  }
317 
318  return 0;
319 }
320 
322  int *got_frame, AVPacket *avpkt)
323 {
324  HQContext *ctx = avctx->priv_data;
325  GetByteContext gbc0, *const gbc = &gbc0;
326  unsigned int data_size;
327  int ret;
328 
329  if (avpkt->size < 4 + 4) {
330  av_log(avctx, AV_LOG_ERROR, "Frame is too small (%d).\n", avpkt->size);
331  return AVERROR_INVALIDDATA;
332  }
333  bytestream2_init(gbc, avpkt->data, avpkt->size);
334 
335  uint32_t info_tag = bytestream2_peek_le32u(gbc);
336  if (info_tag == MKTAG('I', 'N', 'F', 'O')) {
337  bytestream2_skipu(gbc, 4);
338  int info_size = bytestream2_get_le32u(gbc);
339  if (info_size < 0 || bytestream2_get_bytes_left(gbc) < info_size) {
340  av_log(avctx, AV_LOG_ERROR, "Invalid INFO size (%d).\n", info_size);
341  return AVERROR_INVALIDDATA;
342  }
343  ff_canopus_parse_info_tag(avctx, gbc->buffer, info_size);
344 
345  bytestream2_skipu(gbc, info_size);
346  }
347 
348  data_size = bytestream2_get_bytes_left(gbc);
349  if (data_size < 4) {
350  av_log(avctx, AV_LOG_ERROR, "Frame is too small (%d).\n", data_size);
351  return AVERROR_INVALIDDATA;
352  }
353 
354  /* HQ defines dimensions and number of slices, and thus slice traversal
355  * order. HQA has no size constraint and a fixed number of slices, so it
356  * needs a separate scheme for it. */
357  unsigned tag = bytestream2_get_le32u(gbc);
358  if ((tag & 0x00FFFFFF) == (MKTAG('U', 'V', 'C', ' ') & 0x00FFFFFF)) {
359  ret = hq_decode_frame(ctx, pic, gbc, tag >> 24, data_size);
360  } else if (tag == MKTAG('H', 'Q', 'A', '1')) {
361  ret = hqa_decode_frame(ctx, pic, gbc, data_size);
362  } else {
363  av_log(avctx, AV_LOG_ERROR, "Not a HQ/HQA frame.\n");
364  return AVERROR_INVALIDDATA;
365  }
366  if (ret < 0) {
367  av_log(avctx, AV_LOG_ERROR, "Error decoding frame.\n");
368  return ret;
369  }
370 
371  *got_frame = 1;
372 
373  return avpkt->size;
374 }
375 
376 static av_cold void hq_init_static(void)
377 {
379  hq_ac_lens, 1, hq_ac_sym, 2, 2, 0, 0);
380 
381  for (size_t i = 0; i < FF_ARRAY_ELEMS(hq_ac_rvlc); ++i) {
382  int len = hq_ac_rvlc[i].len;
383  int sym = (int16_t)hq_ac_rvlc[i].sym, level = sym;
384 
385  // The invalid code has been remapped to HQ_AC_INVALID_RUN,
386  // so the VLC is complete.
387  av_assert1(len != 0);
388 
389  if (len > 0) {
390  level = sym >> 7;
391  hq_ac_rvlc[i].run = sym & 0x7F;
392  }
393  hq_ac_rvlc[i].len8 = len;
394  hq_ac_rvlc[i].level = level;
395  }
396 
397  for (size_t i = 0; i < FF_ARRAY_ELEMS(hq_quants); ++i) {
398  for (size_t j = 0; j < FF_ARRAY_ELEMS(hq_quants[0]); ++j) {
399  for (size_t k = 0; k < FF_ARRAY_ELEMS(hq_quants[0][0]); ++k)
400  hq_quants[i][j][k] = qmats[hq_quant_map[i][j][k]];
401  }
402  }
403 }
404 
406 {
407  static AVOnce init_static_once = AV_ONCE_INIT;
408  HQContext *ctx = avctx->priv_data;
409  ctx->avctx = avctx;
410 
411  ff_hqdsp_init(&ctx->hqhqadsp);
412 
413  ff_thread_once(&init_static_once, hq_init_static);
414 
415  return 0;
416 }
417 
419  .p.name = "hq_hqa",
420  CODEC_LONG_NAME("Canopus HQ/HQA"),
421  .p.type = AVMEDIA_TYPE_VIDEO,
422  .p.id = AV_CODEC_ID_HQ_HQA,
423  .priv_data_size = sizeof(HQContext),
426  .p.capabilities = AV_CODEC_CAP_DR1,
427 };
hq_decode_block
static int hq_decode_block(HQContext *c, GetBitContext *gb, int16_t block[64], int qsel, int is_chroma, int is_hqa)
Definition: hq_hqa.c:77
VLCElem::level
int16_t level
Definition: vlc.h:41
NUM_HQ_QUANTS
#define NUM_HQ_QUANTS
Definition: hq_hqadata.h:28
level
uint8_t level
Definition: svq3.c:205
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:678
mem_internal.h
GetByteContext
Definition: bytestream.h:33
thread.h
bytestream2_skipu
static av_always_inline void bytestream2_skipu(GetByteContext *g, unsigned int size)
Definition: bytestream.h:174
hq_decode_mb
static int hq_decode_mb(HQContext *c, AVFrame *pic, GetBitContext *gb, int x, int y)
Definition: hq_hqa.c:110
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:410
w
uint8_t w
Definition: llviddspenc.c:38
HQ_CBP_VLC_BITS
#define HQ_CBP_VLC_BITS
Definition: hq_common.h:25
AVPacket::data
uint8_t * data
Definition: packet.h:535
FFCodec
Definition: codec_internal.h:127
HQ_AC_INVALID_RUN
#define HQ_AC_INVALID_RUN
Definition: hq_hqadata.h:1158
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:226
VLCElem::len
VLCBaseType len
Definition: vlc.h:37
UPDATE_CACHE
#define UPDATE_CACHE(name, gb)
Definition: get_bits.h:208
ff_set_dimensions
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
Definition: utils.c:91
init_get_bits
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition: get_bits.h:497
hq_hqa_decode_frame
static int hq_hqa_decode_frame(AVCodecContext *avctx, AVFrame *pic, int *got_frame, AVPacket *avpkt)
Definition: hq_hqa.c:321
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:431
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:318
ff_hq_cbp_vlc
const VLCElem ff_hq_cbp_vlc[1<< HQ_CBP_VLC_BITS]
Definition: hq_common.c:27
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
NUM_HQ_PROFILES
#define NUM_HQ_PROFILES
Definition: hq_hqadata.h:27
ff_canopus_parse_info_tag
int ff_canopus_parse_info_tag(AVCodecContext *avctx, const uint8_t *src, size_t size)
Definition: canopus.c:30
GetBitContext
Definition: get_bits.h:108
perm
perm
Definition: f_perms.c:75
hq_decode_frame
static int hq_decode_frame(HQContext *ctx, AVFrame *pic, GetByteContext *gbc, int prof_num, size_t data_size)
Definition: hq_hqa.c:135
quant
static const uint8_t quant[64]
Definition: vmixdec.c:71
hq_quant_map
static const uint8_t hq_quant_map[NUM_HQ_QUANTS][2][4]
Definition: hq_hqadata.h:1138
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
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
av_cold
#define av_cold
Definition: attributes.h:90
HQContext::avctx
AVCodecContext * avctx
Definition: hq_hqa.c:55
CLOSE_READER
#define CLOSE_READER(name, gb)
Definition: get_bits.h:184
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:341
HQProfile
Definition: hq_hqadata.h:30
HQContext::hqhqadsp
HQDSPContext hqhqadsp
Definition: hq_hqa.c:56
hqa_decode_slice
static int hqa_decode_slice(HQContext *ctx, AVFrame *pic, GetBitContext *gb, int quant, int slice_no, int w, int h)
Definition: hq_hqa.c:240
GetByteContext::buffer
const uint8_t * buffer
Definition: bytestream.h:34
get_sbits
static int get_sbits(GetBitContext *s, int n)
Definition: get_bits.h:303
ctx
AVFormatContext * ctx
Definition: movenc.c:49
decode.h
get_bits.h
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:326
if
if(ret)
Definition: filter_design.txt:179
VLCElem::run
uint8_t run
Definition: vlc.h:43
hqa_decode_mb
static int hqa_decode_mb(HQContext *c, AVFrame *pic, int qgroup, GetBitContext *gb, int x, int y)
Definition: hq_hqa.c:200
AV_ONCE_INIT
#define AV_ONCE_INIT
Definition: thread.h:203
run
uint8_t run
Definition: svq3.c:204
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:371
hqa_decode_frame
static int hqa_decode_frame(HQContext *ctx, AVFrame *pic, GetByteContext *gbc, size_t data_size)
Definition: hq_hqa.c:261
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:635
canopus.h
AVOnce
#define AVOnce
Definition: thread.h:202
hq_init_static
static av_cold void hq_init_static(void)
Definition: hq_hqa.c:376
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
hq_ac_rvlc
static RL_VLC_ELEM hq_ac_rvlc[1184]
Definition: hq_hqa.c:63
bytestream2_get_bytes_left
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
Definition: bytestream.h:158
hq_hqadata.h
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1611
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
AVPacket::size
int size
Definition: packet.h:536
height
#define height
Definition: dsp.h:85
codec_internal.h
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem_internal.h:104
VLCElem
Definition: vlc.h:32
HQContext
Definition: hq_hqa.c:54
VLCElem::len8
int8_t len8
Definition: vlc.h:42
OPEN_READER
#define OPEN_READER(name, gb)
Definition: get_bits.h:173
hq_ac_sym
static const int16_t hq_ac_sym[NUM_HQ_AC_ENTRIES]
Definition: hq_hqadata.h:1165
block1
static int16_t block1[64]
Definition: dct.c:121
HQContext::block
int16_t block[12][64]
Definition: hq_hqa.c:58
NUM_HQ_AC_ENTRIES
#define NUM_HQ_AC_ENTRIES
Definition: hq_hqadata.h:26
attributes.h
hq_hqadsp.h
ff_hqdsp_init
av_cold void ff_hqdsp_init(HQDSPContext *c)
Definition: hq_hqadsp.c:127
AV_CODEC_ID_HQ_HQA
@ AV_CODEC_ID_HQ_HQA
Definition: codec_id.h:242
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
hq_profile
static const HQProfile hq_profile[NUM_HQ_PROFILES]
Definition: hq_hqadata.h:8275
put_blocks
static void put_blocks(HQContext *c, AVFrame *pic, int plane, int x, int y, int ilace, int16_t *block0, int16_t *block1)
Definition: hq_hqa.c:65
av_assert1
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition: avassert.h:56
hq_quants
static const int32_t * hq_quants[NUM_HQ_QUANTS][2][4]
Definition: hq_hqa.c:61
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:179
len
int len
Definition: vorbis_enc_data.h:426
profile
int profile
Definition: mxfenc.c:2250
avcodec.h
GET_RL_VLC
#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)
Definition: get_bits.h:589
ff_zigzag_direct
const uint8_t ff_zigzag_direct[64]
Definition: mathtables.c:98
tag
uint32_t tag
Definition: movenc.c:1911
ret
ret
Definition: filter_design.txt:187
pos
unsigned int pos
Definition: spdifenc.c:414
flag
#define flag(name)
Definition: cbs_av1.c:495
qmats
static const int32_t qmats[NUM_QMATS][MAT_SIZE]
Definition: hq_hqadata.h:121
SIZE_SPECIFIER
#define SIZE_SPECIFIER
Definition: internal.h:129
AVCodecContext
main external API structure.
Definition: avcodec.h:431
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
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
avpriv_request_sample
#define avpriv_request_sample(...)
Definition: tableprint_vlc.h:37
hq_ac_lens
static const uint8_t hq_ac_lens[NUM_HQ_AC_ENTRIES]
Definition: hq_hqadata.h:1318
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:288
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:78
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:458
AVPacket
This structure stores compressed data.
Definition: packet.h:512
vlc.h
int32_t
int32_t
Definition: audioconvert.c:56
bytestream.h
bytestream2_init
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
Definition: bytestream.h:137
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition: frame.h:455
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
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
MKTAG
#define MKTAG(a, b, c, d)
Definition: macros.h:55
h
h
Definition: vp9dsp_template.c:2070
width
#define width
Definition: dsp.h:85
HQDSPContext
Definition: hq_hqadsp.h:32
hq_common.h
src
#define src
Definition: vp8dsp.c:248
ff_hq_hqa_decoder
const FFCodec ff_hq_hqa_decoder
Definition: hq_hqa.c:418
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:173
hq_hqa_decode_init
static av_cold int hq_hqa_decode_init(AVCodecContext *avctx)
Definition: hq_hqa.c:405