aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/dsputil.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-07 02:57:53 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-03-07 03:22:49 +0100
commit6df42f98746be06c883ce683563e07c9a2af983f (patch)
tree6bb893aaf179526515cfb3b1cc933721317dcf6f /libavcodec/dsputil.c
parent57986c501e8c97d4bd2e1b7ce9e9037c4ae06245 (diff)
parentb5161908e06b4497bf663510fb495ba97a6fd2b5 (diff)
downloadffmpeg-6df42f98746be06c883ce683563e07c9a2af983f.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: SBR DSP: fix SSE code to not use SSE2 instructions. cpu: initialize mask to -1, so that by default, optimizations are used. error_resilience: initialize s->block_index[]. svq3: protect against negative quantizers. Don't use ff_cropTbl[] for IDCT. swscale: make filterPos 32bit. FATE: add CPUFLAGS variable, mapping to -cpuflags avconv option. avconv: add -cpuflags option for setting supported cpuflags. cpu: add av_set_cpu_flags_mask(). libx264: Allow overriding the sliced threads option avconv: fix counting encoded video size. Conflicts: doc/APIchanges doc/fate.texi doc/ffmpeg.texi ffmpeg.c libavcodec/h264idct_template.c libavcodec/svq3.c libavutil/avutil.h libavutil/cpu.c libavutil/cpu.h libswscale/swscale.c tests/Makefile tests/fate-run.sh tests/regression-funcs.sh Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dsputil.c')
-rw-r--r--libavcodec/dsputil.c70
1 files changed, 30 insertions, 40 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 9821703d37..7379fa2e73 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -367,18 +367,17 @@ void ff_put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
int line_size)
{
int i;
- uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
/* read the pixels */
for(i=0;i<8;i++) {
- pixels[0] = cm[block[0]];
- pixels[1] = cm[block[1]];
- pixels[2] = cm[block[2]];
- pixels[3] = cm[block[3]];
- pixels[4] = cm[block[4]];
- pixels[5] = cm[block[5]];
- pixels[6] = cm[block[6]];
- pixels[7] = cm[block[7]];
+ pixels[0] = av_clip_uint8(block[0]);
+ pixels[1] = av_clip_uint8(block[1]);
+ pixels[2] = av_clip_uint8(block[2]);
+ pixels[3] = av_clip_uint8(block[3]);
+ pixels[4] = av_clip_uint8(block[4]);
+ pixels[5] = av_clip_uint8(block[5]);
+ pixels[6] = av_clip_uint8(block[6]);
+ pixels[7] = av_clip_uint8(block[7]);
pixels += line_size;
block += 8;
@@ -389,14 +388,13 @@ static void put_pixels_clamped4_c(const DCTELEM *block, uint8_t *restrict pixels
int line_size)
{
int i;
- uint8_t *cm = ff_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[0] = av_clip_uint8(block[0]);
+ pixels[1] = av_clip_uint8(block[1]);
+ pixels[2] = av_clip_uint8(block[2]);
+ pixels[3] = av_clip_uint8(block[3]);
pixels += line_size;
block += 8;
@@ -407,12 +405,11 @@ static void put_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels
int line_size)
{
int i;
- uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
/* read the pixels */
for(i=0;i<2;i++) {
- pixels[0] = cm[block[0]];
- pixels[1] = cm[block[1]];
+ pixels[0] = av_clip_uint8(block[0]);
+ pixels[1] = av_clip_uint8(block[1]);
pixels += line_size;
block += 8;
@@ -444,18 +441,17 @@ void ff_add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
int line_size)
{
int i;
- uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
/* read the pixels */
for(i=0;i<8;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[4] = cm[pixels[4] + block[4]];
- pixels[5] = cm[pixels[5] + block[5]];
- pixels[6] = cm[pixels[6] + block[6]];
- pixels[7] = cm[pixels[7] + block[7]];
+ pixels[0] = av_clip_uint8(pixels[0] + block[0]);
+ pixels[1] = av_clip_uint8(pixels[1] + block[1]);
+ pixels[2] = av_clip_uint8(pixels[2] + block[2]);
+ pixels[3] = av_clip_uint8(pixels[3] + block[3]);
+ pixels[4] = av_clip_uint8(pixels[4] + block[4]);
+ pixels[5] = av_clip_uint8(pixels[5] + block[5]);
+ pixels[6] = av_clip_uint8(pixels[6] + block[6]);
+ pixels[7] = av_clip_uint8(pixels[7] + block[7]);
pixels += line_size;
block += 8;
}
@@ -465,14 +461,13 @@ static void add_pixels_clamped4_c(const DCTELEM *block, uint8_t *restrict pixels
int line_size)
{
int i;
- uint8_t *cm = ff_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[0] = av_clip_uint8(pixels[0] + block[0]);
+ pixels[1] = av_clip_uint8(pixels[1] + block[1]);
+ pixels[2] = av_clip_uint8(pixels[2] + block[2]);
+ pixels[3] = av_clip_uint8(pixels[3] + block[3]);
pixels += line_size;
block += 8;
}
@@ -482,12 +477,11 @@ static void add_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels
int line_size)
{
int i;
- uint8_t *cm = ff_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[0] = av_clip_uint8(pixels[0] + block[0]);
+ pixels[1] = av_clip_uint8(pixels[1] + block[1]);
pixels += line_size;
block += 8;
}
@@ -2779,15 +2773,11 @@ static void ff_jref_idct2_add(uint8_t *dest, int line_size, DCTELEM *block)
static void ff_jref_idct1_put(uint8_t *dest, int line_size, DCTELEM *block)
{
- uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
- dest[0] = cm[(block[0] + 4)>>3];
+ dest[0] = av_clip_uint8((block[0] + 4)>>3);
}
static void ff_jref_idct1_add(uint8_t *dest, int line_size, DCTELEM *block)
{
- uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
- dest[0] = cm[dest[0] + ((block[0] + 4)>>3)];
+ dest[0] = av_clip_uint8(dest[0] + ((block[0] + 4)>>3));
}
static void just_return(void *mem av_unused, int stride av_unused, int h av_unused) { return; }