diff options
-rw-r--r-- | sub/img_convert.c | 1 | ||||
-rw-r--r-- | video/filter/vf.c | 2 | ||||
-rw-r--r-- | video/filter/vf_expand.c | 2 | ||||
-rw-r--r-- | video/filter/vf_stereo3d.c | 2 | ||||
-rw-r--r-- | video/filter/vf_sub.c | 1 | ||||
-rw-r--r-- | video/memcpy_pic.h | 76 | ||||
-rw-r--r-- | video/mp_image.c | 48 | ||||
-rw-r--r-- | video/mp_image.h | 5 | ||||
-rw-r--r-- | video/out/bitmap_packer.c | 2 | ||||
-rw-r--r-- | video/out/gl_video.c | 1 | ||||
-rw-r--r-- | video/out/vo_caca.c | 1 | ||||
-rw-r--r-- | video/out/vo_direct3d.c | 1 | ||||
-rw-r--r-- | video/out/vo_opengl.c | 1 | ||||
-rw-r--r-- | video/out/vo_vaapi.c | 1 | ||||
-rw-r--r-- | video/out/vo_wayland.c | 1 | ||||
-rw-r--r-- | video/out/vo_xv.c | 1 |
16 files changed, 53 insertions, 93 deletions
diff --git a/sub/img_convert.c b/sub/img_convert.c index 2094e98086..af2cb92a88 100644 --- a/sub/img_convert.c +++ b/sub/img_convert.c @@ -29,7 +29,6 @@ #include "video/img_format.h" #include "video/mp_image.h" #include "video/sws_utils.h" -#include "video/memcpy_pic.h" struct osd_conv_cache { struct sub_bitmap part[MP_SUB_BB_LIST_MAX]; diff --git a/video/filter/vf.c b/video/filter/vf.c index b308a32e18..a5573cd2a6 100644 --- a/video/filter/vf.c +++ b/video/filter/vf.c @@ -39,8 +39,6 @@ #include "video/mp_image_pool.h" #include "vf.h" -#include "video/memcpy_pic.h" - extern const vf_info_t vf_info_crop; extern const vf_info_t vf_info_expand; extern const vf_info_t vf_info_scale; diff --git a/video/filter/vf_expand.c b/video/filter/vf_expand.c index 4b8e89c88c..db01bd4324 100644 --- a/video/filter/vf_expand.c +++ b/video/filter/vf_expand.c @@ -31,8 +31,6 @@ #include "video/mp_image.h" #include "vf.h" -#include "video/memcpy_pic.h" - #include "options/m_option.h" static struct vf_priv_s { diff --git a/video/filter/vf_stereo3d.c b/video/filter/vf_stereo3d.c index e370f07c24..21a171aeda 100644 --- a/video/filter/vf_stereo3d.c +++ b/video/filter/vf_stereo3d.c @@ -35,8 +35,6 @@ #include "vf.h" #include "options/m_option.h" -#include "video/memcpy_pic.h" - #include "vf_lavfi.h" //==types==// diff --git a/video/filter/vf_sub.c b/video/filter/vf_sub.c index b30448cf9c..9891dd0174 100644 --- a/video/filter/vf_sub.c +++ b/video/filter/vf_sub.c @@ -38,7 +38,6 @@ #include "sub/dec_sub.h" #include "video/sws_utils.h" -#include "video/memcpy_pic.h" #include "options/m_option.h" diff --git a/video/memcpy_pic.h b/video/memcpy_pic.h deleted file mode 100644 index 437324a048..0000000000 --- a/video/memcpy_pic.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with MPlayer; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MPLAYER_FASTMEMCPY_H -#define MPLAYER_FASTMEMCPY_H - -#include <inttypes.h> -#include <string.h> -#include <stddef.h> - -static inline void memcpy_pic(void *dst, const void *src, - int bytesPerLine, int height, - int dstStride, int srcStride) -{ - if (bytesPerLine == dstStride && dstStride == srcStride) { - if (srcStride < 0) { - src = (uint8_t*)src + (height - 1) * srcStride; - dst = (uint8_t*)dst + (height - 1) * dstStride; - srcStride = -srcStride; - } - - memcpy(dst, src, srcStride * height); - } else { - for (int i = 0; i < height; i++) { - memcpy(dst, src, bytesPerLine); - src = (uint8_t*)src + srcStride; - dst = (uint8_t*)dst + dstStride; - } - } -} - -static inline void memset_pic(void *dst, int fill, int bytesPerLine, int height, - int stride) -{ - if (bytesPerLine == stride) { - memset(dst, fill, stride * height); - } else { - for (int i = 0; i < height; i++) { - memset(dst, fill, bytesPerLine); - dst = (uint8_t *)dst + stride; - } - } -} - -static inline void memset16_pic(void *dst, int fill, int unitsPerLine, - int height, int stride) -{ - if (fill == 0) { - memset_pic(dst, 0, unitsPerLine * 2, height, stride); - } else { - for (int i = 0; i < height; i++) { - uint16_t *line = dst; - uint16_t *end = line + unitsPerLine; - while (line < end) - *line++ = fill; - dst = (uint8_t *)dst + stride; - } - } -} - -#endif /* MPLAYER_FASTMEMCPY_H */ diff --git a/video/mp_image.c b/video/mp_image.c index 20e246792d..3280fd86aa 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -35,7 +35,6 @@ #include "img_format.h" #include "mp_image.h" #include "sws_utils.h" -#include "memcpy_pic.h" #include "fmt-conversion.h" #include "video/filter/vf.h" @@ -723,3 +722,50 @@ struct AVFrame *mp_image_to_av_frame_and_unref(struct mp_image *img) talloc_free(new_ref); return frame; } + +void memcpy_pic(void *dst, const void *src, int bytesPerLine, int height, + int dstStride, int srcStride) +{ + if (bytesPerLine == dstStride && dstStride == srcStride) { + if (srcStride < 0) { + src = (uint8_t*)src + (height - 1) * srcStride; + dst = (uint8_t*)dst + (height - 1) * dstStride; + srcStride = -srcStride; + } + + memcpy(dst, src, srcStride * height); + } else { + for (int i = 0; i < height; i++) { + memcpy(dst, src, bytesPerLine); + src = (uint8_t*)src + srcStride; + dst = (uint8_t*)dst + dstStride; + } + } +} + +void memset_pic(void *dst, int fill, int bytesPerLine, int height, int stride) +{ + if (bytesPerLine == stride) { + memset(dst, fill, stride * height); + } else { + for (int i = 0; i < height; i++) { + memset(dst, fill, bytesPerLine); + dst = (uint8_t *)dst + stride; + } + } +} + +void memset16_pic(void *dst, int fill, int unitsPerLine, int height, int stride) +{ + if (fill == 0) { + memset_pic(dst, 0, unitsPerLine * 2, height, stride); + } else { + for (int i = 0; i < height; i++) { + uint16_t *line = dst; + uint16_t *end = line + unitsPerLine; + while (line < end) + *line++ = fill; + dst = (uint8_t *)dst + stride; + } + } +} diff --git a/video/mp_image.h b/video/mp_image.h index 7346fb73c3..70931ffb55 100644 --- a/video/mp_image.h +++ b/video/mp_image.h @@ -158,4 +158,9 @@ void mp_image_copy_fields_to_av_frame(struct AVFrame *dst, struct mp_image *mp_image_from_av_frame(struct AVFrame *av_frame); struct AVFrame *mp_image_to_av_frame_and_unref(struct mp_image *img); +void memcpy_pic(void *dst, const void *src, int bytesPerLine, int height, + int dstStride, int srcStride); +void memset_pic(void *dst, int fill, int bytesPerLine, int height, int stride); +void memset16_pic(void *dst, int fill, int unitsPerLine, int height, int stride); + #endif /* MPLAYER_MP_IMAGE_H */ diff --git a/video/out/bitmap_packer.c b/video/out/bitmap_packer.c index 747693b089..5fdb1f1bd2 100644 --- a/video/out/bitmap_packer.c +++ b/video/out/bitmap_packer.c @@ -29,7 +29,7 @@ #include "bitmap_packer.h" #include "common/common.h" #include "sub/dec_sub.h" -#include "video/memcpy_pic.h" +#include "video/mp_image.h" #define IS_POWER_OF_2(x) (((x) > 0) && !(((x) - 1) & (x))) diff --git a/video/out/gl_video.c b/video/out/gl_video.c index 801a9ac58f..7d92b47223 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -37,7 +37,6 @@ #include "gl_osd.h" #include "filter_kernels.h" #include "aspect.h" -#include "video/memcpy_pic.h" #include "bitmap_packer.h" #include "dither.h" diff --git a/video/out/vo_caca.c b/video/out/vo_caca.c index d9e478e055..a6a6cb9506 100644 --- a/video/out/vo_caca.c +++ b/video/out/vo_caca.c @@ -37,7 +37,6 @@ #include "config.h" #include "vo.h" #include "video/mp_image.h" -#include "video/memcpy_pic.h" #include "input/keycodes.h" #include "input/input.h" diff --git a/video/out/vo_direct3d.c b/video/out/vo_direct3d.c index b6e40e75ec..8f9b10260d 100644 --- a/video/out/vo_direct3d.c +++ b/video/out/vo_direct3d.c @@ -35,7 +35,6 @@ #include "video/csputils.h" #include "video/mp_image.h" #include "video/img_format.h" -#include "video/memcpy_pic.h" #include "common/msg.h" #include "common/common.h" #include "w32_common.h" diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c index 3abd1d3320..0fb4895f99 100644 --- a/video/out/vo_opengl.c +++ b/video/out/vo_opengl.c @@ -48,7 +48,6 @@ #include "gl_hwdec.h" #include "gl_osd.h" #include "filter_kernels.h" -#include "video/memcpy_pic.h" #include "video/hwdec.h" #include "gl_video.h" #include "gl_lcms.h" diff --git a/video/out/vo_vaapi.c b/video/out/vo_vaapi.c index 31479ff41b..6422148a0f 100644 --- a/video/out/vo_vaapi.c +++ b/video/out/vo_vaapi.c @@ -32,7 +32,6 @@ #include "config.h" #include "common/msg.h" #include "video/out/vo.h" -#include "video/memcpy_pic.h" #include "video/mp_image_pool.h" #include "sub/osd.h" #include "sub/img_convert.h" diff --git a/video/out/vo_wayland.c b/video/out/vo_wayland.c index c179bbe179..5fb4dc60bd 100644 --- a/video/out/vo_wayland.c +++ b/video/out/vo_wayland.c @@ -27,7 +27,6 @@ #include "vo.h" #include "video/mp_image.h" #include "video/sws_utils.h" -#include "video/memcpy_pic.h" #include "sub/osd.h" #include "sub/img_convert.h" #include "common/msg.h" diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c index 654f657ca3..e74a8a406a 100644 --- a/video/out/vo_xv.c +++ b/video/out/vo_xv.c @@ -51,7 +51,6 @@ #include "video/mp_image.h" #include "video/img_fourcc.h" #include "x11_common.h" -#include "video/memcpy_pic.h" #include "sub/osd.h" #include "sub/draw_bmp.h" #include "video/csputils.h" |