OpenShot Library | libopenshot  0.7.0
Public Member Functions | List of all members
openshot::FrameScope Class Reference

Analyze a single Frame and expose scope-friendly JSON. More...

#include <FrameScope.h>

Public Member Functions

void ClearVideoRegion ()
 Clear any video ROI and re-analyze the full frame. More...
 
 FrameScope ()
 Create an empty scope analyzer with default bucket sizes. More...
 
 FrameScope (std::shared_ptr< Frame > frame, int waveform_columns=256, int audio_buckets=256, int vectorscope_size=256)
 Construct and immediately analyze a frame. More...
 
int GetAudioBuckets () const
 Return the number of audio waveform buckets. More...
 
int GetAudioChannels () const
 Return the number of analyzed audio channels. More...
 
std::vector< int > GetAudioClippedSamples () const
 Return per-channel clipped sample counts. More...
 
const std::vector< uint32_t > & GetAudioClippedSamplesRef () const
 Return per-channel clipped sample counts. More...
 
std::vector< float > GetAudioPeakLevels () const
 Return per-channel peak levels. More...
 
const std::vector< float > & GetAudioPeakLevelsRef () const
 Return per-channel peak levels. More...
 
std::vector< float > GetAudioRmsLevels () const
 Return per-channel RMS levels. More...
 
const std::vector< float > & GetAudioRmsLevelsRef () const
 Return per-channel RMS levels. More...
 
int GetAudioSampleRate () const
 Return the analyzed audio sample rate. More...
 
int GetAudioSamples () const
 Return the number of analyzed audio samples. More...
 
std::vector< float > GetAudioWaveformMax (int channel) const
 Return one channel of audio waveform maximum values. More...
 
std::vector< float > GetAudioWaveformMin (int channel) const
 Return one channel of audio waveform minimum values. More...
 
std::shared_ptr< FrameGetFrame () const
 Return the currently analyzed frame. More...
 
int GetVectorscopeSize () const
 Return the vectorscope plane edge length. More...
 
double GetVideoAverageLuma () const
 Return the average luma of the analyzed frame. More...
 
int GetVideoClippedBlue () const
 Return the clipped blue-channel pixel count. More...
 
int GetVideoClippedGreen () const
 Return the clipped green-channel pixel count. More...
 
int GetVideoClippedHighlights () const
 Return the clipped highlight pixel count. More...
 
int GetVideoClippedRed () const
 Return the clipped red-channel pixel count. More...
 
int GetVideoClippedShadows () const
 Return the clipped shadow pixel count. More...
 
int GetVideoHeight () const
 Return the analyzed video height. More...
 
std::vector< int > GetVideoHistogramBlue () const
 Return the blue histogram bins. More...
 
const std::vector< uint32_t > & GetVideoHistogramBlueBins () const
 Return the blue histogram bins by reference. More...
 
std::vector< int > GetVideoHistogramGreen () const
 Return the green histogram bins. More...
 
const std::vector< uint32_t > & GetVideoHistogramGreenBins () const
 Return the green histogram bins by reference. More...
 
std::vector< int > GetVideoHistogramLuma () const
 Return the luma histogram bins. More...
 
const std::vector< uint32_t > & GetVideoHistogramLumaBins () const
 Return the luma histogram bins by reference. More...
 
std::vector< int > GetVideoHistogramRed () const
 Return the red histogram bins. More...
 
const std::vector< uint32_t > & GetVideoHistogramRedBins () const
 Return the red histogram bins by reference. More...
 
std::vector< int > GetVideoVectorscope () const
 Return the flattened vectorscope density plane. More...
 
const std::vector< uint32_t > & GetVideoVectorscopeBins () const
 Return the flattened vectorscope density plane by reference. More...
 
std::vector< int > GetVideoWaveformBlue () const
 Return the flattened blue waveform bins. More...
 
const std::vector< uint32_t > & GetVideoWaveformBlueBins () const
 Return the flattened blue waveform bins by reference. More...
 
std::vector< int > GetVideoWaveformGreen () const
 Return the flattened green waveform bins. More...
 
const std::vector< uint32_t > & GetVideoWaveformGreenBins () const
 Return the flattened green waveform bins by reference. More...
 
std::vector< int > GetVideoWaveformLuma () const
 Return the flattened luma waveform bins. More...
 
const std::vector< uint32_t > & GetVideoWaveformLumaBins () const
 Return the flattened luma waveform bins by reference. More...
 
std::vector< int > GetVideoWaveformRed () const
 Return the flattened red waveform bins. More...
 
