1 |
/****************************************************************************** |
/***************************************************************************** |
2 |
* * |
* |
3 |
* This file is part of XviD, a free MPEG-4 video encoder/decoder * |
* XVID MPEG-4 VIDEO CODEC |
4 |
* * |
* - Prediction functions - |
5 |
* XviD is an implementation of a part of one or more MPEG-4 Video tools * |
* |
6 |
* as specified in ISO/IEC 14496-2 standard. Those intending to use this * |
* Copyright(C) 2001-2002 - Michael Militzer <isibaar@xvid.org> |
7 |
* software module in hardware or software products are advised that its * |
* Copyright(C) 2001-2002 - Peter Ross <pross@cs.rmit.edu.au> |
8 |
* use may infringe existing patents or copyrights, and any such use * |
* |
9 |
* would be at such party's own risk. The original developer of this * |
* This program is an implementation of a part of one or more MPEG-4 |
10 |
* software module and his/her company, and subsequent editors and their * |
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
11 |
* companies, will have no liability for use of this software or * |
* to use this software module in hardware or software products are |
12 |
* modifications or derivatives thereof. * |
* advised that its use may infringe existing patents or copyrights, and |
13 |
* * |
* any such use would be at such party's own risk. The original |
14 |
* XviD is free software; you can redistribute it and/or modify it * |
* developer of this software module and his/her company, and subsequent |
15 |
* under the terms of the GNU General Public License as published by * |
* editors and their companies, will have no liability for use of this |
16 |
* the Free Software Foundation; either version 2 of the License, or * |
* software or modifications or derivatives thereof. |
17 |
* (at your option) any later version. * |
* |
18 |
* * |
* This program is free software; you can redistribute it and/or modify |
19 |
* XviD is distributed in the hope that it will be useful, but * |
* it under the terms of the GNU General Public License as published by |
20 |
* WITHOUT ANY WARRANTY; without even the implied warranty of * |
* the Free Software Foundation; either version 2 of the License, or |
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* (at your option) any later version. |
22 |
* GNU General Public License for more details. * |
* |
23 |
* * |
* This program is distributed in the hope that it will be useful, |
24 |
* You should have received a copy of the GNU General Public License * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
25 |
* along with this program; if not, write to the Free Software * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
26 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * |
* GNU General Public License for more details. |
27 |
* * |
* |
28 |
******************************************************************************/ |
* You should have received a copy of the GNU General Public License |
29 |
|
* along with this program; if not, write to the Free Software |
30 |
/****************************************************************************** |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
31 |
* * |
* |
32 |
* mbprediction.c * |
* $Id: mbprediction.c,v 1.8 2002-09-07 13:43:00 edgomez Exp $ |
33 |
* * |
* |
34 |
* Copyright (C) 2001 - Michael Militzer <isibaar@xvid.org> * |
****************************************************************************/ |
|
* Copyright (C) 2001 - Peter Ross <pross@cs.rmit.edu.au> * |
|
|
* * |
|
|
* For more information visit the XviD homepage: http://www.xvid.org * |
|
|
* * |
|
|
******************************************************************************/ |
|
|
|
|
|
/****************************************************************************** |
|
|
* * |
|
|
* Revision history: * |
|
|
* * |
|
|
* 29.06.2002 predict_acdc() bounding * |
|
|
* 12.12.2001 improved calc_acdc_prediction; removed need for memcpy * |
|
|
* 15.12.2001 moved pmv displacement to motion estimation * |
|
|
* 30.11.2001 mmx cbp support * |
|
|
* 17.11.2001 initial version * |
|
|
* * |
|
|
******************************************************************************/ |
|
35 |
|
|
36 |
#include "../encoder.h" |
#include "../encoder.h" |
37 |
#include "mbprediction.h" |
#include "mbprediction.h" |
43 |
#define DIV_DIV(A,B) ( (A) > 0 ? ((A)+((B)>>1))/(B) : ((A)-((B)>>1))/(B) ) |
#define DIV_DIV(A,B) ( (A) > 0 ? ((A)+((B)>>1))/(B) : ((A)-((B)>>1))/(B) ) |
44 |
|
|
45 |
|
|
46 |
|
/***************************************************************************** |
47 |
|
* Local inlined function |
48 |
|
****************************************************************************/ |
49 |
|
|
50 |
static int __inline |
static int __inline |
51 |
rescale(int predict_quant, |
rescale(int predict_quant, |
52 |
int current_quant, |
int current_quant, |
57 |
} |
} |
58 |
|
|
59 |
|
|
60 |
|
/***************************************************************************** |
61 |
|
* Local data |
62 |
|
****************************************************************************/ |
63 |
|
|
64 |
static const int16_t default_acdc_values[15] = { |
static const int16_t default_acdc_values[15] = { |
65 |
1024, |
1024, |
66 |
0, 0, 0, 0, 0, 0, 0, |
0, 0, 0, 0, 0, 0, 0, |
68 |
}; |
}; |
69 |
|
|
70 |
|
|
71 |
|
/***************************************************************************** |
72 |
|
* Functions |
73 |
|
****************************************************************************/ |
74 |
|
|
75 |
|
|
76 |
/* get dc/ac prediction direction for a single block and place |
/* get dc/ac prediction direction for a single block and place |
77 |
predictor values into MB->pred_values[j][..] |
predictor values into MB->pred_values[j][..] |
78 |
*/ |
*/ |