diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-08-15 23:24:37 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-08-15 23:24:37 +0400 |
commit | fbc0947d00907c604b95aea34314030f404b7319 (patch) | |
tree | 5e9aba6a9efffba2cc1db3528b20a0d4c5460291 /src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/imgconvert.c | |
parent | 2b9ed578ede7ebd6a3417aa886cf5e1fc70d4e5c (diff) |
updated ffmpeg
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@2247 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/imgconvert.c')
-rw-r--r-- | src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/imgconvert.c | 84 |
1 files changed, 50 insertions, 34 deletions
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/imgconvert.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/imgconvert.c index 293fa3c8a..f6ea7a7f1 100644 --- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/imgconvert.c +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/imgconvert.c @@ -761,23 +761,10 @@ int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt, }
#endif
-void ff_img_copy_plane(uint8_t *dst, int dst_wrap,
- const uint8_t *src, int src_wrap,
- int width, int height)
-{
- if((!dst) || (!src))
- return;
- for(;height > 0; height--) {
- memcpy(dst, src, width);
- dst += dst_wrap;
- src += src_wrap;
- }
-}
-
-int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane)
+static int avg_bits_per_pixel(enum PixelFormat pix_fmt)
{
int bits;
- const PixFmtInfo *pf = &pix_fmt_info[pix_fmt];
+ const PixFmtInfo *pf;
const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
pf = &pix_fmt_info[pix_fmt];
@@ -807,26 +794,48 @@ int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane) bits = pf->depth * pf->nb_channels;
break;
}
- return (width * bits + 7) >> 3;
break;
case FF_PIXEL_PLANAR:
- if ((pix_fmt != PIX_FMT_NV12 && pix_fmt != PIX_FMT_NV21) &&
- (plane == 1 || plane == 2))
- width= -((-width)>>desc->log2_chroma_w);
-
- return (width * pf->depth + 7) >> 3;
+ if (desc->log2_chroma_w == 0 && desc->log2_chroma_h == 0) {
+ bits = pf->depth * pf->nb_channels;
+ } else {
+ bits = pf->depth + ((2 * pf->depth) >>
+ (desc->log2_chroma_w + desc->log2_chroma_h));
+ }
break;
case FF_PIXEL_PALETTE:
- if (plane == 0)
- return width;
+ bits = 8;
+ break;
+ default:
+ bits = -1;
break;
}
+ return bits;
+}
+
+void ff_img_copy_plane(uint8_t *dst, int dst_wrap,
+ const uint8_t *src, int src_wrap,
+ int width, int height)
+{
+ if((!dst) || (!src))
+ return;
+ for(;height > 0; height--) {
+ memcpy(dst, src, width);
+ dst += dst_wrap;
+ src += src_wrap;
+ }
+}
- return -1;
+#if LIBAVCODEC_VERSION_MAJOR < 53
+int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane)
+{
+ return av_get_image_linesize(pix_fmt, width, plane);
}
+#endif
-void av_picture_copy(AVPicture *dst, const AVPicture *src,
- enum PixelFormat pix_fmt, int width, int height)
+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)
{
int i;
const PixFmtInfo *pf = &pix_fmt_info[pix_fmt];
@@ -837,26 +846,33 @@ void av_picture_copy(AVPicture *dst, const AVPicture *src, case FF_PIXEL_PLANAR:
for(i = 0; i < pf->nb_channels; i++) {
int h;
- int bwidth = ff_get_plane_bytewidth(pix_fmt, width, i);
+ int bwidth = av_get_image_linesize(pix_fmt, width, i);
h = height;
if (i == 1 || i == 2) {
h= -((-height)>>desc->log2_chroma_h);
}
- ff_img_copy_plane(dst->data[i], dst->linesize[i],
- src->data[i], src->linesize[i],
- bwidth, h);
+ ff_img_copy_plane(dst_data[i], dst_linesize[i],
+ src_data[i], src_linesize[i],
+ bwidth, h);
}
break;
case FF_PIXEL_PALETTE:
- ff_img_copy_plane(dst->data[0], dst->linesize[0],
- src->data[0], src->linesize[0],
- width, height);
+ ff_img_copy_plane(dst_data[0], dst_linesize[0],
+ src_data[0], src_linesize[0],
+ width, height);
/* copy the palette */
- memcpy(dst->data[1], src->data[1], 4*256);
+ memcpy(dst_data[1], src_data[1], 4*256);
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 */
void ff_shrink22(uint8_t *dst, int dst_wrap,
const uint8_t *src, int src_wrap,
|