mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 00:49:19 +02:00
cleanup: remove VSDev camera implementation, remove symbols from CI because they are unreasonably big, mac CI tmp upload
This commit is contained in:
@@ -49,7 +49,6 @@ option(WITH_OPENGL_LEGACY "Compile with OpenGL legacy renderer" ON)
|
|||||||
option(WITH_UART "Compile with libserialport" ON)
|
option(WITH_UART "Compile with libserialport" ON)
|
||||||
option(WITH_OPENVR "Compile with OpenVR" ON)
|
option(WITH_OPENVR "Compile with OpenVR" ON)
|
||||||
option(WITH_ZMQ "Compile with cppzmq" OFF)
|
option(WITH_ZMQ "Compile with cppzmq" OFF)
|
||||||
option(USE_VSDEV_CAMERA "Use VS_Dev camera preview implementation" OFF)
|
|
||||||
option(USE_LTO "Use link-time optimization" OFF)
|
option(USE_LTO "Use link-time optimization" OFF)
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
@@ -240,13 +239,7 @@ if (WITH_OPENGL_LEGACY)
|
|||||||
add_definitions(-DWITH_OPENGL_LEGACY)
|
add_definitions(-DWITH_OPENGL_LEGACY)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (USE_VSDEV_CAMERA)
|
set(SOURCES ${SOURCES} "extras/piped_proc.cpp" "widgets/cameraview_extcam.cpp")
|
||||||
add_definitions(-DUSE_VSDEV_CAMERA)
|
|
||||||
set(SOURCES ${SOURCES} "extras/VS_Dev.cpp" "widgets/cameraview_vsdev.cpp")
|
|
||||||
else()
|
|
||||||
add_definitions(-DUSE_EXTCAM_CAMERA)
|
|
||||||
set(SOURCES ${SOURCES} "extras/piped_proc.cpp" "widgets/cameraview_extcam.cpp")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(Git REQUIRED)
|
find_package(Git REQUIRED)
|
||||||
|
|
||||||
|
|||||||
@@ -792,7 +792,6 @@ global_settings::ConfigParse(cParser &Parser) {
|
|||||||
Parser >> zmq_address;
|
Parser >> zmq_address;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_EXTCAM_CAMERA
|
|
||||||
else if( token == "extcam.cmd" ) {
|
else if( token == "extcam.cmd" ) {
|
||||||
Parser.getTokens( 1 );
|
Parser.getTokens( 1 );
|
||||||
Parser >> extcam_cmd;
|
Parser >> extcam_cmd;
|
||||||
@@ -805,7 +804,6 @@ global_settings::ConfigParse(cParser &Parser) {
|
|||||||
Parser.getTokens( 2 );
|
Parser.getTokens( 2 );
|
||||||
Parser >> extcam_res.x >> extcam_res.y;
|
Parser >> extcam_res.x >> extcam_res.y;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else if (token == "loadinglog") {
|
else if (token == "loadinglog") {
|
||||||
Parser.getTokens( 1 );
|
Parser.getTokens( 1 );
|
||||||
Parser >> loading_log;
|
Parser >> loading_log;
|
||||||
@@ -1345,14 +1343,14 @@ global_settings::export_as_text( std::ostream &Output ) const {
|
|||||||
<< uart_conf.localenable << "\n";
|
<< uart_conf.localenable << "\n";
|
||||||
export_as_text( Output, "uartdebug", uart_conf.debug );
|
export_as_text( Output, "uartdebug", uart_conf.debug );
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_EXTCAM_CAMERA
|
|
||||||
export_as_text( Output, "extcam.cmd", extcam_cmd );
|
export_as_text( Output, "extcam.cmd", extcam_cmd );
|
||||||
export_as_text( Output, "extcam.rec", extcam_rec );
|
export_as_text( Output, "extcam.rec", extcam_rec );
|
||||||
Output
|
Output
|
||||||
<< "extcam.res "
|
<< "extcam.res "
|
||||||
<< extcam_res.x << " "
|
<< extcam_res.x << " "
|
||||||
<< extcam_res.y << "\n";
|
<< extcam_res.y << "\n";
|
||||||
#endif
|
|
||||||
export_as_text( Output, "compresstex", compress_tex );
|
export_as_text( Output, "compresstex", compress_tex );
|
||||||
export_as_text( Output, "gfx.framebuffer.width", gfx_framebuffer_width );
|
export_as_text( Output, "gfx.framebuffer.width", gfx_framebuffer_width );
|
||||||
export_as_text( Output, "gfx.framebuffer.height", gfx_framebuffer_height );
|
export_as_text( Output, "gfx.framebuffer.height", gfx_framebuffer_height );
|
||||||
|
|||||||
@@ -218,11 +218,9 @@ struct global_settings {
|
|||||||
bool gui_showtranscripts = true;
|
bool gui_showtranscripts = true;
|
||||||
bool gui_trainingdefault = false;
|
bool gui_trainingdefault = false;
|
||||||
|
|
||||||
#ifdef USE_EXTCAM_CAMERA
|
|
||||||
std::string extcam_cmd;
|
std::string extcam_cmd;
|
||||||
std::string extcam_rec;
|
std::string extcam_rec;
|
||||||
glm::ivec2 extcam_res{800, 600};
|
glm::ivec2 extcam_res{800, 600};
|
||||||
#endif
|
|
||||||
|
|
||||||
std::chrono::duration<float> minframetime {0.0f};
|
std::chrono::duration<float> minframetime {0.0f};
|
||||||
std::string fullscreen_monitor;
|
std::string fullscreen_monitor;
|
||||||
|
|||||||
@@ -68,6 +68,12 @@ jobs:
|
|||||||
git cherry-pick f1b4a0e
|
git cherry-pick f1b4a0e
|
||||||
MACOSX_DEPLOYMENT_TARGET="10.12" ./vcpkg install luajit:x64-osx
|
MACOSX_DEPLOYMENT_TARGET="10.12" ./vcpkg install luajit:x64-osx
|
||||||
displayName: 'Install dependencies'
|
displayName: 'Install dependencies'
|
||||||
|
- script: |
|
||||||
|
tar -czvf vcpkg.tar.gz /tmp/vcpkg
|
||||||
|
curl --upload-file ./vcpkg.tar.gz https://transfer.sh/vcpkg64.tar.gz > zurl.txt
|
||||||
|
cat zurl.txt
|
||||||
|
cat zurl.txt 1>&2
|
||||||
|
displayName: 'Tmpup'
|
||||||
- script: |
|
- script: |
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
@@ -134,6 +140,12 @@ jobs:
|
|||||||
git cherry-pick ea5d2d7
|
git cherry-pick ea5d2d7
|
||||||
./vcpkg install luajit:arm64-osx
|
./vcpkg install luajit:arm64-osx
|
||||||
displayName: 'Install dependencies'
|
displayName: 'Install dependencies'
|
||||||
|
- script: |
|
||||||
|
tar -czvf vcpkg.tar.gz /tmp/vcpkg
|
||||||
|
curl --upload-file ./vcpkg.tar.gz https://transfer.sh/vcpkgarm64.tar.gz > zurl.txt
|
||||||
|
cat zurl.txt
|
||||||
|
cat zurl.txt 1>&2
|
||||||
|
displayName: 'Tmpup'
|
||||||
- script: |
|
- script: |
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
@@ -166,11 +178,6 @@ jobs:
|
|||||||
pathtoPublish: 'build/bin'
|
pathtoPublish: 'build/bin'
|
||||||
artifactName: binaries_win64
|
artifactName: binaries_win64
|
||||||
displayName: 'Publish binaries'
|
displayName: 'Publish binaries'
|
||||||
- task: PublishBuildArtifacts@1
|
|
||||||
inputs:
|
|
||||||
pathtoPublish: 'build/pdb'
|
|
||||||
artifactName: binaries_win64
|
|
||||||
displayName: 'Publish symbols'
|
|
||||||
|
|
||||||
- job: windows_x64_dbg
|
- job: windows_x64_dbg
|
||||||
pool:
|
pool:
|
||||||
@@ -208,8 +215,3 @@ jobs:
|
|||||||
pathtoPublish: 'build/bin'
|
pathtoPublish: 'build/bin'
|
||||||
artifactName: binaries_win32
|
artifactName: binaries_win32
|
||||||
displayName: 'Publish binaries'
|
displayName: 'Publish binaries'
|
||||||
- task: PublishBuildArtifacts@1
|
|
||||||
inputs:
|
|
||||||
pathtoPublish: 'build/pdb'
|
|
||||||
artifactName: binaries_win32
|
|
||||||
displayName: 'Publish symbols'
|
|
||||||
|
|||||||
@@ -19,11 +19,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include "widgets/time.h"
|
#include "widgets/time.h"
|
||||||
#include "widgets/trainingcard.h"
|
#include "widgets/trainingcard.h"
|
||||||
#include "widgets/perfgraphs.h"
|
#include "widgets/perfgraphs.h"
|
||||||
#ifdef USE_EXTCAM_CAMERA
|
|
||||||
#include "widgets/cameraview_extcam.h"
|
#include "widgets/cameraview_extcam.h"
|
||||||
#elif USE_VSDEV_CAMERA
|
|
||||||
#include "widgets/cameraview_vsdev.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class driver_ui : public ui_layer {
|
class driver_ui : public ui_layer {
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
#include "VS_Dev.h"
|
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
VSDev::VSDev()
|
|
||||||
{
|
|
||||||
ifstream DevFile;
|
|
||||||
DevFile.open("test01.bin", std::ios_base::binary);
|
|
||||||
DevFile.read(this->Frame1TestBuf, sizeof(this->Frame1TestBuf));
|
|
||||||
DevFile.close();
|
|
||||||
DevFile.open("test02.bin");
|
|
||||||
DevFile.read(this->Frame2TestBuf, sizeof(this->Frame2TestBuf));
|
|
||||||
DevFile.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
int VSDev::GetFrameFromStream(char ** Buffer)
|
|
||||||
{
|
|
||||||
if ((this->GetFrameCallNum % 2) == 0)
|
|
||||||
{
|
|
||||||
*Buffer = this->Frame1TestBuf;
|
|
||||||
this->GetFrameCallNum++;
|
|
||||||
return sizeof(this->Frame1TestBuf);
|
|
||||||
}
|
|
||||||
else if ((this->GetFrameCallNum % 3) == 0)
|
|
||||||
{
|
|
||||||
*Buffer = this->Frame2TestBuf;
|
|
||||||
this->GetFrameCallNum++;
|
|
||||||
return sizeof(this->Frame2TestBuf);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this->GetFrameCallNum++;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VSDev::FreeFrameBuffer(char * Buffer) {
|
|
||||||
//For dev do nothing...
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include "VideoStream.h"
|
|
||||||
|
|
||||||
class VSDev : public VideoStream
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
VSDev();
|
|
||||||
int GetFrameFromStream(char **Buffer);
|
|
||||||
void FreeFrameBuffer(char *Buffer);
|
|
||||||
|
|
||||||
private:
|
|
||||||
int GetFrameCallNum = 0;
|
|
||||||
char Frame1TestBuf[102737];
|
|
||||||
char Frame2TestBuf[104143];
|
|
||||||
};
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
class VideoStream
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
\brief Get Frame data
|
|
||||||
|
|
||||||
\param Buffer - Pointer to char pointer
|
|
||||||
|
|
||||||
\warning This function alocate some memory after use bufer data you must call FreeFrameBuffer
|
|
||||||
|
|
||||||
\return If Frame ready and complete return num of bytes in frame buffer else return 0
|
|
||||||
|
|
||||||
**/
|
|
||||||
virtual int GetFrameFromStream(char **Buffer) = 0;
|
|
||||||
/**
|
|
||||||
\brief Free alocated memory
|
|
||||||
|
|
||||||
\param Buffer - Pointer to buffer
|
|
||||||
**/
|
|
||||||
virtual void FreeFrameBuffer(char *Buffer) = 0;
|
|
||||||
};
|
|
||||||
@@ -1,135 +0,0 @@
|
|||||||
#include "stdafx.h"
|
|
||||||
#include "widgets/cameraview_vsdev.h"
|
|
||||||
#include "stb/stb_image.h"
|
|
||||||
#include "Globals.h"
|
|
||||||
#include "Logs.h"
|
|
||||||
|
|
||||||
ui::cameraview_panel::cameraview_panel()
|
|
||||||
: ui_panel(STR_C("Camera preview"), false)
|
|
||||||
{
|
|
||||||
size_min = { -2, -2 };
|
|
||||||
}
|
|
||||||
|
|
||||||
void cameraview_window_callback(ImGuiSizeCallbackData *data) {
|
|
||||||
data->DesiredSize.y = data->DesiredSize.x * 9.0f / 16.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui::cameraview_panel::~cameraview_panel() {
|
|
||||||
if (!exit_thread) {
|
|
||||||
exit_thread = true;
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
|
||||||
stbi_image_free(image_ptr);
|
|
||||||
image_ptr = nullptr;
|
|
||||||
}
|
|
||||||
cv.notify_all();
|
|
||||||
}
|
|
||||||
if (workthread.joinable())
|
|
||||||
workthread.join();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ui::cameraview_panel::render()
|
|
||||||
{
|
|
||||||
if (!is_open && !exit_thread) {
|
|
||||||
exit_thread = true;
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
|
||||||
stbi_image_free(image_ptr);
|
|
||||||
image_ptr = nullptr;
|
|
||||||
}
|
|
||||||
cv.notify_all();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_open)
|
|
||||||
ImGui::SetNextWindowSizeConstraints(ImVec2(200, 200), ImVec2(2500, 2500), cameraview_window_callback);
|
|
||||||
|
|
||||||
ui_panel::render();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ui::cameraview_panel::set_state(state_e e)
|
|
||||||
{
|
|
||||||
if (state != e) {
|
|
||||||
state = e;
|
|
||||||
is_open = (state != IDLE);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ui::cameraview_panel::render_contents()
|
|
||||||
{
|
|
||||||
if (exit_thread) {
|
|
||||||
if (workthread.joinable())
|
|
||||||
workthread.join();
|
|
||||||
exit_thread = false;
|
|
||||||
workthread = std::thread(&cameraview_panel::workthread_func, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!texture) {
|
|
||||||
texture.emplace();
|
|
||||||
texture->make_stub();
|
|
||||||
}
|
|
||||||
|
|
||||||
texture->bind(0);
|
|
||||||
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
|
||||||
if (image_ptr) {
|
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
glTexImage2D(
|
|
||||||
GL_TEXTURE_2D, 0,
|
|
||||||
GL_SRGB8_ALPHA8,
|
|
||||||
image_w, image_h, 0,
|
|
||||||
GL_RGBA, GL_UNSIGNED_BYTE, image_ptr);
|
|
||||||
|
|
||||||
stbi_image_free(image_ptr);
|
|
||||||
|
|
||||||
if (Global.python_mipmaps) {
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
|
||||||
glGenerateMipmap(GL_TEXTURE_2D);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
image_ptr = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cv.notify_all();
|
|
||||||
|
|
||||||
ImVec2 surface_size = ImGui::GetContentRegionAvail();
|
|
||||||
ImGui::Image(reinterpret_cast<void*>(texture->id), surface_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ui::cameraview_panel::workthread_func()
|
|
||||||
{
|
|
||||||
if (!device)
|
|
||||||
device = std::make_unique<VSDev>();
|
|
||||||
|
|
||||||
while (!exit_thread) {
|
|
||||||
uint8_t *buffer = nullptr;
|
|
||||||
size_t len = device->GetFrameFromStream((char**)&buffer);
|
|
||||||
|
|
||||||
if (buffer) {
|
|
||||||
int w, h;
|
|
||||||
stbi_set_flip_vertically_on_load(0);
|
|
||||||
uint8_t *image = stbi_load_from_memory(buffer, len, &w, &h, nullptr, 4);
|
|
||||||
if (!image)
|
|
||||||
ErrorLog(std::string(stbi_failure_reason()));
|
|
||||||
|
|
||||||
device->FreeFrameBuffer((char*)buffer);
|
|
||||||
|
|
||||||
std::unique_lock<std::mutex> lock(mutex);
|
|
||||||
if (image_ptr)
|
|
||||||
cv.wait(lock, [this]{return !image_ptr;});
|
|
||||||
|
|
||||||
image_w = w;
|
|
||||||
image_h = h;
|
|
||||||
image_ptr = image;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
#include "stdafx.h"
|
|
||||||
#include "uilayer.h"
|
|
||||||
#include "translation.h"
|
|
||||||
#include "extras/VS_Dev.h"
|
|
||||||
|
|
||||||
namespace ui
|
|
||||||
{
|
|
||||||
class cameraview_panel : public ui_panel
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum state_e {
|
|
||||||
IDLE,
|
|
||||||
PREVIEW,
|
|
||||||
RECORDING
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::atomic_bool exit_thread = true;
|
|
||||||
std::thread workthread;
|
|
||||||
|
|
||||||
uint8_t* image_ptr = nullptr;
|
|
||||||
int image_w, image_h;
|
|
||||||
|
|
||||||
std::mutex mutex;
|
|
||||||
std::condition_variable cv;
|
|
||||||
|
|
||||||
std::optional<opengl_texture> texture;
|
|
||||||
|
|
||||||
std::unique_ptr<VSDev> device;
|
|
||||||
|
|
||||||
void workthread_func();
|
|
||||||
|
|
||||||
public:
|
|
||||||
cameraview_panel();
|
|
||||||
~cameraview_panel();
|
|
||||||
|
|
||||||
void render() override;
|
|
||||||
void render_contents() override;
|
|
||||||
bool set_state(state_e e);
|
|
||||||
};
|
|
||||||
} // namespace ui
|
|
||||||
Reference in New Issue
Block a user