23 #include <X11/extensions/XvMC.h>
62 cbp <<= 12-mb_block_count;
63 for (i = 0; i < mb_block_count; i++) {
89 "Render token doesn't look as expected.\n");
95 "Rendering surface contains %i unprocessed blocks.\n",
106 "Rendering surface doesn't provide enough block structures to work with.\n");
160 XvMCMacroBlock *mv_block;
162 int i, cbp, blocks_per_mb;
197 mv_block->x = s->
mb_x;
198 mv_block->y = s->
mb_y;
201 mv_block->macroblock_type = XVMC_MB_TYPE_INTRA;
203 mv_block->macroblock_type = XVMC_MB_TYPE_PATTERN;
206 mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_FORWARD;
208 mv_block->PMV[0][0][0] = s->
mv[0][0][0];
209 mv_block->PMV[0][0][1] = s->
mv[0][0][1];
210 mv_block->PMV[1][0][0] = s->
mv[0][1][0];
211 mv_block->PMV[1][0][1] = s->
mv[0][1][1];
214 mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_BACKWARD;
215 mv_block->PMV[0][1][0] = s->
mv[1][0][0];
216 mv_block->PMV[0][1][1] = s->
mv[1][0][1];
217 mv_block->PMV[1][1][0] = s->
mv[1][1][0];
218 mv_block->PMV[1][1][1] = s->
mv[1][1][1];
223 mv_block->motion_type = XVMC_PREDICTION_FRAME;
226 mv_block->motion_type = XVMC_PREDICTION_16x8;
229 mv_block->motion_type = XVMC_PREDICTION_FIELD;
231 mv_block->PMV[0][0][1] <<= 1;
232 mv_block->PMV[1][0][1] <<= 1;
233 mv_block->PMV[0][1][1] <<= 1;
234 mv_block->PMV[1][1][1] <<= 1;
238 mv_block->motion_type = XVMC_PREDICTION_DUAL_PRIME;
241 mv_block->PMV[0][0][0] = s->
mv[0][0][0];
242 mv_block->PMV[0][0][1] = s->
mv[0][0][1] << 1;
244 mv_block->PMV[0][1][0] = s->
mv[0][0][0];
245 mv_block->PMV[0][1][1] = s->
mv[0][0][1] << 1;
247 mv_block->PMV[1][0][0] = s->
mv[0][2][0];
248 mv_block->PMV[1][0][1] = s->
mv[0][2][1] << 1;
250 mv_block->PMV[1][1][0] = s->
mv[0][3][0];
251 mv_block->PMV[1][1][1] = s->
mv[0][3][1] << 1;
254 mv_block->PMV[0][1][0] = s->
mv[0][2][0];
255 mv_block->PMV[0][1][1] = s->
mv[0][2][1];
262 mv_block->motion_vertical_field_select = 0;
266 mv_block->motion_vertical_field_select |= s->
field_select[0][0];
267 mv_block->motion_vertical_field_select |= s->
field_select[1][0] << 1;
268 mv_block->motion_vertical_field_select |= s->
field_select[0][1] << 2;
269 mv_block->motion_vertical_field_select |= s->
field_select[1][1] << 3;
282 for (i = 0; i < blocks_per_mb; i++) {
290 for (i = 4; i < blocks_per_mb; i++) {
296 cbp &= 0xf << (blocks_per_mb - 4);
300 mv_block->coded_block_pattern = cbp;
302 mv_block->macroblock_type &= ~XVMC_MB_TYPE_PATTERN;
304 for (i = 0; i < blocks_per_mb; i++) {
317 if (s->
avctx->xvmc_acceleration == 1) {
int ff_xvmc_field_start(MpegEncContext *s, AVCodecContext *avctx)
#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...
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 encoding
true if we are encoding (vs decoding)
unsigned int flags
XVMC_SECOND_FIELD - 1st or 2nd field in the sequence.
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp)
Picture current_picture
copy of the current picture structure.
#define AV_XVMC_ID
special value to ensure that regular pixel routines haven't corrupted the struct the number is 1337 s...
Libavcodec version macros.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int last_dc[3]
last DC values for MPEG1
int next_free_data_block_num
Number of the next free data block; one data block consists of 64 short values in the data_blocks arr...
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,...)
int16_t(*[12] pblocks)[64]
int block_last_index[12]
last non zero coefficient in block
int xvmc_id
The field contains the special constant value AV_XVMC_ID.
void ff_xvmc_init_block(MpegEncContext *s)
if(ac->has_optimized_func)
int first_field
is 1 for the first field of a field picture 0 otherwise
#define MV_TYPE_16X16
1 vector for the whole mb
Libavcodec external API header.
main external API structure.
XvMCMacroBlock * mv_blocks
Pointer to the macroblock description array allocated by XvMCCreateMacroBlocks() and freed by XvMCDes...
#define MV_TYPE_16X8
2 vectors, one per 16x8 block
Public libavcodec XvMC header.
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
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.
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 ...
#define CODEC_FLAG_GRAY
Only decode/encode grayscale.
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().
void ff_xvmc_decode_mb(MpegEncContext *s)
#define MV_TYPE_DMV
2 vectors, special mpeg2 Dual Prime Vectors
int16_t(* block)[64]
points to one of the following blocks
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.
void(* idct)(int16_t *block)
void ff_xvmc_field_end(MpegEncContext *s)