135 const int bitplane_index = n / 2;
136 const int ff_bp_index = y * stride + x;
139 v = ff_bp[0][ff_bp_index];
141 v |= ff_bp[1][ff_bp_index] << 1;
143 v |= ff_bp[2][ff_bp_index] << 2;
144 bitplane[bitplane_index] = (bitplane[bitplane_index] << 4) | v;
152 VAPictureParameterBufferVC1 *pic_param;
154 ff_dlog(avctx,
"vaapi_vc1_start_frame()\n");
162 pic_param->forward_reference_picture = VA_INVALID_ID;
163 pic_param->backward_reference_picture = VA_INVALID_ID;
164 pic_param->inloop_decoded_picture = VA_INVALID_ID;
165 pic_param->sequence_fields.value = 0;
166 pic_param->sequence_fields.bits.pulldown = v->
broadcast;
167 pic_param->sequence_fields.bits.interlace = v->
interlace;
168 pic_param->sequence_fields.bits.tfcntrflag = v->
tfcntrflag;
169 pic_param->sequence_fields.bits.finterpflag = v->
finterpflag;
170 pic_param->sequence_fields.bits.psf = v->
psf;
171 pic_param->sequence_fields.bits.multires = v->
multires;
172 pic_param->sequence_fields.bits.overlap = v->
overlap;
173 pic_param->sequence_fields.bits.syncmarker = v->
resync_marker;
174 pic_param->sequence_fields.bits.rangered = v->
rangered;
176 #if VA_CHECK_VERSION(0,32,0)
177 pic_param->sequence_fields.bits.profile = v->
profile;
181 pic_param->entrypoint_fields.value = 0;
182 pic_param->entrypoint_fields.bits.broken_link = v->
broken_link;
183 pic_param->entrypoint_fields.bits.closed_entry = v->
closed_entry;
184 pic_param->entrypoint_fields.bits.panscan_flag = v->
panscanflag;
185 pic_param->entrypoint_fields.bits.loopfilter = s->
loop_filter;
186 pic_param->conditional_overlap_flag = v->
condover;
187 pic_param->fast_uvmc_flag = v->
fastuvmc;
188 pic_param->range_mapping_fields.value = 0;
190 pic_param->range_mapping_fields.bits.luma = v->
range_mapy;
192 pic_param->range_mapping_fields.bits.chroma = v->
range_mapuv;
195 pic_param->mb_mode_table = 0;
197 pic_param->rounding_control = v->
rnd;
198 pic_param->post_processing = v->
postproc;
199 pic_param->picture_resolution_index = v->
respic;
200 pic_param->luma_scale = v->
lumscale;
201 pic_param->luma_shift = v->
lumshift;
202 pic_param->picture_fields.value = 0;
203 pic_param->picture_fields.bits.picture_type =
vc1_get_PTYPE(v);
204 pic_param->picture_fields.bits.frame_coding_mode = v->
fcm;
205 pic_param->picture_fields.bits.top_field_first = v->
tff;
206 pic_param->picture_fields.bits.is_first_field = v->
fcm == 0;
208 pic_param->raw_coding.value = 0;
210 pic_param->raw_coding.flags.direct_mb = v->
dmb_is_raw;
211 pic_param->raw_coding.flags.skip_mb = v->
skip_is_raw;
212 pic_param->raw_coding.flags.field_tx = 0;
213 pic_param->raw_coding.flags.forward_mb = 0;
216 pic_param->bitplane_present.value = 0;
220 pic_param->bitplane_present.flags.bp_field_tx = 0;
221 pic_param->bitplane_present.flags.bp_forward_mb = 0;
224 pic_param->reference_fields.value = 0;
225 pic_param->reference_fields.bits.reference_distance_flag = v->
refdist_flag;
226 pic_param->reference_fields.bits.reference_distance = 0;
227 pic_param->reference_fields.bits.num_reference_pictures = 0;
228 pic_param->reference_fields.bits.reference_field_pic_indicator = 0;
229 pic_param->mv_fields.value = 0;
233 pic_param->mv_fields.bits.two_mv_block_pattern_table = 0;
234 pic_param->mv_fields.bits.four_mv_switch = 0;
235 pic_param->mv_fields.bits.four_mv_block_pattern_table = 0;
236 pic_param->mv_fields.bits.extended_mv_flag = v->
extended_mv;
237 pic_param->mv_fields.bits.extended_mv_range = v->
mvrange;
238 pic_param->mv_fields.bits.extended_dmv_flag = v->
extended_dmv;
239 pic_param->mv_fields.bits.extended_dmv_range = 0;
240 pic_param->pic_quantizer_fields.value = 0;
241 pic_param->pic_quantizer_fields.bits.dquant = v->
dquant;
242 pic_param->pic_quantizer_fields.bits.quantizer = v->
quantizer_mode;
243 pic_param->pic_quantizer_fields.bits.half_qp = v->
halfpq;
244 pic_param->pic_quantizer_fields.bits.pic_quantizer_scale = v->
pq;
245 pic_param->pic_quantizer_fields.bits.pic_quantizer_type = v->
pquantizer;
246 pic_param->pic_quantizer_fields.bits.dq_frame = v->
dquantfrm;
247 pic_param->pic_quantizer_fields.bits.dq_profile = v->
dqprofile;
250 pic_param->pic_quantizer_fields.bits.dq_binary_level = v->
dqbilevel;
251 pic_param->pic_quantizer_fields.bits.alt_pic_quantizer = v->
altpq;
252 pic_param->transform_fields.value = 0;
253 pic_param->transform_fields.bits.variable_sized_transform_flag = v->
vstransform;
254 pic_param->transform_fields.bits.mb_level_transform_type_flag = v->
ttmbf;
255 pic_param->transform_fields.bits.frame_level_transform_type =
vc1_get_TTFRM(v);
256 pic_param->transform_fields.bits.transform_ac_codingset_idx1 = v->
c_ac_table_index;
257 pic_param->transform_fields.bits.transform_ac_codingset_idx2 = v->
y_ac_table_index;
258 pic_param->transform_fields.bits.intra_transform_dc_table = v->
s.
dc_table_index;
269 if (pic_param->bitplane_present.value) {
277 ff_bp[1] = pic_param->bitplane_present.flags.bp_skip_mb ? s->
mbskip_table :
NULL;
283 ff_bp[1] = pic_param->bitplane_present.flags.bp_skip_mb ? s->
mbskip_table :
NULL;
290 ff_bp[1] = pic_param->bitplane_present.flags.bp_ac_pred ? v->
acpred_plane :
NULL;
306 for (x = 0; x < s->
mb_width; x++, n++)
318 VASliceParameterBufferVC1 *slice_param;
320 ff_dlog(avctx,
"vaapi_vc1_decode_slice(): buffer %p, size %d\n", buffer, size);
333 slice_param->slice_vertical_position = s->
mb_y;
337 #if CONFIG_WMV3_VAAPI_HWACCEL
339 .
name =
"wmv3_vaapi",
uint8_t bfraction_lut_index
Index for BFRACTION value (see Table 40, reproduced into ff_vc1_bfraction_lut[])
int coded_width
Bitstream width / height, may be different from width/height e.g.
int mv_type_is_raw
mv type mb plane is not coded
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...
int extended_mv
Ext MV in P/B (not in Simple)
int broadcast
TFF/RFF present.
uint8_t rangeredfrm
Frame decoding info for S/M profiles only.
HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the b...
This structure is used to share data between the FFmpeg library and the client video application...
static int vc1_has_ACPRED_bitplane(VC1Context *v)
Check whether the ACPRED bitplane is present.
MVModes
MV modes for P frames.
int fastuvmc
Rounding of qpel vector to hpel ? (not in Simple)
static int vc1_get_PTYPE(VC1Context *v)
Reconstruct bitstream PTYPE (7.1.1.4, index into Table-35)
uint8_t * acpred_plane
AC prediction flags bitplane.
void * hwaccel_context
Hardware accelerator context.
int panscanflag
NUMPANSCANWIN, TOPLEFT{X,Y}, BOTRIGHT{X,Y} present.
VLC ff_vc1_cbpcy_p_vlc[4]
int interlace
Progressive/interlaced (RPTFTM syntax element)
int y_ac_table_index
Luma index from AC2FRM element.
int c_ac_table_index
AC coding set indexes.
int ttfrm
Transform type info present at frame level.
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
int profile
Sequence header data for all Profiles TODO: choose between ints, uint8_ts and monobit flags...
static int vc1_has_DIRECTMB_bitplane(VC1Context *v)
Check whether the DIRECTMB bitplane is present.
static int get_bits_count(const GetBitContext *s)
int refdist_flag
REFDIST syntax element present in II, IP, PI or PP field picture headers.
int mb_height
number of MBs horizontally & vertically
uint8_t * over_flags_plane
Overflags bitplane.
int psf
Progressive Segmented Frame.
uint8_t ttmbf
Transform type flag.
static int get_VAMvModeVC1(enum MVModes mv_mode)
Translate FFmpeg MV modes to VA API.
int dmb_is_raw
direct mb plane is raw
int overlap
overlapped transforms in use
void * ff_vaapi_alloc_pic_param(struct vaapi_context *vactx, unsigned int size)
Allocate a new picture parameter buffer.
static int vc1_has_OVERFLAGS_bitplane(VC1Context *v)
Check whether the OVERFLAGS bitplane is present.
int resync_marker
could this stream contain resync markers
uint8_t broken_link
Broken link flag (BROKEN_LINK syntax element)
static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
const char * name
Name of the hardware accelerated codec.
static int vc1_has_SKIPMB_bitplane(VC1Context *v)
Check whether the SKIPMB bitplane is present.
int tfcntrflag
TFCNTR present.
uint8_t * mbskip_table
used to avoid copy if macroblock skipped (for black regions for example) and used for b-frame encodin...
uint8_t mv_mode
Frame decoding info for all profiles.
static VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic)
Extract VASurfaceID from an AVFrame.
static int vc1_get_TTFRM(VC1Context *v)
Reconstruct bitstream TTFRM (7.1.1.41, Table-53)
unsigned int slice_param_size
Size of a VASliceParameterBuffer element.
uint8_t lumscale
Luma compensation parameters.
static VAMvModeVC1 vc1_get_MVMODE2(VC1Context *v)
Reconstruct bitstream MVMODE2 (7.1.1.33)
uint8_t closed_entry
Closed entry point flag (CLOSED_ENTRY syntax element)
static VAMvModeVC1 vc1_get_MVMODE(VC1Context *v)
Reconstruct bitstream MVMODE (7.1.1.32)
VLC * cbpcy_vlc
CBPCY VLC table.
int rangered
RANGEREDFRM (range reduction) syntax element present at frame level.
int finterpflag
INTERPFRM present.
static int vc1_has_MVTYPEMB_bitplane(VC1Context *v)
Check whether the MVTYPEMB bitplane is present.
int multires
frame-level RESPIC syntax element present
main external API structure.
VASliceParameterBufferBase * ff_vaapi_alloc_slice(struct vaapi_context *vactx, const uint8_t *buffer, uint32_t size)
Allocate a new slice descriptor for the input slice.
int extended_dmv
Additional extended dmv range at P/B frame-level.
uint8_t respic
Frame-level flag for resized images.
int skip_is_raw
skip mb plane is not coded
int quantizer_mode
2bits, quantizer mode used for sequence, see QUANT_*
uint8_t * direct_mb_plane
bitplane for "direct" MBs
uint8_t mvrange
Ranges:0 -> [-64n 63.f] x [-32, 31.f]1 -> [-128, 127.f] x [-64, 63.f]2 -> [-512, 511.f] x [-128, 127.f]3 -> [-1024, 1023.f] x [-256, 255.f].
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
uint8_t * mv_type_mb_plane
bitplane for mv_type == (4MV)
int vstransform
variable-size [48]x[48] transform type + info
static void vc1_pack_bitplanes(uint8_t *bitplane, int n, const uint8_t *ff_bp[3], int x, int y, int stride)
Pack FFmpeg bitplanes into a VABitPlaneBuffer element.
struct AVCodecContext * avctx
GLint GLenum GLboolean GLsizei stride
common internal api header.
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 ...
enum FrameCodingMode fcm
Frame decoding info for Advanced profile.
Picture last_picture
copy of the previous picture structure.
uint8_t dquantfrm
pquant parameters
uint8_t pquantizer
Uniform (over sequence) quantizer in use.
Picture next_picture
copy of the next picture structure.
uint8_t * ff_vaapi_alloc_bitplane(struct vaapi_context *vactx, uint32_t size)
Allocate a new bit-plane buffer.
AVHWAccel ff_vc1_vaapi_hwaccel
int ff_vaapi_mpeg_end_frame(AVCodecContext *avctx)
int dquant
How qscale varies with MBs, 2bits (not in Simple)
uint8_t mv_mode2
Secondary MV coding mode (B frames)
static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
uint8_t halfpq
Uniform quant over image and qp+.5.
uint8_t altpq
Current/alternate frame quantizer scale.