liboilfuncs-copy

## liboilfuncs-copy liboilfuncs-copy |

## Synopsis

    void                oil_compare_u8                      (uint32_t *d_1,
                                                             const uint8_t *s1,
                                                             const uint8_t *s2,
                                                             int n);
    void                oil_copy_u8                         (uint8_t *dest,
                                                             const uint8_t *src,
                                                             int n);
    void                oil_permute_f32                     (float *dest,
                                                             int dstr,
                                                             const float *src1,
                                                             int sstr1,
                                                             const int32_t *src2,
                                                             int sstr2,
                                                             int n);
    void                oil_permute_f64                     (double *dest,
                                                             int dstr,
                                                             const double *src1,
                                                             int sstr1,
                                                             const int32_t *src2,
                                                             int sstr2,
                                                             int n);
    void                oil_permute_s16                     (int16_t *dest,
                                                             int dstr,
                                                             const int16_t *src1,
                                                             int sstr1,
                                                             const int32_t *src2,
                                                             int sstr2,
                                                             int n);
    void                oil_permute_s32                     (int32_t *dest,
                                                             int dstr,
                                                             const int32_t *src1,
                                                             int sstr1,
                                                             const int32_t *src2,
                                                             int sstr2,
                                                             int n);
    void                oil_permute_s8                      (int8_t *dest,
                                                             int dstr,
                                                             const int8_t *src1,
                                                             int sstr1,
                                                             const int32_t *src2,
                                                             int sstr2,
                                                             int n);
    void                oil_permute_u16                     (uint16_t *dest,
                                                             int dstr,
                                                             const uint16_t *src1,
                                                             int sstr1,
                                                             const int32_t *src2,
                                                             int sstr2,
                                                             int n);
    void                oil_permute_u32                     (uint32_t *dest,
                                                             int dstr,
                                                             const uint32_t *src1,
                                                             int sstr1,
                                                             const int32_t *src2,
                                                             int sstr2,
                                                             int n);
    void                oil_permute_u8                      (uint8_t *dest,
                                                             int dstr,
                                                             const uint8_t *src1,
                                                             int sstr1,
                                                             const int32_t *src2,
                                                             int sstr2,
                                                             int n);
    void                oil_splat_u32                       (uint32_t *dest,
                                                             int dstr,
                                                             const uint32_t *s1_1,
                                                             int n);
    void                oil_splat_u8                        (uint8_t *dest,
                                                             int dstr,
                                                             const uint8_t *s1_1,
                                                             int n);
    void                oil_swab_u16                        (uint16_t *d_n,
                                                             const uint16_t *s_n,
                                                             int n);
    void                oil_swab_u32                        (uint32_t *d_n,
                                                             const uint32_t *s_n,
                                                             int n);
    void                oil_tablelookup_u8                  (uint8_t *d,
                                                             int ds,
                                                             const uint8_t *s1,
                                                             int ss1,
                                                             const uint8_t *s2_256,
                                                             int ss2,
                                                             int n);
    void                oil_testzero_u8                     (uint32_t *d_1,
                                                             const uint8_t *s,
                                                             int n);
    void                oil_trans8x8_f64                    (double *d_8x8,
                                                             int ds,
                                                             const double *s_8x8,
                                                             int ss);
    void                oil_trans8x8_u16                    (uint16_t *d_8x8,
                                                             int ds,
                                                             const uint16_t *s_8x8,
                                                             int ss);
    void                oil_trans8x8_u32                    (uint32_t *d_8x8,
                                                             int ds,
                                                             const uint32_t *s_8x8,
                                                             int ss);
    void                oil_trans8x8_u8                     (uint8_t *d_8x8,
                                                             int ds,
                                                             const uint8_t *s_8x8,
                                                             int ss);
    void                oil_unzigzag8x8_s16                 (int16_t *d_8x8,
                                                             int ds,
                                                             const int16_t *s_8x8,
                                                             int ss);
    void                oil_zigzag8x8_s16                   (int16_t *d_8x8,
                                                             int ds,
                                                             const int16_t *s_8x8,
                                                             int ss);
    void                oil_splat_u32_ns                    (uint32_t *dest,
                                                             const uint32_t *s1_1,
                                                             int n);
    void                oil_splat_u8_ns                     (uint8_t *dest,
                                                             const uint8_t *s1_1,
                                                             int n);
    #define             oil_trans8x8_s16                    (dest, dstr, src, sstr)
    #define             oil_memcpy                          (dest,src,n_bytes)

