return bo_handle;
}
-static int
-_new_calc_plane_nv12(int width, int height)
-{
- int mbX, mbY;
-
- mbX = DIV_ROUND_UP(width, S5P_FIMV_NUM_PIXELS_IN_MB_ROW);
- mbY = DIV_ROUND_UP(height, S5P_FIMV_NUM_PIXELS_IN_MB_COL);
-
- if (width * height < S5P_FIMV_MAX_FRAME_SIZE)
- mbY = (mbY + 1) / 2 * 2;
-
- return ((mbX * S5P_FIMV_NUM_PIXELS_IN_MB_COL) * (mbY *
- S5P_FIMV_NUM_PIXELS_IN_MB_ROW));
-}
-
static int
_calc_yplane_nv12(int width, int height)
{
return SIZE_ALIGN((mbX * mbY) >> 1, S5P_FIMV_DEC_BUF_ALIGN);
}
+static int
+_new_calc_plane_nv12(int width, int height)
+{
+ int mbX, mbY;
+
+ mbX = DIV_ROUND_UP(width, S5P_FIMV_NUM_PIXELS_IN_MB_ROW);
+ mbY = DIV_ROUND_UP(height, S5P_FIMV_NUM_PIXELS_IN_MB_COL);
+
+ if (width * height < S5P_FIMV_MAX_FRAME_SIZE)
+ mbY = (mbY + 1) / 2 * 2;
+
+ return ((mbX * S5P_FIMV_NUM_PIXELS_IN_MB_COL) * (mbY *
+ S5P_FIMV_NUM_PIXELS_IN_MB_ROW));
+}
+
static int
_new_calc_yplane_nv12(int width, int height)
{
* 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 = MAX(_calc_yplane_nv12(width, height), _new_calc_yplane_nv12(width,
- height));
- _bo_idx = 0;
- } else if (plane_idx == 1) {
- _offset = MAX(_calc_yplane_nv12(width, height), _new_calc_yplane_nv12(width,
- height));
- _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV / 2);
- _size = MAX(_calc_uvplane_nv12(width, height), _new_calc_uvplane_nv12(width,
- height));
+ _size = MAX(_calc_yplane_nv12(width, height),
+ _new_calc_yplane_nv12(width, height));
_bo_idx = 0;
}
- 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);
+ _size = MAX(_calc_uvplane_nv12(width, height),
+ _new_calc_uvplane_nv12(width, height));
_bo_idx = 0;
}
break;
-
case TBM_FORMAT_NV16:
case TBM_FORMAT_NV61:
bpp = 16;
/*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;
}