]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cap_ogg.c
if MATERIALFLAG_CUSTOMBLEND, clear MATERIALFLAG_ADD and
[xonotic/darkplaces.git] / cap_ogg.c
index a5218655330970ff3019ed7088eacf841d3b1ca5..166ead0138cc2b82ef4043d1eb9ec14d12f806ca 100644 (file)
--- a/cap_ogg.c
+++ b/cap_ogg.c
@@ -9,7 +9,7 @@
 
 // video capture cvars
 static cvar_t cl_capturevideo_ogg_theora_vp3compat = {CVAR_SAVE, "cl_capturevideo_ogg_theora_vp3compat", "1", "make VP3 compatible theora streams"};
-static cvar_t cl_capturevideo_ogg_theora_quality = {CVAR_SAVE, "cl_capturevideo_ogg_theora_quality", "42", "video quality factor (0 to 63), or -1 to use bitrate only; higher is better; setting both to -1 achieves unlimited quality"};
+static cvar_t cl_capturevideo_ogg_theora_quality = {CVAR_SAVE, "cl_capturevideo_ogg_theora_quality", "48", "video quality factor (0 to 63), or -1 to use bitrate only; higher is better; setting both to -1 achieves unlimited quality"};
 static cvar_t cl_capturevideo_ogg_theora_bitrate = {CVAR_SAVE, "cl_capturevideo_ogg_theora_bitrate", "-1", "video bitrate (45 to 2000 kbps), or -1 to use quality only; higher is better; setting both to -1 achieves unlimited quality"};
 static cvar_t cl_capturevideo_ogg_theora_keyframe_bitrate_multiplier = {CVAR_SAVE, "cl_capturevideo_ogg_theora_keyframe_bitrate_multiplier", "1.5", "how much more bit rate to use for keyframes, specified as a factor of at least 1"};
 static cvar_t cl_capturevideo_ogg_theora_keyframe_maxinterval = {CVAR_SAVE, "cl_capturevideo_ogg_theora_keyframe_maxinterval", "64", "maximum keyframe interval (1 to 1000)"};
@@ -847,7 +847,7 @@ static void SCR_CaptureVideo_Ogg_ConvertFrame_BGRA_to_YUV(void)
                        b += 4;
                }
 
-               if((y & 1) == 0)
+               if ((y & 1) == 0 && y/2 < h/2) // if h is odd, this skips the last row
                {
                        for(b = cls.capturevideo.outbuffer + (h-2-y)*w*4, x = 0; x < w/2; ++x)
                        {
@@ -919,7 +919,7 @@ static void SCR_CaptureVideo_Ogg_SoundFrame(const portable_sampleframe_t *paintb
        {
                float *b = vorbis_buffer[map[j]];
                for(i = 0; i < length; ++i)
-                       b[i] = paintbuffer[i].sample[j] / 32768.0f;
+                       b[i] = paintbuffer[i].sample[j];
        }
        qvorbis_analysis_wrote(&format->vd, length);
 
@@ -1015,14 +1015,13 @@ void SCR_CaptureVideo_Ogg_BeginVideo(void)
                }
                else
                {
-                       ti.target_bitrate = ti.target_bitrate;
                        ti.keyframe_data_target_bitrate = (int) (ti.target_bitrate * max(1, cl_capturevideo_ogg_theora_keyframe_bitrate_multiplier.value));
 
                        if(ti.target_bitrate < 45000 || ti.target_bitrate > 2000000)
                                Con_DPrintf("WARNING: requesting an odd bitrate for theora (sensible values range from 45 to 2000 kbps)\n");
                }
 
-               if(ti.quality < 0)
+               if(ti.quality < 0 || ti.quality > 63)
                {
                        ti.quality = 63;
                        if(ti.target_bitrate <= 0)
@@ -1031,10 +1030,6 @@ void SCR_CaptureVideo_Ogg_BeginVideo(void)
                                ti.keyframe_data_target_bitrate = 0x7FFFFFFF;
                        }
                }
-               else
-               {
-                       ti.quality = bound(0, ti.quality, 63);
-               }
 
                // this -1 magic is because ti.keyframe_frequency and ti.keyframe_mindistance use different metrics
                ti.keyframe_frequency = bound(1, cl_capturevideo_ogg_theora_keyframe_maxinterval.integer, 1000);