changeset 3776:1843a85123b7 libavcodec

fix some signedness warnings
author mru
date Wed, 27 Sep 2006 19:47:39 +0000
parents 8e1ed8300165
children 20545fbb6f7c
files 4xm.c cyuv.c error_resilience.c h263.c h264.c indeo3.c mjpeg.c mpeg12.c mpeg12data.h mpegaudiodec.c mpegvideo.c mpegvideo.h msmpeg4.c parser.c svq1.c vc1.c vp3.c wmadec.c
diffstat 18 files changed, 43 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/4xm.c	Wed Sep 27 19:46:19 2006 +0000
+++ b/4xm.c	Wed Sep 27 19:47:39 2006 +0000
@@ -104,8 +104,8 @@
 
 
 typedef struct CFrameBuffer{
-    int allocated_size;
-    int size;
+    unsigned int allocated_size;
+    unsigned int size;
     int id;
     uint8_t *data;
 }CFrameBuffer;
--- a/cyuv.c	Wed Sep 27 19:46:19 2006 +0000
+++ b/cyuv.c	Wed Sep 27 19:47:39 2006 +0000
@@ -75,9 +75,9 @@
     int v_ptr;
 
     /* prediction error tables (make it clear that they are signed values) */
-    signed char *y_table = buf +  0;
-    signed char *u_table = buf + 16;
-    signed char *v_table = buf + 32;
+    signed char *y_table = (signed char*)buf +  0;
+    signed char *u_table = (signed char*)buf + 16;
+    signed char *v_table = (signed char*)buf + 32;
 
     unsigned char y_pred, u_pred, v_pred;
     int stream_ptr;
--- a/error_resilience.c	Wed Sep 27 19:46:19 2006 +0000
+++ b/error_resilience.c	Wed Sep 27 19:47:39 2006 +0000
@@ -70,7 +70,7 @@
     }
 }
 