## Description

## Details

### oil_compare_u8 ()

    void                oil_compare_u8                      (uint32_t *d_1,
                                                             const uint8_t *s1,
                                                             const uint8_t *s2,
                                                             int n);

Compares two arrays. The index of the first two elements that are unequal is written into dest. If all elements are equal, `n` is written into dest.

`d_1` : | destination array
`s1` : | source array
`s2` : | source array
`n` : | number of elements

### oil_copy_u8 ()

    void                oil_copy_u8                         (uint8_t *dest,
                                                             const uint8_t *src,
                                                             int n);

Copies from source to destination.

`dest` : | destination array
`src` : | source array
`n` : | number of elements

### oil_permute_f32 ()

    void                oil_permute_f32                     (float *dest,
                                                             int dstr,
                                                             const float *src1,
                                                             int sstr1,
                                                             const int32_t *src2,
                                                             int sstr2,
                                                             int n);

Copies elements in `src1` to `dest`, permuting them by `src2`. That is, `dest`[i] is set to `src1`[`src2`[i]]. Values in `src2` must be non-negative and less than `n`.

`dest` : |
`dstr` : |
`src1` : |
`sstr1` : |
`src2` : |
`sstr2` : |
`n` : |

### oil_permute_f64 ()

    void                oil_permute_f64                     (double *dest,
                                                             int dstr,
                                                             const double *src1,
                                                             int sstr1,
                                                             const int32_t *src2,
                                                             int sstr2,
                                                             int n);

Copies elements in `src1` to `dest`, permuting them by `src2`. That is, `dest`[i] is set to `src1`[`src2`[i]]. Values in `src2` must be non-negative and less than `n`.

`dest` : |
`dstr` : |
`src1` : |
`sstr1` : |
`src2` : |
`sstr2` : |
`n` : |

### oil_permute_s16 ()

    void                oil_permute_s16                     (int16_t *dest,
                                                             int dstr,
                                                             const int16_t *src1,
                                                             int sstr1,
                                                             const int32_t *src2,
                                                             int sstr2,
                                                             int n);

Copies elements in `src1` to `dest`, permuting them by `src2`. That is, `dest`[i] is set to `src1`[`src2`[i]]. Values in `src2` must be non-negative and less than `n`.

`dest` : |
`dstr` : |
`src1` : |
`sstr1` : |
`src2` : |
`sstr2` : |
`n` : |

### oil_permute_s32 ()

    void                oil_permute_s32                     (int32_t *dest,
                                                             int dstr,
                                                             const int32_t *src1,
                                                             int sstr1,
                                                             const int32_t *src2,
                                                             int sstr2,
                                                             int n);

Copies elements in `src1` to `dest`, permuting them by `src2`. That is, `dest`[i] is set to `src1`[`src2`[i]]. Values in `src2` must be non-negative and less than `n`.

`dest` : |
`dstr` : |
`src1` : |
`sstr1` : |
`src2` : |
`sstr2` : |
`n` : |

### oil_permute_s8 ()

    void                oil_permute_s8                      (int8_t *dest,
                                                             int dstr,
                                                             const int8_t *src1,
                                                             int sstr1,
                                                             const int32_t *src2,
                                                             int sstr2,
                                                             int n);

Copies elements in `src1` to `dest`, permuting them by `src2`. That is, `dest`[i] is set to `src1`[`src2`[i]]. Values in `src2` must be non-negative and less than `n`.

