📄 omxipcs_ycbcr420rszrot_u8_p3r.c
字号:
/** * * * File Name: omxIPCS_YCbCr420RszRot_U8_P3R.c * OpenMAX DL: v1.0.2 * Revision: 10586 * Date: Wednesday, March 5, 2008 * * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. * * * * Description : Integrated Colour Space Conversion and Rotate Routine. Both the * source and destination are in three channel, planar domain format. * */#include "omxtypes.h"#include "armCOMM.h"#include "armOMX.h"#include "omxIP.h"#include "armIP.h"/** * Function: omxIPCS_YCbCr420RszRot_U8_P3R (4.4.3.4.2) * * Description: * This function combines two atomic image processing kernels into a single * function. The following sequence of operations is applied: * * 1. Resize. The input image of dimension srcSize is rescaled according * to the Q16 reciprocal ratio scaling control parameters rcpRatiox * and rcpRatioy using the interpolation/decimation methodology specified * by the control parameter interpolation. Nearest neighbor and bilinear * interpolation schemes are supported. The rescaled image is clipped to * dstSize using a clipping rectangle, the origin of which coincides with * the top, left corner of the input image, i.e., pixels are discarded * along the right and bottom edges. * * 2. Rotation. The output image is rotated with respect to the input * image according to the control parameter rotation. * * The input data should be YCbCr420 planar format for <omxIPCS_YCbCr420RszRot_U8_P3R> * and YCbCr422 planar format for <omxIPCS_YCbCr422RszRot_U8_P3R>. * * Input Arguments: * * pSrc - a 3-element vector containing pointers to the start of each of * the YCbCr420 input planes for <omxIPCS_YCbCr420RszRot_U8_P3R> * and YCbCr422 input planes for <omxIPCS_YCbCr422RszRot_U8_P3R>. * The pointer pSrc[0] must be aligned on a 4-byte boundary. * srcStep - a 3-element vector containing the distance, in bytes, between * the start of lines in each of the input image planes; the * parameter srcStep[0] must be a multiple of 4. * dstStep - a 3-element vector containing the distance, in bytes, between * the start of lines in each of the output image planes; the * parameter dstStep[0] must be a multiple of 4. * srcSize - dimensions, in pixels, of the source image * dstSize - dimensions, in pixels, of the destination image (before * applying rotation to the resized image). The parameters * dstSize.width and dstSize.height must be even. * interpolation - interpolation methodology control parameter; must take * one of the following values: OMX_IP_NEAREST, or OMX_IP_BILINEAR * for nearest neighbor or bilinear interpolation, respectively * rotation - rotation control parameter; must be set to one of the * following pre-defined values: . OMX_IP_DISABLE, * OMX_IP_ROTATE90L, OMX_IP_ROTATE90R, OMX_IP_ROTATE180, * OMX_IP_FLIP_HORIZONTAL, or OMX_IP_FLIP_VERTICAL * rcpRatiox - x direction scaling control parameter, specified in terms of * a reciprocal resize ratio using a Q16 representation. Valid in * the range [1, xrr_max], where xrr_max = (OMX_INT) ((( (OMX_F32) * ((srcSize.width&~1)-1) / ((dstSize.width&~1)-1)) * (1<<16) * +0.5). Setting rcpRatiox = xrr_max guarantees that the output * image size will be exactly dstSize; otherwise for values less * than xrr_max the right hand side of the image will be clipped * since the output image will extend beyond dstSize. Expansion in * the x direction occurs for values of rcpRatiox < 65536; * contraction in the x direction occurs for values > 65536. To * avoid clipping, use the value xrr_max, which will ensure that * the output image width == dstSize.width. Values larger than * xrr_max are invalid, i.e., output images smaller than dstSize * are not allowed. * rcpRatioy - y direction scaling control parameter, specified in terms of * a reciprocal resize ratio using a Q16 representation. Valid in * the range [1, yrr_max], where yrr_max = (OMX_INT) ((( (OMX_F32) * (srcSize.height&~1)-1) / ((dstSize.height&~1)-1)) * (1<< 16) * +0.5). Setting rcpRatioy = yrr_max guarantees that the output * image size will be exactly dstSize; otherwise for values less * than yrr_max the bottom of the output image will be clipped * since the output image will be larger than dstSize. Expansion * in the y direction occurs for values of rcpRatioy < 65536; * contraction in the y direction occurs for values > 65536. To * avoid clipping, use the value yrr_max, which will ensure that * the output image height == dstSize.height. Values larger than * yrr_max are invalid, i.e., output images smaller than dstSize * are not allowed. * * Size of output image, dstSize is the size of destination image * before rotation, i.e., dstSize is the size of the image after * resizing. * * Output Arguments: * * pDst - a 3-element vector containing pointers to the start of each of * the YCbCr420 output planes for <omxIPCS_YCbCr420RszRot_U8_P3R> * or YCbCr422 output planes for <omxIPCS_YCbCr422RszRot_U8_P3R>. * The pointer pDst[0] must be aligned on a 4-byte boundary. * * Return Value: * If the function runs without error, it returns OMX_Sts_NoErr. * OMX_Sts_BadArgErr, if any of the following cases occurs: * - Any pointer is NULL * - srcSize.width, srcSize.height <= 0 * - dstSize.width, dstSize.height <= 0 * - rcpRatioy is outside of the range [1, yrr_max], where yrr_max = * (OMX_INT) ((( (OMX_F32) (srcSize.height&~1)-1) / * ((dstSize.height&~1)-1)) * (1<< 16) + 0.5). * - rcpRatiox is outside of the range [1, xrr_max], where xrr_max = * (OMX_INT) ((( (OMX_F32) ((srcSize.width&~1)-1) / * ((dstSize.width&~1)-1)) * (1<<16) + 0.5). * - pDst[0] is not aligned on a 4-byte boundary * - pSrc[0] is not aligned on a 4-byte boundary * - dstSize.width or dstSize.height is not even * - srcStep[0], srcStep[1], srcStep[2]or dstStep[0], dstStep[1], * dstStep[2]is less than 1 * - srcStep[0] is not multiple of 4 * - dstStep[0] is not multiple of 4 * - srcSize.width is larger than srcStep[0]; srcSize.width>>1 is larger * than srcStep[1] or srcStep[2]. * - interpolation contains an invalid value * - rotation contains an invalid value * - dstSize.height of output image is larger than dstStep[0], * - dstSize.height>>1 of output image is larger than dstStep[1] or * dstStep[2] when rotation is OMX_IP_ROTATE90L or * OMX_IP_ROTATE90R; * - dstSize.width of output image is larger than dstStep[0], * - dstSize.width>>1 of output image is larger than dstStep[1] or dstStep[2] * when other valid rotation options. * */ OMXResult omxIPCS_YCbCr420RszRot_U8_P3R( const OMX_U8 *pSrc[3], OMX_INT srcStep[3], OMXSize srcSize, OMX_U8 *pDst[3], OMX_INT dstStep[3], OMXSize dstSize, OMXIPInterpolation interpolation, OMXIPRotation rotation, OMX_INT rcpRatiox, OMX_INT rcpRatioy ){ OMX_F32 xOff, yOff; const OMX_U8 *pSrcRef; OMX_U8 *pDstRef, component; OMX_INT srcStepRef, dstStepRef; OMX_INT outLoopCnt, inLoopCnt, i, j, yPos, xPos; OMX_INT bufWidth, bufHeight; OMX_INT outWidthY = dstSize.width; OMX_INT outWidthUV = dstSize.width >> 1; OMX_INT outHeightY = dstSize.height; OMX_INT outHeightUV = dstSize.height >> 1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -