Vitor <[email protected]> added the comment:
Michael Niedermayer wrote:
> Michael Niedermayer <[email protected]> added the comment:
>
> On Thu, Mar 04, 2010 at 06:20:41PM +0000, Vitor wrote:
>> This bug has nothing to do with the cinepack decoder.
>>
>> Patch attached.
>>
>> ----------
>> title: Cinepak decoder depends on unintialized memory -> Raw video encoder
write random junk in the end of frames with odd dimensions
>>
>> ________________________________________________
>> FFmpeg issue tracker <[email protected]>
>> <https://roundup.ffmpeg.org/issue956>
>> ________________________________________________
>> imgconvert.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>> 23ef8664c2e1c81febce95b7488b6e2d57d1eedb rawenc_bug.diff
>> Index: libavcodec/imgconvert.c
>> ===================================================================
>> --- libavcodec/imgconvert.c (revision 22109)
>> +++ libavcodec/imgconvert.c (working copy)
>> @@ -724,8 +724,8 @@
>>
>> for (i=0; i<data_planes; i++) {
>> if (i == 1) {
>> - w = ((width >> desc->log2_chroma_w) * pf->depth + 7) / 8;
>> - h = height >> desc->log2_chroma_h;
>> + w = (((width + (1 << desc->log2_chroma_w) - 1) >>
desc->log2_chroma_w) * pf->depth + 7) / 8;
>> + h = (height + (1 << desc->log2_chroma_h) - 1) >>
desc->log2_chroma_h;
>
> -((-a)>>x)
> is nicer
Ok.
________________________________________________
FFmpeg issue tracker <[email protected]>
<https://roundup.ffmpeg.org/issue956>
________________________________________________
Index: libavcodec/imgconvert.c
===================================================================
--- libavcodec/imgconvert.c (revision 22109)
+++ libavcodec/imgconvert.c (working copy)
@@ -724,8 +724,8 @@
for (i=0; i<data_planes; i++) {
if (i == 1) {
- w = ((width >> desc->log2_chroma_w) * pf->depth + 7) / 8;
- h = height >> desc->log2_chroma_h;
+ w = (- ((-width) >> desc->log2_chroma_w) * pf->depth + 7) / 8;
+ h = -((-height) >> desc->log2_chroma_h);
if (pix_fmt == PIX_FMT_NV12 || pix_fmt == PIX_FMT_NV21)
w <<= 1;
} else if (i == 3) {