Disable broken reference frames
This commit is contained in:
parent
a68980a9e5
commit
3de05d047e
1 changed files with 28 additions and 9 deletions
|
@ -252,9 +252,12 @@ encoder_create_config(struct vaapi_recorder *r)
|
|||
&r->encoder.cfg);
|
||||
if (status != VA_STATUS_SUCCESS)
|
||||
return status;
|
||||
VASurfaceID ctx_surfaces[4];
|
||||
memcpy(ctx_surfaces, r->encoder.reference_picture, sizeof(VASurfaceID) * 3);
|
||||
ctx_surfaces[3] = r->vpp.output;
|
||||
|
||||
status = vaCreateContext(r->va_dpy, r->encoder.cfg,
|
||||
r->width, r->height, VA_PROGRESSIVE, 0, 0,
|
||||
r->width, r->height, VA_PROGRESSIVE, ctx_surfaces, 4,
|
||||
&r->encoder.ctx);
|
||||
if (status != VA_STATUS_SUCCESS) {
|
||||
vaDestroyConfig(r->va_dpy, r->encoder.cfg);
|
||||
|
@ -318,7 +321,10 @@ encoder_update_seq_parameters(struct vaapi_recorder *r)
|
|||
if (status == VA_STATUS_SUCCESS)
|
||||
return seq_buf;
|
||||
else
|
||||
{
|
||||
printf("%s: %d\n", __PRETTY_FUNCTION__, status);
|
||||
return VA_INVALID_ID;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -348,8 +354,8 @@ encoder_update_pic_parameters(struct vaapi_recorder *r,
|
|||
|
||||
pic->CurrPic.picture_id = curr_pic;
|
||||
pic->CurrPic.TopFieldOrderCnt = r->frame_count * 2;
|
||||
pic->ReferenceFrames[0].picture_id = pic0;
|
||||
pic->ReferenceFrames[1].picture_id = r->encoder.reference_picture[2];
|
||||
pic->ReferenceFrames[0].picture_id = r->frame_count?pic0:VA_INVALID_ID;
|
||||
pic->ReferenceFrames[1].picture_id = VA_INVALID_ID; // TODOr->frame_count > 1?r->encoder.reference_picture[2]:VA_INVALID_ID;
|
||||
pic->ReferenceFrames[2].picture_id = VA_INVALID_ID;
|
||||
|
||||
pic->coded_buf = output_buf;
|
||||
|
@ -366,7 +372,10 @@ encoder_update_pic_parameters(struct vaapi_recorder *r,
|
|||
if (status == VA_STATUS_SUCCESS)
|
||||
return pic_param_buf;
|
||||
else
|
||||
{
|
||||
printf("%s: %d\n", __PRETTY_FUNCTION__, status);
|
||||
return VA_INVALID_ID;
|
||||
}
|
||||
}
|
||||
|
||||
static VABufferID
|
||||
|
@ -395,7 +404,10 @@ encoder_update_slice_parameter(struct vaapi_recorder *r, int slice_type)
|
|||
if (status == VA_STATUS_SUCCESS)
|
||||
return slice_param_buf;
|
||||
else
|
||||
{
|
||||
printf("%s: %d\n", __PRETTY_FUNCTION__, status);
|
||||
return VA_INVALID_ID;
|
||||
}
|
||||
}
|
||||
|
||||
static VABufferID
|
||||
|
@ -438,15 +450,17 @@ setup_encoder(struct vaapi_recorder *r)
|
|||
{
|
||||
VAStatus status;
|
||||
|
||||
status = vaCreateSurfaces(r->va_dpy, VA_RT_FORMAT_YUV420,
|
||||
r->width, r->height,
|
||||
r->encoder.reference_picture, 3,
|
||||
NULL, 0);
|
||||
|
||||
status = encoder_create_config(r);
|
||||
if (status != VA_STATUS_SUCCESS) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
status = vaCreateSurfaces(r->va_dpy, VA_RT_FORMAT_YUV420,
|
||||
r->width, r->height,
|
||||
r->encoder.reference_picture, 3,
|
||||
NULL, 0);
|
||||
|
||||
if (status != VA_STATUS_SUCCESS) {
|
||||
encoder_destroy_config(r);
|
||||
return -1;
|
||||
|
@ -668,12 +682,16 @@ create_packed_header_buffers(struct vaapi_recorder *r, VABufferID *buffers,
|
|||
sizeof packed_header, 1, &packed_header,
|
||||
&buffers[0]);
|
||||
if (status != VA_STATUS_SUCCESS)
|
||||
{
|
||||
printf("%s: %d\n", __PRETTY_FUNCTION__, status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
status = vaCreateBuffer(r->va_dpy, r->encoder.ctx,
|
||||
VAEncPackedHeaderDataBufferType,
|
||||
(bit_length + 7) / 8, 1, data, &buffers[1]);
|
||||
if (status != VA_STATUS_SUCCESS) {
|
||||
printf("%s: %d\n", __PRETTY_FUNCTION__, status);
|
||||
vaDestroyBuffer(r->va_dpy, buffers[0]);
|
||||
return 0;
|
||||
}
|
||||
|
@ -783,7 +801,7 @@ encoder_encode(struct vaapi_recorder *r, VASurfaceID input)
|
|||
int i, slice_type;
|
||||
enum output_write_status ret;
|
||||
|
||||
if ((r->frame_count % r->encoder.intra_period) == 0)
|
||||
if (1)//(r->frame_count % r->encoder.intra_period) == 0)
|
||||
slice_type = SLICE_TYPE_I;
|
||||
else
|
||||
slice_type = SLICE_TYPE_P;
|
||||
|
@ -812,7 +830,7 @@ encoder_encode(struct vaapi_recorder *r, VASurfaceID input)
|
|||
VAStatus er = encoder_render_picture(r, input, buffers, count);
|
||||
if(er != VA_STATUS_SUCCESS)
|
||||
{
|
||||
printf("error %d\n", er);
|
||||
printf("render error %d\n", er);
|
||||
goto bail;
|
||||
}
|
||||
ret = encoder_write_output(r, output_buf);
|
||||
|
@ -833,6 +851,7 @@ encoder_encode(struct vaapi_recorder *r, VASurfaceID input)
|
|||
return;
|
||||
|
||||
bail:
|
||||
printf("buffer errors?\n");
|
||||
for (i = 0; i < count; i++)
|
||||
vaDestroyBuffer(r->va_dpy, buffers[i]);
|
||||
if (output_buf != VA_INVALID_ID)
|
||||
|
|
Loading…
Reference in a new issue