]> git.sesse.net Git - vlc/commitdiff
Pour la plus grande joie de tous, le client compile correctement. Attention
authorJean-Marc Dressler <polux@videolan.org>
Wed, 12 Jan 2000 22:38:34 +0000 (22:38 +0000)
committerJean-Marc Dressler <polux@videolan.org>
Wed, 12 Jan 2000 22:38:34 +0000 (22:38 +0000)
il compile non seulement avec l'ancien video decoder mais aussi avec le
nouveau. Pour passer de l'un a l'autre il faut changer le flag DECODER
du Makefile ET utiliser l'utilitaire new2old.sh gracieusement mis a votre
disposition par ptyx dans le module utils du CVS. Ce programme switche
quelques fichiers et permet dons de passer de l'ancien client au nouveau
et vis verca. Mais ATTENTION : IL NE FAUT PAS COMMITER LE CLIENT LORSQU'IL
EST EN CONFIGURATION NEW, avant de commiter il faut tout remettre en
configuration old.

14 files changed:
Makefile
include/vdec_idct.h
include/vdec_motion.h
include/video_decoder.h.new
include/vpar_blocks.h
src/input/input.c.new
src/input/input_ctrl.c.new
src/video_decoder/vdec_idct.c
src/video_decoder/vdec_motion.c
src/video_decoder/video_decoder.c
src/video_parser/video_fifo.c
src/video_parser/vpar_blocks.c
src/video_parser/vpar_motion.c
src/video_parser/vpar_synchro.c

index aa61e6c7741368fd5b2842683a51f3e82a3e71db..d10e6573b47ee27f248c9f811ce2add2bff9cae7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -25,6 +25,10 @@ VIDEO=FB
 ARCH=MMX
 #ARCH=PPC
 
+# Decoder choice - ?? old decoder will be removed soon
+DECODER=old
+#DECODER=new
+
 #----------------- do not change anything below this line ----------------------
 
 ################################################################################
@@ -174,6 +178,7 @@ audio_decoder_obj =         audio_decoder/audio_decoder.o \
 #??generic_decoder_obj =               generic_decoder/generic_decoder.o
 # remeber to add it to OBJ 
 
+ifeq ($(DECODER),old)
 video_decoder_obj =            video_decoder_ref/video_decoder.o \
                                                video_decoder_ref/display.o \
                                                video_decoder_ref/getblk.o \
@@ -184,19 +189,19 @@ video_decoder_obj =               video_decoder_ref/video_decoder.o \
                                                video_decoder_ref/motion.o \
                                                video_decoder_ref/mpeg2dec.o \
                                                video_decoder_ref/recon.o \
-                                               video_decoder_ref/spatscal.o 
-#                                              video_decoder_ref/$(TRANSFORM).o
-
-#video_parser_obj =            video_parser/video_parser.o \
-#                                              video_parser/vpar_headers.o \
-#                                              video_parser/vpar_blocks.o \
-#                                              video_parser/vpar_motion.o \
-#                                              video_parser/vpar_synchro.o \
-#                                              video_parser/video_fifo.o
-
-#video_decoder_obj =           video_decoder/video_decoder.o \
-#                                              video_decoder/vdec_idct.o \
-#                                              video_decoder/vdec_motion.o
+                                               video_decoder_ref/spatscal.o
+else
+video_parser_obj =             video_parser/video_parser.o \
+                                               video_parser/vpar_headers.o \
+                                               video_parser/vpar_blocks.o \
+                                               video_parser/vpar_motion.o \
+                                               video_parser/vpar_synchro.o \
+                                               video_parser/video_fifo.o
+
+video_decoder_obj =            video_decoder/video_decoder.o \
+                                               video_decoder/vdec_motion.o \
+                        video_decoder/$(TRANSFORM).o
+endif
 
 misc_obj =                     misc/mtime.o \
                                                misc/rsc_files.o \
index 75e61ce937443a2773cebdc5c163284ab270333d..fb1571cf4dce2e9f5320b277f393027b12f6366f 100644 (file)
@@ -34,16 +34,16 @@ struct vdec_thread_s;
  * shift" instructions that shift in copies of the sign bit.  But some
  * C compilers implement >> with an unsigned shift.  For these machines you
  * must define RIGHT_SHIFT_IS_UNSIGNED.
- * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
+ * RIGHT_SHIFT provides a proper signed right shift of an s32 quantity.
  * It is only applied with constant shift counts.  SHIFT_TEMPS must be
  * included in the variables of any routine using RIGHT_SHIFT.
  */
 
 #ifdef RIGHT_SHIFT_IS_UNSIGNED
-#define SHIFT_TEMPS INT32 shift_temp;
+#define SHIFT_TEMPS s32 shift_temp;
 #define RIGHT_SHIFT(x,shft)  \
     ((shift_temp = (x)) < 0 ? \
-     (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
+     (shift_temp >> (shft)) | ((~((s32) 0)) << (32-(shft))) : \
      (shift_temp >> (shft)))
 #else
 #define SHIFT_TEMPS
@@ -79,20 +79,22 @@ struct vdec_thread_s;
  * they are represented to better-than-integral precision.  These outputs
  * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word
  * with the recommended scaling.  (To scale up 12-bit sample data further, an
- * intermediate INT32 array would be needed.)
+ * intermediate s32 array would be needed.)
  *
  * To avoid overflow of the 32-bit intermediate results in pass 2, we must
  * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26.  Error analysis
  * shows that the values given below are the most effective.
  */
 
