summaryrefslogtreecommitdiff
path: root/libavcodec/hevc_refs.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2015-07-09 14:22:43 +0200
committerAnton Khirnov <anton@khirnov.net>2015-07-12 18:15:39 +0200
commitb11acd57326db6c2cc1475dd0bea2a06fbc85aa2 (patch)
tree64740e507baccb89e4245ba3d2057e8359576ef5 /libavcodec/hevc_refs.c
parentab05ed4c322ed0488ac9b5d2ef5d4ffa55a946a7 (diff)
hevc: remove HEVCContext usage from hevc_ps
Factor out the parameter sets into a separate struct and use it instead. This will allow us to reuse this code in the parser.
Diffstat (limited to 'libavcodec/hevc_refs.c')
-rw-r--r--libavcodec/hevc_refs.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
index f232d03020..a4889a19c1 100644
--- a/libavcodec/hevc_refs.c
+++ b/libavcodec/hevc_refs.c
@@ -55,11 +55,11 @@ void ff_hevc_unref_frame(HEVCContext *s, HEVCFrame *frame, int flags)
RefPicList *ff_hevc_get_ref_list(HEVCContext *s, HEVCFrame *ref, int x0, int y0)
{
- int x_cb = x0 >> s->sps->log2_ctb_size;
- int y_cb = y0 >> s->sps->log2_ctb_size;
- int pic_width_cb = (s->sps->width + (1 << s->sps->log2_ctb_size) - 1) >>
- s->sps->log2_ctb_size;
- int ctb_addr_ts = s->pps->ctb_addr_rs_to_ts[y_cb * pic_width_cb + x_cb];
+ int x_cb = x0 >> s->ps.sps->log2_ctb_size;
+ int y_cb = y0 >> s->ps.sps->log2_ctb_size;
+ int pic_width_cb = (s->ps.sps->width + (1 << s->ps.sps->log2_ctb_size) - 1) >>
+ s->ps.sps->log2_ctb_size;
+ int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[y_cb * pic_width_cb + x_cb];
return (RefPicList *)ref->rpl_tab[ctb_addr_ts];
}
@@ -105,7 +105,7 @@ static HEVCFrame *alloc_frame(HEVCContext *s)
if (!frame->rpl_tab_buf)
goto fail;
frame->rpl_tab = (RefPicListTab **)frame->rpl_tab_buf->data;
- frame->ctb_count = s->sps->ctb_width * s->sps->ctb_height;
+ frame->ctb_count = s->ps.sps->ctb_width * s->ps.sps->ctb_height;
for (j = 0; j < frame->ctb_count; j++)
frame->rpl_tab[j] = (RefPicListTab *)frame->rpl_buf->data;
@@ -161,7 +161,7 @@ int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc)
ref->poc = poc;
ref->sequence = s->seq_decode;
- ref->window = s->sps->output_window;
+ ref->window = s->ps.sps->output_window;
return 0;
}
@@ -186,8 +186,8 @@ int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush)
}
/* wait for more frames before output */
- if (!flush && s->seq_output == s->seq_decode && s->sps &&
- nb_output <= s->sps->temporal_layer[s->sps->max_sub_layers - 1].num_reorder_pics)
+ if (!flush && s->seq_output == s->seq_decode && s->ps.sps &&
+ nb_output <= s->ps.sps->temporal_layer[s->ps.sps->max_sub_layers - 1].num_reorder_pics)
return 0;
if (nb_output) {
@@ -230,7 +230,7 @@ static int init_slice_rpl(HEVCContext *s)
{
HEVCFrame *frame = s->ref;
int ctb_count = frame->ctb_count;
- int ctb_addr_ts = s->pps->ctb_addr_rs_to_ts[s->sh.slice_segment_addr];
+ int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_segment_addr];
int i;
if (s->slice_idx >= frame->rpl_buf->size / sizeof(RefPicListTab))
@@ -317,7 +317,7 @@ int ff_hevc_slice_rpl(HEVCContext *s)
static HEVCFrame *find_ref_idx(HEVCContext *s, int poc)
{
int i;
- int LtMask = (1 << s->sps->log2_max_poc_lsb) - 1;
+ int LtMask = (1 << s->ps.sps->log2_max_poc_lsb) - 1;
for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) {
HEVCFrame *ref = &s->DPB[i];
@@ -356,16 +356,16 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc)
return NULL;
if (!s->avctx->hwaccel) {
- if (!s->sps->pixel_shift) {
+ if (!s->ps.sps->pixel_shift) {
for (i = 0; frame->frame->buf[i]; i++)
- memset(frame->frame->buf[i]->data, 1 << (s->sps->bit_depth - 1),
+ memset(frame->frame->buf[i]->data, 1 << (s->ps.sps->bit_depth - 1),
frame->frame->buf[i]->size);
} else {
for (i = 0; frame->frame->data[i]; i++)
- for (y = 0; y < (s->sps->height >> s->sps->vshift[i]); y++)
- for (x = 0; x < (s->sps->width >> s->sps->hshift[i]); x++) {
+ for (y = 0; y < (s->ps.sps->height >> s->ps.sps->vshift[i]); y++)
+ for (x = 0; x < (s->ps.sps->width >> s->ps.sps->hshift[i]); x++) {
AV_WN16(frame->frame->data[i] + y * frame->frame->linesize[i] + 2 * x,
- 1 << (s->sps->bit_depth - 1));
+ 1 << (s->ps.sps->bit_depth - 1));
}
}
}
@@ -464,7 +464,7 @@ fail:
int ff_hevc_compute_poc(HEVCContext *s, int poc_lsb)
{
- int max_poc_lsb = 1 << s->sps->log2_max_poc_lsb;
+ int max_poc_lsb = 1 << s->ps.sps->log2_max_poc_lsb;
int prev_poc_lsb = s->pocTid0 % max_poc_lsb;
int prev_poc_msb = s->pocTid0 - prev_poc_lsb;
int poc_msb;