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
e2ceb176
Commit
e2ceb176
authored
Nov 26, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpeg4videodec: move mpeg4-specific post-frame-decode code from h264dec to mpeg4videodec
parent
b452d5ae
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
33 deletions
+46
-33
h263dec.c
libavcodec/h263dec.c
+2
-33
mpeg4video.h
libavcodec/mpeg4video.h
+1
-0
mpeg4videodec.c
libavcodec/mpeg4videodec.c
+43
-0
No files found.
libavcodec/h263dec.c
View file @
e2ceb176
...
@@ -593,40 +593,9 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -593,40 +593,9 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
s
->
er
.
error_status_table
[
s
->
mb_num
-
1
]
=
ER_MB_ERROR
;
s
->
er
.
error_status_table
[
s
->
mb_num
-
1
]
=
ER_MB_ERROR
;
assert
(
s
->
bitstream_buffer_size
==
0
);
assert
(
s
->
bitstream_buffer_size
==
0
);
/* divx 5.01+ bistream reorder stuff */
if
(
s
->
codec_id
==
AV_CODEC_ID_MPEG4
&&
s
->
divx_packed
)
{
int
current_pos
=
get_bits_count
(
&
s
->
gb
)
>>
3
;
int
startcode_found
=
0
;
if
(
buf_size
-
current_pos
>
5
)
{
int
i
;
for
(
i
=
current_pos
;
i
<
buf_size
-
3
;
i
++
)
if
(
buf
[
i
]
==
0
&&
buf
[
i
+
1
]
==
0
&&
buf
[
i
+
2
]
==
1
&&
buf
[
i
+
3
]
==
0xB6
)
{
startcode_found
=
1
;
break
;
}
}
if
(
s
->
gb
.
buffer
==
s
->
bitstream_buffer
&&
buf_size
>
7
&&
s
->
xvid_build
>=
0
)
{
// xvid style
startcode_found
=
1
;
current_pos
=
0
;
}
if
(
startcode_found
)
{
if
(
CONFIG_MPEG4_DECODER
&&
avctx
->
codec_id
==
AV_CODEC_ID_MPEG4
)
av_fast_malloc
(
&
s
->
bitstream_buffer
,
ff_mpeg4_frame_end
(
avctx
,
buf
,
buf_size
);
&
s
->
allocated_bitstream_buffer_size
,
buf_size
-
current_pos
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!
s
->
bitstream_buffer
)
return
AVERROR
(
ENOMEM
);
memcpy
(
s
->
bitstream_buffer
,
buf
+
current_pos
,
buf_size
-
current_pos
);
s
->
bitstream_buffer_size
=
buf_size
-
current_pos
;
}
}
intrax8_decoded:
intrax8_decoded:
ff_er_frame_end
(
&
s
->
er
);
ff_er_frame_end
(
&
s
->
er
);
...
...
libavcodec/mpeg4video.h
View file @
e2ceb176
...
@@ -118,6 +118,7 @@ int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx);
...
@@ -118,6 +118,7 @@ int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx);
int
ff_mpeg4_get_video_packet_prefix_length
(
MpegEncContext
*
s
);
int
ff_mpeg4_get_video_packet_prefix_length
(
MpegEncContext
*
s
);
int
ff_mpeg4_decode_video_packet_header
(
Mpeg4DecContext
*
ctx
);
int
ff_mpeg4_decode_video_packet_header
(
Mpeg4DecContext
*
ctx
);
void
ff_mpeg4_init_direct_mv
(
MpegEncContext
*
s
);
void
ff_mpeg4_init_direct_mv
(
MpegEncContext
*
s
);
int
ff_mpeg4_frame_end
(
AVCodecContext
*
avctx
,
const
uint8_t
*
buf
,
int
buf_size
);
/**
/**
*
*
...
...
libavcodec/mpeg4videodec.c
View file @
e2ceb176
...
@@ -2492,6 +2492,49 @@ end:
...
@@ -2492,6 +2492,49 @@ end:
return
decode_vop_header
(
ctx
,
gb
);
return
decode_vop_header
(
ctx
,
gb
);
}
}
int
ff_mpeg4_frame_end
(
AVCodecContext
*
avctx
,
const
uint8_t
*
buf
,
int
buf_size
)
{
Mpeg4DecContext
*
ctx
=
avctx
->
priv_data
;
MpegEncContext
*
s
=
&
ctx
->
m
;
/* divx 5.01+ bistream reorder stuff */
if
(
s
->
divx_packed
)
{
int
current_pos
=
get_bits_count
(
&
s
->
gb
)
>>
3
;
int
startcode_found
=
0
;
if
(
buf_size
-
current_pos
>
5
)
{
int
i
;
for
(
i
=
current_pos
;
i
<
buf_size
-
3
;
i
++
)
if
(
buf
[
i
]
==
0
&&
buf
[
i
+
1
]
==
0
&&
buf
[
i
+
2
]
==
1
&&
buf
[
i
+
3
]
==
0xB6
)
{
startcode_found
=
1
;
break
;
}
}
if
(
s
->
gb
.
buffer
==
s
->
bitstream_buffer
&&
buf_size
>
7
&&
s
->
xvid_build
>=
0
)
{
// xvid style
startcode_found
=
1
;
current_pos
=
0
;
}
if
(
startcode_found
)
{
av_fast_malloc
(
&
s
->
bitstream_buffer
,
&
s
->
allocated_bitstream_buffer_size
,
buf_size
-
current_pos
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!
s
->
bitstream_buffer
)
return
AVERROR
(
ENOMEM
);
memcpy
(
s
->
bitstream_buffer
,
buf
+
current_pos
,
buf_size
-
current_pos
);
s
->
bitstream_buffer_size
=
buf_size
-
current_pos
;
}
}
return
0
;
}
static
int
mpeg4_update_thread_context
(
AVCodecContext
*
dst
,
static
int
mpeg4_update_thread_context
(
AVCodecContext
*
dst
,
const
AVCodecContext
*
src
)
const
AVCodecContext
*
src
)
{
{
...
...
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