+#define CONST_BITS 13       /* Jimmy chose this constant :) */
 #ifdef EIGHT_BIT_SAMPLES
 #define PASS1_BITS  2
 #else
 #define PASS1_BITS  1          /* lose a little precision to avoid overflow */
 #endif
 
-#define ONE    ((INT32) 1)
+#define ONE    ((s32) 1)
 
 #define CONST_SCALE (ONE << CONST_BITS)
 
@@ -102,19 +104,19 @@ struct vdec_thread_s;
  * the correct integer constant values and insert them by hand.
  */
 
-#define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5))
+#define FIX(x) ((s32) ((x) * CONST_SCALE + 0.5))
 
 /* When adding two opposite-signed fixes, the 0.5 cancels */
-#define FIX2(x)        ((INT32) ((x) * CONST_SCALE))
+#define FIX2(x)        ((s32) ((x) * CONST_SCALE))
 
-/* Descale and correctly round an INT32 value that's scaled by N bits.
+/* Descale and correctly round an s32 value that's scaled by N bits.
  * We assume RIGHT_SHIFT rounds towards minus infinity, so adding
  * the fudge factor is correct for either sign of X.
  */
 
 #define DESCALE(x,n)  RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
 
-/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
+/* Multiply an s32 variable by an s32 constant to yield an s32 result.
  * For 8-bit samples with the recommended scaling, all the variable
  * and constant values involved are no more than 16 bits wide, so a
  * 16x16->32 bit multiply can be used instead of a full 32x32 multiply;
@@ -130,7 +132,7 @@ struct vdec_thread_s;
 #define MULTIPLY(var,const)  (((INT16) (var)) * ((INT16) (const)))
 #endif
 #ifdef SHORTxLCONST_32         /* known to work with Microsoft C 6.0 */
-#define MULTIPLY(var,const)  (((INT16) (var)) * ((INT32) (const)))
+#define MULTIPLY(var,const)  (((INT16) (var)) * ((s32) (const)))
 #endif
 #endif
 
index 64892c926a31aa622c4288b8a19fe44a1ec4f25c..a5125894ca39fa370400031635350dbaf4eafe1c 100644 (file)
@@ -32,10 +32,12 @@ void vdec_MotionField   ( struct macroblock_s* );
 void vdec_MotionFrame   ( struct macroblock_s* );
 
 /* Motion compensation for non skipped macroblocks */
-void vdec_FieldRecon    ( struct macroblock_s* );
-void vdec_16x8Recon     ( struct macroblock_s* );
-void vdec_FrameRecon    ( struct macroblock_s* );
-void vdec_DMVRecon      ( struct macroblock_s* );
+void vdec_FieldDMVRecon    ( struct macroblock_s* );
+void vdec_FieldFieldRecon    ( struct macroblock_s* );
+void vdec_Field16x8Recon     ( struct macroblock_s* );
+void vdec_FrameFrameRecon    ( struct macroblock_s* );
+void vdec_FrameFieldRecon    ( struct macroblock_s* );
+void vdec_FrameDMVRecon      ( struct macroblock_s* );
 
 /* Motion compensation functions for the 3 chroma formats */
 void vdec_Motion420();
index ecad1f0f5e9c45f1dba08254fd4400b55cc3a005..4d8f255ffea298f1dad54f3b0d70a5de152d4334 100644 (file)
@@ -33,6 +33,9 @@ typedef struct vdec_thread_s
  /*??*/
 //    int *pi_status;
     
+    /* idct iformations */
+    elem_t              p_pre_idct[64*64];
+    
     /* Input properties */
     struct vpar_thread_s *    p_vpar;                 /* video_parser thread */
         
@@ -53,13 +56,10 @@ typedef struct vdec_thread_s
 #endif
 } vdec_thread_t;
 
-/* Move this somewhere else ASAP !! */
-#define data_t short
-
 /*****************************************************************************
  * Function pointers
  *****************************************************************************/
-typedef void (*f_addb_t)( vdec_thread_t*, elem_t*, data_t*, int );
+typedef void (*f_addb_t)( elem_t*, yuv_data_t*, int );
 
 /*****************************************************************************
  * Prototypes
@@ -68,7 +68,7 @@ struct vpar_thread_s;
 
 /* Thread management functions */
 vdec_thread_t * vdec_CreateThread       ( struct vpar_thread_s *p_vpar /*, int *pi_status */ );
