Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Announcements and Chat > General Discussion

Reply
 
Thread Tools Search this Thread Display Modes
Old 13th May 2021, 17:33   #1  |  Link
mikeiz
Registered User
 
Join Date: Apr 2009
Location: Raleigh-Durham, North Carolina
Posts: 9
Tobias Oelbaum's sgi2yuv utility

I'm trying to find the sgi2yuv program and I'm not finding it. I have a copy, but it looks like the global.h file is corrupted because it has main() and executable code in it. It doesn't look like a header file. I checked Tobias' website using the link in derf's collection, but the site is not found. Any help would be appreciated.

Mike
mikeiz is offline   Reply With Quote
Old 13th May 2021, 17:50   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Perhaps try google
Code:
"Tobias Oelbaum" NEAR "sgi2yuv"
https://www.google.co.uk/search?q=%2...4dUDCA0&uact=5

EDIT: My UBlock Origin (ad blocker) blocks access to many of those site links, saying is malicious.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 13th May 2021 at 17:53.
StainlessS is offline   Reply With Quote
Old 13th May 2021, 19:48   #3  |  Link
mikeiz
Registered User
 
Join Date: Apr 2009
Location: Raleigh-Durham, North Carolina
Posts: 9
This points to the same sites. They use the same link to Tobias' site to get the software but he must have moved it or is not working there anymore.
mikeiz is offline   Reply With Quote
Old 13th May 2021, 20:43   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
This help at all.
from google
Code:
"sgi2yuv" -"Tobias Oelbaum"
https://www.google.co.uk/search?q=+%...4dUDCAg&uact=5

ie, links not mentioning the guys name. [as you say links mentioning his name did not help]
From 2nd link, @ avsforum.com
http://www.w6rz.net/sgitoyuv.zip

Code:
/*
SGI 16-bit RGB to 8-bit 4:2:2 YCbCr (UYVY) conversion
*/

#include <stdio.h>
#include <stdlib.h>

#define	TRUE		1
#define	FALSE		0

void conv444to422(unsigned char *src, unsigned char *dst, int width, int height);

unsigned char *Clip;

int main(int argc, char **argv)
{
	FILE	*fp;
	FILE	*fpout;
	int	length, i, j, horz, vert, index = 0;
	int	r, g, b;
	double	y, u, v;
	double	cr, cg, cb, cu, cv;
	unsigned char	*yp, *up, *vp;
	int	matrix_coefficients = 1;
	unsigned int	py, pcb, pcr;
	static unsigned char	buffer_422output[3840 * 2160 * 2];
	static unsigned char	buffer_422Cb[3840 * 2160 / 2];
	static unsigned char	buffer_422Cr[3840 * 2160 / 2];
	static unsigned char	buffer_444Y[3840 * 2160];
	static unsigned char	buffer_444Cb[3840 * 2160];
	static unsigned char	buffer_444Cr[3840 * 2160];
	static unsigned short	buffer_444input[3840 * 2160 * 3];
	static double coef[7][3] = {
		{0.2126, 0.7152, 0.0722},   /* ITU-R Rec. 709 (2002) */
		{0.299, 0.587, 0.114},      /* unspecified */
		{0.299, 0.587, 0.114},      /* reserved */
		{0.30,  0.59,  0.11},       /* FCC */
		{0.299, 0.587, 0.114},      /* ITU-R Rec. 624-4 System B, G */
		{0.299, 0.587, 0.114},      /* SMPTE 170M */
		{0.212, 0.701, 0.087}};     /* SMPTE 240M (1987) */

	if (argc != 5) {
		fprintf(stderr, "usage: sgitoyuv <horz> <vert> <infile> <outfile>\n");
		exit(-1);
	}

	/*--- open binary file (for parsing) ---*/
	fp = fopen(argv[3], "rb");
	if (fp == 0) {
		fprintf(stderr, "Cannot open input file <%s>\n", argv[3]);
		exit(-1);
	}

	/*--- open binary file (for parsing) ---*/
	fpout = fopen(argv[4], "wb");
	if (fpout == 0) {
		fprintf(stderr, "Cannot open output file <%s>\n", argv[4]);
		exit(-1);
	}

	/* Clip table */
	if (!(Clip=(unsigned char *)malloc(1024)))
		printf("Clip[] malloc failed\n");

	Clip += 384;

	for (i = -384; i < 640; i++)
		Clip[i] = (i<0) ? 0 : ((i>255) ? 255 : i);

	horz = atoi(argv[1]);
	vert = atoi(argv[2]);
	length = fread(&buffer_444input[0], 1, 512, fp);
	length = fread(&buffer_444input[0], 1, (horz * vert * 6), fp);

	i = matrix_coefficients;
	cr = coef[i-1][0];
	cg = coef[i-1][1];
	cb = coef[i-1][2];
	cu = 0.5/(1.0-cb);
	cv = 0.5/(1.0-cr);

	index = ((horz * (vert - 1)));

	for (i = 0; i < vert; i++)
	{
		yp = &buffer_444Y[0] + i*horz;
		up = &buffer_444Cb[0] + i*horz;
		vp = &buffer_444Cr[0] + i*horz;

		for (j =0 ; j < horz; j++)
		{
			r = buffer_444input[index];
			g = buffer_444input[index + (horz*vert)];
			b = buffer_444input[index + (horz*vert*2)];
#if 0
			r = ((r & 0xff) << 8) + ((r & 0xff00) >> 8);
			g = ((g & 0xff) << 8) + ((g & 0xff00) >> 8);
			b = ((b & 0xff) << 8) + ((b & 0xff00) >> 8);
#else
			r = r & 0xff;
			g = g & 0xff;
			b = b & 0xff;
#endif
			index++;

			/* convert to YUV */
			y = cr * r + cg * g + cb * b;
			u = cu*(b-y);
			v = cv*(r-y);
#if 0
			y /= 256;
			u /= 256;
			v /= 256;
#endif
			yp[j] = (219.0/255.0)*y + 16.5;
			up[j] = (224.0/255.0)*u + 128.5;
			vp[j] = (224.0/255.0)*v + 128.5;
		}
		index = index - (horz * 2);
	}
	conv444to422(&buffer_444Cb[0], &buffer_422Cb[0], horz, vert);
	conv444to422(&buffer_444Cr[0], &buffer_422Cr[0], horz, vert);
	py = 0;
	pcb = 0;
	pcr = 0;
	for (i = 0; i < (horz * vert * 2); i++)
	{
		if ((i % 2) == 1)
		{
			buffer_422output[i] = buffer_444Y[py++];
		}
		else if ((i % 4) == 0)
		{
			buffer_422output[i] = buffer_422Cb[pcb++];
		}
		else
		{
			buffer_422output[i] = buffer_422Cr[pcr++];
		}
	}
	fwrite(&buffer_422output[0], 1, (horz * vert * 2), fpout);
	fclose(fp);
	fclose(fpout);
	return 0;
}

