MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / encx264Init

Function encx264Init

libhb/encx264.c:315–669  ·  view source on GitHub ↗

* hb_work_encx264_init *********************************************************************** * **********************************************************************/

Source from the content-addressed store, hash-verified

313 *
314 **********************************************************************/
315int encx264Init( hb_work_object_t * w, hb_job_t * job )
316{
317 hb_work_private_t * pv = calloc( 1, sizeof( hb_work_private_t ) );
318 x264_param_t param;
319 x264_nal_t * nal;
320 int nal_count, bit_depth;
321
322 w->private_data = pv;
323
324 bit_depth = hb_video_encoder_get_depth(job->vcodec);
325 pv->api = hb_x264_api_get(bit_depth);
326 if (pv->api == NULL)
327 {
328 hb_error("encx264: hb_x264_api_get failed, bit-depth %d", bit_depth);
329 return 1;
330 }
331
332 pv->job = job;
333 pv->last_stop = AV_NOPTS_VALUE;
334 pv->chapter_queue = hb_chapter_queue_init();
335
336 if (pv->api->param_default_preset(&param,
337 job->encoder_preset, job->encoder_tune) < 0)
338 {
339 free( pv );
340 w->private_data = NULL;
341 return 1;
342 }
343
344#if X264_BUILD >= 153
345 param.i_bitdepth = bit_depth;
346#endif
347
348 /* If the PSNR or SSIM tunes are in use, enable the relevant metric */
349 if (job->encoder_tune != NULL && *job->encoder_tune)
350 {
351 char *tmp = strdup(job->encoder_tune);
352 char *tok = strtok(tmp, ",./-+");
353 do
354 {
355 if (!strncasecmp(tok, "psnr", 4))
356 {
357 param.analyse.b_psnr = 1;
358 break;
359 }
360 if (!strncasecmp(tok, "ssim", 4))
361 {
362 param.analyse.b_ssim = 1;
363 break;
364 }
365 }
366 while ((tok = strtok(NULL, ",./-+")) != NULL);
367 free(tmp);
368 }
369
370 /* Some HandBrake-specific defaults; users can override them
371 * using the encoder_options string. */
372 param.i_fps_num = job->vrate.num;

Callers

nothing calls this directly

Calls 15

hb_x264_api_getFunction · 0.85
hb_errorFunction · 0.85
hb_chapter_queue_initFunction · 0.85
hb_output_color_primFunction · 0.85
hb_output_color_transferFunction · 0.85
hb_output_color_matrixFunction · 0.85
hb_rescale_rationalFunction · 0.85
hb_encopts_to_dictFunction · 0.85
hb_dict_iter_initFunction · 0.85
hb_dict_iter_nextFunction · 0.85
hb_dict_iter_keyFunction · 0.85

Tested by

no test coverage detected