Home | History | Annotate | Download | only in inc
      1 /*
      2  * Copyright (C) Texas Instruments - http://www.ti.com/
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef NV12_RESIZE_H_
     18 #define NV12_RESIZE_H_
     19 
     20 #include "Common.h"
     21 
     22 typedef unsigned char  mmBool;
     23 typedef unsigned char  mmUchar;
     24 typedef unsigned char  mmUint8;
     25 typedef unsigned char  mmByte;
     26 typedef unsigned short mmUint16;
     27 typedef unsigned int   mmUint32;
     28 typedef unsigned long  mmUint64;
     29 typedef signed char    mmInt8;
     30 typedef char           mmChar;
     31 typedef signed short   mmInt16;
     32 typedef signed int     mmInt32;
     33 typedef signed long    mmLong;
     34 typedef signed int     mmHandle;
     35 typedef float          mmFloat;
     36 typedef double         mmDouble;
     37 typedef int            HObj;
     38 typedef HObj           HFile;
     39 typedef int            HDir;
     40 typedef void*          mmMutexHandle;
     41 typedef struct _fstat {
     42     mmInt32 fileSize;
     43 } VE_FileAttribute;
     44 
     45 typedef struct {
     46     mmInt32 second;
     47     mmInt32 millisecond;
     48 } tsVE_Time;
     49 
     50 typedef struct {
     51     mmInt32 year;
     52     mmInt32 month;
     53     mmInt32 day;
     54     mmInt32 hour;
     55     mmInt32 minute;
     56     mmInt32 second;
     57 } TmDateTime;
     58 
     59 const mmUint8 bWeights[8][8][4] = {
     60   {{64, 0, 0, 0}, {56, 0, 0, 8}, {48, 0, 0,16}, {40, 0, 0,24},
     61    {32, 0, 0,32}, {24, 0, 0,40}, {16, 0, 0,48}, { 8, 0, 0,56}},
     62 
     63   {{56, 8, 0, 0}, {49, 7, 1, 7}, {42, 6, 2,14}, {35, 5, 3,21},
     64    {28, 4, 4,28}, {21, 3, 5,35}, {14, 2, 6,42}, { 7, 1, 7,49}},
     65 
     66   {{48,16, 0, 0}, {42,14, 2, 6}, {36,12,4 ,12}, {30,10,6 ,18},
     67    {24, 8, 8,24}, {18, 6,10,30}, {12,4 ,12,36}, { 6, 2,14,42}},
     68 
     69   {{40,24,0 ,0 }, {35,21, 3, 5}, {30,18, 6,10}, {25,15, 9,15},
     70    {20,12,12,20}, {15, 9,15,25}, {10, 6,18,30}, { 5, 3,21,35}},
     71 
     72   {{32,32, 0,0 }, {28,28, 4, 4}, {24,24, 8, 8}, {20,20,12,12},
     73    {16,16,16,16}, {12,12,20,20}, { 8, 8,24,24}, { 4, 4,28,28}},
     74 
     75   {{24,40,0 ,0 }, {21,35, 5, 3}, {18,30,10, 6}, {15,25,15, 9},
     76    {12,20,20,12}, { 9,15,25,15}, { 6,10,30,18}, { 3, 5,35,21}},
     77 
     78   {{16,48, 0,0 }, {14,42, 6, 2}, {12,36,12, 4}, {10,30,18, 6},
     79    {8 ,24,24,8 }, { 6,18,30,10}, { 4,12,36,12}, { 2, 6,42,14}},
     80 
     81   {{ 8,56, 0,0 }, { 7,49, 7, 1}, { 6,42,14, 2}, { 5,35,21, 3},
     82    { 4,28,28,4 }, { 3,21,35, 5}, { 2,14,42, 6}, { 1,7 ,49, 7}}
     83 };
     84 
     85 typedef enum {
     86     IC_FORMAT_NONE,
     87     IC_FORMAT_RGB565,
     88     IC_FORMAT_RGB888,
     89     IC_FORMAT_YCbCr420_lp,
     90     IC_FORMAT_YCbCr,
     91     IC_FORMAT_YCbCr420_FRAME_PK,
     92     IC_FORMAT_MAX
     93 } enumImageFormat;
     94 
     95 /* This structure defines the format of an image */
     96 typedef struct {
     97     mmInt32                       uWidth;
     98     mmInt32                       uHeight;
     99     mmInt32                       uStride;
    100     enumImageFormat               eFormat;
    101     mmByte                        *imgPtr;
    102     mmByte                        *clrPtr;
    103     mmInt32                       uOffset;
    104 } structConvImage;
    105 
    106 typedef struct IC_crop_struct {
    107     mmUint32 x;             /* x pos of rectangle                              */
    108     mmUint32 y;             /* y pos of rectangle                              */
    109     mmUint32 uWidth;        /* dx of rectangle                                 */
    110     mmUint32 uHeight;       /* dy of rectangle                                 */
    111 } IC_rect_type;
    112 
    113 /*==========================================================================
    114 * Function Name  : VT_resizeFrame_Video_opt2_lp
    115 *
    116 * Description    : Resize a yuv frame.
    117 *
    118 * Input(s)       : input_img_ptr        -> Input Image Structure
    119 *                : output_img_ptr       -> Output Image Structure
    120 *                : cropout             -> crop structure
    121 *
    122 * Value Returned : mmBool               -> FALSE on error TRUE on success
    123 * NOTE:
    124 *            Not tested for crop funtionallity.
    125 *            faster version.
    126 ============================================================================*/
    127 mmBool
    128 VT_resizeFrame_Video_opt2_lp(
    129         structConvImage* i_img_ptr,        /* Points to the input image           */
    130         structConvImage* o_img_ptr,        /* Points to the output image          */
    131         IC_rect_type*  cropout,          /* how much to resize to in final image */
    132         mmUint16 dummy                         /* Transparent pixel value              */
    133         );
    134 
    135 #endif //#define NV12_RESIZE_H_
    136