|
OpenShot Library | libopenshot
0.7.0
|
Go to the documentation of this file.
13 #ifndef OPENSHOT_FRAMESCOPE_H
14 #define OPENSHOT_FRAMESCOPE_H
40 std::shared_ptr<Frame> frame;
54 std::vector<int> waveform_column_map;
55 int waveform_column_map_width;
56 int waveform_column_map_columns;
59 int clipped_highlights;
63 std::vector<uint32_t> histogram_luma;
64 std::vector<uint32_t> histogram_red;
65 std::vector<uint32_t> histogram_green;
66 std::vector<uint32_t> histogram_blue;
67 std::vector<uint32_t> waveform_luma;
68 std::vector<uint32_t> waveform_red;
69 std::vector<uint32_t> waveform_green;
70 std::vector<uint32_t> waveform_blue;
71 std::vector<uint32_t> vectorscope;
76 int audio_sample_rate;
77 std::vector<float> audio_peak;
78 std::vector<float> audio_rms;
79 std::vector<uint32_t> audio_clipped_samples;
80 std::vector<std::vector<float>> audio_waveform_min;
81 std::vector<std::vector<float>> audio_waveform_max;
82 mutable Json::Value scope_data;
83 mutable bool json_dirty;
88 void ensure_video_buffers();
89 void ensure_audio_buffers();
90 void rebuild_waveform_column_map(
int width);
94 void rebuild_json()
const;
95 static std::vector<int> copy_to_int_vector(
const std::vector<uint32_t>& values);
102 FrameScope(std::shared_ptr<Frame> frame,
int waveform_columns = 256,
int audio_buckets = 256,
int vectorscope_size = 256);
105 void SetFrame(std::shared_ptr<Frame> new_frame);
108 std::shared_ptr<Frame>
GetFrame()
const {
return frame; }
261 std::string
Json()
const;
void ClearVideoRegion()
Clear any video ROI and re-analyze the full frame.
const std::vector< uint32_t > & GetVideoHistogramRedBins() const
Return the red histogram bins by reference.
int GetAudioSampleRate() const
Return the analyzed audio sample rate.
std::vector< int > GetVideoHistogramGreen() const
Return the green histogram bins.
std::vector< int > GetAudioClippedSamples() const
Return per-channel clipped sample counts.
void SetFrame(std::shared_ptr< Frame > new_frame)
Replace the current frame and recompute the scope data.
void SetVectorscopeSize(int size)
Set the vectorscope plane edge length and re-analyze video.
FrameScope()
Create an empty scope analyzer with default bucket sizes.
int GetVideoClippedGreen() const
Return the clipped green-channel pixel count.
This namespace is the default namespace for all code in the openshot library.
int GetWaveformBins() const
Return the number of vertical waveform bins.
const std::vector< float > & GetAudioRmsLevelsRef() const
Return per-channel RMS levels.
const std::vector< uint32_t > & GetVideoHistogramGreenBins() const
Return the green histogram bins by reference.
std::vector< int > GetVideoWaveformLuma() const
Return the flattened luma waveform bins.
int GetAudioChannels() const
Return the number of analyzed audio channels.
int GetVideoClippedHighlights() const
Return the clipped highlight pixel count.
int GetVectorscopeSize() const
Return the vectorscope plane edge length.
std::vector< int > GetVideoHistogramBlue() const
Return the blue histogram bins.
const std::vector< uint32_t > & GetVideoHistogramBlueBins() const
Return the blue histogram bins by reference.
std::vector< int > GetVideoHistogramRed() const
Return the red histogram bins.
const std::vector< uint32_t > & GetVideoVectorscopeBins() const
Return the flattened vectorscope density plane by reference.
std::string Json() const
Return the current scope payload as a JSON string.
std::vector< float > GetAudioRmsLevels() const
Return per-channel RMS levels.
void SetAudioBuckets(int buckets)
Set the number of audio buckets and re-analyze.
bool HasAudio() const
Return whether the current frame has analyzable audio data.
void SetWaveformColumns(int columns)
Set the number of horizontal waveform columns and re-analyze.
int GetVideoHeight() const
Return the analyzed video height.
std::vector< int > GetVideoWaveformBlue() const
Return the flattened blue waveform bins.
const std::vector< uint32_t > & GetVideoHistogramLumaBins() const
Return the luma histogram bins by reference.
int GetVideoClippedShadows() const
Return the clipped shadow pixel count.
const std::vector< float > & GetAudioPeakLevelsRef() const
Return per-channel peak levels.
Analyze a single Frame and expose scope-friendly JSON.
std::vector< float > GetAudioWaveformMax(int channel) const
Return one channel of audio waveform maximum values.
void SetVideoRegionNormalized(float x, float y, float width, float height)
Set a normalized ROI for video analysis and re-analyze video.
int GetVideoClippedBlue() const
Return the clipped blue-channel pixel count.
int GetAudioBuckets() const
Return the number of audio waveform buckets.
std::vector< int > GetVideoVectorscope() const
Return the flattened vectorscope density plane.
Header file for Frame class.
std::shared_ptr< Frame > GetFrame() const
Return the currently analyzed frame.
bool HasVideo() const
Return whether the current frame has analyzable video data.
double GetVideoAverageLuma() const
Return the average luma of the analyzed frame.
std::vector< int > GetVideoWaveformGreen() const
Return the flattened green waveform bins.
std::vector< int > GetVideoHistogramLuma() const
Return the luma histogram bins.
bool HasVideoRegion() const
Return whether a video ROI is enabled.
Json::Value JsonValue() const
Return the current scope payload as a Json::Value tree.
std::vector< float > GetAudioWaveformMin(int channel) const
Return one channel of audio waveform minimum values.
int GetAudioSamples() const
Return the number of analyzed audio samples.
const std::vector< uint32_t > & GetVideoWaveformRedBins() const
Return the flattened red waveform bins by reference.
const std::vector< uint32_t > & GetVideoWaveformLumaBins() const
Return the flattened luma waveform bins by reference.
int GetWaveformColumns() const
Return the number of waveform columns.
const std::vector< uint32_t > & GetVideoWaveformBlueBins() const
Return the flattened blue waveform bins by reference.
std::vector< int > GetVideoWaveformRed() const
Return the flattened red waveform bins.
int GetVideoClippedRed() const
Return the clipped red-channel pixel count.
int GetVideoWidth() const
Return the analyzed video width.
Header file for JSON class.
const std::vector< uint32_t > & GetAudioClippedSamplesRef() const
Return per-channel clipped sample counts.
const std::vector< uint32_t > & GetVideoWaveformGreenBins() const
Return the flattened green waveform bins by reference.
std::vector< float > GetAudioPeakLevels() const
Return per-channel peak levels.