From 8cd8240f7a1e7c2d5996f7043670067a3fec4e48 Mon Sep 17 00:00:00 2001 From: Ari Koivula Date: Wed, 4 Mar 2015 13:20:18 +0200 Subject: [PATCH] Rename struct bitstream to bitstream_t. --- src/bitstream.c | 18 +++++++++--------- src/bitstream.h | 20 ++++++++++---------- src/cabac.h | 2 +- src/encoder_state-bitstream.c | 26 +++++++++++++------------- src/encoderstate.h | 2 +- src/nal.c | 2 +- src/nal.h | 2 +- 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/bitstream.c b/src/bitstream.c index 61f8fe67..53162663 100644 --- a/src/bitstream.c +++ b/src/bitstream.c @@ -113,7 +113,7 @@ void free_exp_golomb() /** * \brief Initialize a new bitstream */ -int bitstream_init(bitstream * const stream, const bitstream_type type) { +int bitstream_init(bitstream_t * const stream, const bitstream_type type) { switch (type) { case BITSTREAM_TYPE_MEMORY: stream->mem.allocated_length = 0; @@ -142,7 +142,7 @@ int bitstream_init(bitstream * const stream, const bitstream_type type) { * \brief Finalize bitstream internal structures */ -int bitstream_finalize(bitstream * const stream) { +int bitstream_finalize(bitstream_t * const stream) { switch (stream->base.type) { case BITSTREAM_TYPE_MEMORY: FREE_POINTER(stream->mem.output_data); @@ -170,7 +170,7 @@ int bitstream_finalize(bitstream * const stream) { * \param byte byte to write * \return 1 on success, 0 on failure */ -int bitstream_writebyte(bitstream * const stream, const uint8_t byte) { +int bitstream_writebyte(bitstream_t * const stream, const uint8_t byte) { switch (stream->base.type) { case BITSTREAM_TYPE_FILE: if (fwrite(&byte, 1, 1, stream->file.output) != 1) { @@ -209,7 +209,7 @@ int bitstream_writebyte(bitstream * const stream, const uint8_t byte) { * \param stream pointer bitstream * \return position */ -long long unsigned int bitstream_tell(const bitstream * const stream) { +long long unsigned int bitstream_tell(const bitstream_t * const stream) { long long unsigned int position; switch (stream->base.type) { @@ -229,7 +229,7 @@ long long unsigned int bitstream_tell(const bitstream * const stream) { return position*8 + stream->base.cur_bit; } -int bitstream_append(bitstream * const dst, const bitstream * const src) { +int bitstream_append(bitstream_t * const dst, const bitstream_t * const src) { int i; switch(src->base.type) { @@ -246,7 +246,7 @@ int bitstream_append(bitstream * const dst, const bitstream * const src) { return 1; } -int bitstream_clear(bitstream * const bitstream) { +int bitstream_clear(bitstream_t * const bitstream) { switch(bitstream->base.type) { case BITSTREAM_TYPE_MEMORY: bitstream->mem.output_length = 0; @@ -265,7 +265,7 @@ int bitstream_clear(bitstream * const bitstream) { * \param data input data * \param bits number of bits to write from data to stream */ -void bitstream_put(bitstream * const stream, const uint32_t data, uint8_t bits) +void bitstream_put(bitstream_t * const stream, const uint32_t data, uint8_t bits) { const uint8_t emulation_prevention_three_byte = 0x03; while(bits--) { @@ -296,7 +296,7 @@ void bitstream_put(bitstream * const stream, const uint32_t data, uint8_t bits) /** * \brief Align the bitstream with one-bit padding */ -void bitstream_align(bitstream * const stream) +void bitstream_align(bitstream_t * const stream) { bitstream_put(stream, 1, 1); if ((stream->base.cur_bit & 7) != 0) { @@ -307,7 +307,7 @@ void bitstream_align(bitstream * const stream) /** * \brief Align the bitstream with zero */ -void bitstream_align_zero(bitstream * const stream) +void bitstream_align_zero(bitstream_t * const stream) { if ((stream->base.cur_bit & 7) != 0) { bitstream_put(stream, 0, 8 - (stream->base.cur_bit & 7)); diff --git a/src/bitstream.h b/src/bitstream.h index 7d930946..8b8ffdd5 100644 --- a/src/bitstream.h +++ b/src/bitstream.h @@ -58,7 +58,7 @@ typedef union bitstream_base base; bitstream_file file; bitstream_mem mem; -} bitstream; +} bitstream_t; typedef struct { @@ -68,22 +68,22 @@ typedef struct extern const bit_table *g_exp_table; -int bitstream_init(bitstream * stream, bitstream_type type); -int bitstream_finalize(bitstream * stream); -void bitstream_put(bitstream *stream, uint32_t data, uint8_t bits); -int bitstream_writebyte(bitstream *stream_abstract, uint8_t byte); -long long unsigned int bitstream_tell(const bitstream * stream); +int bitstream_init(bitstream_t * stream, bitstream_type type); +int bitstream_finalize(bitstream_t * stream); +void bitstream_put(bitstream_t *stream, uint32_t data, uint8_t bits); +int bitstream_writebyte(bitstream_t *stream_abstract, uint8_t byte); +long long unsigned int bitstream_tell(const bitstream_t * stream); -int bitstream_append(bitstream *dst, const bitstream *src); -int bitstream_clear(bitstream *stream); +int bitstream_append(bitstream_t *dst, const bitstream_t *src); +int bitstream_clear(bitstream_t *stream); /* Use macros to force inlining */ #define bitstream_put_ue(stream, data) { bitstream_put(stream,g_exp_table[data].value,g_exp_table[data].len); } #define bitstream_put_se(stream, data) { uint32_t index=(uint32_t)(((data)<=0)?(-(data))<<1:((data)<<1)-1); \ bitstream_put(stream,g_exp_table[index].value,g_exp_table[index].len); } -void bitstream_align(bitstream *stream); -void bitstream_align_zero(bitstream *stream); +void bitstream_align(bitstream_t *stream); +void bitstream_align_zero(bitstream_t *stream); int init_exp_golomb(uint32_t len); void free_exp_golomb(); diff --git a/src/cabac.h b/src/cabac.h index 2a583b16..c8c0f124 100644 --- a/src/cabac.h +++ b/src/cabac.h @@ -45,7 +45,7 @@ typedef struct int32_t num_buffered_bytes; int32_t bits_left; int8_t only_count; - bitstream *stream; + bitstream_t *stream; // CONTEXTS struct { diff --git a/src/encoder_state-bitstream.c b/src/encoder_state-bitstream.c index 135f2291..32f1b749 100644 --- a/src/encoder_state-bitstream.c +++ b/src/encoder_state-bitstream.c @@ -29,7 +29,7 @@ static void encoder_state_write_bitstream_access_unit_delimiter(encoder_state_t * const encoder_state) { - bitstream * const stream = &encoder_state->stream; + bitstream_t * const stream = &encoder_state->stream; uint8_t pic_type = encoder_state->global->slicetype == SLICE_I ? 0 : encoder_state->global->slicetype == SLICE_P ? 1 : 2; @@ -38,7 +38,7 @@ static void encoder_state_write_bitstream_access_unit_delimiter(encoder_state_t static void encoder_state_write_bitstream_aud(encoder_state_t * const encoder_state) { - bitstream * const stream = &encoder_state->stream; + bitstream_t * const stream = &encoder_state->stream; encoder_state_write_bitstream_access_unit_delimiter(encoder_state); nal_write(stream, AUD_NUT, 0, 1); bitstream_align(stream); @@ -46,7 +46,7 @@ static void encoder_state_write_bitstream_aud(encoder_state_t * const encoder_st static void encoder_state_write_bitstream_PTL(encoder_state_t * const encoder_state) { - bitstream * const stream = &encoder_state->stream; + bitstream_t * const stream = &encoder_state->stream; int i; // PTL // Profile Tier @@ -86,7 +86,7 @@ static void encoder_state_write_bitstream_PTL(encoder_state_t * const encoder_st static void encoder_state_write_bitstream_vid_parameter_set(encoder_state_t * const encoder_state) { - bitstream * const stream = &encoder_state->stream; + bitstream_t * const stream = &encoder_state->stream; int i; #ifdef _DEBUG printf("=========== Video Parameter Set ID: 0 ===========\n"); @@ -123,7 +123,7 @@ static void encoder_state_write_bitstream_vid_parameter_set(encoder_state_t * co static void encoder_state_write_bitstream_scaling_list(encoder_state_t * const encoder_state) { const encoder_control_t * const encoder = encoder_state->encoder_control; - bitstream * const stream = &encoder_state->stream; + bitstream_t * const stream = &encoder_state->stream; uint32_t size_id; for (size_id = 0; size_id < SCALING_LIST_SIZE_NUM; size_id++) { int32_t list_id; @@ -180,7 +180,7 @@ static void encoder_state_write_bitstream_scaling_list(encoder_state_t * const e static void encoder_state_write_bitstream_VUI(encoder_state_t * const encoder_state) { - bitstream * const stream = &encoder_state->stream; + bitstream_t * const stream = &encoder_state->stream; const encoder_control_t * const encoder = encoder_state->encoder_control; #ifdef _DEBUG printf("=========== VUI Set ID: 0 ===========\n"); @@ -281,7 +281,7 @@ static void encoder_state_write_bitstream_VUI(encoder_state_t * const encoder_st static void encoder_state_write_bitstream_seq_parameter_set(encoder_state_t * const encoder_state) { - bitstream * const stream = &encoder_state->stream; + bitstream_t * const stream = &encoder_state->stream; const encoder_control_t * encoder = encoder_state->encoder_control; #ifdef _DEBUG @@ -386,7 +386,7 @@ static void encoder_state_write_bitstream_seq_parameter_set(encoder_state_t * co static void encoder_state_write_bitstream_pic_parameter_set(encoder_state_t * const encoder_state) { const encoder_control_t * const encoder = encoder_state->encoder_control; - bitstream * const stream = &encoder_state->stream; + bitstream_t * const stream = &encoder_state->stream; #ifdef _DEBUG printf("=========== Picture Parameter Set ID: 0 ===========\n"); #endif @@ -467,7 +467,7 @@ static void encoder_state_write_bitstream_pic_parameter_set(encoder_state_t * co static void encoder_state_write_bitstream_prefix_sei_version(encoder_state_t * const encoder_state) { #define STR_BUF_LEN 1000 - bitstream * const stream = &encoder_state->stream; + bitstream_t * const stream = &encoder_state->stream; int i, length; char buf[STR_BUF_LEN] = { 0 }; char *s = buf + 16; @@ -526,7 +526,7 @@ static void encoder_state_entry_points_explore(const encoder_state_t * const enc } } -static void encoder_state_write_bitstream_entry_points_write(bitstream * const stream, const encoder_state_t * const encoder_state, const int num_entry_points, const int write_length, int * const r_count) { +static void encoder_state_write_bitstream_entry_points_write(bitstream_t * const stream, const encoder_state_t * const encoder_state, const int num_entry_points, const int write_length, int * const r_count) { int i; for (i = 0; encoder_state->children[i].encoder_control; ++i) { if (encoder_state->children[i].is_leaf) { @@ -555,7 +555,7 @@ static int num_bitcount(unsigned int n) { void encoder_state_write_bitstream_slice_header(encoder_state_t * const encoder_state) { const encoder_control_t * const encoder = encoder_state->encoder_control; - bitstream * const stream = &encoder_state->stream; + bitstream_t * const stream = &encoder_state->stream; #ifdef _DEBUG printf("=========== Slice ===========\n"); @@ -647,7 +647,7 @@ void encoder_state_write_bitstream_slice_header(encoder_state_t * const encoder_ */ static void add_checksum(encoder_state_t * const encoder_state) { - bitstream * const stream = &encoder_state->stream; + bitstream_t * const stream = &encoder_state->stream; const videoframe_t * const frame = encoder_state->tile->frame; unsigned char checksum[3][SEI_HASH_MAX_LENGTH]; uint32_t checksum_val; @@ -675,7 +675,7 @@ static void add_checksum(encoder_state_t * const encoder_state) static void encoder_state_write_bitstream_main(encoder_state_t * const main_state) { const encoder_control_t * const encoder = main_state->encoder_control; - bitstream * const stream = &main_state->stream; + bitstream_t * const stream = &main_state->stream; uint64_t curpos; int i; diff --git a/src/encoderstate.h b/src/encoderstate.h index 647e2e96..aa63470f 100644 --- a/src/encoderstate.h +++ b/src/encoderstate.h @@ -161,7 +161,7 @@ typedef struct encoder_state_t { lcu_order_element *lcu_order; uint32_t lcu_order_count; - bitstream stream; + bitstream_t stream; cabac_data cabac; int stats_done; diff --git a/src/nal.c b/src/nal.c index ed655358..2fa8025d 100644 --- a/src/nal.c +++ b/src/nal.c @@ -37,7 +37,7 @@ /** * \brief Write a Network Abstraction Layer (NAL) packet to the output. */ -void nal_write(bitstream * const bitstream, const uint8_t nal_type, +void nal_write(bitstream_t * const bitstream, const uint8_t nal_type, const uint8_t temporal_id, const int long_start_code) { uint8_t byte; diff --git a/src/nal.h b/src/nal.h index 6c75b53a..d937cb4a 100644 --- a/src/nal.h +++ b/src/nal.h @@ -94,7 +94,7 @@ enum { ////////////////////////////////////////////////////////////////////////// // FUNCTIONS -void nal_write(bitstream * const bitstream, const uint8_t nal_type, +void nal_write(bitstream_t * const bitstream, const uint8_t nal_type, const uint8_t temporal_id, const int long_start_code); void image_checksum(const image *im, unsigned char checksum_out[][SEI_HASH_MAX_LENGTH]);