* JPEG decoding ucode found in Ogre Battle and Bottom of the 9th. **************************************************************************/
| 197 | * JPEG decoding ucode found in Ogre Battle and Bottom of the 9th. |
| 198 | **************************************************************************/ |
| 199 | void jpeg_decode_OB(OSTask *task) |
| 200 | { |
| 201 | s16 qtable[SUBBLOCK_SIZE] {}; |
| 202 | u32 mb {}; |
| 203 | |
| 204 | s32 y_dc {}, u_dc {}, v_dc {}; |
| 205 | |
| 206 | u32 address {(u32)task->t.data_ptr}; |
| 207 | const u32 macroblock_count {task->t.data_size}; |
| 208 | const u32 qscale {task->t.yield_data_size}; |
| 209 | |
| 210 | if (task->t.yield_data_size != 0 ) |
| 211 | { |
| 212 | if (task->t.yield_data_size > 0) |
| 213 | { |
| 214 | ScaleSubBlock(qtable, DEFAULT_QTABLE, qscale); |
| 215 | } |
| 216 | else |
| 217 | { |
| 218 | RShiftSubBlock(qtable, DEFAULT_QTABLE, -qscale); |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | for (mb = 0; mb < macroblock_count; ++mb) |
| 223 | { |
| 224 | s16 macroblock[6*SUBBLOCK_SIZE]; |
| 225 | |
| 226 | rdram_read_many_u16((u16*)macroblock, address, 6*SUBBLOCK_SIZE); |
| 227 | DecodeMacroblock1(macroblock, &y_dc, &u_dc, &v_dc, (qscale != 0) ? qtable : nullptr); |
| 228 | EmitTilesMode2(EmitYUVTileLine, macroblock, address); |
| 229 | |
| 230 | address += (2*6*SUBBLOCK_SIZE); |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | static u8 clamp_u8(s16 x) |
| 235 | { |
no test coverage detected