Revision 34017fd9

View differences:

ffplay.c
28 28
#include "libavutil/avstring.h"
29 29
#include "libavutil/colorspace.h"
30 30
#include "libavutil/pixdesc.h"
31
#include "libavcore/imgutils.h"
31 32
#include "libavcore/parseutils.h"
32 33
#include "libavformat/avformat.h"
33 34
#include "libavdevice/avdevice.h"
......
1734 1735
        picref = avfilter_ref_buffer(priv->frame->opaque, ~0);
1735 1736
    } else {
1736 1737
        picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, link->w, link->h);
1737
        av_picture_data_copy(picref->data, picref->linesize,
1738
        av_image_copy(picref->data, picref->linesize,
1738 1739
                             priv->frame->data, priv->frame->linesize,
1739 1740
                             picref->format, link->w, link->h);
1740 1741
    }
libavcodec/avcodec.h
32 32

  
33 33
#define LIBAVCODEC_VERSION_MAJOR 52
34 34
#define LIBAVCODEC_VERSION_MINOR 87
35
#define LIBAVCODEC_VERSION_MICRO  3
35
#define LIBAVCODEC_VERSION_MICRO  4
36 36

  
37 37
#define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
38 38
                                               LIBAVCODEC_VERSION_MINOR, \
......
3950 3950
 */
3951 3951
void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size);
3952 3952

  
3953
#if LIBAVCODEC_VERSION_MAJOR < 53
3953 3954
/**
3954
 * Copy image data in src_data to dst_data.
3955
 *
3956
 * @param dst_linesize linesizes for the image in dst_data
3957
 * @param src_linesize linesizes for the image in src_data
3955
 * @deprecated Deprecated in favor of av_image_copy().
3958 3956
 */
3957
attribute_deprecated
3959 3958
void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4],
3960 3959
                          uint8_t *src_data[4], int src_linesize[4],
3961 3960
                          enum PixelFormat pix_fmt, int width, int height);
3961
#endif
3962 3962

  
3963 3963
/**
3964 3964
 * Copy image src to dst. Wraps av_picture_data_copy() above.
libavcodec/imgconvert.c
793 793
{
794 794
    return av_image_get_linesize(pix_fmt, width, plane);
795 795
}
796
#endif
797 796

  
798 797
void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4],
799 798
                          uint8_t *src_data[4], int src_linesize[4],
800 799
                          enum PixelFormat pix_fmt, int width, int height)
801 800
{
802
    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
803

  
804
    if (desc->flags & PIX_FMT_HWACCEL)
805
        return;
806

  
807
    if (desc->flags & PIX_FMT_PAL) {
808
        av_image_copy_plane(dst_data[0], dst_linesize[0],
809
                            src_data[0], src_linesize[0],
810
                            width, height);
811
        /* copy the palette */
812
        memcpy(dst_data[1], src_data[1], 4*256);
813
    } else {
814
        int i, planes_nb = 0;
815

  
816
        for (i = 0; i < desc->nb_components; i++)
817
            planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1);
818

  
819
        for (i = 0; i < planes_nb; i++) {
820
            int h = height;
821
            int bwidth = av_image_get_linesize(pix_fmt, width, i);
822
            if (i == 1 || i == 2) {
823
                h= -((-height)>>desc->log2_chroma_h);
824
            }
825
            av_image_copy_plane(dst_data[i], dst_linesize[i],
826
                                src_data[i], src_linesize[i],
827
                                bwidth, h);
828
        }
829
    }
801
    av_image_copy(dst_data, dst_linesize, src_data, src_linesize,
802
                  pix_fmt, width, height);
830 803
}
804
#endif
831 805

  
832 806
void av_picture_copy(AVPicture *dst, const AVPicture *src,
833 807
                     enum PixelFormat pix_fmt, int width, int height)
