[FFmpeg-soc] [soc]: r823 - dirac/libavcodec/dirac.c
marco
subversion at mplayerhq.hu
Wed Aug 15 22:05:23 CEST 2007
Author: marco
Date: Wed Aug 15 22:05:22 2007
New Revision: 823
Log:
break up the loop to avoid checking for border conditions and to make further optimizations possible
Modified:
dirac/libavcodec/dirac.c
Modified: dirac/libavcodec/dirac.c
==============================================================================
--- dirac/libavcodec/dirac.c (original)
+++ dirac/libavcodec/dirac.c Wed Aug 15 22:05:22 2007
@@ -2034,7 +2034,8 @@ START_TIMER
lineout = pixels;
lineoutodd = pixels + outwidth;
linein = refdata;
- for (y = 0; y < height; y++) {
+ /* Top 4 lines. */
+ for (y = 0; y < 5; y++) {
for (x = 0; x < width; x++) {
int i;
int val = 0;
@@ -2049,6 +2050,74 @@ START_TIMER
val += t[i] * refdata[FFMAX(ypos, 0)
* refframe->linesize[comp] + x];
ypos = y + i + 1;
+ val += t[i] * refdata[ypos
+ * refframe->linesize[comp] + x];
+ }
+
+ val += 128;
+ val >>= 8;
+
+ lineout[x * 2] = linein[x];
+ lineoutodd[x * 2] = av_clip_uint8(val);
+ }
+
+ linein += refframe->linesize[comp];
+
+ /* Skip one line, we are interpolating to odd lines. */
+ lineout += outwidth * 2;
+ lineoutodd += outwidth * 2;
+ }
+
+ /* Middle part. */
+ for (y = 5; y < height - 5; y++) {
+ for (x = 0; x < width; x++) {
+ int i;
+ int val = 0;
+
+ for (i = 0; i <= 4; i++) {
+ int ypos;
+ ypos = y - i;
+
+ /* XXX: Instead of clipping, it would be better to
+ break up the loop and handle the last lines as a
+ special case. */
+ val += t[i] * refdata[ypos
+ * refframe->linesize[comp] + x];
+ ypos = y + i + 1;
+ val += t[i] * refdata[ypos
+ * refframe->linesize[comp] + x];
+ }
+
+ val += 128;
+ val >>= 8;
+
+ lineout[x * 2] = linein[x];
+ lineoutodd[x * 2] = av_clip_uint8(val);
+ }
+
+ linein += refframe->linesize[comp];
+
+ /* Skip one line, we are interpolating to odd lines. */
+ lineout += outwidth * 2;
+ lineoutodd += outwidth * 2;
+ }
+
+ /* Bottom. */
+ for (y = height - 5; y < height; y++) {
+ for (x = 0; x < width; x++) {
+ int i;
+ int val = 0;
+
+ for (i = 0; i <= 4; i++) {
+ int ypos;
+ ypos = y - i;
+
+ /* XXX: Instead of clipping, it would be better to
+ break up the loop and handle the last lines as a
+ special case. */
+ val += t[i] * refdata[ypos
+ * refframe->linesize[comp] + x];
+ ypos = y + i + 1;
val += t[i] * refdata[FFMIN(ypos, height - 1)
* refframe->linesize[comp] + x];
}
More information about the FFmpeg-soc
mailing list