Cleanup: ImBuf: remove various unused functions

IMB_double_x, IMB_double_y, IMB_double_fast_x, IMB_double_fast_y,
imb_filterx are not used by anything. Looks like they all come
from "initial revision, 22 years ago" and probably unused for decades.
This commit is contained in:
Aras Pranckevicius
2024-02-21 13:47:26 +02:00
parent 11db0b9dad
commit 31869d6857
4 changed files with 0 additions and 213 deletions

View File

@@ -522,11 +522,7 @@ void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, const float b
ImBuf *IMB_loadifffile(int file, int flags, char colorspace[IM_MAX_SPACE], const char *descr);
ImBuf *IMB_half_x(ImBuf *ibuf1);
ImBuf *IMB_double_fast_x(ImBuf *ibuf1);
ImBuf *IMB_double_x(ImBuf *ibuf1);
ImBuf *IMB_half_y(ImBuf *ibuf1);
ImBuf *IMB_double_fast_y(ImBuf *ibuf1);
ImBuf *IMB_double_y(ImBuf *ibuf1);
void IMB_flipx(ImBuf *ibuf);
void IMB_flipy(ImBuf *ibuf);

View File

@@ -13,8 +13,6 @@
struct ImBuf;
void imb_filterx(ImBuf *ibuf);
void IMB_premultiply_rect(uint8_t *rect, char planes, int w, int h);
void IMB_premultiply_rect_float(float *rect_float, int channels, int w, int h);

View File