-void            vdec_DestroyThread      ( vdec_thread_t *p_vdec /*, int *pi_status */ );
-void vdec_AddBlock( vdec_thread_t*, elem_t*, data_t*, int );
-void vdec_CopyBlock( vdec_thread_t*, elem_t*, data_t*, int );
-void vdec_DummyBlock( vdec_thread_t*, elem_t*, data_t*, int );
+void vdec_DestroyThread      ( vdec_thread_t *p_vdec /*, int *pi_status */ );
+void vdec_AddBlock( elem_t*, yuv_data_t*, int );
+void vdec_CopyBlock( elem_t*, yuv_data_t*, int );
+void vdec_DummyBlock( elem_t*, yuv_data_t*, int );
index 229d43bef63dc337d294fef8b7a8d495369e6262..e2cb3c8873f7907a0a5f7c77e5894272ecaecdce 100644 (file)
  *****************************************************************************/
 typedef struct macroblock_s
 {
-    picture_t *             p_picture;
+    int                     i_mb_type;                    /* macroblock type */
     int                     i_structure;
+    int                     i_current_structure;
+    boolean_t               b_P_coding_type;        /* Is it P_CODING_TYPE ? */
+    picture_t *             p_picture;
     int                     i_l_x, i_l_y;    /* position of macroblock (lum) */
     int                     i_c_x, i_c_y; /* position of macroblock (chroma) */
     int                     i_chroma_nb_blocks;  /* nb of bks for a chr comp */
-    int                     i_l_stride;           /* number of data_t to ignore
+    int                     i_l_stride;       /* number of yuv_data_t to ignore
                                                                       * when changing lines     */
     int                     i_c_stride;                  /* idem, for chroma */
     
@@ -42,11 +45,11 @@ typedef struct macroblock_s
     int                     ppi_field_select[2][2];
     int                     pppi_motion_vectors[2][2][2];
     int                     pi_dm_vector[2];
-   
+  
     /* AddBlock information */
     f_addb_t                pf_addb[12];      /* pointer to the Add function */
-    data_t                  p_data[12];              /* pointer to the position
-                                                     * in the final picture */
+    yuv_data_t *            p_data[12];              /* pointer to the position
+                                                                         * in the final picture */
     int                     i_addb_l_stride, i_addb_c_stride;
 } macroblock_t;
 
@@ -122,8 +125,8 @@ typedef struct dct_lookup_s
 /*****************************************************************************
  * Constants
  *****************************************************************************/
-extern int *    pi_default_intra_quant;
-extern int *    pi_default_nonintra_quant;
+extern int      pi_default_intra_quant[];
+extern int      pi_default_nonintra_quant[];
 extern u8       pi_scan[2][64];
 
 /*****************************************************************************
index 1eece03d958b02ce21d6a481d6933831154c4b15..70b287e51e744e3e3f9e7ed4dc076499a9a410b7 100644 (file)
@@ -8,19 +8,22 @@
 
 /*******************************************************************************
  * Preamble
- ******************************************************************************/
+ *******************************************************************************/
+#include "vlc.h"
+
+/*
 #include <errno.h>
-#include <sys/uio.h>                                                 /* iovec */
+#include <sys/uio.h>                                               
 #include <string.h>
 
 #include <X11/Xlib.h>
 #include <X11/extensions/XShm.h>
 #include <sys/soundcard.h>
 
-#include <stdlib.h>                               /* atoi(), malloc(), free() */
+#include <stdlib.h>                            
 #include <stdio.h>
-#include <sys/ioctl.h>                                             /* ioctl() */
-#include <net/if.h>                                                  /* ifreq */
+#include <sys/ioctl.h>                                            
+#include <net/if.h>                                                
 #include <netinet/in.h>
 
 #include "common.h"
@@ -44,6 +47,7 @@
 #include "video.h"
 #include "video_output.h"
 #include "video_decoder.h"
+*/
 
 /******************************************************************************
  * Local prototypes
@@ -192,7 +196,7 @@ input_thread_t *input_CreateThread( input_cfg_t *p_cfg )
 #ifdef NO_THREAD
     input_Thread( p_input );
 #else
-    if( vlc_thread_create(&p_input->thread_id, "input", (vlc_thread_func)input_Thread, 
+    if( vlc_thread_create(&p_input->thread_id, "input", (vlc_thread_func_t)input_Thread, 
                        (void *) p_input) )
     {
         intf_ErrMsg("input error: can't spawn input thread (%s)\n", 
@@ -304,7 +308,7 @@ static void input_Thread( input_thread_t *p_input )
     EndThread( p_input );
 
     intf_DbgMsg("input debug: thread %p destroyed\n", p_input);
-    vlc_thread_exit( 0 );
+    vlc_thread_exit();
 }
 
 
@@ -337,7 +341,7 @@ static void EndThread( input_thread_t * p_input )
             {
                 case MPEG1_VIDEO_ES:
                 case MPEG2_VIDEO_ES:
-                    vpar_DestroyThread( (vpar_thread_t*)(p_input->pp_selected_es[i_es_loop]->p_dec) /*, NULL */ );
+                    vdec_DestroyThread( (vdec_thread_t*)(p_input->pp_selected_es[i_es_loop]->p_dec) /*, NULL */ );
                     break;
 
                 case MPEG1_AUDIO_ES:
@@ -915,27 +919,38 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
                     pcr_descriptor_t * p_pcr;
 
                     p_pcr = p_input->p_pcr;