`dest` : |
`dstr` : |
`src1` : |
`sstr1` : |
`src2` : |
`sstr2` : |
`n` : |

### oil_permute_u16 ()

    void                oil_permute_u16                     (uint16_t *dest,
                                                             int dstr,
                                                             const uint16_t *src1,
                                                             int sstr1,
                                                             const int32_t *src2,
                                                             int sstr2,
                                                             int n);

Copies elements in `src1` to `dest`, permuting them by `src2`. That is, `dest`[i] is set to `src1`[`src2`[i]]. Values in `src2` must be non-negative and less than `n`.

`dest` : |
`dstr` : |
`src1` : |
`sstr1` : |
`src2` : |
`sstr2` : |
`n` : |

### oil_permute_u32 ()

    void                oil_permute_u32                     (uint32_t *dest,
                                                             int dstr,
                                                             const uint32_t *src1,
                                                             int sstr1,
                                                             const int32_t *src2,
                                                             int sstr2,
                                                             int n);

Copies elements in `src1` to `dest`, permuting them by `src2`. That is, `dest`[i] is set to `src1`[`src2`[i]]. Values in `src2` must be non-negative and less than `n`.

`dest` : |
`dstr` : |
`src1` : |
`sstr1` : |
`src2` : |
`sstr2` : |
`n` : |

### oil_permute_u8 ()

    void                oil_permute_u8                      (uint8_t *dest,
                                                             int dstr,
                                                             const uint8_t *src1,
                                                             int sstr1,
                                                             const int32_t *src2,
                                                             int sstr2,
                                                             int n);

Copies elements in `src1` to `dest`, permuting them by `src2`. That is, `dest`[i] is set to `src1`[`src2`[i]]. Values in `src2` must be non-negative and less than `n`.

`dest` : |
`dstr` : |
`src1` : |
`sstr1` : |
`src2` : |
`sstr2` : |
`n` : |

### oil_splat_u32 ()

    void                oil_splat_u32                       (uint32_t *dest,
                                                             int dstr,
                                                             const uint32_t *s1_1,
                                                             int n);

Copies the constant source value `s1_1` to each element in `dest`.

`dest` : |
`dstr` : |
`s1_1` : |
`n` : |

### oil_splat_u8 ()

    void                oil_splat_u8                        (uint8_t *dest,
                                                             int dstr,
                                                             const uint8_t *s1_1,
                                                             int n);

Copies the constant source value `s1_1` to each element in `dest`.

`dest` : |
`dstr` : |
`s1_1` : |
`n` : |

### oil_swab_u16 ()

    void                oil_swab_u16                        (uint16_t *d_n,
                                                             const uint16_t *s_n,
                                                             int n);

Swaps the endianness of values in the source array and places the results in the destination array. The arguments `s_n` and `d_n` may be equal.

`d_n` : |
`s_n` : | n:
`n` : |

### oil_swab_u32 ()

    void                oil_swab_u32                        (uint32_t *d_n,
                                                             const uint32_t *s_n,
                                                             int n);

Swaps the endianness of values in the source array and places the results in the destination array. The arguments `s_n` and `d_n` may be equal.

`d_n` : |
`s_n` : | n:
`n` : |

### oil_tablelookup_u8 ()

    void                oil_tablelookup_u8                  (uint8_t *d,
                                                             int ds,
                                                             const uint8_t *s1,
                                                             int ss1,
                                                             const uint8_t *s2_256,
                                                             int ss2,
                                                             int n);

Looks up each element in `s1` using the lookup table in `s2_256`, and places the table value in `d`.

`d` : |
`ds` : |
`s1` : |
`ss1` : |
`s2_256` : |
`ss2` : |
`n` : |

### oil_testzero_u8 ()

    void                oil_testzero_u8                     (uint32_t *d_1,
                                                             const uint8_t *s,
                                                             int n);

Tests each element in the source array for equality with 0. The index of the first zero element is written into dest. If all elements are non-zero, `n` is written into dest.

