diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2014-11-11 15:49:02 +0300 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2014-11-28 16:51:45 +0300 |
commit | 566c4e060180249b5ee362763d71d8c933d3851b (patch) | |
tree | cb83ec6dbc85569674fc76e85fb4b5a11b669e44 /decoder | |
parent | da570a4d86d0e608ca62611ac783191ca053b232 (diff) |
Do not round aspect ratio when one of its values exceed 255.
- Use the same limit everywhere for consistency.
- Add one missing cast to avoid possible overflow.
Diffstat (limited to 'decoder')
-rw-r--r-- | decoder/LAVVideo/decoders/avcodec.cpp | 2 | ||||
-rw-r--r-- | decoder/LAVVideo/decoders/wmv9.cpp | 2 | ||||
-rw-r--r-- | decoder/LAVVideo/decoders/wmv9mft.cpp | 2 | ||||
-rw-r--r-- | decoder/LAVVideo/parsers/VC1HeaderParser.cpp | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/decoder/LAVVideo/decoders/avcodec.cpp b/decoder/LAVVideo/decoders/avcodec.cpp index 36bd6a20..30a167f7 100644 --- a/decoder/LAVVideo/decoders/avcodec.cpp +++ b/decoder/LAVVideo/decoders/avcodec.cpp @@ -853,7 +853,7 @@ STDMETHODIMP CDecAvcodec::Decode(const BYTE *buffer, int buflen, REFERENCE_TIME AVRational display_aspect_ratio; int64_t num = (int64_t)m_pFrame->sample_aspect_ratio.num * m_pFrame->width; int64_t den = (int64_t)m_pFrame->sample_aspect_ratio.den * m_pFrame->height; - av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, num, den, 1 << 30); + av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, num, den, INT_MAX); pOutFrame->width = m_pFrame->width; pOutFrame->height = m_pFrame->height; diff --git a/decoder/LAVVideo/decoders/wmv9.cpp b/decoder/LAVVideo/decoders/wmv9.cpp index 4b6cc52b..9834434b 100644 --- a/decoder/LAVVideo/decoders/wmv9.cpp +++ b/decoder/LAVVideo/decoders/wmv9.cpp @@ -493,7 +493,7 @@ STDMETHODIMP CDecWMV9::ProcessOutput() AVRational display_aspect_ratio; int64_t num = (int64_t)m_StreamAR.num * pBMI->biWidth; int64_t den = (int64_t)m_StreamAR.den * pBMI->biHeight; - av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, num, den, 1 << 30); + av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, num, den, INT_MAX); BYTE contentType = 0; DWORD dwPropSize = 1; diff --git a/decoder/LAVVideo/decoders/wmv9mft.cpp b/decoder/LAVVideo/decoders/wmv9mft.cpp index 2e4475c9..a4cbf72b 100644 --- a/decoder/LAVVideo/decoders/wmv9mft.cpp +++ b/decoder/LAVVideo/decoders/wmv9mft.cpp @@ -496,7 +496,7 @@ STDMETHODIMP CDecWMV9MFT::ProcessOutput() MFGetAttributeRatio(pMTOut, MF_MT_PIXEL_ASPECT_RATIO, (UINT32*)&pixel_aspect_ratio.num, (UINT32*)&pixel_aspect_ratio.den); AVRational display_aspect_ratio = {0, 0}; - av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, (int64_t)pixel_aspect_ratio.num * pFrame->width, (int64_t)pixel_aspect_ratio.den * pFrame->height, 1 << 30); + av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, (int64_t)pixel_aspect_ratio.num * pFrame->width, (int64_t)pixel_aspect_ratio.den * pFrame->height, INT_MAX); pFrame->interlaced = MFGetAttributeUINT32(OutputBuffer.pSample, MFSampleExtension_Interlaced, FALSE); pFrame->repeat = MFGetAttributeUINT32(OutputBuffer.pSample, MFSampleExtension_RepeatFirstField, FALSE); diff --git a/decoder/LAVVideo/parsers/VC1HeaderParser.cpp b/decoder/LAVVideo/parsers/VC1HeaderParser.cpp index a600db52..ddc5f287 100644 --- a/decoder/LAVVideo/parsers/VC1HeaderParser.cpp +++ b/decoder/LAVVideo/parsers/VC1HeaderParser.cpp @@ -187,7 +187,7 @@ void CVC1HeaderParser::VC1ParseSequenceHeader(GetBitContext *gb) hdr.ar.num = w; hdr.ar.den = h; } else { - av_reduce(&hdr.ar.num, &hdr.ar.den, hdr.height * w, hdr.width * h, 1 << 30); + av_reduce(&hdr.ar.num, &hdr.ar.den, (int64_t)hdr.height * w, (int64_t)hdr.width * h, INT_MAX); } } |