Subversion Repositories eduke32

Compare Revisions

Regard whitespace Rev 4998 → Rev 4997

/polymer/eduke32/source/anim.c
96,7 → 96,7
I_ClearAllInput();
 
#ifdef USE_LIBVPX
while (getrendermode() >= REND_POLYMOST) // if, really
while (getrendermode() >= REND_POLYMOST && glinfo.glsl) // if, really
{
char vpxfn[BMAX_PATH];
Bstrncpyz(vpxfn, fn, BMAX_PATH);
/polymer/eduke32/source/animvpx.c
295,18 → 295,18
 
t[1] = getticks();
 
/*** 3 planes --> packed conversion ***/
{
uint8_t *const dstpic = codec->pic;
 
uint8_t const *const yplane = img->planes[VPX_PLANE_Y];
uint8_t const *const uplane = img->planes[VPX_PLANE_U];
uint8_t const *const vplane = img->planes[VPX_PLANE_V];
const uint8_t *const yplane = img->planes[VPX_PLANE_Y];
const uint8_t *const uplane = img->planes[VPX_PLANE_U];
const uint8_t *const vplane = img->planes[VPX_PLANE_V];
 
const int32_t ystride = img->stride[VPX_PLANE_Y];
const int32_t ustride = img->stride[VPX_PLANE_U];
const int32_t vstride = img->stride[VPX_PLANE_V];
int32_t ystride = img->stride[VPX_PLANE_Y];
int32_t ustride = img->stride[VPX_PLANE_U];
int32_t vstride = img->stride[VPX_PLANE_V];
 
if (glinfo.glsl) /*** 3 planes --> packed conversion ***/
{
int32_t x, y;
const int32_t width = img->d_w, height = img->d_h;
 
334,32 → 334,7
}
}
}
else /*** 3 planes --> packed conversion (RGB) ***/
{
int i = 0;
 
for (unsigned int imgY = 0; imgY < img->d_h; imgY++)
{
for (unsigned int imgX = 0; imgX < img->d_w; imgX++)
{
uint8_t const y = yplane[imgY * ystride + imgX];
uint8_t const u = uplane[(imgY >> 1) * ustride + (imgX >> 1)];
uint8_t const v = vplane[(imgY >> 1) * vstride + (imgX >> 1)];
 
int const c = y - 16;
int const d = (u + -128);
int const e = (v + -128);
int const c298 = c * 298;
 
dstpic[i + 0] = (uint8_t)clamp((c298 + 409 * e - -128) >> 8, 0, 255);
dstpic[i + 1] = (uint8_t)clamp((c298 - 100 * d - 208 * e - -128) >> 8, 0, 255);
dstpic[i + 2] = (uint8_t)clamp((c298 + 516 * d - -128) >> 8, 0, 255);
 
i += 3;
}
}
}
 
t[2] = getticks();
 
codec->sumtimes[0] += t[1]-t[0];
408,8 → 383,6
 
void animvpx_setup_glstate(void)
{
if (glinfo.glsl)
{
GLint gli;
GLhandleARB FSHandle, PHandle;
static char logbuf[512];
440,7 → 413,6
 
/* Finally, use the program. */
bglUseProgramObjectARB(PHandle);
}
 
////////// GL STATE //////////
 
453,18 → 425,26
bglMatrixMode(GL_PROJECTION);
bglLoadIdentity();
 
bglMatrixMode(GL_COLOR);
bglLoadIdentity();
 
bglMatrixMode(GL_TEXTURE);
bglLoadIdentity();
 
// bglPushAttrib(GL_ENABLE_BIT);
bglPushAttrib(GL_ENABLE_BIT);
bglDisable(GL_ALPHA_TEST);
// bglDisable(GL_LIGHTING);
bglDisable(GL_DEPTH_TEST);
bglDisable(GL_BLEND);
bglDisable(GL_CULL_FACE);
// bglDisable(GL_SCISSOR_TEST);
bglEnable(GL_TEXTURE_2D);
 
 
bglActiveTextureARB(GL_TEXTURE0_ARB);
bglGenTextures(1, &texname);
// gli = bglGetUniformLocationARB(PHandle,"tex");
// bglUniform1iARB(gli,0); // 0: texture unit
bglBindTexture(GL_TEXTURE_2D, texname);
 
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP);
481,10 → 461,9
 
void animvpx_restore_glstate(void)
{
if (glinfo.glsl)
bglUseProgramObjectARB(0);
 
// bglPopAttrib();
bglPopAttrib();
 
bglDeleteTextures(1, &texname);
texname = 0;
501,20 → 480,19
if (codec->pic == NULL)
return 2; // shouldn't happen
 
int fmt = glinfo.glsl ? GL_RGBA : GL_RGB;
 
if (!texuploaded)
{
bglTexImage2D(GL_TEXTURE_2D, 0, fmt, codec->width,codec->height,
0, fmt, GL_UNSIGNED_BYTE, codec->pic);
bglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, codec->width,codec->height,
0, GL_RGBA, GL_UNSIGNED_BYTE, codec->pic);
texuploaded = 1;
}
else
{
bglTexSubImage2D(GL_TEXTURE_2D, 0, 0,0, codec->width,codec->height,
fmt, GL_UNSIGNED_BYTE, codec->pic);
GL_RGBA, GL_UNSIGNED_BYTE, codec->pic);
}
 
{
float vid_wbyh = ((float)codec->width)/codec->height;
float scr_wbyh = ((float)xdim)/ydim;
 
532,9 → 510,6
#endif
bglBegin(GL_QUADS);
 
if (!glinfo.glsl)
bglColor3f(1.0, 1.0, 1.0);
 
bglTexCoord2f(0.0,1.0);
bglVertex3f(-x, -y, 0.0);
 
548,6 → 523,7
bglVertex3f(x, -y, 0.0);
 
bglEnd();
}
 
t = getticks()-t;
codec->sumtimes[2] += t;
565,9 → 541,6
const int32_t *m = codec->maxtimes;
int32_t n = codec->numframes;
 
if (glinfo.glsl)
initprintf("animvpx: GLSL mode\n");
 
initprintf("VP8 timing stats (mean, max) [ms] for %d frames:\n"
" read and decode frame: %.02f, %d\n"
" 3 planes -> packed conversion: %.02f, %d\n"