59 int x_cb = x0 >>
s->ps.sps->log2_ctb_size;
60 int y_cb = y0 >>
s->ps.sps->log2_ctb_size;
61 int pic_width_cb =
s->ps.sps->ctb_width;
62 int ctb_addr_ts =
s->ps.pps->ctb_addr_rs_to_ts[y_cb * pic_width_cb + x_cb];
100 if (!
frame->tab_mvf_buf)
105 if (!
frame->rpl_tab_buf)
108 frame->ctb_count =
s->ps.sps->ctb_width *
s->ps.sps->ctb_height;
109 for (j = 0; j <
frame->ctb_count; j++)
115 if (
s->avctx->hwaccel) {
120 if (!
frame->hwaccel_priv_buf)
159 if (
s->sh.pic_output_flag)
165 ref->sequence =
s->seq_decode;
166 ref->frame->crop_left =
s->ps.sps->output_window.left_offset;
167 ref->frame->crop_right =
s->ps.sps->output_window.right_offset;
168 ref->frame->crop_top =
s->ps.sps->output_window.top_offset;
169 ref->frame->crop_bottom =
s->ps.sps->output_window.bottom_offset;
178 int min_poc = INT_MAX;
181 if (
s->sh.no_output_of_prior_pics_flag == 1 &&
s->no_rasl_output_flag == 1) {
185 frame->sequence ==
s->seq_output) {
194 frame->sequence ==
s->seq_output) {
196 if (
frame->poc < min_poc || nb_output == 1) {
197 min_poc =
frame->poc;
204 if (!
flush &&
s->seq_output ==
s->seq_decode &&
s->ps.sps &&
205 nb_output <= s->ps.sps->temporal_layer[
s->ps.sps->max_sub_layers - 1].num_reorder_pics)
220 "Output frame with POC %d.\n",
frame->poc);
224 if (
s->seq_output !=
s->seq_decode)
225 s->seq_output = (
s->seq_output + 1) & 0xff;
236 int min_poc = INT_MAX;
242 frame->sequence ==
s->seq_output &&
248 if (
s->ps.sps && dpb >=
s->ps.sps->temporal_layer[
s->ps.sps->max_sub_layers - 1].max_dec_pic_buffering) {
252 frame->sequence ==
s->seq_output &&
255 min_poc =
frame->poc;
263 frame->sequence ==
s->seq_output &&
264 frame->poc <= min_poc) {
276 int ctb_count =
frame->ctb_count;
277 int ctb_addr_ts =
s->ps.pps->ctb_addr_rs_to_ts[
s->sh.slice_segment_addr];
283 for (
i = ctb_addr_ts;
i < ctb_count;
i++)
309 for (list_idx = 0; list_idx < nb_list; list_idx++) {
344 rpl->
ref[
i] = rpl_tmp.
ref[idx];
349 memcpy(rpl, &rpl_tmp,
sizeof(*rpl));
363 int mask = use_msb ? ~0 : (1 <<
s->ps.sps->log2_max_poc_lsb) - 1;
368 if (
ref->frame->buf[0] &&
ref->sequence ==
s->seq_decode) {
376 "Could not find ref with POC %d\n", poc);
395 if (!
s->avctx->hwaccel) {
396 if (!
s->ps.sps->pixel_shift) {
398 memset(
frame->frame->
buf[
i]->
data, 1 << (
s->ps.sps->bit_depth - 1),
402 for (y = 0; y < (
s->ps.sps->height >>
s->ps.sps->vshift[
i]); y++) {
404 AV_WN16(dst, 1 << (
s->ps.sps->bit_depth - 1));
411 frame->sequence =
s->seq_decode;
422 int poc,
int ref_flag,
uint8_t use_msb)
473 if (!short_rps->
used[
i])
475 else if (i < short_rps->num_negative_pics)
487 int poc = long_rps->
poc[
i];
512 ret += !!rps->
used[
i];
514 ret += !!rps->
used[
i];
519 ret += !!long_rps->
used[
i];
static void flush(AVCodecContext *avctx)
simple assert() macros that are a bit more flexible than ISO C assert().
#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 AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
@ AV_PICTURE_STRUCTURE_BOTTOM_FIELD
@ AV_PICTURE_STRUCTURE_TOP_FIELD
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
AVBufferRef * av_buffer_allocz(buffer_size_t size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
AVBufferRef * av_buffer_pool_get(AVBufferPool *pool)
Allocate a new AVBuffer, reusing an old buffer from the pool when available.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
#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.
static HEVCFrame * alloc_frame(HEVCContext *s)
int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush)
Find next frame in output order and put a reference to it in frame.
static HEVCFrame * find_ref_idx(HEVCContext *s, int poc, uint8_t use_msb)
int ff_hevc_frame_nb_refs(const HEVCContext *s)
Get the number of candidate references for the current frame.
void ff_hevc_flush_dpb(HEVCContext *s)
Drop all frames currently in DPB.
RefPicList * ff_hevc_get_ref_list(HEVCContext *s, HEVCFrame *ref, int x0, int y0)
int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc)
static HEVCFrame * generate_missing_ref(HEVCContext *s, int poc)
static void mark_ref(HEVCFrame *frame, int flag)
void ff_hevc_unref_frame(HEVCContext *s, HEVCFrame *frame, int flags)
void ff_hevc_bump_frame(HEVCContext *s)
int ff_hevc_frame_rps(HEVCContext *s)
Construct the reference picture sets for the current frame.
static int init_slice_rpl(HEVCContext *s)
void ff_hevc_clear_refs(HEVCContext *s)
Mark all frames in DPB as unused for reference.
int ff_hevc_slice_rpl(HEVCContext *s)
Construct the reference picture list(s) for the current slice.
static int add_candidate_ref(HEVCContext *s, RefPicList *list, int poc, int ref_flag, uint8_t use_msb)
#define HEVC_FRAME_FLAG_BUMPING
#define HEVC_FRAME_FLAG_SHORT_REF
#define HEVC_FRAME_FLAG_LONG_REF
#define HEVC_FRAME_FLAG_OUTPUT
common internal API header
static const uint16_t mask[17]
void ff_thread_report_progress(ThreadFrame *f, int n, int field)
Notify later decoding threads when part of their reference picture is ready.
FF_ENABLE_DEPRECATION_WARNINGS int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
void ff_thread_release_buffer(AVCodecContext *avctx, ThreadFrame *f)
Wrapper around release_buffer() frame-for multithreaded codecs.
#define FF_ARRAY_ELEMS(a)
int size
Size of data in bytes.
uint8_t * data
The data buffer.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
int top_field_first
If the content is interlaced, is top field displayed first.
int interlaced_frame
The content of the picture is interlaced.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
int frame_priv_data_size
Size of per-frame hardware accelerator private data.
uint8_t poc_msb_present[32]
int isLongTerm[HEVC_MAX_REFS]
struct HEVCFrame * ref[HEVC_MAX_REFS]
unsigned int num_negative_pics
static int ref[MAX_W *MAX_W]