aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/dsputil.c
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2004-04-27 03:58:06 +0000
committerMike Melanson <mike@multimedia.cx>2004-04-27 03:58:06 +0000
commitf9ed9d8584d762142cf5e579b38bfe649cc5c8e8 (patch)
tree790114f1ba563c9f673933792b8f5f8811cf656e /libavcodec/dsputil.c
parentc0c37848d8c571b13c5fe443f6d0811ac2d3cc36 (diff)
downloadffmpeg-f9ed9d8584d762142cf5e579b38bfe649cc5c8e8.tar.gz
separate out put_signed_pixels_clamped() into its own function and
implement an optimized MMX version of the function Originally committed as revision 3082 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/dsputil.c')
-rw-r--r--libavcodec/dsputil.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 7b554b1fd0..b1252251ad 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -332,6 +332,27 @@ static void put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
}
}
+static void put_signed_pixels_clamped_c(const DCTELEM *block,
+ uint8_t *restrict pixels,
+ int line_size)
+{
+ int i, j;
+
+ for (i = 0; i < 8; i++) {
+ for (j = 0; j < 8; j++) {
+ if (*block < -128)
+ *pixels = 0;
+ else if (*block > 127)
+ *pixels = 255;
+ else
+ *pixels = (uint8_t)(*block + 128);
+ block++;
+ pixels++;
+ }
+ pixels += (line_size - 8);
+ }
+}
+
static void add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
int line_size)
{
@@ -3131,6 +3152,7 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx)
c->get_pixels = get_pixels_c;
c->diff_pixels = diff_pixels_c;
c->put_pixels_clamped = put_pixels_clamped_c;
+ c->put_signed_pixels_clamped = put_signed_pixels_clamped_c;
c->add_pixels_clamped = add_pixels_clamped_c;
c->gmc1 = gmc1_c;
c->gmc = gmc_c;