Compare commits

..

2 Commits

Author SHA1 Message Date
mid
cc88f1f0dd Faster VPx settings 2025-03-29 10:56:45 +02:00
mid
86fe6995ad Fix EncodeOpus crash 2025-03-29 10:56:32 +02:00
2 changed files with 18 additions and 12 deletions

View File

@ -22,12 +22,14 @@ static int encodeopus_perform(CHiPubNode *pubn) {
CHiImage *newpcm = CHi_Crawl(&pubn->sinks[0])->data.sample;
if(newpcm) {
if(n->pcmSamples + newpcm->width > n->pcmCapacity) {
n->pcmbuf = realloc(n->pcmbuf, sizeof(*n->pcmbuf) * (n->pcmCapacity = ((n->pcmSamples + newpcm->width + 1023) & ~1023)));
}
memcpy(&n->pcmbuf[n->pcmSamples], newpcm->data16, sizeof(*n->pcmbuf) * newpcm->width);
n->pcmSamples += newpcm->width;
}
CHiBSFrames *frames = malloc(sizeof(*frames));
frames->count = 0;

View File

@ -110,22 +110,26 @@ static int encodevpx_start(CHiPubNode *pubn) {
vpx_codec_enc_config_default(node->iface, &node->cfg, 0);
node->cfg.g_w = firstFrame->width;
node->cfg.g_h = firstFrame->height;
node->cfg.g_profile = 2;
node->cfg.g_timebase.num = 1;
node->cfg.g_timebase.den = 30;
node->cfg.g_lag_in_frames = 0;
node->cfg.g_threads = 8;
node->cfg.g_threads = 4;
node->cfg.kf_mode = VPX_KF_AUTO;
node->cfg.kf_max_dist = 300;
node->cfg.rc_end_usage = VPX_VBR;
node->cfg.rc_target_bitrate = 512;
node->cfg.rc_min_quantizer = 4;
node->cfg.rc_max_quantizer = 48;
node->cfg.rc_end_usage = VPX_CBR;
node->cfg.rc_target_bitrate = 3000;
node->cfg.rc_min_quantizer = 24;
node->cfg.rc_max_quantizer = 32;
node->cfg.rc_undershoot_pct = 95;
vpx_codec_enc_init(&node->codec, node->iface, &node->cfg, 0);
vpx_codec_control(&node->codec, VP8E_SET_CPUUSED, 8);
vpx_codec_control(&node->codec, VP8E_SET_CPUUSED, 9);
//vpx_codec_control(&node->codec, VP9E_SET_SVC, 1);
vpx_codec_control(&node->codec, VP9E_SET_ROW_MT, 1);
vpx_codec_control(&node->codec, VP9E_SET_TILE_COLUMNS, 2);
//vpx_codec_control(&node->codec, VP9E_SET_TILE_COLUMNS, 3);
vpx_codec_control(&node->codec, VP9E_SET_TILE_ROWS, 1);
vpx_codec_control(&node->codec, VP9E_SET_NOISE_SENSITIVITY, 0);
vpx_codec_control(&node->codec, VP9E_SET_TUNE_CONTENT, VP9E_CONTENT_SCREEN);
node->strideY = (node->cfg.g_w + 64) & ~63;