MPEG CDVA Experimentation Model (CXM)  1.0
Compact Descriptors for Visual Analisys
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
mpeg7cdva::CdvaImpl Class Reference

A CDVA implementation based on multiple CDVS descriptors. More...

#include <CdvaImpl.h>

Public Member Functions

 CdvaImpl ()
 
virtual ~CdvaImpl ()
 
virtual void init (OPERATION op, bool verbose, size_t n_videos, int querybitrate, int refbitrate=0, bool calcdescsizes=false, bool rwCompressed=false, bool optMatch=false, double set_drop_th=-1, double set_encode_th=-1)
 initialization method - called once before processing videos. More...
 
void extract (const std::string &descrname, const std::string &videopathname, int bitrate, ExtractData &outdata) const
 Video processing method - called once for each video in the list. More...
 
virtual double match (MatchData &matchResults, const std::string &qdescrname, const std::string &rdescrname, int qbitrate, int rbitrate)
 Video matching method - called once for each pair of videos in the list. More...
 
virtual void makeindex (const std::string &cdva_descriptor, const std::string &relativepathname)
 Video indexing method - builds a DB of reference video descriptors. More...
 
virtual void retrieve (std::vector< MatchData > &retrievalResults, const std::string &qdescrname, int qbitrate)
 Video retrieval method - returns a list of reference videos matching the query video. More...
 
void commitDB ()
 Save database information. More...
 
virtual void close ()
 de-initialization method - called once at the end of processing. More...
 

Static Public Member Functions

static bool checkBitrate (int bitrate)
 check if the given bitrate is one of the standard values defined in the CDVA evaluation framework. More...
 
static const char * getDescriptorExt (int bitrate)
 get the file extension corresponding to the given bitrate. More...
 

Protected Member Functions

virtual void parse (const std::string &descFile, ShotDescriptorList &shotList)
 
virtual double match (MatchData &matchResults, const ShotDescriptorList &qDescList, const ShotDescriptorList &rDescList)
 
virtual double match_med1 (MatchData &matchResults, const ShotDescriptorList &qDescList, const ShotDescriptorList &rDescList)
 matching using medoid - variant 1 check medoids against min threshold, then perform full match More...
 
virtual double match_med2 (MatchData &matchResults, const ShotDescriptorList &qDescList, const ShotDescriptorList &rDescList)
 matching using medoid - variant 2 check medoids against min threshold, then iteratively match frames More...
 
virtual int encodeShot (SegmentDescriptor &shot, unsigned long endTime, mpeg7cdvs::CdvsDescriptor &medoid, std::ofstream &fout, ExtractData &outdata) const
 
virtual void getDiffSignature (mpeg7cdvs::SCFVSignature &medoid, mpeg7cdvs::SCFVSignature &other, mpeg7cdvs::SCFVSignature &diffSig, unsigned int &bufferSize, unsigned char *buffer, unsigned int *globaldstatsBin) const
 
virtual void localDescCodingAbs (SegmentDescriptor &shot, std::vector< int > &framesToCode, unsigned int &bufferSize, unsigned char *buffer, int medoidIdx, unsigned int *localdstats) const
 lossy local descriptor coding, applying ABAC to absolute descriptors More...
 
void generateDTM (CompressedSegmentDescriptor &shot, std::vector< int > &framesToCode, int medoidIdx, std::vector< RefFeature > refFeatureList, std::vector< int > ldOffsets, std::vector< int > localFrameOrder, int totalNrFeatures) const
 generate frame - descriptor map More...
 
virtual void encodeCoordinates (CompressedSegmentDescriptor &shot, std::vector< int > &framesToCode, int medoidIdx, std::vector< RefFeature > refFeatureList, std::vector< int > ldOffsets) const
 encode coordinates of local descriptors of as one block More...
 

Static Protected Member Functions

static bool byDescendingScore (const MatchData &m1, const MatchData &m2)
 
static int nBitsSet (unsigned char byte)
 
static int nBitsSet (unsigned int word)
 
static std::string getExt (const std::string &imageName)
 