-                    vlc_mutex_lock( &p_pcr->lock );
-                    if( p_pcr->delta_clock == 0 )
+                    
+                    p_pes->i_pts = 
+                        ( ((mtime_t)(p_pes->p_pes_header[9] & 0x0E) << 29) |
+                          (((mtime_t)U16_AT(p_pes->p_pes_header + 10) << 14) - (1 << 14)) |
+                          ((mtime_t)U16_AT(p_pes->p_pes_header + 12) >> 1) ) * 300;
+                    p_pes->i_pts /= 27;
+                    
+                    if( p_pcr->i_synchro_state )
                     {
-                        p_pes->b_has_pts = 0;
+                        switch( p_pcr->i_synchro_state )
+                        {
+                            case SYNCHRO_NOT_STARTED:
+                                p_pes->b_has_pts = 0;
+                                break;
+
+                            case SYNCHRO_START:
+                                p_pes->i_pts += p_pcr->delta_pcr;
+                                p_pcr->delta_absolute = mdate() - p_pes->i_pts + 500000;
+                                p_pes->i_pts += p_pcr->delta_absolute;
+                                p_pcr->i_synchro_state = 0;
+                                break;
+
+                            case SYNCHRO_REINIT: /* We skip a PES */
+                                p_pes->b_has_pts = 0;
+                                p_pcr->i_synchro_state = SYNCHRO_START;
+                                break;
+                        }
                     }
                     else
                     {
-                        p_pes->i_pts = ( ((mtime_t)(p_pes->p_pes_header[9] & 0x0E) << 29) |
-                                         (((mtime_t)U16_AT(p_pes->p_pes_header + 10) << 14) - (1 << 14)) |
-                                         ((mtime_t)U16_AT(p_pes->p_pes_header + 12) >> 1) );
-                        p_pes->i_pts *= 300;
-                        p_pes->i_pts /= 27;
-                        p_pes->i_pts += p_pcr->delta_clock;
-                        if( p_pcr->c_pts == 0 )
-                        {
-                            p_pcr->delta_decode = mdate() - p_pes->i_pts + 500000;
-                        }
-                        p_pes->i_pts += p_pcr->delta_decode;
-                        p_pcr->c_pts += 1;
+                        p_pes->i_pts += p_pcr->delta_pcr + p_pcr->delta_absolute;
                     }
-                    vlc_mutex_unlock( &p_pcr->lock );
                 }
                 break;
             }
index e962ca97fce5515a365951728704ecac008e2821..f129392acc6a882f8891629ded9d5086521b3699 100644 (file)
@@ -9,6 +9,10 @@
 /*******************************************************************************
  * Preamble
  *******************************************************************************/
+
+#include "vlc.h"
+
+#if 0
 #include <errno.h>
 #include <sys/uio.h>                                                 /* iovec */
 #include <stdlib.h>                               /* atoi(), malloc(), free() */
@@ -40,7 +44,7 @@
 #include "video.h"
 #include "video_output.h"
 #include "video_decoder.h"
-
+#endif
 
 /******************************************************************************
  * input_AddPgrmElem: Start the extraction and the decoding of a program element
index 646a569bb6675f2a55d8d0043ebc32cfa2e57fc9..cde2bcf991d832d54a275ce7588d86c17ab76099 100644 (file)
@@ -6,6 +6,7 @@
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
+
 #include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include "decoder_fifo.h"
 #include "video.h"
 #include "video_output.h"
-#include "video_parser.h"
 
-#include "video_fifo.h"
+#include "vdec_idct.h"
 #include "video_decoder.h"
+#include "vdec_motion.h"
 
-#include "vdec_idct.h"
+#include "vpar_blocks.h"
+#include "vpar_headers.h"
+#include "video_fifo.h"
+#include "vpar_synchro.h"
+#include "video_parser.h"
 
 /*
  * Local prototypes
@@ -58,12 +63,14 @@ void vdec_DummyIDCT( vdec_thread_t * p_vdec, elem_t * p_block,
 void vdec_InitIDCT (vdec_thread_t * p_vdec) 
 {        
     int i;
-    elem_t p_pre[][64]=vdec_thread_t->p_pre_idct;
-    for (i=0; i<64; i++) 
+    
+    elem_t * p_pre = p_vdec->p_pre_idct;
+    memset( p_pre, 0, 64*64*sizeof(elem_t) );
+    
+    for( i=0 ; i < 64 ; i++ ) 
     {
-        memset ((char *) p_pre[i], 0, 64*sizeof(elem_t));
-        p_pre[i][i]= 1 << SPARSE_SCALE_FACTOR;
-        vdec_IDCT (p_vdec, p_pre[i], 0);
+        p_pre[i*64+i] = 1 << SPARSE_SCALE_FACTOR;
+        vdec_IDCT( p_vdec, &p_pre[i*64], 0) ;
     }
 }
 
@@ -81,9 +88,9 @@ void vdec_SparseIDCT (vdec_thread_t * p_vdec, elem_t * p_block,
 
     if ( i_sparse_pos == 0 ) 
     {
-       dp=(int *)p_block;
-       val= *p_block >> 6;
-    /* Compute int to assign.  This speeds things up a bit */
+           dp=(int *)p_block;
+           val= *p_block >> 6;
+        /* Compute int to assign.  This speeds things up a bit */
         v = ((val & 0xffff) | (val << 16));
         dp[0] = v;     dp[1] = v;     dp[2] = v;     dp[3] = v;
         dp[4] = v;     dp[5] = v;     dp[6] = v;     dp[7] = v;
@@ -96,10 +103,10 @@ void vdec_SparseIDCT (vdec_thread_t * p_vdec, elem_t * p_block,
         return;
     }
     /* Some other coefficient. */
