Go to the documentation of this file.
29 #include "config_components.h"
54 #if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER
56 typedef struct SpriteData {
70 int effect_type, effect_flag;
71 int effect_pcount1, effect_pcount2;
72 int effect_params1[15], effect_params2[10];
80 static void vc1_sprite_parse_transform(
GetBitContext* gb,
int c[7])
87 c[2] = get_fp_val(gb);
91 c[0] =
c[4] = get_fp_val(gb);
92 c[2] = get_fp_val(gb);
95 c[0] = get_fp_val(gb);
96 c[2] = get_fp_val(gb);
97 c[4] = get_fp_val(gb);
100 c[0] = get_fp_val(gb);
101 c[1] = get_fp_val(gb);
102 c[2] = get_fp_val(gb);
103 c[3] = get_fp_val(gb);
104 c[4] = get_fp_val(gb);
107 c[5] = get_fp_val(gb);
109 c[6] = get_fp_val(gb);
119 for (sprite = 0; sprite <= v->
two_sprites; sprite++) {
120 vc1_sprite_parse_transform(gb, sd->coefs[sprite]);
121 if (sd->coefs[sprite][1] || sd->coefs[sprite][3])
124 for (
i = 0;
i < 7;
i++)
126 sd->coefs[sprite][
i] / (1<<16),
127 (
abs(sd->coefs[sprite][
i]) & 0xFFFF) * 1000 / (1 << 16));
133 switch (sd->effect_pcount1 =
get_bits(gb, 4)) {
135 vc1_sprite_parse_transform(gb, sd->effect_params1);
138 vc1_sprite_parse_transform(gb, sd->effect_params1);
139 vc1_sprite_parse_transform(gb, sd->effect_params1 + 7);
142 for (
i = 0;
i < sd->effect_pcount1;
i++)
143 sd->effect_params1[
i] = get_fp_val(gb);
145 if (sd->effect_type != 13 || sd->effect_params1[0] != sd->coefs[0][6]) {
148 for (
i = 0;
i < sd->effect_pcount1;
i++)
150 sd->effect_params1[
i] / (1 << 16),
151 (
abs(sd->effect_params1[
i]) & 0xFFFF) * 1000 / (1 << 16));
155 sd->effect_pcount2 =
get_bits(gb, 16);
156 if (sd->effect_pcount2 > 10) {
159 }
else if (sd->effect_pcount2) {
162 while (++i < sd->effect_pcount2) {
163 sd->effect_params2[
i] = get_fp_val(gb);
165 sd->effect_params2[
i] / (1 << 16),
166 (
abs(sd->effect_params2[
i]) & 0xFFFF) * 1000 / (1 << 16));
185 static void vc1_draw_sprites(
VC1Context *v, SpriteData* sd)
187 int i, plane, row, sprite;
188 int sr_cache[2][2] = { { -1, -1 }, { -1, -1 } };
189 uint8_t* src_h[2][2];
190 int xoff[2], xadv[2], yoff[2], yadv[2],
alpha;
196 xadv[
i] = sd->coefs[
i][0];
205 for (plane = 0; plane < (CONFIG_GRAY &&
s->avctx->flags &
AV_CODEC_FLAG_GRAY ? 1 : 3); plane++) {
212 for (sprite = 0; sprite <= v->
two_sprites; sprite++) {
213 uint8_t *iplane =
s->current_picture.f->data[plane];
214 int iline =
s->current_picture.f->linesize[plane];
215 int ycoord = yoff[sprite] + yadv[sprite] * row;
216 int yline = ycoord >> 16;
218 ysub[sprite] = ycoord & 0xFFFF;
220 iplane =
s->last_picture.f->data[plane];
221 iline =
s->last_picture.f->linesize[plane];
224 if (!(xoff[sprite] & 0xFFFF) && xadv[sprite] == 1 << 16) {
225 src_h[sprite][0] = iplane + (xoff[sprite] >> 16) + yline * iline;
227 src_h[sprite][1] = iplane + (xoff[sprite] >> 16) + next_line;
229 if (sr_cache[sprite][0] != yline) {
230 if (sr_cache[sprite][1] == yline) {
232 FFSWAP(
int, sr_cache[sprite][0], sr_cache[sprite][1]);
235 sr_cache[sprite][0] = yline;
238 if (ysub[sprite] && sr_cache[sprite][1] != yline + 1) {
240 iplane + next_line, xoff[sprite],
241 xadv[sprite],
width);
242 sr_cache[sprite][1] = yline + 1;
244 src_h[sprite][0] = v->
sr_rows[sprite][0];
245 src_h[sprite][1] = v->
sr_rows[sprite][1];
253 memcpy(dst, src_h[0][0],
width);
256 if (ysub[0] && ysub[1]) {
258 src_h[1][0], src_h[1][1], ysub[1],
alpha,
width);
259 }
else if (ysub[0]) {
262 }
else if (ysub[1]) {
289 memset(&sd, 0,
sizeof(sd));
291 ret = vc1_parse_sprites(v, gb, &sd);
295 if (!
s->current_picture.f || !
s->current_picture.f->data[0]) {
300 if (v->
two_sprites && (!
s->last_picture_ptr || !
s->last_picture.f->data[0])) {
309 vc1_draw_sprites(v, &sd);
326 for (plane = 0; plane < (CONFIG_GRAY &&
s->avctx->flags &
AV_CODEC_FLAG_GRAY ? 1 : 3); plane++)
328 memset(
f->data[plane] +
i *
f->linesize[plane],
329 plane ? 128 : 0,
f->linesize[plane]);
338 int mb_height =
FFALIGN(
s->mb_height, 2);
383 v->
mv_f_base =
av_mallocz(2 * (
s->b8_stride * (mb_height * 2 + 1) +
s->mb_stride * (mb_height + 1) * 2));
387 v->
mv_f[1] = v->
mv_f[0] + (
s->b8_stride * (mb_height * 2 + 1) +
s->mb_stride * (mb_height + 1) * 2);
392 v->
mv_f_next[1] = v->
mv_f_next[0] + (
s->b8_stride * (mb_height * 2 + 1) +
s->mb_stride * (mb_height + 1) * 2);
395 for (
i = 0;
i < 4;
i++)
401 s->block,
s->block_last_index,
402 s->mb_width,
s->mb_height);
460 for (
i = 0;
i < 64;
i++) {
461 #define transpose(x) (((x) >> 3) | (((x) & 7) << 3))
473 0, 520, 552, 616, 1128, 1160, 1224, 1740, 1772, 1836, 1900, 2436,
474 2986, 3050, 3610, 4154, 4218, 4746, 5326, 5390, 5902, 6554, 7658, 8342,
475 9304, 9988, 10630, 11234, 12174, 13006, 13560, 14232, 14786, 15432, 16350, 17522,
476 20372, 21818, 22330, 22394, 23166, 23678, 23742, 24820, 25332, 25396, 26460, 26980,
477 27048, 27592, 27600, 27608, 27616, 27624, 28224, 28258, 28290, 28802, 28834, 28866,
478 29378, 29412, 29444, 29960, 29994, 30026, 30538, 30572, 30604, 31120, 31154, 31186,
479 31714, 31746, 31778, 32306, 32340, 32372
484 static VLCElem vlc_table[32372];
495 for (
int i = 0;
i < 3;
i++) {
512 for (
int i = 0;
i < 4;
i++) {
529 for (
int i = 0;
i < 8;
i++) {
542 for (
int i = 0;
i < 4;
i++) {
562 for (
int i = 0;
i < 4;
i++) {
570 for (
int i = 0;
i < 8;
i++) {
610 s->msmpeg4_version = 6;
666 }
else if (count < 0) {
674 uint8_t *buf2 =
NULL;
675 int seq_initialized = 0, ep_initialized = 0;
688 for (; next < end; start = next) {
690 size = next - start - 4;
713 if (!seq_initialized || !ep_initialized) {
796 for (
i = 0;
i < 4;
i++)
825 const uint8_t *buf = avpkt->
data;
826 int buf_size = avpkt->
size, n_slices = 0,
i,
ret;
829 uint8_t *buf2 =
NULL;
830 const uint8_t *buf_start = buf, *buf_start_second_field =
NULL;
831 int mb_height, n_slices1=-1;
836 const uint8_t *rawbuf;
839 unsigned slices_allocated = 0;
849 if (
s->low_delay == 0 &&
s->next_picture_ptr) {
852 s->next_picture_ptr =
NULL;
863 size_t next_allocated = 0;
869 const uint8_t *start, *end, *next;
873 for (start = buf, end = buf + buf_size; next < end; start = next) {
875 size = next - start - 4;
876 if (
size <= 0)
continue;
886 buf_start_second_field = start;
887 av_size_mult(
sizeof(*slices), n_slices+1, &next_allocated);
895 if (!slices[n_slices].buf) {
900 slices[n_slices].buf);
903 slices[n_slices].mby_start = avctx->
coded_height + 31 >> 5;
904 slices[n_slices].rawbuf = start;
905 slices[n_slices].raw_size =
size + 4;
906 n_slices1 = n_slices - 1;
917 av_size_mult(
sizeof(*slices), n_slices+1, &next_allocated);
925 if (!slices[n_slices].buf) {
930 slices[n_slices].buf);
933 slices[n_slices].mby_start =
get_bits(&slices[n_slices].gb, 9);
934 slices[n_slices].rawbuf = start;
935 slices[n_slices].raw_size =
size + 4;
941 }
else if (v->
interlace && ((buf[0] & 0xC0) == 0xC0)) {
942 const uint8_t *divider;
952 buf_start_second_field = divider;
953 av_size_mult(
sizeof(*slices), n_slices+1, &next_allocated);
961 if (!slices[n_slices].buf) {
968 slices[n_slices].mby_start =
s->mb_height + 1 >> 1;
969 slices[n_slices].rawbuf = divider;
970 slices[n_slices].raw_size = buf + buf_size - divider;
971 n_slices1 = n_slices - 1;
1003 if (
s->context_initialized &&
1009 if (!
s->context_initialized) {
1081 s->current_picture_ptr->f->repeat_pict = 0;
1085 s->current_picture_ptr->f->repeat_pict = 1;
1088 s->current_picture_ptr->f->repeat_pict = v->
rptfrm * 2;
1094 if (v->
field_mode && buf_start_second_field) {
1098 buf_start_second_field - buf_start);
1102 if (n_slices1 == -1) {
1105 buf_start_second_field - buf_start);
1110 slices[0].rawbuf - buf_start);
1114 for (
i = 0 ;
i < n_slices1 + 1;
i++) {
1115 s->gb = slices[
i].gb;
1116 s->mb_y = slices[
i].mby_start;
1130 slices[
i].raw_size);
1140 s->gb = slices[n_slices1 + 1].gb;
1141 s->mb_y = slices[n_slices1 + 1].mby_start;
1153 (buf + buf_size) - buf_start_second_field);
1157 if (n_slices - n_slices1 == 2) {
1160 (buf + buf_size) - buf_start_second_field);
1165 slices[n_slices1 + 2].rawbuf - buf_start_second_field);
1169 for (
i = n_slices1 + 2;
i < n_slices;
i++) {
1170 s->gb = slices[
i].gb;
1171 s->mb_y = slices[
i].mby_start;
1185 slices[
i].raw_size);
1196 (buf + buf_size) - buf_start);
1200 if (n_slices == 0) {
1203 (buf + buf_size) - buf_start);
1209 slices[0].rawbuf - buf_start);
1214 for (
i = 0 ;
i < n_slices;
i++) {
1215 s->gb = slices[
i].gb;
1216 s->mb_y = slices[
i].mby_start;
1230 slices[
i].raw_size);
1245 s->current_picture.f->linesize[0] <<= 1;
1246 s->current_picture.f->linesize[1] <<= 1;
1247 s->current_picture.f->linesize[2] <<= 1;
1249 s->uvlinesize <<= 1;
1255 for (
i = 0;
i <= n_slices;
i++) {
1256 if (
i > 0 && slices[
i - 1].mby_start >= mb_height) {
1259 "picture boundary (%d >= %d)\n",
i,
1260 slices[
i - 1].mby_start, mb_height);
1266 v->
mb_off =
s->mb_stride *
s->mb_height >> 1;
1295 s->start_mb_y = (
i == 0) ? 0 :
FFMAX(0, slices[
i-1].mby_start % mb_height);
1297 s->end_mb_y = (
i == n_slices ) ? mb_height :
FFMIN(mb_height, slices[
i].mby_start % mb_height);
1299 if (
i >= n_slices) {
1303 s->end_mb_y = (
i == n_slices1 + 1) ? mb_height :
FFMIN(mb_height, slices[
i].mby_start % mb_height);
1305 if (
s->end_mb_y <=
s->start_mb_y) {
1316 if (
i != n_slices) {
1317 s->gb = slices[
i].gb;
1322 s->current_picture.f->linesize[0] >>= 1;
1323 s->current_picture.f->linesize[1] >>= 1;
1324 s->current_picture.f->linesize[2] >>= 1;
1326 s->uvlinesize >>= 1;
1332 ff_dlog(
s->avctx,
"Consumed %i/%i bits\n",
1359 #if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER
1360 if ((
ret = vc1_decode_sprites(v, &
s->gb)) < 0)
1373 }
else if (
s->last_picture_ptr) {
1384 for (
i = 0;
i < n_slices;
i++)
1391 for (
i = 0;
i < n_slices;
i++)
1399 #if CONFIG_VC1_DXVA2_HWACCEL
1402 #if CONFIG_VC1_D3D11VA_HWACCEL
1406 #if CONFIG_VC1_NVDEC_HWACCEL
1409 #if CONFIG_VC1_VAAPI_HWACCEL
1412 #if CONFIG_VC1_VDPAU_HWACCEL
1432 #if CONFIG_VC1_DXVA2_HWACCEL
1435 #if CONFIG_VC1_D3D11VA_HWACCEL
1438 #if CONFIG_VC1_D3D11VA2_HWACCEL
1441 #if CONFIG_VC1_NVDEC_HWACCEL
1444 #if CONFIG_VC1_VAAPI_HWACCEL
1447 #if CONFIG_VC1_VDPAU_HWACCEL
1455 #if CONFIG_WMV3_DECODER
1469 #if CONFIG_WMV3_DXVA2_HWACCEL
1472 #if CONFIG_WMV3_D3D11VA_HWACCEL
1475 #if CONFIG_WMV3_D3D11VA2_HWACCEL
1478 #if CONFIG_WMV3_NVDEC_HWACCEL
1481 #if CONFIG_WMV3_VAAPI_HWACCEL
1484 #if CONFIG_WMV3_VDPAU_HWACCEL
1493 #if CONFIG_WMV3IMAGE_DECODER
1495 .
p.
name =
"wmv3image",
1504 .flush = vc1_sprite_flush,
1512 #if CONFIG_VC1IMAGE_DECODER
1514 .
p.
name =
"vc1image",
1523 .flush = vc1_sprite_flush,
int av_size_mult(size_t a, size_t b, size_t *r)
Multiply two size_t values checking for overflow.
av_cold int ff_mpv_common_init(MpegEncContext *s)
init common structure for both encoder and decoder.
void(* sprite_v_double_noscale)(uint8_t *dst, const uint8_t *src1a, const uint8_t *src2a, int alpha, int width)
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
uint8_t zz_8x8[4][64]
Zigzag table for TT_8x8, permuted for IDCT.
#define AV_LOG_WARNING
Something somehow does not look correct.
void ff_simple_idct44_add(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
int new_sprite
Frame decoding info for sprite modes.
@ AV_PIX_FMT_CUDA
HW acceleration through CUDA.
AVPixelFormat
Pixel format.
#define AV_EF_EXPLODE
abort decoding on minor error detection
static const uint8_t vc1_cbpcy_p_bits[4][64]
VLC ff_vc1_2ref_mvdata_vlc[8]
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
@ PROGRESSIVE
in the bitstream is reported as 00b
enum AVColorSpace colorspace
YUV colorspace type.
int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Select the (possibly hardware accelerated) pixel format.
static enum AVPixelFormat vc1_hwaccel_pixfmt_list_420[]
const FFCodec ff_vc1image_decoder
static const uint8_t vc1_intfr_non4mv_mbmode_bits[4][9]
int end_mb_x
Horizontal macroblock limit (used only by mss2)
int interlace
Progressive/interlaced (RPTFTM syntax element)
static const uint8_t vc1_subblkpat_codes[3][15]
void(* vc1_inv_trans_4x4)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static const uint8_t vc1_2ref_mvdata_bits[8][126]
av_cold void ff_qpeldsp_init(QpelDSPContext *c)
static const uint8_t vc1_2mv_block_pattern_bits[4][4]
static int get_bits_count(const GetBitContext *s)
enum AVPixelFormat * pix_fmts
array of supported pixel formats, or NULL if unknown, array is terminated by -1
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int field_picture
whether or not the picture was encoded in separate fields
VLC ff_vc1_intfr_non4mv_mbmode_vlc[4]
This structure describes decoded (raw) audio or video data.
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
#define HWACCEL_DXVA2(codec)
void ff_simple_idct84_add(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
static const uint8_t vc1_intfr_4mv_mbmode_bits[4][15]
#define HWACCEL_D3D11VA2(codec)
#define VC1_SUBBLKPAT_VLC_BITS
uint8_t * mv_type_mb_plane
bitplane for mv_type == (4MV)
@ AV_PIX_FMT_D3D11VA_VLD
HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView p...
#define PICT_BOTTOM_FIELD
#define VC1_CBPCY_P_VLC_BITS
void(* vc1_inv_trans_8x8_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
struct AVCodecContext * avctx
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
void(* vc1_inv_trans_4x4_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
static const uint8_t vc1_norm2_bits[4]
static const uint8_t vc1_ttmb_bits[3][16]
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static const uint16_t vc1_intfr_4mv_mbmode_codes[4][15]
#define FF_DEBUG_PICT_INFO
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static const av_always_inline uint8_t * find_next_marker(const uint8_t *src, const uint8_t *end)
Find VC-1 marker in buffer.
#define AV_FRAME_FLAG_TOP_FIELD_FIRST
A flag to mark frames where the top field is displayed first if the content is interlaced.
int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext *gb)
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
VLC ff_vc1_cbpcy_p_vlc[4]
AVCodec p
The public AVCodec.
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
const struct AVCodec * codec
#define VC1_INTFR_NON4MV_MBMODE_VLC_BITS
enum AVDiscard skip_frame
Skip decoding for selected frames.
static av_cold int vc1_decode_init(AVCodecContext *avctx)
Initialize a VC1/WMV3 decoder.
int first_pic_header_flag
int ff_vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb)
Decode Simple/Main Profiles sequence header.
int flags
AV_CODEC_FLAG_*.
int(* end_frame)(AVCodecContext *avctx)
Called at the end of each frame or field picture.
VLC ff_vc1_4mv_block_pattern_vlc[4]
#define HWACCEL_VDPAU(codec)
#define AV_CODEC_FLAG_LOW_DELAY
Force low delay.
void ff_print_debug_info(const MpegEncContext *s, const Picture *p, AVFrame *pict)
#define VC1_TTMB_VLC_BITS
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define VC1_IF_MMV_MBMODE_VLC_BITS
int(* start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
Called at the beginning of each frame or field picture.
void ff_mpv_common_end(MpegEncContext *s)
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
static int ff_thread_once(char *control, void(*routine)(void))
static const uint8_t vc1_ttblk_codes[3][8]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const uint8_t ff_wmv3_dc_scale_table[32]
void(* vc1_inv_trans_8x4_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static const uint8_t vc1_1ref_mvdata_bits[4][72]
av_cold void ff_msmp4_vc1_vlcs_init_once(void)
void(* sprite_v_double_twoscale)(uint8_t *dst, const uint8_t *src1a, const uint8_t *src1b, int offset1, const uint8_t *src2a, const uint8_t *src2b, int offset2, int alpha, int width)
static const uint8_t vc1_2mv_block_pattern_codes[4][4]
int has_b_frames
Size of the frame reordering buffer in the decoder.
void ff_er_frame_end(ERContext *s, int *decode_error_flags)
Indicate that a frame has finished decoding and perform error concealment in case it has been enabled...
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing.
const FFCodec ff_vc1_decoder
#define FF_CODEC_DECODE_CB(func)
av_cold void ff_blockdsp_init(BlockDSPContext *c)
@ AV_PIX_FMT_DXVA2_VLD
HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer.
int res_sprite
Simple/Main Profile sequence header.
int res_fasttx
reserved, always 1
static av_cold void vc1_init_static(void)
static const uint8_t vc1_if_mmv_mbmode_codes[8][8]
uint8_t * mv_f[2]
0: MV obtained from same field, 1: opposite field
static const uint32_t vc1_ac_tables[AC_MODES][186][2]
void(* sprite_h)(uint8_t *dst, const uint8_t *src, int offset, int advance, int count)
static const uint8_t vc1_subblkpat_bits[3][15]
int(* init)(AVBSFContext *ctx)
uint8_t * over_flags_plane
Overflags bitplane.
void ff_mpeg_er_frame_start(MpegEncContext *s)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
void ff_simple_idct48_add(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
#define vlc_init(vlc, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, flags)
static const uint8_t vc1_imode_bits[7]
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static const uint8_t vc1_norm2_codes[4]
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static const uint8_t vc1_norm6_bits[64]
av_cold int ff_intrax8_common_init(AVCodecContext *avctx, IntraX8Context *w, int16_t(*block)[64], int block_last_index[12], int mb_width, int mb_height)
Initialize IntraX8 frame decoder.
#define CODEC_LONG_NAME(str)
int top_blk_sh
Either 3 or 0, positions of l/t in blk[].
#define VC1_INTFR_4MV_MBMODE_VLC_BITS
#define VC1_1REF_MVDATA_VLC_BITS
@ AVDISCARD_ALL
discard all
const FFCodec ff_wmv3_decoder
uint8_t * forward_mb_plane
bitplane for "forward" MBs
void ff_simple_idct_add_int16_8bit(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
uint8_t * direct_mb_plane
bitplane for "direct" MBs
void(* vc1_inv_trans_8x4)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
av_cold void ff_vc1_init_transposed_scantables(VC1Context *v)
static const uint16_t vc1_cbpcy_p_codes[4][64]
int field_mode
1 for interlaced field pictures
@ AVCHROMA_LOC_LEFT
MPEG-2/4 4:2:0, H.264 default for 4:2:0.
void ff_vc1_decode_blocks(VC1Context *v)
uint8_t * blk_mv_type_base
av_cold void ff_intrax8_common_end(IntraX8Context *w)
Destroy IntraX8 frame structure.
@ AV_PICTURE_TYPE_I
Intra.
static unsigned int get_bits1(GetBitContext *s)
static const uint8_t vc1_intfr_non4mv_mbmode_codes[4][9]
int16_t(* luma_mv_base)[2]
static const uint16_t vlc_offs[]
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
#define VC1_ICBPCY_VLC_BITS
int level
Encoding level descriptor.
@ AVCOL_RANGE_UNSPECIFIED
void(* vc1_inv_trans_4x8_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
H264ChromaContext h264chroma
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
av_cold void ff_vc1_init_common(VC1Context *v)
Init VC-1 specific tables and VC1Context members.
const uint8_t ff_vc1_adv_interlaced_8x8_zz[64]
av_cold void ff_vc1dsp_init(VC1DSPContext *dsp)
@ AVDISCARD_NONKEY
discard all frames except keyframes
enum AVPictureType pict_type
Picture type of the frame.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define VC1_TTBLK_VLC_BITS
#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.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
const FFCodec ff_wmv3image_decoder
static const uint16_t vc1_norm6_codes[64]
static const uint8_t vc1_if_1mv_mbmode_codes[8][6]
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
static const uint8_t vc1_ttblk_bits[3][8]
static const uint8_t vc1_icbpcy_p_bits[8][63]
int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
generic function called after decoding the header and before a frame is decoded.
void ff_mpeg_flush(AVCodecContext *avctx)
#define HWACCEL_D3D11VA(codec)
void(* sprite_v_single)(uint8_t *dst, const uint8_t *src1a, const uint8_t *src1b, int offset, int width)
@ AV_PIX_FMT_D3D11
Hardware surfaces for Direct3D11.
#define HWACCEL_NVDEC(codec)
@ AV_PIX_FMT_VAAPI
Hardware acceleration through VA-API, data[3] contains a VASurfaceID.
void(* vc1_inv_trans_8x8)(int16_t *b)
uint8_t * sr_rows[2][2]
Sprite resizer line cache.
#define VC1_IMODE_VLC_BITS
#define AV_LOG_INFO
Standard information.
#define VC1_IF_1MV_MBMODE_VLC_BITS
@ AV_PIX_FMT_VDPAU
HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface.
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
av_cold void ff_init_scantable(const uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
Picture * current_picture_ptr
pointer to the current picture
static enum AVPixelFormat vc1_get_format(AVCodecContext *avctx)
void ff_simple_idct_int16_8bit(int16_t *block)
void(* sprite_v_double_onescale)(uint8_t *dst, const uint8_t *src1a, const uint8_t *src1b, int offset1, const uint8_t *src2a, int alpha, int width)
static const uint8_t vc1_if_1mv_mbmode_bits[8][6]
#define i(width, name, range_min, range_max)
int(* vc1_unescape_buffer)(const uint8_t *src, int size, uint8_t *dst)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx)
Initialize the given MpegEncContext for decoding.
static const uint8_t vc1_4mv_block_pattern_bits[4][16]
#define VC1_4MV_BLOCK_PATTERN_VLC_BITS
int ff_vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb)
int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext *gb)
const int ff_vc1_ac_sizes[AC_MODES]
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
const char * name
Name of the codec implementation.
int * ttblk
Transform type at the block level.
#define VLC_INIT_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size)
#define VC1_NORM6_VLC_BITS
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
VLC ff_vc1_2mv_block_pattern_vlc[4]
static const uint8_t vc1_if_mmv_mbmode_bits[8][8]
static const uint16_t vc1_icbpcy_p_codes[8][63]
#define FFSWAP(type, a, b)
VLC ff_vc1_if_mmv_mbmode_vlc[8]
AVFrame * sprite_output_frame
int color_prim
8 bits, chroma coordinates of the color primaries
static const uint16_t vc1_mv_diff_codes[4][73]
#define AV_INPUT_BUFFER_PADDING_SIZE
VLC ff_vc1_ac_coeff_table[8]
#define VC1_2MV_BLOCK_PATTERN_VLC_BITS
main external API structure.
VLC ff_vc1_subblkpat_vlc[3]
VLC * cbpcy_vlc
CBPCY VLC table.
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
static const uint8_t vc1_4mv_block_pattern_codes[4][16]
static const FFHWAccel * ffhwaccel(const AVHWAccel *codec)
int(* decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
Callback for each slice.
#define VC1_NORM2_VLC_BITS
static const uint16_t vc1_ttmb_codes[3][16]
int profile
Sequence header data for all Profiles TODO: choose between ints, uint8_ts and monobit flags.
void ff_mpv_frame_end(MpegEncContext *s)
#define AV_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_h264chroma_init(H264ChromaContext *c, int bit_depth)
const AVProfile ff_vc1_profiles[]
int matrix_coef
8 bits, Color primaries->YCbCr transform matrix
VLC ff_vc1_mv_diff_vlc[4]
int coded_width
Bitstream width / height, may be different from width/height e.g.
enum FrameCodingMode fcm
Frame decoding info for Advanced profile.
@ AV_PICTURE_TYPE_P
Predicted.
static const uint32_t vc1_2ref_mvdata_codes[8][126]
int max_b_frames
maximum number of B-frames between non-B-frames Note: The output will be delayed by max_b_frames+1 re...
#define avpriv_request_sample(...)
static const int16_t alpha[]
int level
Advanced Profile.
VLC ff_vc1_intfr_4mv_mbmode_vlc[4]
This structure stores compressed data.
uint8_t * acpred_plane
AC prediction flags bitplane.
@ AV_PICTURE_TYPE_BI
BI type.
#define VC1_2REF_MVDATA_VLC_BITS
#define HWACCEL_VAAPI(codec)
VLC ff_vc1_if_1mv_mbmode_vlc[8]
static const uint8_t vc1_imode_codes[7]
int width
picture width / height.
static av_cold int vc1_decode_init_alloc_tables(VC1Context *v)
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
int transfer_char
8 bits, Opto-electronic transfer characteristics
av_cold int ff_vc1_decode_end(AVCodecContext *avctx)
Close a VC1/WMV3 decoder.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, int *got_frame, AVPacket *avpkt)
Decode a VC1/WMV3 frame.
#define VLC_INIT_USE_STATIC
uint8_t * blk_mv_type
0: frame MV, 1: field MV (interlaced frame)
#define VC1_MV_DIFF_VLC_BITS
VLC ff_vc1_1ref_mvdata_vlc[4]
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
static const uint32_t vc1_1ref_mvdata_codes[4][72]
void(* vc1_inv_trans_4x8)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
@ AVDISCARD_NONREF
discard all non reference
const uint8_t ff_wmv1_scantable[WMV1_SCANTABLE_COUNT][64]
av_cold int ff_vc1_decode_init(AVCodecContext *avctx)
static const uint8_t vc1_mv_diff_bits[4][73]