Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix using software encoder when frame stride is different from frame width #18

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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