1 /*****************************************************************************
2 * Copyright (C) 2013 x265 project
4 * Authors: Praveen Kumar Tiwari <praveen@multicorewareinc.com>
5 * Dnyaneshwar Gorade <dnyaneshwar@multicorewareinc.com>
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.
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.
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.
21 * This program is also available under a commercial proprietary license.
22 * For more information, contact us at license @ x265.com.
23 *****************************************************************************/
26 #include "primitives.h"
29 #define PIXEL_MAX ((1 << X265_DEPTH) - 1)
31 void processSaoCUE0(pixel
* rec
, int8_t * offsetEo
, int width
, int8_t signLeft
)
37 for (x
= 0; x
< width
; x
++)
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
;
43 short v
= rec
[x
] + offsetEo
[edgeType
];
44 rec
[x
] = (pixel
)(v
< 0 ? 0 : (v
> (PIXEL_MAX
)) ? (PIXEL_MAX
) : v
);
49 void Setup_C_LoopFilterPrimitives(EncoderPrimitives
&p
)
51 p
.saoCuOrgE0
= processSaoCUE0
;