diff options
author | Steve L'Homme <slhomme@divxcorp.com> | 2006-11-01 21:09:14 +0000 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2006-11-01 21:09:14 +0000 |
commit | e344c1ea36f228e2987e25327638771c4cedcd33 (patch) | |
tree | a455108c2e273a4791ef8cbd9b334160330121fe /libavcodec/mpeg12.c | |
parent | 484267f3d3d1d47c9a0541316b33beca5a36b2d1 (diff) | |
download | ffmpeg-e344c1ea36f228e2987e25327638771c4cedcd33.tar.gz |
reindentation, patch by From: Steve Lhomme, slhomme divxcorp com
Originally committed as revision 6864 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r-- | libavcodec/mpeg12.c | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 99732ac630..3919c75bd7 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -3109,93 +3109,93 @@ static int mpeg_decode_frame(AVCodecContext *avctx, av_log(avctx, AV_LOG_DEBUG, "%3X at %zd left %d\n", start_code, buf_ptr-buf, input_size); } - /* prepare data for next start code */ - switch(start_code) { - case SEQ_START_CODE: - mpeg1_decode_sequence(avctx, buf_ptr, - input_size); - break; + /* prepare data for next start code */ + switch(start_code) { + case SEQ_START_CODE: + mpeg1_decode_sequence(avctx, buf_ptr, + input_size); + break; - case PICTURE_START_CODE: - /* we have a complete image : we try to decompress it */ - mpeg1_decode_picture(avctx, - buf_ptr, input_size); - break; - case EXT_START_CODE: - mpeg_decode_extension(avctx, - buf_ptr, input_size); - break; - case USER_START_CODE: - mpeg_decode_user_data(avctx, - buf_ptr, input_size); - break; - case GOP_START_CODE: - s2->first_field=0; - mpeg_decode_gop(avctx, - buf_ptr, input_size); + case PICTURE_START_CODE: + /* we have a complete image : we try to decompress it */ + mpeg1_decode_picture(avctx, + buf_ptr, input_size); + break; + case EXT_START_CODE: + mpeg_decode_extension(avctx, + buf_ptr, input_size); + break; + case USER_START_CODE: + mpeg_decode_user_data(avctx, + buf_ptr, input_size); + break; + case GOP_START_CODE: + s2->first_field=0; + mpeg_decode_gop(avctx, + buf_ptr, input_size); + break; + default: + if (start_code >= SLICE_MIN_START_CODE && + start_code <= SLICE_MAX_START_CODE) { + int mb_y= start_code - SLICE_MIN_START_CODE; + + if(s2->last_picture_ptr==NULL){ + /* skip b frames if we dont have reference frames */ + if(s2->pict_type==B_TYPE) break; + /* skip P frames if we dont have reference frame no valid header */ +// if(s2->pict_type==P_TYPE && s2->first_field && !s2->first_slice) break; + } + /* skip b frames if we are in a hurry */ + if(avctx->hurry_up && s2->pict_type==B_TYPE) break; + if( (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==B_TYPE) + ||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=I_TYPE) + || avctx->skip_frame >= AVDISCARD_ALL) break; - default: - if (start_code >= SLICE_MIN_START_CODE && - start_code <= SLICE_MAX_START_CODE) { - int mb_y= start_code - SLICE_MIN_START_CODE; - - if(s2->last_picture_ptr==NULL){ - /* skip b frames if we dont have reference frames */ - if(s2->pict_type==B_TYPE) break; - /* skip P frames if we dont have reference frame no valid header */ -// if(s2->pict_type==P_TYPE && s2->first_field && !s2->first_slice) break; - } - /* skip b frames if we are in a hurry */ - if(avctx->hurry_up && s2->pict_type==B_TYPE) break; - if( (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==B_TYPE) - ||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=I_TYPE) - || avctx->skip_frame >= AVDISCARD_ALL) - break; - /* skip everything if we are in a hurry>=5 */ - if(avctx->hurry_up>=5) break; - - if (!s->mpeg_enc_ctx_allocated) break; - - if(s2->codec_id == CODEC_ID_MPEG2VIDEO){ - if(mb_y < avctx->skip_top || mb_y >= s2->mb_height - avctx->skip_bottom) - break; - } + /* skip everything if we are in a hurry>=5 */ + if(avctx->hurry_up>=5) break; - if(s2->first_slice){ - s2->first_slice=0; - if(mpeg_field_start(s2) < 0) - return -1; - } + if (!s->mpeg_enc_ctx_allocated) break; + + if(s2->codec_id == CODEC_ID_MPEG2VIDEO){ + if(mb_y < avctx->skip_top || mb_y >= s2->mb_height - avctx->skip_bottom) + break; + } - if(avctx->thread_count > 1){ - int threshold= (s2->mb_height*s->slice_count + avctx->thread_count/2) / avctx->thread_count; - if(threshold <= mb_y){ - MpegEncContext *thread_context= s2->thread_context[s->slice_count]; + if(s2->first_slice){ + s2->first_slice=0; + if(mpeg_field_start(s2) < 0) + return -1; + } - thread_context->start_mb_y= mb_y; - thread_context->end_mb_y = s2->mb_height; - if(s->slice_count){ - s2->thread_context[s->slice_count-1]->end_mb_y= mb_y; - ff_update_duplicate_context(thread_context, s2); - } - init_get_bits(&thread_context->gb, buf_ptr, input_size*8); - s->slice_count++; - } - buf_ptr += 2; //FIXME add minimum num of bytes per slice - }else{ - ret = mpeg_decode_slice(s, mb_y, &buf_ptr, input_size); - emms_c(); - - if(ret < 0){ - if(s2->resync_mb_x>=0 && s2->resync_mb_y>=0) - ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x, s2->mb_y, AC_ERROR|DC_ERROR|MV_ERROR); - }else{ - ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x-1, s2->mb_y, AC_END|DC_END|MV_END); - } + if(avctx->thread_count > 1){ + int threshold= (s2->mb_height*s->slice_count + avctx->thread_count/2) / avctx->thread_count; + if(threshold <= mb_y){ + MpegEncContext *thread_context= s2->thread_context[s->slice_count]; + + thread_context->start_mb_y= mb_y; + thread_context->end_mb_y = s2->mb_height; + if(s->slice_count){ + s2->thread_context[s->slice_count-1]->end_mb_y= mb_y; + ff_update_duplicate_context(thread_context, s2); } + init_get_bits(&thread_context->gb, buf_ptr, input_size*8); + s->slice_count++; + } + buf_ptr += 2; //FIXME add minimum num of bytes per slice + }else{ + ret = mpeg_decode_slice(s, mb_y, &buf_ptr, input_size); + emms_c(); + + if(ret < 0){ + if(s2->resync_mb_x>=0 && s2->resync_mb_y>=0) + ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x, s2->mb_y, AC_ERROR|DC_ERROR|MV_ERROR); + }else{ + ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x-1, s2->mb_y, AC_END|DC_END|MV_END); } - break; } + } + break; + } } } |