23 #include <X11/extensions/XvMC.h>
59 cbp <<= 12-mb_block_count;
60 for (i = 0; i < mb_block_count; i++) {
86 "Render token doesn't look as expected.\n");
92 "Rendering surface contains %i unprocessed blocks.\n",
103 "Rendering surface doesn't provide enough block structures to work with.\n");
157 XvMCMacroBlock *mv_block;
159 int i, cbp, blocks_per_mb;
194 mv_block->x = s->
mb_x;
195 mv_block->y = s->
mb_y;
198 mv_block->macroblock_type = XVMC_MB_TYPE_INTRA;
200 mv_block->macroblock_type = XVMC_MB_TYPE_PATTERN;
203 mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_FORWARD;
205 mv_block->PMV[0][0][0] = s->
mv[0][0][0];
206 mv_block->PMV[0][0][1] = s->
mv[0][0][1];
207 mv_block->PMV[1][0][0] = s->
mv[0][1][0];
208 mv_block->PMV[1][0][1] = s->
mv[0][1][1];
211 mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_BACKWARD;
212 mv_block->PMV[0][1][0] = s->
mv[1][0][0];
213 mv_block->PMV[0][1][1] = s->
mv[1][0][1];
214 mv_block->PMV[1][1][0] = s->
mv[1][1][0];
215 mv_block->PMV[1][1][1] = s->
mv[1][1][1];
220 mv_block->motion_type = XVMC_PREDICTION_FRAME;
223 mv_block->motion_type = XVMC_PREDICTION_16x8;
226 mv_block->motion_type = XVMC_PREDICTION_FIELD;
228 mv_block->PMV[0][0][1] <<= 1;
229 mv_block->PMV[1][0][1] <<= 1;
230 mv_block->PMV[0][1][1] <<= 1;
231 mv_block->PMV[1][1][1] <<= 1;
235 mv_block->motion_type = XVMC_PREDICTION_DUAL_PRIME;
238 mv_block->PMV[0][0][0] = s->
mv[0][0][0];
239 mv_block->PMV[0][0][1] = s->
mv[0][0][1] << 1;
241 mv_block->PMV[0][1][0] = s->
mv[0][0][0];
242 mv_block->PMV[0][1][1] = s->
mv[0][0][1] << 1;
244 mv_block->PMV[1][0][0] = s->
mv[0][2][0];
245 mv_block->PMV[1][0][1] = s->
mv[0][2][1] << 1;
247 mv_block->PMV[1][1][0] = s->
mv[0][3][0];
248 mv_block->PMV[1][1][1] = s->
mv[0][3][1] << 1;
251 mv_block->PMV[0][1][0] = s->
mv[0][2][0];
252 mv_block->PMV[0][1][1] = s->
mv[0][2][1];
259 mv_block->motion_vertical_field_select = 0;
263 mv_block->motion_vertical_field_select |= s->
field_select[0][0];
264 mv_block->motion_vertical_field_select |= s->
field_select[1][0] << 1;
265 mv_block->motion_vertical_field_select |= s->
field_select[0][1] << 2;
266 mv_block->motion_vertical_field_select |= s->
field_select[1][1] << 3;
279 for (i = 0; i < blocks_per_mb; i++) {
287 for (i = 4; i < blocks_per_mb; i++) {
293 cbp &= 0xf << (blocks_per_mb - 4);
297 mv_block->coded_block_pattern = cbp;
299 mv_block->macroblock_type &= ~XVMC_MB_TYPE_PATTERN;
301 for (i = 0; i < blocks_per_mb; i++) {
#define MV_TYPE_FIELD
2 vectors, one per field
int filled_mv_blocks_num
Number of new macroblock descriptions in the mv_blocks array (after start_mv_blocks_num) that are fil...
void ff_xvmc_field_end(MpegEncContext *s)
Complete frame/field rendering by passing any remaining blocks.
int allocated_data_blocks
Number of blocks that can be stored at once in the data_blocks array.
int allocated_mv_blocks
Number of macroblock descriptions that can be stored in the mv_blocks array.
int ff_xvmc_field_start(MpegEncContext *s, AVCodecContext *avctx)
Find and store the surfaces that are used as reference frames.
int encoding
true if we are encoding (vs decoding)
unsigned int flags
XVMC_SECOND_FIELD - 1st or 2nd field in the sequence.
DCTELEM(*[12] pblocks)[64]
Picture current_picture
copy of the current picture structure.
void ff_xvmc_init_block(MpegEncContext *s)
Initialize the block field of the MpegEncContext pointer passed as parameter after making sure that t...
void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp)
Fill individual block pointers, so there are no gaps in the data_block array in case not all blocks i...
#define CODEC_FLAG_GRAY
Only decode/encode grayscale.
void ff_xvmc_decode_mb(MpegEncContext *s)
Synthesize the data needed by XvMC to render one macroblock of data.
int last_dc[3]
last DC values for MPEG1
int next_free_data_block_num
Number of the the next free data block; one data block consists of 64 short values in the data_blocks...
int mb_skipped
MUST BE SET only during DECODING.
unsigned int picture_structure
top/bottom field or frame
void av_log(void *avcl, int level, const char *fmt,...)
void(* idct)(DCTELEM *block)
int block_last_index[12]
last non zero coefficient in block
int xvmc_id
The field contains the special constant value AV_XVMC_ID.
int xvmc_acceleration
XVideo Motion Acceleration.
int first_field
is 1 for the first field of a field picture 0 otherwise
#define AV_XVMC_ID
special value to ensure that regular pixel routines haven't corrupted the struct the number is 1337 s...
#define MV_TYPE_16X16
1 vector for the whole mb
main external API structure.
XvMCMacroBlock * mv_blocks
Pointer to the macroblock description array allocated by XvMCCreateMacroBlocks() and freed by XvMCDes...
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define MV_TYPE_16X8
2 vectors, one per 16x8 block
void ff_draw_horiz_band(MpegEncContext *s, int y, int h)
DSPContext dsp
pointers for accelerated dsp functions
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
DCTELEM(* block)[64]
points to one of the following blocks
int unsigned_intra
In MoCo mode it indicates that intra macroblocks are assumed to be in unsigned format; same as the XV...
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int8_t * qscale_table
QP table.
int mv[2][4][2]
motion vectors for a macroblock first coordinate : 0 = forward 1 = backward second " : depend...
short * data_blocks
Pointer to the block array allocated by XvMCCreateBlocks().
struct AVCodecContext * avctx
XvMCSurface * p_past_surface
Set by the decoder before calling ff_draw_horiz_band(), needed by the XvMCRenderSurface function...
int start_mv_blocks_num
Number of macroblock descriptions in the mv_blocks array that have already been passed to the hardwar...
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 ...
int idct
Indicate that the hardware would interpret data_blocks as IDCT coefficients and perform IDCT on them...
Picture last_picture
copy of the previous picture structure.
XvMCSurface * p_surface
Pointer to the surface allocated by XvMCCreateSurface().
#define MV_TYPE_DMV
2 vectors, special mpeg2 Dual Prime Vectors
Picture next_picture
copy of the next picture structure.
int flags
AVCodecContext.flags (HQ, MV4, ...)
XvMCSurface * p_future_surface
Pointer to the surface used as future reference.