Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
aab60d48
Commit
aab60d48
authored
Jan 26, 2000
by
Christophe Massiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Nettoyage et commentationnement.
parent
ba8d1d4c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
92 deletions
+105
-92
include/video_parser.h
include/video_parser.h
+1
-7
include/vpar_blocks.h
include/vpar_blocks.h
+33
-26
include/vpar_headers.h
include/vpar_headers.h
+46
-34
src/video_parser/vpar_blocks.c
src/video_parser/vpar_blocks.c
+25
-25
No files found.
include/video_parser.h
View file @
aab60d48
...
...
@@ -96,7 +96,6 @@ typedef struct vpar_thread_s
/* Parser properties */
sequence_t
sequence
;
picture_parsing_t
picture
;
slice_parsing_t
slice
;
macroblock_parsing_t
mb
;
video_synchro_t
synchro
;
...
...
@@ -130,11 +129,6 @@ typedef struct vpar_thread_s
#endif
}
vpar_thread_t
;
/* Chroma types */
#define CHROMA_420 1
#define CHROMA_422 2
#define CHROMA_444 3
/*****************************************************************************
* Prototypes
*****************************************************************************/
...
...
@@ -194,7 +188,7 @@ static __inline__ void LoadQuantizerScale( struct vpar_thread_s * p_vpar )
}
};
p_vpar
->
slice
.
i_quantizer_scale
=
ppi_quantizer_scale
p_vpar
->
mb
.
i_quantizer_scale
=
ppi_quantizer_scale
[(
!
p_vpar
->
sequence
.
b_mpeg2
<<
1
)
|
p_vpar
->
picture
.
b_q_scale_type
]
[
GetBits
(
&
p_vpar
->
bit_stream
,
5
)];
}
...
...
include/vpar_blocks.h
View file @
aab60d48
...
...
@@ -16,33 +16,34 @@
*****************************************************************************/
/*****************************************************************************
* Function pointers
*****************************************************************************/
typedef
void
(
*
f_parse_mb_t
)(
struct
vpar_thread_s
*
,
int
*
,
int
,
int
,
boolean_t
,
int
,
int
,
int
,
boolean_t
);
/*****************************************************************************
* macroblock_t : information on a macroblock
* macroblock_t : information on a macroblock passed to the video_decoder
* thread
*****************************************************************************/
typedef
struct
macroblock_s
{
picture_t
*
p_picture
;
/* current frame in progress */
int
i_mb_type
;
/* macroblock type */
int
i_coded_block_pattern
;
int
i_chroma_nb_blocks
;
/* nb of bks for a chr comp */
picture_t
*
p_picture
;
/* which blocks are coded ? */
int
i_chroma_nb_blocks
;
/* number of blocks for
* chroma components */
/* IDCT information */
dctelem_t
ppi_blocks
[
12
][
64
];
/* blocks */
f_idct_t
pf_idct
[
12
];
/* sparse IDCT or not ? */
int
pi_sparse_pos
[
12
];
int
pi_sparse_pos
[
12
];
/* position of the
* non-NULL coeff */
/* Motion compensation information */
f_motion_t
pf_motion
;
/* function to use for motion comp */
picture_t
*
p_backward
;
picture_t
*
p_forward
;
int
ppi_field_select
[
2
][
2
];
int
pppi_motion_vectors
[
2
][
2
][
2
];
int
ppi_dmv
[
2
][
2
];
picture_t
*
p_backward
;
/* backward reference frame */
picture_t
*
p_forward
;
/* forward reference frame */
int
ppi_field_select
[
2
][
2
];
/* field to use to
* form predictions */
int
pppi_motion_vectors
[
2
][
2
][
2
];
/* motion vectors */
int
ppi_dmv
[
2
][
2
];
/* differential motion vectors */
/* coordinates of the block in the picture */
int
i_l_x
,
i_c_x
;
int
i_motion_l_y
;
int
i_motion_c_y
;
...
...
@@ -63,20 +64,27 @@ typedef struct macroblock_s
}
macroblock_t
;
/*****************************************************************************
* macroblock_parsing_t :
parser context descriptor #3
* macroblock_parsing_t :
macroblock context & predictors
*****************************************************************************/
typedef
struct
{
int
i_motion_type
,
i_mv_count
,
i_mv_format
;
boolean_t
b_dmv
,
b_dct_type
;
int
i_l_x
,
i_l_y
,
i_c_x
,
i_c_y
;
unsigned
char
i_quantizer_scale
;
/* scale of the quantization
* matrices */
int
pi_dc_dct_pred
[
3
];
/* ISO/IEC 13818-2 7.2.1 */
int
pppi_pmv
[
2
][
2
][
2
];
/* Motion vect predictors, 7.6.3 */
/* Context used to optimize block parsing */
int
i_motion_type
,
i_mv_count
,
i_mv_format
;
boolean_t
b_dmv
,
b_dct_type
;
/* Coordinates of the upper-left pixel of the macroblock, in lum and
* chroma */
int
i_l_x
,
i_l_y
,
i_c_x
,
i_c_y
;
}
macroblock_parsing_t
;
/*****************************************************************************
* lookup_t : entry type for lookup tables *
*****************************************************************************/
typedef
struct
lookup_s
{
int
i_value
;
...
...
@@ -86,7 +94,6 @@ typedef struct lookup_s
/******************************************************************************
* ac_lookup_t : special entry type for lookup tables about ac coefficients
*****************************************************************************/
typedef
struct
dct_lookup_s
{
char
i_run
;
...
...
@@ -118,12 +125,12 @@ typedef struct dct_lookup_s
#define MB_ERROR (-1)
/* Scan */
#define SCAN_ZIGZAG
0
#define SCAN_ALT
1
#define SCAN_ZIGZAG 0
#define SCAN_ALT 1
/* Constant for block decoding */
#define DCT_EOB
64
#define DCT_ESCAPE
65
#define DCT_EOB 64
#define DCT_ESCAPE 65
/*****************************************************************************
* Constants
...
...
include/vpar_headers.h
View file @
aab60d48
...
...
@@ -27,28 +27,41 @@ typedef struct quant_matrix_s
/*****************************************************************************
* sequence_t : sequence descriptor
*****************************************************************************
* This structure should only be changed when reading the sequence header,
* or exceptionnally some extension structures (like quant_matrix).
*****************************************************************************/
typedef
struct
sequence_s
{
u32
i_height
,
i_width
,
i_size
;
u32
i_height
,
i_width
;
/* height and width of the lum
* comp of the picture */
u32
i_size
;
/* total number of pel of the lum comp */
u32
i_mb_height
,
i_mb_width
,
i_mb_size
;
unsigned
int
i_aspect_ratio
,
i_matrix_coefficients
;
float
r_frame_rate
;
boolean_t
b_mpeg2
;
boolean_t
b_progressive
;
unsigned
int
i_scalable_mode
;
/* the same, in macroblock units */
unsigned
int
i_aspect_ratio
;
/* height/width display ratio */
unsigned
int
i_matrix_coefficients
;
/* coeffs of the YUV transform */
float
r_frame_rate
;
/* theoritical frame rate in fps */
boolean_t
b_mpeg2
;
/* guess */
boolean_t
b_progressive
;
/* progressive (ie.
* non-interlaced) frame */
unsigned
int
i_scalable_mode
;
/* scalability ; unsupported, but
* modifies the syntax of the binary
* stream. */
quant_matrix_t
intra_quant
,
nonintra_quant
;
quant_matrix_t
chroma_intra_quant
,
chroma_nonintra_quant
;
/* current quantization matrices */
/* Chromatic information */
unsigned
int
i_chroma_format
;
int
i_chroma_nb_blocks
;
u32
i_chroma_width
;
unsigned
int
i_chroma_format
;
/* see CHROMA_* below */
int
i_chroma_nb_blocks
;
/* number of chroma blocks */
u32
i_chroma_width
;
/* width of a line of the chroma comp */
u32
i_chroma_mb_width
,
i_chroma_mb_height
;
/* size of a macroblock in the chroma buffer
* (eg. 8x8 or 8x16 or 16x16) */
/* Parser context */
picture_t
*
p_forward
;
picture_t
*
p_backward
;
picture_t
*
p_forward
;
/* current forward reference frame */
picture_t
*
p_backward
;
/* current backward reference frame */
/* Copyright extension */
boolean_t
b_copyright_flag
;
/* Whether the following
...
...
@@ -61,12 +74,17 @@ typedef struct sequence_s
/*****************************************************************************
* picture_parsing_t : parser context descriptor
*****************************************************************************
* This structure should only be changed when reading the picture header.
*****************************************************************************/
typedef
struct
picture_parsing_s
{
/* ISO/CEI 11172-2 backward compatibility */
boolean_t
pb_full_pel_vector
[
2
];
int
i_forward_f_code
,
i_backward_f_code
;
/* Values from the picture_coding_extension. Please refer to ISO/IEC
* 13818-2. */
int
ppi_f_code
[
2
][
2
];
int
i_intra_dc_precision
;
boolean_t
b_frame_pred_frame_dct
,
b_q_scale_type
;
...
...
@@ -74,35 +92,24 @@ typedef struct picture_parsing_s
boolean_t
b_alternate_scan
,
b_progressive_frame
;
boolean_t
b_top_field_first
,
b_concealment_mv
;
boolean_t
b_repeat_first_field
;
int
i_l_stride
,
i_c_stride
;
f_parse_mb_t
pf_parse_mb
;
/* Used for second field management */
int
i_current_structure
;
/* Relative to the current field */
int
i_coding_type
,
i_structure
;
boolean_t
b_frame_structure
;
/* i_structure == FRAME_STRUCTURE */
picture_t
*
p_picture
;
picture_t
*
p_picture
;
/* picture buffer from vout */
int
i_current_structure
;
/* current parsed structure of
* p_picture (second field ?) */
#ifdef VDEC_SMP
macroblock_t
*
pp_mb
[
MAX_MB
];
macroblock_t
*
pp_mb
[
MAX_MB
];
/* macroblock buffer to
* send to the vdec thread(s) */
#endif
boolean_t
b_error
;
/* parsing error, try to recover */
/* Relative to the current field */
int
i_coding_type
,
i_structure
;
boolean_t
b_frame_structure
;
boolean_t
b_error
;
int
i_l_stride
,
i_c_stride
;
/* number of coeffs to jump when changing
* lines (different with field pictures) */
}
picture_parsing_t
;
/*****************************************************************************
* slice_parsing_t : parser context descriptor #2
*****************************************************************************/
typedef
struct
slice_parsing_s
{
unsigned
char
i_quantizer_scale
;
int
pi_dc_dct_pred
[
3
];
/* ISO/IEC 13818-2 7.2.1 */
int
pppi_pmv
[
2
][
2
][
2
];
/* Motion vect predictors, 7.6.3 */
}
slice_parsing_t
;
/*****************************************************************************
* Standard codes
*****************************************************************************/
...
...
@@ -134,6 +141,11 @@ typedef struct slice_parsing_s
#define SC_SNR 3
#define SC_TEMP 4
/* Chroma types */
#define CHROMA_420 1
#define CHROMA_422 2
#define CHROMA_444 3
/* Pictures types */
#define I_CODING_TYPE 1
#define P_CODING_TYPE 2
...
...
src/video_parser/vpar_blocks.c
View file @
aab60d48
...
...
@@ -713,7 +713,7 @@ static __inline__ void DecodeMPEG2NonIntra( vpar_thread_t * p_vpar,
}
i_pos
=
pi_scan
[
p_vpar
->
picture
.
b_alternate_scan
][
i_parse
];
i_level
=
(
((
i_level
<<
1
)
+
1
)
*
p_vpar
->
slice
.
i_quantizer_scale
i_level
=
(
((
i_level
<<
1
)
+
1
)
*
p_vpar
->
mb
.
i_quantizer_scale
*
pi_quant
[
i_pos
]
)
>>
5
;
p_mb
->
ppi_blocks
[
i_b
][
i_pos
]
=
b_sign
?
-
i_level
:
i_level
;
}
...
...
@@ -830,11 +830,11 @@ static __inline__ void DecodeMPEG2Intra( vpar_thread_t * p_vpar,
// p_vpar->pppl_dct_dc_size[i_type][i_select][i_pos].i_length );
/* Read the actual code with the good length */
p_vpar
->
slice
.
pi_dc_dct_pred
[
i_cc
]
+=
i_dct_dc_diff
;
p_vpar
->
mb
.
pi_dc_dct_pred
[
i_cc
]
+=
i_dct_dc_diff
;
p_mb
->
ppi_blocks
[
i_b
][
0
]
=
(
p_vpar
->
slice
.
pi_dc_dct_pred
[
i_cc
]
<<
p_mb
->
ppi_blocks
[
i_b
][
0
]
=
(
p_vpar
->
mb
.
pi_dc_dct_pred
[
i_cc
]
<<
(
3
-
p_vpar
->
picture
.
i_intra_dc_precision
)
);
i_nc
=
(
p_vpar
->
slice
.
pi_dc_dct_pred
[
i_cc
]
!=
0
);
i_nc
=
(
p_vpar
->
mb
.
pi_dc_dct_pred
[
i_cc
]
!=
0
);
/* Decoding of the AC coefficients */
...
...
@@ -955,7 +955,7 @@ static __inline__ void DecodeMPEG2Intra( vpar_thread_t * p_vpar,
i_pos
=
pi_scan
[
p_vpar
->
picture
.
b_alternate_scan
][
i_parse
];
i_level
=
(
i_level
*
p_vpar
->
slice
.
i_quantizer_scale
*
p_vpar
->
mb
.
i_quantizer_scale
*
pi_quant
[
i_pos
]
)
>>
4
;
p_mb
->
ppi_blocks
[
i_b
][
i_pos
]
=
b_sign
?
-
i_level
:
i_level
;
}
...
...
@@ -1060,9 +1060,9 @@ static __inline__ void MotionVector( vpar_thread_t * p_vpar,
i_motion_code
=
MotionCode
(
p_vpar
);
i_motion_residual
=
(
i_r_size
!=
0
&&
i_motion_code
!=
0
)
?
GetBits
(
&
p_vpar
->
bit_stream
,
i_r_size
)
:
0
;
DecodeMotionVector
(
&
p_vpar
->
slice
.
pppi_pmv
[
i_r
][
i_s
][
0
],
i_r_size
,
DecodeMotionVector
(
&
p_vpar
->
mb
.
pppi_pmv
[
i_r
][
i_s
][
0
],
i_r_size
,
i_motion_code
,
i_motion_residual
,
i_full_pel
);
p_mb
->
pppi_motion_vectors
[
i_r
][
i_s
][
0
]
=
p_vpar
->
slice
.
pppi_pmv
[
i_r
][
i_s
][
0
];
p_mb
->
pppi_motion_vectors
[
i_r
][
i_s
][
0
]
=
p_vpar
->
mb
.
pppi_pmv
[
i_r
][
i_s
][
0
];
if
(
p_vpar
->
mb
.
b_dmv
)
{
...
...
@@ -1085,17 +1085,17 @@ static __inline__ void MotionVector( vpar_thread_t * p_vpar,
if
(
(
p_vpar
->
mb
.
i_mv_format
==
MOTION_FIELD
)
&&
(
i_structure
==
FRAME_STRUCTURE
)
)
{
p_vpar
->
slice
.
pppi_pmv
[
i_r
][
i_s
][
1
]
>>=
1
;
p_vpar
->
mb
.
pppi_pmv
[
i_r
][
i_s
][
1
]
>>=
1
;
}
DecodeMotionVector
(
&
p_vpar
->
slice
.
pppi_pmv
[
i_r
][
i_s
][
1
],
i_r_size
,
DecodeMotionVector
(
&
p_vpar
->
mb
.
pppi_pmv
[
i_r
][
i_s
][
1
],
i_r_size
,
i_motion_code
,
i_motion_residual
,
i_full_pel
);
if
(
(
p_vpar
->
mb
.
i_mv_format
==
MOTION_FIELD
)
&&
(
i_structure
==
FRAME_STRUCTURE
)
)
p_vpar
->
slice
.
pppi_pmv
[
i_r
][
i_s
][
1
]
<<=
1
;
p_vpar
->
mb
.
pppi_pmv
[
i_r
][
i_s
][
1
]
<<=
1
;
p_mb
->
pppi_motion_vectors
[
i_r
][
i_s
][
1
]
=
p_vpar
->
slice
.
pppi_pmv
[
i_r
][
i_s
][
1
];
p_mb
->
pppi_motion_vectors
[
i_r
][
i_s
][
1
]
=
p_vpar
->
mb
.
pppi_pmv
[
i_r
][
i_s
][
1
];
if
(
p_vpar
->
mb
.
b_dmv
)
{
...
...
@@ -1178,10 +1178,10 @@ static __inline__ void DecodeMVMPEG2( vpar_thread_t * p_vpar,
=
GetBits
(
&
p_vpar
->
bit_stream
,
1
);
}
MotionVector
(
p_vpar
,
p_mb
,
0
,
i_s
,
0
,
i_structure
);
p_vpar
->
slice
.
pppi_pmv
[
1
][
i_s
][
0
]
=
p_vpar
->
slice
.
pppi_pmv
[
0
][
i_s
][
0
];
p_vpar
->
slice
.
pppi_pmv
[
1
][
i_s
][
1
]
=
p_vpar
->
slice
.
pppi_pmv
[
0
][
i_s
][
1
];
p_mb
->
pppi_motion_vectors
[
1
][
i_s
][
0
]
=
p_vpar
->
slice
.
pppi_pmv
[
0
][
i_s
][
0
];
p_mb
->
pppi_motion_vectors
[
1
][
i_s
][
1
]
=
p_vpar
->
slice
.
pppi_pmv
[
0
][
i_s
][
1
];
p_vpar
->
mb
.
pppi_pmv
[
1
][
i_s
][
0
]
=
p_vpar
->
mb
.
pppi_pmv
[
0
][
i_s
][
0
];
p_vpar
->
mb
.
pppi_pmv
[
1
][
i_s
][
1
]
=
p_vpar
->
mb
.
pppi_pmv
[
0
][
i_s
][
1
];
p_mb
->
pppi_motion_vectors
[
1
][
i_s
][
0
]
=
p_vpar
->
mb
.
pppi_pmv
[
0
][
i_s
][
0
];
p_mb
->
pppi_motion_vectors
[
1
][
i_s
][
1
]
=
p_vpar
->
mb
.
pppi_pmv
[
0
][
i_s
][
1
];
}
else
{
...
...
@@ -1622,14 +1622,14 @@ static __inline__ void ParseMacroblock(
/* Skipped macroblock (ISO/IEC 13818-2 7.6.6). */
/* Reset DC predictors (7.2.1). */
p_vpar
->
slice
.
pi_dc_dct_pred
[
0
]
=
p_vpar
->
slice
.
pi_dc_dct_pred
[
1
]
=
p_vpar
->
slice
.
pi_dc_dct_pred
[
2
]
p_vpar
->
mb
.
pi_dc_dct_pred
[
0
]
=
p_vpar
->
mb
.
pi_dc_dct_pred
[
1
]
=
p_vpar
->
mb
.
pi_dc_dct_pred
[
2
]
=
1
<<
(
7
+
p_vpar
->
picture
.
i_intra_dc_precision
);
if
(
i_coding_type
==
P_CODING_TYPE
)
{
/* Reset motion vector predictors (ISO/IEC 13818-2 7.6.3.4). */
memset
(
p_vpar
->
slice
.
pppi_pmv
,
0
,
8
*
sizeof
(
int
)
);
memset
(
p_vpar
->
mb
.
pppi_pmv
,
0
,
8
*
sizeof
(
int
)
);
}
for
(
i_mb
=
i_mb_previous
+
1
;
i_mb
<
*
pi_mb_address
;
i_mb
++
)
...
...
@@ -1684,7 +1684,7 @@ static __inline__ void ParseMacroblock(
{
/* Special No-MC macroblock in P pictures (7.6.3.5). */
p_mb
->
i_mb_type
|=
MB_MOTION_FORWARD
;
memset
(
p_vpar
->
slice
.
pppi_pmv
,
0
,
8
*
sizeof
(
int
)
);
memset
(
p_vpar
->
mb
.
pppi_pmv
,
0
,
8
*
sizeof
(
int
)
);
memset
(
p_mb
->
pppi_motion_vectors
,
0
,
8
*
sizeof
(
int
)
);
p_vpar
->
mb
.
i_motion_type
=
1
+
(
i_structure
==
FRAME_STRUCTURE
);
p_mb
->
ppi_field_select
[
0
][
0
]
=
(
i_structure
==
BOTTOM_FIELD
);
...
...
@@ -1693,8 +1693,8 @@ static __inline__ void ParseMacroblock(
if
(
(
i_coding_type
!=
I_CODING_TYPE
)
&&
!
(
p_mb
->
i_mb_type
&
MB_INTRA
)
)
{
/* Reset DC predictors (7.2.1). */
p_vpar
->
slice
.
pi_dc_dct_pred
[
0
]
=
p_vpar
->
slice
.
pi_dc_dct_pred
[
1
]
=
p_vpar
->
slice
.
pi_dc_dct_pred
[
2
]
p_vpar
->
mb
.
pi_dc_dct_pred
[
0
]
=
p_vpar
->
mb
.
pi_dc_dct_pred
[
1
]
=
p_vpar
->
mb
.
pi_dc_dct_pred
[
2
]
=
1
<<
(
7
+
p_vpar
->
picture
.
i_intra_dc_precision
);
/* Motion function pointer. */
...
...
@@ -1731,7 +1731,7 @@ static __inline__ void ParseMacroblock(
if
(
!
p_vpar
->
picture
.
b_concealment_mv
)
{
/* Reset MV predictors. */
memset
(
p_vpar
->
slice
.
pppi_pmv
,
0
,
8
*
sizeof
(
int
)
);
memset
(
p_vpar
->
mb
.
pppi_pmv
,
0
,
8
*
sizeof
(
int
)
);
}
else
{
...
...
@@ -1830,12 +1830,12 @@ static __inline__ void SliceHeader( vpar_thread_t * p_vpar,
*
pi_mb_address
=
(
i_vert_code
-
1
)
*
p_vpar
->
sequence
.
i_mb_width
;
/* Reset DC coefficients predictors (ISO/IEC 13818-2 7.2.1). */
p_vpar
->
slice
.
pi_dc_dct_pred
[
0
]
=
p_vpar
->
slice
.
pi_dc_dct_pred
[
1
]
=
p_vpar
->
slice
.
pi_dc_dct_pred
[
2
]
p_vpar
->
mb
.
pi_dc_dct_pred
[
0
]
=
p_vpar
->
mb
.
pi_dc_dct_pred
[
1
]
=
p_vpar
->
mb
.
pi_dc_dct_pred
[
2
]
=
1
<<
(
7
+
p_vpar
->
picture
.
i_intra_dc_precision
);
/* Reset motion vector predictors (ISO/IEC 13818-2 7.6.3.4). */
memset
(
p_vpar
->
slice
.
pppi_pmv
,
0
,
8
*
sizeof
(
int
)
);
memset
(
p_vpar
->
mb
.
pppi_pmv
,
0
,
8
*
sizeof
(
int
)
);
do
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment