37 #define ASV2_LEVEL_VLC_BITS 10
59 0x00,0x08,0x01,0x09,0x10,0x18,0x11,0x19,
60 0x02,0x0A,0x03,0x0B,0x12,0x1A,0x13,0x1B,
61 0x04,0x0C,0x05,0x0D,0x20,0x28,0x21,0x29,
62 0x06,0x0E,0x07,0x0F,0x14,0x1C,0x15,0x1D,
63 0x22,0x2A,0x23,0x2B,0x30,0x38,0x31,0x39,
64 0x16,0x1E,0x17,0x1F,0x24,0x2C,0x25,0x2D,
65 0x32,0x3A,0x33,0x3B,0x26,0x2E,0x27,0x2F,
66 0x34,0x3C,0x35,0x3D,0x36,0x3E,0x37,0x3F,
71 {0x2,2}, {0x7,5}, {0xB,5}, {0x3,5},
72 {0xD,5}, {0x5,5}, {0x9,5}, {0x1,5},
73 {0xE,5}, {0x6,5}, {0xA,5}, {0x2,5},
74 {0xC,5}, {0x4,5}, {0x8,5}, {0x3,2},
79 {3,4}, {3,3}, {3,2}, {0,3}, {2,2}, {2,3}, {2,4}
83 {0x1,2}, {0xD,4}, {0xF,4}, {0xC,4},
84 {0x5,3}, {0xE,4}, {0x4,3}, {0x0,2},
88 {0x00,2}, {0x3B,6}, {0x0A,4}, {0x3A,6},
89 {0x02,3}, {0x39,6}, {0x3C,6}, {0x38,6},
90 {0x03,3}, {0x3D,6}, {0x08,4}, {0x1F,5},
91 {0x09,4}, {0x0B,4}, {0x0D,4}, {0x0C,4},
95 {0x3F,10},{0x2F,10},{0x37,10},{0x27,10},{0x3B,10},{0x2B,10},{0x33,10},{0x23,10},
96 {0x3D,10},{0x2D,10},{0x35,10},{0x25,10},{0x39,10},{0x29,10},{0x31,10},{0x21,10},
97 {0x1F, 8},{0x17, 8},{0x1B, 8},{0x13, 8},{0x1D, 8},{0x15, 8},{0x19, 8},{0x11, 8},
98 {0x0F, 6},{0x0B, 6},{0x0D, 6},{0x09, 6},
104 {0x08, 6},{0x0C, 6},{0x0A, 6},{0x0E, 6},
105 {0x10, 8},{0x18, 8},{0x14, 8},{0x1C, 8},{0x12, 8},{0x1A, 8},{0x16, 8},{0x1E, 8},
106 {0x20,10},{0x30,10},{0x28,10},{0x38,10},{0x24,10},{0x34,10},{0x2C,10},{0x3C,10},
107 {0x22,10},{0x32,10},{0x2A,10},{0x3A,10},{0x26,10},{0x36,10},{0x2E,10},{0x3E,10},
154 else return code - 3;
161 else return code - 31;
165 unsigned int index= level + 3;
175 unsigned int index= level + 31;
194 if(ccp < 0 || i>=10){
223 for(i=1; i<count+1; i++){
248 if( (block[index + 0] = (block[index + 0]*a->
q_intra_matrix[index + 0] + (1<<15))>>16) ) ccp |= 8;
249 if( (block[index + 8] = (block[index + 8]*a->
q_intra_matrix[index + 8] + (1<<15))>>16) ) ccp |= 4;
250 if( (block[index + 1] = (block[index + 1]*a->
q_intra_matrix[index + 1] + (1<<15))>>16) ) ccp |= 2;
251 if( (block[index + 9] = (block[index + 9]*a->
q_intra_matrix[index + 9] + (1<<15))>>16) ) ccp |= 1;
254 for(;nc_count; nc_count--)
274 for(count=63; count>3; count--){
287 for(i=0; i<=count; i++){
291 if( (block[index + 0] = (block[index + 0]*a->
q_intra_matrix[index + 0] + (1<<15))>>16) ) ccp |= 8;
292 if( (block[index + 8] = (block[index + 8]*a->
q_intra_matrix[index + 8] + (1<<15))>>16) ) ccp |= 4;
293 if( (block[index + 1] = (block[index + 1]*a->
q_intra_matrix[index + 1] + (1<<15))>>16) ) ccp |= 2;
294 if( (block[index + 9] = (block[index + 9]*a->
q_intra_matrix[index + 9] + (1<<15))>>16) ) ccp |= 1;
350 uint8_t *dest_y = a->
picture.
data[0] + (mb_y * 16* linesize ) + mb_x * 16;
370 uint8_t *ptr_y = a->
picture.
data[0] + (mb_y * 16* linesize ) + mb_x * 16;
390 void *
data,
int *data_size,
393 const uint8_t *buf = avpkt->
data;
394 int buf_size = avpkt->
size;
419 for(i=0; i<buf_size; i++)
446 for(mb_x=0; mb_x<a->
mb_width; mb_x++){
462 #if CONFIG_ASV1_ENCODER || CONFIG_ASV2_ENCODER
493 for(mb_x=0; mb_x<a->
mb_width; mb_x++){
510 for(i=0; i<4*
size; i++)
571 #if CONFIG_ASV1_ENCODER || CONFIG_ASV2_ENCODER
634 #if CONFIG_ASV1_ENCODER
648 #if CONFIG_ASV2_ENCODER
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int(* get_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called at the beginning of each frame to get a buffer for it.
const uint8_t av_reverse[256]
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int qstride
QP store stride.
static const uint8_t ac_ccp_tab[16][2]
static const uint8_t ccp_tab[17][2]
static void put_sbits(PutBitContext *pb, int n, int32_t value)
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
AVFrame * coded_frame
the picture in the bitstream
static int decode_mb(ASV1Context *a, DCTELEM block[6][64])
static av_cold int encode_init(AVCodecContext *avctx)
static void asv2_put_level(PutBitContext *pb, int level)
static const uint8_t level_tab[7][2]
void avpriv_align_put_bits(PutBitContext *s)
Pad the bitstream with zeros up to the next byte boundary.
#define DECLARE_ALIGNED(n, t, v)
static void asv2_encode_block(ASV1Context *a, DCTELEM block[64])
static VLC asv2_level_vlc
unsigned int bitstream_buffer_size
static const uint8_t scantab[64]
four components are given, that's all.
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
static int get_sbits(GetBitContext *s, int n)
static int asv1_decode_block(ASV1Context *a, DCTELEM block[64])
static av_cold void common_init(AVCodecContext *avctx)
static int asv1_get_level(GetBitContext *gb)
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
static int asv2_get_level(GetBitContext *gb)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size)
uint8_t * bitstream_buffer
void(* get_pixels)(DCTELEM *block, const uint8_t *pixels, int line_size)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static int get_bits_count(const GetBitContext *s)
uint8_t idct_permutation[64]
idct input permutation.
av_cold void dsputil_init(DSPContext *c, AVCodecContext *avctx)
static int init(AVCodecParserContext *s)
static void dct_get(ASV1Context *a, int mb_x, int mb_y)
#define CODEC_FLAG_GRAY
Only decode/encode grayscale.
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
const uint16_t ff_mpeg1_default_intra_matrix[64]
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
void(* bswap_buf)(uint32_t *dst, const uint32_t *src, int w)
void(* idct_put)(uint8_t *dest, int line_size, DCTELEM *block)
block -> idct -> clip to unsigned 8 bit -> dest.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static av_cold int decode_init(AVCodecContext *avctx)
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
static void put_bits(PutBitContext *s, int n, unsigned int value)
Write up to 31 bits into a bitstream.
uint16_t intra_matrix[64]
static int asv2_decode_block(ASV1Context *a, DCTELEM block[64])
static int put_bits_count(PutBitContext *s)
static av_always_inline void emms_c(void)
Empty mmx state.
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
int width
picture width / height.
int quality
quality (between 1 (good) and FF_LAMBDA_MAX (bad))
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
static void asv1_encode_block(ASV1Context *a, DCTELEM block[64])
static void idct_put(ASV1Context *a, int mb_x, int mb_y)
int AC3_NAME() encode_frame(AVCodecContext *avctx, unsigned char *frame, int buf_size, void *data)
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
#define ASV2_LEVEL_VLC_BITS
static void close(AVCodecParserContext *s)
struct ASV1Context ASV1Context
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
static const uint8_t asv2_level_tab[63][2]
int global_quality
Global quality for codecs which cannot change it per frame.
static const uint16_t scale[4]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int8_t * qscale_table
QP table.
void(* clear_blocks)(DCTELEM *blocks)
static av_cold int decode_end(AVCodecContext *avctx)
common internal and external API header
void(* fdct)(DCTELEM *block)
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
static int asv2_get_bits(GetBitContext *gb, int n)
void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
VLC_TYPE(* table)[2]
code, bits
static void asv1_put_level(PutBitContext *pb, int level)
static void asv2_put_bits(PutBitContext *pb, int n, int v)
int key_frame
1 -> keyframe, 0-> not
static const uint8_t dc_ccp_tab[8][2]
static av_cold void init_vlcs(ASV1Context *a)
static int encode_mb(ASV1Context *a, DCTELEM block[6][64])