Commit 84821085 authored by Christophe Massiot's avatar Christophe Massiot

* Support for pictures with a pitch different from the picture width,

inspired by Gildas Bazin.
parent 051e23d9
......@@ -2,7 +2,7 @@
* vdec_ext-plugins.h : structures from the video decoder exported to plug-ins
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vdec_ext-plugins.h,v 1.10 2002/04/05 01:05:22 gbazin Exp $
* $Id: vdec_ext-plugins.h,v 1.11 2002/04/15 23:04:08 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -60,7 +60,6 @@ typedef struct macroblock_s
yuv_data_t * p_v_data;
/* pointers to the position
* in the final picture */
/* Motion compensation information */
motion_inner_t p_motions[8];
int i_nb_motions;
......
......@@ -4,7 +4,7 @@
* includes all common video types and constants.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video.h,v 1.48 2002/04/05 01:05:22 gbazin Exp $
* $Id: video.h,v 1.49 2002/04/15 23:04:08 massiot Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -182,8 +182,11 @@ typedef struct picture_heap_s
/* Shortcuts */
#define Y_PIXELS p[Y_PLANE].p_pixels
#define Y_PITCH p[Y_PLANE].i_pitch
#define U_PIXELS p[U_PLANE].p_pixels
#define U_PITCH p[U_PLANE].i_pitch
#define V_PIXELS p[V_PLANE].p_pixels
#define V_PITCH p[V_PLANE].i_pitch
static __inline__ int vout_ChromaCmp( u32 i_chroma, u32 i_amorhc )
{
......
......@@ -2,7 +2,7 @@
* mpeg_ps.c : Program Stream input module for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: mpeg_ps.c,v 1.10 2002/04/10 17:47:58 jobi Exp $
* $Id: mpeg_ps.c,v 1.11 2002/04/15 23:04:08 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -114,8 +114,7 @@ static int PSInit( input_thread_t * p_input )
}
else
{
intf_WarnMsg( 2, "input: PS plug-in discarded (no startcode)" );
return( -1 );
intf_WarnMsg( 2, "input error: this doesn't look like an MPEG PS stream, but continuing anyway" );
}
}
else if( *(p_peek + 3) <= 0xb9 )
......@@ -128,8 +127,8 @@ static int PSInit( input_thread_t * p_input )
}
else
{
intf_WarnMsg( 2, "input: PS plug-in discarded (ES startcode)" );
return( -1 );
intf_WarnMsg( 2, "input error: this seems to be an elementary stream (ES plug-in ?),");
intf_WarnMsg( 2, "but continuing" );
}
}
......
......@@ -2,7 +2,7 @@
* video_decoder.c : video decoder thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: video_decoder.c,v 1.6 2002/02/19 00:50:19 sam Exp $
* $Id: video_decoder.c,v 1.7 2002/04/15 23:04:08 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Lespinasse <walken@zoy.org>
......@@ -222,63 +222,41 @@ static __inline__ void MotionBlock( vdec_pool_t * p_pool,
/*****************************************************************************
* DecodeMacroblock: decode a macroblock
*****************************************************************************/
#define DECODE_INTRA_BLOCK( i_b, p_dest, I_CHROMA ) \
#define DECODE_INTRA_BLOCK( i_b, p_dest ) \
p_idct = &p_mb->p_idcts[i_b]; \
p_idct->pf_idct( p_idct->pi_block, p_dest, \
i_b < 4 ? i_lum_dct_stride : \
I_CHROMA == CHROMA_420 ? \
p_vpar->picture.i_field_width >> 1 : \
i_chrom_dct_stride, \
p_vdec->p_idct_data, p_idct->i_sparse_pos );
i_b < 4 ? i_lum_dct_stride : i_chrom_dct_stride, \
p_vdec->p_idct_data, p_idct->i_sparse_pos );
#define DECODE_NONINTRA_BLOCK( i_b, p_dest, I_CHROMA ) \
#define DECODE_NONINTRA_BLOCK( i_b, p_dest ) \
if( p_mb->i_coded_block_pattern & (1 << (11 - (i_b))) ) \
{ \
DECODE_INTRA_BLOCK( i_b, p_dest, I_CHROMA ); \
DECODE_INTRA_BLOCK( i_b, p_dest ); \
}
#define DECLARE_DECODEMB( PSZ_NAME, I_CHROMA ) \
void PSZ_NAME ( vdec_thread_t *p_vdec, macroblock_t * p_mb ) \
{ \
int i, i_lum_dct_offset, i_lum_dct_stride; \
/* This is to keep the compiler happy with CHROMA_420 and CHROMA_NONE */\
int i_chrom_dct_offset __attribute__((unused)); \
int i_chrom_dct_stride __attribute__((unused)); \
int i_chrom_dct_offset, i_chrom_dct_stride; \
idct_inner_t * p_idct; \
vdec_pool_t * p_pool = p_vdec->p_pool; \
vpar_thread_t * p_vpar = p_pool->p_vpar; \
\
if( p_mb->i_mb_modes & DCT_TYPE_INTERLACED ) \
{ \
i_lum_dct_offset = p_vpar->picture.i_field_width; \
i_lum_dct_stride = p_vpar->picture.i_field_width * 2; \
if( I_CHROMA == CHROMA_422 ) \
{ \
i_chrom_dct_offset = p_vpar->picture.i_field_width >> 1; \
i_chrom_dct_stride = p_vpar->picture.i_field_width; \
} \
else if( I_CHROMA == CHROMA_444 ) \
{ \
i_chrom_dct_offset = p_vpar->picture.i_field_width; \
i_chrom_dct_stride = p_vpar->picture.i_field_width * 2; \
} \
i_lum_dct_offset = p_vpar->picture.i_lum_stride; \
i_lum_dct_stride = p_vpar->picture.i_lum_stride * 2; \
} \
else \
{ \
i_lum_dct_offset = p_vpar->picture.i_field_width * 8; \
i_lum_dct_stride = p_vpar->picture.i_field_width; \
if( I_CHROMA == CHROMA_422 ) \
{ \
i_chrom_dct_offset = p_vpar->picture.i_field_width * 4; \
i_chrom_dct_stride = p_vpar->picture.i_field_width >> 1; \
} \
else if( I_CHROMA == CHROMA_444 ) \
{ \
i_chrom_dct_offset = p_vpar->picture.i_field_width * 8; \
i_chrom_dct_stride = p_vpar->picture.i_field_width; \
} \
i_lum_dct_offset = p_vpar->picture.i_lum_stride * 8; \
i_lum_dct_stride = p_vpar->picture.i_lum_stride; \
} \
\
i_chrom_dct_offset = p_vpar->picture.i_chrom_stride * 8; \
i_chrom_dct_stride = p_vpar->picture.i_chrom_stride; \
\
if( !(p_mb->i_mb_modes & MB_INTRA) ) \
{ \
/* \
......@@ -300,32 +278,28 @@ void PSZ_NAME ( vdec_thread_t *p_vdec, macroblock_t * p_mb ) \
* adding prediction and coefficient data (ISO/IEC \
* 13818-2 section 7.6.8) \
*/ \
DECODE_NONINTRA_BLOCK( 0, p_mb->p_y_data, I_CHROMA ); \
DECODE_NONINTRA_BLOCK( 1, p_mb->p_y_data + 8, I_CHROMA ); \
DECODE_NONINTRA_BLOCK( 2, p_mb->p_y_data + i_lum_dct_offset, \
I_CHROMA ); \
DECODE_NONINTRA_BLOCK( 3, p_mb->p_y_data + i_lum_dct_offset + 8, \
I_CHROMA ); \
DECODE_NONINTRA_BLOCK( 0, p_mb->p_y_data ); \
DECODE_NONINTRA_BLOCK( 1, p_mb->p_y_data + 8 ); \
DECODE_NONINTRA_BLOCK( 2, p_mb->p_y_data + i_lum_dct_offset ); \
DECODE_NONINTRA_BLOCK( 3, p_mb->p_y_data + i_lum_dct_offset + 8 ); \
if( I_CHROMA != CHROMA_NONE ) \
{ \
DECODE_NONINTRA_BLOCK( 4, p_mb->p_u_data, I_CHROMA ); \
DECODE_NONINTRA_BLOCK( 5, p_mb->p_v_data, I_CHROMA ); \
DECODE_NONINTRA_BLOCK( 4, p_mb->p_u_data ); \
DECODE_NONINTRA_BLOCK( 5, p_mb->p_v_data ); \
if( I_CHROMA != CHROMA_420 ) \
{ \
DECODE_NONINTRA_BLOCK( 6, p_mb->p_u_data \
+ i_chrom_dct_offset, I_CHROMA );\
+ i_chrom_dct_offset ); \
DECODE_NONINTRA_BLOCK( 7, p_mb->p_v_data \
+ i_chrom_dct_offset, I_CHROMA );\
+ i_chrom_dct_offset ); \
if( I_CHROMA == CHROMA_444 ) \
{ \
DECODE_NONINTRA_BLOCK( 8, p_mb->p_u_data + 8, \
I_CHROMA ); \
DECODE_NONINTRA_BLOCK( 9, p_mb->p_v_data + 8, \
I_CHROMA ); \
DECODE_NONINTRA_BLOCK( 8, p_mb->p_u_data + 8 ); \
DECODE_NONINTRA_BLOCK( 9, p_mb->p_v_data + 8 ); \
DECODE_NONINTRA_BLOCK( 10, p_mb->p_u_data + 8 \
+ i_chrom_dct_offset, I_CHROMA );\
+ i_chrom_dct_offset ); \
DECODE_NONINTRA_BLOCK( 11, p_mb->p_v_data + 8 \
+ i_chrom_dct_offset, I_CHROMA );\
+ i_chrom_dct_offset ); \
} \
} \
} \
......@@ -333,30 +307,28 @@ void PSZ_NAME ( vdec_thread_t *p_vdec, macroblock_t * p_mb ) \
else \
{ \
/* Intra macroblock */ \
DECODE_INTRA_BLOCK( 0, p_mb->p_y_data, I_CHROMA ); \
DECODE_INTRA_BLOCK( 1, p_mb->p_y_data + 8, I_CHROMA ); \
DECODE_INTRA_BLOCK( 2, p_mb->p_y_data + i_lum_dct_offset, \
I_CHROMA ); \
DECODE_INTRA_BLOCK( 3, p_mb->p_y_data + i_lum_dct_offset + 8, \
I_CHROMA ); \
DECODE_INTRA_BLOCK( 0, p_mb->p_y_data ); \
DECODE_INTRA_BLOCK( 1, p_mb->p_y_data + 8 ); \
DECODE_INTRA_BLOCK( 2, p_mb->p_y_data + i_lum_dct_offset ); \
DECODE_INTRA_BLOCK( 3, p_mb->p_y_data + i_lum_dct_offset + 8 ); \
if( I_CHROMA != CHROMA_NONE ) \
{ \
DECODE_INTRA_BLOCK( 4, p_mb->p_u_data, I_CHROMA ); \
DECODE_INTRA_BLOCK( 5, p_mb->p_v_data, I_CHROMA ); \
DECODE_INTRA_BLOCK( 4, p_mb->p_u_data ); \
DECODE_INTRA_BLOCK( 5, p_mb->p_v_data ); \
if( I_CHROMA != CHROMA_420 ) \
{ \
DECODE_INTRA_BLOCK( 6, p_mb->p_u_data \
+ i_chrom_dct_offset, I_CHROMA ); \
+ i_chrom_dct_offset ); \
DECODE_INTRA_BLOCK( 7, p_mb->p_v_data \
+ i_chrom_dct_offset, I_CHROMA ); \
+ i_chrom_dct_offset ); \
if( I_CHROMA == CHROMA_444 ) \
{ \
DECODE_INTRA_BLOCK( 8, p_mb->p_u_data + 8, I_CHROMA ); \
DECODE_INTRA_BLOCK( 9, p_mb->p_v_data + 8, I_CHROMA ); \
DECODE_INTRA_BLOCK( 8, p_mb->p_u_data + 8 ); \
DECODE_INTRA_BLOCK( 9, p_mb->p_v_data + 8 ); \
DECODE_INTRA_BLOCK( 10, p_mb->p_u_data + 8 \
+ i_chrom_dct_offset, I_CHROMA );\
+ i_chrom_dct_offset ); \
DECODE_INTRA_BLOCK( 11, p_mb->p_v_data + 8 \
+ i_chrom_dct_offset, I_CHROMA );\
+ i_chrom_dct_offset ); \
} \
} \
} \
......
......@@ -2,7 +2,7 @@
* video_parser.h : video parser thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_parser.h,v 1.3 2002/01/02 14:37:42 sam Exp $
* $Id: video_parser.h,v 1.4 2002/04/15 23:04:08 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Jean-Marc Dressler <polux@via.ecp.fr>
......@@ -160,7 +160,7 @@ typedef struct picture_parsing_s
boolean_t b_top_field_first, b_concealment_mv;
boolean_t b_repeat_first_field;
/* Relative to the current field */
int i_coding_type, i_structure;
int i_coding_type, i_structure, i_field_width;
boolean_t b_frame_structure; /* i_structure == FRAME_STRUCTURE */
boolean_t b_current_field; /* i_structure == TOP_FIELD */
boolean_t b_second_field;
......@@ -168,8 +168,10 @@ typedef struct picture_parsing_s
picture_t * p_picture; /* picture buffer from vout */
int i_current_structure; /* current parsed structure of
* p_picture (second field ?) */
int i_field_width;
boolean_t b_error; /* parsing error, try to recover */
/* Given by the video output */
int i_lum_stride, i_chrom_stride;
} picture_parsing_t;
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* vpar_blocks.c : blocks parsing
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: vpar_blocks.c,v 1.7 2002/03/17 17:00:38 sam Exp $
* $Id: vpar_blocks.c,v 1.8 2002/04/15 23:04:08 massiot Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
* Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
......@@ -1160,8 +1160,8 @@ static void MotionMPEG1( vpar_thread_t * p_vpar,
{
int i_motion_x, i_motion_y;
int i_offset = p_vpar->mb.i_offset;
int i_width = p_vpar->picture.i_field_width;
int i_width = p_vpar->picture.i_lum_stride;
i_motion_x = p_motion->ppi_pmv[0][0]
+ MotionDelta( p_vpar, p_motion->pi_f_code[0] );
i_motion_x = BoundMotionVector( i_motion_x, p_motion->pi_f_code[0] );
......@@ -1189,7 +1189,7 @@ static void MotionMPEG1Reuse( vpar_thread_t * p_vpar,
{
int i_motion_x, i_motion_y;
int i_offset = p_vpar->mb.i_offset;
int i_width = p_vpar->picture.i_field_width;
int i_width = p_vpar->picture.i_lum_stride;
i_motion_x = p_motion->ppi_pmv[0][0];
i_motion_y = p_motion->ppi_pmv[0][1];
......@@ -1213,7 +1213,7 @@ static void MotionFrameFrame( vpar_thread_t * p_vpar,
{
int i_motion_x, i_motion_y;
int i_offset = p_vpar->mb.i_offset;
int i_width = p_vpar->picture.i_field_width;
int i_width = p_vpar->picture.i_lum_stride;
i_motion_x = p_motion->ppi_pmv[0][0]
+ MotionDelta( p_vpar, p_motion->pi_f_code[0] );
......@@ -1236,7 +1236,7 @@ static void MotionFrameField( vpar_thread_t * p_vpar,
{
int i_motion_x, i_motion_y, i_field_select;
int i_offset = p_vpar->mb.i_offset;
int i_width = p_vpar->picture.i_field_width;
int i_width = p_vpar->picture.i_lum_stride;
i_field_select = GetSignedBits( &p_vpar->bit_stream, 1 );
......@@ -1284,7 +1284,7 @@ static void MotionFrameDMV( vpar_thread_t * p_vpar,
int i_tmp_x, i_tmp_y;
int i_offset = p_vpar->mb.i_offset;
int i_width = p_vpar->picture.i_field_width;
int i_width = p_vpar->picture.i_lum_stride;
int m;
i_motion_x = p_motion->ppi_pmv[0][0]
......@@ -1326,7 +1326,7 @@ static void MotionFrameZero( vpar_thread_t * p_vpar,
boolean_t b_average )
{
int i_offset = p_vpar->mb.i_offset;
int i_width = p_vpar->picture.i_field_width;
int i_width = p_vpar->picture.i_lum_stride;
MOTION_BLOCK( b_average, 0, 0, i_offset, p_motion->pppi_ref[0],
i_offset, i_width, 16, 0 );
......@@ -1338,7 +1338,7 @@ static void MotionFrameReuse( vpar_thread_t * p_vpar,
boolean_t b_average )
{
int i_offset = p_vpar->mb.i_offset;
int i_width = p_vpar->picture.i_field_width;
int i_width = p_vpar->picture.i_lum_stride;
MOTION_BLOCK( b_average, p_motion->ppi_pmv[0][0], p_motion->ppi_pmv[0][1],
i_offset, p_motion->pppi_ref[0], i_offset, i_width, 16, 0 );
......@@ -1354,7 +1354,7 @@ static void MotionFieldField( vpar_thread_t * p_vpar,
int i_motion_x, i_motion_y;
boolean_t b_field_select;
int i_offset = p_vpar->mb.i_offset;
int i_width = p_vpar->picture.i_field_width;
int i_width = p_vpar->picture.i_lum_stride;
b_field_select = GetBits( &p_vpar->bit_stream, 1 );
......@@ -1380,7 +1380,7 @@ static void MotionField16x8( vpar_thread_t * p_vpar,
int i_motion_x, i_motion_y;
boolean_t b_field_select;
int i_offset = p_vpar->mb.i_offset;
int i_width = p_vpar->picture.i_field_width;
int i_width = p_vpar->picture.i_lum_stride;
/* First half. */
b_field_select = GetBits( &p_vpar->bit_stream, 1 );
......@@ -1423,7 +1423,7 @@ static void MotionFieldDMV( vpar_thread_t * p_vpar,
int i_motion_x, i_motion_y;
int i_dmv_x, i_dmv_y;
int i_offset = p_vpar->mb.i_offset;
int i_width = p_vpar->picture.i_field_width;
int i_width = p_vpar->picture.i_lum_stride;
boolean_t b_current_field = p_vpar->picture.b_current_field;
i_motion_x = p_motion->ppi_pmv[0][0]
......@@ -1458,7 +1458,7 @@ static void MotionFieldZero( vpar_thread_t * p_vpar,
boolean_t b_average )
{
int i_offset = p_vpar->mb.i_offset;
int i_width = p_vpar->picture.i_field_width;
int i_width = p_vpar->picture.i_lum_stride;
boolean_t b_current_field = p_vpar->picture.b_current_field;
MOTION_BLOCK( b_average, 0, 0, i_offset, p_motion->pppi_ref[b_current_field],
......@@ -1471,7 +1471,7 @@ static void MotionFieldReuse( vpar_thread_t * p_vpar,
boolean_t b_average )
{
int i_offset = p_vpar->mb.i_offset;
int i_width = p_vpar->picture.i_field_width;
int i_width = p_vpar->picture.i_lum_stride;
boolean_t b_current_field = p_vpar->picture.b_current_field;
MOTION_BLOCK( b_average, p_motion->ppi_pmv[0][0], p_motion->ppi_pmv[0][1],
......@@ -1735,24 +1735,24 @@ mb_intra:
#define CHECK_BOUNDARIES \
i_offset = p_vpar->mb.i_offset; \
if( i_offset == i_width ) \
if( i_offset == p_vpar->picture.i_field_width ) \
{ \
if( i_coding_type != I_CODING_TYPE || \
p_vpar->picture.b_concealment_mv ) \
{ \
p_f_motion->pppi_ref[0][0] += 16 * i_offset; \
p_f_motion->pppi_ref[0][1] += i_chroma_tmp; \
p_f_motion->pppi_ref[0][2] += i_chroma_tmp; \
p_f_motion->pppi_ref[0][0] += i_lum_vsize; \
p_f_motion->pppi_ref[0][1] += i_chrom_vsize; \
p_f_motion->pppi_ref[0][2] += i_chrom_vsize; \
} \
if( i_coding_type == B_CODING_TYPE ) \
{ \
p_b_motion->pppi_ref[0][0] += 16 * i_offset; \
p_b_motion->pppi_ref[0][1] += i_chroma_tmp; \
p_b_motion->pppi_ref[0][2] += i_chroma_tmp; \
p_b_motion->pppi_ref[0][0] += i_lum_vsize; \
p_b_motion->pppi_ref[0][1] += i_chrom_vsize; \
p_b_motion->pppi_ref[0][2] += i_chrom_vsize; \
} \
p_dest[0] += 16 * i_offset; \
p_dest[1] += 4 * i_offset; \
p_dest[2] += 4 * i_offset; \
p_dest[0] += i_lum_vsize; \
p_dest[1] += i_chrom_vsize; \
p_dest[2] += i_chrom_vsize; \
i_offset = 0; \
} \
p_vpar->mb.i_offset = i_offset;
......@@ -1769,7 +1769,7 @@ static __inline__ void ParseSlice( vpar_thread_t * p_vpar,
u32 i_vert_code, boolean_t b_mpeg2,
int i_coding_type, int i_structure )
{
int i_offset, i_width, i_chroma_tmp;
int i_lum_offset, i_chrom_offset, i_offset, i_lum_vsize, i_chrom_vsize;
picture_t * pp_forward_ref[2];
yuv_data_t * p_dest[3];
......@@ -1791,19 +1791,23 @@ static __inline__ void ParseSlice( vpar_thread_t * p_vpar,
}
/* Calculate the position of the macroblock. */
i_width = p_vpar->sequence.i_width;
i_offset = (i_vert_code - 1) * i_width * 4;
i_lum_offset = (i_vert_code - 1) * p_vpar->picture.p_picture->Y_PITCH * 16;
i_chrom_offset = (i_vert_code - 1) * p_vpar->picture.p_picture->U_PITCH
* 8 * (2 - p_vpar->sequence.b_chroma_v_subsampled);
i_lum_vsize = 16 * p_vpar->picture.p_picture->Y_PITCH;
i_chrom_vsize = 8 * (2 - p_vpar->sequence.b_chroma_v_subsampled)
* p_vpar->picture.p_picture->U_PITCH;
/* Initialize motion context. */
pp_forward_ref[0] = p_vpar->sequence.p_forward;
if( i_structure != FRAME_STRUCTURE )
{
i_offset <<= 1;
i_chroma_tmp =
i_offset * (2 - p_vpar->sequence.b_chroma_v_subsampled)
* (2 - p_vpar->sequence.b_chroma_h_subsampled)
+ (i_width >> p_vpar->sequence.b_chroma_h_subsampled);
i_lum_offset <<= 1;
i_chrom_offset <<= 1;
i_lum_vsize <<= 1;
i_chrom_vsize <<= 1;
pp_forward_ref[1] = p_vpar->sequence.p_forward;
if( i_coding_type != B_CODING_TYPE && p_vpar->picture.b_second_field )
......@@ -1813,32 +1817,34 @@ static __inline__ void ParseSlice( vpar_thread_t * p_vpar,
}
if( i_coding_type != I_CODING_TYPE || p_vpar->picture.b_concealment_mv )
{
p_f_motion->pppi_ref[1][0] =
pp_forward_ref[1]->Y_PIXELS + i_offset * 4 + i_width;
p_f_motion->pppi_ref[1][1] =
pp_forward_ref[1]->U_PIXELS + i_chroma_tmp;
p_f_motion->pppi_ref[1][2] =
pp_forward_ref[1]->V_PIXELS + i_chroma_tmp;
int i_tmp;
p_f_motion->pppi_ref[1][0] = pp_forward_ref[1]->Y_PIXELS +
i_lum_offset + pp_forward_ref[1]->Y_PITCH;
p_f_motion->pppi_ref[1][1] = pp_forward_ref[1]->U_PIXELS +
(i_tmp = i_chrom_offset + pp_forward_ref[1]->U_PITCH);
p_f_motion->pppi_ref[1][2] = pp_forward_ref[1]->V_PIXELS +
i_tmp;
}
if( i_coding_type == B_CODING_TYPE )
{
p_b_motion->pppi_ref[1][0] =
p_vpar->sequence.p_backward->Y_PIXELS + i_offset * 4 + i_width;
p_b_motion->pppi_ref[1][1] =
p_vpar->sequence.p_backward->U_PIXELS + i_chroma_tmp;
p_b_motion->pppi_ref[1][2] =
p_vpar->sequence.p_backward->V_PIXELS + i_chroma_tmp;
int i_tmp;
p_b_motion->pppi_ref[1][0] = p_vpar->sequence.p_backward->Y_PIXELS
+ i_lum_offset + p_vpar->sequence.p_backward->Y_PITCH;
p_b_motion->pppi_ref[1][1] = p_vpar->sequence.p_backward->U_PIXELS
+ (i_tmp = i_chrom_offset + p_vpar->sequence.p_backward->U_PITCH);
p_b_motion->pppi_ref[1][2] = p_vpar->sequence.p_backward->V_PIXELS
+ i_tmp;
}
}
i_chroma_tmp = i_offset
* (2 - p_vpar->sequence.b_chroma_v_subsampled)
* (2 - p_vpar->sequence.b_chroma_h_subsampled);
if( i_coding_type != I_CODING_TYPE || p_vpar->picture.b_concealment_mv )
{
p_f_motion->pppi_ref[0][0] = pp_forward_ref[0]->Y_PIXELS + i_offset * 4;
p_f_motion->pppi_ref[0][1] = pp_forward_ref[0]->U_PIXELS + i_chroma_tmp;
p_f_motion->pppi_ref[0][2] = pp_forward_ref[0]->V_PIXELS + i_chroma_tmp;
p_f_motion->pppi_ref[0][0] = pp_forward_ref[0]->Y_PIXELS +
i_lum_offset;
p_f_motion->pppi_ref[0][1] = pp_forward_ref[0]->U_PIXELS +
i_chrom_offset;
p_f_motion->pppi_ref[0][2] = pp_forward_ref[0]->V_PIXELS +
i_chrom_offset;
p_f_motion->pi_f_code[0] = p_vpar->picture.ppi_f_code[0][0];
p_f_motion->pi_f_code[1] = p_vpar->picture.ppi_f_code[0][1];
p_f_motion->ppi_pmv[0][0] = p_f_motion->ppi_pmv[0][1] = 0;
......@@ -1847,12 +1853,12 @@ static __inline__ void ParseSlice( vpar_thread_t * p_vpar,
if( i_coding_type == B_CODING_TYPE )
{
p_b_motion->pppi_ref[0][0] = p_vpar->sequence.p_backward->Y_PIXELS
+ i_offset * 4;
p_b_motion->pppi_ref[0][1] = p_vpar->sequence.p_backward->U_PIXELS
+ i_chroma_tmp;
p_b_motion->pppi_ref[0][2] = p_vpar->sequence.p_backward->V_PIXELS
+ i_chroma_tmp;
p_b_motion->pppi_ref[0][0] = p_vpar->sequence.p_backward->Y_PIXELS +
i_lum_offset;
p_b_motion->pppi_ref[0][1] = p_vpar->sequence.p_backward->U_PIXELS +
i_chrom_offset;
p_b_motion->pppi_ref[0][2] = p_vpar->sequence.p_backward->V_PIXELS +
i_chrom_offset;
p_b_motion->pi_f_code[0] = p_vpar->picture.ppi_f_code[1][0];
p_b_motion->pi_f_code[1] = p_vpar->picture.ppi_f_code[1][1];
p_b_motion->ppi_pmv[0][0] = p_b_motion->ppi_pmv[0][1] = 0;
......@@ -1860,17 +1866,19 @@ static __inline__ void ParseSlice( vpar_thread_t * p_vpar,
}
/* Initialize destination pointers. */
p_dest[0] = p_vpar->picture.p_picture->Y_PIXELS + i_offset * 4;
p_dest[1] = p_vpar->picture.p_picture->U_PIXELS + i_chroma_tmp;
p_dest[2] = p_vpar->picture.p_picture->V_PIXELS + i_chroma_tmp;
p_dest[0] = p_vpar->picture.p_picture->Y_PIXELS +
i_lum_offset;
p_dest[1] = p_vpar->picture.p_picture->U_PIXELS +
i_chrom_offset;
p_dest[2] = p_vpar->picture.p_picture->V_PIXELS +
i_chrom_offset;
if( i_structure == BOTTOM_FIELD )
{
p_dest[0] += i_width;
p_dest[1] += i_width >> p_vpar->sequence.b_chroma_h_subsampled;
p_dest[2] += i_width >> p_vpar->sequence.b_chroma_h_subsampled;
p_dest[0] += p_vpar->picture.p_picture->Y_PITCH;
p_dest[1] += p_vpar->picture.p_picture->U_PITCH;
p_dest[2] += p_vpar->picture.p_picture->U_PITCH;
}
i_width = p_vpar->picture.i_field_width;
/* Reset intra DC coefficients predictors (ISO/IEC 13818-2 7.2.1). */
p_vpar->mb.pi_dc_dct_pred[0] = p_vpar->mb.pi_dc_dct_pred[1]
......@@ -1879,22 +1887,22 @@ static __inline__ void ParseSlice( vpar_thread_t * p_vpar,
p_vpar->mb.i_offset = MacroblockAddressIncrement( p_vpar ) << 4;
i_chroma_tmp = i_width * 4
* (2 - p_vpar->sequence.b_chroma_v_subsampled)
* (2 - p_vpar->sequence.b_chroma_h_subsampled);
while( (int)(p_vpar->mb.i_offset - p_vpar->sequence.i_width) >= 0 )
{
/* Unusual construct at the start of some slices. Jump one line. */
p_vpar->mb.i_offset -= p_vpar->sequence.i_width;
p_dest[0] += i_width * 16;
p_dest[1] += i_chroma_tmp;
p_dest[2] += i_chroma_tmp;
p_f_motion->pppi_ref[0][0] += i_width * 16;
p_f_motion->pppi_ref[0][1] += i_chroma_tmp;
p_f_motion->pppi_ref[0][2] += i_chroma_tmp;
p_f_motion->pppi_ref[1][0] += i_width * 16;
p_f_motion->pppi_ref[1][1] += i_chroma_tmp;
p_f_motion->pppi_ref[1][2] += i_chroma_tmp;
p_dest[0] += i_lum_vsize;
p_dest[1] += i_chrom_vsize;
p_dest[2] += i_chrom_vsize;
p_f_motion->pppi_ref[0][0] += i_lum_vsize;
p_f_motion->pppi_ref[0][1] += i_chrom_vsize;
p_f_motion->pppi_ref[0][2] += i_chrom_vsize;
p_f_motion->pppi_ref[1][0] += i_lum_vsize;
p_f_motion->pppi_ref[1][1] += i_chrom_vsize;
p_f_motion->pppi_ref[1][2] += i_chrom_vsize;
}
for( ; ; )
......@@ -1906,9 +1914,9 @@ static __inline__ void ParseSlice( vpar_thread_t * p_vpar,
/* Get a macroblock structure. */
p_mb = p_vpar->pool.pf_new_mb( &p_vpar->pool );
p_mb->i_nb_motions = 0;
p_mb->pp_dest[0] = p_dest[0];
p_mb->pp_dest[1] = p_dest[1];
p_mb->pp_dest[2] = p_dest[2];
p_mb->pp_dest[0] = p_dest[0];
p_mb->pp_dest[1] = p_dest[1];
p_mb->pp_dest[2] = p_dest[2];
/* Parse off macroblock_modes structure. */
p_mb->i_mb_modes = i_mb_modes =
......
......@@ -2,7 +2,7 @@
* vpar_headers.c : headers parsing
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: vpar_headers.c,v 1.17 2002/03/17 17:00:38 sam Exp $
* $Id: vpar_headers.c,v 1.18 2002/04/15 23:04:08 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr>
......@@ -843,8 +843,6 @@ static void PictureHeader( vpar_thread_t * p_vpar )
/* Initialize values. */
vpar_SynchroDecode( p_vpar, p_vpar->picture.i_coding_type, i_structure );
P_picture->i_matrix_coefficients = p_vpar->sequence.i_matrix_coefficients;
p_vpar->picture.i_field_width = ( p_vpar->sequence.i_width
<< ( 1 - p_vpar->picture.b_frame_structure ) );
/* Update the reference pointers. */
ReferenceUpdate( p_vpar, p_vpar->picture.i_coding_type, P_picture );
......@@ -857,6 +855,13 @@ static void PictureHeader( vpar_thread_t * p_vpar )
(i_structure != p_vpar->picture.i_current_structure);
p_vpar->picture.b_current_field =
(i_structure == BOTTOM_FIELD );
p_vpar->picture.i_lum_stride = p_vpar->picture.p_picture->Y_PITCH
<< ( 1 - p_vpar->picture.b_frame_structure );
p_vpar->picture.i_chrom_stride = p_vpar->picture.p_picture->U_PITCH
<< ( 1 - p_vpar->picture.b_frame_structure );
/* We suppose the pitch is the same for U and V planes. */
p_vpar->picture.i_field_width = p_vpar->sequence.i_width
<< ( 1 - p_vpar->picture.b_frame_structure );
if( !p_vpar->p_config->p_stream_ctrl->b_grayscale )
{
......
......@@ -2,7 +2,7 @@
* vout_pictures.c : picture management functions
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: vout_pictures.c,v 1.20 2002/04/05 01:05:22 gbazin Exp $
* $Id: vout_pictures.c,v 1.21 2002/04/15 23:04:08 massiot Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -427,36 +427,46 @@ void vout_AllocatePicture( picture_t *p_pic,
case FOURCC_IYUV:
p_pic->p[ Y_PLANE ].i_lines = i_height;
p_pic->p[ Y_PLANE ].i_pitch = i_width;
p_pic->p[ Y_PLANE ].i_visible_bytes = p_pic->p[ Y_PLANE ].i_pitch;
p_pic->p[ U_PLANE ].i_lines = i_height / 2;
p_pic->p[ U_PLANE ].i_pitch = i_width / 2;
p_pic->p[ U_PLANE ].i_visible_bytes = p_pic->p[ U_PLANE ].i_pitch;
p_pic->p[ V_PLANE ].i_lines = i_height / 2;
p_pic->p[ V_PLANE ].i_pitch = i_width / 2;
p_pic->p[ V_PLANE ].i_visible_bytes = p_pic->p[ V_PLANE ].i_pitch;
p_pic->i_planes = 3;
break;
case FOURCC_I422:
p_pic->p[ Y_PLANE ].i_lines = i_height;
p_pic->p[ Y_PLANE ].i_pitch = i_width;
p_pic->p[ Y_PLANE ].i_visible_bytes = p_pic->p[ Y_PLANE ].i_pitch;
p_pic->p[ U_PLANE ].i_lines = i_height;
p_pic->p[ U_PLANE ].i_pitch = i_width / 2;
p_pic->p[ U_PLANE ].i_visible_bytes = p_pic->p[ U_PLANE ].i_pitch;
p_pic->p[ V_PLANE ].i_lines = i_height;
p_pic->p[ V_PLANE ].i_pitch = i_width / 2;
p_pic->p[ V_PLANE ].i_visible_bytes = p_pic->p[ V_PLANE ].i_pitch;
p_pic->i_planes = 3;
break;
case FOURCC_I444:
p_pic->p[ Y_PLANE ].i_lines = i_height;
p_pic->p[ Y_PLANE ].i_pitch = i_width;
p_pic->p[ Y_PLANE ].i_visible_bytes = p_pic->p[ Y_PLANE ].i_pitch;
p_pic->p[ U_PLANE ].i_lines = i_height;
p_pic->p[ U_PLANE ].i_pitch = i_width;
p_pic->p[ U_PLANE ].i_visible_bytes = p_pic->p[ U_PLANE ].i_pitch;
p_pic->p[ V_PLANE ].i_lines = i_height;
p_pic->p[ V_PLANE ].i_pitch = i_width;
p_pic->p[ V_PLANE ].i_visible_bytes = p_pic->p[ V_PLANE ].i_pitch;
p_pic->i_planes = 3;
break;
case FOURCC_Y211:
p_pic->p->i_lines = i_height;
p_pic->p->i_pitch = i_width;
p_pic->p->i_visible_bytes = p_pic->p->i_pitch;
p_pic->p->i_pixel_bytes = 4;
p_pic->i_planes = 1;
break;
......@@ -464,6 +474,7 @@ void vout_AllocatePicture( picture_t *p_pic,
case FOURCC_RV15:
p_pic->p->i_lines = i_height;
p_pic->p->i_pitch = i_width * 2;
p_pic->p->i_visible_bytes = p_pic->p->i_pitch;
p_pic->p->i_pixel_bytes = 2;
p_pic->p_heap->i_rmask = 0x001f;
p_pic->p_heap->i_gmask = 0x03e0;
......@@ -474,6 +485,7 @@ void vout_AllocatePicture( picture_t *p_pic,
case FOURCC_RV16:
p_pic->p->i_lines = i_height;
p_pic->p->i_pitch = i_width * 2;
p_pic->p->i_visible_bytes = p_pic->p->i_pitch;
p_pic->p->i_pixel_bytes = 2;
p_pic->p_heap->i_rmask = 0x001f;
p_pic->p_heap->i_gmask = 0x07e0;
......@@ -484,6 +496,7 @@ void vout_AllocatePicture( picture_t *p_pic,
case FOURCC_RV32:
p_pic->p->i_lines = i_height;
p_pic->p->i_pitch = i_width * 4;
p_pic->p->i_visible_bytes = p_pic->p->i_pitch;
p_pic->p->i_pixel_bytes = 4;
p_pic->p_heap->i_rmask = 0xff0000;
p_pic->p_heap->i_gmask = 0x00ff00;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment