static gboolean kms_webrtc_data_session_bin_is_valid_sctp_stream_id (KmsWebRtcDataSessionBin * self, guint16 sctp_stream_id) { if ((sctp_stream_id == 65535) || (IS_EVEN (sctp_stream_id) && self->priv->dtls_client_mode) || (!IS_EVEN (sctp_stream_id) && !self->priv->dtls_client_mode)) { return FALSE; } else { return TRUE; } }
U_CAPI void U_EXPORT2 uiter_setUTF16BE(UCharIterator * iter, const char * s, int32_t length) { if (iter != NULL) { /* allow only even-length strings (the input length counts bytes) */ if (s != NULL && (length == -1 || (length >= 0 && IS_EVEN(length)))) { /* length/=2, except that >>=1 also works for -1 (-1/2==0, -1>>1==-1) */ length >>= 1; if (U_IS_BIG_ENDIAN && IS_POINTER_EVEN(s)) { /* big-endian machine and 2-aligned UTF-16BE string: use normal UChar iterator */ uiter_setString(iter, (const UChar *)s, length); return; } *iter = utf16BEIterator; iter->context = s; if (length >= 0) { iter->length = length; } else { iter->length = utf16BE_strlen(s); } iter->limit = iter->length; } else {
/** ******************************************************************************************** * 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; }