23 #include <X11/extensions/XvMC.h>
69 cbp <<= 12-mb_block_count;
70 for (i = 0; i < mb_block_count; i++) {
100 "Render token doesn't look as expected.\n");
106 "Rendering surface contains %i unprocessed blocks.\n",
117 "Rendering surface doesn't provide enough block structures to work with.\n");
173 XvMCMacroBlock *mv_block;
175 int i, cbp, blocks_per_mb;
210 mv_block->x = s->
mb_x;
211 mv_block->y = s->
mb_y;
214 mv_block->macroblock_type = XVMC_MB_TYPE_INTRA;
216 mv_block->macroblock_type = XVMC_MB_TYPE_PATTERN;
219 mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_FORWARD;
221 mv_block->PMV[0][0][0] = s->
mv[0][0][0];
222 mv_block->PMV[0][0][1] = s->
mv[0][0][1];
223 mv_block->PMV[1][0][0] = s->
mv[0][1][0];
224 mv_block->PMV[1][0][1] = s->
mv[0][1][1];
227 mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_BACKWARD;
228 mv_block->PMV[0][1][0] = s->
mv[1][0][0];
229 mv_block->PMV[0][1][1] = s->
mv[1][0][1];
230 mv_block->PMV[1][1][0] = s->
mv[1][1][0];
231 mv_block->PMV[1][1][1] = s->
mv[1][1][1];
236 mv_block->motion_type = XVMC_PREDICTION_FRAME;
239 mv_block->motion_type = XVMC_PREDICTION_16x8;
242 mv_block->motion_type = XVMC_PREDICTION_FIELD;
244 mv_block->PMV[0][0][1] <<= 1;
245 mv_block->PMV[1][0][1] <<= 1;
246 mv_block->PMV[0][1][1] <<= 1;
247 mv_block->PMV[1][1][1] <<= 1;
251 mv_block->motion_type = XVMC_PREDICTION_DUAL_PRIME;
254 mv_block->PMV[0][0][0] = s->
mv[0][0][0];
255 mv_block->PMV[0][0][1] = s->
mv[0][0][1] << 1;
257 mv_block->PMV[0][1][0] = s->
mv[0][0][0];
258 mv_block->PMV[0][1][1] = s->
mv[0][0][1] << 1;
260 mv_block->PMV[1][0][0] = s->
mv[0][2][0];
261 mv_block->PMV[1][0][1] = s->
mv[0][2][1] << 1;
263 mv_block->PMV[1][1][0] = s->
mv[0][3][0];
264 mv_block->PMV[1][1][1] = s->
mv[0][3][1] << 1;
267 mv_block->PMV[0][1][0] = s->
mv[0][2][0];
268 mv_block->PMV[0][1][1] = s->
mv[0][2][1];
275 mv_block->motion_vertical_field_select = 0;
279 mv_block->motion_vertical_field_select |= s->
field_select[0][0];
280 mv_block->motion_vertical_field_select |= s->
field_select[1][0] << 1;
281 mv_block->motion_vertical_field_select |= s->
field_select[0][1] << 2;
282 mv_block->motion_vertical_field_select |= s->
field_select[1][1] << 3;
295 for (i = 0; i < blocks_per_mb; i++) {
303 for (i = 4; i < blocks_per_mb; i++) {
309 cbp &= 0xf << (blocks_per_mb - 4);
313 mv_block->coded_block_pattern = cbp;
315 mv_block->macroblock_type &= ~XVMC_MB_TYPE_PATTERN;
317 for (i = 0; i < blocks_per_mb; i++) {
350 #if CONFIG_MPEG1_XVMC_HWACCEL
352 .
name =
"mpeg1_xvmc",
358 .decode_slice =
NULL,
364 #if CONFIG_MPEG2_XVMC_HWACCEL
366 .
name =
"mpeg2_xvmc",
372 .decode_slice =
NULL,
const AVHWAccel ff_mpeg2_xvmc_hwaccel
#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...
static void exchange_uv(MpegEncContext *s)
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)
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_CODEC_FLAG_GRAY
Only decode/encode grayscale.
static void ff_xvmc_decode_mb(struct MpegEncContext *s)
Synthesize the data needed by XvMC to render one macroblock of data.
#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 MPEG-1
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.
int flags
AV_CODEC_FLAG_*.
unsigned int picture_structure
top/bottom field or frame
XVideo Motion Acceleration via common packet passing.
const char * name
Name of the hardware accelerated codec.
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.
static int ff_xvmc_field_start(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
Find and store the surfaces that are used as reference frames.
preferred ID for MPEG-1/2 video decoding
int first_field
is 1 for the first field of a field picture 0 otherwise
const AVHWAccel ff_mpeg1_xvmc_hwaccel
#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.
static int ff_xvmc_field_end(AVCodecContext *avctx)
Complete frame/field rendering by passing any remaining blocks.
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 ...
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
int16_t(* block)[64]
points to one of the following blocks
Picture next_picture
copy of the next picture structure.
XvMCSurface * p_future_surface
Pointer to the surface used as future reference.
void(* idct)(int16_t *block)