mirror of
https://github.com/cemu-project/Cemu.git
synced 2026-04-16 21:31:27 -06:00
Give up on using the precompiled headers
This commit is contained in:
parent
49c33981a7
commit
e457dca5fb
@ -11,8 +11,6 @@ set_property(TARGET CemuCamera PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<C
|
||||
target_include_directories(CemuCamera PUBLIC "../")
|
||||
target_link_libraries(CemuCamera
|
||||
PRIVATE
|
||||
CemuCommon
|
||||
CemuGui
|
||||
CemuUtil
|
||||
glm::glm
|
||||
openpnp-capture)
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
#include "Rgb2Nv12.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <thread>
|
||||
|
||||
#include <openpnp-capture.h>
|
||||
|
||||
@ -1,13 +1,18 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace CameraManager
|
||||
{
|
||||
constexpr uint32 CAMERA_WIDTH = 640;
|
||||
constexpr uint32 CAMERA_HEIGHT = 480;
|
||||
constexpr uint32 CAMERA_PITCH = 768;
|
||||
constexpr uint32_t CAMERA_WIDTH = 640;
|
||||
constexpr uint32_t CAMERA_HEIGHT = 480;
|
||||
constexpr uint32_t CAMERA_PITCH = 768;
|
||||
|
||||
constexpr uint32 CAMERA_NV12_BUFFER_SIZE = (CAMERA_HEIGHT * CAMERA_PITCH * 3) >> 1;
|
||||
constexpr uint32 CAMERA_RGB_BUFFER_SIZE = CAMERA_HEIGHT * CAMERA_WIDTH * 3;
|
||||
constexpr uint32_t CAMERA_NV12_BUFFER_SIZE = (CAMERA_HEIGHT * CAMERA_PITCH * 3) >> 1;
|
||||
constexpr uint32_t CAMERA_RGB_BUFFER_SIZE = CAMERA_HEIGHT * CAMERA_WIDTH * 3;
|
||||
|
||||
struct DeviceInfo
|
||||
{
|
||||
@ -18,12 +23,12 @@ namespace CameraManager
|
||||
void Open();
|
||||
void Close();
|
||||
|
||||
void FillNV12Buffer(std::span<uint8, CAMERA_NV12_BUFFER_SIZE> nv12Buffer);
|
||||
void FillRGBBuffer(std::span<uint8, CAMERA_RGB_BUFFER_SIZE> rgbBuffer);
|
||||
void FillNV12Buffer(std::span<uint8_t, CAMERA_NV12_BUFFER_SIZE> nv12Buffer);
|
||||
void FillRGBBuffer(std::span<uint8_t, CAMERA_RGB_BUFFER_SIZE> rgbBuffer);
|
||||
|
||||
void SetDevice(uint32 deviceNo);
|
||||
void SetDevice(uint32_t deviceNo);
|
||||
void ResetDevice();
|
||||
std::vector<DeviceInfo> EnumerateDevices();
|
||||
void SaveDevice();
|
||||
std::optional<uint32> GetCurrentDevice();
|
||||
std::optional<uint32_t> GetCurrentDevice();
|
||||
} // namespace CameraManager
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
// Based on https://github.com/cohenrotem/Rgb2NV12
|
||||
#include "Rgb2Nv12.h"
|
||||
#include <cstdint>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
constexpr static glm::mat3x3 COEFFICIENT_MATRIX =
|
||||
{
|
||||
@ -13,12 +15,12 @@ constexpr static glm::mat4x3 OFFSET_MATRIX = {
|
||||
16.0f + 0.5f, 128.0f + 2.0f, 128.0f + 2.0f,
|
||||
16.0f + 0.5f, 128.0f + 2.0f, 128.0f + 2.0f};
|
||||
|
||||
static void Rgb2Nv12TwoRows(const uint8* topLine,
|
||||
const uint8* bottomLine,
|
||||
static void Rgb2Nv12TwoRows(const uint8_t* topLine,
|
||||
const uint8_t* bottomLine,
|
||||
unsigned imageWidth,
|
||||
uint8* topLineY,
|
||||
uint8* bottomLineY,
|
||||
uint8* uv)
|
||||
uint8_t* topLineY,
|
||||
uint8_t* bottomLineY,
|
||||
uint8_t* uv)
|
||||
{
|
||||
auto* topIn = reinterpret_cast<const glm::u8vec3*>(topLine);
|
||||
auto* botIn = reinterpret_cast<const glm::u8vec3*>(bottomLine);
|
||||
@ -44,13 +46,12 @@ static void Rgb2Nv12TwoRows(const uint8* topLine,
|
||||
}
|
||||
}
|
||||
|
||||
void Rgb2Nv12(const uint8* rgbImage,
|
||||
void Rgb2Nv12(const uint8_t* rgbImage,
|
||||
unsigned imageWidth,
|
||||
unsigned imageHeight,
|
||||
uint8* outNv12Image,
|
||||
uint8_t* outNv12Image,
|
||||
unsigned nv12Pitch)
|
||||
{
|
||||
cemu_assert_debug(!((imageWidth | imageHeight) & 1));
|
||||
unsigned char* UV = outNv12Image + nv12Pitch * imageHeight;
|
||||
|
||||
for (auto row = 0u; row < imageHeight; row += 2)
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
void Rgb2Nv12(const uint8* rgbImage,
|
||||
void Rgb2Nv12(const uint8_t* rgbImage,
|
||||
unsigned imageWidth,
|
||||
unsigned imageHeight,
|
||||
uint8* outNv12Image,
|
||||
uint8_t* outNv12Image,
|
||||
unsigned nv12Pitch);
|
||||
Loading…
Reference in New Issue
Block a user