[vlc-commits] h264_nal: remove unused H264ConvertState
Thomas Guillem
git at videolan.org
Wed Jul 29 16:01:03 CEST 2015
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Jul 29 15:57:31 2015 +0200| [c3dec45d9b9c15861c75c83c561891473fd97d71] | committer: Thomas Guillem
h264_nal: remove unused H264ConvertState
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c3dec45d9b9c15861c75c83c561891473fd97d71
---
modules/codec/mft.c | 3 +--
modules/codec/omxil/mediacodec.c | 6 ++----
modules/codec/omxil/omxil.c | 3 +--
modules/packetizer/h264_nal.c | 27 ++++++++++++++-------------
modules/packetizer/h264_nal.h | 9 +--------
5 files changed, 19 insertions(+), 29 deletions(-)
diff --git a/modules/codec/mft.c b/modules/codec/mft.c
index 8c9373a..e41762c 100644
--- a/modules/codec/mft.c
+++ b/modules/codec/mft.c
@@ -575,8 +575,7 @@ static int ProcessInputStream(decoder_t *p_dec, DWORD stream_id, block_t *p_bloc
if (p_dec->fmt_in.i_codec == VLC_CODEC_H264)
{
/* in-place NAL to annex B conversion. */
- struct H264ConvertState convert_state = { 0, 0 };
- convert_h264_to_annexb(buffer_start, p_block->i_buffer, p_sys->nal_size, &convert_state);
+ convert_h264_to_annexb(buffer_start, p_block->i_buffer, p_sys->nal_size);
}
hr = IMFMediaBuffer_Unlock(input_media_buffer);
diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index ad56f77..97d082c 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -1126,14 +1126,13 @@ static void H264ProcessBlock(decoder_t *p_dec, block_t *p_block,
bool *p_csd_changed, bool *p_size_changed)
{
decoder_sys_t *p_sys = p_dec->p_sys;
- struct H264ConvertState convert_state = { 0, 0 };
assert(p_dec->fmt_in.i_codec == VLC_CODEC_H264 && p_block);
if (p_sys->u.video.i_nal_size)
{
convert_h264_to_annexb(p_block->p_buffer, p_block->i_buffer,
- p_sys->u.video.i_nal_size, &convert_state);
+ p_sys->u.video.i_nal_size);
} else if (H264SetCSD(p_dec, p_block->p_buffer, p_block->i_buffer,
p_size_changed) == VLC_SUCCESS)
{
@@ -1145,14 +1144,13 @@ static void HEVCProcessBlock(decoder_t *p_dec, block_t *p_block,
bool *p_csd_changed, bool *p_size_changed)
{
decoder_sys_t *p_sys = p_dec->p_sys;
- struct H264ConvertState convert_state = { 0, 0 };
assert(p_dec->fmt_in.i_codec == VLC_CODEC_HEVC && p_block);
if (p_sys->u.video.i_nal_size)
{
convert_h264_to_annexb(p_block->p_buffer, p_block->i_buffer,
- p_sys->u.video.i_nal_size, &convert_state);
+ p_sys->u.video.i_nal_size);
}
/* TODO */
diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index cecd3e3..30ee789 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -1430,7 +1430,6 @@ static int DecodeVideoInput( decoder_t *p_dec, OmxPort *p_port, block_t **pp_blo
{
decoder_sys_t *p_sys = p_dec->p_sys;
OMX_BUFFERHEADERTYPE *p_header;
- struct H264ConvertState convert_state = { 0, 0 };
block_t *p_block = *pp_block;
/* Send the input buffer to the component */
@@ -1486,7 +1485,7 @@ static int DecodeVideoInput( decoder_t *p_dec, OmxPort *p_port, block_t **pp_blo
* i_nal_size_length == 0, which is the case for codecs other
* than H.264 */
convert_h264_to_annexb( p_header->pBuffer, p_header->nFilledLen,
- p_sys->i_nal_size_length, &convert_state );
+ p_sys->i_nal_size_length);
OMX_DBG( "EmptyThisBuffer %p, %p, %i, %"PRId64, p_header, p_header->pBuffer,
(int)p_header->nFilledLen, FromOmxTicks(p_header->nTimeStamp) );
OMX_EmptyThisBuffer(p_port->omx_handle, p_header);
diff --git a/modules/packetizer/h264_nal.c b/modules/packetizer/h264_nal.c
index a894763..10a7494 100644
--- a/modules/packetizer/h264_nal.c
+++ b/modules/packetizer/h264_nal.c
@@ -102,40 +102,41 @@ int convert_sps_pps( decoder_t *p_dec, const uint8_t *p_buf,
}
void convert_h264_to_annexb( uint8_t *p_buf, uint32_t i_len,
- size_t i_nal_size,
- struct H264ConvertState *state )
+ size_t i_nal_size )
{
+ uint32_t nal_len = 0, nal_pos = 0;
+
if( i_nal_size < 3 || i_nal_size > 4 )
return;
/* This only works for NAL sizes 3-4 */
while( i_len > 0 )
{
- if( state->nal_pos < i_nal_size ) {
+ if( nal_pos < i_nal_size ) {
unsigned int i;
- for( i = 0; state->nal_pos < i_nal_size && i < i_len; i++, state->nal_pos++ ) {
- state->nal_len = (state->nal_len << 8) | p_buf[i];
+ for( i = 0; nal_pos < i_nal_size && i < i_len; i++, nal_pos++ ) {
+ nal_len = (nal_len << 8) | p_buf[i];
p_buf[i] = 0;
}
- if( state->nal_pos < i_nal_size )
+ if( nal_pos < i_nal_size )
return;
p_buf[i - 1] = 1;
p_buf += i;
i_len -= i;
}
- if( state->nal_len > INT_MAX )
+ if( nal_len > INT_MAX )
return;
- if( state->nal_len > i_len )
+ if( nal_len > i_len )
{
- state->nal_len -= i_len;
+ nal_len -= i_len;
return;
}
else
{
- p_buf += state->nal_len;
- i_len -= state->nal_len;
- state->nal_len = 0;
- state->nal_pos = 0;
+ p_buf += nal_len;
+ i_len -= nal_len;
+ nal_len = 0;
+ nal_pos = 0;
}
}
}
diff --git a/modules/packetizer/h264_nal.h b/modules/packetizer/h264_nal.h
index 5a577d4..a178138 100644
--- a/modules/packetizer/h264_nal.h
+++ b/modules/packetizer/h264_nal.h
@@ -120,15 +120,8 @@ int convert_sps_pps( decoder_t *p_dec, const uint8_t *p_buf,
uint32_t i_out_buf_size, uint32_t *p_sps_pps_size,
uint32_t *p_nal_size);
-/* Convert H.264 NAL format to annex b in-place */
-struct H264ConvertState {
- uint32_t nal_len;
- uint32_t nal_pos;
-};
-
void convert_h264_to_annexb( uint8_t *p_buf, uint32_t i_len,
- size_t i_nal_size,
- struct H264ConvertState *state );
+ size_t i_nal_size );
/* Get the SPS/PPS pointers from an Annex B buffer
* Returns 0 if a SPS and/or a PPS is found */
More information about the vlc-commits
mailing list