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
3178f4d3
Commit
3178f4d3
authored
Jan 17, 2015
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h264: move rbsp_buffer into the per-slice context
parent
582683b6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
18 deletions
+17
-18
h264.c
libavcodec/h264.c
+11
-11
h264.h
libavcodec/h264.h
+5
-3
h264_parser.c
libavcodec/h264_parser.c
+1
-1
h264_slice.c
libavcodec/h264_slice.c
+0
-3
No files found.
libavcodec/h264.c
View file @
3178f4d3
...
...
@@ -216,7 +216,8 @@ int ff_h264_check_intra_pred_mode(const H264Context *h, H264SliceContext *sl,
return
mode
;
}
const
uint8_t
*
ff_h264_decode_nal
(
H264Context
*
h
,
const
uint8_t
*
src
,
const
uint8_t
*
ff_h264_decode_nal
(
H264Context
*
h
,
H264SliceContext
*
sl
,
const
uint8_t
*
src
,
int
*
dst_length
,
int
*
consumed
,
int
length
)
{
int
i
,
si
,
di
;
...
...
@@ -282,9 +283,9 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src,
return
src
;
}
av_fast_malloc
(
&
h
->
rbsp_buffer
,
&
h
->
rbsp_buffer_size
,
av_fast_malloc
(
&
sl
->
rbsp_buffer
,
&
sl
->
rbsp_buffer_size
,
length
+
FF_INPUT_BUFFER_PADDING_SIZE
);
dst
=
h
->
rbsp_buffer
;
dst
=
sl
->
rbsp_buffer
;
if
(
!
dst
)
return
NULL
;
...
...
@@ -380,10 +381,6 @@ void ff_h264_free_tables(H264Context *h, int free_rbsp)
if
(
!
hx
)
continue
;
if
(
free_rbsp
)
{
av_freep
(
&
hx
->
rbsp_buffer
);
hx
->
rbsp_buffer_size
=
0
;
}
if
(
i
)
av_freep
(
&
h
->
thread_context
[
i
]);
}
...
...
@@ -405,6 +402,11 @@ void ff_h264_free_tables(H264Context *h, int free_rbsp)
sl
->
edge_emu_buffer_allocated
=
0
;
sl
->
top_borders_allocated
[
0
]
=
0
;
sl
->
top_borders_allocated
[
1
]
=
0
;
if
(
free_rbsp
)
{
av_freep
(
&
sl
->
rbsp_buffer
);
sl
->
rbsp_buffer_size
=
0
;
}
}
}
...
...
@@ -709,8 +711,6 @@ static int decode_init_thread_copy(AVCodecContext *avctx)
h
->
slice_ctx
[
i
].
h264
=
h
;
h
->
avctx
=
avctx
;
h
->
rbsp_buffer
=
NULL
;
h
->
rbsp_buffer_size
=
0
;
h
->
context_initialized
=
0
;
return
0
;
...
...
@@ -1385,7 +1385,7 @@ static int get_last_needed_nal(H264Context *h, const uint8_t *buf, int buf_size)
break
;
}
ptr
=
ff_h264_decode_nal
(
h
,
buf
+
buf_index
,
&
dst_length
,
&
consumed
,
ptr
=
ff_h264_decode_nal
(
h
,
&
h
->
slice_ctx
[
0
],
buf
+
buf_index
,
&
dst_length
,
&
consumed
,
next_avc
-
buf_index
);
if
(
!
ptr
||
dst_length
<
0
)
...
...
@@ -1471,7 +1471,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size,
hx
=
h
->
thread_context
[
context_count
];
sl
=
&
h
->
slice_ctx
[
context_count
];
ptr
=
ff_h264_decode_nal
(
hx
,
buf
+
buf_index
,
&
dst_length
,
ptr
=
ff_h264_decode_nal
(
hx
,
sl
,
buf
+
buf_index
,
&
dst_length
,
&
consumed
,
next_avc
-
buf_index
);
if
(
!
ptr
||
dst_length
<
0
)
{
ret
=
-
1
;
...
...
libavcodec/h264.h
View file @
3178f4d3
...
...
@@ -439,6 +439,10 @@ typedef struct H264SliceContext {
CABACContext
cabac
;
uint8_t
cabac_state
[
1024
];
int
cabac_init_idc
;
// rbsp buffer used for this slice
uint8_t
*
rbsp_buffer
;
unsigned
int
rbsp_buffer_size
;
}
H264SliceContext
;
/**
...
...
@@ -542,8 +546,6 @@ typedef struct H264Context {
int
nal_ref_idc
;
int
nal_unit_type
;
uint8_t
*
rbsp_buffer
;
unsigned
int
rbsp_buffer_size
;
/**
* Used to parse AVC variant of h264
...
...
@@ -757,7 +759,7 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length);
* or a decode rbsp tailing?
* @return decoded bytes, might be src+1 if no escapes
*/
const
uint8_t
*
ff_h264_decode_nal
(
H264Context
*
h
,
const
uint8_t
*
src
,
const
uint8_t
*
ff_h264_decode_nal
(
H264Context
*
h
,
H264SliceContext
*
sl
,
const
uint8_t
*
src
,
int
*
dst_length
,
int
*
consumed
,
int
length
);
/**
...
...
libavcodec/h264_parser.c
View file @
3178f4d3
...
...
@@ -226,7 +226,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
}
break
;
}
ptr
=
ff_h264_decode_nal
(
h
,
buf
,
&
dst_length
,
&
consumed
,
src_length
);
ptr
=
ff_h264_decode_nal
(
h
,
sl
,
buf
,
&
dst_length
,
&
consumed
,
src_length
);
if
(
!
ptr
||
dst_length
<
0
)
break
;
...
...
libavcodec/h264_slice.c
View file @
3178f4d3
...
...
@@ -535,9 +535,6 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
return
ret
;
}
h
->
rbsp_buffer
=
NULL
;
h
->
rbsp_buffer_size
=
0
;
h
->
thread_context
[
0
]
=
h
;
h
->
context_initialized
=
1
;
...
...
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