From 81f8895cb433d34da3478b45904536a365d88946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 26 Aug 2008 12:33:16 +0000 Subject: 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. --- gst/deinterlace2/tvtime/tomsmocomp/WierdBob.inc | 93 ++++++++++++++++++------- 1 file changed, 66 insertions(+), 27 deletions(-) (limited to 'gst/deinterlace2/tvtime/tomsmocomp/WierdBob.inc') 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 -- cgit v1.2.1