1 /* 2 * Copyright (c) 2020, Intel Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included 12 * in all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 //! 23 //! \file encode_preenc_defs.h 24 //! \brief Defines the common interface for encode preenc basic feature 25 //! 26 #pragma once 27 28 #include "codec_def_common.h" 29 #include "codec_def_common_encode.h" 30 #if _MEDIA_RESERVED 31 #include "encode_preenc_defs_ext.h" 32 #endif // _MEDIA_RESERVED 33 34 #define CODEC_MAX_NUM_REF_FRAME_PREENC 15 35 36 namespace encode 37 { 38 enum MediaEncodeMode 39 { 40 SINGLE_NORMAL_ENC = 0, //000 41 MANUAL_RES_PRE_ENC, //001 42 MANUAL_FULL_ENC, //010 43 SINGLE_PRE_FULL_ENC, //011 44 AUTO_RES_PRE_ENC = 5, //101 45 }; 46 47 enum EncodePreencDef0 48 { 49 SINGLE_PASS_ENC = 0, 50 PRE_ENC_PASS, 51 FULL_ENC_PASS 52 }; 53 54 typedef struct mfxI16PAIR 55 { 56 short x, y; // integer pair 57 } mfxI16PAIR; 58 59 typedef mfxI16PAIR I16PAIR; 60 61 struct EncodePreencDef1 62 { 63 I16PAIR mv; 64 uint16_t intraSAD; 65 uint16_t interSAD; 66 }; 67 68 #undef MAX 69 #define MAX(a, b) (((a) > (b)) ? (a) : (b)) 70 71 struct PreEncInfo 72 { 73 uint8_t EncodePreEncInfo0 = 0; 74 uint32_t EncodePreEncInfo1 = 0; 75 uint8_t EncodePreEncInfo2 = 0; 76 uint8_t EncodePreEncInfo3 = 0; 77 uint32_t preEncSrcWidth = 0; 78 uint32_t preEncSrcHeight = 0; 79 }; 80 81 typedef struct _CODEC_PRE_ENC_PARAMS 82 { 83 bool LowDelayMode; 84 uint8_t BitDepthLumaMinus8; 85 uint8_t BitDepthChromaMinus8; 86 uint8_t CodingType; 87 CODEC_PICTURE CurrReconstructedPic; 88 CODEC_PICTURE RefFrameList[CODEC_MAX_NUM_REF_FRAME_PREENC]; 89 int32_t CurrPicOrderCnt; 90 int32_t RefFramePOCList[CODEC_MAX_NUM_REF_FRAME_PREENC]; 91 CODEC_PICTURE RefPicList[2][CODEC_MAX_NUM_REF_FRAME_PREENC]; 92 bool HierarchicalFlag; 93 uint8_t HierarchLevelPlus1; 94 uint8_t GopRefDist; 95 uint8_t SliceType; 96 CODEC_PICTURE CurrOriginalPic; 97 bool UsedAsRef; 98 ENCODE_INPUT_COLORSPACE InputColorSpace; 99 CODEC_PIC_ID PicIdx[CODEC_MAX_NUM_REF_FRAME_PREENC]; 100 PCODEC_REF_LIST *RefList; 101 bool isPToB; 102 103 } CODEC_PRE_ENC_PARAMS, *PCODEC_PRE_ENC_PARAMS; 104 105 } // namespace encode 106