diff options
author | Changyeon Lee <cyeon.lee@samsung.com> | 2019-12-19 20:00:12 +0900 |
---|---|---|
committer | Changyeon Lee <cyeon.lee@samsung.com> | 2019-12-20 11:59:27 +0900 |
commit | deb0079e8ed9874866cd37f7f89bd97a8e7974bf (patch) | |
tree | 4e61dfb76fc22b12d40db54918309449f804835b | |
parent | 952a0c6e08139f660c98df2af04fe36deb1c90f2 (diff) | |
download | libtbm-shm-deb0079e8ed9874866cd37f7f89bd97a8e7974bf.tar.gz libtbm-shm-deb0079e8ed9874866cd37f7f89bd97a8e7974bf.tar.bz2 libtbm-shm-deb0079e8ed9874866cd37f7f89bd97a8e7974bf.zip |
fix pitch and offset of NV format
Change-Id: Ib64a31f7eab0f35759bf6cd7d6887d238a89312c
-rw-r--r-- | src/tbm_bufmgr_shm.c | 27 |
1 files 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; } |