23 #include <X11/extensions/XvMC.h>
58 cbp <<= 12-mb_block_count;
59 for (i = 0; i < mb_block_count; i++) {
85 "Render token doesn't look as expected.\n");
91 "Rendering surface contains %i unprocessed blocks.\n",
102 "Rendering surface doesn't provide enough block structures to work with.\n");
156 XvMCMacroBlock *mv_block;
158 int i, cbp, blocks_per_mb;
193 mv_block->x = s->
mb_x;
194 mv_block->y = s->
mb_y;
197 mv_block->macroblock_type = XVMC_MB_TYPE_INTRA;
199 mv_block->macroblock_type = XVMC_MB_TYPE_PATTERN;
202 mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_FORWARD;
204 mv_block->PMV[0][0][0] = s->
mv[0][0][0];
205 mv_block->PMV[0][0][1] = s->
mv[0][0][1];
206 mv_block->PMV[1][0][0] = s->
mv[0][1][0];
207 mv_block->PMV[1][0][1] = s->
mv[0][1][1];
210 mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_BACKWARD;
211 mv_block->PMV[0][1][0] = s->
mv[1][0][0];
212 mv_block->PMV[0][1][1] = s->
mv[1][0][1];
213 mv_block->PMV[1][1][0] = s->
mv[1][1][0];
214 mv_block->PMV[1][1][1] = s->
mv[1][1][1];
219 mv_block->motion_type = XVMC_PREDICTION_FRAME;
222 mv_block->motion_type = XVMC_PREDICTION_16x8;
225 mv_block->motion_type = XVMC_PREDICTION_FIELD;
227 mv_block->PMV[0][0][1] <<= 1;
228 mv_block->PMV[1][0][1] <<= 1;
229 mv_block->PMV[0][1][1] <<= 1;
230 mv_block->PMV[1][1][1] <<= 1;
234 mv_block->motion_type = XVMC_PREDICTION_DUAL_PRIME;
237 mv_block->PMV[0][0][0] = s->
mv[0][0][0];
238 mv_block->PMV[0][0][1] = s->
mv[0][0][1] << 1;
240 mv_block->PMV[0][1][0] = s->
mv[0][0][0];
241 mv_block->PMV[0][1][1] = s->
mv[0][0][1] << 1;
243 mv_block->PMV[1][0][0] = s->
mv[0][2][0];
244 mv_block->PMV[1][0][1] = s->
mv[0][2][1] << 1;
246 mv_block->PMV[1][1][0] = s->
mv[0][3][0];
247 mv_block->PMV[1][1][1] = s->
mv[0][3][1] << 1;
250 mv_block->PMV[0][1][0] = s->
mv[0][2][0];
251 mv_block->PMV[0][1][1] = s->
mv[0][2][1];
258 mv_block->motion_vertical_field_select = 0;
262 mv_block->motion_vertical_field_select |= s->
field_select[0][0];
263 mv_block->motion_vertical_field_select |= s->
field_select[1][0] << 1;
264 mv_block->motion_vertical_field_select |= s->
field_select[0][1] << 2;
265 mv_block->motion_vertical_field_select |= s->
field_select[1][1] << 3;
278 for (i = 0; i < blocks_per_mb; i++) {
286 for (i = 4; i < blocks_per_mb; i++) {
292 cbp &= 0xf << (blocks_per_mb - 4);
296 mv_block->coded_block_pattern = cbp;
298 mv_block->macroblock_type &= ~XVMC_MB_TYPE_PATTERN;
300 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.
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
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.
if((e=av_dict_get(options,"", NULL, AV_DICT_IGNORE_SUFFIX)))
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
XvMCMacroBlock * mv_blocks
Pointer to the macroblock description array allocated by XvMCCreateMacroBlocks() and freed by XvMCDes...
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 AV_XVMC_ID
special value to ensure that regular pixel routines haven't corrupted the struct the number is 1337 s...
void ff_xvmc_decode_mb(MpegEncContext *s)
Synthesize the data needed by XvMC to render one macroblock of data.
#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
Libavcodec external API header.
void(* idct)(int16_t *block)
Public libavcodec XvMC header.
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.
int xvmc_acceleration
XVideo Motion Acceleration.
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
main external API structure.
#define MV_TYPE_16X8
2 vectors, one per 16x8 block
XvMCSurface * p_surface
Pointer to the surface allocated by XvMCCreateSurface().
XvMCSurface * p_past_surface
Set by the decoder before calling ff_draw_horiz_band(), needed by the XvMCRenderSurface function...
DSPContext dsp
pointers for accelerated dsp functions
XvMCSurface * p_future_surface
Pointer to the surface used as future reference.
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...
int mv[2][4][2]
motion vectors for a macroblock first coordinate : 0 = forward 1 = backward second " : depend...
struct AVCodecContext * avctx
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.
#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, ...)
short * data_blocks
Pointer to the block array allocated by XvMCCreateBlocks().
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.