X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fdcaenc.c;h=bd08ccd331c4d395ccc0ab499e626d6864d3d42c;hb=a247ac640df3da573cd661065bf53f37863e2b46;hp=34b3e94165ec236d3688c095fb63c8879eacf827;hpb=1811b7d1f5330e04a48b1d6425cf1ef6ed776ed1;p=ffmpeg diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c index 34b3e94165e..bd08ccd331c 100644 --- a/libavcodec/dcaenc.c +++ b/libavcodec/dcaenc.c @@ -28,6 +28,7 @@ #include "libavutil/channel_layout.h" #include "libavutil/common.h" #include "libavutil/ffmath.h" +#include "libavutil/mem_internal.h" #include "libavutil/opt.h" #include "avcodec.h" #include "dca.h" @@ -924,10 +925,10 @@ static void fill_in_adpcm_bufer(DCAEncContext *c) * But there are no proper value in decoder history, so likely result will be no good. * Bitstream has "Predictor history flag switch", but this flag disables history for all subbands */ - samples[0] = c->adpcm_history[ch][band][0] << 7; - samples[1] = c->adpcm_history[ch][band][1] << 7; - samples[2] = c->adpcm_history[ch][band][2] << 7; - samples[3] = c->adpcm_history[ch][band][3] << 7; + samples[0] = c->adpcm_history[ch][band][0] * (1 << 7); + samples[1] = c->adpcm_history[ch][band][1] * (1 << 7); + samples[2] = c->adpcm_history[ch][band][2] * (1 << 7); + samples[3] = c->adpcm_history[ch][band][3] * (1 << 7); } } } @@ -1212,8 +1213,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt, flush_put_bits(&c->pb); avpkt->pts = frame->pts; + avpkt->size = put_bytes_output(&c->pb); avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples); - avpkt->size = put_bits_count(&c->pb) >> 3; *got_packet_ptr = 1; return 0; } @@ -1237,7 +1238,7 @@ static const AVCodecDefault defaults[] = { { NULL }, }; -AVCodec ff_dca_encoder = { +const AVCodec ff_dca_encoder = { .name = "dca", .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"), .type = AVMEDIA_TYPE_AUDIO,