Skip to content

Commit 3c0558c

Browse files
committed
cellGem: Implement CELL_CAMERA_RAW8 to CELL_GEM_BAYER_RESTORED_RGGB
1 parent c381466 commit 3c0558c

File tree

1 file changed

+41
-4
lines changed

1 file changed

+41
-4
lines changed

rpcs3/Emu/Cell/Modules/cellGem.cpp

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,43 @@ namespace gem
11501150
break;
11511151
}
11521152
case CELL_GEM_BAYER_RESTORED_RGGB: // Restored Bayer output, 2x2 pixels rearranged into 320x240 RG1G2B
1153+
{
1154+
if (input_format == CELL_CAMERA_RAW8)
1155+
{
1156+
const u32 dst_w = std::min(320u, width / 2);
1157+
const u32 dst_h = std::min(240u, height / 2);
1158+
const u32 in_pitch = width;
1159+
constexpr u32 out_pitch = 320 * 4;
1160+
1161+
for (u32 y = 0; y < dst_h; y++)
1162+
{
1163+
const u8* src0 = &video_data_in[y * 2 * in_pitch];
1164+
const u8* src1 = src0 + in_pitch;
1165+
1166+
u8* dst = video_data_out + y * out_pitch;
1167+
1168+
for (u32 x = 0; x < dst_w; x++, src0 += 2, src1 += 2, dst += 4)
1169+
{
1170+
const u8 b = src0[0];
1171+
const u8 g0 = src0[1];
1172+
const u8 g1 = src1[0];
1173+
const u8 r = src1[1];
1174+
1175+
dst[0] = r;
1176+
dst[1] = g0;
1177+
dst[2] = g1;
1178+
dst[3] = b;
1179+
}
1180+
}
1181+
}
1182+
else
1183+
{
1184+
cellGem.error("Unimplemented: Converting %s to %s (called from %s)", input_format, output_format, caller);
1185+
std::memcpy(video_data_out, video_data_in.data(), std::min<usz>(required_in_size, required_out_size));
1186+
return false;
1187+
}
1188+
break;
1189+
}
11531190
case CELL_GEM_BAYER_RESTORED_RASTERIZED: // Restored Bayer output, R,G1,G2,B rearranged into 4 contiguous 320x240 1-channel rasters
11541191
{
11551192
cellGem.error("Unimplemented: Converting %s to %s (called from %s)", input_format, output_format, caller);
@@ -1705,10 +1742,10 @@ static inline void pos_to_gem_state(u32 gem_num, gem_config::gem_controller& con
17051742
// Calculate orientation
17061743
if (g_cfg.io.move == move_handler::real || (g_cfg.io.move == move_handler::fake && move_data.orientation_enabled))
17071744
{
1708-
gem_state->quat[0] = move_data.quaternion[0]; // x
1709-
gem_state->quat[1] = move_data.quaternion[1]; // y
1710-
gem_state->quat[2] = move_data.quaternion[2]; // z
1711-
gem_state->quat[3] = move_data.quaternion[3]; // w
1745+
gem_state->quat[0] = move_data.quaternion.x();
1746+
gem_state->quat[1] = move_data.quaternion.y();
1747+
gem_state->quat[2] = move_data.quaternion.z();
1748+
gem_state->quat[3] = move_data.quaternion.w();
17121749
}
17131750
else
17141751
{

0 commit comments

Comments
 (0)