#include "cabac_functions.h"
#include "golomb.h"
#include "hevc.h"
+#include "profiles.h"
-const uint8_t ff_hevc_qpel_extra_before[4] = { 0, 3, 3, 2 };
-const uint8_t ff_hevc_qpel_extra_after[4] = { 0, 3, 4, 4 };
-const uint8_t ff_hevc_qpel_extra[4] = { 0, 6, 7, 6 };
+const uint8_t ff_hevc_qpel_extra_before[4] = { 0, 3, 3, 3 };
+const uint8_t ff_hevc_qpel_extra_after[4] = { 0, 4, 4, 4 };
+const uint8_t ff_hevc_qpel_extra[4] = { 0, 7, 7, 7 };
static const uint8_t scan_1x1[1] = { 0 };
{ 1, 3, },
};
-const uint8_t ff_hevc_diag_scan4x4_x[16] = {
- 0, 0, 1, 0,
- 1, 2, 0, 1,
- 2, 3, 1, 2,
- 3, 2, 3, 3,
-};
-
-const uint8_t ff_hevc_diag_scan4x4_y[16] = {
- 0, 1, 0, 2,
- 1, 0, 3, 2,
- 1, 0, 3, 2,
- 1, 3, 2, 3,
-};
-
static const uint8_t diag_scan4x4_inv[4][4] = {
{ 0, 2, 5, 9, },
{ 1, 4, 8, 12, },
{ 6, 10, 13, 15, },
};
-const uint8_t ff_hevc_diag_scan8x8_x[64] = {
- 0, 0, 1, 0,
- 1, 2, 0, 1,
- 2, 3, 0, 1,
- 2, 3, 4, 0,
- 1, 2, 3, 4,
- 5, 0, 1, 2,
- 3, 4, 5, 6,
- 0, 1, 2, 3,
- 4, 5, 6, 7,
- 1, 2, 3, 4,
- 5, 6, 7, 2,
- 3, 4, 5, 6,
- 7, 3, 4, 5,
- 6, 7, 4, 5,
- 6, 7, 5, 6,
- 7, 6, 7, 7,
-};
-
-const uint8_t ff_hevc_diag_scan8x8_y[64] = {
- 0, 1, 0, 2,
- 1, 0, 3, 2,
- 1, 0, 4, 3,
- 2, 1, 0, 5,
- 4, 3, 2, 1,
- 0, 6, 5, 4,
- 3, 2, 1, 0,
- 7, 6, 5, 4,
- 3, 2, 1, 0,
- 7, 6, 5, 4,
- 3, 2, 1, 7,
- 6, 5, 4, 3,
- 2, 7, 6, 5,
- 4, 3, 7, 6,
- 5, 4, 7, 6,
- 5, 7, 6, 7,
-};
-
static const uint8_t diag_scan8x8_inv[8][8] = {
{ 0, 2, 5, 9, 14, 20, 27, 35, },
{ 1, 4, 8, 13, 19, 26, 34, 42, },
static int set_sps(HEVCContext *s, const HEVCSPS *sps)
{
- #define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + CONFIG_HEVC_D3D11VA_HWACCEL)
+ #define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + CONFIG_HEVC_D3D11VA_HWACCEL + CONFIG_HEVC_VDPAU_HWACCEL)
enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts;
int ret;
- export_stream_params(s->avctx, &s->ps, sps);
-
pic_arrays_free(s);
+ s->ps.sps = NULL;
+ s->ps.vps = NULL;
+
+ if (!sps)
+ return 0;
+
ret = pic_arrays_init(s, sps);
if (ret < 0)
goto fail;
+ export_stream_params(s->avctx, &s->ps, sps);
+
if (sps->pix_fmt == AV_PIX_FMT_YUV420P || sps->pix_fmt == AV_PIX_FMT_YUVJ420P) {
#if CONFIG_HEVC_DXVA2_HWACCEL
*fmt++ = AV_PIX_FMT_DXVA2_VLD;
#endif
#if CONFIG_HEVC_D3D11VA_HWACCEL
*fmt++ = AV_PIX_FMT_D3D11VA_VLD;
+#endif
+#if CONFIG_HEVC_VDPAU_HWACCEL
+ *fmt++ = AV_PIX_FMT_VDPAU;
#endif
}
sh->colour_plane_id = get_bits(gb, 2);
if (!IS_IDR(s)) {
- int poc;
+ int poc, pos;
sh->pic_order_cnt_lsb = get_bits(gb, s->ps.sps->log2_max_poc_lsb);
poc = ff_hevc_compute_poc(s, sh->pic_order_cnt_lsb);
s->poc = poc;
sh->short_term_ref_pic_set_sps_flag = get_bits1(gb);
+ pos = get_bits_left(gb);
if (!sh->short_term_ref_pic_set_sps_flag) {
- int pos = get_bits_left(gb);
ret = ff_hevc_decode_short_term_rps(gb, s->avctx, &sh->slice_rps, s->ps.sps, 1);
if (ret < 0)
return ret;
- sh->short_term_ref_pic_set_size = pos - get_bits_left(gb);
sh->short_term_rps = &sh->slice_rps;
} else {
int numbits, rps_idx;
rps_idx = numbits > 0 ? get_bits(gb, numbits) : 0;
sh->short_term_rps = &s->ps.sps->st_rps[rps_idx];
}
+ sh->short_term_ref_pic_set_size = pos - get_bits_left(gb);
+ pos = get_bits_left(gb);
ret = decode_lt_rps(s, &sh->long_term_rps, gb);
if (ret < 0) {
av_log(s->avctx, AV_LOG_WARNING, "Invalid long term RPS.\n");
if (s->avctx->err_recognition & AV_EF_EXPLODE)
return AVERROR_INVALIDDATA;
}
+ sh->long_term_ref_pic_set_size = pos - get_bits_left(gb);
if (s->ps.sps->sps_temporal_mvp_enabled_flag)
sh->slice_temporal_mvp_enabled_flag = get_bits1(gb);
int trafo_size = 1 << log2_trafo_size;
int i, qp, shift, add, scale, scale_m;
- const uint8_t level_scale[] = { 40, 45, 51, 57, 64, 72 };
+ static const uint8_t level_scale[] = { 40, 45, 51, 57, 64, 72 };
const uint8_t *scale_matrix;
uint8_t dc_scale;
*/
static void luma_mc(HEVCContext *s, int16_t *dst, ptrdiff_t dststride,
AVFrame *ref, const Mv *mv, int x_off, int y_off,
- int block_w, int block_h)
+ int block_w, int block_h, int pred_idx)
{
HEVCLocalContext *lc = &s->HEVClc;
uint8_t *src = ref->data[0];
x_off += mv->x >> 2;
y_off += mv->y >> 2;
- src += y_off * srcstride + (x_off << s->ps.sps->pixel_shift);
+ src += y_off * srcstride + (x_off * (1 << s->ps.sps->pixel_shift));
if (x_off < extra_left || y_off < extra_top ||
x_off >= pic_width - block_w - ff_hevc_qpel_extra_after[mx] ||
src = lc->edge_emu_buffer + buf_offset;
srcstride = edge_emu_stride;
}
- s->hevcdsp.put_hevc_qpel[my][mx](dst, dststride, src, srcstride, block_w,
- block_h, lc->mc_buffer);
+ s->hevcdsp.put_hevc_qpel[!!my][!!mx][pred_idx](dst, dststride, src, srcstride,
+ block_h, mx, my, lc->mc_buffer);
}
/**
*/
static void chroma_mc(HEVCContext *s, int16_t *dst1, int16_t *dst2,
ptrdiff_t dststride, AVFrame *ref, const Mv *mv,
- int x_off, int y_off, int block_w, int block_h)
+ int x_off, int y_off, int block_w, int block_h, int pred_idx)
{
HEVCLocalContext *lc = &s->HEVClc;
uint8_t *src1 = ref->data[1];
x_off += mv->x >> 3;
y_off += mv->y >> 3;
- src1 += y_off * src1stride + (x_off << s->ps.sps->pixel_shift);
- src2 += y_off * src2stride + (x_off << s->ps.sps->pixel_shift);
+ src1 += y_off * src1stride + (x_off * (1 << s->ps.sps->pixel_shift));
+ src2 += y_off * src2stride + (x_off * (1 << s->ps.sps->pixel_shift));
if (x_off < EPEL_EXTRA_BEFORE || y_off < EPEL_EXTRA_AFTER ||
x_off >= pic_width - block_w - EPEL_EXTRA_AFTER ||
src1 = lc->edge_emu_buffer + buf_offset1;
src1stride = edge_emu_stride;
- s->hevcdsp.put_hevc_epel[!!my][!!mx](dst1, dststride, src1, src1stride,
- block_w, block_h, mx, my, lc->mc_buffer);
+ s->hevcdsp.put_hevc_epel[!!my][!!mx][pred_idx](dst1, dststride, src1, src1stride,
+ block_h, mx, my, lc->mc_buffer);
s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src2 - offset2,
edge_emu_stride, src2stride,
src2 = lc->edge_emu_buffer + buf_offset2;
src2stride = edge_emu_stride;
- s->hevcdsp.put_hevc_epel[!!my][!!mx](dst2, dststride, src2, src2stride,
- block_w, block_h, mx, my,
- lc->mc_buffer);
+ s->hevcdsp.put_hevc_epel[!!my][!!mx][pred_idx](dst2, dststride, src2, src2stride,
+ block_h, mx, my, lc->mc_buffer);
} else {
- s->hevcdsp.put_hevc_epel[!!my][!!mx](dst1, dststride, src1, src1stride,
- block_w, block_h, mx, my,
- lc->mc_buffer);
- s->hevcdsp.put_hevc_epel[!!my][!!mx](dst2, dststride, src2, src2stride,
- block_w, block_h, mx, my,
- lc->mc_buffer);
+ s->hevcdsp.put_hevc_epel[!!my][!!mx][pred_idx](dst1, dststride, src1, src1stride,
+ block_h, mx, my, lc->mc_buffer);
+ s->hevcdsp.put_hevc_epel[!!my][!!mx][pred_idx](dst2, dststride, src2, src2stride,
+ block_h, mx, my, lc->mc_buffer);
}
}
int nPbW, int nPbH,
int log2_cb_size, int partIdx)
{
+ static const int pred_indices[] = {
+ [4] = 0, [8] = 1, [12] = 2, [16] = 3, [24] = 4, [32] = 5, [48] = 6, [64] = 7,
+ };
+ const int pred_idx = pred_indices[nPbW];
+
#define POS(c_idx, x, y) \
&s->frame->data[c_idx][((y) >> s->ps.sps->vshift[c_idx]) * s->frame->linesize[c_idx] + \
(((x) >> s->ps.sps->hshift[c_idx]) << s->ps.sps->pixel_shift)]
RefPicList *refPicList = s->ref->refPicList;
HEVCFrame *ref0, *ref1;
- int tmpstride = MAX_PB_SIZE;
+ int tmpstride = MAX_PB_SIZE * sizeof(int16_t);
uint8_t *dst0 = POS(0, x0, y0);
uint8_t *dst1 = POS(1, x0, y0);
DECLARE_ALIGNED(16, int16_t, tmp2[MAX_PB_SIZE * MAX_PB_SIZE]);
luma_mc(s, tmp, tmpstride, ref0->frame,
- ¤t_mv.mv[0], x0, y0, nPbW, nPbH);
+ ¤t_mv.mv[0], x0, y0, nPbW, nPbH, pred_idx);
if ((s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) ||
(s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag)) {
- s->hevcdsp.weighted_pred(s->sh.luma_log2_weight_denom,
- s->sh.luma_weight_l0[current_mv.ref_idx[0]],
- s->sh.luma_offset_l0[current_mv.ref_idx[0]],
- dst0, s->frame->linesize[0], tmp,
- tmpstride, nPbW, nPbH);
+ s->hevcdsp.weighted_pred[pred_idx](s->sh.luma_log2_weight_denom,
+ s->sh.luma_weight_l0[current_mv.ref_idx[0]],
+ s->sh.luma_offset_l0[current_mv.ref_idx[0]],
+ dst0, s->frame->linesize[0], tmp,
+ tmpstride, nPbH);
} else {
- s->hevcdsp.put_unweighted_pred(dst0, s->frame->linesize[0], tmp, tmpstride, nPbW, nPbH);
+ s->hevcdsp.put_unweighted_pred[pred_idx](dst0, s->frame->linesize[0], tmp, tmpstride, nPbH);
}
chroma_mc(s, tmp, tmp2, tmpstride, ref0->frame,
- ¤t_mv.mv[0], x0 / 2, y0 / 2, nPbW / 2, nPbH / 2);
+ ¤t_mv.mv[0], x0 / 2, y0 / 2, nPbW / 2, nPbH / 2, pred_idx);
if ((s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) ||
(s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag)) {
- s->hevcdsp.weighted_pred(s->sh.chroma_log2_weight_denom,
- s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0],
- s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0],
- dst1, s->frame->linesize[1], tmp, tmpstride,
- nPbW / 2, nPbH / 2);
- s->hevcdsp.weighted_pred(s->sh.chroma_log2_weight_denom,
- s->sh.chroma_weight_l0[current_mv.ref_idx[0]][1],
- s->sh.chroma_offset_l0[current_mv.ref_idx[0]][1],
- dst2, s->frame->linesize[2], tmp2, tmpstride,
- nPbW / 2, nPbH / 2);
+ s->hevcdsp.weighted_pred_chroma[pred_idx](s->sh.chroma_log2_weight_denom,
+ s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0],
+ s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0],
+ dst1, s->frame->linesize[1], tmp, tmpstride,
+ nPbH / 2);
+ s->hevcdsp.weighted_pred_chroma[pred_idx](s->sh.chroma_log2_weight_denom,
+ s->sh.chroma_weight_l0[current_mv.ref_idx[0]][1],
+ s->sh.chroma_offset_l0[current_mv.ref_idx[0]][1],
+ dst2, s->frame->linesize[2], tmp2, tmpstride,
+ nPbH / 2);
} else {
- s->hevcdsp.put_unweighted_pred(dst1, s->frame->linesize[1], tmp, tmpstride, nPbW/2, nPbH/2);
- s->hevcdsp.put_unweighted_pred(dst2, s->frame->linesize[2], tmp2, tmpstride, nPbW/2, nPbH/2);
+ s->hevcdsp.put_unweighted_pred_chroma[pred_idx](dst1, s->frame->linesize[1], tmp, tmpstride, nPbH / 2);
+ s->hevcdsp.put_unweighted_pred_chroma[pred_idx](dst2, s->frame->linesize[2], tmp2, tmpstride, nPbH / 2);
}
} else if (!current_mv.pred_flag[0] && current_mv.pred_flag[1]) {
DECLARE_ALIGNED(16, int16_t, tmp [MAX_PB_SIZE * MAX_PB_SIZE]);
DECLARE_ALIGNED(16, int16_t, tmp2[MAX_PB_SIZE * MAX_PB_SIZE]);
luma_mc(s, tmp, tmpstride, ref1->frame,
- ¤t_mv.mv[1], x0, y0, nPbW, nPbH);
+ ¤t_mv.mv[1], x0, y0, nPbW, nPbH, pred_idx);
if ((s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) ||
(s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag)) {
- s->hevcdsp.weighted_pred(s->sh.luma_log2_weight_denom,
- s->sh.luma_weight_l1[current_mv.ref_idx[1]],
- s->sh.luma_offset_l1[current_mv.ref_idx[1]],
- dst0, s->frame->linesize[0], tmp, tmpstride,
- nPbW, nPbH);
+ s->hevcdsp.weighted_pred[pred_idx](s->sh.luma_log2_weight_denom,
+ s->sh.luma_weight_l1[current_mv.ref_idx[1]],
+ s->sh.luma_offset_l1[current_mv.ref_idx[1]],
+ dst0, s->frame->linesize[0], tmp, tmpstride,
+ nPbH);
} else {
- s->hevcdsp.put_unweighted_pred(dst0, s->frame->linesize[0], tmp, tmpstride, nPbW, nPbH);
+ s->hevcdsp.put_unweighted_pred[pred_idx](dst0, s->frame->linesize[0], tmp, tmpstride, nPbH);
}
chroma_mc(s, tmp, tmp2, tmpstride, ref1->frame,
- ¤t_mv.mv[1], x0/2, y0/2, nPbW/2, nPbH/2);
+ ¤t_mv.mv[1], x0 / 2, y0 / 2, nPbW / 2, nPbH / 2, pred_idx);
if ((s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) ||
(s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag)) {
- s->hevcdsp.weighted_pred(s->sh.chroma_log2_weight_denom,
- s->sh.chroma_weight_l1[current_mv.ref_idx[1]][0],
- s->sh.chroma_offset_l1[current_mv.ref_idx[1]][0],
- dst1, s->frame->linesize[1], tmp, tmpstride, nPbW/2, nPbH/2);
- s->hevcdsp.weighted_pred(s->sh.chroma_log2_weight_denom,
- s->sh.chroma_weight_l1[current_mv.ref_idx[1]][1],
- s->sh.chroma_offset_l1[current_mv.ref_idx[1]][1],
- dst2, s->frame->linesize[2], tmp2, tmpstride, nPbW/2, nPbH/2);
+ s->hevcdsp.weighted_pred_chroma[pred_idx](s->sh.chroma_log2_weight_denom,
+ s->sh.chroma_weight_l1[current_mv.ref_idx[1]][0],
+ s->sh.chroma_offset_l1[current_mv.ref_idx[1]][0],
+ dst1, s->frame->linesize[1], tmp, tmpstride, nPbH/2);
+ s->hevcdsp.weighted_pred_chroma[pred_idx](s->sh.chroma_log2_weight_denom,
+ s->sh.chroma_weight_l1[current_mv.ref_idx[1]][1],
+ s->sh.chroma_offset_l1[current_mv.ref_idx[1]][1],
+ dst2, s->frame->linesize[2], tmp2, tmpstride, nPbH/2);
} else {
- s->hevcdsp.put_unweighted_pred(dst1, s->frame->linesize[1], tmp, tmpstride, nPbW/2, nPbH/2);
- s->hevcdsp.put_unweighted_pred(dst2, s->frame->linesize[2], tmp2, tmpstride, nPbW/2, nPbH/2);
+ s->hevcdsp.put_unweighted_pred_chroma[pred_idx](dst1, s->frame->linesize[1], tmp, tmpstride, nPbH / 2);
+ s->hevcdsp.put_unweighted_pred_chroma[pred_idx](dst2, s->frame->linesize[2], tmp2, tmpstride, nPbH / 2);
}
} else if (current_mv.pred_flag[0] && current_mv.pred_flag[1]) {
DECLARE_ALIGNED(16, int16_t, tmp [MAX_PB_SIZE * MAX_PB_SIZE]);
DECLARE_ALIGNED(16, int16_t, tmp4[MAX_PB_SIZE * MAX_PB_SIZE]);
luma_mc(s, tmp, tmpstride, ref0->frame,
- ¤t_mv.mv[0], x0, y0, nPbW, nPbH);
+ ¤t_mv.mv[0], x0, y0, nPbW, nPbH, pred_idx);
luma_mc(s, tmp2, tmpstride, ref1->frame,
- ¤t_mv.mv[1], x0, y0, nPbW, nPbH);
+ ¤t_mv.mv[1], x0, y0, nPbW, nPbH, pred_idx);
if ((s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) ||
(s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag)) {
- s->hevcdsp.weighted_pred_avg(s->sh.luma_log2_weight_denom,
- s->sh.luma_weight_l0[current_mv.ref_idx[0]],
- s->sh.luma_weight_l1[current_mv.ref_idx[1]],
- s->sh.luma_offset_l0[current_mv.ref_idx[0]],
- s->sh.luma_offset_l1[current_mv.ref_idx[1]],
- dst0, s->frame->linesize[0],
- tmp, tmp2, tmpstride, nPbW, nPbH);
+ s->hevcdsp.weighted_pred_avg[pred_idx](s->sh.luma_log2_weight_denom,
+ s->sh.luma_weight_l0[current_mv.ref_idx[0]],
+ s->sh.luma_weight_l1[current_mv.ref_idx[1]],
+ s->sh.luma_offset_l0[current_mv.ref_idx[0]],
+ s->sh.luma_offset_l1[current_mv.ref_idx[1]],
+ dst0, s->frame->linesize[0],
+ tmp, tmp2, tmpstride, nPbH);
} else {
- s->hevcdsp.put_weighted_pred_avg(dst0, s->frame->linesize[0],
- tmp, tmp2, tmpstride, nPbW, nPbH);
+ s->hevcdsp.put_unweighted_pred_avg[pred_idx](dst0, s->frame->linesize[0],
+ tmp, tmp2, tmpstride, nPbH);
}
chroma_mc(s, tmp, tmp2, tmpstride, ref0->frame,
- ¤t_mv.mv[0], x0 / 2, y0 / 2, nPbW / 2, nPbH / 2);
+ ¤t_mv.mv[0], x0 / 2, y0 / 2, nPbW / 2, nPbH / 2, pred_idx);
chroma_mc(s, tmp3, tmp4, tmpstride, ref1->frame,
- ¤t_mv.mv[1], x0 / 2, y0 / 2, nPbW / 2, nPbH / 2);
+ ¤t_mv.mv[1], x0 / 2, y0 / 2, nPbW / 2, nPbH / 2, pred_idx);
if ((s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) ||
(s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag)) {
- s->hevcdsp.weighted_pred_avg(s->sh.chroma_log2_weight_denom,
- s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0],
- s->sh.chroma_weight_l1[current_mv.ref_idx[1]][0],
- s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0],
- s->sh.chroma_offset_l1[current_mv.ref_idx[1]][0],
- dst1, s->frame->linesize[1], tmp, tmp3,
- tmpstride, nPbW / 2, nPbH / 2);
- s->hevcdsp.weighted_pred_avg(s->sh.chroma_log2_weight_denom,
- s->sh.chroma_weight_l0[current_mv.ref_idx[0]][1],
- s->sh.chroma_weight_l1[current_mv.ref_idx[1]][1],
- s->sh.chroma_offset_l0[current_mv.ref_idx[0]][1],
- s->sh.chroma_offset_l1[current_mv.ref_idx[1]][1],
- dst2, s->frame->linesize[2], tmp2, tmp4,
- tmpstride, nPbW / 2, nPbH / 2);
+ s->hevcdsp.weighted_pred_avg_chroma[pred_idx](s->sh.chroma_log2_weight_denom,
+ s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0],
+ s->sh.chroma_weight_l1[current_mv.ref_idx[1]][0],
+ s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0],
+ s->sh.chroma_offset_l1[current_mv.ref_idx[1]][0],
+ dst1, s->frame->linesize[1], tmp, tmp3,
+ tmpstride, nPbH / 2);
+ s->hevcdsp.weighted_pred_avg_chroma[pred_idx](s->sh.chroma_log2_weight_denom,
+ s->sh.chroma_weight_l0[current_mv.ref_idx[0]][1],
+ s->sh.chroma_weight_l1[current_mv.ref_idx[1]][1],
+ s->sh.chroma_offset_l0[current_mv.ref_idx[0]][1],
+ s->sh.chroma_offset_l1[current_mv.ref_idx[1]][1],
+ dst2, s->frame->linesize[2], tmp2, tmp4,
+ tmpstride, nPbH / 2);
} else {
- s->hevcdsp.put_weighted_pred_avg(dst1, s->frame->linesize[1], tmp, tmp3, tmpstride, nPbW/2, nPbH/2);
- s->hevcdsp.put_weighted_pred_avg(dst2, s->frame->linesize[2], tmp2, tmp4, tmpstride, nPbW/2, nPbH/2);
+ s->hevcdsp.put_unweighted_pred_avg_chroma[pred_idx](dst1, s->frame->linesize[1], tmp, tmp3, tmpstride, nPbH/2);
+ s->hevcdsp.put_unweighted_pred_avg_chroma[pred_idx](dst2, s->frame->linesize[2], tmp2, tmp4, tmpstride, nPbH/2);
}
}
}
if (y_ctb > 0 && s->tab_slice_address[ctb_addr_rs] != s->tab_slice_address[ctb_addr_rs - s->ps.sps->ctb_width])
lc->boundary_flags |= BOUNDARY_UPPER_SLICE;
} else {
- if (!ctb_addr_in_slice > 0)
+ if (!ctb_addr_in_slice)
lc->boundary_flags |= BOUNDARY_LEFT_SLICE;
if (ctb_addr_in_slice < s->ps.sps->ctb_width)
lc->boundary_flags |= BOUNDARY_UPPER_SLICE;
return ret;
}
-static int decode_nal_unit(HEVCContext *s, const HEVCNAL *nal)
+static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
{
HEVCLocalContext *lc = &s->HEVClc;
GetBitContext *gb = &lc->gb;
/* split the input packet into NAL units, so we know the upper bound on the
* number of slices in the frame */
- ret = ff_hevc_split_packet(&s->pkt, buf, length, s->avctx, s->is_nalff,
- s->nal_length_size);
+ ret = ff_h2645_packet_split(&s->pkt, buf, length, s->avctx, s->is_nalff,
+ s->nal_length_size, s->avctx->codec_id);
if (ret < 0) {
av_log(s->avctx, AV_LOG_ERROR,
"Error splitting the input into NAL units.\n");
if (!desc)
return AVERROR(EINVAL);
- pixel_shift = desc->comp[0].depth_minus1 > 7;
+ pixel_shift = desc->comp[0].depth > 8;
av_log(s->avctx, AV_LOG_DEBUG, "Verifying checksum for frame with POC %d: ",
s->poc);
for (i = 0; i < FF_ARRAY_ELEMS(s->ps.pps_list); i++)
av_buffer_unref(&s->ps.pps_list[i]);
- for (i = 0; i < s->pkt.nals_allocated; i++)
- av_freep(&s->pkt.nals[i].rbsp_buffer);
- av_freep(&s->pkt.nals);
- s->pkt.nals_allocated = 0;
+ ff_h2645_packet_uninit(&s->pkt);
return 0;
}
HEVCContext *s = avctx->priv_data;
int ret;
- ff_init_cabac_states();
-
avctx->internal->allocate_progress = 1;
ret = hevc_init_context(avctx);
#define OFFSET(x) offsetof(HEVCContext, x)
#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
-static const AVProfile profiles[] = {
- { FF_PROFILE_HEVC_MAIN, "Main" },
- { FF_PROFILE_HEVC_MAIN_10, "Main 10" },
- { FF_PROFILE_HEVC_MAIN_STILL_PICTURE, "Main Still Picture" },
- { FF_PROFILE_UNKNOWN },
-};
-
static const AVOption options[] = {
{ "apply_defdispwin", "Apply default display window from VUI", OFFSET(apply_defdispwin),
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, PAR },
.flush = hevc_decode_flush,
.update_thread_context = hevc_update_thread_context,
.init_thread_copy = hevc_init_thread_copy,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY |
- CODEC_CAP_FRAME_THREADS,
- .profiles = NULL_IF_CONFIG_SMALL(profiles),
+ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
+ AV_CODEC_CAP_FRAME_THREADS,
+ .profiles = NULL_IF_CONFIG_SMALL(ff_hevc_profiles),
};