1 /*
2  *  gstvaapifeienc_h264.h - FEI Enc abstract
3  *
4  *  Copyright (C) 2016-2018 Intel Corporation
5  *    Author: Leilei Shang <leilei.shang@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_FEI_H264_ENC_H
25 #define GST_VAAPI_FEI_H264_ENC_H
26 
27 #include <gst/vaapi/gstvaapiencoder.h>
28 #include <gst/vaapi/gstvaapiutils_h264.h>
29 #include <gst/vaapi/gstvaapifeiutils_h264.h>
30 #include <gst/vaapi/gstvaapifei_objects_priv.h>
31 G_BEGIN_DECLS
32 #define GST_VAAPI_FEI_H264_ENC(feienc) \
33   ((GstVaapiFeiEncH264 *) (feienc))
34 typedef struct _GstVaapiFeiEncH264 GstVaapiFeiEncH264;
35 
36 /**
37  * GstVaapiFeiEncH264Prop:
38  * @GST_VAAPI_FEI_H264_ENC_PROP_MAX_BFRAMES: Number of B-frames between I
39  *   and P (uint).
40  * @GST_VAAPI_FEI_H264_ENC_PROP_INIT_QP: Initial quantizer value (uint).
41  * @GST_VAAPI_FEI_H264_ENC_PROP_MIN_QP: Minimal quantizer value (uint).
42  * @GST_VAAPI_FEI_H264_ENC_PROP_NUM_SLICES: Number of slices per frame (uint).
43  * @GST_VAAPI_FEI_H264_ENC_PROP_CABAC: Enable CABAC entropy coding mode (bool).
44  * @GST_VAAPI_FEI_H264_ENC_PROP_DCT8X8: Enable adaptive use of 8x8
45  *   transforms in I-frames (bool).
46  * @GST_VAAPI_FEI_H264_ENC_PROP_CPB_LENGTH: Length of the CPB buffer
47  *   in milliseconds (uint).
48  * @GST_VAAPI_FEI_H264_ENC_PROP_NUM_VIEWS: Number of views per frame.
49  * @GST_VAAPI_FEI_H264_ENC_PROP_VIEW_IDS: View IDs
50  *
51  * The set of FEI Enc specific configurable properties.
52  */
53 typedef enum
54 {
55   GST_VAAPI_FEI_H264_ENC_PROP_MAX_BFRAMES = -1,
56   GST_VAAPI_FEI_H264_ENC_PROP_INIT_QP = -2,
57   GST_VAAPI_FEI_H264_ENC_PROP_MIN_QP = -3,
58   GST_VAAPI_FEI_H264_ENC_PROP_NUM_SLICES = -4,
59   GST_VAAPI_FEI_H264_ENC_PROP_CABAC = -5,
60   GST_VAAPI_FEI_H264_ENC_PROP_DCT8X8 = -6,
61   GST_VAAPI_FEI_H264_ENC_PROP_CPB_LENGTH = -7,
62   GST_VAAPI_FEI_H264_ENC_PROP_NUM_VIEWS = -8,
63   GST_VAAPI_FEI_H264_ENC_PROP_VIEW_IDS = -9,
64   GST_VAAPI_FEI_H264_ENC_PROP_NUM_REF = -10,
65   GST_VAAPI_FEI_H264_ENC_PROP_FEI_ENABLE = -11,
66   GST_VAAPI_FEI_H264_ENC_PROP_NUM_MV_PREDICT_L0 = -12,
67   GST_VAAPI_FEI_H264_ENC_PROP_NUM_MV_PREDICT_L1 = -13,
68   GST_VAAPI_FEI_H264_ENC_PROP_SEARCH_WINDOW = -14,
69   GST_VAAPI_FEI_H264_ENC_PROP_LEN_SP = -15,
70   GST_VAAPI_FEI_H264_ENC_PROP_SEARCH_PATH = -16,
71   GST_VAAPI_FEI_H264_ENC_PROP_REF_WIDTH = -17,
72   GST_VAAPI_FEI_H264_ENC_PROP_REF_HEIGHT = -18,
73   GST_VAAPI_FEI_H264_ENC_PROP_SUBMB_MASK = -19,
74   GST_VAAPI_FEI_H264_ENC_PROP_SUBPEL_MODE = -20,
75   GST_VAAPI_FEI_H264_ENC_PROP_INTRA_PART_MASK = -21,
76   GST_VAAPI_FEI_H264_ENC_PROP_INTRA_SAD = -22,
77   GST_VAAPI_FEI_H264_ENC_PROP_INTER_SAD = -23,
78   GST_VAAPI_FEI_H264_ENC_PROP_ADAPT_SEARCH = -24,
79   GST_VAAPI_FEI_H264_ENC_PROP_MULTI_PRED_L0 = -25,
80   GST_VAAPI_FEI_H264_ENC_PROP_MULTI_PRED_L1 = -26,
81   GST_VAAPI_FEI_H264_ENC_PROP_ENABLE_STATS_OUT = -27,
82 } GstVaapiFeiEncH264Prop;
83 
84 GstVaapiEncoder *
85 gst_vaapi_feienc_h264_new (GstVaapiDisplay * display);
86 
87 GPtrArray *
88 gst_vaapi_feienc_h264_get_default_properties (void);
89 
90 gboolean
91 gst_vaapi_feienc_h264_set_max_profile (GstVaapiFeiEncH264 * feienc,
92     GstVaapiProfile profile);
93 
94 gboolean
95 gst_vaapi_feienc_h264_set_ref_pool (GstVaapiFeiEncH264 * feienc, gpointer ref_pool_ptr);
96 
97 GstVaapiEncoderStatus
98 gst_vaapi_feienc_h264_encode (GstVaapiEncoder * base_encoder,
99     GstVaapiEncPicture * picture, GstVaapiSurfaceProxy * reconstruct,
100     GstVaapiCodedBufferProxy * codedbuf_proxy, GstVaapiFeiInfoToPakH264 *info_to_pak);
101 
102 GstVaapiEncoderStatus
103 gst_vaapi_feienc_h264_flush (GstVaapiEncoder * base_encoder);
104 
105 GstVaapiEncoderStatus
106 gst_vaapi_feienc_h264_reordering (GstVaapiEncoder * base_encoder,
107     GstVideoCodecFrame * frame, GstVaapiEncPicture ** output);
108 
109 GstVaapiEncoderStatus
110 gst_vaapi_feienc_h264_reconfigure (GstVaapiEncoder * base_encoder);
111 
112 GstVaapiEncoderStatus
113 gst_vaapi_feienc_h264_set_property (GstVaapiEncoder * base_encoder,
114     gint prop_id, const GValue * value);
115 
116 gboolean
117 gst_vaapi_feienc_h264_get_profile_and_idc (GstVaapiFeiEncH264 * feienc,
118     GstVaapiProfile * out_profile_ptr, guint8 * out_profile_idc_ptr);
119 
120 G_END_DECLS
121 #endif /*GST_VAAPI_FEI_H264_ENC_H */
122