aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-06-11 21:12:46 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-06-11 21:12:46 +0000
commitdbc56b3914cc70e763e902c382065ab09ee6bf1f (patch)
treeafc6e78fdbedab514ebd8df76cf2ec5294f5864e /libavcodec
parentffdff4d7e8baa6769e099c37bec20438ac7f5889 (diff)
downloadffmpeg-dbc56b3914cc70e763e902c382065ab09ee6bf1f.tar.gz
chroma me fix
Originally committed as revision 3216 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dsputil.h4
-rw-r--r--libavcodec/motion_est.c24
2 files changed, 23 insertions, 5 deletions
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index be53279797..a6642f7a05 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -204,7 +204,7 @@ typedef struct DSPContext {
* @param line_size number of bytes in a horizontal line of block
* @param h height
*/
- op_pixels_func put_no_rnd_pixels_tab[2][4];
+ op_pixels_func put_no_rnd_pixels_tab[4][4];
/**
* Halfpel motion compensation with no rounding (a+b)>>1.
@@ -216,7 +216,7 @@ typedef struct DSPContext {
* @param line_size number of bytes in a horizontal line of block
* @param h height
*/
- op_pixels_func avg_no_rnd_pixels_tab[2][4];
+ op_pixels_func avg_no_rnd_pixels_tab[4][4];
void (*put_no_rnd_pixels_l2[2])(uint8_t *block/*align width (8 or 16)*/, const uint8_t *a/*align 1*/, const uint8_t *b/*align 1*/, int line_size, int h);
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index 31250a476a..13f7deb8d8 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -238,6 +238,13 @@ static inline int get_penalty_factor(MpegEncContext *s, int type){
}
}
+static int zero_cmp(void *s, uint8_t *a, uint8_t *b, int stride, int h){
+ return 0;
+}
+
+static void zero_hpel(uint8_t *a, const uint8_t *b, int stride, int h){
+}
+
void ff_init_me(MpegEncContext *s){
MotionEstContext * const c= &s->me;
c->avctx= s->avctx;
@@ -266,10 +273,11 @@ void ff_init_me(MpegEncContext *s){
c->sub_motion_search= sad_hpel_motion_search; // 2050 vs. 2450 cycles
else
c->sub_motion_search= hpel_motion_search;
- c->hpel_avg= s->dsp.avg_pixels_tab;
- if(s->no_rounding) c->hpel_put= s->dsp.put_no_rnd_pixels_tab;
- else c->hpel_put= s->dsp.put_pixels_tab;
}
+ c->hpel_avg= s->dsp.avg_pixels_tab;
+ if(s->no_rounding) c->hpel_put= s->dsp.put_no_rnd_pixels_tab;
+ else c->hpel_put= s->dsp.put_pixels_tab;
+
if(s->linesize){
c->stride = s->linesize;
c->uvstride= s->uvlinesize;
@@ -278,6 +286,16 @@ void ff_init_me(MpegEncContext *s){
c->uvstride= 8*s->mb_width + 16;
}
+ // 8x8 fullpel search would need a 4x4 chroma compare, which we dont have yet, and even if we had the motion estimation code doesnt expect it
+ if((c->avctx->me_cmp&FF_CMP_CHROMA) && !s->dsp.me_cmp[2]){
+ s->dsp.me_cmp[2]= zero_cmp;
+ }
+ if((c->avctx->me_sub_cmp&FF_CMP_CHROMA) && !s->dsp.me_sub_cmp[2]){
+ s->dsp.me_sub_cmp[2]= zero_cmp;
+ }
+ c->hpel_put[2][0]= c->hpel_put[2][1]=
+ c->hpel_put[2][2]= c->hpel_put[2][3]= zero_hpel;
+
c->temp= c->scratchpad;
}