Skip to content

Commit

Permalink
fix using software encoder when frame stride is different from frame …
Browse files Browse the repository at this point in the history
…width (#18)
  • Loading branch information
aler9 authored Oct 12, 2024
1 parent 8ffd050 commit 5bca171
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions encoder_soft_h264.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ bool encoder_soft_h264_create(const parameters_t *params, int stride, int colors
encoder_soft_h264_priv_t *encp = (encoder_soft_h264_priv_t *)(*enc);
memset(encp, 0, sizeof(encoder_soft_h264_priv_t));

if (stride != (int)params->width) {
set_error("unsupported stride: expected %d, got %d", params->width, stride);
goto failed;
}

int res = x264_param_default_preset(&encp->x_params, PRESET, TUNE);
if (res < 0) {
set_error("x264_param_default_preset() failed");
Expand Down Expand Up @@ -85,9 +80,9 @@ bool encoder_soft_h264_create(const parameters_t *params, int stride, int colors
x264_picture_init(&encp->x_pic_in);
encp->x_pic_in.img.i_csp = encp->x_params.i_csp;
encp->x_pic_in.img.i_plane = 3;
encp->x_pic_in.img.i_stride[0] = encp->x_params.i_width;
encp->x_pic_in.img.i_stride[1] = ((encp->x_params.i_width * 256/2) >> 8) * 1;
encp->x_pic_in.img.i_stride[2] = ((encp->x_params.i_width * 256/2) >> 8) * 1;
encp->x_pic_in.img.i_stride[0] = stride;
encp->x_pic_in.img.i_stride[1] = stride >> 1;
encp->x_pic_in.img.i_stride[2] = stride >> 1;

x264_picture_alloc(&encp->x_pic_out, encp->x_params.i_csp, encp->x_params.i_width, encp->x_params.i_height);

Expand Down

0 comments on commit 5bca171

Please sign in to comment.