• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

hardware/intel/libva


Commit MetaInfo

Revisãoe272a93ebccb44b8b78b238e617137708f08c94d (tree)
Hora2010-03-04 18:54:20
AutorAustin Yuan <shengquan.yuan@inte...>
CommiterAustin Yuan

Mensagem de Log

Fix test/./h264encode.c issue

Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>

Mudança Sumário

Diff

--- a/test/encode/h264encode.c
+++ b/test/encode/h264encode.c
@@ -212,10 +212,11 @@ static int do_h264_encoding(void)
212212 VAEncPictureParameterBufferH264 pic_h264;
213213 VAEncSliceParameterBuffer slice_h264;
214214 VAStatus va_status;
215- VABufferID coded_buf, seq_param_buf, pic_param_buf, slice_param_buf;
215+ VABufferID seq_param_buf, pic_param_buf, slice_param_buf;
216216 int codedbuf_size;
217217 VASurfaceStatus surface_status;
218218 int src_surface, dst_surface, ref_surface;
219+ int codedbuf_idx = 0;
219220 int frame_skipped = 0;
220221 int i;
221222
@@ -229,12 +230,24 @@ static int do_h264_encoding(void)
229230
230231 codedbuf_size = (frame_width * frame_height * 400) / (16*16);
231232
233+ for (i = 0; i < CODEDBUF_NUM; i++) {
234+ /* create coded buffer once for all
235+ * other VA buffers which won't be used again after vaRenderPicture.
236+ * so APP can always vaCreateBuffer for every frame
237+ * but coded buffer need to be mapped and accessed after vaRenderPicture/vaEndPicture
238+ * so VA won't maintain the coded buffer
239+ */
240+ va_status = vaCreateBuffer(va_dpy,context_id,VAEncCodedBufferType,
241+ codedbuf_size, 1, NULL, &coded_buf[i]);
242+ CHECK_VASTATUS(va_status,"vaBeginPicture");
243+ }
244+
232245 src_surface = 0;
233246 /* the last two frames are reference/reconstructed frame */
234247 dst_surface = SURFACE_NUM - 1;
235248 ref_surface = SURFACE_NUM - 2;
236249
237- for (i=0; i < frame_count; i++) {
250+ for (i=0; i < (frame_count - 2); i++) {
238251 va_status = vaBeginPicture(va_dpy, context_id, surface_id[src_surface]);
239252 CHECK_VASTATUS(va_status,"vaBeginPicture");
240253
@@ -249,7 +262,7 @@ static int do_h264_encoding(void)
249262 seq_h264.frame_rate = frame_rate;
250263 seq_h264.initial_qp = initial_qp;
251264 seq_h264.min_qp = minimal_qp;
252- seq_h264.basic_unit_size = 6;
265+ seq_h264.basic_unit_size = 0;
253266 seq_h264.intra_period = intra_count;
254267
255268 va_status = vaCreateBuffer(va_dpy, context_id,
@@ -261,12 +274,10 @@ static int do_h264_encoding(void)
261274 CHECK_VASTATUS(va_status,"vaRenderPicture");;
262275 }
263276
264- va_status = vaCreateBuffer(va_dpy,context_id,VAEncCodedBufferType,
265- codedbuf_size, 1, NULL, &coded_buf);
266277
267278 pic_h264.reference_picture = surface_id[ref_surface];
268279 pic_h264.reconstructed_picture= surface_id[dst_surface];
269- pic_h264.coded_buf = coded_buf;
280+ pic_h264.coded_buf = coded_buf[codedbuf_idx];
270281 pic_h264.picture_width = frame_width;
271282 pic_h264.picture_height = frame_height;
272283 pic_h264.last_picture = (i==frame_count);
@@ -300,7 +311,7 @@ static int do_h264_encoding(void)
300311 va_status = vaQuerySurfaceStatus(va_dpy, surface_id[src_surface],&surface_status);
301312 frame_skipped = (surface_status & VASurfaceSkipped);
302313
303- save_coded_buf(coded_buf, i, frame_skipped);
314+ save_coded_buf(coded_buf[codedbuf_idx], i, frame_skipped);
304315
305316 /* should display reconstructed frame, but just diplay source frame */
306317 if (frame_display) {
@@ -316,6 +327,11 @@ static int do_h264_encoding(void)
316327 if (src_surface == (SURFACE_NUM - 2))
317328 src_surface = 0;
318329
330+ /* use next codedbuf */
331+ codedbuf_idx++;
332+ if (codedbuf_idx == (CODEDBUF_NUM - 1))
333+ codedbuf_idx = 0;
334+
319335 /* if a frame is skipped, current frame still use last reference frame */
320336 if (frame_skipped == 0) {
321337 /* swap ref/dst */
@@ -375,7 +391,8 @@ int main(int argc,char **argv)
375391 case '?':
376392 printf("./h264encode <options>\n");
377393 printf(" -w -h: resolution\n");
378- printf(" -n frame number\n");
394+ printf(" -n frame number\n");
395+ printf(" -d display the source frame\n");
379396 printf(" -p P frame count between two I frames\n");
380397 printf(" -f frame rate\n");
381398 printf(" -r bit rate\n");