This function is roughly equivalent to `strnlen()`. One notable difference is that implementations of this function may legally read past the zero byte.

`d_1` : | destination array
`s` : | source array
`n` : | number of elements

### oil_trans8x8_f64 ()

    void                oil_trans8x8_f64                    (double *d_8x8,
                                                             int ds,
                                                             const double *s_8x8,
                                                             int ss);

Performs a matrix transpose the 8x8 block represented by `s_8x8` and places the result in `d_8x8`.

`d_8x8` : |
`ds` : |
`s_8x8` : |
`ss` : |

### oil_trans8x8_u16 ()

    void                oil_trans8x8_u16                    (uint16_t *d_8x8,
                                                             int ds,
                                                             const uint16_t *s_8x8,
                                                             int ss);

Performs a matrix transpose the 8x8 block represented by `s_8x8` and places the result in `d_8x8`. Note that this function can also be used for any type of this size.

`d_8x8` : |
`ds` : |
`s_8x8` : |
`ss` : |

### oil_trans8x8_u32 ()

    void                oil_trans8x8_u32                    (uint32_t *d_8x8,
                                                             int ds,
                                                             const uint32_t *s_8x8,
                                                             int ss);

Performs a matrix transpose the 8x8 block represented by `s_8x8` and places the result in `d_8x8`. Note that this function can also be used for any type of this size.

`d_8x8` : |
`ds` : |
`s_8x8` : |
`ss` : |

### oil_trans8x8_u8 ()

    void                oil_trans8x8_u8                     (uint8_t *d_8x8,
                                                             int ds,
                                                             const uint8_t *s_8x8,
                                                             int ss);

Performs a matrix transpose the 8x8 block represented by `s_8x8` and places the result in `d_8x8`. Note that this function can also be used for any type of this size.

`d_8x8` : |
`ds` : |
`s_8x8` : |
`ss` : |

### oil_unzigzag8x8_s16 ()

    void                oil_unzigzag8x8_s16                 (int16_t *d_8x8,
                                                             int ds,
                                                             const int16_t *s_8x8,
                                                             int ss);

Reorders an 8x8 block to reverse the zig-zag reordering of `oil_zigzag8x8_s16`.

`d_8x8` : |
`ds` : |
`s_8x8` : |
`ss` : |

### oil_zigzag8x8_s16 ()

    void                oil_zigzag8x8_s16                   (int16_t *d_8x8,
                                                             int ds,
                                                             const int16_t *s_8x8,
                                                             int ss);

Reorders an 8x8 block using a zig-zag pattern. The zig-zag pattern is described in the JPEG specification.

FIXME: describe zigzag pattern

`d_8x8` : |
`ds` : |
`s_8x8` : |
`ss` : |

### oil_splat_u32_ns ()

    void                oil_splat_u32_ns                    (uint32_t *dest,
                                                             const uint32_t *s1_1,
                                                             int n);

Copies the constant source value `s1_1` to each element in `dest`.

`dest` : |
`s1_1` : |
`n` : |

### oil_splat_u8_ns ()

    void                oil_splat_u8_ns                     (uint8_t *dest,
                                                             const uint8_t *s1_1,
                                                             int n);

Copies the constant source value `s1_1` to each element in `dest`.

`dest` : |
`s1_1` : |
`n` : |

### oil_trans8x8_s16()

    #define             oil_trans8x8_s16(dest, dstr, src, sstr)

Macro wrapping `trans8x8_u16()`.

`dest` : |
`dstr` : |
`src` : |
`sstr` : |

### oil_memcpy()

    #define             oil_memcpy(dest,src,n_bytes)

Macro that uses `oil_copy_u8()` to provide an implementation of `memcpy()`. Note that `oil_copy_u8()` is optimized for short copies, and may be very slow for large copies compared to alternatives, including the system `memcpy()`.

`dest` : |
`src` : |
`n_bytes` : |