-}
-
-/*****************************************************************************
- * YuvSepia2: Calculates sepia to YUV values for two given Y values
- *****************************************************************************
- * This function calculates sepia values of YUV color space for a given sepia
- * intensity. It converts YUV color values to theirs RGB equivalents,
- * calculates sepia values and then converts RGB values to YUV values again.
- *****************************************************************************/
-static void YuvSepia2( uint8_t* sepia_y1, uint8_t* sepia_y2, uint8_t* sepia_u,
- uint8_t* sepia_v, const uint8_t y1, const uint8_t y2,
- const uint8_t u, const uint8_t v, int i_intensity )
-{
- int r1, g1, b1; /* for y1 new value */
- int r2, b2, g2; /* for y2 new value */
- int r3, g3, b3; /* for new values of u and v */
- /* fist convert YUV -> RGB */
- yuv_to_rgb( &r1, &g1, &b1, y1, u, v );
- yuv_to_rgb( &r2, &g2, &b2, y2, u, v );
- yuv_to_rgb( &r3, &g3, &b3, ( y1 + y2 ) / 2, u, v );
- /* calculates new values for r, g and b components */
- Sepia( &r1, &g1, &b1, i_intensity );
- Sepia( &r2, &g2, &b2, i_intensity );
- Sepia( &r3, &g3, &b3, i_intensity );
- /* convert from calculated RGB -> YUV */
- *sepia_y1 = ( ( 66 * r1 + 129 * g1 + 25 * b1 + 128 ) >> 8 ) + 16;
- *sepia_y2 = ( ( 66 * r2 + 129 * g2 + 25 * b2 + 128 ) >> 8 ) + 16;
- *sepia_u = ( ( -38 * r3 - 74 * g3 + 112 * b3 + 128 ) >> 8 ) + 128;
- *sepia_v = ( ( 112 * r3 - 94 * g3 - 18 * b3 + 128 ) >> 8 ) + 128;
-}
-
-/*****************************************************************************
- * YuvSepia4: Calculates sepia to YUV values for given four Y values
- *****************************************************************************
- * This function calculates sepia values of YUV color space for a given sepia
- * intensity. It converts YUV color values to theirs RGB equivalents,
- * calculates sepia values and then converts RGB values to YUV values again.
- *****************************************************************************/
-static void YuvSepia4( uint8_t* sepia_y1, uint8_t* sepia_y2, uint8_t* sepia_y3,
- uint8_t* sepia_y4, uint8_t* sepia_u, uint8_t* sepia_v,
- const uint8_t y1, const uint8_t y2, const uint8_t y3,
- const uint8_t y4, const uint8_t u, uint8_t v,
- int i_intensity )
-{
- int r1, g1, b1; /* for y1 new value */
- int r2, b2, g2; /* for y2 new value */
- int r3, b3, g3; /* for y3 new value */
- int r4, b4, g4; /* for y4 new value */
- int r5, g5, b5; /* for new values of u and v */
- /* fist convert YUV -> RGB */
- yuv_to_rgb( &r1, &g1, &b1, y1, u, v );
- yuv_to_rgb( &r2, &g2, &b2, y2, u, v );
- yuv_to_rgb( &r3, &g3, &b3, y3, u, v );
- yuv_to_rgb( &r4, &g4, &b4, y4, u, v );
- yuv_to_rgb( &r5, &g5, &b5, ( y1 + y2 + y3 + y4) / 4, u, v );
- /* calculates new values for r, g and b components */
- Sepia( &r1, &g1, &b1, i_intensity );
- Sepia( &r2, &g2, &b2, i_intensity );
- Sepia( &r3, &g3, &b3, i_intensity );
- Sepia( &r4, &g4, &b4, i_intensity );
- Sepia( &r5, &g5, &b5, i_intensity );
- /* convert from calculated RGB -> YUV */
- *sepia_y1 = ( ( 66 * r1 + 129 * g1 + 25 * b1 + 128 ) >> 8 ) + 16;
- *sepia_y2 = ( ( 66 * r2 + 129 * g2 + 25 * b2 + 128 ) >> 8 ) + 16;
- *sepia_y3 = ( ( 66 * r3 + 129 * g3 + 25 * b3 + 128 ) >> 8 ) + 16;
- *sepia_y4 = ( ( 66 * r4 + 129 * g4 + 25 * b4 + 128 ) >> 8 ) + 16;
- *sepia_u = ( ( -38 * r5 - 74 * g5 + 112 * b5 + 128 ) >> 8 ) + 128;
- *sepia_v = ( ( 112 * r5 - 94 * g5 - 18 * b5 + 128 ) >> 8 ) + 128;
-}
-
-/*****************************************************************************
- * Sepia: Calculates sepia of RGB values
- *****************************************************************************
- * This function calculates sepia values of RGB color space for a given sepia
- * intensity. Sepia algorithm is taken from here:
- * http://groups.google.com/group/comp.lang.java.programmer/browse_thread/
- * thread/9d20a72c40b119d0/18f12770ec6d9dd6
- *****************************************************************************/
-static void Sepia( int *p_r, int *p_g, int *p_b, int i_intensity )
-{
- int i_sepia_depth = 20;
- int16_t i_round;
- i_round = ( *p_r + *p_g + *p_b ) / 3;
- *p_r = vlc_uint8( i_round + ( i_sepia_depth * 2 ) );
- *p_g = vlc_uint8( i_round + i_sepia_depth );
- *p_b = vlc_uint8( i_round - i_intensity );