[XviD-devel] Scenechange detection
syskin at ihug.com.au
Wed Dec 31 21:53:17 CET 2003
Christoph Lampert wrote:
> scene changes which were not I-frames and I-frames in which nothing
> spectacular happens at all! And that was not only the uses due to
> max_keyframe-interval, of course.
Hmmm all I can say for now is that it doesn't happen for 'full screen'
encodes at bigger resolution. In fact I was *very* happy the scenechange
detection.. until now :)
Now let me think... if the image was 256x196 it had 16x13 macroblocks.
The actual p/b/i decision ignores top and left macroblocks (image is not
edged yet, motion search there wouldn't work as expected) and takes 4
macroblocks at a time (2x2) possibly including right and down
macroblocks. This means it checked 14x12, and included one black row at
the top and - unfortunately - almost three black rows at the bottom
(almost -> one row had 4 pixels of the image, one didn't, and one was
also black but mostly outside of picture).
I'd say that this was the reason... pure black didn't add to SAD but
added at least 300 to picture's complexity, and it usually works good
I really don't like b0rk the p/b/i decision any more, but perhaps
checking less macroblocks (never ever check bottom and right edge) would
do the trick well.
> This makes it very difficult to reach
> 50% of INTRA blocks, right?
Almost all intra decisions come from SAD/complexity (= sum of
deviations) comparison. There is also this "count intra" thingy but its
threshold is high, which nicely prevents consecutive intra frames.
We couldn't count 50% intra MBs in this conditions anyway :)
Ah, the 'wierd' intra frames definitely come from max-keyframe-interval
- once we reach 2/3 of allowed non-intra frames, intra threshold drops
to reach zero at the right spot. This allows catching any frame that is
better at being intra that just a random 300th (or whatever) frame.
> Should we compensate for this somehow, or should we just ignore it?
I think I'll prepare such source and see if it's easy to fix without
b0rking anything. If it works - good. If not, I'm gonna ignore it :)
More information about the XviD-devel