[FFmpeg-cvslog] avcodec/proresenc_aw : merge funcs subimage_with_fill and subimage_alpha_with_fill
Martin Vignali
git at videolan.org
Sat Feb 23 14:23:19 EET 2019
ffmpeg | branch: master | Martin Vignali <martin.vignali at gmail.com> | Sat Feb 9 18:25:31 2019 +0100| [e7cbbb7374c63a4d67c3600b9de2dfae4a952007] | committer: Martin Vignali
avcodec/proresenc_aw : merge funcs subimage_with_fill and subimage_alpha_with_fill
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e7cbbb7374c63a4d67c3600b9de2dfae4a952007
---
libavcodec/proresenc_anatoliy.c | 50 +++++++++++++++++------------------------
1 file changed, 21 insertions(+), 29 deletions(-)
diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index 57d9d9ac34..e72ec94bad 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -468,11 +468,10 @@ static av_always_inline int encode_alpha_slice_data(AVCodecContext *avctx, int8_
}
}
-static void subimage_with_fill(uint16_t *src, unsigned x, unsigned y,
- unsigned stride, unsigned width, unsigned height, uint16_t *dst,
- unsigned dst_width, unsigned dst_height)
+static inline void subimage_with_fill_template(uint16_t *src, unsigned x, unsigned y,
+ unsigned stride, unsigned width, unsigned height, uint16_t *dst,
+ unsigned dst_width, unsigned dst_height, int is_alpha_plane)
{
-
int box_width = FFMIN(width - x, dst_width);
int box_height = FFMIN(height - y, dst_height);
int i, j, src_stride = stride >> 1;
@@ -481,9 +480,17 @@ static void subimage_with_fill(uint16_t *src, unsigned x, unsigned y,
src += y * src_stride + x;
for (i = 0; i < box_height; ++i) {
for (j = 0; j < box_width; ++j) {
- dst[j] = src[j];
+ if (!is_alpha_plane) {
+ dst[j] = src[j];
+ } else {
+ dst[j] = src[j] << 6; /* alpha 10b to 16b */
+ }
+ }
+ if (!is_alpha_plane) {
+ last_pix = dst[j - 1];
+ } else {
+ last_pix = dst[j - 1] << 6; /* alpha 10b to 16b */
}
- last_pix = dst[j - 1];
for (; j < dst_width; j++)
dst[j] = last_pix;
src += src_stride;
@@ -498,34 +505,19 @@ static void subimage_with_fill(uint16_t *src, unsigned x, unsigned y,
}
}
+static void subimage_with_fill(uint16_t *src, unsigned x, unsigned y,
+ unsigned stride, unsigned width, unsigned height, uint16_t *dst,
+ unsigned dst_width, unsigned dst_height)
+{
+ subimage_with_fill_template(src, x, y, stride, width, height, dst, dst_width, dst_height, 0);
+}
+
/* reorganize alpha data and convert 10b -> 16b */
static void subimage_alpha_with_fill(uint16_t *src, unsigned x, unsigned y,
unsigned stride, unsigned width, unsigned height, uint16_t *dst,
unsigned dst_width, unsigned dst_height)
{
- int box_width = FFMIN(width - x, dst_width);
- int box_height = FFMIN(height - y, dst_height);
- int i, j, src_stride = stride >> 1;
- uint16_t last_pix, *last_line;
-
- src += y * src_stride + x;
- for (i = 0; i < box_height; ++i) {
- for (j = 0; j < box_width; ++j) {
- dst[j] = src[j] << 6; /* 10b to 16b */
- }
- last_pix = dst[j - 1] << 6; /* 10b to 16b */
- for (; j < dst_width; j++)
- dst[j] = last_pix;
- src += src_stride;
- dst += dst_width;
- }
- last_line = dst - dst_width;
- for (; i < dst_height; i++) {
- for (j = 0; j < dst_width; ++j) {
- dst[j] = last_line[j];
- }
- dst += dst_width;
- }
+ subimage_with_fill_template(src, x, y, stride, width, height, dst, dst_width, dst_height, 1);
}
static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, int mb_x,
More information about the ffmpeg-cvslog
mailing list