]> git.sesse.net Git - vlc/blobdiff - src/video_output/video_yuv.c
. nouveaux plugins - ne fonctionnent pas encore tous
[vlc] / src / video_output / video_yuv.c
index 98ef79575593863fb49ea069617298e4bc0a5fc0..2c3bc260427da5d22119db66316e960844707708 100644 (file)
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -72,6 +73,8 @@
 #define V_RED_COEF      ((int)(1.596 * (1<<SHIFT) / 1.164))
 #define V_GREEN_COEF    ((int)(-0.813 * (1<<SHIFT) / 1.164))
 
+//#define NODITHER
+
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
@@ -180,7 +183,7 @@ static void     ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data
         (((*p_y + dither10[i_real_y]) >> 4) << 7)                             \
         + ((*p_u + dither20[i_real_y])   >> 5) * 9                            \
         + ((*p_v + dither20[i_real_y])   >> 5) ];                             \
-    b_jump_uv += *p_offset;                                                   \
+    b_jump_uv = (b_jump_uv + *p_offset) & 0x1;                                \
     p_y += *p_offset;                                                         \
     p_u += *p_offset   & b_jump_uv;                                           \
     p_v += *p_offset++ & b_jump_uv;                                           \
@@ -188,7 +191,7 @@ static void     ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data
         (((*p_y + dither11[i_real_y]) >> 4) << 7)                             \
         + ((*p_u + dither21[i_real_y])   >> 5) * 9                            \
         + ((*p_v + dither21[i_real_y])   >> 5) ];                             \
-    b_jump_uv += *p_offset;                                                   \
+    b_jump_uv = (b_jump_uv + *p_offset) & 0x1;                                \
     p_y += *p_offset;                                                         \
     p_u += *p_offset   & b_jump_uv;                                           \
     p_v += *p_offset++ & b_jump_uv;                                           \
@@ -196,7 +199,7 @@ static void     ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data
         (((*p_y + dither12[i_real_y]) >> 4) << 7)                             \
         + ((*p_u + dither22[i_real_y])   >> 5) * 9                            \
         + ((*p_v + dither22[i_real_y])   >> 5) ];                             \
-    b_jump_uv += *p_offset;                                                   \
+    b_jump_uv = (b_jump_uv + *p_offset) & 0x1;                                \
     p_y += *p_offset;                                                         \
     p_u += *p_offset   & b_jump_uv;                                           \
     p_v += *p_offset++ & b_jump_uv;                                           \
@@ -204,7 +207,7 @@ static void     ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data
         (((*p_y + dither13[i_real_y]) >> 4) << 7)                             \
         + ((*p_u + dither23[i_real_y])   >> 5) * 9                            \
         + ((*p_v + dither23[i_real_y])   >> 5) ];                             \
-    b_jump_uv += *p_offset;                                                   \
+    b_jump_uv = (b_jump_uv + *p_offset) & 0x1;                                \
     p_y += *p_offset;                                                         \
     p_u += *p_offset   & b_jump_uv;                                           \
     p_v += *p_offset++ & b_jump_uv;                                           \
@@ -1092,6 +1095,17 @@ static void ConvertYUV420RGB8( p_vout_thread_t p_vout, u8 *p_pic, yuv_data_t *p_
     int *       p_offset_start;                        /* offset array start */
     int *       p_offset;                            /* offset array pointer */
 
+#ifdef NODITHER
+    int dither10[4] = {  0x7,  0x8,  0x7,  0x8 };
+    int dither11[4] = {  0x8,  0x7,  0x8,  0x7 };
+    int dither12[4] = {  0x7,  0x8,  0x7,  0x8 };
+    int dither13[4] = {  0x8,  0x7,  0x8,  0x7 };
+
+    int dither20[4] = {  0xf, 0x10,  0xf, 0x10 };
+    int dither21[4] = { 0x10,  0xf, 0x10,  0xf };
+    int dither22[4] = {  0xf, 0x10,  0xf, 0x10 };
+    int dither23[4] = { 0x10,  0xf, 0x10,  0xf };
+#else
     int dither10[4] = {  0x0,  0x8,  0x2,  0xa };
     int dither11[4] = {  0xc,  0x4,  0xe,  0x6 };
     int dither12[4] = {  0x3,  0xb,  0x1,  0x9 };
@@ -1101,17 +1115,18 @@ static void ConvertYUV420RGB8( p_vout_thread_t p_vout, u8 *p_pic, yuv_data_t *p_
     int dither21[4] = { 0x18,  0x8, 0x1c,  0xc };
     int dither22[4] = {  0x6, 0x16,  0x2, 0x12 };
     int dither23[4] = { 0x1e,  0xe, 0x1a,  0xa };
+#endif
 
-    #if 0
-    /* other matrices that can be interesting, either for debugging or for
-     * various effects */
-    int dither[4][4] = { { 0, 8, 2, 10 }, { 12, 4, 14, 16 }, { 3, 11, 1, 9}, {15, 7, 13, 5} };
-    int dither[4][4] = { { 7, 8, 0, 15 }, { 0, 15, 8, 7 }, { 7, 0, 15, 8 }, { 15, 7, 8, 0 } };
-    int dither[4][4] = { { 0, 15, 0, 15 }, { 15, 0, 15, 0 }, { 0, 15, 0, 15 }, { 15, 0, 15, 0 } };
-    int dither[4][4] = { { 15, 15, 0, 0 }, { 15, 15, 0, 0 }, { 0, 0, 15, 15 }, { 0, 0, 15, 15 } };
-    int dither[4][4] = { { 8, 8, 8, 8 }, { 8, 8, 8, 8 }, { 8, 8, 8, 8 }, { 8, 8, 8, 8 } };
-    int dither[4][4] = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 }, { 12, 13, 14, 15 } };
-    #endif
+    /* some other matrices that can be interesting, either for debugging
+     *  or for effects :
+     *  
+     * { { 0, 8, 2, 10 }, { 12, 4, 14, 16 }, { 3, 11, 1, 9}, {15, 7, 13, 5} }
+     * { { 7, 8, 0, 15 }, { 0, 15, 8, 7 }, { 7, 0, 15, 8 }, { 15, 7, 8, 0 } }
+     * { { 0, 15, 0, 15 }, { 15, 0, 15, 0 }, { 0, 15, 0, 15 }, { 15, 0, 15, 0 } }
+     * { { 15, 15, 0, 0 }, { 15, 15, 0, 0 }, { 0, 0, 15, 15 }, { 0, 0, 15, 15 } }
+     * { { 8, 8, 8, 8 }, { 8, 8, 8, 8 }, { 8, 8, 8, 8 }, { 8, 8, 8, 8 } }
+     * { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 }, { 12, 13, 14, 15 } }
+     */
 
     /*
      * Initialize some values  - i_pic_line_width will store the line skip