changeset 2938:363be7734674 libavcodec

improvements by Reimar Dffinger; 24-bit decoding is not perfect, only the left half of the frame is painted, but the area that is painted looks correct
author melanson
date Thu, 10 Nov 2005 13:54:32 +0000
parents e63bbb945ebd
children 04cf75617d00
files truemotion1.c
diffstat 1 files changed, 7 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/truemotion1.c	Thu Nov 10 04:40:49 2005 +0000
+++ b/truemotion1.c	Thu Nov 10 13:54:32 2005 +0000
@@ -232,7 +232,7 @@
     
     lo = ydt[p1];
     hi = ydt[p2];
-    return ((lo + (hi << 8)) << 1);
+    return ((lo + (hi << 8) + (hi << 16)) << 1);
 }
 
 #ifdef WORDS_BIGENDIAN
@@ -410,7 +410,7 @@
     
     // FIXME: where to place this ?!?!
     if (compression_types[header.compression].algorithm == ALGO_RGB24H)
-        s->avctx->pix_fmt = PIX_FMT_BGR24;
+        s->avctx->pix_fmt = PIX_FMT_RGBA32;
     else
 	s->avctx->pix_fmt = PIX_FMT_RGB555; // RGB565 is supported aswell
 
@@ -474,7 +474,7 @@
     /* there is a vertical predictor for each pixel in a line; each vertical
      * predictor is 0 to start with */
     s->vert_pred = 
-        (unsigned int *)av_malloc(s->avctx->width * sizeof(unsigned short));
+        (unsigned int *)av_malloc(s->avctx->width * sizeof(unsigned int));
 
     return 0;
 }
@@ -533,13 +533,13 @@
 
 #define APPLY_C_PREDICTOR_24() \
     predictor_pair = s->c_predictor_table[index]; \
-    c_horiz_pred += (predictor_pair >> 1); \
+    horiz_pred += (predictor_pair >> 1); \
     if (predictor_pair & 1) { \
         GET_NEXT_INDEX() \
         if (!index) { \
             GET_NEXT_INDEX() \
             predictor_pair = s->fat_c_predictor_table[index]; \
-            c_horiz_pred += (predictor_pair >> 1); \
+            horiz_pred += (predictor_pair >> 1); \
             if (predictor_pair & 1) \
                 GET_NEXT_INDEX() \
             else \
@@ -547,7 +547,6 @@
         } \
     } else \
         index++; 
-//    c_last+coff = clast+c_horiz_pred;
 
 
 #define APPLY_Y_PREDICTOR() \
@@ -613,7 +612,7 @@
     int index;
 
     /* clean out the line buffer */
-    memset(s->vert_pred, 0, s->avctx->width * sizeof(unsigned short));
+    memset(s->vert_pred, 0, s->avctx->width * sizeof(unsigned int));
 
     GET_NEXT_INDEX();
 
@@ -727,7 +726,6 @@
     int pixels_left;  /* remaining pixels on this line */
     unsigned int predictor_pair;
     unsigned int horiz_pred;
-    unsigned int c_horiz_pred;
     unsigned int *vert_pred;
     unsigned int *current_pixel_pair;
     unsigned int *prev_pixel_pair;
@@ -753,7 +751,7 @@
     for (y = 0; y < s->avctx->height; y++) {
 
         /* re-init variables for the next line iteration */
-        horiz_pred = c_horiz_pred = 0;
+        horiz_pred = 0;
         current_pixel_pair = (unsigned int *)current_line;
         prev_pixel_pair = (unsigned int *)prev_line;
         vert_pred = s->vert_pred;
@@ -774,19 +772,15 @@
                         APPLY_C_PREDICTOR_24();
                         APPLY_Y_PREDICTOR_24();
                         OUTPUT_PIXEL_PAIR();
-//                        OUTPUT_PIXEL_PAIR_24_C();
                         APPLY_C_PREDICTOR_24();
                         APPLY_Y_PREDICTOR_24();
                         OUTPUT_PIXEL_PAIR();
-//                        OUTPUT_PIXEL_PAIR_24_C();
                     } else {
                         APPLY_C_PREDICTOR_24();
                         APPLY_Y_PREDICTOR_24();
                         OUTPUT_PIXEL_PAIR();
-//                        OUTPUT_PIXEL_PAIR_24_C();
                         APPLY_Y_PREDICTOR_24();
                         OUTPUT_PIXEL_PAIR();
-//                        OUTPUT_PIXEL_PAIR_24_C();
                     }
                     break;
 
@@ -806,19 +800,15 @@
                         APPLY_C_PREDICTOR_24();
                         APPLY_Y_PREDICTOR_24();
                         OUTPUT_PIXEL_PAIR();
-//                        OUTPUT_PIXEL_PAIR_24_C();
                         APPLY_C_PREDICTOR_24();
                         APPLY_Y_PREDICTOR_24();
                         OUTPUT_PIXEL_PAIR();
-//                        OUTPUT_PIXEL_PAIR_24_C();
                     } else if (s->block_type == BLOCK_4x2) {
                         APPLY_C_PREDICTOR_24();
                         APPLY_Y_PREDICTOR_24();
                         OUTPUT_PIXEL_PAIR();
-//                        OUTPUT_PIXEL_PAIR_24_C();
                         APPLY_Y_PREDICTOR_24();
                         OUTPUT_PIXEL_PAIR();
-//                        OUTPUT_PIXEL_PAIR_24_C();
                     } else {
                         APPLY_Y_PREDICTOR_24();
                         OUTPUT_PIXEL_PAIR();
@@ -836,7 +826,6 @@
                 *vert_pred++ = *current_pixel_pair++;
                 *current_pixel_pair = *prev_pixel_pair++;
                 horiz_pred = *current_pixel_pair - *vert_pred;
-//		c_horiz_pred = *current_pixel_pair - *vert_pred;
                 *vert_pred++ = *current_pixel_pair++;
                 
             }