diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2008-08-26 12:33:16 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2008-08-26 12:33:16 +0000 |
commit | 81f8895cb433d34da3478b45904536a365d88946 (patch) | |
tree | 428a19ae1c386c1874bf1235f8006a1a8832ac05 /gst/deinterlace2/tvtime/tomsmocomp/WierdBob.inc | |
parent | 9fbc550ee173229058094ad2a43858342ba4fc8e (diff) | |
download | gst-plugins-bad-81f8895cb433d34da3478b45904536a365d88946.tar.gz gst-plugins-bad-81f8895cb433d34da3478b45904536a365d88946.tar.bz2 gst-plugins-bad-81f8895cb433d34da3478b45904536a365d88946.zip |
gst/deinterlace2/tvtime/tomsmocomp/: Unroll the loop to handle two bytes at once. This should give a small speedup an...
Original commit message from CVS:
* gst/deinterlace2/tvtime/tomsmocomp/SearchLoopBottom.inc:
* gst/deinterlace2/tvtime/tomsmocomp/SearchLoopTop.inc:
* gst/deinterlace2/tvtime/tomsmocomp/StrangeBob.inc:
* gst/deinterlace2/tvtime/tomsmocomp/WierdBob.inc:
Unroll the loop to handle two bytes at once. This should give
a small speedup and makes it possible to handle chroma and luma
different which is needed later.
Diffstat (limited to 'gst/deinterlace2/tvtime/tomsmocomp/WierdBob.inc')
-rw-r--r-- | gst/deinterlace2/tvtime/tomsmocomp/WierdBob.inc | 93 |
1 files changed, 66 insertions, 27 deletions
diff --git a/gst/deinterlace2/tvtime/tomsmocomp/WierdBob.inc b/gst/deinterlace2/tvtime/tomsmocomp/WierdBob.inc index 6cbd1b8d..f4bbb830 100644 --- a/gst/deinterlace2/tvtime/tomsmocomp/WierdBob.inc +++ b/gst/deinterlace2/tvtime/tomsmocomp/WierdBob.inc @@ -192,56 +192,95 @@ #else // a,f - best = (pBob[-2] + pBob[src_pitch2 + 2]) / 2; - diff = ABS (pBob[-2] - pBob[src_pitch2 + 2]); + best[0] = (pBob[-2] + pBob[src_pitch2 + 2]) / 2; + diff[0] = ABS (pBob[-2] - pBob[src_pitch2 + 2]); + best[1] = (pBob[-1] + pBob[src_pitch2 + 3]) / 2; + diff[1] = ABS (pBob[-1] - pBob[src_pitch2 + 3]); // c,d - if (ABS (pBob[2] - pBob[src_pitch2 - 2]) < diff) { - best = (pBob[2] + pBob[src_pitch2 - 2]) / 2; - diff = ABS (pBob[2] - pBob[src_pitch2 - 2]); + if (ABS (pBob[2] - pBob[src_pitch2 - 2]) < diff[0]) { + best[0] = (pBob[2] + pBob[src_pitch2 - 2]) / 2; + diff[0] = ABS (pBob[2] - pBob[src_pitch2 - 2]); + } + + if (ABS (pBob[3] - pBob[src_pitch2 - 1]) < diff[1]) { + best[1] = (pBob[3] + pBob[src_pitch2 - 1]) / 2; + diff[1] = ABS (pBob[3] - pBob[src_pitch2 - 1]); } // j,n - if (ABS (pBob[-4] - pBob[src_pitch2 + 4]) < diff) { - best = (pBob[-4] + pBob[src_pitch2 + 4]) / 2; - diff = ABS (pBob[-4] - pBob[src_pitch2 + 4]); + if (ABS (pBob[-4] - pBob[src_pitch2 + 4]) < diff[0]) { + best[0] = (pBob[-4] + pBob[src_pitch2 + 4]) / 2; + diff[0] = ABS (pBob[-4] - pBob[src_pitch2 + 4]); + } + + if (ABS (pBob[-3] - pBob[src_pitch2 + 5]) < diff[1]) { + best[1] = (pBob[-3] + pBob[src_pitch2 + 5]) / 2; + diff[1] = ABS (pBob[-3] - pBob[src_pitch2 + 5]); } // k,m - if (ABS (pBob[4] - pBob[src_pitch2 - 4]) < diff) { - best = (pBob[4] + pBob[src_pitch2 - 4]) / 2; - diff = ABS (pBob[-4] - pBob[src_pitch2 - 4]); + if (ABS (pBob[4] - pBob[src_pitch2 - 4]) < diff[0]) { + best[0] = (pBob[4] + pBob[src_pitch2 - 4]) / 2; + diff[0] = ABS (pBob[-4] - pBob[src_pitch2 - 4]); } + if (ABS (pBob[5] - pBob[src_pitch2 - 3]) < diff[1]) { + best[1] = (pBob[5] + pBob[src_pitch2 - 3]) / 2; + diff[1] = ABS (pBob[-3] - pBob[src_pitch2 - 3]); + } // k,m - if (ABS (pBob[4] - pBob[src_pitch2 - 4]) < diff) { - best = (pBob[4] + pBob[src_pitch2 - 4]) / 2; - diff = ABS (pBob[-4] - pBob[src_pitch2 - 4]); + if (ABS (pBob[4] - pBob[src_pitch2 - 4]) < diff[0]) { + best[0] = (pBob[4] + pBob[src_pitch2 - 4]) / 2; + diff[0] = ABS (pBob[-4] - pBob[src_pitch2 - 4]); + } + + if (ABS (pBob[5] - pBob[src_pitch2 - 3]) < diff[1]) { + best[1] = (pBob[5] + pBob[src_pitch2 - 3]) / 2; + diff[1] = ABS (pBob[-3] - pBob[src_pitch2 - 3]); } // We will also calc here the max/min values to later limit comb // so the max excursion will not exceed the Max_Comb constant #ifdef SKIP_SEARCH - best = CLAMP (best, MIN (pBob[src_pitch2], pBob[0]), MAX (pBob[src_pitch2], pBob[0])); + best[0] = CLAMP (best[0], MIN (pBob[src_pitch2], pBob[0]), MAX (pBob[src_pitch2], pBob[0])); + best[1] = CLAMP (best[1], MIN (pBob[src_pitch2 + 1], pBob[1]), MAX (pBob[src_pitch2 + 1], pBob[1])); #else - mov = MAX (ABS (pBob[0] - pBobP[0]), ABS (pBob[src_pitch2] - pBobP[src_pitch2])); + mov[0] = MAX (ABS (pBob[0] - pBobP[0]), ABS (pBob[src_pitch2] - pBobP[src_pitch2])); + mov[1] = MAX (ABS (pBob[1] - pBobP[1]), ABS (pBob[src_pitch2 + 1] - pBobP[src_pitch2 + 1])); - MinVals = 0; - MaxVals = 255; - if (mov > Max_Mov) { - MinVals = MAX (MIN (pBob[0], pBob[src_pitch2]), best); - MaxVals = MIN (MAX (pBob[0], pBob[src_pitch2]), best); + MinVals[0] = 0; + MinVals[1] = 0; + MaxVals[0] = 255; + MaxVals[1] = 255; + + if (mov[0] > Max_Mov[0]) { + MinVals[0] = MAX (MIN (pBob[0], pBob[src_pitch2]), best[0]); + MaxVals[0] = MIN (MAX (pBob[0], pBob[src_pitch2]), best[0]); + } + + if (mov[1] > Max_Mov[1]) { + MinVals[1] = MAX (MIN (pBob[1], pBob[src_pitch2 + 1]), best[1]); + MaxVals[1] = MIN (MAX (pBob[1], pBob[src_pitch2 + 1]), best[1]); } - best = CLAMP (best, MIN (pBob[src_pitch2], pBob[0]), MAX (pBob[src_pitch2], pBob[0])); + best[0] = CLAMP (best[0], MIN (pBob[src_pitch2], pBob[0]), MAX (pBob[src_pitch2], pBob[0])); + best[1] = CLAMP (best[1], MIN (pBob[src_pitch2 + 1], pBob[1]), MAX (pBob[src_pitch2 + 1], pBob[1])); #endif - avg = (pBob[src_pitch2] + pBob[0]) / 2; - diff2 = ABS (pBob[src_pitch2] - pBob[0]); + avg[0] = (pBob[src_pitch2] + pBob[0]) / 2; + avg[1] = (pBob[src_pitch2 + 1] + pBob[1]) / 2; + diff2[0] = ABS (pBob[src_pitch2] - pBob[0]); + diff2[1] = ABS (pBob[src_pitch2 + 1] - pBob[1]); + + if (diff2[0] < diff[0]) { + best[0] = avg[0]; + diff[0] = diff2[0]; + } - if (diff2 < diff) { - best = avg; - diff = diff2; + if (diff2[1] < diff[1]) { + best[1] = avg[1]; + diff[1] = diff2[1]; } #endif |