MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / decode_init

Function decode_init

libavcodec/exr.c:2327–2376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2325}
2326
2327static av_cold int decode_init(AVCodecContext *avctx)
2328{
2329 EXRContext *s = avctx->priv_data;
2330#if FF_API_EXR_GAMMA
2331 uint32_t i;
2332 union av_intfloat32 t;
2333 float one_gamma = 1.0f / s->gamma;
2334 av_csp_trc_function trc_func = NULL;
2335#endif
2336
2337 ff_init_float2half_tables(&s->f2h_tables);
2338 ff_init_half2float_tables(&s->h2f_tables);
2339
2340 s->avctx = avctx;
2341
2342 ff_exrdsp_init(&s->dsp);
2343
2344#if HAVE_BIGENDIAN
2345 ff_bswapdsp_init(&s->bbdsp);
2346#endif
2347
2348#if FF_API_EXR_GAMMA
2349 trc_func = av_csp_trc_func_from_id(s->apply_trc_type);
2350 if (trc_func) {
2351 for (i = 0; i < 65536; ++i) {
2352 t.i = half2float(i, &s->h2f_tables);
2353 t.f = trc_func(t.f);
2354 s->gamma_table[i] = float2half(av_float2int(t.f), &s->f2h_tables);
2355 }
2356 } else if (one_gamma != 1.0f) {
2357 for (i = 0; i < 65536; ++i) {
2358 t.i = half2float(i, &s->h2f_tables);
2359 /* If negative value we reuse half value */
2360 if (t.f <= 0.0f) {
2361 s->gamma_table[i] = i;
2362 } else {
2363 t.f = powf(t.f, one_gamma);
2364 s->gamma_table[i] = float2half(t.i, &s->f2h_tables);
2365 }
2366 }
2367 }
2368#endif
2369
2370 // allocate thread data, used for non EXR_RAW compression types
2371 s->thread_data = av_calloc(avctx->thread_count, sizeof(*s->thread_data));
2372 if (!s->thread_data)
2373 return AVERROR(ENOMEM);
2374
2375 return 0;
2376}
2377
2378static av_cold int decode_end(AVCodecContext *avctx)
2379{

Callers

nothing calls this directly

Calls 9

ff_exrdsp_initFunction · 0.85
ff_bswapdsp_initFunction · 0.85
av_csp_trc_func_from_idFunction · 0.85
half2floatFunction · 0.85
float2halfFunction · 0.85
av_float2intFunction · 0.85
av_callocFunction · 0.85

Tested by

no test coverage detected