[mythtv] PATCH: Commercial detection/skip using blank frames

Chris Pinkham cpinkham at bc2va.org
Sun Feb 23 11:32:49 EST 2003

> Just out of curiosity, I wanted to see how much load would
> be added by GetFrameVariance() if it were called for each
> frame while recording. I made a copy in NuppleVideoRecorder.cpp

I'm going to submit a patch either today or tomorrow hopefully that
will speed up this somewhat.  I combined 2 of the loops (minor speed
increase) and put in a short-circuit (little more of a speed increase).
I also renamed the function to FrameIsBlank() because of the
short circuit and we are really looking for blank frames, not just
frames with little variance.  The variance code was false-triggering
on white screens.  My short-circuit now will abort if more than
3 pixels are found with a brightness over a certain limit (like 80
which is getting pretty bright).  So it should short-circuit most
of the time and not have to actualy sample all 200 pixels.

> Without the variance code, the encoder PID used 43:49/60:02
> or 72.99%. It used 44:54/60:57 or 73.67% with the variance

I wouldn't imagine the blank detection code uses much cpu.  In my
tests, it seemed like it was miniscule compared to the decoding and
other processes going on.  That's why I said my two changes were
minor speed increases.

> This seems about right because GetFrameVariance is
> essentially three little 200 iteration loops which is
> nothing compared to the mpeg compression.

If I could just figure out whether this segfault I'm seeing is my
code or in CVS.  I'm getting occasional segfaults when exiting playback.
I believe Isaac said he fixed a bug with this when I submitted the first
commercial skip patch, but I'm still seeing it occasionally in current
CVS without my new patch.  Looks like when libavcodec tries to free
the mbskip_table memory it is faulting because it was freed earlier or
points to something that wasn't malloc-ed (according to libefence).

Isaac, what debugging tool/method did you use to find the previous
segfault problem that you mentioned?


** Chris Pinkham                  Linux v2.2.18, Sane v1.0.4, Cajun v3.0-8 **
** cpinkham at bc2va.org                          http://www.bc2va.org/chris/ **

More information about the mythtv-dev mailing list