aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/dsputil.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-09-25 23:18:58 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-09-25 23:18:58 +0000
commit178fcca84883bdbff02d5ae8eb7825bf884b40d8 (patch)
treedaf6d857ef63cf0ad688acdadf1091732507b965 /libavcodec/dsputil.c
parentbc133816c03b32d722fa43cfe1d199a273fc65b4 (diff)
downloadffmpeg-178fcca84883bdbff02d5ae8eb7825bf884b40d8.tar.gz
1/2 resolution decoding
Originally committed as revision 3507 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/dsputil.c')
-rw-r--r--libavcodec/dsputil.c71
1 files changed, 62 insertions, 9 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index a2ef9f6d7f..8b95ff2e6c 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -446,6 +446,24 @@ static void put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
}
}
+static void put_pixels_clamped4_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<4;i++) {
+ pixels[0] = cm[block[0]];
+ pixels[1] = cm[block[1]];
+ pixels[2] = cm[block[2]];
+ pixels[3] = cm[block[3]];
+
+ pixels += line_size;
+ block += 8;
+ }
+}
+
static void put_signed_pixels_clamped_c(const DCTELEM *block,
uint8_t *restrict pixels,
int line_size)
@@ -487,6 +505,23 @@ static void add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
block += 8;
}
}
+
+static void add_pixels_clamped4_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<4;i++) {
+ pixels[0] = cm[pixels[0] + block[0]];
+ pixels[1] = cm[pixels[1] + block[1]];
+ pixels[2] = cm[pixels[2] + block[2]];
+ pixels[3] = cm[pixels[3] + block[3]];
+ pixels += line_size;
+ block += 8;
+ }
+}
#if 0
#define PIXOP2(OPNAME, OP) \
@@ -3294,6 +3329,17 @@ static void ff_jref_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
add_pixels_clamped_c(block, dest, line_size);
}
+static void ff_jref_idct4_put(uint8_t *dest, int line_size, DCTELEM *block)
+{
+ j_rev_dct4 (block);
+ put_pixels_clamped4_c(block, dest, line_size);
+}
+static void ff_jref_idct4_add(uint8_t *dest, int line_size, DCTELEM *block)
+{
+ j_rev_dct4 (block);
+ add_pixels_clamped4_c(block, dest, line_size);
+}
+
/* init static data */
void dsputil_static_init(void)
{
@@ -3332,16 +3378,23 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx)
}
#endif //CONFIG_ENCODERS
- if(avctx->idct_algo==FF_IDCT_INT){
- c->idct_put= ff_jref_idct_put;
- c->idct_add= ff_jref_idct_add;
- c->idct = j_rev_dct;
- c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
- }else{ //accurate/default
- c->idct_put= simple_idct_put;
- c->idct_add= simple_idct_add;
- c->idct = simple_idct;
+ if(avctx->lowres==1){
+ c->idct_put= ff_jref_idct4_put;
+ c->idct_add= ff_jref_idct4_add;
+ c->idct = j_rev_dct4;
c->idct_permutation_type= FF_NO_IDCT_PERM;
+ }else{
+ if(avctx->idct_algo==FF_IDCT_INT){
+ c->idct_put= ff_jref_idct_put;
+ c->idct_add= ff_jref_idct_add;
+ c->idct = j_rev_dct;
+ c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
+ }else{ //accurate/default
+ c->idct_put= simple_idct_put;
+ c->idct_add= simple_idct_add;
+ c->idct = simple_idct;
+ c->idct_permutation_type= FF_NO_IDCT_PERM;
+ }
}
/* VP3 DSP support */