summaryrefslogtreecommitdiff
path: root/apps/plugins/mpegplayer/header.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-01-16 01:22:56 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-01-16 01:22:56 +0000
commit0c7f2372d5887f6a1e9d76f04cd4ddbd1b5e402b (patch)
tree2dac505f17d2ec7a8fb63b8f1009f4c385b10ab1 /apps/plugins/mpegplayer/header.c
parent74d61058dcaf1c0d036a708fd3fcdc35139a1fab (diff)
downloadrockbox-0c7f2372d5887f6a1e9d76f04cd4ddbd1b5e402b.zip
rockbox-0c7f2372d5887f6a1e9d76f04cd4ddbd1b5e402b.tar.gz
rockbox-0c7f2372d5887f6a1e9d76f04cd4ddbd1b5e402b.tar.bz2
rockbox-0c7f2372d5887f6a1e9d76f04cd4ddbd1b5e402b.tar.xz
libmpeg2: Decode only Y on grayscale targets. The chroma skip code is probably less than optimal since it's basically the decoding code with minimum reading of the bitstream but it does the trick for now and gets some more FPS.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16093 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/mpegplayer/header.c')
-rw-r--r--apps/plugins/mpegplayer/header.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/apps/plugins/mpegplayer/header.c b/apps/plugins/mpegplayer/header.c
index 9e6e6de..3dd3d28 100644
--- a/apps/plugins/mpegplayer/header.c
+++ b/apps/plugins/mpegplayer/header.c
@@ -102,8 +102,10 @@ void mpeg2_header_state_init (mpeg2dec_t * mpeg2dec)
i < mpeg2dec->alloc_index; i++)
{
mpeg2_free(mpeg2dec->fbuf_alloc[i].fbuf.buf[0]);
+#if MPEG2_COLOR
mpeg2_free(mpeg2dec->fbuf_alloc[i].fbuf.buf[1]);
mpeg2_free(mpeg2dec->fbuf_alloc[i].fbuf.buf[2]);
+#endif
}
}
@@ -113,8 +115,10 @@ void mpeg2_header_state_init (mpeg2dec_t * mpeg2dec)
for (i = 0; i < 3; i++)
{
mpeg2_free(mpeg2dec->yuv_buf[i][0]);
+#if MPEG2_COLOR
mpeg2_free(mpeg2dec->yuv_buf[i][1]);
mpeg2_free(mpeg2dec->yuv_buf[i][2]);
+#endif
}
}
@@ -840,8 +844,6 @@ void mpeg2_header_picture_finalize (mpeg2dec_t * mpeg2dec)
if (!mpeg2dec->convert_start)
{
- int y_size, uv_size;
-
mpeg2dec->decoder.convert_id =
mpeg2_malloc (mpeg2dec->convert_id_size,
MPEG2_ALLOC_CONVERT_ID);
@@ -855,32 +857,39 @@ void mpeg2_header_picture_finalize (mpeg2dec_t * mpeg2dec)
mpeg2dec->convert_start = convert_init.start;
mpeg2dec->decoder.convert = convert_init.copy;
- y_size = decoder->stride_frame * mpeg2dec->sequence.height;
- uv_size = y_size >> (2 - mpeg2dec->decoder.chroma_format);
+ int y_size = decoder->stride_frame * mpeg2dec->sequence.height;
mpeg2dec->yuv_buf[0][0] =
(uint8_t *) mpeg2_malloc(y_size, MPEG2_ALLOC_YUV);
+#if MPEG2_COLOR
+ int uv_size = y_size >> (2 - mpeg2dec->decoder.chroma_format);
+
mpeg2dec->yuv_buf[0][1] =
(uint8_t *) mpeg2_malloc(uv_size, MPEG2_ALLOC_YUV);
mpeg2dec->yuv_buf[0][2] =
(uint8_t *) mpeg2_malloc(uv_size, MPEG2_ALLOC_YUV);
+#endif
mpeg2dec->yuv_buf[1][0] =
(uint8_t *) mpeg2_malloc(y_size, MPEG2_ALLOC_YUV);
+#if MPEG2_COLOR
mpeg2dec->yuv_buf[1][1] =
(uint8_t *) mpeg2_malloc(uv_size, MPEG2_ALLOC_YUV);
mpeg2dec->yuv_buf[1][2] =
(uint8_t *) mpeg2_malloc(uv_size, MPEG2_ALLOC_YUV);
-
+#endif
y_size = decoder->stride_frame * 32;
- uv_size = y_size >> (2 - mpeg2dec->decoder.chroma_format);
mpeg2dec->yuv_buf[2][0] =
(uint8_t *) mpeg2_malloc(y_size, MPEG2_ALLOC_YUV);
+#if MPEG2_COLOR
+ uv_size = y_size >> (2 - mpeg2dec->decoder.chroma_format);
+
mpeg2dec->yuv_buf[2][1] =
(uint8_t *) mpeg2_malloc(uv_size, MPEG2_ALLOC_YUV);
mpeg2dec->yuv_buf[2][2] =
(uint8_t *) mpeg2_malloc(uv_size, MPEG2_ALLOC_YUV);
+#endif
}
if (!mpeg2dec->custom_fbuf)
@@ -895,13 +904,16 @@ void mpeg2_header_picture_finalize (mpeg2dec_t * mpeg2dec)
fbuf->buf[0] =
(uint8_t *) mpeg2_malloc (convert_init.buf_size[0],
MPEG2_ALLOC_CONVERTED);
+#if MPEG2_COLOR
fbuf->buf[1] =
(uint8_t *) mpeg2_malloc (convert_init.buf_size[1],
MPEG2_ALLOC_CONVERTED);
fbuf->buf[2] =
(uint8_t *) mpeg2_malloc (convert_init.buf_size[2],
MPEG2_ALLOC_CONVERTED);
+#endif
}
+
mpeg2_set_fbuf (mpeg2dec, (decoder->coding_type == B_TYPE));
}
}
@@ -910,21 +922,23 @@ void mpeg2_header_picture_finalize (mpeg2dec_t * mpeg2dec)
while (mpeg2dec->alloc_index < 3)
{
mpeg2_fbuf_t * fbuf;
- int y_size, uv_size;
fbuf = &mpeg2dec->fbuf_alloc[mpeg2dec->alloc_index++].fbuf;
fbuf->id = NULL;
- y_size = decoder->stride_frame * mpeg2dec->sequence.height;
- uv_size = y_size >> (2 - decoder->chroma_format);
+ int y_size = decoder->stride_frame * mpeg2dec->sequence.height;
fbuf->buf[0] = (uint8_t *) mpeg2_malloc (y_size,
MPEG2_ALLOC_YUV);
+#if MPEG2_COLOR
+ int uv_size = y_size >> (2 - decoder->chroma_format);
+
fbuf->buf[1] = (uint8_t *) mpeg2_malloc (uv_size,
MPEG2_ALLOC_YUV);
fbuf->buf[2] = (uint8_t *) mpeg2_malloc (uv_size,
MPEG2_ALLOC_YUV);
+#endif
}
mpeg2_set_fbuf (mpeg2dec, (decoder->coding_type == B_TYPE));