mirror of
https://github.com/cemu-project/Cemu.git
synced 2026-04-16 21:31:27 -06:00
Revert "Give up on using the precompiled headers"
This reverts commit 9fb8618c44.
This commit is contained in:
parent
e457dca5fb
commit
a4478db4b3
@ -11,6 +11,8 @@ 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,18 +1,13 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace CameraManager
|
||||
{
|
||||
constexpr uint32_t CAMERA_WIDTH = 640;
|
||||
constexpr uint32_t CAMERA_HEIGHT = 480;
|
||||
constexpr uint32_t CAMERA_PITCH = 768;
|
||||
constexpr uint32 CAMERA_WIDTH = 640;
|
||||
constexpr uint32 CAMERA_HEIGHT = 480;
|
||||
constexpr uint32 CAMERA_PITCH = 768;
|
||||
|
||||
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;
|
||||
constexpr uint32 CAMERA_NV12_BUFFER_SIZE = (CAMERA_HEIGHT * CAMERA_PITCH * 3) >> 1;
|
||||
constexpr uint32 CAMERA_RGB_BUFFER_SIZE = CAMERA_HEIGHT * CAMERA_WIDTH * 3;
|
||||
|
||||
struct DeviceInfo
|
||||
{
|
||||
@ -23,12 +18,12 @@ namespace CameraManager
|
||||
void Open();
|
||||
void Close();
|
||||
|
||||
void FillNV12Buffer(std::span<uint8_t, CAMERA_NV12_BUFFER_SIZE> nv12Buffer);
|
||||
void FillRGBBuffer(std::span<uint8_t, CAMERA_RGB_BUFFER_SIZE> rgbBuffer);
|
||||
void FillNV12Buffer(std::span<uint8, CAMERA_NV12_BUFFER_SIZE> nv12Buffer);
|
||||
void FillRGBBuffer(std::span<uint8, CAMERA_RGB_BUFFER_SIZE> rgbBuffer);
|
||||
|
||||
void SetDevice(uint32_t deviceNo);
|
||||
void SetDevice(uint32 deviceNo);
|
||||
void ResetDevice();
|
||||
std::vector<DeviceInfo> EnumerateDevices();
|
||||
void SaveDevice();
|
||||
std::optional<uint32_t> GetCurrentDevice();
|
||||
std::optional<uint32> GetCurrentDevice();
|
||||
} // namespace CameraManager
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
// Based on https://github.com/cohenrotem/Rgb2NV12
|
||||
#include "Rgb2Nv12.h"
|
||||
#include <cstdint>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
constexpr static glm::mat3x3 COEFFICIENT_MATRIX =
|
||||
{
|
||||
@ -15,12 +13,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_t* topLine,
|
||||
const uint8_t* bottomLine,
|
||||
static void Rgb2Nv12TwoRows(const uint8* topLine,
|
||||
const uint8* bottomLine,
|
||||
unsigned imageWidth,
|
||||
uint8_t* topLineY,
|
||||
uint8_t* bottomLineY,
|
||||
uint8_t* uv)
|
||||
uint8* topLineY,
|
||||
uint8* bottomLineY,
|
||||
uint8* uv)
|
||||
{
|
||||
auto* topIn = reinterpret_cast<const glm::u8vec3*>(topLine);
|
||||
auto* botIn = reinterpret_cast<const glm::u8vec3*>(bottomLine);
|
||||
@ -46,12 +44,13 @@ static void Rgb2Nv12TwoRows(const uint8_t* topLine,
|
||||
}
|
||||
}
|
||||
|
||||
void Rgb2Nv12(const uint8_t* rgbImage,
|
||||
void Rgb2Nv12(const uint8* rgbImage,
|
||||
unsigned imageWidth,
|
||||
unsigned imageHeight,
|
||||
uint8_t* outNv12Image,
|
||||
uint8* outNv12Image,
|
||||
unsigned nv12Pitch)
|
||||
{
|
||||
cemu_assert_debug(!((imageWidth | imageHeight) & 1));
|
||||
unsigned char* UV = outNv12Image + nv12Pitch * imageHeight;
|
||||
|
||||
for (auto row = 0u; row < imageHeight; row += 2)
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
void Rgb2Nv12(const uint8_t* rgbImage,
|
||||
void Rgb2Nv12(const uint8* rgbImage,
|
||||
unsigned imageWidth,
|
||||
unsigned imageHeight,
|
||||
uint8_t* outNv12Image,
|
||||
uint8* outNv12Image,
|
||||
unsigned nv12Pitch);
|
||||
Loading…
Reference in New Issue
Block a user