~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/gallium/frontends/va/picture_hevc_enc.c

  • Committer: mmach
  • Date: 2023-11-02 21:31:35 UTC
  • Revision ID: netbit73@gmail.com-20231102213135-18d4tzh7tj0uz752
2023-11-02 22:11:57

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
 
54
54
   context->desc.h265enc.pic_order_cnt = h265->decoded_curr_pic.pic_order_cnt;
55
55
   coded_buf = handle_table_get(drv->htab, h265->coded_buf);
 
56
   if (!coded_buf)
 
57
      return VA_STATUS_ERROR_INVALID_BUFFER;
56
58
 
57
59
   if (!coded_buf->derived_surface.resource)
58
60
      coded_buf->derived_surface.resource = pipe_buffer_create(drv->pipe->screen, PIPE_BIND_VERTEX_BUFFER,
165
167
         return VA_STATUS_ERROR_ALLOCATION_FAILED;
166
168
 
167
169
      getEncParamPresetH265(context);
 
170
      context->desc.h265enc.rc.vbv_buffer_size = 20000000;
 
171
      context->desc.h265enc.rc.vbv_buf_lv = 48;
 
172
      context->desc.h265enc.rc.fill_data_enable = 1;
 
173
      context->desc.h265enc.rc.enforce_hrd = 1;
 
174
      context->desc.h265enc.rc.max_qp = 51;
 
175
      context->desc.h265enc.rc.min_qp = 0;
168
176
   }
169
177
 
170
178
   context->desc.h265enc.seq.general_profile_idc = h265->general_profile_idc;
239
247
   context->desc.h265enc.rc.skip_frame_enable = 0;
240
248
   context->desc.h265enc.rc.max_qp = rc->max_qp;
241
249
   context->desc.h265enc.rc.min_qp = rc->min_qp;
 
250
   /* Distinguishes from the default params set for these values in other
 
251
      functions and app specific params passed down */
 
252
   context->desc.h265enc.rc.app_requested_qp_range = ((rc->max_qp > 0) || (rc->min_qp > 0));
 
253
 
 
254
   if (context->desc.h265enc.rc.rate_ctrl_method ==
 
255
       PIPE_H2645_ENC_RATE_CONTROL_METHOD_QUALITY_VARIABLE)
 
256
      context->desc.h265enc.rc.vbr_quality_factor =
 
257
         rc->quality_factor;
242
258
 
243
259
   return VA_STATUS_SUCCESS;
244
260
}
407
423
   if (ms->buffer_size) {
408
424
      context->desc.h265enc.rc.vbv_buffer_size = ms->buffer_size;
409
425
      context->desc.h265enc.rc.vbv_buf_lv = (ms->initial_buffer_fullness << 6 ) / ms->buffer_size;
 
426
      context->desc.h265enc.rc.vbv_buf_initial_size = ms->initial_buffer_fullness;
 
427
      /* Distinguishes from the default params set for these values in other
 
428
         functions and app specific params passed down via HRD buffer */
 
429
      context->desc.h265enc.rc.app_requested_hrd_buffer = true;
410
430
   }
411
431
 
412
432
   return VA_STATUS_SUCCESS;
415
435
void getEncParamPresetH265(vlVaContext *context)
416
436
{
417
437
   //rate control
418
 
   context->desc.h265enc.rc.vbv_buffer_size = 20000000;
419
 
   context->desc.h265enc.rc.vbv_buf_lv = 48;
420
 
   context->desc.h265enc.rc.fill_data_enable = 1;
421
 
   context->desc.h265enc.rc.enforce_hrd = 1;
422
 
   context->desc.h265enc.rc.max_qp = 51;
423
 
   context->desc.h265enc.rc.min_qp = 0;
424
 
 
425
438
   if (context->desc.h265enc.rc.frame_rate_num == 0 ||
426
439
       context->desc.h265enc.rc.frame_rate_den == 0) {
427
440
      context->desc.h265enc.rc.frame_rate_num = 30;