~ubuntu-branches/ubuntu/utopic/libav/utopic-proposed

« back to all changes in this revision

Viewing changes to libavcodec/vaapi_h264.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler, Reinhard Tartler, Rico Tzschichholz
  • Date: 2014-08-30 11:02:45 UTC
  • mfrom: (1.3.47 sid)
  • Revision ID: package-import@ubuntu.com-20140830110245-io3dg7q85wfr7125
Tags: 6:11~beta1-2
[ Reinhard Tartler ]
* Make libavcodec-dev depend on libavresample-dev

[ Rico Tzschichholz ]
* Some fixes and leftovers from soname bumps

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
#include "vaapi_internal.h"
24
24
#include "h264.h"
 
25
#include "mpegutils.h"
25
26
 
26
27
/**
27
28
 * @file
51
52
 *                             supersedes pic's field type if nonzero.
52
53
 */
53
54
static void fill_vaapi_pic(VAPictureH264 *va_pic,
54
 
                           Picture       *pic,
 
55
                           H264Picture   *pic,
55
56
                           int            pic_structure)
56
57
{
57
58
    if (pic_structure == 0)
58
59
        pic_structure = pic->reference;
59
60
    pic_structure &= PICT_FRAME; /* PICT_TOP_FIELD|PICT_BOTTOM_FIELD */
60
61
 
61
 
    va_pic->picture_id = ff_vaapi_get_surface_id(pic);
 
62
    va_pic->picture_id = ff_vaapi_get_surface_id(&pic->f);
62
63
    va_pic->frame_idx  = pic->long_ref ? pic->pic_id : pic->frame_num;
63
64
 
64
65
    va_pic->flags      = 0;
89
90
 * available.  The decoded picture buffer's size must be large enough
90
91
 * to receive the new VA API picture object.
91
92
 */
92
 
static int dpb_add(DPB *dpb, Picture *pic)
 
93
static int dpb_add(DPB *dpb, H264Picture *pic)
93
94
{
94
95
    int i;
95
96
 
98
99
 
99
100
    for (i = 0; i < dpb->size; i++) {
100
101
        VAPictureH264 * const va_pic = &dpb->va_pics[i];
101
 
        if (va_pic->picture_id == ff_vaapi_get_surface_id(pic)) {
 
102
        if (va_pic->picture_id == ff_vaapi_get_surface_id(&pic->f)) {
102
103
            VAPictureH264 temp_va_pic;
103
104
            fill_vaapi_pic(&temp_va_pic, pic, 0);
104
105
 
133
134
        init_vaapi_pic(&dpb.va_pics[i]);
134
135
 
135
136
    for (i = 0; i < h->short_ref_count; i++) {
136
 
        Picture * const pic = h->short_ref[i];
 
137
        H264Picture * const pic = h->short_ref[i];
137
138
        if (pic && pic->reference && dpb_add(&dpb, pic) < 0)
138
139
            return -1;
139
140
    }
140
141
 
141
142
    for (i = 0; i < 16; i++) {
142
 
        Picture * const pic = h->long_ref[i];
 
143
        H264Picture * const pic = h->long_ref[i];
143
144
        if (pic && pic->reference && dpb_add(&dpb, pic) < 0)
144
145
            return -1;
145
146
    }
155
156
 * @param[in]  ref_count   The number of reference pictures in ref_list
156
157
 */
157
158
static void fill_vaapi_RefPicList(VAPictureH264 RefPicList[32],
158
 
                                  Picture      *ref_list,
 
159
                                  H264Picture  *ref_list,
159
160
                                  unsigned int  ref_count)
160
161
{
161
162
    unsigned int i, n = 0;
281
282
    if (!iq_matrix)
282
283
        return -1;
283
284
    memcpy(iq_matrix->ScalingList4x4, h->pps.scaling_matrix4, sizeof(iq_matrix->ScalingList4x4));
284
 
    memcpy(iq_matrix->ScalingList8x8, h->pps.scaling_matrix8, sizeof(iq_matrix->ScalingList8x8));
 
285
    memcpy(iq_matrix->ScalingList8x8[0], h->pps.scaling_matrix8[0], sizeof(iq_matrix->ScalingList8x8[0]));
 
286
    memcpy(iq_matrix->ScalingList8x8[1], h->pps.scaling_matrix8[3], sizeof(iq_matrix->ScalingList8x8[0]));
285
287
    return 0;
286
288
}
287
289
 
297
299
    if (ret < 0)
298
300
        goto finish;
299
301
 
300
 
    ret = ff_vaapi_render_picture(vactx, ff_vaapi_get_surface_id(h->cur_pic_ptr));
 
302
    ret = ff_vaapi_render_picture(vactx, ff_vaapi_get_surface_id(&h->cur_pic_ptr->f));
301
303
    if (ret < 0)
302
304
        goto finish;
303
305
 
332
334
    slice_param->cabac_init_idc                 = h->cabac_init_idc;
333
335
    slice_param->slice_qp_delta                 = h->qscale - h->pps.init_qp;
334
336
    slice_param->disable_deblocking_filter_idc  = h->deblocking_filter < 2 ? !h->deblocking_filter : h->deblocking_filter;
335
 
    slice_param->slice_alpha_c0_offset_div2     = h->slice_alpha_c0_offset / 2 - 26;
336
 
    slice_param->slice_beta_offset_div2         = h->slice_beta_offset     / 2 - 26;
 
337
    slice_param->slice_alpha_c0_offset_div2     = h->slice_alpha_c0_offset / 2;
 
338
    slice_param->slice_beta_offset_div2         = h->slice_beta_offset     / 2;
337
339
    slice_param->luma_log2_weight_denom         = h->luma_log2_weight_denom;
338
340
    slice_param->chroma_log2_weight_denom       = h->chroma_log2_weight_denom;
339
341