Here is the function API for reference:
int ConvertToI420(const uint8* src_frame, size_t src_size, uint8* dst_y, int dst_stride_y, uint8* dst_u, int dst_stride_u, uint8* dst_v, int dst_stride_v, int crop_x, int crop_y, int src_width, int src_height, int crop_width, int crop_height, enum RotationMode rotation, uint32 format);
int retVal = libyuv::ConvertToI420(src_frame, src_size,
pDstY, destWidth,
pDstU, (destWidth/2),
pDstV, (destWidth/2),
0, 0,
sourceWidth, sourceHeight,
sourceWidth, sourceHeight,
mode,
format);
// Rotate NV12 input and store in I420. LIBYUV_API int NV12ToI420Rotate(const uint8* src_y, int src_stride_y, const uint8* src_uv, int src_stride_uv, uint8* dst_y, int dst_stride_y, uint8* dst_u, int dst_stride_u, uint8* dst_v, int dst_stride_v, int src_width, int src_height, enum RotationMode mode);
ConvertToI420 assumes the entire source image is contiguous memory, but the NV12ToI420Rotate does not.
src_width
--I have compiled libyuv and able to call libyuv::ConvertToI420 method but the resulting I420 that I get is all messed up in terms of color and showing lines and all..... however the dimensions that I get are now 144*176.
I have an onPreviewFrame callback set up. This gets a byte[] with NV21 data in it. I have set the preview size to 176*144. When device is held in landscape mode, byte[] with 176*144 dimensions is perfect but when device is held in portrait mode I still get byte[] with the same dimensions.
I want to rotate the byte[] by 90 degrees and obtain byte[] with dimensions 144*176. For this am trying to use ConvertToI420 from libyuv.
The code snippet am using is as follows:-//sourceWidth = 176 and sourceHeight = 144 unsigned char I420M = new unsigned char[(int)(sourceWidth*sourceHeight*1.5)]; unsigned int YSize = sourceWidth * sourceHeight; // yuvPtr is the NV21 data passed from onPreviewCallback (from JAVA layer) const uint8* src_frame = const_cast<const uint8*>(yuvPtr); size_t src_size = YSize; uint8* pDstY = I420M; uint8* pDstU = I420M + YSize; uint8* pDstV = I420M + (YSize/4); libyuv::RotationMode mode; if(landscapeLeft){ mode = libyuv::kRotate90; }else{ mode = libyuv::kRotate270; } uint32 format = libyuv::FOURCC_NV21; int retVal = libyuv::ConvertToI420(src_frame, src_size, pDstY, sourceHeight, pDstU, (sourceHeight/2), pDstV, (sourceHeight/2), 0, 0, sourceWidth, sourceHeight, sourceWidth, sourceHeight, mode, format);
Output I420 obtained (in I420M above) afterConvertToI420
.
A single frame from the I420 obtained.
Please someone could point me where am going wrong.
You received this message because you are subscribed to the Google Groups "discuss-libyuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-libyu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.