summaryrefslogtreecommitdiff
path: root/apps/plugins/mpegplayer/slice.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-04-14 16:35:44 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-04-14 16:35:44 +0000
commitf4b5a723b06b25babe201b0a97bdeebc716f5bba (patch)
tree10a759a0438df774a7b1eab6af0e3995f85ae4d3 /apps/plugins/mpegplayer/slice.c
parent32bd59d4f75f135b26a537f438e0d6b893f1cdfb (diff)
downloadrockbox-f4b5a723b06b25babe201b0a97bdeebc716f5bba.zip
rockbox-f4b5a723b06b25babe201b0a97bdeebc716f5bba.tar.gz
rockbox-f4b5a723b06b25babe201b0a97bdeebc716f5bba.tar.bz2
rockbox-f4b5a723b06b25babe201b0a97bdeebc716f5bba.tar.xz
mpeg2dec in mpegplayer: Do a little code slashing and organizing. Much more to come I think.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13159 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/mpegplayer/slice.c')
-rw-r--r--apps/plugins/mpegplayer/slice.c67
1 files changed, 28 insertions, 39 deletions
diff --git a/apps/plugins/mpegplayer/slice.c b/apps/plugins/mpegplayer/slice.c
index 8ee3417..7c1c07b 100644
--- a/apps/plugins/mpegplayer/slice.c
+++ b/apps/plugins/mpegplayer/slice.c
@@ -34,8 +34,6 @@ extern mpeg2_mc_t mpeg2_mc;
extern void (* mpeg2_idct_copy) (int16_t * block, uint8_t * dest, int stride);
extern void (* mpeg2_idct_add) (int last, int16_t * block,
uint8_t * dest, int stride);
-extern void (* mpeg2_cpu_state_save) (cpu_state_t * state);
-extern void (* mpeg2_cpu_state_restore) (cpu_state_t * state);
#include "vlc.h"
@@ -1554,39 +1552,36 @@ static void motion_fi_conceal (mpeg2_decoder_t * const decoder)
#undef bits
#undef bit_ptr
-#define MOTION_CALL(routine,direction) \
-do { \
- if ((direction) & MACROBLOCK_MOTION_FORWARD) \
- routine (decoder, &(decoder->f_motion), mpeg2_mc.put); \
- if ((direction) & MACROBLOCK_MOTION_BACKWARD) \
- routine (decoder, &(decoder->b_motion), \
- ((direction) & MACROBLOCK_MOTION_FORWARD ? \
- mpeg2_mc.avg : mpeg2_mc.put)); \
+#define MOTION_CALL(routine,direction) \
+do { \
+ if ((direction) & MACROBLOCK_MOTION_FORWARD) \
+ routine (decoder, &(decoder->f_motion), mpeg2_mc.put); \
+ if ((direction) & MACROBLOCK_MOTION_BACKWARD) \
+ routine (decoder, &(decoder->b_motion), \
+ ((direction) & MACROBLOCK_MOTION_FORWARD ? \
+ mpeg2_mc.avg : mpeg2_mc.put)); \
} while (0)
-#define NEXT_MACROBLOCK \
-do { \
- decoder->offset += 16; \
- if (decoder->offset == decoder->width) { \
- do { /* just so we can use the break statement */ \
- if (decoder->convert) { \
- decoder->convert (decoder->convert_id, decoder->dest, \
- decoder->v_offset); \
- if (decoder->coding_type == B_TYPE) \
- break; \
- } \
- decoder->dest[0] += decoder->slice_stride; \
- decoder->dest[1] += decoder->slice_uv_stride; \
- decoder->dest[2] += decoder->slice_uv_stride; \
- } while (0); \
- decoder->v_offset += 16; \
- if (decoder->v_offset > decoder->limit_y) { \
- if (mpeg2_cpu_state_restore) \
- mpeg2_cpu_state_restore (&cpu_state); \
- return; \
- } \
- decoder->offset = 0; \
- } \
+#define NEXT_MACROBLOCK \
+do { \
+ decoder->offset += 16; \
+ if (decoder->offset == decoder->width) { \
+ do { /* just so we can use the break statement */ \
+ if (decoder->convert) { \
+ decoder->convert (decoder->convert_id, decoder->dest, \
+ decoder->v_offset); \
+ if (decoder->coding_type == B_TYPE) \
+ break; \
+ } \
+ decoder->dest[0] += decoder->slice_stride; \
+ decoder->dest[1] += decoder->slice_uv_stride; \
+ decoder->dest[2] += decoder->slice_uv_stride; \
+ } while (0); \
+ decoder->v_offset += 16; \
+ if (decoder->v_offset > decoder->limit_y) \
+ return; \
+ decoder->offset = 0; \
+ } \
} while (0)
void mpeg2_init_fbuf (mpeg2_decoder_t * decoder, uint8_t * current_fbuf[3],
@@ -1780,16 +1775,12 @@ void mpeg2_slice (mpeg2_decoder_t * const decoder, const int code,
#define bit_buf (decoder->bitstream_buf)
#define bits (decoder->bitstream_bits)
#define bit_ptr (decoder->bitstream_ptr)
- cpu_state_t cpu_state;
bitstream_init (decoder, buffer);
if (slice_init (decoder, code))
return;
- if (mpeg2_cpu_state_save)
- mpeg2_cpu_state_save (&cpu_state);
-
while (1) {
int macroblock_modes;
int mba_inc;
@@ -2028,8 +2019,6 @@ void mpeg2_slice (mpeg2_decoder_t * const decoder, const int code,
NEEDBITS (bit_buf, bits, bit_ptr);
continue;
default: /* end of slice, or error */
- if (mpeg2_cpu_state_restore)
- mpeg2_cpu_state_restore (&cpu_state);
return;
}
}