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

Function encode_frame

libavcodec/tiffenc.c:198–443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
199 int buf_size, void *data)
200{
201 TiffEncoderContext *s = avctx->priv_data;
202 AVFrame *pict = data;
203 AVFrame *const p = (AVFrame *) & s->picture;
204 int i;
205 int n;
206 uint8_t *ptr = buf;
207 uint8_t *offset;
208 uint32_t strips;
209 uint32_t *strip_sizes = NULL;
210 uint32_t *strip_offsets = NULL;
211 int bytes_per_row;
212 uint32_t res[2] = { 72, 1 }; // image resolution (72/1)
213 static const uint16_t bpp_tab[] = { 8, 8, 8, 8 };
214 int ret = -1;
215 int is_yuv = 0;
216 uint8_t *yuv_line = NULL;
217 int shift_h, shift_v;
218
219 s->buf_start = buf;
220 s->buf = &ptr;
221 s->buf_size = buf_size;
222
223 *p = *pict;
224 p->pict_type = FF_I_TYPE;
225 p->key_frame = 1;
226 avctx->coded_frame= &s->picture;
227
228 s->compr = TIFF_PACKBITS;
229 if (avctx->compression_level == 0) {
230 s->compr = TIFF_RAW;
231 } else if(avctx->compression_level == 2) {
232 s->compr = TIFF_LZW;
233#if CONFIG_ZLIB
234 } else if ((avctx->compression_level >= 3)) {
235 s->compr = TIFF_DEFLATE;
236#endif
237 }
238
239 s->width = avctx->width;
240 s->height = avctx->height;
241 s->subsampling[0] = 1;
242 s->subsampling[1] = 1;
243
244 switch (avctx->pix_fmt) {
245 case PIX_FMT_RGB24:
246 s->bpp = 24;
247 s->photometric_interpretation = 2;
248 break;
249 case PIX_FMT_GRAY8:
250 s->bpp = 8;
251 s->photometric_interpretation = 1;
252 break;
253 case PIX_FMT_PAL8:
254 s->bpp = 8;
255 s->photometric_interpretation = 3;

Callers

nothing calls this directly

Calls 13

av_logFunction · 0.85
check_sizeFunction · 0.85
av_malloczFunction · 0.85
av_mallocFunction · 0.85
pack_yuvFunction · 0.85
encode_stripFunction · 0.85
av_freeFunction · 0.85
ff_lzw_encode_initFunction · 0.85
ff_lzw_encode_flushFunction · 0.85
add_entry1Function · 0.85
add_entryFunction · 0.85

Tested by

no test coverage detected