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

Function dca_convert_bitstream

libavcodec/dca.c:1157–1193  ·  view source on GitHub ↗

* Convert bitstream to one representation based on sync marker */

Source from the content-addressed store, hash-verified

1155 * Convert bitstream to one representation based on sync marker
1156 */
1157static int dca_convert_bitstream(const uint8_t * src, int src_size, uint8_t * dst,
1158 int max_size)
1159{
1160 uint32_t mrk;
1161 int i, tmp;
1162 const uint16_t *ssrc = (const uint16_t *) src;
1163 uint16_t *sdst = (uint16_t *) dst;
1164 PutBitContext pb;
1165
1166 if((unsigned)src_size > (unsigned)max_size) {
1167// av_log(NULL, AV_LOG_ERROR, "Input frame size larger then DCA_MAX_FRAME_SIZE!\n");
1168// return -1;
1169 src_size = max_size;
1170 }
1171
1172 mrk = AV_RB32(src);
1173 switch (mrk) {
1174 case DCA_MARKER_RAW_BE:
1175 memcpy(dst, src, src_size);
1176 return src_size;
1177 case DCA_MARKER_RAW_LE:
1178 for (i = 0; i < (src_size + 1) >> 1; i++)
1179 *sdst++ = bswap_16(*ssrc++);
1180 return src_size;
1181 case DCA_MARKER_14B_BE:
1182 case DCA_MARKER_14B_LE:
1183 init_put_bits(&pb, dst, max_size);
1184 for (i = 0; i < (src_size + 1) >> 1; i++, src += 2) {
1185 tmp = ((mrk == DCA_MARKER_14B_BE) ? AV_RB16(src) : AV_RL16(src)) & 0x3FFF;
1186 put_bits(&pb, 14, tmp);
1187 }
1188 flush_put_bits(&pb);
1189 return (put_bits_count(&pb) + 7) >> 3;
1190 default:
1191 return -1;
1192 }
1193}
1194
1195/**
1196 * Main frame decoding function

Callers 1

dca_decode_frameFunction · 0.85

Calls 7

init_put_bitsFunction · 0.85
flush_put_bitsFunction · 0.85
put_bits_countFunction · 0.85
AV_RB32Function · 0.50
bswap_16Function · 0.50
AV_RB16Function · 0.50
AV_RL16Function · 0.50

Tested by

no test coverage detected