Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
dd4339a9
Commit
dd4339a9
authored
Jan 18, 2000
by
Christophe Massiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Le motion compensation. Notez que �a ne marche pas (encore).
parent
e70d9d1f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
432 additions
and
184 deletions
+432
-184
include/vdec_motion.h
include/vdec_motion.h
+13
-16
include/vpar_blocks.h
include/vpar_blocks.h
+3
-3
src/video_decoder/vdec_motion.c
src/video_decoder/vdec_motion.c
+395
-147
src/video_parser/vpar_blocks.c
src/video_parser/vpar_blocks.c
+7
-7
src/video_parser/vpar_headers.c
src/video_parser/vpar_headers.c
+12
-9
src/video_parser/vpar_synchro.c
src/video_parser/vpar_synchro.c
+2
-2
No files found.
include/vdec_motion.h
View file @
dd4339a9
...
...
@@ -16,30 +16,27 @@
*****************************************************************************/
struct
macroblock_s
;
struct
vpar_thread_s
;
struct
motion_arg_s
;
typedef
void
(
*
f_motion_t
)(
struct
macroblock_s
*
);
typedef
void
(
*
f_chroma_motion_t
)(
struct
macroblock_s
*
);
typedef
void
(
*
f_chroma_motion_t
)(
struct
macroblock_s
*
,
struct
motion_arg_s
*
);
/*****************************************************************************
* Prototypes
*****************************************************************************/
/* Empty function for intra macroblocks motion compensation */
void
vdec_
DummyRecon
(
struct
macroblock_s
*
);
void
vdec_
MotionDummy
(
struct
macroblock_s
*
p_mb
);
/* Motion compensation for skipped macroblocks */
void
vdec_MotionField
(
struct
macroblock_s
*
);
void
vdec_MotionFrame
(
struct
macroblock_s
*
);
/* Motion compensation for non skipped macroblocks */
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 */
void
vdec_MotionFieldField
(
struct
macroblock_s
*
p_mb
);
void
vdec_MotionField16x8
(
struct
macroblock_s
*
p_mb
);
void
vdec_MotionFieldDMV
(
struct
macroblock_s
*
p_mb
);
void
vdec_MotionFrameFrame
(
struct
macroblock_s
*
p_mb
);
void
vdec_MotionFrameField
(
struct
macroblock_s
*
p_mb
);
void
vdec_MotionFrameDMV
(
struct
macroblock_s
*
p_mb
);
/* Motion compensation functions for the 3 chroma formats */
void
vdec_Motion420
();
void
vdec_Motion422
();
void
vdec_Motion444
();
void
vdec_Motion420
(
struct
macroblock_s
*
p_mb
,
struct
motion_arg_s
*
p_motion
);
void
vdec_Motion422
(
struct
macroblock_s
*
p_mb
,
struct
motion_arg_s
*
p_motion
);
void
vdec_Motion444
(
struct
macroblock_s
*
p_mb
,
struct
motion_arg_s
*
p_motion
);
include/vpar_blocks.h
View file @
dd4339a9
...
...
@@ -29,11 +29,11 @@ typedef struct macroblock_s
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 yuv_data_t to ignore
* when changing lines */
* when changing lines */
int
i_c_stride
;
/* idem, for chroma */
/* IDCT information */
dctelem_t
ppi_blocks
[
12
][
64
];
/* blocks */
dctelem_t
ppi_blocks
[
12
][
64
];
/* blocks */
f_idct_t
pf_idct
[
12
];
/* sparse IDCT or not ? */
int
pi_sparse_pos
[
12
];
...
...
@@ -49,7 +49,7 @@ typedef struct macroblock_s
/* AddBlock information */
f_addb_t
pf_addb
[
12
];
/* pointer to the Add function */
yuv_data_t
*
p_data
[
12
];
/* pointer to the position
* in the final picture */
* in the final picture */
int
i_addb_l_stride
,
i_addb_c_stride
;
}
macroblock_t
;
...
...
src/video_decoder/vdec_motion.c
View file @
dd4339a9
...
...
@@ -39,228 +39,476 @@
#include "vpar_synchro.h"
#include "video_parser.h"
/*
* Local prototypes
*/
/*****************************************************************************
* vdec_MotionComponent : last stage of motion compensation
*****************************************************************************/
static
void
__inline__
MotionComponent
(
yuv_data_t
*
p_src
,
yuv_data_t
*
p_dest
,
int
i_width
,
int
i_height
,
int
i_x_step
,
int
i_select
)
{
int
i_x
,
i_y
,
i_x1
,
i_y1
;
unsigned
int
i_dummy
;
switch
(
i_select
)
{
case
4
:
/* !xh, !yh, average */
for
(
i_y
=
0
;
i_y
<
i_height
;
i_y
+=
4
)
{
for
(
i_y1
=
0
;
i_y1
<
4
;
i_y1
++
)
{
for
(
i_x
=
0
;
i_x
<
i_width
;
i_x
+=
8
)
{
for
(
i_x1
=
0
;
i_x1
<
8
;
i_x1
++
)
{
i_dummy
=
p_dest
[
i_x
+
i_x1
]
+
p_src
[
i_x
+
i_x1
];
p_dest
[
i_x
+
i_x1
]
=
(
i_dummy
+
1
)
>>
1
;
}
}
p_dest
+=
i_x_step
;
p_src
+=
i_x_step
;
}
}
break
;
case
0
:
/* !xh, !yh, !average */
for
(
i_y
=
0
;
i_y
<
i_height
;
i_y
+=
4
)
{
for
(
i_y1
=
0
;
i_y1
<
4
;
i_y1
++
)
{
for
(
i_x
=
0
;
i_x
<
i_width
;
i_x
+=
8
)
{
memcpy
(
&
p_dest
[
i_x
],
&
p_src
[
i_x
],
8
*
sizeof
(
yuv_data_t
)
);
}
p_dest
+=
i_x_step
;
p_src
+=
i_x_step
;
}
}
break
;
case
6
:
/* !xh, yh, average */
for
(
i_y
=
0
;
i_y
<
i_height
;
i_y
+=
4
)
{
for
(
i_y1
=
0
;
i_y1
<
4
;
i_y1
++
)
{
for
(
i_x
=
0
;
i_x
<
i_width
;
i_x
+=
8
)
{
for
(
i_x1
=
0
;
i_x1
<
8
;
i_x1
++
)
{
i_dummy
=
p_dest
[
i_x
+
i_x1
]
+
((
unsigned
int
)(
p_src
[
i_x
+
i_x1
]
+
1
+
p_src
[
i_x
+
i_x1
+
i_x_step
])
>>
1
);
p_dest
[
i_x
+
i_x1
]
=
(
i_dummy
+
1
)
>>
1
;
}
}
p_dest
+=
i_x_step
;
p_src
+=
i_x_step
;
}
}
break
;
case
2
:
/* !xh, yh, !average */
for
(
i_y
=
0
;
i_y
<
i_height
;
i_y
+=
4
)
{
for
(
i_y1
=
0
;
i_y1
<
4
;
i_y1
++
)
{
for
(
i_x
=
0
;
i_x
<
i_width
;
i_x
+=
8
)
{
for
(
i_x1
=
0
;
i_x1
<
8
;
i_x1
++
)
{
p_dest
[
i_x
+
i_x1
]
=
(
unsigned
int
)(
p_src
[
i_x
+
i_x1
]
+
1
+
p_src
[
i_x
+
i_x1
+
i_x_step
])
>>
1
;
}
}
}
}
break
;
case
5
:
/* xh, !yh, average */
for
(
i_y
=
0
;
i_y
<
i_height
;
i_y
+=
4
)
{
for
(
i_y1
=
0
;
i_y1
<
4
;
i_y1
++
)
{
for
(
i_x
=
0
;
i_x
<
i_width
;
i_x
+=
8
)
{
for
(
i_x1
=
0
;
i_x1
<
8
;
i_x1
++
)
{
i_dummy
=
p_dest
[
i_x
+
i_x1
]
+
((
unsigned
int
)(
p_src
[
i_x
+
i_x1
]
+
p_src
[
i_x
+
i_x1
+
1
]
+
1
)
>>
1
);
p_dest
[
i_x
+
i_x1
]
=
(
i_dummy
+
1
)
>>
1
;
}
}
p_dest
+=
i_x_step
;
p_src
+=
i_x_step
;
}
}
break
;
case
1
:
/* xh, !yh, !average */
for
(
i_y
=
0
;
i_y
<
i_height
;
i_y
+=
4
)
{
for
(
i_y1
=
0
;
i_y1
<
4
;
i_y1
++
)
{
for
(
i_x
=
0
;
i_x
<
i_width
;
i_x
+=
8
)
{
for
(
i_x1
=
0
;
i_x1
<
8
;
i_x1
++
)
{
p_dest
[
i_x
+
i_x1
]
=
(
unsigned
int
)(
p_src
[
i_x
+
i_x1
]
+
p_src
[
i_x
+
i_x1
+
1
]
+
1
)
>>
1
;
}
}
}
}
break
;
case
7
:
/* xh, yh, average */
for
(
i_y
=
0
;
i_y
<
i_height
;
i_y
+=
4
)
{
for
(
i_y1
=
0
;
i_y1
<
4
;
i_y1
++
)
{
for
(
i_x
=
0
;
i_x
<
i_width
;
i_x
+=
8
)
{
for
(
i_x1
=
0
;
i_x1
<
8
;
i_x1
++
)
{
i_dummy
=
p_dest
[
i_x
+
i_x1
]
+
((
unsigned
int
)(
p_src
[
i_x
+
i_x1
]
+
p_src
[
i_x
+
i_x1
+
1
]
+
p_src
[
i_x
+
i_x1
+
i_x_step
]
+
p_src
[
i_x
+
i_x1
+
i_x_step
+
1
]
+
2
)
>>
2
);
p_dest
[
i_x
+
i_x1
]
=
(
i_dummy
+
1
)
>>
1
;
}
}
p_dest
+=
i_x_step
;
p_src
+=
i_x_step
;
}
}
break
;
default:
/* xh, yh, !average (3) */
for
(
i_y
=
0
;
i_y
<
i_height
;
i_y
+=
4
)
{
for
(
i_y1
=
0
;
i_y1
<
4
;
i_y1
++
)
{
for
(
i_x
=
0
;
i_x
<
i_width
;
i_x
+=
8
)
{
for
(
i_x1
=
0
;
i_x1
<
8
;
i_x1
++
)
{
p_dest
[
i_x
+
i_x1
]
=
((
unsigned
int
)(
p_src
[
i_x
+
i_x1
]
+
p_src
[
i_x
+
i_x1
+
1
]
+
p_src
[
i_x
+
i_x1
+
i_x_step
]
+
p_src
[
i_x
+
i_x1
+
i_x_step
+
1
]
+
2
)
>>
2
);
}
}
p_dest
+=
i_x_step
;
p_src
+=
i_x_step
;
}
}
break
;
}
}
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_height
,
i_offset
;
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_Motion
Component : last stage of motion compensation
* vdec_Motion
Dummy : motion compensation for an intra macroblock
*****************************************************************************/
static
__inline__
vdec_MotionComponent
()
{
}
/*****************************************************************************
* vdec_DummyRecon : motion compensation for an intra macroblock
*****************************************************************************/
void
vdec_DummyRecon
(
macroblock_t
*
p_mb
)
void
vdec_MotionDummy
(
macroblock_t
*
p_mb
)
{
/* Nothing to do :) */
}
/*****************************************************************************
* vdec_
FieldFieldRecon
: motion compensation for field motion type (field)
* vdec_
MotionFieldField
: motion compensation for field motion type (field)
*****************************************************************************/
void
vdec_
FieldFieldRecon
(
macroblock_t
*
p_mb
)
void
vdec_
MotionFieldField
(
macroblock_t
*
p_mb
)
{
#if 0
motion_arg_t motion_arg;
motion_arg_t
args
;
args
.
i_height
=
16
;
args
.
b_average
=
0
;
args
.
b_dest_field
=
0
;
args
.
i_offset
=
0
;
motion_arg
if
(
p_mb
->
i_mb_type
&
MB_MOTION_FORWARD
)
{
int i_current_field;
picture_t * p_pred_frame;
boolean_t
b_current_field
;
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;
}
b_current_field
=
(
p_mb
->
i_structure
==
BOTTOM_FIELD
);
if
(
p_mb
->
b_P_coding_type
&&
(
p_mb
->
i_current_structure
==
FRAME_STRUCTURE
)
&&
(
b_current_field
!=
p_mb
->
ppi_field_select
[
0
][
0
])
)
args
.
p_source
=
p_mb
->
p_picture
;
else
{
p_pred_frame = p_mb->p_backward;
}
p_mb->pf_chroma_motion( p_mb, p_pred_frame, 0 /* average */ );
args
.
p_source
=
p_mb
->
p_forward
;
args
.
b_source_field
=
p_mb
->
ppi_field_select
[
0
][
0
];
args
.
i_mv_x
=
p_mb
->
pppi_motion_vectors
[
0
][
0
][
0
];
args
.
i_mv_y
=
p_mb
->
pppi_motion_vectors
[
0
][
0
][
1
];
p_mb
->
pf_chroma_motion
(
p_mb
,
&
args
);
args
.
b_average
=
1
;
}
if
(
p_mb
->
i_mb_type
&
MB_MOTION_BACKWARD
)
{
args
.
b_source_field
=
p_mb
->
ppi_field_select
[
0
][
1
];
args
.
i_mv_x
=
p_mb
->
pppi_motion_vectors
[
0
][
1
][
0
];
args
.
i_mv_y
=
p_mb
->
pppi_motion_vectors
[
0
][
1
][
1
];
p_mb
->
pf_chroma_motion
(
p_mb
,
&
args
);
}
#endif
}
/*****************************************************************************
* vdec_
Field16x8Recon
: motion compensation for 16x8 motion type (field)
* vdec_
MotionField16x8
: motion compensation for 16x8 motion type (field)
*****************************************************************************/
void
vdec_
Field16x8Recon
(
macroblock_t
*
p_mb
)
void
vdec_
MotionField16x8
(
macroblock_t
*
p_mb
)
{
motion_arg_t
args
;
args
.
i_height
=
8
;
args
.
b_average
=
0
;
args
.
b_dest_field
=
0
;
args
.
i_offset
=
0
;
if
(
p_mb
->
i_mb_type
&
MB_MOTION_FORWARD
)
{
boolean_t
b_current_field
;
b_current_field
=
(
p_mb
->
i_structure
==
BOTTOM_FIELD
);
if
(
p_mb
->
b_P_coding_type
&&
(
p_mb
->
i_current_structure
==
FRAME_STRUCTURE
)
&&
(
b_current_field
!=
p_mb
->
ppi_field_select
[
0
][
0
])
)
args
.
p_source
=
p_mb
->
p_picture
;
else
args
.
p_source
=
p_mb
->
p_forward
;
args
.
b_source_field
=
p_mb
->
ppi_field_select
[
0
][
0
];
args
.
i_mv_x
=
p_mb
->
pppi_motion_vectors
[
0
][
0
][
0
];
args
.
i_mv_y
=
p_mb
->
pppi_motion_vectors
[
0
][
0
][
1
];
p_mb
->
pf_chroma_motion
(
p_mb
,
&
args
);
if
(
p_mb
->
b_P_coding_type
&&
(
p_mb
->
i_current_structure
==
FRAME_STRUCTURE
)
&&
(
b_current_field
!=
p_mb
->
ppi_field_select
[
1
][
0
])
)
args
.
p_source
=
p_mb
->
p_picture
;
else
args
.
p_source
=
p_mb
->
p_forward
;
args
.
b_source_field
=
p_mb
->
ppi_field_select
[
1
][
0
];
args
.
i_mv_x
=
p_mb
->
pppi_motion_vectors
[
1
][
0
][
0
];
args
.
i_mv_y
=
p_mb
->
pppi_motion_vectors
[
1
][
0
][
1
];
args
.
i_offset
=
8
;
p_mb
->
pf_chroma_motion
(
p_mb
,
&
args
);
args
.
b_average
=
1
;
args
.
i_offset
=
0
;
}
if
(
p_mb
->
i_mb_type
&
MB_MOTION_BACKWARD
)
{
args
.
p_source
=
p_mb
->
p_backward
;
args
.
b_source_field
=
p_mb
->
ppi_field_select
[
0
][
1
];
args
.
i_mv_x
=
p_mb
->
pppi_motion_vectors
[
0
][
1
][
0
];
args
.
i_mv_y
=
p_mb
->
pppi_motion_vectors
[
0
][
1
][
1
];
p_mb
->
pf_chroma_motion
(
p_mb
,
&
args
);
args
.
b_source_field
=
p_mb
->
ppi_field_select
[
1
][
1
];
args
.
i_mv_x
=
p_mb
->
pppi_motion_vectors
[
1
][
1
][
0
];
args
.
i_mv_y
=
p_mb
->
pppi_motion_vectors
[
1
][
1
][
1
];
args
.
i_offset
=
8
;
p_mb
->
pf_chroma_motion
(
p_mb
,
&
args
);
}
}
/*****************************************************************************
* vdec_
FieldDMVRecon
: motion compensation for dmv motion type (field)
* vdec_
MotionFieldDMV
: motion compensation for dmv motion type (field)
*****************************************************************************/
void
vdec_
FieldDMVRecon
(
macroblock_t
*
p_mb
)
void
vdec_
MotionFieldDMV
(
macroblock_t
*
p_mb
)
{
/* This is necessarily a MOTION_FORWARD only macroblock */
fprintf
(
stderr
,
"DMV pas code !!!
\n
"
);
}
/*****************************************************************************
* vdec_
FrameFrameRecon
: motion compensation for frame motion type (frame)
* vdec_
MotionFrameFrame
: motion compensation for frame motion type (frame)
*****************************************************************************/
void
vdec_
FrameFrameRecon
(
macroblock_t
*
p_mb
)
void
vdec_
MotionFrameFrame
(
macroblock_t
*
p_mb
)
{
motion_arg_t
args
;
}
args
.
b_source_field
=
args
.
b_dest_field
=
0
;
args
.
i_height
=
16
;
args
.
b_average
=
0
;
args
.
i_offset
=
0
;
/*****************************************************************************
* vdec_FrameFieldRecon : motion compensation for field motion type (frame)
*****************************************************************************/
void
vdec_FrameFieldRecon
(
macroblock_t
*
p_mb
)
{
if
(
p_mb
->
i_mb_type
&
MB_MOTION_FORWARD
)
{
args
.
p_source
=
p_mb
->
p_forward
;
args
.
i_mv_x
=
p_mb
->
pppi_motion_vectors
[
0
][
0
][
0
];
args
.
i_mv_y
=
p_mb
->
pppi_motion_vectors
[
0
][
0
][
1
];
p_mb
->
pf_chroma_motion
(
p_mb
,
&
args
);
}
args
.
b_average
=
1
;
}
/*****************************************************************************
* vdec_FrameDMVRecon : motion compensation for dmv motion type (frame)
*****************************************************************************/
void
vdec_FrameDMVRecon
(
macroblock_t
*
p_mb
)
{
/* This is necessarily a MOTION_FORWARD only macroblock */
if
(
p_mb
->
i_mb_type
&
MB_MOTION_BACKWARD
)
{
/* Necessarily MB_MOTION_BACKWARD */
args
.
p_source
=
p_mb
->
p_backward
;
args
.
i_mv_x
=
p_mb
->
pppi_motion_vectors
[
0
][
1
][
0
];
args
.
i_mv_y
=
p_mb
->
pppi_motion_vectors
[
0
][
1
][
1
];
p_mb
->
pf_chroma_motion
(
p_mb
,
&
args
);
}
}
/*****************************************************************************
* vdec_MotionF
ield : motion compensation for skipped macroblocks (field
)
* vdec_MotionF
rameField : motion compensation for field motion type (frame
)
*****************************************************************************/
void
vdec_MotionField
(
macroblock_t
*
p_mb
)
void
vdec_MotionF
rameF
ield
(
macroblock_t
*
p_mb
)
{
motion_arg_t
args
;
}
args
.
i_height
=
8
;
args
.
b_average
=
0
;
args
.
i_offset
=
0
;
/*****************************************************************************
* vdec_MotionFrame : motion compensation for skipped macroblocks (frame)
*****************************************************************************/
void
vdec_MotionFrame
(
macroblock_t
*
p_mb
)
{
if
(
p_mb
->
i_mb_type
&
MB_MOTION_FORWARD
)
{
args
.
p_source
=
p_mb
->
p_forward
;
}
args
.
b_source_field
=
p_mb
->
ppi_field_select
[
0
][
0
];
args
.
b_dest_field
=
0
;
args
.
i_mv_x
=
p_mb
->
pppi_motion_vectors
[
0
][
0
][
0
];
args
.
i_mv_y
=
p_mb
->
pppi_motion_vectors
[
0
][
0
][
1
]
>>
1
;
p_mb
->
pf_chroma_motion
(
p_mb
,
&
args
);
/*****************************************************************************
* vdec_Motion420 : motion compensation for a 4:2:0 macroblock
*****************************************************************************/
void
vdec_Motion420
(
macroblock_t
*
p_mb
)
{
}
args
.
b_source_field
=
p_mb
->
ppi_field_select
[
1
][
0
];
args
.
b_dest_field
=
1
;
args
.
i_mv_x
=
p_mb
->
pppi_motion_vectors
[
1
][
0
][
0
];
args
.
i_mv_y
=
p_mb
->
pppi_motion_vectors
[
1
][
0
][
1
]
>>
1
;
p_mb
->
pf_chroma_motion
(
p_mb
,
&
args
);
/*****************************************************************************
* vdec_Motion422 : motion compensation for a 4:2:2 macroblock
*****************************************************************************/
void
vdec_Motion422
(
macroblock_t
*
p_mb
)
{
args
.
b_average
=
1
;
}
if
(
p_mb
->
i_mb_type
&
MB_MOTION_BACKWARD
)
{
args
.
p_source
=
p_mb
->
p_backward
;
args
.
b_source_field
=
p_mb
->
ppi_field_select
[
0
][
1
];
args
.
b_dest_field
=
0
;
args
.
i_mv_x
=
p_mb
->
pppi_motion_vectors
[
0
][
1
][
0
];
args
.
i_mv_y
=
p_mb
->
pppi_motion_vectors
[
0
][
1
][
1
]
>>
1
;
p_mb
->
pf_chroma_motion
(
p_mb
,
&
args
);
args
.
b_source_field
=
p_mb
->
ppi_field_select
[
1
][
1
];
args
.
b_dest_field
=
1
;
args
.
i_mv_x
=
p_mb
->
pppi_motion_vectors
[
1
][
1
][
0
];
args
.
i_mv_y
=
p_mb
->
pppi_motion_vectors
[
1
][
1
][
1
]
>>
1
;
p_mb
->
pf_chroma_motion
(
p_mb
,
&
args
);
}
}
/*****************************************************************************
* vdec_Motion
444 : motion compensation for a 4:4:4 macroblock
* vdec_Motion
FrameDMV : motion compensation for dmv motion type (frame)
*****************************************************************************/
void
vdec_Motion
444
(
macroblock_t
*
p_mb
)
void
vdec_Motion
FrameDMV
(
macroblock_t
*
p_mb
)
{
/* This is necessarily a MOTION_FORWARD only macroblock */
fprintf
(
stderr
,
"DMV pas codee 2 !!!!!
\n
"
);
}
#if 0
/*****************************************************************************
* vdec_Motion
Macroblock
420 : motion compensation for a 4:2:0 macroblock
* vdec_Motion420 : motion compensation for a 4:2:0 macroblock
*****************************************************************************/
void vdec_Motion
Macroblock420( macroblock_t * p_mb
)
void
vdec_Motion
420
(
macroblock_t
*
p_mb
,
motion_arg_t
*
p_motion
)
{
/* 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] );
*/
MotionComponent
(
/* source */
p_motion
->
p_source
->
p_y
+
(
p_mb
->
i_l_x
+
(
p_motion
->
i_mv_x
>>
1
))
+
((
p_mb
->
i_l_y
+
p_motion
->
i_offset
+
(
p_motion
->
i_mv_y
>>
1
))
+
(
p_motion
->
b_source_field
-
p_motion
->
b_dest_field
))
*
p_mb
->
p_picture
->
i_width
,
/* destination */
p_mb
->
p_picture
->
p_y
+
(
p_mb
->
i_l_x
)
+
(
p_mb
->
i_l_y
)
*
p_mb
->
p_picture
->
i_width
,
/* prediction width and height */
16
,
p_motion
->
i_height
,
/* step */
p_mb
->
i_l_stride
,
/* select */
(
p_motion
->
b_average
<<
2
)
|
((
p_motion
->
i_mv_y
&
1
)
<<
1
)
|
(
p_motion
->
i_mv_x
&
1
)
);
/* Chrominance Cr */
MotionComponent
(
p_motion
->
p_source
->
p_u
+
(
p_mb
->
i_c_x
+
((
p_motion
->
i_mv_x
/
2
)
>>
1
))
+
((
p_mb
->
i_c_y
+
(
p_motion
->
i_offset
>>
1
)
+
((
p_motion
->
i_mv_y
/
2
)
>>
1
))
+
(
p_motion
->
b_source_field
-
p_motion
->
b_dest_field
))
*
p_mb
->
p_picture
->
i_chroma_width
,
p_mb
->
p_picture
->
p_u
+
(
p_mb
->
i_c_x
)
+
(
p_mb
->
i_c_y
)
*
p_mb
->
p_picture
->
i_chroma_width
,
8
,
p_motion
->
i_height
>>
1
,
p_mb
->
i_c_stride
,
(
p_motion
->
b_average
<<
2
)
|
(((
p_motion
->
i_mv_y
/
2
)
&
1
)
<<
1
)
|
((
p_motion
->
i_mv_x
/
2
)
&
1
)
);
/* Chrominance Cb */
MotionComponent
(
p_motion
->
p_source
->
p_v
+
(
p_mb
->
i_c_x
+
((
p_motion
->
i_mv_x
/
2
)
>>
1
))
+
((
p_mb
->
i_c_y
+
(
p_motion
->
i_offset
>>
1
)
+
((
p_motion
->
i_mv_y
/
2
)
>>
1
))
+
(
p_motion
->
b_source_field
-
p_motion
->
b_dest_field
))
*
p_mb
->
p_picture
->
i_chroma_width
,
p_mb
->
p_picture
->
p_v
+
(
p_mb
->
i_c_x
)
+
(
p_mb
->
i_c_y
)
*
p_mb
->
p_picture
->
i_chroma_width
,
8
,
p_motion
->
i_height
>>
1
,
p_mb
->
i_c_stride
,
(
p_motion
->
b_average
<<
2
)
|
(((
p_motion
->
i_mv_y
/
2
)
&
1
)
<<
1
)
|
((
p_motion
->
i_mv_x
/
2
)
&
1
)
);
}
/*****************************************************************************
*
MotionBlock : motion compensation for one 8x8
block
*
vdec_Motion422 : motion compensation for a 4:2:2 macro
block
*****************************************************************************/
void __inline__ MotionBlock( coeff_t * p_src, pel_lookup_table_t * p_lookup,
int i_width_line,
coeff_t * p_dest, int i_dest_x, i_dest_y,
int i_stride_line,
i_mv1_x, i_mv1_y, i_mv2_x, i_mv2_y )
void
vdec_Motion422
(
macroblock_t
*
p_mb
,
motion_arg_t
*
p_motion
)
{
static f_motion_c_t ComponentMode[4]
= { &ComponentNN, &ComponentNH, &ComponentHN,
&ComponentHH };
int i_mode;
i_mode = (i_mv_x & 1) | ((i_mv_y & 1) << 1);
ComponentMode[i_mode]( p_src, p_lookup, i_width_line,
p_dest, i_dest_x, i_dest_y,
i_stride_line, i_mv1_x >> 1, i_mv1_y >> 1,
i_mv2_x >> 1, i_mv2_y >> 1 );
fprintf
(
stderr
,
"La chrominance va chier dans la colle.
\n
"
);
}
/*****************************************************************************
*
ComponentNN : motion compensation without half pel
*
vdec_Motion444 : motion compensation for a 4:4:4 macroblock
*****************************************************************************/
void ComponentNN( coeff_t * p_src, pel_lookup_table_t * p_lookup,
int i_width_line,
coeff_t * p_dest, int i_dest_x, i_dest_y,
int i_stride_line, i_mv1_x, i_mv1_y, i_mv2_x, i_mv2_y )
void
vdec_Motion444
(
macroblock_t
*
p_mb
,
motion_arg_t
*
p_motion
)
{
int i_vpos;
register int i_hpos, i_src_loc;
i_src_loc = (i_dest_y + i_mv1_y)*i_width_line + i_dest_x + i_mv1_x;
for( i_vpos = 0; i_vpos < 4; i_vpos++ )
{
for( i_hpos = 0; i_hpos < 8; i_hpos++ )
{
p_dest[i_hpos] += p_src[p_lookup->pi_pel[i_src_loc + i_hpos]];
}
p_dest += 8;
i_src_loc += i_stride_line;
}
i_src_loc = (i_dest_y + i_mv2_y)*i_width_line + i_dest_x + i_mv2_x;
for( i_vpos = 4; i_vpos < 8; i_vpos++ )
{
for( i_hpos = 0; i_hpos < 8; i_hpos++ )
{
p_dest[i_hpos] += p_src[p_lookup->pi_pel[i_src_loc + i_hpos]];
}
p_dest += 8;
i_src_loc += i_stride_line;
}
fprintf
(
stderr
,
"La chrominance va chier dans le pastis.
\n
"
);
}
#endif
src/video_parser/vpar_blocks.c
View file @
dd4339a9
...
...
@@ -590,8 +590,8 @@ static __inline__ void InitMacroblock( vpar_thread_t * p_vpar,
p_mb
->
p_forward
=
p_vpar
->
sequence
.
p_forward
;
p_mb
->
p_backward
=
p_vpar
->
sequence
.
p_backward
;
p_mb
->
i_addb_l_stride
=
p_mb
->
i_l_stride
=
p_vpar
->
picture
.
i_l_stride
;
p_mb
->
i_addb_c_stride
=
p_mb
->
i_c_stride
=
p_vpar
->
picture
.
i_c_stride
;
p_mb
->
i_addb_l_stride
=
(
p_mb
->
i_l_stride
=
p_vpar
->
picture
.
i_l_stride
)
-
8
;
p_mb
->
i_addb_c_stride
=
(
p_mb
->
i_c_stride
=
p_vpar
->
picture
.
i_c_stride
)
-
9
;
/* Update macroblock real position. */
p_vpar
->
mb
.
i_l_x
+=
16
;
...
...
@@ -639,8 +639,8 @@ static __inline__ void MacroblockModes( vpar_thread_t * p_vpar,
macroblock_t
*
p_mb
)
{
static
f_motion_t
pf_motion
[
2
][
4
]
=
{
{
NULL
,
vdec_
FieldFieldRecon
,
vdec_Field16x8Recon
,
vdec_FieldDMVRecon
},
{
NULL
,
vdec_
FrameFieldRecon
,
vdec_FrameFrameRecon
,
vdec_FrameDMVRecon
}
};
{
{
NULL
,
vdec_
MotionFieldField
,
vdec_MotionField16x8
,
vdec_MotionFieldDMV
},
{
NULL
,
vdec_
MotionFrameField
,
vdec_MotionFrameFrame
,
vdec_MotionFrameDMV
}
};
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
}
};
...
...
@@ -685,7 +685,7 @@ static __inline__ void MacroblockModes( vpar_thread_t * p_vpar,
{
/* For the intra macroblocks, we use an empty motion
* compensation function */
p_mb
->
pf_motion
=
vdec_
DummyRecon
;
p_mb
->
pf_motion
=
vdec_
MotionDummy
;
}
else
{
...
...
@@ -752,8 +752,8 @@ i_count++;
{
/* Skipped macroblock (ISO/IEC 13818-2 7.6.6). */
static
int
pi_dc_dct_reinit
[
4
]
=
{
128
,
256
,
512
,
1024
};
static
f_motion_t
pf_motion_skipped
[
4
]
=
{
NULL
,
vdec_MotionField
,
vdec_MotionField
,
vdec_Motion
Frame
};
static
f_motion_t
pf_motion_skipped
[
4
]
=
{
NULL
,
vdec_MotionField
Field
,
vdec_MotionField
Field
,
vdec_MotionFrame
Frame
};
/* Reset DC predictors (7.2.1). */
p_vpar
->
slice
.
pi_dc_dct_pred
[
0
]
=
p_vpar
->
slice
.
pi_dc_dct_pred
[
1
]
...
...
src/video_parser/vpar_headers.c
View file @
dd4339a9
...
...
@@ -624,7 +624,8 @@ static void PictureHeader( vpar_thread_t * p_vpar )
{
/* Do we have the reference pictures ? */
b_parsable
=
!
((
p_vpar
->
picture
.
i_coding_type
==
P_CODING_TYPE
)
&&
(
p_vpar
->
sequence
.
p_forward
==
NULL
))
||
(
p_vpar
->
sequence
.
p_backward
==
NULL
))
||
/* p_backward will become p_forward later */
((
p_vpar
->
picture
.
i_coding_type
==
B_CODING_TYPE
)
&&
(
p_vpar
->
sequence
.
p_forward
==
NULL
||
p_vpar
->
sequence
.
p_backward
==
NULL
));
...
...
@@ -660,16 +661,18 @@ static void PictureHeader( vpar_thread_t * p_vpar )
if
(
!
p_vpar
->
picture
.
i_current_structure
)
{
/* This is a new frame. Get a structure from the video_output. */
if
(
(
P_picture
=
vout_CreatePicture
(
p_vpar
->
p_vout
,
while
(
(
P_picture
=
vout_CreatePicture
(
p_vpar
->
p_vout
,
99
+
p_vpar
->
sequence
.
i_chroma_format
,
/*???*/
p_vpar
->
sequence
.
i_width
,
p_vpar
->
sequence
.
i_height
,
p_vpar
->
sequence
.
i_width
*
sizeof
(
yuv_data_t
)
)
)
p_vpar
->
sequence
.
i_height
)
)
==
NULL
)
{
intf_ErrMsg
(
"vpar debug: allocation error in vout_CreatePicture
\n
"
);
p_vpar
->
b_error
=
1
;
return
;
if
(
p_vpar
->
b_die
)
{
return
;
}
mwait
(
VPAR_IDLE_SLEEP
);
}
/* Initialize values. */
...
...
@@ -678,9 +681,9 @@ static void PictureHeader( vpar_thread_t * p_vpar )
i_structure
);
P_picture
->
i_aspect_ratio
=
p_vpar
->
sequence
.
i_aspect_ratio
;
P_picture
->
i_matrix_coefficients
=
p_vpar
->
sequence
.
i_matrix_coefficients
;
p_vpar
->
picture
.
i_l_stride
=
-
8
+
(
p_vpar
->
sequence
.
i_width
p_vpar
->
picture
.
i_l_stride
=
(
p_vpar
->
sequence
.
i_width
<<
(
1
-
p_vpar
->
picture
.
b_frame_structure
)
);
p_vpar
->
picture
.
i_c_stride
=
-
8
+
(
p_vpar
->
sequence
.
i_chroma_width
p_vpar
->
picture
.
i_c_stride
=
(
p_vpar
->
sequence
.
i_chroma_width
<<
(
1
-
p_vpar
->
picture
.
b_frame_structure
));
P_picture
->
i_deccount
=
p_vpar
->
sequence
.
i_mb_size
;
...
...
@@ -749,7 +752,7 @@ fprintf(stderr, "Image trashee\n");
}
else
if
(
p_vpar
->
picture
.
i_current_structure
==
FRAME_STRUCTURE
)
{
fprintf
(
stderr
,
"Image parsee
\n
"
);
fprintf
(
stderr
,
"Image parsee
(%d)
\n
"
,
p_vpar
->
picture
.
i_coding_type
);
/* Frame completely parsed. */
for
(
i_mb
=
1
;
p_vpar
->
picture
.
pp_mb
[
i_mb
];
i_mb
++
)
{
...
...
src/video_parser/vpar_synchro.c
View file @
dd4339a9
...
...
@@ -49,7 +49,7 @@
boolean_t
vpar_SynchroChoose
(
vpar_thread_t
*
p_vpar
,
int
i_coding_type
,
int
i_structure
)
{
return
(
1
);
//
return( 1 );
return
(
i_coding_type
==
I_CODING_TYPE
||
i_coding_type
==
P_CODING_TYPE
);
//return( i_coding_type == I_CODING_TYPE );
}
...
...
@@ -69,7 +69,7 @@ void vpar_SynchroTrash( vpar_thread_t * p_vpar, int i_coding_type,
mtime_t
vpar_SynchroDecode
(
vpar_thread_t
*
p_vpar
,
int
i_coding_type
,
int
i_structure
)
{
return
mdate
()
+
5
00000
;
return
mdate
()
+
30
00000
;
}
/*****************************************************************************
...
...
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