Go to the documentation of this file.
55 for (y = 0; y <
height; y++) {
57 memset(plane, 0,
width);
59 for (x = 0; x <
width; x++)
77 for (x = 0; x <
width; x++) {
79 for (y = 0; y <
height; y++)
82 for (y = 0; y <
height; y++)
130 *planep++ =
code & 1;
136 *planep++ =
code >> 1;
147 for (y = 0; y <
height; y += 3) {
154 planep[x + 0] = (
code >> 0) & 1;
155 planep[x + 1] = (
code >> 1) & 1;
174 planep[x + 0] = (
code >> 0) & 1;
175 planep[x + 1] = (
code >> 1) & 1;
176 planep[x + 2] = (
code >> 2) & 1;
204 for (x = 1; x <
width; x++)
205 planep[x] ^= planep[x-1];
206 for (y = 1; y <
height; y++) {
208 planep[0] ^= planep[-
stride];
209 for (x = 1; x <
width; x++) {
210 if (planep[x-1] != planep[x-
stride]) planep[x] ^=
invert;
211 else planep[x] ^= planep[x-1];
217 planep[x] = !planep[x];
219 return (imode << 1) +
invert;
294 "Old interlaced mode is not supported\n");
306 "LOOPFILTER shall not be enabled in Simple Profile\n");
318 "FASTUVMC unavailable in Simple Profile\n");
324 "Extended MVs unavailable in Simple Profile\n");
333 "1 for reserved RES_TRANSTAB is forbidden\n");
343 "RANGERED should be set to 0 in Simple Profile\n");
374 "Profile %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n"
375 "LoopFilter=%i, MultiRes=%i, FastUVMC=%i, Extended MV=%i\n"
376 "Rangered=%i, VSTransform=%i, Overlap=%i, SyncMarker=%i\n"
377 "DQuant=%i, Quantizer mode=%i, Max B-frames=%i\n",
395 "Only 4:2:0 chroma format supported\n");
414 "Advanced Profile level %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n"
415 "LoopFilter=%i, ChromaFormat=%i, Pulldown=%i, Interlace: %i\n"
416 "TFCTRflag=%i, FINTERPflag=%i\n",
421 #if FF_API_TICKS_PER_FRAME
445 }
else if (ar == 15) {
473 if (nr > 0 && nr < 8 && dr > 0 && dr < 3) {
547 av_log(avctx,
AV_LOG_ERROR,
"Chroma scaling is not supported, expect wrong picture\n");
552 "BrokenLink=%i, ClosedEntry=%i, PanscanFlag=%i\n"
553 "RefDist=%i, Postproc=%i, FastUVMC=%i, ExtMV=%i\n"
554 "DQuant=%i, VSTransform=%i, Overlap=%i, Qmode=%i\n",
562 #define INIT_LUT(lumscale, lumshift, luty, lutuv, chain) do { \
563 int scale, shift, i; \
566 shift = (255 - lumshift * 2) * 64; \
570 scale = lumscale + 32; \
572 shift = (lumshift - 64) * 64; \
574 shift = lumshift << 6; \
576 for (i = 0; i < 256; i++) { \
577 int iy = chain ? luty[i] : i; \
578 int iu = chain ? lutuv[i] : i; \
579 luty[i] = av_clip_uint8((scale * iy + shift + 32) >> 6); \
580 lutuv[i] = av_clip_uint8((scale * (iu - 128) + 128*64 + 32) >> 6);\
591 #define ROTATE(DEF, L, N, C) do { \
593 memcpy(&tmp, L , sizeof(tmp)); \
594 memcpy(L , N , sizeof(tmp)); \
595 memcpy(N , &tmp, sizeof(tmp)); \
610 int bfraction_lut_index =
get_bits(gb, 3);
612 if (bfraction_lut_index == 7)
613 bfraction_lut_index = 7 +
get_bits(gb, 4);
615 if (bfraction_lut_index == 21) {
626 int pqindex, lowquant,
status;
724 lowquant = (v->
pq > 12) ? 0 : 1;
848 int pqindex, lowquant;
863 goto parse_common_info;
951 goto parse_common_info;
1091 lowquant = (v->
pq > 12) ? 0 : 1;
1227 lowquant = (v->
pq > 12) ? 0 : 1;
static void rotate_luts(VC1Context *v)
#define FF_ENABLE_DEPRECATION_WARNINGS
#define AV_LOG_WARNING
Something somehow does not look correct.
uint8_t lumscale2
for interlaced field P picture
uint8_t next_luty[2][256]
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
static int get_bits_left(GetBitContext *gb)
@ PROGRESSIVE
in the bitstream is reported as 00b
int overlap
overlapped transforms in use
int interlace
Progressive/interlaced (RPTFTM syntax element)
uint8_t altpq
Current/alternate frame quantizer scale.
uint8_t(* curr_luty)[256]
int max_b_frames
max number of B-frames for encoding
@ ILACE_FRAME
in the bitstream is reported as 10b
static int BS_FUNC() decode210(BSCTX *bc)
Return decoded truncated unary code for the values 2, 1, 0.
@ MV_PMODE_1MV_HPEL_BILIN
int reffield
if numref = 0 (1 reference) then reffield decides which
int fastuvmc
Rounding of qpel vector to hpel ? (not in Simple)
uint8_t * mv_type_mb_plane
bitplane for mv_type == (4MV)
@ MV_PMODE_INTENSITY_COMP
const uint8_t * zz_8x4
Zigzag scan table for TT_8x4 coding mode.
struct AVCodecContext * avctx
uint8_t dmvrange
Frame decoding info for interlaced picture.
uint8_t closed_entry
Closed entry point flag (CLOSED_ENTRY syntax element)
const AVRational ff_vc1_pixel_aspect[16]
int height
picture size. must be a multiple of 16
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
@ QUANT_NON_UNIFORM
Non-uniform quant used for all frames.
const uint8_t ff_vc1_mv_pmode_table[2][5]
MV P mode - the 5th element is only used for mode 1.
int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext *gb)
static void decode_colskip(uint8_t *plane, int width, int height, int stride, GetBitContext *gb)
Decode columns by checking if they are skipped.
@ PROFILE_COMPLEX
TODO: WMV9 specific.
static void skip_bits(GetBitContext *s, int n)
uint8_t last_lutuv[2][256]
lookup tables used for intensity compensation
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
const uint8_t ff_vc1_adv_progressive_4x8_zz[32]
int mb_height
number of MBs horizontally & vertically
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
@ ILACE_FIELD
in the bitstream is reported as 11b
int multires
frame-level RESPIC syntax element present
const VLCElem * ff_vc1_if_1mv_mbmode_vlc[8]
int first_pic_header_flag
int numref
number of past field pictures used as reference
int ff_vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb)
Decode Simple/Main Profiles sequence header.
VLCElem ff_vc1_norm6_vlc[556]
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb)
int c_ac_table_index
AC coding set indexes.
int k_y
Number of bits for MVs (depends on MV range)
int dquant
How qscale varies with MBs, 2 bits (not in Simple)
int refdist
distance of the current picture from reference
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const VLCElem * twomvbp_vlc
const VLCElem * ff_vc1_2mv_block_pattern_vlc[4]
int res_sprite
Simple/Main Profile sequence header.
int res_fasttx
reserved, always 1
MPVPicture * ptr
RefStruct reference.
int postprocflag
Per-frame processing suggestion flag present.
uint8_t * over_flags_plane
Overflags bitplane.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int rangered
RANGEREDFRM (range reduction) syntax element present at frame level.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
@ QUANT_FRAME_IMPLICIT
Implicitly specified at frame level.
int hrd_param_flag
Presence of Hypothetical Reference Decoder parameters.
int tt_index
Index for Transform Type tables (to decode TTMB)
uint8_t last_luty[2][256]
MPVWorkPicture cur_pic
copy of the current picture structure.
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11
uint8_t mv_mode
Frame decoding info for all profiles.
static int vop_dquant_decoding(VC1Context *v)
VOP Dquant decoding.
@ AVDISCARD_ALL
discard all
uint8_t * forward_mb_plane
bitplane for "forward" MBs
int pqindex
raw pqindex used in coding set selection
int skip_is_raw
skip mb plane is not coded
const VLCElem * ff_vc1_cbpcy_p_vlc[4]
const VLCElem * ff_vc1_if_mmv_mbmode_vlc[8]
uint8_t * direct_mb_plane
bitplane for "direct" MBs
const VLCElem * ff_vc1_2ref_mvdata_vlc[8]
uint8_t lumscale
Luma compensation parameters.
int field_mode
1 for interlaced field pictures
int panscanflag
NUMPANSCANWIN, TOPLEFT{X,Y}, BOTRIGHT{X,Y} present.
Rational number (pair of numerator and denominator).
int qs_last
if qpel has been used in the previous (tr.) picture
@ AV_PICTURE_TYPE_I
Intra.
static unsigned int get_bits1(GetBitContext *s)
int fmb_is_raw
forward mb plane is raw
int ff_set_sar(AVCodecContext *avctx, AVRational sar)
Check that the provided sample aspect ratio is valid and set it on the codec context.
const VLCElem * mbmode_vlc
int resync_marker
could this stream contain resync markers
const VLCElem * cbpcy_vlc
CBPCY VLC table.
uint8_t((* curr_lutuv)[256]
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
uint8_t halfpq
Uniform quant over image and qp+.5.
uint8_t ttmbf
Transform type flag.
static int get_unary(GetBitContext *gb, int stop, int len)
Get unary code of limited length.
int refdist_flag
REFDIST syntax element present in II, IP, PI or PP field picture headers.
int intcompfield
which of the two fields to be intensity compensated
uint8_t mv_mode2
Secondary MV coding mode (B-frames)
const VLCElem * ff_vc1_icbpcy_vlc[8]
enum AVPictureType pict_type
Picture type of the frame.
int ttfrm
Transform type info present at frame level.
const VLCElem * ff_vc1_1ref_mvdata_vlc[4]
const uint8_t ff_wmv2_scantableB[64]
int16_t bfraction
Relative position % anchors=> how to scale MVs.
int parse_only
Context is used within parser.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
const VLCElem * ff_vc1_intfr_4mv_mbmode_vlc[4]
const int ff_vc1_ttfrm_to_tt[4]
uint8_t rangeredfrm
Frame decoding info for S/M profiles only.
int chromaformat
2 bits, 2=4:2:0, only defined
const uint8_t ff_wmv2_scantableA[64]
int res_transtab
reserved, always 0
uint8_t * mbskip_table
used to avoid copy if macroblock skipped (for black regions for example) and used for B-frame encodin...
uint8_t respic
Frame-level flag for resized images.
int quarter_sample
1->qpel, 0->half pel ME/MC
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
uint8_t broken_link
Broken link flag (BROKEN_LINK syntax element)
static void skip_bits1(GetBitContext *s)
#define ROTATE(DEF, L, N, C)
int tfcntrflag
TFCNTR present.
enum AVDiscard skip_loop_filter
Skip loop filtering for selected frames.
#define VC1_IMODE_VLC_BITS
#define AV_LOG_INFO
Standard information.
int cur_field_type
0: top, 1: bottom
const int ff_vc1_fps_dr[2]
@ QUANT_FRAME_EXPLICIT
Explicitly specified at frame level.
int k_x
Number of bits for MVs (depends on MV range)
const VLCElem * ff_vc1_intfr_non4mv_mbmode_vlc[4]
#define i(width, name, range_min, range_max)
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
static void invert(float *h, int n)
int frmrtq_postproc
3 bits,
static int BS_FUNC() decode012(BSCTX *bc)
Return decoded truncated unary code for the values 0, 1, 2.
int ff_vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb)
int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext *gb)
int extended_mv
Ext MV in P/B (not in Simple)
int hrd_num_leaky_buckets
const uint8_t * zz_4x8
Zigzag scan table for TT_4x8 coding mode.
#define VC1_NORM6_VLC_BITS
int res_y411
reserved, old interlaced mode
const VLCElem * fourmvbp_vlc
int y_ac_table_index
Luma index from AC2FRM element.
int ref_field_type[2]
forward and backward reference field type (top or bottom)
int color_prim
8 bits, chroma coordinates of the color primaries
uint8_t pquantizer
Uniform (over sequence) quantizer in use.
main external API structure.
VLCElem ff_vc1_imode_vlc[1<< VC1_IMODE_VLC_BITS]
const uint8_t ff_vc1_adv_progressive_8x4_zz[32]
static int read_bfraction(VC1Context *v, GetBitContext *gb)
static void decode_rowskip(uint8_t *plane, int width, int height, int stride, GetBitContext *gb)
Decode rows by checking if they are skipped.
uint8_t bfraction_lut_index
Index for BFRACTION value (see Table 40, reproduced into ff_vc1_bfraction_lut[])
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
int brfd
reference frame distance (forward or backward)
#define VC1_NORM2_VLC_BITS
int res_rtm_flag
reserved, set to 1
int profile
Sequence header data for all Profiles TODO: choose between ints, uint8_ts and monobit flags.
int vstransform
variable-size [48]x[48] transform type + info
attribute_deprecated int ticks_per_frame
For some codecs, the time base is closer to the field rate than the frame rate.
int matrix_coef
8 bits, Color primaries->YCbCr transform matrix
#define FF_DISABLE_DEPRECATION_WARNINGS
uint8_t next_lutuv[2][256]
lookup tables used for intensity compensation
enum FrameCodingMode fcm
Frame decoding info for Advanced profile.
@ AV_PICTURE_TYPE_P
Predicted.
int mv_type_is_raw
mv type mb plane is not coded
int psf
Progressive Segmented Frame.
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(...)
VLCElem ff_vc1_norm2_vlc[1<< VC1_NORM2_VLC_BITS]
const VLCElem * ff_vc1_4mv_block_pattern_vlc[4]
const uint8_t ff_vc1_mv_pmode_table2[2][4]
int broadcast
TFF/RFF present.
int dmb_is_raw
direct mb plane is raw
int level
Advanced Profile.
uint8_t * acpred_plane
AC prediction flags bitplane.
@ AV_PICTURE_TYPE_BI
BI type.
int width
picture width / height.
int finterpflag
INTERPFRM present.
int transfer_char
8 bits, Opto-electronic transfer characteristics
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
uint8_t dquantfrm
pquant parameters
static int bitplane_decoding(uint8_t *data, int *raw_flag, VC1Context *v)
Decode a bitplane's bits.
int quantizer_mode
2 bits, quantizer mode used for sequence, see QUANT_*
const int16_t ff_vc1_bfraction_lut[23]
const int ff_vc1_fps_nr[7]
#define INIT_LUT(lumscale, lumshift, luty, lutuv, chain)
int extended_dmv
Additional extended dmv range at P/B-frame-level.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
uint8_t aux_lutuv[2][256]
lookup tables used for intensity compensation
const uint8_t ff_vc1_pquant_table[3][32]
int bitrtq_postproc
5 bits, quantized framerate-based postprocessing strength