Home | History | Annotate | Download | only in encode

Lines Matching refs:avcenc_context

152 } avcenc_context;
168 vaQueryConfigEntrypoints(va_dpy, avcenc_context.profile, entrypoints,
184 vaGetConfigAttributes(va_dpy, avcenc_context.profile, VAEntrypointEncSlice,
192 if ((attrib[1].value & avcenc_context.rate_control_method) == 0) {
199 attrib[1].value = avcenc_context.rate_control_method; /* set to desired RC mode */
201 va_status = vaCreateConfig(va_dpy, avcenc_context.profile, VAEntrypointEncSlice,
202 &attrib[0], 2,&avcenc_context.config_id);
206 va_status = vaCreateContext(va_dpy, avcenc_context.config_id,
210 &avcenc_context.context_id);
216 vaDestroyContext(va_dpy,avcenc_context.context_id);
217 vaDestroyConfig(va_dpy,avcenc_context.config_id);
267 avcenc_context.upload_thread_param.yuv_fp = yuv_fp;
268 avcenc_context.upload_thread_param.surface_id = surface_ids[SID_INPUT_PICTURE_1];
270 avcenc_context.upload_thread_value = pthread_create(&avcenc_context.upload_thread_id,
273 (void*)&avcenc_context.upload_thread_param);
278 pthread_join(avcenc_context.upload_thread_id, NULL);
293 avcenc_context.i_initial_cpb_removal_delay_length,
294 avcenc_context.i_initial_cpb_removal_delay,
296 avcenc_context.i_cpb_removal_delay_length,
297 avcenc_context.i_cpb_removal_delay * frame_num,
298 avcenc_context.i_dpb_output_delay_length,
308 avcenc_context.context_id,
311 &avcenc_context.packed_sei_header_param_buf_id);
315 avcenc_context.context_id,
318 &avcenc_context.packed_sei_buf_id);
330 pic_param = &avcenc_context.pic_param;
336 assert(avcenc_context.codedbuf_buf_id != VA_INVALID_ID);
337 pic_param->coded_buf = avcenc_context.codedbuf_buf_id;
343 avcenc_context.context_id,
346 &avcenc_context.pic_param_buf_id);
432 slice_param = &avcenc_context.slice_param[i];
467 avcenc_context.context_id,
470 &avcenc_context.slice_param_buf_id[i]);
475 slice_param = &avcenc_context.slice_param[i];
493 avcenc_context.context_id,
496 &avcenc_context.slice_param_buf_id[i]);
501 avcenc_context.num_slices = i;
508 if (avcenc_context.upload_thread_value != 0) {
513 pthread_join(avcenc_context.upload_thread_id, NULL);
515 avcenc_context.upload_thread_value = -1;
517 if (avcenc_context.current_input_surface == SID_INPUT_PICTURE_0)
518 avcenc_context.current_input_surface = SID_INPUT_PICTURE_1;
520 avcenc_context.current_input_surface = SID_INPUT_PICTURE_0;
534 avcenc_context.context_id,
537 &avcenc_context.packed_seq_header_param_buf_id);
541 avcenc_context.context_id,
544 &avcenc_context.packed_seq_buf_id);
554 avcenc_context.context_id,
557 &avcenc_context.packed_pic_header_param_buf_id);
561 avcenc_context.context_id,
564 &avcenc_context.packed_pic_buf_id);
572 VAEncSequenceParameterBufferH264 *seq_param = &avcenc_context.seq_param;
574 avcenc_context.context_id,
577 &avcenc_context.seq_param_buf_id);
585 avcenc_context.context_id,
590 &avcenc_context.misc_parameter_hrd_buf_id);
594 avcenc_context.misc_parameter_hrd_buf_id,
607 vaUnmapBuffer(va_dpy, avcenc_context.misc_parameter_hrd_buf_id);
622 va_buffers[num_va_buffers++] = avcenc_context.seq_param_buf_id;
623 va_buffers[num_va_buffers++] = avcenc_context.pic_param_buf_id;
625 if (avcenc_context.packed_seq_header_param_buf_id != VA_INVALID_ID)
626 va_buffers[num_va_buffers++] = avcenc_context.packed_seq_header_param_buf_id;
628 if (avcenc_context.packed_seq_buf_id != VA_INVALID_ID)
629 va_buffers[num_va_buffers++] = avcenc_context.packed_seq_buf_id;
631 if (avcenc_context.packed_pic_header_param_buf_id != VA_INVALID_ID)
632 va_buffers[num_va_buffers++] = avcenc_context.packed_pic_header_param_buf_id;
634 if (avcenc_context.packed_pic_buf_id != VA_INVALID_ID)
635 va_buffers[num_va_buffers++] = avcenc_context.packed_pic_buf_id;
637 if (avcenc_context.packed_sei_header_param_buf_id != VA_INVALID_ID)
638 va_buffers[num_va_buffers++] = avcenc_context.packed_sei_header_param_buf_id;
640 if (avcenc_context.packed_sei_buf_id != VA_INVALID_ID)
641 va_buffers[num_va_buffers++] = avcenc_context.packed_sei_buf_id;
643 if (avcenc_context.misc_parameter_hrd_buf_id != VA_INVALID_ID)
644 va_buffers[num_va_buffers++] = avcenc_context.misc_parameter_hrd_buf_id;
647 avcenc_context.context_id,
648 surface_ids[avcenc_context.current_input_surface]);
652 avcenc_context.context_id,
657 for(i = 0; i < avcenc_context.num_slices; i++) {
659 avcenc_context.context_id,
660 &avcenc_context.slice_param_buf_id[i],
665 va_status = vaEndPicture(va_dpy, avcenc_context.context_id);
710 avcenc_destroy_buffers(&avcenc_context.seq_param_buf_id, 1);
711 avcenc_destroy_buffers(&avcenc_context.pic_param_buf_id, 1);
712 avcenc_destroy_buffers(&avcenc_context.packed_seq_header_param_buf_id, 1);
713 avcenc_destroy_buffers(&avcenc_context.packed_seq_buf_id, 1);
714 avcenc_destroy_buffers(&avcenc_context.packed_pic_header_param_buf_id, 1);
715 avcenc_destroy_buffers(&avcenc_context.packed_pic_buf_id, 1);
716 avcenc_destroy_buffers(&avcenc_context.packed_sei_header_param_buf_id, 1);
717 avcenc_destroy_buffers(&avcenc_context.packed_sei_buf_id, 1);
718 avcenc_destroy_buffers(&avcenc_context.slice_param_buf_id[0], avcenc_context.num_slices);
719 avcenc_destroy_buffers(&avcenc_context.codedbuf_buf_id, 1);
720 avcenc_destroy_buffers(&avcenc_context.misc_parameter_hrd_buf_id, 1);
722 memset(avcenc_context.slice_param, 0, sizeof(avcenc_context.slice_param));
723 avcenc_context.num_slices = 0;
882 VAEncSequenceParameterBufferH264 *seq_param = &avcenc_context.seq_param;
885 if (avcenc_context.profile == VAProfileH264High)
887 else if (avcenc_context.profile == VAProfileH264Main)
891 bitstream_put_ui(bs, !!(avcenc_context.constraint_set_flag & 1), 1); /* constraint_set0_flag */
892 bitstream_put_ui(bs, !!(avcenc_context.constraint_set_flag & 2), 1); /* constraint_set1_flag */
893 bitstream_put_ui(bs, !!(avcenc_context.constraint_set_flag & 4), 1); /* constraint_set2_flag */
894 bitstream_put_ui(bs, !!(avcenc_context.constraint_set_flag & 8), 1); /* constraint_set3_flag */
992 VAEncPictureParameterBufferH264 *pic_param = &avcenc_context.pic_param;
1145 VAEncSequenceParameterBufferH264 *seq_param = &avcenc_context.seq_param;
1146 VAEncPictureParameterBufferH264 *pic_param = &avcenc_context.pic_param;
1219 va_status = vaSyncSurface(va_dpy, surface_ids[avcenc_context.current_input_surface]);
1223 va_status = vaQuerySurfaceStatus(va_dpy, surface_ids[avcenc_context.current_input_surface], &surface_status);
1226 va_status = vaMapBuffer(va_dpy, avcenc_context.codedbuf_buf_id, (void **)(&coded_buffer_segment));
1237 vaUnmapBuffer(va_dpy, avcenc_context.codedbuf_buf_id);
1262 va_status = vaSyncSurface(va_dpy, surface_ids[avcenc_context.current_input_surface]);
1266 va_status = vaQuerySurfaceStatus(va_dpy, surface_ids[avcenc_context.current_input_surface], &surface_status);
1269 va_status = vaMapBuffer(va_dpy, avcenc_context.codedbuf_buf_id, (void **)(&coded_buffer_segment));
1275 avcenc_context.codedbuf_i_size *= 2;
1277 avcenc_context.codedbuf_pb_size *= 2;
1279 vaUnmapBuffer(va_dpy, avcenc_context.codedbuf_buf_id);
1290 if (avcenc_context.codedbuf_i_size > slice_data_length * 3 / 2) {
1291 avcenc_context.codedbuf_i_size = slice_data_length * 3 / 2;
1294 if (avcenc_context.codedbuf_pb_size < slice_data_length) {
1295 avcenc_context.codedbuf_pb_size = slice_data_length;
1298 if (avcenc_context.codedbuf_pb_size > slice_data_length * 3 / 2) {
1299 avcenc_context.codedbuf_pb_size = slice_data_length * 3 / 2;
1303 vaUnmapBuffer(va_dpy, avcenc_context.codedbuf_buf_id);
1325 if (avcenc_context.current_input_surface == SID_INPUT_PICTURE_0)
1333 avcenc_context.upload_thread_param.yuv_fp = yuv_fp;
1334 avcenc_context.upload_thread_param.surface_id = surface_ids[index];
1336 avcenc_context.upload_thread_value = pthread_create(&avcenc_context.upload_thread_id,
1339 (void*)&avcenc_context.upload_thread_param);
1343 avcenc_destroy_buffers(&avcenc_context.codedbuf_buf_id, 1);
1344 avcenc_destroy_buffers(&avcenc_context.pic_param_buf_id, 1);
1348 codedbuf_size = avcenc_context.codedbuf_i_size;
1350 codedbuf_size = avcenc_context.codedbuf_pb_size;
1355 avcenc_context.context_id,
1358 &avcenc_context.codedbuf_buf_id);
1364 if (avcenc_context.rate_control_method == VA_RC_CBR)
1469 if (avcenc_context.constraint_set_flag & 0x7)
1483 target_bit_rate = avcenc_context.seq_param.bits_per_second;
1485 avcenc_context.i_initial_cpb_removal_delay = init_cpb_size * 0.5 * 1024 / target_bit_rate * 90000;
1487 avcenc_context.i_cpb_removal_delay = 2;
1488 avcenc_context.i_initial_cpb_removal_delay_length = 24;
1489 avcenc_context.i_cpb_removal_delay_length = 24;
1490 avcenc_context.i_dpb_output_delay_length = 24;
1496 memset(&avcenc_context, 0, sizeof(avcenc_context));
1497 avcenc_context.profile = VAProfileH264Main;
1499 switch (avcenc_context.profile) {
1501 avcenc_context.constraint_set_flag |= (1 << 0); /* Annex A.2.1 */
1505 avcenc_context.constraint_set_flag |= (1 << 1); /* Annex A.2.2 */
1509 avcenc_context.constraint_set_flag |= (1 << 3); /* Annex A.2.4 */
1516 avcenc_context.seq_param_buf_id = VA_INVALID_ID;
1517 avcenc_context.pic_param_buf_id = VA_INVALID_ID;
1518 avcenc_context.packed_seq_header_param_buf_id = VA_INVALID_ID;
1519 avcenc_context.packed_seq_buf_id = VA_INVALID_ID;
1520 avcenc_context.packed_pic_header_param_buf_id = VA_INVALID_ID;
1521 avcenc_context.packed_pic_buf_id = VA_INVALID_ID;
1522 avcenc_context.codedbuf_buf_id = VA_INVALID_ID;
1523 avcenc_context.misc_parameter_hrd_buf_id = VA_INVALID_ID;
1524 avcenc_context.codedbuf_i_size = width * height;
1525 avcenc_context.codedbuf_pb_size = 0;
1526 avcenc_context.current_input_surface = SID_INPUT_PICTURE_0;
1527 avcenc_context.upload_thread_value = -1;
1528 avcenc_context.packed_sei_header_param_buf_id = VA_INVALID_ID;
1529 avcenc_context.packed_sei_buf_id = VA_INVALID_ID;
1532 avcenc_context.rate_control_method = VA_RC_CBR;
1534 avcenc_context.rate_control_method = VA_RC_VBR;
1537 avcenc_context.rate_control_method = VA_RC_CQP;
1541 avcenc_context.slice_param_buf_id[i] = VA_INVALID_ID;
1544 avcenc_context_seq_param_init(&avcenc_context.seq_param, width, height);
1545 avcenc_context_pic_param_init(&avcenc_context.pic_param);
1546 if (avcenc_context.rate_control_method == VA_RC_CBR)