From: Steinar H. Gunderson Date: Mon, 22 Feb 2016 21:29:17 +0000 (+0100) Subject: Correct VA-API offsets. X-Git-Tag: 1.1.0~8 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=ded4cffec7a53c01389a306ebc5caf1a4e965c05;p=nageru Correct VA-API offsets. --- diff --git a/h264encode.cpp b/h264encode.cpp index 012470d..96e0165 100644 --- a/h264encode.cpp +++ b/h264encode.cpp @@ -1967,10 +1967,10 @@ void H264EncoderImpl::encode_frame(H264EncoderImpl::PendingFrame frame, int enco unsigned char *surface_p = nullptr; vaMapBuffer(va_dpy, surf->surface_image.buf, (void **)&surface_p); - unsigned char *y_ptr = (unsigned char *)surface_p; + unsigned char *y_ptr = (unsigned char *)surface_p + surf->surface_image.offsets[0]; memcpy_with_pitch(y_ptr, surf->y_ptr, frame_width, surf->surface_image.pitches[0], frame_height); - unsigned char *cbcr_ptr = (unsigned char *)surface_p + frame_width * frame_height; + unsigned char *cbcr_ptr = (unsigned char *)surface_p + surf->surface_image.offsets[1]; memcpy_with_pitch(cbcr_ptr, surf->cbcr_ptr, (frame_width / 2) * sizeof(uint16_t), surf->surface_image.pitches[1], frame_height / 2); va_status = vaUnmapBuffer(va_dpy, surf->surface_image.buf);