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 encode app default output framerate #254

Merged
merged 3 commits into from
Jul 30, 2022
Merged
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
17 changes: 10 additions & 7 deletions package/encode_app/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ typedef struct
unsigned char *out_framerate;
int video_enabled;
int ae_enable;
int setQos;

/* audio */
snd_pcm_t *pcmp;
Expand Down Expand Up @@ -1005,7 +1006,7 @@ int free_context(void *arg)
}

static void endof_encode()
{
{
printf("endof_encode\n");
// pCtx->start = 0;
for(int i = 0; i < pCtx->ch_cnt; i++)
Expand Down Expand Up @@ -1087,24 +1088,24 @@ static void endof_encode()
sem_destroy(&pCtx->pSemGetData[i]);
}
}

if(pCtx->video_enabled)
if(pCtx->setQos)
{
unsigned char *reg;

reg=(unsigned char * )mmap(NULL, MEMORY_TEST_BLOCK_ALIGN, PROT_READ | PROT_WRITE, MAP_SHARED, pCtx->fd_ddr, MAILBOX_REG_BASE);
reg=(unsigned char * )mmap(NULL, MEMORY_TEST_BLOCK_ALIGN, PROT_READ | PROT_WRITE, MAP_SHARED, pCtx->fd_ddr, (uint64_t)MAILBOX_REG_BASE|0x100000000);
*(volatile unsigned int *)(reg+0xf4) = pCtx->reg_QoS_ctrl0;
*(volatile unsigned int *)(reg+0xf8) = pCtx->reg_QoS_ctrl1;
*(volatile unsigned int *)(reg+0xfc) = pCtx->reg_QoS_ctrl2;
munmap(reg, MEMORY_TEST_BLOCK_ALIGN);
reg=(unsigned char * )mmap(NULL, MEMORY_TEST_BLOCK_ALIGN, PROT_READ | PROT_WRITE, MAP_SHARED, pCtx->fd_ddr, NOC_QOS_REG_BASE);
reg=(unsigned char * )mmap(NULL, MEMORY_TEST_BLOCK_ALIGN, PROT_READ | PROT_WRITE, MAP_SHARED, pCtx->fd_ddr, (uint64_t)NOC_QOS_REG_BASE|0x100000000);
*(volatile unsigned int *)(reg+0x290) = pCtx->reg_h264_bw;
*(volatile unsigned int *)(reg+0x28c) = pCtx->reg_h264_mode;
*(volatile unsigned int *)(reg+0x388) = pCtx->reg_isp_pri;
*(volatile unsigned int *)(reg+0x38c) = pCtx->reg_isp_mode;
*(volatile unsigned int *)(reg+0x390) = pCtx->reg_isp_bw;
munmap(reg, MEMORY_TEST_BLOCK_ALIGN);
reg=(unsigned char * )mmap(NULL, MEMORY_TEST_BLOCK_ALIGN, PROT_READ | PROT_WRITE, MAP_SHARED, pCtx->fd_ddr, DDR_CTRL_REG_BASE);
reg=(unsigned char * )mmap(NULL, MEMORY_TEST_BLOCK_ALIGN, PROT_READ | PROT_WRITE, MAP_SHARED, pCtx->fd_ddr, (uint64_t)DDR_CTRL_REG_BASE|0x100000000);
*(volatile unsigned int *)(reg+0x504) = pCtx->reg_ddr_cli;
munmap(reg, MEMORY_TEST_BLOCK_ALIGN);
printf("QoS restore\n");
Expand Down Expand Up @@ -1181,6 +1182,8 @@ static void set_QoS()
*(volatile unsigned int *)(reg+0x504) = 0x00010303;
printf("0x98000504: from 0x%08x to 0x%08x\n", pCtx->reg_ddr_cli, *(volatile unsigned int *)(reg+0x504));
munmap(reg, MEMORY_TEST_BLOCK_ALIGN);

pCtx->setQos = 1;
}

#if TEST_ISP
Expand Down Expand Up @@ -2325,7 +2328,7 @@ int main(int argc, char *argv[])
pCtx->ch[i] = i;
pCtx->Cfg[i].channel = i;
if(!pCtx->framerate[i]) pCtx->framerate[i] = 30;
if(!pCtx->out_framerate[i]) pCtx->out_framerate[i] = 30;
if(!pCtx->out_framerate[i]) pCtx->out_framerate[i] = pCtx->framerate[i];
if(!pCtx->Cfg[i].width) pCtx->Cfg[i].width = 1920;
if(!pCtx->Cfg[i].height) pCtx->Cfg[i].height = 1080;
if(!pCtx->Cfg[i].BitRate) pCtx->Cfg[i].BitRate = 4000000;
Expand Down