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
99558270
Commit
99558270
authored
Jul 12, 2015
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/hevc: Simplify skipped_bytes_pos code further
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
ad92410d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
30 deletions
+25
-30
hevc.c
libavcodec/hevc.c
+3
-5
hevc.h
libavcodec/hevc.h
+2
-4
hevc_parse.c
libavcodec/hevc_parse.c
+17
-18
hevc_parser.c
libavcodec/hevc_parser.c
+3
-3
No files found.
libavcodec/hevc.c
View file @
99558270
...
...
@@ -2455,7 +2455,7 @@ static int hls_slice_data_wpp(HEVCContext *s, const HEVCNAL *nal)
offset
=
(
lc
->
gb
.
index
>>
3
);
for
(
j
=
0
,
cmpt
=
0
,
startheader
=
offset
+
s
->
sh
.
entry_point_offset
[
0
];
j
<
nal
->
skipped_bytes
;
j
++
)
{
if
(
s
->
skipped_bytes_pos
[
j
]
>=
offset
&&
s
->
skipped_bytes_pos
[
j
]
<
startheader
)
{
if
(
nal
->
skipped_bytes_pos
[
j
]
>=
offset
&&
nal
->
skipped_bytes_pos
[
j
]
<
startheader
)
{
startheader
--
;
cmpt
++
;
}
...
...
@@ -2465,7 +2465,7 @@ static int hls_slice_data_wpp(HEVCContext *s, const HEVCNAL *nal)
offset
+=
(
s
->
sh
.
entry_point_offset
[
i
-
1
]
-
cmpt
);
for
(
j
=
0
,
cmpt
=
0
,
startheader
=
offset
+
s
->
sh
.
entry_point_offset
[
i
];
j
<
nal
->
skipped_bytes
;
j
++
)
{
if
(
s
->
skipped_bytes_pos
[
j
]
>=
offset
&&
s
->
skipped_bytes_pos
[
j
]
<
startheader
)
{
if
(
nal
->
skipped_bytes_pos
[
j
]
>=
offset
&&
nal
->
skipped_bytes_pos
[
j
]
<
startheader
)
{
startheader
--
;
cmpt
++
;
}
...
...
@@ -2781,8 +2781,6 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
/* decode the NAL units */
for
(
i
=
0
;
i
<
s
->
pkt
.
nb_nals
;
i
++
)
{
s
->
skipped_bytes_pos
=
s
->
pkt
.
nals
[
i
].
skipped_bytes_pos_nal
;
ret
=
decode_nal_unit
(
s
,
&
s
->
pkt
.
nals
[
i
]);
if
(
ret
<
0
)
{
av_log
(
s
->
avctx
,
AV_LOG_WARNING
,
...
...
@@ -3011,7 +3009,7 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx)
for
(
i
=
0
;
i
<
s
->
pkt
.
nals_allocated
;
i
++
)
{
av_freep
(
&
s
->
pkt
.
nals
[
i
].
rbsp_buffer
);
av_freep
(
&
s
->
pkt
.
nals
[
i
].
skipped_bytes_pos
_nal
);
av_freep
(
&
s
->
pkt
.
nals
[
i
].
skipped_bytes_pos
);
}
av_freep
(
&
s
->
pkt
.
nals
);
s
->
pkt
.
nals_allocated
=
0
;
...
...
libavcodec/hevc.h
View file @
99558270
...
...
@@ -761,8 +761,8 @@ typedef struct HEVCNAL {
int
temporal_id
;
int
skipped_bytes
;
int
skipped_bytes_pos_size
_nal
;
int
*
skipped_bytes_pos
_nal
;
int
skipped_bytes_pos_size
;
int
*
skipped_bytes_pos
;
}
HEVCNAL
;
/* an input packet split into unescaped NAL units */
...
...
@@ -901,8 +901,6 @@ typedef struct HEVCContext {
int
enable_parallel_tiles
;
int
wpp_err
;
int
*
skipped_bytes_pos
;
int
skipped_bytes_pos_size
;
const
uint8_t
*
data
;
...
...
libavcodec/hevc_parse.c
View file @
99558270
...
...
@@ -110,18 +110,21 @@ int ff_hevc_extract_rbsp(HEVCContext *s, const uint8_t *src, int length,
dst
[
di
++
]
=
0
;
si
+=
3
;
if
(
s
)
{
nal
->
skipped_bytes
++
;
if
(
s
->
skipped_bytes_pos_size
<
nal
->
skipped_bytes
)
{
s
->
skipped_bytes_pos_size
*=
2
;
av_reallocp_array
(
&
s
->
skipped_bytes_pos
,
s
->
skipped_bytes_pos_size
,
sizeof
(
*
s
->
skipped_bytes_pos
));
if
(
!
s
->
skipped_bytes_pos
)
return
AVERROR
(
ENOMEM
);
if
(
s
&&
nal
->
skipped_bytes_pos
)
{
nal
->
skipped_bytes
++
;
if
(
nal
->
skipped_bytes_pos_size
<
nal
->
skipped_bytes
)
{
nal
->
skipped_bytes_pos_size
*=
2
;
av_assert0
(
nal
->
skipped_bytes_pos_size
>=
nal
->
skipped_bytes
);
av_reallocp_array
(
&
nal
->
skipped_bytes_pos
,
nal
->
skipped_bytes_pos_size
,
sizeof
(
*
nal
->
skipped_bytes_pos
));
if
(
!
nal
->
skipped_bytes_pos
)
{
nal
->
skipped_bytes_pos_size
=
0
;
return
AVERROR
(
ENOMEM
);
}
if
(
s
->
skipped_bytes_pos
)
s
->
skipped_bytes_pos
[
nal
->
skipped_bytes
-
1
]
=
di
-
1
;
}
if
(
nal
->
skipped_bytes_pos
)
nal
->
skipped_bytes_pos
[
nal
->
skipped_bytes
-
1
]
=
di
-
1
;
}
continue
;
}
else
// next start code
...
...
@@ -219,23 +222,19 @@ int ff_hevc_split_packet(HEVCContext *s, HEVCPacket *pkt, const uint8_t *buf, in
(
new_size
-
pkt
->
nals_allocated
)
*
sizeof
(
*
pkt
->
nals
));
nal
=
&
pkt
->
nals
[
pkt
->
nb_nals
];
nal
->
skipped_bytes_pos_size
_nal
=
1024
;
// initial buffer size
nal
->
skipped_bytes_pos
_nal
=
av_malloc_array
(
nal
->
skipped_bytes_pos_size_nal
,
sizeof
(
*
s
->
skipped_bytes_pos
));
if
(
!
nal
->
skipped_bytes_pos
_nal
)
nal
->
skipped_bytes_pos_size
=
1024
;
// initial buffer size
nal
->
skipped_bytes_pos
=
av_malloc_array
(
nal
->
skipped_bytes_pos_size
,
sizeof
(
*
nal
->
skipped_bytes_pos
));
if
(
!
nal
->
skipped_bytes_pos
)
return
AVERROR
(
ENOMEM
);
pkt
->
nals_allocated
=
new_size
;
}
nal
=
&
pkt
->
nals
[
pkt
->
nb_nals
];
s
->
skipped_bytes_pos_size
=
nal
->
skipped_bytes_pos_size_nal
;
s
->
skipped_bytes_pos
=
nal
->
skipped_bytes_pos_nal
;
consumed
=
ff_hevc_extract_rbsp
(
s
,
buf
,
extract_length
,
nal
);
if
(
consumed
<
0
)
return
consumed
;
nal
->
skipped_bytes_pos_size_nal
=
s
->
skipped_bytes_pos_size
;
nal
->
skipped_bytes_pos_nal
=
s
->
skipped_bytes_pos
;
pkt
->
nb_nals
++
;
ret
=
init_get_bits8
(
&
nal
->
gb
,
nal
->
data
,
nal
->
size
);
...
...
libavcodec/hevc_parser.c
View file @
99558270
...
...
@@ -313,7 +313,6 @@ static int hevc_init(AVCodecParserContext *s)
h
->
HEVClc
=
av_mallocz
(
sizeof
(
HEVCLocalContext
));
if
(
!
h
->
HEVClc
)
return
AVERROR
(
ENOMEM
);
h
->
skipped_bytes_pos_size
=
INT_MAX
;
return
0
;
}
...
...
@@ -326,7 +325,6 @@ static void hevc_close(AVCodecParserContext *s)
HEVCParamSets
*
ps
=
&
h
->
ps
;
HEVCPacket
*
pkt
=
&
h
->
pkt
;
av_freep
(
&
h
->
skipped_bytes_pos
);
av_freep
(
&
h
->
HEVClc
);
av_freep
(
&
pc
->
buffer
);
...
...
@@ -339,8 +337,10 @@ static void hevc_close(AVCodecParserContext *s)
ps
->
sps
=
NULL
;
for
(
i
=
0
;
i
<
pkt
->
nals_allocated
;
i
++
)
for
(
i
=
0
;
i
<
pkt
->
nals_allocated
;
i
++
)
{
av_freep
(
&
pkt
->
nals
[
i
].
rbsp_buffer
);
av_freep
(
&
pkt
->
nals
[
i
].
skipped_bytes_pos
);
}
av_freep
(
&
pkt
->
nals
);
pkt
->
nals_allocated
=
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