1 // Copyright (c) 2017-2020 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 #ifndef __MFX_EXT_BUFFERS_H__
22 #define __MFX_EXT_BUFFERS_H__
23 
24 #include "mfxcommon.h"
25 #include "mfx_config.h"
26 #include "vm_strings.h"
27 
28 #if (MFX_VERSION < 1025)
29 enum {
30     MFX_MEMTYPE_VIDEO_MEMORY_ENCODER_TARGET = MFX_MEMTYPE_RESERVED2
31 };
32 #endif
33 
34 
35 #define MFX_EXTBUFF_DEC_ADAPTIVE_PLAYBACK MFX_MAKEFOURCC('A','P','B','K')
36 
37 #define MFX_EXTBUFF_DDI MFX_MAKEFOURCC('D','D','I','P')
38 
39 typedef struct {
40     mfxExtBuffer Header;
41 
42     // parameters below doesn't exist in MediaSDK public API
43     mfxU16  IntraPredCostType;      // from DDI: 1=SAD, 2=SSD, 4=SATD_HADAMARD, 8=SATD_HARR
44     mfxU16  MEInterpolationMethod;  // from DDI: 1=VME4TAP, 2=BILINEAR, 4=WMV4TAP, 8=AVC6TAP
45     mfxU16  MEFractionalSearchType; // from DDI: 1=FULL, 2=HALF, 4=SQUARE, 8=HQ, 16=DIAMOND
46     mfxU16  MaxMVs;
47     mfxU16  SkipCheck;              // tri-state: 0, MFX_CODINGOPTION_OFF, MFX_CODINGOPTION_ON
48     mfxU16  DirectCheck;            // tri-state: 0, MFX_CODINGOPTION_OFF, MFX_CODINGOPTION_ON
49     mfxU16  BiDirSearch;            // tri-state: 0, MFX_CODINGOPTION_OFF, MFX_CODINGOPTION_ON
50     mfxU16  MBAFF;                  // tri-state: 0, MFX_CODINGOPTION_OFF, MFX_CODINGOPTION_ON
51     mfxU16  FieldPrediction;        // tri-state: 0, MFX_CODINGOPTION_OFF, MFX_CODINGOPTION_ON
52     mfxU16  RefOppositeField;       // tri-state: 0, MFX_CODINGOPTION_OFF, MFX_CODINGOPTION_ON
53     mfxU16  ChromaInME;             // tri-state: 0, MFX_CODINGOPTION_OFF, MFX_CODINGOPTION_ON
54     mfxU16  WeightedPrediction;     // tri-state: 0, MFX_CODINGOPTION_OFF, MFX_CODINGOPTION_ON
55     mfxU16  MVPrediction;           // tri-state: 0, MFX_CODINGOPTION_OFF, MFX_CODINGOPTION_ON
56 
57     struct {
58         mfxU16 IntraPredBlockSize;  // mask of 1=4x4, 2=8x8, 4=16x16, 8=PCM
59         mfxU16 InterPredBlockSize;  // mask of 1=16x16, 2=16x8, 4=8x16, 8=8x8, 16=8x4, 32=4x8, 64=4x4
60     } DDI;
61 
62     // MediaSDK parametrization
63     mfxU16  BRCPrecision;   // 0=default=normal, 1=lowest, 2=normal, 3=highest
64     mfxU16  RefRaw;         // (tri-state: 0, MFX_CODINGOPTION_OFF, MFX_CODINGOPTION_ON) on=vme reference on raw(input) frames, off=reconstructed frames
65     mfxU16  reserved0;
66     mfxU16  ConstQP;        // disable bit-rate control and use constant QP
67     mfxU16  GlobalSearch;   // 0=default, 1=long, 2=medium, 3=short
68     mfxU16  LocalSearch;    // 0=default, 1=type, 2=small, 3=square, 4=diamond, 5=large diamond, 6=exhaustive, 7=heavy horizontal, 8=heavy vertical
69 
70     mfxU16 EarlySkip;       // 0=default (let driver choose), 1=enabled, 2=disabled
71     mfxU16 LaScaleFactor;   // 0=default (let msdk choose), 1=1x, 2=2x, 4=4x; Deprecated for legacy H264 encoder, for legacy use mfxExtCodingOption2::LookAheadDS instead
72     mfxU16 reserved1;       //
73     mfxU16 reserved2;       //
74     mfxU16 StrengthN;       // strength=StrengthN/100.0
75     mfxU16 FractionalQP;    // 0=disabled (default), 1=enabled
76 
77     mfxU16 NumActiveRefP;   //
78     mfxU16 NumActiveRefBL0; //
79 
80     mfxU16 DisablePSubMBPartition;  // tri-state, default depends on Profile and Level
81     mfxU16 DisableBSubMBPartition;  // tri-state, default depends on Profile and Level
82     mfxU16 WeightedBiPredIdc;       // 0 - off, 1 - explicit (unsupported), 2 - implicit
83     mfxU16 DirectSpatialMvPredFlag; // (tri-state: 0, MFX_CODINGOPTION_OFF, MFX_CODINGOPTION_ON)on=spatial on, off=temporal on
84     mfxU16 Transform8x8Mode;        // tri-state: 0, MFX_CODINGOPTION_OFF, MFX_CODINGOPTION_ON
85     mfxU16 reserved3;       // 0..255
86     mfxU16 LongStartCodes;          // tri-state, use long start-codes for all NALU
87     mfxU16 CabacInitIdcPlus1;       // 0 - use default value, 1 - cabac_init_idc = 0 and so on
88     mfxU16 NumActiveRefBL1;         //
89     mfxU16 QpUpdateRange;           //
90     mfxU16 RegressionWindow;        //
91     mfxU16 LookAheadDependency;     // LookAheadDependency < LookAhead
92     mfxU16 Hme;                     // tri-state
93     mfxU16 reserved4;               //
94     mfxU16 WriteIVFHeaders;         // tri-state
95     mfxU16 RefreshFrameContext;
96     mfxU16 ChangeFrameContextIdxForTS;
97     mfxU16 SuperFrameForTS;
98     mfxU16 QpAdjust;                // on/off - forces sps.QpAdjustment
99 
100 } mfxExtCodingOptionDDI;
101 
102 
103 
104 
105 
106 
107 
108 #endif // __MFX_EXT_BUFFERS_H__
109