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