~ubuntu-branches/debian/experimental/libav/experimental

« back to all changes in this revision

Viewing changes to libavcodec/hevc.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2014-01-18 15:46:55 UTC
  • mfrom: (1.1.24)
  • Revision ID: package-import@ubuntu.com-20140118154655-iz6u00yevkat1jqi
Tags: 6:10~alpha2-1
New Upstream release 10_alpha2. This upstream git snapshot has too many
changes to list here, cf. to the upstream Changelog:
http://git.libav.org/?p=libav.git;a=blob;f=Changelog;hb=refs/tags/v10_alpha2

Show diffs side-by-side

added added

removed removed

Lines of Context:
495
495
        s->max_ra     = INT_MAX;
496
496
    }
497
497
 
 
498
    s->avctx->profile = s->sps->ptl.general_ptl.profile_idc;
 
499
    s->avctx->level   = s->sps->ptl.general_ptl.level_idc;
 
500
 
498
501
    sh->dependent_slice_segment_flag = 0;
499
502
    if (!sh->first_slice_in_pic_flag) {
500
503
        int slice_address_length;
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)];
1419
1422
 
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);
1422
1425
    int ret;
1423
1426
 
1430
1433
        return ret;
1431
1434
 
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);
1435
1438
    return 0;
1436
1439
}
1437
1440
 
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);
1498
1504
 
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;
1506
1513
    }
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));
1550
1562
 
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);
1557
1569
 
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);
1561
1574
 
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;
 
1583
 
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);
2418
2433
    if (ret < 0)
2419
2434
        goto fail;
2420
2435
 
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);
2425
 
        goto fail;
2426
 
    }
2427
 
 
2428
2436
    ret = ff_hevc_frame_rps(s);
2429
2437
    if (ret < 0) {
2430
2438
        av_log(s->avctx, AV_LOG_ERROR, "Error constructing the frame RPS.\n");
2921
2929
static av_cold int hevc_decode_free(AVCodecContext *avctx)
2922
2930
{
2923
2931
    HEVCContext       *s = avctx->priv_data;
2924
 
    HEVCLocalContext *lc = &s->HEVClc;
2925
2932
    int i;
2926
2933
 
2927
2934
    pic_arrays_free(s);
2928
2935
 
2929
 
    av_freep(&lc->edge_emu_buffer);
2930
2936
    av_freep(&s->md5_ctx);
2931
2937
 
2932
2938
    av_frame_free(&s->tmp_frame);
3170
3176
 
3171
3177
#define OFFSET(x) offsetof(HEVCContext, x)
3172
3178
#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
 
3179
 
 
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 },
 
3185
};
 
3186
 
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 },
3198
3212
    .init_thread_copy      = hevc_init_thread_copy,
3199
3213
    .capabilities          = CODEC_CAP_DR1 | CODEC_CAP_DELAY |
3200
3214
                             CODEC_CAP_FRAME_THREADS,
 
3215
    .profiles              = NULL_IF_CONFIG_SMALL(profiles),
3201
3216
};