Meaning of "uint32_t rgbtoyuv[1<<24];" in typedef struct ?

General FreeBASIC programming questions.
Post Reply
lassar
Posts: 306
Joined: Jan 17, 2006 1:35

Meaning of "uint32_t rgbtoyuv[1<<24];" in typedef struct ?

Post by lassar »

Trying to translate a header in libxbr.

I think understand everything but "uint32_t rgbtoyuv[1<<24];" in the typedef struct.

Could someone explain to me what "uint32_t rgbtoyuv[1<<24];" means?

Here is the header code.

Code: Select all


/*
 * XBR filter: from the FFmpeg project
 *
 * Copyright (c) 2011, 2012 Hyllian/Jararaca <sergiogdb@gmail.com>
 * Copyright (c) 2014 Arwa Arif <arwaarif1994@gmail.com>
 * Copyright (c) 2015 Treeki <treeki@gmail.com>
 *
 *
 * hqx filter: from the hqx project
 * Copyright (C) 2003 Maxim Stepin ( maxst@hiend3d.com )
 * Copyright (C) 2010 Cameron Zemek ( grom@zeminvaders.net)
 * Copyright (c) 2015 Treeki <treeki@gmail.com>
 *
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

#ifndef __LIBXBR_FILTERS_H_INCLUDED
#define __LIBXBR_FILTERS_H_INCLUDED

#include <stdint.h>


#ifdef __cplusplus
extern "C" {
#endif

#ifdef _MSC_VER
	#define XBR_INLINE __inline

	#ifdef XBR_INTERNAL
		#define XBR_EXPORT __declspec(dllexport)
	#else
		#define XBR_EXPORT __declspec(dllimport)
	#endif
#else
	#define XBR_INLINE inline
	#define XBR_EXPORT
#endif

typedef struct {
    uint32_t rgbtoyuv[1<<24];
} xbr_data;

typedef struct {
    const uint8_t *input;
    uint8_t *output;
    int inWidth, inHeight;
    int inPitch, outPitch;
    const xbr_data *data;
} xbr_params;

XBR_EXPORT void xbr_filter_xbr2x(const xbr_params *ctx);
XBR_EXPORT void xbr_filter_xbr3x(const xbr_params *ctx);
XBR_EXPORT void xbr_filter_xbr4x(const xbr_params *ctx);

XBR_EXPORT void xbr_filter_hq2x(const xbr_params *ctx);
XBR_EXPORT void xbr_filter_hq3x(const xbr_params *ctx);
XBR_EXPORT void xbr_filter_hq4x(const xbr_params *ctx);

XBR_EXPORT void xbr_init_data(xbr_data *data);


#ifdef __cplusplus
}
#endif

#endif

badidea
Posts: 2586
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Meaning of "uint32_t rgbtoyuv[1<<24];" in typedef struct ?

Post by badidea »

1<<24 = 1 shl 24 = &h01000000
[...] = (...)
lassar
Posts: 306
Joined: Jan 17, 2006 1:35

Re: Meaning of "uint32_t rgbtoyuv[1<<24];" in typedef struct ?

Post by lassar »

Did some more googling.

Is this typedef making a uinteger static array of size 2^24 ?

I really can't believe, that this is creating a 67 megabyte array.
badidea
Posts: 2586
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Meaning of "uint32_t rgbtoyuv[1<<24];" in typedef struct ?

Post by badidea »

lassar
Posts: 306
Joined: Jan 17, 2006 1:35

Re: Meaning of "uint32_t rgbtoyuv[1<<24];" in typedef struct ?

Post by lassar »

badidea wrote:It seems so. See also: http://www.jonathanfischer.net/profile/
That web page is very interesting.


After all the work of getting libhqx , and libxbr to work.

Think I'll go with scale2x.

Don't believe I am saying this.

Text scaled up by scale2x to be more readable than hqx & xbr.

Really like the way hq2x and xbr2x look, but they are not as readable as scale2x.

It's probably the blending that hq2x & xbr2x does.

Been checking out text with imageresizer, hq2x without blending seems to be fairly
readable.

But I don't know, where to find a library, that would do that.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Meaning of "uint32_t rgbtoyuv[1<<24];" in typedef struct ?

Post by MrSwiss »

Is this typedef making a uinteger static array of size 2^24 ?
No, not UInteger but, ULong as in:

Code: Select all

Type uint32_t As ULong
UInteger in FBC 64 = ULongInt! (ULong is always 32 bit's, both compilers!)
Post Reply