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_MPEG2_ENC_COMMON_HW_H__
22 #define __MFX_MPEG2_ENC_COMMON_HW_H__
23 
24 #include "mfx_common.h"
25 #include "mfx_ext_buffers.h"
26 
27 #if defined (MFX_ENABLE_MPEG2_VIDEO_ENCODE)
28 
29 #define D3DDDIFORMAT        D3DFORMAT
30 #define DXVADDI_VIDEODESC   DXVA2_VideoDesc
31 
32 #if defined(MFX_VA_LINUX)
33     #include "mfx_h264_encode_struct_vaapi.h"
34 #endif
35 
36 #include "mfxstructures.h"
37 
38 #include <vector>
39 #include <list>
40 
41 
42 
43 
44 
45 #define ENCODE_ENC_CTRL_CAPS ENCODE_ENC_CTRL_CAPS
46 
47 //#define __SW_ENC
48 
49 
50 //#define MPEG2_ENCODE_HW_PERF
51 //#define MPEG2_ENC_HW_PERF
52 //#define MPEG2_ENCODE_DEBUG_HW
53 
54 
55     enum
56     {
57       MFX_MPEG2_TOP_FIELD     = 1,
58       MFX_MPEG2_BOTTOM_FIELD  = 2,
59       MFX_MPEG2_FRAME_PICTURE = 3
60     };
61 
62     struct mfxVideoParamEx_MPEG2
63     {
64         mfxVideoParam           mfxVideoParams;
65         bool                    bFieldCoding;
66         mfxU32                  MVRangeP[2];
67         mfxU32                  MVRangeB[2][2];
68         bool                    bAllowFieldPrediction;
69         bool                    bAllowFieldDCT;
70         bool                    bAddEOS;
71         bool                    bRawFrames;
72         mfxFrameAllocResponse*  pRecFramesResponse_hw;
73         mfxFrameAllocResponse*  pRecFramesResponse_sw;
74 
75         mfxExtVideoSignalInfo   videoSignalInfo;
76         bool                    bAddDisplayExt;
77         bool                    bMbqpMode;
78         bool                    bDisablePanicMode;
79     };
80 
81 namespace MfxHwMpeg2Encode
82 {
83    #define NUM_FRAMES 800
84 
85 
86     struct ExtVASurface
87     {
88         VASurfaceID surface;
89         mfxU32 number;
90         mfxU32 idxBs;
91     };
92 
93     typedef std::vector<ExtVASurface> mfxRecFrames;
94     typedef std::vector<ExtVASurface> mfxRawFrames;
95 
96 
97 
98     typedef std::vector<ExtVASurface> mfxFeedback;
99 
100 
101     mfxStatus QueryHwCaps(VideoCORE* core,
102         ENCODE_CAPS & hwCaps,
103         mfxU16 codecProfile);
104 
105 }; // namespace MfxHwMpeg2Encode
106 
107 #endif
108 #endif
109 /* EOF */
110