Help - Search - Members - Calendar
Full Version: Impulse Trigger Profile patch for final release
Hydrogenaudio Forums > Hydrogenaudio Forum > Uploads
Triza
The source code Recommended Ogg Vorbis Encoders refers to is the official code. It does not have QuantumKnot's wonderful Impulse Trigger Profile (ITP) feature.

Thanks to QuantumKnot (QK) providing the source code I managed to create a patchfile and adjusted it so that one can apply it onto the official 1.1 (or more exactly libvorbis 1.1.0 and vorbis-tools 1.0.1) without any warnings. The adjustments were needed because some code changed between 1.1RC1 and 1.1 (QK used some 1.1RC1 code initially when ITP came to light). It seemed that the change was mainly unrelated bitrate management stuff, so conflict is unlikely.

I've upload the patches here in case someone is as anal as I am wanting to use the official final release, but with ITP. It would also be good if QK could quickly check it. It was very straightforward so I do not expect any error.

Enjoy,

Triza

Apologies, but I cannot upload so I have to copy paste into here.

This is the vorbis-tools-1.0.1 patch:

CODE

diff -c --strip-trailing-cr -x .svn -r vorbis-tools-itp-src-base/oggenc/encode.c vorbis-tools-itp-src/oggenc/encode.c
*** vorbis-tools-itp-src-base/oggenc/encode.c Mon Oct 25 01:36:12 2004
--- vorbis-tools-itp-src/oggenc/encode.c Fri Jul 23 10:44:58 2004
***************
*** 92,97 ****
--- 92,108 ----
             SETD(val);
             vorbis_encode_ctl(vi, OV_ECTL_IBLOCK_SET, &val);
         }
+   else if(!strcmp(opts[i].arg, "impulse_trigger_profile")) {
+             double val, prev;
+             SETD(val);
+    vorbis_encode_ctl(vi, OV_ECTL_GLOBAL_MAPPING_GET, &prev);
+    if ((val >= 0) && (val <= 6)) {
+     fprintf(stderr, _("Changing impulse trigger profile from %f to %f\n"), prev, val);
+              vorbis_encode_ctl(vi, OV_ECTL_GLOBAL_MAPPING_SET, &val);
+    }
+    else
+     fprintf(stderr, _("Error: Valid impulse trigger profiles are between 0 and 6. Using default %f.\n"), prev);
+         }
         else if(!strcmp(opts[i].arg, "lowpass_frequency")) {
             double prev, new;
             SETD(new);
diff -c --strip-trailing-cr -x .svn -r vorbis-tools-itp-src-base/oggenc/oggenc.c vorbis-tools-itp-src/oggenc/oggenc.c
*** vorbis-tools-itp-src-base/oggenc/oggenc.c Mon Oct 25 01:36:11 2004
--- vorbis-tools-itp-src/oggenc/oggenc.c Fri Jul 23 10:45:04 2004
***************
*** 25,32 ****
 #include "i18n.h"
 
 
! #define VERSION_STRING "OggEnc v1.0.1 (libvorbis 1.0.1)\n"
! #define COPYRIGHT "(c) 2000-2003 Michael Smith <msmith@xiph.org>\n"
 
 #define CHUNK 4096 /* We do reads, etc. in multiples of this */
 
--- 25,33 ----
 #include "i18n.h"
 
 
! #define VERSION_STRING "OggEnc v1.0.1 with Impulse Trigger Profiles (libvorbis 1.1.0)\n"
! #define COPYRIGHT "(c) 2000-2003 Michael Smith <msmith@xiph.org>\n & impulse trigger code by Stephen So <steve8988@optusnet.com.au>\n"
!
 
 #define CHUNK 4096 /* We do reads, etc. in multiples of this */
 



This is the libvorbis-1.1.0 patch

CODE

diff -c --strip-trailing-cr -x .svn -r vorbis1_1rc1-itp-src-base/include/vorbis/vorbisenc.h vorbis1_1rc1-itp-src/include/vorbis/vorbisenc.h
*** vorbis1_1rc1-itp-src-base/include/vorbis/vorbisenc.h Sun Oct 24 20:17:59 2004
--- vorbis1_1rc1-itp-src/include/vorbis/vorbisenc.h Fri Jul 23 10:32:46 2004
***************
*** 103,108 ****
--- 103,111 ----
 #define OV_ECTL_IBLOCK_GET           0x30
 #define OV_ECTL_IBLOCK_SET           0x31
 
+ #define OV_ECTL_GLOBAL_MAPPING_GET   0x40
+ #define OV_ECTL_GLOBAL_MAPPING_SET   0x41
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff -c --strip-trailing-cr -x .svn -r vorbis1_1rc1-itp-src-base/lib/modes/psych_44.h vorbis1_1rc1-itp-src/lib/modes/psych_44.h
*** vorbis1_1rc1-itp-src-base/lib/modes/psych_44.h Sun Oct 24 20:18:46 2004
--- vorbis1_1rc1-itp-src/lib/modes/psych_44.h Fri Jul 23 10:32:46 2004
***************
*** 18,24 ****
 
 /* preecho trigger settings *****************************************/
 
! static vorbis_info_psy_global _psy_global_44[5]={
 
   {8,   /* lines per eighth octave */
    {20.f,14.f,12.f,12.f,12.f,12.f,12.f},
--- 18,24 ----
 
 /* preecho trigger settings *****************************************/
 
! static vorbis_info_psy_global _psy_global_44[7]={
 
   {8,   /* lines per eighth octave */
    {20.f,14.f,12.f,12.f,12.f,12.f,12.f},
***************
*** 50,55 ****
--- 50,68 ----
    -6.f,
    {99.},{{99.},{99.}},{0},{0},{{0.},{0.}}
   },
+ // GT3b2 values
+   {8,   /* lines per eighth octave */
+    {11.f,8.f,8.f,8.f,8.f,8.f,8.f},
+    {-16.f,-14.f,-12.f,-12.f,-12.f,-12.f,-12.f}, 0,-85.f,
+    -6.f,
+    {99.},{{99.},{99.}},{0},{0},{{0.},{0.}}
+   },
+   {8,   /* lines per eighth octave */
+    {10.f,6.f,6.f,6.f,6.f,6.f,6.f},
+    {-15.f,-14.f,-10.f,-10.f,-10.f,-10.f,-10.f}, 0,-85.f,
+    -6.f,
+    {99.},{{99.},{99.}},{0},{0},{{0.},{0.}}
+   },
 };
 
 /* noise compander lookups * low, mid, high quality ****************/
diff -c --strip-trailing-cr -x .svn -r vorbis1_1rc1-itp-src-base/lib/vorbisenc.c vorbis1_1rc1-itp-src/lib/vorbisenc.c
*** vorbis1_1rc1-itp-src-base/lib/vorbisenc.c Sun Oct 24 20:18:49 2004
--- vorbis1_1rc1-itp-src/lib/vorbisenc.c Fri Jul 23 10:32:46 2004
***************
*** 1175,1183 ****
  if(hi->impulse_noisetune<-15.)hi->impulse_noisetune=-15.;
       }
       return(0);      
!     }
!
!
     return(OV_EIMPL);
   }
   return(OV_EINVAL);
--- 1175,1199 ----
  if(hi->impulse_noisetune<-15.)hi->impulse_noisetune=-15.;
       }
       return(0);      
!  case OV_ECTL_GLOBAL_MAPPING_GET: {
!     ve_setup_data_template *set=(ve_setup_data_template *)hi->setup;
!   double *farg=(double *)arg;
!   int c = hi->base_setting;
!   *farg=set->global_mapping[c];
!  }
!  return (0);
!  
!  case OV_ECTL_GLOBAL_MAPPING_SET: {
!     ve_setup_data_template *set=(ve_setup_data_template *)hi->setup;
!   double *farg = (double *)arg;
!   int c = hi->base_setting;
!   set->global_mapping[c] = *farg;
!   //for (c = 0; c < 12; c++) {
!   // set->global_mapping[c] = *farg;
!   //}
!  }
!  return (0);
!    }
     return(OV_EIMPL);
   }
   return(OV_EINVAL);
jr87
I'm getting some errors..so I dunno

jason@localhost libvorbis-1.1.0 $ cat libvorbis-1.1.0.patch | patch -p1
patching file include/vorbis/vorbisenc.h
Hunk #1 FAILED at 103.
1 out of 1 hunk FAILED -- saving rejects to file include/vorbis/vorbisenc.h.rej
patching file lib/modes/psych_44.h
Hunk #1 FAILED at 18.
Hunk #2 FAILED at 50.
2 out of 2 hunks FAILED -- saving rejects to file lib/modes/psych_44.h.rej
patching file lib/vorbisenc.c
Hunk #1 FAILED at 1175.
1 out of 1 hunk FAILED -- saving rejects to file lib/vorbisenc.c.rej
Triza
I think your problem was that since I had to copy-paste the patches some of the lines got folded.

Triza
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.