diff options
Diffstat (limited to 'libvideoeditor/vss/video_filters')
13 files changed, 0 insertions, 2966 deletions
diff --git a/libvideoeditor/vss/video_filters/Android.mk b/libvideoeditor/vss/video_filters/Android.mk deleted file mode 100755 index e2d2111..0000000 --- a/libvideoeditor/vss/video_filters/Android.mk +++ /dev/null @@ -1,5 +0,0 @@ -#LOCAL_PATH:= $(call my-dir) -#include $(CLEAR_VARS) - -#include $(call all-makefiles-under,$(LOCAL_PATH)) -include $(call all-subdir-makefiles) diff --git a/libvideoeditor/vss/video_filters/src/Android.mk b/libvideoeditor/vss/video_filters/src/Android.mk deleted file mode 100755 index 88fa974..0000000 --- a/libvideoeditor/vss/video_filters/src/Android.mk +++ /dev/null @@ -1,52 +0,0 @@ -# -# Copyright (C) 2011 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -LOCAL_PATH:= $(call my-dir) - -# -# libvideofilters -# - -include $(CLEAR_VARS) - -LOCAL_MODULE:= libvideoeditor_videofilters - -LOCAL_SRC_FILES:= \ - M4VIFI_BGR565toYUV420.c \ - M4VIFI_ResizeRGB888toRGB888.c \ - M4VIFI_ResizeRGB565toRGB565.c \ - M4VIFI_Clip.c \ - M4VIFI_ResizeYUVtoBGR565.c \ - M4VIFI_RGB888toYUV420.c \ - M4VIFI_RGB565toYUV420.c \ - M4VFL_transition.c - -LOCAL_MODULE_TAGS := optional - -LOCAL_SHARED_LIBRARIES := \ - libcutils \ - libutils \ - libvideoeditor_osal \ - -LOCAL_C_INCLUDES += \ - $(TOP)/frameworks/av/libvideoeditor/osal/inc \ - $(TOP)/frameworks/av/libvideoeditor/vss/common/inc - -LOCAL_SHARED_LIBRARIES += libdl - -LOCAL_CFLAGS += -Wno-multichar - -include $(BUILD_SHARED_LIBRARY) diff --git a/libvideoeditor/vss/video_filters/src/M4VFL_transition.c b/libvideoeditor/vss/video_filters/src/M4VFL_transition.c deleted file mode 100755 index 6a5e0b6..0000000 --- a/libvideoeditor/vss/video_filters/src/M4VFL_transition.c +++ /dev/null @@ -1,510 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - ****************************************************************************** - * @file M4TRAN_transition.c - * @brief - ****************************************************************************** -*/ - -/** - * OSAL (memset and memcpy) ***/ -#include "M4OSA_Memory.h" - -#include "M4VFL_transition.h" - -#include <string.h> - -#ifdef LITTLE_ENDIAN -#define M4VFL_SWAP_SHORT(a) a = ((a & 0xFF) << 8) | ((a & 0xFF00) >> 8) -#else -#define M4VFL_SWAP_SHORT(a) -#endif - -#define LUM_FACTOR_MAX 10 - - -unsigned char M4VFL_modifyLumaByStep(M4ViComImagePlane *plane_in, M4ViComImagePlane *plane_out, - M4VFL_ModifLumParam *lum_param, void *user_data) -{ - unsigned short *p_src, *p_dest, *p_src_line, *p_dest_line; - unsigned long pix_src; - unsigned long u_outpx, u_outpx2; - unsigned long u_width, u_stride, u_stride_out,u_height, pix; - unsigned long lf1, lf2, lf3; - long i, j; - - if (lum_param->copy_chroma != 0) - { - /* copy chroma plane */ - - } - - /* apply luma factor */ - u_width = plane_in[0].u_width; - u_height = plane_in[0].u_height; - u_stride = (plane_in[0].u_stride >> 1); - u_stride_out = (plane_out[0].u_stride >> 1); - p_dest = (unsigned short *) &plane_out[0].pac_data[plane_out[0].u_topleft]; - p_src = (unsigned short *) &plane_in[0].pac_data[plane_in[0].u_topleft]; - p_dest_line = p_dest; - p_src_line = p_src; - - switch(lum_param->lum_factor) - { - case 0: - /* very specific case : set luma plane to 16 */ - for (j = u_height; j != 0; j--) - { - memset((void *)p_dest,16, u_width); - p_dest += u_stride_out; - } - return 0; - - case 1: - /* 0.25 */ - lf1 = 6; lf2 = 6; lf3 = 7; - break; - case 2: - /* 0.375 */ - lf1 = 7; lf2 = 7; lf3 = 7; - break; - case 3: - /* 0.5 */ - lf1 = 7; lf2 = 7; lf3 = 8; - break; - case 4: - /* 0.625 */ - lf1 = 7; lf2 = 8; lf3 = 8; - break; - case 5: - /* 0.75 */ - lf1 = 8; lf2 = 8; lf3 = 8; - break; - case 6: - /* 0.875 */ - lf1 = 9; lf2 = 8; lf3 = 7; - break; - default: - lf1 = 8; lf2 = 8; lf3 = 9; - break; - } - - for (j = u_height; j != 0; j--) - { - p_dest = p_dest_line; - p_src = p_src_line; - for (i = (u_width >> 1); i != 0; i--) - { - pix_src = (unsigned long) *p_src++; - pix = pix_src & 0xFF; - u_outpx = (((pix << lf1) + (pix << lf2) + (pix << lf3) ) >> LUM_FACTOR_MAX); - pix = ((pix_src & 0xFF00) >> 8); - u_outpx2 = ((((pix << lf1) + (pix << lf2) + (pix << lf3) ) >> LUM_FACTOR_MAX)<< 8) ; - *p_dest++ = (unsigned short) (u_outpx2 | u_outpx); - } - p_dest_line += u_stride_out; - p_src_line += u_stride; - } - return 0; -} - - -unsigned char M4VFL_modifyLumaWithScale(M4ViComImagePlane *plane_in, - M4ViComImagePlane *plane_out, - unsigned long lum_factor, - void *user_data) -{ - unsigned short *p_src, *p_dest, *p_src_line, *p_dest_line; - unsigned char *p_csrc, *p_cdest, *p_csrc_line, *p_cdest_line; - unsigned long pix_src; - unsigned long u_outpx, u_outpx2; - unsigned long u_width, u_stride, u_stride_out,u_height, pix; - long i, j; - - /* copy or filter chroma */ - u_width = plane_in[1].u_width; - u_height = plane_in[1].u_height; - u_stride = plane_in[1].u_stride; - u_stride_out = plane_out[1].u_stride; - p_cdest_line = (unsigned char *) &plane_out[1].pac_data[plane_out[1].u_topleft]; - p_csrc_line = (unsigned char *) &plane_in[1].pac_data[plane_in[1].u_topleft]; - - if (lum_factor > 256) - { - p_cdest = (unsigned char *) &plane_out[2].pac_data[plane_out[2].u_topleft]; - p_csrc = (unsigned char *) &plane_in[2].pac_data[plane_in[2].u_topleft]; - /* copy chroma */ - for (j = u_height; j != 0; j--) - { - for (i = u_width; i != 0; i--) - { - memcpy((void *)p_cdest_line, (void *)p_csrc_line, u_width); - memcpy((void *)p_cdest,(void *) p_csrc, u_width); - } - p_cdest_line += u_stride_out; - p_cdest += u_stride_out; - p_csrc_line += u_stride; - p_csrc += u_stride; - } - } - else - { - /* filter chroma */ - pix = (1024 - lum_factor) << 7; - for (j = u_height; j != 0; j--) - { - p_cdest = p_cdest_line; - p_csrc = p_csrc_line; - for (i = u_width; i != 0; i--) - { - *p_cdest++ = ((pix + (*p_csrc++ & 0xFF) * lum_factor) >> LUM_FACTOR_MAX); - } - p_cdest_line += u_stride_out; - p_csrc_line += u_stride; - } - p_cdest_line = (unsigned char *) &plane_out[2].pac_data[plane_out[2].u_topleft]; - p_csrc_line = (unsigned char *) &plane_in[2].pac_data[plane_in[2].u_topleft]; - for (j = u_height; j != 0; j--) - { - p_cdest = p_cdest_line; - p_csrc = p_csrc_line; - for (i = u_width; i != 0; i--) - { - *p_cdest++ = ((pix + (*p_csrc & 0xFF) * lum_factor) >> LUM_FACTOR_MAX); - } - p_cdest_line += u_stride_out; - p_csrc_line += u_stride; - } - } - /* apply luma factor */ - u_width = plane_in[0].u_width; - u_height = plane_in[0].u_height; - u_stride = (plane_in[0].u_stride >> 1); - u_stride_out = (plane_out[0].u_stride >> 1); - p_dest = (unsigned short *) &plane_out[0].pac_data[plane_out[0].u_topleft]; - p_src = (unsigned short *) &plane_in[0].pac_data[plane_in[0].u_topleft]; - p_dest_line = p_dest; - p_src_line = p_src; - - for (j = u_height; j != 0; j--) - { - p_dest = p_dest_line; - p_src = p_src_line; - for (i = (u_width >> 1); i != 0; i--) - { - pix_src = (unsigned long) *p_src++; - pix = pix_src & 0xFF; - u_outpx = ((pix * lum_factor) >> LUM_FACTOR_MAX); - pix = ((pix_src & 0xFF00) >> 8); - u_outpx2 = (((pix * lum_factor) >> LUM_FACTOR_MAX)<< 8) ; - *p_dest++ = (unsigned short) (u_outpx2 | u_outpx); - } - p_dest_line += u_stride_out; - p_src_line += u_stride; - } - - return 0; -} - -/** - ************************************************************************************************* - * M4OSA_ERR M4VIFI_ImageBlendingonYUV420 (void *pUserData, - * M4VIFI_ImagePlane *pPlaneIn1, - * M4VIFI_ImagePlane *pPlaneIn2, - * M4VIFI_ImagePlane *pPlaneOut, - * UInt32 Progress) - * @brief Blends two YUV 4:2:0 Planar images. - * @note Blends YUV420 planar images, - * Map the value of progress from (0 - 1000) to (0 - 1024) - * Set the range of blendingfactor, - * 1. from 0 to (Progress << 1) ;for Progress <= 512 - * 2. from (( Progress - 512)<< 1) to 1024 ;otherwise - * Set the increment of blendingfactor for each element in the image row by the factor, - * = (Range-1) / (image width-1) ;for width >= range - * = (Range) / (image width) ;otherwise - * Loop on each(= i) row of output Y plane (steps of 2) - * Loop on each(= j) column of output Y plane (steps of 2) - * Get four Y samples and one U & V sample from two input YUV4:2:0 images and - * Compute four Y sample and one U & V sample for output YUV4:2:0 image - * using the following, - * Out(i,j) = blendingfactor(i,j) * In1(i,j)+ (l - blendingfactor(i,j)) *In2(i,j) - * end loop column - * end loop row. - * @param pUserData: (IN) User Specific Parameter - * @param pPlaneIn1: (IN) Pointer to an array of image plane structures maintained - * for Y, U and V planes. - * @param pPlaneIn2: (IN) Pointer to an array of image plane structures maintained - * for Y, U and V planes. - * @param pPlaneOut: (OUT) Pointer to an array of image plane structures maintained - * for Y, U and V planes. - * @param Progress: (IN) Progress value (varies between 0 and 1000) - * @return M4VIFI_OK: No error - * @return M4VIFI_ILLEGAL_FRAME_HEIGHT: Error in height - * @return M4VIFI_ILLEGAL_FRAME_WIDTH: Error in width - ************************************************************************************************* -*/ - -/** Check for value is EVEN */ -#ifndef IS_EVEN -#define IS_EVEN(a) (!(a & 0x01)) -#endif - -/** Used for fixed point implementation */ -#ifndef MAX_SHORT -#define MAX_SHORT 0x10000 -#endif - -#ifndef NULL -#define NULL 0 -#endif - -#ifndef FALSE -#define FALSE 0 -#define TRUE !FALSE -#endif - -unsigned char M4VIFI_ImageBlendingonYUV420 (void *pUserData, - M4ViComImagePlane *pPlaneIn1, - M4ViComImagePlane *pPlaneIn2, - M4ViComImagePlane *pPlaneOut, - UInt32 Progress) -{ - UInt8 *pu8_data_Y_start1,*pu8_data_U_start1,*pu8_data_V_start1; - UInt8 *pu8_data_Y_start2,*pu8_data_U_start2,*pu8_data_V_start2; - UInt8 *pu8_data_Y_start3,*pu8_data_U_start3,*pu8_data_V_start3; - UInt8 *pu8_data_Y_current1, *pu8_data_Y_next1, *pu8_data_U1, *pu8_data_V1; - UInt8 *pu8_data_Y_current2, *pu8_data_Y_next2, *pu8_data_U2, *pu8_data_V2; - UInt8 *pu8_data_Y_current3,*pu8_data_Y_next3, *pu8_data_U3, *pu8_data_V3; - UInt32 u32_stride_Y1, u32_stride2_Y1, u32_stride_U1, u32_stride_V1; - UInt32 u32_stride_Y2, u32_stride2_Y2, u32_stride_U2, u32_stride_V2; - UInt32 u32_stride_Y3, u32_stride2_Y3, u32_stride_U3, u32_stride_V3; - UInt32 u32_height, u32_width; - UInt32 u32_blendfactor, u32_startA, u32_endA, u32_blend_inc, u32_x_accum; - UInt32 u32_col, u32_row, u32_rangeA, u32_progress; - UInt32 u32_U1,u32_V1,u32_U2,u32_V2, u32_Y1, u32_Y2; - - - /* Check the Y plane height is EVEN and image plane heights are same */ - if( (IS_EVEN(pPlaneIn1[0].u_height) == FALSE) || - (IS_EVEN(pPlaneIn2[0].u_height) == FALSE) || - (IS_EVEN(pPlaneOut[0].u_height) == FALSE) || - (pPlaneIn1[0].u_height != pPlaneOut[0].u_height) || - (pPlaneIn2[0].u_height != pPlaneOut[0].u_height) ) - { - return M4VIFI_ILLEGAL_FRAME_HEIGHT; - } - - /* Check the Y plane width is EVEN and image plane widths are same */ - if( (IS_EVEN(pPlaneIn1[0].u_width) == FALSE) || - (IS_EVEN(pPlaneIn2[0].u_width) == FALSE) || - (IS_EVEN(pPlaneOut[0].u_width) == FALSE) || - (pPlaneIn1[0].u_width != pPlaneOut[0].u_width) || - (pPlaneIn2[0].u_width != pPlaneOut[0].u_width) ) - { - return M4VIFI_ILLEGAL_FRAME_WIDTH; - } - - /* Set the pointer to the beginning of the input1 YUV420 image planes */ - pu8_data_Y_start1 = pPlaneIn1[0].pac_data + pPlaneIn1[0].u_topleft; - pu8_data_U_start1 = pPlaneIn1[1].pac_data + pPlaneIn1[1].u_topleft; - pu8_data_V_start1 = pPlaneIn1[2].pac_data + pPlaneIn1[2].u_topleft; - - /* Set the pointer to the beginning of the input2 YUV420 image planes */ - pu8_data_Y_start2 = pPlaneIn2[0].pac_data + pPlaneIn2[0].u_topleft; - pu8_data_U_start2 = pPlaneIn2[1].pac_data + pPlaneIn2[1].u_topleft; - pu8_data_V_start2 = pPlaneIn2[2].pac_data + pPlaneIn2[2].u_topleft; - - /* Set the pointer to the beginning of the output YUV420 image planes */ - pu8_data_Y_start3 = pPlaneOut[0].pac_data + pPlaneOut[0].u_topleft; - pu8_data_U_start3 = pPlaneOut[1].pac_data + pPlaneOut[1].u_topleft; - pu8_data_V_start3 = pPlaneOut[2].pac_data + pPlaneOut[2].u_topleft; - - /* Set the stride for the next row in each input1 YUV420 plane */ - u32_stride_Y1 = pPlaneIn1[0].u_stride; - u32_stride_U1 = pPlaneIn1[1].u_stride; - u32_stride_V1 = pPlaneIn1[2].u_stride; - - /* Set the stride for the next row in each input2 YUV420 plane */ - u32_stride_Y2 = pPlaneIn2[0].u_stride; - u32_stride_U2 = pPlaneIn2[1].u_stride; - u32_stride_V2 = pPlaneIn2[2].u_stride; - - /* Set the stride for the next row in each output YUV420 plane */ - u32_stride_Y3 = pPlaneOut[0].u_stride; - u32_stride_U3 = pPlaneOut[1].u_stride; - u32_stride_V3 = pPlaneOut[2].u_stride; - - u32_stride2_Y1 = u32_stride_Y1 << 1; - u32_stride2_Y2 = u32_stride_Y2 << 1; - u32_stride2_Y3 = u32_stride_Y3 << 1; - - /* Get the size of the output image */ - u32_height = pPlaneOut[0].u_height; - u32_width = pPlaneOut[0].u_width; - - /* User Specified Progress value */ - u32_progress = Progress; - - /* Map Progress value from (0 - 1000) to (0 - 1024) -> for optimisation */ - if(u32_progress < 1000) - u32_progress = ((u32_progress << 10) / 1000); - else - u32_progress = 1024; - - /* Set the range of blendingfactor */ - if(u32_progress <= 512) - { - u32_startA = 0; - u32_endA = (u32_progress << 1); - } - else /* u32_progress > 512 */ - { - u32_startA = (u32_progress - 512) << 1; - u32_endA = 1024; - } - u32_rangeA = u32_endA - u32_startA; - - /* Set the increment of blendingfactor for each element in the image row */ - if ((u32_width >= u32_rangeA) && (u32_rangeA > 0) ) - { - u32_blend_inc = ((u32_rangeA-1) * MAX_SHORT) / (u32_width - 1); - } - else /* (u32_width < u32_rangeA) || (u32_rangeA < 0) */ - { - u32_blend_inc = (u32_rangeA * MAX_SHORT) / (u32_width); - } - - /* Two YUV420 rows are computed at each pass */ - for (u32_row = u32_height; u32_row != 0; u32_row -=2) - { - /* Set pointers to the beginning of the row for each input image1 plane */ - pu8_data_Y_current1 = pu8_data_Y_start1; - pu8_data_U1 = pu8_data_U_start1; - pu8_data_V1 = pu8_data_V_start1; - - /* Set pointers to the beginning of the row for each input image2 plane */ - pu8_data_Y_current2 = pu8_data_Y_start2; - pu8_data_U2 = pu8_data_U_start2; - pu8_data_V2 = pu8_data_V_start2; - - /* Set pointers to the beginning of the row for each output image plane */ - pu8_data_Y_current3 = pu8_data_Y_start3; - pu8_data_U3 = pu8_data_U_start3; - pu8_data_V3 = pu8_data_V_start3; - - /* Set pointers to the beginning of the next row for image luma plane */ - pu8_data_Y_next1 = pu8_data_Y_current1 + u32_stride_Y1; - pu8_data_Y_next2 = pu8_data_Y_current2 + u32_stride_Y2; - pu8_data_Y_next3 = pu8_data_Y_current3 + u32_stride_Y3; - - /* Initialise blendfactor */ - u32_blendfactor = u32_startA; - /* Blendfactor Increment accumulator */ - u32_x_accum = 0; - - /* Loop on each column of the output image */ - for (u32_col = u32_width; u32_col != 0 ; u32_col -=2) - { - /* Update the blending factor */ - u32_blendfactor = u32_startA + (u32_x_accum >> 16); - - /* Get Luma value (x,y) of input Image1 */ - u32_Y1 = *pu8_data_Y_current1++; - - /* Get chrominance2 value */ - u32_U1 = *pu8_data_U1++; - u32_V1 = *pu8_data_V1++; - - /* Get Luma value (x,y) of input Image2 */ - u32_Y2 = *pu8_data_Y_current2++; - - /* Get chrominance2 value */ - u32_U2 = *pu8_data_U2++; - u32_V2 = *pu8_data_V2++; - - /* Compute Luma value (x,y) of Output image */ - *pu8_data_Y_current3++ = (UInt8)((u32_blendfactor * u32_Y2 + - (1024 - u32_blendfactor)*u32_Y1) >> 10); - /* Compute chroma(U) value of Output image */ - *pu8_data_U3++ = (UInt8)((u32_blendfactor * u32_U2 + - (1024 - u32_blendfactor)*u32_U1) >> 10); - /* Compute chroma(V) value of Output image */ - *pu8_data_V3++ = (UInt8)((u32_blendfactor * u32_V2 + - (1024 - u32_blendfactor)*u32_V1) >> 10); - - /* Get Luma value (x,y+1) of input Image1 */ - u32_Y1 = *pu8_data_Y_next1++; - - /* Get Luma value (x,y+1) of input Image2 */ - u32_Y2 = *pu8_data_Y_next2++; - - /* Compute Luma value (x,y+1) of Output image*/ - *pu8_data_Y_next3++ = (UInt8)((u32_blendfactor * u32_Y2 + - (1024 - u32_blendfactor)*u32_Y1) >> 10); - /* Update accumulator */ - u32_x_accum += u32_blend_inc; - - /* Update the blending factor */ - u32_blendfactor = u32_startA + (u32_x_accum >> 16); - - /* Get Luma value (x+1,y) of input Image1 */ - u32_Y1 = *pu8_data_Y_current1++; - - /* Get Luma value (x+1,y) of input Image2 */ - u32_Y2 = *pu8_data_Y_current2++; - - /* Compute Luma value (x+1,y) of Output image*/ - *pu8_data_Y_current3++ = (UInt8)((u32_blendfactor * u32_Y2 + - (1024 - u32_blendfactor)*u32_Y1) >> 10); - - /* Get Luma value (x+1,y+1) of input Image1 */ - u32_Y1 = *pu8_data_Y_next1++; - - /* Get Luma value (x+1,y+1) of input Image2 */ - u32_Y2 = *pu8_data_Y_next2++; - - /* Compute Luma value (x+1,y+1) of Output image*/ - *pu8_data_Y_next3++ = (UInt8)((u32_blendfactor * u32_Y2 + - (1024 - u32_blendfactor)*u32_Y1) >> 10); - /* Update accumulator */ - u32_x_accum += u32_blend_inc; - - /* Working pointers are incremented just after each storage */ - - }/* End of row scanning */ - - /* Update working pointer of input image1 for next row */ - pu8_data_Y_start1 += u32_stride2_Y1; - pu8_data_U_start1 += u32_stride_U1; - pu8_data_V_start1 += u32_stride_V1; - - /* Update working pointer of input image2 for next row */ - pu8_data_Y_start2 += u32_stride2_Y2; - pu8_data_U_start2 += u32_stride_U2; - pu8_data_V_start2 += u32_stride_V2; - - /* Update working pointer of output image for next row */ - pu8_data_Y_start3 += u32_stride2_Y3; - pu8_data_U_start3 += u32_stride_U3; - pu8_data_V_start3 += u32_stride_V3; - - }/* End of column scanning */ - - return M4VIFI_OK; -} -/* End of file M4VIFI_ImageBlendingonYUV420.c */ - diff --git a/libvideoeditor/vss/video_filters/src/M4VIFI_BGR565toYUV420.c b/libvideoeditor/vss/video_filters/src/M4VIFI_BGR565toYUV420.c deleted file mode 100755 index c608767..0000000 --- a/libvideoeditor/vss/video_filters/src/M4VIFI_BGR565toYUV420.c +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - **************************************************************************************** - * @file M4VIFI_BGR565toYUV420.c - * @brief Contain video library function - * @note Color Conversion Filter - * -# Contains the format conversion filters from BGR565 to YUV420 - **************************************************************************************** -*/ - -/* Prototypes of functions, and type definitions */ -#include "M4VIFI_FiltersAPI.h" -/* Macro definitions */ -#include "M4VIFI_Defines.h" -/* Clip table declaration */ -#include "M4VIFI_Clip.h" - -/** - ***************************************************************************************** - * M4VIFI_UInt8 M4VIFI_BGR565toYUV420 (void *pUserData, M4VIFI_ImagePlane *pPlaneIn, - * M4VIFI_ImagePlane *pPlaneOut) - * @brief Transform BGR565 image to a YUV420 image. - * @note Convert BGR565 to YUV420, - * Loop on each row ( 2 rows by 2 rows ) - * Loop on each column ( 2 col by 2 col ) - * Get 4 BGR samples from input data and build 4 output Y samples - * and each single U & V data - * end loop on col - * end loop on row - * @param pUserData: (IN) User Specific Data - * @param pPlaneIn: (IN) Pointer to BGR565 Plane - * @param pPlaneOut: (OUT) Pointer to YUV420 buffer Plane - * @return M4VIFI_OK: there is no error - * @return M4VIFI_ILLEGAL_FRAME_HEIGHT: YUV Plane height is ODD - * @return M4VIFI_ILLEGAL_FRAME_WIDTH: YUV Plane width is ODD - ***************************************************************************************** -*/ - -M4VIFI_UInt8 M4VIFI_BGR565toYUV420(void *pUserData, M4VIFI_ImagePlane *pPlaneIn, - M4VIFI_ImagePlane *pPlaneOut) -{ - M4VIFI_UInt32 u32_width, u32_height; - M4VIFI_UInt32 u32_stride_Y, u32_stride2_Y, u32_stride_U, u32_stride_V; - M4VIFI_UInt32 u32_stride_bgr, u32_stride_2bgr; - M4VIFI_UInt32 u32_col, u32_row; - - M4VIFI_Int32 i32_r00, i32_r01, i32_r10, i32_r11; - M4VIFI_Int32 i32_g00, i32_g01, i32_g10, i32_g11; - M4VIFI_Int32 i32_b00, i32_b01, i32_b10, i32_b11; - M4VIFI_Int32 i32_y00, i32_y01, i32_y10, i32_y11; - M4VIFI_Int32 i32_u00, i32_u01, i32_u10, i32_u11; - M4VIFI_Int32 i32_v00, i32_v01, i32_v10, i32_v11; - M4VIFI_UInt8 *pu8_yn, *pu8_ys, *pu8_u, *pu8_v; - M4VIFI_UInt8 *pu8_y_data, *pu8_u_data, *pu8_v_data; - M4VIFI_UInt8 *pu8_bgrn_data, *pu8_bgrn; - M4VIFI_UInt16 u16_pix1, u16_pix2, u16_pix3, u16_pix4; - - /* Check planes height are appropriate */ - if( (pPlaneIn->u_height != pPlaneOut[0].u_height) || - (pPlaneOut[0].u_height != (pPlaneOut[1].u_height<<1)) || - (pPlaneOut[0].u_height != (pPlaneOut[2].u_height<<1))) - { - return M4VIFI_ILLEGAL_FRAME_HEIGHT; - } - - /* Check planes width are appropriate */ - if( (pPlaneIn->u_width != pPlaneOut[0].u_width) || - (pPlaneOut[0].u_width != (pPlaneOut[1].u_width<<1)) || - (pPlaneOut[0].u_width != (pPlaneOut[2].u_width<<1))) - { - return M4VIFI_ILLEGAL_FRAME_WIDTH; - } - - /* Set the pointer to the beginning of the output data buffers */ - pu8_y_data = pPlaneOut[0].pac_data + pPlaneOut[0].u_topleft; - pu8_u_data = pPlaneOut[1].pac_data + pPlaneOut[1].u_topleft; - pu8_v_data = pPlaneOut[2].pac_data + pPlaneOut[2].u_topleft; - - /* Set the pointer to the beginning of the input data buffers */ - pu8_bgrn_data = pPlaneIn->pac_data + pPlaneIn->u_topleft; - - /* Get the size of the output image */ - u32_width = pPlaneOut[0].u_width; - u32_height = pPlaneOut[0].u_height; - - /* Set the size of the memory jumps corresponding to row jump in each output plane */ - u32_stride_Y = pPlaneOut[0].u_stride; - u32_stride2_Y = u32_stride_Y << 1; - u32_stride_U = pPlaneOut[1].u_stride; - u32_stride_V = pPlaneOut[2].u_stride; - - /* Set the size of the memory jumps corresponding to row jump in input plane */ - u32_stride_bgr = pPlaneIn->u_stride; - u32_stride_2bgr = u32_stride_bgr << 1; - - /* Loop on each row of the output image, input coordinates are estimated from output ones */ - /* Two YUV rows are computed at each pass */ - for (u32_row = u32_height ;u32_row != 0; u32_row -=2) - { - /* Current Y plane row pointers */ - pu8_yn = pu8_y_data; - /* Next Y plane row pointers */ - pu8_ys = pu8_yn + u32_stride_Y; - /* Current U plane row pointer */ - pu8_u = pu8_u_data; - /* Current V plane row pointer */ - pu8_v = pu8_v_data; - - pu8_bgrn = pu8_bgrn_data; - - /* Loop on each column of the output image */ - for (u32_col = u32_width; u32_col != 0 ; u32_col -=2) - { - /* Get four BGR 565 samples from input data */ - u16_pix1 = *( (M4VIFI_UInt16 *) pu8_bgrn); - u16_pix2 = *( (M4VIFI_UInt16 *) (pu8_bgrn + CST_RGB_16_SIZE)); - u16_pix3 = *( (M4VIFI_UInt16 *) (pu8_bgrn + u32_stride_bgr)); - u16_pix4 = *( (M4VIFI_UInt16 *) (pu8_bgrn + u32_stride_bgr + CST_RGB_16_SIZE)); - /* Unpack RGB565 to 8bit R, G, B */ - /* (x,y) */ - GET_BGR565(i32_b00, i32_g00, i32_r00, u16_pix1); - /* (x+1,y) */ - GET_BGR565(i32_b10, i32_g10, i32_r10, u16_pix2); - /* (x,y+1) */ - GET_BGR565(i32_b01, i32_g01, i32_r01, u16_pix3); - /* (x+1,y+1) */ - GET_BGR565(i32_b11, i32_g11, i32_r11, u16_pix4); - - /* Convert BGR value to YUV */ - i32_u00 = U16(i32_r00, i32_g00, i32_b00); - i32_v00 = V16(i32_r00, i32_g00, i32_b00); - /* luminance value */ - i32_y00 = Y16(i32_r00, i32_g00, i32_b00); - - i32_u10 = U16(i32_r10, i32_g10, i32_b10); - i32_v10 = V16(i32_r10, i32_g10, i32_b10); - /* luminance value */ - i32_y10 = Y16(i32_r10, i32_g10, i32_b10); - - i32_u01 = U16(i32_r01, i32_g01, i32_b01); - i32_v01 = V16(i32_r01, i32_g01, i32_b01); - /* luminance value */ - i32_y01 = Y16(i32_r01, i32_g01, i32_b01); - - i32_u11 = U16(i32_r11, i32_g11, i32_b11); - i32_v11 = V16(i32_r11, i32_g11, i32_b11); - /* luminance value */ - i32_y11 = Y16(i32_r11, i32_g11, i32_b11); - - /* Store luminance data */ - pu8_yn[0] = (M4VIFI_UInt8)i32_y00; - pu8_yn[1] = (M4VIFI_UInt8)i32_y10; - pu8_ys[0] = (M4VIFI_UInt8)i32_y01; - pu8_ys[1] = (M4VIFI_UInt8)i32_y11; - - /* Store chroma data */ - *pu8_u = (M4VIFI_UInt8)((i32_u00 + i32_u01 + i32_u10 + i32_u11 + 2) >> 2); - *pu8_v = (M4VIFI_UInt8)((i32_v00 + i32_v01 + i32_v10 + i32_v11 + 2) >> 2); - - /* Prepare for next column */ - pu8_bgrn += (CST_RGB_16_SIZE<<1); - /* Update current Y plane line pointer*/ - pu8_yn += 2; - /* Update next Y plane line pointer*/ - pu8_ys += 2; - /* Update U plane line pointer*/ - pu8_u ++; - /* Update V plane line pointer*/ - pu8_v ++; - } /* End of horizontal scanning */ - - /* Prepare pointers for the next row */ - pu8_y_data += u32_stride2_Y; - pu8_u_data += u32_stride_U; - pu8_v_data += u32_stride_V; - pu8_bgrn_data += u32_stride_2bgr; - - } /* End of vertical scanning */ - - return M4VIFI_OK; -} -/* End of file M4VIFI_BGR565toYUV420.c */ - diff --git a/libvideoeditor/vss/video_filters/src/M4VIFI_Clip.c b/libvideoeditor/vss/video_filters/src/M4VIFI_Clip.c deleted file mode 100755 index e4290b1..0000000 --- a/libvideoeditor/vss/video_filters/src/M4VIFI_Clip.c +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - ****************************************************************************** - * @file M4VIFI_Clip.c - * @brief Management of the RGB Clipping matrix inclusion and Division Table - * @note -# Clipping Matrix is used in order to properly manage the inclusion of - * the external RGB Clipping matrix used for color conversion. - * This file HAS TO BE compiled with all color conversion filters project - * -# Division table is used in RGB to HLS color conversion - * Important: This file must be compiled during the assembly library building - ****************************************************************************** -*/ - -/* Prototypes of functions, and type definitions */ -#include "M4VIFI_FiltersAPI.h" - -CNST M4VIFI_UInt8 M4VIFI_ClipTable[1256] -= { -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, -0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, -0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, -0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, -0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, -0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, -0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, -0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, -0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, -0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, -0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, -0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, -0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, -0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, -0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, -0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, -0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, -0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, -0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, -0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, -0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, -0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, -0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, -0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, -0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, -0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, -0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, -0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, -0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, -0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, -0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, -0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, -0xfc, 0xfd, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -}; - -/* Division table for ( 65535/x ); x = 0 to 512 */ -CNST M4VIFI_UInt16 M4VIFI_DivTable[512] -= { -0, 65535, 32768, 21845, 16384, 13107, 10922, 9362, -8192, 7281, 6553, 5957, 5461, 5041, 4681, 4369, -4096, 3855, 3640, 3449, 3276, 3120, 2978, 2849, -2730, 2621, 2520, 2427, 2340, 2259, 2184, 2114, -2048, 1985, 1927, 1872, 1820, 1771, 1724, 1680, -1638, 1598, 1560, 1524, 1489, 1456, 1424, 1394, -1365, 1337, 1310, 1285, 1260, 1236, 1213, 1191, -1170, 1149, 1129, 1110, 1092, 1074, 1057, 1040, -1024, 1008, 992, 978, 963, 949, 936, 923, -910, 897, 885, 873, 862, 851, 840, 829, -819, 809, 799, 789, 780, 771, 762, 753, -744, 736, 728, 720, 712, 704, 697, 689, -682, 675, 668, 661, 655, 648, 642, 636, -630, 624, 618, 612, 606, 601, 595, 590, -585, 579, 574, 569, 564, 560, 555, 550, -546, 541, 537, 532, 528, 524, 520, 516, -512, 508, 504, 500, 496, 492, 489, 485, -481, 478, 474, 471, 468, 464, 461, 458, -455, 451, 448, 445, 442, 439, 436, 434, -431, 428, 425, 422, 420, 417, 414, 412, -409, 407, 404, 402, 399, 397, 394, 392, -390, 387, 385, 383, 381, 378, 376, 374, -372, 370, 368, 366, 364, 362, 360, 358, -356, 354, 352, 350, 348, 346, 344, 343, -341, 339, 337, 336, 334, 332, 330, 329, -327, 326, 324, 322, 321, 319, 318, 316, -315, 313, 312, 310, 309, 307, 306, 304, -303, 302, 300, 299, 297, 296, 295, 293, -292, 291, 289, 288, 287, 286, 284, 283, -282, 281, 280, 278, 277, 276, 275, 274, -273, 271, 270, 269, 268, 267, 266, 265, -264, 263, 262, 261, 260, 259, 258, 257, -256, 255, 254, 253, 252, 251, 250, 249, -248, 247, 246, 245, 244, 243, 242, 241, -240, 240, 239, 238, 237, 236, 235, 234, -234, 233, 232, 231, 230, 229, 229, 228, -227, 226, 225, 225, 224, 223, 222, 222, -221, 220, 219, 219, 218, 217, 217, 216, -215, 214, 214, 213, 212, 212, 211, 210, -210, 209, 208, 208, 207, 206, 206, 205, -204, 204, 203, 202, 202, 201, 201, 200, -199, 199, 198, 197, 197, 196, 196, 195, -195, 194, 193, 193, 192, 192, 191, 191, -190, 189, 189, 188, 188, 187, 187, 186, -186, 185, 185, 184, 184, 183, 183, 182, -182, 181, 181, 180, 180, 179, 179, 178, -178, 177, 177, 176, 176, 175, 175, 174, -174, 173, 173, 172, 172, 172, 171, 171, -170, 170, 169, 169, 168, 168, 168, 167, -167, 166, 166, 165, 165, 165, 164, 164, -163, 163, 163, 162, 162, 161, 161, 161, -160, 160, 159, 159, 159, 158, 158, 157, -157, 157, 156, 156, 156, 155, 155, 154, -154, 154, 153, 153, 153, 152, 152, 152, -151, 151, 151, 150, 150, 149, 149, 149, -148, 148, 148, 147, 147, 147, 146, 146, -146, 145, 145, 145, 144, 144, 144, 144, -143, 143, 143, 142, 142, 142, 141, 141, -141, 140, 140, 140, 140, 139, 139, 139, -138, 138, 138, 137, 137, 137, 137, 136, -136, 136, 135, 135, 135, 135, 134, 134, -134, 134, 133, 133, 133, 132, 132, 132, -132, 131, 131, 131, 131, 130, 130, 130, -130, 129, 129, 129, 129, 128, 128, 128 -}; - -CNST M4VIFI_Int32 const_storage1[8] -= { -0x00002568, 0x00003343,0x00000649,0x00000d0f, 0x0000D86C, 0x0000D83B, 0x00010000, 0x00010000 -}; - -CNST M4VIFI_Int32 const_storage[8] -= { -0x00002568, 0x00003343, 0x1BF800, 0x00000649, 0x00000d0f, 0x110180, 0x40cf, 0x22BE00 -}; - - -CNST M4VIFI_UInt16 *M4VIFI_DivTable_zero - = &M4VIFI_DivTable[0]; - -CNST M4VIFI_UInt8 *M4VIFI_ClipTable_zero - = &M4VIFI_ClipTable[500]; - - -/* End of file M4VIFI_Clip.c */ - diff --git a/libvideoeditor/vss/video_filters/src/M4VIFI_RGB565toYUV420.c b/libvideoeditor/vss/video_filters/src/M4VIFI_RGB565toYUV420.c deleted file mode 100755 index 34cbd57..0000000 --- a/libvideoeditor/vss/video_filters/src/M4VIFI_RGB565toYUV420.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - ****************************************************************************** - * @brief Contain video library function - * @note Color Conversion Filter - * Contains the format conversion filters from RGB565 to YUV420 - ****************************************************************************** -*/ - -/* Prototypes of functions, and type definitions */ -#include "M4VIFI_FiltersAPI.h" -/* Macro definitions */ -#include "M4VIFI_Defines.h" -/* Clip table declaration */ -#include "M4VIFI_Clip.h" - - -/** - ****************************************************************************** - * M4VIFI_UInt8 M4VIFI_RGB565toYUV420 (void *pUserData, - * M4VIFI_ImagePlane *pPlaneIn, - * M4VIFI_ImagePlane *pPlaneOut) - * @brief transform RGB565 image to a YUV420 image. - * @note Convert RGB565 to YUV420, - * Loop on each row ( 2 rows by 2 rows ) - * Loop on each column ( 2 col by 2 col ) - * Get 4 RGB samples from input data and build 4 output Y samples - * and each single U & V data - * end loop on col - * end loop on row - * @param pUserData: (IN) User Specific Data - * @param pPlaneIn: (IN) Pointer to RGB565 Plane - * @param pPlaneOut: (OUT) Pointer to YUV420 buffer Plane - * @return M4VIFI_OK: there is no error - * @return M4VIFI_ILLEGAL_FRAME_HEIGHT: YUV Plane height is ODD - * @return M4VIFI_ILLEGAL_FRAME_WIDTH: YUV Plane width is ODD - ****************************************************************************** -*/ -M4VIFI_UInt8 M4VIFI_RGB565toYUV420(void *pUserData, M4VIFI_ImagePlane *pPlaneIn, - M4VIFI_ImagePlane *pPlaneOut) -{ - M4VIFI_UInt32 u32_width, u32_height; - M4VIFI_UInt32 u32_stride_Y, u32_stride2_Y, u32_stride_U, u32_stride_V; - M4VIFI_UInt32 u32_stride_rgb, u32_stride_2rgb; - M4VIFI_UInt32 u32_col, u32_row; - - M4VIFI_Int32 i32_r00, i32_r01, i32_r10, i32_r11; - M4VIFI_Int32 i32_g00, i32_g01, i32_g10, i32_g11; - M4VIFI_Int32 i32_b00, i32_b01, i32_b10, i32_b11; - M4VIFI_Int32 i32_y00, i32_y01, i32_y10, i32_y11; - M4VIFI_Int32 i32_u00, i32_u01, i32_u10, i32_u11; - M4VIFI_Int32 i32_v00, i32_v01, i32_v10, i32_v11; - M4VIFI_UInt8 *pu8_yn, *pu8_ys, *pu8_u, *pu8_v; - M4VIFI_UInt8 *pu8_y_data, *pu8_u_data, *pu8_v_data; - M4VIFI_UInt8 *pu8_rgbn_data, *pu8_rgbn; - M4VIFI_UInt16 u16_pix1, u16_pix2, u16_pix3, u16_pix4; - - /* Check planes height are appropriate */ - if ((pPlaneIn->u_height != pPlaneOut[0].u_height) || - (pPlaneOut[0].u_height != (pPlaneOut[1].u_height<<1)) || - (pPlaneOut[0].u_height != (pPlaneOut[2].u_height<<1))) - { - return M4VIFI_ILLEGAL_FRAME_HEIGHT; - } - - /* Check planes width are appropriate */ - if ((pPlaneIn->u_width != pPlaneOut[0].u_width) || - (pPlaneOut[0].u_width != (pPlaneOut[1].u_width<<1)) || - (pPlaneOut[0].u_width != (pPlaneOut[2].u_width<<1))) - { - return M4VIFI_ILLEGAL_FRAME_WIDTH; - } - - /* Set the pointer to the beginning of the output data buffers */ - pu8_y_data = pPlaneOut[0].pac_data + pPlaneOut[0].u_topleft; - pu8_u_data = pPlaneOut[1].pac_data + pPlaneOut[1].u_topleft; - pu8_v_data = pPlaneOut[2].pac_data + pPlaneOut[2].u_topleft; - - /* Set the pointer to the beginning of the input data buffers */ - pu8_rgbn_data = pPlaneIn->pac_data + pPlaneIn->u_topleft; - - /* Get the size of the output image */ - u32_width = pPlaneOut[0].u_width; - u32_height = pPlaneOut[0].u_height; - - /* Set the size of the memory jumps corresponding to row jump in each output plane */ - u32_stride_Y = pPlaneOut[0].u_stride; - u32_stride2_Y = u32_stride_Y << 1; - u32_stride_U = pPlaneOut[1].u_stride; - u32_stride_V = pPlaneOut[2].u_stride; - - /* Set the size of the memory jumps corresponding to row jump in input plane */ - u32_stride_rgb = pPlaneIn->u_stride; - u32_stride_2rgb = u32_stride_rgb << 1; - - - /* Loop on each row of the output image, input coordinates are estimated from output ones */ - /* Two YUV rows are computed at each pass */ - for (u32_row = u32_height ;u32_row != 0; u32_row -=2) - { - /* Current Y plane row pointers */ - pu8_yn = pu8_y_data; - /* Next Y plane row pointers */ - pu8_ys = pu8_yn + u32_stride_Y; - /* Current U plane row pointer */ - pu8_u = pu8_u_data; - /* Current V plane row pointer */ - pu8_v = pu8_v_data; - - pu8_rgbn = pu8_rgbn_data; - - /* Loop on each column of the output image */ - for (u32_col = u32_width; u32_col != 0 ; u32_col -=2) - { - /* Get four RGB 565 samples from input data */ - u16_pix1 = *( (M4VIFI_UInt16 *) pu8_rgbn); - u16_pix2 = *( (M4VIFI_UInt16 *) (pu8_rgbn + CST_RGB_16_SIZE)); - u16_pix3 = *( (M4VIFI_UInt16 *) (pu8_rgbn + u32_stride_rgb)); - u16_pix4 = *( (M4VIFI_UInt16 *) (pu8_rgbn + u32_stride_rgb + CST_RGB_16_SIZE)); - - /* Unpack RGB565 to 8bit R, G, B */ - /* (x,y) */ - GET_RGB565(i32_r00,i32_g00,i32_b00,u16_pix1); - /* (x+1,y) */ - GET_RGB565(i32_r10,i32_g10,i32_b10,u16_pix2); - /* (x,y+1) */ - GET_RGB565(i32_r01,i32_g01,i32_b01,u16_pix3); - /* (x+1,y+1) */ - GET_RGB565(i32_r11,i32_g11,i32_b11,u16_pix4); - - /* Convert RGB value to YUV */ - i32_u00 = U16(i32_r00, i32_g00, i32_b00); - i32_v00 = V16(i32_r00, i32_g00, i32_b00); - /* luminance value */ - i32_y00 = Y16(i32_r00, i32_g00, i32_b00); - - i32_u10 = U16(i32_r10, i32_g10, i32_b10); - i32_v10 = V16(i32_r10, i32_g10, i32_b10); - /* luminance value */ - i32_y10 = Y16(i32_r10, i32_g10, i32_b10); - - i32_u01 = U16(i32_r01, i32_g01, i32_b01); - i32_v01 = V16(i32_r01, i32_g01, i32_b01); - /* luminance value */ - i32_y01 = Y16(i32_r01, i32_g01, i32_b01); - - i32_u11 = U16(i32_r11, i32_g11, i32_b11); - i32_v11 = V16(i32_r11, i32_g11, i32_b11); - /* luminance value */ - i32_y11 = Y16(i32_r11, i32_g11, i32_b11); - - /* Store luminance data */ - pu8_yn[0] = (M4VIFI_UInt8)i32_y00; - pu8_yn[1] = (M4VIFI_UInt8)i32_y10; - pu8_ys[0] = (M4VIFI_UInt8)i32_y01; - pu8_ys[1] = (M4VIFI_UInt8)i32_y11; - - /* Store chroma data */ - *pu8_u = (M4VIFI_UInt8)((i32_u00 + i32_u01 + i32_u10 + i32_u11 + 2) >> 2); - *pu8_v = (M4VIFI_UInt8)((i32_v00 + i32_v01 + i32_v10 + i32_v11 + 2) >> 2); - - /* Prepare for next column */ - pu8_rgbn += (CST_RGB_16_SIZE<<1); - /* Update current Y plane line pointer*/ - pu8_yn += 2; - /* Update next Y plane line pointer*/ - pu8_ys += 2; - /* Update U plane line pointer*/ - pu8_u ++; - /* Update V plane line pointer*/ - pu8_v ++; - } /* End of horizontal scanning */ - - /* Prepare pointers for the next row */ - pu8_y_data += u32_stride2_Y; - pu8_u_data += u32_stride_U; - pu8_v_data += u32_stride_V; - pu8_rgbn_data += u32_stride_2rgb; - - - } /* End of vertical scanning */ - - return M4VIFI_OK; -} - - diff --git a/libvideoeditor/vss/video_filters/src/M4VIFI_RGB888toYUV420.c b/libvideoeditor/vss/video_filters/src/M4VIFI_RGB888toYUV420.c deleted file mode 100755 index 285a2a6..0000000 --- a/libvideoeditor/vss/video_filters/src/M4VIFI_RGB888toYUV420.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "M4VIFI_FiltersAPI.h" - -#include "M4VIFI_Defines.h" - -#include "M4VIFI_Clip.h" - -/*************************************************************************** -Proto: -M4VIFI_UInt8 M4VIFI_RGB888toYUV420(void *pUserData, M4VIFI_ImagePlane *PlaneIn, - M4VIFI_ImagePlane PlaneOut[3]); -Purpose: filling of the YUV420 plane from a BGR24 plane -Abstract: Loop on each row ( 2 rows by 2 rows ) - Loop on each column ( 2 col by 2 col ) - Get 4 BGR samples from input data and build 4 output Y samples and - each single U & V data - end loop on col - end loop on row - -In: RGB24 plane -InOut: none -Out: array of 3 M4VIFI_ImagePlane structures -Modified: ML: RGB function modified to BGR. -***************************************************************************/ -M4VIFI_UInt8 M4VIFI_RGB888toYUV420(void *pUserData, M4VIFI_ImagePlane *PlaneIn, - M4VIFI_ImagePlane PlaneOut[3]) -{ - M4VIFI_UInt32 u32_width, u32_height; - M4VIFI_UInt32 u32_stride_Y, u32_stride2_Y, u32_stride_U, u32_stride_V, u32_stride_rgb,\ - u32_stride_2rgb; - M4VIFI_UInt32 u32_col, u32_row; - - M4VIFI_Int32 i32_r00, i32_r01, i32_r10, i32_r11; - M4VIFI_Int32 i32_g00, i32_g01, i32_g10, i32_g11; - M4VIFI_Int32 i32_b00, i32_b01, i32_b10, i32_b11; - M4VIFI_Int32 i32_y00, i32_y01, i32_y10, i32_y11; - M4VIFI_Int32 i32_u00, i32_u01, i32_u10, i32_u11; - M4VIFI_Int32 i32_v00, i32_v01, i32_v10, i32_v11; - M4VIFI_UInt8 *pu8_yn, *pu8_ys, *pu8_u, *pu8_v; - M4VIFI_UInt8 *pu8_y_data, *pu8_u_data, *pu8_v_data; - M4VIFI_UInt8 *pu8_rgbn_data, *pu8_rgbn; - - /* check sizes */ - if( (PlaneIn->u_height != PlaneOut[0].u_height) || - (PlaneOut[0].u_height != (PlaneOut[1].u_height<<1)) || - (PlaneOut[0].u_height != (PlaneOut[2].u_height<<1))) - return M4VIFI_ILLEGAL_FRAME_HEIGHT; - - if( (PlaneIn->u_width != PlaneOut[0].u_width) || - (PlaneOut[0].u_width != (PlaneOut[1].u_width<<1)) || - (PlaneOut[0].u_width != (PlaneOut[2].u_width<<1))) - return M4VIFI_ILLEGAL_FRAME_WIDTH; - - - /* set the pointer to the beginning of the output data buffers */ - pu8_y_data = PlaneOut[0].pac_data + PlaneOut[0].u_topleft; - pu8_u_data = PlaneOut[1].pac_data + PlaneOut[1].u_topleft; - pu8_v_data = PlaneOut[2].pac_data + PlaneOut[2].u_topleft; - - /* idem for input buffer */ - pu8_rgbn_data = PlaneIn->pac_data + PlaneIn->u_topleft; - - /* get the size of the output image */ - u32_width = PlaneOut[0].u_width; - u32_height = PlaneOut[0].u_height; - - /* set the size of the memory jumps corresponding to row jump in each output plane */ - u32_stride_Y = PlaneOut[0].u_stride; - u32_stride2_Y= u32_stride_Y << 1; - u32_stride_U = PlaneOut[1].u_stride; - u32_stride_V = PlaneOut[2].u_stride; - - /* idem for input plane */ - u32_stride_rgb = PlaneIn->u_stride; - u32_stride_2rgb = u32_stride_rgb << 1; - - /* loop on each row of the output image, input coordinates are estimated from output ones */ - /* two YUV rows are computed at each pass */ - for (u32_row = u32_height ;u32_row != 0; u32_row -=2) - { - /* update working pointers */ - pu8_yn = pu8_y_data; - pu8_ys = pu8_yn + u32_stride_Y; - - pu8_u = pu8_u_data; - pu8_v = pu8_v_data; - - pu8_rgbn= pu8_rgbn_data; - - /* loop on each column of the output image*/ - for (u32_col = u32_width; u32_col != 0 ; u32_col -=2) - { - /* get RGB samples of 4 pixels */ - GET_RGB24(i32_r00, i32_g00, i32_b00, pu8_rgbn, 0); - GET_RGB24(i32_r10, i32_g10, i32_b10, pu8_rgbn, CST_RGB_24_SIZE); - GET_RGB24(i32_r01, i32_g01, i32_b01, pu8_rgbn, u32_stride_rgb); - GET_RGB24(i32_r11, i32_g11, i32_b11, pu8_rgbn, u32_stride_rgb + CST_RGB_24_SIZE); - - i32_u00 = U24(i32_r00, i32_g00, i32_b00); - i32_v00 = V24(i32_r00, i32_g00, i32_b00); - i32_y00 = Y24(i32_r00, i32_g00, i32_b00); /* matrix luminance */ - pu8_yn[0]= (M4VIFI_UInt8)i32_y00; - - i32_u10 = U24(i32_r10, i32_g10, i32_b10); - i32_v10 = V24(i32_r10, i32_g10, i32_b10); - i32_y10 = Y24(i32_r10, i32_g10, i32_b10); - pu8_yn[1]= (M4VIFI_UInt8)i32_y10; - - i32_u01 = U24(i32_r01, i32_g01, i32_b01); - i32_v01 = V24(i32_r01, i32_g01, i32_b01); - i32_y01 = Y24(i32_r01, i32_g01, i32_b01); - pu8_ys[0]= (M4VIFI_UInt8)i32_y01; - - i32_u11 = U24(i32_r11, i32_g11, i32_b11); - i32_v11 = V24(i32_r11, i32_g11, i32_b11); - i32_y11 = Y24(i32_r11, i32_g11, i32_b11); - pu8_ys[1] = (M4VIFI_UInt8)i32_y11; - - *pu8_u = (M4VIFI_UInt8)((i32_u00 + i32_u01 + i32_u10 + i32_u11 + 2) >> 2); - *pu8_v = (M4VIFI_UInt8)((i32_v00 + i32_v01 + i32_v10 + i32_v11 + 2) >> 2); - - pu8_rgbn += (CST_RGB_24_SIZE<<1); - pu8_yn += 2; - pu8_ys += 2; - - pu8_u ++; - pu8_v ++; - } /* end of horizontal scanning */ - - pu8_y_data += u32_stride2_Y; - pu8_u_data += u32_stride_U; - pu8_v_data += u32_stride_V; - pu8_rgbn_data += u32_stride_2rgb; - - - } /* End of vertical scanning */ - - return M4VIFI_OK; -} diff --git a/libvideoeditor/vss/video_filters/src/M4VIFI_ResizeRGB565toRGB565.c b/libvideoeditor/vss/video_filters/src/M4VIFI_ResizeRGB565toRGB565.c deleted file mode 100755 index 617e4ed..0000000 --- a/libvideoeditor/vss/video_filters/src/M4VIFI_ResizeRGB565toRGB565.c +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - ****************************************************************************** - * @file M4VIFI_ResizeRGB565toRGB565.c - * @brief Contain video library function - * @note This file has a Resize filter function - * Generic resizing of RGB565 (Planar) image - ****************************************************************************** -*/ -/* Prototypes of functions, and type definitions */ -#include "M4VIFI_FiltersAPI.h" -/* Macro definitions */ -#include "M4VIFI_Defines.h" -/* Clip table declaration */ -#include "M4VIFI_Clip.h" - -/** - *********************************************************************************************** - * M4VIFI_UInt8 M4VIFI_ResizeBilinearRGB565toRGB565(void *pUserData, M4VIFI_ImagePlane *pPlaneIn, - * M4VIFI_ImagePlane *pPlaneOut) - * @brief Resizes RGB565 Planar plane. - * @param pUserData: (IN) User Data - * @param pPlaneIn: (IN) Pointer to RGB565 (Planar) plane buffer - * @param pPlaneOut: (OUT) Pointer to RGB565 (Planar) plane - * @return M4VIFI_OK: there is no error - * @return M4VIFI_ILLEGAL_FRAME_HEIGHT: Error in height - * @return M4VIFI_ILLEGAL_FRAME_WIDTH: Error in width - *********************************************************************************************** -*/ -M4VIFI_UInt8 M4VIFI_ResizeBilinearRGB565toRGB565(void *pUserData, - M4VIFI_ImagePlane *pPlaneIn, - M4VIFI_ImagePlane *pPlaneOut) -{ - M4VIFI_UInt16 *pu16_data_in; - M4VIFI_UInt16 *pu16_data_out; - M4VIFI_UInt32 u32_width_in, u32_width_out, u32_height_in, u32_height_out; - M4VIFI_UInt32 u32_stride_in, u32_stride_out; - M4VIFI_UInt32 u32_x_inc, u32_y_inc; - M4VIFI_UInt32 u32_x_accum, u32_y_accum, u32_x_accum_start; - M4VIFI_UInt32 u32_width, u32_height; - M4VIFI_UInt32 u32_y_frac; - M4VIFI_UInt32 u32_x_frac; - M4VIFI_UInt32 u32_Rtemp_value,u32_Gtemp_value,u32_Btemp_value; - M4VIFI_UInt16 *pu16_src_top; - M4VIFI_UInt16 *pu16_src_bottom; - M4VIFI_UInt32 i32_b00, i32_g00, i32_r00; - M4VIFI_UInt32 i32_b01, i32_g01, i32_r01; - M4VIFI_UInt32 i32_b02, i32_g02, i32_r02; - M4VIFI_UInt32 i32_b03, i32_g03, i32_r03; - M4VIFI_UInt8 count_trans=0; - - /* Check for the RGB width and height are even */ - if ((IS_EVEN(pPlaneIn->u_height) == FALSE) || - (IS_EVEN(pPlaneOut->u_height) == FALSE)) { - return M4VIFI_ILLEGAL_FRAME_HEIGHT; - } - - if ((IS_EVEN(pPlaneIn->u_width) == FALSE) || - (IS_EVEN(pPlaneOut->u_width) == FALSE)) { - return M4VIFI_ILLEGAL_FRAME_WIDTH; - } - - /* Set the working pointers at the beginning of the input/output data field */ - pu16_data_in = (M4VIFI_UInt16*)(pPlaneIn->pac_data + pPlaneIn->u_topleft); - pu16_data_out = (M4VIFI_UInt16*)(pPlaneOut->pac_data + pPlaneOut->u_topleft); - - /* Get the memory jump corresponding to a row jump */ - u32_stride_in = pPlaneIn->u_stride; - u32_stride_out = pPlaneOut->u_stride; - - /* Set the bounds of the active image */ - u32_width_in = pPlaneIn->u_width; - u32_height_in = pPlaneIn->u_height; - - u32_width_out = pPlaneOut->u_width; - u32_height_out = pPlaneOut->u_height; - - /* Compute horizontal ratio between src and destination width.*/ - if (u32_width_out >= u32_width_in) { - u32_x_inc = ((u32_width_in-1) * MAX_SHORT) / (u32_width_out-1); - } else { - u32_x_inc = (u32_width_in * MAX_SHORT) / (u32_width_out); - } - - /* Compute vertical ratio between src and destination height.*/ - if (u32_height_out >= u32_height_in) { - u32_y_inc = ((u32_height_in - 1) * MAX_SHORT) / (u32_height_out-1); - } else { - u32_y_inc = (u32_height_in * MAX_SHORT) / (u32_height_out); - } - - /* - Calculate initial accumulator value : u32_y_accum_start. - u32_y_accum_start is coded on 15 bits, and represents a value between 0 and 0.5 - */ - if (u32_y_inc >= MAX_SHORT) { - /* - Keep the fractional part, integer part is coded - on the 16 high bits and the fractionnal on the 15 low bits - */ - u32_y_accum = u32_y_inc & 0xffff; - - if (!u32_y_accum) - { - u32_y_accum = MAX_SHORT; - } - - u32_y_accum >>= 1; - } else { - u32_y_accum = 0; - } - - /* - Calculate initial accumulator value : u32_x_accum_start. - u32_x_accum_start is coded on 15 bits, and represents a value between 0 and 0.5 - */ - if (u32_x_inc >= MAX_SHORT) { - u32_x_accum_start = u32_x_inc & 0xffff; - - if (!u32_x_accum_start) { - u32_x_accum_start = MAX_SHORT; - } - - u32_x_accum_start >>= 1; - } else { - u32_x_accum_start = 0; - } - - u32_height = u32_height_out; - - /* - Bilinear interpolation linearly interpolates along each row, and then uses that - result in a linear interpolation donw each column. Each estimated pixel in the - output image is a weighted combination of its four neighbours according to the formula: - F(p',q')=f(p,q)R(-a)R(b)+f(p,q-1)R(-a)R(b-1)+f(p+1,q)R(1-a)R(b)+f(p+&,q+1)R(1-a)R(b-1) - with R(x) = / x+1 -1 =< x =< 0 \ 1-x 0 =< x =< 1 and a (resp. b)weighting coefficient - is the distance from the nearest neighbor in the p (resp. q) direction - */ - - do { /* Scan all the row */ - - /* Vertical weight factor */ - u32_y_frac = (u32_y_accum>>12)&15; - - /* Reinit accumulator */ - u32_x_accum = u32_x_accum_start; - - u32_width = u32_width_out; - - do { /* Scan along each row */ - pu16_src_top = pu16_data_in + (u32_x_accum >> 16); - pu16_src_bottom = pu16_src_top + (u32_stride_in>>1); - u32_x_frac = (u32_x_accum >> 12)&15; /* Horizontal weight factor */ - - /* Weighted combination */ - if ((u32_height == 1) && (u32_height_in == u32_height_out)) { - GET_RGB565(i32_b00,i32_g00,i32_r00,(M4VIFI_UInt16)pu16_src_top[0]); - GET_RGB565(i32_b01,i32_g01,i32_r01,(M4VIFI_UInt16)pu16_src_top[1]); - GET_RGB565(i32_b02,i32_g02,i32_r02,(M4VIFI_UInt16)pu16_src_top[0]); - GET_RGB565(i32_b03,i32_g03,i32_r03,(M4VIFI_UInt16)pu16_src_top[1]); - } else { - GET_RGB565(i32_b00,i32_g00,i32_r00,(M4VIFI_UInt16)pu16_src_top[0]); - GET_RGB565(i32_b01,i32_g01,i32_r01,(M4VIFI_UInt16)pu16_src_top[1]); - GET_RGB565(i32_b02,i32_g02,i32_r02,(M4VIFI_UInt16)pu16_src_bottom[0]); - GET_RGB565(i32_b03,i32_g03,i32_r03,(M4VIFI_UInt16)pu16_src_bottom[1]); - - } - - /* Solution to avoid green effects due to transparency */ - count_trans = 0; - - /* If RGB is transparent color (0, 63, 0), we transform it to white (31,63,31) */ - if (i32_b00 == 0 && i32_g00 == 63 && i32_r00 == 0) - { - i32_b00 = 31; - i32_r00 = 31; - count_trans++; - } - if (i32_b01 == 0 && i32_g01 == 63 && i32_r01 == 0) - { - i32_b01 = 31; - i32_r01 = 31; - count_trans++; - } - if (i32_b02 == 0 && i32_g02 == 63 && i32_r02 == 0) - { - i32_b02 = 31; - i32_r02 = 31; - count_trans++; - } - if (i32_b03 == 0 && i32_g03 == 63 && i32_r03 == 0) - { - i32_b03 = 31; - i32_r03 = 31; - count_trans++; - } - - if (count_trans > 2) { - /* pixel is transparent */ - u32_Rtemp_value = 0; - u32_Gtemp_value = 63; - u32_Btemp_value = 0; - } else { - u32_Rtemp_value = (M4VIFI_UInt8)(((i32_r00*(16-u32_x_frac) + - i32_r01*u32_x_frac)*(16-u32_y_frac) + - (i32_r02*(16-u32_x_frac) + - i32_r03*u32_x_frac)*u32_y_frac )>>8); - - u32_Gtemp_value = (M4VIFI_UInt8)(((i32_g00*(16-u32_x_frac) + - i32_g01*u32_x_frac)*(16-u32_y_frac) + - (i32_g02*(16-u32_x_frac) + - i32_g03*u32_x_frac)*u32_y_frac )>>8); - - u32_Btemp_value = (M4VIFI_UInt8)(((i32_b00*(16-u32_x_frac) + - i32_b01*u32_x_frac)*(16-u32_y_frac) + - (i32_b02*(16-u32_x_frac) + - i32_b03*u32_x_frac)*u32_y_frac )>>8); - } - - *pu16_data_out++ = (M4VIFI_UInt16)( (((u32_Gtemp_value & 0x38) >> 3) | (u32_Btemp_value << 3)) |\ - ( (((u32_Gtemp_value & 0x7) << 5 ) | u32_Rtemp_value)<<8 )); - - /* Update horizontal accumulator */ - u32_x_accum += u32_x_inc; - - } while(--u32_width); - - - /* Update vertical accumulator */ - u32_y_accum += u32_y_inc; - if (u32_y_accum>>16) { - pu16_data_in = pu16_data_in + (u32_y_accum >> 16) * (u32_stride_in>>1); - u32_y_accum &= 0xffff; - } - - } while(--u32_height); - - return M4VIFI_OK; -} - diff --git a/libvideoeditor/vss/video_filters/src/M4VIFI_ResizeRGB888toRGB888.c b/libvideoeditor/vss/video_filters/src/M4VIFI_ResizeRGB888toRGB888.c deleted file mode 100755 index deb9d44..0000000 --- a/libvideoeditor/vss/video_filters/src/M4VIFI_ResizeRGB888toRGB888.c +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - ****************************************************************************** - * @file M4VIFI_ResizeYUV420toYUV420.c - * @brief Contain video library function - * @note This file has a Resize filter function - * -# Generic resizing of YUV420 (Planar) image - ****************************************************************************** -*/ - -/* Prototypes of functions, and type definitions */ -#include "M4VIFI_FiltersAPI.h" -/* Macro definitions */ -#include "M4VIFI_Defines.h" -/* Clip table declaration */ -#include "M4VIFI_Clip.h" - -/** - *********************************************************************************************** - * M4VIFI_UInt8 M4VIFI_ResizeBilinearRGB888toRGB888(void *pUserData, M4VIFI_ImagePlane *pPlaneIn, - * M4VIFI_ImagePlane *pPlaneOut) - * @brief Resizes YUV420 Planar plane. - * @note Basic structure of the function - * Loop on each row (step 2) - * Loop on each column (step 2) - * Get four Y samples and 1 U & V sample - * Resize the Y with corresponing U and V samples - * Place the YUV in the ouput plane - * end loop column - * end loop row - * For resizing bilinear interpolation linearly interpolates along - * each row, and then uses that result in a linear interpolation down each column. - * Each estimated pixel in the output image is a weighted - * combination of its four neighbours. The ratio of compression - * or dilatation is estimated using input and output sizes. - * @param pUserData: (IN) User Data - * @param pPlaneIn: (IN) Pointer to YUV420 (Planar) plane buffer - * @param pPlaneOut: (OUT) Pointer to YUV420 (Planar) plane - * @return M4VIFI_OK: there is no error - * @return M4VIFI_ILLEGAL_FRAME_HEIGHT: Error in height - * @return M4VIFI_ILLEGAL_FRAME_WIDTH: Error in width - *********************************************************************************************** -*/ -M4VIFI_UInt8 M4VIFI_ResizeBilinearRGB888toRGB888(void *pUserData, - M4VIFI_ImagePlane *pPlaneIn, - M4VIFI_ImagePlane *pPlaneOut) -{ - M4VIFI_UInt8 *pu8_data_in; - M4VIFI_UInt8 *pu8_data_out; - M4VIFI_UInt32 u32_width_in, u32_width_out, u32_height_in, u32_height_out; - M4VIFI_UInt32 u32_stride_in, u32_stride_out; - M4VIFI_UInt32 u32_x_inc, u32_y_inc; - M4VIFI_UInt32 u32_x_accum, u32_y_accum, u32_x_accum_start; - M4VIFI_UInt32 u32_width, u32_height; - M4VIFI_UInt32 u32_y_frac; - M4VIFI_UInt32 u32_x_frac; - M4VIFI_UInt32 u32_Rtemp_value,u32_Gtemp_value,u32_Btemp_value; - M4VIFI_UInt8 *pu8_src_top; - M4VIFI_UInt8 *pu8_src_bottom; - M4VIFI_UInt32 i32_b00, i32_g00, i32_r00; - M4VIFI_UInt32 i32_b01, i32_g01, i32_r01; - M4VIFI_UInt32 i32_b02, i32_g02, i32_r02; - M4VIFI_UInt32 i32_b03, i32_g03, i32_r03; - - /* Check for the YUV width and height are even */ - if ((IS_EVEN(pPlaneIn->u_height) == FALSE) || - (IS_EVEN(pPlaneOut->u_height) == FALSE)) - { - return M4VIFI_ILLEGAL_FRAME_HEIGHT; - } - - if ((IS_EVEN(pPlaneIn->u_width) == FALSE) || - (IS_EVEN(pPlaneOut->u_width) == FALSE)) - { - return M4VIFI_ILLEGAL_FRAME_WIDTH; - } - - - /* Set the working pointers at the beginning of the input/output data field */ - pu8_data_in = (M4VIFI_UInt8*)(pPlaneIn->pac_data + pPlaneIn->u_topleft); - pu8_data_out = (M4VIFI_UInt8*)(pPlaneOut->pac_data + pPlaneOut->u_topleft); - - /* Get the memory jump corresponding to a row jump */ - u32_stride_in = pPlaneIn->u_stride; - u32_stride_out = pPlaneOut->u_stride; - - /* Set the bounds of the active image */ - u32_width_in = pPlaneIn->u_width; - u32_height_in = pPlaneIn->u_height; - - u32_width_out = pPlaneOut->u_width; - u32_height_out = pPlaneOut->u_height; - - /* Compute horizontal ratio between src and destination width.*/ - if (u32_width_out >= u32_width_in) - { - u32_x_inc = ((u32_width_in-1) * MAX_SHORT) / (u32_width_out-1); - } - else - { - u32_x_inc = (u32_width_in * MAX_SHORT) / (u32_width_out); - } - - /* Compute vertical ratio between src and destination height.*/ - if (u32_height_out >= u32_height_in) - { - u32_y_inc = ((u32_height_in - 1) * MAX_SHORT) / (u32_height_out-1); - } - else - { - u32_y_inc = (u32_height_in * MAX_SHORT) / (u32_height_out); - } - - /* - Calculate initial accumulator value : u32_y_accum_start. - u32_y_accum_start is coded on 15 bits, and represents a value between 0 and 0.5 - */ - if (u32_y_inc >= MAX_SHORT) - { - /* - Keep the fractionnal part, assimung that integer part is coded - on the 16 high bits and the fractionnal on the 15 low bits - */ - u32_y_accum = u32_y_inc & 0xffff; - - if (!u32_y_accum) - { - u32_y_accum = MAX_SHORT; - } - - u32_y_accum >>= 1; - } - else - { - u32_y_accum = 0; - } - - - /* - Calculate initial accumulator value : u32_x_accum_start. - u32_x_accum_start is coded on 15 bits, and represents a value between 0 and 0.5 - */ - if (u32_x_inc >= MAX_SHORT) - { - u32_x_accum_start = u32_x_inc & 0xffff; - - if (!u32_x_accum_start) - { - u32_x_accum_start = MAX_SHORT; - } - - u32_x_accum_start >>= 1; - } - else - { - u32_x_accum_start = 0; - } - - u32_height = u32_height_out; - - /* - Bilinear interpolation linearly interpolates along each row, and then uses that - result in a linear interpolation donw each column. Each estimated pixel in the - output image is a weighted combination of its four neighbours according to the formula: - F(p',q')=f(p,q)R(-a)R(b)+f(p,q-1)R(-a)R(b-1)+f(p+1,q)R(1-a)R(b)+f(p+&,q+1)R(1-a)R(b-1) - with R(x) = / x+1 -1 =< x =< 0 \ 1-x 0 =< x =< 1 and a (resp. b)weighting coefficient - is the distance from the nearest neighbor in the p (resp. q) direction - */ - - do { /* Scan all the row */ - - /* Vertical weight factor */ - u32_y_frac = (u32_y_accum>>12)&15; - - /* Reinit accumulator */ - u32_x_accum = u32_x_accum_start; - - u32_width = u32_width_out; - - do { /* Scan along each row */ - pu8_src_top = pu8_data_in + (u32_x_accum >> 16)*3; - pu8_src_bottom = pu8_src_top + (u32_stride_in); - u32_x_frac = (u32_x_accum >> 12)&15; /* Horizontal weight factor */ - - if ((u32_width == 1) && (u32_width_in == u32_width_out)) { - /* - When input height is equal to output height and input width - equal to output width, replicate the corner pixels for - interpolation - */ - if ((u32_height == 1) && (u32_height_in == u32_height_out)) { - GET_RGB24(i32_b00,i32_g00,i32_r00,pu8_src_top,0); - GET_RGB24(i32_b01,i32_g01,i32_r01,pu8_src_top,0); - GET_RGB24(i32_b02,i32_g02,i32_r02,pu8_src_top,0); - GET_RGB24(i32_b03,i32_g03,i32_r03,pu8_src_top,0); - } - /* - When input height is not equal to output height and - input width equal to output width, replicate the - column for interpolation - */ - else { - GET_RGB24(i32_b00,i32_g00,i32_r00,pu8_src_top,0); - GET_RGB24(i32_b01,i32_g01,i32_r01,pu8_src_top,0); - GET_RGB24(i32_b02,i32_g02,i32_r02,pu8_src_bottom,0); - GET_RGB24(i32_b03,i32_g03,i32_r03,pu8_src_bottom,0); - } - } else { - /* - When input height is equal to output height and - input width not equal to output width, replicate the - row for interpolation - */ - if ((u32_height == 1) && (u32_height_in == u32_height_out)) { - GET_RGB24(i32_b00,i32_g00,i32_r00,pu8_src_top,0); - GET_RGB24(i32_b01,i32_g01,i32_r01,pu8_src_top,3); - GET_RGB24(i32_b02,i32_g02,i32_r02,pu8_src_top,0); - GET_RGB24(i32_b03,i32_g03,i32_r03,pu8_src_top,3); - } else { - GET_RGB24(i32_b00,i32_g00,i32_r00,pu8_src_top,0); - GET_RGB24(i32_b01,i32_g01,i32_r01,pu8_src_top,3); - GET_RGB24(i32_b02,i32_g02,i32_r02,pu8_src_bottom,0); - GET_RGB24(i32_b03,i32_g03,i32_r03,pu8_src_bottom,3); - } - } - u32_Rtemp_value = (M4VIFI_UInt8)(((i32_r00*(16-u32_x_frac) + - i32_r01*u32_x_frac)*(16-u32_y_frac) + - (i32_r02*(16-u32_x_frac) + - i32_r03*u32_x_frac)*u32_y_frac )>>8); - - u32_Gtemp_value = (M4VIFI_UInt8)(((i32_g00*(16-u32_x_frac) + - i32_g01*u32_x_frac)*(16-u32_y_frac) + - (i32_g02*(16-u32_x_frac) + - i32_g03*u32_x_frac)*u32_y_frac )>>8); - - u32_Btemp_value = (M4VIFI_UInt8)(((i32_b00*(16-u32_x_frac) + - i32_b01*u32_x_frac)*(16-u32_y_frac) + - (i32_b02*(16-u32_x_frac) + - i32_b03*u32_x_frac)*u32_y_frac )>>8); - - *pu8_data_out++ = u32_Btemp_value ; - *pu8_data_out++ = u32_Gtemp_value ; - *pu8_data_out++ = u32_Rtemp_value ; - - /* Update horizontal accumulator */ - u32_x_accum += u32_x_inc; - - } while(--u32_width); - - //pu16_data_out = pu16_data_out + (u32_stride_out>>1) - (u32_width_out); - - /* Update vertical accumulator */ - u32_y_accum += u32_y_inc; - if (u32_y_accum>>16) - { - pu8_data_in = pu8_data_in + (u32_y_accum >> 16) * (u32_stride_in) ; - u32_y_accum &= 0xffff; - } - } while(--u32_height); - - return M4VIFI_OK; -} -/* End of file M4VIFI_ResizeRGB565toRGB565.c */ - diff --git a/libvideoeditor/vss/video_filters/src/M4VIFI_ResizeYUVtoBGR565.c b/libvideoeditor/vss/video_filters/src/M4VIFI_ResizeYUVtoBGR565.c deleted file mode 100755 index 0042e80..0000000 --- a/libvideoeditor/vss/video_filters/src/M4VIFI_ResizeYUVtoBGR565.c +++ /dev/null @@ -1,422 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - ****************************************************************************** - * @file M4VIFI_ResizeYUV420toBGR565.c - * @brief Contain video library function - * @note This file has a Combo filter function - * -# Resizes YUV420 and converts to RGR565 with rotation - ****************************************************************************** -*/ - -/* Prototypes of functions, and type definitions */ -#include "M4VIFI_FiltersAPI.h" -/* Macro definitions */ -#include "M4VIFI_Defines.h" -/* Clip table declaration */ -#include "M4VIFI_Clip.h" - -/** - ********************************************************************************************* - * M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toBGR565(void *pContext, M4VIFI_ImagePlane *pPlaneIn, - * M4VIFI_ImagePlane *pPlaneOut) - * @brief Resize YUV420 plane and converts to BGR565 with +90 rotation. - * @note Basic sturture of the function - * Loop on each row (step 2) - * Loop on each column (step 2) - * Get four Y samples and 1 u & V sample - * Resize the Y with corresponing U and V samples - * Compute the four corresponding R G B values - * Place the R G B in the ouput plane in rotated fashion - * end loop column - * end loop row - * For resizing bilinear interpolation linearly interpolates along - * each row, and then uses that result in a linear interpolation down each column. - * Each estimated pixel in the output image is a weighted - * combination of its four neighbours. The ratio of compression - * or dilatation is estimated using input and output sizes. - * @param pPlaneIn: (IN) Pointer to YUV plane buffer - * @param pContext: (IN) Context Pointer - * @param pPlaneOut: (OUT) Pointer to BGR565 Plane - * @return M4VIFI_OK: there is no error - * @return M4VIFI_ILLEGAL_FRAME_HEIGHT: YUV Plane height is ODD - * @return M4VIFI_ILLEGAL_FRAME_WIDTH: YUV Plane width is ODD - ********************************************************************************************* -*/ -M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toBGR565(void* pContext, - M4VIFI_ImagePlane *pPlaneIn, - M4VIFI_ImagePlane *pPlaneOut) -{ - M4VIFI_UInt8 *pu8_data_in[PLANES], *pu8_data_in1[PLANES],*pu8_data_out; - M4VIFI_UInt32 *pu32_rgb_data_current, *pu32_rgb_data_next, *pu32_rgb_data_start; - - M4VIFI_UInt32 u32_width_in[PLANES], u32_width_out, u32_height_in[PLANES], u32_height_out; - M4VIFI_UInt32 u32_stride_in[PLANES]; - M4VIFI_UInt32 u32_stride_out, u32_stride2_out, u32_width2_RGB, u32_height2_RGB; - M4VIFI_UInt32 u32_x_inc[PLANES], u32_y_inc[PLANES]; - M4VIFI_UInt32 u32_x_accum_Y, u32_x_accum_U, u32_x_accum_start; - M4VIFI_UInt32 u32_y_accum_Y, u32_y_accum_U; - M4VIFI_UInt32 u32_x_frac_Y, u32_x_frac_U, u32_y_frac_Y,u32_y_frac_U; - M4VIFI_Int32 U_32, V_32, Y_32, Yval_32; - M4VIFI_UInt8 u8_Red, u8_Green, u8_Blue; - M4VIFI_UInt32 u32_row, u32_col; - - M4VIFI_UInt32 u32_plane; - M4VIFI_UInt32 u32_rgb_temp1, u32_rgb_temp2; - M4VIFI_UInt32 u32_rgb_temp3,u32_rgb_temp4; - M4VIFI_UInt32 u32_check_size; - - M4VIFI_UInt8 *pu8_src_top_Y,*pu8_src_top_U,*pu8_src_top_V ; - M4VIFI_UInt8 *pu8_src_bottom_Y, *pu8_src_bottom_U, *pu8_src_bottom_V; - - /* Check for the YUV width and height are even */ - u32_check_size = IS_EVEN(pPlaneIn[0].u_height); - if( u32_check_size == FALSE ) - { - return M4VIFI_ILLEGAL_FRAME_HEIGHT; - } - u32_check_size = IS_EVEN(pPlaneIn[0].u_width); - if (u32_check_size == FALSE ) - { - return M4VIFI_ILLEGAL_FRAME_WIDTH; - - } - /* Make the ouput width and height as even */ - pPlaneOut->u_height = pPlaneOut->u_height & 0xFFFFFFFE; - pPlaneOut->u_width = pPlaneOut->u_width & 0xFFFFFFFE; - pPlaneOut->u_stride = pPlaneOut->u_stride & 0xFFFFFFFC; - - /* Assignment of output pointer */ - pu8_data_out = pPlaneOut->pac_data + pPlaneOut->u_topleft; - /* Assignment of output width(rotated) */ - u32_width_out = pPlaneOut->u_width; - /* Assignment of output height(rotated) */ - u32_height_out = pPlaneOut->u_height; - - u32_width2_RGB = pPlaneOut->u_width >> 1; - u32_height2_RGB = pPlaneOut->u_height >> 1; - - u32_stride_out = pPlaneOut->u_stride >> 1; - u32_stride2_out = pPlaneOut->u_stride >> 2; - - for(u32_plane = 0; u32_plane < PLANES; u32_plane++) - { - /* Set the working pointers at the beginning of the input/output data field */ - pu8_data_in[u32_plane] = pPlaneIn[u32_plane].pac_data + pPlaneIn[u32_plane].u_topleft; - - /* Get the memory jump corresponding to a row jump */ - u32_stride_in[u32_plane] = pPlaneIn[u32_plane].u_stride; - - /* Set the bounds of the active image */ - u32_width_in[u32_plane] = pPlaneIn[u32_plane].u_width; - u32_height_in[u32_plane] = pPlaneIn[u32_plane].u_height; - } - /* Compute horizontal ratio between src and destination width for Y Plane. */ - if (u32_width_out >= u32_width_in[YPlane]) - { - u32_x_inc[YPlane] = ((u32_width_in[YPlane]-1) * MAX_SHORT) / (u32_width_out-1); - } - else - { - u32_x_inc[YPlane] = (u32_width_in[YPlane] * MAX_SHORT) / (u32_width_out); - } - - /* Compute vertical ratio between src and destination height for Y Plane.*/ - if (u32_height_out >= u32_height_in[YPlane]) - { - u32_y_inc[YPlane] = ((u32_height_in[YPlane]-1) * MAX_SHORT) / (u32_height_out-1); - } - else - { - u32_y_inc[YPlane] = (u32_height_in[YPlane] * MAX_SHORT) / (u32_height_out); - } - - /* Compute horizontal ratio between src and destination width for U and V Planes. */ - if (u32_width2_RGB >= u32_width_in[UPlane]) - { - u32_x_inc[UPlane] = ((u32_width_in[UPlane]-1) * MAX_SHORT) / (u32_width2_RGB-1); - } - else - { - u32_x_inc[UPlane] = (u32_width_in[UPlane] * MAX_SHORT) / (u32_width2_RGB); - } - - /* Compute vertical ratio between src and destination height for U and V Planes. */ - - if (u32_height2_RGB >= u32_height_in[UPlane]) - { - u32_y_inc[UPlane] = ((u32_height_in[UPlane]-1) * MAX_SHORT) / (u32_height2_RGB-1); - } - else - { - u32_y_inc[UPlane] = (u32_height_in[UPlane] * MAX_SHORT) / (u32_height2_RGB); - } - - u32_y_inc[VPlane] = u32_y_inc[UPlane]; - u32_x_inc[VPlane] = u32_x_inc[UPlane]; - - /* - Calculate initial accumulator value : u32_y_accum_start. - u32_y_accum_start is coded on 15 bits,and represents a value between 0 and 0.5 - */ - if (u32_y_inc[YPlane] > MAX_SHORT) - { - /* - Keep the fractionnal part, assimung that integer part is coded on the 16 high bits, - and the fractionnal on the 15 low bits - */ - u32_y_accum_Y = u32_y_inc[YPlane] & 0xffff; - u32_y_accum_U = u32_y_inc[UPlane] & 0xffff; - - if (!u32_y_accum_Y) - { - u32_y_accum_Y = MAX_SHORT; - u32_y_accum_U = MAX_SHORT; - } - u32_y_accum_Y >>= 1; - u32_y_accum_U >>= 1; - } - else - { - u32_y_accum_Y = 0; - u32_y_accum_U = 0; - - } - - /* - Calculate initial accumulator value : u32_x_accum_start. - u32_x_accum_start is coded on 15 bits, and represents a value between 0 and 0.5 - */ - if (u32_x_inc[YPlane] > MAX_SHORT) - { - u32_x_accum_start = u32_x_inc[YPlane] & 0xffff; - - if (!u32_x_accum_start) - { - u32_x_accum_start = MAX_SHORT; - } - - u32_x_accum_start >>= 1; - } - else - { - u32_x_accum_start = 0; - } - - pu32_rgb_data_start = (M4VIFI_UInt32*)pu8_data_out; - - /* - Bilinear interpolation linearly interpolates along each row, and then uses that - result in a linear interpolation donw each column. Each estimated pixel in the - output image is a weighted combination of its four neighbours according to the formula : - F(p',q')=f(p,q)R(-a)R(b)+f(p,q-1)R(-a)R(b-1)+f(p+1,q)R(1-a)R(b)+f(p+&,q+1)R(1-a)R(b-1) - with R(x) = / x+1 -1 =< x =< 0 \ 1-x 0 =< x =< 1 and a (resp. b) weighting coefficient - is the distance from the nearest neighbor in the p (resp. q) direction - */ - for (u32_row = u32_height_out; u32_row != 0; u32_row -= 2) - { - u32_x_accum_Y = u32_x_accum_start; - u32_x_accum_U = u32_x_accum_start; - - /* Vertical weight factor */ - u32_y_frac_Y = (u32_y_accum_Y >> 12) & 15; - u32_y_frac_U = (u32_y_accum_U >> 12) & 15; - - /* RGB current line position pointer */ - pu32_rgb_data_current = pu32_rgb_data_start ; - - /* RGB next line position pointer */ - pu32_rgb_data_next = pu32_rgb_data_current + (u32_stride2_out); - - /* Y Plane next row pointer */ - pu8_data_in1[YPlane] = pu8_data_in[YPlane]; - - u32_rgb_temp3 = u32_y_accum_Y + (u32_y_inc[YPlane]); - if (u32_rgb_temp3 >> 16) - { - pu8_data_in1[YPlane] = pu8_data_in[YPlane] + - (u32_rgb_temp3 >> 16) * (u32_stride_in[YPlane]); - u32_rgb_temp3 &= 0xffff; - } - u32_rgb_temp4 = (u32_rgb_temp3 >> 12) & 15; - - for (u32_col = u32_width_out; u32_col != 0; u32_col -= 2) - { - - /* Input Y plane elements */ - pu8_src_top_Y = pu8_data_in[YPlane] + (u32_x_accum_Y >> 16); - pu8_src_bottom_Y = pu8_src_top_Y + u32_stride_in[YPlane]; - - /* Input U Plane elements */ - pu8_src_top_U = pu8_data_in[UPlane] + (u32_x_accum_U >> 16); - pu8_src_bottom_U = pu8_src_top_U + u32_stride_in[UPlane]; - - pu8_src_top_V = pu8_data_in[VPlane] + (u32_x_accum_U >> 16); - pu8_src_bottom_V = pu8_src_top_V + u32_stride_in[VPlane]; - - /* Horizontal weight factor for Y plane */ - u32_x_frac_Y = (u32_x_accum_Y >> 12)&15; - /* Horizontal weight factor for U and V planes */ - u32_x_frac_U = (u32_x_accum_U >> 12)&15; - - /* Weighted combination */ - U_32 = (((pu8_src_top_U[0]*(16-u32_x_frac_U) + pu8_src_top_U[1]*u32_x_frac_U) - *(16-u32_y_frac_U) + (pu8_src_bottom_U[0]*(16-u32_x_frac_U) - + pu8_src_bottom_U[1]*u32_x_frac_U)*u32_y_frac_U ) >> 8); - - V_32 = (((pu8_src_top_V[0]*(16-u32_x_frac_U) + pu8_src_top_V[1]*u32_x_frac_U) - *(16-u32_y_frac_U)+ (pu8_src_bottom_V[0]*(16-u32_x_frac_U) - + pu8_src_bottom_V[1]*u32_x_frac_U)*u32_y_frac_U ) >> 8); - - Y_32 = (((pu8_src_top_Y[0]*(16-u32_x_frac_Y) + pu8_src_top_Y[1]*u32_x_frac_Y) - *(16-u32_y_frac_Y) + (pu8_src_bottom_Y[0]*(16-u32_x_frac_Y) - + pu8_src_bottom_Y[1]*u32_x_frac_Y)*u32_y_frac_Y ) >> 8); - - u32_x_accum_U += (u32_x_inc[UPlane]); - - /* YUV to RGB */ - #ifdef __RGB_V1__ - Yval_32 = Y_32*37; - #else /* __RGB_V1__v */ - Yval_32 = Y_32*0x2568; - #endif /* __RGB_V1__v */ - - DEMATRIX(u8_Red,u8_Green,u8_Blue,Yval_32,U_32,V_32); - - /* Pack 8 bit R,G,B to RGB565 */ - #ifdef LITTLE_ENDIAN - u32_rgb_temp1 = PACK_BGR565(0,u8_Red,u8_Green,u8_Blue); - #else /* LITTLE_ENDIAN */ - u32_rgb_temp1 = PACK_BGR565(16,u8_Red,u8_Green,u8_Blue); - #endif /* LITTLE_ENDIAN */ - - - pu8_src_top_Y = pu8_data_in1[YPlane]+(u32_x_accum_Y >> 16); - pu8_src_bottom_Y = pu8_src_top_Y + u32_stride_in[YPlane]; - - /* Weighted combination */ - Y_32 = (((pu8_src_top_Y[0]*(16-u32_x_frac_Y) + pu8_src_top_Y[1]*u32_x_frac_Y) - *(16-u32_rgb_temp4) + (pu8_src_bottom_Y[0]*(16-u32_x_frac_Y) - + pu8_src_bottom_Y[1]*u32_x_frac_Y)*u32_rgb_temp4 ) >> 8); - - u32_x_accum_Y += u32_x_inc[YPlane]; - - /* Horizontal weight factor */ - u32_x_frac_Y = (u32_x_accum_Y >> 12)&15; - - /* YUV to RGB */ - #ifdef __RGB_V1__ - Yval_32 = Y_32*37; - #else /* __RGB_V1__v */ - Yval_32 = Y_32*0x2568; - #endif /* __RGB_V1__v */ - - DEMATRIX(u8_Red,u8_Green,u8_Blue,Yval_32,U_32,V_32); - - /* Pack 8 bit R,G,B to RGB565 */ - #ifdef LITTLE_ENDIAN - u32_rgb_temp2 = PACK_BGR565(0,u8_Red,u8_Green,u8_Blue); - #else /* LITTLE_ENDIAN */ - u32_rgb_temp2 = PACK_BGR565(16,u8_Red,u8_Green,u8_Blue); - #endif /* LITTLE_ENDIAN */ - - - pu8_src_top_Y = pu8_data_in[YPlane] + (u32_x_accum_Y >> 16) ; - pu8_src_bottom_Y = pu8_src_top_Y + u32_stride_in[YPlane]; - - /* Weighted combination */ - Y_32 = (((pu8_src_top_Y[0]*(16-u32_x_frac_Y) + pu8_src_top_Y[1]*u32_x_frac_Y) - *(16-u32_y_frac_Y) + (pu8_src_bottom_Y[0]*(16-u32_x_frac_Y) - + pu8_src_bottom_Y[1]*u32_x_frac_Y)*u32_y_frac_Y ) >> 8); - - /* YUV to RGB */ - #ifdef __RGB_V1__ - Yval_32 = Y_32*37; - #else /* __RGB_V1__v */ - Yval_32 = Y_32*0x2568; - #endif /* __RGB_V1__v */ - - DEMATRIX(u8_Red,u8_Green,u8_Blue,Yval_32,U_32,V_32); - - /* Pack 8 bit R,G,B to RGB565 */ - #ifdef LITTLE_ENDIAN - *(pu32_rgb_data_current)++ = u32_rgb_temp1 | - PACK_BGR565(16,u8_Red,u8_Green,u8_Blue); - #else /* LITTLE_ENDIAN */ - *(pu32_rgb_data_current)++ = u32_rgb_temp1 | - PACK_BGR565(0,u8_Red,u8_Green,u8_Blue); - #endif /* LITTLE_ENDIAN */ - - - pu8_src_top_Y = pu8_data_in1[YPlane]+ (u32_x_accum_Y >> 16); - pu8_src_bottom_Y = pu8_src_top_Y + u32_stride_in[YPlane]; - - /* Weighted combination */ - Y_32 = (((pu8_src_top_Y[0]*(16-u32_x_frac_Y) + pu8_src_top_Y[1]*u32_x_frac_Y) - *(16-u32_rgb_temp4) + (pu8_src_bottom_Y[0]*(16-u32_x_frac_Y) - + pu8_src_bottom_Y[1]*u32_x_frac_Y)*u32_rgb_temp4 )>>8); - - u32_x_accum_Y += u32_x_inc[YPlane]; - /* YUV to RGB */ - #ifdef __RGB_V1__ - Yval_32=Y_32*37; - #else /* __RGB_V1__v */ - Yval_32=Y_32*0x2568; - #endif /* __RGB_V1__v */ - - DEMATRIX(u8_Red,u8_Green,u8_Blue,Yval_32,U_32,V_32); - - /* Pack 8 bit R,G,B to RGB565 */ - #ifdef LITTLE_ENDIAN - *(pu32_rgb_data_next)++ = u32_rgb_temp2 | - PACK_BGR565(16,u8_Red,u8_Green,u8_Blue); - #else /* LITTLE_ENDIAN */ - *(pu32_rgb_data_next)++ = u32_rgb_temp2 | - PACK_BGR565(0,u8_Red,u8_Green,u8_Blue); - #endif /* LITTLE_ENDIAN */ - - } /* End of horizontal scanning */ - - u32_y_accum_Y = u32_rgb_temp3 + (u32_y_inc[YPlane]); - u32_y_accum_U += (u32_y_inc[UPlane]); - - /* Y plane row update */ - if (u32_y_accum_Y >> 16) - { - pu8_data_in[YPlane] = pu8_data_in1[YPlane] + - ((u32_y_accum_Y >> 16) * (u32_stride_in[YPlane])); - u32_y_accum_Y &= 0xffff; - } - else - { - pu8_data_in[YPlane] = pu8_data_in1[YPlane]; - } - /* U and V planes row update */ - if (u32_y_accum_U >> 16) - { - pu8_data_in[UPlane] = pu8_data_in[UPlane] + - (u32_y_accum_U >> 16) * (u32_stride_in[UPlane]); - pu8_data_in[VPlane] = pu8_data_in[VPlane] + - (u32_y_accum_U >> 16) * (u32_stride_in[VPlane]); - u32_y_accum_U &= 0xffff; - } - /* BGR pointer Update */ - pu32_rgb_data_start += u32_stride_out; - - } /* End of vertical scanning */ - return M4VIFI_OK; -} - diff --git a/libvideoeditor/vss/video_filters/src/M4VIFI_ResizeYUVtoRGB565.c b/libvideoeditor/vss/video_filters/src/M4VIFI_ResizeYUVtoRGB565.c deleted file mode 100755 index eda9d07..0000000 --- a/libvideoeditor/vss/video_filters/src/M4VIFI_ResizeYUVtoRGB565.c +++ /dev/null @@ -1,423 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - ****************************************************************************** - * @file M4VIFI_ResizeYUV420toRGB565RotatedRight.c - * @brief Contain video library function - * @note This file has a Combo filter function - * -# Resizes YUV420 and converts to RGR565 with rotation - * @date - * - 2004/08/11: Creation - ****************************************************************************** -*/ - -/* Prototypes of functions, and type definitions */ -#include "M4VIFI_FiltersAPI.h" -/* Macro definitions */ -#include "M4VIFI_Defines.h" -/* Clip table declaration */ -#include "M4VIFI_Clip.h" - -/** - ******************************************************************************************** - * M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565RotatedRight(void *pContext, - * M4VIFI_ImagePlane *pPlaneIn, - * M4VIFI_ImagePlane *pPlaneOut) - * @brief Resize YUV420 plane and converts to RGB565 with +90 rotation. - * @note Basic sturture of the function - * Loop on each row (step 2) - * Loop on each column (step 2) - * Get four Y samples and 1 u & V sample - * Resize the Y with corresponing U and V samples - * Compute the four corresponding R G B values - * Place the R G B in the ouput plane in rotated fashion - * end loop column - * end loop row - * For resizing bilinear interpolation linearly interpolates along - * each row, and then uses that result in a linear interpolation down each column. - * Each estimated pixel in the output image is a weighted - * combination of its four neighbours. The ratio of compression - * or dilatation is estimated using input and output sizes. - * @param pPlaneIn: (IN) Pointer to YUV plane buffer - * @param pContext: (IN) Context Pointer - * @param pPlaneOut: (OUT) Pointer to BGR565 Plane - * @return M4VIFI_OK: there is no error - * @return M4VIFI_ILLEGAL_FRAME_HEIGHT: YUV Plane height is ODD - * @return M4VIFI_ILLEGAL_FRAME_WIDTH: YUV Plane width is ODD - ******************************************************************************************** -*/ -M4VIFI_UInt8 M4VIFI_ResizeBilinearYUV420toRGB565(void* pContext, - M4VIFI_ImagePlane *pPlaneIn, - M4VIFI_ImagePlane *pPlaneOut) -{ - M4VIFI_UInt8 *pu8_data_in[PLANES], *pu8_data_in1[PLANES],*pu8_data_out; - M4VIFI_UInt32 *pu32_rgb_data_current, *pu32_rgb_data_next, *pu32_rgb_data_start; - - M4VIFI_UInt32 u32_width_in[PLANES], u32_width_out, u32_height_in[PLANES], u32_height_out; - M4VIFI_UInt32 u32_stride_in[PLANES]; - M4VIFI_UInt32 u32_stride_out, u32_stride2_out, u32_width2_RGB, u32_height2_RGB; - M4VIFI_UInt32 u32_x_inc[PLANES], u32_y_inc[PLANES]; - M4VIFI_UInt32 u32_x_accum_Y, u32_x_accum_U, u32_x_accum_start; - M4VIFI_UInt32 u32_y_accum_Y, u32_y_accum_U; - M4VIFI_UInt32 u32_x_frac_Y, u32_x_frac_U, u32_y_frac_Y,u32_y_frac_U; - M4VIFI_Int32 U_32, V_32, Y_32, Yval_32; - M4VIFI_UInt8 u8_Red, u8_Green, u8_Blue; - M4VIFI_UInt32 u32_row, u32_col; - - M4VIFI_UInt32 u32_plane; - M4VIFI_UInt32 u32_rgb_temp1, u32_rgb_temp2; - M4VIFI_UInt32 u32_rgb_temp3,u32_rgb_temp4; - M4VIFI_UInt32 u32_check_size; - - M4VIFI_UInt8 *pu8_src_top_Y,*pu8_src_top_U,*pu8_src_top_V ; - M4VIFI_UInt8 *pu8_src_bottom_Y, *pu8_src_bottom_U, *pu8_src_bottom_V; - - /* Check for the width and height are even */ - u32_check_size = IS_EVEN(pPlaneIn[0].u_height); - if( u32_check_size == FALSE ) - { - return M4VIFI_ILLEGAL_FRAME_HEIGHT; - } - u32_check_size = IS_EVEN(pPlaneIn[0].u_width); - if (u32_check_size == FALSE ) - { - return M4VIFI_ILLEGAL_FRAME_WIDTH; - - } - /* Make the ouput width and height as even */ - pPlaneOut->u_height = pPlaneOut->u_height & 0xFFFFFFFE; - pPlaneOut->u_width = pPlaneOut->u_width & 0xFFFFFFFE; - pPlaneOut->u_stride = pPlaneOut->u_stride & 0xFFFFFFFC; - - /* Assignment of output pointer */ - pu8_data_out = pPlaneOut->pac_data + pPlaneOut->u_topleft; - /* Assignment of output width(rotated) */ - u32_width_out = pPlaneOut->u_width; - /* Assignment of output height(rotated) */ - u32_height_out = pPlaneOut->u_height; - - /* Set the bounds of the active image */ - u32_width2_RGB = pPlaneOut->u_width >> 1; - u32_height2_RGB = pPlaneOut->u_height >> 1; - /* Get the memory jump corresponding to a row jump */ - u32_stride_out = pPlaneOut->u_stride >> 1; - u32_stride2_out = pPlaneOut->u_stride >> 2; - - for(u32_plane = 0; u32_plane < PLANES; u32_plane++) - { - /* Set the working pointers at the beginning of the input/output data field */ - pu8_data_in[u32_plane] = pPlaneIn[u32_plane].pac_data + pPlaneIn[u32_plane].u_topleft; - - /* Get the memory jump corresponding to a row jump */ - u32_stride_in[u32_plane] = pPlaneIn[u32_plane].u_stride; - - /* Set the bounds of the active image */ - u32_width_in[u32_plane] = pPlaneIn[u32_plane].u_width; - u32_height_in[u32_plane] = pPlaneIn[u32_plane].u_height; - } - /* Compute horizontal ratio between src and destination width for Y Plane.*/ - if (u32_width_out >= u32_width_in[YPlane]) - { - u32_x_inc[YPlane] = ((u32_width_in[YPlane]-1) * MAX_SHORT) / (u32_width_out-1); - } - else - { - u32_x_inc[YPlane] = (u32_width_in[YPlane] * MAX_SHORT) / (u32_width_out); - } - - /* Compute vertical ratio between src and destination height for Y Plane.*/ - if (u32_height_out >= u32_height_in[YPlane]) - { - u32_y_inc[YPlane] = ((u32_height_in[YPlane]-1) * MAX_SHORT) / (u32_height_out-1); - } - else - { - u32_y_inc[YPlane] = (u32_height_in[YPlane] * MAX_SHORT) / (u32_height_out); - } - - /* Compute horizontal ratio between src and destination width for U and V Planes.*/ - if (u32_width2_RGB >= u32_width_in[UPlane]) - { - u32_x_inc[UPlane] = ((u32_width_in[UPlane]-1) * MAX_SHORT) / (u32_width2_RGB-1); - } - else - { - u32_x_inc[UPlane] = (u32_width_in[UPlane] * MAX_SHORT) / (u32_width2_RGB); - } - - /* Compute vertical ratio between src and destination height for U and V Planes.*/ - - if (u32_height2_RGB >= u32_height_in[UPlane]) - { - u32_y_inc[UPlane] = ((u32_height_in[UPlane]-1) * MAX_SHORT) / (u32_height2_RGB-1); - } - else - { - u32_y_inc[UPlane] = (u32_height_in[UPlane] * MAX_SHORT) / (u32_height2_RGB); - } - - u32_y_inc[VPlane] = u32_y_inc[UPlane]; - u32_x_inc[VPlane] = u32_x_inc[UPlane]; - - /* - Calculate initial accumulator value : u32_y_accum_start. - u32_y_accum_start is coded on 15 bits, and represents a value between 0 and 0.5 - */ - if (u32_y_inc[YPlane] > MAX_SHORT) - { - /* - Keep the fractionnal part, assimung that integer part is coded on the 16 high bits, - and the fractionnal on the 15 low bits - */ - u32_y_accum_Y = u32_y_inc[YPlane] & 0xffff; - u32_y_accum_U = u32_y_inc[UPlane] & 0xffff; - - if (!u32_y_accum_Y) - { - u32_y_accum_Y = MAX_SHORT; - u32_y_accum_U = MAX_SHORT; - } - u32_y_accum_Y >>= 1; - u32_y_accum_U >>= 1; - } - else - { - u32_y_accum_Y = 0; - u32_y_accum_U = 0; - - } - - /* - Calculate initial accumulator value : u32_x_accum_start. - u32_x_accum_start is coded on 15 bits, and represents a value between 0 and 0.5 - */ - if (u32_x_inc[YPlane] > MAX_SHORT) - { - u32_x_accum_start = u32_x_inc[YPlane] & 0xffff; - - if (!u32_x_accum_start) - { - u32_x_accum_start = MAX_SHORT; - } - - u32_x_accum_start >>= 1; - } - else - { - u32_x_accum_start = 0; - } - /* Intialise the RGB pointer */ - pu32_rgb_data_start = (M4VIFI_UInt32*)pu8_data_out; - - /* - Bilinear interpolation linearly interpolates along each row, and then uses that - result in a linear interpolation donw each column. Each estimated pixel in the - output image is a weighted combination of its four neighbours according to the formula : - F(p',q')=f(p,q)R(-a)R(b)+f(p,q-1)R(-a)R(b-1)+f(p+1,q)R(1-a)R(b)+f(p+&,q+1)R(1-a)R(b-1) - with R(x) = / x+1 -1 =< x =< 0 \ 1-x 0 =< x =< 1 and a (resp. b) weighting coefficient - is the distance from the nearest neighbor in the p (resp. q) direction - */ - for (u32_row = u32_height_out; u32_row != 0; u32_row -= 2) - { - u32_x_accum_Y = u32_x_accum_start; - u32_x_accum_U = u32_x_accum_start; - - /* Vertical weight factor */ - u32_y_frac_Y = (u32_y_accum_Y >> 12) & 15; - u32_y_frac_U = (u32_y_accum_U >> 12) & 15; - - /* RGB current line Position Pointer */ - pu32_rgb_data_current = pu32_rgb_data_start ; - - /* RGB next line position pointer */ - pu32_rgb_data_next = pu32_rgb_data_current + (u32_stride2_out); - - /* Y Plane next row pointer */ - pu8_data_in1[YPlane] = pu8_data_in[YPlane]; - - u32_rgb_temp3 = u32_y_accum_Y + (u32_y_inc[YPlane]); - if (u32_rgb_temp3 >> 16) - { - pu8_data_in1[YPlane] = pu8_data_in[YPlane] + - (u32_rgb_temp3 >> 16) * (u32_stride_in[YPlane]); - u32_rgb_temp3 &= 0xffff; - } - u32_rgb_temp4 = (u32_rgb_temp3 >> 12) & 15; - - for (u32_col = u32_width_out; u32_col != 0; u32_col -= 2) - { - - /* Input Y plane elements */ - pu8_src_top_Y = pu8_data_in[YPlane] + (u32_x_accum_Y >> 16); - pu8_src_bottom_Y = pu8_src_top_Y + u32_stride_in[YPlane]; - - /* Input U Plane elements */ - pu8_src_top_U = pu8_data_in[UPlane] + (u32_x_accum_U >> 16); - pu8_src_bottom_U = pu8_src_top_U + u32_stride_in[UPlane]; - - pu8_src_top_V = pu8_data_in[VPlane] + (u32_x_accum_U >> 16); - pu8_src_bottom_V = pu8_src_top_V + u32_stride_in[VPlane]; - - /* Horizontal weight factor for Y Plane */ - u32_x_frac_Y = (u32_x_accum_Y >> 12)&15; - /* Horizontal weight factor for U and V Planes */ - u32_x_frac_U = (u32_x_accum_U >> 12)&15; - - /* Weighted combination */ - U_32 = (((pu8_src_top_U[0]*(16-u32_x_frac_U) + pu8_src_top_U[1]*u32_x_frac_U) - *(16-u32_y_frac_U) + (pu8_src_bottom_U[0]*(16-u32_x_frac_U) - + pu8_src_bottom_U[1]*u32_x_frac_U)*u32_y_frac_U ) >> 8); - - V_32 = (((pu8_src_top_V[0]*(16-u32_x_frac_U) + pu8_src_top_V[1]*u32_x_frac_U) - *(16-u32_y_frac_U) + (pu8_src_bottom_V[0]*(16-u32_x_frac_U) - + pu8_src_bottom_V[1]*u32_x_frac_U)*u32_y_frac_U ) >> 8); - - Y_32 = (((pu8_src_top_Y[0]*(16-u32_x_frac_Y) + pu8_src_top_Y[1]*u32_x_frac_Y) - *(16-u32_y_frac_Y) + (pu8_src_bottom_Y[0]*(16-u32_x_frac_Y) - + pu8_src_bottom_Y[1]*u32_x_frac_Y)*u32_y_frac_Y ) >> 8); - - u32_x_accum_U += (u32_x_inc[UPlane]); - - /* YUV to RGB */ - #ifdef __RGB_V1__ - Yval_32 = Y_32*37; - #else /* __RGB_V1__v */ - Yval_32 = Y_32*0x2568; - #endif /* __RGB_V1__v */ - - DEMATRIX(u8_Red,u8_Green,u8_Blue,Yval_32,U_32,V_32); - - /* Pack 8 bit R,G,B to RGB565 */ - #ifdef LITTLE_ENDIAN - u32_rgb_temp1 = PACK_RGB565(0,u8_Red,u8_Green,u8_Blue); - #else /* LITTLE_ENDIAN */ - u32_rgb_temp1 = PACK_RGB565(16,u8_Red,u8_Green,u8_Blue); - #endif /* LITTLE_ENDIAN */ - - - pu8_src_top_Y = pu8_data_in1[YPlane]+(u32_x_accum_Y >> 16); - pu8_src_bottom_Y = pu8_src_top_Y + u32_stride_in[YPlane]; - - /* Weighted combination */ - Y_32 = (((pu8_src_top_Y[0]*(16-u32_x_frac_Y) + pu8_src_top_Y[1]*u32_x_frac_Y) - *(16-u32_rgb_temp4) + (pu8_src_bottom_Y[0]*(16-u32_x_frac_Y) - + pu8_src_bottom_Y[1]*u32_x_frac_Y)*u32_rgb_temp4 ) >> 8); - - u32_x_accum_Y += u32_x_inc[YPlane]; - /* Horizontal weight factor */ - u32_x_frac_Y = (u32_x_accum_Y >> 12)&15; - /* YUV to RGB */ - #ifdef __RGB_V1__ - Yval_32 = Y_32*37; - #else /* __RGB_V1__v */ - Yval_32 = Y_32*0x2568; - #endif /* __RGB_V1__v */ - - DEMATRIX(u8_Red,u8_Green,u8_Blue,Yval_32,U_32,V_32); - - /* Pack 8 bit R,G,B to RGB565 */ - #ifdef LITTLE_ENDIAN - u32_rgb_temp2 = PACK_RGB565(0,u8_Red,u8_Green,u8_Blue); - #else /* LITTLE_ENDIAN */ - u32_rgb_temp2 = PACK_RGB565(16,u8_Red,u8_Green,u8_Blue); - #endif /* LITTLE_ENDIAN */ - - - pu8_src_top_Y = pu8_data_in[YPlane] + (u32_x_accum_Y >> 16) ; - pu8_src_bottom_Y = pu8_src_top_Y + u32_stride_in[YPlane]; - - /* Weighted combination */ - Y_32 = (((pu8_src_top_Y[0]*(16-u32_x_frac_Y) + pu8_src_top_Y[1]*u32_x_frac_Y) - *(16-u32_y_frac_Y) + (pu8_src_bottom_Y[0]*(16-u32_x_frac_Y) - + pu8_src_bottom_Y[1]*u32_x_frac_Y)*u32_y_frac_Y ) >> 8); - /* YUV to RGB */ - #ifdef __RGB_V1__ - Yval_32 = Y_32*37; - #else /* __RGB_V1__v */ - Yval_32 = Y_32*0x2568; - #endif /* __RGB_V1__v */ - - DEMATRIX(u8_Red,u8_Green,u8_Blue,Yval_32,U_32,V_32); - - /* Pack 8 bit R,G,B to RGB565 */ - #ifdef LITTLE_ENDIAN - *(pu32_rgb_data_current)++ = u32_rgb_temp1 | - PACK_RGB565(16,u8_Red,u8_Green,u8_Blue); - #else /* LITTLE_ENDIAN */ - *(pu32_rgb_data_current)++ = u32_rgb_temp1 | - PACK_RGB565(0,u8_Red,u8_Green,u8_Blue); - #endif /* LITTLE_ENDIAN */ - - - pu8_src_top_Y = pu8_data_in1[YPlane]+ (u32_x_accum_Y >> 16); - pu8_src_bottom_Y = pu8_src_top_Y + u32_stride_in[YPlane]; - - /* Weighted combination */ - Y_32 = (((pu8_src_top_Y[0]*(16-u32_x_frac_Y) + pu8_src_top_Y[1]*u32_x_frac_Y) - *(16-u32_rgb_temp4) + (pu8_src_bottom_Y[0]*(16-u32_x_frac_Y) - + pu8_src_bottom_Y[1]*u32_x_frac_Y)*u32_rgb_temp4 )>>8); - - u32_x_accum_Y += u32_x_inc[YPlane]; - /* YUV to RGB */ - #ifdef __RGB_V1__ - Yval_32=Y_32*37; - #else /* __RGB_V1__v */ - Yval_32=Y_32*0x2568; - #endif /* __RGB_V1__v */ - - DEMATRIX(u8_Red,u8_Green,u8_Blue,Yval_32,U_32,V_32); - - /* Pack 8 bit R,G,B to RGB565 */ - #ifdef LITTLE_ENDIAN - *(pu32_rgb_data_next)++ = u32_rgb_temp2 | - PACK_RGB565(16,u8_Red,u8_Green,u8_Blue); - #else /* LITTLE_ENDIAN */ - *(pu32_rgb_data_next)++ = u32_rgb_temp2 | - PACK_RGB565(0,u8_Red,u8_Green,u8_Blue); - #endif /* LITTLE_ENDIAN */ - - } /* End of horizontal scanning */ - - u32_y_accum_Y = u32_rgb_temp3 + (u32_y_inc[YPlane]); - u32_y_accum_U += (u32_y_inc[UPlane]); - - /* Y plane row update */ - if (u32_y_accum_Y >> 16) - { - pu8_data_in[YPlane] = pu8_data_in1[YPlane] + - ((u32_y_accum_Y >> 16) * (u32_stride_in[YPlane])); - u32_y_accum_Y &= 0xffff; - } - else - { - pu8_data_in[YPlane] = pu8_data_in1[YPlane]; - } - /* U and V planes row update */ - if (u32_y_accum_U >> 16) - { - pu8_data_in[UPlane] = pu8_data_in[UPlane] + - (u32_y_accum_U >> 16) * (u32_stride_in[UPlane]); - pu8_data_in[VPlane] = pu8_data_in[VPlane] + - (u32_y_accum_U >> 16) * (u32_stride_in[VPlane]); - u32_y_accum_U &= 0xffff; - } - - pu32_rgb_data_start += u32_stride_out; - - } /* End of vertical scanning */ - return M4VIFI_OK; -} - diff --git a/libvideoeditor/vss/video_filters/src/MODULE_LICENSE_APACHE2 b/libvideoeditor/vss/video_filters/src/MODULE_LICENSE_APACHE2 deleted file mode 100644 index e69de29..0000000 --- a/libvideoeditor/vss/video_filters/src/MODULE_LICENSE_APACHE2 +++ /dev/null diff --git a/libvideoeditor/vss/video_filters/src/NOTICE b/libvideoeditor/vss/video_filters/src/NOTICE deleted file mode 100644 index c5b1efa..0000000 --- a/libvideoeditor/vss/video_filters/src/NOTICE +++ /dev/null @@ -1,190 +0,0 @@ - - Copyright (c) 2005-2008, The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - |