From deb0079e8ed9874866cd37f7f89bd97a8e7974bf Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Thu, 19 Dec 2019 20:00:12 +0900 Subject: [PATCH] fix pitch and offset of NV format Change-Id: Ib64a31f7eab0f35759bf6cd7d6887d238a89312c --- src/tbm_bufmgr_shm.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/tbm_bufmgr_shm.c b/src/tbm_bufmgr_shm.c index 72c1615..88c6522 100644 --- a/src/tbm_bufmgr_shm.c +++ b/src/tbm_bufmgr_shm.c @@ -421,34 +421,25 @@ tbm_shm_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data, * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian */ case TBM_FORMAT_NV12: + case TBM_FORMAT_NV21: bpp = 12; - if (plane_idx == 0) { + //if (plane_idx == 0) + { _offset = 0; _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV); _size = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE); _bo_idx = 0; - } else if (plane_idx == 1) { - _offset = 0; - _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV/2); - _size = SIZE_ALIGN(_pitch * (height / 2), TBM_SURFACE_ALIGNMENT_PLANE); - _bo_idx = 1; + if (plane_idx == 0) + break; } - break; - case TBM_FORMAT_NV21: - bpp = 12; - if (plane_idx == 0) { - _offset = 0; + //else if (plane_idx == 1) + { + _offset += _size; _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV); - _size = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE); - _bo_idx = 0; - } else if (plane_idx == 1) { - _offset = width * height; - _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV/2); _size = SIZE_ALIGN(_pitch * (height / 2), TBM_SURFACE_ALIGNMENT_PLANE); _bo_idx = 0; } break; - case TBM_FORMAT_NV16: case TBM_FORMAT_NV61: bpp = 16; @@ -464,7 +455,7 @@ tbm_shm_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data, //else if( plane_idx ==1 ) { _offset += _size; - _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV/2); + _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV); _size = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE); _bo_idx = 0; } -- 2.7.4