Commit | Line | Data |
---|---|---|
72b9787e JB |
1 | /***************************************************************************** |
2 | * Copyright (C) 2013 x265 project | |
3 | * | |
4 | * Authors: Praveen Kumar Tiwari <praveen@multicorewareinc.com> | |
5 | * Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com> | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation; either version 2 of the License, or | |
10 | * (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with this program; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. | |
20 | * | |
21 | * This program is also available under a commercial proprietary license. | |
22 | * For more information, contact us at license @ x265.com. | |
23 | *****************************************************************************/ | |
24 | ||
25 | #include "common.h" | |
26 | #include "primitives.h" | |
27 | ||
28 | #define PIXEL_MIN 0 | |
29 | #define PIXEL_MAX ((1 << X265_DEPTH) - 1) | |
30 | ||
31 | void processSaoCUE0(pixel * rec, int8_t * offsetEo, int width, int8_t signLeft) | |
32 | { | |
33 | int x; | |
34 | int8_t signRight; | |
35 | int8_t edgeType; | |
36 | ||
37 | for (x = 0; x < width; x++) | |
38 | { | |
39 | signRight = ((rec[x] - rec[x + 1]) < 0) ? -1 : ((rec[x] - rec[x + 1]) > 0) ? 1 : 0; | |
40 | edgeType = signRight + signLeft + 2; | |
41 | signLeft = -signRight; | |
42 | ||
43 | short v = rec[x] + offsetEo[edgeType]; | |
44 | rec[x] = (pixel)(v < 0 ? 0 : (v > (PIXEL_MAX)) ? (PIXEL_MAX) : v); | |
45 | } | |
46 | } | |
47 | ||
48 | namespace x265 { | |
49 | void Setup_C_LoopFilterPrimitives(EncoderPrimitives &p) | |
50 | { | |
51 | p.saoCuOrgE0 = processSaoCUE0; | |
52 | } | |
53 | } |