Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: incompatible pointer types #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions source/encoder/encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ void encoder_output_frame_bitstream(xavs2_handler_t *h_mgr, xavs2_frame_t *frame
*/
void encoder_fetch_one_encoded_frame(xavs2_handler_t *h_mgr, xavs2_outpacket_t *packet, int is_flush)
{
int num_encoding_frames = h_mgr->num_encode - h_mgr->num_output; // ���ڱ���֡��
int num_frames_threads = h_mgr->i_frm_threads; // ����֡��
int num_encoding_frames = h_mgr->num_encode - h_mgr->num_output; // 正在编码帧数
int num_frames_threads = h_mgr->i_frm_threads; // 并行帧数

/* clear packet data */
packet->len = 0;
Expand Down Expand Up @@ -695,7 +695,7 @@ static void *encoder_aec_encode_one_frame(xavs2_t *h)
xavs2_lcu_terminat_bit_write(p_aec, lcu_xy == slice->i_last_lcu_xy);
}

/* ������LCU�м���Slice���ַ�ʽ */
/* 仅考虑LCU行级的Slice划分方式 */
if (lcu_xy >= slice->i_last_lcu_xy) {
int bs_len;
/* slice done */
Expand Down Expand Up @@ -895,7 +895,7 @@ static void encoder_decide_level_id(xavs2_param_t *param)
{
const int tab_level_restriction[][5] = {
/* LevelID, MaxWidth, MaxHeight, MaxFps, MaxKBps */
{ 0x00, 8192, 8192, 0, 0 }, // ��ֹ
{ 0x00, 8192, 8192, 0, 0 }, // 禁止
{ 0x10, 352, 288, 15, 1500 }, // 2.0.15
{ 0x12, 352, 288, 30, 2000 }, // 2.0.30
{ 0x14, 352, 288, 60, 2500 }, // 2.0.60
Expand All @@ -919,31 +919,31 @@ static void encoder_decide_level_id(xavs2_param_t *param)
{ 0x66, 8192, 4608, 60, 480000 }, // 10.2.60
{ 0x68, 8192, 4608, 120, 240000 }, // 10.0.120
{ 0x6A, 8192, 4608, 120, 800000 }, // 10.2.120
{ 0x00, 16384, 8192, 120, 8000000 }, // ��ֹ
{ 0x00, 16384, 8192, 120, 8000000 }, // 禁止
};

int i = 1;
int i_last_level = 0;

for (; tab_level_restriction[i][4] != 0;) {
/* δ�������ʱ������Ϊ��� */
/* 未开启码控时,设置为最大 */
if (param->i_rc_method == 0 &&
param->org_width <= tab_level_restriction[i_last_level][1] &&
param->org_height <= tab_level_restriction[i_last_level][2] &&
param->org_width <= tab_level_restriction[i][1] &&
param->org_height <= tab_level_restriction[i][2] &&
tab_level_restriction[i_last_level][1] < tab_level_restriction[i][1] &&
tab_level_restriction[i_last_level][2] < tab_level_restriction[i][2]) {
/* ���ʿ���δ����ʱ��ѡ�����������ķֱ����µ���ߵ� */
/* 码率控制未开启时,选择满足条件的分辨率下的最高档 */
i = i_last_level;
break;
}
/* �ֱ��ʡ�֡�ʷ���Ҫ�� */
/* 分辨率、帧率符合要求 */
if (param->org_width <= tab_level_restriction[i][1] &&
param->org_height <= tab_level_restriction[i][2] &&
param->frame_rate <= tab_level_restriction[i][3]) {
i_last_level = i;
/* ���������趨���ɸ��������������LevelID */
/* 比特率已设定,可根据最大码率设置LevelID */
if (param->i_rc_method != 0 &&
param->i_target_bitrate * 1.5 <= tab_level_restriction[i][4] * 1000 &&
param->bitrate_upper <= tab_level_restriction[i][4] * 1000) {
Expand Down Expand Up @@ -1001,8 +1001,8 @@ int encoder_check_parameters(xavs2_param_t *param)
return -1;
}

/* ��Slice�²��ܿ��� cross slice loop filter����Ӱ�첢��Ч��
* TODO: ������֧�� */
/* 多Slice下不能开启 cross slice loop filter,会影响并行效率
* TODO: 后续可支持 */
if (param->slice_num > 1 && param->b_cross_slice_loop_filter != FALSE) {
xavs2_log(NULL, XAVS2_LOG_WARNING, "Un-supported cross slice loop filter, forcing not filtering\n");
param->b_cross_slice_loop_filter = FALSE;
Expand Down Expand Up @@ -1992,7 +1992,7 @@ void xavs2e_frame_coding_init(xavs2_t *h)
/* encoding begin ----------------------------------------------
*/

/* ֡������������ʼ�� */
/* 帧级其他参数初始化 */
if (IS_ALG_ENABLE(OPT_CU_QSFD)) {
qsfd_calculate_threshold_of_a_frame(h);
}
Expand Down Expand Up @@ -2038,7 +2038,7 @@ void *xavs2e_encode_one_frame(void *arg)

/* start AEC frame coding */
if (h->h_top->threadpool_aec != NULL && !h->param->enable_alf) {
xavs2_threadpool_run(h->h_top->threadpool_aec, encoder_aec_encode_one_frame, h, 0);
xavs2_threadpool_run(h->h_top->threadpool_aec, (void * (*)(void *)) encoder_aec_encode_one_frame, h, 0);
}

/* (3) encode all LCU rows in current frame ---------------------------
Expand All @@ -2051,44 +2051,44 @@ void *xavs2e_encode_one_frame(void *arg)

h->i_slice_index = g_slice_lcu_row_order[i].slice_idx;

/* �Ƿ���Ҫ���⴦��Slice�߽� */
/* 是否需要额外处理Slice边界 */
row->b_top_slice_border = 0;
row->b_down_slice_border = 0;

/* ��ǰ֡�ڵ������� */
/* 当前帧内的依赖行 */
if (row_type) {
last_row = &rows[lcu_y - 1];
row->b_down_slice_border = (row_type == 2 && lcu_y != h->i_height_in_lcu - 1);
} else {
xavs2_slice_write_start(h); /* Slice�ĵ�һ�У���ʼ�� */
xavs2_slice_write_start(h); /* Slice的第一行,初始化 */
last_row = NULL;
row->b_top_slice_border = (lcu_y > 0);
}

/* �ȴ��ο�֡���������б������ */
/* 等待参考帧中依赖的行编码完毕 */
xavs2e_inter_sync(h, lcu_y, 0);

/* encode one lcu row */
if (enable_wpp && i != h->i_height_in_lcu - 1) {
/* 1, ����һ���м����߳̽��б��� */
/* 1, 分配一个行级的线程进行编码 */
if ((row->h = xavs2e_alloc_row_task(h)) == NULL) {
return NULL;
}

/* 2, ��鵱ǰ���Ƿ�Ӧ����������
* ����Ϊ�ȴ���һ�������������LCU�������̣߳��������ٵȴ�1��
/* 2, 检查当前行是否应立刻启动;
* 规则为等待上一行至少完成两个LCU才启动线程,这里至少等待1个
*/
wait_lcu_row_coded(last_row, 0);

/* 3, ʹ�ø��м��߳̽��б��� */
/* 3, 使用该行级线程进行编码 */
xavs2_threadpool_run(h->h_top->threadpool_rdo, xavs2_lcu_row_write, row, 0);
} else {
row->h = h;
xavs2_lcu_row_write(row);
}

/* ��Slice�����һ��LCU��˵����Ҫ�ϲ����Slice������
* ����RDO�׶Σ�������Ҫ */
/* 对Slice的最后一行LCU来说,需要合并多个Slice的码流
* 但在RDO阶段,并不需要 */
// if (h->param->slice_num > 1 && row_type == 2) {
// nal_merge_slice(h, h->slices[h->i_slice_index]->p_bs_buf, h->i_nal_type, h->i_nal_ref_idc);
// }
Expand All @@ -2107,7 +2107,7 @@ void *xavs2e_encode_one_frame(void *arg)
}
}

/* (5) ͳ��SAO�Ŀ����Ϳ��ر��� */
/* (5) 统计SAO的开启和开关比率 */
if (h->param->enable_sao && (h->slice_sao_on[0] || h->slice_sao_on[1] || h->slice_sao_on[2])) {
int sao_off_num_y = 0;
int sao_off_num_u = 0;
Expand All @@ -2132,7 +2132,7 @@ void *xavs2e_encode_one_frame(void *arg)
xavs2_frame_copy_planes(h, h->img_alf, h->fdec);
xavs2_frame_expand_border_frame(h, h->img_alf);
alf_filter_one_frame(h);
/* ���¶��ع�ͼ��߽������չ */
/* 重新对重构图像边界进行扩展 */
if (h->pic_alf_on[0] || h->pic_alf_on[1] || h->pic_alf_on[2]) {
xavs2_frame_expand_border_frame(h, h->fdec);
}
Expand All @@ -2147,7 +2147,7 @@ void *xavs2e_encode_one_frame(void *arg)
#endif

if (h->h_top->threadpool_aec != NULL) {
xavs2_threadpool_run(h->h_top->threadpool_aec, encoder_aec_encode_one_frame, h, 0);
xavs2_threadpool_run(h->h_top->threadpool_aec, (void * (*)(void *)) encoder_aec_encode_one_frame, h, 0);
}
}

Expand Down
8 changes: 4 additions & 4 deletions source/encoder/parameters.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ mapping_default(xavs2_param_map_t *p_map_tab, xavs2_param_t *p)
MAP("ALFLowLatencyEncodingEnable", &p->alf_LowLatencyEncoding, MAP_NUM, "Enable Low Latency ALF (1=Low Latency mode, 0=High Efficiency mode)");
MAP("CrossSliceLoopFilter", &p->b_cross_slice_loop_filter, MAP_NUM, "Enable Cross Slice Boundary Filter (0=Disable, 1=Enable)");

/* ��������� */
/* 场编码参数 */
// MAP("InterlaceCodingOption", &p->InterlaceCodingOption, MAP_NUM);
// MAP("RepeatFirstField", &p->repeat_first_field, MAP_NUM);
// MAP("TopFieldFirst", &p->top_field_first, MAP_NUM);
Expand Down Expand Up @@ -425,7 +425,7 @@ int ParameterNameToMapIndex(xavs2_param_map_t *p_map_tab, const char *param_name
mapping_t *map_tab = p_map_tab->map_tab;
int i = 0;

while (map_tab[i].name[0] != '\0') { // ��ֹλ���ǿ��ַ���
while (map_tab[i].name[0] != '\0') { // 终止位置是空字符串
if (xavs2_param_match(map_tab[i].name, param_name)) {
return i;
} else {
Expand All @@ -439,7 +439,7 @@ int ParameterNameToMapIndex(xavs2_param_map_t *p_map_tab, const char *param_name
/* ---------------------------------------------------------------------------
*/
static INLINE
void get_param_name(char *name, const char *param_item)
void get_param_name(char *name, char *param_item)
{
char *str;
name[0] = '\0';
Expand Down Expand Up @@ -629,7 +629,7 @@ xavs2_encoder_opt_set(xavs2_param_t *param, int argc, char *argv[])
int in_item = 0;
int i;

if ((contents = xavs2_get_configs(argc, argv)) == NULL) {
if ((contents = xavs2_get_configs(argc, (const char * const *)argv)) == NULL) {
fprintf(stderr, "get contents from configure file error.");
return -1;
}
Expand Down