1 /* 2 * 3 * Copyright 2010 Rockchip Electronics S.LSI Co. LTD 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /*************************************************************************************************** 19 File: 20 vpu_macro.h 21 Description: 22 Macro definition in VPU module 23 Author: 24 Jian Huan 25 Date: 26 2010-11-23 21:45:57 27 **************************************************************************************************/ 28 #ifndef _VPU_MACRO_ 29 #define _VPU_MACRO_ 30 31 #include "vpu_type.h" 32 33 #define VPU_OK 0 34 #define VPU_ERR 1 35 36 #define VDPU_BASE 0x10104200 37 38 #define VPU_MAX_FRAME_WIDTH 1920 39 #define VPU_MAX_FRAME_HEIGHT 1088 40 41 #define VPU_FRAME_NULL NULL 42 43 #define DEC_X170_REGISTERS 60 44 45 #define DEC_X170_LITTLE_ENDIAN 1 46 #define DEC_X170_BIG_ENDIAN 0 47 48 #define DEC_X170_BUS_BURST_LENGTH_UNDEFINED 0 49 #define DEC_X170_BUS_BURST_LENGTH_4 4 50 #define DEC_X170_BUS_BURST_LENGTH_8 8 51 #define DEC_X170_BUS_BURST_LENGTH_16 16 52 53 #define VPU_CODEC_DEC_H264 0 54 #define VPU_CODEC_DEC_MPEG4 1 55 #define VPU_CODEC_DEC_H263 2 56 #define VPU_CODEC_DEC_JPEG 3 57 #define VPU_CODEC_DEC_VC1 4 58 #define VPU_CODEC_DEC_MPEG2 5 59 #define VPU_CODEC_DEC_MPEG1 6 60 #define VPU_CODEC_DEC_VP6 7 61 #define VPU_CODEC_DEC_VP7 9 62 #define VPU_CODEC_DEC_VP8 10 63 #define VPU_CODEC_DEC_AVS 11 64 #define VPU_CODEC_DEC_SVC 12 65 #define VPU_CODEC_DEC_VC2 13 66 #define VPU_CODEC_DEC_MVC 14 67 #define VPU_CODEC_DEC_THEORA 15 68 #define VPU_CODEC_ENC_JPEG 16 69 #define VPU_CODEC_ENC_H264 17 70 #define VPU_CODEC_DEC_MJPEG 18 71 72 #define VPU_OUTPUT_FRAME_TYPE 0 73 #define VPU_OUTPUT_TOP_FIELD_FIRST_TYPE 1 74 #define VPU_OUTPUT_BOT_FIELD_FIRST_TYPE 2 75 76 /* 77 * bit definition of ColorType in structure VPU_FRAME 78 */ 79 #define VPU_OUTPUT_FORMAT_TYPE_MASK (0x0000ffff) 80 #define VPU_OUTPUT_FORMAT_ARGB8888 (0x00000000) 81 #define VPU_OUTPUT_FORMAT_ABGR8888 (0x00000001) 82 #define VPU_OUTPUT_FORMAT_RGB888 (0x00000002) 83 #define VPU_OUTPUT_FORMAT_RGB565 (0x00000003) 84 #define VPU_OUTPUT_FORMAT_RGB555 (0x00000004) 85 #define VPU_OUTPUT_FORMAT_YUV420_SEMIPLANAR (0x00000005) 86 #define VPU_OUTPUT_FORMAT_YUV420_PLANAR (0x00000006) 87 #define VPU_OUTPUT_FORMAT_YUV422 (0x00000007) 88 #define VPU_OUTPUT_FORMAT_YUV444 (0x00000008) 89 #define VPU_OUTPUT_FORMAT_YCH420 (0x00000009) 90 #define VPU_OUTPUT_FORMAT_BIT_MASK (0x000f0000) 91 #define VPU_OUTPUT_FORMAT_BIT_8 (0x00000000) 92 #define VPU_OUTPUT_FORMAT_BIT_10 (0x00010000) 93 #define VPU_OUTPUT_FORMAT_BIT_12 (0x00020000) 94 #define VPU_OUTPUT_FORMAT_BIT_14 (0x00030000) 95 #define VPU_OUTPUT_FORMAT_BIT_16 (0x00040000) 96 97 #define VPU_PP_INPUT_FORMAT_YUV420_SEMIPLANAR 0 98 #define VPU_PP_INPUT_FORMAT_YUV420_PLANAR 1 99 #define VPU_PP_INPUT_FORMAT_YUV420_INTERLACE 2 100 #define VPU_PP_INPUT_FORMAT_YUV422 3 101 102 #define VPU_PP_OUTPUT_FORMAT_ARGB8888 VPU_OUTPUT_FORMAT_ARGB8888 103 #define VPU_PP_OUTPUT_FORMAT_ABGR8888 VPU_OUTPUT_FORMAT_ABGR8888 104 #define VPU_PP_OUTPUT_FORMAT_RGB888 VPU_OUTPUT_FORMAT_RGB888 105 #define VPU_PP_OUTPUT_FORMAT_RGB565 VPU_OUTPUT_FORMAT_RGB565 106 #define VPU_PP_OUTPUT_FORMAT_RGB555 VPU_OUTPUT_FORMAT_RGB555 107 #define VPU_PP_OUTPUT_FORMAT_YUV420_SEMIPLANAR VPU_OUTPUT_FORMAT_YUV420_SEMIPLANAR 108 #define VPU_PP_OUTPUT_FORMAT_YUV420_PLANAR VPU_OUTPUT_FORMAT_YUV420_PLANAR 109 #define VPU_PP_OUTPUT_FORMAT_YUV422 VPU_OUTPUT_FORMAT_YUV422 110 #define VPU_PP_OUTPUT_FORMAT_YUV444 VPU_OUTPUT_FORMAT_YUV444 111 #define VPU_PP_OUTPUT_FORMAT_YCH420 VPU_OUTPUT_FORMAT_YCH420 112 113 #define VPU_PP_SCALE_DISABLE 0 114 #define VPU_PP_SCALE_ENABLE 1 115 116 #define VPU_PP_ROTATE_DISABLE 0 117 #define VPU_PP_ROTATE_ENABLE 1 118 119 #define VPU_PP_DITHER_DISABLE 0 120 #define VPU_PP_DITHER_ENABLE 1 121 122 #define VPU_PP_DEBLK_DISABLE 0 123 #define VPU_PP_DEBLK_ENABLE 1 124 125 #define VPU_PP_DEINTERLACE_DISABLE 0 126 #define VPU_PP_DEINTERLACE_ENABLE 1 127 128 #define VPU_BITSTREAM_START_CODE (0x524b5642) /* RKVB, rockchip video bitstream */ 129 130 #define SWAP(_T_, A, B) { _T_ tmp = A; A = B; B = tmp; } 131 #ifndef MIN 132 #define MIN(X, Y) ((X)<(Y)?(X):(Y)) 133 #endif 134 #ifndef MAX 135 #define MAX(X, Y) ((X)>(Y)?(X):(Y)) 136 #endif 137 #ifndef ABS 138 #define ABS(X) (((X) < 0) ? (-(X)) : (X)) 139 #endif 140 #define SIGN(X) (((X)>0)?1:-1) 141 #define BSWAP(a) \ 142 ((((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ 143 (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) 144 #define CLIP(X, AMIN, AMAX) (((X) < (AMIN)) ? (AMIN) : ((X) > (AMAX)) ? (AMAX) : (X)) 145 146 #ifdef _VPU_TRACE_ENABLE 147 #define LOG_TAG "VPU_TRACE" 148 #include <utils/Log.h> 149 #ifdef AVS40 150 #undef ALOGV 151 #define ALOGV LOGV 152 153 #undef ALOGD 154 #define ALOGD LOGD 155 156 #undef ALOGI 157 #define ALOGI LOGI 158 159 #undef ALOGW 160 #define ALOGW LOGW 161 162 #undef ALOGE 163 #define ALOGE LOGE 164 165 #endif 166 #define VPU_TRACE(fmt, args...) ALOGD(__FILE__ " : %d: " fmt, __LINE__, ## args) 167 #define VPU_T(fmt, args...) 168 #else 169 #define VPU_TRACE(fmt, args...) 170 #define VPU_T(fmt, args...) ALOGD(__FILE__ " : %d: " fmt, __LINE__, ## args) 171 #endif 172 173 174 #endif /* _VPU_MACRO_ */ 175