const std::vector< uint32_t > & GetVideoWaveformRedBins () const
 Return the flattened red waveform bins by reference. More...
 
int GetVideoWidth () const
 Return the analyzed video width. More...
 
int GetWaveformBins () const
 Return the number of vertical waveform bins. More...
 
int GetWaveformColumns () const
 Return the number of waveform columns. More...
 
bool HasAudio () const
 Return whether the current frame has analyzable audio data. More...
 
bool HasVideo () const
 Return whether the current frame has analyzable video data. More...
 
bool HasVideoRegion () const
 Return whether a video ROI is enabled. More...
 
std::string Json () const
 Return the current scope payload as a JSON string. More...
 
Json::Value JsonValue () const
 Return the current scope payload as a Json::Value tree. More...
 
void SetAudioBuckets (int buckets)
 Set the number of audio buckets and re-analyze. More...
 
void SetFrame (std::shared_ptr< Frame > new_frame)
 Replace the current frame and recompute the scope data. More...
 
void SetVectorscopeSize (int size)
 Set the vectorscope plane edge length and re-analyze video. More...
 
void SetVideoRegionNormalized (float x, float y, float width, float height)
 Set a normalized ROI for video analysis and re-analyze video. More...
 
void SetWaveformColumns (int columns)
 Set the number of horizontal waveform columns and re-analyze. More...
 

Detailed Description

Analyze a single Frame and expose scope-friendly JSON.

FrameScope provides a lightweight analysis layer for the current preview frame. It intentionally focuses on broadly useful data for grading and editorial decisions, such as histograms, a luma waveform, audio envelope buckets, and simple clipping / peak summaries.

Pixel format: libopenshot frames are always stored as QImage::Format_RGBA8888_Premultiplied (see Frame::AddImage). The in-memory byte order per pixel is [R=0, G=1, B=2, A=3].

Definition at line 38 of file FrameScope.h.

Constructor & Destructor Documentation

◆ FrameScope() [1/2]

FrameScope::FrameScope ( )

Create an empty scope analyzer with default bucket sizes.

Definition at line 68 of file FrameScope.cpp.

◆ FrameScope() [2/2]

FrameScope::FrameScope ( std::shared_ptr< Frame frame,
int  waveform_columns = 256,
int  audio_buckets = 256,
int  vectorscope_size = 256 
)

Construct and immediately analyze a frame.

Definition at line 85 of file FrameScope.cpp.

Member Function Documentation

◆ ClearVideoRegion()

void FrameScope::ClearVideoRegion ( )

Clear any video ROI and re-analyze the full frame.

Definition at line 215 of file FrameScope.cpp.

◆ GetAudioBuckets()

int openshot::FrameScope::GetAudioBuckets ( ) const
inline

Return the number of audio waveform buckets.

Definition at line 231 of file FrameScope.h.

◆ GetAudioChannels()

int openshot::FrameScope::GetAudioChannels ( ) const
inline

Return the number of analyzed audio channels.

Definition at line 222 of file FrameScope.h.

◆ GetAudioClippedSamples()

std::vector<int> openshot::FrameScope::GetAudioClippedSamples ( ) const
inline

Return per-channel clipped sample counts.

Definition at line 249 of file FrameScope.h.

◆ GetAudioClippedSamplesRef()

const std::vector<uint32_t>& openshot::FrameScope::GetAudioClippedSamplesRef ( ) const
inline

Return per-channel clipped sample counts.

Definition at line 240 of file FrameScope.h.

◆ GetAudioPeakLevels()

std::vector<float> openshot::FrameScope::GetAudioPeakLevels ( ) const
inline

Return per-channel peak levels.

Definition at line 243 of file FrameScope.h.

◆ GetAudioPeakLevelsRef()

const std::vector<float>& openshot::FrameScope::GetAudioPeakLevelsRef ( ) const
inline

Return per-channel peak levels.

Definition at line 234 of file FrameScope.h.

◆ GetAudioRmsLevels()

std::vector<float> openshot::FrameScope::GetAudioRmsLevels ( ) const
inline

Return per-channel RMS levels.

Definition at line 246 of file FrameScope.h.

◆ GetAudioRmsLevelsRef()

const std::vector<float>& openshot::FrameScope::GetAudioRmsLevelsRef ( ) const
inline

Return per-channel RMS levels.

Definition at line 237 of file FrameScope.h.

◆ GetAudioSampleRate()

int openshot::FrameScope::GetAudioSampleRate ( ) const
inline

Return the analyzed audio sample rate.

Definition at line 228 of file FrameScope.h.

◆ GetAudioSamples()

