Skip to content

Commit

Permalink
Merge pull request #30 from dneg/test_upload
Browse files Browse the repository at this point in the history
Upload internal changes.
  • Loading branch information
alatdneg authored Mar 1, 2023
2 parents 387fa74 + 18466e2 commit ffcae3c
Show file tree
Hide file tree
Showing 162 changed files with 6,387 additions and 4,266 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@










27 changes: 24 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

set(XSTUDIO_GLOBAL_VERSION 1.2.0)
set(XSTUDIO_GLOBAL_VERSION "0.8.0" CACHE STRING "Version string")
set(XSTUDIO_GLOBAL_NAME xStudio)

project(${XSTUDIO_GLOBAL_NAME} VERSION ${XSTUDIO_GLOBAL_VERSION} LANGUAGES CXX)
Expand All @@ -12,6 +12,7 @@ option(BUILD_DOCS "Build xStudio documentation" ON)
option(ENABLE_CLANG_TIDY "Enable clang-tidy, ninja clang-tidy." OFF)
option(ENABLE_CLANG_FORMAT "Enable clang format, ninja clangformat." OFF)
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." TRUE)
option(OPTIMIZE_FOR_NATIVE "Build with -march=native" OFF)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")

Expand All @@ -28,7 +29,27 @@ if (("${CMAKE_GENERATOR}" MATCHES "Makefiles" OR ("${CMAKE_GENERATOR}" MATCHES "
endif()

set(CXXOPTS_BUILD_TESTS OFF CACHE BOOL "Enable or disable cxxopts' tests")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic -fmax-errors=5 -fdiagnostics-color=always -march=nehalem")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic -fmax-errors=5 -fdiagnostics-color=always")

if (${OPTIMIZE_FOR_NATIVE})
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
if(COMPILER_SUPPORTS_MARCH_NATIVE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif()
endif()

set(GCC_MARCH_OVERRIDE "" CACHE STRING "Override -march")

if (NOT ${GCC_MARCH_OVERRIDE} STREQUAL "")
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-march=${GCC_MARCH_OVERRIDE}" COMPILER_SUPPORTS_MARCH)
if(COMPILER_SUPPORTS_MARCH)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${GCC_MARCH_OVERRIDE}")
endif()
endif()


set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fpic")

set(TEST_RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/test_resource")
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ xSTUDIO is a media playback and review application designed for professionals wo

## Building xSTUDIO

This release of xSTUDIO can be built on various Linux flavours. MacOS and Windows compatibility is not available yet but this work is on the roadmap for 2023.
This release of xSTUDIO can be built on various Linux flavours. MacOS and Windows compatibility is not available yet but this work is on the roadmap for 2023.

We provide comprehensive build steps for 3 of the most popular Linux distributions.

Expand Down
2 changes: 1 addition & 1 deletion cmake/macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ macro(create_test PATH DEPS)
)
set_target_properties(${NAME} PROPERTIES LINK_DEPENDS_NO_SHARED true)

add_test(${PARENT}_tests ${NAME})
add_test(${PARENT}_${NAME} ${NAME})

endmacro()

Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@
# built documents.
#
# The short X.Y version.
version = '1.2.0'
version = '0.8.0'
# The full version, including alpha/beta/rc tags.
release = '1.2.0'
release = '0.8.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 2 additions & 0 deletions include/xstudio/atoms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,8 @@ CAF_BEGIN_TYPE_ID_BLOCK(xstudio_playback_atoms, xstudio_session_atoms_last_type_
CAF_ADD_ATOM(xstudio_playback_atoms, xstudio::playhead, viewport_events_group_atom)

// **************** add new entries here ******************
CAF_ADD_ATOM(xstudio_playback_atoms, xstudio::playhead, last_frame_media_pointer_atom)
CAF_ADD_ATOM(xstudio_playback_atoms, xstudio::colour_pipeline, display_colour_transform_hash_atom)

CAF_END_TYPE_ID_BLOCK(xstudio_playback_atoms)

Expand Down
2 changes: 2 additions & 0 deletions include/xstudio/colour_pipeline/colour_pipeline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ namespace colour_pipeline {
virtual thumbnail::ThumbnailBufferPtr process_thumbnail(
const media::AVFrameID &media_ptr, const thumbnail::ThumbnailBufferPtr &buf) = 0;

virtual std::string fast_display_transform_hash(const media::AVFrameID &media_ptr) = 0;

protected:
utility::Uuid uuid_;
};
Expand Down
29 changes: 28 additions & 1 deletion include/xstudio/colour_pipeline/colour_pipeline_actor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ namespace colour_pipeline {
get_cached_colour_pipeline_data(rp, media_ptr);
return rp;
},
[=](display_colour_transform_hash_atom,
const media::AVFrameID &media_ptr) -> std::string {
return colour_pipeline_->fast_display_transform_hash(media_ptr);
},
[=](media_reader::process_thumbnail_atom,
const media::AVFrameID &mptr,
const thumbnail::ThumbnailBufferPtr &buf)
Expand Down Expand Up @@ -198,6 +202,16 @@ namespace colour_pipeline {
},
caf::actor_pool::round_robin());
link_to(pool_);

thumbnail_processor_pool_ = caf::actor_pool::make(
system().dummy_execution_unit(),
colour_pipeline_worker_count,
[&] {
return system().template spawn<ColourPipelineWorkerActor<T>>(
init_settings, &colour_pipeline_, cache_);
},
caf::actor_pool::round_robin());
link_to(thumbnail_processor_pool_);
}

~ColourPipelineActor() override = default;
Expand All @@ -213,6 +227,7 @@ namespace colour_pipeline {
caf::actor cache_;
caf::actor event_group_;
caf::actor pool_;
caf::actor thumbnail_processor_pool_;
utility::Uuid uuid_;
T colour_pipeline_;
};
Expand All @@ -228,6 +243,14 @@ namespace colour_pipeline {
[=](get_colour_pipe_data_atom atom, const media::AVFrameID &media_ptr) {
delegate(pool_, atom, media_ptr);
},
[=](get_colour_pipe_data_atom atom,
const media::AVFrameID &media_ptr,
bool use_thumbnail_pool) {
delegate(thumbnail_processor_pool_, atom, media_ptr);
},
[=](display_colour_transform_hash_atom atom, const media::AVFrameID &media_ptr) {
delegate(thumbnail_processor_pool_, atom, media_ptr);
},
[=](get_colour_pipe_data_atom,
const media::AVFrameIDsAndTimePoints &mptr_and_timepoints)
-> caf::result<std::vector<ColourPipelineDataPtr>> {
Expand Down Expand Up @@ -298,7 +321,11 @@ namespace colour_pipeline {
[=](media_reader::process_thumbnail_atom,
const media::AVFrameID &mptr,
const thumbnail::ThumbnailBufferPtr &buf) {
delegate(pool_, media_reader::process_thumbnail_atom_v, mptr, buf);
delegate(
thumbnail_processor_pool_,
media_reader::process_thumbnail_atom_v,
mptr,
buf);
},
[=](json_store::update_atom,
const utility::JsonStore & /*change*/,
Expand Down
3 changes: 3 additions & 0 deletions include/xstudio/global/global_actor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <caf/behavior.hpp>
#include <caf/event_based_actor.hpp>

#include "xstudio/global/enums.hpp"
#include "xstudio/utility/exports.hpp"
#include "xstudio/utility/remote_session_file.hpp"
#include "xstudio/utility/logging.hpp"
Expand Down Expand Up @@ -57,6 +58,8 @@ namespace global {
caf::uri session_autosave_path_{};
int session_autosave_interval_{300};
size_t session_autosave_hash_{0};
StatusType status_{StatusType::ST_NONE};
std::set<caf::actor_addr> busy_;
};
} // namespace global
} // namespace xstudio
27 changes: 21 additions & 6 deletions include/xstudio/media_reader/buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace media_reader {
Buffer(const utility::JsonStore &params = utility::JsonStore()) : params_(params) {}
explicit Buffer(const std::string error_message)
: error_message_(std::move(error_message)), error_state_(HAS_ERROR) {}
virtual ~Buffer() = default;
virtual ~Buffer();

virtual byte *allocate(const size_t size);

Expand All @@ -43,26 +43,41 @@ namespace media_reader {
[[nodiscard]] const utility::JsonStore &params() const { return params_; }
utility::JsonStore &params() { return params_; }
[[nodiscard]] size_t size() const { return size_; }
[[nodiscard]] byte *buffer() { return buffer_.get(); }
[[nodiscard]] const byte *buffer() const { return (const byte *)(buffer_.get()); }
[[nodiscard]] byte *buffer() {
return buffer_ ? (byte *)(buffer_->data_.get()) : nullptr;
}
[[nodiscard]] const byte *buffer() const {
return buffer_ ? (const byte *)buffer_->data_.get() : nullptr;
}
[[nodiscard]] BufferErrorState error_state() const { return error_state_; }
[[nodiscard]] const std::string &error_message() const { return error_message_; }

[[nodiscard]] double display_timestamp_seconds() const { return dts_; }
bool display_timestamp_seconds_is_set() const { return dts_ != UNSET_DTS; }
[[nodiscard]] bool display_timestamp_seconds_is_set() const {
return dts_ != UNSET_DTS;
}

void set_display_timestamp_seconds(const double dts) { dts_ = dts; }
void set_error(const std::string &err) {
error_message_ = err;
error_state_ = HAS_ERROR;
}

struct BufferData {
BufferData(byte *d) { data_.reset(d); }
BufferData(size_t sz) { data_.reset(new (std::align_val_t(1024)) byte[sz]); }
std::unique_ptr<byte> data_{
nullptr}; // using long long which should get result byte alignment
};
typedef std::shared_ptr<BufferData> BufferDataPtr;

private:
std::unique_ptr<byte> buffer_; // use long long to get 16 byte alignment
BufferDataPtr buffer_; // use long long to get 16 byte alignment
size_t size_{0};
utility::JsonStore params_;
std::string error_message_;
BufferErrorState error_state_{NO_ERROR};
double dts_ = {UNSET_DTS};
};

} // namespace media_reader
} // namespace xstudio
32 changes: 27 additions & 5 deletions include/xstudio/media_reader/image_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "xstudio/media/media.hpp"
#include "xstudio/media_reader/buffer.hpp"
#include "xstudio/media_reader/audio_buffer.hpp"
#include "xstudio/media_reader/pixel_info.hpp"
#include "xstudio/ui/viewport/shader.hpp"
#include "xstudio/colour_pipeline/colour_pipeline.hpp"

Expand Down Expand Up @@ -57,6 +58,17 @@ namespace media_reader {
[[nodiscard]] int decoder_frame_number() const { return frame_num_; }
void set_decoder_frame_number(const int f) { frame_num_ = f; }

typedef std::function<PixelInfo(
const ImageBuffer &buf, const Imath::V2i &pixel_location)>
PixelPickerFunc;
void set_pixel_picker_func(PixelPickerFunc func) { pixel_picker_ = func; }

PixelInfo pixel_info(const Imath::V2i &pixel_location) const {
if (pixel_picker_)
return pixel_picker_(*this, pixel_location);
return PixelInfo(pixel_location);
}

AudioBufPtr audio_;

private:
Expand All @@ -69,6 +81,7 @@ namespace media_reader {
double frame_duration_ = {1.0};
int frame_num_ = -1;
ui::viewport::GPUShaderPtr shader_;
PixelPickerFunc pixel_picker_;
};

/* Extending std::shared_ptr<ImageBuffer> by adding a pointer to colour pipe
Expand All @@ -85,29 +98,34 @@ namespace media_reader {
: Base(static_cast<const Base &>(o)),
colour_pipe_data_(o.colour_pipe_data_),
when_to_display_(o.when_to_display_),
plugin_blind_data_(o.plugin_blind_data_) {}
plugin_blind_data_(o.plugin_blind_data_),
tts_(o.tts_) {}

ImageBufPtr &operator=(const ImageBufPtr &o) {
Base &b = static_cast<Base &>(*this);
b = static_cast<const Base &>(o);
colour_pipe_data_ = o.colour_pipe_data_;
when_to_display_ = o.when_to_display_;
plugin_blind_data_ = o.plugin_blind_data_;
tts_ = o.tts_;
return *this;
}

~ImageBufPtr() = default;

bool operator==(const ImageBufPtr &o) const {
return this->get() == o.get() && colour_pipe_data_ == o.colour_pipe_data_;
return this->get() == o.get() && colour_pipe_data_ == o.colour_pipe_data_ &&
tts_ == o.tts_;
}

bool operator<(const ImageBufPtr &o) const {
return when_to_display_ < o.when_to_display_;
}
bool operator<(const ImageBufPtr &o) const { return tts_ < o.tts_; }

bool operator<(const utility::time_point &t) const { return when_to_display_ < t; }

bool operator<(const timebase::flicks &t) const { return tts_ < t; }

bool operator>(const timebase::flicks &t) const { return tts_ > t; }

colour_pipeline::ColourPipelineDataPtr colour_pipe_data_;
utility::time_point when_to_display_;

Expand All @@ -126,7 +144,11 @@ namespace media_reader {

std::map<utility::Uuid, utility::BlindDataObjectPtr> plugin_blind_data_;

[[nodiscard]] const timebase::flicks &timeline_timestamp() const { return tts_; }
void set_timline_timestamp(const timebase::flicks tts) { tts_ = tts; }

private:
timebase::flicks tts_ = timebase::flicks{0};
};

} // namespace media_reader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include <caf/all.hpp>

#include <queue>

#include "xstudio/media/media.hpp"
#include "xstudio/media_reader/media_reader.hpp"
#include "xstudio/utility/uuid.hpp"
Expand Down Expand Up @@ -77,15 +79,19 @@ namespace media_reader {
private:
inline static const std::string NAME = "MediaDetailAndThumbnailReaderActor";
caf::behavior behavior_;
std::vector<MediaDetailRequest> media_detail_request_queue_;

int num_detail_requests_since_thumbnail_request_ = {0};

std::queue<MediaDetailRequest> media_detail_request_queue_;
std::queue<ThumbnailRequest> thumbnail_request_queue_;

std::map<caf::uri, media::MediaDetail> media_detail_cache_;
std::map<caf::uri, utility::time_point> media_detail_cache_age_;

utility::Uuid uuid_;
std::vector<ThumbnailRequest> thumbnail_request_queue_;
caf::actor colour_pipe_manager_;
std::vector<caf::actor> plugins_;
std::map<utility::Uuid, caf::actor> plugins_map_;
std::map<caf::uri, media::MediaDetail> media_detail_cache_;
std::map<caf::uri, utility::time_point> media_detail_cache_age_;
int num_detail_requests_since_thumbnail_request_ = {0};
};
} // namespace media_reader
} // namespace xstudio
Loading

0 comments on commit ffcae3c

Please sign in to comment.