From 7ca688b3762120b707b6bd195615985c11c3b7f4 Mon Sep 17 00:00:00 2001 From: Ari Koivula Date: Wed, 4 Mar 2015 13:17:33 +0200 Subject: [PATCH] Rename struct videoframe to videoframe_t. --- src/encoder_state-bitstream.c | 2 +- src/encoderstate.c | 16 ++++++++-------- src/encoderstate.h | 2 +- src/filter.c | 6 +++--- src/inter.c | 2 +- src/intra.c | 2 +- src/sao.c | 12 ++++++------ src/sao.h | 6 +++--- src/search.c | 16 ++++++++-------- src/videoframe.c | 14 +++++++------- src/videoframe.h | 14 +++++++------- 11 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/encoder_state-bitstream.c b/src/encoder_state-bitstream.c index 18a21c36..135f2291 100644 --- a/src/encoder_state-bitstream.c +++ b/src/encoder_state-bitstream.c @@ -648,7 +648,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; - const videoframe * const frame = encoder_state->tile->frame; + const videoframe_t * const frame = encoder_state->tile->frame; unsigned char checksum[3][SEI_HASH_MAX_LENGTH]; uint32_t checksum_val; unsigned int i; diff --git a/src/encoderstate.c b/src/encoderstate.c index 87c69a0d..340f27d4 100644 --- a/src/encoderstate.c +++ b/src/encoderstate.c @@ -92,7 +92,7 @@ int encoder_state_match_children_of_previous_frame(encoder_state_t * const encod } static void encoder_state_recdata_to_bufs(encoder_state_t * const encoder_state, const lcu_order_element * const lcu, yuv_t * const hor_buf, yuv_t * const ver_buf) { - videoframe* const frame = encoder_state->tile->frame; + videoframe_t* const frame = encoder_state->tile->frame; if (hor_buf) { const int rdpx = lcu->position_px.x; @@ -222,7 +222,7 @@ static void encoder_state_worker_encode_lcu(void * opaque) { const lcu_order_element * const lcu = opaque; encoder_state_t *encoder_state = lcu->encoder_state; const encoder_control_t * const encoder = encoder_state->encoder_control; - videoframe* const frame = encoder_state->tile->frame; + videoframe_t* const frame = encoder_state->tile->frame; //This part doesn't write to bitstream, it's only search, deblock and sao @@ -452,7 +452,7 @@ typedef struct { static void encoder_state_worker_sao_reconstruct_lcu(void *opaque) { worker_sao_reconstruct_lcu_data *data = opaque; - videoframe * const frame = data->encoder_state->tile->frame; + videoframe_t * const frame = data->encoder_state->tile->frame; unsigned stride = frame->width_in_lcu; int x; @@ -578,7 +578,7 @@ static void encoder_state_encode(encoder_state_t * const main_state) { //If children are wavefront, we need to reconstruct SAO if (main_state->encoder_control->sao_enable && main_state->children[0].type == ENCODER_STATE_TYPE_WAVEFRONT_ROW) { int y; - videoframe * const frame = main_state->tile->frame; + videoframe_t * const frame = main_state->tile->frame; threadqueue_job *previous_job = NULL; for (y = 0; y < frame->height_in_lcu; ++y) { @@ -839,7 +839,7 @@ void encoder_compute_stats(encoder_state_t *encoder_state, FILE * const recout, threadqueue_waitfor(encoder->threadqueue, encoder_state->tqj_bitstream_written); if (recout) { - const videoframe * const frame = encoder_state->tile->frame; + const videoframe_t * const frame = encoder_state->tile->frame; // Write reconstructed frame out. // Use conformance-window dimensions instead of internal ones. const int width = frame->width; @@ -946,7 +946,7 @@ void encode_coding_tree(encoder_state_t * const encoder_state, uint16_t x_ctb, uint16_t y_ctb, uint8_t depth) { cabac_data * const cabac = &encoder_state->cabac; - const videoframe * const frame = encoder_state->tile->frame; + const videoframe_t * const frame = encoder_state->tile->frame; const cu_info_t *cur_cu = videoframe_get_cu_const(frame, x_ctb, y_ctb); uint8_t split_flag = GET_SPLITDATA(cur_cu, depth); uint8_t split_model = 0; @@ -1395,7 +1395,7 @@ coeff_scan_order_t get_scan_order(int8_t cu_type, int intra_mode, int depth) static void encode_transform_unit(encoder_state_t * const encoder_state, int x_pu, int y_pu, int depth) { - const videoframe * const frame = encoder_state->tile->frame; + const videoframe_t * const frame = encoder_state->tile->frame; uint8_t width = LCU_WIDTH >> depth; uint8_t width_c = (depth == MAX_PU_DEPTH ? width : width / 2); @@ -1487,7 +1487,7 @@ void encode_transform_coeff(encoder_state_t * const encoder_state, int32_t x_pu, cabac_data * const cabac = &encoder_state->cabac; int32_t x_cu = x_pu / 2; int32_t y_cu = y_pu / 2; - const videoframe * const frame = encoder_state->tile->frame; + const videoframe_t * const frame = encoder_state->tile->frame; const cu_info_t *cur_cu = videoframe_get_cu_const(frame, x_cu, y_cu); // NxN signifies implicit transform split at the first transform level. diff --git a/src/encoderstate.h b/src/encoderstate.h index 4a2115f9..647e2e96 100644 --- a/src/encoderstate.h +++ b/src/encoderstate.h @@ -80,7 +80,7 @@ typedef struct { typedef struct { //Current sub-frame - videoframe *frame; + videoframe_t *frame; int32_t id; diff --git a/src/filter.c b/src/filter.c index aba4a596..69f7c76e 100644 --- a/src/filter.c +++ b/src/filter.c @@ -168,7 +168,7 @@ void filter_deblock_edge_luma(encoder_state_t * const encoder_state, int32_t xpos, int32_t ypos, int8_t depth, int8_t dir) { - const videoframe * const frame = encoder_state->tile->frame; + const videoframe_t * const frame = encoder_state->tile->frame; const encoder_control_t * const encoder = encoder_state->encoder_control; const cu_info_t *cu_q = videoframe_get_cu_const(frame, xpos >> MIN_SIZE, ypos >> MIN_SIZE); @@ -294,7 +294,7 @@ void filter_deblock_edge_chroma(encoder_state_t * const encoder_state, int8_t depth, int8_t dir) { const encoder_control_t * const encoder = encoder_state->encoder_control; - const videoframe * const frame = encoder_state->tile->frame; + const videoframe_t * const frame = encoder_state->tile->frame; const cu_info_t *cu_q = videoframe_get_cu_const(frame, x >> (MIN_SIZE - 1), y >> (MIN_SIZE - 1)); // Chroma edges that do not lay on a 8x8 grid are not deblocked. @@ -386,7 +386,7 @@ void filter_deblock_edge_chroma(encoder_state_t * const encoder_state, */ void filter_deblock_cu(encoder_state_t * const encoder_state, int32_t x, int32_t y, int8_t depth, int32_t edge) { - const videoframe * const frame = encoder_state->tile->frame; + const videoframe_t * const frame = encoder_state->tile->frame; const cu_info_t *cur_cu = videoframe_get_cu_const(frame, x, y); uint8_t split_flag = (cur_cu->depth > depth) ? 1 : 0; uint8_t tr_split = (cur_cu->tr_depth > depth) ? 1 : 0; diff --git a/src/inter.c b/src/inter.c index a62a32c3..82f9f6bc 100644 --- a/src/inter.c +++ b/src/inter.c @@ -41,7 +41,7 @@ * \param cur_cu CU to take the settings from * \returns Void */ -void inter_set_block(videoframe* frame, uint32_t x_cu, uint32_t y_cu, uint8_t depth, cu_info_t* cur_cu) +void inter_set_block(videoframe_t* frame, uint32_t x_cu, uint32_t y_cu, uint8_t depth, cu_info_t* cur_cu) { uint32_t x, y; // Width in smallest CU diff --git a/src/intra.c b/src/intra.c index 829e4a80..4d199657 100644 --- a/src/intra.c +++ b/src/intra.c @@ -48,7 +48,7 @@ const uint8_t intra_hor_ver_dist_thres[5] = {0,7,1,0,0}; * \param mode mode to set * \returns Void */ -void intra_set_block_mode(videoframe *frame,uint32_t x_cu, uint32_t y_cu, uint8_t depth, uint8_t mode, uint8_t part_mode) +void intra_set_block_mode(videoframe_t *frame,uint32_t x_cu, uint32_t y_cu, uint8_t depth, uint8_t mode, uint8_t part_mode) { uint32_t x, y; int block_scu_width = (LCU_WIDTH>>depth)/(LCU_WIDTH>>MAX_DEPTH); diff --git a/src/sao.c b/src/sao.c index ba11bd30..9841f499 100644 --- a/src/sao.c +++ b/src/sao.c @@ -422,7 +422,7 @@ static void sao_reconstruct_color(const encoder_control_t * const encoder, * \param sao Sao parameters. * \param rec Top-left corner of the LCU */ -static void sao_calc_band_block_dims(const videoframe *frame, color_index color_i, +static void sao_calc_band_block_dims(const videoframe_t *frame, color_index color_i, vector2d *rec, vector2d *block) { const int is_chroma = (color_i != COLOR_Y ? 1 : 0); @@ -477,7 +477,7 @@ static void sao_calc_band_block_dims(const videoframe *frame, color_index color_ * \param sao Sao parameters. * \param rec Top-left corner of the LCU, modified to be top-left corner of */ -static void sao_calc_edge_block_dims(const videoframe * const frame, color_index color_i, +static void sao_calc_edge_block_dims(const videoframe_t * const frame, color_index color_i, const sao_info *sao, vector2d *rec, vector2d *tl, vector2d *br, vector2d *block) @@ -527,7 +527,7 @@ static void sao_calc_edge_block_dims(const videoframe * const frame, color_index rec->x = (rec->x == 0 ? 0 : -1); } -void sao_reconstruct(const encoder_control_t * const encoder, videoframe * frame, const pixel *old_rec, +void sao_reconstruct(const encoder_control_t * const encoder, videoframe_t * frame, const pixel *old_rec, unsigned x_ctb, unsigned y_ctb, const sao_info *sao, color_index color_i) { @@ -824,7 +824,7 @@ static void sao_search_best_mode(const encoder_state_t * const encoder_state, co return; } -void sao_search_chroma(const encoder_state_t * const encoder_state, const videoframe *frame, unsigned x_ctb, unsigned y_ctb, sao_info *sao, sao_info *sao_top, sao_info *sao_left, int32_t merge_cost[3]) +void sao_search_chroma(const encoder_state_t * const encoder_state, const videoframe_t *frame, unsigned x_ctb, unsigned y_ctb, sao_info *sao, sao_info *sao_top, sao_info *sao_left, int32_t merge_cost[3]) { int block_width = (LCU_WIDTH / 2); int block_height = (LCU_WIDTH / 2); @@ -860,7 +860,7 @@ void sao_search_chroma(const encoder_state_t * const encoder_state, const videof sao_search_best_mode(encoder_state, orig_list, rec_list, block_width, block_height, 2, sao, sao_top, sao_left, merge_cost); } -void sao_search_luma(const encoder_state_t * const encoder_state, const videoframe *frame, unsigned x_ctb, unsigned y_ctb, sao_info *sao, sao_info *sao_top, sao_info *sao_left, int32_t merge_cost[3]) +void sao_search_luma(const encoder_state_t * const encoder_state, const videoframe_t *frame, unsigned x_ctb, unsigned y_ctb, sao_info *sao, sao_info *sao_top, sao_info *sao_left, int32_t merge_cost[3]) { pixel orig[LCU_LUMA_SIZE]; pixel rec[LCU_LUMA_SIZE]; @@ -893,7 +893,7 @@ void sao_search_luma(const encoder_state_t * const encoder_state, const videofra void sao_reconstruct_frame(encoder_state_t * const encoder_state) { vector2d lcu; - videoframe * const frame = encoder_state->tile->frame; + videoframe_t * const frame = encoder_state->tile->frame; // These are needed because SAO needs the pre-SAO pixels form left and // top LCUs. Single pixel wide buffers, like what search_lcu takes, would diff --git a/src/sao.h b/src/sao.h index dba5b37c..3cfe0a09 100644 --- a/src/sao.h +++ b/src/sao.h @@ -56,9 +56,9 @@ typedef struct sao_info_struct { void init_sao_info(sao_info *sao); -void sao_search_chroma(const encoder_state_t * encoder_state, const videoframe *frame, unsigned x_ctb, unsigned y_ctb, sao_info *sao, sao_info *sao_top, sao_info *sao_left, int32_t merge_cost[3]); -void sao_search_luma(const encoder_state_t * encoder_state, const videoframe *frame, unsigned x_ctb, unsigned y_ctb, sao_info *sao, sao_info *sao_top, sao_info *sao_left, int32_t merge_cost[3]); -void sao_reconstruct(const encoder_control_t * encoder, videoframe *frame, const pixel *old_rec, +void sao_search_chroma(const encoder_state_t * encoder_state, const videoframe_t *frame, unsigned x_ctb, unsigned y_ctb, sao_info *sao, sao_info *sao_top, sao_info *sao_left, int32_t merge_cost[3]); +void sao_search_luma(const encoder_state_t * encoder_state, const videoframe_t *frame, unsigned x_ctb, unsigned y_ctb, sao_info *sao, sao_info *sao_top, sao_info *sao_left, int32_t merge_cost[3]); +void sao_reconstruct(const encoder_control_t * encoder, videoframe_t *frame, const pixel *old_rec, unsigned x_ctb, unsigned y_ctb, const sao_info *sao, color_index color_i); void sao_reconstruct_frame(encoder_state_t *encoder_state); diff --git a/src/search.c b/src/search.c index ae708433..13748cda 100644 --- a/src/search.c +++ b/src/search.c @@ -614,7 +614,7 @@ static unsigned search_frac( const encoder_state_t * const encoder_state, */ static int search_cu_inter(const encoder_state_t * const encoder_state, int x, int y, int depth, lcu_t *lcu) { - const videoframe * const frame = encoder_state->tile->frame; + const videoframe_t * const frame = encoder_state->tile->frame; uint32_t ref_idx = 0; int x_local = (x&0x3f), y_local = (y&0x3f); int x_cu = x>>3; @@ -1741,7 +1741,7 @@ static double search_cu_intra(encoder_state_t * const encoder_state, const int x_px, const int y_px, const int depth, lcu_t *lcu) { - const videoframe * const frame = encoder_state->tile->frame; + const videoframe_t * const frame = encoder_state->tile->frame; const vector2d lcu_px = { x_px & 0x3f, y_px & 0x3f }; const vector2d lcu_cu = { lcu_px.x >> 3, lcu_px.y >> 3 }; const int8_t cu_width = (LCU_WIDTH >> (depth)); @@ -1882,7 +1882,7 @@ static uint8_t get_ctx_cu_split_model(const lcu_t *lcu, int x, int y, int depth) static double search_cu(encoder_state_t * const encoder_state, int x, int y, int depth, lcu_t work_tree[MAX_PU_DEPTH]) { const encoder_control_t* ctrl = encoder_state->encoder_control; - const videoframe * const frame = encoder_state->tile->frame; + const videoframe_t * const frame = encoder_state->tile->frame; int cu_width = LCU_WIDTH >> depth; double cost = MAX_INT; cu_info_t *cur_cu; @@ -1958,7 +1958,7 @@ static double search_cu(encoder_state_t * const encoder_state, int x, int y, int // into account, so there is less of a chanse of luma mode being // really bad for chroma. if (encoder_state->encoder_control->rdo == 3) { - const videoframe * const frame = encoder_state->tile->frame; + const videoframe_t * const frame = encoder_state->tile->frame; double costs[5]; int8_t modes[5] = { 0, 26, 10, 1, 34 }; @@ -2149,7 +2149,7 @@ static double search_cu(encoder_state_t * const encoder_state, int x, int y, int */ static void init_lcu_t(const encoder_state_t * const encoder_state, const int x, const int y, lcu_t *lcu, const yuv_t *hor_buf, const yuv_t *ver_buf) { - const videoframe * const frame = encoder_state->tile->frame; + const videoframe_t * const frame = encoder_state->tile->frame; // Copy reference cu_info structs from neighbouring LCUs. { @@ -2217,7 +2217,7 @@ static void init_lcu_t(const encoder_state_t * const encoder_state, const int x, // Copy LCU pixels. { - const videoframe * const frame = encoder_state->tile->frame; + const videoframe_t * const frame = encoder_state->tile->frame; int x_max = MIN(x + LCU_WIDTH, frame->width) - x; int y_max = MIN(y + LCU_WIDTH, frame->height) - y; @@ -2245,7 +2245,7 @@ static void copy_lcu_to_cu_data(const encoder_state_t * const encoder_state, int { const int x_cu = x_px >> MAX_DEPTH; const int y_cu = y_px >> MAX_DEPTH; - videoframe * const frame = encoder_state->tile->frame; + videoframe_t * const frame = encoder_state->tile->frame; // Use top-left sub-cu of LCU as pointer to lcu->cu array to make things // simpler. @@ -2263,7 +2263,7 @@ static void copy_lcu_to_cu_data(const encoder_state_t * const encoder_state, int // Copy pixels to picture. { - videoframe * const pic = encoder_state->tile->frame; + videoframe_t * const pic = encoder_state->tile->frame; const int pic_width = pic->width; const int x_max = MIN(x_px + LCU_WIDTH, pic_width) - x_px; const int y_max = MIN(y_px + LCU_WIDTH, pic->height) - y_px; diff --git a/src/videoframe.c b/src/videoframe.c index b3f3289f..e97decf7 100644 --- a/src/videoframe.c +++ b/src/videoframe.c @@ -35,8 +35,8 @@ * \param pic picture pointer * \return picture pointer */ -videoframe *videoframe_alloc(const int32_t width, const int32_t height, const int32_t poc) { - videoframe *frame = MALLOC(videoframe, 1); +videoframe_t *videoframe_alloc(const int32_t width, const int32_t height, const int32_t poc) { + videoframe_t *frame = MALLOC(videoframe_t, 1); if (!frame) return 0; @@ -73,7 +73,7 @@ videoframe *videoframe_alloc(const int32_t width, const int32_t height, const in * \param pic picture pointer * \return 1 on success, 0 on failure */ -int videoframe_free(videoframe * const frame) +int videoframe_free(videoframe_t * const frame) { //image_free(frame->source); //image_free(frame->rec); @@ -92,13 +92,13 @@ int videoframe_free(videoframe * const frame) return 1; } -void videoframe_set_poc(videoframe * const frame, const int32_t poc) { +void videoframe_set_poc(videoframe_t * const frame, const int32_t poc) { if (frame->source) frame->source->poc = poc; if (frame->rec) frame->rec->poc = poc; frame->poc = poc; } -const cu_info_t* videoframe_get_cu_const(const videoframe * const frame, unsigned int x_in_scu, unsigned int y_in_scu) +const cu_info_t* videoframe_get_cu_const(const videoframe_t * const frame, unsigned int x_in_scu, unsigned int y_in_scu) { assert(x_in_scu < (frame->width_in_lcu << MAX_DEPTH)); assert(y_in_scu < (frame->height_in_lcu << MAX_DEPTH)); @@ -106,7 +106,7 @@ const cu_info_t* videoframe_get_cu_const(const videoframe * const frame, unsigne return &frame->cu_array->data[x_in_scu + y_in_scu * (frame->width_in_lcu << MAX_DEPTH)]; } -cu_info_t* videoframe_get_cu(videoframe * const frame, const unsigned int x_in_scu, const unsigned int y_in_scu) +cu_info_t* videoframe_get_cu(videoframe_t * const frame, const unsigned int x_in_scu, const unsigned int y_in_scu) { assert(x_in_scu < (frame->width_in_lcu << MAX_DEPTH)); assert(y_in_scu < (frame->height_in_lcu << MAX_DEPTH)); @@ -119,7 +119,7 @@ cu_info_t* videoframe_get_cu(videoframe * const frame, const unsigned int x_in_s /** * \brief Calculates image PSNR value */ -void videoframe_compute_psnr(const videoframe * const frame, double psnr[NUM_COLORS]) +void videoframe_compute_psnr(const videoframe_t * const frame, double psnr[NUM_COLORS]) { int32_t pixels = frame->width * frame->height; int32_t i, c; diff --git a/src/videoframe.h b/src/videoframe.h index 0bccba0c..cb3c6c00 100644 --- a/src/videoframe.h +++ b/src/videoframe.h @@ -52,17 +52,17 @@ typedef struct videoframe struct sao_info_struct *sao_luma; //!< \brief Array of sao parameters for every LCU. struct sao_info_struct *sao_chroma; //!< \brief Array of sao parameters for every LCU. int32_t poc; //!< \brief Picture order count -} videoframe; +} videoframe_t; -videoframe *videoframe_alloc(int32_t width, int32_t height, int32_t poc); -int videoframe_free(videoframe * const frame); +videoframe_t *videoframe_alloc(int32_t width, int32_t height, int32_t poc); +int videoframe_free(videoframe_t * const frame); -void videoframe_set_poc(videoframe * frame, int32_t poc); +void videoframe_set_poc(videoframe_t * frame, int32_t poc); -const cu_info_t* videoframe_get_cu_const(const videoframe * const frame, unsigned int x_in_scu, unsigned int y_in_scu); -cu_info_t* videoframe_get_cu(videoframe * const frame, const unsigned int x_in_scu, const unsigned int y_in_scu); -void videoframe_compute_psnr(const videoframe * const frame, double psnr[NUM_COLORS]); +const cu_info_t* videoframe_get_cu_const(const videoframe_t * const frame, unsigned int x_in_scu, unsigned int y_in_scu); +cu_info_t* videoframe_get_cu(videoframe_t * const frame, const unsigned int x_in_scu, const unsigned int y_in_scu); +void videoframe_compute_psnr(const videoframe_t * const frame, double psnr[NUM_COLORS]); #endif