~siretart/libav/merge.raring.libav-0.8.6

« back to all changes in this revision

Viewing changes to libavcodec/h264_direct.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-01-12 22:30:00 UTC
  • mfrom: (1.4.1)
  • mto: (1.3.11 sid) (26.1.1 quantal-security)
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: package-import@ubuntu.com-20120112223000-s1reiy1e28hnix42
Tags: upstream-0.8~beta2
ImportĀ upstreamĀ versionĀ 0.8~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
                poc= (poc&~3) + rfield + 1;
88
88
 
89
89
            for(j=start; j<end; j++){
90
 
                if(4*h->ref_list[0][j].frame_num + (h->ref_list[0][j].reference&3) == poc){
 
90
                if (4 * h->ref_list[0][j].frame_num + (h->ref_list[0][j].f.reference & 3) == poc) {
91
91
                    int cur_ref= mbafi ? (j-16)^field : j;
92
92
                    map[list][2*old_ref + (rfield^field) + 16] = cur_ref;
93
93
                    if(rfield == field || !interl)
105
105
    Picture * const cur = s->current_picture_ptr;
106
106
    int list, j, field;
107
107
    int sidx= (s->picture_structure&1)^1;
108
 
    int ref1sidx= (ref1->reference&1)^1;
 
108
    int ref1sidx = (ref1->f.reference&1)^1;
109
109
 
110
110
    for(list=0; list<2; list++){
111
111
        cur->ref_count[sidx][list] = h->ref_count[list];
112
112
        for(j=0; j<h->ref_count[list]; j++)
113
 
            cur->ref_poc[sidx][list][j] = 4*h->ref_list[list][j].frame_num + (h->ref_list[list][j].reference&3);
 
113
            cur->ref_poc[sidx][list][j] = 4 * h->ref_list[list][j].frame_num + (h->ref_list[list][j].f.reference & 3);
114
114
    }
115
115
 
116
116
    if(s->picture_structure == PICT_FRAME){
126
126
        int *col_poc = h->ref_list[1]->field_poc;
127
127
        h->col_parity= (FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc));
128
128
        ref1sidx=sidx= h->col_parity;
129
 
    }else if(!(s->picture_structure & h->ref_list[1][0].reference) && !h->ref_list[1][0].mbaff){ // FL -> FL & differ parity
130
 
        h->col_fieldoff= 2*(h->ref_list[1][0].reference) - 3;
 
129
    } else if (!(s->picture_structure & h->ref_list[1][0].f.reference) && !h->ref_list[1][0].mbaff) { // FL -> FL & differ parity
 
130
        h->col_fieldoff = 2 * h->ref_list[1][0].f.reference - 3;
131
131
    }
132
132
 
133
 
    if(cur->pict_type != AV_PICTURE_TYPE_B || h->direct_spatial_mv_pred)
 
133
    if (cur->f.pict_type != AV_PICTURE_TYPE_B || h->direct_spatial_mv_pred)
134
134
        return;
135
135
 
136
136
    for(list=0; list<2; list++){
143
143
 
144
144
static void await_reference_mb_row(H264Context * const h, Picture *ref, int mb_y)
145
145
{
146
 
    int ref_field = ref->reference - 1;
 
146
    int ref_field = ref->f.reference - 1;
147
147
    int ref_field_picture = ref->field_picture;
148
148
    int ref_height = 16*h->s.mb_height >> ref_field_picture;
149
149
 
150
 
    if(!HAVE_PTHREADS || !(h->s.avctx->active_thread_type&FF_THREAD_FRAME))
 
150
    if(!HAVE_THREADS || !(h->s.avctx->active_thread_type&FF_THREAD_FRAME))
151
151
        return;
152
152
 
153
153
    //FIXME it can be safe to access mb stuff
172
172
    int mv[2];
173
173
    int list;
174
174
 
175
 
    assert(h->ref_list[1][0].reference&3);
 
175
    assert(h->ref_list[1][0].f.reference & 3);
176
176
 
177
177
    await_reference_mb_row(h, &h->ref_list[1][0], s->mb_y + !!IS_INTERLACED(*mb_type));
178
178
 
234
234
        return;
235
235
    }
236
236
 
237
 
    if(IS_INTERLACED(h->ref_list[1][0].mb_type[mb_xy])){ // AFL/AFR/FR/FL -> AFL/FL
238
 
        if(!IS_INTERLACED(*mb_type)){                    //     AFR/FR    -> AFL/FL
 
237
    if (IS_INTERLACED(h->ref_list[1][0].f.mb_type[mb_xy])) { // AFL/AFR/FR/FL -> AFL/FL
 
238
        if (!IS_INTERLACED(*mb_type)) {                          //     AFR/FR    -> AFL/FL
239
239
            mb_y = (s->mb_y&~1) + h->col_parity;
240
240
            mb_xy= s->mb_x + ((s->mb_y&~1) + h->col_parity)*s->mb_stride;
241
241
            b8_stride = 0;
248
248
        if(IS_INTERLACED(*mb_type)){                     // AFL       /FL -> AFR/FR
249
249
            mb_y = s->mb_y&~1;
250
250
            mb_xy= s->mb_x + (s->mb_y&~1)*s->mb_stride;
251
 
            mb_type_col[0] = h->ref_list[1][0].mb_type[mb_xy];
252
 
            mb_type_col[1] = h->ref_list[1][0].mb_type[mb_xy + s->mb_stride];
 
251
            mb_type_col[0] = h->ref_list[1][0].f.mb_type[mb_xy];
 
252
            mb_type_col[1] = h->ref_list[1][0].f.mb_type[mb_xy + s->mb_stride];
253
253
            b8_stride = 2+4*s->mb_stride;
254
254
            b4_stride *= 6;
255
255
 
264
264
        }else{                                           //     AFR/FR    -> AFR/FR
265
265
single_col:
266
266
            mb_type_col[0] =
267
 
            mb_type_col[1] = h->ref_list[1][0].mb_type[mb_xy];
 
267
            mb_type_col[1] = h->ref_list[1][0].f.mb_type[mb_xy];
268
268
 
269
269
            sub_mb_type |= MB_TYPE_16x16|MB_TYPE_DIRECT2; /* B_SUB_8x8 */
270
270
            if(!is_b8x8 && (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)){
284
284
 
285
285
    await_reference_mb_row(h, &h->ref_list[1][0], mb_y);
286
286
 
287
 
    l1mv0  = &h->ref_list[1][0].motion_val[0][h->mb2b_xy [mb_xy]];
288
 
    l1mv1  = &h->ref_list[1][0].motion_val[1][h->mb2b_xy [mb_xy]];
289
 
    l1ref0 = &h->ref_list[1][0].ref_index [0][4*mb_xy];
290
 
    l1ref1 = &h->ref_list[1][0].ref_index [1][4*mb_xy];
 
287
    l1mv0  = &h->ref_list[1][0].f.motion_val[0][h->mb2b_xy [mb_xy]];
 
288
    l1mv1  = &h->ref_list[1][0].f.motion_val[1][h->mb2b_xy [mb_xy]];
 
289
    l1ref0 = &h->ref_list[1][0].f.ref_index [0][4 * mb_xy];
 
290
    l1ref1 = &h->ref_list[1][0].f.ref_index [1][4 * mb_xy];
291
291
    if(!b8_stride){
292
292
        if(s->mb_y&1){
293
293
            l1ref0 += 2;
416
416
    unsigned int sub_mb_type;
417
417
    int i8, i4;
418
418
 
419
 
    assert(h->ref_list[1][0].reference&3);
 
419
    assert(h->ref_list[1][0].f.reference & 3);
420
420
 
421
421
    await_reference_mb_row(h, &h->ref_list[1][0], s->mb_y + !!IS_INTERLACED(*mb_type));
422
422
 
423
 
    if(IS_INTERLACED(h->ref_list[1][0].mb_type[mb_xy])){ // AFL/AFR/FR/FL -> AFL/FL
424
 
        if(!IS_INTERLACED(*mb_type)){                    //     AFR/FR    -> AFL/FL
 
423
    if (IS_INTERLACED(h->ref_list[1][0].f.mb_type[mb_xy])) { // AFL/AFR/FR/FL -> AFL/FL
 
424
        if (!IS_INTERLACED(*mb_type)) {                          //     AFR/FR    -> AFL/FL
425
425
            mb_y = (s->mb_y&~1) + h->col_parity;
426
426
            mb_xy= s->mb_x + ((s->mb_y&~1) + h->col_parity)*s->mb_stride;
427
427
            b8_stride = 0;
434
434
        if(IS_INTERLACED(*mb_type)){                     // AFL       /FL -> AFR/FR
435
435
            mb_y = s->mb_y&~1;
436
436
            mb_xy= s->mb_x + (s->mb_y&~1)*s->mb_stride;
437
 
            mb_type_col[0] = h->ref_list[1][0].mb_type[mb_xy];
438
 
            mb_type_col[1] = h->ref_list[1][0].mb_type[mb_xy + s->mb_stride];
 
437
            mb_type_col[0] = h->ref_list[1][0].f.mb_type[mb_xy];
 
438
            mb_type_col[1] = h->ref_list[1][0].f.mb_type[mb_xy + s->mb_stride];
439
439
            b8_stride = 2+4*s->mb_stride;
440
440
            b4_stride *= 6;
441
441
 
451
451
        }else{                                           //     AFR/FR    -> AFR/FR
452
452
single_col:
453
453
            mb_type_col[0] =
454
 
            mb_type_col[1] = h->ref_list[1][0].mb_type[mb_xy];
 
454
            mb_type_col[1] = h->ref_list[1][0].f.mb_type[mb_xy];
455
455
 
456
456
            sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */
457
457
            if(!is_b8x8 && (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)){
471
471
 
472
472
    await_reference_mb_row(h, &h->ref_list[1][0], mb_y);
473
473
 
474
 
    l1mv0  = &h->ref_list[1][0].motion_val[0][h->mb2b_xy [mb_xy]];
475
 
    l1mv1  = &h->ref_list[1][0].motion_val[1][h->mb2b_xy [mb_xy]];
476
 
    l1ref0 = &h->ref_list[1][0].ref_index [0][4*mb_xy];
477
 
    l1ref1 = &h->ref_list[1][0].ref_index [1][4*mb_xy];
 
474
    l1mv0  = &h->ref_list[1][0].f.motion_val[0][h->mb2b_xy [mb_xy]];
 
475
    l1mv1  = &h->ref_list[1][0].f.motion_val[1][h->mb2b_xy [mb_xy]];
 
476
    l1ref0 = &h->ref_list[1][0].f.ref_index [0][4 * mb_xy];
 
477
    l1ref1 = &h->ref_list[1][0].f.ref_index [1][4 * mb_xy];
478
478
    if(!b8_stride){
479
479
        if(s->mb_y&1){
480
480
            l1ref0 += 2;