comparison mpegvideo_xvmc.c @ 8926:b8da7a21372c libavcodec

Document all functions in mpegvideo_xvmc.
author iive
date Sun, 15 Feb 2009 18:30:39 +0000
parents 23051e3e9d25
children b978ca882917
comparison
equal deleted inserted replaced
8925:23051e3e9d25 8926:b8da7a21372c
32 #include "xvmc_internal.h" 32 #include "xvmc_internal.h"
33 33
34 /** 34 /**
35 * Initializes the block field of the MpegEncContext pointer passed as 35 * Initializes the block field of the MpegEncContext pointer passed as
36 * parameter after making sure that the data is not corrupted. 36 * parameter after making sure that the data is not corrupted.
37 * In order to implement something like direct rendering instead of decodeing
38 * coefficients in s->blocks and then copy them, do that directly
39 * into the data_blocks array provided by xvmc.
37 */ 40 */
38 void ff_xvmc_init_block(MpegEncContext *s) 41 void ff_xvmc_init_block(MpegEncContext *s)
39 { 42 {
40 struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.data[2]; 43 struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.data[2];
41 assert(render && render->unique_id == AV_XVMC_RENDER_MAGIC); 44 assert(render && render->unique_id == AV_XVMC_RENDER_MAGIC);
42 45
43 s->block = (DCTELEM *)(render->data_blocks + render->next_free_data_block_num * 64); 46 s->block = (DCTELEM *)(render->data_blocks + render->next_free_data_block_num * 64);
44 } 47 }
45 48
49 /**
50 * Fill individual block pointers, so there are no gaps in the data_block array
51 * in case not all blocks in MB are coded.
52 */
46 void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp) 53 void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp)
47 { 54 {
48 int i, j = 0; 55 int i, j = 0;
49 const int mb_block_count = 4 + (1 << s->chroma_format); 56 const int mb_block_count = 4 + (1 << s->chroma_format);
50 57
57 cbp+=cbp; 64 cbp+=cbp;
58 } 65 }
59 } 66 }
60 67
61 /** 68 /**
69 * Find and store the surfaces that are used as reference frames.
62 * This function should be called for every new field and/or frame. 70 * This function should be called for every new field and/or frame.
63 * It should be safe to call the function a few times for the same field. 71 * It should be safe to call the function a few times for the same field.
64 */ 72 */
65 int ff_xvmc_field_start(MpegEncContext*s, AVCodecContext *avctx) 73 int ff_xvmc_field_start(MpegEncContext*s, AVCodecContext *avctx)
66 { 74 {
116 124
117 return -1; 125 return -1;
118 } 126 }
119 127
120 /** 128 /**
121 * This function should be called for every new field and/or frame. 129 * Complete frame/field rendering by passing any remaining blocks.
130 * Normally ff_draw_horiz_band() is called on each slice, however
131 * there may be some remaining blocks, for example put by error_resilience.
122 * It should be safe to call the function a few times for the same field. 132 * It should be safe to call the function a few times for the same field.
123 */ 133 */
124 void ff_xvmc_field_end(MpegEncContext *s) 134 void ff_xvmc_field_end(MpegEncContext *s)
125 { 135 {
126 struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.data[2]; 136 struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.data[2];
128 138
129 if (render->filled_mv_blocks_num > 0) 139 if (render->filled_mv_blocks_num > 0)
130 ff_draw_horiz_band(s, 0, 0); 140 ff_draw_horiz_band(s, 0, 0);
131 } 141 }
132 142
143 /**
144 * Synthesize the data needed by XvMC to render one macroblock of data.
145 * Fill all relevent fields, if necessery do IDCT.
146 */
133 void ff_xvmc_decode_mb(MpegEncContext *s) 147 void ff_xvmc_decode_mb(MpegEncContext *s)
134 { 148 {
135 XvMCMacroBlock *mv_block; 149 XvMCMacroBlock *mv_block;
136 struct xvmc_pix_fmt *render; 150 struct xvmc_pix_fmt *render;
137 int i, cbp, blocks_per_mb; 151 int i, cbp, blocks_per_mb;