Skip to content

Commit

Permalink
clean some unused variables and functions
Browse files Browse the repository at this point in the history
some variables was defined but not used.
some static functions was defined but not used.

Signed-off-by: Carl Zhang <[email protected]>
  • Loading branch information
XinfengZhang committed Dec 5, 2023
1 parent 6bc4995 commit 4497668
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 45 deletions.
22 changes: 1 addition & 21 deletions encode/av1encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,6 @@ static pthread_mutex_t encode_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t encode_cond = PTHREAD_COND_INITIALIZER;
static pthread_t encode_thread;

static char *coded_fn = NULL;
static FILE *coded_fp = NULL, *srcyuv_fp = NULL, *recyuv_fp = NULL;
static unsigned long long srcyuv_frames = 0;
static int srcyuv_fourcc = VA_FOURCC_IYUV;
Expand Down Expand Up @@ -569,22 +568,6 @@ static unsigned int GetTickCount()
return tv.tv_usec / 1000 + tv.tv_sec * 1000;
}

static char *fourcc_to_string(int fourcc)
{
switch (fourcc) {
case VA_FOURCC_NV12:
return "NV12";
case VA_FOURCC_IYUV:
return "IYUV";
case VA_FOURCC_YV12:
return "YV12";
case VA_FOURCC_UYVY:
return "UYVY";
default:
return "Unknown";
}
}

static int string_to_fourcc(char *str)
{
CHECK_NULL(str);
Expand Down Expand Up @@ -1831,10 +1814,7 @@ pack_error_resilient(bitstream* bs)
static void
pack_ref_frame_flags(bitstream* bs, uint8_t error_resilient_mode, uint8_t isI)
{
uint8_t primary_ref_frame = PRIMARY_REF_NONE;
if(isI || error_resilient_mode)
primary_ref_frame = PRIMARY_REF_NONE;
else
if(!(isI || error_resilient_mode))
put_ui(bs, 0, 3); //primary_ref_frame
if (!(fh.frame_type == SWITCH_FRAME || (fh.frame_type == KEY_FRAME && fh.show_frame)))
put_ui(bs, fh.refresh_frame_flags, NUM_REF_FRAMES);
Expand Down
1 change: 0 additions & 1 deletion encode/vp8enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,6 @@ void vp8enc_create_EncoderPipe()
{
VAEntrypoint entrypoints[5];
int num_entrypoints;
int i;
VAConfigAttrib conf_attrib[2];
VASurfaceAttrib surface_attrib;
int major_ver, minor_ver;
Expand Down
1 change: 0 additions & 1 deletion videoprocess/vpp3dlut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,6 @@ video_frame_process_scaling(VASurfaceID in_surface_id,
VAProcPipelineParameterBuffer pipeline_param;
VARectangle surface_region, output_region;
VABufferID pipeline_param_buf_id = VA_INVALID_ID;
VABufferID filter_param_buf_id = VA_INVALID_ID;

/* Fill pipeline buffer */
surface_region.x = 0;
Expand Down
28 changes: 6 additions & 22 deletions videoprocess/vpphdr_tm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,20 +152,6 @@ read_value_uint32(FILE* fp, const char* field_name, uint32_t* value)
return 0;
}

static int8_t
read_value_float(FILE *fp, const char* field_name, float* value)
{
char str[MAX_LEN];
if (read_value_string(fp, field_name, str)) {
printf("Failed to find float field: %s \n", field_name);
return -1;
}

*value = atof(str);

return 0;
}

static VAStatus
create_surface(VASurfaceID * p_surface_id,
uint32_t width, uint32_t height,
Expand Down Expand Up @@ -524,10 +510,10 @@ bool read_frame_to_surface(FILE *fp, VASurfaceID surface_id)

int i = 0;

int frame_size = 0, y_size = 0, u_size = 0;
int frame_size = 0, y_size = 0;

unsigned char *y_src = NULL, *u_src = NULL, *v_src = NULL;
unsigned char *y_dst = NULL, *u_dst = NULL, *v_dst = NULL;
unsigned char *y_src = NULL, *u_src = NULL;
unsigned char *y_dst = NULL, *u_dst = NULL;

int bytes_per_pixel = 2;
size_t n_items;
Expand All @@ -554,7 +540,6 @@ bool read_frame_to_surface(FILE *fp, VASurfaceID surface_id)
case VA_FOURCC_P010:
frame_size = va_image.width * va_image.height * bytes_per_pixel * 3 / 2;
y_size = va_image.width * va_image.height * bytes_per_pixel;
u_size = (va_image.width / 2 * bytes_per_pixel) * (va_image.height >> 1);

src_buffer = (unsigned char*)malloc(frame_size);
assert(src_buffer);
Expand Down Expand Up @@ -629,10 +614,10 @@ bool write_surface_to_frame(FILE *fp, VASurfaceID surface_id)

int i = 0;

int frame_size = 0, y_size = 0, u_size = 0;
int frame_size = 0, y_size = 0;

unsigned char *y_src = NULL, *u_src = NULL, *v_src = NULL;
unsigned char *y_dst = NULL, *u_dst = NULL, *v_dst = NULL;
unsigned char *y_src = NULL, *u_src = NULL;
unsigned char *y_dst = NULL, *u_dst = NULL;

int bytes_per_pixel = 2;

Expand Down Expand Up @@ -664,7 +649,6 @@ bool write_surface_to_frame(FILE *fp, VASurfaceID surface_id)
dst_buffer = (unsigned char*)malloc(frame_size);
assert(dst_buffer);
y_size = va_image.width * va_image.height * bytes_per_pixel;
u_size = (va_image.width / 2 * bytes_per_pixel) * (va_image.height >> 1);
y_dst = dst_buffer;
u_dst = dst_buffer + y_size; // UV offset for P010
y_src = (unsigned char*)in_buf + va_image.offsets[0];
Expand Down

0 comments on commit 4497668

Please sign in to comment.