[FFmpeg-soc] [soc]: r833 - in rv40: rv40.c rv40data.h
kostya
subversion at mplayerhq.hu
Thu Aug 16 09:14:53 CEST 2007
Author: kostya
Date: Thu Aug 16 09:14:52 2007
New Revision: 833
Log:
Correct determining of slice offset size
Modified:
rv40/rv40.c
rv40/rv40data.h
Modified: rv40/rv40.c
==============================================================================
--- rv40/rv40.c (original)
+++ rv40/rv40.c Thu Aug 16 09:14:52 2007
@@ -546,6 +546,7 @@ static int rv40_parse_slice_header(RV40D
{
int t, mb_bits;
int w = r->s.avctx->coded_width, h = r->s.avctx->coded_height;
+ int i, mb_size;
memset(si, 0, sizeof(SliceInfo));
si->type = -1;
@@ -566,7 +567,11 @@ static int rv40_parse_slice_header(RV40D
get_bits1(gb);
si->width = w;
si->height = h;
- mb_bits = av_log2((w + 7) >> 3) + av_log2((h + 7) >> 3);
+ mb_size = ((w + 15) >> 4) * ((h + 15) >> 4);
+ for(i = 0; i < 5; i++)
+ if(rv40_mb_max_sizes[i] > mb_size)
+ break;
+ mb_bits = rv40_mb_bits_sizes[i];
si->start = get_bits(gb, mb_bits);
si->header_size = get_bits_count(gb);
Modified: rv40/rv40data.h
==============================================================================
--- rv40/rv40data.h (original)
+++ rv40/rv40data.h Thu Aug 16 09:14:52 2007
@@ -167,4 +167,14 @@ static const int8_t rv40_dquant_tab[] =
-2, 2, -2, 2, -2, 2, -2, 2, -2, 2, -3, 3, -3, 3, -3, 3,
-3, 3, -3, 3, -3, 3, -3, 3, -3, 3, -3, 2, -3, 1, -3, -5
};
+
+/**
+ * Maximum number of macroblocks for each of the possible slice offset sizes
+ */
+static const uint16_t rv40_mb_max_sizes[6] = { 0x2F, 0x68, 0x18B, 0x62F, 0x18BF, 0x23FF };
+/**
+ * Bits needed to code slice offset for the given size
+ */
+static const uint8_t rv40_mb_bits_sizes[6] = { 6, 7, 9, 11, 13, 14 };
+
#endif /* RV40DATA_H */
More information about the FFmpeg-soc
mailing list