libs: encoder: h265: Add num-tile-cols/rows properties.

These properties are used for support of tile encoding. We just
support uniform mode of tile encoding, that is, separating picture
equally by (num-tile-cols X num-tile-rows).
According to HEVC spec A1, the max number of tiles in column is 20
and in rows is 22, so add two constant definitions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/294>
This commit is contained in:
He Junyan 2020-03-05 17:07:28 +08:00
parent bc1c97c755
commit 812c9fdea7
2 changed files with 57 additions and 0 deletions

View file

@ -117,6 +117,8 @@ struct _GstVaapiEncoderH265
GstClockTime cts_offset;
gboolean config_changed;
gboolean low_delay_b;
guint32 num_tile_cols;
guint32 num_tile_rows;
/* maximum required size of the decoded picture buffer */
guint32 max_dec_pic_buffering;
@ -2893,6 +2895,8 @@ enum
ENCODER_H265_PROP_LOW_DELAY_B,
ENCODER_H265_PROP_MAX_QP,
ENCODER_H265_PROP_QUALITY_FACTOR,
ENCODER_H265_PROP_NUM_TILE_COLS,
ENCODER_H265_PROP_NUM_TILE_ROWS,
ENCODER_H265_N_PROPERTIES
};
@ -2955,6 +2959,12 @@ gst_vaapi_encoder_h265_set_property (GObject * object, guint prop_id,
case ENCODER_H265_PROP_QUALITY_FACTOR:
encoder->quality_factor = g_value_get_uint (value);
break;
case ENCODER_H265_PROP_NUM_TILE_COLS:
encoder->num_tile_cols = g_value_get_uint (value);
break;
case ENCODER_H265_PROP_NUM_TILE_ROWS:
encoder->num_tile_rows = g_value_get_uint (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@ -3010,6 +3020,12 @@ gst_vaapi_encoder_h265_get_property (GObject * object, guint prop_id,
case ENCODER_H265_PROP_QUALITY_FACTOR:
g_value_set_uint (value, encoder->quality_factor);
break;
case ENCODER_H265_PROP_NUM_TILE_COLS:
g_value_set_uint (value, encoder->num_tile_cols);
break;
case ENCODER_H265_PROP_NUM_TILE_ROWS:
g_value_set_uint (value, encoder->num_tile_rows);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@ -3216,6 +3232,32 @@ gst_vaapi_encoder_h265_class_init (GstVaapiEncoderH265Class * klass)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT |
GST_VAAPI_PARAM_ENCODER_EXPOSURE);
/**
* GstVaapiEncoderH265:num-tile-cols:
*
* The number of tile columns when tile encoding is enabled.
*/
properties[ENCODER_H265_PROP_NUM_TILE_COLS] =
g_param_spec_uint ("num-tile-cols",
"number of tile columns",
"the number of columns for tile encoding", 1,
GST_VAAPI_H265_MAX_COL_TILES, 1,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT |
GST_VAAPI_PARAM_ENCODER_EXPOSURE);
/**
* GstVaapiEncoderH265:num-tile-rows:
*
* The number of tile rows when tile encoding is enabled.
*/
properties[ENCODER_H265_PROP_NUM_TILE_ROWS] =
g_param_spec_uint ("num-tile-rows",
"number of tile rows",
"the number of rows for tile encoding", 1,
GST_VAAPI_H265_MAX_ROW_TILES, 1,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT |
GST_VAAPI_PARAM_ENCODER_EXPOSURE);
g_object_class_install_properties (object_class, ENCODER_H265_N_PROPERTIES,
properties);

View file

@ -27,6 +27,21 @@
G_BEGIN_DECLS
/**
* GST_VAAPI_H265_MAX_COL_TILES:
*
* The max tiles in column according to spec A1
*
*/
#define GST_VAAPI_H265_MAX_COL_TILES 20
/**
* GST_VAAPI_H265_MAX_ROW_TILES:
*
* The max tiles in row according to spec A1
*
*/
#define GST_VAAPI_H265_MAX_ROW_TILES 22
/**
* GstVaapiLevelH265:
* @GST_VAAPI_LEVEL_H265_L1: H.265 level 1.