1417
1420
int stride2 = s->frame->linesize[2];
1418
1421
uint8_t *dst2 = &s->frame->data[2][(y0 >> s->sps->vshift[2]) * stride2 + ((x0 >> s->sps->hshift[2]) << s->sps->pixel_shift)];
1420
int length = cb_size * cb_size * s->sps->pcm.bit_depth + ((cb_size * cb_size) >> 1) * s->sps->pcm.bit_depth;
1423
int length = cb_size * cb_size * s->sps->pcm.bit_depth + ((cb_size * cb_size) >> 1) * s->sps->pcm.bit_depth_chroma;
1421
1424
const uint8_t *pcm = skip_bytes(&s->HEVClc.cc, (length + 7) >> 3);
1432
1435
s->hevcdsp.put_pcm(dst0, stride0, cb_size, &gb, s->sps->pcm.bit_depth);
1433
s->hevcdsp.put_pcm(dst1, stride1, cb_size / 2, &gb, s->sps->pcm.bit_depth);
1434
s->hevcdsp.put_pcm(dst2, stride2, cb_size / 2, &gb, s->sps->pcm.bit_depth);
1436
s->hevcdsp.put_pcm(dst1, stride1, cb_size / 2, &gb, s->sps->pcm.bit_depth_chroma);
1437
s->hevcdsp.put_pcm(dst2, stride2, cb_size / 2, &gb, s->sps->pcm.bit_depth_chroma);
1494
1497
if (x_off < extra_left || y_off < extra_top ||
1495
1498
x_off >= pic_width - block_w - ff_hevc_qpel_extra_after[mx] ||
1496
1499
y_off >= pic_height - block_h - ff_hevc_qpel_extra_after[my]) {
1500
const int edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->sps->pixel_shift;
1497
1501
int offset = extra_top * srcstride + (extra_left << s->sps->pixel_shift);
1502
int buf_offset = extra_top *
1503
edge_emu_stride + (extra_left << s->sps->pixel_shift);
1499
1505
s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src - offset,
1500
srcstride, srcstride,
1506
edge_emu_stride, srcstride,
1501
1507
block_w + ff_hevc_qpel_extra[mx],
1502
1508
block_h + ff_hevc_qpel_extra[my],
1503
1509
x_off - extra_left, y_off - extra_top,
1504
1510
pic_width, pic_height);
1505
src = lc->edge_emu_buffer + offset;
1511
src = lc->edge_emu_buffer + buf_offset;
1512
srcstride = edge_emu_stride;
1507
1514
s->hevcdsp.put_hevc_qpel[my][mx](dst, dststride, src, srcstride, block_w,
1508
1515
block_h, lc->mc_buffer);
1545
1552
if (x_off < EPEL_EXTRA_BEFORE || y_off < EPEL_EXTRA_AFTER ||
1546
1553
x_off >= pic_width - block_w - EPEL_EXTRA_AFTER ||
1547
1554
y_off >= pic_height - block_h - EPEL_EXTRA_AFTER) {
1555
const int edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->sps->pixel_shift;
1548
1556
int offset1 = EPEL_EXTRA_BEFORE * (src1stride + (1 << s->sps->pixel_shift));
1557
int buf_offset1 = EPEL_EXTRA_BEFORE *
1558
(edge_emu_stride + (1 << s->sps->pixel_shift));
1549
1559
int offset2 = EPEL_EXTRA_BEFORE * (src2stride + (1 << s->sps->pixel_shift));
1560
int buf_offset2 = EPEL_EXTRA_BEFORE *
1561
(edge_emu_stride + (1 << s->sps->pixel_shift));
1551
1563
s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src1 - offset1,
1552
src1stride, src1stride,
1564
edge_emu_stride, src1stride,
1553
1565
block_w + EPEL_EXTRA, block_h + EPEL_EXTRA,
1554
1566
x_off - EPEL_EXTRA_BEFORE,
1555
1567
y_off - EPEL_EXTRA_BEFORE,
1556
1568
pic_width, pic_height);
1558
src1 = lc->edge_emu_buffer + offset1;
1570
src1 = lc->edge_emu_buffer + buf_offset1;
1571
src1stride = edge_emu_stride;
1559
1572
s->hevcdsp.put_hevc_epel[!!my][!!mx](dst1, dststride, src1, src1stride,
1560
1573
block_w, block_h, mx, my, lc->mc_buffer);
1562
1575
s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src2 - offset2,
1563
src2stride, src2stride,
1576
edge_emu_stride, src2stride,
1564
1577
block_w + EPEL_EXTRA, block_h + EPEL_EXTRA,
1565
1578
x_off - EPEL_EXTRA_BEFORE,
1566
1579
y_off - EPEL_EXTRA_BEFORE,
1567
1580
pic_width, pic_height);
1568
src2 = lc->edge_emu_buffer + offset2;
1581
src2 = lc->edge_emu_buffer + buf_offset2;
1582
src2stride = edge_emu_stride;
1569
1584
s->hevcdsp.put_hevc_epel[!!my][!!mx](dst2, dststride, src2, src2stride,
1570
1585
block_w, block_h, mx, my,
1571
1586
lc->mc_buffer);
2421
av_fast_malloc(&lc->edge_emu_buffer, &lc->edge_emu_buffer_size,
2422
(MAX_PB_SIZE + 7) * s->ref->frame->linesize[0]);
2423
if (!lc->edge_emu_buffer) {
2424
ret = AVERROR(ENOMEM);
2428
2436
ret = ff_hevc_frame_rps(s);
2430
2438
av_log(s->avctx, AV_LOG_ERROR, "Error constructing the frame RPS.\n");
3171
3177
#define OFFSET(x) offsetof(HEVCContext, x)
3172
3178
#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
3180
static const AVProfile profiles[] = {
3181
{ FF_PROFILE_HEVC_MAIN, "Main" },
3182
{ FF_PROFILE_HEVC_MAIN_10, "Main 10" },
3183
{ FF_PROFILE_HEVC_MAIN_STILL_PICTURE, "Main Still Picture" },
3184
{ FF_PROFILE_UNKNOWN },
3173
3187
static const AVOption options[] = {
3174
3188
{ "apply_defdispwin", "Apply default display window from VUI", OFFSET(apply_defdispwin),
3175
3189
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, PAR },