gstvaapiutils_core.c \
gstvaapiutils_h264.c \
gstvaapiutils_h265.c \
+ gstvaapiutils_h26x.c \
gstvaapiutils_mpeg2.c \
gstvaapivalue.c \
gstvaapivideopool.c \
gstvaapiutils_core.h \
gstvaapiutils_h264_priv.h \
gstvaapiutils_h265_priv.h \
+ gstvaapiutils_h26x_priv.h \
gstvaapiutils_mpeg2_priv.h \
gstvaapivideopool_priv.h \
gstvaapiwindow_priv.h \
#include "gstvaapiencoder_h264.h"
#include "gstvaapiutils_h264.h"
#include "gstvaapiutils_h264_priv.h"
+#include "gstvaapiutils_h26x_priv.h"
#include "gstvaapicodedbufferproxy_priv.h"
#include "gstvaapisurface.h"
/* Define the maximum value for view-id */
#define MAX_VIEW_ID 1023
-/* Define the maximum IDR period */
-#define MAX_IDR_PERIOD 512
-
-/* Default CPB length (in milliseconds) */
-#define DEFAULT_CPB_LENGTH 1500
-
-/* Scale factor for CPB size (HRD cpb_size_scale: min = 4) */
-#define SX_CPB_SIZE 4
-
-/* Scale factor for bitrate (HRD bit_rate_scale: min = 6) */
-#define SX_BITRATE 6
-
-/* Define default rate control mode ("constant-qp") */
-#define DEFAULT_RATECONTROL GST_VAAPI_RATECONTROL_CQP
-
/* Supported set of VA rate controls, within this implementation */
#define SUPPORTED_RATECONTROLS \
(GST_VAAPI_RATECONTROL_MASK (CQP) | \
return f;
}
-/* ------------------------------------------------------------------------- */
-/* --- H.264 Bitstream Writer --- */
-/* ------------------------------------------------------------------------- */
-
-#define WRITE_UINT32(bs, val, nbits) do { \
- if (!gst_bit_writer_put_bits_uint32 (bs, val, nbits)) { \
- GST_WARNING ("failed to write uint32, nbits: %d", nbits); \
- goto bs_error; \
- } \
- } while (0)
-
-#define WRITE_UE(bs, val) do { \
- if (!bs_write_ue (bs, val)) { \
- GST_WARNING ("failed to write ue(v)"); \
- goto bs_error; \
- } \
- } while (0)
-
-#define WRITE_SE(bs, val) do { \
- if (!bs_write_se (bs, val)) { \
- GST_WARNING ("failed to write se(v)"); \
- goto bs_error; \
- } \
- } while (0)
-
-/* Write an unsigned integer Exp-Golomb-coded syntax element. i.e. ue(v) */
-static gboolean
-bs_write_ue (GstBitWriter * bs, guint32 value)
-{
- guint32 size_in_bits = 0;
- guint32 tmp_value = ++value;
-
- while (tmp_value) {
- ++size_in_bits;
- tmp_value >>= 1;
- }
- if (size_in_bits > 1
- && !gst_bit_writer_put_bits_uint32 (bs, 0, size_in_bits - 1))
- return FALSE;
- if (!gst_bit_writer_put_bits_uint32 (bs, value, size_in_bits))
- return FALSE;
- return TRUE;
-}
-
-/* Write a signed integer Exp-Golomb-coded syntax element. i.e. se(v) */
-static gboolean
-bs_write_se (GstBitWriter * bs, gint32 value)
-{
- guint32 new_val;
-
- if (value <= 0)
- new_val = -(value << 1);
- else
- new_val = (value << 1) - 1;
-
- if (!bs_write_ue (bs, new_val))
- return FALSE;
- return TRUE;
-}
-
/* Write the NAL unit header */
static gboolean
bs_write_nal_header (GstBitWriter * bs, guint32 nal_ref_idc,
#include "gstvaapiencoder_h265.h"
#include "gstvaapiutils_h265.h"
#include "gstvaapiutils_h265_priv.h"
+#include "gstvaapiutils_h26x_priv.h"
#include "gstvaapicodedbufferproxy_priv.h"
#include "gstvaapisurface.h"
#define DEBUG 1
#include "gstvaapidebug.h"
-/* Define the maximum IDR period */
-#define MAX_IDR_PERIOD 512
-
-/* Default CPB length (in milliseconds) */
-#define DEFAULT_CPB_LENGTH 1500
-
-/* Scale factor for bitrate (HRD bit_rate_scale: min = 6) */
-#define SX_BITRATE 6
-
-/* Scale factor for CPB size (HRD cpb_size_scale: min = 4) */
-#define SX_CPB_SIZE 4
-
-/* Define default rate control mode ("constant-qp") */
-#define DEFAULT_RATECONTROL GST_VAAPI_RATECONTROL_CQP
-
/* Supported set of VA rate controls, within this implementation */
#define SUPPORTED_RATECONTROLS \
(GST_VAAPI_RATECONTROL_MASK (CQP)) | \
return ret;
}
-/* ------------------------------------------------------------------------- */
-/* --- H.265 Bitstream Writer --- */
-/* ------------------------------------------------------------------------- */
-
-#define WRITE_UINT32(bs, val, nbits) do { \
- if (!gst_bit_writer_put_bits_uint32 (bs, val, nbits)) { \
- GST_WARNING ("failed to write uint32, nbits: %d", nbits); \
- goto bs_error; \
- } \
- } while (0)
-
-#define WRITE_UE(bs, val) do { \
- if (!bs_write_ue (bs, val)) { \
- GST_WARNING ("failed to write ue(v)"); \
- goto bs_error; \
- } \
- } while (0)
-
-#define WRITE_SE(bs, val) do { \
- if (!bs_write_se (bs, val)) { \
- GST_WARNING ("failed to write se(v)"); \
- goto bs_error; \
- } \
- } while (0)
-
-/* Write an unsigned integer Exp-Golomb-coded syntax element. i.e. ue(v) */
-static gboolean
-bs_write_ue (GstBitWriter * bs, guint32 value)
-{
- guint32 size_in_bits = 0;
- guint32 tmp_value = ++value;
-
- while (tmp_value) {
- ++size_in_bits;
- tmp_value >>= 1;
- }
- if (size_in_bits > 1
- && !gst_bit_writer_put_bits_uint32 (bs, 0, size_in_bits - 1))
- return FALSE;
- if (!gst_bit_writer_put_bits_uint32 (bs, value, size_in_bits))
- return FALSE;
- return TRUE;
-}
-
-/* Write a signed integer Exp-Golomb-coded syntax element. i.e. se(v) */
-static gboolean
-bs_write_se (GstBitWriter * bs, gint32 value)
-{
- guint32 new_val;
-
- if (value <= 0)
- new_val = -(value << 1);
- else
- new_val = (value << 1) - 1;
-
- if (!bs_write_ue (bs, new_val))
- return FALSE;
- return TRUE;
-}
-
/* Write the NAL unit header */
static gboolean
bs_write_nal_header (GstBitWriter * bs, guint32 nal_unit_type)
--- /dev/null
+/*
+ * gstvaapiutils_h26x.c - H.26x related utilities
+ *
+ * Copyright (C) 2011-2014 Intel Corporation
+ * Author: Gwenole Beauchesne
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#include "gstvaapiutils_h26x_priv.h"
+
+/* Write an unsigned integer Exp-Golomb-coded syntax element. i.e. ue(v) */
+gboolean
+bs_write_ue (GstBitWriter * bs, guint32 value)
+{
+ guint32 size_in_bits = 0;
+ guint32 tmp_value = ++value;
+
+ while (tmp_value) {
+ ++size_in_bits;
+ tmp_value >>= 1;
+ }
+ if (size_in_bits > 1
+ && !gst_bit_writer_put_bits_uint32 (bs, 0, size_in_bits - 1))
+ return FALSE;
+ if (!gst_bit_writer_put_bits_uint32 (bs, value, size_in_bits))
+ return FALSE;
+ return TRUE;
+}
+
+/* Write a signed integer Exp-Golomb-coded syntax element. i.e. se(v) */
+gboolean
+bs_write_se (GstBitWriter * bs, gint32 value)
+{
+ guint32 new_val;
+
+ if (value <= 0)
+ new_val = -(value << 1);
+ else
+ new_val = (value << 1) - 1;
+
+ if (!bs_write_ue (bs, new_val))
+ return FALSE;
+ return TRUE;
+}
--- /dev/null
+/*
+ * gstvaapiutils_h26x_priv.h - H.26x related utilities
+ *
+ * Copyright (C) 2011-2014 Intel Corporation
+ * Author: Gwenole Beauchesne
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifndef GST_VAAPI_UTILS_H26X_PRIV_H
+#define GST_VAAPI_UTILS_H26X_PRIV_H
+
+#include <gst/base/gstbitwriter.h>
+
+G_BEGIN_DECLS
+
+/* Define the maximum IDR period */
+#define MAX_IDR_PERIOD 512
+
+/* Default CPB length (in milliseconds) */
+#define DEFAULT_CPB_LENGTH 1500
+
+/* Scale factor for CPB size (HRD cpb_size_scale: min = 4) */
+#define SX_CPB_SIZE 4
+
+/* Scale factor for bitrate (HRD bit_rate_scale: min = 6) */
+#define SX_BITRATE 6
+
+/* Define default rate control mode ("constant-qp") */
+#define DEFAULT_RATECONTROL GST_VAAPI_RATECONTROL_CQP
+
+/* ------------------------------------------------------------------------- */
+/* --- H.264/265 Bitstream Writer --- */
+/* ------------------------------------------------------------------------- */
+
+#define WRITE_UINT32(bs, val, nbits) \
+ G_STMT_START { \
+ if (!gst_bit_writer_put_bits_uint32 (bs, val, nbits)) { \
+ GST_WARNING ("failed to write uint32, nbits: %d", nbits); \
+ goto bs_error; \
+ } \
+ } G_STMT_END
+
+#define WRITE_UE(bs, val) \
+ G_STMT_START { \
+ if (!bs_write_ue (bs, val)) { \
+ GST_WARNING ("failed to write ue(v)"); \
+ goto bs_error; \
+ } \
+ } G_STMT_END
+
+#define WRITE_SE(bs, val) \
+ G_STMT_START { \
+ if (!bs_write_se (bs, val)) { \
+ GST_WARNING ("failed to write se(v)"); \
+ goto bs_error; \
+ } \
+ } G_STMT_END
+
+
+gboolean
+bs_write_ue (GstBitWriter * bs, guint32 value);
+
+gboolean
+bs_write_se (GstBitWriter * bs, gint32 value);
+
+G_END_DECLS
+
+#endif /* GST_VAAPI_UTILS_H26X_PRIV_H */
'gstvaapiutils_core.c',
'gstvaapiutils_h264.c',
'gstvaapiutils_h265.c',
+ 'gstvaapiutils_h26x.c',
'gstvaapiutils_mpeg2.c',
'gstvaapivalue.c',
'gstvaapivideopool.c',