ff_hevc_get_ref_list() needs the PPS of a previously decoded frame, which may be different from the currently active one.
Unified · Split
| @@ -767,7 +767,7 @@ void ff_hevc_deblocking_boundary_strengths(HEVCLocalContext *lc, const HEVCLayer · 766 unmodified lines | ||
| 767 | 767 | |
| 768 | 768 | if (boundary_upper) { |
| 769 | 769 | const RefPicList *rpl_top = (lc->boundary_flags & BOUNDARY_UPPER_SLICE) ? |
| 770 | − ff_hevc_get_ref_list(s, s->cur_frame, x0, y0 - 1) : | |
| 770 | + ff_hevc_get_ref_list(s->cur_frame, x0, y0 - 1) : | |
| 771 | 771 | s->cur_frame->refPicList; |
| 772 | 772 | int yp_pu = (y0 - 1) >> log2_min_pu_size; |
| 773 | 773 | int yq_pu = y0 >> log2_min_pu_size; |
| @@ -805,7 +805,7 @@ void ff_hevc_deblocking_boundary_strengths(HEVCLocalContext *lc, const HEVCLayer · 31 unmodified lines | ||
| 805 | 805 | |
| 806 | 806 | if (boundary_left) { |
| 807 | 807 | const RefPicList *rpl_left = (lc->boundary_flags & BOUNDARY_LEFT_SLICE) ? |
| 808 | − ff_hevc_get_ref_list(s, s->cur_frame, x0 - 1, y0) : | |
| 808 | + ff_hevc_get_ref_list(s->cur_frame, x0 - 1, y0) : | |
| 809 | 809 | s->cur_frame->refPicList; |
| 810 | 810 | int xp_pu = (x0 - 1) >> log2_min_pu_size; |
| 811 | 811 | int xq_pu = x0 >> log2_min_pu_size; |
| @@ -3503,6 +3503,7 @@ static int hevc_ref_frame(HEVCFrame *dst, const HEVCFrame *src) · 3502 unmodified lines | ||
| 3503 | 3503 | dst->needs_fg = 1; |
| 3504 | 3504 | } |
| 3505 | 3505 | |
| 3506 | + dst->pps = ff_refstruct_ref_c(src->pps); | |
| 3506 | 3507 | dst->tab_mvf = ff_refstruct_ref(src->tab_mvf); |
| 3507 | 3508 | dst->rpl_tab = ff_refstruct_ref(src->rpl_tab); |
| 3508 | 3509 | dst->rpl = ff_refstruct_ref(src->rpl); |
| @@ -366,6 +366,7 @@ typedef struct HEVCFrame { · 365 unmodified lines | ||
| 366 | 366 | int ctb_count; |
| 367 | 367 | int poc; |
| 368 | 368 | |
| 369 | + const HEVCPPS *pps; ///< RefStruct reference | |
| 369 | 370 | RefPicListTab *rpl; ///< RefStruct reference |
| 370 | 371 | int nb_rpl_elems; |
| 371 | 372 | |
| @@ -556,8 +557,7 @@ void ff_hevc_clear_refs(HEVCLayerContext *l); · 184 unmodified lines | ||
| 556 | 557 | */ |
| 557 | 558 | void ff_hevc_flush_dpb(HEVCContext *s); |
| 558 | 559 | |
| 559 | −const RefPicList *ff_hevc_get_ref_list(const HEVCContext *s, const HEVCFrame *frame, | |
| 560 | − int x0, int y0); | |
| 560 | +const RefPicList *ff_hevc_get_ref_list(const HEVCFrame *frame, int x0, int y0); | |
| 561 | 561 | |
| 562 | 562 | /** |
| 563 | 563 | * Construct the reference picture sets for the current frame. |
| @@ -211,7 +211,7 @@ static int derive_temporal_colocated_mvs(const HEVCContext *s, MvField temp_col, · 210 unmodified lines | ||
| 211 | 211 | #define DERIVE_TEMPORAL_COLOCATED_MVS \ |
| 212 | 212 | derive_temporal_colocated_mvs(s, temp_col, \ |
| 213 | 213 | refIdxLx, mvLXCol, X, colPic, \ |
| 214 | − ff_hevc_get_ref_list(s, ref, x, y)) | |
| 214 | + ff_hevc_get_ref_list(ref, x, y)) | |
| 215 | 215 | |
| 216 | 216 | /* |
| 217 | 217 | * 8.5.3.1.7 temporal luma motion vector prediction |
| @@ -38,6 +38,7 @@ void ff_hevc_unref_frame(HEVCFrame *frame, int flags) · 37 unmodified lines | ||
| 38 | 38 | av_frame_unref(frame->frame_grain); |
| 39 | 39 | frame->needs_fg = 0; |
| 40 | 40 | |
| 41 | + ff_refstruct_unref(&frame->pps); | |
| 41 | 42 | ff_refstruct_unref(&frame->tab_mvf); |
| 42 | 43 | |
| 43 | 44 | ff_refstruct_unref(&frame->rpl); |
| @@ -49,13 +50,13 @@ void ff_hevc_unref_frame(HEVCFrame *frame, int flags) · 5 unmodified lines | ||
| 49 | 50 | } |
| 50 | 51 | } |
| 51 | 52 | |
| 52 | −const RefPicList *ff_hevc_get_ref_list(const HEVCContext *s, | |
| 53 | − const HEVCFrame *ref, int x0, int y0) | |
| 53 | +const RefPicList *ff_hevc_get_ref_list(const HEVCFrame *ref, int x0, int y0) | |
| 54 | 54 | { |
| 55 | − int x_cb = x0 >> s->ps.sps->log2_ctb_size; | |
| 56 | − int y_cb = y0 >> s->ps.sps->log2_ctb_size; | |
| 57 | − int pic_width_cb = s->ps.sps->ctb_width; | |
| 58 | − int ctb_addr_ts = s->pps->ctb_addr_rs_to_ts[y_cb * pic_width_cb + x_cb]; | |
| 55 | + const HEVCSPS *sps = ref->pps->sps; | |
| 56 | + int x_cb = x0 >> sps->log2_ctb_size; | |
| 57 | + int y_cb = y0 >> sps->log2_ctb_size; | |
| 58 | + int pic_width_cb = sps->ctb_width; | |
| 59 | + int ctb_addr_ts = ref->pps->ctb_addr_rs_to_ts[y_cb * pic_width_cb + x_cb]; | |
| 59 | 60 | return &ref->rpl_tab[ctb_addr_ts]->refPicList[0]; |
| 60 | 61 | } |
| 61 | 62 | |
| @@ -116,6 +117,8 @@ static HEVCFrame *alloc_frame(HEVCContext *s, HEVCLayerContext *l) · 54 unmodified lines | ||
| 116 | 117 | if (ret < 0) |
| 117 | 118 | goto fail; |
| 118 | 119 | |
| 120 | + frame->pps = ff_refstruct_ref_c(s->pps); | |
| 121 | + | |
| 119 | 122 | return frame; |
| 120 | 123 | fail: |
| 121 | 124 | ff_hevc_unref_frame(frame, ~0); |