36 #define END_OF_STREAM 0x001 38 #define XAVS_PART_I8X8 0x002 39 #define XAVS_PART_P8X8 0x010 40 #define XAVS_PART_B8X8 0x100 71 static const int level_map[] = {
78 if (level < 0 || level > XAVS_LOG_DEBUG)
81 av_vlog(p, level_map[level], fmt, args);
85 xavs_nal_t *nals,
int nnal)
94 for (i = 0; i < nnal; i++)
95 size += nals[i].i_payload;
108 for (i = 0; i < nnal; i++) {
109 s = xavs_nal_encode(p, &size, 1, nals + i);
125 xavs_picture_t pic_out;
128 x4->
pic.img.i_csp = XAVS_CSP_I420;
129 x4->
pic.img.i_plane = 3;
132 for (i = 0; i < 3; i++) {
137 x4->
pic.i_pts = frame->
pts;
138 x4->
pic.i_type = XAVS_TYPE_AUTO;
142 if (xavs_encoder_encode(x4->
enc, &nal, &nnal,
143 frame? &x4->
pic:
NULL, &pic_out) < 0)
168 #if FF_API_CODED_FRAME 173 pkt->
pts = pic_out.i_pts;
182 switch (pic_out.i_type) {
197 #if FF_API_CODED_FRAME 205 if (pic_out.i_type == XAVS_TYPE_I) {
206 #if FF_API_CODED_FRAME 214 #if FF_API_CODED_FRAME 236 xavs_encoder_close(x4->
enc);
246 xavs_param_default(&x4->
params);
249 x4->
params.p_log_private = avctx;
253 x4->
params.rc.i_rc_method = XAVS_RC_ABR;
259 x4->
params.rc.b_stat_read = 1;
262 x4->
params.rc.i_rc_method = XAVS_RC_CRF;
264 }
else if (x4->
cqp >= 0) {
265 x4->
params.rc.i_rc_method = XAVS_RC_CQP;
282 if (x4->
b_bias != INT_MIN)
291 #if FF_API_PRIVATE_OPT 308 #if FF_API_PRIVATE_OPT 335 x4->
params.analyse.inter = XAVS_ANALYSE_I8x8 |XAVS_ANALYSE_PSUB16x16| XAVS_ANALYSE_BSUB16x16;
342 x4->
params.analyse.b_transform_8x8 = 1;
346 #if FF_API_PRIVATE_OPT 355 if (avctx->
level > 0)
359 x4->
params.rc.f_rate_tolerance =
364 x4->
params.rc.f_vbv_buffer_init =
367 x4->
params.rc.f_vbv_buffer_init = 0.9;
374 #if FF_API_PRIVATE_OPT 384 x4->
params.i_log_level = XAVS_LOG_DEBUG;
389 x4->
params.b_repeat_headers = 0;
391 x4->
enc = xavs_encoder_open(&x4->
params);
405 s = xavs_encoder_headers(x4->
enc, &nal, &nnal);
408 for (i = 0; i < nnal; i++) {
410 if (nal[i].i_type == NAL_SEI) {
412 if (xavs_nal_encode(x4->
sei, &x4->
sei_size, 1, nal + i) < 0)
417 size = xavs_nal_encode(p, &s, 1, nal + i);
427 #define OFFSET(x) offsetof(XavsContext, x) 428 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM 431 {
"qp",
"Constant quantization parameter rate control method",
OFFSET(
cqp),
AV_OPT_TYPE_INT, {.i64 = -1 }, -1, INT_MAX, VE },
482 .wrapper_name =
"libxavs",
This structure describes decoded (raw) audio or video data.
int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type)
#define AV_CODEC_FLAG_INTERLACED_DCT
Use interlaced DCT.
float qblur
amount of qscale smoothing over time (0.0-1.0)
#define AV_LOG_WARNING
Something somehow does not look correct.
int64_t bit_rate
the average bitrate
#define LIBAVUTIL_VERSION_INT
Memory handling functions.
static av_cold int init(AVCodecContext *avctx)
int max_b_frames
maximum number of B-frames between non-B-frames Note: The output will be delayed by max_b_frames+1 re...
int rc_initial_buffer_occupancy
Number of bits which should be loaded into the rc buffer before decoding starts.
const char * av_default_item_name(void *ptr)
Return the context name.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
static void XAVS_log(void *p, int level, const char *fmt, va_list args)
#define AV_CODEC_CAP_AUTO_THREADS
Codec supports avctx->thread_count == 0 (auto).
static const AVOption options[]
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
static av_cold int XAVS_close(AVCodecContext *avctx)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
int bit_rate_tolerance
number of bits the bitstream is allowed to diverge from the reference.
int me_range
maximum motion estimation search range in subpel units If 0 then no limit.
float b_quant_factor
qscale factor between IP and B-frames If > 0 then the last P-frame quantizer will be used (q= lastp_q...
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
int me_cmp
motion estimation comparison function
#define AV_INPUT_BUFFER_MIN_SIZE
minimum encoding buffer size Used to avoid some checks during header writing.
static int encode_nals(AVCodecContext *ctx, AVPacket *pkt, xavs_nal_t *nals, int nnal)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int has_b_frames
Size of the frame reordering buffer in the decoder.
static __device__ float fabs(float a)
int qmax
maximum quantizer
static av_cold int XAVS_init(AVCodecContext *avctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
void av_vlog(void *avcl, int level, const char *fmt, va_list vl)
Send the specified message to the log if the level is less than or equal to the current av_log_level...
int flags
AV_CODEC_FLAG_*.
const char * name
Name of the codec implementation.
float i_quant_factor
qscale factor between P- and I-frames If > 0 then the last P-frame quantizer will be used (q = lastp_...
int flags
A combination of AV_PKT_FLAG values.
int rc_buffer_size
decoder bitstream buffer size
common internal API header
int refs
number of reference frames
static const AVCodecDefault xavs_defaults[]
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
attribute_deprecated int noise_reduction
#define AV_CODEC_FLAG_PSNR
error[?] variables will be set during encoding.
#define AV_CODEC_FLAG_PASS1
Use internal 2pass ratecontrol in first pass mode.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
int quality
quality (between 1 (good) and FF_LAMBDA_MAX (bad))
static const AVClass xavs_class
int max_qdiff
maximum quantizer difference between frames
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
static int XAVS_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
#define AV_LOG_INFO
Standard information.
Libavcodec external API header.
attribute_deprecated int scenechange_threshold
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
attribute_deprecated int b_frame_strategy
main external API structure.
int qmin
minimum quantizer
int scenechange_threshold
Describe the class of an AVClass context structure.
attribute_deprecated int chromaoffset
float qcompress
amount of qscale change between easy & hard scenes (0.0-1.0)
static enum AVPixelFormat pix_fmts[]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#define AV_CODEC_FLAG_GLOBAL_HEADER
Place global headers in extradata instead of every keyframe.
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header.
attribute_deprecated AVFrame * coded_frame
the picture in the bitstream
int trellis
trellis RD quantization
#define AV_CODEC_FLAG_PASS2
Use internal 2pass ratecontrol in second pass mode.
#define FF_ENABLE_DEPRECATION_WARNINGS
AVCodec ff_libxavs_encoder
int key_frame
1 -> keyframe, 0-> not
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
int frame_number
Frame counter, set by libavcodec.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
AVPixelFormat
Pixel format.
This structure stores compressed data.
int me_subpel_quality
subpel ME quality
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int64_t rc_max_rate
maximum bitrate
void * av_mallocz_array(size_t nmemb, size_t size)
int keyint_min
minimum GOP size