Originally committed as revision 25067 to svn://svn.ffmpeg.org/ffmpeg/trunk
Unified · Split
| @@ -28,6 +28,7 @@ · 27 unmodified lines | |||
| 28 | #include "libavutil/avstring.h" | 28 | #include "libavutil/avstring.h" |
| 29 | #include "libavutil/colorspace.h" | 29 | #include "libavutil/colorspace.h" |
| 30 | #include "libavutil/pixdesc.h" | 30 | #include "libavutil/pixdesc.h" |
| 31 | #include "libavcore/imgutils.h" | ||
| 31 | #include "libavcore/parseutils.h" | 32 | #include "libavcore/parseutils.h" |
| 32 | #include "libavformat/avformat.h" | 33 | #include "libavformat/avformat.h" |
| 33 | #include "libavdevice/avdevice.h" | 34 | #include "libavdevice/avdevice.h" |
| @@ -1734,7 +1735,7 @@ static int input_request_frame(AVFilterLink *link) · 1700 unmodified lines | |||
| 1734 | picref = avfilter_ref_buffer(priv->frame->opaque, ~0); | 1735 | picref = avfilter_ref_buffer(priv->frame->opaque, ~0); |
| 1735 | } else { | 1736 | } else { |
| 1736 | picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, link->w, link->h); | 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 | priv->frame->data, priv->frame->linesize, | 1739 | priv->frame->data, priv->frame->linesize, |
| 1739 | picref->format, link->w, link->h); | 1740 | picref->format, link->w, link->h); |
| 1740 | } | 1741 | } |
| @@ -32,7 +32,7 @@ · 31 unmodified lines | |||
| 32 | 32 | ||
| 33 | #define LIBAVCODEC_VERSION_MAJOR 52 | 33 | #define LIBAVCODEC_VERSION_MAJOR 52 |
| 34 | #define LIBAVCODEC_VERSION_MINOR 87 | 34 | #define LIBAVCODEC_VERSION_MINOR 87 |
| 35 | #define LIBAVCODEC_VERSION_MICRO 3 | 35 | #define LIBAVCODEC_VERSION_MICRO 4 |
| 36 | 36 | ||
| 37 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | 37 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| 38 | LIBAVCODEC_VERSION_MINOR, \ | 38 | LIBAVCODEC_VERSION_MINOR, \ |
| @@ -3950,15 +3950,15 @@ void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size); · 3911 unmodified lines | |||
| 3950 | */ | 3950 | */ |
| 3951 | void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size); | 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 | * @deprecated Deprecated in favor of av_image_copy(). |
| 3955 | * | ||
| 3956 | * @param dst_linesize linesizes for the image in dst_data | ||
| 3957 | * @param src_linesize linesizes for the image in src_data | ||
| 3958 | */ | 3956 | */ |
| 3957 | attribute_deprecated | ||
| 3959 | void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4], | 3958 | void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4], |
| 3960 | uint8_t *src_data[4], int src_linesize[4], | 3959 | uint8_t *src_data[4], int src_linesize[4], |
| 3961 | enum PixelFormat pix_fmt, int width, int height); | 3960 | enum PixelFormat pix_fmt, int width, int height); |
| 3961 | #endif | ||
| 3962 | 3962 | ||
| 3963 | /** | 3963 | /** |
| 3964 | * Copy image src to dst. Wraps av_picture_data_copy() above. | 3964 | * Copy image src to dst. Wraps av_picture_data_copy() above. |
| @@ -793,46 +793,20 @@ int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane) · 792 unmodified lines | |||
| 793 | { | 793 | { |
| 794 | return av_image_get_linesize(pix_fmt, width, plane); | 794 | return av_image_get_linesize(pix_fmt, width, plane); |
| 795 | } | 795 | } |
| 796 | #endif | ||
| 797 | 796 | ||
| 798 | void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4], | 797 | void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4], |
| 799 | uint8_t *src_data[4], int src_linesize[4], | 798 | uint8_t *src_data[4], int src_linesize[4], |
| 800 | enum PixelFormat pix_fmt, int width, int height) | 799 | enum PixelFormat pix_fmt, int width, int height) |
| 801 | { | 800 | { |
| 802 | const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt]; | 801 | av_image_copy(dst_data, dst_linesize, src_data, src_linesize, |
| 803 | 802 | pix_fmt, width, height); | |
| 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 | } | ||
| 830 | } | 803 | } |
| 804 | #endif | ||
| 831 | 805 | ||
| 832 | void av_picture_copy(AVPicture *dst, const AVPicture *src, | 806 | void av_picture_copy(AVPicture *dst, const AVPicture *src, |
| 833 | enum PixelFormat pix_fmt, int width, int height) | 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 | src->linesize, pix_fmt, width, height); | 810 | src->linesize, pix_fmt, width, height); |
| 837 | } | 811 | } |
| 838 | 812 | ||
| @@ -27,7 +27,7 @@ · 26 unmodified lines | |||
| 27 | #include "libavutil/avutil.h" | 27 | #include "libavutil/avutil.h" |
| 28 | 28 | ||
| 29 | #define LIBAVCORE_VERSION_MAJOR 0 | 29 | #define LIBAVCORE_VERSION_MAJOR 0 |
| 30 | #define LIBAVCORE_VERSION_MINOR 8 | 30 | #define LIBAVCORE_VERSION_MINOR 9 |
| 31 | #define LIBAVCORE_VERSION_MICRO 0 | 31 | #define LIBAVCORE_VERSION_MICRO 0 |
| 32 | 32 | ||
| 33 | #define LIBAVCORE_VERSION_INT AV_VERSION_INT(LIBAVCORE_VERSION_MAJOR, \ | 33 | #define LIBAVCORE_VERSION_INT AV_VERSION_INT(LIBAVCORE_VERSION_MAJOR, \ |
| @@ -152,6 +152,40 @@ void av_image_copy_plane(uint8_t *dst, int dst_linesize, · 151 unmodified lines | |||
| 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 | #if FF_API_OLD_IMAGE_NAMES | 189 | #if FF_API_OLD_IMAGE_NAMES |
| 156 | void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], | 190 | void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], |
| 157 | const AVPixFmtDescriptor *pixdesc) | 191 | const AVPixFmtDescriptor *pixdesc) |
| @@ -90,6 +90,16 @@ void av_image_copy_plane(uint8_t *dst, int dst_linesize, · 89 unmodified lines | |||
| 90 | const uint8_t *src, int src_linesize, | 90 | const uint8_t *src, int src_linesize, |
| 91 | int bytewidth, int height); | 91 | int bytewidth, int height); |
| 92 | 92 | ||
| 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 | |||
| 93 | /** | 103 | /** |
| 94 | * Check if the given dimension of an image is valid, meaning that all | 104 | * Check if the given dimension of an image is valid, meaning that all |
| 95 | * bytes of the image can be addressed with a signed int. | 105 | * bytes of the image can be addressed with a signed int. |
| @@ -26,7 +26,7 @@ · 25 unmodified lines | |||
| 26 | 26 | ||
| 27 | #define LIBAVFILTER_VERSION_MAJOR 1 | 27 | #define LIBAVFILTER_VERSION_MAJOR 1 |
| 28 | #define LIBAVFILTER_VERSION_MINOR 38 | 28 | #define LIBAVFILTER_VERSION_MINOR 38 |
| 29 | #define LIBAVFILTER_VERSION_MICRO 2 | 29 | #define LIBAVFILTER_VERSION_MICRO 3 |
| 30 | 30 | ||
| 31 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ | 31 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ |
| 32 | LIBAVFILTER_VERSION_MINOR, \ | 32 | LIBAVFILTER_VERSION_MINOR, \ |
| @@ -25,7 +25,7 @@ · 24 unmodified lines | |||
| 25 | 25 | ||
| 26 | #include "avfilter.h" | 26 | #include "avfilter.h" |
| 27 | #include "vsrc_buffer.h" | 27 | #include "vsrc_buffer.h" |
| 28 | #include "libavutil/pixdesc.h" | 28 | #include "libavcore/imgutils.h" |
| 29 | 29 | ||
| 30 | typedef struct { | 30 | typedef struct { |
| 31 | int64_t pts; | 31 | int64_t pts; |
| @@ -119,7 +119,7 @@ static int request_frame(AVFilterLink *link) · 87 unmodified lines | |||
| 119 | AV_PERM_REUSE2, | 119 | AV_PERM_REUSE2, |
| 120 | link->w, link->h); | 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 | c->frame.data, c->frame.linesize, | 123 | c->frame.data, c->frame.linesize, |
| 124 | picref->format, link->w, link->h); | 124 | picref->format, link->w, link->h); |
| 125 | 125 | ||