90 #define FULLPEL_MODE 1 91 #define HALFPEL_MODE 2 92 #define THIRDPEL_MODE 3 93 #define PREDICT_MODE 4 105 0 + 0 * 4, 1 + 0 * 4, 2 + 0 * 4, 2 + 1 * 4,
106 2 + 2 * 4, 3 + 0 * 4, 3 + 1 * 4, 3 + 2 * 4,
107 0 + 1 * 4, 0 + 2 * 4, 1 + 1 * 4, 1 + 2 * 4,
108 0 + 3 * 4, 1 + 3 * 4, 2 + 3 * 4, 3 + 3 * 4,
112 0 * 16 + 0 * 64, 1 * 16 + 0 * 64, 2 * 16 + 0 * 64, 0 * 16 + 2 * 64,
113 3 * 16 + 0 * 64, 0 * 16 + 1 * 64, 1 * 16 + 1 * 64, 2 * 16 + 1 * 64,
114 1 * 16 + 2 * 64, 2 * 16 + 2 * 64, 3 * 16 + 2 * 64, 0 * 16 + 3 * 64,
115 3 * 16 + 1 * 64, 1 * 16 + 3 * 64, 2 * 16 + 3 * 64, 3 * 16 + 3 * 64,
121 { 0, 2 }, { 1, 1 }, { 2, 0 },
122 { 3, 0 }, { 2, 1 }, { 1, 2 }, { 0, 3 },
123 { 0, 4 }, { 1, 3 }, { 2, 2 }, { 3, 1 }, { 4, 0 },
124 { 4, 1 }, { 3, 2 }, { 2, 3 }, { 1, 4 },
125 { 2, 4 }, { 3, 3 }, { 4, 2 },
131 { { 2, -1, -1, -1, -1 }, { 2, 1, -1, -1, -1 }, { 1, 2, -1, -1, -1 },
132 { 2, 1, -1, -1, -1 }, { 1, 2, -1, -1, -1 }, { 1, 2, -1, -1, -1 } },
133 { { 0, 2, -1, -1, -1 }, { 0, 2, 1, 4, 3 }, { 0, 1, 2, 4, 3 },
134 { 0, 2, 1, 4, 3 }, { 2, 0, 1, 3, 4 }, { 0, 4, 2, 1, 3 } },
135 { { 2, 0, -1, -1, -1 }, { 2, 1, 0, 4, 3 }, { 1, 2, 4, 0, 3 },
136 { 2, 1, 0, 4, 3 }, { 2, 1, 4, 3, 0 }, { 1, 2, 4, 0, 3 } },
137 { { 2, 0, -1, -1, -1 }, { 2, 0, 1, 4, 3 }, { 1, 2, 0, 4, 3 },
138 { 2, 1, 0, 4, 3 }, { 2, 1, 3, 4, 0 }, { 2, 4, 1, 0, 3 } },
139 { { 0, 2, -1, -1, -1 }, { 0, 2, 1, 3, 4 }, { 1, 2, 3, 0, 4 },
140 { 2, 0, 1, 3, 4 }, { 2, 1, 3, 0, 4 }, { 2, 0, 4, 3, 1 } },
141 { { 0, 2, -1, -1, -1 }, { 0, 2, 4, 1, 3 }, { 1, 4, 2, 0, 3 },
142 { 4, 2, 0, 1, 3 }, { 2, 0, 1, 4, 3 }, { 4, 2, 1, 0, 3 } },
145 static const struct {
149 { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 2, 1 }, { 0, 2 }, { 3, 1 }, { 4, 1 }, { 5, 1 },
150 { 0, 3 }, { 1, 2 }, { 2, 2 }, { 6, 1 }, { 7, 1 }, { 8, 1 }, { 9, 1 }, { 0, 4 } },
151 { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 0, 2 }, { 2, 1 }, { 0, 3 }, { 0, 4 }, { 0, 5 },
152 { 3, 1 }, { 4, 1 }, { 1, 2 }, { 1, 3 }, { 0, 6 }, { 0, 7 }, { 0, 8 }, { 0, 9 } }
156 3881, 4351, 4890, 5481, 6154, 6914, 7761, 8718,
157 9781, 10987, 12339, 13828, 15523, 17435, 19561, 21873,
158 24552, 27656, 30847, 34870, 38807, 43747, 49103, 54683,
159 61694, 68745, 77615, 89113, 100253, 109366, 126635, 141533
170 for (i = 0; i < 4; i++) {
171 const int z0 = 13 * (input[4 * i + 0] + input[4 * i + 2]);
172 const int z1 = 13 * (input[4 * i + 0] - input[4 * i + 2]);
173 const int z2 = 7 * input[4 * i + 1] - 17 * input[4 * i + 3];
174 const int z3 = 17 * input[4 * i + 1] + 7 * input[4 * i + 3];
176 temp[4 * i + 0] = z0 + z3;
177 temp[4 * i + 1] = z1 + z2;
178 temp[4 * i + 2] = z1 - z2;
179 temp[4 * i + 3] = z0 - z3;
182 for (i = 0; i < 4; i++) {
183 const int offset = x_offset[i];
184 const int z0 = 13 * (temp[4 * 0 + i] + temp[4 * 2 + i]);
185 const int z1 = 13 * (temp[4 * 0 + i] - temp[4 * 2 + i]);
186 const int z2 = 7 * temp[4 * 1 + i] - 17 * temp[4 * 3 + i];
187 const int z3 = 17 * temp[4 * 1 + i] + 7 * temp[4 * 3 + i];
189 output[stride * 0 + offset] = (z0 + z3) * qmul + 0x80000 >> 20;
190 output[stride * 2 + offset] = (z1 + z2) * qmul + 0x80000 >> 20;
191 output[stride * 8 + offset] = (z1 - z2) * qmul + 0x80000 >> 20;
192 output[stride * 10 + offset] = (z0 - z3) * qmul + 0x80000 >> 20;
204 dc = 13 * 13 * (dc == 1 ? 1538 * block[0]
205 : qmul * (block[0] >> 3) / 2);
209 for (i = 0; i < 4; i++) {
210 const int z0 = 13 * (block[0 + 4 * i] + block[2 + 4 * i]);
211 const int z1 = 13 * (block[0 + 4 * i] - block[2 + 4 * i]);
212 const int z2 = 7 * block[1 + 4 * i] - 17 * block[3 + 4 * i];
213 const int z3 = 17 * block[1 + 4 * i] + 7 * block[3 + 4 * i];
215 block[0 + 4 * i] = z0 + z3;
216 block[1 + 4 * i] = z1 + z2;
217 block[2 + 4 * i] = z1 - z2;
218 block[3 + 4 * i] = z0 - z3;
221 for (i = 0; i < 4; i++) {
222 const int z0 = 13 * (block[i + 4 * 0] + block[i + 4 * 2]);
223 const int z1 = 13 * (block[i + 4 * 0] - block[i + 4 * 2]);
224 const int z2 = 7 * block[i + 4 * 1] - 17 * block[i + 4 * 3];
225 const int z3 = 17 * block[i + 4 * 1] + 7 * block[i + 4 * 3];
226 const int rr = (dc + 0x80000);
228 dst[i + stride * 0] = av_clip_uint8(dst[i + stride * 0] + ((z0 + z3) * qmul + rr >> 20));
229 dst[i + stride * 1] = av_clip_uint8(dst[i + stride * 1] + ((z1 + z2) * qmul + rr >> 20));
230 dst[i + stride * 2] = av_clip_uint8(dst[i + stride * 2] + ((z1 - z2) * qmul + rr >> 20));
231 dst[i + stride * 3] = av_clip_uint8(dst[i + stride * 3] + ((z0 - z3) * qmul + rr >> 20));
234 memset(block, 0, 16 *
sizeof(int16_t));
238 int index,
const int type)
240 static const uint8_t *
const scan_patterns[4] =
245 const int intra = 3 * type >> 2;
246 const uint8_t *
const scan = scan_patterns[type];
248 for (limit = (16 >> intra); index < 16; index = limit, limit += 8) {
250 int sign = (vlc & 1) ? 0 : -1;
257 }
else if (vlc < 4) {
262 level = (vlc + 9 >> 2) - run;
271 ((run == 0) ? 8 : ((run < 2) ? 2 : ((run < 5) ? 0 : -1)));
275 ((run == 0) ? 4 : ((run < 3) ? 2 : ((run < 10) ? 1 : 0)));
279 if ((index += run) >= limit)
282 block[scan[
index]] = (level ^ sign) - sign;
295 int mx,
int my,
int dxy,
296 int thirdpel,
int dir,
int avg)
302 int blocksize = 2 - (width >> 3);
307 if (mx < 0 || mx >= s->
h_edge_pos - width - 1 ||
310 mx = av_clip(mx, -16, s->
h_edge_pos - width + 15);
311 my = av_clip(my, -16, s->
v_edge_pos - height + 15);
321 width + 1, height + 1,
335 mx = mx + (mx < (int) x) >> 1;
336 my = my + (my < (int) y) >> 1;
338 height = height >> 1;
341 for (i = 1; i < 3; i++) {
348 width + 1, height + 1,
370 int i, j, k, mx, my, dx, dy, x, y;
372 const int part_width = ((size & 5) == 4) ? 4 : 16 >> (size & 1);
373 const int part_height = 16 >> ((unsigned)(size + 1) / 3);
374 const int extra_width = (mode ==
PREDICT_MODE) ? -16 * 6 : 0;
375 const int h_edge_pos = 6 * (s->
h_edge_pos - part_width) - extra_width;
376 const int v_edge_pos = 6 * (s->
v_edge_pos - part_height) - extra_width;
378 for (i = 0; i < 16; i += part_height)
379 for (j = 0; j < 16; j += part_width) {
380 const int b_xy = (4 * h->
mb_x + (j >> 2)) +
383 x = 16 * h->
mb_x + j;
384 y = 16 * h->
mb_y + i;
385 k = (j >> 2 & 1) + (i >> 1 & 2) +
386 (j >> 1 & 4) + (i & 8);
389 pred_motion(h, k, part_width >> 2, dir, 1, &mx, &my);
408 mx = av_clip(mx, extra_width - 6 * x, h_edge_pos - 6 * x);
409 my = av_clip(my, extra_width - 6 * y, v_edge_pos - 6 * y);
427 mx = (mx + 1 >> 1) + dx;
428 my = (my + 1 >> 1) + dy;
429 fx = (unsigned)(mx + 0x3000) / 3 - 0x1000;
430 fy = (unsigned)(my + 0x3000) / 3 - 0x1000;
431 dxy = (mx - 3 * fx) + 4 * (my - 3 * fy);
434 fx, fy, dxy, 1, dir, avg);
438 mx = (unsigned)(mx + 1 + 0x3000) / 3 + dx - 0x1000;
439 my = (unsigned)(my + 1 + 0x3000) / 3 + dy - 0x1000;
440 dxy = (mx & 1) + 2 * (my & 1);
443 mx >> 1, my >> 1, dxy, 0, dir, avg);
447 mx = (unsigned)(mx + 3 + 0x6000) / 6 + dx - 0x1000;
448 my = (unsigned)(my + 3 + 0x6000) / 6 + dy - 0x1000;
451 mx, my, 0, 0, dir, avg);
460 if (part_height == 8 && i < 8) {
463 if (part_width == 8 && j < 8)
466 if (part_width == 8 && j < 8)
468 if (part_width == 4 || part_height == 4)
474 part_width >> 2, part_height >> 2, h->
b_stride,
484 int i, j, k, m, dir, mode;
488 const int mb_xy = h->
mb_xy;
515 }
else if (mb_type < 8) {
533 for (m = 0; m < 2; m++) {
535 for (i = 0; i < 4; i++)
539 for (i = 0; i < 4; i++)
545 4 * 2 *
sizeof(int16_t));
581 for (i = 0; i < 4; i++)
583 0, 4 * 2 *
sizeof(int16_t));
589 for (i = 0; i < 4; i++)
591 0, 4 * 2 *
sizeof(int16_t));
596 }
else if (mb_type == 8 || mb_type == 33) {
601 for (i = 0; i < 4; i++)
617 for (i = 0; i < 16; i += 2) {
622 "luma prediction:%"PRIu32
"\n", vlc);
630 left[2] =
svq3_pred_1[top[1] + 1][left[1] + 1][svq3_pred_0[vlc][1]];
632 if (left[1] == -1 || left[2] == -1) {
638 for (i = 0; i < 4; i++)
650 for (i = 0; i < 4; i++)
660 dir = (dir >> 1) ^ 3 * (dir & 1) ^ 1;
672 for (i = 0; i < 4; i++)
674 0, 4 * 2 *
sizeof(int16_t));
676 for (i = 0; i < 4; i++)
678 0, 4 * 2 *
sizeof(int16_t));
712 "error while decoding intra luma dc\n");
721 for (i = 0; i < 4; i++)
722 if ((cbp & (1 << i))) {
723 for (j = 0; j < 4; j++) {
724 k = index ? (1 * (j & 1) + 2 * (i & 1) +
725 2 * (j & 2) + 4 * (i & 2))
731 "error while decoding block\n");
738 for (i = 1; i < 3; ++i)
741 "error while decoding chroma dc block\n");
746 for (i = 1; i < 3; i++) {
747 for (j = 0; j < 4; j++) {
753 "error while decoding chroma ac block\n");
775 const int mb_xy = h->
mb_xy;
781 if (((header & 0x9F) != 1 && (header & 0x9F) != 2) || (header & 0x60) == 0) {
786 int length = header >> 5 & 3;
819 if ((header & 0x9F) == 2) {
847 -1, 4 *
sizeof(int8_t));
849 -1, 8 *
sizeof(int8_t) * h->
mb_x);
867 unsigned char *extradata;
868 unsigned char *extradata_end;
870 int marker_found = 0;
902 extradata = (
unsigned char *)avctx->
extradata;
906 if (!memcmp(extradata,
"SEQH", 4)) {
920 if (size > extradata_end - extradata - 8)
926 switch (frame_size_code) {
988 unsigned long buf_len = watermark_width *
989 watermark_height * 4;
993 if (watermark_height > 0 &&
994 (uint64_t)watermark_width * 4 > UINT_MAX / watermark_height)
999 watermark_width, watermark_height);
1001 "u1: %x u2: %x u3: %x compressed data size: %d offset: %d\n",
1002 u1, u2, u3, u4, offset);
1003 if (uncompress(buf, &buf_len, extradata + 8 + offset,
1004 size - offset) != Z_OK) {
1006 "could not uncompress watermark logo\n");
1017 "this svq3 file contains watermark which need zlib support compiled in\n");
1044 for (i = 0; i < 2; i++) {
1059 const int b4_stride = h->
mb_width * 4 + 1;
1060 const int b4_array_size = b4_stride * h->
mb_height * 4;
1071 for (i = 0; i < 2; i++) {
1111 int buf_size = avpkt->
size;
1115 if (buf_size == 0) {
1155 for (i = 0; i < 16; i++) {
1159 for (i = 0; i < 16; i++) {
1194 "%c hpel:%d, tpel:%d aqp:%d qp:%d, slice_num:%02X\n",
1230 for (m = 0; m < 2; m++) {
1232 for (i = 0; i < 4; i++) {
1234 for (j = -1; j < 4; j++)
1266 "error while decoding MB %d %d\n", h->
mb_x, h->
mb_y);
#define MB_TYPE_INTRA16x16
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
discard all frames except keyframes
uint8_t * edge_emu_buffer
unsigned int top_samples_available
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
op_pixels_func avg_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
uint16_t ff_svq1_packet_checksum(const uint8_t *data, const int length, int value)
static int svq3_decode_block(GetBitContext *gb, int16_t *block, int index, const int type)
static void skip_bits_long(GetBitContext *s, int n)
av_cold int ff_h264_decode_init(AVCodecContext *avctx)
enum AVColorRange color_range
MPEG vs JPEG YUV range.
AVBufferRef * mb_type_buf
static unsigned svq3_get_ue_golomb(GetBitContext *gb)
int16_t(*[2] motion_val)[2]
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int16_t mv_cache[2][5 *8][2]
Motion vector cache.
void ff_draw_horiz_band(AVCodecContext *avctx, AVFrame *cur, AVFrame *last, int y, int h, int picture_structure, int first_field, int low_delay)
Draw a horizontal band if supported.
static av_always_inline uint32_t pack16to32(int a, int b)
static const uint8_t zigzag_scan[16]
Macro definitions for various function/variable attributes.
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 svq3_mc_dir(SVQ3Context *s, int size, int mode, int dir, int avg)
enum AVDiscard skip_frame
static const uint8_t golomb_to_pict_type[5]
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
static const uint8_t luma_dc_zigzag_scan[16]
int prev_frame_num_offset
for POC type 2
#define FF_DEBUG_PICT_INFO
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static const IMbInfo i_mb_type_info[26]
static int get_bits_count(const GetBitContext *s)
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
H.264 / AVC / MPEG4 part10 codec.
static void free_picture(AVCodecContext *avctx, H264Picture *pic)
int ff_h264_check_intra_pred_mode(H264Context *h, int mode, int is_chroma)
Check if the top & left blocks are available if needed and change the dc mode so it only uses the ava...
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int has_b_frames
Size of the frame reordering buffer in the decoder.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
int16_t mb_luma_dc[3][16 *2]
static const struct @59 svq3_dct_tables[2][16]
#define CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
av_cold void ff_tpeldsp_init(TpelDSPContext *c)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
Sorenson Vector Quantizer #1 (SVQ1) video codec.
static const uint8_t scan8[16 *3+3]
static av_always_inline void pred_motion(H264Context *const h, int n, int part_width, int list, int ref, int *const mx, int *const my)
Get the predicted MV.
av_cold void ff_hpeldsp_init(HpelDSPContext *c, int flags)
static int svq3_get_se_golomb(GetBitContext *gb)
void ff_svq3_add_idct_c(uint8_t *dst, int16_t *block, int stride, int qp, int dc)
useful rectangle filling function
unsigned int left_samples_available
tpel_mc_func avg_tpel_pixels_tab[11]
AVBufferRef * motion_val_buf[2]
enum AVPictureType pict_type
Picture type of the frame.
int frame_num_offset
for POC type 2
#define CODEC_CAP_DRAW_HORIZ_BAND
Decoder can use draw_horiz_band callback.
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_...
int width
picture width / height.
void ff_svq3_luma_dc_dequant_idct_c(int16_t *output, int16_t *input, int qp)
void(* emulated_edge_mc)(uint8_t *buf, const uint8_t *src, ptrdiff_t buf_linesize, ptrdiff_t src_linesize, int block_w, int block_h, int src_x, int src_y, int w, int h)
Copy a rectangular area of samples to a temporary buffer and replicate the border samples...
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
static av_cold int svq3_decode_init(AVCodecContext *avctx)
static void fill_rectangle(SDL_Surface *screen, int x, int y, int w, int h, int color)
tpel_mc_func put_tpel_pixels_tab[11]
Thirdpel motion compensation with rounding (a + b + 1) >> 1.
int8_t intra4x4_pred_mode_cache[5 *8]
unsigned int topright_samples_available
static const uint8_t golomb_to_intra4x4_cbp[48]
#define PART_NOT_AVAILABLE
the normal 2^n-1 "JPEG" YUV ranges
if(ac->has_optimized_func)
static const int8_t mv[256][2]
Libavcodec external API header.
H264 / AVC / MPEG4 part10 codec data table
int prev_frame_num
frame_num of the last pic for POC type 1/2
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
static void close(AVCodecParserContext *s)
int ff_h264_check_intra4x4_pred_mode(H264Context *h)
Check if the top & left blocks are available if needed and change the dc mode so it only uses the ava...
uint8_t * data
The data buffer.
int ff_h264_alloc_tables(H264Context *h)
Allocate tables.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int16_t mb[16 *48 *2]
as a dct coeffecient is int32_t in high depth, we need to reserve twice the space.
op_pixels_func put_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
AVBufferRef * av_buffer_allocz(int size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
static const uint8_t chroma_dc_scan[4]
static void svq3_mc_dir_part(SVQ3Context *s, int x, int y, int width, int height, int mx, int my, int dxy, int thirdpel, int dir, int avg)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
H264Picture * cur_pic_ptr
static av_cold int svq3_decode_end(AVCodecContext *avctx)
static const uint8_t svq3_pred_0[25][2]
int block_offset[2 *(16 *3)]
block_offset[ 0..23] for frame macroblocks block_offset[24..47] for field macroblocks ...
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
av_cold void ff_h264_free_context(H264Context *h)
Free any data that may have been allocated in the H264 context like SPS, PPS etc. ...
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
discard all non reference
common internal api header.
#define CODEC_FLAG_GRAY
Only decode/encode grayscale.
static int get_buffer(AVCodecContext *avctx, H264Picture *pic)
H.264 / AVC / MPEG4 part10 motion vector predicion.
static const uint8_t golomb_to_inter_cbp[48]
static av_cold int init(AVCodecParserContext *s)
static av_always_inline void write_back_intra_pred_mode(H264Context *h)
static const uint32_t svq3_dequant_coeff[32]
uint8_t non_zero_count_cache[15 *8]
non zero coeff count cache.
static int svq3_decode_slice_header(AVCodecContext *avctx)
int key_frame
1 -> keyframe, 0-> not
enum AVPictureType pict_type
static const uint8_t svq3_scan[16]
AVBufferRef * ref_index_buf[2]
static const int8_t svq3_pred_1[6][6][5]
int8_t * intra4x4_pred_mode
#define FFSWAP(type, a, b)
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_dlog(ac->avr, "%d samples - audio_convert: %s to %s (dithered)\", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> dc
AVPixelFormat
Pixel format.
This structure stores compressed data.
static int svq3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
void ff_h264_hl_decode_mb(H264Context *h)
int8_t ref_cache[2][5 *8]