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

Function encode_frame

libavcodec/exrenc.c:350–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348}
349
350static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
351 const AVFrame *frame, int *got_packet)
352{
353 EXRContext *s = avctx->priv_data;
354 PutByteContext *pb = &s->pb;
355 int64_t offset;
356 int ret;
357 int64_t out_size = 2048LL + avctx->height * 16LL +
358 av_image_get_buffer_size(avctx->pix_fmt,
359 avctx->width,
360 avctx->height, 64) * 3LL / 2;
361
362 if ((ret = ff_get_encode_buffer(avctx, pkt, out_size, 0)) < 0)
363 return ret;
364
365 bytestream2_init_writer(pb, pkt->data, pkt->size);
366
367 bytestream2_put_le32(pb, 20000630);
368 bytestream2_put_byte(pb, 2);
369 bytestream2_put_le24(pb, 0);
370 bytestream2_put_buffer(pb, "channels\0chlist\0", 16);
371 bytestream2_put_le32(pb, s->planes * 18 + 1);
372
373 for (int p = 0; p < s->planes; p++) {
374 bytestream2_put_byte(pb, s->ch_names[p]);
375 bytestream2_put_byte(pb, 0);
376 bytestream2_put_le32(pb, s->pixel_type);
377 bytestream2_put_le32(pb, 0);
378 bytestream2_put_le32(pb, 1);
379 bytestream2_put_le32(pb, 1);
380 }
381 bytestream2_put_byte(pb, 0);
382
383 bytestream2_put_buffer(pb, "compression\0compression\0", 24);
384 bytestream2_put_le32(pb, 1);
385 bytestream2_put_byte(pb, s->compression);
386
387 bytestream2_put_buffer(pb, "dataWindow\0box2i\0", 17);
388 bytestream2_put_le32(pb, 16);
389 bytestream2_put_le32(pb, 0);
390 bytestream2_put_le32(pb, 0);
391 bytestream2_put_le32(pb, avctx->width - 1);
392 bytestream2_put_le32(pb, avctx->height - 1);
393
394 bytestream2_put_buffer(pb, "displayWindow\0box2i\0", 20);
395 bytestream2_put_le32(pb, 16);
396 bytestream2_put_le32(pb, 0);
397 bytestream2_put_le32(pb, 0);
398 bytestream2_put_le32(pb, avctx->width - 1);
399 bytestream2_put_le32(pb, avctx->height - 1);
400
401 bytestream2_put_buffer(pb, "lineOrder\0lineOrder\0", 20);
402 bytestream2_put_le32(pb, 1);
403 bytestream2_put_byte(pb, 0);
404
405 bytestream2_put_buffer(pb, "screenWindowCenter\0v2f\0", 23);
406 bytestream2_put_le32(pb, 8);
407 bytestream2_put_le64(pb, 0);

Callers

nothing calls this directly

Calls 11

av_image_get_buffer_sizeFunction · 0.85
ff_get_encode_bufferFunction · 0.85
bytestream2_init_writerFunction · 0.85
bytestream2_put_bufferFunction · 0.85
av_float2intFunction · 0.85
av_q2dFunction · 0.85
encode_scanline_rleFunction · 0.85
encode_scanline_zipFunction · 0.85
bytestream2_tell_pFunction · 0.85
float2halfFunction · 0.85
av_shrink_packetFunction · 0.85

Tested by

no test coverage detected