comparison rv10.c @ 6481:493dc59d469a libavcodec

add FF_ prefix to all (frame)_TYPE usage
author aurel
date Sun, 09 Mar 2008 23:31:02 +0000
parents a56227a0b738
children 48759bfbd073
comparison
equal deleted inserted replaced
6480:6f01a499e785 6481:493dc59d469a
238 238
239 align_put_bits(&s->pb); 239 align_put_bits(&s->pb);
240 240
241 put_bits(&s->pb, 1, 1); /* marker */ 241 put_bits(&s->pb, 1, 1); /* marker */
242 242
243 put_bits(&s->pb, 1, (s->pict_type == P_TYPE)); 243 put_bits(&s->pb, 1, (s->pict_type == FF_P_TYPE));
244 244
245 put_bits(&s->pb, 1, 0); /* not PB frame */ 245 put_bits(&s->pb, 1, 0); /* not PB frame */
246 246
247 put_bits(&s->pb, 5, s->qscale); 247 put_bits(&s->pb, 5, s->qscale);
248 248
249 if (s->pict_type == I_TYPE) { 249 if (s->pict_type == FF_I_TYPE) {
250 /* specific MPEG like DC coding not used */ 250 /* specific MPEG like DC coding not used */
251 } 251 }
252 /* if multiple packets per frame are sent, the position at which 252 /* if multiple packets per frame are sent, the position at which
253 to display the macro blocks is coded here */ 253 to display the macro blocks is coded here */
254 if(!full_frame){ 254 if(!full_frame){
271 271
272 put_bits(&s->pb, 1, s->no_rounding); 272 put_bits(&s->pb, 1, s->no_rounding);
273 273
274 assert(s->f_code == 1); 274 assert(s->f_code == 1);
275 assert(s->unrestricted_mv == 1); 275 assert(s->unrestricted_mv == 1);
276 // assert(s->h263_aic== (s->pict_type == I_TYPE)); 276 // assert(s->h263_aic== (s->pict_type == FF_I_TYPE));
277 assert(s->alt_inter_vlc == 0); 277 assert(s->alt_inter_vlc == 0);
278 assert(s->umvplus == 0); 278 assert(s->umvplus == 0);
279 assert(s->modified_quant==1); 279 assert(s->modified_quant==1);
280 assert(s->loop_filter==1); 280 assert(s->loop_filter==1);
281 281
282 s->h263_aic= s->pict_type == I_TYPE; 282 s->h263_aic= s->pict_type == FF_I_TYPE;
283 if(s->h263_aic){ 283 if(s->h263_aic){
284 s->y_dc_scale_table= 284 s->y_dc_scale_table=
285 s->c_dc_scale_table= ff_aic_dc_scale_table; 285 s->c_dc_scale_table= ff_aic_dc_scale_table;
286 }else{ 286 }else{
287 s->y_dc_scale_table= 287 s->y_dc_scale_table=
313 313
314 //printf("ff:%d\n", full_frame); 314 //printf("ff:%d\n", full_frame);
315 marker = get_bits1(&s->gb); 315 marker = get_bits1(&s->gb);
316 316
317 if (get_bits1(&s->gb)) 317 if (get_bits1(&s->gb))
318 s->pict_type = P_TYPE; 318 s->pict_type = FF_P_TYPE;
319 else 319 else
320 s->pict_type = I_TYPE; 320 s->pict_type = FF_I_TYPE;
321 //printf("h:%X ver:%d\n",h,s->rv10_version); 321 //printf("h:%X ver:%d\n",h,s->rv10_version);
322 if(!marker) av_log(s->avctx, AV_LOG_ERROR, "marker missing\n"); 322 if(!marker) av_log(s->avctx, AV_LOG_ERROR, "marker missing\n");
323 pb_frame = get_bits1(&s->gb); 323 pb_frame = get_bits1(&s->gb);
324 324
325 #ifdef DEBUG 325 #ifdef DEBUG
335 if(s->qscale==0){ 335 if(s->qscale==0){
336 av_log(s->avctx, AV_LOG_ERROR, "error, qscale:0\n"); 336 av_log(s->avctx, AV_LOG_ERROR, "error, qscale:0\n");
337 return -1; 337 return -1;
338 } 338 }
339 339
340 if (s->pict_type == I_TYPE) { 340 if (s->pict_type == FF_I_TYPE) {
341 if (s->rv10_version == 3) { 341 if (s->rv10_version == 3) {
342 /* specific MPEG like DC coding not used */ 342 /* specific MPEG like DC coding not used */
343 s->last_dc[0] = get_bits(&s->gb, 8); 343 s->last_dc[0] = get_bits(&s->gb, 8);
344 s->last_dc[1] = get_bits(&s->gb, 8); 344 s->last_dc[1] = get_bits(&s->gb, 8);
345 s->last_dc[2] = get_bits(&s->gb, 8); 345 s->last_dc[2] = get_bits(&s->gb, 8);
400 } 400 }
401 } 401 }
402 402
403 i= get_bits(&s->gb, 2); 403 i= get_bits(&s->gb, 2);
404 switch(i){ 404 switch(i){
405 case 0: s->pict_type= I_TYPE; break; 405 case 0: s->pict_type= FF_I_TYPE; break;
406 case 1: s->pict_type= I_TYPE; break; //hmm ... 406 case 1: s->pict_type= FF_I_TYPE; break; //hmm ...
407 case 2: s->pict_type= P_TYPE; break; 407 case 2: s->pict_type= FF_P_TYPE; break;
408 case 3: s->pict_type= B_TYPE; break; 408 case 3: s->pict_type= FF_B_TYPE; break;
409 default: 409 default:
410 av_log(s->avctx, AV_LOG_ERROR, "unknown frame type\n"); 410 av_log(s->avctx, AV_LOG_ERROR, "unknown frame type\n");
411 return -1; 411 return -1;
412 } 412 }
413 413
414 if(s->last_picture_ptr==NULL && s->pict_type==B_TYPE){ 414 if(s->last_picture_ptr==NULL && s->pict_type==FF_B_TYPE){
415 av_log(s->avctx, AV_LOG_ERROR, "early B pix\n"); 415 av_log(s->avctx, AV_LOG_ERROR, "early B pix\n");
416 return -1; 416 return -1;
417 } 417 }
418 418
419 if (get_bits1(&s->gb)){ 419 if (get_bits1(&s->gb)){
480 //av_log(s->avctx, AV_LOG_DEBUG, "%d\n", seq); 480 //av_log(s->avctx, AV_LOG_DEBUG, "%d\n", seq);
481 seq |= s->time &~0x7FFF; 481 seq |= s->time &~0x7FFF;
482 if(seq - s->time > 0x4000) seq -= 0x8000; 482 if(seq - s->time > 0x4000) seq -= 0x8000;
483 if(seq - s->time < -0x4000) seq += 0x8000; 483 if(seq - s->time < -0x4000) seq += 0x8000;
484 if(seq != s->time){ 484 if(seq != s->time){
485 if(s->pict_type!=B_TYPE){ 485 if(s->pict_type!=FF_B_TYPE){
486 s->time= seq; 486 s->time= seq;
487 s->pp_time= s->time - s->last_non_b_time; 487 s->pp_time= s->time - s->last_non_b_time;
488 s->last_non_b_time= s->time; 488 s->last_non_b_time= s->time;
489 }else{ 489 }else{
490 s->time= seq; 490 s->time= seq;
503 av_log(s->avctx, AV_LOG_DEBUG, "\n");*/ 503 av_log(s->avctx, AV_LOG_DEBUG, "\n");*/
504 s->no_rounding= get_bits1(&s->gb); 504 s->no_rounding= get_bits1(&s->gb);
505 505
506 s->f_code = 1; 506 s->f_code = 1;
507 s->unrestricted_mv = 1; 507 s->unrestricted_mv = 1;
508 s->h263_aic= s->pict_type == I_TYPE; 508 s->h263_aic= s->pict_type == FF_I_TYPE;
509 // s->alt_inter_vlc=1; 509 // s->alt_inter_vlc=1;
510 // s->obmc=1; 510 // s->obmc=1;
511 // s->umvplus=1; 511 // s->umvplus=1;
512 s->modified_quant=1; 512 s->modified_quant=1;
513 s->loop_filter=1; 513 s->loop_filter=1;
515 if(s->avctx->debug & FF_DEBUG_PICT_INFO){ 515 if(s->avctx->debug & FF_DEBUG_PICT_INFO){
516 av_log(s->avctx, AV_LOG_INFO, "num:%5d x:%2d y:%2d type:%d qscale:%2d rnd:%d\n", 516 av_log(s->avctx, AV_LOG_INFO, "num:%5d x:%2d y:%2d type:%d qscale:%2d rnd:%d\n",
517 seq, s->mb_x, s->mb_y, s->pict_type, s->qscale, s->no_rounding); 517 seq, s->mb_x, s->mb_y, s->pict_type, s->qscale, s->no_rounding);
518 } 518 }
519 519
520 assert(s->pict_type != B_TYPE || !s->low_delay); 520 assert(s->pict_type != FF_B_TYPE || !s->low_delay);
521 521
522 return s->mb_width*s->mb_height - mb_pos; 522 return s->mb_width*s->mb_height - mb_pos;
523 } 523 }
524 524
525 static int rv10_decode_init(AVCodecContext *avctx) 525 static int rv10_decode_init(AVCodecContext *avctx)
621 left = s->mb_width * s->mb_height - mb_pos; 621 left = s->mb_width * s->mb_height - mb_pos;
622 if (mb_count > left) { 622 if (mb_count > left) {
623 av_log(s->avctx, AV_LOG_ERROR, "COUNT ERROR\n"); 623 av_log(s->avctx, AV_LOG_ERROR, "COUNT ERROR\n");
624 return -1; 624 return -1;
625 } 625 }
626 //if(s->pict_type == P_TYPE) return 0; 626 //if(s->pict_type == FF_P_TYPE) return 0;
627 627
628 if ((s->mb_x == 0 && s->mb_y == 0) || s->current_picture_ptr==NULL) { 628 if ((s->mb_x == 0 && s->mb_y == 0) || s->current_picture_ptr==NULL) {
629 if(s->current_picture_ptr){ //FIXME write parser so we always have complete frames? 629 if(s->current_picture_ptr){ //FIXME write parser so we always have complete frames?
630 ff_er_frame_end(s); 630 ff_er_frame_end(s);
631 MPV_frame_end(s); 631 MPV_frame_end(s);
688 688
689 if (ret == SLICE_ERROR || s->gb.size_in_bits < get_bits_count(&s->gb)) { 689 if (ret == SLICE_ERROR || s->gb.size_in_bits < get_bits_count(&s->gb)) {
690 av_log(s->avctx, AV_LOG_ERROR, "ERROR at MB %d %d\n", s->mb_x, s->mb_y); 690 av_log(s->avctx, AV_LOG_ERROR, "ERROR at MB %d %d\n", s->mb_x, s->mb_y);
691 return -1; 691 return -1;
692 } 692 }
693 if(s->pict_type != B_TYPE) 693 if(s->pict_type != FF_B_TYPE)
694 ff_h263_update_motion_val(s); 694 ff_h263_update_motion_val(s);
695 MPV_decode_mb(s, s->block); 695 MPV_decode_mb(s, s->block);
696 if(s->loop_filter) 696 if(s->loop_filter)
697 ff_h263_loop_filter(s); 697 ff_h263_loop_filter(s);
698 698
757 757
758 if(s->current_picture_ptr != NULL && s->mb_y>=s->mb_height){ 758 if(s->current_picture_ptr != NULL && s->mb_y>=s->mb_height){
759 ff_er_frame_end(s); 759 ff_er_frame_end(s);
760 MPV_frame_end(s); 760 MPV_frame_end(s);
761 761
762 if (s->pict_type == B_TYPE || s->low_delay) { 762 if (s->pict_type == FF_B_TYPE || s->low_delay) {
763 *pict= *(AVFrame*)s->current_picture_ptr; 763 *pict= *(AVFrame*)s->current_picture_ptr;
764 } else if (s->last_picture_ptr != NULL) { 764 } else if (s->last_picture_ptr != NULL) {
765 *pict= *(AVFrame*)s->last_picture_ptr; 765 *pict= *(AVFrame*)s->last_picture_ptr;
766 } 766 }
767 767