Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
853d3d6b
Commit
853d3d6b
authored
Jan 09, 2000
by
Jean-Marc Dressler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debut de la partie parser du motion compensation.
parent
5fc945b6
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
183 additions
and
16 deletions
+183
-16
include/vpar_blocks.h
include/vpar_blocks.h
+5
-7
include/vpar_headers.h
include/vpar_headers.h
+4
-1
include/vpar_motion.h
include/vpar_motion.h
+16
-0
src/video_parser/vpar_blocks.c
src/video_parser/vpar_blocks.c
+2
-0
src/video_parser/vpar_headers.c
src/video_parser/vpar_headers.c
+5
-2
src/video_parser/vpar_motion.c
src/video_parser/vpar_motion.c
+151
-6
No files found.
include/vpar_blocks.h
View file @
853d3d6b
...
...
@@ -41,12 +41,9 @@ typedef struct macroblock_s
picture_t
*
p_backw_bot
;
picture_t
*
p_forw_top
;
picture_t
*
p_forw_bot
;
int
i_field_select_backw_top
,
i_field_select_backw_bot
;
int
i_field_select_forw_top
,
i_field_select_forw_bot
;
int
pi_motion_vectors_backw_top
[
2
];
int
pi_motion_vectors_backw_bot
[
2
];
int
pi_motion_vectors_forw_top
[
2
];
int
pi_motion_vectors_forw_bot
[
2
];
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 */
...
...
@@ -61,6 +58,7 @@ typedef struct macroblock_s
typedef
struct
{
int
i_mb_type
,
i_motion_type
,
i_mv_count
,
i_mv_format
;
boolean_t
b_dmv
;
/* AddressIncrement information */
int
i_addr_inc
;
int
i_coded_block_pattern
;
...
...
include/vpar_headers.h
View file @
853d3d6b
...
...
@@ -76,7 +76,7 @@ typedef struct sequence_s
*****************************************************************************/
typedef
struct
picture_parsing_s
{
boolean_t
b_full_pel_forward_vector
,
b_full_pel_backward_vector
;
boolean_t
pb_full_pel_vector
[
2
]
;
int
i_forward_f_code
,
i_backward_f_code
;
int
ppi_f_code
[
2
][
2
];
...
...
@@ -99,6 +99,9 @@ typedef struct picture_parsing_s
boolean_t
b_frame_structure
;
f_macroblock_type_t
pf_macroblock_type
;
/* Scalability variables */
int
i_spatial_temporal_weight_code_table_index
;
boolean_t
b_error
;
}
picture_parsing_t
;
...
...
include/vpar_motion.h
0 → 100644
View file @
853d3d6b
/*****************************************************************************
* vpar_motion.h : video parser motion compensation management
* (c)1999 VideoLAN
*****************************************************************************/
typedef
struct
{
char
i_val
,
i_len
;
}
mv_tab_t
;
/*
* Prototypes
*/
void
vpar_MPEG1MotionVector
(
vpar_thread_t
*
p_vpar
,
macroblock_t
*
p_mb
,
int
i_s
);
void
vpar_MPEG2MotionVector
(
vpar_thread_t
*
p_vpar
,
macroblock_t
*
p_mb
,
int
i_s
);
src/video_parser/vpar_blocks.c
View file @
853d3d6b
...
...
@@ -571,6 +571,8 @@ static __inline__ void MacroblockModes( vpar_thread_t * p_vpar,
}
}
}
p_vpar
->
mb
.
b_dmv
=
p_vpar
->
mb
.
i_motion_type
==
MOTION_DMV
;
}
/*****************************************************************************
...
...
src/video_parser/vpar_headers.c
View file @
853d3d6b
...
...
@@ -38,6 +38,7 @@
#include "video_fifo.h"
#include "vpar_synchro.h"
#include "video_parser.h"
#include "vpar_motion.h"
/*
* Local prototypes
...
...
@@ -435,9 +436,9 @@ static void PictureHeader( vpar_thread_t * p_vpar )
DumpBits
(
&
p_vpar
->
bit_stream
,
16
);
/* vbv_delay */
p_vpar
->
picture
.
b_full_pel_forward_vector
=
GetBits
(
&
p_vpar
->
bit_stream
,
1
);
p_vpar
->
picture
.
pb_full_pel_vector
[
0
]
=
GetBits
(
&
p_vpar
->
bit_stream
,
1
);
p_vpar
->
picture
.
i_forward_f_code
=
GetBits
(
&
p_vpar
->
bit_stream
,
3
);
p_vpar
->
picture
.
b_full_pel_backward_vector
=
GetBits
(
&
p_vpar
->
bit_stream
,
1
);
p_vpar
->
picture
.
pb_full_pel_vector
[
1
]
=
GetBits
(
&
p_vpar
->
bit_stream
,
1
);
p_vpar
->
picture
.
i_backward_f_code
=
GetBits
(
&
p_vpar
->
bit_stream
,
3
);
/* extra_information_picture */
...
...
@@ -928,6 +929,8 @@ static void PictureSpatialScalableExtension( vpar_thread_t * p_vpar )
/* That's scalable, so we trash it */
DumpBits32
(
&
p_vpar
->
bit_stream
);
DumpBits
(
&
p_vpar
->
bit_stream
,
14
);
p_vpar
->
picture
.
i_spatial_temporal_weight_code_table_index
=
GetBits
(
&
p_vpar
->
bit_stream
,
2
);
DumpBits
(
&
p_vpar
->
bit_stream
,
2
);
}
...
...
src/video_parser/vpar_motion.c
View file @
853d3d6b
...
...
@@ -38,23 +38,168 @@
#include "video_fifo.h"
#include "vpar_synchro.h"
#include "video_parser.h"
#include "vpar_motion.h"
/* mv_format */
#define MV_FIELD 0
#define MV_FRAME 1
/*
* Local prototypes
*/
/****************************************************************************
*
* vpar_M
PEG1MotionVector : Parse the next MPEG-1 motion vector
****************************************************************************
*
/
void
vpar_MPEG1MotionVector
(
vpar_thread_t
*
p_vpar
,
int
i_mv
)
/****************************************************************************
* vpar_M
otionCode : Parse the next motion code
****************************************************************************/
static
__inline__
int
vpar_MotionCode
(
vpar_thread_t
*
p_vpar
)
{
int
i_code
;
static
mv_tab_t
p_mv_tab0
[
8
]
=
{
{
-
1
,
0
},
{
3
,
3
},
{
2
,
2
},
{
2
,
2
},
{
1
,
1
},
{
1
,
1
},
{
1
,
1
},
{
1
,
1
}
};
/* Table B-10, motion_code, codes 0000011 ... 000011x */
static
mv_tab_t
p_mv_tab1
[
8
]
=
{
{
-
1
,
0
},
{
-
1
,
0
},
{
-
1
,
0
},
{
7
,
6
},
{
6
,
6
},
{
5
,
6
},
{
4
,
5
},
{
4
,
5
}
};
/* Table B-10, motion_code, codes 0000001100 ... 000001011x */
static
mv_tab_t
p_mv_tab2
[
12
]
=
{
{
16
,
9
},
{
15
,
9
},
{
14
,
9
},
{
13
,
9
},
{
12
,
9
},
{
11
,
9
},
{
10
,
8
},
{
10
,
8
},
{
9
,
8
},
{
9
,
8
},
{
8
,
8
},
{
8
,
8
}
};
if
(
GetBits
(
&
p_vpar
->
bit_stream
,
1
)
)
{
return
0
;
}
if
(
(
i_code
=
ShowBits
(
&
p_vpar
->
bit_stream
,
9
))
>=
64
)
{
i_code
>>=
6
;
DumpBits
(
&
p_vpar
->
bit_stream
,
p_mv_tab0
[
0
].
i_len
);
return
(
GetBits
(
&
p_vpar
->
bit_stream
,
1
)
?
-
p_mv_tab0
[
i_code
].
i_val
:
p_mv_tab0
[
i_code
].
i_val
);
}
if
(
i_code
>=
24
)
{
i_code
>>=
3
;
DumpBits
(
&
p_vpar
->
bit_stream
,
p_mv_tab1
[
0
].
i_len
);
return
(
GetBits
(
&
p_vpar
->
bit_stream
,
1
)
?
-
p_mv_tab1
[
i_code
].
i_val
:
p_mv_tab1
[
i_code
].
i_val
);
}
if
(
(
i_code
-=
12
)
<
0
)
{
intf_DbgMsg
(
"vpar debug: Invalid motion_vector code
\n
"
);
return
0
;
}
DumpBits
(
&
p_vpar
->
bit_stream
,
p_mv_tab2
[
0
].
i_len
);
return
(
GetBits
(
&
p_vpar
->
bit_stream
,
1
)
?
-
p_mv_tab2
[
i_code
].
i_val
:
p_mv_tab2
[
i_code
].
i_val
);
}
/****************************************************************************
* vpar_DecodeMotionVector : decode a motion_vector
****************************************************************************/
static
__inline__
void
vpar_DecodeMotionVector
(
int
*
pi_prediction
,
int
i_r_size
,
int
i_motion_code
,
int
i_motion_residual
,
int
i_full_pel
)
{
int
i_limit
,
i_vector
;
/* ISO/IEC 13818-1 section 7.6.3.1 */
i_limit
=
16
<<
i_r_size
;
i_vector
=
*
pi_prediction
>>
i_full_pel
;
if
(
i_motion_code
<
0
)
{
i_vector
+=
((
i_motion_code
-
1
)
<<
i_r_size
)
+
i_motion_residual
+
1
;
if
(
i_vector
>=
i_limit
)
i_vector
-=
i_limit
<<
1
;
}
else
if
(
i_motion_code
>
0
)
{
i_vector
-=
((
-
i_motion_code
-
1
)
<<
i_r_size
)
+
i_motion_residual
+
1
;
if
(
i_vector
<
i_limit
)
i_vector
+=
i_limit
<<
1
;
}
*
pi_prediction
=
i_vector
<<
i_full_pel
;
}
/****************************************************************************
* vpar_MotionVector : Parse the next motion_vector field
****************************************************************************/
void
vpar_MotionVector
(
vpar_thread_t
*
p_vpar
,
macroblock_t
*
p_mb
,
int
i_r
,
int
i_s
,
int
i_full_pel
)
{
int
i_motion_code
,
i_motion_residual
;
int
i_r_size
;
i_r_size
=
p_vpar
->
picture
.
ppi_f_code
[
i_s
][
0
]
-
1
;
i_motion_code
=
vpar_MotionCode
(
p_vpar
);
i_motion_residual
=
(
i_r_size
!=
0
&&
i_motion_code
!=
0
)
?
GetBits
(
&
p_vpar
->
bit_stream
,
i_r_size
)
:
0
;
vpar_DecodeMotionVector
(
&
p_vpar
->
slice
.
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
];
if
(
p_vpar
->
mb
.
b_dmv
)
{
if
(
GetBits
(
&
p_vpar
->
bit_stream
,
1
)
)
{
p_mb
->
pi_dm_vector
[
0
]
=
GetBits
(
&
p_vpar
->
bit_stream
,
1
)
?
-
1
:
1
;
}
else
{
p_mb
->
pi_dm_vector
[
0
]
=
0
;
}
}
i_r_size
=
p_vpar
->
picture
.
ppi_f_code
[
i_s
][
1
]
-
1
;
i_motion_code
=
vpar_MotionCode
(
p_vpar
);
i_motion_residual
=
(
i_r_size
!=
0
&&
i_motion_code
!=
0
)
?
GetBits
(
&
p_vpar
->
bit_stream
,
i_r_size
)
:
0
;
vpar_DecodeMotionVector
(
&
p_vpar
->
slice
.
pppi_pmv
[
i_r
][
i_s
][
1
],
i_r_size
,
i_motion_code
,
i_motion_residual
,
i_full_pel
);
p_mb
->
pppi_motion_vectors
[
i_r
][
i_s
][
1
]
=
p_vpar
->
slice
.
pppi_pmv
[
i_r
][
i_s
][
1
];
if
(
p_vpar
->
mb
.
b_dmv
)
{
if
(
GetBits
(
&
p_vpar
->
bit_stream
,
1
)
)
{
p_mb
->
pi_dm_vector
[
1
]
=
GetBits
(
&
p_vpar
->
bit_stream
,
1
)
?
-
1
:
1
;
}
else
{
p_mb
->
pi_dm_vector
[
1
]
=
0
;
}
}
}
/*****************************************************************************
* vpar_MPEG
2MotionVector : Parse the next MPEG-2 motion vector
* vpar_MPEG
1MotionVector : Parse the next MPEG-1 motion vectors
*****************************************************************************/
void
vpar_MPEG
2MotionVector
(
vpar_thread_t
*
p_vpar
,
int
i_mv
)
void
vpar_MPEG
1MotionVector
(
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_MPEG2MotionVector : Parse the next MPEG-2 motion_vectors field
*****************************************************************************/
void
vpar_MPEG2MotionVector
(
vpar_thread_t
*
p_vpar
,
macroblock_t
*
p_mb
,
int
i_s
)
{
if
(
p_vpar
->
mb
.
i_mv_count
==
1
)
{
if
(
p_vpar
->
mb
.
i_mv_format
==
MV_FIELD
&&
!
p_vpar
->
mb
.
b_dmv
)
{
p_mb
->
ppi_field_select
[
0
][
i_s
]
=
p_mb
->
ppi_field_select
[
1
][
i_s
]
=
GetBits
(
&
p_vpar
->
bit_stream
,
1
);
}
vpar_MotionVector
(
p_vpar
,
p_mb
,
0
,
i_s
,
0
);
}
else
{
p_mb
->
ppi_field_select
[
0
][
i_s
]
=
GetBits
(
&
p_vpar
->
bit_stream
,
1
);
vpar_MotionVector
(
p_vpar
,
p_mb
,
0
,
i_s
,
0
);
p_mb
->
ppi_field_select
[
1
][
i_s
]
=
GetBits
(
&
p_vpar
->
bit_stream
,
1
);
vpar_MotionVector
(
p_vpar
,
p_mb
,
1
,
i_s
,
0
);
}
}
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