-    p_dest=(short int *)p_block;
-    p_source=(short int *)p_vdec->p_pre_idct[i_sparse_pos];
-    coef=p_dest[i_sparse_pos];
-    for (rr=0; rr<4; rr++)
+    p_dest = (s16*)p_block;
+    p_source = (s16*)&p_vdec->p_pre_idct[i_sparse_pos];
+    coeff = (int)p_dest[i_sparse_pos];
+    for( rr=0 ; rr < 4 ; rr++ )
     {
         p_dest[0] = (p_source[0] * coeff) >> SPARSE_SCALE_FACTOR;
         p_dest[1] = (p_source[1] * coeff) >> SPARSE_SCALE_FACTOR;
@@ -129,30 +136,31 @@ void vdec_SparseIDCT (vdec_thread_t * p_vdec, elem_t * p_block,
  *****************************************************************************/
 void vdec_IDCT( vdec_thread_t * p_vdec, elem_t * p_block, int i_idontcare )
 {
-    INT32 tmp0, tmp1, tmp2, tmp3;
-    INT32 tmp10, tmp11, tmp12, tmp13;
-    INT32 z1, z2, z3, z4, z5;
-    INT32 d0, d1, d2, d3, d4, d5, d6, d7;
+    s32 tmp0, tmp1, tmp2, tmp3;
+    s32 tmp10, tmp11, tmp12, tmp13;
+    s32 z1, z2, z3, z4, z5;
+    s32 d0, d1, d2, d3, d4, d5, d6, d7;
     elem_t * dataptr;
     int rowctr;
+    
     SHIFT_TEMPS
    
-  /* Pass 1: process rows. */
-  /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
-  /* furthermore, we scale the results by 2**PASS1_BITS. */
+    /* Pass 1: process rows. */
+    /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
+    /* furthermore, we scale the results by 2**PASS1_BITS. */
 
     dataptr = p_block;
 
     for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) 
     {
-    /* Due to quantization, we will usually find that many of the input
-     * coefficients are zero, especially the AC terms.  We can exploit this
-     * by short-circuiting the IDCT calculation for any row in which all
-     * the AC terms are zero.  In that case each output is equal to the
-     * DC coefficient (with scale factor as needed).
-     * With typical images and quantization tables, half or more of the
-     * row DCT calculations can be simplified this way.
-     */
+        /* Due to quantization, we will usually find that many of the input
+         * coefficients are zero, especially the AC terms.  We can exploit this
+         * by short-circuiting the IDCT calculation for any row in which all
+         * the AC terms are zero.  In that case each output is equal to the
+         * DC coefficient (with scale factor as needed).
+         * With typical images and quantization tables, half or more of the
+         * row DCT calculations can be simplified this way.
+         */
 
         register int * idataptr = (int*)dataptr;
         d0 = dataptr[0];
@@ -732,7 +740,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, elem_t * p_block, int i_idontcare )
   /* Note that we must descale the results by a factor of 8 == 2**3, */
   /* and also undo the PASS1_BITS scaling. */
 
-    dataptr = data;
+    dataptr = p_block;
     for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) 
     {
     /* Columns of zeroes can be exploited in the same way as we did with rows.
@@ -1301,4 +1309,5 @@ void vdec_IDCT( vdec_thread_t * p_vdec, elem_t * p_block, int i_idontcare )
                        CONST_BITS+PASS1_BITS+3);
     
     dataptr++;                 /* advance pointer to next column */
+    }
 }
index ff07cb460e10d0a8caf02692118e9dd59edd3545..9c03482a2fa0045dd0d30e9597173707f2aa212d 100644 (file)
  * Local prototypes
  */
 
+typedef struct motion_arg_s
+{
+    picture_t *     p_source;
+    boolean_t       b_source_field;
+    boolean_t       b_dest_field;
+    int             i_height;
+    int             i_x_step;
+    int             i_mv_x, i_mv_y;
+    boolean_t       b_average;
+} motion_arg_t;
+
+/*
 typedef void         (*f_motion_c_t)( coeff_t *, pel_lookup_table_t *,
                                       int, coeff_t *, int, int,
                                       int, int, int, int, int );
+*/
+
+/*****************************************************************************
+ * vdec_MotionComponent : last stage of motion compensation
+ *****************************************************************************/
+static __inline__ vdec_MotionComponent()
+{
+
+}
 
 /*****************************************************************************
  * vdec_DummyRecon : motion compensation for an intra macroblock
  *****************************************************************************/
 void vdec_DummyRecon( macroblock_t * p_mb )
 {
+    /* Nothing to do :) */
 }
 
 /*****************************************************************************
- * vdec_ForwardRecon : motion compensation for a forward predicted macroblock
+ * vdec_FieldFieldRecon : motion compensation for field motion type (field)
  *****************************************************************************/
-void vdec_ForwardRecon( macroblock_t * p_mb )
+void vdec_FieldFieldRecon( macroblock_t * p_mb )
 {
+#if 0
+    motion_arg_t motion_arg;
 
+    motion_arg
+    
+    if( p_mb->i_mb_type & MB_MOTION_FORWARD )
+    {
+        int i_current_field;
+        picture_t * p_pred_frame;
+        
+        i_current_field = ( p_mb->i_structure == BOTTOM_FIELD );
+        if( p_mb->b_P_coding_type && (p_mb->i_current_structure == FRAME_STRUCTURE)
+            && (i_current_field != p_mb->ppi_field_select[0][0]) )
+        {
+            p_pred_frame = p_mb->p_forward;
+        }
+        else
+        {
+            p_pred_frame = p_mb->p_backward;
+        }
+        p_mb->pf_chroma_motion( p_mb, p_pred_frame, 0 /* average */ );
+    }
+#endif
 }
 
 /*****************************************************************************
- * vdec_BackwardRecon : motion compensation for a backward predicted macroblock
+ * vdec_Field16x8Recon : motion compensation for 16x8 motion type (field)
  *****************************************************************************/
-void vdec_BackwardRecon( macroblock_t * p_mb )
+void vdec_Field16x8Recon( macroblock_t * p_mb )
 {
 
 }
 
 /*****************************************************************************
- * vdec_BidirectionalRecon : motion compensation for a bidirectionally
- *                           predicted macroblock
+ * vdec_FieldDMVRecon : motion compensation for dmv motion type (field)
  *****************************************************************************/
-void vdec_BidirectionalRecon( macroblock_t * p_mb )
+void vdec_FieldDMVRecon( macroblock_t * p_mb )
+{
+    /* This is necessarily a MOTION_FORWARD only macroblock */
+    
+}
+
+/*****************************************************************************
+ * vdec_FrameFrameRecon : motion compensation for frame motion type (frame)
+ *****************************************************************************/
+void vdec_FrameFrameRecon( macroblock_t * p_mb )
+{
+
+}
+
+/*****************************************************************************
+ * vdec_FrameFieldRecon : motion compensation for field motion type (frame)
+ *****************************************************************************/
+void vdec_FrameFieldRecon( macroblock_t * p_mb )
 {
 
 }
 
+/*****************************************************************************
+ * vdec_FrameDMVRecon : motion compensation for dmv motion type (frame)
+ *****************************************************************************/
+void vdec_FrameDMVRecon( macroblock_t * p_mb )
+{
+    /* This is necessarily a MOTION_FORWARD only macroblock */
+    
+}
+
+/*****************************************************************************
+ * vdec_MotionField : motion compensation for skipped macroblocks (field)
+ *****************************************************************************/
+void vdec_MotionField( macroblock_t * p_mb )
+{
+
+}
+
+/*****************************************************************************
+ * vdec_MotionFrame : motion compensation for skipped macroblocks (frame)
+ *****************************************************************************/
+void vdec_MotionFrame( macroblock_t * p_mb )
+{
+
+}
+
+/*****************************************************************************
+ * vdec_Motion420 : motion compensation for a 4:2:0 macroblock
+ *****************************************************************************/
+void vdec_Motion420( macroblock_t * p_mb )
+{
+}
+
+/*****************************************************************************
+ * vdec_Motion422 : motion compensation for a 4:2:2 macroblock
+ *****************************************************************************/
+void vdec_Motion422( macroblock_t * p_mb )
+{
+}
+
+/*****************************************************************************
+ * vdec_Motion444 : motion compensation for a 4:4:4 macroblock
+ *****************************************************************************/
+void vdec_Motion444( macroblock_t * p_mb )
+{
+}
+
+#if 0
+
 /*****************************************************************************
  * vdec_MotionMacroblock420 : motion compensation for a 4:2:0 macroblock
  *****************************************************************************/
 void vdec_MotionMacroblock420( macroblock_t * p_mb )
 {
     /* Luminance */
+    /*
     MotionBlock( p_undec_p->p_forward->p_u, p_undec_p->p_forward->p_lookup_lum,
                  p_undec_p->p_picture->i_width, p_u, i_mb_x, i_mb_y,
                  p_undec_p->p_picture->i_width,
                  p_undec_p->ppp_motion_vectors[0][0][0],
                  p_undec_p->ppp_motion_vectors[0][0][1] );
-
+    */
 }
 
 /*****************************************************************************
@@ -153,3 +262,5 @@ void ComponentNN( coeff_t * p_src, pel_lookup_table_t * p_lookup,
         i_src_loc += i_stride_line;
     }
 }
+
+#endif
index 742729f9f5afc169c4327c9bbd3089d436b90c2c..837b146a594f29008bca34d572c760896d51f16b 100644 (file)
@@ -8,10 +8,8 @@
 /*******************************************************************************
  * Preamble
  *******************************************************************************/
-#include "vlc.h"
+//#include "vlc.h"
 
-/*#include <errno.h>
-#include <pthread.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include "vlc_thread.h"
 
 #include "intf_msg.h"
-#include "debug.h"                    
+#include "debug.h"                    /* ?? temporaire, requis par netlist.h */
 
 #include "input.h"
 #include "input_netlist.h"
 #include "decoder_fifo.h"
 #include "video.h"
 #include "video_output.h"
-#include "video_decoder.h"*/
-
 
 #include "vdec_idct.h"
 #include "video_decoder.h"
@@ -91,7 +87,7 @@ vdec_thread_t * vdec_CreateThread( vpar_thread_t *p_vpar /*, int *pi_status */ )
 
     /* Spawn the video decoder thread */
     if ( vlc_thread_create(&p_vdec->thread_id, "video decoder",
-         (vlc_thread_func)RunThread, (void *)p_vdec) )
+         (vlc_thread_func_t)RunThread, (void *)p_vdec) )
     {
         intf_ErrMsg("vdec error: can't spawn video decoder thread\n");
         free( p_vdec );
@@ -276,7 +272,7 @@ static void DecodeMacroblock( vdec_thread_t *p_vdec, macroblock_t * p_mb )
          * Adding prediction and coefficient data (ISO/IEC 13818-2 section 7.6.8)
          */
         (p_mb->pf_addb[i_b])( p_mb->ppi_blocks[i_b],
-                               p_mb->p_data[i_b], p_mb->i_l_stride );
+                              p_mb->p_data[i_b], p_mb->i_l_stride );
     }
 
     /* chrominance */
@@ -291,8 +287,8 @@ static void DecodeMacroblock( vdec_thread_t *p_vdec, macroblock_t * p_mb )
         /*
          * Adding prediction and coefficient data (ISO/IEC 13818-2 section 7.6.8)
          */
-        (p_mb->pf_addb[i_b])( p_mb->ppi_blocks[i_b],
-                               p_mb->p_data[i_b], p_mb->i_c_stride );
+        (p_mb->pf_addb[i_b])( (elem_t*)p_mb->ppi_blocks[i_b],
+                              p_mb->p_data[i_b], p_mb->i_c_stride );
     }
 
     /*
@@ -305,8 +301,7 @@ static void DecodeMacroblock( vdec_thread_t *p_vdec, macroblock_t * p_mb )
 /*******************************************************************************
  * vdec_AddBlock : add a block
  *******************************************************************************/
