31#define AES3_HEADER_LEN 4
43 "Encoding %d channel(s) is not allowed. Only 2, 4, 6 and 8 channels are supported.\n",
77 (
frame->nb_samples * nb_channels *
94 put_bits(&pb, 2, (nb_channels - 2) >> 1);
102 const uint32_t *samples = (uint32_t *)
frame->data[0];
104 for (
c = 0;
c <
frame->nb_samples;
c++) {
105 uint8_t vucf =
s->framing_index == 0 ? 0x10: 0;
108 o[0] =
ff_reverse[(samples[0] & 0x0000FF00) >> 8];
109 o[1] =
ff_reverse[(samples[0] & 0x00FF0000) >> 16];
110 o[2] =
ff_reverse[(samples[0] & 0xFF000000) >> 24];
111 o[3] =
ff_reverse[(samples[1] & 0x00000F00) >> 4] | vucf;
112 o[4] =
ff_reverse[(samples[1] & 0x000FF000) >> 12];
113 o[5] =
ff_reverse[(samples[1] & 0x0FF00000) >> 20];
114 o[6] =
ff_reverse[(samples[1] & 0xF0000000) >> 28];
120 if (
s->framing_index >= 192)
121 s->framing_index = 0;
124 const uint32_t *samples = (uint32_t *)
frame->data[0];
126 for (
c = 0;
c <
frame->nb_samples;
c++) {
127 uint8_t vucf =
s->framing_index == 0 ? 0x80: 0;
130 o[0] =
ff_reverse[ (samples[0] & 0x000FF000) >> 12];
131 o[1] =
ff_reverse[ (samples[0] & 0x0FF00000) >> 20];
132 o[2] =
ff_reverse[((samples[0] & 0xF0000000) >> 28) | vucf];
133 o[3] =
ff_reverse[ (samples[1] & 0x000FF000) >> 12];
134 o[4] =
ff_reverse[ (samples[1] & 0x0FF00000) >> 20];
135 o[5] =
ff_reverse[ (samples[1] & 0xF0000000) >> 28];
141 if (
s->framing_index >= 192)
142 s->framing_index = 0;
145 const uint16_t *samples = (uint16_t *)
frame->data[0];
147 for (
c = 0;
c <
frame->nb_samples;
c++) {
148 uint8_t vucf =
s->framing_index == 0 ? 0x10 : 0;
152 o[1] =
ff_reverse[(samples[0] & 0xFF00) >> 8];
153 o[2] =
ff_reverse[(samples[1] & 0x0F) << 4] | vucf;
154 o[3] =
ff_reverse[(samples[1] & 0x0FF0) >> 4];
155 o[4] =
ff_reverse[(samples[1] & 0xF000) >> 12];
162 if (
s->framing_index >= 192)
163 s->framing_index = 0;
const FFCodec ff_s302m_encoder
Libavcodec external API header.
Public libavutil channel layout APIs header.
#define CODEC_SAMPLERATES(...)
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
#define CODEC_SAMPLEFMTS(...)
int(* init)(AVBSFContext *ctx)
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE
Audio encoder supports receiving a different number of samples in each call.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_EXPERIMENTAL
Codec is experimental and is thus avoided in favor of non experimental encoders.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_SAMPLE_FMT_S32
signed 32 bits
@ AV_SAMPLE_FMT_S16
signed 16 bits
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
const uint8_t ff_reverse[256]
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
static int s302m_encode2_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
static av_cold int s302m_encode_init(AVCodecContext *avctx)
int nb_channels
Number of channels in this layout.
main external API structure.
AVChannelLayout ch_layout
Audio channel layout.
enum AVSampleFormat sample_fmt
audio sample format
int64_t bit_rate
the average bitrate
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.