Revision c9d6e847 libavcodec/utils.c

View differences:

libavcodec/utils.c
242 242
        int h_chroma_shift, v_chroma_shift;
243 243
        int size[4] = {0};
244 244
        int tmpsize;
245
        int unaligned;
245 246
        AVPicture picture;
246 247
        int stride_align[4];
247 248

  
......
254 255
            h+= EDGE_WIDTH*2;
255 256
        }
256 257

  
258
        do {
259
            // NOTE: do not align linesizes individually, this breaks e.g. assumptions
260
            // that linesize[0] == 2*linesize[1] in the MPEG-encoder for 4:2:2
257 261
        ff_fill_linesize(&picture, s->pix_fmt, w);
262
            // increase alignment of w for next try (rhs gives the lowest bit set in w)
263
            w += w & ~(w-1);
258 264

  
265
            unaligned = 0;
259 266
        for (i=0; i<4; i++){
260 267
//STRIDE_ALIGN is 8 for SSE* but this does not work for SVQ1 chroma planes
261 268
//we could change STRIDE_ALIGN to 16 for x86/sse but it would increase the
......
267 274
            else
268 275
#endif
269 276
            stride_align[i] = STRIDE_ALIGN;
270
            picture.linesize[i] = ALIGN(picture.linesize[i], stride_align[i]);
277
                unaligned |= picture.linesize[i] % stride_align[i];
271 278
        }
279
        } while (unaligned);
272 280

  
273 281
        tmpsize = ff_fill_pointer(&picture, NULL, s->pix_fmt, h);
274 282
        if (tmpsize < 0)

Also available in: Unified diff