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

Function encode_init

libavcodec/exrenc.c:93–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91} EXRContext;
92
93static av_cold int encode_init(AVCodecContext *avctx)
94{
95 EXRContext *s = avctx->priv_data;
96
97 ff_init_float2half_tables(&s->f2h_tables);
98
99 switch (avctx->pix_fmt) {
100 case AV_PIX_FMT_GBRPF32:
101 s->planes = 3;
102 s->ch_names = bgr_chlist;
103 s->ch_order = gbr_order;
104 break;
105 case AV_PIX_FMT_GBRAPF32:
106 s->planes = 4;
107 s->ch_names = abgr_chlist;
108 s->ch_order = gbra_order;
109 break;
110 case AV_PIX_FMT_GRAYF32:
111 s->planes = 1;
112 s->ch_names = y_chlist;
113 s->ch_order = y_order;
114 break;
115 default:
116 av_assert0(0);
117 }
118
119 switch (s->compression) {
120 case EXR_RAW:
121 case EXR_RLE:
122 case EXR_ZIP1:
123 s->scanline_height = 1;
124 s->nb_scanlines = avctx->height;
125 break;
126 case EXR_ZIP16:
127 s->scanline_height = 16;
128 s->nb_scanlines = (avctx->height + s->scanline_height - 1) / s->scanline_height;
129 break;
130 default:
131 av_assert0(0);
132 }
133
134 s->scanline = av_calloc(s->nb_scanlines, sizeof(*s->scanline));
135 if (!s->scanline)
136 return AVERROR(ENOMEM);
137
138 return 0;
139}
140
141static av_cold int encode_close(AVCodecContext *avctx)
142{

Callers

nothing calls this directly

Calls 2

av_callocFunction · 0.85

Tested by

no test coverage detected