Protected Attributes

mpeg7cdvs::CdvsConfiguration * cdvsconfig
 
mpeg7cdvs::CdvsClient * cdvsclient
 
mpeg7cdvs::CdvsServer * cdvsserver
 
bool verboseMode
 verbose mode indicator More...
 
OPERATION current_op
 the current operation More...
 
int cdvsMode
 the CDVS mode that will be used to encode keyframe descriptors More...
 
int skip_before
 number of video frames to skip before decoding one More...
 
int skip_after
 number of video frames to skip after decoding one More...
 
double drop_frame_th
 drop frame threshold More...
 
double shot_cut_th
 shot cut threshold More...
 
double shot_ver_th
 shot verification threshold More...
 
double encode_th
 threshold for encoding other frames than median More...
 
size_t max_retrieved
 maximum number of retrieved images More...
 
bool calc_desc_sizes
 calculate size of descriptor components More...
 
int forceSampleMs
 enforce a sample every x milliseconds More...
 
int minShotLen
 minimum shot length More...
 
int minLocalDiff
 min local difference for lossy local descriptor coding (if diff is larger, descriptor is encoded, otherwise replaced by reference) More...
 
bool readWriteCompressed
 read and write compressed descriptors More...
 
bool optMatch
 approx. matching of medoid-based descriptors More...
 
int optMatch_mode
 mode for optimised matching (1 or 2) More...
 
double optMatch_tau
 factor to define threshold to continue matching (opt matching modes 1 and 2) More...
 
double optMatch_b
 divider for fraction of key frames to check to decide for match (opt matching mode 2) More...
 

Detailed Description

A CDVA implementation based on multiple CDVS descriptors.

Constructor & Destructor Documentation

◆ CdvaImpl()

mpeg7cdva::CdvaImpl::CdvaImpl ( )

◆ ~CdvaImpl()

virtual mpeg7cdva::CdvaImpl::~CdvaImpl ( )
virtual

Member Function Documentation

◆ byDescendingScore()

static bool mpeg7cdva::CdvaImpl::byDescendingScore ( const MatchData m1,
const MatchData m2 
)
staticprotected

◆ checkBitrate()

static bool mpeg7cdva::CdvaImpl::checkBitrate ( int  bitrate)
static

check if the given bitrate is one of the standard values defined in the CDVA evaluation framework.

Parameters
bitratethe bitrate in Kilo-byte per second (KB/s)
Returns
true if valid

◆ close()

virtual void mpeg7cdva::CdvaImpl::close ( )
virtual

de-initialization method - called once at the end of processing.

◆ commitDB()

void mpeg7cdva::CdvaImpl::commitDB ( )

Save database information.

◆ encodeCoordinates()

virtual void mpeg7cdva::CdvaImpl::encodeCoordinates ( CompressedSegmentDescriptor shot,
std::vector< int > &  framesToCode,
int  medoidIdx,
std::vector< RefFeature refFeatureList,
std::vector< int >  ldOffsets 
) const
protectedvirtual

encode coordinates of local descriptors of as one block

◆ encodeShot()

virtual int mpeg7cdva::CdvaImpl::encodeShot ( SegmentDescriptor shot,
unsigned long  endTime,
mpeg7cdvs::CdvsDescriptor &  medoid,
std::ofstream &  fout,
ExtractData outdata 
) const
protectedvirtual

◆ extract()

void mpeg7cdva::CdvaImpl::extract ( const std::string &  descrname,
const std::string &  videopathname,
int  bitrate,
ExtractData outdata 
) const

Video processing method - called once for each video in the list.

Parameters
descrnameoutput descriptor pathname
videopathnameinput video stream pathname
bitrateencoding bitrate (one of 0,16,64,256)
outdatathe container for output data

◆ generateDTM()

void mpeg7cdva::CdvaImpl::generateDTM ( CompressedSegmentDescriptor shot,
std::vector< int > &  framesToCode,
int  medoidIdx,
std::vector< RefFeature refFeatureList,
std::vector< int >  ldOffsets,
std::vector< int >  localFrameOrder,
int  totalNrFeatures 
) const
protected

generate frame - descriptor map

◆ getDescriptorExt()

static const char* mpeg7cdva::CdvaImpl::getDescriptorExt ( int  bitrate)
static

get the file extension corresponding to the given bitrate.

Parameters
bitratethe bitrate in Kilo-byte per second (KB/s)
Returns
the file extension

◆ getDiffSignature()

virtual void mpeg7cdva::CdvaImpl::getDiffSignature ( mpeg7cdvs::SCFVSignature &  medoid,
mpeg7cdvs::SCFVSignature &  other,
mpeg7cdvs::SCFVSignature &  diffSig,
unsigned int &  bufferSize,
unsigned char *  buffer,
unsigned int *  globaldstatsBin 
) const
protectedvirtual

◆ getExt()

static std::string mpeg7cdva::CdvaImpl::getExt ( const std::string &  imageName)
staticprotected

◆ init()

virtual void mpeg7cdva::CdvaImpl::init ( OPERATION  op,
bool  verbose,
size_t  n_videos,
int  querybitrate,
int  refbitrate = 0,
bool  calcdescsizes = false,
bool  rwCompressed = false,
bool  optMatch = false,
double  set_drop_th = -1,
double  set_encode_th = -1 
)
virtual

initialization method - called once before processing videos.

Parameters
opone of EXTRACT, MATCH, RETRIEVE
verbosewhen set, more information is provided
n_videosthe number of videos to be processed
querybitratethe query encoding bitrate (one of 0,16,64,256)
refbitratethe reference encoding bitrate (one of 0,16,64,256)
calcdescsizesif true, the size of individual elements of the CDVS descriptor is reported in the output log files
rwCompressedif true, compressed descriptor representations are used for serialising and parsing
optMatchif true, use approximate matching of medoid-based descriptors
set_drop_thvalue to override default drop frame threshold
set_encode_thvalue to override default encode frame threshold

◆ localDescCodingAbs()

virtual void mpeg7cdva::CdvaImpl::localDescCodingAbs ( SegmentDescriptor shot,
std::vector< int > &  framesToCode,
unsigned int &  bufferSize,
unsigned char *  buffer,
int  medoidIdx,
unsigned int *  localdstats 
) const
protectedvirtual

lossy local descriptor coding, applying ABAC to absolute descriptors

Parameters
localdstatsfor gathering encoding statistics only

◆ makeindex()

virtual void mpeg7cdva::CdvaImpl::makeindex ( const std::string &  cdva_descriptor,
const std::string &  relativepathname 
)
virtual

Video indexing method - builds a DB of reference video descriptors.

Parameters
cdva_descriptorthe descriptor to add to the DB
relativepathnamethe relative pathname of the video file to be used as unique identifier

◆ match() [1/2]

virtual double mpeg7cdva::CdvaImpl::match ( MatchData matchResults,
const ShotDescriptorList qDescList,
const ShotDescriptorList rDescList 
)
protectedvirtual

◆ match() [2/2]

virtual double mpeg7cdva::CdvaImpl::match ( MatchData matchResults,
const std::string &  qdescrname,
const std::string &  rdescrname,
int  qbitrate,
int  rbitrate 
)
virtual

Video matching method - called once for each pair of videos in the list.

Parameters
matchResultscontainer for the results of matching
qdescrnameinput query descriptor name
rdescrnameinput reference descriptor name
qbitratequery bitrate (one of 16,64,256)
rbitratereference bitrate (one of 16,64,256)
Returns
the matching score (normalized in the [0..1] range)

◆ match_med1()

virtual double mpeg7cdva::CdvaImpl::match_med1 ( MatchData matchResults,
const ShotDescriptorList qDescList,
const ShotDescriptorList rDescList 
)
protectedvirtual

matching using medoid - variant 1 check medoids against min threshold, then perform full match

◆ match_med2()

virtual double mpeg7cdva::CdvaImpl::match_med2 ( MatchData matchResults,
const ShotDescriptorList qDescList,
const ShotDescriptorList rDescList 
)
protectedvirtual

matching using medoid - variant 2 check medoids against min threshold, then iteratively match frames

◆ nBitsSet() [1/2]

static int mpeg7cdva::CdvaImpl::nBitsSet ( unsigned char  byte)
inlinestaticprotected

◆ nBitsSet() [2/2]

static int mpeg7cdva::CdvaImpl::nBitsSet ( unsigned int  word)
inlinestaticprotected

◆ parse()

virtual void mpeg7cdva::CdvaImpl::parse ( const std::string &  descFile,
ShotDescriptorList shotList 
)
protectedvirtual

◆ retrieve()

virtual void mpeg7cdva::CdvaImpl::retrieve ( std::vector< MatchData > &  retrievalResults,
const std::string &  qdescrname,
int  qbitrate 
)
virtual

Video retrieval method - returns a list of reference videos matching the query video.

Parameters
retrievalResultsthe output vector containing an ordered list of matching reference videos
qdescrnamethe video query descriptor
qbitratequery bitrate (one of 16,64,256)

Field Documentation

◆ calc_desc_sizes

bool mpeg7cdva::CdvaImpl::calc_desc_sizes
protected

calculate size of descriptor components

◆ cdvsclient

mpeg7cdvs::CdvsClient* mpeg7cdva::CdvaImpl::cdvsclient
protected

◆ cdvsconfig

mpeg7cdvs::CdvsConfiguration* mpeg7cdva::CdvaImpl::cdvsconfig
protected

◆ cdvsMode

int mpeg7cdva::CdvaImpl::cdvsMode
protected

the CDVS mode that will be used to encode keyframe descriptors

◆ cdvsserver

mpeg7cdvs::CdvsServer* mpeg7cdva::CdvaImpl::cdvsserver
protected

◆ current_op

OPERATION mpeg7cdva::CdvaImpl::current_op
protected

the current operation

◆ drop_frame_th

double mpeg7cdva::CdvaImpl::drop_frame_th
protected

drop frame threshold

◆ encode_th

double mpeg7cdva::CdvaImpl::encode_th
protected

threshold for encoding other frames than median

◆ forceSampleMs

int mpeg7cdva::CdvaImpl::forceSampleMs
protected

enforce a sample every x milliseconds

◆ max_retrieved

size_t mpeg7cdva::CdvaImpl::max_retrieved
protected

maximum number of retrieved images

◆ minLocalDiff

int mpeg7cdva::CdvaImpl::minLocalDiff
protected

min local difference for lossy local descriptor coding (if diff is larger, descriptor is encoded, otherwise replaced by reference)

◆ minShotLen

int mpeg7cdva::CdvaImpl::minShotLen
protected

minimum shot length

◆ optMatch

bool mpeg7cdva::CdvaImpl::optMatch
protected

approx. matching of medoid-based descriptors

◆ optMatch_b

double mpeg7cdva::CdvaImpl::optMatch_b
protected

divider for fraction of key frames to check to decide for match (opt matching mode 2)

◆ optMatch_mode

int mpeg7cdva::CdvaImpl::optMatch_mode
protected

mode for optimised matching (1 or 2)

◆ optMatch_tau

double mpeg7cdva::CdvaImpl::optMatch_tau
protected

factor to define threshold to continue matching (opt matching modes 1 and 2)

◆ readWriteCompressed

bool mpeg7cdva::CdvaImpl::readWriteCompressed
protected

read and write compressed descriptors

◆ shot_cut_th

double mpeg7cdva::CdvaImpl::shot_cut_th
protected

shot cut threshold

◆ shot_ver_th

double mpeg7cdva::CdvaImpl::shot_ver_th
protected

shot verification threshold

◆ skip_after

int mpeg7cdva::CdvaImpl::skip_after
protected

number of video frames to skip after decoding one

◆ skip_before

int mpeg7cdva::CdvaImpl::skip_before
protected

number of video frames to skip before decoding one

◆ verboseMode

bool mpeg7cdva::CdvaImpl::verboseMode
protected

verbose mode indicator


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