int openshot::FrameScope::GetAudioSamples ( ) const
inline

Return the number of analyzed audio samples.

Definition at line 225 of file FrameScope.h.

◆ GetAudioWaveformMax()

std::vector< float > FrameScope::GetAudioWaveformMax ( int  channel) const

Return one channel of audio waveform maximum values.

Definition at line 483 of file FrameScope.cpp.

◆ GetAudioWaveformMin()

std::vector< float > FrameScope::GetAudioWaveformMin ( int  channel) const

Return one channel of audio waveform minimum values.

Definition at line 477 of file FrameScope.cpp.

◆ GetFrame()

std::shared_ptr<Frame> openshot::FrameScope::GetFrame ( ) const
inline

Return the currently analyzed frame.

Definition at line 108 of file FrameScope.h.

◆ GetVectorscopeSize()

int openshot::FrameScope::GetVectorscopeSize ( ) const
inline

Return the vectorscope plane edge length.

Definition at line 147 of file FrameScope.h.

◆ GetVideoAverageLuma()

double openshot::FrameScope::GetVideoAverageLuma ( ) const
inline

Return the average luma of the analyzed frame.

Definition at line 204 of file FrameScope.h.

◆ GetVideoClippedBlue()

int openshot::FrameScope::GetVideoClippedBlue ( ) const
inline

Return the clipped blue-channel pixel count.

Definition at line 219 of file FrameScope.h.

◆ GetVideoClippedGreen()

int openshot::FrameScope::GetVideoClippedGreen ( ) const
inline

Return the clipped green-channel pixel count.

Definition at line 216 of file FrameScope.h.

◆ GetVideoClippedHighlights()

int openshot::FrameScope::GetVideoClippedHighlights ( ) const
inline

Return the clipped highlight pixel count.

Definition at line 210 of file FrameScope.h.

◆ GetVideoClippedRed()

int openshot::FrameScope::GetVideoClippedRed ( ) const
inline

Return the clipped red-channel pixel count.

Definition at line 213 of file FrameScope.h.

◆ GetVideoClippedShadows()

int openshot::FrameScope::GetVideoClippedShadows ( ) const
inline

Return the clipped shadow pixel count.

Definition at line 207 of file FrameScope.h.

◆ GetVideoHeight()

int openshot::FrameScope::GetVideoHeight ( ) const
inline

Return the analyzed video height.

Definition at line 138 of file FrameScope.h.

◆ GetVideoHistogramBlue()

std::vector<int> openshot::FrameScope::GetVideoHistogramBlue ( ) const
inline

Return the blue histogram bins.

Definition at line 189 of file FrameScope.h.

◆ GetVideoHistogramBlueBins()

const std::vector<uint32_t>& openshot::FrameScope::GetVideoHistogramBlueBins ( ) const
inline

Return the blue histogram bins by reference.

Definition at line 159 of file FrameScope.h.

◆ GetVideoHistogramGreen()

std::vector<int> openshot::FrameScope::GetVideoHistogramGreen ( ) const
inline

Return the green histogram bins.

Definition at line 186 of file FrameScope.h.

◆ GetVideoHistogramGreenBins()

const std::vector<uint32_t>& openshot::FrameScope::GetVideoHistogramGreenBins ( ) const
inline

Return the green histogram bins by reference.

Definition at line 156 of file FrameScope.h.

◆ GetVideoHistogramLuma()

std::vector<int> openshot::FrameScope::GetVideoHistogramLuma ( ) const
inline

Return the luma histogram bins.

Definition at line 180 of file FrameScope.h.

◆ GetVideoHistogramLumaBins()

const std::vector<uint32_t>& openshot::FrameScope::GetVideoHistogramLumaBins ( ) const
inline

Return the luma histogram bins by reference.

Definition at line 150 of file FrameScope.h.

◆ GetVideoHistogramRed()

std::vector<int> openshot::FrameScope::GetVideoHistogramRed ( ) const
inline

Return the red histogram bins.

Definition at line 183 of file FrameScope.h.

◆ GetVideoHistogramRedBins()

const std::vector<uint32_t>& openshot::FrameScope::GetVideoHistogramRedBins ( ) const
inline

Return the red histogram bins by reference.

Definition at line 153 of file FrameScope.h.

◆ GetVideoVectorscope()

std::vector<int> openshot::FrameScope::GetVideoVectorscope ( ) const
inline

Return the flattened vectorscope density plane.

Definition at line 177 of file FrameScope.h.

◆ GetVideoVectorscopeBins()

const std::vector<uint32_t>& openshot::FrameScope::GetVideoVectorscopeBins ( ) const
inline

