diff dsputil.c @ 2257:5f64a30339e5 libavcodec

1/4 resolution decoding
author michael
date Sun, 26 Sep 2004 00:18:12 +0000
parents 7e0b2e86afa9
children 12e75af1d44c
line wrap: on
line diff
--- a/dsputil.c	Sat Sep 25 23:18:58 2004 +0000
+++ b/dsputil.c	Sun Sep 26 00:18:12 2004 +0000
@@ -464,6 +464,22 @@
     }
 }
 
+static void put_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels,
+				 int line_size)
+{
+    int i;
+    uint8_t *cm = cropTbl + MAX_NEG_CROP;
+    
+    /* read the pixels */
+    for(i=0;i<2;i++) {
+        pixels[0] = cm[block[0]];
+        pixels[1] = cm[block[1]];
+
+        pixels += line_size;
+        block += 8;
+    }
+}
+
 static void put_signed_pixels_clamped_c(const DCTELEM *block, 
                                         uint8_t *restrict pixels,
                                         int line_size)
@@ -522,6 +538,21 @@
         block += 8;
     }
 }
+
+static void add_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels,
+                          int line_size)
+{
+    int i;
+    uint8_t *cm = cropTbl + MAX_NEG_CROP;
+    
+    /* read the pixels */
+    for(i=0;i<2;i++) {
+        pixels[0] = cm[pixels[0] + block[0]];
+        pixels[1] = cm[pixels[1] + block[1]];
+        pixels += line_size;
+        block += 8;
+    }
+}
 #if 0
 
 #define PIXOP2(OPNAME, OP) \
@@ -3340,6 +3371,17 @@
     add_pixels_clamped4_c(block, dest, line_size);
 }
 
+static void ff_jref_idct2_put(uint8_t *dest, int line_size, DCTELEM *block)
+{
+    j_rev_dct2 (block);
+    put_pixels_clamped2_c(block, dest, line_size);
+}
+static void ff_jref_idct2_add(uint8_t *dest, int line_size, DCTELEM *block)
+{
+    j_rev_dct2 (block);
+    add_pixels_clamped2_c(block, dest, line_size);
+}
+
 /* init static data */
 void dsputil_static_init(void)
 {
@@ -3383,6 +3425,11 @@
         c->idct_add= ff_jref_idct4_add;
         c->idct    = j_rev_dct4;
         c->idct_permutation_type= FF_NO_IDCT_PERM;
+    }else if(avctx->lowres==2){
+        c->idct_put= ff_jref_idct2_put;
+        c->idct_add= ff_jref_idct2_add;
+        c->idct    = j_rev_dct2;
+        c->idct_permutation_type= FF_NO_IDCT_PERM;
     }else{
         if(avctx->idct_algo==FF_IDCT_INT){
             c->idct_put= ff_jref_idct_put;