Skip to content

Commit

Permalink
Fix output.
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Oct 19, 2024
1 parent 5300f5c commit a107b79
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions swscale/swscale_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,13 @@ static int alloc_out_ba(sws_t *sws, value *out_vect, value *tmp) {

*tmp = caml_ba_alloc(CAML_BA_C_LAYOUT | CAML_BA_UINT8, 1, NULL, &out_size);
data = Caml_ba_data_val(*tmp);
*out_vect = caml_alloc_tuple(sws->out.nb_planes + 1);
*out_vect = caml_alloc_tuple(2);

Store_field(*out_vect, 0, *tmp);
Store_field(*out_vect, 1, caml_alloc_tuple(sws->out.nb_planes));

#define planes Field(*out_vect, 1)
#define plane Field(planes, i)

for (i = 0; i < sws->out.nb_planes; i++) {
height = sws->out.height;
Expand All @@ -344,17 +348,17 @@ static int alloc_out_ba(sws_t *sws, value *out_vect, value *tmp) {

len = sws->out.stride[i] * height;

Store_field(*out_vect, i + 1, caml_alloc_tuple(2));

Store_field(Field(*out_vect, i + 1), 0,
caml_ba_sub(*tmp, Val_long(offset), Val_long(len)));

Store_field(Field(*out_vect, i + 1), 1, Val_long(sws->out.stride[i]));
Store_field(planes, i, caml_alloc_tuple(2));
Store_field(plane, 0, caml_ba_sub(*tmp, Val_long(offset), Val_long(len)));
Store_field(plane, 1, Val_long(sws->out.stride[i]));

sws->out.slice[i] = data + offset;
offset += len;
}

#undef planes
#undef plane

return 0;
}

Expand Down

0 comments on commit a107b79

Please sign in to comment.