view release on metacpan or search on metacpan
src/Source/FreeImageToolkit/Background.cpp view on Meta::CPAN
the color arguments is a null pointer.
*/
static BOOL
GetAlphaBlendedColor(const RGBQUAD *bgcolor, const RGBQUAD *fgcolor, RGBQUAD *blended) {
if ((!bgcolor) || (!fgcolor) || (!blended)) {
return FALSE;
}
BYTE alpha = fgcolor->rgbReserved;
BYTE not_alpha = ~alpha;
blended->rgbRed = (BYTE)( ((WORD)fgcolor->rgbRed * alpha + not_alpha * (WORD)bgcolor->rgbRed) >> 8 );
blended->rgbGreen = (BYTE)( ((WORD)fgcolor->rgbGreen * alpha + not_alpha * (WORD)bgcolor->rgbGreen) >> 8) ;
blended->rgbBlue = (BYTE)( ((WORD)fgcolor->rgbRed * alpha + not_alpha * (WORD)bgcolor->rgbBlue) >> 8 );
blended->rgbReserved = 0xFF;
return TRUE;
}
/** @brief Fills a FIT_BITMAP image with the specified color.
This function does the dirty work for FreeImage_FillBackground for FIT_BITMAP
images.
@param dib The image to be filled.
src/Source/FreeImageToolkit/Display.cpp view on Meta::CPAN
int bg_height = FreeImage_GetHeight(bg);
int bg_bpp = FreeImage_GetBPP(bg);
if((bg_width != width) || (bg_height != height) || (bg_bpp != 24))
return NULL;
}
int bytespp = (bpp == 8) ? 1 : 4;
int x, y, c;
BYTE alpha = 0, not_alpha;
BYTE index;
RGBQUAD fgc; // foreground color
RGBQUAD bkc; // background color
memset(&fgc, 0, sizeof(RGBQUAD));
memset(&bkc, 0, sizeof(RGBQUAD));
// allocate the composite image
FIBITMAP *composite = FreeImage_Allocate(width, height, 24, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
if(!composite) return NULL;
src/Source/FreeImageToolkit/Display.cpp view on Meta::CPAN
cp_bits[FI_RGBA_RED] = bkc.rgbRed;
}
else if(alpha == 255) {
// output = foreground
cp_bits[FI_RGBA_BLUE] = fgc.rgbBlue;
cp_bits[FI_RGBA_GREEN] = fgc.rgbGreen;
cp_bits[FI_RGBA_RED] = fgc.rgbRed;
}
else {
// output = alpha * foreground + (1-alpha) * background
not_alpha = (BYTE)~alpha;
cp_bits[FI_RGBA_BLUE] = (BYTE)((alpha * (WORD)fgc.rgbBlue + not_alpha * (WORD)bkc.rgbBlue) >> 8);
cp_bits[FI_RGBA_GREEN] = (BYTE)((alpha * (WORD)fgc.rgbGreen + not_alpha * (WORD)bkc.rgbGreen) >> 8);
cp_bits[FI_RGBA_RED] = (BYTE)((alpha * (WORD)fgc.rgbRed + not_alpha * (WORD)bkc.rgbRed) >> 8);
}
fg_bits += bytespp;
bg_bits += 3;
cp_bits += 3;
}
}
// copy metadata from src to dst
FreeImage_CloneMetadata(composite, fg);
src/Source/LibJXR/common/include/wmspecstring.h view on Meta::CPAN
#define __transfer(formal) __post __inner_transfer(formal)
#define __rpc_entry __inner_control_entrypoint(RPC)
#define __kernel_entry __inner_control_entrypoint(UserToKernel)
#define __gdi_entry __inner_control_entrypoint(GDI)
#define __encoded_pointer __inner_encoded
#define __encoded_array __inner_encoded
#define __field_encoded_pointer __inner_encoded
#define __field_encoded_array __inner_encoded
#define __type_has_adt_prop(adt,prop) __$adt_prop(adt,prop)
#define __out_has_adt_prop(adt,prop) __post __$adt_add_prop(adt,prop)
#define __out_not_has_adt_prop(adt,prop) __post __$adt_remove_prop(adt,prop)
#define __out_transfer_adt_prop(arg) __post __$adt_transfer_prop(arg)
#define __out_has_type_adt_props(typ) __post __$adt_type_props(typ)
/* useful PFD related macros */
#define __possibly_notnulltermiated __post __$possibly_notnulltermiated
#if defined(_WINDOWS_)
/* Windows Internal */
#define __volatile __$volatile
#define __nonvolatile __$nonvolatile
src/Source/LibJXR/common/include/wmspecstrings_strict.h view on Meta::CPAN
* NOINLINE - do not inline this function during analysis overrides
* and default heuristics
*************************************************************************/
#define __analysis_hint(hint) __allowed(on_function)
/*************************************************************************
* Macros to encode abstract properties of values. Used by SALadt.h
*************************************************************************/
#define __type_has_adt_prop(adt,prop) __allowed(on_typdecl)
#define __out_has_adt_prop(adt,prop) __allowed(on_parameter)
#define __out_not_has_adt_prop(adt,prop) __allowed(on_parameter)
#define __out_transfer_adt_prop(arg) __allowed(on_parameter)
#define __out_has_type_adt_props(typ) __allowed(on_parameter)
#define __assume_ValidCompNameA(expr) __allowed(as_statement_with_arg(expr))
#define __assume_ValidCompNameW(expr) __allowed(as_statement_with_arg(expr))
/*************************************************************************
* Macros used by Prefast for Drivers
*
* __possibly_notnulltermiated :
*
src/Source/LibJXR/common/include/wmspecstrings_undef.h view on Meta::CPAN
#undef __out_ecount_full_opt
#undef __out_ecount_nz
#undef __out_ecount_nz_opt
#undef __out_ecount_opt
#undef __out_ecount_part
#undef __out_ecount_part_opt
#undef __out_ecount_z
#undef __out_ecount_z_opt
#undef __out_has_adt_prop
#undef __out_has_type_adt_props
#undef __out_not_has_adt_prop
#undef __out_nz
#undef __out_nz_opt
#undef __out_opt
#undef __out_range
#undef __out_transfer_adt_prop
#undef __out_validated
#undef __out_xcount
#undef __out_xcount_full
#undef __out_xcount_full_opt
#undef __out_xcount_opt
src/Source/LibOpenJPEG/openjpeg.h view on Meta::CPAN
Metadata from the JP2file
==========================================================
*/
/**
* Info structure of the JP2 file
* EXPERIMENTAL FOR THE MOMENT
*/
typedef struct opj_jp2_metadata {
/** */
OPJ_INT32 not_used;
} opj_jp2_metadata_t;
/**
* Index structure of the JP2 file
* EXPERIMENTAL FOR THE MOMENT
*/
typedef struct opj_jp2_index {
/** */
OPJ_INT32 not_used;
} opj_jp2_index_t;
#ifdef __cplusplus
extern "C" {
#endif
/*
src/Source/LibOpenJPEG/pi.c view on Meta::CPAN
* @param p_tileno the tile index being concerned.
* @param p_tx0 X0 parameter for the tile
* @param p_tx1 X1 parameter for the tile
* @param p_ty0 Y0 parameter for the tile
* @param p_ty1 Y1 parameter for the tile
* @param p_max_prec the maximum precision for all the bands of the tile
* @param p_max_res the maximum number of resolutions for all the poc inside the tile.
* @param p_dx_min the minimum dx of all the components of all the resolutions for the tile.
* @param p_dy_min the minimum dy of all the components of all the resolutions for the tile.
*/
static void opj_pi_update_encode_not_poc ( opj_cp_t *p_cp,
OPJ_UINT32 p_num_comps,
OPJ_UINT32 p_tileno,
OPJ_INT32 p_tx0,
OPJ_INT32 p_tx1,
OPJ_INT32 p_ty0,
OPJ_INT32 p_ty1,
OPJ_UINT32 p_max_prec,
OPJ_UINT32 p_max_res,
OPJ_UINT32 p_dx_min,
OPJ_UINT32 p_dy_min);
src/Source/LibOpenJPEG/pi.c view on Meta::CPAN
* @param p_image the image used to initialize the packet iterator (in fact only the number of components is relevant.
* @param p_cp the coding parameters.
* @param tileno the index of the tile from which creating the packet iterator.
*/
static opj_pi_iterator_t * opj_pi_create( const opj_image_t *p_image,
const opj_cp_t *p_cp,
OPJ_UINT32 tileno );
/**
* FIXME DOC
*/
static void opj_pi_update_decode_not_poc (opj_pi_iterator_t * p_pi,
opj_tcp_t * p_tcp,
OPJ_UINT32 p_max_precision,
OPJ_UINT32 p_max_res);
/**
* FIXME DOC
*/
static void opj_pi_update_decode_poc ( opj_pi_iterator_t * p_pi,
opj_tcp_t * p_tcp,
OPJ_UINT32 p_max_precision,
OPJ_UINT32 p_max_res);
src/Source/LibOpenJPEG/pi.c view on Meta::CPAN
l_current_poc->txS = (OPJ_UINT32)p_tx0;
l_current_poc->txE = (OPJ_UINT32)p_tx1;
l_current_poc->tyS = (OPJ_UINT32)p_ty0;
l_current_poc->tyE = (OPJ_UINT32)p_ty1;
l_current_poc->dx = p_dx_min;
l_current_poc->dy = p_dy_min;
++ l_current_poc;
}
}
void opj_pi_update_encode_not_poc ( opj_cp_t *p_cp,
OPJ_UINT32 p_num_comps,
OPJ_UINT32 p_tileno,
OPJ_INT32 p_tx0,
OPJ_INT32 p_tx1,
OPJ_INT32 p_ty0,
OPJ_INT32 p_ty1,
OPJ_UINT32 p_max_prec,
OPJ_UINT32 p_max_res,
OPJ_UINT32 p_dx_min,
OPJ_UINT32 p_dy_min)
src/Source/LibOpenJPEG/pi.c view on Meta::CPAN
l_current_pi->poc.precno0 = 0;
l_current_pi->poc.resno1 = l_current_poc->resno1; /* Resolution Level Index #0 (End) */
l_current_pi->poc.compno1 = l_current_poc->compno1; /* Component Index #0 (End) */
l_current_pi->poc.layno1 = l_current_poc->layno1; /* Layer Index #0 (End) */
l_current_pi->poc.precno1 = p_max_precision;
++l_current_pi;
++l_current_poc;
}
}
void opj_pi_update_decode_not_poc (opj_pi_iterator_t * p_pi,
opj_tcp_t * p_tcp,
OPJ_UINT32 p_max_precision,
OPJ_UINT32 p_max_res)
{
/* loop*/
OPJ_UINT32 pino;
/* encoding prameters to set*/
OPJ_UINT32 l_bound;
src/Source/LibOpenJPEG/pi.c view on Meta::CPAN
l_tmp_data = 00;
opj_free(l_tmp_ptr);
l_tmp_ptr = 00;
if
(l_tcp->POC)
{
opj_pi_update_decode_poc (l_pi,l_tcp,l_max_prec,l_max_res);
}
else
{
opj_pi_update_decode_not_poc(l_pi,l_tcp,l_max_prec,l_max_res);
}
return l_pi;
}
opj_pi_iterator_t *opj_pi_initialise_encode(const opj_image_t *p_image,
opj_cp_t *p_cp,
OPJ_UINT32 p_tile_no,
J2K_T2_MODE p_t2_mode )
src/Source/LibOpenJPEG/pi.c view on Meta::CPAN
opj_free(l_tmp_data);
l_tmp_data = 00;
opj_free(l_tmp_ptr);
l_tmp_ptr = 00;
if (l_tcp->POC && ( p_cp->m_specific_param.m_enc.m_cinema || p_t2_mode == FINAL_PASS)) {
opj_pi_update_encode_poc_and_final(p_cp,p_tile_no,l_tx0,l_tx1,l_ty0,l_ty1,l_max_prec,l_max_res,l_dx_min,l_dy_min);
}
else {
opj_pi_update_encode_not_poc(p_cp,p_image->numcomps,p_tile_no,l_tx0,l_tx1,l_ty0,l_ty1,l_max_prec,l_max_res,l_dx_min,l_dy_min);
}
return l_pi;
}
void opj_pi_create_encode( opj_pi_iterator_t *pi,
opj_cp_t *cp,
OPJ_UINT32 tileno,
OPJ_UINT32 pino,
OPJ_UINT32 tpnum,
src/Source/LibOpenJPEG/pi.c view on Meta::CPAN
l_tcp = &(p_cp->tcps[p_tile_no]);
/* get encoding parameters */
opj_get_encoding_parameters(p_image,p_cp,p_tile_no,&l_tx0,&l_tx1,&l_ty0,&l_ty1,&l_dx_min,&l_dy_min,&l_max_prec,&l_max_res);
if (l_tcp->POC) {
opj_pi_update_encode_poc_and_final(p_cp,p_tile_no,l_tx0,l_tx1,l_ty0,l_ty1,l_max_prec,l_max_res,l_dx_min,l_dy_min);
}
else {
opj_pi_update_encode_not_poc(p_cp,p_image->numcomps,p_tile_no,l_tx0,l_tx1,l_ty0,l_ty1,l_max_prec,l_max_res,l_dx_min,l_dy_min);
}
}
OPJ_BOOL opj_pi_next(opj_pi_iterator_t * pi) {
switch (pi->poc.prg) {
case OPJ_LRCP:
return opj_pi_next_lrcp(pi);
case OPJ_RLCP:
return opj_pi_next_rlcp(pi);
case OPJ_RPCL:
src/Source/LibPNG/png.c view on Meta::CPAN
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
#include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_6_16 Your_png_h_is_not_version_1_6_16;
/* Tells libpng that we have already handled the first "num_bytes" bytes
* of the PNG file signature. If the PNG data is embedded into another
* stream we can set num_bytes = 8 so that libpng will not attempt to read
* or write any of the magic bytes before it starts on the IHDR.
*/
#ifdef PNG_READ_SUPPORTED
void PNGAPI
png_set_sig_bytes(png_structrp png_ptr, int num_bytes)
src/Source/LibPNG/pngread.c view on Meta::CPAN
return format;
}
/* Is the given gamma significantly different from sRGB? The test is the same
* one used in pngrtran.c when deciding whether to do gamma correction. The
* arithmetic optimizes the division by using the fact that the inverse of the
* file sRGB gamma is 2.2
*/
static int
png_gamma_not_sRGB(png_fixed_point g)
{
if (g < PNG_FP_1)
{
/* An uninitialized gamma is assumed to be sRGB for the simplified API. */
if (g == 0)
return 0;
return png_gamma_significant((g * 11 + 2)/5 /* i.e. *2.2, rounded */);
}
src/Source/LibPNG/pngread.c view on Meta::CPAN
*/
#define PNG_DIV51(v8) (((v8) * 5 + 130) >> 8)
/* Utility functions to make particular color-maps */
static void
set_file_encoding(png_image_read_control *display)
{
png_fixed_point g = display->image->opaque->png_ptr->colorspace.gamma;
if (png_gamma_significant(g) != 0)
{
if (png_gamma_not_sRGB(g) != 0)
{
display->file_encoding = P_FILE;
display->gamma_to_linear = png_reciprocal(g);
}
else
display->file_encoding = P_sRGB;
}
else
src/Source/LibPNG/pngread.c view on Meta::CPAN
/* Ideally this code would use libpng to do the gamma correction,
* but if an input alpha channel is to be removed we will hit the
* libpng bug in gamma+compose+rgb-to-gray (the double gamma
* correction bug). Fix this by dropping the gamma correction in
* this case and doing it in the palette; this will result in
* duplicate palette entries, but that's better than the
* alternative of double gamma correction.
*/
if ((png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
png_ptr->num_trans > 0) &&
png_gamma_not_sRGB(png_ptr->colorspace.gamma) != 0)
{
cmap_entries = make_gray_file_colormap(display);
data_encoding = P_FILE;
}
else
cmap_entries = make_gray_colormap(display);
/* But if the input has alpha or transparency it must be removed
*/
src/Source/LibPNG/pngtest.c view on Meta::CPAN
main(void)
{
fprintf(STDERR,
" test ignored because libpng was not built with read support\n");
/* And skip this test */
return PNG_LIBPNG_VER < 10600 ? 0 : 77;
}
#endif
/* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_6_16 Your_png_h_is_not_version_1_6_16;
src/Source/LibRawLite/internal/libraw_x3f.cpp view on Meta::CPAN
#ifdef DCRAW_VERBOSE
printf("... DONE\n");
#endif
#ifdef DBG_PRNT
print_huffman_tree(HUF->tree.nodes, 0, 0);
#endif
huffman_decode(I, DE, bits);
}
static void x3f_load_huffman_not_compressed(x3f_info_t *I,
x3f_directory_entry_t *DE,
int bits,
int use_map_table,
int row_stride)
{
x3f_directory_entry_header_t *DEH = &DE->header;
x3f_image_data_t *ID = &DEH->data_subsection.image_data;
#ifdef DCRAW_VERBOSE
printf("Load huffman not compressed\n");
#endif
src/Source/LibRawLite/internal/libraw_x3f.cpp view on Meta::CPAN
default:
#ifdef DCRAW_VERBOSE
fprintf(stderr, "Unknown huffman image type\n");
#endif
break;
}
if (row_stride == 0)
return x3f_load_huffman_compressed(I, DE, bits, use_map_table);
else
return x3f_load_huffman_not_compressed(I, DE, bits, use_map_table, row_stride);
}
static void x3f_load_pixmap(x3f_info_t *I, x3f_directory_entry_t *DE)
{
x3f_load_image_verbatim(I, DE);
}
static void x3f_load_jpeg(x3f_info_t *I, x3f_directory_entry_t *DE)
{
x3f_load_image_verbatim(I, DE);
src/Source/LibWebP/src/dsp/dsp.argb_sse2.c view on Meta::CPAN
const uint8_t* b, int len, uint32_t* out) {
if (g == r + 1) { // RGBA input order. Need to swap R and B.
int i = 0;
const int len_max = len & ~3; // max length processed in main loop
const __m128i red_blue_mask = _mm_set1_epi32(0x00ff00ffu);
assert(b == r + 2);
assert(a == r + 3);
for (; i < len_max; i += 4) {
const __m128i A = _mm_loadu_si128((const __m128i*)(r + 4 * i));
const __m128i B = _mm_and_si128(A, red_blue_mask); // R 0 B 0
const __m128i C = _mm_andnot_si128(red_blue_mask, A); // 0 G 0 A
const __m128i D = _mm_shufflelo_epi16(B, _MM_SHUFFLE(2, 3, 0, 1));
const __m128i E = _mm_shufflehi_epi16(D, _MM_SHUFFLE(2, 3, 0, 1));
const __m128i F = _mm_or_si128(E, C);
_mm_storeu_si128((__m128i*)(out + i), F);
}
for (; i < len; ++i) {
out[i] = MakeARGB32(a[4 * i], r[4 * i], g[4 * i], b[4 * i]);
}
} else {
assert(g == b + 1);
src/Source/LibWebP/src/dsp/dsp.dec_sse2.c view on Meta::CPAN
#define FLIP_SIGN_BIT4(a, b, c, d) { \
FLIP_SIGN_BIT2(a, b); \
FLIP_SIGN_BIT2(c, d); \
}
// input/output is uint8_t
static WEBP_INLINE void GetNotHEV(const __m128i* const p1,
const __m128i* const p0,
const __m128i* const q0,
const __m128i* const q1,
int hev_thresh, __m128i* const not_hev) {
const __m128i zero = _mm_setzero_si128();
const __m128i t_1 = MM_ABS(*p1, *p0);
const __m128i t_2 = MM_ABS(*q1, *q0);
const __m128i h = _mm_set1_epi8(hev_thresh);
const __m128i t_3 = _mm_subs_epu8(t_1, h); // abs(p1 - p0) - hev_tresh
const __m128i t_4 = _mm_subs_epu8(t_2, h); // abs(q1 - q0) - hev_tresh
*not_hev = _mm_or_si128(t_3, t_4);
*not_hev = _mm_cmpeq_epi8(*not_hev, zero); // not_hev <= t1 && not_hev <= t2
}
// input pixels are int8_t
static WEBP_INLINE void GetBaseDelta(const __m128i* const p1,
const __m128i* const p0,
const __m128i* const q0,
const __m128i* const q1,
__m128i* const delta) {
// beware of addition order, for saturation!
const __m128i p1_q1 = _mm_subs_epi8(*p1, *q1); // p1 - q1
src/Source/LibWebP/src/dsp/dsp.dec_sse2.c view on Meta::CPAN
FLIP_SIGN_BIT2(*p0, *q0);
}
// Applies filter on 4 pixels (p1, p0, q0 and q1)
static WEBP_INLINE void DoFilter4(__m128i* const p1, __m128i* const p0,
__m128i* const q0, __m128i* const q1,
const __m128i* const mask, int hev_thresh) {
const __m128i sign_bit = _mm_set1_epi8(0x80);
const __m128i k64 = _mm_set1_epi8(0x40);
const __m128i zero = _mm_setzero_si128();
__m128i not_hev;
__m128i t1, t2, t3;
// compute hev mask
GetNotHEV(p1, p0, q0, q1, hev_thresh, ¬_hev);
// convert to signed values
FLIP_SIGN_BIT4(*p1, *p0, *q0, *q1);
t1 = _mm_subs_epi8(*p1, *q1); // p1 - q1
t1 = _mm_andnot_si128(not_hev, t1); // hev(p1 - q1)
t2 = _mm_subs_epi8(*q0, *p0); // q0 - p0
t1 = _mm_adds_epi8(t1, t2); // hev(p1 - q1) + 1 * (q0 - p0)
t1 = _mm_adds_epi8(t1, t2); // hev(p1 - q1) + 2 * (q0 - p0)
t1 = _mm_adds_epi8(t1, t2); // hev(p1 - q1) + 3 * (q0 - p0)
t1 = _mm_and_si128(t1, *mask); // mask filter values we don't care about
t2 = _mm_set1_epi8(3);
t3 = _mm_set1_epi8(4);
t2 = _mm_adds_epi8(t1, t2); // 3 * (q0 - p0) + (p1 - q1) + 3
t3 = _mm_adds_epi8(t1, t3); // 3 * (q0 - p0) + (p1 - q1) + 4
src/Source/LibWebP/src/dsp/dsp.dec_sse2.c view on Meta::CPAN
SignedShift8b(&t3); // (3 * (q0 - p0) + hev(p1 - q1) + 4) >> 3
*p0 = _mm_adds_epi8(*p0, t2); // p0 += t2
*q0 = _mm_subs_epi8(*q0, t3); // q0 -= t3
FLIP_SIGN_BIT2(*p0, *q0);
// this is equivalent to signed (a + 1) >> 1 calculation
t2 = _mm_add_epi8(t3, sign_bit);
t3 = _mm_avg_epu8(t2, zero);
t3 = _mm_sub_epi8(t3, k64);
t3 = _mm_and_si128(not_hev, t3); // if !hev
*q1 = _mm_subs_epi8(*q1, t3); // q1 -= t3
*p1 = _mm_adds_epi8(*p1, t3); // p1 += t3
FLIP_SIGN_BIT2(*p1, *q1);
}
// Applies filter on 6 pixels (p2, p1, p0, q0, q1 and q2)
static WEBP_INLINE void DoFilter6(__m128i* const p2, __m128i* const p1,
__m128i* const p0, __m128i* const q0,
__m128i* const q1, __m128i* const q2,
const __m128i* const mask, int hev_thresh) {
const __m128i zero = _mm_setzero_si128();
const __m128i sign_bit = _mm_set1_epi8(0x80);
__m128i a, not_hev;
// compute hev mask
GetNotHEV(p1, p0, q0, q1, hev_thresh, ¬_hev);
FLIP_SIGN_BIT4(*p1, *p0, *q0, *q1);
FLIP_SIGN_BIT2(*p2, *q2);
GetBaseDelta(p1, p0, q0, q1, &a);
{ // do simple filter on pixels with hev
const __m128i m = _mm_andnot_si128(not_hev, *mask);
const __m128i f = _mm_and_si128(a, m);
DoSimpleFilter(p0, q0, &f);
}
{ // do strong filter on pixels with not hev
const __m128i k9 = _mm_set1_epi16(0x0900);
const __m128i k63 = _mm_set1_epi16(63);
const __m128i m = _mm_and_si128(not_hev, *mask);
const __m128i f = _mm_and_si128(a, m);
const __m128i f_lo = _mm_unpacklo_epi8(zero, f);
const __m128i f_hi = _mm_unpackhi_epi8(zero, f);
const __m128i f9_lo = _mm_mulhi_epi16(f_lo, k9); // Filter (lo) * 9
const __m128i f9_hi = _mm_mulhi_epi16(f_hi, k9); // Filter (hi) * 9
const __m128i a2_lo = _mm_add_epi16(f9_lo, k63); // Filter * 9 + 63
const __m128i a2_hi = _mm_add_epi16(f9_hi, k63); // Filter * 9 + 63
src/Source/LibWebP/src/webp/encode.h view on Meta::CPAN
//------------------------------------------------------------------------------
// WebPPicture utils
// Convenience allocation / deallocation based on picture->width/height:
// Allocate y/u/v buffers as per colorspace/width/height specification.
// Note! This function will free the previous buffer if needed.
// Returns false in case of memory error.
WEBP_EXTERN(int) WebPPictureAlloc(WebPPicture* picture);
// Release the memory allocated by WebPPictureAlloc() or WebPPictureImport*().
// Note that this function does _not_ free the memory used by the 'picture'
// object itself.
// Besides memory (which is reclaimed) all other fields of 'picture' are
// preserved.
WEBP_EXTERN(void) WebPPictureFree(WebPPicture* picture);
// Copy the pixels of *src into *dst, using WebPPictureAlloc. Upon return, *dst
// will fully own the copied pixels (this is not a view). The 'dst' picture need
// not be initialized as its content is overwritten.
// Returns false in case of memory allocation error.
WEBP_EXTERN(int) WebPPictureCopy(const WebPPicture* src, WebPPicture* dst);