diff options
author | John Koleszar <jkoleszar@google.com> | 2011-02-17 06:59:48 -0500 |
---|---|---|
committer | John Koleszar <jkoleszar@google.com> | 2011-02-18 09:09:49 -0500 |
commit | cbf923b12cec2fe7ceea0b94091d64953e56b1fe (patch) | |
tree | 20509d6aa1e7a569131fc544ac3f11eb34000e48 /vpx_scale | |
parent | 562f1470ceed6c7d122e61dc5ca63300ab312830 (diff) | |
download | libvpx-cbf923b12cec2fe7ceea0b94091d64953e56b1fe.tar libvpx-cbf923b12cec2fe7ceea0b94091d64953e56b1fe.tar.gz libvpx-cbf923b12cec2fe7ceea0b94091d64953e56b1fe.tar.bz2 libvpx-cbf923b12cec2fe7ceea0b94091d64953e56b1fe.zip |
clean up unused files
Removed a number of files that were unused or little-used.
Change-Id: If9ae5e5b11390077581a9a879e8a0defe709f5da
Diffstat (limited to 'vpx_scale')
-rw-r--r-- | vpx_scale/blackfin/yv12config.c | 117 | ||||
-rw-r--r-- | vpx_scale/blackfin/yv12extend.c | 350 | ||||
-rw-r--r-- | vpx_scale/dm642/bicubic_scaler_c64.c | 194 | ||||
-rw-r--r-- | vpx_scale/dm642/gen_scalers_c64.c | 608 | ||||
-rw-r--r-- | vpx_scale/dm642/yv12extend.c | 446 | ||||
-rw-r--r-- | vpx_scale/include/leapster/vpxscale.h | 62 | ||||
-rw-r--r-- | vpx_scale/intel_linux/scaleopt.c | 1853 | ||||
-rw-r--r-- | vpx_scale/intel_linux/scalesystemdependant.c | 91 | ||||
-rw-r--r-- | vpx_scale/leapster/doptsystemdependant_lf.c | 72 | ||||
-rw-r--r-- | vpx_scale/leapster/gen_scalers_lf.c | 522 | ||||
-rw-r--r-- | vpx_scale/leapster/vpxscale_lf.c | 891 | ||||
-rw-r--r-- | vpx_scale/leapster/yv12extend.c | 232 | ||||
-rw-r--r-- | vpx_scale/symbian/gen_scalers_armv4.asm | 774 | ||||
-rw-r--r-- | vpx_scale/symbian/gen_scalers_armv4.s | 808 | ||||
-rw-r--r-- | vpx_scale/symbian/scalesystemdependant.c | 58 | ||||
-rw-r--r-- | vpx_scale/wce/gen_scalers_armv4.asm | 774 | ||||
-rw-r--r-- | vpx_scale/wce/scalesystemdependant.c | 60 | ||||
-rw-r--r-- | vpx_scale/x86_64/scaleopt.c | 1750 | ||||
-rw-r--r-- | vpx_scale/x86_64/scalesystemdependant.c | 61 |
19 files changed, 0 insertions, 9723 deletions
diff --git a/vpx_scale/blackfin/yv12config.c b/vpx_scale/blackfin/yv12config.c deleted file mode 100644 index c40420296..000000000 --- a/vpx_scale/blackfin/yv12config.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/**************************************************************************** - * - * Module Title : yv12config.c - * - * Description : - * - ***************************************************************************/ - -/**************************************************************************** -* Header Files -****************************************************************************/ -#include "vpx_scale/yv12config.h" -#include "vpx_mem/vpx_mem.h" - -#include <cdef_bf533.h> - -/**************************************************************************** -* Imports -****************************************************************************/ -void -extend_memset(void *dst, unsigned char value, unsigned int size); - -/**************************************************************************** - * - ****************************************************************************/ -int -vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf) -{ - if (ybf) - { - duck_free(ybf->buffer_alloc); - - ybf->buffer_alloc = 0; - } - else - { - return -1; - } - - return 0; -} - -/**************************************************************************** - * - ****************************************************************************/ -int -vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, int border) -{ -//NOTE: - - int yplane_size = (height + 2 * border) * (width + 2 * border); - int uvplane_size = (height / 2 + border) * (width / 2 + border); - - if (ybf) - { - vp8_yv12_de_alloc_frame_buffer(ybf); - - ybf->y_width = width; - ybf->y_height = height; - ybf->y_stride = width + 2 * border; - - ybf->uv_width = width / 2; - ybf->uv_height = height / 2; - ybf->uv_stride = ybf->uv_width + border; - - ybf->border = border; - - // Added 2 extra lines to framebuffer so that copy12x12 doesn't fail - // when we have a large motion vector in V on the last v block. - // Note : We never use these pixels anyway so this doesn't hurt. - ybf->buffer_alloc = (unsigned char *) duck_memalign(32, (yplane_size * 3 / 2) + ybf->y_stride , 0); - - if (ybf->buffer_alloc == NULL) - return -1; - - ybf->y_buffer = ybf->buffer_alloc + border * ybf->y_stride + border; - ybf->u_buffer = ybf->buffer_alloc + yplane_size + border / 2 * ybf->uv_stride + border / 2; - ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size + border / 2 * ybf->uv_stride + border / 2; - } - else - { - return -2; - } - - return 0; -} -/**************************************************************************** - * - ****************************************************************************/ -int -vp8_yv12_black_frame_buffer(YV12_BUFFER_CONFIG *ybf) -{ - if (ybf) - { - if (ybf->buffer_alloc) - { - extend_memset(ybf->y_buffer, 0x0, ybf->y_stride *(ybf->y_height + 2 * ybf->border)); - extend_memset(ybf->u_buffer, 0x80, ybf->uv_stride *(ybf->uv_height + ybf->border)); - extend_memset(ybf->v_buffer, 0x80, ybf->uv_stride *(ybf->uv_height + ybf->border)); - } - - return 0; - } - - return -1; -} diff --git a/vpx_scale/blackfin/yv12extend.c b/vpx_scale/blackfin/yv12extend.c deleted file mode 100644 index cfd3de050..000000000 --- a/vpx_scale/blackfin/yv12extend.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/**************************************************************************** - * - * Module Title : yv12extend.c - * - * Description : - * - ***************************************************************************/ - -/**************************************************************************** -* Header Files -****************************************************************************/ -#include <cdef_bf533.h> - -#include "vpx_scale/yv12config.h" -#include "vpx_mem/vpx_mem.h" - -/**************************************************************************** -* -****************************************************************************/ - - -/**************************************************************************** -* -****************************************************************************/ -void -extend_memset(void *dst, unsigned char value, unsigned int size) -{ -#if 0 - unsigned int quad_value; - - quad_value = (unsigned int) value; - quad_value |= (unsigned int) value << 8; - quad_value |= (unsigned int) value << 16; - quad_value |= (unsigned int) value << 24; -#else - unsigned short quad_value; - - quad_value = (unsigned int) value; - quad_value |= (unsigned int) value << 8; -#endif - - - if (size / 2 >= 64 * 1024) - printf("_Extend_memset__________ dma memset is broken\n"); - - *p_mdma_s1_start_addr = &quad_value; - *p_mdma_s1_x_count = size / 2; - *p_mdma_s1_x_modify = 0x0; - *p_mdma_d1_start_addr = dst; - *p_mdma_d1_x_count = size / 2; - *p_mdma_d1_x_modify = 2; - - *p_mdma_s1_config = DMAEN | WDSIZE_16; - asm("ssync;"); - - *p_mdma_d1_config = DI_EN | DMAEN | WNR | WDSIZE_16; - asm("ssync;"); - - while ((*p_mdma_d1_irq_status & DMA_DONE) == 0); - - *p_mdma_d1_irq_status |= DMA_DONE; -} - -/**************************************************************************** -* -****************************************************************************/ -void -extend_memcpy(void *dst, void *src, unsigned int size) -{ - if (size / 2 >= 64 * 1024) - printf("_Extend_memcpy__________ dma memcpy is broken\n"); - - - if ((size & 0x3)) - printf("_)__________ size not a multiple of 4\n"); - -//32 bit dma here caused some data to be corrupted --- WHY ?????? - - *p_mdma_s1_start_addr = src; - *p_mdma_s1_x_count = size / 2; - *p_mdma_s1_x_modify = 2; - *p_mdma_d1_start_addr = dst; - *p_mdma_d1_x_count = size / 2; - *p_mdma_d1_x_modify = 2; - - *p_mdma_s1_config = DMAEN | WDSIZE_16; - asm("ssync;"); - - *p_mdma_d1_config = DI_EN | DMAEN | WNR | WDSIZE_16; - asm("ssync;"); - - while ((*p_mdma_d1_irq_status & DMA_DONE) == 0); - - *p_mdma_d1_irq_status |= DMA_DONE; -} - -/**************************************************************************** - * - ****************************************************************************/ -void -vp8_yv12_extend_frame_borders(YV12_BUFFER_CONFIG *ybf) -{ -#if 1 - int i; - unsigned char *src_ptr1, *src_ptr2; - unsigned char *dest_ptr1, *dest_ptr2; - - unsigned int Border; - int plane_stride; - int plane_height; - int plane_width; - - unsigned int quad_sample; - unsigned int sample; - - /***********/ - /* Y Plane */ - /***********/ - Border = ybf->border; - plane_stride = ybf->y_stride; - plane_height = ybf->y_height; - plane_width = ybf->y_width; - - // copy the left and right most columns out - src_ptr1 = ybf->y_buffer; - src_ptr2 = src_ptr1 + plane_width - 1; - dest_ptr1 = src_ptr1 - Border; - dest_ptr2 = src_ptr2 + 1; - - for (i = 0; i < plane_height; i++) - { - extend_memset(dest_ptr1, src_ptr1[0], Border); - extend_memset(dest_ptr2, src_ptr2[0], Border); - src_ptr1 += plane_stride; - src_ptr2 += plane_stride; - dest_ptr1 += plane_stride; - dest_ptr2 += plane_stride; - } - - // Now copy the top and bottom source lines into each line of the respective borders - src_ptr1 = ybf->y_buffer - Border; - src_ptr2 = src_ptr1 + (plane_height * plane_stride) - plane_stride; - dest_ptr1 = src_ptr1 - (Border * plane_stride); - dest_ptr2 = src_ptr2 + plane_stride; - - for (i = 0; i < (int)Border; i++) - { - extend_memcpy(dest_ptr1, src_ptr1, plane_stride); - dest_ptr1 += plane_stride; - } - - for (i = 0; i < (int)Border; i++) - { - extend_memcpy(dest_ptr2, src_ptr2, plane_stride); - dest_ptr2 += plane_stride; - } - - plane_stride /= 2; - plane_height /= 2; - plane_width /= 2; - Border /= 2; - - /***********/ - /* U Plane */ - /***********/ - - // copy the left and right most columns out - src_ptr1 = ybf->u_buffer; - src_ptr2 = src_ptr1 + plane_width - 1; - dest_ptr1 = src_ptr1 - Border; - dest_ptr2 = src_ptr2 + 1; - - for (i = 0; i < plane_height; i++) - { - extend_memset(dest_ptr1, src_ptr1[0], Border); - extend_memset(dest_ptr2, src_ptr2[0], Border); - src_ptr1 += plane_stride; - src_ptr2 += plane_stride; - dest_ptr1 += plane_stride; - dest_ptr2 += plane_stride; - } - - // Now copy the top and bottom source lines into each line of the respective borders - src_ptr1 = ybf->u_buffer - Border; - src_ptr2 = src_ptr1 + (plane_height * plane_stride) - plane_stride; - dest_ptr1 = src_ptr1 - (Border * plane_stride); - dest_ptr2 = src_ptr2 + plane_stride; - - for (i = 0; i < (int)(Border); i++) - { - extend_memcpy(dest_ptr1, src_ptr1, plane_stride); - dest_ptr1 += plane_stride; - } - - for (i = 0; i < (int)(Border); i++) - { - extend_memcpy(dest_ptr2, src_ptr2, plane_stride); - dest_ptr2 += plane_stride; - } - - /***********/ - /* V Plane */ - /***********/ - - // copy the left and right most columns out - src_ptr1 = ybf->v_buffer; - src_ptr2 = src_ptr1 + plane_width - 1; - dest_ptr1 = src_ptr1 - Border; - dest_ptr2 = src_ptr2 + 1; - - for (i = 0; i < plane_height; i++) - { - extend_memset(dest_ptr1, src_ptr1[0], Border); - extend_memset(dest_ptr2, src_ptr2[0], Border); - src_ptr1 += plane_stride; - src_ptr2 += plane_stride; - dest_ptr1 += plane_stride; - dest_ptr2 += plane_stride; - } - - // Now copy the top and bottom source lines into each line of the respective borders - src_ptr1 = ybf->v_buffer - Border; - src_ptr2 = src_ptr1 + (plane_height * plane_stride) - plane_stride; - dest_ptr1 = src_ptr1 - (Border * plane_stride); - dest_ptr2 = src_ptr2 + plane_stride; - - for (i = 0; i < (int)(Border); i++) - { - extend_memcpy(dest_ptr1, src_ptr1, plane_stride); - dest_ptr1 += plane_stride; - } - - for (i = 0; i < (int)(Border); i++) - { - extend_memcpy(dest_ptr2, src_ptr2, plane_stride); - dest_ptr2 += plane_stride; - } - -#endif -} -/**************************************************************************** - * - * ROUTINE : vp8_yv12_copy_frame - * - * INPUTS : - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Copies the source image into the destination image and - * updates the destination's UMV borders. - * - * SPECIAL NOTES : The frames are assumed to be identical in size. - * - ****************************************************************************/ -void -vp8_yv12_copy_frame(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc) -{ -#if 1 - int row; - unsigned char *source, *dest; - - source = src_ybc->y_buffer; - dest = dst_ybc->y_buffer; - - for (row = 0; row < src_ybc->y_height; row++) - { - extend_memcpy(dest, source, src_ybc->y_width); - source += src_ybc->y_stride; - dest += dst_ybc->y_stride; - } - - source = src_ybc->u_buffer; - dest = dst_ybc->u_buffer; - - for (row = 0; row < src_ybc->uv_height; row++) - { - extend_memcpy(dest, source, src_ybc->uv_width); - source += src_ybc->uv_stride; - dest += dst_ybc->uv_stride; - } - - source = src_ybc->v_buffer; - dest = dst_ybc->v_buffer; - - for (row = 0; row < src_ybc->uv_height; row++) - { - extend_memcpy(dest, source, src_ybc->uv_width); - source += src_ybc->uv_stride; - dest += dst_ybc->uv_stride; - } - - vp8_yv12_extend_frame_borders(dst_ybc); - -#else - int row; - char *source, *dest; - int height; - int width; - - height = src_ybc->y_height + (src_ybc->border * 2); - width = src_ybc->y_width + (src_ybc->border * 2); - source = src_ybc->y_buffer; - dest = dst_ybc->y_buffer; - - for (row = 0; row < height; row++) - { - extend_memcpy(dest, source, width); - source += src_ybc->y_stride; - dest += dst_ybc->y_stride; - } - - height = src_ybc->uv_height + (src_ybc->border); - width = src_ybc->uv_width + (src_ybc->border); - - source = src_ybc->u_buffer; - dest = dst_ybc->u_buffer; - - for (row = 0; row < height; row++) - { - extend_memcpy(dest, source, width); - source += src_ybc->uv_stride; - dest += dst_ybc->uv_stride; - } - - source = src_ybc->v_buffer; - dest = dst_ybc->v_buffer; - - for (row = 0; row < height; row++) - { - extend_memcpy(dest, source, width); - source += src_ybc->uv_stride; - dest += dst_ybc->uv_stride; - } - -#endif - -} diff --git a/vpx_scale/dm642/bicubic_scaler_c64.c b/vpx_scale/dm642/bicubic_scaler_c64.c deleted file mode 100644 index 5166ace85..000000000 --- a/vpx_scale/dm642/bicubic_scaler_c64.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -#include <float.h> -#include <math.h> -#include <stdio.h> -#include "vpx_mem/vpx_mem.h" -#include "vpxscale_arbitrary.h" - -extern BICUBIC_SCALER_STRUCT g_b_scaler; - -int bicubic_scale_c64(int in_width, int in_height, int in_stride, - int out_width, int out_height, int out_stride, - unsigned char *input_image, unsigned char *output_image) -{ - short *restrict l_w, * restrict l_h; - short *restrict c_w, * restrict c_h; - unsigned char *restrict ip, * restrict op, *restrict op_w; - unsigned char *restrict hbuf; - int h, w, lw, lh; - int phase_offset_w, phase_offset_h; - double coeff; - int max_phase; - - c_w = g_b_scaler.c_w; - c_h = g_b_scaler.c_h; - - op = output_image; - - l_w = g_b_scaler.l_w; - l_h = g_b_scaler.l_h; - - phase_offset_h = 0; - - for (h = 0; h < out_height; h++) - { - // select the row to work on - lh = l_h[h]; - ip = input_image + (in_stride * lh); - - coeff = _memd8_const(&c_h[phase_offset_h*4]); - - // vp8_filter the row vertically into an temporary buffer. - // If the phase offset == 0 then all the multiplication - // is going to result in the output equalling the input. - // So instead point the temporary buffer to the input. - // Also handle the boundry condition of not being able to - // filter that last lines. - if (phase_offset_h && (lh < in_height - 2)) - { - hbuf = g_b_scaler.hbuf; - - for (w = 0; w < in_width; w += 4) - { - int ip1, ip2, ip3, ip4; - int y13_12, y11_10, y23_22, y21_20, y33_32, y31_30, y43_42, y41_40; - int y10_20, y11_21, y12_22, y13_23, y30_40, y31_41, y32_42, y33_43; - int s1, s2, s3, s4; - - ip1 = _mem4_const(&ip[w - in_stride]); - ip2 = _mem4_const(&ip[w]); - ip3 = _mem4_const(&ip[w + in_stride]); - ip4 = _mem4_const(&ip[w + 2*in_stride]); - - // realignment of data. Unpack the data so that it is in short - // format instead of bytes. - y13_12 = _unpkhu4(ip1); - y11_10 = _unpklu4(ip1); - y23_22 = _unpkhu4(ip2); - y21_20 = _unpklu4(ip2); - y33_32 = _unpkhu4(ip3); - y31_30 = _unpklu4(ip3); - y43_42 = _unpkhu4(ip4); - y41_40 = _unpklu4(ip4); - - // repack the data so that elements 1 and 2 are together. this - // lines up so that a dot product with the coefficients can be - // done. - y10_20 = _pack2(y11_10, y21_20); - y11_21 = _packh2(y11_10, y21_20); - y12_22 = _pack2(y13_12, y23_22); - y13_23 = _packh2(y13_12, y23_22); - - s1 = _dotp2(_hi(coeff), y10_20); - s2 = _dotp2(_hi(coeff), y11_21); - s3 = _dotp2(_hi(coeff), y12_22); - s4 = _dotp2(_hi(coeff), y13_23); - - y30_40 = _pack2(y31_30, y41_40); - y31_41 = _packh2(y31_30, y41_40); - y32_42 = _pack2(y33_32, y43_42); - y33_43 = _packh2(y33_32, y43_42); - - // now repack elements 3 and 4 together. - s1 += _dotp2(_lo(coeff), y30_40); - s2 += _dotp2(_lo(coeff), y31_41); - s3 += _dotp2(_lo(coeff), y32_42); - s4 += _dotp2(_lo(coeff), y33_43); - - s1 = s1 >> 12; - s2 = s2 >> 12; - s3 = s3 >> 12; - s4 = s4 >> 12; - - s1 = _pack2(s2, s1); - s2 = _pack2(s4, s3); - - _amem4(&hbuf[w]) = _spacku4(s2, s1); - } - } - else - hbuf = ip; - - // increase the phase offset for the next time around. - if (++phase_offset_h >= g_b_scaler.nh) - phase_offset_h = 0; - - op_w = op; - - // will never be able to interpolate first pixel, so just copy it - // over here. - phase_offset_w = 1; - *op_w++ = hbuf[0]; - - if (1 >= g_b_scaler.nw) phase_offset_w = 0; - - max_phase = g_b_scaler.nw; - - for (w = 1; w < out_width; w++) - { - double coefficients; - int hbuf_high, hbuf_low, hbuf_both; - int sum_high, sum_low, sum; - - // get the index to use to expand the image - lw = l_w[w]; - coefficients = _amemd8_const(&c_w[phase_offset_w*4]); - hbuf_both = _mem4_const(&hbuf[lw-1]); - - hbuf_high = _unpkhu4(hbuf_both); - hbuf_low = _unpklu4(hbuf_both); - - sum_high = _dotp2(_hi(coefficients), hbuf_high); - sum_low = _dotp2(_lo(coefficients), hbuf_low); - - sum = (sum_high + sum_low) >> 12; - - if (++phase_offset_w >= max_phase) - phase_offset_w = 0; - - if ((lw + 2) >= in_width) - sum = hbuf[lw]; - - *op_w++ = sum; - } - - op += out_stride; - } - - return 0; -} - -void bicubic_scale_frame_c64(YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, - int new_width, int new_height) -{ - - dst->y_width = new_width; - dst->y_height = new_height; - dst->uv_width = new_width / 2; - dst->uv_height = new_height / 2; - - dst->y_stride = dst->y_width; - dst->uv_stride = dst->uv_width; - - bicubic_scale_c64(src->y_width, src->y_height, src->y_stride, - new_width, new_height, dst->y_stride, - src->y_buffer, dst->y_buffer); - - bicubic_scale_c64(src->uv_width, src->uv_height, src->uv_stride, - new_width / 2, new_height / 2, dst->uv_stride, - src->u_buffer, dst->u_buffer); - - bicubic_scale_c64(src->uv_width, src->uv_height, src->uv_stride, - new_width / 2, new_height / 2, dst->uv_stride, - src->v_buffer, dst->v_buffer); -} diff --git a/vpx_scale/dm642/gen_scalers_c64.c b/vpx_scale/dm642/gen_scalers_c64.c deleted file mode 100644 index 87ff998d3..000000000 --- a/vpx_scale/dm642/gen_scalers_c64.c +++ /dev/null @@ -1,608 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/**************************************************************************** - * - * Module Title : gen_scalers.c - * - * Description : Generic image scaling functions. - * - ***************************************************************************/ - -/**************************************************************************** -* Header Files -****************************************************************************/ -#include "vpx_scale/vpxscale.h" - -/**************************************************************************** -* Imports -****************************************************************************/ - -/**************************************************************************** - * - * ROUTINE : horizontal_line_4_5_scale_c4 - * - * INPUTS : const unsigned char *source : Pointer to source data. - * unsigned int source_width : Stride of source. - * unsigned char *dest : Pointer to destination data. - * unsigned int dest_width : Stride of destination (NOT USED). - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Copies horizontal line of pixels from source to - * destination scaling up by 4 to 5. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -static -void horizontal_line_4_5_scale_c64 -( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - unsigned i; - unsigned int ba, cb, dc, ed; - unsigned char *restrict des = dest; - unsigned int *restrict src = (unsigned int *)source; - unsigned int const_51_205, const_102_154, - const_205_51, const_154_102; - - unsigned int src_current, src_next; - - (void) dest_width; - - // Constants that are to be used for the filtering. For - // best speed we are going to want to right shift by 16. - // In the generic version they were shift by 8, so put - // an extra 8 in now so that 16 will come out later. - const_51_205 = 0x3300CD00; //_pack2 (51 << 8, 205 << 8); - const_205_51 = 0xCD003300; //_pack2 (205 << 8, 51 << 8); - const_102_154 = 0x66009A00; //_pack2 (102 << 8, 154 << 8); - const_154_102 = 0x9A006600; //_pack2 (154 << 8, 102 << 8); - - // 5 points are needed to filter to give 5 output points. - // A load can pull up 4 at a time, and one needs to be - // "borrowed" from the next set of data. So instead of - // loading those 5 points each time, "steal" a point from - // the next set and only load up 4 each time through. - src_current = _mem4(src); - - for (i = 0; i < source_width - 4; i += 4) - { - src_next = _mem4(src++); - - // Reorder the data so that it is ready for the - // dot product. - ba = _unpklu4(src_current); - cb = _unpkhu4(_rotl(src_current, 8)); - dc = _unpkhu4(src_current); - ed = _unpkhu4(_shrmb(src_next, src_current)); - - // Use the dot product with round and shift. - des [0] = src_current & 0xff; - des [1] = _dotprsu2(ba, const_205_51); - des [2] = _dotprsu2(cb, const_154_102); - des [3] = _dotprsu2(dc, const_102_154); - des [4] = _dotprsu2(ed, const_51_205); - - des += 5; - - // reuse loaded vales next time around. - src_current = src_next; - } - - // vp8_filter the last set of points. Normally a point from the next set - // would be used, but there is no next set, so just fill. - ba = _unpklu4(src_current); - cb = _unpkhu4(_rotl(src_current, 8)); - dc = _unpkhu4(src_current); - - des [0] = src_current & 0xff; - des [1] = _dotprsu2(ba, const_205_51); - des [2] = _dotprsu2(cb, const_154_102); - des [3] = _dotprsu2(dc, const_102_154); - des [4] = src_current & 0xff; - -} -/**************************************************************************** - * - * ROUTINE : vertical_band_4_5_scale_c64 - * - * INPUTS : unsigned char *dest : Pointer to destination data. - * unsigned int dest_pitch : Stride of destination data. - * unsigned int dest_width : Width of destination data. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Scales vertical band of pixels by scale 4 to 5. The - * height of the band scaled is 4-pixels. - * - * SPECIAL NOTES : The routine uses the first line of the band below - * the current band. - * - ****************************************************************************/ -static -void vertical_band_4_5_scale_c64(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) -{ - unsigned int i; - unsigned int a, b, c, d, e; - unsigned int ba, cb, dc, ed; - unsigned char *restrict src = dest; - unsigned char *restrict des = dest; - unsigned int const_51_205, const_102_154, - const_205_51, const_154_102; - - const_51_205 = 0x3300CD00; //_pack2 (51 << 8, 205 << 8); - const_205_51 = 0xCD003300; //_pack2 (205 << 8, 51 << 8); - const_102_154 = 0x66009A00; //_pack2 (102 << 8, 154 << 8); - const_154_102 = 0x9A006600; //_pack2 (154 << 8, 102 << 8); - - // Force a loop unroll here so that there is not such a - // dependancy. - a = src [0]; - b = src [dest_pitch]; - c = src [dest_pitch*2]; - d = src [dest_pitch*3]; - e = src [dest_pitch*5]; - src ++; - - for (i = 0; i < dest_width; i++) - { - ba = _pack2(b, a); - cb = _pack2(c, b); - dc = _pack2(d, c); - ed = _pack2(e, d); - - a = src [0]; - b = src [dest_pitch]; - c = src [dest_pitch*2]; - d = src [dest_pitch*3]; - e = src [dest_pitch*5]; - src ++; - - des [dest_pitch] = _dotprsu2(ba, const_205_51); - des [dest_pitch*2] = _dotprsu2(cb, const_154_102); - des [dest_pitch*3] = _dotprsu2(dc, const_102_154); - des [dest_pitch*4] = _dotprsu2(ed, const_51_205); - - des ++; - } -} - -/**************************************************************************** - * - * ROUTINE : last_vertical_band_4_5_scale_c64 - * - * INPUTS : unsigned char *dest : Pointer to destination data. - * unsigned int dest_pitch : Stride of destination data. - * unsigned int dest_width : Width of destination data. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Scales last vertical band of pixels by scale 4 to 5. The - * height of the band scaled is 4-pixels. - * - * SPECIAL NOTES : The routine does not have available the first line of - * the band below the current band, since this is the - * last band. - * - ****************************************************************************/ -static -void last_vertical_band_4_5_scale_c64(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) -{ - unsigned int i; - unsigned int a, b, c, d; - unsigned int ba, cb, dc; - unsigned char *restrict src = dest; - unsigned char *restrict des = dest; - unsigned int const_102_154, const_205_51, const_154_102; - - const_205_51 = 0xCD003300; //_pack2 (205 << 8, 51 << 8); - const_102_154 = 0x66009A00; //_pack2 (102 << 8, 154 << 8); - const_154_102 = 0x9A006600; //_pack2 (154 << 8, 102 << 8); - - a = src [0]; - b = src [dest_pitch]; - c = src [dest_pitch*2]; - d = src [dest_pitch*3]; - src ++; - - for (i = 0; i < dest_width; ++i) - { - ba = _pack2(b, a); - cb = _pack2(c, b); - dc = _pack2(d, c); - - a = src [0]; - b = src [dest_pitch]; - c = src [dest_pitch*2]; - d = src [dest_pitch*3]; - src ++; - - des [dest_pitch] = _dotprsu2(ba, const_205_51); - des [dest_pitch*2] = _dotprsu2(cb, const_154_102); - des [dest_pitch*3] = _dotprsu2(dc, const_102_154); - des [dest_pitch*4] = (unsigned char) d; - - des++; - } -} - -/**************************************************************************** - * - * ROUTINE : horizontal_line_3_5_scale_c64 - * - * INPUTS : const unsigned char *source : Pointer to source data. - * unsigned int source_width : Stride of source. - * unsigned char *dest : Pointer to destination data. - * unsigned int dest_width : Stride of destination (NOT USED). - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Copies horizontal line of pixels from source to - * destination scaling up by 3 to 5. - * - * SPECIAL NOTES : None. - * - * - ****************************************************************************/ -static -void horizontal_line_3_5_scale_c64 -( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - unsigned int i; - unsigned int ba, cb, dc; - unsigned int src_current; - unsigned char *restrict des = dest; - unsigned char *restrict src = (unsigned char *)source; - unsigned int const_51_205, const_102_154, - const_205_51, const_154_102; - - (void) dest_width; - - const_51_205 = 0x3300CD00; //_pack2 (51 << 8, 205 << 8); - const_205_51 = 0xCD003300; //_pack2 (205 << 8, 51 << 8); - const_102_154 = 0x66009A00; //_pack2 (102 << 8, 154 << 8); - const_154_102 = 0x9A006600; //_pack2 (154 << 8, 102 << 8); - - for (i = 0; i < source_width - 3; i += 3) - { - src_current = _mem4(src); - - // Reorder the data so that it is ready for the - // dot product. - ba = _unpklu4(src_current); - cb = _unpkhu4(_rotl(src_current, 8)); - dc = _unpkhu4(src_current); - - des [0] = src_current & 0xff; - des [1] = _dotprsu2(ba, const_154_102); - des [2] = _dotprsu2(cb, const_51_205); - des [3] = _dotprsu2(cb, const_205_51); - des [4] = _dotprsu2(dc, const_102_154); - - src += 3; - des += 5; - } - - src_current = _mem4(src); - - ba = _unpklu4(src_current); - cb = _unpkhu4(_rotl(src_current, 8)); - dc = _unpkhu4(src_current); - - - des [0] = src_current & 0xff; - des [1] = _dotprsu2(ba, const_154_102); - des [2] = _dotprsu2(cb, const_51_205); - des [3] = _dotprsu2(cb, const_205_51); - des [4] = dc & 0xff; - -} - -/**************************************************************************** - * - * ROUTINE : vertical_band_3_5_scale_c64 - * - * INPUTS : unsigned char *dest : Pointer to destination data. - * unsigned int dest_pitch : Stride of destination data. - * unsigned int dest_width : Width of destination data. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Scales vertical band of pixels by scale 3 to 5. The - * height of the band scaled is 3-pixels. - * - * SPECIAL NOTES : The routine uses the first line of the band below - * the current band. - * - ****************************************************************************/ -static -void vertical_band_3_5_scale_c64(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) -{ - unsigned int i; - unsigned int a, b, c, d; - unsigned int ba, cb, dc; - unsigned char *restrict src = dest; - unsigned char *restrict des = dest; - unsigned int const_51_205, const_102_154, - const_205_51, const_154_102; - - const_51_205 = 0x3300CD00; //_pack2 (51 << 8, 205 << 8); - const_205_51 = 0xCD003300; //_pack2 (205 << 8, 51 << 8); - const_102_154 = 0x66009A00; //_pack2 (102 << 8, 154 << 8); - const_154_102 = 0x9A006600; //_pack2 (154 << 8, 102 << 8); - - a = src [0]; - b = src [dest_pitch]; - c = src [dest_pitch*2]; - d = src [dest_pitch*5]; - src ++; - - for (i = 0; i < dest_width; i++) - { - ba = _pack2(b, a); - cb = _pack2(c, b); - dc = _pack2(d, c); - - a = src [0]; - b = src [dest_pitch]; - c = src [dest_pitch*2]; - d = src [dest_pitch*5]; - src ++; - - des [dest_pitch] = _dotprsu2(ba, const_154_102); - des [dest_pitch*2] = _dotprsu2(cb, const_51_205); - des [dest_pitch*3] = _dotprsu2(cb, const_205_51); - des [dest_pitch*4] = _dotprsu2(dc, const_102_154); - - des++; - } -} - -/**************************************************************************** - * - * ROUTINE : last_vertical_band_3_5_scale_c64 - * - * INPUTS : unsigned char *dest : Pointer to destination data. - * unsigned int dest_pitch : Stride of destination data. - * unsigned int dest_width : Width of destination data. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Scales last vertical band of pixels by scale 3 to 5. The - * height of the band scaled is 3-pixels. - * - * SPECIAL NOTES : The routine does not have available the first line of - * the band below the current band, since this is the - * last band. - * - ****************************************************************************/ -static -void last_vertical_band_3_5_scale_c64(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) -{ - unsigned int i; - unsigned int a, b, c; - unsigned int ba, cb; - unsigned char *restrict src = dest; - unsigned char *restrict des = dest; - unsigned int const_51_205, const_205_51, const_154_102; - - const_51_205 = 0x3300CD00; //_pack2 (51 << 8, 205 << 8); - const_205_51 = 0xCD003300; //_pack2 (205 << 8, 51 << 8); - const_154_102 = 0x9A006600; //_pack2 (154 << 8, 102 << 8); - - a = src [0]; - b = src [dest_pitch]; - c = src [dest_pitch*2]; - src ++; - - for (i = 0; i < dest_width; ++i) - { - ba = _pack2(b, a); - cb = _pack2(c, b); - - a = src [0]; - b = src [dest_pitch]; - c = src [dest_pitch*2]; - src ++; - - des [dest_pitch] = _dotprsu2(ba, const_154_102); - des [dest_pitch*2] = _dotprsu2(cb, const_51_205); - des [dest_pitch*3] = _dotprsu2(cb, const_205_51); - des [dest_pitch*4] = (unsigned char)(c) ; - - des++; - } -} - -/**************************************************************************** - * - * ROUTINE : horizontal_line_1_2_scale_c64 - * - * INPUTS : const unsigned char *source : Pointer to source data. - * unsigned int source_width : Stride of source. - * unsigned char *dest : Pointer to destination data. - * unsigned int dest_width : Stride of destination (NOT USED). - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Copies horizontal line of pixels from source to - * destination scaling up by 1 to 2. - * - * SPECIAL NOTES : source width must be a multiple of 4. - * - ****************************************************************************/ -void horizontal_line_1_2_scale_c64 -( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - unsigned int i; - unsigned char *restrict des = dest; - unsigned char *restrict src = (unsigned char *)source; - unsigned int src7_4i, src4_1i, src3_0i; - unsigned int a4_0i, ahi, alo; - double src7_0d, src3_0d; - const unsigned int k01 = 0x01010101; - - for (i = 0; i < source_width / 4; i += 1) - { - // Load up the data from src. Here a wide load is - // used to get 8 bytes at once, only 5 will be used - // for the actual computation. - src7_0d = _memd8(src); - src3_0i = _lo(src7_0d); - src7_4i = _hi(src7_0d); - - // Need to average between points. Shift byte 5 into - // the lower word. This will result in bytes 5-1 - // averaged with 4-0. - src4_1i = _shrmb(src7_4i, src3_0i); - a4_0i = _avgu4(src4_1i, src3_0i); - - // Expand the data out. Could do an unpack, however - // all but the multiply units are getting pretty hard - // here the multiply unit can take some of the computations. - src3_0d = _mpyu4(src3_0i, k01); - - // The averages need to be unpacked so that they are in 16 - // bit form and will be able to be interleaved with the - // original data - ahi = _unpkhu4(a4_0i); - alo = _unpklu4(a4_0i); - - ahi = _swap4(ahi); - alo = _swap4(alo); - - // Mix the average result in with the orginal data. - ahi = _hi(src3_0d) | ahi; - alo = _lo(src3_0d) | alo; - - _memd8(des) = _itod(ahi, alo); - - des += 8; - src += 4; - } -} - - -/**************************************************************************** - * - * ROUTINE : vertical_band_1_2_scale_c64 - * - * INPUTS : unsigned char *dest : Pointer to destination data. - * unsigned int dest_pitch : Stride of destination data. - * unsigned int dest_width : Width of destination data. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Scales vertical band of pixels by scale 1 to 2. The - * height of the band scaled is 1-pixel. - * - * SPECIAL NOTES : The routine uses the first line of the band below - * the current band. - * Destination width must be a multiple of 4. Because the - * intput must be, therefore the output must be. - * - ****************************************************************************/ -static -void vertical_band_1_2_scale_c64(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) -{ - unsigned int i; - unsigned int a, b; - unsigned int *restrict line_a = (unsigned int *)dest; - unsigned int *restrict line_b = (unsigned int *)(dest + (dest_pitch * 2)); - unsigned int *restrict des = (unsigned int *)(dest + dest_pitch); - - for (i = 0; i < dest_width / 4; i++) - { - a = _mem4(line_a++); - b = _mem4(line_b++); - - _mem4(des++) = _avgu4(a, b); - } -} - -/**************************************************************************** - * - * ROUTINE : last_vertical_band_1_2_scale_c64 - * - * INPUTS : unsigned char *dest : Pointer to destination data. - * unsigned int dest_pitch : Stride of destination data. - * unsigned int dest_width : Width of destination data. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Scales last vertical band of pixels by scale 1 to 2. The - * height of the band scaled is 1-pixel. - * - * SPECIAL NOTES : The routine does not have available the first line of - * the band below the current band, since this is the - * last band. Again, width must be a multiple of 4. - * - ****************************************************************************/ -static -void last_vertical_band_1_2_scale_c64(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) -{ - unsigned int i; - unsigned int *restrict src = (unsigned int *)dest; - unsigned int *restrict des = (unsigned int *)(dest + dest_pitch); - - for (i = 0; i < dest_width / 4; ++i) - { - _mem4(des++) = _mem4(src++); - } -} - -void -register_generic_scalers(void) -{ - vp8_horizontal_line_1_2_scale = horizontal_line_1_2_scale_c64; - vp8_vertical_band_1_2_scale = vertical_band_1_2_scale_c64; - vp8_last_vertical_band_1_2_scale = last_vertical_band_1_2_scale_c64; - vp8_horizontal_line_3_5_scale = horizontal_line_3_5_scale_c64; - vp8_vertical_band_3_5_scale = vertical_band_3_5_scale_c64; - vp8_last_vertical_band_3_5_scale = last_vertical_band_3_5_scale_c64; - vp8_horizontal_line_4_5_scale = horizontal_line_4_5_scale_c64; - vp8_vertical_band_4_5_scale = vertical_band_4_5_scale_c64; - vp8_last_vertical_band_4_5_scale = last_vertical_band_4_5_scale_c64; -} diff --git a/vpx_scale/dm642/yv12extend.c b/vpx_scale/dm642/yv12extend.c deleted file mode 100644 index 646e69a7f..000000000 --- a/vpx_scale/dm642/yv12extend.c +++ /dev/null @@ -1,446 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/**************************************************************************** - * - * Module Title : yv12extend.c - * - * Description : - * - ***************************************************************************/ - -/**************************************************************************** -* Header Files -****************************************************************************/ -//#include <stdlib.h> -#include "csl_dat.h" -#include "vpx_scale/yv12config.h" -#include "vpx_mem/vpx_mem.h" - -/**************************************************************************** -* Exports -****************************************************************************/ -#define UINT8 unsigned char -#define UINT32 unsigned int - - -static inline -void copy_yleft_right_border( - UINT8 *restrict src_ptr1, - UINT8 *restrict src_ptr2, - UINT8 *restrict dest_ptr1, - UINT8 *restrict dest_ptr2, - UINT32 plane_height, - UINT32 plane_stride -) -{ - UINT32 left, right, left2, left4, right2, right4; - double dl, dr; - int i; - -#pragma MUST_ITERATE(16,16,16) - - for (i = 0; i < plane_height; i++) - { - left = src_ptr1[0]; - right = src_ptr2[0]; - - left2 = _pack2(left, left); - left4 = _packl4(left2, left2); - - right2 = _pack2(right, right); - right4 = _packl4(right2, right2); - - dl = _itod(left4, left4); - dr = _itod(right4, right4); - - _amemd8(&dest_ptr1[ 0]) = dl; - _amemd8(&dest_ptr2[ 0]) = dr; - - _amemd8(&dest_ptr1[ 8]) = dl; - _amemd8(&dest_ptr2[ 8]) = dr; - - _amemd8(&dest_ptr1[16]) = dl; - _amemd8(&dest_ptr2[16]) = dr; - - _amemd8(&dest_ptr1[24]) = dl; - _amemd8(&dest_ptr2[24]) = dr; - - _amemd8(&dest_ptr1[32]) = dl; - _amemd8(&dest_ptr2[32]) = dr; - - _amemd8(&dest_ptr1[40]) = dl; - _amemd8(&dest_ptr2[40]) = dr; - - - src_ptr1 += plane_stride; - src_ptr2 += plane_stride; - dest_ptr1 += plane_stride; - dest_ptr2 += plane_stride; - } -} -/**************************************************************************** - * - * - ****************************************************************************/ -static -void copy_uvleft_right_border( - UINT8 *restrict src_ptr1, - UINT8 *restrict src_ptr2, - UINT8 *restrict dest_ptr1, - UINT8 *restrict dest_ptr2, - UINT32 plane_height, - UINT32 plane_stride -) -{ - UINT32 left, right, left2, left4, right2, right4; - double dl, dr; - int i; - -#pragma MUST_ITERATE(8,8 ,8) - - for (i = 0; i < plane_height; i++) - { - left = src_ptr1[0]; - right = src_ptr2[0]; - - left2 = _pack2(left, left); - left4 = _packl4(left2, left2); - - right2 = _pack2(right, right); - right4 = _packl4(right2, right2); - - dl = _itod(left4, left4); - dr = _itod(right4, right4); - - _amemd8(&dest_ptr1[ 0]) = dl; - _amemd8(&dest_ptr2[ 0]) = dr; - - _amemd8(&dest_ptr1[ 8]) = dl; - _amemd8(&dest_ptr2[ 8]) = dr; - - _amemd8(&dest_ptr1[16]) = dl; - _amemd8(&dest_ptr2[16]) = dr; - - - src_ptr1 += plane_stride; - src_ptr2 += plane_stride; - dest_ptr1 += plane_stride; - dest_ptr2 += plane_stride; - } -} -/**************************************************************************** - * - ****************************************************************************/ -void -vp8_yv12_extend_frame_borders(YV12_BUFFER_CONFIG *ybf) -{ - int i; - unsigned char *src_ptr1, *src_ptr2; - unsigned char *dest_ptr1, *dest_ptr2; - - unsigned int Border; - int plane_stride; - int plane_height; - int plane_width; - - /***********/ - /* Y Plane */ - /***********/ - Border = ybf->border; - plane_stride = ybf->y_stride; - plane_height = ybf->y_height; - plane_width = ybf->y_width; - -#if 1 - // copy the left and right most columns out - src_ptr1 = ybf->y_buffer; - src_ptr2 = src_ptr1 + plane_width - 1; - dest_ptr1 = src_ptr1 - Border; - dest_ptr2 = src_ptr2 + 1; - copy_yleft_right_border(src_ptr1, src_ptr2, dest_ptr1, dest_ptr2, plane_height, plane_stride); -#endif - - // Now copy the top and bottom source lines into each line of the respective borders - src_ptr1 = ybf->y_buffer - Border; - src_ptr2 = src_ptr1 + (plane_height * plane_stride) - plane_stride; - dest_ptr1 = src_ptr1 - (Border * plane_stride); - dest_ptr2 = src_ptr2 + plane_stride; - - for (i = 0; i < (int)Border; i++) - { - vpx_memcpy(dest_ptr1, src_ptr1, plane_stride); - vpx_memcpy(dest_ptr2, src_ptr2, plane_stride); - dest_ptr1 += plane_stride; - dest_ptr2 += plane_stride; - } - - plane_stride /= 2; - plane_height /= 2; - plane_width /= 2; - Border /= 2; - - /***********/ - /* U Plane */ - /***********/ -#if 1 - // copy the left and right most columns out - src_ptr1 = ybf->u_buffer; - src_ptr2 = src_ptr1 + plane_width - 1; - dest_ptr1 = src_ptr1 - Border; - dest_ptr2 = src_ptr2 + 1; - - copy_uvleft_right_border(src_ptr1, src_ptr2, dest_ptr1, dest_ptr2, plane_height, plane_stride); - - -#endif - - // Now copy the top and bottom source lines into each line of the respective borders - src_ptr1 = ybf->u_buffer - Border; - src_ptr2 = src_ptr1 + (plane_height * plane_stride) - plane_stride; - dest_ptr1 = src_ptr1 - (Border * plane_stride); - dest_ptr2 = src_ptr2 + plane_stride; - - for (i = 0; i < (int)(Border); i++) - { - vpx_memcpy(dest_ptr1, src_ptr1, plane_stride); - vpx_memcpy(dest_ptr2, src_ptr2, plane_stride); - dest_ptr1 += plane_stride; - dest_ptr2 += plane_stride; - } - - /***********/ - /* V Plane */ - /***********/ -#if 1 - // copy the left and right most columns out - src_ptr1 = ybf->v_buffer; - src_ptr2 = src_ptr1 + plane_width - 1; - dest_ptr1 = src_ptr1 - Border; - dest_ptr2 = src_ptr2 + 1; - - copy_uvleft_right_border(src_ptr1, src_ptr2, dest_ptr1, dest_ptr2, plane_height, plane_stride); - -#endif - - // Now copy the top and bottom source lines into each line of the respective borders - src_ptr1 = ybf->v_buffer - Border; - src_ptr2 = src_ptr1 + (plane_height * plane_stride) - plane_stride; - dest_ptr1 = src_ptr1 - (Border * plane_stride); - dest_ptr2 = src_ptr2 + plane_stride; - - for (i = 0; i < (int)(Border); i++) - { - vpx_memcpy(dest_ptr1, src_ptr1, plane_stride); - vpx_memcpy(dest_ptr2, src_ptr2, plane_stride); - dest_ptr1 += plane_stride; - dest_ptr2 += plane_stride; - } -} -/**************************************************************************** - * - ****************************************************************************/ -void -vpxyv12_extend_frame_tbborders(YV12_BUFFER_CONFIG *ybf) -{ - int i; - unsigned char *src_ptr1, *src_ptr2; - unsigned char *dest_ptr1, *dest_ptr2; - int tid1, tid2; - - unsigned int Border; - int plane_stride; - int plane_height; - int plane_width; - - /***********/ - /* Y Plane */ - /***********/ - Border = ybf->border; - plane_stride = ybf->y_stride; - plane_height = ybf->y_height; - plane_width = ybf->y_width; - - - // Now copy the top and bottom source lines into each line of the respective borders - src_ptr1 = ybf->y_buffer - Border; - src_ptr2 = src_ptr1 + (plane_height * plane_stride) - plane_stride; - dest_ptr1 = src_ptr1 - (Border * plane_stride); - dest_ptr2 = src_ptr2 + plane_stride; - - - for (i = 0; i < (int)Border; i++) - { - dat_copy(src_ptr1, dest_ptr1, plane_stride); - dat_copy(src_ptr2, dest_ptr2, plane_stride); - dest_ptr1 += plane_stride; - dest_ptr2 += plane_stride; - } - - plane_stride /= 2; - plane_height /= 2; - plane_width /= 2; - Border /= 2; - - /***********/ - /* U Plane */ - /***********/ - // Now copy the top and bottom source lines into each line of the respective borders - src_ptr1 = ybf->u_buffer - Border; - src_ptr2 = src_ptr1 + (plane_height * plane_stride) - plane_stride; - dest_ptr1 = src_ptr1 - (Border * plane_stride); - dest_ptr2 = src_ptr2 + plane_stride; - - for (i = 0; i < (int)(Border); i++) - { - dat_copy(src_ptr1, dest_ptr1, plane_stride); - dat_copy(src_ptr2, dest_ptr2, plane_stride); - dest_ptr1 += plane_stride; - dest_ptr2 += plane_stride; - } - - /***********/ - /* V Plane */ - /***********/ - // Now copy the top and bottom source lines into each line of the respective borders - src_ptr1 = ybf->v_buffer - Border; - src_ptr2 = src_ptr1 + (plane_height * plane_stride) - plane_stride; - dest_ptr1 = src_ptr1 - (Border * plane_stride); - dest_ptr2 = src_ptr2 + plane_stride; - - for (i = 0; i < (int)(Border); i++) - { - tid1 = dat_copy(src_ptr1, dest_ptr1, plane_stride); - tid2 = dat_copy(src_ptr2, dest_ptr2, plane_stride); - dest_ptr1 += plane_stride; - dest_ptr2 += plane_stride; - } - - dat_wait(tid1); - dat_wait(tid2); -} - -/**************************************************************************** - * - * ROUTINE : vp8_yv12_copy_frame - * - * INPUTS : - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Copies the source image into the destination image and - * updates the destination's UMV borders. Because the - * borders have been update prior to this so the whole frame - * is copied, borders and all. This is also to circumvent - * using copy_left_right Border functions when copying data - * between L2 and main memory. When that occurs a cache - * clean needs to be done, which would require invalidating - * an entire frame. - * - * SPECIAL NOTES : The frames are assumed to be identical in size. - * - ****************************************************************************/ -void -vpxyv12_copy_frame_dma(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc) -{ - int yheight, uv_height; - int ystride, uv_stride; - int border; - int yoffset, uvoffset; - - border = src_ybc->border; - yheight = src_ybc->y_height; - uv_height = src_ybc->uv_height; - - ystride = src_ybc->y_stride; - uv_stride = src_ybc->uv_stride; - - yoffset = border * (ystride + 1); - uvoffset = border / 2 * (uv_stride + 1); - - dat_copy2d(DAT_2D2D, - src_ybc->y_buffer - yoffset, - dst_ybc->y_buffer - yoffset, - ystride, - yheight + 2 * border, - ystride); - dat_copy2d(DAT_2D2D, - src_ybc->u_buffer - uvoffset, - dst_ybc->u_buffer - uvoffset, - uv_stride, - uv_height + border, - uv_stride); - dat_copy2d(DAT_2D2D, - src_ybc->v_buffer - uvoffset, - dst_ybc->v_buffer - uvoffset, - uv_stride, - uv_height + border, - uv_stride); - -} - - -/**************************************************************************** - * - * ROUTINE : vp8_yv12_copy_frame - * - * INPUTS : - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Copies the source image into the destination image and - * updates the destination's UMV borders. - * - * SPECIAL NOTES : The frames are assumed to be identical in size. - * - ****************************************************************************/ -void -vp8_yv12_copy_frame(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc) -{ - int row; - unsigned char *source, *dest; - - source = src_ybc->y_buffer; - dest = dst_ybc->y_buffer; - - for (row = 0; row < src_ybc->y_height; row++) - { - vpx_memcpy(dest, source, src_ybc->y_width); - source += src_ybc->y_stride; - dest += dst_ybc->y_stride; - } - - source = src_ybc->u_buffer; - dest = dst_ybc->u_buffer; - - for (row = 0; row < src_ybc->uv_height; row++) - { - vpx_memcpy(dest, source, src_ybc->uv_width); - source += src_ybc->uv_stride; - dest += dst_ybc->uv_stride; - } - - source = src_ybc->v_buffer; - dest = dst_ybc->v_buffer; - - for (row = 0; row < src_ybc->uv_height; row++) - { - vpx_memcpy(dest, source, src_ybc->uv_width); - source += src_ybc->uv_stride; - dest += dst_ybc->uv_stride; - } - - vp8_yv12_extend_frame_borders(dst_ybc); -} diff --git a/vpx_scale/include/leapster/vpxscale.h b/vpx_scale/include/leapster/vpxscale.h deleted file mode 100644 index 50218497d..000000000 --- a/vpx_scale/include/leapster/vpxscale.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/**************************************************************************** -* -* Module Title : postp.h -* -* Description : Post processor interface -* -****************************************************************************/ -#ifndef VPXSCALE_H -#define VPXSCALE_H - - -// fwg 2004-10-14 -typedef void (*vpxvertical_band_4_5_scale_lf)(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width); -typedef void (*vpxlast_vertical_band_4_5_scale_lf)(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width); -typedef void (*vpxvertical_band_3_5_scale_lf)(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width); -typedef void (*vpxlast_vertical_band_3_5_scale_lf)(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width); -typedef void (*vpxhorizontal_line_1_2_scale_lf)(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width); -typedef void (*vpxhorizontal_line_3_5_scale_lf)(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width); -typedef void (*vpxhorizontal_line_4_5_scale_lf)(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width); -typedef void (*vpxvertical_band_1_2_scale_lf)(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width); -typedef void (*vpxlast_vertical_band_1_2_scale_lf)(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width); - - -typedef struct vpxglobal_scalling_ptrs_t -{ - vpxvertical_band_4_5_scale_lf vpxvertical_band_4_5_scale_t; - vpxlast_vertical_band_4_5_scale_lf vpxlast_vertical_band_4_5_scale_t; - vpxvertical_band_3_5_scale_lf vpxvertical_band_3_5_scale_t; - vpxlast_vertical_band_3_5_scale_lf vpxlast_vertical_band_3_5_scale_t; - vpxhorizontal_line_1_2_scale_lf vpxhorizontal_line_1_2_scale_t; - vpxhorizontal_line_3_5_scale_lf vpxhorizontal_line_3_5_scale_t; - vpxhorizontal_line_4_5_scale_lf vpxhorizontal_line_4_5_scale_t; - vpxvertical_band_1_2_scale_lf vpxvertical_band_1_2_scale_t; - vpxlast_vertical_band_1_2_scale_lf vpxlast_vertical_band_1_2_scale_t; -} vpxglobal_scalling_ptrs; - -extern struct vpxglobal_scalling_ptrs_t *g_scaling_ptrs; - -/* -extern void (*vp8_vertical_band_4_5_scale)(unsigned char * dest,unsigned int dest_pitch,unsigned int dest_width); -extern void (*vp8_last_vertical_band_4_5_scale)(unsigned char * dest,unsigned int dest_pitch,unsigned int dest_width); -extern void (*vp8_vertical_band_3_5_scale)(unsigned char * dest,unsigned int dest_pitch,unsigned int dest_width); -extern void (*vp8_last_vertical_band_3_5_scale)(unsigned char * dest,unsigned int dest_pitch,unsigned int dest_width); -extern void (*vp8_horizontal_line_1_2_scale)(const unsigned char * source,unsigned int source_width,unsigned char * dest,unsigned int dest_width); -extern void (*vp8_horizontal_line_3_5_scale)(const unsigned char * source,unsigned int source_width,unsigned char * dest,unsigned int dest_width); -extern void (*vp8_horizontal_line_4_5_scale)(const unsigned char * source,unsigned int source_width,unsigned char * dest,unsigned int dest_width); -extern void (*vp8_vertical_band_1_2_scale)(unsigned char * dest,unsigned int dest_pitch,unsigned int dest_width); -extern void (*vp8_last_vertical_band_1_2_scale)(unsigned char * dest,unsigned int dest_pitch,unsigned int dest_width); -*/ - -#endif diff --git a/vpx_scale/intel_linux/scaleopt.c b/vpx_scale/intel_linux/scaleopt.c deleted file mode 100644 index 499f0ed61..000000000 --- a/vpx_scale/intel_linux/scaleopt.c +++ /dev/null @@ -1,1853 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/**************************************************************************** -* -* Module Title : scaleopt.cpp -* -* Description : Optimized scaling functions -* -****************************************************************************/ -#include "pragmas.h" - -/**************************************************************************** -* Module Statics -****************************************************************************/ -#if 0 -__declspec(align(16)) const static unsigned short one_fifth[] = { 51, 51, 51, 51 }; -__declspec(align(16)) const static unsigned short two_fifths[] = { 102, 102, 102, 102 }; -__declspec(align(16)) const static unsigned short three_fifths[] = { 154, 154, 154, 154 }; -__declspec(align(16)) const static unsigned short four_fifths[] = { 205, 205, 205, 205 }; -__declspec(align(16)) const static unsigned short round_values[] = { 128, 128, 128, 128 }; -__declspec(align(16)) const static unsigned short four_ones[] = { 1, 1, 1, 1}; -__declspec(align(16)) const static unsigned short const45_2[] = {205, 154, 102, 51 }; -__declspec(align(16)) const static unsigned short const45_1[] = { 51, 102, 154, 205 }; -__declspec(align(16)) const static unsigned char mask45[] = { 0, 0, 0, 0, 0, 0, 255, 0}; -__declspec(align(16)) const static unsigned short const35_2[] = { 154, 51, 205, 102 }; -__declspec(align(16)) const static unsigned short const35_1[] = { 102, 205, 51, 154 }; -#endif - -#include "vpx_scale/vpxscale.h" -#include "vpx_mem/vpx_mem.h" - -/**************************************************************************** - * - * ROUTINE : horizontal_line_3_5_scale_mmx - * - * INPUTS : const unsigned char *source : - * unsigned int source_width : - * unsigned char *dest : - * unsigned int dest_width : - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : 3 to 5 up-scaling of a horizontal line of pixels. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -static -void horizontal_line_3_5_scale_mmx -( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - __declspec(align(16)) unsigned short const35_2[] = { 154, 51, 205, 102 }; - __declspec(align(16)) unsigned short const35_1[] = { 102, 205, 51, 154 }; - __declspec(align(16)) unsigned short round_values[] = { 128, 128, 128, 128 }; - - (void) dest_width; - - __asm - { - - push ebx - - mov esi, source - mov edi, dest - - mov ecx, source_width - lea edx, [esi+ecx-3]; - - movq mm5, const35_1 // mm5 = 66 xx cd xx 33 xx 9a xx - movq mm6, const35_2 // mm6 = 9a xx 33 xx cd xx 66 xx - - movq mm4, round_values // mm4 = 80 xx 80 xx 80 xx 80 xx - pxor mm7, mm7 // clear mm7 - - horiz_line_3_5_loop: - - mov eax, DWORD PTR [esi] // eax = 00 01 02 03 - mov ebx, eax - - and ebx, 0xffff00 // ebx = xx 01 02 xx - mov ecx, eax // ecx = 00 01 02 03 - - and eax, 0xffff0000 // eax = xx xx 02 03 - xor ecx, eax // ecx = 00 01 xx xx - - shr ebx, 8 // ebx = 01 02 xx xx - or eax, ebx // eax = 01 02 02 03 - - shl ebx, 16 // ebx = xx xx 01 02 - movd mm1, eax // mm1 = 01 02 02 03 xx xx xx xx - - or ebx, ecx // ebx = 00 01 01 02 - punpcklbw mm1, mm7 // mm1 = 01 xx 02 xx 02 xx 03 xx - - movd mm0, ebx // mm0 = 00 01 01 02 - pmullw mm1, mm6 // - - punpcklbw mm0, mm7 // mm0 = 00 xx 01 xx 01 xx 02 xx - pmullw mm0, mm5 // - - mov [edi], ebx // writeoutput 00 xx xx xx - add esi, 3 - - add edi, 5 - paddw mm0, mm1 - - paddw mm0, mm4 - psrlw mm0, 8 - - cmp esi, edx - packuswb mm0, mm7 - - movd DWORD Ptr [edi-4], mm0 - jl horiz_line_3_5_loop - -//Exit: - mov eax, DWORD PTR [esi] // eax = 00 01 02 03 - mov ebx, eax - - and ebx, 0xffff00 // ebx = xx 01 02 xx - mov ecx, eax // ecx = 00 01 02 03 - - and eax, 0xffff0000 // eax = xx xx 02 03 - xor ecx, eax // ecx = 00 01 xx xx - - shr ebx, 8 // ebx = 01 02 xx xx - or eax, ebx // eax = 01 02 02 03 - - shl eax, 8 // eax = xx 01 02 02 - and eax, 0xffff0000 // eax = xx xx 02 02 - - or eax, ebx // eax = 01 02 02 02 - - shl ebx, 16 // ebx = xx xx 01 02 - movd mm1, eax // mm1 = 01 02 02 02 xx xx xx xx - - or ebx, ecx // ebx = 00 01 01 02 - punpcklbw mm1, mm7 // mm1 = 01 xx 02 xx 02 xx 02 xx - - movd mm0, ebx // mm0 = 00 01 01 02 - pmullw mm1, mm6 // - - punpcklbw mm0, mm7 // mm0 = 00 xx 01 xx 01 xx 02 xx - pmullw mm0, mm5 // - - mov [edi], ebx // writeoutput 00 xx xx xx - paddw mm0, mm1 - - paddw mm0, mm4 - psrlw mm0, 8 - - packuswb mm0, mm7 - movd DWORD Ptr [edi+1], mm0 - - pop ebx - - } - - /* - const unsigned char *src = source; - unsigned char *des = dest; - unsigned int a, b, c ; - unsigned int i; - (void) dest_width; - - for ( i=0; i<source_width-3; i+=3 ) - { - a = src[0]; - b = src[1]; - des [0] = (UINT8) (a); - // 2 * left + 3 * right /5 - des [1] = (UINT8) (( a * 102 + 154 * b + 128 ) >> 8); - c = src[2] ; - // 4 * left + 1 * right /5 - des [2] = (UINT8) (( b * 205 + c * 51 + 128 ) >> 8); - // 1 * left + 4 * right /5 - des [3] = (UINT8) (( b * 51 + c * 205 + 128 ) >> 8); - - a = src[3]; - // 3 * left + 2 * right /5 - des [4] = (UINT8) (( c * 154 + a * 102 + 128 ) >> 8); - - src += 3; - des += 5; - } - - a = src[0]; - b = src[1]; - des [0] = (UINT8) (a); - // 2 * left + 3 * right /5 - des [1] = (UINT8) (( a * 102 + 154 * b + 128 ) >> 8); - c = src[2] ; - // 4 * left + 1 * right /5 - des [2] = (UINT8) (( b * 205 + c * 51 + 128 ) >> 8); - // 1 * left + 4 * right /5 - des [3] = (UINT8) (( b * 51 + c * 205 + 128 ) >> 8); - - des [4] = (UINT8) (c); - */ -} - - -/**************************************************************************** - * - * ROUTINE : horizontal_line_4_5_scale_mmx - * - * INPUTS : const unsigned char *source : - * unsigned int source_width : - * unsigned char *dest : - * unsigned int dest_width : - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : 4 to 5 up-scaling of a horizontal line of pixels. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -static -void horizontal_line_4_5_scale_mmx -( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - __declspec(align(16)) unsigned short round_values[] = { 128, 128, 128, 128 }; - __declspec(align(16)) unsigned short const45_2[] = {205, 154, 102, 51 }; - __declspec(align(16)) unsigned short const45_1[] = { 51, 102, 154, 205 }; - __declspec(align(16)) unsigned char mask45[] = { 0, 0, 0, 0, 0, 0, 255, 0}; - - (void)dest_width; - - __asm - { - - mov esi, source - mov edi, dest - - mov ecx, source_width - lea edx, [esi+ecx-8]; - - movq mm5, const45_1 // mm5 = 33 xx 66 xx 9a xx cd xx - movq mm6, const45_2 // mm6 = cd xx 9a xx 66 xx 33 xx - - movq mm4, round_values // mm4 = 80 xx 80 xx 80 xx 80 xx - pxor mm7, mm7 // clear mm7 - - horiz_line_4_5_loop: - - movq mm0, QWORD PTR [esi] // mm0 = 00 01 02 03 04 05 06 07 - movq mm1, QWORD PTR [esi+1]; // mm1 = 01 02 03 04 05 06 07 08 - - movq mm2, mm0 // mm2 = 00 01 02 03 04 05 06 07 - movq mm3, mm1 // mm3 = 01 02 03 04 05 06 07 08 - - movd DWORD PTR [edi], mm0 // write output 00 xx xx xx - punpcklbw mm0, mm7 // mm0 = 00 xx 01 xx 02 xx 03 xx - - punpcklbw mm1, mm7 // mm1 = 01 xx 02 xx 03 xx 04 xx - pmullw mm0, mm5 // 00* 51 01*102 02*154 03*205 - - pmullw mm1, mm6 // 01*205 02*154 03*102 04* 51 - punpckhbw mm2, mm7 // mm2 = 04 xx 05 xx 06 xx 07 xx - - movd DWORD PTR [edi+5], mm2 // write ouput 05 xx xx xx - pmullw mm2, mm5 // 04* 51 05*102 06*154 07*205 - - punpckhbw mm3, mm7 // mm3 = 05 xx 06 xx 07 xx 08 xx - pmullw mm3, mm6 // 05*205 06*154 07*102 08* 51 - - paddw mm0, mm1 // added round values - paddw mm0, mm4 - - psrlw mm0, 8 // output: 01 xx 02 xx 03 xx 04 xx - packuswb mm0, mm7 - - movd DWORD PTR [edi+1], mm0 // write output 01 02 03 04 - add edi, 10 - - add esi, 8 - paddw mm2, mm3 // - - paddw mm2, mm4 // added round values - cmp esi, edx - - psrlw mm2, 8 - packuswb mm2, mm7 - - movd DWORD PTR [edi-4], mm2 // writeoutput 06 07 08 09 - jl horiz_line_4_5_loop - -//Exit: - movq mm0, [esi] // mm0 = 00 01 02 03 04 05 06 07 - movq mm1, mm0 // mm1 = 00 01 02 03 04 05 06 07 - - movq mm2, mm0 // mm2 = 00 01 02 03 04 05 06 07 - psrlq mm1, 8 // mm1 = 01 02 03 04 05 06 07 00 - - movq mm3, mask45 // mm3 = 00 00 00 00 00 00 ff 00 - pand mm3, mm1 // mm3 = 00 00 00 00 00 00 07 00 - - psllq mm3, 8 // mm3 = 00 00 00 00 00 00 00 07 - por mm1, mm3 // mm1 = 01 02 03 04 05 06 07 07 - - movq mm3, mm1 - - movd DWORD PTR [edi], mm0 // write output 00 xx xx xx - punpcklbw mm0, mm7 // mm0 = 00 xx 01 xx 02 xx 03 xx - - punpcklbw mm1, mm7 // mm1 = 01 xx 02 xx 03 xx 04 xx - pmullw mm0, mm5 // 00* 51 01*102 02*154 03*205 - - pmullw mm1, mm6 // 01*205 02*154 03*102 04* 51 - punpckhbw mm2, mm7 // mm2 = 04 xx 05 xx 06 xx 07 xx - - movd DWORD PTR [edi+5], mm2 // write ouput 05 xx xx xx - pmullw mm2, mm5 // 04* 51 05*102 06*154 07*205 - - punpckhbw mm3, mm7 // mm3 = 05 xx 06 xx 07 xx 08 xx - pmullw mm3, mm6 // 05*205 06*154 07*102 07* 51 - - paddw mm0, mm1 // added round values - paddw mm0, mm4 - - psrlw mm0, 8 // output: 01 xx 02 xx 03 xx 04 xx - packuswb mm0, mm7 // 01 02 03 04 xx xx xx xx - - movd DWORD PTR [edi+1], mm0 // write output 01 02 03 04 - paddw mm2, mm3 // - - paddw mm2, mm4 // added round values - psrlw mm2, 8 - - packuswb mm2, mm7 - movd DWORD PTR [edi+6], mm2 // writeoutput 06 07 08 09 - - - } - /* - const unsigned char *src = source; - unsigned char *des = dest; - unsigned int a, b, c ; - unsigned i; - (void) dest_width; - - for ( i=0; i<source_width-4; i+=4 ) - { - a = src[0]; - b = src[1]; - des [0] = (UINT8) a; - des [1] = (UINT8) (( a * 51 + 205 * b + 128) >> 8); - c = src[2] * 154; - a = src[3]; - des [2] = (UINT8) (( b * 102 + c + 128) >> 8); - des [3] = (UINT8) (( c + 102 * a + 128) >> 8); - b = src[4]; - des [4] = (UINT8) (( a * 205 + 51 * b + 128) >> 8); - - src += 4; - des += 5; - } - - a = src[0]; - b = src[1]; - des [0] = (UINT8) (a); - des [1] = (UINT8) (( a * 51 + 205 * b + 128) >> 8); - c = src[2] * 154; - a = src[3]; - des [2] = (UINT8) (( b * 102 + c + 128) >> 8); - des [3] = (UINT8) (( c + 102 * a + 128) >> 8); - des [4] = (UINT8) (a); - */ -} - -/**************************************************************************** - * - * ROUTINE : vertical_band_4_5_scale_mmx - * - * INPUTS : unsigned char *dest : - * unsigned int dest_pitch : - * unsigned int dest_width : - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : 4 to 5 up-scaling of a 4 pixel high band of pixels. - * - * SPECIAL NOTES : The routine uses the first line of the band below - * the current band. The function also has a "C" only - * version. - * - ****************************************************************************/ -static -void vertical_band_4_5_scale_mmx -( - unsigned char *dest, - unsigned int dest_pitch, - unsigned int dest_width -) -{ - - __declspec(align(16)) unsigned short one_fifth[] = { 51, 51, 51, 51 }; - __declspec(align(16)) unsigned short two_fifths[] = { 102, 102, 102, 102 }; - __declspec(align(16)) unsigned short three_fifths[] = { 154, 154, 154, 154 }; - __declspec(align(16)) unsigned short four_fifths[] = { 205, 205, 205, 205 }; - __declspec(align(16)) unsigned short round_values[] = { 128, 128, 128, 128 }; - - __asm - { - - mov esi, dest // Get the source and destination pointer - mov ecx, dest_pitch // Get the pitch size - - lea edi, [esi+ecx*2] // tow lines below - add edi, ecx // three lines below - - pxor mm7, mm7 // clear out mm7 - mov edx, dest_width // Loop counter - - vs_4_5_loop: - - movq mm0, QWORD ptr [esi] // src[0]; - movq mm1, QWORD ptr [esi+ecx] // src[1]; - - movq mm2, mm0 // Make a copy - punpcklbw mm0, mm7 // unpack low to word - - movq mm5, one_fifth - punpckhbw mm2, mm7 // unpack high to word - - pmullw mm0, mm5 // a * 1/5 - - movq mm3, mm1 // make a copy - punpcklbw mm1, mm7 // unpack low to word - - pmullw mm2, mm5 // a * 1/5 - movq mm6, four_fifths // constan - - movq mm4, mm1 // copy of low b - pmullw mm4, mm6 // b * 4/5 - - punpckhbw mm3, mm7 // unpack high to word - movq mm5, mm3 // copy of high b - - pmullw mm5, mm6 // b * 4/5 - paddw mm0, mm4 // a * 1/5 + b * 4/5 - - paddw mm2, mm5 // a * 1/5 + b * 4/5 - paddw mm0, round_values // + 128 - - paddw mm2, round_values // + 128 - psrlw mm0, 8 - - psrlw mm2, 8 - packuswb mm0, mm2 // des [1] - - movq QWORD ptr [esi+ecx], mm0 // write des[1] - movq mm0, [esi+ecx*2] // mm0 = src[2] - - // mm1, mm3 --- Src[1] - // mm0 --- Src[2] - // mm7 for unpacking - - movq mm5, two_fifths - movq mm2, mm0 // make a copy - - pmullw mm1, mm5 // b * 2/5 - movq mm6, three_fifths - - - punpcklbw mm0, mm7 // unpack low to word - pmullw mm3, mm5 // b * 2/5 - - movq mm4, mm0 // make copy of c - punpckhbw mm2, mm7 // unpack high to word - - pmullw mm4, mm6 // c * 3/5 - movq mm5, mm2 - - pmullw mm5, mm6 // c * 3/5 - paddw mm1, mm4 // b * 2/5 + c * 3/5 - - paddw mm3, mm5 // b * 2/5 + c * 3/5 - paddw mm1, round_values // + 128 - - paddw mm3, round_values // + 128 - psrlw mm1, 8 - - psrlw mm3, 8 - packuswb mm1, mm3 // des[2] - - movq QWORD ptr [esi+ecx*2], mm1 // write des[2] - movq mm1, [edi] // mm1=Src[3]; - - // mm0, mm2 --- Src[2] - // mm1 --- Src[3] - // mm6 --- 3/5 - // mm7 for unpacking - - pmullw mm0, mm6 // c * 3/5 - movq mm5, two_fifths // mm5 = 2/5 - - movq mm3, mm1 // make a copy - pmullw mm2, mm6 // c * 3/5 - - punpcklbw mm1, mm7 // unpack low - movq mm4, mm1 // make a copy - - punpckhbw mm3, mm7 // unpack high - pmullw mm4, mm5 // d * 2/5 - - movq mm6, mm3 // make a copy - pmullw mm6, mm5 // d * 2/5 - - paddw mm0, mm4 // c * 3/5 + d * 2/5 - paddw mm2, mm6 // c * 3/5 + d * 2/5 - - paddw mm0, round_values // + 128 - paddw mm2, round_values // + 128 - - psrlw mm0, 8 - psrlw mm2, 8 - - packuswb mm0, mm2 // des[3] - movq QWORD ptr [edi], mm0 // write des[3] - - // mm1, mm3 --- Src[3] - // mm7 -- cleared for unpacking - - movq mm0, [edi+ecx*2] // mm0, Src[0] of the next group - - movq mm5, four_fifths // mm5 = 4/5 - pmullw mm1, mm5 // d * 4/5 - - movq mm6, one_fifth // mm6 = 1/5 - movq mm2, mm0 // make a copy - - pmullw mm3, mm5 // d * 4/5 - punpcklbw mm0, mm7 // unpack low - - pmullw mm0, mm6 // an * 1/5 - punpckhbw mm2, mm7 // unpack high - - paddw mm1, mm0 // d * 4/5 + an * 1/5 - pmullw mm2, mm6 // an * 1/5 - - paddw mm3, mm2 // d * 4/5 + an * 1/5 - paddw mm1, round_values // + 128 - - paddw mm3, round_values // + 128 - psrlw mm1, 8 - - psrlw mm3, 8 - packuswb mm1, mm3 // des[4] - - movq QWORD ptr [edi+ecx], mm1 // write des[4] - - add edi, 8 - add esi, 8 - - sub edx, 8 - jg vs_4_5_loop - } -} - -/**************************************************************************** - * - * ROUTINE : last_vertical_band_4_5_scale_mmx - * - * INPUTS : unsigned char *dest : - * unsigned int dest_pitch : - * unsigned int dest_width : - * - * OUTPUTS : None. - * - * RETURNS : None - * - * FUNCTION : 4 to 5 up-scaling of the last 4-pixel high band in an image. - * - * SPECIAL NOTES : The routine uses the first line of the band below - * the current band. The function also has an "C" only - * version. - * - ****************************************************************************/ -static -void last_vertical_band_4_5_scale_mmx -( - unsigned char *dest, - unsigned int dest_pitch, - unsigned int dest_width -) -{ - __declspec(align(16)) unsigned short one_fifth[] = { 51, 51, 51, 51 }; - __declspec(align(16)) unsigned short two_fifths[] = { 102, 102, 102, 102 }; - __declspec(align(16)) unsigned short three_fifths[] = { 154, 154, 154, 154 }; - __declspec(align(16)) unsigned short four_fifths[] = { 205, 205, 205, 205 }; - __declspec(align(16)) unsigned short round_values[] = { 128, 128, 128, 128 }; - - __asm - { - mov esi, dest // Get the source and destination pointer - mov ecx, dest_pitch // Get the pitch size - - lea edi, [esi+ecx*2] // tow lines below - add edi, ecx // three lines below - - pxor mm7, mm7 // clear out mm7 - mov edx, dest_width // Loop counter - - last_vs_4_5_loop: - - movq mm0, QWORD ptr [esi] // src[0]; - movq mm1, QWORD ptr [esi+ecx] // src[1]; - - movq mm2, mm0 // Make a copy - punpcklbw mm0, mm7 // unpack low to word - - movq mm5, one_fifth - punpckhbw mm2, mm7 // unpack high to word - - pmullw mm0, mm5 // a * 1/5 - - movq mm3, mm1 // make a copy - punpcklbw mm1, mm7 // unpack low to word - - pmullw mm2, mm5 // a * 1/5 - movq mm6, four_fifths // constan - - movq mm4, mm1 // copy of low b - pmullw mm4, mm6 // b * 4/5 - - punpckhbw mm3, mm7 // unpack high to word - movq mm5, mm3 // copy of high b - - pmullw mm5, mm6 // b * 4/5 - paddw mm0, mm4 // a * 1/5 + b * 4/5 - - paddw mm2, mm5 // a * 1/5 + b * 4/5 - paddw mm0, round_values // + 128 - - paddw mm2, round_values // + 128 - psrlw mm0, 8 - - psrlw mm2, 8 - packuswb mm0, mm2 // des [1] - - movq QWORD ptr [esi+ecx], mm0 // write des[1] - movq mm0, [esi+ecx*2] // mm0 = src[2] - - // mm1, mm3 --- Src[1] - // mm0 --- Src[2] - // mm7 for unpacking - - movq mm5, two_fifths - movq mm2, mm0 // make a copy - - pmullw mm1, mm5 // b * 2/5 - movq mm6, three_fifths - - - punpcklbw mm0, mm7 // unpack low to word - pmullw mm3, mm5 // b * 2/5 - - movq mm4, mm0 // make copy of c - punpckhbw mm2, mm7 // unpack high to word - - pmullw mm4, mm6 // c * 3/5 - movq mm5, mm2 - - pmullw mm5, mm6 // c * 3/5 - paddw mm1, mm4 // b * 2/5 + c * 3/5 - - paddw mm3, mm5 // b * 2/5 + c * 3/5 - paddw mm1, round_values // + 128 - - paddw mm3, round_values // + 128 - psrlw mm1, 8 - - psrlw mm3, 8 - packuswb mm1, mm3 // des[2] - - movq QWORD ptr [esi+ecx*2], mm1 // write des[2] - movq mm1, [edi] // mm1=Src[3]; - - movq QWORD ptr [edi+ecx], mm1 // write des[4]; - - // mm0, mm2 --- Src[2] - // mm1 --- Src[3] - // mm6 --- 3/5 - // mm7 for unpacking - - pmullw mm0, mm6 // c * 3/5 - movq mm5, two_fifths // mm5 = 2/5 - - movq mm3, mm1 // make a copy - pmullw mm2, mm6 // c * 3/5 - - punpcklbw mm1, mm7 // unpack low - movq mm4, mm1 // make a copy - - punpckhbw mm3, mm7 // unpack high - pmullw mm4, mm5 // d * 2/5 - - movq mm6, mm3 // make a copy - pmullw mm6, mm5 // d * 2/5 - - paddw mm0, mm4 // c * 3/5 + d * 2/5 - paddw mm2, mm6 // c * 3/5 + d * 2/5 - - paddw mm0, round_values // + 128 - paddw mm2, round_values // + 128 - - psrlw mm0, 8 - psrlw mm2, 8 - - packuswb mm0, mm2 // des[3] - movq QWORD ptr [edi], mm0 // write des[3] - - // mm1, mm3 --- Src[3] - // mm7 -- cleared for unpacking - add edi, 8 - add esi, 8 - - sub edx, 8 - jg last_vs_4_5_loop - } -} - -/**************************************************************************** - * - * ROUTINE : vertical_band_3_5_scale_mmx - * - * INPUTS : unsigned char *dest : - * unsigned int dest_pitch : - * unsigned int dest_width : - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : 3 to 5 up-scaling of a 3-pixel high band of pixels. - * - * SPECIAL NOTES : The routine uses the first line of the band below - * the current band. The function also has an "C" only - * version. - * - ****************************************************************************/ -static -void vertical_band_3_5_scale_mmx -( - unsigned char *dest, - unsigned int dest_pitch, - unsigned int dest_width -) -{ - __declspec(align(16)) unsigned short one_fifth[] = { 51, 51, 51, 51 }; - __declspec(align(16)) unsigned short two_fifths[] = { 102, 102, 102, 102 }; - __declspec(align(16)) unsigned short three_fifths[] = { 154, 154, 154, 154 }; - __declspec(align(16)) unsigned short four_fifths[] = { 205, 205, 205, 205 }; - __declspec(align(16)) unsigned short round_values[] = { 128, 128, 128, 128 }; - - __asm - { - mov esi, dest // Get the source and destination pointer - mov ecx, dest_pitch // Get the pitch size - - lea edi, [esi+ecx*2] // tow lines below - add edi, ecx // three lines below - - pxor mm7, mm7 // clear out mm7 - mov edx, dest_width // Loop counter - - vs_3_5_loop: - - movq mm0, QWORD ptr [esi] // src[0]; - movq mm1, QWORD ptr [esi+ecx] // src[1]; - - movq mm2, mm0 // Make a copy - punpcklbw mm0, mm7 // unpack low to word - - movq mm5, two_fifths // mm5 = 2/5 - punpckhbw mm2, mm7 // unpack high to word - - pmullw mm0, mm5 // a * 2/5 - - movq mm3, mm1 // make a copy - punpcklbw mm1, mm7 // unpack low to word - - pmullw mm2, mm5 // a * 2/5 - movq mm6, three_fifths // mm6 = 3/5 - - movq mm4, mm1 // copy of low b - pmullw mm4, mm6 // b * 3/5 - - punpckhbw mm3, mm7 // unpack high to word - movq mm5, mm3 // copy of high b - - pmullw mm5, mm6 // b * 3/5 - paddw mm0, mm4 // a * 2/5 + b * 3/5 - - paddw mm2, mm5 // a * 2/5 + b * 3/5 - paddw mm0, round_values // + 128 - - paddw mm2, round_values // + 128 - psrlw mm0, 8 - - psrlw mm2, 8 - packuswb mm0, mm2 // des [1] - - movq QWORD ptr [esi+ecx], mm0 // write des[1] - movq mm0, [esi+ecx*2] // mm0 = src[2] - - // mm1, mm3 --- Src[1] - // mm0 --- Src[2] - // mm7 for unpacking - - movq mm4, mm1 // b low - pmullw mm1, four_fifths // b * 4/5 low - - movq mm5, mm3 // b high - pmullw mm3, four_fifths // b * 4/5 high - - movq mm2, mm0 // c - pmullw mm4, one_fifth // b * 1/5 - - punpcklbw mm0, mm7 // c low - pmullw mm5, one_fifth // b * 1/5 - - movq mm6, mm0 // make copy of c low - punpckhbw mm2, mm7 // c high - - pmullw mm6, one_fifth // c * 1/5 low - movq mm7, mm2 // make copy of c high - - pmullw mm7, one_fifth // c * 1/5 high - paddw mm1, mm6 // b * 4/5 + c * 1/5 low - - paddw mm3, mm7 // b * 4/5 + c * 1/5 high - movq mm6, mm0 // make copy of c low - - pmullw mm6, four_fifths // c * 4/5 low - movq mm7, mm2 // make copy of c high - - pmullw mm7, four_fifths // c * 4/5 high - - paddw mm4, mm6 // b * 1/5 + c * 4/5 low - paddw mm5, mm7 // b * 1/5 + c * 4/5 high - - paddw mm1, round_values // + 128 - paddw mm3, round_values // + 128 - - psrlw mm1, 8 - psrlw mm3, 8 - - packuswb mm1, mm3 // des[2] - movq QWORD ptr [esi+ecx*2], mm1 // write des[2] - - paddw mm4, round_values // + 128 - paddw mm5, round_values // + 128 - - psrlw mm4, 8 - psrlw mm5, 8 - - packuswb mm4, mm5 // des[3] - movq QWORD ptr [edi], mm4 // write des[3] - - // mm0, mm2 --- Src[3] - - pxor mm7, mm7 // clear mm7 for unpacking - movq mm1, [edi+ecx*2] // mm1 = Src[0] of the next group - - movq mm5, three_fifths // mm5 = 3/5 - pmullw mm0, mm5 // d * 3/5 - - movq mm6, two_fifths // mm6 = 2/5 - movq mm3, mm1 // make a copy - - pmullw mm2, mm5 // d * 3/5 - punpcklbw mm1, mm7 // unpack low - - pmullw mm1, mm6 // an * 2/5 - punpckhbw mm3, mm7 // unpack high - - paddw mm0, mm1 // d * 3/5 + an * 2/5 - pmullw mm3, mm6 // an * 2/5 - - paddw mm2, mm3 // d * 3/5 + an * 2/5 - paddw mm0, round_values // + 128 - - paddw mm2, round_values // + 128 - psrlw mm0, 8 - - psrlw mm2, 8 - packuswb mm0, mm2 // des[4] - - movq QWORD ptr [edi+ecx], mm0 // write des[4] - - add edi, 8 - add esi, 8 - - sub edx, 8 - jg vs_3_5_loop - } -} - -/**************************************************************************** - * - * ROUTINE : last_vertical_band_3_5_scale_mmx - * - * INPUTS : unsigned char *dest : - * unsigned int dest_pitch : - * unsigned int dest_width : - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : 3 to 5 up-scaling of a 3-pixel high band of pixels. - * - * SPECIAL NOTES : The routine uses the first line of the band below - * the current band. The function also has an "C" only - * version. - * - ****************************************************************************/ -static -void last_vertical_band_3_5_scale_mmx -( - unsigned char *dest, - unsigned int dest_pitch, - unsigned int dest_width -) -{ - __declspec(align(16)) unsigned short one_fifth[] = { 51, 51, 51, 51 }; - __declspec(align(16)) unsigned short two_fifths[] = { 102, 102, 102, 102 }; - __declspec(align(16)) unsigned short three_fifths[] = { 154, 154, 154, 154 }; - __declspec(align(16)) unsigned short four_fifths[] = { 205, 205, 205, 205 }; - __declspec(align(16)) unsigned short round_values[] = { 128, 128, 128, 128 }; - __asm - { - mov esi, dest // Get the source and destination pointer - mov ecx, dest_pitch // Get the pitch size - - lea edi, [esi+ecx*2] // tow lines below - add edi, ecx // three lines below - - pxor mm7, mm7 // clear out mm7 - mov edx, dest_width // Loop counter - - - last_vs_3_5_loop: - - movq mm0, QWORD ptr [esi] // src[0]; - movq mm1, QWORD ptr [esi+ecx] // src[1]; - - movq mm2, mm0 // Make a copy - punpcklbw mm0, mm7 // unpack low to word - - movq mm5, two_fifths // mm5 = 2/5 - punpckhbw mm2, mm7 // unpack high to word - - pmullw mm0, mm5 // a * 2/5 - - movq mm3, mm1 // make a copy - punpcklbw mm1, mm7 // unpack low to word - - pmullw mm2, mm5 // a * 2/5 - movq mm6, three_fifths // mm6 = 3/5 - - movq mm4, mm1 // copy of low b - pmullw mm4, mm6 // b * 3/5 - - punpckhbw mm3, mm7 // unpack high to word - movq mm5, mm3 // copy of high b - - pmullw mm5, mm6 // b * 3/5 - paddw mm0, mm4 // a * 2/5 + b * 3/5 - - paddw mm2, mm5 // a * 2/5 + b * 3/5 - paddw mm0, round_values // + 128 - - paddw mm2, round_values // + 128 - psrlw mm0, 8 - - psrlw mm2, 8 - packuswb mm0, mm2 // des [1] - - movq QWORD ptr [esi+ecx], mm0 // write des[1] - movq mm0, [esi+ecx*2] // mm0 = src[2] - - - - // mm1, mm3 --- Src[1] - // mm0 --- Src[2] - // mm7 for unpacking - - movq mm4, mm1 // b low - pmullw mm1, four_fifths // b * 4/5 low - - movq QWORD ptr [edi+ecx], mm0 // write des[4] - - movq mm5, mm3 // b high - pmullw mm3, four_fifths // b * 4/5 high - - movq mm2, mm0 // c - pmullw mm4, one_fifth // b * 1/5 - - punpcklbw mm0, mm7 // c low - pmullw mm5, one_fifth // b * 1/5 - - movq mm6, mm0 // make copy of c low - punpckhbw mm2, mm7 // c high - - pmullw mm6, one_fifth // c * 1/5 low - movq mm7, mm2 // make copy of c high - - pmullw mm7, one_fifth // c * 1/5 high - paddw mm1, mm6 // b * 4/5 + c * 1/5 low - - paddw mm3, mm7 // b * 4/5 + c * 1/5 high - movq mm6, mm0 // make copy of c low - - pmullw mm6, four_fifths // c * 4/5 low - movq mm7, mm2 // make copy of c high - - pmullw mm7, four_fifths // c * 4/5 high - - paddw mm4, mm6 // b * 1/5 + c * 4/5 low - paddw mm5, mm7 // b * 1/5 + c * 4/5 high - - paddw mm1, round_values // + 128 - paddw mm3, round_values // + 128 - - psrlw mm1, 8 - psrlw mm3, 8 - - packuswb mm1, mm3 // des[2] - movq QWORD ptr [esi+ecx*2], mm1 // write des[2] - - paddw mm4, round_values // + 128 - paddw mm5, round_values // + 128 - - psrlw mm4, 8 - psrlw mm5, 8 - - packuswb mm4, mm5 // des[3] - movq QWORD ptr [edi], mm4 // write des[3] - - // mm0, mm2 --- Src[3] - - add edi, 8 - add esi, 8 - - sub edx, 8 - jg last_vs_3_5_loop - } -} - -/**************************************************************************** - * - * ROUTINE : vertical_band_1_2_scale_mmx - * - * INPUTS : unsigned char *dest : - * unsigned int dest_pitch : - * unsigned int dest_width : - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : 1 to 2 up-scaling of a band of pixels. - * - * SPECIAL NOTES : The routine uses the first line of the band below - * the current band. The function also has an "C" only - * version. - * - ****************************************************************************/ -static -void vertical_band_1_2_scale_mmx -( - unsigned char *dest, - unsigned int dest_pitch, - unsigned int dest_width -) -{ - __declspec(align(16))unsigned short four_ones[] = { 1, 1, 1, 1}; - - __asm - { - - mov esi, dest // Get the source and destination pointer - mov ecx, dest_pitch // Get the pitch size - - pxor mm7, mm7 // clear out mm7 - mov edx, dest_width // Loop counter - - vs_1_2_loop: - - movq mm0, [esi] // get Src[0] - movq mm1, [esi + ecx * 2] // get Src[1] - - movq mm2, mm0 // make copy before unpack - movq mm3, mm1 // make copy before unpack - - punpcklbw mm0, mm7 // low Src[0] - movq mm6, four_ones // mm6= 1, 1, 1, 1 - - punpcklbw mm1, mm7 // low Src[1] - paddw mm0, mm1 // low (a + b) - - punpckhbw mm2, mm7 // high Src[0] - paddw mm0, mm6 // low (a + b + 1) - - punpckhbw mm3, mm7 - paddw mm2, mm3 // high (a + b ) - - psraw mm0, 1 // low (a + b +1 )/2 - paddw mm2, mm6 // high (a + b + 1) - - psraw mm2, 1 // high (a + b + 1)/2 - packuswb mm0, mm2 // pack results - - movq [esi+ecx], mm0 // write out eight bytes - add esi, 8 - - sub edx, 8 - jg vs_1_2_loop - } - -} - -/**************************************************************************** - * - * ROUTINE : last_vertical_band_1_2_scale_mmx - * - * INPUTS : unsigned char *dest : - * unsigned int dest_pitch : - * unsigned int dest_width : - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : 1 to 2 up-scaling of band of pixels. - * - * SPECIAL NOTES : The routine uses the first line of the band below - * the current band. The function also has an "C" only - * version. - * - ****************************************************************************/ -static -void last_vertical_band_1_2_scale_mmx -( - unsigned char *dest, - unsigned int dest_pitch, - unsigned int dest_width -) -{ - __asm - { - mov esi, dest // Get the source and destination pointer - mov ecx, dest_pitch // Get the pitch size - - mov edx, dest_width // Loop counter - - last_vs_1_2_loop: - - movq mm0, [esi] // get Src[0] - movq [esi+ecx], mm0 // write out eight bytes - - add esi, 8 - sub edx, 8 - - jg last_vs_1_2_loop - } -} - -/**************************************************************************** - * - * ROUTINE : horizontal_line_1_2_scale - * - * INPUTS : const unsigned char *source : - * unsigned int source_width : - * unsigned char *dest : - * unsigned int dest_width : - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : 1 to 2 up-scaling of a horizontal line of pixels. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -static -void horizontal_line_1_2_scale_mmx -( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - __declspec(align(16))unsigned short four_ones[] = { 1, 1, 1, 1}; - - (void) dest_width; - - __asm - { - mov esi, source - mov edi, dest - - pxor mm7, mm7 - movq mm6, four_ones - - mov ecx, source_width - - hs_1_2_loop: - - movq mm0, [esi] - movq mm1, [esi+1] - - movq mm2, mm0 - movq mm3, mm1 - - movq mm4, mm0 - punpcklbw mm0, mm7 - - punpcklbw mm1, mm7 - paddw mm0, mm1 - - paddw mm0, mm6 - punpckhbw mm2, mm7 - - punpckhbw mm3, mm7 - paddw mm2, mm3 - - paddw mm2, mm6 - psraw mm0, 1 - - psraw mm2, 1 - packuswb mm0, mm2 - - movq mm2, mm4 - punpcklbw mm2, mm0 - - movq [edi], mm2 - punpckhbw mm4, mm0 - - movq [edi+8], mm4 - add esi, 8 - - add edi, 16 - sub ecx, 8 - - cmp ecx, 8 - jg hs_1_2_loop - -// last eight pixel - - movq mm0, [esi] - movq mm1, mm0 - - movq mm2, mm0 - movq mm3, mm1 - - psrlq mm1, 8 - psrlq mm3, 56 - - psllq mm3, 56 - por mm1, mm3 - - movq mm3, mm1 - movq mm4, mm0 - - punpcklbw mm0, mm7 - punpcklbw mm1, mm7 - - paddw mm0, mm1 - paddw mm0, mm6 - - punpckhbw mm2, mm7 - punpckhbw mm3, mm7 - - paddw mm2, mm3 - paddw mm2, mm6 - - psraw mm0, 1 - psraw mm2, 1 - - packuswb mm0, mm2 - movq mm2, mm4 - - punpcklbw mm2, mm0 - movq [edi], mm2 - - punpckhbw mm4, mm0 - movq [edi+8], mm4 - } -} - - - - - - -/**************************************************************************** - * - * ROUTINE : horizontal_line_5_4_scale_mmx - * - * INPUTS : const unsigned char *source : Pointer to source data. - * unsigned int source_width : Stride of source. - * unsigned char *dest : Pointer to destination data. - * unsigned int dest_width : Stride of destination (NOT USED). - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Copies horizontal line of pixels from source to - * destination scaling up by 4 to 5. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -static -void horizontal_line_5_4_scale_mmx -( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - - __declspec(align(16)) const unsigned short const54_2[] = { 0, 64, 128, 192 }; - __declspec(align(16)) const unsigned short const54_1[] = {256, 192, 128, 64 }; - __declspec(align(16)) unsigned short round_values[] = { 128, 128, 128, 128 }; - /* - unsigned i; - unsigned int a, b, c, d, e; - unsigned char *des = dest; - const unsigned char *src = source; - - (void) dest_width; - - for ( i=0; i<source_width; i+=5 ) - { - a = src[0]; - b = src[1]; - c = src[2]; - d = src[3]; - e = src[4]; - - des[0] = a; - des[1] = ((b*192 + c* 64 + 128)>>8); - des[2] = ((c*128 + d*128 + 128)>>8); - des[3] = ((d* 64 + e*192 + 128)>>8); - - src += 5; - des += 4; - } - */ - __asm - { - - mov esi, source ; - mov edi, dest ; - - mov ecx, source_width ; - movq mm5, const54_1 ; - - pxor mm7, mm7 ; - movq mm6, const54_2 ; - - movq mm4, round_values ; - lea edx, [esi+ecx] ; - horizontal_line_5_4_loop: - - movq mm0, QWORD PTR [esi] ; - 00 01 02 03 04 05 06 07 - movq mm1, mm0 ; - 00 01 02 03 04 05 06 07 - - psrlq mm0, 8 ; - 01 02 03 04 05 06 07 xx - punpcklbw mm1, mm7 ; - xx 00 xx 01 xx 02 xx 03 - - punpcklbw mm0, mm7 ; - xx 01 xx 02 xx 03 xx 04 - pmullw mm1, mm5 - - pmullw mm0, mm6 - add esi, 5 - - add edi, 4 - paddw mm1, mm0 - - paddw mm1, mm4 - psrlw mm1, 8 - - cmp esi, edx - packuswb mm1, mm7 - - movd DWORD PTR [edi-4], mm1 - - jl horizontal_line_5_4_loop - - } - -} - -static -void vertical_band_5_4_scale_mmx(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) -{ - - __declspec(align(16)) const unsigned short one_fourths[] = { 64, 64, 64, 64 }; - __declspec(align(16)) const unsigned short two_fourths[] = { 128, 128, 128, 128 }; - __declspec(align(16)) const unsigned short three_fourths[] = { 192, 192, 192, 192 }; - - __declspec(align(16)) unsigned short round_values[] = { 128, 128, 128, 128 }; - __asm - { - push ebx - - mov esi, source // Get the source and destination pointer - mov ecx, src_pitch // Get the pitch size - - mov edi, dest // tow lines below - pxor mm7, mm7 // clear out mm7 - - mov edx, dest_pitch // Loop counter - mov ebx, dest_width - - vs_5_4_loop: - - movd mm0, DWORD ptr [esi] // src[0]; - movd mm1, DWORD ptr [esi+ecx] // src[1]; - - movd mm2, DWORD ptr [esi+ecx*2] - lea eax, [esi+ecx*2] // - - punpcklbw mm1, mm7 - punpcklbw mm2, mm7 - - movq mm3, mm2 - pmullw mm1, three_fourths - - pmullw mm2, one_fourths - movd mm4, [eax+ecx] - - pmullw mm3, two_fourths - punpcklbw mm4, mm7 - - movq mm5, mm4 - pmullw mm4, two_fourths - - paddw mm1, mm2 - movd mm6, [eax+ecx*2] - - pmullw mm5, one_fourths - paddw mm1, round_values; - - paddw mm3, mm4 - psrlw mm1, 8 - - punpcklbw mm6, mm7 - paddw mm3, round_values - - pmullw mm6, three_fourths - psrlw mm3, 8 - - packuswb mm1, mm7 - packuswb mm3, mm7 - - movd DWORD PTR [edi], mm0 - movd DWORD PTR [edi+edx], mm1 - - - paddw mm5, mm6 - movd DWORD PTR [edi+edx*2], mm3 - - lea eax, [edi+edx*2] - paddw mm5, round_values - - psrlw mm5, 8 - add edi, 4 - - packuswb mm5, mm7 - movd DWORD PTR [eax+edx], mm5 - - add esi, 4 - sub ebx, 4 - - jg vs_5_4_loop - - pop ebx - } -} - - - -static -void horizontal_line_5_3_scale_mmx -( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - __declspec(align(16)) const unsigned short const53_1[] = { 0, 85, 171, 0 }; - __declspec(align(16)) const unsigned short const53_2[] = {256, 171, 85, 0 }; - __declspec(align(16)) unsigned short round_values[] = { 128, 128, 128, 128 }; - __asm - { - - mov esi, source ; - mov edi, dest ; - - mov ecx, source_width ; - movq mm5, const53_1 ; - - pxor mm7, mm7 ; - movq mm6, const53_2 ; - - movq mm4, round_values ; - lea edx, [esi+ecx-5] ; - horizontal_line_5_3_loop: - - movq mm0, QWORD PTR [esi] ; - 00 01 02 03 04 05 06 07 - movq mm1, mm0 ; - 00 01 02 03 04 05 06 07 - - psllw mm0, 8 ; - xx 00 xx 02 xx 04 xx 06 - psrlw mm1, 8 ; - 01 xx 03 xx 05 xx 07 xx - - psrlw mm0, 8 ; - 00 xx 02 xx 04 xx 06 xx - psllq mm1, 16 ; - xx xx 01 xx 03 xx 05 xx - - pmullw mm0, mm6 - - pmullw mm1, mm5 - add esi, 5 - - add edi, 3 - paddw mm1, mm0 - - paddw mm1, mm4 - psrlw mm1, 8 - - cmp esi, edx - packuswb mm1, mm7 - - movd DWORD PTR [edi-3], mm1 - jl horizontal_line_5_3_loop - -//exit condition - movq mm0, QWORD PTR [esi] ; - 00 01 02 03 04 05 06 07 - movq mm1, mm0 ; - 00 01 02 03 04 05 06 07 - - psllw mm0, 8 ; - xx 00 xx 02 xx 04 xx 06 - psrlw mm1, 8 ; - 01 xx 03 xx 05 xx 07 xx - - psrlw mm0, 8 ; - 00 xx 02 xx 04 xx 06 xx - psllq mm1, 16 ; - xx xx 01 xx 03 xx 05 xx - - pmullw mm0, mm6 - - pmullw mm1, mm5 - paddw mm1, mm0 - - paddw mm1, mm4 - psrlw mm1, 8 - - packuswb mm1, mm7 - movd eax, mm1 - - mov edx, eax - shr edx, 16 - - mov WORD PTR[edi], ax - mov BYTE PTR[edi+2], dl - - } - -} - - -static -void vertical_band_5_3_scale_mmx(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) -{ - __declspec(align(16)) unsigned short round_values[] = { 128, 128, 128, 128 }; - __declspec(align(16)) const unsigned short one_thirds[] = { 85, 85, 85, 85 }; - __declspec(align(16)) const unsigned short two_thirds[] = { 171, 171, 171, 171 }; - - __asm - { - push ebx - - mov esi, source // Get the source and destination pointer - mov ecx, src_pitch // Get the pitch size - - mov edi, dest // tow lines below - pxor mm7, mm7 // clear out mm7 - - mov edx, dest_pitch // Loop counter - movq mm5, one_thirds - - movq mm6, two_thirds - mov ebx, dest_width; - - vs_5_3_loop: - - movd mm0, DWORD ptr [esi] // src[0]; - movd mm1, DWORD ptr [esi+ecx] // src[1]; - - movd mm2, DWORD ptr [esi+ecx*2] - lea eax, [esi+ecx*2] // - - punpcklbw mm1, mm7 - punpcklbw mm2, mm7 - - pmullw mm1, mm5 - pmullw mm2, mm6 - - movd mm3, DWORD ptr [eax+ecx] - movd mm4, DWORD ptr [eax+ecx*2] - - punpcklbw mm3, mm7 - punpcklbw mm4, mm7 - - pmullw mm3, mm6 - pmullw mm4, mm5 - - - movd DWORD PTR [edi], mm0 - paddw mm1, mm2 - - paddw mm1, round_values - psrlw mm1, 8 - - packuswb mm1, mm7 - paddw mm3, mm4 - - paddw mm3, round_values - movd DWORD PTR [edi+edx], mm1 - - psrlw mm3, 8 - packuswb mm3, mm7 - - movd DWORD PTR [edi+edx*2], mm3 - - - add edi, 4 - add esi, 4 - - sub ebx, 4 - jg vs_5_3_loop - - pop ebx - } -} - - - - -/**************************************************************************** - * - * ROUTINE : horizontal_line_2_1_scale - * - * INPUTS : const unsigned char *source : - * unsigned int source_width : - * unsigned char *dest : - * unsigned int dest_width : - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : 1 to 2 up-scaling of a horizontal line of pixels. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -static -void horizontal_line_2_1_scale_mmx -( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - (void) dest_width; - - __asm - { - mov esi, source - mov edi, dest - - pxor mm7, mm7 - mov ecx, dest_width - - xor edx, edx - hs_2_1_loop: - - movq mm0, [esi+edx*2] - psllw mm0, 8 - - psrlw mm0, 8 - packuswb mm0, mm7 - - movd DWORD Ptr [edi+edx], mm0; - add edx, 4 - - cmp edx, ecx - jl hs_2_1_loop - - } -} - - - -static -void vertical_band_2_1_scale_mmx(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) -{ - vpx_memcpy(dest, source, dest_width); -} - - - -static -void vertical_band_2_1_scale_i_mmx(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) -{ - - __declspec(align(16)) const unsigned short three_sixteenths[] = { 48, 48, 48, 48 }; - __declspec(align(16)) const unsigned short ten_sixteenths[] = { 160, 160, 160, 160 }; - __declspec(align(16)) unsigned short round_values[] = { 128, 128, 128, 128 }; - __asm - { - mov esi, source - mov edi, dest - - mov eax, src_pitch - mov edx, dest_width - - pxor mm7, mm7 - sub esi, eax //back one line - - - lea ecx, [esi+edx]; - movq mm6, round_values; - - movq mm5, three_sixteenths; - movq mm4, ten_sixteenths; - - vs_2_1_i_loop: - movd mm0, [esi] // - movd mm1, [esi+eax] // - - movd mm2, [esi+eax*2] // - punpcklbw mm0, mm7 - - pmullw mm0, mm5 - punpcklbw mm1, mm7 - - pmullw mm1, mm4 - punpcklbw mm2, mm7 - - pmullw mm2, mm5 - paddw mm0, round_values - - paddw mm1, mm2 - paddw mm0, mm1 - - psrlw mm0, 8 - packuswb mm0, mm7 - - movd DWORD PTR [edi], mm0 - add esi, 4 - - add edi, 4; - cmp esi, ecx - jl vs_2_1_i_loop - - } -} - -void -register_mmxscalers(void) -{ - vp8_horizontal_line_1_2_scale = horizontal_line_1_2_scale_mmx; - vp8_vertical_band_1_2_scale = vertical_band_1_2_scale_mmx; - vp8_last_vertical_band_1_2_scale = last_vertical_band_1_2_scale_mmx; - vp8_horizontal_line_3_5_scale = horizontal_line_3_5_scale_mmx; - vp8_vertical_band_3_5_scale = vertical_band_3_5_scale_mmx; - vp8_last_vertical_band_3_5_scale = last_vertical_band_3_5_scale_mmx; - vp8_horizontal_line_4_5_scale = horizontal_line_4_5_scale_mmx; - vp8_vertical_band_4_5_scale = vertical_band_4_5_scale_mmx; - vp8_last_vertical_band_4_5_scale = last_vertical_band_4_5_scale_mmx; - - vp8_horizontal_line_3_4_scale = vp8cx_horizontal_line_3_4_scale_c; - vp8_vertical_band_3_4_scale = vp8cx_vertical_band_3_4_scale_c; - vp8_last_vertical_band_3_4_scale = vp8cx_last_vertical_band_3_4_scale_c; - vp8_horizontal_line_2_3_scale = vp8cx_horizontal_line_2_3_scale_c; - vp8_vertical_band_2_3_scale = vp8cx_vertical_band_2_3_scale_c; - vp8_last_vertical_band_2_3_scale = vp8cx_last_vertical_band_2_3_scale_c; - - - - vp8_vertical_band_5_4_scale = vertical_band_5_4_scale_mmx; - vp8_vertical_band_5_3_scale = vertical_band_5_3_scale_mmx; - vp8_vertical_band_2_1_scale = vertical_band_2_1_scale_mmx; - vp8_vertical_band_2_1_scale_i = vertical_band_2_1_scale_i_mmx; - vp8_horizontal_line_2_1_scale = horizontal_line_2_1_scale_mmx; - vp8_horizontal_line_5_3_scale = horizontal_line_5_3_scale_mmx; - vp8_horizontal_line_5_4_scale = horizontal_line_5_4_scale_mmx; - -} diff --git a/vpx_scale/intel_linux/scalesystemdependant.c b/vpx_scale/intel_linux/scalesystemdependant.c deleted file mode 100644 index eab741f83..000000000 --- a/vpx_scale/intel_linux/scalesystemdependant.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/**************************************************************************** -* -* Module Title : system_dependant.c -* -* Description : Miscellaneous system dependant functions -* -****************************************************************************/ - -/**************************************************************************** -* Header Files -****************************************************************************/ -#include "vpx_scale/vpxscale.h" -#include "cpuidlib.h" - -/**************************************************************************** -* Imports -*****************************************************************************/ -extern void register_generic_scalers(void); -extern void register_mmxscalers(void); - -/**************************************************************************** - * - * ROUTINE : post_proc_machine_specific_config - * - * INPUTS : UINT32 Version : Codec version number. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Checks for machine specifc features such as MMX support - * sets appropriate flags and function pointers. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -void -vp8_scale_machine_specific_config(void) -{ - // If MMX supported then set to use MMX versions of functions else - // use original 'C' versions. - int mmx_enabled; - int xmm_enabled; - int wmt_enabled; - - vpx_get_processor_flags(&mmx_enabled, &xmm_enabled, &wmt_enabled); - - if (mmx_enabled || xmm_enabled || wmt_enabled) - { - register_mmxscalers(); - } - else - { - vp8_horizontal_line_1_2_scale = vp8cx_horizontal_line_1_2_scale_c; - vp8_vertical_band_1_2_scale = vp8cx_vertical_band_1_2_scale_c; - vp8_last_vertical_band_1_2_scale = vp8cx_last_vertical_band_1_2_scale_c; - vp8_horizontal_line_3_5_scale = vp8cx_horizontal_line_3_5_scale_c; - vp8_vertical_band_3_5_scale = vp8cx_vertical_band_3_5_scale_c; - vp8_last_vertical_band_3_5_scale = vp8cx_last_vertical_band_3_5_scale_c; - vp8_horizontal_line_3_4_scale = vp8cx_horizontal_line_3_4_scale_c; - vp8_vertical_band_3_4_scale = vp8cx_vertical_band_3_4_scale_c; - vp8_last_vertical_band_3_4_scale = vp8cx_last_vertical_band_3_4_scale_c; - vp8_horizontal_line_2_3_scale = vp8cx_horizontal_line_2_3_scale_c; - vp8_vertical_band_2_3_scale = vp8cx_vertical_band_2_3_scale_c; - vp8_last_vertical_band_2_3_scale = vp8cx_last_vertical_band_2_3_scale_c; - vp8_horizontal_line_4_5_scale = vp8cx_horizontal_line_4_5_scale_c; - vp8_vertical_band_4_5_scale = vp8cx_vertical_band_4_5_scale_c; - vp8_last_vertical_band_4_5_scale = vp8cx_last_vertical_band_4_5_scale_c; - - - vp8_vertical_band_5_4_scale = vp8cx_vertical_band_5_4_scale_c; - vp8_vertical_band_5_3_scale = vp8cx_vertical_band_5_3_scale_c; - vp8_vertical_band_2_1_scale = vp8cx_vertical_band_2_1_scale_c; - vp8_vertical_band_2_1_scale_i = vp8cx_vertical_band_2_1_scale_i_c; - vp8_horizontal_line_2_1_scale = vp8cx_horizontal_line_2_1_scale_c; - vp8_horizontal_line_5_3_scale = vp8cx_horizontal_line_5_3_scale_c; - vp8_horizontal_line_5_4_scale = vp8cx_horizontal_line_5_4_scale_c; - - } -} diff --git a/vpx_scale/leapster/doptsystemdependant_lf.c b/vpx_scale/leapster/doptsystemdependant_lf.c deleted file mode 100644 index 7cbb1c555..000000000 --- a/vpx_scale/leapster/doptsystemdependant_lf.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/**************************************************************************** -* -* Module Title : system_dependant.c -* -* Description : Miscellaneous system dependant functions -* -****************************************************************************/ - -/**************************************************************************** -* Header Files -****************************************************************************/ -#include "vpx_scale/vpxscale.h" - -/**************************************************************************** -* Imports -*****************************************************************************/ -extern int register_generic_scalers(void); -extern int de_register_generic_scalers(void); - -/**************************************************************************** - * - * ROUTINE : vp8_scale_machine_specific_config - * - * INPUTS : UINT32 Version : Codec version number. - * - * OUTPUTS : None. - * - * RETURNS : int - * - * FUNCTION : Checks for machine specifc features such as MMX support - * sets appropriate flags and function pointers. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -int -vp8_scale_machine_specific_config() -{ - return register_generic_scalers(); -} - -/**************************************************************************** - * - * ROUTINE : vp8_scale_machine_specific_config - * - * INPUTS : UINT32 Version : Codec version number. - * - * OUTPUTS : None. - * - * RETURNS : int - * - * FUNCTION : Resets the funtion pointers and deallocates memory. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -int -scale_machine_specific_de_config() -{ - return de_register_generic_scalers(); -} diff --git a/vpx_scale/leapster/gen_scalers_lf.c b/vpx_scale/leapster/gen_scalers_lf.c deleted file mode 100644 index f1ee056ea..000000000 --- a/vpx_scale/leapster/gen_scalers_lf.c +++ /dev/null @@ -1,522 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/**************************************************************************** - * - * Module Title : gen_scalers.c - * - * Description : Generic image scaling functions. - * - ***************************************************************************/ - -/**************************************************************************** -* Header Files -****************************************************************************/ -#include "vpx_scale/vpxscale.h" - -/**************************************************************************** -* Imports -****************************************************************************/ - -/**************************************************************************** - * - * ROUTINE : vp8cx_horizontal_line_4_5_scale_c - * - * INPUTS : const unsigned char *source : Pointer to source data. - * unsigned int source_width : Stride of source. - * unsigned char *dest : Pointer to destination data. - * unsigned int dest_width : Stride of destination (NOT USED). - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Copies horizontal line of pixels from source to - * destination scaling up by 4 to 5. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -static -void vp8cx_horizontal_line_4_5_scale_c -( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - unsigned i; - unsigned int a, b, c; - unsigned char *des = dest; - const unsigned char *src = source; - - (void) dest_width; - - for (i = 0; i < source_width - 4; i += 4) - { - a = src[0]; - b = src[1]; - des [0] = (unsigned char) a; - des [1] = (unsigned char)((a * 51 + 205 * b + 128) >> 8); - c = src[2] * 154; - a = src[3]; - des [2] = (unsigned char)((b * 102 + c + 128) >> 8); - des [3] = (unsigned char)((c + 102 * a + 128) >> 8); - b = src[4]; - des [4] = (unsigned char)((a * 205 + 51 * b + 128) >> 8); - - src += 4; - des += 5; - } - - a = src[0]; - b = src[1]; - des [0] = (unsigned char)(a); - des [1] = (unsigned char)((a * 51 + 205 * b + 128) >> 8); - c = src[2] * 154; - a = src[3]; - des [2] = (unsigned char)((b * 102 + c + 128) >> 8); - des [3] = (unsigned char)((c + 102 * a + 128) >> 8); - des [4] = (unsigned char)(a); - -} - -/**************************************************************************** - * - * ROUTINE : vp8cx_vertical_band_4_5_scale_c - * - * INPUTS : unsigned char *dest : Pointer to destination data. - * unsigned int dest_pitch : Stride of destination data. - * unsigned int dest_width : Width of destination data. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Scales vertical band of pixels by scale 4 to 5. The - * height of the band scaled is 4-pixels. - * - * SPECIAL NOTES : The routine uses the first line of the band below - * the current band. - * - ****************************************************************************/ -static -void vp8cx_vertical_band_4_5_scale_c(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) -{ - unsigned int i; - unsigned int a, b, c, d; - unsigned char *des = dest; - - for (i = 0; i < dest_width; i++) - { - a = des [0]; - b = des [dest_pitch]; - - des[dest_pitch] = (unsigned char)((a * 51 + 205 * b + 128) >> 8); - - c = des[dest_pitch*2] * 154; - d = des[dest_pitch*3]; - - des [dest_pitch*2] = (unsigned char)((b * 102 + c + 128) >> 8); - des [dest_pitch*3] = (unsigned char)((c + 102 * d + 128) >> 8); - - // First line in next band - a = des [dest_pitch * 5]; - des [dest_pitch * 4] = (unsigned char)((d * 205 + 51 * a + 128) >> 8); - - des ++; - } -} - -/**************************************************************************** - * - * ROUTINE : vp8cx_last_vertical_band_4_5_scale_c - * - * INPUTS : unsigned char *dest : Pointer to destination data. - * unsigned int dest_pitch : Stride of destination data. - * unsigned int dest_width : Width of destination data. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Scales last vertical band of pixels by scale 4 to 5. The - * height of the band scaled is 4-pixels. - * - * SPECIAL NOTES : The routine does not have available the first line of - * the band below the current band, since this is the - * last band. - * - ****************************************************************************/ -static -void vp8cx_last_vertical_band_4_5_scale_c(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) -{ - unsigned int i; - unsigned int a, b, c, d; - unsigned char *des = dest; - - for (i = 0; i < dest_width; ++i) - { - a = des[0]; - b = des[dest_pitch]; - - des[dest_pitch] = (unsigned char)((a * 51 + 205 * b + 128) >> 8); - - c = des[dest_pitch*2] * 154; - d = des[dest_pitch*3]; - - des [dest_pitch*2] = (unsigned char)((b * 102 + c + 128) >> 8); - des [dest_pitch*3] = (unsigned char)((c + 102 * d + 128) >> 8); - - // No other line for interplation of this line, so .. - des[dest_pitch*4] = (unsigned char) d; - - des++; - } -} - -/**************************************************************************** - * - * ROUTINE : vp8cx_horizontal_line_3_5_scale_c - * - * INPUTS : const unsigned char *source : Pointer to source data. - * unsigned int source_width : Stride of source. - * unsigned char *dest : Pointer to destination data. - * unsigned int dest_width : Stride of destination (NOT USED). - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Copies horizontal line of pixels from source to - * destination scaling up by 3 to 5. - * - * SPECIAL NOTES : None. - * - * - ****************************************************************************/ -static -void vp8cx_horizontal_line_3_5_scale_c -( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - unsigned int i; - unsigned int a, b, c; - unsigned char *des = dest; - const unsigned char *src = source; - - (void) dest_width; - - for (i = 0; i < source_width - 3; i += 3) - { - a = src[0]; - b = src[1]; - des [0] = (unsigned char)(a); - des [1] = (unsigned char)((a * 102 + 154 * b + 128) >> 8); - - c = src[2] ; - des [2] = (unsigned char)((b * 205 + c * 51 + 128) >> 8); - des [3] = (unsigned char)((b * 51 + c * 205 + 128) >> 8); - - a = src[3]; - des [4] = (unsigned char)((c * 154 + a * 102 + 128) >> 8); - - src += 3; - des += 5; - } - - a = src[0]; - b = src[1]; - des [0] = (unsigned char)(a); - - des [1] = (unsigned char)((a * 102 + 154 * b + 128) >> 8); - c = src[2] ; - des [2] = (unsigned char)((b * 205 + c * 51 + 128) >> 8); - des [3] = (unsigned char)((b * 51 + c * 205 + 128) >> 8); - - des [4] = (unsigned char)(c); -} - -/**************************************************************************** - * - * ROUTINE : vp8cx_vertical_band_3_5_scale_c - * - * INPUTS : unsigned char *dest : Pointer to destination data. - * unsigned int dest_pitch : Stride of destination data. - * unsigned int dest_width : Width of destination data. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Scales vertical band of pixels by scale 3 to 5. The - * height of the band scaled is 3-pixels. - * - * SPECIAL NOTES : The routine uses the first line of the band below - * the current band. - * - ****************************************************************************/ -static -void vp8cx_vertical_band_3_5_scale_c(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) -{ - unsigned int i; - unsigned int a, b, c; - unsigned char *des = dest; - - for (i = 0; i < dest_width; i++) - { - a = des [0]; - b = des [dest_pitch]; - des [dest_pitch] = (unsigned char)((a * 102 + 154 * b + 128) >> 8); - - c = des[dest_pitch*2]; - des [dest_pitch*2] = (unsigned char)((b * 205 + c * 51 + 128) >> 8); - des [dest_pitch*3] = (unsigned char)((b * 51 + c * 205 + 128) >> 8); - - // First line in next band... - a = des [dest_pitch * 5]; - des [dest_pitch * 4] = (unsigned char)((c * 154 + a * 102 + 128) >> 8); - - des++; - } -} - -/**************************************************************************** - * - * ROUTINE : vp8cx_last_vertical_band_3_5_scale_c - * - * INPUTS : unsigned char *dest : Pointer to destination data. - * unsigned int dest_pitch : Stride of destination data. - * unsigned int dest_width : Width of destination data. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Scales last vertical band of pixels by scale 3 to 5. The - * height of the band scaled is 3-pixels. - * - * SPECIAL NOTES : The routine does not have available the first line of - * the band below the current band, since this is the - * last band. - * - ****************************************************************************/ -static -void vp8cx_last_vertical_band_3_5_scale_c(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) -{ - unsigned int i; - unsigned int a, b, c; - unsigned char *des = dest; - - for (i = 0; i < dest_width; ++i) - { - a = des [0]; - b = des [dest_pitch]; - - des [ dest_pitch ] = (unsigned char)((a * 102 + 154 * b + 128) >> 8); - - c = des[dest_pitch*2]; - des [dest_pitch*2] = (unsigned char)((b * 205 + c * 51 + 128) >> 8); - des [dest_pitch*3] = (unsigned char)((b * 51 + c * 205 + 128) >> 8); - - // No other line for interplation of this line, so .. - des [ dest_pitch * 4 ] = (unsigned char)(c) ; - - des++; - } -} - -/**************************************************************************** - * - * ROUTINE : vp8cx_horizontal_line_1_2_scale_c - * - * INPUTS : const unsigned char *source : Pointer to source data. - * unsigned int source_width : Stride of source. - * unsigned char *dest : Pointer to destination data. - * unsigned int dest_width : Stride of destination (NOT USED). - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Copies horizontal line of pixels from source to - * destination scaling up by 1 to 2. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -static -void vp8cx_horizontal_line_1_2_scale_c -( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - unsigned int i; - unsigned int a, b; - unsigned char *des = dest; - const unsigned char *src = source; - - (void) dest_width; - - for (i = 0; i < source_width - 1; i += 1) - { - a = src[0]; - b = src[1]; - des [0] = (unsigned char)(a); - des [1] = (unsigned char)((a + b + 1) >> 1); - src += 1; - des += 2; - } - - a = src[0]; - des [0] = (unsigned char)(a); - des [1] = (unsigned char)(a); -} - -/**************************************************************************** - * - * ROUTINE : vp8cx_vertical_band_1_2_scale_c - * - * INPUTS : unsigned char *dest : Pointer to destination data. - * unsigned int dest_pitch : Stride of destination data. - * unsigned int dest_width : Width of destination data. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Scales vertical band of pixels by scale 1 to 2. The - * height of the band scaled is 1-pixel. - * - * SPECIAL NOTES : The routine uses the first line of the band below - * the current band. - * - ****************************************************************************/ -static -void vp8cx_vertical_band_1_2_scale_c(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) -{ - unsigned int i; - unsigned int a, b; - unsigned char *des = dest; - - for (i = 0; i < dest_width; i++) - { - a = des [0]; - b = des [dest_pitch * 2]; - - des[dest_pitch] = (unsigned char)((a + b + 1) >> 1); - - des++; - } -} - -/**************************************************************************** - * - * ROUTINE : vp8cx_last_vertical_band_1_2_scale_c - * - * INPUTS : unsigned char *dest : Pointer to destination data. - * unsigned int dest_pitch : Stride of destination data. - * unsigned int dest_width : Width of destination data. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Scales last vertical band of pixels by scale 1 to 2. The - * height of the band scaled is 1-pixel. - * - * SPECIAL NOTES : The routine does not have available the first line of - * the band below the current band, since this is the - * last band. - * - ****************************************************************************/ -static -void vp8cx_last_vertical_band_1_2_scale_c(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width) -{ - unsigned int i; - unsigned char *des = dest; - - for (i = 0; i < dest_width; ++i) - { - des[dest_pitch] = des[0]; - des++; - } -} - -#include "vpx_scale/vpxscale.h" -#include "vpx_mem/vpx_mem.h" - -struct vpxglobal_scalling_ptrs_t *g_scaling_ptrs = 0; - -int -register_generic_scalers(void) -{ - int rv = 0; - - g_scaling_ptrs = (struct vpxglobal_scalling_ptrs_t *)vpx_malloc(sizeof(struct vpxglobal_scalling_ptrs_t)); - - if (g_scaling_ptrs) - { - g_scaling_ptrs->vpxhorizontal_line_1_2_scale_t = vp8cx_horizontal_line_1_2_scale_c; - g_scaling_ptrs->vpxvertical_band_1_2_scale_t = vp8cx_vertical_band_1_2_scale_c; - g_scaling_ptrs->vpxlast_vertical_band_1_2_scale_t = vp8cx_last_vertical_band_1_2_scale_c; - g_scaling_ptrs->vpxhorizontal_line_3_5_scale_t = vp8cx_horizontal_line_3_5_scale_c; - g_scaling_ptrs->vpxvertical_band_3_5_scale_t = vp8cx_vertical_band_3_5_scale_c; - g_scaling_ptrs->vpxlast_vertical_band_3_5_scale_t = vp8cx_last_vertical_band_3_5_scale_c; - g_scaling_ptrs->vpxhorizontal_line_4_5_scale_t = vp8cx_horizontal_line_4_5_scale_c; - g_scaling_ptrs->vpxvertical_band_4_5_scale_t = vp8cx_vertical_band_4_5_scale_c; - g_scaling_ptrs->vpxlast_vertical_band_4_5_scale_t = vp8cx_last_vertical_band_4_5_scale_c; - } - else - { - rv = -1; - } - - /* - vp8_horizontal_line_1_2_scale = vp8cx_horizontal_line_1_2_scale_c; - vp8_vertical_band_1_2_scale = vp8cx_vertical_band_1_2_scale_c; - vp8_last_vertical_band_1_2_scale = vp8cx_last_vertical_band_1_2_scale_c; - vp8_horizontal_line_3_5_scale = vp8cx_horizontal_line_3_5_scale_c; - vp8_vertical_band_3_5_scale = vp8cx_vertical_band_3_5_scale_c; - vp8_last_vertical_band_3_5_scale = vp8cx_last_vertical_band_3_5_scale_c; - vp8_horizontal_line_4_5_scale = vp8cx_horizontal_line_4_5_scale_c; - vp8_vertical_band_4_5_scale = vp8cx_vertical_band_4_5_scale_c; - vp8_last_vertical_band_4_5_scale = vp8cx_last_vertical_band_4_5_scale_c; - */ - - return rv; -} - -int -de_register_generic_scalers(void) -{ - int rv = 0; - - if (g_scaling_ptrs) - { - vpx_free(g_scaling_ptrs); - g_scaling_ptrs = 0; - } - else - { - rv = -1; - } - - return rv; -} diff --git a/vpx_scale/leapster/vpxscale_lf.c b/vpx_scale/leapster/vpxscale_lf.c deleted file mode 100644 index 616ddf559..000000000 --- a/vpx_scale/leapster/vpxscale_lf.c +++ /dev/null @@ -1,891 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/**************************************************************************** - * - * Module Title : scale.c - * - * Description : Image scaling functions. - * - ***************************************************************************/ - -/**************************************************************************** -* Header Files -****************************************************************************/ -#include "stdlib.h" -#include "vpx_scale/vpxscale.h" -#include "vpx_mem/vpx_mem.h" -#include "vpx_scale/yv12config.h" -#include "codec_common_interface.h" - -/**************************************************************************** -* Exports -****************************************************************************/ -/* -void (*vp8_vertical_band_4_5_scale)(unsigned char * dest,unsigned int dest_pitch,unsigned int dest_width); -void (*vp8_last_vertical_band_4_5_scale)(unsigned char * dest,unsigned int dest_pitch,unsigned int dest_width); -void (*vp8_vertical_band_3_5_scale)(unsigned char * dest,unsigned int dest_pitch,unsigned int dest_width); -void (*vp8_last_vertical_band_3_5_scale)(unsigned char * dest,unsigned int dest_pitch,unsigned int dest_width); -void (*vp8_horizontal_line_1_2_scale)(const unsigned char * source,unsigned int source_width,unsigned char * dest,unsigned int dest_width); -void (*vp8_horizontal_line_3_5_scale)(const unsigned char * source,unsigned int source_width,unsigned char * dest,unsigned int dest_width); -void (*vp8_horizontal_line_4_5_scale)(const unsigned char * source,unsigned int source_width,unsigned char * dest,unsigned int dest_width); -void (*vp8_vertical_band_1_2_scale)(unsigned char * dest,unsigned int dest_pitch,unsigned int dest_width); -void (*vp8_last_vertical_band_1_2_scale)(unsigned char * dest,unsigned int dest_pitch,unsigned int dest_width); -*/ - - -typedef struct -{ - int expanded_frame_width; - int expanded_frame_height; - - int HScale; - int HRatio; - int VScale; - int VRatio; - - YV12_BUFFER_CONFIG *src_yuv_config; - YV12_BUFFER_CONFIG *dst_yuv_config; - -} SCALE_VARS; - - -/**************************************************************************** - * - * ROUTINE : horizontal_line_copy - * - * INPUTS : None - * - * - * OUTPUTS : None. - * - * RETURNS : None - * - * FUNCTION : 1 to 1 scaling up for a horizontal line of pixles - * - * SPECIAL NOTES : None. - * - * ERRORS : None. - * - ****************************************************************************/ -static -void horizontal_line_copy( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - duck_memcpy(dest, source, source_width); -} -/**************************************************************************** - * - * ROUTINE : null_scale - * - * INPUTS : None - * - * - * OUTPUTS : None. - * - * RETURNS : None - * - * FUNCTION : 1 to 1 scaling up for a vertical band - * - * SPECIAL NOTES : None. - * - * ERRORS : None. - * - ****************************************************************************/ -static -void null_scale( - unsigned char *dest, - unsigned int dest_pitch, - unsigned int dest_width -) -{ - return; -} - -/**************************************************************************** - * - * ROUTINE : scale1d_2t1_i - * - * INPUTS : const unsigned char *source : Pointer to data to be scaled. - * int source_step : Number of pixels to step on in source. - * unsigned int source_scale : Scale for source (UNUSED). - * unsigned int source_length : Length of source (UNUSED). - * unsigned char *dest : Pointer to output data array. - * int dest_step : Number of pixels to step on in destination. - * unsigned int dest_scale : Scale for destination (UNUSED). - * unsigned int dest_length : Length of destination. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Performs 2-to-1 interpolated scaling. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -static -void scale1d_2t1_i -( - const unsigned char *source, - int source_step, - unsigned int source_scale, - unsigned int source_length, - unsigned char *dest, - int dest_step, - unsigned int dest_scale, - unsigned int dest_length -) -{ - unsigned int i, j; - unsigned int temp; - - (void) source_length; - (void) source_scale; - (void) dest_scale; - - source_step *= 2; - dest[0] = source[0]; - - for (i = dest_step, j = source_step; i < dest_length * dest_step; i += dest_step, j += source_step) - { - temp = 8; - temp += 3 * source[j-source_step]; - temp += 10 * source[j]; - temp += 3 * source[j+source_step]; - temp >>= 4; - dest[i] = (char)(temp); - } -} - -/**************************************************************************** - * - * ROUTINE : scale1d_2t1_ps - * - * INPUTS : const unsigned char *source : Pointer to data to be scaled. - * int source_step : Number of pixels to step on in source. - * unsigned int source_scale : Scale for source (UNUSED). - * unsigned int source_length : Length of source (UNUSED). - * unsigned char *dest : Pointer to output data array. - * int dest_step : Number of pixels to step on in destination. - * unsigned int dest_scale : Scale for destination (UNUSED). - * unsigned int dest_length : Length of destination. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Performs 2-to-1 point subsampled scaling. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -static -void scale1d_2t1_ps -( - const unsigned char *source, - int source_step, - unsigned int source_scale, - unsigned int source_length, - unsigned char *dest, - int dest_step, - unsigned int dest_scale, - unsigned int dest_length -) -{ - unsigned int i, j; - - (void) source_length; - (void) source_scale; - (void) dest_scale; - - source_step *= 2; - j = 0; - - for (i = 0; i < dest_length * dest_step; i += dest_step, j += source_step) - dest[i] = source[j]; -} -/**************************************************************************** - * - * ROUTINE : scale1d_c - * - * INPUTS : const unsigned char *source : Pointer to data to be scaled. - * int source_step : Number of pixels to step on in source. - * unsigned int source_scale : Scale for source. - * unsigned int source_length : Length of source (UNUSED). - * unsigned char *dest : Pointer to output data array. - * int dest_step : Number of pixels to step on in destination. - * unsigned int dest_scale : Scale for destination. - * unsigned int dest_length : Length of destination. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Performs linear interpolation in one dimension. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -static -void scale1d_c -( - const unsigned char *source, - int source_step, - unsigned int source_scale, - unsigned int source_length, - unsigned char *dest, - int dest_step, - unsigned int dest_scale, - unsigned int dest_length -) -{ - unsigned int i; - unsigned int round_value = dest_scale / 2; - unsigned int left_modifier = dest_scale; - unsigned int right_modifier = 0; - unsigned char left_pixel = *source; - unsigned char right_pixel = *(source + source_step); - - (void) source_length; - - // These asserts are needed if there are boundary issues... - //assert ( dest_scale > source_scale ); - //assert ( (source_length-1) * dest_scale >= (dest_length-1) * source_scale ); - - for (i = 0; i < dest_length * dest_step; i += dest_step) - { - dest[i] = (char)((left_modifier * left_pixel + right_modifier * right_pixel + round_value) / dest_scale); - - right_modifier += source_scale; - - while (right_modifier > dest_scale) - { - right_modifier -= dest_scale; - source += source_step; - left_pixel = *source; - right_pixel = *(source + source_step); - } - - left_modifier = dest_scale - right_modifier; - } -} - -/**************************************************************************** - * - * ROUTINE : Scale2D - * - * INPUTS : const unsigned char *source : Pointer to data to be scaled. - * int source_pitch : Stride of source image. - * unsigned int source_width : Width of input image. - * unsigned int source_height : Height of input image. - * unsigned char *dest : Pointer to output data array. - * int dest_pitch : Stride of destination image. - * unsigned int dest_width : Width of destination image. - * unsigned int dest_height : Height of destination image. - * unsigned char *temp_area : Pointer to temp work area. - * unsigned char temp_area_height : Height of temp work area. - * unsigned int hscale : Horizontal scale factor numerator. - * unsigned int hratio : Horizontal scale factor denominator. - * unsigned int vscale : Vertical scale factor numerator. - * unsigned int vratio : Vertical scale factor denominator. - * unsigned int interlaced : Interlace flag. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Performs 2-tap linear interpolation in two dimensions. - * - * SPECIAL NOTES : Expansion is performed one band at a time to help with - * caching. - * - ****************************************************************************/ -static -void Scale2D -( - const unsigned char *source, - int source_pitch, - unsigned int source_width, - unsigned int source_height, - unsigned char *dest, - int dest_pitch, - unsigned int dest_width, - unsigned int dest_height, - unsigned char *temp_area, - unsigned char temp_area_height, - unsigned int hscale, - unsigned int hratio, - unsigned int vscale, - unsigned int vratio, - unsigned int interlaced -) -{ - unsigned int i, j, k; - unsigned int bands; - unsigned int dest_band_height; - unsigned int source_band_height; - - typedef void (*Scale1D)(const unsigned char * source, int source_step, unsigned int source_scale, unsigned int source_length, - unsigned char * dest, int dest_step, unsigned int dest_scale, unsigned int dest_length); - - Scale1D Scale1Dv = scale1d_c; - Scale1D Scale1Dh = scale1d_c; - - if (hscale == 2 && hratio == 1) - Scale1Dh = scale1d_2t1_ps; - - if (vscale == 2 && vratio == 1) - { - if (interlaced) - Scale1Dv = scale1d_2t1_ps; - else - Scale1Dv = scale1d_2t1_i; - } - - if (source_height == dest_height) - { - // for each band of the image - for (k = 0; k < dest_height; k++) - { - Scale1Dh(source, 1, hscale, source_width + 1, dest, 1, hratio, dest_width); - source += source_pitch; - dest += dest_pitch; - } - - return; - } - - if (dest_height > source_height) - { - dest_band_height = temp_area_height - 1; - source_band_height = dest_band_height * source_height / dest_height; - } - else - { - source_band_height = temp_area_height - 1; - dest_band_height = source_band_height * vratio / vscale; - } - - // first row needs to be done so that we can stay one row ahead for vertical zoom - Scale1Dh(source, 1, hscale, source_width + 1, temp_area, 1, hratio, dest_width); - - // for each band of the image - bands = (dest_height + dest_band_height - 1) / dest_band_height; - - for (k = 0; k < bands; k++) - { - // scale one band horizontally - for (i = 1; i < source_band_height + 1; i++) - { - if (k * source_band_height + i < source_height) - { - Scale1Dh(source + i * source_pitch, 1, hscale, source_width + 1, - temp_area + i * dest_pitch, 1, hratio, dest_width); - } - else // Duplicate the last row - { - // copy temp_area row 0 over from last row in the past - duck_memcpy(temp_area + i * dest_pitch, temp_area + (i - 1)*dest_pitch, dest_pitch); - } - } - - // scale one band vertically - for (j = 0; j < dest_width; j++) - { - Scale1Dv(&temp_area[j], dest_pitch, vscale, source_band_height + 1, - &dest[j], dest_pitch, vratio, dest_band_height); - } - - // copy temp_area row 0 over from last row in the past - duck_memcpy(temp_area, temp_area + source_band_height * dest_pitch, dest_pitch); - - // move to the next band - source += source_band_height * source_pitch; - dest += dest_band_height * dest_pitch; - } -} - -/**************************************************************************** - * - * ROUTINE : vp8_scale_frame - * - * INPUTS : YV12_BUFFER_CONFIG *src : Pointer to frame to be scaled. - * YV12_BUFFER_CONFIG *dst : Pointer to buffer to hold scaled frame. - * unsigned char *temp_area : Pointer to temp work area. - * unsigned char temp_area_height : Height of temp work area. - * unsigned int hscale : Horizontal scale factor numerator. - * unsigned int hratio : Horizontal scale factor denominator. - * unsigned int vscale : Vertical scale factor numerator. - * unsigned int vratio : Vertical scale factor denominator. - * unsigned int interlaced : Interlace flag. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Performs 2-tap linear interpolation in two dimensions. - * - * SPECIAL NOTES : Expansion is performed one band at a time to help with - * caching. - * - ****************************************************************************/ -void vp8_scale_frame -( - YV12_BUFFER_CONFIG *src, - YV12_BUFFER_CONFIG *dst, - unsigned char *temp_area, - unsigned char temp_height, - unsigned int hscale, - unsigned int hratio, - unsigned int vscale, - unsigned int vratio, - unsigned int interlaced -) -{ - int i; - int dw = (hscale - 1 + src->y_width * hratio) / hscale; - int dh = (vscale - 1 + src->y_height * vratio) / vscale; - - // call our internal scaling routines!! - Scale2D((unsigned char *) src->y_buffer, src->y_stride, src->y_width, src->y_height, - (unsigned char *) dst->y_buffer, dst->y_stride, dw, dh, - temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced); - - if (dw < (int)dst->y_width) - for (i = 0; i < dh; i++) - duck_memset(dst->y_buffer + i * dst->y_stride + dw - 1, dst->y_buffer[i*dst->y_stride+dw-2], dst->y_width - dw + 1); - - if (dh < (int)dst->y_height) - for (i = dh - 1; i < (int)dst->y_height; i++) - duck_memcpy(dst->y_buffer + i * dst->y_stride, dst->y_buffer + (dh - 2) * dst->y_stride, dst->y_width + 1); - - Scale2D((unsigned char *) src->u_buffer, src->uv_stride, src->uv_width, src->uv_height, - (unsigned char *) dst->u_buffer, dst->uv_stride, dw / 2, dh / 2, - temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced); - - if (dw / 2 < (int)dst->uv_width) - for (i = 0; i < dst->uv_height; i++) - duck_memset(dst->u_buffer + i * dst->uv_stride + dw / 2 - 1, dst->u_buffer[i*dst->uv_stride+dw/2-2], dst->uv_width - dw / 2 + 1); - - if (dh / 2 < (int)dst->uv_height) - for (i = dh / 2 - 1; i < (int)dst->y_height / 2; i++) - duck_memcpy(dst->u_buffer + i * dst->uv_stride, dst->u_buffer + (dh / 2 - 2)*dst->uv_stride, dst->uv_width); - - Scale2D((unsigned char *) src->v_buffer, src->uv_stride, src->uv_width, src->uv_height, - (unsigned char *) dst->v_buffer, dst->uv_stride, dw / 2, dh / 2, - temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced); - - if (dw / 2 < (int)dst->uv_width) - for (i = 0; i < dst->uv_height; i++) - duck_memset(dst->v_buffer + i * dst->uv_stride + dw / 2 - 1, dst->v_buffer[i*dst->uv_stride+dw/2-2], dst->uv_width - dw / 2 + 1); - - if (dh / 2 < (int) dst->uv_height) - for (i = dh / 2 - 1; i < (int)dst->y_height / 2; i++) - duck_memcpy(dst->v_buffer + i * dst->uv_stride, dst->v_buffer + (dh / 2 - 2)*dst->uv_stride, dst->uv_width); -} -/**************************************************************************** - * - * ROUTINE : any_ratio_2d_scale - * - * INPUTS : SCALE_INSTANCE *si : Pointer to post-processor instance (NOT USED). - * const unsigned char *source : Pointer to source image. - * unsigned int source_pitch : Stride of source image. - * unsigned int source_width : Width of source image. - * unsigned int source_height : Height of source image (NOT USED). - * unsigned char *dest : Pointer to destination image. - * unsigned int dest_pitch : Stride of destination image. - * unsigned int dest_width : Width of destination image. - * unsigned int dest_height : Height of destination image. - * - * OUTPUTS : None. - * - * RETURNS : int: 1 if image scaled, 0 if image could not be scaled. - * - * FUNCTION : Scale the image with changing apect ratio. - * - * SPECIAL NOTES : This scaling is a bi-linear scaling. Need to re-work the - * whole function for new scaling algorithm. - * - ****************************************************************************/ -static -int any_ratio_2d_scale -( - SCALE_VARS *si, - const unsigned char *source, - unsigned int source_pitch, - unsigned int source_width, - unsigned int source_height, - unsigned char *dest, - unsigned int dest_pitch, - unsigned int dest_width, - unsigned int dest_height -) -{ - unsigned int i, k; - unsigned int src_band_height = 0; - unsigned int dest_band_height = 0; - - // suggested scale factors - int hs = si->HScale; - int hr = si->HRatio; - int vs = si->VScale; - int vr = si->VRatio; - - // assume the ratios are scalable instead of should be centered - int ratio_scalable = 1; - - void (*horiz_line_scale)(const unsigned char *, unsigned int, unsigned char *, unsigned int) = NULL; - void (*vert_band_scale)(unsigned char *, unsigned int, unsigned int) = NULL; - void (*last_vert_band_scale)(unsigned char *, unsigned int, unsigned int) = NULL; - - (void) si; - - // find out the ratio for each direction - switch (hr * 10 / hs) - { - case 8: - // 4-5 Scale in Width direction - horiz_line_scale = g_scaling_ptrs->vpxhorizontal_line_4_5_scale_t; - break; - case 6: - // 3-5 Scale in Width direction - horiz_line_scale = g_scaling_ptrs->vpxhorizontal_line_3_5_scale_t; - break; - case 5: - // 1-2 Scale in Width direction - horiz_line_scale = g_scaling_ptrs->vpxhorizontal_line_1_2_scale_t; - break; - case 10: - // no scale in Width direction - horiz_line_scale = horizontal_line_copy; - break; - default: - // The ratio is not acceptable now - // throw("The ratio is not acceptable for now!"); - ratio_scalable = 0; - break; - } - - switch (vr * 10 / vs) - { - case 8: - // 4-5 Scale in vertical direction - vert_band_scale = g_scaling_ptrs->vpxvertical_band_4_5_scale_t; - last_vert_band_scale = g_scaling_ptrs->vpxlast_vertical_band_4_5_scale_t; - src_band_height = 4; - dest_band_height = 5; - break; - case 6: - // 3-5 Scale in vertical direction - vert_band_scale = g_scaling_ptrs->vpxvertical_band_3_5_scale_t; - last_vert_band_scale = g_scaling_ptrs->vpxlast_vertical_band_3_5_scale_t; - src_band_height = 3; - dest_band_height = 5; - break; - case 5: - // 1-2 Scale in vertical direction - vert_band_scale = g_scaling_ptrs->vpxvertical_band_1_2_scale_t; - last_vert_band_scale = g_scaling_ptrs->vpxlast_vertical_band_1_2_scale_t; - src_band_height = 1; - dest_band_height = 2; - break; - case 10: - // no scale in Width direction - vert_band_scale = null_scale; - last_vert_band_scale = null_scale; - src_band_height = 4; - dest_band_height = 4; - break; - default: - // The ratio is not acceptable now - // throw("The ratio is not acceptable for now!"); - ratio_scalable = 0; - break; - } - - if (ratio_scalable == 0) - return ratio_scalable; - - horiz_line_scale(source, source_width, dest, dest_width); - - // except last band - for (k = 0; k < (dest_height + dest_band_height - 1) / dest_band_height - 1; k++) - { - // scale one band horizontally - for (i = 1; i < src_band_height; i++) - { - horiz_line_scale(source + i * source_pitch, - source_width, - dest + i * dest_pitch, - dest_width); - } - - // first line of next band - horiz_line_scale(source + src_band_height * source_pitch, - source_width, - dest + dest_band_height * dest_pitch, - dest_width); - - // Vertical scaling is in place - vert_band_scale(dest, dest_pitch, dest_width); - - // Next band... - source += src_band_height * source_pitch; - dest += dest_band_height * dest_pitch; - } - - // scale one band horizontally - for (i = 1; i < src_band_height; i++) - { - horiz_line_scale(source + i * source_pitch, - source_width, - dest + i * dest_pitch, - dest_width); - } - - // Vertical scaling is in place - last_vert_band_scale(dest, dest_pitch, dest_width); - - return ratio_scalable; -} - -/**************************************************************************** - * - * ROUTINE : any_ratio_frame_scale - * - * INPUTS : SCALE_INSTANCE *si : Pointer to post-processor instance (NOT USED). - * unsigned char *frame_buffer : Pointer to source image. - * int YOffset : Offset from start of buffer to Y samples. - * int UVOffset : Offset from start of buffer to UV samples. - * - * OUTPUTS : None. - * - * RETURNS : int: 1 if image scaled, 0 if image could not be scaled. - * - * FUNCTION : Scale the image with changing apect ratio. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -static -int any_ratio_frame_scale(SCALE_VARS *scale_vars, int YOffset, int UVOffset) -{ - int i; - int ew; - int eh; - - // suggested scale factors - int hs = scale_vars->HScale; - int hr = scale_vars->HRatio; - int vs = scale_vars->VScale; - int vr = scale_vars->VRatio; - - int ratio_scalable = 1; - - int sw = (scale_vars->expanded_frame_width * hr + hs - 1) / hs; - int sh = (scale_vars->expanded_frame_height * vr + vs - 1) / vs; - int dw = scale_vars->expanded_frame_width; - int dh = scale_vars->expanded_frame_height; - YV12_BUFFER_CONFIG *src_yuv_config = scale_vars->src_yuv_config; - YV12_BUFFER_CONFIG *dst_yuv_config = scale_vars->dst_yuv_config; - - if (hr == 3) - ew = (sw + 2) / 3 * 3 * hs / hr; - else - ew = (sw + 7) / 8 * 8 * hs / hr; - - if (vr == 3) - eh = (sh + 2) / 3 * 3 * vs / vr; - else - eh = (sh + 7) / 8 * 8 * vs / vr; - - ratio_scalable = any_ratio_2d_scale(scale_vars, - (const unsigned char *)src_yuv_config->y_buffer, - src_yuv_config->y_stride, sw, sh, - (unsigned char *) dst_yuv_config->y_buffer + YOffset, - dst_yuv_config->y_stride, dw, dh); - - for (i = 0; i < eh; i++) - duck_memset(dst_yuv_config->y_buffer + YOffset + i * dst_yuv_config->y_stride + dw, 0, ew - dw); - - for (i = dh; i < eh; i++) - duck_memset(dst_yuv_config->y_buffer + YOffset + i * dst_yuv_config->y_stride, 0, ew); - - if (ratio_scalable == 0) - return ratio_scalable; - - sw = (sw + 1) >> 1; - sh = (sh + 1) >> 1; - dw = (dw + 1) >> 1; - dh = (dh + 1) >> 1; - - any_ratio_2d_scale(scale_vars, - (const unsigned char *)src_yuv_config->u_buffer, - src_yuv_config->y_stride / 2, sw, sh, - (unsigned char *)dst_yuv_config->u_buffer + UVOffset, - dst_yuv_config->uv_stride, dw, dh); - - any_ratio_2d_scale(scale_vars, - (const unsigned char *)src_yuv_config->v_buffer, - src_yuv_config->y_stride / 2, sw, sh, - (unsigned char *)dst_yuv_config->v_buffer + UVOffset, - dst_yuv_config->uv_stride, dw, dh); - - return ratio_scalable; -} - -/**************************************************************************** - * - * ROUTINE : center_image - * - * INPUTS : SCALE_INSTANCE *si : Pointer to post-processor instance. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Centers the image without scaling in the output buffer. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -static void -center_image(YV12_BUFFER_CONFIG *src_yuv_config, YV12_BUFFER_CONFIG *dst_yuv_config) -{ - int i; - int row_offset, col_offset; - char *src_data_pointer; - char *dst_data_pointer; - - // center values - row_offset = (dst_yuv_config->y_height - src_yuv_config->y_height) / 2; - col_offset = (dst_yuv_config->y_width - src_yuv_config->y_width) / 2; - - // Y's - src_data_pointer = src_yuv_config->y_buffer; - dst_data_pointer = (char *)dst_yuv_config->y_buffer + (row_offset * dst_yuv_config->y_stride) + col_offset; - - for (i = 0; i < src_yuv_config->y_height; i++) - { - duck_memcpy(dst_data_pointer, src_data_pointer, src_yuv_config->y_width); - dst_data_pointer += dst_yuv_config->y_stride; - src_data_pointer += src_yuv_config->y_stride; - } - - row_offset /= 2; - col_offset /= 2; - - // U's - src_data_pointer = src_yuv_config->u_buffer; - dst_data_pointer = (char *)dst_yuv_config->u_buffer + (row_offset * dst_yuv_config->uv_stride) + col_offset; - - for (i = 0; i < src_yuv_config->uv_height; i++) - { - duck_memcpy(dst_data_pointer, src_data_pointer, src_yuv_config->uv_width); - dst_data_pointer += dst_yuv_config->uv_stride; - src_data_pointer += src_yuv_config->uv_stride; - } - - // V's - src_data_pointer = src_yuv_config->v_buffer; - dst_data_pointer = (char *)dst_yuv_config->v_buffer + (row_offset * dst_yuv_config->uv_stride) + col_offset; - - for (i = 0; i < src_yuv_config->uv_height; i++) - { - duck_memcpy(dst_data_pointer, src_data_pointer, src_yuv_config->uv_width); - dst_data_pointer += dst_yuv_config->uv_stride; - src_data_pointer += src_yuv_config->uv_stride; - } -} - -/**************************************************************************** - * - * ROUTINE : scale_or_center - * - * INPUTS : SCALE_INSTANCE *si : Pointer to post-processor instance. - * - * - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Decides to scale or center image in scale buffer for blit - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -void -vp8_yv12_scale_or_center -( - YV12_BUFFER_CONFIG *src_yuv_config, - YV12_BUFFER_CONFIG *dst_yuv_config, - int expanded_frame_width, - int expanded_frame_height, - int scaling_mode, - int HScale, - int HRatio, - int VScale, - int VRatio -) -{ -// if ( ppi->post_processing_level ) - // update_umvborder ( ppi, frame_buffer ); - - - switch (scaling_mode) - { - case SCALE_TO_FIT: - case MAINTAIN_ASPECT_RATIO: - { - SCALE_VARS scale_vars; - // center values -#if 1 - int row = (dst_yuv_config->y_height - expanded_frame_height) / 2; - int col = (dst_yuv_config->y_width - expanded_frame_width) / 2; -// int YOffset = row * dst_yuv_config->y_width + col; -// int UVOffset = (row>>1) * dst_yuv_config->uv_width + (col>>1); - int YOffset = row * dst_yuv_config->y_stride + col; - int UVOffset = (row >> 1) * dst_yuv_config->uv_stride + (col >> 1); -#else - int row = (src_yuv_config->y_height - expanded_frame_height) / 2; - int col = (src_yuv_config->y_width - expanded_frame_width) / 2; - int YOffset = row * src_yuv_config->y_width + col; - int UVOffset = (row >> 1) * src_yuv_config->uv_width + (col >> 1); -#endif - - scale_vars.dst_yuv_config = dst_yuv_config; - scale_vars.src_yuv_config = src_yuv_config; - scale_vars.HScale = HScale; - scale_vars.HRatio = HRatio; - scale_vars.VScale = VScale; - scale_vars.VRatio = VRatio; - scale_vars.expanded_frame_width = expanded_frame_width; - scale_vars.expanded_frame_height = expanded_frame_height; - - // perform center and scale - any_ratio_frame_scale(&scale_vars, YOffset, UVOffset); - - break; - } - case CENTER: - center_image(src_yuv_config, dst_yuv_config); - break; - - default: - break; - } -} diff --git a/vpx_scale/leapster/yv12extend.c b/vpx_scale/leapster/yv12extend.c deleted file mode 100644 index 1cddd9540..000000000 --- a/vpx_scale/leapster/yv12extend.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/**************************************************************************** - * - * Module Title : yv12extend.c - * - * Description : - * - ***************************************************************************/ - -/**************************************************************************** -* Header Files -****************************************************************************/ -//#include <stdlib.h> -#include "vpx_scale/yv12config.h" -#include "vpx_mem/vpx_mem.h" - -/**************************************************************************** -* Exports -****************************************************************************/ - -/**************************************************************************** - * - ****************************************************************************/ -void -vp8_yv12_extend_frame_borders(YV12_BUFFER_CONFIG *ybf) -{ - int i; - char *src_ptr1, *src_ptr2; - char *dest_ptr1, *dest_ptr2; - - unsigned int Border; - int plane_stride; - int plane_height; - int plane_width; - - /***********/ - /* Y Plane */ - /***********/ - Border = ybf->border; - plane_stride = ybf->y_stride; - plane_height = ybf->y_height; - plane_width = ybf->y_width; - - // copy the left and right most columns out - src_ptr1 = ybf->y_buffer; - src_ptr2 = src_ptr1 + plane_width - 1; - dest_ptr1 = src_ptr1 - Border; - dest_ptr2 = src_ptr2 + 1; - - for (i = 0; i < plane_height; i++) - { - memset(dest_ptr1, src_ptr1[0], Border); - memset(dest_ptr2, src_ptr2[0], Border); - src_ptr1 += plane_stride; - src_ptr2 += plane_stride; - dest_ptr1 += plane_stride; - dest_ptr2 += plane_stride; - } - - // Now copy the top and bottom source lines into each line of the respective borders - src_ptr1 = ybf->y_buffer - Border; - src_ptr2 = src_ptr1 + (plane_height * plane_stride) - plane_stride; - dest_ptr1 = src_ptr1 - (Border * plane_stride); - dest_ptr2 = src_ptr2 + plane_stride; - - for (i = 0; i < (int)Border; i++) - { - memcpy(dest_ptr1, src_ptr1, plane_stride); - memcpy(dest_ptr2, src_ptr2, plane_stride); - dest_ptr1 += plane_stride; - dest_ptr2 += plane_stride; - } - - plane_stride /= 2; - plane_height /= 2; - plane_width /= 2; - Border /= 2; - - /***********/ - /* U Plane */ - /***********/ - - // copy the left and right most columns out - src_ptr1 = ybf->u_buffer; - src_ptr2 = src_ptr1 + plane_width - 1; - dest_ptr1 = src_ptr1 - Border; - dest_ptr2 = src_ptr2 + 1; - - for (i = 0; i < plane_height; i++) - { - memset(dest_ptr1, src_ptr1[0], Border); - memset(dest_ptr2, src_ptr2[0], Border); - src_ptr1 += plane_stride; - src_ptr2 += plane_stride; - dest_ptr1 += plane_stride; - dest_ptr2 += plane_stride; - } - - // Now copy the top and bottom source lines into each line of the respective borders - src_ptr1 = ybf->u_buffer - Border; - src_ptr2 = src_ptr1 + (plane_height * plane_stride) - plane_stride; - dest_ptr1 = src_ptr1 - (Border * plane_stride); - dest_ptr2 = src_ptr2 + plane_stride; - - for (i = 0; i < (int)(Border); i++) - { - memcpy(dest_ptr1, src_ptr1, plane_stride); - memcpy(dest_ptr2, src_ptr2, plane_stride); - dest_ptr1 += plane_stride; - dest_ptr2 += plane_stride; - } - - /***********/ - /* V Plane */ - /***********/ - - // copy the left and right most columns out - src_ptr1 = ybf->v_buffer; - src_ptr2 = src_ptr1 + plane_width - 1; - dest_ptr1 = src_ptr1 - Border; - dest_ptr2 = src_ptr2 + 1; - - for (i = 0; i < plane_height; i++) - { - memset(dest_ptr1, src_ptr1[0], Border); - memset(dest_ptr2, src_ptr2[0], Border); - src_ptr1 += plane_stride; - src_ptr2 += plane_stride; - dest_ptr1 += plane_stride; - dest_ptr2 += plane_stride; - } - - // Now copy the top and bottom source lines into each line of the respective borders - src_ptr1 = ybf->v_buffer - Border; - src_ptr2 = src_ptr1 + (plane_height * plane_stride) - plane_stride; - dest_ptr1 = src_ptr1 - (Border * plane_stride); - dest_ptr2 = src_ptr2 + plane_stride; - - for (i = 0; i < (int)(Border); i++) - { - memcpy(dest_ptr1, src_ptr1, plane_stride); - memcpy(dest_ptr2, src_ptr2, plane_stride); - dest_ptr1 += plane_stride; - dest_ptr2 += plane_stride; - } -} -/**************************************************************************** - * - * ROUTINE : vp8_yv12_copy_frame - * - * INPUTS : - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Copies the source image into the destination image and - * updates the destination's UMV borders. - * - * SPECIAL NOTES : The frames are assumed to be identical in size. - * - ****************************************************************************/ -void -vp8_yv12_copy_frame(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc) -{ - int row; - int i; - unsigned int *source; - _Uncached unsigned int *dest; - int height; - int width; - - height = src_ybc->y_height + (src_ybc->border * 2); - width = src_ybc->y_width + (src_ybc->border * 2); - width /= 4; - source = (unsigned int *)(src_ybc->y_buffer - (src_ybc->border * src_ybc->y_stride) - src_ybc->border); - dest = (_Uncached unsigned int *)(dst_ybc->y_buffer - (dst_ybc->border * dst_ybc->y_stride) - dst_ybc->border); - - for (row = 0; row < height; row++) - { - for (i = 0; i < width; i++) - { - dest[i] = source[i]; - } - - source += width; - dest += width; - } - - height = src_ybc->uv_height + (src_ybc->border); - width = src_ybc->uv_width + (src_ybc->border); - width /= 4; - - source = (unsigned int *)(src_ybc->u_buffer - (src_ybc->border / 2 * src_ybc->uv_stride) - src_ybc->border / 2); - dest = (_Uncached unsigned int *)(dst_ybc->u_buffer - (dst_ybc->border / 2 * dst_ybc->uv_stride) - dst_ybc->border / 2); - - for (row = 0; row < height; row++) - { - for (i = 0; i < width; i++) - { - dest[i] = source[i]; - } - - source += width; - dest += width; - } - - source = (unsigned int *)(src_ybc->v_buffer - (src_ybc->border / 2 * src_ybc->uv_stride) - src_ybc->border / 2); - dest = (_Uncached unsigned int *)(dst_ybc->v_buffer - (dst_ybc->border / 2 * dst_ybc->uv_stride) - dst_ybc->border / 2); - - for (row = 0; row < height; row++) - { - for (i = 0; i < width; i++) - { - dest[i] = source[i]; - } - - source += width; - dest += width; - } - -} diff --git a/vpx_scale/symbian/gen_scalers_armv4.asm b/vpx_scale/symbian/gen_scalers_armv4.asm deleted file mode 100644 index e495184e7..000000000 --- a/vpx_scale/symbian/gen_scalers_armv4.asm +++ /dev/null @@ -1,774 +0,0 @@ -; -; Copyright (c) 2010 The WebM project authors. All Rights Reserved. -; -; Use of this source code is governed by a BSD-style license -; that can be found in the LICENSE file in the root of the source -; tree. An additional intellectual property rights grant can be found -; in the file PATENTS. All contributing project authors may -; be found in the AUTHORS file in the root of the source tree. -; - - - EXPORT |horizontal_line_4_5_scale_armv4| - EXPORT |vertical_band_4_5_scale_armv4| - EXPORT |horizontal_line_2_3_scale_armv4| - EXPORT |vertical_band_2_3_scale_armv4| - EXPORT |horizontal_line_3_5_scale_armv4| - EXPORT |vertical_band_3_5_scale_armv4| - EXPORT |horizontal_line_3_4_scale_armv4| - EXPORT |vertical_band_3_4_scale_armv4| - EXPORT |horizontal_line_1_2_scale_armv4| - EXPORT |vertical_band_1_2_scale_armv4| - - AREA |.text|, CODE, READONLY ; name this block of code - -src RN r0 -srcw RN r1 -dest RN r2 -mask RN r12 -c51_205 RN r10 -c102_154 RN r11 -;/**************************************************************************** -; * -; * ROUTINE : horizontal_line_4_5_scale_armv4 -; * -; * INPUTS : const unsigned char *source : Pointer to source data. -; * unsigned int source_width : Stride of source. -; * unsigned char *dest : Pointer to destination data. -; * unsigned int dest_width : Stride of destination (NOT USED). -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Copies horizontal line of pixels from source to -; * destination scaling up by 4 to 5. -; * -; * SPECIAL NOTES : None. -; * -; ****************************************************************************/ -;void horizontal_line_4_5_scale_armv4 -;( -; r0 = UINT8 *source -; r1 = UINT32 source_width -; r2 = UINT8 *dest -; r3 = UINT32 dest_width -;) -|horizontal_line_4_5_scale_armv4| PROC - stmdb sp!, {r4 - r11, lr} - - mov mask, #255 ; mask for selection - ldr c51_205, =0x3300cd - ldr c102_154, =0x66009a - - ldr r3, [src], #4 - -hl45_loop - - and r4, r3, mask ; a = src[0] - and r5, mask, r3, lsr #8 ; b = src[1] - strb r4, [dest], #1 - - orr r6, r4, r5, lsl #16 ; b | a - and r7, mask, r3, lsr #16 ; c = src[2] - mul r6, c51_205, r6 ; a * 51 + 205 * b - - orr r5, r5, r7, lsl #16 ; c | b - mul r5, c102_154, r5 ; b * 102 + 154 * c - add r6, r6, #0x8000 - and r8, mask, r3, lsr #24 ; d = src[3] - mov r6, r6, lsr #24 - strb r6, [dest], #1 - - orr r7, r8, r7, lsl #16 ; c | d - mul r7, c102_154, r7 ; c * 154 + 102 * d - add r5, r5, #0x8000 - ldr r3, [src], #4 - mov r5, r5, lsr #24 - strb r5, [dest], #1 - - add r7, r7, #0x8000 - and r9, mask, r3 ; e = src[4] - orr r9, r9, r8, lsl #16 ; d | e - mul r9, c51_205, r9 ; d * 205 + 51 * e - mov r7, r7, lsr #24 - strb r7, [dest], #1 - - add r9, r9, #0x8000 - subs srcw, srcw, #4 - mov r9, r9, lsr #24 - strb r9, [dest], #1 - - bne hl45_loop - - and r4, r3, mask - and r5, mask, r3, lsl #8 - strb r4, [dest], #1 - - orr r6, r4, r5, lsl #16 ; b | a - mul r6, c51_205, r6 - - and r7, mask, r3, lsl #16 - orr r5, r5, r7, lsl #16 ; c | b - mul r5, c102_154, r5 - add r6, r6, #0x8000 - and r8, mask, r3, lsl #24 - mov r6, r6, lsr #24 - strb r6, [dest], #1 - - orr r7, r8, r7, lsl #16 ; c | d - mul r7, c102_154, r7 - add r5, r5, #0x8000 - mov r5, r5, lsr #24 - strb r5, [dest], #1 - - add r7, r7, #0x8000 - mov r7, r7, lsr #24 - strb r7, [dest], #1 - - ldrb r3, [src] - strb r3, [dest], #1 - - ldmia sp!, {r4 - r11, pc} - ENDP ;|vp8cx_horizontal_line_4_5_scale_c| - -;/**************************************************************************** -; * -; * ROUTINE : vertical_band_4_5_scale_armv4 -; * -; * INPUTS : unsigned char *dest : Pointer to destination data. -; * unsigned int dest_pitch : Stride of destination data. -; * unsigned int dest_width : Width of destination data. -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Scales vertical band of pixels by scale 4 to 5. The -; * height of the band scaled is 4-pixels. -; * -; * SPECIAL NOTES : The routine uses the first line of the band below -; * the current band. -; * -; ****************************************************************************/ -;void vertical_band_4_5_scale_armv4 -;( -; r0 = UINT8 *dest -; r1 = UINT32 dest_pitch -; r2 = UINT32 dest_width -;) -|vertical_band_4_5_scale_armv4| PROC - stmdb sp!, {r4 - r11, lr} - - ldr c51_205, =0x3300cd - ldr c102_154, =0x66009a - -vl45_loop - mov r3, src - ldrb r4, [r3], r1 ; a = des [0] - ldrb r5, [r3], r1 ; b = des [dest_pitch] - ldrb r7, [r3], r1 ; c = des[dest_pitch*2] - add lr, src, r1 - - orr r6, r4, r5, lsl #16 ; b | a - mul r6, c51_205, r6 ; a * 51 + 205 * b - - ldrb r8, [r3], r1 ; d = des[dest_pitch*3] - orr r5, r5, r7, lsl #16 ; c | b - mul r5, c102_154, r5 ; b * 102 + 154 * c - add r6, r6, #0x8000 - orr r7, r8, r7, lsl #16 ; c | d - mov r6, r6, lsr #24 - strb r6, [lr], r1 - - ldrb r9, [r3, r1] ; e = des [dest_pitch * 5] - mul r7, c102_154, r7 ; c * 154 + 102 * d - add r5, r5, #0x8000 - orr r9, r9, r8, lsl #16 ; d | e - mov r5, r5, lsr #24 - strb r5, [lr], r1 - - mul r9, c51_205, r9 ; d * 205 + 51 * e - add r7, r7, #0x8000 - add src, src, #1 - mov r7, r7, lsr #24 - strb r7, [lr], r1 - - add r9, r9, #0x8000 - subs r2, r2, #1 - mov r9, r9, lsr #24 - strb r9, [lr], r1 - - bne vl45_loop - - ldmia sp!, {r4 - r11, pc} - ENDP ;|vertical_band_4_5_scale_armv4| - -;/**************************************************************************** -; * -; * ROUTINE : horizontal_line_2_3_scale_armv4 -; * -; * INPUTS : const unsigned char *source : Pointer to source data. -; * unsigned int source_width : Stride of source. -; * unsigned char *dest : Pointer to destination data. -; * unsigned int dest_width : Stride of destination (NOT USED). -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Copies horizontal line of pixels from source to -; * destination scaling up by 2 to 3. -; * -; * SPECIAL NOTES : None. -; * -; * -; ****************************************************************************/ -;void horizontal_line_2_3_scale_armv4 -;( -; const unsigned char *source, -; unsigned int source_width, -; unsigned char *dest, -; unsigned int dest_width -;) -|horizontal_line_2_3_scale_armv4| PROC - stmdb sp!, {r4 - r11, lr} - ldr lr, =85 - ldr r12, =171 - -hl23_loop - - ldrb r3, [src], #1 ; a - ldrb r4, [src], #1 ; b - ldrb r5, [src] ; c - - strb r3, [dest], #1 - mul r4, r12, r4 ; b * 171 - mla r6, lr, r3, r4 ; a * 85 - mla r7, lr, r5, r4 ; c * 85 - - add r6, r6, #128 - mov r6, r6, lsr #8 - strb r6, [dest], #1 - - add r7, r7, #128 - mov r7, r7, lsr #8 - strb r7, [dest], #1 - - subs srcw, srcw, #2 - bne hl23_loop - - ldrb r4, [src, #1] ; b - strb r5, [dest], #1 - strb r4, [dest, #1] - - mul r4, r12, r4 ; b * 171 - mla r6, lr, r5, r4 ; a * 85 + b *171 - - add r6, r6, #128 - mov r6, r6, lsr #8 - strb r6, [dest] - - ldmia sp!, {r4 - r11, pc} - ENDP ;|horizontal_line_2_3_scale_armv4| - -;/**************************************************************************** -; * -; * ROUTINE : vertical_band_2_3_scale_armv4 -; * -; * INPUTS : unsigned char *dest : Pointer to destination data. -; * unsigned int dest_pitch : Stride of destination data. -; * unsigned int dest_width : Width of destination data. -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Scales vertical band of pixels by scale 2 to 3. The -; * height of the band scaled is 2-pixels. -; * -; * SPECIAL NOTES : The routine uses the first line of the band below -; * the current band. -; * -; ****************************************************************************/ -;void vertical_band_2_3_scale_armv4 -;( -; r0 = UINT8 *dest -; r1 = UINT32 dest_pitch -; r2 = UINT32 dest_width -;) -|vertical_band_2_3_scale_armv4| PROC - stmdb sp!, {r4 - r8, lr} - ldr lr, =85 - ldr r12, =171 - add r3, r1, r1, lsl #1 ; 3 * dest_pitch - -vl23_loop - ldrb r4, [src] ; a = des [0] - ldrb r5, [src, r1] ; b = des [dest_pitch] - ldrb r7, [src, r3] ; c = des [dest_pitch*3] - subs r2, r2, #1 - - mul r5, r12, r5 ; b * 171 - mla r6, lr, r4, r5 ; a * 85 - mla r8, lr, r7, r5 ; c * 85 - - add r6, r6, #128 - mov r6, r6, lsr #8 - strb r6, [src, r1] - - add r8, r8, #128 - mov r8, r8, lsr #8 - strb r8, [src, r1, lsl #1] - - add src, src, #1 - - bne vl23_loop - - ldmia sp!, {r4 - r8, pc} - ENDP ;|vertical_band_2_3_scale_armv4| - -;/**************************************************************************** -; * -; * ROUTINE : vp8cx_horizontal_line_3_5_scale_c -; * -; * INPUTS : const unsigned char *source : Pointer to source data. -; * unsigned int source_width : Stride of source. -; * unsigned char *dest : Pointer to destination data. -; * unsigned int dest_width : Stride of destination (NOT USED). -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Copies horizontal line of pixels from source to -; * destination scaling up by 3 to 5. -; * -; * SPECIAL NOTES : None. -; * -; * -; ****************************************************************************/ -;void vp8cx_horizontal_line_3_5_scale_c -;( -; const unsigned char *source, -; unsigned int source_width, -; unsigned char *dest, -; unsigned int dest_width -;) -|horizontal_line_3_5_scale_armv4| PROC - stmdb sp!, {r4 - r11, lr} - - ldr c51_205, =0x3300cd - ldr c102_154, =0x66009a - - ldrb r4, [src], #1 ; a = src[0] - -hl35_loop - - ldrb r8, [src], #1 ; b = src[1] - strb r4, [dest], #1 - - orr r6, r4, r8, lsl #16 ; b | a - ldrb r9, [src], #1 ; c = src[2] - mul r6, c102_154, r6 ; a * 102 + 154 * b - - orr r5, r9, r8, lsl #16 ; b | c - mul r5, c51_205, r5 ; b * 205 + 51 * c - add r6, r6, #0x8000 - ldrb r4, [src], #1 ; d = src[3] - mov r6, r6, lsr #24 - strb r6, [dest], #1 - - orr r7, r8, r9, lsl #16 ; c | b - mul r7, c51_205, r7 ; c * 205 + 154 * b - add r5, r5, #0x8000 - mov r5, r5, lsr #24 - strb r5, [dest], #1 - - orr r9, r4, r9, lsl #16 ; c | d - mul r9, c102_154, r9 ; c * 154 + 102 * d - add r7, r7, #0x8000 - mov r7, r7, lsr #24 - strb r7, [dest], #1 - - add r9, r9, #0x8000 - subs srcw, srcw, #3 - mov r9, r9, lsr #24 - strb r9, [dest], #1 - - bpl hl35_loop - - ldrb r5, [src], #1 ; b = src[1] - strb r4, [dest], #1 - - orr r6, r4, r8, lsl #16 ; b | a - ldrb r9, [src], #1 ; c = src[2] - mul r6, c102_154, r6 ; a * 102 + 154 * b - - orr r5, r9, r8, lsl #16 ; b | c - mul r5, c51_205, r5 ; b * 205 + 51 * c - add r6, r6, #0x8000 - mov r6, r6, lsr #24 - strb r6, [dest], #1 - - orr r7, r8, r9, lsl #16 ; c | b - mul r7, c51_205, r7 ; c * 205 + 154 * b - add r5, r5, #0x8000 - mov r5, r5, lsr #24 - strb r5, [dest], #1 - - add r7, r7, #0x8000 - mov r7, r7, lsr #24 - strb r7, [dest], #1 - strb r9, [dest], #1 - - ldmia sp!, {r4 - r11, pc} - ENDP ;|vp8cx_horizontal_line_3_5_scale_c| - - -;/**************************************************************************** -; * -; * ROUTINE : vp8cx_vertical_band_3_5_scale_c -; * -; * INPUTS : unsigned char *dest : Pointer to destination data. -; * unsigned int dest_pitch : Stride of destination data. -; * unsigned int dest_width : Width of destination data. -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Scales vertical band of pixels by scale 3 to 5. The -; * height of the band scaled is 3-pixels. -; * -; * SPECIAL NOTES : The routine uses the first line of the band below -; * the current band. -; * -; ****************************************************************************/ -;void vertical_band_4_5_scale_armv4 -;( -; r0 = UINT8 *dest -; r1 = UINT32 dest_pitch -; r2 = UINT32 dest_width -;) -|vertical_band_3_5_scale_armv4| PROC - stmdb sp!, {r4 - r11, lr} - - ldr c51_205, =0x3300cd - ldr c102_154, =0x66009a - -vl35_loop - mov r3, src - ldrb r4, [r3], r1 ; a = des [0] - ldrb r5, [r3], r1 ; b = des [dest_pitch] - ldrb r7, [r3], r1 ; c = des[dest_pitch*2] - add lr, src, r1 - - orr r8, r4, r5, lsl #16 ; b | a - mul r6, c102_154, r8 ; a * 102 + 154 * b - - ldrb r8, [r3, r1, lsl #1] ; d = des[dest_pitch*5] - orr r3, r7, r5, lsl #16 ; b | c - mul r9, c51_205, r3 ; b * 205 + 51 * c - add r6, r6, #0x8000 - orr r3, r5, r7, lsl #16 ; c | b - mov r6, r6, lsr #24 - strb r6, [lr], r1 - - mul r5, c51_205, r3 ; c * 205 + 154 * b - add r9, r9, #0x8000 - orr r3, r8, r7, lsl #16 ; c | d - mov r9, r9, lsr #24 - strb r9, [lr], r1 - - mul r7, c102_154, r3 ; c * 154 + 102 * d - add r5, r5, #0x8000 - add src, src, #1 - mov r5, r5, lsr #24 - strb r5, [lr], r1 - - add r7, r7, #0x8000 - subs r2, r2, #1 - mov r7, r7, lsr #24 - strb r7, [lr], r1 - - - bne vl35_loop - - ldmia sp!, {r4 - r11, pc} - ENDP ;|vertical_band_3_5_scale_armv4| - -;/**************************************************************************** -; * -; * ROUTINE : horizontal_line_3_4_scale_armv4 -; * -; * INPUTS : const unsigned char *source : Pointer to source data. -; * unsigned int source_width : Stride of source. -; * unsigned char *dest : Pointer to destination data. -; * unsigned int dest_width : Stride of destination (NOT USED). -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Copies horizontal line of pixels from source to -; * destination scaling up by 3 to 4. -; * -; * SPECIAL NOTES : None. -; * -; * -; ****************************************************************************/ -;void horizontal_line_3_4_scale_armv4 -;( -; const unsigned char *source, -; unsigned int source_width, -; unsigned char *dest, -; unsigned int dest_width -;) -|horizontal_line_3_4_scale_armv4| PROC - stmdb sp!, {r4 - r11, lr} - - ldr r10, =64 - ldr r11, =192 - mov r9, #128 - - ldrb r4, [src], #1 ; a = src[0] - -hl34_loop - - ldrb r8, [src], #1 ; b = src[1] - ldrb r7, [src], #1 ; c = src[2] - strb r4, [dest], #1 - - mla r4, r10, r4, r9 ; a*64 + 128 - mla r4, r11, r8, r4 ; a*64 + b*192 + 1 - - add r8, r8, #1 ; b + 1 - add r8, r8, r7 ; b + c + 1 - mov r8, r8, asr #1 ; (b + c + 1) >> 1 - - mov r4, r4, asr #8 ; (a*64 + b*192 + 1) >> 8 - strb r4, [dest], #1 - - strb r8, [dest], #1 - - ldrb r4, [src], #1 ; [a+1] - - mla r7, r11, r7, r9 ; c*192 + 128 - mla r7, r4, r10, r7 ; a*64 + b*192 + 128 - - subs srcw, srcw, #3 - - mov r7, r7, asr #8 ; (a*64 + b*192 + 128) >> 8 - strb r7, [dest], #1 - - bpl hl34_loop - - ldrb r8, [src], #1 ; b = src[1] - ldrb r7, [src], #1 ; c = src[2] - strb r4, [dest], #1 - - mla r4, r10, r4, r9 ; a*64 + 128 - mla r4, r11, r8, r4 ; a*64 + b*192 + 1 - mov r4, r4, asr #8 ; (a*64 + b*192 + 1) >> 8 - strb r4, [dest], #1 - - add r8, r8, #1 ; b + 1 - add r8, r8, r7 ; b + c + 1 - mov r8, r8, asr #1 ; (b + c + 1) >> 1 - strb r8, [dest], #1 - strb r7, [dest], #1 - - ldmia sp!, {r4 - r11, pc} - ENDP ;|vp8cx_horizontal_line_3_4_scale_c| - - -;/**************************************************************************** -; * -; * ROUTINE : vertical_band_3_4_scale_armv4 -; * -; * INPUTS : unsigned char *dest : Pointer to destination data. -; * unsigned int dest_pitch : Stride of destination data. -; * unsigned int dest_width : Width of destination data. -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Scales vertical band of pixels by scale 3 to 4. The -; * height of the band scaled is 3-pixels. -; * -; * SPECIAL NOTES : The routine uses the first line of the band below -; * the current band. -; * -; ****************************************************************************/ -;void vertical_band_3_4_scale_armv4 -;( -; r0 = UINT8 *dest -; r1 = UINT32 dest_pitch -; r2 = UINT32 dest_width -;) -|vertical_band_3_4_scale_armv4| PROC - stmdb sp!, {r4 - r11, lr} - - ldr r10, =64 - ldr r11, =192 - mov r9, #128 - -; ldr r1,[r1] -vl34_loop - mov r3, src - ldrb r4, [r3], r1 ; a = des [0] - ldrb r5, [r3], r1 ; b = des [dest_pitch] - ldrb r7, [r3], r1 ; c = des [dest_pitch*2] - add lr, src, r1 - - mla r4, r10, r4, r9 ; a*64 + 128 - mla r4, r11, r5, r4 ; a*64 + b*192 + 1 - - add r5, r5, #1 ; b + 1 - add r5, r5, r7 ; b + c + 1 - mov r5, r5, asr #1 ; (b + c + 1) >> 1 - - mov r4, r4, asr #8 ; (a*64 + b*192 + 1) >> 8 - strb r4, [lr], r1 - - ldrb r4, [r3, r1] ; a = des [dest_pitch*4] - - strb r5, [lr], r1 - - mla r7, r11, r7, r9 ; c*192 + 128 - mla r7, r4, r10, r7 ; a*64 + b*192 + 128 - mov r7, r7, asr #8 ; (a*64 + b*192 + 128) >> 8 - - add src, src, #1 - subs r2, r2, #1 - - strb r7, [lr] - - bne vl34_loop - - ldmia sp!, {r4 - r11, pc} - ENDP ;|vertical_band_3_4_scale_armv4| - -;/**************************************************************************** -; * -; * ROUTINE : vp8cx_horizontal_line_1_2_scale_c -; * -; * INPUTS : const unsigned char *source : Pointer to source data. -; * unsigned int source_width : Stride of source. -; * unsigned char *dest : Pointer to destination data. -; * unsigned int dest_width : Stride of destination (NOT USED). -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Copies horizontal line of pixels from source to -; * destination scaling up by 1 to 2. -; * -; * SPECIAL NOTES : None. -; * -; ****************************************************************************/ -;void vp8cx_horizontal_line_1_2_scale_c -;( -; const unsigned char *source, -; unsigned int source_width, -; unsigned char *dest, -; unsigned int dest_width -;) -|horizontal_line_1_2_scale_armv4| PROC - stmdb sp!, {r4 - r5, lr} - - sub srcw, srcw, #1 - - ldrb r3, [src], #1 - ldrb r4, [src], #1 -hl12_loop - subs srcw, srcw, #1 - - add r5, r3, r4 - add r5, r5, #1 - mov r5, r5, lsr #1 - - orr r5, r3, r5, lsl #8 - strh r5, [dest], #2 - - mov r3, r4 - - ldrneb r4, [src], #1 - bne hl12_loop - - orr r5, r4, r4, lsl #8 - strh r5, [dest] - - ldmia sp!, {r4 - r5, pc} - ENDP ;|vertical_band_3_5_scale_armv4| - -;/**************************************************************************** -; * -; * ROUTINE : vp8cx_vertical_band_1_2_scale_c -; * -; * INPUTS : unsigned char *dest : Pointer to destination data. -; * unsigned int dest_pitch : Stride of destination data. -; * unsigned int dest_width : Width of destination data. -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Scales vertical band of pixels by scale 1 to 2. The -; * height of the band scaled is 1-pixel. -; * -; * SPECIAL NOTES : The routine uses the first line of the band below -; * the current band. -; * -; ****************************************************************************/ -;void vp8cx_vertical_band_1_2_scale_c -;( -; r0 = UINT8 *dest -; r1 = UINT32 dest_pitch -; r2 = UINT32 dest_width -;) -|vertical_band_1_2_scale_armv4| PROC - stmdb sp!, {r4 - r7, lr} - - ldr mask, =0xff00ff ; mask for selection - ldr lr, = 0x010001 - -vl12_loop - mov r3, src - ldr r4, [r3], r1 - ldr r5, [r3, r1] - - add src, src, #4 - subs r2, r2, #4 - - and r6, r4, mask - and r7, r5, mask - - add r6, r7, r6 - add r6, r6, lr - - and r4, mask, r4, lsr #8 - and r5, mask, r5, lsr #8 - - mov r6, r6, lsr #1 - and r6, r6, mask - - add r4, r5, r4 - add r4, r4, lr - - mov r4, r4, lsr #1 - and r4, r4, mask - - orr r5, r6, r4, lsl #8 - - str r5, [r3] - - bpl vl12_loop - - ldmia sp!, {r4 - r7, pc} - ENDP ;|vertical_band_3_5_scale_armv4| - - END diff --git a/vpx_scale/symbian/gen_scalers_armv4.s b/vpx_scale/symbian/gen_scalers_armv4.s deleted file mode 100644 index 3dfd0b9b9..000000000 --- a/vpx_scale/symbian/gen_scalers_armv4.s +++ /dev/null @@ -1,808 +0,0 @@ -@ This file was created from a .asm file -@ using the ads2gas.pl script. - - .equ WIDE_REFERENCE, 0 - .ifndef ARCHITECTURE - .equ ARCHITECTURE, 5 - .endif - .global horizontal_line_4_5_scale_armv4 - .ifndef NO_TYPE_PSEUDO_OP - .type horizontal_line_4_5_scale_armv4, function - .endif - .global vertical_band_4_5_scale_armv4 - .ifndef NO_TYPE_PSEUDO_OP - .type vertical_band_4_5_scale_armv4, function - .endif - .global horizontal_line_2_3_scale_armv4 - .ifndef NO_TYPE_PSEUDO_OP - .type horizontal_line_2_3_scale_armv4, function - .endif - .global vertical_band_2_3_scale_armv4 - .ifndef NO_TYPE_PSEUDO_OP - .type vertical_band_2_3_scale_armv4, function - .endif - .global horizontal_line_3_5_scale_armv4 - .ifndef NO_TYPE_PSEUDO_OP - .type horizontal_line_3_5_scale_armv4, function - .endif - .global vertical_band_3_5_scale_armv4 - .ifndef NO_TYPE_PSEUDO_OP - .type vertical_band_3_5_scale_armv4, function - .endif - .global horizontal_line_3_4_scale_armv4 - .ifndef NO_TYPE_PSEUDO_OP - .type horizontal_line_3_4_scale_armv4, function - .endif - .global vertical_band_3_4_scale_armv4 - .ifndef NO_TYPE_PSEUDO_OP - .type vertical_band_3_4_scale_armv4, function - .endif - .global horizontal_line_1_2_scale_armv4 - .ifndef NO_TYPE_PSEUDO_OP - .type horizontal_line_1_2_scale_armv4, function - .endif - .global vertical_band_1_2_scale_armv4 - .ifndef NO_TYPE_PSEUDO_OP - .type vertical_band_1_2_scale_armv4, function - .endif - -.text - -src .req r0 -srcw .req r1 -dest .req r2 -mask .req r12 -c51_205 .req r10 -c102_154 .req r11 -@/**************************************************************************** -@ * -@ * ROUTINE : horizontal_line_4_5_scale_armv4 -@ * -@ * INPUTS : const unsigned char *source : Pointer to source data. -@ * unsigned int source_width : Stride of source. -@ * unsigned char *dest : Pointer to destination data. -@ * unsigned int dest_width : Stride of destination (NOT USED). -@ * -@ * OUTPUTS : None. -@ * -@ * RETU.req_s : void -@ * -@ * FUNCTION : Copies horizontal line of pixels from source to -@ * destination scaling up by 4 to 5. -@ * -@ * SPECIAL NOTES : None. -@ * -@ ****************************************************************************/ -@void horizontal_line_4_5_scale_armv4 -@( -@ r0 = UINT8 *source -@ r1 = UINT32 source_width -@ r2 = UINT8 *dest -@ r3 = UINT32 dest_width -@) -_HorizontalLine_4_5_Scale_ARMv4: - horizontal_line_4_5_scale_armv4: @ - stmdb sp!, {r4 - r11, lr} - - mov mask, #255 @ mask for selection - ldr c51_205, =0x3300cd - ldr c102_154, =0x66009a - - ldr r3, [src], #4 - -hl45_loop: - - and r4, r3, mask @ a = src[0] - and r5, mask, r3, lsr #8 @ b = src[1] - strb r4, [dest], #1 - - orr r6, r4, r5, lsl #16 @ b | a - and r7, mask, r3, lsr #16 @ c = src[2] - mul r6, c51_205, r6 @ a * 51 + 205 * b - - orr r5, r5, r7, lsl #16 @ c | b - mul r5, c102_154, r5 @ b * 102 + 154 * c - add r6, r6, #0x8000 - and r8, mask, r3, lsr #24 @ d = src[3] - mov r6, r6, lsr #24 - strb r6, [dest], #1 - - orr r7, r8, r7, lsl #16 @ c | d - mul r7, c102_154, r7 @ c * 154 + 102 * d - add r5, r5, #0x8000 - ldr r3, [src], #4 - mov r5, r5, lsr #24 - strb r5, [dest], #1 - - add r7, r7, #0x8000 - and r9, mask, r3 @ e = src[4] - orr r9, r9, r8, lsl #16 @ d | e - mul r9, c51_205, r9 @ d * 205 + 51 * e - mov r7, r7, lsr #24 - strb r7, [dest], #1 - - add r9, r9, #0x8000 - subs srcw, srcw, #4 - mov r9, r9, lsr #24 - strb r9, [dest], #1 - - bne hl45_loop - - and r4, r3, mask - and r5, mask, r3, lsl #8 - strb r4, [dest], #1 - - orr r6, r4, r5, lsl #16 @ b | a - mul r6, c51_205, r6 - - and r7, mask, r3, lsl #16 - orr r5, r5, r7, lsl #16 @ c | b - mul r5, c102_154, r5 - add r6, r6, #0x8000 - and r8, mask, r3, lsl #24 - mov r6, r6, lsr #24 - strb r6, [dest], #1 - - orr r7, r8, r7, lsl #16 @ c | d - mul r7, c102_154, r7 - add r5, r5, #0x8000 - mov r5, r5, lsr #24 - strb r5, [dest], #1 - - add r7, r7, #0x8000 - mov r7, r7, lsr #24 - strb r7, [dest], #1 - - ldrb r3, [src] - strb r3, [dest], #1 - - ldmia sp!, {r4 - r11, pc} - @ @|vp8cx_horizontal_line_4_5_scale_c| - -@/**************************************************************************** -@ * -@ * ROUTINE : vertical_band_4_5_scale_armv4 -@ * -@ * INPUTS : unsigned char *dest : Pointer to destination data. -@ * unsigned int dest_pitch : Stride of destination data. -@ * unsigned int dest_width : Width of destination data. -@ * -@ * OUTPUTS : None. -@ * -@ * RETU.req_s : void -@ * -@ * FUNCTION : Scales vertical band of pixels by scale 4 to 5. The -@ * height of the band scaled is 4-pixels. -@ * -@ * SPECIAL NOTES : The routine uses the first line of the band below -@ * the current band. -@ * -@ ****************************************************************************/ -@void vertical_band_4_5_scale_armv4 -@( -@ r0 = UINT8 *dest -@ r1 = UINT32 dest_pitch -@ r2 = UINT32 dest_width -@) -_VerticalBand_4_5_Scale_ARMv4: - vertical_band_4_5_scale_armv4: @ - stmdb sp!, {r4 - r11, lr} - - ldr c51_205, =0x3300cd - ldr c102_154, =0x66009a - -vl45_loop: - mov r3, src - ldrb r4, [r3], r1 @ a = des [0] - ldrb r5, [r3], r1 @ b = des [dest_pitch] - ldrb r7, [r3], r1 @ c = des[dest_pitch*2] - add lr, src, r1 - - orr r6, r4, r5, lsl #16 @ b | a - mul r6, c51_205, r6 @ a * 51 + 205 * b - - ldrb r8, [r3], r1 @ d = des[dest_pitch*3] - orr r5, r5, r7, lsl #16 @ c | b - mul r5, c102_154, r5 @ b * 102 + 154 * c - add r6, r6, #0x8000 - orr r7, r8, r7, lsl #16 @ c | d - mov r6, r6, lsr #24 - strb r6, [lr], r1 - - ldrb r9, [r3, r1] @ e = des [dest_pitch * 5] - mul r7, c102_154, r7 @ c * 154 + 102 * d - add r5, r5, #0x8000 - orr r9, r9, r8, lsl #16 @ d | e - mov r5, r5, lsr #24 - strb r5, [lr], r1 - - mul r9, c51_205, r9 @ d * 205 + 51 * e - add r7, r7, #0x8000 - add src, src, #1 - mov r7, r7, lsr #24 - strb r7, [lr], r1 - - add r9, r9, #0x8000 - subs r2, r2, #1 - mov r9, r9, lsr #24 - strb r9, [lr], r1 - - bne vl45_loop - - ldmia sp!, {r4 - r11, pc} - @ @|vertical_band_4_5_scale_armv4| - -@/**************************************************************************** -@ * -@ * ROUTINE : horizontal_line_2_3_scale_armv4 -@ * -@ * INPUTS : const unsigned char *source : Pointer to source data. -@ * unsigned int source_width : Stride of source. -@ * unsigned char *dest : Pointer to destination data. -@ * unsigned int dest_width : Stride of destination (NOT USED). -@ * -@ * OUTPUTS : None. -@ * -@ * RETU.req_s : void -@ * -@ * FUNCTION : Copies horizontal line of pixels from source to -@ * destination scaling up by 2 to 3. -@ * -@ * SPECIAL NOTES : None. -@ * -@ * -@ ****************************************************************************/ -@void horizontal_line_2_3_scale_armv4 -@( -@ const unsigned char *source, -@ unsigned int source_width, -@ unsigned char *dest, -@ unsigned int dest_width -@) -_HorizontalLine_2_3_Scale_ARMv4: - horizontal_line_2_3_scale_armv4: @ - stmdb sp!, {r4 - r11, lr} - ldr lr, =85 - ldr r12, =171 - -hl23_loop: - - ldrb r3, [src], #1 @ a - ldrb r4, [src], #1 @ b - ldrb r5, [src] @ c - - strb r3, [dest], #1 - mul r4, r12, r4 @ b * 171 - mla r6, lr, r3, r4 @ a * 85 - mla r7, lr, r5, r4 @ c * 85 - - add r6, r6, #128 - mov r6, r6, lsr #8 - strb r6, [dest], #1 - - add r7, r7, #128 - mov r7, r7, lsr #8 - strb r7, [dest], #1 - - subs srcw, srcw, #2 - bne hl23_loop - - ldrb r4, [src, #1] @ b - strb r5, [dest], #1 - strb r4, [dest, #1] - - mul r4, r12, r4 @ b * 171 - mla r6, lr, r5, r4 @ a * 85 + b *171 - - add r6, r6, #128 - mov r6, r6, lsr #8 - strb r6, [dest] - - ldmia sp!, {r4 - r11, pc} - @ @|horizontal_line_2_3_scale_armv4| - -@/**************************************************************************** -@ * -@ * ROUTINE : vertical_band_2_3_scale_armv4 -@ * -@ * INPUTS : unsigned char *dest : Pointer to destination data. -@ * unsigned int dest_pitch : Stride of destination data. -@ * unsigned int dest_width : Width of destination data. -@ * -@ * OUTPUTS : None. -@ * -@ * RETU.req_s : void -@ * -@ * FUNCTION : Scales vertical band of pixels by scale 2 to 3. The -@ * height of the band scaled is 2-pixels. -@ * -@ * SPECIAL NOTES : The routine uses the first line of the band below -@ * the current band. -@ * -@ ****************************************************************************/ -@void vertical_band_2_3_scale_armv4 -@( -@ r0 = UINT8 *dest -@ r1 = UINT32 dest_pitch -@ r2 = UINT32 dest_width -@) -_VerticalBand_2_3_Scale_ARMv4: - vertical_band_2_3_scale_armv4: @ - stmdb sp!, {r4 - r8, lr} - ldr lr, =85 - ldr r12, =171 - add r3, r1, r1, lsl #1 @ 3 * dest_pitch - -vl23_loop: - ldrb r4, [src] @ a = des [0] - ldrb r5, [src, r1] @ b = des [dest_pitch] - ldrb r7, [src, r3] @ c = des [dest_pitch*3] - subs r2, r2, #1 - - mul r5, r12, r5 @ b * 171 - mla r6, lr, r4, r5 @ a * 85 - mla r8, lr, r7, r5 @ c * 85 - - add r6, r6, #128 - mov r6, r6, lsr #8 - strb r6, [src, r1] - - add r8, r8, #128 - mov r8, r8, lsr #8 - strb r8, [src, r1, lsl #1] - - add src, src, #1 - - bne vl23_loop - - ldmia sp!, {r4 - r8, pc} - @ @|vertical_band_2_3_scale_armv4| - -@/**************************************************************************** -@ * -@ * ROUTINE : vp8cx_horizontal_line_3_5_scale_c -@ * -@ * INPUTS : const unsigned char *source : Pointer to source data. -@ * unsigned int source_width : Stride of source. -@ * unsigned char *dest : Pointer to destination data. -@ * unsigned int dest_width : Stride of destination (NOT USED). -@ * -@ * OUTPUTS : None. -@ * -@ * RETU.req_s : void -@ * -@ * FUNCTION : Copies horizontal line of pixels from source to -@ * destination scaling up by 3 to 5. -@ * -@ * SPECIAL NOTES : None. -@ * -@ * -@ ****************************************************************************/ -@void vp8cx_horizontal_line_3_5_scale_c -@( -@ const unsigned char *source, -@ unsigned int source_width, -@ unsigned char *dest, -@ unsigned int dest_width -@) -_HorizontalLine_3_5_Scale_ARMv4: - horizontal_line_3_5_scale_armv4: @ - stmdb sp!, {r4 - r11, lr} - - ldr c51_205, =0x3300cd - ldr c102_154, =0x66009a - - ldrb r4, [src], #1 @ a = src[0] - -hl35_loop: - - ldrb r8, [src], #1 @ b = src[1] - strb r4, [dest], #1 - - orr r6, r4, r8, lsl #16 @ b | a - ldrb r9, [src], #1 @ c = src[2] - mul r6, c102_154, r6 @ a * 102 + 154 * b - - orr r5, r9, r8, lsl #16 @ b | c - mul r5, c51_205, r5 @ b * 205 + 51 * c - add r6, r6, #0x8000 - ldrb r4, [src], #1 @ d = src[3] - mov r6, r6, lsr #24 - strb r6, [dest], #1 - - orr r7, r8, r9, lsl #16 @ c | b - mul r7, c51_205, r7 @ c * 205 + 154 * b - add r5, r5, #0x8000 - mov r5, r5, lsr #24 - strb r5, [dest], #1 - - orr r9, r4, r9, lsl #16 @ c | d - mul r9, c102_154, r9 @ c * 154 + 102 * d - add r7, r7, #0x8000 - mov r7, r7, lsr #24 - strb r7, [dest], #1 - - add r9, r9, #0x8000 - subs srcw, srcw, #3 - mov r9, r9, lsr #24 - strb r9, [dest], #1 - - bpl hl35_loop - - ldrb r5, [src], #1 @ b = src[1] - strb r4, [dest], #1 - - orr r6, r4, r8, lsl #16 @ b | a - ldrb r9, [src], #1 @ c = src[2] - mul r6, c102_154, r6 @ a * 102 + 154 * b - - orr r5, r9, r8, lsl #16 @ b | c - mul r5, c51_205, r5 @ b * 205 + 51 * c - add r6, r6, #0x8000 - mov r6, r6, lsr #24 - strb r6, [dest], #1 - - orr r7, r8, r9, lsl #16 @ c | b - mul r7, c51_205, r7 @ c * 205 + 154 * b - add r5, r5, #0x8000 - mov r5, r5, lsr #24 - strb r5, [dest], #1 - - add r7, r7, #0x8000 - mov r7, r7, lsr #24 - strb r7, [dest], #1 - strb r9, [dest], #1 - - ldmia sp!, {r4 - r11, pc} - @ @|vp8cx_horizontal_line_3_5_scale_c| - - -@/**************************************************************************** -@ * -@ * ROUTINE : vp8cx_vertical_band_3_5_scale_c -@ * -@ * INPUTS : unsigned char *dest : Pointer to destination data. -@ * unsigned int dest_pitch : Stride of destination data. -@ * unsigned int dest_width : Width of destination data. -@ * -@ * OUTPUTS : None. -@ * -@ * RETU.req_s : void -@ * -@ * FUNCTION : Scales vertical band of pixels by scale 3 to 5. The -@ * height of the band scaled is 3-pixels. -@ * -@ * SPECIAL NOTES : The routine uses the first line of the band below -@ * the current band. -@ * -@ ****************************************************************************/ -@void vertical_band_4_5_scale_armv4 -@( -@ r0 = UINT8 *dest -@ r1 = UINT32 dest_pitch -@ r2 = UINT32 dest_width -@) -_VerticalBand_3_5_Scale_ARMv4: - vertical_band_3_5_scale_armv4: @ - stmdb sp!, {r4 - r11, lr} - - ldr c51_205, =0x3300cd - ldr c102_154, =0x66009a - -vl35_loop: - mov r3, src - ldrb r4, [r3], r1 @ a = des [0] - ldrb r5, [r3], r1 @ b = des [dest_pitch] - ldrb r7, [r3], r1 @ c = des[dest_pitch*2] - add lr, src, r1 - - orr r8, r4, r5, lsl #16 @ b | a - mul r6, c102_154, r8 @ a * 102 + 154 * b - - ldrb r8, [r3, r1, lsl #1] @ d = des[dest_pitch*5] - orr r3, r7, r5, lsl #16 @ b | c - mul r9, c51_205, r3 @ b * 205 + 51 * c - add r6, r6, #0x8000 - orr r3, r5, r7, lsl #16 @ c | b - mov r6, r6, lsr #24 - strb r6, [lr], r1 - - mul r5, c51_205, r3 @ c * 205 + 154 * b - add r9, r9, #0x8000 - orr r3, r8, r7, lsl #16 @ c | d - mov r9, r9, lsr #24 - strb r9, [lr], r1 - - mul r7, c102_154, r3 @ c * 154 + 102 * d - add r5, r5, #0x8000 - add src, src, #1 - mov r5, r5, lsr #24 - strb r5, [lr], r1 - - add r7, r7, #0x8000 - subs r2, r2, #1 - mov r7, r7, lsr #24 - strb r7, [lr], r1 - - - bne vl35_loop - - ldmia sp!, {r4 - r11, pc} - @ @|vertical_band_3_5_scale_armv4| - -@/**************************************************************************** -@ * -@ * ROUTINE : horizontal_line_3_4_scale_armv4 -@ * -@ * INPUTS : const unsigned char *source : Pointer to source data. -@ * unsigned int source_width : Stride of source. -@ * unsigned char *dest : Pointer to destination data. -@ * unsigned int dest_width : Stride of destination (NOT USED). -@ * -@ * OUTPUTS : None. -@ * -@ * RETU.req_s : void -@ * -@ * FUNCTION : Copies horizontal line of pixels from source to -@ * destination scaling up by 3 to 4. -@ * -@ * SPECIAL NOTES : None. -@ * -@ * -@ ****************************************************************************/ -@void horizontal_line_3_4_scale_armv4 -@( -@ const unsigned char *source, -@ unsigned int source_width, -@ unsigned char *dest, -@ unsigned int dest_width -@) -_HorizontalLine_3_4_Scale_ARMv4: - horizontal_line_3_4_scale_armv4: @ - stmdb sp!, {r4 - r11, lr} - - ldr r10, =64 - ldr r11, =192 - mov r9, #128 - - ldrb r4, [src], #1 @ a = src[0] - -hl34_loop: - - ldrb r8, [src], #1 @ b = src[1] - ldrb r7, [src], #1 @ c = src[2] - strb r4, [dest], #1 - - mla r4, r10, r4, r9 @ a*64 + 128 - mla r4, r11, r8, r4 @ a*64 + b*192 + 1 - - add r8, r8, #1 @ b + 1 - add r8, r8, r7 @ b + c + 1 - mov r8, r8, asr #1 @ (b + c + 1) >> 1 - - mov r4, r4, asr #8 @ (a*64 + b*192 + 1) >> 8 - strb r4, [dest], #1 - - strb r8, [dest], #1 - - ldrb r4, [src], #1 @ [a+1] - - mla r7, r11, r7, r9 @ c*192 + 128 - mla r7, r4, r10, r7 @ a*64 + b*192 + 128 - - subs srcw, srcw, #3 - - mov r7, r7, asr #8 @ (a*64 + b*192 + 128) >> 8 - strb r7, [dest], #1 - - bpl hl34_loop - - ldrb r8, [src], #1 @ b = src[1] - ldrb r7, [src], #1 @ c = src[2] - strb r4, [dest], #1 - - mla r4, r10, r4, r9 @ a*64 + 128 - mla r4, r11, r8, r4 @ a*64 + b*192 + 1 - mov r4, r4, asr #8 @ (a*64 + b*192 + 1) >> 8 - strb r4, [dest], #1 - - add r8, r8, #1 @ b + 1 - add r8, r8, r7 @ b + c + 1 - mov r8, r8, asr #1 @ (b + c + 1) >> 1 - strb r8, [dest], #1 - strb r7, [dest], #1 - - ldmia sp!, {r4 - r11, pc} - @ @|vp8cx_horizontal_line_3_4_scale_c| - - -@/**************************************************************************** -@ * -@ * ROUTINE : vertical_band_3_4_scale_armv4 -@ * -@ * INPUTS : unsigned char *dest : Pointer to destination data. -@ * unsigned int dest_pitch : Stride of destination data. -@ * unsigned int dest_width : Width of destination data. -@ * -@ * OUTPUTS : None. -@ * -@ * RETU.req_s : void -@ * -@ * FUNCTION : Scales vertical band of pixels by scale 3 to 4. The -@ * height of the band scaled is 3-pixels. -@ * -@ * SPECIAL NOTES : The routine uses the first line of the band below -@ * the current band. -@ * -@ ****************************************************************************/ -@void vertical_band_3_4_scale_armv4 -@( -@ r0 = UINT8 *dest -@ r1 = UINT32 dest_pitch -@ r2 = UINT32 dest_width -@) -_VerticalBand_3_4_Scale_ARMv4: - vertical_band_3_4_scale_armv4: @ - stmdb sp!, {r4 - r11, lr} - - ldr r10, =64 - ldr r11, =192 - mov r9, #128 - -@ ldr r1,[r1] -vl34_loop: - mov r3, src - ldrb r4, [r3], r1 @ a = des [0] - ldrb r5, [r3], r1 @ b = des [dest_pitch] - ldrb r7, [r3], r1 @ c = des [dest_pitch*2] - add lr, src, r1 - - mla r4, r10, r4, r9 @ a*64 + 128 - mla r4, r11, r5, r4 @ a*64 + b*192 + 1 - - add r5, r5, #1 @ b + 1 - add r5, r5, r7 @ b + c + 1 - mov r5, r5, asr #1 @ (b + c + 1) >> 1 - - mov r4, r4, asr #8 @ (a*64 + b*192 + 1) >> 8 - strb r4, [lr], r1 - - ldrb r4, [r3, r1] @ a = des [dest_pitch*4] - - strb r5, [lr], r1 - - mla r7, r11, r7, r9 @ c*192 + 128 - mla r7, r4, r10, r7 @ a*64 + b*192 + 128 - mov r7, r7, asr #8 @ (a*64 + b*192 + 128) >> 8 - - add src, src, #1 - subs r2, r2, #1 - - strb r7, [lr] - - bne vl34_loop - - ldmia sp!, {r4 - r11, pc} - @ @|vertical_band_3_4_scale_armv4| - -@/**************************************************************************** -@ * -@ * ROUTINE : vp8cx_horizontal_line_1_2_scale_c -@ * -@ * INPUTS : const unsigned char *source : Pointer to source data. -@ * unsigned int source_width : Stride of source. -@ * unsigned char *dest : Pointer to destination data. -@ * unsigned int dest_width : Stride of destination (NOT USED). -@ * -@ * OUTPUTS : None. -@ * -@ * RETU.req_s : void -@ * -@ * FUNCTION : Copies horizontal line of pixels from source to -@ * destination scaling up by 1 to 2. -@ * -@ * SPECIAL NOTES : None. -@ * -@ ****************************************************************************/ -@void vp8cx_horizontal_line_1_2_scale_c -@( -@ const unsigned char *source, -@ unsigned int source_width, -@ unsigned char *dest, -@ unsigned int dest_width -@) -_HorizontalLine_1_2_Scale_ARMv4: - horizontal_line_1_2_scale_armv4: @ - stmdb sp!, {r4 - r5, lr} - - sub srcw, srcw, #1 - - ldrb r3, [src], #1 - ldrb r4, [src], #1 -hl12_loop: - subs srcw, srcw, #1 - - add r5, r3, r4 - add r5, r5, #1 - mov r5, r5, lsr #1 - - orr r5, r3, r5, lsl #8 - strh r5, [dest], #2 - - mov r3, r4 - - ldrneb r4, [src], #1 - bne hl12_loop - - orr r5, r4, r4, lsl #8 - strh r5, [dest] - - ldmia sp!, {r4 - r5, pc} - @ @|vertical_band_3_5_scale_armv4| - -@/**************************************************************************** -@ * -@ * ROUTINE : vp8cx_vertical_band_1_2_scale_c -@ * -@ * INPUTS : unsigned char *dest : Pointer to destination data. -@ * unsigned int dest_pitch : Stride of destination data. -@ * unsigned int dest_width : Width of destination data. -@ * -@ * OUTPUTS : None. -@ * -@ * RETU.req_s : void -@ * -@ * FUNCTION : Scales vertical band of pixels by scale 1 to 2. The -@ * height of the band scaled is 1-pixel. -@ * -@ * SPECIAL NOTES : The routine uses the first line of the band below -@ * the current band. -@ * -@ ****************************************************************************/ -@void vp8cx_vertical_band_1_2_scale_c -@( -@ r0 = UINT8 *dest -@ r1 = UINT32 dest_pitch -@ r2 = UINT32 dest_width -@) -_VerticalBand_1_2_Scale_ARMv4: - vertical_band_1_2_scale_armv4: @ - stmdb sp!, {r4 - r7, lr} - - ldr mask, =0xff00ff @ mask for selection - ldr lr, = 0x010001 - -vl12_loop: - mov r3, src - ldr r4, [r3], r1 - ldr r5, [r3, r1] - - add src, src, #4 - subs r2, r2, #4 - - and r6, r4, mask - and r7, r5, mask - - add r6, r7, r6 - add r6, r6, lr - - and r4, mask, r4, lsr #8 - and r5, mask, r5, lsr #8 - - mov r6, r6, lsr #1 - and r6, r6, mask - - add r4, r5, r4 - add r4, r4, lr - - mov r4, r4, lsr #1 - and r4, r4, mask - - orr r5, r6, r4, lsl #8 - - str r5, [r3] - - bpl vl12_loop - - ldmia sp!, {r4 - r7, pc} - @ @|vertical_band_3_5_scale_armv4| diff --git a/vpx_scale/symbian/scalesystemdependant.c b/vpx_scale/symbian/scalesystemdependant.c deleted file mode 100644 index b0bffddb7..000000000 --- a/vpx_scale/symbian/scalesystemdependant.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -#include "vpx_scale/vpxscale.h" - -/**************************************************************************** - * - * ROUTINE : vp8_scale_machine_specific_config - * - * INPUTS : UINT32 Version : Codec version number. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Checks for machine specifc features such as MMX support - * sets appropriate flags and function pointers. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -void vp8_scale_machine_specific_config() -{ -#ifndef VPX_NO_GLOBALS - vp8_horizontal_line_1_2_scale = horizontal_line_1_2_scale_armv4; - vp8_vertical_band_1_2_scale = vertical_band_1_2_scale_armv4; - vp8_last_vertical_band_1_2_scale = vp8cx_last_vertical_band_1_2_scale_c; - vp8_horizontal_line_3_5_scale = horizontal_line_3_5_scale_armv4; - vp8_vertical_band_3_5_scale = vertical_band_3_5_scale_armv4; - vp8_last_vertical_band_3_5_scale = vp8cx_last_vertical_band_3_5_scale_c; - vp8_horizontal_line_3_4_scale = horizontal_line_3_4_scale_armv4; - vp8_vertical_band_3_4_scale = vertical_band_3_4_scale_armv4; - vp8_last_vertical_band_3_4_scale = vp8cx_last_vertical_band_3_4_scale_c; - vp8_horizontal_line_2_3_scale = horizontal_line_2_3_scale_armv4; - vp8_vertical_band_2_3_scale = vertical_band_2_3_scale_armv4; - vp8_last_vertical_band_2_3_scale = vp8cx_last_vertical_band_2_3_scale_c; - vp8_horizontal_line_4_5_scale = horizontal_line_4_5_scale_armv4; - vp8_vertical_band_4_5_scale = vertical_band_4_5_scale_armv4; - vp8_last_vertical_band_4_5_scale = vp8cx_last_vertical_band_4_5_scale_c; - - - vp8_vertical_band_5_4_scale = vp8cx_vertical_band_5_4_scale_c; - vp8_vertical_band_5_3_scale = vp8cx_vertical_band_5_3_scale_c; - vp8_vertical_band_2_1_scale = vp8cx_vertical_band_2_1_scale_c; - vp8_vertical_band_2_1_scale_i = vp8cx_vertical_band_2_1_scale_i_c; - vp8_horizontal_line_2_1_scale = vp8cx_horizontal_line_2_1_scale_c; - vp8_horizontal_line_5_3_scale = vp8cx_horizontal_line_5_3_scale_c; - vp8_horizontal_line_5_4_scale = vp8cx_horizontal_line_5_4_scale_c; -#endif -} diff --git a/vpx_scale/wce/gen_scalers_armv4.asm b/vpx_scale/wce/gen_scalers_armv4.asm deleted file mode 100644 index e495184e7..000000000 --- a/vpx_scale/wce/gen_scalers_armv4.asm +++ /dev/null @@ -1,774 +0,0 @@ -; -; Copyright (c) 2010 The WebM project authors. All Rights Reserved. -; -; Use of this source code is governed by a BSD-style license -; that can be found in the LICENSE file in the root of the source -; tree. An additional intellectual property rights grant can be found -; in the file PATENTS. All contributing project authors may -; be found in the AUTHORS file in the root of the source tree. -; - - - EXPORT |horizontal_line_4_5_scale_armv4| - EXPORT |vertical_band_4_5_scale_armv4| - EXPORT |horizontal_line_2_3_scale_armv4| - EXPORT |vertical_band_2_3_scale_armv4| - EXPORT |horizontal_line_3_5_scale_armv4| - EXPORT |vertical_band_3_5_scale_armv4| - EXPORT |horizontal_line_3_4_scale_armv4| - EXPORT |vertical_band_3_4_scale_armv4| - EXPORT |horizontal_line_1_2_scale_armv4| - EXPORT |vertical_band_1_2_scale_armv4| - - AREA |.text|, CODE, READONLY ; name this block of code - -src RN r0 -srcw RN r1 -dest RN r2 -mask RN r12 -c51_205 RN r10 -c102_154 RN r11 -;/**************************************************************************** -; * -; * ROUTINE : horizontal_line_4_5_scale_armv4 -; * -; * INPUTS : const unsigned char *source : Pointer to source data. -; * unsigned int source_width : Stride of source. -; * unsigned char *dest : Pointer to destination data. -; * unsigned int dest_width : Stride of destination (NOT USED). -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Copies horizontal line of pixels from source to -; * destination scaling up by 4 to 5. -; * -; * SPECIAL NOTES : None. -; * -; ****************************************************************************/ -;void horizontal_line_4_5_scale_armv4 -;( -; r0 = UINT8 *source -; r1 = UINT32 source_width -; r2 = UINT8 *dest -; r3 = UINT32 dest_width -;) -|horizontal_line_4_5_scale_armv4| PROC - stmdb sp!, {r4 - r11, lr} - - mov mask, #255 ; mask for selection - ldr c51_205, =0x3300cd - ldr c102_154, =0x66009a - - ldr r3, [src], #4 - -hl45_loop - - and r4, r3, mask ; a = src[0] - and r5, mask, r3, lsr #8 ; b = src[1] - strb r4, [dest], #1 - - orr r6, r4, r5, lsl #16 ; b | a - and r7, mask, r3, lsr #16 ; c = src[2] - mul r6, c51_205, r6 ; a * 51 + 205 * b - - orr r5, r5, r7, lsl #16 ; c | b - mul r5, c102_154, r5 ; b * 102 + 154 * c - add r6, r6, #0x8000 - and r8, mask, r3, lsr #24 ; d = src[3] - mov r6, r6, lsr #24 - strb r6, [dest], #1 - - orr r7, r8, r7, lsl #16 ; c | d - mul r7, c102_154, r7 ; c * 154 + 102 * d - add r5, r5, #0x8000 - ldr r3, [src], #4 - mov r5, r5, lsr #24 - strb r5, [dest], #1 - - add r7, r7, #0x8000 - and r9, mask, r3 ; e = src[4] - orr r9, r9, r8, lsl #16 ; d | e - mul r9, c51_205, r9 ; d * 205 + 51 * e - mov r7, r7, lsr #24 - strb r7, [dest], #1 - - add r9, r9, #0x8000 - subs srcw, srcw, #4 - mov r9, r9, lsr #24 - strb r9, [dest], #1 - - bne hl45_loop - - and r4, r3, mask - and r5, mask, r3, lsl #8 - strb r4, [dest], #1 - - orr r6, r4, r5, lsl #16 ; b | a - mul r6, c51_205, r6 - - and r7, mask, r3, lsl #16 - orr r5, r5, r7, lsl #16 ; c | b - mul r5, c102_154, r5 - add r6, r6, #0x8000 - and r8, mask, r3, lsl #24 - mov r6, r6, lsr #24 - strb r6, [dest], #1 - - orr r7, r8, r7, lsl #16 ; c | d - mul r7, c102_154, r7 - add r5, r5, #0x8000 - mov r5, r5, lsr #24 - strb r5, [dest], #1 - - add r7, r7, #0x8000 - mov r7, r7, lsr #24 - strb r7, [dest], #1 - - ldrb r3, [src] - strb r3, [dest], #1 - - ldmia sp!, {r4 - r11, pc} - ENDP ;|vp8cx_horizontal_line_4_5_scale_c| - -;/**************************************************************************** -; * -; * ROUTINE : vertical_band_4_5_scale_armv4 -; * -; * INPUTS : unsigned char *dest : Pointer to destination data. -; * unsigned int dest_pitch : Stride of destination data. -; * unsigned int dest_width : Width of destination data. -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Scales vertical band of pixels by scale 4 to 5. The -; * height of the band scaled is 4-pixels. -; * -; * SPECIAL NOTES : The routine uses the first line of the band below -; * the current band. -; * -; ****************************************************************************/ -;void vertical_band_4_5_scale_armv4 -;( -; r0 = UINT8 *dest -; r1 = UINT32 dest_pitch -; r2 = UINT32 dest_width -;) -|vertical_band_4_5_scale_armv4| PROC - stmdb sp!, {r4 - r11, lr} - - ldr c51_205, =0x3300cd - ldr c102_154, =0x66009a - -vl45_loop - mov r3, src - ldrb r4, [r3], r1 ; a = des [0] - ldrb r5, [r3], r1 ; b = des [dest_pitch] - ldrb r7, [r3], r1 ; c = des[dest_pitch*2] - add lr, src, r1 - - orr r6, r4, r5, lsl #16 ; b | a - mul r6, c51_205, r6 ; a * 51 + 205 * b - - ldrb r8, [r3], r1 ; d = des[dest_pitch*3] - orr r5, r5, r7, lsl #16 ; c | b - mul r5, c102_154, r5 ; b * 102 + 154 * c - add r6, r6, #0x8000 - orr r7, r8, r7, lsl #16 ; c | d - mov r6, r6, lsr #24 - strb r6, [lr], r1 - - ldrb r9, [r3, r1] ; e = des [dest_pitch * 5] - mul r7, c102_154, r7 ; c * 154 + 102 * d - add r5, r5, #0x8000 - orr r9, r9, r8, lsl #16 ; d | e - mov r5, r5, lsr #24 - strb r5, [lr], r1 - - mul r9, c51_205, r9 ; d * 205 + 51 * e - add r7, r7, #0x8000 - add src, src, #1 - mov r7, r7, lsr #24 - strb r7, [lr], r1 - - add r9, r9, #0x8000 - subs r2, r2, #1 - mov r9, r9, lsr #24 - strb r9, [lr], r1 - - bne vl45_loop - - ldmia sp!, {r4 - r11, pc} - ENDP ;|vertical_band_4_5_scale_armv4| - -;/**************************************************************************** -; * -; * ROUTINE : horizontal_line_2_3_scale_armv4 -; * -; * INPUTS : const unsigned char *source : Pointer to source data. -; * unsigned int source_width : Stride of source. -; * unsigned char *dest : Pointer to destination data. -; * unsigned int dest_width : Stride of destination (NOT USED). -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Copies horizontal line of pixels from source to -; * destination scaling up by 2 to 3. -; * -; * SPECIAL NOTES : None. -; * -; * -; ****************************************************************************/ -;void horizontal_line_2_3_scale_armv4 -;( -; const unsigned char *source, -; unsigned int source_width, -; unsigned char *dest, -; unsigned int dest_width -;) -|horizontal_line_2_3_scale_armv4| PROC - stmdb sp!, {r4 - r11, lr} - ldr lr, =85 - ldr r12, =171 - -hl23_loop - - ldrb r3, [src], #1 ; a - ldrb r4, [src], #1 ; b - ldrb r5, [src] ; c - - strb r3, [dest], #1 - mul r4, r12, r4 ; b * 171 - mla r6, lr, r3, r4 ; a * 85 - mla r7, lr, r5, r4 ; c * 85 - - add r6, r6, #128 - mov r6, r6, lsr #8 - strb r6, [dest], #1 - - add r7, r7, #128 - mov r7, r7, lsr #8 - strb r7, [dest], #1 - - subs srcw, srcw, #2 - bne hl23_loop - - ldrb r4, [src, #1] ; b - strb r5, [dest], #1 - strb r4, [dest, #1] - - mul r4, r12, r4 ; b * 171 - mla r6, lr, r5, r4 ; a * 85 + b *171 - - add r6, r6, #128 - mov r6, r6, lsr #8 - strb r6, [dest] - - ldmia sp!, {r4 - r11, pc} - ENDP ;|horizontal_line_2_3_scale_armv4| - -;/**************************************************************************** -; * -; * ROUTINE : vertical_band_2_3_scale_armv4 -; * -; * INPUTS : unsigned char *dest : Pointer to destination data. -; * unsigned int dest_pitch : Stride of destination data. -; * unsigned int dest_width : Width of destination data. -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Scales vertical band of pixels by scale 2 to 3. The -; * height of the band scaled is 2-pixels. -; * -; * SPECIAL NOTES : The routine uses the first line of the band below -; * the current band. -; * -; ****************************************************************************/ -;void vertical_band_2_3_scale_armv4 -;( -; r0 = UINT8 *dest -; r1 = UINT32 dest_pitch -; r2 = UINT32 dest_width -;) -|vertical_band_2_3_scale_armv4| PROC - stmdb sp!, {r4 - r8, lr} - ldr lr, =85 - ldr r12, =171 - add r3, r1, r1, lsl #1 ; 3 * dest_pitch - -vl23_loop - ldrb r4, [src] ; a = des [0] - ldrb r5, [src, r1] ; b = des [dest_pitch] - ldrb r7, [src, r3] ; c = des [dest_pitch*3] - subs r2, r2, #1 - - mul r5, r12, r5 ; b * 171 - mla r6, lr, r4, r5 ; a * 85 - mla r8, lr, r7, r5 ; c * 85 - - add r6, r6, #128 - mov r6, r6, lsr #8 - strb r6, [src, r1] - - add r8, r8, #128 - mov r8, r8, lsr #8 - strb r8, [src, r1, lsl #1] - - add src, src, #1 - - bne vl23_loop - - ldmia sp!, {r4 - r8, pc} - ENDP ;|vertical_band_2_3_scale_armv4| - -;/**************************************************************************** -; * -; * ROUTINE : vp8cx_horizontal_line_3_5_scale_c -; * -; * INPUTS : const unsigned char *source : Pointer to source data. -; * unsigned int source_width : Stride of source. -; * unsigned char *dest : Pointer to destination data. -; * unsigned int dest_width : Stride of destination (NOT USED). -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Copies horizontal line of pixels from source to -; * destination scaling up by 3 to 5. -; * -; * SPECIAL NOTES : None. -; * -; * -; ****************************************************************************/ -;void vp8cx_horizontal_line_3_5_scale_c -;( -; const unsigned char *source, -; unsigned int source_width, -; unsigned char *dest, -; unsigned int dest_width -;) -|horizontal_line_3_5_scale_armv4| PROC - stmdb sp!, {r4 - r11, lr} - - ldr c51_205, =0x3300cd - ldr c102_154, =0x66009a - - ldrb r4, [src], #1 ; a = src[0] - -hl35_loop - - ldrb r8, [src], #1 ; b = src[1] - strb r4, [dest], #1 - - orr r6, r4, r8, lsl #16 ; b | a - ldrb r9, [src], #1 ; c = src[2] - mul r6, c102_154, r6 ; a * 102 + 154 * b - - orr r5, r9, r8, lsl #16 ; b | c - mul r5, c51_205, r5 ; b * 205 + 51 * c - add r6, r6, #0x8000 - ldrb r4, [src], #1 ; d = src[3] - mov r6, r6, lsr #24 - strb r6, [dest], #1 - - orr r7, r8, r9, lsl #16 ; c | b - mul r7, c51_205, r7 ; c * 205 + 154 * b - add r5, r5, #0x8000 - mov r5, r5, lsr #24 - strb r5, [dest], #1 - - orr r9, r4, r9, lsl #16 ; c | d - mul r9, c102_154, r9 ; c * 154 + 102 * d - add r7, r7, #0x8000 - mov r7, r7, lsr #24 - strb r7, [dest], #1 - - add r9, r9, #0x8000 - subs srcw, srcw, #3 - mov r9, r9, lsr #24 - strb r9, [dest], #1 - - bpl hl35_loop - - ldrb r5, [src], #1 ; b = src[1] - strb r4, [dest], #1 - - orr r6, r4, r8, lsl #16 ; b | a - ldrb r9, [src], #1 ; c = src[2] - mul r6, c102_154, r6 ; a * 102 + 154 * b - - orr r5, r9, r8, lsl #16 ; b | c - mul r5, c51_205, r5 ; b * 205 + 51 * c - add r6, r6, #0x8000 - mov r6, r6, lsr #24 - strb r6, [dest], #1 - - orr r7, r8, r9, lsl #16 ; c | b - mul r7, c51_205, r7 ; c * 205 + 154 * b - add r5, r5, #0x8000 - mov r5, r5, lsr #24 - strb r5, [dest], #1 - - add r7, r7, #0x8000 - mov r7, r7, lsr #24 - strb r7, [dest], #1 - strb r9, [dest], #1 - - ldmia sp!, {r4 - r11, pc} - ENDP ;|vp8cx_horizontal_line_3_5_scale_c| - - -;/**************************************************************************** -; * -; * ROUTINE : vp8cx_vertical_band_3_5_scale_c -; * -; * INPUTS : unsigned char *dest : Pointer to destination data. -; * unsigned int dest_pitch : Stride of destination data. -; * unsigned int dest_width : Width of destination data. -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Scales vertical band of pixels by scale 3 to 5. The -; * height of the band scaled is 3-pixels. -; * -; * SPECIAL NOTES : The routine uses the first line of the band below -; * the current band. -; * -; ****************************************************************************/ -;void vertical_band_4_5_scale_armv4 -;( -; r0 = UINT8 *dest -; r1 = UINT32 dest_pitch -; r2 = UINT32 dest_width -;) -|vertical_band_3_5_scale_armv4| PROC - stmdb sp!, {r4 - r11, lr} - - ldr c51_205, =0x3300cd - ldr c102_154, =0x66009a - -vl35_loop - mov r3, src - ldrb r4, [r3], r1 ; a = des [0] - ldrb r5, [r3], r1 ; b = des [dest_pitch] - ldrb r7, [r3], r1 ; c = des[dest_pitch*2] - add lr, src, r1 - - orr r8, r4, r5, lsl #16 ; b | a - mul r6, c102_154, r8 ; a * 102 + 154 * b - - ldrb r8, [r3, r1, lsl #1] ; d = des[dest_pitch*5] - orr r3, r7, r5, lsl #16 ; b | c - mul r9, c51_205, r3 ; b * 205 + 51 * c - add r6, r6, #0x8000 - orr r3, r5, r7, lsl #16 ; c | b - mov r6, r6, lsr #24 - strb r6, [lr], r1 - - mul r5, c51_205, r3 ; c * 205 + 154 * b - add r9, r9, #0x8000 - orr r3, r8, r7, lsl #16 ; c | d - mov r9, r9, lsr #24 - strb r9, [lr], r1 - - mul r7, c102_154, r3 ; c * 154 + 102 * d - add r5, r5, #0x8000 - add src, src, #1 - mov r5, r5, lsr #24 - strb r5, [lr], r1 - - add r7, r7, #0x8000 - subs r2, r2, #1 - mov r7, r7, lsr #24 - strb r7, [lr], r1 - - - bne vl35_loop - - ldmia sp!, {r4 - r11, pc} - ENDP ;|vertical_band_3_5_scale_armv4| - -;/**************************************************************************** -; * -; * ROUTINE : horizontal_line_3_4_scale_armv4 -; * -; * INPUTS : const unsigned char *source : Pointer to source data. -; * unsigned int source_width : Stride of source. -; * unsigned char *dest : Pointer to destination data. -; * unsigned int dest_width : Stride of destination (NOT USED). -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Copies horizontal line of pixels from source to -; * destination scaling up by 3 to 4. -; * -; * SPECIAL NOTES : None. -; * -; * -; ****************************************************************************/ -;void horizontal_line_3_4_scale_armv4 -;( -; const unsigned char *source, -; unsigned int source_width, -; unsigned char *dest, -; unsigned int dest_width -;) -|horizontal_line_3_4_scale_armv4| PROC - stmdb sp!, {r4 - r11, lr} - - ldr r10, =64 - ldr r11, =192 - mov r9, #128 - - ldrb r4, [src], #1 ; a = src[0] - -hl34_loop - - ldrb r8, [src], #1 ; b = src[1] - ldrb r7, [src], #1 ; c = src[2] - strb r4, [dest], #1 - - mla r4, r10, r4, r9 ; a*64 + 128 - mla r4, r11, r8, r4 ; a*64 + b*192 + 1 - - add r8, r8, #1 ; b + 1 - add r8, r8, r7 ; b + c + 1 - mov r8, r8, asr #1 ; (b + c + 1) >> 1 - - mov r4, r4, asr #8 ; (a*64 + b*192 + 1) >> 8 - strb r4, [dest], #1 - - strb r8, [dest], #1 - - ldrb r4, [src], #1 ; [a+1] - - mla r7, r11, r7, r9 ; c*192 + 128 - mla r7, r4, r10, r7 ; a*64 + b*192 + 128 - - subs srcw, srcw, #3 - - mov r7, r7, asr #8 ; (a*64 + b*192 + 128) >> 8 - strb r7, [dest], #1 - - bpl hl34_loop - - ldrb r8, [src], #1 ; b = src[1] - ldrb r7, [src], #1 ; c = src[2] - strb r4, [dest], #1 - - mla r4, r10, r4, r9 ; a*64 + 128 - mla r4, r11, r8, r4 ; a*64 + b*192 + 1 - mov r4, r4, asr #8 ; (a*64 + b*192 + 1) >> 8 - strb r4, [dest], #1 - - add r8, r8, #1 ; b + 1 - add r8, r8, r7 ; b + c + 1 - mov r8, r8, asr #1 ; (b + c + 1) >> 1 - strb r8, [dest], #1 - strb r7, [dest], #1 - - ldmia sp!, {r4 - r11, pc} - ENDP ;|vp8cx_horizontal_line_3_4_scale_c| - - -;/**************************************************************************** -; * -; * ROUTINE : vertical_band_3_4_scale_armv4 -; * -; * INPUTS : unsigned char *dest : Pointer to destination data. -; * unsigned int dest_pitch : Stride of destination data. -; * unsigned int dest_width : Width of destination data. -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Scales vertical band of pixels by scale 3 to 4. The -; * height of the band scaled is 3-pixels. -; * -; * SPECIAL NOTES : The routine uses the first line of the band below -; * the current band. -; * -; ****************************************************************************/ -;void vertical_band_3_4_scale_armv4 -;( -; r0 = UINT8 *dest -; r1 = UINT32 dest_pitch -; r2 = UINT32 dest_width -;) -|vertical_band_3_4_scale_armv4| PROC - stmdb sp!, {r4 - r11, lr} - - ldr r10, =64 - ldr r11, =192 - mov r9, #128 - -; ldr r1,[r1] -vl34_loop - mov r3, src - ldrb r4, [r3], r1 ; a = des [0] - ldrb r5, [r3], r1 ; b = des [dest_pitch] - ldrb r7, [r3], r1 ; c = des [dest_pitch*2] - add lr, src, r1 - - mla r4, r10, r4, r9 ; a*64 + 128 - mla r4, r11, r5, r4 ; a*64 + b*192 + 1 - - add r5, r5, #1 ; b + 1 - add r5, r5, r7 ; b + c + 1 - mov r5, r5, asr #1 ; (b + c + 1) >> 1 - - mov r4, r4, asr #8 ; (a*64 + b*192 + 1) >> 8 - strb r4, [lr], r1 - - ldrb r4, [r3, r1] ; a = des [dest_pitch*4] - - strb r5, [lr], r1 - - mla r7, r11, r7, r9 ; c*192 + 128 - mla r7, r4, r10, r7 ; a*64 + b*192 + 128 - mov r7, r7, asr #8 ; (a*64 + b*192 + 128) >> 8 - - add src, src, #1 - subs r2, r2, #1 - - strb r7, [lr] - - bne vl34_loop - - ldmia sp!, {r4 - r11, pc} - ENDP ;|vertical_band_3_4_scale_armv4| - -;/**************************************************************************** -; * -; * ROUTINE : vp8cx_horizontal_line_1_2_scale_c -; * -; * INPUTS : const unsigned char *source : Pointer to source data. -; * unsigned int source_width : Stride of source. -; * unsigned char *dest : Pointer to destination data. -; * unsigned int dest_width : Stride of destination (NOT USED). -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Copies horizontal line of pixels from source to -; * destination scaling up by 1 to 2. -; * -; * SPECIAL NOTES : None. -; * -; ****************************************************************************/ -;void vp8cx_horizontal_line_1_2_scale_c -;( -; const unsigned char *source, -; unsigned int source_width, -; unsigned char *dest, -; unsigned int dest_width -;) -|horizontal_line_1_2_scale_armv4| PROC - stmdb sp!, {r4 - r5, lr} - - sub srcw, srcw, #1 - - ldrb r3, [src], #1 - ldrb r4, [src], #1 -hl12_loop - subs srcw, srcw, #1 - - add r5, r3, r4 - add r5, r5, #1 - mov r5, r5, lsr #1 - - orr r5, r3, r5, lsl #8 - strh r5, [dest], #2 - - mov r3, r4 - - ldrneb r4, [src], #1 - bne hl12_loop - - orr r5, r4, r4, lsl #8 - strh r5, [dest] - - ldmia sp!, {r4 - r5, pc} - ENDP ;|vertical_band_3_5_scale_armv4| - -;/**************************************************************************** -; * -; * ROUTINE : vp8cx_vertical_band_1_2_scale_c -; * -; * INPUTS : unsigned char *dest : Pointer to destination data. -; * unsigned int dest_pitch : Stride of destination data. -; * unsigned int dest_width : Width of destination data. -; * -; * OUTPUTS : None. -; * -; * RETURNS : void -; * -; * FUNCTION : Scales vertical band of pixels by scale 1 to 2. The -; * height of the band scaled is 1-pixel. -; * -; * SPECIAL NOTES : The routine uses the first line of the band below -; * the current band. -; * -; ****************************************************************************/ -;void vp8cx_vertical_band_1_2_scale_c -;( -; r0 = UINT8 *dest -; r1 = UINT32 dest_pitch -; r2 = UINT32 dest_width -;) -|vertical_band_1_2_scale_armv4| PROC - stmdb sp!, {r4 - r7, lr} - - ldr mask, =0xff00ff ; mask for selection - ldr lr, = 0x010001 - -vl12_loop - mov r3, src - ldr r4, [r3], r1 - ldr r5, [r3, r1] - - add src, src, #4 - subs r2, r2, #4 - - and r6, r4, mask - and r7, r5, mask - - add r6, r7, r6 - add r6, r6, lr - - and r4, mask, r4, lsr #8 - and r5, mask, r5, lsr #8 - - mov r6, r6, lsr #1 - and r6, r6, mask - - add r4, r5, r4 - add r4, r4, lr - - mov r4, r4, lsr #1 - and r4, r4, mask - - orr r5, r6, r4, lsl #8 - - str r5, [r3] - - bpl vl12_loop - - ldmia sp!, {r4 - r7, pc} - ENDP ;|vertical_band_3_5_scale_armv4| - - END diff --git a/vpx_scale/wce/scalesystemdependant.c b/vpx_scale/wce/scalesystemdependant.c deleted file mode 100644 index e9f2c26a9..000000000 --- a/vpx_scale/wce/scalesystemdependant.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -#include "vpx_scale/vpxscale.h" - -/**************************************************************************** -* Imports -*****************************************************************************/ - -/**************************************************************************** - * - * ROUTINE : vp8_scale_machine_specific_config - * - * INPUTS : UINT32 Version : Codec version number. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Checks for machine specifc features such as MMX support - * sets appropriate flags and function pointers. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -void vp8_scale_machine_specific_config() -{ - vp8_horizontal_line_1_2_scale = horizontal_line_1_2_scale_armv4; - vp8_vertical_band_1_2_scale = vertical_band_1_2_scale_armv4; - vp8_last_vertical_band_1_2_scale = vp8cx_last_vertical_band_1_2_scale_c; - vp8_horizontal_line_3_5_scale = horizontal_line_3_5_scale_armv4; - vp8_vertical_band_3_5_scale = vertical_band_3_5_scale_armv4; - vp8_last_vertical_band_3_5_scale = vp8cx_last_vertical_band_3_5_scale_c; - vp8_horizontal_line_3_4_scale = horizontal_line_3_4_scale_armv4; - vp8_vertical_band_3_4_scale = vertical_band_3_4_scale_armv4; - vp8_last_vertical_band_3_4_scale = vp8cx_last_vertical_band_3_4_scale_c; - vp8_horizontal_line_2_3_scale = horizontal_line_2_3_scale_armv4; - vp8_vertical_band_2_3_scale = vertical_band_2_3_scale_armv4; - vp8_last_vertical_band_2_3_scale = vp8cx_last_vertical_band_2_3_scale_c; - vp8_horizontal_line_4_5_scale = horizontal_line_4_5_scale_armv4; - vp8_vertical_band_4_5_scale = vertical_band_4_5_scale_armv4; - vp8_last_vertical_band_4_5_scale = vp8cx_last_vertical_band_4_5_scale_c; - - - vp8_vertical_band_5_4_scale = vp8cx_vertical_band_5_4_scale_c; - vp8_vertical_band_5_3_scale = vp8cx_vertical_band_5_3_scale_c; - vp8_vertical_band_2_1_scale = vp8cx_vertical_band_2_1_scale_c; - vp8_vertical_band_2_1_scale_i = vp8cx_vertical_band_2_1_scale_i_c; - vp8_horizontal_line_2_1_scale = vp8cx_horizontal_line_2_1_scale_c; - vp8_horizontal_line_5_3_scale = vp8cx_horizontal_line_5_3_scale_c; - vp8_horizontal_line_5_4_scale = vp8cx_horizontal_line_5_4_scale_c; -} diff --git a/vpx_scale/x86_64/scaleopt.c b/vpx_scale/x86_64/scaleopt.c deleted file mode 100644 index 101f5ff60..000000000 --- a/vpx_scale/x86_64/scaleopt.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/**************************************************************************** -* -* Module Title : scaleopt.cpp -* -* Description : Optimized scaling functions -* -****************************************************************************/ -#include "pragmas.h" - - - -/**************************************************************************** -* Module Statics -****************************************************************************/ -__declspec(align(16)) const static unsigned short one_fifth[] = { 51, 51, 51, 51 }; -__declspec(align(16)) const static unsigned short two_fifths[] = { 102, 102, 102, 102 }; -__declspec(align(16)) const static unsigned short three_fifths[] = { 154, 154, 154, 154 }; -__declspec(align(16)) const static unsigned short four_fifths[] = { 205, 205, 205, 205 }; -__declspec(align(16)) const static unsigned short round_values[] = { 128, 128, 128, 128 }; -__declspec(align(16)) const static unsigned short four_ones[] = { 1, 1, 1, 1}; -__declspec(align(16)) const static unsigned short const45_2[] = {205, 154, 102, 51 }; -__declspec(align(16)) const static unsigned short const45_1[] = { 51, 102, 154, 205 }; -__declspec(align(16)) const static unsigned char mask45[] = { 0, 0, 0, 0, 0, 0, 255, 0}; -__declspec(align(16)) const static unsigned short const35_2[] = { 154, 51, 205, 102 }; -__declspec(align(16)) const static unsigned short const35_1[] = { 102, 205, 51, 154 }; - - - -#include "vpx_scale/vpxscale.h" -#include "vpx_mem/vpx_mem.h" - -/**************************************************************************** -* -* ROUTINE : horizontal_line_3_5_scale_mmx -* -* INPUTS : const unsigned char *source : -* unsigned int source_width : -* unsigned char *dest : -* unsigned int dest_width : -* -* OUTPUTS : None. -* -* RETURNS : void -* -* FUNCTION : 3 to 5 up-scaling of a horizontal line of pixels. -* -* SPECIAL NOTES : None. -* -****************************************************************************/ -static -void horizontal_line_3_5_scale_mmx -( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - (void) dest_width; - - __asm - { - - push rbx - - mov rsi, source - mov rdi, dest - - mov ecx, source_width - lea rdx, [rsi+rcx-3]; - - movq mm5, const35_1 // mm5 = 66 xx cd xx 33 xx 9a xx - movq mm6, const35_2 // mm6 = 9a xx 33 xx cd xx 66 xx - - movq mm4, round_values // mm4 = 80 xx 80 xx 80 xx 80 xx - pxor mm7, mm7 // clear mm7 - - horiz_line_3_5_loop: - - mov eax, DWORD PTR [rsi] // eax = 00 01 02 03 - mov ebx, eax - - and ebx, 0xffff00 // ebx = xx 01 02 xx - mov ecx, eax // ecx = 00 01 02 03 - - and eax, 0xffff0000 // eax = xx xx 02 03 - xor ecx, eax // ecx = 00 01 xx xx - - shr ebx, 8 // ebx = 01 02 xx xx - or eax, ebx // eax = 01 02 02 03 - - shl ebx, 16 // ebx = xx xx 01 02 - movd mm1, eax // mm1 = 01 02 02 03 xx xx xx xx - - or ebx, ecx // ebx = 00 01 01 02 - punpcklbw mm1, mm7 // mm1 = 01 xx 02 xx 02 xx 03 xx - - movd mm0, ebx // mm0 = 00 01 01 02 - pmullw mm1, mm6 // - - punpcklbw mm0, mm7 // mm0 = 00 xx 01 xx 01 xx 02 xx - pmullw mm0, mm5 // - - mov [rdi], ebx // writeoutput 00 xx xx xx - add rsi, 3 - - add rdi, 5 - paddw mm0, mm1 - - paddw mm0, mm4 - psrlw mm0, 8 - - cmp rsi, rdx - packuswb mm0, mm7 - - movd DWORD Ptr [rdi-4], mm0 - jl horiz_line_3_5_loop - -//Exit: - mov eax, DWORD PTR [rsi] // eax = 00 01 02 03 - mov ebx, eax - - and ebx, 0xffff00 // ebx = xx 01 02 xx - mov ecx, eax // ecx = 00 01 02 03 - - and eax, 0xffff0000 // eax = xx xx 02 03 - xor ecx, eax // ecx = 00 01 xx xx - - shr ebx, 8 // ebx = 01 02 xx xx - or eax, ebx // eax = 01 02 02 03 - - shl eax, 8 // eax = xx 01 02 02 - and eax, 0xffff0000 // eax = xx xx 02 02 - - or eax, ebx // eax = 01 02 02 02 - - shl ebx, 16 // ebx = xx xx 01 02 - movd mm1, eax // mm1 = 01 02 02 02 xx xx xx xx - - or ebx, ecx // ebx = 00 01 01 02 - punpcklbw mm1, mm7 // mm1 = 01 xx 02 xx 02 xx 02 xx - - movd mm0, ebx // mm0 = 00 01 01 02 - pmullw mm1, mm6 // - - punpcklbw mm0, mm7 // mm0 = 00 xx 01 xx 01 xx 02 xx - pmullw mm0, mm5 // - - mov [rdi], ebx // writeoutput 00 xx xx xx - paddw mm0, mm1 - - paddw mm0, mm4 - psrlw mm0, 8 - - packuswb mm0, mm7 - movd DWORD Ptr [rdi+1], mm0 - - pop rbx - - } - -} - - -/**************************************************************************** -* -* ROUTINE : horizontal_line_4_5_scale_mmx -* -* INPUTS : const unsigned char *source : -* unsigned int source_width : -* unsigned char *dest : -* unsigned int dest_width : -* -* OUTPUTS : None. -* -* RETURNS : void -* -* FUNCTION : 4 to 5 up-scaling of a horizontal line of pixels. -* -* SPECIAL NOTES : None. -* -****************************************************************************/ -static -void horizontal_line_4_5_scale_mmx -( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - (void)dest_width; - - __asm - { - - mov rsi, source - mov rdi, dest - - mov ecx, source_width - lea rdx, [rsi+rcx-8]; - - movq mm5, const45_1 // mm5 = 33 xx 66 xx 9a xx cd xx - movq mm6, const45_2 // mm6 = cd xx 9a xx 66 xx 33 xx - - movq mm4, round_values // mm4 = 80 xx 80 xx 80 xx 80 xx - pxor mm7, mm7 // clear mm7 - - horiz_line_4_5_loop: - - movq mm0, QWORD PTR [rsi] // mm0 = 00 01 02 03 04 05 06 07 - movq mm1, QWORD PTR [rsi+1]; // mm1 = 01 02 03 04 05 06 07 08 - - movq mm2, mm0 // mm2 = 00 01 02 03 04 05 06 07 - movq mm3, mm1 // mm3 = 01 02 03 04 05 06 07 08 - - movd DWORD PTR [rdi], mm0 // write output 00 xx xx xx - punpcklbw mm0, mm7 // mm0 = 00 xx 01 xx 02 xx 03 xx - - punpcklbw mm1, mm7 // mm1 = 01 xx 02 xx 03 xx 04 xx - pmullw mm0, mm5 // 00* 51 01*102 02*154 03*205 - - pmullw mm1, mm6 // 01*205 02*154 03*102 04* 51 - punpckhbw mm2, mm7 // mm2 = 04 xx 05 xx 06 xx 07 xx - - movd DWORD PTR [rdi+5], mm2 // write ouput 05 xx xx xx - pmullw mm2, mm5 // 04* 51 05*102 06*154 07*205 - - punpckhbw mm3, mm7 // mm3 = 05 xx 06 xx 07 xx 08 xx - pmullw mm3, mm6 // 05*205 06*154 07*102 08* 51 - - paddw mm0, mm1 // added round values - paddw mm0, mm4 - - psrlw mm0, 8 // output: 01 xx 02 xx 03 xx 04 xx - packuswb mm0, mm7 - - movd DWORD PTR [rdi+1], mm0 // write output 01 02 03 04 - add rdi, 10 - - add rsi, 8 - paddw mm2, mm3 // - - paddw mm2, mm4 // added round values - cmp rsi, rdx - - psrlw mm2, 8 - packuswb mm2, mm7 - - movd DWORD PTR [rdi-4], mm2 // writeoutput 06 07 08 09 - jl horiz_line_4_5_loop - -//Exit: - movq mm0, [rsi] // mm0 = 00 01 02 03 04 05 06 07 - movq mm1, mm0 // mm1 = 00 01 02 03 04 05 06 07 - - movq mm2, mm0 // mm2 = 00 01 02 03 04 05 06 07 - psrlq mm1, 8 // mm1 = 01 02 03 04 05 06 07 00 - - movq mm3, mask45 // mm3 = 00 00 00 00 00 00 ff 00 - pand mm3, mm1 // mm3 = 00 00 00 00 00 00 07 00 - - psllq mm3, 8 // mm3 = 00 00 00 00 00 00 00 07 - por mm1, mm3 // mm1 = 01 02 03 04 05 06 07 07 - - movq mm3, mm1 - - movd DWORD PTR [rdi], mm0 // write output 00 xx xx xx - punpcklbw mm0, mm7 // mm0 = 00 xx 01 xx 02 xx 03 xx - - punpcklbw mm1, mm7 // mm1 = 01 xx 02 xx 03 xx 04 xx - pmullw mm0, mm5 // 00* 51 01*102 02*154 03*205 - - pmullw mm1, mm6 // 01*205 02*154 03*102 04* 51 - punpckhbw mm2, mm7 // mm2 = 04 xx 05 xx 06 xx 07 xx - - movd DWORD PTR [rdi+5], mm2 // write ouput 05 xx xx xx - pmullw mm2, mm5 // 04* 51 05*102 06*154 07*205 - - punpckhbw mm3, mm7 // mm3 = 05 xx 06 xx 07 xx 08 xx - pmullw mm3, mm6 // 05*205 06*154 07*102 07* 51 - - paddw mm0, mm1 // added round values - paddw mm0, mm4 - - psrlw mm0, 8 // output: 01 xx 02 xx 03 xx 04 xx - packuswb mm0, mm7 // 01 02 03 04 xx xx xx xx - - movd DWORD PTR [rdi+1], mm0 // write output 01 02 03 04 - paddw mm2, mm3 // - - paddw mm2, mm4 // added round values - psrlw mm2, 8 - - packuswb mm2, mm7 - movd DWORD PTR [rdi+6], mm2 // writeoutput 06 07 08 09 - - - } -} - -/**************************************************************************** -* -* ROUTINE : vertical_band_4_5_scale_mmx -* -* INPUTS : unsigned char *dest : -* unsigned int dest_pitch : -* unsigned int dest_width : -* -* OUTPUTS : None. -* -* RETURNS : void -* -* FUNCTION : 4 to 5 up-scaling of a 4 pixel high band of pixels. -* -* SPECIAL NOTES : The routine uses the first line of the band below -* the current band. The function also has a "C" only -* version. -* -****************************************************************************/ -static -void vertical_band_4_5_scale_mmx -( - unsigned char *dest, - unsigned int dest_pitch, - unsigned int dest_width -) -{ - __asm - { - - mov rsi, dest // Get the source and destination pointer - mov ecx, dest_pitch // Get the pitch size - - lea rdi, [rsi+rcx*2] // tow lines below - add rdi, rcx // three lines below - - pxor mm7, mm7 // clear out mm7 - mov edx, dest_width // Loop counter - - vs_4_5_loop: - - movq mm0, QWORD ptr [rsi] // src[0]; - movq mm1, QWORD ptr [rsi+rcx] // src[1]; - - movq mm2, mm0 // Make a copy - punpcklbw mm0, mm7 // unpack low to word - - movq mm5, one_fifth - punpckhbw mm2, mm7 // unpack high to word - - pmullw mm0, mm5 // a * 1/5 - - movq mm3, mm1 // make a copy - punpcklbw mm1, mm7 // unpack low to word - - pmullw mm2, mm5 // a * 1/5 - movq mm6, four_fifths // constan - - movq mm4, mm1 // copy of low b - pmullw mm4, mm6 // b * 4/5 - - punpckhbw mm3, mm7 // unpack high to word - movq mm5, mm3 // copy of high b - - pmullw mm5, mm6 // b * 4/5 - paddw mm0, mm4 // a * 1/5 + b * 4/5 - - paddw mm2, mm5 // a * 1/5 + b * 4/5 - paddw mm0, round_values // + 128 - - paddw mm2, round_values // + 128 - psrlw mm0, 8 - - psrlw mm2, 8 - packuswb mm0, mm2 // des [1] - - movq QWORD ptr [rsi+rcx], mm0 // write des[1] - movq mm0, [rsi+rcx*2] // mm0 = src[2] - - // mm1, mm3 --- Src[1] - // mm0 --- Src[2] - // mm7 for unpacking - - movq mm5, two_fifths - movq mm2, mm0 // make a copy - - pmullw mm1, mm5 // b * 2/5 - movq mm6, three_fifths - - - punpcklbw mm0, mm7 // unpack low to word - pmullw mm3, mm5 // b * 2/5 - - movq mm4, mm0 // make copy of c - punpckhbw mm2, mm7 // unpack high to word - - pmullw mm4, mm6 // c * 3/5 - movq mm5, mm2 - - pmullw mm5, mm6 // c * 3/5 - paddw mm1, mm4 // b * 2/5 + c * 3/5 - - paddw mm3, mm5 // b * 2/5 + c * 3/5 - paddw mm1, round_values // + 128 - - paddw mm3, round_values // + 128 - psrlw mm1, 8 - - psrlw mm3, 8 - packuswb mm1, mm3 // des[2] - - movq QWORD ptr [rsi+rcx*2], mm1 // write des[2] - movq mm1, [rdi] // mm1=Src[3]; - - // mm0, mm2 --- Src[2] - // mm1 --- Src[3] - // mm6 --- 3/5 - // mm7 for unpacking - - pmullw mm0, mm6 // c * 3/5 - movq mm5, two_fifths // mm5 = 2/5 - - movq mm3, mm1 // make a copy - pmullw mm2, mm6 // c * 3/5 - - punpcklbw mm1, mm7 // unpack low - movq mm4, mm1 // make a copy - - punpckhbw mm3, mm7 // unpack high - pmullw mm4, mm5 // d * 2/5 - - movq mm6, mm3 // make a copy - pmullw mm6, mm5 // d * 2/5 - - paddw mm0, mm4 // c * 3/5 + d * 2/5 - paddw mm2, mm6 // c * 3/5 + d * 2/5 - - paddw mm0, round_values // + 128 - paddw mm2, round_values // + 128 - - psrlw mm0, 8 - psrlw mm2, 8 - - packuswb mm0, mm2 // des[3] - movq QWORD ptr [rdi], mm0 // write des[3] - - // mm1, mm3 --- Src[3] - // mm7 -- cleared for unpacking - - movq mm0, [rdi+rcx*2] // mm0, Src[0] of the next group - - movq mm5, four_fifths // mm5 = 4/5 - pmullw mm1, mm5 // d * 4/5 - - movq mm6, one_fifth // mm6 = 1/5 - movq mm2, mm0 // make a copy - - pmullw mm3, mm5 // d * 4/5 - punpcklbw mm0, mm7 // unpack low - - pmullw mm0, mm6 // an * 1/5 - punpckhbw mm2, mm7 // unpack high - - paddw mm1, mm0 // d * 4/5 + an * 1/5 - pmullw mm2, mm6 // an * 1/5 - - paddw mm3, mm2 // d * 4/5 + an * 1/5 - paddw mm1, round_values // + 128 - - paddw mm3, round_values // + 128 - psrlw mm1, 8 - - psrlw mm3, 8 - packuswb mm1, mm3 // des[4] - - movq QWORD ptr [rdi+rcx], mm1 // write des[4] - - add rdi, 8 - add rsi, 8 - - sub rdx, 8 - jg vs_4_5_loop - } -} - -/**************************************************************************** -* -* ROUTINE : last_vertical_band_4_5_scale_mmx -* -* INPUTS : unsigned char *dest : -* unsigned int dest_pitch : -* unsigned int dest_width : -* -* OUTPUTS : None. -* -* RETURNS : None -* -* FUNCTION : 4 to 5 up-scaling of the last 4-pixel high band in an image. -* -* SPECIAL NOTES : The routine uses the first line of the band below -* the current band. The function also has an "C" only -* version. -* -****************************************************************************/ -static -void last_vertical_band_4_5_scale_mmx -( - unsigned char *dest, - unsigned int dest_pitch, - unsigned int dest_width -) -{ - __asm - { - mov rsi, dest // Get the source and destination pointer - mov ecx, dest_pitch // Get the pitch size - - lea rdi, [rsi+rcx*2] // tow lines below - add rdi, rcx // three lines below - - pxor mm7, mm7 // clear out mm7 - mov edx, dest_width // Loop counter - - last_vs_4_5_loop: - - movq mm0, QWORD ptr [rsi] // src[0]; - movq mm1, QWORD ptr [rsi+rcx] // src[1]; - - movq mm2, mm0 // Make a copy - punpcklbw mm0, mm7 // unpack low to word - - movq mm5, one_fifth - punpckhbw mm2, mm7 // unpack high to word - - pmullw mm0, mm5 // a * 1/5 - - movq mm3, mm1 // make a copy - punpcklbw mm1, mm7 // unpack low to word - - pmullw mm2, mm5 // a * 1/5 - movq mm6, four_fifths // constan - - movq mm4, mm1 // copy of low b - pmullw mm4, mm6 // b * 4/5 - - punpckhbw mm3, mm7 // unpack high to word - movq mm5, mm3 // copy of high b - - pmullw mm5, mm6 // b * 4/5 - paddw mm0, mm4 // a * 1/5 + b * 4/5 - - paddw mm2, mm5 // a * 1/5 + b * 4/5 - paddw mm0, round_values // + 128 - - paddw mm2, round_values // + 128 - psrlw mm0, 8 - - psrlw mm2, 8 - packuswb mm0, mm2 // des [1] - - movq QWORD ptr [rsi+rcx], mm0 // write des[1] - movq mm0, [rsi+rcx*2] // mm0 = src[2] - - // mm1, mm3 --- Src[1] - // mm0 --- Src[2] - // mm7 for unpacking - - movq mm5, two_fifths - movq mm2, mm0 // make a copy - - pmullw mm1, mm5 // b * 2/5 - movq mm6, three_fifths - - - punpcklbw mm0, mm7 // unpack low to word - pmullw mm3, mm5 // b * 2/5 - - movq mm4, mm0 // make copy of c - punpckhbw mm2, mm7 // unpack high to word - - pmullw mm4, mm6 // c * 3/5 - movq mm5, mm2 - - pmullw mm5, mm6 // c * 3/5 - paddw mm1, mm4 // b * 2/5 + c * 3/5 - - paddw mm3, mm5 // b * 2/5 + c * 3/5 - paddw mm1, round_values // + 128 - - paddw mm3, round_values // + 128 - psrlw mm1, 8 - - psrlw mm3, 8 - packuswb mm1, mm3 // des[2] - - movq QWORD ptr [rsi+rcx*2], mm1 // write des[2] - movq mm1, [rdi] // mm1=Src[3]; - - movq QWORD ptr [rdi+rcx], mm1 // write des[4]; - - // mm0, mm2 --- Src[2] - // mm1 --- Src[3] - // mm6 --- 3/5 - // mm7 for unpacking - - pmullw mm0, mm6 // c * 3/5 - movq mm5, two_fifths // mm5 = 2/5 - - movq mm3, mm1 // make a copy - pmullw mm2, mm6 // c * 3/5 - - punpcklbw mm1, mm7 // unpack low - movq mm4, mm1 // make a copy - - punpckhbw mm3, mm7 // unpack high - pmullw mm4, mm5 // d * 2/5 - - movq mm6, mm3 // make a copy - pmullw mm6, mm5 // d * 2/5 - - paddw mm0, mm4 // c * 3/5 + d * 2/5 - paddw mm2, mm6 // c * 3/5 + d * 2/5 - - paddw mm0, round_values // + 128 - paddw mm2, round_values // + 128 - - psrlw mm0, 8 - psrlw mm2, 8 - - packuswb mm0, mm2 // des[3] - movq QWORD ptr [rdi], mm0 // write des[3] - - // mm1, mm3 --- Src[3] - // mm7 -- cleared for unpacking - add rdi, 8 - add rsi, 8 - - sub rdx, 8 - jg last_vs_4_5_loop - } -} - -/**************************************************************************** -* -* ROUTINE : vertical_band_3_5_scale_mmx -* -* INPUTS : unsigned char *dest : -* unsigned int dest_pitch : -* unsigned int dest_width : -* -* OUTPUTS : None. -* -* RETURNS : void -* -* FUNCTION : 3 to 5 up-scaling of a 3-pixel high band of pixels. -* -* SPECIAL NOTES : The routine uses the first line of the band below -* the current band. The function also has an "C" only -* version. -* -****************************************************************************/ -static -void vertical_band_3_5_scale_mmx -( - unsigned char *dest, - unsigned int dest_pitch, - unsigned int dest_width -) -{ - __asm - { - mov rsi, dest // Get the source and destination pointer - mov ecx, dest_pitch // Get the pitch size - - lea rdi, [rsi+rcx*2] // two lines below - add rdi, rcx // three lines below - - pxor mm7, mm7 // clear out mm7 - mov edx, dest_width // Loop counter - - vs_3_5_loop: - - movq mm0, QWORD ptr [rsi] // src[0]; - movq mm1, QWORD ptr [rsi+rcx] // src[1]; - - movq mm2, mm0 // Make a copy - punpcklbw mm0, mm7 // unpack low to word - - movq mm5, two_fifths // mm5 = 2/5 - punpckhbw mm2, mm7 // unpack high to word - - pmullw mm0, mm5 // a * 2/5 - - movq mm3, mm1 // make a copy - punpcklbw mm1, mm7 // unpack low to word - - pmullw mm2, mm5 // a * 2/5 - movq mm6, three_fifths // mm6 = 3/5 - - movq mm4, mm1 // copy of low b - pmullw mm4, mm6 // b * 3/5 - - punpckhbw mm3, mm7 // unpack high to word - movq mm5, mm3 // copy of high b - - pmullw mm5, mm6 // b * 3/5 - paddw mm0, mm4 // a * 2/5 + b * 3/5 - - paddw mm2, mm5 // a * 2/5 + b * 3/5 - paddw mm0, round_values // + 128 - - paddw mm2, round_values // + 128 - psrlw mm0, 8 - - psrlw mm2, 8 - packuswb mm0, mm2 // des [1] - - movq QWORD ptr [rsi+rcx], mm0 // write des[1] - movq mm0, [rsi+rcx*2] // mm0 = src[2] - - // mm1, mm3 --- Src[1] - // mm0 --- Src[2] - // mm7 for unpacking - - movq mm4, mm1 // b low - pmullw mm1, four_fifths // b * 4/5 low - - movq mm5, mm3 // b high - pmullw mm3, four_fifths // b * 4/5 high - - movq mm2, mm0 // c - pmullw mm4, one_fifth // b * 1/5 - - punpcklbw mm0, mm7 // c low - pmullw mm5, one_fifth // b * 1/5 - - movq mm6, mm0 // make copy of c low - punpckhbw mm2, mm7 // c high - - pmullw mm6, one_fifth // c * 1/5 low - movq mm7, mm2 // make copy of c high - - pmullw mm7, one_fifth // c * 1/5 high - paddw mm1, mm6 // b * 4/5 + c * 1/5 low - - paddw mm3, mm7 // b * 4/5 + c * 1/5 high - movq mm6, mm0 // make copy of c low - - pmullw mm6, four_fifths // c * 4/5 low - movq mm7, mm2 // make copy of c high - - pmullw mm7, four_fifths // c * 4/5 high - - paddw mm4, mm6 // b * 1/5 + c * 4/5 low - paddw mm5, mm7 // b * 1/5 + c * 4/5 high - - paddw mm1, round_values // + 128 - paddw mm3, round_values // + 128 - - psrlw mm1, 8 - psrlw mm3, 8 - - packuswb mm1, mm3 // des[2] - movq QWORD ptr [rsi+rcx*2], mm1 // write des[2] - - paddw mm4, round_values // + 128 - paddw mm5, round_values // + 128 - - psrlw mm4, 8 - psrlw mm5, 8 - - packuswb mm4, mm5 // des[3] - movq QWORD ptr [rdi], mm4 // write des[3] - - // mm0, mm2 --- Src[3] - - pxor mm7, mm7 // clear mm7 for unpacking - movq mm1, [rdi+rcx*2] // mm1 = Src[0] of the next group - - movq mm5, three_fifths // mm5 = 3/5 - pmullw mm0, mm5 // d * 3/5 - - movq mm6, two_fifths // mm6 = 2/5 - movq mm3, mm1 // make a copy - - pmullw mm2, mm5 // d * 3/5 - punpcklbw mm1, mm7 // unpack low - - pmullw mm1, mm6 // an * 2/5 - punpckhbw mm3, mm7 // unpack high - - paddw mm0, mm1 // d * 3/5 + an * 2/5 - pmullw mm3, mm6 // an * 2/5 - - paddw mm2, mm3 // d * 3/5 + an * 2/5 - paddw mm0, round_values // + 128 - - paddw mm2, round_values // + 128 - psrlw mm0, 8 - - psrlw mm2, 8 - packuswb mm0, mm2 // des[4] - - movq QWORD ptr [rdi+rcx], mm0 // write des[4] - - add rdi, 8 - add rsi, 8 - - sub rdx, 8 - jg vs_3_5_loop - } -} - -/**************************************************************************** -* -* ROUTINE : last_vertical_band_3_5_scale_mmx -* -* INPUTS : unsigned char *dest : -* unsigned int dest_pitch : -* unsigned int dest_width : -* -* OUTPUTS : None. -* -* RETURNS : void -* -* FUNCTION : 3 to 5 up-scaling of a 3-pixel high band of pixels. -* -* SPECIAL NOTES : The routine uses the first line of the band below -* the current band. The function also has an "C" only -* version. -* -****************************************************************************/ -static -void last_vertical_band_3_5_scale_mmx -( - unsigned char *dest, - unsigned int dest_pitch, - unsigned int dest_width -) -{ - __asm - { - mov rsi, dest // Get the source and destination pointer - mov ecx, dest_pitch // Get the pitch size - - lea rdi, [rsi+rcx*2] // tow lines below - add rdi, rcx // three lines below - - pxor mm7, mm7 // clear out mm7 - mov edx, dest_width // Loop counter - - - last_vs_3_5_loop: - - movq mm0, QWORD ptr [rsi] // src[0]; - movq mm1, QWORD ptr [rsi+rcx] // src[1]; - - movq mm2, mm0 // Make a copy - punpcklbw mm0, mm7 // unpack low to word - - movq mm5, two_fifths // mm5 = 2/5 - punpckhbw mm2, mm7 // unpack high to word - - pmullw mm0, mm5 // a * 2/5 - - movq mm3, mm1 // make a copy - punpcklbw mm1, mm7 // unpack low to word - - pmullw mm2, mm5 // a * 2/5 - movq mm6, three_fifths // mm6 = 3/5 - - movq mm4, mm1 // copy of low b - pmullw mm4, mm6 // b * 3/5 - - punpckhbw mm3, mm7 // unpack high to word - movq mm5, mm3 // copy of high b - - pmullw mm5, mm6 // b * 3/5 - paddw mm0, mm4 // a * 2/5 + b * 3/5 - - paddw mm2, mm5 // a * 2/5 + b * 3/5 - paddw mm0, round_values // + 128 - - paddw mm2, round_values // + 128 - psrlw mm0, 8 - - psrlw mm2, 8 - packuswb mm0, mm2 // des [1] - - movq QWORD ptr [rsi+rcx], mm0 // write des[1] - movq mm0, [rsi+rcx*2] // mm0 = src[2] - - - - // mm1, mm3 --- Src[1] - // mm0 --- Src[2] - // mm7 for unpacking - - movq mm4, mm1 // b low - pmullw mm1, four_fifths // b * 4/5 low - - movq QWORD ptr [rdi+rcx], mm0 // write des[4] - - movq mm5, mm3 // b high - pmullw mm3, four_fifths // b * 4/5 high - - movq mm2, mm0 // c - pmullw mm4, one_fifth // b * 1/5 - - punpcklbw mm0, mm7 // c low - pmullw mm5, one_fifth // b * 1/5 - - movq mm6, mm0 // make copy of c low - punpckhbw mm2, mm7 // c high - - pmullw mm6, one_fifth // c * 1/5 low - movq mm7, mm2 // make copy of c high - - pmullw mm7, one_fifth // c * 1/5 high - paddw mm1, mm6 // b * 4/5 + c * 1/5 low - - paddw mm3, mm7 // b * 4/5 + c * 1/5 high - movq mm6, mm0 // make copy of c low - - pmullw mm6, four_fifths // c * 4/5 low - movq mm7, mm2 // make copy of c high - - pmullw mm7, four_fifths // c * 4/5 high - - paddw mm4, mm6 // b * 1/5 + c * 4/5 low - paddw mm5, mm7 // b * 1/5 + c * 4/5 high - - paddw mm1, round_values // + 128 - paddw mm3, round_values // + 128 - - psrlw mm1, 8 - psrlw mm3, 8 - - packuswb mm1, mm3 // des[2] - movq QWORD ptr [rsi+rcx*2], mm1 // write des[2] - - paddw mm4, round_values // + 128 - paddw mm5, round_values // + 128 - - psrlw mm4, 8 - psrlw mm5, 8 - - packuswb mm4, mm5 // des[3] - movq QWORD ptr [rdi], mm4 // write des[3] - - // mm0, mm2 --- Src[3] - - add rdi, 8 - add rsi, 8 - - sub rdx, 8 - jg last_vs_3_5_loop - } -} - -/**************************************************************************** -* -* ROUTINE : vertical_band_1_2_scale_mmx -* -* INPUTS : unsigned char *dest : -* unsigned int dest_pitch : -* unsigned int dest_width : -* -* OUTPUTS : None. -* -* RETURNS : void -* -* FUNCTION : 1 to 2 up-scaling of a band of pixels. -* -* SPECIAL NOTES : The routine uses the first line of the band below -* the current band. The function also has an "C" only -* version. -* -****************************************************************************/ -static -void vertical_band_1_2_scale_mmx -( - unsigned char *dest, - unsigned int dest_pitch, - unsigned int dest_width -) -{ - __asm - { - - mov rsi, dest // Get the source and destination pointer - mov ecx, dest_pitch // Get the pitch size - - pxor mm7, mm7 // clear out mm7 - mov edx, dest_width // Loop counter - - vs_1_2_loop: - - movq mm0, [rsi] // get Src[0] - movq mm1, [rsi + rcx * 2] // get Src[1] - - movq mm2, mm0 // make copy before unpack - movq mm3, mm1 // make copy before unpack - - punpcklbw mm0, mm7 // low Src[0] - movq mm6, four_ones // mm6= 1, 1, 1, 1 - - punpcklbw mm1, mm7 // low Src[1] - paddw mm0, mm1 // low (a + b) - - punpckhbw mm2, mm7 // high Src[0] - paddw mm0, mm6 // low (a + b + 1) - - punpckhbw mm3, mm7 - paddw mm2, mm3 // high (a + b ) - - psraw mm0, 1 // low (a + b +1 )/2 - paddw mm2, mm6 // high (a + b + 1) - - psraw mm2, 1 // high (a + b + 1)/2 - packuswb mm0, mm2 // pack results - - movq [rsi+rcx], mm0 // write out eight bytes - add rsi, 8 - - sub rdx, 8 - jg vs_1_2_loop - } - -} - -/**************************************************************************** -* -* ROUTINE : last_vertical_band_1_2_scale_mmx -* -* INPUTS : unsigned char *dest : -* unsigned int dest_pitch : -* unsigned int dest_width : -* -* OUTPUTS : None. -* -* RETURNS : void -* -* FUNCTION : 1 to 2 up-scaling of band of pixels. -* -* SPECIAL NOTES : The routine uses the first line of the band below -* the current band. The function also has an "C" only -* version. -* -****************************************************************************/ -static -void last_vertical_band_1_2_scale_mmx -( - unsigned char *dest, - unsigned int dest_pitch, - unsigned int dest_width -) -{ - __asm - { - mov rsi, dest // Get the source and destination pointer - mov ecx, dest_pitch // Get the pitch size - - mov edx, dest_width // Loop counter - - last_vs_1_2_loop: - - movq mm0, [rsi] // get Src[0] - movq [rsi+rcx], mm0 // write out eight bytes - - add rsi, 8 - sub rdx, 8 - - jg last_vs_1_2_loop - } -} - -/**************************************************************************** -* -* ROUTINE : horizontal_line_1_2_scale -* -* INPUTS : const unsigned char *source : -* unsigned int source_width : -* unsigned char *dest : -* unsigned int dest_width : -* -* OUTPUTS : None. -* -* RETURNS : void -* -* FUNCTION : 1 to 2 up-scaling of a horizontal line of pixels. -* -* SPECIAL NOTES : None. -* -****************************************************************************/ -static -void horizontal_line_1_2_scale_mmx -( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - (void) dest_width; - - __asm - { - mov rsi, source - mov rdi, dest - - pxor mm7, mm7 - movq mm6, four_ones - - mov ecx, source_width - - hs_1_2_loop: - - movq mm0, [rsi] - movq mm1, [rsi+1] - - movq mm2, mm0 - movq mm3, mm1 - - movq mm4, mm0 - punpcklbw mm0, mm7 - - punpcklbw mm1, mm7 - paddw mm0, mm1 - - paddw mm0, mm6 - punpckhbw mm2, mm7 - - punpckhbw mm3, mm7 - paddw mm2, mm3 - - paddw mm2, mm6 - psraw mm0, 1 - - psraw mm2, 1 - packuswb mm0, mm2 - - movq mm2, mm4 - punpcklbw mm2, mm0 - - movq [rdi], mm2 - punpckhbw mm4, mm0 - - movq [rdi+8], mm4 - add rsi, 8 - - add rdi, 16 - sub rcx, 8 - - cmp rcx, 8 - jg hs_1_2_loop - -// last eight pixel - - movq mm0, [rsi] - movq mm1, mm0 - - movq mm2, mm0 - movq mm3, mm1 - - psrlq mm1, 8 - psrlq mm3, 56 - - psllq mm3, 56 - por mm1, mm3 - - movq mm3, mm1 - movq mm4, mm0 - - punpcklbw mm0, mm7 - punpcklbw mm1, mm7 - - paddw mm0, mm1 - paddw mm0, mm6 - - punpckhbw mm2, mm7 - punpckhbw mm3, mm7 - - paddw mm2, mm3 - paddw mm2, mm6 - - psraw mm0, 1 - psraw mm2, 1 - - packuswb mm0, mm2 - movq mm2, mm4 - - punpcklbw mm2, mm0 - movq [rdi], mm2 - - punpckhbw mm4, mm0 - movq [rdi+8], mm4 - } -} - - - - - -__declspec(align(16)) const static unsigned short const54_2[] = { 0, 64, 128, 192 }; -__declspec(align(16)) const static unsigned short const54_1[] = {256, 192, 128, 64 }; - - -/**************************************************************************** -* -* ROUTINE : horizontal_line_5_4_scale_mmx -* -* INPUTS : const unsigned char *source : Pointer to source data. -* unsigned int source_width : Stride of source. -* unsigned char *dest : Pointer to destination data. -* unsigned int dest_width : Stride of destination (NOT USED). -* -* OUTPUTS : None. -* -* RETURNS : void -* -* FUNCTION : Copies horizontal line of pixels from source to -* destination scaling up by 4 to 5. -* -* SPECIAL NOTES : None. -* -****************************************************************************/ -static -void horizontal_line_5_4_scale_mmx -( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - /* - unsigned i; - unsigned int a, b, c, d, e; - unsigned char *des = dest; - const unsigned char *src = source; - - (void) dest_width; - - for ( i=0; i<source_width; i+=5 ) - { - a = src[0]; - b = src[1]; - c = src[2]; - d = src[3]; - e = src[4]; - - des[0] = a; - des[1] = ((b*192 + c* 64 + 128)>>8); - des[2] = ((c*128 + d*128 + 128)>>8); - des[3] = ((d* 64 + e*192 + 128)>>8); - - src += 5; - des += 4; - } - */ - __asm - { - - mov rsi, source ; - mov rdi, dest ; - - mov ecx, source_width ; - movq mm5, const54_1 ; - - pxor mm7, mm7 ; - movq mm6, const54_2 ; - - movq mm4, round_values ; - lea rdx, [rsi+rcx] ; - horizontal_line_5_4_loop: - - movq mm0, QWORD PTR [rsi] ; - 00 01 02 03 04 05 06 07 - movq mm1, mm0 ; - 00 01 02 03 04 05 06 07 - - psrlq mm0, 8 ; - 01 02 03 04 05 06 07 xx - punpcklbw mm1, mm7 ; - xx 00 xx 01 xx 02 xx 03 - - punpcklbw mm0, mm7 ; - xx 01 xx 02 xx 03 xx 04 - pmullw mm1, mm5 - - pmullw mm0, mm6 - add rsi, 5 - - add rdi, 4 - paddw mm1, mm0 - - paddw mm1, mm4 - psrlw mm1, 8 - - cmp rsi, rdx - packuswb mm1, mm7 - - movd DWORD PTR [rdi-4], mm1 - - jl horizontal_line_5_4_loop - - } - -} -__declspec(align(16)) const static unsigned short one_fourths[] = { 64, 64, 64, 64 }; -__declspec(align(16)) const static unsigned short two_fourths[] = { 128, 128, 128, 128 }; -__declspec(align(16)) const static unsigned short three_fourths[] = { 192, 192, 192, 192 }; - -static -void vertical_band_5_4_scale_mmx -( - unsigned char *source, - unsigned int src_pitch, - unsigned char *dest, - unsigned int dest_pitch, - unsigned int dest_width -) -{ - - __asm - { - - mov rsi, source // Get the source and destination pointer - mov ecx, src_pitch // Get the pitch size - - mov rdi, dest // tow lines below - pxor mm7, mm7 // clear out mm7 - - mov edx, dest_pitch // Loop counter - mov ebx, dest_width - - vs_5_4_loop: - - movd mm0, DWORD ptr [rsi] // src[0]; - movd mm1, DWORD ptr [rsi+rcx] // src[1]; - - movd mm2, DWORD ptr [rsi+rcx*2] - lea rax, [rsi+rcx*2] // - - punpcklbw mm1, mm7 - punpcklbw mm2, mm7 - - movq mm3, mm2 - pmullw mm1, three_fourths - - pmullw mm2, one_fourths - movd mm4, [rax+rcx] - - pmullw mm3, two_fourths - punpcklbw mm4, mm7 - - movq mm5, mm4 - pmullw mm4, two_fourths - - paddw mm1, mm2 - movd mm6, [rax+rcx*2] - - pmullw mm5, one_fourths - paddw mm1, round_values; - - paddw mm3, mm4 - psrlw mm1, 8 - - punpcklbw mm6, mm7 - paddw mm3, round_values - - pmullw mm6, three_fourths - psrlw mm3, 8 - - packuswb mm1, mm7 - packuswb mm3, mm7 - - movd DWORD PTR [rdi], mm0 - movd DWORD PTR [rdi+rdx], mm1 - - - paddw mm5, mm6 - movd DWORD PTR [rdi+rdx*2], mm3 - - lea rax, [rdi+rdx*2] - paddw mm5, round_values - - psrlw mm5, 8 - add rdi, 4 - - packuswb mm5, mm7 - movd DWORD PTR [rax+rdx], mm5 - - add rsi, 4 - sub rbx, 4 - - jg vs_5_4_loop - } -} - - -__declspec(align(16)) const static unsigned short const53_1[] = { 0, 85, 171, 0 }; -__declspec(align(16)) const static unsigned short const53_2[] = {256, 171, 85, 0 }; - - -static -void horizontal_line_5_3_scale_mmx -( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - __asm - { - - mov rsi, source ; - mov rdi, dest ; - - mov ecx, source_width ; - movq mm5, const53_1 ; - - pxor mm7, mm7 ; - movq mm6, const53_2 ; - - movq mm4, round_values ; - lea rdx, [rsi+rcx-5] ; - horizontal_line_5_3_loop: - - movq mm0, QWORD PTR [rsi] ; - 00 01 02 03 04 05 06 07 - movq mm1, mm0 ; - 00 01 02 03 04 05 06 07 - - psllw mm0, 8 ; - xx 00 xx 02 xx 04 xx 06 - psrlw mm1, 8 ; - 01 xx 03 xx 05 xx 07 xx - - psrlw mm0, 8 ; - 00 xx 02 xx 04 xx 06 xx - psllq mm1, 16 ; - xx xx 01 xx 03 xx 05 xx - - pmullw mm0, mm6 - - pmullw mm1, mm5 - add rsi, 5 - - add rdi, 3 - paddw mm1, mm0 - - paddw mm1, mm4 - psrlw mm1, 8 - - cmp rsi, rdx - packuswb mm1, mm7 - - movd DWORD PTR [rdi-3], mm1 - jl horizontal_line_5_3_loop - -//exit condition - movq mm0, QWORD PTR [rsi] ; - 00 01 02 03 04 05 06 07 - movq mm1, mm0 ; - 00 01 02 03 04 05 06 07 - - psllw mm0, 8 ; - xx 00 xx 02 xx 04 xx 06 - psrlw mm1, 8 ; - 01 xx 03 xx 05 xx 07 xx - - psrlw mm0, 8 ; - 00 xx 02 xx 04 xx 06 xx - psllq mm1, 16 ; - xx xx 01 xx 03 xx 05 xx - - pmullw mm0, mm6 - - pmullw mm1, mm5 - paddw mm1, mm0 - - paddw mm1, mm4 - psrlw mm1, 8 - - packuswb mm1, mm7 - movd rax, mm1 - - mov rdx, rax - shr rdx, 16 - - mov WORD PTR[rdi], ax - mov BYTE PTR[rdi+2], dl - - } - -} - -__declspec(align(16)) const static unsigned short one_thirds[] = { 85, 85, 85, 85 }; -__declspec(align(16)) const static unsigned short two_thirds[] = { 171, 171, 171, 171 }; - -static -void vertical_band_5_3_scale_mmx -( - unsigned char *source, - unsigned int src_pitch, - unsigned char *dest, - unsigned int dest_pitch, - unsigned int dest_width -) -{ - - __asm - { - - mov rsi, source // Get the source and destination pointer - mov ecx, src_pitch // Get the pitch size - - mov rdi, dest // tow lines below - pxor mm7, mm7 // clear out mm7 - - mov edx, dest_pitch // Loop counter - movq mm5, one_thirds - - movq mm6, two_thirds - mov ebx, dest_width; - - vs_5_3_loop: - - movd mm0, DWORD ptr [rsi] // src[0]; - movd mm1, DWORD ptr [rsi+rcx] // src[1]; - - movd mm2, DWORD ptr [rsi+rcx*2] - lea rax, [rsi+rcx*2] // - - punpcklbw mm1, mm7 - punpcklbw mm2, mm7 - - pmullw mm1, mm5 - pmullw mm2, mm6 - - movd mm3, DWORD ptr [rax+rcx] - movd mm4, DWORD ptr [rax+rcx*2] - - punpcklbw mm3, mm7 - punpcklbw mm4, mm7 - - pmullw mm3, mm6 - pmullw mm4, mm5 - - - movd DWORD PTR [rdi], mm0 - paddw mm1, mm2 - - paddw mm1, round_values - psrlw mm1, 8 - - packuswb mm1, mm7 - paddw mm3, mm4 - - paddw mm3, round_values - movd DWORD PTR [rdi+rdx], mm1 - - psrlw mm3, 8 - packuswb mm3, mm7 - - movd DWORD PTR [rdi+rdx*2], mm3 - - - add rdi, 4 - add rsi, 4 - - sub rbx, 4 - jg vs_5_3_loop - } -} - - - - -/**************************************************************************** -* -* ROUTINE : horizontal_line_2_1_scale -* -* INPUTS : const unsigned char *source : -* unsigned int source_width : -* unsigned char *dest : -* unsigned int dest_width : -* -* OUTPUTS : None. -* -* RETURNS : void -* -* FUNCTION : 1 to 2 up-scaling of a horizontal line of pixels. -* -* SPECIAL NOTES : None. -* -****************************************************************************/ -static -void horizontal_line_2_1_scale_mmx -( - const unsigned char *source, - unsigned int source_width, - unsigned char *dest, - unsigned int dest_width -) -{ - (void) dest_width; - - __asm - { - mov rsi, source - mov rdi, dest - - pxor mm7, mm7 - mov ecx, dest_width - - xor rdx, rdx - hs_2_1_loop: - - movq mm0, [rsi+rdx*2] - psllw mm0, 8 - - psrlw mm0, 8 - packuswb mm0, mm7 - - movd DWORD Ptr [rdi+rdx], mm0; - add rdx, 4 - - cmp rdx, rcx - jl hs_2_1_loop - - } -} - - - -static -void vertical_band_2_1_scale_mmx -( - unsigned char *source, - unsigned int src_pitch, - unsigned char *dest, - unsigned int dest_pitch, - unsigned int dest_width) -{ - vpx_memcpy(dest, source, dest_width); -} - - -__declspec(align(16)) const static unsigned short three_sixteenths[] = { 48, 48, 48, 48 }; -__declspec(align(16)) const static unsigned short ten_sixteenths[] = { 160, 160, 160, 160 }; - -static -void vertical_band_2_1_scale_i_mmx -( - unsigned char *source, - unsigned int src_pitch, - unsigned char *dest, - unsigned int dest_pitch, - unsigned int dest_width -) -{ - __asm - { - mov rsi, source - mov rdi, dest - - mov eax, src_pitch - mov edx, dest_width - - pxor mm7, mm7 - sub rsi, rax //back one line - - - lea rcx, [rsi+rdx]; - movq mm6, round_values; - - movq mm5, three_sixteenths; - movq mm4, ten_sixteenths; - - vs_2_1_i_loop: - movd mm0, [rsi] // - movd mm1, [rsi+rax] // - - movd mm2, [rsi+rax*2] // - punpcklbw mm0, mm7 - - pmullw mm0, mm5 - punpcklbw mm1, mm7 - - pmullw mm1, mm4 - punpcklbw mm2, mm7 - - pmullw mm2, mm5 - paddw mm0, round_values - - paddw mm1, mm2 - paddw mm0, mm1 - - psrlw mm0, 8 - packuswb mm0, mm7 - - movd DWORD PTR [rdi], mm0 - add rsi, 4 - - add rdi, 4; - cmp rsi, rcx - jl vs_2_1_i_loop - - } -} - - - -void -register_mmxscalers(void) -{ - vp8_horizontal_line_1_2_scale = horizontal_line_1_2_scale_mmx; - vp8_horizontal_line_3_5_scale = horizontal_line_3_5_scale_mmx; - vp8_horizontal_line_4_5_scale = horizontal_line_4_5_scale_mmx; - vp8_vertical_band_1_2_scale = vertical_band_1_2_scale_mmx; - vp8_last_vertical_band_1_2_scale = last_vertical_band_1_2_scale_mmx; - vp8_vertical_band_3_5_scale = vertical_band_3_5_scale_mmx; - vp8_last_vertical_band_3_5_scale = last_vertical_band_3_5_scale_mmx; - vp8_vertical_band_4_5_scale = vertical_band_4_5_scale_mmx; - vp8_last_vertical_band_4_5_scale = last_vertical_band_4_5_scale_mmx; - - vp8_vertical_band_5_4_scale = vertical_band_5_4_scale_mmx; - vp8_vertical_band_5_3_scale = vertical_band_5_3_scale_mmx; - vp8_vertical_band_2_1_scale = vertical_band_2_1_scale_mmx; - vp8_vertical_band_2_1_scale_i = vertical_band_2_1_scale_i_mmx; - vp8_horizontal_line_2_1_scale = horizontal_line_2_1_scale_mmx; - vp8_horizontal_line_5_3_scale = horizontal_line_5_3_scale_mmx; - vp8_horizontal_line_5_4_scale = horizontal_line_5_4_scale_mmx; -} diff --git a/vpx_scale/x86_64/scalesystemdependant.c b/vpx_scale/x86_64/scalesystemdependant.c deleted file mode 100644 index 89ae86e00..000000000 --- a/vpx_scale/x86_64/scalesystemdependant.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/**************************************************************************** -* -* Module Title : system_dependant.c -* -* Description : Miscellaneous system dependant functions -* -****************************************************************************/ - -/**************************************************************************** -* Header Files -****************************************************************************/ -#include "vpx_scale/vpxscale.h" -#include "cpuidlib.h" - -/**************************************************************************** -* Imports -*****************************************************************************/ -extern void register_generic_scalers(void); -extern void register_mmxscalers(void); - -/**************************************************************************** - * - * ROUTINE : post_proc_machine_specific_config - * - * INPUTS : UINT32 Version : Codec version number. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Checks for machine specifc features such as MMX support - * sets appropriate flags and function pointers. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -void -vp8_scale_machine_specific_config(void) -{ - int wmt_enabled = 1; - - if (wmt_enabled) - { - register_mmxscalers(); - } - else - { - register_generic_scalers(); - } -} |