1 /*
2  *  gstvaapiencoder_h264_fei.h - H.264 FEI encoder
3  *
4  *  Copyright (C) 2016-2017 Intel Corporation
5  *    Author: Yi A Wang <yi.a.wang@intel.com>
6  *    Author: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
7  *
8  *  This library is free software; you can redistribute it and/or
9  *  modify it under the terms of the GNU Lesser General Public License
10  *  as published by the Free Software Foundation; either version 2.1
11  *  of the License, or (at your option) any later version.
12  *
13  *  This library is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  *  Lesser General Public License for more details.
17  *
18  *  You should have received a copy of the GNU Lesser General Public
19  *  License along with this library; if not, write to the Free
20  *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  *  Boston, MA 02110-1301 USA
22  */
23 
24 #ifndef GST_VAAPI_ENCODER_H264_FEI_H
25 #define GST_VAAPI_ENCODER_H264_FEI_H
26 
27 #include <gst/vaapi/gstvaapiencoder.h>
28 #include <gst/vaapi/gstvaapiutils_h264.h>
29 #include <gst/vaapi/gstvaapifeiutils_h264.h>
30 
31 G_BEGIN_DECLS
32 
33 #define GST_VAAPI_ENCODER_H264_FEI(encoder) \
34   ((GstVaapiEncoderH264Fei *) (encoder))
35 
36 typedef struct _GstVaapiEncoderH264Fei GstVaapiEncoderH264Fei;
37 
38 /**
39  * GstVaapiEncoderH264FeiProp:
40  * @GST_VAAPI_ENCODER_H264_FEI_PROP_MAX_BFRAMES: Number of B-frames between I
41  *   and P (uint).
42  * @GST_VAAPI_ENCODER_H264_FEI_PROP_INIT_QP: Initial quantizer value (uint).
43  * @GST_VAAPI_ENCODER_H264_FEI_PROP_MIN_QP: Minimal quantizer value (uint).
44  * @GST_VAAPI_ENCODER_H264_FEI_PROP_NUM_SLICES: Number of slices per frame (uint).
45  * @GST_VAAPI_ENCODER_H264_FEI_PROP_CABAC: Enable CABAC entropy coding mode (bool).
46  * @GST_VAAPI_ENCODER_H264_FEI_PROP_DCT8X8: Enable adaptive use of 8x8
47  *   transforms in I-frames (bool).
48  * @GST_VAAPI_ENCODER_H264_FEI_PROP_CPB_LENGTH: Length of the CPB buffer
49  *   in milliseconds (uint).
50  * @GST_VAAPI_ENCODER_H264_FEI_PROP_NUM_VIEWS: Number of views per frame.
51  * @GST_VAAPI_ENCODER_H264_FEI_PROP_VIEW_IDS: View IDs
52  *
53  * The set of H.264 encoder specific configurable properties.
54  */
55 typedef enum {
56   GST_VAAPI_ENCODER_H264_FEI_PROP_MAX_BFRAMES = -1,
57   GST_VAAPI_ENCODER_H264_FEI_PROP_INIT_QP = -2,
58   GST_VAAPI_ENCODER_H264_FEI_PROP_MIN_QP = -3,
59   GST_VAAPI_ENCODER_H264_FEI_PROP_NUM_SLICES = -4,
60   GST_VAAPI_ENCODER_H264_FEI_PROP_CABAC = -5,
61   GST_VAAPI_ENCODER_H264_FEI_PROP_DCT8X8 = -6,
62   GST_VAAPI_ENCODER_H264_FEI_PROP_CPB_LENGTH = -7,
63   GST_VAAPI_ENCODER_H264_FEI_PROP_NUM_VIEWS = -8,
64   GST_VAAPI_ENCODER_H264_FEI_PROP_VIEW_IDS = -9,
65   GST_VAAPI_ENCODER_H264_PROP_FEI_DISABLE= -11,
66   GST_VAAPI_ENCODER_H264_PROP_NUM_MV_PREDICT_L0 = -12,
67   GST_VAAPI_ENCODER_H264_PROP_NUM_MV_PREDICT_L1 = -13,
68   GST_VAAPI_ENCODER_H264_PROP_SEARCH_WINDOW = -14,
69   GST_VAAPI_ENCODER_H264_PROP_LEN_SP = -15,
70   GST_VAAPI_ENCODER_H264_PROP_SEARCH_PATH = -16,
71   GST_VAAPI_ENCODER_H264_PROP_REF_WIDTH = -17,
72   GST_VAAPI_ENCODER_H264_PROP_REF_HEIGHT = -18,
73   GST_VAAPI_ENCODER_H264_PROP_SUBMB_MASK = -19,
74   GST_VAAPI_ENCODER_H264_PROP_SUBPEL_MODE = -20,
75   GST_VAAPI_ENCODER_H264_PROP_INTRA_PART_MASK = -21,
76   GST_VAAPI_ENCODER_H264_PROP_INTRA_SAD = -22,
77   GST_VAAPI_ENCODER_H264_PROP_INTER_SAD = -23,
78   GST_VAAPI_ENCODER_H264_PROP_ADAPT_SEARCH = -24,
79   GST_VAAPI_ENCODER_H264_PROP_MULTI_PRED_L0 = -25,
80   GST_VAAPI_ENCODER_H264_PROP_MULTI_PRED_L1 = -26,
81   GST_VAAPI_ENCODER_H264_PROP_ENABLE_STATS_OUT = -27,
82   GST_VAAPI_ENCODER_H264_PROP_FEI_MODE = -28
83 
84 } GstVaapiEncoderH264FeiProp;
85 
86 GstVaapiEncoder *
87 gst_vaapi_encoder_h264_fei_new (GstVaapiDisplay * display);
88 
89 GPtrArray *
90 gst_vaapi_encoder_h264_fei_get_default_properties (void);
91 
92 gboolean
93 gst_vaapi_encoder_h264_fei_set_max_profile (GstVaapiEncoderH264Fei * encoder,
94     GstVaapiProfile profile);
95 
96 gboolean
97 gst_vaapi_encoder_h264_fei_get_profile_and_level (GstVaapiEncoderH264Fei * encoder,
98     GstVaapiProfile * out_profile_ptr, GstVaapiLevelH264 * out_level_ptr);
99 
100 gboolean
101 gst_vaapi_encoder_h264_is_fei_stats_out_enabled (GstVaapiEncoderH264Fei * encoder);
102 
103 GstVaapiFeiMode
104 gst_vaapi_encoder_h264_fei_get_function_mode (GstVaapiEncoderH264Fei *encoder);
105 
106 void
107 gst_vaapi_encoder_h264_fei_set_function_mode (GstVaapiEncoderH264Fei * encoder,
108     guint fei_mode);
109 
110 G_END_DECLS
111 
112 #endif /*GST_VAAPI_ENCODER_H264_FEI_H */
113