[FFmpeg-cvslog] r25792 - trunk/libavcodec/imgconvert.c

Ramiro Polla ramiro.polla
Mon Nov 22 04:53:27 CET 2010


On Sun, Nov 21, 2010 at 7:25 PM, stefano <subversion at mplayerhq.hu> wrote:
> Author: stefano
> Date: Sun Nov 21 22:25:06 2010
> New Revision: 25792
>
> Log:
> Re-implement avpicture_layout() using pixdesc and imgutils API.
>
> The new implementation is more compact, more correct and doesn't hurt
> the eyes.
>
> Modified:
> ? trunk/libavcodec/imgconvert.c
>
> Modified: trunk/libavcodec/imgconvert.c
> ==============================================================================
> --- trunk/libavcodec/imgconvert.c ? ? ? Sun Nov 21 22:25:02 2010 ? ? ? ?(r25791)
> +++ trunk/libavcodec/imgconvert.c ? ? ? Sun Nov 21 22:25:06 2010 ? ? ? ?(r25792)
> @@ -490,68 +490,31 @@ int avpicture_fill(AVPicture *picture, u
> ?int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height,
> ? ? ? ? ? ? ? ? ? ? ?unsigned char *dest, int dest_size)
> ?{
> - ? ?const PixFmtInfo* pf = &pix_fmt_info[pix_fmt];
> + ? ?int i, j, nb_planes = 0, linesizes[4];
> ? ? const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
> - ? ?int i, j, w, ow, h, oh, data_planes;
> - ? ?const unsigned char* s;
 ^     ^^^^^^^^^^^^^^^^^^^^^^^

[...]
> - ? ?ow = w;
> - ? ?oh = h;
> + ? ?av_image_fill_linesizes(linesizes, pix_fmt, width);
> + ? ?for (i = 0; i < nb_planes; i++) {
> + ? ? ? ?int h, s = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
 ^         ^^^    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[...]
> ? ? ? ? s = src->data[i];
          ^^^^^^^^^^^^^^^^^
> - ? ? ? ?for(j=0; j<h; j++) {
> - ? ? ? ? ? ?memcpy(dest, s, w);
> - ? ? ? ? ? ?dest += w;
> + ? ? ? ?for (j = 0; j < h; j++) {
> + ? ? ? ? ? ?memcpy(dest, s, linesizes[i]);
> + ? ? ? ? ? ?dest += linesizes[i];
> ? ? ? ? ? ? s += src->linesize[i];
              ^^^^^^^^^^^^^^^^^^^^^^

fixed in 25793



More information about the ffmpeg-cvslog mailing list