Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/LAVFilters.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2013-12-15 14:43:00 +0400
committerHendrik Leppkes <h.leppkes@gmail.com>2013-12-15 14:43:00 +0400
commitf8893b4e0ed2e28589b759df9d576d434bd0049a (patch)
tree39239d3ba98d5395f943604b6624e972d728be33 /decoder/LAVVideo
parente2d45f4902fe4ffd6de707ece3f4f073f848c903 (diff)
Add a check for converting odd-height 422/444 formats to RGB
The converter would otherwise always try to process 2 lines, which would overrun the dst buf.
Diffstat (limited to 'decoder/LAVVideo')
-rw-r--r--decoder/LAVVideo/pixconv/yuv2rgb.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/decoder/LAVVideo/pixconv/yuv2rgb.cpp b/decoder/LAVVideo/pixconv/yuv2rgb.cpp
index 4a5003ce..a19e8969 100644
--- a/decoder/LAVVideo/pixconv/yuv2rgb.cpp
+++ b/decoder/LAVVideo/pixconv/yuv2rgb.cpp
@@ -409,6 +409,7 @@ static int __stdcall yuv2rgb_process_lines(const uint8_t *srcY, const uint8_t *s
ptrdiff_t line = sliceYStart;
ptrdiff_t lastLine = sliceYEnd;
+ bool lastLineInOddHeight = false;
const ptrdiff_t endx = width - 4;
@@ -428,6 +429,9 @@ static int __stdcall yuv2rgb_process_lines(const uint8_t *srcY, const uint8_t *s
}
if (lastLine == height)
lastLine--;
+ } else if (lastLine == height && (lastLine & 1)) {
+ lastLine--;
+ lastLineInOddHeight = true;
}
for (; line < lastLine; line += 2) {
@@ -451,7 +455,7 @@ static int __stdcall yuv2rgb_process_lines(const uint8_t *srcY, const uint8_t *s
yuv2rgb_convert_pixels<inputFormat, shift, out32, 1, dithertype, ycgco>(y, u, v, rgb, srcStrideY, srcStrideUV, dstStride, line, coeffs, lineDither, 0);
}
- if (inputFormat == LAVPixFmt_YUV420 || inputFormat == LAVPixFmt_NV12) {
+ if (inputFormat == LAVPixFmt_YUV420 || inputFormat == LAVPixFmt_NV12 || lastLineInOddHeight) {
if (sliceYEnd == height) {
if (dithertype == LAVDither_Random)
lineDither = dithers + ((height - 2) * 24 * DITHER_STEPS);