Skip to content

Commit ce9f89f

Browse files
committed
Revert "Give up on using the precompiled headers"
This reverts commit 9fb8618.
1 parent 9fb8618 commit ce9f89f

5 files changed

Lines changed: 22 additions & 27 deletions

File tree

src/camera/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ set_property(TARGET CemuCamera PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<C
1111
target_include_directories(CemuCamera PUBLIC "../")
1212
target_link_libraries(CemuCamera
1313
PRIVATE
14+
CemuCommon
15+
CemuGui
1416
CemuUtil
1517
glm::glm
1618
openpnp-capture)

src/camera/CameraManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#include "Rgb2Nv12.h"
66

77
#include <algorithm>
8-
#include <atomic>
98
#include <mutex>
9+
#include <optional>
1010
#include <thread>
1111

1212
#include <openpnp-capture.h>

src/camera/CameraManager.h

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
#pragma once
2-
#include <cstdint>
3-
#include <optional>
4-
#include <span>
5-
#include <string>
6-
#include <vector>
72

83
namespace CameraManager
94
{
10-
constexpr uint32_t CAMERA_WIDTH = 640;
11-
constexpr uint32_t CAMERA_HEIGHT = 480;
12-
constexpr uint32_t CAMERA_PITCH = 768;
5+
constexpr uint32 CAMERA_WIDTH = 640;
6+
constexpr uint32 CAMERA_HEIGHT = 480;
7+
constexpr uint32 CAMERA_PITCH = 768;
138

14-
constexpr uint32_t CAMERA_NV12_BUFFER_SIZE = (CAMERA_HEIGHT * CAMERA_PITCH * 3) >> 1;
15-
constexpr uint32_t CAMERA_RGB_BUFFER_SIZE = CAMERA_HEIGHT * CAMERA_WIDTH * 3;
9+
constexpr uint32 CAMERA_NV12_BUFFER_SIZE = (CAMERA_HEIGHT * CAMERA_PITCH * 3) >> 1;
10+
constexpr uint32 CAMERA_RGB_BUFFER_SIZE = CAMERA_HEIGHT * CAMERA_WIDTH * 3;
1611

1712
struct DeviceInfo
1813
{
@@ -23,12 +18,12 @@ namespace CameraManager
2318
void Open();
2419
void Close();
2520

26-
void FillNV12Buffer(std::span<uint8_t, CAMERA_NV12_BUFFER_SIZE> nv12Buffer);
27-
void FillRGBBuffer(std::span<uint8_t, CAMERA_RGB_BUFFER_SIZE> rgbBuffer);
21+
void FillNV12Buffer(std::span<uint8, CAMERA_NV12_BUFFER_SIZE> nv12Buffer);
22+
void FillRGBBuffer(std::span<uint8, CAMERA_RGB_BUFFER_SIZE> rgbBuffer);
2823

29-
void SetDevice(uint32_t deviceNo);
24+
void SetDevice(uint32 deviceNo);
3025
void ResetDevice();
3126
std::vector<DeviceInfo> EnumerateDevices();
3227
void SaveDevice();
33-
std::optional<uint32_t> GetCurrentDevice();
28+
std::optional<uint32> GetCurrentDevice();
3429
} // namespace CameraManager

src/camera/Rgb2Nv12.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// Based on https://github.com/cohenrotem/Rgb2NV12
22
#include "Rgb2Nv12.h"
3-
#include <cstdint>
4-
#include <glm/glm.hpp>
53

64
constexpr static glm::mat3x3 COEFFICIENT_MATRIX =
75
{
@@ -15,12 +13,12 @@ constexpr static glm::mat4x3 OFFSET_MATRIX = {
1513
16.0f + 0.5f, 128.0f + 2.0f, 128.0f + 2.0f,
1614
16.0f + 0.5f, 128.0f + 2.0f, 128.0f + 2.0f};
1715

18-
static void Rgb2Nv12TwoRows(const uint8_t* topLine,
19-
const uint8_t* bottomLine,
16+
static void Rgb2Nv12TwoRows(const uint8* topLine,
17+
const uint8* bottomLine,
2018
unsigned imageWidth,
21-
uint8_t* topLineY,
22-
uint8_t* bottomLineY,
23-
uint8_t* uv)
19+
uint8* topLineY,
20+
uint8* bottomLineY,
21+
uint8* uv)
2422
{
2523
auto* topIn = reinterpret_cast<const glm::u8vec3*>(topLine);
2624
auto* botIn = reinterpret_cast<const glm::u8vec3*>(bottomLine);
@@ -46,12 +44,13 @@ static void Rgb2Nv12TwoRows(const uint8_t* topLine,
4644
}
4745
}
4846

49-
void Rgb2Nv12(const uint8_t* rgbImage,
47+
void Rgb2Nv12(const uint8* rgbImage,
5048
unsigned imageWidth,
5149
unsigned imageHeight,
52-
uint8_t* outNv12Image,
50+
uint8* outNv12Image,
5351
unsigned nv12Pitch)
5452
{
53+
cemu_assert_debug(!((imageWidth | imageHeight) & 1));
5554
unsigned char* UV = outNv12Image + nv12Pitch * imageHeight;
5655

5756
for (auto row = 0u; row < imageHeight; row += 2)

src/camera/Rgb2Nv12.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#pragma once
2-
#include <cstdint>
32

4-
void Rgb2Nv12(const uint8_t* rgbImage,
3+
void Rgb2Nv12(const uint8* rgbImage,
54
unsigned imageWidth,
65
unsigned imageHeight,
7-
uint8_t* outNv12Image,
6+
uint8* outNv12Image,
87
unsigned nv12Pitch);

0 commit comments

Comments
 (0)