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

Function encode_frame

libavcodec/dcaenc.c:1256–1292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1254}
1255
1256static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
1257 const AVFrame *frame, int *got_packet_ptr)
1258{
1259 DCAEncContext *c = avctx->priv_data;
1260 const int32_t *samples;
1261 int ret, i;
1262
1263 if ((ret = ff_get_encode_buffer(avctx, avpkt, c->frame_size, 0)) < 0)
1264 return ret;
1265
1266 samples = (const int32_t *)frame->data[0];
1267
1268 subband_transform(c, samples);
1269 if (c->lfe_channel)
1270 lfe_downsample(c, samples);
1271
1272 calc_masking(c, samples);
1273 if (c->options.adpcm_mode)
1274 adpcm_analysis(c);
1275 find_peaks(c);
1276 assign_bits(c);
1277 calc_lfe_scales(c);
1278 shift_history(c, samples);
1279
1280 init_put_bits(&c->pb, avpkt->data, avpkt->size);
1281 fill_in_adpcm_bufer(c);
1282 put_frame_header(c);
1283 put_primary_audio_header(c);
1284 for (i = 0; i < SUBFRAMES; i++)
1285 put_subframe(c, i);
1286
1287 flush_put_bits(&c->pb);
1288 memset(put_bits_ptr(&c->pb), 0, put_bytes_left(&c->pb, 0));
1289
1290 *got_packet_ptr = 1;
1291 return 0;
1292}
1293
1294#define DCAENC_FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
1295

Callers

nothing calls this directly

Calls 15

ff_get_encode_bufferFunction · 0.85
subband_transformFunction · 0.85
lfe_downsampleFunction · 0.85
calc_maskingFunction · 0.85
adpcm_analysisFunction · 0.85
find_peaksFunction · 0.85
assign_bitsFunction · 0.85
calc_lfe_scalesFunction · 0.85
shift_historyFunction · 0.85
init_put_bitsFunction · 0.85
fill_in_adpcm_buferFunction · 0.85
put_frame_headerFunction · 0.85

Tested by

no test coverage detected