/* horizontal filter and 2:1 subsampling */
void conv444to422(unsigned char *src, unsigned char *dst, int width, int height)
{
  int i, j, im5, im4, im3, im2, im1, ip1, ip2, ip3, ip4, ip5, ip6;

  if (0)
  {
    for (j=0; j<height; j++)
    {
      for (i=0; i<width; i+=2)
      {
        im5 = (i<5) ? 0 : i-5;
        im4 = (i<4) ? 0 : i-4;
        im3 = (i<3) ? 0 : i-3;
        im2 = (i<2) ? 0 : i-2;
        im1 = (i<1) ? 0 : i-1;
        ip1 = (i<width-1) ? i+1 : width-1;
        ip2 = (i<width-2) ? i+2 : width-1;
        ip3 = (i<width-3) ? i+3 : width-1;
        ip4 = (i<width-4) ? i+4 : width-1;
        ip5 = (i<width-5) ? i+5 : width-1;
        ip6 = (i<width-5) ? i+6 : width-1;

        /* FIR filter with 0.5 sample interval phase shift */
        dst[i>>1] = Clip[(int)(228*(src[i]+src[ip1])
                         +70*(src[im1]+src[ip2])
                         -37*(src[im2]+src[ip3])
                         -21*(src[im3]+src[ip4])
                         +11*(src[im4]+src[ip5])
                         + 5*(src[im5]+src[ip6])+256)>>9];
      }
      src+= width;
      dst+= width>>1;
    }
  }
  else
  {
    /* MPEG-2 */
    for (j=0; j<height; j++)
    {
      for (i=0; i<width; i+=2)
      {
        im5 = (i<5) ? 0 : i-5;
        im3 = (i<3) ? 0 : i-3;
        im1 = (i<1) ? 0 : i-1;
        ip1 = (i<width-1) ? i+1 : width-1;
        ip3 = (i<width-3) ? i+3 : width-1;
        ip5 = (i<width-5) ? i+5 : width-1;

        /* Original FIR filter coefficients (*512): 22 0 -52 0 159 256 159 0 -52 0 22 */
        /* It's a bug. Filter coefficients must add up to 512!!! */

        /* FIR filter coefficients (*512): 21 0 -52 0 159 256 159 0 -52 0 21 */
        dst[i>>1] = Clip[(int)(  21*(src[im5]+src[ip5])-52*(src[im3]+src[ip3])
                         +159*(src[im1]+src[ip1])+256*src[i]+256)>>9];
      }
      src+= width;
      dst+= width>>1;
    }
  }
}
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 13th May 2021, 21:28   #5  |  Link
mikeiz
Registered User
 
Join Date: Apr 2009
Location: Raleigh-Durham, North Carolina
Posts: 9
Do you have the original global.h file for sgi2yuv?
mikeiz is offline   Reply With Quote
Old 13th May 2021, 22:29   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
No.
As it does not include a [non standard] header, I presume that there aint one.

EDIT:
Arh, there is this, but looks like you have to join a chinese site [with no guarantee that they have it].
Code:
configfile.h
global.h
sgi2yuv.c
sgi2yuv.cfg
configfile.c
sgi2yuv.exe
https://www.dssz.com/594146.html
Google Translated:- https://translate.google.com/transla...om/594146.html

If you know a site where it was once posted, you might find it on Archive.org
[I cant access Archive.org, my ISP blocks it for some reason - I used to be able to access it, not now].
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 14th May 2021 at 01:12.
StainlessS is offline   Reply With Quote
Reply

Tags
sgi yuv convert

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:18.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.