AOMedia AV1 Codec
lookahead.h File Reference

Describes look ahead buffer operations. More...

#include <stdbool.h>
#include "aom_scale/yv12config.h"
#include "aom/aom_integer.h"

Go to the source code of this file.

Functions

struct lookahead_ctx * av1_lookahead_init (unsigned int width, unsigned int height, unsigned int subsampling_x, unsigned int subsampling_y, int use_highbitdepth, unsigned int depth, const int border_in_pixels, int byte_alignment, int num_lap_buffers, bool is_all_intra, bool alloc_pyramid)
 Initializes the lookahead stage.
 
void av1_lookahead_destroy (struct lookahead_ctx *ctx)
 Destroys the lookahead stage.
 
int av1_lookahead_full (const struct lookahead_ctx *ctx)
 Check if lookahead buffer is full.
 
int av1_lookahead_push (struct lookahead_ctx *ctx, const YV12_BUFFER_CONFIG *src, int64_t ts_start, int64_t ts_end, int use_highbitdepth, bool alloc_pyramid, aom_enc_frame_flags_t flags)
 Enqueue a source buffer.
 
struct lookahead_entry * av1_lookahead_pop (struct lookahead_ctx *ctx, int drain, COMPRESSOR_STAGE stage)
 Get the next source buffer to encode.
 
struct lookahead_entry * av1_lookahead_peek (struct lookahead_ctx *ctx, int index, COMPRESSOR_STAGE stage)
 Get a future source buffer to encode.
 
unsigned int av1_lookahead_depth (struct lookahead_ctx *ctx, COMPRESSOR_STAGE stage)
 Get the number of frames currently in the lookahead queue.
 
int av1_lookahead_pop_sz (struct lookahead_ctx *ctx, COMPRESSOR_STAGE stage)
 Get pop_sz value.
 

Detailed Description

Describes look ahead buffer operations.

Function Documentation

◆ av1_lookahead_init()

struct lookahead_ctx * av1_lookahead_init ( unsigned int width,
unsigned int height,
unsigned int subsampling_x,
unsigned int subsampling_y,
int use_highbitdepth,
unsigned int depth,
const int border_in_pixels,
int byte_alignment,
int num_lap_buffers,
bool is_all_intra,
bool alloc_pyramid )

Initializes the lookahead stage.

The lookahead stage is a queue of frame buffers on which some analysis may be done when buffers are enqueued.

◆ av1_lookahead_push()

int av1_lookahead_push ( struct lookahead_ctx * ctx,
const YV12_BUFFER_CONFIG * src,
int64_t ts_start,
int64_t ts_end,
int use_highbitdepth,
bool alloc_pyramid,
aom_enc_frame_flags_t flags )

Enqueue a source buffer.

This function will copy the source image into a new framebuffer with the expected stride/border.

Parameters
[in]ctxPointer to the lookahead context
[in]srcPointer to the image to enqueue
[in]ts_startTimestamp for the start of this frame
[in]ts_endTimestamp for the end of this frame
[in]use_highbitdepthTell if HBD is used
[in]alloc_pyramidWhether to allocate a downsampling pyramid for each frame buffer
[in]flagsFlags set on this frame

Referenced by av1_receive_raw_frame().

◆ av1_lookahead_pop()

struct lookahead_entry * av1_lookahead_pop ( struct lookahead_ctx * ctx,
int drain,
COMPRESSOR_STAGE stage )

Get the next source buffer to encode.

Parameters
[in]ctxPointer to the lookahead context
[in]drainFlag indicating the buffer should be drained (return a buffer regardless of the current queue depth)
[in]stageEncoder stage
Return values
ReturnNULL, if drain set and queue is empty, or if drain not set and queue not of the configured depth.

◆ av1_lookahead_peek()

struct lookahead_entry * av1_lookahead_peek ( struct lookahead_ctx * ctx,
int index,
COMPRESSOR_STAGE stage )

Get a future source buffer to encode.

Parameters
[in]ctxPointer to the lookahead context
[in]indexIndex of the frame to be returned, 0 == next frame
[in]stageEncoder stage
Return values
ReturnNULL, if no buffer exists at the specified index

Referenced by av1_encode_strategy(), and tf_setup_filtering_buffer().