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

« back to all changes in this revision

Viewing changes to libavcodec/h261dec.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:
97
97
}
98
98
 
99
99
/**
100
 
 * decodes the group of blocks header or slice header.
 
100
 * Decode the group of blocks header or slice header.
101
101
 * @return <0 if an error occurred
102
102
 */
103
103
static int h261_decode_gob_header(H261Context *h){
136
136
 
137
137
    if(s->qscale==0) {
138
138
        av_log(s->avctx, AV_LOG_ERROR, "qscale has forbidden 0 value\n");
139
 
        if (s->avctx->error_recognition >= FF_ER_COMPLIANT)
 
139
        if (s->avctx->err_recognition & AV_EF_BITSTREAM)
140
140
            return -1;
141
141
    }
142
142
 
150
150
}
151
151
 
152
152
/**
153
 
 * decodes the group of blocks / video packet header.
 
153
 * Decode the group of blocks / video packet header.
154
154
 * @return <0 if no resync found
155
155
 */
156
156
static int ff_h261_resync(H261Context *h){
191
191
}
192
192
 
193
193
/**
194
 
 * decodes skipped macroblocks
 
194
 * Decode skipped macroblocks.
195
195
 * @return 0
196
196
 */
197
197
static int h261_decode_mb_skipped(H261Context *h, int mba1, int mba2 )
215
215
 
216
216
        s->mv_dir = MV_DIR_FORWARD;
217
217
        s->mv_type = MV_TYPE_16X16;
218
 
        s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
 
218
        s->current_picture.f.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
219
219
        s->mv[0][0][0] = 0;
220
220
        s->mv[0][0][1] = 0;
221
221
        s->mb_skipped = 1;
323
323
    }
324
324
 
325
325
    if(s->mb_intra){
326
 
        s->current_picture.mb_type[xy]= MB_TYPE_INTRA;
 
326
        s->current_picture.f.mb_type[xy] = MB_TYPE_INTRA;
327
327
        goto intra;
328
328
    }
329
329
 
330
330
    //set motion vectors
331
331
    s->mv_dir = MV_DIR_FORWARD;
332
332
    s->mv_type = MV_TYPE_16X16;
333
 
    s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0;
 
333
    s->current_picture.f.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0;
334
334
    s->mv[0][0][0] = h->current_mv_x * 2;//gets divided by 2 in motion compensation
335
335
    s->mv[0][0][1] = h->current_mv_y * 2;
336
336
 
355
355
}
356
356
 
357
357
/**
358
 
 * decodes a macroblock
 
358
 * Decode a macroblock.
359
359
 * @return <0 if an error occurred
360
360
 */
361
361
static int h261_decode_block(H261Context * h, DCTELEM * block,
437
437
}
438
438
 
439
439
/**
440
 
 * decodes the H261 picture header.
 
440
 * Decode the H.261 picture header.
441
441
 * @return <0 if no startcode found
442
442
 */
443
443
static int h261_decode_picture_header(H261Context *h){
464
464
    s->picture_number = (s->picture_number&~31) + i;
465
465
 
466
466
    s->avctx->time_base= (AVRational){1001, 30000};
467
 
    s->current_picture.pts= s->picture_number;
 
467
    s->current_picture.f.pts = s->picture_number;
468
468
 
469
469
 
470
470
    /* PTYPE starts here */
570
570
    }
571
571
 
572
572
    //we need to set current_picture_ptr before reading the header, otherwise we cannot store anyting im there
573
 
    if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){
 
573
    if (s->current_picture_ptr == NULL || s->current_picture_ptr->f.data[0]) {
574
574
        int i= ff_find_unused_picture(s, 0);
 
575
        if (i < 0)
 
576
            return i;
575
577
        s->current_picture_ptr= &s->picture[i];
576
578
    }
577
579
 
596
598
    }
597
599
 
598
600
    // for skipping the frame
599
 
    s->current_picture.pict_type= s->pict_type;
600
 
    s->current_picture.key_frame= s->pict_type == AV_PICTURE_TYPE_I;
 
601
    s->current_picture.f.pict_type = s->pict_type;
 
602
    s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I;
601
603
 
602
604
    if(  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==AV_PICTURE_TYPE_B)
603
605
       ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=AV_PICTURE_TYPE_I)
620
622
    }
621
623
    MPV_frame_end(s);
622
624
 
623
 
assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);
624
 
assert(s->current_picture.pict_type == s->pict_type);
 
625
assert(s->current_picture.f.pict_type == s->current_picture_ptr->f.pict_type);
 
626
assert(s->current_picture.f.pict_type == s->pict_type);
625
627
    *pict= *(AVFrame*)s->current_picture_ptr;
626
628
    ff_print_debug_info(s, pict);
627
629
 
640
642
}
641
643
 
642
644
AVCodec ff_h261_decoder = {
643
 
    "h261",
644
 
    AVMEDIA_TYPE_VIDEO,
645
 
    CODEC_ID_H261,
646
 
    sizeof(H261Context),
647
 
    h261_decode_init,
648
 
    NULL,
649
 
    h261_decode_end,
650
 
    h261_decode_frame,
651
 
    CODEC_CAP_DR1,
 
645
    .name           = "h261",
 
646
    .type           = AVMEDIA_TYPE_VIDEO,
 
647
    .id             = CODEC_ID_H261,
 
648
    .priv_data_size = sizeof(H261Context),
 
649
    .init           = h261_decode_init,
 
650
    .close          = h261_decode_end,
 
651
    .decode         = h261_decode_frame,
 
652
    .capabilities   = CODEC_CAP_DR1,
652
653
    .max_lowres = 3,
653
654
    .long_name = NULL_IF_CONFIG_SMALL("H.261"),
654
655
};