mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-03-01 10:11:01 +00:00
Add av_picture_data_copy() and reimplement av_picture_copy() as a
wrapper of it. The new function is more generic, and does not depend on the definition of the AVPicture struct. Patch by S.N. Hemanth Meenakshisundaram s + "meenakshisundaram".substr(0, 7) + "@ucsd.edu". Originally committed as revision 24768 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
4bf2d6e8d4
commit
9f08d80363
@ -30,8 +30,8 @@
|
|||||||
#include "libavutil/avutil.h"
|
#include "libavutil/avutil.h"
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_MAJOR 52
|
#define LIBAVCODEC_VERSION_MAJOR 52
|
||||||
#define LIBAVCODEC_VERSION_MINOR 84
|
#define LIBAVCODEC_VERSION_MINOR 85
|
||||||
#define LIBAVCODEC_VERSION_MICRO 3
|
#define LIBAVCODEC_VERSION_MICRO 0
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||||
LIBAVCODEC_VERSION_MINOR, \
|
LIBAVCODEC_VERSION_MINOR, \
|
||||||
@ -3937,7 +3937,17 @@ void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
|
|||||||
void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size);
|
void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy image 'src' to 'dst'.
|
* Copy image data in src_data to dst_data.
|
||||||
|
*
|
||||||
|
* @param dst_linesize linesizes for the image in dst_data
|
||||||
|
* @param src_linesize linesizes for the image in src_data
|
||||||
|
*/
|
||||||
|
void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4],
|
||||||
|
uint8_t *src_data[4], int src_linesize[4],
|
||||||
|
enum PixelFormat pix_fmt, int width, int height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy image src to dst. Wraps av_picture_data_copy() above.
|
||||||
*/
|
*/
|
||||||
void av_picture_copy(AVPicture *dst, const AVPicture *src,
|
void av_picture_copy(AVPicture *dst, const AVPicture *src,
|
||||||
enum PixelFormat pix_fmt, int width, int height);
|
enum PixelFormat pix_fmt, int width, int height);
|
||||||
|
@ -845,7 +845,8 @@ int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void av_picture_copy(AVPicture *dst, const AVPicture *src,
|
void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4],
|
||||||
|
uint8_t *src_data[4], int src_linesize[4],
|
||||||
enum PixelFormat pix_fmt, int width, int height)
|
enum PixelFormat pix_fmt, int width, int height)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -862,21 +863,28 @@ void av_picture_copy(AVPicture *dst, const AVPicture *src,
|
|||||||
if (i == 1 || i == 2) {
|
if (i == 1 || i == 2) {
|
||||||
h= -((-height)>>desc->log2_chroma_h);
|
h= -((-height)>>desc->log2_chroma_h);
|
||||||
}
|
}
|
||||||
ff_img_copy_plane(dst->data[i], dst->linesize[i],
|
ff_img_copy_plane(dst_data[i], dst_linesize[i],
|
||||||
src->data[i], src->linesize[i],
|
src_data[i], src_linesize[i],
|
||||||
bwidth, h);
|
bwidth, h);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FF_PIXEL_PALETTE:
|
case FF_PIXEL_PALETTE:
|
||||||
ff_img_copy_plane(dst->data[0], dst->linesize[0],
|
ff_img_copy_plane(dst_data[0], dst_linesize[0],
|
||||||
src->data[0], src->linesize[0],
|
src_data[0], src_linesize[0],
|
||||||
width, height);
|
width, height);
|
||||||
/* copy the palette */
|
/* copy the palette */
|
||||||
memcpy(dst->data[1], src->data[1], 4*256);
|
memcpy(dst_data[1], src_data[1], 4*256);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void av_picture_copy(AVPicture *dst, const AVPicture *src,
|
||||||
|
enum PixelFormat pix_fmt, int width, int height)
|
||||||
|
{
|
||||||
|
av_picture_data_copy(dst->data, dst->linesize, src->data,
|
||||||
|
src->linesize, pix_fmt, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
/* 2x2 -> 1x1 */
|
/* 2x2 -> 1x1 */
|
||||||
void ff_shrink22(uint8_t *dst, int dst_wrap,
|
void ff_shrink22(uint8_t *dst, int dst_wrap,
|
||||||
const uint8_t *src, int src_wrap,
|
const uint8_t *src, int src_wrap,
|
||||||
|
Loading…
Reference in New Issue
Block a user