/* Phase 3 player, slave SH-2: decode and convert the lower half (MB rows 6-11) of each * frame, when the master raises COMM6 (m_main.c). */ #include "mars.h" #include "c1dec.h" #include "c1job.h" static uint8_t prev_changed[C1_NMB], mask[C1_NMB]; static c1_fast_t fast_s; void s_main(void) { for (int k = C1_HALF; k < C1_NMB; k++) prev_changed[k] = 1; /* both buffers start black */ c1_fast_init(&fast_s); for (;;) { while (MARS_SYS_COMM6 == 0) c1_pause(); CacheControl(SH2_CCTL_CP | SH2_CCTL_CE); /* the job, and the master's half of the reference */ int ref = c1_job.ref; c1_decode_half(&fast_s, c1_job.payload, 1, &c1_p[ref], &c1_p[ref ^ 1], c1_changed); for (int k = C1_HALF; k < C1_NMB; k++) { mask[k] = c1_changed[k] | prev_changed[k]; prev_changed[k] = c1_changed[k]; } volatile uint16_t *fb = &MARS_FRAMEBUFFER; c1_to_rgb555(&fast_s, &c1_p[ref ^ 1], fb + C1_FB_BASE, mask, C1_MBY / 2, C1_MBY); MARS_SYS_COMM6 = 0; } }