mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-24 02:24:07 +00:00
Change more 8-bit pixels to pixel typedef.
This commit is contained in:
parent
ef0caee959
commit
202aec69f2
|
@ -33,7 +33,7 @@ void close_cu_file(FILE *fp) {
|
|||
fclose(fp);
|
||||
}
|
||||
|
||||
void yuv2rgb(unsigned char yuv[3], unsigned char rgb[3])
|
||||
void yuv2rgb(pixel yuv[3], pixel rgb[3])
|
||||
{
|
||||
int y = yuv[0];
|
||||
int u = yuv[1];
|
||||
|
@ -64,8 +64,8 @@ unsigned render_cu_file(encoder_control *encoder, picture *pic,
|
|||
int y = yCtb * CU_MIN_SIZE_PIXELS;
|
||||
unsigned luma = y * pic->width + x;
|
||||
unsigned chroma = (y >> 1) * (pic->width >> 1) + (x >> 1);
|
||||
unsigned char yuv[3] = { 0, 0, 0 };
|
||||
unsigned char rgb[3] = { 0, 0, 0 };
|
||||
pixel yuv[3] = { 0, 0, 0 };
|
||||
pixel rgb[3] = { 0, 0, 0 };
|
||||
|
||||
if (x >= pic->width || y >= pic->height) {
|
||||
// Don't output anything for CU's completely outside the botders.
|
||||
|
|
|
@ -326,10 +326,10 @@ void encode_one_frame(encoder_control* encoder)
|
|||
}
|
||||
|
||||
void fill_after_frame(FILE *file, unsigned height, unsigned array_width,
|
||||
unsigned array_height, unsigned char *data)
|
||||
unsigned array_height, pixel *data)
|
||||
{
|
||||
unsigned char* p = data + height * array_width;
|
||||
unsigned char* end = data + array_width * array_height;
|
||||
pixel* p = data + height * array_width;
|
||||
pixel* end = data + array_width * array_height;
|
||||
|
||||
while (p < end) {
|
||||
// Fill the line by copying the line above.
|
||||
|
@ -339,11 +339,11 @@ void fill_after_frame(FILE *file, unsigned height, unsigned array_width,
|
|||
}
|
||||
|
||||
void read_and_fill_frame_data(FILE *file, unsigned width, unsigned height,
|
||||
unsigned array_width, unsigned char *data)
|
||||
unsigned array_width, pixel *data)
|
||||
{
|
||||
unsigned char* p = data;
|
||||
unsigned char* end = data + array_width * height;
|
||||
unsigned char fill_char;
|
||||
pixel* p = data;
|
||||
pixel* end = data + array_width * height;
|
||||
pixel fill_char;
|
||||
unsigned i;
|
||||
|
||||
while (p < end) {
|
||||
|
@ -1060,9 +1060,9 @@ void encode_coding_tree(encoder_control *encoder, uint16_t x_ctb,
|
|||
|
||||
|
||||
if (1) {
|
||||
uint8_t *base_y = &encoder->in.cur_pic->y_data[x_ctb*(LCU_WIDTH>>(MAX_DEPTH)) + (y_ctb*(LCU_WIDTH>>(MAX_DEPTH))) *encoder->in.width];
|
||||
uint8_t *base_u = &encoder->in.cur_pic->u_data[x_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)) + (y_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)))*(encoder->in.width>>1)];
|
||||
uint8_t *base_v = &encoder->in.cur_pic->v_data[x_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)) + (y_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)))*(encoder->in.width>>1)];
|
||||
pixel *base_y = &encoder->in.cur_pic->y_data[x_ctb*(LCU_WIDTH>>(MAX_DEPTH)) + (y_ctb*(LCU_WIDTH>>(MAX_DEPTH))) *encoder->in.width];
|
||||
pixel *base_u = &encoder->in.cur_pic->u_data[x_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)) + (y_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)))*(encoder->in.width>>1)];
|
||||
pixel *base_v = &encoder->in.cur_pic->v_data[x_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)) + (y_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)))*(encoder->in.width>>1)];
|
||||
uint32_t width = LCU_WIDTH>>depth;
|
||||
|
||||
/* INTRAPREDICTION VARIABLES */
|
||||
|
@ -1140,9 +1140,9 @@ void encode_coding_tree(encoder_control *encoder, uint16_t x_ctb,
|
|||
int8_t mpm_preds = -1;
|
||||
int i;
|
||||
uint32_t flag;
|
||||
uint8_t *base_y = &encoder->in.cur_pic->y_data[x_ctb * (LCU_WIDTH >> (MAX_DEPTH)) + (y_ctb * (LCU_WIDTH >> (MAX_DEPTH))) * encoder->in.width];
|
||||
uint8_t *base_u = &encoder->in.cur_pic->u_data[x_ctb * (LCU_WIDTH >> (MAX_DEPTH + 1)) + (y_ctb * (LCU_WIDTH >> (MAX_DEPTH + 1))) * (encoder->in.width >> 1)];
|
||||
uint8_t *base_v = &encoder->in.cur_pic->v_data[x_ctb * (LCU_WIDTH >> (MAX_DEPTH + 1)) + (y_ctb * (LCU_WIDTH >> (MAX_DEPTH + 1))) * (encoder->in.width >> 1)];
|
||||
pixel *base_y = &encoder->in.cur_pic->y_data[x_ctb * (LCU_WIDTH >> (MAX_DEPTH)) + (y_ctb * (LCU_WIDTH >> (MAX_DEPTH))) * encoder->in.width];
|
||||
pixel *base_u = &encoder->in.cur_pic->u_data[x_ctb * (LCU_WIDTH >> (MAX_DEPTH + 1)) + (y_ctb * (LCU_WIDTH >> (MAX_DEPTH + 1))) * (encoder->in.width >> 1)];
|
||||
pixel *base_v = &encoder->in.cur_pic->v_data[x_ctb * (LCU_WIDTH >> (MAX_DEPTH + 1)) + (y_ctb * (LCU_WIDTH >> (MAX_DEPTH + 1))) * (encoder->in.width >> 1)];
|
||||
uint32_t width = LCU_WIDTH>>depth;
|
||||
|
||||
// INTRAPREDICTION VARIABLES
|
||||
|
|
12
src/filter.c
12
src/filter.c
|
@ -69,7 +69,7 @@ const int16_t g_chroma_filter[8][4] =
|
|||
/**
|
||||
* \brief
|
||||
*/
|
||||
INLINE void filter_deblock_luma(uint8_t *src, int32_t offset,
|
||||
INLINE void filter_deblock_luma(pixel *src, int32_t offset,
|
||||
int32_t tc, int8_t sw,
|
||||
int8_t part_P_nofilter, int8_t part_Q_nofilter,
|
||||
int32_t thr_cut,
|
||||
|
@ -129,7 +129,7 @@ INLINE void filter_deblock_luma(uint8_t *src, int32_t offset,
|
|||
/**
|
||||
* \brief
|
||||
*/
|
||||
INLINE void filter_deblock_chroma(uint8_t *src, int32_t offset, int32_t tc,
|
||||
INLINE void filter_deblock_chroma(pixel *src, int32_t offset, int32_t tc,
|
||||
int8_t part_P_nofilter, int8_t part_Q_nofilter)
|
||||
{
|
||||
int32_t delta;
|
||||
|
@ -159,8 +159,8 @@ void filter_deblock_edge_luma(encoder_control *encoder,
|
|||
int32_t beta_offset_div2 = encoder->beta_offset_div2;
|
||||
int32_t tc_offset_div2 = encoder->tc_offset_div2;
|
||||
// TODO: support 10+bits
|
||||
uint8_t *orig_src = &encoder->in.cur_pic->y_recdata[xpos + ypos*stride];
|
||||
uint8_t *src = orig_src;
|
||||
pixel *orig_src = &encoder->in.cur_pic->y_recdata[xpos + ypos*stride];
|
||||
pixel *src = orig_src;
|
||||
int32_t step = 1;
|
||||
cu_info *cu_q = &encoder->in.cur_pic->cu_array[MAX_DEPTH][(xpos>>MIN_SIZE) + (ypos>>MIN_SIZE) * (encoder->in.width_in_lcu << MAX_DEPTH)];
|
||||
cu_info *cu_p = 0;
|
||||
|
@ -259,8 +259,8 @@ void filter_deblock_edge_chroma(encoder_control *encoder,
|
|||
int32_t tc_offset_div2 = encoder->tc_offset_div2;
|
||||
int8_t num_parts = 1;
|
||||
// TODO: support 10+bits
|
||||
uint8_t* src_u = &encoder->in.cur_pic->u_recdata[x + y*stride];
|
||||
uint8_t* src_v = &encoder->in.cur_pic->v_recdata[x + y*stride];
|
||||
pixel *src_u = &encoder->in.cur_pic->u_recdata[x + y*stride];
|
||||
pixel *src_v = &encoder->in.cur_pic->v_recdata[x + y*stride];
|
||||
// Init offset and step to EDGE_HOR
|
||||
int32_t offset = stride;
|
||||
int32_t step = 1;
|
||||
|
|
|
@ -29,11 +29,11 @@ void filter_deblock_edge_chroma(encoder_control *encoder,
|
|||
int32_t xpos, int32_t ypos,
|
||||
int8_t depth, int8_t dir);
|
||||
void filter_deblock(encoder_control *encoder);
|
||||
void filter_deblock_luma(uint8_t *src, int32_t offset, int32_t tc , int8_t sw,
|
||||
void filter_deblock_luma(pixel *src, int32_t offset, int32_t tc , int8_t sw,
|
||||
int8_t part_p_nofilter, int8_t part_q_nofilter,
|
||||
int32_t thr_cut,
|
||||
int8_t filter_second_p, int8_t filter_second_q);
|
||||
void filter_deblock_chroma(uint8_t *src, int32_t offset, int32_t tc,
|
||||
void filter_deblock_chroma(pixel *src, int32_t offset, int32_t tc,
|
||||
int8_t part_p_nofilter, int8_t part_q_nofilter);
|
||||
|
||||
// INTERPOLATION
|
||||
|
|
|
@ -100,6 +100,13 @@ typedef int16_t coefficient;
|
|||
#define INLINE inline
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// Buggy VS2010 throws intellisense warnings if void* is not casted.
|
||||
#define MALLOC(type, num) (type *)malloc(sizeof(type) * num)
|
||||
#else
|
||||
#define MALLOC(type, num) malloc(sizeof(type) * num)
|
||||
#endif
|
||||
|
||||
#define FREE_POINTER(pointer) { free(pointer); pointer = NULL; }
|
||||
|
||||
#endif
|
|
@ -27,7 +27,7 @@ void intra_build_reference_border(picture* pic, int32_t x_ctb, int32_t y_ctb, in
|
|||
void intra_filter(int16_t* ref, int32_t stride, int32_t width, int8_t mode);
|
||||
|
||||
/* Predictions */
|
||||
int16_t intra_prediction(uint8_t* orig, int32_t orig_stride, int16_t* rec, int32_t rec_stride, uint32_t x_pos, uint32_t ypos, uint32_t width, int16_t* dst, int32_t dst_stride, uint32_t *sad);
|
||||
int16_t intra_prediction(pixel* orig, int32_t orig_stride, int16_t* rec, int32_t rec_stride, uint32_t x_pos, uint32_t ypos, uint32_t width, int16_t* dst, int32_t dst_stride, uint32_t *sad);
|
||||
|
||||
int16_t intra_get_dc_pred(int16_t* pic, uint16_t pic_width, uint32_t x_pos, uint32_t y_pos, uint8_t width);
|
||||
void intra_get_planar_pred(int16_t* src,int32_t srcstride, uint32_t xpos, uint32_t ypos,uint32_t width, int16_t* dst,int32_t dststride);
|
||||
|
|
|
@ -80,7 +80,7 @@ void nal_write(FILE *output, uint8_t *buffer, uint32_t buffer_len, uint8_t nal_r
|
|||
* \param width Width of the picture.
|
||||
* \param stride Width of one row in the pixel array.
|
||||
*/
|
||||
static void array_checksum(const uint8_t* data,
|
||||
static void array_checksum(const pixel* data,
|
||||
const int height, const int width,
|
||||
const int stride,
|
||||
unsigned char checksum_out[SEI_HASH_MAX_LENGTH])
|
||||
|
|
|
@ -220,14 +220,14 @@ picture *picture_init(int32_t width, int32_t height,
|
|||
pic->height_in_lcu = height_in_lcu;
|
||||
pic->referenced = 0;
|
||||
// Allocate buffers
|
||||
pic->y_data = (uint8_t *)malloc(sizeof(uint8_t) * luma_size);
|
||||
pic->u_data = (uint8_t *)malloc(sizeof(uint8_t) * chroma_size);
|
||||
pic->v_data = (uint8_t *)malloc(sizeof(uint8_t) * chroma_size);
|
||||
pic->y_data = MALLOC(pixel, luma_size);
|
||||
pic->u_data = MALLOC(pixel, chroma_size);
|
||||
pic->v_data = MALLOC(pixel, chroma_size);
|
||||
|
||||
// Reconstruction buffers
|
||||
pic->y_recdata = (uint8_t *)malloc(sizeof(uint8_t) * luma_size);
|
||||
pic->u_recdata = (uint8_t *)malloc(sizeof(uint8_t) * chroma_size);
|
||||
pic->v_recdata = (uint8_t *)malloc(sizeof(uint8_t) * chroma_size);
|
||||
pic->y_recdata = MALLOC(pixel, luma_size);
|
||||
pic->u_recdata = MALLOC(pixel, chroma_size);
|
||||
pic->v_recdata = MALLOC(pixel, chroma_size);
|
||||
|
||||
memset(pic->u_recdata, 128, (chroma_size));
|
||||
memset(pic->v_recdata, 128, (chroma_size));
|
||||
|
|
|
@ -298,7 +298,7 @@ void search_tree(encoder_control *encoder,
|
|||
cu_info *ref_cu = &ref_pic->cu_array[MAX_DEPTH][y_ctb * width_in_scu + x_ctb];
|
||||
int x = x_ctb * CU_MIN_SIZE_PIXELS;
|
||||
int y = y_ctb * CU_MIN_SIZE_PIXELS;
|
||||
uint8_t *cur_data = &cur_pic->y_data[(y * cur_pic->width) + x];
|
||||
pixel *cur_data = &cur_pic->y_data[(y * cur_pic->width) + x];
|
||||
|
||||
int start_x = 0;
|
||||
int start_y = 0;
|
||||
|
@ -321,7 +321,7 @@ void search_tree(encoder_control *encoder,
|
|||
if (depth >= MIN_INTRA_SEARCH_DEPTH && depth <= MAX_INTRA_SEARCH_DEPTH
|
||||
&& (encoder->in.cur_pic->slicetype == SLICE_I || USE_INTRA_IN_P)) {
|
||||
int x = 0, y = 0;
|
||||
uint8_t *base = &encoder->in.cur_pic->y_data[x_ctb * (LCU_WIDTH >> (MAX_DEPTH)) + (y_ctb * (LCU_WIDTH >> (MAX_DEPTH))) * encoder->in.width];
|
||||
pixel *base = &encoder->in.cur_pic->y_data[x_ctb * (LCU_WIDTH >> (MAX_DEPTH)) + (y_ctb * (LCU_WIDTH >> (MAX_DEPTH))) * encoder->in.width];
|
||||
uint32_t width = LCU_WIDTH >> depth;
|
||||
|
||||
// INTRAPREDICTION
|
||||
|
|
Loading…
Reference in a new issue