@@ -19,44 +19,6 @@
#include "imbuf.hh"
static void filtrow(uchar *point, int x)
{
uint c1, c2, c3, error;
if (x > 1) {
c1 = c2 = *point;
error = 2;
for (x--; x > 0; x--) {
c3 = point[4];
c1 += (c2 << 1) + c3 + error;
error = c1 & 3;
*point = c1 >> 2;
point += 4;
c1 = c2;
c2 = c3;
}
*point = (c1 + (c2 << 1) + c2 + error) >> 2;
}
}
static void filtrowf(float *point, int x)
{
float c1, c2, c3;
if (x > 1) {
c1 = c2 = *point;
for (x--; x > 0; x--) {
c3 = point[4];
c1 += (c2 * 2) + c3;
*point = 0.25f * c1;
point += 4;
c1 = c2;
c2 = c3;
}
*point = 0.25f * (c1 + (c2 * 2) + c2);
}
}
static void filtcolum(uchar *point, int y, int skip)
{
uint c1, c2, c3, error;
@@ -137,43 +99,6 @@ void IMB_filtery(ImBuf *ibuf)
}
}
void imb_filterx(ImBuf *ibuf)
{
uchar *point = ibuf->byte_buffer.data;
float *pointf = ibuf->float_buffer.data;
int x = ibuf->x;
int y = ibuf->y;
int skip = (x << 2) - 3;
for (; y > 0; y--) {
if (point) {
if (ibuf->planes > 24) {
filtrow(point, x);
}
point++;
filtrow(point, x);
point++;
filtrow(point, x);
point++;
filtrow(point, x);
point += skip;
}
if (pointf) {
if (ibuf->planes > 24) {
filtrowf(pointf, x);
}
pointf++;
filtrowf(pointf, x);
pointf++;
filtrowf(pointf, x);
pointf++;
filtrowf(pointf, x);
pointf += skip;
}
}
}
static void imb_filterN(ImBuf *out, ImBuf *in)
{
BLI_assert(out->channels == in->channels);
@@ -291,12 +216,6 @@ static void imb_filterN(ImBuf *out, ImBuf *in)
}
}
void IMB_filter(ImBuf *ibuf)
{
IMB_filtery(ibuf);
imb_filterx(ibuf);
}
void IMB_mask_filter_extend(char *mask, int width, int height)
{
const char *row1, *row2, *row3;

View File

@@ -102,68 +102,6 @@ ImBuf *IMB_half_x(ImBuf *ibuf1)
return ibuf2;
}
ImBuf *IMB_double_fast_x(ImBuf *ibuf1)
{
ImBuf *ibuf2;
int *p1, *dest, i, col, do_rect, do_float;
float *p1f, *destf;
if (ibuf1 == nullptr) {
return nullptr;
}
if (ibuf1->byte_buffer.data == nullptr && ibuf1->float_buffer.data == nullptr) {
return nullptr;
}
do_rect = (ibuf1->byte_buffer.data != nullptr);
do_float = (ibuf1->float_buffer.data != nullptr);
ibuf2 = IMB_allocImBuf(2 * ibuf1->x, ibuf1->y, ibuf1->planes, ibuf1->flags);
if (ibuf2 == nullptr) {
return nullptr;
}
p1 = (int *)ibuf1->byte_buffer.data;
dest = (int *)ibuf2->byte_buffer.data;
p1f = (float *)ibuf1->float_buffer.data;
destf = (float *)ibuf2->float_buffer.data;
for (i = ibuf1->y * ibuf1->x; i > 0; i--) {
if (do_rect) {
col = *p1++;
*dest++ = col;
*dest++ = col;
}
if (do_float) {
destf[0] = destf[4] = p1f[0];
destf[1] = destf[5] = p1f[1];
destf[2] = destf[6] = p1f[2];
destf[3] = destf[7] = p1f[3];
destf += 8;
p1f += 4;
}
}
return ibuf2;
}
ImBuf *IMB_double_x(ImBuf *ibuf1)
{
ImBuf *ibuf2;
if (ibuf1 == nullptr) {
return nullptr;
}
if (ibuf1->byte_buffer.data == nullptr && ibuf1->float_buffer.data == nullptr) {
return nullptr;
}
ibuf2 = IMB_double_fast_x(ibuf1);
imb_filterx(ibuf2);
return ibuf2;
}
static void imb_half_y_no_alloc(ImBuf *ibuf2, ImBuf *ibuf1)
{
uchar *p1, *p2, *_p1, *dest;
@@ -256,70 +194,6 @@ ImBuf *IMB_half_y(ImBuf *ibuf1)
return ibuf2;
}
ImBuf *IMB_double_fast_y(ImBuf *ibuf1)
{
ImBuf *ibuf2;
int *p1, *dest1, *dest2;
float *p1f, *dest1f, *dest2f;
int x, y;
if (ibuf1 == nullptr) {
return nullptr;
}
if (ibuf1->byte_buffer.data == nullptr && ibuf1->float_buffer.data == nullptr) {
return nullptr;
}
const bool do_rect = (ibuf1->byte_buffer.data != nullptr);
const bool do_float = (ibuf1->float_buffer.data != nullptr);
ibuf2 = IMB_allocImBuf(ibuf1->x, 2 * ibuf1->y, ibuf1->planes, ibuf1->flags);
if (ibuf2 == nullptr) {
return nullptr;
}
p1 = (int *)ibuf1->byte_buffer.data;
dest1 = (int *)ibuf2->byte_buffer.data;
p1f = (float *)ibuf1->float_buffer.data;
dest1f = (float *)ibuf2->float_buffer.data;
for (y = ibuf1->y; y > 0; y--) {
if (do_rect) {
dest2 = dest1 + ibuf2->x;
for (x = ibuf2->x; x > 0; x--) {
*dest1++ = *dest2++ = *p1++;
}
dest1 = dest2;
}
if (do_float) {
dest2f = dest1f + (4 * ibuf2->x);
for (x = ibuf2->x * 4; x > 0; x--) {
*dest1f++ = *dest2f++ = *p1f++;
}
dest1f = dest2f;
}
}
return ibuf2;
}
ImBuf *IMB_double_y(ImBuf *ibuf1)
{
ImBuf *ibuf2;
if (ibuf1 == nullptr) {
return nullptr;
}
if (ibuf1->byte_buffer.data == nullptr) {
return nullptr;
}
ibuf2 = IMB_double_fast_y(ibuf1);
IMB_filtery(ibuf2);
return ibuf2;
}
/* pretty much specific functions which converts uchar <-> ushort but assumes
* ushort range of 255*255 which is more convenient here
*/