FFmpeg
asvdec.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2003 Michael Niedermayer
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 /**
22  * @file
23  * ASUS V1/V2 decoder.
24  */
25 
26 #include "libavutil/attributes.h"
27 #include "libavutil/mem.h"
28 #include "libavutil/mem_internal.h"
29 #include "libavutil/thread.h"
30 
31 #include "asv.h"
32 #include "avcodec.h"
33 #include "blockdsp.h"
34 #include "codec_internal.h"
35 #include "config_components.h"
36 #include "decode.h"
37 #include "get_bits.h"
38 #include "idctdsp.h"
39 #include "mpeg12data.h"
40 #include "vlc.h"
41 
42 #define CCP_VLC_BITS 5
43 #define DC_CCP_VLC_BITS 4
44 #define AC_CCP_VLC_BITS 6
45 #define ASV1_LEVEL_VLC_BITS 4
46 #define ASV2_LEVEL_VLC_BITS 10
47 
48 static VLCElem ccp_vlc[32];
49 static VLCElem level_vlc[16];
50 static VLCElem dc_ccp_vlc[16];
51 static VLCElem ac_ccp_vlc[64];
52 static VLCElem asv2_level_vlc[1024];
53 
54 typedef struct ASVDecContext {
56 
58 
61  uint8_t permutated_scantable[64];
62  DECLARE_ALIGNED(32, int16_t, block)[6][64];
63  uint16_t intra_matrix[64];
64  uint8_t *bitstream_buffer;
65  unsigned int bitstream_buffer_size;
67 
68 static av_cold void init_vlcs(void)
69 {
71  &ff_asv_ccp_tab[0][1], 2, 1,
72  &ff_asv_ccp_tab[0][0], 2, 1, 0);
74  &ff_asv_dc_ccp_tab[0][1], 2, 1,
75  &ff_asv_dc_ccp_tab[0][0], 2, 1, VLC_INIT_LE);
77  &ff_asv_ac_ccp_tab[0][1], 2, 1,
78  &ff_asv_ac_ccp_tab[0][0], 2, 1, VLC_INIT_LE);
80  &ff_asv_level_tab[0][1], 2, 1,
81  &ff_asv_level_tab[0][0], 2, 1, 0);
83  &ff_asv2_level_tab[0][1], 4, 2,
84  &ff_asv2_level_tab[0][0], 4, 2, VLC_INIT_LE);
85 }
86 
87 static inline int asv1_get_level(GetBitContext *gb)
88 {
90 
91  if (code == 3)
92  return get_sbits(gb, 8);
93  else
94  return code - 3;
95 }
96 
97 // get_vlc2() is big-endian in this file
98 static inline int asv2_get_vlc2(GetBitContext *gb, const VLCElem *table, int bits)
99 {
100  unsigned int index;
101  int code, n;
102 
103  OPEN_READER(re, gb);
104  UPDATE_CACHE_LE(re, gb);
105 
106  index = SHOW_UBITS_LE(re, gb, bits);
107  code = table[index].sym;
108  n = table[index].len;
109  LAST_SKIP_BITS(re, gb, n);
110 
111  CLOSE_READER(re, gb);
112 
113  return code;
114 }
115 
116 static inline int asv2_get_level(GetBitContext *gb)
117 {
119 
120  if (code == 31)
121  return (int8_t) get_bits_le(gb, 8);
122  else
123  return code - 31;
124 }
125 
126 static inline int asv1_decode_block(ASVDecContext *a, int16_t block[64])
127 {
128  int i;
129 
130  block[0] = 8 * get_bits(&a->gb, 8);
131 
132  for (i = 0; i < 11; i++) {
133  const int ccp = get_vlc2(&a->gb, ccp_vlc, CCP_VLC_BITS, 1);
134 
135  if (ccp) {
136  if (ccp == 16)
137  break;
138  if (ccp < 0 || i >= 10) {
139  av_log(a->c.avctx, AV_LOG_ERROR, "coded coeff pattern damaged\n");
140  return AVERROR_INVALIDDATA;
141  }
142 
143  if (ccp & 8)
144  block[a->permutated_scantable[4 * i + 0]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 0]) >> 4;
145  if (ccp & 4)
146  block[a->permutated_scantable[4 * i + 1]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 1]) >> 4;
147  if (ccp & 2)
148  block[a->permutated_scantable[4 * i + 2]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 2]) >> 4;
149  if (ccp & 1)
150  block[a->permutated_scantable[4 * i + 3]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 3]) >> 4;
151  }
152  }
153 
154  return 0;
155 }
156 
157 static inline int asv2_decode_block(ASVDecContext *a, int16_t block[64])
158 {
159  int i, count, ccp;
160 
161  count = get_bits_le(&a->gb, 4);
162 
163  block[0] = 8 * get_bits_le(&a->gb, 8);
164 
166  if (ccp) {
167  if (ccp & 4)
168  block[a->permutated_scantable[1]] = (asv2_get_level(&a->gb) * a->intra_matrix[1]) >> 4;
169  if (ccp & 2)
170  block[a->permutated_scantable[2]] = (asv2_get_level(&a->gb) * a->intra_matrix[2]) >> 4;
171  if (ccp & 1)
172  block[a->permutated_scantable[3]] = (asv2_get_level(&a->gb) * a->intra_matrix[3]) >> 4;
173  }
174 
175  for (i = 1; i < count + 1; i++) {
176  const int ccp = asv2_get_vlc2(&a->gb, ac_ccp_vlc, AC_CCP_VLC_BITS);
177 
178  if (ccp) {
179  if (ccp & 8)
180  block[a->permutated_scantable[4 * i + 0]] = (asv2_get_level(&a->gb) * a->intra_matrix[4 * i + 0]) >> 4;
181  if (ccp & 4)
182  block[a->permutated_scantable[4 * i + 1]] = (asv2_get_level(&a->gb) * a->intra_matrix[4 * i + 1]) >> 4;
183  if (ccp & 2)
184  block[a->permutated_scantable[4 * i + 2]] = (asv2_get_level(&a->gb) * a->intra_matrix[4 * i + 2]) >> 4;
185  if (ccp & 1)
186  block[a->permutated_scantable[4 * i + 3]] = (asv2_get_level(&a->gb) * a->intra_matrix[4 * i + 3]) >> 4;
187  }
188  }
189 
190  return 0;
191 }
192 
193 static inline int decode_mb(ASVDecContext *a, int16_t block[6][64])
194 {
195  int i, ret;
196 
197  a->bdsp.clear_blocks(block[0]);
198 
199  if (a->c.avctx->codec_id == AV_CODEC_ID_ASV1) {
200  for (i = 0; i < 6; i++) {
201  if ((ret = asv1_decode_block(a, block[i])) < 0)
202  return ret;
203  }
204  } else {
205  for (i = 0; i < 6; i++) {
206  if ((ret = asv2_decode_block(a, block[i])) < 0)
207  return ret;
208  }
209  }
210  return 0;
211 }
212 
213 static inline void idct_put(ASVDecContext *a, AVFrame *frame, int mb_x, int mb_y)
214 {
215  int16_t(*block)[64] = a->block;
216  int linesize = frame->linesize[0];
217 
218  uint8_t *dest_y = frame->data[0] + (mb_y * 16 * linesize) + mb_x * 16;
219  uint8_t *dest_cb = frame->data[1] + (mb_y * 8 * frame->linesize[1]) + mb_x * 8;
220  uint8_t *dest_cr = frame->data[2] + (mb_y * 8 * frame->linesize[2]) + mb_x * 8;
221 
222  a->idsp.idct_put(dest_y, linesize, block[0]);
223  a->idsp.idct_put(dest_y + 8, linesize, block[1]);
224  a->idsp.idct_put(dest_y + 8 * linesize, linesize, block[2]);
225  a->idsp.idct_put(dest_y + 8 * linesize + 8, linesize, block[3]);
226 
227  if (!(a->c.avctx->flags & AV_CODEC_FLAG_GRAY)) {
228  a->idsp.idct_put(dest_cb, frame->linesize[1], block[4]);
229  a->idsp.idct_put(dest_cr, frame->linesize[2], block[5]);
230  }
231 }
232 
233 static int decode_frame(AVCodecContext *avctx, AVFrame *p,
234  int *got_frame, AVPacket *avpkt)
235 {
236  ASVDecContext *const a = avctx->priv_data;
237  const ASVCommonContext *const c = &a->c;
238  const uint8_t *buf = avpkt->data;
239  int buf_size = avpkt->size;
240  int ret;
241 
242  if (buf_size * 8LL < c->mb_height * c->mb_width * 13LL)
243  return AVERROR_INVALIDDATA;
244 
245  if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
246  return ret;
248  p->flags |= AV_FRAME_FLAG_KEY;
249 
250  if (avctx->codec_id == AV_CODEC_ID_ASV1) {
251  av_fast_padded_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size,
252  buf_size);
253  if (!a->bitstream_buffer)
254  return AVERROR(ENOMEM);
255 
256  c->bbdsp.bswap_buf((uint32_t *) a->bitstream_buffer,
257  (const uint32_t *) buf, buf_size / 4);
258  ret = init_get_bits8(&a->gb, a->bitstream_buffer, buf_size);
259  } else {
260  ret = init_get_bits8_le(&a->gb, buf, buf_size);
261  }
262  if (ret < 0)
263  return ret;
264 
265  for (int mb_y = 0; mb_y < c->mb_height2; mb_y++) {
266  for (int mb_x = 0; mb_x < c->mb_width2; mb_x++) {
267  if ((ret = decode_mb(a, a->block)) < 0)
268  return ret;
269 
270  idct_put(a, p, mb_x, mb_y);
271  }
272  }
273 
274  if (c->mb_width2 != c->mb_width) {
275  int mb_x = c->mb_width2;
276  for (int mb_y = 0; mb_y < c->mb_height2; mb_y++) {
277  if ((ret = decode_mb(a, a->block)) < 0)
278  return ret;
279 
280  idct_put(a, p, mb_x, mb_y);
281  }
282  }
283 
284  if (c->mb_height2 != c->mb_height) {
285  int mb_y = c->mb_height2;
286  for (int mb_x = 0; mb_x < c->mb_width; mb_x++) {
287  if ((ret = decode_mb(a, a->block)) < 0)
288  return ret;
289 
290  idct_put(a, p, mb_x, mb_y);
291  }
292  }
293 
294  *got_frame = 1;
295 
296  return (get_bits_count(&a->gb) + 31) / 32 * 4;
297 }
298 
300 {
301  static AVOnce init_static_once = AV_ONCE_INIT;
302  ASVDecContext *const a = avctx->priv_data;
303  const int scale = avctx->codec_id == AV_CODEC_ID_ASV1 ? 1 : 2;
304  int inv_qscale;
305  int i;
306 
307  if (avctx->extradata_size < 1) {
308  av_log(avctx, AV_LOG_WARNING, "No extradata provided\n");
309  }
310 
311  ff_asv_common_init(avctx);
312  ff_blockdsp_init(&a->bdsp);
313  ff_idctdsp_init(&a->idsp, avctx);
314  ff_permute_scantable(a->permutated_scantable, ff_asv_scantab,
315  a->idsp.idct_permutation);
316  avctx->pix_fmt = AV_PIX_FMT_YUV420P;
317 
318  if (avctx->extradata_size < 1 || (inv_qscale = avctx->extradata[0]) == 0) {
319  av_log(avctx, AV_LOG_ERROR, "illegal qscale 0\n");
320  if (avctx->codec_id == AV_CODEC_ID_ASV1)
321  inv_qscale = 6;
322  else
323  inv_qscale = 10;
324  }
325 
326  for (i = 0; i < 64; i++) {
327  int index = ff_asv_scantab[i];
328 
329  a->intra_matrix[i] = 64 * scale * ff_mpeg1_default_intra_matrix[index] /
330  inv_qscale;
331  }
332 
333  ff_thread_once(&init_static_once, init_vlcs);
334 
335  return 0;
336 }
337 
339 {
340  ASVDecContext *const a = avctx->priv_data;
341 
342  av_freep(&a->bitstream_buffer);
343  a->bitstream_buffer_size = 0;
344 
345  return 0;
346 }
347 
348 #if CONFIG_ASV1_DECODER
349 const FFCodec ff_asv1_decoder = {
350  .p.name = "asv1",
351  CODEC_LONG_NAME("ASUS V1"),
352  .p.type = AVMEDIA_TYPE_VIDEO,
353  .p.id = AV_CODEC_ID_ASV1,
354  .priv_data_size = sizeof(ASVDecContext),
355  .init = decode_init,
356  .close = decode_end,
358  .p.capabilities = AV_CODEC_CAP_DR1,
359 };
360 #endif
361 
362 #if CONFIG_ASV2_DECODER
363 const FFCodec ff_asv2_decoder = {
364  .p.name = "asv2",
365  CODEC_LONG_NAME("ASUS V2"),
366  .p.type = AVMEDIA_TYPE_VIDEO,
367  .p.id = AV_CODEC_ID_ASV2,
368  .priv_data_size = sizeof(ASVDecContext),
369  .init = decode_init,
371  .p.capabilities = AV_CODEC_CAP_DR1,
372 };
373 #endif
AC_CCP_VLC_BITS
#define AC_CCP_VLC_BITS
Definition: asvdec.c:44
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
ff_asv_dc_ccp_tab
const uint8_t ff_asv_dc_ccp_tab[8][2]
Definition: asv.c:57
ff_asv_level_tab
const uint8_t ff_asv_level_tab[7][2]
Definition: asv.c:53
blockdsp.h
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
mem_internal.h
thread.h
ASVDecContext::idsp
IDCTDSPContext idsp
Definition: asvdec.c:60
ASVDecContext::bdsp
BlockDSPContext bdsp
Definition: asvdec.c:59
ASV2_LEVEL_VLC_BITS
#define ASV2_LEVEL_VLC_BITS
Definition: asvdec.c:46
get_bits_count
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:266
decode_init
static av_cold int decode_init(AVCodecContext *avctx)
Definition: asvdec.c:299
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:344
AVPacket::data
uint8_t * data
Definition: packet.h:522
table
static const uint16_t table[]
Definition: prosumer.c:205
FFCodec
Definition: codec_internal.h:127
AVFrame::flags
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
Definition: frame.h:616
BlockDSPContext
Definition: blockdsp.h:32
ASVDecContext::c
ASVCommonContext c
Definition: asvdec.c:55
ff_idctdsp_init
av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
Definition: idctdsp.c:228
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:365
ff_asv2_level_tab
const uint16_t ff_asv2_level_tab[63][2]
Definition: asv.c:69
ff_permute_scantable
av_cold void ff_permute_scantable(uint8_t dst[64], const uint8_t src[64], const uint8_t permutation[64])
Definition: idctdsp.c:30
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
ASVDecContext::bitstream_buffer_size
unsigned int bitstream_buffer_size
Definition: asvdec.c:65
ff_asv1_decoder
const FFCodec ff_asv1_decoder
ff_asv_scantab
const uint8_t ff_asv_scantab[64]
Definition: asv.c:34
GetBitContext
Definition: get_bits.h:108
asv2_get_level
static int asv2_get_level(GetBitContext *gb)
Definition: asvdec.c:116
ASVCommonContext
Definition: asv.h:34
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:180
av_cold
#define av_cold
Definition: attributes.h:90
ASV1_LEVEL_VLC_BITS
#define ASV1_LEVEL_VLC_BITS
Definition: asvdec.c:45
init_get_bits8
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
Definition: get_bits.h:545
ASVDecContext::permutated_scantable
uint8_t permutated_scantable[64]
Definition: asvdec.c:61
ac_ccp_vlc
static VLCElem ac_ccp_vlc[64]
Definition: asvdec.c:51
AV_FRAME_FLAG_KEY
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
Definition: frame.h:595
CLOSE_READER
#define CLOSE_READER(name, gb)
Definition: get_bits.h:188
AVCodecContext::extradata_size
int extradata_size
Definition: avcodec.h:524
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:287
ff_blockdsp_init
av_cold void ff_blockdsp_init(BlockDSPContext *c)
Definition: blockdsp.c:58
VLC_INIT_LE
#define VLC_INIT_LE
Definition: vlc.h:186
bits
uint8_t bits
Definition: vp3data.h:128
asv.h
get_bits_le
static unsigned int get_bits_le(GetBitContext *s, int n)
Definition: get_bits.h:356
get_sbits
static int get_sbits(GetBitContext *s, int n)
Definition: get_bits.h:320
idct_put
static void idct_put(ASVDecContext *a, AVFrame *frame, int mb_x, int mb_y)
Definition: asvdec.c:213
decode.h
get_bits.h
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
SHOW_UBITS_LE
#define SHOW_UBITS_LE(name, gb, num)
Definition: get_bits.h:249
decode_frame
static int decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
Definition: asvdec.c:233
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
frame
static AVFrame * frame
Definition: demux_decode.c:54
AVCodecContext::codec_id
enum AVCodecID codec_id
Definition: avcodec.h:455
asv1_decode_block
static int asv1_decode_block(ASVDecContext *a, int16_t block[64])
Definition: asvdec.c:126
ff_asv_ac_ccp_tab
const uint8_t ff_asv_ac_ccp_tab[16][2]
Definition: asv.c:62
AV_ONCE_INIT
#define AV_ONCE_INIT
Definition: thread.h:203
AV_PICTURE_TYPE_I
@ AV_PICTURE_TYPE_I
Intra.
Definition: avutil.h:279
ASVDecContext::gb
GetBitContext gb
Definition: asvdec.c:57
init_vlcs
static av_cold void init_vlcs(void)
Definition: asvdec.c:68
LAST_SKIP_BITS
#define LAST_SKIP_BITS(name, gb, num)
Definition: get_bits.h:247
asv2_get_vlc2
static int asv2_get_vlc2(GetBitContext *gb, const VLCElem *table, int bits)
Definition: asvdec.c:98
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
ASVDecContext::block
int16_t block[6][64]
Definition: asvdec.c:62
index
int index
Definition: gxfenc.c:89
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
AVFrame::pict_type
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:446
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1569
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
AV_CODEC_FLAG_GRAY
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
Definition: avcodec.h:322
AVPacket::size
int size
Definition: packet.h:523
scale
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition: vvc_intra.c:291
codec_internal.h
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem_internal.h:109
VLCElem
Definition: vlc.h:32
ff_mpeg1_default_intra_matrix
const uint16_t ff_mpeg1_default_intra_matrix[256]
Definition: mpeg12data.c:31
OPEN_READER
#define OPEN_READER(name, gb)
Definition: get_bits.h:177
ff_asv_common_init
av_cold void ff_asv_common_init(AVCodecContext *avctx)
Definition: asv.c:91
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
attributes.h
AV_CODEC_ID_ASV1
@ AV_CODEC_ID_ASV1
Definition: codec_id.h:83
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
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
AVCodecContext::extradata
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:523
asv2_level_vlc
static VLCElem asv2_level_vlc[1024]
Definition: asvdec.c:52
AV_CODEC_ID_ASV2
@ AV_CODEC_ID_ASV2
Definition: codec_id.h:84
av_fast_padded_malloc
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
Definition: utils.c:52
CCP_VLC_BITS
#define CCP_VLC_BITS
Definition: asvdec.c:42
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:657
DC_CCP_VLC_BITS
#define DC_CCP_VLC_BITS
Definition: asvdec.c:43
idctdsp.h
avcodec.h
decode_mb
static int decode_mb(ASVDecContext *a, int16_t block[6][64])
Definition: asvdec.c:193
ret
ret
Definition: filter_design.txt:187
IDCTDSPContext
Definition: idctdsp.h:43
ASVDecContext
Definition: asvdec.c:54
ASVDecContext::intra_matrix
uint16_t intra_matrix[64]
Definition: asvdec.c:63
mpeg12data.h
AVCodecContext
main external API structure.
Definition: avcodec.h:445
UPDATE_CACHE_LE
#define UPDATE_CACHE_LE(name, gb)
Definition: get_bits.h:209
decode_end
static av_cold int decode_end(AVCodecContext *avctx)
Definition: asvdec.c:338
VLC_INIT_STATIC_TABLE
#define VLC_INIT_STATIC_TABLE(vlc_table, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, flags)
Definition: vlc.h:267
ccp_vlc
static VLCElem ccp_vlc[32]
Definition: asvdec.c:48
ASVDecContext::bitstream_buffer
uint8_t * bitstream_buffer
Definition: asvdec.c:64
level_vlc
static VLCElem level_vlc[16]
Definition: asvdec.c:49
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
asv2_decode_block
static int asv2_decode_block(ASVDecContext *a, int16_t block[64])
Definition: asvdec.c:157
mem.h
init_get_bits8_le
static int init_get_bits8_le(GetBitContext *s, const uint8_t *buffer, int byte_size)
Definition: get_bits.h:553
ff_asv_ccp_tab
const uint8_t ff_asv_ccp_tab[17][2]
Definition: asv.c:45
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:472
AVPacket
This structure stores compressed data.
Definition: packet.h:499
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
vlc.h
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:389
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
dc_ccp_vlc
static VLCElem dc_ccp_vlc[16]
Definition: asvdec.c:50
asv1_get_level
static int asv1_get_level(GetBitContext *gb)
Definition: asvdec.c:87
ff_asv2_decoder
const FFCodec ff_asv2_decoder