1 |
|
/***************************************************************************** |
2 |
|
* |
3 |
|
* XVID MPEG-4 VIDEO CODEC |
4 |
|
* - XviD plugin: performs a lumimasking algorithm on encoded frame - |
5 |
|
* |
6 |
|
* Copyright(C) 2002-2003 Peter Ross <pross@xvid.org> |
7 |
|
* 2002 Christoph Lampert <gruel@web.de> |
8 |
|
* |
9 |
|
* This program is free software ; you can redistribute it and/or modify |
10 |
|
* it under the terms of the GNU General Public License as published by |
11 |
|
* the Free Software Foundation ; either version 2 of the License, or |
12 |
|
* (at your option) any later version. |
13 |
|
* |
14 |
|
* This program is distributed in the hope that it will be useful, |
15 |
|
* but WITHOUT ANY WARRANTY ; without even the implied warranty of |
16 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 |
|
* GNU General Public License for more details. |
18 |
|
* |
19 |
|
* You should have received a copy of the GNU General Public License |
20 |
|
* along with this program ; if not, write to the Free Software |
21 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 |
|
* |
23 |
|
* $Id$ |
24 |
|
* |
25 |
|
****************************************************************************/ |
26 |
|
|
27 |
|
#include "../xvid.h" |
28 |
|
#include "../image/image.h" |
29 |
|
#include "../quant/adapt_quant.h" |
30 |
|
|
31 |
|
int xvid_plugin_lumimasking(void * handle, int opt, void * param1, void * param2) |
32 |
|
{ |
33 |
|
switch(opt) |
34 |
|
{ |
35 |
|
case XVID_PLG_INFO : |
36 |
|
{ |
37 |
|
xvid_plg_info_t * info = (xvid_plg_info_t*)param1; |
38 |
|
info->flags = XVID_REQDQUANTS; |
39 |
|
return 0; |
40 |
|
} |
41 |
|
|
42 |
|
case XVID_PLG_CREATE : |
43 |
|
case XVID_PLG_DESTROY : |
44 |
|
return 0; |
45 |
|
|
46 |
|
|
47 |
|
case XVID_PLG_BEFORE : |
48 |
|
{ |
49 |
|
xvid_plg_data_t * data = (xvid_plg_data_t*)param1; |
50 |
|
data->quant = |
51 |
|
adaptive_quantization(data->current.plane[0], data->current.stride[0], |
52 |
|
data->dquant, |
53 |
|
data->quant /* framequant*/, |
54 |
|
data->quant /* min_quant */, |
55 |
|
data->quant*2 /* max_quant */, |
56 |
|
data->mb_width, data->mb_height); |
57 |
|
|
58 |
|
return 0; |
59 |
|
} |
60 |
|
|
61 |
|
case XVID_PLG_AFTER : |
62 |
|
return 0; |
63 |
|
} |
64 |
|
|
65 |
|
return XVID_ERR_FAIL; |
66 |
|
} |