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

Function encode_frame

libavcodec/vc2enc.c:908–957  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

906}
907
908static int encode_frame(VC2EncContext *s, AVPacket *avpkt, const AVFrame *frame,
909 const char *aux_data, const int header_size, int field)
910{
911 int i, ret;
912 int64_t max_frame_bytes;
913
914 /* Threaded DWT transform */
915 for (i = 0; i < 3; i++) {
916 s->transform_args[i].ctx = s;
917 s->transform_args[i].field = field;
918 s->transform_args[i].plane = &s->plane[i];
919 s->transform_args[i].idata = frame->data[i];
920 s->transform_args[i].istride = frame->linesize[i];
921 }
922 s->avctx->execute(s->avctx, dwt_plane, s->transform_args, NULL, 3,
923 sizeof(TransformArgs));
924
925 /* Calculate per-slice quantizers and sizes */
926 max_frame_bytes = header_size + calc_slice_sizes(s);
927
928 if (field < 2) {
929 ret = ff_get_encode_buffer(s->avctx, avpkt,
930 max_frame_bytes << s->interlaced, 0);
931 if (ret < 0)
932 return ret;
933 init_put_bits(&s->pb, avpkt->data, avpkt->size);
934 }
935
936 /* Sequence header */
937 encode_parse_info(s, DIRAC_PCODE_SEQ_HEADER);
938 encode_seq_header(s);
939
940 /* Encoder version */
941 if (aux_data) {
942 encode_parse_info(s, DIRAC_PCODE_AUX);
943 ff_put_string(&s->pb, aux_data, 1);
944 }
945
946 /* Picture header */
947 encode_parse_info(s, DIRAC_PCODE_PICTURE_HQ);
948 encode_picture_start(s);
949
950 /* Encode slices */
951 encode_slices(s);
952
953 /* End sequence */
954 encode_parse_info(s, DIRAC_PCODE_END_SEQ);
955
956 return 0;
957}
958
959static av_cold int vc2_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
960 const AVFrame *frame, int *got_packet)

Callers 1

vc2_encode_frameFunction · 0.70

Calls 8

calc_slice_sizesFunction · 0.85
ff_get_encode_bufferFunction · 0.85
init_put_bitsFunction · 0.85
encode_parse_infoFunction · 0.85
encode_seq_headerFunction · 0.85
ff_put_stringFunction · 0.85
encode_picture_startFunction · 0.85
encode_slicesFunction · 0.85

Tested by

no test coverage detected