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.