summaryrefslogtreecommitdiff
path: root/libavcodec/opus_pvq.c
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2017-11-23 00:58:36 +0000
committerRostislav Pehlivanov <atomnuker@gmail.com>2017-11-23 01:00:08 +0000
commit6e0723470bea258ceb72ee4c4916cf8f80337f92 (patch)
treeae2443bb5c41a916ae76b486d8114a48cdf2c09e /libavcodec/opus_pvq.c
parent79a26ef802d66106af42ddc81b61fdac06433821 (diff)
downloadffmpeg-6e0723470bea258ceb72ee4c4916cf8f80337f92.tar.gz
opus_pvq: fix crashing on analysis of mono
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/opus_pvq.c')
-rw-r--r--libavcodec/opus_pvq.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/opus_pvq.c b/libavcodec/opus_pvq.c
index f98b85d36f..2f7aa74da4 100644
--- a/libavcodec/opus_pvq.c
+++ b/libavcodec/opus_pvq.c
@@ -925,7 +925,8 @@ static float pvq_band_cost(CeltPVQ *pvq, CeltFrame *f, OpusRangeCoder *rc, int b
for (i = 0; i < band_size; i++) {
err_x += (X[i] - X_orig[i])*(X[i] - X_orig[i]);
- err_y += (Y[i] - Y_orig[i])*(Y[i] - Y_orig[i]);
+ if (Y)
+ err_y += (Y[i] - Y_orig[i])*(Y[i] - Y_orig[i]);
}
dist = sqrtf(err_x) + sqrtf(err_y);