-static void filter181(int16_t *data, int width, int height, int stride){
+static void filter181(uint16_t *data, int width, int height, int stride){
     int x,y;
 
     /* horizontal filter */
@@ -111,7 +111,7 @@
  * @param w     width in 8 pixel blocks
  * @param h     height in 8 pixel blocks
  */
-static void guess_dc(MpegEncContext *s, int16_t *dc, int w, int h, int stride, int is_luma){
+static void guess_dc(MpegEncContext *s, uint16_t *dc, int w, int h, int stride, int is_luma){
     int b_x, b_y;
 
     for(b_y=0; b_y<h; b_y++){
@@ -931,7 +931,7 @@
     for(mb_y=0; mb_y<s->mb_height; mb_y++){
         for(mb_x=0; mb_x<s->mb_width; mb_x++){
             int dc, dcu, dcv, y, n;
-            int16_t *dc_ptr;
+            uint16_t *dc_ptr;
             uint8_t *dest_y, *dest_cb, *dest_cr;
             const int mb_xy= mb_x + mb_y * s->mb_stride;
             const int mb_type= s->current_picture.mb_type[mb_xy];
--- a/h263.c	Wed Sep 27 19:46:19 2006 +0000
+++ b/h263.c	Wed Sep 27 19:47:39 2006 +0000
@@ -1518,7 +1518,7 @@
 static int h263_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr)
 {
     int x, y, wrap, a, c, pred_dc, scale;
-    int16_t *dc_val;
+    uint16_t *dc_val;
 
     /* find prediction */
     if (n < 4) {
@@ -1563,7 +1563,8 @@
 static void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n)
 {
     int x, y, wrap, a, c, pred_dc, scale, i;
-    int16_t *dc_val, *ac_val, *ac_val1;
+    uint16_t *dc_val;
+    int16_t *ac_val, *ac_val1;
 
     /* find prediction */
     if (n < 4) {
--- a/h264.c	Wed Sep 27 19:46:19 2006 +0000
+++ b/h264.c	Wed Sep 27 19:47:39 2006 +0000
@@ -619,7 +619,7 @@
                 if(USES_LIST(mb_type,list)){
                     uint32_t *src = (uint32_t*)s->current_picture.motion_val[list][h->mb2b_xy[mb_xy]];
                     uint32_t *dst = (uint32_t*)h->mv_cache[list][scan8[0]];
-                    uint8_t *ref = &s->current_picture.ref_index[list][h->mb2b8_xy[mb_xy]];
+                    int8_t *ref = &s->current_picture.ref_index[list][h->mb2b8_xy[mb_xy]];
                     for(i=0; i<4; i++, dst+=8, src+=h->b_stride){
                         dst[0] = src[0];
                         dst[1] = src[1];
@@ -1133,7 +1133,7 @@
      * make mbaff happy, so we can't move all this logic to fill_caches */
     if(FRAME_MBAFF){
         MpegEncContext *s = &h->s;
-        const int *mb_types = s->current_picture_ptr->mb_type;
+        const uint32_t *mb_types = s->current_picture_ptr->mb_type;
         const int16_t *mv;
         *(uint32_t*)h->mv_cache[list][scan8[0]-2] = 0;
         *C = h->mv_cache[list][scan8[0]-2];
@@ -1721,7 +1721,7 @@
         }
 
         {
-            uint8_t *ref_index = &s->current_picture.ref_index[list][b8_xy];
+            int8_t *ref_index = &s->current_picture.ref_index[list][b8_xy];
             ref_index[0+0*h->b8_stride]= h->ref_cache[list][scan8[0]];
             ref_index[1+0*h->b8_stride]= h->ref_cache[list][scan8[4]];
             ref_index[0+1*h->b8_stride]= h->ref_cache[list][scan8[8]];
--- a/indeo3.c	Wed Sep 27 19:46:19 2006 +0000
+++ b/indeo3.c	Wed Sep 27 19:47:39 2006 +0000
@@ -381,7 +381,7 @@
     } else if(cmd == 3) {
       if(strip->usl7 == 0) {
         strip->usl7 = 1;
-        ref_vectors = buf2 + (*buf1 * 2);
+        ref_vectors = (signed char*)buf2 + (*buf1 * 2);
         buf1++;
         continue;
       }
--- a/mjpeg.c	Wed Sep 27 19:46:19 2006 +0000
+++ b/mjpeg.c	Wed Sep 27 19:47:39 2006 +0000
@@ -1801,7 +1801,7 @@
 {
     int len = get_bits(&s->gb, 16);
     if (len >= 2 && 8*len - 16 + get_bits_count(&s->gb) <= s->gb.size_in_bits) {
-        uint8_t *cbuf = av_malloc(len - 1);
+        char *cbuf = av_malloc(len - 1);
         if (cbuf) {
             int i;
             for (i = 0; i < len - 2; i++)
--- a/mpeg12.c	Wed Sep 27 19:46:19 2006 +0000
+++ b/mpeg12.c	Wed Sep 27 19:47:39 2006 +0000
@@ -2695,7 +2695,8 @@
     s->error_count= 3*(s->end_mb_y - s->start_mb_y)*s->mb_width;
 
     for(;;){
-        int start_code, ret;
+        uint32_t start_code;
+        int ret;
 
         ret= mpeg_decode_slice((Mpeg1Context*)s, mb_y, &buf, s->gb.buffer_end - buf);
         emms_c();
@@ -3033,7 +3034,8 @@
     Mpeg1Context *s = avctx->priv_data;
     const uint8_t *buf_end;
     const uint8_t *buf_ptr;
-    int ret, start_code, input_size;
+    uint32_t start_code;
+    int ret, input_size;
     AVFrame *picture = data;
     MpegEncContext *s2 = &s->mpeg_enc_ctx;
     dprintf("fill_buffer\n");
@@ -3080,7 +3082,7 @@
         /* find start next code */
         start_code = -1;
         buf_ptr = ff_find_start_code(buf_ptr,buf_end, &start_code);
-        if (start_code < 0){
+        if (start_code > 0x1ff){
             if(s2->pict_type != B_TYPE || avctx->skip_frame <= AVDISCARD_DEFAULT){
                 if(avctx->thread_count > 1){
                     int i;
--- a/mpeg12data.h	Wed Sep 27 19:46:19 2006 +0000
+++ b/mpeg12data.h	Wed Sep 27 19:47:39 2006 +0000
@@ -23,7 +23,7 @@
  * MPEG1/2 tables.
  */
 
-const int16_t ff_mpeg1_default_intra_matrix[64] = {
+const uint16_t ff_mpeg1_default_intra_matrix[64] = {
         8, 16, 19, 22, 26, 27, 29, 34,
         16, 16, 22, 24, 27, 29, 34, 37,
         19, 22, 26, 27, 29, 34, 34, 38,
@@ -34,7 +34,7 @@
         27, 29, 35, 38, 46, 56, 69, 83
 };
 
-const int16_t ff_mpeg1_default_non_intra_matrix[64] = {
+const uint16_t ff_mpeg1_default_non_intra_matrix[64] = {
     16, 16, 16, 16, 16, 16, 16, 16,
     16, 16, 16, 16, 16, 16, 16, 16,
     16, 16, 16, 16, 16, 16, 16, 16,
--- a/mpegaudiodec.c	Wed Sep 27 19:46:19 2006 +0000
+++ b/mpegaudiodec.c	Wed Sep 27 19:47:39 2006 +0000
@@ -86,7 +86,7 @@
 #endif
     void (*compute_antialias)(struct MPADecodeContext *s, struct GranuleDef *g);
     int adu_mode; ///< 0 for standard mp3, 1 for adu formatted mp3
-    unsigned int dither_state;
+    int dither_state;
 } MPADecodeContext;
 
 /**
--- a/mpegvideo.c	Wed Sep 27 19:46:19 2006 +0000
+++ b/mpegvideo.c	Wed Sep 27 19:47:39 2006 +0000
@@ -217,7 +217,7 @@
 }
 
 #ifdef CONFIG_ENCODERS
-void ff_write_quant_matrix(PutBitContext *pb, int16_t *matrix){
+void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix){
     int i;
 
     if(matrix){
--- a/mpegvideo.h	Wed Sep 27 19:46:19 2006 +0000
+++ b/mpegvideo.h	Wed Sep 27 19:47:39 2006 +0000
@@ -344,8 +344,8 @@
     Picture *current_picture_ptr;  ///< pointer to the current picture
     uint8_t *visualization_buffer[3]; //< temporary buffer vor MV visualization
     int last_dc[3];                ///< last DC values for MPEG1
-    int16_t *dc_val_base;
-    int16_t *dc_val[3];            ///< used for mpeg4 DC prediction, all 3 arrays must be continuous
+    uint16_t *dc_val_base;
+    uint16_t *dc_val[3];           ///< used for mpeg4 DC prediction, all 3 arrays must be continuous
     int16_t dc_cache[4*5];
     int y_dc_scale, c_dc_scale;
     const uint8_t *y_dc_scale_table;     ///< qscale -> y_dc_scale table
@@ -772,7 +772,7 @@
 void ff_parse_close(AVCodecParserContext *s);
 void ff_mpeg_flush(AVCodecContext *avctx);
 void ff_print_debug_info(MpegEncContext *s, AVFrame *pict);
-void ff_write_quant_matrix(PutBitContext *pb, int16_t *matrix);
+void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix);
 int ff_find_unused_picture(MpegEncContext *s, int shared);
 void ff_denoise_dct(MpegEncContext *s, DCTELEM *block);
 void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src);
@@ -828,8 +828,8 @@
                                int ref_index, int size, int h, int add_rate);
 
 /* mpeg12.c */
-extern const int16_t ff_mpeg1_default_intra_matrix[64];
-extern const int16_t ff_mpeg1_default_non_intra_matrix[64];
+extern const uint16_t ff_mpeg1_default_intra_matrix[64];
+extern const uint16_t ff_mpeg1_default_non_intra_matrix[64];
 extern const uint8_t ff_mpeg1_dc_scale_table[128];
 
 void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number);
--- a/msmpeg4.c	Wed Sep 27 19:46:19 2006 +0000
+++ b/msmpeg4.c	Wed Sep 27 19:47:39 2006 +0000
@@ -630,7 +630,7 @@
                              uint16_t **dc_val_ptr, int *dir_ptr)
 {
     int a, b, c, wrap, pred, scale;
-    int16_t *dc_val;
+    uint16_t *dc_val;
 
     /* find prediction */
     if (n < 4) {
--- a/parser.c	Wed Sep 27 19:46:19 2006 +0000
+++ b/parser.c	Wed Sep 27 19:47:39 2006 +0000
@@ -306,7 +306,7 @@
 {
     ParseContext1 *pc = s->priv_data;
     const uint8_t *buf_end;
-    int32_t start_code;
+    uint32_t start_code;
     int frame_rate_index, ext_type, bytes_left;
     int frame_rate_ext_n, frame_rate_ext_d;
     int picture_structure, top_field_first, repeat_first_field, progressive_frame;
--- a/svq1.c	Wed Sep 27 19:46:19 2006 +0000
+++ b/svq1.c	Wed Sep 27 19:47:39 2006 +0000
@@ -655,9 +655,9 @@
     }
 
     if ((s->f_code ^ 0x10) >= 0x50) {
-      char msg[256];
+      uint8_t msg[256];
 
-      svq1_parse_string (bitbuf, (char *) msg);
+      svq1_parse_string (bitbuf, msg);
 
       av_log(s->avctx, AV_LOG_INFO, "embedded message: \"%s\"\n", (char *) msg);
     }
--- a/vc1.c	Wed Sep 27 19:46:19 2006 +0000
+++ b/vc1.c	Wed Sep 27 19:47:39 2006 +0000
@@ -2341,10 +2341,10 @@
  * @param dir_ptr Prediction direction for use in AC prediction
  */
 static inline int vc1_i_pred_dc(MpegEncContext *s, int overlap, int pq, int n,
-                              int16_t **dc_val_ptr, int *dir_ptr)
+                                uint16_t **dc_val_ptr, int *dir_ptr)
 {
     int a, b, c, wrap, pred, scale;
-    int16_t *dc_val;
+    uint16_t *dc_val;
     static const uint16_t dcpred[32] = {
     -1, 1024,  512,  341,  256,  205,  171,  146,  128,
          114,  102,   93,   85,   79,   73,   68,   64,
@@ -2402,10 +2402,10 @@
  */
 static inline int vc1_pred_dc(MpegEncContext *s, int overlap, int pq, int n,
                               int a_avail, int c_avail,
-                              int16_t **dc_val_ptr, int *dir_ptr)
+                              uint16_t **dc_val_ptr, int *dir_ptr)
 {
     int a, b, c, wrap, pred, scale;
-    int16_t *dc_val;
+    uint16_t *dc_val;
     int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
     int q1, q2 = 0;
 
@@ -2578,7 +2578,7 @@
     MpegEncContext *s = &v->s;
     int dc_pred_dir = 0; /* Direction of the DC prediction used */
     int run_diff, i;
-    int16_t *dc_val;
+    uint16_t *dc_val;
     int16_t *ac_val, *ac_val2;
     int dcdiff;
 
@@ -2743,7 +2743,7 @@
     MpegEncContext *s = &v->s;
     int dc_pred_dir = 0; /* Direction of the DC prediction used */
     int run_diff, i;
-    int16_t *dc_val;
+    uint16_t *dc_val;
     int16_t *ac_val, *ac_val2;
     int dcdiff;
     int a_avail = v->a_avail, c_avail = v->c_avail;
@@ -2940,7 +2940,7 @@
     MpegEncContext *s = &v->s;
     int dc_pred_dir = 0; /* Direction of the DC prediction used */
     int run_diff, i;
-    int16_t *dc_val;
+    uint16_t *dc_val;
     int16_t *ac_val, *ac_val2;
     int dcdiff;
     int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
--- a/vp3.c	Wed Sep 27 19:46:19 2006 +0000
+++ b/vp3.c	Wed Sep 27 19:47:39 2006 +0000
@@ -315,7 +315,7 @@
     int last_coded_c_fragment;
 
     uint8_t edge_emu_buffer[9*2048]; //FIXME dynamic alloc
-    uint8_t qscale_table[2048]; //FIXME dynamic alloc (width+15)/16
+    int8_t qscale_table[2048]; //FIXME dynamic alloc (width+15)/16
 
     /* Huffman decode */
     int hti;
--- a/wmadec.c	Wed Sep 27 19:46:19 2006 +0000
+++ b/wmadec.c	Wed Sep 27 19:47:39 2006 +0000
@@ -871,7 +871,7 @@
             VLC *coef_vlc;
             int level, run, sign, tindex;
             int16_t *ptr, *eptr;
-            const int16_t *level_table, *run_table;
+            const uint16_t *level_table, *run_table;
 
             /* special VLC tables are used for ms stereo because
                there is potentially less energy there */