Originally committed as revision 4686 to svn://svn.ffmpeg.org/ffmpeg/trunk
Mike Melanson authored on 2005/11/10 22:54:32... | ... |
@@ -232,7 +232,7 @@ static int make_ydt24_entry(int p1, int p2, int16_t *ydt) |
232 | 232 |
|
233 | 233 |
lo = ydt[p1]; |
234 | 234 |
hi = ydt[p2]; |
235 |
- return ((lo + (hi << 8)) << 1); |
|
235 |
+ return ((lo + (hi << 8) + (hi << 16)) << 1); |
|
236 | 236 |
} |
237 | 237 |
|
238 | 238 |
#ifdef WORDS_BIGENDIAN |
... | ... |
@@ -410,7 +410,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s) |
410 | 410 |
|
411 | 411 |
// FIXME: where to place this ?!?! |
412 | 412 |
if (compression_types[header.compression].algorithm == ALGO_RGB24H) |
413 |
- s->avctx->pix_fmt = PIX_FMT_BGR24; |
|
413 |
+ s->avctx->pix_fmt = PIX_FMT_RGBA32; |
|
414 | 414 |
else |
415 | 415 |
s->avctx->pix_fmt = PIX_FMT_RGB555; // RGB565 is supported aswell |
416 | 416 |
|
... | ... |
@@ -474,7 +474,7 @@ static int truemotion1_decode_init(AVCodecContext *avctx) |
474 | 474 |
/* there is a vertical predictor for each pixel in a line; each vertical |
475 | 475 |
* predictor is 0 to start with */ |
476 | 476 |
s->vert_pred = |
477 |
- (unsigned int *)av_malloc(s->avctx->width * sizeof(unsigned short)); |
|
477 |
+ (unsigned int *)av_malloc(s->avctx->width * sizeof(unsigned int)); |
|
478 | 478 |
|
479 | 479 |
return 0; |
480 | 480 |
} |
... | ... |
@@ -533,13 +533,13 @@ hres,vres,i,i%vres (0 < i < 4) |
533 | 533 |
|
534 | 534 |
#define APPLY_C_PREDICTOR_24() \ |
535 | 535 |
predictor_pair = s->c_predictor_table[index]; \ |
536 |
- c_horiz_pred += (predictor_pair >> 1); \ |
|
536 |
+ horiz_pred += (predictor_pair >> 1); \ |
|
537 | 537 |
if (predictor_pair & 1) { \ |
538 | 538 |
GET_NEXT_INDEX() \ |
539 | 539 |
if (!index) { \ |
540 | 540 |
GET_NEXT_INDEX() \ |
541 | 541 |
predictor_pair = s->fat_c_predictor_table[index]; \ |
542 |
- c_horiz_pred += (predictor_pair >> 1); \ |
|
542 |
+ horiz_pred += (predictor_pair >> 1); \ |
|
543 | 543 |
if (predictor_pair & 1) \ |
544 | 544 |
GET_NEXT_INDEX() \ |
545 | 545 |
else \ |
... | ... |
@@ -547,7 +547,6 @@ hres,vres,i,i%vres (0 < i < 4) |
547 | 547 |
} \ |
548 | 548 |
} else \ |
549 | 549 |
index++; |
550 |
-// c_last+coff = clast+c_horiz_pred; |
|
551 | 550 |
|
552 | 551 |
|
553 | 552 |
#define APPLY_Y_PREDICTOR() \ |
... | ... |
@@ -613,7 +612,7 @@ static void truemotion1_decode_16bit(TrueMotion1Context *s) |
613 | 613 |
int index; |
614 | 614 |
|
615 | 615 |
/* clean out the line buffer */ |
616 |
- memset(s->vert_pred, 0, s->avctx->width * sizeof(unsigned short)); |
|
616 |
+ memset(s->vert_pred, 0, s->avctx->width * sizeof(unsigned int)); |
|
617 | 617 |
|
618 | 618 |
GET_NEXT_INDEX(); |
619 | 619 |
|
... | ... |
@@ -727,7 +726,6 @@ static void truemotion1_decode_24bit(TrueMotion1Context *s) |
727 | 727 |
int pixels_left; /* remaining pixels on this line */ |
728 | 728 |
unsigned int predictor_pair; |
729 | 729 |
unsigned int horiz_pred; |
730 |
- unsigned int c_horiz_pred; |
|
731 | 730 |
unsigned int *vert_pred; |
732 | 731 |
unsigned int *current_pixel_pair; |
733 | 732 |
unsigned int *prev_pixel_pair; |
... | ... |
@@ -753,7 +751,7 @@ static void truemotion1_decode_24bit(TrueMotion1Context *s) |
753 | 753 |
for (y = 0; y < s->avctx->height; y++) { |
754 | 754 |
|
755 | 755 |
/* re-init variables for the next line iteration */ |
756 |
- horiz_pred = c_horiz_pred = 0; |
|
756 |
+ horiz_pred = 0; |
|
757 | 757 |
current_pixel_pair = (unsigned int *)current_line; |
758 | 758 |
prev_pixel_pair = (unsigned int *)prev_line; |
759 | 759 |
vert_pred = s->vert_pred; |
... | ... |
@@ -774,19 +772,15 @@ static void truemotion1_decode_24bit(TrueMotion1Context *s) |
774 | 774 |
APPLY_C_PREDICTOR_24(); |
775 | 775 |
APPLY_Y_PREDICTOR_24(); |
776 | 776 |
OUTPUT_PIXEL_PAIR(); |
777 |
-// OUTPUT_PIXEL_PAIR_24_C(); |
|
778 | 777 |
APPLY_C_PREDICTOR_24(); |
779 | 778 |
APPLY_Y_PREDICTOR_24(); |
780 | 779 |
OUTPUT_PIXEL_PAIR(); |
781 |
-// OUTPUT_PIXEL_PAIR_24_C(); |
|
782 | 780 |
} else { |
783 | 781 |
APPLY_C_PREDICTOR_24(); |
784 | 782 |
APPLY_Y_PREDICTOR_24(); |
785 | 783 |
OUTPUT_PIXEL_PAIR(); |
786 |
-// OUTPUT_PIXEL_PAIR_24_C(); |
|
787 | 784 |
APPLY_Y_PREDICTOR_24(); |
788 | 785 |
OUTPUT_PIXEL_PAIR(); |
789 |
-// OUTPUT_PIXEL_PAIR_24_C(); |
|
790 | 786 |
} |
791 | 787 |
break; |
792 | 788 |
|
... | ... |
@@ -806,19 +800,15 @@ static void truemotion1_decode_24bit(TrueMotion1Context *s) |
806 | 806 |
APPLY_C_PREDICTOR_24(); |
807 | 807 |
APPLY_Y_PREDICTOR_24(); |
808 | 808 |
OUTPUT_PIXEL_PAIR(); |
809 |
-// OUTPUT_PIXEL_PAIR_24_C(); |
|
810 | 809 |
APPLY_C_PREDICTOR_24(); |
811 | 810 |
APPLY_Y_PREDICTOR_24(); |
812 | 811 |
OUTPUT_PIXEL_PAIR(); |
813 |
-// OUTPUT_PIXEL_PAIR_24_C(); |
|
814 | 812 |
} else if (s->block_type == BLOCK_4x2) { |
815 | 813 |
APPLY_C_PREDICTOR_24(); |
816 | 814 |
APPLY_Y_PREDICTOR_24(); |
817 | 815 |
OUTPUT_PIXEL_PAIR(); |
818 |
-// OUTPUT_PIXEL_PAIR_24_C(); |
|
819 | 816 |
APPLY_Y_PREDICTOR_24(); |
820 | 817 |
OUTPUT_PIXEL_PAIR(); |
821 |
-// OUTPUT_PIXEL_PAIR_24_C(); |
|
822 | 818 |
} else { |
823 | 819 |
APPLY_Y_PREDICTOR_24(); |
824 | 820 |
OUTPUT_PIXEL_PAIR(); |
... | ... |
@@ -836,7 +826,6 @@ static void truemotion1_decode_24bit(TrueMotion1Context *s) |
836 | 836 |
*vert_pred++ = *current_pixel_pair++; |
837 | 837 |
*current_pixel_pair = *prev_pixel_pair++; |
838 | 838 |
horiz_pred = *current_pixel_pair - *vert_pred; |
839 |
-// c_horiz_pred = *current_pixel_pair - *vert_pred; |
|
840 | 839 |
*vert_pred++ = *current_pixel_pair++; |
841 | 840 |
|
842 | 841 |
} |