-void vdec_AddBlock( vdec_thread_t * p_vdec, elem_t * p_block, data_t * p_data,
-                    int i_incr )
+void vdec_AddBlock( elem_t * p_block, yuv_data_t * p_data, int i_incr )
 {
     int i_x, i_y;
     
@@ -328,16 +323,15 @@ void vdec_AddBlock( vdec_thread_t * p_vdec, elem_t * p_block, data_t * p_data,
 /*******************************************************************************
  * vdec_CopyBlock : copy a block
  *******************************************************************************/
-void vdec_CopyBlock( vdec_thread_t * p_vdec, elem_t * p_block, data_t * p_data,
-                     int i_incr )
+void vdec_CopyBlock( elem_t * p_block, yuv_data_t * p_data, int i_incr )
 {
     int i_x, i_y;
     
     for( i_y = 0; i_y < 8; i_y++ )
     {
 #ifndef VDEC_DFT
-        /* elem_t and data_t are the same */
-        memcopy( p_data, p_block, 8*sizeof(data_t) );
+        /* elem_t and yuv_data_t are the same */
+        memcpy( p_data, p_block, 8*sizeof(yuv_data_t) );
         p_data += i_incr+8;
         p_block += 8;
 #else
@@ -355,7 +349,6 @@ void vdec_CopyBlock( vdec_thread_t * p_vdec, elem_t * p_block, data_t * p_data,
 /*******************************************************************************
  * vdec_DummyBlock : dummy function that does nothing
  *******************************************************************************/
-void vdec_DummyBlock( vdec_thread_t * p_vdec, elem_t * p_block, data_t * p_data,
-                      int i_incr )
+void vdec_DummyBlock( elem_t * p_block, yuv_data_t * p_data, int i_incr )
 {
 }
index a7c119201eaa2fe23cce02418db656e675cc45f9..f2afda88792616ab32e1613b0bf5bf171cf0c454 100644 (file)
@@ -136,6 +136,8 @@ void vpar_ReleaseMacroblock( video_fifo_t * p_fifo, macroblock_t * p_mb )
     /* Unlink picture buffer */
     vlc_mutex_lock( &p_mb->p_picture->lock_deccount );
     p_mb->p_picture->i_deccount--;
+
+    /* Test if it was the last block of the picture */
     if( p_mb->p_picture->i_deccount == 0 )
     {
         /* Mark the picture to be displayed */
index 97dcf8c6b0b128e27fc99c4f30145497dfc75570..687709b20cb4c2a7798b870d37f4c9254972ba22 100644 (file)
@@ -533,8 +533,6 @@ void InitDCTTables( vpar_thread_t * p_vpar )
     memcpy( p_vpar->ppl_dct_coef[8], pl_DCT_tab6, sizeof( pl_DCT_tab6 ) );
     memcpy( p_vpar->ppl_dct_coef[9], pl_DCT_tab0a, sizeof( pl_DCT_tab0a ) );
     memcpy( p_vpar->ppl_dct_coef[10], pl_DCT_tab1a, sizeof( pl_DCT_tab1a ) );
-
-
 }
 
 /*
@@ -683,8 +681,8 @@ void vpar_ParseMacroblock( vpar_thread_t * p_vpar, int * pi_mb_address,
      
             /* 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_chroma_width;
+                                + pi_y[p_vpar->mb.b_dct_type][i_b]
+                                * p_vpar->sequence.i_chroma_width;
         }
         else
         {
@@ -759,12 +757,14 @@ static __inline__ void InitMacroblock( vpar_thread_t * p_vpar,
     
     p_mb->p_picture = p_vpar->picture.p_picture;
     p_mb->i_structure = p_vpar->picture.i_structure;
+    p_mb->i_current_structure = p_vpar->picture.i_current_structure;
     p_mb->i_l_x = p_vpar->mb.i_l_x;
     p_mb->i_l_y = p_vpar->mb.i_l_y;
     p_mb->i_c_x = p_vpar->mb.i_c_x;
     p_mb->i_c_y = p_vpar->mb.i_c_y;
     p_mb->i_chroma_nb_blocks = p_vpar->sequence.i_chroma_nb_blocks;
     p_mb->pf_chroma_motion = pf_chroma_motion[p_vpar->sequence.i_chroma_format];
+    p_mb->b_P_coding_type = ( p_vpar->picture.i_coding_type == P_CODING_TYPE );
 
     p_mb->p_forward = p_vpar->sequence.p_forward;
     p_mb->p_backward = p_vpar->sequence.p_backward;
@@ -813,20 +813,20 @@ static __inline__ void MacroblockModes( vpar_thread_t * p_vpar,
                                         macroblock_t * p_mb )
 {
     static f_motion_t   pf_motion[2][4] =
-        { {NULL, vdec_FieldRecon, vdec_16x8Recon, vdec_DMVRecon},
-          {NULL, vdec_FieldRecon, vdec_FrameRecon, vdec_DMVRecon} };
+        { {NULL, vdec_FieldFieldRecon, vdec_Field16x8Recon, vdec_FieldDMVRecon},
+          {NULL, vdec_FrameFieldRecon, vdec_FrameFrameRecon, vdec_FrameDMVRecon} };
     static int          ppi_mv_count[2][4] = { {0, 1, 2, 1}, {0, 2, 1, 1} };
     static int          ppi_mv_format[2][4] = { {0, 1, 1, 1}, {0, 1, 2, 1} };
 
     /* Get macroblock_type. */
     p_vpar->mb.i_mb_type = (p_vpar->picture.pf_macroblock_type)( p_vpar );
-
+    p_mb->i_mb_type = p_vpar->mb.i_mb_type;
+    
     /* SCALABILITY : warning, we don't know if spatial_temporal_weight_code
      * has to be dropped, take care if you use scalable streams. */
     /* DumpBits( &p_vpar->bit_stream, 2 ); */
     
-    if( (p_vpar->picture.i_coding_type == P_CODING_TYPE) &&
-        !(p_vpar->mb.i_mb_type & (MB_MOTION_FORWARD|MB_INTRA)) )
+    if( p_mb->b_P_coding_type && !(p_vpar->mb.i_mb_type & (MB_MOTION_FORWARD|MB_INTRA)) )
     {
         /* Special No-MC macroblock in P pictures (7.6.3.5). */
         memset( p_vpar->slice.pppi_pmv, 0, 8*sizeof(int) );
@@ -1078,7 +1078,7 @@ static void vpar_DecodeMPEG2Non( vpar_thread_t * p_vpar, macroblock_t * p_mb, in
             default:
                 i_level = ( * ( p_vpar->ppl_dct_coef[i_select]
                               + ( i_offset * sizeof(dct_lookup_t) ) ) ).i_level;
-                b_sign = Getbits( &p_vpar->bit_stream, 1 );
+                b_sign = GetBits( &p_vpar->bit_stream, 1 );
                 p_mb->ppi_blocks[i_b][i_dummy] = b_sign ? -i_level : i_level;
                 i_coef = i_dummy;
                 i_dummy += i_run;
@@ -1195,7 +1195,7 @@ static void vpar_DecodeMPEG2Intra( vpar_thread_t * p_vpar, macroblock_t * p_mb,
             default:
                 i_level = ( * ( p_vpar->ppl_dct_coef[i_select]
                               + ( i_offset * sizeof(dct_lookup_t) ) ) ).i_level;
-                b_sign = Getbits( &p_vpar->bit_stream, 1 );
+                b_sign = GetBits( &p_vpar->bit_stream, 1 );
                 p_mb->ppi_blocks[i_b][i_dummy] = b_sign ? -i_level : i_level;
                 i_coef = i_dummy;
                 i_dummy += i_run;
index 0f23fdf8fad96f54da2cc7f796a171f3a4c4363c..02175cde798b795ea3ae2655185f6c98a05dc9e7 100644 (file)
@@ -179,7 +179,7 @@ void vpar_MotionVector( vpar_thread_t * p_vpar, macroblock_t * p_mb, int i_r,
  *****************************************************************************/
 void vpar_MPEG1MotionVector( vpar_thread_t * p_vpar, macroblock_t * p_mb, int i_s )
 {
-    p_vpar_MotionVector( p_vpar, p_mb, 0, i_s, p_vpar->picture.pb_full_pel_vector[i_s] );
+    vpar_MotionVector( p_vpar, p_mb, 0, i_s, p_vpar->picture.pb_full_pel_vector[i_s] );
 }
 
 /*****************************************************************************
index 9b0ec2bbc8365ff4eae0aa34690618926adfe7a7..43980038651491ff946b0c9cc13272bd1a1e5ee9 100644 (file)
@@ -69,3 +69,14 @@ mtime_t vpar_SynchroDecode( vpar_thread_t * p_vpar, int i_coding_type,
 {
 
 }
+
+/*****************************************************************************
+ * vpar_SynchroEnd : Called when the image is totally decoded
+ *****************************************************************************/
+void vpar_SynchroEnd( vpar_thread_t * p_vpar )
+{
+
+}
+
+
+