Return the flattened vectorscope density plane by reference.

Definition at line 174 of file FrameScope.h.

◆ GetVideoWaveformBlue()

std::vector<int> openshot::FrameScope::GetVideoWaveformBlue ( ) const
inline

Return the flattened blue waveform bins.

Definition at line 201 of file FrameScope.h.

◆ GetVideoWaveformBlueBins()

const std::vector<uint32_t>& openshot::FrameScope::GetVideoWaveformBlueBins ( ) const
inline

Return the flattened blue waveform bins by reference.

Definition at line 171 of file FrameScope.h.

◆ GetVideoWaveformGreen()

std::vector<int> openshot::FrameScope::GetVideoWaveformGreen ( ) const
inline

Return the flattened green waveform bins.

Definition at line 198 of file FrameScope.h.

◆ GetVideoWaveformGreenBins()

const std::vector<uint32_t>& openshot::FrameScope::GetVideoWaveformGreenBins ( ) const
inline

Return the flattened green waveform bins by reference.

Definition at line 168 of file FrameScope.h.

◆ GetVideoWaveformLuma()

std::vector<int> openshot::FrameScope::GetVideoWaveformLuma ( ) const
inline

Return the flattened luma waveform bins.

Definition at line 192 of file FrameScope.h.

◆ GetVideoWaveformLumaBins()

const std::vector<uint32_t>& openshot::FrameScope::GetVideoWaveformLumaBins ( ) const
inline

Return the flattened luma waveform bins by reference.

Definition at line 162 of file FrameScope.h.

◆ GetVideoWaveformRed()

std::vector<int> openshot::FrameScope::GetVideoWaveformRed ( ) const
inline

Return the flattened red waveform bins.

Definition at line 195 of file FrameScope.h.

◆ GetVideoWaveformRedBins()

const std::vector<uint32_t>& openshot::FrameScope::GetVideoWaveformRedBins ( ) const
inline

Return the flattened red waveform bins by reference.

Definition at line 165 of file FrameScope.h.

◆ GetVideoWidth()

int openshot::FrameScope::GetVideoWidth ( ) const
inline

Return the analyzed video width.

Definition at line 135 of file FrameScope.h.

◆ GetWaveformBins()

int openshot::FrameScope::GetWaveformBins ( ) const
inline

Return the number of vertical waveform bins.

Definition at line 144 of file FrameScope.h.

◆ GetWaveformColumns()

int openshot::FrameScope::GetWaveformColumns ( ) const
inline

Return the number of waveform columns.

Definition at line 141 of file FrameScope.h.

◆ HasAudio()

bool openshot::FrameScope::HasAudio ( ) const
inline

Return whether the current frame has analyzable audio data.

Definition at line 132 of file FrameScope.h.

◆ HasVideo()

bool openshot::FrameScope::HasVideo ( ) const
inline

Return whether the current frame has analyzable video data.

Definition at line 129 of file FrameScope.h.

◆ HasVideoRegion()

bool openshot::FrameScope::HasVideoRegion ( ) const
inline

Return whether a video ROI is enabled.

Definition at line 126 of file FrameScope.h.

◆ Json()

std::string FrameScope::Json ( ) const

Return the current scope payload as a JSON string.

Definition at line 463 of file FrameScope.cpp.

◆ JsonValue()

Json::Value FrameScope::JsonValue ( ) const

Return the current scope payload as a Json::Value tree.

Definition at line 457 of file FrameScope.cpp.

◆ SetAudioBuckets()

void FrameScope::SetAudioBuckets ( int  buckets)

Set the number of audio buckets and re-analyze.

Definition at line 190 of file FrameScope.cpp.

◆ SetFrame()

void FrameScope::SetFrame ( std::shared_ptr< Frame new_frame)

Replace the current frame and recompute the scope data.

Definition at line 178 of file FrameScope.cpp.

◆ SetVectorscopeSize()

void FrameScope::SetVectorscopeSize ( int  size)

Set the vectorscope plane edge length and re-analyze video.

Definition at line 197 of file FrameScope.cpp.

◆ SetVideoRegionNormalized()

void FrameScope::SetVideoRegionNormalized ( float  x,
float  y,
float  width,
float  height 
)

Set a normalized ROI for video analysis and re-analyze video.

Definition at line 204 of file FrameScope.cpp.

◆ SetWaveformColumns()

void FrameScope::SetWaveformColumns ( int  columns)

Set the number of horizontal waveform columns and re-analyze.

Definition at line 183 of file FrameScope.cpp.


The documentation for this class was generated from the following files: