51 frame->nb_rpl_elems = 0;
60 int x_cb = x0 >>
sps->log2_ctb_size;
61 int y_cb = y0 >>
sps->log2_ctb_size;
62 int pic_width_cb =
sps->ctb_width;
63 int ctb_addr_ts =
ref->pps->ctb_addr_rs_to_ts[y_cb * pic_width_cb + x_cb];
64 return &
ref->rpl_tab[ctb_addr_ts]->refPicList[0];
88 uintptr_t
data = (uintptr_t)
alpha->data[0];
93 uintptr_t buf_begin = (uintptr_t)buf->
data;
113 const int view_id =
vps->view_id[
s->cur_layer];
125 if (
s->sei.common.itut_t35.lcevc) {
136 &
frame->f->nb_side_data,
141 *(
int*)sd->
data = view_id;
170 frame->nb_rpl_elems =
s->pkt.nb_nals;
180 for (j = 0; j <
frame->ctb_count; j++)
234 s->collocated_ref =
NULL;
236 ref->base_layer_frame = (l != &
s->layers[0] &&
s->layers[0].cur_frame) ?
237 s->layers[0].cur_frame -
s->layers[0].DPB : -1;
239 no_output = !
IS_IRAP(
s) && (
s->poc <
s->recovery_poc) &&
243 if (
s->sh.pic_output_flag && !no_output)
268 unsigned layers_active_decode,
unsigned layers_active_output,
269 unsigned max_output,
unsigned max_dpb,
int discard)
274 int min_poc = INT_MAX;
276 int min_idx, ret = 0;
281 if (!(layers_active_decode & (1 << layer)))
289 if (!(
frame->base_layer_frame >= 0 &&
292 if (min_layer < 0 || frame->poc < min_poc) {
293 min_poc =
frame->poc;
298 nb_dpb[layer] += !!
frame->flags;
302 if (nb_output > max_output ||
304 (nb_dpb[0] > max_dpb || nb_dpb[1] > max_dpb))) {
307 int output = !discard && (layers_active_output & (1 << min_layer));
312 f->pkt_dts =
s->pkt_dts;
320 output ?
"Output" :
"Discarded", min_layer,
frame->poc);
330 int ctb_count =
frame->ctb_count;
331 int ctb_addr_ts =
s->pps->ctb_addr_rs_to_ts[
s->sh.slice_segment_addr];
334 if (
s->slice_idx >=
frame->nb_rpl_elems)
337 for (
i = ctb_addr_ts;
i < ctb_count;
i++)
360 !
s->pps->pps_curr_pic_ref_enabled_flag) {
365 for (list_idx = 0; list_idx < nb_list; list_idx++) {
367 RefPicList *rpl = &
s->cur_frame->refPicList[list_idx];
414 rpl->
ref[
i] = rpl_tmp.
ref[idx];
419 memcpy(rpl, &rpl_tmp,
sizeof(*rpl));
424 if (
s->pps->pps_curr_pic_ref_enabled_flag &&
440 int poc, uint8_t use_msb)
448 if ((
ref->poc &
mask) == poc && (use_msb ||
ref->poc !=
s->poc))
455 "Could not find ref with POC %d\n", poc);
473 if (!
s->avctx->hwaccel) {
476 for (
int i = 0;
i < nb_planes;
i++)
480 for (
int i = 0;
i < nb_planes;
i++)
501 int poc,
int ref_flag, uint8_t use_msb)
514 if (ref_corrupt && !recovering) {
550 if (
frame ==
s->cur_frame)
567 if (!(short_rps->
used & (1 <<
i)))
582 int poc = long_rps->
poc[
i];
593 if (
s->sh.inter_layer_pred) {
627 ret += !!(rps->
used & (1 <<
i));
629 ret += !!(rps->
used & (1 <<
i));
633 ret += !!long_rps->
used[
i];
636 av_assert0(
pps->sps->vps->num_direct_ref_layers[layer_idx] < 2);
640 if (
pps->pps_curr_pic_ref_enabled_flag)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define FF_THREAD_FRAME
Decode more than one frame at once.
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
static int FUNC sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
static int FUNC vps(CodedBitstreamContext *ctx, RWContext *rw, H265RawVPS *current)
#define AV_CEIL_RSHIFT(a, b)
int av_container_fifo_write(AVContainerFifo *cf, void *obj, unsigned flags)
Write the contents of obj to the FIFO.
@ AV_CONTAINER_FIFO_FLAG_REF
Signal to av_container_fifo_write() that it should make a new reference to data in src rather than co...
int ff_frame_new_side_data_from_buf(const AVCodecContext *avctx, AVFrame *frame, enum AVFrameSideDataType type, AVBufferRef **buf)
Similar to ff_frame_new_side_data, but using an existing buffer ref.
void ff_progress_frame_report(ProgressFrame *f, int n)
Notify later decoding threads when part of their reference frame is ready.
int ff_hwaccel_frame_priv_alloc(AVCodecContext *avctx, void **hwaccel_picture_private)
Allocate a hwaccel frame private data if the provided avctx uses a hwaccel method that needs it.
int ff_progress_frame_alloc(AVCodecContext *avctx, ProgressFrame *f)
This function sets up the ProgressFrame, i.e.
void ff_progress_frame_unref(ProgressFrame *f)
Give up a reference to the underlying frame contained in a ProgressFrame and reset the ProgressFrame,...
#define AV_CODEC_FLAG2_SHOW_ALL
Show all frames before the first keyframe.
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
#define AV_CODEC_FLAG_OUTPUT_CORRUPT
Output even those frames that might be corrupted.
@ AV_PICTURE_STRUCTURE_BOTTOM_FIELD
coded as bottom field
@ AV_PICTURE_STRUCTURE_TOP_FIELD
coded as top field
int av_buffer_replace(AVBufferRef **pdst, const AVBufferRef *src)
Ensure dst refers to the same data as src.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
#define AV_FRAME_FLAG_TOP_FIELD_FIRST
A flag to mark frames where the top field is displayed first if the content is interlaced.
#define AV_FRAME_FLAG_CORRUPT
The frame data may be corrupted, e.g.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
AVFrameSideData * av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd, enum AVFrameSideDataType type, size_t size, unsigned int flags)
Add new side data entry to an array.
AVBufferRef * av_frame_get_plane_buffer(const AVFrame *frame, int plane)
Get the buffer reference a given data plane is stored in.
@ AV_FRAME_DATA_VIEW_ID
This side data must be associated with a video frame.
@ AV_FRAME_DATA_LCEVC
Raw LCEVC payload data, as a uint8_t array, with NAL emulation bytes intact.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
Overlapping memcpy() implementation.
int av_size_mult(size_t a, size_t b, size_t *r)
Multiply two size_t values checking for overflow.
AVStereo3D * av_stereo3d_create_side_data(AVFrame *frame)
Allocate a complete AVFrameSideData and add it to the frame.
@ AV_STEREO3D_FRAMESEQUENCE
Views are alternated temporally.
@ AV_STEREO3D_VIEW_RIGHT
Frame contains only the right view.
@ AV_STEREO3D_VIEW_LEFT
Frame contains only the left view.
@ AV_STEREO3D_VIEW_UNSPEC
Content is unspecified.
#define HEVC_VPS_MAX_LAYERS
int ff_hevc_output_frames(HEVCContext *s, unsigned layers_active_decode, unsigned layers_active_output, unsigned max_output, unsigned max_dpb, int discard)
Find frames in the DPB that are ready for output and either write them to the output FIFO or drop the...
static HEVCFrame * find_ref_idx(HEVCContext *s, HEVCLayerContext *l, int poc, uint8_t use_msb)
void ff_hevc_flush_dpb(HEVCContext *s)
Drop all frames currently in DPB.
int ff_hevc_frame_nb_refs(const SliceHeader *sh, const HEVCPPS *pps, unsigned layer_idx)
Get the number of candidate references for the current frame.
const RefPicList * ff_hevc_get_ref_list(const HEVCFrame *ref, int x0, int y0)
static int add_candidate_ref(HEVCContext *s, HEVCLayerContext *l, RefPicList *rps, int list_idx, int poc, int ref_flag, uint8_t use_msb)
void ff_hevc_clear_refs(HEVCLayerContext *l)
Mark all frames in DPB as unused for reference.
static void unref_missing_refs(HEVCLayerContext *l)
static void mark_ref(HEVCFrame *frame, int flag)
int ff_hevc_set_new_ref(HEVCContext *s, HEVCLayerContext *l, int poc)
int ff_hevc_frame_rps(HEVCContext *s, HEVCLayerContext *l)
Construct the reference picture sets for the current frame.
static int replace_alpha_plane(AVFrame *alpha, AVFrame *base)
static HEVCFrame * alloc_frame(HEVCContext *s, HEVCLayerContext *l)
static int init_slice_rpl(HEVCContext *s)
void ff_hevc_unref_frame(HEVCFrame *frame, int flags)
int ff_hevc_slice_rpl(HEVCContext *s)
Construct the reference picture list(s) for the current slice.
static HEVCFrame * generate_missing_ref(HEVCContext *s, HEVCLayerContext *l, int poc)
#define HEVC_FRAME_FLAG_SHORT_REF
#define HEVC_IS_RECOVERING(s)
#define HEVC_FRAME_FLAG_UNAVAILABLE
#define HEVC_FRAME_FLAG_LONG_REF
#define HEVC_FRAME_FLAG_OUTPUT
#define HEVC_FRAME_FLAG_CORRUPT
static const int16_t alpha[]
int ff_hevc_is_alpha_video(const HEVCContext *s)
Multithreading API for decoders.
static const uint16_t mask[17]
Memory handling functions.
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
const void * av_refstruct_ref_c(const void *obj)
Analog of av_refstruct_ref(), but for constant objects.
void * av_refstruct_pool_get(AVRefStructPool *pool)
Get an object from the pool, reusing an old one from the pool when available.
static void * av_refstruct_allocz(size_t size)
Equivalent to av_refstruct_alloc_ext(size, 0, NULL, NULL)
#define FF_ARRAY_ELEMS(a)
A reference to a data buffer.
uint8_t * data
The data buffer.
Structure to hold side data for an AVFrame.
This structure describes decoded (raw) audio or video data.
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
enum AVStereo3DType type
How views are packed within the video.
enum AVStereo3DView view
Determines which views are packed.
struct AVRefStructPool * rpl_tab_pool
struct AVRefStructPool * tab_mvf_pool
uint16_t left_view_id[32]
uint16_t right_view_id[32]
unsigned int log2_max_poc_lsb
int width
coded frame dimension in various units
const HEVCVPS * vps
RefStruct reference.
unsigned int right_offset
unsigned int bottom_offset
uint8_t poc_msb_present[32]
int isLongTerm[HEVC_MAX_REFS]
struct HEVCFrame * ref[HEVC_MAX_REFS]
uint8_t num_negative_pics
static int ref[MAX_W *MAX_W]