1 // Copyright (c) 2017 Intel Corporation 2 // 3 // Permission is hereby granted, free of charge, to any person obtaining a copy 4 // of this software and associated documentation files (the "Software"), to deal 5 // in the Software without restriction, including without limitation the rights 6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 // copies of the Software, and to permit persons to whom the Software is 8 // furnished to do so, subject to the following conditions: 9 // 10 // The above copyright notice and this permission notice shall be included in all 11 // copies or substantial portions of the Software. 12 // 13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 // SOFTWARE. 20 21 /* ****************************************************************************** */ 22 23 #include "mfx_common.h" 24 25 #if defined (MFX_ENABLE_VPP) 26 27 #ifndef __MFX_VPP_DEFS_H 28 #define __MFX_VPP_DEFS_H 29 30 #include "mfxvideo++int.h" 31 #include "mfx_ext_buffers.h" 32 33 #define MAX_NUM_VPP_FILTERS (15) 34 #define MAX_NUM_CONNECTIONS (MAX_NUM_VPP_FILTERS-1) 35 36 #define VPP_MAX_REQUIRED_FRAMES_COUNT (7) // == MAX( inputFramesCount, outputFramesCount ) 37 38 // (DN, DTL, ProcAmp, Gamut, TCC, STE) 39 #define MAX_NUM_OF_VPP_CONFIG_FILTERS (6) 40 41 // Max samples number for composition filter 42 #define MAX_NUM_OF_VPP_COMPOSITE_STREAMS (72) 43 #define MAX_STREAMS_PER_TILE (8) 44 45 46 // (DO_NOT_USE, DO_USE) + (MAX_NUM_OF_VPP_CONFIG_FILTERS) 47 #define MAX_NUM_OF_VPP_EXT_PARAM (2 + MAX_NUM_OF_VPP_CONFIG_FILTERS) 48 49 // common utility for vpp filters see spec 50 #define VPP_GET_WIDTH(info, width) \ 51 { \ 52 width = info->CropW; \ 53 if (width == 0 || \ 54 (width > info->Width && info->Width > 0)) \ 55 width = info->Width; \ 56 } 57 58 #define VPP_GET_HEIGHT(info, height) \ 59 { \ 60 height = info->CropH; \ 61 if (height == 0 || \ 62 (height > info->Height && info->Height > 0)) \ 63 height = info->Height; \ 64 } 65 66 #define VPP_GET_REAL_WIDTH(info, width) {width = info->Width;} 67 68 #define VPP_GET_REAL_HEIGHT(info, height){height = info->Height;} 69 70 #define VPP_GET_CROPX(info, cropX){cropX = info->CropX;} 71 72 #define VPP_GET_CROPY(info, cropY){cropY = info->CropY;} 73 74 // macros for processing 75 #define VPP_INIT_SUCCESSFUL { m_errPrtctState.isInited = true; } 76 77 #define VPP_CHECK_MULTIPLE_INIT {if( m_errPrtctState.isInited ) return MFX_ERR_UNDEFINED_BEHAVIOR;} 78 79 #define VPP_CHECK_NOT_INITIALIZED {if( !m_errPrtctState.isInited ) return MFX_ERR_NOT_INITIALIZED;} 80 81 #define VPP_CLEAN { m_errPrtctState.isInited = false; m_errPrtctState.isFirstFrameProcessed = false; } 82 83 #define VPP_RESET { m_errPrtctState.isFirstFrameProcessed = false; } 84 85 // error processing 86 #define VPP_CHECK_STS_CONTINUE(sts1, sts2) { if (sts1 != MFX_ERR_NONE) sts2 = sts1; } 87 88 #define VPP_CHECK_IPP_STS(err) if (err != ippStsNoErr) {return MFX_ERR_UNDEFINED_BEHAVIOR;} 89 90 #define IPP_CHECK_STS(err) if (err != ippStsNoErr) {return err;} 91 92 #define IPP_CHECK_NULL_PTR1(pointer) { if (!(pointer)) return ippStsNullPtrErr; } 93 #define VPP_IGNORE_MFX_STS(P, X) {if ((X) == (P)) {P = MFX_ERR_NONE;}} 94 95 // memory allign 96 #define VPP_ALIGN32(X) (((mfxU32)((X)+31)) & (~ (mfxU32)31)) 97 98 // names of VPP smart filters. internal using only 99 enum { 100 MFX_EXTBUFF_VPP_CSC = MFX_MAKEFOURCC('C','S','C','F'),//COLOR SPACE CONVERSION FILTER 101 MFX_EXTBUFF_VPP_RESIZE = MFX_MAKEFOURCC('R','S','Z','F'), 102 MFX_EXTBUFF_VPP_DI = MFX_MAKEFOURCC('S','D','I','F'),//STANDARD DEINTERLACE FILTER (60i->30p) 103 MFX_EXTBUFF_VPP_DI_30i60p = MFX_MAKEFOURCC('F','D','I','F'),//FULL PTS DEINTERLACE FILTER (60i->60p) 104 MFX_EXTBUFF_VPP_DI_WEAVE = MFX_MAKEFOURCC('F','D','I','W'),//WEAVE DEINTERLACE FILTER (60i->30p) 105 MFX_EXTBUFF_VPP_ITC = MFX_MAKEFOURCC('I','T','C','F'), //INV TELECINE FILTER 106 MFX_EXTBUFF_VPP_FIELD_WEAVING = MFX_MAKEFOURCC('F','I','W','F'), 107 MFX_EXTBUFF_VPP_FIELD_SPLITTING = MFX_MAKEFOURCC('F','I','S','F'), 108 109 MFX_EXTBUFF_VPP_CSC_OUT_RGB4 = MFX_MAKEFOURCC('C','S','R','4'), //COLOR SPACE CONVERSION FILTER 110 MFX_EXTBUFF_VPP_CSC_OUT_A2RGB10 = MFX_MAKEFOURCC('C','S','1','0'), //COLOR SPACE CONVERSION FILTER 111 MFX_EXTBUFF_VPP_RSHIFT_IN = MFX_MAKEFOURCC('R','S','F','I'), 112 MFX_EXTBUFF_VPP_LSHIFT_IN = MFX_MAKEFOURCC('L','S','F','I'), 113 MFX_EXTBUFF_VPP_RSHIFT_OUT = MFX_MAKEFOURCC('R','S','F','O'), 114 MFX_EXTBUFF_VPP_LSHIFT_OUT = MFX_MAKEFOURCC('L','S','F','O'), 115 }; 116 117 typedef enum { 118 MFX_REQUEST_FROM_VPP_CHECK = 0x0001, 119 MFX_REQUEST_FROM_VPP_PROCESS = 0x0002 120 121 } mfxRequestType; 122 123 enum { 124 VPP_IN = 0x00, 125 VPP_OUT = 0x01 126 }; 127 128 typedef enum { 129 PASS_THROUGH_PICSTRUCT_MODE = 0x0001, 130 DYNAMIC_DI_PICSTRUCT_MODE = 0x0004, 131 ERR_PICSTRUCT_MODE = 0x0000 132 133 } PicStructMode; 134 135 typedef enum 136 { 137 // gamut compression 138 GAMUT_COMPRESS_BASE_MODE = 1, 139 GAMUT_COMPRESS_ADVANCED_MODE = 2, 140 141 // RGB2YUV tuning 142 GAMUT_PASSIVE_MODE = 3, 143 144 // gamut expansion 145 // none 146 147 // invalid mode 148 GAMUT_INVALID_MODE = 100 149 150 } mfxGamutMode; 151 152 153 typedef enum 154 { 155 MIRROR_INPUT = 0x0001, 156 MIRROR_OUTPUT = 0x0002, 157 MIRROR_WO_EXEC = 0x0004 158 } MirroringPositions; 159 160 #endif // __MFX_VPP_DEFS_H 161 #endif // MFX_ENABLE_VPP 162 /*EOF*/ 163