834 808
{
835
    av_picture_data_copy(dst->data, dst->linesize, src->data,
809
    av_image_copy(dst->data, dst->linesize, src->data,
836 810
                         src->linesize, pix_fmt, width, height);
837 811
}
838 812

  
libavcore/avcore.h
27 27
#include "libavutil/avutil.h"
28 28

  
29 29
#define LIBAVCORE_VERSION_MAJOR  0
30
#define LIBAVCORE_VERSION_MINOR  8
30
#define LIBAVCORE_VERSION_MINOR  9
31 31
#define LIBAVCORE_VERSION_MICRO  0
32 32

  
33 33
#define LIBAVCORE_VERSION_INT   AV_VERSION_INT(LIBAVCORE_VERSION_MAJOR, \
libavcore/imgutils.c
152 152
    }
153 153
}
154 154

  
155
void av_image_copy(uint8_t *dst_data[4], int dst_linesize[4],
156
                   const uint8_t *src_data[4], const int src_linesize[4],
157
                   enum PixelFormat pix_fmt, int width, int height)
158
{
159
    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
160

  
161
    if (desc->flags & PIX_FMT_HWACCEL)
162
        return;
163

  
164
    if (desc->flags & PIX_FMT_PAL) {
165
        av_image_copy_plane(dst_data[0], dst_linesize[0],
166
                            src_data[0], src_linesize[0],
167
                            width, height);
168
        /* copy the palette */
169
        memcpy(dst_data[1], src_data[1], 4*256);
170
    } else {
171
        int i, planes_nb = 0;
172

  
173
        for (i = 0; i < desc->nb_components; i++)
174
            planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1);
175

  
176
        for (i = 0; i < planes_nb; i++) {
177
            int h = height;
178
            int bwidth = av_image_get_linesize(pix_fmt, width, i);
179
            if (i == 1 || i == 2) {
180
                h= -((-height)>>desc->log2_chroma_h);
181
            }
182
            av_image_copy_plane(dst_data[i], dst_linesize[i],
183
                                src_data[i], src_linesize[i],
184
                                bwidth, h);
185
        }
186
    }
187
}
188

  
155 189
#if FF_API_OLD_IMAGE_NAMES
156 190
void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
157 191
                                const AVPixFmtDescriptor *pixdesc)
libavcore/imgutils.h
91 91
                         int bytewidth, int height);
92 92

  
93 93
/**
94
 * Copy image in src_data to dst_data.
95
 *
96
 * @param dst_linesize linesizes for the image in dst_data
97
 * @param src_linesize linesizes for the image in src_data
98
 */
99
void av_image_copy(uint8_t *dst_data[4], int dst_linesize[4],
100
                   const uint8_t *src_data[4], const int src_linesize[4],
101
                   enum PixelFormat pix_fmt, int width, int height);
102

  
103
/**
94 104
 * Check if the given dimension of an image is valid, meaning that all
95 105
 * bytes of the image can be addressed with a signed int.
96 106
 *
libavfilter/avfilter.h
26 26

  
27 27
#define LIBAVFILTER_VERSION_MAJOR  1
28 28
#define LIBAVFILTER_VERSION_MINOR 38
29
#define LIBAVFILTER_VERSION_MICRO  2
29
#define LIBAVFILTER_VERSION_MICRO  3
30 30

  
31 31
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
32 32
                                               LIBAVFILTER_VERSION_MINOR, \
libavfilter/vsrc_buffer.c
25 25

  
26 26
#include "avfilter.h"
27 27
#include "vsrc_buffer.h"
28
#include "libavutil/pixdesc.h"
28
#include "libavcore/imgutils.h"
29 29

  
30 30
typedef struct {
31 31
    int64_t           pts;
......
119 119
                                       AV_PERM_REUSE2,
120 120
                                       link->w, link->h);
121 121

  
122
    av_picture_data_copy(picref->data, picref->linesize,
122
    av_image_copy(picref->data, picref->linesize,
123 123
                         c->frame.data, c->frame.linesize,
124 124
                         picref->format, link->w, link->h);
125 125

  

Also available in: Unified diff