#include <stdint.h>
#include <stdlib.h>
#include <oapv/oapv.h>
#include "libavutil/avassert.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/pixfmt.h"
#include "avcodec.h"
#include "apv.h"
#include "codec_internal.h"
#include "encode.h"
#include "packet_internal.h"
#include "profiles.h"
Go to the source code of this file.
|
struct | ApvEncContext |
| The structure stores all the states associated with the instance of APV encoder. More...
|
|
◆ MAX_BS_BUF
#define MAX_BS_BUF (128 * 1024 * 1024) |
◆ MAX_NUM_FRMS
◆ FRM_IDX
◆ MAX_NUM_CC
#define MAX_NUM_CC (OAPV_MAX_CC) |
◆ OFFSET
◆ VE
◆ apv_imgb_release()
static int apv_imgb_release |
( |
oapv_imgb_t * |
imgb | ) |
|
|
static |
◆ apv_imgb_addref()
static int apv_imgb_addref |
( |
oapv_imgb_t * |
imgb | ) |
|
|
static |
◆ apv_imgb_getref()
static int apv_imgb_getref |
( |
oapv_imgb_t * |
imgb | ) |
|
|
static |
◆ get_color_format()
Convert FFmpeg pixel format (AVPixelFormat) into APV pre-defined color format.
- Returns
- APV pre-defined color format (
- See also
- oapv.h) on success, OAPV_CF_UNKNOWN on failure
Definition at line 100 of file liboapvenc.c.
Referenced by apv_imgb_create().
◆ apv_imgb_create()
◆ get_conf()
The function returns a pointer to the object of the oapve_cdesc_t type.
oapve_cdesc_t contains all encoder parameters that should be initialized before the encoder is used.
The field values of the oapve_cdesc_t structure are populated based on:
- the corresponding field values of the AvCodecConetxt structure,
- the apv encoder specific option values,
The order of processing input data and populating the apve_cdsc structure 1) first, the fields of the AVCodecContext structure corresponding to the provided input options are processed, (i.e -pix_fmt yuv422p -s:v 1920x1080 -r 30 -profile:v 0) 2) then apve-specific options added as AVOption to the apv AVCodec implementation (i.e -preset 0)
Keep in mind that, there are options that can be set in different ways. In this case, please follow the above-mentioned order of processing. The most recent assignments overwrite the previous values.
- Parameters
-
[in] | avctx | codec context (AVCodecContext) |
[out] | cdsc | contains all APV encoder encoder parameters that should be initialized before the encoder is use |
- Returns
- 0 on success, negative error code on failure
Definition at line 188 of file liboapvenc.c.
Referenced by liboapve_init().
◆ liboapve_init()
Initialize APV codec Create an encoder instance and allocate all the needed resources.
- Parameters
-
- Returns
- 0 on success, negative error code on failure
Definition at line 271 of file liboapvenc.c.
◆ liboapve_encode()
Encode raw data frame into APV packet.
- Parameters
-
[in] | avctx | codec context |
[out] | avpkt | output AVPacket containing encoded data |
[in] | frame | AVFrame containing the raw data to be encoded |
[out] | got_packet | encoder sets to 0 or 1 to indicate that a non-empty packet was returned in pkt |
- Returns
- 0 on success, negative error code on failure
Definition at line 337 of file liboapvenc.c.
◆ liboapve_close()
Destroy the encoder and release all the allocated resources.
- Parameters
-
- Returns
- 0 on success, negative error code on failure
Definition at line 400 of file liboapvenc.c.
◆ supported_pixel_formats
◆ liboapv_options
Initial value:= {
{
"preset",
"Encoding preset for setting encoding speed (optimization level control)",
OFFSET(preset_id),
AV_OPT_TYPE_INT, { .i64 = OAPV_PRESET_DEFAULT }, OAPV_PRESET_FASTEST, OAPV_PRESET_PLACEBO,
VE, .unit =
"preset" },
{
"qp",
"Quantization parameter value for CQP rate control mode",
OFFSET(qp),
AV_OPT_TYPE_INT, { .i64 = 32 }, 0, 63,
VE },
{
"oapv-params",
"Override the apv configuration using a :-separated list of key=value parameters",
OFFSET(oapv_params),
AV_OPT_TYPE_DICT, { 0 }, 0, 0,
VE },
}
Definition at line 437 of file liboapvenc.c.
◆ liboapve_class
Initial value:= {
.class_name = "liboapv",
}
Definition at line 451 of file liboapvenc.c.
◆ liboapve_defaults
◆ ff_liboapv_encoder
Initial value:= {
.p.name = "liboapv",
.p.wrapper_name = "liboapv",
}
Definition at line 463 of file liboapvenc.c.
static const AVOption liboapv_options[]
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
The structure stores all the states associated with the instance of APV encoder.
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
static const AVClass liboapve_class
const AVProfile ff_apv_profiles[]
#define FF_CODEC_ENCODE_CB(func)
static const FFCodecDefault liboapve_defaults[]
#define AV_CODEC_CAP_OTHER_THREADS
Codec supports multithreading through a method other than slice- or frame-level multithreading.
static av_cold int liboapve_init(AVCodecContext *avctx)
Initialize APV codec Create an encoder instance and allocate all the needed resources.
#define LIBAVUTIL_VERSION_INT
@ AV_OPT_TYPE_DICT
Underlying C type is AVDictionary*.
const char * av_default_item_name(void *ptr)
Return the context name.
static av_cold int liboapve_close(AVCodecContext *avctx)
Destroy the encoder and release all the allocated resources.
#define AV_PIX_FMT_YUV422P10
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static enum AVPixelFormat supported_pixel_formats[]
static int liboapve_encode(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet)
Encode raw data frame into APV packet.
@ AV_OPT_TYPE_INT
Underlying C type is int.
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.