Thread: Deblock
View Single Post
Old 3rd August 2014, 17:41   #3  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,554
It's the code review patrol!

This is the only definitively wrong part:
Code:
if (!isConstantFormat(d.vi) || d.vi->format->colorFamily == cmCompat || d.vi->format->sampleType != stInteger || d.vi->format->bytesPerSample > 2) {
       vsapi->setError(out, "Deblock: only constant format 8-16 bits integer input supported");
        vsapi->freeNode(d.node);
        return;
}
You probably want this instead:
Code:
  if (!isConstantFormat(d.vi) || d.vi->format->sampleType != stInteger || (d.vi->format->bitsPerSample != 8 && d.vi->format->bitsPerSample != 16)) {
        vsapi->setError(out, "Deblock: only constant format 8 or 16 bits integer input supported");
        vsapi->freeNode(d.node);
        return;
    }
The motivation:
1. Normal filters will never get cmCompat formats as input so no need to check for it
2. You actual processing code actually only works for 8 and 16 bit. For 9-15 bits you don't clamp the output range properly so the output will technically be invalid. You could of course fix the clamping too for the 9-16 bit case which is probably more elegant.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline