0

In my video codec I have two types of frames: a frame can either be a ref frame (something like JPEG) or a delta frame. Delta frame is also like JPEG but done on difference of current and previous frames.

Now I want to define ref/delta info not per frame but per each macroblock (16x16 pixels). To do so I need to determine whether a macroblock should be a ref or a delta macroblock. What should I base this decision on? Ideally I want to pick the one the gives better compression but how can I decide this in a smart way without actually compressing the macroblock in both modes and then picking one producing better compression ratio?

The only way I can think of right now is to compute the sum of pixels differences within the macroblock and, if that sum is bigger than some threshold, classify the macroblock as ref. Delta otherwise. But that doesn't sound like a robust solution.

maxest
  • 89
  • 1
  • 10
  • Instead of a sum of absolute differences you can use a sum of squared differences or do a partial DCT and compare the sum of absolute coefficients. Two DCT vectors from corner to corner would be 1/8th the cost of a 8x8 transform block (what JPEG uses). Anyway, none of that is going to matter much if the camera is moving, since delta from previous frame doesn't code motion efficiently. There's a reason even MPEG-1 used motion vectors with half a pixel accuracy. – The Hard Way Nov 07 '17 at 15:51
  • I thought that motion vectors were precisely for that case - when camera is moving. I wonder if sole DC component would be enough. It might not always be true but I think the bigger the DC the smaller the ACs. And since it takes less bytes to compress data where DC "stores" more information it might be a good guideline. – maxest Nov 22 '17 at 12:41

0 Answers0