35#include "config_components.h"
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
132 for (
i = 0;
i < 11;
i++) {
138 if (ccp < 0 || i >= 10) {
175 for (
i = 1;
i < count + 1;
i++) {
197 a->bdsp.clear_blocks(
block[0]);
200 for (
i = 0;
i < 6;
i++) {
205 for (
i = 0;
i < 6;
i++) {
215 int16_t(*
block)[64] =
a->block;
216 int linesize =
frame->linesize[0];
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;
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]);
228 a->idsp.idct_put(dest_cb,
frame->linesize[1],
block[4]);
229 a->idsp.idct_put(dest_cr,
frame->linesize[2],
block[5]);
238 const uint8_t *buf = avpkt->
data;
239 int buf_size = avpkt->
size;
242 if (buf_size * 8LL <
c->mb_height *
c->mb_width * 13LL)
251 if (!
a->bitstream_buffer)
254 c->bbdsp.bswap_buf((uint32_t *)
a->bitstream_buffer,
255 (
const uint32_t *) buf, buf_size / 4);
263 for (
int mb_y = 0; mb_y <
c->mb_height2; mb_y++) {
264 for (
int mb_x = 0; mb_x <
c->mb_width2; mb_x++) {
272 if (
c->mb_width2 !=
c->mb_width) {
273 int mb_x =
c->mb_width2;
274 for (
int mb_y = 0; mb_y <
c->mb_height2; mb_y++) {
282 if (
c->mb_height2 !=
c->mb_height) {
283 int mb_y =
c->mb_height2;
284 for (
int mb_x = 0; mb_x <
c->mb_width; mb_x++) {
313 a->idsp.idct_permutation);
324 for (
i = 0;
i < 64;
i++) {
341 a->bitstream_buffer_size = 0;
346#if CONFIG_ASV1_DECODER
360#if CONFIG_ASV2_DECODER
const FFCodec ff_asv1_decoder
const FFCodec ff_asv2_decoder
static av_cold void close(AVCodecParserContext *s)
const uint8_t ff_asv_level_tab[7][2]
const uint8_t ff_asv_dc_ccp_tab[8][2]
const uint8_t ff_asv_scantab[64]
const uint8_t ff_asv_ac_ccp_tab[16][2]
const uint16_t ff_asv2_level_tab[63][2]
av_cold void ff_asv_common_init(AVCodecContext *avctx)
const uint8_t ff_asv_ccp_tab[17][2]
ASUS V1/V2 encoder/decoder common data.
static int decode_mb(ASVDecContext *a, int16_t block[6][64])
static VLCElem ccp_vlc[32]
static int asv1_get_level(GetBitContext *gb)
static VLCElem level_vlc[16]
static av_cold int decode_init(AVCodecContext *avctx)
static VLCElem asv2_level_vlc[1024]
static int asv2_get_level(GetBitContext *gb)
static av_cold int decode_end(AVCodecContext *avctx)
static int asv1_decode_block(ASVDecContext *a, int16_t block[64])
static int asv2_decode_block(ASVDecContext *a, int16_t block[64])
static int decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
#define ASV1_LEVEL_VLC_BITS
#define ASV2_LEVEL_VLC_BITS
static int asv2_get_vlc2(GetBitContext *gb, const VLCElem *table, int bits)
static VLCElem ac_ccp_vlc[64]
static VLCElem dc_ccp_vlc[16]
static av_cold void init_vlcs(void)
static void idct_put(ASVDecContext *a, AVFrame *frame, int mb_x, int mb_y)
Libavcodec external API header.
#define i(width, name, range_min, range_max)
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int(* init)(AVBSFContext *ctx)
static const uint8_t bits[8]
bitstream reader API header.
static unsigned int get_bits_le(GetBitContext *s, int n)
static int init_get_bits8_le(GetBitContext *s, const uint8_t *buffer, int byte_size)
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
static int get_sbits(GetBitContext *s, int n)
#define CLOSE_READER(name, gb)
#define OPEN_READER(name, gb)
#define SHOW_UBITS_LE(name, gb, num)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
#define LAST_SKIP_BITS(name, gb, num)
static int get_bits_count(const GetBitContext *s)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define UPDATE_CACHE_LE(name, gb)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
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...
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void scale(int *out, const int *in, const int w, const int h, const int shift)
static av_cold int decode_init(AVCodecContext *avctx)
static av_cold int decode_end(AVCodecContext *avctx)
static av_cold void init_vlcs(void)
static int decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
av_cold void ff_blockdsp_init(BlockDSPContext *c)
av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
av_cold void ff_permute_scantable(uint8_t dst[64], const uint8_t src[64], const uint8_t permutation[64])
Macro definitions for various function/variable attributes.
static int ff_thread_once(char *control, void(*routine)(void))
Memory handling functions.
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
const uint16_t ff_mpeg1_default_intra_matrix[256]
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static const uint16_t table[]
unsigned int bitstream_buffer_size
uint8_t * bitstream_buffer
uint16_t intra_matrix[64]
uint8_t permutated_scantable[64]
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
#define VLC_INIT_STATIC_TABLE(vlc_table, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, flags)