s->picture_structure= PICT_FRAME;
}
- if(s->progressive_frame && !s->frame_pred_frame_dct){
+ if(s->progressive_sequence && !s->frame_pred_frame_dct){
av_log(s->avctx, AV_LOG_ERROR, "invalid frame_pred_frame_dct\n");
s->frame_pred_frame_dct= 1;
}
s->resync_mb_x=
s->resync_mb_y= -1;
- if (mb_y<<field_pic >= s->mb_height){
- av_log(s->avctx, AV_LOG_ERROR, "slice below image (%d >= %d)\n", mb_y, s->mb_height);
- return -1;
- }
+ assert(mb_y < s->mb_height);
init_get_bits(&s->gb, *buf, buf_size*8);
s->mb_x=0;
- for(;;) {
- int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2);
- if (code < 0){
- av_log(s->avctx, AV_LOG_ERROR, "first mb_incr damaged\n");
- return -1;
- }
- if (code >= 33) {
- if (code == 33) {
- s->mb_x += 33;
+ if(mb_y==0 && s->codec_tag == AV_RL32("SLIF")){
+ skip_bits1(&s->gb);
+ }else{
+ for(;;) {
+ int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2);
+ if (code < 0){
+ av_log(s->avctx, AV_LOG_ERROR, "first mb_incr damaged\n");
+ return -1;
+ }
+ if (code >= 33) {
+ if (code == 33) {
+ s->mb_x += 33;
+ }
+ /* otherwise, stuffing, nothing to do */
+ } else {
+ s->mb_x += code;
+ break;
}
- /* otherwise, stuffing, nothing to do */
- } else {
- s->mb_x += code;
- break;
}
}
+
if(s->mb_x >= (unsigned)s->mb_width){
av_log(s->avctx, AV_LOG_ERROR, "initial skip overflow\n");
return -1;
return -1;
if(s->current_picture.motion_val[0] && !s->encoding){ //note motion_val is normally NULL unless we want to extract the MVs
- const int wrap = field_pic ? 2*s->b8_stride : s->b8_stride;
+ const int wrap = s->b8_stride;
int xy = s->mb_x*2 + s->mb_y*2*wrap;
int motion_x, motion_y, dir, i;
- if(field_pic && !s->first_field)
- xy += wrap/2;
for(i=0; i<2; i++){
for(dir=0; dir<2; dir++){
if (++s->mb_x >= s->mb_width) {
const int mb_size= 16>>s->avctx->lowres;
- ff_draw_horiz_band(s, mb_size*s->mb_y, mb_size);
+ ff_draw_horiz_band(s, mb_size*(s->mb_y>>field_pic), mb_size);
s->mb_x = 0;
- s->mb_y++;
+ s->mb_y += 1<<field_pic;
- if(s->mb_y<<field_pic >= s->mb_height){
+ if(s->mb_y >= s->mb_height){
int left= get_bits_left(&s->gb);
int is_d10= s->chroma_format==2 && s->pict_type==FF_I_TYPE && avctx->profile==0 && avctx->level==5
&& s->intra_dc_precision == 2 && s->q_scale_type == 1 && s->alternate_scan == 0
MpegEncContext *s= *(void**)arg;
const uint8_t *buf= s->gb.buffer;
int mb_y= s->start_mb_y;
+ const int field_pic= s->picture_structure != PICT_FRAME;
- s->error_count= 3*(s->end_mb_y - s->start_mb_y)*s->mb_width;
+ s->error_count= (3*(s->end_mb_y - s->start_mb_y)*s->mb_width) >> field_pic;
for(;;){
uint32_t start_code;
default:
if (start_code >= SLICE_MIN_START_CODE &&
start_code <= SLICE_MAX_START_CODE && last_code!=0) {
- int mb_y= start_code - SLICE_MIN_START_CODE;
+ const int field_pic= s2->picture_structure != PICT_FRAME;
+ int mb_y= (start_code - SLICE_MIN_START_CODE) << field_pic;
last_code= SLICE_MIN_START_CODE;
+ if(s2->picture_structure == PICT_BOTTOM_FIELD)
+ mb_y++;
+
+ if (mb_y >= s2->mb_height){
+ av_log(s2->avctx, AV_LOG_ERROR, "slice below image (%d >= %d)\n", mb_y, s2->mb_height);
+ return -1;
+ }
+
if(s2->last_picture_ptr==NULL){
/* Skip B-frames if we do not have reference frames and gop is not closed */
if(s2->pict_type==FF_B_TYPE){
return -1;
}
- if(s2->last_picture_ptr==NULL && s2->pict_type!=FF_I_TYPE){
- int i;
- /* Allocate a dummy frame */
- i= ff_find_unused_picture(s2, 0);
- s2->last_picture_ptr= &s2->picture[i];
- if(ff_alloc_picture(s2, s2->last_picture_ptr, 0) < 0)
- return -1;
- s2->last_picture= *s2->last_picture_ptr;
- }
- if(s2->next_picture_ptr==NULL && s2->pict_type==FF_B_TYPE){
- int i;
- /* Allocate a dummy frame */
- i= ff_find_unused_picture(s2, 0);
- s2->next_picture_ptr= &s2->picture[i];
- if(ff_alloc_picture(s2, s2->next_picture_ptr, 0) < 0)
- return -1;
- s2->next_picture= *s2->next_picture_ptr;
- }
-
if (avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) {
s->slice_count++;
break;