Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
8b5007a3
Commit
8b5007a3
authored
Jun 10, 2015
by
Vittorio Giovara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpegvideo: Move ER functions to a separate file
parent
c0e6b8ca
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
66 deletions
+74
-66
mpeg_er.c
libavcodec/mpeg_er.c
+71
-0
mpeg_er.h
libavcodec/mpeg_er.h
+1
-0
mpegvideo.c
libavcodec/mpegvideo.c
+2
-66
No files found.
libavcodec/mpeg_er.c
View file @
8b5007a3
...
...
@@ -57,3 +57,74 @@ void ff_mpeg_er_frame_start(MpegEncContext *s)
ff_er_frame_start
(
er
);
}
static
void
mpeg_er_decode_mb
(
void
*
opaque
,
int
ref
,
int
mv_dir
,
int
mv_type
,
int
(
*
mv
)[
2
][
4
][
2
],
int
mb_x
,
int
mb_y
,
int
mb_intra
,
int
mb_skipped
)
{
MpegEncContext
*
s
=
opaque
;
s
->
mv_dir
=
mv_dir
;
s
->
mv_type
=
mv_type
;
s
->
mb_intra
=
mb_intra
;
s
->
mb_skipped
=
mb_skipped
;
s
->
mb_x
=
mb_x
;
s
->
mb_y
=
mb_y
;
memcpy
(
s
->
mv
,
mv
,
sizeof
(
*
mv
));
ff_init_block_index
(
s
);
ff_update_block_index
(
s
);
s
->
bdsp
.
clear_blocks
(
s
->
block
[
0
]);
s
->
dest
[
0
]
=
s
->
current_picture
.
f
->
data
[
0
]
+
s
->
mb_y
*
16
*
s
->
linesize
+
s
->
mb_x
*
16
;
s
->
dest
[
1
]
=
s
->
current_picture
.
f
->
data
[
1
]
+
s
->
mb_y
*
(
16
>>
s
->
chroma_y_shift
)
*
s
->
uvlinesize
+
s
->
mb_x
*
(
16
>>
s
->
chroma_x_shift
);
s
->
dest
[
2
]
=
s
->
current_picture
.
f
->
data
[
2
]
+
s
->
mb_y
*
(
16
>>
s
->
chroma_y_shift
)
*
s
->
uvlinesize
+
s
->
mb_x
*
(
16
>>
s
->
chroma_x_shift
);
if
(
ref
)
av_log
(
s
->
avctx
,
AV_LOG_DEBUG
,
"Interlaced error concealment is not fully implemented
\n
"
);
ff_mpv_decode_mb
(
s
,
s
->
block
);
}
int
ff_mpeg_er_init
(
MpegEncContext
*
s
)
{
ERContext
*
er
=
&
s
->
er
;
int
mb_array_size
=
s
->
mb_height
*
s
->
mb_stride
;
int
i
;
er
->
avctx
=
s
->
avctx
;
er
->
mb_index2xy
=
s
->
mb_index2xy
;
er
->
mb_num
=
s
->
mb_num
;
er
->
mb_width
=
s
->
mb_width
;
er
->
mb_height
=
s
->
mb_height
;
er
->
mb_stride
=
s
->
mb_stride
;
er
->
b8_stride
=
s
->
b8_stride
;
er
->
er_temp_buffer
=
av_malloc
(
s
->
mb_height
*
s
->
mb_stride
);
er
->
error_status_table
=
av_mallocz
(
mb_array_size
);
if
(
!
er
->
er_temp_buffer
||
!
er
->
error_status_table
)
goto
fail
;
er
->
mbskip_table
=
s
->
mbskip_table
;
er
->
mbintra_table
=
s
->
mbintra_table
;
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
s
->
dc_val
);
i
++
)
er
->
dc_val
[
i
]
=
s
->
dc_val
[
i
];
er
->
decode_mb
=
mpeg_er_decode_mb
;
er
->
opaque
=
s
;
return
0
;
fail:
av_freep
(
&
er
->
er_temp_buffer
);
av_freep
(
&
er
->
error_status_table
);
return
AVERROR
(
ENOMEM
);
}
libavcodec/mpeg_er.h
View file @
8b5007a3
...
...
@@ -21,6 +21,7 @@
#include "mpegvideo.h"
int
ff_mpeg_er_init
(
MpegEncContext
*
s
);
void
ff_mpeg_er_frame_start
(
MpegEncContext
*
s
);
#endif
/* AVCODEC_MPEG_ER_H */
libavcodec/mpegvideo.c
View file @
8b5007a3
...
...
@@ -37,6 +37,7 @@
#include "idctdsp.h"
#include "internal.h"
#include "mathops.h"
#include "mpeg_er.h"
#include "mpegutils.h"
#include "mpegvideo.h"
#include "mpegvideodata.h"
...
...
@@ -266,35 +267,6 @@ static void dct_unquantize_h263_inter_c(MpegEncContext *s,
}
}
static
void
mpeg_er_decode_mb
(
void
*
opaque
,
int
ref
,
int
mv_dir
,
int
mv_type
,
int
(
*
mv
)[
2
][
4
][
2
],
int
mb_x
,
int
mb_y
,
int
mb_intra
,
int
mb_skipped
)
{
MpegEncContext
*
s
=
opaque
;
s
->
mv_dir
=
mv_dir
;
s
->
mv_type
=
mv_type
;
s
->
mb_intra
=
mb_intra
;
s
->
mb_skipped
=
mb_skipped
;
s
->
mb_x
=
mb_x
;
s
->
mb_y
=
mb_y
;
memcpy
(
s
->
mv
,
mv
,
sizeof
(
*
mv
));
ff_init_block_index
(
s
);
ff_update_block_index
(
s
);
s
->
bdsp
.
clear_blocks
(
s
->
block
[
0
]);
s
->
dest
[
0
]
=
s
->
current_picture
.
f
->
data
[
0
]
+
(
s
->
mb_y
*
16
*
s
->
linesize
)
+
s
->
mb_x
*
16
;
s
->
dest
[
1
]
=
s
->
current_picture
.
f
->
data
[
1
]
+
(
s
->
mb_y
*
(
16
>>
s
->
chroma_y_shift
)
*
s
->
uvlinesize
)
+
s
->
mb_x
*
(
16
>>
s
->
chroma_x_shift
);
s
->
dest
[
2
]
=
s
->
current_picture
.
f
->
data
[
2
]
+
(
s
->
mb_y
*
(
16
>>
s
->
chroma_y_shift
)
*
s
->
uvlinesize
)
+
s
->
mb_x
*
(
16
>>
s
->
chroma_x_shift
);
if
(
ref
)
av_log
(
s
->
avctx
,
AV_LOG_DEBUG
,
"Interlaced error concealment is not fully implemented
\n
"
);
ff_mpv_decode_mb
(
s
,
s
->
block
);
}
/* init common dct for both encoder and decoder */
static
av_cold
int
dct_init
(
MpegEncContext
*
s
)
{
...
...
@@ -645,42 +617,6 @@ void ff_mpv_decode_defaults(MpegEncContext *s)
ff_mpv_common_defaults
(
s
);
}
static
int
init_er
(
MpegEncContext
*
s
)
{
ERContext
*
er
=
&
s
->
er
;
int
mb_array_size
=
s
->
mb_height
*
s
->
mb_stride
;
int
i
;
er
->
avctx
=
s
->
avctx
;
er
->
mb_index2xy
=
s
->
mb_index2xy
;
er
->
mb_num
=
s
->
mb_num
;
er
->
mb_width
=
s
->
mb_width
;
er
->
mb_height
=
s
->
mb_height
;
er
->
mb_stride
=
s
->
mb_stride
;
er
->
b8_stride
=
s
->
b8_stride
;
er
->
er_temp_buffer
=
av_malloc
(
s
->
mb_height
*
s
->
mb_stride
);
er
->
error_status_table
=
av_mallocz
(
mb_array_size
);
if
(
!
er
->
er_temp_buffer
||
!
er
->
error_status_table
)
goto
fail
;
er
->
mbskip_table
=
s
->
mbskip_table
;
er
->
mbintra_table
=
s
->
mbintra_table
;
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
s
->
dc_val
);
i
++
)
er
->
dc_val
[
i
]
=
s
->
dc_val
[
i
];
er
->
decode_mb
=
mpeg_er_decode_mb
;
er
->
opaque
=
s
;
return
0
;
fail:
av_freep
(
&
er
->
er_temp_buffer
);
av_freep
(
&
er
->
error_status_table
);
return
AVERROR
(
ENOMEM
);
}
/**
* Initialize and allocates MpegEncContext fields dependent on the resolution.
*/
...
...
@@ -815,7 +751,7 @@ static int init_context_frame(MpegEncContext *s)
FF_ALLOCZ_OR_GOTO
(
s
->
avctx
,
s
->
mbskip_table
,
mb_array_size
+
2
,
fail
);
// Note the + 1 is for a quicker mpeg4 slice_end detection
return
init_er
(
s
);
return
ff_mpeg_er_init
(
s
);
fail:
return
AVERROR
(
ENOMEM
);
}
...
...
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