]> git.sesse.net Git - vlc/commitdiff
We now have support for the field pictures. It shouldn't break teh frame
authorSam Hocevar <sam@videolan.org>
Wed, 23 Aug 2000 21:38:50 +0000 (21:38 +0000)
committerSam Hocevar <sam@videolan.org>
Wed, 23 Aug 2000 21:38:50 +0000 (21:38 +0000)
pictures, if you notice anything please ring my bell.

--Meuuh (live from Julie)

.cvsignore
ChangeLog
src/video_decoder/vdec_motion.c
src/video_parser/vpar_blocks.c
src/video_parser/vpar_headers.c

index e3d372a65de77623a6268220046af1bb44b1d130..b60650dca33b50019d4cb44f9be2d4c30f022102 100644 (file)
@@ -11,3 +11,5 @@ config.cache
 config.status
 Makefile
 build-stamp
+gvlc
+fbvlc
index 90e0fa2fbd32b288741d72eea1e579d3c03d898f..a82a2921e2a61d4f70b8b1611e1f50dc092b92cd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+O.1.99i :
+
+  * fixed the support for the field pictures, which involved a few dozens
+    bugs in the video parser and video decoder
+
 Tue, 22 Aug 2000 01:31:58 +0200
 0.1.99h :
 
index 2d859f25200065d25ed0e47e73e85969c1b49a00..483abc34dcd8b7a736c15cc1959aec5fb4615f0a 100644 (file)
@@ -175,12 +175,12 @@ static __inline__ void Motion420(
 
     i_source_offset = (p_mb->i_l_x + (i_mv_x >> 1))
                        + (p_mb->i_motion_l_y + i_offset
-                         + (i_mv_y >> 1)
                          + b_source_field)
-                         * p_mb->p_picture->i_width;
+                       * p_mb->p_picture->i_width
+                       + (i_mv_y >> 1) * p_mb->i_l_stride;
     if( i_source_offset >= p_source->i_width * p_source->i_height )
     {
-        intf_ErrMsg( "vdec error: bad motion vector\n" );
+        intf_ErrMsg( "vdec error: bad motion vector (lum)\n" );
         return;
     }
 
@@ -201,13 +201,13 @@ static __inline__ void Motion420(
                      b_average );
 
     i_source_offset = (p_mb->i_c_x + ((i_mv_x/2) >> 1))
-                        + ((p_mb->i_motion_c_y + (i_offset >> 1)
-                           + ((i_mv_y/2) >> 1))
+                        + (p_mb->i_motion_c_y + (i_offset >> 1)
                            + b_source_field)
-                          * p_mb->p_picture->i_chroma_width;
+                          * p_mb->p_picture->i_chroma_width
+                        + ((i_mv_y/2) >> 1) * p_mb->i_c_stride;
     if( i_source_offset >= (p_source->i_width * p_source->i_height) / 4 )
     {
-        intf_ErrMsg( "vdec error: bad motion vector\n" );
+        intf_ErrMsg( "vdec error: bad motion vector (chroma)\n" );
         return;
     }
 
@@ -264,9 +264,9 @@ static __inline__ void Motion422(
                      p_source->p_y
                        + (p_mb->i_l_x + (i_mv_x >> 1))
                        + (p_mb->i_motion_l_y + i_offset
-                          + (i_mv_y >> 1)
                           + b_source_field)
-                         * p_mb->p_picture->i_width,
+                      * p_mb->p_picture->i_width
+                       + (i_mv_y >> 1) * p_mb->i_l_stride,
                      /* destination */
                      p_mb->p_picture->p_y
                        + (p_mb->i_l_x)
@@ -281,10 +281,10 @@ static __inline__ void Motion422(
                      b_average );
 
     i_source_offset = (p_mb->i_c_x + ((i_mv_x/2) >> 1))
-                        + ((p_mb->i_motion_c_y + (i_offset)
-                           + ((i_mv_y) >> 1))
+                        + (p_mb->i_motion_c_y + i_offset
                            + b_source_field)
-                          * p_mb->p_picture->i_chroma_width;
+                        * p_mb->p_picture->i_chroma_width
+                        + (i_mv_y) >> 1) * p_mb->i_c_stride;
     i_dest_offset = (p_mb->i_c_x)
                       + (p_mb->i_motion_c_y + b_dest_field)
                         * p_mb->p_picture->i_chroma_width;
@@ -335,9 +335,9 @@ static __inline__ void Motion444(
 
     i_source_offset = (p_mb->i_l_x + (i_mv_x >> 1))
                         + (p_mb->i_motion_l_y + i_offset
-                           + (i_mv_y >> 1)
                            + b_source_field)
-                          * p_mb->p_picture->i_width;
+                        * p_mb->p_picture->i_width
+                        + (i_mv_y >> 1) * p_mb->i_l_stride;
     i_dest_offset = (p_mb->i_l_x)
                       + (p_mb->i_motion_l_y + b_dest_field)
                         * p_mb->p_picture->i_width;
@@ -374,6 +374,7 @@ static __inline__ void Motion444(
  * vdec_MotionFieldField : motion compensation for field motion type (field)
  *****************************************************************************/
 #define FIELDFIELD( MOTION )                                            \
+{                                                                       \
     picture_t *     p_pred;                                             \
                                                                         \
     if( p_mb->i_mb_type & MB_MOTION_FORWARD )                           \
@@ -398,6 +399,7 @@ static __inline__ void Motion444(
                     p_mb->pppi_motion_vectors[0][1][0],                 \
                     p_mb->pppi_motion_vectors[0][1][1],                 \
                     p_mb->i_l_stride, p_mb->i_c_stride, 16, 0, 1 );     \
+        }                                                               \
     }                                                                   \
                                                                         \
     else /* MB_MOTION_BACKWARD */                                       \
@@ -508,7 +510,7 @@ void vdec_MotionField16x8444( macroblock_t * p_mb )
 }
 
 /*****************************************************************************
- * vdec_MotionFieldDMVXXX?? : motion compensation for dmv motion type (field)
+ * vdec_MotionFieldDMVXXX : motion compensation for dmv motion type (field)
  *****************************************************************************/
 #define FIELDDMV( MOTION )                                              \
 {                                                                       \
index 15fe340bda6e6ed22a643f59d342ad37959bf44b..2bbc38c0adb591fb35ead4b672e7754736a2e3c0 100644 (file)
@@ -54,8 +54,6 @@
 #include "video_parser.h"
 #include "video_fifo.h"
 
-static int i_count = 0;
-
 /*
  * Welcome to vpar_blocks.c ! Here's where the heavy processor-critical parsing
  * task is done. This file is divided in several parts :
@@ -1705,7 +1703,7 @@ if( p_vpar->picture.b_error )                                           \
             /* Calculate block coordinates. */                          \
             p_mb->p_data[i_b] = p_data1                                 \
                                 + pi_y[p_vpar->mb.b_dct_type][i_b]      \
-                                * p_vpar->sequence.i_width              \
+                                * p_vpar->picture.i_l_stride            \
                                 + pi_x[i_b];                            \
                                                                         \
             PARSEERROR                                                  \
@@ -1738,7 +1736,7 @@ if( p_vpar->picture.b_error )                                           \
             /* Calculate block coordinates. */                          \
             p_mb->p_data[i_b] = pp_data[i_b & 1]                        \
                                  + pi_y[p_vpar->mb.b_dct_type][i_b]     \
-                                   * p_vpar->sequence.i_chroma_width    \
+                                   * p_vpar->picture.i_c_stride         \
                                  + pi_x[i_b];                           \
                                                                         \
             PARSEERROR                                                  \
@@ -1791,8 +1789,6 @@ static __inline__ void ParseMacroblock(
     yuv_data_t *    p_data1;
     yuv_data_t *    p_data2;
 
-i_count++;
-
     i_inc = MacroblockAddressIncrement( p_vpar );
     *pi_mb_address += i_inc;
 
@@ -2217,16 +2213,15 @@ static __inline__ void SliceHeader( vpar_thread_t * p_vpar,
         else
         {
             /* Try to find an optimized function. */
-            if( ppf_parse_mb[p_vpar->picture.i_structure]
+            if( ppf_parse_mb[i_structure]
                             [p_vpar->picture.i_coding_type] == NULL )
             {
                 intf_ErrMsg( "vpar error: bad ppf_parse_mb function pointer (struct:%d, coding type:%d)\n",
-                         p_vpar->picture.i_structure, p_vpar->picture.i_coding_type );
+                         i_structure, i_coding_type );
             }
             else
             {
-                ppf_parse_mb[p_vpar->picture.i_structure]
-                            [p_vpar->picture.i_coding_type]
+                ppf_parse_mb[i_structure][i_coding_type]
                        ( p_vpar, pi_mb_address, i_mb_address_save,
                          i_mb_base, b_mpeg2, i_coding_type,
                          i_chroma_format, i_structure,
@@ -2256,7 +2251,8 @@ void vpar_PictureData( vpar_thread_t * p_vpar, int i_mb_base )
     while( ((p_vpar->picture.i_coding_type != I_CODING_TYPE
                     && p_vpar->picture.i_coding_type != D_CODING_TYPE)
              || !p_vpar->picture.b_error)
-           && i_mb_address+i_mb_base < p_vpar->sequence.i_mb_size
+           && i_mb_address < (p_vpar->sequence.i_mb_size
+                    >> (p_vpar->picture.i_structure != FRAME_STRUCTURE))
            && !p_vpar->b_die )
     {
         if( ((i_dummy = ShowBits( &p_vpar->bit_stream, 32 ))
index 1859f528396624e316f12f4f577824d695cc2dfb..d38e270c4c2c8192dcee0dfd548213683bde66a5 100644 (file)
@@ -639,7 +639,17 @@ static void PictureHeader( vpar_thread_t * p_vpar )
 #endif
         /* Update context. */
         if( i_structure != FRAME_STRUCTURE )
-            p_vpar->picture.i_current_structure = i_structure;
+        {
+            if( (p_vpar->picture.i_current_structure | i_structure)
+                    == FRAME_STRUCTURE )
+            {
+                p_vpar->picture.i_current_structure = 0;
+            }
+            else
+            {
+                p_vpar->picture.i_current_structure = i_structure;
+            }
+        }
         p_vpar->picture.p_picture = NULL;
 
         return;