comparison mpegvideo.c @ 2024:f65d87bfdd5a libavcodec

some of the warning fixes by (Michael Roitzsch <mroi at users dot sourceforge dot net>)
author michael
date Tue, 18 May 2004 17:09:46 +0000
parents 3ab8f3e2ae6a
children 591233f22963
comparison
equal deleted inserted replaced
2023:50e92cec1b84 2024:f65d87bfdd5a
23 /** 23 /**
24 * @file mpegvideo.c 24 * @file mpegvideo.c
25 * The simplest mpeg encoder (well, it was the simplest!). 25 * The simplest mpeg encoder (well, it was the simplest!).
26 */ 26 */
27 27
28 #include <limits.h>
29 #include <math.h> //for PI
30 #include "avcodec.h" 28 #include "avcodec.h"
31 #include "dsputil.h" 29 #include "dsputil.h"
32 #include "mpegvideo.h" 30 #include "mpegvideo.h"
33 #include "faandct.h" 31 #include "faandct.h"
32 #include <limits.h>
34 33
35 #ifdef USE_FASTMEMCPY 34 #ifdef USE_FASTMEMCPY
36 #include "fastmemcpy.h" 35 #include "fastmemcpy.h"
37 #endif 36 #endif
38 37
565 * sets the given MpegEncContext to defaults for encoding. 564 * sets the given MpegEncContext to defaults for encoding.
566 * the changed fields will not depend upon the prior state of the MpegEncContext. 565 * the changed fields will not depend upon the prior state of the MpegEncContext.
567 */ 566 */
568 567
569 #ifdef CONFIG_ENCODERS 568 #ifdef CONFIG_ENCODERS
570 void MPV_encode_defaults(MpegEncContext *s){ 569 static void MPV_encode_defaults(MpegEncContext *s){
571 static int done=0; 570 static int done=0;
572 571
573 MPV_common_defaults(s); 572 MPV_common_defaults(s);
574 573
575 if(!done){ 574 if(!done){
1706 for(mb_x=0; mb_x<s->mb_width; mb_x++){ 1705 for(mb_x=0; mb_x<s->mb_width; mb_x++){
1707 const int mb_index= mb_x + mb_y*s->mb_stride; 1706 const int mb_index= mb_x + mb_y*s->mb_stride;
1708 if((s->avctx->debug_mv) && pict->motion_val){ 1707 if((s->avctx->debug_mv) && pict->motion_val){
1709 int type; 1708 int type;
1710 for(type=0; type<3; type++){ 1709 for(type=0; type<3; type++){
1711 int direction; 1710 int direction = 0;
1712 switch (type) { 1711 switch (type) {
1713 case 0: if ((!(s->avctx->debug_mv&FF_DEBUG_VIS_MV_P_FOR)) || (pict->pict_type!=FF_P_TYPE)) 1712 case 0: if ((!(s->avctx->debug_mv&FF_DEBUG_VIS_MV_P_FOR)) || (pict->pict_type!=FF_P_TYPE))
1714 continue; 1713 continue;
1715 direction = 0; 1714 direction = 0;
1716 break; 1715 break;
4587 flush_put_bits(&dst->pb); 4586 flush_put_bits(&dst->pb);
4588 } 4587 }
4589 4588
4590 static void encode_picture(MpegEncContext *s, int picture_number) 4589 static void encode_picture(MpegEncContext *s, int picture_number)
4591 { 4590 {
4592 int i, j; 4591 int i;
4593 int bits; 4592 int bits;
4594 4593
4595 s->picture_number = picture_number; 4594 s->picture_number = picture_number;
4596 4595
4597 /* Reset the average MB variance */ 4596 /* Reset the average MB variance */
4669 } 4668 }
4670 4669
4671 ff_fix_long_p_mvs(s); 4670 ff_fix_long_p_mvs(s);
4672 ff_fix_long_mvs(s, NULL, 0, s->p_mv_table, s->f_code, CANDIDATE_MB_TYPE_INTER, 0); 4671 ff_fix_long_mvs(s, NULL, 0, s->p_mv_table, s->f_code, CANDIDATE_MB_TYPE_INTER, 0);
4673 if(s->flags & CODEC_FLAG_INTERLACED_ME){ 4672 if(s->flags & CODEC_FLAG_INTERLACED_ME){
4673 int j;
4674 for(i=0; i<2; i++){ 4674 for(i=0; i<2; i++){
4675 for(j=0; j<2; j++) 4675 for(j=0; j<2; j++)
4676 ff_fix_long_mvs(s, s->p_field_select_table[i], j, 4676 ff_fix_long_mvs(s, s->p_field_select_table[i], j,
4677 s->p_field_mv_table[i][j], s->f_code, CANDIDATE_MB_TYPE_INTER_I, 0); 4677 s->p_field_mv_table[i][j], s->f_code, CANDIDATE_MB_TYPE_INTER_I, 0);
4678 } 4678 }
4693 ff_fix_long_mvs(s, NULL, 0, s->b_forw_mv_table, s->f_code, CANDIDATE_MB_TYPE_FORWARD, 1); 4693 ff_fix_long_mvs(s, NULL, 0, s->b_forw_mv_table, s->f_code, CANDIDATE_MB_TYPE_FORWARD, 1);
4694 ff_fix_long_mvs(s, NULL, 0, s->b_back_mv_table, s->b_code, CANDIDATE_MB_TYPE_BACKWARD, 1); 4694 ff_fix_long_mvs(s, NULL, 0, s->b_back_mv_table, s->b_code, CANDIDATE_MB_TYPE_BACKWARD, 1);
4695 ff_fix_long_mvs(s, NULL, 0, s->b_bidir_forw_mv_table, s->f_code, CANDIDATE_MB_TYPE_BIDIR, 1); 4695 ff_fix_long_mvs(s, NULL, 0, s->b_bidir_forw_mv_table, s->f_code, CANDIDATE_MB_TYPE_BIDIR, 1);
4696 ff_fix_long_mvs(s, NULL, 0, s->b_bidir_back_mv_table, s->b_code, CANDIDATE_MB_TYPE_BIDIR, 1); 4696 ff_fix_long_mvs(s, NULL, 0, s->b_bidir_back_mv_table, s->b_code, CANDIDATE_MB_TYPE_BIDIR, 1);
4697 if(s->flags & CODEC_FLAG_INTERLACED_ME){ 4697 if(s->flags & CODEC_FLAG_INTERLACED_ME){
4698 int dir; 4698 int dir, j;
4699 for(dir=0; dir<2; dir++){ 4699 for(dir=0; dir<2; dir++){
4700 for(i=0; i<2; i++){ 4700 for(i=0; i<2; i++){
4701 for(j=0; j<2; j++){ 4701 for(j=0; j<2; j++){
4702 int type= dir ? (CANDIDATE_MB_TYPE_BACKWARD_I|CANDIDATE_MB_TYPE_BIDIR_I) 4702 int type= dir ? (CANDIDATE_MB_TYPE_BACKWARD_I|CANDIDATE_MB_TYPE_BIDIR_I)
4703 : (CANDIDATE_MB_TYPE_FORWARD_I |CANDIDATE_MB_TYPE_BIDIR_I); 4703 : (CANDIDATE_MB_TYPE_FORWARD_I |CANDIDATE_MB_TYPE_BIDIR_I);
5258 #endif 5258 #endif
5259 for(;;){ 5259 for(;;){
5260 int best_score=s->dsp.try_8x8basis(rem, weight, basis[0], 0); 5260 int best_score=s->dsp.try_8x8basis(rem, weight, basis[0], 0);
5261 int best_coeff=0; 5261 int best_coeff=0;
5262 int best_change=0; 5262 int best_change=0;
5263 int run2, best_unquant_change, analyze_gradient; 5263 int run2, best_unquant_change=0, analyze_gradient;
5264 #ifdef REFINE_STATS 5264 #ifdef REFINE_STATS
5265 {START_TIMER 5265 {START_TIMER
5266 #endif 5266 #endif
5267 analyze_gradient = last_non_zero > 2 || s->avctx->quantizer_noise_shaping >= 3; 5267 analyze_gradient = last_non_zero > 2 || s->avctx->quantizer_noise_shaping >= 3;
5268 5268