Commit 7d73307b authored by Wonchul Lee's avatar Wonchul Lee Committed by Olivier Crête
Browse files

av1enc: Add configurations

Added rate control and profile related configuration. The profile
configuration has been copied from vpx.

https://bugzilla.gnome.org/show_bug.cgi?id=791674
parent 498dc9a8
......@@ -3,7 +3,8 @@ plugin_LTLIBRARIES = libgstaom.la
libgstaom_la_SOURCES = \
gstaom.c \
gstav1enc.c \
gstav1dec.c
gstav1dec.c \
gstav1utils.c
libgstaom_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AOM_CFLAGS)
libgstaom_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) -lgstvideo-$(GST_API_VERSION) $(AOM_LIBS)
......@@ -12,4 +13,5 @@ libgstaom_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
noinst_HEADERS = \
gstaom.h \
gstav1dec.h \
gstav1enc.h
gstav1enc.h \
gstav1utils.h
This diff is collapsed.
......@@ -49,6 +49,60 @@ G_BEGIN_DECLS
typedef struct _GstAV1Enc GstAV1Enc;
typedef struct _GstAV1EncClass GstAV1EncClass;
/**
* GstAV1EncResizeMode:
* @GST_AV1_ENC_RESIZE_NONE: No frame resizing allowed
* @GST_AV1_ENC_RESIZE_FIXED: All frames are coded at the specified scale
* @GST_AV1_ENC_RESIZE_RANDOM: All frames are coded at a random scale
*
* Frame resize mode
*/
typedef enum
{
GST_AV1_ENC_RESIZE_NONE = 0,
GST_AV1_ENC_RESIZE_FIXED = 1,
GST_AV1_ENC_RESIZE_RANDOM = 2,
GST_AV1_ENC_RESIZE_MODES
} GstAV1EncResizeMode;
/**
* GstAV1EncSuperresMode
* @GST_AV1_ENC_SUPERRES_NONE: No frame superres allowed
* @GST_AV1_ENC_SUPERRES_FIXED: All frames are coded at the specified scale and
* super-resolved
* @GST_AV1_ENC_SUPERRES_QTHRESH: Superres scale for a frame is determined based
* on q_index
*
* Frame super-resolution mode
*/
typedef enum
{
GST_AV1_ENC_SUPERRES_NONE = 0,
GST_AV1_ENC_SUPERRES_FIXED = 1,
GST_AV1_ENC_SUPERRES_RANDOM = 2,
GST_AV1_ENC_SUPERRES_QTHRESH = 3,
GST_AV1_ENC_SUPERRES_MODES
} GstAV1EncSuperresMode;
/**
* GstAV1EncEndUsageMode
* @GST_AV1_ENC_END_USAGE_VBR: Variable Bit Rate Mode
* @GST_AV1_ENC_END_USAGE_CBR: Constant Bit Rate Mode
* @GST_AV1_ENC_END_USAGE_CQ: Constrained Quality Mode
* @GST_AV1_ENC_END_USAGE_Q: Constant Quality Mode
*
* Rate control algorithm to use
*/
typedef enum
{
GST_AV1_ENC_END_USAGE_VBR = 0,
GST_AV1_ENC_END_USAGE_CBR = 1,
GST_AV1_ENC_END_USAGE_CQ = 2,
GST_AV1_ENC_END_USAGE_Q = 3,
GST_AV1_ENC_END_USAGE_MODES
} GstAV1EncEndUsageMode;
struct _GstAV1Enc
{
GstVideoEncoder base_video_encoder;
......@@ -62,7 +116,10 @@ struct _GstAV1Enc
GstVideoCodecState *input_state;
aom_codec_enc_cfg_t aom_cfg;
aom_codec_ctx_t encoder;
aom_img_fmt_t format;
GMutex encoder_lock;
gboolean target_bitrate_set;
};
struct _GstAV1EncClass
......
/* AV1
* Copyright (C) 2018 Wonchul Lee <chul0812@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gstav1utils.h"
const char *
gst_av1_get_error_name (aom_codec_err_t status)
{
switch (status) {
case AOM_CODEC_OK:
return "OK";
case AOM_CODEC_ERROR:
return "error";
case AOM_CODEC_MEM_ERROR:
return "mem error";
case AOM_CODEC_ABI_MISMATCH:
return "abi mismatch";
case AOM_CODEC_INCAPABLE:
return "incapable";
case AOM_CODEC_UNSUP_BITSTREAM:
return "unsupported bitstream";
case AOM_CODEC_UNSUP_FEATURE:
return "unsupported feature";
case AOM_CODEC_CORRUPT_FRAME:
return "corrupt frame";
case AOM_CODEC_INVALID_PARAM:
return "invalid parameter";
default:
return "unknown";
}
}
/* AV1
* Copyright (C) 2018 Wonchul Lee <chul0812@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <gst/gst.h>
#include <aom/aom_codec.h>
G_BEGIN_DECLS
const char *gst_av1_get_error_name (aom_codec_err_t status);
G_END_DECLS
aom_dep = dependency('aom', required: get_option('aom'))
if aom_dep.found()
gstaom = library('gstaom',
['gstaom.c', 'gstav1enc.c', 'gstav1dec.c'],
['gstaom.c', 'gstav1enc.c', 'gstav1dec.c', 'gstav1utils.c'],
c_args : gst_plugins_bad_args,
include_directories : [configinc],
dependencies : [gstpbutils_dep, gstvideo_dep, aom_dep],
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment