Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Successful build of binary for taking a interval value. #13

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 11 additions & 8 deletions src/film.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ void film::CompareFrame (AVFrame * pFrame, AVFrame * pFramePrev)
score = 0;

// IDEA! Split image in slices and calculate score per-slice.
// This would allow to detect areas on the image which have stayed
// the same, and (a) increase score if all areas have changed
// This would allow to detect areas on the image which have stayed
// the same, and (a) increase score if all areas have changed
// and (b) decrease score if some areas have changed less (ot not at all).
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
Expand Down Expand Up @@ -311,7 +311,7 @@ int film::process ()
* Register all formats and codecs
*/
av_register_all ();
pFormatCtx = avformat_alloc_context ();
pFormatCtx = avformat_alloc_context ();
if (avformat_open_input (&pFormatCtx, input_path.c_str (), NULL, NULL) != 0) {
string error_msg = "Could not open file ";
error_msg += input_path;
Expand Down Expand Up @@ -354,7 +354,7 @@ int film::process ()
*/
if (audioStream != -1) {
if (audio_set) {

string xml_audio = graphpath + "/" + alphaid + "_audio.xml";
init_xml (xml_audio);
}
Expand Down Expand Up @@ -383,15 +383,18 @@ int film::process ()
return -1; // Could not open codec

/*
* Allocate current and previous video frames
* Allocate current and previous video frames
*/
pFrame = avcodec_alloc_frame ();
// RGB:
pFrameRGB = avcodec_alloc_frame (); // current frame
for (int j=0;j<this->interval; j++){
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used.. delete this.

tempRGBprev = avcodec_alloc_frame();
}
pFrameRGBprev = avcodec_alloc_frame (); // previous frame
// YUV:
pFrameYUV = avcodec_alloc_frame (); // current frame

/*
* Allocate memory for the pixels of a picture and setup the AVPicture fields for it
*/
Expand Down Expand Up @@ -457,7 +460,7 @@ int film::process ()
}
}

/*
/*
* Calling "sws_scale" is used to copy the data from "pFrame->data" to other
* frame buffers for later processing. It is also used to convert between
* different pix_fmts.
Expand Down Expand Up @@ -554,7 +557,7 @@ int film::process ()
av_free (pFrameYUV);
avcodec_close (pCodecCtx);
}

// Close the codec
if (audioStream != -1) {
/* Close the XML file */
Expand Down
7 changes: 7 additions & 0 deletions src/film.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class film
// - RGB:
AVFrame *pFrameRGB;
AVFrame *pFrameRGBprev;
AVFrame *tempRGBprev;
// - YUV:
AVFrame *pFrameYUV;

Expand Down Expand Up @@ -200,6 +201,9 @@ class film
bool draw_hsv_graph;
bool draw_yuv_graph;

/* Interval of frames to skip*/
int interval;

xml *x;
bool display;

Expand Down Expand Up @@ -251,6 +255,9 @@ class film
inline void set_year(int year) {
this->year=year;
};
inline void set_interval(int interval) {
this->interval=interval;
}
inline void set_alphaid(string alphaid) {
this->alphaid = alphaid;
};
Expand Down
9 changes: 7 additions & 2 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ void show_help (char **argv) {
"-m : generate the thumbnail image\n"
"-r : generate the images in native resolution\n"
"-c : print timecode on x-axis in graph\n",
"-z : Interval to compare frames across(Default 1)\n",
g_APP_VERSION,
argv[0],
DEFAULT_THRESHOLD
Expand All @@ -82,7 +83,7 @@ int main (int argc, char **argv) {
f.threshold=DEFAULT_THRESHOLD;

for (;;) {
int c = getopt (argc, argv, "?hnt:y:i:o:a:x:s:flwvmrc");
int c = getopt (argc, argv, "?hnt:y:i:o:a:x:s:flwvmrcz");

if (c < 0) {
break;
Expand Down Expand Up @@ -131,7 +132,7 @@ int main (int argc, char **argv) {
break;

/* Embed timecode in graph */
case 't':
case 'c':
f.set_show_timecode(true);
break;

Expand Down Expand Up @@ -174,6 +175,10 @@ int main (int argc, char **argv) {
gui = false;
break;

/* Compare across this interval */
case 'z':
f.set_interval(atoi(optarg));
break;

default:
break;
Expand Down