Commit f32fd318 authored by Sjoerd Simons's avatar Sjoerd Simons Committed by Martin Storsjö

g722: Change bits per sample to 4

Earlier, bits per sample was defined as 8, since
bits_per_coded_sample was used to indicate whether to ignore
the lower bits of the codeword, having values 6, 7 or 8.

g722 encodes 2 samples into one byte codeword, therefore the
bits per sample is 4. By changing this, the generated timestamps
for streams encoded with g722 become correct.

This makes timestamp generation for g722 data correct (both when
encoding and when demuxing from raw g722 files).
Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent 6fcbb0f5
...@@ -139,7 +139,7 @@ static int g722_encode_trellis(AVCodecContext *avctx, ...@@ -139,7 +139,7 @@ static int g722_encode_trellis(AVCodecContext *avctx,
nodes[i][0]->state = c->band[i]; nodes[i][0]->state = c->band[i];
} }
for (i = 0; i < buf_size >> 1; i++) { for (i = 0; i < buf_size; i++) {
int xlow, xhigh; int xlow, xhigh;
struct TrellisNode *next[2]; struct TrellisNode *next[2];
int heap_pos[2] = {0, 0}; int heap_pos[2] = {0, 0};
...@@ -285,7 +285,7 @@ static int g722_encode_frame(AVCodecContext *avctx, ...@@ -285,7 +285,7 @@ static int g722_encode_frame(AVCodecContext *avctx,
if (avctx->trellis) if (avctx->trellis)
return g722_encode_trellis(avctx, dst, buf_size, data); return g722_encode_trellis(avctx, dst, buf_size, data);
for (i = 0; i < buf_size >> 1; i++) { for (i = 0; i < buf_size; i++) {
int xlow, xhigh, ihigh, ilow; int xlow, xhigh, ihigh, ilow;
filter_samples(c, &samples[2*i], &xlow, &xhigh); filter_samples(c, &samples[2*i], &xlow, &xhigh);
ihigh = encode_high(&c->band[1], xhigh); ihigh = encode_high(&c->band[1], xhigh);
......
...@@ -1342,8 +1342,8 @@ int av_get_bits_per_sample(enum CodecID codec_id){ ...@@ -1342,8 +1342,8 @@ int av_get_bits_per_sample(enum CodecID codec_id){
case CODEC_ID_ADPCM_SWF: case CODEC_ID_ADPCM_SWF:
case CODEC_ID_ADPCM_MS: case CODEC_ID_ADPCM_MS:
case CODEC_ID_ADPCM_YAMAHA: case CODEC_ID_ADPCM_YAMAHA:
return 4;
case CODEC_ID_ADPCM_G722: case CODEC_ID_ADPCM_G722:
return 4;
case CODEC_ID_PCM_ALAW: case CODEC_ID_PCM_ALAW:
case CODEC_ID_PCM_MULAW: case CODEC_ID_PCM_MULAW:
case CODEC_ID_PCM_S8: case CODEC_ID_PCM_S8:
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#define AVCODEC_VERSION_H #define AVCODEC_VERSION_H
#define LIBAVCODEC_VERSION_MAJOR 53 #define LIBAVCODEC_VERSION_MAJOR 53
#define LIBAVCODEC_VERSION_MINOR 25 #define LIBAVCODEC_VERSION_MINOR 26
#define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment