Commit 73689dd3 authored by Julian Scheel's avatar Julian Scheel Committed by Jean-Baptiste Kempf

mmal: Fix plane offset computation

The computation of plane offsets was broken after recent refactorings. Fix it
by doing the actual computation of offsets in the picture lock function.
Signed-off-by: Julian Scheel's avatarJulian Scheel <julian@jusst.de>
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 87cb6e26
......@@ -33,9 +33,13 @@ int mmal_picture_lock(picture_t *picture)
MMAL_BUFFER_HEADER_T *buffer = pic_sys->buffer;
buffer->user_data = picture;
int offset = 0;
picture->p[0].p_pixels = buffer->data;
picture->p[1].p_pixels += (ptrdiff_t)buffer->data;
picture->p[2].p_pixels += (ptrdiff_t)buffer->data;
for (int i = 1; i < picture->i_planes; i++) {
offset = offset + picture->p[i - 1].i_pitch * picture->p[i - 1].i_lines;
picture->p[i].p_pixels = (ptrdiff_t)buffer->data + offset;
}
pic_sys->displayed = false;
......
......@@ -180,7 +180,6 @@ static int Open(vlc_object_t *object)
uint32_t buffer_pitch, buffer_height;
vout_display_place_t place;
MMAL_DISPLAYREGION_T display_region;
uint32_t offsets[3];
MMAL_STATUS_T status;
int ret = VLC_SUCCESS;
unsigned i;
......@@ -273,7 +272,6 @@ static int Open(vlc_object_t *object)
goto out;
}
offsets[0] = 0;
for (i = 0; i < sys->i_planes; ++i) {
sys->planes[i].i_lines = buffer_height;
sys->planes[i].i_pitch = buffer_pitch;
......@@ -281,14 +279,11 @@ static int Open(vlc_object_t *object)
sys->planes[i].i_visible_pitch = vd->fmt.i_visible_width;
if (i > 0) {
offsets[i] = offsets[i - 1] + sys->planes[i - 1].i_pitch * sys->planes[i - 1].i_lines;
sys->planes[i].i_lines /= 2;
sys->planes[i].i_pitch /= 2;
sys->planes[i].i_visible_lines /= 2;
sys->planes[i].i_visible_pitch /= 2;
}
sys->planes[i].p_pixels = (uint8_t *)offsets[i];
}
vlc_mutex_init(&sys->buffer_mutex);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment