avifile-0.7.48~20090503.ds/0000755000175000017500000000000011267646562013760 5ustar yavoryavoravifile-0.7.48~20090503.ds/admin/0000755000175000017500000000000011267646347015051 5ustar yavoryavoravifile-0.7.48~20090503.ds/admin/am_edit0000644000175000017500000020625407457062064016401 0ustar yavoryavor#!/usr/bin/perl -w # Expands the specialised KDE tags in Makefile.in to (hopefully) valid # make syntax. # When called without file parameters, we work recursively on all Makefile.in # in and below the current subdirectory. When called with file parameters, # only those Makefile.in are changed. # The currently supported tags are # # {program}_METASOURCES # where you have a choice of two styles # {program}_METASOURCES = name1.moc name2.moc ... [\] # {program}_METASOURCES = AUTO # The second style requires other tags as well. # # To install icons : # KDE_ICON = iconname iconname2 ... # KDE_ICON = AUTO # # For documentation : # ... # # and more new tags TBD! # # The concept (and base code) for this program came from automoc, # supplied by the following # # Matthias Ettrich (The originator) # Kalle Dalheimer (The original implementator) # Harri Porten # Alex Zepeda # David Faure # Stephan Kulow use Cwd; use File::Find; use File::Basename; # Prototype the functions sub initialise (); sub processMakefile ($); sub updateMakefile (); sub restoreMakefile (); sub removeLine ($$); sub appendLines ($); sub substituteLine ($$); sub findMocCandidates (); sub pruneMocCandidates ($); sub checkMocCandidates (); sub addMocRules (); sub tag_AUTOMAKE (); sub tag_META_INCLUDES (); sub tag_METASOURCES (); sub tag_POFILES (); sub tag_DOCFILES (); sub tag_LOCALINSTALL(); sub tag_IDLFILES(); sub tag_UIFILES(); sub tag_SUBDIRS(); sub tag_ICON(); sub tag_CLOSURE(); sub tag_DIST(); # Some global globals... $verbose = 0; # a debug flag $thisProg = "$0"; # This programs name $topdir = cwd(); # The current directory @makefiles = (); # Contains all the files we'll process @foreignfiles = (); $start = (times)[0]; # some stats for testing - comment out for release $version = "v0.2"; $errorflag = 0; $cppExt = "(cpp|cc|cxx|C|c\\+\\+)"; $hExt = "(h|H|hh|hxx|hpp|h\\+\\+)"; $progId = "KDE tags expanded automatically by " . basename($thisProg); $automkCall = "\n"; $printname = ""; # used to display the directory the Makefile is in $use_final = 1; # create code for --enable-final $cleantarget = "clean"; $dryrun = 0; $pathoption = 0; $foreign_libtool = 0; while (defined ($ARGV[0])) { $_ = shift; if (/^--version$/) { print STDOUT "\n"; print STDOUT basename($thisProg), " $version\n", "This is really free software, unencumbered by the GPL.\n", "You can do anything you like with it except sueing me.\n", "Copyright 1998 Kalle Dalheimer \n", "Concept, design and unnecessary questions about perl\n", " by Matthias Ettrich \n\n", "Making it useful by Stephan Kulow and\n", "Harri Porten \n", "Updated (Feb-1999), John Birch \n", "Current Maintainer Stephan Kulow\n\n"; exit 0; } elsif (/^--verbose$|^-v$/) { $verbose = 1; # Oh is there a problem...? } elsif (/^-p(.+)$|^--path=(.+)$/) { $thisProg = "$1/".basename($thisProg) if($1); $thisProg = "$2/".basename($thisProg) if($2); warn ("$thisProg doesn't exist\n") if (!(-f $thisProg)); $pathoption=1; } elsif (/^--help$|^-h$/) { print STDOUT "Usage $thisProg [OPTION] ... [dir/Makefile.in]...\n", "\n", "Patches dir/Makefile.in generated from automake\n", "(where dir can be a full or relative directory name)", "\n", " -v, --verbose verbosely list files processed\n", " -h, --help print this help, then exit\n", " --version print version number, then exit\n", " -p, --path= use the path to am_edit if the path\n", " --no-final don't patch for --enable-final\n", " called from is not the one to be used\n"; exit 0; } elsif (/^--no-final$/) { $use_final = 0; $thisProg .= " --no-final"; } elsif (/^--foreign-libtool$/) { $foreign_libtool = 1; $thisProg .= " --foreign-libtool"; } elsif (/^-n$/) { $dryrun = 1; } else { # user selects what input files to check # add full path if relative path is given $_ = cwd()."/".$_ if (! /^\//); print "User wants $_\n" if ($verbose); push (@makefiles, $_); } } if ($thisProg =~ /^\// && !$pathoption ) { print STDERR "Illegal full pathname call performed...\n", "The call to \"$thisProg\"\nwould be inserted in some Makefile.in.\n", "Please use option --path.\n"; exit 1; } # Only scan for files when the user hasn't entered data if (!@makefiles) { print STDOUT "Scanning for Makefile.in\n" if ($verbose); find (\&add_makefile, cwd()); #chdir('$topdir'); } else { print STDOUT "Using user enter input files\n" if ($verbose); } foreach $makefile (sort(@makefiles)) { processMakefile ($makefile); last if ($errorflag); } # Just some debug statistics - comment out for release as it uses printf. printf STDOUT "Time %.2f CPU sec\n", (times)[0] - $start if ($verbose); exit $errorflag; # causes make to fail if erroflag is set #----------------------------------------------------------------------------- # In conjunction with the "find" call, this builds the list of input files sub add_makefile () { push (@makefiles, $File::Find::name) if (/Makefile.in$/); } #----------------------------------------------------------------------------- # Processes a single make file # The parameter contains the full path name of the Makefile.in to use sub processMakefile ($) { # some useful globals for the subroutines called here local ($makefile) = @_; local @headerdirs = ('.'); local $haveAutomocTag = 0; local $MakefileData = ""; local $cxxsuffix = "KKK"; local @programs = (); # lists the names of programs and libraries local $program = ""; local %realObjs = (); # lists the objects compiled into $program local %sources = (); # lists the sources used for $program local %finalObjs = (); # lists the objects compiled when final local %realname = (); # the binary name of program variable local %idlfiles = (); # lists the idl files used for $program local %globalmocs = ();# list of all mocfiles (in %mocFiles format) local %important = (); # list of files to be generated asap local %uiFiles = (); local $allidls = ""; local $idl_output = "";# lists all idl generated files for cleantarget local $ui_output = "";# lists all uic generated files for cleantarget local %depedmocs = (); local $metasourceTags = 0; local $dep_files = ""; local $dep_finals = ""; local %target_adds = (); # the targets to add local $kdelang = ""; local @cleanfiles = (); local $cleanMoc = ""; local $closure_output = ""; $makefileDir = dirname($makefile); chdir ($makefileDir); $printname = $makefile; $printname =~ s/^\Q$topdir\E\///; $makefile = basename($makefile); print STDOUT "Processing makefile $printname\n" if ($verbose); # Setup and see if we need to do this. return if (!initialise()); tag_AUTOMAKE (); # Allows a "make" to redo the Makefile.in tag_META_INCLUDES (); # Supplies directories for src locations foreach $program (@programs) { $sources_changed{$program} = 0; $depedmocs{$program} = ""; $important{$program} = ""; tag_IDLFILES(); # Sorts out idl rules tag_CLOSURE(); tag_UIFILES(); # Sorts out ui rules tag_METASOURCES (); # Sorts out the moc rules if ($sources_changed{$program}) { my $lookup = "$program" . '_SOURCES\s*=\s*(.*)'; substituteLine($lookup, "$program\_SOURCES=" . $sources{$program}); } if ($important{$program}) { local %source_dict = (); for $source (split(/[\034\s]+/, $sources{$program})) { $source_dict{$source} = 1; } for $source (@cleanfiles) { $source_dict{$source} = 0; } for $source (keys %source_dict) { next if (!$source); if ($source_dict{$source}) { # sanity check if (! -f $source) { print STDERR "Error: $source is listed in a _SOURCE line in $printname, but doesn't exist yet. Put it in DISTCLEANFILES!\n"; } else { $target_adds{"\$(srcdir)/$source"} .= $important{$program}; } } } } } if ($cleanMoc) { # Always add dist clean tag # Add extra *.moc.cpp files created for USE_AUTOMOC because they # aren't included in the normal *.moc clean rules. appendLines ("$cleantarget-metasources:\n\t-rm -f $cleanMoc\n"); $target_adds{"$cleantarget-am"} .= "$cleantarget-metasources "; } tag_DIST() unless ($kdeopts{"noautodist"}); if ($idl_output) { appendLines ("$cleantarget-idl:\n\t-rm -f $idl_output\n"); $target_adds{"$cleantarget-am"} .= "$cleantarget-idl "; } if ($ui_output) { appendLines ("$cleantarget-ui:\n\t-rm -f $ui_output\n"); $target_adds{"$cleantarget-am"} .= "$cleantarget-ui "; } if ($closure_output) { appendLines ("$cleantarget-closures:\n\t-rm -f $closure_output\n"); $target_adds{"$cleantarget-am"} .= "$cleantarget-closures "; } if ($MakefileData =~ /\nKDE_LANG\s*=\s*(\S*)\s*\n/) { $kdelang = '$(KDE_LANG)' } else { $kdelang = ''; } tag_POFILES (); # language rules for po directory tag_DOCFILES (); # language rules for doc directories tag_LOCALINSTALL(); # add $(DESTDIR) before all kde_ dirs tag_ICON(); tag_SUBDIRS(); my $tmp = "force-reedit:\n"; $tmp .= "\t$automkCall\n\tcd \$(top_srcdir) && perl $thisProg $printname\n\n"; appendLines($tmp); make_meta_classes(); tag_COMPILE_FIRST(); tag_FINAL() if (!$kdeopts{"nofinal"}); my $final_lines = "final:\n\t\$(MAKE) "; my $final_install_lines = "final-install:\n\t\$(MAKE) "; my $nofinal_lines = "no-final:\n\t\$(MAKE) "; my $nofinal_install_lines = "no-final-install:\n\t\$(MAKE) "; foreach $program (@programs) { my $lookup = "$program\_OBJECTS.*=[^\n]*"; my $new = ""; my @list = split(/[\034\s]+/, $realObjs{$program}); if (!$kdeopts{"nofinal"} && @list > 1 && $finalObjs{$program}) { $new .= "$program\_final\_OBJECTS = " . $finalObjs{$program}; $new .= "\n$program\_nofinal\_OBJECTS = " . $realObjs{$program}; $new .= "\n\@KDE_USE_FINAL_FALSE\@$program\_OBJECTS = \$($program\_nofinal\_OBJECTS)"; $new .= "\n\@KDE_USE_FINAL_TRUE\@$program\_OBJECTS = \$($program\_final\_OBJECTS)"; $final_lines .= "$program\_OBJECTS=\"\$($program\_final_OBJECTS)\" "; $final_install_lines .= "$program\_OBJECTS=\"\$($program\_final_OBJECTS)\" "; $nofinal_lines .= "$program\_OBJECTS=\"\$($program\_nofinal\_OBJECTS)\" "; $nofinal_install_lines .= "$program\_OBJECTS=\"\$($program\_nofinal_OBJECTS)\" "; } else { $new = "$program\_OBJECTS = " . $realObjs{$program}; } substituteLine ($lookup, $new); } appendLines($final_lines . "all-am"); appendLines($final_install_lines . "install-am"); appendLines($nofinal_lines . "all-am"); appendLines($nofinal_install_lines . "install-am"); my $lookup = 'DEP_FILES\s*=([^\n]*)'; if ($MakefileData =~ /\n$lookup\n/o) { $depfiles = $1; if ($dep_finals) { $lines = "\@KDE_USE_FINAL_TRUE\@DEP_FILES = $dep_files $dep_finals \034\t$depfiles\n"; $lines .= "\@KDE_USE_FINAL_FALSE\@DEP_FILES = $dep_files $depfiles\n"; } else { $lines = "DEP_FILES = $dep_files $depfiles\n"; } substituteLine($lookup, $lines); } my $cvs_lines = "cvs-clean:\n"; $cvs_lines .= "\t\$(MAKE) -f \$(top_srcdir)/admin/Makefile.common cvs-clean\n"; appendLines($cvs_lines); $cvs_lines = "kde-rpo-clean:\n"; $cvs_lines .= "\t-rm -f *.rpo\n"; appendLines($cvs_lines); $target_adds{"clean"} .= "kde-rpo-clean "; # some strange people like to do a install-exec, and expect that also # all modules are installed. automake doesn't know this, so we need to move # this here from install-data to install-exec. if ($MakefileData =~ m/\nkde_module_LTLIBRARIES\s*=/) { $target_adds{"install-exec-am"} .= "install-kde_moduleLTLIBRARIES"; my $lookup = 'install-data-am:\s*(.*)'; if ($MakefileData =~ /\n$lookup\n/) { my $newdeps = $1; $newdeps =~ s/\s*install-kde_moduleLTLIBRARIES\s*/ /g; substituteLine($lookup, "install-data-am: " . $newdeps); } } my $lines = ""; foreach $add (keys %target_adds) { my $lookup = quotemeta($add) . ':([^\n]*)'; if ($MakefileData =~ /\n$lookup\n/) { substituteLine($lookup, "$add: " . $target_adds{$add} . $1); } else { $lines .= "$add: " . $target_adds{$add} . "\n"; } } if ($lines) { appendLines($lines); } my $found = 1; while ($found) { if ($MakefileData =~ m/\n(.*)\$\(CXXFLAGS\)(.*)\n/) { my $vor = $1; # "vor" means before in German my $nach = $2; # "nach" means after in German my $lookup = quotemeta("$1\$(CXXFLAGS)$2"); my $replacement = "$1\$(KCXXFLAGS)$2"; $MakefileData =~ s/$lookup/$replacement/; $lookup =~ s/\\\$\\\(CXXFLAGS\\\)/\\\$\\\(KCXXFLAGS\\\)/; $replacement = "$vor\$(KCXXFLAGS) \$(KDE_CXXFLAGS)$nach"; substituteLine($lookup, $replacement); } else { $found = 0; } } if($foreign_libtool == 0) { $lookup = '(\n[^#].*\$\(LIBTOOL\) --mode=link) (\$\(CXXLD\).*\$\(KCXXFLAGS\))'; if ($MakefileData =~ m/$lookup/ ) { $MakefileData =~ s/$lookup/$1 --tag=CXX $2/; } $lookup = '(\n[^#].*\$\(LIBTOOL\) --mode=compile)\s+(\$\(CXX\)\s+)'; if ($MakefileData =~ m/$lookup/ ) { $MakefileData =~ s/$lookup/$1 --tag=CXX $2/; } } $MakefileData =~ s/\$\(KCXXFLAGS\)/\$\(CXXFLAGS\)/g; $lookup = '(.*)cp -pr \$\$/\$\$file \$\(distdir\)/\$\$file(.*)'; if ($MakefileData =~ m/\n$lookup\n/) { substituteLine($lookup, "$1cp -pr \$\$d/\$\$file \$(distdir)/\$\$file$2"); } # Always update the Makefile.in updateMakefile (); return; } #----------------------------------------------------------------------------- # Check to see whether we should process this make file. # This is where we look for tags that we need to process. # A small amount of initialising on the tags is also done here. # And of course we open and/or create the needed make files. sub initialise () { if (! -r "Makefile.am") { print STDOUT "found Makefile.in without Makefile.am\n" if ($verbose); return 0; } # Checking for files to process... open (FILEIN, $makefile) || die "Could not open $makefileDir/$makefile: $!\n"; # Read the file # stat(FILEIN)[7] might look more elegant, but is slower as it # requires stat'ing the file seek(FILEIN, 0, 2); my $fsize = tell(FILEIN); seek(FILEIN, 0, 0); read FILEIN, $MakefileData, $fsize; close FILEIN; print "DOS CRLF within $makefileDir/$makefile!\n" if($MakefileData =~ y/\r//d); # Remove the line continuations, but keep them marked # Note: we lose the trailing spaces but that's ok. $MakefileData =~ s/\\\s*\n\s*/\034/g; # If we've processed the file before... restoreMakefile () if ($MakefileData =~ /$progId/); foreach $dir (@foreignfiles) { if (substr($makefileDir,0,length($dir)) eq $dir) { return 0; } } %kdeopts = (); $kdeopts{"foreign"} = 0; $kdeopts{"qtonly"} = 0; $kdeopts{"noautodist"} = 0; $kdeopts{"foreign-libtool"} = $foreign_libtool; $kdeopts{"nofinal"} = !$use_final; # default if ($MakefileData =~ /\nKDE_OPTIONS\s*=\s*([^\n]*)\n/) { local @kde_options = split(/[\s\034]/, $1); if (grep(/^foreign$/, @kde_options)) { push(@foreignfiles, $makefileDir . "/"); return 0; # don't touch me } for $opt (@kde_options) { if (!defined $kdeopts{$opt}) { print STDERR "Warning: unknown option $opt in $printname\n"; } else { $kdeopts{$opt} = 1; } } } # Look for the tags that mean we should process this file. $metasourceTags = 0; $metasourceTags++ while ($MakefileData =~ /\n[^=\#]*METASOURCES\s*=/g); my $pofileTag = 0; $pofileTag++ while ($MakefileData =~ /\nPOFILES\s*=/g); if ($pofileTag > 1) { print STDERR "Error: Only one POFILES tag allowed\n"; $errorflag = 1; } while ($MakefileData =~ /\n\.SUFFIXES:([^\n]+)\n/g) { my @list=split(' ', $1); foreach $ext (@list) { if ($ext =~ /^\.$cppExt$/) { $cxxsuffix = $ext; $cxxsuffix =~ s/\.//g; print STDOUT "will use suffix $cxxsuffix\n" if ($verbose); last; } } } while ($MakefileData =~ /\n(\S*)_OBJECTS\s*=[ \t\034]*([^\n]*)\n/g) { my $program = $1; my $objs = $2; # safe them my $ocv = 0; my @objlist = split(/[\s\034]+/, $objs); foreach $obj (@objlist) { if ($obj =~ /\$\((\S+)\)/ ) { my $variable = $1; if ($variable !~ 'OBJEXT') { $ocv = 1; } } } next if ($ocv); $program =~ s/^am_// if ($program =~ /^am_/); my $sourceprogram = $program; $sourceprogram =~ s/\@am_/\@/ if($sourceprogram =~ /^.*\@am_.+/); print STDOUT "found program $program\n" if ($verbose); push(@programs, $program); $realObjs{$program} = $objs; if ($MakefileData =~ /\n$sourceprogram\_SOURCES\s*=\s*(.*)\n/) { $sources{$program} = $1; } else { $sources{$program} = ""; print STDERR "found program with no _SOURCES: $program\n"; } my $realprogram = $program; $realprogram =~ s/_/./g; # unmask to regexp if ($MakefileData =~ /\n($realprogram)(\$\(EXEEXT\)?)?:.*\$\($program\_OBJECTS\)/) { $realname{$program} = $1; } else { # not standard Makefile - nothing to worry about $realname{$program} = ""; } } my $lookup = '\nDEPDIR\s*=.*'; if ($MakefileData !~ /($lookup)\n/o) { $lookup = '\nbindir\s*=.*'; if ($MakefileData =~ /($lookup)\n/) { substituteLine ($lookup, "DEPDIR = .deps\n$1"); } } my @marks = ('MAINTAINERCLEANFILES', 'CLEANFILES', 'DISTCLEANFILES'); foreach $mark (@marks) { while ($MakefileData =~ /\n($mark)\s*=\s*([^\n]*)/g) { foreach $file (split('[\034\s]', $2)) { $file =~ s/\.\///; push(@cleanfiles, $file); } } } my $localTag = 0; $localTag++ if ($MakefileData =~ /\ninstall-\S+-local:/); return (!$errorflag); } #----------------------------------------------------------------------------- # Gets the list of user defined directories - relative to $srcdir - where # header files could be located. sub tag_META_INCLUDES () { my $lookup = '[^=\n]*META_INCLUDES\s*=\s*(.*)'; return 1 if ($MakefileData !~ /($lookup)\n/o); print STDOUT "META_INCLUDE processing <$1>\n" if ($verbose); my $headerStr = $2; removeLine ($lookup, $1); $headerStr =~ tr/\034/ /; my @headerlist = split(' ', $headerStr); foreach $dir (@headerlist) { $dir =~ s#\$\(srcdir\)#.#; if (! -d $dir) { print STDERR "Warning: $dir can't be found. ", "Must be a relative path to \$(srcdir)\n"; } else { push (@headerdirs, $dir); } } return 0; } #----------------------------------------------------------------------------- sub tag_FINAL() { my @final_names = (); foreach $program (@programs) { if ($sources{$program} =~ /\(/) { print STDOUT "found ( in $program\_SOURCES. skipping\n" if ($verbose); next; } my $mocsources = ""; my @progsources = split(/[\s\034]+/, $sources{$program}); my %sourcelist = (); foreach $source (@progsources) { my $suffix = $source; $suffix =~ s/^.*\.([^\.]+)$/$1/; if (defined($sourcelist{$suffix})) { $sourcelist{$suffix} .= " " . $source; } else { $sourcelist{$suffix} .= $source; } } foreach $suffix (keys %sourcelist) { # See if this file contains c++ code. (ie Just check the files suffix against my $suffix_is_cxx = 0; if($suffix =~ /($cppExt)$/) { $cxxsuffix = $1; $suffix_is_cxx = 1; } my $mocfiles_in = ($suffix eq $cxxsuffix) && defined($depedmocs{$program}); my @sourcelist = split(/[\s\034]+/, $sourcelist{$suffix}); if ((@sourcelist == 1 && !$mocfiles_in) || $suffix_is_cxx != 1 ) { # we support IDL on our own if ($suffix =~ /^skel$/ || $suffix =~ /^stub/ || $suffix =~ /^signals/ || $suffix =~ /^h$/ || $suffix =~ /^ui$/ ) { next; } foreach $file (@sourcelist) { $file =~ s/\Q$suffix\E$//; $finalObjs{$program} .= $file; if ($program =~ /_la$/) { $finalObjs{$program} .= "lo "; } else { $finalObjs{$program} .= "o "; } } next; # suffix } my $source_deps = ""; foreach $source (@sourcelist) { if (-f $source) { $source_deps .= "\$(srcdir)/$source "; } else { $source_deps .= "$source "; } } $handling = "$program.all_$suffix.$suffix: \$(srcdir)/Makefile.in " . $source_deps . " "; if ($mocfiles_in) { $handling .= $depedmocs{$program}; foreach $mocfile (split(' ', $depedmocs{$program})) { if ($mocfile =~ m/\.$suffix$/) { $mocsources .= " " . $mocfile; } } } $handling .= "\n"; $handling .= "\t\@echo 'creating $program.all_$suffix.$suffix ...'; \\\n"; $handling .= "\trm -f $program.all_$suffix.files $program.all_$suffix.final; \\\n"; $handling .= "\techo \"#define KDE_USE_FINAL 1\" >> $program.all_$suffix.final; \\\n"; $handling .= "\tfor file in " . $sourcelist{$suffix} . " $mocsources; do \\\n"; $handling .= "\t echo \"#include \\\"\$\$file\\\"\" >> $program.all_$suffix.files; \\\n"; $handling .= "\t test ! -f \$\(srcdir\)/\$\$file || egrep '^#pragma +implementation' \$\(srcdir\)/\$\$file >> $program.all_$suffix.final; \\\n"; $handling .= "\tdone; \\\n"; $handling .= "\tcat $program.all_$suffix.final $program.all_$suffix.files > $program.all_$suffix.$suffix; \\\n"; $handling .= "\trm -f $program.all_$suffix.final $program.all_$suffix.files\n"; appendLines($handling); push(@final_names, "$program.all_$suffix.$suffix"); $finalObjs{$program} .= "$program.all_$suffix."; if ($program =~ /_la$/) { $finalObjs{$program} .= "lo "; } else { $finalObjs{$program} .= "o "; } } } if (!$kdeopts{"nofinal"} && @final_names >= 1) { # add clean-final target my $lines = "$cleantarget-final:\n"; $lines .= "\t-rm -f " . join(' ', @final_names) . "\n" if (@final_names); appendLines($lines); $target_adds{"$cleantarget-am"} .= "$cleantarget-final "; foreach $finalfile (@final_names) { $finalfile =~ s/\.[^.]*$/.P/; $dep_finals .= " \$(DEPDIR)/$finalfile"; } } } #----------------------------------------------------------------------------- sub tag_COMPILE_FIRST() { foreach $program (@programs) { my $lookup = "$program" . '_COMPILE_FIRST\s*=\s*(.*)'; if ($MakefileData =~ m/\n$lookup\n/) { my @compilefirst = split(/[\s\034]+/, $1); my @progsources = split(/[\s\034]+/, $sources{$program}); my %donesources = (); $handling = ""; foreach $source (@progsources) { my @deps = (); my $sdeps = ""; if (-f $source) { $sdeps = "\$(srcdir)/$source"; } else { $sdeps = "$source"; } foreach $depend (@compilefirst) { next if ($source eq $depend); # avoid cyclic dependencies next if defined($donesources{$depend}); push @deps, $depend; } $handling .= "$sdeps: " . join(' ', @deps) . "\n" if (@deps); $donesources{$source} = 1; } appendLines($handling) if (length($handling)); } } } #----------------------------------------------------------------------------- # Organises the list of headers that we'll use to produce moc files # from. sub tag_METASOURCES () { local @newObs = (); # here we add to create object files local @deped = (); # here we add to create moc files local $mocExt = ".moc"; local %mocFiles = (); my $line = ""; my $postEqual = ""; my $lookup; my $found = ""; if ($metasourceTags > 1) { $lookup = $program . '_METASOURCES\s*=\s*(.*)'; return 1 if ($MakefileData !~ /\n($lookup)\n/); $found = $1; } else { $lookup = $program . '_METASOURCES\s*=\s*(.*)'; if ($MakefileData !~ /\n($lookup)\n/) { $lookup = 'METASOURCES\s*=\s*(.*)'; return 1 if ($MakefileData !~ /\n($lookup)\n/o); $found = $1; $metasourceTags = 0; # we can use the general target only once } else { $found = $1; } } print STDOUT "METASOURCE processing <$found>)\n" if ($verbose); $postEqual = $found; $postEqual =~ s/[^=]*=//; removeLine ($lookup, $found); # Always find the header files that could be used to "moc" return 1 if (findMocCandidates ()); if ($postEqual =~ /AUTO\s*(\S*)|USE_AUTOMOC\s*(\S*)/) { print STDERR "$printname: the argument for AUTO|USE_AUTOMOC is obsolete" if ($+); $mocExt = ".moc.$cxxsuffix"; $haveAutomocTag = 1; } else { # Not automoc so read the list of files supplied which # should be .moc files. $postEqual =~ tr/\034/ /; # prune out extra headers - This also checks to make sure that # the list is valid. pruneMocCandidates ($postEqual); } checkMocCandidates (); if (@newObs) { my $ext = ($program =~ /_la$/) ? ".moc.lo " : ".moc.o "; $realObjs{$program} .= "\034" . join ($ext, @newObs) . $ext; $depedmocs{$program} = join (".moc.$cxxsuffix " , @newObs) . ".moc.$cxxsuffix"; foreach $file (@newObs) { $dep_files .= " \$(DEPDIR)/$file.moc.P" if($dep_files !~/$file.moc.P/); } } if (@deped) { $depedmocs{$program} .= " "; $depedmocs{$program} .= join('.moc ', @deped) . ".moc"; $depedmocs{$program} .= " "; } addMocRules (); @globalmocs{keys %mocFiles}=values %mocFiles; } #----------------------------------------------------------------------------- # Returns 0 if the line was processed - 1 otherwise. # Errors are logged in the global $errorflags sub tag_AUTOMAKE () { my $lookup = '.*cd \$\(top_srcdir\)\s+&&[\s\034]+\$\(AUTOMAKE\)(.*)'; return 1 if ($MakefileData !~ /\n($lookup)\n/); print STDOUT "AUTOMAKE processing <$1>\n" if ($verbose); my $newLine = $1."\n\tcd \$(top_srcdir) && perl $thisProg $printname"; substituteLine ($lookup, $newLine); $automkCall = $1; return 0; } #----------------------------------------------------------------------------- sub handle_TOPLEVEL() { my $pofiles = ""; my @restfiles = (); opendir (THISDIR, "."); foreach $entry (readdir(THISDIR)) { next if (-d $entry); next if ($entry eq "CVS" || $entry =~ /^\./ || $entry =~ /^Makefile/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/ || $entry =~ /.gmo$/); if ($entry =~ /\.po$/) { next; } push(@restfiles, $entry); } closedir (THISDIR); if (@restfiles) { $target_adds{"install-data-am"} .= "install-nls-files "; $lines = "install-nls-files:\n"; $lines .= "\t\$(mkinstalldirs) \$(DESTDIR)\$(kde_locale)/$kdelang\n"; for $file (@restfiles) { $lines .= "\t\$(INSTALL_DATA) \$\(srcdir\)/$file \$(DESTDIR)\$(kde_locale)/$kdelang/$file\n"; } $target_adds{"uninstall"} .= "uninstall-nls-files "; $lines .= "uninstall-nls-files:\n"; for $file (@restfiles) { $lines .= "\t-rm -f \$(DESTDIR)\$(kde_locale)/$kdelang/$file\n"; } appendLines($lines); } return 0; } #----------------------------------------------------------------------------- sub tag_SUBDIRS () { if ($MakefileData !~ /\nSUBDIRS\s*=\s*\$\(AUTODIRS\)\s*\n/) { return 1; } my $subdirs = "."; opendir (THISDIR, "."); foreach $entry (readdir(THISDIR)) { next if ($entry eq "CVS" || $entry =~ /^\./); if (-d $entry && -f $entry . "/Makefile.am") { $subdirs .= " $entry"; next; } } closedir (THISDIR); my $lines = "SUBDIRS =$subdirs\n"; substituteLine('SUBDIRS\s*=.*', $lines); return 0; } sub tag_IDLFILES () { my @psources = split(/[\034\s]+/, $sources{$program}); my $dep_lines = ""; my @cppFiles = (); foreach $source (@psources) { my $skel = ($source =~ m/\.skel$/); my $stub = ($source =~ m/\.stub$/); my $signals = ($source =~ m/\.signals$/); if ($stub || $skel || $signals) { my $qs = quotemeta($source); $sources{$program} =~ s/$qs//; $sources_changed{$program} = 1; print STDOUT "adding IDL file $source\n" if ($verbose); $source =~ s/\.(stub|skel|signals)$//; my $sourcename; if ($skel) { $sourcename = "$source\_skel"; } elsif ($stub) { $sourcename = "$source\_stub"; } else { $sourcename = "$source\_signals"; } my $sourcedir = ''; if (-f "$makefileDir/$source.h") { $sourcedir = '$(srcdir)/'; } else { if ($MakefileData =~ /\n$source\_DIR\s*=\s*(\S+)\n/) { $sourcedir = $1; $sourcedir .= "/" if ($sourcedir !~ /\/$/); } } if ($allidls !~ /$source\_kidl/) { $dep_lines .= "$source.kidl: $sourcedir$source.h \$(DCOPIDL_DEPENDENCIES)\n"; $dep_lines .= "\t\$(DCOPIDL) $sourcedir$source.h > $source.kidl || ( rm -f $source.kidl ; /bin/false )\n"; $allidls .= $source . "_kidl "; } if ($allidls !~ /$sourcename/) { $dep_lines_tmp = ""; if ($skel) { $dep_lines .= "$sourcename.$cxxsuffix: $source.kidl\n"; $dep_lines .= "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-signals --no-stub $source.kidl\n"; } elsif ($stub) { $dep_lines_tmp = "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-signals --no-skel $source.kidl\n"; } else { # signals $dep_lines_tmp = "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-stub --no-skel $source.kidl\n"; } if ($stub || $signals) { $target_adds{"$sourcename.$cxxsuffix"} .= "$sourcename.h "; $dep_lines .= "$sourcename.h: $source.kidl\n"; $dep_lines .= $dep_lines_tmp; } $allidls .= $sourcename . " "; } $idlfiles{$program} .= $sourcename . " "; if ($program =~ /_la$/) { $realObjs{$program} .= " $sourcename.lo"; } else { $realObjs{$program} .= " $sourcename.\$(OBJEXT)"; } $sources{$program} .= " $sourcename.$cxxsuffix"; $sources_changed{$program} = 1; $important{$program} .= "$sourcename.h " if (!$skel); $idl_output .= "\\\n\t$sourcename.$cxxsuffix $sourcename.h $source.kidl "; push(@cleanfiles, "$sourcename.$cxxsuffix"); push(@cleanfiles, "$sourcename.h"); push(@cleanfiles, "$sourcename.kidl"); $dep_files .= " \$(DEPDIR)/$sourcename.P" if ($dep_files !~/$sourcename.P/); } } if ($dep_lines) { appendLines($dep_lines); } if (0) { my $lookup = "($program)"; $lookup .= '(|\$\(EXEEXT\))'; $lookup =~ s/\_/./g; $lookup .= ":(.*..$program\_OBJECTS..*)"; # $lookup = quotemeta($lookup); if ($MakefileData =~ /\n$lookup\n/) { my $line = "$1$2: "; foreach $file (split(' ', $idlfiles{$program})) { $line .= "$file.$cxxsuffix "; } $line .= $3; substituteLine($lookup, $line); } else { print STDERR "no built dependency found $lookup\n"; } } } sub tag_UIFILES () { my @psources = split(/[\034\s]+/, $sources{$program}); my $dep_lines = ""; my @depFiles = (); foreach $source (@psources) { if ($source =~ m/\.ui$/) { print STDERR "adding UI file $source\n" if ($verbose); my $qs = quotemeta($source); $sources{$program} =~ s/$qs//; $sources_changed{$program} = 1; $source =~ s/\.ui$//; my $sourcedir = ''; if (-f "$makefileDir/$source.ui") { $sourcedir = '$(srcdir)/'; } if (!$uiFiles{$source}) { $dep_lines .= "$source.$cxxsuffix: $sourcedir$source.ui $source.h $source.moc\n"; $dep_lines .= "\trm -f $source.$cxxsuffix\n"; if (!$kdeopts{"qtonly"}) { $dep_lines .= "\techo '#include ' > $source.$cxxsuffix\n"; my ($mangled_source) = $source; $mangled_source =~ s/[^A-Za-z0-9]/_/g; # get rid of garbage $dep_lines .= "\t\$(UIC) -tr \${UIC_TR} -i $source.h $sourcedir$source.ui | sed -e \"s,\${UIC_TR}( \\\"\\\" ),QString::null,g\" | sed -e \"s,\${UIC_TR}( \\\"\\\"\\, \\\"\\\" ),QString::null,g\" | sed -e \"s,image\\([0-9][0-9]*\\)_data,img\\1_" . $mangled_source . ",g\" >> $source.$cxxsuffix || rm -f $source.$cxxsuffix\n"; } else { $dep_lines .= "\t\$(UIC) -i $source.h $sourcedir$source.ui > $source.$cxxsuffix || rm -f $source.$cxxsuffix\n"; } $dep_lines .= "\techo '#include \"$source.moc\"' >> $source.$cxxsuffix\n\n"; $dep_lines .= "$source.h: $sourcedir$source.ui\n"; $dep_lines .= "\t\$(UIC) -o $source.h $sourcedir$source.ui\n\n"; $dep_lines .= "$source.moc: $source.h\n"; $dep_lines .= "\t\$(MOC) $source.h -o $source.moc\n"; $uiFiles{$source} = 1; $depedmocs{$program} .= " $source.moc"; $globalmocs{$source} = "\035$source.h\035$source.cpp"; } if ($program =~ /_la$/) { $realObjs{$program} .= " $source.lo"; } else { $realObjs{$program} .= " $source.\$(OBJEXT)"; } $sources{$program} .= " $source.$cxxsuffix"; $sources_changed{$program} = 1; $important{$program} .= "$source.h "; $ui_output .= "\\\n\t$source.$cxxsuffix $source.h $source.moc "; push(@cleanfiles, "$source.$cxxsuffix"); push(@cleanfiles, "source.h"); push(@cleanfiles, "$source.moc"); $dep_files .= " \$(DEPDIR)/$source.P" if($dep_files !~/$source.P/ ); } } if ($dep_lines) { appendLines($dep_lines); } } sub tag_ICON() { my $lookup = '([^\s]*)_ICON\s*=\s*([^\n]*)'; my $install = ""; my $uninstall = ""; while ($MakefileData =~ /\n$lookup/og) { my $destdir; if ($1 eq "KDE") { $destdir = "kde_icondir"; } else { $destdir = $1 . "dir"; } my $iconauto = ($2 =~ /AUTO\s*$/); my @appnames = (); if ( ! $iconauto ) { my @_appnames = split(" ", $2); print STDOUT "KDE_ICON processing <@_appnames>\n" if ($verbose); foreach $appname (@_appnames) { push(@appnames, quotemeta($appname)); } } else { print STDOUT "KDE_ICON processing \n" if ($verbose); } my @files = (); opendir (THISDIR, "."); foreach $entry (readdir(THISDIR)) { next if ($entry eq "CVS" || $entry =~ /^\./ || $entry =~ /^Makefile/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/); next if (! -f $entry); if ( $iconauto ) { push(@files, $entry) if ($entry =~ /\.xpm/ || $entry =~ /\.png/ || $entry =~ /\.mng/); } else { foreach $appname (@appnames) { push(@files, $entry) if ($entry =~ /-$appname\.xpm/ || $entry =~ /-$appname\.png/ || $entry =~ /-$appname\.mng/); } } } closedir (THISDIR); my %directories = (); foreach $file (@files) { my $newfile = $file; my $prefix = $file; $prefix =~ s/\.(png|xpm|mng)$//; my $appname = $prefix; $appname =~ s/^[^-]+-// if ($appname =~ /-/) ; $appname =~ s/^[^-]+-// if ($appname =~ /-/) ; $appname = quotemeta($appname); $prefix =~ s/$appname$//; $prefix =~ s/-$//; $prefix = 'lo16-app' if ($prefix eq 'mini'); $prefix = 'lo32-app' if ($prefix eq 'lo'); $prefix = 'hi48-app' if ($prefix eq 'large'); $prefix .= '-app' if ($prefix =~ m/^...$/); my $type = $prefix; $type =~ s/^.*-([^-]+)$/$1/; $prefix =~ s/^(.*)-[^-]+$/$1/; my %type_hash = ( 'action' => 'actions', 'app' => 'apps', 'device' => 'devices', 'filesys' => 'filesystems', 'mime' => 'mimetypes' ); if (! defined $type_hash{$type} ) { print STDERR "unknown icon type $type in $printname ($file)\n"; next; } my %dir_hash = ( 'los' => 'locolor/16x16', 'lom' => 'locolor/32x32', 'him' => 'hicolor/32x32', 'hil' => 'hicolor/48x48', 'lo16' => 'locolor/16x16', 'lo22' => 'locolor/22x22', 'lo32' => 'locolor/32x32', 'hi16' => 'hicolor/16x16', 'hi22' => 'hicolor/22x22', 'hi32' => 'hicolor/32x32', 'hi48' => 'hicolor/48x48', 'hi64' => 'hicolor/64x64', 'hisc' => 'hicolor/scalable' ); $newfile =~ s@.*-($appname\.(png|xpm|mng?))@$1@; if (! defined $dir_hash{$prefix}) { print STDERR "unknown icon prefix $prefix in $printname\n"; next; } my $dir = $dir_hash{$prefix} . "/" . $type_hash{$type}; if ($newfile =~ /-[^\.]/) { my $tmp = $newfile; $tmp =~ s/^([^-]+)-.*$/$1/; $dir = $dir . "/" . $tmp; $newfile =~ s/^[^-]+-//; } if (!defined $directories{$dir}) { $install .= "\t\$(mkinstalldirs) \$(DESTDIR)\$($destdir)/$dir\n"; $directories{$dir} = 1; } $install .= "\t\$(INSTALL_DATA) \$(srcdir)/$file \$(DESTDIR)\$($destdir)/$dir/$newfile\n"; $uninstall .= "\t-rm -f \$(DESTDIR)\$($destdir)/$dir/$newfile\n"; } } if (length($install)) { $target_adds{"install-data-am"} .= "install-kde-icons "; $target_adds{"uninstall-am"} .= "uninstall-kde-icons "; appendLines("install-kde-icons:\n" . $install . "\nuninstall-kde-icons:\n" . $uninstall); } } sub handle_POFILES($$) { my @pofiles = split(" ", $_[0]); my $lang = $_[1]; # Build rules for creating the gmo files my $tmp = ""; my $allgmofiles = ""; my $pofileLine = "POFILES ="; foreach $pofile (@pofiles) { $pofile =~ /(.*)\.[^\.]*$/; # Find name minus extension $tmp .= "$1.gmo: $pofile\n"; $tmp .= "\trm -f $1.gmo; \$(GMSGFMT) -o $1.gmo \$(srcdir)/$pofile\n"; $tmp .= "\ttest ! -f $1.gmo || touch $1.gmo\n"; $allgmofiles .= " $1.gmo"; $pofileLine .= " $1.po"; } appendLines ($tmp); my $lookup = 'POFILES\s*=([^\n]*)'; if ($MakefileData !~ /\n$lookup/o) { appendLines("$pofileLine\nGMOFILES =$allgmofiles"); } else { substituteLine ($lookup, "$pofileLine\nGMOFILES =$allgmofiles"); } if ($allgmofiles) { # Add the "clean" rule so that the maintainer-clean does something appendLines ("clean-nls:\n\t-rm -f $allgmofiles\n"); $target_adds{"maintainer-clean"} .= "clean-nls "; $lookup = 'DISTFILES\s*=\s*(.*)'; if ($MakefileData =~ /\n$lookup\n/o) { $tmp = "DISTFILES = \$(GMOFILES) \$(POFILES) $1"; substituteLine ($lookup, $tmp); } } $target_adds{"install-data-am"} .= "install-nls "; $tmp = "install-nls:\n"; if ($lang) { $tmp .= "\t\$(mkinstalldirs) \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES\n"; } $tmp .= "\t\@for base in "; foreach $pofile (@pofiles) { $pofile =~ /(.*)\.[^\.]*$/; # Find name minus extension $tmp .= "$1 "; } $tmp .= "; do \\\n"; if ($lang) { $tmp .= "\t echo \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/\$\$base.mo ;\\\n"; $tmp .= "\t test ! -f \$\$base.gmo || \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/\$\$base.mo ;\\\n" } else { $tmp .= "\t echo \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES/\$(PACKAGE).mo ;\\\n"; $tmp .= "\t \$(mkinstalldirs) \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES ; \\\n"; $tmp .= "\t test ! -f \$\$base.gmo || \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES/\$(PACKAGE).mo ;\\\n"; } $tmp .= "\tdone\n\n"; appendLines ($tmp); $target_adds{"uninstall"} .= "uninstall-nls "; $tmp = "uninstall-nls:\n"; foreach $pofile (@pofiles) { $pofile =~ /(.*)\.[^\.]*$/; # Find name minus extension if ($lang) { $tmp .= "\trm -f \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/$1.mo\n"; } else { $tmp .= "\trm -f \$(DESTDIR)\$(kde_locale)/$1/LC_MESSAGES/\$(PACKAGE).mo\n"; } } appendLines($tmp); $target_adds{"all"} .= "all-nls "; $tmp = "all-nls: \$(GMOFILES)\n"; appendLines($tmp); $target_adds{"distdir"} .= "distdir-nls "; $tmp = "distdir-nls:\$(GMOFILES)\n"; $tmp .= "\tfor file in \$(POFILES); do \\\n"; $tmp .= "\t cp \$(srcdir)/\$\$file \$(distdir); \\\n"; $tmp .= "\tdone\n"; $tmp .= "\tfor file in \$(GMOFILES); do \\\n"; $tmp .= "\t cp \$(srcdir)/\$\$file \$(distdir); \\\n"; $tmp .= "\tdone\n"; appendLines ($tmp); if (!$lang) { appendLines("merge:\n\t\$(MAKE) -f \$(top_srcdir)/admin/Makefile.common package-merge POFILES=\"\${POFILES}\" PACKAGE=\${PACKAGE}\n\n"); } } #----------------------------------------------------------------------------- # Returns 0 if the line was processed - 1 otherwise. # Errors are logged in the global $errorflags sub tag_POFILES () { my $lookup = 'POFILES\s*=([^\n]*)'; return 1 if ($MakefileData !~ /\n$lookup/o); print STDOUT "POFILES processing <$1>\n" if ($verbose); my $tmp = $1; # make sure these are all gone. if ($MakefileData =~ /\n\.po\.gmo:\n/) { print STDERR "Warning: Found old .po.gmo rules in $printname. New po rules not added\n"; return 1; } # Either find the pofiles in the directory (AUTO) or use # only the specified po files. my $pofiles = ""; if ($tmp =~ /^\s*AUTO\s*$/) { opendir (THISDIR, "."); $pofiles = join(" ", grep(/\.po$/, readdir(THISDIR))); closedir (THISDIR); print STDOUT "pofiles found = $pofiles\n" if ($verbose); if (-f "charset" && -f "kdelibs.po") { handle_TOPLEVEL(); } } else { $tmp =~ s/\034/ /g; $pofiles = $tmp; } return 1 if (!$pofiles); # Nothing to do handle_POFILES($pofiles, $kdelang); return 0; } sub helper_LOCALINSTALL($) { my $lookup = "\n" . $_[0] . ":"; if ($MakefileData =~ /($lookup)/) { my $install = $MakefileData; $install =~ s/\n/\035/g; $install =~ s/.*\035$_[0]:[^\035]*\035//; my $emptyline = 0; while (! $emptyline) { if ($install =~ /([^\035]*)\035(.*)/) { local $line = $1; $install = $2; if ($line !~ /^\s*$/ && $line !~ /^(\@.*\@)*\t/) { $emptyline = 1; } else { replaceDestDir($line); } } else { $emptyline = 1; } } } } sub tag_LOCALINSTALL () { helper_LOCALINSTALL('install-exec-local'); helper_LOCALINSTALL('install-data-local'); helper_LOCALINSTALL('uninstall-local'); return 0; } sub replaceDestDir($) { local $line = $_[0]; if ( $line =~ /^\s*(\@.*\@)*\s*\$\(mkinstalldirs\)/ || $line =~ /^\s*(\@.*\@)*\s*\$\(INSTALL\S*\)/ || $line =~ /^\s*(\@.*\@)*\s*(-?rm.*) \S*$/) { $line =~ s/^(.*) ([^\s]+)\s*$/$1 \$(DESTDIR)$2/ if ($line !~ /\$\(DESTDIR\)/); } if ($line ne $_[0]) { $_[0] = quotemeta $_[0]; substituteLine($_[0], $line); } } #--------------------------------------------------------------------------- sub tag_CLOSURE () { return if ($program !~ /_la$/); my $lookup = quotemeta($realname{$program}) . ":.*?\n\t.*?\\((.*?)\\) .*\n"; $MakefileData =~ m/$lookup/; return if ($1 !~ /CXXLINK/); if ($MakefileData !~ /\n$program\_LDFLAGS\s*=.*-no-undefined/ && $MakefileData !~ /\n$program\_LDFLAGS\s*=.*KDE_PLUGIN/ ) { print STDERR "Report: $program contains undefined in $printname\n" if ($program =~ /^lib/ && $dryrun); return; } my $closure = $realname{$program} . ".closure"; my $lines = "$closure: \$($program\_OBJECTS) \$($program\_DEPENDENCIES)\n"; $lines .= "\t\@echo \"int main() {return 0;}\" > $program\_closure.$cxxsuffix\n"; $lines .= "\t\@\$\(LTCXXCOMPILE\) -c $program\_closure.$cxxsuffix\n"; $lines .= "\t\$\(CXXLINK\) $program\_closure.lo \$($program\_LDFLAGS) \$($program\_OBJECTS) \$($program\_LIBADD) \$(LIBS)\n"; $lines .= "\t\@rm -f $program\_closure.* $closure\n"; $lines .= "\t\@echo \"timestamp\" > $closure\n"; $lines .= "\n"; appendLines($lines); $lookup = $realname{$program} . ": (.*)"; if ($MakefileData =~ /\n$lookup\n/) { $lines = "\@KDE_USE_CLOSURE_TRUE@". $realname{$program} . ": $closure $1"; $lines .= "\n\@KDE_USE_CLOSURE_FALSE@" . $realname{$program} . ": $1"; substituteLine($lookup, $lines); } $closure_output .= " $closure"; } sub tag_DIST () { my %foundfiles = (); opendir (THISDIR, "."); foreach $entry (readdir(THISDIR)) { next if ($entry eq "CVS" || $entry =~ /^\./ || $entry =~ /^Makefile$$/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/); next if (! -f $entry); next if ($entry =~ /\.moc/ || $entry =~ /\.lo$/ || $entry =~ /\.la$/ || $entry =~ /\.o/); next if ($entry =~ /.+meta_unload.$cppExt$/ || $entry =~ /\.all_$cppExt\.$cppExt$/); $foundfiles{$entry} = 1; } closedir (THISDIR); # doing this for MAINTAINERCLEANFILES would be wrong my @marks = ("EXTRA_DIST", "DIST_COMMON", '\S*_SOURCES', '\S*_HEADERS', 'CLEANFILES', 'DISTCLEANFILES', '\S*_OBJECTS'); foreach $mark (@marks) { while ($MakefileData =~ /\n($mark)\s*=\s*([^\n]*)/g) { foreach $file (split('[\034\s]', $2)) { $file =~ s/\.\///; $foundfiles{$file} = 0 if (defined $foundfiles{$file}); } } } my @files = ("Makefile", "config.cache", "config.log", "stamp-h", "stamp-h1", "stamp-h1", "config.h", "Makefile", "config.status", "config.h", "libtool"); foreach $file (@files) { $foundfiles{$file} = 0 if (defined $foundfiles{$file}); } my $KDE_DIST = ""; foreach $file (keys %foundfiles) { if ($foundfiles{$file} == 1) { $KDE_DIST .= "$file "; } } if ($KDE_DIST) { print "KDE_DIST $printname $KDE_DIST\n" if ($verbose); my $lookup = "DISTFILES *=(.*)"; if ($MakefileData =~ /\n$lookup\n/o) { substituteLine($lookup, "KDE_DIST=$KDE_DIST\n\nDISTFILES=$1 \$(KDE_DIST)\n"); } } } #----------------------------------------------------------------------------- # Returns 0 if the line was processed - 1 otherwise. # Errors are logged in the global $errorflags sub tag_DOCFILES () { # if ($MakefileData =~ /\nSUBDIRS\s*=/) { # subdirs # $MakefileData =~ /\n(.*-recursive:\s*)\n/; # my $orig_rules = $1; # my $rules = $orig_rules; # $rules =~ s/:\s*$//; # substituteLine($orig_rules, "$rules docs-recursive:"); # appendLines("docs: docs-recursive docs-am\n"); # } else { # appendLines("docs: docs-am\n"); # } $target_adds{"all"} .= "docs-am "; my $lookup = 'KDE_DOCS\s*=\s*([^\n]*)'; goto nodocs if ($MakefileData !~ /\n$lookup/o); print STDOUT "KDE_DOCS processing <$1>\n" if ($verbose); my $tmp = $1; # Either find the files in the directory (AUTO) or use # only the specified po files. my $files = ""; my $appname = $tmp; $appname =~ s/^(\S*)\s*.*$/$1/; if ($appname =~ /AUTO/) { $appname = basename($makefileDir); if ("$appname" eq "en") { print STDERR "Error: KDE_DOCS = AUTO relies on the directory name. Yours is 'en' - you most likely want something else, e.g. KDE_DOCS = myapp\n"; exit(1); } } if ($tmp !~ / - /) { opendir (THISDIR, "."); foreach $entry (readdir(THISDIR)) { next if ($entry eq "CVS" || $entry =~ /^\./ || $entry =~ /^Makefile/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/); next if (! -f $entry); $files .= "$entry "; } closedir (THISDIR); print STDOUT "docfiles found = $files\n" if ($verbose); } else { $tmp =~ s/\034/ /g; $tmp =~ s/^\S*\s*-\s*//; $files = $tmp; } goto nodocs if (!$files); # Nothing to do if ($files =~ /(^| )index\.docbook($| )/) { my $lines = ""; my $lookup = 'MEINPROC\s*='; if ($MakefileData !~ /\n($lookup)/) { $lines = "MEINPROC=/\$(kde_bindir)/meinproc\n"; } $lookup = 'KDE_XSL_STYLESHEET\s*='; if ($MakefileData !~ /\n($lookup)/) { $lines .= "KDE_XSL_STYLESHEET=/\$(kde_datadir)/ksgmltools2/customization/kde-chunk.xsl\n"; } $lookup = '\nindex.cache.bz2:'; if ($MakefileData !~ /\n($lookup)/) { $lines .= "index.cache.bz2: \$(srcdir)/index.docbook \$(KDE_XSL_STYLESHEET) $files\n"; $lines .= "\t-\@if test -n \"\$(MEINPROC)\"; then echo \$(MEINPROC) --check --cache index.cache.bz2 \$(srcdir)/index.docbook; \$(MEINPROC) --check --cache index.cache.bz2 \$(srcdir)/index.docbook; fi\n"; $lines .= "\n"; } $lines .= "docs-am: index.cache.bz2\n"; $lines .= "\n"; $lines .= "install-docs: docs-am install-nls\n"; $lines .= "\t\$(mkinstalldirs) \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname\n"; $lines .= "\t\@if test -f index.cache.bz2; then \\\n"; $lines .= "\techo \$(INSTALL_DATA) index.cache.bz2 \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/; \\\n"; $lines .= "\t\$(INSTALL_DATA) index.cache.bz2 \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/; \\\n"; $lines .= "\tfi\n"; $lines .= "\t-rm -f \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/common\n"; $lines .= "\t\$(LN_S) \$(kde_libs_htmldir)/$kdelang/common \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/common\n"; $lines .= "\n"; $lines .= "uninstall-docs:\n"; $lines .= "\t-rm -rf \$(kde_htmldir)/$kdelang/$appname\n"; $lines .= "\n"; $lines .= "clean-docs:\n"; $lines .= "\t-rm -f index.cache.bz2\n"; $lines .= "\n"; $target_adds{"install-data-am"} .= "install-docs "; $target_adds{"uninstall"} .= "uninstall-docs "; $target_adds{"clean-am"} .= "clean-docs "; appendLines ($lines); } else { appendLines("docs-am: $files\n"); } $target_adds{"install-data-am"} .= "install-nls"; $target_adds{"uninstall"} .= "uninstall-nls "; $tmp = "install-nls:\n"; $tmp .= "\t\$(mkinstalldirs) \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname\n"; $tmp .= "\t\@for base in $files; do \\\n"; $tmp .= "\t echo \$(INSTALL_DATA) \$\$base \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/\$\$base ;\\\n"; $tmp .= "\t \$(INSTALL_DATA) \$(srcdir)/\$\$base \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/\$\$base ;\\\n"; $tmp .= "\tdone\n"; if ($appname eq 'common') { $tmp .= "\t\@echo \"merging common and language specific dir\" ;\\\n"; $tmp .= "\tif test ! -e \$(kde_htmldir)/en/common/kde-common.css; then echo 'no english docs found in \$(kde_htmldir)/en/common/'; exit 1; fi \n"; $tmp .= "\t\@com_files=`cd \$(kde_htmldir)/en/common && echo *` ;\\\n"; $tmp .= "\tcd \$(DESTDIR)\$(kde_htmldir)/$kdelang/common ;\\\n"; $tmp .= "\tif test -n \"\$\$com_files\"; then for p in \$\$com_files ; do \\\n"; $tmp .= "\t case \" $files \" in \\\n"; $tmp .= "\t *\" \$\$p \"*) ;; \\\n"; $tmp .= "\t *) test ! -e \$\$p && echo \$(LN_S) ../../en/common/\$\$p \$(DESTDIR)\$(kde_htmldir)/$kdelang/common/\$\$p && \$(LN_S) ../../en/common/\$\$p \$\$p ;; \\\n"; $tmp .= "\t esac ; \\\n"; $tmp .= "\tdone ; fi ; true\n"; } $tmp .= "\n"; $tmp .= "uninstall-nls:\n"; $tmp .= "\tfor base in $files; do \\\n"; $tmp .= "\t rm -f \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/\$\$base ;\\\n"; $tmp .= "\tdone\n\n"; appendLines ($tmp); $target_adds{"distdir"} .= "distdir-nls "; $tmp = "distdir-nls:\n"; $tmp .= "\tfor file in $files; do \\\n"; $tmp .= "\t cp \$(srcdir)/\$\$file \$(distdir); \\\n"; $tmp .= "\tdone\n"; appendLines ($tmp); return 0; nodocs: appendLines("docs-am:\n"); return 1; } #----------------------------------------------------------------------------- # Find headers in any of the source directories specified previously, that # are candidates for "moc-ing". sub findMocCandidates () { foreach $dir (@headerdirs) { my @list = (); opendir (SRCDIR, "$dir"); @hFiles = grep { /.+\.$hExt$/o && !/^\./ } readdir(SRCDIR); closedir SRCDIR; foreach $hf (@hFiles) { next if ($hf =~ /^\.\#/); $hf =~ /(.*)\.[^\.]*$/; # Find name minus extension next if ($uiFiles{$1}); open (HFIN, "$dir/$hf") || die "Could not open $dir/$hf: $!\n"; my $hfsize = 0; seek(HFIN, 0, 2); $hfsize = tell(HFIN); seek(HFIN, 0, 0); read HFIN, $hfData, $hfsize; close HFIN; # push (@list, $hf) if(index($hfData, "Q_OBJECT") >= 0); ### fast but doesn't handle //Q_OBJECT if ( $hfData =~ /{([^}]*)Q_OBJECT/s ) { ## handle " { friend class blah; Q_OBJECT " push (@list, $hf) unless $1 =~ m://[^\n]*Q_OBJECT[^\n]*$:s; ## handle "// Q_OBJECT" } } # The assoc array of root of headerfile and header filename foreach $hFile (@list) { $hFile =~ /(.*)\.[^\.]*$/; # Find name minus extension if ($mocFiles{$1}) { print STDERR "Warning: Multiple header files found for $1\n"; next; # Use the first one } $mocFiles{$1} = "$dir\035$hFile"; # Add relative dir } } return 0; } #----------------------------------------------------------------------------- # The programmer has specified a moc list. Prune out the moc candidates # list that we found based on looking at the header files. This generates # a warning if the programmer gets the list wrong, but this doesn't have # to be fatal here. sub pruneMocCandidates ($) { my %prunedMoc = (); local @mocList = split(' ', $_[0]); foreach $mocname (@mocList) { $mocname =~ s/\.moc$//; if ($mocFiles{$mocname}) { $prunedMoc{$mocname} = $mocFiles{$mocname}; } else { my $print = $makefileDir; $print =~ s/^\Q$topdir\E\\//; # They specified a moc file but we can't find a header that # will generate this moc file. That's possible fatal! print STDERR "Warning: No moc-able header file for $print/$mocname\n"; } } undef %mocFiles; %mocFiles = %prunedMoc; } #----------------------------------------------------------------------------- # Finds the cpp files (If they exist). # The cpp files get appended to the header file separated by \035 sub checkMocCandidates () { my @cppFiles; my $cpp2moc; # which c++ file includes which .moc files my $moc2cpp; # which moc file is included by which c++ files return unless (keys %mocFiles); opendir(THISDIR, ".") || return; @cppFiles = grep { /.+\.$cppExt$/o && !/.+\.moc\.$cppExt$/o && !/.+\.all_$cppExt\.$cppExt$/o && !/^\./ } readdir(THISDIR); closedir THISDIR; return unless (@cppFiles); my $files = join (" ", @cppFiles); $cpp2moc = {}; $moc2cpp = {}; foreach $cxxf (@cppFiles) { open (CXXFIN, $cxxf) || die "Could not open $cxxf: $!\n"; seek(CXXFIN, 0, 2); my $cxxfsize = tell(CXXFIN); seek(CXXFIN, 0, 0); read CXXFIN, $cxxfData, $cxxfsize; close CXXFIN; while(($cxxfData =~ m/^[ \t]*\#include\s*[<\"](.*\.moc)[>\"]/gm)) { $cpp2moc->{$cxxf}->{$1} = 1; $moc2cpp->{$1}->{$cxxf} = 1; } } foreach my $mocFile (keys (%mocFiles)) { @cppFiles = keys %{$moc2cpp->{"$mocFile.moc"}}; if (@cppFiles == 1) { $mocFiles{$mocFile} .= "\035" . $cppFiles[0]; push(@deped, $mocFile); } elsif (@cppFiles == 0) { push (@newObs, $mocFile); # Produce new object file next if ($haveAutomocTag); # This is expected... # But this is an error we can deal with - let them know print STDERR "Warning: No c++ file that includes $mocFile.moc\n"; } else { # We can't decide which file to use, so it's fatal. Although as a # guess we could use the mocFile.cpp file if it's in the list??? print STDERR "Error: Multiple c++ files that include $mocFile.moc\n"; print STDERR "\t",join ("\t", @cppFiles),"\n"; $errorflag = 1; delete $mocFiles{$mocFile}; # Let's continue and see what happens - They have been told! } } } #----------------------------------------------------------------------------- # Add the rules for generating moc source from header files # For Automoc output *.moc.cpp but normally we'll output *.moc # (We must compile *.moc.cpp separately. *.moc files are included # in the appropriate *.cpp file by the programmer) sub addMocRules () { my $cppFile; my $hFile; foreach $mocFile (keys (%mocFiles)) { undef $cppFile; ($dir, $hFile, $cppFile) = split ("\035", $mocFiles{$mocFile}, 3); $dir =~ s#^\.#\$(srcdir)#; if (defined ($cppFile)) { $target_adds{"\$(srcdir)/$cppFile"} .= "$mocFile.moc "; appendLines ("$mocFile.moc: $dir/$hFile\n\t\$(MOC) $dir/$hFile -o $mocFile.moc\n"); $cleanMoc .= " $mocFile.moc"; } else { appendLines ("$mocFile$mocExt: $dir/$hFile\n\t\$(MOC) $dir/$hFile -o $mocFile$mocExt\n"); $cleanMoc .= " $mocFile$mocExt"; } } } sub make_meta_classes () { return if ($kdeopts{"qtonly"}); my $cppFile; my $hFile; my $moc_class_headers = ""; foreach $program (@programs) { my $mocs = ""; my @progsources = split(/[\s\034]+/, $sources{$program}); my @depmocs = split(' ', $depedmocs{$program}); my %shash = (), %mhash = (); @shash{@progsources} = 1; # we are only interested in the existence @mhash{@depmocs} = 1; print STDOUT "program=$program\n" if ($verbose); print STDOUT "psources=[".join(' ', keys %shash)."]\n" if ($verbose); print STDOUT "depmocs=[".join(' ', keys %mhash)."]\n" if ($verbose); print STDOUT "globalmocs=[".join(' ', keys(%globalmocs))."]\n" if ($verbose); foreach my $mocFile (keys (%globalmocs)) { undef $cppFile; ($dir, $hFile, $cppFile) = split ("\035", $globalmocs{$mocFile}, 3); $dir =~ s#^\.#\$(srcdir)#; if (defined ($cppFile)) { $mocs .= " $mocFile.moc" if exists $shash{$cppFile}; } else { # Bah. This is the case, if no C++ file includes the .moc # file. We make a .moc.cpp file for that. Unfortunately this # is not included in the %sources hash, but rather is mentioned # in %depedmocs. If the user wants to use AUTO he can't just # use an unspecific METAINCLUDES. Instead he must use # program_METAINCLUDES. Anyway, it's not working real nicely. # E.g. Its not clear what happens if user specifies two # METAINCLUDES=AUTO in the same Makefile.am. $mocs .= " $mocFile.moc.$cxxsuffix" if exists $mhash{$mocFile.".moc.$cxxsuffix"}; } } if ($mocs) { print STDOUT "==> mocs=[".$mocs."]\n" if ($verbose); my $sourcename = $program."_meta_unload"; my $ext = ($program =~ /_la$/) ? ".lo" : ".o"; my $srcfile = $sourcename.".$cxxsuffix"; my $objfile = $sourcename.$ext; $moc_class_headers .= " $srcfile"; my $appl; $appl = "$srcfile: $mocs\n"; $appl .= "\t\@echo 'creating $srcfile'\n"; $appl .= "\t\@-rm -f $srcfile\n"; $appl .= "\t\@if test \${kde_qtver} = 2; then \\\n"; $appl .= "\t\techo 'static const char * _metalist_$program\[\] = {' > $srcfile ;\\\n"; $appl .= "\t\tcat $mocs | grep 'char.*className' | "; $appl .= "sed -e 's/.*[^A-Za-z0-9_:]\\([A-Za-z0-9_:]*\\)::className.*\$\$/\\\"\\1\\\",/' | sort | uniq >> $srcfile ;\\\n"; $appl .= "\t\techo '0};' >> $srcfile ;\\\n"; $appl .= "\t\techo '#include ' >> $srcfile ;\\\n"; $appl .= "\t\techo '_UNLOAD($program)' >> $srcfile ;\\\n"; $appl .= "\telse echo > $srcfile; fi\n"; $appl .= "\n"; $realObjs{$program} .= " \034" . $objfile . " "; $sources{$program} .= " $srcfile"; $sources_changed{$program} = 1; $dep_files .= " \$(DEPDIR)/$sourcename.P" if($dep_files !~/$sourcename.P/); appendLines ($appl); } print STDOUT "\n" if $verbose; } if ($moc_class_headers) { appendLines ("$cleantarget-moc-classes:\n\t-rm -f $moc_class_headers\n"); $target_adds{"$cleantarget-am"} .= "$cleantarget-moc-classes "; } } #----------------------------------------------------------------------------- sub updateMakefile () { return if ($dryrun); open (FILEOUT, "> $makefile") || die "Could not create $makefile: $!\n"; print FILEOUT "\# $progId - " . '$Revision: 1.2 $ ' . "\n"; $MakefileData =~ s/\034/\\\n\t/g; # Restore continuation lines print FILEOUT $MakefileData; close FILEOUT; } #----------------------------------------------------------------------------- # The given line needs to be removed from the makefile # Do this by adding the special "removed line" comment at the line start. sub removeLine ($$) { my ($lookup, $old) = @_; $old =~ s/\034/\\\n#>- /g; # Fix continuation lines $MakefileData =~ s/\n$lookup/\n#>\- $old/; } #----------------------------------------------------------------------------- # Replaces the old line with the new line # old line(s) are retained but tagged as removed. The new line(s) have the # "added" tag placed before it. sub substituteLine ($$) { my ($lookup, $new) = @_; if ($MakefileData =~ /\n($lookup)/) { $old = $1; $old =~ s/\034/\\\n#>\- /g; # Fix continuation lines $new =~ s/\034/\\\n\t/g; my $newCount = ($new =~ tr/\n//) + 1; $MakefileData =~ s/\n$lookup/\n#>- $old\n#>\+ $newCount\n$new/; } else { print STDERR "Warning: substitution of \"$lookup\" in $printname failed\n"; } } #----------------------------------------------------------------------------- # Slap new lines on the back of the file. sub appendLines ($) { my ($new) = @_; $new =~ s/\034/\\\n\t/g; # Fix continuation lines my $newCount = ($new =~ tr/\n//) + 1; $MakefileData .= "\n#>\+ $newCount\n$new"; } #----------------------------------------------------------------------------- # Restore the Makefile.in to the state it was before we fiddled with it sub restoreMakefile () { $MakefileData =~ s/# $progId[^\n\034]*[\n\034]*//g; # Restore removed lines $MakefileData =~ s/([\n\034])#>\- /$1/g; # Remove added lines while ($MakefileData =~ /[\n\034]#>\+ ([^\n\034]*)/) { my $newCount = $1; my $removeLines = ""; while ($newCount--) { $removeLines .= "[^\n\034]*([\n\034]|)"; } $MakefileData =~ s/[\n\034]#>\+.*[\n\034]$removeLines/\n/; } } #----------------------------------------------------------------------------- avifile-0.7.48~20090503.ds/admin/gendefs.sh0000755000175000017500000001214211167230257017007 0ustar yavoryavor#!/bin/sh # # This script file generates necessary defines for ffmpeg compilation # As it has got a little bit tricky it must be carefully checked # which codecs are checked by ffmpeg.m4 file source_path=ffmpeg result_file="include/configff.h" gendefine() { prune="$1" shift for i in "$@" do #test $prune -eq 1 && echo "#define CONFIG_"`echo $i | tr a-z A-Z`" $prune" #echo "#define ENABLE_"`echo $i | tr a-z A-Z`" $prune" done } prune() { pattern="$1" shift echo "$@" | sed "s%\\<$pattern\\>%%g" } haspattern() { pattern="$1" shift echo "$@" | grep $pattern >/dev/null } createlist() { ENCODER_LIST=`sed -n 's/^[^#]*ENC.*(.*, *\(.*\)).*/\1_encoder/p' "$source_path/libavcodec/allcodecs.c"` DECODER_LIST=`sed -n 's/^[^#]*DEC.*(.*, *\(.*\)).*/\1_decoder/p' "$source_path/libavcodec/allcodecs.c"` HWACCEL_LIST=`sed -n 's/^[^#]*HWACCEL.*(.*, *\(.*\)).*/\1_hwaccel/p' "$source_path/libavcodec/allcodecs.c"` PARSER_LIST=`sed -n 's/^[^#]*PARSER.*(.*, *\(.*\)).*/\1_parser/p' "$source_path/libavcodec/allcodecs.c"` BSF_LIST=`sed -n 's/^[^#]*BSF.*(.*, *\(.*\)).*/\1_bsf/p' "$source_path/libavcodec/allcodecs.c"` MUXER_LIST=`sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavformat/allformats.c"` DEMUXER_LIST=`sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavformat/allformats.c"` OUTDEV_LIST=`sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavdevice/alldevices.c"` INDEV_LIST=`sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavdevice/alldevices.c"` PROTOCOL_LIST=`sed -n 's/^[^#]*PROTOCOL.*(.*, *\(.*\)).*/\1_protocol/p' "$source_path/libavformat/allformats.c"` #echo $BSF_LIST DETECT_ENCODER="png flashsv zmbv" PRUNE_ENCODER="\ libamr_nb\ libamr_wb\ libdirac\ libfaac\ libgsm\ libgsm_ms\ libmp3lame\ libschroedinger\ libtheora\ libvorbis\ libx264\ libxvid\ oggvorbis\ snow\ " DETECT_DECODER="\ libfaad\ libopenjpeg\ mpeg4aac\ dxa\ flashsv\ png\ tscc\ zmbv\ " PRUNE_DECODER="\ libamr_nb\ libamr_wb\ libdirac\ libgsm\ libgsm_ms\ libschroedinger\ libspeex\ libvorbis\ libxvid\ mpeg_xvmc\ oggvorbis\ snow\ xvmc\ h264_vdpau\ mpeg_vdpau\ mpeg1_vdpau\ vc1_vdpau\ wmv3_vdpau\ " DETECT_HWACCEL= PRUNE_HWACCEL="h263_vaapi mpeg2_vaapi mpeg4_vaapi vc1_vaapi wmv3_vaapi" DETECT_PARSER= PRUNE_PARSER= DETECT_BSF= PRUNE_BSF= DETECT_MUXER="oss" PRUNE_MUXER="libnut ogg" DETECT_DEMUXER="oss" PRUNE_DEMUXER="libnut ogg avisynth vc1t" DETECT_PROTOCOL= PRUNE_PROTOCOL= DETECT_OUTDEV="oss dv1394 libdc1394" PRUNE_OUTDEV="alsa bktr audio_beos" DETECT_INDEV="oss dv1394 libdc1394" PRUNE_INDEV="alsa bktr audio_beos jack vfwcap x11_grab_device" for i in $DETECT_ENCODER $PRUNE_ENCODER; do ENCODER_LIST=`prune ${i}_encoder $ENCODER_LIST` haspattern $i $DETECT_ENCODER || ENCODER_PRUNE="$ENCODER_PRUNE ${i}_encoder" done for i in $DETECT_DECODER $PRUNE_DECODER; do DECODER_LIST=`prune ${i}_decoder $DECODER_LIST` haspattern $i $DETECT_DECODER || DECODER_PRUNE="$DECODER_PRUNE ${i}_decoder" done for i in $DETECT_HWACCEL $PRUNE_HWACCEL; do HWACCEL_LIST=`prune ${i}_hwaccel $HWACCEL_LIST` haspattern $i $DETECT_HWACCEL || HWACCEL_PRUNE="$HWACCEL_PRUNE ${i}_hwaccel" done for i in $DETECT_PARSER $PRUNE_PARSER; do PARSER_LIST=`prune ${i}_parser $PARSER_LIST` haspattern $i $DETECT_PARSER || PARSER_PRUNE="$PARSER_PRUNE ${i}_parser" done for i in $DETECT_BSF $PRUNE_BSF; do BSF_LIST=`prune ${i}_bsf $BSF_LIST` haspattern $i $DETECT_BSF || BSF_PRUNE="$BSF_PRUNE ${i}_bsf" done for i in $DETECT_MUXER $PRUNE_MUXER; do MUXER_LIST=`prune ${i}_muxer $MUXER_LIST` haspattern $i $DETECT_MUXER || MUXER_PRUNE="$MUXER_PRUNE ${i}_muxer" done for i in $DETECT_DEMUXER $PRUNE_DEMUXER; do DEMUXER_LIST=`prune ${i}_demuxer $DEMUXER_LIST` haspattern $i $DETECT_DEMUXER || DEMUXER_PRUNE="$DEMUXER_PRUNE ${i}_demuxer" done for i in $DETECT_PROTOCOL $PRUNE_PROTOCOL; do PROTOCOL_LIST=`prune ${i}_protocol $PROTOCOL_LIST` haspattern $i $DETECT_PROTOCOL || PROTOCOL_PRUNE="$PROTOCOL_PRUNE ${i}_protocol" done for i in $DETECT_OUTDEV $PRUNE_OUTDEV; do OUTDEV_LIST=`prune ${i}_muxer $OUTDEV_LIST` haspattern $i $DETECT_OUTDEV || OUTDEV_PRUNE="$OUTDEV_PRUNE ${i}_muxer" done for i in $DETECT_INDEV $PRUNE_INDEV; do INDEV_LIST=`prune ${i}_demuxer $INDEV_LIST` haspattern $i $DETECT_INDEV || INDEV_PRUNE="$INDEV_PRUNE ${i}_demuxer" done cat <<_ACEOF /* * This file is generated by the script: admin/gendefs.sh * Do not modify it by hand! */ #define ENABLE_VHOOK 0 _ACEOF gendefine 1 $DECODER_LIST gendefine 0 $DECODER_PRUNE gendefine 1 $DEMUXER_LIST gendefine 0 $DEMUXER_PRUNE gendefine 1 $HWACCEL_LIST gendefine 0 $HWACCEL_PRUNE gendefine 1 $PARSER_LIST gendefine 0 $PARSER_PRUNE gendefine 1 $BSF_LIST gendefine 0 $BSF_PRUNE gendefine 1 $ENCODER_LIST gendefine 0 $ENCODER_PRUNE gendefine 1 $MUXER_LIST gendefine 0 $MUXER_PRUNE gendefine 1 $PROTOCOL_LIST gendefine 0 $PROTOCOL_PRUNE gendefine 1 $OUTDEV_LIST gendefine 0 $OUTDEV_PRUNE gendefine 1 $INDEV_LIST gendefine 0 $INDEV_PRUNE echo } echo -n "Creating list of $result_file, wait..." createlist >$result_file echo "done" avifile-0.7.48~20090503.ds/admin/strip_fPIC.sh0000755000175000017500000000060407455007525017403 0ustar yavoryavor#!/bin/sh # # libtool assumes that the compiler can handle the -fPIC flag # This isn't always true (for example, nasm can't handle it) command="" while [ $# -gt 0 ]; do case "$1" in -?PIC) # Ignore -fPIC and -DPIC options ;; *) command="$command $1" ;; esac shift done echo "---echo-- $command" exec $command avifile-0.7.48~20090503.ds/admin/version.sh0000755000175000017500000000216507562165711017073 0ustar yavoryavor#!/bin/sh # last_cvs_update=`date -r CVS/Entries +%y%m%d-%H:%M 2>/dev/null` # this works in zsh # ls -atr **/CVS/Entries | tail -1 | xargs date -r # !!!! # This file is no longer used by avifile project # !!!! AVIFILE_MAJOR_VERSION=0 AVIFILE_MINOR_VERSION=7 AVIFILE_MICRO_VERSION=16 if test "$1" != "NOHEADER" ; then last_cvs_update=`find . -name Entries -printf '%Ty%Tm%Td-%TH:%TM\n' | sort | tail -1` if test $? -ne 0 -o -z "$last_cvs_update" ; then # probably no gnu date installed(?), use current date last_cvs_update=`date +%y%m%d-%H:%M` fi VFL=/tmp/version$RANDOM BUILD="CVS-${last_cvs_update}-$1" echo "#ifndef AVIFILE_VERSION #define AVIFILE_MAJOR_VERSION $AVIFILE_MAJOR_VERSION #define AVIFILE_MINOR_VERSION $AVIFILE_MINOR_VERSION #define AVIFILE_PATCHLEVEL $AVIFILE_MICRO_VERSION #define AVIFILE_VERSION ((AVIFILE_MAJOR_VERSION << 8 + AVIFILE_MINOR_VERSION) << 8 + AVIFILE_PATCHLEVEL) #define AVIFILE_BUILD \"$BUILD\" #endif" >$VFL # avoid unnecessary timestamp modification diff -q $VFL include/version.h >/dev/null 2>&1 if test $? -ne 0 ; then cp -p $VFL include/version.h fi rm -f $VFL echo $BUILD fi avifile-0.7.48~20090503.ds/.indent.pro0000644000175000017500000000123107246534637016037 0ustar yavoryavor--indent-level4 --line-length100 --comment-line-length200 --comment-indentation1 --brace-indent0 --dont-format-comments --blank-lines-after-declarations --blank-lines-after-procedures --braces-after-if-line --braces-on-struct-decl-line --space-after-cast --cuddle-else --declaration-indentation3 --continue-at-parentheses --leave-preprocessor-space --space-special-semicolon --dont-star-comments --no-space-after-function-call-names --no-comment-delimiters-on-blank-lines --no-blank-lines-after-commas --no-space-after-function-call-names --dont-break-procedure-type --swallow-optional-blank-lines --verbose --ignore-newlines --preserve-mtime --use-tabs --tab-size8avifile-0.7.48~20090503.ds/COPYING0000644000175000017500000004307607233220345015006 0ustar yavoryavor GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. avifile-0.7.48~20090503.ds/ChangeLog0000644000175000017500000017326011172575465015541 0ustar yavoryavor2009/04/19 * usually trying to followup ffmpeg API changes - still undecided whether to support external builds with ffmpeg libraries as the API is changing every month * fixing some bugs in way too many places to list * switching to use size_t and off_t system types * add support to seek in ffmpeg opened files * simplification in various parts of code * added few more supported keys in player * reworked audio buffering inside ReadStreamA class - uses less memory and gives more precise time calculation * some cosmetic API changes * added more documentation about various bits of AVI streams to header files 2008/11/15 * cleaned i386 build again (using 64bits most of the time) * cleaned soem debian package building warnings * cleaned ffmpeg Makefiles 2008/11/13 * fixed various gcc warning which has fixed couple type bugs inside the API * as usually resync with ffmpeg 2008/05/07 * again sync with ffmpeg * fixed some mess in the RGB / BGR naming 2008/04/24 * again sync with ffmpeg * fixing some missing lock in the render (no more occasional locking on startup) * cosmetics 2008/01/20 * as usual try to keep in sync with ever changing ffmpeg's API * lots of new codecs from ffmpeg are now available in avifile * avifile is now being developed on 64bit machine :) this means it should compile & work well at least on x86_64 platform * of course compilers always finds new bugs - so couple of them were fixed * slightly better support for RPM should be also vissible by updated spec file * cleaned usage of some static data - trying to reduce the size slightly * playing with -fvisibility=hidden flag 2007/07/18 * hmm not realy many entries here ;) - but just the package should build * fixed stupid bug in configuration storage * cleanup make distcheck again * prepared for Debian package release * and of course mostly in sync with ffmpeg libraries 2006/09/10 * Fixex some nasty bug in AviReadStream which caused bad sound synchronization at the end of avi stream - this bug was probably introduced with packetized stream reading * internal Flush no longer throws away the initial audio packet when playback starts * GetPos for audio stream was not precise * as usual fixing small bug in various places 2006/08/27 * tried to have configure.in again automake-1.4 compatible * possible fixed the race problem with right button movie menu * fixed many tracing strings * simplified some code in renderer * bugfixed avm::string.sprintf 2006/08/22 * commited a lot of updated configuration script - more simple now * updated to recent ffmpeg sources with better configration of all their codecs/muxers (still not yet fully automated and based on my local shell script - shall be fixed in future) * new timer function name (longcount->avm_get_time_us, localcount->removed) * minor update for logging - will improve slightly more over the time I hope * applied mmx.cpp patch from Dryak 2006/03/15 * cleanup of configure skripts * ffmpeg file parsers works again * compilation fix for k4vlsetup * updates for gcc-3.x options (-mtune/-mcpu) 2006/03/03 * doing some periodical updates to the source code - usually keeping avifile compilable with latest compiler and ffmpeg * no longer giving rpath to avifile-config --libs 2004/10/05 * ok the last release has one stupid bug in subtitle reader - fixed copying of subtitle lines where emptyline weren't copyied. * as usually ffmpeg is regulary updated 2004/06/04 * yep - the time is running, everyone is using mplayer so who actully cares, but still it's worth to mention that some bug in threading was fixed with 2.6 kernels and aviplay usage * Xft subtitles are now rendered with line breaking so if the line is too long, overlaping words are moved to the next line - this should be probably convigurable option we will see * ffmpeg is contiuosly updated - but for now the framerate logic is changed way too offect so it doesn't currently work 2003/07/10 * nothing really inovative - mostly just ffmpeg gets update main purpose is to make a new Debian/SF release 2003/06/08 - alexannika@users.sourceforge.net * new exp. multichannel view * press [ or ] to change number of tiles * press + or - to change speed of channel switch 2003/06/06 - alexannika@users.sourceforge.net * added files samples/qtvidcap/frequencies.{c,h} (taken from xawtv) * added frequencies.{c,h} to samples/qtvidcap/Makefile.am * avicap now uses v4l->setFreq() to set frequency * recording continues while you can zapp around 2003/06/05 - alexannika@users.sourceforge.net * sdl-renderer doesn't crash anymore * menu & some keys work in sdl window * you can switch between overlay/preview/sdl 2003/06/02 - alexannika@users.sourceforge.net * avirec shows correct time 2003/05/30 - alexannika@users.sourceforge.net * minor fixes 2003/05/26 - alexannika@users.sourceforge.net * removed my savename code from lib/codeckeeper.cpp * disabled the savename code in vidconfig.cpp/capproc.cpp the code is still there, but no named codecs are used * no named codecs till I have the new version written * removed the bogus constructor from lib/aviplay/aviplay_impl.h * improved a little bit the sdl renderer * fixed the avirec problem * compiles with qt2.3.2 and without qt 2003/05/25 * still more cleanup & speedup for automake * more headers moved to avm_ prefix usage * headers are now stored within avifile0.7 2003/05/17 * again played a bit with configure script - cleanup support for divxbin has been added 2003/05/11 * cleaned some parts of avicap * partly enable ffmpeg encoding support - works but not yet properly * wow - we could really play SVQ3 via ffmpeg * AAC should be working as well >> name codecs should be replaced with something more universal 2003/05/10 - alexannika@users.sourceforge.net * fs-fenderer: yv12 gets negative picture, yuy2 works * funny channel dependent cpu-usage 2003/05/09 - alexannika@users.sourceforge.net * experimental! fullscreen/sdl/avicap-renderer * added files samples/qtvidcap/fullscreen_renderer.{cpp,h} 2003/05/07 - alexannika@users.sourceforge.net * user can now use 'named codecs' 2003/05/01 - alexannika@users.sourceforge.net * avicap_de.qm gets installed to $(datadir)/avifile/i18n * documentation gets installed to $(datadir)/avifile/doc * added AUTHORS file to topdir * README INSTALL COPYING AUTHORS ChangeLog gets installed to $(datadir)/avifile * added global.h,huffman.h,layer12.h,layer3.h,version.c to plugins/libmad/libmad/Makefile.am (tarball didn't compile) 2003/05/01 - alexannika@users.sourceforge.net * german translation of avicap done by Jochen Puchalla 2003/04/30 - alexannika@users.sourceforge.net * more strings to translate * slightly improved epg drawing 2003/04/30 - alexannika@users.sourceforge.net * segmenting evaluates the dirpool * file gets segmented into another dir when keepfree>freespace * audio/video error & timeshift get shown in avicapwnd * updated documentation 2003/04/29 - alexannika@users.sourceforge.net * prepared for translation * added samples/qtvidcap{avicap.pro,avicap_de.ts,avicap_de.qm} * keyframe bug fixed *thanks* to Jochen Puchalla again :-) 2003/04/27 - alexannika@users.sourceforge.net * avicap does synchfixes again *thanks* to Jochen Puchalla for his help & inspiration 2003/04/25 - alexannika@users.sourceforge.net * slight improvements to the timertable 2003/04/22 - alexannika@users.sourceforge.net * paranoid logging with -DAVICAP_PARANOID * user logging to ~/.avm/avicap-userlog.log 2003/04/20 * implemneted support for I410 (used by ffmpeg indeo decoder) * fixed Raw Uncompressed Bitmap support (it's stored with even columns for odd widths) 2003/04/16 - alexannika@users.sourceforge.net * timertable: 'every' recordings get now updated automatically * you can't switch channel to blocked programs * new config tab 'other' * other tab: password/child lock * other tab: log to file checkbox (not yet functional) 2003/04/15 - alexannika@users.sourceforge.net * epg faster redraw * guide can now show range upto 3 days * preliminary zoom (not yet working correctly) 2003/04/15 * nothing really impressive - just syncing with ffmpeg and cleaning few minor issues 2003/04/14 - alexannika@users.sourceforge.net * epg browser highlights program which are running 'now' * epg browser get updated from timertable when next/current recording has changed or any recording modified * epg browser gets redrawn every minute (it's slow yet) 2003/04/13 - alexannika@users.sourceforge.net * regexps get now written to ~/.avm/avicap-regexps * epg-channel-id's for all providers the same * you can change provider (but have to restart avicap yet) * epgwindow interacts with timertable, you can put recordings from epgwindow into the timertable * recordings from the timertable will show up shaded in the epg browser * press middle button & move mouse to move display around * regexp-edit separate window * updated epg documentation * epg browser compiles with Qt2.3.2 now 2003/04/12 - alexannika@users.sourceforge.net * epgwindow regexps now much faster and usuable 2003/04/11 - alexannika@users.sourceforge.net * epgwindow highlights program under mouse correctly * epgwindow highlight/blocks programs by regexp * fixes for Qt2.3.2, no epg yet 2003/04/09 - alexannika@users.sourceforge.net * config for epgwindow * disabled build of standalone 'epgbrowser' 2003/04/06 - alexannika@users.sourceforge.net * improved epgwindow 2003/04/06 - alexannika@users.sourceforge.net * added samples/qtvidcap/epgwindow.cpp/h (widget) * added samples/qtvidcap/epgbrowser.cpp (standalone browser) * added doc/avicap/epg.html * added samples/qtvidcap/TODO (my personal TODO-file) * implemented an EPG-display/browser for Avicap * also standalone browser 'epgbrowser' * avicap/timertable compiles and works with Qt2.3.2 * disabled epg for Qt<300 (I'll look at those errors later...) 2003/04/03 - alexannika@users.sourceforge.net * fixed bug in kv4lsetup, kv4lsetup -t=1 or -t=2 works now * timertable now recognizes when user stops a programmed recording manually * timertable now also starts recordings if the start time is in the past but the stop time is yet in the future, also now * timertable now stops a programmed recording if a second programmed recording is now to start * the start/stop date columns get now sorted correctly * timertableitems in the past cannot be enabled * DirPool widget added to Configure/File tab * Avicapwnd now also displays free disc space * timertable uses DirPool * mini-button for Avicapwnd * added doc/avicap/configuration.html * timertable entries now get colored * 'every day/monday...sunday' feature in timertable * avicapwnd has got mini-button -> mini-display 2003/03/30 - alexannika@users.sourceforge.net * fixed bug in reading/writing timertable settings * zapp through channels with cursor-up/down * channels are numbered now in the menus * keys 1-9 can be used to select channels (if not xawtv keys) * added 'Shutdown&Resume' tab to config dialog * feature 'shutdown&resume' for timertable * added ConfigFile::Save() to lib/common/Config.cpp/h * added RegSave() to lib/common/Registry.cpp/h * added RegSave() declaration to include/configfile.h * Configuration is now saved to file when modifying it * use 'avicap -timer' to start timer automatically * window-caption will display channel nr and name * imported avifile/doc/avicap (html user docu) * imported avifile/samples/qtvidcap/scripts (root shell scripts) * elapsed time is displayed in hh:mm:ss in avicapwnd.cpp * file size is displayed in MB in avicapwnd.cpp * never overwrite existing files option 2003/03/19 * support for Float attribute - hopefully it should be backward compatible * disable some annoying FFMPEG debug messages 2003/03/14 * hmm - forget to check Xft support - it had been disabled by accident 2003/03/11 * recovered support for older libtool which doesn't allow to link shared lib into another shard lib 2003/03/10 * qt-dir changed to qt-prefix * fixed few other minor problems with configure * started to implement support for ffmpeg options 2003/02/19 * mostly fixing minor bugs and focusing more on ffmpeg * among stupid bugs has been the one which has caused compilation hasn't been using CPU flags by default (hmm sometimes it's probably worth to check things in standard environment) * another Debian sync 2003/01/30 * fixed small bug in configure causing usage of FT2 include everywhere 2003/01/26 * added some code to play to the last byte from the OSS audio buffer 2003/01/20 * fixed some compilation problem 2003/01/17 * fixed timestamp for b-framed divx & ffmpeg (using brute force method - sorting timestamp and giving them to outgoing frames and this works for avi & mpeg) 2003/01/08 * mainly squashing many outstanding bugs so it will be a bit more usable * subtitles should be now working again (-subcp for selection iconv codepage) 2002/12/03 * supporting every third frame from mpegs (libavformats is somewhat mysterious here) 2002/11/27 * continue with cleanup - looks now more simple * fixed mms streaming from TV Nova again 2002/11/26 * some architectural redesings/cleanups/simplifications in aviread 2002/11/25 * full DMO support 2002/11/20 * simplifying some parsers and readers to match better ffmpeg * yep Win32 DMO works (it was very stupid bug which has blocked its functionality) 2002/11/17 * implemented support for OSS mixer so volume slider does something useful * ok redesigned some timing things - should be now simplier 2002/11/13 * hmm it's interesting how the bugs tends to repear in some parts of the source code :) so fixed quite a few problems with incorrectly played movies * added support for 411P colorspace for some NTSC DV movies decompressed via ffmpeg * simplier and faster timing routines (again - interesting how much could be saved by removing few virtual method calls) 2002/11/11 * during weeked played a bit more with ffmpeg * fixing some bugs introduced with some latest cleanups 2002/11/07 * hmm relase 0.7.17 seemed to be a little bit more buggy then I've expected for some users - now reported bugs have been at least fixed (and did I mentioned who do not report bugs can't expect such bugs will be solved fast) * working on new Subtitle rendering which should also be able to use freetype2 library directly (end eventually draw text into the movie - now when there is Crop support this might be usefull) * also FontDialog is somewhat less functinal then it used to be (yet this is known issue at this moment - no need to report) 2002/10/31 * hmm I'm somewhat forget about this log * ok now we support WMA decoding via * Cropping is now support for RGB modes as well * options are now better supported (yet it's not finished) * ffmpeg now allows to set few options at runtime (direct mode 1 rendering is amongs them) * speaking about ffmpeg - there is new simplier code to handle ffmpeg codecs - and lot of them has been added * as usually lot's of fixes 2002/10/01 * number of improvements and fixes * support for multiple filename list * fixes for avicat * DMO isn't usable - very hard... 2002/09/13 * released 0.7.16 version * working on DMO support (aka WM9) 2002/09/09 * more vidix fixes (and played a bit with mga) 2002/09/05 * vidix works somehow for 'root' user now (though now root user is actually forced to use vidix) this might be disabled for next few releases until some reasonable usable UI will be made for this. 2002/09/03 * fixed few bugs in an old mp3 decoder so it should be a little bit more stable 2002/09/02 * added some patch to avoid crashes with wm8 and gcc-3.2 2002/08/31 * added gamma correction also for X11 renderer 2002/08/16 * fixed reading of windows position 2002/08/12 * fixed some memory leak in rgb conversion/rendering (this isn't really tested - 99% of time I'm using YUV) * fixed some stupid bugs in YV12 I420 conversions (I420 is now a little bit better supported) * slightly fixed capturing code - shouldn't crash at least 2002/08/07 * removed usage of %Ld from library - looks like freebsd has some serious problems with this one * fixed ffmpeg libav Makefile and configure so grab.c isn't compiled * fixed stupid bug in ReadStreamA where return 0 has been used instead of break - caused memory leak during seek * fixed another 'seek' memory leak issue with libmad usage 2002/08/06 * improved audio VBR support * some fixes for freebsd (no complains - no fixes) 2002/08/04 * lowered memory usage for avi reading 2002/08/01 * support of download of multiple video streams (video_stream > 128 - good value to use would be 255) 2002/07/31 * ok now I could finaly watch TV Nova archive :) without any major problems with seeking and without problems in decoding URLs in received headers from server which has broken configuration. * fixed some remaining major bugs in seeking code now it's quite nice to use. 2002/07/30 * still improving networking code * fixing stupid bug in mmx detection and avirec parameter printing * minor fix for one subtitle type (better handling of broken files) 2002/07/28 * cleaning asf code - but still it's not very good * cleaning code to make it again compilable without AVM_COMPATIBLE 2002/07/25 * reworked Asf network reading code - futher changes will come so I could finaly select those things I'd like to actually hear & view * applied two patch files by borders for TV by Jindrich Makovicka Theme selector by Tomas Konir for aviplay (this should be probably made a little bit more universal and usable for avirecompress and avicap - FIXME later) 2002/07/24 * cleaning some code mainly in player * better support for streamed files - should be a little bit more comfortable now 2002/07/20 * fixed bug which has been non existent audio streaming for streams without audio tracks 2002/07/19 * some fixes for codecs sorting as now it's a little bit more complicated 2002/07/18 * added new way to retrieve CodecInfo list CodecInfo::Get - it takes few option to get some selected codecs which will match some criterium It might cause some minor incompatibilies as video_codecs and audio_codecs are no longer sorted and have the same order over the whole program live (as they are used for referencies it's order can't be changed - it would cause mysterious ugly problems) * fixed some stupid ugly bug which might have caused weird crashes during aviplay reconfiguration. * codecs are now selected only from those which are usable for currently played movie - if you want to see all of them run aviplay without movie. * played a bit with QSplitter class 2002/07/16 * added some code to repair incorrect mp3 headers * more safe code which throws away non-mp3 packets in mp3 stream 2002/07/11 * fixed some seeking problem with ffmpeg 2002/07/10 * added --disable-fpic options for disabling compilation with -fPIC flags on systems with older autotools (users of newer auto* tools should use --without-pic) * more fixes for avirecompress - it seems to be working again a little bit (yet I wouldn't recommed it's usage at this moment) 2002/07/09 * fixed some stupid bugs with sound seeking (alignment has been ignored for WMA audio tracks - bad idea) * fixed some compilation problems * code now contains code for playing streams via ffmpeg libav library but it's not yet usable * some fixes for avirecompresor * divx4linux now plays old divx files again 2002/07/03 * removed some more throws from the code so it's more safe for optimalized compilations with broken gcc compilers (aka 2.95.4) (sometimes I get the felling their main intention is to eliminate the usage of C++ completely because the bugs are far more scary then normal user might think of and users do not use the latest version of gcc compiler) 2002/06/27 * cleaned ASF->Asf class naming together with iterators 2002/06/26 * started to cleanup win32 loader part - to be more portable across player with fewer modifications necessary 2002/06/25 * checked support for mjpeg and fixed many bugs and problems so these files are now playable by ffmpeg (or sometimes by OS Mjpeg plugin - (now internaly renamed as ijpg to match mplayer terminology) 2002/06/22 * thrown away throws in plugins 2002/06/18 * more asf interator cleanup * enabled WMV1 support in ffmpeg * fixed AC3 reading bug (sometimes too small buffers were used) 2002/06/18 * few more fixes in ReadDirect - checking quality of avi copy with avirecompress - still it's broken 2002/06/13 * fixing some memory leaks/probs discovered by valgrind detector (very nice) * a bit restructuralized sources in aviread so it's more logical 2002/06/11 * asf stream reading in packets * cleanup of some test sources so automake1.6 will be quiet 2002/06/09 * started reorganization of stream reader - will be made in several steps for now avi stream reading in packets 2002/06/06 * reverted to original <0 topside-down - it's documnted and there is no real reason to change so leaving it as is - expect no all bitmapinfo formats returns upside-down format at least * fixed stupid bug with open file dialog opening * better xfree3.3.6 lock-free toggle-fullscreen * saving few more clocks by removing some memcpy in audio renderer * also using MMXEXT for stride memcopy to get better transfer speed 2002/06/03 * changing upside/down logic for BitmapInfo - I hope there is no application which would be using/interpreting internal values directly 2002/05/31 * spending some time with ffmpeg optimalizations to gain few more CPU cycles * finaly added support draw called in ffmpeg 2002/05/21 * still removing some useless parts of code to make the code cleaner * fixing some various minor problem which arised during this cleanup * added extra check to get even faster seeks (I hope no one will complain that we are to slow now :) 2002/05/19 * significantly simplified code for scheduling - removed various junk from this code which has accumulated over the time and is no longer necessary * fixed various 'read from stream' issues * rechecked my collection of buggy avi samples - interesting how many bug has managed to reappear - they were fixed again 2002/05/08 * fixed resampling support * few Makefile updates so there should be less problems with mixed Qt instalation and library linking 2002/05/07 * fixing some code path in audio decoding - so another memcpy is saved (though it's been quite small - like 1200b) still mp3 decoding seems to be delayed by some 0.1sec but at least now it's consistent for both OSS & SDL audio renderers * fixed some problems with pinnacle video clips and dwStart in video stream * fixed another problem with configure and Qt detection - now --with-qt-dir is prefered to QTDIR 2002/05/02 * fixed some threading problems - so it should be relatively safe to resize picture even in RGB mode * fixing some names for postprocessing - now it's everywhere lowercase * support for Qt3.0 font selection by Tomas Konir 2002/05/01 * again modified SDL audio renderer - (OSS is now default is SDL probably could never give predictable results) - but as for now it looks quite good * restored some older smoother time modification in video thread - so the smooth video is back * started to modify avirecompress to support some more options like YV12 or two pass encoding - for now avirecompress is a little bit broken (I a guess it's more then just a little ;)) 2002/04/29 * fixed few newly discoverd issues with configure add added support for --with-xvid-prefix * spent some time on adding options for XviD & Divx4 plugins - yet XviD is not correct so fat - feature added to divx4 are most probably only available to Pro version which is not yet accessible for linux (if ever will be...) * avirecompress now also compiles with Qt2.0 (though the GUI looks quite strange - if anyone know how to removed those huge empty spaces - let me know) * avicap has few GUI fixes so it's fully resizable - also graph bars now will show something nice * checked and fixed compilalation for g++-3.1 * fixed some annoying bugs in audiorenederes which were waiting too much with the lowquality audio streams (problems with radio listening) * also stream reader has some minor problems with threaded reading - fixed, but the fix looks a bit wierd - FIXME better 2002/04/26 * prepared new relase - fixing some remaining configuration issues I hope this time it will be finaly good release 2002/04/23 * fixing some C++ exception compilation problems - avoid usage of function throw(FatalError) even when you are sure there will be no other exception generated by this function - produce bad code also I'd like to note here help of my friend and his idea to check -fsjlj-exceptions g++ option * fixed a/v sync a bit better - now it works so perfect I'm actually quite impressed myself :) * few more cleanups in configure 2002/04/21 * using liba52 * some minor bugs resolved 2002/04/20 * still fixing some macros in configure and using some standard names like HAVE_LIBSDL * checking AC3 passthrough usability and fixing few issues with OSS render (we can't reset device - it will stop ac3 audio playback and there are few other most probably sblive emu driver faults) * fixing few memory leaks in the library 2002/04/16 * fixing fixing fixing and again fixing - will this ever and ??? anyway now the debian build produces correct package for potato system * fixed some reported problem (i.e. avirec, in some Makefile some files were missing - annoying if you have used CVS snapshot 2002/04/14 * fixed AC3 decompressor initialization * large cleanup of configure.in & acinclude.m4 now Qt should be checked more precisely * fixing few minor bugs in avirecompressor * hopefully correctly restored a/v sync calculation 2002/04/11 * cleaning configration process - e.g. now should again work compilation without X (--without-x) so programs which do not require Xfree might save addition of xfree libraries * running perl am_edit script only on specific Makefile.in files * fixing few bugs with images conversion * removed stupid BitmapInfo pointer - useless mem allocation * rename CVS to avifile - (both names are however still valid sp user still could use avifile-0.6) 2002/04/09 * a lot of minor change to be compatible with SDL 1.0.0 of course there is no Xv rendering but it works * fixing couple of wrong overloaded methods * some modification to be Qt2.0 compatible - but it's not that easy - but player is already compilable with it though without configuration dialog 2002/04/07 * support for .srt subtitles which doesn't have free empty lines * fixed aviplay's config for subtitle async time * fixed coredump for AC3 passthrough (which is not yet checked if it works) * added support XV Atoms settings (hw contrast, brightness,...) * cleaned library and plugins code so it compiles without backward compatible defines - samples & player still needs it. * fixed memleak in some audio renderer extract path * fixed some bugs in a complicated audio decoding path * removed static variables from SDL video renderer 2002/04/04 * fixing some remaing reported problems * added qring template class so we could use it intead of slightly inefficient vector classes for various buffers * implemented 'show previous frame' with backspace - slow by might be usable 2002/03/30 * another major cleanup and fixup of reading classes - it looks like now all my asf & wmv files are precisely played without any problems (especialy vanderer.wmv clip was hard to fix) * add few more magical tricks to properly play even files with seriously damaged audio headers (like famous CoyteUgly.ogg) * few more GUI updates 2002/03/26 * major GUI updates - finaly first shared Qt object * fixing some gcc3.0 compilation bugs * a lot of minor tweaks and fixes in other places (e.g. eliminated iv32 encoder - causes memory trashing) 2002/03/23 * fixed detection of stream EOF - we were ignoring last frame in avi stream * fixed some stupid bug instroduced in last commit with avm_stl.h 2002/03/17 * make some fixes to prevent stack overwrite with -fstack-check * discovering some GCC problems with throw handling - we shouldn't probably use it at all as this seems to be horrible broken in all known to me GCC compilers - as soon as optimalization is turned on the weird thing begin to happen - with -fno-defer-pop and !not! using -march=i686 mostly solve this problem however the problem seems to be serious * improving ldt_setup - adapting xine's method - but we are currently unable to use it as currently two different threads might want to decompress video frames 2002/02/29 * a lot of minor fixes in the video buffering rewrote - now it's finaly works as expected - was hard work... * autoquality now works also without buffering - of course it's not as good as with buffers but it works. * playing some more with ffmpeg - expect some major changes in this area. 2002/01/21 * a lot of fixes in the field of asf parsing - code starts to look a bit more readable - but still it's far a way from the understandibility... * few more tweaks to handle better some timestamps 2002/01/10 * well a lot of changes in the progress * currently the avifile is slightly broken - library is evolving itself a bit * some major changes for now: - everything is being moved into avm:: namespace - also any C declaration should be prefixed with avm_ - buffering has been removed from video decoders - but this introduced some new problems which are not so easy to solve - currently buffering is being made diferenly video queue was moved into VideoStream parser (and might be controlable from outside - so not only aviplay could use direct rendering mechanism - but the API is not yet stable) * feature of this month - ASF streaming support has been improved a lot (actually it mostly works) * for now I'm not sure if more bugs have been fixed or introduced as a lot of classes have been modified 2001/12/19 * more fixed over the whole source code * now the segmentation should work again and should be possible to do some buffering and splitting at keyframes * we are now playing on PPC as well - fixing avi playing was easy, asf required some more modication * avicap supports Xawtv settings - usable via menu or with hotkey 2001/12/07 * some more cleanups in win32.c code 2001/12/04 * various fixes for dropping and autoquality - again - all I could say - if user will not complain I'll not most probably notice 2001/12/02 * spent many many hours on locating and finaly fixing the remaining problem with acelp codec (the thing which almost noone is probably using anyway :) But after all it FINALY works. Also AVID works for decoding. * started rewrite of avifile main classes - yeah I know programs who are using avifile library likes these changes :) - but the good thing so far is - you do not need to modify single line of you code - as I'm providing backward compatible defines structures - just binary compatibility seems to be rather a sci-fi so far :) but trust me the change is necessary to properly support all the setting we need to support - yet you can't see this code in CVS 2001/11/29 * fixed couple problems introduced with Makefile cleanup * fixed stupid bug in subtitles creation - currios why almost nobody noticed this problem (big thanks goes to Lukas) 2001/11/27 * heavy cleanup of Makefile.am rules * DivX4 DirectShow should work again * fixed some compilation issues for old egcc 2001/11/25 * more fixes to newly converted DirectShow code in plain C * acel.net codec loads in both - .ax & .acm form, but none of them seems to be operating normaly * fixed few remaining problems with Mp3 header detection (bug in tables) 2001/11/18 * made avicap look more like real application - moving, resizing,... * some fixes for YUV colorspaces in win32 dll encoding * fixed YV12 encoding with DivX4 plugins (avicap showed quite a few bugs at this field - but I do not have really that much time to fix everything instantly - especialy when I do not know about the problem!) 2001/11/15 * fixed many minor bugs across the code (curious why nobody complained - maybe I'm the only one who is still using this :) * fixed some bug with direct data reading from stream * updated avicap * ReadDirect has now another parameter - to get first frame flag 2001/11/13 * fixed few bugs in win32 code - VP31 shouldn't corrupt memory (was dealocating some Heap twice) * few quick fixes in avicap so it will work * updated fillplugins.h for win32 - enabled MWV1 ZLib Mszh for compression (thought these old codecs are quite useless anyway :) disabled Morgan jpeg & DivX for encoding to prevent mysterious segfaults these codecs are causing 2001/11/11 * fixed some more details in Mp3 detection (reading more samples) * ASF will continue with index reconstraction when some bad packets are found * implementation for AUDIO_CHANNEL * saving some bits of memory 2001/11/08 * Dirk Mueller joined our team and will do some work on GUI interface * also some outstanding problem with Qt3.0 popup menu problem was fixed (with Trolltech support) 2001/11/04 * slightly updated API - but backward compatible function remains in headers I'll try to do any future API changes get handled this way as API seems to be getting into its stable phase... * OSS sound audio render now also supports time tracking of video stream and is actually more precise then SDL audio renderer - I've no idea how to get precise time of currently played buffer 2001/11/02 * few more compatibility/compilation fixes for older systems * using GetSrcSize more precisely to get better timing for VBR audio streams * garbage coolection reenable for Global mallocs with mouch simplier method and without any slowdown 2001/10/31 * swaped function names for be/le calls * disable garbage collection for Global mallocs in libwin32 - VP31 allocates 11000 memory chunks - and after this it gets free we need probably a tree to store memory referencies as linked list isn't a good choice for this 2001/10/30 * removed check for movie chunk - so another set of broken files should be playable * slightly modified routine for mp3 stream detection - will not fail if mp3 header could not be found and will use stream header 2001/10/28 * fixing memory leaks in libwin32 (hard task to catch them all...) * changing some internals in write/read avi (maily to be less big-endian dependent) * avm::vector will behave more like std::vector (operator=, copy constructor) * seeking audio stream more closely to video track - useful when avi stream has very large chunks with audio (e.g. 256KB) 2001/10/23 * added several functions into encoder API - now it's possible to create audio/video encoder objects and AVI streams using CodecInfo as a reference. * fixed some bugs in avirecompress 2001/10/21 * added high quality MPEG audio decoder MAD * fixed ugly bug in AVI stream reading causing some problems with certain MPEG streams * added keyboard control for Saturation/Brightness,Hue,Constras compatible with Xawtv (F1/F2, F5/F6, F7/F8, F9/F10) (some people believes sliders s*s, but they are not reporting this problem :) - of course it was 10 minute work to add this :)- 2001/10/20 * some updates in configure.in and installing plugins without version-info 2001/10/15 * fixed some outstanding bugs - like wrong Eof detection for broken streams, or missing initialization of Async or Volume properties. * moved Locker to common so other programs might use just aviread, common subdirs if they do not need player or writer part 2001/10/14 * quite a few changes in libwin32 driver * fixed bug which prevented setting non direct show driver * added few more options to couple codecs 2001/10/10 * fixed keyframe for recompress and placed video stream as the first one in avirecompress 2001/10/08 * fixed some ugly bugs probably introduces by me long time ago in win32 registry so now they are working in the way one would expect * fixed DivX4.0 setting so they are also correctly stored in registry 2001/10/08 * Eugene made DivX4 Win32 codec quite usable * change a little behaviour in threads - now it waits in aviplayth decoder instead of videodecoder directly when buffers are full * some cleanup of libwin32 so mplayer team could be a little bit more happy :) * more and more fixes in stl->avm conversion 2001/10/03 * some small steps towards multiplatform compilation * quite big automake cleanup * another set of header cleanups 2001/10/02 * fixed missing mbox initialization * CodefInfo & AttributeInfo is now derived from BaseInfo - use methods GetName() GetAbout() instead of accessing private members * some improvements in win32 loader - handles divx.dll for decoding/encoding 2001/09/30 * type cleanup - using uint_t in most places - eliminated Unsigned, size_t * fixed couple crashes during deinitialization of aviplay * fixed endless loop in asf seeking * added our own very simple and basic implementation for two used STL classes - vector & string - compiles much faster and especialy debugging object files are much smaller 2001/09/28 * fixed some serious bugs in dropping algorithm * cleaned some includes and classes to minimalize usage of bloated STL this should speedup compilation 2001/09/26 * VfwEx for vp31vfw.dll works now - based on the work of mplayer team 2001/09/24 * update in whole a-v synchronization for both asf and avi streams 2001/09/23 * cleaned some new warnings * slightly reworked event filter so its part of class * fixed resizing - takes into account subtitles size * another bug - using dwStart for index 2001/09/20 * few minor (memory eating) bugs introduced with last update has been fixed * updated ffmpeg sources * patch from Jurgen Keil amongs other thing fixes wrong TSC detection in win32 2001/09/16 * fixed stupid bug in function overload of AviReadStreamA::GetTime() 2001/09/15 * fixed crash with avicap - so it should work mjpeg & huffyuv are only used for decoding * fixed deadlock in stream read for some very broken avi file * fixed missing init call in Ogg/Vorbis pluggin * fixed memcpy for video image in ffmpeg plugin * repaired threading - now works much more reliable and doesn't use EVENTTHREAD from SDL which seems to cause busy loop on some systems * fixed DIVX video stream index reconstruction * removed avifmt.h - now its private header file use StreamInfo when you need info about stream 2001/09/08 * Workaround for playback of AVI files with nonzero dwSampleSize in video stream header * Rearranged subtitle suffixes test order 2001/09/04 * vorbis plugin operates - without seeking 3 magical numbers discovered in mplayer source big thanks and hello to Felix who reads our Changelog for his work on ogg/vorbis decoding * autodetection of ogg/vorbis libraries 2001/09/02 * more work on libmmxnow * failed to build working vorbis decoder plugin - the test files seems to have unlogical content - so unless I'll find some better descrition we have to live without this plugin for now * cleanup in the source code 2001/09/01 * smarter FileStream class which should allow faster rescaning of damaged files * adding few more const pointers 2001/08/31 * cleaning some problems reported on the list - autogen.sh recompilaction problems * solved stupid bug in CPU consuming SDL thread - used wrong return value 2001/08/29 * spend another day with video scheduler - now it has just three lines (why have I discovered this earlier???) should be giving very good results in X11 and Xv accelerated mode * discovered potencial slowdown code in SDL library - SDL_Delay(1) in src/events/SDL_events.c around the line 120 should be rather SDL_Delay(100) otherwice this loop eats CPU a lot - not a problem when there are two processors - but noticable when just one has to be running (that's why I've not noticed this problem) SOLUTION for now - replace Delay and recompile - for now I've no idea what we could be doing wrong that we hit this problem - maybe it's real bug in SDL ??? (solved) 2001/08/26 * initial work on mmxnow library * improve AviPlayer initilization * added loading support for reading external audio channel from second file 2001/08/25 * minor tuning of scheduler - checking larger delay * DVSD support (fallbacks to dvsd) * removed QMARK, DMARK, DropFrame, shortened buffers for precaching * video scheduling again improved - noticable with huge images rendered with x11 renderer without any hardware acceleration * ported big part of pthread calls to use our internal Mutex/Cond/Thread implementation (Locker.h) - adaptation to SDL locks should be possible just with replacement of Locker.cpp later * cleanup of thread - more safety for Free/NetBSD systems * Max Autoquality - for DS_VideoDecoder & DivX 2001/08/24 * allowed usage of SW YUV overlay emulation - very useful for ffmpeg which supports only YV12 surface * many fixes in renderer part - updating fonts in runtine and other nice features should basicaly work 2001/08/21 * yet another minor change in scheduler - but "there is something about xine" which tells me we can still be better... 2001/08/20 * fixed another stupid cut&paste bug - used video listbox instead of audio * fixed couple other problems in the run-time configuration update 2001/08/19 * fixed information messages - for kbps using 1000 instead of 1024 as with KB * added AC3 passthrough pluggin which really plays Dolby Digital! (-> I do not have any other player except play-ac3 which plays ac3 stream) (ok I know - there is not many DivX with AC3 and we do not play vob but anyway - it's nice :) * fixed few problems with AudioQueue to accept ac3 passthrough stream 2001/08/17 * continual cleanup of Win32 subsystem - to be more portable - goal is to allow mplayer team to use exact same copy of unmodified source. * some updates in headers - using "name.h" instead of for our headers - its better for dependency generators 2001/08/13 * Huge update in AviPlayer class - moving towards much easier runtime configuration - everything should be fully modifiable in runtime (For now you could at least switch renderer (x11 & xv) but note the whole replacement is usually without soundskip!) * fixed ASF parsing (Ann Lee - Two Times.asf) * skip to next key frame is not performed if the last one passed * added ordering of decoders - for now its still not that easy to select codec - but you could do it. * player shows the time of seek bar, as obviously user wants to know to which time he is seeking * fixed couple gcc3.0 things 2001/08/08 * large set of various minor improvements in configure and autogen.sh * much better library versioning * ffmpeg CVS update * renamed few programs qtrecompress -> avirecompress qtvidcap -> avicap benchmark -> avibench 2001/08/04 * decoding ALaw & uLaw audio tracks * using AC3 decoding from FFMPEG (seems to there are few modified ac3 libraries available - mplayer seem to be using different version - probably heavily optimized - but as it doesn't take to much CPU we stay with the current version for a moment - API seems to be differnet * autoquality implemeneted into OpenDivX (or should I say ClosedDivX :) anyway this code is about 25% faster and it works with autoquality * during cleaning bugs and improving functionality of benchmark fixed some bug in detection of Eof in Avi stream * benchmark will now give also similar number as you could get from benchmarking mplayer (just to be sure we are still faster :) for now with -direct -yuv - but buffered mode seems to be slower - maybe there is something on the fastmemcpy... * renderer disables mouse after 1sec of inactivity in aviplayer window 2001/08/04 * fixed problem with 0 frame numbering actual information about the current frame are available after ReadFrame (e.g. Time, Position,...) * huge set of improvements in qtrecompress - now it really works (with few filters which are not available in VirtualDub :)) 2001/08/03 * subtitle code update (support for SAMI - .smi) * cleanup of various makefiles (suggest by some users) * Debian package slightly modified 2001/07/22 * TrueType Font Rendering (using Xft extension - with the help of Lukas Hejtmanek) * smarter DirectRendering mode - should work all the time with necessary conversions 2001/07/21 * very extensive cleanup of conversion modes of images * cleaned some hacks in Win32 VideoDecoder class * added some hack for correct playing of several not very used codecs like huffyuv, asv1, asv2, vcr2 * large speedup of C-version routines for conversion RGB 24b->16b 2001/07/18 * fixed bug in Subviewer reader * fixed two memory leaks discovered by mprotector * added support for few more codecs 2001/07/17 * lots of code cleanup * started to cleanup some types - transformation to uint32... * some fixies in DirectShow code * fixed several MAJOR bugs in qtrecompressor - now it even works - though it's still rather a toy application and I would not advice to use it for any serious thing yet * ffmpeg 0.4.4 * autoconf2.50 compatible - anyone dissagree ??? 2001/07/14 * another speedup of resumpling code - should be now very efficient * -ljpeg for avimake 2001/07/11 * added libmp3lamebin plugin which as able to load libmp3lame at runtime 2001/07/10 * 4 times faster resampling - using just interger arithmetic * scanning WIN32_PATH, /usr/lib/win32, /usr/local/lib/win32 paths for dll 2001/07/09 * able to use ffmpeg library - version 0.4.3 is now in avifile CVS - original CVS seems to be now the tree of the mplayer. for now we could use it to play OpenDivX - it could also play DivX :-) * minor redesing of videodecoder API - now we have Start/StopInternal * cleaned mjpeg_plugin * started to clean DirectShow directory to make it C-compilable (so it could be used by mplayer and others...) * also made quite a few cleanups in other places * fixed WIN32_PATH support * added AVIPLUGIN_PATH shell variable * fixed AVIPLAY_MUTE_VIDEO, AVIPLAY_MUTE_AUDIO * few fixes for debian 2001/06/28 * another change in constants in scheduler * interface change! - GetHeader(void* header, size_t n) 2001/06/26 * Locker.h and VideoDPMS.h are now public * fixed few problems in frame elimination in video decoder class 2001/06/23 * complete rewrite of players' thread - is it now FreeBSD safe ?? - also we are no longer using avi_usleep for audio synchronization and instead we use timed condition which has adwantage that we have immediate hangup when thread is sleeping * added NextFrame aviplay method - usable with 'Return' key in aviplayer * implemented initial 'hacked' support for better priority handling - if you set uid.gid to root.root together with 'suid' bit, that video thread will use -10 priority for better timing - however BIG WARNING is here - you are using closed-source windows binary dll codecs - during their execution aviplayer is using user uid & gid - however you never know what could happen! * for this reason it looks like the best is to lower the priority if audio & video decoding threads so video thread gets its needed CPU when necessery. 2001/06/21 * complex GUI update for configuration of aviplayer (some of buttons now even works in runtime so you don't have to restart player - ok I know - still not perfect...) * resampling is now more usable as it could do far more things then just pure 44kHz resampling - so why not making it fully usable - its even nice feature * version-info - library has now number 0.0.6 (level 0 version 0.6) * another streaming bug fixed - so we play more asf stream over the net 2001/06/20 * fixed & tuned resampling to remove clics for unsigned char audio stream (but some check for the overflow would help us too) * extended stream info added (check movie property) 2001/06/18 * some deadlocks in audio renderer - SDL_LockAudio now works somehow better but it is still not usable * no longer processing keyboard events which belongs to other applications * fixed resampling - that was really stupid bug and not that easy to fix but the result is very good 2001/06/18 * minor updates in network asf - it just works - but it's still crashing a lot * staying compatible with qt2.X * added hack for NVidia cards - autodetected by looking for NVIDIA-GLX extension - could be forced on by setting export AVIPLAY_NVIDIA_ENABLE=1 or off with this shell command executed before aviplayer gets started export AVIPLAY_NVIDIA_DISABLE=1 2001/06/16 * a lot of fixes in asf parsing code - finally we are able to detect end of the file properly * redesigned and simplified event handling in aviplayer * a-v sync is now 100% better than it ever was * maximize return to its previous size when switching off fullscreen * hopefully fixed problem with mpg sound which could occasionaly get broken * GUI updates * added keys '[', ']' to modify a-v sync - (adds, subs 0.1 sec) * UNIQUE frame-dropping technique - now even very slow computers could be used to view movies in audio-video sync !!!! 2001/06/12 * more keyboard updates * added methods for setting getting video renderers in aviplay class (set is however unimplemented so far) * reading video modes and making them available in maximize modes 2001/06/11 * improved player keyboard handling - seeking is better & faster again * GetFrame is using Lock instead of usleep - faster reaction 2001/06/08 * redesigned whole ToggleFullscreen & Resize system - now it should work reliable, fast and without strange locking problems (at least I hope so) Pressing 'm' key is now the best thing you could do to view the move * added support for SubRip subtitles * l3codeca.acm - windows mp3 dll library seems to be working now! * quick resizing with keys: 1 (0.5x), 2 (1x), 3 (2x) * fixes in audio synchronization * fixed YV12 drawing (swaped 2nd & 3rd plane) * benchmark supports YV12 2001/06/05 * hardly played with synchronization we can now resize window without stopping playing!!! (try this with other players :) 2001/05/30 * fixed couple deadlocks in AudioRenderer * fixed Uncompressed video decoder * added autorepeat for SDL 2001/05/28 * slowly adding support for direct rendering * again general rewrite of scheduler - simplier and more efficient * of course the complex part did not dissappeared - its now in audio renderer - which is being constantly modified so OSS & Sun are currently not supported until they will be fixed to match complexity of SdlAudioRenderer 2001/05/19 * as some more issues have been resolved in the audio time calculation we could now have much more simple and precise video image scheduling A-V is in in milisecond range - just check (export AVIPLAY_DEBUG=1) * reconstructing even seriously broken .avi files you could really split two .avi files and then join them in any order - you just need the correct initial header * few changes in qtrecompress GUI * bugfix: some codecs needs previous image to be stored in the new decoded image * supporting more flags for benchmark utility: -seek, -frame, -length 2001/05/15 * played a bit with DPMS code - now it should be compilable even on older systems * tuned Dropping algorithm 2001/05/13 * removed memorymut - replaced with two utility functions - memory_un/lock() * aviplay.h: Set/GetSubAsync -> Set/GetSubtitlesAsync InitSubtitles is now public function (well not full usable at this moment) 2001/05/12 * New VIDEO IMAGE scheduler - its giving excelent result to me - however my machine is quite powerful SMP computer so this needs to be test with other types of machine (btw - mplayer has made lately some progress in this area too - and we have to be better :)) * reconstruction of index on broken DivX movies - now checks for KeyFrames (inspired by mplayer code) * reading from avistream is now more endinadness independent - but this probaly has to be checked in the real small endian machine. 2001/05/08 * significant speed for large movies - memory is now protected when doing large memory transfers so we are not loosing the speed too much ion this case - was hard to figure out and current solution is not very nice - its rather a hach * changed drawFunc - they are now replaced with list of video renderes yet function to add them on the fly are missing for now - will be resolved later - expect some interface changes in this area 2001/05/06 * timing changed more - so more ASF files are played correctly if anyone has something we are playing completely wrong - let me know * VBUFSIZE is now in the class which implements IVideoDecoder and is quite easily changable - maybe configurable option in future... 2001/05/05 * !!IMPORTANT!! general update of several public interfaces (changes are not that big - but probably require simple updates, I wanted to make these changes before library get used by more projects) - unification of various method names doing same thing - SeekTime replaces Seek(double) - it better visible what's going on - GetEndPos -> GetLength - GetEndTime -> GetLenghtTime - LengthTime -> GetLenghtTime - Length -> GetLength - FormatSize -> GetFormatSize - FourCC -> GetFourCC - Prev/Next/NearestKeyFrame -> Get* - ToNext/PrevKetFrame -> SeekToNext/PrevKeyFrame - SetRealtime -> SetDecodingMode - config_entry -> ConfigEntry - GetDrop, GetQuality -> GetAvgDrop, GetAvgQuality * new code for timing ASF files * added QualityAuto & PreserveAspect in RegAccess * many changes across the whole source base because of this * implemented Preserve Aspect Ratio * implemented CPU Quality checkbox (still missing setting Quality after Off) * fixed bug with killHandler destruction - caused crashes with broken videostreams * found & fixed deadlock in Mpeg layer3 decoding (now just writes: MP3 Stream reinitialized! and reinitialize decoder) * we are again playing Video free avi/wma/asf streams. * fixed deadlock case in AviMediaReadStream::find 2001/05/04 * fixed playing of asf files with variable frame rate - e.g. when frame should stay on the screen for longer time current solution allows immediate seeking * more changes to videodecoder interface class few things have been made private and I suppose more change will be made within this class - if you are building your own decode watch closely these updates. * fixed some bugs when Videostream is not present 2001/05/01 * code cleanup * now progress bar shows correct info for direct show DivX * clenaup of members of videodecoder class * some updates for Spark i386 architecture * VideoDPMS is now separate class 2001/04/30 * fixed and rewrote destruction of aviplayer class (now its more clean) * adding several methods to win32.c so huffyuv codecs almost works * rewrote & fixed reading .SRT subtitles (takes less space) also this will be moved to separate class file - also the support for SMI subtitles will be added soon * add few more keystrokes to aviplayer to be compatible with movie window * fixed and repaired wrong image time reading - we were reading time information for the next image and also it was causing unpleasent effect on the image redrawing when mouse enters the window - its the only reasonable way to simulate expose event for this moment - now its almost unnoticable. * support for DivX VKI - DIV5, DIV6 - user has to install these libraries: divxcvki.ax & divxcvki.dll * implemented several new functions in win32 to make huffyuv work better so far RGB variant is upside-down in player and corretly in qtrecompress YUV variant looks OK in player and is upside-down in qtrecompress * variuous fixes in qtrecompress - but for this moment is still pretty much broken piece so I would still advice to use VirtualDub. * many other minor bugfixes - like missing -O2 flag in configure.in, * fixed uggly bug in videodecoder - we have to use mutex in this case * we should be now nearly as fast as mplayer I believe 2001/04/27 * fixed compilation some inline for RedHat broken g++ compiler * reversed wrong idea for using DIV5 & DIV6 2001/04/26 * fixed another problem with audio - it looks like its not the right thing to divide rate by dwSampleSize - sometimes there are weird values anyway for now it works - better fix will come later * modified slightly renderer - remember data only in mutexed part - otherwice it might lead to possible race * we are playing huffyuv - for now upside-done in player - but qtrecompress show normal image - this will be fixed * fixed few problems with ACEL incorect initialization - it still doesn't work but at least its not crashing. 2001/04/25 * fixed bug in audio playing - missing division by dwSampleSize * fixed bug with destroying AviPlayer2 object - setting m_bQuit there * Cursor keys Up/Down means 1m forward backward in the movie (similar semantic to mplayer - to not confuse people) * added few fourCC for DivX VKI we will see if this helps * played a bit with renderer so it should refresh images better 2001/04/22 * fixed bug introduced by me for software scaling * added few more calls to PlayerWidget - refresh, maximize * also extended renderer class for refresh call - we are now finaly able to refresh/resize image in pause mode too * slightly modified maximize - it goes to fullscreen mode automagicaly yet it might look slightly weird when the window has to be resized first as it first switch to fullscreen for the current size, that it resizes to the new size and finaly switches to this new screen mode - weird I know, but quite stable for X11 * news keys - 'f' - fullscreen, 'm' - maximize, 'space' - pause * left mouse click - pause 2001/04/20 * changed video decoder interface to separate caching code from actual decoding. Now nearly all caching code is situated in lib/common/impl_video.cpp ( useful for writing new video decoder plugins, also more logical ). * fixed a bug in asf parser code which prevented local .asf files from playing. * removed arts plugin & software motion jpeg decoder from distribution ( they are unusable anyway ). Fixed a few small linking problems. 2001/04/16 * complete rewrite of Cache.cpp - now should be quite efficient (should be almost zero wasted time now) * fixed couple of fast scrolling problems - now should no longer scroller switch frames by itself - actually I've tried hard to get this to the perfection - does anyone notice any problems with aviplayer scroller ?? please let me know (similar scrolling will be backported to recompressor later) * fixed most of problems when doing pause - audio should now continue at the point it has stopped * fixed detection of audio stream - also buffered time is now included into calculation so the audio is not being stopped several seconds before the actual end of video * made couple changes to be more gcc3.0 compatible - however this compiler seems to be seriously broken these days and needs way to much memory to compile classes with member values which are classes again (pointers are OK) also for some weird reason std::string as a member value is also some kind of brake barrier for this compiler 2001/04/07 * another set of gcc3.0 compatibility patches (by Dirk Mueller) * started to support /dev/misc/mga_vid (not yet finished) 2001/04/07 * continued with cleaning of audio classes * added few more locks into video renderer * fixed problem with opening menu in fullscreen window * using smaller amount of precached images (15) (rewritten some part of videodecoders) * popup menu for midle mouse button and about menu is created only once * fixed bug in ReadString - def_string has not been copied * fixed couple bugs in qtrecompres - should not by cycling and should be showing some images at least * played a bit with qtvidcap - modified some parts of the gui to be fully resizable 2001/03/31 * heavy cleaning in many files - creating a lot of new files during this process * fixed problems which has prevented compilation with optimized of Win32 loader * fixed loop bug in qtrecompress * mpeg decoder has to be compiled with optimalization because of inlines! * started to add more types - like fourcc_t * modified IVideoDecoder - m_bh is now just pointer to memory which is copy if format - this way we support longer BITMAPINFOHEADER structures yet few problems still remains * some modification to configure.in * possibly fixed problem with asynchronous sound (not so sure for now however) but this problem problem has to be checked more deeply for now I've just checked SDL Audio renderer * changes some mimetype for artsc (to fix debian bugreport) 2001/03/26 * Quality progress bar should give some meaningful status for DivX movies * another change in time scheduler * fixed couple destructors so we are getting less coredumps on program exit * tried to add huffyuv codec - still doesn't work * fixed few problems with configure.in - should be able to build without SDL * few more updates for gcc3.0 compatibility 2001/03/21 * few changes to make compilation of avifile on RedHat with broken gcc more comfortable (so it doesn't take hours to compile one .cpp file) 2001/03/19 * quality setting from command line stays across movie change * cleanup of huge amount of gcc -pendantic warnings (mainly in lib) * slightly changed behavior of slider - when paused you should see the image with slider movement * added working Xv render - but it has few reason for segfaults so it currently available only by code editing * played heavily with the solution for image flickering nice solution seems to be my new modified version of mga_vid device taken from mplayer - but we use only code for interrupts and we rather use this device as interrupt generator - which is clean and its highly possible that this will hit mainstream kernel sometimes in the future currently mga_vid driver is provided with the avifile package - user has to recompile device itself * few more fixes in the behaviour of GUI (switching between image size) * fixed some problems with subtitles (but they should be reworked later) * fixed and added some noticing messages were some problems with resize appears * unified volume_func (using quadratic steps for now) * applied patch for SUN audio on solaris by Juergen Keil 2001/03/12 * started to use unsigned long in most seek commands (4GB compatibility) this is a big change in the interface and probably few bugs are still left in the code also writing code was not yet modified! * cleaned some interface header files * added volume slider and mute button * added quality progres bar (its not yet fully operational - support for auto quality selection is not finished) * YV12 doen's work - FIXME * SDL double buffer doesn't work - FIXME 2001/03/12 created file avifile-0.7.48~20090503.ds/Doxyfile0000644000175000017500000001611007465440343015457 0ustar yavoryavor# Doxyfile 1.2.13-20020210 #--------------------------------------------------------------------------- # General configuration options #--------------------------------------------------------------------------- PROJECT_NAME = Avifile PROJECT_NUMBER = "version 0.7" OUTPUT_DIRECTORY = doxy OUTPUT_LANGUAGE = English EXTRACT_ALL = YES EXTRACT_PRIVATE = YES EXTRACT_STATIC = YES EXTRACT_LOCAL_CLASSES = YES HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = NO BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = YES ALWAYS_DETAILED_SEC = YES INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = NO STRIP_FROM_PATH = INTERNAL_DOCS = NO STRIP_CODE_COMMENTS = YES CASE_SENSE_NAMES = YES SHORT_NAMES = YES HIDE_SCOPE_NAMES = NO VERBATIM_HEADERS = YES SHOW_INCLUDE_FILES = NO JAVADOC_AUTOBRIEF = YES INHERIT_DOCS = YES INLINE_INFO = YES SORT_MEMBER_DOCS = YES DISTRIBUTE_GROUP_DOC = NO TAB_SIZE = 8 GENERATE_TODOLIST = YES GENERATE_TESTLIST = YES GENERATE_BUGLIST = YES ALIASES = ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 OPTIMIZE_OUTPUT_FOR_C = YES OPTIMIZE_OUTPUT_JAVA = NO SHOW_USED_FILES = YES #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- QUIET = NO WARNINGS = YES WARN_IF_UNDOCUMENTED = YES WARN_FORMAT = "$file:$line: $text" WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = include/ FILE_PATTERNS = *.cpp \ *.h \ *.c RECURSIVE = YES EXCLUDE = include/config.h EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = EXAMPLE_PATH = EXAMPLE_PATTERNS = EXAMPLE_RECURSIVE = NO IMAGE_PATH = INPUT_FILTER = FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- SOURCE_BROWSER = NO INLINE_SOURCES = NO REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = NO COLS_IN_ALPHA_INDEX = 5 IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = html HTML_FILE_EXTENSION = .html HTML_HEADER = HTML_FOOTER = HTML_STYLESHEET = HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO GENERATE_CHI = NO BINARY_TOC = NO TOC_EXPAND = YES DISABLE_INDEX = NO ENUM_VALUES_PER_LINE = 4 GENERATE_TREEVIEW = NO TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- GENERATE_LATEX = NO LATEX_OUTPUT = latex LATEX_CMD_NAME = latex MAKEINDEX_CMD_NAME = makeindex COMPACT_LATEX = NO PAPER_TYPE = a4wide EXTRA_PACKAGES = LATEX_HEADER = PDF_HYPERLINKS = NO USE_PDFLATEX = NO LATEX_BATCHMODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- GENERATE_RTF = NO RTF_OUTPUT = rtf COMPACT_RTF = NO RTF_HYPERLINKS = NO RTF_STYLESHEET_FILE = RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- GENERATE_MAN = NO MAN_OUTPUT = man MAN_EXTENSION = .3 MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- GENERATE_XML = NO #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- ENABLE_PREPROCESSING = YES MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = NO SEARCH_INCLUDES = YES INCLUDE_PATH = INCLUDE_FILE_PATTERNS = PREDEFINED = __attribute__ \ __packed__ \ _WAVEFORMATEX EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::addtions related to external references #--------------------------------------------------------------------------- TAGFILES = GENERATE_TAGFILE = ALLEXTERNALS = NO EXTERNAL_GROUPS = YES PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- CLASS_DIAGRAMS = YES HAVE_DOT = NO CLASS_GRAPH = YES COLLABORATION_GRAPH = YES TEMPLATE_RELATIONS = YES HIDE_UNDOC_RELATIONS = YES INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES GRAPHICAL_HIERARCHY = YES DOT_IMAGE_FORMAT = png DOT_PATH = DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1024 MAX_DOT_GRAPH_HEIGHT = 1024 GENERATE_LEGEND = YES DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::addtions related to the search engine #--------------------------------------------------------------------------- SEARCHENGINE = NO CGI_NAME = search.cgi CGI_URL = DOC_URL = DOC_ABSPATH = BIN_ABSPATH = /usr/local/bin/ EXT_DOC_PATHS = avifile-0.7.48~20090503.ds/INSTALL0000644000175000017500000000365411167212540015001 0ustar yavoryavorINSTALL To build 'avifile' project If you are using CVS (i.e. you have checked out project from avifile CVS repository from sourceforge.net) there IS NO configure script present. That means you have to create one for yourself. This can be accomplished with execution of shell script: autogen.sh in the CVS main directory. Be aware that you need relatively well configured system to be able to use this script. Note if you believe your system is properly configured and avifile's autogen.sh script doesn't create usable 'configure' script - please contact avifile maintainer - we will ask you for more details and we try to resolve your problem (we know there are always some - but we could resolve them only with your help) You may try to use CVS snapshot available in download section on avifile.sourceforge.net which contains valid configure script. now if you have valid configure script or you have downloaded the .tgz CVS snapshot you should run script: configure Note: you may use some extra options - check 'configure --help' to list them all after successful configuration (i.e. there are no error/fatal messages) just compile and install avifile project with this command make -j 2 install if there is still a problem - please report it - otherwise it will not be fixed as your problem is for 90% specific to your system - so never expect it will resolve itself. ============================================= === to build RedHat/Mandrake .rpm package === ============================================= rpm -ba /usr/src/packages/SPECS/avifile.spec Note: You could find some packages or links to them on avifile.sourceforge.net Moreover avifile.spec file in avifile project is currently out-of-date ==================================== === to build Debian .deb package === ==================================== fakeroot debian/rules binary-arch Note: Unstable Debian contains avifile packages so you may use them. avifile-0.7.48~20090503.ds/Makefile.am0000644000175000017500000001225611164672153016011 0ustar yavoryavorSUBDIRS =\ ffmpeg\ drivers\ lib\ plugins\ libavqt\ player\ samples mainincludedir = $(pkgincludedir) maininclude_HEADERS =\ include/audiodecoder.h\ include/audioencoder.h\ include/avifile.h\ include/aviplay.h\ include/avm_args.h\ include/avm_cpuinfo.h\ include/avm_except.h\ include/avm_creators.h\ include/avm_default.h\ include/avm_fourcc.h\ include/avm_locker.h\ include/avm_output.h\ include/avm_stl.h\ include/configfile.h\ include/cpuinfo.h\ include/creators.h\ include/default.h\ include/except.h\ include/formats.h\ include/fourcc.h\ include/image.h\ include/infotypes.h\ include/Locker.h\ include/playerwidget.h\ include/renderer.h\ include/StreamInfo.h\ include/subtitle.h\ include/utils.h\ include/version.h\ include/videodecoder.h\ include/VideoDPMS.h\ include/videoencoder.h noinst_HEADERS =\ include/avm_avcodec.h\ include/avm_avformat.h\ include/avm_map.h\ include/configff.h\ include/mmx.h\ include/plugin.h\ include/vbrctrl.h m4datadir = $(datadir)/aclocal m4data_DATA =\ bin/avifile.m4 man_MANS =\ doc/avibench.1\ doc/avicap.1\ doc/avicat.1\ doc/avifile-config.1\ doc/avimake.1\ doc/aviplay.1\ doc/avirec.1\ doc/avirecompress.1\ doc/avitype.1\ doc/kv4lsetup.1 pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA =\ avifile.pc pkgdatadir = $(datadir)/$(PACKAGE)/pixmaps pkgdata_DATA =\ bin/about.ppm\ bin/bottom.ppm\ bin/down.ppm\ bin/mute.ppm\ bin/open.ppm\ bin/opena.ppm\ bin/opens.ppm\ bin/pause.ppm\ bin/play.ppm\ bin/stop.ppm\ bin/test.png\ bin/test.xpm\ bin/top.ppm\ bin/up.ppm pkgdocdir = $(datadir)/$(PACKAGE)/doc pkgdoc_DATA =\ ChangeLog\ COPYING\ doc/avicap/avicap.html\ doc/avicap/configuration.html\ doc/avicap/epg.html\ doc/avicap/shutdown_resume.html\ doc/avicap/timertable.html\ doc/CREDITS\ doc/EXCEPTIONS\ doc/FreeBSD\ doc/KNOWN_BUGS\ doc/LICENSING\ doc/README-DEVEL\ doc/TODO\ doc/VIDEO-PERFORMANCE\ doc/WARNINGS\ README EXTRA_DIST =\ INSTALL\ admin/am_edit\ admin/strip_fPIC.sh\ admin/version.sh\ admin/depcomp\ admin/gendefs.sh\ autogen.sh\ avifile.spec.in\ avifile.pc.in\ debian/avifile-player.dirs\ debian/avifile-player.lintian\ debian/avifile-player.menu\ debian/avifile-player.mime\ debian/avifile-player.postinst\ debian/avifile-player.postrm\ debian/avifile-utils.dirs\ debian/avifile-utils.lintian\ debian/avifile-utils.menu\ debian/builddeb\ debian/control\ debian/copyright\ debian/changelog\ debian/libavifile-0.7-dev.dirs\ debian/libavifile-0.7c2.lintian\ debian/postinst\ debian/postrm\ debian/README.debian\ debian/rules\ include/version.h.in\ m4/a52.m4\ m4/as.m4\ m4/compiler.m4\ m4/dc1394.m4\ m4/divx.m4\ m4/dts.m4\ m4/faad.m4\ m4/ffmpeg.m4\ m4/freetype2.m4\ m4/iconv.m4\ m4/mad.m4\ m4/ogg.m4\ m4/oss.m4\ m4/pkg.m4\ m4/sdl.m4\ m4/v4l.m4\ m4/v4l2.m4\ m4/various.m4\ m4/vidix.m4\ m4/vorbis.m4\ m4/xvid.m4\ m4/xvid4.m4\ $(m4data_DATA) $(man_MANS) $(pkgconfig_DATA) $(pkgdata_DATA) $(pkgdoc_DATA) bin_SCRIPTS = avifile-config install-data-hook: -rm -f $(DESTDIR)$(includedir)/avifile $(LN_S) $(PACKAGE) $(DESTDIR)$(includedir)/avifile uninstall-local: -rm -f $(DESTDIR)$(includedir)/avifile mostlyclean-generic: -rm -f core build-stamp configure-stamp `find . -name '#*' -o \ -name '.\#*' -o -name '.*~' -o -name '*~' -o -name 'core*'` -rm -rf core `find . -name autom4te.cache` -rm -f $(PACKAGE)_$(VERSION).tar.gz -rm -f $(distdir).tar.gz $(PACKAGE).tgz package_descriptions -rm -rf $(distdir) debian/libavifile*[0-9] ## not really usable now -name '.deps' DISTCLEANFILES =\ admin/depcomp\ include/version.h MAINTAINERCLEANFILES =\ $(pkgconfig_DATA)\ aclocal.m4\ admin/compile\ admin/config.guess\ admin/config.status\ admin/config.sub\ admin/depcomp\ admin/gendegs.sh\ admin/install-sh\ admin/libtool\ admin/ltconfig\ admin/ltmain.sh\ admin/missing\ admin/mkinstalldirs\ avifile-config\ avifile.spec\ confdefs.h\ config.cache\ config.log\ config.status\ configure.ac\ configure\ include/config.h.in\ include/stamp-h.in\ include/stamp-h1.in\ libtool\ Makefile.in\ stamp-h2.in # speedup compilation of check target DISTCHECK_CONFIGURE_FLAGS = --disable-release # Run ldconfig after installing the library: #install-hook: # -ldconfig # unportable to RedHat - install-exec-hook runs prior instalation! #install-exec-local: # $(INSTALL_SCRIPT) -m 0755 $(srcdir)/avifile-config $(DESTDIR)$(bindir) .SILENT: help configure.in: m4/*.m4 deb: dpkg-buildpackage -sa -pgpg -ICVS -I.cvsignore -rfakeroot testdeb: fakeroot debian/rules binary-arch tags: find $(top_srcdir) -name '*.cpp' -o -name '*.c' -o -name '*.h' | xargs ctags -a help: echo "Useful targets:" echo " make [all] : compile all the avifile parts" echo " make install : install 'avifile' stuff on your system" echo " make clean : cleanup compilation stuff" echo " make distclean : remove data relative to your system" echo " make deb : create signed debian package" echo " make testdeb : just make debs - quick for testing" echo " make tags : generated tags files with ctags" echo "Note: you may try to run 'autogen.sh'," echo " and then run './configure' before trying to compile" echo " if you have some compilation troubles" avifile-0.7.48~20090503.ds/README0000644000175000017500000002305110474300470014621 0ustar yavoryavor This archive contains version 0.7 of the Avifile library, an AVI player and a couple of sample apps. === Requirements === Linux ( should work on all modern distributions, kernel 2.2.0 or newer ) or FreeBSD >=4.1 ( thanks to Hiroshi Yamashita ). Win32 binaries for compression/decompression of video ( available from site ). Some test programs expect to find 384*288*24 BMP file './uncompr.bmp'. Processor: Intel Pentium or compatible. MMX is strongly recommended. C++ compiler, compatible with latest C++ standard ( such as gcc 2.95.2 ). === Requirements for 'aviplay' sample === XFree86 3.x or 4.x. Qt library ver. 3.0 or newer. If you've built Qt from sources, environment variable QTDIR should point at root of installation or you should specify path to Qt in ./configure options. SDL library ver. 1.0 or newer. Version 1.1.7 may cause problems with compilation and thus isn't recommended to use - use 1.2 or better if you can. === Requirements for 'qtvidcap' sample === Video capture card with V4L1 interface driver. Tested on bttv: http://www.in-berlin.de/User/kraxel/bttv.html. For Miro DC10+ cards you should read carefully README from driver package ( section related to uncompressed video capture ). I suppose you know what you are doing if you are trying to use it, so no documentation about capturing process is available yet. Installation ( ideal variant ): (See INSTALL for installation of CVS version) mkdir /usr/lib/win32 unzip ./binaries.zip -d /usr/lib/win32 tar zxf ./avifile-xxx.tar.gz cd avifile #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # for the latest CVS release - running 'autogen.sh' is strongly recommended # it will create correct configure script for your system # # you may use CVS snapshot which contains all necessary scripts together # with configure script ./configure make make install aviplay You can use 'make install-strip' instead of 'make install' if you are worried about disk usage. It'll give you additional 3-4 MB of disk space, but you won't be able to produce gdb backtraces ( see below, section Reporting Bugs ). By default it installs main shared library into directory /usr/local/lib, you should make sure that /usr/local/lib exists in search part of dynamic linker ( file /etc/ld.so.conf and environment variable LD_LIBRARY_PATH ). ./configure options: --enable-release Turn on optimisations. Does not affect player performance. (also disables compilation of debug info so its much harder to detect reason for crash) --without-sdl Disables SDL code. Not recommended. --without-qt Disables Qt utilities. Not recommended --prefix= Where to install library. Default is /usr/local. --with-qt-dir= --with-qt-includes= --with-qt-libraries= Specify these options if ./configure fails to find your Qt installation, if you receive strange Qt-related errors or if you want to build 'aviplay' for an alternative version of Qt. PERFORMANCE: Aviplay tries to be relatively efficient, but it's still very CPU-intensive product. It's hard to tell what are its minimum requirements. For playing of DivX ;-) AVI files in 720x480 you'll need P2-300 ( with good video card ) or P3-600 ( with bad one ). For 384x288 DivX ;-) lower limit is about P200MMX to P2-400. Check doc/VIDEO_PERFORMANCE if you are having problems with performance. Player will use 2D hardware acceleration if it's available in your system. As of 11/25/2000, you'll need the following: * XFree86 4.0 or newer (Xvideo hardware accelerated extension) * One of the following video cards: - Matrox G400. - Any NVIDIA card with installed binary driver, that is available from http://www.nvidia.com. - ATI newer cards (e.g. Radeon should work) It may also work with the other video cards, but you will need latest driver. Refer to XFree86 4.0.2 documentation for details about XVideo extension support in various card drivers. Hardware acceleration reduces ( by 20-30% in 16-bit color ) CPU load and allows to perform hardware scaling of the picture. Here are CPU load numbers, measured on Pentium II-400(480)/Riva TNT, 16 bpp, 384x288 movie at 25 fps ( by Sergey Zhitomirsky, szh (at) 7ka,mipt,ru ): ZOOM HARDWARE SOFTWARE 1x 20-25% 25-30% 2x 20-25% 40-45% 1024x768 20-25% 45-50% Acceleration can be disabled from 'config' player menu. REPORTING BUGS: Please include output log and gdb backtrace in case of segfault or lock-up. Backtrace is desired for all running threads: $ gdb aviplay (gdb) run ( type 'cont' if gdb stops with non-fatal messages ) (gdb) info threads (gdb) thread 1 (gdb) bt (gdb) thread 2 ... The amount of these data is the only significant factor in catching your bug. I can't understand what's going wrong for you if you only tell me that 'aviplayer has crashed when closing'. Your comments are welcome, but please look through the FAQ before posting them. It's up-to-date version is available at http://divx.euro.ru/faq.htm. Mail your questions and at divx@euro.ru. SCHEDULING PRIORITIES For the best video experience it's useful to understand Linux scheduler and also it's good to know how aviplay internaly works. So here is some short overview: Player is divided into several threads - for prefetching data, decoding audio, playing audio, decoding video, playing video and GUI has also its own thread. Also X11 events have its own thread. So you see there is quite a lot of them - most of them are idle most of the time. But some of them have almost real-time needs. The most important one is video thread which main purpose is it place the image from buffered queue to the screen at very precise time. You would not notice 10ms delays, but anything above this create noticable jerk in the video. So now few words about priorities - if all of these threads have same priority then video decoder is fighting for the CPU with video drawing thread - however if we increase priority (thus make task less preffered for the CPU) that we increase the chance that image will be placed on the screen at the right time. Ok now I hope you understand the reason for lowering priority of video & audio decoding threads: 1. Video decoder is highly CPU intensive task - actually it's the only one which really keeps your CPU busy when you use hw accelerated rendering) - and all decoded images are stored in buffers (when enabled) thus this thread doesn't need high priorities. 2. Audio decoder takes far less CPU and as we are caching more than 1sec of audio we also do not need very precise timing in this process. If these threads have lower priority that it looks like video playing thread gets all the needed time. There is also another way - using FIFO scheduler - however for this reason the player's binary has to made root.root suid (or you could even run it as root which is even more dangerous) - this is serious problem for the security of your system - thought the player tries to use this priority only when changing scheduler and then drop this root privileges for the decoding you never know what you could expect from binary-only Windows code (in case you run this as root - then windows codec have full control over your system!) So before you start to ask developers why you see highly CPU intensive task with such low priorities - read the text above first and try to find some other places where linux scheduling is described in details. VIDEO OPTIONS * Use 2D hw acceleration When you have some modern graphics cards and XFree4.0 you could use neat Xvideo extension which provides high quality graphics output which could be rescaled by hardware and its also very fast as it is using just 16 bits for superior image quality - also decoding to YUV color space is usually faster * Set CPU quality automagicaly works only when buffering is activated and does the following thing: Aviplayer allocates several buffers for image precaching (currently 13 images are used). Decoding thread continually fills this buffer while video playing thread consumes them. The more the buffer is full the higher CPU quality is being set by player - of course when buffer is becoming empty the CPU quality is lowered. * Direct rendering In this case image is being decompressed directly into graphical memory if possible. This way we save one memory copy of the whole image. * Buffer frames Enables precaching of images - this is very important if you want to have smooth video - and is also necessary for autoquality. If you do not use buffering decoding is slightly faster (e.g. you should use it if you have really slow machine and smooth video is the last thing you would care about) as this way decoding is being made in the one memory place and the previous image doesn't have to be transfered in this place. But as decompression times between frames are really very different between each frame and sometimes they takes time for two video frames you can't expect any miracles. * Dropping frames Generally you should leave this option turned on all the time - only you want to see all the images from the movie and you don't care about time synchronisation. * Preserve video aspect ratio Keeps ratio for video width and height when the window is being resized. Using mga_vid driver (only with MGA card for now) Read the enclosed README in drivers directory #internal getrusage(2), times(2) avifile-0.7.48~20090503.ds/autogen.sh0000755000175000017500000001501211164477363015755 0ustar yavoryavor#!/bin/sh # #set -x acdir="" # can't be made default - some automake will fail here - using only privately # for snapshot creation #use_copy="--copy" use_copy="" forceon="" removeconf="" while [ $# -gt 0 ]; do case "$1" in --acdir) acdir=$2 ; shift ;; --force) forceon="force" ; shift ;; --copy) use_copy="--copy" ; shift ;; --linkac) test -h configure.ac || ln -sf configure.in configure.ac ;; --clean) removeconf="yes" ; rm -f config.cache ;; --clean-am) find . -name autom4te.cache -print0 | xargs -0 rm -rf core ; exit ;; -h|--help) echo "Usage: $0 [OPTIONS]" echo echo "Run all necesary programs to create 'configure' file" echo echo "Options:" echo " --help print this help, then exit" echo " --acdir pass this parameter to aclocal" echo " (see 'aclocal --help' for more details)" echo " --force ignore FATAL error message" echo " --linkac create symbolic link configure.in ->configure.ac" echo " --copy use option --copy with automake and libtoolize" echo " --clean remove configure script & config.cache (forcing its recreation)" exit 0 ;; *) echo "WARNING: unrecognized option: $1 (see --help)" ;; esac shift done echo "Generating build information..." # Touch the timestamps on all the files since CVS messes them up #directory=`dirname $0` #touch $directory/configure.in #touch configure.in # Debian unstable allows to have several different versions of autoconf # in the one system use_automake=automake use_aclocal=aclocal use_libtool=libtool use_autoconf=autoconf use_autoheader=autoheader # some freebsd compatibility lookups for prefered versions findver=14 export findver ( which automake${findver} 2>/dev/null | grep -q "^/" ) && use_automake=`which automake${findver}` ( which aclocal${findver} 2>/dev/null | grep -q "^/" ) && use_aclocal=`which aclocal${findver}` findver=213 ( which autoconf${findver} 2>/dev/null | grep -q "^/" ) && use_autoconf=`which autoconf${findver}` ( which autoheader${findver} 2>/dev/null | grep -q "^/" ) && use_autoheader=`which autoheader${findver}` unset findver # I think links are now OK # Debian will use 2.50 for configure.ac files automaticaly #( which autoconf2.50 2>/dev/null | grep -q "^/" ) && use_autoconf=autoconf2.50 #( which autoheader2.50 2>/dev/null | grep -q "^/" ) && use_autoheader=autoheader2.50 DIE=0 ($use_autoconf --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`autoconf' installed ." DIE=1 } ($use_automake --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`automake' installed." DIE=1 NO_AUTOMAKE=yes } ($use_aclocal --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: Missing \`aclocal'." DIE=1 } ($use_libtool --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`libtool' installed." DIE=1 } if test -z "$acdir" -a -d /usr/local/share/aclocal ; then if !(ls -ld /usr/local/share | grep /usr/share > /dev/null 2>/dev/null ); then if test "`$use_aclocal --print-ac-dir`" != "/usr/local/share/aclocal" ; then INCLUDESTRING="-I /usr/local/share/aclocal" #ACLOCAL_FLAGS=`echo $ACLOCAL_FLAGS | sed s/-I\ \/z//` ACLOCAL_FLAGS="-I /usr/local/share/aclocal $ACLOCAL_FLAGS" ACLOCAL_MAINDIR=`$use_aclocal --print-ac-dir` for FILENAME in `ls $ACLOCAL_MAINDIR`; do if test -e /usr/local/share/aclocal/$FILENAME ; then echo "FATAL: both $ACLOCAL_MAINDIR/$FILENAME and /usr/local/share/aclocal/$FILENAME exist; you must manually delete one of them" echo "or use: autogen.sh --acdir /usr/share/aclocal" if test -z "$forceon" ; then echo "if you still want to continue - use force option" echo "but do not expect it will work! - fix the problem" exit 0; fi fi done fi else echo /usr/local/share is link to /usr/share fi fi # Regenerate configuration files ok=0 rm -f aclocal.m4 configure config.guess config.cache config.log config.sub ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh # test if configure.in is newer the created configure script testfornewer() { test $1.in -nt $1 -o -n "$removeconf" && rm -f $1; } #testfornewer libmmxnow/configure #testfornewer plugins/libmad/libmad/configure echo "Running libtoolize..." libtoolize --force $use_copy > /dev/null || ok=1 if test -d m4 ; then rm -f acinclude.m4; for i in m4/*.m4 ; do cat $i >> acinclude.m4 ; done fi if test -z "$acdir" ; then echo "Running aclocal $ACLOCAL_FLAGS..." $use_aclocal $ACLOCAL_FLAGS || ok=1 else echo "Running aclocal with forced acdir: $acdir" $use_aclocal --acdir=$acdir || ok=1 fi # echo "Running autoupdate..." # autoupdate || ok=1 echo "Running autoheader..." $use_autoheader || ok=1 echo "Running autoconf..." $use_autoconf || ok=1 echo "Running automake..." $use_automake $use_copy --add-missing --foreign || ok=1 # as the automake is unable to pass make distcheck with # am_edit perl script - it's disabled for now # # only invoke in the toplevel dir if test -r admin/am_edit_XXX ; then # disable - XXX doesn't exists echo "Postprocessing automake generated Makefiles" # use only for dirs with Qt programs perl admin/am_edit --foreign-libtool --no-final \ libavqt/Makefile.in \ player/Makefile.in \ samples/artsplug/Makefile.in \ samples/qtrecompress/Makefile.in \ samples/qtvidcap/Makefile.in || ok=1 fi if [ "${ok}" -eq 0 ]; then # remove caching directory rm -rf autom4te.cache echo "Now you are ready to run ./configure" echo " Please remove the file config.cache after changing your setup" echo " so that configure will find the changes next time." echo " To speedup configure process use option cache-file i.e.:" echo " configure --cache-file=config.cache" if test -n "$acdir" ; then echo echo " Note: you have to specify this configure option:" echo " --with-acdir=$acdir" echo " when configuring avifile" fi else echo "Problems detected. Please investigate." echo "Suggested version of used programs (try to use them)" echo " libtool 1.4.1 or better" echo " automake 1.5 or better (automake 1.6.0 is buggy!)" echo " autoconf 2.52 or better" echo "Your installed version:" $use_libtool --version | head -1 $use_automake --version | head -1 $use_autoconf --version | head -1 echo "Report aclocal = " $use_aclocal --print-ac-dir echo "Please report your problem on kabi@users.sourceforge.net" echo "with this log of build process together with system description." fi avifile-0.7.48~20090503.ds/avifile-config.in0000755000175000017500000000360611110410676017160 0ustar yavoryavor#!/bin/sh # avifile-config # # Tool for retrieving the library/include paths avifile was compiled with. # # Written by Zdenek Kabelac kabi@user.sf.net # # This work is released under the GNU GPL, version 2 or later. prefix="@prefix@" exec_prefix="@exec_prefix@" exec_prefix_set=no datarootdir="@datarootdir@" datadir="@datadir@/@PACKAGE@" version="@VERSION@" include_dir="@includedir@/@PACKAGE@" lib_dir="@libdir@" usage() { cat <&2 fi while test $# -gt 0; do case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac case $1 in --prefix=*) prefix=$optarg if test $exec_prefix_set = no ; then exec_prefix=$optarg fi ;; --prefix) echo_prefix=yes ;; --exec-prefix=*) exec_prefix=$optarg exec_prefix_set=yes ;; --exec-prefix) echo_exec_prefix=yes ;; --cflags) echo_cflags=yes ;; --libs) echo_libs=yes ;; --data-dir) echo_data_dir=yes ;; --data-root-dir) echo_data_root_dir=yes ;; --version) echo_version=yes ;; *) usage 1 1>&2 ;; esac shift done if test "$include_dir" != "/usr/include"; then cflags="-I$include_dir" else cflags="" fi libs="-laviplay" #libs="-L$lib_dir @AVIFILE_RLD_FLAGS@ -laviplay" test "$lib_dir" != "/usr/lib" && libs="-L$lib_dir $libs" test "$echo_prefix" = "yes" && echo $prefix test "$echo_exec_prefix" = "yes" && echo $exec_prefix test "$echo_cflags" = "yes" && echo $cflags test "$echo_libs" = "yes" && echo $libs test "$echo_data_dir" = "yes" && echo $datadir test "$echo_data_root_dir" = "yes" && echo $datarootdir test "$echo_version" = "yes" && echo $version avifile-0.7.48~20090503.ds/avifile.pc.in0000644000175000017500000000051111106645003016302 0ustar yavoryavorprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/@PACKAGE@ Name: avifile Description: A library for reading and writing of audio video files Requires: Conflicts: Version: @VERSION@ Libs: -L${libdir} -laviplay Libs.private: @FFMPEG_LIBS@ @DTS_LIBS@ @DC1394_LIBS@ @Z_LIBS@ Cflags: -I${includedir} avifile-0.7.48~20090503.ds/avifile.spec.in0000644000175000017500000001163510746105006016646 0ustar yavoryavor%define name avifile %define ver @AVIFILE_MAJOR_VERSION@.@AVIFILE_MINOR_VERSION@.@AVIFILE_MICRO_VERSION@ %define mjver @AVIFILE_MAJOR_VERSION@.@AVIFILE_MINOR_VERSION@ %define rel 1 %define cvsdate @AVIFILE_BUILD@- %define prefix /usr Summary: AVI file library Name: %name-%mjver Version: %ver Release: %rel License: GPL Group: Development/Libraries Source0: %{name}-%{version}.tar.gz Source1: aviplay.keys Source2: aviplay.mime #Patch0: avifile-%{PACKAGE_VERSION}-patch0 URL: http://avifile.sourceforge.net/ BuildRoot: %{_tmppath}/%{name}-%{version}-build Packager: Mario Mikocevic Mozgy Docdir: %{prefix}/doc Requires: SDL >= 1.2, xvid BuildRequires: qt-devel >= 2.2.0 %description Avifile is a library that allows programs to read and write compressed AVI files (Indeo? Video, DivX :-), etc.) under x86 Linux. (De)compression is performed with Win32 DLLs. CVS %{cvsdate} %package devel Summary: Libraries, includes and more to develop avifile applications Group: Development/Libraries Requires: %{name} = %{ver} %description devel Avifile is a library that allows programs to read and write compressed AVI files (Indeo? Video, DivX :-), etc.) under x86 Linux. (De)compression is performed with Win32 DLLs. This is the libraries, include files and other resources you can use to develop avifile applications. %package utils Summary: Utilities for avifile Group: Applications/Multimedia Requires: %{name} qt >= 3.2.0 Obsoletes: avifile-qt %description utils Utilities for testing avifile library based on QT toolkit. Contains aviplay, avicat, avibench, avicap, avimake, avirecompress, avitype, kv4lsetup %prep %setup #%patch0 -p1 #CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh --prefix=%prefix --enable-release --enable-quiet #CFLAGS="$RPM_OPT_FLAGS -mcpu=i386 -fomit-frame-pointer" CXXFLAGS="$RPM_OPT_FLAGS -mcpu=i386 -fomit-frame-pointer" ./autogen.sh CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh %build # Needed for snapshot releases. #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix --enable-release --enable-quiet --disable-xft #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix --enable-release --enable-quiet --enable-lame --with-qt-dir=/usr/lib/qt2 #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix --enable-release --enable-quiet --disable-samples #CFLAGS="$RPM_OPT_FLAGS -mcpu=i386 -fomit-frame-pointer" CXXFLAGS="$RPM_OPT_FLAGS -mcpu=i386 -fomit-frame-pointer" ./configure --prefix=%prefix --enable-release --enable-quiet -disable-vidix CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix --enable-release --enable-quiet make %install rm -rf $RPM_BUILD_ROOT %makeinstall prefix=$RPM_BUILD_ROOT%{prefix} install ####---------------------desktop entries-------------------------- ###mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/X11/applnk/Multimedia/avifile ###cat >$RPM_BUILD_ROOT/%{_sysconfdir}/X11/applnk/Multimedia/avifile/aviplay.desktop <$RPM_BUILD_ROOT/%{_sysconfdir}/X11/applnk/Multimedia/avifile/avirecompress.desktop <$RPM_BUILD_ROOT/%{_sysconfdir}/X11/applnk/Multimedia/avifile/avicap.desktop < - Updated to 0.7.48 * Tue Dec 10 2002 Mario Mikocevic - Updated to 0.7.22 * Wed Nov 06 2002 Mario Mikocevic - Updated to 0.7.18 * Fri May 24 2002 Mario Mikocevic - Fixed compiling for all i[3456]86 archs * Fri May 03 2002 Mario Mikocevic - Abbandoned DATE in release * Fri Jan 11 2002 Mario Mikocevic - Rewamped .spec * Wed Oct 05 2001 Mario Mikocevic - Fixed .spec for daily CVS update * Wed Sep 12 2001 Mario Mikocevic - Fixed .spec * Sat Jan 27 2001 Eugene Kuznetsov - Updated to conform to new directory layout * Tue Oct 02 2000 Eugene Kuznetsov - Merged in contributed .spec - First public release * Wed Sep 20 2000 Eugene Kuznetsov - First try at an RPM avifile-0.7.48~20090503.ds/config.guess0000755000175000017500000007165407366406717016316 0ustar yavoryavor#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 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 # General Public License for more details. # # You should have received a copy of the GNU 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. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Written by Per Bothner . # The master version of this file is at the FSF in /home/gd/gnu/lib. # Please send patches to the Autoconf mailing list . # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit system type (host/target name). # # Only a few systems have been added to this list; please add others # (but try to keep the structure clean). # # Use $HOST_CC if defined. $CC may point to a cross-compiler if test x"$CC_FOR_BUILD" = x; then if test x"$HOST_CC" != x; then CC_FOR_BUILD="$HOST_CC" else if test x"$CC" != x; then CC_FOR_BUILD="$CC" else CC_FOR_BUILD=cc fi fi fi # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 8/24/94.) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown dummy=dummy-$$ trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. cat <$dummy.s .globl main .ent main main: .frame \$30,0,\$26,0 .prologue 0 .long 0x47e03d80 # implver $0 lda \$2,259 .long 0x47e20c21 # amask $2,$1 srl \$1,8,\$2 sll \$2,2,\$2 sll \$0,3,\$0 addl \$1,\$0,\$0 addl \$2,\$0,\$0 ret \$31,(\$26),1 .end main EOF $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then ./$dummy case "$?" in 7) UNAME_MACHINE="alpha" ;; 15) UNAME_MACHINE="alphaev5" ;; 14) UNAME_MACHINE="alphaev56" ;; 10) UNAME_MACHINE="alphapca56" ;; 16) UNAME_MACHINE="alphaev6" ;; esac fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-cbm-sysv4 exit 0;; amiga:NetBSD:*:*) echo m68k-cbm-netbsd${UNAME_RELEASE} exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; arc64:OpenBSD:*:*) echo mips64el-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hkmips:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; arm32:NetBSD:*:*) echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; SR2?01:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; atari*:NetBSD:*:*) echo m68k-atari-netbsd${UNAME_RELEASE} exit 0 ;; atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; sun3*:NetBSD:*:*) echo m68k-sun-netbsd${UNAME_RELEASE} exit 0 ;; sun3*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:NetBSD:*:*) echo m68k-apple-netbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; macppc:NetBSD:*:*) echo powerpc-apple-netbsd${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ -o ${TARGET_BINARY_INTERFACE}x = x ] ; then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i?86:AIX:*:*) echo i386-ibm-aix exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:4) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=4.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/6?? | 9000/7?? | 9000/80[024] | 9000/8?[136790] | 9000/892 ) sed 's/^ //' << EOF >$dummy.c #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF ($CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` rm -f $dummy.c $dummy esac HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE*:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i?86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*X-MP:*:*:*) echo xmp-cray-unicos exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} exit 0 ;; CRAY*T3E:*:*:*) echo t3e-cray-unicosmk${UNAME_RELEASE} exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; F300:UNIX_System_V:*:*) FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; F301:UNIX_System_V:*:*) echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` exit 0 ;; hp3[0-9][05]:NetBSD:*:*) echo m68k-hp-netbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; i?86:BSD/386:*:* | i?86:BSD/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) if test -x /usr/bin/objformat; then if test "elf" = "`/usr/bin/objformat`"; then echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` exit 0 fi fi echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; *:NetBSD:*:*) echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; *:Linux:*:*) # uname on the ARM produces all sorts of strangeness, and we need to # filter it out. case "$UNAME_MACHINE" in armv*) UNAME_MACHINE=$UNAME_MACHINE ;; arm* | sa110*) UNAME_MACHINE="arm" ;; esac # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. ld_help_string=`cd /; ld --help 2>&1` ld_supported_emulations=`echo $ld_help_string \ | sed -ne '/supported emulations:/!d s/[ ][ ]*/ /g s/.*supported emulations: *// s/ .*// p'` case "$ld_supported_emulations" in i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; esac if test "${UNAME_MACHINE}" = "alpha" ; then sed 's/^ //' <$dummy.s .globl main .ent main main: .frame \$30,0,\$26,0 .prologue 0 .long 0x47e03d80 # implver $0 lda \$2,259 .long 0x47e20c21 # amask $2,$1 srl \$1,8,\$2 sll \$2,2,\$2 sll \$0,3,\$0 addl \$1,\$0,\$0 addl \$2,\$0,\$0 ret \$31,(\$26),1 .end main EOF LIBC="" $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then ./$dummy case "$?" in 7) UNAME_MACHINE="alpha" ;; 15) UNAME_MACHINE="alphaev5" ;; 14) UNAME_MACHINE="alphaev56" ;; 10) UNAME_MACHINE="alphapca56" ;; 16) UNAME_MACHINE="alphaev6" ;; esac objdump --private-headers $dummy | \ grep ld.so.1 > /dev/null if test "$?" = 0 ; then LIBC="libc1" fi fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 elif test "${UNAME_MACHINE}" = "mips" ; then cat >$dummy.c </dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy else # Either a pre-BFD a.out linker (linux-gnuoldld) # or one that does not give us useful --help. # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. # If ld does not provide *any* "supported emulations:" # that means it is gnuoldld. echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 case "${UNAME_MACHINE}" in i?86) VENDOR=pc; ;; *) VENDOR=unknown; ;; esac # Determine whether the default compiler is a.out or elf cat >$dummy.c < #ifdef __cplusplus int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); # else printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); # endif # else printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); # endif #else printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); #endif return 0; } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy fi ;; # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions # are messed up and put the nodename in both sysname and nodename. i?86:DYNIX/ptx:4*:*) echo i386-sequent-sysv4 exit 0 ;; i?86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} fi exit 0 ;; i?86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; i?86:UnixWare:*:*) if /bin/uname -X 2>/dev/null >/dev/null ; then (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 fi echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION} exit 0 ;; pc:*:*:*) # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:*:6*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) #if !defined (ultrix) printf ("vax-dec-bsd\n"); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi #echo '(Unable to guess system type)' 1>&2 exit 1 avifile-0.7.48~20090503.ds/config.sub0000755000175000017500000004774507366406717015765 0ustar yavoryavor#! /bin/sh # Configuration validation subroutine script, version 1.1. # Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc. # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 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 General Public License for more details. # # You should have received a copy of the GNU 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. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. if [ x$1 = x ] then echo Configuration name missing. 1>&2 echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 echo "or $0 ALIAS" 1>&2 echo where ALIAS is a recognized configuration type. 1>&2 exit 1 fi # First pass through any local machine types. case $1 in *local*) echo $1 exit 0 ;; *) ;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in linux-gnu*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple) os= basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ | 580 | i960 | h8300 \ | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w \ | alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \ | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ | 1750a | dsp16xx | pdp11 | mips64 | mipsel | mips64el \ | mips64orion | mips64orionel | mipstx39 | mipstx39el \ | sparc | sparclet | sparclite | sparc64 | v850) basic_machine=$basic_machine-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i[34567]86) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ | xmp-* | ymp-* \ | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ | alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67] \ | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ | clipper-* | orion-* \ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ | sparc64-* | mips64-* | mipsel-* \ | mips64el-* | mips64orion-* | mips64orionel-* \ | mipstx39-* | mipstx39el-* \ | f301-* | armv*-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-cbm ;; amigaos | amigados) basic_machine=m68k-cbm os=-amigaos ;; amigaunix | amix) basic_machine=m68k-cbm os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | ymp) basic_machine=ymp-cray os=-unicos ;; cray2) basic_machine=cray2-cray os=-unicos ;; [ctj]90-cray) basic_machine=c90-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp os=-mpeix ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp os=-mpeix ;; i370-ibm* | ibm*) basic_machine=i370-ibm os=-mvs ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i[34567]86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i[34567]86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i[34567]86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i[34567]86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; miniframe) basic_machine=m68000-convergent ;; mipsel*-linux*) basic_machine=mipsel-unknown os=-linux-gnu ;; mips*-linux*) basic_machine=mips-unknown os=-linux-gnu ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netwinder) basic_machine=armv4l-corel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; np1) basic_machine=np1-gould ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | nexen) basic_machine=i586-pc ;; pentiumpro | p6 | k6 | 6x86) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | nexen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | k6-* | 6x86-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=rs6000-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; symmetry) basic_machine=i386-sequent os=-dynix ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; xmp) basic_machine=xmp-cray os=-unicos ;; xps | xps100) basic_machine=xps100-honeywell ;; *mint | *MiNT) basic_machine=m68k-atari os=-mint ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. mips) if [ x$os = x-linux-gnu ]; then basic_machine=mips-unknown else basic_machine=mips-mips fi ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sparc) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -rhapsody* \ | -openstep* | -mpeix* | -oskit*) # Remember, each alternative MUST END IN *, to match a version number. ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -ctix* | -uts*) os=-sysv ;; -ns2 ) os=-nextstep2 ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -xenix) os=-xenix ;; -*mint | -*MiNT) os=-mint ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-corel) os=-linux ;; arm*-semi) os=-aout ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f301-fujitsu) os=-uxpv ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks*) vendor=wrs ;; -aux*) vendor=apple ;; -*mint | -*MiNT) vendor=atari ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os avifile-0.7.48~20090503.ds/configure.in0000644000175000017500000011102311175405542016254 0ustar yavoryavordnl -*- m4 -*- dnl Process this file with autoconf to produce a configure script. dnl dnl avifile - library for parsing reading playing audio/video files dnl Copyright (C) 2000-2003 Eugene Kuznetsov, dnl 2000- Zdenek Kabelac dnl dnl stupid idea - works just with 2.52 AC_INIT([avifileX.Y],[X.Y.Z],[kabi@users.sourceforge.net]) AC_INIT(acinclude.m4) dnl AC_CONFIG_SRCDIR([acinclude.m4]) dnl info file says that it is a good idea to put AC_REVISION before AC_INIT dnl unfortunately it triggers a bug in autoconf 2.13 :( Quote: dnl ***BUG in Autoconf--please report*** AC_DISABLE_FAST_INSTALL dnl AC_REVISION(disabled - I no longer like the file modification after commit) configure_options="$@" echo "avifile configure options: $configure_options" AC_CONFIG_AUX_DIR(admin) # libtool versioning # # +1 : ? : +1 == new interface that does not break old one # +1 : ? : 0 == new interface that breaks old one # ? : ? : 0 == no new interfaces, but breaks apps # ? :+1 : ? == just some internal changes, nothing breaks but might work # better # CURRENT: REVISION : AGE # # ok theory was nice - but let's just do it more simple :) AVIFILE_MAJOR_VERSION=0 AVIFILE_MINOR_VERSION=7 AVIFILE_MICRO_VERSION=48 AC_SUBST(AVIFILE_MAJOR_VERSION) AC_SUBST(AVIFILE_MINOR_VERSION) AC_SUBST(AVIFILE_MICRO_VERSION) test -n "$CFLAGS" && have_user_cflags=yes || have_user_cflags=no test -n "$CXXFLAGS" && have_user_cxxflags=yes || have_user_cxxflags=no dnl Detect the canonical host and target build environment AC_CANONICAL_HOST AC_CANONICAL_TARGET dnl Setup for automake AM_INIT_AUTOMAKE(avifile-0.7, $AVIFILE_MAJOR_VERSION.$AVIFILE_MINOR_VERSION.$AVIFILE_MICRO_VERSION ) AM_CONFIG_HEADER(include/config.h) AH_TOP([ #ifndef AVM_CONFIG_H #define AVM_CONFIG_H #ifdef HAVE_AV_CONFIG_H #include /* ffmpegs' predefined set of supported parts */ #endif]) AH_BOTTOM([#endif /* AVM_CONFIG_H */]) dnl Checks for programs. AC_PROG_CXX AC_PROG_CC AM_PROG_CC_C_O AC_PROG_CPP AM_PROG_AS AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_RANLIB AC_PROG_AWK AC_CC_VERSION AC_LANG(C) aviconfigure= aviunconfigure= enable_x86opt=yes enable_win32=yes case "$target" in i586-*) DEFAULT_FLAGS="i586" ;; i686-*) DEFAULT_FLAGS="i686" ;; i?86-*) DEFAULT_FLAGS="i386" ;; # Default for all other x86 (i386 and i486) ia64*|amd64*|x86_64*) enable_win32=no ;; *) DEFAULT_FLAGS= enable_x86opt=no enable_win32=no ;; esac case "$target" in i?86*) if test "$GCC" = yes; then case "$GCC_VERSION" in 2*) GCCOPT=cpu ;; 3.0*) GCCOPT=cpu ;; 3.1*) GCCOPT=cpu ;; 3.2*) GCCOPT=cpu ;; 3.3*) GCCOPT=cpu ;; *) GCCOPT=tune ;; esac DEFAULT_FLAGS="-m$GCCOPT=$DEFAULT_FLAGS -march=$DEFAULT_FLAGS" fi AC_DEFINE(ARCH_X86_32, 1, [Define if you want to build on x86 architecture.]) AC_DEFINE(ARCH_X86_64, 0, [Define if you want to build on x86_64 architecture.]) ;; ia64*|x86_64*|amd64) AC_DEFINE(ARCH_X86_64, 1, [Define if you want to build on x86_64 architecture.]) ;; alpha*) AC_DEFINE(ARCH_ALPHA, 1, [Define if you want to build on alpha architecture.]) enable_alphaopt=yes ;; arm*) AC_DEFINE(ARCH_ARM, 1, [Define if you want to build on arm architecture.]) enable_armopt=yes ;; sparc*) AC_DEFINE(ARCH_SPARC, 1, [Define if you want to build on sparc architecture.]) ;; mips*) AC_DEFINE(ARCH_MIPS, 1, [Define if you want to build on mips architecture.]) enable_mipsopt=yes ;; ppc*|powerpc*) AC_DEFINE(ARCH_POWERPC, 1, [Define if you want to build on ppc architecture.]) enable_ppcopt=yes ;; s390*) AC_DEFINE(ARCH_S390, 1, [Define if you want to build on s390 architecture.]) enable_s390opt=yes ;; esac case "$target" in i?86*|ia64*|amd64*|x86_64*) AC_DEFINE(ARCH_X86, 1, [Define if you want to build on x86 architecture.]) AC_DEFINE(HAVE_MMX, 1, [Define if you want to build with mmx code.]) AC_DEFINE(HAVE_MMX2, 1, [Define if you want to build with mmx code.]) AC_DEFINE(HAVE_3DNOW, 1, [Define if you want to build with mmx code.]) DEFAULT_FLAGS="$DEFAULT_FLAGS -ffast-math -fomit-frame-pointer" esac AC_CHECK_GNU_EXTENSIONS(AC_DEFINE(_GNU_SOURCE, 1, [Define if compiling with large file support on Linux to get the correct prototypes for pread and pwrite.]), []) test "$have_user_cflags" = no && CFLAGS="$CFLAGS $DEFAULT_FLAGS" test "$have_user_cxxflags" = no && CXXFLAGS="$CXXFLAGS $DEFAULT_FLAGS" dnl Check if compiler supports -finline-limit CINLINEFLAGS="-finline-limit-200" AC_TRY_CFLAGS([ $CINLINEFLAGS ], [], CINLINEFLAGS="") AC_SUBST(CINLINEFLAGS) dnl Check if compiler supports -fomit-frame-pointer OMITFRAMEPOINTERFLAG="-fomit-frame-pointer" AC_TRY_CFLAGS([ $OMITFRAMEPOINTERFLAG ], [], OMITFRAMEPOINTERFLAG="") AC_SUBST(OMITFRAMEPOINTERFLAG) dnl Check if compiler supports -fvisibility VISIBILITYFLAG="-fvisibility=hidden" AC_TRY_CFLAGS([ $VISIBILITYFLAG ], [visattr="__attribute__((visibility(\"default\")))"], VISIBILITYFLAG="") AC_SUBST(VISIBILITYFLAG) AC_DEFINE_UNQUOTED(AVMEXPORT, $visattr, [Compilers that support -fvisible flag]) dnl Check if compiler supports -fno-exceptions -fno-rtti AC_ARG_ENABLE(rtti, AC_HELP_STRING(--enable-rtti, [build plugins with rtti and exceptions. [[disabled]]]), [], enable_rtti=no) AC_IF_YES(enable_rtti, [CXXRTTIEXCEPT="-fno-exceptions -fno-rtti" AC_TRY_CXXFLAGS([ $CXXRTTIEXCEPT ], [], CXXRTTIEXCEPT="")], [CXXRTTIEXCEPT=""]) AC_SUBST(CXXRTTIEXCEPT) dnl Use -Wall if we have gcc. changequote(,)dnl if test "$GCC" = yes; then CFLAGS="$CFLAGS -pipe" CXXFLAGS="$CXXFLAGS -pipe" packedattr="__attribute__((packed))" case "$CPPFLAGS" in *[\ \ ]\-Wall[\ \ ]*) ;; *) CPPFLAGS="$CPPFLAGS -Wall -Wno-unused" ;; esac else packedattr="" fi dnl for testing change optimalization to -O0 COPTFLAGS=$CFLAGS CXXOPTFLAGS=$CXXFLAGS CFLAGS=`echo $CFLAGS | sed s/\-O[1-9]/\-O0/` CXXFLAGS=`echo $CXXFLAGS | sed s/\-O[1-9]/\-O0/` changequote([,])dnl AC_DEFINE_UNQUOTED(AVMPACKED, [ $packedattr ], [Keep structure packed]) dnl dnl Libtool dnl dnl AC_LIBTOOL_DLOPEN AM_DISABLE_STATIC AM_PROG_LIBTOOL dnl automatic updating of libtool configuration files dnl not needed with automake AC_SUBST(LIBTOOL_DEPS) dnl using rather hack for .lo creation AM_PROG_AS dnl dnl Endianess - use standard WORDS_BIGENDIAN (for PowerPC) dnl dnl with older autoconf produces warning AC_C_BIGENDIAN dnl Checks for libraries. dnl Replace main with a function in -ldl: AC_CHECK_FUNCS(dlopen, [], [ AC_CHECK_LIB(dl, dlopen, DL_LIBS=-ldl, [ AC_MSG_WARN([could not find dlopen() needed by libaviplay your system may not be supported.]) ]) ]) AC_SUBST(DL_LIBS) AC_CHECK_FUNCS(gethostbyname, [], [ AC_CHECK_LIB(nsl, gethostbyname, EXTRA_LIBS="$EXTRA_LIBS -lnsl") ]) AC_CHECK_FUNCS(nanosleep, [], [ AC_CHECK_LIB(posix4, nanosleep, EXTRA_LIBS="$EXTRA_LIBS -lposix4") ]) AC_CHECK_FUNCS(socket, [], [ AC_CHECK_LIB(socket, socket, EXTRA_LIBS="$EXTRA_LIBS -lsocket") ]) AC_CHECK_FUNCS(kstat_open, [], [ AC_CHECK_LIB(kstat, kstat_open, EXTRA_LIBS="$EXTRA_LIBS -lkstat") ]) AC_SUBST(EXTRA_LIBS) AC_CHECK_FUNCS(lseek64,[ AC_DEFINE(_LARGEFILE_SOURCE, 1, [Define if you want to use _LARGEFILE_SOURCE.]) AC_DEFINE(_FILE_OFFSET_BITS, 64, [Define if you want to use 64bit file support.]) ]) AH_VERBATIM([stdmacros], [/* Define if you want to use INT64_C macros. */ #if defined __cplusplus && ! defined __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS #endif #if defined __cplusplus && ! defined __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS #endif]) dnl AC_SUBST(LIBSOCKET) dnl AC_SUBST(LIBNSL) dnl Replace main with a function in pthread libs: dnl some defaults I386_LDADD= build_avicap=no build_avirecomp=no AC_DEFINE(_REENTRANT, 1, [Define if you want to use pthreads.]) PTHREAD_CFLAGS= PTHREAD_LIBS="-lpthread" dnl Library linking case "$target" in # untested -*-*-solaris*) AVIFILE_RLD_FLAGS="-R\${exec_prefix}/lib" ;; # untested *openbsd) AVIFILE_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib" ;; # linux, freebsd, bsdi *) AVIFILE_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib" ;; esac AC_SUBST(AVIFILE_RLD_FLAGS) case "$target" in *-*-freebsd*) AC_DEFINE(_THREAD_SAFE, 1, [Define if you want to use pthreads on freebsd.]) PTHREAD_CFLAGS="-I/usr/local/include $PTHREAD_CFLAGS" PTHREAD_LIBS="-pthread" ;; i?86-*-netbsd*) I386_LDADD=-li386 ;; *-*-solaris*) ;; *) build_avicap=yes build_avirecomp=yes ;; esac AC_SUBST(I386_LDADD) # LIBS="$pthread_lib $LIBS -Wl,rpath,/usr/X11/lib" AVILIBDEPLIB="$pthread_lib $LIBS -lm" AC_SUBST(PTHREAD_LIBS) AC_SUBST(PTHREAD_CFLAGS) AC_SUBST(AVILIBDEPLIB) AC_CACHE_CHECK([for pthreads], ac_cv_val_pthread, AC_LINK_IFELSE(AC_LANG_PROGRAM([ #include ], [pthread_attr_t type; pthread_attr_init(&type)]), ac_cv_val_pthread=yes, ac_cv_val_pthread=no) ) dnl AC_CHECK_FILE dnl Checks for header files. AC_HEADER_STDC case "$target" in *-linux*) AC_CHECK_HEADER(linux/ioctl.h, , AC_MSG_ERROR([Linux kernel headers are not found! You cannot build this application without them.])) ;; esac AC_CHECK_HEADERS(fcntl.h limits.h malloc.h unistd.h stdint.h assert.h \ sys/types.h sys/ioctl.h sys/ioccom.h sys/time.h sys/mman.h) dnl check for valid header sys/sysinfo.h AC_CACHE_CHECK([for valid sysinfo struct], ac_cv_val_sysinfo_valid, AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include ], [struct sysinfo s_info]), ac_cv_val_sysinfo_valid=yes, ac_cv_val_sysinfo_valid=no) ) AC_IF_YES(ac_cv_val_sysinfo_valid, AC_DEFINE(HAVE_SYSINFO, 1, [Define if you have struct sysinfo in header file.])) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T dnl AC_CHECK_MEMBERS([struct stat.st_rdev]) AC_HEADER_TIME AC_STRUCT_TM dnl Checks for library functions. AC_FUNC_ALLOCA AC_PROG_GCC_TRADITIONAL AC_HEADER_MAJOR dnl AC_FUNC_MALLOC AC_FUNC_MEMCMP dnl AC_FUNC_MKTIME AC_FUNC_MMAP AC_FUNC_SETVBUF_REVERSED AC_TYPE_SIGNAL dnl AC_FUNC_STAT dnl AC_FUNC_STRTOD AC_FUNC_VPRINTF AC_CHECK_FUNCS(ftime gettimeofday strdup strstr setenv unsetenv memalign \ scandir opendir nanosleep localtime_r asctime_r vsscanf) AC_CACHE_CHECK([for extra asctime_r argument], ac_cv_val_asctime_t_long, AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include ], [char* c = asctime_r((struct tm*)0, (char*)0, 0)]), ac_cv_val_asctime_t_long=yes, ac_cv_val_asctime_t_long=no) ) AC_IF_YES(ac_cv_val_asctime_t_long, AC_DEFINE(HAVE_ASCTIME_R_LONG, 1, [Define if you have long 3 params asctime_t in header file.])) AC_ARG_WITH(acdir, AC_HELP_STRING(--with-acdir=path, [use path for autogen.sh.]), with_acdir="--acdir $withval", with_acdir="") dnl ========================= dnl Build with profiling info dnl ========================= AC_ARG_ENABLE(profiling, AC_HELP_STRING(--enable-profiling, [compile with profiling info for gprof. [[disabled]]]), [], enable_profiling=no) dnl =============================== dnl Use some extra warning dnl - we should slowly fix them all dnl =============================== AC_ARG_ENABLE(warnings, AC_HELP_STRING(--enable-warnings, [build with scary gcc warnings. [[disabled]]]), [], enable_warnings=no) if test "$enable_warnings" = yes -a "$GCC" = yes; then CPPFLAGS="$CPPFLAGS\ -Wwrite-strings\ -Wcast-qual\ -Wbad-function-cast\ -Wpointer-arith\ -Wstrict-prototypes\ -Wmissing-prototypes\ -Wmissing-declarations\ -Wnested-externs\ -Wtraditional\ -Wconversion\ -Wcomment\ -Wcast-align\ -Winline\ -Wshadow\ -Wredundant-decls\ -Wid-clash-31 -pedantic " fi dnl ======================= dnl Enable fast compilation dnl ======================= dnl AC_ARG_ENABLE(fast_build, AC_HELP_STRING(--enable-fast-build, [useful for one-time build DO NOT USE! [[disabled]]]), dnl [], enable_fast_build=no) dnl ========================== dnl Check whathever to build dnl debug or optimized version dnl ========================== AC_ARG_ENABLE(release, AC_HELP_STRING(--disable-release, [turn off heavy optimizations. [[enabled]]]), [], enable_release=yes) if test "$enable_x86opt" = yes; then if (echo $GCC_VERSION | grep '2.91' 2>&1 >/dev/null ) ; then AC_MSG_WARN([ *** outdated version of GCC compiler is used, compilation may fail *** - upgrade to 2.95.3 or better is recommended]) enable_x86opt=no fi fi dnl =========================== dnl Check for Freetype2 library dnl =========================== AC_ARG_WITH(freetype2, AC_HELP_STRING(--with-freetype2, [build FreeType2 support. [[disabled]]]), [], with_freetype2=no) AC_IF_YES(with_freetype2, [AC_CHECK_FT2(2.0, [AC_DEFINE(HAVE_LIBFREETYPE, 1, [Define if you have libfreetype library (-lfreetype)])], with_freetype2=no)]) dnl ======================== dnl Check X Window libraries dnl ======================== AC_PATH_XTRA if test "$no_x" = yes; then with_xft=no else X_MYLIBS="$X_LIBS -lXext -lX11 $X_EXTRA_LIBS" save_CPPFLAGS=$CPPFLAGS save_LDFLAGS=$LDFLAGS save_LIBS=$LIBS dnl use -I path for X11 header files CPPFLAGS="$CPPFLAGS $X_CFLAGS" LDFLAGS="$LDFLAGS $X_LIBS" LIBS="" AC_CHECK_LIB(Xi, XGetExtensionVersion, [], [], $X_MYLIBS) AC_CACHE_CHECK([whether system has DGA fce in X11/extensions/dpms.h], ac_cv_val_dga_uint, AC_LANG_PUSH(C++) AC_COMPILE_IFELSE( AC_LANG_PROGRAM([ #include #include ], [XF86DGAGetVideoLL(NULL, 0, (unsigned int*) NULL, NULL, NULL, NULL);]), ac_cv_val_dga_uint=unsigned, ac_cv_val_dga_uint="") AC_LANG_POP ) AC_DEFINE_UNQUOTED(CAST_DGALL, $ac_cv_val_dga_uint, [Define to type of XF86DGAGetVideoLL from X11/extensions/xf86dga1.h file.]) AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [], [], $X_MYLIBS) AC_CHECK_LIB(Xxf86vm, XF86VidModeSwitchMode, [], [], $X_MYLIBS) dnl ===================== dnl Check for Xft library dnl ===================== AC_ARG_WITH(xft, AC_HELP_STRING(--with-xft, [build with Xft. [[autodetected]]]), [], with_xft=yes) AC_ARG_WITH(xft-config, AC_HELP_STRING(--with-xft-config=PATH, [where xft-config is installed.]), XFT_CONFIG="${with_xft_config}/xft-config", []) dnl this is another funny modification of the Xft2 installation dnl after roughly 3 months they have again changed configuration dnl and Debian is properly supporting only pkg-config PKG_CHECK_MODULES(XFT, xft, [], AC_MSG_RESULT([reverting to use xft-config])) if test -z "$XFT_LIBS"; then dnl xft2 is a bit tricky and introduces xft-config if test -z "$XFT_CONFIG" -a -z "$XFT_LIBS"; then AC_CHECK_PROGS(XFT_CONFIG, xft-config, "") if test -n "$XFT_CONFIG"; then XFT_CONFIG=`which $XFT_CONFIG` AC_MSG_RESULT([setting XFT_CONFIG to $XFT_CONFIG]) fi fi if test -n "$XFT_CONFIG"; then XFT_CFLAGS=`$XFT_CONFIG --cflags | sed -e 's!-I/usr/include[[^/]]!!g' -e 's!-I/usr/include$!!g'` XFT_LIBS=`$XFT_CONFIG --libs` else XFT_CFLAGS="" XFT_LIBS="" fi fi save_xft_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS $XFT_CFLAGS" AC_CHECK_HEADER(X11/Xft/Xft.h, [], with_xft=no) CPPFLAGS=$save_xft_CPPFLAGS if test "$with_xft" = yes; then save_xft_LIBS=$LIBS LIBS="$LIBS $XFT_LIBS" AC_CHECK_LIB(Xft, XftDrawStringUtf8, [ test -z "$XFT_LIBS" && XFT_LIBS="-lXft" AC_DEFINE(HAVE_LIBXFT, 1, [Define if you have libXft.]) ], [], $X_MYLIBS) LIBS=$save_xft_LIBS fi AC_SUBST(XFT_CFLAGS) AC_SUBST(XFT_LIBS) dnl ====================== dnl Check for Xv extension dnl ====================== AC_ARG_WITH(xv, AC_HELP_STRING(--with-xv, [build with Xv extension. [[autodetected]]]), [], with_xv=yes) AC_IF_YES(with_xv, [AC_CHECK_HEADER(X11/extensions/Xv.h, [], with_xv=no)]) AC_IF_YES(with_xv, [AC_CHECK_LIB(Xv, XvCreateImage, [], [], $X_MYLIBS)]) dnl ============================ dnl Check for Xinerama extension dnl ============================ AC_ARG_WITH(xinerama, AC_HELP_STRING(--with-xinerama, [build with Xinerama extension. [[autodetected]]]), [], with_xinerama=yes) if test "$with_xinerama" = yes; then AC_CHECK_HEADER(X11/extensions/Xinerama.h, [], with_xinerama=no, [ #include ]) fi if test "$with_xinerama" = yes; then AC_CHECK_LIB(Xinerama, XineramaQueryExtension, [], [], $X_MYLIBS) fi dnl ======================== dnl Check for DPMS extension dnl ======================== AC_ARG_ENABLE(dpms, AC_HELP_STRING(--enable-dpms, [support DPMS. [[autodetected]]]), [], enable_dpms=yes) AC_IF_YES(enable_dpms, [AC_CHECK_HEADER(X11/extensions/dpms.h, [], enable_dpms=no, [#include ])]) dnl Check for usable DPMS header file if test "$enable_dpms" = yes; then AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support.]) AC_CACHE_CHECK([whether system has DPMS fce in X11/extensions/dpms.h], ac_cv_val_ok_dpms_h, AC_COMPILE_IFELSE(AC_LANG_PROGRAM([ #include #include ], [ void* x = (void*) DPMSQueryExtension; ]), ac_cv_val_ok_dpms_h=yes, ac_cv_val_ok_dpms_h=no) ) if test "$ac_cv_val_ok_dpms_h" = yes; then AC_DEFINE(HAVE_OK_DPMS_H, 1, [Define if you have correct 'X11/extensions/dpms.h' header file.]) fi AC_CHECK_LIB(Xdpms, DPMSQueryExtension, [], [], $X_MYLIBS) fi X_LIBS="$X_LIBS $LIBS -lXext -lX11 $X_EXTRA_LIBS" CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS fi dnl no_x dnl ==================== dnl Check for Qt library dnl ==================== AC_ARG_WITH(qt, AC_HELP_STRING(--with-qt, [build with Qt utils. [[autodetected]]]), [], with_qt=yes) dnl no X means no Qt test "$no_x" = yes && with_qt=no AC_IF_YES(with_qt, [AC_PATH_QT(200, test -z "$qt_version" && qt_version=0 AC_DEFINE_UNQUOTED(HAVE_LIBQT, $qt_version, [Define if using 'Qt' libraries.]), with_qt=no)], [AC_MSG_RESULT([compilation of Qt utils disabled])] ) AC_IF_YES(with_qt,[ AC_LANG_PUSH(C++) save_CXXFLAGS=$CXXFLAGS save_LIBS=$LIBS CXXFLAGS="$CXXFLAGS $QT_CFLAGS $X_CFLAGS" LIBS="$LIBS $QT_LIBS $X_LIBS $PTHREAD_LIBS" AC_CACHE_CHECK([for multithreading support in Qt], ac_cv_val_with_qt_multi, AC_LINK_IFELSE(AC_LANG_PROGRAM([ #ifndef QT_THREAD_SUPPORT #define QT_THREAD_SUPPORT #endif #include ], [ qApp->wakeUpGuiThread() ]), ac_cv_val_with_qt_multi=yes, ac_cv_val_with_qt_multi=no) ) CXXFLAGS=$save_CXXFLAGS LIBS=$save_LIBS if test "$ac_cv_val_with_qt_multi" != yes; then AC_MSG_WARN([ *** Your Qt installation does not support multi-threading! *** Avifile will be compiled - however it might crash mysteriously *** Instalation of threaded Qt library version (qt-mt) is recommended *** When rebuilding Qt use configure option '-thread'.]) fi AC_MSG_CHECKING(Qt version for Avicap) AS_IF([test "$qt_version" -ge 220], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no (needs Qt 2.2.0 or better)]) build_avicap=no] ) AC_LANG_POP ]) dnl ====================== dnl Check for Jpeg library dnl ====================== AC_CHECK_HEADER(jpeglib.h, AC_CHECK_LIB(jpeg, jpeg_start_compress, [JPEG_LIBS=-ljpeg; have_jpeglib=yes], have_jpeglib="no "), have_jpeglib="no ") AC_SUBST(JPEG_LIBS) dnl ======================= dnl Check for iconv support dnl ======================= AC_ICONV([], AC_DEFINE(HAVE_ICONV, 1, [Define if you have 'iconv_open' function.])) dnl ===================== dnl Check for SDL library dnl ===================== AC_ARG_WITH(sdl, AC_HELP_STRING(--with-sdl, [build with SDL. [[autodetected]]]), [], with_sdl=yes) if test "$with_sdl" != yes; then with_sdl="no (video rendering unavailable as requested!)" AC_MSG_WARN([ *** there will be NO video rendering without SDL support!]) else SDL_MIN_VERSION=1.0.0 save_CFLAGS=$CFLAGS save_CPPFLAGS=$CPPFLAGS save_LIBS=$LIBS LIBS= AM_PATH_SDL($SDL_MIN_VERSION, AC_DEFINE(HAVE_LIBSDL, 1, [Define if using 'SDL' library (-lsdl).]), with_sdl="no (*** no SDL => no video rendering! ***)" AC_MSG_WARN([Could not find SDL >= $SDL_MIN_VERSION!]) ) CFLAGS=$save_CFLAGS CPPFLAGS=$save_CPPFLAGS LIBS=$save_LIBS fi dnl ========================= dnl Check v4l video interface dnl ========================= AC_CHECK_V4L([], build_avicap=no) dnl ========================= dnl Check OSS audio interface dnl ========================= AC_CHECK_OSS(AC_DEFINE(HAVE_OSS, 1, [Define if you want to have OSS audio support compiled.])) dnl ============================= dnl Check for Sun audio interface dnl ============================= AC_ARG_ENABLE(sunaudio, AC_HELP_STRING(--enable-sunaudio, [support the Sun audio API. [[autodetected]]]), [], enable_sunaudio=yes) if test "$enable_sunaudio" = yes; then AC_CACHE_CHECK([for Sun audio support], ac_cv_val_have_sun_audio, AC_COMPILE_IFELSE(AC_LANG_PROGRAM([ #include #include ], [ audio_info_t audio_info; AUDIO_INITINFO(&audio_info); ]), ac_cv_val_have_sun_audio=yes, ac_cv_val_have_sun_audio=no) ) enable_sunaudio=$ac_cv_val_have_sun_audio AC_IF_YES(enable_sunaudio, AC_DEFINE(HAVE_SUNAUDIO, 1, [Define if you want to have Sun audio support.])) fi dnl ===================== dnl Check for A52 support dnl ===================== A52_CFLAGS="" A52_LIBS="" AC_ARG_WITH(a52, AC_HELP_STRING(--with-a52, [build a52 AC3 support. [[autodetected]]]), [], with_a52=yes) AC_IF_YES(with_a52, [AM_PATH_A52([AC_DEFINE(HAVE_LIBA52, 1, [Define if you have 'liba52' library (-l52).])], with_a52="no ")]) AC_ARG_ENABLE(a52bin, AC_HELP_STRING(--enable-a52bin, [dlopen liba52 at runtime. [[enabled]]]), [], enable_a52bin=yes) AC_SUBST(A52_LIBS) dnl ================================ dnl Check for Ac3 passthrough plugin dnl ================================ dnl tested and works only with SBLive AC_ARG_WITH(ac3passthrough, AC_HELP_STRING(--without-ac3passthrough, [AC3 passthrough plugin (OSS & SBlive!). [[autodetect]]]), [], with_ac3passthrough=yes) test "$enable_oss" != yes && with_ac3passthrough=no dnl ============================== dnl Check if build Lame bin plugin dnl ============================== dnl NOTE: dnl this kind of construction is necesary if we want to prevent dnl automatic library inclusion by AUTOMAKE AC_ARG_WITH(lame, AC_HELP_STRING(--without-lame, [do not build included old lame3.70 plugin. [[enabled]]]), [], with_lame=yes) AC_ARG_ENABLE(lamebin, AC_HELP_STRING(--enable-lamebin, [dlopen libmp3lame at runtime. [[disabled]]]), [], enable_lamebin=no) AC_CHECK_LIB(mp3lame, lame_decode_init, [ enable_lamebin=yes AC_DEFINE(HAVE_LIBMP3LAME, 1, [Define if you have 'mp3lame' library (-lmp3lame).]) ], [], [ -lm ]) dnl ====================================== dnl Check for Win32 dll libraries & plugin dnl ====================================== AC_ARG_ENABLE(win32, AC_HELP_STRING(--enable-win32, [build Win DLLs plugin. [[arch specific]]])) AC_ARG_WITH(win32_path, AC_HELP_STRING(--with-win32-path=PATH, [where Windows DLL files are located. [[=/usr/lib/win32]]]), WIN32_PATH=$withval, WIN32_PATH="/usr/lib/win32") AC_SUBST(WIN32_PATH) test ! -d $WIN32_PATH && AC_MSG_WARN([Directory: $WIN32_PATH does not exist - install binaries!]) AC_ARG_ENABLE(loader-out, AC_HELP_STRING(--enable-loader-out, [enable verbose Win32 loader output. [[disabled]]]), AC_IF_YES(enableval, AC_DEFINE(DETAILED_OUT, 1, [Define if you want to see detailed out of Win32 loader.])) ) AC_ARG_ENABLE(timing, AC_HELP_STRING(--enable-timing, [show ALL process timings in library. [[disabled]]]), AC_IF_YES(enableval, AC_DEFINE(TIMING, 1, [Define if you want to have timing code in library.])) ) AC_ARG_ENABLE(quiet, AC_HELP_STRING(--enable-quiet, [quiet library. [[disabled]]]), AC_IF_YES(enableval, AC_DEFINE(QUIET, 1, [Define if you want to have quiet library.])) ) AC_ARG_ENABLE(x86opt, AC_HELP_STRING(--disable-x86opt, [x86 optimizations MMX,MMX2,SSE... [[arch specific]]]), [], enable_x86opt=yes) dnl ====================== dnl Check for zlib library dnl ====================== AC_ARG_WITH(zlib, AC_HELP_STRING(--with-zlib, [build with z library. [[autodetected]]]), [], with_zlib=yes) AC_IF_YES(with_zlib, [AC_FIND_ZLIB([AC_DEFINE(HAVE_LIBZ, 1, [Define if you have z library (-lz)])], [])]) dnl ============================== dnl Check for Ogg/Vorbis libraries dnl ============================== AC_ARG_WITH(vorbis, AC_HELP_STRING(--with-vorbis, [build vorbis plugin. [[autodetected]]]), [], with_vorbis=yes) AC_IF_YES(with_vorbis, [AM_PATH_OGG([], with_vorbis="no ")]) AC_IF_YES(with_vorbis, [AM_PATH_VORBIS([], with_vorbis="no ")]) dnl ============================== dnl Check for MAD library dnl ============================== AC_ARG_WITH(mad, AC_HELP_STRING(--without-mad, [do not build MAD MPEG3 audio decoder plugin. [[enabled]]]), [], with_mad=yes) AC_IF_YES(with_mad, [AM_PATH_MAD([], with_mad="no ")]) dnl ========================= dnl Check for DivX4 libraries dnl ========================= AC_ARG_WITH(divx4, AC_HELP_STRING(--with-divx4, [build DivX4 plugin http://avifile.sf.net. [[autodetect]]]), [], with_divx4=yes) AC_ARG_ENABLE(divxbin, AC_HELP_STRING(--enable-divxbin, [open DivX libs runtime. [[disabled]]]), [], enable_divxbin=no) AC_IF_YES(with_divx4, [AM_PATH_DIVX(AC_DEFINE(HAVE_LIBDIVXDECORE, 1, [Define if you have 'divxdecore' library (-ldivxdecore).]), [], AC_DEFINE(HAVE_LIBDIVXENCORE, 1, [Define if you have 'divxencore' library (-ldivxencore).]), [])]) dnl ====================== dnl Check for XviD library dnl ====================== AC_ARG_WITH(xvid, AC_HELP_STRING(--with-xvid, [build old XviD plugin. [[disabled]]]), [], with_xvid="no ") if test "$with_xvid" = yes; then AM_PATH_XVID(AC_DEFINE(HAVE_LIBXVIDCORE, 1, [Define if you have old 'xvidcore' library (-lxvidcore).]), with_xvid="no "; AC_MSG_RESULT( [--- Sources to build XviD xvidcore library can be found at http://www.xvid.org]) ) fi dnl ====================== dnl Check for XviD4 library dnl ====================== AC_ARG_WITH(xvid4, AC_HELP_STRING(--with-xvid4, [build XviD4 plugin http://www.xvid.org. [[autodetected]]]), [], with_xvid4=yes) if test "$with_xvid4" = yes; then AM_PATH_XVID4(AC_DEFINE(HAVE_LIBXVIDCORE4, 1, [Define if you have 'xvidcore' ver 1.0 library (-lxvidcore).]), with_xvid4="no "; AC_MSG_RESULT( [--- Sources to build XviD xvidcore library can be found at http://www.xvid.org]) ) fi dnl ======================= dnl Configure ffmpeg plugin dnl ======================= AM_PATH_FFMPEG dnl ================================= dnl Configure external ffmpeg library dnl ================================= dnl AM_PATH_FFMPEGLIB dnl HAVE_GL=1 dnl AC_CHECK_HEADER(GL/gl.h,, HAVE_GL=) dnl if test "HAVE_GL"; then dnl AC_CHECK_LIB(GL, glClear, , HAVE_GL=, $X_LDFLAGS -lX11 -lXext $X_EXTRA_LIBS -lm) dnl fi; dnl if test "HAVE_GL"; then dnl GL_LDFLAGS="-lGL -lGLU" dnl AC_SUBST(GL_LDFLAGS) dnl AC_DEFINE(HAVE_OPENGL, 1, [Define if you have 'GL' & 'GLU' libraries (-lGL -lGLU).]) dnl fi; dnl =================== dnl Configure libmmxnow dnl =================== dnl Note: this library is curently unused dnl AC_CONFIG_SUBDIRS(libmmxnow) dnl AC_MSG_CHECKING([configure in libmmxnow]) dnl ( cd $srcdir/libmmxnow/ dnl test -f configure || ../autogen.sh $with_acdir ) dnl AC_MSG_RESULT([done]) AC_ARG_ENABLE(samples, AC_HELP_STRING(--disable-samples, [do not build samples (avicap, ...). [[enabled]]]), [], enable_samples=yes) dnl kde is currently unsupported dnl AC_ARG_ENABLE(kde, [ --disable-kde do not build kde sample programs. [[enabled]]], dnl [], enable_kde=yes) dnl ============================= dnl Check if linux kernel devices dnl should be build dnl ============================= dnl this require usable kernel headers AM_PATH_LINUX(/usr/src/linux, enable_linux=yes, enable_linux=no) AC_ARG_ENABLE(mga_vid, AC_HELP_STRING(--enable-mga, [build mga_vid driver. [[autodetected]]]), [], enable_mga_vid=yes) if test "$enable_mga_vid" = yes; then if test -c /dev/mga_vid -o -c /dev/misc/mga_vid; then if test ! -f /usr/src/linux/include/linux/modversions.h; then enable_mga_vid=no AC_MSG_RESULT([mga_vid can not find modversion.h]) else AC_MSG_RESULT([building mga_vid device]) fi else enable_mga_vid=no fi fi dnl =============== dnl Configure vidix dnl =============== AM_PATH_VIDIX dnl we do not need this code now - FFMPEG no longer uses nasm dnl but I am leaving it here just for the case we would need it dnl in the future dnl AC_MSG_CHECKING(whether to use --tag=CXX with libtool) dnl TAGCXX="--tag=CXX" dnl ${srcdir}/libtool "$TAGCXX" -n --mode=compile gcc test.c > /dev/null 2>&1 || TAGCXX= dnl if test -z "$TAGCXX"; then dnl AC_MSG_RESULT([no]) dnl else dnl AC_MSG_RESULT([yes]) dnl fi dnl AC_SUBST(TAGCXX) dnl Some platforms needs this to build some necessary parts of code CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/include" AC_ARG_ENABLE(fpic, AC_HELP_STRING(--disable-fpic, [no -fPIC for shlibs. (use --without-pic where available)]), [], enable_fpic=yes) LTNOPIC="" if test "$enable_fpic" = no; then grep "prefer-non-pic" libtool && LTNOPIC="-prefer-non-pic" fi AC_SUBST(LTNOPIC) CFLAGS=$COPTFLAGS CXXFLAGS=$CXXOPTFLAGS if test "$enable_release" != yes -o x$enable_profiling = xyes; then CFLAGS=`echo $CFLAGS | sed -e s/-O[[0-9]]//g -e s/-fomit-frame-pointer//g` CXXFLAGS=`echo $CXXFLAGS | sed -e s/-O[[0-9]]//g -e s/-fomit-frame-pointer//g` FFMPEG_CFLAGS=`echo $FFMPEG_CFLAGS | sed -e s/-O[[0-9]]//g -e s/-fomit-frame-pointer//g` if test "$enable_profiling" = yes; then AC_MSG_RESULT([profiling enabled - DO NOT USE FOR NORMAL OPERATIONS]) dnl GCov does not like our C++ - figure out why dnl PROFFLAG="-fprofile-arcs -ftest-coverage" dnl this is for my yet released kprof profiler PROFFLAG="-finstrument-functions " fi else CFLAGS=`echo $CFLAGS | sed s/-g//` CXXFLAGS=`echo $CXXFLAGS | sed s/-g//` FFMPEG_CFLAGS=`echo $FFMPEG_CFLAGS | sed s/-g//` fi WIN32_CFLAGS=`echo $CFLAGS | sed s/-fomit-frame-pointer//g` AC_SUBST(WIN32_CFLAGS) lt_major_version=`libtool --version 2>&1 | head -1 | sed 's/\(.*\ \)\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\)\(.*\)/\2/'` lt_minor_version=`echo $lt_major_version | cut -d . -f 2` lt_micro_version=`echo $lt_major_version | cut -d . -f 3` lt_major_version=`echo $lt_major_version | cut -d . -f 1` dnl echo LT $lt_major_version $lt_minor_version $lt_micro_version AM_CONDITIONAL(AMM_USE_QT, test "$with_qt" = yes ) AM_CONDITIONAL(AMM_USE_SDL, test "$with_sdl" = yes) AM_CONDITIONAL(AMM_USE_SUN, test "$enable_sunaudio" = yes ) AM_CONDITIONAL(AMM_USE_OSS, test "$enable_oss" = yes) AM_CONDITIONAL(AMM_USE_A52, test "$with_a52" = yes) AM_CONDITIONAL(AMM_USE_A52BIN, test "$enable_a52bin" = yes) AM_CONDITIONAL(AMM_USE_AC3PASS, test "$with_ac3passthrough" = yes) AM_CONDITIONAL(AMM_USE_DIVX, test "$have_divx_decore" = yes -o "$have_divx_encore" = yes ) AM_CONDITIONAL(AMM_USE_DIVXBIN, test "$enable_divxbin" = yes) AM_CONDITIONAL(AMM_USE_LIBMAD, test "$with_mad_prefix" != "internal" ) AM_CONDITIONAL(AMM_USE_MAD, test "$with_mad" = yes ) AM_CONDITIONAL(AMM_USE_MP3LAMEBIN, test "$enable_lamebin" = yes) AM_CONDITIONAL(AMM_USE_MP3LAME, test "$with_lame" = yes) AM_CONDITIONAL(AMM_USE_VORBIS, test "$with_vorbis" = yes ) AM_CONDITIONAL(AMM_USE_WIN32, test "$enable_win32" = yes) AM_CONDITIONAL(AMM_USE_XVID, test "$enable_xvid" = yes) AM_CONDITIONAL(AMM_USE_XVID4, test "$enable_xvid4" = yes) AM_CONDITIONAL(AMM_USE_JPEGLIB, test "$have_jpeglib" = yes ) AM_CONDITIONAL(AMM_USE_AVICAP, test "$build_avicap" = yes ) AM_CONDITIONAL(AMM_USE_V4L, test "$enable_v4l" = yes ) AM_CONDITIONAL(AMM_USE_AVIRECOMP, test "$build_avirecomp" = yes ) AM_CONDITIONAL(AMM_USE_SAMPLES, test "$enable_samples" = yes ) AM_CONDITIONAL(AMM_USE_FT2, test "$with_freetype2" = yes ) AM_CONDITIONAL(AMM_USE_MGA_VID, test "$have_mga_vid" = yes ) AM_CONDITIONAL(AMM_USE_VIDIX, test "$enable_vidix" = yes ) AM_CONDITIONAL(AMM_USE_LINUX, test "$enable_linux" = yes ) AM_CONDITIONAL(AMM_USE_FAST_BUILD, test "$enable_fast_build" = yes ) AM_CONDITIONAL(AMM_LINK_SHARED, test $lt_major_version -ge 1 -a $lt_minor_version -ge 4 -a $lt_micro_version -ge 3 ) AM_CONDITIONAL(AMM_FF_INTERNAL, test 0 -eq 0 ) AM_CONDITIONAL(AMM_FF_FAAD, test "$have_faad" = yes ) AM_CONDITIONAL(AMM_FF_OPENJPEG, test "$have_openjpeg" = yes ) AM_CONDITIONAL(AMM_FF_FAADBIN, test "$enable_ffmpeg_faadbin" = yes) AM_CONDITIONAL(AMM_FF_DC1394, test "$have_dc1394" = yes ) AM_CONDITIONAL(AMM_FF_ZLIB, test "$have_zlib" = yes ) AM_CONDITIONAL(AMM_FF_ALPHAOPT, test "$enable_alphaopt" = yes) AM_CONDITIONAL(AMM_FF_ARMOPT, test "$enable_armopt" = yes) AM_CONDITIONAL(AMM_FF_MIPSOPT, test "$enable_mipsopt" = yes) AM_CONDITIONAL(AMM_FF_MLIBOPT, test "$enable_mlibopt" = yes) AM_CONDITIONAL(AMM_FF_PPCOPT, test "$enable_ppcopt" = yes) AM_CONDITIONAL(AMM_FF_PS2OPT, test "$enable_ps2opt" = yes) AM_CONDITIONAL(AMM_FF_SH4OPT, test "$enable_sh4opt" = yes) AM_CONDITIONAL(AMM_FF_SPARCOPT, test "$enable_sparcopt" = yes) AM_CONDITIONAL(AMM_FF_X86OPT, test "$enable_x86opt" = yes -a 0 -eq 0) last_cvs_update=`find . -name Entries -printf '%Ty%Tm%Td-%TH:%TM\n' | sort | tail -1` if test $? -ne 0 -o -z "$last_cvs_update"; then # probably no gnu date installed(?), use current date # or this is release last_cvs_update=`date +%y%m%d-%H:%M` AVIFILE_BUILD="RELEASE" else AVIFILE_BUILD="CVS" fi AVIFILE_BUILD="$AVIFILE_BUILD-$AVIFILE_MAJOR_VERSION.$AVIFILE_MINOR_VERSION.$AVIFILE_MICRO_VERSION-${last_cvs_update}-$GCC_VERSION" AC_SUBST(AVIFILE_BUILD) AC_SUBST(DIVX_LIBS) AC_SUBST(DTS_LIBS) AC_SUBST(MAD_LIBS) AC_SUBST(QT_LIBS) AC_SUBST(SDL_LIBS) AC_SUBST(XVID4_LIBS) AC_SUBST(XVID_LIBS) AC_SUBST(Z_LIBS) AC_OUTPUT([ Makefile ffmpeg/Makefile ffmpeg/libavcodec/Makefile ffmpeg/libavcodec/alpha/Makefile ffmpeg/libavcodec/arm/Makefile ffmpeg/libavcodec/mlib/Makefile ffmpeg/libavcodec/ppc/Makefile ffmpeg/libavcodec/ps2/Makefile ffmpeg/libavcodec/sh4/Makefile ffmpeg/libavcodec/sparc/Makefile ffmpeg/libavcodec/x86/Makefile ffmpeg/libavdevice/Makefile ffmpeg/libavfilter/Makefile ffmpeg/libavformat/Makefile ffmpeg/libavutil/Makefile ffmpeg/libpostproc/Makefile ffmpeg/libswscale/Makefile drivers/Makefile drivers/libdha/Makefile drivers/libdha/kernelhelper/Makefile drivers/vidix/Makefile lib/Makefile plugins/Makefile plugins/libac3pass/Makefile plugins/libaudiodec/Makefile plugins/libdivx4/Makefile plugins/libffmpeg/Makefile plugins/libmad/Makefile plugins/libmad/libmad/Makefile plugins/libmp3lamebin_audioenc/Makefile plugins/libmp3lame_audioenc/Makefile plugins/libmp3lame_audioenc/lame3.70/Makefile plugins/libmpeg_audiodec/Makefile plugins/libvorbis/Makefile plugins/libwin32/Makefile plugins/libwin32/audiodec/Makefile plugins/libwin32/loader/Makefile plugins/libwin32/loader/dmo/Makefile plugins/libwin32/loader/dshow/Makefile plugins/libwin32/loader/wine/Makefile plugins/libwin32/videocodec/Makefile plugins/libxvid/Makefile plugins/libxvid4/Makefile player/Makefile include/version.h libavqt/Makefile samples/Makefile samples/misc/Makefile samples/mjpeg_plugin/Makefile samples/qtrecompress/Makefile samples/qtvidcap/Makefile avifile-config avifile.spec avifile.pc ]) USED="" dnl brutal hack for an old libtool which does not support -prefer-non-pic dnl might fail on some systems which really needs -fPIC code if test "$enable_fpic" = "no" -a -z "$LTNOPIC"; then for i in `find . -name libtool` do sed -e 's/^pic_flag=/#pic_flag=/g' $i >$i.tmp mv ${i}.tmp $i done fi touch admin/depcomp >/dev/null 2>&1 dnl touch libmmxnow/depcomp >/dev/null 2>&1 AC_MSG_RESULT([ Note: If you have installed/removed some package in your system do NOT forget to remove config.cache file before using configure! Configuration for avifile ${AVIFILE_BUILD} Compiler C: ${CC} ${CFLAGS} Compiler C++: ${CXX} ${CXXFLAGS} Install path: ${prefix} Qt=$with_qt, Sdl=$with_sdl, Xft=$with_xft, Oss audio=$enable_oss, Sun audio=$enable_sunaudio, Mga_vid=$enable_mga_vid Plugins: ac3passthrough $with_ac3passthrough (with OSS/SBLive only) divx (dec/enc) ${have_divx_decore}/${have_divx_encore} (DivxNetworks divx4linux) old xvid $with_xvid (DivX4, XviD) xvid4 $with_xvid4 (DivX4, XviD) ffmpeg yes (DivX ;-), OpenDivX, MJPEG,...) ffmpeg faad $have_faad (AAC) (runtime $enable_ffmpeg_faadbin) ffmpeg a52 $have_a52 (AC3) (runtime $enable_ffmpeg_a52bin) os motion jpeg $have_jpeglib (MJPEG) win32 $enable_win32 (DivX, WM7/8/9, DV, MJPEG, Ati, Asus,...) mad $with_mad (MPEG Layer I/II/III) ($with_mad_prefix) vorbis $with_vorbis lame runtime $enable_lamebin lame internal $with_lame ]) avifile-0.7.48~20090503.ds/ltmain.sh0000644000175000017500000032137607366406717015615 0ustar yavoryavor# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun ltconfig. # # Copyright (C) 1996-1999 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 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 # General Public License for more details. # # You should have received a copy of the GNU 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. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then echo "$modename: not configured to build any kind of library" 1>&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" # Parse our command line options once, thoroughly. while test $# -gt 0 do arg="$1" shift case "$arg" in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case "$prev" in execute_dlfiles) eval "$prev=\"\$$prev \$arg\"" ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case "$arg" in --help) show_help=yes ;; --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" exit 0 ;; --config) sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 exit 0 ;; --debug) echo "$progname: enabling shell trace mode" set -x ;; --dry-run | -n) run=: ;; --features) echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit 0 ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --quiet | --silent) show=: ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit 1 ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then case "$nonopt" in *cc | *++ | gcc* | *-gcc*) mode=link for arg do case "$arg" in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit 1 fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case "$mode" in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= lastarg= srcfile="$nonopt" suppress_output= user_target=no for arg do # Accept any command-line options. case "$arg" in -o) if test "$user_target" != "no"; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit 1 fi user_target=next ;; -static) build_old_libs=yes continue ;; esac case "$user_target" in next) # The next one is the -o target name user_target=yes continue ;; yes) # We got the output file user_target=set libobj="$arg" continue ;; esac # Accept the current argument as the source file. lastarg="$srcfile" srcfile="$arg" # Aesthetically quote the previous argument. # Backslashify any backslashes, double quotes, and dollar signs. # These are the only characters that are still specially # interpreted inside of double-quoted scrings. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly in scan # sets, so we specify it separately. case "$lastarg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) lastarg="\"$lastarg\"" ;; esac # Add the previous argument to base_compile. if test -z "$base_compile"; then base_compile="$lastarg" else base_compile="$base_compile $lastarg" fi done case "$user_target" in set) ;; no) # Get the name of the library object. libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; *) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit 1 ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSfmso]' case "$libobj" in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case "$libobj" in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit 1 ;; esac if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit 1 fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $libobj" else removelist="$libobj" fi $run $rm $removelist trap "$run $rm $removelist; exit 1" 1 2 15 # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit 1" 1 2 15 else need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until ln "$0" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile # All platforms use -DPIC, to notify preprocessed assembler code. command="$base_compile $pic_flag -DPIC $srcfile" if test "$build_old_libs" = yes; then lo_libobj="$libobj" dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$libobj"; then dir="$objdir" else dir="$dir/$objdir" fi libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` if test -d "$dir"; then $show "$rm $libobj" $run $rm $libobj else $show "$mkdir $dir" $run $mkdir $dir status=$? if test $status -ne 0 && test ! -d $dir; then exit $status fi fi fi if test "$compiler_o_lo" = yes; then output_obj="$libobj" command="$command -o $output_obj" elif test "$compiler_c_o" = yes; then output_obj="$obj" command="$command -o $output_obj" fi $show "$command" if $run eval "$command"; then : else test -n "$output_obj" && $run $rm $removelist exit 1 fi if test "$need_locks" = warn && test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi # Just move the object if needed, then go on to compile the next one if test x"$output_obj" != x"$libobj"; then $show "$mv $output_obj $libobj" if $run $mv $output_obj $libobj; then : else error=$? $run $rm $removelist exit $error fi fi # If we have no pic_flag, then copy the object into place and finish. if test -z "$pic_flag" && test "$build_old_libs" = yes; then # Rename the .lo from within objdir to obj if test -f $obj; then $show $rm $obj $run $rm $obj fi $show "$mv $libobj $obj" if $run $mv $libobj $obj; then : else error=$? $run $rm $removelist exit $error fi # Now arrange that obj and lo_libobj become the same file $show "$LN_S $obj $lo_libobj" if $run $LN_S $obj $lo_libobj; then exit 0 else error=$? $run $rm $removelist exit $error fi fi # Allow error messages only from the first compilation. suppress_output=' >/dev/null 2>&1' fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then command="$base_compile $srcfile" if test "$compiler_c_o" = yes; then command="$command -o $obj" output_obj="$obj" fi # Suppress compiler output if we already did a PIC compilation. command="$command$suppress_output" $show "$command" if $run eval "$command"; then : else $run $rm $removelist exit 1 fi if test "$need_locks" = warn && test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi # Just move the object if needed if test x"$output_obj" != x"$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Create an invalid libtool object if no PIC, so that we do not # accidentally link it into a program. if test "$build_libtool_libs" != yes; then $show "echo timestamp > $libobj" $run eval "echo timestamp > \$libobj" || exit $? else # Move the .lo from within objdir $show "$mv $libobj $lo_libobj" if $run $mv $libobj $lo_libobj; then : else error=$? $run $rm $removelist exit $error fi fi fi # Unlock the critical section if it was locked if test "$need_locks" != no; then $rm "$lockfile" fi exit 0 ;; # libtool link mode link) modename="$modename: link" C_compiler="$CC" # save it, to compile generated C sources CC="$nonopt" case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invokation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes # This is a source program that is used to create dlls on Windows # Don't remove nor modify the starting and closing comments # /* ltdll.c starts here */ # #define WIN32_LEAN_AND_MEAN # #include # #undef WIN32_LEAN_AND_MEAN # #include # # #ifdef __cplusplus # extern "C" { # #endif # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); # #ifdef __cplusplus # } # #endif # # #include # DECLARE_CYGWIN_DLL( DllMain ); # HINSTANCE __hDllInstance_base; # # BOOL APIENTRY # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) # { # __hDllInstance_base = hInst; # return TRUE; # } # /* ltdll.c ends here */ # This is a source program that is used to create import libraries # on Windows for dlls which lack them. Don't remove nor modify the # starting and closing comments # /* impgen.c starts here */ # /* Copyright (C) 1999 Free Software Foundation, Inc. # # This file is part of GNU libtool. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 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 General Public License for more details. # # You should have received a copy of the GNU 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. # */ # # #include /* for printf() */ # #include /* for open(), lseek(), read() */ # #include /* for O_RDONLY, O_BINARY */ # #include /* for strdup() */ # # static unsigned int # pe_get16 (fd, offset) # int fd; # int offset; # { # unsigned char b[2]; # lseek (fd, offset, SEEK_SET); # read (fd, b, 2); # return b[0] + (b[1]<<8); # } # # static unsigned int # pe_get32 (fd, offset) # int fd; # int offset; # { # unsigned char b[4]; # lseek (fd, offset, SEEK_SET); # read (fd, b, 4); # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); # } # # static unsigned int # pe_as32 (ptr) # void *ptr; # { # unsigned char *b = ptr; # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); # } # # int # main (argc, argv) # int argc; # char *argv[]; # { # int dll; # unsigned long pe_header_offset, opthdr_ofs, num_entries, i; # unsigned long export_rva, export_size, nsections, secptr, expptr; # unsigned long name_rvas, nexp; # unsigned char *expdata, *erva; # char *filename, *dll_name; # # filename = argv[1]; # # dll = open(filename, O_RDONLY|O_BINARY); # if (!dll) # return 1; # # dll_name = filename; # # for (i=0; filename[i]; i++) # if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') # dll_name = filename + i +1; # # pe_header_offset = pe_get32 (dll, 0x3c); # opthdr_ofs = pe_header_offset + 4 + 20; # num_entries = pe_get32 (dll, opthdr_ofs + 92); # # if (num_entries < 1) /* no exports */ # return 1; # # export_rva = pe_get32 (dll, opthdr_ofs + 96); # export_size = pe_get32 (dll, opthdr_ofs + 100); # nsections = pe_get16 (dll, pe_header_offset + 4 +2); # secptr = (pe_header_offset + 4 + 20 + # pe_get16 (dll, pe_header_offset + 4 + 16)); # # expptr = 0; # for (i = 0; i < nsections; i++) # { # char sname[8]; # unsigned long secptr1 = secptr + 40 * i; # unsigned long vaddr = pe_get32 (dll, secptr1 + 12); # unsigned long vsize = pe_get32 (dll, secptr1 + 16); # unsigned long fptr = pe_get32 (dll, secptr1 + 20); # lseek(dll, secptr1, SEEK_SET); # read(dll, sname, 8); # if (vaddr <= export_rva && vaddr+vsize > export_rva) # { # expptr = fptr + (export_rva - vaddr); # if (export_rva + export_size > vaddr + vsize) # export_size = vsize - (export_rva - vaddr); # break; # } # } # # expdata = (unsigned char*)malloc(export_size); # lseek (dll, expptr, SEEK_SET); # read (dll, expdata, export_size); # erva = expdata - export_rva; # # nexp = pe_as32 (expdata+24); # name_rvas = pe_as32 (expdata+32); # # printf ("EXPORTS\n"); # for (i = 0; i&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test $# -gt 0; do arg="$1" shift # If the previous option needs an argument, assign it. if test -n "$prev"; then case "$prev" in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case "$prev" in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case "$arg" in *.la | *.lo) ;; # We handle these cases below. self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit 1 fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case "$arg" in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit 1 ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi prevarg="$arg" case "$arg" in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: not more than one -exported-symbols argument allowed" exit 1 fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case "$dir" in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 exit 1 fi dir="$absdir" ;; esac case " $deplibs " in *" $arg "*) ;; *) deplibs="$deplibs $arg";; esac case " $lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir";; esac case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2*) dllsearchdir=`cd "$dir" && pwd || echo "$dir"` case ":$dllsearchpath:" in ::) dllsearchpath="$dllsearchdir";; *":$dllsearchdir:"*) ;; *) dllsearchpath="$dllsearchpath:$dllsearchdir";; esac ;; esac ;; -l*) if test "$arg" = "-lc"; then case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) # These systems don't actually have c library (as such) continue ;; esac elif test "$arg" = "-lm"; then case "$host" in *-*-cygwin* | *-*-beos*) # These systems don't actually have math library (as such) continue ;; esac fi deplibs="$deplibs $arg" ;; -module) module=yes continue ;; -no-undefined) allow_undefined=no continue ;; -o) prev=output ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case "$dir" in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit 1 ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # If we have no pic_flag, then this is the same as -all-static. if test -z "$pic_flag" && test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac ;; *.o | *.obj | *.a | *.lib) # A standard object. objs="$objs $arg" ;; *.lo) # A library object. if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` prev= fi libobjs="$libobjs $arg" ;; *.la) # A libtool-controlled library. dlname= libdir= library_names= old_library= # Check to see that this really is a libtool archive. if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 exit 1 fi # If the library was installed with an old release of libtool, # it will not redefine variable installed. installed=yes # Read the .la file # If there is no directory component, then add one. case "$arg" in */* | *\\*) . $arg ;; *) . ./$arg ;; esac # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 exit 1 fi # Find the relevant object directory and library name. name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` if test "X$installed" = Xyes; then dir="$libdir" else dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$arg"; then dir="$objdir" else dir="$dir/$objdir" fi fi if test -n "$dependency_libs"; then # Extract -R from dependency_libs temp_deplibs= for deplib in $dependency_libs; do case "$deplib" in -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'` case " $rpath $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; -L*) case "$compile_command $temp_deplibs " in *" $deplib "*) ;; *) temp_deplibs="$temp_deplibs $deplib";; esac;; *) temp_deplibs="$temp_deplibs $deplib";; esac done dependency_libs="$temp_deplibs" fi if test -z "$libdir"; then # It is a libtool convenience library, so add in its objects. convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$deplibs$dependency_libs" compile_command="$compile_command $dir/$old_library$dependency_libs" finalize_command="$finalize_command $dir/$old_library$dependency_libs" continue fi # This library was specified with -dlopen. if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking statically, # we need to preload. prev=dlprefiles else # We should not create a dependency on this library, but we # may need any libraries it requires. compile_command="$compile_command$dependency_libs" finalize_command="$finalize_command$dependency_libs" prev= continue fi fi # The library was specified with -dlpreopen. if test "$prev" = dlprefiles; then # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then dlprefiles="$dlprefiles $dir/$old_library" else dlprefiles="$dlprefiles $dir/$linklib" fi prev= fi if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then link_against_libtool_libs="$link_against_libtool_libs $arg" if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # We need an absolute path. case "$dir" in [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 exit 1 fi ;; esac # This is the magic to use -rpath. # Skip directories that are in the system default run-time # search path, unless they have been requested with -R. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac lib_linked=yes case "$hardcode_action" in immediate | unsupported) if test "$hardcode_direct" = no; then compile_command="$compile_command $dir/$linklib" deplibs="$deplibs $dir/$linklib" case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2*) dllsearchdir=`cd "$dir" && pwd || echo "$dir"` if test -n "$dllsearchpath"; then dllsearchpath="$dllsearchpath:$dllsearchdir" else dllsearchpath="$dllsearchdir" fi ;; esac elif test "$hardcode_minus_L" = no; then case "$host" in *-*-sunos*) compile_shlibpath="$compile_shlibpath$dir:" ;; esac case "$compile_command " in *" -L$dir "*) ;; *) compile_command="$compile_command -L$dir";; esac compile_command="$compile_command -l$name" deplibs="$deplibs -L$dir -l$name" elif test "$hardcode_shlibpath_var" = no; then case ":$compile_shlibpath:" in *":$dir:"*) ;; *) compile_shlibpath="$compile_shlibpath$dir:";; esac compile_command="$compile_command -l$name" deplibs="$deplibs -l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then compile_command="$compile_command $absdir/$linklib" deplibs="$deplibs $absdir/$linklib" elif test "$hardcode_minus_L" = yes; then case "$compile_command " in *" -L$absdir "*) ;; *) compile_command="$compile_command -L$absdir";; esac compile_command="$compile_command -l$name" deplibs="$deplibs -L$absdir -l$name" elif test "$hardcode_shlibpath_var" = yes; then case ":$compile_shlibpath:" in *":$absdir:"*) ;; *) compile_shlibpath="$compile_shlibpath$absdir:";; esac compile_command="$compile_command -l$name" deplibs="$deplibs -l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit 1 fi # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then finalize_command="$finalize_command $libdir/$linklib" elif test "$hardcode_minus_L" = yes; then case "$finalize_command " in *" -L$libdir "*) ;; *) finalize_command="$finalize_command -L$libdir";; esac finalize_command="$finalize_command -l$name" elif test "$hardcode_shlibpath_var" = yes; then case ":$finalize_shlibpath:" in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:";; esac finalize_command="$finalize_command -l$name" else # We cannot seem to hardcode it, guess we'll fake it. case "$finalize_command " in *" -L$dir "*) ;; *) finalize_command="$finalize_command -L$libdir";; esac finalize_command="$finalize_command -l$name" fi else # Transform directly to old archives if we don't build new libraries. if test -n "$pic_flag" && test -z "$old_library"; then $echo "$modename: cannot find static library for \`$arg'" 1>&2 exit 1 fi # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_command="$compile_command $dir/$linklib" finalize_command="$finalize_command $dir/$linklib" else case "$compile_command " in *" -L$dir "*) ;; *) compile_command="$compile_command -L$dir";; esac compile_command="$compile_command -l$name" case "$finalize_command " in *" -L$dir "*) ;; *) finalize_command="$finalize_command -L$dir";; esac finalize_command="$finalize_command -l$name" fi fi # Add in any libraries that this one depends upon. compile_command="$compile_command$dependency_libs" finalize_command="$finalize_command$dependency_libs" continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac ;; esac # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" case "$output" in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit 1 ;; *.a | *.lib) if test -n "$link_against_libtool_libs"; then $echo "$modename: error: cannot link libtool libraries into archives" 1>&2 exit 1 fi if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" ;; *.la) # Make sure we only generate libraries of the form `libNAME.la'. case "$outputname" in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit 1 fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi if test -n "$objs"; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 exit 1 fi # How the heck are we supposed to write a wrapper for a shared library? if test -n "$link_against_libtool_libs"; then $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 exit 1 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test $# -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. libext=al oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi dependency_libs="$deplibs" if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit 1 fi current="$2" revision="$3" age="$4" # Check that each of the things are valid numbers. case "$current" in 0 | [1-9] | [1-9][0-9]*) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac case "$revision" in 0 | [1-9] | [1-9][0-9]*) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac case "$age" in 0 | [1-9] | [1-9][0-9]*) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac if test $age -gt $current; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 fi # Calculate the version variables. major= versuffix= verstring= case "$version_type" in none) ;; irix) major=`expr $current - $age + 1` versuffix="$major.$revision" verstring="sgi$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test $loop != 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="sgi$major.$iface:$verstring" done ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test $loop != 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; windows) # Like Linux, but with '-' rather than '.', since we only # want one extension on Windows 95. major=`expr $current - $age` versuffix="-$major-$age-$revision" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= verstring="0.0" if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi dependency_libs="$deplibs" case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *) # Add libc to deplibs on all other systems. deplibs="$deplibs -lc" ;; esac fi # Create the output directory, or remove our outputs if we need to. if test -d $output_objdir; then $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* else $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test $status -ne 0 && test ! -d $output_objdir; then exit $status fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi if test "$build_libtool_libs" = yes; then # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case "$deplibs_check_method" in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behaviour. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potlib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | sed 's/.* -> //'` case "$potliblink" in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | sed 10q \ | egrep "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done if test -n "$a_deplib" ; then droppeddeps=yes echo echo "*** Warning: This library needs some functionality provided by $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | grep . >/dev/null; then echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" echo "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." fi fi # Done checking deplibs! deplibs=$newdeplibs fi # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then # Get the real and link names of the library. eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Ensure that we have .o objects for linkers which dislike .lo # (e.g. aix) incase we are running --disable-static for obj in $libobjs; do oldobj=`$echo "X$obj" | $Xsed -e "$lo2o"` if test ! -f $oldobj; then $show "${LN_S} $obj $oldobj" $run ${LN_S} $obj $oldobj || exit $? fi done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` if test -n "$whole_archive_flag_spec"; then if test -n "$convenience"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi else gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "mkdir $gentop" $run mkdir "$gentop" status=$? if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" for xlib in $convenience; do # Extract the objects. case "$xlib" in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "mkdir $xdir" $run mkdir "$xdir" status=$? if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` done fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linkopts="$linkopts $flag" fi # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols eval cmds=\"$export_symbols_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi # Do each of the archive commands. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval cmds=\"$archive_expsym_cmds\" else eval cmds=\"$archive_cmds\" fi IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; *.lo | *.o | *.obj) if test -n "$link_against_libtool_libs"; then $echo "$modename: error: cannot link libtool libraries into objects" 1>&2 exit 1 fi if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case "$output" in *.lo) if test -n "$objs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit 1 fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Create the old-style object. reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` output="$obj" eval cmds=\"$reload_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. test -z "$libobj" && exit 0 if test "$build_libtool_libs" != yes; then # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. $show "echo timestamp > $libobj" $run eval "echo timestamp > $libobj" || exit $? exit 0 fi if test -n "$pic_flag"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs" output="$libobj" eval cmds=\"$reload_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" else # Just create a symlink. $show $rm $libobj $run $rm $libobj $show "$LN_S $obj $libobj" $run $LN_S $obj $libobj || exit $? fi exit 0 ;; # Anything else should be a program. *) if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$compile_rpath " in *" $libdir "*) ;; *) compile_rpath="$compile_rpath $libdir" ;; esac case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the binary in the object directory, then wrap it. if test ! -d $output_objdir; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test $status -ne 0 && test ! -d $output_objdir; then exit $status fi fi if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" = yes; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case "$dlsyms" in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`echo "$arg" | sed -e 's%^.*/%%'` $run eval 'echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[] = {\ " sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr_t) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case "$host" in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit 1 ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case "$dir" in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $0 --fallback-echo"; then case "$0" in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; *) qecho="$SHELL `pwd`/$0 --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`echo $output|sed 's,.exe$,,'` ;; esac $rm $output trap "$rm $output; exit 1" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: link_against_libtool_libs='$link_against_libtool_libs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then echo >> $output "\ program=lt-'$outputname' progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if (cd \"\$thisdir\" && eval \$relink_command); then : else $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in *-*-cygwin* | *-*-mingw | *-*-os2*) # win32 systems need to use the prog path for dll # lookup to work $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ # Export the path to the program. PATH=\"\$progdir:\$PATH\" export PATH exec \$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit 0 ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "mkdir $gentop" $run mkdir "$gentop" status=$? if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" # Add in members from convenience archives. for xlib in $addlibs; do # Extract the objects. case "$xlib" in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "mkdir $xdir" $run mkdir "$xdir" status=$? if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` done fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then eval cmds=\"$old_archive_from_new_cmds\" else # Ensure that we have .o objects in place incase we decided # not to build a shared library, and have fallen back to building # static libs even though --disable-static was passed! for oldobj in $oldobjs; do if test ! -f $oldobj; then obj=`$echo "X$oldobj" | $Xsed -e "$o2lo"` $show "${LN_S} $obj $oldobj" $run ${LN_S} $obj $oldobj || exit $? fi done eval cmds=\"$old_archive_cmds\" fi IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case "$output" in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" if test -n "$xrpath"; then temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" done dependency_libs="$temp_xrpath $dependency_libs" fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i fi $rm $output $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$dlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Directory that this library needs to be installed in: libdir='$install_libdir'\ " done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $? ;; esac exit 0 ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case "$arg" in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit 1 fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test $# -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit 1 fi fi case "$destdir" in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case "$file" in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case "$file" in *.a | *.lib) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit 1 fi library_names= old_library= # If there is no directory component, then add one. case "$file" in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" test "X$dir" = "X$file/" && dir= dir="$dir$objdir" # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift # Install the shared library and build the symlinks. $show "$install_prog $dir/$realname $destdir/$realname" $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? test "X$dlname" = "X$realname" && dlname= if test $# -gt 0; then # Delete the old symlinks, and create new ones. for linkname do test "X$dlname" = "X$linkname" && dlname= if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi if test -n "$dlname"; then # Install the dynamically-loadable library. $show "$install_prog $dir/$dlname $destdir/$dlname" $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $? fi # Do each command in the postinstall commands. lib="$destdir/$realname" eval cmds=\"$postinstall_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case "$destfile" in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.o | *.obj) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit 0 ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Do a test to see if this is really a libtool program. if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then link_against_libtool_libs= relink_command= # If there is no directory component, then add one. case "$file" in */* | *\\*) . $file ;; *) . ./$file ;; esac # Check the variables that should have been set. if test -z "$link_against_libtool_libs"; then $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 exit 1 fi finalize=yes for lib in $link_against_libtool_libs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case "$lib" in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : else $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue fi outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? # Do each command in the postinstall commands. eval cmds=\"$old_postinstall_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec $SHELL $0 --finish$current_libdirs exit 1 fi exit 0 ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. eval cmds=\"$finish_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit 0 echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do echo " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" echo "more information, such as the ld(1) and ld.so(8) manual pages." echo "----------------------------------------------------------------------" exit 0 ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit 1 fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit 1 fi dir= case "$file" in *.la) # Check to see that this really is a libtool archive. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit 1 fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case "$file" in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit 1 fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case "$file" in -*) ;; *) # Do a test to see if this is really a libtool program. if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case "$file" in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then # Export the shlibpath_var. eval "export $shlibpath_var" # Restore saved enviroment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now actually exec the command. eval "exec \$cmd$args" $echo "$modename: cannot exec \$cmd$args" exit 1 else # Display what would be done. eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" $echo "$cmd$args" exit 0 fi ;; # libtool uninstall mode uninstall) modename="$modename: uninstall" rm="$nonopt" files= for arg do case "$arg" in -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit 1 fi for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` rmfiles="$file" case "$name" in *.la) # Possibly a libtool archive, so verify it. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $dir/$n" test "X$n" = "X$dlname" && dlname= done test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname" test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" $show "$rm $rmfiles" $run $rm $rmfiles if test -n "$library_names"; then # Do each command in the postuninstall commands. eval cmds=\"$postuninstall_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. eval cmds=\"$old_postuninstall_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi ;; *.lo) if test "$build_old_libs" = yes; then oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` rmfiles="$rmfiles $dir/$oldobj" fi $show "$rm $rmfiles" $run $rm $rmfiles ;; *) $show "$rm $rmfiles" $run $rm $rmfiles ;; esac done exit 0 ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit 1 ;; esac $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit 1 fi # test -z "$show_help" # We need to display help for each of the modes. case "$mode" in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --version print version information MODE must be one of the following: compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE." exit 0 ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac echo $echo "Try \`$modename --help' for more information about other modes." exit 0 # Local Variables: # mode:shell-script # sh-indentation:2 # End: avifile-0.7.48~20090503.ds/bin/0000755000175000017500000000000011267637114014521 5ustar yavoryavoravifile-0.7.48~20090503.ds/bin/about.ppm0000644000175000017500000000147207233220760016346 0ustar yavoryavorP6 # CREATOR: The GIMP's PNM Filter Version 1.0 16 16 255 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„„‚„ÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆ„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿ„‚„„‚„„‚„ÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„„‚„„‚„„‚„„‚„ÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„„‚„ÆÃÆÿÿ„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„„‚„ÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿÆÃÆ„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆ„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿ„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„„‚„„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿavifile-0.7.48~20090503.ds/bin/avifile.m40000644000175000017500000001016610474277632016412 0ustar yavoryavor# AM_PATH_AVIFILE 0.1.0 # CXXFLAGS and LIBS for avifile # taken from Autostar Sandbox, http://autostars.sourceforge.net/ # constructed by careful cross-pollination from various sources and lots of # hard labour dnl Usage: dnl AM_PATH_AVIFILE(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for avifile, and defines dnl - AVIFILE_CXXFLAGS (C++ compiler flags) dnl - AVIFILE_LDFLAGS (linker flags, stripping and path) dnl as well as set HAVE_AVIFILE to yes or no dnl dnl FIXME: should define AVIFILE_VERSION dnl dnl prerequisites: dnl - working C++ compiler dnl - usable libstdc++ dnl - AC_PATH_XTRA AC_DEFUN([AM_PATH_AVIFILE], [ AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PATH_XTRA]) HAVE_AVIFILE=no dnl first look for avifile-config AC_PATH_PROG(AVIFILE_CONFIG, avifile-config, no) min_avifile_version=ifelse([$1], ,0.7.0, $1) if test "x$AVIFILE_CONFIG" != "xno"; then dnl now that we have it, we need to save libs and cflags AVIFILE_LDFLAGS=`avifile-config --libs` AVIFILE_CXXFLAGS=`avifile-config --cflags` AC_SUBST(AVIFILE_LDFLAGS) AC_SUBST(AVIFILE_CXXFLAGS) HAVE_AVIFILE=yes fi dnl we got this far, now start checking if we have the right version if test x$HAVE_AVIFILE = xyes ; then AC_MSG_CHECKING(for avifile - version >= $min_avifile_version) dnl first get the version number from avifile-config avifile_major_version=`$AVIFILE_CONFIG $avifile_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` avifile_minor_version=`$AVIFILE_CONFIG $avifile_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` avifile_micro_version=`$AVIFILE_CONFIG $avifile_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` dnl now run a short C app that tells us if the version is ok or not dnl all of this is boilerplate code from other examples rm -f conf.avifiletest AC_TRY_RUN([ #include #include #include int main () { int major, minor, micro; char ver[50]; system ("touch conf.avifiletest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ strncpy(ver, "$min_avifile_version", sizeof(ver) - 1); if (sscanf(ver, "%d.%d.%d", &major, &minor, µ) != 3) { printf ("%s, bad version string\n", "$min_avifile_version"); exit (1); } if (($avifile_major_version > major) || (($avifile_major_version == major) && ($avifile_minor_version > minor)) || (($avifile_major_version == major) && ($avifile_minor_version == minor) && ($avifile_micro_version >= micro))) return 0; else { printf ("\n*** 'avifile-config --version' returned %d.%d.%d, but the minimum version\n", $avifile_major_version, $avifile_minor_version, $avifile_micro_version); printf ("*** of AVIFILE required is %d.%d.%d. If avifile-config is correct, then it is\n", major, minor, micro); printf ("*** best to upgrade to the required version.\n"); printf ("*** If avifile-config was wrong, set the environment variable AVIFILE_CONFIG\n"); printf ("*** to point to the correct copy of avifile-config, and remove the file\n"); printf ("*** config.cache (if it exists) before re-running configure\n"); return 1; } } ], [ AC_MSG_RESULT(yes) HAVE_AVIFILE=yes ], [ HAVE_AVIFILE=no ]) fi if test x$HAVE_AVIFILE = xyes ; then dnl now try to compile a sample test app dnl first save whatever language we're currently testing in dnl AC_LANG_SAVE dnl AC_LANG_CPLUSPLUS AC_LANG_PUSH(C++) ac_save_CXXFLAGS=$CXXFLAGS ac_save_LDFLAGS=$LDFLAGS dnl add X flags, because it looks like avifile needs libXv and libXxf86vm CXXFLAGS="$CXXFLAGS $AVIFILE_CXXFLAGS" LDFLAGS="$LDFLAGS $AVIFILE_LDFLAGS $X_LIBS -lXv -lXxf86vm" AC_MSG_CHECKING(compilation of avifile test program) dnl try the compile AC_TRY_LINK([ #include #include #include #include ], [ /* function body */ IVideoDecoder *decoder; BITMAPINFOHEADER bh; decoder = Creators::CreateVideoDecoder(bh) ], [ AC_MSG_RESULT(succeeded) ], [ AC_MSG_RESULT(failed) ; HAVE_AVIFILE=no ] ) AC_LANG_POP CXXFLAGS="$ac_save_CXXFLAGS" LDFLAGS="$ac_save_LDFLAGS" fi ]) avifile-0.7.48~20090503.ds/bin/bottom.ppm0000644000175000017500000000060407646461635016554 0ustar yavoryavorP6 # CREATOR: The GIMP's PNM Filter Version 1.0 10 11 255 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ]]]ÿÿÿÿÿÿ===†††ÿÿÿÿÿÿ¢¢¢;;;ÝÝÝÿÿÿÿÿÿîîîGGGªªªúúúÿÿÿÿÿÿýýýÂÂÁMLL×ÖÖþþþÿÿÿÿÿÿÿÿÿâââLLL„„„îîîÿÿÿÿÿÿÿÿÿÿÿÿñññ„„„,,,¼¼¼ÿÿÿÿÿÿÿÿÿÿÿÿDDDÿÿÿÿÿÿZZZÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿavifile-0.7.48~20090503.ds/bin/down.ppm0000644000175000017500000000060407646461635016217 0ustar yavoryavorP6 # CREATOR: The GIMP's PNM Filter Version 1.0 10 11 255 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ]]]ÿÿÿÿÿÿ===†††ÿÿÿÿÿÿ¢¢¢;;;ÝÝÝÿÿÿÿÿÿîîîGGGªªªúúúÿÿÿÿÿÿýýýÂÂÁMLL×ÖÖþþþÿÿÿÿÿÿÿÿÿâââLLL„„„îîîÿÿÿÿÿÿÿÿÿÿÿÿñññ„„„,,,¼¼¼ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿâââ¼¼¼ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿâââÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿavifile-0.7.48~20090503.ds/bin/mute.ppm0000644000175000017500000000147207517325446016222 0ustar yavoryavorP6 # CREATOR: The GIMP's PNM Filter Version 1.0 16 16 255 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÿÿÿÿ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÿÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„„‚„„‚„„‚„„‚„ÿÿÿÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÿÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„„‚„„‚„„‚„„‚„ÆÃÆÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿavifile-0.7.48~20090503.ds/bin/open.ppm0000755000175000017500000000555607233220760016207 0ustar yavoryavorP3 # Created by Paint Shop Pro 6 16 16 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 132 130 132 132 130 132 132 130 132 132 130 132 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 132 130 132 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 132 130 132 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 132 130 132 255 255 255 198 195 198 255 255 0 198 195 198 255 255 0 198 195 198 255 255 255 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 255 255 255 255 255 255 132 130 132 255 255 255 255 255 0 198 195 198 255 255 0 198 195 198 255 255 0 198 195 198 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 132 130 132 0 0 0 255 255 255 132 130 132 255 255 255 198 195 198 255 255 0 198 195 198 255 255 0 198 195 198 255 255 0 198 195 198 255 255 0 198 195 198 255 255 0 198 195 198 132 130 132 0 0 0 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 255 255 0 132 130 132 0 0 0 132 130 132 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 132 130 132 0 0 0 198 195 198 132 130 132 0 0 0 132 130 132 255 255 255 198 195 198 255 255 0 198 195 198 255 255 0 198 195 198 255 255 0 198 195 198 255 255 0 198 195 198 255 255 0 0 0 0 132 130 132 132 130 132 0 0 0 255 255 255 132 130 132 255 255 255 198 195 198 255 255 0 198 195 198 255 255 0 198 195 198 255 255 0 198 195 198 255 255 0 198 195 198 132 130 132 0 0 0 132 130 132 0 0 0 255 255 255 132 130 132 255 255 255 255 255 0 198 195 198 255 255 0 198 195 198 255 255 0 198 195 198 255 255 0 198 195 198 255 255 0 198 195 198 0 0 0 132 130 132 0 0 0 255 255 255 255 255 255 132 130 132 255 255 255 255 255 0 198 195 198 255 255 0 198 195 198 255 255 0 198 195 198 255 255 0 198 195 198 255 255 0 132 130 132 0 0 0 0 0 0 255 255 255 255 255 255 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 132 130 132 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 avifile-0.7.48~20090503.ds/bin/opena.ppm0000644000175000017500000000147207342746723016353 0ustar yavoryavorP6 # CREATOR: The GIMP's PNM Filter Version 1.0 16 16 255 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ999ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÇÇÇÇÇÇÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„;:;999ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÿÿÿÿrrrŽŽŽãããÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÿÆÃÆŽŽrrnmn;:;„‚„„‚„„‚„„‚„„‚„ÿÿÿÿÿÿ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÿ„‚„ÿÿÿ›˜›nmnÿÿÆÃÆÇÇŽŽÆÃÆÿÿÆÃÆ„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„ÿÿ„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆ„‚„„‚„ÿÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿ„‚„„‚„ÿÿÿ„‚„ÿÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆ„‚„„‚„ÿÿÿ„‚„ÿÿÿÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿ„‚„ÿÿÿÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿ„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿavifile-0.7.48~20090503.ds/bin/opens.ppm0000644000175000017500000000147207342746723016375 0ustar yavoryavorP6 # CREATOR: The GIMP's PNM Filter Version 1.0 16 16 255 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿrrrªªªÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿªªªŽŽŽUUUÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„XWXXWXÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÿÿÿÿÿÿÿÇÇÇÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÿÆÃÆÿÿÆÃÆÿÿnmnvtv„‚„„‚„„‚„„‚„ÿÿÿÿÿÿ„‚„ÿÿÿÿÿÆÃÆÇÇ›˜›ÿÿ°®°ªªªÿÿÿÿÿÿÿÿÿ„‚„ÿÿÿ„‚„ÿÿÿÆÃÆÿÿYWYnmnrrããÆÃÆÿÿÆÃÆ„‚„„‚„„‚„„‚„„‚„„‚„„‚„;:;XWX„‚„„‚„„‚„ÿÿ„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆ„‚„„‚„ÿÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿ„‚„„‚„ÿÿÿ„‚„ÿÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆ„‚„„‚„ÿÿÿ„‚„ÿÿÿÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿ„‚„ÿÿÿÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿ„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿavifile-0.7.48~20090503.ds/bin/pause.ppm0000755000175000017500000000147207517325446016370 0ustar yavoryavorP6 # CREATOR: The GIMP's PNM Filter Version 1.0 16 16 255 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„„‚„„‚„„‚„„‚„ÿÿÿÿÿÿ„‚„„‚„„‚„„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÿÿÿÆÃÆ„‚„ÿÿÿ„‚„ÿÿÿÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿ„‚„ÿÿÿ„‚„ÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿÆÃÆ„‚„ÿÿÿ„‚„ÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿ„‚„ÿÿÿ„‚„ÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿÆÃÆ„‚„ÿÿÿ„‚„ÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿ„‚„ÿÿÿ„‚„ÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿÆÃÆ„‚„ÿÿÿ„‚„ÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿ„‚„ÿÿÿ„‚„ÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿÆÃÆ„‚„ÿÿÿ„‚„ÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿ„‚„ÿÿÿ„‚„ÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿÆÃÆ„‚„ÿÿÿ„‚„ÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿ„‚„„‚„„‚„„‚„„‚„ÿÿÿ„‚„„‚„„‚„„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿavifile-0.7.48~20090503.ds/bin/play.ppm0000755000175000017500000000147207517325446016220 0ustar yavoryavorP6 # CREATOR: The GIMP's PNM Filter Version 1.0 16 16 255 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÿ„‚„„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿ„‚„„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿÆÃÆÿÿÆÃÆ„‚„„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿ„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿ„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿ„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿÆÃÆÿÿÆÃÆ„‚„„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿÆÃÆ„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿ„‚„„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿ„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿavifile-0.7.48~20090503.ds/bin/stop.ppm0000755000175000017500000000147207517325446016240 0ustar yavoryavorP6 # CREATOR: The GIMP's PNM Filter Version 1.0 16 16 255 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿ„‚„ÿÿÿÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿ„‚„ÿÿÿÿÿÿÿÿÿ„‚„ÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆÿÿÆÃÆ„‚„ÿÿÿÿÿÿÿÿÿ„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿavifile-0.7.48~20090503.ds/bin/test.png0000644000175000017500000000434507233220761016206 0ustar yavoryavor‰PNG  IHDR }JbgAMA± üaœIDATx­W hTÙþfœ$ÏdV_Ü1ÎNžëKœ¦ƒD™–´–t—” K*é6X›‘ Z±ÃV‚XÒTD$,©„"ÛED¤Y$lÅÚ%m³m(ƒŒÛ© »ƒ îˆÓøV§æŸúŒ“ÜžsßÌ$£›…-=ÉÌ»ïÞsÎ=÷»g\†a`9¹ùå­&MLžÐ]Ìqþô¨°r"^’Ãƶ ŸæFf-’ä`ù¯7¶ˆo 9Q>†_í5`[&Üý_Õ„mÍI‰›æ™%»¿Õ,ÜÞO7ÒânÌÌtº˜Ë#Yé+ ¡ÞÇÏ[ÞÄø~|p6-‚ö2†ðå8*‡ð ÿOX*3‚ú¬KjxŸ¬J«€?óÿœÜˆh˜hå/Cšž²ÀJ$Ý(.6:d|!ùäy©á7»{ÄæÐ$* œ?Õq4EoÿQ—ÔŸr×ê1ÌBÇä;{ñ_-ÎDœH½‘u­"§ê° Fâ"„-°s(îhÚ×%MÅ1Oâk?Å⸚‘Ê-¾¡Çq_¢½µ NüBº¨*ŽAîó4QE>_Mµb|¼uJ ÿ"­‡@`œ\½'ùffz]Àbfæ‚ÌOQ˜ŸÏ)¸tòˆ°Í1Ôx(QDWãÀhbˆFÛè“¥Ï5Jô@IQ™‚šˆêÀæ6€Íf¤gÖj)•?mÇèq k,/6(.lìý™“k‡¨&f½'†™Q¼Ôr«•5xlÏa6IËÛôÁgzá%ëªòN”Ê,`EZ@—F1CÕûÖ¤‰½aaà~ò8l Þ˜ºœ¤Ü1™‚c;4ÑÖƒê÷Á¥¬¢]K%ƒ¿:Œú0‹@–Ìv*U—¢ ]îÒa½ƒN„ZBøû æOak”¶fââ³ýpÖ%ü‘êZNÒâÍÅ:75dá~¶R¿Åk»’R¨’… Ä‘—K¾è³`L¹˜s^8ï(îrŽ¥7YËK¯Îˆ ¥M?Rš®ô‰@à4}ÞXŠjaµÌ‚ĉCâJf[t½À­ýØöòE!ÐW`_WRZ”Y0—Ë£Ág€Ä´Ú üºï2†:H›,a«®œcý<”Y`ÒXí§ÈÒlQ §­žæŽ¶ `竉Ø^ PŸ‘›”Y`«*•®#ß x½Kt¶EœºŒÚP 5”ôR® {0êpñÌR_Š«øS¦N˜£0\2Žgv¶ ¿âÇÏž+Ä 8ÙÝ#|ù rT_f8¤Íø¶.ÂÜrÈ+ɘ»dÌðE?²ö¨xÍd]—?Û„îqJw†€©µD±¢Ü&|¿Ë‡ùJÔ«¶M¥¶ÃšGÎ4 vºbUÂ0C±õz[õW ŠMd)Ôy¼¸MŒeu^™aSdi¢ ¸B‹kÎ¥ÐÔ¶Ö>êgÈ{E‘àø”Ö¸!6L F:_>D^š¨ÑX%p?“€jµ’ÁYJ‡ÉF@ÕäÙ_ ¥Sq¸4ýù)`E{¨OºFWWg4‚ïEÖa¹`S³5ž »!E0¨“IÊ-…9—ƒ™‘xÉ·š'ô¦ûCõëX£ùà¦|™F¯ŸX*@ÞcÅðâ+=¬Kf`Ó†ŸøÛ OUÜ1mœ;sz<ƒƒGbx”³àñ»ñ’¯V.Œy+‰U^ ¡PÏ#ƒ§dÐ'  ÷=§cÝEZ±¹1o ‡á›8{šŠpªƒ!ºðHäKcxœSõ8¿€'6œ]£psá.Ò“éÓ4EõwåF|¦¯h¢% *ÂØ•š…ZµšrH›Ò]Ç>¥j®j æ1CW÷lú]¬öäAµˆZÝÁ~¾}–ŸžÛ) {™Ïp¡_ :Å_=ìEU”‚5D†(<˲q=9{ijD3ð龤zc²‰Ÿ+^&¸à})Ùô¾<Ì&‰¡ö]ˆÇ€Ã$¯HßÍS]“*šÛéW@Ø ª9\›h¦º£zPÕãxÁOBÄO‡¥Œ¼d’X/}Z––e. Šj\Aöž7ççí4jR‡íßE€£ Ò¥ ÏÉÖ{•ö"¬É1|³cÕTxË£VæýÒ~rÄÑ@÷é¬kUÓ܈à¼qoñpQAUÌ"×Ù"0gÒ™½Åâ–>\ùš¬jõ…~\WÃ}ÏMžÚ¸føJ¥Ñøò*< $·@â ¤£8¦ß*’¸xü”Ö¨=Ä—¶¿ùËÿFÌ’¢õGl‚IEND®B`‚avifile-0.7.48~20090503.ds/bin/test.xpm0000644000175000017500000000303307613463777016241 0ustar yavoryavor/* XPM */ static char * test_xpm[] = { "32 32 24 1", " c None", ". c #7F0000", "+ c #999999", "@ c #4C4C4C", "# c #FF00FF", "$ c #00FFFF", "% c #E5E5E5", "& c #666667", "* c #007F00", "= c #FF0000", "- c #191919", "; c #7F7F00", "> c #00007F", ", c #00FF00", "' c #7F007F", ") c #FFFFFF", "! c #B2B2B2", "~ c #333333", "{ c #007F7F", "] c #FFFF00", "^ c #0000FF", "/ c #CCCCCC", "( c #7F7F7F", "_ c #000000", " ", " ", " >>>>>> _ ", " >>>>> >>>_ ", " ~ ~~_>_ >>>>_ ", " @( .....-_ >>>>>_ ", " ((........>>>>>>>> ", " @(..........~>>>>_ @@ ", " @(............->_ (++. ", " @..............->_ ((++( ", " -...............>~++(+++ ", " -..........(....&++(++++. ", " ..&.....++!!....+!+(++++; ", " ..+....+!+++....!+((((++. ", " ..((..+!!!++....(((++++( ", " _.&+++!!+(&(....((((+++. ", " .((+!!++!((.....+++++( ", " .-&+!+&+!+!+......((. ", " ._@+++_@!+++........ ", " &~~(++_~!(!!........ ", " @(...++(&(+!!+....... ", " @(..(+!!+!!!!!........ ", " .++++!!!!!!!!+........ ", " ...(+++!!!!!+(.......... ", " .....(((+!!!+............ ", " ......(++++&.............. ", " .........&(+&''............ ", " ........@'(+('>'............ ", " .......'''(&'''............. ", " .........''+&'''.............. ", " ........@''&&'>~.............. ", "........@'>''>>'>-............. "}; avifile-0.7.48~20090503.ds/bin/top.ppm0000644000175000017500000000060407646461637016054 0ustar yavoryavorP6 # CREATOR: The GIMP's PNM Filter Version 1.0 10 11 255 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿZZZÿÿÿÿÿÿDDDÿÿÿÿÿÿÿÿÿñññ„„„,,,¼¼¼ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿâââLLL„„„îîîÿÿÿÿÿÿÿÿÿýýýÂÂÁMLL×ÖÖþþþÿÿÿÿÿÿîîîGGGªªªúúúÿÿÿÿÿÿ¢¢¢;;;ÝÝÝÿÿÿÿÿÿ===†††ÿÿÿÿÿÿ]]]ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿavifile-0.7.48~20090503.ds/bin/up.ppm0000644000175000017500000000060407646461640015670 0ustar yavoryavorP6 # CREATOR: The GIMP's PNM Filter Version 1.0 10 11 255 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿâââÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿâââ¼¼¼ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿñññ„„„,,,¼¼¼ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿâââLLL„„„îîîÿÿÿÿÿÿÿÿÿýýýÂÂÁMLL×ÖÖþþþÿÿÿÿÿÿîîîGGGªªªúúúÿÿÿÿÿÿ¢¢¢;;;ÝÝÝÿÿÿÿÿÿ===†††ÿÿÿÿÿÿ]]]ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿavifile-0.7.48~20090503.ds/doc/0000755000175000017500000000000011267637117014521 5ustar yavoryavoravifile-0.7.48~20090503.ds/doc/EXCEPTIONS0000644000175000017500000001055707233220762016125 0ustar yavoryavor This library contains several modules, connected into hierarchical structure, Very frequently an error that has happened in lower-level module results in breaking the functioning of some ( or all ) parent modules. These error states can be conveniently handled by technique called 'exception handling'. It's relatively rarely used part of C++ standard, and some time ago it was unsupported by popular compilers. Here I'll describe briefly how to use exception handling to correctly deal with errors in programs on top of Avifile, as well as basics of it for those without proper education in this area. 1. EXCEPTION HANDLING BASICS One basic idea is an 'exception object' - an object that's created when exceptional state occurs. Then it's 'thrown' - program repeatedly unwinds stack, moving from function to function until either exception is catched or program reaches top of stack. In latter case by default program aborts ( though one can override default action ). Throwing, catching exceptions and creation of exception objects is done by programmer, so he can decide what kind of data will be contained in exception object. It is convenient for this object to contain description of error and module which caused it. Look at first sample. It shows how to throw an exception and how to catch it. FILE* f; try { f=fopen("./my.file", "rb"); if(f==NULL)throw "Error opening file"; // // this code won't be executed if f is NULL //.... // } catch(const char* string) { //Perform failure handling cerr<, which contains definition of main exception object types. --- Catching exceptions --- Embrace all Avifile calls which can fail into try{} block. Add catch() for type FatalError&: try { pFile->OpenFile(argv[1]); stream=pFile->GetStream(AviStream::Video, 0); } catch(FatalError& error) { //Here you can show message box with content from error.GetDesc() //and re-throw exception if you can't handle absence of stream object } FatalError class has 4 members: Print(), PrintAll(), GetDesc() and GetModule(). Print() prints name of module and error description to stderr. PrintAll() does the same, but also adds name of C++ source file and line where an exception was thrown. GetDesc() returns const char* pointer to error description, and GetModule() returns name of failed module. --- Throwing exceptions --- In addition to including , #define string constant __MODULE__ in your source file to contain name of your module: #include #define __MODULE__ "MyProg" Make sure that this definition is not overridden by any included later files. Every time you face with an error which is fatal for your module, add line throw FATAL("...."); where "...." should contain error definition. 4. EXCEPTIONS VS ERROR CODES try { CallSomeFunc(); CallSomeMoreFunc(); DoSomething(); } catch(FatalError& error) { error.Print(); destroy(); } /********** or: **********/ int hr; hr=CallSomeFunc(); if(hr!=0) { cout<<"CallSomeFunc(): "< (active developer) Eugene Kuznetsov Alexander Rawass Heinrich Langos Hiroshi Yamashita Build with the following parts from other project sources: plugins/libwin32/loader/ : mostly taken from Wine project ( http://www.winehq.com ) plugins/libaudiodec/gsm* : XAnim sources, see plugins/libaudiodec/xa_gsm.c for precise copyright plugins/libmpeg_audiodecoder/ : 'splay' MP3 player, by Jung woo-jae plugins/libac3pass/ : emu10k1 CVS tree - Juha Yrjölä plugins/libmp3lame*/ : lame developers ffmpeg/ : ffmpeg developers (creator - Gerard Lantau,...) lib/aviread/asfinput.cpp : partially from ASFRecorder ( http://members.tripod.com/asfrecorder ) plugins/libvorbis/ : based on work of mplayer team - especialy Felix 'Atmosfear' Buenemann also the gstream vorbis support has been checked Many patches from different people - to name just few: Miguel Freitas for pushing me to finish DirectShow loader in plain C - also I've used ideas from his rewrite Rainer Lay - misc patches for some utilities Arkadiusz Miskiewicz (autoconf,...) Mathew Kanner (FreeBSD,...) Juergen Keil (Solaris i386 patches) Jakub Jelinek (resolving some problems with gcc) Yue Shi Lai (patch fo VfmEx based on mplayer code created by Atmosfear) avifile-0.7.48~20090503.ds/doc/KNOWN_BUGS0000644000175000017500000000051107241123516016143 0ustar yavoryavorProblem with color depth detect on Riva 128 ( true color ). Indeo Video 5.0 codec refuses to encode 32-bit data. Player does not allow to choose non-ISO-8859-1 fonts for subtitles. Solution: upgrade to Qt 2.2.4. All programs crash during loading on some platforms. Can be solved on client-side by upgrading libstdc++ library. avifile-0.7.48~20090503.ds/doc/FreeBSD0000644000175000017500000000127407233220762015652 0ustar yavoryavor/* $Id: FreeBSD,v 1.1.1.1 2001/01/23 06:17:22 cypher Exp $ */ Now FreeBSD Ports available. http://www.freebsd.org/cgi/ports.cgi?query=avifile&stype=all Thanks MAINTENERS. - old memo's need FreeBSD's package(or ports) egcs & gmake & qt Found from ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/3.5.1-RELEASE/packages/lang/gcc-2.95.2.tgz ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/3.5.1-RELEASE/packages/devel/gmake-3.79.tgz ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/3.5.1-RELEASE/packages/x11-toolkits/qt-2.1.1.tgz and symlink /usr/include/machine/soundcard.h -> /usr/include/sys/soundcard.h %setenv CC /usr/local/bin/gcc295 %setenv CXX /usr/local/bin/g++295 %./configure %gmake avifile-0.7.48~20090503.ds/doc/avicap/0000755000175000017500000000000011267637120015756 5ustar yavoryavoravifile-0.7.48~20090503.ds/doc/avicap/avicap.html0000644000175000017500000002276707653577154020143 0ustar yavoryavor Avicap User Documentation

Avicap User Documentation

to Avifile Homepage         to Avicap Homepage

docu by: Alexander Rawass (alexannika@users.sourceforge.net)
if anyone can write a better documentation - please do it and tell me

Avicap is a capturing tool for video4linux that allows to record in realtime with various (DivX-)codecs.
Avicap also contains a programmable timertable, so that Avicap can be used like a VCR/PVR.
Avicap also allows to automatically shutdown/poweroff and resume/poweron your computer in-between programmed recordings.
Avicap also displays EPG (Electronic Program Guide) Information, that can highlight or block programs to the regexp of your choice.

Avicap is part of the avifile library

Sections in this documentations:

Features:

  • video4linux grabber interface
  • Qt GUI, full control of recordings via GUI
  • lot of different codecs for encoding:
  • encoding thread buffers frames when system load is high
  • perfect A/V-sync
  • automatically segments recording at given size
  • you can change saturation/brightness/etc while recording
  • not hundreds of commandline options ;-))
  • no Digital UnRights Management ;-)
  • distributed under the GPL/LGPL license - it's Free Software!
  • programmable timertable 
  • EPG Electronic Program Guide  
    it can highlight or block programs by regexp
  • password lock to enforce blocking of programs
  • shutdown & resume option to shutdown/poweroff and resume/poweron your computer between recordings
  • Directory Pool, to use all your free space on all partitions automatically


Usage:

start avicap with 'avicap'

A window will come up, showing the currently selected channel (if you've used a v4l app before), or with noise, because no channel has been set yet.
Best to go to the Configuration Dialog and set the correct settings for your video device.

When you click the right mouse button, a menu will pop up with those entries:
  • Configuration
    there you can select your video device, input, color space and grabbing size
  • Xawtv station
    If you have a valid xawtv configuration file with channels set, then Avicap will use that file to show you a channel list in this menu
  • Picture Properties
    changes saturation,brightness,etc
  • Timertable
    opens the window to show the programmable timertable
  • Electronic Program Guide
    opens up the window of the EPG Electronic Program Guide  
    the timertable window will also be opened
  • Capture AVI
    capture an avi manually
    a new window will come up, click 'start' to start the recording

If you start avicap with 'avicap -timer' , the timertable window will automatically open and start the timer to wait for pending recordings.

Performance?

My system is an Athlon550 with TNT2pro graphics card, running SuSE8.1 with kernel-2.4.18 with apm enabled, I am using nvidia's proprietary drivers (shame on me!).
I've got 384MB ram and a bttv-compatible TV-card, I am using the v4l/bttv driver in the kernel.
My harddisks are set to Ultra-DMA 2 mode, they can write 30MB/sec and read 20MB/sec.
My Motherboard is a Asus K7M which has got a 'RTC Alarm Resume from Soft-off'.

I record at 384x288 pixel, in YV12 or RGB24 color mode, 25fps PAL.
My preferred codec at the moment is native XVid, at 3Mbit/sec for perfect quality, with halfpel interpol. and lum. masking turned on

I have to nice avicap to a lower priority (-15) to not get any framedrops in recording (whatever I  do else with my system), the recording takes up 65-75% of my CPU time - great!

Avicap can record stable in the background without any framedrops, I can read/write Emails in kmail and surf the net with galeon without suffering from framedrops.

If I also nice up gcc, I can also compile source code (nice -15 make).

I can also watch other avis with mplayer while I am recording, but I have to nice mplayer up, so mplayer gets it's framedrops - but NO framedrops in the recording, which is more important.

Hey, that's quite a good performance for a nowadays slow 550MHz CPU - thanks especially to the xvid team for their codec :-)))

Can anyone tell me which processor I need to record with xvid/divx/ffmpeg in PAL-fullscreen (786x576) in superb quality - cause that's the only thing I'll need a newer/faster CPU for? :-)))

more documentation:


Plans for the future:

  • Fullscreen/Maximize mode with xvideo overlay
  • record while zapping through channels

Screenshots

timertable screenshot Screenshot of the programmable Timertable
There, you can see my list of recordings for the next time.
The current recording is highlighted red, the next pending recording is highlighted green.


screenshot epgwindow Screenshot of the EPG (Electronic Program Guide) Window
Here you can see a typical day on german television.





avifile-0.7.48~20090503.ds/doc/avicap/configuration.html0000644000175000017500000002526707653577155021546 0ustar yavoryavor Avicap Configuration

Configuring Avicap


docu by: Alexander Rawass (alexannika@users.sourceforge.net)
if anyone can write a better documentation - please do it and tell me

To configure Avicap, press the right mouse button and select 'Configure' from the pop-up menu.

If overlay mode is enabled, the overlay TV-picture may be drawn above the menues, so can't read/use them.
Best is, to go to the very right of the TV-window and click right mouse there, so the menu will pop up beside the TV window.

The configure dialog will show these Tabs:

  • Device
    you can set up your v4l device here, select video input, color mode, capturing size and color space
  • File
    • Destination file
      this will be the default destination file if you do 'Capture Avi'
    • never overwrite existing files
      <does not work fully yet>
    • Directory Pool
      you can add directories there that you want to use for your recordings
    • Segmentation
      you should always use segmentation, because the filesystem you might use might not allow files greater than 2 or 4MB or whatever
      I've set the segmentation size to 1900000 Kb (1.9GB), so I can be sure that the files work fine on linux as well as my windows-partitions
  • Video
    • Video Compression Format
      you can select between different video-encoders and there options, when you press 'Change'
    • Video frame rate
  • Audio
    • Audio compression format
      is not yet implemented
      you can only record to uncompressed PCM audio, you have to recompress the audio later with tools like qtrecompress, mencoder or transcode or else
    • Audio format
  • Limits
    • you can limit the duration and file size of your recordings
      I might advise you to leave these options unchecked, but others might think different
      if you want to record for a specific time, better use the programmable timertable
      to limit the size of the file, so that your HD doesn't overflow, better use segmentation together with the Directory Pool
  • Shutdown & Resume
    here you can allow Avicap to shutdown/poweroff and poweron/reboot your computer automatically
    read here in full length about the shutdown & resume modes
    read this, if you want to know about the options to configure shutdown & resume
  • other
    • Log to file
      all important actions get logged into ~/.avm/avicap-userlog.log
      you have to restart avicap for changes to have effect
    • Password Lock
      here you can set the Lock password or lock avicap
      if Avicap is locked, programs which are blocked by the EPG cannot be watched

Directory Pool

The direcory pool is a list of directories, where you want Avicap to save your recordings.

Enter the name of a directory and select, how much space should be always free on this device, then click 'add'

The directory will be shown in the Direcory pool table, along with the keep-free setting and the currently free disk space.

You can enable or disable each entry per checkbox, disabled entries will not be used for saving.

With these checkboxes, you can easilty disable a directory for now and turn it on back later.

To actually use the DirPool feature, you have to learn about the 'special way' Avicap uses to select how your files are named, and in which dir they go:

Naming your files

Avicap saves files in different ways, depending on the way you name them (either in the Configure/File/File Destionation dialog or in the Timertable/Filename entry:
  • absolute or relative paths (filename starts with either '/' or '.')
    the file will get written to that absolute or relative path, like you'd expect it
    the filename might get changed if you enabled 'never overwrite existing files'
    examples:
    • /home/alex/video/record/movie.avi
    • /windata/record/movie.avi
    • ./movie.avi
    • ./subdir/movie.avi
  • filename has no path and ends on .avi
    avicap will select the 'best' directory from the dirpool and write the file into that direcory
    examples:
    • movie.avi        -> /path/from/dirpool/movie.avi
    • movie123.avi     -> /another/path/from/dirpool/movie123.avi

  • filename has got no path and hasn't got an .avi ending
    avicap will select the 'best' directory from the dirpool
    avicap will append the current date as '-yymmdd-hhmmss.avi' to the filename
    examples:
    • movie            -> /path/from/dirpool/movie-030401-190000.avi
    • movie347beta     -> /another/path/from/dirpool/movie347beta-030402-201500.avi

  • no filename at all
    avicap will select the 'best' directory from the dirpool
    avicap will name the file 'avicap-yymmdd-hhmmss.avi' , depending on your date
    use this to never care for filenames any more
    no example ;-)

Warning:
If you use absolute or relative paths, the dirpool doesn't get used and Avicap also doesn't check for free space on disk or segements to different directory

When you use the dirpool, avicap will try to find a directory with enough free space and then segments there.

It is recommended to not use absolute/relative paths at all.

How Avicap finds the 'best' directory

Avicap will select the directory from the dirpool as 'best' , where Avicap has the most free space to write to.

Avicap respect the 'keep free' setting, and will stop recording into that directory if the 'keep free' limit is reached.
Avicap will then try to select another dir from the dirpool, and continue the current recording by segmenting it.

<noy yet> If Avicap cannot find free space anymore, avicap will abort the current recording and disable all other recordings, then it will go into shutdown (if selected).


Password Lock

The password lock is a feature for parents, who don't have the time to care about their children and simply park them before the TV (or rather Avicap), so they don't have to communicate with their children.

If you don't want to care what your children are watching, or if you have better things to do than be with your children, you can use the password lock to simply forbid your children to watch any TV shows you don't like them to watch.

Setting up your unix system for use with password lock


First, you need separate accounts for parent 'parent' and child 'child'.

Install avicap as root like you normally do.

Now change the owner of your /dev/video device to 'parent' and make sure that your children have no access to /dev/video at all.

Then make sure that the home dir of 'parent', the dir ~parent/.avm and especially the files
~parent/.avm/default and ~parent/.avm/avicap-regexps
are not readable (or writable) for your children.

Then change (as root) the owner of the avicap binary (usually /usr/local/bin/avicap ) to 'parent' and set the setuid-bit on the binary.

That way, when avicap is started, it runs as user 'parent'

Now start avicap as parent.

Go to config/others and do 'Set Password'

You get prompted for a password, enter it twice and click the button.

Then click 'press to lock'.

After that, Avicap will get locked, with those effects:
  • the epg window will start up
  • on a channel switch, avicap will verify what program/show is currently running on this channel.
  • if the current program is blocked in the EPG, avicap will not allow to switch to that channel
  • avicap won't allow free editing of the regexps file (deleting blocked regeps is not possible)
  • avicap won't allow changing of the EPG provider
  • avicap won't allow unlocking unless password given
  • at a restart of avicap, avicap is still locked
Your children can now use Avicap to watch TV, but it is not possible for them to switch to a blocked channel.

WARNING: the timertable has still full access to all channels YET!!

You have to have a valid EPG provier, you should have sensible regexps for blocking, and you should make sure that the epg xml date is updated at least every day.

If the epg data doesn't get updated, or if avicap cannot find the epg xml file, the lock will not be able to block channels any more.

Make also sure that your children also cannot read/write the epg xml data and the nxtvepg data directory etc


Security thoughts:
  • your children could download, compile, run or use other TV software
    BUT since /dev/video is setuid of 'parent', only TV software which runs as root or 'parent' can access the video device, and your children have to get root access for that
  • the password is saved into the file ~parent/.avm/default unencrypted (yet)
    BUT, if the permissions of 'parent' and its subdirs are okay, it is not possible for your children to read or write this file
  • the regexps in ~parent/avicap-regexps can also not be edited or read without special permissions
  • you should set the umask of 'parent' to secure values
If you've got ideas to improve security or a flaw in the password lock feature, tell us.

avifile-0.7.48~20090503.ds/doc/avicap/epg.html0000644000175000017500000001676507646422266017447 0ustar yavoryavor Avicap EPG Electronic Program Guide

Avicaps EPG Electronic Program Guide


back to Avicap Index

docu by: Alexander Rawass (alexannika@users.sourceforge.net)
if anyone can write a better documentation - please do it and tell me

Avicap's EPG display can display EPG information that has been saved in the xml 'xmltv' format.

This format is supported for linux and analogue TV by those projects:
I've only tested it with nxtvepg.

Preparing nxtvepg for usage with Avicap

You have to download and install the latest nxtvepg package.

Make sure that you TV card is correctly configured (with kv4lsetup), then start nxtvepg.
Avicap or any TV apps should better not run while nxtvepg is running??

nxtvepg will start searching your xawtv channels for EPG providers.

If found, it will start aqcuiring the EPG data via the vbi blank between each TV frame.
This will take some time, this process is rather slow.

Let it run for some time.

Then exit nxtvepg.

Now get nxtvepg to produce a xml-output of it's aqcuired data, that is readable by avicaps EPG-browser, like this:

nxtvepg -dump xml -provider <hex of provider> >/tmp/epg.xml

To know about the hex number of the epg provider, open up the 'view statistics' window in nxtvepg, and look for the hex num after 'CNI'.

It's probably a good idea to read the nxtvepg documentation at this point.

Avicaps EPG browser

If you click 'Electronic Program Guide' in your Avicap menu, the EPG module will start and open up its window.
Per default, the EPG data will be read from /tmp/epg.xml , but you can change that in the epg config dialog.
Depending on the size of your EPG data file and on your number of regexps, it may take some seconds til the window comes up.

EPG Browser window

On the left side is a channel table - this is yet not functional.

In the middle you'll see the EPG guide of today, a display that looks like the tables in your movie guide (or, at least like mine ;-)).
If you're not seeing any data, you should click 'EPG Config' and configure your EPG data file.

In the top strip, you can change the day you are currently seeing.

With 'Toggle Display' you switch from guide display to table display.

The table display is rather unusuable imho, better not use it.

'EPG Config' starts the EPG configuration.

'Edit Regexps' opens the regexp editor, where you can edit regexps to highlight or block programs by name.

EPG Configuration

At first use, you should set the 'EPG xml filename' to the xml data file of the provider you want to use.
Any changes in this field need a restart of Avicap to have effect. Yet.

When the EPG module has found a correct EPG xmltv file, it will display a list
'EPG Provider to Avicap channel mappings'

The EPG module doesn't know, which epg channel is which avicap channel, so you have to select the correct channels there, to have your EPG guide be displayed in correct order.

You can also select the color, with which the EPG strip of that channel will be colored.
I recommend rather light colors, like you can see in the screenshots.

The spinboxes 'day starts at' and 'day ends at' are yet not functional.

With 'recording starts/ends N mins before/after program' you can select the time margin, that gets sent to the timertable, when you add recordings from the EPG display to the timertable.


EPG Display/Guide Display

If you're EPG config is correct, you will see in the middle of the EPG window the guide display.

It looks like a TV guide, it's also nicely colored if you select sane colors.

If you move your mouse around, you can see the full description of the program at the bottom of the guide display.

If you press the middle mouse button and hold it, you can move the display around to where you like it.

If you press the right button, a popupmenu will show up, see below.

If you have set regexps, then highlighted programs will (currently) appear in green, blocked programs in  near-black (nearly unreadable).

If you have a pending recording in the timertable, it will also show up with a blue shading across the timespan, where the recording will happen.

Guide Popup Menu

In the popupmenu, you can add the current selected program to your highlight- or blocklist, and you can also add the program to the list of pending recordings in the timertable.

Regexps, Regexp Edit, blocking and highlighting programs

With Avicaps EPG module, you can use regular expressions to highlight or block programs by title name or description string.

Press 'Edit Regexps' in the EPG window, and the Regexp edit window will appear.

In the textedit, you can edit your regexps by hand, like in a text-editor.

The regexps have following syntax:

[#](title:|desc:|both:)(block:|high:)regexp

Huh? For example, these are valid epg regexps:
  • title:high:.*Star.Trek.*
    will highlight all program which have 'Star Trek' or 'Star-Trek' etc in their title.
  • desc:high:.*Doris.Day.*
    wil highlight all programs which have the string 'Doris Day' or alike in their description.
  • title:block:^X.Files$
    will say goodbye to one of my most despised series in TV
  • desc:block:.*Scully.*
    will do that and even more
  • # title:block:whatever
    will do nothing, cause # at the start of a line is a comment
Note: we're using Qt's QRegexp here, they are regexps, not wildcards, so you should know what you do.

I recommend you to use a normal text-edit to edit the regexps, that's easier and more comfortable than in the 'Edit Regexp' window.

The Regexp file is ~/.avm/avicap-regexps

If you press 'Re-read regexps', the EPG module will re-read this file from disk (after you've changed it in an external editor)

What I do with these blocking features

I am using the blocking features of Avicap's EPG display to not know and see violence in TV at all any more, I've completely blocked all those (mostly american) series, where the audience can enjoy itself by watching people in fear, running for their lives, and can amuse themselves with pictures where the blood runs from the walls, and people get cut in half for the enjoyment and amusement of YOU, the viewer.

Currently, I've blocked 78 series in german TV this way.

Soon, this will include a password lock.





avifile-0.7.48~20090503.ds/doc/avicap/shutdown_resume.html0000644000175000017500000002745107644167707022125 0ustar yavoryavor Avicap - Howto use shutdown & resume

HOWTO use shutdown & resume with Avicap

back to Avicap Index

docu by: Alexander Rawass (alexannika@users.sourceforge.net)
if anyone can write a better documentation - please do it and tell me

this howto describes how you can shutdown,poweroff,resume & reboot your linux with Avicap, to have a video recording tool with a programmable timer, that allows your computer to be powered-off in-between recordings


Step 1: Check your BIOS

Most modern BIOS have an advanced power management section, which allows you not only to configure sleep/suspend modes, but also on which signals your computer should poweron from 'soft-off'

Goto to the BIOS, to the advanced power management section
Turn on advanced power management on, if you haven't enabled it before, you might want to set most entries to 'disabled'.

For awakening after a soft-off, we need to enable
'RTC Alarm Resume from Soft off'

Below this, you should be able to set the date and the time to wakeup.

If you don't find such entries in your BIOS, well, it won't work for you,sorry.

Step 2: Install nvram-wakeup

http://sourceforge.net/projects/nvram-wakeup

Download the latest version of nvram-wakeup.

nvram-wakeup is a tool to set the RTC alarm time in your Bios - WARNING, this may be dangerous, be careful what you do!

compile nvram-wakeup.

Read the README file. Read it again.

Read the README.mb file. Read it twice again!

Now you can be lucky, then your motherboard/bios will be supported by nvram-wakeup.

If you're unlucky (like me with my Asus K7M motherboard), you'll have to find out the bytes in your nvram that contain the RTC alarm date.

Read the README.mb file again.

Maybe you can use the latest CVS version of nvram-wakeup, else you'll have to run the 'guess' script that's delivered with nvram-wakeup, it's usage is described in README.mb

If you've now followed the steps in README.mb and you now seem to have a working configuration for nvram-wakeup, test it yourself, and be aware that false bytes written in your nvram may you cause to loose your precious bios settings.

All I can say, the guess script worked for me, with a little modification.

To use nvram-wakeup with avicap, you should edit 'nvram-wakeup.h' and set these defines to zero like this:
#define WAKEUP_BEFORE    0
#define NEED_TO_SHTDWN   0
cause these values can be set in Avicap's GUI directly.

Step 3: root scripts for your linux

For the shutdown & resume process to work for Avicap, you'll need to have several shell scripts that will be run via sudo:

avicap-shutdown:  let's avicap shutdown your computer
avicap-setnvram:  sets the RTC alarm date in your BIOS via nvram-wakeup
avicap-boot:    a init script for /etc/init.d that starts your computer either via the normal way, or it starts avicap in timer-mode, and manages the 'twice shutdown' problem.

These scripts can be found in avifile/samples/qtvidcap/scripts
They will not get installed by 'make install', you have to copy them to their locations for yourself, cause they could do damage to your system by shutting down unexpectedly.

avicap-shutdown and avicap-setnvram should be copied to /usr/local/bin

avicap-boot should be copied to /etc/init.d

You also have to create these links:

/etc/init.d/boot.d/S01avicap -> /etc/init.d/avicap-boot
/etc/init.d/rc3.d/S99avicap  -> /etc/init.d/avicap-boot

You HAVE to edit all these scripts manually to suit them to your system - especially avicap-boot is highly customized to my system, my way of booting and my preferences.

You also have to edit with 'visudo' your sudoers file to allow avicap to call avicap-shutdown and avicap-setnvram, something like this:
alex ALL= NOPASSWD: /home/alex/sbin/avicap-shutdown
alex ALL= NOPASSWD: /home/alex/sbin/avicap-setnvram

Be aware that using these scripts and letting avicap shutdown & resume your computer interferes severely with the running of a full blown unix system.

The shutdown & resume capabilites should only be used on a 'single-person' workstation, with no running jobs in background.

I've prepared such scripts for my system, they might suit you or not, if you've got better solutions, send them to me.

My system is a SuSE 8.1-based system, running kernel 2.4.18 with apm enabled (this is necessary to poweroff your ATX power...

I am only booting my system to runlevel 3 (no networking, no graphics).

I login in textmode and then do a 'startx' manually.

The avicap-reboot script will check at the end of runlevel 3, if it should do nothing or  start X and avicap automatically, you have to edit this script to suit it to your system and preferences.

On my system, there's a special problem:

the setting of the RTC and the resume will only work, if the system is resetted, after the RTC alarm date in the nvram has been set.

So the shutdown & resume will have to shutdown TWICE, once to reboot to make a reset, and the other to actually shutdown.

It goes like this:

1. Avicap calls 'sudo avicap-setnvram <timestamp>' to set the RTC
    avicap-setnvram will create a file /etc/avicap/next_recording

2. Avicap calls 'sudo avicap-shutdown' to shutdown & reboot my system
    avicap-shutdown will create a file /etc/avicap/first_shutdown
    then it will make a shutdown -r (reboot) to reboot the system

3. The system reboots, and shortly after booting, 'avicap-boot' is called again (in runlevel S)

4. If the file /etc/avicap/first_shutdown exists, the file gets removed and the system will go down again with halt -p -f (force power off) to poweroff the computer.

5. The computer is now off, till the time you've set for first recording.

6. The RTC alarm will poweron your computer

7. My linux will boot in runlevel 3, at the end of runlevel 3 'avicap-boot' is called.

8. If the file /etc/avicap/next_recording exists, then it is assumed that the re-boot is a 'timed' reboot done by the RTC alarm.

9. avicap-boot will then call 'startx' to start X and KDE (takes a long time...) or Gnome or whatever and then 'avicap -timer'

10. and then avicap should start recording as you liked it

11. until the recording stops and it is time to go down again

Step 4: Configuring Avicap for shutdown & resume

There's a new Tab in the 'Configure'-Dialog named 'Shutdown&Resume'

These options tell avicap when to shutdown:
  • never shut down system
    avicap will never try to shutdown your system
  • shutdown after last tecording
    avicap will shutdown (to poweroff) your system only after the last recording, when there are no pending records
    you don't need nvram-wakeup for this
  • shutdown in-between recordings
    avicap will shutdown (first to reboot, then to poweroff) your system with nvram-wakeup between recordings
  • minimum downtime in min
    the system will only be shut down in-between recordings, when the system would be in power-off longer than this time
    it is probably not sensible to send the system up and down for just 5 minutes downtime
    sensible values could range from 10 to 30 minutes or so
  • boot n mins before recording
    a unix system can take quite a lot of time to boot and to start X/KDE/Gnome on top of it.
    the system will power-on and reboot n mins before the recording should start
    make sure that time is long enough, if you are not using a journaling filesystem, you should be aware that sometimes booting can be quite long
    sensible values could range from 5 to 15 minutes
  • gracetime for shutdown in min
    if avicap decides that a shutdown should be done, it pops up a critical requester, which shows  a countdown for gracetime mins
    press abort in that dialog to abort the shutdown

To use that feature, you also have to enable the 'shutdown' checkbox in the main timertable window.
That checkbox will always be de-activated when you start avicap normally (so you have to check it again).
If you start avicap with 'avicap -timer', avicap will open the timertable window, sets that checkbox and starts the timer and waits for the first recording.

avicap is started with -timer from avicap-boot, so it will go down if the recording has finished.

I advise you strongly to test this feature thoroughly, so that you can be sure it works for you,too.
It would be a shame, if a precious recording is lost - but, alas, Free Software comes without any warranty, so be warned

Known Problems

  • my system is running it's hardware-clock in localtime, so the RTC alarm is also set in localtime, there's code to check if localtime differs from UTC and sets the RTC alarm correctly.
    I believe. Umpft. Test it yourself.
  • I have no idea what happens if your system (hardware) clock runs in UTC.
    test it thoroughly and tell me about it
  • I have no idea what happens if the local time switches an hour to the future or back - for example, when we Europeans switch from winter time (CET) to summer time (CEST) or back
    Your recordings might start at the right time, an hour too late or an hour too early
  • I have no idea what happens when you're flying in an airplane that travels round the world (with or against time), I also don't know what might happen if you fly in a spaceship at 95% light speed, you've been warned, the timer might do really crazy things there ;-)))
  • I am using QDateTime for my calculations, I just hope it's clever enough to cope with leapyears and such
When you've started Avicap from a shell window, it will show it's output there when nvram-wakeup is setting the RTC alarm, you should see for yourself if the RTC is set correctly.





avifile-0.7.48~20090503.ds/doc/avicap/timertable.html0000644000175000017500000001762407643144776021023 0ustar yavoryavor Avicaps Timertable

Avicaps Timertable

back to Avicap Index

docu by: Alexander Rawass (alexannika@users.sourceforge.net)
if anyone can write a better documentation - please do it and tell me

This timertable window implements a programable VCR-like mode into avicap.

In the timertable window, you can edit/control the recordings which avicap will do automatically.

Start the timertable mode

When you start avicap with 'avicap', the timertable window will be inactive.
To use the timertable, you have to click on 'Timertable' in the menu.
After you've started the timertable, it will remain active, even if you close the timertable window.

At first startup, you'll see an empty table at the top of the window, below you'll find buttons labeled 'new', 'modify' and 'remove'

'new' will create a new entry in the timertable and show the editing controls.

Editing Controls

With the editing controls, you can set:
  • When to record (only once or every day/weekday)
  • Date and Time when to start the recording
  • the Time when to end the recording
  • the channel used for recording
  • the filename to save your recording into
  • a description of your recording
If you set the 'when' combobox to 'every', you can select in the 'day' combobox which days (every day or every weekday) - the date is ignored with 'every'

If you select 'once', you have to enter the correct date.

At present, it is not possible to select a different codec for each recording, they all use the codec specified in the avicap configuration.
I hope I can change that in the future.

When you've set the correct parameters, press the 'modify' button to commit it actually in the table at the top.
Be aware that you have to click 'modify' to accept the parameters.

When using 'every', the date you might have entered will be ignored, instead the next correct date is entered in the table.

If you click another table-entry instead, your modifications for the old will be lost.

Press 'remove' if you want to remove an entry.

Enable and disable per checkboxes

You have to activate the checkbox to the left of an entry to enable it for recording.
A disabled checkbox means, that this entry will not be recorded.
This is useful, for daily or weekly recording, etc
If you see that a daily recording clashes with another, you can temporarily disable it for the next day/week, and turn it back on later.

Start the timer

Press 'Start Timer' to start the timer in recording mode.
You cannot start the timer if there are no pending recordings.

If there are pending recordings, the label on the button will show 'Stop Timer'.
Press to stop the timer.
The timer can only be disabled in-between different recordings, but not while a recording is running? <question: is this sane?>

If you have started a recording with 'Capture AVI' from the main menu directly, this recording will be aborted if a recording programmed with the timertable needs to be done.

Sanity Check

Avicap will do 'Sanity Check' on your recordings.

If two recordings conflict with each other, Avicap will display this conflict in the status display.
Avicap will display only the first conflict found - there may be more, be warned!

If Avicap reports a sanity check, better modify the times or disable one of the conflicting recordings.

If you don't correct these insane recording settings, Avicap will stop the first recording brutally to start the second (conflicting) one.

It's your own fault them, if you don't care about the sanity of your recordings ;-)

Shutdown mode

If you activate the 'shutdown' checkbox, your system will go to shutdown after a recording has been done.
This behaviour can be disabled completely by configuring avicap to 'never shut down system' in the general avicap configuration dialog.

Avicap can also shutdown/poweroff your system after a recording and resume/reboot it just before the next recording, implementing a real power-saving VCR like mode, where your computer is off in-between recordings.

Logout with Avicap

If you want to enable this resume/shutdown, you HAVE to 'quit' per Avicaps shutdown routine.
Don't log out of X and shutdown the normal way anymore.
Use this way:

1. Edit the timertable settings for the next recording, and start the timer.
2. As long as you want to work with your computer, leave Avicap in background running.
3. If you want to power-off your computer (maybe because you've got to go to bed after a long programming session, just like me right now ;-)), close all other applications, get Avicap in the foreground, and set the 'shutdown' checkbox.
4. If your recording is more than <boottime>+<gracetime> in the future, Avicap will pop a requester telling you that it will shut down, counting down.
Ignore it.
5. After some time, Avicap will set the nvram and call the shutdown-script
6. Your system will be sent into shutdown
7. It will re-boot again
8. And get's powered down soon after booting
9. and then, some time, the RTC alarm will power-on again and your system will reboot, starting X and avicap in timermode, waiting for your recording

Read here about Avicaps shutdown&resume capabilities.


How I use the timertable along with the shutdown & resume mode

I've programmed my timertable for the next two weeks with all the stuff I wanna see, Avicap will be running on my computer in background while I am working with it, and when I do a power-off I am sure that Avicap will power-on itself when it feels the need to watch TV itself ;-)

It's like sort of an external brain, I don't have to think about TV for the next two weeks, cause Avicap will do that for me if I am awake or asleep :-)))

<Humor>
And if I don't have time to watch the session that Avicap has recorded, why worry?
Avicap has watched it, so why should I watch it again?
I think it is just neccessary that anyone watches TV, and it's probably also a good education for my computer if he can watch TV for himself ;-))))
</Humor>



avifile-0.7.48~20090503.ds/doc/LICENSING0000644000175000017500000000173507241123516015753 0ustar yavoryavor In this document I'll try to cover the legal status of this project. The most obvious problem is the fact that library uses closed-source Win32 DLLs. It can be considered to be 'creating derived work' by including these DLLs into GPL'ed code. In other words, library may seem to be 'linked' with these proprietary binaries. That's actually a fringe case - the strict definition of 'linking' does not exist yet. I prefer to think of the DLLs as 'plug-ins', which are separate from main library and voluntary to use. That's why I distribute binaries and sources in different packages - you do not need binaries to compile library and even to run some test programs. One can someday rewrite DLLs using C/C++ and thus make AVIFile library completely platform independent. The DLLs themself are freeware - you can easily get them from lots of other places. Their licenses typically do not say anything explicitly about this way of using them. I believe there's nothing wrong in it. avifile-0.7.48~20090503.ds/doc/README-DEVEL0000644000175000017500000003025607340511156016233 0ustar yavoryavor --- 1. Overview of library services --- Plugin-based architecture that provides access to audio & video compressors/decompressors for a wide range of formats. Interfaces for reading from AVI & ASF files, with and without implicit decompression. Interfaces for writing to AVI files, with and without implicit compression. Object that provides core of movie player for supported file types. --- 2. Subdirectories --- include/: All header files which may be needed for programmer to use the library. plugins/: Main set of codec plugins. plugins/libwin32/: Win32 DLL loading plugin. plugins/libaudiodec/: Audio decoder plugins for a few formats. plugins/libmpeg_audiodec/: MPEG layer-1..3 audio decoder plugin plugins/libmp3lame_audioenc/: MPEG layer-3 audio encoder plugin plugins/libmp3lamebin_audioenc/:MPEG layer-3 audio encoder plugin loaded at runtime using libmp3lame lib/: Core library. lib/common/: Set of utility functions and implementations of non-pure methods in plugin interfaces. lib/aviread/: Implementation of AVI & ASF readers. lib/aviwrite/: Implementation of AVI writer. lib/aviplay/: Implementation of AVI/ASF player. player/: Movie player. samples/: Various tools & examples of using library. --- 3. Coding style conventions --- All methods of public interfaces are named in MFC style ( one or more concatenated words, each word beginning with CAPITAL letter ); for example, IAviPlayer::SetColorSpace() or CImage::Width(). On the opposite, internal function names start with lowercase letters ( AviPlayer::getVideoAsync() ). Class member variables begin with capital letters and are prefixed with m_ and with appropriate type information: p pointer b bool u unsigned c char s short i 32-bit integer ( int, long ) l 64-bit integer ( long long ) f float d double Code is indented in BSD style with 4-space tabs. Short if() expressions may be written in one line, as in 'if(...) return; '. For imported parts of project ( such as lame mp3 encoder ) original coding style is left untouched. --- 4. Using codecs --- All codec object creation functions are declared in include/creators.h. To avoid possible naming collisions, they were put into namespace Creators. Decoder creation functions take pointer to compressed format description structure ( which is WAVEFORMATEX for audio and BITMAPINFOHEADER for video; both are declared in include/formats.h ). Encoder creators take pointer to structure that describes uncompressed format and so-called FOURCC - which describes desired compression format. All of them look through the list of registered plugins and try to find the codec matching request. They return pointer to initialized object on success and 0 on failure. When codec object is not needed any more, use one of Free* functions from include/creators.h to destroy it. It frees all data structures and decrements usage count of the plugin that provided the codec. Each codec interface includes function GetCodecInfo(). It returns reference to CodecInfo structure with all known information about codec ( such as: is it video or audio codec, does it support both encoding & decoding, etc. ) Many codecs have 'attributes' which affect their performance, quality, etc. These attributes can be enumerated using fields of CodecInfo structure. Attributes should be set before codec object starts operation. They can be read and written with Creators::GetCodecAttr/Creators::SetCodecAttr. Once set, these values will be stored in config file and reused every time codec is initialized. --- 5. Video codecs specifics --- Some video codecs support run-time setting of attributes ( during the encoding or decoding process ). For example, video decoder may suggest the option to do post-processing with different levels of quality independently on each frame, or to adjust brightness of picture. This video decoder will inherit from interface IRtConfig ( declared in include/videodecoder.h ). Do a dynamic_cast on received interface to determine if it's the case. Initial value for run-time attribute will be read from config file. If you want to permanently change it, do two calls - to Creators::SetCodecAttr and to IRtConfig::SetValue with the same attribute name. Video decoders can produce data in any of the following formats: RGB 16-bit ( color weights 555 & 565 ), 24-bit, 32-bit, YUY2 and YV12. User can specify desired format in call to IVideoDecoder::SetDestFmt(). However, internal video decoder logic does not always support all these formats. For these cases library provides a set of conversion functions between all supported formats. It is optimal in terms of efficiency when the decoder itself performs the conversion ( it is especially important for conversions into YUV formats ). For this purpose, video decoders have method GetCapabilities(), which can be used to determine internal capabilities of decoder. Video decoders take a special attribute - 'flip' to the constructing function. 'True' here means that decoder shouldn't flip vertically picture. By default decoder produces flipped picture: it allows to do simple memcpy() to X11 screen. Unfortunately, not all encoders are able to compress 'flipped' video formats, which are indicated by negative value in biHeight field of BITMAPINFOHEADER structure. --- 6. Audio decoders specifics --- Audio decoder objects convert input compressed data into raw PCM ( 16-bit signed low-endian, suitable for feeding to /dev/dsp ). Unlike with video decoders, there's generally no need here to start/stop conversion because it's usually done on per-sample basis and samples are independent from each other. --- 7. Audio encoders specifics --- Area of audio encoding is not well developed. There's only one experimental audio encoder plugin, based on Lame MP3 encoder v. 3.70. --- 8. ASF and AVI reading ( without decompression ) --- Direct ASF, MMS and AVI reading interface is described in include/ReadHandlers.h. Reader object is created with CreateAVIReadHandler() ( for AVI ) and CreateASXReadHandler() ( for ASF family ). CreateAVIReadHandler() is synchronous. It either returns pointer to valid reader object, or throws an exception in one of formats from include/except.h. On the other hand, opening of ASF file may be an asynchronous operation. That is, constructor only performs sanity checking on the file name, starts actual opening process ( in another thread ) and returns successfully. You should periodically call IMediaReadHandler::isOpened() until it returns true, which means that opening process has finished. After that, you can determine if it was successful by calling IMediaReadHandler::isValid(). MMS URL or local ASX file may point to the 'redirector' - XML file that includes copyrights, file information, etc. and other URLs. Call IMediaReadHandler::isRedirector() after isOpened() and isValid() returned true to determine if it's the case. After successful opening of non-redirector file you can read data from its streams through IMediaReadStream* interfaces. You don't need to destroy them manually when they are not needed any more, and multiple requests for the interface to the same stream will return the same pointer. --- 9. ASF and AVI reading with implicit decompression --- This interface is described in include/avifile.h. Reader object is created with CreateIAviReadFile(). This function has the same semantics as object creators from previous section. It tries to open passed URL as a local AVI file, if it fails, as an ASF, and it it fails too, throws an exception. To read the data, use IAviReadStream interface. It acts as a 'wrapper' to IMediaReadStream and I[Video|Audio]Decoder. To start reading uncompressed data, call IAviReadStream::StartStreaming(). It returns 0 on success and negative value if it fails to create decoder object. Audio data should be read using IAviReadStream::ReadFrames() and video data - using IAviReadStream::GetFrame() and IAviReadStream::ReadFrame(). --- 10. AVI writing --- This interface is also described in include/avifile.h. You can either use implicit compression ( by writing into streams returned with IAviWriteFile::AddAudioStream() & IAviWriteFile::AddVideoStream() ) or write directly into file ( IAviWriteFile::AddStream() ). File headers will be updated and written to the disk each 1000 accesses to streams to minimize damage of hardware or software failure. When writing is finished, delete the object; it writes final version of headers, appends an index chunk and closes the file. The library is able to write 'segmented' AVI files. It is a convenient way to work-around 2 Gb file size limit which exists both because of AVI format specification misfeature and because of limitations of most Linux kernels ( >2Gb files are properly supported only in 2.4 series ). When such object is created, you pass the file size limit as an argument to constructor. Each time physical file grows beyond that size, library automatically closes it, changes the name and starts a new one. --- 11. Movie player core --- Movie player core is declared in include/aviplay.h. It suggests two choices. If you want to do all GUI-related work by yourself, use interface IAviPlayer. You'll have to pass to the core a pointer to draw function which will be called when there's a need to draw new frame. Library will do all internal work, such as opening file and ( if needed ) audio device, synchronizing audio with video, etc. You will handle initialization, changing media ( in case of ASF redirectors ), passing events from keyboard/mouse to the library and drawing. The second choice is to allow library to do drawing. Use interface IAviPlayer2 for it. If you want to have video output, establish the connection with X server and pass the connection handle (Display*) to the library through construction function. Library will accept NULL handle, which will mean that there'll be no video output. --- 12. Plugin system --- Important feature of the library is its ability to automatically discover and use plugins with predefined interface to perform compression/decompression of data. Plugins have to be dlopen()'able libtool libraries ( linked with -module flag ) and be installed in predefined directory. By default it's /usr/lib/win32, it can be changed during compilation ( with --with-win32-path configure parameter ) or after installation ith WIN32_PATH environment variable. Each plugin exports several functions, which are defined and described in include/plugin.h. Plugin system is not tightly bound to avifile. One can compile and use its plugins without core library. If you want to write your own plugin that can be used by avifile, take a look at the opendivx plugin sample ( it can be found at http://divx.euro.ru/download.htm ). It is made completely independent of avifile. You will notice that it includes a subset of avifile headers, ~40k total, which describe all necessary types and interfaces. Using these plugins by themselves is also possible. You'll have to do the following: 1) Copy API/ and common/ directories from opendivx plugin into your project. Link your application against code in common/. 2) Search the plugin directory for files with .la extension. Parse them to find line "dlname='...'". Dlopen() corresponding shared library. 3) Make sure that API versions of plugin and your code are the same. 4) Call exported functions of plugin to create codec objects. --- 13. Image conversion speeds ---- Numbers are approximate CPU cycles per pixel and measured on non-MMX processor for 640x480 random image without overflows. Source format is the determined by the row. For typical 600 MHz processor 100 cycles/pixel correspond to 20 frames per second with 640x480 image. Your numbers may differ, depending on processor family, memory speed, etc. Many of these conversions can possibly be optimized ( so far the only MMX-optimized conversion is RGB15->RGB16 ). Without flipping: RGB15 RGB16 RGB24 RGB32 YUY2 YV12 RGB15 10 20 31 67 101 84 RGB16 68 10 31 66 103 83 RGB24 36 35 15 34 68 52 RGB32 63 63 27 20 96 79 YUY2 133 135 113 159 10 19 YV12 133 132 97 132 20 7 With flipping: RGB15 RGB16 RGB24 RGB32 YUY2 YV12 RGB15 10 18 30 76 101 82 RGB16 70 10 30 78 101 84 RGB24 41 40 15 46 68 53 RGB32 72 66 26 19 96 79 YUY2 138 137 98 142 10 18 YV12 135 134 95 140 20 7 Last modified; January 21, 2001avifile-0.7.48~20090503.ds/doc/TODO0000644000175000017500000000241607462231012015176 0ustar yavoryavorrenaming of utils? - NO 4 Gb limit - may work now with 0.6. DONE URL mms://208.184.229.32/rollingstone/383/8615.asf crashes BOTH aviplay AND asfrecorder ??? < uncommon packet format, 0x55 in 4th byte of packet > - DONE Maybe you could add a selector for the frame rate the subtiltles were encoded for the {xxx}{xxx} subtitles. An external converter is easy to make but it will will be simpler and easy to do it in the config panel (even if it needs a restart) Sync in recompress Redrawing recompress window only when mouse moves - WHY ??? re-check subtitle/font stuff verona60? memory & fd leaks in qualtest update binaries with dvsd first call to directshow decoder sometimes fails with 'cannot open dll' mms:// entry in config causes troubles for Qt open file dialog local asf files cannot be recompressed into valid avis - necessary functions aren't implemented global labels in inline asm cause troubles when compiling with optimization playing asf without building table? put solution for not found either in FAQ, configure.in, or both. Problem with color depth detect on Riva 128 ( true color ). Indeo Video 5.0 codec refuses to encode 32-bit data. All programs crash during loading on some platforms. Can be solved on client-side by upgrading libstdc++ library. avifile-0.7.48~20090503.ds/doc/VIDEO-PERFORMANCE0000644000175000017500000000552207311113567017046 0ustar yavoryavor Theoretically, performance of video output should be only limited by bandwidth of CPU <-> Video bus ( for PCI bus it's 133 Mb/s or 5 ms for drawing of 640x480x16 picture ). Unfortunately, this value is rarely achieved. Actual performance is affected by many factors and can vary from 20 to 250 Mb/s. You can determine this value for your system by running 'benchmark' tool. Type: benchmark (try also with options -yuv and -direct) and it'll perform quick measurement of most typical timings. In the end, it'll print video output speed in megabytes per second. If the resulting value for your system is higher than 50 Mb/s, then there's nothing for you to worry about, because your X server has some kind of output acceleration. In case of this performance being worse than 30 Mb/s, you'll probably need to turn on write-combining for video card. This should generally be done by X server, but some servers ( for example, X server for XFree86 3.3.6 with s3_savage driver ) don't do it ( shame on them ). Here I'll describe how it could be done by hands in case of Linux. 1. Your processor should have MTRR registers ( Pentium Pro, Pentium II or maybe some compatible processors ). Your kernel should be compiled with MTRR support: in kernel configuration menu, select 'Processor type and features' ->'MTRR (Memory Type Range Register) support'. 2. Run X and log its output somewhere: startx >./startx.log 2>&1 Look into the log and find a line similar to this: (--) SVGA: PCI: S3 Savage4 rev 2, Memory @ 0xe5000000, 0xd8000000 Here 0xe5000000 and 0xd8000000 are virtual addresses of your video memory. You'll need one of them. 2a. Alternatively, you can look at /proc/pci and find section related to your video card ( "VGA compatible controller" ). Take the first address from the line saying about "prefetchable 32 bit memory". 3. Type as root: echo "base= size=0x800000 type=write-combining" >>/proc/mtrr replacing with address received in step 2 and 0x800000 ( which is equal to 8 Mb ) with size of your video memory. That's it. If you did everything properly, you should notice significant increase in output performance. For me it increased output bandwidth from 20 to 36 Mb/s ( 1.8x ), and I had reports about 3x..4x increase! In case that you chose wrong address from list in step 2, do the following: cat /proc/mtrr Find the line that was added by you. Suppose it starts with "reg02", then type: echo "disable=2" >>/proc/mtrr and repeat step 3 with another address. It is a good idea to put command from step 3 somewhere in startup scripts, because that base address does not change when you restart computer, but do not forget to remove it when changing hardware configuration. You can find details about using /proc/mtrr in Linux kernel sources, file Documentation/mtrr.txt. avifile-0.7.48~20090503.ds/doc/WARNINGS0000644000175000017500000000340607267027005015671 0ustar yavoryavorlib/loader/ext.c:440 User can reserve big chunk of memory by calling VirtualAlloc with flag RESERVE and later calls to VirtualAlloc specifying parts of this region are guaranteed to succeed. This doesn't perfectly fit into mmap() implementation of VirtualAlloc. Current implementation loses memory allocated this way. lib/loader/externals.c:699 MultiByteToWideChar Win32 call is unsupported. lib/loader/externals.c:289 bManualReset flag for CreateEventA Win32 call is unsupported. lib/loader/externals.c:341 WaitForSingleObject Win32 call may be implemented incorrectly. lib/videocodec/VideoDecoder.cpp:27 It is not known exactly which FOURCC's should be decoded by 'old' MPEG-4 dll. lib/loader/externals.c:727 Win32 semaphores are supported incorrectly. Do not try to use VideoDecoder objects in different threads simultaneously. lib/aviplay/audio.cpp:206 I don't know how to determine delay between write() and actual sound output for ESD 0.2.8 ( 0.2.15 does not work for me ). lib/avifile/AviRead.cpp:128 No AVI frame flags other than KEYFRAME are supported because of limited VirtualDub read handler structure. lib/avifile/AviRead.cpp:263 AviReadStream::SetOutputFormat() is not implemented. lib/avifile/AviWrite.cpp:83 AVI writer copies some values in main AVI header from corresponding fiels in 1st video stream header. I don't know what should I put there if there are no video streams at all. lib/audiodecoder/adpcm/adpcm.cpp:23 IMA ADPCM audio decoder was only tested with one stereo file. lib/avifile/AVIReadHandler2.cpp:382 AviReadHandler2::Header() is not implemented. AviReadFile::GetFileHeader() won't work for files opened with this handler. lib/avifile/AVIReadHandler2.cpp:1075 VirtualDub warned user about broken file here. What should I do? avifile-0.7.48~20090503.ds/doc/avibench.10000644000175000017500000000044307622527454016365 0ustar yavoryavor.TH "avibench" "1" "12 February 2003" "Zdenek Kabelac" "" .SH "NAME" avibench \- benchmarking tool .SH "SYNOPSIS" .B avibench .RI [options]\ [ \ files\ | \ URLs\ ] .SH "DESCRIPTION" .B avibench .SH "OPTIONS" \fB\-h \-\-help\fR Show help message .TP .BR .SH "SEE ALSO" \fBaviplay(1)\fR avifile-0.7.48~20090503.ds/doc/avicap.10000644000175000017500000000111007643144775016045 0ustar yavoryavor.TH "avicap" "1" "12 February 2003" "Zdenek Kabelac" "" .SH "NAME" avicap \- v4l capturing and PVR tool .SH "SYNOPSIS" .B avicap .RI [options]\ [ \ files\ | \ URLs\ ] .SH "DESCRIPTION" .B avicap avicap is a video4linux capturing and PVR tool. avicap can shutdown/poweroff and poweron/reboot your computer again look here for a full end user documentation on Avicap, its timertable/PVR mode and it's shutdown options: http://avifile.sourceforge.net/ .SH "OPTIONS" \fB\-timer\fR start in automatic timer (PVR) mode .TP .BR .SH "SEE ALSO" \fBaviplay(1)\fR \fBkv4lsetup(1)\fR avifile-0.7.48~20090503.ds/doc/avicat.10000644000175000017500000000045710647356425016061 0ustar yavoryavor.TH "avicat" "1" "12 February 2003" "Zdenek Kabelac" "" .SH "NAME" avicat \- cat tool for joining files .SH "SYNOPSIS" .B avicat .RI [options]\ [ \ files\ | \ URLs\ ] .SH "DESCRIPTION" .B avicat DO NOT USE! .SH "OPTIONS" \fB\-h \-\-help\fR Show help message .TP .BR .SH "SEE ALSO" \fBaviplay(1)\fR avifile-0.7.48~20090503.ds/doc/avifile-config.10000644000175000017500000000364111110407404017446 0ustar yavoryavor.TH "avifile" "1" "12 February 2003" "Version" "0.7" .SH "NAME" avifile\-config \- script to get information about the installed version of avifile .SH "SYNOPSIS" .B avifile\-config [\-\-prefix\fI[=DIR]\fP] [\-\-exec\-prefix\fI[=DIR]\fP] [\-\-version] [\-\-libs] [\-\-cflags] .SH "DESCRIPTION" .PP \fIavifile\-config\fP is a tool that is used to configure to determine the compiler and linker flags that should be used to compile and link programs that use \fIavifile\fP. It is also used internally to the .m4 macros for GNU autoconf that are included with \fIavifile\fP. . .SH "OPTIONS" .B \-\-version Print the currently installed version of \fIavifile\fP on the standard output. .TP 8 .B \-\-libs Print the linker flags that are necessary to link a \fIavifile\fP program. .TP 8 .B \-\-cflags Print the compiler flags that are necessary to compile a \fIavifile\fP program. .TP 8 .B \-\-prefix=PREFIX If specified, use PREFIX instead of the installation prefix that \fIavifile\fP was built with when computing the output for the \-\-cflags and \-\-libs options. This option is also used for the exec prefix if \-\-exec\-prefix was not specified. This option must be specified before any \-\-libs or \-\-cflags options. .TP 8 .B \-\-exec\-prefix=PREFIX If specified, use PREFIX instead of the installation exec prefix that \fIavifile\fP was built with when computing the output for the \-\-cflags and \-\-libs options. This option must be specified before any \-\-libs or \-\-cflags options. .TP 8 .B \-\-data-dir Print the data dir used for \fIavifile\fP program. .SH "SEE ALSO" .BR aviplay (1) .SH "COPYRIGHT" Copyright \(co 1998 Zdenek Kabelac Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. avifile-0.7.48~20090503.ds/doc/avimake.10000644000175000017500000000043107622527457016223 0ustar yavoryavor.TH "avimake" "1" "12 February 2003" "Zdenek Kabelac" "" .SH "NAME" avimake \- making tool .SH "SYNOPSIS" .B avimake .RI [options]\ [ \ files\ | \ URLs\ ] .SH "DESCRIPTION" .B avimake .SH "OPTIONS" \fB\-h \-\-help\fR Show help message .TP .BR .SH "SEE ALSO" \fBaviplay(1)\fR avifile-0.7.48~20090503.ds/doc/aviplay.10000644000175000017500000000720111170321766016241 0ustar yavoryavor.TH "aviplay" "1" "12 February 2003" "Zdenek Kabelac" "" .SH "NAME" aviplay \- QT\-based movie player .SH "SYNOPSIS" .B aviplay .RI [options]\ [ \ files\ | \ URLs\ ] .SH "DESCRIPTION" .B aviplay is a QT\-based player for various avi, asf, mpeg4 movie files. Avifile project creates library that allows programs to read and write compressed AVI/ASF files (Indeo Video, DivX :\-), etc.) under Unix OS. (De)compression is performed with various plugins (included Win32 DLLs for x86_32 OS) if native codec is not available. Win32 libraries have to be downloaded separately. Primarily the ffmpeg project is used for codecs and also for stream parsing. Over the time it's possible the project will mostly blend into ffmpeg. .SH "FEATURES" .TP * low CPU usage (movies playable even P200MMX) .TP * smooth video (using threads and frame precaching) .TP * supports streamed .asf files .TP * audio resampling suppport .TP * modular design .BR .SH "OPTIONS" \fB\-h \-\-help\fR Show help message .TP \fB\-c \-\-codec\fR [help] Set codec options (use help to see options for this parameter) .TP \fB\-s \-\-size\fR <\fIwidth\fR:\fIheight\fR> Start playing movie at dimensions X * Y. .TP \fB\-f \-\-fullscreen\fR Start playing movie in fullscreen. .TP \fB\-f \-\-maximize\fR Start playing movie in maximized mode (i.e. preserve current resolution). .TP \fB\-\-seek\fR <\fIposition\fR> Seek to given position in movie. .TP \fB\-sub \-\-subtitle\fR <\fIfilename\fR> Use give file as the source for subtitles. .TP \fB\-subcp \-\-subtitle_codepage\fR <\fIcodepage\fR> Select codepage for subtitles. They are internaly encoded into UTF\-8. See iconv(3) for available codepages. Codepage "default" means current default encoding in system. Example of codepages: CP1250, ISO8859\-2, default. .TP \fB\-subfont \-\-subtitle_font\fR <\fIfontname\fR> Select font for subtitles. At this moment only X11 fonts are supported (either in traditional "\-misc\-*" or TTF notation) .TP \fB\-ac \-\-audio\-codec\fR <\fIcodecname\fR> Prefered codec to be used for movie audio decoding. Use with "help" to see available audio codecs. .TP \fB\-vc \-\-video\-codec\fR <\fIcodecname\fR> Prefered codec to be used for movie video decoding. Use with "help" to see available video codecs. .TP \fB\-\-rc\fR Enables remote control (stdin|stdout). .TP .BR .SH "SHELL variables:" .B WIN32_PATH \- can be used to override library path /usr/lib/win32 which holds MS Windows binary dll codecs. .B AVIPLUGIN_PATH \- can be used to override library path /usr/lib/avifile which holds avifile plugins. .B AVIPLAY_MUTE_AUDIO \- if set shows just video track .B AVIPLAY_MUTE_VIDEO \- if set plays just audio track .B AVIPLAY_NOSYNC \- do not synchronize audio and video track .B HTTP_PROXY .B WRITE_ASF \- write asf file received over the network to file (/tmp/*.asf) .SH "NOTE" Press the About button in aviplay's GUI for more details about the usage and configuation. Aviplay automaticaly searches for subtitle file with the same name as the original ".avi" file but with .sub, .SUB, .srt, .SRT, .txt, .TXT, .smi, .SMI suffix. For Debian users: After the discussion with the autor I have came to the conclusion that GSM codec is legaly distributed under GPL terms since this piece of code was donated to the project by the original author which was using it in the non\-GPL project xanim. .SH "SEE ALSO" http://avifile.sourceforge.net for the original source and main CVS archive for binary codecs. http://mplayerhq.hu for mplayer \- an excelent player with more options and supported formats .SH "AUTHORS" .TP Original author: Eugene Kuznetsov .TP Current developer: Zdenek Kabelac avifile-0.7.48~20090503.ds/doc/avirec.10000644000175000017500000000043607622527460016056 0ustar yavoryavor.TH "avirec" "1" "12 February 2003" "Zdenek Kabelac" "" .SH "NAME" avirec \- video recording tool .SH "SYNOPSIS" .B avirec .RI [options]\ [ \ files\ | \ URLs\ ] .SH "DESCRIPTION" .B avirec .SH "OPTIONS" \fB\-h \-\-help\fR Show help message .TP .BR .SH "SEE ALSO" \fBaviplay(1)\fR avifile-0.7.48~20090503.ds/doc/avirecompress.10000644000175000017500000000047607622527460017473 0ustar yavoryavor.TH "avirecompress" "1" "12 February 2003" "Zdenek Kabelac" "" .SH "NAME" avirecompress \- video recompression tool .SH "SYNOPSIS" .B avirecompress .RI [options]\ [ \ files\ | \ URLs\ ] .SH "DESCRIPTION" .B avirecompress .SH "OPTIONS" \fB\-h \-\-help\fR Show help message .TP .BR .SH "SEE ALSO" \fBaviplay(1)\fR avifile-0.7.48~20090503.ds/doc/avitype.10000644000175000017500000000043507622527461016266 0ustar yavoryavor.TH "avitype" "1" "12 February 2003" "Zdenek Kabelac" "" .SH "NAME" avitype \- show video info .SH "SYNOPSIS" .B avitype .RI [options]\ [ \ files\ | \ URLs\ ] .SH "DESCRIPTION" .B avitype .SH "OPTIONS" \fB\-h \-\-help\fR Show help message .TP .BR .SH "SEE ALSO" \fBaviplay(1)\fR avifile-0.7.48~20090503.ds/doc/kv4lsetup.10000644000175000017500000000133607643144775016555 0ustar yavoryavor.TH "k4vlsetup" "1" "12 February 2003" "Zdenek Kabelac" "" .SH "NAME" k4vlsetup \- setup grabbing card .SH "SYNOPSIS" .B k4vlsetup .RI [options] .SH "DESCRIPTION" .B k4vlsetup kv4lsetup must either be called as root or run setuid root if kv4lsetup doesn't run as root, it cannot set the address of the framebuffer correctly, so avicap will crash - it might even crash your computer kv4lsetup will be started automatically by avicap .SH "OPTIONS" \fB\-h \-\-help\fR Show help message .TP \fB\-t= \-\-verbose=\fR be verbose use 0 for no verbosity, 1 for normal and 2 for more verboseness .TP \fB\-l \-\-device \fR sets your v4l device (usually /dev/video) .TP .BR .SH "SEE ALSO" \fBavicap(1)\fR avifile-0.7.48~20090503.ds/drivers/0000755000175000017500000000000011267646347015437 5ustar yavoryavoravifile-0.7.48~20090503.ds/drivers/libdha/0000755000175000017500000000000011267646347016662 5ustar yavoryavoravifile-0.7.48~20090503.ds/drivers/libdha/bin/0000755000175000017500000000000011267637123017422 5ustar yavoryavoravifile-0.7.48~20090503.ds/drivers/libdha/bin/mapdev.vxd0000644000175000017500000001322407532424711021420 0ustar yavoryavorMZÿÿ¸@€º´ Í!¸LÍ!This program cannot be run in DOS mode. $LE€\GPÄô $[[\#ؼ|E LCOD\ ICODMAPDEV--7ØT­'P0² »ÅÏ'HQMAPDEV €verPU¸‹ìƒ|$#uÿuè‹å]ÃU‹D$‹ìVW‹H …ÉtPù"tù "t7ƒùÿt;¸ë6‹@3ÿW‹0ÿvÿvèVƒÄ ‰F ;Çuf‰~ëfÇFë ‹@fÇ@3À_^]ÃU‹ìVW3ÿWj8è0‹ð…ötn‹="t = "t Received: from melita.melita.com by max4.rrze.uni-erlangen.de; Mon, 23 Jun 1997 21:48:16 +0200 Received: from mailgate.melita.com ([192.68.22.8]) by melita.melita.com (8.6.12/8.6.9) with SMTP id QAA29292 for ; Mon, 23 Jun 1997 16:17:55 -0400 Received: by mailgate.melita.com with Microsoft Mail id <33AEFD34@mailgate.melita.com>; Mon, 23 Jun 97 15:48:20 PDT From: Karen Hazzah To: "'Stefan.Dirsch@stud.uni-erlangen.de'" Subject: Your post to vxd newsgroup Date: Sun, 22 Jun 97 20:51:00 PDT Message-ID: <33AEFD34@mailgate.melita.com> Encoding: 22 TEXT X-Mailer: Microsoft Mail V3.0 I posted an answer to your question in the newsgroup. I also have additional information for you. I can email you the binary for VxD which does exactly what you need: given a physical address, returns a pointer that can be used by a Win32 application. I'll also give you source for a Win32 app which uses the VxD to read an area of physical memory. I don't offer this solution to everyone, since in most cases the proper solution is for them to write a VxD which interacts with their hardware, rather than simply getting a pointer to the hardware and interacting with it from an application. However, in your case, you're just using a VxD as a tool to get your Linux driver working...you shouldn't have to write a VxD for this :-) Let me know if you're interested. =============================================================================== Hello Karen A long time ago, you sent me your VXD for reading an area of physical memory under Win32, so I could make register dumps of the graphic chip. Did I ever mention, that it works perfectly for me? Why I contact you is, that I really would like to offer this solution to all XFree86 members, so that it will be much easier in the future for XFree86 to develop drivers for graphic boards. Can I count with your agreement? Would you like to add a special copyright to your software? Stefan =============================================================================== From KHazzah@melita.com Wed Mar 4 00:00:28 1998 Return-Path: Received: from melita.melita.com (melita.com [192.68.22.2]) by Galois.suse.de (8.8.8/8.8.8) with SMTP id AAA03709 for ; Wed, 4 Mar 1998 00:00:26 +0100 Received: from norcross.melita.com (norcross.melita.com [192.68.22.10]) by melita.melita.com (8.6.12/8.6.9) with ESMTP id TAA31217 for ; Tue, 3 Mar 1998 19:48:10 -0500 Received: by zippy.melita.com with Internet Mail Service (5.5.1960.3) id ; Tue, 3 Mar 1998 18:00:26 -0500 Message-ID: From: "Hazzah, Karen" To: Stefan Dirsch Subject: RE: VXD binary for Win32 for reading an area of physical memory Date: Tue, 3 Mar 1998 18:00:25 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.1960.3) Content-Type: text/plain Status: ROr OK, you have my permission to make it publicly available, as is. If you make it available on the web (ftp, etc.), please give me the URL so I can refer others to it. avifile-0.7.48~20090503.ds/drivers/libdha/oth/0000755000175000017500000000000011267637131017443 5ustar yavoryavoravifile-0.7.48~20090503.ds/drivers/libdha/oth/pci.db0000644000175000017500000100255507622470372020537 0ustar yavoryavorv 0000 Gammagraphx, Inc. 0 v 001a Ascend Communications, Inc. 0 v 0033 Paradyne corp. 0 v 003d Lockheed Martin-Marietta Corp 0 v 0070 Hauppauge computer works Inc. 0 v 0100 Ncipher Corp Ltd 0 v 0675 Dynalink 0 d 06751700 IS64PH ISDN Adapter 0 d 06751702 IS64PH ISDN Adapter 0 v 0925 VIA Technologies, Inc. (Wrong ID) 0 Wrong ID used in subsystem ID of VIA USB controllers. v 09c1 Arris 0 d 09c10704 CM 200E Cable Modem 0 v 0a89 BREA Technologies Inc 0 v 0e11 Compaq Computer Corporation 0 d 0e110001 PCI to EISA Bridge 0 d 0e110002 PCI to ISA Bridge 0 d 0e110049 NC7132 Gigabit Upgrade Module 0 d 0e11004a NC6136 Gigabit Server Adapter 0 d 0e110508 Netelligent 4/16 Token Ring 0 d 0e111000 Triflex/Pentium Bridge, Model 1000 0 d 0e112000 Triflex/Pentium Bridge, Model 2000 0 d 0e113032 QVision 1280/p 0 d 0e113033 QVision 1280/p 0 d 0e113034 QVision 1280/p 0 d 0e114000 4000 [Triflex] 0 d 0e116010 HotPlug PCI Bridge 6010 0 d 0e117020 USB Controller 0 d 0e11a0ec Fibre Channel Host Controller 0 d 0e11a0f0 Advanced System Management Controller 0 d 0e11a0f3 Triflex PCI to ISA Bridge 0 d 0e11a0f7 PCI Hotplug Controller 0 s 0e11a0f78086002a PCI Hotplug Controller A 0 s 0e11a0f78086002b PCI Hotplug Controller B 0 d 0e11a0f8 ZFMicro Chipset USB 0 d 0e11a0fc Fibre Channel Host Controller 0 d 0e11ae10 Smart-2/P RAID Controller 0 s 0e11ae100e114030 Smart-2/P Array Controller 0 s 0e11ae100e114031 Smart-2SL Array Controller 0 s 0e11ae100e114032 Smart Array Controller 0 s 0e11ae100e114033 Smart 3100ES Array Controller 0 d 0e11ae29 MIS-L 0 d 0e11ae2a MPC 0 d 0e11ae2b MIS-E 0 d 0e11ae31 System Management Controller 0 d 0e11ae32 Netelligent 10/100 0 d 0e11ae33 Triflex Dual EIDE Controller 0 d 0e11ae34 Netelligent 10 0 d 0e11ae35 Integrated NetFlex-3/P 0 d 0e11ae40 Netelligent 10/100 Dual 0 d 0e11ae43 ProLiant Integrated Netelligent 10/100 0 d 0e11ae69 CETUS-L 0 d 0e11ae6c Northstar 0 d 0e11ae6d NorthStar CPU to PCI Bridge 0 d 0e11b011 Integrated Netelligent 10/100 0 d 0e11b012 Netelligent 10 T/2 0 d 0e11b01e NC3120 Fast Ethernet NIC 0 d 0e11b01f NC3122 Fast Ethernet NIC 0 d 0e11b02f NC1120 Ethernet NIC 0 d 0e11b030 Netelligent WS 5100 0 d 0e11b04a 10/100 TX PCI Intel WOL UTP Controller 0 d 0e11b060 Smart Array 5300 Controller 0 d 0e11b0c6 NC3161 Fast Ethernet NIC 0 d 0e11b0c7 NC3160 Fast Ethernet NIC 0 d 0e11b0d7 NC3121 Fast Ethernet NIC 0 d 0e11b0dd NC3131 Fast Ethernet NIC 0 d 0e11b0de NC3132 Fast Ethernet Module 0 d 0e11b0df NC6132 Gigabit Module 0 d 0e11b0e0 NC6133 Gigabit Module 0 d 0e11b0e1 NC3133 Fast Ethernet Module 0 d 0e11b123 NC6134 Gigabit NIC 0 d 0e11b134 NC3163 Fast Ethernet NIC 0 d 0e11b13c NC3162 Fast Ethernet NIC 0 d 0e11b144 NC3123 Fast Ethernet NIC 0 d 0e11b163 NC3134 Fast Ethernet NIC 0 d 0e11b164 NC3165 Fast Ethernet Upgrade Module 0 d 0e11b178 Smart Array 5i/532 0 d 0e11b1a4 NC7131 Gigabit Server Adapter 0 d 0e11f130 NetFlex-3/P ThunderLAN 1.0 0 d 0e11f150 NetFlex-3/P ThunderLAN 2.3 0 v 0e55 HaSoTec GmbH 0 v 1000 LSI Logic / Symbios Logic 0 Formerly NCR d 10000001 53c810 0 s 1000000110001000 8100S 0 d 10000002 53c820 0 d 10000003 53c825 0 d 10000004 53c815 0 d 10000005 53c810AP 0 d 10000006 53c860 0 d 1000000a 53c1510 0 d 1000000b 53c896 0 d 1000000c 53c895 0 s 1000000c1de13907 DC-390U2W 0 d 1000000d 53c885 0 d 1000000f 53c875 0 s 1000000f0e117004 Embedded Ultra Wide SCSI Controller 0 s 1000000f10928760 FirePort 40 Dual SCSI Controller 0 s 1000000f1de13904 DC390F Ultra Wide SCSI Controller 0 d 10000010 53c895 0 s 100000100e114040 Integrated Array Controller 0 s 100000100e114048 Integrated Array Controller 0 d 10000012 53c895a 0 d 10000013 53c875a 0 d 10000020 53c1010 Ultra3 SCSI Adapter 0 s 100000201de11020 DC-390U3W 0 d 10000021 53c1010 66MHz Ultra3 SCSI Adapter 0 d 10000030 53c1030 0 s 1000003010281010 LSI U320 SCSI Controller 0 d 10000040 53c1035 0 d 1000008f 53c875J 0 s 1000008f10928000 FirePort 40 SCSI Controller 0 s 1000008f10928760 FirePort 40 Dual SCSI Host Adapter 0 d 10000621 FC909 0 d 10000622 FC929 0 d 10000623 FC929 LAN 0 d 10000624 FC919 0 d 10000625 FC919 LAN 0 d 10000626 FC929X 0 d 10000627 FC929X LAN 0 d 10000628 FC919X 0 d 10000629 FC919X LAN 0 d 10000701 83C885 NT50 DigitalScape Fast Ethernet 0 d 10000702 Yellowfin G-NIC gigabit ethernet 0 s 1000070213180000 PEI100X 0 d 10000901 61C102 0 d 10001000 63C815 0 d 10001960 PowerEdge Expandable RAID Controller 4 0 s 1000196010280518 PowerEdge Expandable RAID Controller 4/DC 0 s 1000196010280520 PowerEdge Expandable RAID Controller 4/SC 0 s 1000196010280531 PowerEdge Expandable RAID Controller 4/QC 0 v 1001 Kolter Electronic 0 d 10010010 PCI 1616 Measurement card with 32 digital I/O lines 0 d 10010011 OPTO-PCI Opto-Isolated digital I/O board 0 d 10010012 PCI-AD/DA Analogue I/O board 0 d 10010013 PCI-OPTO-RELAIS Digital I/O board with relay outputs 0 d 10010014 PCI-Counter/Timer Counter Timer board 0 d 10010015 PCI-DAC416 Analogue output board 0 d 10010016 PCI-MFB Analogue I/O board 0 d 10010017 PROTO-3 PCI Prototyping board 0 d 10019100 INI-9100/9100W SCSI Host 0 v 1002 ATI Technologies Inc 0 d 10024158 68800AX [Mach32] 0 d 10024242 Radeon R200 BB [Radeon All in Wonder 8500DV] 0 s 10024242100202aa Radeon 8500 AIW DV Edition 0 d 10024336 Radeon Mobility U1 0 d 10024354 215CT [Mach64 CT] 0 d 10024358 210888CX [Mach64 CX] 0 d 10024554 210888ET [Mach64 ET] 0 d 10024654 Mach64 VT 0 d 10024742 3D Rage Pro AGP 1X/2X 0 s 1002474210020040 Rage Pro Turbo AGP 2X 0 s 1002474210020044 Rage Pro Turbo AGP 2X 0 s 1002474210020061 Rage Pro AIW AGP 2X 0 s 1002474210020062 Rage Pro AIW AGP 2X 0 s 1002474210020063 Rage Pro AIW AGP 2X 0 s 1002474210020080 Rage Pro Turbo AGP 2X 0 s 1002474210020084 Rage Pro Turbo AGP 2X 0 s 1002474210024742 Rage Pro Turbo AGP 2X 0 s 1002474210028001 Rage Pro Turbo AGP 2X 0 s 1002474210280082 Rage Pro Turbo AGP 2X 0 s 1002474210284082 Optiplex GX1 Onboard Display Adapter 0 s 1002474210288082 Rage Pro Turbo AGP 2X 0 s 100247421028c082 Rage Pro Turbo AGP 2X 0 s 1002474280864152 Xpert 98D AGP 2X 0 s 100247428086464a Rage Pro Turbo AGP 2X 0 d 10024744 3D Rage Pro AGP 1X 0 s 1002474410024744 Rage Pro Turbo AGP 0 d 10024747 3D Rage Pro 0 d 10024749 3D Rage Pro 0 s 1002474910020061 Rage Pro AIW 0 s 1002474910020062 Rage Pro AIW 0 d 1002474c Rage XC 0 d 1002474d Rage XL AGP 2X 0 s 1002474d10020004 Xpert 98 RXL AGP 2X 0 s 1002474d10020008 Xpert 98 RXL AGP 2X 0 s 1002474d10020080 Rage XL AGP 2X 0 s 1002474d10020084 Xpert 98 AGP 2X 0 s 1002474d1002474d Rage XL AGP 0 s 1002474d1033806a Rage XL AGP 0 d 1002474e Rage XC AGP 0 s 1002474e1002474e Rage XC AGP 0 d 1002474f Rage XL 0 s 1002474f10020008 Rage XL 0 s 1002474f1002474f Rage XL 0 d 10024750 3D Rage Pro 215GP 0 s 1002475010020040 Rage Pro Turbo 0 s 1002475010020044 Rage Pro Turbo 0 s 1002475010020080 Rage Pro Turbo 0 s 1002475010020084 Rage Pro Turbo 0 s 1002475010024750 Rage Pro Turbo 0 d 10024751 3D Rage Pro 215GQ 0 d 10024752 Rage XL 0 s 1002475210020008 Rage XL 0 s 1002475210024752 Rage XL 0 s 10024752102800d1 PowerEdge 2550 1 d 10024753 Rage XC 0 s 1002475310024753 Rage XC 0 d 10024754 3D Rage I/II 215GT [Mach64 GT] 0 d 10024755 3D Rage II+ 215GTB [Mach64 GTB] 0 d 10024756 3D Rage IIC 215IIC [Mach64 GT IIC] 0 s 1002475610024756 Rage IIC 0 d 10024757 3D Rage IIC AGP 0 s 1002475710024757 Rage IIC AGP 0 s 1002475710280089 Rage 3D IIC 0 s 1002475710284082 Rage 3D IIC 0 s 1002475710288082 Rage 3D IIC 0 s 100247571028c082 Rage 3D IIC 0 d 10024758 210888GX [Mach64 GX] 0 d 10024759 3D Rage IIC 0 d 1002475a 3D Rage IIC AGP 0 s 1002475a10020087 Rage 3D IIC 0 s 1002475a1002475a Rage IIC AGP 0 d 10024964 Radeon R250 Id [Radeon 9000] 0 d 10024965 Radeon R250 Ie [Radeon 9000] 0 d 10024966 Radeon R250 If [Radeon 9000] 0 s 1002496610f10002 R250 If [Tachyon G9000 PRO] 1 ATI supplied info - http://mirror.ati.com/support/identify/graphicschart.html s 10024966148c2039 R250 If [Radeon 9000 Pro "Evil Commando"] 1 ATI supplied info - http://mirror.ati.com/support/identify/graphicschart.html s 1002496615099a00 R250 If [Radeon 9000 "AT009"] 1 ATI supplied info - http://mirror.ati.com/support/identify/graphicschart.html s 10024966174b7176 R250 If [Sapphire Radeon 9000 Pro] 1 ATI supplied info - http://mirror.ati.com/support/identify/graphicschart.html s 10024966174b7192 Radeon R250 If [Radeon 9000 "Atlantis"] 1 New "Powered by ATI" card - Manufactured by: Sapphire (www.sapphiretech.com) s 10024966174b7192 R250 If [Radeon 9000 "Atlantis"] 1 Update - tidied up entry above submitted by someone else s 1002496617af2005 R250 If [Excalibur Radeon 9000 Pro] 1 ATI supplied info - http://mirror.ati.com/support/identify/graphicschart.html s 1002496617af2006 R250 If [Excalibur Radeon 9000] 1 ATI supplied info - http://mirror.ati.com/support/identify/graphicschart.html d 10024967 Radeon R250 Ig [Radeon 9000] 0 d 1002496e Radeon R250 [Radeon 9000] (Secondary) 1 d 10024c42 3D Rage LT Pro AGP-133 0 s 10024c420e11b0e8 Rage 3D LT Pro 0 s 10024c420e11b10e 3D Rage LT Pro (Compaq Armada 1750) 0 s 10024c4210020040 Rage LT Pro AGP 2X 0 s 10024c4210020044 Rage LT Pro AGP 2X 0 s 10024c4210024c42 Rage LT Pro AGP 2X 0 s 10024c4210028001 Rage LT Pro AGP 2X 0 s 10024c4210280085 Rage 3D LT Pro 0 d 10024c44 3D Rage LT Pro AGP-66 0 d 10024c45 Rage Mobility M3 AGP 0 d 10024c46 Rage Mobility M3 AGP 2x 0 d 10024c47 3D Rage LT-G 215LG 0 d 10024c49 3D Rage LT Pro 0 s 10024c4910020004 Rage LT Pro 0 s 10024c4910020040 Rage LT Pro 0 s 10024c4910020044 Rage LT Pro 0 s 10024c4910024c49 Rage LT Pro 0 d 10024c4d Rage Mobility P/M AGP 2x 0 s 10024c4d10020084 Xpert 98 AGP 2X (Mobility) 0 s 10024c4d10140154 ThinkPad A20m 1 d 10024c4e Rage Mobility L AGP 2x 0 d 10024c50 3D Rage LT Pro 0 s 10024c5010024c50 Rage LT Pro 0 d 10024c51 3D Rage LT Pro 0 d 10024c52 Rage Mobility P/M 0 d 10024c53 Rage Mobility L 0 d 10024c54 264LT [Mach64 LT] 0 d 10024c57 Radeon Mobility M7 LW [Radeon Mobility 7500] 0 s 10024c5710140517 ThinkPad T30 1 s 10024c57102800e6 Radeon Mobility M7 LW (Dell Inspiron 8100) 0 d 10024c58 Radeon Mobility M7 LX [Radeon Mobility FireGL 7800] 0 d 10024c59 Radeon Mobility M6 LY 0 s 10024c5910140235 ThinkPad A30p (2653-64G) 0 s 10024c5910140239 ThinkPad X22/X23/X24 0 s 10024c59104d80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP 0 d 10024c5a Radeon Mobility M6 LZ 0 d 10024c64 Radeon R250 Ld [Radeon Mobility 9000] 0 d 10024c65 Radeon R250 Le [Radeon Mobility 9000] 0 d 10024c66 Radeon R250 Lf [Radeon Mobility 9000] 0 d 10024c67 Radeon R250 Lg [Radeon Mobility 9000] 0 d 10024d46 Rage Mobility M4 AGP 0 d 10024d4c Rage Mobility M4 AGP 0 d 10024e44 Radeon R300 ND [Radeon 9700] 0 d 10024e45 Radeon R300 NE [Radeon 9700] 0 d 10024e46 Radeon R300 NF [Radeon 9700] 0 d 10024e47 Radeon R300 NG [Radeon 9700] 0 d 10024e64 Radeon R300 [Radeon 9700] (Secondary) 1 d 10025041 Rage 128 PA/PRO 0 d 10025042 Rage 128 PB/PRO AGP 2x 0 d 10025043 Rage 128 PC/PRO AGP 4x 0 d 10025044 Rage 128 PD/PRO TMDS 0 s 1002504410020028 Rage 128 AIW 0 s 1002504410020029 Rage 128 AIW 0 d 10025045 Rage 128 PE/PRO AGP 2x TMDS 0 d 10025046 Rage 128 PF/PRO AGP 4x TMDS 0 s 1002504610020004 Rage Fury Pro 0 s 1002504610020008 Rage Fury Pro/Xpert 2000 Pro 0 s 1002504610020014 Rage Fury Pro 0 s 1002504610020018 Rage Fury Pro/Xpert 2000 Pro 0 s 1002504610020028 Rage 128 Pro AIW AGP 0 s 100250461002002a Rage 128 Pro AIW AGP 0 s 1002504610020048 Rage Fury Pro 0 s 1002504610022000 Rage Fury MAXX AGP 4x (TMDS) (VGA device) 0 s 1002504610022001 Rage Fury MAXX AGP 4x (TMDS) (Extra device?!) 0 d 10025047 Rage 128 PG/PRO 0 d 10025048 Rage 128 PH/PRO AGP 2x 0 d 10025049 Rage 128 PI/PRO AGP 4x 0 d 1002504a Rage 128 PJ/PRO TMDS 0 d 1002504b Rage 128 PK/PRO AGP 2x TMDS 0 d 1002504c Rage 128 PL/PRO AGP 4x TMDS 0 d 1002504d Rage 128 PM/PRO 0 d 1002504e Rage 128 PN/PRO AGP 2x 0 d 1002504f Rage 128 PO/PRO AGP 4x 0 d 10025050 Rage 128 PP/PRO TMDS [Xpert 128] 0 s 1002505010020008 Xpert 128 0 d 10025051 Rage 128 PQ/PRO AGP 2x TMDS 0 d 10025052 Rage 128 PR/PRO AGP 4x TMDS 0 d 10025053 Rage 128 PS/PRO 0 d 10025054 Rage 128 PT/PRO AGP 2x 0 d 10025055 Rage 128 PU/PRO AGP 4x 0 d 10025056 Rage 128 PV/PRO TMDS 0 d 10025057 Rage 128 PW/PRO AGP 2x TMDS 0 d 10025058 Rage 128 PX/PRO AGP 4x TMDS 0 d 10025144 Radeon R100 QD [Radeon 64 DDR] 0 s 1002514410020008 Radeon 7000/Radeon VE 0 s 1002514410020009 Radeon 7000/Radeon 0 s 100251441002000a Radeon 7000/Radeon 0 s 100251441002001a Radeon 7000/Radeon 0 s 1002514410020029 Radeon AIW 0 s 1002514410020038 Radeon 7000/Radeon 0 s 1002514410020039 Radeon 7000/Radeon 0 s 100251441002008a Radeon 7000/Radeon 0 s 10025144100200ba Radeon 7000/Radeon 0 s 1002514410020139 Radeon 7000/Radeon 0 s 100251441002028a Radeon 7000/Radeon 0 s 10025144100202aa Radeon AIW 0 s 100251441002053a Radeon 7000/Radeon 0 d 10025145 Radeon R100 QE 0 d 10025146 Radeon R100 QF 0 d 10025147 Radeon R100 QG 0 d 10025148 Radeon R200 QH [Radeon 8500] 0 s 1002514810020152 FireGL 8800 0 s 1002514810020172 FireGL 8700 0 d 10025149 Radeon R200 QI 0 d 1002514a Radeon R200 QJ 0 d 1002514b Radeon R200 QK 0 d 1002514c Radeon R200 QL [Radeon 8500 LE] 0 s 1002514c1002003a Radeon R200 QL [Radeon 8500 LE] 0 s 1002514c1002013a Radeon 8500 0 s 1002514c148c2026 R200 QL [Radeon 8500 Evil Master II Multi Display Edition] 1 s 1002514c148c2026 R200 QL [Radeon 8500 Evil Master II Multi Display Edition] 1 Oops, missed comment above http://mirror.ati.com/support/identify/graphicschart.html s 1002514c174b7149 Radeon R200 QL [Sapphire Radeon 8500 LE] 0 d 10025157 Radeon RV200 QW [Radeon 7500] 0 s 100251571002013a Radeon 7500 0 s 1002515714584000 RV200 QW [RADEON 7500 PRO MAYA AR] 1 ATI supplied info - http://mirror.ati.com/support/identify/graphicschart.html s 10025157148c2024 RV200 QW [Radeon 7500LE Dual Display] 1 ATI supplied info - http://mirror.ati.com/support/identify/graphicschart.html s 10025157148c2025 RV200 QW [Radeon 7500 Evil Master Multi Display Edition] 1 ATI supplied info - http://mirror.ati.com/support/identify/graphicschart.html s 10025157148c2036 RV200 QW [Radeon 7500 PCI Dual Display] 1 ATI supplied info - http://mirror.ati.com/support/identify/graphicschart.html s 10025157174b7147 RV200 QW [Sapphire Radeon 7500LE] 1 ATI supplied info - http://mirror.ati.com/support/identify/graphicschart.html s 10025157174b7161 Radeon RV200 QW [Radeon 7500 LE] 0 s 1002515717af0202 RV200 QW [Excalibur Radeon 7500LE] 1 ATI supplied info - http://mirror.ati.com/support/identify/graphicschart.html d 10025158 Radeon RV200 QX [Radeon 7500] 0 d 10025159 Radeon VE QY 0 s 100251591002000a Radeon 7000/Radeon VE 0 s 100251591002000b Radeon 7000 0 s 1002515910020038 Radeon 7000/Radeon VE 0 s 100251591002003a Radeon 7000/Radeon VE 0 s 10025159100200ba Radeon 7000/Radeon VE 0 s 100251591002013a Radeon 7000/Radeon VE 0 s 1002515914584002 RV100 QY [RADEON 7000 PRO MAYA AV Series] 1 ATI clone board - http://mirror.ati.com/support/identify/graphicschart.html s 10025159148c2003 RV100 QY [Radeon 7000 Multi-Display Edition] 1 ATI clone board - http://mirror.ati.com/support/identify/graphicschart.html s 10025159148c2023 RV100 QY [Radeon 7000 Evil Master Multi-Display] 1 ATI clone board - http://mirror.ati.com/support/identify/graphicschart.html s 10025159174b7112 Radeon 7000 64M TVO 0 s 10025159174b7112 RV100 QY [Sapphire Radeon VE 7000] 1 ATI clone board - http://mirror.ati.com/support/identify/graphicschart.html s 1002515917870202 RV100 QY [Excalibur Radeon 7000] 1 ATI clone board - http://mirror.ati.com/support/identify/graphicschart.html d 1002515a Radeon VE QZ 0 d 10025168 Radeon R200 Qh 0 d 10025169 Radeon R200 Qi 0 d 1002516a Radeon R200 Qj 0 d 1002516b Radeon R200 Qk 0 d 10025245 Rage 128 RE/SG 0 s 1002524510020008 Xpert 128 0 s 1002524510020028 Rage 128 AIW 0 s 1002524510020029 Rage 128 AIW 0 s 1002524510020068 Rage 128 AIW 0 d 10025246 Rage 128 RF/SG AGP 0 s 1002524610020004 Magnum/Xpert 128/Xpert 99 0 s 1002524610020008 Magnum/Xpert128/X99/Xpert2000 0 s 1002524610020028 Rage 128 AIW AGP 0 s 1002524610020044 Rage Fury/Xpert 128/Xpert 2000 0 s 1002524610020068 Rage 128 AIW AGP 0 s 1002524610020448 Rage Fury 0 d 10025247 Rage 128 RG 0 d 1002524b Rage 128 RK/VR 0 d 1002524c Rage 128 RL/VR AGP 0 s 1002524c10020008 Xpert 99/Xpert 2000 0 s 1002524c10020088 Xpert 99 0 d 10025345 Rage 128 SE/4x 0 d 10025346 Rage 128 SF/4x AGP 2x 0 d 10025347 Rage 128 SG/4x AGP 4x 0 d 10025348 Rage 128 SH 0 d 1002534b Rage 128 SK/4x 0 d 1002534c Rage 128 SL/4x AGP 2x 0 d 1002534d Rage 128 SM/4x AGP 4x 0 s 1002534d10020008 Xpert 99/Xpert 2000 0 s 1002534d10020018 Xpert 2000 0 d 1002534e Rage 128 4x 0 d 10025354 Mach 64 VT 0 s 1002535410025654 Mach 64 reference 0 d 10025446 Rage 128 Pro Ultra TF 0 s 1002544610020004 Rage Fury Pro 0 s 1002544610020008 Rage Fury Pro/Xpert 2000 Pro 0 s 1002544610020018 Rage Fury Pro/Xpert 2000 Pro 0 s 1002544610020028 Rage 128 AIW Pro AGP 0 s 1002544610020029 Rage 128 AIW 0 s 100254461002002a Rage 128 AIW Pro AGP 0 s 100254461002002b Rage 128 AIW 0 s 1002544610020048 Xpert 2000 Pro 0 d 1002544c Rage 128 Pro Ultra TL 0 d 10025452 Rage 128 Pro Ultra TR 0 s 100254521002001c Rage 128 Pro 4XL 0 s 10025452103c1279 Rage 128 Pro 4XL 0 d 10025453 Rage 128 Pro Ultra TS 0 d 10025454 Rage 128 Pro Ultra TT 0 d 10025455 Rage 128 Pro Ultra TU 0 d 10025654 264VT [Mach64 VT] 0 s 1002565410025654 Mach64VT Reference 0 d 10025655 264VT3 [Mach64 VT3] 0 d 10025656 264VT4 [Mach64 VT4] 0 d 1002700f U1/A3 AGP Bridge [IGP 320M] 0 v 1003 ULSI Systems 0 d 10030201 US201 0 v 1004 VLSI Technology Inc 0 d 10040005 82C592-FC1 0 d 10040006 82C593-FC1 0 d 10040007 82C594-AFC2 0 d 10040008 82C596/7 [Wildcat] 0 d 10040009 82C597-AFC2 0 d 1004000c 82C541 [Lynx] 0 d 1004000d 82C543 [Lynx] 0 d 10040101 82C532 0 d 10040102 82C534 [Eagle] 0 d 10040103 82C538 0 d 10040104 82C535 0 d 10040105 82C147 0 d 10040200 82C975 0 d 10040280 82C925 0 d 10040304 QSound ThunderBird PCI Audio 0 s 1004030410040304 QSound ThunderBird PCI Audio 0 s 10040304122d1206 DSP368 Audio 0 s 1004030414835020 XWave Thunder 3D Audio 0 d 10040305 QSound ThunderBird PCI Audio Gameport 0 s 1004030510040305 QSound ThunderBird PCI Audio Gameport 0 s 10040305122d1207 DSP368 Audio Gameport 0 s 1004030514835021 XWave Thunder 3D Audio Gameport 0 d 10040306 QSound ThunderBird PCI Audio Support Registers 0 s 1004030610040306 QSound ThunderBird PCI Audio Support Registers 0 s 10040306122d1208 DSP368 Audio Support Registers 0 s 1004030614835022 XWave Thunder 3D Audio Support Registers 0 d 10040307 Thunderbird 1 http://pcsound.philips.com/_acoustic706.html d 10040308 Thunderbird 1 http://pcsound.philips.com/_acoustic706.html d 10040702 VAS96011 [Golden Gate II] 0 d 10040703 Tollgate 1 PCI/ISA bridge v 1005 Avance Logic Inc. [ALI] 0 d 10052064 ALG2032/2064 0 d 10052128 ALG2364A 0 d 10052301 ALG2301 0 d 10052302 ALG2302 0 d 10052364 ALG2364 0 d 10052464 ALG2364A 0 d 10052501 ALG2564A/25128A 0 v 1006 Reply Group 0 v 1007 NetFrame Systems Inc 0 v 1008 Epson 0 v 100a Phoenix Technologies 0 v 100b National Semiconductor Corporation 0 d 100b0001 DP83810 0 d 100b0002 87415/87560 IDE 0 d 100b000e 87560 Legacy I/O 0 d 100b000f FireWire Controller 0 d 100b0011 NS87560 National PCI System I/O 0 d 100b0012 USB Controller 0 d 100b0020 DP83815 (MacPhyter) Ethernet Controller 0 d 100b0022 DP83820 10/100/1000 Ethernet Controller 0 d 100b0500 SCx200 Bridge 0 d 100b0501 SCx200 SMI 0 d 100b0502 SCx200 IDE 0 d 100b0503 SCx200 Audio 0 d 100b0504 SCx200 Video 0 d 100b0505 SCx200 XBus 0 d 100bd001 87410 IDE 0 v 100c Tseng Labs Inc 0 d 100c3202 ET4000/W32p rev A 0 d 100c3205 ET4000/W32p rev B 0 d 100c3206 ET4000/W32p rev C 0 d 100c3207 ET4000/W32p rev D 0 d 100c3208 ET6000 0 d 100c4702 ET6300 0 v 100d AST Research Inc 0 v 100e Weitek 0 d 100e9000 P9000 Viper 0 d 100e9001 P9000 Viper 0 d 100e9002 P9000 Viper 0 d 100e9100 P9100 Viper Pro/SE 0 v 1010 Video Logic, Ltd. 0 v 1011 Digital Equipment Corporation 0 d 10110001 DECchip 21050 0 d 10110002 DECchip 21040 [Tulip] 0 d 10110004 DECchip 21030 [TGA] 0 d 10110007 NVRAM [Zephyr NVRAM] 0 d 10110008 KZPSA [KZPSA] 0 d 10110009 DECchip 21140 [FasterNet] 0 s 1011000910250310 21140 Fast Ethernet 0 s 1011000910b82001 SMC9332BDT EtherPower 10/100 0 s 1011000910b82002 SMC9332BVT EtherPower T4 10/100 0 s 1011000910b82003 SMC9334BDT EtherPower 10/100 (1-port) 0 s 1011000911092400 ANA-6944A/TX Fast Ethernet 0 s 1011000911122300 RNS2300 Fast Ethernet 0 s 1011000911122320 RNS2320 Fast Ethernet 0 s 1011000911122340 RNS2340 Fast Ethernet 0 s 1011000911131207 EN-1207-TX Fast Ethernet 0 s 1011000911861100 DFE-500TX Fast Ethernet 0 s 1011000911861112 DFE-570TX Fast Ethernet 0 s 1011000911861140 DFE-660 Cardbus Ethernet 10/100 0 s 1011000911861142 DFE-660 Cardbus Ethernet 10/100 0 s 1011000911f60503 Freedomline Fast Ethernet 0 s 1011000912829100 AEF-380TXD Fast Ethernet 0 s 1011000913851100 FA310TX Fast Ethernet 0 s 1011000926460001 KNE100TX Fast Ethernet 0 d 1011000a 21230 Video Codec 0 d 1011000d PBXGB [TGA2] 0 d 1011000f DEFPA 0 d 10110014 DECchip 21041 [Tulip Pass 3] 0 s 1011001411860100 DE-530+ 0 d 10110016 DGLPB [OPPO] 0 d 10110019 DECchip 21142/43 0 s 101100191011500a DE500A Fast Ethernet 0 s 101100191011500b DE500B Fast Ethernet 0 s 1011001910140001 10/100 EtherJet Cardbus 0 s 1011001910250315 ALN315 Fast Ethernet 0 s 101100191033800c PC-9821-CS01 0 s 101100191033800d PC-9821NR-B06 0 s 10110019108d0016 Rapidfire 2327 10/100 Ethernet 0 s 10110019108d0017 GoCard 2250 Ethernet 10/100 Cardbus 0 s 1011001910b82005 SMC8032DT Extreme Ethernet 10/100 0 s 1011001910b88034 SMC8034 Extreme Ethernet 10/100 0 s 1011001910ef8169 Cardbus Fast Ethernet 0 s 1011001911092a00 ANA-6911A/TX Fast Ethernet 0 s 1011001911092b00 ANA-6911A/TXC Fast Ethernet 0 s 1011001911093000 ANA-6922/TX Fast Ethernet 0 s 1011001911131207 Cheetah Fast Ethernet 0 s 1011001911132220 Cardbus Fast Ethernet 0 s 10110019115d0002 Cardbus Ethernet 10/100 0 s 1011001911790203 Fast Ethernet 0 s 1011001911790204 Cardbus Fast Ethernet 0 s 1011001911861100 DFE-500TX Fast Ethernet 0 s 1011001911861101 DFE-500TX Fast Ethernet 0 s 1011001911861102 DFE-500TX Fast Ethernet 0 s 1011001912592800 AT-2800Tx Fast Ethernet 0 s 1011001912660004 Eagle Fast EtherMAX 0 s 1011001912af0019 NetFlyer Cardbus Fast Ethernet 0 s 1011001913740001 Cardbus Ethernet Card 10/100 0 s 1011001913740002 Cardbus Ethernet Card 10/100 0 s 1011001913740007 Cardbus Ethernet Card 10/100 0 s 1011001913740008 Cardbus Ethernet Card 10/100 0 s 1011001913950001 10/100 Ethernet CardBus PC Card 0 s 1011001913d1ab01 EtherFast 10/100 Cardbus (PCMPC200) 0 s 1011001980860001 EtherExpress PRO/100 Mobile CardBus 32 0 d 1011001a Farallon PN9000SX 0 d 10110021 DECchip 21052 0 d 10110022 DECchip 21150 0 d 10110023 DECchip 21150 0 d 10110024 DECchip 21152 0 d 10110025 DECchip 21153 0 d 10110026 DECchip 21154 0 d 10110034 56k Modem Cardbus 0 s 1011003413740003 56k Modem Cardbus 0 d 10110045 DECchip 21553 0 d 10110046 DECchip 21554 0 s 101100460e114050 Integrated Smart Array 0 s 101100460e114051 Integrated Smart Array 0 s 101100460e114058 Integrated Smart Array 0 s 10110046103c10c2 Hewlett-Packard NetRAID-4M 0 s 1011004612d9000a VoIP PCI Gateway 0 s 1011004690050365 Adaptec 5400S 0 s 1011004690051364 Dell PowerEdge RAID Controller 2 0 s 1011004690051365 Dell PowerEdge RAID Controller 2 0 s 10110046e4bf1000 CC8-1-BLUES 0 d 10111065 StrongARM DC21285 0 s 1011106510690020 DAC960P / DAC1164P 0 v 1012 Micronics Computers Inc 0 v 1013 Cirrus Logic 0 d 10130038 GD 7548 0 d 10130040 GD 7555 Flat Panel GUI Accelerator 0 d 1013004c GD 7556 Video/Graphics LCD/CRT Ctrlr 0 d 101300a0 GD 5430/40 [Alpine] 0 d 101300a2 GD 5432 [Alpine] 0 d 101300a4 GD 5434-4 [Alpine] 0 d 101300a8 GD 5434-8 [Alpine] 0 d 101300ac GD 5436 [Alpine] 0 d 101300b0 GD 5440 0 d 101300b8 GD 5446 0 d 101300bc GD 5480 0 s 101300bc101300bc CL-GD5480 0 d 101300d0 GD 5462 0 d 101300d2 GD 5462 [Laguna I] 0 d 101300d4 GD 5464 [Laguna] 0 d 101300d5 GD 5464 BD [Laguna] 0 d 101300d6 GD 5465 [Laguna] 0 s 101300d613ce8031 Barco Metheus 2 Megapixel, Dual Head 0 s 101300d613cf8031 Barco Metheus 2 Megapixel, Dual Head 0 d 101300e8 GD 5436U 0 d 10131100 CL 6729 0 d 10131110 PD 6832 PCMCIA/CardBus Ctrlr 0 d 10131112 PD 6834 PCMCIA/CardBus Ctrlr 0 d 10131113 PD 6833 PCMCIA/CardBus Ctrlr 0 d 10131200 GD 7542 [Nordic] 0 d 10131202 GD 7543 [Viking] 0 d 10131204 GD 7541 [Nordic Light] 0 d 10134400 CD 4400 0 d 10136001 CS 4610/11 [CrystalClear SoundFusion Audio Accelerator] 0 s 1013600110141010 CS4610 SoundFusion Audio Accelerator 0 d 10136003 CS 4614/22/24 [CrystalClear SoundFusion Audio Accelerator] 0 s 1013600310134280 Crystal SoundFusion PCI Audio Accelerator 0 s 1013600316810050 Hercules Game Theater XP 0 d 10136004 CS 4614/22/24 [CrystalClear SoundFusion Audio Accelerator] 0 d 10136005 Crystal CS4281 PCI Audio 0 s 1013600510134281 Crystal CS4281 PCI Audio 0 s 1013600510cf10a8 Crystal CS4281 PCI Audio 0 s 1013600510cf10a9 Crystal CS4281 PCI Audio 0 s 1013600510cf10aa Crystal CS4281 PCI Audio 0 s 1013600510cf10ab Crystal CS4281 PCI Audio 0 s 1013600510cf10ac Crystal CS4281 PCI Audio 0 s 1013600510cf10ad Crystal CS4281 PCI Audio 0 s 1013600510cf10b4 Crystal CS4281 PCI Audio 0 s 1013600511790001 Crystal CS4281 PCI Audio 0 s 1013600514c0000c Crystal CS4281 PCI Audio 0 v 1014 IBM 0 d 10140002 PCI to MCA Bridge 0 d 10140005 Alta Lite 0 d 10140007 Alta MP 0 d 1014000a Fire Coral 0 d 10140017 CPU to PCI Bridge 0 d 10140018 TR Auto LANstreamer 0 d 1014001b GXT-150P 0 d 1014001c Carrera 0 d 1014001d 82G2675 0 d 10140020 MCA 0 d 10140022 IBM27-82351 0 d 1014002d Python 0 d 1014002e ServeRAID Controller 0 s 1014002e1014002e ServeRAID-3x 0 s 1014002e1014022e ServeRAID-4H 0 d 10140036 Miami 0 d 1014003a CPU to PCI Bridge 0 d 1014003e 16/4 Token ring UTP/STP controller 0 s 1014003e1014003e Token-Ring Adapter 0 s 1014003e101400cd Token-Ring Adapter + Wake-On-LAN 0 s 1014003e101400ce 16/4 Token-Ring Adapter 2 0 s 1014003e101400cf 16/4 Token-Ring Adapter Special 0 s 1014003e101400e4 High-Speed 100/16/4 Token-Ring Adapter 0 s 1014003e101400e5 16/4 Token-Ring Adapter 2 + Wake-On-LAN 0 s 1014003e1014016d iSeries 2744 Card 0 d 10140045 SSA Adapter 0 d 10140046 MPIC interrupt controller 0 d 10140047 PCI to PCI Bridge 0 d 10140048 PCI to PCI Bridge 0 d 10140049 Warhead SCSI Controller 0 d 1014004e ATM Controller (14104e00) 0 d 1014004f ATM Controller (14104f00) 0 d 10140050 ATM Controller (14105000) 0 d 10140053 25 MBit ATM Controller 0 d 10140057 MPEG PCI Bridge 0 d 1014005c i82557B 10/100 0 d 1014007c ATM Controller (14107c00) 0 d 1014007d 3780IDSP [MWave] 0 d 10140090 GXT 3000P 0 s 101400901014008e GXT-3000P 0 d 10140095 20H2999 PCI Docking Bridge 0 d 10140096 Chukar chipset SCSI controller 0 s 1014009610140097 iSeries 2778 DASD IOA 0 s 1014009610140098 iSeries 2763 DASD IOA 0 s 1014009610140099 iSeries 2748 DASD IOA 0 d 101400a5 ATM Controller (1410a500) 0 d 101400a6 ATM 155MBPS MM Controller (1410a600) 0 d 101400b7 256-bit Graphics Rasterizer [Fire GL1] 0 s 101400b7190200b8 Fire GL1 0 d 101400be ATM 622MBPS Controller (1410be00) 0 d 101400dc Remote Supervisor Adapter (RSA) 1 IBM's remote management adapter d 101400dc Advanced Systems Management Adapter (ASMA) 1 sorry, the previous entry I posted was a mistake, this ID is the ASMA not the RSA. d 101400fc CPC710 Dual Bridge and Memory Controller (PCI-64) 0 d 10140105 CPC710 Dual Bridge and Memory Controller (PCI-32) 0 d 1014010f Remote Supervisor Adapter (RSA) 1 this is actually the RSA d 10140142 Yotta Video Compositor Input 0 s 1014014210140143 Yotta Input Controller (ytin) 0 d 10140144 Yotta Video Compositor Output 0 s 1014014410140145 Yotta Output Controller (ytout) 0 d 10140156 405GP PLB to PCI Bridge 0 d 101401a7 PCI-X to PCI-X Bridge 0 d 101401bd ServeRAID Controller 0 s 101401bd101401be ServeRAID-4M 0 s 101401bd101401bf ServeRAID-4L 0 s 101401bd10140208 ServeRAID-4Mx 0 s 101401bd1014020e ServeRAID-4Lx 0 s 101401bd1014022e ServeRAID-4H 0 s 101401bd10140258 ServeRAID-5i 0 s 101401bd10140259 ServeRAID-5i 0 d 10140302 XA-32 chipset [Summit] 1 the IBM Summit X-Architecuture chipset d 1014ffff MPIC-2 interrupt controller 0 v 1015 LSI Logic Corp of Canada 0 v 1016 ICL Personal Systems 0 v 1017 SPEA Software AG 0 d 10175343 SPEA 3D Accelerator 0 v 1018 Unisys Systems 0 v 1019 Elitegroup Computer Systems 0 v 101a AT&T GIS (NCR) 0 d 101a0005 100VG ethernet 0 v 101b Vitesse Semiconductor 0 v 101c Western Digital 0 d 101c0193 33C193A 0 d 101c0196 33C196A 0 d 101c0197 33C197A 0 d 101c0296 33C296A 0 d 101c3193 7193 0 d 101c3197 7197 0 d 101c3296 33C296A 0 d 101c4296 34C296 0 d 101c9710 Pipeline 9710 0 d 101c9712 Pipeline 9712 0 d 101cc24a 90C 0 v 101e American Megatrends Inc. 0 d 101e1960 MegaRAID 0 s 101e1960101e0471 MegaRAID 471 Enterprise 1600 RAID Controller 0 s 101e1960101e0475 MegaRAID 475 Express 500 RAID Controller 0 s 101e1960101e0493 MegaRAID 493 Elite 1600 RAID Controller 0 s 101e196010280471 PowerEdge RAID Controller 3/QC 0 s 101e196010280475 PowerEdge RAID Controller 3/SC 0 s 101e196010280493 PowerEdge RAID Controller 3/DC 0 s 101e196010280511 PowerEdge Cost Effective RAID Controller ATA100/4Ch 0 d 101e9010 MegaRAID 428 Ultra RAID Controller 0 d 101e9030 EIDE Controller 0 d 101e9031 EIDE Controller 0 d 101e9032 EIDE & SCSI Controller 0 d 101e9033 SCSI Controller 0 d 101e9040 Multimedia card 0 d 101e9060 MegaRAID 434 Ultra GT RAID Controller 0 d 101e9063 MegaRAC 0 s 101e9063101e0767 Dell Remote Assistant Card 2 0 v 101f PictureTel 0 v 1020 Hitachi Computer Products 0 v 1021 OKI Electric Industry Co. Ltd. 0 v 1022 Advanced Micro Devices [AMD] 0 d 10221100 K8 NorthBridge 0 d 10221101 K8 NorthBridge 0 d 10221102 K8 NorthBridge 0 d 10221103 K8 NorthBridge 0 d 10222000 79c970 [PCnet32 LANCE] 0 s 1022200010142000 NetFinity 10/100 Fast Ethernet 0 s 10222000103c104c Ethernet with LAN remote power Adapter 0 s 10222000103c1064 Ethernet with LAN remote power Adapter 0 s 10222000103c1065 Ethernet with LAN remote power Adapter 0 s 10222000103c106c Ethernet with LAN remote power Adapter 0 s 10222000103c106e Ethernet with LAN remote power Adapter 0 s 10222000103c10ea Ethernet with LAN remote power Adapter 0 s 1022200011131220 EN1220 10/100 Fast Ethernet 0 s 1022200012592450 AT-2450 10/100 Fast Ethernet 0 s 1022200012592454 AT-2450v4 10Mb Ethernet Adapter 0 s 1022200012592700 AT-2700TX 10/100 Fast Ethernet 0 s 1022200012592701 AT-2700FX 100Mb Ethernet 0 d 10222001 79c978 [HomePNA] 0 s 1022200110920a78 Multimedia Home Network Adapter 0 s 1022200116680299 ActionLink Home Network Adapter 0 d 10222020 53c974 [PCscsi] 0 d 10222040 79c974 0 d 10223000 ELanSC520 Microcontroller 0 d 10227006 AMD-751 [Irongate] System Controller 0 d 10227007 AMD-751 [Irongate] AGP Bridge 0 d 1022700c AMD-760 MP [IGD4-2P] System Controller 0 d 1022700d AMD-760 MP [IGD4-2P] AGP Bridge 0 d 1022700e AMD-760 [IGD4-1P] System Controller 0 d 1022700f AMD-760 [IGD4-1P] AGP Bridge 0 d 10227400 AMD-755 [Cobra] ISA 0 d 10227401 AMD-755 [Cobra] IDE 0 d 10227403 AMD-755 [Cobra] ACPI 0 d 10227404 AMD-755 [Cobra] USB 0 d 10227408 AMD-756 [Viper] ISA 0 d 10227409 AMD-756 [Viper] IDE 0 d 1022740b AMD-756 [Viper] ACPI 0 d 1022740c AMD-756 [Viper] USB 0 d 10227410 AMD-766 [ViperPlus] ISA 0 d 10227411 AMD-766 [ViperPlus] IDE 0 d 10227413 AMD-766 [ViperPlus] ACPI 0 d 10227414 AMD-766 [ViperPlus] USB 0 d 10227440 AMD-768 [Opus] ISA 0 s 1022744010438044 A7M-D Mainboard 0 d 10227441 AMD-768 [Opus] IDE 0 d 10227443 AMD-768 [Opus] ACPI 0 s 1022744310438044 A7M-D Mainboard 0 d 10227445 AMD-768 [Opus] Audio 0 d 10227446 AMD-768 [Opus] MC97 Modem (Smart Link HAMR5600 compatible) 0 d 10227448 AMD-768 [Opus] PCI 0 d 10227449 AMD-768 [Opus] USB 0 d 10227450 AMD-8131 PCI-X Bridge 0 d 10227451 AMD-8131 PCI-X APIC 0 d 10227454 AMD-8151 System Controller 0 d 10227455 AMD-8151 AGP Bridge 0 d 10227460 AMD-8111 PCI 0 d 10227461 AMD-8111 USB 0 d 10227462 AMD-8111 Ethernet 0 d 10227464 AMD-8111 USB 0 d 10227468 AMD-8111 LPC 0 d 10227469 AMD-8111 IDE 0 d 1022746a AMD-8111 SMBus 2.0 0 d 1022746b AMD-8111 ACPI 0 d 1022746d AMD-8111 AC97 Audio 0 d 1022746e AMD-8111 MC97 Modem 0 v 1023 Trident Microsystems 0 d 10230194 82C194 0 d 10232000 4DWave DX 0 d 10232001 4DWave NX 0 d 10238400 CyberBlade/i7 0 s 1023840010238400 CyberBlade i7 AGP 0 d 10238420 CyberBlade/i7d 0 s 102384200e11b15a CyberBlade i7 AGP 0 d 10238500 CyberBlade/i1 0 d 10238520 CyberBlade i1 0 s 102385200e11b16e CyberBlade i1 AGP 0 s 1023852010238520 CyberBlade i1 AGP 0 d 10238620 CyberBlade/i1 1 s 1023862010140502 ThinkPad T30 1 d 10238820 CyberBlade XPAi1 0 d 10239320 TGUI 9320 0 d 10239350 GUI Accelerator 0 d 10239360 Flat panel GUI Accelerator 0 d 10239382 Cyber 9382 [Reference design] 0 d 10239383 Cyber 9383 [Reference design] 0 d 10239385 Cyber 9385 [Reference design] 0 d 10239386 Cyber 9386 0 d 10239388 Cyber 9388 0 d 10239397 Cyber 9397 0 d 1023939a Cyber 9397DVD 0 d 10239420 TGUI 9420 0 d 10239430 TGUI 9430 0 d 10239440 TGUI 9440 0 d 10239460 TGUI 9460 0 d 10239470 TGUI 9470 0 d 10239520 Cyber 9520 0 d 10239525 Cyber 9525 0 s 1023952510cf1094 Lifebook C6155 0 d 10239540 Cyber 9540 0 d 10239660 TGUI 9660/938x/968x 0 d 10239680 TGUI 9680 0 d 10239682 TGUI 9682 0 d 10239683 TGUI 9683 0 d 10239685 ProVIDIA 9685 0 d 10239750 3DImage 9750 0 s 1023975010149750 3DImage 9750 0 s 1023975010239750 3DImage 9750 0 d 10239753 TGUI 9753 0 d 10239754 TGUI 9754 0 d 10239759 TGUI 975 0 d 10239783 TGUI 9783 0 d 10239785 TGUI 9785 0 d 10239850 3DImage 9850 0 d 10239880 Blade 3D PCI/AGP 0 s 1023988010239880 Blade 3D 0 d 10239910 CyberBlade/XP 0 d 10239930 CyberBlade/XPm 0 v 1024 Zenith Data Systems 0 v 1025 Acer Incorporated [ALI] 0 d 10251435 M1435 0 d 10251445 M1445 0 d 10251449 M1449 0 d 10251451 M1451 0 d 10251461 M1461 0 d 10251489 M1489 0 d 10251511 M1511 0 d 10251512 ALI M1512 Aladdin 0 d 10251513 M1513 0 d 10251521 ALI M1521 Aladdin III CPU Bridge 0 s 1025152110b91521 ALI M1521 Aladdin III CPU Bridge 0 d 10251523 ALI M1523 ISA Bridge 0 s 1025152310b91523 ALI M1523 ISA Bridge 0 d 10251531 M1531 Northbridge [Aladdin IV/IV+] 0 d 10251533 M1533 PCI-to-ISA Bridge 0 s 1025153310b91533 ALI M1533 Aladdin IV/V ISA South Bridge 0 d 10251535 M1535 PCI Bridge + Super I/O + FIR 0 d 10251541 M1541 Northbridge [Aladdin V] 0 s 1025154110b91541 ALI M1541 Aladdin V/V+ AGP+PCI North Bridge 0 d 10251542 M1542 Northbridge [Aladdin V] 0 d 10251543 M1543 PCI-to-ISA Bridge + Super I/O + FIR 0 d 10251561 M1561 Northbridge [Aladdin 7] 0 d 10251621 M1621 Northbridge [Aladdin-Pro II] 0 d 10251631 M1631 Northbridge+3D Graphics [Aladdin TNT2] 0 d 10251641 M1641 Northbridge [Aladdin-Pro IV] 0 d 10251647 M1647 [MaGiK1] PCI North Bridge 0 d 10253141 M3141 0 d 10253143 M3143 0 d 10253145 M3145 0 d 10253147 M3147 0 d 10253149 M3149 0 d 10253151 M3151 0 d 10253307 M3307 MPEG-I Video Controller 0 d 10253309 M3309 MPEG-II Video w/ Software Audio Decoder 0 d 10253321 M3321 MPEG-II Audio/Video Decoder 0 d 10255212 M4803 0 d 10255215 ALI PCI EIDE Controller 0 d 10255217 M5217H 0 d 10255219 M5219 0 d 10255225 M5225 0 d 10255229 M5229 0 d 10255235 M5235 0 d 10255237 M5237 PCI USB Host Controller 0 d 10255240 EIDE Controller 0 d 10255241 PCMCIA Bridge 0 d 10255242 General Purpose Controller 0 d 10255243 PCI to PCI Bridge Controller 0 d 10255244 Floppy Disk Controller 0 d 10255247 M1541 PCI to PCI Bridge 0 d 10255251 M5251 P1394 Controller 0 d 10255427 PCI to AGP Bridge 0 d 10255451 M5451 PCI AC-Link Controller Audio Device 0 d 10255453 M5453 PCI AC-Link Controller Modem Device 0 d 10257101 M7101 PCI PMU Power Management Controller 0 s 1025710110b97101 M7101 PCI PMU Power Management Controller 0 v 1028 Dell Computer Corporation 0 d 10280001 PowerEdge Expandable RAID Controller 2/Si 0 s 1028000110280001 PowerEdge Expandable RAID Controller 2/Si 0 d 10280002 PowerEdge Expandable RAID Controller 3 0 s 1028000210280002 PowerEdge Expandable RAID Controller 3/Di 0 s 10280002102800d1 PowerEdge Expandable RAID Controller 3/Di 0 s 10280002102800d9 PowerEdge Expandable RAID Controller 3/Di 0 d 10280003 PowerEdge Expandable RAID Controller 3/Si 0 s 1028000310280003 PowerEdge Expandable RAID Controller 3/Si 0 d 10280004 PowerEdge Expandable RAID Controller 3/Si 0 s 10280004102800d0 PowerEdge Expandable RAID Controller 3/Si 0 d 10280005 PowerEdge Expandable RAID Controller 3/Di 0 d 10280006 PowerEdge Expandable RAID Controller 3/Di 0 d 10280007 Remote Assistant Card 3 0 d 10280008 PowerEdge Expandable RAID Controller 3/Di 0 d 1028000a PowerEdge Expandable RAID Controller 3 0 s 1028000a10270121 PowerEdge Expandable RAID Controller 3/Di 0 s 1028000a10280106 PowerEdge Expandable RAID Controller 3/Di 0 s 1028000a1028011b PowerEdge Expandable RAID Controller 3/Di 0 d 1028000c Embedded Systems Management Device 4 0 d 1028000e PowerEdge Expandable RAID Controller 0 d 1028000f PowerEdge Expandable RAID Controller 4/Di 0 v 1029 Siemens Nixdorf IS 0 v 102a LSI Logic 0 d 102a0000 HYDRA 0 d 102a0010 ASPEN 0 v 102b Matrox Graphics, Inc. 0 d 102b0010 MGA-I [Impression?] 0 DJ: I've a suspicion that 0010 is a duplicate of 0d10. d 102b0518 MGA-II [Athena] 0 d 102b0519 MGA 2064W [Millennium] 0 d 102b051a MGA 1064SG [Mystique] 0 s 102b051a102b1100 MGA-1084SG Mystique 0 s 102b051a102b1200 MGA-1084SG Mystique 0 s 102b051a1100102b MGA-1084SG Mystique 0 s 102b051a110a0018 Scenic Pro C5 (D1025) 0 d 102b051b MGA 2164W [Millennium II] 0 s 102b051b102b051b MGA-2164W Millennium II 0 s 102b051b102b1100 MGA-2164W Millennium II 0 s 102b051b102b1200 MGA-2164W Millennium II 0 d 102b051e MGA 1064SG [Mystique] AGP 0 d 102b051f MGA 2164W [Millennium II] AGP 0 d 102b0520 MGA G200 0 s 102b0520102bdbc2 G200 Multi-Monitor 0 s 102b0520102bdbc8 G200 Multi-Monitor 0 s 102b0520102bdbe2 G200 Multi-Monitor 0 s 102b0520102bdbe8 G200 Multi-Monitor 0 s 102b0520102bff03 Millennium G200 SD 0 s 102b0520102bff04 Marvel G200 0 d 102b0521 MGA G200 AGP 0 s 102b05211014ff03 Millennium G200 AGP 0 s 102b0521102b48e9 Mystique G200 AGP 0 s 102b0521102b48f8 Millennium G200 SD AGP 0 s 102b0521102b4a60 Millennium G200 LE AGP 0 s 102b0521102b4a64 Millennium G200 AGP 0 s 102b0521102bc93c Millennium G200 AGP 0 s 102b0521102bc9b0 Millennium G200 AGP 0 s 102b0521102bc9bc Millennium G200 AGP 0 s 102b0521102bca60 Millennium G250 LE AGP 0 s 102b0521102bca6c Millennium G250 AGP 0 s 102b0521102bdbbc Millennium G200 AGP 0 s 102b0521102bdbc2 Millennium G200 MMS (Dual G200) 0 s 102b0521102bdbc3 G200 Multi-Monitor 0 s 102b0521102bdbc8 Millennium G200 MMS (Dual G200) 0 s 102b0521102bdbd2 G200 Multi-Monitor 0 s 102b0521102bdbd3 G200 Multi-Monitor 0 s 102b0521102bdbd4 G200 Multi-Monitor 0 s 102b0521102bdbd5 G200 Multi-Monitor 0 s 102b0521102bdbd8 G200 Multi-Monitor 0 s 102b0521102bdbd9 G200 Multi-Monitor 0 s 102b0521102bdbe2 Millennium G200 MMS (Quad G200) 0 s 102b0521102bdbe3 G200 Multi-Monitor 0 s 102b0521102bdbe8 Millennium G200 MMS (Quad G200) 0 s 102b0521102bdbf2 G200 Multi-Monitor 0 s 102b0521102bdbf3 G200 Multi-Monitor 0 s 102b0521102bdbf4 G200 Multi-Monitor 0 s 102b0521102bdbf5 G200 Multi-Monitor 0 s 102b0521102bdbf8 G200 Multi-Monitor 0 s 102b0521102bdbf9 G200 Multi-Monitor 0 s 102b0521102bf806 Mystique G200 Video AGP 0 s 102b0521102bff00 MGA-G200 AGP 0 s 102b0521102bff02 Mystique G200 AGP 0 s 102b0521102bff03 Millennium G200 AGP 0 s 102b0521102bff04 Marvel G200 AGP 0 s 102b0521110a0032 MGA-G200 AGP 0 d 102b0525 MGA G400 AGP 0 s 102b05250e11b16f MGA-G400 AGP 0 s 102b0525102b0328 Millennium G400 16Mb SDRAM 0 s 102b0525102b0338 Millennium G400 16Mb SDRAM 0 s 102b0525102b0378 Millennium G400 32Mb SDRAM 0 s 102b0525102b0541 Millennium G450 Dual Head 0 s 102b0525102b0542 Millennium G450 Dual Head LX 0 s 102b0525102b0543 Millennium G450 Single Head LX 0 s 102b0525102b0641 Millennium G450 32Mb SDRAM Dual Head 0 s 102b0525102b0642 Millennium G450 32Mb SDRAM Dual Head LX 0 s 102b0525102b0643 Millennium G450 32Mb SDRAM Single Head LX 0 s 102b0525102b07c0 Millennium G450 Dual Head LE 0 s 102b0525102b07c1 Millennium G450 SDR Dual Head LE 0 s 102b0525102b0d41 Millennium G450 Dual Head PCI 0 s 102b0525102b0d42 Millennium G450 Dual Head LX PCI 0 s 102b0525102b0e00 Marvel G450 eTV 0 s 102b0525102b0e01 Marvel G450 eTV 0 s 102b0525102b0e02 Marvel G450 eTV 0 s 102b0525102b0e03 Marvel G450 eTV 0 s 102b0525102b0f80 Millennium G450 Low Profile 0 s 102b0525102b0f81 Millennium G450 Low Profile 0 s 102b0525102b0f82 Millennium G450 Low Profile DVI 0 s 102b0525102b0f83 Millennium G450 Low Profile DVI 0 s 102b0525102b19d8 Millennium G400 16Mb SGRAM 0 s 102b0525102b19f8 Millennium G400 32Mb SGRAM 0 s 102b0525102b2159 Millennium G400 Dual Head 16Mb 0 s 102b0525102b2179 Millennium G400 MAX/Dual Head 32Mb 0 s 102b0525102b217d Millennium G400 Dual Head Max 0 s 102b0525102b23c0 Millennium G450 0 s 102b0525102b23c1 Millennium G450 0 s 102b0525102b23c2 Millennium G450 DVI 0 s 102b0525102b23c3 Millennium G450 DVI 0 s 102b0525102b2f58 Millennium G400 0 s 102b0525102b2f78 Millennium G400 0 s 102b0525102b3693 Marvel G400 AGP 0 s 102b0525102b5dd0 4Sight II 0 s 102b0525102b5f50 4Sight II 0 s 102b0525102b5f51 4Sight II 0 s 102b0525102b5f52 4Sight II 0 s 102b0525102b9010 Millennium G400 Dual Head 0 s 102b052514580400 GA-G400 0 s 102b052517050001 Digital First Millennium G450 32MB SGRAM 0 s 102b052517050002 Digital First Millennium G450 16MB SGRAM 0 s 102b052517050003 Digital First Millennium G450 32MB 0 s 102b052517050004 Digital First Millennium G450 16MB 0 s 102b0525b16f0e11 MGA-G400 AGP 0 d 102b0527 MGA Parhelia AGP 0 s 102b0527102b0840 Parhelia 128Mb 0 d 102b0d10 MGA Ultima/Impression 0 d 102b1000 MGA G100 [Productiva] 0 s 102b1000102bff01 Productiva G100 0 s 102b1000102bff05 Productiva G100 Multi-Monitor 0 d 102b1001 MGA G100 [Productiva] AGP 0 s 102b1001102b1001 MGA-G100 AGP 0 s 102b1001102bff00 MGA-G100 AGP 0 s 102b1001102bff01 MGA-G100 Productiva AGP 0 s 102b1001102bff03 Millennium G100 AGP 0 s 102b1001102bff04 MGA-G100 AGP 0 s 102b1001102bff05 MGA-G100 Productiva AGP Multi-Monitor 0 s 102b1001110a001e MGA-G100 AGP 0 d 102b2007 MGA Mistral 0 d 102b2527 MGA G550 AGP 0 s 102b2527102b0f83 Millennium G550 0 s 102b2527102b0f84 Millennium G550 Dual Head DDR 32Mb 0 s 102b2527102b1e41 Millennium G550 0 d 102b4536 VIA Framegrabber 0 d 102b6573 Shark 10/100 Multiport SwitchNIC 0 v 102c Chips and Technologies 0 d 102c00b8 F64310 0 d 102c00c0 F69000 HiQVideo 0 s 102c00c0102c00c0 F69000 HiQVideo 0 d 102c00d0 F65545 0 d 102c00d8 F65545 0 d 102c00dc F65548 0 d 102c00e0 F65550 0 d 102c00e4 F65554 0 d 102c00e5 F65555 HiQVPro 0 s 102c00e50e11b049 Armada 1700 Laptop Display Controller 0 d 102c00f0 F68554 0 d 102c00f4 F68554 HiQVision 0 d 102c00f5 F68555 0 d 102c0c30 F69030 0 v 102d Wyse Technology Inc. 0 d 102d50dc 3328 Audio 0 v 102e Olivetti Advanced Technology 0 v 102f Toshiba America 0 d 102f0009 r4x00 0 d 102f0020 ATM Meteor 155 0 s 102f0020102f00f8 ATM Meteor 155 0 v 1030 TMC Research 0 v 1031 Miro Computer Products AG 0 d 10315601 DC20 ASIC 0 d 10315607 Video I/O & motion JPEG compressor 0 d 10315631 Media 3D 0 d 10316057 MiroVideo DC10/DC30+ 0 v 1032 Compaq 0 v 1033 NEC Corporation 0 d 10330001 PCI to 486-like bus Bridge 0 d 10330002 PCI to VL98 Bridge 0 d 10330003 ATM Controller 0 d 10330004 R4000 PCI Bridge 0 d 10330005 PCI to 486-like bus Bridge 0 d 10330006 GUI Accelerator 0 d 10330007 PCI to UX-Bus Bridge 0 d 10330008 GUI Accelerator 0 d 10330009 GUI Accelerator for W98 0 d 1033001a [Nile II] 0 d 10330021 Vrc4373 [Nile I] 0 d 10330029 PowerVR PCX1 0 d 1033002a PowerVR 3D 0 d 10330035 USB 0 s 1033003511790001 USB 0 s 1033003512ee7000 Root Hub 0 s 1033003517990001 Root Hub 0 d 1033003e NAPCCARD Cardbus Controller 0 d 10330046 PowerVR PCX2 [midas] 0 d 1033005a Vrc5074 [Nile 4] 0 d 10330063 Firewarden 0 d 10330067 PowerVR Neon 250 Chipset 0 s 1033006710100020 PowerVR Neon 250 AGP 32Mb 0 s 1033006710100080 PowerVR Neon 250 AGP 16Mb 0 s 1033006710100088 PowerVR Neon 250 16Mb 0 s 1033006710100090 PowerVR Neon 250 AGP 16Mb 0 s 1033006710100098 PowerVR Neon 250 16Mb 0 s 10330067101000a0 PowerVR Neon 250 AGP 32Mb 0 s 10330067101000a8 PowerVR Neon 250 32Mb 0 s 1033006710100120 PowerVR Neon 250 AGP 32Mb 0 d 10330074 56k Voice Modem 0 s 1033007410338014 RCV56ACF 56k Voice Modem 0 d 1033009b Vrc5476 0 d 103300a6 VRC5477 AC97 0 d 103300cd IEEE 1394 [OrangeLink] Host Controller 0 s 103300cd12ee8011 Root hub 0 d 103300e0 USB 2.0 0 s 103300e012ee7001 Root hub 0 s 103300e017990002 Root Hub 0 v 1034 Framatome Connectors USA Inc. 0 v 1035 Comp. & Comm. Research Lab 0 v 1036 Future Domain Corp. 0 d 10360000 TMC-18C30 [36C70] 0 v 1037 Hitachi Micro Systems 0 v 1038 AMP, Inc 0 v 1039 Silicon Integrated Systems [SiS] 0 d 10390001 5591/5592 AGP 0 d 10390002 SG86C202 0 d 10390006 85C501/2/3 0 d 10390008 85C503/5513 0 d 10390009 ACPI 0 d 10390018 SiS85C503/5513 (LPC Bridge) 0 d 10390200 5597/5598/6326 VGA 0 s 1039020010390000 SiS5597 SVGA (Shared RAM) 0 d 10390204 82C204 0 d 10390205 SG86C205 0 d 10390300 300/200 0 s 10390300107d2720 Leadtek WinFast VR300 0 d 10390406 85C501/2 0 d 10390496 85C496 0 d 10390530 530 Host 0 d 10390540 540 Host 0 d 10390597 5513C 0 d 10390601 85C601 0 d 10390620 620 Host 0 d 10390630 630 Host 0 d 10390633 633 Host 0 d 10390635 635 Host 0 d 10390645 SiS645 Host & Memory & AGP Controller 0 d 10390646 SiS645DX Host & Memory & AGP Controller 0 d 10390650 650 Host 0 d 10390651 SiS651 Host 0 d 10390730 730 Host 0 d 10390733 733 Host 0 d 10390735 735 Host 0 d 10390740 740 Host 0 d 10390745 745 Host 0 d 10390900 SiS900 10/100 Ethernet 0 s 1039090010390900 SiS900 10/100 Ethernet Adapter 0 d 10390961 SiS961 [MuTIOL Media IO] 0 d 10390962 SiS962 [MuTIOL Media IO] 0 d 10393602 83C602 0 d 10395107 5107 0 d 10395300 SiS540 PCI Display Adapter 0 d 10395401 486 PCI Chipset 0 d 10395511 5511/5512 0 d 10395513 5513 [IDE] 0 s 1039551310395513 SiS5513 EIDE Controller (A,B step) 0 d 10395517 5517 0 d 10395571 5571 0 d 10395581 5581 Pentium Chipset 0 d 10395582 5582 0 d 10395591 5591/5592 Host 0 d 10395596 5596 Pentium Chipset 0 d 10395597 5597 [SiS5582] 0 d 10395600 5600 Host 0 d 10396204 Video decoder & MPEG interface 0 d 10396205 VGA Controller 0 d 10396236 6236 3D-AGP 0 d 10396300 SiS630 GUI Accelerator+3D 0 d 10396306 SiS530 3D PCI/AGP 0 s 1039630610396306 SiS530,620 GUI Accelerator+3D 0 d 10396326 86C326 5598/6326 0 s 1039632610396326 SiS6326 GUI Accelerator 0 s 1039632610920a50 SpeedStar A50 0 s 1039632610920a70 SpeedStar A70 0 s 1039632610924910 SpeedStar A70 0 s 1039632610924920 SpeedStar A70 0 s 1039632615696326 SiS6326 GUI Accelerator 0 d 10397001 7001 0 s 1039700110397000 Onboard USB Controller 0 d 10397007 FireWire Controller 0 d 10397012 SiS7012 PCI Audio Accelerator 0 d 10397013 56k Winmodem (Smart Link HAMR5600 compatible) 0 d 10397016 SiS7016 10/100 Ethernet Adapter 0 s 1039701610397016 SiS7016 10/100 Ethernet Adapter 0 d 10397018 SiS PCI Audio Accelerator 0 s 10397018101401b6 SiS PCI Audio Accelerator 0 s 10397018101401b7 SiS PCI Audio Accelerator 0 s 1039701810197018 SiS PCI Audio Accelerator 0 s 103970181025000e SiS PCI Audio Accelerator 0 s 1039701810250018 SiS PCI Audio Accelerator 0 s 1039701810397018 SiS PCI Audio Accelerator 0 s 103970181043800b SiS PCI Audio Accelerator 0 s 1039701810547018 SiS PCI Audio Accelerator 0 s 10397018107d5330 SiS PCI Audio Accelerator 0 s 10397018107d5350 SiS PCI Audio Accelerator 0 s 1039701811703209 SiS PCI Audio Accelerator 0 s 103970181462400a SiS PCI Audio Accelerator 0 s 1039701814a42089 SiS PCI Audio Accelerator 0 s 1039701814cd2194 SiS PCI Audio Accelerator 0 s 1039701814ff1100 SiS PCI Audio Accelerator 0 s 10397018152d8808 SiS PCI Audio Accelerator 0 s 1039701815581103 SiS PCI Audio Accelerator 0 s 1039701815582200 SiS PCI Audio Accelerator 0 s 1039701815637018 SiS PCI Audio Accelerator 0 s 1039701815c50111 SiS PCI Audio Accelerator 0 s 10397018270fa171 SiS PCI Audio Accelerator 0 s 10397018a0a00022 SiS PCI Audio Accelerator 0 v 103a Seiko Epson Corporation 0 v 103b Tatung Co. of America 0 v 103c Hewlett-Packard Company 0 d 103c1005 A4977A Visualize EG 0 d 103c1006 Visualize FX6 0 d 103c1008 Visualize FX4 0 d 103c100a Visualize FX2 0 d 103c1028 Tach TL Fibre Channel Host Adapter 0 d 103c1029 Tach XL2 Fibre Channel Host Adapter 0 s 103c1029107e000f Interphase 5560 Fibre Channel Adapter 0 s 103c102990049210 1Gb/2Gb Family Fibre Channel Controller 0 s 103c102990049211 1Gb/2Gb Family Fibre Channel Controller 0 d 103c102a Tach TS Fibre Channel Host Adapter 0 s 103c102a107e000e Interphase 5540/5541 Fibre Channel Adapter 0 s 103c102a90049110 1Gb/2Gb Family Fibre Channel Controller 0 s 103c102a90049111 1Gb/2Gb Family Fibre Channel Controller 0 d 103c1030 J2585A DeskDirect 10/100VG NIC 0 d 103c1031 J2585B HP 10/100VG PCI LAN Adapter 0 s 103c1031103c1040 J2973A DeskDirect 10BaseT NIC 0 s 103c1031103c1041 J2585B DeskDirect 10/100VG NIC 0 s 103c1031103c1042 J2970A DeskDirect 10BaseT/2 NIC 0 d 103c1040 J2973A DeskDirect 10BaseT NIC 0 d 103c1041 J2585B DeskDirect 10/100 NIC 0 d 103c1042 J2970A DeskDirect 10BaseT/2 NIC 0 d 103c1048 Diva Serial [GSP] Multiport UART 0 s 103c1048103c1049 Tosca Console 0 s 103c1048103c104a Tosca Secondary 0 s 103c1048103c104b Maestro SP2 0 s 103c1048103c1223 Halfdome Console 0 s 103c1048103c1226 Keystone SP2 0 s 103c1048103c1227 Powerbar SP2 0 s 103c1048103c1282 Everest SP2 0 d 103c1064 79C970 PCnet Ethernet Controller 0 d 103c108b Visualize FXe 0 d 103c10c1 NetServer Smart IRQ Router 0 d 103c10ed TopTools Remote Control 0 d 103c1200 82557B 10/100 NIC 0 d 103c1219 NetServer PCI Hot-Plug Controller 0 d 103c121a NetServer SMIC Controller 0 d 103c121b NetServer Legacy COM Port Decoder 0 d 103c121c NetServer PCI COM Port Decoder 0 d 103c1229 zx1 System Bus Adapter 0 d 103c122a zx1 I/O Controller 0 d 103c122e zx1 Local Bus Adapter 0 d 103c1290 Auxiliary Diva Serial Port 0 d 103c2910 E2910A PCIBus Exerciser 0 d 103c2925 E2925A 32 Bit, 33 MHzPCI Exerciser & Analyzer 0 v 103e Solliday Engineering 0 v 103f Synopsys/Logic Modeling Group 0 v 1040 Accelgraphics Inc. 0 v 1041 Computrend 0 v 1042 Micron 0 d 10421000 FDC 37C665 0 d 10421001 37C922 0 d 10423000 Samurai_0 0 d 10423010 Samurai_1 0 d 10423020 Samurai_IDE 0 v 1043 Asustek Computer, Inc. 0 d 10430675 ISDNLink P-IN100-ST-D 0 v 1044 Distributed Processing Technology 0 d 10441012 Domino RAID Engine 0 d 1044a400 SmartCache/Raid I-IV Controller 0 d 1044a500 PCI Bridge 0 d 1044a501 SmartRAID V Controller 0 s 1044a5011044c001 PM1554U2 Ultra2 Single Channel 0 s 1044a5011044c002 PM1654U2 Ultra2 Single Channel 0 s 1044a5011044c003 PM1564U3 Ultra3 Single Channel 0 s 1044a5011044c004 PM1564U3 Ultra3 Dual Channel 0 s 1044a5011044c005 PM1554U2 Ultra2 Single Channel (NON ACPI) 0 s 1044a5011044c00a PM2554U2 Ultra2 Single Channel 0 s 1044a5011044c00b PM2654U2 Ultra2 Single Channel 0 s 1044a5011044c00c PM2664U3 Ultra3 Single Channel 0 s 1044a5011044c00d PM2664U3 Ultra3 Dual Channel 0 s 1044a5011044c00e PM2554U2 Ultra2 Single Channel (NON ACPI) 0 s 1044a5011044c00f PM2654U2 Ultra2 Single Channel (NON ACPI) 0 s 1044a5011044c014 PM3754U2 Ultra2 Single Channel (NON ACPI) 0 s 1044a5011044c015 PM3755U2B Ultra2 Single Channel (NON ACPI) 0 s 1044a5011044c016 PM3755F Fibre Channel (NON ACPI) 0 s 1044a5011044c01e PM3757U2 Ultra2 Single Channel 0 s 1044a5011044c01f PM3757U2 Ultra2 Dual Channel 0 s 1044a5011044c020 PM3767U3 Ultra3 Dual Channel 0 s 1044a5011044c021 PM3767U3 Ultra3 Quad Channel 0 s 1044a5011044c028 PM2865U3 Ultra3 Single Channel 0 s 1044a5011044c029 PM2865U3 Ultra3 Dual Channel 0 s 1044a5011044c02a PM2865F Fibre Channel 0 s 1044a5011044c03c 2000S Ultra3 Single Channel 0 s 1044a5011044c03d 2000S Ultra3 Dual Channel 0 s 1044a5011044c03e 2000F Fibre Channel 0 s 1044a5011044c046 3000S Ultra3 Single Channel 0 s 1044a5011044c047 3000S Ultra3 Dual Channel 0 s 1044a5011044c048 3000F Fibre Channel 0 s 1044a5011044c050 5000S Ultra3 Single Channel 0 s 1044a5011044c051 5000S Ultra3 Dual Channel 0 s 1044a5011044c052 5000F Fibre Channel 0 s 1044a5011044c05a 2400A UDMA Four Channel 0 s 1044a5011044c05b 2400A UDMA Four Channel DAC 0 s 1044a5011044c064 3010S Ultra3 Dual Channel 0 s 1044a5011044c065 3010S Ultra3 Four Channel 0 s 1044a5011044c066 3010S Fibre Channel 0 d 1044a511 SmartRAID V Controller 0 v 1045 OPTi Inc. 0 d 1045a0f8 82C750 [Vendetta] USB Controller 0 d 1045c101 92C264 0 d 1045c178 92C178 0 d 1045c556 82X556 [Viper] 0 d 1045c557 82C557 [Viper-M] 0 d 1045c558 82C558 [Viper-M ISA+IDE] 0 d 1045c567 82C750 [Vendetta], device 0 0 d 1045c568 82C750 [Vendetta], device 1 0 d 1045c569 82C579 [Viper XPress+ Chipset] 0 d 1045c621 82C621 [Viper-M/N+] 0 d 1045c700 82C700 [FireStar] 0 d 1045c701 82C701 [FireStar Plus] 0 d 1045c814 82C814 [Firebridge 1] 0 d 1045c822 82C822 0 d 1045c824 82C824 0 d 1045c825 82C825 [Firebridge 2] 0 d 1045c832 82C832 0 d 1045c861 82C861 0 d 1045c895 82C895 0 d 1045c935 EV1935 ECTIVA MachOne PCI Audio 0 d 1045d568 82C825 [Firebridge 2] 0 d 1045d721 IDE [FireStar] 0 v 1046 IPC Corporation, Ltd. 0 v 1047 Genoa Systems Corp 0 v 1048 Elsa AG 0 d 10480d22 Quadro4 900XGL [ELSA GLoria4 900XGL] 0 d 10481000 QuickStep 1000 0 d 10483000 QuickStep 3000 0 v 1049 Fountain Technologies, Inc. 0 v 104a SGS Thomson Microelectronics 0 d 104a0008 STG 2000X 0 d 104a0009 STG 1764X 0 d 104a0010 STG4000 [3D Prophet Kyro Series] 1 d 104a0981 DEC-Tulip compatible 10/100 Ethernet 0 d 104a1746 STG 1764X 0 d 104a2774 DEC-Tulip compatible 10/100 Ethernet 0 d 104a3520 MPEG-II decoder card 0 v 104b BusLogic 0 d 104b0140 BT-946C (old) [multimaster 01] 0 d 104b1040 BT-946C (BA80C30) [MultiMaster 10] 0 d 104b8130 Flashpoint LT 0 v 104c Texas Instruments 0 d 104c0500 100 MBit LAN Controller 0 d 104c0508 TMS380C2X Compressor Interface 0 d 104c1000 Eagle i/f AS 0 d 104c3d04 TVP4010 [Permedia] 0 d 104c3d07 TVP4020 [Permedia 2] 0 s 104c3d0710114d10 Comet 0 s 104c3d071040000f AccelStar II 0 s 104c3d0710400011 AccelStar II 0 s 104c3d0710480a31 WINNER 2000 0 s 104c3d0710480a32 GLoria Synergy 0 s 104c3d0710480a35 GLoria Synergy 0 s 104c3d07107d2633 WinFast 3D L2300 0 s 104c3d0710920127 FIRE GL 1000 PRO 0 s 104c3d0710920136 FIRE GL 1000 PRO 0 s 104c3d0710920141 FIRE GL 1000 PRO 0 s 104c3d0710920146 FIRE GL 1000 PRO 0 s 104c3d0710920148 FIRE GL 1000 PRO 0 s 104c3d0710920149 FIRE GL 1000 PRO 0 s 104c3d0710920152 FIRE GL 1000 PRO 0 s 104c3d0710920154 FIRE GL 1000 PRO 0 s 104c3d0710920155 FIRE GL 1000 PRO 0 s 104c3d0710920156 FIRE GL 1000 PRO 0 s 104c3d0710920157 FIRE GL 1000 PRO 0 s 104c3d0710973d01 Jeronimo Pro 0 s 104c3d071102100f Graphics Blaster Extreme 0 s 104c3d073d3d0100 Reference Permedia 2 3D 0 d 104c8000 PCILynx/PCILynx2 IEEE 1394 Link Layer Controller 0 s 104c8000e4bf1010 CF1-1-SNARE 0 s 104c8000e4bf1020 CF1-2-SNARE 0 d 104c8009 FireWire Controller 0 s 104c8009104d8032 8032 OHCI i.LINK (IEEE 1394) Controller 0 d 104c8017 PCI4410 FireWire Controller 0 d 104c8019 TSB12LV23 IEEE-1394 Controller 0 s 104c801911bd000a Studio DV500-1394 0 s 104c801911bd000e Studio DV 0 s 104c8019e4bf1010 CF2-1-CYMBAL 0 d 104c8020 TSB12LV26 IEEE-1394 Controller (Link) 0 d 104c8021 TSB43AA22 IEEE-1394 Controller (PHY/Link Integrated) 0 s 104c8021104d80df Vaio PCG-FX403 0 s 104c8021104d80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP 0 d 104c8022 TSB43AB22 IEEE-1394a-2000 Controller (PHY/Link) 0 d 104c8023 TSB43AB22/A IEEE-1394a-2000 Controller (PHY/Link) 0 d 104c8024 TSB43AB23 IEEE-1394a-2000 Controller (PHY/Link) 0 d 104c8026 TSB43AB21 IEEE-1394a-2000 Controller (PHY/Link) 0 d 104c8027 PCI4451 IEEE-1394 Controller 0 s 104c8027102800e6 PCI4451 IEEE-1394 Controller (Dell Inspiron 8100) 0 d 104c8400 USR2210 22Mbps Wireless PC Card 0 d 104ca001 TDC1570 0 d 104ca100 TDC1561 0 d 104ca102 TNETA1575 HyperSAR Plus w/PCI Host i/f & UTOPIA i/f 0 d 104ca106 TMS320C6205 0 d 104cac10 PCI1050 0 d 104cac11 PCI1053 0 d 104cac12 PCI1130 0 d 104cac13 PCI1031 0 d 104cac15 PCI1131 0 d 104cac16 PCI1250 0 d 104cac17 PCI1220 0 d 104cac18 PCI1260 0 d 104cac19 PCI1221 0 d 104cac1a PCI1210 0 d 104cac1b PCI1450 0 d 104cac1c PCI1225 0 d 104cac1d PCI1251A 0 d 104cac1e PCI1211 0 d 104cac1f PCI1251B 0 d 104cac20 TI 2030 0 d 104cac21 PCI2031 0 d 104cac22 PCI2032 PCI Docking Bridge 0 d 104cac23 PCI2250 PCI-to-PCI Bridge 0 d 104cac28 PCI2050 PCI-to-PCI Bridge 0 d 104cac30 PCI1260 PC card Cardbus Controller 0 d 104cac40 PCI4450 PC card Cardbus Controller 0 d 104cac41 PCI4410 PC card Cardbus Controller 0 d 104cac42 PCI4451 PC card Cardbus Controller 0 s 104cac42102800e6 PCI4451 PC card CardBus Controller (Dell Inspiron 8100) 0 d 104cac50 PCI1410 PC card Cardbus Controller 0 d 104cac51 PCI1420 0 s 104cac511014023b ThinkPad T23 (2647-4MG) 0 s 104cac5110cf1095 Lifebook C6155 0 s 104cac51e4bf1000 CP2-2-HIPHOP 0 d 104cac52 PCI1451 PC card Cardbus Controller 0 d 104cac53 PCI1421 PC card Cardbus Controller 0 d 104cac55 PCI1250 PC card Cardbus Controller 0 s 104cac5510140512 ThinkPad T30 1 s 104cac55104cac55 PCI-1520 CardBus Controller 1 Windoze XP on my ThinkPad T30 claims that it is 1520, not 1250. d 104cac60 PCI2040 PCI to DSP Bridge Controller 0 d 104cfe00 FireWire Host Controller 0 d 104cfe03 12C01A FireWire Host Controller 0 v 104d Sony Corporation 0 d 104d8009 CXD1947Q i.LINK Controller 0 d 104d8039 CXD3222 i.LINK Controller 0 d 104d8056 Rockwell HCF 56K modem 0 d 104d808a Memory Stick Controller 0 v 104e Oak Technology, Inc 0 d 104e0017 OTI-64017 0 d 104e0107 OTI-107 [Spitfire] 0 d 104e0109 Video Adapter 0 d 104e0111 OTI-64111 [Spitfire] 0 d 104e0217 OTI-64217 0 d 104e0317 OTI-64317 0 v 104f Co-time Computer Ltd 0 v 1050 Winbond Electronics Corp 0 d 10500000 NE2000 0 d 10500001 W83769F 0 d 10500105 W82C105 0 d 10500840 W89C840 0 s 1050084010500001 W89C840 Ethernet Adapter 0 s 1050084010500840 W89C840 Ethernet Adapter 0 d 10500940 W89C940 0 d 10505a5a W89C940F 0 d 10506692 W6692 1 ISDN Card d 10509970 W9970CF 0 v 1051 Anigma, Inc. 0 v 1052 ?Young Micro Systems 0 v 1053 Young Micro Systems 0 v 1054 Hitachi, Ltd 0 v 1055 Efar Microsystems 0 d 10559130 SLC90E66 [Victory66] IDE 0 d 10559460 SLC90E66 [Victory66] ISA 0 d 10559462 SLC90E66 [Victory66] USB 0 d 10559463 SLC90E66 [Victory66] ACPI 0 v 1056 ICL 0 v 1057 Motorola 0 Motorola made a mistake and used 1507 instead of 1057 in some chips. Please look at the 1507 entry as well when updating this. d 10570001 MPC105 [Eagle] 0 d 10570002 MPC106 [Grackle] 0 d 10570003 MPC8240 [Kahlua] 0 d 10570004 MPC107 0 d 10570006 MPC8245 [Unity] 0 d 10570100 MC145575 [HFC-PCI] 0 d 10570431 KTI829c 100VG 0 d 10571801 Audio I/O Controller (MIDI) 0 s 10571801ecc00030 Layla 0 d 105718c0 MPC8265A/MPC8266 0 d 10574801 Raven 0 d 10574802 Falcon 0 d 10574803 Hawk 0 d 10574806 CPX8216 0 d 10574d68 20268 0 d 10575600 SM56 PCI Modem 0 s 1057560010570300 SM56 PCI Speakerphone Modem 0 s 1057560010570301 SM56 PCI Voice Modem 0 s 1057560010570302 SM56 PCI Fax Modem 0 s 1057560010575600 SM56 PCI Voice modem 0 s 1057560013d20300 SM56 PCI Speakerphone Modem 0 s 1057560013d20301 SM56 PCI Voice modem 0 s 1057560013d20302 SM56 PCI Fax Modem 0 s 1057560014360300 SM56 PCI Speakerphone Modem 0 s 1057560014360301 SM56 PCI Voice modem 0 s 1057560014360302 SM56 PCI Fax Modem 0 s 10575600144f100c SM56 PCI Fax Modem 0 s 1057560014940300 SM56 PCI Speakerphone Modem 0 s 1057560014940301 SM56 PCI Voice modem 0 s 1057560014c80300 SM56 PCI Speakerphone Modem 0 s 1057560014c80302 SM56 PCI Fax Modem 0 s 1057560016680300 SM56 PCI Speakerphone Modem 0 s 1057560016680302 SM56 PCI Fax Modem 0 d 10576400 MPC190 Security Processor (S1 family, encryption) 0 v 1058 Electronics & Telecommunications RSH 0 v 1059 Teknor Industrial Computers Inc 0 v 105a Promise Technology, Inc. 0 d 105a0d30 20265 0 s 105a0d30105a4d33 Ultra100 0 d 105a0d38 20263 0 s 105a0d38105a4d39 Fasttrak66 0 d 105a1275 20275 0 d 105a4d30 20267 0 s 105a4d30105a4d33 Ultra100 0 s 105a4d30105a4d39 Fasttrak100 0 d 105a4d33 20246 0 s 105a4d33105a4d33 20246 IDE Controller 0 d 105a4d38 20262 0 s 105a4d38105a4d30 Ultra Device on SuperTrak 0 s 105a4d38105a4d33 Ultra66 0 s 105a4d38105a4d39 Fasttrak66 0 d 105a4d68 20268 0 s 105a4d68105a4d68 Ultra100TX2 0 d 105a4d69 20269 0 d 105a5275 PDC20276 IDE 0 d 105a5275 PDC20276 (MBFastTrack 133) 1 I can't obtain the sub device ID's. The correction is for the "secondary" name (the one between parentheses). Have great day ! s 105a5275105a0275 SuperTrak SX6000 IDE 0 d 105a5300 DC5300 0 d 105a6268 20268R 0 d 105a6269 PDC20271 0 s 105a6269105a6269 Fasttrack tx2 0 s 105a6269105a6269 FastTrak TX2/TX2000 1 Old entry has spelling mistake; besides, another product (TX2000) uses same chips, hence the same ID d 105a7275 PDC20277 0 v 105b Foxconn International, Inc. 0 v 105c Wipro Infotech Limited 0 v 105d Number 9 Computer Company 0 d 105d2309 Imagine 128 0 d 105d2339 Imagine 128-II 0 s 105d2339105d0000 Imagine 128 series 2 4Mb VRAM 0 s 105d2339105d0001 Imagine 128 series 2 4Mb VRAM 0 s 105d2339105d0002 Imagine 128 series 2 4Mb VRAM 0 s 105d2339105d0003 Imagine 128 series 2 4Mb VRAM 0 s 105d2339105d0004 Imagine 128 series 2 4Mb VRAM 0 s 105d2339105d0005 Imagine 128 series 2 4Mb VRAM 0 s 105d2339105d0006 Imagine 128 series 2 4Mb VRAM 0 s 105d2339105d0007 Imagine 128 series 2 4Mb VRAM 0 s 105d2339105d0008 Imagine 128 series 2e 4Mb DRAM 0 s 105d2339105d0009 Imagine 128 series 2e 4Mb DRAM 0 s 105d2339105d000a Imagine 128 series 2 8Mb VRAM 0 s 105d2339105d000b Imagine 128 series 2 8Mb H-VRAM 0 s 105d233911a4000a Barco Metheus 5 Megapixel 0 s 105d233913cc0000 Barco Metheus 5 Megapixel 0 s 105d233913cc0004 Barco Metheus 5 Megapixel 0 s 105d233913cc0005 Barco Metheus 5 Megapixel 0 s 105d233913cc0006 Barco Metheus 5 Megapixel 0 s 105d233913cc0008 Barco Metheus 5 Megapixel 0 s 105d233913cc0009 Barco Metheus 5 Megapixel 0 s 105d233913cc000a Barco Metheus 5 Megapixel 0 s 105d233913cc000c Barco Metheus 5 Megapixel 0 d 105d493d Imagine 128 T2R [Ticket to Ride] 0 s 105d493d11a4000a Barco Metheus 5 Megapixel, Dual Head 0 s 105d493d11a4000b Barco Metheus 5 Megapixel, Dual Head 0 s 105d493d13cc0002 Barco Metheus 4 Megapixel, Dual Head 0 s 105d493d13cc0003 Barco Metheus 5 Megapixel, Dual Head 0 s 105d493d13cc0007 Barco Metheus 5 Megapixel, Dual Head 0 s 105d493d13cc0008 Barco Metheus 5 Megapixel, Dual Head 0 s 105d493d13cc0009 Barco Metheus 5 Megapixel, Dual Head 0 s 105d493d13cc000a Barco Metheus 5 Megapixel, Dual Head 0 d 105d5348 Revolution 4 0 v 105e Vtech Computers Ltd 0 v 105f Infotronic America Inc 0 v 1060 United Microelectronics [UMC] 0 d 10600001 UM82C881 0 d 10600002 UM82C886 0 d 10600101 UM8673F 0 d 10600881 UM8881 0 d 10600886 UM8886F 0 d 10600891 UM8891A 0 d 10601001 UM886A 0 d 1060673a UM8886BF 0 d 1060673b EIDE Master/DMA 0 d 10608710 UM8710 0 d 1060886a UM8886A 0 d 10608881 UM8881F 0 d 10608886 UM8886F 0 d 1060888a UM8886A 0 d 10608891 UM8891A 0 d 10609017 UM9017F 0 d 10609018 UM9018 0 d 10609026 UM9026 0 d 1060e881 UM8881N 0 d 1060e886 UM8886N 0 d 1060e88a UM8886N 0 d 1060e891 UM8891N 0 v 1061 I.I.T. 0 d 10610001 AGX016 0 d 10610002 IIT3204/3501 0 v 1062 Maspar Computer Corp 0 v 1063 Ocean Office Automation 0 v 1064 Alcatel 0 v 1065 Texas Microsystems 0 v 1066 PicoPower Technology 0 d 10660000 PT80C826 0 d 10660001 PT86C521 [Vesuvius v1] Host Bridge 0 d 10660002 PT86C523 [Vesuvius v3] PCI-ISA Bridge Master 0 d 10660003 PT86C524 [Nile] PCI-to-PCI Bridge 0 d 10660004 PT86C525 [Nile-II] PCI-to-PCI Bridge 0 d 10660005 National PC87550 System Controller 0 d 10668002 PT86C523 [Vesuvius v3] PCI-ISA Bridge Slave 0 v 1067 Mitsubishi Electric 0 d 10671002 VG500 [VolumePro Volume Rendering Accelerator] 0 v 1068 Diversified Technology 0 v 1069 Mylex Corporation 0 d 10690001 DAC960P 0 d 10690002 DAC960PD 0 d 10690010 DAC960PX 0 d 10690050 AcceleRAID 352/170/160 support Device 0 d 1069ba55 eXtremeRAID 1100 support Device 0 d 1069ba56 eXtremeRAID 2000/3000 support Device 0 v 106a Aten Research Inc 0 v 106b Apple Computer Inc. 0 d 106b0001 Bandit PowerPC host bridge 0 d 106b0002 Grand Central I/O 0 d 106b0003 Control Video 0 d 106b0004 PlanB Video-In 0 d 106b0007 O'Hare I/O 0 d 106b000e Hydra Mac I/O 0 d 106b0010 Heathrow Mac I/O 0 d 106b0017 Paddington Mac I/O 0 d 106b0018 UniNorth FireWire 0 d 106b0019 KeyLargo USB 0 d 106b001e UniNorth Internal PCI 0 d 106b001f UniNorth PCI 0 d 106b0020 UniNorth AGP 0 d 106b0021 UniNorth GMAC (Sun GEM) 0 d 106b0022 KeyLargo Mac I/O 0 d 106b0024 UniNorth/Pangea GMAC (Sun GEM) 0 d 106b0025 KeyLargo/Pangea Mac I/O 0 d 106b0026 KeyLargo/Pangea USB 0 d 106b0027 UniNorth/Pangea AGP 0 d 106b0028 UniNorth/Pangea PCI 0 d 106b0029 UniNorth/Pangea Internal PCI 0 d 106b002d UniNorth 1.5 AGP 0 d 106b002e UniNorth 1.5 PCI 0 d 106b002f UniNorth 1.5 Internal PCI 0 d 106b0030 UniNorth/Pangea FireWire 0 d 106b0031 UniNorth 2 FireWire 0 d 106b0032 UniNorth 2 GMAC (Sun GEM) 0 d 106b0033 UniNorth 2 ATA/100 0 d 106b0034 UniNorth 2 AGP 0 d 106b1645 Tigon3 Gigabit Ethernet NIC (BCM5701) 0 v 106c Hyundai Electronics America 0 d 106c8801 Dual Pentium ISA/PCI Motherboard 0 d 106c8802 PowerPC ISA/PCI Motherboard 0 d 106c8803 Dual Window Graphics Accelerator 0 d 106c8804 LAN Controller 0 d 106c8805 100-BaseT LAN 0 v 106d Sequent Computer Systems 0 v 106e DFI, Inc 0 v 106f City Gate Development Ltd 0 v 1070 Daewoo Telecom Ltd 0 v 1071 Mitac 0 v 1072 GIT Co Ltd 0 v 1073 Yamaha Corporation 0 d 10730001 3D GUI Accelerator 0 d 10730002 YGV615 [RPA3 3D-Graphics Controller] 0 d 10730003 YMF-740 0 d 10730004 YMF-724 0 s 1073000410730004 YMF724-Based PCI Audio Adapter 0 d 10730005 DS1 Audio 0 s 1073000510730005 DS-XG PCI Audio CODEC 0 d 10730006 DS1 Audio 0 d 10730008 DS1 Audio 0 s 1073000810730008 DS-XG PCI Audio CODEC 0 d 1073000a DS1L Audio 0 s 1073000a10730004 DS-XG PCI Audio CODEC 0 s 1073000a1073000a DS-XG PCI Audio CODEC 0 d 1073000c YMF-740C [DS-1L Audio Controller] 0 s 1073000c107a000c DS-XG PCI Audio CODEC 0 d 1073000d YMF-724F [DS-1 Audio Controller] 0 s 1073000d1073000d DS-XG PCI Audio CODEC 0 d 10730010 YMF-744B [DS-1S Audio Controller] 0 s 1073001010730006 DS-XG PCI Audio CODEC 0 s 1073001010730010 DS-XG PCI Audio CODEC 0 d 10730012 YMF-754 [DS-1E Audio Controller] 0 s 1073001210730012 DS-XG PCI Audio Codec 0 d 10730020 DS-1 Audio 0 d 10732000 DS2416 Digital Mixing Card 0 s 1073200010732000 DS2416 Digital Mixing Card 0 v 1074 NexGen Microsystems 0 d 10744e78 82c500/1 0 v 1075 Advanced Integrations Research 0 v 1076 Chaintech Computer Co. Ltd 0 v 1077 QLogic Corp. 0 d 10771016 ISP10160 Single Channel Ultra3 SCSI Processor 0 d 10771020 ISP1020 Fast-wide SCSI 0 d 10771022 ISP1022 Fast-wide SCSI 0 d 10771080 ISP1080 SCSI Host Adapter 0 d 10771216 ISP12160 Dual Channel Ultra3 SCSI Processor 0 s 10771216101e8471 QLA12160 on AMI MegaRAID 0 s 10771216101e8493 QLA12160 on AMI MegaRAID 0 d 10771240 ISP1240 SCSI Host Adapter 0 d 10771280 ISP1280 0 d 10772020 ISP2020A Fast!SCSI Basic Adapter 0 d 10772100 QLA2100 64-bit Fibre Channel Adapter 0 s 1077210010770001 QLA2100 64-bit Fibre Channel Adapter 0 d 10772200 QLA2200 0 d 10772300 QLA2300 64-bit FC-AL Adapter 0 d 10772312 QLA2312 Fibre Channel Adapter 0 v 1078 Cyrix Corporation 0 d 10780000 5510 [Grappa] 0 d 10780001 PCI Master 0 d 10780002 5520 [Cognac] 0 d 10780100 5530 Legacy [Kahlua] 0 d 10780101 5530 SMI [Kahlua] 0 d 10780102 5530 IDE [Kahlua] 0 d 10780103 5530 Audio [Kahlua] 0 d 10780104 5530 Video [Kahlua] 0 d 10780400 ZFMicro PCI Bridge 0 d 10780401 ZFMicro Chipset SMI 0 d 10780402 ZFMicro Chipset IDE 0 d 10780403 ZFMicro Expansion Bus 0 v 1079 I-Bus 0 v 107a NetWorth 0 v 107b Gateway 2000 0 v 107c LG Electronics [Lucky Goldstar Co. Ltd] 0 v 107d LeadTek Research Inc. 0 d 107d0000 P86C850 0 v 107e Interphase Corporation 0 d 107e0001 5515 ATM Adapter [Flipper] 0 d 107e0002 100 VG AnyLan Controller 0 d 107e0004 5526 Fibre Channel Host Adapter 0 d 107e0005 x526 Fibre Channel Host Adapter 0 d 107e0008 5525/5575 ATM Adapter (155 Mbit) [Atlantic] 0 d 107e9003 5535-4P-BRI-ST 0 d 107e9007 5535-4P-BRI-U 0 d 107e9008 5535-1P-SR 0 d 107e900c 5535-1P-SR-ST 0 d 107e900e 5535-1P-SR-U 0 d 107e9011 5535-1P-PRI 0 d 107e9013 5535-2P-PRI 0 d 107e9023 5536-4P-BRI-ST 0 d 107e9027 5536-4P-BRI-U 0 d 107e9031 5536-1P-PRI 0 d 107e9033 5536-2P-PRI 0 v 107f Data Technology Corporation 0 d 107f0802 SL82C105 0 v 1080 Contaq Microsystems 0 d 10800600 82C599 0 d 1080c691 Cypress CY82C691 0 d 1080c693 82c693 0 v 1081 Supermac Technology 0 d 10810d47 Radius PCI to NuBUS Bridge 0 v 1082 EFA Corporation of America 0 v 1083 Forex Computer Corporation 0 d 10830001 FR710 0 v 1084 Parador 0 v 1085 Tulip Computers Int.B.V. 0 v 1086 J. Bond Computer Systems 0 v 1087 Cache Computer 0 v 1088 Microcomputer Systems (M) Son 0 v 1089 Data General Corporation 0 v 108a SBS Technologies 0 Formerly Bit3 Computer Corp. d 108a0001 VME Bridge Model 617 0 d 108a0010 VME Bridge Model 618 0 d 108a0040 dataBLIZZARD 0 d 108a3000 VME Bridge Model 2706 0 v 108c Oakleigh Systems Inc. 0 v 108d Olicom 0 d 108d0001 Token-Ring 16/4 PCI Adapter (3136/3137) 0 d 108d0002 16/4 Token Ring 0 d 108d0004 RapidFire 3139 Token-Ring 16/4 PCI Adapter 0 s 108d0004108d0004 OC-3139/3140 RapidFire Token-Ring 16/4 Adapter 0 d 108d0005 GoCard 3250 Token-Ring 16/4 CardBus PC Card 0 d 108d0006 OC-3530 RapidFire Token-Ring 100 0 d 108d0007 RapidFire 3141 Token-Ring 16/4 PCI Fiber Adapter 0 s 108d0007108d0007 OC-3141 RapidFire Token-Ring 16/4 Adapter 0 d 108d0008 RapidFire 3540 HSTR 100/16/4 PCI Adapter 0 s 108d0008108d0008 OC-3540 RapidFire HSTR 100/16/4 Adapter 0 d 108d0011 OC-2315 0 d 108d0012 OC-2325 0 d 108d0013 OC-2183/2185 0 d 108d0014 OC-2326 0 d 108d0019 OC-2327/2250 10/100 Ethernet Adapter 0 s 108d0019108d0016 OC-2327 Rapidfire 10/100 Ethernet Adapter 0 s 108d0019108d0017 OC-2250 GoCard 10/100 Ethernet Adapter 0 d 108d0021 OC-6151/6152 [RapidFire ATM 155] 0 d 108d0022 ATM Adapter 0 v 108e Sun Microsystems Computer Corp. 0 d 108e0001 EBUS 0 d 108e1000 EBUS 0 d 108e1001 Happy Meal 0 d 108e1100 RIO EBUS 0 d 108e1101 RIO GEM 0 d 108e1102 RIO 1394 0 d 108e1103 RIO USB 0 d 108e2bad GEM 0 d 108e5000 Simba Advanced PCI Bridge 0 d 108e5043 SunPCI Co-processor 0 d 108e8000 Psycho PCI Bus Module 0 d 108e8001 Schizo PCI Bus Module 0 d 108ea000 Ultra IIi 0 d 108ea001 Ultra IIe 0 v 108f Systemsoft 0 v 1090 Encore Computer Corporation 0 v 1091 Intergraph Corporation 0 d 10910020 3D graphics processor 0 d 10910021 3D graphics processor w/Texturing 0 d 10910040 3D graphics frame buffer 0 d 10910041 3D graphics frame buffer 0 d 10910060 Proprietary bus bridge 0 d 109100e4 Powerstorm 4D50T 0 d 10910720 Motion JPEG codec 0 v 1092 Diamond Multimedia Systems 0 d 109200a0 Speedstar Pro SE 0 d 109200a8 Speedstar 64 0 d 10920550 Viper V550 0 d 109208d4 Supra 2260 Modem 0 d 1092094c SupraExpress 56i Pro 0 d 10921092 Viper V330 0 d 10926120 Maximum DVD 0 d 10928810 Stealth SE 0 d 10928811 Stealth 64/SE 0 d 10928880 Stealth 0 d 10928881 Stealth 0 d 109288b0 Stealth 64 0 d 109288b1 Stealth 64 0 d 109288c0 Stealth 64 0 d 109288c1 Stealth 64 0 d 109288d0 Stealth 64 0 d 109288d1 Stealth 64 0 d 109288f0 Stealth 64 0 d 109288f1 Stealth 64 0 d 10929999 DMD-I0928-1 "Monster sound" sound chip 0 v 1093 National Instruments 0 d 10930160 PCI-DIO-96 0 d 10930162 PCI-MIO-16XE-50 0 d 10931170 PCI-MIO-16XE-10 0 d 10931180 PCI-MIO-16E-1 0 d 10931190 PCI-MIO-16E-4 0 d 10931330 PCI-6031E 0 d 10931350 PCI-6071E 0 d 10932a60 PCI-6023E 0 d 1093b001 IMAQ-PCI-1408 0 d 1093b011 IMAQ-PXI-1408 0 d 1093b021 IMAQ-PCI-1424 0 d 1093b031 IMAQ-PCI-1413 0 d 1093b041 IMAQ-PCI-1407 0 d 1093b051 IMAQ-PXI-1407 0 d 1093b061 IMAQ-PCI-1411 0 d 1093b071 IMAQ-PCI-1422 0 d 1093b081 IMAQ-PXI-1422 0 d 1093b091 IMAQ-PXI-1411 0 d 1093c801 PCI-GPIB 0 d 1093c831 PCI-GPIB bridge 0 v 1094 First International Computers [FIC] 0 v 1095 CMD Technology Inc 0 d 10950640 PCI0640 0 d 10950643 PCI0643 0 d 10950646 PCI0646 0 d 10950647 PCI0647 0 d 10950648 PCI0648 0 d 10950649 PCI0649 0 s 109506490e11005d Integrated Ultra ATA-100 Dual Channel Controller 0 s 109506490e11007e Integrated Ultra ATA-100 IDE RAID Controller 0 s 10950649101e0649 AMI MegaRAID IDE 100 Controller 0 d 10950650 PBC0650A 0 d 10950670 USB0670 0 s 1095067010950670 USB0670 0 d 10950673 USB0673 0 d 10950680 PCI0680 0 v 1096 Alacron 0 v 1097 Appian Technology 0 v 1098 Quantum Designs (H.K.) Ltd 0 d 10980001 QD-8500 0 d 10980002 QD-8580 0 v 1099 Samsung Electronics Co., Ltd 0 v 109a Packard Bell 0 v 109b Gemlight Computer Ltd. 0 v 109c Megachips Corporation 0 v 109d Zida Technologies Ltd. 0 v 109e Brooktree Corporation 0 d 109e0350 Bt848 Video Capture 0 d 109e0351 Bt849A Video capture 0 d 109e0369 Bt878 Video Capture 0 s 109e036910020001 TV-Wonder 0 s 109e036910020003 TV-Wonder/VE 0 d 109e036c Bt879(??) Video Capture 0 s 109e036c13e90070 Win/TV (Video Section) 0 d 109e036e Bt878 Video Capture 0 s 109e036e007013eb WinTV/GO 0 s 109e036e0070ff01 Viewcast Osprey 200 0 s 109e036e11bd001c PCTV Sat (DBC receiver) 0 s 109e036e127a0001 Bt878 Mediastream Controller NTSC 0 s 109e036e127a0002 Bt878 Mediastream Controller PAL BG 0 s 109e036e127a0003 Bt878a Mediastream Controller PAL BG 0 s 109e036e127a0048 Bt878/832 Mediastream Controller 0 s 109e036e144f3000 MagicTView CPH060 - Video 0 s 109e036e14610004 AVerTV WDM Video Capture 0 s 109e036e14f10001 Bt878 Mediastream Controller NTSC 0 s 109e036e14f10002 Bt878 Mediastream Controller PAL BG 0 s 109e036e14f10003 Bt878a Mediastream Controller PAL BG 0 s 109e036e14f10048 Bt878/832 Mediastream Controller 0 s 109e036e18511850 FlyVideo'98 - Video 0 s 109e036e18511851 FlyVideo II 0 s 109e036e18521852 FlyVideo'98 - Video (with FM Tuner) 0 s 109e036ebd111200 PCTV pro (TV + FM stereo receiver) 1 d 109e036f Bt879 Video Capture 0 s 109e036f127a0044 Bt879 Video Capture NTSC 0 s 109e036f127a0122 Bt879 Video Capture PAL I 0 s 109e036f127a0144 Bt879 Video Capture NTSC 0 s 109e036f127a0222 Bt879 Video Capture PAL BG 0 s 109e036f127a0244 Bt879a Video Capture NTSC 0 s 109e036f127a0322 Bt879 Video Capture NTSC 0 s 109e036f127a0422 Bt879 Video Capture NTSC 0 s 109e036f127a1122 Bt879 Video Capture PAL I 0 s 109e036f127a1222 Bt879 Video Capture PAL BG 0 s 109e036f127a1322 Bt879 Video Capture NTSC 0 s 109e036f127a1522 Bt879a Video Capture PAL I 0 s 109e036f127a1622 Bt879a Video Capture PAL BG 0 s 109e036f127a1722 Bt879a Video Capture NTSC 0 s 109e036f14f10044 Bt879 Video Capture NTSC 0 s 109e036f14f10122 Bt879 Video Capture PAL I 0 s 109e036f14f10144 Bt879 Video Capture NTSC 0 s 109e036f14f10222 Bt879 Video Capture PAL BG 0 s 109e036f14f10244 Bt879a Video Capture NTSC 0 s 109e036f14f10322 Bt879 Video Capture NTSC 0 s 109e036f14f10422 Bt879 Video Capture NTSC 0 s 109e036f14f11122 Bt879 Video Capture PAL I 0 s 109e036f14f11222 Bt879 Video Capture PAL BG 0 s 109e036f14f11322 Bt879 Video Capture NTSC 0 s 109e036f14f11522 Bt879a Video Capture PAL I 0 s 109e036f14f11622 Bt879a Video Capture PAL BG 0 s 109e036f14f11722 Bt879a Video Capture NTSC 0 s 109e036f18511850 FlyVideo'98 - Video 0 s 109e036f18511851 FlyVideo II 0 s 109e036f18521852 FlyVideo'98 - Video (with FM Tuner) 0 d 109e0370 Bt880 Video Capture 0 s 109e037018511850 FlyVideo'98 0 s 109e037018511851 FlyVideo'98 EZ - video 0 s 109e037018521852 FlyVideo'98 (with FM Tuner) 0 d 109e0878 Bt878 Audio Capture 0 s 109e0878007013eb WinTV/GO 0 s 109e08780070ff01 Viewcast Osprey 200 0 s 109e087810020001 TV-Wonder 0 s 109e087810020003 TV-Wonder/VE 0 s 109e087811bd001c PCTV Sat (DBC receiver) 0 s 109e0878127a0001 Bt878 Video Capture (Audio Section) 0 s 109e0878127a0002 Bt878 Video Capture (Audio Section) 0 s 109e0878127a0003 Bt878 Video Capture (Audio Section) 0 s 109e0878127a0048 Bt878 Video Capture (Audio Section) 0 s 109e087813e90070 Win/TV (Audio Section) 0 s 109e0878144f3000 MagicTView CPH060 - Audio 0 s 109e087814610004 AVerTV WDM Audio Capture 0 s 109e087814f10001 Bt878 Video Capture (Audio Section) 0 s 109e087814f10002 Bt878 Video Capture (Audio Section) 0 s 109e087814f10003 Bt878 Video Capture (Audio Section) 0 s 109e087814f10048 Bt878 Video Capture (Audio Section) 0 s 109e0878bd111200 PCTV pro (TV + FM stereo receiver) 1 s 109e0878bd111200 PCTV pro (TV + FM stereo receiver, audio section) 1 d 109e0879 Bt879 Audio Capture 0 s 109e0879127a0044 Bt879 Video Capture (Audio Section) 0 s 109e0879127a0122 Bt879 Video Capture (Audio Section) 0 s 109e0879127a0144 Bt879 Video Capture (Audio Section) 0 s 109e0879127a0222 Bt879 Video Capture (Audio Section) 0 s 109e0879127a0244 Bt879 Video Capture (Audio Section) 0 s 109e0879127a0322 Bt879 Video Capture (Audio Section) 0 s 109e0879127a0422 Bt879 Video Capture (Audio Section) 0 s 109e0879127a1122 Bt879 Video Capture (Audio Section) 0 s 109e0879127a1222 Bt879 Video Capture (Audio Section) 0 s 109e0879127a1322 Bt879 Video Capture (Audio Section) 0 s 109e0879127a1522 Bt879 Video Capture (Audio Section) 0 s 109e0879127a1622 Bt879 Video Capture (Audio Section) 0 s 109e0879127a1722 Bt879 Video Capture (Audio Section) 0 s 109e087914f10044 Bt879 Video Capture (Audio Section) 0 s 109e087914f10122 Bt879 Video Capture (Audio Section) 0 s 109e087914f10144 Bt879 Video Capture (Audio Section) 0 s 109e087914f10222 Bt879 Video Capture (Audio Section) 0 s 109e087914f10244 Bt879 Video Capture (Audio Section) 0 s 109e087914f10322 Bt879 Video Capture (Audio Section) 0 s 109e087914f10422 Bt879 Video Capture (Audio Section) 0 s 109e087914f11122 Bt879 Video Capture (Audio Section) 0 s 109e087914f11222 Bt879 Video Capture (Audio Section) 0 s 109e087914f11322 Bt879 Video Capture (Audio Section) 0 s 109e087914f11522 Bt879 Video Capture (Audio Section) 0 s 109e087914f11622 Bt879 Video Capture (Audio Section) 0 s 109e087914f11722 Bt879 Video Capture (Audio Section) 0 d 109e0880 Bt880 Audio Capture 0 d 109e2115 BtV 2115 Mediastream controller 0 d 109e2125 BtV 2125 Mediastream controller 0 d 109e2164 BtV 2164 0 d 109e2165 BtV 2165 0 d 109e8230 Bt8230 ATM Segment/Reassembly Ctrlr (SRC) 0 d 109e8472 Bt8472 0 d 109e8474 Bt8474 0 v 109f Trigem Computer Inc. 0 v 10a0 Meidensha Corporation 0 v 10a1 Juko Electronics Ind. Co. Ltd 0 v 10a2 Quantum Corporation 0 v 10a3 Everex Systems Inc 0 v 10a4 Globe Manufacturing Sales 0 v 10a5 Racal Interlan 0 v 10a6 Informtech Industrial Ltd. 0 v 10a7 Benchmarq Microelectronics 0 v 10a8 Sierra Semiconductor 0 d 10a80000 STB Horizon 64 0 v 10a9 Silicon Graphics, Inc. 0 d 10a90001 Crosstalk to PCI Bridge 0 d 10a90002 Linc I/O controller 0 d 10a90003 IOC3 I/O controller 0 d 10a90004 O2 MACE 0 d 10a90005 RAD Audio 0 d 10a90006 HPCEX 0 d 10a90007 RPCEX 0 d 10a90008 DiVO VIP 0 d 10a90009 Alteon Gigabit Ethernet 0 d 10a90010 AMP Video I/O 0 d 10a90011 GRIP 0 d 10a90012 SGH PSHAC GSN 0 d 10a91001 Magic Carpet 0 d 10a91002 Lithium 0 d 10a91003 Dual JPEG 1 0 d 10a91004 Dual JPEG 2 0 d 10a91005 Dual JPEG 3 0 d 10a91006 Dual JPEG 4 0 d 10a91007 Dual JPEG 5 0 d 10a91008 Cesium 0 d 10a92001 Fibre Channel 0 d 10a92002 ASDE 0 d 10a98001 O2 1394 0 d 10a98002 G-net NT 0 v 10aa ACC Microelectronics 0 d 10aa0000 ACCM 2188 0 v 10ab Digicom 0 v 10ac Honeywell IAC 0 v 10ad Symphony Labs 0 d 10ad0001 W83769F 0 d 10ad0003 SL82C103 0 d 10ad0005 SL82C105 0 d 10ad0103 SL82c103 0 d 10ad0105 SL82c105 0 d 10ad0565 W83C553 0 v 10ae Cornerstone Technology 0 v 10af Micro Computer Systems Inc 0 v 10b0 CardExpert Technology 0 v 10b1 Cabletron Systems Inc 0 v 10b2 Raytheon Company 0 v 10b3 Databook Inc 0 d 10b33106 DB87144 0 d 10b3b106 DB87144 0 v 10b4 STB Systems Inc 0 d 10b41b1d Velocity 128 3D 0 s 10b41b1d10b4237e Velocity 4400 0 v 10b5 PLX Technology, Inc. 0 d 10b50001 i960 PCI bus interface 0 d 10b51076 VScom 800 8 port serial adaptor 0 d 10b51077 VScom 400 4 port serial adaptor 0 d 10b51078 VScom 210 2 port serial and 1 port parallel adaptor 0 d 10b51103 VScom 200 2 port serial adaptor 0 d 10b51146 VScom 010 1 port parallel adaptor 0 d 10b51147 VScom 020 2 port parallel adaptor 0 d 10b52724 Thales PCSM Security Card 0 d 10b58845 RCIM Realtime Clock and Interrupts Module 1 d 10b59030 PCI <-> IOBus Bridge Hot Swap 0 s 10b5903015ed1002 MCCS 8-port Serial Hot Swap 0 s 10b5903015ed1003 MCCS 16-port Serial Hot Swap 0 d 10b59036 9036 0 d 10b59050 PCI <-> IOBus Bridge 0 s 10b5905010b52273 SH-ARC SoHard ARCnet card 0 s 10b5905015220001 RockForce 4 Port V.90 Data/Fax/Voice Modem 0 s 10b5905015220002 RockForce 2 Port V.90 Data/Fax/Voice Modem 0 s 10b5905015220003 RockForce 6 Port V.90 Data/Fax/Voice Modem 0 s 10b5905015220004 RockForce 8 Port V.90 Data/Fax/Voice Modem 0 s 10b5905015220010 RockForce2000 4 Port V.90 Data/Fax/Voice Modem 0 s 10b5905015220020 RockForce2000 2 Port V.90 Data/Fax/Voice Modem 0 s 10b5905015ed1000 Macrolink MCCS 8-port Serial 0 s 10b5905015ed1001 Macrolink MCCS 16-port Serial 0 s 10b5905015ed1002 Macrolink MCCS 8-port Serial Hot Swap 0 s 10b5905015ed1003 Macrolink MCCS 16-port Serial Hot Swap 0 s 10b59050d531c002 PCIntelliCAN 2xSJA1000 CAN bus 0 s 10b59050d84d4006 EX-4006 1P 0 s 10b59050d84d4008 EX-4008 1P EPP/ECP 0 s 10b59050d84d4014 EX-4014 2P 0 s 10b59050d84d4018 EX-4018 3P EPP/ECP 0 s 10b59050d84d4025 EX-4025 1S(16C550) RS-232 0 s 10b59050d84d4027 EX-4027 1S(16C650) RS-232 0 s 10b59050d84d4028 EX-4028 1S(16C850) RS-232 0 s 10b59050d84d4036 EX-4036 2S(16C650) RS-232 0 s 10b59050d84d4037 EX-4037 2S(16C650) RS-232 0 s 10b59050d84d4038 EX-4038 2S(16C850) RS-232 0 s 10b59050d84d4052 EX-4052 1S(16C550) RS-422/485 0 s 10b59050d84d4053 EX-4053 2S(16C550) RS-422/485 0 s 10b59050d84d4055 EX-4055 4S(16C550) RS-232 0 s 10b59050d84d4058 EX-4055 4S(16C650) RS-232 0 s 10b59050d84d4065 EX-4065 8S(16C550) RS-232 0 s 10b59050d84d4068 EX-4068 8S(16C650) RS-232 0 s 10b59050d84d4078 EX-4078 2S(16C552) RS-232+1P 0 d 10b59054 PCI <-> IOBus Bridge 0 s 10b5905410b52455 Wessex Techology PHIL-PCI 0 d 10b59060 9060 0 d 10b5906d 9060SD 0 s 10b5906d125c0640 Aries 16000P 0 d 10b5906e 9060ES 0 d 10b59080 9080 0 s 10b5908010b59080 9080 [real subsystem ID not set] 0 s 10b59080129d0002 Aculab PCI Prosidy card 0 v 10b6 Madge Networks 0 d 10b60001 Smart 16/4 PCI Ringnode 0 d 10b60002 Smart 16/4 PCI Ringnode Mk2 0 s 10b6000210b60002 Smart 16/4 PCI Ringnode Mk2 0 s 10b6000210b60006 16/4 CardBus Adapter 0 d 10b60003 Smart 16/4 PCI Ringnode Mk3 0 s 10b600030e11b0fd Compaq NC4621 PCI, 4/16, WOL 0 s 10b6000310b60003 Smart 16/4 PCI Ringnode Mk3 0 s 10b6000310b60007 Presto PCI Plus Adapter 0 d 10b60004 Smart 16/4 PCI Ringnode Mk1 0 d 10b60006 16/4 Cardbus Adapter 0 s 10b6000610b60006 16/4 CardBus Adapter 0 d 10b60007 Presto PCI Adapter 0 s 10b6000710b60007 Presto PCI 0 d 10b60009 Smart 100/16/4 PCI-HS Ringnode 0 s 10b6000910b60009 Smart 100/16/4 PCI-HS Ringnode 0 d 10b6000a Smart 100/16/4 PCI Ringnode 0 s 10b6000a10b6000a Smart 100/16/4 PCI Ringnode 0 d 10b6000b 16/4 CardBus Adapter Mk2 0 s 10b6000b10b60008 16/4 CardBus Adapter Mk2 0 s 10b6000b10b6000b 16/4 Cardbus Adapter Mk2 0 d 10b6000c RapidFire 3140V2 16/4 TR Adapter 0 s 10b6000c10b6000c RapidFire 3140V2 16/4 TR Adapter 0 d 10b61000 Collage 25/155 ATM Client Adapter 0 d 10b61001 Collage 155 ATM Server Adapter 0 v 10b7 3Com Corporation 0 d 10b70001 3c985 1000BaseSX (SX/TX) 0 d 10b71006 MINI PCI type 3B Data Fax Modem 0 d 10b71007 Mini PCI 56k Winmodem 0 s 10b7100710b7615c Mini PCI 56K Modem 0 d 10b73390 3c339 TokenLink Velocity 0 d 10b73590 3c359 TokenLink Velocity XL 0 s 10b7359010b73590 TokenLink Velocity XL Adapter (3C359/359B) 0 d 10b74500 3c450 Cyclone/unknown 0 d 10b75055 3c555 Laptop Hurricane 0 d 10b75057 3c575 [Megahertz] 10/100 LAN CardBus 0 s 10b7505710b75a57 3C575 Megahertz 10/100 LAN Cardbus PC Card 0 d 10b75157 3c575 [Megahertz] 10/100 LAN CardBus 0 s 10b7515710b75b57 3C575 Megahertz 10/100 LAN Cardbus PC Card 0 d 10b75257 3CCFE575CT Cyclone CardBus 0 s 10b7525710b75c57 FE575C-3Com 10/100 LAN CardBus-Fast Ethernet 0 d 10b75900 3c590 10BaseT [Vortex] 0 d 10b75920 3c592 EISA 10mbps Demon/Vortex 0 d 10b75950 3c595 100BaseTX [Vortex] 0 d 10b75951 3c595 100BaseT4 [Vortex] 0 d 10b75952 3c595 100Base-MII [Vortex] 0 d 10b75970 3c597 EISA Fast Demon/Vortex 0 d 10b75b57 3c595 [Megahertz] 10/100 LAN CardBus 0 s 10b75b5710b75b57 3C575 Megahertz 10/100 LAN Cardbus PC Card 0 d 10b76055 3c556 Hurricane CardBus 0 d 10b76056 3c556B Hurricane CardBus 0 s 10b7605610b76556 10/100 Mini PCI Ethernet Adapter 0 d 10b76560 3CCFE656 Cyclone CardBus 0 s 10b7656010b7656a 3CCFEM656 10/100 LAN+56K Modem CardBus 0 d 10b76561 3CCFEM656 10/100 LAN+56K Modem CardBus 0 s 10b7656110b7656b 3CCFEM656 10/100 LAN+56K Modem CardBus 0 d 10b76562 3CCFEM656 [id 6562] Cyclone CardBus 0 s 10b7656210b7656b 3CCFEM656B 10/100 LAN+56K Modem CardBus 0 d 10b76563 3CCFEM656B 10/100 LAN+56K Modem CardBus 0 s 10b7656310b7656b 3CCFEM656 10/100 LAN+56K Modem CardBus 0 d 10b76564 3CCFEM656 [id 6564] Cyclone CardBus 0 d 10b77646 3cSOHO100-TX Hurricane 0 d 10b77940 3c803 FDDILink UTP Controller 0 d 10b77980 3c804 FDDILink SAS Controller 0 d 10b77990 3c805 FDDILink DAS Controller 0 d 10b78811 Token ring 0 d 10b79000 3c900 10BaseT [Boomerang] 0 d 10b79001 3c900 Combo [Boomerang] 0 d 10b79004 3c900B-TPO [Etherlink XL TPO] 0 s 10b7900410b79004 3C900B-TPO Etherlink XL TPO 10Mb 0 d 10b79005 3c900B-Combo [Etherlink XL Combo] 0 s 10b7900510b79005 3C900B-Combo Etherlink XL Combo 0 d 10b79006 3c900B-TPC [Etherlink XL TPC] 0 d 10b7900a 3c900B-FL [Etherlink XL FL] 0 d 10b79050 3c905 100BaseTX [Boomerang] 0 d 10b79051 3c905 100BaseT4 [Boomerang] 0 d 10b79055 3c905B 100BaseTX [Cyclone] 0 s 10b7905510280080 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280081 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280082 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280083 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280084 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280085 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280086 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280087 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280088 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280089 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280090 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280091 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280092 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280093 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280094 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280095 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280096 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280097 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280098 3C905B Fast Etherlink XL 10/100 0 s 10b7905510280099 3C905B Fast Etherlink XL 10/100 0 s 10b7905510b79055 3C905B Fast Etherlink XL 10/100 0 d 10b79056 3c905B-T4 [Fast EtherLink XL 10/100] 0 d 10b79058 3c905B-Combo [Deluxe Etherlink XL 10/100] 0 d 10b7905a 3c905B-FX [Fast Etherlink XL FX 10/100] 0 d 10b79200 3c905C-TX/TX-M [Tornado] 0 s 10b7920010280095 Integrated 3C905C-TX Fast Etherlink for PC Management NIC 0 s 10b7920010b71000 3C905C-TX Fast Etherlink for PC Management NIC 0 s 10b7920010b77000 10/100 Mini PCI Ethernet Adapter 0 d 10b79300 3CSOHO100B-TX [910-A01] 1 Designed for Windows-based networks. Is there driver for linux? d 10b79800 3c980-TX [Fast Etherlink XL Server Adapter] 0 s 10b7980010b79800 3c980-TX Fast Etherlink XL Server Adapter 0 d 10b79805 3c980-TX 10/100baseTX NIC [Python-T] 0 s 10b7980510b71201 3c982-TXM 10/100baseTX Dual Port A [Hydra] 0 s 10b7980510b71202 3c982-TXM 10/100baseTX Dual Port B [Hydra] 0 s 10b7980510b79805 3c980 10/100baseTX NIC [Python-T] 0 d 10b79900 3C990-TX [Typhoon] 0 d 10b79902 3CR990-TX-95 [Typhoon 56-bit] 0 d 10b79903 3CR990-TX-97 [Typhoon 168-bit] 0 d 10b79904 3C990B-TX-M/3C990BSVR [Typhoon2] 0 s 10b7990410b71000 3CR990B-TX-M [Typhoon2] 0 s 10b7990410b72000 3CR990BSVR [Typhoon2 Server] 0 d 10b79905 3CR990-FX-95/97/95 [Typhon Fiber] 0 s 10b7990510b71101 3CR990-FX-95 [Typhoon Fiber 56-bit] 0 s 10b7990510b71102 3CR990-FX-97 [Typhoon Fiber 168-bit] 0 s 10b7990510b72101 3CR990-FX-95 Server [Typhoon Fiber 56-bit] 0 s 10b7990510b72102 3CR990-FX-97 Server [Typhoon Fiber 168-bit] 0 d 10b79908 3CR990SVR95 [Typhoon Server 56-bit] 0 d 10b79909 3CR990SVR97 [Typhoon Server 168-bit] 0 d 10b7990b 3C990SVR [Typhoon Server] 0 v 10b8 Standard Microsystems Corp [SMC] 0 d 10b80005 83C170QF 0 s 10b800051055e000 LANEPIC 10/100 [EVB171Q-PCI] 0 s 10b800051055e002 LANEPIC 10/100 [EVB171G-PCI] 0 s 10b8000510b8a011 EtherPower II 10/100 0 s 10b8000510b8a014 EtherPower II 10/100 0 s 10b8000510b8a015 EtherPower II 10/100 0 s 10b8000510b8a016 EtherPower II 10/100 0 s 10b8000510b8a017 EtherPower II 10/100 0 d 10b80006 LANEPIC 0 s 10b800061055e100 LANEPIC Cardbus Fast Ethernet Adapter 0 s 10b800061055e102 LANEPIC Cardbus Fast Ethernet Adapter 0 s 10b800061055e300 LANEPIC Cardbus Fast Ethernet Adapter 0 s 10b800061055e302 LANEPIC Cardbus Fast Ethernet Adapter 0 s 10b8000610b8a012 LANEPIC Cardbus Fast Ethernet Adapter 0 s 10b8000613a28002 LANEPIC Cardbus Fast Ethernet Adapter 0 s 10b8000613a28006 LANEPIC Cardbus Fast Ethernet Adapter 0 d 10b81000 FDC 37c665 0 d 10b81001 FDC 37C922 0 d 10b8a011 83C170QF 0 d 10b8b106 SMC34C90 0 v 10b9 Acer Laboratories Inc. [ALi] 0 v 10b9 ALi Corporation. [ALi] 1 d 10b90111 C-Media CMI8738/C3DX Audio Device (OEM) 0 s 10b9011110b90111 C-Media CMI8738/C3DX Audio Device (OEM) 0 d 10b91435 M1435 0 d 10b91445 M1445 0 d 10b91449 M1449 0 d 10b91451 M1451 0 d 10b91461 M1461 0 d 10b91489 M1489 0 d 10b91511 M1511 [Aladdin] 0 d 10b91512 M1512 [Aladdin] 0 d 10b91513 M1513 [Aladdin] 0 d 10b91521 M1521 [Aladdin III] 0 s 10b9152110b91521 ALI M1521 Aladdin III CPU Bridge 0 d 10b91523 M1523 0 s 10b9152310b91523 ALI M1523 ISA Bridge 0 d 10b91531 M1531 [Aladdin IV] 0 d 10b91533 M1533 PCI to ISA Bridge [Aladdin IV] 0 s 10b9153310b91533 ALI M1533 Aladdin IV ISA Bridge 0 d 10b91541 M1541 0 s 10b9154110b91541 ALI M1541 Aladdin V/V+ AGP System Controller 0 d 10b91543 M1543 0 d 10b91563 M1563 South Bridge supporting HyperTransport(TM) Technology 1 d 10b91621 M1621 0 d 10b91631 ALI M1631 PCI North Bridge Aladdin Pro III 0 d 10b91632 M1632M Northbridge+Trident 0 d 10b91641 ALI M1641 PCI North Bridge Aladdin Pro IV 0 d 10b91644 M1644/M1644T Northbridge+Trident 0 d 10b91646 M1646 Northbridge+Trident 0 d 10b91647 M1647 Northbridge [MAGiK 1 / MobileMAGiK 1] 0 d 10b91651 M1651/M1651T Northbridge [Aladdin-Pro 5/5M,Aladdin-Pro 5T/5TM] 0 d 10b91671 M1671 Northbridge [Aladdin-P4] 0 d 10b91671 M1671 Super P4 Northbridge [AGP4X,PCI and SDR/DDR] 1 d 10b91681 M1681 P4 Northbridge [AGP8X,HyperTransport(TM) and SDR/DDR] 1 d 10b91687 M1687 K8 Northbridge [AGP8X and HyperTransport(TM)] 1 d 10b93141 M3141 0 d 10b93143 M3143 0 d 10b93145 M3145 0 d 10b93147 M3147 0 d 10b93149 M3149 0 d 10b93151 M3151 0 d 10b93307 M3307 0 d 10b93309 M3309 0 d 10b95212 M4803 0 d 10b95215 MS4803 0 d 10b95217 M5217H 0 d 10b95219 M5219 0 d 10b95225 M5225 0 d 10b95229 M5229 IDE 0 s 10b9522910438053 A7A266 Motherboard IDE 0 d 10b95235 M5225 0 d 10b95237 USB 1.1 Controller 0 d 10b95239 USB 2.0 Controller 0 d 10b95243 M1541 PCI to AGP Controller 0 d 10b95247 PCI to AGP Controller 0 d 10b95249 HTT to PCI Bridge 1 d 10b95251 M5251 P1394 OHCI 1.0 Controller 0 d 10b95253 M5253 P1394 OHCI 1.1 Controller 0 d 10b95261 M5261 Ethernet Controller 0 d 10b95451 M5451 PCI AC-Link Controller Audio Device 0 s 10b9545110140506 ThinkPad R30 1 d 10b95453 M5453 PCI AC-Link Controller Modem Device 0 d 10b95455 M5455 PCI AC-Link Controller Audio Device 0 d 10b95457 M5457 AC-Link Modem Interface Controller 0 d 10b95459 SmartPCI561 56K Modem 0 d 10b95471 M5471 Memory Stick Controller 0 d 10b95473 M5473 SD-MMC Controller 0 d 10b97101 M7101 PMU 0 s 10b9710110b97101 ALI M7101 Power Management Controller 0 v 10ba Mitsubishi Electric Corp. 0 d 10ba0301 AccelGraphics AccelECLIPSE 0 v 10bb Dapha Electronics Corporation 0 v 10bc Advanced Logic Research 0 v 10bd Surecom Technology 0 d 10bd0e34 NE-34 0 v 10be Tseng Labs International Co. 0 v 10bf Most Inc 0 v 10c0 Boca Research Inc. 0 v 10c1 ICM Co., Ltd. 0 v 10c2 Auspex Systems Inc. 0 v 10c3 Samsung Semiconductors, Inc. 0 d 10c31100 Smartether100 SC1100 LAN Adapter (i82557B) 0 v 10c4 Award Software International Inc. 0 v 10c5 Xerox Corporation 0 v 10c6 Rambus Inc. 0 v 10c7 Media Vision 0 v 10c8 Neomagic Corporation 0 d 10c80001 NM2070 [MagicGraph NM2070] 0 d 10c80001 NM2070 [MagicGraph 128] 1 Update - cleaning up the neomagic entries using XFree86 sources d 10c80002 NM2090 [MagicGraph 128V] 0 d 10c80003 NM2093 [MagicGraph 128ZV] 0 d 10c80004 NM2160 [MagicGraph 128XD] 0 s 10c80004101400ba MagicGraph 128XD 0 s 10c8000410251007 MagicGraph 128XD 0 s 10c8000410280074 MagicGraph 128XD 0 s 10c8000410280075 MagicGraph 128XD 0 s 10c800041028007d MagicGraph 128XD 0 s 10c800041028007e MagicGraph 128XD 0 s 10c800041033802f MagicGraph 128XD 0 s 10c80004104d801b MagicGraph 128XD 0 s 10c80004104d802f MagicGraph 128XD 0 s 10c80004104d830b MagicGraph 128XD 0 s 10c8000410ba0e00 MagicGraph 128XD 0 s 10c8000410c80004 MagicGraph 128XD 0 s 10c8000410cf1029 MagicGraph 128XD 0 s 10c8000410f78308 MagicGraph 128XD 0 s 10c8000410f78309 MagicGraph 128XD 0 s 10c8000410f7830b MagicGraph 128XD 0 s 10c8000410f7830d MagicGraph 128XD 0 s 10c8000410f78312 MagicGraph 128XD 0 d 10c80005 [MagicMedia 256AV] 0 d 10c80005 NM2200 [MagicGraph 256AV] 1 Update - cleaning up the neomagic entries using XFree86 sources s 10c80005101400dd ThinkPad 570 1 d 10c80006 NM2360 [MagicMedia 256ZX] 0 d 10c80016 NM2380 [MagicMedia 256XL+] 0 s 10c8001610c80016 MagicMedia 256XL+ 0 d 10c80025 [MagicMedia 256AV+] 0 d 10c80025 NM2230 [MagicGraph 256AV+] 1 Update - cleaning up the neomagic entries using XFree86 sources d 10c80083 [MagicGraph 128ZV Plus] 0 d 10c80083 NM2093 [MagicGraph 128ZV+] 1 Update - cleaning up the neomagic entries using XFree86 sources d 10c88005 [MagicMedia 256AV Audio] 0 d 10c88005 NM2200 [MagicMedia 256AV Audio] 1 Update - cleaning up the neomagic entries using XFree86 sources s 10c880050e11b0d1 MagicMedia 256AV Audio Device on Discovery 0 s 10c880050e11b126 MagicMedia 256AV Audio Device on Durango 0 s 10c88005101400dd MagicMedia 256AV Audio Device on BlackTip Thinkpad 0 s 10c8800510251003 MagicMedia 256AV Audio Device on TravelMate 720 0 s 10c880051028008f MagicMedia 256AV Audio Device on Colorado Inspiron 0 s 10c88005103c0007 MagicMedia 256AV Audio Device on Voyager II 0 s 10c88005103c0008 MagicMedia 256AV Audio Device on Voyager III 0 s 10c88005103c000d MagicMedia 256AV Audio Device on Omnibook 900 0 s 10c8800510c88005 MagicMedia 256AV Audio Device on FireAnt 0 s 10c88005110a8005 MagicMedia 256AV Audio Device 0 s 10c8800514c00004 MagicMedia 256AV Audio Device 0 d 10c88006 NM2360 [MagicMedia 256ZX Audio] 0 d 10c88016 NM2360 [MagicMedia 256ZX Audio] 0 d 10c88016 NM2380 [MagicMedia 256XL+ Audio] 1 Update - cleaning up the neomagic entries extrapolating from XFree86 sources v 10c9 Dataexpert Corporation 0 v 10ca Fujitsu Microelectr., Inc. 0 v 10cb Omron Corporation 0 v 10cc Mentor ARC Inc 0 v 10cd Advanced System Products, Inc 0 d 10cd1100 ASC1100 0 d 10cd1200 ASC1200 [(abp940) Fast SCSI-II] 0 d 10cd1300 ABP940-U / ABP960-U 0 s 10cd130010cd1310 ASC1300 SCSI Adapter 0 d 10cd2300 ABP940-UW 0 d 10cd2500 ABP940-U2W 0 v 10ce Radius 0 v 10cf Citicorp TTI 0 d 10cf2001 mb86605 0 v 10d0 Fujitsu Limited 0 v 10d1 FuturePlus Systems Corp. 0 v 10d2 Molex Incorporated 0 v 10d3 Jabil Circuit Inc 0 v 10d4 Hualon Microelectronics 0 v 10d5 Autologic Inc. 0 v 10d6 Cetia 0 v 10d7 BCM Advanced Research 0 v 10d8 Advanced Peripherals Labs 0 v 10d9 Macronix, Inc. [MXIC] 0 d 10d90512 MX98713 0 d 10d90531 MX987x5 0 s 10d9053111861200 DFE-540TX ProFAST 10/100 Adapter 0 d 10d98625 MX86250 0 d 10d98888 MX86200 0 v 10da Compaq IPG-Austin 0 d 10da0508 TC4048 Token Ring 4/16 0 d 10da3390 Tl3c3x9 0 v 10db Rohm LSI Systems, Inc. 0 v 10dc CERN/ECP/EDU 0 d 10dc0001 STAR/RD24 SCI-PCI (PMC) 0 d 10dc0002 TAR/RD24 SCI-PCI (PMC) 0 d 10dc0021 HIPPI destination 0 d 10dc0022 HIPPI source 0 d 10dc10dc ATT2C15-3 FPGA 0 v 10dd Evans & Sutherland 0 v 10de nVidia Corporation 0 d 10de0008 NV1 [EDGE 3D] 0 d 10de0009 NV1 [EDGE 3D] 0 d 10de0010 NV2 [Mutara V08] 0 d 10de0020 NV4 [Riva TnT] 0 s 10de002010430200 V3400 TNT 0 s 10de002010480c18 Erazor II SGRAM 0 s 10de002010480c1b Erazor II 0 s 10de002010920550 Viper V550 0 s 10de002010920552 Viper V550 0 s 10de002010924804 Viper V550 0 s 10de002010924808 Viper V550 0 s 10de002010924810 Viper V550 0 s 10de002010924812 Viper V550 0 s 10de002010924815 Viper V550 0 s 10de002010924820 Viper V550 with TV out 0 s 10de002010924822 Viper V550 0 s 10de002010924904 Viper V550 0 s 10de002010924914 Viper V550 0 s 10de002010928225 Viper V550 0 s 10de002010b4273d Velocity 4400 0 s 10de002010b4273e Velocity 4400 0 s 10de002010b42740 Velocity 4400 0 s 10de002010de0020 Riva TNT 0 s 10de002011021015 Graphics Blaster CT6710 0 s 10de002011021016 Graphics Blaster RIVA TNT 0 d 10de0028 NV5 [Riva TnT2] 0 s 10de002810430200 AGP-V3800 SGRAM 0 s 10de002810430201 AGP-V3800 SDRAM 0 s 10de002810430205 PCI-V3800 0 s 10de002810434000 AGP-V3800PRO 0 s 10de002810924804 Viper V770 0 s 10de002810924a00 Viper V770 0 s 10de002810924a02 Viper V770 Ultra 0 s 10de002810925a00 RIVA TNT2/TNT2 Pro 0 s 10de002810926a02 Viper V770 Ultra 0 s 10de002810927a02 Viper V770 Ultra 0 s 10de002810de0005 RIVA TNT2 Pro 0 s 10de002810de000f Compaq NVIDIA TNT2 Pro 0 s 10de002811021020 3D Blaster RIVA TNT2 0 s 10de002811021026 3D Blaster RIVA TNT2 Digital 0 s 10de002814af5810 Maxi Gamer Xentor 0 d 10de0029 NV5 [Riva TnT2 Ultra] 0 s 10de002910430200 AGP-V3800 Deluxe 0 s 10de002910430201 AGP-V3800 Ultra SDRAM 0 s 10de002910430205 PCI-V3800 Ultra 0 s 10de002911021021 3D Blaster RIVA TNT2 Ultra 0 s 10de002911021029 3D Blaster RIVA TNT2 Ultra 0 s 10de00291102102f 3D Blaster RIVA TNT2 Ultra 0 s 10de002914af5820 Maxi Gamer Xentor 32 0 d 10de002a NV5 [Riva TnT2] 0 d 10de002b NV5 [Riva TnT2] 0 d 10de002c NV6 [Vanta] 0 s 10de002c10430200 AGP-V3800 Combat SDRAM 0 s 10de002c10430201 AGP-V3800 Combat 0 s 10de002c10926820 Viper V730 0 s 10de002c11021031 CT6938 VANTA 8MB 0 s 10de002c11021034 CT6894 VANTA 16MB 0 s 10de002c14af5008 Maxi Gamer Phoenix 2 0 d 10de002d RIVA TNT2 Model 64 0 s 10de002d10430200 AGP-V3800M 0 s 10de002d10430201 AGP-V3800M 0 s 10de002d11021023 CT6892 RIVA TNT2 Value 0 s 10de002d11021024 CT6932 RIVA TNT2 Value 32Mb 0 s 10de002d1102102c CT6931 RIVA TNT2 Value [Jumper] 0 s 10de002d14628808 MSI-8808 0 s 10de002d15541041 PixelView RIVA TNT2 M64 32MB 0 d 10de002e NV6 [Vanta] 0 d 10de002f NV6 [Vanta] 0 d 10de00a0 NV5 [Riva TNT2] 0 s 10de00a014af5810 Maxi Gamer Xentor 0 d 10de0100 NV10 [GeForce 256 SDR] 0 s 10de010010430200 AGP-V6600 SGRAM 0 s 10de010010430201 AGP-V6600 SDRAM 0 s 10de010010434008 AGP-V6600 SGRAM 0 s 10de010010434009 AGP-V6600 SDRAM 0 s 10de01001102102d CT6941 GeForce 256 0 s 10de010014af5022 3D Prophet SE 0 d 10de0101 NV10 [GeForce 256 DDR] 0 s 10de010110430202 AGP-V6800 DDR 0 s 10de01011043400a AGP-V6800 DDR SGRAM 0 s 10de01011043400b AGP-V6800 DDR SDRAM 0 s 10de01011102102e CT6971 GeForce 256 DDR 0 s 10de010114af5021 3D Prophet DDR-DVI 0 d 10de0103 NV10 [Quadro] 0 d 10de0110 NV11 [GeForce2 MX] 0 s 10de011010434015 AGP-V7100 Pro 0 s 10de011010434031 V7100 Pro with TV output 0 s 10de011014af7102 3D Prophet II MX 0 s 10de011014af7103 3D Prophet II MX Dual-Display 0 d 10de0111 NV11 [GeForce2 MX DDR] 0 d 10de0112 NV11 [GeForce2 Go] 0 d 10de0113 NV11 [GeForce2 MXR] 0 d 10de0150 NV15 [GeForce2 GTS] 0 s 10de015010434016 V7700 AGP Video Card 0 s 10de0150107d2840 WinFast GeForce2 GTS with TV output 0 s 10de015014628831 Creative GeForce2 Pro 0 d 10de0151 NV15 [GeForce2 Ti] 0 s 10de01511043405f V7700Ti 0 d 10de0152 NV15 [GeForce2 Ultra, Bladerunner] 0 s 10de015210480c56 GLADIAC Ultra 0 d 10de0153 NV15 [Quadro2 Pro] 0 d 10de0170 NV17 [GeForce4 MX460] 0 d 10de0171 NV17 [GeForce4 MX440] 0 s 10de017114628661 G4MX440-VTP 0 d 10de0172 NV17 [GeForce4 MX420] 0 d 10de0173 NV1x 0 d 10de0174 NV17 [GeForce4 440 Go] 0 d 10de0175 NV17 [GeForce4 420 Go] 0 d 10de0176 NV17 [GeForce4 420 Go 32M] 0 d 10de0178 Quadro4 500XGL 0 d 10de0179 NV17 [GeForce4 440 Go 64M] 0 d 10de017a Quadro4 200/400NVS 0 d 10de017b Quadro4 550XGL 0 d 10de017c Quadro4 550 GoGL 0 d 10de0181 NV18 [GeForce4 MX440 AGP 8x] 1 d 10de01a0 NV15 [GeForce2 - nForce GPU] 0 d 10de01a4 nForce CPU bridge 0 d 10de01ab nForce 420 Memory Controller (DDR) 0 d 10de01ac nForce 220/420 Memory Controller 0 d 10de01ad nForce 220/420 Memory Controller 0 d 10de01b1 nForce Audio 0 d 10de01b2 nForce ISA Bridge 0 d 10de01b4 nForce PCI System Management 0 d 10de01b7 nForce AGP to PCI Bridge 0 d 10de01b8 nForce PCI-to-PCI bridge 0 d 10de01bc nForce IDE 0 d 10de01c1 nForce MC97 Modem (Smart Link HAMR5600 compatible) 0 d 10de0200 NV20 [GeForce3] 0 s 10de02001043402f AGP-V8200 DDR 0 d 10de0201 NV20 [GeForce3 Ti200] 0 d 10de0202 NV20 [GeForce3 Ti500] 0 s 10de02021043405b V8200 T5 0 s 10de02021545002f Xtasy 6964 0 d 10de0203 NV20 [Quadro DCC] 0 d 10de0250 NV25 [GeForce4 Ti4600] 0 d 10de0251 NV25 [GeForce4 Ti4400] 0 d 10de0253 NV25 [GeForce4 Ti4200] 0 s 10de0253107d2896 WinFast A250 LE TD (Dual VGA/TV-out/DVI) 1 s 10de0253147b8f09 Abit Siluro (Dual VGA/TV-out/DVI) 1 d 10de0258 Quadro4 900XGL 0 d 10de0259 Quadro4 750XGL 0 d 10de025b Quadro4 700XGL 0 v 10df Emulex Corporation 0 d 10df1ae5 LP6000 Fibre Channel Host Adapter 0 d 10dff085 LP850 Fibre Channel Adapter 0 d 10dff095 LP952 Fibre Channel Adapter 0 d 10dff098 LP982 Fibre Channel Adapter 0 d 10dff700 LP7000 Fibre Channel Host Adapter 0 d 10dff800 LP8000 Fibre Channel Host Adapter 0 d 10dff900 LP9000 Fibre Channel Host Adapter 0 d 10dff980 LP9802 Fibre Channel Adapter 0 v 10e0 Integrated Micro Solutions Inc. 0 d 10e05026 IMS5026/27/28 0 d 10e05027 IMS5027 0 d 10e05028 IMS5028 0 d 10e08849 IMS8849 0 d 10e08853 IMS8853 0 d 10e09128 IMS9128 [Twin turbo 128] 0 v 10e1 Tekram Technology Co.,Ltd. 0 d 10e10391 TRM-S1040 0 s 10e1039110e10391 DC-315U SCSI-3 Host Adapter 0 d 10e1690c DC-690c 0 d 10e1dc29 DC-290 0 v 10e2 Aptix Corporation 0 v 10e3 Tundra Semiconductor Corp. 0 d 10e30000 CA91C042 [Universe] 0 d 10e30860 CA91C860 [QSpan] 0 v 10e4 Tandem Computers 0 v 10e5 Micro Industries Corporation 0 v 10e6 Gainbery Computer Products Inc. 0 v 10e7 Vadem 0 v 10e8 Applied Micro Circuits Corp. 0 d 10e82011 Q-Motion Video Capture/Edit board 0 d 10e84750 S5930 [Matchmaker] 0 d 10e85920 S5920 0 d 10e88043 LANai4.x [Myrinet LANai interface chip] 0 d 10e88062 S5933_PARASTATION 0 d 10e8807d S5933 [Matchmaker] 0 d 10e88088 Kongsberg Spacetec Format Synchronizer 0 d 10e88089 Kongsberg Spacetec Serial Output Board 0 d 10e8809c S5933_HEPC3 0 d 10e880d7 PCI-9112 0 d 10e880d9 PCI-9118 0 d 10e880da PCI-9812 0 d 10e8811a PCI-IEEE1355-DS-DE Interface 0 d 10e88170 S5933 [Matchmaker] (Chipset Development Tool) 0 d 10e882db AJA HDNTV HD SDI Framestore 0 v 10e9 Alps Electric Co., Ltd. 0 v 10ea Intergraphics Systems 0 d 10ea1680 IGA-1680 0 d 10ea1682 IGA-1682 0 d 10ea1683 IGA-1683 0 d 10ea2000 CyberPro 2000 0 d 10ea2010 CyberPro 2000A 0 d 10ea5000 CyberPro 5000 0 d 10ea5050 CyberPro 5050 0 v 10eb Artists Graphics 0 d 10eb0101 3GA 0 d 10eb8111 Twist3 Frame Grabber 0 v 10ec Realtek Semiconductor Co., Ltd. 0 d 10ec8029 RTL-8029(AS) 0 s 10ec802910b82011 EZ-Card (SMC1208) 0 s 10ec802910ec8029 RTL-8029(AS) 0 s 10ec802911131208 EN1208 0 s 10ec802911860300 DE-528 0 s 10ec802912592400 AT-2400 0 d 10ec8129 RTL-8129 0 s 10ec812910ec8129 RT8129 Fast Ethernet Adapter 0 d 10ec8138 RT8139 (B/C) Cardbus Fast Ethernet Adapter 0 s 10ec813810ec8138 RT8139 (B/C) Fast Ethernet Adapter 0 d 10ec8139 RTL-8139/8139C/8139C+ 0 s 10ec813910258920 ALN-325 0 s 10ec813910258921 ALN-325 0 s 10ec813910bd0320 EP-320X-R 0 s 10ec813910ec8139 RT8139 0 s 10ec813911861300 DFE-538TX 0 s 10ec813911861320 SN5200 0 s 10ec813911868139 DRN-32TX 0 s 10ec813912592500 AT-2500TX 0 s 10ec813912592503 AT-2500TX/ACPI 0 s 10ec81391429d010 ND010 0 s 10ec813914329130 EN-9130TX 0 s 10ec813914368139 RT8139 0 s 10ec8139146c1439 FE-1439TX 0 s 10ec813914896001 GF100TXRII 0 s 10ec813914896002 GF100TXRA 0 s 10ec8139149c139a LFE-8139ATX 0 s 10ec8139149c8139 LFE-8139TX 0 s 10ec813926460001 EtheRx 0 s 10ec81398e2e7000 KF-230TX 0 s 10ec81398e2e7100 KF-230TX/2 0 s 10ec8139a0a00007 ALN-325C 0 d 10ec8169 RTL-8169 0 d 10ec8197 SmartLAN56 56K Modem 0 v 10ed Ascii Corporation 0 d 10ed7310 V7310 0 v 10ee Xilinx, Inc. 0 v 10ee Xilinx Corporation 1 This Vendor-Id and several it's Device-Ids appear in a larger database at http://www.yourvote.com/pci/ which you may want to ref v 10ee Xilinx Corporation 1 This Vendor-Id and several it's Device-Ids appear in a larger database at http://www.yourvote.com/pci/ which you may want to ref v 10ee Xilinx Corporation 1 This Vendor-Id and several it's Device-Ids appear in a larger database at http://www.yourvote.com/pci/ which you may want to ref d 10ee3fc0 RME Digi96 0 d 10ee3fc1 RME Digi96/8 0 d 10ee3fc2 RME Digi96/8 Pro 0 d 10ee3fc3 RME Digi96/8 Pad 0 d 10ee3fc4 RME Digi9652 (Hammerfall) 0 d 10ee3fc5 RME Hammerfall DSP 0 v 10ef Racore Computer Products, Inc. 0 d 10ef8154 M815x Token Ring Adapter 0 v 10f0 Peritek Corporation 0 v 10f1 Tyan Computer 0 v 10f2 Achme Computer, Inc. 0 v 10f3 Alaris, Inc. 0 v 10f4 S-MOS Systems, Inc. 0 v 10f5 NKK Corporation 0 d 10f5a001 NDR4000 [NR4600 Bridge] 0 v 10f6 Creative Electronic Systems SA 0 v 10f7 Matsushita Electric Industrial Co., Ltd. 0 v 10f8 Altos India Ltd 0 v 10f9 PC Direct 0 v 10fa Truevision 0 d 10fa000c TARGA 1000 0 v 10fb Thesys Gesellschaft für Mikroelektronik mbH 0 v 10fc I-O Data Device, Inc. 0 d 10fc0003 Cardbus IDE Controller 0 What's in the cardbus end of a Sony ACR-A01 card, comes with newer Vaio CD-RW drives v 10fd Soyo Computer, Inc 0 v 10fe Fast Multimedia AG 0 v 10ff NCube 0 v 1100 Jazz Multimedia 0 v 1101 Initio Corporation 0 d 11011060 INI-A100U2W 0 d 11019100 INI-9100/9100W 0 d 11019400 INI-940 0 d 11019401 INI-950 0 d 11019500 360P 0 v 1102 Creative Labs 0 d 11020002 SB Live! EMU10k1 0 s 1102000211020020 CT4850 SBLive! Value 0 s 1102000211020021 CT4620 SBLive! 0 s 110200021102002f SBLive! mainboard implementation 0 s 1102000211024001 E-mu APS 0 s 1102000211028022 CT4780 SBLive! Value 0 s 1102000211028023 CT4790 SoundBlaster PCI512 0 s 1102000211028024 CT4760 SBLive! 0 s 1102000211028025 SBLive! Mainboard Implementation 0 s 1102000211028026 CT4830 SBLive! Value 0 s 1102000211028027 CT4832 SBLive! Value 0 s 1102000211028028 CT4760 SBLive! OEM version 0 s 1102000211028031 CT4831 SBLive! Value 0 s 1102000211028040 CT4760 SBLive! 0 s 1102000211028051 CT4850 SBLive! Value 0 s 1102000211028061 SBLive! Player 5.1 0 d 11020004 SB Audigy 0 s 1102000411020051 SB0090 Audigy Player 0 s 1102000411020053 SB0090 Audigy Player/OEM 1 d 11020006 [SB Live! Value] EMU10K1X audio controller 1 OEM card in new Dell system d 11024001 SB Audigy FireWire Port 0 s 1102400111020010 SB Audigy FireWire Port 1 d 11027002 SB Live! MIDI/Game Port 0 s 1102700211020020 Gameport Joystick 0 d 11027003 SB Audigy MIDI/Game port 0 d 11027003 SB Audigy MIDI/Game Port 1 s 1102700311020040 SB Audigy MIDI/Gameport 0 s 1102700311020040 SB Audigy MIDI/Game Port 1 d 11027004 [SB Live! Value] Input device controller 1 OEM card in new Dell system d 11028938 ES1371 0 v 1103 Triones Technologies, Inc. 0 d 11030003 HPT343 0 d 11030004 HPT366/368/370/370A/372 0 Revisions: 01=HPT366, 03=HPT370, 04=HPT370A, 05=HPT372 s 1103000411030001 HPT370A 0 s 1103000411030005 HPT370 UDMA100 0 d 11030005 HPT372A 0 d 11030006 HPT302 0 d 11030007 HPT371 0 d 11030008 HPT374 0 v 1104 RasterOps Corp. 0 v 1105 Sigma Designs, Inc. 0 d 11051105 REALmagic Xcard MPEG 1/2/3/4 DVD Decoder 0 d 11058300 REALmagic Hollywood Plus DVD Decoder 0 d 11058400 EM840x REALmagic DVD/MPEG-2 Audio/Video Decoder 0 v 1106 VIA Technologies, Inc. 0 d 11060102 Embedded VIA Ethernet Controller 0 d 11060130 VT6305 1394.A Controller 0 d 11060305 VT8363/8365 [KT133/KM133] 0 s 1106030510438033 A7V Mainboard 0 s 1106030510438042 A7V133/A7V133-C Mainboard 0 s 11060305147ba401 KT7/KT7-RAID/KT7A/KT7A-RAID Mainboard 0 d 11060391 VT8371 [KX133] 0 d 11060501 VT8501 [Apollo MVP4] 0 d 11060505 VT82C505 0 d 11060561 VT82C561 0 d 11060571 VT82C586B PIPC Bus Master IDE 0 d 11060571 VT82C586/B/686A/B PIPC Bus Master IDE 1 s 1106057110438052 VT8233A Bus Master ATA100/66/33 IDE 1 s 1106057111060571 VT8235 Bus Master ATA133/100/66/33 IDE 0 d 11060576 VT82C576 3V [Apollo Master] 0 d 11060585 VT82C585VP [Apollo VP1/VPX] 0 d 11060586 VT82C586/A/B PCI-to-ISA [Apollo VP] 0 s 1106058611060000 MVP3 ISA Bridge 0 d 11060595 VT82C595 [Apollo VP2] 0 d 11060596 VT82C596 ISA [Mobile South] 0 s 1106059611060000 VT82C596/A/B PCI to ISA Bridge 0 s 1106059614580596 VT82C596/A/B PCI to ISA Bridge 0 d 11060597 VT82C597 [Apollo VP3] 0 d 11060598 VT82C598 [Apollo MVP3] 0 d 11060601 VT8601 [Apollo ProMedia] 0 d 11060605 VT8605 [ProSavage PM133] 0 d 11060680 VT82C680 [Apollo P6] 0 d 11060686 VT82C686 [Apollo Super South] 0 s 1106068610438033 A7V Mainboard 0 s 1106068610438040 A7M266 Mainboard 0 s 1106068610438042 A7V133/A7V133-C Mainboard 0 s 1106068611060000 VT82C686/A PCI to ISA Bridge 0 s 1106068611060686 VT82C686/A PCI to ISA Bridge 0 d 11060691 VT82C693A/694x [Apollo PRO133x] 0 s 1106069114580691 VT82C691 Apollo Pro System Controller 0 d 11060693 VT82C693 [Apollo Pro Plus] 0 d 11060698 VT82C693A [Apollo Pro133 AGP] 0 d 11060926 VT82C926 [Amazon] 0 d 11061000 VT82C570MV 0 d 11061106 VT82C570MV 0 d 11061571 VT82C416MV 0 d 11061595 VT82C595/97 [Apollo VP2/97] 0 d 11063038 USB 0 s 1106303809251234 USB Controller 0 s 1106303812340925 MVP3 USB Controller 0 d 11063040 VT82C586B ACPI 0 d 11063043 VT86C100A [Rhine] 0 s 1106304310bd0000 VT86C100A Fast Ethernet Adapter 0 s 1106304311060100 VT86C100A Fast Ethernet Adapter 0 s 1106304311861400 DFE-530TX rev A 0 d 11063044 IEEE 1394 Host Controller 0 d 11063050 VT82C596 Power Management 0 d 11063051 VT82C596 Power Management 0 d 11063057 VT82C686 [Apollo Super ACPI] 0 s 1106305710438033 A7V Mainboard 0 s 1106305710438040 A7M266 Mainboard 0 s 1106305710438042 A7V133/A7V133-C Mainboard 0 d 11063058 VT82C686 AC97 Audio Controller 0 s 110630580e11b194 Soundmax integrated digital audio 0 s 1106305811064511 Onboard Audio on EP7KXA 0 s 1106305814587600 Onboard Audio 0 s 1106305814623091 MS-6309 Onboard Audio 0 s 1106305815dd7609 Onboard Audio 0 d 11063059 VT8233 AC97 Audio Controller 0 d 11063065 VT6102 [Rhine-II] 0 s 1106306511060102 VT6102 [Rhine II] Embeded Ethernet Controller on VT8235 0 s 1106306511063065 Embedded ethernet on VIA Eden 0 s 1106306511861400 DFE-530TX rev A 0 s 1106306511861401 DFE-530TX rev B 0 d 11063068 AC97 Modem Controller 0 d 11063074 VT8233 PCI to ISA Bridge 0 s 1106307410438052 VT8233A 1 d 11063091 VT8633 [Apollo Pro266] 0 d 11063099 VT8367 [KT266] 0 d 11063099 VT8366/A/7 [Apollo KT266/A/333] 1 s 1106309910438064 A7V266-E 0 s 1106309910438064 A7V266-E Mainboard 1 s 110630991043807f A7V333 0 s 110630991043807f A7V333 Mainboard 1 d 11063101 VT8653 Host Bridge 0 d 11063102 VT8662 Host Bridge 0 d 11063103 VT8615 Host Bridge 0 d 11063104 USB 2.0 0 d 11063109 VT8233C PCI to ISA Bridge 0 d 11063112 VT8361 [KLE133] Host Bridge 0 d 11063116 VT8375 [KM266] Host Bridge 0 d 11063128 VT8753 [P4X266 AGP] 0 d 11063133 VT3133 Host Bridge 0 d 11063147 VT8233A ISA Bridge 0 d 11063148 P4M266 Host Bridge 0 d 11063156 P/KN266 Host Bridge 0 d 11063168 VT8374 P4X400 Host Controller/AGP Bridge 1 PCI devices found: \n Bus 0, device 0, function 0: \n Host bridge: PCI device 1106:3168 (VIA Technologies, Inc.) (rev 3). d 11063177 VT8233A ISA Bridge 0 d 11063177 VT8235 ISA Bridge 1 The kernel patch available in http://www.uwsg.iu.edu/hypermail/linux/kernel/0208.2/0581.html declares this ID to be VT8235 and n d 11063189 VT8377 [KT400] Host Bridge 0 d 11065030 VT82C596 ACPI [Apollo PRO] 0 d 11066100 VT85C100A [Rhine II] 0 d 11068231 VT8231 [PCI-to-ISA Bridge] 0 d 11068235 VT8235 ACPI 0 d 11068305 VT8363/8365 [KT133/KM133 AGP] 0 d 11068391 VT8371 [KX133 AGP] 0 d 11068501 VT8501 [Apollo MVP4 AGP] 0 d 11068596 VT82C596 [Apollo PRO AGP] 0 d 11068597 VT82C597 [Apollo VP3 AGP] 0 d 11068598 VT82C598/694x [Apollo MVP3/Pro133x AGP] 0 d 11068601 VT8601 [Apollo ProMedia AGP] 0 d 11068605 VT8605 [PM133 AGP] 0 d 11068691 VT82C691 [Apollo Pro] 0 d 11068693 VT82C693 [Apollo Pro Plus] PCI Bridge 0 d 1106b091 VT8633 [Apollo Pro266 AGP] 0 d 1106b099 VT8367 [KT333 AGP] 0 d 1106b099 VT8366/A/7 [Apollo KT266/A/333 AGP] 1 d 1106b101 VT8653 AGP Bridge 0 d 1106b102 VT8362 AGP Bridge 0 d 1106b103 VT8615 AGP Bridge 0 d 1106b112 VT8361 [KLE133] AGP Bridge 0 d 1106b168 VT8235 0 v 1107 Stratus Computers 0 d 11070576 VIA VT82C570MV [Apollo] (Wrong vendor ID!) 0 v 1108 Proteon, Inc. 0 d 11080100 p1690plus_AA 0 d 11080101 p1690plus_AB 0 d 11080105 P1690Plus 0 d 11080108 P1690Plus 0 d 11080138 P1690Plus 0 d 11080139 P1690Plus 0 d 1108013c P1690Plus 0 d 1108013d P1690Plus 0 v 1109 Cogent Data Technologies, Inc. 0 d 11091400 EM110TX [EX110TX] 0 v 110a Siemens Nixdorf AG 0 d 110a0002 Pirahna 2-port 0 d 110a0005 Tulip controller, power management, switch extender 0 d 110a2102 DSCC4 WAN adapter 0 d 110a4942 FPGA I-Bus Tracer for MBD 0 d 110a6120 SZB6120 0 v 110b Chromatic Research Inc. 0 d 110b0001 Mpact Media Processor 0 d 110b0004 Mpact 2 0 v 110c Mini-Max Technology, Inc. 0 v 110d Znyx Advanced Systems 0 v 110e CPU Technology 0 v 110f Ross Technology 0 v 1110 Powerhouse Systems 0 d 11106037 Firepower Powerized SMP I/O ASIC 0 d 11106073 Firepower Powerized SMP I/O ASIC 0 v 1111 Santa Cruz Operation 0 v 1112 Osicom Technologies Inc 1 see http://www.pcisig.com/membership/vid_search/by_vendor_id/?vendor_id=1112&type=h for proof v 1112 RNS - Div. of Meret Communications Inc 0 DJ: Some people say that 0x1112 is Rockwell International d 11122200 FDDI Adapter 0 d 11122300 Fast Ethernet Adapter 0 d 11122340 4 Port Fast Ethernet Adapter 0 d 11122400 ATM Adapter 0 v 1113 Accton Technology Corporation 0 d 11131211 SMC2-1211TX 0 s 11131211103c1207 EN-1207D Fast Ethernet Adapter 0 s 1113121111131211 EN-1207D Fast Ethernet Adapter 0 d 11131216 EN-1216 Ethernet Adapter 0 d 11131217 EN-1217 Ethernet Adapter 0 d 11135105 10Mbps Network card 0 d 11139211 EN-1207D Fast Ethernet Adapter 0 s 1113921111139211 EN-1207D Fast Ethernet Adapter 0 d 11139511 Fast Ethernet Adapter 0 v 1114 Atmel Corporation 0 v 1115 3D Labs 0 v 1116 Data Translation 0 d 11160022 DT3001 0 d 11160023 DT3002 0 d 11160024 DT3003 0 d 11160025 DT3004 0 d 11160026 DT3005 0 d 11160027 DT3001-PGL 0 d 11160028 DT3003-PGL 0 v 1117 Datacube, Inc 0 d 11179500 Max-1C SVGA card 0 d 11179501 Max-1C image processing 0 v 1118 Berg Electronics 0 v 1119 ICP Vortex Computersysteme GmbH 0 d 11190000 GDT 6000/6020/6050 0 d 11190001 GDT 6000B/6010 0 d 11190002 GDT 6110/6510 0 d 11190003 GDT 6120/6520 0 d 11190004 GDT 6530 0 d 11190005 GDT 6550 0 d 11190006 GDT 6x17 0 d 11190007 GDT 6x27 0 d 11190008 GDT 6537 0 d 11190009 GDT 6557 0 d 1119000a GDT 6115/6515 0 d 1119000b GDT 6125/6525 0 d 1119000c GDT 6535 0 d 1119000d GDT 6555 0 d 11190100 GDT 6117RP/6517RP 0 d 11190101 GDT 6127RP/6527RP 0 d 11190102 GDT 6537RP 0 d 11190103 GDT 6557RP 0 d 11190104 GDT 6111RP/6511RP 0 d 11190105 GDT 6121RP/6521RP 0 d 11190110 GDT 6117RD/6517RD 0 d 11190111 GDT 6127RD/6527RD 0 d 11190112 GDT 6537RD 0 d 11190113 GDT 6557RD 0 d 11190114 GDT 6111RD/6511RD 0 d 11190115 GDT 6121RD/6521RD 0 d 11190118 GDT 6118RD/6518RD/6618RD 0 d 11190119 GDT 6128RD/6528RD/6628RD 0 d 1119011a GDT 6538RD/6638RD 0 d 1119011b GDT 6558RD/6658RD 0 d 11190120 GDT 6117RP2/6517RP2 0 d 11190121 GDT 6127RP2/6527RP2 0 d 11190122 GDT 6537RP2 0 d 11190123 GDT 6557RP2 0 d 11190124 GDT 6111RP2/6511RP2 0 d 11190125 GDT 6121RP2/6521RP2 0 d 11190136 GDT 6113RS/6513RS 0 d 11190137 GDT 6123RS/6523RS 0 d 11190138 GDT 6118RS/6518RS/6618RS 0 d 11190139 GDT 6128RS/6528RS/6628RS 0 d 1119013a GDT 6538RS/6638RS 0 d 1119013b GDT 6558RS/6658RS 0 d 1119013c GDT 6533RS/6633RS 0 d 1119013d GDT 6543RS/6643RS 0 d 1119013e GDT 6553RS/6653RS 0 d 1119013f GDT 6563RS/6663RS 0 d 11190166 GDT 7113RN/7513RN/7613RN 0 d 11190167 GDT 7123RN/7523RN/7623RN 0 d 11190168 GDT 7118RN/7518RN/7518RN 0 d 11190169 GDT 7128RN/7528RN/7628RN 0 d 1119016a GDT 7538RN/7638RN 0 d 1119016b GDT 7558RN/7658RN 0 d 1119016c GDT 7533RN/7633RN 0 d 1119016d GDT 7543RN/7643RN 0 d 1119016e GDT 7553RN/7653RN 0 d 1119016f GDT 7563RN/7663RN 0 d 111901d6 GDT 4x13RZ 0 d 111901d7 GDT 4x23RZ 0 d 111901f6 GDT 8x13RZ 0 d 111901f7 GDT 8x23RZ 0 d 111901fc GDT 8x33RZ 0 d 111901fd GDT 8x43RZ 0 d 111901fe GDT 8x53RZ 0 d 111901ff GDT 8x63RZ 0 d 11190210 GDT 6519RD/6619RD 0 d 11190211 GDT 6529RD/6629RD 0 d 11190260 GDT 7519RN/7619RN 0 d 11190261 GDT 7529RN/7629RN 0 d 11190300 GDT Raid Controller 0 v 111a Efficient Networks, Inc 0 d 111a0000 155P-MF1 (FPGA) 0 d 111a0002 155P-MF1 (ASIC) 0 d 111a0003 ENI-25P ATM 0 s 111a0003111a0000 ENI-25p Miniport ATM Adapter 0 d 111a0005 SpeedStream (LANAI) 0 s 111a0005111a0001 ENI-3010 ATM 0 s 111a0005111a0009 ENI-3060 ADSL (VPI=0) 0 s 111a0005111a0101 ENI-3010 ATM 0 s 111a0005111a0109 ENI-3060CO ADSL (VPI=0) 0 s 111a0005111a0809 ENI-3060 ADSL (VPI=0 or 8) 0 s 111a0005111a0909 ENI-3060CO ADSL (VPI=0 or 8) 0 s 111a0005111a0a09 ENI-3060 ADSL (VPI=<0..15>) 0 d 111a0007 SpeedStream ADSL 0 s 111a0007111a1001 ENI-3061 ADSL [ASIC] 0 v 111b Teledyne Electronic Systems 0 v 111c Tricord Systems Inc. 0 d 111c0001 Powerbis Bridge 0 v 111d Integrated Device Tech 0 d 111d0001 IDT77211 ATM Adapter 0 d 111d0003 IDT77252 ATM network controller 0 v 111e Eldec 0 v 111f Precision Digital Images 0 d 111f4a47 Precision MX Video engine interface 0 d 111f5243 Frame capture bus interface 0 v 1120 EMC Corporation 0 v 1121 Zilog 0 v 1122 Multi-tech Systems, Inc. 0 v 1123 Excellent Design, Inc. 0 v 1124 Leutron Vision AG 0 v 1125 Eurocore 0 v 1126 Vigra 0 v 1127 FORE Systems Inc 0 d 11270200 ForeRunner PCA-200 ATM 0 d 11270210 PCA-200PC 0 d 11270250 ATM 0 d 11270300 ForeRunner PCA-200EPC ATM 0 d 11270310 ATM 0 d 11270400 ForeRunnerHE ATM Adapter 0 s 1127040011270400 ForeRunnerHE ATM 0 v 1129 Firmworks 0 v 112a Hermes Electronics Company, Ltd. 0 v 112b Linotype - Hell AG 0 v 112c Zenith Data Systems 0 v 112d Ravicad 0 v 112e Infomedia Microelectronics Inc. 0 v 112f Imaging Technology Inc 0 d 112f0000 MVC IC-PCI 0 d 112f0001 MVC IM-PCI Video frame grabber/processor 0 v 1130 Computervision 0 v 1131 Philips Semiconductors 0 d 11313400 SmartPCI56(UCB1500) 56K Modem 0 d 11317130 SAA7130 Video Broadcast Decoder 0 d 11317134 SAA7134 0 PCI audio and video broadcast decoder (http://www.semiconductors.philips.com/pip/saa7134hl) d 11317145 SAA7145 0 d 11317146 SAA7146 0 s 11317146114b2003 DVRaptor Video Edit/Capture Card 0 s 1131714611bd0006 DV500 Overlay 0 s 1131714611bd000a DV500 Overlay 0 v 1132 Mitel Corp. 0 v 1133 Eicon Technology Corporation 0 d 11337901 EiconCard S90 0 d 11337902 EiconCard S90 0 d 11337911 EiconCard S91 0 d 11337912 EiconCard S91 0 d 11337941 EiconCard S94 0 d 11337942 EiconCard S94 0 d 11337943 EiconCard S94 0 d 11337944 EiconCard S94 0 d 1133b921 EiconCard P92 0 d 1133b922 EiconCard P92 0 d 1133b923 EiconCard P92 0 d 1133e001 DIVA 20PRO 0 s 1133e0011133e001 DIVA Pro 2.0 S/T 0 d 1133e002 DIVA 20 0 s 1133e0021133e002 DIVA 2.0 S/T 0 d 1133e003 DIVA 20PRO_U 0 s 1133e0031133e003 DIVA Pro 2.0 U 0 d 1133e004 DIVA 20_U 0 s 1133e0041133e004 DIVA 2.0 U 0 d 1133e005 DIVA LOW 0 s 1133e0051133e005 DIVA 2.01 S/T 0 d 1133e00b Eicon Diva 2.02 1 New version of Eicon Diva card class 280 d 1133e010 DIVA Server BRI-2M 0 s 1133e0101133e010 DIVA Server BRI-2M 0 d 1133e012 DIVA Server BRI-8M 0 s 1133e0121133e012 DIVA Server BRI-8M 0 d 1133e014 DIVA Server PRI-30M 0 s 1133e0141133e014 DIVA Server PRI-30M 0 d 1133e018 DIVA Server BRI-2M/-2F 0 v 1134 Mercury Computer Systems 0 d 11340001 Raceway Bridge 0 v 1135 Fuji Xerox Co Ltd 0 d 11350001 Printer controller 0 v 1136 Momentum Data Systems 0 v 1137 Cisco Systems Inc 0 v 1138 Ziatech Corporation 0 d 11388905 8905 [STD 32 Bridge] 0 v 1139 Dynamic Pictures, Inc 0 d 11390001 VGA Compatable 3D Graphics 0 v 113a FWB Inc 0 v 113b Network Computing Devices 0 v 113c Cyclone Microsystems, Inc. 0 d 113c0000 PCI-9060 i960 Bridge 0 d 113c0001 PCI-SDK [PCI i960 Evaluation Platform] 0 d 113c0911 PCI-911 [i960Jx-based Intelligent I/O Controller] 0 d 113c0912 PCI-912 [i960CF-based Intelligent I/O Controller] 0 d 113c0913 PCI-913 0 d 113c0914 PCI-914 [I/O Controller w/ secondary PCI bus] 0 v 113d Leading Edge Products Inc 0 v 113e Sanyo Electric Co - Computer Engineering Dept 0 v 113f Equinox Systems, Inc. 0 d 113f0808 SST-64P Adapter 0 d 113f1010 SST-128P Adapter 0 d 113f80c0 SST-16P DB Adapter 0 d 113f80c4 SST-16P RJ Adapter 0 d 113f80c8 SST-16P Adapter 0 d 113f8888 SST-4P Adapter 0 d 113f9090 SST-8P Adapter 0 v 1140 Intervoice Inc 0 v 1141 Crest Microsystem Inc 0 v 1142 Alliance Semiconductor Corporation 0 d 11423210 AP6410 0 d 11426422 ProVideo 6422 0 d 11426424 ProVideo 6424 0 d 11426425 ProMotion AT25 0 d 1142643d ProMotion AT3D 0 v 1143 NetPower, Inc 0 v 1144 Cincinnati Milacron 0 d 11440001 Noservo controller 0 v 1145 Workbit Corporation 0 v 1146 Force Computers 0 v 1147 Interface Corp 0 v 1148 Syskonnect (Schneider & Koch) 0 d 11484000 FDDI Adapter 0 s 114840000e11b03b Netelligent 100 FDDI DAS Fibre SC 0 s 114840000e11b03c Netelligent 100 FDDI SAS Fibre SC 0 s 114840000e11b03d Netelligent 100 FDDI DAS UTP 0 s 114840000e11b03e Netelligent 100 FDDI SAS UTP 0 s 114840000e11b03f Netelligent 100 FDDI SAS Fibre MIC 0 s 1148400011485521 FDDI SK-5521 (SK-NET FDDI-UP) 0 s 1148400011485522 FDDI SK-5522 (SK-NET FDDI-UP DAS) 0 s 1148400011485541 FDDI SK-5541 (SK-NET FDDI-FP) 0 s 1148400011485543 FDDI SK-5543 (SK-NET FDDI-LP) 0 s 1148400011485544 FDDI SK-5544 (SK-NET FDDI-LP DAS) 0 s 1148400011485821 FDDI SK-5821 (SK-NET FDDI-UP64) 0 s 1148400011485822 FDDI SK-5822 (SK-NET FDDI-UP64 DAS) 0 s 1148400011485841 FDDI SK-5841 (SK-NET FDDI-FP64) 0 s 1148400011485843 FDDI SK-5843 (SK-NET FDDI-LP64) 0 s 1148400011485844 FDDI SK-5844 (SK-NET FDDI-LP64 DAS) 0 d 11484200 Token Ring adapter 0 d 11484300 Gigabit Ethernet 0 s 1148430011489821 SK-9821 (1000Base-T single link) 0 s 1148430011489822 SK-9822 (1000Base-T dual link) 0 s 1148430011489841 SK-9841 (1000Base-LX single link) 0 s 1148430011489842 SK-9842 (1000Base-LX dual link) 0 s 1148430011489843 SK-9843 (1000Base-SX single link) 0 s 1148430011489844 SK-9844 (1000Base-SX dual link) 0 s 1148430011489861 SK-9861 (1000Base-SX VF45 single link) 0 s 1148430011489862 SK-9862 (1000Base-SX VF45 dual link) 0 d 11484400 Gigabit Ethernet 0 v 1149 Win System Corporation 0 v 114a VMIC 0 d 114a5579 VMIPCI-5579 (Reflective Memory Card) 0 d 114a5587 VMIPCI-5587 (Reflective Memory Card) 0 d 114a6504 VMIC PCI 7755 FPGA 0 d 114a7587 VMIVME-7587 0 v 114b Canopus Co., Ltd 0 v 114c Annabooks 0 v 114d IC Corporation 0 v 114e Nikon Systems Inc 0 v 114f Digi International 0 d 114f0002 AccelePort EPC 0 d 114f0003 RightSwitch SE-6 0 d 114f0004 AccelePort Xem 0 d 114f0005 AccelePort Xr 0 d 114f0006 AccelePort Xr,C/X 0 d 114f0009 AccelePort Xr/J 0 d 114f000a AccelePort EPC/J 0 d 114f000c DataFirePRIme T1 (1-port) 0 d 114f000d SyncPort 2-Port (x.25/FR) 0 d 114f0011 AccelePort 8r EIA-232 (IBM) 0 d 114f0012 AccelePort 8r EIA-422 0 d 114f0013 AccelePort Xr 0 d 114f0014 AccelePort 8r EIA-422 0 d 114f0015 AccelePort Xem 0 d 114f0016 AccelePort EPC/X 0 d 114f0017 AccelePort C/X 0 d 114f001a DataFirePRIme E1 (1-port) 0 d 114f001b AccelePort C/X (IBM) 0 d 114f001d DataFire RAS T1/E1/PRI 0 s 114f001d114f0050 DataFire RAS E1 Adapter 0 s 114f001d114f0051 DataFire RAS Dual E1 Adapter 0 s 114f001d114f0052 DataFire RAS T1 Adapter 0 s 114f001d114f0053 DataFire RAS Dual T1 Adapter 0 d 114f0023 AccelePort RAS 0 d 114f0024 DataFire RAS B4 ST/U 0 s 114f0024114f0030 DataFire RAS BRI U Adapter 0 s 114f0024114f0031 DataFire RAS BRI S/T Adapter 0 d 114f0026 AccelePort 4r 920 0 d 114f0027 AccelePort Xr 920 0 d 114f0034 AccelePort 2r 920 0 d 114f0035 DataFire DSP T1/E1/PRI cPCI 0 d 114f0040 AccelePort Xp 0 d 114f0042 AccelePort 2p PCI 0 d 114f0070 Datafire Micro V IOM2 (Europe) 0 d 114f0071 Datafire Micro V (Europe) 0 d 114f0072 Datafire Micro V IOM2 (North America) 0 d 114f0073 Datafire Micro V (North America) 0 d 114f6001 Avanstar 0 v 1150 Thinking Machines Corp 0 v 1151 JAE Electronics Inc. 0 v 1152 Megatek 0 v 1153 Land Win Electronic Corp 0 v 1154 Melco Inc 0 v 1155 Pine Technology Ltd 0 v 1156 Periscope Engineering 0 v 1157 Avsys Corporation 0 v 1158 Voarx R & D Inc 0 d 11583011 Tokenet/vg 1001/10m anylan 0 d 11589050 Lanfleet/Truevalue 0 d 11589051 Lanfleet/Truevalue 0 v 1159 Mutech Corp 0 d 11590001 MV-1000 0 v 115a Harlequin Ltd 0 v 115b Parallax Graphics 0 v 115c Photron Ltd. 0 v 115d Xircom 0 d 115d0003 Cardbus Ethernet 10/100 0 s 115d000310140181 10/100 EtherJet Cardbus Adapter 0 s 115d000310141181 10/100 EtherJet Cardbus Adapter 0 s 115d000310148181 10/100 EtherJet Cardbus Adapter 0 s 115d000310149181 10/100 EtherJet Cardbus Adapter 0 s 115d0003115d0181 Cardbus Ethernet 10/100 0 s 115d0003115d1181 Cardbus Ethernet 10/100 0 s 115d000311790181 Cardbus Ethernet 10/100 0 s 115d000380868181 EtherExpress PRO/100 Mobile CardBus 32 Adapter 0 s 115d000380869181 EtherExpress PRO/100 Mobile CardBus 32 Adapter 0 d 115d0005 Cardbus Ethernet 10/100 0 s 115d000510140182 10/100 EtherJet Cardbus Adapter 0 s 115d000510141182 10/100 EtherJet Cardbus Adapter 0 s 115d0005115d0182 Cardbus Ethernet 10/100 0 s 115d0005115d1182 Cardbus Ethernet 10/100 0 d 115d0007 Cardbus Ethernet 10/100 0 s 115d000710140182 10/100 EtherJet Cardbus Adapter 0 s 115d000710141182 10/100 EtherJet Cardbus Adapter 0 s 115d0007115d0182 Cardbus Ethernet 10/100 0 s 115d0007115d1182 Cardbus Ethernet 10/100 0 d 115d000b Cardbus Ethernet 10/100 0 s 115d000b10140183 10/100 EtherJet Cardbus Adapter 0 s 115d000b115d0183 Cardbus Ethernet 10/100 0 d 115d000c Mini-PCI V.90 56k Modem 0 d 115d000f Cardbus Ethernet 10/100 0 s 115d000f10140183 10/100 EtherJet Cardbus Adapter 0 s 115d000f115d0183 Cardbus Ethernet 10/100 0 d 115d0101 Cardbus 56k modem 0 s 115d0101115d1081 Cardbus 56k Modem 0 d 115d0103 Cardbus Ethernet + 56k Modem 0 s 115d010310149181 Cardbus 56k Modem 0 s 115d010311151181 Cardbus Ethernet 100 + 56k Modem 0 s 115d0103115d1181 CBEM56G-100 Ethernet + 56k Modem 0 s 115d010380869181 PRO/100 LAN + Modem56 CardBus 0 v 115e Peer Protocols Inc 0 v 115f Maxtor Corporation 0 v 1160 Megasoft Inc 0 v 1161 PFU Limited 0 v 1162 OA Laboratory Co Ltd 0 v 1163 Rendition 0 d 11630001 Verite 1000 0 d 11632000 Verite V2000/V2100/V2200 0 s 1163200010922000 Stealth II S220 0 v 1164 Advanced Peripherals Technologies 0 v 1165 Imagraph Corporation 0 d 11650001 Motion TPEG Recorder/Player with audio 0 v 1166 ServerWorks 0 d 11660005 CNB20-LE Host Bridge 0 d 11660007 CNB20-LE Host Bridge 0 d 11660008 CNB20HE Host Bridge 0 d 11660009 CNB20LE Host Bridge 0 d 11660010 CIOB30 0 d 11660011 CMIC-HE 0 d 11660012 CMIC-LE 0 d 11660013 CNB20-HE Host Bridge 0 d 11660014 CNB20-HE Host Bridge 0 d 11660015 CMIC-GC Host Bridge 0 d 11660016 CMIC-GC Host Bridge 0 d 11660017 CMIC-SL 0 d 11660200 OSB4 South Bridge 0 d 11660201 CSB5 South Bridge 0 d 11660211 OSB4 IDE Controller 0 d 11660212 CSB5 IDE Controller 0 d 11660220 OSB4/CSB5 USB Controller 0 v 1167 Mutoh Industries Inc 0 v 1168 Thine Electronics Inc 0 v 1169 Centre for Development of Advanced Computing 0 v 116a Polaris Communications 0 d 116a6100 Bus/Tag Channel 0 d 116a6800 Escon Channel 0 d 116a7100 Bus/Tag Channel 0 d 116a7800 Escon Channel 0 v 116b Connectware Inc 0 v 116c Intelligent Resources Integrated Systems 0 v 116d Martin-Marietta 0 v 116e Electronics for Imaging 0 v 116f Workstation Technology 0 v 1170 Inventec Corporation 0 v 1171 Loughborough Sound Images Plc 0 v 1172 Altera Corporation 0 v 1173 Adobe Systems, Inc 0 v 1174 Bridgeport Machines 0 v 1175 Mitron Computer Inc. 0 v 1176 SBE Incorporated 0 v 1177 Silicon Engineering 0 v 1178 Alfa, Inc. 0 d 1178afa1 Fast Ethernet Adapter 0 v 1179 Toshiba America Info Systems 0 d 11790103 EX-IDE Type-B 0 d 11790404 DVD Decoder card 0 d 11790406 Tecra Video Capture device 0 d 11790407 DVD Decoder card (Version 2) 0 d 11790601 601 0 d 11790603 ToPIC95 PCI to CardBus Bridge for Notebooks 0 d 1179060a ToPIC95 0 d 1179060f ToPIC97 0 d 11790617 ToPIC95 PCI to Cardbus Bridge with ZV Support 0 d 11790618 CPU to PCI and PCI to ISA bridge 0 d 11790701 FIR Port 0 Claimed to be Lucent DSP1645 [Mars], but that's apparently incorrect. Does anyone know the correct ID? d 11790804 TC6371AF SmartMedia Controller 0 d 11790805 SD TypA Controller 0 d 11790d01 FIR Port Type-DO 0 s 11790d0111790001 FIR Port Type-DO 0 v 117a A-Trend Technology 0 v 117b L G Electronics, Inc. 0 v 117c Atto Technology 0 v 117d Becton & Dickinson 0 v 117e T/R Systems 0 v 117f Integrated Circuit Systems 0 v 1180 Ricoh Co Ltd 0 d 11800465 RL5c465 0 d 11800466 RL5c466 0 d 11800475 RL5c475 0 d 11800476 RL5c476 II 0 s 11800476104d80df Vaio PCG-FX403 0 s 11800476104d80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP 0 d 11800477 RL5c477 0 d 11800478 RL5c478 0 s 1180047810140184 ThinkPad A30p (2653-64G) 0 d 11800522 R5C522 IEEE 1394 Controller 0 s 11800522101401cf ThinkPad A30p (2653-64G) 0 d 11800551 R5C551 IEEE 1394 Controller 0 d 11800552 R5C552 IEEE 1394 Controller 0 v 1181 Telmatics International 0 v 1183 Fujikura Ltd 0 v 1184 Forks Inc 0 v 1185 Dataworld International Ltd 0 v 1186 D-Link System Inc 0 d 11860100 DC21041 0 d 11861002 DL10050 Sundance Ethernet 0 s 1186100211861002 DFE-550TX 0 s 1186100211861012 DFE-580TX 0 d 11861300 RTL8139 Ethernet 0 s 1186130011861300 DFE-538TX 10/100 Ethernet Adapter 0 s 1186130011861301 DFE-530TX+ 10/100 Ethernet Adapter 0 d 11861340 DFE-690TXD CardBus PC Card 0 d 11861561 DRP-32TXD Cardbus PC Card 0 d 11864000 DL2K Ethernet 0 v 1187 Advanced Technology Laboratories, Inc. 0 v 1188 Shima Seiki Manufacturing Ltd. 0 v 1189 Matsushita Electronics Co Ltd 0 v 118a Hilevel Technology 0 v 118b Hypertec Pty Limited 0 v 118c Corollary, Inc 0 d 118c0014 PCIB [C-bus II to PCI bus host bridge chip] 0 d 118c1117 Intel 8-way XEON Profusion Chipset [Cache Coherency Filter] 0 v 118d BitFlow Inc 0 d 118d0001 Raptor-PCI framegrabber 0 d 118d0012 Model 12 Road Runner Frame Grabber 0 d 118d0014 Model 14 Road Runner Frame Grabber 0 d 118d0024 Model 24 Road Runner Frame Grabber 0 d 118d0044 Model 44 Road Runner Frame Grabber 0 d 118d0112 Model 12 Road Runner Frame Grabber 0 d 118d0114 Model 14 Road Runner Frame Grabber 0 d 118d0124 Model 24 Road Runner Frame Grabber 0 d 118d0144 Model 44 Road Runner Frame Grabber 0 d 118d0212 Model 12 Road Runner Frame Grabber 0 d 118d0214 Model 14 Road Runner Frame Grabber 0 d 118d0224 Model 24 Road Runner Frame Grabber 0 d 118d0244 Model 44 Road Runner Frame Grabber 0 d 118d0312 Model 12 Road Runner Frame Grabber 0 d 118d0314 Model 14 Road Runner Frame Grabber 0 d 118d0324 Model 24 Road Runner Frame Grabber 0 d 118d0344 Model 44 Road Runner Frame Grabber 0 v 118e Hermstedt GmbH 0 v 118f Green Logic 0 v 1190 Tripace 0 d 1190c731 TP-910/920/940 PCI Ultra(Wide) SCSI Adapter 0 v 1191 Artop Electronic Corp 0 d 11910003 SCSI Cache Host Adapter 0 d 11910004 ATP8400 0 d 11910005 ATP850UF 0 d 11910006 ATP860 NO-BIOS 0 d 11910007 ATP860 0 d 11910008 ATP865 NO-ROM 0 d 11910009 ATP865 0 d 11918002 AEC6710 SCSI-2 Host Adapter 0 d 11918010 AEC6712UW SCSI 0 d 11918020 AEC6712U SCSI 0 d 11918030 AEC6712S SCSI 0 d 11918040 AEC6712D SCSI 0 d 11918050 AEC6712SUW SCSI 0 v 1192 Densan Company Ltd 0 v 1193 Zeitnet Inc. 0 d 11930001 1221 0 d 11930002 1225 0 v 1194 Toucan Technology 0 v 1195 Ratoc System Inc 0 v 1196 Hytec Electronics Ltd 0 v 1197 Gage Applied Sciences, Inc. 0 v 1198 Lambda Systems Inc 0 v 1199 Attachmate Corporation 0 v 119a Mind Share, Inc. 0 v 119b Omega Micro Inc. 0 d 119b1221 82C092G 0 v 119c Information Technology Inst. 0 v 119d Bug, Inc. Sapporo Japan 0 v 119e Fujitsu Microelectronics Ltd. 0 d 119e0001 FireStream 155 0 d 119e0003 FireStream 50 0 v 119f Bull HN Information Systems 0 v 11a0 Convex Computer Corporation 0 v 11a1 Hamamatsu Photonics K.K. 0 v 11a2 Sierra Research and Technology 0 v 11a3 Deuretzbacher GmbH & Co. Eng. KG 0 v 11a4 Barco Graphics NV 0 v 11a5 Microunity Systems Eng. Inc 0 v 11a6 Pure Data Ltd. 0 v 11a7 Power Computing Corp. 0 v 11a8 Systech Corp. 0 v 11a9 InnoSys Inc. 0 d 11a94240 AMCC S933Q Intelligent Serial Card 0 v 11aa Actel 0 v 11ab Galileo Technology Ltd. 0 d 11ab0146 GT-64010/64010A System Controller 0 d 11ab4611 GT-64115 System Controller 0 d 11ab4620 GT-64120/64120A/64121A System Controller 0 d 11ab4801 GT-48001 0 d 11abf003 GT-64010 Primary Image Piranha Image Generator 0 v 11ac Canon Information Systems Research Aust. 0 v 11ad Lite-On Communications Inc 0 d 11ad0002 LNE100TX 0 s 11ad000211ad0002 LNE100TX 0 s 11ad000211ad0003 LNE100TX 0 s 11ad000211adf003 LNE100TX 0 s 11ad000211adffff LNE100TX 0 s 11ad00021385f004 FA310TX 0 d 11adc115 LNE100TX [Linksys EtherFast 10/100] 0 s 11adc11511adc001 LNE100TX [ver 2.0] 0 v 11ae Aztech System Ltd 0 v 11af Avid Technology Inc. 0 v 11b0 V3 Semiconductor Inc. 0 d 11b00002 V300PSC 0 d 11b00292 V292PBC [Am29030/40 Bridge] 0 d 11b00960 V96xPBC 0 d 11b0c960 V96DPC 0 v 11b1 Apricot Computers 0 v 11b2 Eastman Kodak 0 v 11b3 Barr Systems Inc. 0 v 11b4 Leitch Technology International 0 v 11b5 Radstone Technology Plc 0 v 11b6 United Video Corp 0 v 11b7 Motorola 0 v 11b8 XPoint Technologies, Inc 0 d 11b80001 Quad PeerMaster 0 v 11b9 Pathlight Technology Inc. 0 d 11b9c0ed SSA Controller 0 v 11ba Videotron Corp 0 v 11bb Pyramid Technology 0 v 11bc Network Peripherals Inc 0 d 11bc0001 NP-PCI 0 v 11bd Pinnacle Systems Inc. 0 v 11be International Microcircuits Inc 0 v 11bf Astrodesign, Inc. 0 v 11c0 Hewlett Packard 0 v 11c1 Lucent Microelectronics 0 d 11c10440 56k WinModem 0 s 11c1044000010440 LT WinModem 56k Data+Fax+Voice+Dsvd 0 s 11c1044010338015 LT WinModem 56k Data+Fax+Voice+Dsvd 0 s 11c1044010338047 LT WinModem 56k Data+Fax+Voice+Dsvd 0 s 11c104401033804f LT WinModem 56k Data+Fax+Voice+Dsvd 0 s 11c1044010cf102c LB LT Modem V.90 56k 0 s 11c1044010cf104a BIBLO LT Modem 56k 0 s 11c1044010cf105f LB2 LT Modem V.90 56k 0 s 11c1044011790001 Internal V.90 Modem 0 s 11c1044011c10440 LT WinModem 56k Data+Fax+Voice+Dsvd 0 s 11c10440122d4101 MDP7800-U Modem 0 s 11c10440122d4102 MDP7800SP-U Modem 0 s 11c1044013e00040 LT WinModem 56k Data+Fax+Voice+Dsvd 0 s 11c1044013e00440 LT WinModem 56k Data+Fax+Voice+Dsvd 0 s 11c1044013e00441 LT WinModem 56k Data+Fax+Voice+Dsvd 0 s 11c1044013e00450 LT WinModem 56k Data+Fax+Voice+Dsvd 0 s 11c1044013e0f100 LT WinModem 56k Data+Fax+Voice+Dsvd 0 s 11c1044013e0f101 LT WinModem 56k Data+Fax+Voice+Dsvd 0 s 11c10440144d2101 LT56PV Modem 0 s 11c10440149f0440 LT WinModem 56k Data+Fax+Voice+Dsvd 0 d 11c10441 56k WinModem 0 s 11c104411033804d LT WinModem 56k Data+Fax 0 s 11c1044110338065 LT WinModem 56k Data+Fax 0 s 11c1044110920440 Supra 56i 0 s 11c1044111790001 Internal V.90 Modem 0 s 11c1044111c10440 LT WinModem 56k Data+Fax 0 s 11c1044111c10441 LT WinModem 56k Data+Fax 0 s 11c10441122d4100 MDP7800-U Modem 0 s 11c1044113e00040 LT WinModem 56k Data+Fax 0 s 11c1044113e00100 LT WinModem 56k Data+Fax 0 s 11c1044113e00410 LT WinModem 56k Data+Fax 0 s 11c1044113e00420 TelePath Internet 56k WinModem 0 s 11c1044113e00440 LT WinModem 56k Data+Fax 0 s 11c1044113e00443 LT WinModem 56k Data+Fax 0 s 11c1044113e0f102 LT WinModem 56k Data+Fax 0 s 11c1044114169804 CommWave 56k Modem 0 s 11c10441141d0440 LT WinModem 56k Data+Fax 0 s 11c10441144f0441 Lucent 56k V.90 DF Modem 0 s 11c10441144f0449 Lucent 56k V.90 DF Modem 0 s 11c10441144f110d Lucent Win Modem 0 s 11c1044114680441 Presario 56k V.90 DF Modem 0 s 11c1044116680440 Lucent Win Modem 0 d 11c10442 56k WinModem 0 s 11c1044200010440 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd 0 s 11c1044211c10440 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd 0 s 11c1044211c10442 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd 0 s 11c1044213e00412 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd 0 s 11c1044213e00442 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd 0 s 11c1044213fc2471 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd 0 s 11c10442144d2104 LT56PT Modem 0 s 11c10442144f1104 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd 0 s 11c10442149f0440 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd 0 s 11c1044216680440 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd 0 d 11c10443 LT WinModem 0 d 11c10444 LT WinModem 0 d 11c10445 LT WinModem 0 d 11c10446 LT WinModem 0 d 11c10447 LT WinModem 0 d 11c10448 WinModem 56k 0 s 11c1044810140131 Lucent Win Modem 0 s 11c1044810338066 LT WinModem 56k Data+Fax+Voice+Dsvd 0 s 11c1044813e00030 56k Voice Modem 0 s 11c1044813e00040 LT WinModem 56k Data+Fax+Voice+Dsvd 0 s 11c1044816682400 LT WinModem 56k (MiniPCI Ethernet+Modem) 0 Actiontech eth+modem card as used by Dell &c. d 11c10449 WinModem 56k 0 s 11c104490e11b14d 56k V.90 Modem 0 s 11c1044913e00020 LT WinModem 56k Data+Fax 0 s 11c1044913e00041 TelePath Internet 56k WinModem 0 s 11c1044914360440 Lucent Win Modem 0 s 11c10449144f0449 Lucent 56k V.90 DFi Modem 0 s 11c1044914680410 IBM ThinkPad T23 (2647-4MG) 0 s 11c1044914680440 Lucent Win Modem 0 s 11c1044914680449 Presario 56k V.90 DFi Modem 0 d 11c1044a F-1156IV WinModem (V90, 56KFlex) 0 s 11c1044a10cf1072 LB Global LT Modem 0 s 11c1044a13e00012 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd 0 s 11c1044a13e00042 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd 0 s 11c1044a144f1005 LT WinModem 56k Data+Fax+Voice+VoiceView+Dsvd 0 d 11c1044b LT WinModem 0 d 11c1044c LT WinModem 0 d 11c1044d LT WinModem 0 d 11c1044e LT WinModem 0 d 11c1044f V90 WildWire Modem 0 d 11c10450 LT WinModem 0 s 11c10450144f4005 Toshiba Magnia SG20 1 d 11c10451 LT WinModem 0 d 11c10452 LT WinModem 0 d 11c10453 LT WinModem 0 d 11c10454 LT WinModem 0 d 11c10455 LT WinModem 0 d 11c10456 LT WinModem 0 d 11c10457 LT WinModem 0 d 11c10458 LT WinModem 0 d 11c10459 LT WinModem 0 d 11c1045a LT WinModem 0 d 11c1045c LT WinModem 1 d 11c10461 V90 WildWire Modem 0 d 11c10462 V90 WildWire Modem 0 d 11c10480 Venus Modem (V90, 56KFlex) 0 d 11c15801 USB 0 d 11c15802 USS-312 USB Controller 0 d 11c15811 FW323 0 s 11c15811dead0800 FireWire Host Bus Adapter 0 v 11c2 Sand Microelectronics 0 v 11c3 NEC Corp 0 v 11c4 Document Technologies, Inc 0 v 11c5 Shiva Corporation 0 v 11c6 Dainippon Screen Mfg. Co. Ltd 0 v 11c7 D.C.M. Data Systems 0 v 11c8 Dolphin Interconnect Solutions AS 0 d 11c80658 PSB32 SCI-Adapter D31x 0 d 11c8d665 PSB64 SCI-Adapter D32x 0 d 11c8d667 PSB66 SCI-Adapter D33x 0 v 11c9 Magma 0 d 11c90010 16-line serial port w/- DMA 0 d 11c90011 4-line serial port w/- DMA 0 v 11ca LSI Systems, Inc 0 v 11cb Specialix Research Ltd. 0 d 11cb2000 PCI_9050 0 s 11cb200011cb0200 SX 0 s 11cb200011cbb008 I/O8+ 0 d 11cb4000 SUPI_1 0 d 11cb8000 T225 0 v 11cc Michels & Kleberhoff Computer GmbH 0 v 11cd HAL Computer Systems, Inc. 0 v 11ce Netaccess 0 v 11cf Pioneer Electronic Corporation 0 v 11d0 Lockheed Martin Federal Systems-Manassas 0 v 11d1 Auravision 0 d 11d101f7 VxP524 0 v 11d2 Intercom Inc. 0 v 11d3 Trancell Systems Inc 0 v 11d4 Analog Devices 0 d 11d41805 SM56 PCI modem 0 d 11d41889 AD1889 sound chip 0 v 11d5 Ikon Corporation 0 d 11d50115 10115 0 d 11d50117 10117 0 v 11d6 Tekelec Telecom 0 v 11d7 Trenton Technology, Inc. 0 v 11d8 Image Technologies Development 0 v 11d9 TEC Corporation 0 v 11da Novell 0 v 11db Sega Enterprises Ltd 0 v 11dc Questra Corporation 0 v 11dd Crosfield Electronics Limited 0 v 11de Zoran Corporation 0 d 11de6057 ZR36057PQC Video cutting chipset 0 s 11de605710317efe DC10 Plus 0 s 11de60571031fc00 MiroVIDEO DC50, Motion JPEG Capture/CODEC Board 0 s 11de605713ca4231 JPEG/TV Card 0 d 11de6120 ZR36120 0 s 11de61201328f001 Cinemaster C DVD Decoder 0 v 11df New Wave PDG 0 v 11e0 Cray Communications A/S 0 v 11e1 GEC Plessey Semi Inc. 0 v 11e2 Samsung Information Systems America 0 v 11e3 Quicklogic Corporation 0 d 11e35030 PC Watchdog 0 v 11e4 Second Wave Inc 0 v 11e5 IIX Consulting 0 v 11e6 Mitsui-Zosen System Research 0 v 11e7 Toshiba America, Elec. Company 0 v 11e8 Digital Processing Systems Inc. 0 v 11e9 Highwater Designs Ltd. 0 v 11ea Elsag Bailey 0 v 11eb Formation Inc. 0 v 11ec Coreco Inc 0 v 11ed Mediamatics 0 v 11ee Dome Imaging Systems Inc 0 v 11ef Nicolet Technologies B.V. 0 v 11f0 Compu-Shack 0 d 11f04231 FDDI 0 d 11f04232 FASTline UTP Quattro 0 d 11f04233 FASTline FO 0 d 11f04234 FASTline UTP 0 d 11f04235 FASTline-II UTP 0 d 11f04236 FASTline-II FO 0 d 11f04731 GIGAline 0 v 11f1 Symbios Logic Inc 0 v 11f2 Picture Tel Japan K.K. 0 v 11f3 Keithley Metrabyte 0 v 11f4 Kinetic Systems Corporation 0 d 11f42915 CAMAC controller 0 v 11f5 Computing Devices International 0 v 11f6 Compex 0 d 11f60112 ENet100VG4 0 d 11f60113 FreedomLine 100 0 d 11f61401 ReadyLink 2000 0 d 11f62011 RL100-ATX 10/100 0 s 11f6201111f62011 RL100-ATX 0 d 11f62201 ReadyLink 100TX (Winbond W89C840) 0 s 11f6220111f62011 ReadyLink 100TX 0 d 11f69881 RL100TX 0 v 11f7 Scientific Atlanta 0 v 11f8 PMC-Sierra Inc. 0 d 11f87375 PM7375 [LASAR-155 ATM SAR] 0 v 11f9 I-Cube Inc 0 v 11fa Kasan Electronics Company, Ltd. 0 v 11fb Datel Inc 0 v 11fc Silicon Magic 0 v 11fd High Street Consultants 0 v 11fe Comtrol Corporation 0 d 11fe0001 RocketPort 8 Oct 0 d 11fe0002 RocketPort 8 Intf 0 d 11fe0003 RocketPort 16 Intf 0 d 11fe0004 RocketPort 32 Intf 0 d 11fe0005 RocketPort Octacable 0 d 11fe0006 RocketPort 8J 0 d 11fe0007 RocketPort 4-port 0 d 11fe0008 RocketPort 8-port 0 d 11fe0009 RocketPort 16-port 0 d 11fe000a RocketPort Plus Quadcable 0 d 11fe000b RocketPort Plus Octacable 0 d 11fe000c RocketPort 8-port Modem 0 d 11fe8015 RocketPort 4-port UART 16954 0 v 11ff Scion Corporation 0 v 1200 CSS Corporation 0 v 1201 Vista Controls Corp 0 v 1202 Network General Corp. 0 v 1203 Bayer Corporation, Agfa Division 0 v 1204 Lattice Semiconductor Corporation 0 v 1205 Array Corporation 0 v 1206 Amdahl Corporation 0 v 1208 Parsytec GmbH 0 d 12084853 HS-Link Device 0 v 1209 SCI Systems Inc 0 v 120a Synaptel 0 v 120b Adaptive Solutions 0 v 120c Technical Corp. 0 v 120d Compression Labs, Inc. 0 v 120e Cyclades Corporation 0 d 120e0100 Cyclom-Y below first megabyte 0 d 120e0101 Cyclom-Y above first megabyte 0 d 120e0102 Cyclom-4Y below first megabyte 0 d 120e0103 Cyclom-4Y above first megabyte 0 d 120e0104 Cyclom-8Y below first megabyte 0 d 120e0105 Cyclom-8Y above first megabyte 0 d 120e0200 Cyclades-Z below first megabyte 0 d 120e0201 Cyclades-Z above first megabyte 0 d 120e0300 PC300/RSV or /X21 (2 ports) 0 d 120e0301 PC300/RSV or /X21 (1 port) 0 d 120e0310 PC300/TE (2 ports) 0 d 120e0311 PC300/TE (1 port) 0 d 120e0320 PC300/TE-M (2 ports) 0 d 120e0321 PC300/TE-M (1 port) 0 d 120e0400 PC400 0 v 120f Essential Communications 0 d 120f0001 Roadrunner serial HIPPI 0 v 1210 Hyperparallel Technologies 0 v 1211 Braintech Inc 0 v 1212 Kingston Technology Corp. 0 v 1213 Applied Intelligent Systems, Inc. 0 v 1214 Performance Technologies, Inc. 0 v 1215 Interware Co., Ltd 0 v 1216 Purup Prepress A/S 0 v 1217 O2 Micro, Inc. 0 d 12176729 OZ6729 0 d 1217673a OZ6730 0 d 12176832 OZ6832/6833 Cardbus Controller 0 d 12176836 OZ6836/6860 Cardbus Controller 0 d 12176872 OZ6812 Cardbus Controller 0 d 12176925 OZ6922 Cardbus Controller 0 d 12176933 OZ6933 Cardbus Controller 0 s 1217693310251016 Travelmate 612 TX 0 d 12176972 OZ6912 Cardbus Controller 0 s 1217697234127856 Toshiba Magnia SG20 1 v 1218 Hybricon Corp. 0 v 1219 First Virtual Corporation 0 v 121a 3Dfx Interactive, Inc. 0 d 121a0001 Voodoo 0 d 121a0002 Voodoo 2 0 d 121a0003 Voodoo Banshee 0 s 121a000310920003 Monster Fusion 0 s 121a000310924000 Monster Fusion 0 s 121a000310924002 Monster Fusion 0 s 121a000310924801 Monster Fusion AGP 0 s 121a000310924803 Monster Fusion AGP 0 s 121a000310928030 Monster Fusion 0 s 121a000310928035 Monster Fusion AGP 0 s 121a000310b00001 Dragon 4000 0 s 121a000311021018 3D Blaster Banshee VE 0 s 121a0003121a0001 Voodoo Banshee AGP 0 s 121a0003121a0003 Voodoo Banshee AGP SGRAM 0 s 121a0003121a0004 Voodoo Banshee 0 s 121a0003139c0016 Raven 0 s 121a0003139c0017 Raven 0 s 121a000314af0002 Maxi Gamer Phoenix 0 s 121a000330303030 Skywell Magic TwinPower 0 d 121a0004 Voodoo Banshee [Velocity 100] 0 d 121a0005 Voodoo 3 0 s 121a0005121a0004 Voodoo3 AGP 0 s 121a0005121a0030 Voodoo3 AGP 0 s 121a0005121a0031 Voodoo3 AGP 0 s 121a0005121a0034 Voodoo3 AGP 0 s 121a0005121a0036 Voodoo3 0 s 121a0005121a0037 Voodoo3 AGP 0 s 121a0005121a0038 Voodoo3 AGP 0 s 121a0005121a003a Voodoo3 AGP 0 s 121a0005121a0044 Voodoo3 0 s 121a0005121a004b Velocity 100 0 s 121a0005121a004c Velocity 200 0 s 121a0005121a004d Voodoo3 AGP 0 s 121a0005121a004e Voodoo3 AGP 0 s 121a0005121a0051 Voodoo3 AGP 0 s 121a0005121a0052 Voodoo3 AGP 0 s 121a0005121a0060 Voodoo3 3500 TV (NTSC) 0 s 121a0005121a0061 Voodoo3 3500 TV (PAL) 0 s 121a0005121a0062 Voodoo3 3500 TV (SECAM) 0 d 121a0009 Voodoo 4 / Voodoo 5 0 s 121a0009121a0009 Voodoo5 AGP 5500/6000 0 d 121a0057 Voodoo 3/3000 [Avenger] 0 v 121b Advanced Telecommunications Modules 0 v 121c Nippon Texaco., Ltd 0 v 121d Lippert Automationstechnik GmbH 0 v 121e CSPI 0 v 121f Arcus Technology, Inc. 0 v 1220 Ariel Corporation 0 d 12201220 AMCC 5933 TMS320C80 DSP/Imaging board 0 v 1221 Contec Co., Ltd 0 v 1222 Ancor Communications, Inc. 0 v 1223 Artesyn Communication Products 0 d 12230003 PM/Link 0 d 12230004 PM/T1 0 d 12230005 PM/E1 0 d 12230008 PM/SLS 0 d 12230009 BajaSpan Resource Target 0 d 1223000a BajaSpan Section 0 0 d 1223000b BajaSpan Section 1 0 d 1223000c BajaSpan Section 2 0 d 1223000d BajaSpan Section 3 0 d 1223000e PM/PPC 0 v 1224 Interactive Images 0 v 1225 Power I/O, Inc. 0 v 1227 Tech-Source 0 v 1228 Norsk Elektro Optikk A/S 0 v 1229 Data Kinesis Inc. 0 v 122a Integrated Telecom 0 v 122b LG Industrial Systems Co., Ltd 0 v 122c Sican GmbH 0 v 122d Aztech System Ltd 0 d 122d1206 368DSP 0 d 122d50dc 3328 Audio 0 s 122d50dc122d0001 3328 Audio 0 d 122d80da 3328 Audio 0 s 122d80da122d0001 3328 Audio 0 v 122e Xyratex 0 v 122f Andrew Corporation 0 v 1230 Fishcamp Engineering 0 v 1231 Woodward McCoach, Inc. 0 v 1232 GPT Limited 0 v 1233 Bus-Tech, Inc. 0 v 1234 Technical Corp. 0 v 1235 Risq Modular Systems, Inc. 0 v 1236 Sigma Designs Corporation 0 d 12360000 RealMagic64/GX 0 d 12366401 REALmagic 64/GX (SD 6425) 0 v 1237 Alta Technology Corporation 0 v 1238 Adtran 0 v 1239 3DO Company 0 v 123a Visicom Laboratories, Inc. 0 v 123b Seeq Technology, Inc. 0 v 123c Century Systems, Inc. 0 v 123d Engineering Design Team, Inc. 0 d 123d0000 EasyConnect 8/32 0 d 123d0002 EasyConnect 8/64 0 d 123d0003 EasyIO 0 v 123e Simutech, Inc. 0 v 123f C-Cube Microsystems 0 d 123f00e4 MPEG 0 d 123f8120 E4? 0 s 123f812011bd0006 DV500 E4 0 s 123f812011bd000a DV500 E4 0 d 123f8888 Cinemaster C 3.0 DVD Decoder 0 s 123f888810020001 Cinemaster C 3.0 DVD Decoder 0 s 123f888810020002 Cinemaster C 3.0 DVD Decoder 0 s 123f888813280001 Cinemaster C 3.0 DVD Decoder 0 v 1240 Marathon Technologies Corp. 0 v 1241 DSC Communications 0 v 1242 JNI Corporation 0 Formerly Jaycor Networks, Inc. d 12424643 FCI-1063 Fibre Channel Adapter 0 d 12426562 FCX2-6562 Dual Channel PCI-X Fibre Channel Adapter 0 d 1242656a FCX-6562 PCI-X Fibre Channel Adapter 0 v 1243 Delphax 0 v 1244 AVM Audiovisuelles MKTG & Computer System GmbH 0 d 12440700 B1 ISDN 0 d 12440800 C4 ISDN 0 d 12440a00 A1 ISDN [Fritz] 0 s 12440a0012440a00 FRITZ!Card ISDN Controller 0 d 12440e00 Fritz!PCI v2.0 ISDN 0 d 12441100 C2 ISDN 0 d 12441200 T1 ISDN 0 v 1245 A.P.D., S.A. 0 v 1246 Dipix Technologies, Inc. 0 v 1247 Xylon Research, Inc. 0 v 1248 Central Data Corporation 0 v 1249 Samsung Electronics Co., Ltd. 0 v 124a AEG Electrocom GmbH 0 v 124b SBS/Greenspring Modular I/O 0 d 124b0040 PCI-40A Quad IndustryPack Carrier or cPCI-200 Four Slot IndustryPack carrier 0 s 124b0040124b9080 PCI9080 Bridge 0 v 124c Solitron Technologies, Inc. 0 v 124d Stallion Technologies, Inc. 0 d 124d0000 EasyConnection 8/32 0 d 124d0002 EasyConnection 8/64 0 d 124d0003 EasyIO 0 d 124d0004 EasyConnection/RA 0 v 124e Cylink 0 v 124f Infotrend Technology, Inc. 0 d 124f0041 IFT-2000 Series RAID Controller 0 v 1250 Hitachi Microcomputer System Ltd 0 v 1251 VLSI Solutions Oy 0 v 1253 Guzik Technical Enterprises 0 v 1254 Linear Systems Ltd. 0 v 1255 Optibase Ltd 0 d 12551110 MPEG Forge 0 d 12551210 MPEG Fusion 0 d 12552110 VideoPlex 0 d 12552120 VideoPlex CC 0 d 12552130 VideoQuest 0 v 1256 Perceptive Solutions, Inc. 0 d 12564201 PCI-2220I 0 d 12564401 PCI-2240I 0 d 12565201 PCI-2000 0 v 1257 Vertex Networks, Inc. 0 v 1258 Gilbarco, Inc. 0 v 1259 Allied Telesyn International 0 d 12592560 AT-2560 Fast Ethernet Adapter (i82557B) 0 v 125a ABB Power Systems 0 v 125b Asix Electronics Corporation 0 d 125b1400 ALFA GFC2204 0 v 125c Aurora Technologies, Inc. 0 d 125c0640 Aries 16000P 0 v 125d ESS Technology 0 d 125d0000 ES336H Fax Modem (Early Model) 0 d 125d1948 Solo? 0 d 125d1968 ES1968 Maestro 2 0 s 125d196810280085 ES1968 Maestro-2 PCI 0 s 125d196810338051 ES1968 Maestro-2 Audiodrive 0 d 125d1969 ES1969 Solo-1 Audiodrive 0 s 125d196910140166 ES1969 SOLO-1 AudioDrive on IBM Aptiva Mainboard 0 s 125d1969125d8888 Solo-1 Audio Adapter 0 s 125d1969525fc888 ES1969 SOLO-1 AudioDrive (+ES1938) 0 d 125d1978 ES1978 Maestro 2E 0 s 125d19781033803c ES1978 Maestro-2E Audiodrive 0 s 125d197810338058 ES1978 Maestro-2E Audiodrive 0 s 125d197810924000 Monster Sound MX400 0 s 125d197811790001 ES1978 Maestro-2E Audiodrive 0 d 125d1988 ES1988 Allegro-1 0 s 125d198810924100 Sonic Impact S100 0 s 125d1988125d1988 ESS Allegro-1 Audiodrive 0 d 125d1989 ESS Modem 0 s 125d1989125d1989 ESS Modem 0 d 125d1998 ES1983S Maestro-3i PCI Audio Accelerator 0 s 125d1998102800e6 ES1983S Maestro-3i (Dell Inspiron 8100) 0 d 125d1999 ES1983S Maestro-3i PCI Modem Accelerator 0 d 125d199a ES1983S Maestro-3i PCI Audio Accelerator 0 d 125d199b ES1983S Maestro-3i PCI Modem Accelerator 0 d 125d2808 ES336H Fax Modem (Later Model) 0 d 125d2838 ES2838/2839 SuperLink Modem 0 d 125d2898 ES2898 Modem 0 s 125d2898125d0424 ES56-PI Data Fax Modem 0 s 125d2898125d0425 ES56T-PI Data Fax Modem 0 s 125d2898125d0426 ES56V-PI Data Fax Modem 0 s 125d2898125d0427 VW-PI Data Fax Modem 0 s 125d2898125d0428 ES56ST-PI Data Fax Modem 0 s 125d2898125d0429 ES56SV-PI Data Fax Modem 0 s 125d2898147ac001 ES56-PI Data Fax Modem 0 s 125d289814fe0428 ES56-PI Data Fax Modem 0 s 125d289814fe0429 ES56-PI Data Fax Modem 0 v 125e Specialvideo Engineering SRL 0 v 125f Concurrent Technologies, Inc. 0 v 1260 Harris Semiconductor 0 d 12603873 Prism 2.5 Wavelan chipset 0 s 1260387311863501 DWL-520 Wireless PCI Adapter 0 s 1260387317373874 WMP11 Wireless 802.11b PCI Adaptor 0 s 1260387380862513 Wireless 802.11b MiniPCI Adapter 1 d 12608130 HMP8130 NTSC/PAL Video Decoder 0 d 12608131 HMP8131 NTSC/PAL Video Decoder 0 v 1261 Matsushita-Kotobuki Electronics Industries, Ltd. 0 v 1262 ES Computer Company, Ltd. 0 v 1263 Sonic Solutions 0 v 1264 Aval Nagasaki Corporation 0 v 1265 Casio Computer Co., Ltd. 0 v 1266 Microdyne Corporation 0 d 12660001 NE10/100 Adapter (i82557B) 0 d 12661910 NE2000Plus (RT8029) Ethernet Adapter 0 s 1266191012661910 NE2000Plus Ethernet Adapter 0 v 1267 S. A. Telecommunications 0 d 12675352 PCR2101 0 d 12675a4b Telsat Turbo 0 v 1268 Tektronix 0 v 1269 Thomson-CSF/TTM 0 v 126a Lexmark International, Inc. 0 v 126b Adax, Inc. 0 v 126c Northern Telecom 0 v 126d Splash Technology, Inc. 0 v 126e Sumitomo Metal Industries, Ltd. 0 v 126f Silicon Motion, Inc. 0 d 126f0710 SM710 LynxEM 0 d 126f0712 SM712 LynxEM+ 0 d 126f0720 SM720 Lynx3DM 0 d 126f0810 SM810 LynxE 0 d 126f0811 SM811 LynxE 0 d 126f0820 SM820 Lynx3D 0 d 126f0910 SM910 0 v 1270 Olympus Optical Co., Ltd. 0 v 1271 GW Instruments 0 v 1272 Telematics International 0 v 1273 Hughes Network Systems 0 d 12730002 DirecPC 0 v 1274 Ensoniq 0 d 12741371 ES1371 [AudioPCI-97] 0 s 127413710e110024 AudioPCI on Motherboard Compaq Deskpro 0 s 127413710e11b1a7 ES1371, ES1373 AudioPCI 0 s 12741371103380ac ES1371, ES1373 AudioPCI 0 s 1274137110421854 Tazer 0 s 12741371107b8054 Tabor2 0 s 1274137112741371 Creative Sound Blaster AudioPCI64V, AudioPCI128 0 s 1274137114626470 ES1371, ES1373 AudioPCI On Motherboard MS-6147 1.1A 0 s 1274137114626560 ES1371, ES1373 AudioPCI On Motherboard MS-6156 1.10 0 s 1274137114626630 ES1371, ES1373 AudioPCI On Motherboard MS-6163BX 1.0A 0 s 1274137114626631 ES1371, ES1373 AudioPCI On Motherboard MS-6163VIA 1.0A 0 s 1274137114626632 ES1371, ES1373 AudioPCI On Motherboard MS-6163BX 2.0A 0 s 1274137114626633 ES1371, ES1373 AudioPCI On Motherboard MS-6163VIA 2.0A 0 s 1274137114626820 ES1371, ES1373 AudioPCI On Motherboard MS-6182 1.00 0 s 1274137114626822 ES1371, ES1373 AudioPCI On Motherboard MS-6182 1.00A 0 s 1274137114626830 ES1371, ES1373 AudioPCI On Motherboard MS-6183 1.00 0 s 1274137114626880 ES1371, ES1373 AudioPCI On Motherboard MS-6188 1.00 0 s 1274137114626900 ES1371, ES1373 AudioPCI On Motherboard MS-6190 1.00 0 s 1274137114626910 ES1371, ES1373 AudioPCI On Motherboard MS-6191 0 s 1274137114626930 ES1371, ES1373 AudioPCI On Motherboard MS-6193 0 s 1274137114626990 ES1371, ES1373 AudioPCI On Motherboard MS-6199BX 2.0A 0 s 1274137114626991 ES1371, ES1373 AudioPCI On Motherboard MS-6199VIA 2.0A 0 s 1274137114a42077 ES1371, ES1373 AudioPCI On Motherboard KR639 0 s 1274137114a42105 ES1371, ES1373 AudioPCI On Motherboard MR800 0 s 1274137114a42107 ES1371, ES1373 AudioPCI On Motherboard MR801 0 s 1274137114a42172 ES1371, ES1373 AudioPCI On Motherboard DR739 0 s 1274137115099902 ES1371, ES1373 AudioPCI On Motherboard KW11 0 s 1274137115099903 ES1371, ES1373 AudioPCI On Motherboard KW31 0 s 1274137115099904 ES1371, ES1373 AudioPCI On Motherboard KA11 0 s 1274137115099905 ES1371, ES1373 AudioPCI On Motherboard KC13 0 s 12741371152d8801 ES1371, ES1373 AudioPCI On Motherboard CP810E 0 s 12741371152d8802 ES1371, ES1373 AudioPCI On Motherboard CP810 0 s 12741371152d8803 ES1371, ES1373 AudioPCI On Motherboard P3810E 0 s 12741371152d8804 ES1371, ES1373 AudioPCI On Motherboard P3810-S 0 s 12741371152d8805 ES1371, ES1373 AudioPCI On Motherboard P3820-S 0 s 12741371270f2001 ES1371, ES1373 AudioPCI On Motherboard 6CTR 0 s 12741371270f2200 ES1371, ES1373 AudioPCI On Motherboard 6WTX 0 s 12741371270f3000 ES1371, ES1373 AudioPCI On Motherboard 6WSV 0 s 12741371270f3100 ES1371, ES1373 AudioPCI On Motherboard 6WIV2 0 s 12741371270f3102 ES1371, ES1373 AudioPCI On Motherboard 6WIV 0 s 12741371270f7060 ES1371, ES1373 AudioPCI On Motherboard 6ASA2 0 s 1274137180864249 ES1371, ES1373 AudioPCI On Motherboard BI440ZX 0 s 127413718086424c ES1371, ES1373 AudioPCI On Motherboard BL440ZX 0 s 127413718086425a ES1371, ES1373 AudioPCI On Motherboard BZ440ZX 0 s 1274137180864341 ES1371, ES1373 AudioPCI On Motherboard Cayman 0 s 1274137180864343 ES1371, ES1373 AudioPCI On Motherboard Cape Cod 0 s 1274137180864649 ES1371, ES1373 AudioPCI On Motherboard Fire Island 0 s 127413718086464a ES1371, ES1373 AudioPCI On Motherboard FJ440ZX 0 s 1274137180864d4f ES1371, ES1373 AudioPCI On Motherboard Montreal 0 s 1274137180864f43 ES1371, ES1373 AudioPCI On Motherboard OC440LX 0 s 1274137180865243 ES1371, ES1373 AudioPCI On Motherboard RC440BX 0 s 1274137180865352 ES1371, ES1373 AudioPCI On Motherboard SunRiver 0 s 1274137180865643 ES1371, ES1373 AudioPCI On Motherboard Vancouver 0 s 1274137180865753 ES1371, ES1373 AudioPCI On Motherboard WS440BX 0 d 12745000 ES1370 [AudioPCI] 0 s 1274500049424c4c Creative Sound Blaster AudioPCI128 0 d 12745880 5880 AudioPCI 0 s 1274588012742000 Creative Sound Blaster AudioPCI128 0 s 1274588012742003 Creative SoundBlaster AudioPCI 128 0 s 1274588012745880 Creative Sound Blaster AudioPCI128 0 s 127458801458a000 5880 AudioPCI On Motherboard 6OXET 0 s 1274588014626880 5880 AudioPCI On Motherboard MS-6188 1.00 0 s 12745880270f2001 5880 AudioPCI On Motherboard 6CTR 0 s 12745880270f2200 5880 AudioPCI On Motherboard 6WTX 0 s 12745880270f7040 5880 AudioPCI On Motherboard 6ATA4 0 v 1275 Network Appliance Corporation 0 v 1276 Switched Network Technologies, Inc. 0 v 1277 Comstream 0 v 1278 Transtech Parallel Systems Ltd. 0 d 12780701 TPE3/TM3 PowerPC Node 0 v 1279 Transmeta Corporation 0 d 12790295 Northbridge 0 d 12790395 LongRun Northbridge 0 d 12790396 SDRAM controller 0 d 12790397 BIOS scratchpad 0 v 127a Rockwell International 0 d 127a1002 HCF 56k Data/Fax Modem 0 s 127a10021092094c SupraExpress 56i PRO [Diamond SUP2380] 0 s 127a1002122d4002 HPG / MDP3858-U 0 s 127a1002122d4005 MDP3858-E 0 s 127a1002122d4007 MDP3858-A/-NZ 0 s 127a1002122d4012 MDP3858-SA 0 s 127a1002122d4017 MDP3858-W 0 s 127a1002122d4018 MDP3858-W 0 s 127a1002127a1002 Rockwell 56K D/F HCF Modem 0 d 127a1003 HCF 56k Data/Fax Modem 0 s 127a10030e11b0bc 229-DF Zephyr 0 s 127a10030e11b114 229-DF Cheetah 0 s 127a10031033802b 229-DF 0 s 127a100313df1003 PCI56RX Modem 0 s 127a100313e00117 IBM 0 s 127a100313e00147 IBM F-1156IV+/R3 Spain V.90 Modem 0 s 127a100313e00197 IBM 0 s 127a100313e001c7 IBM F-1156IV+/R3 WW V.90 Modem 0 s 127a100313e001f7 IBM 0 s 127a100314361003 IBM 0 s 127a100314361103 IBM 5614PM3G V.90 Modem 0 s 127a100314361602 Compaq 229-DF Ducati 0 d 127a1004 HCF 56k Data/Fax/Voice Modem 0 s 127a100410481500 MicroLink 56k Modem 0 s 127a100410cf1059 Fujitsu 229-DFRT 0 d 127a1005 HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem 0 s 127a100510338029 229-DFSV 0 s 127a100510338054 Modem 0 s 127a100510cf103c Fujitsu 0 s 127a100510cf1055 Fujitsu 229-DFSV 0 s 127a100510cf1056 Fujitsu 229-DFSV 0 s 127a1005122d4003 MDP3858SP-U 0 s 127a1005122d4006 Packard Bell MDP3858V-E 0 s 127a1005122d4008 MDP3858SP-A/SP-NZ 0 s 127a1005122d4009 MDP3858SP-E 0 s 127a1005122d4010 MDP3858V-U 0 s 127a1005122d4011 MDP3858SP-SA 0 s 127a1005122d4013 MDP3858V-A/V-NZ 0 s 127a1005122d4015 MDP3858SP-W 0 s 127a1005122d4016 MDP3858V-W 0 s 127a1005122d4019 MDP3858V-SA 0 s 127a100513df1005 PCI56RVP Modem 0 s 127a100513e00187 IBM 0 s 127a100513e001a7 IBM 0 s 127a100513e001b7 IBM DF-1156IV+/R3 Spain V.90 Modem 0 s 127a100513e001d7 IBM DF-1156IV+/R3 WW V.90 Modem 0 s 127a100514361005 IBM 0 s 127a100514361105 IBM 0 s 127a100514371105 IBM 5614PS3G V.90 Modem 0 d 127a1022 HCF 56k Modem 0 s 127a102214361303 M3-5614PM3G V.90 Modem 0 d 127a1023 HCF 56k Data/Fax Modem 0 s 127a1023122d4020 Packard Bell MDP3858-WE 0 s 127a1023122d4023 MDP3858-UE 0 s 127a102313e00247 IBM F-1156IV+/R6 Spain V.90 Modem 0 s 127a102313e00297 IBM 0 s 127a102313e002c7 IBM F-1156IV+/R6 WW V.90 Modem 0 s 127a102314361203 IBM 0 s 127a102314361303 IBM 0 d 127a1024 HCF 56k Data/Fax/Voice Modem 0 d 127a1025 HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem 0 s 127a102510cf106a Fujitsu 235-DFSV 0 s 127a1025122d4021 Packard Bell MDP3858V-WE 0 s 127a1025122d4022 MDP3858SP-WE 0 s 127a1025122d4024 MDP3858V-UE 0 s 127a1025122d4025 MDP3858SP-UE 0 d 127a1026 HCF 56k PCI Speakerphone Modem 0 d 127a1032 HCF 56k Modem 0 d 127a1033 HCF 56k Modem 0 d 127a1034 HCF 56k Modem 0 d 127a1035 HCF 56k PCI Speakerphone Modem 0 d 127a1036 HCF 56k Modem 0 d 127a1085 HCF 56k Volcano PCI Modem 0 d 127a2005 HCF 56k Data/Fax Modem 0 s 127a2005104d8044 229-DFSV 0 s 127a2005104d8045 229-DFSV 0 s 127a2005104d8055 PBE/Aztech 235W-DFSV 0 s 127a2005104d8056 235-DFSV 0 s 127a2005104d805a Modem 0 s 127a2005104d805f Modem 0 s 127a2005104d8074 Modem 0 d 127a2013 HSF 56k Data/Fax Modem 0 s 127a201311790001 Modem 0 s 127a20131179ff00 Modem 0 d 127a2014 HSF 56k Data/Fax/Voice Modem 0 s 127a201410cf1057 Fujitsu Citicorp III 0 s 127a2014122d4050 MSP3880-U 0 s 127a2014122d4055 MSP3880-W 0 d 127a2015 HSF 56k Data/Fax/Voice/Spkp (w/Handset) Modem 0 s 127a201510cf1063 Fujitsu 0 s 127a201510cf1064 Fujitsu 0 s 127a201514682015 Fujitsu 0 d 127a2016 HSF 56k Data/Fax/Voice/Spkp Modem 0 s 127a2016122d4051 MSP3880V-W 0 s 127a2016122d4052 MSP3880SP-W 0 s 127a2016122d4054 MSP3880V-U 0 s 127a2016122d4056 MSP3880SP-U 0 s 127a2016122d4057 MSP3880SP-A 0 d 127a4311 Riptide HSF 56k PCI Modem 0 s 127a4311127a4311 Ring Modular? Riptide HSF RT HP Dom 0 s 127a431113e00210 HP-GVC 0 d 127a4320 Riptide PCI Audio Controller 0 s 127a432012354320 Riptide PCI Audio Controller 0 d 127a4321 Riptide HCF 56k PCI Modem 0 s 127a432112354321 Hewlett Packard DF 0 s 127a432112354324 Hewlett Packard DF 0 s 127a432113e00210 Hewlett Packard DF 0 s 127a4321144d2321 Riptide 0 d 127a4322 Riptide PCI Game Controller 0 s 127a432212354322 Riptide PCI Game Controller 0 d 127a8234 RapidFire 616X ATM155 Adapter 0 s 127a8234108d0022 RapidFire 616X ATM155 Adapter 0 s 127a8234108d0027 RapidFire 616X ATM155 Adapter 0 v 127b Pixera Corporation 0 v 127c Crosspoint Solutions, Inc. 0 v 127d Vela Research 0 v 127e Winnov, L.P. 0 v 127f Fujifilm 0 v 1280 Photoscript Group Ltd. 0 v 1281 Yokogawa Electric Corporation 0 v 1282 Davicom Semiconductor, Inc. 0 d 12829009 Ethernet 100/10 MBit 0 d 12829100 Ethernet 100/10 MBit 0 d 12829102 Ethernet 100/10 MBit 0 d 12829132 Ethernet 100/10 MBit 0 v 1283 Integrated Technology Express, Inc. 0 d 1283673a IT8330G 0 d 12838330 IT8330G 0 d 12838888 IT8888F PCI to ISA Bridge with SMB 0 d 12838889 IT8889F PCI to ISA Bridge 0 d 1283e886 IT8330G 0 v 1284 Sahara Networks, Inc. 0 v 1285 Platform Technologies, Inc. 0 d 12850100 AGOGO sound chip (aka ESS Maestro 1) 0 v 1286 Mazet GmbH 0 v 1287 M-Pact, Inc. 0 d 1287001e LS220D DVD Decoder 0 d 1287001f LS220C DVD Decoder 0 v 1288 Timestep Corporation 0 v 1289 AVC Technology, Inc. 0 v 128a Asante Technologies, Inc. 0 v 128b Transwitch Corporation 0 v 128c Retix Corporation 0 v 128d G2 Networks, Inc. 0 d 128d0021 ATM155 Adapter 0 v 128e Hoontech Corporation/Samho Multi Tech Ltd. 0 d 128e0008 ST128 WSS/SB 0 d 128e0009 ST128 SAM9407 0 d 128e000a ST128 Game Port 0 d 128e000b ST128 MPU Port 0 d 128e000c ST128 Ctrl Port 0 v 128f Tateno Dennou, Inc. 0 v 1290 Sord Computer Corporation 0 v 1291 NCS Computer Italia 0 v 1292 Tritech Microelectronics Inc 0 v 1293 Media Reality Technology 0 v 1294 Rhetorex, Inc. 0 v 1295 Imagenation Corporation 0 v 1296 Kofax Image Products 0 v 1297 Holco Enterprise Co, Ltd/Shuttle Computer 0 v 1298 Spellcaster Telecommunications Inc. 0 v 1299 Knowledge Technology Lab. 0 v 129a VMetro, inc. 0 d 129a0615 PBT-615 PCI-X Bus Analyzer 0 v 129b Image Access 0 v 129c Jaycor 0 v 129d Compcore Multimedia, Inc. 0 v 129e Victor Company of Japan, Ltd. 0 v 129f OEC Medical Systems, Inc. 0 v 12a0 Allen-Bradley Company 0 v 12a1 Simpact Associates, Inc. 0 v 12a2 Newgen Systems Corporation 0 v 12a3 Lucent Technologies 0 v 12a4 NTT Electronics Technology Company 0 v 12a5 Vision Dynamics Ltd. 0 v 12a6 Scalable Networks, Inc. 0 v 12a7 AMO GmbH 0 v 12a8 News Datacom 0 v 12a9 Xiotech Corporation 0 v 12aa SDL Communications, Inc. 0 v 12ab Yuan Yuan Enterprise Co., Ltd. 0 d 12ab3000 MPG-200C PCI DVD Decoder Card 0 v 12ac Measurex Corporation 0 v 12ad Multidata GmbH 0 v 12ae Alteon Networks Inc. 0 d 12ae0001 AceNIC Gigabit Ethernet 0 s 12ae000112ae0001 Gigabit Ethernet-SX (Universal) 0 s 12ae000114100104 Gigabit Ethernet-SX PCI Adapter 0 d 12ae0002 AceNIC Gigabit Ethernet (Copper) 0 s 12ae000212ae0002 Gigabit Ethernet-T (3C986-T) 0 v 12af TDK USA Corp 0 v 12b0 Jorge Scientific Corp 0 v 12b1 GammaLink 0 v 12b2 General Signal Networks 0 v 12b3 Inter-Face Co Ltd 0 v 12b4 FutureTel Inc 0 v 12b5 Granite Systems Inc. 0 v 12b6 Natural Microsystems 0 v 12b7 Cognex Modular Vision Systems Div. - Acumen Inc. 0 v 12b8 Korg 0 v 12b9 US Robotics/3Com 0 d 12b91006 WinModem 0 s 12b9100612b9005c USR 56k Internal Voice WinModem (Model 3472) 0 s 12b9100612b9005e USR 56k Internal WinModem (Models 662975) 0 s 12b9100612b90062 USR 56k Internal Voice WinModem (Model 662978) 0 s 12b9100612b90068 USR 56k Internal Voice WinModem (Model 5690) 0 s 12b9100612b9007a USR 56k Internal Voice WinModem (Model 662974) 0 s 12b9100612b9007f USR 56k Internal WinModem (Models 5698, 5699) 0 s 12b9100612b90080 USR 56k Internal WinModem (Models 2975, 3528) 0 s 12b9100612b90081 USR 56k Internal Voice WinModem (Models 2974, 3529) 0 s 12b9100612b90091 USR 56k Internal Voice WinModem (Model 2978) 0 d 12b91007 USR 56k Internal WinModem 0 s 12b9100712b900a3 USR 56k Internal WinModem (Model 3595) 0 d 12b91008 56K FaxModem Model 5610 0 s 12b9100812b900a2 USR 56k Internal FAX Modem (Model 2977) 0 s 12b9100812b900aa USR 56k Internal Voice Modem (Model 2976) 0 s 12b9100812b900ab USR 56k Internal Voice Modem (Model 5609) 0 s 12b9100812b900ac USR 56k Internal Voice Modem (Model 3298) 0 s 12b9100812b900ad USR 56k Internal FAX Modem (Model 5610) 0 v 12ba BittWare, Inc. 0 v 12bb Nippon Unisoft Corporation 0 v 12bc Array Microsystems 0 v 12bd Computerm Corp. 0 v 12be Anchor Chips Inc. 0 d 12be3041 AN3041Q CO-MEM 0 d 12be3042 AN3042Q CO-MEM Lite 0 s 12be304212be3042 Anchor Chips Lite Evaluation Board 0 v 12bf Fujifilm Microdevices 0 v 12c0 Infimed 0 v 12c1 GMM Research Corp 0 v 12c2 Mentec Limited 0 v 12c3 Holtek Microelectronics Inc 0 d 12c30058 PCI NE2K Ethernet 0 d 12c35598 PCI NE2K Ethernet 0 v 12c4 Connect Tech Inc 0 v 12c5 Picture Elements Incorporated 0 d 12c5007e Imaging/Scanning Subsystem Engine 0 d 12c5007f Imaging/Scanning Subsystem Engine 0 d 12c50081 PCIVST [Grayscale Thresholding Engine] 0 d 12c50085 Video Simulator/Sender 0 d 12c50086 THR2 Multi-scale Thresholder 0 v 12c6 Mitani Corporation 0 v 12c7 Dialogic Corp 0 v 12c8 G Force Co, Ltd 0 v 12c9 Gigi Operations 0 v 12ca Integrated Computing Engines 0 v 12cb Antex Electronics Corporation 0 v 12cc Pluto Technologies International 0 v 12cd Aims Lab 0 v 12ce Netspeed Inc. 0 v 12cf Prophet Systems, Inc. 0 v 12d0 GDE Systems, Inc. 0 v 12d1 PSITech 0 v 12d2 NVidia / SGS Thomson (Joint Venture) 0 d 12d20008 NV1 0 d 12d20009 DAC64 0 d 12d20018 Riva128 0 s 12d2001810480c10 VICTORY Erazor 0 s 12d20018107b8030 STB Velocity 128 0 s 12d2001810920350 Viper V330 0 s 12d2001810921092 Viper V330 0 s 12d2001810b41b1b STB Velocity 128 0 s 12d2001810b41b1d STB Velocity 128 0 s 12d2001810b41b1e STB Velocity 128, PAL TV-Out 0 s 12d2001810b41b20 STB Velocity 128 Sapphire 0 s 12d2001810b41b21 STB Velocity 128 0 s 12d2001810b41b22 STB Velocity 128 AGP, NTSC TV-Out 0 s 12d2001810b41b23 STB Velocity 128 AGP, PAL TV-Out 0 s 12d2001810b41b27 STB Velocity 128 DVD 0 s 12d2001810b41b88 MVP Pro 128 0 s 12d2001810b4222a STB Velocity 128 AGP 0 s 12d2001810b42230 STB Velocity 128 0 s 12d2001810b42232 STB Velocity 128 0 s 12d2001810b42235 STB Velocity 128 AGP 0 s 12d200182a1554a3 3DVision-SAGP / 3DexPlorer 3000 0 d 12d20019 Riva128ZX 0 d 12d20020 TNT 0 d 12d20028 TNT2 0 d 12d20029 UTNT2 0 d 12d2002c VTNT2 0 d 12d200a0 ITNT2 0 v 12d3 Vingmed Sound A/S 0 v 12d4 Ulticom (Formerly DGM&S) 0 v 12d5 Equator Technologies 0 v 12d6 Analogic Corp 0 v 12d7 Biotronic SRL 0 v 12d8 Pericom Semiconductor 0 v 12d9 Aculab PLC 0 v 12da True Time Inc. 0 v 12db Annapolis Micro Systems, Inc 0 v 12dc Symicron Computer Communication Ltd. 0 v 12dd Management Graphics 0 v 12de Rainbow Technologies 0 v 12df SBS Technologies Inc 0 v 12e0 Chase Research 0 d 12e00010 ST16C654 Quad UART 0 d 12e00020 ST16C654 Quad UART 0 d 12e00030 ST16C654 Quad UART 0 v 12e1 Nintendo Co, Ltd 0 v 12e2 Datum Inc. Bancomm-Timing Division 0 v 12e3 Imation Corp - Medical Imaging Systems 0 v 12e4 Brooktrout Technology Inc 0 v 12e5 Apex Semiconductor Inc 0 v 12e6 Cirel Systems 0 v 12e7 Sunsgroup Corporation 0 v 12e8 Crisc Corp 0 v 12e9 GE Spacenet 0 v 12ea Zuken 0 v 12eb Aureal Semiconductor 0 d 12eb0001 Vortex 1 0 s 12eb0001104d8036 AU8820 Vortex Digital Audio Processor 0 s 12eb000110922000 Sonic Impact A3D 0 s 12eb000110922100 Sonic Impact A3D 0 s 12eb000110922110 Sonic Impact A3D 0 s 12eb000110922200 Sonic Impact A3D 0 s 12eb0001122d1002 AU8820 Vortex Digital Audio Processor 0 s 12eb000112eb0001 AU8820 Vortex Digital Audio Processor 0 s 12eb000150533355 Montego 0 d 12eb0002 Vortex 2 0 s 12eb0002104d8049 AU8830 Vortex 3D Digital Audio Processor 0 s 12eb0002104d807b AU8830 Vortex 3D Digital Audio Processor 0 s 12eb000210923000 Monster Sound II 0 s 12eb000210923001 Monster Sound II 0 s 12eb000210923002 Monster Sound II 0 s 12eb000210923003 Monster Sound II 0 s 12eb000210923004 Monster Sound II 0 s 12eb000212eb0001 AU8830 Vortex 3D Digital Audio Processor 0 s 12eb000212eb0002 AU8830 Vortex 3D Digital Audio Processor 0 s 12eb000212eb0088 AU8830 Vortex 3D Digital Audio Processor 0 s 12eb0002144d3510 AU8830 Vortex 3D Digital Audio Processor 0 s 12eb000250533356 Montego II 0 d 12eb0003 AU8810 Vortex Digital Audio Processor 0 s 12eb0003104d8049 AU8810 Vortex Digital Audio Processor 0 s 12eb0003104d8077 AU8810 Vortex Digital Audio Processor 0 s 12eb0003109f1000 AU8810 Vortex Digital Audio Processor 0 s 12eb000312eb0003 AU8810 Vortex Digital Audio Processor 0 s 12eb000314626780 AU8810 Vortex Digital Audio Processor 0 s 12eb000314a42073 AU8810 Vortex Digital Audio Processor 0 s 12eb000314a42091 AU8810 Vortex Digital Audio Processor 0 s 12eb000314a42104 AU8810 Vortex Digital Audio Processor 0 s 12eb000314a42106 AU8810 Vortex Digital Audio Processor 0 d 12eb8803 Vortex 56k Software Modem 0 s 12eb880312eb8803 Vortex 56k Software Modem 0 v 12ec 3A International, Inc. 0 v 12ed Optivision Inc. 0 v 12ee Orange Micro 0 v 12ef Vienna Systems 0 v 12f0 Pentek 0 v 12f1 Sorenson Vision Inc 0 v 12f2 Gammagraphx, Inc. 0 v 12f3 Radstone Technology 0 v 12f4 Megatel 0 v 12f5 Forks 0 v 12f6 Dawson France 0 v 12f7 Cognex 0 v 12f8 Electronic Design GmbH 0 d 12f80002 VideoMaker 0 v 12f9 Four Fold Ltd 0 v 12fb Spectrum Signal Processing 0 v 12fc Capital Equipment Corp 0 v 12fd I2S 0 v 12fe ESD Electronic System Design GmbH 0 v 12ff Lexicon 0 v 1300 Harman International Industries Inc 0 v 1302 Computer Sciences Corp 0 v 1303 Innovative Integration 0 v 1304 Juniper Networks 0 v 1305 Netphone, Inc 0 v 1306 Duet Technologies 0 v 1307 Computer Boards 0 d 13070001 PCI-DAS1602/16 0 d 1307000b PCI-DIO48H 0 d 1307000c PCI-PDISO8 0 d 1307000d PCI-PDISO16 0 d 1307000f PCI-DAS1200 0 d 13070010 PCI-DAS1602/12 0 d 13070014 PCI-DIO24H 0 d 13070015 PCI-DIO24H/CTR3 0 d 13070016 PCI-DIO48H/CTR15 0 d 13070017 PCI-DIO96H 0 d 13070018 PCI-CTR05 0 d 13070019 PCI-DAS1200/JR 0 d 1307001a PCI-DAS1001 0 d 1307001b PCI-DAS1002 0 d 1307001c PCI-DAS1602JR/16 0 d 1307001d PCI-DAS6402/16 0 d 1307001e PCI-DAS6402/12 0 d 1307001f PCI-DAS16/M1 0 d 13070020 PCI-DDA02/12 0 d 13070021 PCI-DDA04/12 0 d 13070022 PCI-DDA08/12 0 d 13070023 PCI-DDA02/16 0 d 13070024 PCI-DDA04/16 0 d 13070025 PCI-DDA08/16 0 d 13070026 PCI-DAC04/12-HS 0 d 13070027 PCI-DAC04/16-HS 0 d 13070028 PCI-DIO24 0 d 13070029 PCI-DAS08 0 d 1307002c PCI-INT32 0 d 13070033 PCI-DUAL-AC5 0 d 13070034 PCI-DAS-TC 0 d 13070035 PCI-DAS64/M1/16 0 d 13070036 PCI-DAS64/M2/16 0 d 13070037 PCI-DAS64/M3/16 0 d 1307004c PCI-DAS1000 0 v 1308 Jato Technologies Inc. 0 d 13080001 NetCelerator Adapter 0 s 1308000113080001 NetCelerator Adapter 0 v 1309 AB Semiconductor Ltd 0 v 130a Mitsubishi Electric Microcomputer 0 v 130b Colorgraphic Communications Corp 0 v 130c Ambex Technologies, Inc 0 v 130d Accelerix Inc 0 v 130e Yamatake-Honeywell Co. Ltd 0 v 130f Advanet Inc 0 v 1310 Gespac 0 v 1311 Videoserver, Inc 0 v 1312 Acuity Imaging, Inc 0 v 1313 Yaskawa Electric Co. 0 v 1316 Teradyne Inc 0 v 1317 Linksys 0 d 13170981 Fast Ethernet 10/100 0 d 13170985 Network Everywhere Fast Ethernet 10/100 model NC100 0 d 13171985 Fast Ethernet 10/100 0 v 1318 Packet Engines Inc. 0 d 13180911 PCI Ethernet Adapter 0 v 1319 Fortemedia, Inc 0 d 13190801 Xwave QS3000A [FM801] 0 d 13190802 Xwave QS3000A [FM801 game port] 0 d 13191000 FM801 PCI Audio 0 d 13191001 FM801 PCI Joystick 0 v 131a Finisar Corp. 0 v 131c Nippon Electro-Sensory Devices Corp 0 v 131d Sysmic, Inc. 0 v 131e Xinex Networks Inc 0 v 131f Siig Inc 0 d 131f1000 CyberSerial (1-port) 16550 0 d 131f1001 CyberSerial (1-port) 16650 0 d 131f1002 CyberSerial (1-port) 16850 0 d 131f1010 Duet 1S(16550)+1P 0 d 131f1011 Duet 1S(16650)+1P 0 d 131f1012 Duet 1S(16850)+1P 0 d 131f1020 CyberParallel (1-port) 0 d 131f1021 CyberParallel (2-port) 0 d 131f1030 CyberSerial (2-port) 16550 0 d 131f1031 CyberSerial (2-port) 16650 0 d 131f1032 CyberSerial (2-port) 16850 0 d 131f1034 Trio 2S(16550)+1P 0 d 131f1035 Trio 2S(16650)+1P 0 d 131f1036 Trio 2S(16850)+1P 0 d 131f1050 CyberSerial (4-port) 16550 0 d 131f1051 CyberSerial (4-port) 16650 0 d 131f1052 CyberSerial (4-port) 16850 0 d 131f2000 CyberSerial (1-port) 16550 0 d 131f2001 CyberSerial (1-port) 16650 0 d 131f2002 CyberSerial (1-port) 16850 0 d 131f2010 Duet 1S(16550)+1P 0 d 131f2011 Duet 1S(16650)+1P 0 d 131f2012 Duet 1S(16850)+1P 0 d 131f2020 CyberParallel (1-port) 0 d 131f2021 CyberParallel (2-port) 0 d 131f2030 CyberSerial (2-port) 16550 0 s 131f2030131f2030 PCI Serial Card 0 d 131f2031 CyberSerial (2-port) 16650 0 d 131f2032 CyberSerial (2-port) 16850 0 d 131f2040 Trio 1S(16550)+2P 0 d 131f2041 Trio 1S(16650)+2P 0 d 131f2042 Trio 1S(16850)+2P 0 d 131f2050 CyberSerial (4-port) 16550 0 d 131f2051 CyberSerial (4-port) 16650 0 d 131f2052 CyberSerial (4-port) 16850 0 d 131f2060 Trio 2S(16550)+1P 0 d 131f2061 Trio 2S(16650)+1P 0 d 131f2062 Trio 2S(16850)+1P 0 v 1320 Crypto AG 0 v 1321 Arcobel Graphics BV 0 v 1322 MTT Co., Ltd 0 v 1323 Dome Inc 0 v 1324 Sphere Communications 0 v 1325 Salix Technologies, Inc 0 v 1326 Seachange international 0 v 1327 Voss scientific 0 v 1328 quadrant international 0 v 1329 Productivity Enhancement 0 v 132a Microcom Inc. 0 v 132b Broadband Technologies 0 v 132c Micrel Inc 0 v 132d Integrated Silicon Solution, Inc. 0 v 1330 MMC Networks 0 v 1331 Radisys Corp. 0 v 1332 Micro Memory 0 d 13325415 MM-5415CN PCI Memory Module with Battery Backup 0 v 1334 Redcreek Communications, Inc 0 v 1335 Videomail, Inc 0 v 1337 Third Planet Publishing 0 v 1338 BT Electronics 0 v 133a Vtel Corp 0 v 133b Softcom Microsystems 0 v 133c Holontech Corp 0 v 133d SS Technologies 0 v 133e Virtual Computer Corp 0 v 133f SCM Microsystems 0 v 1340 Atalla Corp 0 v 1341 Kyoto Microcomputer Co 0 v 1342 Promax Systems Inc 0 v 1343 Phylon Communications Inc 0 v 1344 Crucial Technology 0 v 1345 Arescom Inc 0 v 1347 Odetics 0 v 1349 Sumitomo Electric Industries, Ltd. 0 v 134a DTC Technology Corp. 0 d 134a0001 Domex 536 0 d 134a0002 Domex DMX3194UP SCSI Adapter 0 v 134b ARK Research Corp. 0 v 134c Chori Joho System Co. Ltd 0 v 134d PCTel Inc 0 d 134d7890 HSP MicroModem 56 0 d 134d7891 HSP MicroModem 56 0 s 134d7891134d0001 HSP MicroModem 56 0 d 134d7892 HSP MicroModem 56 0 d 134d7893 HSP MicroModem 56 0 d 134d7894 HSP MicroModem 56 0 d 134d7895 HSP MicroModem 56 0 d 134d7896 HSP MicroModem 56 0 d 134d7897 HSP MicroModem 56 0 v 134e CSTI 0 v 134f Algo System Co Ltd 0 v 1350 Systec Co. Ltd 0 v 1351 Sonix Inc 0 v 1353 Thales Idatys 0 d 13530002 Proserver 0 d 13530003 PCI-FUT 0 d 13530004 PCI-S0 0 d 13530005 PCI-FUT-S0 0 v 1354 Dwave System Inc 0 v 1355 Kratos Analytical Ltd 0 v 1356 The Logical Co 0 v 1359 Prisa Networks 0 v 135a Brain Boxes 0 v 135b Giganet Inc 0 v 135c Quatech Inc 0 d 135c0010 QSC-100 1 d 135c0020 DSC-100 1 d 135c0030 DSC-200/300 1 d 135c0040 QSC-200/300 1 d 135c0050 ESC-100D 1 d 135c0060 ESC-100M 1 d 135c00f0 MPAC-100 Syncronous Serial Card (Zilog 85230) 0 d 135c0170 QSCLP-100 1 d 135c0180 DSCLP-100 1 d 135c0190 SSCLP-100 1 d 135c01a0 QSCLP-200/300 1 d 135c01b0 DSCLP-200/300 1 d 135c01c0 SSCLP-200/300 1 v 135d ABB Network Partner AB 0 v 135e Sealevel Systems Inc 0 d 135e7101 Single Port RS-232/422/485/530 0 d 135e7201 Dual Port RS-232/422/485 Interface 0 d 135e7202 Dual Port RS-232 Interface 0 d 135e7401 Four Port RS-232 Interface 0 d 135e7402 Four Port RS-422/485 Interface 0 d 135e7801 Eight Port RS-232 Interface 0 d 135e8001 8001 Digital I/O Adapter 0 v 135f I-Data International A-S 0 v 1360 Meinberg Funkuhren 0 v 1361 Soliton Systems K.K. 0 v 1362 Fujifacom Corporation 0 v 1363 Phoenix Technology Ltd 0 v 1364 ATM Communications Inc 0 v 1365 Hypercope GmbH 0 v 1366 Teijin Seiki Co. Ltd 0 v 1367 Hitachi Zosen Corporation 0 v 1368 Skyware Corporation 0 v 1369 Digigram 0 v 136a High Soft Tech 0 v 136b Kawasaki Steel Corporation 0 v 136c Adtek System Science Co Ltd 0 v 136d Gigalabs Inc 0 v 136f Applied Magic Inc 0 v 1370 ATL Products 0 v 1371 CNet Technology Inc 0 v 1373 Silicon Vision Inc 0 v 1374 Silicom Ltd 0 v 1375 Argosystems Inc 0 v 1376 LMC 0 v 1377 Electronic Equipment Production & Distribution GmbH 0 v 1378 Telemann Co. Ltd 0 v 1379 Asahi Kasei Microsystems Co Ltd 0 v 137a Mark of the Unicorn Inc 0 v 137b PPT Vision 0 v 137c Iwatsu Electric Co Ltd 0 v 137d Dynachip Corporation 0 v 137e Patriot Scientific Corporation 0 v 137f Japan Satellite Systems Inc 0 v 1380 Sanritz Automation Co Ltd 0 v 1381 Brains Co. Ltd 0 v 1382 Marian - Electronic & Software 0 v 1383 Controlnet Inc 0 v 1384 Reality Simulation Systems Inc 0 v 1385 Netgear 0 d 13854100 802.11b Wireless Adapter (MA301) 0 d 1385620a GA620 0 d 1385622a GA622 0 d 1385630a GA630 0 d 1385f311 FA311 0 v 1386 Video Domain Technologies 0 v 1387 Systran Corp 0 v 1388 Hitachi Information Technology Co Ltd 0 v 1389 Applicom International 0 d 13890001 PCI1500PFB [Intelligent fieldbus adaptor] 0 v 138a Fusion Micromedia Corp 0 v 138b Tokimec Inc 0 v 138c Silicon Reality 0 v 138d Future Techno Designs pte Ltd 0 v 138e Basler GmbH 0 v 138f Patapsco Designs Inc 0 v 1390 Concept Development Inc 0 v 1391 Development Concepts Inc 0 v 1392 Medialight Inc 0 v 1393 Moxa Technologies Co Ltd 0 d 13931040 Smartio C104H/PCI 0 d 13931680 Smartio C168H/PCI 0 d 13932040 Intellio CP-204J 0 d 13932180 Intellio C218 Turbo PCI 0 d 13933200 Intellio C320 Turbo PCI 0 v 1394 Level One Communications 0 d 13940001 LXT1001 Gigabit Ethernet 0 s 1394000113940001 NetCelerator Adapter 0 v 1395 Ambicom Inc 0 v 1396 Cipher Systems Inc 0 v 1397 Cologne Chip Designs GmbH 0 d 13972bd0 ISDN network controller [HFC-PCI] 0 s 13972bd013972bd0 ISDN Board 0 s 13972bd0e4bf1000 CI1-1-Harp 0 v 1398 Clarion co. Ltd 0 v 1399 Rios systems Co Ltd 0 v 139a Alacritech Inc 0 d 139a0001 Quad Port 10/100 Server Accelerator 0 d 139a0003 Single Port 10/100 Server Accelerator 0 d 139a0005 Single Port Gigabit Server Accelerator 0 v 139b Mediasonic Multimedia Systems Ltd 0 v 139c Quantum 3d Inc 0 v 139d EPL limited 0 v 139e Media4 0 v 139f Aethra s.r.l. 0 v 13a0 Crystal Group Inc 0 v 13a1 Kawasaki Heavy Industries Ltd 0 v 13a2 Ositech Communications Inc 0 v 13a3 Hifn Inc. 0 d 13a30005 7751 Security Processor 0 d 13a30006 6500 Public Key Processor 0 d 13a30007 7811 Security Processor 0 d 13a30012 7951 Security Processor 0 v 13a4 Rascom Inc 0 v 13a5 Audio Digital Imaging Inc 0 v 13a6 Videonics Inc 0 v 13a7 Teles AG 0 v 13a8 Exar Corp. 0 d 13a80158 XR17C158 Octal UART 0 v 13a9 Siemens Medical Systems, Ultrasound Group 0 v 13aa Broadband Networks Inc 0 v 13ab Arcom Control Systems Ltd 0 v 13ac Motion Media Technology Ltd 0 v 13ad Nexus Inc 0 v 13ae ALD Technology Ltd 0 v 13af T.Sqware 0 v 13b0 Maxspeed Corp 0 v 13b1 Tamura corporation 0 v 13b2 Techno Chips Co. Ltd 0 v 13b3 Lanart Corporation 0 v 13b4 Wellbean Co Inc 0 v 13b5 ARM 0 v 13b6 Dlog GmbH 0 v 13b7 Logic Devices Inc 0 v 13b8 Nokia Telecommunications oy 0 v 13b9 Elecom Co Ltd 0 v 13ba Oxford Instruments 0 v 13bb Sanyo Technosound Co Ltd 0 v 13bc Bitran Corporation 0 v 13bd Sharp corporation 0 v 13be Miroku Jyoho Service Co. Ltd 0 v 13bf Sharewave Inc 0 v 13c0 Microgate Corporation 0 d 13c00010 SyncLink WAN Adapter 0 v 13c1 3ware Inc 0 d 13c11000 3ware ATA-RAID 0 d 13c11001 3ware 7000-series ATA-RAID 0 d 13c11002 3ware ATA-RAID 0 v 13c2 Technotrend Systemtechnik GmbH 0 v 13c3 Janz Computer AG 0 v 13c4 Phase Metrics 0 v 13c5 Alphi Technology Corp 0 v 13c6 Condor Engineering Inc 0 v 13c7 Blue Chip Technology Ltd 0 v 13c8 Apptech Inc 0 v 13c9 Eaton Corporation 0 v 13ca Iomega Corporation 0 v 13cb Yano Electric Co Ltd 0 v 13cc Metheus Corporation 0 v 13cd Compatible Systems Corporation 0 v 13ce Cocom A/S 0 v 13cf Studio Audio & Video Ltd 0 v 13d0 Techsan Electronics Co Ltd 0 v 13d1 Abocom Systems Inc 0 d 13d1ab02 ADMtek Centaur-C rev 17 [D-Link DFE-680TX] CardBus Fast Ethernet Adapter 1 d 13d1ab06 RTL8139 [FE2000VX] CardBus Fast Ethernet Attached Port Adapter 0 v 13d2 Shark Multimedia Inc 0 v 13d3 IMC Networks 0 v 13d4 Graphics Microsystems Inc 0 v 13d5 Media 100 Inc 0 v 13d6 K.I. Technology Co Ltd 0 v 13d7 Toshiba Engineering Corporation 0 v 13d8 Phobos corporation 0 v 13d9 Apex PC Solutions Inc 0 v 13da Intresource Systems pte Ltd 0 v 13db Janich & Klass Computertechnik GmbH 0 v 13dc Netboost Corporation 0 v 13dd Multimedia Bundle Inc 0 v 13de ABB Robotics Products AB 0 v 13df E-Tech Inc 0 d 13df0001 PCI56RVP Modem 0 s 13df000113df0001 PCI56RVP Modem 0 v 13e0 GVC Corporation 0 v 13e1 Silicom Multimedia Systems Inc 0 v 13e2 Dynamics Research Corporation 0 v 13e3 Nest Inc 0 v 13e4 Calculex Inc 0 v 13e5 Telesoft Design Ltd 0 v 13e6 Argosy research Inc 0 v 13e7 NAC Incorporated 0 v 13e8 Chip Express Corporation 0 v 13e9 Chip Express Corporation 0 v 13ea Dallas Semiconductor 0 v 13eb Hauppauge Computer Works Inc 0 v 13ec Zydacron Inc 0 v 13ed Raytheion E-Systems 0 v 13ee Hayes Microcomputer Products Inc 0 v 13ef Coppercom Inc 0 v 13f0 Sundance Technology Inc 0 d 13f00201 ST201 Sundance Ethernet 0 v 13f1 Oce' - Technologies B.V. 0 v 13f2 Ford Microelectronics Inc 0 v 13f3 Mcdata Corporation 0 v 13f4 Troika Networks, Inc. 0 d 13f41401 Zentai Fibre Channel Adapter 0 v 13f5 Kansai Electric Co. Ltd 0 v 13f6 C-Media Electronics Inc 0 d 13f60100 CM8338A 0 s 13f6010013f6ffff CMI8338/C3DX PCI Audio Device 0 d 13f60101 CM8338B 0 s 13f6010113f60101 CMI8338-031 PCI Audio Device 0 d 13f60111 CM8738 0 s 13f6011110438077 CMI8738 6-channel audio controller 0 s 13f60111104380e2 CMI8738 6ch-MX 0 s 13f6011113f60111 CMI8738/C3DX PCI Audio Device 0 d 13f60211 CM8738 0 v 13f7 Wildfire Communications 0 v 13f8 Ad Lib Multimedia Inc 0 v 13f9 NTT Advanced Technology Corp. 0 v 13fa Pentland Systems Ltd 0 v 13fb Aydin Corp 0 v 13fc Computer Peripherals International 0 v 13fd Micro Science Inc 0 v 13fe Advantech Co. Ltd 0 d 13fe1756 PCI-1756 0 v 13ff Silicon Spice Inc 0 v 1400 Artx Inc 0 d 14001401 9432 TX 0 v 1401 CR-Systems A/S 0 v 1402 Meilhaus Electronic GmbH 0 v 1403 Ascor Inc 0 v 1404 Fundamental Software Inc 0 v 1405 Excalibur Systems Inc 0 v 1406 Oce' Printing Systems GmbH 0 v 1407 Lava Computer mfg Inc 0 d 14070100 Lava Dual Serial 0 d 14070101 Lava Quatro A 0 d 14070102 Lava Quatro B 0 d 14070200 Lava Port Plus 0 d 14070201 Lava Quad A 0 d 14070202 Lava Quad B 0 d 14070500 Lava Single Serial 0 d 14070600 Lava Port 650 0 d 14078000 Lava Parallel 0 d 14078001 Dual parallel port controller A 0 d 14078002 Lava Dual Parallel port A 0 d 14078003 Lava Dual Parallel port B 0 d 14078800 BOCA Research IOPPAR 0 v 1408 Aloka Co. Ltd 0 v 1409 Timedia Technology Co Ltd 0 d 14097168 PCI2S550 (Dual 16550 UART) 0 v 140a DSP Research Inc 0 v 140b Ramix Inc 0 v 140c Elmic Systems Inc 0 v 140d Matsushita Electric Works Ltd 0 v 140e Goepel Electronic GmbH 0 v 140f Salient Systems Corp 0 v 1410 Midas lab Inc 0 v 1411 Ikos Systems Inc 0 v 1412 IC Ensemble Inc 0 d 14121712 ICE1712 [Envy24] 0 v 1413 Addonics 0 v 1414 Microsoft Corporation 0 v 1415 Oxford Semiconductor Ltd 0 d 14158403 VScom 011H-EP1 1 port parallel adaptor 0 d 14159501 OX16PCI954 (Quad 16950 UART) function 0 0 s 1415950115ed2000 MCCR Serial p0-3 of 8 0 s 1415950115ed2001 MCCR Serial p0-3 of 16 0 d 1415950a EXSYS EX-41092 Dual 16950 Serial adapter 0 d 1415950b OXCB950 Cardbus 16950 UART 0 d 14159511 OX16PCI954 (Quad 16950 UART) function 1 0 s 1415951115ed2000 MCCR Serial p4-7 of 8 0 s 1415951115ed2001 MCCR Serial p4-15 of 16 0 d 14159521 OX16PCI952 (Dual 16950 UART) 0 v 1416 Multiwave Innovation pte Ltd 0 v 1417 Convergenet Technologies Inc 0 v 1418 Kyushu electronics systems Inc 0 v 1419 Excel Switching Corp 0 v 141a Apache Micro Peripherals Inc 0 v 141b Zoom Telephonics Inc 0 v 141d Digitan Systems Inc 0 v 141e Fanuc Ltd 0 v 141f Visiontech Ltd 0 v 1420 Psion Dacom plc 0 v 1421 Ads Technologies Inc 0 v 1422 Ygrec Systems Co Ltd 0 v 1423 Custom Technology Corp. 0 v 1424 Videoserver Connections 0 v 1425 ASIC Designers Inc 0 v 1426 Storage Technology Corp. 0 v 1427 Better On-Line Solutions 0 v 1428 Edec Co Ltd 0 v 1429 Unex Technology Corp. 0 v 142a Kingmax Technology Inc 0 v 142b Radiolan 0 v 142c Minton Optic Industry Co Ltd 0 v 142d Pix stream Inc 0 v 142e Vitec Multimedia 0 v 142f Radicom Research Inc 0 v 1430 ITT Aerospace/Communications Division 0 v 1431 Gilat Satellite Networks 0 v 1432 Edimax Computer Co. 0 v 1433 Eltec Elektronik GmbH 0 v 1435 Real Time Devices US Inc. 0 v 1436 CIS Technology Inc 0 v 1437 Nissin Inc Co 0 v 1438 Atmel-dream 0 v 1439 Outsource Engineering & Mfg. Inc 0 v 143a Stargate Solutions Inc 0 v 143b Canon Research Center, America 0 v 143c Amlogic Inc 0 v 143d Tamarack Microelectronics Inc 0 v 143e Jones Futurex Inc 0 v 143f Lightwell Co Ltd - Zax Division 0 v 1440 ALGOL Corp. 0 v 1441 AGIE Ltd 0 v 1442 Phoenix Contact GmbH & Co. 0 v 1443 Unibrain S.A. 0 v 1444 TRW 0 v 1445 Logical DO Ltd 0 v 1446 Graphin Co Ltd 0 v 1447 AIM GmBH 0 v 1448 Alesis Studio Electronics 0 v 1449 TUT Systems Inc 0 v 144a Adlink Technology 0 d 144a7296 PCI-7296 0 d 144a7432 PCI-7432 0 d 144a7433 PCI-7433 0 d 144a7434 PCI-7434 0 d 144a7841 PCI-7841 0 d 144a8133 PCI-8133 0 d 144a8554 PCI-8554 0 d 144a9111 PCI-9111 0 d 144a9113 PCI-9113 0 d 144a9114 PCI-9114 0 v 144b Loronix Information Systems Inc 0 v 144c Catalina Research Inc 0 v 144d Samsung Electronics Co Ltd 0 v 144e OLITEC 0 v 144f Askey Computer Corp. 0 v 1450 Octave Communications Ind. 0 v 1451 SP3D Chip Design GmBH 0 v 1453 MYCOM Inc 0 v 1454 Altiga Networks 0 v 1455 Logic Plus Plus Inc 0 v 1456 Advanced Hardware Architectures 0 v 1457 Nuera Communications Inc 0 v 1458 Giga-byte Technology 0 v 1459 DOOIN Electronics 0 v 145a Escalate Networks Inc 0 v 145b PRAIM SRL 0 v 145c Cryptek 0 v 145d Gallant Computer Inc 0 v 145e Aashima Technology B.V. 0 v 145f Baldor Electric Company 0 d 145f0001 NextMove PCI 0 v 1460 DYNARC INC 0 v 1461 Avermedia Technologies Inc 0 v 1462 Micro-star International Co Ltd 0 v 1463 Fast Corporation 0 v 1464 Interactive Circuits & Systems Ltd 0 v 1465 GN NETTEST Telecom DIV. 0 v 1466 Designpro Inc. 0 v 1467 DIGICOM SPA 0 v 1468 AMBIT Microsystem Corp. 0 v 1469 Cleveland Motion Controls 0 v 146a IFR 0 v 146b Parascan Technologies Ltd 0 v 146c Ruby Tech Corp. 0 v 146d Tachyon, INC. 0 v 146e Williams Electronics Games, Inc. 0 v 146f Multi Dimensional Consulting Inc 0 v 1470 Bay Networks 0 v 1471 Integrated Telecom Express Inc 0 v 1472 DAIKIN Industries, Ltd 0 v 1473 ZAPEX Technologies Inc 0 v 1474 Doug Carson & Associates 0 v 1475 PICAZO Communications 0 v 1476 MORTARA Instrument Inc 0 v 1477 Net Insight 0 v 1478 DIATREND Corporation 0 v 1479 TORAY Industries Inc 0 v 147a FORMOSA Industrial Computing 0 v 147b ABIT Computer Corp. 0 v 147c AWARE, Inc. 0 v 147d Interworks Computer Products 0 v 147e Matsushita Graphic Communication Systems, Inc. 0 v 147f NIHON UNISYS, Ltd. 0 v 1480 SCII Telecom 0 v 1481 BIOPAC Systems Inc 0 v 1482 ISYTEC - Integrierte Systemtechnik GmBH 0 v 1483 LABWAY Corporation 0 v 1484 Logic Corporation 0 v 1485 ERMA - Electronic GmBH 0 v 1486 L3 Communications Telemetry & Instrumentation 0 v 1487 MARQUETTE Medical Systems 0 v 1488 KONTRON Electronik GmBH 0 v 1489 KYE Systems Corporation 0 v 148a OPTO 0 v 148b INNOMEDIALOGIC Inc. 0 v 148c C.P. Technology Co. Ltd 0 v 148d DIGICOM Systems, Inc. 0 d 148d1003 HCF 56k Data/Fax Modem 0 v 148e OSI Plus Corporation 0 v 148f Plant Equipment, Inc. 0 v 1490 Stone Microsystems PTY Ltd. 0 v 1491 ZEAL Corporation 0 v 1492 Time Logic Corporation 0 v 1493 MAKER Communications 0 v 1494 WINTOP Technology, Inc. 0 v 1495 TOKAI Communications Industry Co. Ltd 0 v 1496 JOYTECH Computer Co., Ltd. 0 v 1497 SMA Regelsysteme GmBH 0 v 1498 TEWS Datentechnik GmBH 0 v 1499 EMTEC CO., Ltd 0 v 149a ANDOR Technology Ltd 0 v 149b SEIKO Instruments Inc 0 v 149c OVISLINK Corp. 0 v 149d NEWTEK Inc 0 v 149e Mapletree Networks Inc. 0 v 149f LECTRON Co Ltd 0 v 14a0 SOFTING GmBH 0 v 14a1 Systembase Co Ltd 0 v 14a2 Millennium Engineering Inc 0 v 14a3 Maverick Networks 0 v 14a4 GVC/BCM Advanced Research 0 v 14a5 XIONICS Document Technologies Inc 0 v 14a6 INOVA Computers GmBH & Co KG 0 v 14a7 MYTHOS Systems Inc 0 v 14a8 FEATRON Technologies Corporation 0 v 14a9 HIVERTEC Inc 0 v 14aa Advanced MOS Technology Inc 0 v 14ab Mentor Graphics Corp. 0 v 14ac Novaweb Technologies Inc 0 v 14ad Time Space Radio AB 0 v 14ae CTI, Inc 0 v 14af Guillemot Corporation 0 d 14af7102 3D Prophet II MX 0 v 14b0 BST Communication Technology Ltd 0 v 14b1 Nextcom K.K. 0 v 14b2 ENNOVATE Networks Inc 0 v 14b3 XPEED Inc 0 d 14b30000 DSL NIC 0 v 14b4 PHILIPS Business Electronics B.V. 0 v 14b5 Creamware GmBH 0 v 14b6 Quantum Data Corp. 0 v 14b7 PROXIM Inc 0 d 14b70001 Symphony 4110 0 v 14b8 Techsoft Technology Co Ltd 0 v 14b9 AIRONET Wireless Communications 0 d 14b90001 PC4800 0 d 14b90340 PC4800 0 d 14b90350 PC4800 0 d 14b94500 PC4500 0 d 14b94800 PC4800 0 d 14b9a504 Cisco Aironet Wireless 802.11b 1 This is the name used by IBM in their Thinkpad T30 doc. It is a wireless ethernet card. v 14ba INTERNIX Inc. 0 v 14bb SEMTECH Corporation 0 v 14bc Globespan Semiconductor Inc. 0 v 14bd CARDIO Control N.V. 0 v 14be L3 Communications 0 v 14bf SPIDER Communications Inc. 0 v 14c0 COMPAL Electronics Inc 0 v 14c1 MYRICOM Inc. 0 v 14c2 DTK Computer 0 v 14c3 MEDIATEK Corp. 0 v 14c4 IWASAKI Information Systems Co Ltd 0 v 14c5 Automation Products AB 0 v 14c6 Data Race Inc 0 v 14c7 Modular Technology Holdings Ltd 0 v 14c8 Turbocomm Tech. Inc. 0 v 14c9 ODIN Telesystems Inc 0 v 14ca PE Logic Corp. 0 v 14cb Billionton Systems Inc 0 v 14cc NAKAYO Telecommunications Inc 0 v 14cd Universal Scientific Ind. 0 v 14ce Whistle Communications 0 v 14cf TEK Microsystems Inc. 0 v 14d0 Ericsson Axe R & D 0 v 14d1 Computer Hi-Tech Co Ltd 0 v 14d2 Titan Electronics Inc 0 d 14d28001 VScom 010L 1 port parallel adaptor 0 d 14d28002 VScom 020L 2 port parallel adaptor 0 d 14d28010 VScom 100L 1 port serial adaptor 0 d 14d28011 VScom 110L 1 port serial and 1 port parallel adaptor 0 d 14d28020 VScom 200L 1 port serial adaptor 0 d 14d28021 VScom 210L 2 port serial and 1 port parallel adaptor 0 d 14d28040 VScom 400L 4 port serial adaptor 0 d 14d28080 VScom 800L 8 port serial adaptor 0 d 14d2a000 VScom 010H 1 port parallel adaptor 0 d 14d2a001 VScom 100H 1 port serial adaptor 0 d 14d2a003 VScom 400H 4 port serial adaptor 0 d 14d2a004 VScom 400HF1 4 port serial adaptor 0 d 14d2a005 VScom 200H 2 port serial adaptor 0 d 14d2e001 VScom 010HV2 1 port parallel adaptor 0 d 14d2e010 VScom 100HV2 1 port serial adaptor 0 d 14d2e020 VScom 200HV2 2 port serial adaptor 0 v 14d3 CIRTECH (UK) Ltd 0 v 14d4 Panacom Technology Corp 0 v 14d5 Nitsuko Corporation 0 v 14d6 Accusys Inc 0 v 14d7 Hirakawa Hewtech Corp 0 v 14d8 HOPF Elektronik GmBH 0 v 14d9 Alpha Processor Inc 0 v 14da National Aerospace Laboratories 0 v 14db AFAVLAB Technology Inc 0 d 14db2120 TK9902 0 v 14dc Amplicon Liveline Ltd 0 d 14dc0000 PCI230 0 d 14dc0001 PCI242 0 d 14dc0002 PCI244 0 d 14dc0003 PCI247 0 d 14dc0004 PCI248 0 d 14dc0005 PCI249 0 d 14dc0006 PCI260 0 d 14dc0007 PCI224 0 d 14dc0008 PCI234 0 d 14dc0009 PCI236 0 d 14dc000a PCI272 0 d 14dc000b PCI215 0 v 14dd Boulder Design Labs Inc 0 v 14de Applied Integration Corporation 0 v 14df ASIC Communications Corp 0 v 14e1 INVERTEX 0 v 14e2 INFOLIBRIA 0 v 14e3 AMTELCO 0 v 14e4 Broadcom Corporation 0 d 14e41644 NetXtreme BCM5700 Gigabit Ethernet 0 s 14e4164410140277 Broadcom Vigil B5700 1000BaseTX 0 s 14e41644102800d1 Broadcom BCM5700 0 s 14e4164410280106 Broadcom BCM5700 0 s 14e4164410280109 Broadcom BCM5700 1000BaseTX 0 s 14e416441028010a Broadcom BCM5700 1000BaseTX 0 s 14e4164410b71000 3C996-T 1000BaseTX 0 s 14e4164410b71001 3C996B-T 1000BaseTX 0 s 14e4164410b71002 3C996C-T 1000BaseTX 0 s 14e4164410b71003 3C997-T 1000BaseTX Dual Port 0 s 14e4164410b71004 3C996-SX 1000BaseSX 0 s 14e4164410b71005 3C997-SX 1000BaseSX Dual Port 0 s 14e4164410b71008 3C942 Gigabit LOM (31X31) 0 s 14e4164414e40002 NetXtreme 1000BaseSX 0 s 14e4164414e40003 NetXtreme 1000BaseSX 0 s 14e4164414e40004 NetXtreme 1000BaseTX 0 s 14e4164414e41028 NetXtreme 1000BaseTX 0 s 14e4164414e41644 BCM5700 1000BaseTX 0 d 14e41645 NetXtreme BCM5701 Gigabit Ethernet 0 s 14e416450e11007c NC7770 Gigabit Server Adapter (PCI-X, 10/100/1000-T) 0 s 14e416450e11007d NC6770 Gigabit Server Adapter (PCI-X, 1000-SX) 0 s 14e416450e110085 NC7780 Gigabit Server Adapter (embedded, WOL) 0 s 14e416450e110099 NC7780 Gigabit Server Adapter (embedded, WOL) 0 s 14e416450e11009a NC7770 Gigabit Server Adapter (PCI-X, 10/100/1000-T) 0 s 14e4164510280121 Broadcom BCM5701 1000BaseTX 0 s 14e4164510b71004 3C996-SX 1000BaseSX 0 s 14e4164510b71006 3C996B-T 1000BaseTX 0 s 14e4164510b71007 3C1000-T 1000BaseTX 0 s 14e4164510b71008 3C940-BR01 1000BaseTX 0 s 14e4164514e40001 BCM5701 1000BaseTX 0 s 14e4164514e40005 BCM5701 1000BaseTX 0 s 14e4164514e40006 BCM5701 1000BaseTX 0 s 14e4164514e40007 BCM5701 1000BaseSX 0 s 14e4164514e40008 BCM5701 1000BaseTX 0 s 14e4164514e48008 BCM5701 1000BaseTX 0 d 14e41646 NetXtreme BCM5702 Gigabit Ethernet 0 s 14e416460e1100bb NC7760 1000BaseTX 0 s 14e4164610280126 Broadcom BCM5702 1000BaseTX 0 s 14e4164614e48009 BCM5702 1000BaseTX 0 d 14e41647 NetXtreme BCM5703 Gigabit Ethernet 0 s 14e416470e110099 NC7780 1000BaseTX 0 s 14e416470e11009a NC7770 1000BaseTX 0 s 14e4164714e40009 BCM5703 1000BaseTX 0 s 14e4164714e4000a BCM5703 1000BaseSX 0 s 14e4164714e4000b BCM5703 1000BaseTX 0 s 14e4164714e48009 BCM5703 1000BaseTX 0 s 14e4164714e4800a BCM5703 1000BaseTX 0 d 14e41648 "Broadcom Corporation|BCM5704 1000BaseTX" 1 d 14e4164d NetXtreme BCM5702FE Gigabit Ethernet 0 d 14e416a6 NetXtreme BCM5702X Gigabit Ethernet 0 d 14e416a7 NetXtreme BCM5703X Gigabit Ethernet 0 d 14e416a8 Broadcom Corporation|BCM5704 1000BaseSX 1 d 14e44210 BCM4210 iLine10 HomePNA 2.0 1 d 14e44211 BCM4211 iLine10 HomePNA 2.0 + V.90 56k modem 1 d 14e44212 BCM v.90 56k modem 0 d 14e44212 BCM4212 v.90 56k modem 1 d 14e44402 BCM4402 Integrated 10/100BaseT 1 d 14e44410 BCM4413 iLine32 HomePNA 2.0 1 d 14e44411 BCM4413 V.90 56k modem 1 d 14e44412 BCM4413 10/100BaseT 1 d 14e45820 BCM5820 Crypto Accelerator 0 d 14e45821 BCM5821 Crypto Accelerator 0 v 14e5 Pixelfusion Ltd 0 v 14e6 SHINING Technology Inc 0 v 14e7 3CX 0 v 14e8 RAYCER Inc 0 v 14e9 GARNETS System CO Ltd 0 v 14ea Planex Communications, Inc 0 d 14eaab06 FNW-3603-TX CardBus Fast Ethernet 0 v 14eb SEIKO EPSON Corp 0 v 14ec ACQIRIS 0 v 14ed DATAKINETICS Ltd 0 v 14ee MASPRO KENKOH Corp 0 v 14ef CARRY Computer ENG. CO Ltd 0 v 14f0 CANON RESEACH CENTRE FRANCE 0 v 14f1 Conexant 0 d 14f11002 HCF 56k Modem 0 d 14f11003 HCF 56k Modem 0 d 14f11004 HCF 56k Modem 0 d 14f11005 HCF 56k Modem 0 d 14f11006 HCF 56k Modem 0 d 14f11022 HCF 56k Modem 0 d 14f11023 HCF 56k Modem 0 d 14f11024 HCF 56k Modem 0 d 14f11025 HCF 56k Modem 0 d 14f11026 HCF 56k Modem 0 d 14f11032 HCF 56k Modem 0 d 14f11033 HCF 56k Data/Fax Modem 0 s 14f1103310338077 NEC 0 s 14f11033122d4027 Dell Zeus - MDP3880-W(B) Data Fax Modem 0 s 14f11033122d4030 Dell Mercury - MDP3880-U(B) Data Fax Modem 0 s 14f11033122d4034 Dell Thor - MDP3880-W(U) Data Fax Modem 0 s 14f1103313e0020d Dell Copper 0 s 14f1103313e0020e Dell Silver 0 s 14f1103313e00261 IBM 0 s 14f1103313e00290 Compaq Goldwing 0 s 14f1103313e002a0 IBM 0 s 14f1103313e002b0 IBM 0 s 14f1103313e002c0 Compaq Scooter 0 s 14f1103313e002d0 IBM 0 s 14f11033144f1500 IBM P85-DF (1) 0 s 14f11033144f1501 IBM P85-DF (2) 0 s 14f11033144f150a IBM P85-DF (3) 0 s 14f11033144f150b IBM P85-DF Low Profile (1) 0 s 14f11033144f1510 IBM P85-DF Low Profile (2) 0 d 14f11034 HCF 56k Data/Fax/Voice Modem 0 d 14f11035 HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem 0 s 14f1103510cf1098 Fujitsu P85-DFSV 0 d 14f11036 HCF 56k Data/Fax/Voice/Spkp Modem 0 s 14f11036104d8067 HCF 56k Modem 0 s 14f11036122d4029 MDP3880SP-W 0 s 14f11036122d4031 MDP3880SP-U 0 s 14f1103613e00209 Dell Titanium 0 s 14f1103613e0020a Dell Graphite 0 s 14f1103613e00260 Gateway Red Owl 0 s 14f1103613e00270 Gateway White Horse 0 d 14f11052 HCF 56k Data/Fax Modem (Worldwide) 0 d 14f11053 HCF 56k Data/Fax Modem (Worldwide) 0 d 14f11054 HCF 56k Data/Fax/Voice Modem (Worldwide) 0 d 14f11055 HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem (Worldwide) 0 d 14f11056 HCF 56k Data/Fax/Voice/Spkp Modem (Worldwide) 0 d 14f11057 HCF 56k Data/Fax/Voice/Spkp Modem (Worldwide) 0 d 14f11059 HCF 56k Data/Fax/Voice Modem (Worldwide) 0 d 14f11063 HCF 56k Data/Fax Modem 0 d 14f11064 HCF 56k Data/Fax/Voice Modem 0 d 14f11065 HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem 0 d 14f11066 HCF 56k Data/Fax/Voice/Spkp Modem 0 s 14f11066122d4033 Dell Athena - MDP3900V-U 0 d 14f11433 HCF 56k Data/Fax Modem 0 d 14f11434 HCF 56k Data/Fax/Voice Modem 0 d 14f11435 HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem 0 d 14f11436 HCF 56k Data/Fax Modem 0 d 14f11453 HCF 56k Data/Fax Modem 0 s 14f1145313e00240 IBM 0 s 14f1145313e00250 IBM 0 s 14f11453144f1502 IBM P95-DF (1) 0 s 14f11453144f1503 IBM P95-DF (2) 0 d 14f11454 HCF 56k Data/Fax/Voice Modem 0 d 14f11455 HCF 56k Data/Fax/Voice/Spkp (w/Handset) Modem 0 d 14f11456 HCF 56k Data/Fax/Voice/Spkp Modem 0 s 14f11456122d4035 Dell Europa - MDP3900V-W 0 s 14f11456122d4302 Dell MP3930V-W(C) MiniPCI 0 d 14f11610 ADSL AccessRunner PCI Arbitration Device 0 d 14f11611 AccessRunner PCI ADSL Interface Device 0 d 14f11803 HCF 56k Modem 0 s 14f118030e110023 623-LAN Grizzly 0 s 14f118030e110043 623-LAN Yogi 0 d 14f11815 HCF 56k Modem 0 s 14f118150e110022 Grizzly 0 s 14f118150e110042 Yogi 0 d 14f12003 HSF 56k Data/Fax Modem 0 d 14f12004 HSF 56k Data/Fax/Voice Modem 0 d 14f12005 HSF 56k Data/Fax/Voice/Spkp (w/Handset) Modem 0 d 14f12006 HSF 56k Data/Fax/Voice/Spkp Modem 0 d 14f12013 HSF 56k Data/Fax Modem 0 s 14f120130e11b195 Bear 0 s 14f120130e11b196 Seminole 1 0 s 14f120130e11b1be Seminole 2 0 s 14f1201310258013 Acer 0 s 14f120131033809d NEC 0 s 14f12013103380bc NEC 0 s 14f12013155d6793 HP 0 s 14f12013155d8850 E Machines 0 d 14f12014 HSF 56k Data/Fax/Voice Modem 0 d 14f12015 HSF 56k Data/Fax/Voice/Spkp (w/Handset) Modem 0 d 14f12016 HSF 56k Data/Fax/Voice/Spkp Modem 0 d 14f12043 HSF 56k Data/Fax Modem (WorldW SmartDAA) 0 d 14f12044 HSF 56k Data/Fax/Voice Modem (WorldW SmartDAA) 0 d 14f12045 HSF 56k Data/Fax/Voice/Spkp (w/Handset) Modem (WorldW SmartDAA) 0 d 14f12046 HSF 56k Data/Fax/Voice/Spkp Modem (WorldW SmartDAA) 0 d 14f12063 HSF 56k Data/Fax Modem (SmartDAA) 0 d 14f12064 HSF 56k Data/Fax/Voice Modem (SmartDAA) 0 d 14f12065 HSF 56k Data/Fax/Voice/Spkp (w/Handset) Modem (SmartDAA) 0 d 14f12066 HSF 56k Data/Fax/Voice/Spkp Modem (SmartDAA) 0 d 14f12093 HSF 56k Modem 0 s 14f12093155d2f07 Legend 0 d 14f12143 HSF 56k Data/Fax/Cell Modem (Mob WorldW SmartDAA) 0 d 14f12144 HSF 56k Data/Fax/Voice/Cell Modem (Mob WorldW SmartDAA) 0 d 14f12145 HSF 56k Data/Fax/Voice/Spkp (w/HS)/Cell Modem (Mob WorldW SmartDAA) 0 d 14f12146 HSF 56k Data/Fax/Voice/Spkp/Cell Modem (Mob WorldW SmartDAA) 0 d 14f12163 HSF 56k Data/Fax/Cell Modem (Mob SmartDAA) 0 d 14f12164 HSF 56k Data/Fax/Voice/Cell Modem (Mob SmartDAA) 0 d 14f12165 HSF 56k Data/Fax/Voice/Spkp (w/HS)/Cell Modem (Mob SmartDAA) 0 d 14f12166 HSF 56k Data/Fax/Voice/Spkp/Cell Modem (Mob SmartDAA) 0 d 14f12343 HSF 56k Data/Fax CardBus Modem (Mob WorldW SmartDAA) 0 d 14f12344 HSF 56k Data/Fax/Voice CardBus Modem (Mob WorldW SmartDAA) 0 d 14f12345 HSF 56k Data/Fax/Voice/Spkp (w/HS) CardBus Modem (Mob WorldW SmartDAA) 0 d 14f12346 HSF 56k Data/Fax/Voice/Spkp CardBus Modem (Mob WorldW SmartDAA) 0 d 14f12363 HSF 56k Data/Fax CardBus Modem (Mob SmartDAA) 0 d 14f12364 HSF 56k Data/Fax/Voice CardBus Modem (Mob SmartDAA) 0 d 14f12365 HSF 56k Data/Fax/Voice/Spkp (w/HS) CardBus Modem (Mob SmartDAA) 0 d 14f12366 HSF 56k Data/Fax/Voice/Spkp CardBus Modem (Mob SmartDAA) 0 d 14f12443 HSF 56k Data/Fax Modem (Mob WorldW SmartDAA) 0 s 14f12443104d8075 Modem 0 s 14f12443104d8083 Modem 0 s 14f12443104d8097 Modem 0 d 14f12444 HSF 56k Data/Fax/Voice Modem (Mob WorldW SmartDAA) 0 d 14f12445 HSF 56k Data/Fax/Voice/Spkp (w/HS) Modem (Mob WorldW SmartDAA) 0 d 14f12446 HSF 56k Data/Fax/Voice/Spkp Modem (Mob WorldW SmartDAA) 0 d 14f12463 HSF 56k Data/Fax Modem (Mob SmartDAA) 0 d 14f12464 HSF 56k Data/Fax/Voice Modem (Mob SmartDAA) 0 d 14f12465 HSF 56k Data/Fax/Voice/Spkp (w/HS) Modem (Mob SmartDAA) 0 d 14f12466 HSF 56k Data/Fax/Voice/Spkp Modem (Mob SmartDAA) 0 d 14f12f00 HSF 56k HSFi Modem 0 s 14f12f0013e08d84 IBM HSFi V.90 0 s 14f12f0013e08d85 Compaq Stinger 0 s 14f12f0014f12004 Dynalink 56PMi 0 d 14f18234 RS8234 ATM SAR Controller [ServiceSAR Plus] 0 v 14f2 MOBILITY Electronics 0 v 14f3 BROADLOGIC 0 v 14f4 TOKYO Electronic Industry CO Ltd 0 v 14f5 SOPAC Ltd 0 v 14f6 COYOTE Technologies LLC 0 v 14f7 WOLF Technology Inc 0 v 14f8 AUDIOCODES Inc 0 v 14f9 AG COMMUNICATIONS 0 v 14fa WANDEL & GOCHERMANN 0 v 14fb TRANSAS MARINE (UK) Ltd 0 v 14fc QUADRICS Supercomputers World 0 v 14fd JAPAN Computer Industry Inc 0 v 14fe ARCHTEK TELECOM Corp 0 v 14ff TWINHEAD INTERNATIONAL Corp 0 v 1500 DELTA Electronics, Inc 0 v 1501 BANKSOFT CANADA Ltd 0 v 1502 MITSUBISHI ELECTRIC LOGISTICS SUPPORT Co Ltd 0 v 1503 KAWASAKI LSI USA Inc 0 v 1504 KAISER Electronics 0 v 1505 ITA INGENIEURBURO FUR TESTAUFGABEN GmbH 0 v 1506 CHAMELEON Systems Inc 0 v 1507 Motorola ?? / HTEC 0 Should be HTEC Ltd, but there are no known HTEC chips and 1507 is already used by mistake by Motorola (see vendor ID 1057). d 15070001 MPC105 [Eagle] 0 d 15070002 MPC106 [Grackle] 0 d 15070003 MPC8240 [Kahlua] 0 d 15070100 MC145575 [HFC-PCI] 0 d 15070431 KTI829c 100VG 0 d 15074801 Raven 0 d 15074802 Falcon 0 d 15074803 Hawk 0 d 15074806 CPX8216 0 v 1508 HONDA CONNECTORS/MHOTRONICS Inc 0 v 1509 FIRST INTERNATIONAL Computer Inc 0 v 150a FORVUS RESEARCH Inc 0 v 150b YAMASHITA Systems Corp 0 v 150c KYOPAL CO Ltd 0 v 150d WARPSPPED Inc 0 v 150e C-PORT Corp 0 v 150f INTEC GmbH 0 v 1510 BEHAVIOR TECH Computer Corp 0 v 1511 CENTILLIUM Technology Corp 0 v 1512 ROSUN Technologies Inc 0 v 1513 Raychem 0 v 1514 TFL LAN Inc 0 v 1515 Advent design 0 v 1516 MYSON Technology Inc 0 d 15160803 SURECOM EP-320X-S 100/10M Ethernet PCI Adapter 0 s 15160803132010bd SURECOM EP-320X-S 100/10M Ethernet PCI Adapter 0 v 1517 ECHOTEK Corp 0 v 1518 PEP MODULAR Computers GmbH 0 v 1519 TELEFON AKTIEBOLAGET LM Ericsson 0 v 151a Globetek 0 d 151a1002 PCI-1002 0 d 151a1004 PCI-1004 0 d 151a1008 PCI-1008 0 v 151b COMBOX Ltd 0 v 151c DIGITAL AUDIO LABS Inc 0 v 151d Fujitsu Computer Products Of America 0 v 151e MATRIX Corp 0 v 151f TOPIC SEMICONDUCTOR Corp 0 d 151f0000 TP560 Data/Fax/Voice 56k modem 0 v 1520 CHAPLET System Inc 0 v 1521 BELL Corp 0 v 1522 MainPine Ltd 0 d 15220100 PCI <-> IOBus Bridge 0 s 1522010015220200 RockForceDUO 2 Port V.92/V.44 Data/Fax/Voice Modem 0 s 1522010015220300 RockForceQUATRO 4 Port V.92/V.44 Data/Fax/Voice Modem 0 s 1522010015220400 RockForceDUO+ 2 Port V.92/V.44 Data/Fax/Voice Modem 0 s 1522010015220500 RockForceQUATRO+ 4 Port V.92/V.44 Data/Fax/Voice Modem 0 s 1522010015220600 RockForce+ 2 Port V.90 Data/Fax/Voice Modem 0 v 1523 MUSIC Semiconductors 0 v 1524 ENE Technology Inc 0 v 1525 IMPACT Technologies 0 v 1526 ISS, Inc 0 v 1527 SOLECTRON 0 v 1528 ACKSYS 0 v 1529 AMERICAN MICROSystems Inc 0 v 152a QUICKTURN DESIGN Systems 0 v 152b FLYTECH Technology CO Ltd 0 v 152c MACRAIGOR Systems LLC 0 v 152d QUANTA Computer Inc 0 v 152e MELEC Inc 0 v 152f PHILIPS - CRYPTO 0 v 1530 ACQIS Technology Inc 0 v 1531 CHRYON Corp 0 v 1532 ECHELON Corp 0 v 1533 BALTIMORE 0 v 1534 ROAD Corp 0 v 1535 EVERGREEN Technologies Inc 0 v 1537 DATALEX COMMUNCATIONS 0 v 1538 ARALION Inc 0 v 1539 ATELIER INFORMATIQUES et ELECTRONIQUE ETUDES S.A. 0 v 153a ONO SOKKI 0 v 153b TERRATEC Electronic GmbH 0 v 153c ANTAL Electronic 0 v 153d FILANET Corp 0 v 153e TECHWELL Inc 0 v 153f MIPS DENMARK 0 v 1540 PROVIDEO MULTIMEDIA Co Ltd 0 v 1541 MACHONE Communications 0 v 1542 VIVID Technology Inc 0 v 1543 SILICON Laboratories 0 d 15434c22 Si3036 1 MC'97 DAA v 1544 DCM DATA Systems 0 v 1545 VISIONTEK 0 v 1546 IOI Technology Corp 0 v 1547 MITUTOYO Corp 0 v 1548 JET PROPULSION Laboratory 0 v 1549 INTERCONNECT Systems Solutions 0 v 154a MAX Technologies Inc 0 v 154b COMPUTEX Co Ltd 0 v 154c VISUAL Technology Inc 0 v 154d PAN INTERNATIONAL Industrial Corp 0 v 154e SERVOTEST Ltd 0 v 154f STRATABEAM Technology 0 v 1550 OPEN NETWORK Co Ltd 0 v 1551 SMART Electronic DEVELOPMENT GmBH 0 v 1552 RACAL AIRTECH Ltd 0 v 1553 CHICONY Electronics Co Ltd 0 v 1554 PROLINK Microsystems Corp 0 v 1555 GESYTEC GmBH 0 v 1556 PLD APPLICATIONS 0 v 1557 MEDIASTAR Co Ltd 0 v 1558 CLEVO/KAPOK Computer 0 v 1559 SI LOGIC Ltd 0 v 155a INNOMEDIA Inc 0 v 155b PROTAC INTERNATIONAL Corp 0 v 155c Cemax-Icon Inc 0 v 155d Mac System Co Ltd 0 v 155e LP Elektronik GmbH 0 v 155f Perle Systems Ltd 0 v 1560 Terayon Communications Systems 0 v 1561 Viewgraphics Inc 0 v 1562 Symbol Technologies 0 v 1563 A-Trend Technology Co Ltd 0 v 1564 Yamakatsu Electronics Industry Co Ltd 0 v 1565 Biostar Microtech Int'l Corp 0 v 1566 Ardent Technologies Inc 0 v 1567 Jungsoft 0 v 1568 DDK Electronics Inc 0 v 1569 Palit Microsystems Inc. 0 v 156a Avtec Systems 0 v 156b 2wire Inc 0 v 156c Vidac Electronics GmbH 0 v 156d Alpha-Top Corp 0 v 156e Alfa Inc 0 v 156f M-Systems Flash Disk Pioneers Ltd 0 v 1570 Lecroy Corp 0 v 1571 Contemporary Controls 0 d 1571a001 CCSI PCI20-485 ARCnet 0 d 1571a002 CCSI PCI20-485D ARCnet 0 d 1571a003 CCSI PCI20-485X ARCnet 0 d 1571a004 CCSI PCI20-CXB ARCnet 0 d 1571a005 CCSI PCI20-CXS ARCnet 0 d 1571a006 CCSI PCI20-FOG-SMA ARCnet 0 d 1571a007 CCSI PCI20-FOG-ST ARCnet 0 d 1571a008 CCSI PCI20-TB5 ARCnet 0 d 1571a009 CCSI PCI20-5-485 5Mbit ARCnet 0 d 1571a00a CCSI PCI20-5-485D 5Mbit ARCnet 0 d 1571a00b CCSI PCI20-5-485X 5Mbit ARCnet 0 d 1571a00c CCSI PCI20-5-FOG-ST 5Mbit ARCnet 0 d 1571a00d CCSI PCI20-5-FOG-SMA 5Mbit ARCnet 0 d 1571a201 CCSI PCI22-485 10Mbit ARCnet 0 d 1571a202 CCSI PCI22-485D 10Mbit ARCnet 0 d 1571a203 CCSI PCI22-485X 10Mbit ARCnet 0 d 1571a204 CCSI PCI22-CHB 10Mbit ARCnet 0 d 1571a205 CCSI PCI22-FOG_ST 10Mbit ARCnet 0 d 1571a206 CCSI PCI22-THB 10Mbit ARCnet 0 v 1572 Otis Elevator Company 0 v 1573 Lattice - Vantis 0 v 1574 Fairchild Semiconductor 0 v 1575 Voltaire Advanced Data Security Ltd 0 v 1576 Viewcast COM 0 v 1578 HITT 0 v 1579 Dual Technology Corp 0 v 157a Japan Elecronics Ind Inc 0 v 157b Star Multimedia Corp 0 v 157c Eurosoft (UK) 0 d 157c8001 Fix2000 PCI Y2K Compliance Card 0 v 157d Gemflex Networks 0 v 157e Transition Networks 0 v 157f PX Instruments Technology Ltd 0 v 1580 Primex Aerospace Co 0 v 1581 SEH Computertechnik GmbH 0 v 1582 Cytec Corp 0 v 1583 Inet Technologies Inc 0 v 1584 Uniwill Computer Corp 0 v 1585 Logitron 0 v 1586 Lancast Inc 0 v 1587 Konica Corp 0 v 1588 Solidum Systems Corp 0 v 1589 Atlantek Microsystems Pty Ltd 0 v 158a Digalog Systems Inc 0 v 158b Allied Data Technologies 0 v 158c Hitachi Semiconductor & Devices Sales Co Ltd 0 v 158d Point Multimedia Systems 0 v 158e Lara Technology Inc 0 v 158f Ditect Coop 0 v 1590 3pardata Inc 0 v 1591 ARN 0 v 1592 Syba Tech Ltd 0 d 15920781 Multi-IO Card 0 d 15920782 Parallel Port Card 2xEPP 0 d 15920783 Multi-IO Card 0 d 15920785 Multi-IO Card 0 d 15920786 Multi-IO Card 0 d 15920787 Multi-IO Card 0 d 15920788 Multi-IO Card 0 d 1592078a Multi-IO Card 0 v 1593 Bops Inc 0 v 1594 Netgame Ltd 0 v 1595 Diva Systems Corp 0 v 1596 Folsom Research Inc 0 v 1597 Memec Design Services 0 v 1598 Granite Microsystems 0 v 1599 Delta Electronics Inc 0 v 159a General Instrument 0 v 159b Faraday Technology Corp 0 v 159c Stratus Computer Systems 0 v 159d Ningbo Harrison Electronics Co Ltd 0 v 159e A-Max Technology Co Ltd 0 v 159f Galea Network Security 0 v 15a0 Compumaster SRL 0 v 15a1 Geocast Network Systems 0 v 15a2 Catalyst Enterprises Inc 0 d 15a20001 TA700 PCI Bus Analyzer/Exerciser 0 v 15a3 Italtel 0 v 15a4 X-Net OY 0 v 15a5 Toyota Macs Inc 0 v 15a6 Sunlight Ultrasound Technologies Ltd 0 v 15a7 SSE Telecom Inc 0 v 15a8 Shanghai Communications Technologies Center 0 v 15aa Moreton Bay 0 v 15ab Bluesteel Networks Inc 0 v 15ac North Atlantic Instruments 0 v 15ad VMWare Inc 0 d 15ad0405 Unknown? 1 d 15ad0710 Virtual SVGA 0 d 15ad0720 Virtual SVGA? 1 v 15ae Amersham Pharmacia Biotech 0 v 15b0 Zoltrix International Ltd 0 v 15b1 Source Technology Inc 0 v 15b2 Mosaid Technologies Inc 0 v 15b3 Mellanox Technology 0 d 15b35274 MT21108 InfiniBridge 0 v 15b4 CCI/TRIAD 0 v 15b5 Cimetrics Inc 0 v 15b6 Texas Memory Systems Inc 0 v 15b7 Sandisk Corp 0 v 15b8 ADDI-DATA GmbH 0 v 15b9 Maestro Digital Communications 0 v 15ba Impacct Technology Corp 0 v 15bb Portwell Inc 0 v 15bc Agilent Technologies 0 d 15bc2929 E2929A PCI/PCI-X Bus Analyzer 0 v 15bd DFI Inc 0 v 15be Sola Electronics 0 v 15bf High Tech Computer Corp (HTC) 0 v 15c0 BVM Ltd 0 v 15c1 Quantel 0 v 15c2 Newer Technology Inc 0 v 15c3 Taiwan Mycomp Co Ltd 0 v 15c4 EVSX Inc 0 v 15c5 Procomp Informatics Ltd 0 v 15c6 Technical University of Budapest 0 v 15c7 Tateyama System Laboratory Co Ltd 0 d 15c70349 Tateyama C-PCI PLC/NC card Rev.01A 0 v 15c8 Penta Media Co Ltd 0 d 15c89050 PentaNet 1 Satellite DVB Card v 15c9 Serome Technology Inc 0 v 15ca Bitboys OY 0 v 15cb AG Electronics Ltd 0 v 15cc Hotrail Inc 0 v 15cd Dreamtech Co Ltd 0 v 15ce Genrad Inc 0 v 15cf Hilscher GmbH 0 v 15d1 Infineon Technologies AG 0 v 15d2 FIC (First International Computer Inc) 0 v 15d3 NDS Technologies Israel Ltd 0 v 15d4 Iwill Corp 0 v 15d5 Tatung Co 0 v 15d6 Entridia Corp 0 v 15d7 Rockwell-Collins Inc 0 v 15d8 Cybernetics Technology Co Ltd 0 v 15d9 Super Micro Computer Inc 0 v 15da Cyberfirm Inc 0 v 15db Applied Computing Systems Inc 0 v 15dc Litronic Inc 0 d 15dc0001 Argus 300 PCI Cryptography Module 0 v 15dd Sigmatel Inc 0 v 15de Malleable Technologies Inc 0 v 15df Infinilink Corp 0 v 15e0 Cacheflow Inc 0 v 15e1 Voice Technologies Group Inc 0 v 15e2 Quicknet Technologies Inc 0 v 15e3 Networth Technologies Inc 0 v 15e4 VSN Systemen BV 0 v 15e5 Valley technologies Inc 0 v 15e6 Agere Inc 0 v 15e7 Get Engineering Corp 0 v 15e8 National Datacomm Corp 0 d 15e80130 Wireless PCI Card 0 v 15e9 Pacific Digital Corp 0 v 15ea Tokyo Denshi Sekei K.K. 0 v 15eb Drsearch GmbH 0 v 15ec Beckhoff GmbH 0 v 15ed Macrolink Inc 0 v 15ee In Win Development Inc 0 v 15ef Intelligent Paradigm Inc 0 v 15f0 B-Tree Systems Inc 0 v 15f1 Times N Systems Inc 0 v 15f2 Diagnostic Instruments Inc 0 v 15f3 Digitmedia Corp 0 v 15f4 Valuesoft 0 v 15f5 Power Micro Research 0 v 15f6 Extreme Packet Device Inc 0 v 15f7 Banctec 0 v 15f8 Koga Electronics Co 0 v 15f9 Zenith Electronics Corp 0 v 15fa J.P. Axzam Corp 0 v 15fb Zilog Inc 0 v 15fc Techsan Electronics Co Ltd 0 v 15fd N-CUBED.NET 0 v 15fe Kinpo Electronics Inc 0 v 15ff Fastpoint Technologies Inc 0 v 1600 Northrop Grumman - Canada Ltd 0 v 1601 Tenta Technology 0 v 1602 Prosys-tec Inc 0 v 1603 Nokia Wireless Communications 0 v 1604 Central System Research Co Ltd 0 v 1605 Pairgain Technologies 0 v 1606 Europop AG 0 v 1607 Lava Semiconductor Manufacturing Inc 0 v 1608 Automated Wagering International 0 v 1609 Scimetric Instruments Inc 0 v 1612 Telesynergy Research Inc. 0 v 1619 FarSite Communications Ltd 0 d 16190400 FarSync T2P (2 port X.21/V.35/V.24) 0 d 16190440 FarSync T4P (4 port X.21/V.35/V.24) 0 v 1629 Kongsberg Spacetec AS 0 d 16291003 Format synchronizer v3.0 0 d 16292002 Fast Universal Data Output 0 v 1638 Standard Microsystems Corp [SMC] 0 d 16381100 SMC2602W EZConnect / Addtron AWA-100 0 v 1657 Brocade Communications Systems, Inc. 0 v 165a Epix Inc. 1 d 165ac100 PIXCI(R) CL1 PCI Camera Link Video Capture Board 1 Custom chip made for this board, based on QuickLogic QL5232 d 165ad200 PIXCI(R) D2X PCI Digital Video Capture Board 1 Custom chip made for this board, based on QuickLogic QL5232 d 165ad300 PIXCI(R) D3X PCI Digital Video Capture Board 1 Custom chip made for this board, based on QuickLogic QL5232 v 165d Hsing Tech. Enterprise Co., Ltd. 0 v 1661 Worldspace Corp. 0 v 1668 Action Tec Electronics Inc 0 v 168c Action Tec Electronics Inc 1 subtype: '0007 802.11a WLAN Controller (AR5k chipset)' v 16ab Global Sun Technology Inc 0 d 16ab1102 PCMCIA-to-PCI Wireless Network Bridge 1 PLX chipset v 16ec U.S. Robotics 0 d 16ec3685 Wireless Access PCI Adapter Model 022415 0 v 16f6 VideoTele.com, Inc. 0 v 170b NetOctave Inc 0 v 170c YottaYotta Inc. 0 v 1737 Linksys 0 v 173b Altima (nee Broadcom) 0 d 173b03e8 AC1000 Gigabit Ethernet 0 d 173b03ea AC9100 Gigabit Ethernet 0 v 1743 Peppercon AG 0 d 17438139 ROL/F-100 Fast Ethernet Adapter with ROL 0 v 174b PC Partner Limited 0 v 175e Sanera Systems, Inc. 0 v 1787 Sapphire Technology Ltd. 1 http://mirror.ati.com/support/identify/graphicschart.html v 1787 Hightech Information System Ltd. 1 Oops, I goofed on the Sapphire entry above.. this one is correct v 1796 Research Centre Juelich 0 also used by Struck Innovative Systeme for joint developments d 17960001 SIS1100 [Gigabit link] 0 d 17960002 HOTlink 0 d 17960003 Counter Timer 0 d 17960004 CAMAC Controller 0 d 17960005 PROFIBUS 0 d 17960006 AMCC HOTlink 0 v 1799 Belkin 1 v 17af Hightech Information System Ltd. 1 ATI supplied info - http://mirror.ati.com/support/identify/graphicschart.html v 1813 Ambient Technologies Inc 0 d 18134000 HaM controllerless modem 1 v 1a08 Sierra semiconductor 0 d 1a080000 SC15064 0 v 1b13 Jaton Corp 0 v 1c1c Symphony 0 d 1c1c0001 82C101 0 v 1d44 DPT 0 d 1d44a400 PM2x24/PM3224 0 v 1de1 Tekram Technology Co.,Ltd. 0 d 1de10391 TRM-S1040 0 d 1de12020 DC-390 0 d 1de1690c 690c 0 d 1de1dc29 DC290 0 v 2001 Temporal Research Ltd 0 v 21c3 21st Century Computer Corp. 0 v 2348 Racore 0 d 23482010 8142 100VG/AnyLAN 0 v 2646 Kingston Technologies 0 v 270b Xantel Corporation 0 v 270f Chaintech Computer Co. Ltd 0 v 2711 AVID Technology Inc. 0 v 2a15 3D Vision(???) 0 v 3000 Hansol Electronics Inc. 0 v 3142 Post Impression Systems. 0 v 3388 Hint Corp 0 d 33880021 HB1-SE33 PCI-PCI Bridge 0 d 33888011 VXPro II Chipset 0 s 3388801133888011 VXPro II Chipset CPU to PCI Bridge 0 d 33888012 VXPro II Chipset 0 s 3388801233888012 VXPro II Chipset PCI to ISA Bridge 0 d 33888013 VXPro II IDE 0 s 3388801333888013 VXPro II Chipset EIDE Controller 0 v 3411 Quantum Designs (H.K.) Inc 0 v 3412 Unknown 1 Toshiba Magnia SG20 has a 3412:7856 as a subsystem of 1217:6972 v 3513 ARCOM Control Systems Ltd 0 v 38ef 4Links 0 v 3d3d 3DLabs 0 d 3d3d0001 GLINT 300SX 0 d 3d3d0002 GLINT 500TX 0 d 3d3d0003 GLINT Delta 0 d 3d3d0004 Permedia 0 d 3d3d0005 Permedia 0 d 3d3d0006 GLINT MX 0 d 3d3d0007 3D Extreme 0 d 3d3d0008 GLINT Gamma G1 0 d 3d3d0009 Permedia II 2D+3D 0 s 3d3d000910400011 AccelStar II 0 s 3d3d00093d3d0100 AccelStar II 3D Accelerator 0 s 3d3d00093d3d0111 Permedia 3:16 0 s 3d3d00093d3d0114 Santa Ana 0 s 3d3d00093d3d0116 Oxygen GVX1 0 s 3d3d00093d3d0119 Scirocco 0 s 3d3d00093d3d0120 Santa Ana PCL 0 s 3d3d00093d3d0125 Oxygen VX1 0 s 3d3d00093d3d0127 Permedia3 Create! 0 d 3d3d000a GLINT R3 0 s 3d3d000a3d3d0121 Oxygen VX1 0 d 3d3d000c GLINT R3 [Oxygen VX1] 0 d 3d3d0100 Permedia II 2D+3D 0 d 3d3d1004 Permedia 0 d 3d3d3d04 Permedia 0 d 3d3dffff Glint VGA 0 v 4005 Avance Logic Inc. 0 d 40050300 ALS300 PCI Audio Device 0 d 40050308 ALS300+ PCI Audio Device 0 d 40050309 PCI Input Controller 0 d 40051064 ALG-2064 0 d 40052064 ALG-2064i 0 d 40052128 ALG-2364A GUI Accelerator 0 d 40052301 ALG-2301 0 d 40052302 ALG-2302 0 d 40052303 AVG-2302 GUI Accelerator 0 d 40052364 ALG-2364A 0 d 40052464 ALG-2464 0 d 40052501 ALG-2564A/25128A 0 d 40054000 ALS4000 Audio Chipset 0 s 4005400040054000 ALS4000 Audio Chipset 0 d 40054710 ALC200/200P 0 v 4033 Addtron Technology Co, Inc. 0 d 40331360 RTL8139 Ethernet 0 v 4143 Digital Equipment Corp 0 v 416c Aladdin Knowledge Systems 0 d 416c0100 AladdinCARD 0 d 416c0200 CPC 0 v 4444 Internext Compression Inc 0 v 4468 Bridgeport machines 0 v 4594 Cogetec Informatique Inc 0 v 45fb Baldor Electric Company 0 v 4680 Umax Computer Corp 0 v 4843 Hercules Computer Technology Inc 0 v 4916 RedCreek Communications Inc 0 d 49161960 RedCreek PCI adapter 0 v 4943 Growth Networks 0 v 4978 Axil Computer Inc 0 v 4a14 NetVin 0 d 4a145000 NV5000SC 0 s 4a1450004a145000 RT8029-Based Ethernet Adapter 0 v 4b10 Buslogic Inc. 0 v 4c48 LUNG HWA Electronics 0 v 4c53 SBS Technologies 0 v 4ca1 Seanix Technology Inc 0 v 4d51 MediaQ Inc. 0 d 4d510200 MQ-200 0 v 4d54 Microtechnica Co Ltd 0 v 4ddc ILC Data Device Corp 0 d 4ddc0100 DD-42924I5-300 (ARINC 429 Data Bus) 0 d 4ddc0801 BU-65570I1 MIL-STD-1553 Test and Simulation 0 d 4ddc0802 BU-65570I2 MIL-STD-1553 Test and Simulation 0 d 4ddc0811 BU-65572I1 MIL-STD-1553 Test and Simulation 0 d 4ddc0812 BU-65572I2 MIL-STD-1553 Test and Simulation 0 d 4ddc0881 BU-65570T1 MIL-STD-1553 Test and Simulation 0 d 4ddc0882 BU-65570T2 MIL-STD-1553 Test and Simulation 0 d 4ddc0891 BU-65572T1 MIL-STD-1553 Test and Simulation 0 d 4ddc0892 BU-65572T2 MIL-STD-1553 Test and Simulation 0 d 4ddc0901 BU-65565C1 MIL-STD-1553 Data Bus 0 d 4ddc0902 BU-65565C2 MIL-STD-1553 Data Bus 0 d 4ddc0903 BU-65565C3 MIL-STD-1553 Data Bus 0 d 4ddc0904 BU-65565C4 MIL-STD-1553 Data Bus 0 d 4ddc0b01 BU-65569I1 MIL-STD-1553 Data Bus 0 d 4ddc0b02 BU-65569I2 MIL-STD-1553 Data Bus 0 d 4ddc0b03 BU-65569I3 MIL-STD-1553 Data Bus 0 d 4ddc0b04 BU-65569I4 MIL-STD-1553 Data Bus 0 v 5046 GemTek Technology Corporation 0 d 50461001 PCI Radio 0 v 5053 Voyetra Technologies 0 d 50532010 Daytona Audio Adapter 0 v 5136 S S Technologies 0 v 5143 Qualcomm Inc 0 v 5145 Ensoniq (Old) 0 d 51453031 Concert AudioPCI 0 v 5301 Alliance Semiconductor Corp. 0 d 53010001 ProMotion aT3D 0 v 5333 S3 Inc. 0 d 53330551 Plato/PX (system) 0 d 53335631 86c325 [ViRGE] 0 d 53338800 86c866 [Vision 866] 0 d 53338801 86c964 [Vision 964] 0 d 53338810 86c764_0 [Trio 32 vers 0] 0 d 53338811 86c764/765 [Trio32/64/64V+] 0 d 53338812 86cM65 [Aurora64V+] 0 d 53338813 86c764_3 [Trio 32/64 vers 3] 0 d 53338814 86c767 [Trio 64UV+] 0 d 53338815 86cM65 [Aurora 128] 0 d 5333883d 86c988 [ViRGE/VX] 0 d 53338870 FireGL 0 d 53338880 86c868 [Vision 868 VRAM] vers 0 0 d 53338881 86c868 [Vision 868 VRAM] vers 1 0 d 53338882 86c868 [Vision 868 VRAM] vers 2 0 d 53338883 86c868 [Vision 868 VRAM] vers 3 0 d 533388b0 86c928 [Vision 928 VRAM] vers 0 0 d 533388b1 86c928 [Vision 928 VRAM] vers 1 0 d 533388b2 86c928 [Vision 928 VRAM] vers 2 0 d 533388b3 86c928 [Vision 928 VRAM] vers 3 0 d 533388c0 86c864 [Vision 864 DRAM] vers 0 0 d 533388c1 86c864 [Vision 864 DRAM] vers 1 0 d 533388c2 86c864 [Vision 864-P DRAM] vers 2 0 d 533388c3 86c864 [Vision 864-P DRAM] vers 3 0 d 533388d0 86c964 [Vision 964 VRAM] vers 0 0 d 533388d1 86c964 [Vision 964 VRAM] vers 1 0 d 533388d2 86c964 [Vision 964-P VRAM] vers 2 0 d 533388d3 86c964 [Vision 964-P VRAM] vers 3 0 d 533388f0 86c968 [Vision 968 VRAM] rev 0 0 d 533388f1 86c968 [Vision 968 VRAM] rev 1 0 d 533388f2 86c968 [Vision 968 VRAM] rev 2 0 d 533388f3 86c968 [Vision 968 VRAM] rev 3 0 d 53338900 86c755 [Trio 64V2/DX] 0 s 5333890053338900 86C775 Trio64V2/DX 0 d 53338901 86c775/86c785 [Trio 64V2/DX or /GX] 0 s 5333890153338901 86C775 Trio64V2/DX, 86C785 Trio64V2/GX 0 d 53338902 Plato/PX 0 d 53338903 Trio 3D business multimedia 0 d 53338904 Trio 64 3D 0 s 53338904101400db Integrated Trio3D 0 s 5333890453338904 86C365 Trio3D AGP 0 d 53338905 Trio 64V+ family 0 d 53338906 Trio 64V+ family 0 d 53338907 Trio 64V+ family 0 d 53338908 Trio 64V+ family 0 d 53338909 Trio 64V+ family 0 d 5333890a Trio 64V+ family 0 d 5333890b Trio 64V+ family 0 d 5333890c Trio 64V+ family 0 d 5333890d Trio 64V+ family 0 d 5333890e Trio 64V+ family 0 d 5333890f Trio 64V+ family 0 d 53338a01 ViRGE/DX or /GX 0 s 53338a010e11b032 ViRGE/GX 0 s 53338a0110b41617 Nitro 3D 0 s 53338a0110b41717 Nitro 3D 0 s 53338a0153338a01 ViRGE/DX 0 d 53338a10 ViRGE/GX2 0 s 53338a1010928a10 Stealth 3D 4000 0 d 53338a13 86c368 [Trio 3D/2X] 0 s 53338a1353338a13 Trio3D/2X 0 d 53338a20 86c794 [Savage 3D] 0 s 53338a2053338a20 86C391 Savage3D 0 d 53338a21 86c390 [Savage 3D/MV] 0 s 53338a2153338a21 86C390 Savage3D/MV 0 d 53338a22 Savage 4 0 s 53338a2210338068 Savage 4 0 s 53338a2210338069 Savage 4 0 s 53338a22105d0018 SR9 8Mb SDRAM 0 s 53338a22105d002a SR9 Pro 16Mb SDRAM 0 s 53338a22105d003a SR9 Pro 32Mb SDRAM 0 s 53338a22105d092f SR9 Pro+ 16Mb SGRAM 0 s 53338a2210924207 Stealth III S540 0 s 53338a2210924800 Stealth III S540 0 s 53338a2210924807 SpeedStar A90 0 s 53338a2210924808 Stealth III S540 0 s 53338a2210924809 Stealth III S540 0 s 53338a221092480e Stealth III S540 0 s 53338a2210924904 Stealth III S520 0 s 53338a2210924905 SpeedStar A200 0 s 53338a2210924a09 Stealth III S540 0 s 53338a2210924a0b Stealth III S540 Xtreme 0 s 53338a2210924a0f Stealth III S540 0 s 53338a2210924e01 Stealth III S540 0 s 53338a221102101d 3d Blaster Savage 4 0 s 53338a221102101e 3d Blaster Savage 4 0 s 53338a2253338100 86C394-397 Savage4 SDRAM 100 0 s 53338a2253338110 86C394-397 Savage4 SDRAM 110 0 s 53338a2253338125 86C394-397 Savage4 SDRAM 125 0 s 53338a2253338143 86C394-397 Savage4 SDRAM 143 0 s 53338a2253338a22 86C394-397 Savage4 0 s 53338a2253338a2e 86C394-397 Savage4 32bit 0 s 53338a2253339125 86C394-397 Savage4 SGRAM 125 0 s 53338a2253339143 86C394-397 Savage4 SGRAM 143 0 d 53338a23 Savage 4 0 d 53338a25 ProSavage PM133 0 d 53338a26 ProSavage KM133 0 d 53338c00 ViRGE/M3 0 d 53338c01 ViRGE/MX 0 s 53338c0111790001 ViRGE/MX 0 d 53338c02 ViRGE/MX+ 0 d 53338c03 ViRGE/MX+MV 0 d 53338c10 86C270-294 Savage/MX-MV 0 d 53338c11 82C270-294 Savage/MX 0 d 53338c12 86C270-294 Savage/IX-MV 0 s 53338c121014017f ThinkPad T20 1 d 53338c13 86C270-294 Savage/IX 0 d 53338c22 SuperSavage MX/128 0 d 53338c24 SuperSavage MX/64 0 d 53338c26 SuperSavage MX/64C 0 d 53338c2a SuperSavage IX/128 SDR 0 d 53338c2b SuperSavage IX/128 DDR 0 d 53338c2c SuperSavage IX/64 SDR 0 d 53338c2d SuperSavage IX/64 DDR 0 d 53338c2e SuperSavage IX/C SDR 0 s 53338c2e101401fc ThinkPad T23 (2647-4MG) 0 d 53338c2f SuperSavage IX/C DDR 0 d 53338d01 VT8603 [ProSavage PN133] AGP4X VGA Controller (Twister) 0 Integrated in VIA ProSavage PN133 North Bridge d 53338d02 VT8636A [ProSavage KN133] AGP4X VGA Controller (TwisterK) 0 d 53338d04 VT8751 [ProSavageDDR P4M266] VGA Controller 0 d 53339102 86C410 Savage 2000 0 s 5333910210925932 Viper II Z200 0 s 5333910210925934 Viper II Z200 0 s 5333910210925952 Viper II Z200 0 s 5333910210925954 Viper II Z200 0 s 5333910210925a35 Viper II Z200 0 s 5333910210925a37 Viper II Z200 0 s 5333910210925a55 Viper II Z200 0 s 5333910210925a57 Viper II Z200 0 d 5333ca00 SonicVibes 0 v 544c Teralogic Inc 0 v 5455 Technische University Berlin 0 d 54554458 S5933 0 v 5519 Cnet Technologies, Inc. 0 v 5544 Dunord Technologies 0 d 55440001 I-30xx Scanner Interface 0 v 5555 Genroco, Inc 0 d 55550003 TURBOstor HFP-832 [HiPPI NIC] 0 v 5700 Netpower 0 v 6356 UltraStor 0 v 6374 c't Magazin für Computertechnik 0 d 63746773 GPPCI 0 v 6409 Logitec Corp. 0 v 6666 Decision Computer International Co. 0 d 66660001 PCCOM4 0 d 66660002 PCCOM8 0 v 7604 O.N. Electronic Co Ltd. 0 v 7bde MIDAC Corporation 0 v 7fed PowerTV 0 v 8008 Quancom Electronic GmbH 0 d 80080010 WDOG1 [PCI-Watchdog 1] 0 d 80080011 PWDOG2 [PCI-Watchdog 2] 0 v 8086 Intel Corp. 0 d 80860007 82379AB 0 d 80860008 Extended Express System Support Controller 0 d 80860039 21145 0 d 80860122 82437FX 0 d 80860482 82375EB 0 d 80860483 82424ZX [Saturn] 0 d 80860484 82378IB [SIO ISA Bridge] 0 d 80860486 82430ZX [Aries] 0 d 808604a3 82434LX [Mercury/Neptune] 0 d 808604d0 82437FX [Triton FX] 0 d 80860600 RAID Controller 0 d 80860960 80960RP [i960 RP Microprocessor/Bridge] 0 d 80860962 80960RM [i960RM Bridge] 0 d 80860964 80960RP [i960 RP Microprocessor/Bridge] 0 d 80861000 82542 Gigabit Ethernet Controller 0 s 808610000e11b0df NC1632 Gigabit Ethernet Adapter (1000-SX) 0 s 808610000e11b0e0 NC1633 Gigabit Ethernet Adapter (1000-LX) 0 s 808610000e11b123 NC1634 Gigabit Ethernet Adapter (1000-SX) 0 s 8086100010140119 Netfinity Gigabit Ethernet SX Adapter 0 s 8086100080861000 PRO/1000 Gigabit Server Adapter 0 d 80861001 82543GC Gigabit Ethernet Controller (Fiber) 0 s 808610010e11004a NC6136 Gigabit Server Adapter 0 s 80861001101401ea Netfinity Gigabit Ethernet SX Adapter 0 s 8086100180861003 PRO/1000 F Server Adapter 0 d 80861002 Pro 100 LAN+Modem 56 Cardbus II 0 s 808610028086200e Pro 100 LAN+Modem 56 Cardbus II 0 s 8086100280862013 Pro 100 SR Mobile Combo Adapter 0 s 8086100280862017 Pro 100 S Combo Mobile Adapter 0 d 80861004 82543GC Gigabit Ethernet Controller (Copper) 0 s 808610040e110049 NC7132 Gigabit Upgrade Module 0 s 808610040e11b1a4 NC7131 Gigabit Server Adapter 0 s 80861004101410f2 Gigabit Ethernet Server Adapter 0 s 8086100480861004 PRO/1000 T Server Adapter 0 s 8086100480862004 PRO/1000 T Server Adapter 0 d 80861008 82544EI Gigabit Ethernet Controller (Copper) 0 s 8086100880861107 PRO/1000 XT Server Adapter 0 s 8086100880862107 PRO/1000 XT Server Adapter 0 s 8086100880862110 PRO/1000 XT Server Adapter 0 d 80861009 82544EI Gigabit Ethernet Controller (Fiber) 0 s 8086100980861109 PRO/1000 XF Server Adapter 0 s 8086100980862109 PRO/1000 XF Server Adapter 0 d 8086100c 82544GC Gigabit Ethernet Controller (Copper) 0 s 8086100c80861112 PRO/1000 T Desktop Adapter 0 s 8086100c80862112 PRO/1000 T Desktop Adapter 0 d 8086100d 82544GC Gigabit Ethernet Controller (LOM) 0 d 8086100e 82540EM Gigabit Ethernet Controller 0 s 8086100e8086001e PRO/1000 MT Desktop Adapter 0 s 8086100e8086002e PRO/1000 MT Desktop Adapter 0 d 8086100f 82545EM Gigabit Ethernet Controller (Copper) 0 s 8086100f80861001 PRO/1000 MT Server Adapter 0 d 80861010 82546EB Gigabit Ethernet Controller (Copper) 0 s 8086101080861011 PRO/1000 MT Dual Port Server Adapter 0 d 80861011 82545EM Gigabit Ethernet Controller (Fiber) 0 s 8086101180861002 PRO/1000 MF Server Adapter 0 d 80861012 82546EB Gigabit Ethernet Controller (Fiber) 0 s 8086101280861012 PRO/1000 MF Dual Port Server Adapter 0 d 80861015 82540EM Gigabit Ethernet Controller (LOM) 0 d 80861029 82559 Ethernet Controller 0 d 80861030 82559 InBusiness 10/100 0 d 80861031 82801CAM (ICH3) PRO/100 VE (LOM) Ethernet Controller 0 s 8086103110140209 ThinkPad A30p (2653-64G) 0 s 8086103110140209 ThinkPad A30p/T30 1 s 80861031104d80e7 Vaio PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP 0 s 80861031107b5350 EtherExpress PRO/100 VE 0 s 8086103111790001 EtherExpress PRO/100 VE 0 s 80861031144dc000 EtherExpress PRO/100 VE 0 s 80861031144dc001 EtherExpress PRO/100 VE 0 s 80861031144dc003 EtherExpress PRO/100 VE 0 d 80861032 82801CAM (ICH3) PRO/100 VE Ethernet Controller 0 d 80861033 82801CAM (ICH3) PRO/100 VM (LOM) Ethernet Controller 0 d 80861034 82801CAM (ICH3) PRO/100 VM Ethernet Controller 0 d 80861035 82801CAM (ICH3)/82562EH (LOM) Ethernet Controller 0 d 80861036 82801CAM (ICH3) 82562EH Ethernet Controller 0 d 80861037 82801CAM (ICH3) Chipset Ethernet Controller 0 d 80861038 82801CAM (ICH3) PRO/100 VM (KM) Ethernet Controller 0 d 80861039 82801BD PRO/100 VE (LOM) Ethernet Controller 0 d 8086103a 82801BD PRO/100 VE (CNR) Ethernet Controller 0 d 8086103b 82801BD PRO/100 VM (LOM) Ethernet Controller 0 d 8086103c 82801BD PRO/100 VM (CNR) Ethernet Controller 0 d 8086103d 82801BD PRO/100 VE (MOB) Ethernet Controller 0 d 8086103e 82801BD PRO/100 VM (MOB) Ethernet Controller 0 d 80861059 82551QM Ethernet Controller 0 d 80861130 82815 815 Chipset Host Bridge and Memory Controller Hub 0 s 8086113010438027 TUSL2-C Mainboard 0 s 80861130104d80df Vaio PCG-FX403 0 d 80861131 82815 815 Chipset AGP Bridge 0 d 80861132 82815 CGC [Chipset Graphics Controller] 0 s 8086113210251016 Travelmate 612 TX 0 s 80861132104d80df Vaio PCG-FX403 0 d 80861161 82806AA PCI64 Hub Advanced Programmable Interrupt Controller 0 s 8086116180861161 82806AA PCI64 Hub APIC 0 d 80861162 Xscale 80200 Big Endian Companion Chip 0 d 80861200 Intel IXP1200 Network Processor 0 s 80861200172a0000 AEP SSL Accelerator 0 d 80861209 82559ER 0 d 80861221 82092AA_0 0 d 80861222 82092AA_1 0 d 80861223 SAA7116 0 d 80861225 82452KX/GX [Orion] 0 d 80861226 82596 PRO/10 PCI 0 d 80861227 82865 EtherExpress PRO/100A 0 d 80861228 82556 EtherExpress PRO/100 Smart 0 d 80861229 82557/8/9 [Ethernet Pro 100] 0 the revision field differentiates between them (1-3 is 82557, 4-5 is 82558, 6-8 is 82559, 9 is 82559ER) s 808612290e113001 82559 Fast Ethernet LOM with Alert on LAN* 0 s 808612290e113002 82559 Fast Ethernet LOM with Alert on LAN* 0 s 808612290e113003 82559 Fast Ethernet LOM with Alert on LAN* 0 s 808612290e113004 82559 Fast Ethernet LOM with Alert on LAN* 0 s 808612290e113005 82559 Fast Ethernet LOM with Alert on LAN* 0 s 808612290e113006 82559 Fast Ethernet LOM with Alert on LAN* 0 s 808612290e113007 82559 Fast Ethernet LOM with Alert on LAN* 0 s 808612290e11b01e NC3120 Fast Ethernet NIC 0 s 808612290e11b01f NC3122 Fast Ethernet NIC (dual port) 0 s 808612290e11b02f NC1120 Ethernet NIC 0 s 808612290e11b04a Netelligent 10/100TX NIC with Wake on LAN 0 s 808612290e11b0c6 NC3161 Fast Ethernet NIC (embedded, WOL) 0 s 808612290e11b0c7 NC3160 Fast Ethernet NIC (embedded) 0 s 808612290e11b0d7 NC3121 Fast Ethernet NIC (WOL) 0 s 808612290e11b0dd NC3131 Fast Ethernet NIC (dual port) 0 s 808612290e11b0de NC3132 Fast Ethernet Module (dual port) 0 s 808612290e11b0e1 NC3133 Fast Ethernet Module (100-FX) 0 s 808612290e11b134 NC3163 Fast Ethernet NIC (embedded, WOL) 0 s 808612290e11b13c NC3162 Fast Ethernet NIC (embedded) 0 s 808612290e11b144 NC3123 Fast Ethernet NIC (WOL) 0 s 808612290e11b163 NC3134 Fast Ethernet NIC (dual port) 0 s 808612290e11b164 NC3135 Fast Ethernet Upgrade Module (dual port) 0 s 808612290e11b1a4 NC7131 Gigabit Server Adapter 0 s 808612291014005c 82558B Ethernet Pro 10/100 0 s 80861229101401bc 82559 Fast Ethernet LAN On Motherboard 0 s 80861229101401f1 10/100 Ethernet Server Adapter 0 s 80861229101401f2 10/100 Ethernet Server Adapter 0 s 8086122910140207 Ethernet Pro/100 S 0 s 8086122910140232 10/100 Dual Port Server Adapter 0 s 808612291014023a ThinkPad R30 1 s 808612291014105c Netfinity 10/100 0 s 8086122910142205 ThinkPad A22p 1 s 808612291014305c 10/100 EtherJet Management Adapter 0 s 808612291014405c 10/100 EtherJet Adapter with Alert on LAN 0 s 808612291014505c 10/100 EtherJet Secure Management Adapter 0 s 808612291014605c 10/100 EtherJet Secure Management Adapter 0 s 808612291014705c 10/100 Netfinity 10/100 Ethernet Security Adapter 0 s 808612291014805c 10/100 Netfinity 10/100 Ethernet Security Adapter 0 s 808612291028009b PowerEdge 2550 1 s 8086122910338000 PC-9821X-B06 0 s 8086122910338016 PK-UG-X006 0 s 808612291033801f PK-UG-X006 0 s 8086122910338026 PK-UG-X006 0 s 8086122910338063 82559-based Fast Ethernet Adapter 0 s 8086122910338064 82559-based Fast Ethernet Adapter 0 s 80861229103c10c0 NetServer 10/100TX 0 s 80861229103c10c3 NetServer 10/100TX 0 s 80861229103c10ca NetServer 10/100TX 0 s 80861229103c10cb NetServer 10/100TX 0 s 80861229103c10e3 NetServer 10/100TX 0 s 80861229103c10e4 NetServer 10/100TX 0 s 80861229103c1200 NetServer 10/100TX 0 s 8086122910c31100 SmartEther100 SC1100 0 s 8086122910cf1115 8255x-based Ethernet Adapter (10/100) 0 s 8086122910cf1143 8255x-based Ethernet Adapter (10/100) 0 s 8086122911790001 8255x-based Ethernet Adapter (10/100) 0 s 8086122911790002 PCI FastEther LAN on Docker 0 s 8086122911790003 8255x-based Fast Ethernet 0 s 8086122912592560 AT-2560 100 0 s 8086122912592561 AT-2560 100 FX Ethernet Adapter 0 s 8086122912660001 NE10/100 Adapter 0 s 80861229144d2501 SEM-2000 MiniPCI LAN Adapter 0 s 80861229144d2502 SEM-2100IL MiniPCI LAN Adapter 0 s 8086122916681100 EtherExpress PRO/100B (TX) (MiniPCI Ethernet+Modem) 0 s 8086122980860001 EtherExpress PRO/100B (TX) 0 s 8086122980860002 EtherExpress PRO/100B (T4) 0 s 8086122980860003 EtherExpress PRO/10+ 0 s 8086122980860004 EtherExpress PRO/100 WfM 0 s 8086122980860005 82557 10/100 0 s 8086122980860006 82557 10/100 with Wake on LAN 0 s 8086122980860007 82558 10/100 Adapter 0 s 8086122980860008 82558 10/100 with Wake on LAN 0 s 8086122980860009 EtherExpress PRO/100+ 0 s 808612298086000a EtherExpress PRO/100+ Management Adapter 0 s 808612298086000b EtherExpress PRO/100+ 0 s 808612298086000c EtherExpress PRO/100+ Management Adapter 0 s 808612298086000d EtherExpress PRO/100+ Alert On LAN II* Adapter 0 s 808612298086000e EtherExpress PRO/100+ Management Adapter with Alert On LAN* 0 s 808612298086000f EtherExpress PRO/100 Desktop Adapter 0 s 8086122980860010 EtherExpress PRO/100 S Management Adapter 0 s 8086122980860011 EtherExpress PRO/100 S Management Adapter 0 s 8086122980860012 EtherExpress PRO/100 S Advanced Management Adapter (D) 0 s 8086122980860013 EtherExpress PRO/100 S Advanced Management Adapter (E) 0 s 8086122980860030 EtherExpress PRO/100 Management Adapter with Alert On LAN* GC 0 s 8086122980860031 EtherExpress PRO/100 Desktop Adapter 0 s 8086122980860040 EtherExpress PRO/100 S Desktop Adapter 0 s 8086122980860041 EtherExpress PRO/100 S Desktop Adapter 0 s 8086122980860042 EtherExpress PRO/100 Desktop Adapter 0 s 8086122980860050 EtherExpress PRO/100 S Desktop Adapter 0 s 8086122980861009 EtherExpress PRO/100+ Server Adapter 0 s 808612298086100c EtherExpress PRO/100+ Server Adapter (PILA8470B) 0 s 8086122980861012 EtherExpress PRO/100 S Server Adapter (D) 0 s 8086122980861013 EtherExpress PRO/100 S Server Adapter (E) 0 s 8086122980861015 EtherExpress PRO/100 S Dual Port Server Adapter 0 s 8086122980861017 EtherExpress PRO/100+ Dual Port Server Adapter 0 s 8086122980861030 EtherExpress PRO/100+ Management Adapter with Alert On LAN* G Server 0 s 8086122980861040 EtherExpress PRO/100 S Server Adapter 0 s 8086122980861041 EtherExpress PRO/100 S Server Adapter 0 s 8086122980861042 EtherExpress PRO/100 Server Adapter 0 s 8086122980861050 EtherExpress PRO/100 S Server Adapter 0 s 8086122980861051 EtherExpress PRO/100 Server Adapter 0 s 8086122980861052 EtherExpress PRO/100 Server Adapter 0 s 80861229808610f0 EtherExpress PRO/100+ Dual Port Adapter 0 s 8086122980862009 EtherExpress PRO/100 S Mobile Adapter 0 s 808612298086200d EtherExpress PRO/100 Cardbus 0 s 808612298086200e EtherExpress PRO/100 LAN+V90 Cardbus Modem 0 s 808612298086200f EtherExpress PRO/100 SR Mobile Adapter 0 s 8086122980862010 EtherExpress PRO/100 S Mobile Combo Adapter 0 s 8086122980862013 EtherExpress PRO/100 SR Mobile Combo Adapter 0 s 8086122980862016 EtherExpress PRO/100 S Mobile Adapter 0 s 8086122980862017 EtherExpress PRO/100 S Combo Mobile Adapter 0 s 8086122980862018 EtherExpress PRO/100 SR Mobile Adapter 0 s 8086122980862019 EtherExpress PRO/100 SR Combo Mobile Adapter 0 s 8086122980862101 EtherExpress PRO/100 P Mobile Adapter 0 s 8086122980862102 EtherExpress PRO/100 SP Mobile Adapter 0 s 8086122980862103 EtherExpress PRO/100 SP Mobile Adapter 0 s 8086122980862104 EtherExpress PRO/100 SP Mobile Adapter 0 s 8086122980862105 EtherExpress PRO/100 SP Mobile Adapter 0 s 8086122980862106 EtherExpress PRO/100 P Mobile Adapter 0 s 8086122980862107 EtherExpress PRO/100 Network Connection 0 s 8086122980862108 EtherExpress PRO/100 Network Connection 0 s 8086122980862200 EtherExpress PRO/100 P Mobile Combo Adapter 0 s 8086122980862201 EtherExpress PRO/100 P Mobile Combo Adapter 0 s 8086122980862202 EtherExpress PRO/100 SP Mobile Combo Adapter 0 s 8086122980862203 EtherExpress PRO/100+ MiniPCI 0 s 8086122980862204 EtherExpress PRO/100+ MiniPCI 0 s 8086122980862205 EtherExpress PRO/100 SP Mobile Combo Adapter 0 s 8086122980862206 EtherExpress PRO/100 SP Mobile Combo Adapter 0 s 8086122980862207 EtherExpress PRO/100 SP Mobile Combo Adapter 0 s 8086122980862208 EtherExpress PRO/100 P Mobile Combo Adapter 0 s 8086122980862402 EtherExpress PRO/100+ MiniPCI 0 s 8086122980862407 EtherExpress PRO/100+ MiniPCI 0 s 8086122980862408 EtherExpress PRO/100+ MiniPCI 0 s 8086122980862409 EtherExpress PRO/100+ MiniPCI 0 s 808612298086240f EtherExpress PRO/100+ MiniPCI 0 s 8086122980862410 EtherExpress PRO/100+ MiniPCI 0 s 8086122980862411 EtherExpress PRO/100+ MiniPCI 0 s 8086122980862412 EtherExpress PRO/100+ MiniPCI 0 s 8086122980862413 EtherExpress PRO/100+ MiniPCI 0 s 8086122980863000 82559 Fast Ethernet LAN on Motherboard 0 s 8086122980863001 82559 Fast Ethernet LOM with Basic Alert on LAN* 0 s 8086122980863002 82559 Fast Ethernet LOM with Alert on LAN II* 0 s 8086122980863006 EtherExpress PRO/100 S Network Connection 0 s 8086122980863007 EtherExpress PRO/100 S Network Connection 0 s 8086122980863008 EtherExpress PRO/100 Network Connection 0 s 8086122980863010 EtherExpress PRO/100 S Network Connection 0 s 8086122980863011 EtherExpress PRO/100 S Network Connection 0 s 8086122980863012 EtherExpress PRO/100 Network Connection 0 d 8086122d 430FX - 82437FX TSC [Triton I] 0 d 8086122e 82371FB PIIX ISA [Triton I] 0 d 80861230 82371FB PIIX IDE [Triton I] 0 d 80861231 DSVD Modem 0 d 80861234 430MX - 82371MX Mobile PCI I/O IDE Xcelerator (MPIIX) 0 d 80861235 430MX - 82437MX Mob. System Ctrlr (MTSC) & 82438MX Data Path (MTDP) 0 d 80861237 440FX - 82441FX PMC [Natoma] 0 d 80861239 82371FB 0 d 8086123b 82380PB 0 d 8086123c 82380AB 0 d 8086123d 683053 Programmable Interrupt Device 0 d 8086123f 82466GX Integrated Hot-Plug Controller (IHPC) 0 d 80861240 752 AGP 0 d 8086124b 82380FB 0 d 80861250 430HX - 82439HX TXC [Triton II] 0 d 80861360 82806AA PCI64 Hub PCI Bridge 0 d 80861361 82806AA PCI64 Hub Controller (HRes) 0 s 8086136180861361 82806AA PCI64 Hub Controller (HRes) 0 s 8086136180868000 82806AA PCI64 Hub Controller (HRes) 0 d 80861460 82870P2 P64H2 Hub PCI Bridge 0 d 80861461 82870P2 P64H2 I/OxAPIC 0 d 80861462 82870P2 P64H2 Hot Plug Controller 0 d 80861960 80960RP [i960RP Microprocessor] 0 s 80861960101e0431 MegaRAID 431 RAID Controller 0 s 80861960101e0438 MegaRAID 438 Ultra2 LVD RAID Controller 0 s 80861960101e0466 MegaRAID 466 Express Plus RAID Controller 0 s 80861960101e0467 MegaRAID 467 Enterprise 1500 RAID Controller 0 s 80861960101e0490 MegaRAID 490 Express 300 RAID Controller 0 s 80861960101e0762 MegaRAID 762 Express RAID Controller 0 s 80861960101e09a0 PowerEdge Expandable RAID Controller 2/SC 0 s 8086196010280467 PowerEdge Expandable RAID Controller 2/DC 0 s 8086196010281111 PowerEdge Expandable RAID Controller 2/SC 0 s 80861960103c03a2 MegaRAID 0 s 80861960103c10c6 MegaRAID 438, HP NetRAID-3Si 0 s 80861960103c10c7 MegaRAID T5, Integrated HP NetRAID 0 s 80861960103c10cc MegaRAID, Integrated HP NetRAID 0 s 80861960103c10cd HP NetRAID-1Si 0 s 80861960105a0000 SuperTrak 0 s 80861960105a2168 SuperTrak Pro 0 s 80861960105a5168 SuperTrak66/100 0 s 8086196011111111 MegaRAID 466, PowerEdge Expandable RAID Controller 2/SC 0 s 8086196011111112 PowerEdge Expandable RAID Controller 2/SC 0 s 80861960113c03a2 MegaRAID 0 d 80861962 80960RM [i960RM Microprocessor] 0 s 80861962105a0000 SuperTrak SX6000 I2O CPU 0 d 80861a21 82840 840 (Carmel) Chipset Host Bridge (Hub A) 0 d 80861a23 82840 840 (Carmel) Chipset AGP Bridge 0 d 80861a24 82840 840 (Carmel) Chipset PCI Bridge (Hub B) 0 d 80861a30 82845 845 (Brookdale) Chipset Host Bridge 0 d 80861a31 82845 845 (Brookdale) Chipset AGP Bridge 0 d 80862410 82801AA ISA Bridge (LPC) 0 d 80862411 82801AA IDE 0 d 80862412 82801AA USB 0 d 80862413 82801AA SMBus 0 d 80862415 82801AA AC'97 Audio 0 s 8086241510280095 Precision Workstation 220 Integrated Digital Audio 0 s 8086241511d40040 SoundMAX Integrated Digital Audio 0 s 8086241511d40048 SoundMAX Integrated Digital Audio 0 s 8086241511d45340 SoundMAX Integrated Digital Audio 0 d 80862416 82801AA AC'97 Modem 0 d 80862418 82801AA PCI Bridge 0 d 80862420 82801AB ISA Bridge (LPC) 0 d 80862421 82801AB IDE 0 d 80862422 82801AB USB 0 d 80862423 82801AB SMBus 0 d 80862425 82801AB AC'97 Audio 0 s 8086242511d40040 SoundMAX Integrated Digital Audio 0 s 8086242511d40048 SoundMAX Integrated Digital Audio 0 d 80862426 82801AB AC'97 Modem 0 d 80862428 82801AB PCI Bridge 0 d 80862440 82801BA ISA Bridge (LPC) 0 d 80862442 82801BA/BAM USB (Hub #1) 0 s 80862442104d80df Vaio PCG-FX403 0 s 80862442147b0507 TH7II-RAID 0 d 80862443 82801BA/BAM SMBus 0 d 80862443 1 s 8086244310438027 TUSL2-C Mainboard 0 s 80862443104d80df Vaio PCG-FX403 0 s 80862443147b0507 TH7II-RAID 0 d 80862444 82801BA/BAM USB (Hub #2) 0 s 80862444104d80df Vaio PCG-FX403 0 s 80862444147b0507 TH7II-RAID 0 d 80862445 82801BA/BAM AC'97 Audio 0 s 80862445104d80df Vaio PCG-FX403 0 s 8086244514623370 STAC9721 AC 0 s 80862445147b0507 TH7II-RAID 0 d 80862446 82801BA/BAM AC'97 Modem 0 s 80862446104d80df Vaio PCG-FX403 0 d 80862448 82801BAM/CAM PCI Bridge 0 d 80862449 82801BA/BAM/CA/CAM Ethernet Controller 0 s 808624490e110012 EtherExpress PRO/100 VM 0 s 808624490e110091 EtherExpress PRO/100 VE 0 s 80862449101401ce EtherExpress PRO/100 VE 0 s 80862449101401dc EtherExpress PRO/100 VE 0 s 80862449101401eb EtherExpress PRO/100 VE 0 s 80862449101401ec EtherExpress PRO/100 VE 0 s 8086244910140202 EtherExpress PRO/100 VE 0 s 8086244910140205 EtherExpress PRO/100 VE 0 s 8086244910140217 EtherExpress PRO/100 VE 0 s 8086244910140234 EtherExpress PRO/100 VE 0 s 808624491014023d EtherExpress PRO/100 VE 0 s 8086244910140244 EtherExpress PRO/100 VE 0 s 8086244910140245 EtherExpress PRO/100 VE 0 s 80862449109f315d EtherExpress PRO/100 VE 0 s 80862449109f3181 EtherExpress PRO/100 VE 0 s 8086244911867801 EtherExpress PRO/100 VE 0 s 80862449144d2602 HomePNA 1M CNR 0 s 8086244980863010 EtherExpress PRO/100 VE 0 s 8086244980863011 EtherExpress PRO/100 VM 0 s 8086244980863012 82562EH based Phoneline 0 s 8086244980863013 EtherExpress PRO/100 VE 0 s 8086244980863014 EtherExpress PRO/100 VM 0 s 8086244980863015 82562EH based Phoneline 0 s 8086244980863016 EtherExpress PRO/100 P Mobile Combo 0 s 8086244980863017 EtherExpress PRO/100 P Mobile 0 s 8086244980863018 EtherExpress PRO/100 0 d 8086244a 82801BAM IDE U100 0 s 8086244a10251016 Travelmate 612TX 0 s 8086244a104d80df Vaio PCG-FX403 0 d 8086244b 82801BA IDE U100 0 s 8086244b10438027 TUSL2-C Mainboard 0 s 8086244b147b0507 TH7II-RAID 0 d 8086244c 82801BAM ISA Bridge (LPC) 0 d 8086244e 82801BA/CA/DB PCI Bridge 0 d 80862450 82801E ISA Bridge (LPC) 0 d 80862452 82801E USB 0 d 80862453 82801E SMBus 0 d 80862459 82801E Ethernet Controller 0 0 d 8086245b 82801E IDE U100 0 d 8086245d 82801E Ethernet Controller 1 0 d 8086245e 82801E PCI Bridge 0 d 80862480 82801CA ISA Bridge (LPC) 0 d 80862482 82801CA/CAM USB (Hub #1) 0 s 8086248210140220 ThinkPad T23 (2647-4MG) or A30p (2653-64G) 0 s 8086248210140220 ThinkPad T23/A30p/T30 1 s 80862482104d80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP 0 d 80862483 82801CA/CAM SMBus 0 s 8086248310140220 ThinkPad T23 (2647-4MG) or A30p (2653-64G) 0 s 8086248310140220 ThinkPad T23/A30p/T30 1 s 80862483104d80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP 0 d 80862484 82801CA/CAM USB (Hub #2) 0 s 8086248410140220 ThinkPad T23 (2647-4MG) or A30p (2653-64G) 0 s 8086248410140220 ThinkPad T23/A30p/T30 1 s 80862484104d80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP 0 d 80862485 82801CA/CAM AC'97 Audio 0 s 8086248510140222 ThinkPad T23 (2647-4MG) or A30p (2653-64G) 0 s 8086248510140508 ThinkPad T30 1 s 80862485104d80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP 0 d 80862486 82801CA/CAM AC'97 Modem 0 s 8086248610140223 ThinkPad A30p (2653-64G) 0 s 8086248610140503 ThinkPad R31 2656BBG 0 s 808624861014051a ThinkPad T30 1 s 80862486104d80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP 0 s 80862486134d4c21 Dell Inspiron 2100 internal modem 0 s 8086248614f15421 Actiontec MD56ORD V.92 MDC Modem 1 Dell Inspiron 4100 internal modem d 80862487 82801CA/CAM USB (Hub #3) 0 s 8086248710140220 ThinkPad T23 (2647-4MG) or A30p (2653-64G) 0 s 8086248710140220 ThinkPad T23/A30p/T30 1 s 80862487104d80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP 0 d 8086248a 82801CAM IDE U100 0 s 8086248a10140220 ThinkPad T23 (2647-4MG) or A30p (2653-64G) 0 s 8086248a10140220 ThinkPad T23/A30p/T30 1 s 8086248a104d80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP 0 d 8086248b 82801CA IDE U100 0 d 8086248c 82801CAM ISA Bridge (LPC) 0 d 808624c0 82801DB ISA Bridge (LPC) 0 d 808624c2 82801DB USB (Hub #1) 0 d 808624c3 82801DB SMBus 0 d 808624c4 82801DB USB (Hub #2) 0 d 808624c5 82801DB AC'97 Audio 0 d 808624c6 82801DB AC'97 Modem 0 d 808624c7 82801DB USB (Hub #3) 0 d 808624cb 82801DB ICH4 IDE 0 d 808624cd 82801DB USB EHCI Controller 0 d 80862500 82820 820 (Camino) Chipset Host Bridge (MCH) 0 s 8086250010280095 Precision Workstation 220 Chipset 0 s 808625001043801c P3C-2000 system chipset 0 d 80862501 82820 820 (Camino) Chipset Host Bridge (MCH) 0 s 808625011043801c P3C-2000 system chipset 0 d 8086250b 82820 820 (Camino) Chipset Host Bridge 0 d 8086250f 82820 820 (Camino) Chipset AGP Bridge 0 d 80862520 82805AA MTH Memory Translator Hub 0 d 80862521 82804AA MRH-S Memory Repeater Hub for SDRAM 0 d 80862530 82850 850 (Tehama) Chipset Host Bridge (MCH) 0 s 80862530147b0507 TH7II-RAID 0 d 80862531 82860 860 (Wombat) Chipset Host Bridge (MCH) 0 d 80862532 82850 850 (Tehama) Chipset AGP Bridge 0 d 80862533 82860 860 (Wombat) Chipset AGP Bridge 0 d 80862534 82860 860 (Wombat) Chipset PCI Bridge 0 d 80862540 e7500 [Plumas] DRAM Controller 0 d 80862541 e7500 [Plumas] DRAM Controller Error Reporting 0 d 80862543 e7500 [Plumas] HI_B Virtual PCI Bridge (F0) 0 d 80862544 e7500 [Plumas] HI_B Virtual PCI Bridge (F1) 0 d 80862545 e7500 [Plumas] HI_C Virtual PCI Bridge (F0) 0 d 80862546 e7500 [Plumas] HI_C Virtual PCI Bridge (F1) 0 d 80862547 e7500 [Plumas] HI_D Virtual PCI Bridge (F0) 0 d 80862548 e7500 [Plumas] HI_D Virtual PCI Bridge (F1) 0 d 80862560 82845G/GL [Brookdale-G] Chipset Host Bridge 0 d 80862561 82845G/GL [Brookdale-G] Chipset AGP Bridge 0 d 80862562 82845G/GL [Brookdale-G] Chipset Integrated Graphics Device 0 d 80863092 Integrated RAID 0 d 80863575 82830 830 Chipset Host Bridge 0 s 808635751014021d ThinkPad T23 (2647-4MG) or A30p (2653-64G) 0 s 80863575104d80e7 VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP 0 d 80863576 82830 830 Chipset AGP Bridge 0 d 80863577 82830 CGC [Chipset Graphics Controller] 0 d 80863578 82830 830 Chipset Host Bridge 0 d 80865200 EtherExpress PRO/100 Intelligent Server 0 d 80865201 EtherExpress PRO/100 Intelligent Server 0 s 8086520180860001 EtherExpress PRO/100 Server Ethernet Adapter 0 d 8086530d 80310 IOP [IO Processor] 0 d 80867000 82371SB PIIX3 ISA [Natoma/Triton II] 0 d 80867010 82371SB PIIX3 IDE [Natoma/Triton II] 0 d 80867020 82371SB PIIX3 USB [Natoma/Triton II] 0 d 80867030 430VX - 82437VX TVX [Triton VX] 0 d 80867100 430TX - 82439TX MTXC 0 d 80867110 82371AB/EB/MB PIIX4 ISA 0 d 80867111 82371AB/EB/MB PIIX4 IDE 0 d 80867112 82371AB/EB/MB PIIX4 USB 0 d 80867113 82371AB/EB/MB PIIX4 ACPI 0 d 80867120 82810 GMCH [Graphics Memory Controller Hub] 0 d 80867121 82810 CGC [Chipset Graphics Controller] 0 d 80867122 82810 DC-100 GMCH [Graphics Memory Controller Hub] 0 d 80867123 82810 DC-100 CGC [Chipset Graphics Controller] 0 d 80867124 82810E DC-133 GMCH [Graphics Memory Controller Hub] 0 d 80867125 82810E DC-133 CGC [Chipset Graphics Controller] 0 d 80867126 82810 DC-133 System and Graphics Controller 0 d 80867128 82810-M DC-100 System and Graphics Controller 0 d 8086712a 82810-M DC-133 System and Graphics Controller 0 d 80867180 440LX/EX - 82443LX/EX Host bridge 0 d 80867181 440LX/EX - 82443LX/EX AGP bridge 0 d 80867190 440BX/ZX/DX - 82443BX/ZX/DX Host bridge 0 s 808671900e110500 Armada 1750 Laptop System Chipset 0 s 8086719011790001 Toshiba Tecra 8100 Laptop System Chipset 0 d 80867191 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge 0 d 80867192 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (AGP disabled) 0 s 808671920e110460 Armada 1700 Laptop System Chipset 0 d 80867194 82440MX Host Bridge 0 d 80867195 82440MX AC'97 Audio Controller 0 s 8086719510cf1099 QSound_SigmaTel Stac97 PCI Audio 0 s 8086719511d40040 SoundMAX Integrated Digital Audio 0 s 8086719511d40048 SoundMAX Integrated Digital Audio 0 d 80867196 82440MX AC'97 Modem Controller 0 d 80867198 82440MX ISA Bridge 0 d 80867199 82440MX EIDE Controller 0 d 8086719a 82440MX USB Universal Host Controller 0 d 8086719b 82440MX Power Management Controller 0 d 808671a0 440GX - 82443GX Host bridge 0 d 808671a1 440GX - 82443GX AGP bridge 0 d 808671a2 440GX - 82443GX Host bridge (AGP disabled) 0 d 80867600 82372FB PIIX5 ISA 0 d 80867601 82372FB PIIX5 IDE 0 d 80867602 82372FB PIIX5 USB 0 d 80867603 82372FB PIIX5 SMBus 0 d 80867800 i740 0 s 80867800003d0008 Starfighter AGP 0 s 80867800003d000b Starfighter AGP 0 s 8086780010920100 Stealth II G460 0 s 8086780010b4201a Lightspeed 740 0 s 8086780010b4202f Lightspeed 740 0 s 8086780080860000 Terminator 2x/i 0 s 8086780080860100 Intel740 Graphics Accelerator 0 d 808684c4 450KX/GX [Orion] - 82454KX/GX PCI bridge 0 d 808684c5 450KX/GX [Orion] - 82453KX/GX Memory controller 0 d 808684ca 450NX - 82451NX Memory & I/O Controller 0 d 808684cb 450NX - 82454NX/84460GX PCI Expander Bridge 0 d 808684e0 460GX - 84460GX System Address Controller (SAC) 0 d 808684e1 460GX - 84460GX System Data Controller (SDC) 0 d 808684e2 460GX - 84460GX AGP Bridge (GXB function 2) 0 d 808684e3 460GX - 84460GX Memory Address Controller (MAC) 0 d 808684e4 460GX - 84460GX Memory Data Controller (MDC) 0 d 808684e6 460GX - 82466GX Wide and fast PCI eXpander Bridge (WXB) 0 d 808684ea 460GX - 84460GX AGP Bridge (GXB function 1) 0 d 80869621 Integrated RAID 0 d 80869622 Integrated RAID 0 d 80869641 Integrated RAID 0 d 808696a1 Integrated RAID 0 d 8086b152 21152 PCI-to-PCI Bridge 0 d 8086b154 21154 PCI-to-PCI Bridge 0 observed, and documented in Intel revision note; new mask of 1011:0026 d 8086b555 21555 Non transparent PCI-to-PCI Bridge 0 s 8086b555e4bf1000 CC8-1-BLUES 0 d 8086ffff 450NX/GX [Orion] - 82453KX/GX Memory controller [BUG] 0 v 8800 Trigem Computer Inc. 0 d 88002008 Video assistent component 0 v 8866 T-Square Design Inc. 0 v 8888 Silicon Magic 0 v 8e0e Computone Corporation 0 v 8e2e KTI 0 d 8e2e3000 ET32P2 0 v 9004 Adaptec 0 d 90041078 AIC-7810 0 d 90041160 AIC-1160 [Family Fibre Channel Adapter] 0 d 90042178 AIC-7821 0 d 90043860 AHA-2930CU 0 d 90043b78 AHA-4844W/4844UW 0 d 90045075 AIC-755x 0 d 90045078 AHA-7850 0 s 9004507890047850 AHA-2904/Integrated AIC-7850 0 d 90045175 AIC-755x 0 d 90045178 AIC-7851 0 d 90045275 AIC-755x 0 d 90045278 AIC-7852 0 d 90045375 AIC-755x 0 d 90045378 AIC-7850 0 d 90045475 AIC-755x 0 d 90045478 AIC-7850 0 d 90045575 AVA-2930 0 d 90045578 AIC-7855 0 d 90045647 ANA-7711 TCP Offload Engine 0 s 9004564790047710 ANA-7711F TCP Offload Engine - Optical 0 s 9004564790047711 ANA-7711LP TCP Offload Engine - Copper 0 d 90045675 AIC-755x 0 d 90045678 AIC-7856 0 d 90045775 AIC-755x 0 d 90045778 AIC-7850 0 d 90045800 AIC-5800 0 d 90045900 ANA-5910/5930/5940 ATM155 & 25 LAN Adapter 0 d 90045905 ANA-5910A/5930A/5940A ATM Adapter 0 d 90046038 AIC-3860 0 d 90046075 AIC-1480 / APA-1480 0 s 9004607590047560 AIC-1480 / APA-1480 Cardbus 0 d 90046078 AIC-7860 0 d 90046178 AIC-7861 0 s 9004617890047861 AHA-2940AU Single 0 d 90046278 AIC-7860 0 d 90046378 AIC-7860 0 d 90046478 AIC-786x 0 d 90046578 AIC-786x 0 d 90046678 AIC-786x 0 d 90046778 AIC-786x 0 d 90046915 ANA620xx/ANA69011A 0 s 9004691590040008 ANA69011A/TX 10/100 0 s 9004691590040009 ANA69011A/TX 10/100 0 s 9004691590040010 ANA62022 2-port 10/100 0 s 9004691590040018 ANA62044 4-port 10/100 0 s 9004691590040019 ANA62044 4-port 10/100 0 s 9004691590040020 ANA62022 2-port 10/100 0 s 9004691590040028 ANA69011A/TX 10/100 0 s 9004691590048008 ANA69011A/TX 64 bit 10/100 0 s 9004691590048009 ANA69011A/TX 64 bit 10/100 0 s 9004691590048010 ANA62022 2-port 64 bit 10/100 0 s 9004691590048018 ANA62044 4-port 64 bit 10/100 0 s 9004691590048019 ANA62044 4-port 64 bit 10/100 0 s 9004691590048020 ANA62022 2-port 64 bit 10/100 0 s 9004691590048028 ANA69011A/TX 64 bit 10/100 0 d 90047078 AHA-294x / AIC-7870 0 d 90047178 AHA-2940/2940W / AIC-7871 0 d 90047278 AHA-3940/3940W / AIC-7872 0 d 90047378 AHA-3985 / AIC-7873 0 d 90047478 AHA-2944/2944W / AIC-7874 0 d 90047578 AHA-3944/3944W / AIC-7875 0 d 90047678 AHA-4944W/UW / AIC-7876 0 d 90047778 AIC-787x 0 d 90047810 AIC-7810 0 d 90047815 AIC-7815 RAID+Memory Controller IC 0 s 9004781590047815 ARO-1130U2 RAID Controller 0 s 9004781590047840 AIC-7815 RAID+Memory Controller IC 0 d 90047850 AIC-7850 0 d 90047855 AHA-2930 0 d 90047860 AIC-7860 0 d 90047870 AIC-7870 0 d 90047871 AHA-2940 0 d 90047872 AHA-3940 0 d 90047873 AHA-3980 0 d 90047874 AHA-2944 0 d 90047880 AIC-7880P 0 d 90047890 AIC-7890 0 d 90047891 AIC-789x 0 d 90047892 AIC-789x 0 d 90047893 AIC-789x 0 d 90047894 AIC-789x 0 d 90047895 AHA-2940U/UW / AHA-39xx / AIC-7895 0 s 9004789590047890 AHA-2940U/2940UW Dual AHA-394xAU/AUW/AUWD AIC-7895B 0 s 9004789590047891 AHA-2940U/2940UW Dual 0 s 9004789590047892 AHA-3940AU/AUW/AUWD/UWD 0 s 9004789590047894 AHA-3944AUWD 0 s 9004789590047895 AHA-2940U/2940UW Dual AHA-394xAU/AUW/AUWD AIC-7895B 0 s 9004789590047896 AHA-2940U/2940UW Dual AHA-394xAU/AUW/AUWD AIC-7895B 0 s 9004789590047897 AHA-2940U/2940UW Dual AHA-394xAU/AUW/AUWD AIC-7895B 0 d 90047896 AIC-789x 0 d 90047897 AIC-789x 0 d 90048078 AIC-7880U 0 s 9004807890047880 AIC-7880P Ultra/Ultra Wide SCSI Chipset 0 d 90048178 AHA-2940U/UW/D / AIC-7881U 0 s 9004817890047881 AHA-2940UW SCSI Host Adapter 0 d 90048278 AHA-3940U/UW/UWD / AIC-7882U 0 d 90048378 AHA-3940U/UW / AIC-7883U 0 d 90048478 AHA-2944UW / AIC-7884U 0 d 90048578 AHA-3944U/UWD / AIC-7885 0 d 90048678 AHA-4944UW / AIC-7886 0 d 90048778 AHA-2940UW Pro / AIC-788x 0 s 9004877890047887 2940UW Pro Ultra-Wide SCSI Controller 0 d 90048878 AHA-2930UW / AIC-7888 0 s 9004887890047888 AHA-2930UW SCSI Controller 0 d 90048b78 ABA-1030 0 d 9004ec78 AHA-4944W/UW 0 v 9005 Adaptec 0 d 90050010 AHA-2940U2/U2W 0 s 9005001090052180 AHA-2940U2 SCSI Controller 0 s 9005001090058100 AHA-2940U2B SCSI Controller 0 s 900500109005a180 AHA-2940U2W SCSI Controller 0 s 900500109005e100 AHA-2950U2B SCSI Controller 0 d 90050011 AHA-2930U2 0 d 90050013 78902 0 s 9005001390050003 AAA-131U2 Array1000 1 Channel RAID Controller 0 d 9005001f AHA-2940U2/U2W / 7890/7891 0 s 9005001f9005000f 2940U2W SCSI Controller 0 s 9005001f9005a180 2940U2W SCSI Controller 0 d 90050020 AIC-7890 0 d 9005002f AIC-7890 0 d 90050030 AIC-7890 0 d 9005003f AIC-7890 0 d 90050050 AHA-3940U2x/395U2x 0 s 900500509005f500 AHA-3950U2B 0 d 90050051 AHA-3950U2D 0 s 900500519005b500 AHA-3950U2D 0 d 90050053 AIC-7896 SCSI Controller 0 s 900500539005ffff AIC-7896 SCSI Controller mainboard implementation 0 d 9005005f AIC-7896U2/7897U2 0 d 90050080 AIC-7892A U160/m 0 s 900500800e11e2a0 Compaq 64-Bit/66MHz Wide Ultra3 SCSI Adapter 0 s 90050080900562a0 29160N Ultra160 SCSI Controller 0 s 900500809005e220 29160LP Low Profile Ultra160 SCSI Controller 0 s 900500809005e2a0 29160 Ultra160 SCSI Controller 0 d 90050081 AIC-7892B U160/m 0 s 90050081900562a1 19160 Ultra160 SCSI Controller 0 d 90050083 AIC-7892D U160/m 0 d 9005008f AIC-7892P U160/m 0 d 900500c0 AHA-3960D / AIC-7899A U160/m 0 s 900500c00e11f620 Compaq 64-Bit/66MHz Dual Channel Wide Ultra3 SCSI Adapter 0 s 900500c09005f620 AHA-3960D U160/m 0 d 900500c1 AIC-7899B U160/m 0 d 900500c3 AIC-7899D U160/m 0 d 900500c5 RAID subsystem HBA 0 s 900500c5102800c5 PowerEdge 2550 1 d 900500cf AIC-7899P U160/m 0 s 900500cf102800d1 PowerEdge 2550 1 d 90050250 ServeRAID Controller 0 s 9005025010140279 ServeRAID-xx 0 s 900502501014028c ServeRAID-xx 0 d 90050285 AAC-RAID 0 s 9005028510280287 PowerEdge Expandable RAID Controller 320/DC 0 d 90058000 ASC-29320A U320 0 d 9005800f AIC-7901 U320 0 d 90058010 ASC-39320 U320 0 d 90058011 ASC-32320D U320 0 s 900580110e1100ac U320 0 s 9005801190050041 ASC-39320D U320 0 d 90058012 ASC-29320 U320 0 d 90058013 ASC-29320B U320 0 d 90058014 ASC-29320LP U320 0 d 9005801e AIC-7901A U320 0 d 9005801f AIC-7902 U320 0 d 90058090 ASC-39320 U320 w/HostRAID 0 d 90058091 ASC-39320D U320 w/HostRAID 0 d 90058092 ASC-29320 U320 w/HostRAID 0 d 90058093 ASC-29320B U320 w/HostRAID 0 d 90058094 ASC-29320LP U320 w/HostRAID 0 d 9005809e AIC-7901A U320 w/HostRAID 0 d 9005809f AIC-7902 U320 w/HostRAID 0 v 907f Atronics 0 d 907f2015 IDE-2015PL 0 v 919a Gigapixel Corp 0 v 9412 Holtek 0 d 94126565 6565 0 v 9699 Omni Media Technology Inc 0 d 96996565 6565 0 v 9710 NetMos Technology 0 d 97109815 VScom 021H-EP2 2 port parallel adaptor 0 d 97109835 222N-2 I/O Card (2S+1P) 0 v a0a0 AOPEN Inc. 0 v a0f1 UNISYS Corporation 0 v a200 NEC Corporation 0 v a259 Hewlett Packard 0 v a25b Hewlett Packard GmbH PL24-MKT 0 v a304 Sony 0 v a727 3Com Corporation 0 v aa42 Scitex Digital Video 0 v ac1e Digital Receiver Technology Inc 0 v b1b3 Shiva Europe Limited 0 v bd11 Pinnacle Systems 1 11bd is probably wrong v c001 TSI Telsys 0 v c0a9 Micron/Crucial Technology 0 v c0de Motorola 0 v c0fe Motion Engineering, Inc. 0 v ca50 Varian Australia Pty Ltd 0 v cafe Chrysalis-ITS 0 v cccc Catapult Communications 0 v cddd Tyzx, Inc. 0 d cddd0101 DeepSea 1 High Speed Stereo Vision Frame Grabber 0 d cddd0200 DeepSea 2 High Speed Stereo Vision Frame Grabber 1 v d4d4 Dy4 Systems Inc 0 d d4d40601 PCI Mezzanine Card 0 v d531 I+ME ACTIA GmbH 0 v d84d Exsys 0 v dead Indigita Corporation 0 v e000 Winbond 0 d e000e000 W89C940 0 v e159 Tiger Jet Network Inc. 0 d e1590001 Model 300 128k 0 s e159000100590001 128k ISDN-S/T Adapter 0 s e159000100590003 128k ISDN-U Adapter 0 d e1590002 Tiger100APC ISDN chipset 0 v e4bf EKF Elektronik GmbH 0 v ea01 Eagle Technology 0 v ea60 RME 1 The main chip of all these devices is by Xilinx -> It could also be a Xilinx ID. d ea609896 Digi32 1 d ea609896 RME Digi32 1 d ea609897 RME Digi32 Pro 1 d ea609897 Digi32 Pro 1 d ea609898 Digi32/8 1 d ea609898 RME Digi32/8 1 v eabb Aashima Technology B.V. 0 v eace Endace Measurement Systems, Ltd 0 d eace3100 DAG 3.10 OC-3/OC-12 0 d eace3200 DAG 3.2x OC-3/OC-12 0 d eace320e DAG 3.2E Fast Ethernet 0 d eace340e DAG 3.4E Fast Ethernet 0 d eace341e DAG 3.41E Fast Ethernet 0 d eace3500 DAG 3.5 OC-3/OC-12 0 d eace351c DAG 3.5ECM Fast Ethernet 0 d eace4100 DAG 4.10 OC-48 0 d eace4110 DAG 4.11 OC-48 0 d eace4220 DAG 4.2 OC-48 0 d eace422e DAG 4.2E Dual Gigabit Ethernet 0 v ec80 Belkin Corporation 0 d ec80ec00 F5D6000 0 v ecc0 Echo Corporation 0 v edd8 ARK Logic Inc 0 d edd8a091 1000PV [Stingray] 0 d edd8a099 2000PV [Stingray] 0 d edd8a0a1 2000MT 0 d edd8a0a9 2000MI 0 v f1d0 AJA Video 0 d f1d0cafe KONA SD SMPTE 259M I/O 1 All boards I have seen have this ID not efac, though all docs say efac... d f1d0efac KONA SD SMPTE 259M I/O 0 d f1d0facd KONA HD SMPTE 292M I/O 0 v fa57 Fast Search & Transfer ASA 0 v febd Ultraview Corp. 0 v feda Epigram Inc 0 v feda Epigram Inc (Broadcom Inc) 1 d fedaa0fa BCM4210 iLine10 HomePNA 2.0 1 d fedaa10e BCM4230 iLine10 HomePNA 2.0 1 v fffe VMWare Inc 0 d fffe0710 Virtual SVGA 0 v ffff Illegal Vendor ID 0 avifile-0.7.48~20090503.ds/drivers/libdha/AsmMacros.h0000644000175000017500000001057707532424710020716 0ustar yavoryavor/* $XConsortium: AsmMacros.h /main/13 1996/10/25 11:33:12 kaleb $ */ /* * (c) Copyright 1993,1994 by David Wexelblat * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of David Wexelblat shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from David Wexelblat. * */ /* * Copyright 1997 * Digital Equipment Corporation. All rights reserved. * This software is furnished under license and may be used and copied only in * accordance with the following terms and conditions. Subject to these * conditions, you may download, copy, install, use, modify and distribute * this software in source and/or binary form. No title or ownership is * transferred hereby. * * 1) Any source code used, modified or distributed must reproduce and retain * this copyright notice and list of conditions as they appear in the source * file. * * 2) No right is granted to use any trade name, trademark, or logo of Digital * Equipment Corporation. Neither the "Digital Equipment Corporation" name * nor any trademark or logo of Digital Equipment Corporation may be used * to endorse or promote products derived from this software without the * prior written permission of Digital Equipment Corporation. * * 3) This software is provided "AS-IS" and any express or implied warranties, * including but not limited to, any implied warranties of merchantability, * fitness for a particular purpose, or non-infringement are disclaimed. In * no event shall DIGITAL be liable for any damages whatsoever, and in * particular, DIGITAL shall not be liable for special, indirect, * consequential, or incidental damages or damages for * lost profits, loss of revenue or loss of use, whether such damages arise * in contract, * negligence, tort, under statute, in equity, at law or otherwise, even if * advised of the possibility of such damage. * */ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 2001/11/16 21:13:34 tsi Exp $ */ /* * Modified for readability by Nick Kurshev */ #if defined(__GNUC__) #if defined(__alpha__) #include "sysdep/AsmMacros_alpha.h" #elif defined(__ia64__) #include "sysdep/AsmMacros_ia64.h" #elif defined(__sparc__) #include "sysdep/AsmMacros_sparc.h" #elif defined( __arm32__ ) #include "sysdep/AsmMacros_arm32.h" #elif defined(__powerpc__) #include "sysdep/AsmMacros_powerpc.h" #elif defined (__i386__) #include "sysdep/AsmMacros_x86.h" #else #include "sysdep/AsmMacros_generic.h" #endif #else /* __GNUC__ */ #if defined(_MINIX) && defined(_ACK) /* inb, outb, inw and outw are defined in the library */ /* ... but I've no idea if the same is true for inl & outl */ extern u8_t inb(U16_t); extern void outb(U16_t, U8_t); extern u16_t inw(U16_t); extern void outw(U16_t, U16_t); extern u32_t inl(U16_t); extern void outl(U16_t, U32_t); #else /* not _MINIX and _ACK */ # if defined(__STDC__) && (__STDC__ == 1) # ifndef NCR # define asm __asm # endif # endif # ifdef SVR4 # include # ifndef __USLC__ # define __USLC__ # endif # endif #ifndef SCO325 # include #else # include "../common/scoasm.h" #endif #define intr_disable() asm("cli") #define intr_enable() asm("sti") #endif /* _MINIX and _ACK */ #endif /* __GNUC__ */ avifile-0.7.48~20090503.ds/drivers/libdha/Makefile.am0000644000175000017500000000256611110340043020672 0ustar yavoryavorSUBDIRS = kernelhelper noinst_LTLIBRARIES = libdha.la noinst_HEADERS =\ AsmMacros.h\ libdha.h\ sysdep/AsmMacros_alpha.h\ sysdep/AsmMacros_arm32.h\ sysdep/AsmMacros_ia64.h\ sysdep/AsmMacros_powerpc.h\ sysdep/AsmMacros_sparc.h\ sysdep/AsmMacros_x86.h if AMM_USE_VIDIX libdha_la_SOURCES =\ cpu_flush.c\ irq.c\ libdha.c\ mmi.c\ mtrr.c\ pci.c\ pci_names.c\ ports.c endif EXTRA_DIST =\ README\ bin/mapdev.copyright\ bin/mapdev.vxd\ bin/README\ oth/pci.db\ pci_db2c.awk\ sysdep/libdha_os2.c\ sysdep/libdha_win32.c\ sysdep/pci_386bsd.c\ sysdep/pci_alpha.c\ sysdep/pci_arm32.c\ sysdep/pci_bsdi.c\ sysdep/pci_freebsd.c\ sysdep/pci_ia64.c\ sysdep/pci_isc.c\ sysdep/pci_linux.c\ sysdep/pci_lynx.c\ sysdep/pci_mach386.c\ sysdep/pci_netbsd.c\ sysdep/pci_openbsd.c\ sysdep/pci_os2.c\ sysdep/pci_powerpc.c\ sysdep/pci_sco.c\ sysdep/pci_sparc.c\ sysdep/pci_svr4.c\ sysdep/pci_win32.c\ sysdep/pci_x86.c AWK_GENERATED =\ pci_dev_ids.c\ pci_ids.h\ pci_names.c\ pci_names.h\ pci_vendors.h EXTRA_PROGRAMS = test test_SOURCES = test.c test_LDADD = $(noinst_LTLIBRARIES) pci_dev_ids.c: $(srcdir)/pci_db2c.awk $(srcdir)/oth/pci.db LC_CTYPE=C $(AWK) -f $(srcdir)/pci_db2c.awk $(srcdir)/oth/pci.db $(srcdir)/pci.c: pci_dev_ids.c $(srcdir)/pci_names.c: pci_dev_ids.c $(srcdir)/pci_ids.h: pci_vendors.h CLEANFILES = $(AWK_GENERATED) MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/drivers/libdha/Makefile.mp0000644000175000017500000000247007535675404020737 0ustar yavoryavor# makefile include ../config.mak VERSION = 0.2 ifeq ($(TARGET_OS),CYGWIN) SHORTNAME = libdha.dll else SHORTNAME = libdha.so endif LIBNAME = libdha-$(VERSION).so SRCS=libdha.c mtrr.c pci.c pci_names.c mmi.c ports.c OBJS=$(SRCS:.c=.o) CFLAGS = $(OPTFLAGS) -fPIC -I. -I.. -Wall -W LIBS = ifeq ($(TARGET_OS),OpenBSD) ifeq ($(TARGET_ARCH_X86),yes) LIBS += -li386 endif endif .SUFFIXES: .c .o # .PHONY: all clean .c.o: $(CC) -c $(CFLAGS) -o $@ $< $(LIBNAME): $(OBJS) $(CC) -shared -o $(LIBNAME) $(OBJS) $(LIBS) ln -sf $(LIBNAME) $(SHORTNAME) all: $(LIBNAME) $(SHORTNAME) pci_names.c: $(AWK) -f pci_db2c.awk oth/pci.db test: $(CC) test.c -o test $(SHORTNAME) clean: rm -f *.o *.so *~ distclean: rm -f Makefile.bak *.o *.so test *~ .depend rm -f pci_dev_ids.c pci_ids.h pci_names.c pci_names.h pci_vendors.h pci.db dep: depend depend: $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend install: install -D -m 755 -s -p $(LIBNAME) $(prefix)/lib/$(LIBNAME) rm -f $(prefix)/lib/libdha.so ln -sf $(LIBNAME) $(prefix)/lib/libdha.so ifeq ($(TARGET_OS),OpenBSD) $(LDCONFIG) -R else $(LDCONFIG) endif uninstall: rm -f $(prefix)/lib/$(LIBNAME) rm -f $(prefix)/lib/libdha.so rmdir -p --ignore-fail-on-non-empty $(prefix)/lib # # include dependency files if they exist # ifneq ($(wildcard .depend),) include .depend endif avifile-0.7.48~20090503.ds/drivers/libdha/README0000644000175000017500000000100207532424711017520 0ustar yavoryavorlibdha - Library of Direct Hardware Access. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This library was designed for direct hardware access under different OS and architectures. It's not linux specific only (like harddrake and other). This library is based on gfxdump utility from GATOS project. Full list of supported OS'es see in libdha.h Note: This library requires ROOT privileges or SUID'ed executable file (same as XServer). (Or use newly developed libdha kernel helper. Look at kernelhelper/dhahelper.c) avifile-0.7.48~20090503.ds/drivers/libdha/cpu_flush.c0000644000175000017500000000076207622471101021003 0ustar yavoryavor/* CPU flush support */ #include #include #include #include #include #include "libdha.h" #include "kernelhelper/dhahelper.h" void cpu_flush(void *va,unsigned long length) { int retval; int libdha_fd=-1; if( libdha_fd == -1) libdha_fd = open("/dev/dhahelper",O_RDWR); if (libdha_fd > 0) { dhahelper_cpu_flush_t _l2; _l2.va = va; _l2.length = length; retval = ioctl(libdha_fd, DHAHELPER_CPU_FLUSH, &_l2); close(libdha_fd); } } avifile-0.7.48~20090503.ds/drivers/libdha/irq.c0000644000175000017500000000230007622471101017574 0ustar yavoryavor/* HW IRQ support */ #include #include #include /* mlock */ #include #include #include #include #include "libdha.h" #include "kernelhelper/dhahelper.h" static int libdha_fd=-1; static int hwirq_locks=0; int hwirq_install(int bus, int dev, int func, int ar, u_long ao, uint32_t ad) { int retval; if( libdha_fd == -1) libdha_fd = open("/dev/dhahelper",O_RDWR); hwirq_locks++; if (libdha_fd > 0) { dhahelper_irq_t _irq; _irq.bus = bus; _irq.dev = dev; _irq.func = func; _irq.ack_region = ar; _irq.ack_offset = ao; _irq.ack_data = ad; retval = ioctl(libdha_fd, DHAHELPER_INSTALL_IRQ, &_irq); return retval; } return errno; } int hwirq_wait(unsigned irqnum) { int retval; if (libdha_fd > 0) { dhahelper_irq_t _irq; _irq.num = irqnum; retval = ioctl(libdha_fd, DHAHELPER_ACK_IRQ, &_irq); return retval; } return EINVAL; } int hwirq_uninstall(int bus, int dev, int func) { if (libdha_fd > 0) { dhahelper_irq_t _irq; _irq.bus = bus; _irq.dev = dev; _irq.func = func; ioctl(libdha_fd, DHAHELPER_FREE_IRQ, &_irq); } if(!hwirq_locks) { close(libdha_fd); libdha_fd=-1; } return 0; } avifile-0.7.48~20090503.ds/drivers/libdha/libdha.c0000644000175000017500000000441611167211455020241 0ustar yavoryavor/* libgha.c - Library for direct hardware access Copyrights: 1996/10/27 - Robin Cutshaw (robin@xfree86.org) XFree86 3.3.3 implementation 1999 - Øyvind Aabling. Modified for GATOS/win/gfxdump. 2002 - library implementation by Nick Kurshev - dhahelper and some changes by Alex Beregszaszi supported O/S's: SVR4, UnixWare, SCO, Solaris, FreeBSD, NetBSD, 386BSD, BSDI BSD/386, Linux, Mach/386, ISC DOS (WATCOM 9.5 compiler), Win9x (with mapdev.vxd) Licence: GPL Original location: www.linuxvideo.org/gatos */ #include "config.h" #include "libdha.h" #include #include #include #include #include #include #if ARCH_ALPHA #include #endif #include /* instead exit() use libdha_exit, and do the 'mother-application' deinit only in this code */ void libdha_exit(const char *message, int level) { printf("libdha: FATAL: %s\n", message); exit(level); /* FIXME */ } #if defined(_WIN32) #include "sysdep/libdha_win32.c" #elif defined (__EMX__) #include "sysdep/libdha_os2.c" #else #if defined(SVR4) || defined(SCO325) # if !(defined(sun) && defined (i386) && defined (SVR4)) # define DEV_MEM "/dev/pmem" # elif defined(PowerMAX_OS) # define DEV_MEM "/dev/iomem" # endif # ifdef SCO325 # undef DEV_MEM # define DEV_MEM "/dev/mem" # endif # endif /* SVR4 */ /* Generic version */ #include #include #ifndef DEV_MEM #define DEV_MEM "/dev/mem" #endif #include "kernelhelper/dhahelper.h" static int devmem_fd=-1; static unsigned devmem_locks=0; void *map_phys_mem(unsigned long base, unsigned long size) { #if ARCH_ALPHA /* TODO: move it into sysdep */ base += bus_base(); #endif if( devmem_fd == -1) { if ( (devmem_fd = open("/dev/dhahelper",O_RDWR)) < 0) { if ( (devmem_fd = open(DEV_MEM,O_RDWR)) == -1) { perror("libdha: open(/dev/mem) failed"); exit(1); } } } devmem_locks++; return mmap(0,size,PROT_READ|PROT_WRITE,MAP_SHARED,devmem_fd,base) ; } void unmap_phys_mem(void *ptr, unsigned long size) { int res=munmap(ptr,size) ; if (res == -1) { perror("libdha: munmap() failed") ; exit(1) ; } devmem_locks--; if(!devmem_locks) { close(devmem_fd); devmem_fd=-1; } } #endif avifile-0.7.48~20090503.ds/drivers/libdha/libdha.h0000644000175000017500000001036407622470371020252 0ustar yavoryavor/* libgha.h - Library for direct hardware access Copyrights: 1996/10/27 - Robin Cutshaw (robin@xfree86.org) XFree86 3.3.3 implementation 1999 - Øyvind Aabling. Modified for GATOS/win/gfxdump. 2002 - library implementation by Nick Kurshev supported O/S's: SVR4, UnixWare, SCO, Solaris, FreeBSD, NetBSD, 386BSD, BSDI BSD/386, Linux, Mach/386, ISC DOS (WATCOM 9.5 compiler), Win9x (with mapdev.vxd) Licence: GPL */ #ifndef LIBDHA_H #define LIBDHA_H #include #ifdef __cplusplus extern "C" { #endif #define MAX_DEV_PER_VENDOR_CFG1 64 #define MAX_PCI_DEVICES_PER_BUS 32 #define MAX_PCI_DEVICES 64 #define PCI_MULTIFUNC_DEV 0x80 typedef struct pciinfo_s { int bus,card,func; /* PCI/AGP bus:card:func */ unsigned short vendor,device; /* Card vendor+device ID */ unsigned long base0,base1,base2,baserom; /* Memory and I/O base addresses */ unsigned long base3,base4,base5; /* Memory and I/O base addresses */ unsigned char irq,ipin,gnt,lat; /* assigned IRQ parameters for this card */ // unsigned base0_limit, base1_limit, base2_limit, baserom_limit; }pciinfo_t; extern int pci_config_read(unsigned char bus, unsigned char dev, unsigned char func, unsigned char cmd, int len, unsigned long *val); extern int pci_config_write(unsigned char bus, unsigned char dev, unsigned char func, unsigned char cmd, int len, unsigned long val); /* Fill array pci_list which must have size MAX_PCI_DEVICES and return 0 if sucessful */ extern int pci_scan(pciinfo_t *pci_list,unsigned *num_card); /* Enables/disables accessing to IO space from application side. Should return 0 if o'k or errno on error. */ extern int enable_app_io( void ); extern int disable_app_io( void ); extern unsigned char INPORT8(unsigned idx); extern unsigned short INPORT16(unsigned idx); extern unsigned INPORT32(unsigned idx); #define INPORT(idx) INPORT32(idx) extern void OUTPORT8(unsigned idx,unsigned char val); extern void OUTPORT16(unsigned idx,unsigned short val); extern void OUTPORT32(unsigned idx,unsigned val); #define OUTPORT(idx,val) OUTPORT32(idx,val) extern void * map_phys_mem(unsigned long base, unsigned long size); extern void unmap_phys_mem(void *ptr, unsigned long size); /* These are the region types */ #define MTRR_TYPE_UNCACHABLE 0 #define MTRR_TYPE_WRCOMB 1 #define MTRR_TYPE_WRTHROUGH 4 #define MTRR_TYPE_WRPROT 5 #define MTRR_TYPE_WRBACK 6 extern int mtrr_set_type(unsigned base,unsigned size,int type); /* Busmastering support */ /* returns 0 if support exists else errno */ extern int bm_open( void ); extern void bm_close( void ); /* Converts virtual memory addresses into physical returns 0 if OK else - errno parray should have enough length to accept length/page_size elements. virt_addr can be located in non-continious memory block and can be allocated by malloc(). (kmalloc() is not needed). Note: if you have some very old card which requires continous memory block then you need to implement bm_kmalloc bm_kfree functions here. NOTE2: to be sure that every page of region is present in physical memory (is not swapped out) use m(un)lock functions. Note3: Probably your card will want to have page-aligned block for DMA transfer so use memalign(PAGE_SIZE,mem_size) function to alloc such memory. */ extern int bm_virt_to_phys( void * virt_addr, unsigned long length, unsigned long * parray ); /* Converts virtual memory addresses into bus address Works in the same way as bm_virt_to_phys. */ extern int bm_virt_to_bus( void * virt_addr, unsigned long length, unsigned long * barray ); extern void * bm_alloc_pa( unsigned long length ); extern void bm_free_pa( void * virt_addr, unsigned long length ); extern int bm_lock_mem( const void * addr, unsigned long length ); extern int bm_unlock_mem( const void * addr, unsigned long length ); /* HWIRQ support */ extern int hwirq_install(int bus, int dev, int func, int areg, unsigned long aoff, uint32_t adata); extern int hwirq_wait(unsigned irqnum); extern int hwirq_uninstall(int bus, int dev, int func); /* CPU flushing support */ extern void cpu_flush(void *va,unsigned long length); #ifdef __cplusplus } #endif #endif avifile-0.7.48~20090503.ds/drivers/libdha/mmi.c0000644000175000017500000000474510402763761017610 0ustar yavoryavor/* Memory manager interface */ #include #include #include /* mlock */ #include #include #include #include "libdha.h" #include "kernelhelper/dhahelper.h" static int libdha_fd=-1; #define ALLOWED_VER 0x10 int bm_open( void ) { int retv; libdha_fd = open("/dev/dhahelper",O_RDWR); retv = libdha_fd > 0 ? 0 : ENXIO; if(!retv) { int ver; ioctl(libdha_fd,DHAHELPER_GET_VERSION,&ver); if(ver < ALLOWED_VER) { printf("libdha: You have wrong version (%i) of /dev/dhahelper\n" "libdha: Please upgrade your driver up to ver=%i\n",ver,ALLOWED_VER); retv = EINVAL; close(libdha_fd); } } else printf("libdha: Can't open /dev/dhahelper\n"); return retv; } void bm_close( void ) { close(libdha_fd); } int bm_virt_to_phys( void * virt_addr, unsigned long length, unsigned long * parray ) { dhahelper_vmi_t vmi; vmi.virtaddr = virt_addr; vmi.length = length; vmi.realaddr = parray; if(libdha_fd > 0) return ioctl(libdha_fd,DHAHELPER_VIRT_TO_PHYS,&vmi); return ENXIO; } int bm_virt_to_bus( void * virt_addr, unsigned long length, unsigned long * barray ) { dhahelper_vmi_t vmi; vmi.virtaddr = virt_addr; vmi.length = length; vmi.realaddr = barray; if(libdha_fd > 0) return ioctl(libdha_fd,DHAHELPER_VIRT_TO_BUS,&vmi); return ENXIO; } void * bm_alloc_pci_shmem(pciinfo_t *pi, unsigned mem_bitness, unsigned long length,int op ) { printf("libdha: Pure virtual function call - bm_alloc_pci_shmem()\n"); #if 0 dhahelper_mem_t vmi; vmi.length = length; if(libdha_fd > 0) { if(ioctl(libdha_fd,DHAHELPER_ALLOC_PA,&vmi) == 0) return vmi.addr; } #endif return 0; } void bm_free_pci_shmem(void * pci_shmem) { printf("libdha: Pure virtual function call - bm_free_pci_shmem()\n"); #if 0 dhahelper_mem_t vmi; vmi.addr = virt_addr; vmi.length = length; if(libdha_fd > 0) { ioctl(libdha_fd,DHAHELPER_FREE_PA,&vmi); } #endif } int bm_lock_mem( const void *addr, unsigned long length ) { dhahelper_mem_t vmi; vmi.addr = addr; vmi.length = length; if(libdha_fd > 0) { return ioctl(libdha_fd,DHAHELPER_LOCK_MEM,&vmi); } return mlock(addr,length); } int bm_unlock_mem( const void * addr, unsigned long length ) { dhahelper_mem_t vmi; vmi.addr = addr; vmi.length = length; if(libdha_fd > 0) { return ioctl(libdha_fd,DHAHELPER_UNLOCK_MEM,&vmi); } return munlock(addr,length); } avifile-0.7.48~20090503.ds/drivers/libdha/mtrr.c0000644000175000017500000000401107622470371017776 0ustar yavoryavor/* mtrr.c - Stuff for optimizing memory access Copyrights: 2002 - Linux version by Nick Kurshev Licence: GPL */ #include "config.h" #include #include #include #include #include #include #include "kernelhelper/dhahelper.h" #include "libdha.h" #if defined (__i386__) && defined (__NetBSD__) #include #if __NetBSD_Version__ > 105240000 #include #include #include #include #endif #endif int mtrr_set_type(unsigned base,unsigned size,int type) { int dhahelper_fd; dhahelper_fd = open("/dev/dhahelper",O_RDWR); if(dhahelper_fd > 0) { int retval; dhahelper_mtrr_t mtrrs; mtrrs.operation = MTRR_OP_ADD; mtrrs.start = base; mtrrs.size = size; mtrrs.type = type; retval = ioctl(dhahelper_fd, DHAHELPER_ACK_IRQ, &mtrrs); close(dhahelper_fd); return retval; } #if defined (__NetBSD__) && (__NetBSD_Version__) > 105240000 { struct mtrr *mtrrp; int n; mtrrp = malloc(sizeof (struct mtrr)); mtrrp->base = base; mtrrp->len = size; mtrrp->type = type; mtrrp->flags = MTRR_VALID | MTRR_PRIVATE; n = 1; if (i386_set_mtrr(mtrrp, &n) < 0) { free(mtrrp); return errno; } free(mtrrp); return 0; } #else { FILE * mtrr_fd; char * stype; switch(type) { case MTRR_TYPE_UNCACHABLE: stype = "uncachable"; break; case MTRR_TYPE_WRCOMB: stype = "write-combining"; break; case MTRR_TYPE_WRTHROUGH: stype = "write-through"; break; case MTRR_TYPE_WRPROT: stype = "write-protect"; break; case MTRR_TYPE_WRBACK: stype = "write-back"; break; default: return EINVAL; } mtrr_fd = fopen("/proc/mtrr","wt"); if(mtrr_fd) { char sout[256]; unsigned wr_len; sprintf(sout,"base=0x%08X size=0x%08X type=%s\n",base,size,stype); wr_len = fprintf(mtrr_fd,sout); /*printf("MTRR: %s\n",sout);*/ fclose(mtrr_fd); return wr_len == strlen(sout) ? 0 : EPERM; } } #endif return ENOSYS; } avifile-0.7.48~20090503.ds/drivers/libdha/pci.c0000644000175000017500000006276107622470371017605 0ustar yavoryavor/* (C) 2002 - library implementation by Nick Kyrshev XFree86 3.3.3 scanpci.c, modified for GATOS/win/gfxdump by Øyvind Aabling. */ /* $XConsortium: scanpci.c /main/25 1996/10/27 11:48:40 kaleb $ */ /* * name: scanpci.c * * purpose: This program will scan for and print details of * devices on the PCI bus. * author: Robin Cutshaw (robin@xfree86.org) * * supported O/S's: SVR4, UnixWare, SCO, Solaris, * FreeBSD, NetBSD, 386BSD, BSDI BSD/386, * Linux, Mach/386, ISC * DOS (WATCOM 9.5 compiler) * * compiling: [g]cc scanpci.c -o scanpci * for SVR4 (not Solaris), UnixWare use: * [g]cc -DSVR4 scanpci.c -o scanpci * for DOS, watcom 9.5: * wcc386p -zq -omaxet -7 -4s -s -w3 -d2 name.c * and link with PharLap or other dos extender for exe * */ /* $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ */ /* * Copyright 1995 by Robin Cutshaw * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of the above listed copyright holder(s) * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. The above listed * copyright holder(s) make(s) no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #include "libdha.h" #include #include #include #include #include #include #include "kernelhelper/dhahelper.h" #ifdef __unix__ #include #endif #if 0 #if defined(__SUNPRO_C) || defined(sun) || defined(__sun) #include #else #include #endif #include #endif #if defined(Lynx) && defined(__powerpc__) /* let's mimick the Linux Alpha stuff for LynxOS so we don't have * to change too much code */ #include static unsigned char *pciConfBase; static __inline__ unsigned long static swapl(unsigned long val) { unsigned char *p = (unsigned char *)&val; return ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | (p[0] << 0)); } #define BUS(tag) (((tag)>>16)&0xff) #define DFN(tag) (((tag)>>8)&0xff) #define PCIBIOS_DEVICE_NOT_FOUND 0x86 #define PCIBIOS_SUCCESSFUL 0x00 int pciconfig_read( unsigned char bus, unsigned char dev, unsigned char offset, int len, /* unused, alway 4 */ unsigned long *val) { unsigned long _val; unsigned long *ptr; dev >>= 3; if (bus || dev >= 16) { *val = 0xFFFFFFFF; return PCIBIOS_DEVICE_NOT_FOUND; } else { ptr = (unsigned long *)(pciConfBase + ((1<>= 3; _val = swapl(val); if (bus || dev >= 16) { return PCIBIOS_DEVICE_NOT_FOUND; } else { ptr = (unsigned long *)(pciConfBase + ((1<=MAX_PCI_DEVICES) return ; pci_lst[pcicards].bus = pcibus ; pci_lst[pcicards].card = pcicard ; pci_lst[pcicards].func = pcifunc ; pci_lst[pcicards].vendor = pcr->_vendor ; pci_lst[pcicards].device = pcr->_device ; pci_lst[pcicards].base0 = 0xFFFFFFFF ; pci_lst[pcicards].base1 = 0xFFFFFFFF ; pci_lst[pcicards].base2 = 0xFFFFFFFF ; pci_lst[pcicards].base3 = 0xFFFFFFFF ; pci_lst[pcicards].base4 = 0xFFFFFFFF ; pci_lst[pcicards].base5 = 0xFFFFFFFF ; pci_lst[pcicards].baserom = 0x000C0000 ; if (pcr->_base0) pci_lst[pcicards].base0 = pcr->_base0 & ((pcr->_base0&0x1) ? 0xFFFFFFFC : 0xFFFFFFF0) ; if (pcr->_base1) pci_lst[pcicards].base1 = pcr->_base1 & ((pcr->_base1&0x1) ? 0xFFFFFFFC : 0xFFFFFFF0) ; if (pcr->_base2) pci_lst[pcicards].base2 = pcr->_base2 & ((pcr->_base2&0x1) ? 0xFFFFFFFC : 0xFFFFFFF0) ; if (pcr->_base3) pci_lst[pcicards].base3 = pcr->_base3 & ((pcr->_base0&0x1) ? 0xFFFFFFFC : 0xFFFFFFF0) ; if (pcr->_base4) pci_lst[pcicards].base4 = pcr->_base4 & ((pcr->_base1&0x1) ? 0xFFFFFFFC : 0xFFFFFFF0) ; if (pcr->_base5) pci_lst[pcicards].base5 = pcr->_base5 & ((pcr->_base2&0x1) ? 0xFFFFFFFC : 0xFFFFFFF0) ; if (pcr->_baserom) pci_lst[pcicards].baserom = pcr->_baserom ; pci_lst[pcicards].irq = pcr->_int_line; pci_lst[pcicards].ipin= pcr->_int_pin; pci_lst[pcicards].gnt = pcr->_min_gnt; pci_lst[pcicards].lat = pcr->_max_lat; pcicards++; } /*main(int argc, char *argv[])*/ static int __pci_scan(pciinfo_t *pci_list,unsigned *num_pci) { unsigned int idx; struct pci_config_reg pcr; int do_mode1_scan = 0, do_mode2_scan = 0; int func, hostbridges=0; int ret = -1; pci_lst = pci_list; pcicards = 0; ret = enable_app_io(); if (ret != 0) return(ret); if((pcr._configtype = pci_config_type()) == 0xFFFF) return ENODEV; /* Try pci config 1 probe first */ if ((pcr._configtype == 1) || do_mode1_scan) { /*printf("\nPCI probing configuration type 1\n");*/ pcr._ioaddr = 0xFFFF; pcr._pcibuses[0] = 0; pcr._pcinumbus = 1; pcr._pcibusidx = 0; idx = 0; do { /*printf("Probing for devices on PCI bus %d:\n\n", pcr._pcibusidx);*/ for (pcr._cardnum = 0x0; pcr._cardnum < MAX_PCI_DEVICES_PER_BUS; pcr._cardnum += 0x1) { func = 0; do { /* loop over the different functions, if present */ pcr._device_vendor = pci_get_vendor(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum, func); if ((pcr._vendor == 0xFFFF) || (pcr._device == 0xFFFF)) break; /* nothing there */ /*printf("\npci bus 0x%x cardnum 0x%02x function 0x%04x: vendor 0x%04x device 0x%04x\n", pcr._pcibuses[pcr._pcibusidx], pcr._cardnum, func, pcr._vendor, pcr._device);*/ pcibus = pcr._pcibuses[pcr._pcibusidx]; pcicard = pcr._cardnum; pcifunc = func; pcr._status_command = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum,func,PCI_CMD_STAT_REG); pcr._class_revision = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum,func,PCI_CLASS_REG); pcr._bist_header_latency_cache = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum,func,PCI_HEADER_MISC); pcr._base0 = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum,func,PCI_MAP_REG_START); pcr._base1 = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum,func,PCI_MAP_REG_START+4); pcr._base2 = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum,func,PCI_MAP_REG_START+8); pcr._base3 = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum,func,PCI_MAP_REG_START+0x0C); pcr._base4 = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum,func,PCI_MAP_REG_START+0x10); pcr._base5 = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum,func,PCI_MAP_REG_START+0x14); pcr._baserom = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum,func,PCI_MAP_ROM_REG); #if 0 pcr._int_pin = pci_config_read_byte(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum,func,PCI_INTERRUPT_PIN); pcr._int_line = pci_config_read_byte(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum,func,PCI_INTERRUPT_REG); pcr._min_gnt = pci_config_read_byte(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum,func,PCI_MIN_GNT); pcr._max_lat = pci_config_read_byte(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum,func,PCI_MAX_LAT); #else pcr._max_min_ipin_iline = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum,func,PCI_INTERRUPT_REG); #endif pcr._user_config = pci_config_read_long(pcr._pcibuses[pcr._pcibusidx], pcr._cardnum,func,PCI_REG_USERCONFIG); /* check for pci-pci bridges */ #define PCI_CLASS_MASK 0xff000000 #define PCI_SUBCLASS_MASK 0x00ff0000 #define PCI_CLASS_BRIDGE 0x06000000 #define PCI_SUBCLASS_BRIDGE_PCI 0x00040000 switch(pcr._class_revision & (PCI_CLASS_MASK|PCI_SUBCLASS_MASK)) { case PCI_CLASS_BRIDGE|PCI_SUBCLASS_BRIDGE_PCI: if (pcr._secondary_bus_number > 0) { pcr._pcibuses[pcr._pcinumbus++] = pcr._secondary_bus_number; } break; case PCI_CLASS_BRIDGE: if ( ++hostbridges > 1) { pcr._pcibuses[pcr._pcinumbus] = pcr._pcinumbus; pcr._pcinumbus++; } break; default: break; } if((func==0) && ((pcr._header_type & PCI_MULTIFUNC_DEV) == 0)) { /* not a multi function device */ func = 8; } else { func++; } if (idx++ >= MAX_PCI_DEVICES) continue; identify_card(&pcr); } while( func < 8 ); } } while (++pcr._pcibusidx < pcr._pcinumbus); } #if !defined(__alpha__) && !defined(__powerpc__) /* Now try pci config 2 probe (deprecated) */ if ((pcr._configtype == 2) || do_mode2_scan) { OUTPORT8(PCI_MODE2_ENABLE_REG, 0xF1); OUTPORT8(PCI_MODE2_FORWARD_REG, 0x00); /* bus 0 for now */ /*printf("\nPCI probing configuration type 2\n");*/ pcr._pcibuses[0] = 0; pcr._pcinumbus = 1; pcr._pcibusidx = 0; idx = 0; do { for (pcr._ioaddr = 0xC000; pcr._ioaddr < 0xD000; pcr._ioaddr += 0x0100){ OUTPORT8(PCI_MODE2_FORWARD_REG, pcr._pcibuses[pcr._pcibusidx]); /* bus 0 for now */ pcr._device_vendor = INPORT32(pcr._ioaddr); OUTPORT8(PCI_MODE2_FORWARD_REG, 0x00); /* bus 0 for now */ if ((pcr._vendor == 0xFFFF) || (pcr._device == 0xFFFF)) continue; if ((pcr._vendor == 0xF0F0) || (pcr._device == 0xF0F0)) continue; /* catch ASUS P55TP4XE motherboards */ /*printf("\npci bus 0x%x slot at 0x%04x, vendor 0x%04x device 0x%04x\n", pcr._pcibuses[pcr._pcibusidx], pcr._ioaddr, pcr._vendor, pcr._device);*/ pcibus = pcr._pcibuses[pcr._pcibusidx] ; pcicard = pcr._ioaddr ; pcifunc = 0 ; OUTPORT8(PCI_MODE2_FORWARD_REG, pcr._pcibuses[pcr._pcibusidx]); /* bus 0 for now */ pcr._status_command = INPORT32(pcr._ioaddr + 0x04); pcr._class_revision = INPORT32(pcr._ioaddr + 0x08); pcr._bist_header_latency_cache = INPORT32(pcr._ioaddr + 0x0C); pcr._base0 = INPORT32(pcr._ioaddr + 0x10); pcr._base1 = INPORT32(pcr._ioaddr + 0x14); pcr._base2 = INPORT32(pcr._ioaddr + 0x18); pcr._base3 = INPORT32(pcr._ioaddr + 0x1C); pcr._base4 = INPORT32(pcr._ioaddr + 0x20); pcr._base5 = INPORT32(pcr._ioaddr + 0x24); pcr._baserom = INPORT32(pcr._ioaddr + 0x30); pcr._max_min_ipin_iline = INPORT8(pcr._ioaddr + 0x3C); pcr._user_config = INPORT32(pcr._ioaddr + 0x40); OUTPORT8(PCI_MODE2_FORWARD_REG, 0x00); /* bus 0 for now */ /* check for pci-pci bridges (currently we only know Digital) */ if ((pcr._vendor == 0x1011) && (pcr._device == 0x0001)) if (pcr._secondary_bus_number > 0) pcr._pcibuses[pcr._pcinumbus++] = pcr._secondary_bus_number; if (idx++ >= MAX_PCI_DEVICES) continue; identify_card(&pcr); } } while (++pcr._pcibusidx < pcr._pcinumbus); OUTPORT8(PCI_MODE2_ENABLE_REG, 0x00); } #endif /* __alpha__ */ disable_app_io(); *num_pci = pcicards; return 0 ; } #if !defined(ENOTSUP) #if defined(EOPNOTSUPP) #define ENOTSUP EOPNOTSUPP #else #warning "ENOTSUP nor EOPNOTSUPP defined!" #endif #endif int pci_scan(pciinfo_t *pci_list,unsigned *num_pci) { int libdha_fd; if ( (libdha_fd = open("/dev/dhahelper",O_RDWR)) < 0) { return __pci_scan(pci_list,num_pci); } else { dhahelper_pci_device_t pci_dev; unsigned idx; idx = 0; while(ioctl(libdha_fd, DHAHELPER_PCI_FIND, &pci_dev)==0) { pci_list[idx].bus = pci_dev.bus; pci_list[idx].card = pci_dev.card; pci_list[idx].func = pci_dev.func; pci_list[idx].vendor = pci_dev.vendor; pci_list[idx].device = pci_dev.device; pci_list[idx].base0 = pci_dev.base0?pci_dev.base0:0xFFFFFFFF; pci_list[idx].base1 = pci_dev.base1?pci_dev.base1:0xFFFFFFFF; pci_list[idx].base2 = pci_dev.base2?pci_dev.base2:0xFFFFFFFF; pci_list[idx].baserom = pci_dev.baserom?pci_dev.baserom:0x000C0000; pci_list[idx].base3 = pci_dev.base3?pci_dev.base3:0xFFFFFFFF; pci_list[idx].base4 = pci_dev.base4?pci_dev.base4:0xFFFFFFFF; pci_list[idx].base5 = pci_dev.base5?pci_dev.base5:0xFFFFFFFF; pci_list[idx].irq = pci_dev.irq; pci_list[idx].ipin = pci_dev.ipin; pci_list[idx].gnt = pci_dev.gnt; pci_list[idx].lat = pci_dev.lat; idx++; } *num_pci=idx; close(libdha_fd); } return 0; } int pci_config_read(unsigned char bus, unsigned char dev, unsigned char func, unsigned char cmd, int len, unsigned long *val) { int ret; int dhahelper_fd; if ( (dhahelper_fd = open("/dev/dhahelper",O_RDWR)) > 0) { int retval; dhahelper_pci_config_t pcic; pcic.operation = PCI_OP_READ; pcic.bus = bus; pcic.dev = dev; pcic.func = func; pcic.cmd = cmd; pcic.size = len; retval = ioctl(dhahelper_fd, DHAHELPER_PCI_CONFIG, &pcic); close(dhahelper_fd); *val = pcic.ret; return retval; } ret = enable_app_io(); if (ret != 0) return(ret); switch(len) { case 4: ret = pci_config_read_long(bus, dev, func, cmd); break; case 2: ret = pci_config_read_word(bus, dev, func, cmd); break; case 1: ret = pci_config_read_byte(bus, dev, func, cmd); break; default: printf("libdha_pci: wrong length to read: %u\n",len); } disable_app_io(); *val = ret; return(0); } int pci_config_write(unsigned char bus, unsigned char dev, unsigned char func, unsigned char cmd, int len, unsigned long val) { int ret; int dhahelper_fd; if ( (dhahelper_fd = open("/dev/dhahelper",O_RDWR)) > 0) { int retval; dhahelper_pci_config_t pcic; pcic.operation = PCI_OP_WRITE; pcic.bus = bus; pcic.dev = dev; pcic.func = func; pcic.cmd = cmd; pcic.size = len; pcic.ret = val; retval = ioctl(dhahelper_fd, DHAHELPER_PCI_CONFIG, &pcic); close(dhahelper_fd); return retval; } ret = enable_app_io(); if (ret != 0) return ret; switch(len) { case 4: pci_config_write_long(bus, dev, func, cmd, val); break; case 2: pci_config_write_word(bus, dev, func, cmd, val); break; case 1: pci_config_write_byte(bus, dev, func, cmd, val); break; default: printf("libdha_pci: wrong length to read: %u\n",len); } disable_app_io(); return 0; } avifile-0.7.48~20090503.ds/drivers/libdha/pci_db2c.awk0000644000175000017500000002145307532424711021025 0ustar yavoryavor# This file converts given pci.db to "C" source and header files # For latest version of pci ids see: http://pciids.sf.net # Copyright 2002 Nick Kurshev # # Usage: awk -f pci_db2c.awk pci.db # # Tested with Gawk v 3.0.x and Mawk 1.3.3 # But it should work with standard Awk implementations (hopefully). # (Nobody tested it with Nawk, but it should work, too). # BEGIN { if(ARGC != 2) { # check for arguments: print "Usage awk -f pci_db2c.awk pci.db (and make sure pci.db file exists first)"; exit(1); } in_file = ARGV[1]; vendor_file = "pci_vendors.h"; ids_file = "pci_ids.h" name_file = "pci_names.c" name_h_file = "pci_names.h" dev_ids_file = "pci_dev_ids.c" line=0; # print out head lines print_head(vendor_file); print_head(ids_file); print_head(name_file); print_head(name_h_file); print_head(dev_ids_file); print "#ifndef PCI_VENDORS_INCLUDED" >vendor_file print "#define PCI_VENDORS_INCLUDED 1">vendor_file print "" >vendor_file print "#ifndef PCI_IDS_INCLUDED" >ids_file print "#define PCI_IDS_INCLUDED 1">ids_file print "" >ids_file print "#include \"pci_vendors.h\"">ids_file print "" >ids_file print "#ifndef PCI_NAMES_INCLUDED" >name_h_file print "#define PCI_NAMES_INCLUDED 1">name_h_file print "" >name_h_file print_name_struct(name_h_file); print "#include ">name_file print "#include \"pci_names.h\"">name_file print "#include \"pci_dev_ids.c\"">name_file print "">name_file print "static struct vendor_id_s vendor_ids[] = {">name_file first_pass=1; init_name_db(); while(getline 0 && field[4] == "0") { init_device_db() svend_name = get_short_vendor_name(field[3]) printf("#define VENDOR_%s\t", svend_name) >vendor_file; if(length(svend_name) < 9) printf("\t") >vendor_file; printf("0x%s /*%s*/\n",field[2], name_field) >vendor_file; printf("{ 0x%s, \"%s\", dev_lst_%s },\n",field[2], name_field, field[2]) >name_file; printf("/* Vendor: %s: %s */\n", field[2], name_field) > ids_file if(first_pass == 1) { first_pass=0; } else { print "{ 0xFFFF, NULL }\n};" >dev_ids_file; } printf("static const struct device_id_s dev_lst_%s[]={\n", field[2])>dev_ids_file } if(field[1] == "d" && length(field[3])>0 && field[4] == "0") { sdev_name = get_short_device_name(field[3]) full_name = sprintf("#define DEVICE_%s_%s", svend_name, sdev_name); printf("%s\t", full_name) >ids_file if(length(full_name) < 9) printf("\t") >ids_file; if(length(full_name) < 17) printf("\t") >ids_file; if(length(full_name) < 25) printf("\t") >ids_file; if(length(full_name) < 32) printf("\t") >ids_file; if(length(full_name) < 40) printf("\t") >ids_file; if(length(full_name) < 48) printf("\t") >ids_file; printf("0x%s /*%s*/\n", substr(field[2], 5), name_field) >ids_file printf("{ 0x%s, \"%s\" },\n", substr(field[2], 5), name_field) >dev_ids_file } if(field[1] == "s" && length(field[3])>0 && field[4] == "0") { subdev_name = get_short_subdevice_name(field[3]) full_name = sprintf("#define SUBDEVICE_%s_%s", svend_name, subdev_name) printf("\t%s\t", full_name) >ids_file if(length(full_name) < 9) printf("\t") >ids_file; if(length(full_name) < 17) printf("\t") >ids_file; if(length(full_name) < 25) printf("\t") >ids_file; if(length(full_name) < 32) printf("\t") >ids_file; if(length(full_name) < 40) printf("\t") >ids_file; printf("0x%s /*%s*/\n", substr(field[2], 9), name_field) >ids_file } } print "Total lines parsed:", line; print "">vendor_file print "#endif/*PCI_VENDORS_INCLUDED*/">vendor_file print "">ids_file print "#endif/*PCI_IDS_INCLUDED*/">ids_file print "">name_h_file print "#endif/*PCI_NAMES_INCLUDED*/">name_h_file print "};">name_file print "{ 0xFFFF, NULL }" >dev_ids_file; print "};">dev_ids_file print_func_bodies(name_file); } function print_head( out_file) { print "/*" >out_file; printf(" * File: %s\n", out_file) >out_file; printf(" * This file was generated automatically. Don't modify it.\n") >out_file; print "*/" >out_file; return; } function print_name_struct(out_file) { print "#ifdef __cplusplus" >out_file print "extern \"C\" {" >out_file print "#endif" >out_file print "">out_file print "struct device_id_s" >out_file print "{" >out_file print "\tunsigned short\tid;" >out_file print "\tconst char *\tname;" >out_file print "};" >out_file print "">out_file print "struct vendor_id_s" >out_file print "{" >out_file print "\tunsigned short\tid;" >out_file print "\tconst char *\tname;" >out_file print "\tconst struct device_id_s *\tdev_list;" >out_file print "};" >out_file print "extern const char *pci_vendor_name(unsigned short id);">out_file print "extern const char *pci_device_name(unsigned short vendor_id, unsigned short device_id);">out_file print "">out_file print "#ifdef __cplusplus" >out_file print "}" >out_file print "#endif" >out_file return } function print_func_bodies(out_file) { print "">out_file print "const char *pci_vendor_name(unsigned short id)" >out_file print "{" >out_file print " unsigned i;" >out_file print " for(i=0;iout_file print " {" >out_file print "\tif(vendor_ids[i].id == id) return vendor_ids[i].name;" >out_file print " }" >out_file print " return NULL;" >out_file print "}">out_file print "" >out_file print "const char *pci_device_name(unsigned short vendor_id, unsigned short device_id)" >out_file print "{" >out_file print " unsigned i, j;" >out_file print " for(i=0;iout_file print " {" >out_file print "\tif(vendor_ids[i].id == vendor_id)" >out_file print "\t{" >out_file print "\t j=0;" >out_file print "\t while(vendor_ids[i].dev_list[j].id != 0xFFFF)" >out_file print "\t {">out_file print "\t\tif(vendor_ids[i].dev_list[j].id == device_id) return vendor_ids[i].dev_list[j].name;">out_file print "\t\tj++;">out_file print "\t };">out_file print "\t break;" >out_file print "\t}" >out_file print " }" >out_file print " return NULL;">out_file print "}">out_file return } function kill_double_quoting(fld) { n=split(fld,phrases, "[\"]"); new_fld = phrases[1] for(i=2;i<=n;i++) new_fld = sprintf("%s\\\"%s", new_fld, phrases[i]) return new_fld } function init_name_db() { vendor_names[1]="" } function init_device_db() { # delete device_names for( i in device_names ) delete device_names[i]; device_names[1]="" # delete subdevice_names for( i in subdevice_names ) delete subdevice_names[i]; subdevice_names[1] = "" } function get_short_vendor_name(from) { n=split(from, name, "[ ]"); new_name = toupper(name[1]); if(length(new_name)<3) new_name = sprintf("%s_%s", new_name, toupper(name[2])); n=split(new_name, name, "[^0-9A-Za-z]"); svendor = name[1]; for(i=2;i<=n;i++) svendor=sprintf("%s%s%s", svendor, length(name[i])?"_":"", name[i]); new_name = svendor; vend_suffix = 2; # check for unique while(new_name in vendor_names) { new_name = sprintf("%s%u", svendor, vend_suffix) vend_suffix = vend_suffix + 1; } # Add new name in array of vendor's names vendor_names[new_name] = new_name return new_name; } function get_short_device_name(from_name) { n=split(from_name, name, "[ ]"); new_name = toupper(name[1]); if(length(name[2])) new_name = sprintf("%s_%s", new_name, toupper(name[2])); if(length(name[3])) new_name = sprintf("%s_%s", new_name, toupper(name[3])); n=split(new_name, name, "[^0-9A-Za-z]"); sdevice = name[1]; for(i=2;i<=n;i++) sdevice=sprintf("%s%s%s", sdevice, length(name[i])?"_":"", name[i]); new_name = sdevice; dev_suffix = 2; # check for unique while(new_name in device_names) { new_name = sprintf("%s%u", sdevice, dev_suffix) dev_suffix = dev_suffix + 1; } # Add new name in array of device names device_names[new_name] = new_name return new_name; } function get_short_subdevice_name(from_name) { n=split(from_name, name, "[ ]"); new_name = toupper(name[1]); if(length(name[2])) new_name = sprintf("%s_%s", new_name, toupper(name[2])); if(length(name[3])) new_name = sprintf("%s_%s", new_name, toupper(name[3])); n=split(new_name, name, "[^0-9A-Za-z]"); ssdevice = name[1]; for(i=2;i<=n;i++) ssdevice=sprintf("%s%s%s", ssdevice, length(name[i])?"_":"", name[i]); new_name = ssdevice; sdev_suffix = 2; # check for unique while(new_name in subdevice_names) { new_name = sprintf("%s%u", ssdevice, sdev_suffix) sdev_suffix = sdev_suffix + 1; } # Add new name in array of subdevice names subdevice_names[new_name] = new_name return new_name; } avifile-0.7.48~20090503.ds/drivers/libdha/ports.c0000644000175000017500000001314111167211455020160 0ustar yavoryavor/* (C) 2002 - library implementation by Nick Kyrshev XFree86 3.3.3 scanpci.c, modified for GATOS/win/gfxdump by Øyvind Aabling. */ /* $XConsortium: scanpci.c /main/25 1996/10/27 11:48:40 kaleb $ */ /* * name: scanpci.c * * purpose: This program will scan for and print details of * devices on the PCI bus. * author: Robin Cutshaw (robin@xfree86.org) * * supported O/S's: SVR4, UnixWare, SCO, Solaris, * FreeBSD, NetBSD, 386BSD, BSDI BSD/386, * Linux, Mach/386, ISC * DOS (WATCOM 9.5 compiler) * * compiling: [g]cc scanpci.c -o scanpci * for SVR4 (not Solaris), UnixWare use: * [g]cc -DSVR4 scanpci.c -o scanpci * for DOS, watcom 9.5: * wcc386p -zq -omaxet -7 -4s -s -w3 -d2 name.c * and link with PharLap or other dos extender for exe * */ /* $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ */ /* * Copyright 1995 by Robin Cutshaw * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of the above listed copyright holder(s) * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. The above listed * copyright holder(s) make(s) no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #include #include #include #include #include #include #include #if ARCH_ALPHA #include #endif #include #include "libdha.h" #include "AsmMacros.h" #include "kernelhelper/dhahelper.h" /* OS depended stuff */ #if defined (linux) #include "sysdep/pci_linux.c" #elif defined (__FreeBSD__) #include "sysdep/pci_freebsd.c" #elif defined (__386BSD__) #include "sysdep/pci_386bsd.c" #elif defined (__NetBSD__) #include "sysdep/pci_netbsd.c" #elif defined (__OpenBSD__) #include "sysdep/pci_openbsd.c" #elif defined (__bsdi__) #include "sysdep/pci_bsdi.c" #elif defined (Lynx) #include "sysdep/pci_lynx.c" #elif defined (MACH386) #include "sysdep/pci_mach386.c" #elif defined (__SVR4) #if !defined(SVR4) #define SVR4 #endif #include "sysdep/pci_svr4.c" #elif defined (SCO) #include "sysdep/pci_sco.c" #elif defined (ISC) #include "sysdep/pci_isc.c" #elif defined (__EMX__) #include "sysdep/pci_os2.c" #elif defined (_WIN32) || defined(__CYGWIN__) #include "sysdep/pci_win32.c" #else #include "sysdep/pci_generic_os.c" #endif static int dhahelper_fd=-1; static unsigned dhahelper_counter=0; int enable_app_io( void ) { if((dhahelper_fd=open("/dev/dhahelper",O_RDWR)) < 0) return enable_os_io(); dhahelper_counter++; return 0; } int disable_app_io( void ) { dhahelper_counter--; if(dhahelper_fd > 0) { if(!dhahelper_counter) { close(dhahelper_fd); dhahelper_fd = -1; } } else return disable_os_io(); return 0; } unsigned char INPORT8(unsigned idx) { if (dhahelper_fd > 0) { dhahelper_port_t _port; _port.operation = PORT_OP_READ; _port.addr = idx; _port.size = 1; if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0) return _port.value; } return inb(idx); } unsigned short INPORT16(unsigned idx) { if (dhahelper_fd > 0) { dhahelper_port_t _port; _port.operation = PORT_OP_READ; _port.addr = idx; _port.size = 2; if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0) return _port.value; } return inw(idx); } unsigned INPORT32(unsigned idx) { if (dhahelper_fd > 0) { dhahelper_port_t _port; _port.operation = PORT_OP_READ; _port.addr = idx; _port.size = 4; if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0) return _port.value; } return inl(idx); } void OUTPORT8(unsigned idx,unsigned char val) { if (dhahelper_fd > 0) { dhahelper_port_t _port; _port.operation = PORT_OP_WRITE; _port.addr = idx; _port.size = 1; _port.value = val; if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0) return; } else outb(idx,val); } void OUTPORT16(unsigned idx,unsigned short val) { if (dhahelper_fd > 0) { dhahelper_port_t _port; _port.operation = PORT_OP_WRITE; _port.addr = idx; _port.size = 2; _port.value = val; if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0) return; } else outw(idx,val); } void OUTPORT32(unsigned idx,unsigned val) { if (dhahelper_fd > 0) { dhahelper_port_t _port; _port.operation = PORT_OP_WRITE; _port.addr = idx; _port.size = 4; _port.value = val; if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0) return; } else outl(idx,val); } avifile-0.7.48~20090503.ds/drivers/libdha/test.c0000644000175000017500000000254607622470371020004 0ustar yavoryavor#include "libdha.h" #include "pci_names.h" #include #include #include #include /* for __WORDSIZE */ int main( void ) { pciinfo_t lst[MAX_PCI_DEVICES]; unsigned i,num_pci; int err; err = pci_scan(lst,&num_pci); if(err) { printf("Error occured during pci scan: %s\n",strerror(err)); return EXIT_FAILURE; } else { printf(" Bus:card:func vend:dev base0 :base1 :base2 :baserom :irq:pin:gnt:lat\n"); for(i=0;i 32 printf("%04X:%04X:%04X %04X:%04X %16X:%16X:%16X:%16X:%02X :%02X :%02X :%02X\n" #else printf("%04X:%04X:%04X %04X:%04X %08X:%08X:%08X:%08X:%02X :%02X :%02X :%02X\n" #endif ,lst[i].bus,lst[i].card,lst[i].func ,lst[i].vendor,lst[i].device ,lst[i].base0,lst[i].base1,lst[i].base2,lst[i].baserom ,lst[i].irq,lst[i].ipin,lst[i].gnt,lst[i].lat); printf("Additional info:\n"); printf("================\n"); printf("base3 :base4 :base5 :name (vendor)\n"); for(i=0;i (C) 2002-2003 Nick Kurshev Accessing hardware from userspace as USER (no root needed!) Tested on 2.2.x (2.2.19) and 2.4.x (2.4.3,2.4.17). License: GPL WARNING! THIS MODULE VIOLATES SEVERAL SECURITY LINES! DON'T USE IT ON PRODUCTION SYSTEMS, ONLY AT HOME, ON A "SINGLE-USER" SYSTEM. NO WARRANTY! IF YOU WANT TO USE IT ON PRODUCTION SYSTEMS THEN PLEASE READ 'README' FILE TO KNOW HOW TO PREVENT ANONYMOUS ACCESS TO THIS MODULE. Tech: Communication between userspace and kernelspace goes over character device using ioctl. Usage: mknod -m 666 /dev/dhahelper c 180 0 Also you can change the major number, setting the "dhahelper_major" module parameter, the default is 180, specified in dhahelper.h. Note: do not use other than minor==0, the module forbids it. TODO: * select (request?) a "valid" major number (from Linux project? ;) * make security * is pci handling needed? (libdha does this with lowlevel port funcs) * is mttr handling needed? * test on older kernels (2.0.x (?)) */ #ifndef MODULE #define MODULE #endif #ifndef __KERNEL__ #define __KERNEL__ #endif #include #ifdef CONFIG_MODVERSION #define MODVERSION #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) #include #else #include #endif #include #include #include #include #include #include #include #include #include #ifdef CONFIG_MTRR #include #endif #ifdef CONFIG_DEVFS_FS #include #endif #include "dhahelper.h" #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) #define DEV_MINOR(d) minor(d) #define pte_offset(p,a) pte_offset_kernel(p,a) #define LockPage(p) SetPageLocked(p) #define UnlockPage(p) ClearPageLocked(p) #else #define DEV_MINOR(d) MINOR(d) #endif MODULE_AUTHOR("Alex Beregszaszi , Nick Kurshev , Måns Rullgård "); MODULE_DESCRIPTION("Provides userspace access to hardware"); #ifdef MODULE_LICENSE MODULE_LICENSE("GPL"); #endif static int dhahelper_major = DEFAULT_MAJOR; MODULE_PARM(dhahelper_major, "i"); MODULE_PARM_DESC(dhahelper_major, "Major number of dhahelper characterdevice"); /* 0 = silent */ /* 1 = report errors (default) */ /* 2 = debug */ static int dhahelper_verbosity = 1; MODULE_PARM(dhahelper_verbosity, "i"); MODULE_PARM_DESC(dhahelper_verbosity, "Level of verbosity (0 = silent, 1 = only errors, 2 = debug)"); static int dhahelper_open(struct inode *inode, struct file *file) { if (dhahelper_verbosity > 1) printk(KERN_DEBUG "dhahelper: device opened\n"); if (DEV_MINOR(inode->i_rdev) != 0) return -ENXIO; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) MOD_INC_USE_COUNT; #endif return 0; } static int dhahelper_release(struct inode *inode, struct file *file) { if (dhahelper_verbosity > 1) printk(KERN_DEBUG "dhahelper: device released\n"); if (DEV_MINOR(inode->i_rdev) != 0) return -ENXIO; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) MOD_DEC_USE_COUNT; #endif return 0; } static int dhahelper_get_version(int * arg) { int version = API_VERSION; if (copy_to_user(arg, &version, sizeof(int))) { if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: failed copy to userspace\n"); return -EFAULT; } return 0; } static int dhahelper_port(dhahelper_port_t * arg) { dhahelper_port_t port; if (copy_from_user(&port, arg, sizeof(dhahelper_port_t))) { if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: failed copy from userspace\n"); return -EFAULT; } switch(port.operation) { case PORT_OP_READ: { switch(port.size) { case 1: port.value = inb(port.addr); break; case 2: port.value = inw(port.addr); break; case 4: port.value = inl(port.addr); break; default: if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: invalid port read size (%d)\n", port.size); return -EINVAL; } break; } case PORT_OP_WRITE: { switch(port.size) { case 1: outb(port.value, port.addr); break; case 2: outw(port.value, port.addr); break; case 4: outl(port.value, port.addr); break; default: if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: invalid port write size (%d)\n", port.size); return -EINVAL; } break; } default: if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: invalid port operation (%d)\n", port.operation); return -EINVAL; } /* copy back only if read was performed */ if (port.operation == PORT_OP_READ) if (copy_to_user(arg, &port, sizeof(dhahelper_port_t))) { if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: failed copy to userspace\n"); return -EFAULT; } return 0; } /*******************************/ /* Memory management functions */ /* from kernel:/drivers/media/video/bttv-driver.c */ /*******************************/ #define MDEBUG(x) do { } while(0) /* Debug memory management */ /* [DaveM] I've recoded most of this so that: * 1) It's easier to tell what is happening * 2) It's more portable, especially for translating things * out of vmalloc mapped areas in the kernel. * 3) Less unnecessary translations happen. * * The code used to assume that the kernel vmalloc mappings * existed in the page tables of every process, this is simply * not guarenteed. We now use pgd_offset_k which is the * defined way to get at the kernel page tables. */ /* Given PGD from the address space's page table, return the kernel * virtual mapping of the physical memory mapped at ADR. */ static inline unsigned long uvirt_to_kva(pgd_t *pgd, unsigned long adr) { unsigned long ret = 0UL; pmd_t *pmd; pte_t *ptep, pte; if (!pgd_none(*pgd)) { pmd = pmd_offset(pgd, adr); if (!pmd_none(*pmd)) { ptep = pte_offset(pmd, adr); pte = *ptep; if(pte_present(pte)) { ret = (unsigned long) page_address(pte_page(pte)); ret |= (adr & (PAGE_SIZE - 1)); } } } MDEBUG(printk("uv2kva(%lx-->%lx)", adr, ret)); return ret; } static inline unsigned long uvirt_to_bus(unsigned long adr) { unsigned long kva, ret; kva = uvirt_to_kva(pgd_offset(current->mm, adr), adr); ret = virt_to_bus((void *)kva); MDEBUG(printk("uv2b(%lx-->%lx)", adr, ret)); return ret; } static inline unsigned long uvirt_to_pa(unsigned long adr) { unsigned long kva, ret; kva = uvirt_to_kva(pgd_offset(current->mm, adr), adr); ret = virt_to_phys((void *)kva); MDEBUG(printk("uv2b(%lx-->%lx)", adr, ret)); return ret; } static inline unsigned long kvirt_to_bus(unsigned long adr) { unsigned long va, kva, ret; va = VMALLOC_VMADDR(adr); kva = uvirt_to_kva(pgd_offset_k(va), va); ret = virt_to_bus((void *)kva); MDEBUG(printk("kv2b(%lx-->%lx)", adr, ret)); return ret; } /* Here we want the physical address of the memory. * This is used when initializing the contents of the * area and marking the pages as reserved. */ static inline unsigned long kvirt_to_pa(unsigned long adr) { unsigned long va, kva, ret; va = VMALLOC_VMADDR(adr); kva = uvirt_to_kva(pgd_offset_k(va), va); ret = __pa(kva); MDEBUG(printk("kv2pa(%lx-->%lx)", adr, ret)); return ret; } static void * rvmalloc(signed long size) { void * mem; unsigned long adr, page; mem=vmalloc_32(size); if (mem) { memset(mem, 0, size); /* Clear the ram out, no junk to the user */ adr=(unsigned long) mem; while (size > 0) { page = kvirt_to_pa(adr); mem_map_reserve(virt_to_page(__va(page))); adr+=PAGE_SIZE; size-=PAGE_SIZE; } } return mem; } static int pag_lock(unsigned long addr) { unsigned long page; unsigned long kva; kva = uvirt_to_kva(pgd_offset(current->mm, addr), addr); if(kva) { lock_it: page = uvirt_to_pa((unsigned long)addr); LockPage(virt_to_page(__va(page))); SetPageReserved(virt_to_page(__va(page))); } else { copy_from_user(&page,(char *)addr,1); /* try access it */ kva = uvirt_to_kva(pgd_offset(current->mm, addr), addr); if(kva) goto lock_it; else return EPERM; } return 0; } static int pag_unlock(unsigned long addr) { unsigned long page; unsigned long kva; kva = uvirt_to_kva(pgd_offset(current->mm, addr), addr); if(kva) { page = uvirt_to_pa((unsigned long)addr); UnlockPage(virt_to_page(__va(page))); ClearPageReserved(virt_to_page(__va(page))); return 0; } return EPERM; } static void rvfree(void * mem, signed long size) { unsigned long adr, page; if (mem) { adr=(unsigned long) mem; while (size > 0) { page = kvirt_to_pa(adr); mem_map_unreserve(virt_to_page(__va(page))); adr+=PAGE_SIZE; size-=PAGE_SIZE; } vfree(mem); } } static int dhahelper_virt_to_phys(dhahelper_vmi_t *arg) { dhahelper_vmi_t mem; unsigned long i,nitems; char *addr; if (copy_from_user(&mem, arg, sizeof(dhahelper_vmi_t))) { if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: failed copy from userspace\n"); return -EFAULT; } nitems = mem.length / PAGE_SIZE; if(mem.length % PAGE_SIZE) nitems++; addr = mem.virtaddr; for(i=0;i 0) printk(KERN_ERR "dhahelper: failed copy to userspace\n"); return -EFAULT; } addr += PAGE_SIZE; } return 0; } static int dhahelper_virt_to_bus(dhahelper_vmi_t *arg) { dhahelper_vmi_t mem; unsigned long i,nitems; char *addr; if (copy_from_user(&mem, arg, sizeof(dhahelper_vmi_t))) { if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: failed copy from userspace\n"); return -EFAULT; } nitems = mem.length / PAGE_SIZE; if(mem.length % PAGE_SIZE) nitems++; addr = mem.virtaddr; for(i=0;i 0) printk(KERN_ERR "dhahelper: failed copy to userspace\n"); return -EFAULT; } addr += PAGE_SIZE; } return 0; } static int dhahelper_alloc_pa(dhahelper_mem_t *arg) { dhahelper_mem_t mem; if (copy_from_user(&mem, arg, sizeof(dhahelper_mem_t))) { if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: failed copy from userspace\n"); return -EFAULT; } mem.addr = rvmalloc(mem.length); if (copy_to_user(arg, &mem, sizeof(dhahelper_mem_t))) { if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: failed copy to userspace\n"); return -EFAULT; } return 0; } static int dhahelper_free_pa(dhahelper_mem_t *arg) { dhahelper_mem_t mem; if (copy_from_user(&mem, arg, sizeof(dhahelper_mem_t))) { if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: failed copy from userspace\n"); return -EFAULT; } rvfree(mem.addr,mem.length); return 0; } static int dhahelper_lock_mem(dhahelper_mem_t *arg) { dhahelper_mem_t mem; int retval; unsigned long i,nitems,addr; if (copy_from_user(&mem, arg, sizeof(dhahelper_mem_t))) { if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: failed copy from userspace\n"); return -EFAULT; } nitems = mem.length / PAGE_SIZE; if(mem.length % PAGE_SIZE) nitems++; addr = (unsigned long)mem.addr; for(i=0;i 0) printk(KERN_ERR "dhahelper: failed copy from userspace\n"); return -EFAULT; } nitems = mem.length / PAGE_SIZE; if(mem.length % PAGE_SIZE) nitems++; addr = (unsigned long)mem.addr; for(i=0;i 0) printk(KERN_ERR "dhahelper: failed copy from userspace\n"); return -EFAULT; } if(!(pci = pci_find_slot(my_irq.bus, PCI_DEVFN(my_irq.dev, my_irq.func)))) return -EINVAL; rlen = pci_resource_len(pci, my_irq.ack_region); if(my_irq.ack_offset > rlen - 4) return -EINVAL; irqn = pci->irq; spin_lock_irqsave(&dha_irqs[irqn].lock, dha_irqs[irqn].flags); if(dha_irqs[irqn].handled){ retval = -EBUSY; goto fail; } if(my_irq.ack_region >= 0){ ack_addr = pci_resource_start(pci, my_irq.ack_region); ack_addr += my_irq.ack_offset; #ifdef CONFIG_ALPHA ack_addr += ((struct pci_controller *) pci->sysdata)->dense_mem_base; #endif /* FIXME: Other architectures */ dha_irqs[irqn].ack_addr = phys_to_virt(ack_addr); dha_irqs[irqn].ack_data = my_irq.ack_data; } else { dha_irqs[irqn].ack_addr = 0; } dha_irqs[irqn].lock = SPIN_LOCK_UNLOCKED; dha_irqs[irqn].flags = 0; dha_irqs[irqn].rcvd = 0; dha_irqs[irqn].dev = pci; init_waitqueue_head(&dha_irqs[irqn].wait); dha_irqs[irqn].count = 0; retval = request_irq(irqn, dhahelper_irq_handler, SA_SHIRQ, "dhahelper", pci); if(retval < 0) goto fail; copy_to_user(&arg->num, &irqn, sizeof(irqn)); dha_irqs[irqn].handled = 1; out: spin_unlock_irqrestore(&dha_irqs[irqn].lock, dha_irqs[irqn].flags); return retval; fail: if(retval == -EINVAL){ printk("dhahelper: bad irq number or handler\n"); } else if(retval == -EBUSY){ printk("dhahelper: IRQ %u busy\n", irqn); } else { printk("dhahelper: Could not install irq handler...\n"); } printk("dhahelper: Perhaps you need to let your BIOS assign an IRQ to your video card\n"); goto out; } static int dhahelper_free_irq(dhahelper_irq_t *arg) { dhahelper_irq_t irq; struct pci_dev *pci; int irqn; if (copy_from_user(&irq, arg, sizeof(dhahelper_irq_t))) { if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: failed copy from userspace\n"); return -EFAULT; } pci = pci_find_slot(irq.bus, PCI_DEVFN(irq.dev, irq.func)); if(!pci) return -EINVAL; irqn = pci->irq; spin_lock_irqsave(&dha_irqs[irqn].lock, dha_irqs[irqn].flags); if(dha_irqs[irqn].handled) { free_irq(irqn, pci); dha_irqs[irqn].handled = 0; printk("IRQ %i: %li\n", irqn, dha_irqs[irqn].count); } spin_unlock_irqrestore(&dha_irqs[irqn].lock, dha_irqs[irqn].flags); return 0; } static int dhahelper_ack_irq(dhahelper_irq_t *arg) { dhahelper_irq_t irq; int retval = 0; DECLARE_WAITQUEUE(wait, current); if (copy_from_user(&irq, arg, sizeof(dhahelper_irq_t))) { if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: failed copy from userspace\n"); return -EFAULT; } if(irq.num > 255) return -EINVAL; if(!dha_irqs[irq.num].handled) return -ESRCH; add_wait_queue(&dha_irqs[irq.num].wait, &wait); set_current_state(TASK_INTERRUPTIBLE); for(;;){ int r; spin_lock_irqsave(&dha_irqs[irq.num].lock, dha_irqs[irq.num].flags); r = dha_irqs[irq.num].rcvd; spin_unlock_irqrestore(&dha_irqs[irq.num].lock, dha_irqs[irq.num].flags); if(r){ dha_irqs[irq.num].rcvd = 0; break; } if(signal_pending(current)){ retval = -ERESTARTSYS; break; } schedule(); } set_current_state(TASK_RUNNING); remove_wait_queue(&dha_irqs[irq.num].wait, &wait); return retval; } static int dhahelper_cpu_flush(dhahelper_cpu_flush_t *arg) { dhahelper_cpu_flush_t my_l2; if (copy_from_user(&my_l2, arg, sizeof(dhahelper_cpu_flush_t))) { if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: failed copy from userspace\n"); return -EFAULT; } #if defined(__i386__) /* WBINVD writes all modified cache lines back to main memory */ if(boot_cpu_data.x86 > 3) { __asm __volatile("wbinvd":::"memory"); } #else /* FIXME!!!*/ mb(); /* declared in "asm/system.h" */ #endif return 0; } static struct pci_dev *pdev = NULL; static int dhahelper_pci_find(dhahelper_pci_device_t *arg) { dhahelper_pci_device_t this_dev; pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev); if(pdev) { this_dev.bus = pdev->bus->number; this_dev.card = PCI_SLOT(pdev->devfn); this_dev.func = PCI_FUNC(pdev->devfn); this_dev.vendor = pdev->vendor; this_dev.device = pdev->device; this_dev.base0 = pci_resource_start (pdev, 0); this_dev.base1 = pci_resource_start (pdev, 1); this_dev.base2 = pci_resource_start (pdev, 2); pci_read_config_dword(pdev, pdev->rom_base_reg, (u32*)&this_dev.baserom); this_dev.base3 = pci_resource_start (pdev, 3); this_dev.base4 = pci_resource_start (pdev, 4); this_dev.base5 = pci_resource_start (pdev, 5); pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &this_dev.irq); pci_read_config_byte(pdev, PCI_INTERRUPT_PIN, &this_dev.ipin); pci_read_config_byte(pdev, PCI_MIN_GNT, &this_dev.gnt); pci_read_config_byte(pdev, PCI_MAX_LAT, &this_dev.lat); } else memset(&this_dev,0,sizeof(dhahelper_pci_device_t)); if (copy_to_user(arg, &this_dev, sizeof(dhahelper_pci_device_t))) { if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: failed copy to userspace\n"); return -EFAULT; } return pdev?0:-ENODATA; } static int dhahelper_pci_config(dhahelper_pci_config_t *arg) { dhahelper_pci_config_t op; struct pci_dev *pdev; if (copy_from_user(&op, arg, sizeof(dhahelper_pci_config_t))) { if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: failed copy from userspace\n"); return -EFAULT; } pdev = pci_find_slot(op.bus,PCI_DEVFN(op.dev,op.func)); if(!pdev) { if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: can't identify device\n"); return -EFAULT; } switch(op.operation) { case PCI_OP_READ: switch(op.size) { case 1: pci_read_config_byte(pdev,op.cmd,(u8*)&op.ret); break; case 2: pci_read_config_word(pdev,op.cmd,(u16*)&op.ret); break; case 4: pci_read_config_dword(pdev,op.cmd,(u32*)&op.ret); break; default: if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: wrong size of pci operation: %u \n",op.size); return -EFAULT; } case PCI_OP_WRITE: switch(op.size) { case 1: pci_write_config_byte(pdev,op.cmd,op.ret); break; case 2: pci_write_config_word(pdev,op.cmd,op.ret); break; case 4: pci_write_config_dword(pdev,op.cmd,op.ret); break; default: if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: wrong size of pci operation: %u \n",op.size); return -EFAULT; } default: if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: unknown pci operation %i\n",op.operation); return -EFAULT; } if (copy_to_user(arg, &op, sizeof(dhahelper_pci_device_t))) { if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: failed copy to userspace\n"); return -EFAULT; } return 0; } static int dhahelper_mtrr(dhahelper_mtrr_t *arg) { #ifdef CONFIG_MTRR dhahelper_mtrr_t op; if (copy_from_user(&op, arg, sizeof(dhahelper_pci_config_t))) { if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: failed copy from userspace\n"); return -EFAULT; } switch(op.operation) { case MTRR_OP_ADD: op.privat = mtrr_add (op.start,op.size,op.type,1); break; case MTRR_OP_DEL: mtrr_del(op.privat, op.start, op.size); break; default: if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: unknown mtrr operation %i\n",op.operation); return -EFAULT; } if (copy_to_user(arg, &op, sizeof(dhahelper_mtrr_t))) { if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: failed copy to userspace\n"); return -EFAULT; } #endif return 0; } static int dhahelper_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { if (dhahelper_verbosity > 1) printk(KERN_DEBUG "dhahelper: ioctl(cmd=%x, arg=%lx)\n", cmd, arg); if (DEV_MINOR(inode->i_rdev) != 0) return -ENXIO; switch(cmd) { case DHAHELPER_GET_VERSION: return dhahelper_get_version((int *)arg); case DHAHELPER_PORT: return dhahelper_port((dhahelper_port_t *)arg); case DHAHELPER_MTRR: return dhahelper_mtrr((dhahelper_mtrr_t *)arg); case DHAHELPER_PCI_CONFIG: return dhahelper_pci_config((dhahelper_pci_config_t *)arg); case DHAHELPER_VIRT_TO_PHYS:return dhahelper_virt_to_phys((dhahelper_vmi_t *)arg); case DHAHELPER_VIRT_TO_BUS: return dhahelper_virt_to_bus((dhahelper_vmi_t *)arg); case DHAHELPER_ALLOC_PA:return dhahelper_alloc_pa((dhahelper_mem_t *)arg); case DHAHELPER_FREE_PA: return dhahelper_free_pa((dhahelper_mem_t *)arg); case DHAHELPER_LOCK_MEM: return dhahelper_lock_mem((dhahelper_mem_t *)arg); case DHAHELPER_UNLOCK_MEM: return dhahelper_unlock_mem((dhahelper_mem_t *)arg); case DHAHELPER_INSTALL_IRQ: return dhahelper_install_irq((dhahelper_irq_t *)arg); case DHAHELPER_ACK_IRQ: return dhahelper_ack_irq((dhahelper_irq_t *)arg); case DHAHELPER_FREE_IRQ: return dhahelper_free_irq((dhahelper_irq_t *)arg); case DHAHELPER_CPU_FLUSH: return dhahelper_cpu_flush((dhahelper_cpu_flush_t *)arg); case DHAHELPER_PCI_FIND: return dhahelper_pci_find((dhahelper_pci_device_t *)arg); default: if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: invalid ioctl (%x)\n", cmd); return -EINVAL; } return 0; } /* fops functions were shamelessly stolen from linux-kernel project ;) */ static loff_t dhahelper_lseek(struct file * file, loff_t offset, int orig) { switch (orig) { case 0: file->f_pos = offset; return file->f_pos; case 1: file->f_pos += offset; return file->f_pos; default: return -EINVAL; } } /* * This funcion reads the *physical* memory. The f_pos points directly to the * memory location. */ static ssize_t dhahelper_read(struct file * file, char * buf, size_t count, loff_t *ppos) { unsigned long p = *ppos; unsigned long end_mem; ssize_t read; end_mem = __pa(high_memory); if (p >= end_mem) return 0; if (count > end_mem - p) count = end_mem - p; read = 0; #if defined(__sparc__) || defined(__mc68000__) /* we don't have page 0 mapped on sparc and m68k.. */ if (p < PAGE_SIZE) { unsigned long sz = PAGE_SIZE-p; if (sz > count) sz = count; if (sz > 0) { if (clear_user(buf, sz)) return -EFAULT; buf += sz; p += sz; count -= sz; read += sz; } } #endif if (copy_to_user(buf, __va(p), count)) return -EFAULT; read += count; *ppos += read; return read; } static ssize_t do_write_mem(struct file * file, void *p, unsigned long realp, const char * buf, size_t count, loff_t *ppos) { ssize_t written; written = 0; #if defined(__sparc__) || defined(__mc68000__) /* we don't have page 0 mapped on sparc and m68k.. */ if (realp < PAGE_SIZE) { unsigned long sz = PAGE_SIZE-realp; if (sz > count) sz = count; /* Hmm. Do something? */ buf+=sz; p+=sz; count-=sz; written+=sz; } #endif if (copy_from_user(p, buf, count)) return -EFAULT; written += count; *ppos += written; return written; } static ssize_t dhahelper_write(struct file * file, const char * buf, size_t count, loff_t *ppos) { unsigned long p = *ppos; unsigned long end_mem; end_mem = __pa(high_memory); if (p >= end_mem) return 0; if (count > end_mem - p) count = end_mem - p; return do_write_mem(file, __va(p), p, buf, count, ppos); } #ifndef pgprot_noncached /* * This should probably be per-architecture in */ static inline pgprot_t pgprot_noncached(pgprot_t _prot) { unsigned long prot = pgprot_val(_prot); #if defined(__i386__) || defined(__x86_64__) /* On PPro and successors, PCD alone doesn't always mean uncached because of interactions with the MTRRs. PCD | PWT means definitely uncached. */ if (boot_cpu_data.x86 > 3) prot |= _PAGE_PCD | _PAGE_PWT; #elif defined(__powerpc__) prot |= _PAGE_NO_CACHE | _PAGE_GUARDED; #elif defined(__mc68000__) #ifdef SUN3_PAGE_NOCACHE if (MMU_IS_SUN3) prot |= SUN3_PAGE_NOCACHE; else #endif if (MMU_IS_851 || MMU_IS_030) prot |= _PAGE_NOCACHE030; /* Use no-cache mode, serialized */ else if (MMU_IS_040 || MMU_IS_060) prot = (prot & _CACHEMASK040) | _PAGE_NOCACHE_S; #endif return __pgprot(prot); } #endif /* !pgprot_noncached */ /* * Architectures vary in how they handle caching for addresses * outside of main memory. */ static inline int noncached_address(unsigned long addr) { #if defined(__i386__) /* * On the PPro and successors, the MTRRs are used to set * memory types for physical addresses outside main memory, * so blindly setting PCD or PWT on those pages is wrong. * For Pentiums and earlier, the surround logic should disable * caching for the high addresses through the KEN pin, but * we maintain the tradition of paranoia in this code. */ return !( test_bit(X86_FEATURE_MTRR, &boot_cpu_data.x86_capability) || test_bit(X86_FEATURE_K6_MTRR, &boot_cpu_data.x86_capability) || test_bit(X86_FEATURE_CYRIX_ARR, &boot_cpu_data.x86_capability) || test_bit(X86_FEATURE_CENTAUR_MCR, &boot_cpu_data.x86_capability) ) && addr >= __pa(high_memory); #else return addr >= __pa(high_memory); #endif } static int dhahelper_mmap(struct file * file, struct vm_area_struct * vma) { unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; int err; /* * Accessing memory above the top the kernel knows about or * through a file pointer that was marked O_SYNC will be * done non-cached. */ if (noncached_address(offset) || (file->f_flags & O_SYNC)) vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); /* Don't try to swap out physical pages.. */ vma->vm_flags |= VM_RESERVED; /* * Don't dump addresses that are not real memory to a core file. */ if (offset >= __pa(high_memory) || (file->f_flags & O_SYNC)) vma->vm_flags |= VM_IO; #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) err = remap_page_range(vma, vma->vm_start, offset, vma->vm_end-vma->vm_start, vma->vm_page_prot); #else err = remap_page_range(vma->vm_start, offset, vma->vm_end-vma->vm_start, vma->vm_page_prot); #endif if(err) return -EAGAIN; return 0; } #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) static struct file_operations dhahelper_fops = { /*llseek*/ dhahelper_lseek, /*read*/ dhahelper_read, /*write*/ dhahelper_write, /*readdir*/ NULL, /*poll*/ NULL, /*ioctl*/ dhahelper_ioctl, /*mmap*/ dhahelper_mmap, /*open*/ dhahelper_open, /*flush*/ NULL, /*release*/ dhahelper_release, /* zero out the last 5 entries too ? */ }; #else static struct file_operations dhahelper_fops = { owner: THIS_MODULE, ioctl: dhahelper_ioctl, open: dhahelper_open, release: dhahelper_release, llseek: dhahelper_lseek, read: dhahelper_read, write: dhahelper_write, mmap: dhahelper_mmap, }; #endif #ifdef CONFIG_DEVFS_FS devfs_handle_t dha_devfsh; #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) int init_module(void) #else static int __init init_dhahelper(void) #endif { int err = 0; printk(KERN_INFO "Direct Hardware Access kernel helper (C) Alex Beregszaszi\n"); #ifdef CONFIG_DEVFS_FS dha_devfsh = devfs_register(NULL, "dhahelper", DEVFS_FL_NONE, dhahelper_major, 0, S_IFCHR | S_IRUSR | S_IWUSR, &dhahelper_fops, NULL); if(!dha_devfsh){ err = -EIO; } #else if(register_chrdev(dhahelper_major, "dhahelper", &dhahelper_fops)) { err = -EIO; } #endif if(err){ if (dhahelper_verbosity > 0) printk(KERN_ERR "dhahelper: unable to register character device (major: %d)\n", dhahelper_major); return err; } memset(dha_irqs, 0, sizeof(dha_irqs)); return 0; } #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) void cleanup_module(void) #else static void __exit exit_dhahelper(void) #endif { unsigned i; for(i=0;i<256;i++) if(dha_irqs[i].handled) free_irq(i, dha_irqs[i].dev); #ifdef CONFIG_DEVFS_FS devfs_unregister(dha_devfsh); #else unregister_chrdev(dhahelper_major, "dhahelper"); #endif } #ifdef EXPORT_NO_SYMBOLS EXPORT_NO_SYMBOLS; #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) module_init(init_dhahelper); module_exit(exit_dhahelper); #endif avifile-0.7.48~20090503.ds/drivers/libdha/kernelhelper/dhahelper.h0000644000175000017500000000533607622470372023447 0ustar yavoryavor/* Direct Hardware Access kernel helper (C) 2002 Alex Beregszaszi (C) 2002-2003 Nick Kurshev */ #ifndef DHAHELPER_H #define DHAHELPER_H #include /* feel free to change */ #define DEFAULT_MAJOR 252 /* 240-254 LOCAL/EXPERIMENTAL USE */ #define API_VERSION 0x30 /* 3.0*/ typedef struct dhahelper_port_s { #define PORT_OP_READ 1 #define PORT_OP_WRITE 2 int operation; int size; int addr; // FIXME - switch to void* (64bit) int value; } dhahelper_port_t; typedef struct dhahelper_mtrr_s { #define MTRR_OP_ADD 1 #define MTRR_OP_DEL 2 int operation; long start; long size; int type; int privat; } dhahelper_mtrr_t; typedef struct dhahelper_pci_config_s { #define PCI_OP_READ 0 #define PCI_OP_WRITE 1 int operation; int bus; int dev; int func; int cmd; int size; long ret; } dhahelper_pci_config_t; typedef struct dhahelper_vmi_s { void * virtaddr; unsigned long length; unsigned long *realaddr; }dhahelper_vmi_t; typedef struct dhahelper_mem_s { void * addr; unsigned long length; }dhahelper_mem_t; typedef struct dhahelper_irq_s { unsigned num; int bus, dev, func; int ack_region; unsigned long ack_offset; unsigned int ack_data; }dhahelper_irq_t; typedef struct dhahelper_cpu_flush_s { void *va; unsigned long length; }dhahelper_cpu_flush_t; typedef struct dhahelper_pci_device_s { int bus,card,func; /* PCI/AGP bus:card:func */ unsigned short vendor,device; /* Card vendor+device ID */ unsigned long base0,base1,base2,baserom; /* Memory and I/O base addresses */ unsigned long base3,base4,base5; /* Memory and I/O base addresses */ unsigned char irq,ipin,gnt,lat; /* assigned IRQ parameters for this card */ }dhahelper_pci_device_t; #define DHAHELPER_GET_VERSION _IOW('D', 0, int) #define DHAHELPER_PORT _IOWR('D', 1, dhahelper_port_t) #define DHAHELPER_MTRR _IOWR('D', 2, dhahelper_mtrr_t) #define DHAHELPER_PCI_CONFIG _IOWR('D', 3, dhahelper_pci_config_t) #define DHAHELPER_VIRT_TO_PHYS _IOWR('D', 4, dhahelper_vmi_t) #define DHAHELPER_VIRT_TO_BUS _IOWR('D', 5, dhahelper_vmi_t) #define DHAHELPER_ALLOC_PA _IOWR('D', 6, dhahelper_mem_t) #define DHAHELPER_FREE_PA _IOWR('D', 7, dhahelper_mem_t) #define DHAHELPER_LOCK_MEM _IOWR('D', 8, dhahelper_mem_t) #define DHAHELPER_UNLOCK_MEM _IOWR('D', 9, dhahelper_mem_t) #define DHAHELPER_INSTALL_IRQ _IOWR('D', 10, dhahelper_irq_t) #define DHAHELPER_ACK_IRQ _IOWR('D', 11, dhahelper_irq_t) #define DHAHELPER_FREE_IRQ _IOWR('D', 12, dhahelper_irq_t) #define DHAHELPER_CPU_FLUSH _IOWR('D', 13, dhahelper_cpu_flush_t) #define DHAHELPER_PCI_FIND _IOWR('D', 14, dhahelper_pci_device_t) #endif /* DHAHELPER_H */ avifile-0.7.48~20090503.ds/drivers/libdha/kernelhelper/test.c0000644000175000017500000000135607532424711022457 0ustar yavoryavor#include #include #include #include #include #include #include #include "dhahelper.h" int main(int argc, char *argv[]) { int fd; int ret; fd = open("/dev/dhahelper", O_RDWR); ioctl(fd, DHAHELPER_GET_VERSION, &ret); printf("api version: %d\n", ret); if (ret != API_VERSION) printf("incompatible api!\n"); { void *mem; unsigned long size=256; mem = mmap(0,size,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0); printf("allocated to %p\n", mem); if (argc > 1) if (mem != 0) { int i; for (i = 0; i < 256; i++) printf("[%x] ", *(int *)(mem+i)); printf("\n"); } munmap((void *)mem, size); } return(0); } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/0000755000175000017500000000000011267637134020163 5ustar yavoryavoravifile-0.7.48~20090503.ds/drivers/libdha/sysdep/AsmMacros_alpha.h0000644000175000017500000000127507532424711023366 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 2001/11/16 21:13:34 tsi Exp $ Modified for readability by Nick Kurshev */ #ifndef __ASM_MACROS_ALPHA_H #define __ASM_MACROS_ALPHA_H #if defined (linux) #include #elif defined (__FreeBSD__) #include extern void outb(u_int32_t port, u_int8_t val); extern void outw(u_int32_t port, u_int16_t val); extern void outl(u_int32_t port, u_int32_t val); extern u_int8_t inb(u_int32_t port); extern u_int16_t inw(u_int32_t port); extern u_int32_t inl(u_int32_t port); #else #include "sysdep/AsmMacros_generic.h" #endif #define intr_disable() #define intr_enable() #endif avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/AsmMacros_arm32.h0000644000175000017500000000264207532424711023224 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 2001/11/16 21:13:34 tsi Exp $ Modified for readability by Nick Kurshev */ #ifndef __ASM_MACROS_ARM32_H #define __ASM_MACROS_ARM32_H unsigned int IOPortBase; /* Memory mapped I/O port area */ static __inline__ void outb(short port,char val) { if ((unsigned short)port >= 0x400) return; *(volatile unsigned char*)(((unsigned short)(port))+IOPortBase) = val; } static __inline__ void outw(short port,short val) { if ((unsigned short)port >= 0x400) return; *(volatile unsigned short*)(((unsigned short)(port))+IOPortBase) = val; } static __inline__ void outl(short port,int val) { if ((unsigned short)port >= 0x400) return; *(volatile unsigned long*)(((unsigned short)(port))+IOPortBase) = val; } static __inline__ unsigned int inb(short port) { if ((unsigned short)port >= 0x400) return((unsigned int)-1); return(*(volatile unsigned char*)(((unsigned short)(port))+IOPortBase)); } static __inline__ unsigned int inw(short port) { if ((unsigned short)port >= 0x400) return((unsigned int)-1); return(*(volatile unsigned short*)(((unsigned short)(port))+IOPortBase)); } static __inline__ unsigned int inl(short port) { if ((unsigned short)port >= 0x400) return((unsigned int)-1); return(*(volatile unsigned long*)(((unsigned short)(port))+IOPortBase)); } #define intr_disable() #define intr_enable() #endif avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/AsmMacros_generic.h0000644000175000017500000000203107532424711023704 0ustar yavoryavor/* Generic stuff to compile VIDIX only on any system (SCRATCH) */ #ifndef __ASM_MACROS_GENERIC_H #define __ASM_MACROS_GENERIC_H #warn This stuff is not ported on yur system static __inline__ void outb(short port,char val) { printf("outb: generic function call\n"); return; } static __inline__ void outw(short port,short val) { printf("outw: generic function call\n"); return; } static __inline__ void outl(short port,unsigned int val) { printf("outl: generic function call\n"); return; } static __inline__ unsigned int inb(short port) { printf("inb: generic function call\n"); return 0; } static __inline__ unsigned int inw(short port) { printf("inw: generic function call\n"); return 0; } static __inline__ unsigned int inl(short port) { printf("inl: generic function call\n"); return 0; } static __inline__ void intr_disable() { printf("intr_disable: generic function call\n"); } static __inline__ void intr_enable() { printf("intr_enable: generic function call\n"); } #endif avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/AsmMacros_ia64.h0000644000175000017500000000052707532424711023043 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 2001/11/16 21:13:34 tsi Exp $ Modified for readability by Nick Kurshev */ #ifndef __ASM_MACROS_IA64_H #define __ASM_MACROS_IA64_H #if defined(linux) #include #else #include "sysdep/AsmMacros_generic.h" #endif #endif avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/AsmMacros_powerpc.h0000644000175000017500000000247007651314612023756 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 2001/11/16 21:13:34 tsi Exp $ Modified for readability by Nick Kurshev */ #ifndef __ASM_MACROS_POWERPC_H #define __ASM_MACROS_POWERPC_H #if defined(Lynx) || defined(__OpenBSD__) extern unsigned char *ioBase; static __inline__ volatile void eieio() { __asm__ __volatile__ ("eieio"); } static __inline__ void outb(short port, unsigned char value) { *(unsigned char *)(ioBase + port) = value; eieio(); } static __inline__ void outw(short port, unsigned short value) { *(unsigned short *)(ioBase + port) = value; eieio(); } static __inline__ void outl(short port, unsigned short value) { *(unsigned long *)(ioBase + port) = value; eieio(); } static __inline__ unsigned char inb(short port) { unsigned char val; val = *((unsigned char *)(ioBase + port)); eieio(); return(val); } static __inline__ unsigned short inw(short port) { unsigned short val; val = *((unsigned short *)(ioBase + port)); eieio(); return(val); } static __inline__ unsigned long inl(short port) { unsigned long val; val = *((unsigned long *)(ioBase + port)); eieio(); return(val); } #define intr_disable() #define intr_enable() #else #ifdef linux /*nothing*/ #else #include "sysdep/AsmMacros_generic.h" #endif #endif #endif avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/AsmMacros_sparc.h0000644000175000017500000000246207532424711023410 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 2001/11/16 21:13:34 tsi Exp $ Modified for readability by Nick Kurshev */ #ifndef __ASM_MACROS_SPARC_H #define __ASM_MACROS_SPARC_H #ifndef ASI_PL #define ASI_PL 0x88 #endif static __inline__ void outb(unsigned long port, char val) { __asm__ __volatile__("stba %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL)); } static __inline__ void outw(unsigned long port, char val) { __asm__ __volatile__("stha %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL)); } static __inline__ void outl(unsigned long port, char val) { __asm__ __volatile__("sta %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL)); } static __inline__ unsigned int inb(unsigned long port) { unsigned char ret; __asm__ __volatile__("lduba [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL)); return ret; } static __inline__ unsigned int inw(unsigned long port) { unsigned char ret; __asm__ __volatile__("lduha [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL)); return ret; } static __inline__ unsigned int inl(unsigned long port) { unsigned char ret; __asm__ __volatile__("lda [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL)); return ret; } #define intr_disable() #define intr_enable() #endif avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/AsmMacros_x86.h0000644000175000017500000000255607532424711022731 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 2001/11/16 21:13:34 tsi Exp $ Modified for readability by Nick Kurshev */ #ifndef __ASM_MACROS_X86_H #define __ASM_MACROS_X86_H #if defined (WINNT) #include "sysdep/AsmMacros_generic.h" #else #include "config.h" static __inline__ void outb(short port,char val) { __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port)); return; } static __inline__ void outw(short port,short val) { __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port)); return; } static __inline__ void outl(short port,unsigned int val) { __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port)); return; } static __inline__ unsigned int inb(short port) { unsigned char ret; __asm__ __volatile__("inb %1,%0" : "=a" (ret) : "d" (port)); return ret; } static __inline__ unsigned int inw(short port) { unsigned short ret; __asm__ __volatile__("inw %1,%0" : "=a" (ret) : "d" (port)); return ret; } static __inline__ unsigned int inl(short port) { unsigned int ret; __asm__ __volatile__("inl %1,%0" : "=a" (ret) : "d" (port)); return ret; } static __inline__ void intr_disable() { __asm__ __volatile__("cli"); } static __inline__ void intr_enable() { __asm__ __volatile__("sti"); } #endif #endif avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/libdha_os2.c0000644000175000017500000001202607532424711022331 0ustar yavoryavor/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_video.c,v 3.14 2000/10/28 01:42:28 mvojkovi Exp $ */ /* Modified for libdha by Nick Kurshev. */ /* * (c) Copyright 1994,1999 by Holger Veit * * Modified 1996 by Sebastien Marineau * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * HOLGER VEIT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of Holger Veit shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from Holger Veit. * */ /* $XConsortium: os2_video.c /main/8 1996/10/27 11:49:02 kaleb $ */ #define INCL_DOSFILEMGR #include "os2.h" /***************************************************************************/ /* Video Memory Mapping helper functions */ /***************************************************************************/ /* This section uses the xf86sup.sys driver developed for xfree86. * The driver allows mapping of physical memory * You must install it with a line DEVICE=path\xf86sup.sys in config.sys. */ static HFILE mapdev = -1; static ULONG stored_virt_addr; static char* mappath = "\\DEV\\PMAP$"; static HFILE open_mmap() { APIRET rc; ULONG action; if (mapdev != -1) return mapdev; rc = DosOpen((PSZ)mappath, (PHFILE)&mapdev, (PULONG)&action, (ULONG)0, FILE_SYSTEM, FILE_OPEN, OPEN_SHARE_DENYNONE|OPEN_FLAGS_NOINHERIT|OPEN_ACCESS_READONLY, (ULONG)0); if (rc!=0) mapdev = -1; return mapdev; } static void close_mmap() { if (mapdev != -1) DosClose(mapdev); mapdev = -1; } /* this structure is used as a parameter packet for the direct access * ioctl of pmap$ */ /* Changed here for structure of driver PMAP$ */ typedef struct{ ULONG addr; ULONG size; } DIOParPkt; /* This is the data packet for the mapping function */ typedef struct { ULONG addr; USHORT sel; } DIODtaPkt; /***************************************************************************/ /* Video Memory Mapping section */ /***************************************************************************/ static long callcount = 0L; /* ARGSUSED */ void * map_phys_mem(unsigned long base, unsigned long size) { DIOParPkt par; ULONG plen; DIODtaPkt dta; ULONG dlen; static BOOL ErrRedir = FALSE; APIRET rc; par.addr = (ULONG)base; par.size = (ULONG)size; plen = sizeof(par); dlen = sizeof(dta); open_mmap(); if (mapdev == -1) { perror("libdha: device xf86sup.sys is not installed"); exit(1); } if ((rc=DosDevIOCtl(mapdev, (ULONG)0x76, (ULONG)0x44, (PVOID)&par, (ULONG)plen, (PULONG)&plen, (PVOID)&dta, (ULONG)dlen, (PULONG)&dlen)) == 0) { if (dlen==sizeof(dta)) { callcount++; return (void *)dta.addr; } /*else fail*/ } return (void *)-1; } /* ARGSUSED */ void unmap_phys_mem(void * base, unsigned long size) { DIOParPkt par; ULONG plen,vmaddr; /* We need here the VIRTADDR for unmapping, not the physical address */ /* This should be taken care of either here by keeping track of allocated */ /* pointers, but this is also already done in the driver... Thus it would */ /* be a waste to do this tracking twice. Can this be changed when the fn. */ /* is called? This would require tracking this function in all servers, */ /* and changing it appropriately to call this with the virtual adress */ /* If the above mapping function is only called once, then we can store */ /* the virtual adress and use it here.... */ par.addr = (ULONG)base; par.size = 0xffffffff; /* This is the virtual address parameter. Set this to ignore */ plen = sizeof(par); if (mapdev != -1) { DosDevIOCtl(mapdev, (ULONG)0x76, (ULONG)0x46, (PVOID)&par, (ULONG)plen, (PULONG)&plen, &vmaddr, sizeof(ULONG), &plen); callcount--; } /* Now if more than one region has been allocated and we close the driver, * the other pointers will immediately become invalid. We avoid closing * driver for now, but this should be fixed for server exit */ if(!callcount) close_mmap(); } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/libdha_win32.c0000644000175000017500000000465307532424711022577 0ustar yavoryavor/* MAPDEV.h - include file for VxD MAPDEV Copyright (c) 1996 Vireo Software, Inc. Modified for libdha by Nick Kurshev. */ #include /* This is the request structure that applications use to request services from the MAPDEV VxD. */ typedef struct _MapDevRequest { DWORD mdr_ServiceID; /* supplied by caller */ LPVOID mdr_PhysicalAddress; /* supplied by caller */ DWORD mdr_SizeInBytes; /* supplied by caller */ LPVOID mdr_LinearAddress; /* returned by VxD */ WORD mdr_Selector; /* returned if 16-bit caller */ WORD mdr_Status; /* MDR_xxxx code below */ } MAPDEVREQUEST, *PMAPDEVREQUEST; #define MDR_SERVICE_MAP CTL_CODE(FILE_DEVICE_UNKNOWN, 1, METHOD_NEITHER, FILE_ANY_ACCESS) #define MDR_SERVICE_UNMAP CTL_CODE(FILE_DEVICE_UNKNOWN, 2, METHOD_NEITHER, FILE_ANY_ACCESS) #define MDR_STATUS_SUCCESS 1 #define MDR_STATUS_ERROR 0 /*#include "winioctl.h"*/ #define FILE_DEVICE_UNKNOWN 0x00000022 #define METHOD_NEITHER 3 #define FILE_ANY_ACCESS 0 #define CTL_CODE( DeviceType, Function, Method, Access ) ( \ ((DeviceType)<<16) | ((Access)<<14) | ((Function)<<2) | (Method) ) /* Memory Map a piece of Real Memory */ void *map_phys_mem(unsigned base, unsigned size) { HANDLE hDevice ; PVOID inBuf[1] ; /* buffer for struct pointer to VxD */ DWORD RetInfo[2] ; /* buffer to receive data from VxD */ DWORD cbBytesReturned ; /* count of bytes returned from VxD */ MAPDEVREQUEST req ; /* map device request structure */ DWORD *pNicstar, Status, Time ; int i ; char *endptr ; const PCHAR VxDName = "\\\\.\\MAPDEV.VXD" ; const PCHAR VxDNameAlreadyLoaded = "\\\\.\\MAPDEV" ; hDevice = CreateFile(VxDName, 0,0,0, CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, 0) ; if (hDevice == INVALID_HANDLE_VALUE) hDevice = CreateFile(VxDNameAlreadyLoaded, 0,0,0, CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, 0) ; if (hDevice == INVALID_HANDLE_VALUE) { fprintf(stderr, "Cannot open driver, error=%08lx\n", GetLastError()) ; exit(1) ; } req.mdr_ServiceID = MDR_SERVICE_MAP ; req.mdr_PhysicalAddress = (PVOID)base ; req.mdr_SizeInBytes = size ; inBuf[0] = &req ; if ( ! DeviceIoControl(hDevice, MDR_SERVICE_MAP, inBuf, sizeof(PVOID), NULL, 0, &cbBytesReturned, NULL) ) { fprintf(stderr, "Failed to map device\n") ; exit(1) ; } return (void*)req.mdr_LinearAddress ; } void unmap_phys_mem(void *ptr, unsigned size) { } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_386bsd.c0000644000175000017500000000143207532424711022166 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ Modified for readability by Nick Kurshev */ #include #include #include #ifndef GCCUSESGAS #define GCCUSESGAS #endif static int io_fd; static __inline__ int enable_os_io(void) { io_fd = -1 ; if ((io_fd = open("/dev/console", O_RDWR, 0)) < 0) { perror("/dev/console"); return(errno); } if (ioctl(io_fd, KDENABIO, 0) < 0) { perror("ioctl(KDENABIO)"); return(errno); } return(0); } static __inline__ int disable_os_io(void) { if (ioctl(io_fd, KDDISABIO, 0) < 0) { perror("ioctl(KDDISABIO)"); close(io_fd); return(errno); } close(io_fd); return(0); } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_alpha.c0000644000175000017500000000334007622470373022247 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ Modified for readability by Nick Kurshev */ static int pci_config_type( void ) { return 1; } static int pci_get_vendor( unsigned char bus, unsigned char dev, int func) { unsigned long retval; pciconfig_read(bus, dev<<3, PCI_ID_REG, 4, &retval); return retval; } static long pci_config_read_long( unsigned char bus, unsigned char dev, int func, unsigned cmd) { unsigned long retval; pciconfig_read(bus, dev<<3, cmd, 4, &retval); return retval; } static long pci_config_read_word( unsigned char bus, unsigned char dev, int func, unsigned cmd) { unsigned long retval; pciconfig_read(bus, dev<<3, cmd, 2, &retval); return retval; } static long pci_config_read_byte( unsigned char bus, unsigned char dev, int func, unsigned cmd) { unsigned long retval; pciconfig_read(bus, dev<<3, cmd, 1, &retval); return retval; } static void pci_config_write_long( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { pciconfig_write(bus, dev<<3, cmd, 4, val); } static void pci_config_write_word( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { pciconfig_write(bus, dev<<3, cmd, 2, val); } static void pci_config_write_byte( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { pciconfig_write(bus, dev<<3, cmd, 1, val); } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_arm32.c0000644000175000017500000000645407622470373022117 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ Modified for readability by Nick Kurshev */ static int pci_config_type( void ) { unsigned long tmplong1, tmplong2; unsigned char tmp1, tmp2; int retval; retval = 0; OUTPORT8(PCI_MODE2_ENABLE_REG, 0x00); OUTPORT8(PCI_MODE2_FORWARD_REG, 0x00); tmp1 = INPORT8(PCI_MODE2_ENABLE_REG); tmp2 = INPORT8(PCI_MODE2_FORWARD_REG); if ((tmp1 == 0x00) && (tmp2 == 0x00)) { retval = 2; /*printf("PCI says configuration type 2\n");*/ } else { tmplong1 = INPORT32(PCI_MODE1_ADDRESS_REG); OUTPORT32(PCI_MODE1_ADDRESS_REG, PCI_EN); tmplong2 = INPORT32(PCI_MODE1_ADDRESS_REG); OUTPORT32(PCI_MODE1_ADDRESS_REG, tmplong1); if (tmplong2 == PCI_EN) { retval = 1; /*printf("PCI says configuration type 1\n");*/ } else { /*printf("No PCI !\n");*/ disable_app_io(); /*exit(1);*/ retval = 0xFFFF; } } return retval; } static int pci_get_vendor( unsigned char bus, unsigned char dev, int func) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd); return INPORT32(PCI_MODE1_DATA_REG); } static long pci_config_read_long( unsigned char bus, unsigned char dev, int func, unsigned cmd) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); return INPORT32(PCI_MODE1_DATA_REG); } static long pci_config_read_word( unsigned char bus, unsigned char dev, int func, unsigned cmd) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); return INPORT16(PCI_MODE1_DATA_REG); } static long pci_config_read_byte( unsigned char bus, unsigned char dev, int func, unsigned cmd) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); return INPORT8(PCI_MODE1_DATA_REG); } static void pci_config_write_long( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); OUTPORT32(PCI_MODE1_DATA_REG,val); } static void pci_config_write_word( unsigned char bus, unsigned char dev, int func, unsigned cmd, unsigned val) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); OUTPORT16(PCI_MODE1_DATA_REG,val); } static void pci_config_write_byte( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); OUTPORT8(PCI_MODE1_DATA_REG,val); } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_bsdi.c0000644000175000017500000000153007532424711022075 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ Modified for readability by Nick Kurshev */ #include #include #include #include #ifndef GCCUSESGAS #define GCCUSESGAS #endif static int io_fd; static __inline__ int enable_os_io(void) { io_fd = -1 ; if ((io_fd = open("/dev/console", O_RDWR, 0)) < 0) { perror("/dev/console"); return(errno); } if (ioctl(io_fd, PCCONENABIOPL, 0) < 0) { perror("ioctl(PCCONENABIOPL)"); return(errno); } return(0); } static __inline__ int disable_os_io(void) { if (ioctl(io_fd, PCCONDISABIOPL, 0) < 0) { perror("ioctl(PCCONDISABIOPL)"); close(io_fd); return(errno); } close(io_fd); return(0); } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_freebsd.c0000644000175000017500000000171207532424711022570 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ Modified for readability by Nick Kurshev */ #include #include /* machine/console.h seems to be outdated by recent FreeBSD * * however pcvt_ioctl.h seems to exist for very long time */ /* #include */ #include #ifndef GCCUSESGAS #define GCCUSESGAS #endif static int io_fd; static __inline__ int enable_os_io(void) { io_fd = -1 ; if ((io_fd = open("/dev/console", O_RDWR, 0)) < 0) { perror("/dev/console"); return(errno); } if (ioctl(io_fd, KDENABIO, 0) < 0) { perror("ioctl(KDENABIO)"); return(errno); } return(0); } static __inline__ int disable_os_io(void) { if (ioctl(io_fd, KDDISABIO, 0) < 0) { perror("ioctl(KDDISABIO)"); close(io_fd); return(errno); } close(io_fd); return(0); } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_generic_cpu.c0000644000175000017500000000326207622470373023450 0ustar yavoryavor/* Generic stuff to compile VIDIX only on any system (SCRATCH) */ #warn This stuff is not ported on yur system static int pci_config_type( void ) { printf("pci_config_type: generic function call\n"); return 0xFFFF; } static int pci_get_vendor( unsigned char bus, unsigned char dev, int func) { printf("pci_get_vendor: generic function call\n"); return 0; } static long pci_config_read_long( unsigned char bus, unsigned char dev, int func, unsigned cmd) { printf("pci_config_read_long: generic function call\n"); return 0; } static long pci_config_read_word( unsigned char bus, unsigned char dev, int func, unsigned cmd) { printf("pci_config_read_word: generic function call\n"); return 0; } static long pci_config_read_byte( unsigned char bus, unsigned char dev, int func, unsigned cmd) { printf("pci_config_read_byte: generic function call\n"); return 0; } static void pci_config_write_long( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { printf("pci_config_write_long: generic function call\n"); } static void pci_config_write_word( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { printf("pci_config_write_word: generic function call\n"); } static void pci_config_write_byte( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { printf("pci_config_write_byte: generic function call\n"); } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_generic_os.c0000644000175000017500000000052607532424711023275 0ustar yavoryavor/* Generic stuff to compile VIDIX only on any system (SCRATCH) */ #warn This stuff is not ported on yur system static __inline__ int enable_os_io(void) { printf("enable_os_io: generic function call\n"); return 0; } static __inline__ int disable_os_io(void) { printf("disable_os_io: generic function call\n"); return 0; } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_ia64.c0000644000175000017500000000645007622470373021732 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ Modified for readability by Nick Kurshev */ static int pci_config_type( void ) { unsigned long tmplong1, tmplong2; unsigned char tmp1, tmp2; int retval; retval = 0; OUTPORT8(PCI_MODE2_ENABLE_REG, 0x00); OUTPORT8(PCI_MODE2_FORWARD_REG, 0x00); tmp1 = INPORT8(PCI_MODE2_ENABLE_REG); tmp2 = INPORT8(PCI_MODE2_FORWARD_REG); if ((tmp1 == 0x00) && (tmp2 == 0x00)) { retval = 2; /*printf("PCI says configuration type 2\n");*/ } else { tmplong1 = INPORT32(PCI_MODE1_ADDRESS_REG); OUTPORT32(PCI_MODE1_ADDRESS_REG, PCI_EN); tmplong2 = INPORT32(PCI_MODE1_ADDRESS_REG); OUTPORT32(PCI_MODE1_ADDRESS_REG, tmplong1); if (tmplong2 == PCI_EN) { retval = 1; /*printf("PCI says configuration type 1\n");*/ } else { /*printf("No PCI !\n");*/ disable_app_io(); /*exit(1);*/ retval = 0xFFFF; } } return retval; } static int pci_get_vendor( unsigned char bus, unsigned char dev, int func) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd); return INPORT32(PCI_MODE1_DATA_REG); } static long pci_config_read_long( unsigned char bus, unsigned char dev, int func, unsigned cmd) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); return INPORT32(PCI_MODE1_DATA_REG); } static long pci_config_read_word( unsigned char bus, unsigned char dev, int func, unsigned cmd) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); return INPORT16(PCI_MODE1_DATA_REG); } static long pci_config_read_byte( unsigned char bus, unsigned char dev, int func, unsigned cmd) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); return INPORT8(PCI_MODE1_DATA_REG); } static void pci_config_write_long( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); OUTPORT32(PCI_MODE1_DATA_REG,val); } static void pci_config_write_word( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); OUTPORT16(PCI_MODE1_DATA_REG,val); } static void pci_config_write_byte( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); OUTPORT8(PCI_MODE1_DATA_REG,val); } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_isc.c0000644000175000017500000000122007532424711021726 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ Modified for readability by Nick Kurshev */ #include #include #include #include #include #include #include static __inline__ int enable_os_io(void) { #if defined(SI86IOPL) sysi86(SI86IOPL, 3); #else sysi86(SI86V86, V86SC_IOPL, PS_IOPL); #endif return(0); } static __inline__ int disable_os_io(void) { #if defined(SI86IOPL) sysi86(SI86IOPL, 0); #else sysi86(SI86V86, V86SC_IOPL, 0); #endif return(0); } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_linux.c0000644000175000017500000000172707651314613022324 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ Modified for readability by Nick Kurshev */ #include #ifdef __i386__ #include #else #ifndef __sparc__ #include #endif #endif #include "config.h" #ifdef CONFIG_DHAHELPER #include int dhahelper_initialized = 0; int dhahelper_fd = 0; #endif #if defined(__sparc__) || defined(__powerpc__) #define iopl(x) (0) #endif static __inline__ int enable_os_io(void) { #ifdef CONFIG_DHAHELPER dhahelper_fd = open("/dev/dhahelper", O_RDWR); if (dhahelper_fd > 0) { dhahelper_initialized = 1; return(0); } dhahelper_initialized = -1; #endif if (iopl(3) != 0) return(errno); return(0); } static __inline__ int disable_os_io(void) { #ifdef CONFIG_DHAHELPER if (dhahelper_initialized == 1) close(dhahelper_fd); else #endif if (iopl(0) != 0) return(errno); return(0); } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_lynx.c0000644000175000017500000000403707532424711022153 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ Modified for readability by Nick Kurshev */ #if defined(Lynx_22) #ifndef GCCUSESGAS #define GCCUSESGAS #endif /* let's mimick the Linux Alpha stuff for LynxOS so we don't have * to change too much code */ #include static unsigned char *pciConfBase; static __inline__ void enable_os_io(void) { pciConfBase = (unsigned char *) smem_create("PCI-CONF", (char *)0x80800000, 64*1024, SM_READ|SM_WRITE); if (pciConfBase == (void *) -1) exit(1); } static __inline__ void disable_os_io(void) { smem_create(NULL, (char *) pciConfBase, 0, SM_DETACH); smem_remove("PCI-CONF"); pciConfBase = NULL; } #include static unsigned char *pciConfBase; static __inline__ unsigned long static swapl(unsigned long val) { unsigned char *p = (unsigned char *)&val; return ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | (p[0] << 0)); } #define BUS(tag) (((tag)>>16)&0xff) #define DFN(tag) (((tag)>>8)&0xff) #define PCIBIOS_DEVICE_NOT_FOUND 0x86 #define PCIBIOS_SUCCESSFUL 0x00 static int pciconfig_read( unsigned char bus, unsigned char dev, unsigned char offset, int len, /* unused, alway 4 */ unsigned long *val) { unsigned long _val; unsigned long *ptr; dev >>= 3; if (bus || dev >= 16) { *val = 0xFFFFFFFF; return PCIBIOS_DEVICE_NOT_FOUND; } else { ptr = (unsigned long *)(pciConfBase + ((1<>= 3; _val = swapl(val); if (bus || dev >= 16) { return PCIBIOS_DEVICE_NOT_FOUND; } else { ptr = (unsigned long *)(pciConfBase + ((1< static int io_fd; static __inline__ int enable_os_io(void) { io_fd = -1 ; if ((io_fd = open("/dev/iopl", O_RDWR, 0)) < 0) { perror("/dev/iopl"); return(errno); } return(0); } static __inline__ int disable_os_io(void) { close(io_fd); return(0); } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_netbsd.c0000644000175000017500000000152107532424711022433 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ Modified for readability by Nick Kurshev */ #include #include #include #include #ifndef GCCUSESGAS #define GCCUSESGAS #endif static int io_fd; static __inline__ int enable_os_io(void) { io_fd = -1 ; #if !defined(USE_I386_IOPL) if ((io_fd = open("/dev/io", O_RDWR, 0)) < 0) { perror("/dev/io"); return(errno); } #else if (i386_iopl(1) < 0) { perror("i386_iopl"); return(errno); } #endif /* USE_I386_IOPL */ return(0); } static __inline__ int disable_os_io(void) { #if !defined(USE_I386_IOPL) close(io_fd); #else if (i386_iopl(0) < 0) { perror("i386_iopl"); return(errno); } #endif /* NetBSD1_1 */ return(0); } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_openbsd.c0000644000175000017500000000075207532424711022613 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ Modified for readability by Nick Kurshev */ #ifdef __i386__ #include #include #include static __inline__ int enable_os_io(void) { if (i386_iopl(1) < 0) { perror("i386_iopl"); return(errno); } return(0); } static __inline__ int disable_os_io(void) { /* Nothing to do */ return(0); } #endif avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_os2.c0000644000175000017500000000260307532424711021661 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ Modified for readability by Nick Kurshev */ #define INCL_DOSFILEMGR #include static USHORT callgate[3] = {0,0,0}; static __inline__ int enable_os_io(void) { HFILE hfd; ULONG dlen,action; APIRET rc; static char *ioDrvPath = "/dev/fastio$"; if (DosOpen((PSZ)ioDrvPath, (PHFILE)&hfd, (PULONG)&action, (ULONG)0, FILE_SYSTEM, FILE_OPEN, OPEN_SHARE_DENYNONE|OPEN_FLAGS_NOINHERIT|OPEN_ACCESS_READONLY, (ULONG)0) != 0) { fprintf(stderr,"Error opening fastio$ driver...\n"); fprintf(stderr,"Please install xf86sup.sys in config.sys!\n"); return(42); } callgate[0] = callgate[1] = 0; /* Get callgate from driver for fast io to ports and other stuff */ rc = DosDevIOCtl(hfd, (ULONG)0x76, (ULONG)0x64, NULL, 0, NULL, (ULONG*)&callgate[2], sizeof(USHORT), &dlen); if (rc) { fprintf(stderr,"xf86-OS/2: EnableIOPorts failed, rc=%d, dlen=%d; emergency exit\n", rc,dlen); DosClose(hfd); return(42); } /* Calling callgate with function 13 sets IOPL for the program */ asm volatile ("movl $13,%%ebx;.byte 0xff,0x1d;.long _callgate" : /*no outputs */ : /*no inputs */ : "eax","ebx","ecx","edx","cc"); DosClose(hfd); return(0); } static __inline__ int disable_os_io(void) { /* Nothing to do */ return(0); } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_powerpc.c0000644000175000017500000001174107651314614022642 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ Modified for readability by Nick Kurshev */ static int pci_config_type( void ) { return 1; } #ifdef linux #include #include #include #include "../../bswap.h" #endif #ifdef linux static int pci_get_vendor( unsigned char bus, unsigned char dev, int func) { int retval; char path[100]; int fd; short vendor, device; sprintf(path,"/proc/bus/pci/%02d/%02x.0", bus, dev); fd = open(path,O_RDONLY|O_SYNC); if (fd == -1) { retval=0xFFFF; } else if (pread(fd, &vendor, 2, PCI_VENDOR_ID) == 2 && pread(fd, &device, 2, PCI_DEVICE_ID) == 2) { vendor = bswap_16(vendor); device = bswap_16(device); retval = vendor + (device<<16); /*no worries about byte order, all ppc are bigendian*/ } else { retval = 0xFFFF; } if (fd > 0) { close(fd); } return retval; } #else static int pci_get_vendor( unsigned char bus, unsigned char dev, int func) { int retval; pciconfig_read(bus, dev<<3, PCI_ID_REG, 4, &retval); return retval; } #endif #ifdef linux static long pci_config_read_long( unsigned char bus, unsigned char dev, int func, unsigned cmd) { long retval; char path[100]; int fd; sprintf(path,"/proc/bus/pci/%02d/%02x.0", bus, dev); fd = open(path,O_RDONLY|O_SYNC); if (fd == -1) { retval=0; } else if (pread(fd, &retval, 4, cmd) == 4) { retval = bswap_32(retval); } else { retval = 0; } if (fd > 0) { close(fd); } return retval; } static long pci_config_read_word( unsigned char bus, unsigned char dev, int func, unsigned cmd) { long retval; char path[100]; int fd; sprintf(path,"/proc/bus/pci/%02d/%02x.0", bus, dev); fd = open(path,O_RDONLY|O_SYNC); if (fd == -1) { retval=0; } else if (pread(fd, &retval, 2, cmd) == 2) { retval = bswap_16(retval); } else { retval = 0; } if (fd > 0) { close(fd); } return retval; } static long pci_config_read_byte( unsigned char bus, unsigned char dev, int func, unsigned cmd) { long retval; char path[100]; int fd; sprintf(path,"/proc/bus/pci/%02d/%02x.0", bus, dev); fd = open(path,O_RDONLY|O_SYNC); if (fd == -1) { retval=0; } else if (pread(fd, &retval, 1, cmd) != 1) { retval = 0; } if (fd > 0) { close(fd); } return retval; } static void pci_config_write_long( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { char path[100]; int fd; val = bswap_32(val); sprintf(path,"/proc/bus/pci/%02d/%02x.0", bus, dev); fd = open(path,O_RDONLY|O_SYNC); if (fd > 0) { pwrite(fd, &val, 4, cmd); close(fd); } } static void pci_config_write_word( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { char path[100]; int fd; val = bswap_16(val); sprintf(path,"/proc/bus/pci/%02d/%02x.0", bus, dev); fd = open(path,O_RDONLY|O_SYNC); if (fd > 0) { pwrite(fd, &val, 2, cmd); close(fd); } } static void pci_config_write_byte( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { char path[100]; int fd; sprintf(path,"/proc/bus/pci/%02d/%02x.0", bus, dev); fd = open(path,O_RDONLY|O_SYNC); if (fd > 0) { pwrite(fd, &val, 1, cmd); close(fd); } } #else static long pci_config_read_long( unsigned char bus, unsigned char dev, int func, unsigned cmd) { long retval; pciconfig_read(bus, dev<<3, cmd, 4, &retval); return retval; } static long pci_config_read_word( unsigned char bus, unsigned char dev, int func, unsigned cmd) { long retval; pciconfig_read(bus, dev<<3, cmd, 2, &retval); return retval; } static long pci_config_read_byte( unsigned char bus, unsigned char dev, int func, unsigned cmd) { long retval; pciconfig_read(bus, dev<<3, cmd, 1, &retval); return retval; } static void pci_config_write_long( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { long retval; pciconfig_write(bus, dev<<3, cmd, 4, val); return retval; } static void pci_config_write_word( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { long retval; pciconfig_write(bus, dev<<3, cmd, 2, val); return retval; } static void pci_config_write_byte( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { long retval; pciconfig_write(bus, dev<<3, cmd, 1, val); return retval; } #endif avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_sco.c0000644000175000017500000000125107532424711021740 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ Modified for readability by Nick Kurshev */ #include #include #include #include #include #include #include #include static __inline__ int enable_os_io(void) { #if defined(SI86IOPL) sysi86(SI86IOPL, 3); #else sysi86(SI86V86, V86SC_IOPL, PS_IOPL); #endif return(0); } static __inline__ int disable_os_io(void) { #if defined(SI86IOPL) sysi86(SI86IOPL, 0); #else sysi86(SI86V86, V86SC_IOPL, 0); #endif return(0); } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_sparc.c0000644000175000017500000000645007622470373022277 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ Modified for readability by Nick Kurshev */ static int pci_config_type( void ) { unsigned long tmplong1, tmplong2; unsigned char tmp1, tmp2; int retval; retval = 0; OUTPORT8(PCI_MODE2_ENABLE_REG, 0x00); OUTPORT8(PCI_MODE2_FORWARD_REG, 0x00); tmp1 = INPORT8(PCI_MODE2_ENABLE_REG); tmp2 = INPORT8(PCI_MODE2_FORWARD_REG); if ((tmp1 == 0x00) && (tmp2 == 0x00)) { retval = 2; /*printf("PCI says configuration type 2\n");*/ } else { tmplong1 = INPORT32(PCI_MODE1_ADDRESS_REG); OUTPORT32(PCI_MODE1_ADDRESS_REG, PCI_EN); tmplong2 = INPORT32(PCI_MODE1_ADDRESS_REG); OUTPORT32(PCI_MODE1_ADDRESS_REG, tmplong1); if (tmplong2 == PCI_EN) { retval = 1; /*printf("PCI says configuration type 1\n");*/ } else { /*printf("No PCI !\n");*/ disable_app_io(); /*exit(1);*/ retval = 0xFFFF; } } return retval; } static int pci_get_vendor( unsigned char bus, unsigned char dev, int func) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd); return INPORT32(PCI_MODE1_DATA_REG); } static long pci_config_read_long( unsigned char bus, unsigned char dev, int func, unsigned cmd) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); return INPORT32(PCI_MODE1_DATA_REG); } static long pci_config_read_word( unsigned char bus, unsigned char dev, int func, unsigned cmd) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); return INPORT16(PCI_MODE1_DATA_REG); } static long pci_config_read_byte( unsigned char bus, unsigned char dev, int func, unsigned cmd) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); return INPORT8(PCI_MODE1_DATA_REG); } static void pci_config_write_long( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); OUTPORT32(PCI_MODE1_DATA_REG,val); } static void pci_config_write_word( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); OUTPORT16(PCI_MODE1_DATA_REG,val); } static void pci_config_write_byte( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); OUTPORT8(PCI_MODE1_DATA_REG,val); } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_svr4.c0000644000175000017500000000140707532424711022055 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ Modified for readability by Nick Kurshev */ #include #include #include #if defined(NCR) #define __STDC #include #undef __STDC #else #include #endif #if defined(sun) # ifndef __EXTENSIONS__ # define __EXTENSIONS__ # endif # include #endif static __inline__ int enable_os_io(void) { #if defined(SI86IOPL) sysi86(SI86IOPL, 3); #else sysi86(SI86V86, V86SC_IOPL, PS_IOPL); #endif return(0); } static __inline__ int disable_os_io(void) { #if defined(SI86IOPL) sysi86(SI86IOPL, 0); #else sysi86(SI86V86, V86SC_IOPL, 0); #endif return(0); } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_win32.c0000644000175000017500000000057707532424711022130 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ Modified for readability by Nick Kurshev */ #include /* Nothing to do for Win9x. For WinNT I have no solution */ static __inline__ int enable_os_io(void) { return(0); } static __inline__ int disable_os_io(void) { return(0); } avifile-0.7.48~20090503.ds/drivers/libdha/sysdep/pci_x86.c0000644000175000017500000000645007622470373021614 0ustar yavoryavor/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ Modified for readability by Nick Kurshev */ static int pci_config_type( void ) { unsigned long tmplong1, tmplong2; unsigned char tmp1, tmp2; int retval; retval = 0; OUTPORT8(PCI_MODE2_ENABLE_REG, 0x00); OUTPORT8(PCI_MODE2_FORWARD_REG, 0x00); tmp1 = INPORT8(PCI_MODE2_ENABLE_REG); tmp2 = INPORT8(PCI_MODE2_FORWARD_REG); if ((tmp1 == 0x00) && (tmp2 == 0x00)) { retval = 2; /*printf("PCI says configuration type 2\n");*/ } else { tmplong1 = INPORT32(PCI_MODE1_ADDRESS_REG); OUTPORT32(PCI_MODE1_ADDRESS_REG, PCI_EN); tmplong2 = INPORT32(PCI_MODE1_ADDRESS_REG); OUTPORT32(PCI_MODE1_ADDRESS_REG, tmplong1); if (tmplong2 == PCI_EN) { retval = 1; /*printf("PCI says configuration type 1\n");*/ } else { /*printf("No PCI !\n");*/ disable_app_io(); /*exit(1);*/ retval = 0xFFFF; } } return retval; } static int pci_get_vendor( unsigned char bus, unsigned char dev, int func) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd); return INPORT32(PCI_MODE1_DATA_REG); } static long pci_config_read_long( unsigned char bus, unsigned char dev, int func, unsigned cmd) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); return INPORT32(PCI_MODE1_DATA_REG); } static long pci_config_read_word( unsigned char bus, unsigned char dev, int func, unsigned cmd) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); return INPORT16(PCI_MODE1_DATA_REG); } static long pci_config_read_byte( unsigned char bus, unsigned char dev, int func, unsigned cmd) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); return INPORT8(PCI_MODE1_DATA_REG); } static void pci_config_write_long( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); OUTPORT32(PCI_MODE1_DATA_REG,val); } static void pci_config_write_word( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); OUTPORT16(PCI_MODE1_DATA_REG,val); } static void pci_config_write_byte( unsigned char bus, unsigned char dev, int func, unsigned cmd, long val) { unsigned long config_cmd; config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8); OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd); OUTPORT8(PCI_MODE1_DATA_REG,val); } avifile-0.7.48~20090503.ds/drivers/Makefile.am0000644000175000017500000000101211106670144017445 0ustar yavoryavorSUBDIRS = libdha vidix EXTRA_DIST = mga_vid.c mga_vid.h mga_vid_test.c bswap.h config.h # complex autodetection for presence of Modeversion and various other things AM_CFLAGS = $(LINUX_CFLAGS) if AMM_USE_MGA_VID TARGETS = mga_vid.o mga_vid_test endif all: $(TARGETS) mga_vid.o: $(srcdir)/mga_vid.c $(srcdir)/mga_vid.h $(CC) $(CFLAGS) -c $(basename $@).c mga_vid_test: $(srcdir)/mga_vid_test.c $(srcdir)/mga_vid.h $(CC) -g -O -Wall $(INCLUDES) -o $@ $@.c MAINTAINERCLEANFILES = Makefile.in mga_vid.o mga_vid_test avifile-0.7.48~20090503.ds/drivers/README0000644000175000017500000000604507317345023016310 0ustar yavoryavor mga_vid - MGA G200/G400 YUV Overlay kernel module Author: Aaron Holtzman , Oct 1999 Contributions by: Fredrik Vraalsen Alan Cox Zdenek Kabelac (Notes for usage with aviplayer you will at the end of this file) --------- This are original README before it has been modified -------- for the usage with avifile player WARNING ----- WARNING This code messes with your video card and your xserver. It will probably lock up your box, format your hard drive, and cause your brand new g400 MAX to spout 6 inch flames. You have been warned. WARNING ----- WARNING What does this code do? mga_vid is a kernel module that utilitizes the Matrox g200/g400 video scaler/overlay unit to perform YUV->RGB colorspace conversion and arbitrary video scaling. mga_vid is also a monster hack. How does mga_vid work? This kernel module sets up the BES (backend scaler) with approriate values based on parameters supplied via ioctl. It also maps a chunk of video memory into userspace via mmap. This memory is stolen from X (which may decide to write to it later). The application can then write image data directly to the frame buffer (if it knows the right padding, etc). How do I know if mga_vid works on my system? There are test applications called mga_vid_test_g400 and mga_vid_test_g200. Use the appropriate one for your card. This test code should draw some nice 256x256 images for you if all is working well. -------------------------------------------------------------------------- And here are some notes about how to use this driver with Aviplayer First - Aviplayer doesn't use any hardware registry trashing call from this driver - it just turn of interrupt generation for Vertical Blank Interrupt when its opened for reading. (so Xv extension should be working even when you close aviplayer). So the whole usage of this driver is to wakeup process waiting in read operation when VBI event comes in. This is used also for video synchronization timing (and its the best way (and I would also say the only one) to provide smooth video. Compilation should be quite easy - you just need to use kernel 2.4 (as driver is using tasklets which are not present in 2.2 kernel - it should not be that hard to rewrite this driver to support also 2.2 kernel but I'm lazy to do this - so if you want to sent me a patch for this just go ahead) Use this command to create driver dev entry point : mknod /dev/mga_vid c 178 0 (you could also use devfs - it should be supported by aviplayer) and the rest shuold be easy - aviplayer shuold be able to detect presence of such device and use it - and you could enjoy the perfect smooth video on your computer (OK only with MGA card for now) But if you know how to wait for VBI on your card and you are able to write some line of kernel code - you should be able to easily extend current mga_vid driver - I assume it will be soon renamed to vbi_drv anyway. avifile-0.7.48~20090503.ds/drivers/bswap.h0000644000175000017500000000570507651313446016724 0ustar yavoryavor#ifndef __BSWAP_H__ #define __BSWAP_H__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_BYTESWAP_H #include #else #include /* for __WORDSIZE */ #ifdef ARCH_X86 inline static unsigned short ByteSwap16(unsigned short x) { __asm("xchgb %b0,%h0" : "=q" (x) : "0" (x)); return x; } #define bswap_16(x) ByteSwap16(x) inline static unsigned int ByteSwap32(unsigned int x) { #if __CPU__ > 386 __asm("bswap %0": "=r" (x) : #else __asm("xchgb %b0,%h0\n" " rorl $16,%0\n" " xchgb %b0,%h0": "=q" (x) : #endif "0" (x)); return x; } #define bswap_32(x) ByteSwap32(x) inline static unsigned long long int ByteSwap64(unsigned long long int x) { register union { __extension__ unsigned long long int __ll; unsigned long int __l[2]; } __x; asm("xchgl %0,%1": "=r"(__x.__l[0]),"=r"(__x.__l[1]): "0"(bswap_32((unsigned long)x)),"1"(bswap_32((unsigned long)(x>>32)))); return __x.__ll; } #define bswap_64(x) ByteSwap64(x) #else #define bswap_16(x) (((x) & 0x00ff) << 8 | ((x) & 0xff00) >> 8) // code from bits/byteswap.h (C) 1997, 1998 Free Software Foundation, Inc. #define bswap_32(x) \ ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) #if __WORDSIZE >= 64 # define bswap_64(x) \ ((((x) & 0xff00000000000000ull) >> 56) \ | (((x) & 0x00ff000000000000ull) >> 40) \ | (((x) & 0x0000ff0000000000ull) >> 24) \ | (((x) & 0x000000ff00000000ull) >> 8) \ | (((x) & 0x00000000ff000000ull) << 8) \ | (((x) & 0x0000000000ff0000ull) << 24) \ | (((x) & 0x000000000000ff00ull) << 40) \ | (((x) & 0x00000000000000ffull) << 56)) #else #define bswap_64(x) \ (__extension__ \ ({ union { __extension__ unsigned long long int __ll; \ unsigned long int __l[2]; } __w, __r; \ __w.__ll = (x); \ __r.__l[0] = bswap_32 (__w.__l[1]); \ __r.__l[1] = bswap_32 (__w.__l[0]); \ __r.__ll; })) #endif #endif /* !ARCH_X86 */ #endif /* !HAVE_BYTESWAP_H */ // be2me ... BigEndian to MachineEndian // le2me ... LittleEndian to MachineEndian #ifdef WORDS_BIGENDIAN #define be2me_16(x) (x) #define be2me_32(x) (x) #define be2me_64(x) (x) #define me2be_16(x) (x) #define me2be_32(x) (x) #define me2be_64(x) (x) #define le2me_16(x) bswap_16(x) #define le2me_32(x) bswap_32(x) #define le2me_64(x) bswap_64(x) #define me2le_16(x) bswap_16(x) #define me2le_32(x) bswap_32(x) #define me2le_64(x) bswap_64(x) #else #define be2me_16(x) bswap_16(x) #define be2me_32(x) bswap_32(x) #define be2me_64(x) bswap_64(x) #define me2be_16(x) bswap_16(x) #define me2be_32(x) bswap_32(x) #define me2be_64(x) bswap_64(x) #define le2me_16(x) (x) #define le2me_32(x) (x) #define le2me_64(x) (x) #define me2le_16(x) (x) #define me2le_32(x) (x) #define me2le_64(x) (x) #endif #endif avifile-0.7.48~20090503.ds/drivers/config.h0000644000175000017500000000003707532425317017045 0ustar yavoryavor#include "../include/config.h" avifile-0.7.48~20090503.ds/drivers/mga_vid.c0000644000175000017500000006743707414616124017217 0ustar yavoryavor// YUY2 support (see config.format) added by A'rpi/ESP-team // double buffering added by A'rpi/ESP-team // read at vertical refresh time & partial SMP safeness by kabi@i.am // Set this value, if autodetection fails! (video ram size in megabytes) // #define MGA_MEMORY_SIZE 16 // for reading timestamp at vertical refresh #define MGA_ALLOW_IRQ #define MGA_VSYNC_POS 2 /* * * mga_vid.c * * Copyright (C) 1999 Aaron Holtzman * * Module skeleton based on gutted agpgart module by Jeff Hartmann * * * Matrox MGA G200/G400 YUV Video Interface module Version 0.1.0 * * kabi@i.am - added support for sleeping read - wakes task at * vertical refresh time - seems to be useful enough * for clean Xv X11 support * * BES == Back End Scaler * * This software has been released under the terms of the GNU Public * license. See http://www.gnu.org/copyleft/gpl.html for details. */ //It's entirely possible this major conflicts with something else /* mknod /dev/mga_vid c 178 0 */ #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef CONFIG_MTRR #include #endif #include #include #include #include "mga_vid.h" #define TRUE 1 #define FALSE 0 #define MGA_VID_MAJOR 178 //#define MGA_VIDMEM_SIZE mga_ram_size #ifndef PCI_DEVICE_ID_MATROX_G200_PCI #define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520 #endif #ifndef PCI_DEVICE_ID_MATROX_G200_AGP #define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521 #endif #ifndef PCI_DEVICE_ID_MATROX_G400 #define PCI_DEVICE_ID_MATROX_G400 0x0525 #endif MODULE_AUTHOR("Aaron Holtzman ," "A'rpi/ESP-team Arpad Gereoffy ," "Zdenek Kabelac "); typedef struct bes_registers_s { //BES Control uint32_t besctl; //BES Global control uint32_t besglobctl; //Luma control (brightness and contrast) uint32_t beslumactl; //Line pitch uint32_t bespitch; //Buffer A-1 Chroma 3 plane org uint32_t besa1c3org; //Buffer A-1 Chroma org uint32_t besa1corg; //Buffer A-1 Luma org uint32_t besa1org; //Buffer A-2 Chroma 3 plane org uint32_t besa2c3org; //Buffer A-2 Chroma org uint32_t besa2corg; //Buffer A-2 Luma org uint32_t besa2org; //Buffer B-1 Chroma 3 plane org uint32_t besb1c3org; //Buffer B-1 Chroma org uint32_t besb1corg; //Buffer B-1 Luma org uint32_t besb1org; //Buffer B-2 Chroma 3 plane org uint32_t besb2c3org; //Buffer B-2 Chroma org uint32_t besb2corg; //Buffer B-2 Luma org uint32_t besb2org; //BES Horizontal coord uint32_t beshcoord; //BES Horizontal inverse scaling [5.14] uint32_t beshiscal; //BES Horizontal source start [10.14] (for scaling) uint32_t beshsrcst; //BES Horizontal source ending [10.14] (for scaling) uint32_t beshsrcend; //BES Horizontal source last uint32_t beshsrclst; //BES Vertical coord uint32_t besvcoord; //BES Vertical inverse scaling [5.14] uint32_t besviscal; //BES Field 1 vertical source last position uint32_t besv1srclst; //BES Field 1 weight start uint32_t besv1wght; //BES Field 2 vertical source last position uint32_t besv2srclst; //BES Field 2 weight start uint32_t besv2wght; } bes_registers_t; static bes_registers_t regs; static uint32_t mga_vid_in_use = 0; static uint32_t is_g400 = 0; static uint32_t vid_src_ready = 0; static uint32_t vid_overlay_on = 0; static uint8_t *mga_mmio_base = 0; static uint32_t mga_mem_base = 0; static int mga_src_base = 0; // YUV buffer position in video memory static uint32_t mga_ram_size = 0; // how much megabytes videoram we have //static int mga_force_memsize = 0; MODULE_PARM(mga_ram_size, "i"); static struct pci_dev *pci_dev; static mga_vid_config_t mga_config; static int mga_irq = -1; static unsigned long irq_counter = 0; static unsigned long irq_per_sec = 0; static unsigned long last_jiffies = 0; static struct tasklet_struct tasklet; static spinlock_t mga_vid_spinlock = SPIN_LOCK_UNLOCKED; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0) static struct wait_queue *wait; #else static wait_queue_head_t wait; #endif //All register offsets are converted to word aligned offsets (32 bit) //because we want all our register accesses to be 32 bits #define VCOUNT 0x1e20 #define PALWTADD 0x3c00 // Index register for X_DATAREG port #define X_DATAREG 0x3c0a #define XMULCTRL 0x19 #define BPP_8 0x00 #define BPP_15 0x01 #define BPP_16 0x02 #define BPP_24 0x03 #define BPP_32_DIR 0x04 #define BPP_32_PAL 0x07 #define XCOLMSK 0x40 #define X_COLKEY 0x42 #define XKEYOPMODE 0x51 #define XCOLMSK0RED 0x52 #define XCOLMSK0GREEN 0x53 #define XCOLMSK0BLUE 0x54 #define XCOLKEY0RED 0x55 #define XCOLKEY0GREEN 0x56 #define XCOLKEY0BLUE 0x57 // Backend Scaler registers #define BESCTL 0x3d20 #define BESGLOBCTL 0x3dc0 #define BESLUMACTL 0x3d40 #define BESPITCH 0x3d24 #define BESA1C3ORG 0x3d60 #define BESA1CORG 0x3d10 #define BESA1ORG 0x3d00 #define BESA2C3ORG 0x3d64 #define BESA2CORG 0x3d14 #define BESA2ORG 0x3d04 #define BESB1C3ORG 0x3d68 #define BESB1CORG 0x3d18 #define BESB1ORG 0x3d08 #define BESB2C3ORG 0x3d6C #define BESB2CORG 0x3d1C #define BESB2ORG 0x3d0C #define BESHCOORD 0x3d28 #define BESHISCAL 0x3d30 #define BESHSRCEND 0x3d3C #define BESHSRCLST 0x3d50 #define BESHSRCST 0x3d38 #define BESV1WGHT 0x3d48 #define BESV2WGHT 0x3d4c #define BESV1SRCLST 0x3d54 #define BESV2SRCLST 0x3d58 #define BESVISCAL 0x3d34 #define BESVCOORD 0x3d2c #define BESSTATUS 0x3dc4 #define CRTCX 0x1fd4 #define CRTCD 0x1fd5 #define IEN 0x1e1c #define ICLEAR 0x1e18 #define STATUS 0x1e14 static int mga_next_frame=0; static void mga_vid_frame_sel(int frame) { if ( mga_irq != -1 ) { mga_next_frame=frame; } else { //we don't need the vcount protection as we're only hitting //one register (and it doesn't seem to be double buffered) regs.besctl = (regs.besctl & ~0x07000000) + (frame << 25); writel( regs.besctl, mga_mmio_base + BESCTL ); // writel( regs.besglobctl + ((readl(mga_mmio_base + VCOUNT)+2)<<16), writel( regs.besglobctl + (MGA_VSYNC_POS<<16), mga_mmio_base + BESGLOBCTL); } } static void mga_vid_write_regs(void) { //Make sure internal registers don't get updated until we're done writel( (readl(mga_mmio_base + VCOUNT)-1)<<16, mga_mmio_base + BESGLOBCTL); // color or coordinate keying writeb( XKEYOPMODE, mga_mmio_base + PALWTADD); writeb( mga_config.colkey_on, mga_mmio_base + X_DATAREG); if ( mga_config.colkey_on ) { uint32_t r=0, g=0, b=0; writeb( XMULCTRL, mga_mmio_base + PALWTADD); switch (readb (mga_mmio_base + X_DATAREG)) { case BPP_8: /* Need to look up the color index, just using color 0 for now. */ break; case BPP_15: r = mga_config.colkey_red >> 3; g = mga_config.colkey_green >> 3; b = mga_config.colkey_blue >> 3; break; case BPP_16: r = mga_config.colkey_red >> 3; g = mga_config.colkey_green >> 2; b = mga_config.colkey_blue >> 3; break; case BPP_24: case BPP_32_DIR: case BPP_32_PAL: r = mga_config.colkey_red; g = mga_config.colkey_green; b = mga_config.colkey_blue; break; } // Disable color keying on alpha channel writeb( XCOLMSK, mga_mmio_base + PALWTADD); writeb( 0x00, mga_mmio_base + X_DATAREG); writeb( X_COLKEY, mga_mmio_base + PALWTADD); writeb( 0x00, mga_mmio_base + X_DATAREG); // Set up color key registers writeb( XCOLKEY0RED, mga_mmio_base + PALWTADD); writeb( r, mga_mmio_base + X_DATAREG); writeb( XCOLKEY0GREEN, mga_mmio_base + PALWTADD); writeb( g, mga_mmio_base + X_DATAREG); writeb( XCOLKEY0BLUE, mga_mmio_base + PALWTADD); writeb( b, mga_mmio_base + X_DATAREG); // Set up color key mask registers writeb( XCOLMSK0RED, mga_mmio_base + PALWTADD); writeb( 0xff, mga_mmio_base + X_DATAREG); writeb( XCOLMSK0GREEN, mga_mmio_base + PALWTADD); writeb( 0xff, mga_mmio_base + X_DATAREG); writeb( XCOLMSK0BLUE, mga_mmio_base + PALWTADD); writeb( 0xff, mga_mmio_base + X_DATAREG); } // Backend Scaler writel( regs.besctl, mga_mmio_base + BESCTL); if(is_g400) writel( regs.beslumactl, mga_mmio_base + BESLUMACTL); writel( regs.bespitch, mga_mmio_base + BESPITCH); writel( regs.besa1org, mga_mmio_base + BESA1ORG); writel( regs.besa1corg, mga_mmio_base + BESA1CORG); writel( regs.besa2org, mga_mmio_base + BESA2ORG); writel( regs.besa2corg, mga_mmio_base + BESA2CORG); writel( regs.besb1org, mga_mmio_base + BESB1ORG); writel( regs.besb1corg, mga_mmio_base + BESB1CORG); writel( regs.besb2org, mga_mmio_base + BESB2ORG); writel( regs.besb2corg, mga_mmio_base + BESB2CORG); if(is_g400) { writel( regs.besa1c3org, mga_mmio_base + BESA1C3ORG); writel( regs.besa2c3org, mga_mmio_base + BESA2C3ORG); writel( regs.besb1c3org, mga_mmio_base + BESB1C3ORG); writel( regs.besb2c3org, mga_mmio_base + BESB2C3ORG); } writel( regs.beshcoord, mga_mmio_base + BESHCOORD); writel( regs.beshiscal, mga_mmio_base + BESHISCAL); writel( regs.beshsrcst, mga_mmio_base + BESHSRCST); writel( regs.beshsrcend, mga_mmio_base + BESHSRCEND); writel( regs.beshsrclst, mga_mmio_base + BESHSRCLST); writel( regs.besvcoord, mga_mmio_base + BESVCOORD); writel( regs.besviscal, mga_mmio_base + BESVISCAL); writel( regs.besv1srclst, mga_mmio_base + BESV1SRCLST); writel( regs.besv1wght, mga_mmio_base + BESV1WGHT); writel( regs.besv2srclst, mga_mmio_base + BESV2SRCLST); writel( regs.besv2wght, mga_mmio_base + BESV2WGHT); //update the registers somewhere between 1 and 2 frames from now. writel( regs.besglobctl + ((readl(mga_mmio_base + VCOUNT)+2)<<16), mga_mmio_base + BESGLOBCTL); #if 0 printk(KERN_DEBUG "mga_vid: wrote BES registers\n"); printk(KERN_DEBUG "mga_vid: BESCTL = 0x%08x\n", readl(mga_mmio_base + BESCTL)); printk(KERN_DEBUG "mga_vid: BESGLOBCTL = 0x%08x\n", readl(mga_mmio_base + BESGLOBCTL)); printk(KERN_DEBUG "mga_vid: BESSTATUS= 0x%08x\n", readl(mga_mmio_base + BESSTATUS)); #endif } static int mga_vid_set_config(mga_vid_config_t *config) { int x, y, sw, sh, dw, dh; int besleft, bestop, ifactor, ofsleft, ofstop, baseadrofs, weight, weights; int frame_size=config->frame_size; x = config->x_org; y = config->y_org; sw = config->src_width; sh = config->src_height; dw = config->dest_width; dh = config->dest_height; printk(KERN_DEBUG "mga_vid: Setting up a %dx%d+%d+%d video window (src %dx%d) format %X\n", dw, dh, x, y, sw, sh, config->format); //FIXME check that window is valid and inside desktop //FIXME figure out a better way to allocate memory on card //allocate 2 megs //mga_src_base = mga_mem_base + (MGA_VIDMEM_SIZE-2) * 0x100000; //mga_src_base = (MGA_VIDMEM_SIZE-3) * 0x100000; //Setup the BES registers for a three plane 4:2:0 video source switch(config->format){ case MGA_VID_FORMAT_YV12: regs.besctl = 1 // BES enabled + (0<<6) // even start polarity + (1<<10) // x filtering enabled + (1<<11) // y filtering enabled + (1<<16) // chroma upsampling + (1<<17) // 4:2:0 mode + (1<<18); // dither enabled if(is_g400) { //zoom disabled, zoom filter disabled, 420 3 plane format, proc amp //disabled, rgb mode disabled regs.besglobctl = (1<<5); } else { //zoom disabled, zoom filter disabled, Cb samples in 0246, Cr //in 1357, BES register update on besvcnt regs.besglobctl = 0; } break; case MGA_VID_FORMAT_YUY2: regs.besctl = 1 // BES enabled + (0<<6) // even start polarity + (1<<10) // x filtering enabled + (1<<11) // y filtering enabled + (1<<16) // chroma upsampling + (0<<17) // 4:2:2 mode + (1<<18); // dither enabled regs.besglobctl = 0; // YUY2 format selected break; default: printk(KERN_ERR "mga_vid: Unsupported pixel format: 0x%X\n",config->format); return -1; } //Disable contrast and brightness control regs.besglobctl = (1<<5) + (1<<7); regs.beslumactl = (0x7f << 16) + (0x80<<0); regs.beslumactl = 0x80<<0; //Setup destination window boundaries besleft = x > 0 ? x : 0; bestop = y > 0 ? y : 0; regs.beshcoord = (besleft<<16) + (x + dw-1); regs.besvcoord = (bestop<<16) + (y + dh-1); //Setup source dimensions regs.beshsrclst = (sw - 1) << 16; regs.bespitch = (sw + 31) & ~31 ; //Setup horizontal scaling ifactor = ((sw-1)<<14)/(dw-1); ofsleft = besleft - x; regs.beshiscal = ifactor<<2; regs.beshsrcst = (ofsleft*ifactor)<<2; regs.beshsrcend = regs.beshsrcst + (((dw - ofsleft - 1) * ifactor) << 2); //Setup vertical scaling ifactor = ((sh-1)<<14)/(dh-1); ofstop = bestop - y; regs.besviscal = ifactor<<2; baseadrofs = ((ofstop*regs.besviscal)>>16)*regs.bespitch; //frame_size = ((sw + 31) & ~31) * sh + (((sw + 31) & ~31) * sh) / 2; regs.besa1org = (uint32_t) mga_src_base + baseadrofs; regs.besa2org = (uint32_t) mga_src_base + baseadrofs + 1*frame_size; regs.besb1org = (uint32_t) mga_src_base + baseadrofs + 2*frame_size; regs.besb2org = (uint32_t) mga_src_base + baseadrofs + 3*frame_size; if(config->format==MGA_VID_FORMAT_YV12){ // planar YUV frames: if (is_g400) baseadrofs = (((ofstop*regs.besviscal)/4)>>16)*regs.bespitch; else baseadrofs = (((ofstop*regs.besviscal)/2)>>16)*regs.bespitch; regs.besa1corg = (uint32_t) mga_src_base + baseadrofs + regs.bespitch * sh ; regs.besa2corg = (uint32_t) mga_src_base + baseadrofs + 1*frame_size + regs.bespitch * sh; regs.besb1corg = (uint32_t) mga_src_base + baseadrofs + 2*frame_size + regs.bespitch * sh; regs.besb2corg = (uint32_t) mga_src_base + baseadrofs + 3*frame_size + regs.bespitch * sh; regs.besa1c3org = regs.besa1corg + ((regs.bespitch * sh) / 4); regs.besa2c3org = regs.besa2corg + ((regs.bespitch * sh) / 4); regs.besb1c3org = regs.besb1corg + ((regs.bespitch * sh) / 4); regs.besb2c3org = regs.besb2corg + ((regs.bespitch * sh) / 4); } weight = ofstop * (regs.besviscal >> 2); weights = weight < 0 ? 1 : 0; regs.besv2wght = regs.besv1wght = (weights << 16) + ((weight & 0x3FFF) << 2); regs.besv2srclst = regs.besv1srclst = sh - 1 - (((ofstop * regs.besviscal) >> 16) & 0x03FF); mga_vid_write_regs(); return 0; } #ifdef MGA_ALLOW_IRQ #define vlinelen (1 << 5) #define vlineiclr (1 << 5) #define c2vlinelen (1 << 9) #define c2vlineiclr (1 << 9) static void mga_enable_irq(int cmd) { long cc, cl = 0; unsigned long flags; spin_lock_irqsave(&mga_vid_spinlock, flags); cc = readl(mga_mmio_base + IEN) & ~(vlinelen | c2vlinelen); //printk(KERN_ALERT "*** IRQREG = 0x%x\n", cc); if (cmd == MGA_VID_IRQ_ON) { // clear any pending interrupts cl = vlineiclr; cc = vlinelen; } else if (cmd == MGA_VID_IRQ2_ON) { cl = c2vlineiclr; cc = c2vlinelen; } writel(cl, mga_mmio_base + ICLEAR); writel(cc, mga_mmio_base + IEN); #if 0 // this will currently stops when the resolution is changed writeb(0x11, mga_mmio_base + CRTCX); writeb(0x20, mga_mmio_base + CRTCD ); /* clear 0, enable off */ writeb(0x00, mga_mmio_base + CRTCD ); /* enable on */ writeb(0x10, mga_mmio_base + CRTCD ); /* clear = 1 */ #endif //writel( regs.besglobctl , mga_mmio_base + BESGLOBCTL); spin_unlock_irqrestore(&mga_vid_spinlock, flags); last_jiffies = 0; } static void mga_disable_irq(int cmd) { long cc, cl = 0; unsigned long flags; spin_lock_irqsave(&mga_vid_spinlock, flags); cc = readl(mga_mmio_base + IEN); if (cmd == MGA_VID_IRQ_OFF || cmd == -1) { cl |= vlineiclr; cc &= ~vlinelen; } else if (cmd == MGA_VID_IRQ2_OFF || cmd == -1) { cl |= c2vlineiclr; cc &= ~c2vlinelen; } writel(cl, mga_mmio_base + ICLEAR); writel(cc, mga_mmio_base + IEN); #if 0 writeb(0x11, mga_mmio_base + CRTCX); writeb(0x20, mga_mmio_base + CRTCD ); /* clear 0, enable off */ #endif spin_unlock_irqrestore(&mga_vid_spinlock, flags); } // executed after interrupt static void mga_tasklet(unsigned long refdata) { static unsigned long first_jiffies = 0; static unsigned long sec_jiffies; static unsigned long sec_irq_counter = 0; if ((jiffies - last_jiffies) > 2) first_jiffies = 0; last_jiffies = jiffies; if (first_jiffies == 0) { sec_jiffies = first_jiffies = last_jiffies; sec_irq_counter = irq_per_sec = irq_counter = 0; } else { irq_counter++; if ((last_jiffies - sec_jiffies) > HZ) { irq_per_sec = irq_counter - sec_irq_counter; sec_irq_counter = irq_counter; sec_jiffies = last_jiffies; } //if (! (d % HZ)) // printk(KERN_DEBUG "%ld %ld\n", irq_counter, irq_per_sec); } #if 0 if ((irq_counter % 500) == 0) { printk(KERN_DEBUG "mga_vid: irq counter = %ld\n", irq_counter); } #endif wake_up_interruptible(&wait); } static void mga_handle_irq(int irq, void *dev_id, struct pt_regs *pregs) { // static int frame=0; // if ( ! mga_enabled_flag ) return; // printk(KERN_DEBUG "vcount = %d\n",readl(mga_mmio_base + VCOUNT)); //printk("mga_interrupt #%d\n", irq); if ( irq != -1 ) { unsigned long flags; long cc, cl = 0; spin_lock_irqsave(&mga_vid_spinlock, flags); cc = readl(mga_mmio_base + STATUS); if (cc & vlineiclr) { #if 0 writeb( 0x11, mga_mmio_base + CRTCX); writeb( 0, mga_mmio_base + CRTCD ); writeb( 0x10, mga_mmio_base + CRTCD ); #endif cl |= vlineiclr; } if (cc & c2vlineiclr) cl |= c2vlineiclr; if (cl) writel(cl, mga_mmio_base + ICLEAR); spin_unlock_irqrestore(&mga_vid_spinlock, flags); if (cl) tasklet_hi_schedule(&tasklet); // debug_irqcnt++; } // if ( debug_irqignore ) { // debug_irqignore = 0; /* if ( mga_conf_deinterlace ) { if ( mga_first_field ) { // printk("mga_interrupt first field\n"); if ( syncfb_interrupt() ) mga_first_field = 0; } else { // printk("mga_interrupt second field\n"); mga_select_buffer( mga_current_field | 2 ); mga_first_field = 1; } } else { syncfb_interrupt(); } */ // frame=(frame+1)&1; //regs.besctl = (regs.besctl & ~0x07000000) + (mga_next_frame << 25); //writel( regs.besctl, mga_mmio_base + BESCTL ); // } else { // debug_irqignore = 1; // } // writel( regs.besglobctl, mga_mmio_base + BESGLOBCTL); } #endif static int mga_vid_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { int frame; switch(cmd) { case MGA_VID_CONFIG: //FIXME remove // printk(KERN_DEBUG "vcount = %d\n",readl(mga_mmio_base + VCOUNT)); printk(KERN_DEBUG "mga_mmio_base = %p\n",mga_mmio_base); printk(KERN_DEBUG "mga_mem_base = %08X\n",mga_mem_base); //FIXME remove printk(KERN_DEBUG "mga_vid: Received configuration\n"); if(copy_from_user(&mga_config,(mga_vid_config_t*) arg,sizeof(mga_vid_config_t))) { printk(KERN_ERR "mga_vid: failed copy from userspace\n"); return(-EFAULT); } if(mga_config.version != MGA_VID_VERSION){ printk(KERN_ERR "mga_vid: incompatible version! driver: %X requested: %X\n",MGA_VID_VERSION,mga_config.version); return(-EFAULT); } if(mga_config.frame_size==0 || mga_config.frame_size>1024*768*2){ printk(KERN_ERR "mga_vid: illegal frame_size: %d\n",mga_config.frame_size); return(-EFAULT); } if(mga_config.num_frames<1 || mga_config.num_frames>4){ printk(KERN_ERR "mga_vid: illegal num_frames: %d\n",mga_config.num_frames); return(-EFAULT); } mga_src_base = (mga_ram_size*0x100000-mga_config.num_frames*mga_config.frame_size); if(mga_src_base<0){ printk(KERN_ERR "mga_vid: not enough memory for frames!\n"); return(-EFAULT); } mga_src_base &= (~0xFFFF); // 64k boundary printk(KERN_DEBUG "mga YUV buffer base: 0x%X\n", mga_src_base); if (is_g400) mga_config.card_type = MGA_G400; else mga_config.card_type = MGA_G200; mga_config.ram_size = mga_ram_size; if (copy_to_user((mga_vid_config_t *) arg, &mga_config, sizeof(mga_vid_config_t))) { printk(KERN_ERR "mga_vid: failed copy to userspace\n"); return(-EFAULT); } return mga_vid_set_config(&mga_config); case MGA_VID_ON: printk(KERN_DEBUG "mga_vid: Video ON\n"); vid_src_ready = 1; if(vid_overlay_on) { regs.besctl |= 1; mga_vid_write_regs(); } #ifdef MGA_ALLOW_IRQ if ( mga_irq != -1 ) mga_enable_irq(0); #endif mga_next_frame=0; break; case MGA_VID_OFF: printk(KERN_DEBUG "mga_vid: Video OFF\n"); vid_src_ready = 0; #ifdef MGA_ALLOW_IRQ if ( mga_irq != -1 ) mga_disable_irq(0); #endif regs.besctl &= ~1; mga_vid_write_regs(); break; case MGA_VID_FSEL: if(copy_from_user(&frame,(int *) arg,sizeof(int))) { printk(KERN_ERR "mga_vid: FSEL failed copy from userspace\n"); return(-EFAULT); } mga_vid_frame_sel(frame); break; case MGA_VID_IRQ_ON: case MGA_VID_IRQ2_ON: printk(KERN_DEBUG "mga_vid: Video IRQ ON\n"); #ifdef MGA_ALLOW_IRQ if ( mga_irq != -1 ) mga_enable_irq(cmd); #endif break; case MGA_VID_IRQ_OFF: case MGA_VID_IRQ2_OFF: printk(KERN_DEBUG "mga_vid: Video IRQ OFF\n"); #ifdef MGA_ALLOW_IRQ if ( mga_irq != -1 ) mga_disable_irq(cmd); #endif break; default: printk(KERN_ERR "mga_vid: Invalid ioctl\n"); return (-EINVAL); } return 0; } static int mga_vid_find_card(void) { struct pci_dev *dev = NULL; unsigned int card_option;//, temp; if((dev = pci_find_device(PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G400, NULL))) { is_g400 = 1; printk(KERN_INFO "mga_vid: Found MGA G400/G450\n"); } else if((dev = pci_find_device(PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G200_AGP, NULL))) { is_g400 = 0; printk(KERN_INFO "mga_vid: Found MGA G200 AGP\n"); } else if((dev = pci_find_device(PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G200_PCI, NULL))) { is_g400 = 0; printk(KERN_INFO "mga_vid: Found MGA G200 PCI\n"); } else { printk(KERN_ERR "mga_vid: No supported cards found\n"); return FALSE; } pci_dev = dev; mga_irq = pci_dev->irq; #if LINUX_VERSION_CODE >= 0x020300 mga_mmio_base = ioremap_nocache(dev->resource[1].start,0x4000); mga_mem_base = dev->resource[0].start; #else mga_mmio_base = ioremap_nocache(dev->base_address[1] & PCI_BASE_ADDRESS_MEM_MASK,0x4000); mga_mem_base = dev->base_address[0] & PCI_BASE_ADDRESS_MEM_MASK; #endif printk(KERN_INFO "mga_vid: MMIO at 0x%p IRQ: %d framebuffer: 0x%08X\n", mga_mmio_base, mga_irq, mga_mem_base); pci_read_config_dword(dev, 0x40, &card_option); printk(KERN_INFO "mga_vid: OPTION word: 0x%08X mem: 0x%02X %s\n", card_option, (card_option>>10)&0x17, ((card_option>>14)&1)?"SGRAM":"SDRAM"); // temp = (card_option >> 10) & 0x17; if (mga_ram_size) { printk(KERN_INFO "mga_vid: RAMSIZE forced to %d MB\n", mga_ram_size); } else { #ifdef MGA_MEMORY_SIZE mga_ram_size = MGA_MEMORY_SIZE; printk(KERN_INFO "mga_vid: hard-coded RAMSIZE is %d MB\n", (unsigned int) mga_ram_size); #else if (is_g400){ switch((card_option>>10)&0x17){ // SDRAM: case 0x00: case 0x04: mga_ram_size = 16; break; case 0x03: mga_ram_size = 32; break; // SGRAM: case 0x10: case 0x14: mga_ram_size = 32; break; case 0x11: case 0x12: mga_ram_size = 16; break; default: mga_ram_size = 16; printk(KERN_INFO "mga_vid: Couldn't detect RAMSIZE, assuming 16MB!"); } }else{ switch((card_option>>11)&1){ case 0: mga_ram_size = 8; break; default: mga_ram_size = 16; } } #if 0 // printk("List resources -----------\n"); for(temp=0;tempresource[temp]; if(res->flags){ int size=(1+res->end-res->start)>>20; printk(KERN_DEBUG "res %d: start: 0x%X end: 0x%X (%d MB) flags=0x%X\n",temp,res->start,res->end,size,res->flags); if(res->flags&(IORESOURCE_MEM|IORESOURCE_PREFETCH)){ if(size>mga_ram_size && size<=64) mga_ram_size=size; } } } #endif printk(KERN_INFO "mga_vid: detected RAMSIZE is %d MB\n", (unsigned int) mga_ram_size); #endif } #ifdef MGA_ALLOW_IRQ if ( mga_irq != -1 ) { int tmp = request_irq(mga_irq, mga_handle_irq, SA_INTERRUPT | SA_SHIRQ, "Syncfb Time Base", &mga_irq); if ( tmp ) { printk(KERN_INFO "syncfb (mga): cannot register irq %d (Err: %d)\n", mga_irq, tmp); mga_irq=-1; } else { printk(KERN_DEBUG "syncfb (mga): registered irq %d\n", mga_irq); } } else { printk(KERN_INFO "syncfb (mga): No valid irq was found\n"); mga_irq=-1; } #else printk(KERN_INFO "syncfb (mga): IRQ disabled in mga_vid.c\n"); mga_irq=-1; #endif return TRUE; } static ssize_t mga_vid_read(struct file *file, char *buf, size_t count, loff_t *ppos) { #ifdef MGA_ALLOW_IRQ if ( mga_irq == -1 ) return -EINVAL; // when the video mode is switched we have to renable mga irq interruptible_sleep_on_timeout(&wait, HZ/10); if (signal_pending(current)) { return -ERESTARTSYS; } // check for timeout here if ((jiffies - last_jiffies) >= HZ/2) { printk(KERN_INFO "mga_vid: timeout\n"); if (mga_irq != -1) { mga_enable_irq(0); } } if (count < 4) return 0; copy_to_user(buf, &irq_counter, 4); if (count < 8) return 4; copy_to_user(buf + 4, &irq_per_sec, 4); return 8; #endif return -EINVAL; } static ssize_t mga_vid_write(struct file *file, const char *buf, size_t count, loff_t *ppos) { return -EINVAL; } static int mga_vid_mmap(struct file *file, struct vm_area_struct *vma) { printk(KERN_DEBUG "mga_vid: mapping video memory into userspace\n"); if(remap_page_range(vma->vm_start, mga_mem_base + mga_src_base, vma->vm_end - vma->vm_start, vma->vm_page_prot)) { printk(KERN_ERR "mga_vid: error mapping video memory\n"); return -EAGAIN; } return 0; } static int mga_vid_release(struct inode *inode, struct file *file) { //Close the window just in case printk(KERN_DEBUG "mga_vid: Video OFF (release)\n"); vid_src_ready = 0; if (regs.besctl & 1) { printk("write_regs()\n"); regs.besctl &= ~1; mga_vid_write_regs(); } #ifdef MGA_ALLOW_IRQ if ( mga_irq != -1 ) mga_disable_irq(-1); #endif mga_vid_in_use = 0; MOD_DEC_USE_COUNT; return 0; } static long long mga_vid_lseek(struct file *file, long long offset, int origin) { return -ESPIPE; } static int mga_vid_open(struct inode *inode, struct file *file) { int minor = MINOR(inode->i_rdev); if(minor != 0) return(-ENXIO); if(mga_vid_in_use == 1) return(-EBUSY); mga_vid_in_use = 1; MOD_INC_USE_COUNT; return(0); } #if LINUX_VERSION_CODE >= 0x020400 static struct file_operations mga_vid_fops = { llseek: mga_vid_lseek, read: mga_vid_read, write: mga_vid_write, ioctl: mga_vid_ioctl, mmap: mga_vid_mmap, open: mga_vid_open, release: mga_vid_release }; #else static struct file_operations mga_vid_fops = { mga_vid_lseek, mga_vid_read, mga_vid_write, NULL, NULL, mga_vid_ioctl, mga_vid_mmap, mga_vid_open, NULL, mga_vid_release }; #endif /* * Main Initialization Function */ static int mga_vid_initialize(void) { mga_vid_in_use = 0; // printk(KERN_INFO "Matrox MGA G200/G400 YUV Video interface v0.01 (c) Aaron Holtzman \n"); printk(KERN_INFO "Matrox MGA G200/G400/G450 YUV Video interface v2.01 (c) Aaron Holtzman & A'rpi\n"); if (mga_ram_size) { if (mga_ram_size<4 || mga_ram_size>64) { printk(KERN_ERR "mga_vid: invalid RAMSIZE: %d MB\n", mga_ram_size); return -EINVAL; } } if(register_chrdev(MGA_VID_MAJOR, "mga_vid", &mga_vid_fops)) { printk(KERN_ERR "mga_vid: unable to get major: %d\n", MGA_VID_MAJOR); return -EIO; } if (!mga_vid_find_card()) { printk(KERN_ERR "mga_vid: no supported devices found\n"); unregister_chrdev(MGA_VID_MAJOR, "mga_vid"); return -EINVAL; } #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 3, 0) init_waitqueue_head(&wait); #else init_waitqueue(&wait); #endif tasklet_init(&tasklet, mga_tasklet, (unsigned long) 0); return 0; } int init_module(void) { return mga_vid_initialize(); } void cleanup_module(void) { #ifdef MGA_ALLOW_IRQ if ( mga_irq != -1) free_irq(mga_irq, &mga_irq); #endif if(mga_mmio_base) iounmap(mga_mmio_base); //FIXME turn off BES printk(KERN_INFO "mga_vid: Cleaning up module\n"); unregister_chrdev(MGA_VID_MAJOR, "mga_vid"); } avifile-0.7.48~20090503.ds/drivers/mga_vid.h0000644000175000017500000000247407414616124017212 0ustar yavoryavor/* * * mga_vid.h * * Copyright (C) 1999 Aaron Holtzman * * Matrox MGA G200/G400 YUV Video Interface module Version 0.1.0 * * BES == Back End Scaler * * This software has been released under the terms of the GNU Public * license. See http://www.gnu.org/copyleft/gpl.html for details. */ #ifndef __LINUX_MGAVID_H #define __LINUX_MGAVID_H #ifdef __KERNEL__ #include #else #include #endif typedef struct mga_vid_config_s { uint16_t version; uint16_t card_type; uint32_t ram_size; uint32_t src_width; uint32_t src_height; uint32_t dest_width; uint32_t dest_height; uint32_t x_org; uint32_t y_org; uint8_t colkey_on; uint8_t colkey_red; uint8_t colkey_green; uint8_t colkey_blue; uint32_t format; uint32_t frame_size; uint32_t num_frames; } mga_vid_config_t; #define MGA_VID_FORMAT_YV12 0x32315659 #define MGA_VID_FORMAT_YUY2 (('Y'<<24)|('U'<<16)|('Y'<<8)|'2') #define MGA_VID_CONFIG _IOR('J', 1, mga_vid_config_t) #define MGA_VID_ON _IO ('J', 2) #define MGA_VID_OFF _IO ('J', 3) #define MGA_VID_FSEL _IOR('J', 4, int) #define MGA_VID_IRQ_ON _IO ('J', 5) #define MGA_VID_IRQ_OFF _IO ('J', 6) #define MGA_VID_IRQ2_ON _IO ('J', 7) #define MGA_VID_IRQ2_OFF _IO ('J', 8) #define MGA_G200 0x1234 #define MGA_G400 0x5678 #define MGA_VID_VERSION 0x0201 #endif avifile-0.7.48~20090503.ds/drivers/mga_vid_test.c0000644000175000017500000001111407414616124020233 0ustar yavoryavor/* * * mga_vid_test.c * * Aaron Holtzman * Sept 1999 * * This software has been released under the terms of the GNU Public * license. See http://www.gnu.org/copyleft/gpl.html for details. */ //#include #include #include #include #include #include #include #include "mga_vid.h" mga_vid_config_t config; uint8_t *mga_vid_base; uint32_t is_g400; #define SRC_IMAGE_WIDTH 256 #define SRC_IMAGE_HEIGHT 256 uint8_t y_image[SRC_IMAGE_WIDTH * SRC_IMAGE_HEIGHT]; uint8_t cr_image[SRC_IMAGE_WIDTH * SRC_IMAGE_HEIGHT]; uint8_t cb_image[SRC_IMAGE_WIDTH * SRC_IMAGE_HEIGHT]; void write_frame_g200(uint8_t *y,uint8_t *cr, uint8_t *cb) { uint8_t *dest; uint32_t bespitch,h,w; dest = mga_vid_base; bespitch = (config.src_width + 31) & ~31; for(h=0; h < config.src_height; h++) { memcpy(dest, y, config.src_width); y += config.src_width; dest += bespitch; } for(h=0; h < config.src_height/2; h++) { for(w=0; w < config.src_width/2; w++) { *dest++ = *cb++; *dest++ = *cr++; } dest += bespitch - config.src_width; } } void write_frame_g400(uint8_t *y,uint8_t *cr, uint8_t *cb) { uint8_t *dest; uint32_t bespitch,h; dest = mga_vid_base; bespitch = (config.src_width + 31) & ~31; for(h=0; h < config.src_height; h++) { memcpy(dest, y, config.src_width); y += config.src_width; dest += bespitch; } for(h=0; h < config.src_height/2; h++) { memcpy(dest, cb, config.src_width/2); cb += config.src_width/2; dest += bespitch/2; } for(h=0; h < config.src_height/2; h++) { memcpy(dest, cr, config.src_width/2); cr += config.src_width/2; dest += bespitch/2; } } void write_frame(uint8_t *y,uint8_t *cr, uint8_t *cb) { if(is_g400) write_frame_g400(y,cr,cb); else write_frame_g200(y,cr,cb); } void draw_cool_pattern(void) { int i,x,y; i = 0; for (y=0; y 0) printf("c: %ld %ld\n", buf[0], buf[1]); } ioctl(f,MGA_VID_IRQ2_OFF,0); } int main(int argc, char *argv[]) { int f; f = open("/dev/mga_vid",O_RDWR); if(f == -1) { fprintf(stderr,"Couldn't open driver\n"); exit(1); } //test_write(f); test_irq(f); close(f); return 0; } avifile-0.7.48~20090503.ds/drivers/vidix/0000755000175000017500000000000011267646347016562 5ustar yavoryavoravifile-0.7.48~20090503.ds/drivers/vidix/drivers/0000755000175000017500000000000011267637140020227 5ustar yavoryavoravifile-0.7.48~20090503.ds/drivers/vidix/drivers/Makefile.mp0000644000175000017500000000740107532425317022305 0ustar yavoryavor# makefile include ../../config.mak BINDIR = $(prefix)/lib/vidix OLDBINDIR = $(prefix)/lib/mplayerxp/vidix RADEON_VID=radeon_vid.so RADEON_SRCS=radeon_vid.c RADEON_OBJS=radeon_vid.o RADEON_LIBS=-L../../libdha -ldha -lm RADEON_CFLAGS=$(OPTFLAGS) -fPIC -I. -I.. -Wall -W RAGE128_VID=rage128_vid.so RAGE128_SRCS=radeon_vid.c RAGE128_OBJS=rage128_vid.o RAGE128_LIBS=-L../../libdha -ldha RAGE128_CFLAGS=$(OPTFLAGS) -fPIC -I. -I.. -Wall -W -DRAGE128 PM3_VID=pm3_vid.so PM3_SRCS=pm3_vid.c PM3_OBJS=pm3_vid.o PM3_LIBS=-L../../libdha -ldha PM3_CFLAGS=$(OPTFLAGS) -fPIC -I. -I.. -Wall -W PM2_VID=pm2_vid.so PM2_SRCS=pm2_vid.c PM2_OBJS=pm2_vid.o PM2_LIBS=-L../../libdha -ldha PM2_CFLAGS=$(OPTFLAGS) -fPIC -I. -I.. -Wall -W MACH64_VID=mach64_vid.so MACH64_SRCS=mach64_vid.c MACH64_OBJS=mach64_vid.o MACH64_LIBS=-L../../libdha -ldha MACH64_CFLAGS=$(OPTFLAGS) -fPIC -I. -I.. -Wall -W -DRAGE128 NVIDIA_VID=nvidia_vid.so NVIDIA_SRCS=nvidia_vid.c NVIDIA_OBJS=nvidia_vid.o NVIDIA_LIBS=-L../../libdha -ldha -lm NVIDIA_CFLAGS=$(OPTFLAGS) -fPIC -I. -I.. -Wall -W GENFB_VID=genfb_vid.so GENFB_SRCS=genfb_vid.c GENFB_OBJS=genfb_vid.o GENFB_LIBS=-L../../libdha -ldha -lm GENFB_CFLAGS=$(OPTFLAGS) -fPIC -I. -I.. -Wall -W MGA_VID=mga_vid.so MGA_SRCS=mga_vid.c MGA_OBJS=mga_vid.o MGA_LIBS=-L../../libdha -ldha -lm MGA_CFLAGS=$(OPTFLAGS) -fPIC -I. -I.. -Wall -W MGA_CRTC2_VID=mga_crtc2_vid.so MGA_CRTC2_SRCS=mga_vid.c MGA_CRTC2_OBJS=mga_crtc2_vid.o MGA_CRTC2_LIBS=-L../../libdha -ldha -lm MGA_CRTC2_CFLAGS=$(OPTFLAGS) -fPIC -I. -I.. -Wall -W -DCRTC2 all: $(RADEON_VID) $(RAGE128_VID) $(MACH64_VID) $(NVIDIA_VID) $(GENFB_VID) $(MGA_VID) $(MGA_CRTC2_VID) $(PM3_VID) $(PM2_VID) .SUFFIXES: .c .o # .PHONY: all clean $(PM3_OBJS): $(PM3_SRCS) $(CC) -c $(PM3_CFLAGS) -o $@ $< $(PM3_VID): $(PM3_OBJS) $(LD) $(PM3_LIBS) -shared -soname $(PM3_VID) -o $(PM3_VID) $(PM3_OBJS) $(PM2_OBJS): $(PM2_SRCS) $(CC) -c $(PM2_CFLAGS) -o $@ $< $(PM2_VID): $(PM2_OBJS) $(LD) $(PM2_LIBS) -shared -soname $(PM2_VID) -o $(PM2_VID) $(PM2_OBJS) $(RADEON_OBJS): $(RADEON_SRCS) $(CC) -c $(RADEON_CFLAGS) -o $@ $< $(RADEON_VID): $(RADEON_OBJS) $(LD) $(RADEON_LIBS) -shared -soname $(RADEON_VID) -o $(RADEON_VID) $(RADEON_OBJS) $(RAGE128_OBJS): $(RAGE128_SRCS) $(CC) -c $(RAGE128_CFLAGS) -o $@ $< $(RAGE128_VID): $(RAGE128_OBJS) $(LD) $(RAGE128_LIBS) -shared -soname $(RAGE128_VID) -o $(RAGE128_VID) $(RAGE128_OBJS) $(MACH64_OBJS): $(MACH64_SRCS) $(CC) -c $(MACH64_CFLAGS) -o $@ $< $(MACH64_VID): $(MACH64_OBJS) $(LD) $(MACH64_LIBS) -shared -soname $(MACH64_VID) -o $(MACH64_VID) $(MACH64_OBJS) $(NVIDIA_OBJS): $(NVIDIA_SRCS) $(CC) -c $(NVIDIA_CFLAGS) -o $@ $< $(NVIDIA_VID): $(NVIDIA_OBJS) $(LD) $(NVIDIA_LIBS) -shared -soname $(NVIDIA_VID) -o $(NVIDIA_VID) $(NVIDIA_OBJS) $(GENFB_OBJS): $(GENFB_SRCS) $(CC) -c $(GENFB_CFLAGS) -o $@ $< $(GENFB_VID): $(GENFB_OBJS) $(LD) $(GENFB_LIBS) -shared -soname $(GENFB_VID) -o $(GENFB_VID) $(GENFB_OBJS) $(MGA_OBJS): $(MGA_SRCS) $(CC) -c $(MGA_CFLAGS) -o $@ $< $(MGA_VID): $(MGA_OBJS) $(LD) $(MGA_LIBS) -shared -soname $(MGA_VID) -o $(MGA_VID) $(MGA_OBJS) $(MGA_CRTC2_OBJS): $(MGA_CRTC2_SRCS) $(CC) -c $(MGA_CRTC2_CFLAGS) -o $@ $< $(MGA_CRTC2_VID): $(MGA_CRTC2_OBJS) $(LD) $(MGA_CRTC2_LIBS) -shared -soname $(MGA_CRTC2_VID) -o $(MGA_CRTC2_VID) $(MGA_CRTC2_OBJS) clean: rm -f *.o *.so *~ distclean: rm -f Makefile.bak *.o *.so test *~ .depend dep: depend depend: # do nothing here install: mkdir -p $(BINDIR) install -m 755 -s -p *.so $(BINDIR) if test -d $(OLDBINDIR) ; then rm -f $(OLDBINDIR)/*.so ; rmdir -p --ignore-fail-on-non-empty $(OLDBINDIR) ; fi uninstall: rm -f $(BINDIR)/*.so rmdir -p --ignore-fail-on-non-empty $(BINDIR) # # include dependency files if they exist # ifneq ($(wildcard .depend),) include .depend endif avifile-0.7.48~20090503.ds/drivers/vidix/drivers/genfb_vid.c0000644000175000017500000000665107537440410022323 0ustar yavoryavor#include #include #include #include #include #include #include #include "../vidix.h" #include "../fourcc.h" #include "../../libdha/libdha.h" #include "../../libdha/pci_ids.h" #include "../../libdha/pci_names.h" #define DEMO_DRIVER 1 #define VIDIX_STATIC genfb_ #define GENFB_MSG "[genfb-demo-driver] " static int fd; static void *mmio_base = 0; static void *mem_base = 0; static int32_t overlay_offset = 0; static uint32_t ram_size = 0; static int probed = 0; /* VIDIX exports */ static vidix_capability_t genfb_cap = { "General Framebuffer", "alex", TYPE_OUTPUT, { 0, 0, 0, 0 }, 2048, 2048, 4, 4, -1, FLAG_UPSCALER|FLAG_DOWNSCALER, -1, -1, { 0, 0, 0, 0 } }; unsigned int VIDIX_NAME(vixGetVersion)(void) { return(VIDIX_VERSION); } int VIDIX_NAME(vixProbe)(int verbose,int force) { #if 0 int err = 0; #ifdef DEMO_DRIVER err = ENOSYS; #endif printf(GENFB_MSG"probe\n"); fd = open("/dev/fb0", O_RDWR); if (fd < 0) { printf(GENFB_MSG"Error occured durint open: %s\n", strerror(errno)); err = errno; } probed = 1; return(err); #else pciinfo_t lst[MAX_PCI_DEVICES]; unsigned i,num_pci; int err; err = pci_scan(lst,&num_pci); if(err) { printf(GENFB_MSG"Error occured during pci scan: %s\n",strerror(err)); return err; } else { err = ENXIO; for(i=0;ifourcc); to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP | VID_DEPTH_4BPP | VID_DEPTH_8BPP | VID_DEPTH_12BPP | VID_DEPTH_15BPP | VID_DEPTH_16BPP | VID_DEPTH_24BPP | VID_DEPTH_32BPP; to->flags = 0; return(0); } int VIDIX_NAME(vixConfigPlayback)(vidix_playback_t *info) { printf(GENFB_MSG"config playback\n"); info->num_frames = 2; info->frame_size = info->src.w*info->src.h+(info->src.w*info->src.h)/2; info->dest.pitch.y = 32; info->dest.pitch.u = info->dest.pitch.v = 16; info->offsets[0] = 0; info->offsets[1] = info->frame_size; info->offset.y = 0; info->offset.v = ((info->src.w+31) & ~31) * info->src.h; info->offset.u = info->offset.v+((info->src.w+31) & ~31) * info->src.h/4; info->dga_addr = malloc(info->num_frames*info->frame_size); printf(GENFB_MSG"frame_size: %d, dga_addr: %x\n", info->frame_size, info->dga_addr); return(0); } int VIDIX_NAME(vixPlaybackOn)(void) { printf(GENFB_MSG"playback on\n"); return(0); } int VIDIX_NAME(vixPlaybackOff)(void) { printf(GENFB_MSG"playback off\n"); return(0); } int VIDIX_NAME(vixPlaybackFrameSelect)(unsigned int frame) { printf(GENFB_MSG"frameselect: %d\n", frame); return(0); } avifile-0.7.48~20090503.ds/drivers/vidix/drivers/glint_regs.h0000644000175000017500000012644107532425317022546 0ustar yavoryavor/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h,v 1.31 2001/12/08 16:01:52 alanh Exp $ */ /* * glint register file * * Copyright by Stefan Dirsch, Dirk Hohndel, Alan Hourihane * Authors: Alan Hourihane, * Dirk Hohndel, * Stefan Dirsch, * Simon P., * * this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen and * Siemens Nixdorf Informationssysteme * */ #ifndef _GLINTREG_H_ #define _GLINTREG_H_ /********************************************** * GLINT 500TX Configuration Region Registers * ***********************************************/ /* Device Identification */ #define CFGVendorId 0x0000 #define PCI_VENDOR_3DLABS 0x3D3D #define PCI_VENDOR_TI 0x104C #define CFGDeviceId 0x0002 #define CFGRevisionId 0x08 #define CFGClassCode 0x09 #define CFGHeaderType 0x0E /* Device Control/Status */ #define CFGCommand 0x04 #define CFGStatus 0x06 /* Miscellaneous Functions */ #define CFGBist 0x0f #define CFGLatTimer 0x0d #define CFGCacheLine 0x0c #define CFGMaxLat 0x3f #define CFGMinGrant 0x3e #define CFGIntPin 0x3d #define CFGIntLine 0x3c /* Base Adresses */ #define CFGBaseAddr0 0x10 #define CFGBaseAddr1 0x14 #define CFGBaseAddr2 0x18 #define CFGBaseAddr3 0x1C #define CFGBaseAddr4 0x20 #define CFGRomAddr 0x30 /********************************** * GLINT 500TX Region 0 Registers * **********************************/ /* Control Status Registers */ #define ResetStatus 0x0000 #define IntEnable 0x0008 #define IntFlags 0x0010 #define InFIFOSpace 0x0018 #define OutFIFOWords 0x0020 #define DMAAddress 0x0028 #define DMACount 0x0030 #define ErrorFlags 0x0038 #define VClkCtl 0x0040 #define TestRegister 0x0048 #define Aperture0 0x0050 #define Aperture1 0x0058 #define DMAControl 0x0060 #define FIFODis 0x0068 /* GLINT PerMedia Region 0 additional Registers */ #define ChipConfig 0x0070 #define SCLK_SEL_MASK (3 << 10) #define SCLK_SEL_MCLK_HALF (3 << 10) #define ByDMAControl 0x00D8 /* GLINT 500TX LocalBuffer Registers */ #define LBMemoryCtl 0x1000 #define LBNumBanksMask 0x00000001 #define LBNumBanks1 (0) #define LBNumBanks2 (1) #define LBPageSizeMask 0x00000006 #define LBPageSize256 (0<<1) #define LBPageSize512 (1<<1) #define LBPageSize1024 (2<<1) #define LBPageSize2048 (3<<1) #define LBRASCASLowMask 0x00000018 #define LBRASCASLow2 (0<<3) #define LBRASCASLow3 (1<<3) #define LBRASCASLow4 (2<<3) #define LBRASCASLow5 (3<<3) #define LBRASPrechargeMask 0x00000060 #define LBRASPrecharge2 (0<<5) #define LBRASPrecharge3 (1<<5) #define LBRASPrecharge4 (2<<5) #define LBRASPrecharge5 (3<<5) #define LBCASLowMask 0x00000180 #define LBCASLow1 (0<<7) #define LBCASLow2 (1<<7) #define LBCASLow3 (2<<7) #define LBCASLow4 (3<<7) #define LBPageModeMask 0x00000200 #define LBPageModeEnabled (0<<9) #define LBPageModeDisabled (1<<9) #define LBRefreshCountMask 0x0003fc00 #define LBRefreshCountShift 10 #define LBMemoryEDO 0x1008 #define LBEDOMask 0x00000001 #define LBEDODisabled (0) #define LBEDOEnabled (1) #define LBEDOBankSizeMask 0x0000000e #define LBEDOBankSizeDiabled (0<<1) #define LBEDOBankSize256K (1<<1) #define LBEDOBankSize512K (2<<1) #define LBEDOBankSize1M (3<<1) #define LBEDOBankSize2M (4<<1) #define LBEDOBankSize4M (5<<1) #define LBEDOBankSize8M (6<<1) #define LBEDOBankSize16M (7<<1) #define LBTwoPageDetectorMask 0x00000010 #define LBSinglePageDetector (0<<4) #define LBTwoPageDetector (1<<4) /* GLINT PerMedia Memory Control Registers */ #define PMReboot 0x1000 #define PMRomControl 0x1040 #define PMBootAddress 0x1080 #define PMMemConfig 0x10C0 #define RowCharge8 1 << 10 #define TimeRCD8 1 << 7 #define TimeRC8 0x6 << 3 #define TimeRP8 1 #define CAS3Latency8 0 << 16 #define BootAdress8 0x10 #define NumberBanks8 0x3 << 29 #define RefreshCount8 0x41 << 21 #define TimeRASMin8 1 << 13 #define DeadCycle8 1 << 17 #define BankDelay8 0 << 18 #define Burst1Cycle8 1 << 31 #define SDRAM8 0 << 4 #define RowCharge6 1 << 10 #define TimeRCD6 1 << 7 #define TimeRC6 0x6 << 3 #define TimeRP6 0x2 #define CAS3Latency6 1 << 16 #define BootAdress6 0x60 #define NumberBanks6 0x2 << 29 #define RefreshCount6 0x41 << 21 #define TimeRASMin6 1 << 13 #define DeadCycle6 1 << 17 #define BankDelay6 0 << 18 #define Burst1Cycle6 1 << 31 #define SDRAM6 0 << 4 #define RowCharge4 0 << 10 #define TimeRCD4 0 << 7 #define TimeRC4 0x4 << 3 #define TimeRP4 1 #define CAS3Latency4 0 << 16 #define BootAdress4 0x10 #define NumberBanks4 1 << 29 #define RefreshCount4 0x30 << 21 #define TimeRASMin4 1 << 13 #define DeadCycle4 0 << 17 #define BankDelay4 0 << 18 #define Burst1Cycle4 1 << 31 #define SDRAM4 0 << 4 /* Permedia 2 Control */ #define MemControl 0x1040 #define PMBypassWriteMask 0x1100 #define PMFramebufferWriteMask 0x1140 #define PMCount 0x1180 /* Framebuffer Registers */ #define FBMemoryCtl 0x1800 #define FBModeSel 0x1808 #define FBGCWrMask 0x1810 #define FBGCColorLower 0x1818 #define FBTXMemCtl 0x1820 #define FBWrMaskk 0x1830 #define FBGCColorUpper 0x1838 /* Core FIFO */ #define OutputFIFO 0x2000 /* 500TX Internal Video Registers */ #define VTGHLimit 0x3000 #define VTGHSyncStart 0x3008 #define VTGHSyncEnd 0x3010 #define VTGHBlankEnd 0x3018 #define VTGVLimit 0x3020 #define VTGVSyncStart 0x3028 #define VTGVSyncEnd 0x3030 #define VTGVBlankEnd 0x3038 #define VTGHGateStart 0x3040 #define VTGHGateEnd 0x3048 #define VTGVGateStart 0x3050 #define VTGVGateEnd 0x3058 #define VTGPolarity 0x3060 #define VTGFrameRowAddr 0x3068 #define VTGVLineNumber 0x3070 #define VTGSerialClk 0x3078 #define VTGModeCtl 0x3080 /* Permedia Video Control Registers */ #define PMScreenBase 0x3000 #define PMScreenStride 0x3008 #define PMHTotal 0x3010 #define PMHgEnd 0x3018 #define PMHbEnd 0x3020 #define PMHsStart 0x3028 #define PMHsEnd 0x3030 #define PMVTotal 0x3038 #define PMVbEnd 0x3040 #define PMVsStart 0x3048 #define PMVsEnd 0x3050 #define PMVideoControl 0x3058 #define PMInterruptLine 0x3060 #define PMDDCData 0x3068 #define DataIn (1<<0) #define ClkIn (1<<1) #define DataOut (1<<2) #define ClkOut (1<<3) #define PMLineCount 0x3070 #define PMFifoControl 0x3078 /* Permedia 2 RAMDAC Registers */ #define PM2DACWriteAddress 0x4000 #define PM2DACIndexReg 0x4000 #define PM2DACData 0x4008 #define PM2DACReadMask 0x4010 #define PM2DACReadAddress 0x4018 #define PM2DACCursorColorAddress 0x4020 #define PM2DACCursorColorData 0x4028 #define PM2DACIndexData 0x4050 #define PM2DACCursorData 0x4058 #define PM2DACCursorXLsb 0x4060 #define PM2DACCursorXMsb 0x4068 #define PM2DACCursorYLsb 0x4070 #define PM2DACCursorYMsb 0x4078 #define PM2DACCursorControl 0x06 #define PM2DACIndexCMR 0x18 #define PM2DAC_TRUECOLOR 0x80 #define PM2DAC_RGB 0x20 #define PM2DAC_GRAPHICS 0x10 #define PM2DAC_PACKED 0x09 #define PM2DAC_8888 0x08 #define PM2DAC_565 0x06 #define PM2DAC_4444 0x05 #define PM2DAC_5551 0x04 #define PM2DAC_2321 0x03 #define PM2DAC_2320 0x02 #define PM2DAC_332 0x01 #define PM2DAC_CI8 0x00 #define PM2DACIndexMDCR 0x19 #define PM2DACIndexPalettePage 0x1c #define PM2DACIndexMCR 0x1e #define PM2DACIndexClockAM 0x20 #define PM2DACIndexClockAN 0x21 #define PM2DACIndexClockAP 0x22 #define PM2DACIndexClockBM 0x23 #define PM2DACIndexClockBN 0x24 #define PM2DACIndexClockBP 0x25 #define PM2DACIndexClockCM 0x26 #define PM2DACIndexClockCN 0x27 #define PM2DACIndexClockCP 0x28 #define PM2DACIndexClockStatus 0x29 #define PM2DACIndexMemClockM 0x30 #define PM2DACIndexMemClockN 0x31 #define PM2DACIndexMemClockP 0x32 #define PM2DACIndexMemClockStatus 0x33 #define PM2DACIndexColorKeyControl 0x40 #define PM2DACIndexColorKeyOverlay 0x41 #define PM2DACIndexColorKeyRed 0x42 #define PM2DACIndexColorKeyGreen 0x43 #define PM2DACIndexColorKeyBlue 0x44 /* Permedia 2V extensions */ #define PM2VDACRDMiscControl 0x000 #define PM2VDACRDSyncControl 0x001 #define PM2VDACRDDACControl 0x002 #define PM2VDACRDPixelSize 0x003 #define PM2VDACRDColorFormat 0x004 #define PM2VDACRDCursorMode 0x005 #define PM2VDACRDCursorXLow 0x007 #define PM2VDACRDCursorXHigh 0x008 #define PM2VDACRDCursorYLow 0x009 #define PM2VDACRDCursorYHigh 0x00A #define PM2VDACRDCursorHotSpotX 0x00B #define PM2VDACRDCursorHotSpotY 0x00C #define PM2VDACRDOverlayKey 0x00D #define PM2VDACRDPan 0x00E #define PM2VDACRDSense 0x00F #define PM2VDACRDCheckControl 0x018 #define PM2VDACIndexClockControl 0x200 #define PM2VDACRDDClk0PreScale 0x201 #define PM2VDACRDDClk0FeedbackScale 0x202 #define PM2VDACRDDClk0PostScale 0x203 #define PM2VDACRDDClk1PreScale 0x204 #define PM2VDACRDDClk1FeedbackScale 0x205 #define PM2VDACRDDClk1PostScale 0x206 #define PM2VDACRDMClkControl 0x20D #define PM2VDACRDMClkPreScale 0x20E #define PM2VDACRDMClkFeedbackScale 0x20F #define PM2VDACRDMClkPostScale 0x210 #define PM2VDACRDCursorPalette 0x303 #define PM2VDACRDCursorPattern 0x400 #define PM2VDACIndexRegLow 0x4020 #define PM2VDACIndexRegHigh 0x4028 #define PM2VDACIndexData 0x4030 #define PM2VDACRDIndexControl 0x4038 /* Permedia 2 Video Streams Unit Registers */ #define VSBIntFlag (1<<8) #define VSAIntFlag (1<<9) #define VSConfiguration 0x5800 #define VS_UnitMode_ROM 0 #define VS_UnitMode_AB8 3 #define VS_UnitMode_Mask 7 #define VS_GPBusMode_A (1<<3) #define VS_HRefPolarityA (1<<9) #define VS_VRefPolarityA (1<<10) #define VS_VActivePolarityA (1<<11) #define VS_UseFieldA (1<<12) #define VS_FieldPolarityA (1<<13) #define VS_FieldEdgeA (1<<14) #define VS_VActiveVBIA (1<<15) #define VS_InterlaceA (1<<16) #define VS_ReverseDataA (1<<17) #define VS_HRefPolarityB (1<<18) #define VS_VRefPolarityB (1<<19) #define VS_VActivePolarityB (1<<20) #define VS_UseFieldB (1<<21) #define VS_FieldPolarityB (1<<22) #define VS_FieldEdgeB (1<<23) #define VS_VActiveVBIB (1<<24) #define VS_InterlaceB (1<<25) #define VS_ColorSpaceB_RGB (1<<26) #define VS_ReverseDataB (1<<27) #define VS_DoubleEdgeB (1<<28) #define VSStatus 0x5808 #define VS_FieldOne0A (1<<9) #define VS_FieldOne1A (1<<10) #define VS_FieldOne2A (1<<11) #define VS_InvalidInterlaceA (1<<12) #define VS_FieldOne0B (1<<17) #define VS_FieldOne1B (1<<18) #define VS_FieldOne2B (1<<19) #define VS_InvalidInterlaceB (1<<20) #define VSSerialBusControl 0x5810 #define VSABase 0x5900 #define VSA_Video (1<<0) #define VSA_VBI (1<<1) #define VSA_BufferCtl (1<<2) #define VSA_MirrorX (1<<7) #define VSA_MirrorY (1<<8) #define VSA_Discard_None (0<<9) #define VSA_Discard_FieldOne (1<<9) #define VSA_Discard_FieldTwo (2<<9) #define VSA_CombineFields (1<<11) #define VSA_LockToStreamB (1<<12) #define VSBBase 0x5A00 #define VSB_Video (1<<0) #define VSB_VBI (1<<1) #define VSB_BufferCtl (1<<2) #define VSB_CombineFields (1<<3) #define VSB_RGBOrder (1<<11) #define VSB_GammaCorrect (1<<12) #define VSB_LockToStreamA (1<<13) #define VSControl 0x0000 #define VSInterrupt 0x0008 #define VSCurrentLine 0x0010 #define VSVideoAddressHost 0x0018 #define VSVideoAddressIndex 0x0020 #define VSVideoAddress0 0x0028 #define VSVideoAddress1 0x0030 #define VSVideoAddress2 0x0038 #define VSVideoStride 0x0040 #define VSVideoStartLine 0x0048 #define VSVideoEndLine 0x0050 #define VSVideoStartData 0x0058 #define VSVideoEndData 0x0060 #define VSVBIAddressHost 0x0068 #define VSVBIAddressIndex 0x0070 #define VSVBIAddress0 0x0078 #define VSVBIAddress1 0x0080 #define VSVBIAddress2 0x0088 #define VSVBIStride 0x0090 #define VSVBIStartLine 0x0098 #define VSVBIEndLine 0x00A0 #define VSVBIStartData 0x00A8 #define VSVBIEndData 0x00B0 #define VSFifoControl 0x00B8 /********************************** * GLINT Delta Region 0 Registers * **********************************/ /* Control Status Registers */ #define DResetStatus 0x0800 #define DIntEnable 0x0808 #define DIntFlags 0x0810 #define DErrorFlags 0x0838 #define DTestRegister 0x0848 #define DFIFODis 0x0868 /********************************** * GLINT Gamma Region 0 Registers * **********************************/ /* Control Status Registers */ #define GInFIFOSpace 0x0018 #define GDMAAddress 0x0028 #define GDMACount 0x0030 #define GDMAControl 0x0060 #define GOutDMA 0x0080 #define GOutDMACount 0x0088 #define GResetStatus 0x0800 #define GIntEnable 0x0808 #define GIntFlags 0x0810 #define GErrorFlags 0x0838 #define GTestRegister 0x0848 #define GFIFODis 0x0868 #define GChipConfig 0x0870 #define GChipAGPCapable 1 << 0 #define GChipAGPSideband 1 << 1 #define GChipMultiGLINTApMask 3 << 19 #define GChipMultiGLINTAp_0M 0 << 19 #define GChipMultiGLINTAp_16M 1 << 19 #define GChipMultiGLINTAp_32M 2 << 19 #define GChipMultiGLINTAp_64M 3 << 19 #define GCSRAperture 0x0878 #define GCSRSecondaryGLINTMapEn 1 << 0 #define GPageTableAddr 0x0c00 #define GPageTableLength 0x0c08 #define GDelayTimer 0x0c38 #define GCommandMode 0x0c40 #define GCommandIntEnable 0x0c48 #define GCommandIntFlags 0x0c50 #define GCommandErrorFlags 0x0c58 #define GCommandStatus 0x0c60 #define GCommandFaultingAddr 0x0c68 #define GVertexFaultingAddr 0x0c70 #define GWriteFaultingAddr 0x0c88 #define GFeedbackSelectCount 0x0c98 #define GGammaProcessorMode 0x0cb8 #define GVGAShadow 0x0d00 #define GMultGLINTAperture 0x0d08 #define GMultGLINT1 0x0d10 #define GMultGLINT2 0x0d18 /************************ * GLINT Core Registers * ************************/ #define GLINT_TAG(major,offset) (((major) << 7) | ((offset) << 3)) #define GLINT_TAG_ADDR(major,offset) (0x8000 | GLINT_TAG((major),(offset))) #define UNIT_DISABLE 0 #define UNIT_ENABLE 1 #define StartXDom GLINT_TAG_ADDR(0x00,0x00) #define dXDom GLINT_TAG_ADDR(0x00,0x01) #define StartXSub GLINT_TAG_ADDR(0x00,0x02) #define dXSub GLINT_TAG_ADDR(0x00,0x03) #define StartY GLINT_TAG_ADDR(0x00,0x04) #define dY GLINT_TAG_ADDR(0x00,0x05) #define GLINTCount GLINT_TAG_ADDR(0x00,0x06) #define Render GLINT_TAG_ADDR(0x00,0x07) #define AreaStippleEnable 0x00001 #define LineStippleEnable 0x00002 #define ResetLineStipple 0x00004 #define FastFillEnable 0x00008 #define PrimitiveLine 0 #define PrimitiveTrapezoid 0x00040 #define PrimitivePoint 0x00080 #define PrimitiveRectangle 0x000C0 #define AntialiasEnable 0x00100 #define AntialiasingQuality 0x00200 #define UsePointTable 0x00400 #define SyncOnBitMask 0x00800 #define SyncOnHostData 0x01000 #define TextureEnable 0x02000 #define FogEnable 0x04000 #define CoverageEnable 0x08000 #define SubPixelCorrectionEnable 0x10000 #define SpanOperation 0x40000 #define XPositive 1<<21 #define YPositive 1<<22 #define ContinueNewLine GLINT_TAG_ADDR(0x00,0x08) #define ContinueNewDom GLINT_TAG_ADDR(0x00,0x09) #define ContinueNewSub GLINT_TAG_ADDR(0x00,0x0a) #define Continue GLINT_TAG_ADDR(0x00,0x0b) #define FlushSpan GLINT_TAG_ADDR(0x00,0x0c) #define BitMaskPattern GLINT_TAG_ADDR(0x00,0x0d) #define PointTable0 GLINT_TAG_ADDR(0x01,0x00) #define PointTable1 GLINT_TAG_ADDR(0x01,0x01) #define PointTable2 GLINT_TAG_ADDR(0x01,0x02) #define PointTable3 GLINT_TAG_ADDR(0x01,0x03) #define RasterizerMode GLINT_TAG_ADDR(0x01,0x04) #define RMMultiGLINT 1<<17 #define BitMaskPackingEachScanline 1<<9 #define ForceBackgroundColor 1<<6 #define InvertBitMask 1<<1 #define YLimits GLINT_TAG_ADDR(0x01,0x05) #define ScanLineOwnership GLINT_TAG_ADDR(0x01,0x06) #define WaitForCompletion GLINT_TAG_ADDR(0x01,0x07) #define PixelSize GLINT_TAG_ADDR(0x01,0x08) #define XLimits GLINT_TAG_ADDR(0x01,0x09) /* PM only */ #define RectangleOrigin GLINT_TAG_ADDR(0x01,0x0A) /* PM2 only */ #define RectangleSize GLINT_TAG_ADDR(0x01,0x0B) /* PM2 only */ #define PackedDataLimits GLINT_TAG_ADDR(0x02,0x0a) /* PM only */ #define ScissorMode GLINT_TAG_ADDR(0x03,0x00) #define SCI_USER 0x01 #define SCI_SCREEN 0x02 #define SCI_USERANDSCREEN 0x03 #define ScissorMinXY GLINT_TAG_ADDR(0x03,0x01) #define ScissorMaxXY GLINT_TAG_ADDR(0x03,0x02) #define ScreenSize GLINT_TAG_ADDR(0x03,0x03) #define AreaStippleMode GLINT_TAG_ADDR(0x03,0x04) /* 0: */ /* NoMirrorY */ /* NoMirrorX */ /* NoInvertPattern */ /* YAddress_1bit */ /* XAddress_1bit */ /* UNIT_DISABLE */ #define ASM_XAddress_2bit 1 << 1 #define ASM_XAddress_3bit 2 << 1 #define ASM_XAddress_4bit 3 << 1 #define ASM_XAddress_5bit 4 << 1 #define ASM_YAddress_2bit 1 << 4 #define ASM_YAddress_3bit 2 << 4 #define ASM_YAddress_4bit 3 << 4 #define ASM_YAddress_5bit 4 << 4 #define ASM_InvertPattern 1 << 17 #define ASM_MirrorX 1 << 18 #define ASM_MirrorY 1 << 19 #define LineStippleMode GLINT_TAG_ADDR(0x03,0x05) #define LoadLineStippleCounters GLINT_TAG_ADDR(0x03,0x06) #define UpdateLineStippleCounters GLINT_TAG_ADDR(0x03,0x07) #define SaveLineStippleState GLINT_TAG_ADDR(0x03,0x08) #define WindowOrigin GLINT_TAG_ADDR(0x03,0x09) #define AreaStipplePattern0 GLINT_TAG_ADDR(0x04,0x00) #define AreaStipplePattern1 GLINT_TAG_ADDR(0x04,0x01) #define AreaStipplePattern2 GLINT_TAG_ADDR(0x04,0x02) #define AreaStipplePattern3 GLINT_TAG_ADDR(0x04,0x03) #define AreaStipplePattern4 GLINT_TAG_ADDR(0x04,0x04) #define AreaStipplePattern5 GLINT_TAG_ADDR(0x04,0x05) #define AreaStipplePattern6 GLINT_TAG_ADDR(0x04,0x06) #define AreaStipplePattern7 GLINT_TAG_ADDR(0x04,0x07) #define TextureAddressMode GLINT_TAG_ADDR(0x07,0x00) #define SStart GLINT_TAG_ADDR(0x07,0x01) #define dSdx GLINT_TAG_ADDR(0x07,0x02) #define dSdyDom GLINT_TAG_ADDR(0x07,0x03) #define TStart GLINT_TAG_ADDR(0x07,0x04) #define dTdx GLINT_TAG_ADDR(0x07,0x05) #define dTdyDom GLINT_TAG_ADDR(0x07,0x06) #define QStart GLINT_TAG_ADDR(0x07,0x07) #define dQdx GLINT_TAG_ADDR(0x07,0x08) #define dQdyDom GLINT_TAG_ADDR(0x07,0x09) #define LOD GLINT_TAG_ADDR(0x07,0x0A) #define dSdy GLINT_TAG_ADDR(0x07,0x0B) #define dTdy GLINT_TAG_ADDR(0x07,0x0C) #define dQdy GLINT_TAG_ADDR(0x07,0x0D) #define TextureReadMode GLINT_TAG_ADDR(0x09,0x00) #define TextureFormat GLINT_TAG_ADDR(0x09,0x01) #define Texture_4_Components 3 << 3 #define Texture_Texel 0 #define TextureCacheControl GLINT_TAG_ADDR(0x09,0x02) #define TextureCacheControlEnable 2 #define TextureCacheControlInvalidate 1 #define GLINTBorderColor GLINT_TAG_ADDR(0x09,0x05) #define TexelLUTIndex GLINT_TAG_ADDR(0x09,0x08) #define TexelLUTData GLINT_TAG_ADDR(0x09,0x09) #define TexelLUTAddress GLINT_TAG_ADDR(0x09,0x0A) #define TexelLUTTransfer GLINT_TAG_ADDR(0x09,0x0B) #define TextureFilterMode GLINT_TAG_ADDR(0x09,0x0C) #define TextureChromaUpper GLINT_TAG_ADDR(0x09,0x0D) #define TextureChromaLower GLINT_TAG_ADDR(0x09,0x0E) #define TxBaseAddr0 GLINT_TAG_ADDR(0x0A,0x00) #define TxBaseAddr1 GLINT_TAG_ADDR(0x0A,0x01) #define TxBaseAddr2 GLINT_TAG_ADDR(0x0A,0x02) #define TxBaseAddr3 GLINT_TAG_ADDR(0x0A,0x03) #define TxBaseAddr4 GLINT_TAG_ADDR(0x0A,0x04) #define TxBaseAddr5 GLINT_TAG_ADDR(0x0A,0x05) #define TxBaseAddr6 GLINT_TAG_ADDR(0x0A,0x06) #define TxBaseAddr7 GLINT_TAG_ADDR(0x0A,0x07) #define TxBaseAddr8 GLINT_TAG_ADDR(0x0A,0x08) #define TxBaseAddr9 GLINT_TAG_ADDR(0x0A,0x09) #define TxBaseAddr10 GLINT_TAG_ADDR(0x0A,0x0A) #define TxBaseAddr11 GLINT_TAG_ADDR(0x0A,0x0B) #define PMTextureBaseAddress GLINT_TAG_ADDR(0x0b,0x00) #define PMTextureMapFormat GLINT_TAG_ADDR(0x0b,0x01) #define PMTextureDataFormat GLINT_TAG_ADDR(0x0b,0x02) #define Texel0 GLINT_TAG_ADDR(0x0c,0x00) #define Texel1 GLINT_TAG_ADDR(0x0c,0x01) #define Texel2 GLINT_TAG_ADDR(0x0c,0x02) #define Texel3 GLINT_TAG_ADDR(0x0c,0x03) #define Texel4 GLINT_TAG_ADDR(0x0c,0x04) #define Texel5 GLINT_TAG_ADDR(0x0c,0x05) #define Texel6 GLINT_TAG_ADDR(0x0c,0x06) #define Texel7 GLINT_TAG_ADDR(0x0c,0x07) #define Interp0 GLINT_TAG_ADDR(0x0c,0x08) #define Interp1 GLINT_TAG_ADDR(0x0c,0x09) #define Interp2 GLINT_TAG_ADDR(0x0c,0x0a) #define Interp3 GLINT_TAG_ADDR(0x0c,0x0b) #define Interp4 GLINT_TAG_ADDR(0x0c,0x0c) #define TextureFilter GLINT_TAG_ADDR(0x0c,0x0d) #define PMTextureReadMode GLINT_TAG_ADDR(0x0c,0x0e) #define TexelLUTMode GLINT_TAG_ADDR(0x0c,0x0f) #define TextureColorMode GLINT_TAG_ADDR(0x0d,0x00) #define TextureTypeOpenGL 0 #define TextureTypeApple 1 << 4 #define TextureKsDDA 1 << 5 /* only Apple-Mode */ #define TextureKdDDA 1 << 6 /* only Apple-Mode */ #define TextureEnvColor GLINT_TAG_ADDR(0x0d,0x01) #define FogMode GLINT_TAG_ADDR(0x0d,0x02) /* 0: */ /* FOG RGBA */ /* UNIT_DISABLE */ #define FOG_CI 0x0002 #define FogColor GLINT_TAG_ADDR(0x0d,0x03) #define FStart GLINT_TAG_ADDR(0x0d,0x04) #define dFdx GLINT_TAG_ADDR(0x0d,0x05) #define dFdyDom GLINT_TAG_ADDR(0x0d,0x06) #define KsStart GLINT_TAG_ADDR(0x0d,0x09) #define dKsdx GLINT_TAG_ADDR(0x0d,0x0a) #define dKsdyDom GLINT_TAG_ADDR(0x0d,0x0b) #define KdStart GLINT_TAG_ADDR(0x0d,0x0c) #define dKdStart GLINT_TAG_ADDR(0x0d,0x0d) #define dKddyDom GLINT_TAG_ADDR(0x0d,0x0e) #define RStart GLINT_TAG_ADDR(0x0f,0x00) #define dRdx GLINT_TAG_ADDR(0x0f,0x01) #define dRdyDom GLINT_TAG_ADDR(0x0f,0x02) #define GStart GLINT_TAG_ADDR(0x0f,0x03) #define dGdx GLINT_TAG_ADDR(0x0f,0x04) #define dGdyDom GLINT_TAG_ADDR(0x0f,0x05) #define BStart GLINT_TAG_ADDR(0x0f,0x06) #define dBdx GLINT_TAG_ADDR(0x0f,0x07) #define dBdyDom GLINT_TAG_ADDR(0x0f,0x08) #define AStart GLINT_TAG_ADDR(0x0f,0x09) #define dAdx GLINT_TAG_ADDR(0x0f,0x0a) #define dAdyDom GLINT_TAG_ADDR(0x0f,0x0b) #define ColorDDAMode GLINT_TAG_ADDR(0x0f,0x0c) /* 0: */ #define CDDA_FlatShading 0 /* UNIT_DISABLE */ #define CDDA_GouraudShading 0x0002 #define ConstantColor GLINT_TAG_ADDR(0x0f,0x0d) #define GLINTColor GLINT_TAG_ADDR(0x0f,0x0e) #define AlphaTestMode GLINT_TAG_ADDR(0x10,0x00) #define AntialiasMode GLINT_TAG_ADDR(0x10,0x01) #define AlphaBlendMode GLINT_TAG_ADDR(0x10,0x02) /* 0: */ /* SrcZERO */ /* DstZERO */ /* ColorFormat8888 */ /* AlphaBuffer present */ /* ColorOrderBGR */ /* TypeOpenGL */ /* DstFBData */ /* UNIT_DISABLE */ #define ABM_SrcONE 1 << 1 #define ABM_SrcDST_COLOR 2 << 1 #define ABM_SrcONE_MINUS_DST_COLOR 3 << 1 #define ABM_SrcSRC_ALPHA 4 << 1 #define ABM_SrcONE_MINUS_SRC_ALPHA 5 << 1 #define ABM_SrcDST_ALPHA 6 << 1 #define ABM_SrcONE_MINUS_DST_ALPHA 7 << 1 #define ABM_SrcSRC_ALPHA_SATURATE 8 << 1 #define ABM_DstONE 1 << 5 #define ABM_DstSRC_COLOR 2 << 5 #define ABM_DstONE_MINUS_SRC_COLOR 3 << 5 #define ABM_DstSRC_ALPHA 4 << 5 #define ABM_DstONE_MINUS_SRC_ALPHA 5 << 5 #define ABM_DstDST_ALPHA 6 << 5 #define ABM_DstONE_MINUS_DST_ALPHA 7 << 5 #define ABM_ColorFormat5555 1 << 8 #define ABM_ColorFormat4444 2 << 8 #define ABM_ColorFormat4444_Front 3 << 8 #define ABM_ColorFormat4444_Back 4 << 8 #define ABM_ColorFormat332_Front 5 << 8 #define ABM_ColorFormat332_Back 6 << 8 #define ABM_ColorFormat121_Front 7 << 8 #define ABM_ColorFormat121_Back 8 << 8 #define ABM_ColorFormat555_Back 13 << 8 #define ABM_ColorFormat_CI8 14 << 8 #define ABM_ColorFormat_CI4 15 << 8 #define ABM_NoAlphaBuffer 0x1000 #define ABM_ColorOrderRGB 0x2000 #define ABM_TypeQuickDraw3D 0x4000 #define ABM_DstFBSourceData 0x8000 #define DitherMode GLINT_TAG_ADDR(0x10,0x03) /* 0: */ /* ColorOrder BGR */ /* AlphaDitherDefault */ /* ColorFormat8888 */ /* TruncateMode */ /* DitherDisable */ /* UNIT_DISABLE */ #define DTM_DitherEnable 1 << 1 #define DTM_ColorFormat5555 1 << 2 #define DTM_ColorFormat4444 2 << 2 #define DTM_ColorFormat4444_Front 3 << 2 #define DTM_ColorFormat4444_Back 4 << 2 #define DTM_ColorFormat332_Front 5 << 2 #define DTM_ColorFormat332_Back 6 << 2 #define DTM_ColorFormat121_Front 7 << 2 #define DTM_ColorFormat121_Back 8 << 2 #define DTM_ColorFormat555_Back 13 << 2 #define DTM_ColorFormat_CI8 14 << 2 #define DTM_ColorFormat_CI4 15 << 2 #define DTM_ColorOrderRGB 1 << 10 #define DTM_NoAlphaDither 1 << 14 #define DTM_RoundMode 1 << 15 #define FBSoftwareWriteMask GLINT_TAG_ADDR(0x10,0x04) #define LogicalOpMode GLINT_TAG_ADDR(0x10,0x05) #define Use_ConstantFBWriteData 0x40 #define FBWriteData GLINT_TAG_ADDR(0x10,0x06) #define RouterMode GLINT_TAG_ADDR(0x10,0x08) #define ROUTER_Depth_Texture 1 #define ROUTER_Texture_Depth 0 #define LBReadMode GLINT_TAG_ADDR(0x11,0x00) /* 0: */ /* SrcNoRead */ /* DstNoRead */ /* DataLBDefault */ /* WinTopLeft */ /* NoPatch */ /* ScanlineInterval1 */ #define LBRM_SrcEnable 1 << 9 #define LBRM_DstEnable 1 << 10 #define LBRM_DataLBStencil 1 << 16 #define LBRM_DataLBDepth 2 << 16 #define LBRM_WinBottomLeft 1 << 18 #define LBRM_DoPatch 1 << 19 #define LBRM_ScanlineInt2 1 << 20 #define LBRM_ScanlineInt4 2 << 20 #define LBRM_ScanlineInt8 3 << 20 #define LBReadFormat GLINT_TAG_ADDR(0x11,0x01) #define LBRF_DepthWidth15 0x03 /* only permedia */ #define LBRF_DepthWidth16 0x00 #define LBRF_DepthWidth24 0x01 #define LBRF_DepthWidth32 0x02 #define LBRF_StencilWidth0 (0 << 2) #define LBRF_StencilWidth4 (1 << 2) #define LBRF_StencilWidth8 (2 << 2) #define LBRF_StencilPos16 (0 << 4) #define LBRF_StencilPos20 (1 << 4) #define LBRF_StencilPos24 (2 << 4) #define LBRF_StencilPos28 (3 << 4) #define LBRF_StencilPos32 (4 << 4) #define LBRF_FrameCount0 (0 << 7) #define LBRF_FrameCount4 (1 << 7) #define LBRF_FrameCount8 (2 << 7) #define LBRF_FrameCountPos16 (0 << 9) #define LBRF_FrameCountPos20 (1 << 9) #define LBRF_FrameCountPos24 (2 << 9) #define LBRF_FrameCountPos28 (3 << 9) #define LBRF_FrameCountPos32 (4 << 9) #define LBRF_FrameCountPos36 (5 << 9) #define LBRF_FrameCountPos40 (6 << 9) #define LBRF_GIDWidth0 (0 << 12) #define LBRF_GIDWidth4 (1 << 12) #define LBRF_GIDPos16 (0 << 13) #define LBRF_GIDPos20 (1 << 13) #define LBRF_GIDPos24 (2 << 13) #define LBRF_GIDPos28 (3 << 13) #define LBRF_GIDPos32 (4 << 13) #define LBRF_GIDPos36 (5 << 13) #define LBRF_GIDPos40 (6 << 13) #define LBRF_GIDPos44 (7 << 13) #define LBRF_GIDPos48 (8 << 13) #define LBRF_Compact32 (1 << 17) #define LBSourceOffset GLINT_TAG_ADDR(0x11,0x02) #define LBStencil GLINT_TAG_ADDR(0x11,0x05) #define LBDepth GLINT_TAG_ADDR(0x11,0x06) #define LBWindowBase GLINT_TAG_ADDR(0x11,0x07) #define LBWriteMode GLINT_TAG_ADDR(0x11,0x08) #define LBWM_WriteEnable 0x1 #define LBWM_UpLoad_LBDepth 0x2 #define LBWM_UpLoad_LBStencil 0x4 #define LBWriteFormat GLINT_TAG_ADDR(0x11,0x09) #define TextureData GLINT_TAG_ADDR(0x11,0x0d) #define TextureDownloadOffset GLINT_TAG_ADDR(0x11,0x0e) #define LBWindowOffset GLINT_TAG_ADDR(0x11,0x0f) #define GLINTWindow GLINT_TAG_ADDR(0x13,0x00) #define GWIN_UnitEnable (1 << 0) #define GWIN_ForceLBUpdate (1 << 3) #define GWIN_LBUpdateSourceREG (1 << 4) #define GWIN_LBUpdateSourceLB (0 << 4) #define GWIN_StencilFCP (1 << 17) #define GWIN_DepthFCP (1 << 18) #define GWIN_OverrideWriteFilter (1 << 19) /* ??? is this needed, set by permedia (2) modules */ #define GWIN_DisableLBUpdate 0x40000 #define StencilMode GLINT_TAG_ADDR(0x13,0x01) #define StencilData GLINT_TAG_ADDR(0x13,0x02) #define GLINTStencil GLINT_TAG_ADDR(0x13,0x03) #define DepthMode GLINT_TAG_ADDR(0x13,0x04) /* 0: */ /* WriteDisable */ /* SrcCompFragment */ /* CompFuncNEVER */ /* UNIT_DISABLE */ #define DPM_WriteEnable 1 << 1 #define DPM_SrcCompLBData 1 << 2 #define DPM_SrcCompDregister 2 << 2 #define DPM_SrcCompLBSourceData 3 << 2 #define DPM_CompFuncLESS 1 << 4 #define DPM_CompFuncEQUAL 2 << 4 #define DPM_CompFuncLESS_OR_EQ 3 << 4 #define DPM_CompFuncGREATER 4 << 4 #define DPM_CompFuncNOT_EQ 5 << 4 #define DPM_CompFuncGREATER_OR_EQ 6 << 4 #define DPM_CompFuncALWAYS 7 << 4 #define GLINTDepth GLINT_TAG_ADDR(0x13,0x05) #define ZStartU GLINT_TAG_ADDR(0x13,0x06) #define ZStartL GLINT_TAG_ADDR(0x13,0x07) #define dZdxU GLINT_TAG_ADDR(0x13,0x08) #define dZdxL GLINT_TAG_ADDR(0x13,0x09) #define dZdyDomU GLINT_TAG_ADDR(0x13,0x0a) #define dZdyDomL GLINT_TAG_ADDR(0x13,0x0b) #define FastClearDepth GLINT_TAG_ADDR(0x13,0x0c) #define FBReadMode GLINT_TAG_ADDR(0x15,0x00) /* 0: */ /* SrcNoRead */ /* DstNoRead */ /* DataFBDefault */ /* WinTopLeft */ /* ScanlineInterval1 */ #define FBRM_SrcEnable 1 << 9 #define FBRM_DstEnable 1 << 10 #define FBRM_DataFBColor 1 << 15 #define FBRM_WinBottomLeft 1 << 16 #define FBRM_Packed 1 << 19 #define FBRM_ScanlineInt2 1 << 23 #define FBRM_ScanlineInt4 2 << 23 #define FBRM_ScanlineInt8 3 << 23 #define FBSourceOffset GLINT_TAG_ADDR(0x15,0x01) #define FBPixelOffset GLINT_TAG_ADDR(0x15,0x02) #define FBColor GLINT_TAG_ADDR(0x15,0x03) #define FBData GLINT_TAG_ADDR(0x15,0x04) #define FBSourceData GLINT_TAG_ADDR(0x15,0x05) #define FBWindowBase GLINT_TAG_ADDR(0x15,0x06) #define FBWriteMode GLINT_TAG_ADDR(0x15,0x07) /* 0: */ /* FBWM_NoColorUpload */ /* FBWM_WriteDisable */ #define FBWM_WriteEnable 1 #define FBWM_UploadColor 1 << 3 /* Permedia3 extensions */ #define FBWM_Enable0 1 << 12 #define FBHardwareWriteMask GLINT_TAG_ADDR(0x15,0x08) #define FBBlockColor GLINT_TAG_ADDR(0x15,0x09) #define FBReadPixel GLINT_TAG_ADDR(0x15,0x0a) /* PM */ #define PatternRamMode GLINT_TAG_ADDR(0x15,0x0f) #define PatternRamData0 GLINT_TAG_ADDR(0x16,0x00) #define PatternRamData1 GLINT_TAG_ADDR(0x16,0x01) #define PatternRamData2 GLINT_TAG_ADDR(0x16,0x02) #define PatternRamData3 GLINT_TAG_ADDR(0x16,0x03) #define PatternRamData4 GLINT_TAG_ADDR(0x16,0x04) #define PatternRamData5 GLINT_TAG_ADDR(0x16,0x05) #define PatternRamData6 GLINT_TAG_ADDR(0x16,0x06) #define PatternRamData7 GLINT_TAG_ADDR(0x16,0x07) #define FilterMode GLINT_TAG_ADDR(0x18,0x00) /* 0: */ /* CullDepthTags */ /* CullDepthData */ /* CullStencilTags */ /* CullStencilData */ /* CullColorTag */ /* CullColorData */ /* CullSyncTag */ /* CullSyncData */ /* CullStatisticTag */ /* CullStatisticData */ #define FM_PassDepthTags 0x0010 #define FM_PassDepthData 0x0020 #define FM_PassStencilTags 0x0040 #define FM_PassStencilData 0x0080 #define FM_PassColorTag 0x0100 #define FM_PassColorData 0x0200 #define FM_PassSyncTag 0x0400 #define FM_PassSyncData 0x0800 #define FM_PassStatisticTag 0x1000 #define FM_PassStatisticData 0x2000 #define Sync_tag 0x0188 #define StatisticMode GLINT_TAG_ADDR(0x18,0x01) #define MinRegion GLINT_TAG_ADDR(0x18,0x02) #define MaxRegion GLINT_TAG_ADDR(0x18,0x03) #define ResetPickResult GLINT_TAG_ADDR(0x18,0x04) #define MitHitRegion GLINT_TAG_ADDR(0x18,0x05) #define MaxHitRegion GLINT_TAG_ADDR(0x18,0x06) #define PickResult GLINT_TAG_ADDR(0x18,0x07) #define GlintSync GLINT_TAG_ADDR(0x18,0x08) #define FBBlockColorU GLINT_TAG_ADDR(0x18,0x0d) #define FBBlockColorL GLINT_TAG_ADDR(0x18,0x0e) #define SuspendUntilFrameBlank GLINT_TAG_ADDR(0x18,0x0f) #define KsRStart GLINT_TAG_ADDR(0x19,0x00) #define dKsRdx GLINT_TAG_ADDR(0x19,0x01) #define dKsRdyDom GLINT_TAG_ADDR(0x19,0x02) #define KsGStart GLINT_TAG_ADDR(0x19,0x03) #define dKsGdx GLINT_TAG_ADDR(0x19,0x04) #define dKsGdyDom GLINT_TAG_ADDR(0x19,0x05) #define KsBStart GLINT_TAG_ADDR(0x19,0x06) #define dKsBdx GLINT_TAG_ADDR(0x19,0x07) #define dKsBdyDom GLINT_TAG_ADDR(0x19,0x08) #define KdRStart GLINT_TAG_ADDR(0x1A,0x00) #define dKdRdx GLINT_TAG_ADDR(0x1A,0x01) #define dKdRdyDom GLINT_TAG_ADDR(0x1A,0x02) #define KdGStart GLINT_TAG_ADDR(0x1A,0x03) #define dKdGdx GLINT_TAG_ADDR(0x1A,0x04) #define dKdGdyDom GLINT_TAG_ADDR(0x1A,0x05) #define KdBStart GLINT_TAG_ADDR(0x1A,0x06) #define dKdBdx GLINT_TAG_ADDR(0x1A,0x07) #define dKdBdyDom GLINT_TAG_ADDR(0x1A,0x08) #define FBSourceBase GLINT_TAG_ADDR(0x1B,0x00) #define FBSourceDelta GLINT_TAG_ADDR(0x1B,0x01) #define Config GLINT_TAG_ADDR(0x1B,0x02) #define CFBRM_SrcEnable 1<<0 #define CFBRM_DstEnable 1<<1 #define CFBRM_Packed 1<<2 #define CWM_Enable 1<<3 #define CCDDA_Enable 1<<4 #define CLogOp_Enable 1<<5 #define ContextDump GLINT_TAG_ADDR(0x1B,0x08) #define ContextRestore GLINT_TAG_ADDR(0x1B,0x09) #define ContextData GLINT_TAG_ADDR(0x1B,0x0a) #define TexelLUT0 GLINT_TAG_ADDR(0x1D,0x00) #define TexelLUT1 GLINT_TAG_ADDR(0x1D,0x01) #define TexelLUT2 GLINT_TAG_ADDR(0x1D,0x02) #define TexelLUT3 GLINT_TAG_ADDR(0x1D,0x03) #define TexelLUT4 GLINT_TAG_ADDR(0x1D,0x04) #define TexelLUT5 GLINT_TAG_ADDR(0x1D,0x05) #define TexelLUT6 GLINT_TAG_ADDR(0x1D,0x06) #define TexelLUT7 GLINT_TAG_ADDR(0x1D,0x07) #define TexelLUT8 GLINT_TAG_ADDR(0x1D,0x08) #define TexelLUT9 GLINT_TAG_ADDR(0x1D,0x09) #define TexelLUT10 GLINT_TAG_ADDR(0x1D,0x0A) #define TexelLUT11 GLINT_TAG_ADDR(0x1D,0x0B) #define TexelLUT12 GLINT_TAG_ADDR(0x1D,0x0C) #define TexelLUT13 GLINT_TAG_ADDR(0x1D,0x0D) #define TexelLUT14 GLINT_TAG_ADDR(0x1D,0x0E) #define TexelLUT15 GLINT_TAG_ADDR(0x1D,0x0F) #define YUVMode GLINT_TAG_ADDR(0x1E,0x00) #define ChromaUpper GLINT_TAG_ADDR(0x1E,0x01) #define ChromaLower GLINT_TAG_ADDR(0x1E,0x02) #define ChromaTestMode GLINT_TAG_ADDR(0x1E,0x03) #define AlphaMapUpperBound GLINT_TAG_ADDR(0x1E,0x03) /* PM2 */ #define AlphaMapLowerBound GLINT_TAG_ADDR(0x1E,0x04) /* PM2 */ /****************************** * GLINT Delta Core Registers * ******************************/ #define V0FixedTag GLINT_TAG_ADDR(0x20,0x00) #define V1FixedTag GLINT_TAG_ADDR(0x21,0x00) #define V2FixedTag GLINT_TAG_ADDR(0x22,0x00) #define V0FloatTag GLINT_TAG_ADDR(0x23,0x00) #define V1FloatTag GLINT_TAG_ADDR(0x24,0x00) #define V2FloatTag GLINT_TAG_ADDR(0x25,0x00) #define VPAR_s 0x00 #define VPAR_t 0x08 #define VPAR_q 0x10 #define VPAR_Ks 0x18 #define VPAR_Kd 0x20 /* have changed colors in ramdac ! #define VPAR_R 0x28 #define VPAR_G 0x30 #define VPAR_B 0x38 #define VPAR_A 0x40 */ #define VPAR_B 0x28 #define VPAR_G 0x30 #define VPAR_R 0x38 #define VPAR_A 0x40 #define VPAR_f 0x48 #define VPAR_x 0x50 #define VPAR_y 0x58 #define VPAR_z 0x60 #define DeltaModeTag GLINT_TAG_ADDR(0x26,0x00) /* 0: */ /* GLINT_300SX */ /* DeltaMode Register Bit Field Assignments */ #define DM_GLINT_300SX 0x0000 #define DM_GLINT_500TX 0x0001 #define DM_PERMEDIA 0x0002 #define DM_Depth_16BPP (1 << 2) #define DM_Depth_24BPP (2 << 2) #define DM_Depth_32BPP (3 << 2) #define DM_FogEnable 0x0010 #define DM_TextureEnable 0x0020 #define DM_SmoothShadingEnable 0x0040 #define DM_DepthEnable 0x0080 #define DM_SpecularTextureEnable 0x0100 #define DM_DiffuseTextureEnable 0x0200 #define DM_SubPixelCorrectionEnable 0x0400 #define DM_DiamondExit 0x0800 #define DM_NoDraw 0x1000 #define DM_ClampEnable 0x2000 #define DM_ClampedTexParMode 0x4000 #define DM_NormalizedTexParMode 0xC000 #define DDCMD_AreaStrippleEnable 0x0001 #define DDCMD_LineStrippleEnable 0x0002 #define DDCMD_ResetLineStripple 1 << 2 #define DDCMD_FastFillEnable 1 << 3 /* 2 Bits reserved */ #define DDCMD_PrimitiveType_Point 2 << 6 #define DDCMD_PrimitiveType_Line 0 << 6 #define DDCMD_PrimitiveType_Trapezoid 1 << 6 #define DDCMD_AntialiasEnable 1 << 8 #define DDCMD_AntialiasingQuality 1 << 9 #define DDCMD_UsePointTable 1 << 10 #define DDCMD_SyncOnBitMask 1 << 11 #define DDCMD_SyncOnHostDate 1 << 12 #define DDCMD_TextureEnable 1 << 13 #define DDCMD_FogEnable 1 << 14 #define DDCMD_CoverageEnable 1 << 15 #define DDCMD_SubPixelCorrectionEnable 1 << 16 #define DrawTriangle GLINT_TAG_ADDR(0x26,0x01) #define RepeatTriangle GLINT_TAG_ADDR(0x26,0x02) #define DrawLine01 GLINT_TAG_ADDR(0x26,0x03) #define DrawLine10 GLINT_TAG_ADDR(0x26,0x04) #define RepeatLine GLINT_TAG_ADDR(0x26,0x05) #define BroadcastMask GLINT_TAG_ADDR(0x26,0x0F) /* Permedia 3 - Accelerator Extensions */ #define FillRectanglePosition 0x8348 #define FillRender2D 0x8350 #define FBDstReadBufAddr0 0xAE80 #define FBDstReadBufOffset0 0xAEA0 #define FBDstReadBufWidth0 0xAEC0 #define FBDstReadMode 0xAEE0 #define FBDRM_Enable0 1<<8 #define FBDRM_Blocking 1<<24 #define FBDstReadEnables 0xAEE8 #define FBSrcReadMode 0xAF00 #define FBSRM_Blocking 1<<11 #define FBSrcReadBufAddr 0xAF08 #define FBSrcReadBufOffset0 0xAF10 #define FBSrcReadBufWidth 0xAF18 #define FBWriteBufAddr0 0xB000 #define FBWriteBufOffset0 0xB020 #define FBWriteBufWidth0 0xB040 #define FBBlockColorBack 0xB0A0 #define ForegroundColor 0xB0C0 #define BackgroundColor 0xB0C8 #define RectanglePosition 0xB600 #define Render2D 0xB640 /* Colorformats */ #define BGR555 1 #define BGR565 16 #define CI8 14 #define CI4 15 #ifdef DEBUG #define GLINT_WRITE_REG(v,r) \ GLINT_VERB_WRITE_REG(pGlint,v,r,__FILE__,__LINE__) #define GLINT_READ_REG(r) \ GLINT_VERB_READ_REG(pGlint,r,__FILE__,__LINE__) #else #define GLINT_WRITE_REG(v,r) \ MMIO_OUT32(pGlint->IOBase + pGlint->IOOffset,(unsigned long)(r), (v)) #define GLINT_READ_REG(r) \ MMIO_IN32(pGlint->IOBase + pGlint->IOOffset,(unsigned long)(r)) #endif /* DEBUG */ #define GLINT_WAIT(n) \ do{ \ if (pGlint->InFifoSpace>=(n)) \ pGlint->InFifoSpace -= (n); \ else { \ int tmp; \ while((tmp=GLINT_READ_REG(InFIFOSpace))<(n)); \ /* Clamp value due to bugs in PM3 */ \ if (tmp > pGlint->FIFOSize) \ tmp = pGlint->FIFOSize; \ pGlint->InFifoSpace = tmp - (n); \ } \ }while(0) #define GLINTDACDelay(x) do { \ int delay = x; \ unsigned char tmp; \ while(delay--){tmp = GLINT_READ_REG(InFIFOSpace);}; \ } while(0) #define GLINT_MASK_WRITE_REG(v,m,r) \ GLINT_WRITE_REG((GLINT_READ_REG(r)&(m))|(v),r) #define GLINT_SLOW_WRITE_REG(v,r) \ do{ \ mem_barrier(); \ GLINT_WAIT(pGlint->FIFOSize); \ mem_barrier(); \ GLINT_WRITE_REG(v,r); \ }while(0) #define GLINT_SET_INDEX(index) \ do{ \ GLINT_SLOW_WRITE_REG(((index)>>8)&0xff,PM2VDACIndexRegHigh); \ GLINT_SLOW_WRITE_REG((index)&0xff,PM2VDACIndexRegLow); \ } while(0) #define REPLICATE(r) \ { \ if (pScrn->bitsPerPixel == 16) { \ r &= 0xFFFF; \ r |= (r<<16); \ } else \ if (pScrn->bitsPerPixel == 8) { \ r &= 0xFF; \ r |= (r<<8); \ r |= (r<<16); \ } \ } #ifndef XF86DRI #define LOADROP(rop) \ { \ if (pGlint->ROP != rop) { \ GLINT_WRITE_REG(rop<<1|UNIT_ENABLE, LogicalOpMode); \ pGlint->ROP = rop; \ } \ } #else #define LOADROP(rop) \ { \ GLINT_WRITE_REG(rop<<1|UNIT_ENABLE, LogicalOpMode); \ pGlint->ROP = rop; \ } #endif #define CHECKCLIPPING \ { \ if (pGlint->ClippingOn) { \ pGlint->ClippingOn = FALSE; \ GLINT_WAIT(1); \ GLINT_WRITE_REG(0, ScissorMode); \ } \ } #ifndef XF86DRI #define DO_PLANEMASK(planemask) \ { \ if (planemask != pGlint->planemask) { \ pGlint->planemask = planemask; \ REPLICATE(planemask); \ GLINT_WRITE_REG(planemask, FBHardwareWriteMask);\ } \ } #else #define DO_PLANEMASK(planemask) \ { \ pGlint->planemask = planemask; \ REPLICATE(planemask); \ GLINT_WRITE_REG(planemask, FBHardwareWriteMask);\ } #endif /* Permedia Save/Restore functions */ #define STOREREG(address,value) \ pReg->glintRegs[address >> 3] = value; #define SAVEREG(address) \ pReg->glintRegs[address >> 3] = GLINT_READ_REG(address); #define RESTOREREG(address) \ GLINT_SLOW_WRITE_REG(pReg->glintRegs[address >> 3], address); #define STOREDAC(address,value) \ pReg->DacRegs[address] = value; #define P2VOUT(address) \ Permedia2vOutIndReg(pScrn, address, 0x00, pReg->DacRegs[address]); #define P2VIN(address) \ pReg->DacRegs[address] = Permedia2vInIndReg(pScrn, address); /* RamDac Save/Restore functions, used by external DAC's */ #define STORERAMDAC(address,value) \ ramdacReg->DacRegs[address] = value; /* Multi Chip access */ #define ACCESSCHIP1() \ pGlint->IOOffset = 0; #define ACCESSCHIP2() \ pGlint->IOOffset = 0x10000; #endif avifile-0.7.48~20090503.ds/drivers/vidix/drivers/mach64.h0000644000175000017500000030233707532425317021473 0ustar yavoryavor/* * mach64.h * This software has been released under the terms of the GNU Public * license. See http://www.gnu.org/copyleft/gpl.html for details. * * It's based on radeonfb, X11, GATOS sources */ #ifndef __MACH64_INCLUDED #define __MACH64_INCLUDED 1 /* Note: this model of accessing to IO space is based on MMIO technology. This means that this sources don't support ISA and VLB cards */ #define BlockIOTag(val) (val) #define IOPortTag(sparce,val) (val) /* MDA/[M]CGA/EGA/VGA I/O ports */ #define GENVS 0x0102u /* Write (and Read on uC only) */ #define R_GENLPS 0x03b9u /* Read */ #define GENHP 0x03bfu #define ATTRX 0x03c0u #define ATTRD 0x03c1u #define GENS0 0x03c2u /* Read */ #define GENMO 0x03c2u /* Write */ #define GENENB 0x03c3u /* Read */ #define SEQX 0x03c4u #define SEQD 0x03c5u #define VGA_DAC_MASK 0x03c6u #define VGA_DAC_READ 0x03c7u #define VGA_DAC_WRITE 0x03c8u #define VGA_DAC_DATA 0x03c9u #define R_GENFC 0x03cau /* Read */ /* ? 0x03cbu */ #define R_GENMO 0x03ccu /* Read */ /* ? 0x03cdu */ #define GRAX 0x03ceu #define GRAD 0x03cfu #define GENB 0x03d9u #define GENLPS 0x03dcu /* Write */ #define KCX 0x03ddu #define KCD 0x03deu #define GENENA 0x46e8u /* Write */ /* I/O port base numbers */ #define MonochromeIOBase 0x03b0u #define ColourIOBase 0x03d0u /* Other MDA/[M]CGA/EGA/VGA I/O ports */ /* ?(_IOBase) ((_IOBase) + 0x00u) */ /* CRTX synonym */ /* ?(_IOBase) ((_IOBase) + 0x01u) */ /* CRTD synonym */ /* ?(_IOBase) ((_IOBase) + 0x02u) */ /* CRTX synonym */ /* ?(_IOBase) ((_IOBase) + 0x03u) */ /* CRTD synonym */ #define CRTX(_IOBase) ((_IOBase) + 0x04u) #define CRTD(_IOBase) ((_IOBase) + 0x05u) /* ?(_IOBase) ((_IOBase) + 0x06u) */ /* ?(_IOBase) ((_IOBase) + 0x07u) */ #define GENMC(_IOBase) ((_IOBase) + 0x08u) /* ?(_IOBase) ((_IOBase) + 0x09u) */ /* R_GENLPS/GENB */ #define GENS1(_IOBase) ((_IOBase) + 0x0au) /* Read */ #define GENFC(_IOBase) ((_IOBase) + 0x0au) /* Write */ #define GENLPC(_IOBase) ((_IOBase) + 0x0bu) /* ?(_IOBase) ((_IOBase) + 0x0cu) */ /* /GENLPS */ /* ?(_IOBase) ((_IOBase) + 0x0du) */ /* /KCX */ /* ?(_IOBase) ((_IOBase) + 0x0eu) */ /* /KCD */ /* ?(_IOBase) ((_IOBase) + 0x0fu) */ /* GENHP/ */ /* 8514/A VESA approved register definitions */ #define DISP_STAT 0x02e8u /* Read */ #define SENSE 0x0001u /* Presumably belong here */ #define VBLANK 0x0002u #define HORTOG 0x0004u #define H_TOTAL 0x02e8u /* Write */ #define IBM_DAC_MASK 0x02eau #define IBM_DAC_READ 0x02ebu #define IBM_DAC_WRITE 0x02ecu #define IBM_DAC_DATA 0x02edu #define H_DISP 0x06e8u /* Write */ #define H_SYNC_STRT 0x0ae8u /* Write */ #define H_SYNC_WID 0x0ee8u /* Write */ #define HSYNCPOL_POS 0x0000u #define HSYNCPOL_NEG 0x0020u #define H_POLARITY_POS HSYNCPOL_POS /* Sigh */ #define H_POLARITY_NEG HSYNCPOL_NEG /* Sigh */ #define V_TOTAL 0x12e8u /* Write */ #define V_DISP 0x16e8u /* Write */ #define V_SYNC_STRT 0x1ae8u /* Write */ #define V_SYNC_WID 0x1ee8u /* Write */ #define VSYNCPOL_POS 0x0000u #define VSYNCPOL_NEG 0x0020u #define V_POLARITY_POS VSYNCPOL_POS /* Sigh */ #define V_POLARITY_NEG VSYNCPOL_NEG /* Sigh */ #define DISP_CNTL 0x22e8u /* Write */ #define ODDBNKENAB 0x0001u #define MEMCFG_2 0x0000u #define MEMCFG_4 0x0002u #define MEMCFG_6 0x0004u #define MEMCFG_8 0x0006u #define DBLSCAN 0x0008u #define INTERLACE 0x0010u #define DISPEN_NC 0x0000u #define DISPEN_ENAB 0x0020u #define DISPEN_DISAB 0x0040u #define R_H_TOTAL 0x26e8u /* Read */ /* ? 0x2ae8u */ /* ? 0x2ee8u */ /* ? 0x32e8u */ /* ? 0x36e8u */ /* ? 0x3ae8u */ /* ? 0x3ee8u */ #define SUBSYS_STAT 0x42e8u /* Read */ #define VBLNKFLG 0x0001u #define PICKFLAG 0x0002u #define INVALIDIO 0x0004u #define GPIDLE 0x0008u #define MONITORID_MASK 0x0070u /* MONITORID_? 0x0000u */ #define MONITORID_8507 0x0010u #define MONITORID_8514 0x0020u /* MONITORID_? 0x0030u */ /* MONITORID_? 0x0040u */ #define MONITORID_8503 0x0050u #define MONITORID_8512 0x0060u #define MONITORID_8513 0x0060u #define MONITORID_NONE 0x0070u #define _8PLANE 0x0080u #define SUBSYS_CNTL 0x42e8u /* Write */ #define RVBLNKFLG 0x0001u #define RPICKFLAG 0x0002u #define RINVALIDIO 0x0004u #define RGPIDLE 0x0008u #define IVBLNKFLG 0x0100u #define IPICKFLAG 0x0200u #define IINVALIDIO 0x0400u #define IGPIDLE 0x0800u #define CHPTEST_NC 0x0000u #define CHPTEST_NORMAL 0x1000u #define CHPTEST_ENAB 0x2000u #define GPCTRL_NC 0x0000u #define GPCTRL_ENAB 0x4000u #define GPCTRL_RESET 0x8000u #define ROM_PAGE_SEL 0x46e8u /* Write */ #define ADVFUNC_CNTL 0x4ae8u /* Write */ #define DISABPASSTHRU 0x0001u #define CLOKSEL 0x0004u /* ? 0x4ee8u */ #define EXT_CONFIG_0 0x52e8u /* C & T 82C480 */ #define EXT_CONFIG_1 0x56e8u /* C & T 82C480 */ #define EXT_CONFIG_2 0x5ae8u /* C & T 82C480 */ #define EXT_CONFIG_3 0x5ee8u /* C & T 82C480 */ /* ? 0x62e8u */ /* ? 0x66e8u */ /* ? 0x6ae8u */ /* ? 0x6ee8u */ /* ? 0x72e8u */ /* ? 0x76e8u */ /* ? 0x7ae8u */ /* ? 0x7ee8u */ #define CUR_Y 0x82e8u #define CUR_X 0x86e8u #define DESTY_AXSTP 0x8ae8u /* Write */ #define DESTX_DIASTP 0x8ee8u /* Write */ #define ERR_TERM 0x92e8u #define MAJ_AXIS_PCNT 0x96e8u /* Write */ #define GP_STAT 0x9ae8u /* Read */ #define GE_STAT 0x9ae8u /* Alias */ #define DATARDY 0x0100u #define DATA_READY DATARDY /* Alias */ #define GPBUSY 0x0200u #define CMD 0x9ae8u /* Write */ #define WRTDATA 0x0001u #define PLANAR 0x0002u #define LASTPIX 0x0004u #define LINETYPE 0x0008u #define DRAW 0x0010u #define INC_X 0x0020u #define YMAJAXIS 0x0040u #define INC_Y 0x0080u #define PCDATA 0x0100u #define _16BIT 0x0200u #define CMD_NOP 0x0000u #define CMD_OP_MSK 0xf000u #define BYTSEQ 0x1000u #define CMD_LINE 0x2000u #define CMD_RECT 0x4000u #define CMD_RECTV1 0x6000u #define CMD_RECTV2 0x8000u #define CMD_LINEAF 0xa000u #define CMD_BITBLT 0xc000u #define SHORT_STROKE 0x9ee8u /* Write */ #define SSVDRAW 0x0010u #define VECDIR_000 0x0000u #define VECDIR_045 0x0020u #define VECDIR_090 0x0040u #define VECDIR_135 0x0060u #define VECDIR_180 0x0080u #define VECDIR_225 0x00a0u #define VECDIR_270 0x00c0u #define VECDIR_315 0x00e0u #define BKGD_COLOR 0xa2e8u /* Write */ #define FRGD_COLOR 0xa6e8u /* Write */ #define WRT_MASK 0xaae8u /* Write */ #define RD_MASK 0xaee8u /* Write */ #define COLOR_CMP 0xb2e8u /* Write */ #define BKGD_MIX 0xb6e8u /* Write */ /* 0x001fu See MIX_* definitions below */ #define BSS_BKGDCOL 0x0000u #define BSS_FRGDCOL 0x0020u #define BSS_PCDATA 0x0040u #define BSS_BITBLT 0x0060u #define FRGD_MIX 0xbae8u /* Write */ /* 0x001fu See MIX_* definitions below */ #define FSS_BKGDCOL 0x0000u #define FSS_FRGDCOL 0x0020u #define FSS_PCDATA 0x0040u #define FSS_BITBLT 0x0060u #define MULTIFUNC_CNTL 0xbee8u /* Write */ #define MIN_AXIS_PCNT 0x0000u #define SCISSORS_T 0x1000u #define SCISSORS_L 0x2000u #define SCISSORS_B 0x3000u #define SCISSORS_R 0x4000u #define M32_MEM_CNTL 0x5000u #define HORCFG_4 0x0000u #define HORCFG_5 0x0001u #define HORCFG_8 0x0002u #define HORCFG_10 0x0003u #define VRTCFG_2 0x0000u #define VRTCFG_4 0x0004u #define VRTCFG_6 0x0008u #define VRTCFG_8 0x000cu #define BUFSWP 0x0010u #define PATTERN_L 0x8000u #define PATTERN_H 0x9000u #define PIX_CNTL 0xa000u #define PLANEMODE 0x0004u #define COLCMPOP_F 0x0000u #define COLCMPOP_T 0x0008u #define COLCMPOP_GE 0x0010u #define COLCMPOP_LT 0x0018u #define COLCMPOP_NE 0x0020u #define COLCMPOP_EQ 0x0028u #define COLCMPOP_LE 0x0030u #define COLCMPOP_GT 0x0038u #define MIXSEL_FRGDMIX 0x0000u #define MIXSEL_PATT 0x0040u #define MIXSEL_EXPPC 0x0080u #define MIXSEL_EXPBLT 0x00c0u /* ? 0xc2e8u */ /* ? 0xc6e8u */ /* ? 0xcae8u */ /* ? 0xcee8u */ /* ? 0xd2e8u */ /* ? 0xd6e8u */ /* ? 0xdae8u */ /* ? 0xdee8u */ #define PIX_TRANS 0xe2e8u /* ? 0xe6e8u */ /* ? 0xeae8u */ /* ? 0xeee8u */ /* ? 0xf2e8u */ /* ? 0xf6e8u */ /* ? 0xfae8u */ /* ? 0xfee8u */ /* ATI Mach8 & Mach32 register definitions */ #define OVERSCAN_COLOR_8 0x02eeu /* Write */ /* Mach32 */ #define OVERSCAN_BLUE_24 0x02efu /* Write */ /* Mach32 */ #define OVERSCAN_GREEN_24 0x06eeu /* Write */ /* Mach32 */ #define OVERSCAN_RED_24 0x06efu /* Write */ /* Mach32 */ #define CURSOR_OFFSET_LO 0x0aeeu /* Write */ /* Mach32 */ #define CURSOR_OFFSET_HI 0x0eeeu /* Write */ /* Mach32 */ #define CONFIG_STATUS_1 0x12eeu /* Read */ #define CLK_MODE 0x0001u /* Mach8 */ #define BUS_16 0x0002u /* Mach8 */ #define MC_BUS 0x0004u /* Mach8 */ #define EEPROM_ENA 0x0008u /* Mach8 */ #define DRAM_ENA 0x0010u /* Mach8 */ #define MEM_INSTALLED 0x0060u /* Mach8 */ #define ROM_ENA 0x0080u /* Mach8 */ #define ROM_PAGE_ENA 0x0100u /* Mach8 */ #define ROM_LOCATION 0xfe00u /* Mach8 */ #define _8514_ONLY 0x0001u /* Mach32 */ #define BUS_TYPE 0x000eu /* Mach32 */ #define ISA_16_BIT 0x0000u /* Mach32 */ #define EISA 0x0002u /* Mach32 */ #define MICRO_C_16_BIT 0x0004u /* Mach32 */ #define MICRO_C_8_BIT 0x0006u /* Mach32 */ #define LOCAL_386SX 0x0008u /* Mach32 */ #define LOCAL_386DX 0x000au /* Mach32 */ #define LOCAL_486 0x000cu /* Mach32 */ #define PCI 0x000eu /* Mach32 */ #define MEM_TYPE 0x0070u /* Mach32 */ #define CHIP_DIS 0x0080u /* Mach32 */ #define TST_VCTR_ENA 0x0100u /* Mach32 */ #define DACTYPE 0x0e00u /* Mach32 */ #define MC_ADR_DECODE 0x1000u /* Mach32 */ #define CARD_ID 0xe000u /* Mach32 */ #define HORZ_CURSOR_POSN 0x12eeu /* Write */ /* Mach32 */ #define CONFIG_STATUS_2 0x16eeu /* Read */ #define SHARE_CLOCK 0x0001u /* Mach8 */ #define HIRES_BOOT 0x0002u /* Mach8 */ #define EPROM_16_ENA 0x0004u /* Mach8 */ #define WRITE_PER_BIT 0x0008u /* Mach8 */ #define FLASH_ENA 0x0010u /* Mach8 */ #define SLOW_SEQ_EN 0x0001u /* Mach32 */ #define MEM_ADDR_DIS 0x0002u /* Mach32 */ #define ISA_16_ENA 0x0004u /* Mach32 */ #define KOR_TXT_MODE_ENA 0x0008u /* Mach32 */ #define LOCAL_BUS_SUPPORT 0x0030u /* Mach32 */ #define LOCAL_BUS_CONFIG_2 0x0040u /* Mach32 */ #define LOCAL_BUS_RD_DLY_ENA 0x0080u /* Mach32 */ #define LOCAL_DAC_EN 0x0100u /* Mach32 */ #define LOCAL_RDY_EN 0x0200u /* Mach32 */ #define EEPROM_ADR_SEL 0x0400u /* Mach32 */ #define GE_STRAP_SEL 0x0800u /* Mach32 */ #define VESA_RDY 0x1000u /* Mach32 */ #define Z4GB 0x2000u /* Mach32 */ #define LOC2_MDRAM 0x4000u /* Mach32 */ #define VERT_CURSOR_POSN 0x16eeu /* Write */ /* Mach32 */ #define FIFO_TEST_DATA 0x1aeeu /* Read */ /* Mach32 */ #define CURSOR_COLOR_0 0x1aeeu /* Write */ /* Mach32 */ #define CURSOR_COLOR_1 0x1aefu /* Write */ /* Mach32 */ #define HORZ_CURSOR_OFFSET 0x1eeeu /* Write */ /* Mach32 */ #define VERT_CURSOR_OFFSET 0x1eefu /* Write */ /* Mach32 */ #define PCI_CNTL 0x22eeu /* Mach32-PCI */ #define CRT_PITCH 0x26eeu /* Write */ #define CRT_OFFSET_LO 0x2aeeu /* Write */ #define CRT_OFFSET_HI 0x2eeeu /* Write */ #define LOCAL_CNTL 0x32eeu /* Mach32 */ #define FIFO_OPT 0x36eeu /* Write */ /* Mach8 */ #define MISC_OPTIONS 0x36eeu /* Mach32 */ #define W_STATE_ENA 0x0000u /* Mach32 */ #define HOST_8_ENA 0x0001u /* Mach32 */ #define MEM_SIZE_ALIAS 0x000cu /* Mach32 */ #define MEM_SIZE_512K 0x0000u /* Mach32 */ #define MEM_SIZE_1M 0x0004u /* Mach32 */ #define MEM_SIZE_2M 0x0008u /* Mach32 */ #define MEM_SIZE_4M 0x000cu /* Mach32 */ #define DISABLE_VGA 0x0010u /* Mach32 */ #define _16_BIT_IO 0x0020u /* Mach32 */ #define DISABLE_DAC 0x0040u /* Mach32 */ #define DLY_LATCH_ENA 0x0080u /* Mach32 */ #define TEST_MODE 0x0100u /* Mach32 */ #define BLK_WR_ENA 0x0400u /* Mach32 */ #define _64_DRAW_ENA 0x0800u /* Mach32 */ #define FIFO_TEST_TAG 0x3aeeu /* Read */ /* Mach32 */ #define EXT_CURSOR_COLOR_0 0x3aeeu /* Write */ /* Mach32 */ #define EXT_CURSOR_COLOR_1 0x3eeeu /* Write */ /* Mach32 */ #define MEM_BNDRY 0x42eeu /* Mach32 */ #define MEM_PAGE_BNDRY 0x000fu /* Mach32 */ #define MEM_BNDRY_ENA 0x0010u /* Mach32 */ #define SHADOW_CTL 0x46eeu /* Write */ #define CLOCK_SEL 0x4aeeu /* DISABPASSTHRU 0x0001u See ADVFUNC_CNTL */ #define VFIFO_DEPTH_1 0x0100u /* Mach32 */ #define VFIFO_DEPTH_2 0x0200u /* Mach32 */ #define VFIFO_DEPTH_3 0x0300u /* Mach32 */ #define VFIFO_DEPTH_4 0x0400u /* Mach32 */ #define VFIFO_DEPTH_5 0x0500u /* Mach32 */ #define VFIFO_DEPTH_6 0x0600u /* Mach32 */ #define VFIFO_DEPTH_7 0x0700u /* Mach32 */ #define VFIFO_DEPTH_8 0x0800u /* Mach32 */ #define VFIFO_DEPTH_9 0x0900u /* Mach32 */ #define VFIFO_DEPTH_A 0x0a00u /* Mach32 */ #define VFIFO_DEPTH_B 0x0b00u /* Mach32 */ #define VFIFO_DEPTH_C 0x0c00u /* Mach32 */ #define VFIFO_DEPTH_D 0x0d00u /* Mach32 */ #define VFIFO_DEPTH_E 0x0e00u /* Mach32 */ #define VFIFO_DEPTH_F 0x0f00u /* Mach32 */ #define COMPOSITE_SYNC 0x1000u /* ? 0x4eeeu */ #define ROM_ADDR_1 0x52eeu #define BIOS_BASE_SEGMENT 0x007fu /* Mach32 */ /* ? 0xff80u */ /* Mach32 */ #define ROM_ADDR_2 0x56eeu /* Sick ... */ #define SHADOW_SET 0x5aeeu /* Write */ #define MEM_CFG 0x5eeeu /* Mach32 */ #define MEM_APERT_SEL 0x0003u /* Mach32 */ #define MEM_APERT_PAGE 0x000cu /* Mach32 */ #define MEM_APERT_LOC 0xfff0u /* Mach32 */ #define EXT_GE_STATUS 0x62eeu /* Read */ /* Mach32 */ #define HORZ_OVERSCAN 0x62eeu /* Write */ /* Mach32 */ #define VERT_OVERSCAN 0x66eeu /* Write */ /* Mach32 */ #define MAX_WAITSTATES 0x6aeeu #define GE_OFFSET_LO 0x6eeeu /* Write */ #define BOUNDS_LEFT 0x72eeu /* Read */ #define GE_OFFSET_HI 0x72eeu /* Write */ #define BOUNDS_TOP 0x76eeu /* Read */ #define GE_PITCH 0x76eeu /* Write */ #define BOUNDS_RIGHT 0x7aeeu /* Read */ #define EXT_GE_CONFIG 0x7aeeu /* Write */ /* Mach32 */ #define MONITOR_ALIAS 0x0007u /* Mach32 */ /* MONITOR_? 0x0000u */ /* Mach32 */ #define MONITOR_8507 0x0001u /* Mach32 */ #define MONITOR_8514 0x0002u /* Mach32 */ /* MONITOR_? 0x0003u */ /* Mach32 */ /* MONITOR_? 0x0004u */ /* Mach32 */ #define MONITOR_8503 0x0005u /* Mach32 */ #define MONITOR_8512 0x0006u /* Mach32 */ #define MONITOR_8513 0x0006u /* Mach32 */ #define MONITOR_NONE 0x0007u /* Mach32 */ #define ALIAS_ENA 0x0008u /* Mach32 */ #define PIXEL_WIDTH_4 0x0000u /* Mach32 */ #define PIXEL_WIDTH_8 0x0010u /* Mach32 */ #define PIXEL_WIDTH_16 0x0020u /* Mach32 */ #define PIXEL_WIDTH_24 0x0030u /* Mach32 */ #define RGB16_555 0x0000u /* Mach32 */ #define RGB16_565 0x0040u /* Mach32 */ #define RGB16_655 0x0080u /* Mach32 */ #define RGB16_664 0x00c0u /* Mach32 */ #define MULTIPLEX_PIXELS 0x0100u /* Mach32 */ #define RGB24 0x0000u /* Mach32 */ #define RGBx24 0x0200u /* Mach32 */ #define BGR24 0x0400u /* Mach32 */ #define xBGR24 0x0600u /* Mach32 */ #define DAC_8_BIT_EN 0x4000u /* Mach32 */ #define ORDER_16BPP_565 RGB16_565 /* Mach32 */ #define BOUNDS_BOTTOM 0x7eeeu /* Read */ #define MISC_CNTL 0x7eeeu /* Write */ /* Mach32 */ #define PATT_DATA_INDEX 0x82eeu /* ? 0x86eeu */ /* ? 0x8aeeu */ #define R_EXT_GE_CONFIG 0x8eeeu /* Read */ /* Mach32 */ #define PATT_DATA 0x8eeeu /* Write */ #define R_MISC_CNTL 0x92eeu /* Read */ /* Mach32 */ #define BRES_COUNT 0x96eeu #define EXT_FIFO_STATUS 0x9aeeu /* Read */ #define LINEDRAW_INDEX 0x9aeeu /* Write */ /* ? 0x9eeeu */ #define LINEDRAW_OPT 0xa2eeu #define BOUNDS_RESET 0x0100u #define CLIP_MODE_0 0x0000u /* Clip exception disabled */ #define CLIP_MODE_1 0x0200u /* Line segments */ #define CLIP_MODE_2 0x0400u /* Polygon boundary lines */ #define CLIP_MODE_3 0x0600u /* Patterned lines */ #define DEST_X_START 0xa6eeu /* Write */ #define DEST_X_END 0xaaeeu /* Write */ #define DEST_Y_END 0xaeeeu /* Write */ #define R_H_TOTAL_DISP 0xb2eeu /* Read */ /* Mach32 */ #define SRC_X_STRT 0xb2eeu /* Write */ #define R_H_SYNC_STRT 0xb6eeu /* Read */ /* Mach32 */ #define ALU_BG_FN 0xb6eeu /* Write */ #define R_H_SYNC_WID 0xbaeeu /* Read */ /* Mach32 */ #define ALU_FG_FN 0xbaeeu /* Write */ #define SRC_X_END 0xbeeeu /* Write */ #define R_V_TOTAL 0xc2eeu /* Read */ #define SRC_Y_DIR 0xc2eeu /* Write */ #define R_V_DISP 0xc6eeu /* Read */ /* Mach32 */ #define EXT_SHORT_STROKE 0xc6eeu /* Write */ #define R_V_SYNC_STRT 0xcaeeu /* Read */ /* Mach32 */ #define SCAN_X 0xcaeeu /* Write */ #define VERT_LINE_CNTR 0xceeeu /* Read */ /* Mach32 */ #define DP_CONFIG 0xceeeu /* Write */ #define READ_WRITE 0x0001u #define DATA_WIDTH 0x0200u #define DATA_ORDER 0x1000u #define FG_COLOR_SRC_FG 0x2000u #define FG_COLOR_SRC_BLIT 0x6000u #define R_V_SYNC_WID 0xd2eeu /* Read */ #define PATT_LENGTH 0xd2eeu /* Write */ #define PATT_INDEX 0xd6eeu /* Write */ #define READ_SRC_X 0xdaeeu /* Read */ /* Mach32 */ #define EXT_SCISSOR_L 0xdaeeu /* Write */ #define READ_SRC_Y 0xdeeeu /* Read */ /* Mach32 */ #define EXT_SCISSOR_T 0xdeeeu /* Write */ #define EXT_SCISSOR_R 0xe2eeu /* Write */ #define EXT_SCISSOR_B 0xe6eeu /* Write */ /* ? 0xeaeeu */ #define DEST_COMP_FN 0xeeeeu /* Write */ #define DEST_COLOR_CMP_MASK 0xf2eeu /* Write */ /* Mach32 */ /* ? 0xf6eeu */ #define CHIP_ID 0xfaeeu /* Read */ /* Mach32 */ #define CHIP_CODE_0 0x001fu /* Mach32 */ #define CHIP_CODE_1 0x03e0u /* Mach32 */ #define CHIP_CLASS 0x0c00u /* Mach32 */ #define CHIP_REV 0xf000u /* Mach32 */ #define LINEDRAW 0xfeeeu /* Write */ /* ATI Mach64 register definitions */ #define CRTC_H_TOTAL_DISP IOPortTag(0x00u, 0x00u) # define CRTC_H_TOTAL 0x000001fful /* ? 0x0000fe00ul */ # define CRTC_H_DISP 0x01ff0000ul /* ? 0xfe000000ul */ #define CRTC_H_SYNC_STRT_WID IOPortTag(0x01u, 0x01u) # define CRTC_H_SYNC_STRT 0x000000fful # define CRTC_H_SYNC_DLY 0x00000700ul /* ? 0x00000800ul */ # define CRTC_H_SYNC_STRT_HI 0x00001000ul /* ? 0x0000e000ul */ # define CRTC_H_SYNC_WID 0x001f0000ul # define CRTC_H_SYNC_POL 0x00200000ul /* ? 0xffc00000ul */ #define CRTC_V_TOTAL_DISP IOPortTag(0x02u, 0x02u) # define CRTC_V_TOTAL 0x000007fful /* ? 0x0000f800ul */ # define CRTC_V_DISP 0x07ff0000ul /* ? 0xf8000000ul */ #define CRTC_V_SYNC_STRT_WID IOPortTag(0x03u, 0x03u) # define CRTC_V_SYNC_STRT 0x000007fful /* ? 0x0000f800ul */ # define CRTC_V_SYNC_WID 0x001f0000ul # define CRTC_V_SYNC_POL 0x00200000ul /* ? 0xffc00000ul */ #define CRTC_VLINE_CRNT_VLINE IOPortTag(0x04u, 0x04u) #define CRTC_VLINE 0x000007fful /* ? 0x0000f800ul */ #define CRTC_CRNT_VLINE 0x07ff0000ul /* ? 0xf8000000ul */ #define CRTC_OFF_PITCH IOPortTag(0x05u, 0x05u) # define CRTC_OFFSET 0x000ffffful # define CRTC_OFFSET_VGA 0x0003fffful # define CRTC_OFFSET_LOCK 0x00100000ul /* XC/XL */ /* ? 0x00200000ul */ # define CRTC_PITCH 0xffc00000ul #define CRTC_INT_CNTL IOPortTag(0x06u, 0x06u) # define CRTC_VBLANK 0x00000001ul # define CRTC_VBLANK_INT_EN 0x00000002ul # define CRTC_VBLANK_INT 0x00000004ul # define CRTC_VLINE_INT_EN 0x00000008ul # define CRTC_VLINE_INT 0x00000010ul # define CRTC_VLINE_SYNC 0x00000020ul # define CRTC_FRAME 0x00000040ul # define CRTC_SNAPSHOT_INT_EN 0x00000080ul /* GTPro */ # define CRTC_SNAPSHOT_INT 0x00000100ul /* GTPro */ # define CRTC_I2C_INT_EN 0x00000200ul /* GTPro */ # define CRTC_I2C_INT 0x00000400ul /* GTPro */ # define CRTC2_VBLANK 0x00000800ul /* LTPro */ # define CRTC2_VBLANK_INT_EN 0x00001000ul /* LTPro */ # define CRTC2_VBLANK_INT 0x00002000ul /* LTPro */ # define CRTC2_VLINE_INT_EN 0x00004000ul /* LTPro */ # define CRTC2_VLINE_INT 0x00008000ul /* LTPro */ # define CRTC_CAPBUF0_INT_EN 0x00010000ul /* VT/GT */ # define CRTC_CAPBUF0_INT 0x00020000ul /* VT/GT */ # define CRTC_CAPBUF1_INT_EN 0x00040000ul /* VT/GT */ # define CRTC_CAPBUF1_INT 0x00080000ul /* VT/GT */ # define CRTC_OVERLAY_EOF_INT_EN 0x00100000ul /* VT/GT */ # define CRTC_OVERLAY_EOF_INT 0x00200000ul /* VT/GT */ # define CRTC_ONESHOT_CAP_INT_EN 0x00400000ul /* VT/GT */ # define CRTC_ONESHOT_CAP_INT 0x00800000ul /* VT/GT */ # define CRTC_BUSMASTER_EOL_INT_EN 0x01000000ul /* VTB/GTB/LT */ # define CRTC_BUSMASTER_EOL_INT 0x02000000ul /* VTB/GTB/LT */ # define CRTC_GP_INT_EN 0x04000000ul /* VTB/GTB/LT */ # define CRTC_GP_INT 0x08000000ul /* VTB/GTB/LT */ # define CRTC2_VLINE_SYNC 0x10000000ul /* LTPro */ # define CRTC_SNAPSHOT2_INT_EN 0x20000000ul /* LTPro */ # define CRTC_SNAPSHOT2_INT 0x40000000ul /* LTPro */ # define CRTC_VBLANK_BIT2_INT 0x80000000ul /* GTPro */ # define CRTC_INT_ENS /* *** UPDATE ME *** */ \ ( \ CRTC_VBLANK_INT_EN | \ CRTC_VLINE_INT_EN | \ CRTC_SNAPSHOT_INT_EN | \ CRTC_I2C_INT_EN | \ CRTC2_VBLANK_INT_EN | \ CRTC2_VLINE_INT_EN | \ CRTC_CAPBUF0_INT_EN | \ CRTC_CAPBUF1_INT_EN | \ CRTC_OVERLAY_EOF_INT_EN | \ CRTC_ONESHOT_CAP_INT_EN | \ CRTC_BUSMASTER_EOL_INT_EN | \ CRTC_GP_INT_EN | \ CRTC_SNAPSHOT2_INT_EN | \ 0 \ ) # define CRTC_INT_ACKS /* *** UPDATE ME *** */ \ ( \ CRTC_VBLANK_INT | \ CRTC_VLINE_INT | \ CRTC_SNAPSHOT_INT | \ CRTC_I2C_INT | \ CRTC2_VBLANK_INT | \ CRTC2_VLINE_INT | \ CRTC_CAPBUF0_INT | \ CRTC_CAPBUF1_INT | \ CRTC_OVERLAY_EOF_INT | \ CRTC_ONESHOT_CAP_INT | \ CRTC_BUSMASTER_EOL_INT | \ CRTC_GP_INT | \ CRTC_SNAPSHOT2_INT | \ CRTC_VBLANK_BIT2_INT | \ 0 \ ) #define CRTC_GEN_CNTL IOPortTag(0x07u, 0x07u) # define CRTC_DBL_SCAN_EN 0x00000001ul # define CRTC_INTERLACE_EN 0x00000002ul # define CRTC_HSYNC_DIS 0x00000004ul # define CRTC_VSYNC_DIS 0x00000008ul # define CRTC_CSYNC_EN 0x00000010ul # define CRTC_PIX_BY_2_EN 0x00000020ul # define CRTC2_DBL_SCAN_EN 0x00000020ul /* LTPro */ # define CRTC_DISPLAY_DIS 0x00000040ul # define CRTC_VGA_XOVERSCAN 0x00000080ul # define CRTC_PIX_WIDTH 0x00000700ul # define CRTC_BYTE_PIX_ORDER 0x00000800ul # define CRTC_VSYNC_INT_EN 0x00001000ul /* XC/XL */ # define CRTC_VSYNC_INT 0x00002000ul /* XC/XL */ # define CRTC_FIFO_OVERFILL 0x0000c000ul /* VT/GT */ # define CRTC2_VSYNC_INT_EN 0x00004000ul /* XC/XL */ # define CRTC2_VSYNC_INT 0x00008000ul /* XC/XL */ # define CRTC_FIFO_LWM 0x000f0000ul # define CRTC_HVSYNC_IO_DRIVE 0x00010000ul /* XC/XL */ # define CRTC2_PIX_WIDTH 0x000e0000ul /* LTPro */ # define CRTC_VGA_128KAP_PAGING 0x00100000ul /* VT/GT */ # define CRTC_DISPREQ_ONLY 0x00200000ul /* VT/GT */ # define CRTC_VFC_SYNC_TRISTATE 0x00200000ul /* VTB/GTB/LT */ # define CRTC2_EN 0x00200000ul /* LTPro */ # define CRTC_LOCK_REGS 0x00400000ul /* VT/GT */ # define CRTC_SYNC_TRISTATE 0x00800000ul /* VT/GT */ # define CRTC_EXT_DISP_EN 0x01000000ul # define CRTC_EN 0x02000000ul # define CRTC_DISP_REQ_EN 0x04000000ul # define CRTC_VGA_LINEAR 0x08000000ul # define CRTC_VSYNC_FALL_EDGE 0x10000000ul # define CRTC_VGA_TEXT_132 0x20000000ul # define CRTC_CNT_EN 0x40000000ul # define CRTC_CUR_B_TEST 0x80000000ul # define CRTC_INT_ENS_X /* *** UPDATE ME *** */ \ ( \ CRTC_VSYNC_INT_EN | \ CRTC2_VSYNC_INT_EN | \ 0 \ ) # define CRTC_INT_ACKS_X /* *** UPDATE ME *** */ \ ( \ CRTC_VSYNC_INT | \ CRTC2_VSYNC_INT | \ 0 \ ) #define DSP_CONFIG BlockIOTag(0x08u) /* VTB/GTB/LT */ # define DSP_XCLKS_PER_QW 0x00003ffful /* ? 0x00004000ul */ # define DSP_FLUSH_WB 0x00008000ul # define DSP_LOOP_LATENCY 0x000f0000ul # define DSP_PRECISION 0x00700000ul /* ? 0xff800000ul */ #define DSP_ON_OFF BlockIOTag(0x09u) /* VTB/GTB/LT */ # define DSP_OFF 0x000007fful /* ? 0x0000f800ul */ # define DSP_ON 0x07ff0000ul /* ? 0xf8000000ul */ #define TIMER_CONFIG BlockIOTag(0x0au) /* VTB/GTB/LT */ #define MEM_BUF_CNTL BlockIOTag(0x0bu) /* VTB/GTB/LT */ #define SHARED_CNTL BlockIOTag(0x0cu) /* VTB/GTB/LT */ #define SHARED_MEM_CONFIG BlockIOTag(0x0du) /* VTB/GTB/LT */ #define MEM_ADDR_CONFIG BlockIOTag(0x0du) /* GTPro */ #define SHARED_CNTL_CTD BlockIOTag(0x0eu) /* CTD */ /* ? 0x00fffffful */ #define CTD_FIFO5 0x01000000ul /* ? 0xfe000000ul */ #define CRT_TRAP BlockIOTag(0x0eu) /* VTB/GTB/LT */ #define DSTN_CONTROL BlockIOTag(0x0fu) /* LT */ #define I2C_CNTL_0 BlockIOTag(0x0fu) /* GTPro */ #define OVR_CLR IOPortTag(0x08u, 0x10u) # define OVR_CLR_8 0x000000fful # define OVR_CLR_B 0x0000ff00ul # define OVR_CLR_G 0x00ff0000ul # define OVR_CLR_R 0xff000000ul #define OVR_WID_LEFT_RIGHT IOPortTag(0x09u, 0x11u) # define OVR_WID_LEFT 0x0000003ful /* 0x0f on #include #include #include #include #include #include #include #include #include /* for m(un)lock */ #ifdef HAVE_MALLOC_H #include #ifdef HAVE_MEMALIGN #define MACH64_ENABLE_BM 1 #endif #endif #include "../../config.h" #include "../../bswap.h" #include "../vidix.h" #include "../fourcc.h" #include "../../libdha/libdha.h" #include "../../libdha/pci_ids.h" #include "../../libdha/pci_names.h" #include "mach64.h" #define UNUSED(x) ((void)(x)) /**< Removes warning about unused arguments */ #define VIDIX_STATIC mach64_ #ifdef MACH64_ENABLE_BM #define cpu_to_le32(a) (a) #define VIRT_TO_CARD(a,b,c) bm_virt_to_bus(a,b,c) #pragma pack(1) typedef struct { uint32_t framebuf_offset; uint32_t sys_addr; uint32_t command; uint32_t reserved; } bm_list_descriptor; #pragma pack() static void *mach64_dma_desc_base[64]; static unsigned long bus_addr_dma_desc = 0; static unsigned long *dma_phys_addrs; #endif static void *mach64_mmio_base = 0; static void *mach64_mem_base = 0; static int32_t mach64_overlay_offset = 0; static uint32_t mach64_ram_size = 0; static uint32_t mach64_buffer_base[64][3]; static int num_mach64_buffers=-1; static int supports_planar=0; static int supports_colour_adj=0; static int supports_idct=0; static int supports_subpic=0; static int supports_lcd_v_stretch=0; pciinfo_t pci_info; static int probed = 0; static int __verbose = 0; #define VERBOSE_LEVEL 2 typedef struct bes_registers_s { /* base address of yuv framebuffer */ uint32_t yuv_base; uint32_t fourcc; /* YUV BES registers */ uint32_t reg_load_cntl; uint32_t scale_inc; uint32_t y_x_start; uint32_t y_x_end; uint32_t vid_buf_pitch; uint32_t height_width; uint32_t scale_cntl; uint32_t exclusive_horz; uint32_t auto_flip_cntl; uint32_t filter_cntl; uint32_t key_cntl; uint32_t test; /* Configurable stuff */ int brightness; int saturation; int ckey_on; uint32_t graphics_key_clr; uint32_t graphics_key_msk; int deinterlace_on; uint32_t deinterlace_pattern; } bes_registers_t; static bes_registers_t besr; typedef struct video_registers_s { const char * sname; uint32_t name; uint32_t value; }video_registers_t; static bes_registers_t besr; /* Graphic keys */ static vidix_grkey_t mach64_grkey; #define DECLARE_VREG(name) { #name, name, 0 } static video_registers_t vregs[] = { DECLARE_VREG(OVERLAY_SCALE_INC), DECLARE_VREG(OVERLAY_Y_X_START), DECLARE_VREG(OVERLAY_Y_X_END), DECLARE_VREG(OVERLAY_SCALE_CNTL), DECLARE_VREG(OVERLAY_EXCLUSIVE_HORZ), DECLARE_VREG(OVERLAY_EXCLUSIVE_VERT), DECLARE_VREG(OVERLAY_TEST), DECLARE_VREG(SCALER_BUF_PITCH), DECLARE_VREG(SCALER_HEIGHT_WIDTH), DECLARE_VREG(SCALER_BUF0_OFFSET), DECLARE_VREG(SCALER_BUF0_OFFSET_U), DECLARE_VREG(SCALER_BUF0_OFFSET_V), DECLARE_VREG(SCALER_BUF1_OFFSET), DECLARE_VREG(SCALER_BUF1_OFFSET_U), DECLARE_VREG(SCALER_BUF1_OFFSET_V), DECLARE_VREG(SCALER_H_COEFF0), DECLARE_VREG(SCALER_H_COEFF1), DECLARE_VREG(SCALER_H_COEFF2), DECLARE_VREG(SCALER_H_COEFF3), DECLARE_VREG(SCALER_H_COEFF4), DECLARE_VREG(SCALER_COLOUR_CNTL), DECLARE_VREG(SCALER_THRESHOLD), DECLARE_VREG(VIDEO_FORMAT), DECLARE_VREG(VIDEO_CONFIG), DECLARE_VREG(VIDEO_SYNC_TEST), DECLARE_VREG(VIDEO_SYNC_TEST_B), DECLARE_VREG(BUS_CNTL), DECLARE_VREG(SRC_CNTL), DECLARE_VREG(GUI_STAT), DECLARE_VREG(BM_ADDR), DECLARE_VREG(BM_DATA), DECLARE_VREG(BM_HOSTDATA), DECLARE_VREG(BM_GUI_TABLE_CMD), DECLARE_VREG(BM_FRAME_BUF_OFFSET), DECLARE_VREG(BM_SYSTEM_MEM_ADDR), DECLARE_VREG(BM_COMMAND), DECLARE_VREG(BM_STATUS), DECLARE_VREG(BM_GUI_TABLE), DECLARE_VREG(BM_SYSTEM_TABLE), DECLARE_VREG(AGP_BASE), DECLARE_VREG(AGP_CNTL), DECLARE_VREG(CRTC_INT_CNTL) }; /* VIDIX exports */ /* MMIO space*/ #define GETREG(TYPE,PTR,OFFZ) (*((volatile TYPE*)((PTR)+(OFFZ)))) #define SETREG(TYPE,PTR,OFFZ,VAL) (*((volatile TYPE*)((PTR)+(OFFZ))))=VAL #define INREG8(addr) GETREG(uint8_t,(uint32_t)mach64_mmio_base,((addr)^0x100)<<2) #define OUTREG8(addr,val) SETREG(uint8_t,(uint32_t)mach64_mmio_base,((addr)^0x100)<<2,val) static inline uint32_t INREG (uint32_t addr) { uint32_t tmp = GETREG(uint32_t,(uint32_t)mach64_mmio_base,((addr)^0x100)<<2); return le2me_32(tmp); } #define OUTREG(addr,val) SETREG(uint32_t,(uint32_t)mach64_mmio_base,((addr)^0x100)<<2,me2le_32(val)) #define OUTREGP(addr,val,mask) \ do { \ unsigned int _tmp = INREG(addr); \ _tmp &= (mask); \ _tmp |= (val); \ OUTREG(addr, _tmp); \ } while (0) static __inline__ int ATIGetMach64LCDReg(int _Index) { OUTREG8(LCD_INDEX, _Index); return INREG(LCD_DATA); } static __inline__ uint32_t INPLL(uint32_t addr) { uint32_t res; uint32_t in; in= INREG(CLOCK_CNTL); in &= ~((PLL_WR_EN | PLL_ADDR)); //clean some stuff OUTREG(CLOCK_CNTL, in | (addr<<10)); /* read the register value */ res = (INREG(CLOCK_CNTL)>>16)&0xFF; return res; } static __inline__ void OUTPLL(uint32_t addr,uint32_t val) { //FIXME buggy but its not used /* write addr byte */ OUTREG8(CLOCK_CNTL + 1, (addr << 2) | PLL_WR_EN); /* write the register value */ OUTREG(CLOCK_CNTL + 2, val); OUTREG8(CLOCK_CNTL + 1, (addr << 2) & ~PLL_WR_EN); } #define OUTPLLP(addr,val,mask) \ do { \ unsigned int _tmp = INPLL(addr); \ _tmp &= (mask); \ _tmp |= (val); \ OUTPLL(addr, _tmp); \ } while (0) static void mach64_engine_reset( void ) { /* Kill off bus mastering with extreme predjudice... */ OUTREG(BUS_CNTL, INREG(BUS_CNTL) | BUS_MASTER_DIS); OUTREG(CRTC_INT_CNTL,INREG(CRTC_INT_CNTL)&~(CRTC_BUSMASTER_EOL_INT|CRTC_BUSMASTER_EOL_INT_EN)); /* Reset engine -- This is accomplished by setting bit 8 of the GEN_TEST_CNTL register high, then low (per the documentation, it's on high to low transition that the GUI engine gets reset...) */ OUTREG( GEN_TEST_CNTL, INREG( GEN_TEST_CNTL ) | GEN_GUI_EN ); OUTREG( GEN_TEST_CNTL, INREG( GEN_TEST_CNTL ) & ~GEN_GUI_EN ); } static void mach64_fifo_wait(unsigned n) { while ((INREG(FIFO_STAT) & 0xffff) > ((uint32_t)(0x8000 >> n))); } static void mach64_wait_for_idle( void ) { unsigned i; mach64_fifo_wait(16); for (i=0; i<2000000; i++) if((INREG(GUI_STAT) & GUI_ACTIVE) == 0) break; if((INREG(GUI_STAT) & 1) != 0) mach64_engine_reset(); /* due card lookup */ } static void mach64_wait_vsync( void ) { int i; for(i=0; i<2000000; i++) if( (INREG(CRTC_INT_CNTL)&CRTC_VBLANK)==0 ) break; for(i=0; i<2000000; i++) if( (INREG(CRTC_INT_CNTL)&CRTC_VBLANK) ) break; } static vidix_capability_t mach64_cap = { "BES driver for Mach64/3DRage cards", "Nick Kurshev and Michael Niedermayer", TYPE_OUTPUT, { 0, 0, 0, 0 }, 2048, 2048, 4, 4, -1, FLAG_UPSCALER|FLAG_DOWNSCALER, VENDOR_ATI, -1, { 0, 0, 0, 0 } }; static uint32_t mach64_vid_get_dbpp( void ) { uint32_t dbpp,retval; dbpp = (INREG(CRTC_GEN_CNTL)>>8)& 0x7; switch(dbpp) { case 1: retval = 4; break; case 2: retval = 8; break; case 3: retval = 15; break; case 4: retval = 16; break; case 5: retval = 24; break; default: retval=32; break; } return retval; } static int mach64_is_dbl_scan( void ) { return INREG(CRTC_GEN_CNTL) & CRTC_DBL_SCAN_EN; } static int mach64_is_interlace( void ) { return INREG(CRTC_GEN_CNTL) & CRTC_INTERLACE_EN; } static uint32_t mach64_get_xres( void ) { /* FIXME: currently we extract that from CRTC!!!*/ uint32_t xres,h_total; h_total = INREG(CRTC_H_TOTAL_DISP); xres = (h_total >> 16) & 0xffff; return (xres + 1)*8; } static uint32_t mach64_get_yres( void ) { /* FIXME: currently we extract that from CRTC!!!*/ uint32_t yres,v_total; v_total = INREG(CRTC_V_TOTAL_DISP); yres = (v_total >> 16) & 0xffff; return yres + 1; } // returns the verical stretch factor in 16.16 static int mach64_get_vert_stretch(void) { int lcd_index; int vert_stretching; int ext_vert_stretch; int ret; int yres= mach64_get_yres(); if(!supports_lcd_v_stretch){ if(__verbose>0) printf("[mach64] vertical stretching not supported\n"); return 1<<16; } lcd_index= INREG(LCD_INDEX); vert_stretching= ATIGetMach64LCDReg(LCD_VERT_STRETCHING); if(!(vert_stretching&VERT_STRETCH_EN)) ret= 1<<16; else { int panel_size; ext_vert_stretch= ATIGetMach64LCDReg(LCD_EXT_VERT_STRETCH); panel_size= (ext_vert_stretch&VERT_PANEL_SIZE)>>11; panel_size++; ret= ((yres<<16) + (panel_size>>1))/panel_size; } // lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL); OUTREG(LCD_INDEX, lcd_index); if(__verbose>0) printf("[mach64] vertical stretching factor= %d\n", ret); return ret; } static void mach64_vid_make_default() { mach64_fifo_wait(5); OUTREG(SCALER_COLOUR_CNTL,0x00101000); besr.ckey_on=0; besr.graphics_key_msk=0; besr.graphics_key_clr=0; OUTREG(OVERLAY_GRAPHICS_KEY_MSK, besr.graphics_key_msk); OUTREG(OVERLAY_GRAPHICS_KEY_CLR, besr.graphics_key_clr); OUTREG(OVERLAY_KEY_CNTL,VIDEO_KEY_FN_TRUE|GRAPHIC_KEY_FN_EQ|CMP_MIX_AND); } static void mach64_vid_dump_regs( void ) { size_t i; printf("[mach64] *** Begin of DRIVER variables dump ***\n"); printf("[mach64] mach64_mmio_base=%p\n",mach64_mmio_base); printf("[mach64] mach64_mem_base=%p\n",mach64_mem_base); printf("[mach64] mach64_overlay_off=%08X\n",mach64_overlay_offset); printf("[mach64] mach64_ram_size=%08X\n",mach64_ram_size); printf("[mach64] video mode: %ux%u@%u\n",mach64_get_xres(),mach64_get_yres(),mach64_vid_get_dbpp()); printf("[mach64] *** Begin of OV0 registers dump ***\n"); for(i=0;i PROBE_NORMAL) { printf("[mach64] Driver was forced. Was found %sknown chip\n",idx == -1 ? "un" : ""); if(idx == -1) printf("[mach64] Assuming it as Mach64\n"); } if(idx != -1) is_agp = ati_card_ids[idx].is_agp; mach64_cap.device_id = lst[i].device; err = 0; memcpy(&pci_info,&lst[i],sizeof(pciinfo_t)); probed=1; break; } } } if(err && verbose) printf("[mach64] Can't find chip\n"); return err; } static void reset_regs( void ) { size_t i; for(i=0;i0) printf("[mach64] version %d args='%s'\n", VIDIX_VERSION,args); if(args) if(strncmp(args,"irq=",4) == 0) { forced_irq=atoi(&args[4]); if(__verbose>0) printf("[mach64] forcing IRQ to %u\n",forced_irq); } if((mach64_mmio_base = map_phys_mem(pci_info.base2,0x4000))==(void *)-1) return ENOMEM; mach64_wait_for_idle(); mach64_ram_size = INREG(MEM_CNTL) & CTL_MEM_SIZEB; if (mach64_ram_size < 8) mach64_ram_size = (mach64_ram_size + 1) * 512; else if (mach64_ram_size < 12) mach64_ram_size = (mach64_ram_size - 3) * 1024; else mach64_ram_size = (mach64_ram_size - 7) * 2048; mach64_ram_size *= 0x400; /* KB -> bytes */ if((mach64_mem_base = map_phys_mem(pci_info.base0,mach64_ram_size))==(void *)-1) return ENOMEM; memset(&besr,0,sizeof(bes_registers_t)); printf("[mach64] Video memory = %uMb\n",mach64_ram_size/0x100000); err = mtrr_set_type(pci_info.base0,mach64_ram_size,MTRR_TYPE_WRCOMB); if(!err) printf("[mach64] Set write-combining type of video memory\n"); save_regs(); /* check if planar formats are supported */ supports_planar=0; mach64_wait_for_idle(); mach64_fifo_wait(2); if(INREG(SCALER_BUF0_OFFSET_U)) supports_planar=1; else { OUTREG(SCALER_BUF0_OFFSET_U, -1); mach64_wait_vsync(); mach64_wait_for_idle(); mach64_fifo_wait(2); if(INREG(SCALER_BUF0_OFFSET_U)) supports_planar=1; } printf("[mach64] Planar YUV formats are %s supported\n",supports_planar?"":"not"); supports_colour_adj=0; OUTREG(SCALER_COLOUR_CNTL,-1); if(INREG(SCALER_COLOUR_CNTL)) supports_colour_adj=1; supports_idct=0; OUTREG(IDCT_CONTROL,-1); if(INREG(IDCT_CONTROL)) supports_idct=1; OUTREG(IDCT_CONTROL,0); printf("[mach64] IDCT is %s supported\n",supports_idct?"":"not"); supports_subpic=0; OUTREG(SUBPIC_CNTL,-1); if(INREG(SUBPIC_CNTL)) supports_subpic=1; OUTREG(SUBPIC_CNTL,0); printf("[mach64] subpictures are %s supported\n",supports_subpic?"":"not"); if( mach64_cap.device_id==DEVICE_ATI_RAGE_MOBILITY_P_M || mach64_cap.device_id==DEVICE_ATI_RAGE_MOBILITY_P_M2 || mach64_cap.device_id==DEVICE_ATI_RAGE_MOBILITY_L || mach64_cap.device_id==DEVICE_ATI_RAGE_MOBILITY_L2) supports_lcd_v_stretch=1; else supports_lcd_v_stretch=0; reset_regs(); mach64_vid_make_default(); if(__verbose > VERBOSE_LEVEL) mach64_vid_dump_regs(); #ifdef MACH64_ENABLE_BM if(!(INREG(BUS_CNTL) & BUS_MASTER_DIS)) OUTREG(BUS_CNTL,INREG(BUS_CNTL)|BUS_MSTR_RESET); if(bm_open() == 0) { mach64_cap.flags |= FLAG_DMA | FLAG_EQ_DMA; if((dma_phys_addrs = malloc(mach64_ram_size*sizeof(unsigned long)/4096)) == 0) { out_mem: printf("[mach64] Can't allocate temporary buffer for DMA\n"); mach64_cap.flags &= ~FLAG_DMA & ~FLAG_EQ_DMA; return 0; } /* WARNING: We MUST have continigous descriptors!!! But: (720*720*2(YUV422)*16(sizeof(bm_descriptor)))/4096=4050 Thus one 4K page is far enough to describe max movie size. */ for(i=0;i<64;i++) if((mach64_dma_desc_base[i] = memalign(4096,mach64_ram_size*sizeof(bm_list_descriptor)/4096)) == 0) goto out_mem; #if 0 if(!is_agp) { long tst; if(pci_config_read(pci_info.bus,pci_info.card,pci_info.func,4,4,&pci_command) == 0) pci_config_write(pci_info.bus,pci_info.card,pci_info.func,4,4,pci_command|0x14); pci_config_read(pci_info.bus,pci_info.card,pci_info.func,4,4,&tst); } #endif } else if(__verbose) printf("[mach64] Can't initialize busmastering: %s\n",strerror(errno)); #endif return 0; } void VIDIX_NAME(vixDestroy)(void) { unsigned i; restore_regs(); #ifdef MACH64_ENABLE_BM mach64_engine_reset(); #endif unmap_phys_mem(mach64_mem_base,mach64_ram_size); unmap_phys_mem(mach64_mmio_base,0x4000); #ifdef MACH64_ENABLE_BM bm_close(); if(can_use_irq && irq_installed) hwirq_uninstall(pci_info.bus,pci_info.card,pci_info.func); if(dma_phys_addrs) free(dma_phys_addrs); for(i=0;i<64;i++) { if(mach64_dma_desc_base[i]) free(mach64_dma_desc_base[i]); } #endif } int VIDIX_NAME(vixGetCapability)(vidix_capability_t *to) { memcpy(to, &mach64_cap, sizeof(vidix_capability_t)); return 0; } static unsigned mach64_query_pitch(unsigned fourcc,const vidix_yuv_t *spitch) { unsigned pitch,spy,spv,spu; spy = spv = spu = 0; switch(spitch->y) { case 16: case 32: case 64: case 128: case 256: spy = spitch->y; break; default: break; } switch(spitch->u) { case 16: case 32: case 64: case 128: case 256: spu = spitch->u; break; default: break; } switch(spitch->v) { case 16: case 32: case 64: case 128: case 256: spv = spitch->v; break; default: break; } switch(fourcc) { /* 4:2:0 */ case IMGFMT_IYUV: case IMGFMT_YV12: case IMGFMT_I420: if(spy > 16 && spu == spy/2 && spv == spy/2) pitch = spy; else pitch = 32; break; case IMGFMT_YVU9: if(spy > 32 && spu == spy/4 && spv == spy/4) pitch = spy; else pitch = 64; break; default: if(spy >= 16) pitch = spy; else pitch = 16; break; } return pitch; } static void mach64_compute_framesize(vidix_playback_t *info) { unsigned pitch,awidth; pitch = mach64_query_pitch(info->fourcc,&info->src.pitch); switch(info->fourcc) { case IMGFMT_I420: case IMGFMT_YV12: case IMGFMT_IYUV: awidth = (info->src.w + (pitch-1)) & ~(pitch-1); info->frame_size = awidth*(info->src.h+info->src.h/2); break; case IMGFMT_YVU9: awidth = (info->src.w + (pitch-1)) & ~(pitch-1); info->frame_size = awidth*(info->src.h+info->src.h/8); break; // case IMGFMT_RGB32: case IMGFMT_BGR32: awidth = (info->src.w*4 + (pitch-1)) & ~(pitch-1); info->frame_size = (awidth*info->src.h); break; /* YUY2 YVYU, RGB15, RGB16 */ default: awidth = (info->src.w*2 + (pitch-1)) & ~(pitch-1); info->frame_size = (awidth*info->src.h); break; } info->frame_size+=256; // so we have some space for alignment & such info->frame_size&=~16; } static void mach64_vid_stop_video( void ) { mach64_fifo_wait(14); OUTREG(OVERLAY_SCALE_CNTL, 0x80000000); OUTREG(OVERLAY_EXCLUSIVE_HORZ, 0); OUTREG(OVERLAY_EXCLUSIVE_VERT, 0); OUTREG(SCALER_H_COEFF0, 0x00002000); OUTREG(SCALER_H_COEFF1, 0x0D06200D); OUTREG(SCALER_H_COEFF2, 0x0D0A1C0D); OUTREG(SCALER_H_COEFF3, 0x0C0E1A0C); OUTREG(SCALER_H_COEFF4, 0x0C14140C); OUTREG(VIDEO_FORMAT, 0xB000B); OUTREG(OVERLAY_TEST, 0x0); } static void mach64_vid_display_video( void ) { uint32_t vf,sc,width; mach64_fifo_wait(14); OUTREG(OVERLAY_Y_X_START, besr.y_x_start); OUTREG(OVERLAY_Y_X_END, besr.y_x_end); OUTREG(OVERLAY_SCALE_INC, besr.scale_inc); OUTREG(SCALER_BUF_PITCH, besr.vid_buf_pitch); OUTREG(SCALER_HEIGHT_WIDTH, besr.height_width); OUTREG(SCALER_BUF0_OFFSET, mach64_buffer_base[0][0]); OUTREG(SCALER_BUF0_OFFSET_U, mach64_buffer_base[0][1]); OUTREG(SCALER_BUF0_OFFSET_V, mach64_buffer_base[0][2]); OUTREG(SCALER_BUF1_OFFSET, mach64_buffer_base[0][0]); OUTREG(SCALER_BUF1_OFFSET_U, mach64_buffer_base[0][1]); OUTREG(SCALER_BUF1_OFFSET_V, mach64_buffer_base[0][2]); mach64_wait_vsync(); width = (besr.height_width >> 16 & 0x03FF); sc = SCALE_EN | OVERLAY_EN | SCALE_BANDWIDTH | /* reset bandwidth status */ SCALE_PIX_EXPAND | /* dynamic range correct */ SCALE_Y2R_TEMP; /* use the equal temparature for every component of RGB */ /* Force clocks of scaler. */ if(width > 360 && !supports_planar && !mach64_is_interlace()) sc |= SCALE_CLK_FORCE_ON; /* Do we need that? And how we can improve the quality of 3dRageII scaler ? 3dRageII+ (non pro) is really crapped HW :( ^^^^^^^^^^^^^^^^^^^ !!SCALER_WIDTH <= 360 provides full scaling functionality !!!!!!!!!!!!! !!360 < SCALER_WIDTH <= 720 provides scaling with vertical replication (crap) !!SCALER_WIDTH > 720 is illegal. (no comments) As for me - I would prefer to limit movie's width with 360 but it provides only half of picture but with perfect quality. (NK) */ mach64_fifo_wait(10); OUTREG(OVERLAY_SCALE_CNTL, sc); mach64_wait_for_idle(); switch(besr.fourcc) { /* BGR formats */ case IMGFMT_BGR15: vf = SCALER_IN_RGB15; break; case IMGFMT_BGR16: vf = SCALER_IN_RGB16; break; case IMGFMT_BGR32: vf = SCALER_IN_RGB32; break; /* 4:2:0 */ case IMGFMT_IYUV: case IMGFMT_I420: case IMGFMT_YV12: vf = SCALER_IN_YUV12; break; /* 4:1:0 */ case IMGFMT_YVU9: vf = SCALER_IN_YUV9; break; /* 4:2:2 */ case IMGFMT_YVYU: case IMGFMT_UYVY: vf = SCALER_IN_YVYU422; break; case IMGFMT_YUY2: default: vf = SCALER_IN_VYUY422; break; } OUTREG(VIDEO_FORMAT,vf); if(__verbose > VERBOSE_LEVEL) mach64_vid_dump_regs(); } /* Goal of this function: hide RGB background and provide black screen around movie. Useful in '-vo fbdev:vidix -fs -zoom' mode. Reverse effect to colorkey */ static void mach64_vid_exclusive( void ) { unsigned screenw,screenh; screenw = mach64_get_xres(); screenh = mach64_get_yres(); OUTREG(OVERLAY_EXCLUSIVE_VERT,(((screenh-1)<<16)&EXCLUSIVE_VERT_END)); OUTREG(OVERLAY_EXCLUSIVE_HORZ,(((screenw/8+1)<<8)&EXCLUSIVE_HORZ_END)|EXCLUSIVE_EN); } static void mach64_vid_non_exclusive( void ) { OUTREG(OVERLAY_EXCLUSIVE_HORZ,0); } static int mach64_vid_init_video( vidix_playback_t *config ) { uint32_t src_w,src_h,dest_w,dest_h,pitch,h_inc,v_inc,left,leftUV,top,ecp,y_pos; int is_420,best_pitch,mpitch; int src_offset_y, src_offset_u, src_offset_v; unsigned int i; mach64_vid_stop_video(); /* warning, if left or top are != 0 this will fail, as the framesize is too small then */ left = config->src.x; top = config->src.y; src_h = config->src.h; src_w = config->src.w; is_420 = 0; if(config->fourcc == IMGFMT_YV12 || config->fourcc == IMGFMT_I420 || config->fourcc == IMGFMT_IYUV) is_420 = 1; best_pitch = mach64_query_pitch(config->fourcc,&config->src.pitch); mpitch = best_pitch-1; switch(config->fourcc) { case IMGFMT_YVU9: /* 4:2:0 */ case IMGFMT_IYUV: case IMGFMT_YV12: case IMGFMT_I420: pitch = (src_w + mpitch) & ~mpitch; config->dest.pitch.y = config->dest.pitch.u = config->dest.pitch.v = best_pitch; besr.vid_buf_pitch= pitch; break; /* RGB 4:4:4:4 */ case IMGFMT_RGB32: case IMGFMT_BGR32: pitch = (src_w*4 + mpitch) & ~mpitch; config->dest.pitch.y = config->dest.pitch.u = config->dest.pitch.v = best_pitch; besr.vid_buf_pitch= pitch>>2; break; /* 4:2:2 */ default: /* RGB15, RGB16, YVYU, UYVY, YUY2 */ pitch = ((src_w*2) + mpitch) & ~mpitch; config->dest.pitch.y = config->dest.pitch.u = config->dest.pitch.v = best_pitch; besr.vid_buf_pitch= pitch>>1; break; } dest_w = config->dest.w; dest_h = config->dest.h; besr.fourcc = config->fourcc; ecp = (INPLL(PLL_VCLK_CNTL) & PLL_ECP_DIV) >> 4; #if 0 { int i; for(i=0; i<32; i++){ printf("%X ", INPLL(i)); } } #endif if(__verbose>0) printf("[mach64] ecp: %d\n", ecp); v_inc = src_h * mach64_get_vert_stretch(); if(mach64_is_interlace()) v_inc<<=1; if(mach64_is_dbl_scan() ) v_inc>>=1; v_inc/= dest_h; v_inc>>=4; // convert 16.16 -> 4.12 h_inc = (src_w << (12+ecp)) / dest_w; /* keep everything in 4.12 */ config->offsets[0] = 0; for(i=1; inum_frames; i++) config->offsets[i] = config->offsets[i-1] + config->frame_size; /*FIXME the left / top stuff is broken (= zoom a src rectangle from a larger one) 1. the framesize isnt known as the outer src rectangle dimensions arent known 2. the mach64 needs aligned addresses so it cant work anyway -> so we could shift the outer buffer to compensate that but that would mean alignment problems for the code which writes into it */ if(is_420) { config->offset.y= 0; config->offset.u= (pitch*src_h + 15)&~15; config->offset.v= (config->offset.u + (pitch*src_h>>2) + 15)&~15; src_offset_y= config->offset.y + top*pitch + left; src_offset_u= config->offset.u + (top*pitch>>2) + (left>>1); src_offset_v= config->offset.v + (top*pitch>>2) + (left>>1); if(besr.fourcc == IMGFMT_I420 || besr.fourcc == IMGFMT_IYUV) { uint32_t tmp; tmp = config->offset.u; config->offset.u = config->offset.v; config->offset.v = tmp; src_offset_u=config->offset.u; src_offset_v=config->offset.v; } } else if(besr.fourcc == IMGFMT_YVU9) { config->offset.y= 0; config->offset.u= (pitch*src_h + 15)&~15; config->offset.v= (config->offset.u + (pitch*src_h>>4) + 15)&~15; src_offset_y= config->offset.y + top*pitch + left; src_offset_u= config->offset.u + (top*pitch>>4) + (left>>1); src_offset_v= config->offset.v + (top*pitch>>4) + (left>>1); } else if(besr.fourcc == IMGFMT_BGR32) { config->offset.y = config->offset.u = config->offset.v = 0; src_offset_y= src_offset_u= src_offset_v= top*pitch + (left << 2); } else { config->offset.y = config->offset.u = config->offset.v = 0; src_offset_y= src_offset_u= src_offset_v= top*pitch + (left << 1); } num_mach64_buffers= config->num_frames; for(i=0; inum_frames; i++) { mach64_buffer_base[i][0]= (mach64_overlay_offset + config->offsets[i] + src_offset_y)&~15; mach64_buffer_base[i][1]= (mach64_overlay_offset + config->offsets[i] + src_offset_u)&~15; mach64_buffer_base[i][2]= (mach64_overlay_offset + config->offsets[i] + src_offset_v)&~15; } leftUV = (left >> 17) & 15; left = (left >> 16) & 15; besr.scale_inc = ( h_inc << 16 ) | v_inc; y_pos = config->dest.y; if(mach64_is_dbl_scan()) y_pos*=2; else if(mach64_is_interlace()) y_pos/=2; besr.y_x_start = y_pos | (config->dest.x << 16); y_pos =config->dest.y + dest_h; if(mach64_is_dbl_scan()) y_pos*=2; else if(mach64_is_interlace()) y_pos/=2; besr.y_x_end = y_pos | ((config->dest.x + dest_w) << 16); besr.height_width = ((src_w - left)<<16) | (src_h - top); return 0; } static int is_supported_fourcc(uint32_t fourcc) { switch(fourcc) { case IMGFMT_YV12: case IMGFMT_I420: case IMGFMT_YVU9: case IMGFMT_IYUV: return supports_planar; case IMGFMT_YUY2: case IMGFMT_UYVY: case IMGFMT_BGR15: case IMGFMT_BGR16: case IMGFMT_BGR32: return 1; default: return 0; } } int VIDIX_NAME(vixQueryFourcc)(vidix_fourcc_t *to) { if(is_supported_fourcc(to->fourcc)) { to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP | VID_DEPTH_4BPP | VID_DEPTH_8BPP | VID_DEPTH_12BPP| VID_DEPTH_15BPP| VID_DEPTH_16BPP| VID_DEPTH_24BPP| VID_DEPTH_32BPP; to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY; return 0; } else to->depth = to->flags = 0; return ENOSYS; } int VIDIX_NAME(vixConfigPlayback)(vidix_playback_t *info) { unsigned rgb_size,nfr; uint32_t mach64_video_size; if(!is_supported_fourcc(info->fourcc)) return ENOSYS; if(info->src.h > 720 || info->src.w > 720) { printf("[mach64] Can't apply width or height > 720\n"); return EINVAL; } if(info->num_frames>VID_PLAY_MAXFRAMES) info->num_frames=VID_PLAY_MAXFRAMES; mach64_compute_framesize(info); rgb_size = mach64_get_xres()*mach64_get_yres()*((mach64_vid_get_dbpp()+7)/8); nfr = info->num_frames; mach64_video_size = mach64_ram_size; for(;nfr>0;nfr--) { mach64_overlay_offset = mach64_video_size - info->frame_size*nfr; mach64_overlay_offset &= 0xffff0000; if(mach64_overlay_offset >= (int)rgb_size ) break; } if(nfr <= 3) { nfr = info->num_frames; for(;nfr>0;nfr--) { mach64_overlay_offset = mach64_video_size - info->frame_size*nfr; mach64_overlay_offset &= 0xffff0000; if(mach64_overlay_offset>=0) break; } } if(nfr <= 0) return EINVAL; info->num_frames=nfr; num_mach64_buffers = info->num_frames; info->dga_addr = (char *)mach64_mem_base + mach64_overlay_offset; mach64_vid_init_video(info); return 0; } int VIDIX_NAME(vixPlaybackOn)(void) { int err; unsigned dw,dh; dw = (besr.y_x_end >> 16) - (besr.y_x_start >> 16); dh = (besr.y_x_end & 0xFFFF) - (besr.y_x_start & 0xFFFF); if(dw == mach64_get_xres() || dh == mach64_get_yres()) mach64_vid_exclusive(); else mach64_vid_non_exclusive(); mach64_vid_display_video(); err = INREG(SCALER_BUF_PITCH) == besr.vid_buf_pitch ? 0 : EINTR; if(err) { printf("[mach64] *** Internal fatal error ***: Detected pitch corruption\n" "[mach64] Try decrease number of buffers\n"); } return err; } int VIDIX_NAME(vixPlaybackOff)(void) { mach64_vid_stop_video(); return 0; } int VIDIX_NAME(vixPlaybackFrameSelect)(unsigned int frame) { uint32_t off[6]; int i; int last_frame= (frame-1+num_mach64_buffers) % num_mach64_buffers; /* buf3-5 always should point onto second buffer for better deinterlacing and TV-in */ if(num_mach64_buffers==1) return 0; for(i=0; i<3; i++) { off[i] = mach64_buffer_base[frame][i]; off[i+3]= mach64_buffer_base[last_frame][i]; } if(__verbose > VERBOSE_LEVEL) printf("mach64_vid: flip_page = %u\n",frame); #if 0 // delay routine so the individual frames can be ssen better { volatile int i=0; for(i=0; i<10000000; i++); } #endif mach64_wait_for_idle(); mach64_fifo_wait(7); OUTREG(SCALER_BUF0_OFFSET, off[0]); OUTREG(SCALER_BUF0_OFFSET_U, off[1]); OUTREG(SCALER_BUF0_OFFSET_V, off[2]); OUTREG(SCALER_BUF1_OFFSET, off[3]); OUTREG(SCALER_BUF1_OFFSET_U, off[4]); OUTREG(SCALER_BUF1_OFFSET_V, off[5]); if(num_mach64_buffers==2) mach64_wait_vsync(); //only wait for vsync if we do double buffering if(__verbose > VERBOSE_LEVEL) mach64_vid_dump_regs(); return 0; } vidix_video_eq_t equal = { VEQ_CAP_BRIGHTNESS | VEQ_CAP_SATURATION , 0, 0, 0, 0, 0, 0, 0, 0 }; int VIDIX_NAME(vixPlaybackGetEq)( vidix_video_eq_t * eq) { memcpy(eq,&equal,sizeof(vidix_video_eq_t)); if(!supports_colour_adj) eq->cap = VEQ_CAP_BRIGHTNESS; return 0; } int VIDIX_NAME(vixPlaybackSetEq)( const vidix_video_eq_t * eq) { int br,sat; if(eq->cap & VEQ_CAP_BRIGHTNESS) equal.brightness = eq->brightness; if(eq->cap & VEQ_CAP_CONTRAST) equal.contrast = eq->contrast; if(eq->cap & VEQ_CAP_SATURATION) equal.saturation = eq->saturation; if(eq->cap & VEQ_CAP_HUE) equal.hue = eq->hue; if(eq->cap & VEQ_CAP_RGB_INTENSITY) { equal.red_intensity = eq->red_intensity; equal.green_intensity = eq->green_intensity; equal.blue_intensity = eq->blue_intensity; } if(supports_colour_adj) { equal.flags = eq->flags; br = equal.brightness * 64 / 1000; if(br < -64) br = -64; if(br > 63) br = 63; sat = (equal.saturation + 1000) * 16 / 1000; if(sat < 0) sat = 0; if(sat > 31) sat = 31; OUTREG(SCALER_COLOUR_CNTL, (br & 0x7f) | (sat << 8) | (sat << 16)); } else { unsigned gamma; br = equal.brightness * 3 / 1000; if(br < 0) br = 0; switch(br) { default:gamma = SCALE_GAMMA_SEL_BRIGHT; break; case 1: gamma = SCALE_GAMMA_SEL_G14; break; case 2: gamma = SCALE_GAMMA_SEL_G18; break; case 3: gamma = SCALE_GAMMA_SEL_G22; break; } OUTREG(OVERLAY_SCALE_CNTL,(INREG(OVERLAY_SCALE_CNTL) & ~SCALE_GAMMA_SEL_MSK) | gamma); } return 0; } int VIDIX_NAME(vixGetGrKeys)(vidix_grkey_t *grkey) { memcpy(grkey, &mach64_grkey, sizeof(vidix_grkey_t)); return(0); } int VIDIX_NAME(vixSetGrKeys)(const vidix_grkey_t *grkey) { memcpy(&mach64_grkey, grkey, sizeof(vidix_grkey_t)); if(mach64_grkey.ckey.op == CKEY_TRUE) { besr.ckey_on=1; switch(mach64_vid_get_dbpp()) { case 15: besr.graphics_key_msk=0x7FFF; besr.graphics_key_clr= ((mach64_grkey.ckey.blue &0xF8)>>3) | ((mach64_grkey.ckey.green&0xF8)<<2) | ((mach64_grkey.ckey.red &0xF8)<<7); break; case 16: besr.graphics_key_msk=0xFFFF; besr.graphics_key_clr= ((mach64_grkey.ckey.blue &0xF8)>>3) | ((mach64_grkey.ckey.green&0xFC)<<3) | ((mach64_grkey.ckey.red &0xF8)<<8); break; case 24: besr.graphics_key_msk=0xFFFFFF; besr.graphics_key_clr= ((mach64_grkey.ckey.blue &0xFF)) | ((mach64_grkey.ckey.green&0xFF)<<8) | ((mach64_grkey.ckey.red &0xFF)<<16); break; case 32: besr.graphics_key_msk=0xFFFFFF; besr.graphics_key_clr= ((mach64_grkey.ckey.blue &0xFF)) | ((mach64_grkey.ckey.green&0xFF)<<8) | ((mach64_grkey.ckey.red &0xFF)<<16); break; default: besr.ckey_on=0; besr.graphics_key_msk=0; besr.graphics_key_clr=0; } } else { besr.ckey_on=0; besr.graphics_key_msk=0; besr.graphics_key_clr=0; } mach64_fifo_wait(4); OUTREG(OVERLAY_GRAPHICS_KEY_MSK, besr.graphics_key_msk); OUTREG(OVERLAY_GRAPHICS_KEY_CLR, besr.graphics_key_clr); // OUTREG(OVERLAY_VIDEO_KEY_MSK, 0); // OUTREG(OVERLAY_VIDEO_KEY_CLR, 0); if(besr.ckey_on) OUTREG(OVERLAY_KEY_CNTL,VIDEO_KEY_FN_TRUE|GRAPHIC_KEY_FN_EQ|CMP_MIX_AND); else OUTREG(OVERLAY_KEY_CNTL,VIDEO_KEY_FN_TRUE|GRAPHIC_KEY_FN_TRUE|CMP_MIX_AND); return(0); } #ifdef MACH64_ENABLE_BM static int mach64_setup_frame( vidix_dma_t * dmai ) { if(mach64_overlay_offset + dmai->dest_offset + dmai->size > mach64_ram_size) return E2BIG; if(dmai->idx > VID_PLAY_MAXFRAMES-1) dmai->idx=0; if(!(dmai->internal[dmai->idx] && (dmai->flags & BM_DMA_FIXED_BUFFS))) { bm_list_descriptor * list = (bm_list_descriptor *)mach64_dma_desc_base[dmai->idx]; unsigned long dest_ptr; unsigned i,n,count; int retval; n = dmai->size / 4096; if(dmai->size % 4096) n++; if((retval = VIRT_TO_CARD(dmai->src,dmai->size,dma_phys_addrs)) != 0) return retval; dmai->internal[dmai->idx] = mach64_dma_desc_base[dmai->idx]; dest_ptr = dmai->dest_offset; count = dmai->size; #if 0 printf("MACH64_DMA_REQUEST va=%X size=%X\n",dmai->src,dmai->size); #endif for(i=0;i 4096 ? 4096 : (count | DMA_GUI_COMMAND__EOL)); list[i].reserved = 0; #if 0 printf("MACH64_DMA_TABLE[%i] fboff=%X pa=%X cmd=%X rsrvd=%X\n",i,list[i].framebuf_offset,list[i].sys_addr,list[i].command,list[i].reserved); #endif dest_ptr += 4096; count -= 4096; } cpu_flush(list,4096); } return 0; } static int mach64_transfer_frame( unsigned long ba_dma_desc,int sync_mode ) { uint32_t crtc_int; mach64_wait_for_idle(); mach64_fifo_wait(4); OUTREG(BUS_CNTL,(INREG(BUS_CNTL)|BUS_EXT_REG_EN)&(~BUS_MASTER_DIS)); crtc_int = INREG(CRTC_INT_CNTL); if(sync_mode && can_use_irq) OUTREG(CRTC_INT_CNTL,crtc_int|CRTC_BUSMASTER_EOL_INT|CRTC_BUSMASTER_EOL_INT_EN); else OUTREG(CRTC_INT_CNTL,crtc_int|CRTC_BUSMASTER_EOL_INT); OUTREG(BM_SYSTEM_TABLE,ba_dma_desc|SYSTEM_TRIGGER_SYSTEM_TO_VIDEO); if(__verbose > VERBOSE_LEVEL) mach64_vid_dump_regs(); #if 0 mach64_fifo_wait(4); mach64_fifo_wait(16); printf("MACH64_DMA_DBG: bm_fb_off=%08X bm_sysmem_addr=%08X bm_cmd=%08X bm_status=%08X bm_agp_base=%08X bm_agp_cntl=%08X\n", INREG(BM_FRAME_BUF_OFFSET), INREG(BM_SYSTEM_MEM_ADDR), INREG(BM_COMMAND), INREG(BM_STATUS), INREG(AGP_BASE), INREG(AGP_CNTL)); #endif return 0; } int VIDIX_NAME(vixQueryDMAStatus)( void ) { int bm_off; unsigned crtc_int_cntl; mach64_wait_for_idle(); mach64_fifo_wait(2); crtc_int_cntl = INREG(CRTC_INT_CNTL); bm_off = crtc_int_cntl & CRTC_BUSMASTER_EOL_INT; // if(bm_off) OUTREG(CRTC_INT_CNTL,crtc_int_cntl | CRTC_BUSMASTER_EOL_INT); return bm_off?0:1; } int VIDIX_NAME(vixPlaybackCopyFrame)( vidix_dma_t * dmai ) { int retval,sync_mode; if(!(dmai->flags & BM_DMA_FIXED_BUFFS)) if(bm_lock_mem(dmai->src,dmai->size) != 0) return errno; sync_mode = (dmai->flags & BM_DMA_SYNC) == BM_DMA_SYNC; if(sync_mode) { if(!irq_installed) init_irq(); /* burn CPU instead of PCI bus here */ while(vixQueryDMAStatus()!=0){ if(can_use_irq) hwirq_wait(pci_info.irq); else usleep(0); /* ugly but may help */ } } mach64_engine_reset(); retval = mach64_setup_frame(dmai); VIRT_TO_CARD(mach64_dma_desc_base[dmai->idx],1,&bus_addr_dma_desc); if(retval == 0) retval = mach64_transfer_frame(bus_addr_dma_desc,sync_mode); if(!(dmai->flags & BM_DMA_FIXED_BUFFS)) bm_unlock_mem(dmai->src,dmai->size); return retval; } #endif avifile-0.7.48~20090503.ds/drivers/vidix/drivers/mga_vid.c0000644000175000017500000011243607547603644022020 0ustar yavoryavor/* * Matrox MGA driver * * ported to VIDIX by Alex Beregszaszi * * YUY2 support (see config.format) added by A'rpi/ESP-team * double buffering added by A'rpi/ESP-team * * Brightness/contrast support by Nick Kurshev/Dariush Pietrzak (eyck) and me * * Fixed Brightness/Contrast * Rewrite or read/write kabi@users.sf.net * * TODO: * * fix memory size detection (current reading pci userconfig isn't * working as requested - returns the max avail. ram on arch?) * * translate all non-english comments to english */ /* * Original copyright: * * mga_vid.c * * Copyright (C) 1999 Aaron Holtzman * * Module skeleton based on gutted agpgart module by Jeff Hartmann * * * Matrox MGA G200/G400 YUV Video Interface module Version 0.1.0 * * BES == Back End Scaler * * This software has been released under the terms of the GNU Public * license. See http://www.gnu.org/copyleft/gpl.html for details. */ //#define CRTC2 // Set this value, if autodetection fails! (video ram size in megabytes) //#define MGA_MEMORY_SIZE 16 /* No irq support in userspace implemented yet, do not enable this! */ /* disable irq */ #undef MGA_ALLOW_IRQ #define MGA_VSYNC_POS 2 #undef MGA_PCICONFIG_MEMDETECT #define MGA_DEFAULT_FRAMES 64 #include #include #include #include #include #include #include "../vidix.h" #include "../fourcc.h" #include "../../libdha/libdha.h" #include "../../libdha/pci_ids.h" #include "../../libdha/pci_names.h" #if !defined(ENOTSUP) && defined(EOPNOTSUPP) #define ENOTSUP EOPNOTSUPP #endif #ifdef CRTC2 #define VIDIX_STATIC mga_crtc2_ #else #define VIDIX_STATIC mga_ #endif /* from radeon_vid */ #define GETREG(TYPE,PTR,OFFZ) (*((volatile TYPE*)((PTR)+(OFFZ)))) #define SETREG(TYPE,PTR,OFFZ,VAL) (*((volatile TYPE*)((PTR)+(OFFZ))))=VAL #define readb(addr) GETREG(uint8_t,(uint32_t)(mga_mmio_base + addr),0) #define writeb(addr, val) SETREG(uint8_t,(uint32_t)(mga_mmio_base + addr),0,val) #define readl(addr) GETREG(uint32_t,(uint32_t)(mga_mmio_base + addr),0) #define writel(addr, val) SETREG(uint32_t,(uint32_t)(mga_mmio_base + addr),0,val) static int mga_verbose = 0; /* for device detection */ static int probed = 0; static pciinfo_t pci_info; /* internal booleans */ static int mga_vid_in_use = 0; static int is_g400 = 0; static int vid_src_ready = 0; static int vid_overlay_on = 0; /* mapped physical addresses */ static uint8_t *mga_mmio_base = 0; static uint8_t* mga_mem_base = 0; static int mga_src_base = 0; /* YUV buffer position in video memory */ static uint32_t mga_ram_size = 0; /* how much megabytes videoram we have */ /* Graphic keys */ static vidix_grkey_t mga_grkey; static int colkey_saved = 0; static int colkey_on = 0; static unsigned char colkey_color[4]; static unsigned char colkey_mask[4]; /* for IRQ */ static int mga_irq = -1; static int mga_next_frame = 0; static vidix_capability_t mga_cap = { "Matrox MGA G200/G4x0/G5x0 YUV Video", "Aaron Holtzman, Arpad Gereoffy, Alex Beregszaszi, Nick Kurshev", TYPE_OUTPUT, { 0, 0, 0, 0 }, 2048, 2048, 4, 4, -1, FLAG_UPSCALER | FLAG_DOWNSCALER | FLAG_EQUALIZER, VENDOR_MATROX, -1, /* will be set in VIDIX_NAME(vixProbe) */ { 0, 0, 0, 0} }; /* MATROX BES registers */ typedef struct bes_registers_s { //BES Control uint32_t besctl; //BES Global control uint32_t besglobctl; //Luma control (brightness and contrast) uint32_t beslumactl; //Line pitch uint32_t bespitch; //Buffer A-1 Chroma 3 plane org uint32_t besa1c3org; //Buffer A-1 Chroma org uint32_t besa1corg; //Buffer A-1 Luma org uint32_t besa1org; //Buffer A-2 Chroma 3 plane org uint32_t besa2c3org; //Buffer A-2 Chroma org uint32_t besa2corg; //Buffer A-2 Luma org uint32_t besa2org; //Buffer B-1 Chroma 3 plane org uint32_t besb1c3org; //Buffer B-1 Chroma org uint32_t besb1corg; //Buffer B-1 Luma org uint32_t besb1org; //Buffer B-2 Chroma 3 plane org uint32_t besb2c3org; //Buffer B-2 Chroma org uint32_t besb2corg; //Buffer B-2 Luma org uint32_t besb2org; //BES Horizontal coord uint32_t beshcoord; //BES Horizontal inverse scaling [5.14] uint32_t beshiscal; //BES Horizontal source start [10.14] (for scaling) uint32_t beshsrcst; //BES Horizontal source ending [10.14] (for scaling) uint32_t beshsrcend; //BES Horizontal source last uint32_t beshsrclst; //BES Vertical coord uint32_t besvcoord; //BES Vertical inverse scaling [5.14] uint32_t besviscal; //BES Field 1 vertical source last position uint32_t besv1srclst; //BES Field 1 weight start uint32_t besv1wght; //BES Field 2 vertical source last position uint32_t besv2srclst; //BES Field 2 weight start uint32_t besv2wght; } bes_registers_t; static bes_registers_t regs; #ifdef CRTC2 typedef struct crtc2_registers_s { uint32_t c2ctl; uint32_t c2datactl; uint32_t c2misc; uint32_t c2hparam; uint32_t c2hsync; uint32_t c2offset; uint32_t c2pl2startadd0; uint32_t c2pl2startadd1; uint32_t c2pl3startadd0; uint32_t c2pl3startadd1; uint32_t c2preload; uint32_t c2spicstartadd0; uint32_t c2spicstartadd1; uint32_t c2startadd0; uint32_t c2startadd1; uint32_t c2subpiclut; uint32_t c2vcount; uint32_t c2vparam; uint32_t c2vsync; } crtc2_registers_t; static crtc2_registers_t cregs; static crtc2_registers_t cregs_save; #endif //All register offsets are converted to word aligned offsets (32 bit) //because we want all our register accesses to be 32 bits #define VCOUNT 0x1e20 #define PALWTADD 0x3c00 // Index register for X_DATAREG port #define X_DATAREG 0x3c0a #define XMULCTRL 0x19 #define BPP_8 0x00 #define BPP_15 0x01 #define BPP_16 0x02 #define BPP_24 0x03 #define BPP_32_DIR 0x04 #define BPP_32_PAL 0x07 #define XCOLMSK 0x40 #define X_COLKEY 0x42 #define XKEYOPMODE 0x51 #define XCOLMSK0RED 0x52 #define XCOLMSK0GREEN 0x53 #define XCOLMSK0BLUE 0x54 #define XCOLKEY0RED 0x55 #define XCOLKEY0GREEN 0x56 #define XCOLKEY0BLUE 0x57 #ifdef CRTC2 /*CRTC2 registers*/ #define XMISCCTRL 0x1e #define C2CTL 0x3c10 #define C2DATACTL 0x3c4c #define C2MISC 0x3c44 #define C2HPARAM 0x3c14 #define C2HSYNC 0x3c18 #define C2OFFSET 0x3c40 #define C2PL2STARTADD0 0x3c30 // like BESA1CORG #define C2PL2STARTADD1 0x3c34 // like BESA2CORG #define C2PL3STARTADD0 0x3c38 // like BESA1C3ORG #define C2PL3STARTADD1 0x3c3c // like BESA2C3ORG #define C2PRELOAD 0x3c24 #define C2SPICSTARTADD0 0x3c54 #define C2SPICSTARTADD1 0x3c58 #define C2STARTADD0 0x3c28 // like BESA1ORG #define C2STARTADD1 0x3c2c // like BESA2ORG #define C2SUBPICLUT 0x3c50 #define C2VCOUNT 0x3c48 #define C2VPARAM 0x3c1c #define C2VSYNC 0x3c20 #endif /* CRTC2 */ // Backend Scaler registers #define BESCTL 0x3d20 #define BESGLOBCTL 0x3dc0 #define BESLUMACTL 0x3d40 #define BESPITCH 0x3d24 #define BESA1C3ORG 0x3d60 #define BESA1CORG 0x3d10 #define BESA1ORG 0x3d00 #define BESA2C3ORG 0x3d64 #define BESA2CORG 0x3d14 #define BESA2ORG 0x3d04 #define BESB1C3ORG 0x3d68 #define BESB1CORG 0x3d18 #define BESB1ORG 0x3d08 #define BESB2C3ORG 0x3d6C #define BESB2CORG 0x3d1C #define BESB2ORG 0x3d0C #define BESHCOORD 0x3d28 #define BESHISCAL 0x3d30 #define BESHSRCEND 0x3d3C #define BESHSRCLST 0x3d50 #define BESHSRCST 0x3d38 #define BESV1WGHT 0x3d48 #define BESV2WGHT 0x3d4c #define BESV1SRCLST 0x3d54 #define BESV2SRCLST 0x3d58 #define BESVISCAL 0x3d34 #define BESVCOORD 0x3d2c #define BESSTATUS 0x3dc4 #define CRTCX 0x1fd4 #define CRTCD 0x1fd5 #define IEN 0x1e1c #define ICLEAR 0x1e18 #define STATUS 0x1e14 #define CRTCEXTX 0x1fde #define CRTCEXTD 0x1fdf #ifdef CRTC2 static void crtc2_frame_sel(int frame) { switch(frame) { case 0: cregs.c2pl2startadd0=regs.besa1corg; cregs.c2pl3startadd0=regs.besa1c3org; cregs.c2startadd0=regs.besa1org; break; case 1: cregs.c2pl2startadd0=regs.besa2corg; cregs.c2pl3startadd0=regs.besa2c3org; cregs.c2startadd0=regs.besa2org; break; case 2: cregs.c2pl2startadd0=regs.besb1corg; cregs.c2pl3startadd0=regs.besb1c3org; cregs.c2startadd0=regs.besb1org; break; case 3: cregs.c2pl2startadd0=regs.besb2corg; cregs.c2pl3startadd0=regs.besb2c3org; cregs.c2startadd0=regs.besb2org; break; } writel(C2STARTADD0, cregs.c2startadd0); // writel(C2PL2STARTADD0, cregs.c2pl2startadd0); // writel(C2PL3STARTADD0, cregs.c2pl3startadd0); } #endif int VIDIX_NAME(vixPlaybackFrameSelect)(unsigned int frame) { mga_next_frame = frame; if (mga_verbose>1) printf("[mga] frameselect: %d\n", mga_next_frame); #if MGA_ALLOW_IRQ if (mga_irq == -1) #endif { //we don't need the vcount protection as we're only hitting //one register (and it doesn't seem to be double buffered) regs.besctl = (regs.besctl & ~0x07000000) + (mga_next_frame << 25); writel(BESCTL, regs.besctl); // writel( regs.besglobctl + ((readl(VCOUNT)+2)<<16), writel(BESGLOBCTL, regs.besglobctl + (MGA_VSYNC_POS<<16)); #ifdef CRTC2 crtc2_frame_sel(mga_next_frame); #endif } return(0); } static void mga_vid_write_regs(int restore) { //Make sure internal registers don't get updated until we're done writel(BESGLOBCTL, (readl(VCOUNT)-1)<<16); // color or coordinate keying if (restore && colkey_saved) { // restore it colkey_saved = 0; // Set color key registers: writeb(PALWTADD, XKEYOPMODE); writeb(X_DATAREG, colkey_on); writeb(PALWTADD, XCOLKEY0RED); writeb(X_DATAREG, colkey_color[0]); writeb(PALWTADD, XCOLKEY0GREEN); writeb(X_DATAREG, colkey_color[1]); writeb(PALWTADD, XCOLKEY0BLUE); writeb(X_DATAREG, colkey_color[2]); writeb(PALWTADD, X_COLKEY); writeb(X_DATAREG, colkey_color[3]); writeb(PALWTADD, XCOLMSK0RED); writeb(X_DATAREG, colkey_mask[0]); writeb(PALWTADD, XCOLMSK0GREEN); writeb(X_DATAREG, colkey_mask[1]); writeb(PALWTADD, XCOLMSK0BLUE); writeb(X_DATAREG, colkey_mask[2]); writeb(PALWTADD, XCOLMSK); writeb(X_DATAREG, colkey_mask[3]); printf("[mga] Restored colorkey (ON: %d %02X:%02X:%02X)\n", colkey_on,colkey_color[0],colkey_color[1],colkey_color[2]); } else if (!colkey_saved) { // save it colkey_saved=1; // Get color key registers: writeb(PALWTADD, XKEYOPMODE); colkey_on = readb(X_DATAREG) & 1; writeb(PALWTADD, XCOLKEY0RED); colkey_color[0]=(unsigned char)readb(X_DATAREG); writeb(PALWTADD, XCOLKEY0GREEN); colkey_color[1]=(unsigned char)readb(X_DATAREG); writeb(PALWTADD, XCOLKEY0BLUE); colkey_color[2]=(unsigned char)readb(X_DATAREG); writeb(PALWTADD, X_COLKEY); colkey_color[3]=(unsigned char)readb(X_DATAREG); writeb(PALWTADD, XCOLMSK0RED); colkey_mask[0]=(unsigned char)readb(X_DATAREG); writeb(PALWTADD, XCOLMSK0GREEN); colkey_mask[1]=(unsigned char)readb(X_DATAREG); writeb(PALWTADD, XCOLMSK0BLUE); colkey_mask[2]=(unsigned char)readb(X_DATAREG); writeb(PALWTADD, XCOLMSK); colkey_mask[3]=(unsigned char)readb(X_DATAREG); printf("[mga] Saved colorkey (ON: %d %02X:%02X:%02X)\n", colkey_on,colkey_color[0],colkey_color[1],colkey_color[2]); } if (!restore) { writeb(PALWTADD, XKEYOPMODE); writeb(X_DATAREG, (mga_grkey.ckey.op == CKEY_TRUE)); if ( mga_grkey.ckey.op == CKEY_TRUE ) { uint32_t r=0, g=0, b=0; writeb(PALWTADD, XMULCTRL); switch (readb(X_DATAREG)) { case BPP_8: /* Need to look up the color index, just using color 0 for now. */ break; case BPP_15: r = mga_grkey.ckey.red >> 3; g = mga_grkey.ckey.green >> 3; b = mga_grkey.ckey.blue >> 3; break; case BPP_16: r = mga_grkey.ckey.red >> 3; g = mga_grkey.ckey.green >> 2; b = mga_grkey.ckey.blue >> 3; break; case BPP_24: case BPP_32_DIR: case BPP_32_PAL: r = mga_grkey.ckey.red; g = mga_grkey.ckey.green; b = mga_grkey.ckey.blue; break; } // Disable color keying on alpha channel writeb(PALWTADD, XCOLMSK); writeb(X_DATAREG, 0x00); writeb(PALWTADD, X_COLKEY); writeb(X_DATAREG, 0x00); // Set up color key registers writeb(PALWTADD, XCOLKEY0RED); writeb(X_DATAREG, r); writeb(PALWTADD, XCOLKEY0GREEN); writeb(X_DATAREG, g); writeb(PALWTADD, XCOLKEY0BLUE); writeb(X_DATAREG, b); // Set up color key mask registers writeb(PALWTADD, XCOLMSK0RED); writeb(X_DATAREG, 0xff); writeb(PALWTADD, XCOLMSK0GREEN); writeb(X_DATAREG, 0xff); writeb(PALWTADD, XCOLMSK0BLUE); writeb(X_DATAREG, 0xff); } } // Backend Scaler writel(BESCTL, regs.besctl); if (is_g400) writel(BESLUMACTL, regs.beslumactl); writel(BESPITCH, regs.bespitch); writel(BESA1ORG, regs.besa1org); writel(BESA1CORG, regs.besa1corg); writel(BESA2ORG, regs.besa2org); writel(BESA2CORG, regs.besa2corg); writel(BESB1ORG, regs.besb1org); writel(BESB1CORG, regs.besb1corg); writel(BESB2ORG, regs.besb2org); writel(BESB2CORG, regs.besb2corg); if(is_g400) { writel(BESA1C3ORG, regs.besa1c3org); writel(BESA2C3ORG, regs.besa2c3org); writel(BESB1C3ORG, regs.besb1c3org); writel(BESB2C3ORG, regs.besb2c3org); } writel(BESHCOORD, regs.beshcoord); writel(BESHISCAL, regs.beshiscal); writel(BESHSRCST, regs.beshsrcst); writel(BESHSRCEND, regs.beshsrcend); writel(BESHSRCLST, regs.beshsrclst); writel(BESVCOORD, regs.besvcoord); writel(BESVISCAL, regs.besviscal); writel(BESV1SRCLST, regs.besv1srclst); writel(BESV1WGHT, regs.besv1wght); writel(BESV2SRCLST, regs.besv2srclst); writel(BESV2WGHT, regs.besv2wght); //update the registers somewhere between 1 and 2 frames from now. writel(BESGLOBCTL, regs.besglobctl + ((readl(VCOUNT)+2)<<16)); if (mga_verbose > 1) { printf("[mga] wrote BES registers\n"); printf("[mga] BESCTL = 0x%08x\n", readl(BESCTL)); printf("[mga] BESGLOBCTL = 0x%08x\n", readl(BESGLOBCTL)); printf("[mga] BESSTATUS= 0x%08x\n", readl(BESSTATUS)); } #ifdef CRTC2 if (cregs_save.c2ctl == 0) { int i; cregs_save.c2ctl = readl(C2CTL); cregs_save.c2datactl = readl(C2DATACTL); cregs_save.c2misc = readl(C2MISC); for (i = 0; i <= 8; i++) { writeb(CRTCEXTX, i); printf("CRTCEXT%d %x\n", i, readb(CRTCEXTD)); } printf("c2ctl:0x%08x c2datactl:0x%08x\n", cregs_save.c2ctl, cregs_save.c2datactl); printf("c2misc:0x%08x\n", readl(C2MISC)); printf("c2ctl:0x%08x c2datactl:0x%08x\n", cregs.c2ctl, cregs.c2datactl); } if (restore) { writel(C2CTL, cregs_save.c2ctl); writel(C2DATACTL, cregs_save.c2datactl); writel(C2MISC, cregs_save.c2misc); return; } // disable c2en CRTC2 acording to specs writel(C2CTL, cregs.c2ctl & 0xfffffffe); //writel(C2DATACTL, ((readl(C2DATACTL) & ~0x000000ff) + (cregs.c2datactl & 0x000000ff))); writeb(PALWTADD, XMISCCTRL); { int a = readb(X_DATAREG); printf("XXXXX 0x%x\n", a); } // writeb(X_DATAREG, (readb(X_DATAREG) & ~(0x06 | 0xe0)) | (0x02 | 0xA0)); // MAFC - mfcsel & vdoutsel writeb(X_DATAREG, (readb(X_DATAREG) & ~(0x06 | 0xe0)) | (0x02 | 0xC0)); // MAFC - mfcsel & vdoutsel // writeb(XMISCCTRL, (readb(XMISCCTRL) & 0x19) | 0x92); // writeb(XMISCCTRL, (readb(XMISCCTRL) & ~0xe9) + 0xa2); writel(C2DATACTL, cregs.c2datactl); writel(C2HPARAM, cregs.c2hparam); writel(C2HSYNC, cregs.c2hsync); writel(C2VPARAM, cregs.c2vparam); writel(C2VSYNC, cregs.c2vsync); writel(C2MISC, cregs.c2misc); if (mga_verbose > 1) printf("[mga] c2offset = %d\n", cregs.c2offset); writel(C2OFFSET, cregs.c2offset); writel(C2STARTADD0, cregs.c2startadd0); // writel(C2STARTADD1, cregs.c2startadd1); // writel(C2PL2STARTADD0, cregs.c2pl2startadd0); // writel(C2PL2STARTADD1, cregs.c2pl2startadd1); // writel(C2PL3STARTADD0, cregs.c2pl3startadd0); // writel(C2PL3STARTADD1, cregs.c2pl3startadd1); // writel(C2SPICSTARTADD0, cregs.c2spicstartadd0); //xx writel(C2SPICSTARTADD1, cregs.c2spicstartadd1); writel(C2SUBPICLUT, cregs.c2subpiclut); writel(C2PRELOAD, cregs.c2preload); // finaly enable everything writel(C2CTL, cregs.c2ctl); // printf("c2ctl:0x%08x c2datactl:0x%08x\n",readl(C2CTL), readl(C2DATACTL)); // printf("c2misc:0x%08x\n", readl(C2MISC)); #endif } #ifdef MGA_ALLOW_IRQ static void enable_irq() { long int cc; cc = readl(IEN); // printf("*** !!! IRQREG = %d\n", (int)(cc&0xff)); writeb(CRTCX, 0x11); writeb(CRTCD, 0x20); /* clear 0, enable off */ writeb(CRTCD, 0x00); /* enable on */ writeb(CRTCD, 0x10); /* clear = 1 */ writel(BESGLOBCTL, regs.besglobctl); return; } static void disable_irq() { writeb(CRTCX, 0x11); writeb(CRTCD, 0x20); /* clear 0, enable off */ return; } void mga_handle_irq(int irq, void *dev_id/*, struct pt_regs *pregs*/) { // static int frame=0; // static int counter=0; long int cc; // if ( ! mga_enabled_flag ) return; // printf("vcount = %d\n",readl(VCOUNT)); //printf("mga_interrupt #%d\n", irq); if ( irq != -1 ) { cc = readl(STATUS); if ( ! (cc & 0x10) ) return; /* vsyncpen */ // debug_irqcnt++; } // if ( debug_irqignore ) { // debug_irqignore = 0; /* if ( mga_conf_deinterlace ) { if ( mga_first_field ) { // printf("mga_interrupt first field\n"); if ( syncfb_interrupt() ) mga_first_field = 0; } else { // printf("mga_interrupt second field\n"); mga_select_buffer( mga_current_field | 2 ); mga_first_field = 1; } } else { syncfb_interrupt(); } */ // frame=(frame+1)&1; regs.besctl = (regs.besctl & ~0x07000000) + (mga_next_frame << 25); writel(BESCTL, regs.besctl); #ifdef CRTC2 crtc2_frame_sel(mga_next_frame); #endif #if 0 ++counter; if(!(counter&63)){ printf("mga irq counter = %d\n",counter); } #endif // } else { // debug_irqignore = 1; // } if ( irq != -1 ) { writeb(CRTCX, 0x11); writeb(CRTCD, 0); writeb(CRTCD, 0x10); } //writel(BESGLOBCTL, regs.besglobctl); } #endif /* MGA_ALLOW_IRQ */ int VIDIX_NAME(vixConfigPlayback)(vidix_playback_t *config) { unsigned int i; int x, y, sw, sh, dw, dh; int besleft, bestop, ifactor, ofsleft, ofstop, baseadrofs, weight, weights; #ifdef CRTC2 #define right_margin 0 #define left_margin 18 #define hsync_len 46 #define lower_margin 10 #define vsync_len 4 #define upper_margin 39 unsigned int hdispend = (config->src.w + 31) & ~31; unsigned int hsyncstart = hdispend + (right_margin & ~7); unsigned int hsyncend = hsyncstart + (hsync_len & ~7); unsigned int htotal = hsyncend + (left_margin & ~7); unsigned int vdispend = config->src.h; unsigned int vsyncstart = vdispend + lower_margin; unsigned int vsyncend = vsyncstart + vsync_len; unsigned int vtotal = vsyncend + upper_margin; #endif if ((config->num_frames < 1) || (config->num_frames > MGA_DEFAULT_FRAMES)) { printf("[mga] illegal num_frames: %d, setting to %d\n", config->num_frames, MGA_DEFAULT_FRAMES); config->num_frames = MGA_DEFAULT_FRAMES; } for(;config->num_frames>0;config->num_frames--) { /*FIXME: this driver can use more frames but we need to apply some tricks to avoid RGB-memory hits*/ mga_src_base = ((mga_ram_size/2)*0x100000-config->num_frames*config->frame_size); mga_src_base &= (~0xFFFF); /* 64k boundary */ if(mga_src_base>=0) break; } if (mga_verbose > 1) printf("[mga] YUV buffer base: 0x%x\n", mga_src_base); config->dga_addr = mga_mem_base + mga_src_base; x = config->dest.x; y = config->dest.y; sw = config->src.w; sh = config->src.h; dw = config->dest.w; dh = config->dest.h; config->dest.pitch.y=32; config->dest.pitch.u=config->dest.pitch.v=16; if (mga_verbose) printf("[mga] Setting up a %dx%d-%dx%d video window (src %dx%d) format %X\n", dw, dh, x, y, sw, sh, config->fourcc); if ((sw < 4) || (sh < 4) || (dw < 4) || (dh < 4)) { printf("[mga] Invalid src/dest dimensions\n"); return(EINVAL); } //FIXME check that window is valid and inside desktop // printf("[mga] vcount = %d\n", readl(VCOUNT)); sw += sw & 1; switch(config->fourcc) { case IMGFMT_I420: case IMGFMT_IYUV: case IMGFMT_YV12: sh+=sh&1; config->frame_size = ((sw + 31) & ~31) * sh + (((sw + 31) & ~31) * sh) / 2; break; case IMGFMT_YUY2: case IMGFMT_UYVY: config->frame_size = ((sw + 31) & ~31) * sh * 2; break; default: printf("[mga] Unsupported pixel format: %x\n", config->fourcc); return(ENOTSUP); } config->offsets[0] = 0; // config->offsets[1] = config->frame_size; // config->offsets[2] = 2*config->frame_size; // config->offsets[3] = 3*config->frame_size; for (i = 1; i < config->num_frames+1; i++) config->offsets[i] = i*config->frame_size; config->offset.y=0; config->offset.v=((sw + 31) & ~31) * sh; config->offset.u=config->offset.v+((sw + 31) & ~31) * sh /4; //FIXME figure out a better way to allocate memory on card //allocate 2 megs //mga_src_base = mga_mem_base + (MGA_VIDMEM_SIZE-2) * 0x100000; //mga_src_base = (MGA_VIDMEM_SIZE-3) * 0x100000; /* for G200 set Interleaved UV planes */ if (!is_g400) config->flags = VID_PLAY_INTERLEAVED_UV | INTERLEAVING_UV; //Setup the BES registers for a three plane 4:2:0 video source regs.besglobctl = 0; switch(config->fourcc) { case IMGFMT_YV12: case IMGFMT_I420: case IMGFMT_IYUV: regs.besctl = 1 // BES enabled + (0<<6) // even start polarity + (1<<10) // x filtering enabled + (1<<11) // y filtering enabled + (1<<16) // chroma upsampling + (1<<17) // 4:2:0 mode + (1<<18); // dither enabled #if 0 if(is_g400) { //zoom disabled, zoom filter disabled, 420 3 plane format, proc amp //disabled, rgb mode disabled regs.besglobctl = (1<<5); } else { //zoom disabled, zoom filter disabled, Cb samples in 0246, Cr //in 1357, BES register update on besvcnt regs.besglobctl = 0; } #endif break; case IMGFMT_YUY2: regs.besctl = 1 // BES enabled + (0<<6) // even start polarity + (1<<10) // x filtering enabled + (1<<11) // y filtering enabled + (1<<16) // chroma upsampling + (0<<17) // 4:2:2 mode + (1<<18); // dither enabled regs.besglobctl = 0; // YUY2 format selected break; case IMGFMT_UYVY: regs.besctl = 1 // BES enabled + (0<<6) // even start polarity + (1<<10) // x filtering enabled + (1<<11) // y filtering enabled + (1<<16) // chroma upsampling + (0<<17) // 4:2:2 mode + (1<<18); // dither enabled regs.besglobctl = 1<<6; // UYVY format selected break; } //Disable contrast and brightness control regs.besglobctl |= (1<<5) + (1<<7); // we want to preserver these across restarts //regs.beslumactl = (0x0 << 16) + 0x80; //Setup destination window boundaries besleft = x > 0 ? x : 0; bestop = y > 0 ? y : 0; regs.beshcoord = (besleft<<16) + (x + dw-1); regs.besvcoord = (bestop<<16) + (y + dh-1); //Setup source dimensions regs.beshsrclst = (sw - 1) << 16; regs.bespitch = (sw + 31) & ~31 ; //Setup horizontal scaling ifactor = ((sw-1)<<14)/(dw-1); ofsleft = besleft - x; regs.beshiscal = ifactor<<2; regs.beshsrcst = (ofsleft*ifactor)<<2; regs.beshsrcend = regs.beshsrcst + (((dw - ofsleft - 1) * ifactor) << 2); //Setup vertical scaling ifactor = ((sh-1)<<14)/(dh-1); ofstop = bestop - y; regs.besviscal = ifactor<<2; baseadrofs = ((ofstop*regs.besviscal)>>16)*regs.bespitch; //frame_size = ((sw + 31) & ~31) * sh + (((sw + 31) & ~31) * sh) / 2; regs.besa1org = (uint32_t) mga_src_base + baseadrofs; regs.besa2org = (uint32_t) mga_src_base + baseadrofs + 1*config->frame_size; regs.besb1org = (uint32_t) mga_src_base + baseadrofs + 2*config->frame_size; regs.besb2org = (uint32_t) mga_src_base + baseadrofs + 3*config->frame_size; if (config->fourcc == IMGFMT_YV12 || config->fourcc == IMGFMT_IYUV || config->fourcc == IMGFMT_I420) { // planar YUV frames: if (is_g400) baseadrofs = (((ofstop*regs.besviscal)/4)>>16)*regs.bespitch; else baseadrofs = (((ofstop*regs.besviscal)/2)>>16)*regs.bespitch; if (config->fourcc == IMGFMT_YV12){ regs.besa1corg = (uint32_t) mga_src_base + baseadrofs + regs.bespitch * sh ; regs.besa2corg = (uint32_t) mga_src_base + baseadrofs + 1*config->frame_size + regs.bespitch * sh; regs.besb1corg = (uint32_t) mga_src_base + baseadrofs + 2*config->frame_size + regs.bespitch * sh; regs.besb2corg = (uint32_t) mga_src_base + baseadrofs + 3*config->frame_size + regs.bespitch * sh; regs.besa1c3org = regs.besa1corg + ((regs.bespitch * sh) / 4); regs.besa2c3org = regs.besa2corg + ((regs.bespitch * sh) / 4); regs.besb1c3org = regs.besb1corg + ((regs.bespitch * sh) / 4); regs.besb2c3org = regs.besb2corg + ((regs.bespitch * sh) / 4); } else { regs.besa1c3org = (uint32_t) mga_src_base + baseadrofs + regs.bespitch * sh ; regs.besa2c3org = (uint32_t) mga_src_base + baseadrofs + 1*config->frame_size + regs.bespitch * sh; regs.besb1c3org = (uint32_t) mga_src_base + baseadrofs + 2*config->frame_size + regs.bespitch * sh; regs.besb2c3org = (uint32_t) mga_src_base + baseadrofs + 3*config->frame_size + regs.bespitch * sh; regs.besa1corg = regs.besa1c3org + ((regs.bespitch * sh) / 4); regs.besa2corg = regs.besa2c3org + ((regs.bespitch * sh) / 4); regs.besb1corg = regs.besb1c3org + ((regs.bespitch * sh) / 4); regs.besb2corg = regs.besb2c3org + ((regs.bespitch * sh) / 4); } } weight = ofstop * (regs.besviscal >> 2); weights = weight < 0 ? 1 : 0; regs.besv2wght = regs.besv1wght = (weights << 16) + ((weight & 0x3FFF) << 2); regs.besv2srclst = regs.besv1srclst = sh - 1 - (((ofstop * regs.besviscal) >> 16) & 0x03FF); #ifdef CRTC2 // pridat hlavni registry - tj. casovani ... cregs.c2ctl = 1 // CRTC2 enabled | (1<<1) // p2pixclksel - external clock (VDOCLK pin) | (0<<3) // p2pixclkdis - pixel clock is enable //| (5<<4) // c2hiprilvl - high priority req | (2<<4) // c2hiprilvl - high priority req for YUV | (0<<8) // c2maxhipri - high priority req max for YUV //| (2<<8) // c2maxhipri - high priority req max | (0<<20) // crtcdacsel - CRTC1 output to DAC | (0<<24) // csvcdbcrsingle - single chroma line for 420 mode | (0<<25) // c2interlace - interlace mode | (0<<26) // c2fieldlength - field legth polariry | (0<<27) // c2fieldpol - field identification polariry | (1<<28) // c2vidrstmod - VIDRST detection mode (raising) | (1<<30) // c2hploaden - horizontal counter preload | (1<<31) // c2vploaden - vertical counter preload ; cregs.c2datactl = 1 // disable dither - propably not needed, we are already in YUV mode | (1<<1) // Y filter enable | (1<<2) // CbCr filter enable | (0<<3) // subpicture enable (disabled) //| (0<<4) // NTSC enable (disabled - PAL) | (0<<4) // NTSC enable (disabled - PAL) | (0<<5) // C2 static subpicture enable (disabled) | (0<<6) // C2 subpicture offset division (disabled) | (0<<7) // 422 uyvy subformat selection ! /* | (0<<8) // 15 bpp high alpha | (0<<16) // 15 bpp low alpha | (0<<24) // static subpicture key */ ; switch(config->fourcc){ case IMGFMT_YV12: case IMGFMT_I420: case IMGFMT_IYUV: cregs.c2ctl |= (7 << 21); // 420 mode break; case IMGFMT_UYVY: //+ (1<<24) // single chroma line for 420 mode - need to be corrected cregs.c2datactl |= (1<<7); // 422 subformat selection ! /* fall through */ case IMGFMT_YUY2: cregs.c2ctl |= (5 << 21); // 422 mode break; } cregs.c2misc=0 // CRTCV2 656 togg f0 +(0<<1) // CRTCV2 656 togg f0 +(0<<2) // CRTCV2 656 togg f0 +(0<<4) // CRTCV2 656 togg f1 +(0<<5) // CRTCV2 656 togg f1 +(0<<6) // CRTCV2 656 togg f1 +(0<<8) // Hsync active high +(0<<9) // Vsync active high // 16-27 c2vlinecomp - nevim co tam dat ; //cregs.c2offset=(regs.bespitch << 1); cregs.c2offset = regs.bespitch; printf("COFF %d %x %x %x\n", cregs.c2offset, regs.besa1org, regs.besa1corg, regs.besa1c3org); cregs.c2startadd0=regs.besa1org; //cregs.c2startadd1=regs.besa2org; cregs.c2pl2startadd0=regs.besa1corg; //cregs.c2pl2startadd1=regs.besa2corg; cregs.c2pl3startadd0=regs.besa1c3org; //cregs.c2pl3startadd1=regs.besa2c3org; cregs.c2spicstartadd0=0; // not used //cregs.c2spicstartadd1=0; // not used cregs.c2subpiclut=0; //not used cregs.c2hparam = (((hdispend - 8) & ~7) << 16) | ((htotal - 8) & ~7); cregs.c2hsync = (((hsyncend - 8) & ~7) << 16) | ((hsyncstart - 8) & ~7); cregs.c2preload=((vsyncstart & ~7) << 16) | hsyncstart; // from cregs.c2vparam=((vdispend - 1) << 16) | (vtotal - 1); cregs.c2vsync=((vsyncend - 1) << 16) | (vsyncstart - 1); printf("VTotal: %d VDispEnd: %d ctl:%x\n",vtotal, vdispend, cregs.c2ctl); #endif /* CRTC2 */ mga_vid_write_regs(0); return(0); } int VIDIX_NAME(vixPlaybackOn)(void) { if (mga_verbose) printf("[mga] playback on\n"); vid_src_ready = 1; if(vid_overlay_on) { regs.besctl |= 1; mga_vid_write_regs(0); } #ifdef MGA_ALLOW_IRQ if (mga_irq != -1) enable_irq(); #endif mga_next_frame=0; return(0); } int VIDIX_NAME(vixPlaybackOff)(void) { if (mga_verbose) printf("[mga] playback off\n"); vid_src_ready = 0; #ifdef MGA_ALLOW_IRQ if (mga_irq != -1) disable_irq(); #endif regs.besctl &= ~1; regs.besglobctl &= ~(1<<6); /* UYVY format selected */ mga_vid_write_regs(0); return(0); } int VIDIX_NAME(vixProbe)(int verbose,int force) { pciinfo_t lst[MAX_PCI_DEVICES]; unsigned int i, num_pci; int err; if (verbose) printf("[mga] probe\n"); mga_verbose = verbose; is_g400 = -1; err = pci_scan(lst, &num_pci); if (err) { printf("[mga] Error occured during pci scan: %s\n", strerror(err)); return(err); } if (mga_verbose) printf("[mga] found %d pci devices\n", num_pci); for (i = 0; i < num_pci; i++) { if (mga_verbose > 1) printf("[mga] pci[%d] vendor: %d device: %d\n", i, lst[i].vendor, lst[i].device); if (lst[i].vendor == VENDOR_MATROX) { switch(lst[i].device) { case DEVICE_MATROX_MGA_G550_AGP: printf("[mga] Found MGA G550\n"); is_g400 = 1; goto card_found; case DEVICE_MATROX_MGA_G400_AGP: printf("[mga] Found MGA G400/G450\n"); is_g400 = 1; goto card_found; case DEVICE_MATROX_MGA_G200_AGP: printf("[mga] Found MGA G200 AGP\n"); is_g400 = 0; goto card_found; case DEVICE_MATROX_MGA_G200: printf("[mga] Found MGA G200 PCI\n"); is_g400 = 0; goto card_found; } } } if (is_g400 == -1) { printf("[mga] No supported cards found\n"); return(ENXIO); } card_found: probed = 1; memcpy(&pci_info, &lst[i], sizeof(pciinfo_t)); mga_cap.device_id = pci_info.device; /* set device id in capabilites */ return(0); } int VIDIX_NAME(vixInit)(const char *args) { unsigned int card_option = 0; int err; /* reset Brightness & Constrast here */ regs.beslumactl = (0x0 << 16) + 0x80; if (mga_verbose) printf("[mga] init\n"); mga_vid_in_use = 0; printf("Matrox MGA G200/G400/G450 YUV Video interface v2.01 (c) Aaron Holtzman & A'rpi\n"); #ifdef CRTC2 printf("Driver compiled with TV-out (second-head) support\n"); #endif if (!probed) { printf("[mga] driver was not probed but is being initializing\n"); return(EINTR); } #ifdef MGA_PCICONFIG_MEMDETECT pci_config_read(pci_info.bus, pci_info.card, pci_info.func, 0x40, 4, &card_option); if (mga_verbose > 1) printf("[mga] OPTION word: 0x%08X mem: 0x%02X %s\n", card_option, (card_option>>10)&0x17, ((card_option>>14)&1)?"SGRAM":"SDRAM"); #endif if (mga_ram_size) { printf("[mga] RAMSIZE forced to %d MB\n", mga_ram_size); } else { #ifdef MGA_MEMORY_SIZE mga_ram_size = MGA_MEMORY_SIZE; printf("[mga] hard-coded RAMSIZE is %d MB\n", (unsigned int) mga_ram_size); #else if (is_g400) { switch((card_option>>10)&0x17) { // SDRAM: case 0x00: case 0x04: mga_ram_size = 16; break; case 0x03: mga_ram_size = 32; break; // SGRAM: case 0x10: case 0x14: mga_ram_size = 32; break; case 0x11: case 0x12: mga_ram_size = 16; break; default: mga_ram_size = 16; printf("[mga] Couldn't detect RAMSIZE, assuming 16MB!\n"); } } else { switch((card_option>>10)&0x17) { // case 0x10: // case 0x13: mga_ram_size = 8; break; default: mga_ram_size = 8; } } #if 0 // printf("List resources -----------\n"); for(temp=0;tempresource[temp]; if(res->flags){ int size=(1+res->end-res->start)>>20; printf("res %d: start: 0x%X end: 0x%X (%d MB) flags=0x%X\n",temp,res->start,res->end,size,res->flags); if(res->flags&(IORESOURCE_MEM|IORESOURCE_PREFETCH)){ if(size>mga_ram_size && size<=64) mga_ram_size=size; } } } #endif printf("[mga] detected RAMSIZE is %d MB\n", (unsigned int) mga_ram_size); #endif } if (mga_ram_size) { if ((mga_ram_size < 4) || (mga_ram_size > 64)) { printf("[mga] invalid RAMSIZE: %d MB\n", mga_ram_size); return(EINVAL); } } if (mga_verbose > 1) printf("[mga] hardware addresses: mmio: 0x%x, framebuffer: 0x%x\n", pci_info.base1, pci_info.base0); mga_mmio_base = map_phys_mem(pci_info.base1,0x4000); mga_mem_base = map_phys_mem(pci_info.base0,mga_ram_size*1024*1024); if (mga_verbose > 1) printf("[mga] MMIO at %p, IRQ: %d, framebuffer: %p\n", mga_mmio_base, mga_irq, mga_mem_base); err = mtrr_set_type(pci_info.base0,mga_ram_size*1024*1024,MTRR_TYPE_WRCOMB); if(!err) printf("[mga] Set write-combining type of video memory\n"); #ifdef MGA_ALLOW_IRQ if (mga_irq != -1) { int tmp = request_irq(mga_irq, mga_handle_irq, SA_INTERRUPT | SA_SHIRQ, "Syncfb Time Base", &mga_irq); if (tmp) { printf("syncfb (mga): cannot register irq %d (Err: %d)\n", mga_irq, tmp); mga_irq=-1; } else { printf("syncfb (mga): registered irq %d\n", mga_irq); } } else { printf("syncfb (mga): No valid irq was found\n"); mga_irq=-1; } #else printf("syncfb (mga): IRQ disabled in mga_vid.c\n"); mga_irq=-1; #endif #ifdef CRTC2 memset(&cregs_save, 0, sizeof(cregs_save)); #endif return(0); } void VIDIX_NAME(vixDestroy)(void) { if (mga_verbose) printf("[mga] destroy\n"); /* FIXME turn off BES */ vid_src_ready = 0; regs.besctl &= ~1; regs.besglobctl &= ~(1<<6); // UYVY format selected // mga_config.colkey_on=0; //!!! mga_vid_write_regs(1); mga_vid_in_use = 0; #ifdef MGA_ALLOW_IRQ if (mga_irq != -1) free_irq(mga_irq, &mga_irq); #endif if (mga_mmio_base) unmap_phys_mem(mga_mmio_base, 0x4000); if (mga_mem_base) unmap_phys_mem(mga_mem_base, mga_ram_size); return; } int VIDIX_NAME(vixQueryFourcc)(vidix_fourcc_t *to) { int supports=0; if (mga_verbose) printf("[mga] query fourcc (%x)\n", to->fourcc); switch(to->fourcc) { case IMGFMT_YV12: case IMGFMT_IYUV: case IMGFMT_I420: supports = is_g400 ? 1 : 0; case IMGFMT_NV12: supports = is_g400 ? 0 : 1; case IMGFMT_YUY2: case IMGFMT_UYVY: supports = 1; break; default: supports = 0; } if(!supports) { to->depth = to->flags = 0; return(ENOTSUP); } to->depth = VID_DEPTH_12BPP | VID_DEPTH_15BPP | VID_DEPTH_16BPP | VID_DEPTH_24BPP | VID_DEPTH_32BPP; to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY; return(0); } unsigned int VIDIX_NAME(vixGetVersion)(void) { return(VIDIX_VERSION); } int VIDIX_NAME(vixGetCapability)(vidix_capability_t *to) { memcpy(to, &mga_cap, sizeof(vidix_capability_t)); return(0); } int VIDIX_NAME(vixGetGrKeys)(vidix_grkey_t *grkey) { memcpy(grkey, &mga_grkey, sizeof(vidix_grkey_t)); return(0); } int VIDIX_NAME(vixSetGrKeys)(const vidix_grkey_t *grkey) { memcpy(&mga_grkey, grkey, sizeof(vidix_grkey_t)); return(0); } int VIDIX_NAME(vixPlaybackSetEq)( const vidix_video_eq_t * eq) { uint32_t luma; float factor = 255.0 / 2000; /* contrast and brightness control isn't supported on G200 - alex */ if (!is_g400) { if (mga_verbose) printf("[mga] equalizer isn't supported with G200\n"); return(ENOTSUP); } luma = regs.beslumactl; if (eq->cap & VEQ_CAP_BRIGHTNESS) { luma &= 0xffff; luma |= (((int)(eq->brightness * factor) & 0xff) << 16); } if (eq->cap & VEQ_CAP_CONTRAST) { luma &= 0xffff << 16; luma |= ((int)((eq->contrast + 1000) * factor) & 0xff); } regs.beslumactl = luma; writel(BESLUMACTL, regs.beslumactl); return(0); } int VIDIX_NAME(vixPlaybackGetEq)( vidix_video_eq_t * eq) { float factor = 2000.0 / 255; /* contrast and brightness control isn't supported on G200 - alex */ if (!is_g400) { if (mga_verbose) printf("[mga] equalizer isn't supported with G200\n"); return(ENOTSUP); } // BESLUMACTL is WO only registr! // this will not work: regs.beslumactl = readl(BESLUMACTL); eq->brightness = ((signed char)((regs.beslumactl >> 16) & 0xff)) * factor; eq->contrast = (regs.beslumactl & 0xFF) * factor - 1000; eq->cap = VEQ_CAP_BRIGHTNESS | VEQ_CAP_CONTRAST; return(0); } avifile-0.7.48~20090503.ds/drivers/vidix/drivers/nvidia.h0000644000175000017500000000304707532425320021651 0ustar yavoryavor#include #define RIVA_FIFO_FREE(hwptr, cnt) \ { \ while (nv_fifo_space < (cnt)) { \ nv_fifo_space = hwptr->fifo_free >> 2; \ } \ nv_fifo_space -= (cnt); \ } typedef struct { uint32_t reserved00[4]; uint16_t fifo_free; uint16_t nop[1]; uint32_t reserved01[0x03b]; uint32_t no_operation; uint32_t notify; uint32_t reserved02[0x01e]; uint32_t set_context_dma_notifies; uint32_t set_context_dma_image; uint32_t set_context_pattern; uint32_t set_context_rop; uint32_t set_context_beta1; uint32_t set_context_surface; uint32_t reserved03[0x05a]; uint32_t set_color_format; uint32_t set_operation; int16_t clip_x; int16_t clip_y; uint16_t clip_height; uint16_t clip_width; int16_t image_out_x; int16_t image_out_y; uint16_t image_out_height; uint16_t image_out_width; uint32_t du_dx; uint32_t du_dy; uint32_t reserved04[0x38]; uint16_t image_in_height; uint16_t image_in_width; uint32_t image_in_format; uint32_t image_in_offset; uint32_t image_in_point; uint32_t reserved05[0x6fc]; } RivaScaledImage; #define dump_scaledimage(x) { \ printf("clip: pos: %dx%d, size: %dx%d\n", \ x->clip_x, x->clip_y, x->clip_height, x->clip_width); \ printf("image_out: pos: %dx%d, size: %dx%d\n", \ x->image_out_x, x->image_out_y, x->image_out_height, x->image_out_width); \ printf("image_in: size: %dx%d format: %x offset: %x\n", \ x->image_in_height, x->image_in_width, x->image_in_format, x->image_in_offset); \ } avifile-0.7.48~20090503.ds/drivers/vidix/drivers/nvidia_vid.c0000644000175000017500000001652107622470302022507 0ustar yavoryavor#include #include #include #include #include #include #include "../vidix.h" #include "../fourcc.h" #include "../../libdha/libdha.h" #include "../../libdha/pci_ids.h" #include "../../libdha/pci_names.h" #include "nvidia.h" #define VIDIX_STATIC nvidia_ static void *ctrl_base = 0; static void *fb_base = 0; static int32_t overlay_offset = 0; static uint32_t ram_size = 0; static unsigned int *PFB; static unsigned int *PCIO; static unsigned int *PGRAPH; static unsigned int *PRAMIN; static unsigned int *FIFO; static unsigned int *PMC; typedef unsigned char U008; #define NVIDIA_MSG "[nvidia-unworking-driver] " #define NV_WR08(p,i,d) (((U008 *)(p))[i]=(d)) unsigned int nv_fifo_space = 0; void CRTCout(unsigned char index, unsigned char val) { NV_WR08(PCIO, 0x3d4, index); NV_WR08(PCIO, 0x3d5, val); } volatile RivaScaledImage *ScaledImage; #define CARD_FLAGS_NONE 0x00 #define CARD_FLAGS_NOTSUPPORTED 0x01 struct nv_card_id_s { const unsigned int id ; const char name[32]; const int core; const int flags; }; static const struct nv_card_id_s nv_card_id; static const struct nv_card_id_s nv_card_ids[]= { { DEVICE_NVIDIA_NV5_RIVA_TNT2, "nVidia TNT2 (NV5) ", 5, CARD_FLAGS_NOTSUPPORTED}, { DEVICE_NVIDIA_NV6_VANTA, "nVidia Vanta (NV6.1)", 6, CARD_FLAGS_NOTSUPPORTED}, { DEVICE_NVIDIA_RIVA_TNT2_MODEL, "nVidia Vanta (NV6.2)", 6, CARD_FLAGS_NOTSUPPORTED} }; static int find_chip(unsigned int chip_id) { unsigned int i; for (i = 0; i < sizeof(nv_card_ids)/sizeof(struct nv_card_id_s); i++) if (chip_id == nv_card_ids[i].id) return(i); return(-1); } static pciinfo_t pci_info; static int probed = 0; /* VIDIX exports */ static vidix_capability_t nvidia_cap = { "NVIDIA driver for VIDIX", "alex", TYPE_OUTPUT, { 0, 0, 0, 0 }, 2046, 2047, 4, 4, -1, FLAG_NONE, VENDOR_NVIDIA, 0, { 0, 0, 0, 0 } }; unsigned int VIDIX_NAME(vixGetVersion)(void) { return(VIDIX_VERSION); } int VIDIX_NAME(vixProbe)(int verbose,int force) { pciinfo_t lst[MAX_PCI_DEVICES]; unsigned int i, num_pci; int err; printf(NVIDIA_MSG"probe\n"); err = pci_scan(lst, &num_pci); if (err) { printf(NVIDIA_MSG"Error occured during pci scan: %s\n", strerror(err)); return err; } else { err = ENXIO; for (i = 0; i < num_pci; i++) { if (lst[i].vendor == VENDOR_NVIDIA) { int idx; idx = find_chip(lst[i].device); if (idx == -1) continue; if (nv_card_ids[idx].flags & CARD_FLAGS_NOTSUPPORTED) { printf(NVIDIA_MSG"Found chip: %s, but not supported!\n", nv_card_ids[idx].name); continue; } else printf(NVIDIA_MSG"Found chip: %s\n", nv_card_ids[idx].name); memcpy(&nv_card_id, &nv_card_ids[idx], sizeof(struct nv_card_id_s)); nvidia_cap.device_id = nv_card_ids[idx].id; err = 0; memcpy(&pci_info, &lst[i], sizeof(pciinfo_t)); probed = 1; printf(NVIDIA_MSG"bus:card:func = %x:%x:%x\n", pci_info.bus, pci_info.card, pci_info.func); printf(NVIDIA_MSG"vendor:device = %x:%x\n", pci_info.vendor, pci_info.device); printf(NVIDIA_MSG"base0:base1:base2:baserom = %x:%x:%x:%x\n", pci_info.base0, pci_info.base1, pci_info.base2, pci_info.baserom); break; } } } if (err) printf(NVIDIA_MSG"No chip found\n"); return(err); } int VIDIX_NAME(vixInit)(const char *args) { int card_option; printf(NVIDIA_MSG"init\n"); pci_config_read(pci_info.bus, pci_info.card, pci_info.func, 0x40, 4, &card_option); printf(NVIDIA_MSG"card_option: %x\n", card_option); if (!probed) { printf(NVIDIA_MSG"Driver was not probed but is being initialized\n"); return(EINTR); } ctrl_base = map_phys_mem(pci_info.base0, 0x00800000); if (ctrl_base == (void *)-1) return(ENOMEM); fb_base = map_phys_mem(pci_info.base1, 0x01000000); if (fb_base == (void *)-1) return(ENOMEM); printf(NVIDIA_MSG"ctrl_base: %p, fb_base: %p\n", ctrl_base, fb_base); PFB = ctrl_base+0x00100000; PGRAPH = ctrl_base+0x00400000; PRAMIN = ctrl_base+0x00710000; FIFO = ctrl_base+0x00800000; PCIO = ctrl_base+0x00601000; PMC = ctrl_base+0x00000000; printf(NVIDIA_MSG"pfb: %p, pgraph: %p, pramin: %p, fifo: %p, pcio: %p\n", PFB, PGRAPH, PRAMIN, FIFO, PCIO); ScaledImage = FIFO+0x8000/4; printf(NVIDIA_MSG"ScaledImage: %p\n", ScaledImage); /* unlock */ CRTCout(0x11, 0xff); printf(NVIDIA_MSG"fifo_free: %d\n", ScaledImage->fifo_free); RIVA_FIFO_FREE(ScaledImage, 10); dump_scaledimage(ScaledImage); /* create scaled image object */ *(PRAMIN+0x518) = 0x0100A037; *(PRAMIN+0x519) = 0x00000C02; /* put scaled image object into subchannel */ *(FIFO+0x2000) = 0x80000011; /* ram size detection */ switch(nv_card_id.core) { case 5: { if (*(PFB+0x0) & 0x00000100) { printf(NVIDIA_MSG"first ver\n"); ram_size = ((*(PFB+0x0) >> 12) & 0x0f) * 1024 * 2 + 1024 * 2; } else { printf("second ver (code: %d)\n", *(PFB+0x0) & 0x00000003); switch(*(PFB+0x0) & 0x00000003) { case 0: ram_size = 1024*32; break; case 1: ram_size = 1024*4; break; case 2: ram_size = 1024*8; break; case 3: ram_size = 1024*16; break; default: printf(NVIDIA_MSG"Unknown ram size code: %d\n", *(PFB+0x0) & 0x00000003); break; } } break; } default: printf(NVIDIA_MSG"Unknown core: %d\n", nv_card_id.core); } printf(NVIDIA_MSG"ram_size: %d\n", ram_size); return 0; } void VIDIX_NAME(vixDestroy)(void) { printf(NVIDIA_MSG"destory\n"); } int VIDIX_NAME(vixGetCapability)(vidix_capability_t *to) { memcpy(to, &nvidia_cap, sizeof(vidix_capability_t)); return(0); } int VIDIX_NAME(vixQueryFourcc)(vidix_fourcc_t *to) { printf(NVIDIA_MSG"query fourcc (%x)\n", to->fourcc); to->flags = 0; to->depth = VID_DEPTH_32BPP; return 0; } int VIDIX_NAME(vixConfigPlayback)(vidix_playback_t *info) { int fb_pixel_size = 32/8; int fb_line_len = 1280*4; char buffer = 0; int offset = 0; int x,y,h,w; int bpp = 32 >> 3; int size; printf(NVIDIA_MSG"config playback\n"); x = info->src.x; y = info->src.y; h = info->src.h; w = info->src.w; w = (w + 1) & ~1; size = h * (((w << 1) + 63) & ~63) / bpp; PMC[(0x8900/4)+buffer] = offset; PMC[(0x8928/4)+buffer] = (h << 16) | w; PMC[(0x8930/4)+buffer] = ((y << 4) & 0xffff0000) | (x >> 12); PMC[(0x8938/4)+buffer] = (w << 20) / info->dest.w; PMC[(0x8938/4)+buffer] = (h << 20) / info->dest.h; info->dga_addr = fb_base + (info->dest.w - info->src.w) * fb_pixel_size / 2 + (info->dest.h - info->src.h) * fb_line_len / 2; info->num_frames = 1; info->frame_size = info->src.w*info->src.h+(info->src.w*info->src.h)/2; info->offsets[0] = 0; info->offset.y = 0; info->offset.v = ((info->src.w + 31) & ~31) * info->src.h; info->offset.u = info->offset.v+((info->src.w + 31) & ~31) * info->src.h / 4; // info->dga_addr = malloc(info->num_frames*info->frame_size); return 0; } int VIDIX_NAME(vixPlaybackOn)(void) { printf(NVIDIA_MSG"playback on\n"); return 0; } int VIDIX_NAME(vixPlaybackOff)(void) { printf(NVIDIA_MSG"playback off\n"); return 0; } avifile-0.7.48~20090503.ds/drivers/vidix/drivers/pm2_vid.c0000644000175000017500000002077307555016013021737 0ustar yavoryavor/** Driver for 3DLabs Permedia 2. Copyright (C) 2002 Måns Rullgård This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU 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 **/ #include #include #include #include #include #include #include #include "../vidix.h" #include "../fourcc.h" #include "../../libdha/libdha.h" #include "../../libdha/pci_ids.h" #include "../../libdha/pci_names.h" #include "../../config.h" #include "glint_regs.h" #define VIDIX_STATIC pm2_ /* MBytes of video memory to use */ #define PM2_VIDMEM 6 #if 0 #define TRACE_ENTER() fprintf(stderr, "%s: enter\n", __FUNCTION__) #define TRACE_EXIT() fprintf(stderr, "%s: exit\n", __FUNCTION__) #else #define TRACE_ENTER() #define TRACE_EXIT() #endif #define WRITE_REG(offset,val) \ *(volatile u_long *)(((u_char *)(pm2_reg_base)) + offset) = (val) #define READ_REG(offset) \ *(volatile unsigned long *)(((unsigned char *)(pm2_reg_base)) + offset) pciinfo_t pci_info; void *pm2_reg_base; void *pm2_mem; int pm2_vidmem = PM2_VIDMEM; static vidix_capability_t pm2_cap = { "3DLabs Permedia2 driver", "Måns Rullgård ", TYPE_OUTPUT, { 0, 0, 0, 0 }, 2048, 2048, 4, 4, -1, FLAG_UPSCALER|FLAG_DOWNSCALER, VENDOR_3DLABS, -1, { 0, 0, 0, 0 } }; unsigned int VIDIX_NAME(vixGetVersion)(void) { return(VIDIX_VERSION); } static u_int pm2_card_ids[] = { (VENDOR_3DLABS << 16) | DEVICE_3DLABS_PERMEDIA2, (VENDOR_TEXAS << 16) | DEVICE_TEXAS_TVP4020_PERMEDIA_2 }; static int find_chip(u_int vendor, u_int chip_id) { u_int vci = (vendor << 16) | chip_id; unsigned i; for(i = 0; i < sizeof(pm2_card_ids)/sizeof(u_int); i++){ if(vci == pm2_card_ids[i]) return i; } return -1; } int VIDIX_NAME(vixProbe)(int verbose, int force) { pciinfo_t lst[MAX_PCI_DEVICES]; unsigned i,num_pci; int err; err = pci_scan(lst,&num_pci); if(err) { printf("[pm2] Error occured during pci scan: %s\n",strerror(err)); return err; } else { err = ENXIO; for(i=0; i < num_pci; i++) { int idx; const char *dname; idx = find_chip(lst[i].vendor, lst[i].device); if(idx == -1) continue; dname = pci_device_name(lst[i].vendor, lst[i].device); dname = dname ? dname : "Unknown chip"; printf("[pm2] Found chip: %s\n", dname); pm2_cap.device_id = lst[i].device; err = 0; memcpy(&pci_info, &lst[i], sizeof(pciinfo_t)); break; } } if(err && verbose) printf("[pm2] Can't find chip.\n"); return err; } #define PRINT_REG(reg) \ { \ long _foo = READ_REG(reg); \ printf("[pm2] " #reg " (%x) = %#lx (%li)\n", reg, _foo, _foo); \ } int VIDIX_NAME(vixInit)(const char *args) { char *vm; pm2_reg_base = map_phys_mem(pci_info.base0, 0x10000); pm2_mem = map_phys_mem(pci_info.base1, 1 << 23); if((vm = getenv("PM2_VIDMEM"))){ pm2_vidmem = strtol(vm, NULL, 0); } return 0; } void VIDIX_NAME(vixDestroy)(void) { unmap_phys_mem(pm2_reg_base, 0x10000); unmap_phys_mem(pm2_mem, 1 << 23); } int VIDIX_NAME(vixGetCapability)(vidix_capability_t *to) { memcpy(to, &pm2_cap, sizeof(vidix_capability_t)); return 0; } static int is_supported_fourcc(uint32_t fourcc) { switch(fourcc){ case IMGFMT_YUY2: return 1; default: return 0; } } int VIDIX_NAME(vixQueryFourcc)(vidix_fourcc_t *to) { if(is_supported_fourcc(to->fourcc)) { to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP | VID_DEPTH_4BPP | VID_DEPTH_8BPP | VID_DEPTH_12BPP| VID_DEPTH_15BPP| VID_DEPTH_16BPP| VID_DEPTH_24BPP| VID_DEPTH_32BPP; to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY; return 0; } else to->depth = to->flags = 0; return ENOSYS; } #define FORMAT_YUV422 ((1 << 6) | 3 | (1 << 4)) #define PPROD(a,b,c) (a | (b << 3) | (c << 6)) static u_int ppcodes[][2] = { {0, 0}, {32, PPROD(1, 0, 0)}, {64, PPROD(1, 1, 0)}, {96, PPROD(1, 1, 1)}, {128, PPROD(2, 1, 1)}, {160, PPROD(2, 2, 1)}, {192, PPROD(2, 2, 2)}, {224, PPROD(3, 2, 1)}, {256, PPROD(3, 2, 2)}, {288, PPROD(3, 3, 1)}, {320, PPROD(3, 3, 2)}, {384, PPROD(3, 3, 3)}, {416, PPROD(4, 3, 1)}, {448, PPROD(4, 3, 2)}, {512, PPROD(4, 3, 3)}, {544, PPROD(4, 4, 1)}, {576, PPROD(4, 4, 2)}, {640, PPROD(4, 4, 3)}, {768, PPROD(4, 4, 4)}, {800, PPROD(5, 4, 1)}, {832, PPROD(5, 4, 2)}, {896, PPROD(5, 4, 3)}, {1024, PPROD(5, 4, 4)}, {1056, PPROD(5, 5, 1)}, {1088, PPROD(5, 5, 2)}, {1152, PPROD(5, 5, 3)}, {1280, PPROD(5, 5, 4)}, {1536, PPROD(5, 5, 5)}, {1568, PPROD(6, 5, 1)}, {1600, PPROD(6, 5, 2)}, {1664, PPROD(6, 5, 3)}, {1792, PPROD(6, 5, 4)}, {2048, PPROD(6, 5, 5)} }; static int frames[VID_PLAY_MAXFRAMES]; int VIDIX_NAME(vixConfigPlayback)(vidix_playback_t *info) { u_int src_w, drw_w; u_int src_h, drw_h; long base0; u_int stride, sstr; u_int format; unsigned int i; u_int ppcode = 0, sppc = 0; u_int pitch = 0; TRACE_ENTER(); switch(info->fourcc){ case IMGFMT_YUY2: format = FORMAT_YUV422; break; default: return -1; } src_w = info->src.w; src_h = info->src.h; drw_w = info->dest.w; drw_h = info->dest.h; sstr = READ_REG(PMScreenStride) * 2; stride = 0; for(i = 1; i < sizeof(ppcodes) / sizeof(ppcodes[0]); i++){ if((!stride) && (ppcodes[i][0] >= src_w)){ stride = ppcodes[i][0]; ppcode = ppcodes[i][1]; pitch = ppcodes[i][0] - ppcodes[i-1][0]; } if(ppcodes[i][0] == sstr) sppc = ppcodes[i][1]; } if(!stride) return -1; info->num_frames = pm2_vidmem*1024*1024 / (stride * src_h * 2); if(info->num_frames > VID_PLAY_MAXFRAMES) info->num_frames = VID_PLAY_MAXFRAMES; /* Use end of video memory. Assume the card has 8 MB */ base0 = (8 - pm2_vidmem)*1024*1024; info->dga_addr = pm2_mem + base0; info->dest.pitch.y = pitch*2; info->dest.pitch.u = 0; info->dest.pitch.v = 0; info->offset.y = 0; info->offset.v = 0; info->offset.u = 0; info->frame_size = stride * src_h * 2; for(i = 0; i < info->num_frames; i++){ info->offsets[i] = info->frame_size * i; frames[i] = (base0 + info->offsets[i]) >> 1; } WRITE_REG(WindowOrigin, 0); WRITE_REG(dY, 1 << 16); WRITE_REG(RasterizerMode, 0); WRITE_REG(ScissorMode, 0); WRITE_REG(AreaStippleMode, 0); WRITE_REG(StencilMode, 0); WRITE_REG(TextureAddressMode, 1); WRITE_REG(dSdyDom, 0); WRITE_REG(dTdx, 0); WRITE_REG(PMTextureMapFormat, (1 << 19) | ppcode); WRITE_REG(PMTextureDataFormat, format); WRITE_REG(PMTextureReadMode, (1 << 17) | /* FilterMode */ (11 << 13) | (11 << 9) /* TextureSize log2 */ | 1); WRITE_REG(ColorDDAMode, 0); WRITE_REG(TextureColorMode, (0 << 4) /* RGB */ | (3 << 1) /* Copy */ | 1); WRITE_REG(AlphaBlendMode, 0); WRITE_REG(DitherMode, (1 << 10) | 1); WRITE_REG(LogicalOpMode, 0); WRITE_REG(FBReadMode, sppc); WRITE_REG(FBHardwareWriteMask, 0xFFFFFFFF); WRITE_REG(FBWriteMode, 1); WRITE_REG(YUVMode, 1); WRITE_REG(SStart, 0); WRITE_REG(TStart, 0); WRITE_REG(dSdx, (src_w << 20) / drw_w); WRITE_REG(dTdyDom, (src_h << 20) / drw_h); WRITE_REG(RectangleOrigin, info->dest.x | (info->dest.y << 16)); WRITE_REG(RectangleSize, (drw_h << 16) | drw_w); TRACE_EXIT(); return 0; } int VIDIX_NAME(vixPlaybackOn)(void) { TRACE_ENTER(); TRACE_EXIT(); return 0; } int VIDIX_NAME(vixPlaybackOff)(void) { WRITE_REG(YUVMode, 0); WRITE_REG(TextureColorMode, 0); WRITE_REG(TextureAddressMode, 0); WRITE_REG(TextureReadMode, 0); return 0; } int VIDIX_NAME(vixPlaybackFrameSelect)(unsigned int frame) { WRITE_REG(PMTextureBaseAddress, frames[frame]); WRITE_REG(Render, PrimitiveRectangle | XPositive | YPositive | TextureEnable); return 0; } avifile-0.7.48~20090503.ds/drivers/vidix/drivers/pm3_regs.h0000644000175000017500000015055207622470303022123 0ustar yavoryavor/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h,v 1.9 2001/11/20 00:09:15 alanh Exp $ */ /* * glint register file * * Copyright by Sven Luther * Authors: Sven Luther, * Thomas Witzel, * * this work is sponsored by Appian Graphics. * */ #ifndef _PM3_REG_H_ #define _PM3_REG_H_ #define PM3FIFOSize 120 #define PM3Tag(r) ((r>>3)&0x7ff) #define PM3OutputFIFO 0x2000 /********************************************** * GLINT Permedia3 Control Status registers * ***********************************************/ /* Control Status Registers */ #define PM3ResetStatus 0x0000 #define PM3IntEnable 0x0008 #define PM3IntFlags 0x0010 #define PM3InFIFOSpace 0x0018 #define PM3OutFIFOWords 0x0020 #define PM3DMAAddress 0x0028 #define PM3DMACount 0x0030 #define PM3ErrorFlags 0x0038 #define PM3VClkCtl 0x0040 #define PM3TestRegister 0x0048 #define PM3Aperture0 0x0050 #define PM3Aperture1 0x0058 #define PM3DMAControl 0x0060 #define PM3FIFODis 0x0068 #define PM3ChipConfig 0x0070 #define PM3AGPControl 0x0078 #define PM3GPOutDMAAddress 0x0080 #define PM3PCIFeedbackCount 0x0088 #define PM3PCIAbortStatus 0x0090 #define PM3PCIAbortAddress 0x0098 #define PM3PCIPLLStatus 0x00f0 #define PM3HostTextureAddress 0x0100 #define PM3TextureDownloadControl 0x0108 #define PM3TextureOperation 0x0110 #define PM3LogicalTexturePage 0x0118 #define PM3TexDMAAddress 0x0120 #define PM3TexFIFOSpace 0x0128 /********************************************** * GLINT Permedia3 Region 0 Bypass Controls * ***********************************************/ #define PM3ByAperture1Mode 0x0300 #define PM3ByApertureMode_BYTESWAP_ABCD (0<<0) #define PM3ByApertureMode_BYTESWAP_BADC (1<<0) #define PM3ByApertureMode_BYTESWAP_CDAB (2<<0) #define PM3ByApertureMode_BYTESWAP_DCBA (3<<0) #define PM3ByApertureMode_PATCH_DISABLE (0<<2) #define PM3ByApertureMode_PATCH_ENABLE (1<<2) #define PM3ByApertureMode_FORMAT_RAW (0<<3) #define PM3ByApertureMode_FORMAT_YUYV (1<<3) #define PM3ByApertureMode_FORMAT_UYVY (2<<3) #define PM3ByApertureMode_PIXELSIZE_8BIT (0<<5) #define PM3ByApertureMode_PIXELSIZE_16BIT (1<<5) #define PM3ByApertureMode_PIXELSIZE_32BIT (2<<5) #define PM3ByApertureMode_EFFECTIVE_STRIDE_1024 (0<<7) #define PM3ByApertureMode_EFFECTIVE_STRIDE_2048 (1<<7) #define PM3ByApertureMode_EFFECTIVE_STRIDE_4096 (2<<7) #define PM3ByApertureMode_EFFECTIVE_STRIDE_8192 (3<<7) #define PM3ByApertureMode_PATCH_OFFSET_X(off) (((off)&7f)<<9) #define PM3ByApertureMode_PATCH_OFFSET_Y(off) (((off)&7f)<<16) #define PM3ByApertureMode_FRAMEBUFFER (0<<21) #define PM3ByApertureMode_LOCALBUFFER (1<<21) #define PM3ByApertureMode_DOUBLE_WRITE_OFF (0<<22) #define PM3ByApertureMode_DOUBLE_WRITE_1MB (1<<22) #define PM3ByApertureMode_DOUBLE_WRITE_2MB (2<<22) #define PM3ByApertureMode_DOUBLE_WRITE_4MB (3<<22) #define PM3ByApertureMode_DOUBLE_WRITE_8MB (4<<22) #define PM3ByApertureMode_DOUBLE_WRITE_16MB (5<<22) #define PM3ByApertureMode_DOUBLE_WRITE_32MB (6<<22) #define PM3Aperture1Stride 0x0308 #define PM3Aperture1YStart 0x0310 #define PM3Aperture1UStart 0x0318 #define PM3Aperture1VStart 0x0320 #define PM3ByAperture2Mode 0x0328 #define PM3Aperture2Stride 0x0330 #define PM3Aperture2YStart 0x0338 #define PM3Aperture2UStart 0x0340 #define PM3Aperture2VStart 0x0348 #define PM3ByDMAReadCommandBase 0x0378 #define PM3ByDMAReadCommandCount 0x0380 #define PM3ByDMAReadMode 0x0350 #define PM3ByDMAReadMode_ByteSwap_NONE (0<<0) #define PM3ByDMAReadMode_ByteSwap_BYTE (1<<0) #define PM3ByDMAReadMode_ByteSwap_HWORD (2<<0) #define PM3ByDMAReadMode_ByteSwap_FULL (3<<0) #define PM3ByDMAReadMode_PatchEnable (1<<2) #define PM3ByDMAReadMode_Format_RAW (0<<3) #define PM3ByDMAReadMode_Format_YUYV (1<<3) #define PM3ByDMAReadMode_Format_UYVY (2<<3) #define PM3ByDMAReadMode_PixelSize(s) (((s>>4)&3)<<5) #define PM3ByDMAReadMode_EffectiveStride(s) ((s&3)<<7) #define PM3ByDMAReadMode_PatchOffsetX(x) ((x&0x3f)<<9) #define PM3ByDMAReadMode_PatchOffsetY(y) ((y&0x3f)<<16) #define PM3ByDMAReadMode_Buffer_FB (0<<21) #define PM3ByDMAReadMode_Buffer_LB (1<<21) #define PM3ByDMAReadMode_Active (1<<22) #define PM3ByDMAReadMode_MemType_PCI (0<<23) #define PM3ByDMAReadMode_MemType_AGP (1<<23) #define PM3ByDMAReadMode_Burst(b) ((b&7)<<24) #define PM3ByDMAReadMode_Align (1<<27) #define PM3ByDMAReadStride 0x0358 #define PM3ByDMAReadUStart 0x0368 #define PM3ByDMAReadVStart 0x0370 #define PM3ByDMAReadYStart 0x0360 /********************************************** * GLINT Permedia3 Memory Control (0x1000) * ***********************************************/ #define PM3MemCounter 0x1000 #define PM3MemBypassWriteMask 0x1008 #define PM3MemScratch 0x1010 #define PM3LocalMemCaps 0x1018 #define PM3LocalMemCaps_NoWriteMask (1<<28) #define PM3LocalMemTimings 0x1020 #define PM3LocalMemControl 0x1028 #define PM3LocalMemRefresh 0x1030 #define PM3LocalMemPowerDown 0x1038 #define PM3RemoteMemControl 0x1100 /********************************************** * GLINT Permedia3 Video Control (0x3000) * ***********************************************/ #define PM3ScreenBase 0x3000 #define PM3ScreenStride 0x3008 #define PM3HTotal 0x3010 #define PM3HgEnd 0x3018 #define PM3HbEnd 0x3020 #define PM3HsStart 0x3028 #define PM3HsEnd 0x3030 #define PM3VTotal 0x3038 #define PM3VbEnd 0x3040 #define PM3VsStart 0x3048 #define PM3VsEnd 0x3050 #define PM3VideoControl 0x3058 #define PM3VideoControl_DISABLE (0<<0) #define PM3VideoControl_ENABLE (1<<0) #define PM3VideoControl_BLANK_ACTIVE_HIGH (0<<1) #define PM3VideoControl_BLANK_ACTIVE_LOW (1<<1) #define PM3VideoControl_LINE_DOUBLE_OFF (0<<2) #define PM3VideoControl_LINE_DOUBLE_ON (1<<2) #define PM3VideoControl_HSYNC_FORCE_HIGH (0<<3) #define PM3VideoControl_HSYNC_ACTIVE_HIGH (1<<3) #define PM3VideoControl_HSYNC_FORCE_LOW (2<<3) #define PM3VideoControl_HSYNC_ACTIVE_LOW (3<<3) #define PM3VideoControl_VSYNC_FORCE_HIGH (0<<5) #define PM3VideoControl_VSYNC_ACTIVE_HIGH (1<<5) #define PM3VideoControl_VSYNC_FORCE_LOW (2<<5) #define PM3VideoControl_VSYNC_ACTIVE_LOW (3<<5) #define PM3VideoControl_BYTE_DOUBLE_OFF (0<<7) #define PM3VideoControl_BYTE_DOUBLE_ON (1<<7) #define PM3VideoControl_BUFFER_SWAP_SYNCON_FRAMEBLANK (0<<9) #define PM3VideoControl_BUFFER_SWAP_FREE_RUNNING (1<<9) #define PM3VideoControl_BUFFER_SWAP_LIMITETO_FRAMERATE (2<<9) #define PM3VideoControl_STEREO_DISABLE (0<<11) #define PM3VideoControl_STEREO_ENABLE (1<<11) #define PM3VideoControl_RIGHT_EYE_ACTIVE_HIGH (0<<12) #define PM3VideoControl_RIGHT_EYE_ACTIVE_LOW (1<<12) #define PM3VideoControl_VIDEO_EXT_LOW (0<<14) #define PM3VideoControl_VIDEO_EXT_HIGH (1<<14) #define PM3VideoControl_SYNC_MODE_INDEPENDENT (0<<16) #define PM3VideoControl_SYNC_MODE_SYNCTO_VSA (1<<16) #define PM3VideoControl_SYNC_MODE_SYNCTO_VSB (2<<16) #define PM3VideoControl_PATCH_DISABLE (0<<18) #define PM3VideoControl_PATCH_ENABLE (1<<18) #define PM3VideoControl_PIXELSIZE_8BIT (0<<19) #define PM3VideoControl_PIXELSIZE_16BIT (1<<19) #define PM3VideoControl_PIXELSIZE_32BIT (2<<19) #define PM3VideoControl_DISPLAY_DISABLE (0<<21) #define PM3VideoControl_DISPLAY_ENABLE (1<<21) #define PM3VideoControl_PATCH_OFFSET_X(off) (((off)&0x3f)<<22) #define PM3VideoControl_PATCH_OFFSET_Y(off) (((off)&0x3f)<<28) #define PM3InterruptLine 0x3060 #define PM3DisplayData 0x3068 #define PM3VerticalLineCount 0x3070 #define PM3FifoControl 0x3078 #define PM3ScreenBaseRight 0x3080 #define PM3MiscControl 0x3088 #define PM3VideoOverlayUpdate 0x3100 #define PM3VideoOverlayUpdate_DISABLE (0<<0) #define PM3VideoOverlayUpdate_ENABLE (1<<0) #define PM3VideoOverlayMode 0x3108 #define PM3VideoOverlayMode_DISABLE (0<<0) #define PM3VideoOverlayMode_ENABLE (1<<0) #define PM3VideoOverlayMode_BUFFERSYNC_MANUAL (0<<1) #define PM3VideoOverlayMode_BUFFERSYNC_VIDEOSTREAMA (1<<1) #define PM3VideoOverlayMode_BUFFERSYNC_VIDEOSTREAMB (2<<1) #define PM3VideoOverlayMode_FIELDPOLARITY_NORMAL (0<<4) #define PM3VideoOverlayMode_FIELDPOLARITY_INVERT (1<<4) #define PM3VideoOverlayMode_PIXELSIZE_8BIT (0<<5) #define PM3VideoOverlayMode_PIXELSIZE_16BIT (1<<5) #define PM3VideoOverlayMode_PIXELSIZE_32BIT (2<<5) #define PM3VideoOverlayMode_COLORFORMAT_RGB8888 ((0<<7)|(1<<12)|(2<<5)) #define PM3VideoOverlayMode_COLORFORMAT_RGB4444 ((1<<7)|(1<<12)|(1<<5)) #define PM3VideoOverlayMode_COLORFORMAT_RGB5551 ((2<<7)|(1<<12)|(1<<5)) #define PM3VideoOverlayMode_COLORFORMAT_RGB565 ((3<<7)|(1<<12)|(1<<5)) #define PM3VideoOverlayMode_COLORFORMAT_RGB332 ((4<<7)|(1<<12)|(0<<5)) #define PM3VideoOverlayMode_COLORFORMAT_BGR8888 ((0<<7)|(2<<5)) #define PM3VideoOverlayMode_COLORFORMAT_BGR4444 ((1<<7)|(1<<5)) #define PM3VideoOverlayMode_COLORFORMAT_BGR5551 ((2<<7)|(1<<5)) #define PM3VideoOverlayMode_COLORFORMAT_BGR565 ((3<<7)|(1<<5)) #define PM3VideoOverlayMode_COLORFORMAT_BGR332 ((4<<7)|(0<<5)) #define PM3VideoOverlayMode_COLORFORMAT_CI8 ((5<<7)|(1<<12)|(0<<5)) #define PM3VideoOverlayMode_COLORFORMAT_VUY444 ((2<<10)|(1<<12)|(2<<5)) #define PM3VideoOverlayMode_COLORFORMAT_YUV444 ((2<<10)|(2<<5)) #define PM3VideoOverlayMode_COLORFORMAT_VUY422 ((1<<10)|(1<<12)|(1<<5)) #define PM3VideoOverlayMode_COLORFORMAT_YUV422 ((1<<10)|(1<<5)) #define PM3VideoOverlayMode_COLORORDER_BGR (0<<12) #define PM3VideoOverlayMode_COLORORDER_RGB (1<<12) #define PM3VideoOverlayMode_LINEARCOLOREXT_OFF (0<<13) #define PM3VideoOverlayMode_LINEARCOLOREXT_ON (1<<13) #define PM3VideoOverlayMode_FILTER_MASK (3<<14) #define PM3VideoOverlayMode_FILTER_OFF (0<<14) #define PM3VideoOverlayMode_FILTER_FULL (1<<14) #define PM3VideoOverlayMode_FILTER_PARTIAL (2<<14) #define PM3VideoOverlayMode_DEINTERLACE_OFF (0<<16) #define PM3VideoOverlayMode_DEINTERLACE_BOB (1<<16) #define PM3VideoOverlayMode_PATCHMODE_OFF (0<<18) #define PM3VideoOverlayMode_PATCHMODE_ON (1<<18) #define PM3VideoOverlayMode_FLIP_VIDEO (0<<20) #define PM3VideoOverlayMode_FLIP_VIDEOSTREAMA (1<<20) #define PM3VideoOverlayMode_FLIP_VIDEOSTREAMB (2<<20) #define PM3VideoOverlayMode_MIRROR_MASK (3<<23) #define PM3VideoOverlayMode_MIRRORX_OFF (0<<23) #define PM3VideoOverlayMode_MIRRORX_ON (1<<23) #define PM3VideoOverlayMode_MIRRORY_OFF (0<<24) #define PM3VideoOverlayMode_MIRRORY_ON (1<<24) #define PM3VideoOverlayFifoControl 0x3110 #define PM3VideoOverlayIndex 0x3118 #define PM3VideoOverlayBase 0x3120 #define PM3VideoOverlayBase0 0x3120 #define PM3VideoOverlayBase1 0x3128 #define PM3VideoOverlayBase2 0x3130 #define PM3VideoOverlayStride 0x3138 #define PM3VideoOverlayStride_STRIDE(s) (((s)&0xfff)<<0) #define PM3VideoOverlayWidth 0x3140 #define PM3VideoOverlayWidth_WIDTH(w) (((w)&0xfff)<<0) #define PM3VideoOverlayHeight 0x3148 #define PM3VideoOverlayHeight_HEIGHT(h) (((h)&0xfff)<<0) #define PM3VideoOverlayOrigin 0x3150 #define PM3VideoOverlayOrigin_XORIGIN(x) (((x)&0xfff)<<0) #define PM3VideoOverlayOrigin_YORIGIN(y) (((y)&0xfff)<<16) #define PM3VideoOverlayShrinkXDelta 0x3158 #define PM3VideoOverlayShrinkXDelta_NONE (1<<16) #define PM3VideoOverlayShrinkXDelta_DELTA(s,d) \ ((((s)<<16)/(d))&0x0ffffff0) #define PM3VideoOverlayZoomXDelta 0x3160 #define PM3VideoOverlayZoomXDelta_NONE (1<<16) #define PM3VideoOverlayZoomXDelta_DELTA(s,d) \ ((((s)<<16)/(d))&0x0001fff0) #define PM3VideoOverlayYDelta 0x3168 #define PM3VideoOverlayYDelta_NONE (1<<16) #define PM3VideoOverlayYDelta_DELTA(s,d) \ ((((s)<<16)/(d))&0x0ffffff0) #define PM3VideoOverlayFieldOffset 0x3170 #define PM3VideoOverlayStatus 0x3178 /********************************************** * GLINT Permedia3 RAMDAC Registers (0x4000) * ***********************************************/ /* Direct Registers */ #define PM3RD_PaletteWriteAddress 0x4000 #define PM3RD_PaletteData 0x4008 #define PM3RD_PixelMask 0x4010 #define PM3RD_PaletteReadAddress 0x4018 #define PM3RD_IndexLow 0x4020 #define PM3RD_IndexHigh 0x4028 #define PM3RD_IndexedData 0x4030 #define PM3RD_IndexControl 0x4038 #define PM3RD_IndexControl_AUTOINCREMENT_ENABLE (1<<0) #define PM3RD_IndexControl_AUTOINCREMENT_DISABLE (0<<0) /* Indirect Registers */ #define PM3RD_MiscControl 0x000 #define PM3RD_MiscControl_HIGHCOLOR_RES_DISABLE (0<<0) #define PM3RD_MiscControl_HIGHCOLOR_RES_ENABLE (1<<0) #define PM3RD_MiscControl_PIXELDOUBLE_DISABLE (0<<1) #define PM3RD_MiscControl_PIXELDOUBLE_ENABLE (1<<1) #define PM3RD_MiscControl_LASTREAD_ADDR_DISABLE (0<<2) #define PM3RD_MiscControl_LASTREAD_ADDR_ENABLE (1<<2) #define PM3RD_MiscControl_DIRECTCOLOR_DISABLE (0<<3) #define PM3RD_MiscControl_DIRECTCOLOR_ENABLE (1<<3) #define PM3RD_MiscControl_OVERLAY_DISABLE (0<<4) #define PM3RD_MiscControl_OVERLAY_ENABLE (1<<4) #define PM3RD_MiscControl_PIXELDOUBLE_BUFFER_DISABLE (0<<5) #define PM3RD_MiscControl_PIXELDOUBLE_BUFFER_ENABLE (1<<5) #define PM3RD_MiscControl_VSB_OUTPUT_DISABLE (0<<6) #define PM3RD_MiscControl_VSB_OUTPUT_ENABLE (1<<6) #define PM3RD_MiscControl_STEREODOUBLE_BUFFER_DISABLE (0<<7) #define PM3RD_MiscControl_STEREODOUBLE_BUFFER_ENABLE (1<<7) #define PM3RD_SyncControl 0x001 #define PM3RD_SyncControl_HSYNC_ACTIVE_LOW (0<<0) #define PM3RD_SyncControl_HSYNC_ACTIVE_HIGH (1<<0) #define PM3RD_SyncControl_HSYNC_FORCE_ACTIVE (3<<0) #define PM3RD_SyncControl_HSYNC_FORCE_INACTIVE (4<<0) #define PM3RD_SyncControl_HSYNC_TRI_STATE (2<<0) #define PM3RD_SyncControl_VSYNC_ACTIVE_LOW (0<<3) #define PM3RD_SyncControl_VSYNC_ACTIVE_HIGH (1<<3) #define PM3RD_SyncControl_VSYNC_TRI_STATE (2<<3) #define PM3RD_SyncControl_VSYNC_FORCE_ACTIVE (3<<3) #define PM3RD_SyncControl_VSYNC_FORCE_INACTIVE (4<<3) #define PM3RD_SyncControl_HSYNC_OVERRIDE_SETBY_HSYNC (0<<6) #define PM3RD_SyncControl_HSYNC_OVERRIDE_FORCE_HIGH (1<<6) #define PM3RD_SyncControl_VSYNC_OVERRIDE_SETBY_VSYNC (0<<7) #define PM3RD_SyncControl_VSYNC_OVERRIDE_FORCE_HIGH (1<<7) #define PM3RD_DACControl 0x002 #define PM3RD_DACControl_DAC_POWER_ON (0<<0) #define PM3RD_DACControl_DAC_POWER_OFF (1<<0) #define PM3RD_DACControl_SYNC_ON_GREEN_DISABLE (0<<3) #define PM3RD_DACControl_SYNC_ON_GREEN_ENABLE (1<<3) #define PM3RD_DACControl_BLANK_RED_DAC_DISABLE (0<<4) #define PM3RD_DACControl_BLANK_RED_DAC_ENABLE (1<<4) #define PM3RD_DACControl_BLANK_GREEN_DAC_DISABLE (0<<5) #define PM3RD_DACControl_BLANK_GREEN_DAC_ENABLE (1<<5) #define PM3RD_DACControl_BLANK_BLUE_DAC_DISABLE (0<<6) #define PM3RD_DACControl_BLANK_BLUE_DAC_ENABLE (1<<6) #define PM3RD_DACControl_BLANK_PEDESTAL_DISABLE (0<<7) #define PM3RD_DACControl_BLANK_PEDESTAL_ENABLE (1<<7) #define PM3RD_PixelSize 0x003 #define PM3RD_PixelSize_24_BIT_PIXELS (4<<0) #define PM3RD_PixelSize_32_BIT_PIXELS (2<<0) #define PM3RD_PixelSize_16_BIT_PIXELS (1<<0) #define PM3RD_PixelSize_8_BIT_PIXELS (0<<0) #define PM3RD_ColorFormat 0x004 #define PM3RD_ColorFormat_LINEAR_COLOR_EXT_ENABLE (1<<6) #define PM3RD_ColorFormat_LINEAR_COLOR_EXT_DISABLE (0<<6) #define PM3RD_ColorFormat_COLOR_ORDER_BLUE_LOW (1<<5) #define PM3RD_ColorFormat_COLOR_ORDER_RED_LOW (0<<5) #define PM3RD_ColorFormat_COLOR_FORMAT_MASK (0x1f<<0) #define PM3RD_ColorFormat_8888_COLOR (0<<0) #define PM3RD_ColorFormat_5551_FRONT_COLOR (1<<0) #define PM3RD_ColorFormat_4444_COLOR (2<<0) #define PM3RD_ColorFormat_332_FRONT_COLOR (5<<0) #define PM3RD_ColorFormat_332_BACK_COLOR (6<<0) #define PM3RD_ColorFormat_2321_FRONT_COLOR (9<<0) #define PM3RD_ColorFormat_2321_BACK_COLOR (10<<0) #define PM3RD_ColorFormat_232_FRONTOFF_COLOR (11<<0) #define PM3RD_ColorFormat_232_BACKOFF_COLOR (12<<0) #define PM3RD_ColorFormat_5551_BACK_COLOR (13<<0) #define PM3RD_ColorFormat_CI8_COLOR (14<<0) #define PM3RD_ColorFormat_565_FRONT_COLOR (16<<0) #define PM3RD_ColorFormat_565_BACK_COLOR (17<<0) #define PM3RD_CursorMode 0x005 #define PM3RD_CursorMode_CURSOR_DISABLE (0<<0) #define PM3RD_CursorMode_CURSOR_ENABLE (1<<0) #define PM3RD_CursorMode_FORMAT_64x64_2BPE_P0123 (0<<2) #define PM3RD_CursorMode_FORMAT_32x32_2BPE_P0 (1<<2) #define PM3RD_CursorMode_FORMAT_32x32_2BPE_P1 (2<<2) #define PM3RD_CursorMode_FORMAT_32x32_2BPE_P2 (3<<2) #define PM3RD_CursorMode_FORMAT_32x32_2BPE_P3 (4<<2) #define PM3RD_CursorMode_FORMAT_32x32_4BPE_P01 (5<<2) #define PM3RD_CursorMode_FORMAT_32x32_4BPE_P23 (6<<2) #define PM3RD_CursorMode_TYPE_MS (0<<4) #define PM3RD_CursorMode_TYPE_X (1<<4) #define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_DISABLE (0<<6) #define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_ENABLE (1<<6) #define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_3_COLOR (2<<6) #define PM3RD_CursorMode_REVERSE_PIXEL_ORDER_15_COLOR (3<<6) #define PM3RD_CursorControl 0x006 #define PM3RD_CursorControl_DOUBLE_X_DISABLED (0<<0) #define PM3RD_CursorControl_DOUBLE_X_ENABLED (1<<0) #define PM3RD_CursorControl_DOUBLE_Y_DISABLED (0<<1) #define PM3RD_CursorControl_DOUBLE_Y_ENABLED (1<<1) #define PM3RD_CursorControl_READBACK_POS_DISABLED (0<<2) #define PM3RD_CursorControl_READBACK_POS_ENABLED (1<<2) #define PM3RD_CursorXLow 0x007 #define PM3RD_CursorXHigh 0x008 #define PM3RD_CursorYLow 0x009 #define PM3RD_CursorYHigh 0x00a #define PM3RD_CursorHotSpotX 0x00b #define PM3RD_CursorHotSpotY 0x00c #define PM3RD_OverlayKey 0x00d #define PM3RD_Pan 0x00e #define PM3RD_Pan_DISABLE (0<<0) #define PM3RD_Pan_ENABLE (1<<0) #define PM3RD_Pan_GATE_DISABLE (0<<1) #define PM3RD_Pan_GATE_ENABLE (1<<1) #define PM3RD_Sense 0x00f #define PM3RD_CheckControl 0x018 #define PM3RD_CheckControl_PIXEL_DISABLED (0<<0) #define PM3RD_CheckControl_PIXEL_ENABLED (1<<0) #define PM3RD_CheckControl_LUT_DISABLED (0<<1) #define PM3RD_CheckControl_LUT_ENABLED (1<<1) #define PM3RD_CheckPixelRed 0x019 #define PM3RD_CheckPixelGreen 0x01a #define PM3RD_CheckPixelBlue 0x01b #define PM3RD_CheckLUTRed 0x01c #define PM3RD_CheckLUTGreen 0x01d #define PM3RD_CheckLUTBlue 0x01e #define PM3RD_Scratch 0x01f #define PM3RD_VideoOverlayControl 0x020 #define PM3RD_VideoOverlayControl_DISABLE (0<<0) #define PM3RD_VideoOverlayControl_ENABLE (1<<0) #define PM3RD_VideoOverlayControl_MODE_MASK (3<<1) #define PM3RD_VideoOverlayControl_MODE_MAINKEY (0<<1) #define PM3RD_VideoOverlayControl_MODE_OVERLAYKEY (1<<1) #define PM3RD_VideoOverlayControl_MODE_ALWAYS (2<<1) #define PM3RD_VideoOverlayControl_MODE_BLEND (3<<1) #define PM3RD_VideoOverlayControl_DIRECTCOLOR_DISABLED (0<<3) #define PM3RD_VideoOverlayControl_DIRECTCOLOR_ENABLED (1<<3) #define PM3RD_VideoOverlayControl_BLENDSRC_MAIN (0<<4) #define PM3RD_VideoOverlayControl_BLENDSRC_REGISTER (1<<4) #define PM3RD_VideoOverlayControl_KEY_COLOR (0<<5) #define PM3RD_VideoOverlayControl_KEY_ALPHA (1<<5) #define PM3RD_VideoOverlayXStartLow 0x021 #define PM3RD_VideoOverlayXStartHigh 0x022 #define PM3RD_VideoOverlayYStartLow 0x023 #define PM3RD_VideoOverlayYStartHigh 0x024 #define PM3RD_VideoOverlayXEndLow 0x025 #define PM3RD_VideoOverlayXEndHigh 0x026 #define PM3RD_VideoOverlayYEndLow 0x027 #define PM3RD_VideoOverlayYEndHigh 0x028 #define PM3RD_VideoOverlayKeyR 0x029 #define PM3RD_VideoOverlayKeyG 0x02a #define PM3RD_VideoOverlayKeyB 0x02b #define PM3RD_VideoOverlayBlend 0x02c #define PM3RD_VideoOverlayBlend_FACTOR_0_PERCENT (0<<6) #define PM3RD_VideoOverlayBlend_FACTOR_25_PERCENT (1<<6) #define PM3RD_VideoOverlayBlend_FACTOR_75_PERCENT (2<<6) #define PM3RD_VideoOverlayBlend_FACTOR_100_PERCENT (3<<6) #define PM3RD_DClkSetup1 0x1f0 #define PM3RD_DClkSetup2 0x1f1 #define PM3RD_KClkSetup1 0x1f2 #define PM3RD_KClkSetup2 0x1f3 #define PM3RD_DClkControl 0x200 #define PM3RD_DClkControl_SOURCE_PLL (0<<4) #define PM3RD_DClkControl_SOURCE_VSA (1<<4) #define PM3RD_DClkControl_SOURCE_VSB (2<<4) #define PM3RD_DClkControl_SOURCE_EXT (3<<4) #define PM3RD_DClkControl_STATE_RUN (2<<2) #define PM3RD_DClkControl_STATE_HIGH (1<<2) #define PM3RD_DClkControl_STATE_LOW (0<<2) #define PM3RD_DClkControl_LOCKED (1<<1) #define PM3RD_DClkControl_NOT_LOCKED (0<<1) #define PM3RD_DClkControl_ENABLE (1<<0) #define PM3RD_DClkControl_DISABLE (0<<0) #define PM3RD_DClk0PreScale 0x201 #define PM3RD_DClk0FeedbackScale 0x202 #define PM3RD_DClk0PostScale 0x203 #define PM3RD_DClk1PreScale 0x204 #define PM3RD_DClk1FeedbackScale 0x205 #define PM3RD_DClk1PostScale 0x206 #define PM3RD_DClk2PreScale 0x207 #define PM3RD_DClk2FeedbackScale 0x208 #define PM3RD_DClk2PostScale 0x209 #define PM3RD_DClk3PreScale 0x20a #define PM3RD_DClk3FeedbackScale 0x20b #define PM3RD_DClk3PostScale 0x20c #define PM3RD_KClkControl 0x20d #define PM3RD_KClkControl_DISABLE (0<<0) #define PM3RD_KClkControl_ENABLE (1<<0) #define PM3RD_KClkControl_NOT_LOCKED (0<<1) #define PM3RD_KClkControl_LOCKED (1<<1) #define PM3RD_KClkControl_STATE_LOW (0<<2) #define PM3RD_KClkControl_STATE_HIGH (1<<2) #define PM3RD_KClkControl_STATE_RUN (2<<2) #define PM3RD_KClkControl_STATE_LOW_POWER (3<<2) #define PM3RD_KClkControl_SOURCE_PCLK (0<<4) #define PM3RD_KClkControl_SOURCE_HALF_PCLK (1<<4) #define PM3RD_KClkControl_SOURCE_PLL (2<<4) #define PM3RD_KClkPreScale 0x20e #define PM3RD_KClkFeedbackScale 0x20f #define PM3RD_KClkPostScale 0x210 #define PM3RD_MClkControl 0x211 #define PM3RD_MClkControl_DISABLE (0<<0) #define PM3RD_MClkControl_ENABLE (1<<0) #define PM3RD_MClkControl_NOT_LOCKED (0<<1) #define PM3RD_MClkControl_LOCKED (1<<1) #define PM3RD_MClkControl_STATE_LOW (0<<2) #define PM3RD_MClkControl_STATE_HIGH (1<<2) #define PM3RD_MClkControl_STATE_RUN (2<<2) #define PM3RD_MClkControl_STATE_LOW_POWER (3<<2) #define PM3RD_MClkControl_SOURCE_PCLK (0<<4) #define PM3RD_MClkControl_SOURCE_HALF_PCLK (1<<4) #define PM3RD_MClkControl_SOURCE_HALF_EXT (3<<4) #define PM3RD_MClkControl_SOURCE_EXT (4<<4) #define PM3RD_MClkControl_SOURCE_HALF_KCLK (5<<4) #define PM3RD_MClkControl_SOURCE_KCLK (6<<4) #define PM3RD_MClkPreScale 0x212 #define PM3RD_MClkFeedbackScale 0x213 #define PM3RD_MClkPostScale 0x214 #define PM3RD_SClkControl 0x215 #define PM3RD_SClkControl_DISABLE (0<<0) #define PM3RD_SClkControl_ENABLE (1<<0) #define PM3RD_SClkControl_NOT_LOCKED (0<<1) #define PM3RD_SClkControl_LOCKED (1<<1) #define PM3RD_SClkControl_STATE_LOW (0<<2) #define PM3RD_SClkControl_STATE_HIGH (1<<2) #define PM3RD_SClkControl_STATE_RUN (2<<2) #define PM3RD_SClkControl_STATE_LOW_POWER (3<<2) #define PM3RD_SClkControl_SOURCE_PCLK (0<<4) #define PM3RD_SClkControl_SOURCE_HALF_PCLK (1<<4) #define PM3RD_SClkControl_SOURCE_HALF_EXT (3<<4) #define PM3RD_SClkControl_SOURCE_EXT (4<<4) #define PM3RD_SClkControl_SOURCE_HALF_KCLK (5<<4) #define PM3RD_SClkControl_SOURCE_KCLK (6<<4) #define PM3RD_SClkPreScale 0x216 #define PM3RD_SClkFeedbackScale 0x217 #define PM3RD_SClkPostScale 0x218 #define PM3RD_CursorPalette(p) (0x303+(p)) #define PM3RD_CursorPattern(p) (0x400+(p)) /****************************************************** * GLINT Permedia3 Video Streaming Registers (0x5000) * *******************************************************/ #define PM3VSConfiguration 0x5800 /********************************************** * GLINT Permedia3 Core Registers (0x8000+) * ***********************************************/ #define PM3AALineWidth 0x94c0 #define PM3AAPointsize 0x94a0 #define PM3AlphaBlendAlphaMode 0xafa8 #define PM3AlphaBlendAlphaModeAnd 0xad30 #define PM3AlphaBlendAlphaModeOr 0xad38 #define PM3AlphaBlendColorMode 0xafa0 #define PM3AlphaBlendColorModeAnd 0xacb0 #define PM3AlphaBlendColorModeOr 0xacb8 #define PM3AlphaDestColor 0xaf88 #define PM3AlphaSourceColor 0xaf80 #define PM3AlphaTestMode 0x8800 #define PM3AlphaTestModeAnd 0xabf0 #define PM3AlphaTestModeOr 0xabf8 #define PM3AntialiasMode 0x8808 #define PM3AntialiasModeAnd 0xac00 #define PM3AntialiasModeOr 0xac08 #define PM3AreaStippleMode 0x81a0 /* ... */ #define PM3BackgroundColor 0xb0c8 #define PM3BasePageOfWorkingSet 0xb4c8 /* ... */ #define PM3ChromaTestMode 0x8f18 /* ... */ #define PM3ColorDDAMode 0x87e0 #define PM3ColorDDAModeAnd 0xabe0 #define PM3ColorDDAModeOr 0xabe8 #define PM3CommandInterrupt 0xa990 #define PM3ConstantColorDDA 0xafb0 #define PM3ConstantColorDDA_R(r) ((r)&0xff) #define PM3ConstantColorDDA_G(g) (((g)&0xff)<<8) #define PM3ConstantColorDDA_B(b) (((b)&0xff)<<16) #define PM3ConstantColorDDA_A(a) (((a)&0xff)<<24) #define PM3ContextData 0x8dd0 #define PM3ContextDump 0x8dc0 #define PM3ContextRestore 0x8dc8 #define PM3Continue 0x8058 #define PM3ContinueNewDom 0x8048 #define PM3ContinueNewLine 0x8040 #define PM3ContinueNewSub 0x8050 #define PM3Count 0x8030 /* ... */ #define PM3DeltaControl 0x9350 #define PM3DeltaControlAnd 0xab20 #define PM3DeltaControlOr 0xab28 #define PM3DeltaMode 0x9300 #define PM3DeltaModeAnd 0xaad0 #define PM3DeltaModeOr 0xaad8 #define PM3DepthMode 0x89a0 /* ... */ #define PM3DitherMode 0x8818 #define PM3DitherModeAnd 0xacd0 #define PM3DitherModeOr 0xacd8 /* ... */ #define PM3DMARectangleRead 0xa9a8 #define PM3DMARectangleRead_Width(w) (w&0xfff) #define PM3DMARectangleRead_Height(h) ((h&0xfff)<<12) #define PM3DMARectangleRead_PixelSize(s) ((s&0x3)<<24) #define PM3DMARectangleRead_Pack (1<<26) #define PM3DMARectangleRead_ByteSwap(b) ((b&0x3)<<27) #define PM3DMARectangleRead_Alignment (1<<30) #define PM3DMARectangleReadAddress 0xa9b0 #define PM3DMARectangleReadLinePitch 0xa9b8 #define PM3DMARectangleReadTarget 0xa9c0 /* ... */ #define PM3DownloadAddress 0xb0d0 #define PM3DownloadData 0xb0d8 /* ... */ #define PM3dBdx 0x87b8 #define PM3dBdyDom 0x87c0 #define PM3dGdx 0x87a0 #define PM3dGdyDom 0x87a8 #define PM3dQdx 0x83c0 #define PM3dQdyDom 0x83c8 #define PM3dRdx 0x8788 #define PM3dRdyDom 0x8790 #define PM3dSdx 0x8390 #define PM3dSdy 0x83d8 #define PM3dSdyDom 0x8398 #define PM3dTdx 0x83a8 #define PM3dTdy 0x83e0 #define PM3dTdyDom 0x83b0 #define PM3dXDom 0x8008 #define PM3dXSub 0x8018 #define PM3dY 0x8028 /* ... */ #define PM3FBBlockColor 0x8ac8 #define PM3FBBlockColor0 0xb060 #define PM3FBBlockColor1 0xb068 #define PM3FBBlockColor2 0xb070 #define PM3FBBlockColor3 0xb078 #define PM3FBBlockColorBack 0xb0a0 #define PM3FBBlockColorBack0 0xb080 #define PM3FBBlockColorBack1 0xb088 #define PM3FBBlockColorBack2 0xb090 #define PM3FBBlockColorBack3 0xb098 #define PM3FBColor 0x8a98 #define PM3FBDestReadBufferAddr0 0xae80 #define PM3FBDestReadBufferAddr1 0xae88 #define PM3FBDestReadBufferAddr2 0xae90 #define PM3FBDestReadBufferAddr3 0xae98 #define PM3FBDestReadBufferOffset0 0xaea0 #define PM3FBDestReadBufferOffset1 0xaea8 #define PM3FBDestReadBufferOffset2 0xaeb0 #define PM3FBDestReadBufferOffset3 0xaeb8 #define PM3FBDestReadBufferOffset_XOffset(x) ((x)&0xffff) #define PM3FBDestReadBufferOffset_YOffset(y) (((y)&0xffff)<<16) #define PM3FBDestReadBufferWidth0 0xaec0 #define PM3FBDestReadBufferWidth1 0xaec8 #define PM3FBDestReadBufferWidth2 0xaed0 #define PM3FBDestReadBufferWidth3 0xaed8 #define PM3FBDestReadBufferWidth_Width(w) ((w)&0x0fff) #define PM3FBDestReadEnables 0xaee8 #define PM3FBDestReadEnablesAnd 0xad20 #define PM3FBDestReadEnablesOr 0xad28 #define PM3FBDestReadEnables_E(e) ((e)&0xff) #define PM3FBDestReadEnables_E0 (1<<0) #define PM3FBDestReadEnables_E1 (1<<1) #define PM3FBDestReadEnables_E2 (1<<2) #define PM3FBDestReadEnables_E3 (1<<3) #define PM3FBDestReadEnables_E4 (1<<4) #define PM3FBDestReadEnables_E5 (1<<5) #define PM3FBDestReadEnables_E6 (1<<6) #define PM3FBDestReadEnables_E7 (1<<7) #define PM3FBDestReadEnables_R(r) (((r)&0xff)<<8) #define PM3FBDestReadEnables_R0 (1<<8) #define PM3FBDestReadEnables_R1 (1<<9) #define PM3FBDestReadEnables_R2 (1<<10) #define PM3FBDestReadEnables_R3 (1<<11) #define PM3FBDestReadEnables_R4 (1<<12) #define PM3FBDestReadEnables_R5 (1<<13) #define PM3FBDestReadEnables_R6 (1<<14) #define PM3FBDestReadEnables_R7 (1<<15) #define PM3FBDestReadEnables_ReferenceAlpha(a) (((a)&0xff)<<24) #define PM3FBDestReadMode 0xaee0 #define PM3FBDestReadModeAnd 0xac90 #define PM3FBDestReadModeOr 0xac98 #define PM3FBDestReadMode_ReadDisable (0<<0) #define PM3FBDestReadMode_ReadEnable (1<<0) #define PM3FBDestReadMode_StripePitch(sp) (((sp)&0x7)<<2) #define PM3FBDestReadMode_StripeHeight(sh) (((sh)&0x7)<<7) #define PM3FBDestReadMode_Enable0 (1<<8) #define PM3FBDestReadMode_Enable1 (1<<9) #define PM3FBDestReadMode_Enable2 (1<<10) #define PM3FBDestReadMode_Enable3 (1<<11) #define PM3FBDestReadMode_Layout0(l) (((l)&0x3)<<12) #define PM3FBDestReadMode_Layout1(l) (((l)&0x3)<<14) #define PM3FBDestReadMode_Layout2(l) (((l)&0x3)<<16) #define PM3FBDestReadMode_Layout3(l) (((l)&0x3)<<18) #define PM3FBDestReadMode_Origin0 (1<<20) #define PM3FBDestReadMode_Origin1 (1<<21) #define PM3FBDestReadMode_Origin2 (1<<22) #define PM3FBDestReadMode_Origin3 (1<<23) #define PM3FBDestReadMode_Blocking (1<<24) #define PM3FBDestReadMode_UseReadEnabled (1<<26) #define PM3FBDestReadMode_AlphaFiltering (1<<27) #define PM3FBHardwareWriteMask 0x8ac0 #define PM3FBSoftwareWriteMask 0x8820 #define PM3FBData 0x8aa0 #define PM3FBSourceData 0x8aa8 #define PM3FBSourceReadBufferAddr 0xaf08 #define PM3FBSourceReadBufferOffset 0xaf10 #define PM3FBSourceReadBufferOffset_XOffset(x) ((x)&0xffff) #define PM3FBSourceReadBufferOffset_YOffset(y) (((y)&0xffff)<<16) #define PM3FBSourceReadBufferWidth 0xaf18 #define PM3FBSourceReadBufferWidth_Width(w) ((w)&0x0fff) #define PM3FBSourceReadMode 0xaf00 #define PM3FBSourceReadModeAnd 0xaca0 #define PM3FBSourceReadModeOr 0xaca8 #define PM3FBSourceReadMode_ReadDisable (0<<0) #define PM3FBSourceReadMode_ReadEnable (1<<0) #define PM3FBSourceReadMode_StripePitch(sp) (((sp)&0x7)<<2) #define PM3FBSourceReadMode_StripeHeight(sh) (((sh)&0x7)<<7) #define PM3FBSourceReadMode_Layout(l) (((l)&0x3)<<8) #define PM3FBSourceReadMode_Origin (1<<10) #define PM3FBSourceReadMode_Blocking (1<<11) #define PM3FBSourceReadMode_UseTexelCoord (1<<13) #define PM3FBSourceReadMode_WrapXEnable (1<<14) #define PM3FBSourceReadMode_WrapYEnable (1<<15) #define PM3FBSourceReadMode_WrapX(w) (((w)&0xf)<<16) #define PM3FBSourceReadMode_WrapY(w) (((w)&0xf)<<20) #define PM3FBSourceReadMode_ExternalSourceData (1<<24) #define PM3FBWriteBufferAddr0 0xb000 #define PM3FBWriteBufferAddr1 0xb008 #define PM3FBWriteBufferAddr2 0xb010 #define PM3FBWriteBufferAddr3 0xb018 #define PM3FBWriteBufferOffset0 0xb020 #define PM3FBWriteBufferOffset1 0xb028 #define PM3FBWriteBufferOffset2 0xb030 #define PM3FBWriteBufferOffset3 0xb038 #define PM3FBWriteBufferOffset_XOffset(x) ((x)&0xffff) #define PM3FBWriteBufferOffset_YOffset(y) (((y)&0xffff)<<16) #define PM3FBWriteBufferWidth0 0xb040 #define PM3FBWriteBufferWidth1 0xb048 #define PM3FBWriteBufferWidth2 0xb050 #define PM3FBWriteBufferWidth3 0xb058 #define PM3FBWriteBufferWidth_Width(w) ((w)&0x0fff) #define PM3FBWriteMode 0x8ab8 #define PM3FBWriteModeAnd 0xacf0 #define PM3FBWriteModeOr 0xacf8 #define PM3FBWriteMode_WriteDisable 0<<0 #define PM3FBWriteMode_WriteEnable 1<<0 #define PM3FBWriteMode_Replicate 1<<4 #define PM3FBWriteMode_OpaqueSpan 1<<5 #define PM3FBWriteMode_StripePitch(p) (((p)&0x7)<<6) #define PM3FBWriteMode_StripeHeight(h) (((h)&0x7)<<9) #define PM3FBWriteMode_Enable0 1<<12 #define PM3FBWriteMode_Enable1 1<<13 #define PM3FBWriteMode_Enable2 1<<14 #define PM3FBWriteMode_Enable3 1<<15 #define PM3FBWriteMode_Layout0(l) (((l)&0x3)<<16) #define PM3FBWriteMode_Layout1(l) (((l)&0x3)<<18) #define PM3FBWriteMode_Layout2(l) (((l)&0x3)<<20) #define PM3FBWriteMode_Layout3(l) (((l)&0x3)<<22) #define PM3FBWriteMode_Origin0 1<<24 #define PM3FBWriteMode_Origin1 1<<25 #define PM3FBWriteMode_Origin2 1<<26 #define PM3FBWriteMode_Origin3 1<<27 #define PM3FogMode 0x8690 #define PM3ForegroundColor 0xb0c0 /* ... */ #define PM3GIDMode 0xb538 #define PM3GIDModeAnd 0xb5b0 #define PM3GIDModeOr 0xb5b8 /* ... */ #define PM3HeadPhysicalPageAllocation0 0xb480 #define PM3HeadPhysicalPageAllocation1 0xb488 #define PM3HeadPhysicalPageAllocation2 0xb490 #define PM3HeadPhysicalPageAllocation3 0xb498 /* ... */ #define PM3LBDestReadBufferAddr 0xb510 #define PM3LBDestReadBufferOffset 0xb518 #define PM3LBDestReadEnables 0xb508 #define PM3LBDestReadEnablesAnd 0xb590 #define PM3LBDestReadEnablesOr 0xb598 #define PM3LBDestReadMode 0xb500 #define PM3LBDestReadModeAnd 0xb580 #define PM3LBDestReadModeOr 0xb588 #define PM3LBDestReadMode_Disable (0<<0) #define PM3LBDestReadMode_Enable (1<<0) #define PM3LBDestReadMode_StripePitch(p) (((p)&0x7)<<2) #define PM3LBDestReadMode_StripeHeight(h) (((h)&0x7)<<5) #define PM3LBDestReadMode_Layout (1<<8) #define PM3LBDestReadMode_Origin (1<<9) #define PM3LBDestReadMode_UserReadEnables (1<<10) #define PM3LBDestReadMode_Packed16 (1<<11) #define PM3LBDestReadMode_Width(w) (((w)&0xfff)<<12) #define PM3LBReadFormat 0x8888 #define PM3LBReadFormat_DepthWidth(w) (((w)&0x3)<<0) #define PM3LBReadFormat_StencilWidth(w) (((w)&0xf)<<2) #define PM3LBReadFormat_StencilPosition(p) (((p)&0x1f)<<6) #define PM3LBReadFormat_FCPWidth(w) (((w)&0xf)<<11) #define PM3LBReadFormat_FCPPosition(p) (((p)&0x1f)<<15) #define PM3LBReadFormat_GIDWidth(w) (((w)&0x7)<<20) #define PM3LBReadFormat_GIDPosition(p) (((p)&0x1f)<<23) #define PM3LBSourceReadBufferAddr 0xb528 #define PM3LBSourceReadBufferOffset 0xb530 #define PM3LBSourceReadMode 0xb520 #define PM3LBSourceReadModeAnd 0xb5a0 #define PM3LBSourceReadModeOr 0xb5a8 #define PM3LBSourceReadMode_Enable (1<<0) #define PM3LBSourceReadMode_StripePitch(p) (((p)&0x7)<<2) #define PM3LBSourceReadMode_StripeHeight(h) (((h)&0x7)<<5) #define PM3LBSourceReadMode_Layout (1<<8) #define PM3LBSourceReadMode_Origin (1<<9) #define PM3LBSourceReadMode_Packed16 (1<<10) #define PM3LBSourceReadMode_Width(w) (((w)&0xfff)<<11) #define PM3LBStencil 0x88a8 #define PM3LBWriteBufferAddr 0xb540 #define PM3LBWriteBufferOffset 0xb548 #define PM3LBWriteFormat 0x88c8 #define PM3LBWriteFormat_DepthWidth(w) (((w)&0x3)<<0) #define PM3LBWriteFormat_StencilWidth(w) (((w)&0xf)<<2) #define PM3LBWriteFormat_StencilPosition(p) (((p)&0x1f)<<6) #define PM3LBWriteFormat_GIDWidth(w) (((w)&0x7)<<20) #define PM3LBWriteFormat_GIDPosition(p) (((p)&0x1f)<<23) #define PM3LBWriteMode 0x88c0 #define PM3LBWriteModeAnd 0xac80 #define PM3LBWriteModeOr 0xac88 #define PM3LBWriteMode_WriteDisable (0<<0) #define PM3LBWriteMode_WriteEnable (1<<0) #define PM3LBWriteMode_StripePitch(p) (((p)&0x7)<<3) #define PM3LBWriteMode_StripeHeight(h) (((h)&0x7)<<6) #define PM3LBWriteMode_Layout (1<<9) #define PM3LBWriteMode_Origin (1<<10) #define PM3LBWriteMode_Packed16 (1<<11) #define PM3LBWriteMode_Width(w) (((w)&0xfff)<<12) /* ... */ #define PM3LineStippleMode 0x81a8 #define PM3LineStippleModeAnd 0xabc0 #define PM3LineStippleModeOr 0xabc8 #define PM3LoadLineStippleCounters 0x81b0 /* ... */ #define PM3LogicalOpMode 0x8828 #define PM3LogicalOpModeAnd 0xace0 #define PM3LogicalOpModeOr 0xace8 #define PM3LogicalOpMode_Disable (0<<0) #define PM3LogicalOpMode_Enable (1<<0) #define PM3LogicalOpMode_LogicOp(op) (((op)&0xf)<<1) #define PM3LogicalOpMode_UseConstantWriteData_Disable (0<<5) #define PM3LogicalOpMode_UseConstantWriteData_Enable (1<<5) #define PM3LogicalOpMode_Background_Disable (0<<6) #define PM3LogicalOpMode_Background_Enable (1<<6) #define PM3LogicalOpMode_Background_LogicOp(op) (((op)&0xf)<<7) #define PM3LogicalOpMode_UseConstantSource_Disable (0<<11) #define PM3LogicalOpMode_UseConstantSource_Enable (1<<11) #define PM3LogicalTexturePageAddr 0xb4d0 #define PM3LogicalTexturePageTableLength 0xb4d8 /* ... */ #define PM3LUT 0x8e80 /* ... */ #define PM3LUT 0x8e80 #define PM3LUTAddress 0x84d0 #define PM3LUTData 0x84c8 #define PM3LUTIndex 0x84c0 #define PM3LUTMode 0xb378 #define PM3LUTModeAnd 0xad70 #define PM3LUTModeOr 0xad78 #define PM3LUTTransfer 0x84d8 /* ... */ #define PM3PhysicalPageAllocationTableAddr 0xb4c0 /* ... */ #define PM3PixelSize 0x80c0 #define PM3PixelSize_GLOBAL_32BIT (0<<0) #define PM3PixelSize_GLOBAL_16BIT (1<<0) #define PM3PixelSize_GLOBAL_8BIT (2<<0) #define PM3PixelSize_RASTERIZER_32BIT (0<<2) #define PM3PixelSize_RASTERIZER_16BIT (1<<2) #define PM3PixelSize_RASTERIZER_8BIT (2<<2) #define PM3PixelSize_SCISSOR_AND_STIPPLE_32BIT (0<<4) #define PM3PixelSize_SCISSOR_AND_STIPPLE_16BIT (1<<4) #define PM3PixelSize_SCISSOR_AND_STIPPLE_8BIT (2<<4) #define PM3PixelSize_TEXTURE_32BIT (0<<6) #define PM3PixelSize_TEXTURE_16BIT (1<<6) #define PM3PixelSize_TEXTURE_8BIT (2<<6) #define PM3PixelSize_LUT_32BIT (0<<8) #define PM3PixelSize_LUT_16BIT (1<<8) #define PM3PixelSize_LUT_8BIT (2<<8) #define PM3PixelSize_FRAMEBUFFER_32BIT (0<<10) #define PM3PixelSize_FRAMEBUFFER_16BIT (1<<10) #define PM3PixelSize_FRAMEBUFFER_8BIT (2<<10) #define PM3PixelSize_LOGICAL_OP_32BIT (0<<12) #define PM3PixelSize_LOGICAL_OP_16BIT (1<<12) #define PM3PixelSize_LOGICAL_OP_8BIT (2<<12) #define PM3PixelSize_LOCALBUFFER_32BIT (0<<14) #define PM3PixelSize_LOCALBUFFER_16BIT (1<<14) #define PM3PixelSize_LOCALBUFFER_8BIT (2<<14) #define PM3PixelSize_SETUP_32BIT (0<<16) #define PM3PixelSize_SETUP_16BIT (1<<16) #define PM3PixelSize_SETUP_8BIT (2<<16) #define PM3PixelSize_GLOBAL (0<<31) #define PM3PixelSize_INDIVIDUAL (1<<31) /* ... */ #define PM3QStart 0x83b8 #define PM3Render 0x8038 #define PM3Render_AreaStipple_Disable (0<<0) #define PM3Render_AreaStipple_Enable (1<<0) #define PM3Render_LineStipple_Disable (0<<1) #define PM3Render_LineStipple_Enable (1<<1) #define PM3Render_ResetLine_Disable (0<<2) #define PM3Render_ResetLine_Enable (1<<2) #define PM3Render_FastFill_Disable (0<<3) #define PM3Render_FastFill_Enable (1<<3) #define PM3Render_Primitive_Line (0<<6) #define PM3Render_Primitive_Trapezoid (1<<6) #define PM3Render_Primitive_Point (2<<6) #define PM3Render_Antialias_Disable (0<<8) #define PM3Render_Antialias_Enable (1<<8) #define PM3Render_Antialias_SubPixelRes_4x4 (0<<9) #define PM3Render_Antialias_SubPixelRes_8x8 (1<<9) #define PM3Render_UsePointTable_Disable (0<<10) #define PM3Render_UsePointTable_Enable (1<<10) #define PM3Render_SyncOnbitMask_Disable (0<<11) #define PM3Render_SyncOnBitMask_Enable (1<<11) #define PM3Render_SyncOnHostData_Disable (0<<12) #define PM3Render_SyncOnHostData_Enable (1<<12) #define PM3Render_Texture_Disable (0<<13) #define PM3Render_Texture_Enable (1<<13) #define PM3Render_Fog_Disable (0<<14) #define PM3Render_Fog_Enable (1<<14) #define PM3Render_Coverage_Disable (0<<15) #define PM3Render_Coverage_Enable (1<<15) #define PM3Render_SubPixelCorrection_Disable (0<<16) #define PM3Render_SubPixelCorrection_Enable (1<<16) #define PM3Render_SpanOperation_Disable (0<<18) #define PM3Render_SpanOperation_Enable (1<<18) #define PM3Render_FBSourceRead_Disable (0<<27) #define PM3Render_FBSourceRead_Enable (1<<27) #define PM3RasterizerMode 0x80a0 #define PM3RasterizerModeAnd 0xaba0 #define PM3RasterizerModeOr 0xabb8 #define PM3RectangleHeight 0x94e0 #define PM3RepeatLine 0x9328 #define PM3ResetPickResult 0x8c20 #define PM3RLEMask 0x8c48 #define PM3RouterMode 0x8840 #define PM3RStart 0x8780 #define PM3S1Start 0x8400 #define PM3aveLineStippleCounters 0x81c0 #define PM3ScissorMaxXY 0x8190 #define PM3ScissorMinXY 0x8188 #define PM3ScissorMode 0x8180 #define PM3ScissorModeAnd 0xabb0 #define PM3ScissorModeOr 0xabb8 #define PM3ScreenSize 0x8198 #define PM3Security 0x8908 #define PM3SetLogicalTexturePage 0xb360 #define PM3SizeOfFramebuffer 0xb0a8 #define PM3SStart 0x8388 #define PM3StartXDom 0x8000 #define PM3StartXSub 0x8010 #define PM3StartY 0x8020 /* ... */ #define PM3SpanColorMask 0x8168 #define PM3StencilMode 0x8988 /* ... */ #define PM3TailPhysicalPageAllocation0 0xb4a0 #define PM3TailPhysicalPageAllocation1 0xb4a8 #define PM3TailPhysicalPageAllocation2 0xb4b0 #define PM3TailPhysicalPageAllocation3 0xb4b8 /* ... */ #define PM3TextureApplicationMode 0x8680 #define PM3TextureApplicationModeAnd 0xac50 #define PM3TextureApplicationModeOr 0xac58 #define PM3TextureBaseAddr0 0x8500 #define PM3TextureBaseAddr1 0x8508 #define PM3TextureBaseAddr2 0x8510 #define PM3TextureBaseAddr3 0x8518 #define PM3TextureBaseAddr4 0x8520 #define PM3TextureBaseAddr5 0x8528 #define PM3TextureBaseAddr6 0x8530 #define PM3TextureBaseAddr7 0x8538 #define PM3TextureBaseAddr8 0x8540 #define PM3TextureBaseAddr9 0x8548 #define PM3TextureBaseAddr10 0x8550 #define PM3TextureBaseAddr11 0x8558 #define PM3TextureBaseAddr12 0x8560 #define PM3TextureBaseAddr13 0x8568 #define PM3TextureBaseAddr14 0x8570 #define PM3TextureBaseAddr15 0x8578 #define PM3TextureCacheControl 0x8490 #define PM3TextureChromaLower0 0x84f0 #define PM3TextureChromaLower1 0x8608 #define PM3TextureChromaUpper0 0x84e8 #define PM3TextureChromaUpper1 0x8600 #define PM3TextureCompositeAlphaMode0 0xb310 #define PM3TextureCompositeAlphaMode0And 0xb390 #define PM3TextureCompositeAlphaMode0Or 0xb398 #define PM3TextureCompositeAlphaMode1 0xb320 #define PM3TextureCompositeAlphaMode1And 0xb3b0 #define PM3TextureCompositeAlphaMode1Or 0xb3b8 #define PM3TextureCompositeColorMode0 0xb308 #define PM3TextureCompositeColorMode0And 0xb380 #define PM3TextureCompositeColorMode0Or 0xb388 #define PM3TextureCompositeColorMode1 0xb318 #define PM3TextureCompositeColorMode1And 0xb3a0 #define PM3TextureCompositeColorMode1Or 0xb3a8 #define PM3TextureCompositeFactor0 0xb328 #define PM3TextureCompositeFactor1 0xb330 #define PM3TextureCompositeMode 0xb300 #define PM3TextureCoordMode 0x8380 #define PM3TextureCoordModeAnd 0xac20 #define PM3TextureCoordModeOr 0xac28 #define PM3TextureData 0x88e8 /* #define PM3TextureDownloadControl 0x0108 */ #define PM3TextureDownloadOffset 0x88f0 #define PM3TextureEnvColor 0x8688 #define PM3TextureFilterMode 0x84e0 #define PM3TextureFilterModeAnd 0xad50 #define PM3TextureFilterModeOr 0xad58 #define PM3TextureIndexMode0 0xb338 #define PM3TextureIndexMode0And 0xb3c0 #define PM3TextureIndexMode0Or 0xb3c8 #define PM3TextureIndexMode1 0xb340 #define PM3TextureIndexMode1And 0xb3d0 #define PM3TextureIndexMode1Or 0xb3d8 #define PM3TextureLODBiasS 0x8450 #define PM3TextureLODBiasT 0x8458 /* ... */ #define PM3TextureMapSize 0xb428 #define PM3TextureMapWidth0 0x8580 #define PM3TextureMapWidth1 0x8588 #define PM3TextureMapWidth_Width(w) ((w&0xfff)<<0) #define PM3TextureMapWidth_BorderLayout (1<<12) #define PM3TextureMapWidth_Layout_Linear (0<<13) #define PM3TextureMapWidth_Layout_Patch64 (1<<13) #define PM3TextureMapWidth_Layout_Patch32_2 (2<<13) #define PM3TextureMapWidth_Layout_Patch2 (3<<13) #define PM3TextureMapWidth_HostTexture (1<<15) #define PM3TextureReadMode0 0xb400 #define PM3TextureReadMode0And 0xac30 #define PM3TextureReadMode0Or 0xac38 #define PM3TextureReadMode1 0xb408 #define PM3TextureReadMode1And 0xad40 #define PM3TextureReadMode1Or 0xad48 #define PM3TouchLogicalPage 0xb370 #define PM3TouchLogicalPage_Page(p) (p&0xffff) #define PM3TouchLogicalPage_Count(c) ((c&0x3fff)<<16) #define PM3TouchLogicalPage_Mode(m) ((m&0x3)<<30) #define PM3TStart 0x83a0 #define PM3UpdateLogicalTextureInfo 0xb368 #define PM3UpdateLogicalTextureInfo_Length(l) ((l)&0x1ff) #define PM3UpdateLogicalTextureInfo_MemoryPool(m) (((m)&0x3)<<9) #define PM3UpdateLogicalTextureInfo_VirtualHostPage (1<<11) #define PM3UpdateLogicalTextureInfo_HostPage(p) (((p)&0xfffff)<<12) /* ... */ #define PM3WaitForCompletion 0x80b8 #define PM3Window 0x8980 #define PM3Window_ForceLBUpdate (1<<3) #define PM3Window_LBUpdateSource (1<<4) #define PM3Window_FrameCount(c) (((c)&0xff)<<9) #define PM3Window_StencilFCP (1<<17) #define PM3Window_DepthFCP (1<<18) #define PM3Window_OverrideWriteFiltering (1<<19) #define PM3WindowAnd 0xab80 #define PM3WindowOr 0xab88 #define PM3WindowOrigin 0x81c8 #define PM3XBias 0x9480 #define PM3YBias 0x9488 #define PM3YLimits 0x80a8 #define PM3YUVMode 0x8f00 #define PM3ZFogBias 0x86b8 #define PM3ZStart 0xadd8 #define PM3ZStartL 0x89b8 #define PM3ZStartU 0x89b0 /********************************************** * GLINT Permedia3 2D setup Unit * ***********************************************/ #define PM3Config2D 0xb618 #define PM3Config2D_OpaqueSpan (1<<0) #define PM3Config2D_MultiRXBlit (1<<1) #define PM3Config2D_UserScissorEnable (1<<2) #define PM3Config2D_FBDestReadEnable (1<<3) #define PM3Config2D_AlphaBlendEnable (1<<4) #define PM3Config2D_DitherEnable (1<<5) #define PM3Config2D_ForegroundROPEnable (1<<6) #define PM3Config2D_ForegroundROP(rop) (((rop)&0xf)<<7) #define PM3Config2D_BackgroundROPEnable (1<<11) #define PM3Config2D_BackgroundROP(rop) (((rop)&0xf)<<12) #define PM3Config2D_UseConstantSource (1<<16) #define PM3Config2D_FBWriteEnable (1<<17) #define PM3Config2D_Blocking (1<<18) #define PM3Config2D_ExternalSourceData (1<<19) #define PM3Config2D_LUTModeEnable (1<<20) #define PM3DownloadGlyphwidth 0xb658 #define PM3DownloadGlyphwidth_GlyphWidth(gw) ((gw)&0xffff) #define PM3DownloadTarget 0xb650 #define PM3DownloadTarget_TagName(tag) ((tag)&0x1fff) #define PM3GlyphData 0xb660 #define PM3GlyphPosition 0xb608 #define PM3GlyphPosition_XOffset(x) ((x)&0xffff) #define PM3GlyphPosition_YOffset(y) (((y)&0xffff)<<16) #define PM3Packed4Pixels 0xb668 #define PM3Packed8Pixels 0xb630 #define PM3Packed16Pixels 0xb638 #define PM3RectanglePosition 0xb600 #define PM3RectanglePosition_XOffset(x) ((x)&0xffff) #define PM3RectanglePosition_YOffset(y) (((y)&0xffff)<<16) #define PM3Render2D 0xb640 #define PM3Render2D_Width(w) ((w)&0x0fff) #define PM3Render2D_Operation_Normal (0<<12) #define PM3Render2D_Operation_SyncOnHostData (1<<12) #define PM3Render2D_Operation_SyncOnBitMask (2<<12) #define PM3Render2D_Operation_PatchOrderRendering (3<<12) #define PM3Render2D_FBSourceReadEnable (1<<14) #define PM3Render2D_SpanOperation (1<<15) #define PM3Render2D_Height(h) (((h)&0x0fff)<<16) #define PM3Render2D_XPositive (1<<28) #define PM3Render2D_YPositive (1<<29) #define PM3Render2D_AreaStippleEnable (1<<30) #define PM3Render2D_TextureEnable (1<<31) #define PM3Render2DGlyph 0xb648 #define PM3Render2DGlyph_Width(w) ((w)&0x7f) #define PM3Render2DGlyph_Height(h) (((h)&0x7f)<<7) #define PM3Render2DGlyph_XOffset(x) (((x)&0x1ff)<<14) #define PM3Render2DGlyph_YOffset(y) (((y)&0x1ff)<<23) #define PM3RenderPatchOffset 0xb610 #define PM3RenderPatchOffset_XOffset(x) ((x)&0xffff) #define PM3RenderPatchOffset_YOffset(y) (((y)&0xffff)<<16) #define PM3RLCount 0xb678 #define PM3RLCount_Count(c) ((c)&0x0fff) #define PM3RLData 0xb670 /********************************************** * GLINT Permedia3 Alias Register * ***********************************************/ #define PM3FillBackgroundColor 0x8330 #define PM3FillConfig2D0 0x8338 #define PM3FillConfig2D1 0x8360 #define PM3FillConfig2D_OpaqueSpan 1<<0 #define PM3FillConfig2D_MultiRXBlit 1<<1 #define PM3FillConfig2D_UserScissorEnable 1<<2 #define PM3FillConfig2D_FBDestReadEnable 1<<3 #define PM3FillConfig2D_AlphaBlendEnable 1<<4 #define PM3FillConfig2D_DitherEnable 1<<5 #define PM3FillConfig2D_ForegroundROPEnable 1<<6 #define PM3FillConfig2D_ForegroundROP(rop) (((rop)&0xf)<<7) #define PM3FillConfig2D_BackgroundROPEnable 1<<11 #define PM3FillConfig2D_BackgroundROP(rop) (((rop)&0xf)<<12) #define PM3FillConfig2D_UseConstantSource 1<<16 #define PM3FillConfig2D_FBWriteEnable 1<<17 #define PM3FillConfig2D_Blocking 1<<18 #define PM3FillConfig2D_ExternalSourceData 1<<19 #define PM3FillConfig2D_LUTModeEnable 1<<20 #define PM3FillFBDestReadBufferAddr 0x8310 #define PM3FillFBSourceReadBufferAddr 0x8308 #define PM3FillFBSourceReadBufferOffset 0x8340 #define PM3FillFBSourceReadBufferOffset_XOffset(x) ((x)&0xffff) #define PM3FillFBSourceReadBufferOffset_YOffset(y) (((y)&0xffff)<<16) #define PM3FillFBWriteBufferAddr 0x8300 #define PM3FillForegroundColor0 0x8328 #define PM3FillForegroundColor1 0x8358 #define PM3FillGlyphPosition 0x8368 #define PM3FillGlyphPosition_XOffset(x) ((x)&0xffff) #define PM3FillGlyphPosition_YOffset(y) (((y)&0xffff)<<16) #define PM3FillRectanglePosition 0x8348 #define PM3FillRectanglePosition_XOffset(x) ((x)&0xffff) #define PM3FillRectanglePosition_YOffset(y) (((y)&0xffff)<<16) /********************************************** * GLINT Permedia3 Macros * ***********************************************/ #ifdef __alpha__ #define mem_barrier() asm volatile ("mb" : : : "memory") #define write_mem_barrier() asm volatile ("wmb" : : : "memory") #else #define mem_barrier() #define write_mem_barrier() #endif extern void *pm3_reg_base; #define WRITE_REG(offset,val) \ do { \ write_mem_barrier(); \ *(volatile uint32_t *) \ (((unsigned char *)(pm3_reg_base)) + offset) = (val); \ } while(0) static inline uint32_t READ_REG(uint32_t offset) { mem_barrier(); return *(volatile uint32_t *)(((unsigned char *)(pm3_reg_base)) + offset); } #define UPDATE_SET_REG(offset,val) \ { \ unsigned long temp; \ temp = READ_REG(offset); \ WRITE_REG(offset,temp|(val)); \ } #define UPDATE_CLEAR_REG(offset,val) \ { \ unsigned long temp; \ temp = READ_REG(offset); \ WRITE_REG(offset,temp&(~(val))); \ } #define WAIT_FIFO(n) while(READ_REG(PM3InFIFOSpace) < (n)) #define RAMDAC_DELAY(x) do { \ int delay = x; \ unsigned char tmp; \ while(delay--){tmp = READ_REG(PM3InFIFOSpace);}; \ } while(0) #define SLOW_WRITE_REG(v,r) \ do{ \ RAMDAC_DELAY(5); \ WRITE_REG(v,r); \ RAMDAC_DELAY(5); \ }while(0) #define RAMDAC_SET_INDEX(index) \ { \ SLOW_WRITE_REG (PM3RD_IndexHigh,(index>>8)&0xff); \ SLOW_WRITE_REG (PM3RD_IndexLow,index&0xff); \ } #define RAMDAC_SET_REG(index, data) \ { \ RAMDAC_SET_INDEX(index); \ SLOW_WRITE_REG(PM3RD_IndexedData, data); \ } #define RAMDAC_GET_REG(index, temp) \ { \ RAMDAC_SET_INDEX(index); \ temp = READ_REG(PM3RD_IndexedData); \ } #endif /* _PM3_REG_H_ */ avifile-0.7.48~20090503.ds/drivers/vidix/drivers/pm3_vid.c0000644000175000017500000003502410142423644021731 0ustar yavoryavor/** Driver for 3DLabs GLINT R3 and Permedia3 chips. Copyright (C) 2002, 2003 Måns Rullgård This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU 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 **/ #include #include #include #include #include #include #include #include "../vidix.h" #include "../fourcc.h" #include "../../libdha/libdha.h" #include "../../libdha/pci_ids.h" #include "../../libdha/pci_names.h" #include "../../config.h" #include "pm3_regs.h" #define VIDIX_STATIC pm3_ /* MBytes of video memory to use */ #define PM3_VIDMEM 24 #if 0 #define TRACE_ENTER() fprintf(stderr, "%s: enter\n", __FUNCTION__) #define TRACE_EXIT() fprintf(stderr, "%s: exit\n", __FUNCTION__) #else #define TRACE_ENTER() #define TRACE_EXIT() #endif static pciinfo_t pci_info; void *pm3_reg_base; static void *pm3_mem; static int pm3_vidmem = PM3_VIDMEM; static int pm3_blank = 0; static int pm3_dma = 0; static int pm3_ckey_red, pm3_ckey_green, pm3_ckey_blue; static u_int page_size; static vidix_capability_t pm3_cap = { "3DLabs GLINT R3/Permedia3 driver", "Måns Rullgård ", TYPE_OUTPUT, { 0, 0, 0, 0 }, 2048, 2048, 4, 4, -1, FLAG_UPSCALER | FLAG_DOWNSCALER, VENDOR_3DLABS, -1, { 0, 0, 0, 0 } }; unsigned int VIDIX_NAME(vixGetVersion)(void) { return(VIDIX_VERSION); } static unsigned short pm3_card_ids[] = { DEVICE_3DLABS_GLINT_R3 }; static int find_chip(unsigned chip_id) { unsigned i; for(i = 0;i < sizeof(pm3_card_ids)/sizeof(unsigned short);i++) { if(chip_id == pm3_card_ids[i]) return i; } return -1; } int VIDIX_NAME(vixProbe)(int verbose, int force) { pciinfo_t lst[MAX_PCI_DEVICES]; unsigned i,num_pci; int err; err = pci_scan(lst,&num_pci); if(err) { printf("[pm3] Error occured during pci scan: %s\n",strerror(err)); return err; } else { err = ENXIO; for(i=0; i < num_pci; i++) { if(lst[i].vendor == VENDOR_3DLABS) { int idx; const char *dname; idx = find_chip(lst[i].device); if(idx == -1) continue; dname = pci_device_name(VENDOR_3DLABS, lst[i].device); dname = dname ? dname : "Unknown chip"; printf("[pm3] Found chip: %s with IRQ %i\n", dname, lst[i].irq); pm3_cap.device_id = lst[i].device; err = 0; memcpy(&pci_info, &lst[i], sizeof(pciinfo_t)); break; } } } if(err && verbose) printf("[pm3] Can't find chip\n"); return err; } #define PRINT_REG(reg) \ { \ long _foo = READ_REG(reg); \ printf("[pm3] " #reg " (%x) = %#lx (%li)\n", reg, _foo, _foo); \ } int VIDIX_NAME(vixInit)(const char *args) { if(args != NULL){ char *ac = strdup(args), *s, *opt; opt = strtok_r(ac, ",", &s); while(opt){ char *a = strchr(opt, '='); if(a) *a++ = 0; if(!strcmp(opt, "mem")){ if(a) pm3_vidmem = strtol(a, NULL, 0); } else if(!strcmp(opt, "blank")){ pm3_blank = a? strtol(a, NULL, 0): 1; } opt = strtok_r(NULL, ",", &s); } free(ac); } pm3_reg_base = map_phys_mem(pci_info.base0, 0x20000); pm3_mem = map_phys_mem(pci_info.base1, 0x2000000); if(bm_open() == 0){ fprintf(stderr, "[pm3] DMA available.\n"); pm3_cap.flags |= FLAG_DMA; page_size = sysconf(_SC_PAGESIZE); hwirq_install(pci_info.bus, pci_info.card, pci_info.func, 0, PM3IntFlags, -1); pm3_dma = 1; } RAMDAC_GET_REG(PM3RD_VideoOverlayKeyR, pm3_ckey_red); RAMDAC_GET_REG(PM3RD_VideoOverlayKeyG, pm3_ckey_green); RAMDAC_GET_REG(PM3RD_VideoOverlayKeyB, pm3_ckey_blue); return 0; } void VIDIX_NAME(vixDestroy)(void) { if(pm3_dma) WRITE_REG(PM3IntEnable, 0); RAMDAC_SET_REG(PM3RD_VideoOverlayKeyR, pm3_ckey_red); RAMDAC_SET_REG(PM3RD_VideoOverlayKeyG, pm3_ckey_green); RAMDAC_SET_REG(PM3RD_VideoOverlayKeyB, pm3_ckey_blue); unmap_phys_mem(pm3_reg_base, 0x20000); unmap_phys_mem(pm3_mem, 0x2000000); hwirq_uninstall(pci_info.bus, pci_info.card, pci_info.func); bm_close(); } int VIDIX_NAME(vixGetCapability)(vidix_capability_t *to) { memcpy(to, &pm3_cap, sizeof(vidix_capability_t)); return 0; } static int is_supported_fourcc(uint32_t fourcc) { switch(fourcc){ case IMGFMT_YUY2: case IMGFMT_UYVY: return 1; default: return 0; } } int VIDIX_NAME(vixQueryFourcc)(vidix_fourcc_t *to) { if(is_supported_fourcc(to->fourcc)) { to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP | VID_DEPTH_4BPP | VID_DEPTH_8BPP | VID_DEPTH_12BPP| VID_DEPTH_15BPP| VID_DEPTH_16BPP| VID_DEPTH_24BPP| VID_DEPTH_32BPP; to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY; return 0; } else to->depth = to->flags = 0; return ENOSYS; } static int frames[VID_PLAY_MAXFRAMES], vid_base; static int overlay_mode, overlay_control, video_control, int_enable; static int rdoverlay_mode; static int src_w, drw_w; static int src_h, drw_h; static int drw_x, drw_y; #define FORMAT_RGB8888 PM3VideoOverlayMode_COLORFORMAT_RGB8888 #define FORMAT_RGB4444 PM3VideoOverlayMode_COLORFORMAT_RGB4444 #define FORMAT_RGB5551 PM3VideoOverlayMode_COLORFORMAT_RGB5551 #define FORMAT_RGB565 PM3VideoOverlayMode_COLORFORMAT_RGB565 #define FORMAT_RGB332 PM3VideoOverlayMode_COLORFORMAT_RGB332 #define FORMAT_BGR8888 PM3VideoOverlayMode_COLORFORMAT_BGR8888 #define FORMAT_BGR4444 PM3VideoOverlayMode_COLORFORMAT_BGR4444 #define FORMAT_BGR5551 PM3VideoOverlayMode_COLORFORMAT_BGR5551 #define FORMAT_BGR565 PM3VideoOverlayMode_COLORFORMAT_BGR565 #define FORMAT_BGR332 PM3VideoOverlayMode_COLORFORMAT_BGR332 #define FORMAT_CI8 PM3VideoOverlayMode_COLORFORMAT_CI8 #define FORMAT_VUY444 PM3VideoOverlayMode_COLORFORMAT_VUY444 #define FORMAT_YUV444 PM3VideoOverlayMode_COLORFORMAT_YUV444 #define FORMAT_VUY422 PM3VideoOverlayMode_COLORFORMAT_VUY422 #define FORMAT_YUV422 PM3VideoOverlayMode_COLORFORMAT_YUV422 /* Notice, have to check that we dont overflow the deltas here ... */ static void compute_scale_factor(int* src_w, int* dst_w, u_int* shrink_delta, u_int* zoom_delta) { /* NOTE: If we don't return reasonable values here then the video * unit can potential shut off and won't display an image until re-enabled. * Seems as though the zoom_delta is o.k, and I've not had the problem. * The 'shrink_delta' is prone to this the most - FIXME ! */ if (*src_w >= *dst_w) { *src_w &= ~0x3; *dst_w &= ~0x3; *shrink_delta = (((*src_w << 16) / *dst_w) + 0x0f) & 0x0ffffff0; *zoom_delta = 1<<16; if ( ((*shrink_delta * *dst_w) >> 16) & 0x03 ) *shrink_delta += 0x10; } else { *src_w &= ~0x3; *dst_w &= ~0x3; *zoom_delta = (((*src_w << 16) / *dst_w) + 0x0f) & 0x0001fff0; *shrink_delta = 1<<16; if ( ((*zoom_delta * *dst_w) >> 16) & 0x03 ) *zoom_delta += 0x10; } } static void pm3_setup_overlay(vidix_playback_t *info) { int shrink, zoom; int format = 0; int filter = 0; int sw = src_w; switch(info->fourcc){ case IMGFMT_YUY2: format = FORMAT_YUV422; break; case IMGFMT_UYVY: format = FORMAT_VUY422; break; } compute_scale_factor(&sw, &drw_w, &shrink, &zoom); WAIT_FIFO(9); WRITE_REG(PM3VideoOverlayBase0, vid_base >> 1); WRITE_REG(PM3VideoOverlayStride, PM3VideoOverlayStride_STRIDE(src_w)); WRITE_REG(PM3VideoOverlayWidth, PM3VideoOverlayWidth_WIDTH(sw)); WRITE_REG(PM3VideoOverlayHeight, PM3VideoOverlayHeight_HEIGHT(src_h)); WRITE_REG(PM3VideoOverlayOrigin, 0); /* Scale the source to the destinationsize */ if (src_w == drw_w) { WRITE_REG(PM3VideoOverlayShrinkXDelta, 1<<16); WRITE_REG(PM3VideoOverlayZoomXDelta, 1<<16); } else { WRITE_REG(PM3VideoOverlayShrinkXDelta, shrink); WRITE_REG(PM3VideoOverlayZoomXDelta, zoom); filter = PM3VideoOverlayMode_FILTER_PARTIAL; } if (src_h == drw_h) { WRITE_REG(PM3VideoOverlayYDelta, PM3VideoOverlayYDelta_NONE); } else { WRITE_REG(PM3VideoOverlayYDelta, PM3VideoOverlayYDelta_DELTA(src_h, drw_h)); filter = PM3VideoOverlayMode_FILTER_FULL; } WRITE_REG(PM3VideoOverlayIndex, 0); /* Now set the ramdac video overlay region and mode */ RAMDAC_SET_REG(PM3RD_VideoOverlayXStartLow, (drw_x & 0xff)); RAMDAC_SET_REG(PM3RD_VideoOverlayXStartHigh, (drw_x & 0xf00)>>8); RAMDAC_SET_REG(PM3RD_VideoOverlayXEndLow, (drw_x+drw_w) & 0xff); RAMDAC_SET_REG(PM3RD_VideoOverlayXEndHigh, ((drw_x+drw_w) & 0xf00)>>8); RAMDAC_SET_REG(PM3RD_VideoOverlayYStartLow, (drw_y & 0xff)); RAMDAC_SET_REG(PM3RD_VideoOverlayYStartHigh, (drw_y & 0xf00)>>8); RAMDAC_SET_REG(PM3RD_VideoOverlayYEndLow, (drw_y+drw_h) & 0xff); RAMDAC_SET_REG(PM3RD_VideoOverlayYEndHigh, ((drw_y+drw_h) & 0xf00)>>8); overlay_mode = 1 << 5 | format | filter | PM3VideoOverlayMode_BUFFERSYNC_MANUAL | PM3VideoOverlayMode_FLIP_VIDEO; overlay_control = PM3RD_VideoOverlayControl_KEY_COLOR | PM3RD_VideoOverlayControl_DIRECTCOLOR_ENABLED; } extern int VIDIX_NAME(vixSetGrKeys)(const vidix_grkey_t *key) { if(key->ckey.op == CKEY_TRUE){ RAMDAC_SET_REG(PM3RD_VideoOverlayKeyR, key->ckey.red); RAMDAC_SET_REG(PM3RD_VideoOverlayKeyG, key->ckey.green); RAMDAC_SET_REG(PM3RD_VideoOverlayKeyB, key->ckey.blue); rdoverlay_mode = PM3RD_VideoOverlayControl_MODE_MAINKEY; } else { rdoverlay_mode = PM3RD_VideoOverlayControl_MODE_ALWAYS; } RAMDAC_SET_REG(PM3RD_VideoOverlayControl, overlay_control | rdoverlay_mode); return 0; } extern int VIDIX_NAME(vixGetGrKeys)(vidix_grkey_t *key) { RAMDAC_GET_REG(PM3RD_VideoOverlayKeyR, key->ckey.red); RAMDAC_GET_REG(PM3RD_VideoOverlayKeyG, key->ckey.green); RAMDAC_GET_REG(PM3RD_VideoOverlayKeyB, key->ckey.blue); return 0; } extern int VIDIX_NAME(vixConfigPlayback)(vidix_playback_t *info) { unsigned int i; u_int frame_size; u_int vidmem_size; u_int max_frames; TRACE_ENTER(); src_w = info->src.w; src_h = info->src.h; drw_w = info->dest.w; drw_h = info->dest.h; drw_x = info->dest.x; drw_y = info->dest.y; frame_size = src_w * src_h * 2; vidmem_size = pm3_vidmem*1024*1024; max_frames = vidmem_size / frame_size; if(max_frames > VID_PLAY_MAXFRAMES) max_frames = VID_PLAY_MAXFRAMES; src_h--; /* ugh */ if(info->num_frames > max_frames) info->num_frames = max_frames; vidmem_size = info->num_frames * frame_size; /* Use end of video memory. Assume the card has 32 MB */ vid_base = 32*1024*1024 - vidmem_size; info->dga_addr = pm3_mem + vid_base; info->dest.pitch.y = 2; info->dest.pitch.u = 0; info->dest.pitch.v = 0; info->offset.y = 0; info->offset.v = 0; info->offset.u = 0; info->frame_size = frame_size; for(i = 0; i < info->num_frames; i++){ info->offsets[i] = frame_size * i; frames[i] = (vid_base + info->offsets[i]) >> 1; } pm3_setup_overlay(info); video_control = READ_REG(PM3VideoControl); int_enable = READ_REG(PM3IntEnable); TRACE_EXIT(); return 0; } int VIDIX_NAME(vixPlaybackOn)(void) { TRACE_ENTER(); WRITE_REG(PM3VideoOverlayMode, overlay_mode | PM3VideoOverlayMode_ENABLE); overlay_control |= PM3RD_VideoOverlayControl_ENABLE; RAMDAC_SET_REG(PM3RD_VideoOverlayControl, overlay_control | rdoverlay_mode); WRITE_REG(PM3VideoOverlayUpdate, PM3VideoOverlayUpdate_ENABLE); if(pm3_blank) WRITE_REG(PM3VideoControl, video_control | PM3VideoControl_DISPLAY_ENABLE); TRACE_EXIT(); return 0; } int VIDIX_NAME(vixPlaybackOff)(void) { overlay_control &= ~PM3RD_VideoOverlayControl_ENABLE; RAMDAC_SET_REG(PM3RD_VideoOverlayControl, PM3RD_VideoOverlayControl_DISABLE); WRITE_REG(PM3VideoOverlayMode, PM3VideoOverlayMode_DISABLE); if(video_control) WRITE_REG(PM3VideoControl, video_control & ~PM3VideoControl_DISPLAY_ENABLE); return 0; } int VIDIX_NAME(vixPlaybackFrameSelect)(unsigned int frame) { WRITE_REG(PM3VideoOverlayBase0, frames[frame]); return 0; } struct pm3_bydma_cmd { uint32_t bus_addr; uint32_t fb_addr; uint32_t mask; uint32_t count; }; struct pm3_bydma_frame { struct pm3_bydma_cmd *cmds; u_long bus_addr; uint32_t count; }; static struct pm3_bydma_frame * pm3_setup_bydma(vidix_dma_t *dma, struct pm3_bydma_frame *bdf) { u_int size = dma->size; u_int pages = (size + page_size-1) / page_size; long baddr[pages]; u_int i; uint32_t dest; if(bm_virt_to_bus(dma->src, dma->size, baddr)) return NULL; if(!bdf){ bdf = malloc(sizeof(*bdf)); bdf->cmds = valloc(pages * sizeof(struct pm3_bydma_cmd)); if(dma->flags & BM_DMA_FIXED_BUFFS){ mlock(bdf->cmds, page_size); } } dest = vid_base + dma->dest_offset; for(i = 0; i < pages; i++, dest += page_size, size -= page_size){ bdf->cmds[i].bus_addr = baddr[i]; bdf->cmds[i].fb_addr = dest; bdf->cmds[i].mask = ~0; bdf->cmds[i].count = ((size > page_size)? page_size: size) / 16; } bdf->count = pages; if(bm_virt_to_bus(bdf->cmds, page_size, &bdf->bus_addr) != 0){ free(bdf->cmds); free(bdf); return NULL; } return bdf; } extern int VIDIX_NAME(vixPlaybackCopyFrame)(vidix_dma_t *dma) { u_int frame = dma->idx; struct pm3_bydma_frame *bdf; static int s = 0; bdf = dma->internal[frame]; if(!bdf || !(dma->flags & BM_DMA_FIXED_BUFFS)) bdf = pm3_setup_bydma(dma, bdf); if(!bdf) return -1; if(!dma->internal[frame]) dma->internal[frame] = bdf; if(dma->flags & BM_DMA_SYNC){ if(s){ hwirq_wait(pci_info.irq); } else { WRITE_REG(PM3IntEnable, (1 << 7)); s = 1; } } WAIT_FIFO(3); WRITE_REG(PM3ByDMAReadCommandBase, bdf->bus_addr); WRITE_REG(PM3ByDMAReadCommandCount, bdf->count); WRITE_REG(PM3ByDMAReadMode, PM3ByDMAReadMode_ByteSwap_NONE | PM3ByDMAReadMode_Format_RAW | PM3ByDMAReadMode_PixelSize(16) | PM3ByDMAReadMode_Active | PM3ByDMAReadMode_Burst(7) | PM3ByDMAReadMode_Align); return 0; } extern int VIDIX_NAME(vixQueryDMAStatus)(void) { uint32_t bdm = READ_REG(PM3ByDMAReadMode); return (bdm & PM3ByDMAReadMode_Active)? 1: 0; } avifile-0.7.48~20090503.ds/drivers/vidix/drivers/radeon.h0000644000175000017500000022733207555016013021654 0ustar yavoryavor/* * radeon.h * This software has been released under the terms of the GNU Public * license. See http://www.gnu.org/copyleft/gpl.html for details. * * This collection of definition was written by Nick Kurshev * It's based on radeonfb, X11, GATOS sources * and partly compatible with Rage128 set (in OV0, CAP0, CAP1 parts) */ #ifndef _RADEON_H #define _RADEON_H #define RADEON_REGSIZE 0x4000 #define MM_INDEX 0x0000 /* MM_INDEX bit constants */ # define MM_APER 0x80000000 #define MM_DATA 0x0004 #define BUS_CNTL 0x0030 /* BUS_CNTL bit constants */ # define BUS_DBL_RESYNC 0x00000001 # define BUS_MSTR_RESET 0x00000002 # define BUS_FLUSH_BUF 0x00000004 # define BUS_STOP_REQ_DIS 0x00000008 # define BUS_ROTATION_DIS 0x00000010 # define BUS_MASTER_DIS 0x00000040 # define BUS_ROM_WRT_EN 0x00000080 # define BUS_DIS_ROM 0x00001000 # define BUS_PCI_READ_RETRY_EN 0x00002000 # define BUS_AGP_AD_STEPPING_EN 0x00004000 # define BUS_PCI_WRT_RETRY_EN 0x00008000 # define BUS_MSTR_RD_MULT 0x00100000 # define BUS_MSTR_RD_LINE 0x00200000 # define BUS_SUSPEND 0x00400000 # define LAT_16X 0x00800000 # define BUS_RD_DISCARD_EN 0x01000000 # define BUS_RD_ABORT_EN 0x02000000 # define BUS_MSTR_WS 0x04000000 # define BUS_PARKING_DIS 0x08000000 # define BUS_MSTR_DISCONNECT_EN 0x10000000 # define BUS_WRT_BURST 0x20000000 # define BUS_READ_BURST 0x40000000 # define BUS_RDY_READ_DLY 0x80000000 #define HI_STAT 0x004C #define BUS_CNTL1 0x0034 # define BUS_WAIT_ON_LOCK_EN (1 << 4) #define I2C_CNTL_0 0x0090 # define I2C_DONE (1<<0) # define I2C_NACK (1<<1) # define I2C_HALT (1<<2) # define I2C_SOFT_RST (1<<5) # define I2C_DRIVE_EN (1<<6) # define I2C_DRIVE_SEL (1<<7) # define I2C_START (1<<8) # define I2C_STOP (1<<9) # define I2C_RECEIVE (1<<10) # define I2C_ABORT (1<<11) # define I2C_GO (1<<12) # define I2C_SEL (1<<16) # define I2C_EN (1<<17) #define I2C_CNTL_1 0x0094 #define I2C_DATA 0x0098 #define CONFIG_CNTL 0x00E0 /* CONFIG_CNTL bit constants */ # define CFG_VGA_RAM_EN 0x00000100 #ifdef RAGE128 #define GEN_RESET_CNTL 0x00f0 # define SOFT_RESET_GUI 0x00000001 # define SOFT_RESET_VCLK 0x00000100 # define SOFT_RESET_PCLK 0x00000200 # define SOFT_RESET_ECP 0x00000400 # define SOFT_RESET_DISPENG_XCLK 0x00000800 # define SOFT_RESET_MEMCTLR_XCLK 0x00001000 #endif #define CONFIG_MEMSIZE 0x00F8 #define CONFIG_APER_0_BASE 0x0100 #define CONFIG_APER_1_BASE 0x0104 #define CONFIG_APER_SIZE 0x0108 #define CONFIG_REG_1_BASE 0x010C #define CONFIG_REG_APER_SIZE 0x0110 #define PAD_AGPINPUT_DELAY 0x0164 #define PAD_CTLR_STRENGTH 0x0168 #define PAD_CTLR_UPDATE 0x016C #define AGP_CNTL 0x0174 # define AGP_APER_SIZE_256MB (0x00 << 0) # define AGP_APER_SIZE_128MB (0x20 << 0) # define AGP_APER_SIZE_64MB (0x30 << 0) # define AGP_APER_SIZE_32MB (0x38 << 0) # define AGP_APER_SIZE_16MB (0x3c << 0) # define AGP_APER_SIZE_8MB (0x3e << 0) # define AGP_APER_SIZE_4MB (0x3f << 0) # define AGP_APER_SIZE_MASK (0x3f << 0) #define AMCGPIO_A_REG 0x01a0 #define AMCGPIO_EN_REG 0x01a8 #define AMCGPIO_MASK 0x0194 #define AMCGPIO_Y_REG 0x01a4 /*#define BM_STATUS 0x0160*/ #define MPP_TB_CONFIG 0x01c0 /* ? */ #define MPP_GP_CONFIG 0x01c8 /* ? */ #define VENDOR_ID 0x0F00 #define DEVICE_ID 0x0F02 #define COMMAND 0x0F04 #define STATUS 0x0F06 #define REVISION_ID 0x0F08 #define REGPROG_INF 0x0F09 #define SUB_CLASS 0x0F0A #define CACHE_LINE 0x0F0C #define LATENCY 0x0F0D #define HEADER 0x0F0E #define BIST 0x0F0F #define REG_MEM_BASE 0x0F10 #define REG_IO_BASE 0x0F14 #define REG_REG_BASE 0x0F18 #define ADAPTER_ID 0x0F2C #define BIOS_ROM 0x0F30 #define CAPABILITIES_PTR 0x0F34 #define INTERRUPT_LINE 0x0F3C #define INTERRUPT_PIN 0x0F3D #define MIN_GRANT 0x0F3E #define MAX_LATENCY 0x0F3F #define ADAPTER_ID_W 0x0F4C #define PMI_CAP_ID 0x0F50 #define PMI_NXT_CAP_PTR 0x0F51 #define PMI_PMC_REG 0x0F52 #define PM_STATUS 0x0F54 #define PMI_DATA 0x0F57 #define AGP_CAP_ID 0x0F58 #define AGP_STATUS 0x0F5C # define AGP_1X_MODE 0x01 # define AGP_2X_MODE 0x02 # define AGP_4X_MODE 0x04 # define AGP_MODE_MASK 0x07 #define AGP_COMMAND 0x0F60 /* Video muxer unit */ #define VIDEOMUX_CNTL 0x0190 #define VIPPAD_MASK 0x0198 #define VIPPAD1_A 0x01AC #define VIPPAD1_EN 0x01B0 #define VIPPAD1_Y 0x01B4 #define AIC_CTRL 0x01D0 #define AIC_STAT 0x01D4 #define AIC_PT_BASE 0x01D8 #define AIC_LO_ADDR 0x01DC #define AIC_HI_ADDR 0x01E0 #define AIC_TLB_ADDR 0x01E4 #define AIC_TLB_DATA 0x01E8 #define DAC_CNTL 0x0058 /* DAC_CNTL bit constants */ # define DAC_RANGE_CNTL_MSK 0x00000003 # define DAC_RANGE_PAL 0x00000000 # define DAC_RANGE_NTSC 0x00000001 # define DAC_RANGE_PS2 0x00000002 # define DAC_BLANKING 0x00000004 # define DAC_CMP_EN 0x00000008 # define DAC_CMP_OUTPUT 0x00000080 # define DAC_8BIT_EN 0x00000100 # define DAC_4BPP_PIX_ORDER 0x00000200 # define DAC_TVO_EN 0x00000400 # define DAC_TVO_OVR_EXCL 0x00000800 # define DAC_TVO_16BPP_DITH_EN 0x00001000 # define DAC_VGA_ADR_EN (1 << 13) # define DAC_PWDN (1 << 15) # define DAC_CRC_EN 0x00080000 # define DAC_MASK_ALL (0xff << 24) # define DAC_RANGE_CNTL (3 << 0) #define DAC_CNTL2 0x007c /* DAC_CNTL2 bit constants */ # define DAC2_DAC_CLK_SEL (1 << 0) # define DAC2_DAC2_CLK_SEL (1 << 1) # define DAC2_PALETTE_ACC_CTL (1 << 5) #define TV_DAC_CNTL 0x088c /* TV_DAC_CNTL bit constants */ # define TV_DAC_STD_MASK 0x0300 # define TV_DAC_RDACPD (1 << 24) # define TV_DAC_GDACPD (1 << 25) # define TV_DAC_BDACPD (1 << 26) #define CRTC_GEN_CNTL 0x0050 /* CRTC_GEN_CNTL bit constants */ # define CRTC_DBL_SCAN_EN 0x00000001 # define CRTC_INTERLACE_EN (1 << 1) # define CRTC_CSYNC_EN (1 << 4) # define CRTC_CUR_EN 0x00010000 # define CRTC_CUR_MODE_MASK (7 << 17) # define CRTC_ICON_EN (1 << 20) # define CRTC_EXT_DISP_EN (1 << 24) # define CRTC_EN (1 << 25) # define CRTC_DISP_REQ_EN_B (1 << 26) #define CRTC2_GEN_CNTL 0x03f8 /* CRTC2_GEN_CNTL bit constants */ # define CRTC2_DBL_SCAN_EN (1 << 0) # define CRTC2_INTERLACE_EN (1 << 1) # define CRTC2_SYNC_TRISTAT (1 << 4) # define CRTC2_HSYNC_TRISTAT (1 << 5) # define CRTC2_VSYNC_TRISTAT (1 << 6) # define CRTC2_CRT2_ON (1 << 7) # define CRTC2_ICON_EN (1 << 15) # define CRTC2_CUR_EN (1 << 16) # define CRTC2_CUR_MODE_MASK (7 << 20) # define CRTC2_DISP_DIS (1 << 23) # define CRTC2_EN (1 << 25) # define CRTC2_DISP_REQ_EN_B (1 << 26) # define CRTC2_HSYNC_DIS (1 << 28) # define CRTC2_VSYNC_DIS (1 << 29) #define MEM_CNTL 0x0140 /* MEM_CNTL bit constants */ # define MEM_CTLR_STATUS_IDLE 0x00000000 # define MEM_CTLR_STATUS_BUSY 0x00100000 # define MEM_SEQNCR_STATUS_IDLE 0x00000000 # define MEM_SEQNCR_STATUS_BUSY 0x00200000 # define MEM_ARBITER_STATUS_IDLE 0x00000000 # define MEM_ARBITER_STATUS_BUSY 0x00400000 # define MEM_REQ_UNLOCK 0x00000000 # define MEM_REQ_LOCK 0x00800000 #define EXT_MEM_CNTL 0x0144 #define MC_AGP_LOCATION 0x014C #define MEM_IO_CNTL_A0 0x0178 #define MEM_INIT_LATENCY_TIMER 0x0154 #define MEM_SDRAM_MODE_REG 0x0158 #define AGP_BASE 0x0170 #ifdef RAGE128 #define PCI_GART_PAGE 0x017c #define PC_NGUI_MODE 0x0180 #define PC_NGUI_CTLSTAT 0x0184 # define PC_FLUSH_GUI (3 << 0) # define PC_RI_GUI (1 << 2) # define PC_FLUSH_ALL 0x00ff # define PC_BUSY (1 << 31) #define PC_MISC_CNTL 0x0188 #else #define MEM_IO_CNTL_A1 0x017C #define MEM_IO_CNTL_B0 0x0180 #define MEM_IO_CNTL_B1 0x0184 #define MC_DEBUG 0x0188 #endif #define MC_STATUS 0x0150 #define MEM_IO_OE_CNTL 0x018C #define MC_FB_LOCATION 0x0148 #define HOST_PATH_CNTL 0x0130 #define MEM_VGA_WP_SEL 0x0038 #define MEM_VGA_RP_SEL 0x003C #define HDP_DEBUG 0x0138 #define SW_SEMAPHORE 0x013C #define SURFACE_CNTL 0x0B00 /* SURFACE_CNTL bit constants */ # define SURF_TRANSLATION_DIS (1 << 8) # define NONSURF_AP0_SWP_16BPP (1 << 20) # define NONSURF_AP0_SWP_32BPP (2 << 20) #define SURFACE0_LOWER_BOUND 0x0B04 #define SURFACE1_LOWER_BOUND 0x0B14 #define SURFACE2_LOWER_BOUND 0x0B24 #define SURFACE3_LOWER_BOUND 0x0B34 #define SURFACE4_LOWER_BOUND 0x0B44 #define SURFACE5_LOWER_BOUND 0x0B54 #define SURFACE6_LOWER_BOUND 0x0B64 #define SURFACE7_LOWER_BOUND 0x0B74 #define SURFACE0_UPPER_BOUND 0x0B08 #define SURFACE1_UPPER_BOUND 0x0B18 #define SURFACE2_UPPER_BOUND 0x0B28 #define SURFACE3_UPPER_BOUND 0x0B38 #define SURFACE4_UPPER_BOUND 0x0B48 #define SURFACE5_UPPER_BOUND 0x0B58 #define SURFACE6_UPPER_BOUND 0x0B68 #define SURFACE7_UPPER_BOUND 0x0B78 #define SURFACE0_INFO 0x0B0C #define SURFACE1_INFO 0x0B1C #define SURFACE2_INFO 0x0B2C #define SURFACE3_INFO 0x0B3C #define SURFACE4_INFO 0x0B4C #define SURFACE5_INFO 0x0B5C #define SURFACE6_INFO 0x0B6C #define SURFACE7_INFO 0x0B7C #define SURFACE_ACCESS_FLAGS 0x0BF8 #define SURFACE_ACCESS_CLR 0x0BFC #define GEN_INT_CNTL 0x0040 #define GEN_INT_STATUS 0x0044 # define VSYNC_INT_AK (1 << 2) # define VSYNC_INT (1 << 2) #define CRTC_EXT_CNTL 0x0054 /* CRTC_EXT_CNTL bit constants */ # define CRTC_VGA_XOVERSCAN (1 << 0) # define VGA_ATI_LINEAR 0x00000008 # define VGA_128KAP_PAGING 0x00000010 # define XCRT_CNT_EN (1 << 6) # define CRTC_HSYNC_DIS (1 << 8) # define CRTC_VSYNC_DIS (1 << 9) # define CRTC_DISPLAY_DIS (1 << 10) # define CRTC_SYNC_TRISTAT (1 << 11) # define CRTC_CRT_ON (1 << 15) #define CRTC_EXT_CNTL_DPMS_BYTE 0x0055 # define CRTC_HSYNC_DIS_BYTE (1 << 0) # define CRTC_VSYNC_DIS_BYTE (1 << 1) # define CRTC_DISPLAY_DIS_BYTE (1 << 2) #define RB3D_CNTL 0x1C3C #define WAIT_UNTIL 0x1720 # define EVENT_CRTC_OFFSET 0x00000001 # define EVENT_RE_CRTC_VLINE 0x00000002 # define EVENT_FE_CRTC_VLINE 0x00000004 # define EVENT_CRTC_VLINE 0x00000008 # define EVENT_BM_VIP0_IDLE 0x00000010 # define EVENT_BM_VIP1_IDLE 0x00000020 # define EVENT_BM_VIP2_IDLE 0x00000040 # define EVENT_BM_VIP3_IDLE 0x00000080 # define EVENT_BM_VIDCAP_IDLE 0x00000100 # define EVENT_BM_GUI_IDLE 0x00000200 # define EVENT_CMDFIFO 0x00000400 # define EVENT_OV0_FLIP 0x00000800 # define EVENT_CMDFIFO_ENTRIES 0x07F00000 #define ISYNC_CNTL 0x1724 #define RBBM_GUICNTL 0x172C #define RBBM_STATUS 0x0E40 # define RBBM_FIFOCNT_MASK 0x007f # define RBBM_ACTIVE (1 << 31) #define RBBM_STATUS_alt_1 0x1740 #define RBBM_CNTL 0x00EC #define RBBM_CNTL_alt_1 0x0E44 #define RBBM_SOFT_RESET 0x00F0 /* RBBM_SOFT_RESET bit constants */ # define SOFT_RESET_CP (1 << 0) # define SOFT_RESET_HI (1 << 1) # define SOFT_RESET_SE (1 << 2) # define SOFT_RESET_RE (1 << 3) # define SOFT_RESET_PP (1 << 4) # define SOFT_RESET_E2 (1 << 5) # define SOFT_RESET_RB (1 << 6) # define SOFT_RESET_HDP (1 << 7) #define RBBM_SOFT_RESET_alt_1 0x0E48 #define NQWAIT_UNTIL 0x0E50 #define RBBM_DEBUG 0x0E6C #define RBBM_CMDFIFO_ADDR 0x0E70 #define RBBM_CMDFIFO_DATAL 0x0E74 #define RBBM_CMDFIFO_DATAH 0x0E78 #define RBBM_CMDFIFO_STAT 0x0E7C #define CRTC_STATUS 0x005C /* CRTC_STATUS bit constants */ # define CRTC_VBLANK 0x00000001 # define CRTC_VBLANK_SAVE ( 1 << 1) #define GPIO_VGA_DDC 0x0060 #define GPIO_DVI_DDC 0x0064 #define GPIO_MONID 0x0068 #define PALETTE_INDEX 0x00B0 #define PALETTE_DATA 0x00B4 #define PALETTE_30_DATA 0x00B8 #define CRTC_H_TOTAL_DISP 0x0200 # define CRTC_H_TOTAL (0x03ff << 0) # define CRTC_H_TOTAL_SHIFT 0 # define CRTC_H_DISP (0x01ff << 16) # define CRTC_H_DISP_SHIFT 16 #define CRTC2_H_TOTAL_DISP 0x0300 # define CRTC2_H_TOTAL (0x03ff << 0) # define CRTC2_H_TOTAL_SHIFT 0 # define CRTC2_H_DISP (0x01ff << 16) # define CRTC2_H_DISP_SHIFT 16 #define CRTC_H_SYNC_STRT_WID 0x0204 # define CRTC_H_SYNC_STRT_PIX (0x07 << 0) # define CRTC_H_SYNC_STRT_CHAR (0x3ff << 3) # define CRTC_H_SYNC_STRT_CHAR_SHIFT 3 # define CRTC_H_SYNC_WID (0x3f << 16) # define CRTC_H_SYNC_WID_SHIFT 16 # define CRTC_H_SYNC_POL (1 << 23) #define CRTC2_H_SYNC_STRT_WID 0x0304 # define CRTC2_H_SYNC_STRT_PIX (0x07 << 0) # define CRTC2_H_SYNC_STRT_CHAR (0x3ff << 3) # define CRTC2_H_SYNC_STRT_CHAR_SHIFT 3 # define CRTC2_H_SYNC_WID (0x3f << 16) # define CRTC2_H_SYNC_WID_SHIFT 16 # define CRTC2_H_SYNC_POL (1 << 23) #define CRTC_V_TOTAL_DISP 0x0208 # define CRTC_V_TOTAL (0x07ff << 0) # define CRTC_V_TOTAL_SHIFT 0 # define CRTC_V_DISP (0x07ff << 16) # define CRTC_V_DISP_SHIFT 16 #define CRTC2_V_TOTAL_DISP 0x0308 # define CRTC2_V_TOTAL (0x07ff << 0) # define CRTC2_V_TOTAL_SHIFT 0 # define CRTC2_V_DISP (0x07ff << 16) # define CRTC2_V_DISP_SHIFT 16 #define CRTC_V_SYNC_STRT_WID 0x020C # define CRTC_V_SYNC_STRT (0x7ff << 0) # define CRTC_V_SYNC_STRT_SHIFT 0 # define CRTC_V_SYNC_WID (0x1f << 16) # define CRTC_V_SYNC_WID_SHIFT 16 # define CRTC_V_SYNC_POL (1 << 23) #define CRTC2_V_SYNC_STRT_WID 0x030C # define CRTC2_V_SYNC_STRT (0x7ff << 0) # define CRTC2_V_SYNC_STRT_SHIFT 0 # define CRTC2_V_SYNC_WID (0x1f << 16) # define CRTC2_V_SYNC_WID_SHIFT 16 # define CRTC2_V_SYNC_POL (1 << 23) #define CRTC_VLINE_CRNT_VLINE 0x0210 # define CRTC_CRNT_VLINE_MASK (0x7ff << 16) #define CRTC2_VLINE_CRNT_VLINE 0x0310 #define CRTC_CRNT_FRAME 0x0214 #define CRTC2_CRNT_FRAME 0x0314 #define CRTC_GUI_TRIG_VLINE 0x0218 #define CRTC2_GUI_TRIG_VLINE 0x0318 #define CRTC_DEBUG 0x021C #define CRTC2_DEBUG 0x031C #define CRTC_OFFSET_RIGHT 0x0220 #define CRTC_OFFSET 0x0224 #define CRTC2_OFFSET 0x0324 #define CRTC_OFFSET_CNTL 0x0228 # define CRTC_TILE_EN (1 << 15) #define CRTC2_OFFSET_CNTL 0x0328 # define CRTC2_TILE_EN (1 << 15) #define CRTC_PITCH 0x022C #define CRTC2_PITCH 0x032C #define TMDS_CRC 0x02a0 #define OVR_CLR 0x0230 #define OVR_WID_LEFT_RIGHT 0x0234 #define OVR_WID_TOP_BOTTOM 0x0238 #define DISPLAY_BASE_ADDR 0x023C #define SNAPSHOT_VH_COUNTS 0x0240 #define SNAPSHOT_F_COUNT 0x0244 #define N_VIF_COUNT 0x0248 #define SNAPSHOT_VIF_COUNT 0x024C #define FP_CRTC_H_TOTAL_DISP 0x0250 #define FP_CRTC2_H_TOTAL_DISP 0x0350 #define FP_CRTC_V_TOTAL_DISP 0x0254 #define FP_CRTC2_V_TOTAL_DISP 0x0354 # define FP_CRTC_H_TOTAL_MASK 0x000003ff # define FP_CRTC_H_DISP_MASK 0x01ff0000 # define FP_CRTC_V_TOTAL_MASK 0x00000fff # define FP_CRTC_V_DISP_MASK 0x0fff0000 # define FP_H_SYNC_STRT_CHAR_MASK 0x00001ff8 # define FP_H_SYNC_WID_MASK 0x003f0000 # define FP_V_SYNC_STRT_MASK 0x00000fff # define FP_V_SYNC_WID_MASK 0x001f0000 # define FP_CRTC_H_TOTAL_SHIFT 0x00000000 # define FP_CRTC_H_DISP_SHIFT 0x00000010 # define FP_CRTC_V_TOTAL_SHIFT 0x00000000 # define FP_CRTC_V_DISP_SHIFT 0x00000010 # define FP_H_SYNC_STRT_CHAR_SHIFT 0x00000003 # define FP_H_SYNC_WID_SHIFT 0x00000010 # define FP_V_SYNC_STRT_SHIFT 0x00000000 # define FP_V_SYNC_WID_SHIFT 0x00000010 #define CRT_CRTC_H_SYNC_STRT_WID 0x0258 #define CRT_CRTC_V_SYNC_STRT_WID 0x025C #define CUR_OFFSET 0x0260 #define CUR_HORZ_VERT_POSN 0x0264 #define CUR_HORZ_VERT_OFF 0x0268 /* CUR_OFFSET, CUR_HORZ_VERT_POSN, CUR_HORZ_VERT_OFF bit constants */ # define CUR_LOCK 0x80000000 #define CUR_CLR0 0x026C #define CUR_CLR1 0x0270 #define CUR2_OFFSET 0x0360 #define CUR2_HORZ_VERT_POSN 0x0364 #define CUR2_HORZ_VERT_OFF 0x0368 # define CUR2_LOCK (1 << 31) #define CUR2_CLR0 0x036c #define CUR2_CLR1 0x0370 #define FP_HORZ_VERT_ACTIVE 0x0278 #define CRTC_MORE_CNTL 0x027C #define DAC_EXT_CNTL 0x0280 #define FP_GEN_CNTL 0x0284 /* FP_GEN_CNTL bit constants */ # define FP_FPON (1 << 0) # define FP_TMDS_EN (1 << 2) # define FP_EN_TMDS (1 << 7) # define FP_DETECT_SENSE (1 << 8) # define FP_SEL_CRTC2 (1 << 13) # define FP_CRTC_DONT_SHADOW_HPAR (1 << 15) # define FP_CRTC_DONT_SHADOW_VPAR (1 << 16) # define FP_CRTC_DONT_SHADOW_HEND (1 << 17) # define FP_CRTC_USE_SHADOW_VEND (1 << 18) # define FP_RMX_HVSYNC_CONTROL_EN (1 << 20) # define FP_DFP_SYNC_SEL (1 << 21) # define FP_CRTC_LOCK_8DOT (1 << 22) # define FP_CRT_SYNC_SEL (1 << 23) # define FP_USE_SHADOW_EN (1 << 24) # define FP_CRT_SYNC_ALT (1 << 26) #define FP2_GEN_CNTL 0x0288 /* FP2_GEN_CNTL bit constants */ # define FP2_FPON (1 << 0) # define FP2_TMDS_EN (1 << 2) # define FP2_EN_TMDS (1 << 7) # define FP2_DETECT_SENSE (1 << 8) # define FP2_SEL_CRTC2 (1 << 13) # define FP2_FP_POL (1 << 16) # define FP2_LP_POL (1 << 17) # define FP2_SCK_POL (1 << 18) # define FP2_LCD_CNTL_MASK (7 << 19) # define FP2_PAD_FLOP_EN (1 << 22) # define FP2_CRC_EN (1 << 23) # define FP2_CRC_READ_EN (1 << 24) #define FP_HORZ_STRETCH 0x028C #define FP_HORZ2_STRETCH 0x038C # define HORZ_STRETCH_RATIO_MASK 0xffff # define HORZ_STRETCH_RATIO_MAX 4096 # define HORZ_PANEL_SIZE (0x1ff << 16) # define HORZ_PANEL_SHIFT 16 # define HORZ_STRETCH_PIXREP (0 << 25) # define HORZ_STRETCH_BLEND (1 << 26) # define HORZ_STRETCH_ENABLE (1 << 25) # define HORZ_AUTO_RATIO (1 << 27) # define HORZ_FP_LOOP_STRETCH (0x7 << 28) # define HORZ_AUTO_RATIO_INC (1 << 31) #define FP_VERT_STRETCH 0x0290 #define FP_VERT2_STRETCH 0x0390 # define VERT_PANEL_SIZE (0xfff << 12) # define VERT_PANEL_SHIFT 12 # define VERT_STRETCH_RATIO_MASK 0xfff # define VERT_STRETCH_RATIO_SHIFT 0 # define VERT_STRETCH_RATIO_MAX 4096 # define VERT_STRETCH_ENABLE (1 << 25) # define VERT_STRETCH_LINEREP (0 << 26) # define VERT_STRETCH_BLEND (1 << 26) # define VERT_AUTO_RATIO_EN (1 << 27) # define VERT_STRETCH_RESERVED 0xf1000000 #define FP_H_SYNC_STRT_WID 0x02C4 #define FP_H2_SYNC_STRT_WID 0x03C4 #define FP_V_SYNC_STRT_WID 0x02C8 #define FP_V2_SYNC_STRT_WID 0x03C8 #define LVDS_GEN_CNTL 0x02d0 # define LVDS_ON (1 << 0) # define LVDS_DISPLAY_DIS (1 << 1) # define LVDS_PANEL_TYPE (1 << 2) # define LVDS_PANEL_FORMAT (1 << 3) # define LVDS_EN (1 << 7) # define LVDS_DIGON (1 << 18) # define LVDS_BLON (1 << 19) # define LVDS_SEL_CRTC2 (1 << 23) #define LVDS_PLL_CNTL 0x02d4 # define HSYNC_DELAY_SHIFT 28 # define HSYNC_DELAY_MASK (0xf << 28) #define AUX_WINDOW_HORZ_CNTL 0x02D8 #define AUX_WINDOW_VERT_CNTL 0x02DC #define DDA_CONFIG 0x02e0 #define DDA_ON_OFF 0x02e4 #define GRPH_BUFFER_CNTL 0x02F0 #define VGA_BUFFER_CNTL 0x02F4 /* first overlay unit (there is only one) */ #define OV0_Y_X_START 0x0400 #define OV0_Y_X_END 0x0404 #define OV0_PIPELINE_CNTL 0x0408 #define OV0_EXCLUSIVE_HORZ 0x0408 # define EXCL_HORZ_START_MASK 0x000000ff # define EXCL_HORZ_END_MASK 0x0000ff00 # define EXCL_HORZ_BACK_PORCH_MASK 0x00ff0000 # define EXCL_HORZ_EXCLUSIVE_EN 0x80000000 #define OV0_EXCLUSIVE_VERT 0x040C # define EXCL_VERT_START_MASK 0x000003ff # define EXCL_VERT_END_MASK 0x03ff0000 #define OV0_REG_LOAD_CNTL 0x0410 # define REG_LD_CTL_LOCK 0x00000001L # define REG_LD_CTL_VBLANK_DURING_LOCK 0x00000002L # define REG_LD_CTL_STALL_GUI_UNTIL_FLIP 0x00000004L # define REG_LD_CTL_LOCK_READBACK 0x00000008L #define OV0_SCALE_CNTL 0x0420 # define SCALER_PIX_EXPAND 0x00000001L # define SCALER_Y2R_TEMP 0x00000002L #ifdef RAGE128 # define SCALER_HORZ_PICK_NEAREST 0x00000003L # define SCALER_VERT_PICK_NEAREST 0x00000004L #else # define SCALER_HORZ_PICK_NEAREST 0x00000004L # define SCALER_VERT_PICK_NEAREST 0x00000008L #endif # define SCALER_SIGNED_UV 0x00000010L # define SCALER_GAMMA_SEL_MASK 0x00000060L # define SCALER_GAMMA_SEL_BRIGHT 0x00000000L # define SCALER_GAMMA_SEL_G22 0x00000020L # define SCALER_GAMMA_SEL_G18 0x00000040L # define SCALER_GAMMA_SEL_G14 0x00000060L # define SCALER_COMCORE_SHIFT_UP_ONE 0x00000080L # define SCALER_SURFAC_FORMAT 0x00000f00L # define SCALER_SOURCE_UNK0 0x00000000L /* 2 bpp ??? */ # define SCALER_SOURCE_UNK1 0x00000100L /* 4 bpp ??? */ # define SCALER_SOURCE_UNK2 0x00000200L /* 8 bpp ??? */ # define SCALER_SOURCE_15BPP 0x00000300L # define SCALER_SOURCE_16BPP 0x00000400L /*# define SCALER_SOURCE_24BPP 0x00000500L*/ # define SCALER_SOURCE_32BPP 0x00000600L # define SCALER_SOURCE_UNK3 0x00000700L /* 8BPP_RGB332 ??? */ # define SCALER_SOURCE_UNK4 0x00000800L /* 8BPP_Y8 ??? */ # define SCALER_SOURCE_YUV9 0x00000900L /* 8BPP_RGB8 */ # define SCALER_SOURCE_YUV12 0x00000A00L # define SCALER_SOURCE_VYUY422 0x00000B00L # define SCALER_SOURCE_YVYU422 0x00000C00L # define SCALER_SOURCE_UNK5 0x00000D00L /* ??? */ # define SCALER_SOURCE_UNK6 0x00000E00L /* 32BPP_AYUV444 */ # define SCALER_SOURCE_UNK7 0x00000F00L /* 16BPP_ARGB4444 */ # define SCALER_ADAPTIVE_DEINT 0x00001000L # define R200_SCALER_TEMPORAL_DEINT 0x00002000L # define SCALER_UNKNOWN_FLAG1 0x00004000L /* ??? */ # define SCALER_SMART_SWITCH 0x00008000L #ifdef RAGE128 # define SCALER_BURST_PER_PLANE 0x00ff0000L #else # define SCALER_BURST_PER_PLANE 0x007f0000L #endif # define SCALER_DOUBLE_BUFFER 0x01000000L # define SCALER_UNKNOWN_FLAG3 0x02000000L /* ??? */ # define SCALER_UNKNOWN_FLAG4 0x04000000L /* ??? */ # define SCALER_DIS_LIMIT 0x08000000L # define SCALER_PRG_LOAD_START 0x10000000L # define SCALER_INT_EMU 0x20000000L # define SCALER_ENABLE 0x40000000L # define SCALER_SOFT_RESET 0x80000000L #define OV0_V_INC 0x0424 #define OV0_P1_V_ACCUM_INIT 0x0428 # define OV0_P1_MAX_LN_IN_PER_LN_OUT 0x00000003L # define OV0_P1_V_ACCUM_INIT_MASK 0x01ff8000L #define OV0_P23_V_ACCUM_INIT 0x042C # define OV0_P23_MAX_LN_IN_PER_LN_OUT 0x00000003L # define OV0_P23_V_ACCUM_INIT_MASK 0x01ff8000L #define OV0_P1_BLANK_LINES_AT_TOP 0x0430 # define P1_BLNK_LN_AT_TOP_M1_MASK 0x00000fffL # define P1_ACTIVE_LINES_M1 0x0fff0000L #define OV0_P23_BLANK_LINES_AT_TOP 0x0434 # define P23_BLNK_LN_AT_TOP_M1_MASK 0x000007ffL # define P23_ACTIVE_LINES_M1 0x07ff0000L #ifndef RAGE128 #define OV0_BASE_ADDR 0x043C #endif #define OV0_VID_BUF0_BASE_ADRS 0x0440 # define VIF_BUF0_PITCH_SEL 0x00000001L # define VIF_BUF0_TILE_ADRS 0x00000002L # define VIF_BUF0_BASE_ADRS_MASK 0x03fffff0L # define VIF_BUF0_1ST_LINE_LSBS_MASK 0x48000000L #define OV0_VID_BUF1_BASE_ADRS 0x0444 # define VIF_BUF1_PITCH_SEL 0x00000001L # define VIF_BUF1_TILE_ADRS 0x00000002L # define VIF_BUF1_BASE_ADRS_MASK 0x03fffff0L # define VIF_BUF1_1ST_LINE_LSBS_MASK 0x48000000L #define OV0_VID_BUF2_BASE_ADRS 0x0448 # define VIF_BUF2_PITCH_SEL 0x00000001L # define VIF_BUF2_TILE_ADRS 0x00000002L # define VIF_BUF2_BASE_ADRS_MASK 0x03fffff0L # define VIF_BUF2_1ST_LINE_LSBS_MASK 0x48000000L #define OV0_VID_BUF3_BASE_ADRS 0x044C # define VIF_BUF3_PITCH_SEL 0x00000001L # define VIF_BUF3_TILE_ADRS 0x00000002L # define VIF_BUF3_BASE_ADRS_MASK 0x03fffff0L # define VIF_BUF3_1ST_LINE_LSBS_MASK 0x48000000L #define OV0_VID_BUF4_BASE_ADRS 0x0450 # define VIF_BUF4_PITCH_SEL 0x00000001L # define VIF_BUF4_TILE_ADRS 0x00000002L # define VIF_BUF4_BASE_ADRS_MASK 0x03fffff0L # define VIF_BUF4_1ST_LINE_LSBS_MASK 0x48000000L #define OV0_VID_BUF5_BASE_ADRS 0x0454 # define VIF_BUF5_PITCH_SEL 0x00000001L # define VIF_BUF5_TILE_ADRS 0x00000002L # define VIF_BUF5_BASE_ADRS_MASK 0x03fffff0L # define VIF_BUF5_1ST_LINE_LSBS_MASK 0x48000000L #define OV0_VID_BUF_PITCH0_VALUE 0x0460 #define OV0_VID_BUF_PITCH1_VALUE 0x0464 #define OV0_AUTO_FLIP_CNTL 0x0470 # define OV0_AUTO_FLIP_CNTL_SOFT_BUF_NUM 0x00000007 # define OV0_AUTO_FLIP_CNTL_SOFT_REPEAT_FIELD 0x00000008 # define OV0_AUTO_FLIP_CNTL_SOFT_BUF_ODD 0x00000010 # define OV0_AUTO_FLIP_CNTL_IGNORE_REPEAT_FIELD 0x00000020 # define OV0_AUTO_FLIP_CNTL_SOFT_EOF_TOGGLE 0x00000040 # define OV0_AUTO_FLIP_CNTL_VID_PORT_SELECT 0x00000300 # define OV0_AUTO_FLIP_CNTL_P1_FIRST_LINE_EVEN 0x00010000 # define OV0_AUTO_FLIP_CNTL_SHIFT_EVEN_DOWN 0x00040000 # define OV0_AUTO_FLIP_CNTL_SHIFT_ODD_DOWN 0x00080000 # define OV0_AUTO_FLIP_CNTL_FIELD_POL_SOURCE 0x00800000 #define OV0_DEINTERLACE_PATTERN 0x0474 #define OV0_SUBMIT_HISTORY 0x0478 #define OV0_H_INC 0x0480 #define OV0_STEP_BY 0x0484 #define OV0_P1_H_ACCUM_INIT 0x0488 #define OV0_P23_H_ACCUM_INIT 0x048C #define OV0_P1_X_START_END 0x0494 #define OV0_P2_X_START_END 0x0498 #define OV0_P3_X_START_END 0x049C #define OV0_FILTER_CNTL 0x04A0 # define FILTER_PROGRAMMABLE_COEF 0x00000000 # define FILTER_HARD_SCALE_HORZ_Y 0x00000001 # define FILTER_HARD_SCALE_HORZ_UV 0x00000002 # define FILTER_HARD_SCALE_VERT_Y 0x00000004 # define FILTER_HARD_SCALE_VERT_UV 0x00000008 # define FILTER_HARDCODED_COEF 0x0000000F # define FILTER_COEF_MASK 0x0000000F /* When bit is set hard coded coefficients are used. */ /* Top quality 4x4-tap filtered vertical and horizontal scaler. It allows up to 64:1 upscaling and downscaling without performance or quality degradation. */ #define OV0_FOUR_TAP_COEF_0 0x04B0 # define OV0_FOUR_TAP_PHASE_0_TAP_0 0x0000000F # define OV0_FOUR_TAP_PHASE_0_TAP_1 0x00007F00 # define OV0_FOUR_TAP_PHASE_0_TAP_2 0x007F0000 # define OV0_FOUR_TAP_PHASE_0_TAP_3 0x0F000000 #define OV0_FOUR_TAP_COEF_1 0x04B4 # define OV0_FOUR_TAP_PHASE_1_5_TAP_0 0x0000000F # define OV0_FOUR_TAP_PHASE_1_5_TAP_1 0x00007F00 # define OV0_FOUR_TAP_PHASE_1_5_TAP_2 0x007F0000 # define OV0_FOUR_TAP_PHASE_1_5_TAP_3 0x0F000000 #define OV0_FOUR_TAP_COEF_2 0x04B8 # define OV0_FOUR_TAP_PHASE_2_6_TAP_0 0x0000000F # define OV0_FOUR_TAP_PHASE_2_6_TAP_1 0x00007F00 # define OV0_FOUR_TAP_PHASE_2_6_TAP_2 0x007F0000 # define OV0_FOUR_TAP_PHASE_2_6_TAP_3 0x0F000000 #define OV0_FOUR_TAP_COEF_3 0x04BC # define OV0_FOUR_TAP_PHASE_3_7_TAP_0 0x0000000F # define OV0_FOUR_TAP_PHASE_3_7_TAP_1 0x00007F00 # define OV0_FOUR_TAP_PHASE_3_7_TAP_2 0x007F0000 # define OV0_FOUR_TAP_PHASE_3_7_TAP_3 0x0F000000 #define OV0_FOUR_TAP_COEF_4 0x04C0 # define OV0_FOUR_TAP_PHASE_4_TAP_0 0x0000000F # define OV0_FOUR_TAP_PHASE_4_TAP_1 0x00007F00 # define OV0_FOUR_TAP_PHASE_4_TAP_2 0x007F0000 # define OV0_FOUR_TAP_PHASE_4_TAP_3 0x0F000000 /* 0th_tap means that the left most of top most pixel in a set of four will be multiplied by this coefficient. */ #define OV0_FLAG_CNTL 0x04DC #ifdef RAGE128 #define OV0_COLOUR_CNTL 0x04E0 # define COLOUR_CNTL_BRIGHTNESS 0x0000007F # define COLOUR_CNTL_SATURATION 0x001F1F00 #else /* NB: radeons have no COLOUR_CNTL register */ #define OV0_SLICE_CNTL 0x04E0 # define SLICE_CNTL_DISABLE 0x40000000 #endif /* Video and graphics keys allow alpha blending, color correction and many other video effects */ #define OV0_VID_KEY_CLR 0x04E4 #define OV0_VID_KEY_MSK 0x04E8 #define OV0_GRAPHICS_KEY_CLR 0x04EC #define OV0_GRAPHICS_KEY_MSK 0x04F0 #define OV0_KEY_CNTL 0x04F4 #ifdef RAGE128 # define VIDEO_KEY_FN_MASK 0x00000007L # define VIDEO_KEY_FN_FALSE 0x00000000L # define VIDEO_KEY_FN_TRUE 0x00000001L # define VIDEO_KEY_FN_EQ 0x00000004L # define VIDEO_KEY_FN_NE 0x00000005L # define GRAPHIC_KEY_FN_MASK 0x00000070L # define GRAPHIC_KEY_FN_FALSE 0x00000000L # define GRAPHIC_KEY_FN_TRUE 0x00000010L # define GRAPHIC_KEY_FN_EQ 0x00000040L # define GRAPHIC_KEY_FN_NE 0x00000050L #else # define VIDEO_KEY_FN_MASK 0x00000003L # define VIDEO_KEY_FN_FALSE 0x00000000L # define VIDEO_KEY_FN_TRUE 0x00000001L # define VIDEO_KEY_FN_EQ 0x00000002L # define VIDEO_KEY_FN_NE 0x00000003L # define GRAPHIC_KEY_FN_MASK 0x00000030L # define GRAPHIC_KEY_FN_FALSE 0x00000000L # define GRAPHIC_KEY_FN_TRUE 0x00000010L # define GRAPHIC_KEY_FN_EQ 0x00000020L # define GRAPHIC_KEY_FN_NE 0x00000030L #endif # define CMP_MIX_MASK 0x00000100L # define CMP_MIX_OR 0x00000000L # define CMP_MIX_AND 0x00000100L #define OV0_TEST 0x04F8 # define OV0_SCALER_Y2R_DISABLE 0x00000001L # define OV0_SUBPIC_ONLY 0x00000008L # define OV0_EXTENSE 0x00000010L # define OV0_SWAP_UV 0x00000020L #define OV0_COL_CONV 0x04FC # define OV0_CB_TO_B 0x0000007FL # define OV0_CB_TO_G 0x0000FF00L # define OV0_CR_TO_G 0x00FF0000L # define OV0_CR_TO_R 0x7F000000L # define OV0_NEW_COL_CONV 0x80000000L #define OV0_LIN_TRANS_A 0x0D20 #define OV0_LIN_TRANS_B 0x0D24 #define OV0_LIN_TRANS_C 0x0D28 #define OV0_LIN_TRANS_D 0x0D2C #define OV0_LIN_TRANS_E 0x0D30 #define OV0_LIN_TRANS_F 0x0D34 #define OV0_GAMMA_0_F 0x0D40 #define OV0_GAMMA_10_1F 0x0D44 #define OV0_GAMMA_20_3F 0x0D48 #define OV0_GAMMA_40_7F 0x0D4C /* These registers exist on R200 only */ #define OV0_GAMMA_80_BF 0x0E00 #define OV0_GAMMA_C0_FF 0x0E04 #define OV0_GAMMA_100_13F 0x0E08 #define OV0_GAMMA_140_17F 0x0E0C #define OV0_GAMMA_180_1BF 0x0E10 #define OV0_GAMMA_1C0_1FF 0x0E14 #define OV0_GAMMA_200_23F 0x0E18 #define OV0_GAMMA_240_27F 0x0E1C #define OV0_GAMMA_280_2BF 0x0E20 #define OV0_GAMMA_2C0_2FF 0x0E24 #define OV0_GAMMA_300_33F 0x0E28 #define OV0_GAMMA_340_37F 0x0E2C /* End of R200 specific definitions */ #define OV0_GAMMA_380_3BF 0x0D50 #define OV0_GAMMA_3C0_3FF 0x0D54 /* IDCT ENGINE: It's MPEG-2 hardware decoder which incorporates run-level decode, de-zigzag and IDCT into an IDCT engine to complement the motion compensation engine. */ #define IDCT_RUNS 0x1F80 #define IDCT_LEVELS 0x1F84 #define IDCT_AUTH_CONTROL 0x1F88 #define IDCT_AUTH 0x1F8C #define IDCT_CONTROL 0x1FBC #define SE_MC_SRC2_CNTL 0x19D4 # define SECONDARY_SCALE_HACC 0x00001FFFL # define SECONDARY_SCALE_VACC 0x0FFF0000L # define SECONDARY_SCALE_PICTH_ADJ 0xC0000000L #define SE_MC_SRC1_CNTL 0x19D8 # define SCALE_HACC 0x00001FFFL # define SCALE_VACC 0x0FFF0000L # define IDCT_EN 0x10000000L # define SECONDARY_TEX_EN 0x20000000L # define SCALE_PICTH_ADJ 0xC0000000L #define SE_MC_DST_CNTL 0x19DC # define DST_Y 0x00003FFFL # define DST_X 0x3FFF0000L # define DST_PITCH_ADJ 0xC0000000L #define SE_MC_CNTL_START 0x19E0 # define SCALE_OFFSET_PTR 0x0000000FL # define DST_OFFSET 0x00FFFFF0L # define ALPHA_EN 0x01000000L # define SECONDARY_OFFSET_PTR 0x1E000000L # define MC_DST_HEIGHT_WIDTH 0xE0000000L #ifndef RAGE128 #define SE_MC_BUF_BASE 0x19E4 #define PP_MC_CONTEXT 0x19E8 #define PP_MISC 0x1C14 #endif /* SUBPICTURE UNIT: Decompressing, scaling and alpha blending the compressed bitmap on the fly. Provide optimal DVD subpicture qualtity. */ #define SUBPIC_CNTL 0x0540 #define SUBPIC_DEFCOLCON 0x0544 #define SUBPIC_Y_X_START 0x054C #define SUBPIC_Y_X_END 0x0550 #define SUBPIC_V_INC 0x0554 #define SUBPIC_H_INC 0x0558 #define SUBPIC_BUF0_OFFSET 0x055C #define SUBPIC_BUF1_OFFSET 0x0560 #define SUBPIC_LC0_OFFSET 0x0564 #define SUBPIC_LC1_OFFSET 0x0568 #define SUBPIC_PITCH 0x056C #define SUBPIC_BTN_HLI_COLCON 0x0570 #define SUBPIC_BTN_HLI_Y_X_START 0x0574 #define SUBPIC_BTN_HLI_Y_X_END 0x0578 #define SUBPIC_PALETTE_INDEX 0x057C #define SUBPIC_PALETTE_DATA 0x0580 #define SUBPIC_H_ACCUM_INIT 0x0584 #define SUBPIC_V_ACCUM_INIT 0x0588 #define CP_RB_BASE 0x0700 #define CP_RB_CNTL 0x0704 #define CP_RB_RPTR_ADDR 0x070C #define CP_RB_RPTR 0x0710 #define CP_RB_WPTR 0x0714 #define CP_RB_WPTR_DELAY 0x0718 #define CP_IB_BASE 0x0738 #define CP_IB_BUFSZ 0x073C #define CP_CSQ_CNTL 0x0740 #define SCRATCH_UMSK 0x0770 #define SCRATCH_ADDR 0x0774 #ifndef RAGE128 #define DMA_GUI_TABLE_ADDR 0x0780 # define DMA_GUI_COMMAND__BYTE_COUNT_MASK 0x001fffff # define DMA_GUI_COMMAND__INTDIS 0x40000000 # define DMA_GUI_COMMAND__EOL 0x80000000 #define DMA_GUI_SRC_ADDR 0x0784 #define DMA_GUI_DST_ADDR 0x0788 #define DMA_GUI_COMMAND 0x078C #define DMA_GUI_STATUS 0x0790 #define DMA_GUI_ACT_DSCRPTR 0x0794 #define DMA_VID_TABLE_ADDR 0x07A0 #define DMA_VID_SRC_ADDR 0x07A4 #define DMA_VID_DST_ADDR 0x07A8 #define DMA_VID_COMMAND 0x07AC #define DMA_VID_STATUS 0x07B0 #define DMA_VID_ACT_DSCRPTR 0x07B4 #endif #define CP_ME_CNTL 0x07D0 #define CP_ME_RAM_ADDR 0x07D4 #define CP_ME_RAM_RADDR 0x07D8 #define CP_ME_RAM_DATAH 0x07DC #define CP_ME_RAM_DATAL 0x07E0 #define CP_CSQ_ADDR 0x07F0 #define CP_CSQ_DATA 0x07F4 #define CP_CSQ_STAT 0x07F8 #define DISP_MISC_CNTL 0x0D00 # define SOFT_RESET_GRPH_PP (1 << 0) #define DAC_MACRO_CNTL 0x0D04 #define DISP_PWR_MAN 0x0D08 #define DISP_TEST_DEBUG_CNTL 0x0D10 #define DISP_HW_DEBUG 0x0D14 #define DAC_CRC_SIG1 0x0D18 #define DAC_CRC_SIG2 0x0D1C /* first capture unit */ #define VID_BUFFER_CONTROL 0x0900 #define CAP_INT_CNTL 0x0908 #define CAP_INT_STATUS 0x090C #define FCP_CNTL 0x0910 # define FCP_CNTL__PCICLK 0 # define FCP_CNTL__PCLK 1 # define FCP_CNTL__PCLKb 2 # define FCP_CNTL__HREF 3 # define FCP_CNTL__GND 4 # define FCP_CNTL__HREFb 5 #define CAP0_BUF0_OFFSET 0x0920 #define CAP0_BUF1_OFFSET 0x0924 #define CAP0_BUF0_EVEN_OFFSET 0x0928 #define CAP0_BUF1_EVEN_OFFSET 0x092C #define CAP0_BUF_PITCH 0x0930 #define CAP0_V_WINDOW 0x0934 #define CAP0_H_WINDOW 0x0938 #define CAP0_VBI0_OFFSET 0x093C #define CAP0_VBI1_OFFSET 0x0940 #define CAP0_VBI_V_WINDOW 0x0944 #define CAP0_VBI_H_WINDOW 0x0948 #define CAP0_PORT_MODE_CNTL 0x094C #define CAP0_TRIG_CNTL 0x0950 #define CAP0_DEBUG 0x0954 #define CAP0_CONFIG 0x0958 # define CAP0_CONFIG_CONTINUOS 0x00000001 # define CAP0_CONFIG_START_FIELD_EVEN 0x00000002 # define CAP0_CONFIG_START_BUF_GET 0x00000004 # define CAP0_CONFIG_START_BUF_SET 0x00000008 # define CAP0_CONFIG_BUF_TYPE_ALT 0x00000010 # define CAP0_CONFIG_BUF_TYPE_FRAME 0x00000020 # define CAP0_CONFIG_ONESHOT_MODE_FRAME 0x00000040 # define CAP0_CONFIG_BUF_MODE_DOUBLE 0x00000080 # define CAP0_CONFIG_BUF_MODE_TRIPLE 0x00000100 # define CAP0_CONFIG_MIRROR_EN 0x00000200 # define CAP0_CONFIG_ONESHOT_MIRROR_EN 0x00000400 # define CAP0_CONFIG_VIDEO_SIGNED_UV 0x00000800 # define CAP0_CONFIG_ANC_DECODE_EN 0x00001000 # define CAP0_CONFIG_VBI_EN 0x00002000 # define CAP0_CONFIG_SOFT_PULL_DOWN_EN 0x00004000 # define CAP0_CONFIG_VIP_EXTEND_FLAG_EN 0x00008000 # define CAP0_CONFIG_FAKE_FIELD_EN 0x00010000 # define CAP0_CONFIG_ODD_ONE_MORE_LINE 0x00020000 # define CAP0_CONFIG_EVEN_ONE_MORE_LINE 0x00040000 # define CAP0_CONFIG_HORZ_DIVIDE_2 0x00080000 # define CAP0_CONFIG_HORZ_DIVIDE_4 0x00100000 # define CAP0_CONFIG_VERT_DIVIDE_2 0x00200000 # define CAP0_CONFIG_VERT_DIVIDE_4 0x00400000 # define CAP0_CONFIG_FORMAT_BROOKTREE 0x00000000 # define CAP0_CONFIG_FORMAT_CCIR656 0x00800000 # define CAP0_CONFIG_FORMAT_ZV 0x01000000 # define CAP0_CONFIG_FORMAT_VIP 0x01800000 # define CAP0_CONFIG_FORMAT_TRANSPORT 0x02000000 # define CAP0_CONFIG_HORZ_DECIMATOR 0x04000000 # define CAP0_CONFIG_VIDEO_IN_YVYU422 0x00000000 # define CAP0_CONFIG_VIDEO_IN_VYUY422 0x20000000 # define CAP0_CONFIG_VBI_DIVIDE_2 0x40000000 # define CAP0_CONFIG_VBI_DIVIDE_4 0x80000000 #define CAP0_ANC_ODD_OFFSET 0x095C #define CAP0_ANC_EVEN_OFFSET 0x0960 #define CAP0_ANC_H_WINDOW 0x0964 #define CAP0_VIDEO_SYNC_TEST 0x0968 #define CAP0_ONESHOT_BUF_OFFSET 0x096C #define CAP0_BUF_STATUS 0x0970 #ifdef RAGE128 #define CAP0_DWNSC_XRATIO 0x0978 #define CAP0_XSHARPNESS 0x097C #else /* #define CAP0_DWNSC_XRATIO 0x0978 */ /* #define CAP0_XSHARPNESS 0x097C */ #endif #define CAP0_VBI2_OFFSET 0x0980 #define CAP0_VBI3_OFFSET 0x0984 #define CAP0_ANC2_OFFSET 0x0988 #define CAP0_ANC3_OFFSET 0x098C /* second capture unit */ #define CAP1_BUF0_OFFSET 0x0990 #define CAP1_BUF1_OFFSET 0x0994 #define CAP1_BUF0_EVEN_OFFSET 0x0998 #define CAP1_BUF1_EVEN_OFFSET 0x099C #define CAP1_BUF_PITCH 0x09A0 #define CAP1_V_WINDOW 0x09A4 #define CAP1_H_WINDOW 0x09A8 #define CAP1_VBI_ODD_OFFSET 0x09AC #define CAP1_VBI_EVEN_OFFSET 0x09B0 #define CAP1_VBI_V_WINDOW 0x09B4 #define CAP1_VBI_H_WINDOW 0x09B8 #define CAP1_PORT_MODE_CNTL 0x09BC #define CAP1_TRIG_CNTL 0x09C0 #define CAP1_DEBUG 0x09C4 #define CAP1_CONFIG 0x09C8 #define CAP1_ANC_ODD_OFFSET 0x09CC #define CAP1_ANC_EVEN_OFFSET 0x09D0 #define CAP1_ANC_H_WINDOW 0x09D4 #define CAP1_VIDEO_SYNC_TEST 0x09D8 #define CAP1_ONESHOT_BUF_OFFSET 0x09DC #define CAP1_BUF_STATUS 0x09E0 #define CAP1_DWNSC_XRATIO 0x09E8 #define CAP1_XSHARPNESS 0x09EC #define DISP_MERGE_CNTL 0x0D60 #define DISP_OUTPUT_CNTL 0x0D64 # define DISP_DAC_SOURCE_MASK 0x03 # define DISP_DAC_SOURCE_CRTC2 0x01 #define DISP_LIN_TRANS_GRPH_A 0x0D80 #define DISP_LIN_TRANS_GRPH_B 0x0D84 #define DISP_LIN_TRANS_GRPH_C 0x0D88 #define DISP_LIN_TRANS_GRPH_D 0x0D8C #define DISP_LIN_TRANS_GRPH_E 0x0D90 #define DISP_LIN_TRANS_GRPH_F 0x0D94 #define DISP_LIN_TRANS_VID_A 0x0D98 #define DISP_LIN_TRANS_VID_B 0x0D9C #define DISP_LIN_TRANS_VID_C 0x0DA0 #define DISP_LIN_TRANS_VID_D 0x0DA4 #define DISP_LIN_TRANS_VID_E 0x0DA8 #define DISP_LIN_TRANS_VID_F 0x0DAC #define RMX_HORZ_FILTER_0TAP_COEF 0x0DB0 #define RMX_HORZ_FILTER_1TAP_COEF 0x0DB4 #define RMX_HORZ_FILTER_2TAP_COEF 0x0DB8 #define RMX_HORZ_PHASE 0x0DBC #define DAC_EMBEDDED_SYNC_CNTL 0x0DC0 #define DAC_BROAD_PULSE 0x0DC4 #define DAC_SKEW_CLKS 0x0DC8 #define DAC_INCR 0x0DCC #define DAC_NEG_SYNC_LEVEL 0x0DD0 #define DAC_POS_SYNC_LEVEL 0x0DD4 #define DAC_BLANK_LEVEL 0x0DD8 #define CLOCK_CNTL_INDEX 0x0008 /* CLOCK_CNTL_INDEX bit constants */ # define PLL_WR_EN 0x00000080 # define PLL_DIV_SEL (3 << 8) # define PLL2_DIV_SEL_MASK ~(3 << 8) #define CLOCK_CNTL_DATA 0x000C #define CP_RB_CNTL 0x0704 #define CP_RB_BASE 0x0700 #define CP_RB_RPTR_ADDR 0x070C #define CP_RB_RPTR 0x0710 #define CP_RB_WPTR 0x0714 #define CP_RB_WPTR_DELAY 0x0718 #define CP_IB_BASE 0x0738 #define CP_IB_BUFSZ 0x073C #define SCRATCH_REG0 0x15E0 #define GUI_SCRATCH_REG0 0x15E0 #define SCRATCH_REG1 0x15E4 #define GUI_SCRATCH_REG1 0x15E4 #define SCRATCH_REG2 0x15E8 #define GUI_SCRATCH_REG2 0x15E8 #define SCRATCH_REG3 0x15EC #define GUI_SCRATCH_REG3 0x15EC #define SCRATCH_REG4 0x15F0 #define GUI_SCRATCH_REG4 0x15F0 #define SCRATCH_REG5 0x15F4 #define GUI_SCRATCH_REG5 0x15F4 #define SCRATCH_UMSK 0x0770 #define SCRATCH_ADDR 0x0774 #define DP_BRUSH_FRGD_CLR 0x147C #define DP_BRUSH_BKGD_CLR 0x1478 #define DST_LINE_START 0x1600 #define DST_LINE_END 0x1604 #define SRC_OFFSET 0x15AC #define SRC_PITCH 0x15B0 #define SRC_TILE 0x1704 #define SRC_PITCH_OFFSET 0x1428 #define SRC_X 0x1414 #define SRC_Y 0x1418 #define DST_WIDTH_X 0x1588 #define DST_HEIGHT_WIDTH_8 0x158C #define SRC_X_Y 0x1590 #define SRC_Y_X 0x1434 #define DST_Y_X 0x1438 #define DST_WIDTH_HEIGHT 0x1598 #define DST_HEIGHT_WIDTH 0x143c #ifdef RAGE128 #define GUI_STAT 0x1740 # define GUI_FIFOCNT_MASK 0x0fff # define PM4_BUSY (1 << 16) # define MICRO_BUSY (1 << 17) # define FPU_BUSY (1 << 18) # define VC_BUSY (1 << 19) # define IDCT_BUSY (1 << 20) # define ENG_EV_BUSY (1 << 21) # define SETUP_BUSY (1 << 22) # define EDGE_WALK_BUSY (1 << 23) # define ADDRESSING_BUSY (1 << 24) # define ENG_3D_BUSY (1 << 25) # define ENG_2D_SM_BUSY (1 << 26) # define ENG_2D_BUSY (1 << 27) # define GUI_WB_BUSY (1 << 28) # define CACHE_BUSY (1 << 29) # define GUI_ACTIVE (1 << 31) #endif #define SRC_CLUT_ADDRESS 0x1780 #define SRC_CLUT_DATA 0x1784 #define SRC_CLUT_DATA_RD 0x1788 #define HOST_DATA0 0x17C0 #define HOST_DATA1 0x17C4 #define HOST_DATA2 0x17C8 #define HOST_DATA3 0x17CC #define HOST_DATA4 0x17D0 #define HOST_DATA5 0x17D4 #define HOST_DATA6 0x17D8 #define HOST_DATA7 0x17DC #define HOST_DATA_LAST 0x17E0 #define DP_SRC_ENDIAN 0x15D4 #define DP_SRC_FRGD_CLR 0x15D8 #define DP_SRC_BKGD_CLR 0x15DC #define DP_WRITE_MASK 0x16cc #define SC_LEFT 0x1640 #define SC_RIGHT 0x1644 #define SC_TOP 0x1648 #define SC_BOTTOM 0x164C #define SRC_SC_RIGHT 0x1654 #define SRC_SC_BOTTOM 0x165C #define DP_CNTL 0x16C0 /* DP_CNTL bit constants */ # define DST_X_RIGHT_TO_LEFT 0x00000000 # define DST_X_LEFT_TO_RIGHT 0x00000001 # define DST_Y_BOTTOM_TO_TOP 0x00000000 # define DST_Y_TOP_TO_BOTTOM 0x00000002 # define DST_X_MAJOR 0x00000000 # define DST_Y_MAJOR 0x00000004 # define DST_X_TILE 0x00000008 # define DST_Y_TILE 0x00000010 # define DST_LAST_PEL 0x00000020 # define DST_TRAIL_X_RIGHT_TO_LEFT 0x00000000 # define DST_TRAIL_X_LEFT_TO_RIGHT 0x00000040 # define DST_TRAP_FILL_RIGHT_TO_LEFT 0x00000000 # define DST_TRAP_FILL_LEFT_TO_RIGHT 0x00000080 # define DST_BRES_SIGN 0x00000100 # define DST_HOST_BIG_ENDIAN_EN 0x00000200 # define DST_POLYLINE_NONLAST 0x00008000 # define DST_RASTER_STALL 0x00010000 # define DST_POLY_EDGE 0x00040000 #define DP_CNTL_XDIR_YDIR_YMAJOR 0x16D0 /* DP_CNTL_XDIR_YDIR_YMAJOR bit constants (short version of DP_CNTL) */ # define DST_X_MAJOR_S 0x00000000 # define DST_Y_MAJOR_S 0x00000001 # define DST_Y_BOTTOM_TO_TOP_S 0x00000000 # define DST_Y_TOP_TO_BOTTOM_S 0x00008000 # define DST_X_RIGHT_TO_LEFT_S 0x00000000 # define DST_X_LEFT_TO_RIGHT_S 0x80000000 #define DP_DATATYPE 0x16C4 /* DP_DATATYPE bit constants */ # define DST_8BPP 0x00000002 # define DST_15BPP 0x00000003 # define DST_16BPP 0x00000004 # define DST_24BPP 0x00000005 # define DST_32BPP 0x00000006 # define DST_8BPP_RGB332 0x00000007 # define DST_8BPP_Y8 0x00000008 # define DST_8BPP_RGB8 0x00000009 # define DST_16BPP_VYUY422 0x0000000b # define DST_16BPP_YVYU422 0x0000000c # define DST_32BPP_AYUV444 0x0000000e # define DST_16BPP_ARGB4444 0x0000000f # define BRUSH_SOLIDCOLOR 0x00000d00 # define SRC_MONO 0x00000000 # define SRC_MONO_LBKGD 0x00010000 # define SRC_DSTCOLOR 0x00030000 # define BYTE_ORDER_MSB_TO_LSB 0x00000000 # define BYTE_ORDER_LSB_TO_MSB 0x40000000 # define DP_CONVERSION_TEMP 0x80000000 # define HOST_BIG_ENDIAN_EN (1 << 29) #define DP_MIX 0x16C8 /* DP_MIX bit constants */ # define DP_SRC_RECT 0x00000200 # define DP_SRC_HOST 0x00000300 # define DP_SRC_HOST_BYTEALIGN 0x00000400 #define DP_WRITE_MSK 0x16CC #define DP_XOP 0x17F8 #define CLR_CMP_CLR_SRC 0x15C4 #define CLR_CMP_CLR_DST 0x15C8 #define CLR_CMP_CNTL 0x15C0 /* CLR_CMP_CNTL bit constants */ # define COMPARE_SRC_FALSE 0x00000000 # define COMPARE_SRC_TRUE 0x00000001 # define COMPARE_SRC_NOT_EQUAL 0x00000004 # define COMPARE_SRC_EQUAL 0x00000005 # define COMPARE_SRC_EQUAL_FLIP 0x00000007 # define COMPARE_DST_FALSE 0x00000000 # define COMPARE_DST_TRUE 0x00000100 # define COMPARE_DST_NOT_EQUAL 0x00000400 # define COMPARE_DST_EQUAL 0x00000500 # define COMPARE_DESTINATION 0x00000000 # define COMPARE_SOURCE 0x01000000 # define COMPARE_SRC_AND_DST 0x02000000 #define CLR_CMP_MSK 0x15CC #define DSTCACHE_MODE 0x1710 #define DSTCACHE_CTLSTAT 0x1714 /* DSTCACHE_CTLSTAT bit constants */ # define RB2D_DC_FLUSH (3 << 0) # define RB2D_DC_FLUSH_ALL 0xf # define RB2D_DC_BUSY (1 << 31) #define DEFAULT_OFFSET 0x16e0 #define DEFAULT_PITCH_OFFSET 0x16E0 #define DEFAULT_SC_BOTTOM_RIGHT 0x16E8 /* DEFAULT_SC_BOTTOM_RIGHT bit constants */ # define DEFAULT_SC_RIGHT_MAX (0x1fff << 0) # define DEFAULT_SC_BOTTOM_MAX (0x1fff << 16) #define DP_GUI_MASTER_CNTL 0x146C /* DP_GUI_MASTER_CNTL bit constants */ # define GMC_SRC_PITCH_OFFSET_DEFAULT 0x00000000 # define GMC_SRC_PITCH_OFFSET_LEAVE 0x00000001 # define GMC_DST_PITCH_OFFSET_DEFAULT 0x00000000 # define GMC_DST_PITCH_OFFSET_LEAVE 0x00000002 # define GMC_SRC_CLIP_DEFAULT 0x00000000 # define GMC_SRC_CLIP_LEAVE 0x00000004 # define GMC_DST_CLIP_DEFAULT 0x00000000 # define GMC_DST_CLIP_LEAVE 0x00000008 # define GMC_BRUSH_8x8MONO 0x00000000 # define GMC_BRUSH_8x8MONO_LBKGD 0x00000010 # define GMC_BRUSH_8x1MONO 0x00000020 # define GMC_BRUSH_8x1MONO_LBKGD 0x00000030 # define GMC_BRUSH_1x8MONO 0x00000040 # define GMC_BRUSH_1x8MONO_LBKGD 0x00000050 # define GMC_BRUSH_32x1MONO 0x00000060 # define GMC_BRUSH_32x1MONO_LBKGD 0x00000070 # define GMC_BRUSH_32x32MONO 0x00000080 # define GMC_BRUSH_32x32MONO_LBKGD 0x00000090 # define GMC_BRUSH_8x8COLOR 0x000000a0 # define GMC_BRUSH_8x1COLOR 0x000000b0 # define GMC_BRUSH_1x8COLOR 0x000000c0 # define GMC_BRUSH_SOLID_COLOR 0x000000d0 # define GMC_DST_8BPP 0x00000200 # define GMC_DST_15BPP 0x00000300 # define GMC_DST_16BPP 0x00000400 # define GMC_DST_24BPP 0x00000500 # define GMC_DST_32BPP 0x00000600 # define GMC_DST_8BPP_RGB332 0x00000700 # define GMC_DST_8BPP_Y8 0x00000800 # define GMC_DST_8BPP_RGB8 0x00000900 # define GMC_DST_16BPP_VYUY422 0x00000b00 # define GMC_DST_16BPP_YVYU422 0x00000c00 # define GMC_DST_32BPP_AYUV444 0x00000e00 # define GMC_DST_16BPP_ARGB4444 0x00000f00 # define GMC_SRC_MONO 0x00000000 # define GMC_SRC_MONO_LBKGD 0x00001000 # define GMC_SRC_DSTCOLOR 0x00003000 # define GMC_BYTE_ORDER_MSB_TO_LSB 0x00000000 # define GMC_BYTE_ORDER_LSB_TO_MSB 0x00004000 # define GMC_DP_CONVERSION_TEMP_9300 0x00008000 # define GMC_DP_CONVERSION_TEMP_6500 0x00000000 # define GMC_DP_SRC_RECT 0x02000000 # define GMC_DP_SRC_HOST 0x03000000 # define GMC_DP_SRC_HOST_BYTEALIGN 0x04000000 # define GMC_3D_FCN_EN_CLR 0x00000000 # define GMC_3D_FCN_EN_SET 0x08000000 # define GMC_DST_CLR_CMP_FCN_LEAVE 0x00000000 # define GMC_DST_CLR_CMP_FCN_CLEAR 0x10000000 # define GMC_AUX_CLIP_LEAVE 0x00000000 # define GMC_AUX_CLIP_CLEAR 0x20000000 # define GMC_WRITE_MASK_LEAVE 0x00000000 # define GMC_WRITE_MASK_SET 0x40000000 # define GMC_CLR_CMP_CNTL_DIS (1 << 28) # define GMC_SRC_DATATYPE_COLOR (3 << 12) # define ROP3_S 0x00cc0000 # define ROP3_SRCCOPY 0x00cc0000 # define ROP3_P 0x00f00000 # define ROP3_PATCOPY 0x00f00000 # define DP_SRC_SOURCE_MASK (7 << 24) # define GMC_BRUSH_NONE (15 << 4) # define DP_SRC_SOURCE_MEMORY (2 << 24) # define GMC_BRUSH_SOLIDCOLOR 0x000000d0 #define SC_TOP_LEFT 0x16EC #define SC_BOTTOM_RIGHT 0x16F0 #define SRC_SC_BOTTOM_RIGHT 0x16F4 #define RB2D_DSTCACHE_CTLSTAT 0x342C #define RB2D_DSTCACHE_MODE 0x3428 #define BASE_CODE 0x0f0b/*0x0f08*/ #define RADEON_BIOS_0_SCRATCH 0x0010 #define RADEON_BIOS_1_SCRATCH 0x0014 #define RADEON_BIOS_2_SCRATCH 0x0018 #define RADEON_BIOS_3_SCRATCH 0x001c #define RADEON_BIOS_4_SCRATCH 0x0020 #define RADEON_BIOS_5_SCRATCH 0x0024 #define RADEON_BIOS_6_SCRATCH 0x0028 #define RADEON_BIOS_7_SCRATCH 0x002c #define CLK_PIN_CNTL 0x0001 #define PPLL_CNTL 0x0002 # define PPLL_RESET (1 << 0) # define PPLL_SLEEP (1 << 1) # define PPLL_ATOMIC_UPDATE_EN (1 << 16) # define PPLL_VGA_ATOMIC_UPDATE_EN (1 << 17) # define PPLL_ATOMIC_UPDATE_VSYNC (1 << 18) #define PPLL_REF_DIV 0x0003 # define PPLL_REF_DIV_MASK 0x03ff # define PPLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */ # define PPLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */ #define PPLL_DIV_0 0x0004 #define PPLL_DIV_1 0x0005 #define PPLL_DIV_2 0x0006 #define PPLL_DIV_3 0x0007 #define VCLK_ECP_CNTL 0x0008 # define VCLK_SRC_SEL_MASK 0x03 # define VCLK_SRC_SEL_CPUCLK 0x00 # define VCLK_SRC_SEL_PSCANCLK 0x01 # define VCLK_SRC_SEL_BYTECLK 0x02 # define VCLK_SRC_SEL_PPLLCLK 0x03 #define HTOTAL_CNTL 0x0009 #define HTOTAL2_CNTL 0x002e /* PLL */ #define M_SPLL_REF_FB_DIV 0x000a #define AGP_PLL_CNTL 0x000b #define SPLL_CNTL 0x000c #define SCLK_CNTL 0x000d # define DYN_STOP_LAT_MASK 0x00007ff8 # define CP_MAX_DYN_STOP_LAT 0x0008 # define SCLK_FORCEON_MASK 0xffff8000 #define SCLK_MORE_CNTL 0x0035 /* PLL */ # define SCLK_MORE_FORCEON 0x0700 #define MPLL_CNTL 0x000e #ifdef RAGE128 #define MCLK_CNTL 0x000f /* PLL */ # define FORCE_GCP (1 << 16) # define FORCE_PIPE3D_CP (1 << 17) # define FORCE_RCP (1 << 18) #else #define MCLK_CNTL 0x0012 /* MCLK_CNTL bit constants */ # define FORCEON_MCLKA (1 << 16) # define FORCEON_MCLKB (1 << 17) # define FORCEON_YCLKA (1 << 18) # define FORCEON_YCLKB (1 << 19) # define FORCEON_MC (1 << 20) # define FORCEON_AIC (1 << 21) #endif #define PLL_TEST_CNTL 0x0013 #define P2PLL_CNTL 0x002a /* P2PLL */ # define P2PLL_RESET (1 << 0) # define P2PLL_SLEEP (1 << 1) # define P2PLL_ATOMIC_UPDATE_EN (1 << 16) # define P2PLL_VGA_ATOMIC_UPDATE_EN (1 << 17) # define P2PLL_ATOMIC_UPDATE_VSYNC (1 << 18) #define P2PLL_DIV_0 0x002c # define P2PLL_FB0_DIV_MASK 0x07ff # define P2PLL_POST0_DIV_MASK 0x00070000 #define P2PLL_REF_DIV 0x002B /* PLL */ # define P2PLL_REF_DIV_MASK 0x03ff # define P2PLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */ # define P2PLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */ #define PIXCLKS_CNTL 0x002d # define PIX2CLK_SRC_SEL_MASK 0x03 # define PIX2CLK_SRC_SEL_CPUCLK 0x00 # define PIX2CLK_SRC_SEL_PSCANCLK 0x01 # define PIX2CLK_SRC_SEL_BYTECLK 0x02 # define PIX2CLK_SRC_SEL_P2PLLCLK 0x03 /* masks */ #define CONFIG_MEMSIZE_MASK 0x1f000000 #define MEM_CFG_TYPE 0x40000000 #define DST_OFFSET_MASK 0x003fffff #define DST_PITCH_MASK 0x3fc00000 #define DEFAULT_TILE_MASK 0xc0000000 #define PPLL_DIV_SEL_MASK 0x00000300 #define PPLL_FB3_DIV_MASK 0x000007ff #define PPLL_POST3_DIV_MASK 0x00070000 /* BUS MASTERING */ #ifdef RAGE128 #define BM_FRAME_BUF_OFFSET 0xA00 #define BM_SYSTEM_MEM_ADDR 0xA04 #define BM_COMMAND 0xA08 # define BM_INTERRUPT_DIS 0x08000000 # define BM_TRANSFER_DEST_REG 0x10000000 # define BM_FORCE_TO_PCI 0x20000000 # define BM_FRAME_OFFSET_HOLD 0x40000000 # define BM_END_OF_LIST 0x80000000 #define BM_STATUS 0xA0c #define BM_QUEUE_STATUS 0xA10 #define BM_QUEUE_FREE_STATUS 0xA14 #define BM_CHUNK_0_VAL 0xA18 # define BM_PTR_FORCE_TO_PCI 0x00200000 # define BM_PM4_RD_FORCE_TO_PCI 0x00400000 # define BM_GLOBAL_FORCE_TO_PCI 0x00800000 # define BM_VIP3_NOCHUNK 0x10000000 # define BM_VIP2_NOCHUNK 0x20000000 # define BM_VIP1_NOCHUNK 0x40000000 # define BM_VIP0_NOCHUNK 0x80000000 #define BM_CHUNK_1_VAL 0xA1C #define BM_VIP0_BUF 0xA20 # define SYSTEM_TRIGGER_SYSTEM_TO_VIDEO 0x0 # define SYSTEM_TRIGGER_VIDEO_TO_SYSTEM 0x1 #define BM_VIP0_ACTIVE 0xA24 #define BM_VIP1_BUF 0xA30 #define BM_VIP1_ACTIVE 0xA34 #define BM_VIP2_BUF 0xA40 #define BM_VIP2_ACTIVE 0xA44 #define BM_VIP3_BUF 0xA50 #define BM_VIP3_ACTIVE 0xA54 #define BM_VIDCAP_BUF0 0xA60 #define BM_VIDCAP_BUF1 0xA64 #define BM_VIDCAP_BUF2 0xA68 #define BM_VIDCAP_ACTIVE 0xA6c #define BM_GUI 0xA80 #define BM_ABORT 0xA88 #endif /* RAGE THEATER REGISTERS */ #define DMA_VIPH0_COMMAND 0x0A00 #define DMA_VIPH1_COMMAND 0x0A04 #define DMA_VIPH2_COMMAND 0x0A08 #define DMA_VIPH3_COMMAND 0x0A0C #define DMA_VIPH_STATUS 0x0A10 #define DMA_VIPH_CHUNK_0 0x0A18 #define DMA_VIPH_CHUNK_1_VAL 0x0A1C #define DMA_VIP0_TABLE_ADDR 0x0A20 #define DMA_VIPH0_ACTIVE 0x0A24 #define DMA_VIP1_TABLE_ADDR 0x0A30 #define DMA_VIPH1_ACTIVE 0x0A34 #define DMA_VIP2_TABLE_ADDR 0x0A40 #define DMA_VIPH2_ACTIVE 0x0A44 #define DMA_VIP3_TABLE_ADDR 0x0A50 #define DMA_VIPH3_ACTIVE 0x0A54 #define DMA_VIPH_ABORT 0x0A88 #define VIPH_CH0_DATA 0x0c00 #define VIPH_CH1_DATA 0x0c04 #define VIPH_CH2_DATA 0x0c08 #define VIPH_CH3_DATA 0x0c0c #define VIPH_CH0_ADDR 0x0c10 #define VIPH_CH1_ADDR 0x0c14 #define VIPH_CH2_ADDR 0x0c18 #define VIPH_CH3_ADDR 0x0c1c #define VIPH_CH0_SBCNT 0x0c20 #define VIPH_CH1_SBCNT 0x0c24 #define VIPH_CH2_SBCNT 0x0c28 #define VIPH_CH3_SBCNT 0x0c2c #define VIPH_CH0_ABCNT 0x0c30 #define VIPH_CH1_ABCNT 0x0c34 #define VIPH_CH2_ABCNT 0x0c38 #define VIPH_CH3_ABCNT 0x0c3c #define VIPH_CONTROL 0x0c40 #define VIPH_DV_LAT 0x0c44 #define VIPH_BM_CHUNK 0x0c48 #define VIPH_DV_INT 0x0c4c #define VIPH_TIMEOUT_STAT 0x0c50 #define VIPH_REG_DATA 0x0084 #define VIPH_REG_ADDR 0x0080 /* Address Space Rage Theatre Registers (VIP Access) */ #define VIP_VIP_VENDOR_DEVICE_ID 0x0000 #define VIP_VIP_SUB_VENDOR_DEVICE_ID 0x0004 #define VIP_VIP_COMMAND_STATUS 0x0008 #define VIP_VIP_REVISION_ID 0x000c #define VIP_HW_DEBUG 0x0010 #define VIP_SW_SCRATCH 0x0014 #define VIP_I2C_CNTL_0 0x0020 #define VIP_I2C_CNTL_1 0x0024 #define VIP_I2C_DATA 0x0028 #define VIP_INT_CNTL 0x002c #define VIP_GPIO_INOUT 0x0030 #define VIP_GPIO_CNTL 0x0034 #define VIP_CLKOUT_GPIO_CNTL 0x0038 #define VIP_RIPINTF_PORT_CNTL 0x003c #define VIP_ADC_CNTL 0x0400 #define VIP_ADC_DEBUG 0x0404 #define VIP_STANDARD_SELECT 0x0408 #define VIP_THERMO2BIN_STATUS 0x040c #define VIP_COMB_CNTL0 0x0440 #define VIP_COMB_CNTL1 0x0444 #define VIP_COMB_CNTL2 0x0448 #define VIP_COMB_LINE_LENGTH 0x044c #define VIP_NOISE_CNTL0 0x0450 #define VIP_HS_PLINE 0x0480 #define VIP_HS_DTOINC 0x0484 #define VIP_HS_PLLGAIN 0x0488 #define VIP_HS_MINMAXWIDTH 0x048c #define VIP_HS_GENLOCKDELAY 0x0490 #define VIP_HS_WINDOW_LIMIT 0x0494 #define VIP_HS_WINDOW_OC_SPEED 0x0498 #define VIP_HS_PULSE_WIDTH 0x049c #define VIP_HS_PLL_ERROR 0x04a0 #define VIP_HS_PLL_FS_PATH 0x04a4 #define VIP_SG_BLACK_GATE 0x04c0 #define VIP_SG_SYNCTIP_GATE 0x04c4 #define VIP_SG_UVGATE_GATE 0x04c8 #define VIP_LP_AGC_CLAMP_CNTL0 0x0500 #define VIP_LP_AGC_CLAMP_CNTL1 0x0504 #define VIP_LP_BRIGHTNESS 0x0508 #define VIP_LP_CONTRAST 0x050c #define VIP_LP_SLICE_LIMIT 0x0510 #define VIP_LP_WPA_CNTL0 0x0514 #define VIP_LP_WPA_CNTL1 0x0518 #define VIP_LP_BLACK_LEVEL 0x051c #define VIP_LP_SLICE_LEVEL 0x0520 #define VIP_LP_SYNCTIP_LEVEL 0x0524 #define VIP_LP_VERT_LOCKOUT 0x0528 #define VIP_VS_DETECTOR_CNTL 0x0540 #define VIP_VS_BLANKING_CNTL 0x0544 #define VIP_VS_FIELD_ID_CNTL 0x0548 #define VIP_VS_COUNTER_CNTL 0x054c #define VIP_VS_FRAME_TOTAL 0x0550 #define VIP_VS_LINE_COUNT 0x0554 #define VIP_CP_PLL_CNTL0 0x0580 #define VIP_CP_PLL_CNTL1 0x0584 #define VIP_CP_HUE_CNTL 0x0588 #define VIP_CP_BURST_GAIN 0x058c #define VIP_CP_AGC_CNTL 0x0590 #define VIP_CP_ACTIVE_GAIN 0x0594 #define VIP_CP_PLL_STATUS0 0x0598 #define VIP_CP_PLL_STATUS1 0x059c #define VIP_CP_PLL_STATUS2 0x05a0 #define VIP_CP_PLL_STATUS3 0x05a4 #define VIP_CP_PLL_STATUS4 0x05a8 #define VIP_CP_PLL_STATUS5 0x05ac #define VIP_CP_PLL_STATUS6 0x05b0 #define VIP_CP_PLL_STATUS7 0x05b4 #define VIP_CP_DEBUG_FORCE 0x05b8 #define VIP_CP_VERT_LOCKOUT 0x05bc #define VIP_H_ACTIVE_WINDOW 0x05c0 #define VIP_V_ACTIVE_WINDOW 0x05c4 #define VIP_H_VBI_WINDOW 0x05c8 #define VIP_V_VBI_WINDOW 0x05cc #define VIP_VBI_CONTROL 0x05d0 #define VIP_DECODER_DEBUG_CNTL 0x05d4 #define VIP_SINGLE_STEP_DATA 0x05d8 #define VIP_MASTER_CNTL 0x0040 #define VIP_RGB_CNTL 0x0048 #define VIP_CLKOUT_CNTL 0x004c #define VIP_SYNC_CNTL 0x0050 #define VIP_I2C_CNTL 0x0054 #define VIP_HTOTAL 0x0080 #define VIP_HDISP 0x0084 #define VIP_HSIZE 0x0088 #define VIP_HSTART 0x008c #define VIP_HCOUNT 0x0090 #define VIP_VTOTAL 0x0094 #define VIP_VDISP 0x0098 #define VIP_VCOUNT 0x009c #define VIP_VFTOTAL 0x00a0 #define VIP_DFCOUNT 0x00a4 #define VIP_DFRESTART 0x00a8 #define VIP_DHRESTART 0x00ac #define VIP_DVRESTART 0x00b0 #define VIP_SYNC_SIZE 0x00b4 #define VIP_TV_PLL_FINE_CNTL 0x00b8 #define VIP_CRT_PLL_FINE_CNTL 0x00bc #define VIP_TV_PLL_CNTL 0x00c0 #define VIP_CRT_PLL_CNTL 0x00c4 #define VIP_PLL_CNTL0 0x00c8 #define VIP_PLL_TEST_CNTL 0x00cc #define VIP_CLOCK_SEL_CNTL 0x00d0 #define VIP_VIN_PLL_CNTL 0x00d4 #define VIP_VIN_PLL_FINE_CNTL 0x00d8 #define VIP_AUD_PLL_CNTL 0x00e0 #define VIP_AUD_PLL_FINE_CNTL 0x00e4 #define VIP_AUD_CLK_DIVIDERS 0x00e8 #define VIP_AUD_DTO_INCREMENTS 0x00ec #define VIP_L54_PLL_CNTL 0x00f0 #define VIP_L54_PLL_FINE_CNTL 0x00f4 #define VIP_L54_DTO_INCREMENTS 0x00f8 #define VIP_PLL_CNTL1 0x00fc #define VIP_FRAME_LOCK_CNTL 0x0100 #define VIP_SYNC_LOCK_CNTL 0x0104 #define VIP_TVO_SYNC_PAT_ACCUM 0x0108 #define VIP_TVO_SYNC_THRESHOLD 0x010c #define VIP_TVO_SYNC_PAT_EXPECT 0x0110 #define VIP_DELAY_ONE_MAP_A 0x0114 #define VIP_DELAY_ONE_MAP_B 0x0118 #define VIP_DELAY_ZERO_MAP_A 0x011c #define VIP_DELAY_ZERO_MAP_B 0x0120 #define VIP_TVO_DATA_DELAY_A 0x0140 #define VIP_TVO_DATA_DELAY_B 0x0144 #define VIP_HOST_READ_DATA 0x0180 #define VIP_HOST_WRITE_DATA 0x0184 #define VIP_HOST_RD_WT_CNTL 0x0188 #define VIP_VSCALER_CNTL1 0x01c0 #define VIP_TIMING_CNTL 0x01c4 #define VIP_VSCALER_CNTL2 0x01c8 #define VIP_Y_FALL_CNTL 0x01cc #define VIP_Y_RISE_CNTL 0x01d0 #define VIP_Y_SAW_TOOTH_CNTL 0x01d4 #define VIP_UPSAMP_AND_GAIN_CNTL 0x01e0 #define VIP_GAIN_LIMIT_SETTINGS 0x01e4 #define VIP_LINEAR_GAIN_SETTINGS 0x01e8 #define VIP_MODULATOR_CNTL1 0x0200 #define VIP_MODULATOR_CNTL2 0x0204 #define VIP_MV_MODE_CNTL 0x0208 #define VIP_MV_STRIPE_CNTL 0x020c #define VIP_MV_LEVEL_CNTL1 0x0210 #define VIP_MV_LEVEL_CNTL2 0x0214 #define VIP_PRE_DAC_MUX_CNTL 0x0240 #define VIP_TV_DAC_CNTL 0x0280 #define VIP_CRC_CNTL 0x02c0 #define VIP_VIDEO_PORT_SIG 0x02c4 #define VIP_VBI_CC_CNTL 0x02c8 #define VIP_VBI_EDS_CNTL 0x02cc #define VIP_VBI_20BIT_CNTL 0x02d0 #define VIP_VBI_DTO_CNTL 0x02d4 #define VIP_VBI_LEVEL_CNTL 0x02d8 #define VIP_UV_ADR 0x0300 #define VIP_MV_STATUS 0x0330 #define VIP_UPSAMP_COEFF0_0 0x0340 #define VIP_UPSAMP_COEFF0_1 0x0344 #define VIP_UPSAMP_COEFF0_2 0x0348 #define VIP_UPSAMP_COEFF1_0 0x034c #define VIP_UPSAMP_COEFF1_1 0x0350 #define VIP_UPSAMP_COEFF1_2 0x0354 #define VIP_UPSAMP_COEFF2_0 0x0358 #define VIP_UPSAMP_COEFF2_1 0x035c #define VIP_UPSAMP_COEFF2_2 0x0360 #define VIP_UPSAMP_COEFF3_0 0x0364 #define VIP_UPSAMP_COEFF3_1 0x0368 #define VIP_UPSAMP_COEFF3_2 0x036c #define VIP_UPSAMP_COEFF4_0 0x0370 #define VIP_UPSAMP_COEFF4_1 0x0374 #define VIP_UPSAMP_COEFF4_2 0x0378 #define VIP_TV_DTO_INCREMENTS 0x0390 #define VIP_CRT_DTO_INCREMENTS 0x0394 #define VIP_VSYNC_DIFF_CNTL 0x03a0 #define VIP_VSYNC_DIFF_LIMITS 0x03a4 #define VIP_VSYNC_DIFF_RD_DATA 0x03a8 #define VIP_SCALER_IN_WINDOW 0x0618 #define VIP_SCALER_OUT_WINDOW 0x061c #define VIP_H_SCALER_CONTROL 0x0600 #define VIP_V_SCALER_CONTROL 0x0604 #define VIP_V_DEINTERLACE_CONTROL 0x0608 #define VIP_VBI_SCALER_CONTROL 0x060c #define VIP_DVS_PORT_CTRL 0x0610 #define VIP_DVS_PORT_READBACK 0x0614 #define VIP_FIFOA_CONFIG 0x0800 #define VIP_FIFOB_CONFIG 0x0804 #define VIP_FIFOC_CONFIG 0x0808 #define VIP_SPDIF_PORT_CNTL 0x080c #define VIP_SPDIF_CHANNEL_STAT 0x0810 #define VIP_SPDIF_AC3_PREAMBLE 0x0814 #define VIP_I2S_TRANSMIT_CNTL 0x0818 #define VIP_I2S_RECEIVE_CNTL 0x081c #define VIP_SPDIF_TX_CNT_REG 0x0820 #define VIP_IIS_TX_CNT_REG 0x0824 /* Status defines */ #define VIP_BUSY 0 #define VIP_IDLE 1 #define VIP_RESET 2 #define VIPH_TIMEOUT_STAT__VIPH_REG_STAT 0x00000010 #define VIPH_TIMEOUT_STAT__VIPH_REG_AK 0x00000010 #define VIPH_TIMEOUT_STAT__VIPH_REGR_DIS 0x01000000 #define TEST_DEBUG_CNTL__TEST_DEBUG_OUT_EN 0x00000001 #define RT_ATI_ID 0x4D541002 /* Register/Field values: */ #define RT_COMP0 0x0 #define RT_COMP1 0x1 #define RT_COMP2 0x2 #define RT_YF_COMP3 0x3 #define RT_YR_COMP3 0x4 #define RT_YCF_COMP4 0x5 #define RT_YCR_COMP4 0x6 /* Video standard defines */ #define RT_NTSC 0x0 #define RT_PAL 0x1 #define RT_SECAM 0x2 #define extNONE 0x0000 #define extNTSC 0x0100 #define extRsvd 0x0200 #define extPAL 0x0300 #define extPAL_M 0x0400 #define extPAL_N 0x0500 #define extSECAM 0x0600 #define extPAL_NCOMB 0x0700 #define extNTSC_J 0x0800 #define extNTSC_443 0x0900 #define extPAL_BGHI 0x0A00 #define extPAL_60 0x0B00 /* these are used in MSP3430 */ #define extPAL_DK1 0x0C00 #define extPAL_AUTO 0x0D00 #define RT_FREF_2700 6 #define RT_FREF_2950 5 #define RT_COMPOSITE 0x0 #define RT_SVIDEO 0x1 #define RT_NORM_SHARPNESS 0x03 #define RT_HIGH_SHARPNESS 0x0F #define RT_HUE_PAL_DEF 0x00 #define RT_DECINTERLACED 0x1 #define RT_DECNONINTERLACED 0x0 #define NTSC_LINES 525 #define PAL_SECAM_LINES 625 #define RT_ASYNC_ENABLE 0x0 #define RT_ASYNC_DISABLE 0x1 #define RT_ASYNC_RESET 0x1 #define RT_VINRST_ACTIVE 0x0 #define RT_VINRST_RESET 0x1 #define RT_L54RST_RESET 0x1 #define RT_REF_CLK 0x0 #define RT_PLL_VIN_CLK 0x1 #define RT_VIN_ASYNC_RST 0x20 #define RT_DVS_ASYNC_RST 0x80 #define RT_ADC_ENABLE 0x0 #define RT_ADC_DISABLE 0x1 #define RT_DVSDIR_IN 0x0 #define RT_DVSDIR_OUT 0x1 #define RT_DVSCLK_HIGH 0x0 #define RT_DVSCLK_LOW 0x1 #define RT_DVSCLK_SEL_8FS 0x0 #define RT_DVSCLK_SEL_27MHZ 0x1 #define RT_DVS_CONTSTREAM 0x1 #define RT_DVS_NONCONTSTREAM 0x0 #define RT_DVSDAT_HIGH 0x0 #define RT_DVSDAT_LOW 0x1 #define RT_ADC_CNTL_DEFAULT 0x03252338 /* COMB_CNTL0 FILTER SETTINGS FOR DIFFERENT STANDARDS: */ #define RT_NTSCM_COMB_CNTL0_COMPOSITE 0x09438090 #define RT_NTSCM_COMB_CNTL0_SVIDEO 0x48540000 #define RT_PAL_COMB_CNTL0_COMPOSITE 0x09438090 #define RT_PAL_COMB_CNTL0_SVIDEO 0x40348090 #define RT_SECAM_COMB_CNTL0_COMPOSITE 0xD0108090 /* instead of orig 0xD0088090 - eric*/ #define RT_SECAM_COMB_CNTL0_SVIDEO 0x50148090 #define RT_PALN_COMB_CNTL0_COMPOSITE 0x09438090 #define RT_PALN_COMB_CNTL0_SVIDEO 0x40348090 #define RT_PALM_COMB_CNTL0_COMPOSITE 0x09438090 #define RT_PALM_COMB_CNTL0_SVIDEO 0x40348090 /* End of filter settings. */ /* COMB_CNTL1 FILTER SETTINGS FOR DIFFERENT STANDARDS: */ #define RT_NTSCM_COMB_CNTL1_COMPOSITE 0x00000010 #define RT_NTSCM_COMB_CNTL1_SVIDEO 0x00000081 #define RT_PAL_COMB_CNTL1_COMPOSITE 0x00000010 #define RT_PAL_COMB_CNTL1_SVIDEO 0x000000A1 #define RT_SECAM_COMB_CNTL1_COMPOSITE 0x00000091 #define RT_SECAM_COMB_CNTL1_SVIDEO 0x00000081 #define RT_PALN_COMB_CNTL1_COMPOSITE 0x00000010 #define RT_PALN_COMB_CNTL1_SVIDEO 0x000000A1 #define RT_PALM_COMB_CNTL1_COMPOSITE 0x00000010 #define RT_PALM_COMB_CNTL1_SVIDEO 0x000000A1 /* End of filter settings. */ /* COMB_CNTL2 FILTER SETTINGS FOR DIFFERENT STANDARDS: */ #define RT_NTSCM_COMB_CNTL2_COMPOSITE 0x16161010 #define RT_NTSCM_COMB_CNTL2_SVIDEO 0xFFFFFFFF #define RT_PAL_COMB_CNTL2_COMPOSITE 0x06080102 /* instead of 0x16161010 - Ivo */ #define RT_PAL_COMB_CNTL2_SVIDEO 0x06080102 #define RT_SECAM_COMB_CNTL2_COMPOSITE 0xffffffff /* instead of 0x06080102 - eric */ #define RT_SECAM_COMB_CNTL2_SVIDEO 0x06080102 #define RT_PALN_COMB_CNTL2_COMPOSITE 0x06080102 #define RT_PALN_COMB_CNTL2_SVIDEO 0x06080102 #define RT_PALM_COMB_CNTL2_COMPOSITE 0x06080102 #define RT_PALM_COMB_CNTL2_SVIDEO 0x06080102 /* End of filter settings. */ /* COMB_LINE_LENGTH FILTER SETTINGS FOR DIFFERENT STANDARDS: */ #define RT_NTSCM_COMB_LENGTH_COMPOSITE 0x0718038A #define RT_NTSCM_COMB_LENGTH_SVIDEO 0x0718038A #define RT_PAL_COMB_LENGTH_COMPOSITE 0x08DA046B #define RT_PAL_COMB_LENGTH_SVIDEO 0x08DA046B #define RT_SECAM_COMB_LENGTH_COMPOSITE 0x08DA046A #define RT_SECAM_COMB_LENGTH_SVIDEO 0x08DA046A #define RT_PALN_COMB_LENGTH_COMPOSITE 0x07260391 #define RT_PALN_COMB_LENGTH_SVIDEO 0x07260391 #define RT_PALM_COMB_LENGTH_COMPOSITE 0x07160389 #define RT_PALM_COMB_LENGTH_SVIDEO 0x07160389 /* End of filter settings. */ /* LP_AGC_CLAMP_CNTL0 */ #define RT_NTSCM_SYNCTIP_REF0 0x00000037 #define RT_NTSCM_SYNCTIP_REF1 0x00000029 #define RT_NTSCM_CLAMP_REF 0x0000003B #define RT_NTSCM_PEAKWHITE 0x000000FF #define RT_NTSCM_VBI_PEAKWHITE 0x000000C2 #define RT_NTSCM_WPA_THRESHOLD 0x00000406 #define RT_NTSCM_WPA_TRIGGER_LO 0x000000B3 #define RT_NTSCM_WPA_TRIGGER_HIGH 0x0000021B #define RT_NTSCM_LP_LOCKOUT_START 0x00000206 #define RT_NTSCM_LP_LOCKOUT_END 0x00000021 #define RT_NTSCM_CH_DTO_INC 0x00400000 #define RT_NTSCM_CH_PLL_SGAIN 0x00000001 #define RT_NTSCM_CH_PLL_FGAIN 0x00000002 #define RT_NTSCM_CR_BURST_GAIN 0x0000007A #define RT_NTSCM_CB_BURST_GAIN 0x000000AC #define RT_NTSCM_CH_HEIGHT 0x000000CD #define RT_NTSCM_CH_KILL_LEVEL 0x000000C0 #define RT_NTSCM_CH_AGC_ERROR_LIM 0x00000002 #define RT_NTSCM_CH_AGC_FILTER_EN 0x00000000 #define RT_NTSCM_CH_AGC_LOOP_SPEED 0x00000000 #define RT_NTSCM_CRDR_ACTIVE_GAIN 0x0000007A #define RT_NTSCM_CBDB_ACTIVE_GAIN 0x000000AC #define RT_NTSCM_VERT_LOCKOUT_START 0x00000207 #define RT_NTSCM_VERT_LOCKOUT_END 0x0000000E #define RT_NTSCJ_SYNCTIP_REF0 0x00000004 #define RT_NTSCJ_SYNCTIP_REF1 0x00000012 #define RT_NTSCJ_CLAMP_REF 0x0000003B #define RT_NTSCJ_PEAKWHITE 0x000000CB #define RT_NTSCJ_VBI_PEAKWHITE 0x000000C2 #define RT_NTSCJ_WPA_THRESHOLD 0x000004B0 #define RT_NTSCJ_WPA_TRIGGER_LO 0x000000B4 #define RT_NTSCJ_WPA_TRIGGER_HIGH 0x0000021C #define RT_NTSCJ_LP_LOCKOUT_START 0x00000206 #define RT_NTSCJ_LP_LOCKOUT_END 0x00000021 #define RT_NTSCJ_CR_BURST_GAIN 0x00000071 #define RT_NTSCJ_CB_BURST_GAIN 0x0000009F #define RT_NTSCJ_CH_HEIGHT 0x000000CD #define RT_NTSCJ_CH_KILL_LEVEL 0x000000C0 #define RT_NTSCJ_CH_AGC_ERROR_LIM 0x00000002 #define RT_NTSCJ_CH_AGC_FILTER_EN 0x00000000 #define RT_NTSCJ_CH_AGC_LOOP_SPEED 0x00000000 #define RT_NTSCJ_CRDR_ACTIVE_GAIN 0x00000071 #define RT_NTSCJ_CBDB_ACTIVE_GAIN 0x0000009F #define RT_NTSCJ_VERT_LOCKOUT_START 0x00000207 #define RT_NTSCJ_VERT_LOCKOUT_END 0x0000000E #define RT_PAL_SYNCTIP_REF0 0x37 /* instead of 0x00000004 - Ivo */ #define RT_PAL_SYNCTIP_REF1 0x26 /* instead of 0x0000000F - Ivo */ #define RT_PAL_CLAMP_REF 0x0000003B #define RT_PAL_PEAKWHITE 0xFF /* instead of 0x000000C1 - Ivo */ #define RT_PAL_VBI_PEAKWHITE 0xC6 /* instead of 0x000000C7 - Ivo */ #define RT_PAL_WPA_THRESHOLD 0x59C /* instead of 0x000006A4 - Ivo */ #define RT_PAL_WPA_TRIGGER_LO 0x00000096 #define RT_PAL_WPA_TRIGGER_HIGH 0x000001C2 #define RT_PAL_LP_LOCKOUT_START 0x00000263 #define RT_PAL_LP_LOCKOUT_END 0x0000002C #define RT_PAL_CH_DTO_INC 0x00400000 #define RT_PAL_CH_PLL_SGAIN 1 /* instead of 0x00000002 - Ivo */ #define RT_PAL_CH_PLL_FGAIN 2 /* instead of 0x00000001 - Ivo */ #define RT_PAL_CR_BURST_GAIN 0x0000007A #define RT_PAL_CB_BURST_GAIN 0x000000AB #define RT_PAL_CH_HEIGHT 0x0000009C #define RT_PAL_CH_KILL_LEVEL 4 /* instead of 0x00000090 - Ivo */ #define RT_PAL_CH_AGC_ERROR_LIM 1 /* instead of 0x00000002 - Ivo */ #define RT_PAL_CH_AGC_FILTER_EN 1 /* instead of 0x00000000 - Ivo */ #define RT_PAL_CH_AGC_LOOP_SPEED 0x00000000 #define RT_PAL_CRDR_ACTIVE_GAIN 0x9E /* instead of 0x0000007A - Ivo */ #define RT_PAL_CBDB_ACTIVE_GAIN 0xDF /* instead of 0x000000AB - Ivo */ #define RT_PAL_VERT_LOCKOUT_START 0x00000269 #define RT_PAL_VERT_LOCKOUT_END 0x00000012 #define RT_SECAM_SYNCTIP_REF0 0x37 /* instead of 0x00000004 - Ivo */ #define RT_SECAM_SYNCTIP_REF1 0x26 /* instead of 0x0000000F - Ivo */ #define RT_SECAM_CLAMP_REF 0x0000003B #define RT_SECAM_PEAKWHITE 0xFF /* instead of 0x000000C1 - Ivo */ #define RT_SECAM_VBI_PEAKWHITE 0xC6 /* instead of 0x000000C7 - Ivo */ #define RT_SECAM_WPA_THRESHOLD 0x57A /* instead of 0x6A4, instead of 0x0000059C is Ivo's value , -eric*/ #define RT_SECAM_WPA_TRIGGER_LO 0x96 /* instead of 0x0000026B - eric */ #define RT_SECAM_WPA_TRIGGER_HIGH 0x000001C2 #define RT_SECAM_LP_LOCKOUT_START 0x263 /* instead of 0x0000026B - eric */ #define RT_SECAM_LP_LOCKOUT_END 0x2b /* instead of 0x0000002C -eric */ #define RT_SECAM_CH_DTO_INC 0x003E7A28 #define RT_SECAM_CH_PLL_SGAIN 0x4 /* instead of 0x00000006 -Volodya */ #define RT_SECAM_CH_PLL_FGAIN 0x7 /* instead of 0x00000006 -Volodya */ #define RT_SECAM_CR_BURST_GAIN 0x1FF /* instead of 0x00000200 -Volodya */ #define RT_SECAM_CB_BURST_GAIN 0x1FF /* instead of 0x00000200 -Volodya */ #define RT_SECAM_CH_HEIGHT 0x00000066 #define RT_SECAM_CH_KILL_LEVEL 0x00000060 #define RT_SECAM_CH_AGC_ERROR_LIM 0x00000003 #define RT_SECAM_CH_AGC_FILTER_EN 0x00000000 #define RT_SECAM_CH_AGC_LOOP_SPEED 0x00000000 #define RT_SECAM_CRDR_ACTIVE_GAIN 0x11B /* instead of 0x00000200 - eric */ #define RT_SECAM_CBDB_ACTIVE_GAIN 0x15A /* instead of 0x00000200 - eric */ #define RT_SECAM_VERT_LOCKOUT_START 0x00000269 #define RT_SECAM_VERT_LOCKOUT_END 0x00000012 #define RT_PAL_VS_FIELD_BLANK_END 0x2A /* instead of 0x0000002C - Ivo*/ #define RT_NTSCM_VS_FIELD_BLANK_END 0x0000000A #define RT_NTSCM_FIELD_IDLOCATION 0x00000105 #define RT_PAL_FIELD_IDLOCATION 0x00000137 #define RT_NTSCM_H_ACTIVE_START 0x00000070 #define RT_NTSCM_H_ACTIVE_END 0x00000363 #define RT_PAL_H_ACTIVE_START 0x0000009A #define RT_PAL_H_ACTIVE_END 0x00000439 #define RT_NTSCM_V_ACTIVE_START ((22-4)*2+1) #define RT_NTSCM_V_ACTIVE_END ((22+240-4)*2+1) #define RT_PAL_V_ACTIVE_START 0x2E /* instead of 0x00000023 (Same as SECAM) - Ivo */ #define RT_PAL_V_ACTIVE_END 0x269 /* instead of 0x00000262 - Ivo */ /* VBI */ #define RT_NTSCM_H_VBI_WIND_START 0x00000049 #define RT_NTSCM_H_VBI_WIND_END 0x00000366 #define RT_PAL_H_VBI_WIND_START 0x00000084 #define RT_PAL_H_VBI_WIND_END 0x0000041F #define RT_NTSCM_V_VBI_WIND_START fld_V_VBI_WIND_START_def #define RT_NTSCM_V_VBI_WIND_END fld_V_VBI_WIND_END_def #define RT_PAL_V_VBI_WIND_START 0x8 /* instead of 0x0000000B - Ivo */ #define RT_PAL_V_VBI_WIND_END 0x2D /* instead of 0x00000022 - Ivo */ #define RT_VBI_CAPTURE_EN 0x00000001 /* Enable */ #define RT_VBI_CAPTURE_DIS 0x00000000 /* Disable */ #define RT_RAW_CAPTURE 0x00000002 /* Use raw Video Capture. */ #define RT_NTSCM_VSYNC_INT_TRIGGER 0x2AA #define RT_PALSEM_VSYNC_INT_TRIGGER 0x353 #define RT_NTSCM_VSYNC_INT_HOLD 0x17 #define RT_PALSEM_VSYNC_INT_HOLD 0x1C #define RT_NTSCM_VS_FIELD_BLANK_START 0x206 #define RT_PALSEM_VS_FIELD_BLANK_START 0x26D /* instead of 0x26C - Ivo */ #define RT_FIELD_FLIP_EN 0x4 #define RT_V_FIELD_FLIP_INVERTED 0x2000 #define RT_NTSCM_H_IN_START 0x70 #define RT_PAL_H_IN_START 154 /* instead of 144 - Ivo */ #define RT_SECAM_H_IN_START 0x91 /* instead of 0x9A, Ivo value is 154, instead of 144 - Volodya, - eric */ #define RT_NTSC_H_ACTIVE_SIZE 744 #define RT_PAL_H_ACTIVE_SIZE 928 /* instead of 927 - Ivo */ #define RT_SECAM_H_ACTIVE_SIZE 932 /* instead of 928, instead of 927 - Ivo, - eric */ #define RT_NTSCM_V_IN_START (0x23) #define RT_PAL_V_IN_START 44 /* instead of (45-6) - Ivo */ #define RT_SECAM_V_IN_START 0x2C /* instead of (45-6) - Volodya */ #define RT_NTSCM_V_ACTIVE_SIZE 480 #define RT_PAL_V_ACTIVE_SIZE 572 /* instead of 575 - Ivo */ #define RT_SECAM_V_ACTIVE_SIZE 570 /* instead of 572, instead of 575 - Ivo, - eric */ #define RT_NTSCM_WIN_CLOSE_LIMIT 0x4D #define RT_NTSCJ_WIN_CLOSE_LIMIT 0x4D #define RT_NTSC443_WIN_CLOSE_LIMIT 0x5F #define RT_PALM_WIN_CLOSE_LIMIT 0x4D #define RT_PALN_WIN_CLOSE_LIMIT 0x5F #define RT_SECAM_WIN_CLOSE_LIMIT 0xC7 /* instead of 0x5F - eric */ #define RT_NTSCM_VS_FIELD_BLANK_START 0x206 #define RT_NTSCM_HS_PLL_SGAIN 0x5 #define RT_NTSCM_HS_PLL_FGAIN 0x7 #define RT_NTSCM_H_OUT_WIND_WIDTH 0x2F4 #define RT_NTSCM_V_OUT_WIND_HEIGHT 0xF0 #define TV 0x1 #define LINEIN 0x2 #define MUTE 0x3 #define DEC_COMPOSITE 0 #define DEC_SVIDEO 1 #define DEC_TUNER 2 #define DEC_NTSC 0 #define DEC_PAL 1 #define DEC_SECAM 2 #define DEC_NTSC_J 8 #define DEC_SMOOTH 0 #define DEC_SHARP 1 /* RT Register Field Defaults: */ #define fld_tmpReg1_def 0x00000000 #define fld_tmpReg2_def 0x00000001 #define fld_tmpReg3_def 0x00000002 #define fld_LP_CONTRAST_def 0x0000006e #define fld_LP_BRIGHTNESS_def 0x00003ff0 #define fld_CP_HUE_CNTL_def 0x00000000 #define fld_LUMA_FILTER_def 0x00000001 #define fld_H_SCALE_RATIO_def 0x00010000 #define fld_H_SHARPNESS_def 0x00000000 #define fld_V_SCALE_RATIO_def 0x00000800 #define fld_V_DEINTERLACE_ON_def 0x00000001 #define fld_V_BYPSS_def 0x00000000 #define fld_V_DITHER_ON_def 0x00000001 #define fld_EVENF_OFFSET_def 0x00000000 #define fld_ODDF_OFFSET_def 0x00000000 #define fld_INTERLACE_DETECTED_def 0x00000000 #define fld_VS_LINE_COUNT_def 0x00000000 #define fld_VS_DETECTED_LINES_def 0x00000000 #define fld_VS_ITU656_VB_def 0x00000000 #define fld_VBI_CC_DATA_def 0x00000000 #define fld_VBI_CC_WT_def 0x00000000 #define fld_VBI_CC_WT_ACK_def 0x00000000 #define fld_VBI_CC_HOLD_def 0x00000000 #define fld_VBI_DECODE_EN_def 0x00000000 #define fld_VBI_CC_DTO_P_def 0x00001802 #define fld_VBI_20BIT_DTO_P_def 0x0000155c #define fld_VBI_CC_LEVEL_def 0x0000003f #define fld_VBI_20BIT_LEVEL_def 0x00000059 #define fld_VBI_CLK_RUNIN_GAIN_def 0x0000010f #define fld_H_VBI_WIND_START_def 0x00000041 #define fld_H_VBI_WIND_END_def 0x00000366 #define fld_V_VBI_WIND_START_def 0x0D #define fld_V_VBI_WIND_END_def 0x24 #define fld_VBI_20BIT_DATA0_def 0x00000000 #define fld_VBI_20BIT_DATA1_def 0x00000000 #define fld_VBI_20BIT_WT_def 0x00000000 #define fld_VBI_20BIT_WT_ACK_def 0x00000000 #define fld_VBI_20BIT_HOLD_def 0x00000000 #define fld_VBI_CAPTURE_ENABLE_def 0x00000000 #define fld_VBI_EDS_DATA_def 0x00000000 #define fld_VBI_EDS_WT_def 0x00000000 #define fld_VBI_EDS_WT_ACK_def 0x00000000 #define fld_VBI_EDS_HOLD_def 0x00000000 #define fld_VBI_SCALING_RATIO_def 0x00010000 #define fld_VBI_ALIGNER_ENABLE_def 0x00000000 #define fld_H_ACTIVE_START_def 0x00000070 #define fld_H_ACTIVE_END_def 0x000002f0 #define fld_V_ACTIVE_START_def ((22-4)*2+1) #define fld_V_ACTIVE_END_def ((22+240-4)*2+2) #define fld_CH_HEIGHT_def 0x000000CD #define fld_CH_KILL_LEVEL_def 0x000000C0 #define fld_CH_AGC_ERROR_LIM_def 0x00000002 #define fld_CH_AGC_FILTER_EN_def 0x00000000 #define fld_CH_AGC_LOOP_SPEED_def 0x00000000 #define fld_HUE_ADJ_def 0x00000000 #define fld_STANDARD_SEL_def 0x00000000 #define fld_STANDARD_YC_def 0x00000000 #define fld_ADC_PDWN_def 0x00000001 #define fld_INPUT_SELECT_def 0x00000000 #define fld_ADC_PREFLO_def 0x00000003 #define fld_H_SYNC_PULSE_WIDTH_def 0x00000000 #define fld_HS_GENLOCKED_def 0x00000000 #define fld_HS_SYNC_IN_WIN_def 0x00000000 #define fld_VIN_ASYNC_RST_def 0x00000001 #define fld_DVS_ASYNC_RST_def 0x00000001 /* Vendor IDs: */ #define fld_VIP_VENDOR_ID_def 0x00001002 #define fld_VIP_DEVICE_ID_def 0x00004d54 #define fld_VIP_REVISION_ID_def 0x00000001 /* AGC Delay Register */ #define fld_BLACK_INT_START_def 0x00000031 #define fld_BLACK_INT_LENGTH_def 0x0000000f #define fld_UV_INT_START_def 0x0000003b #define fld_U_INT_LENGTH_def 0x0000000f #define fld_V_INT_LENGTH_def 0x0000000f #define fld_CRDR_ACTIVE_GAIN_def 0x0000007a #define fld_CBDB_ACTIVE_GAIN_def 0x000000ac #define fld_DVS_DIRECTION_def 0x00000000 #define fld_DVS_VBI_CARD8_SWAP_def 0x00000000 #define fld_DVS_CLK_SELECT_def 0x00000000 #define fld_CONTINUOUS_STREAM_def 0x00000000 #define fld_DVSOUT_CLK_DRV_def 0x00000001 #define fld_DVSOUT_DATA_DRV_def 0x00000001 #define fld_COMB_CNTL0_def 0x09438090 #define fld_COMB_CNTL1_def 0x00000010 #define fld_COMB_CNTL2_def 0x16161010 #define fld_COMB_LENGTH_def 0x0718038A #define fld_SYNCTIP_REF0_def 0x00000037 #define fld_SYNCTIP_REF1_def 0x00000029 #define fld_CLAMP_REF_def 0x0000003B #define fld_AGC_PEAKWHITE_def 0x000000FF #define fld_VBI_PEAKWHITE_def 0x000000D2 #define fld_WPA_THRESHOLD_def 0x000003B0 #define fld_WPA_TRIGGER_LO_def 0x000000B4 #define fld_WPA_TRIGGER_HIGH_def 0x0000021C #define fld_LOCKOUT_START_def 0x00000206 #define fld_LOCKOUT_END_def 0x00000021 #define fld_CH_DTO_INC_def 0x00400000 #define fld_PLL_SGAIN_def 0x00000001 #define fld_PLL_FGAIN_def 0x00000002 #define fld_CR_BURST_GAIN_def 0x0000007a #define fld_CB_BURST_GAIN_def 0x000000ac #define fld_VERT_LOCKOUT_START_def 0x00000207 #define fld_VERT_LOCKOUT_END_def 0x0000000E #define fld_H_IN_WIND_START_def 0x00000070 #define fld_V_IN_WIND_START_def 0x00000027 #define fld_H_OUT_WIND_WIDTH_def 0x000002f4 #define fld_V_OUT_WIND_WIDTH_def 0x000000f0 #define fld_HS_LINE_TOTAL_def 0x0000038E #define fld_MIN_PULSE_WIDTH_def 0x0000002F #define fld_MAX_PULSE_WIDTH_def 0x00000046 #define fld_WIN_CLOSE_LIMIT_def 0x0000004D #define fld_WIN_OPEN_LIMIT_def 0x000001B7 #define fld_VSYNC_INT_TRIGGER_def 0x000002AA #define fld_VSYNC_INT_HOLD_def 0x0000001D #define fld_VIN_M0_def 0x00000039 #define fld_VIN_N0_def 0x0000014c #define fld_MNFLIP_EN_def 0x00000000 #define fld_VIN_P_def 0x00000006 #define fld_REG_CLK_SEL_def 0x00000000 #define fld_VIN_M1_def 0x00000000 #define fld_VIN_N1_def 0x00000000 #define fld_VIN_DRIVER_SEL_def 0x00000000 #define fld_VIN_MNFLIP_REQ_def 0x00000000 #define fld_VIN_MNFLIP_DONE_def 0x00000000 #define fld_TV_LOCK_TO_VIN_def 0x00000000 #define fld_TV_P_FOR_WINCLK_def 0x00000004 #define fld_VINRST_def 0x00000001 #define fld_VIN_CLK_SEL_def 0x00000000 #define fld_VS_FIELD_BLANK_START_def 0x00000206 #define fld_VS_FIELD_BLANK_END_def 0x0000000A /*#define fld_VS_FIELD_IDLOCATION_def 0x00000105 */ #define fld_VS_FIELD_IDLOCATION_def 0x00000001 #define fld_VS_FRAME_TOTAL_def 0x00000217 #define fld_SYNC_TIP_START_def 0x00000372 #define fld_SYNC_TIP_LENGTH_def 0x0000000F #define fld_GAIN_FORCE_DATA_def 0x00000000 #define fld_GAIN_FORCE_EN_def 0x00000000 #define fld_I_CLAMP_SEL_def 0x00000003 #define fld_I_AGC_SEL_def 0x00000001 #define fld_EXT_CLAMP_CAP_def 0x00000001 #define fld_EXT_AGC_CAP_def 0x00000001 #define fld_DECI_DITHER_EN_def 0x00000001 #define fld_ADC_PREFHI_def 0x00000000 #define fld_ADC_CH_GAIN_SEL_def 0x00000001 #define fld_HS_PLL_SGAIN_def 0x00000003 #define fld_NREn_def 0x00000000 #define fld_NRGainCntl_def 0x00000000 #define fld_NRBWTresh_def 0x00000000 #define fld_NRGCTresh_def 0x00000000 #define fld_NRCoefDespeclMode_def 0x00000000 #define fld_GPIO_5_OE_def 0x00000000 #define fld_GPIO_6_OE_def 0x00000000 #define fld_GPIO_5_OUT_def 0x00000000 #define fld_GPIO_6_OUT_def 0x00000000 /* End of field default values. */ #endif /* RADEON_H */ avifile-0.7.48~20090503.ds/drivers/vidix/drivers/radeon_vid.c0000644000175000017500000033053307622470305022512 0ustar yavoryavor/* radeon_vid - VIDIX based video driver for Radeon and Rage128 chips Copyrights 2002 Nick Kurshev. This file is based on sources from GATOS (gatos.sf.net) and X11 (www.xfree86.org) Licence: GPL */ #include #include #include #include #include #include #include #include "../../config.h" #include "../../bswap.h" #include "../../libdha/pci_ids.h" #include "../../libdha/pci_names.h" #include "../vidix.h" #include "../fourcc.h" #include "../../libdha/libdha.h" #include "radeon.h" #ifdef RAGE128 #define RADEON_MSG "Rage128_vid:" #define X_ADJUST 0 #else #define RADEON_MSG "Radeon_vid:" #define X_ADJUST (is_shift_required ? 8 : 0) #ifndef RADEON #define RADEON #endif #endif #define RADEON_ASSERT(msg) printf(RADEON_MSG"################# FATAL:"msg); #ifdef RAGE128 #define VIDIX_STATIC rage128_ #else #define VIDIX_STATIC radeo_ #endif //#undef RADEON_ENABLE_BM /* unfinished stuff. May corrupt your filesystem ever */ #define RADEON_ENABLE_BM 1 #ifdef RADEON_ENABLE_BM static void * radeon_dma_desc_base = 0; static unsigned long bus_addr_dma_desc = 0; static unsigned long *dma_phys_addrs = 0; #pragma pack(1) typedef struct { uint32_t framebuf_offset; uint32_t sys_addr; uint32_t command; uint32_t reserved; } bm_list_descriptor; #pragma pack() #endif #define VERBOSE_LEVEL 0 static int __verbose = 0; #ifndef RAGE128 static int is_shift_required=0; #endif typedef struct bes_registers_s { /* base address of yuv framebuffer */ uint32_t yuv_base; uint32_t fourcc; uint32_t surf_id; int load_prg_start; int horz_pick_nearest; int vert_pick_nearest; int swap_uv; /* for direct support of bgr fourccs */ uint32_t dest_bpp; /* YUV BES registers */ uint32_t reg_load_cntl; uint32_t h_inc; uint32_t step_by; uint32_t y_x_start; uint32_t y_x_end; uint32_t v_inc; uint32_t p1_blank_lines_at_top; uint32_t p23_blank_lines_at_top; uint32_t vid_buf_pitch0_value; uint32_t vid_buf_pitch1_value; uint32_t p1_x_start_end; uint32_t p2_x_start_end; uint32_t p3_x_start_end; uint32_t base_addr; uint32_t vid_buf_base_adrs_y[VID_PLAY_MAXFRAMES]; uint32_t vid_buf_base_adrs_u[VID_PLAY_MAXFRAMES]; uint32_t vid_buf_base_adrs_v[VID_PLAY_MAXFRAMES]; uint32_t vid_nbufs; uint32_t p1_v_accum_init; uint32_t p1_h_accum_init; uint32_t p23_v_accum_init; uint32_t p23_h_accum_init; uint32_t scale_cntl; uint32_t exclusive_horz; uint32_t auto_flip_cntl; uint32_t filter_cntl; uint32_t four_tap_coeff[5]; uint32_t key_cntl; uint32_t test; /* Configurable stuff */ int double_buff; int brightness; int saturation; int ckey_on; uint32_t graphics_key_clr; uint32_t graphics_key_msk; uint32_t ckey_cntl; int deinterlace_on; uint32_t deinterlace_pattern; } bes_registers_t; typedef struct video_registers_s { const char * sname; uint32_t name; uint32_t value; }video_registers_t; static bes_registers_t besr; #ifndef RAGE128 static int RadeonFamily=100; #endif #define DECLARE_VREG(name) { #name, name, 0 } static video_registers_t vregs[] = { DECLARE_VREG(VIDEOMUX_CNTL), DECLARE_VREG(VIPPAD_MASK), DECLARE_VREG(VIPPAD1_A), DECLARE_VREG(VIPPAD1_EN), DECLARE_VREG(VIPPAD1_Y), DECLARE_VREG(OV0_Y_X_START), DECLARE_VREG(OV0_Y_X_END), DECLARE_VREG(OV0_PIPELINE_CNTL), DECLARE_VREG(OV0_EXCLUSIVE_HORZ), DECLARE_VREG(OV0_EXCLUSIVE_VERT), DECLARE_VREG(OV0_REG_LOAD_CNTL), DECLARE_VREG(OV0_SCALE_CNTL), DECLARE_VREG(OV0_V_INC), DECLARE_VREG(OV0_P1_V_ACCUM_INIT), DECLARE_VREG(OV0_P23_V_ACCUM_INIT), DECLARE_VREG(OV0_P1_BLANK_LINES_AT_TOP), DECLARE_VREG(OV0_P23_BLANK_LINES_AT_TOP), #ifdef RADEON DECLARE_VREG(OV0_BASE_ADDR), #endif DECLARE_VREG(OV0_VID_BUF0_BASE_ADRS), DECLARE_VREG(OV0_VID_BUF1_BASE_ADRS), DECLARE_VREG(OV0_VID_BUF2_BASE_ADRS), DECLARE_VREG(OV0_VID_BUF3_BASE_ADRS), DECLARE_VREG(OV0_VID_BUF4_BASE_ADRS), DECLARE_VREG(OV0_VID_BUF5_BASE_ADRS), DECLARE_VREG(OV0_VID_BUF_PITCH0_VALUE), DECLARE_VREG(OV0_VID_BUF_PITCH1_VALUE), DECLARE_VREG(OV0_AUTO_FLIP_CNTL), DECLARE_VREG(OV0_DEINTERLACE_PATTERN), DECLARE_VREG(OV0_SUBMIT_HISTORY), DECLARE_VREG(OV0_H_INC), DECLARE_VREG(OV0_STEP_BY), DECLARE_VREG(OV0_P1_H_ACCUM_INIT), DECLARE_VREG(OV0_P23_H_ACCUM_INIT), DECLARE_VREG(OV0_P1_X_START_END), DECLARE_VREG(OV0_P2_X_START_END), DECLARE_VREG(OV0_P3_X_START_END), DECLARE_VREG(OV0_FILTER_CNTL), DECLARE_VREG(OV0_FOUR_TAP_COEF_0), DECLARE_VREG(OV0_FOUR_TAP_COEF_1), DECLARE_VREG(OV0_FOUR_TAP_COEF_2), DECLARE_VREG(OV0_FOUR_TAP_COEF_3), DECLARE_VREG(OV0_FOUR_TAP_COEF_4), DECLARE_VREG(OV0_FLAG_CNTL), #ifdef RAGE128 DECLARE_VREG(OV0_COLOUR_CNTL), #else DECLARE_VREG(OV0_SLICE_CNTL), #endif DECLARE_VREG(OV0_VID_KEY_CLR), DECLARE_VREG(OV0_VID_KEY_MSK), DECLARE_VREG(OV0_GRAPHICS_KEY_CLR), DECLARE_VREG(OV0_GRAPHICS_KEY_MSK), DECLARE_VREG(OV0_KEY_CNTL), DECLARE_VREG(OV0_TEST), DECLARE_VREG(OV0_LIN_TRANS_A), DECLARE_VREG(OV0_LIN_TRANS_B), DECLARE_VREG(OV0_LIN_TRANS_C), DECLARE_VREG(OV0_LIN_TRANS_D), DECLARE_VREG(OV0_LIN_TRANS_E), DECLARE_VREG(OV0_LIN_TRANS_F), DECLARE_VREG(OV0_GAMMA_0_F), DECLARE_VREG(OV0_GAMMA_10_1F), DECLARE_VREG(OV0_GAMMA_20_3F), DECLARE_VREG(OV0_GAMMA_40_7F), DECLARE_VREG(OV0_GAMMA_380_3BF), DECLARE_VREG(OV0_GAMMA_3C0_3FF), DECLARE_VREG(SUBPIC_CNTL), DECLARE_VREG(SUBPIC_DEFCOLCON), DECLARE_VREG(SUBPIC_Y_X_START), DECLARE_VREG(SUBPIC_Y_X_END), DECLARE_VREG(SUBPIC_V_INC), DECLARE_VREG(SUBPIC_H_INC), DECLARE_VREG(SUBPIC_BUF0_OFFSET), DECLARE_VREG(SUBPIC_BUF1_OFFSET), DECLARE_VREG(SUBPIC_LC0_OFFSET), DECLARE_VREG(SUBPIC_LC1_OFFSET), DECLARE_VREG(SUBPIC_PITCH), DECLARE_VREG(SUBPIC_BTN_HLI_COLCON), DECLARE_VREG(SUBPIC_BTN_HLI_Y_X_START), DECLARE_VREG(SUBPIC_BTN_HLI_Y_X_END), DECLARE_VREG(SUBPIC_PALETTE_INDEX), DECLARE_VREG(SUBPIC_PALETTE_DATA), DECLARE_VREG(SUBPIC_H_ACCUM_INIT), DECLARE_VREG(SUBPIC_V_ACCUM_INIT), DECLARE_VREG(IDCT_RUNS), DECLARE_VREG(IDCT_LEVELS), DECLARE_VREG(IDCT_AUTH_CONTROL), DECLARE_VREG(IDCT_AUTH), DECLARE_VREG(IDCT_CONTROL), #ifdef RAGE128 DECLARE_VREG(BM_FRAME_BUF_OFFSET), DECLARE_VREG(BM_SYSTEM_MEM_ADDR), DECLARE_VREG(BM_COMMAND), DECLARE_VREG(BM_STATUS), DECLARE_VREG(BM_QUEUE_STATUS), DECLARE_VREG(BM_QUEUE_FREE_STATUS), DECLARE_VREG(BM_CHUNK_0_VAL), DECLARE_VREG(BM_CHUNK_1_VAL), DECLARE_VREG(BM_VIP0_BUF), DECLARE_VREG(BM_VIP0_ACTIVE), DECLARE_VREG(BM_VIP1_BUF), DECLARE_VREG(BM_VIP1_ACTIVE), DECLARE_VREG(BM_VIP2_BUF), DECLARE_VREG(BM_VIP2_ACTIVE), DECLARE_VREG(BM_VIP3_BUF), DECLARE_VREG(BM_VIP3_ACTIVE), DECLARE_VREG(BM_VIDCAP_BUF0), DECLARE_VREG(BM_VIDCAP_BUF1), DECLARE_VREG(BM_VIDCAP_BUF2), DECLARE_VREG(BM_VIDCAP_ACTIVE), DECLARE_VREG(BM_GUI), DECLARE_VREG(BM_ABORT) #else DECLARE_VREG(DMA_GUI_TABLE_ADDR), DECLARE_VREG(DMA_GUI_SRC_ADDR), DECLARE_VREG(DMA_GUI_DST_ADDR), DECLARE_VREG(DMA_GUI_COMMAND), DECLARE_VREG(DMA_GUI_STATUS), DECLARE_VREG(DMA_GUI_ACT_DSCRPTR), DECLARE_VREG(DMA_VID_SRC_ADDR), DECLARE_VREG(DMA_VID_DST_ADDR), DECLARE_VREG(DMA_VID_COMMAND), DECLARE_VREG(DMA_VID_STATUS), DECLARE_VREG(DMA_VID_ACT_DSCRPTR), #endif }; static void * radeon_mmio_base = 0; static void * radeon_mem_base = 0; static int32_t radeon_overlay_off = 0; static uint32_t radeon_ram_size = 0; #define GETREG(TYPE,PTR,OFFZ) (*((volatile TYPE*)((PTR)+(OFFZ)))) #define SETREG(TYPE,PTR,OFFZ,VAL) (*((volatile TYPE*)((PTR)+(OFFZ))))=VAL #define INREG8(addr) GETREG(uint8_t,(uint32_t)(radeon_mmio_base),addr) #define OUTREG8(addr,val) SETREG(uint8_t,(uint32_t)(radeon_mmio_base),addr,val) static inline uint32_t INREG (uint32_t addr) { uint32_t tmp = GETREG(uint32_t,(uint32_t)(radeon_mmio_base),addr); return le2me_32(tmp); } #define OUTREG(addr,val) SETREG(uint32_t,(uint32_t)(radeon_mmio_base),addr,le2me_32(val)) #define OUTREGP(addr,val,mask) \ do { \ unsigned int _tmp = INREG(addr); \ _tmp &= (mask); \ _tmp |= (val); \ OUTREG(addr, _tmp); \ } while (0) static __inline__ uint32_t INPLL(uint32_t addr) { OUTREG8(CLOCK_CNTL_INDEX, addr & 0x0000001f); return (INREG(CLOCK_CNTL_DATA)); } #define OUTPLL(addr,val) OUTREG8(CLOCK_CNTL_INDEX, (addr & 0x0000001f) | 0x00000080); \ OUTREG(CLOCK_CNTL_DATA, val) #define OUTPLLP(addr,val,mask) \ do { \ unsigned int _tmp = INPLL(addr); \ _tmp &= (mask); \ _tmp |= (val); \ OUTPLL(addr, _tmp); \ } while (0) static uint32_t radeon_vid_get_dbpp( void ) { uint32_t dbpp,retval; dbpp = (INREG(CRTC_GEN_CNTL)>>8)& 0xF; switch(dbpp) { case DST_8BPP: retval = 8; break; case DST_15BPP: retval = 15; break; case DST_16BPP: retval = 16; break; case DST_24BPP: retval = 24; break; default: retval=32; break; } return retval; } static int radeon_is_dbl_scan( void ) { return (INREG(CRTC_GEN_CNTL))&CRTC_DBL_SCAN_EN; } static int radeon_is_interlace( void ) { return (INREG(CRTC_GEN_CNTL))&CRTC_INTERLACE_EN; } static uint32_t radeon_get_xres( void ) { /* FIXME: currently we extract that from CRTC!!!*/ uint32_t xres,h_total; h_total = INREG(CRTC_H_TOTAL_DISP); xres = (h_total >> 16) & 0xffff; return (xres + 1)*8; } static uint32_t radeon_get_yres( void ) { /* FIXME: currently we extract that from CRTC!!!*/ uint32_t yres,v_total; v_total = INREG(CRTC_V_TOTAL_DISP); yres = (v_total >> 16) & 0xffff; return yres + 1; } static void radeon_wait_vsync(void) { int i; OUTREG(GEN_INT_STATUS, VSYNC_INT_AK); for (i = 0; i < 2000000; i++) { if (INREG(GEN_INT_STATUS) & VSYNC_INT) break; } } #ifdef RAGE128 static void _radeon_engine_idle(void); static void _radeon_fifo_wait(unsigned); #define radeon_engine_idle() _radeon_engine_idle() #define radeon_fifo_wait(entries) _radeon_fifo_wait(entries) /* Flush all dirty data in the Pixel Cache to memory. */ static __inline__ void radeon_engine_flush ( void ) { unsigned i; OUTREGP(PC_NGUI_CTLSTAT, PC_FLUSH_ALL, ~PC_FLUSH_ALL); for (i = 0; i < 2000000; i++) { if (!(INREG(PC_NGUI_CTLSTAT) & PC_BUSY)) break; } } /* Reset graphics card to known state. */ static void radeon_engine_reset( void ) { uint32_t clock_cntl_index; uint32_t mclk_cntl; uint32_t gen_reset_cntl; radeon_engine_flush(); clock_cntl_index = INREG(CLOCK_CNTL_INDEX); mclk_cntl = INPLL(MCLK_CNTL); OUTPLL(MCLK_CNTL, mclk_cntl | FORCE_GCP | FORCE_PIPE3D_CP); gen_reset_cntl = INREG(GEN_RESET_CNTL); OUTREG(GEN_RESET_CNTL, gen_reset_cntl | SOFT_RESET_GUI); INREG(GEN_RESET_CNTL); OUTREG(GEN_RESET_CNTL, gen_reset_cntl & (uint32_t)(~SOFT_RESET_GUI)); INREG(GEN_RESET_CNTL); OUTPLL(MCLK_CNTL, mclk_cntl); OUTREG(CLOCK_CNTL_INDEX, clock_cntl_index); OUTREG(GEN_RESET_CNTL, gen_reset_cntl); } #else static __inline__ void radeon_engine_flush ( void ) { int i; /* initiate flush */ OUTREGP(RB2D_DSTCACHE_CTLSTAT, RB2D_DC_FLUSH_ALL, ~RB2D_DC_FLUSH_ALL); for (i=0; i < 2000000; i++) { if (!(INREG(RB2D_DSTCACHE_CTLSTAT) & RB2D_DC_BUSY)) break; } } static void _radeon_engine_idle(void); static void _radeon_fifo_wait(unsigned); #define radeon_engine_idle() _radeon_engine_idle() #define radeon_fifo_wait(entries) _radeon_fifo_wait(entries) static void radeon_engine_reset( void ) { uint32_t clock_cntl_index, mclk_cntl, rbbm_soft_reset; radeon_engine_flush (); clock_cntl_index = INREG(CLOCK_CNTL_INDEX); mclk_cntl = INPLL(MCLK_CNTL); OUTPLL(MCLK_CNTL, (mclk_cntl | FORCEON_MCLKA | FORCEON_MCLKB | FORCEON_YCLKA | FORCEON_YCLKB | FORCEON_MC | FORCEON_AIC)); rbbm_soft_reset = INREG(RBBM_SOFT_RESET); OUTREG(RBBM_SOFT_RESET, rbbm_soft_reset | SOFT_RESET_CP | SOFT_RESET_HI | SOFT_RESET_SE | SOFT_RESET_RE | SOFT_RESET_PP | SOFT_RESET_E2 | SOFT_RESET_RB | SOFT_RESET_HDP); INREG(RBBM_SOFT_RESET); OUTREG(RBBM_SOFT_RESET, rbbm_soft_reset & (uint32_t) ~(SOFT_RESET_CP | SOFT_RESET_HI | SOFT_RESET_SE | SOFT_RESET_RE | SOFT_RESET_PP | SOFT_RESET_E2 | SOFT_RESET_RB | SOFT_RESET_HDP)); INREG(RBBM_SOFT_RESET); OUTPLL(MCLK_CNTL, mclk_cntl); OUTREG(CLOCK_CNTL_INDEX, clock_cntl_index); OUTREG(RBBM_SOFT_RESET, rbbm_soft_reset); return; } #endif static void radeon_engine_restore( void ) { #ifndef RAGE128 int pitch64; uint32_t xres,yres,bpp; radeon_fifo_wait(1); xres = radeon_get_xres(); yres = radeon_get_yres(); bpp = radeon_vid_get_dbpp(); /* turn of all automatic flushing - we'll do it all */ OUTREG(RB2D_DSTCACHE_MODE, 0); pitch64 = ((xres * (bpp / 8) + 0x3f)) >> 6; radeon_fifo_wait(1); OUTREG(DEFAULT_OFFSET, (INREG(DEFAULT_OFFSET) & 0xC0000000) | (pitch64 << 22)); radeon_fifo_wait(1); #if defined(WORDS_BIGENDIAN) OUTREGP(DP_DATATYPE, HOST_BIG_ENDIAN_EN, ~HOST_BIG_ENDIAN_EN); #else OUTREGP(DP_DATATYPE, 0, ~HOST_BIG_ENDIAN_EN); #endif radeon_fifo_wait(1); OUTREG(DEFAULT_SC_BOTTOM_RIGHT, (DEFAULT_SC_RIGHT_MAX | DEFAULT_SC_BOTTOM_MAX)); radeon_fifo_wait(1); OUTREG(DP_GUI_MASTER_CNTL, (INREG(DP_GUI_MASTER_CNTL) | GMC_BRUSH_SOLID_COLOR | GMC_SRC_DATATYPE_COLOR)); radeon_fifo_wait(7); OUTREG(DST_LINE_START, 0); OUTREG(DST_LINE_END, 0); OUTREG(DP_BRUSH_FRGD_CLR, 0xffffffff); OUTREG(DP_BRUSH_BKGD_CLR, 0x00000000); OUTREG(DP_SRC_FRGD_CLR, 0xffffffff); OUTREG(DP_SRC_BKGD_CLR, 0x00000000); OUTREG(DP_WRITE_MASK, 0xffffffff); radeon_engine_idle(); #endif } #ifdef RAGE128 static void _radeon_fifo_wait (unsigned entries) { unsigned i; for(;;) { for (i=0; i<2000000; i++) if ((INREG(GUI_STAT) & GUI_FIFOCNT_MASK) >= entries) return; radeon_engine_reset(); radeon_engine_restore(); } } static void _radeon_engine_idle ( void ) { unsigned i; /* ensure FIFO is empty before waiting for idle */ radeon_fifo_wait (64); for(;;) { for (i=0; i<2000000; i++) { if ((INREG(GUI_STAT) & GUI_ACTIVE) == 0) { radeon_engine_flush (); return; } } radeon_engine_reset(); radeon_engine_restore(); } } #else static void _radeon_fifo_wait (unsigned entries) { unsigned i; for(;;) { for (i=0; i<2000000; i++) if ((INREG(RBBM_STATUS) & RBBM_FIFOCNT_MASK) >= entries) return; radeon_engine_reset(); radeon_engine_restore(); } } static void _radeon_engine_idle ( void ) { int i; /* ensure FIFO is empty before waiting for idle */ radeon_fifo_wait (64); for(;;) { for (i=0; i<2000000; i++) { if (((INREG(RBBM_STATUS) & RBBM_ACTIVE)) == 0) { radeon_engine_flush (); return; } } radeon_engine_reset(); radeon_engine_restore(); } } #endif #ifndef RAGE128 /* Reference color space transform data */ typedef struct tagREF_TRANSFORM { float RefLuma; float RefRCb; float RefRCr; float RefGCb; float RefGCr; float RefBCb; float RefBCr; } REF_TRANSFORM; /* Parameters for ITU-R BT.601 and ITU-R BT.709 colour spaces */ REF_TRANSFORM trans[2] = { {1.1678, 0.0, 1.6007, -0.3929, -0.8154, 2.0232, 0.0}, /* BT.601 */ {1.1678, 0.0, 1.7980, -0.2139, -0.5345, 2.1186, 0.0} /* BT.709 */ }; /**************************************************************************** * SetTransform * * Function: Calculates and sets color space transform from supplied * * reference transform, gamma, brightness, contrast, hue and * * saturation. * * Inputs: bright - brightness * * cont - contrast * * sat - saturation * * hue - hue * * red_intensity - intense of red component * * green_intensity - intense of green component * * blue_intensity - intense of blue component * * ref - index to the table of refernce transforms * * Outputs: NONE * ****************************************************************************/ static void radeon_set_transform(float bright, float cont, float sat, float hue, float red_intensity, float green_intensity,float blue_intensity, unsigned ref) { float OvHueSin, OvHueCos; float CAdjLuma, CAdjOff; float RedAdj,GreenAdj,BlueAdj; float CAdjRCb, CAdjRCr; float CAdjGCb, CAdjGCr; float CAdjBCb, CAdjBCr; float OvLuma, OvROff, OvGOff, OvBOff; float OvRCb, OvRCr; float OvGCb, OvGCr; float OvBCb, OvBCr; float Loff = 64.0; float Coff = 512.0f; uint32_t dwOvLuma, dwOvROff, dwOvGOff, dwOvBOff; uint32_t dwOvRCb, dwOvRCr; uint32_t dwOvGCb, dwOvGCr; uint32_t dwOvBCb, dwOvBCr; if (ref >= 2) return; OvHueSin = sin((double)hue); OvHueCos = cos((double)hue); CAdjLuma = cont * trans[ref].RefLuma; CAdjOff = cont * trans[ref].RefLuma * bright * 1023.0; RedAdj = cont * trans[ref].RefLuma * red_intensity * 1023.0; GreenAdj = cont * trans[ref].RefLuma * green_intensity * 1023.0; BlueAdj = cont * trans[ref].RefLuma * blue_intensity * 1023.0; CAdjRCb = sat * -OvHueSin * trans[ref].RefRCr; CAdjRCr = sat * OvHueCos * trans[ref].RefRCr; CAdjGCb = sat * (OvHueCos * trans[ref].RefGCb - OvHueSin * trans[ref].RefGCr); CAdjGCr = sat * (OvHueSin * trans[ref].RefGCb + OvHueCos * trans[ref].RefGCr); CAdjBCb = sat * OvHueCos * trans[ref].RefBCb; CAdjBCr = sat * OvHueSin * trans[ref].RefBCb; #if 0 /* default constants */ CAdjLuma = 1.16455078125; CAdjRCb = 0.0; CAdjRCr = 1.59619140625; CAdjGCb = -0.39111328125; CAdjGCr = -0.8125; CAdjBCb = 2.01708984375; CAdjBCr = 0; #endif OvLuma = CAdjLuma; OvRCb = CAdjRCb; OvRCr = CAdjRCr; OvGCb = CAdjGCb; OvGCr = CAdjGCr; OvBCb = CAdjBCb; OvBCr = CAdjBCr; OvROff = RedAdj + CAdjOff - OvLuma * Loff - (OvRCb + OvRCr) * Coff; OvGOff = GreenAdj + CAdjOff - OvLuma * Loff - (OvGCb + OvGCr) * Coff; OvBOff = BlueAdj + CAdjOff - OvLuma * Loff - (OvBCb + OvBCr) * Coff; #if 0 /* default constants */ OvROff = -888.5; OvGOff = 545; OvBOff = -1104; #endif dwOvROff = ((int)(OvROff * 2.0)) & 0x1fff; dwOvGOff = (int)(OvGOff * 2.0) & 0x1fff; dwOvBOff = (int)(OvBOff * 2.0) & 0x1fff; /* Whatever docs say about R200 having 3.8 format instead of 3.11 as in Radeon is a lie */ #if 0 if(!IsR200) { #endif dwOvLuma =(((int)(OvLuma * 2048.0))&0x7fff)<<17; dwOvRCb = (((int)(OvRCb * 2048.0))&0x7fff)<<1; dwOvRCr = (((int)(OvRCr * 2048.0))&0x7fff)<<17; dwOvGCb = (((int)(OvGCb * 2048.0))&0x7fff)<<1; dwOvGCr = (((int)(OvGCr * 2048.0))&0x7fff)<<17; dwOvBCb = (((int)(OvBCb * 2048.0))&0x7fff)<<1; dwOvBCr = (((int)(OvBCr * 2048.0))&0x7fff)<<17; #if 0 } else { dwOvLuma = (((int)(OvLuma * 256.0))&0x7ff)<<20; dwOvRCb = (((int)(OvRCb * 256.0))&0x7ff)<<4; dwOvRCr = (((int)(OvRCr * 256.0))&0x7ff)<<20; dwOvGCb = (((int)(OvGCb * 256.0))&0x7ff)<<4; dwOvGCr = (((int)(OvGCr * 256.0))&0x7ff)<<20; dwOvBCb = (((int)(OvBCb * 256.0))&0x7ff)<<4; dwOvBCr = (((int)(OvBCr * 256.0))&0x7ff)<<20; } #endif OUTREG(OV0_LIN_TRANS_A, dwOvRCb | dwOvLuma); OUTREG(OV0_LIN_TRANS_B, dwOvROff | dwOvRCr); OUTREG(OV0_LIN_TRANS_C, dwOvGCb | dwOvLuma); OUTREG(OV0_LIN_TRANS_D, dwOvGOff | dwOvGCr); OUTREG(OV0_LIN_TRANS_E, dwOvBCb | dwOvLuma); OUTREG(OV0_LIN_TRANS_F, dwOvBOff | dwOvBCr); } /* Gamma curve definition */ typedef struct { unsigned int gammaReg; unsigned int gammaSlope; unsigned int gammaOffset; }GAMMA_SETTINGS; /* Recommended gamma curve parameters */ GAMMA_SETTINGS r200_def_gamma[18] = { {OV0_GAMMA_0_F, 0x100, 0x0000}, {OV0_GAMMA_10_1F, 0x100, 0x0020}, {OV0_GAMMA_20_3F, 0x100, 0x0040}, {OV0_GAMMA_40_7F, 0x100, 0x0080}, {OV0_GAMMA_80_BF, 0x100, 0x0100}, {OV0_GAMMA_C0_FF, 0x100, 0x0100}, {OV0_GAMMA_100_13F, 0x100, 0x0200}, {OV0_GAMMA_140_17F, 0x100, 0x0200}, {OV0_GAMMA_180_1BF, 0x100, 0x0300}, {OV0_GAMMA_1C0_1FF, 0x100, 0x0300}, {OV0_GAMMA_200_23F, 0x100, 0x0400}, {OV0_GAMMA_240_27F, 0x100, 0x0400}, {OV0_GAMMA_280_2BF, 0x100, 0x0500}, {OV0_GAMMA_2C0_2FF, 0x100, 0x0500}, {OV0_GAMMA_300_33F, 0x100, 0x0600}, {OV0_GAMMA_340_37F, 0x100, 0x0600}, {OV0_GAMMA_380_3BF, 0x100, 0x0700}, {OV0_GAMMA_3C0_3FF, 0x100, 0x0700} }; GAMMA_SETTINGS r100_def_gamma[6] = { {OV0_GAMMA_0_F, 0x100, 0x0000}, {OV0_GAMMA_10_1F, 0x100, 0x0020}, {OV0_GAMMA_20_3F, 0x100, 0x0040}, {OV0_GAMMA_40_7F, 0x100, 0x0080}, {OV0_GAMMA_380_3BF, 0x100, 0x0100}, {OV0_GAMMA_3C0_3FF, 0x100, 0x0100} }; static void make_default_gamma_correction( void ) { size_t i; if(RadeonFamily == 100){ OUTREG(OV0_LIN_TRANS_A, 0x12A00000); OUTREG(OV0_LIN_TRANS_B, 0x199018FE); OUTREG(OV0_LIN_TRANS_C, 0x12A0F9B0); OUTREG(OV0_LIN_TRANS_D, 0xF2F0043B); OUTREG(OV0_LIN_TRANS_E, 0x12A02050); OUTREG(OV0_LIN_TRANS_F, 0x0000174E); for(i=0; i<6; i++){ OUTREG(r100_def_gamma[i].gammaReg, (r100_def_gamma[i].gammaSlope<<16) | r100_def_gamma[i].gammaOffset); } } else{ OUTREG(OV0_LIN_TRANS_A, 0x12a20000); OUTREG(OV0_LIN_TRANS_B, 0x198a190e); OUTREG(OV0_LIN_TRANS_C, 0x12a2f9da); OUTREG(OV0_LIN_TRANS_D, 0xf2fe0442); OUTREG(OV0_LIN_TRANS_E, 0x12a22046); OUTREG(OV0_LIN_TRANS_F, 0x175f); /* Default Gamma, Of 18 segments for gamma cure, all segments in R200 are programmable, while only lower 4 and upper 2 segments are programmable in Radeon*/ for(i=0; i<18; i++){ OUTREG(r200_def_gamma[i].gammaReg, (r200_def_gamma[i].gammaSlope<<16) | r200_def_gamma[i].gammaOffset); } } } #endif static void radeon_vid_make_default(void) { #ifdef RAGE128 besr.saturation = 0x0F; besr.brightness = 0; OUTREG(OV0_COLOUR_CNTL,0x000F0F00UL); /* Default brihgtness and saturation for Rage128 */ #else make_default_gamma_correction(); #endif besr.deinterlace_pattern = 0x900AAAAA; OUTREG(OV0_DEINTERLACE_PATTERN,besr.deinterlace_pattern); besr.deinterlace_on=1; besr.double_buff=1; besr.ckey_on=0; besr.graphics_key_msk=0; besr.graphics_key_clr=0; besr.ckey_cntl = VIDEO_KEY_FN_TRUE|GRAPHIC_KEY_FN_TRUE|CMP_MIX_AND; } unsigned VIDIX_NAME(vixGetVersion)( void ) { return VIDIX_VERSION; } static unsigned short ati_card_ids[] = { #ifdef RAGE128 /* This driver should be compatible with Rage128 (pro) chips. (include adaptive deinterlacing!!!). Moreover: the same logic can be used with Mach64 chips. (I mean: mach64xx, 3d rage, 3d rage IIc, 3D rage pro, 3d rage mobility). but they are incompatible by i/o ports. So if enthusiasts will want then they can redefine OUTREG and INREG macros and redefine OV0_* constants. Also it seems that mach64 chips supports only: YUY2, YV12, UYVY fourccs (422 and 420 formats only). */ /* Rage128 Pro GL */ DEVICE_ATI_RAGE_128_PA_PRO, DEVICE_ATI_RAGE_128_PB_PRO, DEVICE_ATI_RAGE_128_PC_PRO, DEVICE_ATI_RAGE_128_PD_PRO, DEVICE_ATI_RAGE_128_PE_PRO, DEVICE_ATI_RAGE_128_PF_PRO, /* Rage128 Pro VR */ DEVICE_ATI_RAGE_128_PG_PRO, DEVICE_ATI_RAGE_128_PH_PRO, DEVICE_ATI_RAGE_128_PI_PRO, DEVICE_ATI_RAGE_128_PJ_PRO, DEVICE_ATI_RAGE_128_PK_PRO, DEVICE_ATI_RAGE_128_PL_PRO, DEVICE_ATI_RAGE_128_PM_PRO, DEVICE_ATI_RAGE_128_PN_PRO, DEVICE_ATI_RAGE_128_PO_PRO, DEVICE_ATI_RAGE_128_PP_PRO, DEVICE_ATI_RAGE_128_PQ_PRO, DEVICE_ATI_RAGE_128_PR_PRO, DEVICE_ATI_RAGE_128_PS_PRO, DEVICE_ATI_RAGE_128_PT_PRO, DEVICE_ATI_RAGE_128_PU_PRO, DEVICE_ATI_RAGE_128_PV_PRO, DEVICE_ATI_RAGE_128_PW_PRO, DEVICE_ATI_RAGE_128_PX_PRO, /* Rage128 GL */ DEVICE_ATI_RAGE_128_RE_SG, DEVICE_ATI_RAGE_128_RF_SG, DEVICE_ATI_RAGE_128_RG, DEVICE_ATI_RAGE_128_RK_VR, DEVICE_ATI_RAGE_128_RL_VR, DEVICE_ATI_RAGE_128_SE_4X, DEVICE_ATI_RAGE_128_SF_4X, DEVICE_ATI_RAGE_128_SG_4X, DEVICE_ATI_RAGE_128_SH, DEVICE_ATI_RAGE_128_SK_4X, DEVICE_ATI_RAGE_128_SL_4X, DEVICE_ATI_RAGE_128_SM_4X, DEVICE_ATI_RAGE_128_4X, DEVICE_ATI_RAGE_128_PRO, DEVICE_ATI_RAGE_128_PRO2, DEVICE_ATI_RAGE_128_PRO3, /* these seem to be based on rage 128 instead of mach64 */ DEVICE_ATI_RAGE_MOBILITY_M3, DEVICE_ATI_RAGE_MOBILITY_M32 #else /* Radeons (indeed: Rage 256 Pro ;) */ DEVICE_ATI_RADEON_R100_QD, DEVICE_ATI_RADEON_R100_QE, DEVICE_ATI_RADEON_R100_QF, DEVICE_ATI_RADEON_R100_QG, DEVICE_ATI_RADEON_VE_QY, DEVICE_ATI_RADEON_VE_QZ, DEVICE_ATI_RADEON_MOBILITY_M7, DEVICE_ATI_RADEON_MOBILITY_M72, DEVICE_ATI_RADEON_MOBILITY_M6, DEVICE_ATI_RADEON_MOBILITY_M62, DEVICE_ATI_RADEON_R200_BB, DEVICE_ATI_RADEON_R200_QH, DEVICE_ATI_RADEON_R200_QI, DEVICE_ATI_RADEON_R200_QJ, DEVICE_ATI_RADEON_R200_QK, DEVICE_ATI_RADEON_R200_QL, DEVICE_ATI_RADEON_R200_QH2, DEVICE_ATI_RADEON_R200_QI2, DEVICE_ATI_RADEON_R200_QJ2, DEVICE_ATI_RADEON_R200_QK2, DEVICE_ATI_RADEON_RV200_QW, DEVICE_ATI_RADEON_RV200_QX, DEVICE_ATI_RADEON_R250_ID, DEVICE_ATI_RADEON_R250_IE, DEVICE_ATI_RADEON_R250_IF, DEVICE_ATI_RADEON_R250_IG, DEVICE_ATI_RADEON_R250_LD, DEVICE_ATI_RADEON_R250_LE, DEVICE_ATI_RADEON_R250_LF, DEVICE_ATI_RADEON_R250_LG, DEVICE_ATI_RADEON_R300_ND, DEVICE_ATI_RADEON_R300_NE, DEVICE_ATI_RADEON_R300_NF, DEVICE_ATI_RADEON_R300_NG #endif }; static int find_chip(unsigned chip_id) { unsigned i; for(i = 0;i < sizeof(ati_card_ids)/sizeof(unsigned short);i++) { if(chip_id == ati_card_ids[i]) return i; } return -1; } static pciinfo_t pci_info; static int probed=0; vidix_capability_t def_cap = { #ifdef RAGE128 "BES driver for rage128 cards", #else "BES driver for radeon cards", #endif "Nick Kurshev", TYPE_OUTPUT | TYPE_FX, { 0, 0, 0, 0 }, 2048, 2048, 4, 4, -1, FLAG_UPSCALER | FLAG_DOWNSCALER | FLAG_EQUALIZER, VENDOR_ATI, 0, { 0, 0, 0, 0} }; int VIDIX_NAME(vixProbe)( int verbose,int force ) { pciinfo_t lst[MAX_PCI_DEVICES]; unsigned i,num_pci; int err; __verbose = verbose; err = pci_scan(lst,&num_pci); if(err) { printf(RADEON_MSG" Error occured during pci scan: %s\n",strerror(err)); return err; } else { err = ENXIO; for(i=0;i PROBE_NORMAL) { printf(RADEON_MSG" Driver was forced. Was found %sknown chip\n",idx == -1 ? "un" : ""); if(idx == -1) #ifdef RAGE128 printf(RADEON_MSG" Assuming it as Rage128\n"); #else printf(RADEON_MSG" Assuming it as Radeon1\n"); #endif } def_cap.device_id = lst[i].device; err = 0; memcpy(&pci_info,&lst[i],sizeof(pciinfo_t)); probed=1; break; } } } if(err && verbose) printf(RADEON_MSG" Can't find chip\n"); return err; } #ifndef RAGE128 enum radeon_montype { MT_NONE, MT_CRT, /* CRT-(cathode ray tube) analog monitor. (15-pin VGA connector) */ MT_LCD, /* Liquid Crystal Display */ MT_DFP, /* DFP-digital flat panel monitor. (24-pin DVI-I connector) */ MT_CTV, /* Composite TV out (not in VE) */ MT_STV /* S-Video TV out (probably in VE only) */ }; typedef struct radeon_info_s { int hasCRTC2; int crtDispType; int dviDispType; }rinfo_t; static rinfo_t rinfo; static char * GET_MON_NAME(int type) { char *pret; switch(type) { case MT_NONE: pret = "no"; break; case MT_CRT: pret = "CRT"; break; case MT_DFP: pret = "DFP"; break; case MT_LCD: pret = "LCD"; break; case MT_CTV: pret = "CTV"; break; case MT_STV: pret = "STV"; break; default: pret = "Unknown"; } return pret; } static void radeon_get_moninfo (rinfo_t *rinfo) { unsigned int tmp; tmp = INREG(RADEON_BIOS_4_SCRATCH); if (rinfo->hasCRTC2) { /* primary DVI port */ if (tmp & 0x08) rinfo->dviDispType = MT_DFP; else if (tmp & 0x4) rinfo->dviDispType = MT_LCD; else if (tmp & 0x200) rinfo->dviDispType = MT_CRT; else if (tmp & 0x10) rinfo->dviDispType = MT_CTV; else if (tmp & 0x20) rinfo->dviDispType = MT_STV; /* secondary CRT port */ if (tmp & 0x2) rinfo->crtDispType = MT_CRT; else if (tmp & 0x800) rinfo->crtDispType = MT_DFP; else if (tmp & 0x400) rinfo->crtDispType = MT_LCD; else if (tmp & 0x1000) rinfo->crtDispType = MT_CTV; else if (tmp & 0x2000) rinfo->crtDispType = MT_STV; } else { rinfo->dviDispType = MT_NONE; tmp = INREG(FP_GEN_CNTL); if (tmp & FP_EN_TMDS) rinfo->crtDispType = MT_DFP; else rinfo->crtDispType = MT_CRT; } } #endif typedef struct saved_regs_s { uint32_t ov0_vid_key_clr; uint32_t ov0_vid_key_msk; uint32_t ov0_graphics_key_clr; uint32_t ov0_graphics_key_msk; uint32_t ov0_key_cntl; }saved_regs_t; static saved_regs_t savreg; static void save_regs( void ) { radeon_fifo_wait(6); savreg.ov0_vid_key_clr = INREG(OV0_VID_KEY_CLR); savreg.ov0_vid_key_msk = INREG(OV0_VID_KEY_MSK); savreg.ov0_graphics_key_clr = INREG(OV0_GRAPHICS_KEY_CLR); savreg.ov0_graphics_key_msk = INREG(OV0_GRAPHICS_KEY_MSK); savreg.ov0_key_cntl = INREG(OV0_KEY_CNTL); } static void restore_regs( void ) { radeon_fifo_wait(6); OUTREG(OV0_VID_KEY_CLR,savreg.ov0_vid_key_clr); OUTREG(OV0_VID_KEY_MSK,savreg.ov0_vid_key_msk); OUTREG(OV0_GRAPHICS_KEY_CLR,savreg.ov0_graphics_key_clr); OUTREG(OV0_GRAPHICS_KEY_MSK,savreg.ov0_graphics_key_msk); OUTREG(OV0_KEY_CNTL,savreg.ov0_key_cntl); } int VIDIX_NAME(vixInit)( const char *args ) { int err; if(!probed) { printf(RADEON_MSG" Driver was not probed but is being initializing\n"); return EINTR; } if((radeon_mmio_base = map_phys_mem(pci_info.base2,0xFFFF))==(void *)-1) return ENOMEM; radeon_ram_size = INREG(CONFIG_MEMSIZE); /* mem size is bits [28:0], mask off the rest. Range: from 1Mb up to 512 Mb */ radeon_ram_size &= CONFIG_MEMSIZE_MASK; if((radeon_mem_base = map_phys_mem(pci_info.base0,radeon_ram_size))==(void *)-1) return ENOMEM; memset(&besr,0,sizeof(bes_registers_t)); radeon_vid_make_default(); printf(RADEON_MSG" Video memory = %uMb\n",radeon_ram_size/0x100000); err = mtrr_set_type(pci_info.base0,radeon_ram_size,MTRR_TYPE_WRCOMB); if(!err) printf(RADEON_MSG" Set write-combining type of video memory\n"); #ifndef RAGE128 { memset(&rinfo,0,sizeof(rinfo_t)); if(RadeonFamily > 100) rinfo.hasCRTC2 = 1; switch(RadeonFamily) { case 100: case 120: case 150: case 250: is_shift_required=1; break; default: break; } radeon_get_moninfo(&rinfo); if(rinfo.hasCRTC2) { printf(RADEON_MSG" DVI port has %s monitor connected\n",GET_MON_NAME(rinfo.dviDispType)); printf(RADEON_MSG" CRT port has %s monitor connected\n",GET_MON_NAME(rinfo.crtDispType)); } else printf(RADEON_MSG" CRT port has %s monitor connected\n",GET_MON_NAME(rinfo.crtDispType)); } #endif #ifdef RADEON_ENABLE_BM if(bm_open() == 0) { if((dma_phys_addrs = malloc(radeon_ram_size*sizeof(unsigned long)/4096)) != 0) def_cap.flags |= FLAG_DMA | FLAG_EQ_DMA; else printf(RADEON_MSG" Can't allocate temopary buffer for DMA\n"); } else if(__verbose) printf(RADEON_MSG" Can't initialize busmastering: %s\n",strerror(errno)); #endif save_regs(); return 0; } void VIDIX_NAME(vixDestroy)( void ) { restore_regs(); unmap_phys_mem(radeon_mem_base,radeon_ram_size); unmap_phys_mem(radeon_mmio_base,0xFFFF); bm_close(); } int VIDIX_NAME(vixGetCapability)(vidix_capability_t *to) { memcpy(to,&def_cap,sizeof(vidix_capability_t)); return 0; } /* Full list of fourcc which are supported by Win2K radeon driver: YUY2, UYVY, DDES, OGLT, OGL2, OGLS, OGLB, OGNT, OGNZ, OGNS, IF09, YVU9, IMC4, M2IA, IYUV, VBID, DXT1, DXT2, DXT3, DXT4, DXT5 */ typedef struct fourcc_desc_s { uint32_t fourcc; unsigned max_srcw; }fourcc_desc_t; fourcc_desc_t supported_fourcc[] = { { IMGFMT_Y800, 1567 }, { IMGFMT_YVU9, 1567 }, { IMGFMT_IF09, 1567 }, { IMGFMT_YV12, 1567 }, { IMGFMT_I420, 1567 }, { IMGFMT_IYUV, 1567 }, { IMGFMT_UYVY, 1551 }, { IMGFMT_YUY2, 1551 }, { IMGFMT_YVYU, 1551 }, { IMGFMT_RGB15, 1551 }, { IMGFMT_BGR15, 1551 }, { IMGFMT_RGB16, 1551 }, { IMGFMT_BGR16, 1551 }, { IMGFMT_RGB32, 775 }, { IMGFMT_BGR32, 775 } }; __inline__ static int is_supported_fourcc(uint32_t fourcc,unsigned srcw) { unsigned i; for(i=0;ifourcc,to->srcw)) { to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP | VID_DEPTH_4BPP | VID_DEPTH_8BPP | VID_DEPTH_12BPP| VID_DEPTH_15BPP| VID_DEPTH_16BPP| VID_DEPTH_24BPP| VID_DEPTH_32BPP; to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY; return 0; } else to->depth = to->flags = 0; return ENOSYS; } static double H_scale_ratio; static void radeon_vid_dump_regs( void ) { size_t i; printf(RADEON_MSG"*** Begin of DRIVER variables dump ***\n"); printf(RADEON_MSG"radeon_mmio_base=%p\n",radeon_mmio_base); printf(RADEON_MSG"radeon_mem_base=%p\n",radeon_mem_base); printf(RADEON_MSG"radeon_overlay_off=%08X\n",radeon_overlay_off); printf(RADEON_MSG"radeon_ram_size=%08X\n",radeon_ram_size); printf(RADEON_MSG"video mode: %ux%u@%u\n",radeon_get_xres(),radeon_get_yres(),radeon_vid_get_dbpp()); printf(RADEON_MSG"H_scale_ratio=%8.2f\n",H_scale_ratio); printf(RADEON_MSG"*** Begin of OV0 registers dump ***\n"); for(i=0;i VERBOSE_LEVEL) printf(RADEON_MSG"we wanted: scaler=%08X\n",bes_flags); if(__verbose > VERBOSE_LEVEL) radeon_vid_dump_regs(); } /* Goal of this function: hide RGB background and provide black screen around movie. Useful in '-vo fbdev:vidix -fs -zoom' mode. Reverse effect to colorkey */ #ifdef RAGE128 static void radeon_vid_exclusive( void ) { /* this function works only with Rage128. Radeon should has something the same */ unsigned screenw,screenh; screenw = radeon_get_xres(); screenh = radeon_get_yres(); radeon_fifo_wait(2); OUTREG(OV0_EXCLUSIVE_VERT,(((screenh-1)<<16)&EXCL_VERT_END_MASK)); OUTREG(OV0_EXCLUSIVE_HORZ,(((screenw/8+1)<<8)&EXCL_HORZ_END_MASK)|EXCL_HORZ_EXCLUSIVE_EN); } static void radeon_vid_non_exclusive( void ) { OUTREG(OV0_EXCLUSIVE_HORZ,0); } #endif static unsigned radeon_query_pitch(unsigned fourcc,const vidix_yuv_t *spitch) { unsigned pitch,spy,spv,spu; spy = spv = spu = 0; switch(spitch->y) { case 16: case 32: case 64: case 128: case 256: spy = spitch->y; break; default: break; } switch(spitch->u) { case 16: case 32: case 64: case 128: case 256: spu = spitch->u; break; default: break; } switch(spitch->v) { case 16: case 32: case 64: case 128: case 256: spv = spitch->v; break; default: break; } switch(fourcc) { /* 4:2:0 */ case IMGFMT_IYUV: case IMGFMT_YV12: case IMGFMT_I420: if(spy > 16 && spu == spy/2 && spv == spy/2) pitch = spy; else pitch = 32; break; case IMGFMT_IF09: case IMGFMT_YVU9: if(spy >= 64 && spu == spy/4 && spv == spy/4) pitch = spy; else pitch = 64; break; default: if(spy >= 16) pitch = spy; else pitch = 16; break; } return pitch; } static void Calc_H_INC_STEP_BY ( int fieldvalue_OV0_SURFACE_FORMAT, double H_scale_ratio, int DisallowFourTapVertFiltering, int DisallowFourTapUVVertFiltering, uint32_t *val_OV0_P1_H_INC, uint32_t *val_OV0_P1_H_STEP_BY, uint32_t *val_OV0_P23_H_INC, uint32_t *val_OV0_P23_H_STEP_BY, int *P1GroupSize, int *P1StepSize, int *P23StepSize ) { double ClocksNeededFor16Pixels; switch (fieldvalue_OV0_SURFACE_FORMAT) { case 3: case 4: /*16BPP (ARGB1555 and RGB565) */ /* All colour components are fetched in pairs */ *P1GroupSize = 2; /* We don't support four tap in this mode because G's are split between two bytes. In theory we could support it if */ /* we saved part of the G when fetching the R, and then filter the G, followed by the B in the following cycles. */ if (H_scale_ratio>=.5) { /* We are actually generating two pixels (but 3 colour components) per tick. Thus we don't have to skip */ /* until we reach .5. P1 and P23 are the same. */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 1; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 1; *P1StepSize = 1; *P23StepSize = 1; } else if (H_scale_ratio>=.25) { /* Step by two */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 2; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 2; *P1StepSize = 2; *P23StepSize = 2; } else if (H_scale_ratio>=.125) { /* Step by four */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 3; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 3; *P1StepSize = 4; *P23StepSize = 4; } else if (H_scale_ratio>=.0625) { /* Step by eight */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 4; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 4; *P1StepSize = 8; *P23StepSize = 8; } else if (H_scale_ratio>=0.03125) { /* Step by sixteen */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*16)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 5; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*16)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 5; *P1StepSize = 16; *P23StepSize = 16; } else { H_scale_ratio=0.03125; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*16)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 5; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*16)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 5; *P1StepSize = 16; *P23StepSize = 16; } break; case 6: /*32BPP RGB */ if (H_scale_ratio>=1.5 && !DisallowFourTapVertFiltering) { /* All colour components are fetched in pairs */ *P1GroupSize = 2; /* With four tap filtering, we can generate two colour components every clock, or two pixels every three */ /* clocks. This means that we will have four tap filtering when scaling 1.5 or more. */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 0; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 0; *P1StepSize = 1; *P23StepSize = 1; } else if (H_scale_ratio>=0.75) { /* Four G colour components are fetched at once */ *P1GroupSize = 4; /* R and B colour components are fetched in pairs */ /* With two tap filtering, we can generate four colour components every clock. */ /* This means that we will have two tap filtering when scaling 1.0 or more. */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 1; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 1; *P1StepSize = 1; *P23StepSize = 1; } else if (H_scale_ratio>=0.375) { /* Step by two. */ /* Four G colour components are fetched at once */ *P1GroupSize = 4; /* R and B colour components are fetched in pairs */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 2; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 2; *P1StepSize = 2; *P23StepSize = 2; } else if (H_scale_ratio>=0.25) { /* Step by two. */ /* Four G colour components are fetched at once */ *P1GroupSize = 4; /* R and B colour components are fetched in pairs */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 2; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 3; *P1StepSize = 2; *P23StepSize = 4; } else if (H_scale_ratio>=0.1875) { /* Step by four */ /* Four G colour components are fetched at once */ *P1GroupSize = 4; /* R and B colour components are fetched in pairs */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 3; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 3; *P1StepSize = 4; *P23StepSize = 4; } else if (H_scale_ratio>=0.125) { /* Step by four */ /* Four G colour components are fetched at once */ *P1GroupSize = 4; /* R and B colour components are fetched in pairs */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 3; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 4; *P1StepSize = 4; *P23StepSize = 8; } else if (H_scale_ratio>=0.09375) { /* Step by eight */ /* Four G colour components are fetched at once */ *P1GroupSize = 4; /* R and B colour components are fetched in pairs */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 4; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 4; *P1StepSize = 8; *P23StepSize = 8; } else if (H_scale_ratio>=0.0625) { /* Step by eight */ /* Four G colour components are fetched at once */ *P1GroupSize = 4; /* R and B colour components are fetched in pairs */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*16)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 5; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*16)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 5; *P1StepSize = 16; *P23StepSize = 16; } else { H_scale_ratio=0.0625; *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*16)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 5; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*16)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 5; *P1StepSize = 16; *P23StepSize = 16; } break; case 9: /*ToDo_Active: In mode 9 there is a possibility that HScale ratio may be set to an illegal value, so we have extra conditions in the if statement. For consistancy, these conditions be added to the other modes as well. */ /* four tap on both (unless Y is too wide) */ if ((H_scale_ratio>=(ClocksNeededFor16Pixels=8+2+2) / 16.0) && ((uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5)<=0x2000) && !DisallowFourTapVertFiltering && !DisallowFourTapUVVertFiltering) { /*0.75 */ /* Colour components are fetched in pairs */ *P1GroupSize = 2; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 0; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 0; *P1StepSize = 1; *P23StepSize = 1; } /* two tap on Y (because it is too big for four tap), four tap on UV */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=4+2+2) / 16.0) && ((uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5)<=0x2000) && DisallowFourTapVertFiltering && !DisallowFourTapUVVertFiltering) { /*0.75 */ *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 1; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 0; *P1StepSize = 1; *P23StepSize = 1; } /* We scale the Y with the four tap filters, but UV's are generated with dual two tap configuration. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=8+1+1) / 16.0) && ((uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5)<=0x2000) && !DisallowFourTapVertFiltering) { /*0.625 */ *P1GroupSize = 2; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 0; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 1; *P1StepSize = 1; *P23StepSize = 1; } /* We scale the Y, U, and V with the two tap filters */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=4+1+1) / 16.0) && ((uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5)<=0x2000)) { /*0.375 */ *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 1; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 1; *P1StepSize = 1; *P23StepSize = 1; } /* We scale step the U and V by two to allow more bandwidth for fetching Y's, thus we won't drop Y's yet. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=4+.5+.5) / 16.0) && ((uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4*2)) * (1<<0xc) + 0.5)<=0x2000)) { /*>=0.3125 and >.333333~ */ *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 1; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4*2)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 2; *P1StepSize = 1; *P23StepSize = 2; } /* We step the Y, U, and V by two. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=2+.5+.5) / 16.0) && ((uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4*2)) * (1<<0xc) + 0.5)<=0x2000)) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 2; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4*2)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 2; *P1StepSize = 2; *P23StepSize = 2; } /* We step the Y by two and the U and V by four. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=2+.25+.25) / 16.0) && ((uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4*4)) * (1<<0xc) + 0.5)<=0x2000)) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 2; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 3; *P1StepSize = 2; *P23StepSize = 4; } /* We step the Y, U, and V by four. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=1+.25+.25) / 16.0) && ((uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4*4)) * (1<<0xc) + 0.5)<=0x2000)) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 3; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 3; *P1StepSize = 4; *P23StepSize = 4; } /* We would like to step the Y by four and the U and V by eight, but we can't mix step by 3 and step by 4 for packed modes */ /* We step the Y, U, and V by eight. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=.5+.125+.125) / 16.0) && ((uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4*8)) * (1<<0xc) + 0.5)<=0x2000)) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 4; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4*8)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 4; *P1StepSize = 8; *P23StepSize = 8; } /* We step the Y by eight and the U and V by sixteen. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=.5+.0625+.0625) / 16.0) && ((uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4*16)) * (1<<0xc) + 0.5)<=0x2000)) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 4; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4*16)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 5; *P1StepSize = 8; *P23StepSize = 16; } /* We step the Y, U, and V by sixteen. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=.25+.0625+.0625) / 16.0) && ((uint16_t)((1/(H_scale_ratio*16)) * (1<<0xc) + 0.5)<=0x3000) && ((uint16_t)((1/(H_scale_ratio*4*16)) * (1<<0xc) + 0.5)<=0x2000)) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*16)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 5; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4*16)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 5; *P1StepSize = 16; *P23StepSize = 16; } else { H_scale_ratio=(ClocksNeededFor16Pixels=.25+.0625+.0625) / 16; *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*16)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 5; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*4*16)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 5; *P1StepSize = 16; *P23StepSize = 16; } break; case 10: case 11: case 12: case 13: case 14: /* YUV12, VYUY422, YUYV422, YOverPkCRCB12, YWovenWithPkCRCB12 */ /* We scale the Y, U, and V with the four tap filters */ /* four tap on both (unless Y is too wide) */ if ((H_scale_ratio>=(ClocksNeededFor16Pixels=8+4+4) / 16.0) && !DisallowFourTapVertFiltering && !DisallowFourTapUVVertFiltering) { /*0.75 */ *P1GroupSize = 2; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 0; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 0; *P1StepSize = 1; *P23StepSize = 1; } /* two tap on Y (because it is too big for four tap), four tap on UV */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=4+4+4) / 16.0) && DisallowFourTapVertFiltering && !DisallowFourTapUVVertFiltering) { /*0.75 */ *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 1; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 0; *P1StepSize = 1; *P23StepSize = 1; } /* We scale the Y with the four tap filters, but UV's are generated with dual two tap configuration. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=8+2+2) / 16.0) && !DisallowFourTapVertFiltering) { /*0.625 */ *P1GroupSize = 2; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 0; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 1; *P1StepSize = 1; *P23StepSize = 1; } /* We scale the Y, U, and V with the two tap filters */ else if (H_scale_ratio>=(ClocksNeededFor16Pixels=4+2+2) / 16.0) { /*0.375 */ *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 1; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 1; *P1StepSize = 1; *P23StepSize = 1; } /* We scale step the U and V by two to allow more bandwidth for fetching Y's, thus we won't drop Y's yet. */ else if (H_scale_ratio>=(ClocksNeededFor16Pixels=4+1+1) / 16.0) { /*0.312 */ *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 1; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*2)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 2; *P1StepSize = 1; *P23StepSize = 2; } /* We step the Y, U, and V by two. */ else if (H_scale_ratio>=(ClocksNeededFor16Pixels=2+1+1) / 16.0) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 2; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*2)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 2; *P1StepSize = 2; *P23StepSize = 2; } /* We step the Y by two and the U and V by four. */ else if (H_scale_ratio>=(ClocksNeededFor16Pixels=2+.5+.5) / 16.0) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*2)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 2; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 3; *P1StepSize = 2; *P23StepSize = 4; } /* We step the Y, U, and V by four. */ else if (H_scale_ratio>=(ClocksNeededFor16Pixels=1+.5+.5) / 16.0) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 3; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*4)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 3; *P1StepSize = 4; *P23StepSize = 4; } /* We step the Y by four and the U and V by eight. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=1+.25+.25) / 16.0) && (fieldvalue_OV0_SURFACE_FORMAT==10)) { *P1GroupSize = 4; /* Can't mix step by 3 and step by 4 for packed modes */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*4)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 3; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*8)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 4; *P1StepSize = 4; *P23StepSize = 8; } /* We step the Y, U, and V by eight. */ else if (H_scale_ratio>=(ClocksNeededFor16Pixels=.5+.25+.25) / 16.0) { *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 4; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*8)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 4; *P1StepSize = 8; *P23StepSize = 8; } /* We step the Y by eight and the U and V by sixteen. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=.5+.125+.125) / 16.0) && (fieldvalue_OV0_SURFACE_FORMAT==10)) { *P1GroupSize = 4; /* Step by 5 not supported for packed modes */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 4; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*16)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 5; *P1StepSize = 8; *P23StepSize = 16; } /* We step the Y, U, and V by sixteen. */ else if ((H_scale_ratio>=(ClocksNeededFor16Pixels=.25+.125+.125) / 16.0) && (fieldvalue_OV0_SURFACE_FORMAT==10)) { *P1GroupSize = 4; /* Step by 5 not supported for packed modes */ *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*16)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 5; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*16)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 5; *P1StepSize = 16; *P23StepSize = 16; } else { if (fieldvalue_OV0_SURFACE_FORMAT==10) { H_scale_ratio=(ClocksNeededFor16Pixels=.25+.125+.125) / 16; *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*16)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 5; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*16)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 5; *P1StepSize = 16; *P23StepSize = 16; } else { H_scale_ratio=(ClocksNeededFor16Pixels=.5+.25+.25) / 16; *P1GroupSize = 4; *val_OV0_P1_H_INC = (uint16_t)((1/(H_scale_ratio*8)) * (1<<0xc) + 0.5); *val_OV0_P1_H_STEP_BY = 4; *val_OV0_P23_H_INC = (uint16_t)((1/(H_scale_ratio*2*8)) * (1<<0xc) + 0.5); *val_OV0_P23_H_STEP_BY = 4; *P1StepSize = 8; *P23StepSize = 8; } } break; default: break; } besr.h_inc = (*(val_OV0_P1_H_INC)&0x3fff) | ((*(val_OV0_P23_H_INC)&0x3fff)<<16); besr.step_by = (*(val_OV0_P1_H_STEP_BY)&0x7) | ((*(val_OV0_P23_H_STEP_BY)&0x7)<<8); } /* ********************************************************* */ /* ** Setup Black Bordering */ /* ********************************************************* */ static void ComputeBorders( vidix_playback_t *config, int VertUVSubSample ) { double tempBLANK_LINES_AT_TOP; unsigned TopLine,BottomLine,SourceLinesUsed,TopUVLine,BottomUVLine,SourceUVLinesUsed; uint32_t val_OV0_P1_ACTIVE_LINES_M1,val_OV0_P1_BLNK_LN_AT_TOP_M1; uint32_t val_OV0_P23_ACTIVE_LINES_M1,val_OV0_P23_BLNK_LN_AT_TOP_M1; if (floor(config->src.y)<0) { tempBLANK_LINES_AT_TOP = -floor(config->src.y); TopLine = 0; } else { tempBLANK_LINES_AT_TOP = 0; TopLine = (int)floor(config->src.y); } /* Round rSrcBottom up and subtract one */ if (ceil(config->src.y+config->src.h) > config->src.h) { BottomLine = config->src.h - 1; } else { BottomLine = (int)ceil(config->src.y+config->src.h) - 1; } if (BottomLine >= TopLine) { SourceLinesUsed = BottomLine - TopLine + 1; } else { /*CYCACC_ASSERT(0, "SourceLinesUsed less than or equal to zero.") */ SourceLinesUsed = 1; } { int SourceHeightInPixels; SourceHeightInPixels = BottomLine - TopLine + 1; } val_OV0_P1_ACTIVE_LINES_M1 = SourceLinesUsed - 1; val_OV0_P1_BLNK_LN_AT_TOP_M1 = ((int)tempBLANK_LINES_AT_TOP-1) & 0xfff; TopUVLine = ((int)(config->src.y/VertUVSubSample) < 0) ? 0: (int)(config->src.y/VertUVSubSample); /* Round rSrcTop down */ BottomUVLine = (ceil(((config->src.y+config->src.h)/VertUVSubSample)) > (config->src.h/VertUVSubSample)) ? (config->src.h/VertUVSubSample)-1 : (int)ceil(((config->src.y+config->src.h)/VertUVSubSample))-1; if (BottomUVLine >= TopUVLine) { SourceUVLinesUsed = BottomUVLine - TopUVLine + 1; } else { /*CYCACC_ASSERT(0, "SourceUVLinesUsed less than or equal to zero.") */ SourceUVLinesUsed = 1; } val_OV0_P23_ACTIVE_LINES_M1 = SourceUVLinesUsed - 1; val_OV0_P23_BLNK_LN_AT_TOP_M1 = ((int)(tempBLANK_LINES_AT_TOP/VertUVSubSample)-1) & 0x7ff; besr.p1_blank_lines_at_top = (val_OV0_P1_BLNK_LN_AT_TOP_M1 & 0xfff) | ((val_OV0_P1_ACTIVE_LINES_M1 & 0xfff) << 16); besr.p23_blank_lines_at_top = (val_OV0_P23_BLNK_LN_AT_TOP_M1 & 0x7ff) | ((val_OV0_P23_ACTIVE_LINES_M1 & 0x7ff) << 16); } static void ComputeXStartEnd( int is_400, uint32_t LeftPixel,uint32_t LeftUVPixel, uint32_t MemWordsInBytes,uint32_t BytesPerPixel, uint32_t SourceWidthInPixels, uint32_t P1StepSize, uint32_t BytesPerUVPixel,uint32_t SourceUVWidthInPixels, uint32_t P23StepSize, uint32_t *p1_x_start, uint32_t *p2_x_start ) { uint32_t val_OV0_P1_X_START,val_OV0_P2_X_START,val_OV0_P3_X_START; uint32_t val_OV0_P1_X_END,val_OV0_P2_X_END,val_OV0_P3_X_END; /* ToDo_Active: At the moment we are not using iOV0_VID_BUF?_START_PIX, but instead // are using iOV0_P?_X_START and iOV0_P?_X_END. We should use "start pix" and // "width" to derive the start and end. */ val_OV0_P1_X_START = (int)LeftPixel % (MemWordsInBytes/BytesPerPixel); val_OV0_P1_X_END = (int)((val_OV0_P1_X_START + SourceWidthInPixels - 1) / P1StepSize) * P1StepSize; val_OV0_P2_X_START = val_OV0_P2_X_END = 0; switch (besr.surf_id) { case 9: case 10: case 13: case 14: /* ToDo_Active: The driver must insure that the initial value is */ /* a multiple of a power of two when decimating */ val_OV0_P2_X_START = (int)LeftUVPixel % (MemWordsInBytes/BytesPerUVPixel); val_OV0_P2_X_END = (int)((val_OV0_P2_X_START + SourceUVWidthInPixels - 1) / P23StepSize) * P23StepSize; break; case 11: case 12: val_OV0_P2_X_START = (int)LeftUVPixel % (MemWordsInBytes/(BytesPerPixel*2)); val_OV0_P2_X_END = (int)((val_OV0_P2_X_START + SourceUVWidthInPixels - 1) / P23StepSize) * P23StepSize; break; case 3: case 4: val_OV0_P2_X_START = val_OV0_P1_X_START; /* This value is needed only to allow proper setting of */ /* val_OV0_PRESHIFT_P23_TO */ /* val_OV0_P2_X_END = 0; */ break; case 6: val_OV0_P2_X_START = (int)LeftPixel % (MemWordsInBytes/BytesPerPixel); val_OV0_P2_X_END = (int)((val_OV0_P1_X_START + SourceWidthInPixels - 1) / P23StepSize) * P23StepSize; break; default: /* insert debug statement here. */ RADEON_ASSERT("unknown fourcc\n"); break; } val_OV0_P3_X_START = val_OV0_P2_X_START; val_OV0_P3_X_END = val_OV0_P2_X_END; besr.p1_x_start_end = (val_OV0_P1_X_END&0x7ff) | ((val_OV0_P1_X_START&0x7ff)<<16); besr.p2_x_start_end = (val_OV0_P2_X_END&0x7ff) | ((val_OV0_P2_X_START&0x7ff)<<16); besr.p3_x_start_end = (val_OV0_P3_X_END&0x7ff) | ((val_OV0_P3_X_START&0x7ff)<<16); if(is_400) { besr.p2_x_start_end = 0; besr.p3_x_start_end = 0; } *p1_x_start = val_OV0_P1_X_START; *p2_x_start = val_OV0_P2_X_START; } static void ComputeAccumInit( uint32_t val_OV0_P1_X_START,uint32_t val_OV0_P2_X_START, uint32_t val_OV0_P1_H_INC,uint32_t val_OV0_P23_H_INC, uint32_t val_OV0_P1_H_STEP_BY,uint32_t val_OV0_P23_H_STEP_BY, uint32_t CRT_V_INC, uint32_t P1GroupSize, uint32_t P23GroupSize, uint32_t val_OV0_P1_MAX_LN_IN_PER_LN_OUT, uint32_t val_OV0_P23_MAX_LN_IN_PER_LN_OUT) { uint32_t val_OV0_P1_H_ACCUM_INIT,val_OV0_PRESHIFT_P1_TO; uint32_t val_OV0_P23_H_ACCUM_INIT,val_OV0_PRESHIFT_P23_TO; uint32_t val_OV0_P1_V_ACCUM_INIT,val_OV0_P23_V_ACCUM_INIT; /* 2.5 puts the kernal 50% of the way between the source pixel that is off screen */ /* and the first on-screen source pixel. "(float)valOV0_P?_H_INC / (1<<0xc)" is */ /* the distance (in source pixel coordinates) to the center of the first */ /* destination pixel. Need to add additional pixels depending on how many pixels */ /* are fetched at a time and how many pixels in a set are masked. */ /* P23 values are always fetched in groups of two or four. If the start */ /* pixel does not fall on the boundary, then we need to shift preshift for */ /* some additional pixels */ { double ExtraHalfPixel; double tempAdditionalShift; double tempP1HStartPoint; double tempP23HStartPoint; double tempP1Init; double tempP23Init; if (besr.horz_pick_nearest) ExtraHalfPixel = 0.5; else ExtraHalfPixel = 0.0; tempAdditionalShift = val_OV0_P1_X_START % P1GroupSize + ExtraHalfPixel; tempP1HStartPoint = tempAdditionalShift + 2.5 + ((float)val_OV0_P1_H_INC / (1<<0xd)); tempP1Init = (double)((int)(tempP1HStartPoint * (1<<0x5) + 0.5)) / (1<<0x5); /* P23 values are always fetched in pairs. If the start pixel is odd, then we */ /* need to shift an additional pixel */ /* Note that if the pitch is a multiple of two, and if we store fields using */ /* the traditional planer format where the V plane and the U plane share the */ /* same pitch, then OverlayRegFields->val_OV0_P2_X_START % P23Group */ /* OverlayRegFields->val_OV0_P3_X_START % P23GroupSize. Either way */ /* it is a requirement that the U and V start on the same polarity byte */ /* (even or odd). */ tempAdditionalShift = val_OV0_P2_X_START % P23GroupSize + ExtraHalfPixel; tempP23HStartPoint = tempAdditionalShift + 2.5 + ((float)val_OV0_P23_H_INC / (1<<0xd)); tempP23Init = (double)((int)(tempP23HStartPoint * (1<<0x5) + 0.5)) / (1 << 0x5); val_OV0_P1_H_ACCUM_INIT = (int)((tempP1Init - (int)tempP1Init) * (1<<0x5)); val_OV0_PRESHIFT_P1_TO = (int)tempP1Init; val_OV0_P23_H_ACCUM_INIT = (int)((tempP23Init - (int)tempP23Init) * (1<<0x5)); val_OV0_PRESHIFT_P23_TO = (int)tempP23Init; } /* ************************************************************** */ /* ** Calculate values for initializing the vertical accumulators */ /* ************************************************************** */ { double ExtraHalfLine; double ExtraFullLine; double tempP1VStartPoint; double tempP23VStartPoint; if (besr.vert_pick_nearest) ExtraHalfLine = 0.5; else ExtraHalfLine = 0.0; if (val_OV0_P1_H_STEP_BY==0)ExtraFullLine = 1.0; else ExtraFullLine = 0.0; tempP1VStartPoint = 1.5 + ExtraFullLine + ExtraHalfLine + ((float)CRT_V_INC / (1<<0xd)); if (tempP1VStartPoint>2.5 + 2*ExtraFullLine) { tempP1VStartPoint = 2.5 + 2*ExtraFullLine; } val_OV0_P1_V_ACCUM_INIT = (int)(tempP1VStartPoint * (1<<0x5) + 0.5); if (val_OV0_P23_H_STEP_BY==0)ExtraFullLine = 1.0; else ExtraFullLine = 0.0; switch (besr.surf_id) { case 10: case 13: case 14: tempP23VStartPoint = 1.5 + ExtraFullLine + ExtraHalfLine + ((float)CRT_V_INC / (1<<0xe)); break; case 9: tempP23VStartPoint = 1.5 + ExtraFullLine + ExtraHalfLine + ((float)CRT_V_INC / (1<<0xf)); break; case 3: case 4: case 6: case 11: case 12: tempP23VStartPoint = 0; break; default: tempP23VStartPoint = 0xFFFF;/* insert debug statement here */ break; } if (tempP23VStartPoint>2.5 + 2*ExtraFullLine) { tempP23VStartPoint = 2.5 + 2*ExtraFullLine; } val_OV0_P23_V_ACCUM_INIT = (int)(tempP23VStartPoint * (1<<0x5) + 0.5); } besr.p1_h_accum_init = ((val_OV0_P1_H_ACCUM_INIT&0x1f)<<15) |((val_OV0_PRESHIFT_P1_TO&0xf)<<28); besr.p1_v_accum_init = (val_OV0_P1_MAX_LN_IN_PER_LN_OUT&0x3) |((val_OV0_P1_V_ACCUM_INIT&0x7ff)<<15); besr.p23_h_accum_init= ((val_OV0_P23_H_ACCUM_INIT&0x1f)<<15) |((val_OV0_PRESHIFT_P23_TO&0xf)<<28); besr.p23_v_accum_init= (val_OV0_P23_MAX_LN_IN_PER_LN_OUT&0x3)|((val_OV0_P23_V_ACCUM_INIT&0x3ff)<<15); } typedef struct RangeAndCoefSet { double Range; signed char CoefSet[5][4]; } RANGEANDCOEFSET; /* Filter Setup Routine */ static void FilterSetup ( uint32_t val_OV0_P1_H_INC ) { static RANGEANDCOEFSET ArrayOfSets[] = { {0.25, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.26, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.27, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.28, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.29, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.30, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.31, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.32, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.33, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.34, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.35, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.36, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.37, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.38, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.39, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.40, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.41, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.42, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.43, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.44, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.45, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.46, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.47, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.48, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.49, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.50, {{ 7, 16, 9, 0}, { 7, 16, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 3, 13, 13, 3}, }}, {0.51, {{ 7, 17, 8, 0}, { 6, 17, 9, 0}, { 5, 15, 11, 1}, { 4, 15, 12, 1}, { 2, 14, 14, 2}, }}, {0.52, {{ 7, 17, 8, 0}, { 6, 17, 9, 0}, { 5, 16, 11, 0}, { 3, 15, 13, 1}, { 2, 14, 14, 2}, }}, {0.53, {{ 7, 17, 8, 0}, { 6, 17, 9, 0}, { 5, 16, 11, 0}, { 3, 15, 13, 1}, { 2, 14, 14, 2}, }}, {0.54, {{ 7, 17, 8, 0}, { 6, 17, 9, 0}, { 4, 17, 11, 0}, { 3, 15, 13, 1}, { 2, 14, 14, 2}, }}, {0.55, {{ 7, 18, 7, 0}, { 6, 17, 9, 0}, { 4, 17, 11, 0}, { 3, 15, 13, 1}, { 1, 15, 15, 1}, }}, {0.56, {{ 7, 18, 7, 0}, { 5, 18, 9, 0}, { 4, 17, 11, 0}, { 2, 17, 13, 0}, { 1, 15, 15, 1}, }}, {0.57, {{ 7, 18, 7, 0}, { 5, 18, 9, 0}, { 4, 17, 11, 0}, { 2, 17, 13, 0}, { 1, 15, 15, 1}, }}, {0.58, {{ 7, 18, 7, 0}, { 5, 18, 9, 0}, { 4, 17, 11, 0}, { 2, 17, 13, 0}, { 1, 15, 15, 1}, }}, {0.59, {{ 7, 18, 7, 0}, { 5, 18, 9, 0}, { 4, 17, 11, 0}, { 2, 17, 13, 0}, { 1, 15, 15, 1}, }}, {0.60, {{ 7, 18, 8, -1}, { 6, 17, 10, -1}, { 4, 17, 11, 0}, { 2, 17, 13, 0}, { 1, 15, 15, 1}, }}, {0.61, {{ 7, 18, 8, -1}, { 6, 17, 10, -1}, { 4, 17, 11, 0}, { 2, 17, 13, 0}, { 1, 15, 15, 1}, }}, {0.62, {{ 7, 18, 8, -1}, { 6, 17, 10, -1}, { 4, 17, 11, 0}, { 2, 17, 13, 0}, { 1, 15, 15, 1}, }}, {0.63, {{ 7, 18, 8, -1}, { 6, 17, 10, -1}, { 4, 17, 11, 0}, { 2, 17, 13, 0}, { 1, 15, 15, 1}, }}, {0.64, {{ 7, 18, 8, -1}, { 6, 17, 10, -1}, { 4, 17, 12, -1}, { 2, 17, 13, 0}, { 1, 15, 15, 1}, }}, {0.65, {{ 7, 18, 8, -1}, { 6, 17, 10, -1}, { 4, 17, 12, -1}, { 2, 17, 13, 0}, { 0, 16, 16, 0}, }}, {0.66, {{ 7, 18, 8, -1}, { 6, 18, 10, -2}, { 4, 17, 12, -1}, { 2, 17, 13, 0}, { 0, 16, 16, 0}, }}, {0.67, {{ 7, 20, 7, -2}, { 5, 19, 10, -2}, { 3, 18, 12, -1}, { 2, 17, 13, 0}, { 0, 16, 16, 0}, }}, {0.68, {{ 7, 20, 7, -2}, { 5, 19, 10, -2}, { 3, 19, 12, -2}, { 1, 18, 14, -1}, { 0, 16, 16, 0}, }}, {0.69, {{ 7, 20, 7, -2}, { 5, 19, 10, -2}, { 3, 19, 12, -2}, { 1, 18, 14, -1}, { 0, 16, 16, 0}, }}, {0.70, {{ 7, 20, 7, -2}, { 5, 20, 9, -2}, { 3, 19, 12, -2}, { 1, 18, 14, -1}, { 0, 16, 16, 0}, }}, {0.71, {{ 7, 20, 7, -2}, { 5, 20, 9, -2}, { 3, 19, 12, -2}, { 1, 18, 14, -1}, { 0, 16, 16, 0}, }}, {0.72, {{ 7, 20, 7, -2}, { 5, 20, 9, -2}, { 2, 20, 12, -2}, { 0, 19, 15, -2}, {-1, 17, 17, -1}, }}, {0.73, {{ 7, 20, 7, -2}, { 4, 21, 9, -2}, { 2, 20, 12, -2}, { 0, 19, 15, -2}, {-1, 17, 17, -1}, }}, {0.74, {{ 6, 22, 6, -2}, { 4, 21, 9, -2}, { 2, 20, 12, -2}, { 0, 19, 15, -2}, {-1, 17, 17, -1}, }}, {0.75, {{ 6, 22, 6, -2}, { 4, 21, 9, -2}, { 1, 21, 12, -2}, { 0, 19, 15, -2}, {-1, 17, 17, -1}, }}, {0.76, {{ 6, 22, 6, -2}, { 4, 21, 9, -2}, { 1, 21, 12, -2}, { 0, 19, 15, -2}, {-1, 17, 17, -1}, }}, {0.77, {{ 6, 22, 6, -2}, { 3, 22, 9, -2}, { 1, 22, 12, -3}, { 0, 19, 15, -2}, {-2, 18, 18, -2}, }}, {0.78, {{ 6, 21, 6, -1}, { 3, 22, 9, -2}, { 1, 22, 12, -3}, { 0, 19, 15, -2}, {-2, 18, 18, -2}, }}, {0.79, {{ 5, 23, 5, -1}, { 3, 22, 9, -2}, { 0, 23, 12, -3}, {-1, 21, 15, -3}, {-2, 18, 18, -2}, }}, {0.80, {{ 5, 23, 5, -1}, { 3, 23, 8, -2}, { 0, 23, 12, -3}, {-1, 21, 15, -3}, {-2, 18, 18, -2}, }}, {0.81, {{ 5, 23, 5, -1}, { 2, 24, 8, -2}, { 0, 23, 12, -3}, {-1, 21, 15, -3}, {-2, 18, 18, -2}, }}, {0.82, {{ 5, 23, 5, -1}, { 2, 24, 8, -2}, { 0, 23, 12, -3}, {-1, 21, 15, -3}, {-3, 19, 19, -3}, }}, {0.83, {{ 5, 23, 5, -1}, { 2, 24, 8, -2}, { 0, 23, 11, -2}, {-2, 22, 15, -3}, {-3, 19, 19, -3}, }}, {0.84, {{ 4, 25, 4, -1}, { 1, 25, 8, -2}, { 0, 23, 11, -2}, {-2, 22, 15, -3}, {-3, 19, 19, -3}, }}, {0.85, {{ 4, 25, 4, -1}, { 1, 25, 8, -2}, { 0, 23, 11, -2}, {-2, 22, 15, -3}, {-3, 19, 19, -3}, }}, {0.86, {{ 4, 24, 4, 0}, { 1, 25, 7, -1}, {-1, 24, 11, -2}, {-2, 22, 15, -3}, {-3, 19, 19, -3}, }}, {0.87, {{ 4, 24, 4, 0}, { 1, 25, 7, -1}, {-1, 24, 11, -2}, {-2, 22, 15, -3}, {-3, 19, 19, -3}, }}, {0.88, {{ 3, 26, 3, 0}, { 0, 26, 7, -1}, {-1, 24, 11, -2}, {-3, 23, 15, -3}, {-3, 19, 19, -3}, }}, {0.89, {{ 3, 26, 3, 0}, { 0, 26, 7, -1}, {-1, 24, 11, -2}, {-3, 23, 15, -3}, {-3, 19, 19, -3}, }}, {0.90, {{ 3, 26, 3, 0}, { 0, 26, 7, -1}, {-2, 25, 11, -2}, {-3, 23, 15, -3}, {-3, 19, 19, -3}, }}, {0.91, {{ 3, 26, 3, 0}, { 0, 27, 6, -1}, {-2, 25, 11, -2}, {-3, 23, 15, -3}, {-3, 19, 19, -3}, }}, {0.92, {{ 2, 28, 2, 0}, { 0, 27, 6, -1}, {-2, 25, 11, -2}, {-3, 23, 15, -3}, {-3, 19, 19, -3}, }}, {0.93, {{ 2, 28, 2, 0}, { 0, 26, 6, 0}, {-2, 25, 10, -1}, {-3, 23, 15, -3}, {-3, 19, 19, -3}, }}, {0.94, {{ 2, 28, 2, 0}, { 0, 26, 6, 0}, {-2, 25, 10, -1}, {-3, 23, 15, -3}, {-3, 19, 19, -3}, }}, {0.95, {{ 1, 30, 1, 0}, {-1, 28, 5, 0}, {-3, 26, 10, -1}, {-3, 23, 14, -2}, {-3, 19, 19, -3}, }}, {0.96, {{ 1, 30, 1, 0}, {-1, 28, 5, 0}, {-3, 26, 10, -1}, {-3, 23, 14, -2}, {-3, 19, 19, -3}, }}, {0.97, {{ 1, 30, 1, 0}, {-1, 28, 5, 0}, {-3, 26, 10, -1}, {-3, 23, 14, -2}, {-3, 19, 19, -3}, }}, {0.98, {{ 1, 30, 1, 0}, {-2, 29, 5, 0}, {-3, 27, 9, -1}, {-3, 23, 14, -2}, {-3, 19, 19, -3}, }}, {0.99, {{ 0, 32, 0, 0}, {-2, 29, 5, 0}, {-3, 27, 9, -1}, {-4, 24, 14, -2}, {-3, 19, 19, -3}, }}, {1.00, {{ 0, 32, 0, 0}, {-2, 29, 5, 0}, {-3, 27, 9, -1}, {-4, 24, 14, -2}, {-3, 19, 19, -3}, }} }; double DSR; unsigned ArrayElement; DSR = (double)(1<<0xc)/val_OV0_P1_H_INC; if (DSR<.25) DSR=.25; if (DSR>1) DSR=1; ArrayElement = (int)((DSR-0.25) * 100); besr.four_tap_coeff[0] = (ArrayOfSets[ArrayElement].CoefSet[0][0] & 0xf) | ((ArrayOfSets[ArrayElement].CoefSet[0][1] & 0x7f)<<8) | ((ArrayOfSets[ArrayElement].CoefSet[0][2] & 0x7f)<<16) | ((ArrayOfSets[ArrayElement].CoefSet[0][3] & 0xf)<<24); besr.four_tap_coeff[1] = (ArrayOfSets[ArrayElement].CoefSet[1][0] & 0xf) | ((ArrayOfSets[ArrayElement].CoefSet[1][1] & 0x7f)<<8) | ((ArrayOfSets[ArrayElement].CoefSet[1][2] & 0x7f)<<16) | ((ArrayOfSets[ArrayElement].CoefSet[1][3] & 0xf)<<24); besr.four_tap_coeff[2] = (ArrayOfSets[ArrayElement].CoefSet[2][0] & 0xf) | ((ArrayOfSets[ArrayElement].CoefSet[2][1] & 0x7f)<<8) | ((ArrayOfSets[ArrayElement].CoefSet[2][2] & 0x7f)<<16) | ((ArrayOfSets[ArrayElement].CoefSet[2][3] & 0xf)<<24); besr.four_tap_coeff[3] = (ArrayOfSets[ArrayElement].CoefSet[3][0] & 0xf) | ((ArrayOfSets[ArrayElement].CoefSet[3][1] & 0x7f)<<8) | ((ArrayOfSets[ArrayElement].CoefSet[3][2] & 0x7f)<<16) | ((ArrayOfSets[ArrayElement].CoefSet[3][3] & 0xf)<<24); besr.four_tap_coeff[4] = (ArrayOfSets[ArrayElement].CoefSet[4][0] & 0xf) | ((ArrayOfSets[ArrayElement].CoefSet[4][1] & 0x7f)<<8) | ((ArrayOfSets[ArrayElement].CoefSet[4][2] & 0x7f)<<16) | ((ArrayOfSets[ArrayElement].CoefSet[4][3] & 0xf)<<24); /* For more details, refer to Microsoft's draft of PC99. */ } /* The minimal value of horizontal scale ratio when hard coded coefficients are suitable for the best quality. */ /* FIXME: Should it be 0.9 for Rage128 ??? */ const double MinHScaleHard=0.75; static int radeon_vid_init_video( vidix_playback_t *config ) { double V_scale_ratio; uint32_t i,src_w,src_h,dest_w,dest_h,pitch,left,leftUV,top,h_inc; uint32_t val_OV0_P1_H_INC,val_OV0_P1_H_STEP_BY,val_OV0_P23_H_INC,val_OV0_P23_H_STEP_BY; uint32_t val_OV0_P1_X_START,val_OV0_P2_X_START; uint32_t val_OV0_P1_MAX_LN_IN_PER_LN_OUT,val_OV0_P23_MAX_LN_IN_PER_LN_OUT; uint32_t CRT_V_INC; uint32_t BytesPerOctWord,LogMemWordsInBytes,MemWordsInBytes,LogTileWidthInMemWords; uint32_t TileWidthInMemWords,TileWidthInBytes,LogTileHeight,TileHeight; uint32_t PageSizeInBytes,OV0LB_Rows; uint32_t SourceWidthInMemWords,SourceUVWidthInMemWords; uint32_t SourceWidthInPixels,SourceUVWidthInPixels; uint32_t RightPixel,RightUVPixel,LeftPixel,LeftUVPixel; int is_400,is_410,is_420,best_pitch,mpitch; int horz_repl_factor,interlace_factor; int BytesPerPixel,BytesPerUVPixel,HorzUVSubSample,VertUVSubSample; int DisallowFourTapVertFiltering,DisallowFourTapUVVertFiltering; radeon_vid_stop_video(); left = config->src.x << 16; top = config->src.y << 16; src_h = config->src.h; src_w = config->src.w; is_400 = is_410 = is_420 = 0; if(config->fourcc == IMGFMT_YV12 || config->fourcc == IMGFMT_I420 || config->fourcc == IMGFMT_IYUV) is_420 = 1; if(config->fourcc == IMGFMT_YVU9 || config->fourcc == IMGFMT_IF09) is_410 = 1; if(config->fourcc == IMGFMT_Y800) is_400 = 1; best_pitch = radeon_query_pitch(config->fourcc,&config->src.pitch); mpitch = best_pitch-1; BytesPerOctWord = 16; LogMemWordsInBytes = 4; MemWordsInBytes = 1<fourcc) { /* 4:0:0*/ case IMGFMT_Y800: /* 4:1:0*/ case IMGFMT_YVU9: case IMGFMT_IF09: /* 4:2:0 */ case IMGFMT_IYUV: case IMGFMT_YV12: case IMGFMT_I420: pitch = (src_w + mpitch) & ~mpitch; config->dest.pitch.y = config->dest.pitch.u = config->dest.pitch.v = best_pitch; break; /* RGB 4:4:4:4 */ case IMGFMT_RGB32: case IMGFMT_BGR32: pitch = (src_w*4 + mpitch) & ~mpitch; config->dest.pitch.y = config->dest.pitch.u = config->dest.pitch.v = best_pitch; break; /* 4:2:2 */ default: /* RGB15, RGB16, YVYU, UYVY, YUY2 */ pitch = ((src_w*2) + mpitch) & ~mpitch; config->dest.pitch.y = config->dest.pitch.u = config->dest.pitch.v = best_pitch; break; } besr.load_prg_start=0; besr.swap_uv=0; switch(config->fourcc) { case IMGFMT_RGB15: besr.swap_uv=1; case IMGFMT_BGR15: besr.surf_id = SCALER_SOURCE_15BPP>>8; besr.load_prg_start = 1; break; case IMGFMT_RGB16: besr.swap_uv=1; case IMGFMT_BGR16: besr.surf_id = SCALER_SOURCE_16BPP>>8; besr.load_prg_start = 1; break; case IMGFMT_RGB32: besr.swap_uv=1; case IMGFMT_BGR32: besr.surf_id = SCALER_SOURCE_32BPP>>8; besr.load_prg_start = 1; break; /* 4:1:0*/ case IMGFMT_IF09: case IMGFMT_YVU9: besr.surf_id = SCALER_SOURCE_YUV9>>8; break; /* 4:0:0*/ case IMGFMT_Y800: /* 4:2:0 */ case IMGFMT_IYUV: case IMGFMT_I420: case IMGFMT_YV12: besr.surf_id = SCALER_SOURCE_YUV12>>8; break; /* 4:2:2 */ case IMGFMT_YVYU: case IMGFMT_UYVY: besr.surf_id = SCALER_SOURCE_YVYU422>>8; break; case IMGFMT_YUY2: default: besr.surf_id = SCALER_SOURCE_VYUY422>>8; break; } switch (besr.surf_id) { case 3: case 4: case 11: case 12: BytesPerPixel = 2; break; case 6: BytesPerPixel = 4; break; case 9: case 10: case 13: case 14: BytesPerPixel = 1; break; default: BytesPerPixel = 0;/*insert a debug statement here. */ break; } switch (besr.surf_id) { case 3: case 4: BytesPerUVPixel = 0; break;/* In RGB modes, the BytesPerUVPixel is don't care */ case 11: case 12: BytesPerUVPixel = 2; break; case 6: BytesPerUVPixel = 0; break; /* In RGB modes, the BytesPerUVPixel is don't care */ case 9: case 10: BytesPerUVPixel = 1; break; case 13: case 14: BytesPerUVPixel = 2; break; default: BytesPerUVPixel = 0;/* insert a debug statement here. */ break; } switch (besr.surf_id) { case 3: case 4: case 6: HorzUVSubSample = 1; break; case 9: HorzUVSubSample = 4; break; case 10: case 11: case 12: case 13: case 14: HorzUVSubSample = 2; break; default: HorzUVSubSample = 0;/* insert debug statement here. */ break; } switch (besr.surf_id) { case 3: case 4: case 6: case 11: case 12: VertUVSubSample = 1; break; case 9: VertUVSubSample = 4; break; case 10: case 13: case 14: VertUVSubSample = 2; break; default: VertUVSubSample = 0;/* insert debug statment here. */ break; } DisallowFourTapVertFiltering = 0; /* Allow it by default */ DisallowFourTapUVVertFiltering = 0; /* Allow it by default */ LeftPixel = config->src.x; RightPixel = config->src.w-1; if(floor(config->src.x/HorzUVSubSample)<0) LeftUVPixel = 0; else LeftUVPixel = (int)floor(config->src.x/HorzUVSubSample); if(ceil((config->src.x+config->src.w)/HorzUVSubSample) > config->src.w/HorzUVSubSample) RightUVPixel = config->src.w/HorzUVSubSample - 1; else RightUVPixel = (int)ceil((config->src.x+config->src.w)/HorzUVSubSample) - 1; /* Top, Bottom and Right Crops can be out of range. The driver will program the hardware // to create a black border at the top and bottom. This is useful for DVD letterboxing. */ SourceWidthInPixels = (int)(config->src.w + 1); SourceUVWidthInPixels = (int)(RightUVPixel - LeftUVPixel + 1); SourceWidthInMemWords = (int)(ceil(RightPixel*BytesPerPixel / MemWordsInBytes) - floor(LeftPixel*BytesPerPixel / MemWordsInBytes) + 1); /* SourceUVWidthInMemWords means Source_U_or_V_or_UV_WidthInMemWords depending on whether the UV is packed together of not. */ SourceUVWidthInMemWords = (int)(ceil(RightUVPixel*BytesPerUVPixel / MemWordsInBytes) - floor(LeftUVPixel*BytesPerUVPixel / MemWordsInBytes) + 1); switch (besr.surf_id) { case 9: case 10: if ((ceil(SourceWidthInMemWords/2)-1) * 2 > OV0LB_Rows-1) { RADEON_ASSERT("ceil(SourceWidthInMemWords/2)-1) * 2 > OV0LB_Rows-1\n"); } else if ((SourceWidthInMemWords-1) * 2 > OV0LB_Rows-1) { DisallowFourTapVertFiltering = 1; } if ((ceil(SourceUVWidthInMemWords/2)-1) * 4 + 1 > OV0LB_Rows-1) { /*CYCACC_ASSERT(0, "Image U plane width spans more octwords than supported by hardware.") */ } else if ((SourceUVWidthInMemWords-1) * 4 + 1 > OV0LB_Rows-1) { DisallowFourTapUVVertFiltering = 1; } if ((ceil(SourceUVWidthInMemWords/2)-1) * 4 + 3 > OV0LB_Rows-1) { /*CYCACC_ASSERT(0, "Image V plane width spans more octwords than supported by hardware.") */ } else if ((SourceUVWidthInMemWords-1) * 4 + 3 > OV0LB_Rows-1) { DisallowFourTapUVVertFiltering = 1; } break; case 13: case 14: if ((ceil(SourceWidthInMemWords/2)-1) * 2 > OV0LB_Rows-1) { RADEON_ASSERT("ceil(SourceWidthInMemWords/2)-1) * 2 > OV0LB_Rows-1\n"); } else if ((SourceWidthInMemWords-1) * 2 > OV0LB_Rows-1) { DisallowFourTapVertFiltering = 1; } if ((ceil(SourceUVWidthInMemWords/2)-1) * 2 + 1 > OV0LB_Rows-1) { /*CYCACC_ASSERT(0, "Image UV plane width spans more octwords than supported by hardware.") */ } else if ((SourceUVWidthInMemWords-1) * 2 + 1 > OV0LB_Rows-1) { DisallowFourTapUVVertFiltering = 1; } break; case 3: case 4: case 6: case 11: case 12: if ((ceil(SourceWidthInMemWords/2)-1) > OV0LB_Rows-1) { RADEON_ASSERT("(ceil(SourceWidthInMemWords/2)-1) > OV0LB_Rows-1\n") } else if ((SourceWidthInMemWords-1) > OV0LB_Rows-1) { DisallowFourTapVertFiltering = 1; } break; default: /* insert debug statement here. */ break; } dest_w = config->dest.w; dest_h = config->dest.h; if(radeon_is_dbl_scan()) dest_h *= 2; besr.dest_bpp = radeon_vid_get_dbpp(); besr.fourcc = config->fourcc; if(radeon_is_interlace()) interlace_factor = 2; else interlace_factor = 1; /* TODO: must be checked in doublescan mode!!! */ horz_repl_factor = 1 << (uint32_t)((INPLL(VCLK_ECP_CNTL) & 0x300) >> 8); H_scale_ratio = (double)ceil(((double)dest_w+1)/horz_repl_factor)/src_w; V_scale_ratio = (double)(dest_h+1)/src_h; if(H_scale_ratio < 0.5 && V_scale_ratio < 0.5) { val_OV0_P1_MAX_LN_IN_PER_LN_OUT = 3; val_OV0_P23_MAX_LN_IN_PER_LN_OUT = 2; } else if(H_scale_ratio < 1 && V_scale_ratio < 1) { val_OV0_P1_MAX_LN_IN_PER_LN_OUT = 2; val_OV0_P23_MAX_LN_IN_PER_LN_OUT = 1; } else { val_OV0_P1_MAX_LN_IN_PER_LN_OUT = 1; val_OV0_P23_MAX_LN_IN_PER_LN_OUT = 1; } /* N.B.: Indeed it has 6.12 format but shifted on 8 to the left!!! */ besr.v_inc = (uint16_t)((1./V_scale_ratio)*(1<<12)*interlace_factor+0.5); CRT_V_INC = besr.v_inc/interlace_factor; besr.v_inc <<= 8; { int ThereIsTwoTapVerticalFiltering,DoNotUseMostRecentlyFetchedLine; int P1GroupSize; int P23GroupSize; int P1StepSize; int P23StepSize; Calc_H_INC_STEP_BY( besr.surf_id, H_scale_ratio, DisallowFourTapVertFiltering, DisallowFourTapUVVertFiltering, &val_OV0_P1_H_INC, &val_OV0_P1_H_STEP_BY, &val_OV0_P23_H_INC, &val_OV0_P23_H_STEP_BY, &P1GroupSize, &P1StepSize, &P23StepSize); if(H_scale_ratio > MinHScaleHard) { h_inc = (src_w << 12) / dest_w; besr.step_by = 0x0101; switch (besr.surf_id) { case 3: case 4: case 6: besr.h_inc = (h_inc)|(h_inc<<16); break; case 9: besr.h_inc = h_inc | ((h_inc >> 2) << 16); break; default: besr.h_inc = h_inc | ((h_inc >> 1) << 16); break; } } P23GroupSize = 2; /* Current vaue for all modes */ besr.horz_pick_nearest=0; DoNotUseMostRecentlyFetchedLine=0; ThereIsTwoTapVerticalFiltering = (val_OV0_P1_H_STEP_BY!=0) || (val_OV0_P23_H_STEP_BY!=0); if (ThereIsTwoTapVerticalFiltering && DoNotUseMostRecentlyFetchedLine) besr.vert_pick_nearest = 1; else besr.vert_pick_nearest = 0; ComputeXStartEnd(is_400,LeftPixel,LeftUVPixel,MemWordsInBytes,BytesPerPixel, SourceWidthInPixels,P1StepSize,BytesPerUVPixel, SourceUVWidthInPixels,P23StepSize,&val_OV0_P1_X_START,&val_OV0_P2_X_START); if(H_scale_ratio > MinHScaleHard) { unsigned tmp; tmp = (left & 0x0003ffff) + 0x00028000 + (h_inc << 3); besr.p1_h_accum_init = ((tmp << 4) & 0x000f8000) | ((tmp << 12) & 0xf0000000); tmp = (top & 0x0000ffff) + 0x00018000; besr.p1_v_accum_init = ((tmp << 4) & OV0_P1_V_ACCUM_INIT_MASK) |(OV0_P1_MAX_LN_IN_PER_LN_OUT & 1); tmp = ((left >> 1) & 0x0001ffff) + 0x00028000 + (h_inc << 2); besr.p23_h_accum_init = ((tmp << 4) & 0x000f8000) | ((tmp << 12) & 0x70000000); tmp = ((top >> 1) & 0x0000ffff) + 0x00018000; besr.p23_v_accum_init = (is_420||is_410) ? ((tmp << 4) & OV0_P23_V_ACCUM_INIT_MASK) |(OV0_P23_MAX_LN_IN_PER_LN_OUT & 1) : 0; } else ComputeAccumInit( val_OV0_P1_X_START,val_OV0_P2_X_START, val_OV0_P1_H_INC,val_OV0_P23_H_INC, val_OV0_P1_H_STEP_BY,val_OV0_P23_H_STEP_BY, CRT_V_INC,P1GroupSize,P23GroupSize, val_OV0_P1_MAX_LN_IN_PER_LN_OUT, val_OV0_P23_MAX_LN_IN_PER_LN_OUT); } /* keep everything in 16.16 */ besr.base_addr = INREG(DISPLAY_BASE_ADDR); config->offsets[0] = 0; for(i=1;ioffsets[i] = config->offsets[i-1]+config->frame_size; if(is_420 || is_410 || is_400) { uint32_t d1line,d2line,d3line; d1line = top*pitch; if(is_420) { d2line = src_h*pitch+(d1line>>2); d3line = d2line+((src_h*pitch)>>2); } else if(is_410) { d2line = src_h*pitch+(d1line>>4); d3line = d2line+((src_h*pitch)>>4); } else { d2line = 0; d3line = 0; } d1line += (left >> 16) & ~15; if(is_420) { d2line += (left >> 17) & ~15; d3line += (left >> 17) & ~15; } else /* is_410 */ { d2line += (left >> 18) & ~15; d3line += (left >> 18) & ~15; } config->offset.y = d1line & VIF_BUF0_BASE_ADRS_MASK; if(is_400) { config->offset.v = 0; config->offset.u = 0; } else { config->offset.v = d2line & VIF_BUF1_BASE_ADRS_MASK; config->offset.u = d3line & VIF_BUF2_BASE_ADRS_MASK; } for(i=0;ioffsets[i]+config->offset.y)&VIF_BUF0_BASE_ADRS_MASK); if(is_400) { besr.vid_buf_base_adrs_v[i]=0; besr.vid_buf_base_adrs_u[i]=0; } else { besr.vid_buf_base_adrs_v[i]=((radeon_overlay_off+config->offsets[i]+config->offset.v)&VIF_BUF1_BASE_ADRS_MASK)|VIF_BUF1_PITCH_SEL; besr.vid_buf_base_adrs_u[i]=((radeon_overlay_off+config->offsets[i]+config->offset.u)&VIF_BUF2_BASE_ADRS_MASK)|VIF_BUF2_PITCH_SEL; } } config->offset.y = ((besr.vid_buf_base_adrs_y[0])&VIF_BUF0_BASE_ADRS_MASK) - radeon_overlay_off; if(is_400) { config->offset.v = 0; config->offset.u = 0; } else { config->offset.v = ((besr.vid_buf_base_adrs_v[0])&VIF_BUF1_BASE_ADRS_MASK) - radeon_overlay_off; config->offset.u = ((besr.vid_buf_base_adrs_u[0])&VIF_BUF2_BASE_ADRS_MASK) - radeon_overlay_off; } if(besr.fourcc == IMGFMT_I420 || besr.fourcc == IMGFMT_IYUV) { uint32_t tmp; tmp = config->offset.u; config->offset.u = config->offset.v; config->offset.v = tmp; } } else { config->offset.y = config->offset.u = config->offset.v = ((left & ~7) << 1)&VIF_BUF0_BASE_ADRS_MASK; for(i=0;ioffsets[i] + config->offset.y; } } leftUV = (left >> (is_410?18:17)) & 15; left = (left >> 16) & 15; besr.y_x_start = (config->dest.x+X_ADJUST) | (config->dest.y << 16); besr.y_x_end = (config->dest.x + dest_w+X_ADJUST) | ((config->dest.y + dest_h) << 16); ComputeBorders(config,VertUVSubSample); besr.vid_buf_pitch0_value = pitch; besr.vid_buf_pitch1_value = is_410 ? pitch>>2 : is_420 ? pitch>>1 : pitch; /* ********************************************************* */ /* ** Calculate programmable coefficients as needed */ /* ********************************************************* */ /* ToDo_Active: When in pick nearest mode, we need to program the filter tap zero */ /* coefficients to 0, 32, 0, 0. Or use hard coded coefficients. */ if(H_scale_ratio > MinHScaleHard) besr.filter_cntl |= FILTER_HARDCODED_COEF; else { FilterSetup (val_OV0_P1_H_INC); /* ToDo_Active: Must add the smarts into the driver to decide what type of filtering it */ /* would like to do. For now, we let the test application decide. */ besr.filter_cntl = FILTER_PROGRAMMABLE_COEF; if(DisallowFourTapVertFiltering) besr.filter_cntl |= FILTER_HARD_SCALE_VERT_Y; if(DisallowFourTapUVVertFiltering) besr.filter_cntl |= FILTER_HARD_SCALE_VERT_UV; } return 0; } static void radeon_compute_framesize(vidix_playback_t *info) { unsigned pitch,awidth,dbpp; pitch = radeon_query_pitch(info->fourcc,&info->src.pitch); dbpp = radeon_vid_get_dbpp(); switch(info->fourcc) { case IMGFMT_Y800: awidth = (info->src.w + (pitch-1)) & ~(pitch-1); info->frame_size = awidth*info->src.h; break; case IMGFMT_YVU9: case IMGFMT_IF09: awidth = (info->src.w + (pitch-1)) & ~(pitch-1); info->frame_size = awidth*(info->src.h+info->src.h/8); break; case IMGFMT_I420: case IMGFMT_YV12: case IMGFMT_IYUV: awidth = (info->src.w + (pitch-1)) & ~(pitch-1); info->frame_size = awidth*(info->src.h+info->src.h/2); break; case IMGFMT_RGB32: case IMGFMT_BGR32: awidth = (info->src.w*4 + (pitch-1)) & ~(pitch-1); info->frame_size = awidth*info->src.h; break; /* YUY2 YVYU, RGB15, RGB16 */ default: awidth = (info->src.w*2 + (pitch-1)) & ~(pitch-1); info->frame_size = awidth*info->src.h; break; } info->frame_size = (info->frame_size+4095)&~4095; } int VIDIX_NAME(vixConfigPlayback)(vidix_playback_t *info) { unsigned rgb_size,nfr; uint32_t radeon_video_size; if(!is_supported_fourcc(info->fourcc,info->src.w)) return ENOSYS; if(info->num_frames>VID_PLAY_MAXFRAMES) info->num_frames=VID_PLAY_MAXFRAMES; if(info->num_frames==1) besr.double_buff=0; else besr.double_buff=1; radeon_compute_framesize(info); rgb_size = radeon_get_xres()*radeon_get_yres()*((radeon_vid_get_dbpp()+7)/8); nfr = info->num_frames; radeon_video_size = radeon_ram_size; #ifdef RADEON_ENABLE_BM if(def_cap.flags & FLAG_DMA) { /* every descriptor describes one 4K page and takes 16 bytes in memory Note: probably it's ont good idea to locate them in video memory but as initial release it's OK */ radeon_video_size -= radeon_ram_size * sizeof(bm_list_descriptor) / 4096; radeon_dma_desc_base = pci_info.base0 + radeon_video_size; } #endif for(;nfr>0; nfr--) { radeon_overlay_off = radeon_video_size - info->frame_size*nfr; radeon_overlay_off &= 0xffff0000; if(radeon_overlay_off >= (int)rgb_size ) break; } if(nfr <= 3) { nfr = info->num_frames; for(;nfr>0; nfr--) { radeon_overlay_off = radeon_video_size - info->frame_size*nfr; radeon_overlay_off &= 0xffff0000; if(radeon_overlay_off > 0) break; } } if(nfr <= 0) return EINVAL; info->num_frames = nfr; besr.vid_nbufs = info->num_frames; info->dga_addr = (char *)radeon_mem_base + radeon_overlay_off; radeon_vid_init_video(info); return 0; } int VIDIX_NAME(vixPlaybackOn)( void ) { #ifdef RAGE128 unsigned dw,dh; #endif radeon_vid_display_video(); #ifdef RAGE128 dh = (besr.y_x_end >> 16) - (besr.y_x_start >> 16); dw = (besr.y_x_end & 0xFFFF) - (besr.y_x_start & 0xFFFF); if(dw == radeon_get_xres() || dh == radeon_get_yres()) radeon_vid_exclusive(); else radeon_vid_non_exclusive(); #endif return 0; } int VIDIX_NAME(vixPlaybackOff)( void ) { radeon_vid_stop_video(); return 0; } int VIDIX_NAME(vixPlaybackFrameSelect)(unsigned frame) { uint32_t off[6]; int prev_frame= (frame-1+besr.vid_nbufs) % besr.vid_nbufs; /* buf3-5 always should point onto second buffer for better deinterlacing and TV-in */ if(!besr.double_buff) return 0; if(frame > besr.vid_nbufs) frame = besr.vid_nbufs-1; if(prev_frame > (int)besr.vid_nbufs) prev_frame = besr.vid_nbufs-1; off[0] = besr.vid_buf_base_adrs_y[frame]; off[1] = besr.vid_buf_base_adrs_v[frame]; off[2] = besr.vid_buf_base_adrs_u[frame]; off[3] = besr.vid_buf_base_adrs_y[prev_frame]; off[4] = besr.vid_buf_base_adrs_v[prev_frame]; off[5] = besr.vid_buf_base_adrs_u[prev_frame]; radeon_fifo_wait(8); OUTREG(OV0_REG_LOAD_CNTL, REG_LD_CTL_LOCK); radeon_engine_idle(); while(!(INREG(OV0_REG_LOAD_CNTL)®_LD_CTL_LOCK_READBACK)); OUTREG(OV0_VID_BUF0_BASE_ADRS, off[0]); OUTREG(OV0_VID_BUF1_BASE_ADRS, off[1]); OUTREG(OV0_VID_BUF2_BASE_ADRS, off[2]); OUTREG(OV0_VID_BUF3_BASE_ADRS, off[3]); OUTREG(OV0_VID_BUF4_BASE_ADRS, off[4]); OUTREG(OV0_VID_BUF5_BASE_ADRS, off[5]); OUTREG(OV0_REG_LOAD_CNTL, 0); if(besr.vid_nbufs == 2) radeon_wait_vsync(); if(__verbose > VERBOSE_LEVEL) radeon_vid_dump_regs(); return 0; } vidix_video_eq_t equal = { VEQ_CAP_BRIGHTNESS | VEQ_CAP_SATURATION #ifndef RAGE128 | VEQ_CAP_CONTRAST | VEQ_CAP_HUE | VEQ_CAP_RGB_INTENSITY #endif , 0, 0, 0, 0, 0, 0, 0, 0 }; int VIDIX_NAME(vixPlaybackGetEq)( vidix_video_eq_t * eq) { memcpy(eq,&equal,sizeof(vidix_video_eq_t)); return 0; } #ifndef RAGE128 #define RTFSaturation(a) (1.0 + ((a)*1.0)/1000.0) #define RTFBrightness(a) (((a)*1.0)/2000.0) #define RTFIntensity(a) (((a)*1.0)/2000.0) #define RTFContrast(a) (1.0 + ((a)*1.0)/1000.0) #define RTFHue(a) (((a)*3.1416)/1000.0) #define RTFCheckParam(a) {if((a)<-1000) (a)=-1000; if((a)>1000) (a)=1000;} #endif int VIDIX_NAME(vixPlaybackSetEq)( const vidix_video_eq_t * eq) { #ifdef RAGE128 int br,sat; #else int itu_space; #endif if(eq->cap & VEQ_CAP_BRIGHTNESS) equal.brightness = eq->brightness; if(eq->cap & VEQ_CAP_CONTRAST) equal.contrast = eq->contrast; if(eq->cap & VEQ_CAP_SATURATION) equal.saturation = eq->saturation; if(eq->cap & VEQ_CAP_HUE) equal.hue = eq->hue; if(eq->cap & VEQ_CAP_RGB_INTENSITY) { equal.red_intensity = eq->red_intensity; equal.green_intensity = eq->green_intensity; equal.blue_intensity = eq->blue_intensity; } equal.flags = eq->flags; #ifdef RAGE128 br = equal.brightness * 64 / 1000; if(br < -64) br = -64; if(br > 63) br = 63; sat = (equal.saturation*31 + 31000) / 2000; if(sat < 0) sat = 0; if(sat > 31) sat = 31; OUTREG(OV0_COLOUR_CNTL, (br & 0x7f) | (sat << 8) | (sat << 16)); #else itu_space = equal.flags == VEQ_FLG_ITU_R_BT_709 ? 1 : 0; RTFCheckParam(equal.brightness); RTFCheckParam(equal.saturation); RTFCheckParam(equal.contrast); RTFCheckParam(equal.hue); RTFCheckParam(equal.red_intensity); RTFCheckParam(equal.green_intensity); RTFCheckParam(equal.blue_intensity); radeon_set_transform(RTFBrightness(equal.brightness), RTFContrast(equal.contrast), RTFSaturation(equal.saturation), RTFHue(equal.hue), RTFIntensity(equal.red_intensity), RTFIntensity(equal.green_intensity), RTFIntensity(equal.blue_intensity), itu_space); #endif return 0; } int VIDIX_NAME(vixPlaybackSetDeint)( const vidix_deinterlace_t * info) { unsigned sflg; switch(info->flags) { default: case CFG_NON_INTERLACED: besr.deinterlace_on = 0; break; case CFG_EVEN_ODD_INTERLACING: case CFG_INTERLACED: besr.deinterlace_on = 1; besr.deinterlace_pattern = 0x900AAAAA; break; case CFG_ODD_EVEN_INTERLACING: besr.deinterlace_on = 1; besr.deinterlace_pattern = 0x00055555; break; case CFG_UNIQUE_INTERLACING: besr.deinterlace_on = 1; besr.deinterlace_pattern = info->deinterlace_pattern; break; } OUTREG(OV0_REG_LOAD_CNTL, REG_LD_CTL_LOCK); radeon_engine_idle(); while(!(INREG(OV0_REG_LOAD_CNTL)®_LD_CTL_LOCK_READBACK)); radeon_fifo_wait(15); sflg = INREG(OV0_SCALE_CNTL); if(besr.deinterlace_on) { OUTREG(OV0_SCALE_CNTL,sflg | SCALER_ADAPTIVE_DEINT); OUTREG(OV0_DEINTERLACE_PATTERN,besr.deinterlace_pattern); } else OUTREG(OV0_SCALE_CNTL,sflg & (~SCALER_ADAPTIVE_DEINT)); OUTREG(OV0_REG_LOAD_CNTL, 0); return 0; } int VIDIX_NAME(vixPlaybackGetDeint)( vidix_deinterlace_t * info) { if(!besr.deinterlace_on) info->flags = CFG_NON_INTERLACED; else { info->flags = CFG_UNIQUE_INTERLACING; info->deinterlace_pattern = besr.deinterlace_pattern; } return 0; } /* Graphic keys */ static vidix_grkey_t radeon_grkey; static void set_gr_key( void ) { if(radeon_grkey.ckey.op == CKEY_TRUE) { int dbpp=radeon_vid_get_dbpp(); besr.ckey_on=1; switch(dbpp) { case 15: #ifndef RAGE128 if(RadeonFamily > 100) besr.graphics_key_clr= ((radeon_grkey.ckey.blue &0xF8)) | ((radeon_grkey.ckey.green&0xF8)<<8) | ((radeon_grkey.ckey.red &0xF8)<<16); else #endif besr.graphics_key_clr= ((radeon_grkey.ckey.blue &0xF8)>>3) | ((radeon_grkey.ckey.green&0xF8)<<2) | ((radeon_grkey.ckey.red &0xF8)<<7); break; case 16: #ifndef RAGE128 /* This test may be too general/specific */ if(RadeonFamily > 100) besr.graphics_key_clr= ((radeon_grkey.ckey.blue &0xF8)) | ((radeon_grkey.ckey.green&0xFC)<<8) | ((radeon_grkey.ckey.red &0xF8)<<16); else #endif besr.graphics_key_clr= ((radeon_grkey.ckey.blue &0xF8)>>3) | ((radeon_grkey.ckey.green&0xFC)<<3) | ((radeon_grkey.ckey.red &0xF8)<<8); break; case 24: besr.graphics_key_clr= ((radeon_grkey.ckey.blue &0xFF)) | ((radeon_grkey.ckey.green&0xFF)<<8) | ((radeon_grkey.ckey.red &0xFF)<<16); break; case 32: besr.graphics_key_clr= ((radeon_grkey.ckey.blue &0xFF)) | ((radeon_grkey.ckey.green&0xFF)<<8) | ((radeon_grkey.ckey.red &0xFF)<<16); break; default: besr.ckey_on=0; besr.graphics_key_msk=0; besr.graphics_key_clr=0; } #ifdef RAGE128 besr.graphics_key_msk=(1<dest_offset + dmai->size > radeon_ram_size) return E2BIG; n = dmai->size / 4096; if(dmai->size % 4096) n++; if((retval = bm_virt_to_bus(dmai->src,dmai->size,dma_phys_addrs)) != 0) return retval; dest_ptr = dmai->dest_offset; count = dmai->size; for(i=0;i 4096 ? 4096 : count | BM_END_OF_LIST)|BM_FORCE_TO_PCI; #else list[i].command = (count > 4096 ? 4096 : count | DMA_GUI_COMMAND__EOL); #endif list[i].reserved = 0; printf("RADEON_DMA_TABLE[%i] %X %X %X %X\n",i,list[i].framebuf_offset,list[i].sys_addr,list[i].command,list[i].reserved); dest_ptr += 4096; count -= 4096; } return 0; } static int radeon_transfer_frame( void ) { unsigned i; radeon_engine_idle(); for(i=0;i<1000;i++) INREG(BUS_CNTL); /* FlushWriteCombining */ OUTREG(BUS_CNTL,(INREG(BUS_CNTL) | BUS_STOP_REQ_DIS)&(~BUS_MASTER_DIS)); #ifdef RAGE128 OUTREG(BM_CHUNK_0_VAL,0x000000FF | BM_GLOBAL_FORCE_TO_PCI); OUTREG(BM_CHUNK_1_VAL,0x0F0F0F0F); OUTREG(BM_VIP0_BUF,bus_addr_dma_desc|SYSTEM_TRIGGER_SYSTEM_TO_VIDEO); // OUTREG(GEN_INT_STATUS,INREG(GEN_INT_STATUS)|0x00010000); #else OUTREG(MC_FB_LOCATION, ((pci_info.base0>>16)&0xffff)| ((pci_info.base0+INREG(CONFIG_APER_SIZE)-1)&0xffff0000)); if((INREG(MC_AGP_LOCATION)&0xffff)!= (((pci_info.base0+INREG(CONFIG_APER_SIZE))>>16)&0xffff)) /*Radeon memory controller is misconfigured*/ return EINVAL; OUTREG(DMA_VID_ACT_DSCRPTR,bus_addr_dma_desc); // OUTREG(GEN_INT_STATUS,INREG(GEN_INT_STATUS)|(1<<30)); #endif OUTREG(GEN_INT_STATUS,INREG(GEN_INT_STATUS)|0x00010000); return 0; } int VIDIX_NAME(vixPlaybackCopyFrame)( vidix_dma_t * dmai ) { int retval; if(mlock(dmai->src,dmai->size) != 0) return errno; retval = radeon_setup_frame(dmai); if(retval == 0) retval = radeon_transfer_frame(); munlock(dmai->src,dmai->size); return retval; } int VIDIX_NAME(vixQueryDMAStatus)( void ) { int bm_active; #if 1 //def RAGE128 bm_active=(INREG(GEN_INT_STATUS)&0x00010000)==0?1:0; #else bm_active=(INREG(GEN_INT_STATUS)&(1<<30))==0?1:0; #endif return bm_active?1:0; } #endif avifile-0.7.48~20090503.ds/drivers/vidix/Makefile.am0000644000175000017500000000374411110353622020600 0ustar yavoryavornoinst_HEADERS =\ drivers/glint_regs.h\ drivers/mach64.h\ drivers/nvidia.h\ drivers/pm3_regs.h\ drivers/radeon.h\ fourcc.h\ vidix.h\ vidixlib.h EXTRA_DIST =\ drivers/Makefile.mp\ README\ vidix.txt if AMM_USE_VIDIX noinst_LTLIBRARIES = libvidix.la pkglib_LTLIBRARIES =\ libgenfb.la\ libmach64.la\ libmga_crtc2.la\ libmga.la\ libpm3.la\ libradeon.la\ librage128.la endif libvidix_la_SOURCES = vidixlib.c libvidix_la_LIBADD = ../libdha/libdha.la $(DL_LIBS) -lm pkglibdir = $(libdir)/$(PACKAGE)/vidix # just debug driver # libnvidia.la CLEANFILES = rage128_vid.c mga_crtc2_vid.c all-recursive: $(CLEANFILES) mga_crtc2_vid.c: drivers/mga_vid.c -echo "#define CRTC2 1" >mga_crtc2_vid.c -echo "#include \"drivers/mga_vid.c\"" >>mga_crtc2_vid.c rage128_vid.c: drivers/radeon_vid.c -echo "#define RAGE128 1" >rage128_vid.c -echo "#include \"drivers/radeon_vid.c\"" >>rage128_vid.c VIDLDFLAGS = -module -avoid-version libgenfb_la_SOURCES = drivers/genfb_vid.c libgenfb_la_LIBADD = $(libvidix_la_LIBADD) libgenfb_la_LDFLAGS = $(VIDLDFLAGS) libmach64_la_SOURCES = drivers/mach64_vid.c libmach64_la_LIBADD = $(libvidix_la_LIBADD) libmach64_la_LDFLAGS = $(VIDLDFLAGS) libmga_crtc2_la_SOURCES = mga_crtc2_vid.c #libmga_crtc2_la_CFLAGS = -DCRTC2 libmga_crtc2_la_LIBADD = $(libvidix_la_LIBADD) libmga_crtc2_la_LDFLAGS = $(VIDLDFLAGS) libmga_la_SOURCES = drivers/mga_vid.c libmga_la_LIBADD = $(libvidix_la_LIBADD) libmga_la_LDFLAGS = $(VIDLDFLAGS) #libnvidia_la_SOURCES = drivers/nvidia_vid.c #libnvidia_la_LIBADD = $(VIDLIBS) #libnvidia_la_LDFLAGS = $(VIDLDFLAGS) libpm3_la_SOURCES = drivers/pm3_vid.c libpm3_la_LIBADD = $(libvidix_la_LIBADD) libpm3_la_LDFLAGS = $(VIDLDFLAGS) libradeon_la_SOURCES = drivers/radeon_vid.c libradeon_la_LIBADD = $(libvidix_la_LIBADD) libradeon_la_LDFLAGS = $(VIDLDFLAGS) librage128_la_SOURCES = rage128_vid.c #librage128_la_CPPFLAGS = -DRAGE128 librage128_la_LIBADD = $(libvidix_la_LIBADD) librage128_la_LDFLAGS = $(VIDLDFLAGS) MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/drivers/vidix/Makefile.mp0000644000175000017500000000227707532425317020635 0ustar yavoryavorLIBNAME = libvidix.so BINDIR = $(prefix)/lib INCDIR = $(prefix)/include/vidix SUBDIRS = drivers DO_MAKE = @ for i in $(SUBDIRS); do $(MAKE) -C $$i $@ || exit; done include ../config.mak SRCS = vidixlib.c OBJS = $(SRCS:.c=.o) CFLAGS = $(OPTFLAGS) -W -Wall .SUFFIXES: .c .o # .PHONY: all clean .c.o: $(CC) -c $(CFLAGS) -o $@ $< all: $(SUBDIRS) $(LIBNAME) $(DO_MAKE) $(LIBNAME): $(OBJS) $(LD) -shared -soname $(LIBNAME) -o $(LIBNAME) $(OBJS) -lc -ldl clean: rm -f *.o $(LIBNAME) *~ $(DO_MAKE) distclean: rm -f test *.o $(LIBNAME) *~ .depend $(DO_MAKE) dep: depend $(DO_MAKE) depend: $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend install: $(DO_MAKE) mkdir -p $(BINDIR) install -m 755 -s -p $(LIBNAME) $(BINDIR) ifeq ($(TARGET_OS),OpenBSD) $(LDCONFIG) -R else $(LDCONFIG) endif mkdir -p $(INCDIR) install -m 644 fourcc.h $(INCDIR)/fourcc.h install -m 644 vidix.h $(INCDIR)/vidix.h install -m 644 vidixlib.h $(INCDIR)/vidixlib.h uninstall: $(DO_MAKE) rm -f $(BINDIR)/$(LIBNAME) rmdir -p --ignore-fail-on-non-empty $(BINDIR) rm -f $(INCDIR)/* rmdir -p --ignore-fail-on-non-empty $(INCDIR) # # include dependency files if they exist # ifneq ($(wildcard .depend),) include .depend endif avifile-0.7.48~20090503.ds/drivers/vidix/README0000644000175000017500000000051507532425606017434 0ustar yavoryavorVIDIX - Video Interface for *niX. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This library was designed and introduced as interface to userspace drivers to provide DGA everywhere where it's possible (unline X11). I hope that these drivers will be portable same as X11 (not only on *nix). For detail on how to develop new driver see vidix.txt avifile-0.7.48~20090503.ds/drivers/vidix/fourcc.h0000644000175000017500000000744307622470275020217 0ustar yavoryavor/* * fourcc.h * This file is part of VIDIX * Copyright 2002 Nick Kurshev * Licence: GPL * This interface is based on v4l2, fbvid.h, mga_vid.h projects * and personally my ideas. */ #ifndef FOURCC_H #define FOURCC_H /* Four-character-code (FOURCC) */ #define vid_fourcc(a,b,c,d)\ (((unsigned)(a)<<0)|((unsigned)(b)<<8)|((unsigned)(c)<<16)|((unsigned)(d)<<24)) /* RGB fourcc */ #define IMGFMT_RGB332 vid_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */ #define IMGFMT_RGB555 vid_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */ #define IMGFMT_RGB565 vid_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */ #define IMGFMT_RGB555X vid_fourcc('R','G','B','Q') /* 16 RGB-5-5-5 BE */ #define IMGFMT_RGB565X vid_fourcc('R','G','B','R') /* 16 RGB-5-6-5 BE */ #define IMGFMT_BGR15 vid_fourcc('B','G','R',15) /* 15 BGR-5-5-5 */ #define IMGFMT_RGB15 vid_fourcc('R','G','B',15) /* 15 RGB-5-5-5 */ #define IMGFMT_BGR16 vid_fourcc('B','G','R',16) /* 32 BGR-5-6-5 */ #define IMGFMT_RGB16 vid_fourcc('R','G','B',16) /* 32 RGB-5-6-5 */ #define IMGFMT_BGR24 vid_fourcc('B','G','R',24) /* 24 BGR-8-8-8 */ #define IMGFMT_RGB24 vid_fourcc('R','G','B',24) /* 24 RGB-8-8-8 */ #define IMGFMT_BGR32 vid_fourcc('B','G','R',32) /* 32 BGR-8-8-8-8 */ #define IMGFMT_RGB32 vid_fourcc('R','G','B',32) /* 32 RGB-8-8-8-8 */ /* Planar YUV Formats */ #define IMGFMT_YVU9 vid_fourcc('Y','V','U','9') /* 9 YVU 4:1:0 */ #define IMGFMT_IF09 vid_fourcc('I','F','0','9') /* 9.5 YUV 4:1:0 */ #define IMGFMT_YV12 vid_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */ #define IMGFMT_I420 vid_fourcc('I','4','2','0') /* 12 YUV 4:2:0 */ #define IMGFMT_IYUV vid_fourcc('I','Y','U','V') /* 12 YUV 4:2:0 */ #define IMGFMT_CLPL vid_fourcc('C','L','P','L') /* 12 */ #define IMGFMT_Y800 vid_fourcc('Y','8','0','0') /* 8 Y Grayscale */ #define IMGFMT_NV12 vid_fourcc('N','V','1','2') /* 8 Y Grayscale */ #define IMGFMT_Y8 vid_fourcc('Y','8',' ',' ') /* 8 Y Grayscale */ /* Packed YUV Formats */ #define IMGFMT_IUYV vid_fourcc('I','U','Y','V') /* 16 line order {0,2,4,...1,3,5} */ #define IMGFMT_IY41 vid_fourcc('I','Y','4','1') /* 12 line order {0,2,4,...1,3,5} */ #define IMGFMT_IYU1 vid_fourcc('I','Y','U','1') /* 12 IEEE 1394 Digital Camera */ #define IMGFMT_IYU2 vid_fourcc('I','Y','U','2') /* 24 IEEE 1394 Digital Camera */ #define IMGFMT_UYVY vid_fourcc('U','Y','V','Y') /* 16 UYVY 4:2:2 */ #define IMGFMT_UYNV vid_fourcc('U','Y','N','V') /* 16 UYVY 4:2:2 */ #define IMGFMT_cyuv vid_fourcc('c','y','u','v') /* 16 */ #define IMGFMT_Y422 vid_fourcc('Y','4','2','2') /* 16 UYVY 4:2:2 */ #define IMGFMT_YUY2 vid_fourcc('Y','U','Y','2') /* 16 YUYV 4:2:2 */ #define IMGFMT_YUNV vid_fourcc('Y','U','N','V') /* 16 YUYV 4:2:2 */ #define IMGFMT_YVYU vid_fourcc('Y','V','Y','U') /* 16 YVYU 4:2:2 */ #define IMGFMT_Y41P vid_fourcc('Y','4','1','P') /* 12 YUV 4:1:1 */ #define IMGFMT_Y211 vid_fourcc('Y','2','1','1') /* 8.5 YUV 2:1:1 */ #define IMGFMT_Y41T vid_fourcc('Y','4','1','T') /* 12 YUV 4:1:1 */ #define IMGFMT_Y42T vid_fourcc('Y','4','2','T') /* 16 UYVU 4:2:2 */ #define IMGFMT_V422 vid_fourcc('V','4','2','2') /* 16 YUY2 4:2:2 */ #define IMGFMT_V655 vid_fourcc('V','6','5','5') /* 16 YUV 4:2:2 */ #define IMGFMT_CLJR vid_fourcc('C','L','J','R') /* 7.9 YUV 4:1:1 */ #define IMGFMT_YUVP vid_fourcc('Y','U','V','P') /* 24 Y0U0Y1V0 */ #define IMGFMT_UYVP vid_fourcc('U','Y','V','P') /* 24 U0Y0V0Y1 */ #define IMGFMT_411P vid_fourcc('4','1','1','P') /* 12 alias of Y41B */ #define IMGFMT_422P vid_fourcc('4','2','2','P') /* 16 alias of Y42B */ #define IMGFMT_444P vid_fourcc('4','4','4','P') /* 24 alias of Y44B */ /* Vendor-specific formats */ #define IMGFMT_WNVA vid_fourcc('W','N','V','A') /* Winnov hw compress */ #endif avifile-0.7.48~20090503.ds/drivers/vidix/vidix.h0000644000175000017500000002521207651313447020052 0ustar yavoryavor/* * vidix.h * VIDIX - VIDeo Interface for *niX * This interface is introduced as universal one to MPEG decoder, * BES == Back End Scaler and YUV2RGB hw accelerators. * In the future it may be expanded up to capturing and audio things. * Main goal of this this interface imlpementation is providing DGA * everywhere where it's possible (unlike X11 and other). * Copyright 2002 Nick Kurshev * Licence: GPL * This interface is based on v4l2, fbvid.h, mga_vid.h projects * and personally my ideas. * NOTE: This interface is introduces as driver interface. * Don't use it for APP. */ #ifndef VIDIX_H #define VIDIX_H #ifdef __cplusplus extern "C" { #endif #define VIDIX_VERSION 100 /* returns driver version */ extern unsigned vixGetVersion( void ); #define PROBE_NORMAL 0 /* normal probing */ #define PROBE_FORCE 1 /* ignore device_id but recognize device if it's known */ /* Probes video hw. verbose - specifies verbose level. force - specifies force mode - driver should ignore device_id (danger but useful for new devices) Returns 0 if ok else errno */ extern int vixProbe( int verbose, int force ); /* Initializes driver. args - specifies driver specific parameters Returns 0 if ok else errno */ extern int vixInit( const char *args ); /* Destroys driver */ extern void vixDestroy( void ); typedef struct vidix_capability_s { char name[64]; /* Driver name */ char author[64]; /* Author name */ #define TYPE_OUTPUT 0x00000000 /* Is a video playback device */ #define TYPE_CAPTURE 0x00000001 /* Is a capture device */ #define TYPE_CODEC 0x00000002 /* Device supports hw (de)coding */ #define TYPE_FX 0x00000004 /* Is a video effects device */ int type; /* Device type, see below */ unsigned reserved0[4]; int maxwidth; int maxheight; int minwidth; int minheight; int maxframerate; /* -1 if unlimited */ #define FLAG_NONE 0x00000000 /* No flags defined */ #define FLAG_DMA 0x00000001 /* Card can use DMA */ #define FLAG_EQ_DMA 0x00000002 /* Card can use DMA only if src pitch == dest pitch */ #define FLAG_UPSCALER 0x00000010 /* Card supports hw upscaling */ #define FLAG_DOWNSCALER 0x00000020 /* Card supports hw downscaling */ #define FLAG_SUBPIC 0x00001000 /* Card supports DVD subpictures */ #define FLAG_EQUALIZER 0x00002000 /* Card supports equalizer */ unsigned flags; /* Feature flags, see above */ unsigned short vendor_id; unsigned short device_id; unsigned reserved1[4]; }vidix_capability_t; /* Should fill at least type before init. Returns 0 if ok else errno */ extern int vixGetCapability(vidix_capability_t *); typedef struct vidix_fourcc_s { unsigned fourcc; /* input: requested fourcc */ unsigned srcw; /* input: hint: width of source */ unsigned srch; /* input: hint: height of source */ #define VID_DEPTH_NONE 0x0000 #define VID_DEPTH_1BPP 0x0001 #define VID_DEPTH_2BPP 0x0002 #define VID_DEPTH_4BPP 0x0004 #define VID_DEPTH_8BPP 0x0008 #define VID_DEPTH_12BPP 0x0010 #define VID_DEPTH_15BPP 0x0020 #define VID_DEPTH_16BPP 0x0040 #define VID_DEPTH_24BPP 0x0080 #define VID_DEPTH_32BPP 0x0100 unsigned depth; /* output: screen depth for given fourcc */ #define VID_CAP_NONE 0x0000 #define VID_CAP_EXPAND 0x0001 /* if overlay can be bigger than source */ #define VID_CAP_SHRINK 0x0002 /* if overlay can be smaller than source */ #define VID_CAP_BLEND 0x0004 /* if overlay can be blended with framebuffer */ #define VID_CAP_COLORKEY 0x0008 /* if overlay can be restricted to a colorkey */ #define VID_CAP_ALPHAKEY 0x0010 /* if overlay can be restricted to an alpha channel */ #define VID_CAP_COLORKEY_ISRANGE 0x0020 /* if the colorkey can be a range */ #define VID_CAP_ALPHAKEY_ISRANGE 0x0040 /* if the alphakey can be a range */ #define VID_CAP_COLORKEY_ISMAIN 0x0080 /* colorkey is checked against framebuffer */ #define VID_CAP_COLORKEY_ISOVERLAY 0x0100 /* colorkey is checked against overlay */ #define VID_CAP_ALPHAKEY_ISMAIN 0x0200 /* alphakey is checked against framebuffer */ #define VID_CAP_ALPHAKEY_ISOVERLAY 0x0400 /* alphakey is checked against overlay */ unsigned flags; /* output: capability */ }vidix_fourcc_t; /* Returns 0 if ok else errno */ extern int vixQueryFourcc(vidix_fourcc_t *); typedef struct vidix_yuv_s { unsigned y,u,v,a; }vidix_yuv_t; typedef struct vidix_rect_s { unsigned x,y,w,h; /* in pixels */ vidix_yuv_t pitch; /* line-align in bytes */ }vidix_rect_t; typedef struct vidix_color_key_s { #define CKEY_FALSE 0 #define CKEY_TRUE 1 #define CKEY_EQ 2 #define CKEY_NEQ 3 unsigned op; /* defines logical operation */ unsigned char red; unsigned char green; unsigned char blue; unsigned char reserved; }vidix_ckey_t; typedef struct vidix_video_key_s { #define VKEY_FALSE 0 #define VKEY_TRUE 1 #define VKEY_EQ 2 #define VKEY_NEQ 3 unsigned op; /* defines logical operation */ unsigned char key[8]; }vidix_vkey_t; typedef struct vidix_playback_s { unsigned fourcc; /* app -> driver: movies's fourcc */ unsigned capability; /* app -> driver: what capability to use */ unsigned blend_factor; /* app -> driver: blending factor */ vidix_rect_t src; /* app -> driver: original movie size */ vidix_rect_t dest; /* app -> driver: destinition movie size. driver->app dest_pitch */ #define VID_PLAY_INTERLEAVED_UV 0x00000001 /* driver -> app: interleaved UV planes */ #define INTERLEAVING_UV 0x00001000 /* UVUVUVUVUV used by Matrox G200 */ #define INTERLEAVING_VU 0x00001001 /* VUVUVUVUVU */ int flags; /* memory model */ unsigned frame_size; /* driver -> app: destinition frame size */ unsigned num_frames; /* app -> driver: after call: driver -> app */ #define VID_PLAY_MAXFRAMES 1024 /* unreal limitation */ unsigned offsets[VID_PLAY_MAXFRAMES]; /* driver -> app */ vidix_yuv_t offset; /* driver -> app: relative offsets within frame for yuv planes */ void* dga_addr; /* driver -> app: linear address */ }vidix_playback_t; /* Returns 0 if ok else errno */ extern int vixConfigPlayback(vidix_playback_t *); /* Returns 0 if ok else errno */ extern int vixPlaybackOn( void ); /* Returns 0 if ok else errno */ extern int vixPlaybackOff( void ); /* Returns 0 if ok else errno */ extern int vixPlaybackFrameSelect( unsigned frame_idx ); typedef struct vidix_grkey_s { vidix_ckey_t ckey; /* app -> driver: color key */ vidix_vkey_t vkey; /* app -> driver: video key */ #define KEYS_PUT 0 #define KEYS_AND 1 #define KEYS_OR 2 #define KEYS_XOR 3 unsigned key_op; /* app -> driver: keys operations */ }vidix_grkey_t; /* Returns 0 if ok else errno */ extern int vixGetGrKeys( vidix_grkey_t * ); /* Returns 0 if ok else errno */ extern int vixSetGrKeys( const vidix_grkey_t * ); typedef struct vidix_video_eq_s { #define VEQ_CAP_NONE 0x00000000UL #define VEQ_CAP_BRIGHTNESS 0x00000001UL #define VEQ_CAP_CONTRAST 0x00000002UL #define VEQ_CAP_SATURATION 0x00000004UL #define VEQ_CAP_HUE 0x00000008UL #define VEQ_CAP_RGB_INTENSITY 0x00000010UL int cap; /* on get_eq should contain capability of equalizer on set_eq should contain using fields */ /* end-user app can have presets like: cold-normal-hot picture and so on */ int brightness; /* -1000 : +1000 */ int contrast; /* -1000 : +1000 */ int saturation; /* -1000 : +1000 */ int hue; /* -1000 : +1000 */ int red_intensity; /* -1000 : +1000 */ int green_intensity;/* -1000 : +1000 */ int blue_intensity; /* -1000 : +1000 */ #define VEQ_FLG_ITU_R_BT_601 0x00000000 /* ITU-R BT.601 colour space (default) */ #define VEQ_FLG_ITU_R_BT_709 0x00000001 /* ITU-R BT.709 colour space */ #define VEQ_FLG_ITU_MASK 0x0000000f int flags; /* currently specifies ITU YCrCb color space to use */ }vidix_video_eq_t; /* Returns 0 if ok else errno */ extern int vixPlaybackGetEq( vidix_video_eq_t * ); /* Returns 0 if ok else errno */ extern int vixPlaybackSetEq( const vidix_video_eq_t * ); typedef struct vidix_deinterlace_s { #define CFG_NON_INTERLACED 0x00000000 /* stream is not interlaced */ #define CFG_INTERLACED 0x00000001 /* stream is interlaced */ #define CFG_EVEN_ODD_INTERLACING 0x00000002 /* first frame contains even fields but second - odd */ #define CFG_ODD_EVEN_INTERLACING 0x00000004 /* first frame contains odd fields but second - even */ #define CFG_UNIQUE_INTERLACING 0x00000008 /* field deinterlace_pattern is valid */ #define CFG_UNKNOWN_INTERLACING 0x0000000f /* unknown deinterlacing - use adaptive if it's possible */ unsigned flags; unsigned deinterlace_pattern; /* app -> driver: deinterlace pattern if flag CFG_UNIQUE_INTERLACING is set */ }vidix_deinterlace_t; /* Returns 0 if ok else errno */ extern int vixPlaybackGetDeint( vidix_deinterlace_t * ); /* Returns 0 if ok else errno */ extern int vixPlaybackSetDeint( const vidix_deinterlace_t * ); typedef struct vidix_slice_s { void* address; /* app -> driver */ unsigned size; /* app -> driver */ vidix_rect_t slice; /* app -> driver */ }vidix_slice_t; typedef struct vidix_dma_s { void * src; /* app -> driver. Virtual address of source */ unsigned dest_offset; /* app -> driver. Destinition offset within of video memory */ unsigned size; /* app -> driver. Size of transaction */ #define BM_DMA_ASYNC 0 #define BM_DMA_SYNC 1 /* means: wait dma transfer completion */ #define BM_DMA_FIXED_BUFFS 2 /* app -> driver: app uses buffers which are fixed in memory */ unsigned flags; /* app -> driver */ unsigned idx; /* app -> driver: idx of src buffer */ void * internal[VID_PLAY_MAXFRAMES]; /* for internal use by driver */ }vidix_dma_t; /* Returns 0 if ok else errno */ extern int vixPlaybackCopyFrame( vidix_dma_t * ); /* Returns 0 if DMA is available else errno (EBUSY) */ extern int vixQueryDMAStatus( void ); /* This structure is introdused to support OEM effects like: - sharpness - exposure - (auto)gain - H(V)flip - black level - white balance and many other */ typedef struct vidix_oem_fx_s { #define FX_TYPE_BOOLEAN 0x00000000 #define FX_TYPE_INTEGER 0x00000001 int type; /* type of effects */ int num; /* app -> driver: effect number. From 0 to max number of effects */ int minvalue; /* min value of effect. 0 - for boolean */ int maxvalue; /* max value of effect. 1 - for boolean */ int value; /* current value of effect on 'get'; required on set */ char * name[80]; /* effect name to display */ }vidix_oem_fx_t; /* Returns 0 if ok else errno */ extern int vixQueryNumOemEffects( unsigned * number ); /* Returns 0 if ok else errno */ extern int vixGetOemEffect( vidix_oem_fx_t * ); /* Returns 0 if ok else errno */ extern int vixSetOemEffect( const vidix_oem_fx_t * ); #ifdef VIDIX_BUILD_STATIC #define VIDIX_NAME(name) VIDIX_STATIC##name #else #define VIDIX_NAME(name) name #endif #ifdef __cplusplus } #endif #endif avifile-0.7.48~20090503.ds/drivers/vidix/vidix.txt0000644000175000017500000002243307532425317020442 0ustar yavoryavor VIDIX - VIDeo Interface for *niX ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This interface was designed and introduced as interface to userspace drivers to provide DGA everywhere where it's possible (unline X11). I hope that these drivers will be portable same as X11 (not only on *nix). What is it: - It's portable successor of mga_vid technology which is located in user-space. - Unlikely X11 it's provides DGA everywhere where it's possible. - Unlikely v4l it provides interface for video playback - Unlikely linux's drivers it uses mathematics library. Why it was developed: As said Vladimir Dergachev (http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/gatos/km/km.rfc.txt): "0) Motivation v4l, v4l2 and Xv are all suffering from the same problem: attempt to fit existing multimedia devices into a fixed scheme." Well - I tried to implement something similar by motivation. How it works: ~~~~~~~~~~~~~ This interface is almost finished. But I guess it can be expanded by developer's requests. So any suggestions, reports, criticism are gladly accepted. 1) APP calls vixGetVersion to check age of driver ;) 2) APP calls vixProbe. Driver should return 0 if it can handle something in PC. 3) APP calls vixGetCapability. Driver should return filled vidix_capability_t.type field at least. 4) If above calls were succesful then APP calls vixInit function (Driver can have not exported this function in this case call will be skiped). 5) After initializing of driver APP calls vixGetCapability again (In this case driver must fill every field of struct) 6) APP calls vixQueryFourcc. Driver should answer - can it configure video memory for given fourcc or not. 7) APP calls vixConfigPlayback. Driver should prepare BES on this call. APP pass to driver following info: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vidix_playback_t.fourcc - contains fourcc of movie vidix_playback_t.capability - currently contsinas copy of vidix_capability_t.flags vidix_playback_t.blend_factor- currently unused vidix_playback_t.src - x,y,w,h fields contain original movie size (in pixels) x and y often are nulls. vidix_playback_t.src.pitch.y These fields contain source pitches vidix_playback_t.src.pitch.u - for each Y,U,V plane in bytes. vidix_playback_t.src.pitch.v (For packed fourcc only Y value is used) They are hints for driver to use same destinition pitches as in source memory (to speed up memcpy process). Note: when source pitches are unknown or variable these field will be filled into 0. vidix_playback_t.dest - x,y,w,h fields contains destinition rectange on the screen in pixels. vidix_playback_t.num_frames - maximal # of frames which can be used by APP. (Currently 10). Driver should fill following fields: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vidix_playback_t.num_frames - real # of frames which will be used by driver. (Should be less or equal to app's num_frames). vidix_playback_t.dest.pitch.y These fields should contain alignment vidix_playback_t.dest.pitch.u - for each Y,U,V plane in bytes. vidix_playback_t.dest.pitch.v (For packed fourcc only Y value is used) vidix_playback_t.frame_size - Driver should tell to app which size of source frame (src.w and src.h) should use APP (according to pitches and offsets) vidix_playback_t.offsets - offsets from begin of BES memory for each frame vidix_playback_t.offset.y These field should contain offset vidix_playback_t.offset.u - for each Y,U,V plane within frame. vidix_playback_t.offset.v (For packed fourcc only Y value is used) vidix_playback_t.dga_addr - Address of BES memory. Also see this picture: VIDEO MEMORY layout: +----------- It's begin of video memory End of video memory--------------+ | | v v [ RGB memory | YUV memory | UNDEF ] ^ | +---- begin of BES memory BES MEMORY layout: +-------- begin of BES memory | v [ | | | | | ^ ^ ^ ^ ^ | | | | + BEGIN of second frame | | | + BEGIN of V plane | | + BEGIN of U plane | +------- BEGIN of Y plane | +--------- BEGIN of first frame This means that in general case: offset of frame != offset of BES offset of Y plane != offset of first frame But often: vidix_playback_t.offsets[0] = vidix_playback_t.offset.y = 0; Formula: (For Y plane) copy source to: vidix_playback_t.dga_addr + vidix_playback_t.offsets[i] + vidix_playback_t.offset.y 8) APP calls vixPlaybackOn. Driver should activate BES on this call. 9) PLAYBACK. Driver should sleep here ;) But during playback can be called: vixFrameSelect (if this function is exported) Driver should prepare and activate corresponded frame. This function is used only for double and trilpe buffering and never used for single buffering playback. vixGet(Set)GrKeys (if this function is exported) This interface should be tuned but intriduced for overlapped playback and video effects (TYPE_FX) vixPlaybackGet(Set)Eq (if this function is exported) For color correction. 10) APP calls vixPlaybackOff. Driver should deactivate BES on this call. 11) If vixDestroy is defined APP calls this function before unloading driver from memory. What functions are mandatory: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vixGetVersion vixProbe vixGetCapability vixQueryFourcc vixConfigPlayback vixPlaybackOn vixPlaybackOff All other functions are optionaly. BUSMASTERING ************ Busmastering is technique to implement data transfer through DMA. This technique is intended to free CPU for other useful work to speedup movie playback. The speedup will be different on different CPUs OSes and videocards. Only thing which SHOULD be implemented it's the fact that frame should be transfered faster than 1/fps. (I.e. faster than 33ms for 30 fps or faster than 40ms for 25 fps) VIDIX implementation of BM (busmastering) is slightly specific. During driver development you should keep in mind the next rules: 1. BM is implemented as parallel process which should work simultaneously with frame decoding. 2. To have possibility to use busmastering by non-ROOT users driver should rather call functions from libdha than from libc. (Example: driver should call bm_lock_mem instead of mlock) 3. To speedup data transfer player will pass pointer to the DMA buffer which will have the same structure (planes and strides) as video memory (In this connexion driver should allocate frames in video memory same as if BM would not be implemented). Interface: ~~~~~~~~~~ The interface of BM is implemented through 2 functions: vixPlaybackCopyFrame vixQueryDMAStatus vixPlaybackCopyFrame should prepare engine to copy frame from system memory into video framebuffer. After that driver should send command into engine to start data transfer and return control immediatedly. The structure vidix_dma_s in details: typedef struct vidix_dma_s { /* app -> driver. Virtual address of source. Note: source buffer is allocated by using malloc or memalign(); */ void * src; /* app -> driver. Destinition offset within of video memory. It will point offset within of YUV memory where destinition data should be stored. */ unsigned dest_offset; /* app -> driver. Size of data to be transfered in bytes. */ unsigned size; /* can accept ORed values of BM_DMA* definitions BM_DMA_ASYNC - default value which indicates that transactiion should work asynchronously. BM_DMA_SYNC - may be ignored due speedup reasons BM_DMA_FIXED_BUFFS - indicates that player was started by ROOT and source DMA buffers were already locked in memory through mlock(). /* app -> driver: idx of src buffer. if BM_DMA_FIXED_BUFFS flags is set then this field indicates which from buffers currently is passed into driver. This field maybe ignored by driver but it would be better to use that for minor speedup of engine preparing. */ unsigned idx; /* for internal use by driver. Driver may use them on its opinion */ void * internal[VID_PLAY_MAXFRAMES]; }vidix_dma_t; vixQueryDMAStatus should check out DMA status and return 1 if BM is busy and 0 otherwise. Note: this function shouldn't wait any changes in DMA state. A few words about of non-linux systems ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Well, there is only one problem which stops us to use BM on nono-linux systems: it's lacking of possibility to perform convertion from virtual to physical address in user-space. This problem is sloved by so-called dhahelper driver for linux. What about of other OSes then this driver requires to be ported first. (Of course, except of DOS and DOS32 where these convertions are unnecessary). Useful links: ~~~~~~~~~~~~~ Guide to DTV http://www.digitaltelevision.com/dtvbook/toc.shtml Fourcc http://www.webartz.com/fourcc/ MPEG http://www.mpeg.org/MPEG/index.html Analog colors http://www.miranda.com/en/app_notes/TN/TN-05/TN-05.htm Please send your suggestions, reports, feedback to mplayerxp-general@lists.sourceforge.net Best regards! Nick Kurshev. avifile-0.7.48~20090503.ds/drivers/vidix/vidixlib.c0000644000175000017500000003361207651313450020531 0ustar yavoryavor/* * vidixlib.c * VIDIXLib - Library for VIDeo Interface for *niX * This interface is introduced as universal one to MPEG decoder, * BES == Back End Scaler and YUV2RGB hw accelerators. * In the future it may be expanded up to capturing and audio things. * Main goal of this this interface imlpementation is providing DGA * everywhere where it's possible (unlike X11 and other). * Copyright 2002 Nick Kurshev * Licence: GPL * This interface is based on v4l2, fbvid.h, mga_vid.h projects * and personally my ideas. * NOTE: This interface is introduces as APP interface. * Don't use it for driver. * It provides multistreaming. This mean that APP can handle * several streams simultaneously. (Example: Video capturing and video * playback or capturing, video playback, audio encoding and so on). */ #include #include #include #include #include /* GLIBC specific. Exists under cygwin too! */ #include #include "vidixlib.h" #include "../bswap.h" #define t_vdl(p) (((vdl_stream_t *)p)) typedef struct vdl_stream_s { void * handle; int (*get_caps)(vidix_capability_t *); int (*query_fourcc)(vidix_fourcc_t *); int (*config_playback)(vidix_playback_t *); int (*playback_on)( void ); int (*playback_off)( void ); /* Functions below can be missed in driver ;) */ int (*init)(const char *); void (*destroy)(void); int (*frame_sel)( unsigned frame_idx ); int (*get_eq)( vidix_video_eq_t * ); int (*set_eq)( const vidix_video_eq_t * ); int (*get_deint)( vidix_deinterlace_t * ); int (*set_deint)( const vidix_deinterlace_t * ); int (*copy_frame)( const vidix_dma_t * ); int (*query_dma)( void ); int (*get_gkey)( vidix_grkey_t * ); int (*set_gkey)( const vidix_grkey_t * ); int (*get_num_fx)( unsigned * ); int (*get_fx)( vidix_oem_fx_t * ); int (*set_fx)( const vidix_oem_fx_t * ); }vdl_stream_t; static char drv_name[FILENAME_MAX]; static int dl_idx = -1; /* currently available driver for static linking */ static const char* const drv_snames[] = { #ifdef VIDIX_BUILD_STATIC "genfb_", "mach64_", "mga_crtc2_", "mga_", "nvidia_", "pm2_", "pm3_", "radeo_", "rage128_", #endif NULL }; extern unsigned vdlGetVersion( void ) { return VIDIX_VERSION; } static void* dlsymm(void* handle, const char* fce) { char b[100]; #if defined(__OpenBSD__) && !defined(__ELF__) b[0] = '_'; b[1] = 0; #else b[0] = 0; #endif if (dl_idx >= 0) strcat(b, drv_snames[dl_idx]); strcat(b, fce); //printf("Handle %p %s\n", handle, b); return dlsym(handle, b); } static int vdl_fill_driver(VDL_HANDLE stream) { t_vdl(stream)->init = dlsymm(t_vdl(stream)->handle,"vixInit"); t_vdl(stream)->destroy = dlsymm(t_vdl(stream)->handle,"vixDestroy"); t_vdl(stream)->get_caps = dlsymm(t_vdl(stream)->handle,"vixGetCapability"); t_vdl(stream)->query_fourcc = dlsymm(t_vdl(stream)->handle,"vixQueryFourcc"); t_vdl(stream)->config_playback= dlsymm(t_vdl(stream)->handle,"vixConfigPlayback"); t_vdl(stream)->playback_on = dlsymm(t_vdl(stream)->handle,"vixPlaybackOn"); t_vdl(stream)->playback_off = dlsymm(t_vdl(stream)->handle,"vixPlaybackOff"); t_vdl(stream)->frame_sel = dlsymm(t_vdl(stream)->handle,"vixPlaybackFrameSelect"); t_vdl(stream)->get_eq = dlsymm(t_vdl(stream)->handle,"vixPlaybackGetEq"); t_vdl(stream)->set_eq = dlsymm(t_vdl(stream)->handle,"vixPlaybackSetEq"); t_vdl(stream)->get_gkey = dlsymm(t_vdl(stream)->handle,"vixGetGrKeys"); t_vdl(stream)->set_gkey = dlsymm(t_vdl(stream)->handle,"vixSetGrKeys"); t_vdl(stream)->get_deint = dlsymm(t_vdl(stream)->handle,"vixPlaybackGetDeint"); t_vdl(stream)->set_deint = dlsymm(t_vdl(stream)->handle,"vixPlaybackSetDeint"); t_vdl(stream)->copy_frame = dlsymm(t_vdl(stream)->handle,"vixPlaybackCopyFrame"); t_vdl(stream)->query_dma = dlsymm(t_vdl(stream)->handle,"vixQueryDMAStatus"); t_vdl(stream)->get_num_fx = dlsymm(t_vdl(stream)->handle,"vixQueryNumOemEffects"); t_vdl(stream)->get_fx = dlsymm(t_vdl(stream)->handle,"vixGetOemEffect"); t_vdl(stream)->set_fx = dlsymm(t_vdl(stream)->handle,"vixSetOemEffect"); /* check driver viability */ if(!( t_vdl(stream)->get_caps && t_vdl(stream)->query_fourcc && t_vdl(stream)->config_playback && t_vdl(stream)->playback_on && t_vdl(stream)->playback_off)) { printf("vidixlib: Incomplete driver: some of essential features are missed in it.\n"); return 0; } return 1; } #ifndef RTLD_GLOBAL #define RTLD_GLOBAL RTLD_LAZY #endif #ifndef RTLD_NOW #define RTLD_NOW RTLD_LAZY #endif static int vdl_probe_driver(VDL_HANDLE stream,const char *path,const char *name,unsigned cap,int verbose) { vidix_capability_t vid_cap; unsigned (*_ver)(void); int (*_probe)(int,int); int (*_cap)(vidix_capability_t*); strcpy(drv_name,path); strcat(drv_name,name); if(verbose) printf("vidixlib: PROBING: %s\n",drv_name); { const char* slash = strrchr(drv_name, '/'); if (slash) { for (dl_idx = 0; drv_snames[dl_idx]; dl_idx++) { if (!strncmp(slash + 1, drv_snames[dl_idx], strlen(drv_snames[dl_idx]))) break; // locate the name } if (!drv_snames[dl_idx]) dl_idx = -1; } } if (dl_idx < 0) if(!(t_vdl(stream)->handle = dlopen(drv_name,RTLD_LAZY|RTLD_GLOBAL))) { if(verbose) printf("vidixlib: %s not driver: %s\n",drv_name,dlerror()); return 0; } _ver = dlsymm(t_vdl(stream)->handle,"vixGetVersion"); _probe = dlsymm(t_vdl(stream)->handle,"vixProbe"); _cap = dlsymm(t_vdl(stream)->handle,"vixGetCapability"); if(_ver) { if((*_ver)() != VIDIX_VERSION) { if(verbose) printf("vidixlib: %s has wrong version\n",drv_name); err: dlclose(t_vdl(stream)->handle); t_vdl(stream)->handle = 0; dl_idx = -1; return 0; } } else { fatal_err: if(verbose) printf("vidixlib: %s has no function definition\n",drv_name); goto err; } if(_probe) { if((*_probe)(verbose,PROBE_NORMAL) != 0) goto err; } else goto fatal_err; if(_cap) { if((*_cap)(&vid_cap) != 0) goto err; } else goto fatal_err; if((vid_cap.type & cap) != cap) { if(verbose) printf("vidixlib: Found %s but has no required capability\n",drv_name); goto err; } if(verbose) printf("vidixlib: %s probed o'k\n",drv_name); return 1; } static int vdl_find_driver(VDL_HANDLE stream,const char *path,unsigned cap,int verbose) { DIR *dstream; struct dirent *name; int done = 0; if(!(dstream = opendir(path))) return 0; while(!done) { name = readdir(dstream); if(name) { if(name->d_name[0] != '.') if(vdl_probe_driver(stream,path,name->d_name,cap,verbose)) break; } else done = 1; } closedir(dstream); return done?0:1; } VDL_HANDLE vdlOpen(const char *path,const char *name,unsigned cap,int verbose) { vdl_stream_t *stream; const char *drv_args=NULL; int errcode; if(!(stream = malloc(sizeof(vdl_stream_t)))) return NULL; memset(stream,0,sizeof(vdl_stream_t)); if(name) { unsigned (*ver)(void); int (*probe)(int,int); unsigned version = 0; unsigned char *arg_sep; arg_sep = strchr(name,':'); if(arg_sep) { *arg_sep='\0'; drv_args = &arg_sep[1]; } strcpy(drv_name,path); strcat(drv_name,name); { const char* slash = strrchr(drv_name, '/'); if (slash) { for (dl_idx = 0; drv_snames[dl_idx]; dl_idx++) { if (!strncmp(slash + 1, drv_snames[dl_idx], strlen(drv_snames[dl_idx]))) break; // locate the name } if (!drv_snames[dl_idx]) dl_idx = -1; } } if (dl_idx < 0) if(!(t_vdl(stream)->handle = dlopen(drv_name,RTLD_NOW|RTLD_GLOBAL))) { if (verbose) printf("vidixlib: dlopen error: %s\n", dlerror()); err: vdlClose(stream); return NULL; } ver = dlsymm(t_vdl(stream)->handle,"vixGetVersion"); if(ver) version = (*ver)(); if(version != VIDIX_VERSION) goto err; probe = dlsymm(t_vdl(stream)->handle,"vixProbe"); if(probe) { if((*probe)(verbose,PROBE_FORCE)!=0) goto err; } else goto err; fill: if(!vdl_fill_driver(stream)) goto err; goto ok; } else if(vdl_find_driver(stream,path,cap,verbose)) { if(verbose) printf("vidixlib: will use %s driver\n",drv_name); goto fill; } else goto err; ok: if(t_vdl(stream)->init) { if(verbose) printf("vidixlib: Attempt to initialize driver at: %p\n",t_vdl(stream)->init); if((errcode=t_vdl(stream)->init(drv_args))!=0) { if(verbose) printf("vidixlib: Can't init driver: %s\n",strerror(errcode)); goto err; } } if(verbose) printf("vidixlib: '%s'successfully loaded\n",drv_name); return stream; } void vdlClose(VDL_HANDLE stream) { if(t_vdl(stream)->destroy) t_vdl(stream)->destroy(); if(t_vdl(stream)->handle) dlclose(t_vdl(stream)->handle); memset(stream,0,sizeof(vdl_stream_t)); /* <- it's not stupid */ free(stream); dl_idx = -1; } int vdlGetCapability(VDL_HANDLE handle, vidix_capability_t *cap) { return t_vdl(handle)->get_caps(cap); } #define MPLAYER_IMGFMT_RGB (('R'<<24)|('G'<<16)|('B'<<8)) #define MPLAYER_IMGFMT_BGR (('B'<<24)|('G'<<16)|('R'<<8)) #define MPLAYER_IMGFMT_RGB_MASK 0xFFFFFF00 static uint32_t normalize_fourcc(uint32_t fourcc) { if((fourcc & MPLAYER_IMGFMT_RGB_MASK) == (MPLAYER_IMGFMT_RGB|0) || (fourcc & MPLAYER_IMGFMT_RGB_MASK) == (MPLAYER_IMGFMT_BGR|0)) return bswap_32(fourcc); else return fourcc; } int vdlQueryFourcc(VDL_HANDLE handle,vidix_fourcc_t *f) { f->fourcc = normalize_fourcc(f->fourcc); return t_vdl(handle)->query_fourcc(f); } int vdlConfigPlayback(VDL_HANDLE handle,vidix_playback_t *p) { p->fourcc = normalize_fourcc(p->fourcc); return t_vdl(handle)->config_playback(p); } int vdlPlaybackOn(VDL_HANDLE handle) { return t_vdl(handle)->playback_on(); } int vdlPlaybackOff(VDL_HANDLE handle) { return t_vdl(handle)->playback_off(); } int vdlPlaybackFrameSelect(VDL_HANDLE handle, unsigned frame_idx ) { return t_vdl(handle)->frame_sel ? t_vdl(handle)->frame_sel(frame_idx) : ENOSYS; } int vdlPlaybackGetEq(VDL_HANDLE handle, vidix_video_eq_t * e) { return t_vdl(handle)->get_eq ? t_vdl(handle)->get_eq(e) : ENOSYS; } int vdlPlaybackSetEq(VDL_HANDLE handle, const vidix_video_eq_t * e) { return t_vdl(handle)->set_eq ? t_vdl(handle)->set_eq(e) : ENOSYS; } int vdlPlaybackCopyFrame(VDL_HANDLE handle, vidix_dma_t * f) { return t_vdl(handle)->copy_frame ? t_vdl(handle)->copy_frame(f) : ENOSYS; } int vdlQueryDMAStatus(VDL_HANDLE handle ) { return t_vdl(handle)->query_dma ? t_vdl(handle)->query_dma() : ENOSYS; } int vdlGetGrKeys(VDL_HANDLE handle, vidix_grkey_t * k) { return t_vdl(handle)->get_gkey ? t_vdl(handle)->get_gkey(k) : ENOSYS; } int vdlSetGrKeys(VDL_HANDLE handle, const vidix_grkey_t * k) { return t_vdl(handle)->set_gkey ? t_vdl(handle)->set_gkey(k) : ENOSYS; } int vdlPlaybackGetDeint(VDL_HANDLE handle, vidix_deinterlace_t * d) { return t_vdl(handle)->get_deint ? t_vdl(handle)->get_deint(d) : ENOSYS; } int vdlPlaybackSetDeint(VDL_HANDLE handle, const vidix_deinterlace_t * d) { return t_vdl(handle)->set_deint ? t_vdl(handle)->set_deint(d) : ENOSYS; } int vdlQueryNumOemEffects(VDL_HANDLE handle, unsigned * number ) { return t_vdl(handle)->get_num_fx ? t_vdl(handle)->get_num_fx(number) : ENOSYS; } int vdlGetOemEffect(VDL_HANDLE handle, vidix_oem_fx_t * f) { return t_vdl(handle)->get_fx ? t_vdl(handle)->get_fx(f) : ENOSYS; } int vdlSetOemEffect(VDL_HANDLE handle, const vidix_oem_fx_t * f) { return t_vdl(handle)->set_fx ? t_vdl(handle)->set_fx(f) : ENOSYS; } /* ABI related extensions */ vidix_capability_t * vdlAllocCapabilityS( void ) { vidix_capability_t *retval; retval=malloc(sizeof(vidix_capability_t)); if(retval) memset(retval,0,sizeof(vidix_capability_t)); return retval; } vidix_fourcc_t * vdlAllocFourccS( void ) { vidix_fourcc_t *retval; retval=malloc(sizeof(vidix_fourcc_t)); if(retval) memset(retval,0,sizeof(vidix_fourcc_t)); return retval; } vidix_yuv_t * vdlAllocYUVS( void ) { vidix_yuv_t *retval; retval=malloc(sizeof(vidix_yuv_t)); if(retval) memset(retval,0,sizeof(vidix_yuv_t)); return retval; } vidix_rect_t * vdlAllocRectS( void ) { vidix_rect_t *retval; retval=malloc(sizeof(vidix_rect_t)); if(retval) memset(retval,0,sizeof(vidix_rect_t)); return retval; } vidix_playback_t * vdlAllocPlaybackS( void ) { vidix_playback_t *retval; retval=malloc(sizeof(vidix_playback_t)); if(retval) memset(retval,0,sizeof(vidix_playback_t)); return retval; } vidix_grkey_t * vdlAllocGrKeyS( void ) { vidix_grkey_t *retval; retval=malloc(sizeof(vidix_grkey_t)); if(retval) memset(retval,0,sizeof(vidix_grkey_t)); return retval; } vidix_video_eq_t * vdlAllocVideoEqS( void ) { vidix_video_eq_t *retval; retval=malloc(sizeof(vidix_video_eq_t)); if(retval) memset(retval,0,sizeof(vidix_video_eq_t)); return retval; } vidix_deinterlace_t * vdlAllocDeinterlaceS( void ) { vidix_deinterlace_t *retval; retval=malloc(sizeof(vidix_deinterlace_t)); if(retval) memset(retval,0,sizeof(vidix_deinterlace_t)); return retval; } vidix_dma_t * vdlAllocDmaS( void ) { vidix_dma_t *retval; retval=malloc(sizeof(vidix_dma_t)); if(retval) memset(retval,0,sizeof(vidix_dma_t)); return retval; } vidix_oem_fx_t * vdlAllocOemFxS( void ) { vidix_oem_fx_t *retval; retval=malloc(sizeof(vidix_oem_fx_t)); if(retval) memset(retval,0,sizeof(vidix_oem_fx_t)); return retval; } void vdlFreeCapabilityS(vidix_capability_t * _this) { free(_this); } void vdlFreeFourccS( vidix_fourcc_t * _this ) { free(_this); } void vdlFreePlaybackS( vidix_playback_t * _this ) { free(_this); } void vdlFreeYUVS( vidix_yuv_t * _this) { free(_this); } void vdlFreeRectS( vidix_rect_t * _this) { free(_this); } void vdlFreeGrKeyS( vidix_grkey_t * _this) { free(_this); } void vdlFreeVideoEqS( vidix_video_eq_t * _this) { free(_this); } void vdlFreeDeinterlaceS( vidix_deinterlace_t * _this) { free(_this); } void vdlFreeDmaS( vidix_dma_t * _this) { free(_this); } void vdlFreeOemFxS( vidix_oem_fx_t * _this) { free(_this); } avifile-0.7.48~20090503.ds/drivers/vidix/vidixlib.h0000644000175000017500000001053507651313451020536 0ustar yavoryavor/* * vidixlib.h * VIDIXLib - Library for VIDeo Interface for *niX * This interface is introduced as universal one to MPEG decoder, * BES == Back End Scaler and YUV2RGB hw accelerators. * In the future it may be expanded up to capturing and audio things. * Main goal of this this interface imlpementation is providing DGA * everywhere where it's possible (unlike X11 and other). * Copyright 2002 Nick Kurshev * Licence: GPL * This interface is based on v4l2, fbvid.h, mga_vid.h projects * and personally my ideas. * NOTE: This interface is introduces as APP interface. * Don't use it for driver. * It provides multistreaming. This mean that APP can handle * several streams simultaneously. (Example: Video capturing and video * playback or capturing, video playback, audio encoding and so on). */ #ifndef VIDIXLIB_H #define VIDIXLIB_H #ifdef __cplusplus extern "C" { #endif #include "vidix.h" typedef void * VDL_HANDLE; /* returns library version */ extern unsigned vdlGetVersion( void ); /* Opens corresponded video driver and returns handle of associated stream. path - specifies path where drivers are located. name - specifies prefered driver name (can be NULL). cap - specifies driver capability (TYPE_* constants). verbose - specifies verbose level returns !0 if ok else NULL. */ extern VDL_HANDLE vdlOpen(const char *path,const char *name,unsigned cap,int verbose); /* Closes stream and corresponded driver. */ extern void vdlClose(VDL_HANDLE stream); /* Queries driver capabilities. Return 0 if ok else errno */ extern int vdlGetCapability(VDL_HANDLE, vidix_capability_t *); /* Queries support for given fourcc. Returns 0 if ok else errno */ extern int vdlQueryFourcc(VDL_HANDLE,vidix_fourcc_t *); /* Returns 0 if ok else errno */ extern int vdlConfigPlayback(VDL_HANDLE, vidix_playback_t *); /* Returns 0 if ok else errno */ extern int vdlPlaybackOn(VDL_HANDLE); /* Returns 0 if ok else errno */ extern int vdlPlaybackOff(VDL_HANDLE); /* Returns 0 if ok else errno */ extern int vdlPlaybackFrameSelect(VDL_HANDLE, unsigned frame_idx ); /* Returns 0 if ok else errno */ extern int vdlGetGrKeys(VDL_HANDLE, vidix_grkey_t * ); /* Returns 0 if ok else errno */ extern int vdlSetGrKeys(VDL_HANDLE, const vidix_grkey_t * ); /* Returns 0 if ok else errno */ extern int vdlPlaybackGetEq(VDL_HANDLE, vidix_video_eq_t * ); /* Returns 0 if ok else errno */ extern int vdlPlaybackSetEq(VDL_HANDLE, const vidix_video_eq_t * ); /* Returns 0 if ok else errno */ extern int vdlPlaybackGetDeint(VDL_HANDLE, vidix_deinterlace_t * ); /* Returns 0 if ok else errno */ extern int vdlPlaybackSetDeint(VDL_HANDLE, const vidix_deinterlace_t * ); /* Returns 0 if ok else errno */ extern int vdlQueryNumOemEffects(VDL_HANDLE, unsigned * number ); /* Returns 0 if ok else errno */ extern int vdlGetOemEffect(VDL_HANDLE, vidix_oem_fx_t * ); /* Returns 0 if ok else errno */ extern int vdlSetOemEffect(VDL_HANDLE, const vidix_oem_fx_t * ); /* Returns 0 if ok else errno */ extern int vdlPlaybackCopyFrame(VDL_HANDLE, vidix_dma_t * ); /* Returns 0 if DMA is available else errno (EBUSY) */ extern int vdlQueryDMAStatus( VDL_HANDLE ); /* ABI related extensions. Note: you should use this functions if you are using shared version of vidix. */ extern vidix_capability_t * vdlAllocCapabilityS( void ); extern vidix_fourcc_t * vdlAllocFourccS( void ); extern vidix_playback_t * vdlAllocPlaybackS( void ); extern vidix_yuv_t * vdlAllocYUVS( void ); extern vidix_rect_t * vdlAllocRectS( void ); extern vidix_grkey_t * vdlAllocGrKeyS( void ); extern vidix_video_eq_t * vdlAllocVideoEqS( void ); extern vidix_deinterlace_t * vdlAllocDeinterlaceS( void ); extern vidix_dma_t * vdlAllocDmaS( void ); extern vidix_oem_fx_t * vdlAllocOemFxS( void ); extern void vdlFreeCapabilityS(vidix_capability_t * ); extern void vdlFreeFourccS( vidix_fourcc_t * ); extern void vdlFreePlaybackS( vidix_playback_t * ); extern void vdlFreeYUVS( vidix_yuv_t * ); extern void vdlFreeRectS( vidix_rect_t * ); extern void vdlFreeGrKeyS( vidix_grkey_t * ); extern void vdlFreeVideoEqS( vidix_video_eq_t * ); extern void vdlFreeDeinterlaceS( vidix_deinterlace_t * ); extern void vdlFreeDmaS( vidix_dma_t * ); extern void vdlFreeOemFxS( vidix_oem_fx_t * ); #ifdef __cplusplus } #endif #endif avifile-0.7.48~20090503.ds/include/0000755000175000017500000000000011267646347015404 5ustar yavoryavoravifile-0.7.48~20090503.ds/include/Locker.h0000644000175000017500000000020007547603645016764 0ustar yavoryavor#ifndef AVIFILE_LOCKER_H #define AVIFILE_LOCKER_H #warning Use #include "avm_locker.h" instead #include "avm_locker.h" #endif avifile-0.7.48~20090503.ds/include/StreamInfo.h0000644000175000017500000000477311164472545017630 0ustar yavoryavor#ifndef AVIFILE_STREAMINFO_H #define AVIFILE_STREAMINFO_H #ifndef AVIFILE_INFOTYPES_H #error Wrong usage of StreamInfo.h - include only infotypes.h! #endif #include "avm_default.h" #include "avm_stl.h" /* * this file could be a part of infotypes in future > so be careful * * so include only !!!! infotypes.h !!!! (StreamInfo is included there!) */ AVM_BEGIN_NAMESPACE; class IMediaReadStream; class AviReadStream; class AsfReadStream; class FFReadStream; class AVMEXPORT StreamInfo { friend class IMediaReadStream; friend class AviReadStream; friend class AsfReadStream; friend class FFReadStream; public: enum Type { Video, Audio, Other }; StreamInfo(); StreamInfo(const StreamInfo&);// copy ~StreamInfo(); /// returns string representation of this Info structure avm::string GetString() const; /// stream type (Video, Audio,...) Type GetType() const; /// Format tag (FourCC for Video, WAVEFORMAT Tag for audio, uint_t GetFormat() const; const char* GetFormatName() const; /// Quality of the stream 0..10000 (not sure here) int GetQuality() const; double GetBps() const; // calculated Bps double GetFps() const; // calculated Fps /// total length of the stream in seconds double GetLengthTime() const; /// total stream size int64_t GetStreamSize() const; /// frames in the stream uint_t GetStreamFrames() const; /// size of each sample in stream - will be 0 for VBR streams size_t GetSampleSize() const; /// some stats about frames /// note - for Audio stream are all frames marked as KeyFrames size_t GetMaxKfFrameSize() const; size_t GetMinKfFrameSize() const; size_t GetAvgKfFrameSize() const; uint_t GetKfFrames() const; int64_t GetKfFramesSize() const; /// delta frames - valid for video stream size_t GetMaxFrameSize() const; size_t GetMinFrameSize() const; size_t GetAvgFrameSize() const; uint_t GetFrames() const; int64_t GetFramesSize() const; // for non video returns -1 int GetVideoWidth() const; int GetVideoHeight() const; float GetAspectRatio() const; // for non audio returns -1 int GetAudioBitsPerSample() const; int GetAudioChannels() const; int GetAudioSamplesPerSec() const; const avm::vector& GetProperties() const; protected: struct StreamInfoPriv; // forward declaration struct StreamInfoPriv* m_p; // private structure - hidden }; AVM_END_NAMESPACE; #endif // AVIFILE_STREAMINFO_H avifile-0.7.48~20090503.ds/include/VideoDPMS.h0000644000175000017500000000056111107365277017302 0ustar yavoryavor#ifndef AVIFILE_VIDEODPMS_H #define AVIFILE_VIDEODPMS_H #include "avm_default.h" #ifndef X_DISPLAY_MISSING #include #endif AVM_BEGIN_NAMESPACE; class AVMEXPORT VideoDPMS { Display* m_pDisplay; int m_iTimeoutSave; bool m_bDisabled; public: VideoDPMS(Display* dpy); ~VideoDPMS(); }; AVM_END_NAMESPACE; #endif // AVIFILE_VIDEODPMS_H avifile-0.7.48~20090503.ds/include/audiodecoder.h0000644000175000017500000000343411164472545020201 0ustar yavoryavor#ifndef AVIFILE_AUDIODECODER_H #define AVIFILE_AUDIODECODER_H #include "infotypes.h" AVM_BEGIN_NAMESPACE; /** * * Audio decoder abstract class. * * Performs decompression of data from * various audio formats into raw 2 channels PCM * * Some common methods are already implemented * to avoid useless source copying * * Different output format might be requested by * SetOutputFormat method */ class AVMEXPORT IAudioDecoder { public: IAudioDecoder(const CodecInfo& info, const WAVEFORMATEX* in); virtual ~IAudioDecoder(); /** * Decodes data. It is guaranteed that either size_read or size_written * will receive nonzero value if out_size>=GetMinSize(). */ virtual int Convert(const void* in_data, size_t in_size, void* out_data, size_t out_size, size_t* size_read, size_t* size_written) = 0; /** * Flush call after seek */ virtual void Flush(); virtual const CodecInfo& GetCodecInfo() const; /** * Minimal required output buffer size. Calls to Convert() will * fail if you pass smaller output buffer to it. */ virtual size_t GetMinSize() const; /** * Returns output format for this audio decoder. */ virtual int GetOutputFormat(WAVEFORMATEX* destfmt) const; virtual IRtConfig* GetRtConfig(); // can't be const /** * Estimates the amount (in bytes) of input data that's * required to produce specified amount of decompressed PCM data. */ virtual size_t GetSrcSize(size_t dest_size) const; /** * Set output format * Returns -1 if unsupported */ virtual int SetOutputFormat(const WAVEFORMATEX* destfmt); protected: const CodecInfo& m_Info; WAVEFORMATEX* m_pFormat; size_t m_uiBytesPerSec; }; AVM_END_NAMESPACE; #endif // AVIFILE_AUDIODECODER_H avifile-0.7.48~20090503.ds/include/audioencoder.h0000644000175000017500000000363611164472545020217 0ustar yavoryavor#ifndef AVIFILE_AUDIOENCODER_H #define AVIFILE_AUDIOENCODER_H /******************************************************** * * Audio encoder interface. * ********************************************************/ #include "infotypes.h" AVM_BEGIN_NAMESPACE; /** * * \warning * As of 1/15/2001, the only supported format is MPEG layer-3 * ( using Lame encoder v. 3.70 ), format id 0x55. Arguments passed * to Create() are not checked for correctness. Only 16-bit input * is supported. * */ class AVMEXPORT IAudioEncoder { public: IAudioEncoder(const CodecInfo& info); virtual ~IAudioEncoder(); /** * Finishes conversion. May write some more data * ( pass buffer of >10kb size here ). */ virtual int Close(void* out_data, size_t out_size, size_t* size_written) = 0; /** * Encodes data. Parameters in_size and size_read are measured * in samples ( not in bytes ). */ virtual int Convert(const void* in_data, size_t in_size, void* out_data, size_t out_size, size_t* size_read, size_t* size_written) = 0; virtual const CodecInfo& GetCodecInfo() const; /// Reads the format structure. (format == 0 -> query for size) virtual size_t GetFormat(void* format = 0, size_t size = 0) const = 0; /// Starts conversion. virtual int Start() = 0; /// USE ATTRIBUTES as for video - we want to support a lot of various parameters /// Sets bitrate in bytes/second. virtual int SetBitrate(int bitrate); /// Sets encoding quality ( 1..10 ). virtual int SetQuality(int quality); /// Sets more extra options //virtual int Set(int option, int param) { return -1; } /// Queries for the size of structure describing destination format. /// \obsolete - just source backward compatible size_t GetFormatSize() const { return GetFormat(0, 0); } protected: const CodecInfo& m_Info; }; AVM_END_NAMESPACE; #endif // AVIFILE_AUDIOENCODER_H avifile-0.7.48~20090503.ds/include/avifile.h0000644000175000017500000003753111172414764017174 0ustar yavoryavor#ifndef AVIFILE_AVIFILE_H #define AVIFILE_AVIFILE_H #include "avm_stl.h" #include "formats.h" AVM_BEGIN_NAMESPACE; class CImage; class CodecInfo; class IAudioDecoder; class IImageAllocator; class IVideoDecoder; class StreamInfo; class VideoEncoderInfo; /** * Classes for reading & writing movie files. * Interfaces are the same for all supported formats: * AVI, local and networked ASF 1.0. Writing is * possible only into AVI files. */ /** * Abstract class for reading streams */ class IStream { public: static const framepos_t ERR = ~0U; static const int KEYFRAME = 0x00000010; enum StreamType { Audio, Video, Other }; enum StreamFormat { Avi = 1, Wav = 10 }; virtual ~IStream(); }; /** * This class provides means of sequential access to data from one * stream, usually video or soundtrack. Though AVI files rarely contain * more than one soundtrack, they are also supported. Streams of other * kind are not handled. * * It maintains an internal position counter, which can be read with * @ref GetPos()/@ref GetTime() and changed with @ref Seek()/@ref SeekToKeyframe(). * This counter is modified by all reading functions; function that reads * 10 frames will increase counter by 10. * * IReadStream is capable of implicit video and audio decompression, * so that you won't need to work with decoders directly. All you need is * to call @ref StartStreaming(), and if it succeeds ( does not throw exception ), * call members that decompress data into internal buffer ( @ref ReadFrame() ), * return this buffer ( @ref GetFrame() ) or decompress data into your memory * ( @ref ReadFrames() ). * * If you want to have direct access to compressed data, use @ref ReadDirect(). * Note that this call is incompatible with streaming, so calls to @ref ReadDirect() * between @ref StartStreaming() and @ref StopStreaming() will fail. It is done so * because dropping even one data frame during sequence decompression will ruin * current picture. * * Since version 0.6, these interfaces are also able to handle ASF 1.0 local * files, pre-recorded and broadcast MMS URLs. Special care is needed when * you want to deal with such files. * First of all, you should not assume that all video and audio frames have * the same duration ( result of GetFrameTime() ). It is not true for ASF files. * Instead, use GetTime(). * For MMS URLs, do not rely on GetPos() and Seek(framepos_t) at all. * These operations are simply unavailable in MMS protocol. * Use only SeekTime(double), and only when it's definitely needed, because it * is very lengthy operation. For live broadcast streams SeekTime(double) * is not available, either. * There's an important issue with Seek() and multiple streams in MMS. * For the sake of efficiency library does not allow streams to be seekable * independently. Each Seek() operation on one stream automatically repositions * pointer for others approximately to the same position. * */ class IReadStream : public IStream { public: /** Checks for end of stream. */ virtual bool Eof() const =0; virtual StreamType GetType() const =0; /** * might disappear - use StreamInfo - this might only useful for stream copy * - size query - pheader == 0 */ virtual size_t GetHeader(void* pheader = 0, size_t size = 0) const =0; /** * For audio stream returns audio format information. Stores main * format info in wf - usually WAVEFORMATEX structure * * if wf == 0 -- query for the size of structure * For other stream types fails. */ virtual size_t GetAudioFormat(void* format = 0, size_t size = 0) const =0; /** * For video stream returns video format information * ( usually in BITMAPINFOHEADER format ). * For other stream types fails. * * if format == 0 -- query for the size of structure */ virtual size_t GetVideoFormat(void* format = 0, size_t size = 0) const =0; /** Total length of stream in samples. */ virtual framepos_t GetLength() const =0; /** Total length of stream in seconds. */ virtual double GetLengthTime() const =0; /** * Returns various informations in StreamInfo structure like * stream size in bytes, avg chunk size and some others... * It is users responsibility to delete this object * when stream information is no longer needed! * * THIS IS PREFFERED method to get information about stream! * GetVideoFormatInfo & GetAudioFormatInfo should be used only * when you know what you are doing - mainly for data copying */ virtual StreamInfo* GetStreamInfo() const =0; /** Duration of one frame/sample. */ virtual double GetFrameTime() const =0; /** * Following four methods are only meaningful for video streams, * but no checking is done * value ERR means current frame */ virtual framepos_t GetNextKeyFrame(framepos_t frame = ERR) const =0; virtual framepos_t GetPrevKeyFrame(framepos_t frame = ERR) const =0; virtual framepos_t SeekToNextKeyFrame() =0; virtual framepos_t SeekToPrevKeyFrame() =0; /** * Seeks to position 'pos' in stream. In video streams, if * streaming is started, you will need to decompress all * video frames since last key-frame before pos. */ virtual int Seek(framepos_t pos) =0; virtual int SeekTime(double pos) =0; virtual framepos_t SeekToKeyFrame(framepos_t pos) =0; virtual double SeekTimeToKeyFrame(double pos) =0; virtual int SkipFrame() =0; virtual int SkipTo(double pos) =0; /** * Time for frame - ERR -> current time */ virtual double GetTime(framepos_t frame = ERR) const =0; /** * Current frame position in stream. */ virtual framepos_t GetPos() const =0; virtual bool IsStreaming() const =0; /** * Initialize decoder. */ virtual int StartStreaming(const char* privname = 0) =0; /** * Close decoder. */ virtual int StopStreaming() =0; /*** For audio streams ***/ /** * Retrieve pointer to audio decoder - use with caution!!! */ virtual IAudioDecoder* GetAudioDecoder() const =0; /** * Reads and decompresses variable number of frames into * user-supplied buffer. */ virtual int ReadFrames(void* buffer, size_t buffer_size, size_t samples, size_t& samples_read, size_t& bytes_read) =0; /*** For video streams ***/ /** * retrieve pointer to video decoder - use with caution!!! */ virtual IVideoDecoder* GetVideoDecoder() const =0; /** * Returns current output format. Call after StartStreaming. */ virtual size_t GetOutputFormat(void* format = 0, size_t size = 0) const =0; /** * Returns flags associated with current frame. You'll need this * function if you use IVideoDecoder for decompression. Then, * pass resulting value to decoder together with frame data. */ virtual int GetFrameFlags(int* flags) const =0; /** * Can be calculated from video format as width*height*bpp/8 usually */ virtual size_t GetFrameSize() const =0; /** * Flip image upside/down in decoder */ virtual int SetDirection(bool direction) =0; /** * Specifies desired output format. Call before StartStreaming. * Only valid for video streams. Not implemented yet. */ virtual int SetOutputFormat(void* bi, size_t size) =0; /** * Reads one frame, decompresses it into internal buffer * and increases position counter. */ virtual int ReadFrame(bool render = true) =0; /** * Returns pointer to internal frame buffer. * It will call ReadFrame internaly when readFrame == true. * when you no longer need this frame - call CImage::Release() */ virtual CImage* GetFrame(bool read_frame = false) =0; /** * Directly reads data from file. Incompatible with streaming. */ virtual int ReadDirect(void* buffer, size_t bufsize, size_t samples, size_t& samples_read, size_t& bytes_read, int* flags = 0) =0; /** * Returns approximate size of internal chunk cache. 1 is 'cache full' * and 0 is 'cache empty'. When cache size is too low, it may be a * good idea to wait for some time until it refills. */ virtual double CacheSize() const =0; /** * Private mainly for aviplay usage */ virtual int SetBuffering(size_t maxsz = 1, IImageAllocator* ia = 0) =0; /** * Retrieve information about buffers - max size and current status */ virtual size_t GetBuffering(size_t* bufsz = 0) const =0; #ifdef AVM_COMPATIBLE /** * backward compatible inline declaration - do not use in new programs */ /** * \deprecated * For audio stream returns audio format information. Stores main * format info in wf - usually WAVEFORMATEX structure - and pointer * to complete format in ext if ext is nonzero and if its size is * more than 18=sizeof(WAVEFORMATEX). * If *ext!=NULL on return, you should free it with delete * when it's not needed anymore. */ int GetAudioFormatInfo(void* wf, char** ext) const { size_t sz = GetAudioFormat(); char* b = new char[sz]; GetAudioFormat(b, sz); if (wf) { for (unsigned i = 0; i < sz && i < sizeof(WAVEFORMATEX); i++) ((char*)wf)[i] = b[i]; } if (ext) { if (*ext) { for (unsigned i = 0; i < sz; i++) (*ext)[i] = b[i]; delete[] b; } else *ext = b; } else delete[] b; return 0; } /** \deprecated */ size_t GetVideoFormatInfo(void* bi, size_t size) const { return GetVideoFormat(bi, size); } /** \deprecated */ IVideoDecoder* GetDecoder() const { return GetVideoDecoder(); }; #endif }; class IReadFile { public: enum { // currently these names aren't final // DO NOT USE if you want to stay compatible for NOW ! // ignore indexes in files (i.e. if avi index gives false info) IGNORE_INDEX = 1, // ignore more header informations // (might help with some broken files) IGNORE_HEADER = 2, // do not create precaching thread NO_THREAD = (1 << 31) }; virtual ~IReadFile(); virtual size_t StreamCount() =0; virtual size_t VideoStreamCount() =0; virtual size_t AudioStreamCount() =0; /** * May return something not completely correct for ASF file, * because it is not always possible to convert ASF to AVI. * For MMS URL returns structure with many invalid fields. * If you want to retrieve AVI header - pass approriate structure size * as it's rather internal you shouldn't need to use this function */ virtual size_t GetHeader(void* header, size_t size) =0; virtual IReadStream* GetStream(uint_t stream_id, IStream::StreamType type) =0; /** * With redirector you could only get list of URLs. */ virtual bool GetURLs(avm::vector& urls) =0; /** * See doc/README-DEVEL * For local files IsOpened() will return true immediately after opening. */ virtual bool IsOpened() =0; virtual bool IsValid() =0; virtual bool IsRedirector() =0; }; /** * Interface for storing any data into a stream */ class IWriteStream : public IStream { public: virtual int AddChunk(const void* chunk, size_t size, int flags = 0) =0; virtual size_t GetLength() const =0; virtual StreamType GetType() const =0; }; /** * Interface for video compressed stream */ class IVideoWriteStream { public: virtual ~IVideoWriteStream(); // data will be filled with pointer to encoded data virtual int AddFrame(CImage* img, size_t* size=0, int* keyframe=0, char** const data = 0) =0; virtual const CodecInfo& GetCodecInfo() const =0; virtual size_t GetLength() const =0; virtual int Start() =0; virtual int Stop() =0; #ifdef AVM_COMPATIBLE //0..10000 // use codecs atribute! virtual int SetQuality(int quality) { return -1; } virtual int SetKeyFrame(int frequency) { return -1; } #endif }; /** * Interface for audio compressed stream */ class IAudioWriteStream { public: virtual ~IAudioWriteStream(); virtual int AddData(void* data, size_t size) =0; virtual const CodecInfo& GetCodecInfo() const =0; virtual size_t GetLength() const =0; //???virtual int SetAudioPreload(int preloadtime = 500.0, int rate = 100, bool bytime = true); virtual int Start() =0; virtual int Stop() =0; #ifdef AVM_COMPATIBLE //0..10 virtual int SetQuality(int quality) { return -1; } #endif }; class IWriteFile { public: virtual ~IWriteFile(); // DO NOT delete these returned stream! virtual IVideoWriteStream* AddVideoStream(fourcc_t fourcc, const BITMAPINFOHEADER* srchdr, int frame_rate, int flags = 0) =0; virtual IVideoWriteStream* AddVideoStream(const CodecInfo& ci, const BITMAPINFOHEADER* srchdr, int frame_rate, int flags = 0) =0; virtual IVideoWriteStream* AddVideoStream(const VideoEncoderInfo* vi, int frame_rate, int flags = 0) =0; virtual IAudioWriteStream* AddAudioStream(fourcc_t fourcc, const WAVEFORMATEX* format, int bitrate, int flags = 0) =0; virtual IAudioWriteStream* AddAudioStream(const CodecInfo& ci, const WAVEFORMATEX* format, int bitrate, int flags = 0) =0; virtual IWriteStream* AddStream(IStream::StreamType type, const void* format, size_t format_size, fourcc_t handler, int frame_rate, size_t samplesize = 0, int quality = 0, int flags = 0) =0; // make stream with same parameters as given stream // useful for making copy of the stream virtual IWriteStream* AddStream(IReadStream* pCopyStream) =0; virtual const char* GetFileName() const =0; virtual int64_t GetFileSize() const =0; virtual int Reserve(size_t size) =0; virtual int WriteChunk(fourcc_t fourcc, void* data, size_t size) =0; // close current file and open new avi file with same parameters virtual int Segment() =0; // waits till the next keyframe and then segments virtual void SegmentAtKeyframe() =0; virtual void SetSegmentName(const avm::string& new_name) =0; }; /** * Open stream from given URL */ AVMEXPORT IReadFile* CreateReadFile(const char* url, int flags = 0); /** * Create writable stream * */ AVMEXPORT IWriteFile* CreateWriteFile(const char* filename, int64_t flimit = 0, // limit for segmentation IStream::StreamFormat fmt = IStream::Avi, int flags = 0, int mask = 00666 // mask for file opening ); AVM_END_NAMESPACE; ////////////////////////////////////// // backward compatibility // - so far still use old API calls!!! ////////////////////////////////////// #ifdef AVM_COMPATIBLE typedef avm::IStream AviStream; typedef avm::IReadStream IAviReadStream; typedef avm::IReadFile IAviReadFile; typedef avm::IWriteFile IAviWriteFile; typedef avm::IWriteFile ISegWriteFile; typedef avm::IWriteFile IAviSegWriteFile; typedef avm::IWriteStream IAviWriteStream; typedef avm::IAudioWriteStream IAviAudioWriteStream; typedef avm::IVideoWriteStream IAviVideoWriteStream; static inline IAviReadFile* CreateIAviReadFile(const char* url) { return avm::CreateReadFile(url, 0); } static inline IAviWriteFile* CreateIAviWriteFile(const char* url, int flags = 0, int mask = 00666) { return avm::CreateWriteFile(url, 0, avm::IStream::Avi, flags, mask); } static inline IAviSegWriteFile* CreateSegmentedFile(const char* url, uint_t flimit = 0x7F000000, int flags = 0, int mask = 00666) { return avm::CreateWriteFile(url, flimit, avm::IStream::Avi, flags, mask); } #endif // AVM_COMPATIBLE #endif // AVIFILE_AVIFILE_H avifile-0.7.48~20090503.ds/include/aviplay.h0000644000175000017500000002447611177255755017236 0ustar yavoryavor#ifndef AVIFILE_IAVIPLAYER_H #define AVIFILE_IAVIPLAYER_H /** * AVI player, ver. 0.7.X * Copyright 2002-2009 Zdenek Kabelac (kabi@users.sf.net) * Copyright 2001 Eugene Kuznetsov (divx@euro.ru) */ #include "infotypes.h" #include "image.h" #include "avm_args.h" typedef void (*KILLHANDLER)(int, void* p); typedef ssize_t (*AUDIOFUNC)(const void* srcdata, size_t size, void* p); struct subtitle_line_t; AVM_BEGIN_NAMESPACE; class IPlayerWidget; class IRtConfig; class IVideoRenderer; class StreamInfo; /** * * This class is meant to contain all code that is * not related to graphical interface of AVI/ASF player: you provide * an interface ( buttons, windows, etc. ), this class * provides you with video data and performs audio playback. * * NEVER call playback-controlling functions ( even indirectly * through event processing calls, such as qApp->processEvents * in Qt ) from its callbacks. * * Usage: * * Call CreateAviPlayer(), specifying file name of AVI/ASF file, bit depth * of physical screen and optional file name of subtitle file. * Catch FatalError if player can't be constructed. Set two callbacks: * kill handler ( will be called when player stops ) and draw callback * ( called each frame during playback and frequently if paused. Takes * non-zero pointer to video data or NULL if frame sholdn't be drawn ). * Passed URL may refer to remote ( MMS://... ) ASF file. Such files are * opened asynchronously. It means that constructor only performs sanity * checking on the file name, starts actual opening process ( in another * thread ) and returns. You should periodically call isOpened() until * it returns true, which means that opening process has finished. After that, * you can determine if it was successful by calling isValid(). For local * files isOpened() and isValid() will return 'true' immediately after * successful construction. * URL can point to ASX ( redirector ) file. For such file isRedirector() * will return 'true'. If this is the case, read list of redirected URLs * with getURLs(). After that, IAviPlayer object may be destroyed because * you can't do anything else with it. * Prepare to draw video and call start(). Player immediately starts * playing. Its state can be controlled by calls play()/pause()/reseek(), * player can be stopped by stop() and started again by start(). * Once again: don't try to call these functions from draw callback or * your program will burn in hell forever. * When playing ASF files over the network and AVI files over slow * connections, player may occasionally get into 'buffering' state. * It means that player stops to output data and waits until its internal * buffers are refilled. You can determine if it's in buffering state * by calling GetState(). It'll put buffer fill percentage into variable * pointed by its argument if buffering takes place ( here 1 corresponds * to full buffers and 0 to empty buffers ). * Player can be destroyed with 'delete'. Deleting automatically stops * playback and frees all resources. * */ class IAviPlayer { public: enum Property { PROPERTY_END, // 0 - marks last property AUDIO_CODECS, // char* VIDEO_CODECS, // char* AUDIO_RENDERER, // char* VIDEO_RENDERER, // char* SUBTITLE_RENDERER, // char* USE_YUV, // bool AUTOREPEAT, // bool AUDIO_STREAM, // int (0..127) VIDEO_STREAM, // int SUBTITLE_FONT, // char* SUBTITLE_ASYNC_TIME_MS, // int SUBTITLE_EXTEND_TIME_MS,// int SUBTITLE_CODEPAGE, // char* (iconv --list) SUBTITLE_ENABLED, // int SUBTITLE_WRAP, // int SUBTITLE_BGCOLOR, // int SUBTITLE_FGCOLOR, // int SUBTITLE_HPOSITION, // int USE_HTTP_PROXY, // bool HTTP_PROXY, // char* AUDIO_RESAMPLING, // bool AUDIO_RESAMPLING_RATE, // int AUDIO_PLAYING_RATE, // int AUDIO_MASTER_TIMER, // bool AUDIO_VOLUME, // int (0..1000 - is standard level) AUDIO_BALANCE, // int (0..1000 - 500 - is standard mid-level) AUDIO_URL, // char* URL VIDEO_PRESERVE_ASPECT, // bool VIDEO_BUFFERED, // bool VIDEO_DIRECT, // bool VIDEO_DROPPING, // bool VIDEO_QUALITY_AUTO, // bool DISPLAY_FRAME_POS, // bool ASYNC_TIME_MS, // int // fill new entires here // add appropriate line into avifileprop.cpp /** for internal usage only */ LAST_PROPERTY, /** average drop in % (int*) */ QUERY_AVG_DROP = 10000, /** average image quality in % (int*) */ QUERY_AVG_QUALITY, /** */ QUERY_AUDIO_STREAMS, // int number of audio streams QUERY_VIDEO_STREAMS, // int number of video streams QUERY_AUDIO_RENDERERS, QUERY_VIDEO_RENDERERS, QUERY_SUBTITLE_RENDERERS, QUERY_VIDEO_WIDTH, // int QUERY_VIDEO_HEIGHT, // int QUERY_EOF // bool #ifdef AVM_COMPATIBLE // backward compatible , DEFAULT_AUDIO_STREAM = AUDIO_STREAM #endif }; enum State { Opening, Buffering, Playing, Stopped, Paused, Invalid }; virtual ~IAviPlayer() {} /** options for aviplay */ static AVMEXPORT const Args::Option* getOptions(); /** filename of the currently played stream */ virtual const char* GetFileName() const =0; /** retrieve player state */ virtual State GetState(double* percent) =0; // player state virtual bool GetURLs(avm::vector& urls) const =0; virtual double GetAudioLengthTime() const =0; virtual const char* GetAudioFormat() const =0; virtual StreamInfo* GetAudioStreamInfo() const =0; virtual double GetVideoLengthTime() const =0; virtual const char* GetVideoFormat() const =0; virtual StreamInfo* GetVideoStreamInfo() const =0; virtual double GetFps() const =0; // video frames per second virtual int GetWidth() const =0; // video width virtual int GetHeight() const =0; // video height virtual double GetLengthTime() const = 0; // length of longer stream virtual double GetTime() const =0; virtual framepos_t GetFramePos() const =0; // playing frame position virtual const subtitle_line_t* GetCurrentSubtitles() =0; virtual bool HasSubtitles() const =0; virtual int InitSubtitles(const char* filename) =0; virtual bool IsOpened() const =0; // true if stream is opened virtual bool IsRedirector() const =0; virtual bool IsValid() const =0; virtual bool IsPaused() const =0; // true -> paused virtual bool IsPlaying() const =0; // true -> playing || paused virtual bool IsStopped() const =0; // true -> !playing && !paused virtual int NextFrame() =0; // to next frame ( mostly useful in pause mode ) virtual int NextKeyFrame() =0; // to next keyframe virtual int PrevFrame() =0; // to prev frame - might take a lot of time!!! virtual int PrevKeyFrame() =0; // to prev keyframe ( the one before frame drawn last time ) virtual void Pause(bool state) =0; virtual void Play() =0; // start playing virtual double Reseek(double timepos) =0; virtual int ReseekExact(double timepos) =0; // nonzero if unable virtual int SetColorSpace(fourcc_t csp, bool test_only) =0; virtual void SetKillHandler(KILLHANDLER handler, void* argument=0) =0; virtual void SetAudioFunc(AUDIOFUNC func, void* argument=0) =0; virtual void Start() =0; virtual void Stop() =0; // reading and setting list of video renderers - should work in runtime later virtual const avm::vector& GetVideoRenderers() const =0; virtual int SetVideoRenderers(avm::vector) =0; //to be added!!! virtual const std::vector& GetAudioRenderers() const =0; //to be added!!! virtual int SetAudioRenderers(vector) =0; // General interface to control various things at runtime // - list of properties with arguments is finished with 0 (PROPERTY_END) // WARNING: passed pointers has to match its type!!! virtual int Get(...) const = 0; virtual int Set(...) = 0; /** * type could be AUDIO_CODECS, VIDEO_CODECS */ virtual const CodecInfo& GetCodecInfo(int type = VIDEO_CODECS) const =0; /** * type could be AUDIO_CODECS, VIDEO_CODECS, AUDIO_RENDERER, VIDEO_RENDERER */ virtual IRtConfig* GetRtConfig(int type = VIDEO_CODECS) const =0; virtual void Restart() =0; virtual bool GetVideo() const =0; virtual void SetVideo(bool enabled) =0; virtual bool GetAudio() const =0; virtual void SetAudio(bool enabled) =0; #ifdef AVM_COMPATIBLE // // Obsolete backward compatible calls // Audio/video sync correction, argument in seconds // virtual float GetAsync() const =0; virtual void SetAsync(float asynctime) =0; // \deprecated int PageUp() { return NextKeyFrame(); } // \deprecated int PageDown() { return PrevKeyFrame(); } // \deprecated IRtConfig* GetRuntimeConfig() const { return GetRtConfig(); } // \deprecated double GetPos() const { return GetTime(); } #endif }; /** * This object has interface very similar to IAviPlayer, but * it does drawing by itself. You do not need to provide * pointer to kill handler, but you can still do it. Attempts * to install draw callback will be ignored. * Create an object with this interface by calling CreateAviPlayer2(). * Its arguments: * parent - pointer to interface which handles a few specific * key & mouse events in movie window. * Optional. Pass it if you want to do this handling by yourself. * dpy - pointer to opened X display. * Optional. If it's non-NULL, * movie window will be created on this display. If it's NULL, * movie window won't be created at all. * filename & subname - same as when constructing IAviPlayer. */ class IAviPlayer2: public IAviPlayer { public: virtual ~IAviPlayer2() {} virtual int Refresh() =0; virtual int Resize(int& new_w, int& new_h) =0; virtual int Zoom(int x, int y, int w, int h) =0; virtual int ToggleFullscreen(bool maximize = false) =0; }; AVMEXPORT IAviPlayer* CreateAviPlayer(const char* filename, int bitdepth, const char* subfile = 0, int flags = 0, // vcodec & acodec are going to be supported const char* vcodec = 0, const char* acodec = 0); //void* instead of Display* AVMEXPORT IAviPlayer2* CreateAviPlayer2(IPlayerWidget*, void* dpy, const char* filename, const char* subname, int flags = 0, // vcodec & acodec are going to be supported const char* vcodec = 0, const char* acodec = 0); AVM_END_NAMESPACE; AVM_BEGIN_EXTERN_C; AVMEXPORT int GetAvifileVersion(); AVM_END_EXTERN_C; #endif //AVIFILE_IAVIPLAYER_H avifile-0.7.48~20090503.ds/include/avm_args.h0000644000175000017500000000655111165367531017353 0ustar yavoryavor#ifndef AVM_ARGS_H #define AVM_ARGS_H #include "avm_default.h" AVM_BEGIN_NAMESPACE; class AVMEXPORT Args { public: class Option { public: enum Type { NONE = '#', HELP = 'h', // use default help text and options CODEC = 'c', // show available codec options (char*) OPTIONS = 'O', // @value is pointer to another Options array SUBOPTIONS = 'o', // @value is pointer to SubOptions array // these options are separated by ':' BOOL = 'b', // true flag when option is present (default is false) DOUBLE = 'd', // double from given range (max == min -> unlimited) INT = 'i', // integer from given range (max == min -> unlimited) STRING = 's', // any string could be given SELECTSTRING = 'x', // string from the list REGBOOL = 'B', REGDOUBLE = 'D', REGINT = 'I', REGSTRING = 'S' }; Option(const char* o, const void* v = 0, int32_t mi = 0, int32_t ma = 0) : opts(o), value(v), min(mi), max(ma) {} Option(const char* o, const bool* b) : opts(o), value(b) {} const char* getLongOption() const { return opts + 1; } const char* getShortOption() const { return findString(1); } const char* getHelp() const { return findString(2); } int32_t getInt() const { return (value) ? *(const int32_t*)value : 0; } int32_t getMin() const { return min; } int32_t getMax() const { return max; } bool getBool() const { return (value) ? *(const bool*)value : false; } double getDouble() const { return (value) ? *(const double*)value : 0.; } const char* getString() const { return (const char*)value; } const Option* getOptions() const { return (const Option*)value; } Type getType() const { return (Type) opts[0]; } bool is(Type t) const { return (t == getType()); } bool isInRange(int32_t v) const { return (getMin() == getMax()) || (getMin() <= v && v <= getMax()); } int setBool(bool b) const { return (value) ? *(bool*)value = b, 0 : -1; } int setDouble(double d) const { return (value) ? *(double*)value = d, 0 : -1; } int setInt(int32_t i) const { return (value) ? *(int32_t*)value = i, 0 : -1; } int setString(char* s) const { return (value) ? *(char**)value = s, 0 : -1; } private: // go through adjanced zero ended strings const char* findString(int cnt) const { const char* r = opts; while (cnt--) while (*r++) ; return r; } const char* opts; // 'Type' long-option-str \0 short-option-str \0 help-str const void* value; // storage pointer for value // for SUB/OPTIONS contains subarray with Options // for REG+ contains pointer to default value union { struct { int32_t min; // min integer value int32_t max; // max integer value }; const char* defstr; // list of string options }; }; Args(const Option* options, int* argc, char** argv, const char* help = 0, const char* regname = 0); ~Args(); // could be used to parse CodecInfo arguments static void ParseCodecInfo(const char* str); protected: int findOpt(int olong = 0); const Option* opts; int* argc; char** argv; const char* help; const char* regname; int idx; }; #ifdef __GNUC__ #define ARGSOPTION(a, b, c, d, args...) \ Args::Option(a b "\0" c "\0" d, ## args) #else #define ARGSOPTION(a, b, c, d, ...) \ Args::Option(a b "\0" c "\0" d, __VA_ARGS__) #endif AVM_END_NAMESPACE; #endif /* AVM_ARGS_H */ avifile-0.7.48~20090503.ds/include/avm_avcodec.h0000644000175000017500000000036411106427223020005 0ustar yavoryavor/* * This header file exists, because some people hate C++ so much */ #ifndef AVM_AVCODEC_H #define AVM_AVCODEC_H #ifdef __cplusplus extern "C" { #endif #include #ifdef __cplusplus } #endif #endif // AVM_AVCODEC_H avifile-0.7.48~20090503.ds/include/avm_avformat.h0000644000175000017500000000037111106425524020220 0ustar yavoryavor/* * This header file exists, because some people hate C++ so much */ #ifndef AVM_AVFORMAT_H #define AVM_AVFORMAT_H #ifdef __cplusplus extern "C" { #endif #include #ifdef __cplusplus } #endif #endif // AVM_AVFORMAT_H avifile-0.7.48~20090503.ds/include/avm_cpuinfo.h0000644000175000017500000000332611106427153020047 0ustar yavoryavor#ifndef AVM_CPUINFO_H #define AVM_CPUINFO_H #include "avm_default.h" AVM_BEGIN_NAMESPACE; class CPU_Info { double freq; bool have_tsc; bool have_mmx; bool have_mmxext; bool have_sse; public: CPU_Info(); ~CPU_Info(); void Init(); /** * Returns nonzero if the processor supports MMX instruction set. */ bool HaveMMX() const {return have_mmx;} /** * Returns nonzero if the processor supports extended integer MMX instruction set ( Pentium-III, AMD Athlon and compatibles ) */ bool HaveMMXEXT() const {return have_mmxext;} /** * Returns nonzero if the processor supports 'SSE' floating-point SIMD instruction set ( Pentium-III and compatibles ) */ bool HaveSSE() const {return have_sse;} /** * Returns nonzero if the processor has time-stamp counter feature. */ bool HaveTSC() const {return have_tsc;} /** * Returns processor frequency in kHz. */ operator double() const {return freq;} }; AVM_END_NAMESPACE; extern AVMEXPORT avm::CPU_Info freq; AVM_BEGIN_EXTERN_C; static inline int avm_is_mmx_state() { #ifdef ARCH_X86 if (freq.HaveMMX()) { unsigned short tagword = 0; char b[28]; __asm__ __volatile__ ("fnstenv (%0)\n\t" : : "r"(&b)); tagword = *(unsigned short*) (b + 8); return (tagword != 0xffff); } #endif return 0; } #ifdef AVM_COMPATIBLE /** * Returns duration of time interval between two timestamps, received * with longcount() in miliseconds */ static inline float to_float(int64_t tend, int64_t tbegin) { //return float((tend - tbegin) / (double)freq / 1000.); return float((double)(tend - tbegin) / 4294.967296); } #endif AVM_END_EXTERN_C; #endif // AVM_CPUINFO_H avifile-0.7.48~20090503.ds/include/avm_creators.h0000644000175000017500000001303311170321723020217 0ustar yavoryavor#ifndef AVM_CREATORS_H #define AVM_CREATORS_H #include "formats.h" #include "infotypes.h" AVM_BEGIN_NAMESPACE; class IAudioEncoder; class IAudioDecoder; class IVideoEncoder; class IVideoDecoder; /** * Attempts to create decoder for specified format. * Returns valid interface on success, 0 on failure. */ AVMEXPORT IAudioDecoder* CreateDecoderAudio(const WAVEFORMATEX* format, const char* privcname = 0); /** * Creates the encoder for specified format. Pass desired format id in * fourcc ( see lib/libwin32/loader/wine/mmreg.h * (you could be more specific with the codec's name) * or lib/audiodecoder/audiodecoder.cpp * for values ) and format of input data in fmt. * Returns interface on success, 0 on failure. */ AVMEXPORT IAudioEncoder* CreateEncoderAudio(const CodecInfo& ci, const WAVEFORMATEX* fmt); AVMEXPORT IAudioEncoder* CreateEncoderAudio(fourcc_t compressor, const WAVEFORMATEX* fmt); AVMEXPORT IVideoDecoder* CreateDecoderVideo(const BITMAPINFOHEADER& bh, int depth = 24, int flip = 0, const char* privcname = 0); AVMEXPORT IVideoEncoder* CreateEncoderVideo(const CodecInfo& ci, const BITMAPINFOHEADER& bh); AVMEXPORT IVideoEncoder* CreateEncoderVideo(fourcc_t compressor, const BITMAPINFOHEADER& bh, const char* cname = 0); AVMEXPORT IVideoEncoder* CreateEncoderVideo(const VideoEncoderInfo& info); AVMEXPORT void FreeDecoderAudio(IAudioDecoder* decoder); AVMEXPORT void FreeEncoderAudio(IAudioEncoder* encoder); AVMEXPORT void FreeDecoderVideo(IVideoDecoder* decoder); AVMEXPORT void FreeEncoderVideo(IVideoEncoder* encoder); AVMEXPORT int CodecGetAttr(const CodecInfo& info, const char* attribute, float* value); AVMEXPORT int CodecSetAttr(const CodecInfo& info, const char* attribute, float value); AVMEXPORT int CodecGetAttr(const CodecInfo& info, const char* attribute, int* value); AVMEXPORT int CodecSetAttr(const CodecInfo& info, const char* attribute, int value); AVMEXPORT int CodecGetAttr(const CodecInfo& info, const char* attribute, const char** value); AVMEXPORT int CodecSetAttr(const CodecInfo& info, const char* attribute, const char* value); /** * list of prefered codecs - delimited with commas "," * e.g: DivX ;-) fast-motion,ATI VCR-1, * * spaces are important! * comma must not be in the codec's name! */ AVMEXPORT int SortVideoCodecs(const char* orderlist); AVMEXPORT int SortAudioCodecs(const char* orderlist); AVMEXPORT const avm::string& CodecGetError(); AVM_END_NAMESPACE; #ifdef AVM_COMPATIBLE #define CREATORS_BEGIN_NAMESPACE namespace Creators { #define CREATORS_END_NAMESPACE } CREATORS_BEGIN_NAMESPACE; static inline avm::IAudioDecoder* CreateAudioDecoder(const WAVEFORMATEX* format, const char* privcname = 0) { return avm::CreateDecoderAudio(format, privcname); } /** * Creates the encoder for specified format. Pass desired format id in * fourcc ( see lib/libwin32/loader/wine/mmreg.h * (you could be more specific with the codec's name) * or lib/audiodecoder/audiodecoder.cpp * for values ) and format of input data in fmt. * Returns interface on success, 0 on failure. */ static inline avm::IAudioEncoder* CreateAudioEncoder(const avm::CodecInfo& ci, const WAVEFORMATEX* fmt) { return avm::CreateEncoderAudio(ci, fmt); } static inline avm::IAudioEncoder* CreateAudioEncoder(fourcc_t compressor, const WAVEFORMATEX* fmt) { return avm::CreateEncoderAudio(compressor, fmt); } static inline avm::IVideoDecoder* CreateVideoDecoder(const BITMAPINFOHEADER& bh, int depth = 24, int flip = 0, const char* privcname = 0) { return avm::CreateDecoderVideo(bh, depth, flip, privcname); } static inline avm::IVideoEncoder* CreateVideoEncoder(const avm::CodecInfo& ci, const BITMAPINFOHEADER& bh) { return avm::CreateEncoderVideo(ci, bh); } static inline avm::IVideoEncoder* CreateVideoEncoder(fourcc_t compressor, const BITMAPINFOHEADER& bh, const char* cname = 0) { return avm::CreateEncoderVideo(compressor, bh, cname); } static inline avm::IVideoEncoder* CreateVideoEncoder(const avm::VideoEncoderInfo& info) { return avm::CreateEncoderVideo(info); } static inline void FreeDecoderAudio(avm::IAudioDecoder* decoder) { return avm::FreeDecoderAudio(decoder); } static inline void FreeEncoderAudio(avm::IAudioEncoder* encoder) { return avm::FreeEncoderAudio(encoder); } static inline void FreeVideoDecoder(avm::IVideoDecoder* decoder) { return avm::FreeDecoderVideo(decoder); } static inline void FreeVideoEncoder(avm::IVideoEncoder* encoder) { return avm::FreeEncoderVideo(encoder); } static inline int GetCodecAttr(const avm::CodecInfo& info, const char* attribute, int& value) { return avm::CodecGetAttr(info, attribute, &value); } static inline int SetCodecAttr(const avm::CodecInfo& info, const char* attribute, int value) { return avm::CodecSetAttr(info, attribute, value); } static inline int GetCodecAttr(const avm::CodecInfo& info, const char* attribute, const char** value) { return avm::CodecGetAttr(info, attribute, value); } static inline int SetCodecAttr(const avm::CodecInfo& info, const char* attribute, const char* value) { return avm::CodecSetAttr(info, attribute, value); } /** * list of prefered codecs - delimited with commas "," * e.g: DivX ;-) fast-motion,ATI VCR-1, * * spaces are important! * comma must not be in the codec's name! */ static inline int SortVideoCodecs(const char* orderlist) { return avm::SortVideoCodecs(orderlist); } static inline int SortAudioCodecs(const char* orderlist) { return avm::SortAudioCodecs(orderlist); } static inline avm::string GetError() { return avm::CodecGetError(); } CREATORS_END_NAMESPACE; #endif #endif // AVM_CREATORS_H avifile-0.7.48~20090503.ds/include/avm_default.h0000644000175000017500000000511211175405413020024 0ustar yavoryavor#ifndef AVM_DEFAULT_H #define AVM_DEFAULT_H #ifndef WIN32 #ifdef HAVE_CONFIG_H #include "config.h" /* to get the HAVE_xxx_H defines */ #else /* we need something for int typedefs */ #include /* for int64_t and __WORDSIZE */ #define AVMEXPORT #define AVMPACKED #endif /* HAVE_CONFIG_H */ #ifdef HAVE_INTTYPES_H #include /* for int64_t and __WORDSIZE */ #elif HAVE_STDINT_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifndef PRId64 #define PRId64 "lld" /* pick some default */ #endif #define PRIsz __PRIPTR_PREFIX "u" /* pick some default */ #ifndef __WINE_WINDEF_H typedef long HRESULT; #endif /* __WINE_WINDEF_H */ #else /* WIN32 */ # define __attribute__() /* ' has C-linkage specified, but returns UDT 'basic_string 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ > 4))) # define _avm_printf_attr(a,b) __attribute((__format__(__printf__,a,b))) #else # define _avm_printf_attr(a,b) #endif #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 1) # define _avm_deprecated __attribute__((__deprecated__)) #else # define _avm_deprecated #endif #ifdef __cplusplus # define AVM_BEGIN_EXTERN_C extern "C" { # define AVM_END_EXTERN_C } # define AVM_BEGIN_NAMESPACE namespace avm { # define AVM_END_NAMESPACE } #else # define AVM_BEGIN_EXTERN_C # define AVM_END_EXTERN_C # define AVM_BEGIN_NAMESPACE # define AVM_END_NAMESPACE #endif /** * \namespace avm * * encupsulates functions & classes from the avifile library * * \author Zdenek Kabelac (kabi@users.sourceforge.net) * \author Eugene Kuznetsov (divx@euro.ru) */ #define AVM_COMPATIBLE /* define & build backward compatible code */ #endif /* AVM_DEFAULT_H */ avifile-0.7.48~20090503.ds/include/avm_except.h0000644000175000017500000000526310747171433017705 0ustar yavoryavor#ifndef AVIFILE_AVM_EXCEPT_H #define AVIFILE_AVM_EXCEPT_H #include "avm_default.h" //#warning exceptions will be OBSOLETE /******************************************************** Exception object Copyright 2000 Eugene Kuznetsov (divx@euro.ru) *********************************************************/ AVM_BEGIN_NAMESPACE; /** * * The idea is to use error codes for non-fatal problems * ( for example, problem in decompressing one frame is not fatal * for video decoder ) and exceptions for problems which leave * object in unusable state. GenError is an intermediate case. * */ class AVMEXPORT BaseError { protected: const char* file; char* module; char* description; char* severity; int line; public: BaseError(); /** \internal copy constructor */ BaseError(const BaseError& f); BaseError(const char* severity, const char* module, const char* file, int line, const char* desc); virtual ~BaseError(); BaseError& operator=(const BaseError& f); void Print(); void PrintAll(); const char* GetModule() const; const char* GetDesc() const; }; class AVMEXPORT FatalError: public BaseError { public: FatalError(const char* mod, const char* f, int l, const char* desc,...); FatalError(const FatalError& f):BaseError(f){} }; class AVMEXPORT GenError: public BaseError { public: GenError(const char* mod, const char* f, int l, const char* desc,...); GenError(const GenError& f):BaseError(f){} }; #define FATAL(X...) avm::FatalError(__MODULE__,__FILE__,__LINE__,X) #define WARNING(X...) avm::GenError(__ERR_MODULE__,__FILE__,__LINE__,X) AVM_END_NAMESPACE; #ifdef AVM_COMPATIBLE typedef avm::BaseError BaseError; typedef avm::FatalError FatalError; typedef avm::GenError GenError; #endif // AVM_COMPATIBLE /*** If you want to understand how exactly it will work: #include class Error { public: Error() { int pos; __asm__ __volatile__ ("push %%esp\n\t" "pop %%eax\n\t" : "=a"(pos) ); printf("Created Error object, esp=%x, this=%x\n", pos, this); } Error(const Error& e) { printf("Copy-created Error object %x from %x\n", this, &e); } ~Error() { printf("Destroyed Error object, this=%x\n", this); } }; void main() { try { throw Error(); } catch(const Error& e) { int pos; __asm__ __volatile__ ("push %%esp\n\t" "pop %%eax\n\t" : "=a"(pos) ); printf("esp %x\n", pos); printf("Caught object %x\n", &e); } } Created Error object, esp=bffff910, this=bffff964 Copy-created Error object 804a0c8 from bffff964 Destroyed Error object, this=bffff964 esp bffff940 Caught object 804a0c8 Destroyed Error object, this=804a0c8 ***/ #endif // AVIFILE_AVM_EXCEPT_H avifile-0.7.48~20090503.ds/include/avm_fourcc.h0000644000175000017500000002752607564500614017704 0ustar yavoryavor#ifndef AVM_FOURCC_H #define AVM_FOURCC_H #ifndef mmioFOURCC #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \ ( (long)(unsigned char)(ch0) | ( (long)(unsigned char)(ch1) << 8 ) | \ ( (long)(unsigned char)(ch2) << 16 ) | ( (long)(unsigned char)(ch3) << 24 ) ) #endif /* mmioFOURCC */ /* On2 Truemotion VP3.x */ #define RIFFINFO_VP31 mmioFOURCC('V', 'P', '3', '1') #define RIFFINFO_vp31 mmioFOURCC('v', 'p', '3', '1') #define RIFFINFO_VP30 mmioFOURCC('V', 'P', '3', '0') #define RIFFINFO_vp30 mmioFOURCC('v', 'p', '3', '0') /* OpenDivX */ #define RIFFINFO_MP4S mmioFOURCC('M', 'P', '4', 'S') #define RIFFINFO_mp4s mmioFOURCC('m', 'p', '4', 's') #define RIFFINFO_DIVX mmioFOURCC('D', 'I', 'V', 'X') #define RIFFINFO_divx mmioFOURCC('d', 'i', 'v', 'x') #define RIFFINFO_DX50 mmioFOURCC('D', 'X', '5', '0') #define RIFFINFO_dx50 mmioFOURCC('d', 'x', '5', '0') #define RIFFINFO_DIV1 mmioFOURCC('D', 'I', 'V', '1') #define RIFFINFO_div1 mmioFOURCC('d', 'i', 'v', '1') /* DivX codecs */ #define RIFFINFO_DIV2 mmioFOURCC('D', 'I', 'V', '2') #define RIFFINFO_div2 mmioFOURCC('d', 'i', 'v', '2') #define RIFFINFO_DIV3 mmioFOURCC('D', 'I', 'V', '3') #define RIFFINFO_div3 mmioFOURCC('d', 'i', 'v', '3') #define RIFFINFO_DIV4 mmioFOURCC('D', 'I', 'V', '4') #define RIFFINFO_div4 mmioFOURCC('d', 'i', 'v', '4') #define RIFFINFO_DIV5 mmioFOURCC('D', 'I', 'V', '5') #define RIFFINFO_div5 mmioFOURCC('d', 'i', 'v', '5') #define RIFFINFO_DIV6 mmioFOURCC('D', 'I', 'V', '6') #define RIFFINFO_div6 mmioFOURCC('d', 'i', 'v', '6') #define RIFFINFO_MP41 mmioFOURCC('M', 'P', '4', '1') #define RIFFINFO_mp41 mmioFOURCC('m', 'p', '4', '1') #define RIFFINFO_MP43 mmioFOURCC('M', 'P', '4', '3') #define RIFFINFO_mp43 mmioFOURCC('m', 'p', '4', '3') /* old MS Mpeg-4 codecs */ #define RIFFINFO_MP42 mmioFOURCC('M', 'P', '4', '2') #define RIFFINFO_mp42 mmioFOURCC('m', 'p', '4', '2') #define RIFFINFO_MPG3 mmioFOURCC('M', 'P', 'G', '3') #define RIFFINFO_mpg3 mmioFOURCC('m', 'p', 'g', '3') #define RIFFINFO_MPG4 mmioFOURCC('M', 'P', 'G', '4') #define RIFFINFO_mpg4 mmioFOURCC('m', 'p', 'g', '4') /* Windows Media codecs */ #define RIFFINFO_WMV1 mmioFOURCC('W', 'M', 'V', '1') #define RIFFINFO_wmv1 mmioFOURCC('w', 'm', 'v', '1') #define RIFFINFO_WMV2 mmioFOURCC('W', 'M', 'V', '2') #define RIFFINFO_wmv2 mmioFOURCC('w', 'm', 'v', '2') #define RIFFINFO_WMV3 mmioFOURCC('W', 'M', 'V', '3') #define RIFFINFO_wmv3 mmioFOURCC('w', 'm', 'v', '3') #define RIFFINFO_MWV1 mmioFOURCC('M', 'W', 'V', '1') /* Angel codecs */ #define RIFFINFO_AP41 mmioFOURCC('A', 'P', '4', '1') #define RIFFINFO_ap41 mmioFOURCC('a', 'p', '4', '1') #define RIFFINFO_AP42 mmioFOURCC('A', 'P', '4', '2') #define RIFFINFO_ap42 mmioFOURCC('a', 'p', '4', '2') /* other codecs */ /* Intel video */ #define RIFFINFO_IV31 mmioFOURCC('I', 'V', '3', '1') #define RIFFINFO_iv31 mmioFOURCC('i', 'v', '3', '1') #define RIFFINFO_IV32 mmioFOURCC('I', 'V', '3', '2') #define RIFFINFO_iv32 mmioFOURCC('i', 'v', '3', '2') #define RIFFINFO_IV41 mmioFOURCC('I', 'V', '4', '1') /* Indeo Interactive */ #define RIFFINFO_iv41 mmioFOURCC('i', 'v', '4', '1') #define RIFFINFO_IV50 mmioFOURCC('I', 'V', '5', '0') #define RIFFINFO_iv50 mmioFOURCC('i', 'v', '5', '0') #define RIFFINFO_H263 mmioFOURCC('H', '2', '6', '3') #define RIFFINFO_h263 mmioFOURCC('h', '2', '6', '3') #define RIFFINFO_I263 mmioFOURCC('I', '2', '6', '3') #define RIFFINFO_i263 mmioFOURCC('i', '2', '6', '3') #define RIFFINFO_U263 mmioFOURCC('U', '2', '6', '3') #define RIFFINFO_u263 mmioFOURCC('u', '2', '6', '3') #define RIFFINFO_MJPG mmioFOURCC('M', 'J', 'P', 'G') /* Motion JPEG */ #define RIFFINFO_mjpg mmioFOURCC('m', 'j', 'p', 'g') #define RIFFINFO_HFYU mmioFOURCC('H', 'F', 'Y', 'U') #define RIFFINFO_CVID mmioFOURCC('C', 'V', 'I', 'D') /* Cinepak (Radius) */ #define RIFFINFO_cvid mmioFOURCC('c', 'v', 'i', 'd') /* Cinepak (Radius) */ /* Sony Digital Video */ #define RIFFINFO_DVSD mmioFOURCC('D', 'V', 'S', 'D') /* standard DV format */ #define RIFFINFO_dvsd mmioFOURCC('d', 'v', 's', 'd') /* High Definition DV */ #define RIFFINFO_dvhd mmioFOURCC('d', 'v', 'h', 'd') /* Long Play DV */ #define RIFFINFO_dvsl mmioFOURCC('d', 'v', 's', 'l') /* * Note: DVSD is incorrect FOURCC - will not be accepted by codec - but * some files contains this fcc - avifile fallbacks to use dvsd */ /* Ati codecs */ #define RIFFINFO_VCR2 mmioFOURCC('V', 'C', 'R', '2') #define RIFFINFO_VCR1 mmioFOURCC('V', 'C', 'R', '1') #define RIFFINFO_VYUY mmioFOURCC('V', 'Y', 'U', 'Y') #define RIFFINFO_YVU9 mmioFOURCC('I', 'Y', 'U', '9') /* Asus codecs */ #define RIFFINFO_ASV1 mmioFOURCC('A', 'S', 'V', '1') #define RIFFINFO_ASV2 mmioFOURCC('A', 'S', 'V', '2') /* let's give some FCC to Xvid */ #define RIFFINFO_XVID mmioFOURCC('X', 'V', 'I', 'D') #define RIFFINFO_xvid mmioFOURCC('x', 'v', 'i', 'd') #define RIFFINFO_XviD mmioFOURCC('X', 'v', 'i', 'D') /* Microsoft video */ #define RIFFINFO_CRAM mmioFOURCC('C', 'R', 'A', 'M') #define RIFFINFO_cram mmioFOURCC('c', 'r', 'a', 'm') #define RIFFINFO_MSVC mmioFOURCC('M', 'S', 'V', 'C') #define RIFFINFO_MSZH mmioFOURCC('M', 'S', 'Z', 'H') #define RIFFINFO_ZLIB mmioFOURCC('Z', 'L', 'I', 'B') #define RIFFINFO_TM20 mmioFOURCC('T', 'M', '2', '0') #define RIFFINFO_M261 mmioFOURCC('M', '2', '6', '1') #define RIFFINFO_m261 mmioFOURCC('m', '2', '6', '1') #define RIFFINFO_TSCC mmioFOURCC('T', 'S', 'C', 'C') #define RIFFINFO_tscc mmioFOURCC('t', 's', 'c', 'c') #define RIFFINFO_PIM1 mmioFOURCC('P', 'I', 'M', '1') #define RIFFINFO_YUV mmioFOURCC('Y', 'U', 'V', ' ') /* YUNV V422 */ #define RIFFINFO_YUY2 mmioFOURCC('Y', 'U', 'Y', '2') #define RIFFINFO_YV12 mmioFOURCC('Y', 'V', '1', '2') /* Planar mode: Y + V + U (3 planes) */ /* just swaped V U planes */ #define RIFFINFO_I420 mmioFOURCC('I', '4', '2', '0') /* Planar mode: Y + U + V (3 planes) */ /* same as I420 */ #define RIFFINFO_IYUV mmioFOURCC('I', 'Y', 'U', 'V') /* Planar mode: Y + U + V (3 planes) */ #define RIFFINFO_UYVY mmioFOURCC('U', 'Y', 'V', 'Y') /* Packed mode: U0+Y0+V0+Y1 (1 plane) */ #define RIFFINFO_YVYU mmioFOURCC('Y', 'V', 'Y', 'U') /* Packed mode: Y0+V0+Y1+U0 (1 plane) */ #define RIFFINFO_Y800 mmioFOURCC('Y', '8', '0', '0') /* 8bit Y plane for monochrome images */ /* INFO LIST CHUNKS (from the Multimedia Programmer's Reference plus new ones) */ #define RIFFINFO_IARL mmioFOURCC ('I', 'A', 'R', 'L') /* Archival location */ #define RIFFINFO_IART mmioFOURCC ('I', 'A', 'R', 'T') /* Artist */ #define RIFFINFO_ICMS mmioFOURCC ('I', 'C', 'M', 'S') /* Commissioned */ #define RIFFINFO_ICMT mmioFOURCC ('I', 'C', 'M', 'T') /* Comments */ #define RIFFINFO_ICOP mmioFOURCC ('I', 'C', 'O', 'P') /* Copyright */ #define RIFFINFO_ICRD mmioFOURCC ('I', 'C', 'R', 'D') /* Creation date of subject */ #define RIFFINFO_ICRP mmioFOURCC ('I', 'C', 'R', 'P') /* Cropped */ #define RIFFINFO_IDIM mmioFOURCC ('I', 'D', 'I', 'M') /* Dimensions */ #define RIFFINFO_IDPI mmioFOURCC ('I', 'D', 'P', 'I') /* Dots per inch */ #define RIFFINFO_IENG mmioFOURCC ('I', 'E', 'N', 'G') /* Engineer */ #define RIFFINFO_IGNR mmioFOURCC ('I', 'G', 'N', 'R') /* Genre */ #define RIFFINFO_IKEY mmioFOURCC ('I', 'K', 'E', 'Y') /* Keywords */ #define RIFFINFO_ILGT mmioFOURCC ('I', 'L', 'G', 'T') /* Lightness settings */ #define RIFFINFO_IMED mmioFOURCC ('I', 'M', 'E', 'D') /* Medium */ #define RIFFINFO_INAM mmioFOURCC ('I', 'N', 'A', 'M') /* Name of subject */ #define RIFFINFO_IPLT mmioFOURCC ('I', 'P', 'L', 'T') /* Palette Settings. No. of colors requested */ #define RIFFINFO_IPRD mmioFOURCC ('I', 'P', 'R', 'D') /* Product */ #define RIFFINFO_ISBJ mmioFOURCC ('I', 'S', 'B', 'J') /* Subject description */ #define RIFFINFO_ISFT mmioFOURCC ('I', 'S', 'F', 'T') /* Software. Name of package used to create file */ #define RIFFINFO_ISHP mmioFOURCC ('I', 'S', 'H', 'P') /* Sharpness */ #define RIFFINFO_ISRC mmioFOURCC ('I', 'S', 'R', 'C') /* Source */ #define RIFFINFO_ISRF mmioFOURCC ('I', 'S', 'R', 'F') /* Source Form. ie slide, paper */ #define RIFFINFO_ITCH mmioFOURCC ('I', 'T', 'C', 'H') /* Technician who digitized the subject. */ /* New INFO Chunks as of August 30, 1993: */ #define RIFFINFO_ISMP mmioFOURCC ('I', 'S', 'M', 'P') /* SMPTE time code */ /* ISMP: SMPTE time code of digitization start point expressed as a NULL terminated text string "HH:MM:SS:FF". If performing MCI capture in AVICAP, this chunk will be automatically set based on the MCI start time. */ #define RIFFINFO_IDIT mmioFOURCC ('I', 'D', 'I', 'T') /* Digitization Time */ /* IDIT: "Digitization Time" Specifies the time and date that the digitization commenced. The digitization time is contained in an ASCII string which contains exactly 26 characters and is in the format "Wed Jan 02 02:03:55 1990\n\0". The ctime(), asctime(), functions can be used to create strings in this format. This chunk is automatically added to the capture file based on the current system time at the moment capture is initiated. */ /*Template line for new additions*/ /*#define RIFFINFO_I mmioFOURCC ('I', '', '', '') */ #define RIFFINFO_MPG1 mmioFOURCC ('M', 'P', 'G', '1') #define RIFFINFO_MPG2 mmioFOURCC ('M', 'P', 'G', '2') /* backward compatibile defines - RIFFINFO should be now prefered name */ #define fccMP4S RIFFINFO_MP4S #define fccmp4s RIFFINFO_mp4s #define fccDIVX RIFFINFO_DIVX #define fccdivx RIFFINFO_divx #define fccDX50 RIFFINFO_DX50 #define fccdx50 RIFFINFO_dx50 #define fccDIV1 RIFFINFO_DIV1 #define fccdiv1 RIFFINFO_div1 #define fccDIV2 RIFFINFO_DIV2 #define fccdiv2 RIFFINFO_div2 #define fccDIV3 RIFFINFO_DIV3 #define fccdiv3 RIFFINFO_div3 #define fccDIV4 RIFFINFO_DIV4 #define fccdiv4 RIFFINFO_div4 #define fccDIV5 RIFFINFO_DIV5 #define fccdiv5 RIFFINFO_div5 #define fccDIV6 RIFFINFO_DIV6 #define fccdiv6 RIFFINFO_div6 #define fccMP41 RIFFINFO_MP41 #define fccmp41 RIFFINFO_mp41 #define fccMP43 RIFFINFO_MP43 #define fccmp43 RIFFINFO_mp43 #define fccMP42 RIFFINFO_MP42 #define fccmp42 RIFFINFO_mp42 #define fccMPG4 RIFFINFO_MPG4 #define fccmpg4 RIFFINFO_mpg4 #define fccWMV1 RIFFINFO_WMV1 #define fccwmv1 RIFFINFO_wmv1 #define fccWMV2 RIFFINFO_WMV2 #define fccwmv2 RIFFINFO_wmv2 #define fccMWV1 RIFFINFO_MWV1 #define fccAP41 RIFFINFO_AP41 #define fccap41 RIFFINFO_ap41 #define fccAP42 RIFFINFO_AP42 #define fccap42 RIFFINFO_ap42 #define fccIV31 RIFFINFO_IV31 #define fcciv31 RIFFINFO_iv31 #define fccIV32 RIFFINFO_IV32 #define fcciv32 RIFFINFO_iv32 #define fccIV41 RIFFINFO_IV41 #define fcciv41 RIFFINFO_iv41 #define fccIV50 RIFFINFO_IV50 #define fcciv50 RIFFINFO_iv50 #define fccH263 RIFFINFO_H263 #define fcch263 RIFFINFO_h263 #define fccI263 RIFFINFO_I263 #define fcci263 RIFFINFO_i263 #define fccU263 RIFFINFO_U263 #define fccu263 RIFFINFO_u263 #define fccMJPG RIFFINFO_MJPG #define fccmjpg RIFFINFO_mjpg #define fccHFYU RIFFINFO_HFYU #define fccXVID RIFFINFO_XVID #define fccCVID RIFFINFO_CVID #define fcccvid RIFFINFO_cvid #define fccdvsd RIFFINFO_dvsd #define fccdvsl RIFFINFO_dvsl #define fccdvhd RIFFINFO_dvhd #define fccDVSD RIFFINFO_DVSD #define fccVCR2 RIFFINFO_VCR2 #define fccVCR1 RIFFINFO_VCR1 #define fccVYUY RIFFINFO_VYUY #define fccYVU9 RIFFINFO_YVU9 #define fccASV1 RIFFINFO_ASV1 #define fccASV2 RIFFINFO_ASV2 #define fcccram RIFFINFO_cram #define fccCRAM RIFFINFO_CRAM #define fccMSVC RIFFINFO_MSVC #define fccMSZH RIFFINFO_MSZH #define fccZLIB RIFFINFO_ZLIB #define fccTM20 RIFFINFO_TM20 #define fccVP31 RIFFINFO_VP31 #define fccvp31 RIFFINFO_vp31 #define fccVP30 RIFFINFO_VP30 #define fccvp30 RIFFINFO_vp30 #define fccM261 RIFFINFO_M261 #define fccm261 RIFFINFO_m261 #define fccTSCC RIFFINFO_TSCC #define fcctscc RIFFINFO_tscc #define fccPIM1 RIFFINFO_PIM1 #define fccYUV RIFFINFO_YUV #define fccYUY2 RIFFINFO_YUY2 #define fccYV12 RIFFINFO_YV12 #define fccI420 RIFFINFO_I420 #define fccIYUV RIFFINFO_IYUV #define fccUYVY RIFFINFO_UYVY #define fccYVYU RIFFINFO_YVYU #define fccY800 RIFFINFO_Y800 /* interleaved - iavs */ #endif // AVM_FOURCC_H avifile-0.7.48~20090503.ds/include/avm_locker.h0000644000175000017500000000450411007565047017667 0ustar yavoryavor#ifndef AVM_LOCKER_H #define AVM_LOCKER_H #include "avm_default.h" AVM_BEGIN_NAMESPACE; // do not include pthread.h nor semaphore.h here // hidden in the implementation class PthreadMutex; /** * */ class AVMEXPORT PthreadCond { void* m_pCond; /// \internal disabled PthreadCond(const PthreadCond&) : m_pCond(0) {} /// \internal disabled PthreadCond& operator=(const PthreadCond&) { return *this; } public: PthreadCond(); ~PthreadCond(); int Wait(PthreadMutex& m, float waitTime = -1.f); int Broadcast(); }; /** * class used to hide usage of thread * * it might be implemented diferently for various platforms */ class AVMEXPORT PthreadMutex { void* m_pMutex; friend int PthreadCond::Wait(PthreadMutex&, float); /// \internal disabled PthreadMutex(const PthreadMutex&) : m_pMutex(0) {} /// \internal disabled PthreadMutex& operator=(const PthreadMutex&) { return *this; } public: // most probably unportable // enum Attr { FAST, RECURSIVE }; PthreadMutex( /* Attr = FAST */ ); ~PthreadMutex(); /// Lock mutex int Lock(); /// TryLock mutex int TryLock(); /// Unlock mutex int Unlock(); }; /** * Creates a new thread of control that executes concurrently with * the calling thread. */ class AVMEXPORT PthreadTask { void* m_pTask; /// \internal disabled PthreadTask(const PthreadTask&) : m_pTask(0) {} /// \internal disabled PthreadTask& operator=(const PthreadTask&) { return *this; } public: PthreadTask(void* attr, void* (*start_routine)(void *), void* arg); ~PthreadTask(); }; /** * Simple mutex locker for simplifying Lock/Unlock usage * * thus there is no need to worry about unlocking on the exit path * the beauty of C++ :) * * constructor locks passed mutex * destructor unlocks passd mutex */ class AVMEXPORT Locker { PthreadMutex& m_Mutex; /// \internal disabled Locker(const Locker&) : m_Mutex(*(new PthreadMutex())) {} /// \internal disabled Locker& operator=(const Locker&) { return *this; } public: Locker(PthreadMutex& mutex) : m_Mutex(mutex) { m_Mutex.Lock(); } ~Locker() { m_Mutex.Unlock(); } }; AVM_END_NAMESPACE; #ifdef AVM_COMPATIBLE typedef avm::Locker Locker; typedef avm::PthreadCond PthreadCond; typedef avm::PthreadMutex PthreadMutex; #endif #endif // AVM_LOCKER_H avifile-0.7.48~20090503.ds/include/avm_map.h0000644000175000017500000002235311171070560017160 0ustar yavoryavor#ifndef AVIFILE_AVM_MAP_H #define AVIFILE_AVM_MAP_H #ifndef AVM_BEGIN_NAMESPACE #define AVM_BEGIN_NAMESPACE namespace avm { #define AVM_END_NAMESPACE } #endif #include /********** * WARNING - this file is meant to be used by internal avifile application * DO NOT USE in your own project! * the API here could change in any minute */ AVM_BEGIN_NAMESPACE; template class less { public: bool operator()(const Key& k1, const Key& k2) const { return k1 class equal { public: bool operator()(const Key& k1, const Key& k2) const { return k1==k2; } }; // do not use this container in time critical context // search time is between log(N) and N, depending on order of element insertion template , class equal = equal > class avm_map { protected: template struct pair { KeyP key; ValueP value; pair() : key(Key()), value(Value()) {} pair(KeyP k, ValueP v) : key(k), value(v) {} pair(const pair& p) : key(p.key), value(p.value) {} }; typedef pair _Tpair; template struct binary_tree_node { _Tpair* entry; binary_tree_node* left; Key1 minval; binary_tree_node* right; binary_tree_node* parent; Key1 maxval; binary_tree_node(binary_tree_node* ptr=0) : entry(0), left(0), right(0), parent(ptr), weight(1) {} int weight; void destroy() { if(left) { left->destroy(); delete left; } if(right) { right->destroy(); delete right; } delete entry; } }; typedef binary_tree_node _Tnode; _Tnode* m_pTree; Value* m_pDefaultValue; Compare m_sC; equal m_sE; // this funny trick makes old compiler work with this pointer static void update_min_max_weights(void* node); _Tnode* find_private(const Key& key) const; public: #if 1 class const_iterator { _Tnode* p; public: const_iterator(_Tnode* p1=0) : p(p1) {} const_iterator(const const_iterator& c) : p(c.p) {} bool operator==(const const_iterator& c) const { return p==c.p; } operator const _Tpair*() const { return p ? p->entry : 0 ; } _Tpair* operator->() { return p ? p->entry : 0 ; } const_iterator operator++(int) { if(p==0) return *this; _Tnode* p1 = p; while(p1) { if(p1->parent && (p1==p1->parent->left) && p1->parent->right) { p1=p1->parent->right; break; } if(!p1->parent) { p=0; return *this; } p1=p1->parent; } while(p1->left || p1->right) if(p1->left) p1=p1->left; else p1=p1->right; p=p1; return *this; } }; #endif avm_map(); ~avm_map() { m_pTree->destroy(); delete m_pTree; } #if 1 const_iterator begin() { _Tnode* p1=m_pTree; while(p1->left || p1->right) if(p1->left) p1=p1->left; else p1=p1->right; return const_iterator(p1); } const_iterator end() { return 0; } #endif // inserts a new entry into the map Value* insert(const Key& key, Value value); // searches for the entry that corresponds to the key. If the search fails, returns 0. Value* find(const Key& key) const { _Tnode* tree_node=find_private(key); if(!tree_node) return 0; else { assert(tree_node->entry); return &(tree_node->entry->value); } } // searches for the entry that corresponds to the key. If the search fails, inserts a new entry into the map // and returns it ( default STL map behavior ). Value* find_insert(const Key& key) { _Tnode* tree_node=find_private(key); if(!tree_node) return insert(key, *m_pDefaultValue); else { assert(tree_node->entry); return &(tree_node->entry->value); } } // searches for the entry that corresponds to the key. If the search fails, returns pointer to the default entry // ( entry that corresponds to Key=0 ). Value* find_default(const Key& key = Key()) const { if(m_sE(key, Key())) return m_pDefaultValue; _Tnode* tree_node=find_private(key); if(!tree_node) return m_pDefaultValue; else { assert(tree_node->entry); return &(tree_node->entry->value); } } // erases entry that corresponds to the key if such entry is present. Returns true on success. bool erase(const Key& key); }; template avm_map::avm_map() { m_pTree=new _Tnode; m_pTree->entry = new pair; m_pDefaultValue=&(m_pTree->entry->value); } template void avm_map::update_min_max_weights(void* n) { // cast to the needed type - used to prevent internal compiler error // for old egcc //avm_map::_Tnode* node = (avm_map::_Tnode*) n; _Tnode* node = (_Tnode*) n; if(node->entry) { node->weight=1; node->minval=node->maxval=node->entry->key; node=node->parent; } else { if(node->left && node->left->entry) { node->left->weight=0; node->left->minval=node->left->maxval=node->left->entry->key; } if(node->right && node->right->entry) { node->right->weight=0; node->right->minval=node->right->maxval=node->right->entry->key; } } while(node) { node->weight=0; if(node->left) { node->minval=node->left->minval; node->weight+=node->left->weight; } else node->minval=node->right->minval; if(node->right) { node->maxval=node->right->maxval; node->weight+=node->right->weight; } else node->maxval=node->left->maxval; node=node->parent; // while(1) // { // int diff=0; // if(node->left) // diff+=node->left->weight; // if(nod->right) // diff-=m_pTree->right->weight; // if((diff>-2) && (diff<2)) // break; // } } } template Value* avm_map::insert(const Key& key, Value value) { _Tnode* ptr=m_pTree; while(1) { if(ptr->entry) { if(m_sE(ptr->entry->key, key)) { ptr->entry->value=value; return &(ptr->entry->value); } ptr->left=new _Tnode(ptr); ptr->right=new _Tnode(ptr); if(m_sC(ptr->entry->key, key)) { ptr->left->entry=ptr->entry; ptr->right->entry=new pair(key, value); ptr->entry=0; update_min_max_weights(ptr); return &(ptr->right->entry->value); } else { ptr->left->entry=new pair(key, value); ptr->right->entry=ptr->entry; ptr->entry=0; update_min_max_weights(ptr); return &(ptr->left->entry->value); } } if(ptr->left && ((m_sC(key, ptr->left->maxval)) || m_sE(key, ptr->left->maxval))) { ptr=ptr->left; continue; } if(ptr->right && ((m_sC(ptr->right->minval, key)) || m_sE(ptr->right->minval, key))) { ptr=ptr->right; continue; } if(ptr->left && ptr->right) { if(ptr->left->weightright->weight) ptr=ptr->left; else ptr=ptr->right; continue; } if(!ptr->left) { ptr->left=new _Tnode(ptr); ptr->left->entry=new pair(key, value); update_min_max_weights(ptr); return &(ptr->left->entry->value); } if(!ptr->right) { ptr->right=new _Tnode(ptr); ptr->right->entry=new pair(key, value); update_min_max_weights(ptr); return &(ptr->right->entry->value); } //printf("Should not arrive here\n"); } } template typename avm_map::_Tnode* avm_map::find_private(const Key& key) const { _Tnode* ptr=m_pTree; while(1) { if(ptr->entry) { if (m_sE(ptr->entry->key, key)) return ptr; return 0; } if(ptr->left && ((m_sC(key, ptr->left->maxval)) || m_sE(key, ptr->left->maxval))) { ptr=ptr->left; continue; } if(ptr->right && ((m_sC(ptr->right->minval, key)) || m_sE(ptr->right->minval, key))) { ptr=ptr->right; continue; } if(ptr->left && ptr->right) { if(ptr->left->weightright->weight) ptr=ptr->left; else ptr=ptr->right; continue; } return 0; } } template bool avm_map::erase(const Key& key) { if(m_sE(key, Key())) return false; // you may not erase the default entry _Tnode* ptr=find_private(key); if(!ptr) return false; _Tnode* parent=ptr->parent; assert(parent); // since we have more than one tree node, this can't be root entry delete ptr->entry; if(parent->left==ptr) parent->left=0; else parent->right=0; delete ptr; while(!parent->left && !parent->right) { if(parent->parent->left==parent) parent->parent->left=0; else parent->parent->right=0; ptr=parent; parent=parent->parent; delete ptr; } if(parent->left && parent->left->entry && !parent->right) { parent->entry=parent->left->entry; delete parent->left; parent->left=0; } if(parent->right && parent->right->entry && !parent->left) { parent->entry=parent->right->entry; delete parent->right; parent->right=0; } update_min_max_weights(parent); return true; } AVM_END_NAMESPACE; #endif avifile-0.7.48~20090503.ds/include/avm_output.h0000644000175000017500000000641411172166540017750 0ustar yavoryavor#ifndef AVIFILE_AVM_OUTPUT_H #define AVIFILE_AVM_OUTPUT_H #include "avm_default.h" /** Logging levels */ enum AvmLevel { AVML_STRERROR = 128, // when or-red to level number bellow it shows (%s) strerror output AVML_LASTFLAG = 8, AVML_ERROR = 1 << AVML_LASTFLAG, // serious error (leads to application problem) AVML_ERRORNO = AVML_ERROR | AVML_STRERROR, AVML_WARN = 2 << AVML_LASTFLAG, // warning AVML_WARNNO = AVML_WARN | AVML_STRERROR, AVML_HINT = 3 << AVML_LASTFLAG, // useful hint for user AVML_INFO = 4 << AVML_LASTFLAG, // useful trace for running program AVML_DEBUG = 5 << AVML_LASTFLAG, // debug trace AVML_DETAIL = 6 << AVML_LASTFLAG // detailed debug trace }; #ifdef __cplusplus #include /********** * WARNING - this file is meant to be used by internal avifile application * DO NOT USE in your own project! * the API here could change in any minute */ AVM_BEGIN_NAMESPACE; //typedef void (*handlerFuncPtr) (const char* s, int opt); class AVMEXPORT AvmOutput { public: static void createAvmOutput(); static int getLevel() { return m_iLevel; } static AvmOutput* singleton(); ~AvmOutput(); void write(const char* mode, const char* format, ...) _avm_printf_attr(3, 4); // debuglevel 0 void write(const char* mode, int debuglevel, const char* format, ...) _avm_printf_attr(4, 5); // any debuglevel void vwrite(const char* mode, const char* format, va_list va) _avm_printf_attr(3, 0); void vwrite(const char* mode, int debuglevel, const char* format, va_list va) _avm_printf_attr(4, 0); void setDebugLevel(const char* mode, int level); void resetDebugLevels(int level = 0); private: AvmOutput(); //!< Only to be called by createAvmOutput AvmOutput(const AvmOutput&); //!< Forbid copy constructor AvmOutput& operator=(const AvmOutput&); //!< Forbid assignment void vwrite(const char* format, va_list va) _avm_printf_attr(2, 0); void flush(); struct AvmOutputPrivate; struct AvmOutputPrivate* priv; static AvmOutput* m_pSelf; static int m_iLevel; }; static AvmOutput* AvmOutput() { return AvmOutput::singleton(); } class AVMEXPORT AvmOutputLog { const char* m_sOutputMode; public: AvmOutputLog(const char* outputMode) : m_sOutputMode(outputMode) {} ~AvmOutputLog() {} void setOutputMode(const char* s) { m_sOutputMode = s; } const char* getOutputMode() const { return m_sOutputMode; } }; AVM_END_NAMESPACE; #ifdef __GNUC__ #define AVMOUT(lev, args...) \ do { if (lev < avm::AvmOutput::getLevel()) { avm::AvmOutput()->write(getOutputMode(), (int)lev, ## args); } } while (0) #else #define AVMOUT(lev, ...) \ do { if (lev < avm::AvmOutput::getLevel()) { avm::AvmOutput()->write(getOutputMode(), (int)lev, __VA_ARGS__); } } while (0) #endif #define AVM_WRITE avm::AvmOutput()->write #endif // __cplusplus AVM_BEGIN_EXTERN_C; /** C interface **/ AVMEXPORT void avm_printf(const char* mode, const char* format, ...) _avm_printf_attr(2, 3); AVMEXPORT void avm_dprintf(const char* mode, int debuglevel, const char* format, ...) _avm_printf_attr(3, 4); //#define avml(level, section, fmt, args...) do { if (avm_output_level >= level) avm_printf(section, fmt, ## args); } while (0) AVM_END_EXTERN_C; #endif // AVIFILE_AVM_OUTPUT_H avifile-0.7.48~20090503.ds/include/avm_stl.h0000644000175000017500000002272311172574576017227 0ustar yavoryavor#ifndef AVIFILE_AVM_STL_H #define AVIFILE_AVM_STL_H // some basic types for our C++ usage // we are replacing overbloated STL //#include #include "avm_default.h" #include AVM_BEGIN_NAMESPACE; /** * Simple class for storing SmartPointers */ template class aptr { public: explicit aptr(T* p) : pointer(p) {} //avm_ptr& operator=(const avm_ptr& other); ~aptr() { if (ARRAY) delete [] pointer ; else delete pointer; } T& operator*() const { return *pointer; } T* operator->() const { return pointer; } private: T* pointer; }; /** * Simple class for storing char* * * * The main reason for existance of this class is faster compilation. * We do not need overcomplicated std::string class for our purpose. * The behaviour of implemented methods should mostly match them 1:1 */ class AVMEXPORT string { public: typedef size_t size_type; static const size_type npos = ~0U; string(); string(char s); string(const char* s, size_type len = 0); string(const string& s, size_type len = 0); ~string(); size_type size() const { size_type i = 0; while (str[i]) i++; return i; } char operator[](size_type i) const { return str[i]; } char& operator[](size_type i) { return str[i]; } bool operator==(const char* s) const; bool operator==(const string& s) const { return operator==(s.str); } bool operator!=(const char* s) const { return !operator==(s); } bool operator!=(const string& s) const { return !operator==(s); } bool operator<(const string& s) const; const char* c_str() const { return str; } string& operator=(const char* s); string& operator=(const string& s) { return operator=(s.str); } string& operator+=(const char* s); string& operator+=(const string& s) { return operator+=(s.str); } string operator+(const char* s) const { return string(str) += s; } string operator+(const string& s) const { return string(str) += s; } string substr(size_type from = 0, size_type to = npos) const { return string(str + from, to); }; size_type find(const string& s, size_type startpos = 0) const; size_type find(char c) const; size_type rfind(char c) const; void insert(size_type pos, const string& s); string& erase(size_type from = 0, size_type to = npos); int sprintf(const char* fmt, ...) _avm_printf_attr(2, 3); // allocates size // it will use just 1024 bytes for non _GNU_SOURCE compilation!! string& tolower(); string& toupper(); private: char* str; }; /* * without this operator attempt to compare const char* with string will give quite unexpected * results because of implicit usage of operator const char*() with the right operand */ inline bool operator==(const char* s1, const string& s2) { return s2 == s1; } /** * Simple queue ring template class * * usable for ring buffer with given size */ template class AVMEXPORT qring { public: typedef const Type* const_iterator; typedef Type* iterator; typedef const Type& const_reference; typedef Type& reference; typedef size_t size_type; qring(size_type rcapacity) : m_capacity(rcapacity), m_pos(0), m_size(0) { m_type = new Type[m_capacity]; } ~qring(); qring(const qring& t) : m_type(0) { operator=(t); } qring& operator=(const qring& t) { if (this != &t) { Type* tmp = new Type[t.m_capacity]; m_capacity = t.m_capacity; m_pos = t.m_pos; m_size = t.m_size; for (uint_t i = 0; i < m_size; i++) { size_type p = fpos() + i; if (p >= m_capacity) p -= m_capacity; tmp[p] = t.m_type[p]; } delete[] m_type; m_type = tmp; } return *this; } void clear() { m_pos = m_size = 0; } const_reference back() const { return m_type[bpos()]; } reference back() { return m_type[bpos()]; } const_reference front() const { return m_type[fpos()]; } reference front() { return m_type[fpos()]; } bool empty() const { return (m_size == 0); } bool full() const { return (m_size + 1) >= m_capacity; } void insert(size_type where, const Type& m) { assert(m_size < m_capacity && where <= m_size); m_pos++; if (m_pos >= m_capacity) m_pos -= m_capacity; m_size++; size_type f = m_pos; size_type e = fpos() + where; if (e >= m_capacity) e -= m_capacity; do { size_type prev = f; if (f == 0) f = m_capacity; m_type[prev] = m_type[--f]; } while (e != f); m_type[e] = m; } size_type size() const { return m_size; } void pop() { m_size--; } void pop_front() { pop(); } // alias for vector compatibility void push(const Type& m) { assert(m_size < m_capacity); m_type[m_pos++] = m; m_size++; if (m_pos >= m_capacity) m_pos -= m_capacity; } void push_back(const Type& m) { push(m); } // alias for vector compatibility size_type capacity() const { return m_capacity; } const_reference operator[](size_type i) const { return m_type[i]; } reference operator[](size_type i) { i += fpos(); return m_type[i >= m_capacity ? i - m_capacity : i]; } protected: Type* m_type; size_type m_capacity; size_type m_pos; size_type m_size; // disabled for now qring() {} size_type bpos() const { return (m_pos > 0) ? m_pos - 1 : m_capacity - 1; } size_type fpos() const { return (m_size > m_pos) ? m_pos + m_capacity - m_size: m_pos - m_size; } }; template qring::~qring() { delete[] m_type; } /** * Simple vector class * * Implemented methods behaves like std::vector */ template class AVMEXPORT vector { public: typedef const Type* const_iterator; typedef Type* iterator; typedef const Type& const_reference; typedef Type& reference; typedef size_t size_type; static const size_type invalid = ~0U; vector() :m_type(0), m_capacity(0), m_size(0) { } vector(size_type prealloc) :m_type(0), m_capacity(prealloc), m_size(prealloc) { if (m_capacity > 0) m_type = new Type[m_capacity]; } // we will not count references - we have to program with this in mind! vector(const vector& t) :m_type(0) { operator=(t); } vector& operator=(const vector& t) { //printf("operator= %p %d %d\n", t.m_type, t.m_size, t.m_capacity); if (this != &t) copy(t.m_type, t.m_size, t.m_capacity); return *this; } ~vector(); const_reference operator[](size_type i) const { return m_type[i]; } reference operator[](size_type i) { return m_type[i]; } const_iterator begin() const { return m_type; } iterator begin() { return m_type; } const_reference front() const { return *begin(); } reference front() { return *begin(); } const_iterator end() const { return m_type + m_size; } iterator end() { return m_type + m_size; } const_reference back() const { return *(end() - 1); } reference back() { return *(end() - 1); } size_type capacity() const { return m_capacity; } void clear(); void erase(iterator pos); size_type find(const Type& t) const { for (size_type i = 0; i < m_size; ++i) if (t == m_type[i]) return i; return invalid; } void pop_back() { //printf("vector pop_back %d\n", m_size); assert(m_size > 0); m_size--; if ((m_capacity >= 8) && (m_size < m_capacity / 4)) copy(m_type, m_size, m_capacity / 2); } void pop_front() { assert(m_size > 0); for (size_type i = 1; i < m_size; i++) m_type[i - 1] = m_type[i]; pop_back(); } void push_back(const_reference m) { if (m_size + 1 >= m_capacity) copy(m_type, m_size, m_capacity * 2); m_type[m_size++] = m; } void remove(const_reference t); void reserve(size_type sz) { if (sz > m_capacity) copy(m_type, m_size, sz); } void resize(size_type sz) { copy(m_type, (sz < m_size) ? sz : m_size, sz); m_size = sz; } size_type size() const { return m_size; } protected: Type* m_type; size_type m_capacity; size_type m_size; void copy(const_iterator in, size_type size, size_type alloc); }; #define vector_const_iterate(type, var, i) for (avm::vector::const_iterator i = var.begin(); i != var.end(); ++i) #define vector_iterate(type, var, i) for (avm::vector::iterator i = var.begin(); i != var.end(); ++i) template vector::~vector() { delete[] m_type; } template void vector::clear() { delete[] m_type; m_type = 0; m_capacity = 0; m_size = 0; } template void vector::copy(const Type* in, size_type sz, size_type alloc) { Type* tmp = m_type; m_capacity = (alloc < 4) ? 4 : alloc; //printf("COPY VECT %d %d\n", sz, alloc); assert(sz <= m_capacity); m_type = new Type[m_capacity]; for (size_type i = 0; i < sz; ++i) m_type[i] = in[i]; m_size = sz; delete[] tmp; } template void vector::erase(iterator pos) { assert(m_size > 0); if (m_size > 0) { while ((pos + 1) != end()) { pos[0] = pos[1]; pos++; } pop_back(); } } template void vector::remove(const Type& t) { uint_t d = 0; iterator from = begin(); for (iterator it = from; it != end(); it++) { if (t == *it) { d++; continue; } if (from != it) *from++ = *it; } while (d-- > 0) pop_back(); //printf("REMOVE VECT %d\n", m_size); } AVM_END_NAMESPACE; #endif avifile-0.7.48~20090503.ds/include/config.h.in0000644000175000017500000001135207426445533017425 0ustar yavoryavor/* include/config.h.in. Generated automatically from configure.in by autoheader. */ /* Define to empty if the keyword does not work. */ #undef const /* Define if you don't have vprintf but do have _doprnt. */ #undef HAVE_DOPRNT /* Define if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define if you have the vprintf function. */ #undef HAVE_VPRINTF /* Define as __inline if that's what the C compiler calls it. */ #undef inline /* Define as the return type of signal handlers (int or void). */ #undef RETSIGTYPE /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define if you have the ftime function. */ #undef HAVE_FTIME /* Define if you have the getpagesize function. */ #undef HAVE_GETPAGESIZE /* Define if you have the gettimeofday function. */ #undef HAVE_GETTIMEOFDAY /* Define if you have the nanosleep function. */ #undef HAVE_NANOSLEEP /* Define if you have the scandir function. */ #undef HAVE_SCANDIR /* Define if you have the setenv function. */ #undef HAVE_SETENV /* Define if you have the strdup function. */ #undef HAVE_STRDUP /* Define if you have the strstr function. */ #undef HAVE_STRSTR /* Define if you have the unsetenv function. */ #undef HAVE_UNSETENV /* Define if you have the header file. */ #undef HAVE_FCNTL_H /* Define if you have the header file. */ #undef HAVE_LIMITS_H /* Define if you have the header file. */ #undef HAVE_MALLOC_H /* Define if you have the header file. */ #undef HAVE_STDINT_H /* Define if you have the header file. */ #undef HAVE_SYS_IOCCOM_H /* Define if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define if you have the header file. */ #undef HAVE_SYS_MMAN_H /* Define if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define if you have the header file. */ #undef HAVE_UNISTD_H /* Define if you have the divxdecore library (-ldivxdecore). */ #undef HAVE_LIBDIVXDECORE /* Define if you have the divxencore library (-ldivxencore). */ #undef HAVE_LIBDIVXENCORE /* Define if you have the dl library (-ldl). */ #undef HAVE_LIBDL /* Define if you have the iconv library (-liconv). */ #undef HAVE_LIBICONV /* Define if you have the jpeg library (-ljpeg). */ #undef HAVE_LIBJPEG /* Define if you have the nsl library (-lnsl). */ #undef HAVE_LIBNSL /* Define if you have the ossaudio library (-lossaudio). */ #undef HAVE_LIBOSSAUDIO /* Define if you have the posix4 library (-lposix4). */ #undef HAVE_LIBPOSIX4 /* Define if you have the socket library (-lsocket). */ #undef HAVE_LIBSOCKET /* Define if you have 'kstat' library with 'kstat_open' function (-lkstat). */ #undef HAVE_KSTAT /* Define if you have 'lseek64' function. */ #undef HAVE_LSEEK64 /* Define if you have struct sysinfo in header file. */ #undef HAVE_SYSINFO /* Define if using the dmallocth debugging malloc package */ #undef WITH_DMALLOCTH /* Define if you do NOT want to have X11 support. */ #undef WITHOUT_X /* Define if using 'Qt' libraries. */ #undef USE_QT /* Define if you have 'iconv' library (-liconv) */ #undef I18N /* Define if you have 'iconv_open' function. */ #undef I18N /* Define if you have 'Xxf86dga' library (-lXxf86dga). */ #undef HAVE_LIBXXF86DGA /* Define if you have 'Xxf86vm' library (-lXxf86vm). */ #undef HAVE_LIBXXF86VM /* Define if you have 'Xdpms' library (-lXdpms). */ #undef HAVE_LIBXDPMS /* Define if you have 'Xi' library (-lXi). */ #undef HAVE_LIBXI /* Define if you have 'Xft' library (-lXft) */ #undef HAVE_XFT /* Define if you have 'Xv' library (-lXv). */ #undef HAVE_XV /* Define if you have DPMS support. */ #undef HAVE_DPMS /* Define if you have correct 'X11/extensions/dpms.h' header file. */ #undef HAVE_OK_DPMS_H /* Define if using 'SDL' library (-lsdl). */ #undef USE_SDL /* Define if you want to have OSS audio support compiled. */ #undef OSS_SUPPORT /* Define if you want to have Sun audio support. */ #undef SUNAUDIO_SUPPORT /* Define if you have 'mp3lame' library (-lmp3lame). */ #undef HAVE_LIBMP3LAME /* Define if you want to see detailed out of Win32 loader. */ #undef DETAILED_OUT /* Define if you want to have timing code in library. */ #undef TIMING /* Define if you want to have quiet library. */ #undef QUIET /* Define if you want to use ffmpeg OpenDivX decoder. */ #undef USE_FFMPEG_DIVX /* Define if you want to use ffmpeg Ac3 decoder. */ #undef USE_FFMPEG_AC3 /* Define if you have 'mad' library (-lmad). */ #undef HAVE_LIBMAD /* Define if you have 'ac3' library (-lac3). --unsable-- */ #undef HAVE_AC3 avifile-0.7.48~20090503.ds/include/configff.h0000644000175000017500000004467511174135454017343 0ustar yavoryavor/* * This file is generated by the script: admin/gendefs.sh * Do not modify it by hand! */ #define ENABLE_VHOOK 0 #define CONFIG_AASC_DECODER 1 #define CONFIG_AMV_DECODER 1 #define CONFIG_ASV1_DECODER 1 #define CONFIG_ASV2_DECODER 1 #define CONFIG_AVS_DECODER 1 #define CONFIG_BETHSOFTVID_DECODER 1 #define CONFIG_BFI_DECODER 1 #define CONFIG_BMP_DECODER 1 #define CONFIG_C93_DECODER 1 #define CONFIG_CAVS_DECODER 1 #define CONFIG_CINEPAK_DECODER 1 #define CONFIG_CLJR_DECODER 1 #define CONFIG_CSCD_DECODER 1 #define CONFIG_CYUV_DECODER 1 #define CONFIG_DNXHD_DECODER 1 #define CONFIG_DSICINVIDEO_DECODER 1 #define CONFIG_DVVIDEO_DECODER 1 #define CONFIG_EACMV_DECODER 1 #define CONFIG_EATGQ_DECODER 1 #define CONFIG_EATGV_DECODER 1 #define CONFIG_EATQI_DECODER 1 #define CONFIG_EIGHTBPS_DECODER 1 #define CONFIG_EIGHTSVX_EXP_DECODER 1 #define CONFIG_EIGHTSVX_FIB_DECODER 1 #define CONFIG_ESCAPE124_DECODER 1 #define CONFIG_FFV1_DECODER 1 #define CONFIG_FFVHUFF_DECODER 1 #define CONFIG_FLIC_DECODER 1 #define CONFIG_FLV_DECODER 1 #define CONFIG_FOURXM_DECODER 1 #define CONFIG_FRAPS_DECODER 1 #define CONFIG_GIF_DECODER 1 #define CONFIG_H261_DECODER 1 #define CONFIG_H263_DECODER 1 #define CONFIG_H263I_DECODER 1 #define CONFIG_H264_DECODER 1 #define CONFIG_HUFFYUV_DECODER 1 #define CONFIG_IDCIN_DECODER 1 #define CONFIG_INDEO2_DECODER 1 #define CONFIG_INDEO3_DECODER 1 #define CONFIG_INTERPLAY_VIDEO_DECODER 1 #define CONFIG_JPEGLS_DECODER 1 #define CONFIG_KMVC_DECODER 1 #define CONFIG_LOCO_DECODER 1 #define CONFIG_MDEC_DECODER 1 #define CONFIG_MIMIC_DECODER 1 #define CONFIG_MJPEG_DECODER 1 #define CONFIG_MJPEGB_DECODER 1 #define CONFIG_MMVIDEO_DECODER 1 #define CONFIG_MOTIONPIXELS_DECODER 1 #define CONFIG_MPEG1VIDEO_DECODER 1 #define CONFIG_MPEG2VIDEO_DECODER 1 #define CONFIG_MPEG4_DECODER 1 #define CONFIG_MPEGVIDEO_DECODER 1 #define CONFIG_MSMPEG4V1_DECODER 1 #define CONFIG_MSMPEG4V2_DECODER 1 #define CONFIG_MSMPEG4V3_DECODER 1 #define CONFIG_MSRLE_DECODER 1 #define CONFIG_MSVIDEO1_DECODER 1 #define CONFIG_MSZH_DECODER 1 #define CONFIG_NUV_DECODER 1 #define CONFIG_PAM_DECODER 1 #define CONFIG_PBM_DECODER 1 #define CONFIG_PCX_DECODER 1 #define CONFIG_PGM_DECODER 1 #define CONFIG_PGMYUV_DECODER 1 #define CONFIG_PPM_DECODER 1 #define CONFIG_PTX_DECODER 1 #define CONFIG_QDRAW_DECODER 1 #define CONFIG_QPEG_DECODER 1 #define CONFIG_QTRLE_DECODER 1 #define CONFIG_RAWVIDEO_DECODER 1 #define CONFIG_RL2_DECODER 1 #define CONFIG_ROQ_DECODER 1 #define CONFIG_RPZA_DECODER 1 #define CONFIG_RV10_DECODER 1 #define CONFIG_RV20_DECODER 1 #define CONFIG_RV30_DECODER 1 #define CONFIG_RV40_DECODER 1 #define CONFIG_SGI_DECODER 1 #define CONFIG_SMACKER_DECODER 1 #define CONFIG_SMC_DECODER 1 #define CONFIG_SP5X_DECODER 1 #define CONFIG_SUNRAST_DECODER 1 #define CONFIG_SVQ1_DECODER 1 #define CONFIG_SVQ3_DECODER 1 #define CONFIG_TARGA_DECODER 1 #define CONFIG_THEORA_DECODER 1 #define CONFIG_THP_DECODER 1 #define CONFIG_TIERTEXSEQVIDEO_DECODER 1 #define CONFIG_TIFF_DECODER 1 #define CONFIG_TRUEMOTION1_DECODER 1 #define CONFIG_TRUEMOTION2_DECODER 1 #define CONFIG_TXD_DECODER 1 #define CONFIG_ULTI_DECODER 1 #define CONFIG_V210X_DECODER 1 #define CONFIG_VB_DECODER 1 #define CONFIG_VC1_DECODER 1 #define CONFIG_VCR1_DECODER 1 #define CONFIG_VMDVIDEO_DECODER 1 #define CONFIG_VMNC_DECODER 1 #define CONFIG_VP3_DECODER 1 #define CONFIG_VP5_DECODER 1 #define CONFIG_VP6_DECODER 1 #define CONFIG_VP6A_DECODER 1 #define CONFIG_VP6F_DECODER 1 #define CONFIG_VQA_DECODER 1 #define CONFIG_WMV1_DECODER 1 #define CONFIG_WMV2_DECODER 1 #define CONFIG_WMV3_DECODER 1 #define CONFIG_WNV1_DECODER 1 #define CONFIG_XAN_WC3_DECODER 1 #define CONFIG_XL_DECODER 1 #define CONFIG_ZLIB_DECODER 1 #define CONFIG_AAC_DECODER 1 #define CONFIG_AC3_DECODER 1 #define CONFIG_ALAC_DECODER 1 #define CONFIG_APE_DECODER 1 #define CONFIG_ATRAC3_DECODER 1 #define CONFIG_COOK_DECODER 1 #define CONFIG_DCA_DECODER 1 #define CONFIG_DSICINAUDIO_DECODER 1 #define CONFIG_EAC3_DECODER 1 #define CONFIG_FLAC_DECODER 1 #define CONFIG_IMC_DECODER 1 #define CONFIG_MACE3_DECODER 1 #define CONFIG_MACE6_DECODER 1 #define CONFIG_MLP_DECODER 1 #define CONFIG_MP1_DECODER 1 #define CONFIG_MP2_DECODER 1 #define CONFIG_MP3_DECODER 1 #define CONFIG_MP3ADU_DECODER 1 #define CONFIG_MP3ON4_DECODER 1 #define CONFIG_MPC7_DECODER 1 #define CONFIG_MPC8_DECODER 1 #define CONFIG_NELLYMOSER_DECODER 1 #define CONFIG_QCELP_DECODER 1 #define CONFIG_QDM2_DECODER 1 #define CONFIG_RA_144_DECODER 1 #define CONFIG_RA_288_DECODER 1 #define CONFIG_SHORTEN_DECODER 1 #define CONFIG_SMACKAUD_DECODER 1 #define CONFIG_SONIC_DECODER 1 #define CONFIG_TRUEHD_DECODER 1 #define CONFIG_TRUESPEECH_DECODER 1 #define CONFIG_TTA_DECODER 1 #define CONFIG_VMDAUDIO_DECODER 1 #define CONFIG_VORBIS_DECODER 1 #define CONFIG_WAVPACK_DECODER 1 #define CONFIG_WMAV1_DECODER 1 #define CONFIG_WMAV2_DECODER 1 #define CONFIG_WS_SND1_DECODER 1 #define CONFIG_PCM_ALAW_DECODER 1 #define CONFIG_PCM_DVD_DECODER 1 #define CONFIG_PCM_F32BE_DECODER 1 #define CONFIG_PCM_F32LE_DECODER 1 #define CONFIG_PCM_F64BE_DECODER 1 #define CONFIG_PCM_F64LE_DECODER 1 #define CONFIG_PCM_MULAW_DECODER 1 #define CONFIG_PCM_S8_DECODER 1 #define CONFIG_PCM_S16BE_DECODER 1 #define CONFIG_PCM_S16LE_DECODER 1 #define CONFIG_PCM_S16LE_PLANAR_DECODER 1 #define CONFIG_PCM_S24BE_DECODER 1 #define CONFIG_PCM_S24DAUD_DECODER 1 #define CONFIG_PCM_S24LE_DECODER 1 #define CONFIG_PCM_S32BE_DECODER 1 #define CONFIG_PCM_S32LE_DECODER 1 #define CONFIG_PCM_U8_DECODER 1 #define CONFIG_PCM_U16BE_DECODER 1 #define CONFIG_PCM_U16LE_DECODER 1 #define CONFIG_PCM_U24BE_DECODER 1 #define CONFIG_PCM_U24LE_DECODER 1 #define CONFIG_PCM_U32BE_DECODER 1 #define CONFIG_PCM_U32LE_DECODER 1 #define CONFIG_PCM_ZORK_DECODER 1 #define CONFIG_INTERPLAY_DPCM_DECODER 1 #define CONFIG_ROQ_DPCM_DECODER 1 #define CONFIG_SOL_DPCM_DECODER 1 #define CONFIG_XAN_DPCM_DECODER 1 #define CONFIG_ADPCM_4XM_DECODER 1 #define CONFIG_ADPCM_ADX_DECODER 1 #define CONFIG_ADPCM_CT_DECODER 1 #define CONFIG_ADPCM_EA_DECODER 1 #define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 1 #define CONFIG_ADPCM_EA_R1_DECODER 1 #define CONFIG_ADPCM_EA_R2_DECODER 1 #define CONFIG_ADPCM_EA_R3_DECODER 1 #define CONFIG_ADPCM_EA_XAS_DECODER 1 #define CONFIG_ADPCM_G726_DECODER 1 #define CONFIG_ADPCM_IMA_AMV_DECODER 1 #define CONFIG_ADPCM_IMA_DK3_DECODER 1 #define CONFIG_ADPCM_IMA_DK4_DECODER 1 #define CONFIG_ADPCM_IMA_EA_EACS_DECODER 1 #define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 1 #define CONFIG_ADPCM_IMA_ISS_DECODER 1 #define CONFIG_ADPCM_IMA_QT_DECODER 1 #define CONFIG_ADPCM_IMA_SMJPEG_DECODER 1 #define CONFIG_ADPCM_IMA_WAV_DECODER 1 #define CONFIG_ADPCM_IMA_WS_DECODER 1 #define CONFIG_ADPCM_MS_DECODER 1 #define CONFIG_ADPCM_SBPRO_2_DECODER 1 #define CONFIG_ADPCM_SBPRO_3_DECODER 1 #define CONFIG_ADPCM_SBPRO_4_DECODER 1 #define CONFIG_ADPCM_SWF_DECODER 1 #define CONFIG_ADPCM_THP_DECODER 1 #define CONFIG_ADPCM_XA_DECODER 1 #define CONFIG_ADPCM_YAMAHA_DECODER 1 #define CONFIG_DVBSUB_DECODER 1 #define CONFIG_DVDSUB_DECODER 1 #define CONFIG_XSUB_DECODER 1 #define CONFIG_LIBAMR_NB_DECODER 0 #define CONFIG_LIBAMR_WB_DECODER 0 #define CONFIG_LIBDIRAC_DECODER 0 #define CONFIG_LIBGSM_DECODER 0 #define CONFIG_LIBGSM_MS_DECODER 0 #define CONFIG_LIBSCHROEDINGER_DECODER 0 #define CONFIG_LIBSPEEX_DECODER 0 #define CONFIG_LIBVORBIS_DECODER 0 #define CONFIG_LIBXVID_DECODER 0 #define CONFIG_MPEG_XVMC_DECODER 0 #define CONFIG_OGGVORBIS_DECODER 0 #define CONFIG_SNOW_DECODER 0 #define CONFIG_XVMC_DECODER 0 #define CONFIG_H264_VDPAU_DECODER 0 #define CONFIG_MPEG_VDPAU_DECODER 0 #define CONFIG_MPEG1_VDPAU_DECODER 0 #define CONFIG_VC1_VDPAU_DECODER 0 #define CONFIG_WMV3_VDPAU_DECODER 0 #define CONFIG_AAC_DEMUXER 1 #define CONFIG_AC3_DEMUXER 1 #define CONFIG_AIFF_DEMUXER 1 #define CONFIG_AMR_DEMUXER 1 #define CONFIG_APC_DEMUXER 1 #define CONFIG_APE_DEMUXER 1 #define CONFIG_ASF_DEMUXER 1 #define CONFIG_ASS_DEMUXER 1 #define CONFIG_AU_DEMUXER 1 #define CONFIG_AVI_DEMUXER 1 #define CONFIG_AVS_DEMUXER 1 #define CONFIG_BETHSOFTVID_DEMUXER 1 #define CONFIG_BFI_DEMUXER 1 #define CONFIG_C93_DEMUXER 1 #define CONFIG_CAVSVIDEO_DEMUXER 1 #define CONFIG_DAUD_DEMUXER 1 #define CONFIG_DIRAC_DEMUXER 1 #define CONFIG_DNXHD_DEMUXER 1 #define CONFIG_DSICIN_DEMUXER 1 #define CONFIG_DTS_DEMUXER 1 #define CONFIG_DV_DEMUXER 1 #define CONFIG_DXA_DEMUXER 1 #define CONFIG_EA_DEMUXER 1 #define CONFIG_EA_CDATA_DEMUXER 1 #define CONFIG_EAC3_DEMUXER 1 #define CONFIG_FFM_DEMUXER 1 #define CONFIG_FLAC_DEMUXER 1 #define CONFIG_FLIC_DEMUXER 1 #define CONFIG_FLV_DEMUXER 1 #define CONFIG_FOURXM_DEMUXER 1 #define CONFIG_GSM_DEMUXER 1 #define CONFIG_GXF_DEMUXER 1 #define CONFIG_H261_DEMUXER 1 #define CONFIG_H263_DEMUXER 1 #define CONFIG_H264_DEMUXER 1 #define CONFIG_IDCIN_DEMUXER 1 #define CONFIG_IFF_DEMUXER 1 #define CONFIG_IMAGE2_DEMUXER 1 #define CONFIG_IMAGE2PIPE_DEMUXER 1 #define CONFIG_INGENIENT_DEMUXER 1 #define CONFIG_IPMOVIE_DEMUXER 1 #define CONFIG_ISS_DEMUXER 1 #define CONFIG_LMLM4_DEMUXER 1 #define CONFIG_M4V_DEMUXER 1 #define CONFIG_MATROSKA_DEMUXER 1 #define CONFIG_MJPEG_DEMUXER 1 #define CONFIG_MLP_DEMUXER 1 #define CONFIG_MM_DEMUXER 1 #define CONFIG_MMF_DEMUXER 1 #define CONFIG_MOV_DEMUXER 1 #define CONFIG_MP3_DEMUXER 1 #define CONFIG_MPC_DEMUXER 1 #define CONFIG_MPC8_DEMUXER 1 #define CONFIG_MPEGPS_DEMUXER 1 #define CONFIG_MPEGTS_DEMUXER 1 #define CONFIG_MPEGTSRAW_DEMUXER 1 #define CONFIG_MPEGVIDEO_DEMUXER 1 #define CONFIG_MSNWC_TCP_DEMUXER 1 #define CONFIG_MTV_DEMUXER 1 #define CONFIG_MVI_DEMUXER 1 #define CONFIG_MXF_DEMUXER 1 #define CONFIG_NC_DEMUXER 1 #define CONFIG_NSV_DEMUXER 1 #define CONFIG_NUT_DEMUXER 1 #define CONFIG_NUV_DEMUXER 1 #define CONFIG_OMA_DEMUXER 1 #define CONFIG_PCM_ALAW_DEMUXER 1 #define CONFIG_PCM_MULAW_DEMUXER 1 #define CONFIG_PCM_F64BE_DEMUXER 1 #define CONFIG_PCM_F64LE_DEMUXER 1 #define CONFIG_PCM_F32BE_DEMUXER 1 #define CONFIG_PCM_F32LE_DEMUXER 1 #define CONFIG_PCM_S32BE_DEMUXER 1 #define CONFIG_PCM_S32LE_DEMUXER 1 #define CONFIG_PCM_S24BE_DEMUXER 1 #define CONFIG_PCM_S24LE_DEMUXER 1 #define CONFIG_PCM_S16BE_DEMUXER 1 #define CONFIG_PCM_S16LE_DEMUXER 1 #define CONFIG_PCM_S8_DEMUXER 1 #define CONFIG_PCM_U32BE_DEMUXER 1 #define CONFIG_PCM_U32LE_DEMUXER 1 #define CONFIG_PCM_U24BE_DEMUXER 1 #define CONFIG_PCM_U24LE_DEMUXER 1 #define CONFIG_PCM_U16BE_DEMUXER 1 #define CONFIG_PCM_U16LE_DEMUXER 1 #define CONFIG_PCM_U8_DEMUXER 1 #define CONFIG_PVA_DEMUXER 1 #define CONFIG_R3D_DEMUXER 1 #define CONFIG_RAWVIDEO_DEMUXER 1 #define CONFIG_REDIR_DEMUXER 1 #define CONFIG_RL2_DEMUXER 1 #define CONFIG_RM_DEMUXER 1 #define CONFIG_ROQ_DEMUXER 1 #define CONFIG_RPL_DEMUXER 1 #define CONFIG_RTSP_DEMUXER 1 #define CONFIG_SDP_DEMUXER 1 #define CONFIG_SEGAFILM_DEMUXER 1 #define CONFIG_SHORTEN_DEMUXER 1 #define CONFIG_SIFF_DEMUXER 1 #define CONFIG_SMACKER_DEMUXER 1 #define CONFIG_SOL_DEMUXER 1 #define CONFIG_STR_DEMUXER 1 #define CONFIG_SWF_DEMUXER 1 #define CONFIG_THP_DEMUXER 1 #define CONFIG_TIERTEXSEQ_DEMUXER 1 #define CONFIG_TRUEHD_DEMUXER 1 #define CONFIG_TTA_DEMUXER 1 #define CONFIG_TXD_DEMUXER 1 #define CONFIG_VC1_DEMUXER 1 #define CONFIG_VMD_DEMUXER 1 #define CONFIG_VOC_DEMUXER 1 #define CONFIG_VQF_DEMUXER 1 #define CONFIG_WAV_DEMUXER 1 #define CONFIG_WC3_DEMUXER 1 #define CONFIG_WSAUD_DEMUXER 1 #define CONFIG_WSVQA_DEMUXER 1 #define CONFIG_WV_DEMUXER 1 #define CONFIG_XA_DEMUXER 1 #define CONFIG_YUV4MPEGPIPE_DEMUXER 1 #define CONFIG_LIBNUT_DEMUXER 0 #define CONFIG_OGG_DEMUXER 0 #define CONFIG_AVISYNTH_DEMUXER 0 #define CONFIG_VC1T_DEMUXER 0 #define CONFIG_H263_VAAPI_HWACCEL 0 #define CONFIG_MPEG2_VAAPI_HWACCEL 0 #define CONFIG_MPEG4_VAAPI_HWACCEL 0 #define CONFIG_VC1_VAAPI_HWACCEL 0 #define CONFIG_WMV3_VAAPI_HWACCEL 0 #define CONFIG_AAC_PARSER 1 #define CONFIG_AC3_PARSER 1 #define CONFIG_CAVSVIDEO_PARSER 1 #define CONFIG_DCA_PARSER 1 #define CONFIG_DIRAC_PARSER 1 #define CONFIG_DNXHD_PARSER 1 #define CONFIG_DVBSUB_PARSER 1 #define CONFIG_DVDSUB_PARSER 1 #define CONFIG_H261_PARSER 1 #define CONFIG_H263_PARSER 1 #define CONFIG_H264_PARSER 1 #define CONFIG_MJPEG_PARSER 1 #define CONFIG_MLP_PARSER 1 #define CONFIG_MPEG4VIDEO_PARSER 1 #define CONFIG_MPEGAUDIO_PARSER 1 #define CONFIG_MPEGVIDEO_PARSER 1 #define CONFIG_PNM_PARSER 1 #define CONFIG_VC1_PARSER 1 #define CONFIG_VP3_PARSER 1 #define CONFIG_DUMP_EXTRADATA_BSF 1 #define CONFIG_H264_MP4TOANNEXB_BSF 1 #define CONFIG_IMX_DUMP_HEADER_BSF 1 #define CONFIG_MJPEGA_DUMP_HEADER_BSF 1 #define CONFIG_MP3_HEADER_COMPRESS_BSF 1 #define CONFIG_MP3_HEADER_DECOMPRESS_BSF 1 #define CONFIG_MOV2TEXTSUB_BSF 1 #define CONFIG_NOISE_BSF 1 #define CONFIG_REMOVE_EXTRADATA_BSF 1 #define CONFIG_TEXT2MOVSUB_BSF 1 #define CONFIG_ASV1_ENCODER 1 #define CONFIG_ASV2_ENCODER 1 #define CONFIG_BMP_ENCODER 1 #define CONFIG_DNXHD_ENCODER 1 #define CONFIG_DVVIDEO_ENCODER 1 #define CONFIG_FFV1_ENCODER 1 #define CONFIG_FFVHUFF_ENCODER 1 #define CONFIG_FLV_ENCODER 1 #define CONFIG_GIF_ENCODER 1 #define CONFIG_H261_ENCODER 1 #define CONFIG_H263_ENCODER 1 #define CONFIG_H263P_ENCODER 1 #define CONFIG_HUFFYUV_ENCODER 1 #define CONFIG_JPEGLS_ENCODER 1 #define CONFIG_LJPEG_ENCODER 1 #define CONFIG_MJPEG_ENCODER 1 #define CONFIG_MPEG1VIDEO_ENCODER 1 #define CONFIG_MPEG2VIDEO_ENCODER 1 #define CONFIG_MPEG4_ENCODER 1 #define CONFIG_MSMPEG4V1_ENCODER 1 #define CONFIG_MSMPEG4V2_ENCODER 1 #define CONFIG_MSMPEG4V3_ENCODER 1 #define CONFIG_PAM_ENCODER 1 #define CONFIG_PBM_ENCODER 1 #define CONFIG_PCX_ENCODER 1 #define CONFIG_PGM_ENCODER 1 #define CONFIG_PGMYUV_ENCODER 1 #define CONFIG_PPM_ENCODER 1 #define CONFIG_QTRLE_ENCODER 1 #define CONFIG_RAWVIDEO_ENCODER 1 #define CONFIG_ROQ_ENCODER 1 #define CONFIG_RV10_ENCODER 1 #define CONFIG_RV20_ENCODER 1 #define CONFIG_SGI_ENCODER 1 #define CONFIG_SVQ1_ENCODER 1 #define CONFIG_TARGA_ENCODER 1 #define CONFIG_TIFF_ENCODER 1 #define CONFIG_WMV1_ENCODER 1 #define CONFIG_WMV2_ENCODER 1 #define CONFIG_ZLIB_ENCODER 1 #define CONFIG_AC3_ENCODER 1 #define CONFIG_ALAC_ENCODER 1 #define CONFIG_FLAC_ENCODER 1 #define CONFIG_MP2_ENCODER 1 #define CONFIG_NELLYMOSER_ENCODER 1 #define CONFIG_SONIC_ENCODER 1 #define CONFIG_SONIC_LS_ENCODER 1 #define CONFIG_VORBIS_ENCODER 1 #define CONFIG_WMAV1_ENCODER 1 #define CONFIG_WMAV2_ENCODER 1 #define CONFIG_PCM_ALAW_ENCODER 1 #define CONFIG_PCM_F32BE_ENCODER 1 #define CONFIG_PCM_F32LE_ENCODER 1 #define CONFIG_PCM_F64BE_ENCODER 1 #define CONFIG_PCM_F64LE_ENCODER 1 #define CONFIG_PCM_MULAW_ENCODER 1 #define CONFIG_PCM_S8_ENCODER 1 #define CONFIG_PCM_S16BE_ENCODER 1 #define CONFIG_PCM_S16LE_ENCODER 1 #define CONFIG_PCM_S24BE_ENCODER 1 #define CONFIG_PCM_S24DAUD_ENCODER 1 #define CONFIG_PCM_S24LE_ENCODER 1 #define CONFIG_PCM_S32BE_ENCODER 1 #define CONFIG_PCM_S32LE_ENCODER 1 #define CONFIG_PCM_U8_ENCODER 1 #define CONFIG_PCM_U16BE_ENCODER 1 #define CONFIG_PCM_U16LE_ENCODER 1 #define CONFIG_PCM_U24BE_ENCODER 1 #define CONFIG_PCM_U24LE_ENCODER 1 #define CONFIG_PCM_U32BE_ENCODER 1 #define CONFIG_PCM_U32LE_ENCODER 1 #define CONFIG_PCM_ZORK_ENCODER 1 #define CONFIG_ROQ_DPCM_ENCODER 1 #define CONFIG_ADPCM_ADX_ENCODER 1 #define CONFIG_ADPCM_G726_ENCODER 1 #define CONFIG_ADPCM_IMA_QT_ENCODER 1 #define CONFIG_ADPCM_IMA_WAV_ENCODER 1 #define CONFIG_ADPCM_MS_ENCODER 1 #define CONFIG_ADPCM_SWF_ENCODER 1 #define CONFIG_ADPCM_YAMAHA_ENCODER 1 #define CONFIG_DVBSUB_ENCODER 1 #define CONFIG_DVDSUB_ENCODER 1 #define CONFIG_LIBAMR_NB_ENCODER 0 #define CONFIG_LIBAMR_WB_ENCODER 0 #define CONFIG_LIBDIRAC_ENCODER 0 #define CONFIG_LIBFAAC_ENCODER 0 #define CONFIG_LIBGSM_ENCODER 0 #define CONFIG_LIBGSM_MS_ENCODER 0 #define CONFIG_LIBMP3LAME_ENCODER 0 #define CONFIG_LIBSCHROEDINGER_ENCODER 0 #define CONFIG_LIBTHEORA_ENCODER 0 #define CONFIG_LIBVORBIS_ENCODER 0 #define CONFIG_LIBX264_ENCODER 0 #define CONFIG_LIBXVID_ENCODER 0 #define CONFIG_OGGVORBIS_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_AC3_MUXER 1 #define CONFIG_ADTS_MUXER 1 #define CONFIG_AIFF_MUXER 1 #define CONFIG_AMR_MUXER 1 #define CONFIG_ASF_MUXER 1 #define CONFIG_ASS_MUXER 1 #define CONFIG_ASF_STREAM_MUXER 1 #define CONFIG_AU_MUXER 1 #define CONFIG_AVI_MUXER 1 #define CONFIG_AVM2_MUXER 1 #define CONFIG_CRC_MUXER 1 #define CONFIG_DAUD_MUXER 1 #define CONFIG_DIRAC_MUXER 1 #define CONFIG_DNXHD_MUXER 1 #define CONFIG_DTS_MUXER 1 #define CONFIG_DV_MUXER 1 #define CONFIG_EAC3_MUXER 1 #define CONFIG_FFM_MUXER 1 #define CONFIG_FLAC_MUXER 1 #define CONFIG_FLV_MUXER 1 #define CONFIG_FRAMECRC_MUXER 1 #define CONFIG_GIF_MUXER 1 #define CONFIG_GXF_MUXER 1 #define CONFIG_H261_MUXER 1 #define CONFIG_H263_MUXER 1 #define CONFIG_H264_MUXER 1 #define CONFIG_IMAGE2_MUXER 1 #define CONFIG_IMAGE2PIPE_MUXER 1 #define CONFIG_IPOD_MUXER 1 #define CONFIG_M4V_MUXER 1 #define CONFIG_MATROSKA_MUXER 1 #define CONFIG_MATROSKA_AUDIO_MUXER 1 #define CONFIG_MJPEG_MUXER 1 #define CONFIG_MLP_MUXER 1 #define CONFIG_MMF_MUXER 1 #define CONFIG_MOV_MUXER 1 #define CONFIG_MP2_MUXER 1 #define CONFIG_MP3_MUXER 1 #define CONFIG_MP4_MUXER 1 #define CONFIG_MPEG1SYSTEM_MUXER 1 #define CONFIG_MPEG1VCD_MUXER 1 #define CONFIG_MPEG1VIDEO_MUXER 1 #define CONFIG_MPEG2DVD_MUXER 1 #define CONFIG_MPEG2SVCD_MUXER 1 #define CONFIG_MPEG2VIDEO_MUXER 1 #define CONFIG_MPEG2VOB_MUXER 1 #define CONFIG_MPEGTS_MUXER 1 #define CONFIG_MPJPEG_MUXER 1 #define CONFIG_MXF_MUXER 1 #define CONFIG_MXF_D10_MUXER 1 #define CONFIG_NULL_MUXER 1 #define CONFIG_NUT_MUXER 1 #define CONFIG_PCM_ALAW_MUXER 1 #define CONFIG_PCM_MULAW_MUXER 1 #define CONFIG_PCM_F64BE_MUXER 1 #define CONFIG_PCM_F64LE_MUXER 1 #define CONFIG_PCM_F32BE_MUXER 1 #define CONFIG_PCM_F32LE_MUXER 1 #define CONFIG_PCM_S32BE_MUXER 1 #define CONFIG_PCM_S32LE_MUXER 1 #define CONFIG_PCM_S24BE_MUXER 1 #define CONFIG_PCM_S24LE_MUXER 1 #define CONFIG_PCM_S16BE_MUXER 1 #define CONFIG_PCM_S16LE_MUXER 1 #define CONFIG_PCM_S8_MUXER 1 #define CONFIG_PCM_U32BE_MUXER 1 #define CONFIG_PCM_U32LE_MUXER 1 #define CONFIG_PCM_U24BE_MUXER 1 #define CONFIG_PCM_U24LE_MUXER 1 #define CONFIG_PCM_U16BE_MUXER 1 #define CONFIG_PCM_U16LE_MUXER 1 #define CONFIG_PCM_U8_MUXER 1 #define CONFIG_PSP_MUXER 1 #define CONFIG_RAWVIDEO_MUXER 1 #define CONFIG_RM_MUXER 1 #define CONFIG_ROQ_MUXER 1 #define CONFIG_RTP_MUXER 1 #define CONFIG_SWF_MUXER 1 #define CONFIG_TG2_MUXER 1 #define CONFIG_TGP_MUXER 1 #define CONFIG_TRUEHD_MUXER 1 #define CONFIG_VC1T_MUXER 1 #define CONFIG_VOC_MUXER 1 #define CONFIG_WAV_MUXER 1 #define CONFIG_YUV4MPEGPIPE_MUXER 1 #define CONFIG_LIBNUT_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_FILE_PROTOCOL 1 #define CONFIG_GOPHER_PROTOCOL 1 #define CONFIG_HTTP_PROTOCOL 1 #define CONFIG_PIPE_PROTOCOL 1 #define CONFIG_RTP_PROTOCOL 1 #define CONFIG_TCP_PROTOCOL 1 #define CONFIG_UDP_PROTOCOL 1 #define CONFIG_ALSA_MUXER 0 #define CONFIG_BKTR_MUXER 0 #define CONFIG_AUDIO_BEOS_MUXER 0 #define CONFIG_V4L2_DEMUXER 1 #define CONFIG_V4L_DEMUXER 1 #define CONFIG_ALSA_DEMUXER 0 #define CONFIG_BKTR_DEMUXER 0 #define CONFIG_AUDIO_BEOS_DEMUXER 0 #define CONFIG_JACK_DEMUXER 0 #define CONFIG_VFWCAP_DEMUXER 0 #define CONFIG_X11_GRAB_DEVICE_DEMUXER 0 avifile-0.7.48~20090503.ds/include/configfile.h0000644000175000017500000000731411174020355017645 0ustar yavoryavor#ifndef AVIFILE_CONFIGFILE_H #define AVIFILE_CONFIGFILE_H #include "avm_default.h" /** * This namespace provides means to conveniently store and retrieve app-specific * data from the registry ( file ~/.avm/ ). * * Function names are self-explanatory. Do not include spaces in first two * arguments to avoid collisions. 'def_value' arguments correspond to * values which will be returned if needed record is not found in the * registry or if registry access fails for some reason. */ /* declaration */ AVM_BEGIN_NAMESPACE; // change default config directory name .avm/default AVMEXPORT void* RegInit(const char* regname, const char* dirname = ".avm"); AVMEXPORT void RegSave(); AVMEXPORT int RegWriteInt(const char* appname, const char* valname, int value); AVMEXPORT int RegReadInt(const char* appname, const char* valname, int def_value); AVMEXPORT int RegWriteFloat(const char* appname, const char* valname, float value); AVMEXPORT float RegReadFloat(const char* appname, const char* valname, float def_value); AVMEXPORT int RegWriteString(const char* appname, const char* valname, const char* value); AVMEXPORT const char* RegReadString(const char* appname, const char* valname, const char* def_value); AVM_END_NAMESPACE; #ifdef AVM_COMPATIBLE #define REGISTRY_BEGIN_NAMESPACE namespace Registry { #define REGISTRY_END_NAMESPACE } REGISTRY_BEGIN_NAMESPACE; /* backward declaration */ static inline void* Init(const char* regname, const char* dirname = ".avm") { return avm::RegInit(regname, dirname); } static inline int WriteInt(const char* appname, const char* valname, int value) { return avm::RegWriteInt(appname, valname, value); } static inline int ReadInt(const char* appname, const char* valname, int def_value) { return avm::RegReadInt(appname, valname, def_value); } static inline int WriteFloat(const char* appname, const char* valname, float value) { return avm::RegWriteFloat(appname, valname, value); } static inline float ReadFloat(const char* appname, const char* valname, float def_value) { return avm::RegReadFloat(appname, valname, def_value); } static inline int WriteString(const char* appname, const char* valname, const char* value) { return avm::RegWriteString(appname, valname, value); } static inline const char* ReadString(const char* appname, const char* valname, const char* def_value) { return avm::RegReadString(appname, valname, def_value); } REGISTRY_END_NAMESPACE; #endif // AVM_COMPATIBLE // // For internal usage by avifile applications // do not try to use elsewhere! // // used by defining DECLARE_REGISTRY_SHORTCUT // before inclusion of this file #ifdef DECLARE_REGISTRY_SHORTCUT extern const char* g_pcProgramName; static inline float RF(const char* name, float def) { return avm::RegReadFloat(g_pcProgramName, name, def); } static inline int RI(const char* name, int def) { return avm::RegReadInt(g_pcProgramName, name, def); } static inline const char* RS(const char* name, const char* def) { return avm::RegReadString(g_pcProgramName, name, def); } static inline int WF(const char* name, float def) { return avm::RegWriteFloat(g_pcProgramName, name, def); } static inline int WI(const char* name, int def) { return avm::RegWriteInt(g_pcProgramName, name, def); } static inline int WS(const char* name, const char* def) { return avm::RegWriteString(g_pcProgramName, name, def); } #ifdef QSTRING_H static inline int WI(const char* name, const QString& def) { return avm::RegWriteInt(g_pcProgramName, name, def.toInt()); } static inline int WS(const char* name, const QString& def) { return avm::RegWriteString(g_pcProgramName, name, def.ascii()); } //{ return avm::RegWriteString(g_pcProgramName, name, def.toAscii()); } #endif // QSTRING_H #endif // DECLARE_REGISTRY_SHORTCUT #endif // AVIFILE_CONFIGFILE_H avifile-0.7.48~20090503.ds/include/cpuinfo.h0000644000175000017500000000023107664344744017216 0ustar yavoryavor#ifndef AVIFILE_CPUINFO_H #define AVIFILE_CPUINFO_H #warning Use #include "avm_cpuinfo.h" instead #include "avm_cpuinfo.h" #endif // AVIFILE_CPUINFO_H avifile-0.7.48~20090503.ds/include/creators.h0000644000175000017500000000023507664344744017401 0ustar yavoryavor#ifndef AVIFILE_CREATORS_H #define AVIFILE_CREATORS_H #warning Use #include "avm_creators.h" instead #include "avm_creators.h" #endif //AVIFILE_CREATORS_H avifile-0.7.48~20090503.ds/include/default.h0000644000175000017500000000023407547603645017200 0ustar yavoryavor#ifndef AVIFILE_DEFAULT_H #define AVIFILE_DEFAULT_H #warning Use #include "avm_default.h" instead #include "avm_default.h" #endif /* AVIFILE_DEFAULT_H */ avifile-0.7.48~20090503.ds/include/except.h0000644000175000017500000000022407664344744017045 0ustar yavoryavor#ifndef AVIFILE_EXCEPT_H #define AVIFILE_EXCEPT_H #warning Use #include "avm_except.h" instead #include "avm_except.h" #endif // AVIFILE_EXCEPT_H avifile-0.7.48~20090503.ds/include/formats.h0000644000175000017500000010353611175405631017223 0ustar yavoryavor#ifndef AVIFILE_FORMATS_H #define AVIFILE_FORMATS_H #ifdef WIN32 #include #include #include #include #else /* !WIN32 */ #include "avm_default.h" #ifndef GUID_TYPE #define GUID_TYPE /** * GUID is unique 16-byte indentifier * * Usually being shown as: AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE * * DDDD however is not uint16_t but two uint8_t * This representation allows to use it in the natural * human readable way * Note: f1, f2, f3 are little endian */ typedef struct AVMPACKED { uint32_t f1; uint16_t f2; uint16_t f3; uint8_t f4[8]; } GUID; #endif /* !GUID_TYPE */ #ifndef _BITMAPINFOHEADER_ #define _BITMAPINFOHEADER_ /** * The BITMAPINFOHEADER contains all the details about the video stream such * as the actual image dimensions and their pixel depth. A source filter may * also request that the sink take only a section of the video by providing a * clipping rectangle in rcSource. In the worst case where the sink filter * forgets to check this on connection it will simply render the whole thing * which isn't a disaster. Ideally a sink filter will check the rcSource and * if it doesn't support image extraction and the rectangle is not empty then * it will reject the connection. A filter should use SetRectEmpty to reset a * rectangle to all zeroes (and IsRectEmpty to later check the rectangle). * The rcTarget specifies the destination rectangle for the video, for most * source filters they will set this to all zeroes, a downstream filter may * request that the video be placed in a particular area of the buffers it * supplies. */ typedef struct AVMPACKED { /** Specifies the number of bytes required by the structure. */ uint32_t biSize; /** Specifies the width of bitmap, in pixels. */ int32_t biWidth; /** * Specifies the height of bitmap, in pixels. * * For RGB surfaces - negative orientation means top-down image * for all other codecs the sign is meangless and should be ignored * the FOURCC code uniquely identifies the compression and orientation * It is not valid to describe orientation with the sign of biHeight * * Common YUV format such as YV12, YUY2 are top-down oriented. * The sign of biHeight for such formats must always be set positive * by driver producing such formats and the sign must be ignored by any * driver receiving such formats. For proprietary compression formats with * an associated FOURCC, any orientation is acceptable, but must be * always the same for all bitmaps of the FOURCC. */ int32_t biHeight; /** Specifies the number of planes for target device. (Must be 1) */ uint16_t biPlanes; /** * Specifies the number of bits-per-pixel. * * - 0 * The number is specified or is implied by the JPEG or PNG * * - 1 * The bitmap is monochrome and the bmiColors member contains * two entries. Each bit in the bitmap array represents a pixel. * If the bit is clear, the pixel is displayed with the color * of the first entry in the bmiColors table; if the bit is set, * the pixel has the color of the second in the table. * * - 4 * The bitmap has a maximum of 16 colors and the bmiColors member * contains up to 16 entries. Each pixel in the bitmap is represented * by a 4-bit index into the color table. For example, if the * first pixel contains the color in the second table entry, and * the second pixel constains the color in the sixteenth table entry * * - 8 * The bitmap has a maximum of 256 color, and the bmiColors member * constains up to 256 entries. In this case, each byte in the * array represents a single pixel. * * - 16 * The bitmap has a maximum of 2^16 color. If the biCompression member * of the BITMPAINFOHEADER is BI_RGB, the bmiColors member is NULL. * Each WORD in the bitmap array represents a single pixel. * The relative intensities of red, green and blue are represented * with five bits for each color component 5-5-5. * When the biCompression member is BI_BITFIELDS, the system supports * only the following 16bpp color masks: A 5-5-5 16bit image, * (b:0x001f, g:0x03e0, r:0x7c00) and 5-6-5 16bit image * (b:0x001f g:0x07e0 r:0xf800) * * - 24 * Bitmap has a maximum of 2^24 colors, and the bmiColors member * is NULL, Each 3-byte triplet in the bitmap array represents * the realtive intensities of blue, green, and red, respecitively, * for each a pix. The bmiColors color table is used for optimizing * colors used on palette-based devices, and must contain the number * of entries specified by the biClrUsed member of BITMAPINFOHEADER. * * - 32 * The bitmap has a maximum of 2^32. If the biCompression member * of the BITMPAINFOHEADER is BI_RGB, the bmiColors member is NULL. * Each DWORD in the bitmap array represents the relative intensities * of the blue, green and read, respectively, for a pixel. The high * byte in each DWORD is not used. The bmiColors color table is used * for optimizing colors used on palette-based devices, * and must constain the number of entries specified by the biClrUsed * member of the BITMAPINFOHEADER. * * \todo append remaining info here */ uint16_t biBitCount; /** * Specifies the compression format * * - BI_RGB * An uncompressed format. * * - BI_RLE8 * A run-length encoded (RLE) format for bitmaps with 8bpp. * The compression format is a 2-byte format consisting of * a count byte followed by a byte containg a color index. * * - BI_RLE4 * An RLE format for bitmaps with 4bpp. The compression format * is a 2-byte format consisting of a count byte followed * by two word-length color indexes. * * - BI_BITFIELDS * Specifies that the bitmap is not compressed and that the * color table consists of three DWORD color masks that * specify the red, green, and blue components, respectively, * of each pixel. This is valid when used with 16- and * 32-bpp bitmaps. * * - BI_JPEG * Image is a JPEG image * * - BI_PNG * Image is PNG image */ uint32_t biCompression; /** * Specifies the size, in bytes, of the image. This may be set to zero * for BI_RGB bitmaps. */ uint32_t biSizeImage; /** Specifies the horizontal resolution, in pixels-pre-meter */ int32_t biXPelsPerMeter; /** Specifies the vertical resolution, in pixels-pre-meter */ int32_t biYPelsPerMeter; /** * Specifies the number of color indexes in the color table that * are actually used by the bitmap. If this value is zero, the bitmap * uses the maximum number of colors corresponding to the value of * the biBitCount member for the compression mode specified by * biCompression. * * If biClrUsed is nonzero and the biBitCount member is less then 16, * the biClrUsed member specifies the actual number of colors the graphics * engine or device driver accesses. If the biBitCount is 16 or greater, * the biClrUsed member specifies the size of the color table used to * optimize performance of the system color palettes. If biBitCount * equals 16 or 32, the optimal color palette starts immediately * following the free DWORD mask. * * When the bitmap array immediatelly follos the BITMAPINFO structure, * it is a packed bitmap. Packed bitmaps are referenced by a single * pointer. Packed bitmaps require that the biClrUsed member * must be either zero or the actual size of the color table. */ uint32_t biClrUsed; /** * Specifies the number of color indexes that are required for the displaying * the bitmap. If this value is zero, all colors are required. */ uint32_t biClrImportant; } BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER; typedef struct AVMPACKED { BITMAPINFOHEADER bmiHeader; uint32_t bmiColors[1]; } BITMAPINFO, *LPBITMAPINFO; #endif /* _BITMAPINFOHEADER */ #ifndef _WAVEFORMATEX_ #define _WAVEFORMATEX_ typedef struct AVMPACKED _WAVEFORMATEX { /** * Waveform-audio format type. Format tags are registred with * Microsoft Corporation for many compression algorithms. */ uint16_t wFormatTag; /** Number of channels in the waveformat audio data. */ uint16_t nChannels; /** * Sample rate, in samples per seconds (Hertz), that each channel * should be played or recorded. */ uint32_t nSamplesPerSec; /** * Required average data-transfer rate, in bytes per second, for * format tag. For PCM it should be nAvgBytesPerSec * nBlockAlign */ uint32_t nAvgBytesPerSec; /** * Block alignment in bytes. The block alignment is the minimum * atomic using of the data for the wFormatTag format type. * For PCM it should be nChannels * wBitsPerPixel / 8. * For Mp3 this is 1 because of the Windows (there is no logic in this) */ uint16_t nBlockAlign; /** * Bits per sample for the wFormatTag format type. If wFormatTag * is WAVE_FORMAT_PCM then wBitsPerSample should be equal to 8 or 16. * Note that some compression schemes cannot define a value for * wBitsPerSample, so this member can be zero. * For WAVEFORMATEXTENSIBLE it must be byte-aligned */ uint16_t wBitsPerSample; /** * Size, in bytes, of extra format information appended to the end * of the WAVEFORMATEX structure. This information can be used by * non-PCM formats to store extra attributes for the wFormatTag. * If no extra information od required by the wFormatTag, this member * must be set to zero. For PCM format this member is ignored. */ uint16_t cbSize; } WAVEFORMATEX; typedef WAVEFORMATEX *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX; #endif /* !_WAVEFORMATEX_ */ #ifndef _WAVEFORMATEXTENSIBLE_ #define _WAVEFORMATEXTENSIBLE_ /** * The WAVEFORMATEXTENSIBLE structure defines the format of waveform-audio * data for formats having more than two channels or higher sample * resolutions than allowed by WAVEFORMATEX. It can also be used to * define any format that can be defined by WAVEFORMATEX. * * cbSize member must be at least 22 */ typedef struct AVMPACKED { WAVEFORMATEX Format; union { uint16_t wValidBitsPerSample; ///< bits of precision uint16_t wSamplesPerBlock; ///< valid if wBitsPerSample==0 int16_t wReserved; ///< If neither applies, set to zero } Samples; int32_t dwChannelMask; ///< which channels are present in stream #define SPEAKER_FRONT_LEFT 0x1 #define SPEAKER_FRONT_RIGHT 0x2 #define SPEAKER_FRONT_CENTER 0x4 #define SPEAKER_LOW_FREQUENCY 0x8 #define SPEAKER_BACK_LEFT 0x10 #define SPEAKER_BACK_RIGHT 0x20 #define SPEAKER_FRONT_LEFT_OF_CENTER 0x40 #define SPEAKER_FRONT_RIGHT_OF_CENTER 0x80 #define SPEAKER_BACK_CENTER 0x100 #define SPEAKER_SIDE_LEFT 0x200 #define SPEAKER_SIDE_RIGHT 0x400 #define SPEAKER_TOP_CENTER 0x800 #define SPEAKER_TOP_FRONT_LEFT 0x1000 #define SPEAKER_TOP_FRONT_CENTER 0x2000 #define SPEAKER_TOP_FRONT_RIGHT 0x4000 #define SPEAKER_TOP_BACK_LEFT 0x8000 #define SPEAKER_TOP_BACK_CENTER 0x10000 #define SPEAKER_TOP_BACK_RIGHT 0x20000 GUID SubFormat; ///< similar to wFormatTag number } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE; #endif /* !_WAVEFORMATEXTENSIBLE_ */ typedef WAVEFORMATEXTENSIBLE WAVEFORMATPCMEX; /* Format.cbSize = 22 */ /** * WAVE format with extended structure which describes mp3 track */ typedef struct AVMPACKED { WAVEFORMATEX wfx; uint16_t wID; ///< Set this structure member to MPEGLAYER3_ID_MPEG #define MPEGLAYER3_ID_UNKNOWN 0 #define MPEGLAYER3_ID_MPEG 1 #define MPEGLAYER3_ID_CONSTANTFRAMESIZE 2 int32_t fdwFlags; ///< Indicates whether padding is used to adjust the average bitrate to the sampling rate #define MPEGLAYER3_FLAG_PADDING_ISO 0 ///< Insert padding as needed to achieve the stated average bitrate. #define MPEGLAYER3_FLAG_PADDING_ON 1 ///< Always insert padding. The average bit rate may be higher than stated. #define MPEGLAYER3_FLAG_PADDING_OFF 2 ///< Never insert padding. The average bit rate may be lower than stated. uint16_t nBlockSize; ///< Block size in bytes. This value equals the frame length in bytes x nFramesPerBlock. For MP3 audio, the frame length is calculated as follows: 144 x (bitrate / sample rate) + padding uint16_t nFramesPerBlock; ///< Number of audio frames per block uint16_t nCodecDelay; ///< Encoder delay in samples. If you do not know this value, set this structure member to zero } MPEGLAYER3WAVEFORMAT; typedef struct AVMPACKED { WAVEFORMATEXTENSIBLE wfex; uint32_t nInitSize; ///< Size of initial ident header uint32_t nCommentSize; ///< Size of comment header uint32_t nCodebookSize; ///< Size of codebook header } VORBISWAVEFORMATEX; #ifndef WAVE_FORMAT_VORBIS1 #define WAVE_FORMAT_VORBIS1 0x674f ///< ("Og") ... Original stream compatible #define WAVE_FORMAT_VORBIS2 0x6750 ///< ("Pg") ... Have independent header #define WAVE_FORMAT_VORBIS3 0x6751 ///< ("Qg") ... Have no codebook header #define WAVE_FORMAT_VORBIS1P 0x676f ///< ("og") ... Original stream compatible #define WAVE_FORMAT_VORBIS2P 0x6770 ///< ("pg") ... Have independent header #define WAVE_FORMAT_VORBIS3P ('q' | ('g'<<8)) ///< 0x6771("qg") ... Have no codebook header typedef struct AVMPACKED { WAVEFORMATEX wfx; uint32_t dwVorbisACMVersion; ///< vorbis.acm uint32_t dwLibVorbisVersion; ///< libVorbis uint8_t byExtra[0]; } OGGWAVEWAVEFORMAT; #endif /* WAVE_FORMAT_VORBIS1 */ /** * this extended WAVEFORMAT struct is used to pass around info about codecs currently unknown to other * parts of avifile (and usually to any Microsoft specs) * So this format will NOT be playable by anything else except avifile!!! */ typedef struct AVMPACKED { WAVEFORMATEXTENSIBLE wfex; uint32_t dwCodecID; ///< CodecID from ffmpeg's audio codec } FFMPEGWAVEFORMATEX; /* http://msdn.microsoft.com/en-us/library/ms867195.aspx */ /** WAVE form wFormatTag IDs */ #define WAVE_FORMAT_UNKNOWN 0x0000 ///< Microsoft Corporation #if !defined(WAVE_FORMAT_PCM) #define WAVE_FORMAT_PCM 0x0001 ///< Microsoft Corporation: PCM audio in integer format #endif /* !WAVE_FORMAT_PCM */ #define WAVE_FORMAT_ADPCM 0x0002 ///< Microsoft Corporation: adaptive PCM #define WAVE_FORMAT_IEEE_FLOAT 0x0003 ///< Microsoft Corporation: PCM audio in IEEE floating-point format #define WAVE_FORMAT_VSELP 0x0004 ///< Compaq Computer Corp.: PCM audio in IEEE floating-point format #define WAVE_FORMAT_IBM_CVSD 0x0005 ///< IBM Corporation #define WAVE_FORMAT_ALAW 0x0006 ///< Microsoft Corporation #define WAVE_FORMAT_MULAW 0x0007 ///< Microsoft Corporation #define WAVE_FORMAT_DTS 0x0008 ///< Microsoft Corporation #define WAVE_FORMAT_DRM 0x0009 ///< Microsoft Corporation: Microsoft Digital Rights Managed encrypted audio #define WAVE_FORMAT_VMPS1 0x000A ///< Microsoft Corporation: Speech audio codec #define WAVE_FORMAT_WMSP2 0x000B ///< Microsoft Corporation #define WAVE_FORMAT_OKI_ADPCM 0x0010 ///< OKI #define WAVE_FORMAT_DVI_ADPCM 0x0011 ///< Intel Corporation #define WAVE_FORMAT_IMA_ADPCM (WAVE_FORMAT_DVI_ADPCM) #define WAVE_FORMAT_MEDIASPACE_ADPCM 0x0012 ///< Videologic #define WAVE_FORMAT_SIERRA_ADPCM 0x0013 ///< Sierra Semiconductor Corp #define WAVE_FORMAT_G723_ADPCM 0x0014 ///< Antex Electronics Corporation #define WAVE_FORMAT_DIGISTD 0x0015 ///< DSP Solutions, Inc. #define WAVE_FORMAT_DIGIFIX 0x0016 ///< DSP Solutions, Inc. #define WAVE_FORMAT_DIALOGIC_OKI_ADPCM 0x0017 ///< Dialogic Corporation: OKI ADPCM chips or firmware #define WAVE_FORMAT_MEDIAVISION_ADPCM 0x0018 ///< Media Vision, Inc.: ADPCM for Jazz 16 chip set #define WAVE_FORMAT_CU_CODEC 0x0019 ///< Hewlett-Packard Company #define WAVE_FORMAT_HP_DYNAMIC_VOICE 0x001A ///< Hewlett-Packard Company #define WAVE_FORMAT_YAMAHA_ADPCM 0x0020 ///< Yamaha Corporation of America #define WAVE_FORMAT_SONARC 0x0021 ///< Speech Compression #define WAVE_FORMAT_DSPGROUP_TRUESPEECH 0x0022 ///< DSP Group, Inc #define WAVE_FORMAT_ECHOSC1 0x0023 ///< Echo Speech Corporation #define WAVE_FORMAT_AUDIOFILE_AF36 0x0024 ///< Ahead Inc. #define WAVE_FORMAT_APTX 0x0025 ///< Audio Processing Technology #define WAVE_FORMAT_AUDIOFILE_AF10 0x0026 ///< Ahead, Inc. #define WAVE_FORMAT_PROSODY_1612 0x0027 ///< Aculab plc: Prosody CTI speech card #define WAVE_FORMAT_LRC 0x0028 ///< Merging Technologies S.A. #define WAVE_FORMAT_DOLBY_AC2 0x0030 ///< Dolby Laboratories #define WAVE_FORMAT_GSM610 0x0031 ///< Microsoft Corporation #define WAVE_FORMAT_MSNAUDIO 0x0032 ///< Microsoft Corporation: Microsoft MSN audio code #define WAVE_FORMAT_ANTEX_ADPCME 0x0033 ///< Antex Electronics Corporation #define WAVE_FORMAT_CONTROL_RES_VQLPC 0x0034 ///< Control Resources Limited #define WAVE_FORMAT_DIGIREAL 0x0035 ///< DSP Solutions, Inc. #define WAVE_FORMAT_DIGIADPCM 0x0036 ///< DSP Solutions, Inc. #define WAVE_FORMAT_CONTROL_RES_CR10 0x0037 ///< Control Resources Limited #define WAVE_FORMAT_NMS_VBXADPCM 0x0038 ///< Natural MicroSystems #define WAVE_FORMAT_ROLAND_RDAC 0x0039 ///< Roland Corporation: Roland RDAC proprietary format (IMA ADPCM) #define WAVE_FORMAT_ECHOSC3 0x003A ///< Echo Speech Corporation: Proprietary compression format #define WAVE_FORMAT_ROCKWELL_ADPCM 0x003B ///< Rockwell International: Rockwell ADPCM #define WAVE_FORMAT_ROCKWELL_DIGITALK 0x003C ///< Rockwell International: Rockwell DIGITALK #define WAVE_FORMAT_XEBEC 0x003D ///< Xebec Multimedia Solutions Ltd.: Proprietary compression format #define WAVE_FORMAT_G721_ADPCM 0x0040 ///< Antex Electronics Corporation #define WAVE_FORMAT_G728_CELP 0x0041 ///< Antex Electronics Corporation #define WAVE_FORMAT_MSG723 0x0042 ///< Microsoft Corporation #define WAVE_FORMAT_MSG723_1 0x0043 ///< Microsoft Corporation #define WAVE_FORMAT_MSG729 0x0044 ///< Microsoft Corporation #define WAVE_FORMAT_SPG726 0x0045 ///< Microsoft Corporation #define WAVE_FORMAT_MPEG 0x0050 ///< Microsoft Corporation #define WAVE_FORMAT_RT24 0x0052 ///< InSoft, Inc. #define WAVE_FORMAT_PAC 0x0053 ///< InSoft, Inc. #define WAVE_FORMAT_MPEGLAYER3 0x0055 ///< ISO/MPEG Layer3 format tag #define WAVE_FORMAT_LUCENT_G723 0x0059 ///< Lucent Technologies #define WAVE_FORMAT_CIRRUS 0x0060 ///< Cirrus Logic #define WAVE_FORMAT_ESPCM 0x0061 ///< ESS Technology #define WAVE_FORMAT_VOXWARE 0x0062 ///< Voxware Inc #define WAVE_FORMAT_CANOPUS_ATRAC 0x0063 ///< Canopus, co., Ltd.: ATRACWAVEFORMAT #define WAVE_FORMAT_G726_ADPCM 0x0064 ///< APICOM #define WAVE_FORMAT_G722_ADPCM 0x0065 ///< APICOM #define WAVE_FORMAT_DSAT_DISPLAY 0x0067 ///< Microsoft Corporation #define WAVE_FORMAT_VOXWARE_BYTE_ALIGNED 0x0069 ///< Voxware, Inc. #define WAVE_FORMAT_VOXWARE_AC8 0x0070 ///< Voxware, Inc. #define WAVE_FORMAT_VOXWARE_AC10 0x0071 ///< Voxware, Inc. #define WAVE_FORMAT_VOXWARE_AC16 0x0072 ///< Voxware, Inc. #define WAVE_FORMAT_VOXWARE_AC20 0x0073 ///< Voxware, Inc. #define WAVE_FORMAT_VOXWARE_RT24 0x0074 ///< Voxware, Inc. #define WAVE_FORMAT_VOXWARE_RT29 0x0075 ///< Voxware, Inc. #define WAVE_FORMAT_VOXWARE_RT29HW 0x0076 ///< Voxware, Inc. #define WAVE_FORMAT_VOXWARE_VR12 0x0077 ///< Voxware, Inc. #define WAVE_FORMAT_VOXWARE_VR18 0x0078 ///< Voxware, Inc. #define WAVE_FORMAT_VOXWARE_TQ40 0x0079 ///< Voxware, Inc. #define WAVE_FORMAT_SOFTSOUND 0x0080 ///< Softsound, Ltd. #define WAVE_FORMAT_VOXWARE_TQ60 0x0081 ///< Voxware, Inc. #define WAVE_FORMAT_MSRT24 0x0082 ///< Microsoft Corporation #define WAVE_FORMAT_G729A 0x0083 ///< AT&T Labs, Inc. #define WAVE_FORMAT_MVI_MVI2 0x0084 ///< Motion Pixels #define WAVE_FORMAT_DF_G726 0x0085 ///< DataFusion Systems (Pty), Ltd. #define WAVE_FORMAT_DF_GSM610 0x0086 ///< DataFusion Systems (Pty), Ltd. #define WAVE_FORMAT_ISIAUDIO 0x0088 ///< Iterated Systems, Inc. #define WAVE_FORMAT_ONLIVE 0x0089 ///< OnLive! Technologies, Inc. #define WAVE_FORMAT_MULTITUDE_FT_SX20 0x008A ///< Multitude, Inc. #define WAVE_FORMAT_MM_INFOCOM_ITS_ACM_G721 0x008B ///< Infocom ITS A/S: G.721 ADPCM #define WAVE_FORMAT_CONVEDIA_G729 0x008C ///< Convedia Corporation #define WAVE_FORMAT_CONGRUENCY_AUDIO_CODEC 0x008D ///< Congruency, Inc. #define WAVE_FORMAT_SBC24 0x0091 ///< Siemens Business Communications Sys #define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092 ///< Sonic Foundry #define WAVE_FORMAT_MEDIASONIC_G723 0x0093 ///< MediaSonic #define WAVE_FORMAT_PROSODY_8KBPS 0x0094 ///< Aculab plc: Prosody CTI speech card #define WAVE_FORMAT_ZYXEL_ADPCM 0x0097 ///< ZyXEL Communications, Inc.: ZyXEL ADPCM #define WAVE_FORMAT_PHILIPS_LPCBB 0x0098 ///< Philips Speech Processing #define WAVE_FORMAT_PACKED 0x0099 ///< Studer Professional Audio AG #define WAVE_FORMAT_MALDEN_PHONYTALK 0x00A0 ///< Malden Electronics Ltd. #define WAVE_FORMAT_RRLGSM 0x00A1 ///< Racal Recorders: Racal Recorder GSM #define WAVE_FORMAT_RRLG729A 0x00A3 ///< Racal Recorders: Racal Recorder G720.a #define WAVE_FORMAT_RRLG7231 0x00A3 ///< Racal Recorders: Racal G723.1 #define WAVE_FORMAT_RRLTETRA_ACLEP 0x00A4 ///< Racal Recorders: Racal Tetra ACELP #define WAVE_FORMAT_NEC_AAC 0x00B0 ///< NEC Corporation: NEC AAC #define WAVE_FORMAT_RHETOREX_ADPCM 0x0100 ///< Rhetorex Inc.: Rhetorex ADPCM wave format type #define WAVE_FORMAT_IRAT 0x0101 ///< BeCubed Software, Inc. #define WAVE_FORMAT_VIVO_G723 0x0111 ///< Vivo Software #define WAVE_FORMAT_VIVO_SIREN 0x0112 ///< Vivo Software #define WAVE_FORMAT_PHILIPS_CELP 0x0120 ///< Philips Speech Processing #define WAVE_FORMAT_PHILIPS_GRUNDIG 0x0121 ///< Philips Speech Processing #define WAVE_FORMAT_DIGITAL_G723 0x0123 ///< Digital Equipment Corporation #define WAVE_FORMAT_SANYO_LD_ADPCM 0x0125 ///< Sanyo Electric Co., Ltd.: Sanyo LD-ADPCM wave type #define WAVE_FORMAT_SIPROLAB_ACEPLNET 0x0130 ///< Sipro Lab Telecom, Inc. #define WAVE_FORMAT_SIPROLAB_ACELP4800 0x0131 ///< Sipro Lab Telecom, Inc. #define WAVE_FORMAT_SIPROLAB_ACELP8V3 0x0132 ///< Sipro Lab Telecom, Inc. #define WAVE_FORMAT_SIPROLAB_G729 0x0133 ///< Sipro Lab Telecom, Inc. #define WAVE_FORMAT_SIPROLAB_G729A 0x0134 ///< Sipro Lab Telecom, Inc. #define WAVE_FORMAT_SIPROLAB_KELVIN 0x0135 ///< Sipro Lab Telecom, Inc. #define WAVE_FORMAT_G726ADPCM 0x0140 ///< Dictaphone Corporation #define WAVE_FORMAT_CELP68 0x0141 ///< Dictaphone Corporation #define WAVE_FORMAT_CELP54 0x0142 ///< Dictaphone Corporation #define WAVE_FORMAT_QUALCOMM_PUREVOICE 0x0150 ///< Qualcomm, Inc. #define WAVE_FORMAT_QUALCOMM_HALFRATE 0x0151 ///< Qualcomm, Inc. #define WAVE_FORMAT_TUBGSM 0x0155 ///< Ring Zero Systems, Inc.: Related to GSM 6.10 #define WAVE_FORMAT_MSAUDIO1 0x0160 ///< Microsoft Corporation #define WAVE_FORMAT_WMAUDIO2 0x0161 ///< Microsoft Corporation: Multichannel WMA #define WAVE_FORMAT_MSAUDIO2 (WAVE_FORMAT_WMAUDIO2) #define WAVE_FORMAT_WMAUDIO3 0x0162 ///< Microsoft Corporation #define WAVE_FORMAT_WMAUDIO_LOSSLESS 0x0163 ///< Microsoft Corporation: WMA lossless #define WAVE_FORMAT_WMASPDIF 0x0164 ///< Microsoft Corporation: WMA Pro over S/PDIF #define WAVE_FORMAT_UNISYS_NAP_ADPCM 0x0170 ///< Unisys Corporation #define WAVE_FORMAT_UNISYS_NAP_ULAW 0x0171 ///< Unisys Corporation #define WAVE_FORMAT_UNISYS_NAP_ALAW 0x0172 ///< Unisys Corporation #define WAVE_FORMAT_UNISYS_NAP_16K 0x0173 ///< Unisys Corporation #define WAVE_FORMAT_MM_SYCOM_ACM_SYC008 0x0174 ///< SyCom Technologies #define WAVE_FORMAT_MM_SYCOM_ACM_SYC701_G726L 0x0175 ///< SyCom Technologies #define WAVE_FORMAT_MM_SYCOM_ACM_SYC701_CELP54 0x0176 ///< SyCom Technologies #define WAVE_FORMAT_MM_SYCOM_ACM_SYC701_CELP68 0x0177 ///< SyCom Technologies #define WAVE_FORMAT_KNOWLEDGE_ADVENTURE_ADPCM 0x0177 ///< Knowledge Adventure, Inc. #define WAVE_FORMAT_MPEG2AAC 0x0180 ///< Fraunhofer IIS #define WAVE_FORMAT_DTS_DS 0x0190 ///< Digital Theater Systems, Inc. #define WAVE_FORMAT_INNINGS_ADPCM 0x0197 ///< Innings Telecom Inc. #define WAVE_FORMAT_CREATIVE_ADPCM 0x0200 ///< Creative Labs, Inc. #define WAVE_FORMAT_CREATIVE_FASTSPEECH8 0x0202 ///< Creative Labs, Inc. #define WAVE_FORMAT_CREATIVE_FASTSPEECH10 0x0203 ///< Creative Labs, Inc. #define WAVE_FORMAT_UHER_ADPCM 0x0210 ///< UHER informatic GmbH #define WAVE_FORMAT_QUARTERDECK 0x0220 ///< Quarterdeck Corporation #define WAVE_FORMAT_ILINK_VC 0x0230 ///< I-Link Worldwide #define WAVE_FORMAT_RAW_SPORT 0x0240 ///< Aureal Semiconductor #define WAVE_FORMAT_IPI_HSX 0x0250 ///< Interactive Products, Inc. #define WAVE_FORMAT_IPI_RPELP 0x0251 ///< Interactive Products, Inc. #define WAVE_FORMAT_CS2 0x0260 ///< Consistent Software #define WAVE_FORMAT_SONY_SCX 0x0270 ///< Sony Corporation #define WAVE_FORMAT_SONY_SCY 0x0271 ///< Sony Corporation #define WAVE_FORMAT_SONY_ATRAC3 0x0272 ///< Sony Corporation #define WAVE_FORMAT_SONY_SPC 0x0273 ///< Sony Corporation #define WAVE_FORMAT_TELUM 0x0280 ///< Telum, Inc. #define WAVE_FORMAT_TELUMIA 0x0281 ///< Telum, Inc. #define WAVE_FORMAT_NCVS_ADPCM 0x0285 ///< Norcom Electronics Corporation: Norcom Voice Systems ADPCM #define WAVE_FORMAT_FM_TOWNS_SND 0x0300 ///< Fujitsu Corporation // 0x0301 .. 0x0308 reserved for Fujitsu Corporation #define WAVE_FORMAT_DEVELOPMENT_MICRONAS 0x0350 ///< Micronas Semiconductors, Inc. #define WAVE_FORMAT_CELP833 0x0351 ///< Micronas Semiconductors, Inc. #define WAVE_FORMAT_BTV_DIGITAL 0x0400 ///< Brooktree Corporation: Brooktree digital audio format #define WAVE_FORMAT_QDESIGN_MUSIC 0x0450 ///< QDesign Corporation #define WAVE_FORMAT_VME_VMPCM 0x0680 ///< AT&T Labs, Inc. #define WAVE_FORMAT_TPC 0x0681 ///< AT&T Labs, Inc. #define WAVE_FORMAT_OLIGSM 0x1000 ///< Ing C. Olivetti & C., S.p.A. #define WAVE_FORMAT_OLIADPCM 0x1001 ///< Ing C. Olivetti & C., S.p.A. #define WAVE_FORMAT_OLICELP 0x1002 ///< Ing C. Olivetti & C., S.p.A. #define WAVE_FORMAT_OLISBC 0x1003 ///< Ing C. Olivetti & C., S.p.A. #define WAVE_FORMAT_OLIOPR 0x1004 ///< Ing C. Olivetti & C., S.p.A. #define WAVE_FORMAT_LH_CODEC 0x1100 ///< Lernout & Hauspie #define WAVE_FORMAT_LH_CELP 0x1101 ///< Lernout & Hauspie #define WAVE_FORMAT_LH_SB8 0x1102 ///< Lernout & Hauspie #define WAVE_FORMAT_LH_SB12 0x1103 ///< Lernout & Hauspie #define WAVE_FORMAT_LH_SB16 0x1104 ///< Lernout & Hauspie #define WAVE_FORMAT_NORRIS 0x1400 ///< Norris Communications, Inc. #define WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS 0x1500 ///< AT&T Labs, Inc. #define WAVE_FORMAT_SONICFOUNDRY_LOSSLESS 0x1971 ///< Sonic Foundry #define WAVE_FORMAT_DVM 0x2000 ///< FAST Multimedia AG #define WAVE_FORMAT_MSCE 0x2500 ///< Microsoft Corporation: reserved rangle to 0x2600 #define WAVE_FORMAT_DIVIO_AAC 0x4143 ///< Divio, Inc.: Divio's AAC #define WAVE_FORMAT_NOKIA_AMR 0x4201 ///< Nokia Mobile Phones: Nokia adaptive multirate #define WAVE_FORMAT_DIVIO_G726 0x4243 ///< Divio, Inc.: Divio's G726 #define WAVE_FORMAT_3COM_NBX 0x7000 ///< 3Com Corporation Not specified #define WAVE_FORMAT_NTT_DOCOMO_AMR_NO_SID 0x7A21 ///< Microsoft Corporation Adaptive multirate #define WAVE_FORMAT_NTT_DOCOMO_AMR_WITH_SID 0x7A22 ///< Microsoft Corporation: AMR with silence detection #define WAVE_FORMAT_COMVERSEINFOSYS_G723_1 0xA100 ///< Comverse Infosys Ltd. #define WAVE_FORMAT_COMVERSEINFOSYS_AVQSBC 0xA101 ///< Comverse Infosys Ltd. #define WAVE_FORMAT_COMVERSEINFOSYS_OLDSBC 0xA102 ///< Comverse Infosys Ltd. #define WAVE_FORMAT_SYMBOLTECH_G729A 0xA103 ///< Symbol Technologies Canada Symbol Technology's G729A #define WAVE_FORMAT_VOICEAGE_AMR_WB 0xA104 ///< VoiceAge Corporation #define WAVE_FORMAT_ITI_G726 0xA105 ///< Ingenient Technologies, Inc.: Ingenient's G726 #define WAVE_FORMAT_AAC 0xA106 ///< ISO/MPEG-4 advanced audio Coding #define WAVE_FORMAT_ESLG726 0xA107 ///< Encore Software Ltd.: Encore Software Ltd's G726 // WAVEFORMATIEEEFLOATEX KSDATAFORMAT_SUBTYPE_IEEE_FLOAT // WAVEFORMATPCMEX KSDATAFORMAT_SUBTYPE_PCM #if !defined(WAVE_FORMAT_EXTENSIBLE) #define WAVE_FORMAT_EXTENSIBLE 0xFFFE ///< Microsoft extensible #endif /* !WAVE_FORMAT_EXTENSIBLE */ /** * the WAVE_FORMAT_DEVELOPMENT format tag can be used during the * development phase of a new wave format. Before shipping, you MUST * acquire an official format tag from Microsoft. */ #define WAVE_FORMAT_DEVELOPMENT 0xFFFF #endif /* !WIN32 */ /** * Image format tag: * For more details see: http://www.webartz.com/fourcc/fccyuv.htm */ /** * Basic Windows bitmap format. 1, 4 and 8 bpp versions are palettised. * 16, 24 and 32bpp contain raw BGR samples. */ #define BI_RGB 0 /** Run length encoded 8bpp BGR image. */ #define BI_RLE8 1 /** Alias for BI_RLE8 */ #define IMG_FMT_RLE8 0x38454C52 /** Run length encoded 4bpp BGR image. */ #define BI_RLE4 2 /** Alias for BI_RLE4 */ #define IMG_FMT_RLE 0x34454C52 /** * Raw BGR with alpha. Sample precision and packing is arbitrary and * determined using bit masks for each component, as for BI_BITFIELDS. */ #define IMG_FMT_RGBA 0x34454C52 /** * Raw BGR with a transparency field. Layout is as for BI_RGB * at 16 and 32 bits per pixel but the msb in each pixel * indicates whether the pixel is transparent or not. */ #define IMG_FMT_RGBT 0x34454C52 /** * Raw BGR with arbitrary sample packing within a pixel. * Packing and precision of R, G and B components is determined * by bit masks for each. * bps: 16, 24, 32 */ #define BI_BITFIELDS 3 /** Alias for BI_RLE4 */ #define IMG_FMT_RAW 0x32776173 /* RGB/BGR Formats */ #define IMG_FMT_RGB (('R'<<24)|('G'<<16)|('B'<<8)) #define IMG_FMT_RGB8 (IMG_FMT_RGB|8) #define IMG_FMT_RGB15 (IMG_FMT_RGB|15) #define IMG_FMT_RGB16 (IMG_FMT_RGB|16) #define IMG_FMT_RGB24 (IMG_FMT_RGB|24) #define IMG_FMT_RGB32 (IMG_FMT_RGB|32) #define IMG_FMT_BGR BI_RGB // so normal BGR image has just number #define IMG_FMT_BGR8 (IMG_FMT_BGR|8) #define IMG_FMT_BGR15 (IMG_FMT_BGR|15) #define IMG_FMT_BGR16 (IMG_FMT_BGR|16) #define IMG_FMT_BGR24 (IMG_FMT_BGR|24) #define IMG_FMT_BGR32 (IMG_FMT_BGR|32) /** * Planar YUV Formats U (Cb) V (Cr) */ /** Similar to YV12 but including a level of indirection. */ #define IMG_FMT_CLPL 0x4C504C43 /** 8 bit Y plane followed by 8 bit 4x4 subsampled V and U planes. */ #define IMG_FMT_YVU9 0x39555659 /** As YVU9 but an additional 4x4 subsampled plane is appended and * constains delta information relative to the last frame - bpp is 9. * Intel Intermediate YUV9 */ #define IMG_FMT_IF09 0x39304649 /** 8 bit Y plane followed 8 bit 2x2 subsampled U and V planes */ #define IMG_FMT_I420 0x30323449 /** Duplicate of I420. */ #define IMG_FMT_IYUV 0x56555949 /** 8 bit Y plane follwed 8 bit 2x2 subsampled V and U planes. * similar to I420 except U, V planes swaped */ #define IMG_FMT_YV12 0x32315659 /** 8 bit Y plane followed 8 bit 4x4 subsampled U and V planes * so there is 1/4 width and 1/4 height of Y pixels for each line * this is UNREGISTERED extension used by avifile (YUV411P) */ #define IMG_FMT_I410 0x30313449 /** 8 bit Y plane followed 8 bit 4x1 subsampled U and V planes * so there is 1/4 width of Y pixels for each line * this is UNREGISTERED extension used by avifile (YUV411P) */ #define IMG_FMT_I411 0x31313449 /** 8 bit Y plane followed 8 bit 2x1 subsampled U and V planes * this is UNREGISTERED extension used by avifile (YUV422P) */ #define IMG_FMT_I422 0x32323449 /** 8 bit Y U V planes * this is UNREGISTERED extension used by avifile (YUV444P) */ #define IMG_FMT_I444 0x34343449 /** Single Y plane for monochrome images. */ #define IMG_FMT_Y800 0x30303859 /** Duplicate of Y800. */ #define IMG_FMT_Y8 0x20203859 /** * Packed YUV Formats */ /** Cirrus Logic format wit 4 pixels packed into uint32 * A form of YUV 4:1:1 with less than 8 bits per Y, U and V sample. */ #define IMG_FMT_CLJR 0x524A4C43 /** Interlaced version of UYVY (line order 0,2,4,... 1,3,5,...). */ #define IMG_FMT_IUYV 0x56595549 /** Interlaced version of Y41P (line order 0,2,4,... 1,3,5,...). */ #define IMG_FMT_IY41 0x31435949 /** 12 bit format used in Digital Camera IEEE 1394 * lsb: U0,Y0,Y1,V0,Y2,Y3 */ #define IMG_FMT_IYU1 0x31555949 /** YUV 4:2:2 as for UYVY but with different component ordering * within the uint32 macropixel identical to YUNV & V422 * lsb: Y0,U0,Y1,V0; Y2,U2,Y3,V2; Y4,U4,Y5,V4; */ #define IMG_FMT_YUY2 0x32595559 /** Duplicate of YUY2. */ #define IMG_FMT_YUYV 0x49595559 /** Duplicate of YUY2. */ #define IMG_FMT_V422 0x32323456 /** Duplicate of YUY2. */ #define IMG_FMT_YUNV 0x564E5559 /** 24 bit format * YUY 4:4:4 lsb: U0,Y0,V0; U1,Y1,V1; */ #define IMG_FMT_YUV 0x20565559 /** duplicate of YUV used in Digital Camera IEEE 1394. */ #define IMG_FMT_IYU2 0x32555949 /** YUV 4:2:2 (Y sample at every pixel, U and V sampled every second * pixel horizontaly on each line). A macropixel constains 2 pixels * in one uint32 - also known as UYNV and UYVY * lsb: U0,Y0,V0,Y1; U2,Y2,V2,Y3; U4,Y4,V4,Y5 */ #define IMG_FMT_Y422 0x32323459 /** Duplicate of Y422. */ #define IMG_FMT_UYVY 0x59565955 /** Duplicate of Y422. */ #define IMG_FMT_CPLA 0x414C5543 /** Duplicate of UYVY - used by some Nvidia */ #define IMG_FMT_UYNV 0x564E5955 /** Format as UYVY but lsb of each Y component is used * to signal pixel transparency. */ #define IMG_FMT_Y42T 0x54323459 /** YCbCr 4:2:2 extended precision 10bits per component - lsb: U0,Y0,V0,Y1 */ #define IMG_FMT_UYVP 0x50565955 /** YCbCr 4:2:2 extended precision 10-bits per component in Y0U0Y1V0 order. */ #define IMG_FMT_YUVP 0x50565559 /** 16 but YUV 4:2:2 - registered by Vitec Multimedia. */ #define IMG_FMT_V655 0x35353656 /** Packed YUV format with Y sampled at every second pixel across each * line and U and V sampled at every fourth pixel. */ #define IMG_FMT_Y211 0x31313259 /** YUV 4:1:1 similar to Y41P * within the 3x uint32 macropixels there are 8 image pixels * lsb: U0,Y0,V1,Y1; U4,Y2,V4,Y3; Y4,Y5,Y6,Y7; */ #define IMG_FMT_Y411 0x31315559 /** Y41P is basically the same as IY41 with the exception that * the data is interlaced. Lines are ordered 0,2,4,....,1,3,5.... * instead of 0,1,2,3,4,5,.... */ #define IMG_FMT_Y41P 0x50313459 /** Identical to Y41P except that the least significant bit of each Y * component forms a chromakey channel. (1 means show pixel) */ #define IMG_FMT_Y41T 0x54313459 /** Reodered YUY2 lsb: Y0,V0,Y1,U0; Y2,V2,Y3,U2; Y4,V4,Y5,U5 */ #define IMG_FMT_YVYU 0x55595659 /** Similar to UYVY - but the image is fliped vertically * also is made from lowercase letters ! */ #define IMG_FMT_cyuv 0x76757963 /** Compressed Formats */ #define IMG_FMT_MPEGPES (('M'<<24)|('P'<<16)|('E'<<8)|('S')) #endif // AVIFILE_FORMATS_H avifile-0.7.48~20090503.ds/include/fourcc.h0000644000175000017500000000020007560467706017027 0ustar yavoryavor#ifndef AVIFILE_FOURCC_H #define AVIFILE_FOURCC_H #warning Use #include "avm_fourcc.h" instead #include "avm_fourcc.h" #endif avifile-0.7.48~20090503.ds/include/image.h0000644000175000017500000002520411170700272016617 0ustar yavoryavor#ifndef AVIFILE_IMAGE_H #define AVIFILE_IMAGE_H #include "infotypes.h" #include "formats.h" AVM_BEGIN_NAMESPACE; /** * Class that hides some details of proper BITMAPINFOHEADER * initialization methods. */ class AVMEXPORT BitmapInfo : public BITMAPINFOHEADER { public: uint32_t m_iColors[3]; BitmapInfo(); BitmapInfo(int width, int height, int bpp); BitmapInfo(const BITMAPINFOHEADER & hdr); BitmapInfo(const BitmapInfo & bi); BitmapInfo(const BitmapInfo * bi); static int BitCount(int csp); void SetBitFields15(); // by default SetBits will use BI_RGB & 16bit void SetBitFields16(); // set BGR void SetRGB(); // set top-down BGR image void SetBits(int bits); // set top-down YUV image void SetSpace(int csp); void SetDirection(int dir) { if (biHeight < 0) biHeight = -biHeight; //labs if (!dir) biHeight = -biHeight; } int Bpp() const; bool operator== (const BitmapInfo & bi) const { return (biWidth == bi.biWidth && biHeight == bi.biHeight && Bpp() == bi.Bpp() && (biCompression == bi.biCompression || (IsRGB() && bi.IsRGB()) ) ); } // checks for BGR - used for Windows API compatibility bool IsRGB() const { return biCompression == BI_RGB || biCompression == BI_BITFIELDS; } void Print() const; }; /** * This class describes an uncompressed image in one of several supported * formats. These formats currently include RGB ( 15, 16, 24 and 32 bits ) * and packed YUV ( non-subsampled 24-bit YUV and 16-bit YUY2 formats ). * It is capable of converting between all supported formats. Some of * conversions are optimized, but it is generally not recommended to use * these conversions in time-critical code. */ /** * mplayer compatible surface declaration * used to allow development of common conversion routines */ // for internal usage BGR/RGB,Y | U | V | Alpha #define CIMAGE_MAX_PLANES 4 struct AVMEXPORT ci_surface_t { static const int MAX_AGE = (1 << 30); unsigned int m_iFormat; // fourcc int m_iWidth, m_iHeight; // surface's real width & height struct window_s { int x; int y; int w; int h; } m_Window; // visible area uint8_t* m_pPlane[CIMAGE_MAX_PLANES]; int m_iStride[CIMAGE_MAX_PLANES]; int m_iBpp; // bytes per plane int m_iFlip; // 1 - upside-down -1 downside-up (usually RGB) // mostly private extension - // do not even think about using them now int* m_iQScale; int m_iQStride; int m_iAge; // mainly for ffmpeg int m_iType; // i/p/b frame float m_fAspectRatio; // select area of visible image // the rest of the image will not be converted, transfered,.... void SetWindow(int x = 0, int y = 0, int w = 0, int h = 0); // pointer to start of visible data uint8_t* GetWindow(uint_t idx = 0); const uint8_t* GetWindow(uint_t idx = 0) const; void Age(int age = MAX_AGE) { m_iAge = age; } int GetAge() const { return m_iAge; } }; class IImageAllocator; class AVMEXPORT CImage : public ci_surface_t { public: // Non-conversion constructors /** * Creates new image in format 'header' from specified memory area. * Either allocates its own memory area & copies src data into it, or reuses * parent data. - Note: data can't be specified as void* here to distinguish * different constructors */ CImage(const BitmapInfo* header, const uint8_t* data = 0, bool copy = true); CImage(const BitmapInfo* header, const uint8_t* planes[CIMAGE_MAX_PLANES], const int strides[CIMAGE_MAX_PLANES], bool copy = true); /* Creates 24-bit BGR image from 24-bit BGR 'data' */ CImage(const uint8_t* data, int width, int height); /* Creates a copy of image 'im' */ CImage(const CImage* im); // Conversion constructors /** * Creates converted BGR image with depth or image colorspace * from given image */ CImage(const CImage* im, uint_t csp_bits); /** Creates new image in format 'header' from image 'im' */ CImage(const CImage* im, const BitmapInfo* header); ~CImage(); void AddRef() const { m_iRefcount++; } void Release() const; uint8_t* Data(uint_t idx = 0) { return m_pPlane[idx]; } const uint8_t* Data(uint_t idx = 0) const { return m_pPlane[idx]; } uint_t Stride(uint_t idx = 0) const { return m_iStride[idx]; } // for BGR/RGB images only! uint8_t* At(int i) { return Data() + i * m_iBpl; } const uint8_t* At(int i) const { return Data() + i * m_iBpl; } uint8_t* At(int i, int j) { return Offset(i) + j * m_iBpl; } uint8_t* Offset(int i) { return Data() + i * m_iBpp; } const uint8_t* Offset(int i) const { return Data() + i * m_iBpp; } // returns bytes per the first plane int Bpp() const { return m_iBpp; } // returns bytes per line (width * bpp) int Bpl() const { return m_iBpl; } int Depth() const { return m_iDepth; } fourcc_t Format() const { return m_iFormat; } uint_t Bytes(uint_t idx = 0) const { return m_iBytes[idx]; } int Pixels() const { return m_iPixels; } int Width() const { return m_iWidth; } int Height() const { return m_iHeight; } float Aspect() const { return m_fAspectRatio; } int AspectWidth() const { return (int)(m_fAspectRatio * (float)m_iWidth + 0.5f); } // returns true for upside-down image bool Direction() const { return !(m_pInfo.biHeight < 0); } /** * Is it in format 'hdr'? */ bool IsFmt(const BitmapInfo* hdr) const { return (m_pInfo == *hdr); } BitmapInfo* GetFmt() { return &m_pInfo; } const BitmapInfo* GetFmt() const { return &m_pInfo; } /** * Translations 24-bit RGB <-> Non-subsampled packed 24-bit YUV * ( for image processing purposes ) */ void ToYUV(); void ToRGB(); /** * Fast MMX blur filter ( blur over the square with 2^range*2^range dimensions ) * Blur(x); Blur(y, x) has the same effect as Blur(y) */ void Blur(int range, int from = 0); /** * Writes 24-bit uncompressed bitmap with name 'filename'. */ void Dump(const char *filename); /** * BGR <-> RGB translation for 24-bit images * native format is BGR */ void ByteSwap(); float GetQuality() const { return m_fQuality; } void SetQuality(float q) { m_fQuality = q; } void* GetUserData() const { return m_pUserData; } void SetUserData(void* userData) { m_pUserData = userData; } IImageAllocator* GetAllocator() const { return m_pAllocator; } void SetAllocator(IImageAllocator* pAllocator) { m_pAllocator = pAllocator; } // set image to black color void Clear(); static bool Supported(const BITMAPINFOHEADER& bi); static bool Supported(int csp, int bitcount = 0); // convert some common fourcc to those internaly used // i.e. Y422 -> YUY2, IYUV -> I420 static fourcc_t StandardFOURCC(fourcc_t csp); /** * General way of converting is as follows. * a) There's one function for converting anything to 24-bit RGB and back. * b) There is a number of 'shortcuts' between formats, * e.g. YUY2<->16-bit RGB. * c) If there's no shortcut between particular two formats, the conversion * is done in two steps through temporary image. */ void Convert(const CImage* from_img); void Convert(const uint8_t* from_data, const BitmapInfo* from_fmt); // do not use - it's for internal usage and will be removed! void Slice(const ci_surface_t* ci, int alpha = 0); void Interlaced(CImage* from_img); protected: void fillMembers(); void setPlanes(); mutable int m_iRefcount; BitmapInfo m_pInfo; uint_t m_iBytes[CIMAGE_MAX_PLANES]; int m_iDepth; int m_iBpl; int m_iPixels; float m_fQuality; void* m_pUserData; IImageAllocator* m_pAllocator; bool m_bDataOwner[CIMAGE_MAX_PLANES]; public: uint_t m_uiPosition; // decoded position int64_t m_lTimestamp; // 64bit timestamp (us) private: /* copying disabled */ CImage& operator= (CImage&) { return *this; } CImage(const CImage&) {} }; /** * Interface for Image allocators * * Usually implemented by VideoRenderer and used for DirectRendering support */ class IImageAllocator { public: virtual ~IImageAllocator() {} // number of allocated buffers virtual size_t GetImages() const =0; virtual CImage* ImageAlloc(const BITMAPINFOHEADER& bh, uint_t idx, size_t align) =0; virtual void ReleaseImages() =0; //virtual int ImageResize(int w, int h, uint_t idx) =0; }; struct yuv; struct lookuptable { int m_plY[256]; int m_plRV[256]; int m_plGV[256]; int m_plGU[256]; int m_plBU[256]; lookuptable(); }; /** * Structure that represents 24-bit BGR pixel. */ struct __attribute__((__packed__)) col { static lookuptable t; uint8_t b, g, r; col() {} col(uint8_t B, uint8_t G, uint8_t R) :b(B),g(G),r(R) {} inline col(yuv YUV); int CREF() const { return (int(b) << 16) + (int(g) << 8) + int(r); } uint8_t Y() const { int _Y= (int) (6392l * b + 33055l * g + 16853l * r + 0x8000); return uint8_t((_Y>>16) + 16); } uint16_t bgr15() const { return (uint16_t) (((((((r<<5)&0xff00)|g)<<5)&0xfff00)|b)>>3); } uint16_t bgr16() const { return (uint16_t) (((((((r<<5)&0xff00)|g)<<6)&0xfff00)|b)>>3); } uint32_t bgr32() const { return (uint32_t) ((r<<24) | (g<<16) | b); } }; /** * Structure that represents 24-bit ( 888 ) YUV pixel. */ struct __attribute__((__packed__)) yuv { uint8_t Y; uint8_t Cb;/* aka U */ uint8_t Cr;/* aka V */ yuv() {} yuv(uint8_t _Y, uint8_t _Cb, uint8_t _Cr) :Y(_Y), Cb(_Cb), Cr(_Cr) {} yuv(col Col) { int _Y = ((25*Col.b + 129*Col.g + 66*Col.r) >> 8) + 0x10; if (_Y < 0x10) _Y = 0x10; else if (_Y > 0xef) _Y = 0xef; Y = (uint8_t)_Y; int _Cb = ((112*Col.b -74*Col.g -38*Col.r) >> 8) + 0x80; if (_Cb < 0x10) _Cb = 0x10; else if (_Cb > 0xef) _Cb = 0xef; Cb = (uint8_t)_Cb; int _Cr = ((-18*Col.b -94*Col.g + 112*Col.r) >> 8) + 0x80; if (_Cr < 0x10) _Cr = 0x10; else if (_Cr > 0xef) _Cr = 0xef; Cr =(uint8_t)_Cr; } }; inline col::col(yuv YUV) { int y = t.m_plY[YUV.Y]; int B = (y + t.m_plBU[YUV.Cb]) >> 8; if (B < 0) B = 0; else if (B > 0xff) B = 0xff; b = (uint8_t)B; int G = (y + t.m_plGU[YUV.Cb] + t.m_plGV[YUV.Cr]) >> 8; if (G < 0) G = 0; else if (G > 0xff) G = 0xff; g = (uint8_t)G; int R = (y + t.m_plRV[YUV.Cr]) >> 8; if (R < 0) R = 0; else if (R > 0xff) R = 0xff; r = (uint8_t)R; } AVM_END_NAMESPACE; #ifdef AVM_COMPATIBLE typedef avm::CImage CImage; typedef avm::BitmapInfo BitmapInfo; typedef avm::yuv yuv; typedef avm::col col; #endif #endif // AVIFILE_IMAGE_H avifile-0.7.48~20090503.ds/include/infotypes.h0000644000175000017500000002075411174446643017577 0ustar yavoryavor#ifndef AVIFILE_INFOTYPES_H #define AVIFILE_INFOTYPES_H #include "StreamInfo.h" #include "formats.h" AVM_BEGIN_NAMESPACE; /** * Base class for other infotype classes */ class AVMEXPORT BaseInfo { public: BaseInfo(); BaseInfo(const char* _name, const char* _about); ~BaseInfo(); const char* GetName() const { return name.c_str(); } const char* GetAbout() const { return about.c_str(); } protected: /// \internal unique name. avm::string name; /// \internal text description. avm::string about; }; /** Describes the attibutes of decoder or encoder. */ struct AVMEXPORT AttributeInfo : public BaseInfo { enum Kind { /// integer either limited by i_min and i_max (if i_min < i_max), or unlimited. Integer, /// any string value, such as registration code. String, /// value can have one of several string values from 'options'. Select, /// floating point number limited by i_min and i_max (if i_min < i_max), or unlimited. Float }; Kind kind; union { float f_min; int i_min; }; union { float f_max; int i_max; }; union { float f_default; int i_default; }; avm::vector options; AttributeInfo(); /** * Constructor for Select-type attribute * \param name of the attribute * \param about the attribute * \param options for this attribute * \param defitem default item from the list */ AttributeInfo(const char* name, const char* about, const char* const* options, int defitem = 0); /** * Generic constructor for Integer-type attribute * \param name of the attribute * \param about the attribute * \param kind sets type of this attribute * \param minval set lower bound for the Integer-type attribute * \param maxval set upper bound for the Integer-type attribute * is maxval < minval value is unlimited * \param defval use as default value for this attribute */ AttributeInfo(const char* name, const char* about = 0, Kind kind = Integer, int minval = 0, int maxval = -1, int defval = -1); /** * double type constructor */ AttributeInfo(const char* name, const char* about, float defval, float minval = 0.f, float maxval = -1.f); /** \internal */ ~AttributeInfo(); float GetDefaultFloat() const { return f_default; } int GetDefault() const { return i_default; } /** * \retval minimum for integer attribute */ Kind GetKind() const { return kind; } float GetMinFloat() const { return f_min; } float GetMaxFloat() const { return f_max; } int GetMin() const { return i_min; } int GetMax() const { return i_max; } const avm::vector& GetOptions() const { return options; } // the following names might change - do not use for bool IsAttr(const char* attribute) const; bool IsValid(int value) const { switch (GetKind()) { case Integer: case Select: if (GetMin() < GetMax() && (value < GetMin() || value > GetMax())) return false; break; case Float: if (GetMinFloat() < GetMaxFloat() && (value < GetMinFloat() || value > GetMaxFloat())) return false; break; default: break; } return true; } bool IsValid(float value) const { switch (GetKind()) { case Integer: case Select: if (GetMin() < GetMax() && (value < GetMin() || value > GetMax())) return false; break; case Float: if (GetMinFloat() < GetMaxFloat() && (value < GetMinFloat() || value > GetMaxFloat())) return false; break; default: break; } return true; } }; /** * Structure describes audio/video codec, registered in the system. */ struct PluginPrivate; struct AVMEXPORT CodecInfo : public BaseInfo { static const fourcc_t FFMPEG = ('F' << 24) | ('F' << 16) | ('f' << 8) | 'f'; static const GUID FFMPEG_GUID; enum Kind { Source = 0, Plugin, Win32, Win32Ex, DShow_Dec, DMO }; enum Media { Audio, Video }; enum Direction { Encode = 1, Decode = 2, Both = 3 }; /* * Fields that loader expects to be filled by plugin */ /// Default fourcc for this codec. fourcc_t fourcc; /// Fourcc's handled by this codec. avm::vector fourcc_array; /** * private name of the codec * globally unique! i.e. there should be at most one CodecInfo in audio * and one CodecInfo in video for a given private name on any system * assigned to the codec by avifile ( or mplayer ) developers ;^) */ avm::string privatename; /** * Source - structure describes codec that is implemented as * a part of library. All other values in this field are ignored * by the library and can be used within plugins. */ Kind kind; Media media; Direction direction; /* * These fields contain custom data that may be needed by plugin. * They will be ignored by loader. */ GUID guid; // CLSID ( only needed by DirectShow codecs + Vorbis ). avm::string dll; // Win32 DLL/ffmpeg name. avm::vector decoder_info; // acceptable attrs for decoder. avm::vector encoder_info; // acceptable attrs for encoder. CodecInfo(); ~CodecInfo(); CodecInfo(const fourcc_t* array, const char* info, const char* path, const char* about, Kind _kind, const char* privname, Media _media = Video, Direction _direction = Both, const GUID* id = 0, const avm::vector& ei = avm::vector(), const avm::vector& di = avm::vector()); CodecInfo(const CodecInfo& ci); CodecInfo& operator=(const CodecInfo&); bool operator==(const CodecInfo& v) const { return (this==&v); } const char* GetPrivateName() const { return privatename.c_str(); } /** * Tries to find given attribute * \param attr name of the searched attribute * \param dir seach in either decoder or encoder set of attributes or both * \retval Attribute */ const AttributeInfo* FindAttribute(const char* attr, Direction dir = Both) const; // // Searches for codec matching given fourcc, returns NULL if there's no match. // static const CodecInfo* match(fourcc_t codec, Media media=Video, const CodecInfo* start=0, Direction direction=Both); static const CodecInfo* match(Media media, const char* privname); static const fourcc_t ANY = 0x414e5920; // as any type // use this method to receive all CodecInfos for given media, // direction and fourcc static void Get(avm::vector&, Media media = Video, Direction direction = Decode, fourcc_t fcc = ANY); // // These two fields will be filled by plugin loader. // avm::string modulename; mutable PluginPrivate* handle; }; struct AVMEXPORT VideoEncoderInfo { fourcc_t compressor;// codec's FourCC avm::string cname; // more precise specification of the codec BITMAPINFOHEADER header; #ifdef AVM_COMPATIBLE int quality; // these are ignored int keyfreq; // use only codec properties #endif }; /** * Interface for runtime configuration of selected Integer attributes */ class AVMEXPORT IRtConfig { public: virtual ~IRtConfig(); /** * Returns vector with list of supported attributes */ virtual const avm::vector& GetAttrs() const { return m_Attrs; } /** * Get value for value for a given attribute name * Returns 0 - success, -1 - failure */ virtual int GetValue(const char* attr, int* value) const =0; /** * Sets value for a given attribute name * Returns 0 - success, -1 - failure */ virtual int SetValue(const char* attr, int value) =0; protected: avm::vector m_Attrs; }; struct AVMEXPORT Mp3AudioInfo { enum MPEG_MODE { MPEG1 = 0, MPEG2, ERR, MPEG2_5 } mode; enum STEREO_MODE { STEREO = 0, JSTEREO, DUAL_CHANNEL, MODE_MONO } stereo_mode; uint_t xing; uint_t layer; uint_t bitrate; uint_t start_offset; uint_t sample_rate; uint_t samples_per_frame; uint_t num_channels; uint_t frame_size; uint_t header; Mp3AudioInfo(); int Init(const void* buf, int fast = 0); int GetBitrate() const; int GetFrameSize() const; void PrintHeader() const; }; AVM_END_NAMESPACE; // use CodecInfo::Get() instead // usage of these two vectors is obsoleted extern AVMEXPORT avm::vector video_codecs; extern AVMEXPORT avm::vector audio_codecs; #endif // AVIFILE_INFOTYPES_H avifile-0.7.48~20090503.ds/include/mmx.h0000644000175000017500000000166007326777251016361 0ustar yavoryavor#ifndef AVIFILE_MMX_H #define AVIFILE_MMX_H /******************************************************** * * Miscellaneous MMX-accelerated routines * Copyright 2000 Eugene Kuznetsov (divx@euro.ru) * ********************************************************/ // generic scaling function for 16, 24 or 32 bit data void zoom(uint16_t* dest, const uint16_t* src, int dst_w, int dst_h, int src_w, int src_h, int bpp, int xdim=0); // converter from 555 to 565 color depth extern void (*v555to565)(uint16_t* dest, const uint16_t* src, int w, int h); // fast scaler by-2 ( e.g. 640x480->320x240 ) for 16-bit colors */ extern void (*zoom_2_16)(uint16_t* dest, const uint16_t* src, int w, int h); // scaler & converter extern void (*zoom_2_16_to565)(uint16_t *dest, const uint16_t* src, int w, int h); // scaler by-2 for 32-bit colors extern void (*zoom_2_32)(uint32_t* dest, const uint32_t* src, int w, int h); #endif // AVIFILE_MMX_H avifile-0.7.48~20090503.ds/include/playerwidget.h0000644000175000017500000000530110315567562020246 0ustar yavoryavor#ifndef AVIFILE_PLAYERWIDGET_H #define AVIFILE_PLAYERWIDGET_H /** * Implement this interface if you wish to manually handle * playback-controlling events that come from movie window * of IAviPlayer2 object. For example, you might want * some kind of configuration popup menu ( implemented * with your favorite widget toolkit ) to show up when * user right-clicks in the movie window. You'll have to * put the code for creation of popup menu into implementation * of PW_menu_slot(). * Members of this interface will be called from within movie * window event thread. **/ AVM_BEGIN_NAMESPACE; class IPlayerWidget { public: enum Action { // key actions A_QUIT = 5555, // window actions A_RESIZE, A_REFRESH, // mouse actions A_MOUSE_LEFT, A_MOUSE_MIDDLE, A_MOUSE_RIGHT, A_MOUSE_WHEEL_UP, A_MOUSE_WHEEL_DOWN }; // status of keyboard or other potentical modifiers enum Mod { M_NONE = 0x0000, M_LSHIFT= 0x0001, M_RSHIFT= 0x0002, M_LCTRL = 0x0040, M_RCTRL = 0x0080, M_LALT = 0x0100, M_RALT = 0x0200, M_LMETA = 0x0400, M_RMETA = 0x0800, M_NUM = 0x1000, M_CAPS = 0x2000, M_MODE = 0x4000, M_PRESSED = 0x8000, M_CTRL = M_LCTRL | M_RCTRL, M_SHIFT = M_LSHIFT | M_RSHIFT, M_ALT = M_LALT | M_RALT, M_META = M_LMETA | M_RMETA }; // will be removed virtual ~IPlayerWidget() {} /* Unused */ virtual void PW_showconf_func() {}; /* Middle button click. Default action: switch zoom 0.5x->1x->2x */ virtual void PW_middle_button() {}; /* Key 'x' pressed. Default action: stop playback. */ virtual void PW_stop_func() {}; /* Key 'c' pressed. Default action: pause/resume playback. */ virtual void PW_pause_func() {}; /* Key 'v' pressed. Default action: start playback after stop or pause. */ virtual void PW_play_func() {}; /* Key 'q' pressed. Default action: do nothing. */ virtual void PW_quit_func() {}; /* Right button click. Default action: do nothing. */ virtual void PW_menu_slot() {}; /* 'Esc' or 'Alt+Enter' pressed. Default action: toggle fullscreen mode. */ virtual void PW_fullscreen() {}; /* Movie window is resized with mouse. Default action: resize picture. */ virtual void PW_maximize_func() {}; virtual void PW_resize(int w, int h) {}; virtual void PW_refresh() {}; virtual void PW_key_func(int sym, int mod) {}; // or maybe use some Event structure with timestamps... //virtual void action(Action act, Mod mod, // int arg1, int arg2, int arg3, int arg4) {}; }; AVM_END_NAMESPACE; typedef avm::IPlayerWidget PlayerWidget; #endif // AVIFILE_PLAYERWIDGET_H avifile-0.7.48~20090503.ds/include/plugin.h0000644000175000017500000000736011106424737017046 0ustar yavoryavor#ifndef AVIFILE_PLUGIN_H #define AVIFILE_PLUGIN_H #include "infotypes.h" #include "formats.h" /* this is internal header for avifile */ #define PLUGIN_API_VERSION 30318 #define PLUGIN_TEMP(name) \ extern "C" avm::codec_plugin_t avm_codec_plugin_ ## name ; \ \ static void name ## _error_set (const char* s, ...) \ { \ if (avm_codec_plugin_ ## name .error) \ free(avm_codec_plugin_ ## name .error); \ if (s) { \ va_list va; \ va_start(va, s); \ avm_codec_plugin_ ## name .error = (char*) malloc(1024); \ strcpy(avm_codec_plugin_ ## name .error, #name);\ size_t l = strlen(avm_codec_plugin_ ## name .error); \ avm_codec_plugin_ ## name .error[l++] = ' '; \ vsprintf(avm_codec_plugin_ ## name .error + l, s, va); \ va_end(va); \ } else \ avm_codec_plugin_ ## name .error = 0; \ } AVM_BEGIN_NAMESPACE; class IAudioEncoder; class IAudioDecoder; class IVideoEncoder; class IVideoDecoder; /* * these are some commonly usable functions for avifile plugins * userspace apps are using CodecGet/SetAttrInt */ AVMEXPORT int PluginGetAttrFloat(const CodecInfo& info, const char* attribute, float* value); AVMEXPORT int PluginSetAttrFloat(const CodecInfo& info, const char* attribute, float value); AVMEXPORT int PluginGetAttrInt(const CodecInfo& info, const char* attribute, int* value); AVMEXPORT int PluginSetAttrInt(const CodecInfo& info, const char* attribute, int value); AVMEXPORT int PluginGetAttrString(const CodecInfo& info, const char* attribute, const char** value); AVMEXPORT int PluginSetAttrString(const CodecInfo& info, const char* attribute, const char* value); /* * This library is capable of using external ELF plugins for audio/video * (de)compression. This document describes the interface of such plugin. * Each plugin provides named structure equals to plugin name * with function table * * * This is private header for avifile project - user program is not * supposed to use this proprietary interface */ typedef struct { /* * Value identifies date of the last change in its API. For example, * value 10120 corresponds to January 20, 2001. */ int version; char* error; // last error /* * Names of attributes and their acceptable values can be found out from * CodecInfo structure. */ int (*get_attr_float)(const CodecInfo& info, const char* attribute, float* value); int (*set_attr_float)(const CodecInfo& info, const char* attribute, float value); int (*get_attr_int)(const CodecInfo& info, const char* attribute, int* value); int (*set_attr_int)(const CodecInfo& info, const char* attribute, int value); int (*get_attr_string)(const CodecInfo& info, const char* attribute, const char** value); int (*set_attr_string)(const CodecInfo& info, const char* attribute, const char* value); /* * which is used by the library to register formats supported by * this plugin. This function returns reference to array of CodecInfo * objects. Each of them refers to one supported format. See declaration * of CodecInfo type ( include/infotypes.h ) for details. * * When plugin supports decoding of at least one video format, it provides * function */ void (*register_codecs)(avm::vector& codecs); IAudioDecoder* (*audio_decoder)(const CodecInfo& info, const WAVEFORMATEX* format); IAudioEncoder* (*audio_encoder)(const CodecInfo& info, fourcc_t compressor, const WAVEFORMATEX* fmt); IVideoDecoder* (*video_decoder)(const CodecInfo& info, const BITMAPINFOHEADER& bh, int flip); IVideoEncoder* (*video_encoder)(const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& bh); } codec_plugin_t; struct PluginPrivate { void* dlhandle; void* fchandle; int refcount; }; AVM_END_NAMESPACE; #endif // AVIFILE_PLUGIN_H avifile-0.7.48~20090503.ds/include/renderer.h0000644000175000017500000001374711164471524017364 0ustar yavoryavor#ifndef AVIFILE_RENDERER_H #define AVIFILE_RENDERER_H #include "avm_stl.h" #include "image.h" #include "subtitle.h" AVM_BEGIN_NAMESPACE; class IPlayerWidget; /** Structure for describtion of video mode */ struct VideoMode { /// width of the screen int width; /// height of the screen int height; /// vertical refresh frequency float freq; /// textual representation for this mode avm::string name; VideoMode(int w = 0, int h = 0, float f = 0.); }; /** * Abstract interface for video rendering * * One day we may support more renderers * We do not want to have any XFree specific stuff here */ class IVideoRenderer : public IImageAllocator { public: enum Property { SYNC, REFRESH, FULLSCREEN, // true - maximize with FULLSCREEN toggle DRAW_CIMAGE, // CImage* DRAW_SUBTITLES, WINDOW_SIZE = 100, // int* width, int* height WINDOW_POSITION, // get*/set int* x, int* y WINDOW_CAPTION, // char* SUBTITLE_FONT, // char* SUBTITLE_POSITION, // get*/set int* y SUBTITLE_VISIBLE, VIDEO_MODES, // avm::vector - list of video modes VIDEO_OVERLAYS, // avm::vector - list of overlay LAST }; enum Cursor { NORMAL, ZOOMLU, ZOOMRB }; /** * Allow YUV renderer to use software YUV->RGB conversion * ( slow, only for testing purposes ) * SDL has very fast implementation - used now */ static bool allow_sw_yuv; virtual ~IVideoRenderer() {} // possible new interface??? virtual int Set(...) = 0; virtual int Get(...) const = 0; #if 1 /** * Issues the request to draw the image in the window memory * might be empty when direct rendering is being used */ virtual int Draw(const CImage* data) = 0; /** * Draws a line of subtitles below the picture. */ virtual int DrawSubtitles(const subtitle_line_t* sl) { return -1; } /** * Returns actual size of the rendered image */ virtual int GetSize(int& width, int& height) const { return -1; } /** * Returns actual x, y coordinates of the window. */ virtual int GetPosition(int& x, int& y) const { return -1; } /** * Returns available video modes */ virtual const avm::vector& GetVideoModes() const = 0; /** * Returns runtime configurable parameters */ virtual IRtConfig* GetRtConfig() const { return 0; } /** * Called to blit image on the screen */ virtual int Sync() = 0; /** * Redraws image (resize, move with pause) */ virtual int Refresh() = 0; /** * Resizes renderer window and stretch the image in it. */ virtual int Resize(int& new_w, int& new_h) { return -1; } /** * Set window titlebar * \param title window title name * \param icon pathname to icon of the window */ virtual int SetCaption(const char* title, const char* icon) { return -1; } /** * Set font for subtitle */ virtual int SetFont(const char* font) { return -1; } /** * Set window position * \param x coordinate * \param y coordinate */ virtual int SetPosition(int x, int y) { return -1; } /** * Toggle on/off fullscreen mode. maximize=true means that * renderer should stretch the picture to dimensions of * screen when going fullscreen without changing screen mode. */ virtual int ToggleFullscreen(bool maximize = false) { return -1; } /** * Pick area in the image which is displayed in the given window * \param x coordinate for the begining of zoomed area * \param y coordinate for the begining of zoomed area * \param width width of zoomed area (0 disables zooming) * \param height height of zoomed area (0 disables zooming) */ virtual int Zoom(int x, int y, int width, int height) { return -1; } virtual int SetCursor(Cursor cursor) { return -1; } #endif virtual int Lock() const = 0; virtual int TryLock() const = 0; virtual int Unlock() const = 0; }; #ifndef X_DISPLAY_MISSING /** * Creates SDL video renderer for RGB data in current depth of * display from 2nd argument. Last argument specifies whether * this renderer should reserve place for subtitles or not. */ AVMEXPORT IVideoRenderer* CreateFullscreenRenderer(IPlayerWidget*, void* dpy, int width, int height, bool sub = false); /** * Creates SDL video renderer for YUV data in format yuv_fmt. * If it fails ( e.g. because yuv_fmt is not supported by X server * and VideoRenderer::allow_sw_yuv==false ), returns pointer to * 'ordinary' fullscreen renderer and puts 0 into yuv_fmt. */ AVMEXPORT IVideoRenderer* CreateYUVRenderer(IPlayerWidget*, void* dpy, int width, int height, fourcc_t yuv_fmt, bool sub = false); /* VideoRenderer* CreateXvYUVRenderer(PlayerWidget*, void* dpy, int width, int height, fourcc_t yuv_fmt, bool sub = false); */ /** * Function that returns actual bit depth of specified X display. * Should be used instead of any other functions with similar * purpose ( DefaultDepth(), x11Depth() in Qt ) when determining * bit depth of data to pass to renderer. */ AVMEXPORT int GetPhysicalDepth(void* dpy); #else static inline int GetPhysicalDepth(void* dpy) { return 0; } #endif // X_DISPLAY_MISSING AVM_END_NAMESPACE; #ifdef AVM_COMPATIBLE typedef avm::VideoMode VideoMode; typedef avm::IVideoRenderer VideoRenderer; #ifndef X_DISPLAY_MISSING static inline VideoRenderer* CreateFullscreenRenderer(avm::IPlayerWidget* pw, void* dpy, int width, int height, bool sub = false) { return avm::CreateFullscreenRenderer(pw, dpy, width, height, sub); } static inline VideoRenderer* CreateYUVRenderer(avm::IPlayerWidget* pw, void* dpy, int width, int height, fourcc_t yuv_fmt, bool sub = false) { return avm::CreateYUVRenderer(pw, dpy, width, height, yuv_fmt, sub); } #endif // X_DISPLAY_MISSING static inline int GetPhysicalDepth(void* dpy) { return avm::GetPhysicalDepth(dpy); } #endif // AVM_COMPATIBLE #endif // AVIFILE_RENDERER_H avifile-0.7.48~20090503.ds/include/subtitle.h0000644000175000017500000000740711177255137017411 0ustar yavoryavor#ifndef AVIFILE_SUBTITLE_H #define AVIFILE_SUBTITLE_H /** * subtitle is plain C library - usable outside of avifile * * All subtitle lines are internally stored in UTF-8 format * (iconv is used for conversion and must be present for this) */ /** Maximum supported number of lines which may compose one subtitle */ #define SUBTITLE_MAX_LINES 5 #if defined(__cplusplus) extern "C" { #endif /** * Types of recognized subtitles * with a short example of such subtitle line */ typedef struct __subtitles_s subtitles_t; typedef enum { /** \internal */ SUBTITLE_UNSELECTED, /** * .SUB * {123}{345} text */ SUBTITLE_MICRODVD, /** * .SRT * 123 * 1:23:55.125 --> 1:24:00.275 */ SUBTITLE_SUBRIP, /** * 1:23:55 * text */ SUBTITLE_VPLAYER, SUBTITLE_AQT, SUBTITLE_SAMI, /** * 1:23:55.125,1:24:00.275 * text */ SUBTITLE_SUBVIEWER, SUBTITLE_MPSUB, /* mplayer's format of subtitles */ SUBTITLE_LAST } subtitle_t; typedef struct subtitle_line_t { /** how many text lines are in this subtitle element */ unsigned int lines; /** starting time for display (time in 1/1000s = 1ms) */ unsigned int start; /** ending time for display (time in 1/1000s = 1ms) */ unsigned int end; /** pointers to individual subtitle lines */ char* line[SUBTITLE_MAX_LINES]; } subtitle_line_t; /** * tries to open subtitle for the given filename * \returns file descriptor */ int subtitle_filename(const char* filename, char** opened_filename); /** * Opens subtiles from a given filename * * \param fd file descriptor with opened file with subtitles * \param fps frame per seconds (needed for some subtitles types * \param codepage when NULL default system codepage is used */ subtitles_t* subtitle_open(int fd, double fps, const char* codepage); /** * Closes and destroys array of subtitles * \param subset array of subtitles for freeing * * \warning after calling this function the subset array could no longer * be accessed as all the memory allocated by this structure has been * released */ void subtitle_close(subtitles_t* subs); void subtitle_set_fps(subtitles_t*, double fps); /** Returns number of lines in the subtitle array */ unsigned int subtitle_get_lines(subtitles_t*); /** Returns type of subtitles */ subtitle_t subtitle_get_type(subtitles_t*, const char**); /** * Copies subtitle into given subtitle_line_t pointer * It will check first if the line isn't already copied * returns true if subtitle is found */ int subtitle_get(subtitle_line_t*, subtitles_t*, double timepos); /** * Check if two subtitles are equal * checking linecount & start,end pos (text is not being compared!) */ int subtitle_line_equals(const subtitle_line_t*, const subtitle_line_t*); /** creates new empty subtitle line */ subtitle_line_t* subtitle_line_new(void); /** duplicates one subtitle line */ subtitle_line_t* subtitle_line_copy(const subtitle_line_t*); /** free allocated subtitle line (obtained with subtitle_line_copy) */ void subtitle_line_free(subtitle_line_t*); /** * write subtitles to file */ int subtitle_write(const subtitles_t* st, const char* filename, subtitle_t type); /* might be implemented later write update insert delete */ /* * private structure currently kept here */ struct __subtitles_s { /* * never accessed directly * use suplied functions to manipulate subtitle array */ int fd; subtitle_t type; unsigned int allocated; unsigned int count; int frame_based; /* if subtitles use frame number */ int time_diff; double fps; char* encoding; /* original encoding */ char* out_encoding; /* for write */ subtitle_line_t* subtitle; }; #if defined(__cplusplus) } #endif #endif // AVIFILE_SUBTITLE_H avifile-0.7.48~20090503.ds/include/utils.h0000644000175000017500000001002711177255220016677 0ustar yavoryavor#ifndef AVIFILE_UTILS_H #define AVIFILE_UTILS_H #include "avm_default.h" #include "formats.h" /** * Utility functions. * plain C functions are here */ AVM_BEGIN_EXTERN_C; /** * retriew current time in microseconds * \returns time in microsecond units */ AVMEXPORT int64_t avm_get_time_us(void); /** * callculate diff between 2 times - * \returns time difference in seconds */ static inline float avm_get_time_diff(int64_t t1, int64_t t2) { return (float)(t1 - t2) * 0.000001f; } /* * function to retrieve/store data in machine independent format * - right now dumb implementation - as we could check functionality */ static inline uint16_t avm_get_le16(const void* p) { #ifdef WORDS_BIGENDIAN const uint8_t* c = (const uint8_t*) p; return c[0] | c[1] << 8; #else return *(const uint16_t*)p; #endif } static inline uint8_t* avm_set_le16(void* p, uint16_t v) { uint8_t* b = (uint8_t*) p; #ifdef WORDS_BIGENDIAN b[0] = (uint8_t)v; b[1] = (uint8_t)(v >> 8); #else *(uint16_t*)p = v; #endif return b; } static inline uint32_t avm_get_le32(const void* p) { #ifdef WORDS_BIGENDIAN const uint8_t* c = (const uint8_t*) p; return c[0] | c[1] << 8 | c[2] << 16 | c[3] << 24; #else return *(const uint32_t*)p; #endif } static inline uint8_t* avm_set_le32(void* p, uint32_t v) { uint8_t* b = (uint8_t*) p; #ifdef WORDS_BIGENDIAN b[0] = (uint8_t)v; b[1] = (uint8_t)(v >> 8); b[2] = (uint8_t)(v >> 16); b[3] = (uint8_t)(v >> 24); #else *(uint32_t*)p = v; #endif return b; } static inline uint64_t avm_get_le64(const void* p) { #ifdef WORDS_BIGENDIAN const uint8_t* c = (const uint8_t*) p; return avm_get_le32(c) | (((uint64_t)avm_get_le32(c + 4)) << 32); #else return *(const uint64_t*)p; #endif } static inline uint16_t avm_get_be16(const void* p) { #ifdef WORDS_BIGENDIAN return *(const uint16_t*)p; #else const uint8_t* c = (const uint8_t*) p; return (uint16_t) (c[0] << 8 | c[1]); #endif } static inline uint8_t* avm_set_be16(void* p, uint16_t v) { #ifdef WORDS_BIGENDIAN *(uint16_t*)p = v; #else uint8_t* b = (uint8_t*) p; b[0] = (uint8_t)(v >> 8); b[1] = (uint8_t)v; return b; #endif } static inline uint32_t avm_get_be32(const void* p) { #ifdef WORDS_BIGENDIAN return *(const uint32_t*)p; #else const uint8_t* c = (const uint8_t*) p; return (uint32_t)(c[0] << 24 | c[1] << 16 | c[2] << 8 | c[3]); #endif } static inline uint8_t* avm_set_be32(void* p, uint32_t v) { #ifdef WORDS_BIGENDIAN *(uint32_t*)p = v; #else uint8_t* b = (uint8_t*) p; b[0] = (uint8_t)(v >> 24); b[1] = (uint8_t)(v >> 16); b[2] = (uint8_t)(v >> 8); b[3] = (uint8_t)v; return b; #endif } static inline uint64_t avm_get_be64(const void* p) { #ifdef WORDS_BIGENDIAN return *(const uint64_t*)p; #else const uint8_t* c = (const uint8_t*) p; return ((uint64_t) avm_get_be32(c)) << 32 | avm_get_le32(c + 4); #endif } static inline int avm_img_is_rgb(fourcc_t fmt) { return ((fmt & 0xffffff00) == IMG_FMT_RGB); } static inline int avm_img_is_bgr(fourcc_t fmt) { return ((fmt & 0xffffff00) == IMG_FMT_BGR); } static inline int avm_img_get_depth(fourcc_t fmt) { return fmt & 0xff; } AVMEXPORT WAVEFORMATEX* avm_get_leWAVEFORMATEX(void* waveformat); AVMEXPORT BITMAPINFOHEADER* avm_get_leBITMAPINFOHEADER(void* bitmapinfoheader); AVMEXPORT GUID* avm_get_leGUID(void* guid); AVMEXPORT const char* avm_fcc_name(fourcc_t fcc); AVMEXPORT const char* avm_wave_format_name(short fmt); /* not sure - might be special type */ AVMEXPORT const char* avm_img_format_name(fourcc_t fmt); AVMEXPORT char* avm_wave_format(char* buf, size_t, const WAVEFORMATEX*); AVMEXPORT char* avm_mp3wave_format(char* buf, size_t, const MPEGLAYER3WAVEFORMAT*); /* wrapping functions */ /* A thread-save usec sleep */ AVMEXPORT int avm_usleep(unsigned long); /* some system doesn't have setenv/unsetenv */ AVMEXPORT int avm_setenv(const char *name, const char *value, int overwrite); AVMEXPORT void avm_unsetenv(const char *name); AVM_END_EXTERN_C; #endif /* AVIFILE_UTILS_H */ avifile-0.7.48~20090503.ds/include/vbrctrl.h0000644000175000017500000000210207515743774017231 0ustar yavoryavor#ifndef VBRCRTL_H #define VBRCRTL_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** * for internal usage only! */ //private strutures struct vbrctrl_s; typedef struct vbrctrl_s vbrctrl_t; // cripsness is ignored at this moment vbrctrl_t* vbrctrl_init_1pass(int quality, int crispness); vbrctrl_t* vbrctrl_init_2pass_analysis(const char* filename, int quality, int crispness); vbrctrl_t* vbrctrl_init_2pass_encoding(const char* filename, int bitrate, double framerate, int quality, int crispness); void vbrctrl_close(vbrctrl_t*); void vbrctrl_update_1pass(vbrctrl_t*); void vbrctrl_update_2pass_analysis(vbrctrl_t*, int is_key_frame, int motion_bits, int texture_bits, int total_bits, int quant); void vbrctrl_update_2pass_encoding(vbrctrl_t*, int motion_bits, int texture_bits, int total_bits); int vbrctrl_get_drop(vbrctrl_t*); int vbrctrl_get_intra(vbrctrl_t*); int vbrctrl_get_quant(vbrctrl_t*); void vbrctrl_set_quant(vbrctrl_t*, float q); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* VBRCRTL_H */ avifile-0.7.48~20090503.ds/include/version.h.in0000644000175000017500000000052307606644667017654 0ustar yavoryavor#ifndef AVIFILE_VERSION #define AVIFILE_MAJOR_VERSION @AVIFILE_MAJOR_VERSION@ #define AVIFILE_MINOR_VERSION @AVIFILE_MINOR_VERSION@ #define AVIFILE_PATCHLEVEL @AVIFILE_MICRO_VERSION@ #define AVIFILE_VERSION ((AVIFILE_MAJOR_VERSION << 16) + (AVIFILE_MINOR_VERSION << 8) + AVIFILE_PATCHLEVEL) #define AVIFILE_BUILD "@AVIFILE_BUILD@" #endif avifile-0.7.48~20090503.ds/include/videodecoder.h0000644000175000017500000001227711170321573020202 0ustar yavoryavor#ifndef AVIFILE_IVIDEODECODER_H #define AVIFILE_IVIDEODECODER_H #include "infotypes.h" #include "image.h" AVM_BEGIN_NAMESPACE; /** * * Class for video decompression. * * Usage: * * IVideoDecoder::Create() call tries to load video codec * corresponding to your format, * Start() starts decompression and Stop() stops it. * * SetDestFmt() sets desired bit depth and color space of output picture. * Returns zero on success, -1 if format is unsupported and * +1 if there was no 'native' support for the depth and library * is going to perform internal conversion of format. Most decoders * support depths 15, 16, 24 or 32. Many of them also allow to use some * YUV formats. You can check if your particular decoder is able to decode * into the particular YUV format by calling GetCapabilities(), * which returns bitwise OR of supported formats. * * DecodeFrame() decodes a single frame. Returns >=0 on success, * of <0 on failure (it is not fatal ( maybe it was * just one defective bit in file, after next keyframe everything * will be OK ). * * SetDirection() allows to 'flip' output picture. By default picture * is flipped ( DestFmt().biHeight<0 ), so that output image can * be simply memcpy()'ed to the X screen. It should be turned on * if image will be used for recompression, because some video encoders * will refuse to encode images with negative biHeight. Call it before * Start(). * * Some decoders allow tweaking of their parameters. There are two ways * of doing it. 1) Use Get/SetExtendedAttr() to store parameter values * in registry. Decoders read these values during Start(), so you should * perform Restart() if you need to change parameters in run-time. * * There's more convenient way, which is supported by a few DirectShow * codecs. If GetRtConfig() returns nonzero, you can * use IRtConfig methods to adjust picture properties between Start() and * Stop(). These adjustments are applied from the first frame following * method call. * * List of valid parameters is available IRtConfig::GetCodecInfo().decoder_info. * See include/infotypes.h for details on accessing it. * */ class AVMEXPORT IVideoDecoder { public: /** * internaly used flag to mark that decoder * has not produced new picture from given data */ static const int NO_PICTURE = 0x40000000; static const int NEXT_PICTURE = 0x20000000; enum CAPS { CAP_NONE = 0, // packed CAP_IYUV = 1, CAP_YUY2 = 2, CAP_UYVY = 4, CAP_YVYU = 8, // planar CAP_YV12 = 128, CAP_I420 = 256, CAP_YVU9 = 512, // for DR1 rendering this align is needed // this also mean codec will properly handle strides // IT'S FOR PRIVATE USAGE and will be changed CAP_ALIGN64 = 1 << 30, CAP_ALIGN16 = 1 << 31 }; IVideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& format); virtual ~IVideoDecoder(); /* Functions which may be reimplemented */ /** * Codec's currently selected destination format */ virtual const BITMAPINFOHEADER& GetDestFmt() const; /** * Capability flags for this codec */ virtual CAPS GetCapabilities() const; virtual const CodecInfo& GetCodecInfo() const; /** * Use this method instead of dynamic_cast - some gcc compilers * (even the new ones seems to have some serious problems with that) */ virtual IRtConfig* GetRtConfig(); // can't be const virtual void Flush(); // call after seek virtual int Restart(); virtual int SetDirection(int dir); virtual int Start(); virtual int Stop(); /* Functions which must be implemented by each decoder */ /** * Passes the data to decoder. * 'render' flag signals decoder if the frame will be rendered. * If it is 'false', decoder may speed up the decoding process * by not filling CImage object. This feature is available only * for a few decoders, such as Indeo Video 5.0. * also it will be faster with ffmpeg decoder * * dest - points to memory area (size respects BITMAPINFOHEADER.biSize) * src - source of bitstream data * size - size of bitstream data * is_keyframe - flag to make visible to decoder that this is keyframe * most new decoders will decide this from content * of bitstream - but for some older codecs this * flags is necessary * returns <0 if some error appears * INTERNAL flags: * | NO_PICTURE - no picture was generated * | NEXT_PICTURE - another picture is needed * when picture is generated codec might actually return it * in differenet locations (out != 0) */ virtual int DecodeFrame(CImage* dest, const void* src, size_t size, int is_keyframe, bool render = true, CImage** out = 0) =0; /** * Select destination decoder output * by default it will be BGR24 */ virtual int SetDestFmt(int bits = 24, fourcc_t csp = 0) =0; protected: const CodecInfo& m_Info; BITMAPINFOHEADER* m_pFormat; BitmapInfo m_Dest; CImage* m_pImage; // for backward compatibility }; // declaration of IRtConfig moved to image.h // used also by IVideoRenderer AVM_END_NAMESPACE; #endif // AVIFILE_IVIDEODECODER_H avifile-0.7.48~20090503.ds/include/videoencoder.h0000644000175000017500000000504111164472545020214 0ustar yavoryavor#ifndef AVIFILE_IVIDEOENCODER_H #define AVIFILE_IVIDEOENCODER_H /******************************************************** Video encoder interface Copyright 2000 Eugene Kuznetsov (divx@euro.ru) *********************************************************/ #include "infotypes.h" #include "image.h" AVM_BEGIN_NAMESPACE; /** * * Video encoder class. * * Usage: * * Create encoder object. Optionally * set quality and key-frame frequency. Call Start(). * Call GetOutputSize() to identify maximum possible * size of compressed frame. Allocate buffer of this size. * Pass it as 'dest' in calls to EncodeFrame(). At the end * call Stop(). Do not forget to delete the object. * * Some codec DLLs have be controlled by special codec-specific * parameters. In Windows you can set them from codec configuration * dialog, but since we are completely GUI-independent, we'll need * an internal method to set them. Currently it is done by calling * static func SetExtendedAttr(), which takes FOURCC of codec, * name of parameter and its integer value. Complete list of * supported attributes can be retrieved as GetCodecInfo().encoder_info. * SetExtendedAttr() should be called before object creation, * because values for these attributes are typically stored in * registry and read by codec during object creation. * */ class AVMEXPORT IVideoEncoder { public: enum CAPS { CAP_NONE = 0, // packed CAP_IYUV = 1, CAP_YUY2 = 2, CAP_UYVY = 4, CAP_YVYU = 8, // planar CAP_YV12 = 128, CAP_I420 = 256 }; IVideoEncoder(const CodecInfo& info); virtual ~IVideoEncoder(); virtual int EncodeFrame(const CImage* src, void* dest, int* is_keyframe, size_t* size, int* lpckid = 0) =0; virtual const CodecInfo& GetCodecInfo() const; virtual const BITMAPINFOHEADER& GetOutputFormat() const =0; virtual size_t GetOutputSize() const =0; virtual int Start() =0; virtual int Stop() =0; virtual float GetFps() const; virtual int SetFps(float fps); #ifdef AVM_COMPATIBLE /* just for backward compatibility */ int QueryOutputSize() const { return (int)GetOutputSize(); }; const BITMAPINFOHEADER& QueryOutputFormat() const { return GetOutputFormat(); } /* use Attribute stuff for these */ int GetQuality() const { return -1; } int SetQuality(int quality) { return -1; } int GetKeyFrame() const { return -1; } int SetKeyFrame(int frequency) { return -1; } #endif protected: const CodecInfo& m_Info; }; AVM_END_NAMESPACE; #endif // AVIFILE_IVIDEOENCODER_H avifile-0.7.48~20090503.ds/lib/0000755000175000017500000000000011267646347014527 5ustar yavoryavoravifile-0.7.48~20090503.ds/lib/aviplay/0000755000175000017500000000000011267637343016170 5ustar yavoryavoravifile-0.7.48~20090503.ds/lib/aviplay/AudioCleaner.cpp0000644000175000017500000000626711164477616021243 0ustar yavoryavor// // Class which should minimalize effect of // changed sound signal by interpolating through the zero // #include "AudioCleaner.h" #include AVM_BEGIN_NAMESPACE; template size_t AudioCleanerStereo::soundOff(void* out, const void* in) { #if 0 T* OUT = (T*) out; const T* IN = (const T*) in; unsigned i = 1; while (i < CLEARED_SAMPLES) { float f = (float)(CLEARED_SAMPLES - i) / (float)CLEARED_SAMPLES; *OUT++ = (T) (f * *IN++); *OUT++ = (T) (f * *IN++); i++; } while (i < 2 * CLEARED_SAMPLES) { *OUT++ = (T) 0; *OUT++ = (T) 0; i++; } #endif m_uiRemains = m_uiClearSize; return 2 * CLEARED_SAMPLES; } template size_t AudioCleanerStereo::soundOn(void* out, size_t n) { if (m_uiRemains > 0) { T* OUT = (T*) out; size_t clear = (n < m_uiRemains && (n > 0)) ? n : m_uiRemains; m_uiRemains -= clear; if (m_uiRemains < 128) m_uiRemains = 0; size_t sub = (m_uiRemains) ? 0 : CLEARED_SAMPLES * 2 * sizeof(T); if (clear < sub) sub = clear; memset(OUT, (sizeof(T) == 1) ? 0x80 : 0, clear - sub + 4); OUT += clear / sizeof(T); T* IN = OUT; if (sub > 0) { for (unsigned i = 1; i <= sub / 2 / sizeof(T); ++i) { float f = (float)(CLEARED_SAMPLES - i) / (float)CLEARED_SAMPLES; f *= f; OUT--; *OUT = (T) (f * (float) *OUT); OUT--; *OUT = (T) (f * (float) *OUT); } } } return m_uiRemains; } template size_t AudioCleanerMono::soundOff(void* out, const void* in) { #if 0 T* OUT = (T*) out; const T* IN = (const T*) in; for (unsigned i = 0; i < CLEARED_SAMPLES; i++) { float f = (CLEARED_SAMPLES - i) / (double)CLEARED_SAMPLES; *OUT++ = (T) (IN[0] * f); } #endif m_uiRemains = m_uiClearSize; return 0; } template size_t AudioCleanerMono::soundOn(void* out, size_t n) { if (m_uiRemains > 0) { T* OUT = (T*) out; size_t clear = (n < m_uiRemains && (n > 0)) ? n : m_uiRemains; m_uiRemains -= clear; if (m_uiRemains < 128) m_uiRemains = 0; size_t sub = (m_uiRemains) ? 0 : CLEARED_SAMPLES * sizeof(T); if (clear < sub) sub = clear; memset(OUT, (sizeof(T) == 1) ? 0x80 : 0, clear - sub + 4); OUT += clear / sizeof(T); T* IN = OUT; if (sub > 0) { for (unsigned i = 1; i <= sub / sizeof(T); ++i) { float f = (float)(CLEARED_SAMPLES - i) / (float)CLEARED_SAMPLES; f *= f; OUT--; *OUT = (T) (f * (float)*OUT); } } } return m_uiRemains; } IAudioCleaner* CreateAudioCleaner(uint_t channels, uint_t bitsPerSample, size_t clearsz) { IAudioCleaner* r = 0; switch (channels) { case 1: if (bitsPerSample <= 8) r = new AudioCleanerMono(clearsz); else if (bitsPerSample <= 16) r = new AudioCleanerMono(clearsz); else if (bitsPerSample <= 32) r = new AudioCleanerMono(clearsz); break; case 2: if (bitsPerSample <= 8) r = new AudioCleanerStereo(clearsz); else if (bitsPerSample <= 16) r = new AudioCleanerStereo(clearsz); else if (bitsPerSample <= 32) r = new AudioCleanerStereo(clearsz); break; } return r; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviplay/AudioCleaner.h0000644000175000017500000000221211164477616020672 0ustar yavoryavor#ifndef AVIFILE_AUDIOCLEANER_H #define AVIFILE_AUDIOCLEANER_H #include "avm_default.h" #include "formats.h" #include AVM_BEGIN_NAMESPACE; class IAudioCleaner { protected: static const size_t CLEARED_SAMPLES = 32; size_t m_uiClearSize; size_t m_uiRemains; public: IAudioCleaner(size_t clear) : m_uiClearSize(clear), m_uiRemains(0) {} virtual ~IAudioCleaner() {} virtual size_t soundOff(void* out, const void* in) = 0; virtual size_t soundOn(void* out, size_t n) = 0; }; template class AudioCleanerStereo : public IAudioCleaner { public: AudioCleanerStereo(size_t clear) : IAudioCleaner(clear) {} virtual size_t soundOff(void* out, const void* in); virtual size_t soundOn(void* out, size_t n); }; template class AudioCleanerMono : public IAudioCleaner { public: AudioCleanerMono(size_t clear) : IAudioCleaner(clear) {} virtual size_t soundOff(void* out, const void* in); virtual size_t soundOn(void* out, size_t n); }; IAudioCleaner* CreateAudioCleaner(uint_t channels, uint_t bitsPerSample, size_t clearsz); AVM_END_NAMESPACE; #endif // AVIFILE_AUDIOCLEANER_H avifile-0.7.48~20090503.ds/lib/aviplay/AudioFpHQResampler.cpp0000644000175000017500000002054511164477616022336 0ustar yavoryavor// // RealTime High Precision resampling with antialising of the signal // // based on some algorithm from // Digital Image Warping by George Wolberg - page 159 // // // this code might be a bit more optimized in the future // but its already quite fast for its purpose #include "AudioFpHQResampler.h" #include /** * Real-arithmetic based resampling - giving very precise results - but its rather slow * few lines bellow we have now integer version of this - * this version is used for scaling of more then 16bit precise samples * and is not that much optimized as it serves as an illustration * how is this alghorithm working as the optimized integer version * is probably quite mystique * * NOTE: * these methods are accesing one member behind array * this is not a bug and it is intentional to fill also the last * member in the output field **/ AVM_BEGIN_NAMESPACE; #define PRECTYPE double //#define PRECTYPE float #define PREC (15) // use 14bits for floating point part #define PRECSIZE (1L< class AudioFpHQResamplerStereo : public IAudioResampler { public: virtual uint_t getBitsPerSample() const; virtual void resample(void* out, const void* in, size_t out_count, size_t int_count); }; template class AudioFpHQResamplerMono : public IAudioResampler { public: virtual uint_t getBitsPerSample() const; virtual void resample(void* out, const void* in, size_t out_count, size_t in_count); }; // to be used for 8 & 16 bit samples template class AudioIntHQResamplerStereo : public IAudioResampler { public: virtual uint_t getBitsPerSample() const; virtual void resample(void* out, const void* in, size_t out_count, size_t int_count); }; template class AudioIntHQResamplerMono : public IAudioResampler { public: virtual uint_t getBitsPerSample() const; virtual void resample(void* out, const void* in, size_t out_count, size_t in_count); }; template void AudioFpHQResamplerMono::resample(void* out, const void* in, size_t OUTlen, size_t INlen) { const T* IN = (const T*) in; T* OUT = (T*) out; memset(OUT, 0, OUTlen * sizeof(T)); PRECTYPE step = (PRECTYPE) OUTlen / (PRECTYPE) (INlen - 1); PRECTYPE x1 = 0.0; for (unsigned u = 0; u <= INlen; u++) { PRECTYPE x0 = x1; x1 += step; /* integer parts */ uint_t ix0 = (uint_t) x0; uint_t ix1 = (uint_t) x1; if (ix0 == ix1) { OUT[ix0] += (T) (IN[u] * step); continue; } OUT[ix0] += (T) (IN[u] * (ix0 + 1 - x0)); PRECTYPE dl = (IN[u + 1] - IN[u]) / step; for (unsigned i = ix0 + 1; i < ix1; i++) OUT[i] = (T) (IN[u] + dl * (i - x0)); OUT[ix1] += (T) ((x1 - ix1) * (IN[u] + dl * (ix1 - x0))); } OUT[OUTlen - 1] = IN[INlen - 1]; } template void AudioFpHQResamplerStereo::resample(void* out, const void* in, size_t OUTlen, size_t INlen) { const T* IN = (const T*) in; T* OUT = (T*) out; memset(OUT, 0, OUTlen * sizeof(T) * 2); PRECTYPE step = (PRECTYPE) (OUTlen) / (PRECTYPE) (INlen - 1); //cout << "SIZE " << sizeof(T) << " " << OUTlen << " " << INlen << " step " << step << endl; PRECTYPE x1 = 0.0; for (uint_t u = 0; u <= 2*INlen; u += 2) { PRECTYPE x0 = x1; //x1 = u/2 * step; x1 += step; /* integer parts */ uint_t ix0 = (uint_t) x0; uint_t ix1 = (uint_t) x1; if (ix0 == ix1) { OUT[ix0 * 2] += (T) (IN[u] * step); OUT[ix0 * 2 + 1] += (T) (IN[u + 1] * step); continue; } OUT[ix0 * 2] += (T) (IN[u] * (ix0 + 1 - x0)); OUT[ix0 * 2 + 1] += (T) (IN[u + 1] * (ix0 + 1 - x0)); PRECTYPE dl = ((int)IN[u + 2] - (int)IN[u]) / step; PRECTYPE dr = ((int)IN[u + 2 + 1] - (int)IN[u + 1]) / step; for (unsigned i = ix0 + 1; i < ix1; i++) { OUT[i * 2] = (T) (IN[u] + dl * (i - x0)); OUT[i * 2 + 1] = (T) (IN[u + 1] + dr * (i - x0)); } OUT[ix1 * 2] += (T) ((x1 - ix1) * (IN[u] + dl * (ix1 - x0))); OUT[ix1 * 2 + 1] += (T) ((x1 - ix1) * (IN[u + 1] + dr * (ix1 - x0))); } #if 0 for (int i = 0; i < 16; i++) printf(" %d in: %x %x out: %x %x\n", i, IN[2*i], IN[2*i + 1], OUT[2*i], OUT[2*i + 1]); for (int i = 16; i >= 0; i--) printf("%d in: %x %x out: %x %x\n", i, IN[2*INlen - 2*i], IN[2*INlen - 2*i + 1], OUT[2*OUTlen - 2*i], OUT[2*OUTlen - 2*i + 1]); #endif } template uint_t AudioFpHQResamplerStereo::getBitsPerSample() const { return sizeof(T) * 8; } template uint_t AudioFpHQResamplerMono::getBitsPerSample() const { return sizeof(T) * 8; } /** * Optimized real-arithmetic based resampling which is using integers * * NOTE: * these methods are accesing one member behind array * this is not a bug and it it intencial to fill also the last * member in the output field **/ template void AudioIntHQResamplerMono::resample(void* out, const void* in, size_t OUTlen, size_t INlen) { const T* IN = (const T*) in; T* OUT = (T*) out; const T* OUTEND = &OUT[OUTlen]; long delta = (OUTlen * PRECSIZE) / (INlen - ((INlen < OUTlen) ? 1 : 0)); //int delta = (OUTlen * PRECSIZE) / (INlen + 1); //printf("Delta: %d\n", delta); long frac = -PRECSIZE; long part = 0; long a = 0; for (;;) { frac += delta; if (frac >= 0) { long dl; long r = *IN; frac -= PRECSIZE; a += (PRECSIZE - part) * r; *OUT = (T) (a >> PREC); OUT++; if (OUT >= OUTEND) break; dl = ((IN[1] - r) << PREC) / delta; a = r + dl - ((dl * part) >> PREC); while (frac >= 0) { *OUT = (T) a; OUT++; a += dl; frac -= PRECSIZE; } part = frac & (PRECSIZE - 1); a *= part; } else { part = frac & (PRECSIZE - 1); a += *IN * delta; } IN++; } //printf("OUT: %p OUTEND: %p IN: %p INEND: %p\n", // OUT, OUTEND, IN, &((const T*) in)[INlen]); //OUT[-1] = IN[-1]; } // this version is the same code as above it just goes through every second sample // to save some registers we use this instead of parametrized version // ok I think we could make slightly more complicated template... template void AudioIntHQResamplerStereo::resample(void* out, const void* in, size_t OUTlen, size_t INlen) { const T* OUTEND = &(((const T*)out)[OUTlen * 2]); long delta = (OUTlen * PRECSIZE) / (INlen - ((INlen < OUTlen) ? 1 : 0)); // use two loops and skip every second sample - should be faster // than processing two channels at the same time for (int loop = 0; loop < 2; loop++) { const T* IN = (const T*) in; T* OUT = (T*) out; int x1 = 0, ix1 = 0; OUT += loop; // left channel - 0 right channel - 1 IN += loop; long frac = -PRECSIZE; long part = 0; long a = 0; for (;;) { frac += delta; if (frac >= 0) { long dl; long r = *IN; frac -= PRECSIZE; a += (PRECSIZE - part) * r; *OUT = (T) (a >> PREC); OUT += 2; if (OUT >= OUTEND) break; dl = ((IN[2] - r) << PREC) / delta; a = r + dl - ((dl * part) >> PREC); while (frac >= 0) { *OUT = (T) a; OUT += 2; a += dl; frac -= PRECSIZE; } part = frac & (PRECSIZE - 1); a *= part; } else { part = frac & (PRECSIZE - 1); a += *IN * delta; } IN += 2; } //OUT[-1] = IN[-1]; } } template uint_t AudioIntHQResamplerStereo::getBitsPerSample() const { return sizeof(T) * 8; } template uint_t AudioIntHQResamplerMono::getBitsPerSample() const { return sizeof(T) * 8; } IAudioResampler* CreateHQResampler(uint_t channels, uint_t bitsPerSample) { IAudioResampler* r = 0; //cout << "Resample " << channels << " " << bitsPerSample << endl; // create all the needed instancies switch (channels) { case 1: if (bitsPerSample <= 8) r = new AudioIntHQResamplerMono; else if (bitsPerSample <= 16) r = new AudioIntHQResamplerMono; else if (bitsPerSample <= 32) r = new AudioFpHQResamplerMono; break; case 2: if (bitsPerSample <= 8) r = new AudioIntHQResamplerStereo; else if (bitsPerSample <= 16) r = new AudioIntHQResamplerStereo; else if (bitsPerSample <= 32) r = new AudioFpHQResamplerStereo; break; } return r; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviplay/AudioFpHQResampler.h0000644000175000017500000000035710113137122021754 0ustar yavoryavor#ifndef AUDIOFPHQRESAMPLER_H #define AUDIOFPHQRESAMPLER_H #include "IAudioResampler.h" AVM_BEGIN_NAMESPACE; IAudioResampler* CreateHQResampler(uint_t channels, uint_t bitsPerSample); AVM_END_NAMESPACE; #endif // AUDIOFPHQRESAMPLER_H avifile-0.7.48~20090503.ds/lib/aviplay/AudioIntResampler.cpp0000644000175000017500000000575207415107747022274 0ustar yavoryavor#include "AudioIntResampler.h" AVM_BEGIN_NAMESPACE; template uint_t AudioIntResamplerMono::getBitsPerSample() const { return sizeof(T) * 8; } template uint_t AudioIntResamplerStereo::getBitsPerSample() const { return sizeof(T) * 8; } template void AudioIntResamplerMono::resample(void* out, const void* in, uint_t dest_len, uint_t src_len) { const T* src = (const T*) in; T* dest = (T*) out; double rate = src_len / (double) dest_len; double progress = 0; for (T* d = dest; d < &dest[dest_len * 2];) { *d++ = src[int(progress)]; progress += rate; } } template void AudioIntResamplerStereo::resample(void* out, const void* in, uint_t dest_len, uint_t src_len) { const T* src = (const T*) in; T* dest = (T*) out; double rate = src_len / (double) dest_len; double progress = 0; for (T* d = dest; d < &dest[dest_len * 2];) { *d++ = src[int(progress) * 2]; *d++ = src[int(progress) * 2 + 1]; progress += rate; } } // explicitly create implementation for these types // we have only one piece of the code for all these type template class AudioIntResamplerStereo; template class AudioIntResamplerStereo; template class AudioIntResamplerStereo; template class AudioIntResamplerMono; template class AudioIntResamplerMono; template class AudioIntResamplerMono; /* static int multiply(char* dest, const char* src, uint_t src_size, int rate, int samplesize); if this would be useful or there will be free time reimplement this here correctly int AudioQueue::multiply(char* dest, const char* src, uint_t src_size, int rate, int samplesize) { Debug cout << "AudioQueue: multiply" << endl; unsigned i; switch(rate*16+samplesize) { case 0x21: for(i=0; i class AudioIntResamplerStereo : public IAudioResampler { public: virtual uint_t getBitsPerSample() const; virtual void resample(void* out, const void* in, uint_t out_count, uint_t in_count); }; template class AudioIntResamplerMono : public IAudioResampler { public: virtual uint_t getBitsPerSample() const; virtual void resample(void* out, const void* in, uint_t out_count, uint_t in_count); }; AVM_END_NAMESPACE; #endif avifile-0.7.48~20090503.ds/lib/aviplay/AudioQueue.cpp0000644000175000017500000001351211165742267020743 0ustar yavoryavor/********************************************** Audio queue implementation **********************************************/ #include "AudioQueue.h" #include "AudioCleaner.h" #include "IAudioResampler.h" #include "avm_output.h" #if 1 // slower but has much better precision #define RESAMPLERSTEREO AudioFpHQResamplerStereo #define RESAMPLERMONO AudioFpHQResamplerMono #include "AudioFpHQResampler.h" #else // faster but not very good method #define RESAMPLERSTEREO AudioIntResamplerStereo #define RESAMPLERMONO AudioIntResamplerMono #include "AudioIntResampler.h" #endif #include "avm_cpuinfo.h" #include "utils.h" #include //write #include //memcpy #include //#undef Debug //#define Debug if (0) // using different strategy - caller is responsible for holding lock! AVM_BEGIN_NAMESPACE; template inline T mymin(const T x, const T y) { return (x < y) ? x : y; } AudioQueue::AudioQueue(WAVEFORMATEX& Iwf, WAVEFORMATEX& Owf) : m_Bufs(64) { m_dRemains = 0.0; m_pResampler = 0; m_pCleaner = 0; m_Iwf = Iwf; m_Owf = Owf; m_uiBytesPerSec = (m_Owf.nChannels * ((m_Owf.wBitsPerSample + 7) / 8) * m_Owf.nSamplesPerSec); for (size_t i = 0; i < m_Bufs.capacity(); i++) m_Bufs[i].mem = 0; m_uiBufSize = 0; m_bCleared = false; //printf("QUEUE %x %x\n", m_Iwf.wFormatTag, m_Owf.wFormatTag); if (m_Owf.wFormatTag == 0x01) { uint_t clearsz = (m_uiBytesPerSec / 10) & ~3U; // 0.1 sec // for PCM (0x01) we could add some silent to remove clics & pops m_pCleaner = CreateAudioCleaner(m_Owf.nChannels, m_Owf.wBitsPerSample, clearsz); } } AudioQueue::~AudioQueue() { m_Mutex.Lock(); // just for safety Clear(); m_Mutex.Unlock(); delete m_pCleaner; delete m_pResampler; } void AudioQueue::Clear() { AVM_WRITE("aviplay", 2, "AudioQueue: clear\n"); for (size_t i = 0; i < m_Bufs.capacity(); i++) { delete[] m_Bufs[i].mem; m_Bufs[i].mem = 0; } m_Bufs.clear(); m_bCleared = true; m_uiBufSize = 0; if (m_pCleaner) m_pCleaner->soundOff(0, 0); m_Cond.Broadcast(); } void AudioQueue::DisableCleaner() { delete m_pCleaner; m_pCleaner = 0; } /* ineffective */ ssize_t AudioQueue::Resample(void* dest, const void* src, size_t src_size) { if (m_Iwf.wBitsPerSample != m_Owf.wBitsPerSample || m_Iwf.nChannels != m_Owf.nChannels || (m_Iwf.nChannels != 1 && m_Iwf.nChannels != 2)) { #if 0 cerr << "AudioQueue::resample() unsupported resampling conversion!" << endl << "From: bps: " << m_Iwf.wBitsPerSample << " ch: " << m_Iwf.nChannels << " To: bps: " << m_Owf.wBitsPerSample << " ch: " << m_Owf.nChannels << endl; #endif return 0; } if (!m_pResampler || (int)m_pResampler->getBitsPerSample() != m_Owf.wBitsPerSample) { delete m_pResampler; m_pResampler = CreateHQResampler(m_Owf.nChannels, m_Owf.wBitsPerSample); if (!m_pResampler) { AVM_WRITE("aviplay", "AudioQueue::resample() creation of resampler failed\n"); return 0; } } double ndest_size = (double) src_size / m_Iwf.nSamplesPerSec * m_Owf.nSamplesPerSec / (m_Owf.wBitsPerSample / 8 * m_Owf.nChannels); src_size /= (m_Iwf.wBitsPerSample / 8 * m_Iwf.nChannels); size_t dest_size = (size_t) ndest_size; m_dRemains += (ndest_size - (double)dest_size); if (m_dRemains > 1.0) { m_dRemains -= 1.0; dest_size++; } //cout << "dest_size " << dest_size << " orig " << ndest_size << endl; AVM_WRITE("aviplay", 2, "AudioQueue::resample() freq: %" PRIsz " -> %" PRIsz "\n", src_size, dest_size); if (dest_size > 0) m_pResampler->resample(dest, src, dest_size, src_size); //cout << "resampled " << src_size<< " to " << dest_size // << " >>> " << src_size << " b:" << m_Owf.wBitsPerSample // << " ch:" << m_Owf.nChannels << endl; return (ssize_t) (dest_size * (m_Owf.wBitsPerSample / 8) * m_Owf.nChannels); } ssize_t AudioQueue::Read(void* data, size_t count, const IAudioMix* amix) { //AVM_WRITE("aviplay", 2, "AudioQueue: read: %d\n", count); size_t bread = 0; while (bread < count && !m_Bufs.empty()) { chunk& rchunk = m_Bufs.front(); size_t r = rchunk.size - rchunk.rsize; if (r > (count - bread)) r = (count - bread); if (amix == 0) memcpy((char*)data + bread, rchunk.mem + rchunk.rsize, r); else { r = amix->Mix((char*)data + bread, rchunk.mem + rchunk.rsize, r); if (r <= 0) break; } //printf("ReadAudioChunk %d %d\n", rchunk.rsize, r); rchunk.rsize += r; bread += r; if (rchunk.rsize >= rchunk.size) { delete[] rchunk.mem; rchunk.mem = 0; m_Bufs.pop(); } } if (m_Bufs.empty() && !bread) AVM_WRITE("aviplay", "AudioQueue::Read() Warning: audio queue drain\n"); m_uiBufSize -= bread; m_Cond.Broadcast(); return bread; } ssize_t AudioQueue::Write(char* data, size_t count) { //AVM_WRITE("aviplay", 2, "AudioQueue::Write(%d) %d\n", count, m_uiBufSize); size_t new_count = count * m_Owf.nSamplesPerSec / m_Iwf.nSamplesPerSec + 16; chunk newch; newch.mem = data; newch.size = count; if (m_Iwf.nSamplesPerSec != m_Owf.nSamplesPerSec) { if (!(newch.mem = new char[new_count])) return -1; newch.size = Resample(newch.mem, data, count); delete[] data; } #if 0 // checking if the sample continues correctly short *p = (short*) (m_pcAudioFrame + ((m_uiFrameIn > 64) ? m_uiFrameIn : 64)); for (int i = -32; i < 32; i++) { if (!(i % 8)) printf("\n%4d ", i); //printf(" 0x%4.4x", abs(p[i] - p[i-2]) & 0xffff); printf(" 0x%4.4x", p[i] & 0xffff); } #endif if (m_bCleared && m_pCleaner) m_bCleared = (m_pCleaner->soundOn(newch.mem, newch.size) != 0); newch.rsize = 0; m_Bufs.push(newch); m_uiBufSize += newch.size; m_Cond.Broadcast(); return 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviplay/AudioQueue.h0000644000175000017500000000416411164477616020415 0ustar yavoryavor#ifndef AVIFILE_AUDIOQUEUE_H #define AVIFILE_AUDIOQUEUE_H #include "formats.h" #include "avm_locker.h" #include "avm_stl.h" AVM_BEGIN_NAMESPACE; class IAudioResampler; class IAudioCleaner; // buggy gcc-4.0 refused to compile static const double #define MAX_BUFFER_TIME 1.0 class IAudioMix { public: virtual ~IAudioMix() {} virtual ssize_t Mix(void* data, const void* src, size_t n) const = 0; }; class AudioQueue { public: //static const double MAX_BUFFER_TIME = 1.0; AudioQueue(WAVEFORMATEX& Iwf, WAVEFORMATEX& Owf); ~AudioQueue(); void Broadcast() { m_Cond.Broadcast(); } void Clear(); void DisableCleaner(); double GetBufferTime() const { return GetSize() / (double) GetBytesPerSec(); } size_t GetBytesPerSec() const { return m_uiBytesPerSec; } size_t GetSize() const { return m_uiBufSize; } bool IsFull() { return m_Bufs.full() || GetBufferTime() > MAX_BUFFER_TIME; } ssize_t Read(void* data, size_t count, const IAudioMix* amix = 0); ssize_t Resample(void* dest, const void* src, size_t src_size); ssize_t Write(char* b, size_t count); // add new samples int Wait(float waitTime = -1.0) { Broadcast(); return m_Cond.Wait(m_Mutex, waitTime); } int Lock() { return m_Mutex.Lock(); } int Unlock() { return m_Mutex.Unlock(); } protected: WAVEFORMATEX m_Iwf; ///< format of data we get from audio stream WAVEFORMATEX m_Owf; ///< format of data audio output PthreadCond m_Cond; ///< broadcast to notify audio_thread about ///< new available data OR about quit=1 PthreadMutex m_Mutex; ///< controls access to audio buffer size_t m_uiBytesPerSec; ///< input and output positions in queue IAudioResampler* m_pResampler; double m_dRemains; ///< remainder for resampling size_t m_uiBufSize; struct chunk { char* mem; ///< memchunk size_t size; ///< chunk size size_t rsize; ///< already readed samples from this chunk }; qring m_Bufs; IAudioCleaner* m_pCleaner; bool m_bCleared; ///< cleared buffers }; AVM_END_NAMESPACE; #endif // AVIFILE_AUDIOQUEUE_H avifile-0.7.48~20090503.ds/lib/aviplay/CopyAudioRenderer.cpp0000644000175000017500000000170211164657374022261 0ustar yavoryavor/********************************************************* CopyAudioRenderer implementation *********************************************************/ #include "aviplay.h" // AUDIOFUNC #include "CopyAudioRenderer.h" #include "AudioQueue.h" #include "avifile.h" #include "utils.h" AVM_BEGIN_NAMESPACE; ssize_t CopyAudioMix::Mix(void* data, const void* src, size_t n) const { return m_pAf(src, n, m_pArg); } CopyAudioRenderer::CopyAudioRenderer(IReadStream* stream, WAVEFORMATEX& Owf, AUDIOFUNC func, void* arg) : IAudioRenderer(stream, Owf) { m_pAudioMix = new CopyAudioMix(func, arg); m_pQueue->DisableCleaner(); } int CopyAudioRenderer::Extract() { IAudioRenderer::Extract(); size_t size = m_pQueue->GetSize(); m_dAudioRealpos = m_pAudiostream->GetTime() - m_pQueue->GetBufferTime() - m_fAsync; if (m_bInitialized && !m_bPaused && size > 0) m_pQueue->Read(0, size, m_pAudioMix); return 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviplay/CopyAudioRenderer.h0000644000175000017500000000130511164657376021727 0ustar yavoryavor#ifndef AVIFILE_COPYAUDIORENDERER_H #define AVIFILE_COPYAUDIORENDERER_H #include "IAudioRenderer.h" #include "AudioQueue.h" AVM_BEGIN_NAMESPACE; class CopyAudioMix : public IAudioMix { AUDIOFUNC m_pAf; void* m_pArg; public: CopyAudioMix(AUDIOFUNC func, void* arg) : m_pAf(func), m_pArg(arg) {} virtual ssize_t Mix(void* data, const void* src, size_t n) const; }; class CopyAudioRenderer: public IAudioRenderer { public: CopyAudioRenderer(IReadStream* stream, WAVEFORMATEX& Owf, AUDIOFUNC func, void* arg); ~CopyAudioRenderer() { delete m_pAudioMix; } virtual int Extract(); protected: CopyAudioMix* m_pAudioMix; }; AVM_END_NAMESPACE; #endif //AVIFILE_COPYAUDIORENDERER_H avifile-0.7.48~20090503.ds/lib/aviplay/IAudioRenderer.cpp0000644000175000017500000002011111174451143021515 0ustar yavoryavor/********************************************************* Implementation of base audio renderer class *********************************************************/ #include "IAudioRenderer.h" #include "AudioQueue.h" #include "avm_cpuinfo.h" #include "avm_output.h" #include "audiodecoder.h" #include "avifile.h" #include "utils.h" #include AVM_BEGIN_NAMESPACE; IAudioRenderer::IAudioRenderer(IReadStream* as, WAVEFORMATEX& Owf) : m_pAudiostream(as), m_pQueue(0), m_llTimeStart(0), m_uiSamples(0), m_Owf(Owf), m_iBalance(BAL_MAX/2), m_iVolume(VOL_MAX), m_bQuit(false), m_bPaused(false), m_bInitialized(false) { m_dSeekTime = m_dStreamTime = m_dAudioRealpos = m_dPauseTime = m_pAudiostream->GetTime(); // needed for bitrate in nAvgBytesPerSec WAVEFORMATEX Inwf; m_pAudiostream->GetAudioFormat(&Inwf, sizeof(Inwf)); m_pAudiostream->GetOutputFormat(&m_Iwf, sizeof(m_Iwf)); // format can't be changed m_Owf.wFormatTag = m_Iwf.wFormatTag; m_Owf.nBlockAlign = m_Iwf.nBlockAlign; if (m_Owf.nChannels == 0) { m_Owf.nChannels = m_Iwf.nChannels; if (m_Owf.nChannels > 2) m_Owf.nChannels = 2; } if (m_Owf.nSamplesPerSec == 0) m_Owf.nSamplesPerSec = m_Iwf.nSamplesPerSec; if (m_Owf.wBitsPerSample == 0) { m_Owf.wBitsPerSample = m_Iwf.wBitsPerSample; if (m_Owf.wBitsPerSample > 16) m_Owf.wBitsPerSample = 16; } m_Owf.nBlockAlign = (uint16_t) (m_Owf.nChannels * ((m_Owf.wBitsPerSample + 7) / 8)); m_Owf.nAvgBytesPerSec = m_Owf.nSamplesPerSec * m_Owf.nBlockAlign; m_dOwfBPS = m_Owf.nAvgBytesPerSec; m_dIwfBPS = m_Iwf.nSamplesPerSec * m_Owf.nChannels /* tricky */ * ((m_Owf.wBitsPerSample + 7) / 8); char b[200]; avm_wave_format(b, sizeof(b), &Inwf); AVM_WRITE("audio renderer", "src %s\n", b); avm_wave_format(b, sizeof(b), &m_Owf); AVM_WRITE("audio renderer", "dst %s\n", b); // no need to catch - we allocate m_pQueue as last object m_pQueue = new AudioQueue(m_Iwf, m_Owf); SetAsync(0.); } IAudioRenderer::~IAudioRenderer() { delete m_pQueue; } const char* IAudioRenderer::GetAudioFormat() const { return m_pAudiostream->GetAudioDecoder()->GetCodecInfo().GetName(); } bool IAudioRenderer::Eof() const { //if (m_pAudiostream->Eof()) // AVM_WRITE("audio renderer", "Audio EOF: %d --- bt:%f ren:%f %f\n", m_pAudiostream->Eof(), GetBufferTime(), getRendererBufferTime(), m_pAudiostream->GetTime()); return m_pAudiostream->Eof() && ((GetBufferTime() - getRendererBufferTime()) < 0.01); } int IAudioRenderer::Extract() { if (m_pAudiostream->Eof() || m_pQueue->IsFull()) return -1; // reader is supposed to wait!! size_t frame_size = m_pAudiostream->GetFrameSize(); if (frame_size < 2048) frame_size = 2048; size_t ocnt; size_t samples; char* frame = new char[frame_size + 2048]; // safety reason if (!frame) return -1; //AVM_WRITE("audio renderer", 1, "before st: %f\n", m_pAudiostream->GetTime()); //for (int i = 0; i < 64; i++) printf("%d 0x%x\n", i, (unsigned char) m_pcLocalFrame[i]); m_pAudiostream->ReadFrames(frame, frame_size, frame_size, samples, ocnt); //if (m_uiSamples < 100000) printf("Ocnt %d %d %d\n", ocnt, samples, frame_size); if ((int)ocnt <= 0) { delete[] frame; if (ocnt == 0) // && m_uiSamples > 0) { m_dSeekTime = m_pAudiostream->GetTime(); m_uiSamples = 0; AVM_WRITE("audio renderer", 1, "new seektime set: %f (eof:%d)\n", m_dSeekTime, m_pAudiostream->Eof()); } return 0; } if (samples > frame_size) AVM_WRITE("audio renderer", "OOPS: samples (%" PRIsz ") > one_frame_sound (%" PRIsz ")\n", samples, frame_size); if (ocnt > frame_size) { AVM_WRITE("audio renderer", "OOPS: ocnt (%" PRIsz ") > one_frame_sound (%" PRIsz ")\n", ocnt, frame_size); ocnt = frame_size; } m_pQueue->Lock(); m_pQueue->Write(frame, ocnt); m_uiSamples += ocnt; m_dStreamTime = m_pAudiostream->GetTime(); m_pQueue->Unlock(); //AVM_WRITE("audio renderer", 1, "extracted %d sample(s) (%d bytes) newtime: %f %d %f\n", samples, ocnt, m_dStreamTime, m_uiSamples, m_dOwfBPS); return 0; } double IAudioRenderer::GetBufferTime() const { if (!m_bInitialized) return 0.; //AVM_WRITE("audio renderer", "GBT %f %f\n", m_pQueue->GetBufferTime(), getRendererBufferTime()); double btime = m_pQueue->GetBufferTime() + getRendererBufferTime(); //printf("BTIME %f %f %f\n", btime, m_pQueue->GetBufferTime(),getRendererBufferTime()); return btime; } double IAudioRenderer::GetCacheSize() const { return m_pAudiostream->CacheSize(); } double IAudioRenderer::GetLengthTime() const { return m_pAudiostream->GetLengthTime(); } double IAudioRenderer::GetTime() { //printf("GetTime %f %d\n", m_dPauseTime, m_bPaused); if (m_dPauseTime != -1.) return m_dPauseTime; double actual_time = avm_get_time_diff(avm_get_time_us(), m_llTimeStart) + m_dAudioRealpos - m_fAsync; //AVM_WRITE("audio renderer", "stream: %f buffered: %f actual: %f\n", // m_pAudiostream->GetTime(), GetBufferTime(), actual_time); //actual_time = m_pAudiostream->GetTime() - GetBufferTime(); return (actual_time > 0.) ? actual_time : 0.; } int IAudioRenderer::Pause(bool state) { m_pQueue->Lock(); if (!m_bInitialized) { m_pQueue->Unlock(); return -1; } if (m_bPaused != state) { m_bPaused = state; pause((state) ? 1 : 0); if (state) { m_dPauseTime = GetTime(); reset(); } } m_pQueue->Broadcast(); // in case audio renderer waits for new data m_pQueue->Unlock(); return 0; } int IAudioRenderer::SeekTime(double pos) { m_pQueue->Lock(); pos += m_fAsync; if (pos < 0.) pos = 0.; int hr = 0; m_llTimeStart = 0; if (m_bInitialized) { if (pos < m_pAudiostream->GetTime()) hr = m_pAudiostream->SeekTime(pos); else m_pAudiostream->SkipTo(pos); m_pQueue->Clear(); reset(); } else hr = m_pAudiostream->SeekTime(pos); m_dSeekTime = m_dStreamTime = m_dAudioRealpos = m_dPauseTime = m_pAudiostream->GetTime(); m_uiSamples = 0; //AVM_WRITE("audio renderer", "AUDIOREALPOS %f to %f\n", m_dAudioRealpos, pos); m_pQueue->Unlock(); return hr; } /* int IAudioRenderer::Skip(double skiptime) { Locker locker(m_Mutex); int r = m_pAudiostream->SkipTo(skiptime); m_dStreamTime = m_dAudioRealpos = m_pAudiostream->GetTime(); return r; } */ int IAudioRenderer::GetBalance() { return m_iBalance; } int IAudioRenderer::GetVolume() { return m_iVolume; } int IAudioRenderer::SetBalance(int balance) { if (balance < 0 || balance > BAL_MAX) return -1; m_iBalance = balance; return 0; } int IAudioRenderer::SetVolume(int volume) { if (volume < 0 || volume > VOL_MAX) return -1; m_iVolume = volume; return 0; } void IAudioRenderer::Start() { m_pQueue->Lock(); if (!m_bInitialized) { m_bInitialized = true; m_bPaused = false; pause(0); } else { AVM_WRITE("audio renderer", "already started\n"); } m_pQueue->Unlock(); } void IAudioRenderer::Stop() { m_pQueue->Lock(); if (m_bInitialized) { m_bInitialized = false; m_pQueue->Clear(); pause(1); } m_pQueue->Unlock(); return; } void IAudioRenderer::updateTimer() { double nt = GetStreamTime() - GetBufferTime() - m_fAsync; //printf("NT time %f %f\n", nt - GetTime(), nt); if (nt < 0.) nt = 0.; if (m_dPauseTime != -1.) { m_dAudioRealpos = nt; m_llTimeStart = avm_get_time_us(); m_dPauseTime = -1.; } else { const double df = 0.04; double st = GetTime(); double dt = st - nt; //AVM_WRITE("audio renderer", "nt:%.4f st:%.4f dt:%.4f t:%.4f bt:%.4f df:%.4f\n", nt, st, dt, // GetStreamTime(), GetBufferTime(), getRendererBufferTime()); if (dt < -df || dt > df) { AVM_WRITE("audio renderer", 1, "stime %f %f dt: %f t: %f b: %f rt: %f\n", nt, st, dt, GetStreamTime(), GetBufferTime(), getRendererBufferTime()); // we need bigger jump when sound is going slower! m_dAudioRealpos -= dt / 20; } } } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviplay/IAudioRenderer.h0000644000175000017500000000463711164657376021220 0ustar yavoryavor#ifndef AVIFILE_IAUDIORENDERER_H #define AVIFILE_IAUDIORENDERER_H #include "avifile.h" #include "formats.h" #include "avm_locker.h" AVM_BEGIN_NAMESPACE; class AudioQueue; // call with started audio stream! class IAudioRenderer { public: static const int VOL_MAX = 1000; static const int BAL_MAX = 1000; IAudioRenderer(IReadStream* astream, WAVEFORMATEX& m_Owf); virtual ~IAudioRenderer(); virtual int Init() { return 0; } // -1: error range 0-1000 virtual int GetVolume(); // -1: error range 0-500-1000 500 middle virtual int GetBalance(); virtual int SetVolume(int volume); virtual int SetBalance(int balance); // no overloadable at this moment bool Eof() const; int Extract(); const char* GetAudioFormat() const; double GetCacheSize() const; double GetLengthTime() const; double GetStreamTime() const { return m_dStreamTime; } double GetTime(); double GetBufferTime() const;//for how long we can play without Extract()'s? int Pause(bool state); // 0 - Ok -1 - ignored int SeekTime(double pos); void SetAsync(float async) { m_fAsync = async; } int SetPlayingRate(int rate) { return -1; } int SetResamplingRate(int rate) { return -1; } void Start(); void Stop(); protected: // overloaded virtual void pause(int) {} virtual int reset() { return 0; } virtual double getRendererBufferTime() const { return 0.; } void updateTimer(); IReadStream* m_pAudiostream; AudioQueue* m_pQueue; ///< using pointer - faster gcc3.0 compilation int64_t m_llTimeStart; ///< Timestamp of start /// updated after each reseek or pause size_t m_uiSamples; ///< Decoded samples from last seek double m_dStreamTime; ///< Precise stream time double m_dSeekTime; ///< Precise position at seek double m_dAudioRealpos; ///< Position used for timing double m_dPauseTime; ///< Timestamp at pause WAVEFORMATEX m_Iwf; ///< Input format of data we get from the audiostream WAVEFORMATEX m_Owf; ///< Resulting Output format of data double m_dIwfBPS; double m_dOwfBPS; int m_iBalance; int m_iVolume; float m_fAsync; ///< by default 0, hardware-dependent bool m_bQuit; ///< true when terminating thread bool m_bPaused; ///< true if we are paused bool m_bInitialized; ///< true if we are playing OR paused }; AVM_END_NAMESPACE; #endif // AVIFILE_IAUDIORENDERER_H avifile-0.7.48~20090503.ds/lib/aviplay/IAudioResampler.h0000644000175000017500000000073011164657503021362 0ustar yavoryavor#ifndef IAUDIORESAMPLER_H #define IAUDIORESAMPLER_H // // Interface class for the resampling routine // #include "avm_default.h" AVM_BEGIN_NAMESPACE; // using templates for char, short, int sized samples class IAudioResampler { public: virtual ~IAudioResampler() {} virtual uint_t getBitsPerSample() const = 0; virtual void resample(void* out, const void* in, size_t out_count, size_t in_count) = 0; }; AVM_END_NAMESPACE; #endif /* IAUDIORESAMPLER_H */ avifile-0.7.48~20090503.ds/lib/aviplay/OssAudioRenderer.cpp0000644000175000017500000002134511164657376022122 0ustar yavoryavor/********************************************************* DSP OssAudioRenderer implementation *********************************************************/ #include "OssAudioRenderer.h" #include "avifile.h" #include "avm_cpuinfo.h" #include "avm_output.h" #ifdef __NetBSD__ #include #else #include #endif #include #include #include // strerror #include #include #include #ifndef AFMT_AC3 #define AFMT_AC3 0x400 #endif AVM_BEGIN_NAMESPACE; ssize_t OssAudioMix::Mix(void* data, const void* src, size_t n) const { //int ds = open("/tmp/wav", O_WRONLY | O_CREAT | O_APPEND, 0666); write(ds, src, n); close(ds); return ::write(m_iFd, src, n); } int OssAudioRenderer::Init() { const char DSP_DEVICE[] = "/dev/dsp"; const char DEVDSP_DEVICE[] = "/dev/sound/dsp"; const char MIXER_DEVICE[] = "/dev/mixer"; const char DEVMIXER_DEVICE[] = "/dev/sound/mixer"; #ifdef __linux__ #define NDELAY_FLAG O_NDELAY #else #define NDELAY_FLAG 0 #endif m_iMixFd = ::open(DEVMIXER_DEVICE, O_RDONLY); if (m_iMixFd < 0) m_iMixFd = ::open(MIXER_DEVICE, O_RDONLY); m_iAudioFd = ::open(DEVDSP_DEVICE, O_WRONLY | NDELAY_FLAG); if (m_iAudioFd < 0) m_iAudioFd = ::open(DSP_DEVICE, O_WRONLY | NDELAY_FLAG); for (;;) { if (m_iAudioFd < 0) { AVM_WRITE("OSS audio renderer", "Can't open %s audio device: %s\n", DSP_DEVICE, strerror(errno)); break; } #ifdef __linux__ int flag = fcntl(m_iAudioFd, F_GETFL, 0); if (flag < 0) break; flag &= ~O_NDELAY; if (fcntl(m_iAudioFd, F_SETFL, flag) < 0) break; #endif m_uiWriteSize = m_Owf.nBlockAlign; if (m_Owf.wFormatTag == 0x01) { if (reset() != 0) return -1; audio_buf_info zz; ioctl(m_iAudioFd, SNDCTL_DSP_GETOSPACE, &zz); m_iSndLimit = zz.bytes; ioctl(m_iAudioFd, SNDCTL_DSP_GETBLKSIZE, &m_uiWriteSize); AVM_WRITE("OSS audio renderer", "frags=%d size=%db buffer=%db (%db)\n", zz.fragments, zz.fragsize, m_iSndLimit, m_uiWriteSize); } else if (m_Owf.wFormatTag == 0x2000) { m_uiWriteSize = m_Owf.nBlockAlign; // AC3 passthrough support int tmp = AFMT_AC3; if (ioctl(m_iAudioFd, SNDCTL_DSP_SETFMT, &tmp) < 0 || tmp != AFMT_AC3) { AVM_WRITE("OSS audio renderer", "AC3 SNDCTL_DSP_SETFMT failed" "** Have you set emu10k1 into proper state?? (see README) **\n"); break; } else AVM_WRITE("OSS audio renderer", "AC3 pass-through enabled\n"); } m_AudioMix.m_iFd = m_iAudioFd; mixer(GET); m_pAudioThread = new PthreadTask(0, doAudioOut, (void*)this); return 0; } return -1; } OssAudioRenderer::~OssAudioRenderer() { AVM_WRITE("OSS audio renderer", 1, "destroy\n"); m_pQueue->Lock(); m_bQuit = true; m_pQueue->Broadcast(); m_pQueue->Unlock(); delete m_pAudioThread; m_pAudioThread = 0; // so reset will work for 0x2000 if (m_iAudioFd >= 0) { if (m_uiWriteSize == 4096) reset(); ::close(m_iAudioFd); } if (m_iMixFd >= 0) ::close(m_iMixFd); } int OssAudioRenderer::GetBalance() { return (mixer(GET) == 0) ? m_iBalance : -1; } int OssAudioRenderer::GetVolume() { return (mixer(GET) == 0) ? m_iVolume : -1; } int OssAudioRenderer::SetBalance(int balance) { return (IAudioRenderer::SetBalance(balance) == 0 && mixer(SET) == 0) ? m_iBalance : -1; } int OssAudioRenderer::SetVolume(int volume) { return (IAudioRenderer::SetVolume(volume) == 0 && mixer(SET) == 0) ? m_iVolume : -1; } int OssAudioRenderer::mixer(Act a) { int r = -1; if (m_iMixFd >= 0 && m_Owf.wFormatTag != 0x2000) { int devm; ioctl(m_iMixFd, SOUND_MIXER_READ_DEVMASK, &devm); if (devm & SOUND_MASK_PCM) { int t = 0; switch (a) { case GET: ioctl(m_iMixFd, SOUND_MIXER_READ_PCM, &t); //printf("GET %x\n", t); m_iVolume = (t >> 8) & 0x7f; t &= 0x7f; if (m_iVolume >= t) { if (m_iVolume > 6) m_iBalance = BAL_MAX - t * (BAL_MAX / 2) / m_iVolume; m_iVolume = m_iVolume * VOL_MAX / OSS_VOL_MAX; } else { if (t > 6) m_iBalance = m_iVolume * (BAL_MAX / 2) / t; m_iVolume = t * VOL_MAX / OSS_VOL_MAX; } //printf("GET VOLUME %d BALANCE %d\n", m_iVolume, m_iBalance); break; case SET: t = m_iVolume * OSS_VOL_MAX / VOL_MAX; if (m_iBalance < (BAL_MAX / 2)) t = ((t * m_iBalance / (BAL_MAX / 2)) << 8) + t; else t = (t << 8) + t * (BAL_MAX - m_iBalance) / (BAL_MAX / 2); //printf("SETVOL %x\n", t); ioctl(m_iMixFd, SOUND_MIXER_WRITE_PCM, &t); break; } r = 0; } } return r; } void* OssAudioRenderer::doAudioOut(void* arg) { OssAudioRenderer& a = *(OssAudioRenderer*)arg; a.m_pQueue->Lock(); while (!a.m_bQuit) { size_t wsize = a.m_pQueue->GetSize(); audio_buf_info zz; ioctl(a.m_iAudioFd, SNDCTL_DSP_GETOSPACE, &zz); //AVM_WRITE("audio renderer", "ospace %d %d frag %d fsize %d\n", zz.bytes, // zz.fragments*zz.fragsize, zz.fragments, zz.fragsize); zz.fragments *= zz.fragsize; // checking for EOF to avoid busy loop if (!a.m_bInitialized || a.m_bPaused || (wsize < a.m_uiWriteSize && (!wsize || !a.m_pAudiostream->Eof())) || zz.fragments == 0) { //printf("WAIT1 %d %d\n", a.m_bPaused, a.m_pQueue->GetSize()); //printf("OSSSLEEP %d %d %d %d\n", wsize, a.m_pAudiostream->Eof(), a.m_bInitialized, a.m_bPaused); a.m_pQueue->Wait(0.02f); continue; } if (wsize > a.m_uiWriteSize) wsize = a.m_uiWriteSize; #if 0 static int64_t las = avm_get_time_us(); int64_t tlas = avm_get_time_us(); AVM_WRITE("OSS audio renderer", "diff %f %f\n", avm_get_time_diff(tlas, las), a.getRendererBufferTime()); las = tlas; #endif ssize_t result = a.m_pQueue->Read(0, wsize, &a.m_AudioMix); //printf("wtime %f %f\n", avm_get_time_diff(avm_get_time_us(), ct), avm_get_time_diff(avm_get_time_us(), a.m_lTimeStart) ); //AVM_WRITE("audio renderer", "Wrote %d bytes\n", result); if (result < (ssize_t) a.m_uiWriteSize) { if (result < 0) perror("AudioQueue::write"); else { // this should assure the we will actually // hear the very last bytes from buffer const uint_t sz = 32768/4; int r = 0; if (a.m_Owf.wBitsPerSample <= 8) r = 0x80808080; uint32_t* d = new uint32_t[sz]; if (d) { for (uint_t i = 0; i < sz; i++) d[i] = r; a.m_AudioMix.Mix(0, d, sz*4); delete[] d; } } } else a.updateTimer(); } a.m_pQueue->Unlock(); AVM_WRITE("OSS audio renderer", 1, "audio thread finished\n"); return 0; } int OssAudioRenderer::reset() { int tmp; if (m_pAudioThread && m_Owf.wFormatTag != 0x01) return 0; // avoid RESET for AC3 passthrough code #ifdef SNDCTL_DSP_RESET ioctl(m_iAudioFd, SNDCTL_DSP_RESET, 0); #endif tmp = (8 << 16) | 12; // 16 frags of 2^12 bytes ioctl(m_iAudioFd, SNDCTL_DSP_SETFRAGMENT, &tmp); tmp = m_Owf.nChannels - 1; if (ioctl(m_iAudioFd, SNDCTL_DSP_STEREO, &tmp) != 0 || tmp != (m_Owf.nChannels - 1)) { AVM_WRITE("OSS audio renderer", "WARNING: ioctl(stereo) (%d != %d)\n", tmp, (m_Owf.nChannels - 1)); return -1; } tmp = m_Owf.wBitsPerSample; if (ioctl(m_iAudioFd, SNDCTL_DSP_SAMPLESIZE, &tmp) < 0) { AVM_WRITE("OSS audio renderer", "WARNING: ioctl(samplesize)\n"); return -1; } tmp = (m_uiUseFreq) ? m_uiUseFreq : m_Owf.nSamplesPerSec; if (ioctl(m_iAudioFd, SNDCTL_DSP_SPEED, &tmp) != 0) { AVM_WRITE("OSS audio renderer", "WARNING: ioctl(speed)\n"); return -1; } return 0; } double OssAudioRenderer::getRendererBufferTime() const { if (m_Owf.wFormatTag != 0x01) return 0.0; // to be solved - problems with SBLive and AC3 audio_buf_info zz; int r; switch (m_iDelayMethod) { case 2: #ifdef SNDCTL_DSP_GETODELAY if (ioctl(m_iAudioFd, SNDCTL_DSP_GETODELAY, &r) != -1) break; #endif m_iDelayMethod--; // fallback if not supported case 1: if (ioctl(m_iAudioFd, SNDCTL_DSP_GETOSPACE, &zz) != -1) { r = m_iSndLimit - zz.bytes; break; } m_iDelayMethod--; // fallback if not supported default: r = m_iSndLimit; // full buffer } #if 0 count_info info; if (ioctl(m_iAudioFd, SNDCTL_DSP_GETOPTR, &info) != -1) { printf("GETOPTR %f %f %f %d %d %d\n", info.bytes / m_dOwfBPS, avm_get_time_diff(avm_get_time_us(), m_lTimeStart), m_dAudioRealpos, info.bytes, info.blocks, info.ptr); } #endif //AVM_WRITE("audio renderer", "GETRENDER %f %d %d\n", r / (double) m_pQueue->GetBytesPerSec(), r, m_pQueue->GetBytesPerSec()); return r / (double) m_pQueue->GetBytesPerSec(); } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviplay/OssAudioRenderer.h0000644000175000017500000000257211164657377021571 0ustar yavoryavor#ifndef AVIFILE_OSSAUDIORENDERER_H #define AVIFILE_OSSAUDIORENDERER_H #include "IAudioRenderer.h" #include "AudioQueue.h" AVM_BEGIN_NAMESPACE; class OssAudioMix : public IAudioMix { public: int m_iFd; OssAudioMix() : m_iFd(-1) {} virtual ssize_t Mix(void* data, const void* src, size_t n) const; }; class OssAudioRenderer: public IAudioRenderer { static const int OSS_VOL_MAX = 100; enum Act { GET, SET }; public: OssAudioRenderer(IReadStream* as, WAVEFORMATEX& Owf, uint_t useFreq = 0) :IAudioRenderer(as, Owf), m_pAudioThread(0), m_iAudioFd(-1), m_iMixFd(-1), m_uiUseFreq(useFreq), m_iDelayMethod(2) {} ~OssAudioRenderer(); virtual int Init(); virtual int GetBalance(); virtual int GetVolume(); virtual int SetBalance(int balance); virtual int SetVolume(int volume); protected: // length of sound in OSS buffer virtual double getRendererBufferTime() const; virtual int reset(); int mixer(Act a); static void* doAudioOut(void* arg); PthreadTask* m_pAudioThread; // Writes data to audio_fd OssAudioMix m_AudioMix; int m_iAudioFd; // /dev/dsp or ESD socket ( syntactically the same behaviour ) int m_iMixFd; // /dev/mixer uint_t m_iSndLimit; // DMA buffer size uint_t m_uiWriteSize; uint_t m_uiUseFreq; mutable int m_iDelayMethod; }; AVM_END_NAMESPACE; #endif // AVIFILE_OSSAUDIORENDERER_H avifile-0.7.48~20090503.ds/lib/aviplay/SdlAudioRenderer.cpp0000644000175000017500000001146711164657377022105 0ustar yavoryavor#include "SdlAudioRenderer.h" #include "avifile.h" #include "avm_cpuinfo.h" #include "avm_output.h" #include #include #include #include #ifndef SDL_VERSIONNUM #define SDL_VERSIONNUM(X, Y, Z) (X)*1000 + (Y)*100 + (Z) #endif #define _SDL_VER SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) AVM_BEGIN_NAMESPACE; class SdlAudioMix : public IAudioMix { int m_iVolume; public: SdlAudioMix() { SetVolume(); } virtual ssize_t Mix(void* data, const void* src, size_t n) const { // SDL should use const pointer for src if (m_iVolume != SDL_MIX_MAXVOLUME) SDL_MixAudio((Uint8*) data, (Uint8*) src, (Uint32) n, m_iVolume); else memcpy(data, src, n); return n; } void SetVolume(int volume = SDL_MIX_MAXVOLUME) { m_iVolume = volume; } }; int SdlAudioRenderer::Init() { for (;;) { sdl_systems = 0; #if _SDL_VER < 1103 SDL_Init(SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE); #else Uint32 subsystem_init = SDL_WasInit(SDL_INIT_EVERYTHING); if (subsystem_init == 0) { SDL_Init(SDL_INIT_NOPARACHUTE); atexit(SDL_Quit); } if (!(subsystem_init & SDL_INIT_AUDIO)) { if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) { AVM_WRITE("SDL audio renderer", "failed to init SDL_AUDIO!\n"); break; } sdl_systems |= SDL_INIT_AUDIO; } #endif if (m_Owf.wFormatTag != 0x01) { AVM_WRITE("SDL audio renderer", "unsupported audio format 0x%x!\n", m_Owf.wFormatTag); break; } SDL_AudioSpec spec; SDL_AudioSpec m_Spec; memset(&spec, 0, sizeof(spec)); // keep quiet memory validator spec.freq = (m_uiUseFreq) ? m_uiUseFreq : m_Owf.nSamplesPerSec; spec.format = (m_Owf.wBitsPerSample == 16) ? (uint16_t)AUDIO_S16 : (uint16_t)AUDIO_U8; spec.channels = (uint8_t) m_Owf.nChannels; spec.samples = 2048; // 1024 causes drops on busy system // if (m_Owf.nChannels == 1) spec.samples *= 2; // shorter buffer generates more interrupts // and would give us more precise timing - // on the other hand it's more sensitive to the system load // for slowly moving sound - shorter buffer is better spec.callback = fillAudio; spec.userdata = this; //printf("SDL freq:%d fmt:0x%x ch:%d s:%d\n", spec.freq, spec.format, spec.channels, spec.samples); // to simulate broken audio card // spec.freq += -1000; if (SDL_OpenAudio(&spec, &m_Spec) < 0) { SDL_CloseAudio(); AVM_WRITE("SDL audio renderer", "%s!\n", SDL_GetError()); break; } AVM_WRITE("SDL audio renderer", 1, "error: %s\n", SDL_GetError()); m_dSpecTime = m_Spec.size/(double) m_pQueue->GetBytesPerSec(); m_pAudiomix = new SdlAudioMix(); AVM_WRITE("SDL audio renderer", 0, "buffer size: %d %dHz\n", m_Spec.size, m_Spec.freq); return 0; } return -1; } SdlAudioRenderer::~SdlAudioRenderer() { AVM_WRITE("SDL audio renderer", 2, "destroy()\n"); m_pQueue->Lock(); m_bQuit = true; m_bInitialized = false; m_pQueue->Unlock(); m_pQueue->Broadcast(); delete m_pAudiomix; SDL_CloseAudio(); #if _SDL_VER > 1102 //we can't call SDL_Quit() for older SDL - causes crash if (sdl_systems & SDL_INIT_AUDIO) SDL_QuitSubSystem(sdl_systems); #endif AVM_WRITE("SDL audio renderer", 2, "destroy() successful\n"); } int SdlAudioRenderer::SetVolume(int volume) { int hr = IAudioRenderer::SetVolume(volume); if (hr == 0) m_pAudiomix->SetVolume(volume * SDL_MIX_MAXVOLUME / VOL_MAX); return hr; } void SdlAudioRenderer::fillAudio(void* userdata, unsigned char* stream, int len) { //AVM_WRITE("SDL audio renderer", 3, "fillAudio()\n"); SdlAudioRenderer& a = *(SdlAudioRenderer*)userdata; a.m_pQueue->Lock(); while (!a.m_bQuit && a.m_bInitialized) { if (a.m_pQueue->GetSize() < unsigned(len)) { //printf("EOF: %d\n", a.m_pAudiostream->Eof()); memset(stream, 0, len); if (a.m_pAudiostream->Eof()) { // play the rest len = (int) a.m_pQueue->GetSize(); if (len == 0) break; } else { // wait for buffer being filled a.m_pQueue->Wait(0.01f); continue; } } #if 0 int64_t ct = avm_get_time_us(); static int64_t las = ct; AVM_WRITE("SDL audio renderer", "diff %f\n", avm_get_time_diff(ct, las)); las = ct; #endif a.m_pQueue->Read(stream, len, a.m_pAudiomix); a.updateTimer(); #if 0 SDL_AudioSpec spec; spec.freq = (a.m_uiUseFreq) ? a.m_uiUseFreq : a.m_Owf.nSamplesPerSec; spec.format = (a.m_Owf.wBitsPerSample == 16) ? AUDIO_S16 : AUDIO_U8; spec.channels = a.m_Owf.nChannels; AVM_WRITE("SDL audio renderer", "OLDAUDIO freq:%d format:%d channels:%d\n", a.m_Spec.freq, a.m_Spec.format, a.m_Spec.channels); AVM_WRITE("SDL audio renderer", "NEWAUDIO freq:%d format:%d channels:%d\n", spec.freq, spec.format, spec.channels); #endif break; } a.m_pQueue->Unlock(); } void SdlAudioRenderer::pause(int v) { SDL_PauseAudio(v); } #undef _SDL_VER AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviplay/SdlAudioRenderer.h0000644000175000017500000000141707566140576021543 0ustar yavoryavor#ifndef AVIFILE_SDLAUDIORENDERER_H #define AVIFILE_SDLAUDIORENDERER_H #include "IAudioRenderer.h" #include "AudioQueue.h" AVM_BEGIN_NAMESPACE; class SdlAudioMix; class SdlAudioRenderer: public IAudioRenderer { public: SdlAudioRenderer(IReadStream* as, WAVEFORMATEX& owf, uint_t useFreq = 0) :IAudioRenderer(as, owf), m_pAudiomix(0), m_uiUseFreq(useFreq) {} virtual ~SdlAudioRenderer(); virtual int Init(); virtual int SetVolume(int volume); protected: virtual void pause(int v); // C binding - used for SDL callback static void fillAudio(void* userdata, unsigned char* stream, int len); SdlAudioMix* m_pAudiomix; uint_t sdl_systems; double m_dSpecTime; uint_t m_uiUseFreq; }; AVM_END_NAMESPACE; #endif // AVIFILE_SDLAUDIORENDERER_H avifile-0.7.48~20090503.ds/lib/aviplay/SunAudioRenderer.cpp0000644000175000017500000001306307651224402022103 0ustar yavoryavor/********************************************************* SunAudioRenderer implementation *********************************************************/ #include "SunAudioRenderer.h" #ifdef HAVE_SUNAUDIO #include "avifile.h" #include "except.h" #include "cpuinfo.h" #include "utils.h" #include "avm_output.h" #include #include #include #include #include #include #include #define Debug #define __MODULE__ "SunAudioRenderer" AVM_BEGIN_NAMESPACE; int SunAudioMix::Mix(void* data, const void* src, uint_t n) const { return ::write(m_iFd, src, n); } SunAudioRenderer::SunAudioRenderer(IAviReadStream* as, WAVEFORMATEX& Owf, const char* privcname) :IAudioRenderer(as, Owf), m_iAudioFd(-1), m_pAudioMix(0) { try { int audio_status = m_pAudiostream->StartStreaming(); if(audio_status != 0) throw FATAL("Failed to start streaming"); m_pAudiostream->GetOutputFormat(&m_Owf, sizeof m_Owf); // Debug std::cout << "Audio format " << m_Owf.nSamplesPerSec // << "/" << m_Owf.wBitsPerSample // << "/" << ((m_Owf.nChannels != 1) ? "stereo" : "mono") // << endl; m_iAudioFd = open("/dev/audio", O_WRONLY|O_NDELAY); if(m_iAudioFd < 0) throw FATAL("Can't open audio device"); // m_bForce44KHz = RegAccess::ReadForce44KHz(); // if(m_Owf.nSamplesPerSec == 44100 && m_bForce44KHz) // m_bForce44KHz = false; audio_info_t audio_info; AUDIO_INITINFO(&audio_info); audio_info.play.channels = m_Owf.nChannels; audio_info.play.precision = m_Owf.wBitsPerSample; audio_info.play.sample_rate = 0 // m_bForce44KHz ? 44100 : m_Owf.nSamplesPerSec; audio_info.play.encoding = m_Owf.wBitsPerSample == 8 ? AUDIO_ENCODING_LINEAR8 : AUDIO_ENCODING_LINEAR; audio_info.play.samples = 0; if(ioctl(m_iAudioFd, AUDIO_SETINFO, &audio_info) < 0) { char failure_msg[80]; sprintf(failure_msg, "ioctl(AUDIO_SETINFO) failed: chnl=%d, prec=%d, rate=%d, enc=%d", audio_info.play.channels, audio_info.play.precision, audio_info.play.sample_rate, audio_info.play.encoding); throw FATAL(failure_msg); } m_pAudioMix = new SunAudioMix(m_iAudioFd); } catch(FatalError& error) { if(m_iAudioFd > 0) ::close(m_iAudioFd); m_iAudioFd = -1; m_pAudiostream = 0; throw; } m_iSamplesSent = 0; m_pAudioThread = new PthreadTask(0, doAudioOut, (void*)this); } SunAudioRenderer::~SunAudioRenderer() { //Debug cout<<"Destroying audio renderer"<Lock(); m_bQuit = true; m_pQueue->Broadcast(); m_pQueue->Unlock(); delete m_pAudioThread; delete m_pAudioMix; reset(); ::close(m_iAudioFd); //Debug cout<<"Destroy() successful"<GetSize(), m_iSamplesSent, audio_info.play.samples, m_iSamplesSent - audio_info.play.samples, m_pQueue->GetBufferTime()); } return frame_time / rate; } void* SunAudioRenderer::doAudioOut(void* arg) { SunAudioRenderer& a = *(SunAudioRenderer*) arg; int reset_dev = 0; while (!a.m_bQuit) { if (!a.m_bInitialized) { a.m_pQueue->Lock(); if (reset_dev) { a.m_pQueue->Clear(); a.reset(); reset_dev = 0; } else { AVM_WRITE("audio renderer", 0, "not yet m_bInitialized\n"); a.m_pQueue->Wait(); } a.m_pQueue->Unlock(); continue; } else reset_dev=1; a.m_pQueue->Lock(); if (a.m_pQueue->GetSize() < a.m_uiWriteSize || a.m_bPaused ) { if (!a.m_bQuit) a.m_pQueue->Wait(); a.m_pQueue->Unlock(); continue; } int result = a.m_pQueue->Read(0, 8192, a.m_pAudioMix); if (result < 0) perror("AudioQueue::write"); else a.updateTimer(); a.m_pQueue->Unlock(); } AVM_WRITE("audio renderer", 1, "Exiting audio thread\n"); return 0; } void SunAudioRenderer::pause(int state) { AVM_WRITE("audio renderer", 1, "SunAudioRenderer::pause %d\n", state); audio_info_t audio_info; AUDIO_INITINFO(&audio_info); audio_info.play.pause = state; ::ioctl(m_iAudioFd, AUDIO_SETINFO, &audio_info); AVM_WRITE("audio renderer", 1, "Samples buffered in audio_queue %f\n", m_pQueue->GetBufferTime()); } int SunAudioRenderer::reset() { if (m_iAudioFd) { /* * clear data in the STREAMS queue, and wait for * playback end. Make sure the audio device is not * 'paused' state, else the AUDIO_DRAIN ioctl hangs * forever. */ ioctl(m_iAudioFd, I_FLUSH, FLUSHW); audio_info_t audio_info; AUDIO_INITINFO(&audio_info); audio_info.play.pause = 0; ioctl(m_iAudioFd, AUDIO_SETINFO, &audio_info); ioctl(m_iAudioFd, AUDIO_DRAIN, 0); AUDIO_INITINFO(&audio_info); audio_info.play.samples = 0; ioctl(m_iAudioFd, AUDIO_SETINFO, &audio_info); m_iSamplesSent = 0; return 0; } return -1; } AVM_END_NAMESPACE; #endif // HAVE_SUNAUDIO avifile-0.7.48~20090503.ds/lib/aviplay/SunAudioRenderer.h0000644000175000017500000000204207647107202021546 0ustar yavoryavor#ifndef AVIFILE_SUNAUDIORENDERER_H #define AVIFILE_SUNAUDIORENDERER_H #include "IAudioRenderer.h" #include "AudioQueue.h" #ifdef HAVE_SUNAUDIO AVM_BEGIN_NAMESPACE; class SunAudioMix : public IAudioMix { int m_iFd; public: SunAudioMix(int fd) : m_iFd(fd) {} virtual int Mix(void* data, const void* src, uint_t n) const; }; class SunAudioRenderer: public IAudioRenderer { public: SunAudioRenderer(IReadStream* stream, WAVEFORMATEX& Owf, const char* cname = 0); ~SunAudioRenderer(); virtual int SetVolume(int volume); //restart thread if it waits protected: virtual double getRendererBufferTime() const; virtual int reset(); virtual void pause(int state); static void* doAudioOut(void* arg); int m_iAudioFd; // /dev/audio file descriptor PthreadTask* m_pAudioThread;// writes data to audio_fd SunAudioMix* m_pAudioMix; uint_t m_iSamplesSent; // number of samples written to device uint_t m_uiWriteSize; }; AVM_END_NAMESPACE; #endif // HAVE_SUNAUDIO #endif // AVIFILE_SUNAUDIORENDERER_H avifile-0.7.48~20090503.ds/lib/aviplay/aviplay.cpp0000644000175000017500000005763211174175660020352 0ustar yavoryavor/******************************************************** AVI player object Copyright 2000 Eugene Kuznetsov (divx@euro.ru) *********************************************************/ #include "aviplay_impl.h" #ifdef HAVE_LIBSDL #include "SdlAudioRenderer.h" #endif #ifdef HAVE_OSS #include "OssAudioRenderer.h" #endif #ifdef HAVE_SUNAUDIO #include "SunAudioRenderer.h" #endif #include "CopyAudioRenderer.h" #include "avm_cpuinfo.h" #include "avm_creators.h" #include "avm_fourcc.h" #include "avm_output.h" #include "utils.h" #include // geteuid #include // memcpy #include // getenv, free() #include AVM_BEGIN_NAMESPACE; #define __MODULE__ "IAviPlayer" //int AVIPLAY_DEBUG = 0; //#undef Debug //#define Debug if(AVIPLAY_DEBUG) #undef min #define min(X,Y) ((X)<(Y)?(X):(Y)) AviPlayer::AviPlayer(const char* filename, int depth, const char* subname, int flags, const char* vcodec, const char* acodec) : m_pAudioRenderer(0), m_pKillhandler(0), m_pAudiofunc(0), m_pClip(0), m_pClipAudio(0), m_pVideostream(0), m_pAudiostream(0), m_Drop("Drop", 50), m_Quality("Quality", 25), m_Filename(filename), m_Subfilename(subname ? subname : ""), m_pSubtitles(0), m_pSubline(0), m_fAsync(0.), m_fSubAsync(0.), m_iMaxAuto(0), m_iFramesVideo(0), m_iFrameDrop(0), m_iLockCount(0), m_llTimeStart(0), m_dFrameStart(0), m_dLastFrameStart(0), m_dLastAudioSync(0.), m_fLastDiff(0.f), m_fLastSyncTime(0.f), m_fLastSleepTime(0.f), m_pVideoThread(0), m_pAudioThread(0), m_pDecoderThread(0), m_uiPgPrevPos(~0U), m_llPgPrevTime(0), m_dVframetime(0.04), m_iWidth(0), m_iHeight(0), m_iDepth(depth), m_CSP(24), m_bQualityAuto(false), m_bVideoBuffered(false), m_bVideoDirect(false), m_bDropping(false), m_bPaused(false), m_bInitialized(false), m_bQuit(false), m_bHangup(false), m_bBuffering(false), m_bCallSync(false), m_bConstructed(false) { if (vcodec && strlen(vcodec)) m_vcodec = vcodec; if (acodec && strlen(acodec)) m_acodec = acodec; memset(propertyRead, 0, sizeof(propertyRead)); // remember effective ids at the creation time of the object // and use the real user id until we really need the euid m_iEffectiveUid = geteuid(); m_iEffectiveGid = getegid(); if ((int) getuid() != (int) m_iEffectiveUid) seteuid(getuid()); if ((int) getgid() != (int) m_iEffectiveGid) setegid(getgid()); //m_bAudioMute = (getenv("AVIPLAY_MUTE_AUDIO") != 0); m_bVideoMute = (getenv("AVIPLAY_MUTE_VIDEO") != 0) ? true : false; m_bVideoAsync = (getenv("AVIPLAY_VIDEO_ASYNC") != 0) ? true : false; const char* ad = getenv("AVIPLAY_DEBUG"); if (ad) { int AVIPLAY_DEBUG = atoi(ad); if (AVIPLAY_DEBUG) { AvmOutput()->setDebugLevel("aviplayxx", 4); AVM_WRITE("aviplay", "Debug is on %d\n", AVIPLAY_DEBUG); } } if (m_bVideoAsync) AVM_WRITE("aviplay", 1, "Video is running asynchronously\n"); m_pClip = CreateReadFile(filename, flags); } AviPlayer::~AviPlayer() { Stop(); assert(!m_bQuit); m_bQuit = true; if (!IsRedirector()) { if (m_pVideostream) m_pVideostream->StopStreaming(); if (m_pAudiostream) m_pAudiostream->StopStreaming(); while (!m_bInitialized) unlockThreads(); delete m_pVideoThread; delete m_pDecoderThread; delete m_pAudioThread; } if (m_pClipAudio) { AVM_WRITE("aviplay", "Closing audio clip\n"); delete m_pClipAudio; } if (m_pClip) { AVM_WRITE("aviplay", "Closing clip\n"); delete m_pClip; } while (m_VideoRenderers.size() > 0) { delete m_VideoRenderers.back(); m_VideoRenderers.pop_back(); } if (m_iFramesVideo) AVM_WRITE("aviplay", "Played %d video frames ( %f%% drop )\n", m_iFramesVideo, (float)m_iFrameDrop * 100.f / (float)m_iFramesVideo); if (m_pSubtitles) subtitle_close(m_pSubtitles); if (m_pSubline) subtitle_line_free(m_pSubline); } void AviPlayer::construct() { if (IsRedirector()) { AVM_WRITE("aviplay", "Redirector\n"); return; } int def_audio, def_video, asynctm, avol, subasync; Get(AUDIO_STREAM, &def_audio, VIDEO_STREAM, &def_video, ASYNC_TIME_MS, &asynctm, SUBTITLE_ASYNC_TIME_MS, &subasync, AUDIO_VOLUME, &avol, 0); m_iWidth = 0; m_iHeight = 0; m_fAsync = (float)asynctm / 1000.f; m_fSubAsync = (float)subasync / 1000.f; //fprintf(stderr, "MP0 audio %p\n", m_pVideostream); while (!m_pAudiostream && def_audio >= 0) m_pAudiostream = m_pClip->GetStream(def_audio--, IReadStream::Audio); // Initialize audio - thread from SDL is initialized here if (m_pAudiostream == 0) AVM_WRITE("aviplay", "Audiostream not detected\n"); //fprintf(stderr, "MP0 construct %p\n", m_pVideostream); if (!m_bVideoMute && m_iDepth) { // >128 will try to 'touch' all streams int o = def_video; while ((!m_pVideostream || o > 128) && def_video >= 0) m_pVideostream = m_pClip->GetStream(def_video--, IReadStream::Video); } else { m_pVideostream = 0; AVM_WRITE("aviplay", "Video disabled\n"); } // check if it's still valid // might not be in the case of network stream m_pClip->IsValid(); Get(VIDEO_QUALITY_AUTO, &m_bQualityAuto, VIDEO_DROPPING, &m_bVideoDropping, VIDEO_BUFFERED, &m_bVideoBuffered, VIDEO_DIRECT, &m_bVideoDirect, 0); if (!m_pVideostream) AVM_WRITE("aviplay", "Videostream not detected\n"); else { //printf("VSTREAMTIME %f\n", m_pVideostream->GetTime()); // reading subtitles avm::string fn(m_Filename, m_Filename.rfind('.')); InitSubtitles(m_Subfilename.size() ? m_Subfilename.c_str() : fn.c_str()); if (restartVideoStreaming(m_vcodec.size() ? m_vcodec.c_str() : 0) == 0) createVideoRenderer(); } m_iFramesVideo = 0; m_iFrameDrop = 0; m_llTimeStart = 0; m_bQuit = false; m_bConstructed = true; // short fs; // __asm__ __volatile__ ("movw %%fs, %%ax":"=a"(fs)); // cout<<"Before pthread_create: fs is "<GetVideoDecoder()) return -1; //cout << "SET COLOR SPACE " << hex << csp << dec << " " << test_only << endl; if (!test_only) return m_pVideostream->GetVideoDecoder()->SetDestFmt(0, csp); IVideoDecoder::CAPS cap; switch (csp) { case fccYUY2: cap = IVideoDecoder::CAP_YUY2; break; case fccI420: cap = IVideoDecoder::CAP_I420; break; case fccYV12: cap = IVideoDecoder::CAP_YV12; break; case fccIYUV: cap = IVideoDecoder::CAP_IYUV; break; case fccUYVY: cap = IVideoDecoder::CAP_UYVY; break; case fccYVYU: cap = IVideoDecoder::CAP_YVYU; break; default: cap = IVideoDecoder::CAP_NONE; } return !(m_pVideostream->GetVideoDecoder()->GetCapabilities() & cap); } int AviPlayer::InitSubtitles(const char* filename) { if (lockThreads("InitSubtitles") == 0) { if (m_pSubtitles) subtitle_close(m_pSubtitles); char* fn = NULL; int fd = subtitle_filename(filename, &fn); if (fd >= 0) { char* cp; Get(SUBTITLE_CODEPAGE, &cp, 0); m_pSubtitles = subtitle_open(fd, GetFps(), cp); if (fn) { AVM_WRITE("aviplay", "Subtitles from: %s (codepage: %s)\n", fn, cp); free(fn); } if (cp) free(cp); } unlockThreads(); } return 0; } const char* AviPlayer::GetAudioFormat() const { return (m_pAudioRenderer) ? m_pAudioRenderer->GetAudioFormat() : 0; } const char* AviPlayer::GetVideoFormat() const { return (m_pVideostream) ? GetCodecInfo().GetName() : 0; } StreamInfo* AviPlayer::GetAudioStreamInfo() const { return (m_pAudiostream) ? m_pAudiostream->GetStreamInfo() : 0; } StreamInfo* AviPlayer::GetVideoStreamInfo() const { return (m_pVideostream) ? m_pVideostream->GetStreamInfo() : 0; } const CodecInfo& AviPlayer::GetCodecInfo(int type) const { if (type == AUDIO_CODECS) return m_pAudiostream->GetAudioDecoder()->GetCodecInfo(); return m_pVideostream->GetVideoDecoder()->GetCodecInfo(); } const subtitle_line_t* AviPlayer::GetCurrentSubtitles() { if (!m_pSubtitles) return 0; if (m_pSubline == 0) { m_pSubline = subtitle_line_new(); if (m_pSubline == 0) return 0; } if (subtitle_get(m_pSubline, m_pSubtitles, GetTime() + m_fSubAsync) != 0) return 0; return m_pSubline; } bool AviPlayer::HasSubtitles() const { return (m_pSubtitles && subtitle_get_lines(m_pSubtitles) > 0); } void AviPlayer::Start() { AVM_WRITE("aviplay", 1, "AviPlayer::Start()\n"); if (!IsValid() || IsRedirector()) return; //printf("CONSTRUCT %d %d i: %d p: %d\n", IsValid(), IsRedirector(), m_bInitialized, m_bPaused); if (!m_bConstructed) construct(); if (IsPlaying()) { AVM_WRITE("aviplay", "AviPlayer::Start(), already started\n"); return; } createAudioRenderer(); if (m_pAudioRenderer) m_pAudioRenderer->Start(); else if (!m_pVideostream) return; // nothing to do m_llLastTimeStart = avm_get_time_us(); m_Drop.clear(); m_bQuit = false; m_bPaused = false; m_bBuffering = false; unlockThreads(); } void AviPlayer::Stop() { AVM_WRITE("aviplay", 1, "AviPlayer::Stop()\n"); if (!IsPlaying()) return; if (m_bPaused || lockThreads("Stop") == 0) { delete m_pAudioRenderer; m_pAudioRenderer = 0; m_bPaused = false; if (m_pKillhandler) m_pKillhandler(0, m_pKillhandlerArg); if (m_pVideostream) m_pVideostream->SeekTime(0);//0x7fffffff); if (m_pAudiostream) m_pAudiostream->SeekTime(0);//x7fffffff); } } void AviPlayer::Pause(bool state) { AVM_WRITE("aviplay", 1, "AviPlayer::pause() ( %d -> %d )\n", m_bPaused, state); if (!IsPlaying()) return; if (m_bPaused == state) return; if (state) { lockThreads("Pause"); if (m_pAudioRenderer) m_pAudioRenderer->Pause(state); m_bPaused = state; m_bBuffering = true; } else { if (m_pAudioRenderer && (m_pAudioRenderer->Pause(state) != 0)) return; m_bPaused = state; m_bBuffering = false; unlockThreads(); } } void AviPlayer::Play() { AVM_WRITE("aviplay", 1, "AviPlayer::Play() ( %d )\n", m_bPaused); if (!IsPlaying()) return; if (m_bPaused) Pause(!m_bPaused); } double AviPlayer::GetTime() const { if (m_pVideostream && !m_pVideostream->Eof()) { // this is bit more complicated so here goes light explanation: // Asf file can display the same frame for 5 second - and // it doesn't look good when we show jumping numbers // so we pick the last remebered frame time and we are // calculating time from this frame - we should be preserving // this speed - for paused mode we display time for currently // displayed frame double len = m_pVideostream->GetLengthTime(); if (len > 0.) { double t = m_pVideostream->GetTime(); if (m_pAudioRenderer && !m_pAudioRenderer->Eof()) { double at = m_pAudioRenderer->GetTime(); if ((t - at) > 5.) t = at; } return t; } } return (m_pAudioRenderer) ? m_pAudioRenderer->GetTime() : 0.; } double AviPlayer::GetLengthTime() const { double len = GetVideoLengthTime(); double alen = GetAudioLengthTime(); return (alen > len) ? alen : len; } framepos_t AviPlayer::GetFramePos() const { return (m_pVideostream) ? m_pVideostream->GetPos() : 0; } double AviPlayer::Reseek(double pos) { AVM_WRITE("aviplay", 1, "Seek pos: %f %" PRIsz "\n", pos, m_VideoRenderers.size()); if (!IsPlaying()) return -1; if (lockThreads("Reseek") == 0) { if (m_pVideostream) { pos = m_pVideostream->SeekTimeToKeyFrame(pos); AVM_WRITE("aviplay", 1, "Keyframe pos: %f\n", pos); if (m_bPaused) drawFrame(false); } if (m_pAudioRenderer) m_pAudioRenderer->SeekTime(pos); m_Drop.clear(); unlockThreads(); } return pos; } int AviPlayer::ReseekExact(double pos) { if (!IsPlaying()) return -1; // we might not need this in future int r = 0; if (lockThreads("ReseekExact") == 0) { AVM_WRITE("aviplay", 1, "Reseek pos: %f %p %" PRIsz "\n", pos, m_pVideoThread, m_VideoRenderers.size()); double pos2 = pos; if (m_pVideostream) { double cft = m_pVideostream->GetTime(); double nkft = m_pVideostream->GetTime(m_pVideostream->GetNextKeyFrame()); //printf("TIMES %f %f\n", cft, nkft); if (cft < pos && pos < nkft) { // do nothing unlockThreads(); return 0; } pos2 = m_pVideostream->SeekTimeToKeyFrame(pos); //printf("TIMESPOS2 %f \n", pos2); // in case the video is delayed and doesn't start at 0.0s if (pos < (m_pVideostream->GetTime(0) - 0.001) || pos > m_pVideostream->GetLengthTime()) { pos2 = pos; //printf("TIMESPOS3 %f %f %f %f\n", pos2, pos, m_pVideostream->GetTime(0), m_pVideostream->GetLengthTime()); } } AVM_WRITE("aviplay", 1, "Seek OK ( %fs -> %fs )\n", pos, pos2); if (pos2 < 0.) { pos2 = pos = 0.; AVM_WRITE("aviplay", "Warning: reseek_exact pos2<0!\n"); r = -1; } if (m_pVideostream) { if (pos2 > pos && pos2 > (m_pVideostream->GetTime(0) + 0.001)) { AVM_WRITE("aviplay", "Warning: reseek_exact: pos2>pos! %f %f %f\n", pos2, pos, m_pVideostream->GetTime(0)); r = -1; } drawFrame(false); } if (m_pAudioRenderer) { AVM_WRITE("aviplay", 1, "Seek Audio ( %fs )\n", pos2); m_pAudioRenderer->SeekTime(pos2); // might be different from vpos } m_Drop.clear(); unlockThreads(); } return r; } int AviPlayer::NextKeyFrame() { if (!IsPlaying()) return -1; int r = 0; if (lockThreads("NextKeyFrame") == 0) { if (m_pVideostream) { m_pVideostream->SeekToNextKeyFrame(); drawFrame(); } else if (m_pAudioRenderer) m_pAudioRenderer->SeekTime(m_pAudioRenderer->GetTime() + 1.); unlockThreads(); } return r; } int AviPlayer::PrevKeyFrame() { if (!IsPlaying()) return -1; int r = 0; if (lockThreads("PrevKeyFrame") == 0) { if (m_pVideostream && m_pVideostream->GetPos()) { framepos_t cpos = m_pVideostream->GetPos(); framepos_t npos = m_pVideostream->SeekToPrevKeyFrame(); if (avm_get_time_diff(avm_get_time_us(), m_llPgPrevTime) < 0.3) { framepos_t p = npos; while (npos > 0 && npos >= m_uiPgPrevPos) { npos = m_pVideostream->SeekToPrevKeyFrame(); if (p == npos) break; } } if ((cpos - npos < 5) && !IsPaused()) { m_pVideostream->Seek(npos); npos = m_pVideostream->SeekToPrevKeyFrame(); } m_llPgPrevTime = avm_get_time_us(); m_uiPgPrevPos = npos; if (npos != m_pVideostream->ERR) { //m_pVideostream->SeekToKeyFrame(npos); double pos = m_pVideostream->GetTime(); if (m_pAudioRenderer) m_pAudioRenderer->SeekTime(pos > 0. ? pos : 0.); } drawFrame(); } else if (m_pAudioRenderer) m_pAudioRenderer->SeekTime(m_pAudioRenderer->GetTime() - 1.); unlockThreads(); } return r; } int AviPlayer::NextFrame() { if (!IsPlaying()) return -1; if (lockThreads("NextFrame") == 0) { drawFrame(); unlockThreads(); } return 0; } int AviPlayer::PrevFrame() { if (!IsPlaying()) return -1; if (lockThreads("PrevFrame") == 0) { if (m_pVideostream) { framepos_t cpos = m_pVideostream->GetPos(); framepos_t prev = cpos; m_pVideostream->SeekToPrevKeyFrame(); m_fDecodingTime = 1.f; setQuality(); if ((m_pVideostream->GetPos() + 2) < cpos) { //printf("GGP %d %d\n",m_pVideostream->GetPos(), cpos); while ((m_pVideostream->ReadFrame(false) == 0)) { //printf("npos %d\n", m_pVideostream->GetPos()); if ((m_pVideostream->GetPos() + 2) >= cpos) break; } if (m_pVideostream->GetPos() > cpos) { // there were some skiped frame - so jump to keyframe m_pVideostream->SeekToPrevKeyFrame(); } } //printf("RENDER %d %f %d\n", m_pVideostream->GetPos(), m_pVideostream->GetTime(), cpos); if (m_pVideostream->GetPos() < cpos || cpos == 0) drawFrame(); } unlockThreads(); } return 0; } IRtConfig* AviPlayer::GetRtConfig(int type) const { // maybe add lock ??? switch (type) { case AUDIO_CODECS: { IAudioDecoder* d = (m_pAudiostream) ? m_pAudiostream->GetAudioDecoder() : 0; // here is INCREDIBLE BUG in g++ 3.0.4 //IRtConfig* c = dynamic_cast(d) // so whole avifile now doesn't use dynamic_cast operator return (d) ? d->GetRtConfig() : 0; } case AUDIO_RENDERER: return 0; case VIDEO_CODECS: { IVideoDecoder* d = (m_pVideostream) ? m_pVideostream->GetVideoDecoder() : 0; return (d) ? d->GetRtConfig() : 0; } case VIDEO_RENDERER: return (m_VideoRenderers.size() > 0) ? m_VideoRenderers[0]->GetRtConfig() : 0; } return 0; } // used when we are in pause mode or the player is not playing int AviPlayer::drawFrame(bool aseek) { if (!m_bQuit && m_pVideostream) { CImage* im = m_pVideostream->GetFrame(true); // ReadFrame m_fLastDiff = 0.f; setQuality(); if (im) { const subtitle_line_t* sl = GetCurrentSubtitles(); for (size_t i = 0; i < m_VideoRenderers.size(); ++i) { m_VideoRenderers[i]->Draw(im); if (HasSubtitles()) m_VideoRenderers[i]->DrawSubtitles(sl); m_VideoRenderers[i]->Sync(); } m_Quality.insert(im->GetQuality() * 100.f); im->Release(); m_iFramesVideo++; } if (aseek && m_pAudioRenderer) m_pAudioRenderer->SeekTime(m_pVideostream->GetTime()); return 0; } return -1; } void AviPlayer::createAudioRenderer() { double origtime = (m_pAudioRenderer) ? m_pAudioRenderer->GetTime() : -1.; delete m_pAudioRenderer; m_pAudioRenderer = 0; if (!m_pAudiostream) return; WAVEFORMATEX MyOwf; memset(&MyOwf, 0, sizeof(MyOwf)); uint_t forcedFreq = 0; bool resamp; Get(AUDIO_RESAMPLING, &resamp, 0); if (resamp) { Get(AUDIO_RESAMPLING_RATE, &MyOwf.nSamplesPerSec, AUDIO_PLAYING_RATE, &forcedFreq, 0); } char* arend; Get(AUDIO_RENDERER, &arend, 0); if (!arend) return; m_pAudiostream->StopStreaming(); if (m_pAudiostream->StartStreaming(m_acodec.size() ? m_acodec.c_str() : 0)) return; char* arends = arend; while (arends && !m_pAudioRenderer) { WAVEFORMATEX Owf(MyOwf); AVM_WRITE("aviplay", "Will try audio renderers in this order: %s\n", arends); if (m_pAudiofunc) { // we could run this code sooner - but why... m_pAudioRenderer = new CopyAudioRenderer(m_pAudiostream, Owf, m_pAudiofunc, m_pAudiofuncArg); } else if (!strncasecmp(arends, "SDL", 3)) { #ifdef HAVE_LIBSDL m_pAudioRenderer = new SdlAudioRenderer(m_pAudiostream, Owf, forcedFreq); #else AVM_WRITE("aviplay", "Warning: SDL audio renderer unavailable!\n"); #endif } else if (!strncasecmp(arends, "OSS", 3)) { #ifdef HAVE_OSS m_pAudioRenderer = new OssAudioRenderer(m_pAudiostream, Owf, forcedFreq); #else AVM_WRITE("aviplay", "Warning: OSS audio renderer unavailable!\n"); #endif } else if (!strncasecmp(arends, "SUN", 3)) { #ifdef HAVE_SUNAUDIO AVM_WRITE("aviplay", "Warning: Sun audio renderer out of date - update me!\n"); m_pAudioRenderer = new SunAudioRenderer(m_pAudiostream, Owf); #else AVM_WRITE("aviplay", "Warning: Sun audio renderer unavailable!\n"); #endif } else if (!strncasecmp(arends, "noaudio", 5)) { if (strlen(arend) < 6) { AVM_WRITE("aviplay", "--- 'noaudio' audio renderer selected - if this is unintentional\n"); AVM_WRITE("aviplay", "--- please remove ~/.avm directory and default renderer set will be used\n"); } break; } if (m_pAudioRenderer && m_pAudioRenderer->Init() < 0) { delete m_pAudioRenderer; m_pAudioRenderer = 0; } arends = strchr(arends, ','); if (arends) arends++; } if (m_pAudioRenderer) { m_pAudioRenderer->SetAsync(m_fAsync); // m_pAudioRenderer->SetVolume(m_fVolume * m_pAudioRenderer->VOL_MAX); if (origtime > 0) { m_pAudioRenderer->SeekTime(origtime); m_pAudioRenderer->Start(); } } free(arend); } AviPlayer::State AviPlayer::GetState(double* percent) { if (!m_pClip || !m_pClip->IsValid()) { if (m_pClip && !m_pClip->IsOpened()) return Opening; return Invalid; } double p; if (m_pVideostream) p = m_pVideostream->CacheSize(); else if (m_pAudioRenderer) p = m_pAudioRenderer->GetCacheSize(); else p = 0; if (percent) *percent = p; if (m_bBuffering) { if (p >= 1.) m_bBuffering = false; return Buffering; } if (IsPaused()) return Paused; if (IsPlaying()) return Playing; return Stopped; } bool AviPlayer::IsPaused() const { return (m_pClip && m_bPaused); } bool AviPlayer::IsPlaying() const { // when we are in paused mode initialized is 0 return m_pClip && !IsRedirector() && (m_bInitialized || m_bPaused); } bool AviPlayer::IsStopped() const { return (m_pClip && !IsPlaying()); } const avm::vector& AviPlayer::GetVideoRenderers() const { return m_VideoRenderers; } int AviPlayer::SetVideoRenderers(avm::vector rv) { if (lockThreads("SetVideoRenderes") == 0) { m_VideoRenderers = rv; unlockThreads(); } return 0; } void AviPlayer::SetAsync(float async) { Set(ASYNC_TIME_MS, int(async * 1000.f), 0); } void AviPlayer::SetAudioFunc(AUDIOFUNC func, void* arg) { if (lockThreads("SetAudioFunc") == 0) { m_pAudiofunc = func; m_pAudiofuncArg = arg; createAudioRenderer(); unlockThreads(); } } void AviPlayer::Restart() { if (!IsPlaying() || !m_pVideostream) return; IVideoDecoder* vs = m_pVideostream->GetVideoDecoder(); if (!vs) return; if (m_bPaused) { vs->Restart(); return; } lockThreads("Restart"); vs->Restart(); unlockThreads(); ReseekExact(GetTime()); } int AviPlayer::restartVideoStreaming(const char* vc) { int r = -1; if (m_pVideostream) { m_pVideostream->StopStreaming(); r = m_pVideostream->StartStreaming(vc); if (r == 0) { if (!GetRtConfig(VIDEO_CODECS) || !GetCodecInfo().FindAttribute("maxauto") || CodecGetAttr(GetCodecInfo(), "maxauto", &m_iMaxAuto) < 0) m_iMaxAuto = -1; // prefer this format // remove 0 to get YUY2 rendering StreamInfo* si = m_pVideostream->GetStreamInfo(); if (si) { m_iWidth = si->GetVideoWidth(); m_iHeight = si->GetVideoHeight(); delete si; } // FIXME - might be sometimes better to use different // colorspace const fourcc_t m[] = { m_CSP, IMG_FMT_YUY2, IMG_FMT_YV12, 0 }; for (unsigned i = 0; m[i]; ++i) { if (m[i] > 32 && m_pVideostream->GetVideoDecoder()->SetDestFmt(m_CSP) == 0) { //printf("OK %x\n", m[i]); m_CSP = m[i]; break; } } } else { AVM_WRITE("aviplay", "Failed to initialize decoder\n"); m_pVideostream = 0; } } return r; } void* AviPlayer::startVideoThread(void* arg) { return ((AviPlayer*) arg)->videoThread(); } void* AviPlayer::startAudioThread(void* arg) { return ((AviPlayer*) arg)->audioThread(); } void* AviPlayer::startDecoderThread(void* arg) { return ((AviPlayer*) arg)->decoderThread(); } IAviPlayer* CreateAviPlayer(const char* filename, int bitdepth, const char* subname, int flags, const char* vcodec, const char* acodec) { return new AviPlayer(filename, bitdepth, subname, flags, vcodec, acodec); } #undef __MODULE__ AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviplay/aviplay2.cpp0000644000175000017500000001401611167232204020407 0ustar yavoryavor #include "aviplay_impl.h" #include "playerwidget.h" #include "avm_fourcc.h" #include "avm_cpuinfo.h" #include "avm_except.h" #include "configfile.h" #include "infotypes.h" #include #include // free() AVM_BEGIN_NAMESPACE; class AviPlayer2: public AviPlayer, public IPlayerWidget { IPlayerWidget* m_pPW; void* m_pDpy; int m_iResizeCount; int zx, zy, zw, zh; public: AviPlayer2(IPlayerWidget* pw, void* _dpy, const char* filename, const char* subname, int flags, const char* vcodec, const char* acodec) : AviPlayer(filename, GetPhysicalDepth(_dpy), subname, flags, vcodec, acodec), m_pPW(pw ? pw : this), m_pDpy(_dpy), m_iResizeCount(1), zx(0), zy(0), zw(0), zh(0) { m_pKillhandler = killHandler; m_pKillhandlerArg = (void*)this; updateResize(); } virtual ~AviPlayer2() { m_pKillhandler = 0; } virtual int Refresh() { for (size_t i = 0; i < m_VideoRenderers.size(); ++i) m_VideoRenderers[i]->Refresh(); return 0; } // should be redesigned - only first one will get resize event for now virtual int Resize(int& new_w, int& new_h) { if (m_VideoRenderers.size() > 0) { bool pres; Get(VIDEO_PRESERVE_ASPECT, &pres, 0); if (pres) { StreamInfo* si = m_pVideostream->GetStreamInfo(); float a = si->GetAspectRatio(); delete si; if (a == 0) a = (float)GetWidth() / (float)GetHeight(); new_w = (int)((float)new_h * a + 0.5f); if (zw) new_w = new_h * zw / zh; } return m_VideoRenderers.front()->Resize(new_w, new_h); } return 0; } virtual int Zoom(int x, int y, int w, int h) { zx = zy = zw = zh = 0; for (size_t i = 0; i < m_VideoRenderers.size(); ++i) if (m_VideoRenderers[i]->Zoom(x, y, w, h) == 0) { zx = x; zy = y; zw = w; zh = h; } return 0; } virtual int ToggleFullscreen(bool maximize=false) { for (size_t i = 0; i < m_VideoRenderers.size(); ++i) if (m_VideoRenderers[i]->ToggleFullscreen(maximize) != 0) return -1; return 0; } // FIXME: will be removed - and replaced with better code later // this is very impractical // we need to support many other callbacks // users might want to use any device they have connected // to their linux to control player virtual void PW_stop_func() { Stop(); } //'x' virtual void PW_middle_button() //middle-click { m_iResizeCount++; updateResize(); } virtual void PW_pause_func() { Pause(true); }//'c' virtual void PW_play_func() //'v' { if (!IsPlaying()) Start(); else Pause(false); } virtual void PW_fullscreen() { ToggleFullscreen(); } //alt+enter, esc virtual void PW_resize(int w, int h) { Resize(w, h); } // resize event virtual void PW_refresh() { Refresh(); } virtual void PW_maximize_func() { ToggleFullscreen(true); } void updateResize() { int w = GetWidth(), h = GetHeight(); switch (m_iResizeCount % 3) { case 0: w /= 2; h /= 2; break; case 1: break; case 2: w *= 2; h *= 2; break; } Resize(w, h); } protected: virtual void createVideoRenderer() { int pos = -1, wx, wy, ww, wh; while (m_VideoRenderers.size() > 0) { if (pos < 0) pos = m_VideoRenderers.back()->GetPosition(wx, wy); if (pos == 0) pos = m_VideoRenderers.back()->GetSize(ww, wh); delete m_VideoRenderers.back(); m_VideoRenderers.pop_back(); } //printf("WX %d WY %d WW %d WH %d\n", wx, wy, ww, wh); #ifndef X_DISPLAY_MISSING if (m_pDpy && GetWidth() > 0 && GetHeight() > 0) { IVideoRenderer* renderer = 0; bool sub = HasSubtitles(); bool useyuv; Get(USE_YUV, &useyuv, 0); if (useyuv) { // checking for YUY2 first const fourcc_t tryFcc[] = { //fccYUY2, // looks like YV12 is not supported for Color changes fccYUY2, fccYV12, // fastest fccUYVY, fccI420, // forced //fccYUY2, fccYV12, //fccUYVY, 0 }; int i = 0; while (!renderer && tryFcc[i]) { // we always allow to use last entry when HW acceleration // is requested - it is giving hw scalable picture m_CSP = tryFcc[i]; if (!tryFcc[i + 1] || SetColorSpace(m_CSP, true) == 0) { renderer = CreateYUVRenderer(m_pPW, m_pDpy, GetWidth(), GetHeight(), m_CSP, sub); SetColorSpace(m_CSP, false); } i++; } } if (!renderer) { // BGR renderer renderer = CreateFullscreenRenderer(m_pPW, m_pDpy, GetWidth(), GetHeight(), sub); m_CSP = m_iDepth; m_pVideostream->GetVideoDecoder()->SetDestFmt(m_iDepth); } if (renderer) { StreamInfo* si = m_pVideostream->GetStreamInfo(); float a = si->GetAspectRatio(); delete si; if (a > 1.) { int w = (int)((float)GetHeight() * a + 0.5f); int h = GetHeight(); renderer->Resize(w, h); } if (pos == 0) { renderer->Resize(ww, wh); renderer->SetPosition(wx, wy); } m_VideoRenderers.push_back(renderer); char* fs; Get(SUBTITLE_FONT, &fs, 0); renderer->SetFont(sub ? fs : 0); if (fs) free(fs); } setVideoBuffering(); } #endif } virtual int setFont(const char* fn) { if (m_pVideostream) { lockThreads("setFont"); for (size_t i = 0; i < m_VideoRenderers.size(); ++i) m_VideoRenderers[i]->SetFont(fn); // direct renderer for X11 needs to reinitilize surface! if (m_pVideostream->GetVideoDecoder()) m_pVideostream->GetVideoDecoder()->Restart(); unlockThreads(); } return 0; } static void drawFunc(const CImage*, void* arg=0) {} static void killHandler(int, void* arg=0) {} }; IAviPlayer2* CreateAviPlayer2(IPlayerWidget* parent, void* dpy, const char* filename, const char* subname, int flags, const char* vcodec, const char* acodec) { return new AviPlayer2(parent, dpy, filename, subname, flags, vcodec, acodec); } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviplay/aviplay_impl.h0000644000175000017500000002005211106666340021015 0ustar yavoryavor#ifndef AVIPLAY_IMPL_H #define AVIPLAY_IMPL_H #include "IAudioRenderer.h" #include "Statistic.h" #include "audiodecoder.h" #include "aviplay.h" #include "renderer.h" #include "videodecoder.h" /*************************************************** Here aviplay interface goes ****************************************************/ AVM_BEGIN_NAMESPACE; class AviPlayer: public IAviPlayer2 { public: AviPlayer(const char* filename, int _depth, const char*subname, int flags = 0, const char* vcodec = 0, const char* acodec = 0); ~AviPlayer(); int SetColorSpace(fourcc_t csp, bool test_only); virtual int GetWidth() const {return m_iWidth;} virtual int GetHeight() const {return m_iHeight;} virtual void SetKillHandler(KILLHANDLER handler, void* arg = 0) { m_pKillhandler = handler; m_pKillhandlerArg = arg; } virtual void SetAudioFunc(AUDIOFUNC func, void* arg = 0); virtual double GetTime() const; virtual framepos_t GetFramePos() const; virtual bool GetURLs(avm::vector& urls) const { return (m_pClip) ? m_pClip->GetURLs(urls) : false; } virtual bool IsOpened() const { return (m_pClip) ? m_pClip->IsOpened() : false; } virtual bool IsValid() const { return (m_pClip) ? m_pClip->IsValid() : false; } virtual bool IsRedirector() const { return (m_pClip) ? m_pClip->IsRedirector() : false; } virtual bool IsStopped() const; virtual bool IsPlaying() const; virtual bool IsPaused() const; virtual void Restart(); virtual double Reseek(double pos); virtual int ReseekExact(double pos); virtual void Start(); virtual void Stop(); virtual int NextKeyFrame(); virtual int NextFrame(); virtual int PrevKeyFrame(); virtual int PrevFrame(); virtual void Play(); virtual void Pause(bool state); virtual const subtitle_line_t* GetCurrentSubtitles(); virtual double GetLengthTime() const; virtual double GetAudioLengthTime() const { return (m_pAudioRenderer) ? m_pAudioRenderer->GetLengthTime() : 0.0; } virtual double GetVideoLengthTime() const { return (m_pVideostream) ? m_pVideostream->GetLengthTime() : 0.0; } virtual const char* GetAudioFormat() const; virtual StreamInfo* GetAudioStreamInfo() const; virtual const char* GetVideoFormat() const; virtual StreamInfo* GetVideoStreamInfo() const; virtual double GetFps() const { return (m_pVideostream) ? 1.0 / m_pVideostream->GetFrameTime() : 0.0; } virtual const char* GetFileName() const { return m_Filename.c_str(); } virtual const avm::vector& GetVideoRenderers() const; virtual int SetVideoRenderers(avm::vector); virtual State GetState(double* percent); virtual bool HasSubtitles() const; virtual int InitSubtitles(const char* filename); virtual int Set(...); virtual int Get(...) const; virtual void SetAsync(float async); virtual float GetAsync() const { return m_fAsync; } virtual const CodecInfo& GetCodecInfo(int type = VIDEO_CODECS) const; virtual IRtConfig* GetRtConfig(int type = VIDEO_CODECS) const; virtual void SetVideo(bool enabled) { m_bVideoMute = enabled; } virtual void SetAudio(bool enabled) { } virtual bool GetVideo() const { return m_bVideoMute; } virtual bool GetAudio() const { return (m_pAudioRenderer != 0); } virtual int Refresh() { return -1; } virtual int Resize(int& new_w, int& new_h) { return -1; } virtual int Zoom(int x, int y, int w, int h) { return -1; } virtual int ToggleFullscreen(bool maximize = false) { return -1; } protected: enum ThreadId { // do not change order THREAD_FIRST = 0, THREAD_DECODER = THREAD_FIRST, THREAD_AUDIO, THREAD_VIDEO, THREAD_LAST, }; static void* constructThread(void* arg); void* constructThreadfunc(); void construct(); int lockThreads(const char *name = 0); void unlockThreads(void); int checkSync(ThreadId); int drawFrame(bool aseek = true); void syncFrame(); void changePriority(const char* taskName, int add, int schedt = 0); float getVideoAsync(); bool dropFrame(); void setQuality(); void* videoThread(); void* audioThread(); void* decoderThread(); // special way to have function compatible with C code pthread parameter // we could use only one parameter and this seems to be simpliest way static void* startVideoThread(void* arg); static void* startAudioThread(void* arg); static void* startDecoderThread(void* arg); virtual int setAudioStream(int channel); virtual int setAudioUrl(const char* filename); virtual int setFont(const char* fn) { return -1; } virtual void setVideoBuffering(); virtual void createVideoRenderer() {} void createAudioRenderer(); int restartVideoStreaming(const char* codec = 0); mutable int propertyRead[LAST_PROPERTY]; // have we read at least once from Registry:: avm::vector m_VideoRenderers; // we could draw image to more places IAudioRenderer* m_pAudioRenderer; // not sure about the sound - this will be // more complicated because of buffer sizes KILLHANDLER m_pKillhandler; void* m_pKillhandlerArg; AUDIOFUNC m_pAudiofunc; void* m_pAudiofuncArg; IReadFile* m_pClip; IReadFile* m_pClipAudio; // second (audio - only stream) IReadStream* m_pVideostream; IReadStream* m_pAudiostream; Statistic m_Drop; Statistic m_Quality; avm::string m_Filename; avm::string m_Subfilename; avm::string m_vcodec; avm::string m_acodec; subtitles_t* m_pSubtitles; // list of subtitles subtitle_line_t* m_pSubline;// contains current subtitle line float m_fAsync; // a-v async time float m_fSubAsync; int m_iMaxAuto; int m_iFramesVideo; // just counters int m_iFrameDrop; int m_iLockCount; // these vars are used in syncing video with time int64_t m_llTimeStart; // timestamp of moment when we started playing // updated after each reseek or pause int64_t m_llLastVideoSync; // stamp for last video time in sync int64_t m_llLastTimeStart; // timestamp of the last displayed frame double m_dFrameStart; // precise position of video at time_start ( needed // for timing of video-only streams ) double m_dLastFrameStart; // precise position of video at last frame double m_dLastAudioSync; // stamp for last audio time in sync float m_fLastDiff; // difference between succesive float m_fLastSyncTime; // length of the last Video sync call float m_fLastSleepTime; float m_fDecodingTime; PthreadTask* m_pVideoThread; // performs video output and sync PthreadTask* m_pAudioThread; // performs audio output and sync PthreadTask* m_pDecoderThread; // performs video decompression and caching int m_iEffectiveUid; // effective user id int m_iEffectiveGid; // effective group id framepos_t m_uiPgPrevPos; int64_t m_llPgPrevTime; PthreadMutex m_ThreadMut[THREAD_LAST]; // 3 mutexes PthreadCond m_ThreadCond[THREAD_LAST]; // 3 conditions PthreadMutex m_LockMutex; PthreadMutex m_QueueMutex; PthreadCond m_QueueCond; double m_dVideoSeekDest; double m_dVframetime; int m_iWidth; int m_iHeight; int m_iDepth; uint_t m_CSP; // used colorspace by renderer bool m_bVideoMute; bool m_bVideoAsync; // true - do not care about a-v sync bool m_bQualityAuto; bool m_bVideoBuffered; bool m_bVideoDirect; bool m_bVideoDropping; bool m_bDropping; // internal flag for temporal stop of decoder bool m_bPaused; // true if we are paused bool m_bInitialized; // true if we are playing OR paused bool m_bQuit; // true signals to all processing threads // to terminate bool m_bHangup; // signals main_thread to enter 'waiting' state // and set initialized=0 bool m_bBuffering; bool m_bCallSync; // marks that video update is needed bool m_bConstructed; // marks that video update is needed }; AVM_END_NAMESPACE; #endif // AVIPLAY_IMPL_H avifile-0.7.48~20090503.ds/lib/aviplay/aviplayprop.cpp0000644000175000017500000003403211167232204021226 0ustar yavoryavor#include "avm_args.h" #include "avm_except.h" #include "avm_creators.h" // codec sorting #include "aviplay_impl.h" #include "configfile.h" #include "avm_output.h" #include #include #include #include AVM_BEGIN_NAMESPACE; static const char regName[] = "aviplay"; // first in the list is default static const char subtitleRendererTxt[] = #ifdef HAVE_LIBXFT "XFT_DRAW," #endif #ifndef X_DISPLAY_MISSING "X11_DRAW," #endif "nosubtitles"; static const char audioRendererTxt[] = #ifdef HAVE_OSS "OSS," #endif #ifdef HAVE_LIBSDL "SDL," #endif #ifdef HAVE_SUNAUDIO "SUN," #endif "noaudio"; static const char videoRendererTxt[] = #ifdef HAVE_LIBSDL "SDL_XV,SDL_X11," #endif "novideo"; const Args::Option* IAviPlayer::getOptions() { static const bool DEFAULT_TRUE = true; static const int DEFAULT_0 = 0; static const int DEFAULT_RATE = 44100; static const int DEFAULT_VOLUME = 1000; static const int DEFAULT_BALANCE = 500; static const Args::Option options[] = { // FIXME convert rest of flags later // type, short, long, help, defvalue, minval, maxval ARGSOPTION("i", "", "", ""), // empty field to skip PROPERTY_END ARGSOPTION("S", "codecs-audio", "", "order of audio codecs"), ARGSOPTION("S", "codecs-video", "", "order of video codecs"), ARGSOPTION("S", "audio-renderer", "","audio renderer", audioRendererTxt), ARGSOPTION("S", "video-renderer", "", "video renderer", videoRendererTxt), ARGSOPTION("S", "subtitle-renderer", "", "subtitle renderer", subtitleRendererTxt), ARGSOPTION("B", "use-yuv", "", "use YUV hw acceleration", &DEFAULT_TRUE), ARGSOPTION("B", "autorepeat", "", "repeat movie after end of the movie", &DEFAULT_TRUE), ARGSOPTION("I", "audio-stream", "", "select audio channel", &DEFAULT_0, -1, 255), ARGSOPTION("I", "video-stream", "", "select video channel", &DEFAULT_0, -1, 255), ARGSOPTION("S", "subtitle-font", "subfont", "select font for subtitles", "-adobe-helvetica-medium-r-normal--*-160-100-100-p-*"), ARGSOPTION("I", "subtitle-async-ms", "", "async time for subtitle (ms)"), ARGSOPTION("I", "subtitle-extend-ms", "", "extended time for subtitle (ms)"), ARGSOPTION("S", "subtitle-codepage", "subcp", "encoding code page of subtitles (iconv --list)", "default"), ARGSOPTION("B", "subtitle-enabled", "", "enable subtitles", &DEFAULT_TRUE), ARGSOPTION("B", "subtitle-wrap", "", "subtitles wrap to next line"), ARGSOPTION("I", "subtitle-bgcolor", "", "subtitles background color"), ARGSOPTION("I", "subtitle-fgcolor", "", "subtitles foreground color"), ARGSOPTION("I", "subtitle-hposition", "", "subtitles horizontal position"), ARGSOPTION("B", "use-http-proxy", "", "use http proxy for connection"), ARGSOPTION("S", "http-proxy", "", "address of http proxy"), ARGSOPTION("B", "audio-resampling", "", "resample audio"), ARGSOPTION("I", "audio-resampling-rate", "", "target resampling rate", &DEFAULT_RATE, 1, 100000), ARGSOPTION("I", "audio-playing-rate", "", "audio playing rate", &DEFAULT_RATE, 1, 100000), ARGSOPTION("B", "audio-master-timer", "", ""), ARGSOPTION("I", "audio-volume", "", "audio volume <%d, %d>", &DEFAULT_VOLUME, 0, 1000), // 1000 is 1.0 ARGSOPTION("I", "audio-balance", "", "audio balance <%d, %d>", &DEFAULT_BALANCE, 0, 1000), // 500 is middle ARGSOPTION("S", "url-audio", "", "url for audio stream"), ARGSOPTION("B", "preserve-aspect", "", "preserve aspect during resize", &DEFAULT_TRUE), ARGSOPTION("B", "buffered", "", "buffer video ahead", &DEFAULT_TRUE), ARGSOPTION("B", "direct", "", "decompress directly to image memory", &DEFAULT_TRUE), ARGSOPTION("B", "dropping", "", "drop frame when a/v desync", &DEFAULT_TRUE), ARGSOPTION("B", "quality_auto", "", "change postprocessing automaticaly", &DEFAULT_TRUE), ARGSOPTION("B", "display-frame-pos", "", "show more informative about position"), ARGSOPTION("I", "av-async-ms", "", "audio/video async time (ms)"), ARGSOPTION("#", "", "", "") }; return options; } #define LOCK_THREADS() \ if (!locked)\ {\ lockThreads("SetProperties");\ locked = true;\ } int AviPlayer::Set(...) { va_list args; Property prop; avm::string strtmp; bool setvidbuf = false; bool locked = false; bool renderer = false; bool useyuv; va_start(args, this); while ((prop = (Property) va_arg(args, int)) != 0) { avm::vector vci; int int_param = 0; const char* string_param = 0; if (prop < LAST_PROPERTY) { switch (getOptions()[prop].getType()) { case Args::Option::REGINT: case Args::Option::REGBOOL: int_param = va_arg(args, int); break; case Args::Option::REGSTRING: string_param = va_arg(args, char*); break; default: ; } //printf("PropertySet %d %s\n", prop, options[prop].olong); switch (prop) { case AUDIO_RENDERER: break; case VIDEO_RENDERER: break; case VIDEO_CODECS: LOCK_THREADS(); SortVideoCodecs(string_param); strtmp.erase(); CodecInfo::Get(vci); for (size_t i = 0; i < vci.size(); ++i) { strtmp += vci[i]->GetPrivateName(); if ((i + 1) < vci.size()) strtmp += ','; } string_param = strtmp.c_str(); if (0) { char* origval = 0; Get(ASYNC_TIME_MS, &origval, NULL); printf("ORIG %s\n NEW %s\n R: %d\n", string_param, origval, strcmp(string_param, origval)); } if (m_pVideostream && m_pVideostream->IsStreaming()) { //printf("POS1 %f\n", m_pVideostream->GetTime()); restartVideoStreaming(); if (m_pAudioRenderer) { m_pVideostream->SeekTime(m_pAudioRenderer->GetTime()); framepos_t p = m_pVideostream->GetPos(); if ((m_pVideostream->GetNextKeyFrame() - p) < 40) m_pVideostream->SeekToNextKeyFrame(); else m_pVideostream->SeekToPrevKeyFrame(); } //printf("POS5 %f\n", m_pVideostream->GetTime()); } break; case AUDIO_CODECS: LOCK_THREADS(); SortAudioCodecs(string_param); strtmp.erase(); CodecInfo::Get(vci, CodecInfo::Audio); for (size_t i = 0; i < vci.size(); i++) { strtmp += vci[i]->GetPrivateName(); if (i + 1 < vci.size()) strtmp += ','; } string_param = strtmp.c_str(); createAudioRenderer(); break; case USE_YUV: LOCK_THREADS(); Get(USE_YUV, &useyuv, 0); if (int_param != useyuv) renderer = true; break; case VIDEO_QUALITY_AUTO: LOCK_THREADS(); if (m_bQualityAuto != int_param) { setvidbuf = true; m_bQualityAuto = int_param; } break; case VIDEO_BUFFERED: LOCK_THREADS(); if (m_bVideoBuffered != int_param) { setvidbuf = true; m_bVideoBuffered = int_param; } break; case VIDEO_DIRECT: LOCK_THREADS(); if (m_bVideoDirect != int_param) { setvidbuf = true; m_bVideoDirect = int_param; } break; case VIDEO_DROPPING: m_bVideoDropping = int_param; break; case ASYNC_TIME_MS: m_fAsync = (float) int_param / 1000.0f; if (m_pAudioRenderer) m_pAudioRenderer->SetAsync(m_fAsync); break; case SUBTITLE_FONT: LOCK_THREADS(); setFont(string_param); break; case SUBTITLE_ASYNC_TIME_MS: m_fSubAsync = (float) int_param / 1000.0f; break; case AUDIO_VOLUME: if (m_pAudioRenderer) m_pAudioRenderer->SetVolume(int_param); break; case AUDIO_BALANCE: if (m_pAudioRenderer) m_pAudioRenderer->SetBalance(int_param); break; case AUDIO_URL: LOCK_THREADS(); setAudioUrl(string_param); break; case VIDEO_STREAM: //delete m_pVideostream; //m_pVideostream = m_pClip->GetStream(0, IAviReadStream::Video); break; case AUDIO_STREAM: LOCK_THREADS(); setAudioStream(int_param); break; default: //AVM_WRITE("Property", "Unknown (?unsupported?) propety %d\n", prop); break; } switch (getOptions()[prop].getType()) { case Args::Option::REGINT: case Args::Option::REGBOOL: RegWriteInt(regName, getOptions()[prop].getLongOption(), int_param); break; case Args::Option::REGSTRING: RegWriteString(regName, getOptions()[prop].getLongOption(), string_param); break; default: ; } } } va_end(args); if (locked) { if (setvidbuf) setVideoBuffering(); if (renderer && m_pVideostream) { double pos = GetTime(); m_pVideostream->StopStreaming(); m_pVideostream->StartStreaming(); createVideoRenderer(); double posn = m_pVideostream->SeekTimeToKeyFrame(pos); if (m_pAudiostream && ((posn + 5) < pos)) Reseek(posn); // complet reseek } unlockThreads(); } return 0; } #undef LOCK_THREADS int AviPlayer::Get(...) const { va_list args; Property prop; //printf("Sizeof %d\n", sizeof(Property)); va_start(args, this); while ((prop = (Property) va_arg(args, int)) != 0) { bool ok = true; bool isBool = false; avm::string string_param = "_empty_"; int int_param = 0; if (prop < LAST_PROPERTY) { //printf("PropertyGet %d %s (readcnt: %d)\n", prop, options[prop].olong, propertyRead[prop]); Property force = prop; isBool = (getOptions()[prop].getType() == Args::Option::REGBOOL); if (!propertyRead[prop]) force = LAST_PROPERTY; // force reading from registry switch (force) { case VIDEO_BUFFERED: int_param = m_bVideoBuffered; break; case VIDEO_DROPPING: int_param = m_bVideoDropping; break; case VIDEO_DIRECT: int_param = m_bVideoDirect; break; case VIDEO_QUALITY_AUTO: int_param = m_bQualityAuto; break; case ASYNC_TIME_MS: int_param = int(m_fAsync * 1000.0); break; case SUBTITLE_ASYNC_TIME_MS: int_param = int(m_fSubAsync * 1000.0); break; case AUDIO_VOLUME: int_param = (m_pAudioRenderer) ? m_pAudioRenderer->GetVolume() : 0; break; case AUDIO_BALANCE: int_param = (m_pAudioRenderer) ? m_pAudioRenderer->GetBalance() : 500; break; default: //printf("Default propety: %s (idx = %d)\n", propertyList[prop].text, prop); switch (getOptions()[prop].getType()) { case Args::Option::REGBOOL: case Args::Option::REGINT: int_param = RegReadInt(regName, getOptions()[prop].getLongOption(), getOptions()[prop].getInt()); break; case Args::Option::REGSTRING: string_param = RegReadString(regName, getOptions()[prop].getLongOption(), getOptions()[prop].getString()); break; default: ; } propertyRead[prop]++; break; } } else { switch (prop) { case QUERY_AVG_QUALITY: int_param = int(m_Quality.average()); break; case QUERY_AVG_DROP: int_param = int(m_Drop.average()); break; case QUERY_AUDIO_RENDERERS: string_param = audioRendererTxt; break; case QUERY_VIDEO_RENDERERS: string_param = videoRendererTxt; break; case QUERY_SUBTITLE_RENDERERS: string_param = subtitleRendererTxt; break; case QUERY_EOF: isBool = true; int_param = (m_pVideostream) ? m_pVideostream->Eof() : true; //printf("VSTREAM %d\n", int_param); // audiostream doesn't detect eof - have to use Length FIXME if (int_param && m_pAudioRenderer) int_param = m_pAudioRenderer->Eof(); //printf("???EOF %d %d %f %f\n", int_param, m_pAudiostream->Eof(), // m_pAudiostream->GetTime(), m_pAudiostream->GetLengthTime()); break; case QUERY_VIDEO_WIDTH: { int w = m_iWidth, h; if (m_VideoRenderers.size()) m_VideoRenderers[0]->GetSize(w, h); int_param = w; } break; case QUERY_VIDEO_HEIGHT: { int w, h = m_iHeight; if (m_VideoRenderers.size()) m_VideoRenderers[0]->GetSize(w, h); int_param = h; } break; case QUERY_VIDEO_STREAMS: int_param = (m_pClip) ? (int)m_pClip->VideoStreamCount() : 0; break; case QUERY_AUDIO_STREAMS: if (m_pClipAudio) int_param = (int)m_pClipAudio->AudioStreamCount(); else int_param = (m_pClip) ? (int)m_pClip->AudioStreamCount() : 0; break; default: AVM_WRITE("aviplay", "Unexpected property value: %d\n", prop); break; } } int* ptr = va_arg(args, int*); //printf("Ptr: %p\n", ptr); if (ok && ptr) { if (isBool) *(bool*)ptr = (bool) int_param; else { if (string_param == "_empty_") *ptr = int_param; else *(char**)ptr = (char*) strdup(string_param.c_str()); } } } va_end(args); return 0; } void AviPlayer::setVideoBuffering() { lockThreads("SetVideoBuffered"); if (m_pVideostream) { IImageAllocator* ia = (m_bVideoDirect && m_VideoRenderers.size()) ? m_VideoRenderers[0] : 0; uint_t bufs = (m_bVideoBuffered) ? 6 : 1; //printf("Buffering: %d Allocator: %p\n", bufs, ia); m_pVideostream->SetBuffering(bufs, ia); } unlockThreads(); } int AviPlayer::setAudioStream(int channel) { IReadStream* astream = 0; if (channel > 127) channel = 127; else if (channel < 0) channel = 0; IReadFile* qf = m_pClipAudio; if (!qf) qf = m_pClip; while (qf && !astream && channel >= 0) astream = qf->GetStream(channel--, IReadStream::Audio); if (astream != m_pAudiostream) { double tpos = 0.0; if (m_pAudioRenderer) { tpos = m_pAudioRenderer->GetTime(); delete m_pAudioRenderer; m_pAudioRenderer = 0; } else if (m_pVideostream) tpos = m_pVideostream->GetTime(); if (m_pAudiostream) m_pAudiostream->StopStreaming(); // NOTE: never call delete on m_pAudiostream ! m_pAudiostream = astream; createAudioRenderer(); if (m_pAudioRenderer) { m_pAudioRenderer->SeekTime(tpos); m_pAudioRenderer->Start(); } } return 0; } int AviPlayer::setAudioUrl(const char* url) { lockThreads("SetAudioUrl"); // compare Url's from the end (as filename could be either // fullpath or just filename size_t u = strlen(url); size_t f = m_Filename.size(); while (u > 0 && f > 0) if (url[--u] != m_Filename[--f]) break; IReadFile* newClipAudio = (u == 0 || f == 0) ? m_pClip : CreateReadFile(url); if (newClipAudio) { IReadFile* tmp = m_pClipAudio; m_pClipAudio = (newClipAudio != m_pClip) ? newClipAudio : 0; int def_audio; Get(AUDIO_STREAM, &def_audio, 0); setAudioStream(def_audio); delete tmp; } unlockThreads(); return 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviplay/aviplayth.cpp0000644000175000017500000005060211167232204020662 0ustar yavoryavor#include "aviplay_impl.h" #include "avm_cpuinfo.h" #include "avm_output.h" #include "avm_creators.h" #include "utils.h" #include //needed by sys/resource.h in FreeBSD #include //set/getpriority #include #include #include #include #include //exit #include //close #ifdef __NetBSD__ #include #else #include #endif // has to go with mga_vid #if HAVE_SYS_IOCCOM_H #include #endif #include "mga_vid.h" AVM_BEGIN_NAMESPACE; // preffer video playing thread static const int PRIORITY_ADD_VIDEO = 0; static const int PRIORITY_ADD_AUDIO = 0; static const float m_fDropLimit = -0.315f; float AviPlayer::getVideoAsync() { if (m_llTimeStart == 0) { m_dFrameStart = (m_pVideostream) ? m_pVideostream->GetTime() : 0.; m_dLastFrameStart = m_dFrameStart; m_llTimeStart = avm_get_time_us(); AVM_WRITE("aviplay", 1, "AviPlayer::getVideoAsync(): resetting\n"); } if (!m_pVideostream) return 0.f; double actual_time; if (m_pAudioRenderer && !m_pAudioRenderer->Eof()) { actual_time = m_pAudioRenderer->GetTime(); } else { // for stream without audio track or when audio track has finished... // since we want to show real-time video we have to // compute async deviation from real time actual_time = m_dFrameStart + avm_get_time_diff(avm_get_time_us(), m_llTimeStart); } //printf("ATIM %f %f\n", m_pVideostream->GetTime(), actual_time); return (float) (m_pVideostream->GetTime() - actual_time); } /* * check for synchronization event * * might block this task - it will await for broadcast from the main thread * returns: 0 - quit * 1 - ok could continue */ int AviPlayer::checkSync(ThreadId i) { //printf("Thread: %d m_bHangup: %d\n", i, m_bHangup); if (!m_bQuit && m_bHangup) { m_ThreadCond[i].Wait(m_ThreadMut[i]); AVM_WRITE("aviplay", 1, "Thread unlocked %d\n", i); } return (!m_bQuit); } /* * block all running threads - implemented as recursive lock */ int AviPlayer::lockThreads(const char *name) { Locker locker(m_LockMutex); if (m_bQuit) return -1; if (++m_iLockCount > 1) return 0; m_bHangup = true; AVM_WRITE("aviplay", 1, "Waiting for main_thread to hang up (%s)...", ((name) ? name : "???")); if (m_pVideostream) { m_ThreadMut[THREAD_VIDEO].Lock(); AVM_WRITE("aviplay", 1, " video"); m_ThreadMut[THREAD_DECODER].Lock(); AVM_WRITE("aviplay", 1, " decoder"); } m_ThreadMut[THREAD_AUDIO].Lock(); m_QueueMutex.Lock(); AVM_WRITE("aviplay", 1, " audio"); syncFrame(); // now we have all threads locked m_bInitialized = false; AVM_WRITE("aviplay", 1, " OK!\n"); return 0; } /* * unlock all waiting threads in cond_wait state */ void AviPlayer::unlockThreads() { Locker locker(m_LockMutex); if (--m_iLockCount > 0) return; // pausetest m_iLockCount = 0; m_llTimeStart = 0; m_bHangup = false; m_bInitialized = true; AVM_WRITE("aviplay", 1, "Unlock threads\n"); m_QueueCond.Broadcast(); m_QueueMutex.Unlock(); m_ThreadCond[THREAD_AUDIO].Broadcast(); m_ThreadMut[THREAD_AUDIO].Unlock(); if (m_pVideostream) { m_ThreadCond[THREAD_DECODER].Broadcast(); m_ThreadMut[THREAD_DECODER].Unlock(); m_ThreadCond[THREAD_VIDEO].Broadcast(); m_ThreadMut[THREAD_VIDEO].Unlock(); } } // returns true when some frames have been dropped // called with m_QueueMutex LOCKED! bool AviPlayer::dropFrame() { if (m_bVideoAsync || !m_bVideoDropping || avm_get_time_diff(avm_get_time_us(), m_llTimeStart) < 0.3) return false; bool ret = false; // here we try to eliminate all the frames // until next key-frame with reasonable close time //printf("enter drop: async=%f\n", getVideoAsync()); framepos_t orig = m_pVideostream->GetPos(); framepos_t kpos = orig; bool locked = false; // do not skip frames if we have full buffer // in this case the problem is with slow rendering while (m_pVideostream->GetBuffering() <= 1) { framepos_t npos = m_pVideostream->GetNextKeyFrame(kpos + 1); if (npos == m_pVideostream->ERR || kpos >= npos) break; double curtime = (m_pAudioRenderer) ? m_pAudioRenderer->GetTime() : m_dFrameStart + avm_get_time_diff(avm_get_time_us(), m_llTimeStart); double nt = m_pVideostream->GetTime(npos) - curtime; if (nt < 0.1) { kpos = npos; continue; // next kf needed } if (nt > 0.3) npos = kpos; if (npos == orig) break; AVM_WRITE("aviplay", 1, "AviPlayer::dropFrame()\n" " async %f new_vtime: %f cur_atime: %f diff %f %d - %d\n", getVideoAsync(), m_pVideostream->GetTime(npos), curtime, nt, npos, kpos); //printf("o: %d k: %d n: %d\n", orig, kpos, npos); if (!locked) { // stop decoder for proper frame skip m_bDropping = true; m_QueueMutex.Unlock(); m_ThreadMut[THREAD_DECODER].Lock(); m_QueueMutex.Lock(); m_bDropping = false; locked = true; } framepos_t posbef = m_pVideostream->GetPos(); kpos = m_pVideostream->SeekToKeyFrame(npos); if (kpos != npos) { AVM_WRITE("aviplay", 1, "AviPlayer::dropFrame() logical fault compare %d %d %d %d " "before %d\n", npos, kpos, orig, m_pVideostream->GetPos(), posbef); //abort(); kpos = orig; } //if (nt > 0.1 || kpos >= npos || npos == m_pVideostream->ERR) break; } if (kpos > orig && kpos != m_pVideostream->ERR) { // and finaly we we have keyframe which is // is not too ahead of audio AVM_WRITE("aviplay", 1, "AviPlayer::dropFrame() skipped %d frames ( %d, %d )\n", (kpos - orig), orig, kpos); while (orig++ < kpos) { m_Drop.insert(100.0); m_iFrameDrop++; } ret = true; } //printf("DDD %d %f %d\n", ret, getVideoAsync(), m_pVideostream->GetBuffering()); if (!ret) { uint_t bm = 2 - (m_bVideoBuffered == 0); while (m_pVideostream->GetBuffering() > bm && getVideoAsync() < m_fDropLimit) { CImage *im = m_pVideostream->GetFrame(!m_bVideoBuffered); if (!im) break; im->Release(); m_Drop.insert(100.0); m_iFrameDrop++; AVM_WRITE("aviplay", 1, "Dropped video frames: %d atime: %f vtime: %f bufs: %" PRIsz "\n", m_iFrameDrop, ((m_pAudioRenderer) ? m_pAudioRenderer->GetTime() : 0.0), m_pVideostream->GetTime(), m_pVideostream->GetBuffering()); ret = true; } } if (locked) { m_ThreadCond[THREAD_DECODER].Broadcast(); m_ThreadMut[THREAD_DECODER].Unlock(); } return ret; } void AviPlayer::setQuality() { if (!m_bQualityAuto || m_iMaxAuto < 0) return; IRtConfig* rt = GetRtConfig(VIDEO_CODECS); if (rt) { const char ppstr[] = "postprocessing"; if (CodecGetAttr(GetCodecInfo(), "maxauto", &m_iMaxAuto) < 0) return; int val; rt->GetValue(ppstr, &val); float as = getVideoAsync(); size_t bs; size_t bf = m_pVideostream->GetBuffering(&bs); //if (!m_dVframetime) //printf("As: %f Max %d PP: %d b: %d %f %f\n", as, m_iMaxAuto, val, bf, m_fDecodingTime, m_dVframetime); // some tricky checks here - // it must work with buffering or even just with one buffer // and should prevent large drops with high postprocessing levels if (val < m_iMaxAuto && as > m_fDropLimit && (m_fDecodingTime < m_dVframetime * (1. - double(3 - bf) / 10.))) { rt->SetValue(ppstr, val + 1); //printf("+++++++++++\n"); } else if (val > 0 && ((m_fDecodingTime > m_dVframetime * ((bf >= 2) ? 1.1 : 0.7)) || val > m_iMaxAuto || as < m_fDropLimit) ) { //printf("As: %f Max %d PP: %d b: %d %f %f\n", as, m_iMaxAuto, val, bf, m_fDecodingTime, m_dVframetime); if (as < m_fDropLimit || m_fDecodingTime > m_dVframetime * ((bf < 2) ? 1.0 : 1.4)) val = 1; rt->SetValue(ppstr, val - 1); //printf("-----------\n"); } } } void* AviPlayer::videoThread() { const ThreadId th = THREAD_VIDEO; m_ThreadMut[th].Lock(); AVM_WRITE("aviplay", 1, "Thread video started\n"); #ifdef SCHED_FIFO changePriority("Video player", 0, SCHED_FIFO); #endif int mga_vid = open("/dev/mga_vid", O_RDONLY); if (mga_vid == -1) mga_vid = open("/dev/misc/mga_vid", O_RDONLY); float minWait = 0.01f; float lastCopyTime = 0.f; int framecnt = 0; double dLastEofTime = 0.f; int lastirq = 0; m_llLastVideoSync = avm_get_time_us(); m_dLastFrameStart = m_pVideostream->GetTime(); if (mga_vid != -1) { if (ioctl(mga_vid, MGA_VID_IRQ_ON, 0) < 0) //if (ioctl(mga_vid, MGA_VID_IRQ2_ON, 0) < 0) { AVM_WRITE("aviplay", "Can't use MGA_VID device for VBI (vsync) synchronization (incompatible)\n"); // not supported close(mga_vid); mga_vid = -1; } else { minWait = 0.02f; // better precision with interrupt handler AVM_WRITE("aviplay", "Using MGA_VID device for VBI (vsync) synchronization\n"); } } // video synchronization while (checkSync(th)) { if (m_pVideostream->Eof()) { if (m_dLastFrameStart != dLastEofTime) AVM_WRITE("aviplay", "Video stream eof\n"); m_Drop.clear(); dLastEofTime = m_dLastFrameStart; m_ThreadCond[th].Wait(m_ThreadMut[th], 1.0); continue; } float async = getVideoAsync(); //printf("V %d %f %f as:%f %d\n", m_pVideostream->Eof(), m_dLastFrameStart, dLastEofTime, async, (m_pAudioRenderer) ? m_pAudioRenderer->Eof() : 0); if (async > minWait) { if (mga_vid >= 0) { int buf[3]; read(mga_vid, &buf, sizeof(buf)); // always wait for at least one VBI event // if (getVideoAsync() <= minWait) { //AVM_WRITE("aviplay", "VID: Diff: %d %d async:%f\n", buf[0] - lastirq, buf[1], getVideoAsync()); lastirq = buf[0]; } } else { if (async > 0.5f) async = 0.4f; // max sleep time int64_t t1 = avm_get_time_us(); m_ThreadCond[th].Wait(m_ThreadMut[th], async); float oversleep = avm_get_time_diff(avm_get_time_us(), t1); //printf("Oversleep %f a: %f\n", oversleep - async, async); m_fLastSleepTime += oversleep; if ((oversleep - async) > 0.016) { AVM_WRITE("aviplay", 1, " Sleep too long!!! real: %f expected: %f async: %f over: %f\n", m_fLastSleepTime, async, getVideoAsync(), oversleep); } } continue; // let's check the status after sleep } m_QueueMutex.Lock(); if (m_bVideoBuffered) { size_t bufsize; size_t buffull = m_pVideostream->GetBuffering(&bufsize); //printf("BUFFfull %f %d : %d\n", getVideoAsync(), buffull, bufsize); if (buffull < 1) { m_ThreadMut[th].Unlock(); ///AVM_WRITE("aviplay", "wait...\n"); m_QueueCond.Broadcast(); m_QueueCond.Wait(m_QueueMutex); //buffull = m_pVideostream->GetBuffering(&bufsize); //printf("AfterwaitBUFFfull %d : %d\n", buffull, bufsize); m_QueueMutex.Unlock(); m_ThreadMut[th].Lock(); continue; } } else // !m_bVideoBuffered setQuality(); m_llLastTimeStart = avm_get_time_us(); //printf("BUFFfull %d\n", m_pVideostream->GetBuffering()); CImage* im = m_pVideostream->GetFrame(!m_bVideoBuffered); //printf("NEWFT t:%f p:%d %d\n", m_pVideostream->GetTime(), m_pVideostream->GetPos(), m_pVideostream->GetBuffering()); // read time for the next frame double nf = m_pVideostream->GetTime() - m_dLastFrameStart; m_dVframetime = nf; if (!m_bVideoBuffered) { //avm_usleep(40000); // debug drop m_fDecodingTime = avm_get_time_diff(avm_get_time_us(), m_llLastTimeStart); } if (im) { //printf("DRATM %f\n", (lastCopyTime + m_fLastSyncTime)); // FIXME - this bool is stupid // condition: - no drop if there is just small async // or if its odd frame or rendering time is quite small if (!m_bVideoMute && (async > -0.1 || !m_bDropping || (framecnt++ & 1) ))//|| (lastCopyTime + m_fLastSyncTime) < 0.007)) { //printf("D %f\n", lastCopyTime + m_fLastSyncTime); m_Quality.insert(im->GetQuality() * 100.0f); m_Drop.insert(0.0); m_iFramesVideo++; const subtitle_line_t* sl = GetCurrentSubtitles(); // unlock here - as it could stop decoding process // because of block in xfree, but we do not need to // send signal as decoder will be waken by drop in that case // invoked in audio thread m_QueueMutex.Unlock(); int64_t copys = avm_get_time_us(); for (size_t i = 0; i < m_VideoRenderers.size(); ++i) { m_VideoRenderers[i]->Draw(im); if (HasSubtitles()) m_VideoRenderers[i]->DrawSubtitles(sl); //m_VideoRenderers[i]->Sync(); // syncFrame() executed elsewhere } lastCopyTime = avm_get_time_diff(avm_get_time_us(), copys); // copy time m_bCallSync = true; // copy image to graphics card syncFrame(); m_QueueMutex.Lock(); } else { m_Drop.insert(100.0); m_iFrameDrop++; printf("Ignore %f as: %f - %f\n", m_Drop.average(), async, getVideoAsync()); } im->Release(); } m_dLastFrameStart += m_dVframetime; // this will not accumulate error if (async < m_fDropLimit) dropFrame(); m_QueueCond.Broadcast(); m_QueueMutex.Unlock(); m_fLastSleepTime = 0.0; } if (mga_vid != -1) { //ioctl(mga_vid, MGA_VID_IRQ_OFF, 0); close(mga_vid); } AVM_WRITE("aviplay", 1, "Thread video finished\n"); return 0; } void* AviPlayer::audioThread() { const ThreadId th = THREAD_AUDIO; m_ThreadMut[th].Lock(); AVM_WRITE("aviplay", 1, "Thread audio started\n"); changePriority("Audio decoder ", PRIORITY_ADD_AUDIO); bool paused = false; while (checkSync(th)) { if (!m_pAudioRenderer) { m_ThreadCond[th].Wait(m_ThreadMut[th], 0.1f); continue; } const float async = getVideoAsync(); const double buftime = m_pAudioRenderer->GetBufferTime(); if (!m_bVideoAsync && async < -0.5 && avm_get_time_diff(avm_get_time_us(), m_llTimeStart) > 1.0 && (!m_pVideostream || !m_pVideostream->Eof())) { if (!paused && async < -5.0) { // ok even with dropping we could not stay in sync // so for a while turn of audio track and wait // until video will match audio time AVM_WRITE("aviplay", 1, "Thread audio large async time: %f buftime: %f - pause\n", async, buftime); // if the video stream has finished sooner than audio m_pAudioRenderer->Pause(true); paused = true; } if (m_pVideostream && m_QueueMutex.TryLock() == 0) { dropFrame(); m_QueueCond.Broadcast(); m_QueueMutex.Unlock(); } } else if (paused && !m_pAudioRenderer->Eof() && (async > 0.0 || (!m_pVideostream || m_pVideostream->Eof()))) paused = (m_pAudioRenderer->Pause(false) != 0); //AVM_WRITE("aviplay", "atime: %f btime: %f\n", async, buftime); int r = m_pAudioRenderer->Extract(); if (r < 0) { if (m_pAudioRenderer->Eof()) { // FIXME FIXME - this is a big mess - fix if (!paused) { m_pAudioRenderer->Pause(true); paused = true; AVM_WRITE("aviplay", "Audio stream eof\n"); } } // either we have enough prebuffered sound or audio renderer // is unable to extract new samples - wait for a while m_ThreadCond[th].Wait(m_ThreadMut[th], 0.1f); } else if (m_pAudioRenderer->GetBufferTime() - buftime > 0.02) { // just a small trick - so the buffers will not be filled // so fast when seeking - it's better for ffrwd //AVM_WRITE("aviplay", "JO %f %f\n", buftime, avm_get_time_diff(avm_get_time_us(), m_llTimeStart)); m_ThreadCond[th].Wait(m_ThreadMut[th], 0.01f); } } AVM_WRITE("aviplay", 1, "Thread audio finished\n"); return 0; } void* AviPlayer::decoderThread() { const ThreadId th = THREAD_DECODER; m_ThreadMut[th].Lock(); // thread started only with (stream != NULL) AVM_WRITE("aviplay", 1, "Thread decoder started\n"); changePriority("Video decoder ", PRIORITY_ADD_VIDEO); if (geteuid() == 0) AVM_WRITE("aviplay", "!!!Running video decoder as ROOT - Dangerous!!!\n"); while (checkSync(th)) { // if we are after seek - leave some time for the user // if he will want to seek more there is no need to // precache frames at this point if (m_bVideoBuffered && !m_bDropping && m_llTimeStart && avm_get_time_diff(avm_get_time_us(), m_llTimeStart) > 0.05) { m_QueueMutex.Lock(); size_t bs; size_t b = m_pVideostream->GetBuffering(&bs); //AVM_WRITE("aviplay", "Bdecoder %d %d %f\n", b, bs, avm_get_time_diff(avm_get_time_us(), m_llTimeStart)); // smart condition - do not stop with one-buffer if (b >= (bs - 1) && b > 0) { //int64_t tin = avm_get_time_us(); m_ThreadMut[th].Unlock(); //AVM_WRITE("aviplay", "MUTEXWAIT %d\n", b); m_QueueCond.Broadcast(); m_QueueCond.Wait(m_QueueMutex); m_QueueMutex.Unlock(); m_ThreadMut[th].Lock(); //float td = avm_get_time_diff(avm_get_time_us(), tin); //b = m_pVideostream->GetBuffering(&bs); //AVM_WRITE("aviplay", "Bdecoder %d %d\n", b, bs); //AVM_WRITE("aviplay", "FREETM %f\n", td); continue; // recheck m_bVideoBuffered } setQuality(); m_QueueMutex.Unlock(); int64_t tin = avm_get_time_us(); //avm_usleep(40000); // debug drop //AVM_WRITE("aviplay", "readin %f\n", m_pVideostream->GetTime()); int hr = m_pVideostream->ReadFrame(true); m_fDecodingTime = avm_get_time_diff(avm_get_time_us(), tin); //AVM_WRITE("aviplay", "readout %d %f %f\n", hr, m_pVideostream->GetTime(), m_fDecodingTime); m_QueueMutex.Lock(); m_QueueCond.Broadcast(); m_QueueMutex.Unlock(); if (hr >= 0) continue; // frame is OK -> next frame } m_ThreadCond[th].Wait(m_ThreadMut[th], 0.1f); } AVM_WRITE("aviplay", 1, "Thread decoder finished\n"); return 0; } void AviPlayer::changePriority(const char* taskName, int addPriority, int schedt) { return ; #if !defined(__NetBSD__) && !defined(__FreeBSD__) if (addPriority != 0) { if (!taskName) taskName = ""; #if 1 int p = getpriority(PRIO_PROCESS, 0) + addPriority; if (p > 20) p = 20; setpriority(PRIO_PROCESS, 0, p); AVM_WRITE("aviplay", "%s thread lowered priority to %d\n", taskName, getpriority(PRIO_PROCESS, 0)); #else // this code doesn't work on Linux! // it looks like pthread priority is completely ignored and the only // way is to call 'setpriority' as you see above int policy; struct sched_param sched; pthread_getschedparam(pthread_self(), &policy, &sched); sched.sched_priority += addPriority; pthread_setschedparam(pthread_self(), policy, &sched); AVM_WRITE("aviplay", "%s using priority: %d\n", taskName, sched.sched_priority); #endif } if (schedt != 0 && m_iEffectiveUid == 0) { // we could use FIFO scheduler with root access privilegies seteuid(m_iEffectiveUid); setegid(m_iEffectiveGid); const char sched_txt[][12] = { "SCHED_OTHER", "SCHED_FIFO", "SCHED_RR" }; struct sched_param schedRec; if (sched_getparam(0, &schedRec) != 0) { perror("sched_getparam"); return; } schedRec.sched_priority = sched_get_priority_min(schedt); if (sched_setscheduler(0, schedt, &schedRec) != 0) { perror("sched_setscheduler"); return; } AVM_WRITE("aviplay", "Video thread - using scheduler: %s\n", sched_txt[sched_getscheduler(0)]); setuid(getuid()); setgid(getgid()); } #endif // __NetBSD__ & __FreeBSD__ } void AviPlayer::syncFrame() { if (m_pVideostream && !m_bVideoMute && m_bCallSync) { m_bCallSync = false; int64_t newSync = avm_get_time_us(); // blit image on screen for (size_t i = 0; i < m_VideoRenderers.size(); ++i) m_VideoRenderers[i]->Sync(); // splited into two parts so we do not create jumping images // even in the debug mode int64_t newVideo = avm_get_time_us(); float newDiff = avm_get_time_diff(newVideo, m_llLastVideoSync); m_fLastSyncTime = avm_get_time_diff(newVideo, newSync); // after check of ahead might be more precise time for this // however we would have to play some with pausing // so we currently place the image right here double newAudio = (m_pAudioRenderer) ? m_pAudioRenderer->GetTime() : 0.0; //if (d < 0.027 || d > 0.043) AVM_WRITE("aviplay", 1, "AVS:%+8.4f s:%5.1f Vd:%5.1f Ad:%5.1f VSync:%2.1f %.3f\n", m_dLastFrameStart - newAudio, // sync m_fLastSleepTime * 1000.0, // sleep newDiff * 1000.0, // vdiff (newAudio - m_dLastAudioSync) * 1000.0, // adiff m_fLastSyncTime * 1000.0, m_dLastFrameStart ); m_dLastAudioSync = newAudio; m_llLastVideoSync = newVideo; m_fLastDiff = newDiff; } } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviplay/hqtest.cpp0000644000175000017500000000300710474274652020203 0ustar yavoryavor// for testing #include "avm_cpuinfo.h" #include "utils.h" #include "IAudioResampler.h" #include "AudioFpHQResampler.h" #include #include #include #include using namespace std; int main(int argc, char* argv[]) { #define SZ1 4000 #define SZ2 5000 //#define TESTSTEREO 1 #ifdef TESTSTEREO avm::IAudioResampler* t = avm::CreateHQResampler(2, 16); #else avm::IAudioResampler* t = avm::CreateHQResampler(1, 16); #endif short in[2*(SZ1 + SZ2)]; short out[2*(SZ1 + SZ2)]; memset(in, 0, sizeof(in)); memset(out, 0, sizeof(out)); for (int i = 0; i < SZ1; i++) { #if TESTSTEREO in[i*2] = i - SZ1/2; in[i*2+1] = i - SZ1/2; #else in[i] = 100 * (i - SZ1/2); //in[i] = (short)(sin(i * 10 * 3.14 / 180) * 10000); #endif } //in[SZ1] = in[SZ1 - 1]; int64_t ts = avm_get_time_us(); for (int i = 0; i < 10000; i++) //for (int i = 0; i < 1; i++) t->resample(out, in, SZ2, SZ1); int64_t te = avm_get_time_us(); for (int i = 0; i < ((SZ1 > SZ2) ? (SZ1) : (SZ2)) && i < 100; i++) { #ifdef TESTSTEREO cout << " i " << i << " " << in[i*2] << " " << in[i*2+1] << " -> " << out[i*2] << " " << out[i*2+1] << endl; #else cout << " i " << i << " " << in[i] << " -> " << out[i] << " " << out[i+1] - out[i] << endl; #endif } cout << "time " << avm_get_time_diff(te, ts) << "s" << endl; //for (int i = 0; i < 40; i++) // cout << sin(i * 10 * 3.14 / 180) * 10000 << " " << sin(i * 10 * 4 / 5.0 * 3.14 / 180) * 10000 << endl; } avifile-0.7.48~20090503.ds/lib/Makefile.am0000644000175000017500000001067511170617575016566 0ustar yavoryavorlib_LTLIBRARIES = libaviplay.la noinst_HEADERS =\ Uncompressed.h\ aviplay/AudioCleaner.h\ aviplay/AudioFpHQResampler.h\ aviplay/AudioIntResampler.h\ aviplay/AudioQueue.h\ aviplay/aviplay_impl.h\ aviplay/CopyAudioRenderer.h\ aviplay/IAudioRenderer.h\ aviplay/IAudioResampler.h\ aviplay/OssAudioRenderer.h\ aviplay/SdlAudioRenderer.h\ aviplay/SunAudioRenderer.h\ aviread/AsfFileInputStream.h\ aviread/asffmt.h\ aviread/AsfInputStream.h\ aviread/AsfNetworkInputStream.h\ aviread/AsfReadHandler.h\ aviread/AsfReadStream.h\ aviread/AsfRedirectInputStream.h\ aviread/asf_guids.h\ aviread/AsxReader.h\ aviread/avifmt.h\ aviread/AviReadHandler.h\ aviread/AviReadStream.h\ aviread/Cache.h\ aviread/FFReadHandler.h\ aviread/FFReadStream.h\ aviread/ReadHandlers.h\ aviread/ReadStream.h\ aviread/ReadStreamA.h\ aviread/ReadStreamV.h\ aviread/StreamInfoPriv.h\ aviwrite/AviWrite.h\ aviwrite/FileBuffer.h\ common/Config.h\ common/frame.h\ common/Statistic.h\ video/rendlock.h\ video/subrend.h libaviplay_la_SOURCES =\ codeckeeper.cpp\ Uncompressed.cpp\ aviplay/AudioCleaner.cpp\ aviplay/AudioFpHQResampler.cpp\ aviplay/AudioIntResampler.cpp\ aviplay/AudioQueue.cpp\ aviplay/aviplay.cpp\ aviplay/aviplay2.cpp\ aviplay/aviplayprop.cpp\ aviplay/aviplayth.cpp\ aviplay/CopyAudioRenderer.cpp\ aviplay/IAudioRenderer.cpp\ aviplay/SunAudioRenderer.cpp\ aviread/AsfFileInputStream.cpp\ aviread/asffmt.cpp\ aviread/AsfNetworkInputStream.cpp\ aviread/AsfReadHandler.cpp\ aviread/AsfReadStream.cpp\ aviread/AsfRedirectInputStream.cpp\ aviread/AsfStreamSeekInfo.cpp\ aviread/asf_guids.cpp\ aviread/AsxReader.cpp\ aviread/AviReadHandler.cpp\ aviread/AviReadStream.cpp\ aviread/Cache.cpp\ aviread/FFReadHandler.cpp\ aviread/FFReadStream.cpp\ aviread/ReadFile.cpp\ aviread/ReadStream.cpp\ aviread/ReadStreamA.cpp\ aviread/ReadStreamV.cpp\ aviread/StreamInfo.cpp\ aviwrite/AviWrite.cpp\ aviwrite/AviAudioWriteStream.cpp\ aviwrite/AviVideoWriteStream.cpp\ common/Args.cpp\ common/avm_output.cpp\ common/BaseError.cpp\ common/BitmapInfo.cpp\ common/Config.cpp\ common/fcc_type.c\ common/image.cpp\ common/impl_audio.cpp\ common/impl_video.cpp\ common/Locker.cpp\ common/mmx.cpp\ common/Registry.cpp\ common/Statistic.cpp\ common/String.cpp\ common/util.cpp\ common/utils.c\ common/vbrctrl.c\ common/wave_type.c\ subtitle/subread.c\ subtitle/subtitle.c\ subtitle/subwrite.c\ video/sub_ft.cpp\ video/renderer.cpp\ video/VideoDPMS.cpp if AMM_USE_OSS libaviplay_la_SOURCES += aviplay/OssAudioRenderer.cpp endif if AMM_USE_SDL libaviplay_la_SOURCES += aviplay/SdlAudioRenderer.cpp endif EXTRA_DIST =\ aviplay/OssAudioRenderer.cpp\ aviplay/SdlAudioRenderer.cpp\ common/testimage.cpp libaviplay_la_LIBADD = $(VIDIX_LIBS) $(SDL_LIBS) $(FT2_LIBS) AM_CXXFLAGS = $(VISIBILITYFLAG) AM_CPPFLAGS =\ -DPLUGIN_PATH=\"$(pkglibdir)\"\ -I$(top_srcdir)/drivers\ -I$(srcdir)/aviread\ -I$(srcdir)/subtitles\ -I$(srcdir)/common if AMM_USE_VIDIX libaviplay_la_LIBADD +=\ ../drivers/vidix/libvidix.la AM_CPPFLAGS +=\ -I$(top_srcdir)/drivers/vidix endif if AMM_FF_INTERNAL libaviplay_la_LIBADD +=\ ../ffmpeg/libavcodec/libavcodec.la\ ../ffmpeg/libavformat/libavformat.la\ ../ffmpeg/libavdevice/libavdevice.la\ ../ffmpeg/libavutil/libavutil.la AM_CPPFLAGS += -I$(top_srcdir)/ffmpeg else # fix this later libaviplay_la_LIBADD += $(FFMPEG_LIBS)\ -lavcodec -lavformat -lavdevice -lavutil AM_CPPFLAGS += $(FFMPEG_CFLAGS) endif AM_CPPFLAGS += $(DIVX4_CFLAGS) $(XVID_CFLAGS) $(PTHREAD_CFLAGS) $(SDL_CFLAGS) AM_CPPFLAGS += $(X_CFLAGS) $(XFT_CFLAGS) $(FT2_CFLAGS) $(ICONV_CFLAGS) libaviplay_la_LIBADD += $(X_LIBS) $(XFT_LIBS) $(ICONV_LIBS) libaviplay_la_LIBADD += $(PTHREAD_LIBS) $(DL_LIBS) $(I386_LDADD) $(EXTRA_LIBS) libaviplay_la_LDFLAGS = -Wl,-Bsymbolic -release $(AVIFILE_MAJOR_VERSION).$(AVIFILE_MINOR_VERSION) -version-info 0:$(AVIFILE_MICRO_VERSION):0 # just for testing speed #check_PROGRAMS = hqtest #hqtest_SOURCES = aviplay/hqtest.cpp #hqtest_LDFLAGS = libaviplay.la $(SDL_LDADD) #testimage #testimage_SOURCES = testimage.cpp #testimage_LDFLAGS = -g ../libaviplay.la #testimage_CXXFLAGS = -g -O4 #imtest.o: image.o mmx.o # $(CXXCOMPILE) -DIMTEST -o $@ -c $< #imtest: imtest.o # $(CXXCOMPILE) -g -o $@ $< -laviplay #res_SOURCES = ResampleSinc.cpp CLEANFILES =\ aviplay/hqtest\ common/imtest\ common/testimage #check_PROGRAMS = subtest #subtest_SOURCES = subtest.c #subtest_LDADD = libsubtitle.la #EXTRA_DIST = libaviplay.cpp MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/lib/Makefile.avm0000644000175000017500000000153607547604373016755 0ustar yavoryavor AR = ar clq RANLIB = ranlib CXX = g++ CXXFLAGS = -g -O2 -march=i586 -pipe -fPIC -DPIC -DHAVE_CONFIG_H -D_REENTRANT \ -DPLUGIN_PATH=\"/usr/lib/avifile0.6\" -Iaviread -I../include -I../../include -I/usr/include/SDL -Wall -Wno-unused CFLAGS = $(CXXFLAGS) SRCCXXFILES = $(shell find . -name '*.cpp' -print ) SRCCFILES = $(shell find . -name '*.c' -print ) OBJCXXFILES = $(SRCCXXFILES:.cpp=.o) OBJCFILES = $(SRCCFILES:.c=.o) TARGET = libaviplay all: $(TARGET) %.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< libaviplay: $(OBJCXXFILES) $(OBJCFILES) @$(RM) -f $@ @echo -n "linking library $@..." @$(AR) $@ $(OBJFILES) @$(RANLIB) $@ @echo "done" .PHONY: all clean clean: $(RM) -f core `find . -name '*.[od]' -o -name '*~' \ -o -name '*.bak' -o -name '.*bak' -o -name core -o -name cscope.files \ -o -name '*.out' -o -name '*.lo' ` $(RM) -f libaviplay avifile-0.7.48~20090503.ds/lib/Uncompressed.cpp0000644000175000017500000000763611164474166017710 0ustar yavoryavor#include "Uncompressed.h" #include "avm_except.h" #include "avifile.h" // IStream #include #include // sprintf #include // sprintf AVM_BEGIN_NAMESPACE; #define __MODULE__ "Uncompress" Unc_Decoder::Unc_Decoder(const CodecInfo& info, const BITMAPINFOHEADER& h, int flip) :IVideoDecoder(info, h) { m_Dest = *m_pFormat; switch (m_pFormat->biCompression) { case IMG_FMT_YUY2: m_Dest.SetSpace(IMG_FMT_YUY2); m_Cap = CAP_YUY2; break; case IMG_FMT_YV12: m_Dest.SetSpace(IMG_FMT_YV12); m_Cap = CAP_YV12; break; case IMG_FMT_I420: m_Dest.SetSpace(IMG_FMT_I420); m_Cap = CAP_I420; break; case IMG_FMT_UYVY: m_Dest.SetSpace(IMG_FMT_UYVY); m_Cap = CAP_UYVY; break; case IMG_FMT_Y800: m_Dest.SetSpace(IMG_FMT_Y800); break; case 0: case mmioFOURCC('D', 'I', 'B', ' '): case mmioFOURCC('R', 'G', 'B', ' '): case mmioFOURCC('r', 'a', 'w', ' '): if (m_Dest.biBitCount == 16) m_Dest.SetBits(15); else m_Dest.SetBits(m_Dest.biBitCount); /* fall through */ case 3: // image is always stored in bottom-up form if (!flip) m_Dest.biHeight *= -1; m_Cap = CAP_NONE; break; default: char msg[100]; sprintf(msg, "unsupported format: 0x%x (%.4s)!", m_pFormat->biCompression, (char*)&m_pFormat->biCompression); throw FATAL(msg); } #undef __MODULE__ // 32bit 8bit B 8bit G 8bit R 8bit reserved // 24bit 8bit B 8bit G 8bit R // 16bit Windows BI_RGB format always means // (11 - 15) B (6 - 10) G (1 - 5) R 0 reserved // Image data is always padded to ensure that each scan line // begins on an even byte boundary // e.g. - 75 pixels width image has one empty column /* printf("Uncompressed video %dx%d %d %d %d\n", m_pFormat->biWidth, m_pFormat->biHeight, m_pFormat->biSizeImage, m_pFormat->biWidth * m_pFormat->biHeight, m_pFormat->biBitCount); */ dest = m_Dest; dest.biWidth = (dest.biWidth + 1) & ~1; } Unc_Decoder::~Unc_Decoder() { Stop(); } int Unc_Decoder::DecodeFrame(CImage* pImage, const void* src, size_t size, int is_keyframe, bool render, CImage** pOut) { CImage ci(&dest, (const uint8_t*)src, false); //printf("DECODER RGB\n"); dest.Print(); pImage->GetFmt()->Print(); pImage->Convert(&ci); pImage->SetQuality(1.0); return 0; } int Unc_Decoder::SetDestFmt(int bits, fourcc_t csp) { if (!CImage::Supported(csp, bits)) return -1; // we allow to set any dest format if (bits == 0) bits = csp; switch (bits) { case 15: case 16: case 24: case 32: m_Dest.SetBits(bits); return 0; } m_Dest.SetSpace(bits); //printf("SETDESTFMT %d %.4s\n", bits, (char*) &csp); return 0; } /** * * E N C O D E R * */ Unc_Encoder::Unc_Encoder(const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& header) :IVideoEncoder(info), head(header) { switch (info.fourcc) { case fccYUY2: case fccYV12: case fccI420: case fccUYVY: head.SetSpace(info.fourcc); break; default: head.SetBits(info.fourcc); head.SetDirection(1); } chead = head; // for YUV - topdown is used - but biHeight in header is positive head.biHeight = (int32_t)labs(head.biHeight); } Unc_Encoder::~Unc_Encoder() { } size_t Unc_Encoder::GetOutputSize() const { return head.biSizeImage; } const BITMAPINFOHEADER& Unc_Encoder::GetOutputFormat() const { return head; } int Unc_Encoder::EncodeFrame(const CImage* src, void* dest, int* is_keyframe, size_t* size, int* lpckid) { // FIXME - add check for proper orded!!! //printf("FMT from -> to\n"); src->GetFmt()->Print(); chead.Print(); CImage ci(&chead, (uint8_t*)dest, false); ci.Convert(src); if (size) *size = head.biSizeImage; if (is_keyframe) *is_keyframe = IStream::KEYFRAME; return 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/Uncompressed.h0000644000175000017500000000436511164474166017351 0ustar yavoryavor#ifndef AVIFILE_UNCOMPRESSED_H #define AVIFILE_UNCOMPRESSED_H #include "videodecoder.h" #include "videoencoder.h" #include "avm_fourcc.h" AVM_BEGIN_NAMESPACE; class Unc_Decoder: public IVideoDecoder { CAPS m_Cap; BitmapInfo dest; public: Unc_Decoder(const CodecInfo&, const BITMAPINFOHEADER&, int); virtual ~Unc_Decoder(); virtual CAPS GetCapabilities() const { return m_Cap; } virtual int DecodeFrame(CImage* dest, const void* src, size_t size, int is_keyframe, bool render = true, CImage** out = 0); virtual int SetDestFmt(int bits, fourcc_t csp); }; class Unc_Encoder: public IVideoEncoder { BitmapInfo head; BitmapInfo chead; public: Unc_Encoder(const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& header); virtual ~Unc_Encoder(); virtual int Start() { return 0; } virtual int Stop() { return 0; } virtual size_t GetOutputSize() const; virtual const BITMAPINFOHEADER& GetOutputFormat() const; virtual int EncodeFrame(const CImage* src, void* dest, int* is_keyframe, size_t* size, int* lpckid=0); }; static void uncompressed_FillPlugins(avm::vector& ci) { const fourcc_t unc_rgb24[] = { 0, 3, mmioFOURCC('D', 'I', 'B', ' '), mmioFOURCC('R', 'G', 'B', ' '), mmioFOURCC('r', 'a', 'w', ' '), 0 }; const fourcc_t unc_yuy2[] = { fccYUY2, 0 }; const fourcc_t unc_yv12[] = { fccYV12, 0 }; const fourcc_t unc_i420[] = { fccI420, 0 }; const fourcc_t unc_uyvy[] = { fccUYVY, 0 }; const fourcc_t unc_y800[] = { mmioFOURCC('Y', '8', '0', '0'), mmioFOURCC('Y', '8', ' ', ' '), 0 }; ci.push_back(CodecInfo(unc_rgb24, "Uncompressed RGB", "", "", CodecInfo::Source, "rgb")); ci.push_back(CodecInfo(unc_yuy2, "Uncompressed YUY2", "", "", CodecInfo::Source, "yuy2")); ci.push_back(CodecInfo(unc_yv12, "Uncompressed YV12", "", "", CodecInfo::Source, "yv12")); ci.push_back(CodecInfo(unc_i420, "Uncompressed I420", "", "", CodecInfo::Source, "i420")); ci.push_back(CodecInfo(unc_uyvy, "Uncompressed UYVY", "", "", CodecInfo::Source, "uyvy")); ci.push_back(CodecInfo(unc_y800, "Uncompressed Y800", "", "", CodecInfo::Source, "y800")); } AVM_END_NAMESPACE; #endif /* AVIFILE_UNCOMPRESSED_H */ avifile-0.7.48~20090503.ds/lib/codeckeeper.cpp0000644000175000017500000006263611174447124017506 0ustar yavoryavor#include "avm_cpuinfo.h" #include "avm_except.h" // catch only #include "avm_creators.h" #include "videodecoder.h" #include "videoencoder.h" #include "audiodecoder.h" #include "audioencoder.h" #include "plugin.h" #include "configfile.h" #include "utils.h" #include "avm_output.h" #include "aviplay.h" // GetAvifileVersion #include "version.h" #include "../plugins/libac3pass/fillplugins.h" #include "../plugins/libaudiodec/fillplugins.h" #include "../plugins/libdivx4/fillplugins.h" #include "../plugins/libffmpeg/fillplugins.h" #include "../plugins/libmad/fillplugins.h" #include "../plugins/libmp3lame_audioenc/fillplugins.h" #include "../plugins/libmp3lamebin_audioenc/fillplugins.h" #include "../plugins/libmpeg_audiodec/fillplugins.h" #include "../plugins/libvorbis/fillplugins.h" #include "../plugins/libwin32/fillplugins.h" #include "../plugins/libxvid/fillplugins.h" #include "../plugins/libxvid4/fillplugins.h" #include "../samples/mjpeg_plugin/fillplugins.h" #include "Uncompressed.h" #include #include #include #include #include #ifndef RTLD_PARENT #define RTLD_PARENT 0 #endif #if 1 // gdb catch point extern "C" void trapbug(void) { static int a = 0; a++; } #endif avm::vector video_codecs; avm::vector audio_codecs; #define Debug if(0) static bool pluginit = false; const char* plugin_def_path = PLUGIN_PATH; static avm::string last_error; AVM_BEGIN_NAMESPACE; static avm::vector video_order; static avm::vector audio_order; #if ARCH_X86_32 /* * LDT_Keeper MUST be here * LDT must be modified before program creates first thread */ // including c-file is slightly unusual, but // we prevent to have duplicated code #include "../plugins/libwin32/loader/ldt_keeper.c" struct LDT_Keeper { ldt_fs_t* ldt_fs; LDT_Keeper() : ldt_fs(0) {} ~LDT_Keeper() { if (ldt_fs) Restore_LDT_Keeper(ldt_fs); } // to be initialized only when Win32 plugin is available void init() { if (!ldt_fs) { ldt_fs = Setup_LDT_Keeper(); if (ldt_fs) AVM_WRITE("LDT keeper", "Installed fs segment: %p\n", ldt_fs->fs_seg); } } }; static LDT_Keeper Keeper; #endif static void plugin_close(const CodecInfo& ci) { if (PluginPrivate* pi = (PluginPrivate*) ci.handle) { //printf("PLUGINCLOSE %p c:%d\n", pi, (pi)?pi->refcount:12345); if (--pi->refcount <= 0 && pi->dlhandle) { if (((codec_plugin_t*)pi->fchandle) && ((codec_plugin_t*)pi->fchandle)->error) { free(((codec_plugin_t*)pi->fchandle)->error); ((codec_plugin_t*)pi->fchandle)->error = 0; } dlclose(pi->dlhandle); delete pi; ci.handle = 0; } } } codec_plugin_t* plugin_open(const CodecInfo& ci) { const char* name = ci.modulename.c_str(); PluginPrivate* pi = (PluginPrivate*) ci.handle; if (!pi) { pi = new PluginPrivate(); pi->dlhandle = dlopen(name, RTLD_LAZY | RTLD_PARENT); if (!pi->dlhandle) { AVM_WRITE("codec keeper", "WARNING: plugin %s could not be opened: %s\n", name, dlerror()); delete pi; return 0; } pi->fchandle = 0; pi->refcount = 0; ci.handle = pi; } pi->refcount++; if (!pi->fchandle) { char plgn[100]; strcpy(plgn, "avm_codec_plugin_"); const char* nx = strrchr(name, '/'); strncat(plgn, nx + 1, 50); char* x = strchr(plgn, '.'); *x = 0; codec_plugin_t* plugin = (codec_plugin_t*) dlsym(pi->dlhandle, plgn); if (!plugin || (plugin->version != PLUGIN_API_VERSION)) { if (plugin) { AVM_WRITE("codec keeper", "WARNING: plugin %s has version %d, expected %d (should be removed)\n", name, plugin->version, PLUGIN_API_VERSION); } else { AVM_WRITE("codec keeper", "WARNING: plugin %s is in incompatible format\n", name); } plugin_close(ci); return 0; } pi->fchandle = plugin; } return (codec_plugin_t*) pi->fchandle; } static void plugin_add_list(avm::vector& ci, const avm::string& fullname) { size_t vp = 0; for (size_t i = 0; i < ci.size(); i++) { ci[i].modulename = fullname; if (ci[i].media == CodecInfo::Video) { vp++; video_codecs.push_back(ci[i]); } else audio_codecs.push_back(ci[i]); } AVM_WRITE("codec keeper", 1, "%s: A/V %" PRIsz "/%" PRIsz "\n", fullname.c_str(), ci.size() - vp, vp); } static void plugin_get_error(codec_plugin_t* plugin) { if (plugin && plugin->error) AVM_WRITE("codec keeper", "%s\n", plugin->error); } // we have to avoid prefixed positive matches // i.e. ffmpeg_divx will not match ffmpeg static const char* sort_str(const char* haystack, const char* needle) { const char* r = haystack; size_t nl = strlen(needle); if (!strlen(haystack) || !nl) return 0; //printf("HAY %s %s\n", haystack, needle); while ((r = strstr(r, needle)) != NULL) { //printf("r %50s %s %p\n", r, haystack, needle); if (r == haystack || r[-1] == ',') { r += nl; if (!*r || *r == ',') return r; } r++; // next char (also skips ',') } return 0; } static int sort_codec_list(avm::vector& codecs, const char* orderlist) { // simple stupid bubble sort - this code is not supposed // to be executed very often... // // only CodecInfos' found in the list will be swaped // rest of them will stay in the unspecified order ///return 0; // disabled for now if (!orderlist) return 0; // always be sure list contains all codecs // so repeat all of them after passed parameter avm::string tl = orderlist; for (size_t i = 0; i < codecs.size(); ++i) { const char* p = sort_str(tl.c_str(), codecs[i]->GetPrivateName()); if (!p) p = sort_str(tl.c_str(), codecs[i]->GetName()); if (!p) { tl += ","; tl += codecs[i]->GetPrivateName(); //printf("MISSING %s\n", codecs[i]->GetPrivateName()); } } orderlist = tl.c_str(); int changed = 0; size_t len = strlen(orderlist); //printf("Sort for list of %d codecs with: %s \n", codecs.size(), orderlist); for (size_t i = 0; i < codecs.size(); ++i) { //printf("Order %d: %s (%s)\n", i, codecs[i]->GetPrivateName(), codecs[i]->GetName()); const char* p = sort_str(orderlist, codecs[i]->GetPrivateName()); if (!p) // tagged to the first position p = sort_str(orderlist, codecs[i]->GetName()); if (!p) // tagged to the first position continue;//orderlist + len; // last position size_t s = 0; for (size_t j = i + 1; j < codecs.size(); ++j) { //cout << " Compare with " << codecs[j].name.c_str() << endl; const char* r = sort_str(orderlist, codecs[j]->GetPrivateName()); if (!r) r = sort_str(orderlist, codecs[j]->GetName()); //cout << " ptr: " << (void*) r << " p: " << (void*) p << endl; if (r && r < p) { //printf("FOUND %.10s %.10s pn:%s\n", p, r, codecs[j]->GetPrivateName()); s = j; p = r; } } if (s > 0) { //printf("Swap %s <> %s\n", codecs[s]->GetPrivateName(), codecs[i]->GetPrivateName()); CodecInfo* t = codecs[s]; codecs[s] = codecs[i]; codecs[i] = t; changed++; } } //for (unsigned i = 0; i < codecs.size(); i++) // printf("Sorted %d: %s (%s)\n", i, codecs[i]->GetPrivateName(), codecs[i]->GetName()); return changed; } static void plugin_fill() { if (pluginit) return; pluginit = true; video_codecs.clear(); audio_codecs.clear(); // FFMPEG initialization avcodec_init(); avcodec_register_all(); uncompressed_FillPlugins(video_codecs); if (getenv("AVIPLUGIN_PATH")) plugin_def_path = getenv("AVIPLUGIN_PATH"); struct dirent *dp; int disc = 0; // for linux prefer memory leakless opendir #if defined(HAVE_OPENDIR) DIR *dir = opendir(plugin_def_path); if (dir != NULL) while ((dp = readdir(dir)) != NULL) { #elif defined(HAVE_SCANDIR) struct dirent **namelist = 0; int n; n = scandir(plugin_def_path, &namelist, 0, alphasort); if(n>0) while(n--) { dp = namelist[n]; #else #error No 'opendir' nor 'scandir' present - needs to be resolved... #endif // HAVE_SCANDIR char* name=dp->d_name; if (strlen(name)<4) continue; // find just .so named libraries/plugins if (strcmp(name+strlen(name)-3, ".so")) continue; avm::string dllname = name; avm::string fullname = plugin_def_path; fullname += "/"; fullname += dllname; const struct plugin_map { const char* name; void (*fill)(avm::vector& ci); } pm[] = { { "ac3pass", ac3pass_FillPlugins }, { "audiodec", audiodec_FillPlugins }, { "divx4", divx4_FillPlugins }, { "ffmpeg", ffmpeg_FillPlugins }, { "mad_audiodec", mad_FillPlugins }, { "mp3lame_audioenc", mp3lame_FillPlugins }, { "mp3lamebin_audioenc", mp3lamebin_FillPlugins }, { "mpeg_audiodec", mpeg_audiodec_FillPlugins }, { "osmjpeg", ijpg_FillPlugins }, { "vorbis", vorbis_FillPlugins }, { "win32", win32_FillPlugins }, { "xvid4", xvid4_FillPlugins }, // MUST BE before standalone xvid! { "xvid", xvid_FillPlugins }, { 0 } }; /** * This chunk of code eliminates the need to open several shared * libraries while starting every application */ const plugin_map* c; for (c = pm; c->name; c++) { if (dllname.substr(0, (uint_t)strlen(c->name)) == c->name) { avm::vector ci; c->fill(ci); plugin_add_list(ci, fullname); #if ARCH_X86_32 if (strcmp(c->name, "win32") == 0) Keeper.init(); #endif break; } } disc++; if (c->name) continue; // found in the table above //cout << "Loading " << fullname.c_str() << endl; // third party plugin #if 0 // FIXME codec_plugin_t* plugin = plugin_open(fullname.c_str()); if (plugin && plugin->register_codecs) { avm::vector ci; plugin->register_codecs(ci); PluginAddList(ci, fullname); } plugin_close(dlclose(handle); #endif #if defined(HAVE_SCANDIR) && !defined(HAVE_OPENDIR) free(dp); #endif } #if defined(HAVE_OPENDIR) if (dir) closedir(dir); #elif defined(HAVE_SCANDIR) if (namelist) free(namelist); #endif AVM_WRITE("codec keeper", "Found %d plugins (%s,A:%" PRIsz ",V:%" PRIsz ")\n", disc, plugin_def_path, audio_codecs.size(), video_codecs.size()); // hack avm::string sol; // move just numbers... video_order.resize(video_codecs.size()); for (size_t v = 0; v < video_order.size(); ++v) video_order[v] = &video_codecs[v]; audio_order.resize(audio_codecs.size()); for (size_t a = 0; a < audio_order.size(); ++a) audio_order[a] = &audio_codecs[a]; // use by default - but each codec might use it's own order sol = RegReadString("aviplay", "codecs-video", "ff"); sort_codec_list(video_order, sol.c_str()); sol = RegReadString("aviplay", "codecs-audio", "ff"); sort_codec_list(audio_order, sol.c_str()); } const avm::string& CodecGetError() { return last_error; } void CodecInfo::Get(avm::vector& infos, CodecInfo::Media media, Direction dir, fourcc_t fcc) { plugin_fill(); const avm::vector& v = (media == Video) ? video_order : audio_order; //infos.clear(); // ??? unsure for (size_t i = 0; i < v.size(); ++i) { if (v[i]->direction != Both && dir != Both && dir != v[i]->direction) continue; // check if fcc match is requested // for the encoding the first fcc must be matching if (fcc != ANY && ((dir == Encode && fcc != v[i]->fourcc) || v.invalid == v[i]->fourcc_array.find(fcc))) continue; infos.push_back(v[i]); } //printf("Selected %d infos\n", infos.size()); } IVideoDecoder* CreateDecoderVideo(const BITMAPINFOHEADER& bh, int depth, int flip, const char* privcname) { plugin_fill(); if (bh.biCompression == 0xffffffff) return 0; avm::vector::const_iterator it; for (it = video_order.begin(); it != video_order.end(); ++it) { const CodecInfo& ci = *(*it); if (!(ci.direction & CodecInfo::Decode) || (privcname && strcmp(ci.GetPrivateName(), privcname) != 0)) continue; avm::vector::const_iterator iv; for (iv = ci.fourcc_array.begin(); iv != ci.fourcc_array.end(); ++iv) { if (bh.biCompression == *iv) { codec_plugin_t* plugin; switch (ci.kind) { case CodecInfo::Source: return new Unc_Decoder(ci, bh, flip); default: plugin = plugin_open(ci); //AVM_WRITE("CodecKeeper", "Modname %s %p\n", ci.modulename.c_str(), plugin); if (plugin && plugin->video_decoder) { IVideoDecoder* vd = plugin->video_decoder(ci, bh, flip); if (!vd && (fourcc_t)bh.biCompression != ci.fourcc) { // try again with default codec for this // fourcc array AVM_WRITE("codec keeper", "Trying to use %.4s instead of %.4s\n", (const char*)&ci.fourcc, (const char*)&bh.biCompression); BITMAPINFOHEADER dbh(bh); dbh.biCompression = ci.fourcc; vd = plugin->video_decoder(ci, dbh, flip); } if (vd) { //it->handle = handle; AVM_WRITE("codec keeper", "Created video decoder: %s\n", ci.GetName()); return vd; } plugin_get_error(plugin); } plugin_close(ci); }//switch }//if }//for }//for char s[5]; last_error.sprintf("Unknown codec 0x%x = \"%.4s\"", bh.biCompression, avm_set_le32(s, bh.biCompression)); AVM_WRITE("codec keeper", "CreateVideoDecoder(): %s\n", last_error.c_str()); return 0; } IVideoEncoder* CreateEncoderVideo(const CodecInfo& ci, const BITMAPINFOHEADER& bh) { if (!(ci.direction & CodecInfo::Encode)) return 0; if (video_codecs.find(ci) == avm::vector::invalid) { AVM_WRITE("codec keeper", "Failed to find this CodecInfo in list\n"); return 0; } codec_plugin_t* plugin; switch(ci.kind) { case CodecInfo::Source: try { return new Unc_Encoder(ci, bh.biCompression, bh); } catch (FatalError& e) { e.PrintAll(); } break; default: plugin = plugin_open(ci); if (plugin && plugin->video_encoder) { IVideoEncoder* ve = plugin->video_encoder(ci, ci.fourcc, bh); if (ve) { // video_codecs[index] is same as ci, the only difference is in permissions //video_codecs[index].handle = handle; return ve; } plugin_get_error(plugin); } plugin_close(ci); } return 0; } IVideoEncoder* CreateEncoderVideo(fourcc_t compressor, const BITMAPINFOHEADER& bh, const char* cname) { plugin_fill(); avm::vector::const_iterator it; for (it = video_order.begin(); it != video_order.end(); ++it) { const CodecInfo& ci = *(*it); if (!(ci.direction & CodecInfo::Encode) || (cname && strcmp(ci.GetName(), cname) != 0)) continue; //AVM_WRITE("codec keeper", 0, "Check dir:%d 0x%x (%.4s) cname:(%s)\n", ci.direction, // compressor, (const char*) &compressor, cname); if ((cname && cname[0] && !compressor) || ci.fourcc == compressor) if (IVideoEncoder* ve = CreateEncoderVideo(ci, bh)) { AVM_WRITE("codec keeper", "%s video encoder created\n", ci.GetName()); return ve; } } char s[5]; last_error.sprintf("Unknown codec 0x%x = \"%.4s\"", compressor, avm_set_le32(s, compressor)); AVM_WRITE("codec keeper", "CreateVideoEncoder(): %s\n", last_error.c_str()); return 0; } IVideoEncoder* CreateEncoderVideo(const VideoEncoderInfo& info) { const char* cname = info.cname.size() ? info.cname.c_str() : 0; return CreateEncoderVideo(info.compressor, info.header, cname); } IAudioEncoder* CreateEncoderAudio(const CodecInfo& ci, const WAVEFORMATEX* fmt) { if (!(ci.direction & CodecInfo::Encode)) return 0; if (audio_codecs.find(ci) == avm::vector::invalid) { AVM_WRITE("codec keeper", "Failed to find this CodecInfo in list\n"); return 0; } codec_plugin_t* plugin = plugin_open(ci); if (plugin && plugin->audio_encoder) { if (IAudioEncoder* ae = plugin->audio_encoder(ci, ci.fourcc, fmt)) return ae; plugin_get_error(plugin); } plugin_close(ci); return 0; } IAudioEncoder* CreateEncoderAudio(fourcc_t compressor, const WAVEFORMATEX* format) { plugin_fill(); avm::vector::const_iterator it; for (it = audio_order.begin(); it != audio_order.end(); ++it) { const CodecInfo& ci = *(*it); if ((ci.direction & CodecInfo::Encode) && ci.fourcc_array.find(compressor) != avm::vector::invalid) if (IAudioEncoder* ae = CreateEncoderAudio(ci, format)) return ae; } last_error.sprintf("No audio decoder for ID 0x%x", format->wFormatTag); return 0; } IAudioDecoder* CreateDecoderAudio(const WAVEFORMATEX* format, const char* privcname) { plugin_fill(); avm::vector::const_iterator it; for (it = audio_order.begin(); it != audio_order.end(); ++it) { const CodecInfo& ci = *(*it); if (!(ci.direction & CodecInfo::Decode) || (privcname && strcmp(ci.GetPrivateName(), privcname) != 0)) continue; avm::vector::const_iterator iv; for (iv = ci.fourcc_array.begin(); iv != ci.fourcc_array.end(); ++iv) { //printf("Audio search %x for %x\n", format->wFormatTag, *iv); if (unsigned(format->wFormatTag) == *iv) { codec_plugin_t* plugin; switch(ci.kind) { default: if (format->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { // check GUID const WAVEFORMATEXTENSIBLE& wfe = *(const WAVEFORMATEXTENSIBLE*)format; if (memcmp(&wfe.SubFormat, &ci.guid, sizeof(GUID)) != 0) continue; } plugin = plugin_open(ci); if (plugin && plugin->audio_decoder) { IAudioDecoder* ad = plugin->audio_decoder(ci, format); if (ad) { //ci.handle = handle; AVM_WRITE("codec keeper", "%s audio decoder created\n", ci.GetName()); return ad; } plugin_get_error(plugin); } plugin_close(ci); continue; } } } } last_error.sprintf("No audio decoder for ID 0x%x", format->wFormatTag); return 0; } int CodecGetAttr(const CodecInfo& info, const char* attribute, float* value) { int result = -1; codec_plugin_t* plugin = plugin_open(info); if (plugin && plugin->get_attr_float) result = plugin->get_attr_float(info, attribute, value); plugin_close(info); return result; } int CodecSetAttr(const CodecInfo& info, const char* attribute, float value) { int result = -1; codec_plugin_t* plugin = plugin_open(info); if (plugin && plugin->set_attr_float) result = plugin->set_attr_float(info, attribute, value); plugin_close(info); return result; } int CodecGetAttr(const CodecInfo& info, const char* attribute, int* value) { int result = -1; codec_plugin_t* plugin = plugin_open(info); if (plugin && plugin->get_attr_int) result = plugin->get_attr_int(info, attribute, value); plugin_close(info); return result; } int CodecSetAttr(const CodecInfo& info, const char* attribute, int value) { int result = -1; codec_plugin_t* plugin = plugin_open(info); if (plugin && plugin->set_attr_int) result = plugin->set_attr_int(info, attribute, value); plugin_close(info); return result; } int CodecGetAttr(const CodecInfo& info, const char* attribute, const char** value) { int result = -1; codec_plugin_t* plugin = plugin_open(info); if (plugin && plugin->get_attr_string) result = plugin->get_attr_string(info, attribute, value); plugin_close(info); return result; } int CodecSetAttr(const CodecInfo& info, const char* attribute, const char* value) { int result = -1; codec_plugin_t* plugin = plugin_open(info); if (plugin && plugin->set_attr_string) result = plugin->set_attr_string(info, attribute, value); plugin_close(info); return result; } void FreeDecoderAudio(IAudioDecoder* decoder) { if (decoder) { const CodecInfo& info = decoder->GetCodecInfo(); AVM_WRITE("codec keeper", 1, "FreeAudioDecoder() %s\n", info.GetName()); delete decoder; plugin_close(info); } } void FreeEncoderAudio(IAudioEncoder* encoder) { if (encoder) { const CodecInfo& info = encoder->GetCodecInfo(); AVM_WRITE("codec keeper", 1, "FreeAudioEncoder() %s\n", info.GetName()); delete encoder; plugin_close(info); } } void FreeDecoderVideo(IVideoDecoder* decoder) { if (decoder) { const CodecInfo& info = decoder->GetCodecInfo(); AVM_WRITE("codec keeper", 1, "FreeVideoDecoder() %s\n", info.GetName()); delete decoder; plugin_close(info); } } void FreeEncoderVideo(IVideoEncoder* encoder) { if (encoder) { const CodecInfo& info = encoder->GetCodecInfo(); AVM_WRITE("codec keeper", 1, "FreeVideoEncoder() %s\n", info.GetName()); delete encoder; plugin_close(info); } } int SortVideoCodecs(const char* orderlist) { return sort_codec_list(video_order, orderlist); } int SortAudioCodecs(const char* orderlist) { return sort_codec_list(audio_order, orderlist); } int PluginGetAttrFloat(const CodecInfo& info, const char* attribute, float* value) { const AttributeInfo* attr = info.FindAttribute(attribute); const char* n = info.GetPrivateName(); if (attr && attr->GetKind() == AttributeInfo::Float) { *value = RegReadFloat(n, attribute, attr->GetDefaultFloat()); return 0; } AVM_WRITE(n, "GetAttrFloat unsupported attribute or incorrect value %s = %f\n", attribute, *value);\ return -1; } int PluginSetAttrFloat(const CodecInfo& info, const char* attribute, float value) { const AttributeInfo* attr = info.FindAttribute(attribute); const char* n = info.GetPrivateName(); if (attr && attr->GetKind() == AttributeInfo::Float && attr->IsValid(value)) return RegWriteFloat(n, attribute, value); AVM_WRITE(n, "SetAttrFloat unsupported attribute or incorrect value %s = %f\n", attribute, value); return -1; } int PluginGetAttrInt(const CodecInfo& info, const char* attribute, int* value) { const AttributeInfo* attr = info.FindAttribute(attribute); const char* n = info.GetPrivateName(); if (attr && (attr->GetKind() == AttributeInfo::Integer || attr->GetKind() == AttributeInfo::Select)) { *value = RegReadInt(n, attribute, attr->GetDefault()); return 0; } AVM_WRITE(n, "GetAttrInt unsupported attribute or incorrect value %s = %d\n", attribute, *value);\ return -1; } int PluginSetAttrInt(const CodecInfo& info, const char* attribute, int value) { const AttributeInfo* attr = info.FindAttribute(attribute); const char* n = info.GetPrivateName(); if (attr && (attr->GetKind() == AttributeInfo::Integer || attr->GetKind() == AttributeInfo::Select) && attr->IsValid(value)) { return RegWriteInt(n, attribute, value); } AVM_WRITE(n, "SetAttrInt unsupported attribute or incorrect value %s = %d\n", attribute, value); return -1; } int PluginGetAttrString(const CodecInfo& info, const char* attribute, const char** value) { const AttributeInfo* attr = info.FindAttribute(attribute); const char* n = info.GetPrivateName(); if (value && attr && (attr->GetKind() == AttributeInfo::String)) { *value = RegReadString(n, attribute, ""); return 0; } AVM_WRITE(n, "GetAttrStr unsupported attribute or incorrect value %s = %p\n", attribute, value);\ return -1; } int PluginSetAttrString(const CodecInfo& info, const char* attribute, const char* value) { const AttributeInfo* attr = info.FindAttribute(attribute); const char* n = info.GetPrivateName(); if (value && attr && (attr->GetKind() == AttributeInfo::String)) return RegWriteString(n, attribute, value); AVM_WRITE(n, "SetAttrString unsupported attribute or incorrect value %s = %p\n", attribute, value); return -1; } const CodecInfo* CodecInfo::match(fourcc_t fcccodec, CodecInfo::Media cimedia, const CodecInfo* start, CodecInfo::Direction cdir) { if (video_codecs.size() == 0 && audio_codecs.size() == 0) { BITMAPINFOHEADER bi; bi.biCompression = 0xffffffff; // just to fill video_codecs list CreateDecoderVideo(bi, 0, 0); } const avm::vector& c = (cimedia == Video) ? video_codecs : audio_codecs; for (size_t i = 0; i < c.size(); ++i) { if (start) { if (&c[i] == start) start = 0; continue; } const CodecInfo& ci = c[i]; if (((int)ci.direction & (int)cdir) != (int)cdir) continue; //printf("CHECK DIR %d %x %x %s\n", ci.direction, fcccodec, ci.fourcc, ci.GetName()); if (cdir == Encode) { // for encoding we want exact match - the first fourcc if (fcccodec == ci.fourcc) return &ci; } else { for (size_t j = 0; j < ci.fourcc_array.size(); j++) { //printf("SEARCH FOR %.4s (0x%x) %.4s (0x%x) %d:%d\n", (char*)&fcccodec, fcccodec, (char*)&ci.fourcc_array[j], ci.fourcc_array[j], i, j); if (fcccodec == ci.fourcc_array[j]) return &ci; } } } return 0; } const CodecInfo* CodecInfo::match(CodecInfo::Media cimedia, const char* pname) { if (video_codecs.size() == 0 && audio_codecs.size() == 0) { BITMAPINFOHEADER bi; bi.biCompression = 0xffffffff; // just to fill video_codecs list CreateDecoderVideo(bi, 0, 0); } const avm::vector& c = (cimedia == Video ) ? video_codecs : audio_codecs; for (size_t i = 0; i < c.size(); ++i) { const CodecInfo& ci = c[i]; if (strcmp(ci.GetPrivateName(), pname) == 0 || strcmp(ci.GetName(), pname) == 0) return &ci; } return 0; } AVM_END_NAMESPACE; int GetAvifileVersion() { return AVIFILE_VERSION; } avifile-0.7.48~20090503.ds/lib/libaviplay.cpp0000644000175000017500000000357707513526510017367 0ustar yavoryavor#include "aviread/Cache.cpp" #include "aviplay/AudioCleaner.cpp" #include "aviplay/AudioFpHQResampler.cpp" #include "aviplay/AudioIntResampler.cpp" #include "aviplay/AudioQueue.cpp" #include "aviplay/CopyAudioRenderer.cpp" #include "aviplay/IAudioRenderer.cpp" #include "aviplay/OssAudioRenderer.cpp" #include "aviplay/RegAccess.cpp" #include "aviplay/SdlAudioRenderer.cpp" #include "aviplay/Statistic.cpp" #include "aviplay/SunAudioRenderer.cpp" #include "aviplay/aviplay.cpp" #include "aviplay/aviplay2.cpp" #include "aviplay/aviplayprop.cpp" #include "aviplay/aviplayth.cpp" #include "aviread/AsfFileInputStream.cpp" #include "aviread/AsfNetworkInputStream.cpp" #include "aviread/AsfReadHandler.cpp" #include "aviread/AsfReadStream.cpp" #include "aviread/AsfRedirectInputStream.cpp" #include "aviread/AsfStreamSeekInfo.cpp" #include "aviread/AsxReader.cpp" #include "aviread/AviReadHandler.cpp" #include "aviread/AviReadStream.cpp" #include "aviread/ReadFile.cpp" #include "aviread/ReadStream.cpp" #include "aviread/ReadStreamA.cpp" #include "aviread/ReadStreamV.cpp" #include "aviread/StreamInfo.cpp" #include "aviread/asf_guids.cpp" #include "aviread/asffmt.cpp" #include "aviwrite/AviAudioWriteStream.cpp" #include "aviwrite/AviVideoWriteStream.cpp" #include "aviwrite/AviWrite.cpp" #include "common/BaseError.cpp" #include "common/BitmapInfo.cpp" #include "common/Config.cpp" #include "common/Locker.cpp" #include "common/Registry.cpp" #include "common/avm_output.cpp" #include "common/image.cpp" #include "common/impl_audio.cpp" #include "common/impl_video.cpp" #include "common/mmx.cpp" #include "common/util.cpp" #include "video/VideoDPMS.cpp" #include "video/renderer.cpp" #include "common/wave_type.c" #include "common/utils.c" #include "common/fcc_type.c" #include "subtitle/subread.c" #include "subtitle/subtest.c" #include "subtitle/subtitle.c" #include "Uncompressed.cpp" #include "codeckeeper.cpp" avifile-0.7.48~20090503.ds/lib/aviread/0000755000175000017500000000000011267637352016136 5ustar yavoryavoravifile-0.7.48~20090503.ds/lib/aviread/AsfFileInputStream.cpp0000644000175000017500000001655011176642755022360 0ustar yavoryavor#include "Cache.h" // first for lseek64 support #include "AsfFileInputStream.h" #include "asf_guids.h" #include "avm_output.h" #include "utils.h" #include #include #include #include #include #include #include #ifndef O_LARGEFILE #define O_LARGEFILE 0 #endif AVM_BEGIN_NAMESPACE; #define __MODULE__ "AsfFileInputStream" AsfIterator::~AsfIterator() { } AsfInputStream::~AsfInputStream() { } class FileIterator: public AsfIterator { public: FileIterator(AsfFileInputStream* parent, int id) : AsfIterator(id), m_lPos(0), m_pParent(parent), m_SeekInfo(m_pParent->m_SeekInfo[id]) { } virtual const AsfStreamSeekInfo* getSeekInfo() { return m_SeekInfo; } virtual AsfPacket* getPacket() { const ASFMainHeader& header = m_pParent->m_Header; //printf("Id: %d PID %d\n", m_iId, getpid()); //printf("Pos packer id: %d pos : %d (of %d sz: %d)\n", // m_iId, m_lPos, header.pkts_count, m_SeekInfo->size()); //if (m_lPos >= 0 || m_lPos < (int)header.pkts_count) AsfPacket* p = new AsfPacket(header.max_pktsize); if (!p) return 0; //AVM_WRITE("ASF file reader", "GET PACKET %lld size: %d\n", m_lPos, header.min_pktsize); m_pParent->m_Mutex.Lock(); int64_t pos = m_pParent->m_lDataOffset + m_lPos * header.max_pktsize; lseek64(m_pParent->m_iFd, pos, SEEK_SET); //printf("SEEK SET %lld %llx\n", pos, pos); ssize_t i = read(m_pParent->m_iFd, &(*p)[0], header.max_pktsize); m_pParent->m_Mutex.Unlock(); if (i != (ssize_t) header.max_pktsize || p->init() != 0) { if (!m_bEof ) AVM_WRITE("ASF file reader", "incorrect packet (%" PRId64 ") at: %" PRId64 " byte\n", m_lPos, pos); // FIXME - missing check for unix signal and restart - maybe add later // usually happens with EOF - handle better... //AVM_WRITE("ASF network reader", "asfinput:: read fail %d\n", header.pktsize); p->release(); m_bEof = true; return 0; } m_lPos++; return p; } virtual int seek(framepos_t pos, chunk_info* pch) { if (pos >= m_SeekInfo->size()) return -1; const chunk_info& ch = (*m_SeekInfo)[pos]; m_lPos = ch.packet_id; *pch = ch; m_bEof = false; //AVM_WRITE("ASF file reader", "Seekpos %lld time %d %d\n", m_lPos, ch.object_start_time/1000, pos); return 0; } virtual int seekTime(double timestamp, chunk_info* pch) { return seek(m_SeekInfo->find(uint_t(timestamp*1000.)), pch); } protected: int64_t m_lPos; AsfFileInputStream* m_pParent; AsfStreamSeekInfo* m_SeekInfo; }; /* first, we make a completely stupid implementation */ AsfFileInputStream::AsfFileInputStream() :m_iFd(-1), m_SeekInfo(128) { for (size_t i = 0; i < m_SeekInfo.size(); ++i) m_SeekInfo[i] = 0; } int AsfFileInputStream::init(const char* pszFile) { m_iFd = open(pszFile, O_RDONLY | O_LARGEFILE); if (m_iFd < 0) { AVM_WRITE("ASF reader", "Could not open the file\n"); return -1; } uint8_t* header = 0; ssize_t r; m_lDataOffset = 0; for (;;) { GUID guid; int64_t size; if (read(m_iFd, &guid, 16) <= 0 || read(m_iFd, &size, 8) <= 0) break; avm_get_leGUID(&guid); size = avm_get_le64(&size) - 24; if (size < 0) break; //char buf[100];printf("GUID type %d %s\n", (int) guid_get_guidid(&guid), guid_to_string(buf, &guid)); AVM_WRITE("ASF reader", 1, "Object: %s - object size: %5" PRId64 "\n", guidid_to_text(guid_get_guidid(&guid)), size); switch (guid_get_guidid(&guid)) { case GUID_ASF_HEADER: if ((header = new uint8_t[size])) { r = read(m_iFd, header, size); if (r <= 0 || !parseHeader(header, (uint_t) r)) { delete[] header; header = 0; } } break; case GUID_ASF_DATA: if (size < 26 || !header) { AVM_WRITE("ASF reader", "Wrong data chunk size\n"); return -1; } m_lDataOffset = lseek64(m_iFd, 0, SEEK_CUR) + 26; lseek64(m_iFd, size, SEEK_CUR); break; case GUID_ERROR: //unknown chunk type default: if (!header) break; lseek64(m_iFd, size, SEEK_CUR); break; } } if (!header) { AVM_WRITE("ASF reader", 1, "Could not find ASF header chunk in file\n"); return -1; } if (!m_lDataOffset) { AVM_WRITE("ASF reader", "Could not find data chunk in file\n"); return -1; } delete[] header; createSeekData(); return 0; } #undef __MODULE__ AsfFileInputStream::~AsfFileInputStream() { if (m_iFd >= 0) close(m_iFd); for (unsigned i = 0; i < m_SeekInfo.size(); i++) delete m_SeekInfo[i]; } void AsfFileInputStream::createSeekData() { uint_t last_start[m_SeekInfo.size()]; for (unsigned l = 0; l < m_SeekInfo.size(); l++) last_start[l] = 0; for (unsigned l = 0; l < m_Streams.size(); l++) m_SeekInfo[m_Streams[l].hdr.stream & 0x7f] = new AsfStreamSeekInfo(); AVM_WRITE("ASF reader", "Creating seek data, please wait...\n"); AsfIterator* it = getIterator(~0U);//argument only needed in seek operations AsfPacket* p = 0; unsigned i; for (i = 0; /*i < m_Header.pkts_count*/; i++) { if (p) p->release(); p = it->getPacket(); if (!p) break; for (unsigned j = 0; j < p->fragments.size(); j++) { const AsfPacketFragment& f = p->fragments[j]; chunk_info ch; if (f.object_length != f.data_length && f.fragment_offset) continue; if (!m_SeekInfo[f.stream_id]) { AVM_WRITE("ASF reader", "WARNING: Unexpected stream_id ( packet %d, send time %f" ", fragment: %d, stream_id: %d)\n", i, p->send_time/1000., j, f.stream_id); continue; } ch.object_start_time = f.object_start_time - m_Header.preroll; ch.object_length = f.object_length; //AVM_WRITE("ASF reader", "id:%d %d starttm: %f len: %d idx: %d kf:%d\n", f.stream_id, m_SeekInfo[f.stream_id]->size(), ch.object_start_time/1000.0, ch.object_length, j, f.keyframe); if (last_start[f.stream_id] > 0) { if (ch.object_start_time < last_start[f.stream_id]) { AVM_WRITE("ASF reader", "WARNING: Negative send time difference ( packet %d" ", packet send time: %f, fragment: %d, stream_id: %d " ", fragment send time: %f, last fragment send time: %f)\n", i, p->send_time/1000., j, (int)f.stream_id, ch.object_start_time/1000., m_SeekInfo[f.stream_id]->back().object_start_time/1000.); //continue; ch.object_start_time = last_start[f.stream_id]; } } // note - keyframe flag must be set after object_length! ch.SetKeyFrame(f.keyframe); ch.packet_id = i; ch.fragment_id = (uint16_t) j; //printf("packet %d %d %d\n", i, j, f.fragment_offset); last_start[f.stream_id] = ch.object_start_time; m_SeekInfo[f.stream_id]->push_back(ch); } } if (p) p->release(); #if 0 AsfStreamSeekInfo* si = m_SeekInfo[1]; for (unsigned i = 0; i < si->size() && i < 200; i++) { chunk_info& c = si->operator[](i); cout << i << " " << c.packet_id << " " << c.object_start_time << " " << (int)c.keyframe << endl; } #endif m_Header.pkts_count = i; AVM_WRITE("ASF reader", "Seek data created ( processed %d packets )\n", i); it->release(); } AsfIterator* AsfFileInputStream::getIterator(uint_t id) { if (id >= m_Streams.size()) return (id == ~0U) ? new FileIterator(this, 0) : 0; int sid = m_Streams[id].hdr.stream & 0x7f; return (m_SeekInfo[sid] && m_SeekInfo[sid]->size()) ? new FileIterator(this, sid) : 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviread/AsfFileInputStream.h0000644000175000017500000000217407612730437022015 0ustar yavoryavor#ifndef AVIFILE_ASFFILEINPUTSTREAM_H #define AVIFILE_ASFFILEINPUTSTREAM_H #include "AsfInputStream.h" #include "avm_locker.h" /** Relative complexity of this model serves the following purposes: 1) Local and remote ASF files should be seekable from player ( allow to simultaneously re-seek all streams to the same position ). 2) Data downloaded from network stream should be cached ( downloaded before it's requested ) and discarded when it's not inter needed 3) Local ASF files should allow independent seeking in streams. 4) Local ASF files should allow their conversion to AVI to as much extent as it is possible. **/ AVM_BEGIN_NAMESPACE; class FileIterator; class AsfFileInputStream: public AsfInputStream { friend class FileIterator; public: AsfFileInputStream(); virtual ~AsfFileInputStream(); virtual AsfIterator* getIterator(uint_t id); int init(const char* pszFile); protected: void createSeekData(); int64_t m_lDataOffset; int m_iFd; PthreadMutex m_Mutex; avm::vector m_SeekInfo; }; AVM_END_NAMESPACE; #endif // AVIFILE_ASFFILEINPUTSTREAM_H avifile-0.7.48~20090503.ds/lib/aviread/AsfInputStream.h0000644000175000017500000000570611176642755021226 0ustar yavoryavor#ifndef AVIFILE_ASFITERATOR_H #define AVIFILE_ASFITERATOR_H #include "asffmt.h" AVM_BEGIN_NAMESPACE; struct chunk_info { static const int KEYFRAME = 1 << 31; uint32_t object_start_time; uint32_t object_length; // 31bit marks keyframe - anyone has frames >2^31 bytes? uint32_t packet_id; uint16_t fragment_id; // let's cheat here uint_t GetChunkLength() const { return object_length & ~KEYFRAME; } bool IsKeyFrame() const { return object_length & KEYFRAME; } void SetKeyFrame(bool s) { if (s) object_length |= KEYFRAME; } }; class AsfStreamSeekInfo: public avm::vector { public: static const framepos_t ERR = ~0U; framepos_t find(uint_t time) const; framepos_t nearestKeyFrame(framepos_t kf = ERR) const; framepos_t nextKeyFrame(framepos_t kf = ERR) const; framepos_t prevKeyFrame(framepos_t kf = ERR) const; }; /* * This logic is needed to properly handle reading from networked streams. * Each stream owns an 'iterator' that can be used to access packets. * If the stream is local, it allows iterators for different streams * to point at completely independent packets ( and seek independently ). * If it isn't, seek() on one iterator invalidates the other, and when * seek() is called on invalidated iterator, it's automatically * reposition at the place of last seek. */ class AsfIterator { public: AsfIterator(int id = 0) : m_iRefcount(1), m_iId(id), m_bEof(false) {} virtual ~AsfIterator(); virtual void addRef() { m_iRefcount++; } virtual void release() { m_iRefcount--; if (!m_iRefcount) delete this; } virtual bool isEof() { return m_bEof; } virtual AsfPacket* getPacket() =0; virtual const AsfStreamSeekInfo* getSeekInfo() =0; virtual int seek(framepos_t pos, chunk_info* pch) =0; virtual int seekTime(double timestamp, chunk_info* pch) =0; int getId() { return m_iId; } protected: int m_iRefcount; int m_iId; bool m_bEof; }; class AsfInputStream { public: static const uint_t ASF_STREAMS = 0x7f; virtual ~AsfInputStream(); virtual const ASFMainHeader& getHeader() const { return m_Header; } virtual const avm::vector& getStreams() const { return m_Streams; } virtual AsfIterator* getIterator(uint_t id) { return 0; } virtual double cacheSize() const { return 1.; } virtual void clear() {} virtual void interrupt() {} virtual bool isOpened() { return true; } virtual bool isValid() { return true; } virtual bool isRedirector() { return false; } virtual bool getURLs(avm::vector& urls) { return false; } int getMaxBitrate(uint_t i) { return (i <= ASF_STREAMS) ? m_MaxBitrates[i] : ~0U; } protected: bool parseHeader(uint8_t* b, size_t size, int level = 0); ASFMainHeader m_Header; avm::vector m_Streams; avm::vector m_Description; uint_t m_MaxBitrates[ASF_STREAMS + 1]; }; AVM_END_NAMESPACE; #endif // AVIFILE_ITERATOR_H avifile-0.7.48~20090503.ds/lib/aviread/AsfNetworkInputStream.cpp0000644000175000017500000010661711176642755023136 0ustar yavoryavor #include "AsfNetworkInputStream.h" #include "AsxReader.h" #include "asf_guids.h" #include "utils.h" #include "avm_output.h" #include #include #include #include #include #include #include #include #include #include #include // atoi #include // strerror #include // FIXME - fix new elements here AVM_BEGIN_NAMESPACE; static int l_iFd = -1; #define USERAGENT "User-Agent: NSPlayer/7.1.0.3055\r\n" #define CLIENTGUID "Pragma: xClientGUID={c77e7400-738a-11d2-9add-0020af0a3278}\r\n" static const char m_pcFirstRequest[] = "GET %s HTTP/1.0\r\n" "Accept: */*\r\n" USERAGENT "Host: %s\r\n" "Pragma: no-cache,rate=1.000000,stream-time=0,stream-offset=0:0,request-context=%u,max-duration=0\r\n" CLIENTGUID "Connection: Close\r\n\r\n"; static const char m_pcSeekableRequest[] = "GET %s HTTP/1.0\r\n" "Accept: */*\r\n" USERAGENT "Host: %s\r\n" "Pragma: no-cache,rate=1.000000,stream-time=%u,stream-offset=%u:%u,request-context=%u,max-duration=%u\r\n" CLIENTGUID "Pragma: xPlayStrm=1\r\n" "Pragma: stream-switch-count=%d\r\n" "Pragma: stream-switch-entry=%s\r\n" // ffff:1:0 ffff:2:0 "Connection: Close\r\n\r\n"; static const char m_pcPostRequest[] = "POST %s HTTP/1.0\r\n" "Accept: */*\r\n" USERAGENT "Host: %s\r\n" "Pragma: client-id=%u\r\n" //"Pragma: log-line=no-cache,rate=1.000000,stream-time=%u,stream-offset=%u:%u,request-context=2,max-duration=%u\r\n" "Pragma: Content-Length: 0\r\n" CLIENTGUID "\r\n"; static const char m_pcLiveRequest[] = "GET %s HTTP/1.0\r\n" "Accept: */*\r\n" USERAGENT "Host: %s\r\n" "Pragma: no-cache,rate=1.000000,request-context=%u\r\n" "Pragma: xPlayStrm=1\r\n" CLIENTGUID "Pragma: stream-switch-count=%d\r\n" "Pragma: stream-switch-entry=%s\r\n" "Connection: Close\r\n\r\n"; static const char m_pcRangeRequest[] = "GET %s HTTP/1.0\r\n" "Accept: */*\r\n" USERAGENT "Host: %s\r\n" "Range: bytes=%llu-\r\n" CLIENTGUID "Connection: Close\r\n\r\n"; class AsfNetworkInputStream; class AsfStreamSeekInfo; class NetworkIterator: public AsfIterator { friend class AsfNetworkInputStream; public: NetworkIterator(AsfNetworkInputStream* parent, int id) : AsfIterator(id), m_pParent(parent) { } virtual ~NetworkIterator() { for (uint_t i = 0; i < m_Packets.size(); i++) m_Packets[i]->release(); } virtual const AsfStreamSeekInfo* getSeekInfo() { return 0; } virtual AsfPacket* getPacket() { AVM_WRITE("ASF network reader", 1, "getPacket() (Eof: %d, pkts: %" PRIsz ")\n", m_bEof, m_Packets.size()); PthreadMutex& mutex = m_pParent->m_Mutex; PthreadCond& cond = m_pParent->m_Cond; Locker locker(mutex); for (int i = 0; !m_Packets.size(); i++) { if (m_bEof || i > 20) return 0; if (!m_pParent->m_bWaiting) cond.Broadcast(); cond.Wait(mutex, 0.5); //printf("WAIT %d\n", i); } //for (int i = 0; i < m_Packets.size(); i++) // AVM_WRITE("ASF network reader", "GETPACKETLIST %d %p %d\n", i, m_Packets[i], m_Packets[i]->size()); AsfPacket* p = m_Packets.front(); m_Packets.pop_front(); //AVM_WRITE("ASF network reader", "packet %d p:%d\n", m_Packets.size(), p->send_time); //AVM_WRITE("ASF network reader", 1, "Returning: length %d, send time %dms (%d)\n", // p->packet_length, p->send_time, p->length); return p; } virtual bool isEof() { return m_bEof && !m_Packets.size(); } virtual int seek(framepos_t pos, chunk_info* pch) { AVM_WRITE("ASF network reader", "WARNING: seek(%u) is unsupported\n", pos); return -1; } virtual int seekTime(double timestamp, chunk_info* pch) { if (m_pParent->seekInternal(uint_t(timestamp*1000.0), this) < 0) return -1; PthreadMutex& mutex = m_pParent->m_Mutex; PthreadCond& cond = m_pParent->m_Cond; Locker locker(mutex); int i = 0; while (i++ < 20 && !m_pParent->m_bQuit && !m_bEof && !m_Packets.size()) { AVM_WRITE("ASF network reader", "waiting & sleeping (%d, %d, %d)\n", i, m_bEof, m_iId); cond.Broadcast(); cond.Wait(mutex, 0.5); } if (m_Packets.size()) { AsfPacket* p = m_Packets.front(); pch->SetKeyFrame(true); pch->fragment_id = 0; pch->object_start_time = p->send_time; return 0; } // hmmm pch->SetKeyFrame(true); pch->fragment_id = 0; pch->object_start_time = m_pParent->m_uiTime; return 0; } protected: void setEof(bool b) { m_bEof = b; } avm::vector m_Packets; AsfNetworkInputStream* m_pParent; }; int AsfNetworkInputStream::init(const char* pszFile) { m_iSocket = m_lfd = m_iSeekId = -1; m_bHeadersValid = false; m_bAcceptRanges = false; m_bFinished = false; m_bWaiting = false; m_bQuit = false; m_Ctype = Unknown; m_uiTime = 0; m_pReader = 0; m_Server = pszFile; m_uiDataOffset = 0; m_uiTimeshift = 0; m_iRedirectSize = 16000; m_iReadSize = 0; m_iProxyport = 0; pipe(m_iPipeFd); avm::string::size_type start = 0, end; AVM_WRITE("ASF network reader", 1, "checking URL: %s\n", m_Server.c_str()); for (;;) { start = m_Server.find("://", start); if (start == avm::string::npos || start + 3 >= m_Server.size()) { AVM_WRITE("ASF network reader", 1, "Not an URL\n"); return -1; } // find & use last occurence of :// if (m_Server.find("://", start + 1) == avm::string::npos) break; start++; } start += 3; end = m_Server.find("/", start); if (end == avm::string::npos) { AVM_WRITE("ASF network reader", "Not an URL\n"); return -1; } m_ServerFilename = m_Server.substr(0, end); m_Filename = m_Server.substr(end); m_Filename.escape(); m_Server = m_Server.substr(start, end-start); end = m_Server.find(":", start); if (end == avm::string::npos) m_Server += ":80"; //m_iServerport = atoi(m_Server.substr(end+1).c_str()); //m_Server = m_Server.substr(0,end); AVM_WRITE("ASF network reader", "server:%s filename:%s\n", m_Server.c_str(), m_Filename.c_str()); // style hostname:port eg 192.168.10.10:8080 char* proxyenv = getenv("HTTP_PROXY"); if (!proxyenv) proxyenv = getenv("http_proxy"); if (proxyenv) { if ((strncasecmp(proxyenv, "http://", 7) == 0)) proxyenv += 7; m_Proxyhost = proxyenv; end = m_Proxyhost.find(":"); if (end==avm::string::npos) m_iProxyport = 80; else { avm::string p = m_Proxyhost.substr(end + 1,avm::string::npos); m_iProxyport = (uint16_t)atoi(p.c_str()); } m_Proxyhost = m_Proxyhost.substr(0, end); m_ServerFilename += m_Filename; AVM_WRITE("ASF network reader", "proxy host:%s port:%d\n", m_Proxyhost.c_str(), m_iProxyport); } else m_ServerFilename = m_Filename; /* * This func tries to open URL m_File. If it succeeds, * it loads its headers, puts true to m_bHeadersValid * and starts caching packets. If it fails, it puts * true to m_bHeadersValid and to m_bQuit, and then exits. */ // use some randomized name srand((unsigned int) avm_get_time_us()); m_iRandcntx = rand(); // determine max size for posted requests size_t max_request = strlen(m_pcLiveRequest); size_t sz = strlen(m_pcSeekableRequest); if (sz > max_request) max_request = sz; sz = strlen(m_pcFirstRequest); if (sz > max_request) max_request = sz; max_request += m_Filename.size() + m_Server.size() + 512; if (max_request < 65536) max_request = 65536; m_pBuffer = new char[max_request]; if (getenv("WRITE_ASFLOG") && l_iFd < 0) l_iFd = open("./log", O_WRONLY|O_CREAT|O_TRUNC, 00666); m_pThread = new PthreadTask(0, &AsfNetworkInputStream::threadStarter, this); return 0; } AsfNetworkInputStream::~AsfNetworkInputStream() { m_bQuit = true; interrupt(); delete m_pThread; clear(); avm::vector::iterator it2; for (it2 = m_Iterators.begin(); it2 != m_Iterators.end(); it2++) (*it2)->release(); close(m_iPipeFd[0]); close(m_iPipeFd[1]); delete[] m_pBuffer; delete m_pReader; } bool AsfNetworkInputStream::isValid() { if (m_bFinished) { Locker locker(m_Mutex); if (m_Iterators.size()) { size_t s = 0; for(avm::vector::iterator it2 = m_Iterators.begin(); it2 != m_Iterators.end(); it2++) s += (*it2)->m_Packets.size(); if (!s) { //printf("BROADCAST\n"); m_Cond.Broadcast(); } } } return ((m_bHeadersValid && !m_bQuit) || m_pReader); } void AsfNetworkInputStream::flushPipe() { int pipe_flags = fcntl(m_iPipeFd[0], F_GETFL); char c; fcntl(m_iPipeFd[0], F_SETFL, pipe_flags | O_NONBLOCK); while (::read(m_iPipeFd[0], &c, 1) > 0) ; fcntl(m_iPipeFd[0], F_SETFL, pipe_flags); } /* time in milliseconds */ int AsfNetworkInputStream::seekInternal(uint_t seektime, NetworkIterator* requester) { if (m_Ctype == Live || (m_Ctype == Plain && (!m_bAcceptRanges || !m_uiDataOffset))) { if (seektime == 0) { m_bFinished = true; // stop reading clear(); } return -1; } if (m_iSeekId < 0) m_iSeekId = requester->getId(); if (m_iSeekId != requester->getId()) return 0; int d = (m_uiTime > seektime) ? m_uiTime - seektime : seektime - m_uiTime; //printf("DIFFERENCE %d\n", d); if (d < 2000) return 0; // ignore too close seeks //AVM_WRITE("ASF network reader", "***********SEEKINTERNAL %d\n", seektime); m_bFinished = true; if (!m_bWaiting) { interrupt(); while (!m_bQuit && !m_bWaiting) { //printf("SLEEP %d %d\n", m_bQuit, m_bWaiting); avm_usleep(100000); } } m_uiTime = seektime; interrupt(); m_bWaiting = false; return 0; } void AsfNetworkInputStream::unregister(NetworkIterator* it) { m_Iterators.remove(it); } void AsfNetworkInputStream::interrupt() { AVM_WRITE("ASF network reader", 1, "interrupt()\n"); Locker locker(m_Mutex); m_Cond.Broadcast(); char c = 0; ::write(m_iPipeFd[1], &c, 1); } double AsfNetworkInputStream::cacheSize() const { Locker locker(m_Mutex); AVM_WRITE("ASF network reader", 1, "cacheSize() finished: %d\n", m_bFinished); if (m_bFinished) return 1.; size_t min = m_Iterators.size() ? CACHE_PACKETS : 0; for(avm::vector::const_iterator it2 = m_Iterators.begin(); it2!=m_Iterators.end(); it2++) { size_t s = (*it2)->m_Packets.size(); //AVM_WRITE("ASF network reader", "cachesz %d\n", s); if (s < min) min = s; } //AVM_WRITE("ASF network reader", "cacheSizeMin %d\n", min); return (double)min / (double)CACHE_PACKETS; } void AsfNetworkInputStream::clear() { AVM_WRITE("ASF network reader", 1, "clear()\n"); Locker locker(m_Mutex); for(avm::vector::iterator it2 = m_Iterators.begin(); it2!=m_Iterators.end(); it2++) { //printf("SIZE %d\n", (*it2)->m_Packets.size()); for (uint_t i = 0; i < (*it2)->m_Packets.size(); i++) (*it2)->m_Packets[i]->release(); (*it2)->m_Packets.clear(); //FIXME - release } } void* AsfNetworkInputStream::threadFunc() { int result = -1; m_lReadBytes = 0; if (createSocket() < 0) goto terminated; m_lfd = -12345; sprintf(m_pBuffer, m_pcFirstRequest, m_ServerFilename.c_str(), m_Server.c_str(), m_iRandcntx); AVM_WRITE("ASF network reader", 1, "Request1 [ %s ]\n", m_pBuffer); m_Ctype = checkContent(m_pBuffer); switch (m_Ctype) { case Unknown: AVM_WRITE("ASF network reader", "Unknown Content-Type - closing...\n"); goto terminated; case Redirect: AVM_WRITE("ASF network reader", "Redirector\n"); if (readRedirect() == 0) goto ok; goto terminated; case Plain: break; default: // reopen for broadcasted prerecorder & live streams // user can select which streams he wants to receive close(m_iSocket); m_iSocket = -1; } while(!m_bQuit) { size_t scnt; avm::string sffff; m_bFinished = true; m_Mutex.Lock(); if (!m_Iterators.size()) m_Cond.Wait(m_Mutex); // wait for read or IsValid avm::vector::iterator it2; for(it2 = m_Iterators.begin(); it2 != m_Iterators.end(); it2++) (*it2)->setEof(false); for (avm::vector::iterator it = m_Streams.begin(); it != m_Streams.end(); it++) { int id = (*it).hdr.stream & 0x7f; bool in = false; for (it2 = m_Iterators.begin(); it2 != m_Iterators.end(); it2++) if ((*it2)->getId() == id) { in = true; break; } char b[30]; sprintf(b, "ffff:%d:%d ", id, (in) ? 0 : 2); sffff += b; } scnt = m_Streams.size(); m_Mutex.Unlock(); clear(); if (m_iSocket < 0) { if (createSocket() < 0) goto terminated; } //printf("INIT %d %s\n", scnt, sffff.c_str()); switch(m_Ctype) { case Prerecorded: // CHECK which stream are actually requested by user sprintf(m_pBuffer, m_pcSeekableRequest, m_ServerFilename.c_str(), m_Server.c_str(), m_uiTime, ~0, ~0, // offset m_iRandcntx, 0x7FFFFFFF, scnt, sffff.c_str() // stream_count //4, "ffff:1:0 ffff:2:0 ffff:3:0 ffff:4:0" ); AVM_WRITE("ASF network reader", 1, "Requesting prerecorded [ %s ]\n", m_pBuffer); m_Ctype = checkContent(m_pBuffer); break; case Live: sprintf(m_pBuffer, m_pcLiveRequest, m_ServerFilename.c_str(), m_Server.c_str(), m_iRandcntx, scnt, sffff.c_str() // stream_count ); m_Ctype = checkContent(m_pBuffer); AVM_WRITE("ASF network reader", 1, "Requesting live [ %s ]\n", m_pBuffer); break; case Plain: if (m_bAcceptRanges && m_uiDataOffset && m_Header.max_bitrate) { // estimate packet in the file int64_t o = (int64_t) m_Header.max_bitrate * (int64_t) m_uiTime; o /= (8 * 1000); // bits -> bytes * milisec -> sec o = (o / m_Header.max_pktsize) * m_Header.max_pktsize; o += m_uiDataOffset; sprintf(m_pBuffer, m_pcRangeRequest, m_ServerFilename.c_str(), m_Server.c_str(), o, m_iRandcntx ); AVM_WRITE("ASF network reader", 1, "Requesting range [ %s ]\n", m_pBuffer); m_Ctype = checkContent(m_pBuffer); } default: break; } if (m_Ctype == Unknown) { AVM_WRITE("ASF network reader", "threadFunc() unknown Content-Type\n"); } else { if (readContent() < 0) // main reading loop AVM_WRITE("ASF network reader", "read_content() aborted\n"); else AVM_WRITE("ASF network reader", "read_content() successful\n"); m_uiTime = 0; } if (m_bQuit) goto terminated; switch (m_Ctype) { case Prerecorded: sprintf(m_pBuffer, m_pcPostRequest, m_ServerFilename.c_str(), m_Server.c_str(), m_iRandcntx); AVM_WRITE("ASF network reader", 1, "Posting prerecorded [ %s ]\n", m_pBuffer); write(m_pBuffer, strlen(m_pBuffer)); default: break; } m_Mutex.Lock(); m_bWaiting = true; close(m_iSocket); m_iSocket = -1; AVM_WRITE("ASF network reader", "Waiting for wake up\n"); m_Cond.Broadcast(); m_Cond.Wait(m_Mutex); m_Mutex.Unlock(); flushPipe(); AVM_WRITE("ASF network reader", "Continuing...\n"); } result = 0; goto ok; terminated: m_bHeadersValid = true; m_bQuit = true; ok: m_Mutex.Lock(); for(avm::vector::iterator it2 = m_Iterators.begin(); it2 != m_Iterators.end(); it2++) (*it2)->setEof(true); m_Cond.Broadcast(); m_Mutex.Unlock(); clear(); delete[] m_pBuffer; m_pBuffer = 0; if (m_iSocket >= 0) close(m_iSocket); m_iSocket = -1; flushPipe(); return (void*)result; } void* AsfNetworkInputStream::threadStarter(void* arg) { return ((AsfNetworkInputStream*)arg)->threadFunc(); } int AsfNetworkInputStream::createSocket() { avm::string sn; int proxyport; uint16_t sp; h_errno = 0; if (m_iProxyport != 0) { sp = m_iProxyport; sn = m_Proxyhost.c_str(); } else { avm::string::size_type end = m_Server.find(":"); assert(end != avm::string::npos); sp = (uint16_t)atoi(m_Server.substr(end + 1).c_str()); sn = m_Server.substr(0, end); } // if(!inet_aton(m_Server.c_str(), &sa.sin_addr)) hostent* he = gethostbyname(sn.c_str()); if (!he || !he->h_addr_list || !he->h_addr_list[0]) { AVM_WRITE("ASF network reader", "Warning: could not resolve server name %s:%d ( %s )\n", sn.c_str(), sp, strerror(h_errno)); return -1; } sockaddr_in sa; memset(&sa, 0, sizeof(sa)); sa.sin_family = (sa_family_t) he->h_addrtype; sa.sin_port = htons(sp); sa.sin_addr = *(in_addr*)(he->h_addr_list[0]); m_iSocket = socket(he->h_addrtype, SOCK_STREAM, 0); if (m_iSocket < 0) { AVM_WRITE("ASF network reader", "Socket() failed ( %s )\n", strerror(errno)); return -1; } int oflg = fcntl(m_iSocket, F_GETFL); fcntl(m_iSocket, F_SETFL, oflg | O_NONBLOCK); int r = connect(m_iSocket, (sockaddr*)&sa, sizeof(sa)); if (r == -1 && errno == EINPROGRESS) { int maxtry = 50; // hmm should be settable by user ??? while (!m_bQuit && --maxtry >= 0) { fd_set wset; fd_set rset; int mx = (m_iSocket > m_iPipeFd[0]) ? m_iSocket : m_iPipeFd[0]; struct timeval tout = { 1, 0 }; // 1s timeout FD_ZERO(&wset); FD_ZERO(&rset); FD_SET(m_iSocket, &wset); FD_SET(m_iPipeFd[0], &rset); r = select(mx + 1, &rset, &wset, 0, &tout); if (r > 0) { if (FD_ISSET(m_iPipeFd[0], &rset)) { flushPipe(); AVM_WRITE("ASF network reader", 1, "connect: interrupted\n"); r = -1; } break; } else if (r < 0) { AVM_WRITE("ASF network reader", "connect: select failed\n"); break; } else // r == 0 { if (maxtry == 0) { AVM_WRITE("ASF network reader", "connect: timeout\n"); Locker locker(m_Mutex); m_Cond.Broadcast(); } continue; } } if (r > 1) { socklen_t errlen = sizeof(int); int err; r = getsockopt(m_iSocket, SOL_SOCKET, SO_ERROR, &err, &errlen); if (r < 0) { AVM_WRITE("ASF network reader", "connect: getsockopt failed %s\n", strerror(errno)); } else if (err > 0) { AVM_WRITE("ASF network reader", "connect: error %s\n", strerror(err)); r = -1; } else r = 0; } } fcntl(m_iSocket, F_SETFL, oflg); //printf("ENDLOOP %d %d\n", r, m_iSocket); if (r < 0) { AVM_WRITE("ASF network reader", "Warning: connection failed ( %s )\n", strerror(errno)); close(m_iSocket); m_iSocket = -1; } else { AVM_WRITE("ASF network reader", 1, "Socket created\n"); /* char hostname[256]; if (gethostname(hostname, sizeof(hostname) - 1)) { AVM_WRITE("ASF network reader", "WARNING: gethostname() failed ( %s )\n", strerror(errno)); hostname[sizeof(hostname) - 1]=0; } */ } return m_iSocket; } ssize_t AsfNetworkInputStream::read(void* buffer, size_t size) { ssize_t result = 0; while (!m_bQuit) { fd_set fset; FD_ZERO(&fset); FD_SET(m_iSocket, &fset); FD_SET(m_iPipeFd[0], &fset); struct timeval tout = { 20, 0}; // 20s timeout int mx = (m_iSocket > m_iPipeFd[0]) ? m_iSocket : m_iPipeFd[0]; if (select(mx + 1, &fset, 0, 0, &tout) == 0) { AVM_WRITE("ASF network reader", "NetRead: TIMEOUTED\n"); Locker locker(m_Mutex); m_Cond.Broadcast(); return -1;//continue; } //printf("socket %d %d\n", FD_ISSET(m_iPipeFd[0], &fset), FD_ISSET(m_iSocket, &fset)); if (FD_ISSET(m_iPipeFd[0], &fset)) { flushPipe(); AVM_WRITE("ASF network reader", 1, "Interrupted\n"); return -1; } if (FD_ISSET(m_iSocket, &fset)) { ssize_t tmp = ::read(m_iSocket, (char*)buffer + result, size - result); //AVM_WRITE("ASF network reader", "NetRead: %d bytes (want: %d)\n", tmp, size-result); if (tmp <= 0) { if (errno != EAGAIN && errno != EINTR) { if (errno) AVM_WRITE("ASF network reader", "Aborting: read() returned %d ( %s )\n", errno, strerror(errno)); if (result>0) return result; if (tmp < 0) AVM_WRITE("ASF network reader", "read() failed\n"); return tmp; } if (tmp == 0) return 0; continue; } result += tmp; //printf("result %d:%d\n", result, size); if (result >= (ssize_t) size) { if (l_iFd >= 0) { if (result > 32) AVM_WRITE("ASF network reader", 1, "read(): returned %" PRIsz " of %" PRIsz " bytes\n", (size_t) result, size); ::write(l_iFd, buffer, result); fsync(l_iFd); } m_lReadBytes += result; return result; } } } return -1; } ssize_t AsfNetworkInputStream::write(const void* b, size_t size) { const char* buffer = (const char*) b; ssize_t wsize = size; while (wsize > 0) { ssize_t i = ::write(m_iSocket, buffer, wsize); if (i <= 0) return i; buffer += i; wsize -= i; } return size; } ssize_t AsfNetworkInputStream::dwrite(const void* b, size_t size) { const char* buffer = (const char*) b; if (m_lfd < 0) { if (m_lfd == -12345) { if (getenv("WRITE_ASF")) { // check if recording is requested char tmpfilename[256]; char* tmpdir = getenv("TMPDIR"); strncpy(tmpfilename, (tmpdir) ? tmpdir : "/tmp", 240); tmpfilename[240] = 0; strcat(tmpfilename, "/asfXXXXXX"); m_lfd = mkstemp(tmpfilename); AVM_WRITE("ASF network reader", "Writing ASF file: %s (%d)\n", tmpfilename, m_lfd); } else { AVM_WRITE("ASF network reader", "\n\n" "\tIf you wish to store the stream into a local file\n" "\tyou may try to use this before starting aviplay:\n" "\t\texport WRITE_ASF=1\n" "\tthis will create /tmp/asfXXXXX with received data\n\n"); m_lfd = -1; } } if (m_lfd < 0) return -1; } while (size > 0) { ssize_t i = ::write(m_lfd, buffer, size); if (i < 0) return i; buffer += i; size -= i; } fsync(m_lfd); return 0; } int AsfNetworkInputStream::readContent() { m_bFinished = false; int64_t rsize = 100000000; int skip = 0; while (!m_bQuit && !m_bFinished) { if (cacheSize() >= 1.) { AVM_WRITE("ASF network reader", 1, "FULLCACHE - wait for empty place\n"); char c; fd_set fset; FD_ZERO(&fset); FD_SET(m_iPipeFd[0], &fset); struct timeval tout = { 0, 1000000 }; if (select(m_iPipeFd[0] + 1, &fset, 0, 0, &tout) != 0) { if (FD_ISSET(m_iPipeFd[0], &fset)) { ::read(m_iPipeFd[0], &c, 1); AVM_WRITE("ASF network reader", 1, "read_content(): interrupted\n"); break; } } continue; } if (m_Ctype == Plain) { // ugly trick for now - emulating streamed data if (m_uiDataOffset > 0) { chhdr.size = (uint16_t)m_Header.max_pktsize; chhdr.partflag = 0; rsize -= chhdr.size; //chhdr.kind = (rsize > 0) ? 0x4424 : 0x4524; chhdr.kind = 0x4424; } else { // after the header the data header // should follow if (read(m_pBuffer, 24 + 26) < 0) { m_bFinished = true; continue; } dwrite(m_pBuffer, 24 + 26); GUID* guid = (GUID*) m_pBuffer; avm_get_leGUID(guid); if (guid_get_guidid(guid) == GUID_ASF_DATA) { rsize = avm_get_le64(m_pBuffer + 16) - 24; // remember offset - so we are able to // seek in Plain streams m_uiDataOffset = m_lReadBytes; } } } else { if (read(&chhdr, sizeof(chhdr)) <= 0) { AVM_WRITE("ASF network reader", 1, "read() no more data\n"); break; } chhdr.le16(); //AVM_WRITE("ASF network reader", 1, "PACKET: 0x%x 0x%x 0x%x 0x%x 0x%x\n", chhdr.kind, chhdr.size, chhdr.seq, chhdr.tmp, chhdr.size_confirm); if (chhdr.size < 8) { AVM_WRITE("ASF network reader", "I don't like chunk size: %d\n", chhdr.size); break; } if (chhdr.size != chhdr.size_confirm) { AVM_WRITE("ASF network reader", "size != size_confirm (%d != %d)\n", chhdr.size, chhdr.size_confirm); break; } chhdr.size = (uint16_t)(chhdr.size - 8); } AsfPacket* p; unsigned short& size = chhdr.size; //printf("STREAMPACKET 0x%x sz:%d %lld seq:%d part:%d sc:%d\n", chhdr.kind, size, rsize, chhdr.seq, chhdr.partflag, chhdr.size_confirm); switch (chhdr.kind) { case 0x4824: // $H header if (chhdr.partflag & 0x0400) { skip = read(m_pBuffer, chhdr.size); if (skip < chhdr.size) { AVM_WRITE("ASF network reader", "wrong size (%d != %d)\n", skip, chhdr.size); m_bFinished = true; continue; } } else if (skip > 0 && !(chhdr.partflag & 0x0800)) { int r = read(m_pBuffer + skip, chhdr.size); if (r < chhdr.size) { AVM_WRITE("ASF network reader", "wrong size (%d != %d)\n", r, chhdr.size); m_bFinished = true; continue; } skip += chhdr.size; } else readHeader(skip + chhdr.size, skip); break; case 0x4424: // $D data if (!m_bHeadersValid) { AVM_WRITE("ASF network reader", "unexpected data chunk (no headers yet)\n"); m_bFinished = true; continue; } if (size > m_Header.max_pktsize) { AVM_WRITE("ASF network reader", "size>m_Header.max_pktsize (%d > %d) ignoring...\n", size, m_Header.max_pktsize); continue; } //AVM_WRITE("ASF network reader", "Packet size %d\n", size); p = new AsfPacket(m_Header.max_pktsize); if (read(&(*p)[0], size) <= 0) { p->release(); AVM_WRITE("ASF network reader", "read() no more data\n"); m_bFinished = true; continue; } //for (int i = 0; i < 20; i++) // AVM_WRITE("ASF network reader", "%02x ",(uint_t) (*p)[inloaded + i]); //AVM_WRITE("ASF network reader", "\n"); if (m_lfd >= 0 && size < m_Header.max_pktsize) memset(&(*p)[size], 0, m_Header.max_pktsize - size); // zero padding //AVM_WRITE("ASF network reader", 0, "Created packet %p %d - 0x%x (free %d : %.2f)\n", p, p->size(), (*p)[0], m_Header.max_pktsize - size, size/(float)m_Header.max_pktsize); if (p->init(m_uiTimeshift) == 0) { if (!m_uiTimeshift && m_Ctype == Live) { m_uiTimeshift = p->send_time - m_Header.preroll; p->fragments.clear(); // reinit packet with new timeshift p->init(m_uiTimeshift); AVM_WRITE("ASF network reader", "setting timeshift %.3fs\n", m_uiTimeshift / 1000.); } dwrite(&(*p)[0], m_Header.max_pktsize); m_Mutex.Lock(); //printf("Iterators: %d\n", m_Iterators.size()); avm::vector::iterator it; for(it = m_Iterators.begin(); it != m_Iterators.end(); it++) { p->addRef(); (*it)->m_Packets.push_back(p); size_t psz = (*it)->m_Packets.size(); //printf("PACKET SIZE %d time:%u\n", psz, p->send_time); if (psz >= 2 * CACHE_PACKETS && !(psz & 1)) { uint_t i = 0; while (i + psz/2 < psz) { (*it)->m_Packets[i]->release(); (*it)->m_Packets[i] = (*it)->m_Packets[i + psz/2]; i++; } (*it)->m_Packets.resize(i); //AVM_WRITE("ASF network reader", "Removing unreaded packets %d\n", m_Iterators.size()); } } m_Cond.Broadcast(); m_Mutex.Unlock(); } p->release(); break; case 0x4524: // $E m_bFinished = true; AVM_WRITE("ASF network reader", "read_content(): finished transmission\n"); break; } //switch } if (m_lfd>=0) close(m_lfd); m_lfd = -1; m_Mutex.Lock(); for(avm::vector::iterator it2 = m_Iterators.begin(); it2 != m_Iterators.end(); it2++) (*it2)->setEof(true); //not here m_Cond.Broadcast(); m_Mutex.Unlock(); if (m_bFinished) return 0; m_bFinished = true; return -1; } AsfNetworkInputStream::Content AsfNetworkInputStream::checkContent(const char* request) { int hdrpos = 0; uint_t linepos = 0; uint_t linenum = 0; char *hdrptr; // Platform for Privacy Preferences (p3p) // http://www.w3.org/P3P/ bool eol = false; char HTTPLine[1024]; char Features[256]; char ContentType[256]; ContentType[0] = 0; Features[0] = 0; // send http request write(request, strlen(request)); //AVM_WRITE("ASF network reader", "WRITE %s\n", request); for (;;) { char c; if (read(&c, 1) <= 0) // header was incorrect // this is probably the best we could do return Unknown; // \r\n means http header eof if (linepos < (sizeof(HTTPLine) - 1) && (c != '\r') && (c != '\n')) { eol = false; // all letter in lowercase HTTPLine[linepos++] = (char) tolower(c); } else HTTPLine[linepos] = 0; if (c == '\n') { if (eol) break; // header eof linepos = 0; eol = true; linenum++; hdrptr = HTTPLine; //printf("PARSEHTTP: %s\n",hdrptr); /* Parse first line of HTTP reply */ if (linenum == 1) { if (!strncmp(hdrptr, "http/1.0 ", 9) || !strncmp(hdrptr, "http/1.1 ", 9)) { int errorcode = 0; hdrptr += 9; sscanf(hdrptr, "%d", &errorcode); hdrptr += 4; if (strstr(hdrptr, "redirect") || strstr(hdrptr, "object moved")) { m_iRedirectSize = 4096; return Redirect; } if (strstr(hdrptr, "bad request")) return Unknown; } else { AVM_WRITE("ASF network reader", "Illegal server reply! Expected HTTP/1.0 or HTTP/1.1\n"); } } else { /* parse all other lines of HTTP reply */ if (!strncmp(hdrptr, "content-type: ", 14)) { strncpy(ContentType, hdrptr + 14, sizeof(ContentType)); } else if (!strncmp(hdrptr, "content-length: ", 16)) { m_iRedirectSize = atoi(hdrptr + 16); AVM_WRITE("ASF network reader", 1, "Content-Length: %d\n", m_iRedirectSize); } else if (!strncmp(hdrptr, "pragma: ", 8)) { char* f = strstr(hdrptr + 8, "features="); if (f) strncpy(Features, f + 9, sizeof(Features)); } else if (!strncmp(hdrptr, "accept-ranges: bytes", 20)) m_bAcceptRanges = true; } } } // ok here it is a bit tricky // many servers seems to be passing here false headers // were they claim they are redirectors while they // are already giving us a stream // so we try to read some more data from the connection // but only in case we have not yet decided type of stream // as we could get here for the Plain seek again // FIXME m_lReadBytes = 0; if ((m_Ctype == Unknown) && (m_iReadSize = read(m_pBuffer, sizeof(chhdr))) > 0) { memcpy(&chhdr, m_pBuffer, m_iReadSize); chhdr.le16(); chhdr.size = (uint16_t)(chhdr.size - 8); //printf("PACKET sz:%d se:%d un:%d sc:%d\n", chhdr.size, chhdr.seq, chhdr.partflag, chhdr.size_confirm); if (chhdr.kind == 0x4824) // $H { int hsize = chhdr.size; int skip = 0; if (chhdr.partflag & 0x0400) while (chhdr.kind == 0x4824) { if (chhdr.partflag & 0x0400) { // reset skip = 0; hsize = 0; } hsize += chhdr.size; if (chhdr.partflag & 0x0800) break; // header packet complete int r = read(m_pBuffer + skip, chhdr.size); if (r < 0) break; skip += r; read(&chhdr, sizeof(chhdr)); chhdr.le16(); chhdr.size = (uint16_t)(chhdr.size - 8); } readHeader(hsize, skip); } else { if (avm_get_le32(m_pBuffer) == 0x75b22630) // guid_asf_header { m_Ctype = Plain; readHeader(16 + 8, m_iReadSize); // if this is the ASF header -> no socket reopen } } } /* Determine whether this is live content or not */ if (!strcmp(ContentType, "application/octet-stream") || !strcasecmp(ContentType, "application/vnd.ms.wms-hdr.asfv1") || !strcasecmp(ContentType, "application/x-mms-framed")) { if (!m_bHeadersValid) return Redirect; return (strstr(Features, "broadcast")) ? Live : Prerecorded; } if ((m_bHeadersValid && m_Ctype == Plain) || !strcmp(ContentType, "text/plain")) // if the redirector's size is small it's not a plain file return (m_iRedirectSize < 300) ? Redirect : Plain; if ((!strcmp(ContentType, "text/html")) || (!strcmp(ContentType, "audio/x-ms-wax")) || (!strcmp(ContentType, "audio/x-ms-wma")) || (!strcmp(ContentType, "video/s-ms-asf")) || (!strcmp(ContentType, "video/x-ms-afs")) || (!strcmp(ContentType, "video/x-ms-asf")) || (!strcmp(ContentType, "video/x-ms-wma")) || (!strcmp(ContentType, "video/x-ms-wmv")) || (!strcmp(ContentType, "video/x-ms-wmx")) || (!strcmp(ContentType, "video/x-ms-wvx")) || (!strcmp(ContentType, "video/x-msvideo"))) return Redirect; return Unknown; } void AsfNetworkInputStream::readHeader(size_t size, size_t skip) { AVM_WRITE("ASF network reader", "read hdrbl %" PRIsz " skip: %" PRIsz "\n", size, skip); ssize_t r = read(m_pBuffer + skip, size - skip); if (r < 0) return; // check if this is really asf header GUID guid = *(GUID*) m_pBuffer; avm_get_leGUID(&guid); if (guid_get_guidid(&guid) != GUID_ASF_HEADER) return; // let's just ignore this junk if (size == 24) // read the header (trick used for Plain) { int64_t hsz = avm_get_le64(m_pBuffer + 16) - 24; read(m_pBuffer + 24, hsz); size += hsz; skip = 0; } else r += skip; size = avm_get_le64(m_pBuffer + 16); if (!m_bHeadersValid) // first time header + data size beging (50 bytes) // should come right after header dwrite(m_pBuffer, size + 50); //printf("SIZE %d %d\n", size, r); m_Mutex.Lock(); m_bHeadersValid = parseHeader((uint8_t*)m_pBuffer + 24, size - 24, m_bHeadersValid ? 1 : 0); if (m_bHeadersValid) AVM_WRITE("ASF network reader", "received valid headers\n"); m_Cond.Broadcast(); m_Mutex.Unlock(); } int AsfNetworkInputStream::readRedirect() { if (m_iRedirectSize > 65536) { AVM_WRITE("ASF network reader", "Redirector size too large! (%d)\n", m_iRedirectSize); m_iRedirectSize = 65536; } while (m_iReadSize < m_iRedirectSize && read(&m_pBuffer[m_iReadSize], 1) > 0) m_iReadSize++; ASXReader* r = new ASXReader(m_Server, m_Filename); if (!r->create(m_pBuffer, m_iReadSize)) { AVM_WRITE("ASF network reader", "No redirector found\n"); delete r; return -1; } else m_pReader = r; return 0; } bool AsfNetworkInputStream::getURLs(avm::vector& urls) { return (m_pReader) ? m_pReader->getURLs(urls) : false; } AsfIterator* AsfNetworkInputStream::getIterator(uint_t id) { //AVM_WRITE("ASF network reader", "GETITERATOR %d\n", id); if (id >= m_Streams.size()) return 0; m_Iterators.push_back(new NetworkIterator(this, m_Streams[id].hdr.stream & 0x7f)); AsfIterator* it = m_Iterators.back(); it->addRef(); return it; } /* * replace specific characters in the URL string by an escape sequence */ void URLString::escape() { char* nstr = new char[size() * 3 + 1]; char* outbuf = nstr; const char* inbuf = c_str(); unsigned char c; do { /* mark characters do not touch escape character */ /* reserved characters see RFC 2396 */ const char avoid[] = "#`'<>[]^|\\\""; c = *inbuf++; if (c && (c <= ' ' || strchr(avoid, c))) { /* these character should be escaped */ unsigned char c1 = (c >> 4) & 0x0f; unsigned char c2 = (unsigned char) (c & 0x0f); *outbuf++ = '%'; *outbuf++ = c1 + (c1 < 10) ? '0' : 'A'; *outbuf++ = c2 + (c2 < 10) ? '0' : 'A'; } else *outbuf++ = c; } while (c); //printf("Before: %s\nAfter: %s\n", str, n); string::operator=(nstr); delete nstr; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviread/AsfNetworkInputStream.h0000644000175000017500000000576111172166610022564 0ustar yavoryavor#ifndef ASFNETWORKINPUTSTREAM_H #define ASFNETWORKINPUTSTREAM_H #include "AsfInputStream.h" #include "avm_locker.h" #include "unistd.h" AVM_BEGIN_NAMESPACE; class ASXReader; class NetworkIterator; class URLString : public avm::string { public: URLString() {} URLString(const avm::string& s) : avm::string(s) {} void escape(); //int getPort(int def = 80) { } }; class AsfNetworkInputStream: public AsfInputStream { friend class NetworkIterator; static const uint_t CACHE_PACKETS = 160; public: enum Content { Unknown, Plain, Live, Prerecorded, Redirect }; AsfNetworkInputStream() :m_pReader(0), m_pThread(0), m_pBuffer(0) {} virtual ~AsfNetworkInputStream(); virtual AsfIterator* getIterator(uint_t id); virtual void interrupt(); virtual double cacheSize() const; virtual void clear(); virtual bool isOpened() { return (m_bHeadersValid || m_pReader); } virtual bool isValid();// { return ((m_bHeadersValid && !m_bQuit) || m_pReader); } virtual bool isRedirector() { return (m_pReader != 0); } virtual bool getURLs(avm::vector& urls); int init(const char* pszFile); protected: static void* threadStarter(void*); void* threadFunc(); int createSocket(); Content checkContent(const char* request); int readContent(); int readRedirect(); void readHeader(size_t size, size_t skip = 0); ssize_t read(void* buffer, size_t size); ssize_t write(const void* buffer, size_t size); ssize_t dwrite(const void* buffer, size_t size); int seekInternal(uint_t time, NetworkIterator* requester); void unregister(NetworkIterator* requester); void flushPipe(); void escapeUrl(); size_t m_lReadBytes; ASXReader* m_pReader; PthreadTask* m_pThread; avm::vector m_Iterators; avm::string m_File, m_Server, m_Proxyhost; URLString m_Filename; URLString m_ServerFilename; int m_iSocket; int m_iPipeFd[2];//message on this pipe interrupts main reading thread int m_lfd; // localy stored asf stream uint16_t m_iProxyport; int m_iRandcntx; // random number to identify connection int m_iSeekId; // first stream which calls seek will be the master uint_t m_uiTime; off_t m_uiDataOffset; uint_t m_uiTimeshift; // network files should be moved to zero time char* m_pBuffer; int m_iRedirectSize; int m_iReadSize; mutable PthreadMutex m_Mutex; mutable PthreadCond m_Cond; Content m_Ctype; struct __attribute__((__packed__)) { uint16_t kind; uint16_t size; uint32_t seq; uint16_t partflag; uint16_t size_confirm; void le16() { kind = avm_get_le16(&kind); size = avm_get_le16(&size); seq = avm_get_le32(&seq); partflag = avm_get_le16(&partflag); size_confirm = avm_get_le16(&size_confirm); } } chhdr; bool m_bQuit; bool m_bHeadersValid; bool m_bFinished; bool m_bWaiting; bool m_bAcceptRanges; }; AVM_END_NAMESPACE; #endif // ASFNETWORKINPUTSTREAM_H avifile-0.7.48~20090503.ds/lib/aviread/AsfReadHandler.cpp0000644000175000017500000003146011176642755021453 0ustar yavoryavor#include "AsfReadHandler.h" #include "AsfReadStream.h" #include "asf_guids.h" #include "AsfFileInputStream.h" #include "AsfRedirectInputStream.h" #include "AsfNetworkInputStream.h" #include "avm_output.h" #include #include #include #define Debug if (0) AVM_BEGIN_NAMESPACE; #define __MODULE__ "AsfReaderHandler" AsfReadHandler::AsfReadHandler() : m_pInput(0) { } int AsfReadHandler::init(const char* pszFile) { bool isurl = strstr(pszFile, "://"); if (!isurl) { AsfFileInputStream* af = new AsfFileInputStream(); if (af && af->init(pszFile) == 0) m_pInput = af; else delete af; } if (!isurl && !m_pInput) { AsfRedirectInputStream* ar = new AsfRedirectInputStream(); if (ar && ar->init(pszFile) == 0) m_pInput = ar; else delete ar; } if (!m_pInput) { AsfNetworkInputStream* ai = new AsfNetworkInputStream(); if (ai && ai->init(pszFile) == 0) m_pInput = ai; else delete ai; } if (!m_pInput) return -1; IsValid(); return 0; } AsfReadHandler::~AsfReadHandler() { for (size_t i = 0; i < m_SeekInfo.size(); ++i) delete m_SeekInfo[i]; for (size_t i = 0; i < m_Streams.size(); ++i) delete m_Streams[i]; delete m_pInput; } size_t AsfReadHandler::GetHeader(void* header, size_t size) { if (header && (size >= sizeof(AVIStreamHeader))) { memset(header, 0, size); AVIStreamHeader* p = (AVIStreamHeader*) header; if (!m_Streams.size()) { p->dwRate=15; p->dwScale=1; p->dwLength=0x7FFFFFFF; } else { double stream_length = (double)m_Header.play_time / 10000000.; p->dwRate = 1000000; if (!m_SeekInfo.size()) p->dwScale = 1000000/15; else p->dwScale = uint_t(1000000.*stream_length/(double)m_SeekInfo.size()); p->dwLength = (uint32_t)m_SeekInfo.size(); } /* if (m_bIsAudio) { p->fccType=mmioFOURCC('a', 'u', 'd', 's'); p->fccHandler=m_Header.hdr.aud.wfex.wFormatTag; p->dwSampleSize=m_Header.hdr.aud.wfex.nBlockAlign; } else if (m_Header.hdr.uid_type == guid_video_stream) { p->fccType=mmioFOURCC('v', 'i', 'd', 's'); p->fccHandler=m_Header.hdr.vid.biCompression; p->rcFrame.right=m_Header.hdr.vid.biWidth; p->rcFrame.top=m_Header.hdr.vid.biHeight; } */ } return sizeof(AVIStreamHeader); } IMediaReadStream* AsfReadHandler::GetStream(uint_t stream_id, IStream::StreamType type) { guidid_t guidid; switch (type) { case IStream::Audio: guidid = GUID_ASF_AUDIO_MEDIA; break; case IStream::Video: guidid = GUID_ASF_VIDEO_MEDIA; break; default: return 0; } // // Selecting from the last available stream - as usualy this // stream contains the best quality video. // yet it's a little bit problematic // so some more advanced selection mechanism is necessary... // FIXME FIXME FIXME uint_t match = 0; for ( #if 1 int i = (int)m_Streams.size() - 1; i >= 0; i-- #else uint_t i = 0; i < m_Streams.size(); i++ #endif ) { if (guid_is_guidid(&m_Streams[i]->m_Header.hdr.stream_guid, guidid)) { if (match == stream_id) { if (!m_Streams[i]->m_pIterator) { m_Streams[i]->m_pIterator = m_pInput->getIterator(i); if (!m_Streams[i]->m_pIterator) continue; m_Streams[i]->m_pSeekInfo = m_Streams[i]->m_pIterator->getSeekInfo(); m_Streams[i]->m_iMaxBitrate = m_pInput->getMaxBitrate(m_Streams[i]->m_pIterator->getId()); //printf("STREAM %d %d BITRATE %d %d\n", stream_id, i, m_Streams[i]->m_iMaxBitrate, m_Streams[i]->m_pIterator->getId()); } return m_Streams[i]; } match++; } } return 0; } size_t AsfReadHandler::GetStreamCount(IStream::StreamType type) { guidid_t guidid; switch (type) { case IStream::Audio: guidid = GUID_ASF_AUDIO_MEDIA; break; case IStream::Video: guidid = GUID_ASF_VIDEO_MEDIA; break; default: guidid = GUID_ERROR; } size_t cnt = 0; for (size_t i = 0; i < m_Streams.size(); ++i) if (guid_is_guidid(&m_Streams[i]->m_Header.hdr.stream_guid, guidid)) cnt++; return cnt; } bool AsfReadHandler::GetURLs(avm::vector& urls) { return m_pInput->getURLs(urls); } void AsfReadHandler::Interrupt() { return m_pInput->interrupt(); } bool AsfReadHandler::IsOpened() { return m_pInput->isOpened(); } bool AsfReadHandler::IsRedirector() { return m_pInput->isRedirector(); } bool AsfReadHandler::IsValid() { //printf("ISVALIDE %d %d %d\n", IsOpened(), m_pInput->isValid(), IsRedirector()); if (!IsOpened() || !m_pInput->isValid()) return false; if (IsRedirector()) return true; if (!m_Streams.size()) { m_Header = m_pInput->getHeader(); const avm::vector& str = m_pInput->getStreams(); for (size_t i = 0; i < str.size(); ++i) { AsfReadStream* stream = new AsfReadStream(this); if (!stream) return false; m_Streams.push_back(stream); stream->m_Header = str[i]; // stream id could be <1, 127> stream->m_iId = stream->m_Header.hdr.stream & 0x7f; stream->m_bIsAudio = guid_is_guidid(&stream->m_Header.hdr.stream_guid, GUID_ASF_AUDIO_MEDIA); if (stream->m_bIsAudio && guid_is_guidid(&stream->m_Header.hdr.error_guid, GUID_ASF_AUDIO_SPREAD) && stream->m_Header.hdr.aud.wfx.cbSize < 200 //FIXME ) { // read/calculate descrambling parameters char* ctmp = (char*) &stream->m_Header.hdr.aud.wfx + sizeof(WAVEFORMATEX) + stream->m_Header.hdr.aud.wfx.cbSize; stream->m_pScrambleDef = (const ASFSpreadAudio*) ctmp; //printf("Scrambling check %d\n", stream.m_Header.hdr.aud.wfex.cbSize); AVM_WRITE("ASF reader", "Interleave info: blocksize=%d packetlen=%d chunklen=%d\n", (int)stream->m_pScrambleDef->span, stream->m_pScrambleDef->packet_length, stream->m_pScrambleDef->chunk_length); if ((stream->m_pScrambleDef->span != 1) && (stream->m_pScrambleDef->chunk_length > 0) && (stream->m_pScrambleDef->packet_length/stream->m_pScrambleDef->chunk_length!=1)) { stream->m_bIsScrambled = true; int msize = stream->m_pScrambleDef->packet_length * stream->m_pScrambleDef->span; AVM_WRITE("ASF reader", "Scrambling scrsize: %d\n", msize); } } if (stream->m_Header.hdr.stream & 0x8000) { AVM_WRITE("ASF reader", "The content of the stream: %d is ENCRYPTED (and for now unplayable!)\n", stream->m_iId); } } } return true; } bool AsfInputStream::parseHeader(uint8_t* ptr, size_t size, int level) { ASFStreamHeader strhdr; bool bResult = false; uint32_t a = avm_get_le32(ptr); ptr += 4 + 2 /* reserved */; AVM_WRITE("ASF reader", 1, "header objects: %d (%" PRIsz ")\n", a, size); for (unsigned i = 0; i <= ASF_STREAMS; ++i) m_MaxBitrates[i] = ~0U; while (size >= 24) { uint64_t ch_size; GUID* guid = avm_get_leGUID(ptr); guidid_t gid = guid_get_guidid(guid); ptr += 16; ch_size = avm_get_le64(ptr); ptr += 8; if (ch_size > size) ch_size = size; // some error if (ch_size < 24) break; ch_size -= 24; size -= 24; AVM_WRITE("ASF reader", 1, "chunk_size %d, size: %" PRIsz " GUID: %s\n", (uint_t)ch_size, size, guidid_to_text(gid)); switch (gid) { case GUID_ASF_FILE_PROPERTIES: if ((uint_t)ch_size < sizeof(ASFMainHeader)) { AVM_WRITE("ASF reader", "Wrong ASF header size"); return false; } if ((uint_t)ch_size > sizeof(ASFMainHeader)) AVM_WRITE("ASF reader", "Warning: unexpected size of ASF header %" PRIsz "!\n", size); m_Header = *avm_get_leASFMainHeader(ptr); m_Streams.clear(); if (level == 0) AsfReadHandler::PrintASFMainHeader(&m_Header); bResult = true; break; case GUID_ASF_STREAM_PROPERTIES: memset(&strhdr, 0, sizeof(strhdr)); // FIXME if ((uint_t)ch_size > sizeof(strhdr)) AVM_WRITE("ASF reader", "FIXME: unexpected size of ASF stream header %" PRIsz "\n", size); memcpy(&strhdr, ptr, ((uint_t)ch_size < sizeof(strhdr)) ? ch_size : sizeof(strhdr)); avm_get_leASFStreamHeader(&strhdr); if (level == 0) AsfReadHandler::PrintASFStreamHeader(&strhdr); m_Streams.push_back(strhdr); break; case GUID_ASF_CONTENT_DESCRIPTION: { static const char comment_txt[][14] = { "Title ", "Author ", "Copyright ", "Description ", "Rating " }; size_t ps = 5 * 2; for (uint_t i = 0; i < 5; i++) { size_t sz = avm_get_le16(ptr + i * 2); if (sz > 0) { char* cs = avm_convert_asfstring(ptr + ps, sz); m_Description.push_back(cs); AVM_WRITE("ASF reader", level, " %s: %s\n", comment_txt[i], cs); ps += sz; } } } break; case GUID_ASF_EXTENDED_CONTENT_DESCRIPTION: { size_t off = 0; while (off < ch_size) { size_t sz = avm_get_le16(ptr + 2 + off); off += 4; if (off + sz < ch_size) { AVM_WRITE("ASF reader", level, "VersionInfo: %s\n", avm_convert_asfstring(ptr + off, sz)); } off += sz; } } break; case GUID_ASF_CODEC_LIST: { uint8_t* b = ptr + 16; // skip reserved GUID size_t ccount = avm_get_le32(b); b += 4; for (size_t i = 0; i < ccount; ++i) { static const char cstr[][19] = { "Codec Name", "Codec Description", "Information" // wide, wide, byte - }; uint16_t ctype = avm_get_le16(b); b += 2; AVM_WRITE("ASF reader", level, "Codec Type: %s\n", (ctype == 1) ? "Video" : ((ctype == 2) ? "Audio" : "Unknown")); for (uint_t j = 0; j < 3; ++j) { size_t csize = avm_get_le16(b); b += 2; if (j < 2) { csize = (uint16_t) (csize * 2); // *2 WCHAR avm_convert_asfstring(b, csize); AVM_WRITE("ASF reader", level, "%s: %s\n", cstr[j], b); } b += csize; } } } break; case GUID_ERROR: { char guidstr[64]; AVM_WRITE("ASF reader", "Unknown guid \"%s\"!\n", guid_to_string(guidstr, guid)); } break; case GUID_ASF_STREAM_BITRATE_PROPERTIES: { const uint8_t* b = ptr; avm::string t; unsigned sc = avm_get_le16(b); b += 2; for (unsigned i = 0; i < sc; i++) { char tl[50]; unsigned sid = avm_get_le16(b); b += 2; unsigned mbit = avm_get_le32(b); b += 4; m_MaxBitrates[sid & ASF_STREAMS] = mbit; sprintf(tl, " %d-%d", sid, mbit); t += tl; } AVM_WRITE("ASF reader", level, "Stream-MaxBitrate:%s\n", t.c_str()); } break; default: // some known but not parsed GUIDs at this moment AVM_WRITE("ASF reader", level, "header contains \"%s\" (%" PRId64 "b)\n", guidid_to_text(gid), ch_size); break; } size -= (uint_t) ch_size; ptr += (uint_t) ch_size; } return bResult; } /* 1601 to 1970 is 369 years plus 89 leap days */ #define SECS_1601_TO_1970 ((369 * 365 + 89) * 86400ULL) void AsfReadHandler::PrintASFMainHeader(const ASFMainHeader* h) { char b[64]; char sec1970str[128]; struct tm result; time_t sec1970 = (int64_t) (h->create_time / 10000000) - SECS_1601_TO_1970; #ifdef HAVE_LOCALTIME_R localtime_r(&sec1970, &result); #else struct tm* r = localtime(&sec1970); memcpy(&result, r, sizeof(result)); #endif #ifdef HAVE_ASCTIME_R #ifdef HAVE_ASCTIME_R_LONG asctime_r(&result, sec1970str, sizeof(sec1970str) - 1); #else asctime_r(&result, sec1970str); #endif // HAVE_ASCTIME_R_LONG #else // HAVE_ASCTIME_R char* bb = asctime(&result); strcpy(sec1970str, bb); #endif // HAVE_ASCTIME_R char* d = strchr(sec1970str, '\n'); if (d) *d = 0; AVM_WRITE("ASF reader", "MainHeader: %s\n" " Created: %s File size=%.0f Packets=%.0f\n" " Total time=%.1f sec Play time=%.1f sec Preroll=%.1f sec\n" " Flags=0x%x Packet size=%d (=%d) MaxBandwidth=%d bps\n", guid_to_string(b, &h->guid), sec1970str, (double)h->file_size, (double)h->pkts_count, (double)h->play_time / 10000000., (double)h->send_time / 10000000., (double)h->preroll / 1000., h->flags, h->min_pktsize, h->max_pktsize, h->max_bitrate); } void AsfReadHandler::PrintASFStreamHeader(const ASFStreamHeader* h) { char b[64], c[64]; AVM_WRITE("ASF reader", "StreamHeader: %s Error correction: %s\n" " Time offset=%.0f Stream size=%d Error size=%d Stream=%d Reserved=0x%x\n", guidid_to_text(guid_get_guidid(&h->hdr.stream_guid)), guidid_to_text(guid_get_guidid(&h->hdr.error_guid)), (double)h->hdr.time_offset, h->hdr.stream_size, h->hdr.error_size, h->hdr.stream, h->hdr.reserved); } IMediaReadHandler* CreateAsfReadHandler(const char* pszFile) { AsfReadHandler* r = new AsfReadHandler(); if (r && r->init(pszFile) == 0) return r; delete r; return 0; } #undef __MODULE__ AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviread/AsfReadHandler.h0000644000175000017500000000205311171137130021071 0ustar yavoryavor#ifndef ASFREADHANDLER_H #define ASFREADHANDLER_H #include "ReadHandlers.h" #include "asffmt.h" AVM_BEGIN_NAMESPACE; class AsfInputStream; class AsfStreamSeekInfo; class AsfReadHandler : public IMediaReadHandler { friend class AsfReadStream; public: AsfReadHandler(); virtual ~AsfReadHandler(); virtual size_t GetHeader(void* pheader, size_t n); virtual IMediaReadStream* GetStream(uint_t stream_id, IStream::StreamType type); virtual size_t GetStreamCount(IStream::StreamType type); virtual bool GetURLs(avm::vector& urls); virtual void Interrupt(); virtual bool IsOpened(); virtual bool IsValid(); virtual bool IsRedirector(); int init(const char* pszFile); static void PrintASFMainHeader(const ASFMainHeader*); static void PrintASFStreamHeader(const ASFStreamHeader*); protected: avm::vector m_Streams; avm::vector m_SeekInfo; ASFMainHeader m_Header; AsfInputStream* m_pInput; }; AVM_END_NAMESPACE; #endif // ASFREADHANDLER_H avifile-0.7.48~20090503.ds/lib/aviread/AsfReadStream.cpp0000644000175000017500000003434411177255626021333 0ustar yavoryavor#include "AsfReadStream.h" #include "AsfReadHandler.h" #include "asf_guids.h" #include "avm_output.h" #include #include #include #include #define Debug if (0) AVM_BEGIN_NAMESPACE; AsfReadStream::AsfReadStream(AsfReadHandler* handler) :m_pSeekInfo(0), m_pScrambleDef(0), m_pHandler(handler), m_pIterator(0), m_pStrPacket(0), m_pAsfPacket(0), m_uiFragId(0), m_uiLastPos(0), m_dLastTime(-1.), m_iMaxBitrate(-1), m_bIsScrambled(false) { } AsfReadStream::~AsfReadStream() { if (m_pAsfPacket) m_pAsfPacket->release(); if (m_pIterator) m_pIterator->release(); if (m_pStrPacket) m_pStrPacket->Release(); } double AsfReadStream::CacheSize() const { return m_pHandler->m_pInput->cacheSize(); } void AsfReadStream::ClearCache() { //return m_pHandler->m_pInput->clear(); } size_t AsfReadStream::GetFormat(void *format, size_t size) const { const void* fmt; size_t fsize; if (m_bIsAudio) { fsize = m_Header.hdr.stream_size; fmt = &m_Header.hdr.aud.wfx; } else { fsize = m_Header.hdr.stream_size - 11; fmt = &m_Header.hdr.vid.bih; } if (format) memcpy(format, fmt, (fsize > size) ? size : fsize); return fsize; } IStream::StreamType AsfReadStream::GetType() const { switch (guid_get_guidid(&m_Header.hdr.stream_guid)) { case GUID_ASF_AUDIO_MEDIA: return IStream::Audio; case GUID_ASF_VIDEO_MEDIA: return IStream::Video; default: return IStream::Other; } } double AsfReadStream::GetFrameTime() const { if (!m_pSeekInfo || !m_pSeekInfo->size()) return 1./15.; return GetLengthTime()/(double)m_pSeekInfo->size(); } size_t AsfReadStream::GetHeader(void* pheader, size_t size) const { if (pheader && size >= sizeof(AVIStreamHeader)) { memset(pheader, 0, size); AVIStreamHeader* p = (AVIStreamHeader*) pheader; if (!m_pSeekInfo) { p->dwRate = 15; p->dwScale = 1; p->dwLength = 0x7FFFFFFF; } else { p->dwRate = 1000000; if (!m_pSeekInfo->size()) p->dwScale = 1000000 / 15; else { double stream_length = (double)m_pHandler->m_Header.play_time / 10000000.; p->dwScale = int(1000000. * stream_length / (double)m_pSeekInfo->size()); } p->dwLength = (uint32_t)m_pSeekInfo->size(); } if (m_bIsAudio) { p->fccType = streamtypeAUDIO; p->fccHandler = m_Header.hdr.aud.wfx.wFormatTag; p->dwSampleSize = m_Header.hdr.aud.wfx.nBlockAlign; } else if (guid_is_guidid(&m_Header.hdr.stream_guid, GUID_ASF_VIDEO_MEDIA)) { p->fccType = streamtypeVIDEO; p->fccHandler = m_Header.hdr.vid.bih.biCompression; p->rcFrame.right = (int16_t) m_Header.hdr.vid.bih.biWidth; p->rcFrame.top = (int16_t) m_Header.hdr.vid.bih.biHeight; } } return sizeof(AVIStreamHeader); } framepos_t AsfReadStream::GetLength() const { // FIXME - show better value here return (m_pSeekInfo) ? (framepos_t)m_pSeekInfo->size() : 0x7fffffff; } double AsfReadStream::GetLengthTime() const { if (m_pSeekInfo && m_pSeekInfo->size() > 0) { return ((*m_pSeekInfo)[m_pSeekInfo->size() - 1].object_start_time) / 1000.; } if (m_pHandler->m_Header.play_time <= m_pHandler->m_Header.preroll) return (double) 0x7fffffff; // some large value return (double)(m_pHandler->m_Header.play_time - m_pHandler->m_Header.preroll) / 10000000.; } framepos_t AsfReadStream::GetNearestKeyFrame(framepos_t lFrame) const { if (!m_pSeekInfo) return ERR; framepos_t info_pos; if (lFrame != ERR) { if (lFrame >= m_pSeekInfo->size()) return 0; info_pos = lFrame; } else info_pos = m_uiLastPos; return m_pSeekInfo->nearestKeyFrame(info_pos); } framepos_t AsfReadStream::GetNextKeyFrame(framepos_t lFrame) const { if (!m_pSeekInfo) return ERR;// GetPos(); framepos_t info_pos; if (lFrame != ERR) { if (lFrame >= m_pSeekInfo->size()) return ERR; info_pos = lFrame; } else info_pos = m_uiLastPos; return m_pSeekInfo->nextKeyFrame(info_pos + 1); } framepos_t AsfReadStream::GetPrevKeyFrame(framepos_t lFrame) const { if (!m_pSeekInfo) return ERR; framepos_t info_pos; if (lFrame != ERR) { if (lFrame >= m_pSeekInfo->size() || lFrame == 0) return 0; info_pos = lFrame - 1; } else info_pos = m_uiLastPos; return m_pSeekInfo->prevKeyFrame(info_pos); } double AsfReadStream::GetTime(framepos_t pos) const { //printf("GET TIME %d %f %d\n", pos, m_dLastTime, m_iId); if (pos == ERR) { if (!m_pStrPacket) ReadPacketInternal(); return m_dLastTime; } if (m_pSeekInfo && pos < m_pSeekInfo->size()) return (*m_pSeekInfo)[pos].object_start_time / 1000.; //AVM_WRITE("ASF reader", "lSample %d %f (%f)\n", pos, t, m_uiLastTimestamp / 1000.0); return -1.; } size_t AsfReadStream::GetSampleSize() const { return (m_bIsAudio) ? m_Header.hdr.aud.wfx.nBlockAlign : 0; } StreamInfo* AsfReadStream::GetStreamInfo() const { if (!m_pSeekInfo) { AVM_WRITE("ASF reader", "GetStreamInfo() no seek info\n"); } if (m_StreamInfo.m_p->m_dLengthTime == 0.0) { size_t kfmax = 0; size_t kfmin = ~0U; uint_t kfchunks = 0; int64_t kfsize = 0; size_t fmax = 0; size_t fmin = ~0U; uint_t chunks = 0; int64_t size = 0; if (m_pSeekInfo) for (size_t i = 0; i < m_pSeekInfo->size(); ++i) { size_t l = (*m_pSeekInfo)[i].GetChunkLength(); if ((*m_pSeekInfo)[i].IsKeyFrame() || m_bIsAudio) { kfmax = (kfmax > l) ? kfmax : l; kfmin = (kfmin < l) ? kfmin : l; kfsize += l; kfchunks++; } else { fmax = (fmax > l) ? fmax : l; fmin = (fmin < l) ? fmin : l; size += l; chunks++; } } m_StreamInfo.m_p->setKfFrames(kfmax, kfmin, kfchunks, kfsize); m_StreamInfo.m_p->setFrames(fmax, fmin, chunks, size); double ft = 0; if (m_pSeekInfo && m_pSeekInfo->size()) ft = (*m_pSeekInfo)[0].object_start_time / 1000.; m_StreamInfo.m_p->m_dLengthTime = GetLengthTime() - ft; m_StreamInfo.m_p->m_iQuality = 0; if (m_bIsAudio) { const WAVEFORMATEX& wfx = m_Header.hdr.aud.wfx; m_StreamInfo.m_p->setAudio(wfx.nChannels, wfx.nSamplesPerSec, wfx.wBitsPerSample, wfx.nAvgBytesPerSec); m_StreamInfo.m_p->m_Type = StreamInfo::Audio; m_StreamInfo.m_p->m_uiFormat = wfx.wFormatTag; m_StreamInfo.m_p->m_iSampleSize = 1; } else { const BITMAPINFOHEADER& bih = m_Header.hdr.vid.bih; m_StreamInfo.m_p->setVideo(bih.biWidth, bih.biHeight, m_iMaxBitrate/8); m_StreamInfo.m_p->m_Type = StreamInfo::Video; m_StreamInfo.m_p->m_uiFormat = bih.biCompression; m_StreamInfo.m_p->m_iSampleSize = 0; } } return new StreamInfo(m_StreamInfo); } bool AsfReadStream::IsKeyFrame(framepos_t lFrame) const { if (!m_pSeekInfo || m_bIsAudio) return true; framepos_t info_pos; if (lFrame != ERR) { if (lFrame >= m_pSeekInfo->size()) return true; info_pos = lFrame; } else info_pos = m_uiLastPos; //printf("ISKEY %d %d\n", info_pos, (*m_pSeekInfo)[info_pos].IsKeyFrame()); return (info_pos != ERR) ? (*m_pSeekInfo)[(int)info_pos].IsKeyFrame() : true; } void AsfReadStream::ReadPacketInternal() const { int m_iRealId = m_iId; StreamPacket* spkt = 0; size_t wpos = 0; uint_t seq_num = ~0U; int newpos = -1; // loop until packet is completed for (;;) { //printf("READPACKET %p %d id:%d\n", m_pAsfPacket, m_uiFragId, m_iId); if (!m_pAsfPacket || m_uiFragId >= m_pAsfPacket->fragments.size()) { newpos = -1; if (!GetNextAsfPacket()) { if (spkt) spkt->Release(); spkt = 0; break; } } // go through all fragments in this packet const AsfPacketFragment& f = m_pAsfPacket->fragments[m_uiFragId++]; Debug AVM_WRITE("ASF reader", 4, "Pos id:%d == %d (rid: %d) spos: %d off: %d osize: %d dsize: %d seq: %d fsize: %" PRIsz "\n", m_iId, f.stream_id, m_iRealId, m_uiFragId, f.fragment_offset, f.object_length, f.data_length, f.seq_num, m_pAsfPacket->fragments.size()); if (f.stream_id != m_iRealId) { if (!m_iRealId && !f.fragment_offset && f.stream_id > 1) { m_iRealId = f.stream_id; } else continue; } //printf("S %d\n", f.stream_id); if (spkt && seq_num != f.seq_num) { AVM_WRITE("ASF reader", "WARNING: fragment with different" " sequence number ( expected %d, found %d ), " "packet timestamp %f ignoring ???\n", seq_num, f.seq_num, m_pAsfPacket->send_time / 1000.); // we could check if the current packet doesn't have any // other fragments which would fit our needs unsigned np = 0; for (unsigned i = m_uiFragId + 1; i < m_pAsfPacket->fragments.size(); i++) { const AsfPacketFragment& fn = m_pAsfPacket->fragments[i]; // ok skip and check if the next fragment would fit //printf("FRAGS %d: %d\n", i, fn.seq_num); if (fn.seq_num == seq_num && f.stream_id == m_iRealId) { np = i; break; } } if (np) { newpos = m_uiFragId - 1; m_uiFragId = np; } else { if (f.fragment_offset == 0) m_uiFragId--; if (spkt) spkt->Release(); spkt = 0; } } if (!spkt) { //printf("OBJLEN %d t:%d o:%d\n", f.object_length, f.object_start_time, f.fragment_offset); seq_num = f.seq_num; if (f.object_length > StreamPacket::MAX_PACKET_SIZE) // too large - some bug continue; spkt = new StreamPacket(f.object_length); if (!spkt) break; spkt->SetFlags(f.keyframe ? 0x10 : 0); //printf("Duration %d\n", m_pAsfPacket->duration); uint_t tpos = f.object_start_time - m_pHandler->m_Header.preroll; m_uiLastPos = (m_pSeekInfo) ? m_pSeekInfo->find(tpos) : 0; spkt->SetPos(m_uiLastPos); spkt->SetTimestamp((int64_t)tpos * 1000LL); m_dLastTime = spkt->GetTime() ; //printf("CREATED pkt: %d 0x%x tm:%lld %d id:%d\n", spkt->size, spkt->flags, spkt->timestamp, spkt->position, m_iId); } if ((wpos + f.data_length) > spkt->GetSize()) { // this fragment won't fit into the buffer AVM_WRITE("ASF reader", "WARNING: fragment too big " "( read bytes %" PRIsz ", fragment data length %d ), " "position %d, offset: %d, packet timestamp %f skipping", wpos, f.data_length, m_uiFragId, f.fragment_offset, m_pAsfPacket->send_time / 1000.); if (spkt) spkt->Release(); spkt = 0; continue; } if (wpos) { if (wpos != f.fragment_offset) { AVM_WRITE("ASF reader", "WARNING: fragment with unexpected offset while" " reassembling ( expected %" PRIsz ", found %d ), " "packet timestamp %f skipping\n", wpos, f.fragment_offset, m_pAsfPacket->send_time / 1000.); if (spkt) spkt->Release(); spkt = 0; continue; } } else if (f.fragment_offset) // !spkt->read { AVM_WRITE("ASF reader", "WARNING: incomplete fragment found ( offset %d, length %d )" ", packet timestamp %f skipping\n", f.fragment_offset, f.object_length, m_pAsfPacket->send_time / 1000.); if (spkt) spkt->Release(); spkt = 0; continue; } memcpy(spkt->GetData() + wpos, f.pointer, f.data_length); wpos += f.data_length; if (wpos == spkt->GetSize()) break; } if (newpos >= 0) m_uiFragId = newpos; //if (m_iId>0) {int sum = 0; for (int i = 0; i < spkt->size; i++) sum += spkt->memory[i]; printf("PK %d %d\n", spkt->size, sum);} m_pStrPacket = spkt; } // buffer one frame ahead // after seek we have to throw out the old 'cached' packet // and prepare new one - this is made via SkipFrame call StreamPacket* AsfReadStream::ReadPacket() { if (!m_pStrPacket) ReadPacketInternal(); //printf("_____READPAKET %p id:%d\n", m_pStrPacket, m_iId); StreamPacket* tmp = m_pStrPacket; if (m_pStrPacket) { if (m_bIsScrambled) { // descramble packet uint8_t* oldmem = m_pStrPacket->GetData(); StreamPacket* npkt = new StreamPacket(m_pStrPacket->GetSize()); if (npkt) { if (npkt->GetData()) { for (size_t offset = 0; offset < m_pStrPacket->GetSize(); offset += m_pScrambleDef->chunk_length) { size_t off = offset / m_pScrambleDef->chunk_length; size_t row = off / m_pScrambleDef->span; size_t col = off % m_pScrambleDef->span; size_t idx = row + col * m_pScrambleDef->packet_length / m_pScrambleDef->chunk_length; //printf("off:%d samp_count: %d samples: %d\n", m_iScrOffset, samp_count, lSamples); //printf("%d bytes in buffer, block align: %d, lasttime: %d\n", m_pcScrambleBuf.size()-m_iScrOffset, m_pScrambleDef->block_align_1, m_uiLastTimestamp); //printf("%d bytes in buffer, block_size: %d, offset: %d\n", m_pcScrambleBuf.size()-m_iScrOffset, m_pScrambleDef->chunk_size, m_iScrOffset); //printf("%d: writing block %dx%d=%d as %d\n", i, row, col, idx, index); memcpy(npkt->GetData() + offset, m_pStrPacket->GetData() + idx * m_pScrambleDef->chunk_length, m_pScrambleDef->chunk_length); } } m_pStrPacket->SwapData(*npkt); npkt->Release(); } } ReadPacketInternal(); } return tmp; } int AsfReadStream::Seek(framepos_t pos) { AVM_WRITE("ASF reader", 1, "AsfReadStream::Seek(%d)\n", pos); chunk_info ch; if (m_pIterator->seek(pos, &ch) != 0) return -1; GetNextAsfPacket(); m_uiFragId = ch.fragment_id; if (m_pStrPacket) m_pStrPacket->Release(); m_pStrPacket = 0; ReadPacketInternal(); //printf("SEEK NEW POS %d %d (%d f:%d)\n", pos, GetPos(), ch.packet_id, ch.fragment_id); return 0; } int AsfReadStream::SeekTime(double timepos) { AVM_WRITE("ASF reader", 1, "AsfReadStream::SeekTime(%f)\n", timepos); chunk_info ch; if (timepos < 0. || m_pIterator->seekTime(timepos, &ch) != 0) return -1; GetNextAsfPacket(); m_uiFragId = ch.fragment_id; if (m_pStrPacket) m_pStrPacket->Release(); m_pStrPacket = 0; ReadPacketInternal(); //printf("seektimepos %d (tpos: %f)\n", m_uiFragId, timepos); //AVM_WRITE("ASF reader", "SEEKTIMEB %f %f\n", m_uiLastTimestamp / 1000.0, ch.object_start_time / 1000.0); return 0; } int AsfReadStream::SkipFrame() { AVM_WRITE("ASF reader", 1, "Skip frame\n"); StreamPacket* p = ReadPacket(); if (p) p->Release(); //printf("SKIP POS %p %u\n", m_pAsfPacket, m_uiLastTimestamp / 1000); return 0; } int AsfReadStream::SkipTo(double pos) { while (m_pStrPacket && m_pStrPacket->GetTime() < pos) SkipFrame(); return 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviread/AsfReadStream.h0000644000175000017500000000440111176642755020771 0ustar yavoryavor#ifndef ASFREADSTREAM_H #define ASFREADSTREAM_H #include "ReadHandlers.h" #include "AsfInputStream.h" #include "infotypes.h" AVM_BEGIN_NAMESPACE; class AsfReadHandler; class AsfReadStream : public IMediaReadStream { friend class AsfReadHandler; public: AsfReadStream(AsfReadHandler* parent); virtual ~AsfReadStream(); virtual void ClearCache(); virtual double CacheSize() const; virtual bool IsKeyFrame(framepos_t frame = ERR) const; virtual size_t GetHeader(void* header = 0, size_t size = 0) const; virtual size_t GetFormat(void *format = 0, size_t size = 0) const; virtual double GetFrameTime() const; virtual framepos_t GetLength() const; virtual double GetLengthTime() const; virtual framepos_t GetPrevKeyFrame(framepos_t frame = ERR) const; virtual framepos_t GetNextKeyFrame(framepos_t frame = ERR) const; virtual framepos_t GetNearestKeyFrame(framepos_t frame = ERR) const; virtual size_t GetSampleSize() const; virtual StreamInfo* GetStreamInfo() const; virtual double GetTime(framepos_t frame = ERR) const; virtual IStream::StreamType GetType() const; virtual StreamPacket* ReadPacket(); virtual int Seek(framepos_t framepos); virtual int SeekTime(double timepos); virtual int SkipFrame(); virtual int SkipTo(double timepos); protected: void ReadPacketInternal() const; AsfPacket* GetNextAsfPacket() const { while (!m_pIterator->isEof()) { if (m_pAsfPacket) m_pAsfPacket->release(); if (!(m_pAsfPacket = m_pIterator->getPacket()) || !m_pAsfPacket->fragments.size()) continue; m_uiFragId = 0; //printf("Packet %p %d for %p\n", m_pAsfPacket, m_pAsfPacket->refcount, this); return m_pAsfPacket; } return 0; } ASFStreamHeader m_Header; const AsfStreamSeekInfo* m_pSeekInfo; const ASFSpreadAudio* m_pScrambleDef; mutable AsfReadHandler* m_pHandler; mutable StreamInfo m_StreamInfo; mutable AsfIterator* m_pIterator; mutable StreamPacket* m_pStrPacket; mutable AsfPacket* m_pAsfPacket; mutable unsigned m_uiFragId; mutable unsigned m_uiLastPos; mutable double m_dLastTime; int m_iId; int m_iMaxBitrate; bool m_bIsAudio; bool m_bIsScrambled; }; AVM_END_NAMESPACE; #endif // ASFREADSTREAM_H avifile-0.7.48~20090503.ds/lib/aviread/AsfRedirectInputStream.cpp0000644000175000017500000000110411172141157023211 0ustar yavoryavor#include "AsfRedirectInputStream.h" #include "avm_output.h" #include #include #include AVM_BEGIN_NAMESPACE; int AsfRedirectInputStream::init(const char* pszFile) { int fd = open(pszFile, O_RDONLY); if (fd < 0) { AVM_WRITE("ASX reader", "Could not open file!\n"); return -1; } ssize_t r = read(fd, &m_Buffer[0], m_Buffer.size()); close(fd); if (r > 0 && m_Reader.create(&m_Buffer[0], m_Buffer.size())) return 0; AVM_WRITE("ASX reader", 1, "Not a redirector!\n"); return -1; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviread/AsfRedirectInputStream.h0000644000175000017500000000104011172166610022656 0ustar yavoryavor#ifndef ASFREDIRECTINPUTSTREAM_H #define ASFREDIRECTINPUTSTREAM_H #include "AsxReader.h" #include "AsfInputStream.h" AVM_BEGIN_NAMESPACE; class AsfRedirectInputStream: public AsfInputStream { avm::vector m_Buffer; ASXReader m_Reader; public: AsfRedirectInputStream() :m_Buffer(16384) {} virtual bool getURLs(avm::vector& urls) { return m_Reader.getURLs(urls); } virtual bool isRedirector() { return true; } int init(const char* pszFile); }; AVM_END_NAMESPACE; #endif // ASFREDIRECTINPUTSTREAM_H avifile-0.7.48~20090503.ds/lib/aviread/AsfStreamSeekInfo.cpp0000644000175000017500000000332011177255503022143 0ustar yavoryavor#include "AsfInputStream.h" //#include /** * * This object contains information that's necessary for proper implementation * of seek and a few other nice features. To create it, we need to read the * whole media first. That's why we won't do it for non-local media. */ AVM_BEGIN_NAMESPACE; framepos_t AsfStreamSeekInfo::prevKeyFrame(framepos_t kf) const { if (kf == 0 || kf >= size() || kf == ERR) return ERR; for (unsigned i = kf - 1; i > 0; --i) if (operator[](i).IsKeyFrame()) return i; return 0; } framepos_t AsfStreamSeekInfo::nextKeyFrame(framepos_t kf) const { if (kf >= size() || kf == ERR) return ERR; for (unsigned i = kf + 1; i < size(); ++i) if (operator[](i).IsKeyFrame()) return i; return ERR; } framepos_t AsfStreamSeekInfo::nearestKeyFrame(framepos_t kf) const { if (kf >= size() || kf == ERR) return ERR; framepos_t prev_kf = prevKeyFrame(kf); framepos_t next_kf = nextKeyFrame(kf); return (kf - prev_kf < next_kf - kf) ? prev_kf : next_kf; } framepos_t AsfStreamSeekInfo::find(framepos_t sktime) const { if (!size() || sktime == ERR) return ERR; framepos_t h = (framepos_t)size() - 1; framepos_t l = (sktime < operator[](h).object_start_time) ? 0 : h; while (l != h) { framepos_t m = l + (h - l) / 2; if (sktime >= operator[](m).object_start_time) { if (l == m) break; l = m; if (sktime < operator[](m + 1).object_start_time) break; } else h = m; } #if 0 printf("TIME find sk: %f cur: %f nex: %f -> %d\n", sktime / 1000., operator[](l).object_start_time / 1000., operator[](l + 1).object_start_time / 1000., l); #endif return l; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviread/AsxReader.cpp0000644000175000017500000001360311172166610020510 0ustar yavoryavor#include "AsxReader.h" #include "avm_output.h" #include #include #include AVM_BEGIN_NAMESPACE; enum asx_position { BEGIN, OPEN_BRACKET, CLOSE_BRACKET, IN_COMMENT, IN_QUOTED_COMMENT, IN_TAGNAME, AFTER_TAGNAME, IN_ENDTAG, BEFORE_TAGCLOSE, IN_PROPNAME, AFTER_PROPNAME, PROP_EQUAL, AFTER_PROPEQUAL, BETWEEN_PROPS, IN_PROPCONTENTS, IN_QUOTED_PROPCONTENTS, IN_QUOTED_CONTENTS, IN_CONTENTS, }; bool ASXReader::addURL(const char* url) { int i = 0; while (*url && (!isprint(*url) || (*url == '"'))) url++; while (isprint(url[i]) && (url[i] != '"')) i++; if (i > 0) { avm::string vurl = avm::string(url, i); if (strncasecmp(vurl.c_str(), "mms://", 6) != 0 && strncasecmp(vurl.c_str(), "http://", 7) != 0) { char* h = new char[m_Server.size() * 2 + m_Filename.size()]; if (h) { int p = sprintf(h, "http://%s", m_Server.c_str()); if (vurl[0] != '/') { h[p++] = '/'; strcpy(h + p, m_Filename.c_str()); char* q = strchr(h + p, '?'); // strip all after '?' if (q) *q = 0; } //printf("_____addUrl>%s<>%s<____\n", h, vurl.c_str()); vurl.insert(0, h); } } //printf("URL:%s<\n", vurl.c_str()); m_Urls.push_back(vurl); return true; } return false; } bool ASXReader::create(const char* data, size_t size) { int last_start = 0; avm::string last_tag; avm::string last_prop; avm::string last_prop_val; m_Urls.clear(); //printf("PARSE >%s< %d\n", data, size); asx_position state = BEGIN; for (unsigned i = 0; i < size; i++) { unsigned char c = data[i]; if (c < 6) break; // stop processing //printf("i %d %c %d\n", i, c, state); int is_alpha = isalpha(c) || (c >= 0x80); int is_space = isspace(c); switch(state) { case BEGIN: if (c == '<') state = OPEN_BRACKET; else if (is_alpha) { // sometime only single one line redirection appears if (!strncasecmp(data + i, "mms://", 6) || !strncasecmp(data + i, "http://", 7)) return addURL(data + i); } continue; case OPEN_BRACKET: if (c == '!') state = IN_COMMENT; else if (c == '/') { state = IN_ENDTAG; last_start = i + 1; } else if (is_alpha) { state = IN_TAGNAME; last_start = i; } else if (!is_space) return false; continue; case IN_COMMENT: if (c == '"') state = IN_QUOTED_COMMENT; else if (c == '>') state = CLOSE_BRACKET; continue; case IN_QUOTED_COMMENT: if (c == '"') state = IN_COMMENT; continue; case CLOSE_BRACKET: if (c == '<') state = OPEN_BRACKET; else state = IN_CONTENTS; continue; case IN_TAGNAME: if (is_space) { last_tag = avm::string(&data[last_start], i-last_start); //printf("TAG1: %s\n", last_tag.c_str()); state = AFTER_TAGNAME; } else if ((c == '/') || (c == '>')) { last_tag = avm::string(&data[last_start], i-last_start); //printf("TAG2: %s\n", last_tag.c_str()); if (c == '/') state = BEFORE_TAGCLOSE; else state = CLOSE_BRACKET; } continue; case AFTER_TAGNAME: if (c == '/') state = BEFORE_TAGCLOSE; else if (!is_space) { last_start = i; state = IN_PROPNAME; } continue; case IN_ENDTAG: if (c == '>') { last_tag = avm::string(&data[last_start], i-last_start); state = CLOSE_BRACKET; AVM_WRITE("ASX reader", 1, " TAG: %s\n", last_tag.c_str()); if (last_tag == "asx") return true; } continue; case BEFORE_TAGCLOSE: if (c == '>') state = CLOSE_BRACKET; else if (!is_space) return false; continue; case IN_PROPNAME: if (c == '=') { last_prop = avm::string(&data[last_start], i-last_start); state = PROP_EQUAL; } else if (is_space) { last_prop = avm::string(&data[last_start], i-last_start); state = AFTER_PROPNAME; } continue; case AFTER_PROPNAME: if (c == '=') state = PROP_EQUAL; continue; case PROP_EQUAL: if (is_space) continue; if (c == '"') state = IN_QUOTED_PROPCONTENTS; else state = IN_PROPCONTENTS; last_start = i; continue; case IN_PROPCONTENTS: if (c == '"') state = IN_QUOTED_PROPCONTENTS; else if (is_space || (c == '/') || (c == '>')) { last_prop_val = avm::string(&data[last_start], i-last_start); AVM_WRITE("ASX reader", 1, "VALUE: %s t:%s p:%s\n", last_prop_val.c_str(), last_tag.c_str(), last_prop.c_str()); if (last_tag.tolower() == "ref" || last_tag == "entryref" || last_tag == "a" || last_tag == "location" || last_tag == "embed") // part of some javascript if (last_prop.tolower() == "href" || last_prop == "src") addURL(last_prop_val.c_str()); if (c == '/') state = BEFORE_TAGCLOSE; else if (c == '>') state = CLOSE_BRACKET; else state = BETWEEN_PROPS; } continue; case IN_QUOTED_PROPCONTENTS: if (c == '"') state = IN_PROPCONTENTS; continue; case BETWEEN_PROPS: if (c == '/') state = BEFORE_TAGCLOSE; else if (c == '>') state = CLOSE_BRACKET; else if (is_alpha) { last_start = i; state = IN_PROPNAME; } else if (!is_space) return false; continue; case IN_CONTENTS: if (c == '"') state = IN_QUOTED_CONTENTS; else if (c == '<') state = OPEN_BRACKET; continue; case IN_QUOTED_CONTENTS: if (c == '"') state = IN_CONTENTS; continue; default: // after_propequal AVM_WRITE("ASX reader", "FIXME ERROR after_propequal not handled\n"); break; } } return (m_Urls.size() > 0); } bool ASXReader::getURLs(avm::vector& urls) const { //for (unsigned i = 0; i < m_Urls.size(); i++) printf("URLs: %s\n", m_Urls[i].c_str()); urls = m_Urls; return true; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviread/AsxReader.h0000644000175000017500000000111111172166610020144 0ustar yavoryavor#ifndef AVIFILE_ASXREADER_H #define AVIFILE_ASXREADER_H #include "avm_stl.h" AVM_BEGIN_NAMESPACE; class ASXReader { public: ASXReader() {} // for redirector's default constructor ASXReader(const avm::string& server, const avm::string& file) : m_Server(server), m_Filename(file) {} bool create(const char* data, size_t size); bool getURLs(avm::vector& urls) const; private: bool addURL(const char* url); avm::string m_Server; avm::string m_Filename; avm::vector m_Urls; }; AVM_END_NAMESPACE; #endif // AVIFILE_ASXREADER_H avifile-0.7.48~20090503.ds/lib/aviread/AviReadHandler.cpp0000644000175000017500000005511511177256037021457 0ustar yavoryavor#include "AviReadHandler.h" #include "AviReadStream.h" #include "utils.h" #include "avm_fourcc.h" #include "formats.h" #include "avm_output.h" #include #include //#define USE_HACK AVM_BEGIN_NAMESPACE; // reset profiler status - just for debuging //extern "C" void kprof_reset_stats(void); struct RiffInfoChunk { fourcc_t riff; //const char* text; const char text[20]; }; static const RiffInfoChunk infos[] = { // here will follow various info about the movie file // comments here are copied from OpenDML specs by Matrox // Indicates where the subject of the file is archived { RIFFINFO_IARL, "Archival Location" }, // Lists the artist of the original subject of the file; // for example, "Michaelangelo." { RIFFINFO_IART, "Artist" }, // Lists the name of the person or organization that commissioned // the subject of the file; for example "Pope Julian II." { RIFFINFO_ICMS, "Commissioned" }, // Provides general comments about the file or the subject // of the file. If the comment is several sentences long, end each // sentence with a period. Do not include new-line characters. { RIFFINFO_ICMT, "Comments" }, // Records the copyright information for the file; for example, // "Copyright Encyclopedia International 1991." If there are multiple // copyrights, separate them by semicolon followed by a space. { RIFFINFO_ICOP, "Copyright" }, // Specifies the date the subject of the file was created. List // dates in year-month-day format, padding one-digit months and days with // a zero on the left; for example, "1553-05-03" for May 3, 1553. { RIFFINFO_ICRD, "Creation Date" }, // Describes whether an image has been cropped and, if so, how it // was cropped; for example, "lower-right corner." { RIFFINFO_ICRP, "Cropped" }, // Specifies the size of the original subject of the file; for // example, "8.5 in h, 11 in w." { RIFFINFO_IDIM, "Dimensions" }, // Stores dots per inch setting of the digitizer used to // produce the file, such as "300." { RIFFINFO_IDPI, "Dots Per Inch" }, // Stores the of the engineer who worked on the file. If there are // multiple engineers, separate the names by a semicolon and a blank; // for example, "Smith, John; Adams, Joe." { RIFFINFO_IENG, "Engineer" }, // Describes the original work, such as "landscape,", "portrait," // "still liefe," etc. { RIFFINFO_IGNR, "Genre" }, // Provides a list of keywords that refer to the file or subject of the // file. Separate multiple keywords with a semicolon and a blank; // for example, "Seattle, aerial view; scenery." { RIFFINFO_IKEY, "Keywords" }, // ILGT - Describes the changes in the lightness settings on the digitizer // required to produce the file. Note that the format of this information // depends on the hardware used. { RIFFINFO_ILGT, "Lightness" }, // IMED - Decribes the original subject of the file, such as // "computer image," "drawing," "lithograph," and so on. { RIFFINFO_IMED, "Medium" }, // INAM - Stores the title of the subject of the file, such as // "Seattle from Above." { RIFFINFO_INAM, "Name" }, // IPLT - Specifies the number of colors requested when digitizing // an image, such as "256." { RIFFINFO_IPLT, "Palette Setting" }, // IPRD - Specifies the name of title the file was originally intended // for, such as "Encyclopedia of Pacific Northwest Geography." { RIFFINFO_IPRD, "Product" }, // ISBJ - Decsribes the contents of the file, such as // "Aerial view of Seattle." { RIFFINFO_ISBJ, "Subject" }, // ISFT - Identifies the name of the software packages used to create the // file, such as "Microsoft WaveEdit" { RIFFINFO_ISFT, "Software" }, // ISHP - Identifies the change in sharpness for the digitizer // required to produce the file (the format depends on the hardware used). { RIFFINFO_ISHP, "Sharpness" }, // ISRC - Identifies the name of the person or organization who // suplied the original subject of the file; for example, "Try Research." { RIFFINFO_ISRC, "Source" }, // ISRF - Identifies the original form of the material that was digitized, // such as "slide," "paper," "map," and so on. This is not necessarily // the same as IMED { RIFFINFO_ISRF, "Source Form" }, // ITCH - Identifies the technician who digitized the subject file; // for example, "Smith, John." { RIFFINFO_ITCH, "Technician" }, // ISMP { RIFFINFO_ISMP, "Time Code" }, // IDIT { RIFFINFO_IDIT, "Digitization Time" }, { 0, "" } }; static inline AVIMainHeader* avm_get_leAVIMainHeader(void* header) { AVIMainHeader* h = (AVIMainHeader*) header; h->dwMicroSecPerFrame = avm_get_le32(&h->dwMicroSecPerFrame); h->dwMaxBytesPerSec = avm_get_le32(&h->dwMaxBytesPerSec); h->dwPaddingGranularity = avm_get_le32(&h->dwPaddingGranularity); h->dwFlags = avm_get_le32(&h->dwFlags); h->dwTotalFrames = avm_get_le32(&h->dwTotalFrames); h->dwInitialFrames = avm_get_le32(&h->dwInitialFrames); h->dwStreams = avm_get_le32(&h->dwStreams); h->dwSuggestedBufferSize = avm_get_le32(&h->dwSuggestedBufferSize); h->dwWidth = avm_get_le32(&h->dwWidth); h->dwHeight = avm_get_le32(&h->dwHeight); h->dwScale = avm_get_le32(&h->dwScale); h->dwRate = avm_get_le32(&h->dwRate); h->dwStart = avm_get_le32(&h->dwStart); h->dwLength = avm_get_le32(&h->dwLength); return h; } static inline AVIStreamHeader* avm_get_leAVIStreamHeader(void* header) { AVIStreamHeader* h = (AVIStreamHeader*) header; h->fccType = avm_get_le32(&h->fccType); h->fccHandler = avm_get_le32(&h->fccHandler); h->dwFlags = avm_get_le32(&h->dwFlags); h->wPriority = avm_get_le16(&h->wPriority); h->wLanguage = avm_get_le16(&h->wLanguage); h->dwInitialFrames = avm_get_le32(&h->dwInitialFrames); h->dwScale = avm_get_le32(&h->dwScale); h->dwRate = avm_get_le32(&h->dwRate); h->dwStart = avm_get_le32(&h->dwStart); h->dwLength = avm_get_le32(&h->dwLength); h->dwSuggestedBufferSize = avm_get_le32(&h->dwSuggestedBufferSize); h->dwQuality = avm_get_le32(&h->dwQuality); h->dwSampleSize = avm_get_le32(&h->dwSampleSize); h->rcFrame.left = avm_get_le16(&h->rcFrame.left); h->rcFrame.right = avm_get_le16(&h->rcFrame.right); h->rcFrame.top = avm_get_le16(&h->rcFrame.top); h->rcFrame.bottom = avm_get_le16(&h->rcFrame.bottom); return h; } AviReadHandler::AviReadHandler(int flags) :m_iFlags(flags) { } int AviReadHandler::init(const char* pszFile) { if (m_Input.open(pszFile) < 0) { AVM_WRITE("AVI reader", "Stream: %s can't be opened!\n", pszFile); return -1; } if (m_Input.readDword() != FOURCC_RIFF) #ifndef USE_HACK return -1 #endif ; m_Input.readDword(); if (m_Input.readDword() != formtypeAVI) #ifndef USE_HACK return -1 #endif ; off_t movie_chunk = 0; uint_t type; off_t nextpos; size_t chunk_size; uint32_t chunk_type; bool index_chunk_found = false; bool valid_list = false; #ifdef USE_HACK AVIStreamHeader ash; ash.fccType = streamtypeVIDEO; BitmapInfo bih(640,360,24); bih.SetDirection(1); bih.biCompression = ('3'<<24) | ('V'<<16) | ('I' << 8) | 'D'; ash.fccHandler = bih.biCompression; if (AviReadStream* s = new AviReadStream(this, ash, 0, (char*)&bih, sizeof(bih))) m_Streams.push_back(s); #endif for (;;) { chunk_type = m_Input.readDword(); if (m_Input.eof()) break; if (!valid_list && chunk_type != FOURCC_LIST) continue; // search for next valid LIST header chunk_size = m_Input.readDword(); if (chunk_size < 0) continue; nextpos = m_Input.pos() + chunk_size + (chunk_size & 1); //printf("CHUNK %.4s %d pos:%lld %d\n", (char*)&chunk_type, chunk_size, m_Input.pos(), m_Input.eof()); switch(chunk_type) { case FOURCC_LIST: if (chunk_size < 4) { AVM_WRITE("AVI reader", "Damaged Avi with LIST chunk size %" PRIsz " detected...\n", chunk_size); continue; } valid_list = true; type = m_Input.readDword(); //printf("LISTTYPE %.4s %lld %d\n", (char*)&type, m_Input.pos(), m_Input.eof()); switch (type) { case listtypeAVIMOVIE: movie_chunk = m_Input.pos(); m_Input.seek(nextpos); // readMovieChunk(); //printf("MovieChunk %d\n", movie_chunk); break; case listtypeAVIHEADER: continue; case listtypeSTREAMHEADER: if (m_Input.readDword() == ckidSTREAMHEADER) readAVIStreamHeader(m_Input.readDword()); break; case listtypeINFO: readInfoChunk(chunk_size); break; } break; case ckidAVIMAINHDR: readAVIMainHeader(chunk_size); break; case ckidAVINEWINDEX: if (readIndexChunk(chunk_size, movie_chunk) == 0) index_chunk_found = true; break; }; m_Input.seek(nextpos); } if (m_Streams.size() == 0) { AVM_WRITE("AVI reader", "No playable stream found in this AVI file!\n"); return -1; } if (!index_chunk_found) reconstructIndexChunk(movie_chunk); for (size_t i = 0; i < m_Streams.size(); ++i) { m_Streams[i]->fixHeader(); char b[100]; short wFormatTag; if (m_Streams[i]->GetType() == IStream::Audio) { if(m_Streams[i]->m_pcFormat && (m_Streams[i]->m_uiFormatSize >= 2)) wFormatTag = ((WAVEFORMATEX*)(m_Streams[i]->m_pcFormat))->wFormatTag; else wFormatTag = (short)m_Streams[i]->m_Header.fccHandler; strncpy(b, avm_wave_format_name(wFormatTag), sizeof(b)); b[sizeof(b) - 1] = 0; } else { wFormatTag = (short)m_Streams[i]->m_Header.fccHandler; memcpy(b, &m_Streams[i]->m_Header.fccHandler, 4); b[4] = 0; } // clip the size of allocated vectors m_Streams[i]->m_Offsets.resize(m_Streams[i]->m_Offsets.size()); m_Streams[i]->m_Positions.resize(m_Streams[i]->m_Positions.size()); char fcctype[4]; avm_set_le32(fcctype, m_Streams[i]->m_Header.fccType); AVM_WRITE("AVI reader", "Stream %d %.4s : %s (0x%hx) %" PRIsz " chunks (%.2fKB)\n", (int)i, fcctype, b, wFormatTag, m_Streams[i]->m_Offsets.size(), (double)(m_Streams[i]->m_Offsets.size() * sizeof(uint32_t) + m_Streams[i]->m_Positions.size() * sizeof(uint32_t)) / 1024.); #if 0 AVM_WRITE("AVI reader", " Idx Offset Timestamp Flags\n"); AviReadStream* stream = m_Streams[i]; for (unsigned j = 0 ; j < stream->m_Offsets.size(); j++) AVM_WRITE("AVI reader", "%6d %10d %10d %d\n", j, stream->m_Offsets[j] & ~0x01, (j < stream->m_Positions.size()) ? stream->m_Positions[j] : (int)(j / stream->m_dFrameRate * 1000), stream->m_Offsets[j] & 0x01); #endif //hack interleaved format - iavs //if (m_Streams[i]->m_Header.fccType == mmioFOURCC('i', 'a', 'v', 's')) // m_Streams[i]->m_Header.fccType = streamtypeVIDEO; //m_Input.addStream(m_Streams[i]->m_iId, m_Streams[i]->m_Index); m_Input.addStream(m_Streams[i]->m_iId, m_Streams[i]->m_Offsets); } m_Input.async(); return 0; } AviReadHandler::~AviReadHandler() { m_Input.close(); for (size_t i = 0; i < m_Streams.size(); ++i) delete m_Streams[i]; } size_t AviReadHandler::GetHeader(void* pheader, size_t size) { if (pheader && (size >= sizeof(AVIMainHeader))) { memset(pheader, 0, size); *(AVIMainHeader*)pheader = m_MainHeader; } return sizeof(AVIMainHeader); } IMediaReadStream* AviReadHandler::GetStream(uint_t stream_id, IStream::StreamType type) { uint_t match = 0; avm::vector::iterator it; for (it = m_Streams.begin(); it != m_Streams.end(); ++it) if ((*it)->GetType() == type) { if (match == stream_id) return (*it); match++; } return 0; } size_t AviReadHandler::GetStreamCount(IStream::StreamType type) { size_t cnt = 0; avm::vector::const_iterator it; for (it = m_Streams.begin(); it != m_Streams.end(); ++it) if ((*it)->GetType() == type) cnt++; return cnt; } void AviReadHandler::readInfoChunk(size_t data_size) { size_t rs = 0; while (rs < data_size && !m_Input.eof()) { uint32_t type = m_Input.readDword(); size_t size = m_Input.readDword(); //printf("rs r:%" PRIsz " ds:%" PRIsz " t:%d s:%" PRIsz "\n", rs, data_size, type, size); if ((rs + size) < data_size) { size += (size & 1); char b[size + 10]; m_Input.read(b, size); for (const RiffInfoChunk* pr = infos; pr->riff; pr++) if (pr->riff == type) { AVM_WRITE("AVI reader", "InfoChunk %s: %s\n", pr->text, b); break; } } //printf("addd %" PRIsz " %" PRIsz "\n", rs, size); rs += size; } } void AviReadHandler::readAVIMainHeader(size_t data_size) { size_t read_size = sizeof(AVIMainHeader); data_size += (data_size & 1); if (read_size < data_size) { memset(&m_MainHeader, 0, read_size); AVM_WRITE("AVI reader", "WARNING: unexpected main header size\n"); } else read_size = data_size; m_Input.read(&m_MainHeader, read_size); avm_get_leAVIMainHeader(&m_MainHeader); PrintAVIMainHeader(&m_MainHeader); } void AviReadHandler::readAVIStreamHeader(size_t data_size) { AVIStreamHeader ash; size_t read_size = sizeof(ash); data_size += (data_size & 1); if (read_size < data_size) { memset(&ash, 0, read_size); AVM_WRITE("AVI reader", "WARNING: unexpected stream header size (%" PRIsz ")\n", data_size); } else read_size = data_size; m_Input.read(&ash, read_size); if (read_size < data_size) m_Input.seekCur(data_size - read_size); avm_get_leAVIStreamHeader(&ash); //if (m_Header.dwStart && m_Header.dwStart) // cout << "Calc starttime " << m_Header.dwStart * (m_Header.dwRate / (double)m_Header.dwStart) << endl; if (m_Input.readDword() != ckidSTREAMFORMAT) { AVM_WRITE("AVI Reader", "WARNING: StreamFormat not found, stream ignored\n"); return; //strf } data_size = m_Input.readDword(); size_t fsize = data_size; data_size += (data_size & 1); // align vector format(data_size); if (m_Input.read(format.begin(), data_size) < (ssize_t)data_size) { AVM_WRITE("AVI Reader", "WARNING: Can not read StreamFormat, stream ignored\n"); return; } if (ash.fccType == streamtypeVIDEO || ash.fccType == streamtypeIAVS) { const size_t bihs = sizeof(BITMAPINFOHEADER); if (data_size < bihs) { format.resize(bihs); memset(&format[data_size], 0, bihs - data_size); fsize = data_size = bihs; } BITMAPINFOHEADER* bih = avm_get_leBITMAPINFOHEADER(format.begin()); //AVM_WRITE("AVI reader", "format %x %.4s %d\n", // s.m_Header.fccHandler, (char*)&s.m_Header.fccHandler, data_size); if (bih->biCompression != ash.fccHandler) { AVM_WRITE("AVI Reader", "Info: fccHandler differs from biCompression!\n"); ash.fccHandler = bih->biCompression; } ash.dwSampleSize = 0; } else if (ash.fccType == streamtypeAUDIO) { size_t wfs = sizeof(WAVEFORMATEX) + ((WAVEFORMATEX*)format.begin())->cbSize; if (data_size < wfs) { format.resize(wfs); memset(&format[data_size], 0, wfs - data_size); fsize = data_size = wfs; } avm_get_leWAVEFORMATEX(format.begin()); if (!ash.dwSampleSize && ash.dwLength > 800000) { // ((*(ashort*)s.m_pcFormat == WAVE_FORMAT_MPEGLAYER3) // only if we have a lot of chunks // if the stream would be VBR then ther would be far // less chunks AVM_WRITE("AVI reader", "WARNING: setting SampleSize=1 (Length was %d)\n", ash.dwLength); ash.dwSampleSize = 1; } } PrintAVIStreamHeader(&ash); m_Streams.push_back(new AviReadStream(this, ash, (uint_t)m_Streams.size(), format.begin(), fsize)); } int AviReadHandler::readIndexChunk(size_t index_size, off_t movie_chunk_offset) { bool zero_based_offsets = false; AVM_WRITE("AVI reader", "Reading index from offset: %" PRId64 "\n", m_Input.pos()); for (size_t ip = 0; ip <= (index_size/sizeof(AVIIndexEntry)) && !m_Input.eof(); ip++) { uint_t ckid = m_Input.readDword(); uint_t cflags = m_Input.readDword(); off_t coffset = m_Input.readDword(); uint32_t clen = m_Input.readDword(); uint_t id = StreamFromFOURCC(ckid); if (id >= m_Streams.size()) continue; AviReadStream* stream = m_Streams[id]; //printf ("Id %u off: %u len:%u\n", ip, entry.dwChunkOffset, entry.dwChunkLength); if (clen > StreamPacket::MAX_PACKET_SIZE) { AVM_WRITE("AVI reader", "WARNING: invalid index entry %" PRIsz " -- id: %u " "offset: %" PRId64 " size: %ud (pos: %" PRId64 ")\n", ip, ckid, (int64_t)coffset, clen, (int64_t)m_Input.pos()); return reconstructIndexChunk(stream->m_Offsets.back() & ~1); } if (coffset < movie_chunk_offset) zero_based_offsets = true; if (zero_based_offsets) coffset += movie_chunk_offset - 4; stream->addChunk(coffset, clen, cflags & AVIIF_KEYFRAME); } //AVM_WRITE("AVI reader", "Avi Index entries: %d\n", m_Streams[0].m_Index.size()); //kprof_reset_stats(); return 0; } int AviReadHandler::reconstructIndexChunk(off_t offset) { m_Input.seek(offset); int64_t positions[m_Streams.size()]; int isdivx[m_Streams.size()]; AVM_WRITE("AVI reader", "Reconstructing index from offset: %" PRId64 " s=%" PRIsz "\n", (int64_t)offset, m_Streams.size()); // fixing KeyFrames for DivX movies by checking flag bit for (size_t i = 0; i < m_Streams.size(); ++i) { isdivx[i] = 0; if (m_Streams[i]->GetType() == IStream::Video) switch (m_Streams[i]->m_Header.fccHandler) { case fccDIV3: case fccdiv3: case fccDIV4: case fccdiv4: case fccDIV5: case fccdiv5: case fccDIV6: case fccdiv6: case fccMP43: case fccmp43: case fccMP42: case fccmp42: case fccAP41: isdivx[i] = 1; break; case fccDX50: case fccdx50: case fccDIVX: case fccdivx: case fccDIV1: case fccdiv1: case fccMP4S: case fccmp4s: case fccXVID: case 0x4: isdivx[i] = 2; break; case fccWMV1: case fccwmv1: isdivx[i] = 3; break; } } // set when trying to reconstruct even very broken .avi files bool seriously_broken = false; while (!m_Input.eof()) { off_t coffset = m_Input.pos(); uint_t ckid = m_Input.readDword(); if (ckid == ckidAVINEWINDEX) break; //if (!ckid) continue; uint_t id = StreamFromFOURCC(ckid); //uint_t ckidt = TWOCCFromFOURCC(ckid); //printf("pos: %llu %u %u %x %d\n", m_Input.pos(), id, m_Streams.size(), ckid, seriouslyBroken); if (id >= m_Streams.size()) { //printf("index type id:%d ss:%d 0x%x 0x%x ckid:0x%x\n", id, m_Streams.size(), (ckid & 0xffff), cktypeINDEX, ckid); if ((ckid & 0xffff) == cktypeINDEX) { // skip indexes size_t size = m_Input.readDword(); //printf("SKEEEEEP %u\n", size); if (size < ((seriously_broken) ? MAX_CHUNK_SIZE : 0xfffffffU)) m_Input.seekCur(size); continue; } if (ckid && !m_Input.eof()) m_Input.seekCur(-2); if (!seriously_broken) { AVM_WRITE("AVI reader", "Trying to reconstruct broken avi stream (could take a lot of time)\n"); seriously_broken = true; } continue; } size_t clen = m_Input.readDword(); if (clen > ((seriously_broken) ? MAX_CHUNK_SIZE : 0xfffffffU)) continue; size_t size = clen + (clen & 1); // round bool keyframe = (size > 0); if (isdivx[id] && (size > 4)) { uint_t a = m_Input.readDword(); size -= 4; switch (isdivx[id]) { case 1: if (a & 0x40) keyframe = false; break; case 2: // DivX4 keyframe detection //AVM_WRITE("AVI reader", "Dword 0x%x\n", a); if (a == 0xb6010000 || a == 0xb0010000) { // looks like new DivX4/5 frame int b = m_Input.readByte(); size--; keyframe = ((b & 0xc0) == 0); // 0x00 Key frame, 0x40 P-frame //printf("Byte 0x%x %d", b, b); // for b001 it gives false keyframes - // parser from ffmpeg will be needed // to do a better job :(... } //else if (a == 0xb0010000) // old OpenDivX // keyframe = true; else if (a != 0x00010000) // old OpenDivX keyframe = false; break; case 3: if (!(a & 0x1)) keyframe = false; //printf("keyframe %d %d\n", keyframe, size); break; } } //printf("SEEK %d\n", size); if (m_Input.seekCur(size) > ssize_t(coffset + size)) // do not insert incomplete chunks m_Streams[id]->addChunk(coffset, clen, keyframe); } return 0; } #if 0 AviStreamPacket* AviReadHandler::readPacket(bool fill) { int ckid = m_Input.readDword(); uint_t id = StreamFromFOURCC(ckid); uint_t ckidt = TWOCCFromFOURCC(ckid); int len = m_Input.readDword(); if (fill) { } return 0; } #endif void AviReadHandler::PrintAVIMainHeader(const AVIMainHeader* h) { char buffer[200]; AVM_WRITE("AVI reader", "MainHeader: MicroSecPerFrame=%d MaxBytesPerSec=%d\n" " PaddingGranularity=%d Flags=[%s] TotalFrames=%d\n" " InitialFrames=%d Streams=%d SuggestedBufferSize=%d WxH=%dx%d\n" " Scale=%d Rate=%d Start=%d Length=%d\n", h->dwMicroSecPerFrame, h->dwMaxBytesPerSec, h->dwPaddingGranularity, GetAviFlags(buffer, h->dwFlags), h->dwTotalFrames, h->dwInitialFrames, h->dwStreams, h->dwSuggestedBufferSize, h->dwWidth, h->dwHeight, h->dwScale, h->dwRate, h->dwStart, h->dwLength); } void AviReadHandler::PrintAVIStreamHeader(const AVIStreamHeader* h) { char buffer[200]; char sb[20]; if (h->fccType == streamtypeVIDEO || h->fccType == streamtypeIAVS) { avm_set_le32(sb, h->fccHandler); sb[4] = 0; } else sprintf(sb, "0x%x", h->fccHandler); char ft[4]; AVM_WRITE("AVI reader", "StreamHeader: Type=%.4s Handler=%s Flags=[%s]\n" " InitialFrames=%d Scale=%d Rate=%d Start=%d Length=%d\n" " SuggestedBufferSize=%d Quality=%d SampleSize=%d" " Rect l,r,t,b=%d,%d,%d,%d\n", avm_set_le32(ft, h->fccType), sb, GetAviFlags(buffer, h->dwFlags), h->dwInitialFrames, h->dwScale, h->dwRate, h->dwStart, h->dwLength, h->dwSuggestedBufferSize, h->dwQuality, h->dwSampleSize, h->rcFrame.left, h->rcFrame.right, h->rcFrame.top, h->rcFrame.bottom); } char* AviReadHandler::GetAviFlags(char* buffer, int flags) { sprintf(buffer, "%s%s%s%s%s%s ", (flags & AVIF_HASINDEX) ? " HAS_INDEX" : "", (flags & AVIF_MUSTUSEINDEX) ? " MUST_USE_INDEX" : "", (flags & AVIF_ISINTERLEAVED) ? " IS_INTERLEAVED" : "", (flags & AVIF_TRUSTCKTYPE) ? " TRUST_CKTYPE" : "", (flags & AVIF_COPYRIGHTED) ? " COPYRIGHTED" : "", (flags & AVIF_WASCAPTUREFILE) ? " WAS_CAPTURED_FILE" : "" ); return buffer; } IMediaReadHandler* CreateAviReadHandler(const char *pszFile, int flags) { AviReadHandler* r = new AviReadHandler(flags); if (r && r->init(pszFile) == 0) return r; delete r; return 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviread/AviReadHandler.h0000644000175000017500000000326311176342154021114 0ustar yavoryavor#ifndef AVIREADHANDLER_H #define AVIREADHANDLER_H #include "Cache.h" #include "ReadHandlers.h" AVM_BEGIN_NAMESPACE; class AviReadStream; class AviStreamPacket : public StreamPacket { public: int64_t offset; uint_t id; AviStreamPacket(uint_t off = 0, uint_t i = 0, size_t bsize = 0) : StreamPacket(bsize), offset(off), id(i) {} }; class AviReadHandler : public IMediaReadHandler { friend class AviReadStream; static const size_t MAX_CHUNK_SIZE = 10000000; public: AviReadHandler(int flags = 0); virtual ~AviReadHandler(); virtual size_t GetHeader(void* pheader, size_t size); virtual IMediaReadStream* GetStream(uint_t stream_id, IStream::StreamType type); virtual size_t GetStreamCount(IStream::StreamType type); virtual bool GetURLs(avm::vector& urls) { return false; } virtual void Interrupt() {} /* avi files are opened synchronously */ virtual bool IsOpened() { return true; } virtual bool IsValid() { return true; } virtual bool IsRedirector() { return false; } int init(const char* pszFile); static void PrintAVIMainHeader(const AVIMainHeader* hdr); static void PrintAVIStreamHeader(const AVIStreamHeader* hdr); static char* GetAviFlags(char* buffer, int flags); protected: void readAVIMainHeader(size_t); void readAVIStreamHeader(size_t); void readInfoChunk(size_t); int readIndexChunk(size_t, off_t movie_chunk_offset); //AviStreamPacket* readPacket(bool fill = true); int reconstructIndexChunk(off_t); AVIMainHeader m_MainHeader; avm::vector m_Streams; InputStream m_Input; int m_iFlags; }; AVM_END_NAMESPACE; #endif // AVIREADHANDLER_H avifile-0.7.48~20090503.ds/lib/aviread/AviReadStream.cpp0000644000175000017500000002642011176642755021337 0ustar yavoryavor#include "AviReadStream.h" #include "AviReadHandler.h" #include "formats.h" #include "avm_output.h" #include "avm_cpuinfo.h" #include "utils.h" #include #include AVM_BEGIN_NAMESPACE; AviReadStream::AviReadStream(AviReadHandler* handler, const AVIStreamHeader& hdr, uint_t id, const void* format, size_t fsize) :m_pHandler(handler), m_iId(id), m_uiChunk(0), m_uiPosition(0), m_Header(hdr), m_uiFormatSize(fsize), m_uiStart(0), m_uiStreamSize(0), m_uiAlignedSize(0), m_uiKeyChunks(0), m_uiKeySize(0), m_uiKeyMaxSize(0), m_uiKeyMinSize(~0U), m_uiDeltaSize(0), m_uiDeltaMaxSize(0), m_uiDeltaMinSize(~0U) { if ((m_pcFormat = new char[m_uiFormatSize])) memcpy(m_pcFormat, format, m_uiFormatSize); if (GetType() == IStream::Audio && m_Header.dwSampleSize) { m_dFrameRate = m_WAVEFORMATEX->nAvgBytesPerSec / m_Header.dwSampleSize; m_Positions.reserve(16384); m_Positions.push_back(0); } else { m_dFrameRate = (m_Header.dwScale) ? m_Header.dwRate / (double) m_Header.dwScale : 1.; if (GetType() == IStream::Audio) { // VBR audio has dwSampleSize == 0 // use tranlation table for time - see note in addChunk(). m_Positions.reserve(16384); m_Positions.push_back(0); if (m_WAVEFORMATEX->nBlockAlign < 32) AVM_WRITE("AVI reader", "WARNING: WaveFormat::BlockAlign=%d is too small for VBR audio stream!\n", m_WAVEFORMATEX->nBlockAlign); } } m_Offsets.reserve(16384); } AviReadStream::~AviReadStream() { delete[] m_pcFormat; } double AviReadStream::CacheSize() const { return m_pHandler->m_Input.cacheSize(); } void AviReadStream::ClearCache() { m_pHandler->m_Input.clear(); } size_t AviReadStream::GetHeader(void* header, size_t size) const { if (header && size >= sizeof(m_Header)) { memset(header, 0, size); memcpy(header, &m_Header, sizeof(m_Header)); } return sizeof(m_Header); } size_t AviReadStream::GetFormat(void *format, size_t size) const { if (format) memcpy(format, m_pcFormat, (size < m_uiFormatSize) ? size : m_uiFormatSize); return m_uiFormatSize; } framepos_t AviReadStream::GetLength() const { return m_Header.dwStart + m_Header.dwLength; } double AviReadStream::GetLengthTime() const { return GetTime(GetLength()); } framepos_t AviReadStream::GetNearestKeyFrame(framepos_t pos) const { pos = getFramePos(pos); framepos_t rpos = m_Header.dwStart + pos; if (m_Header.dwSampleSize || (pos < m_Offsets.size() && (m_Offsets[pos] & 1))) return rpos; // already keyframe framepos_t prev = GetPrevKeyFrame(rpos); framepos_t next = GetNextKeyFrame(rpos); return ((rpos - prev) < (next - rpos)) ? prev : next; } framepos_t AviReadStream::GetNextKeyFrame(framepos_t pos) const { //printf("GETNEXT %d %d %d\n", m_iId, pos, m_uiPosition); pos = getFramePos(pos); if (m_Header.dwSampleSize == 0) { do { if (pos >= m_Offsets.size()) return ERR; } while (!(m_Offsets[pos] & 1) && ++pos); } //printf("GETNEXT return %d\n", pos + m_Header.dwStart); return m_Header.dwStart + pos; } framepos_t AviReadStream::GetPrevKeyFrame(framepos_t pos) const { //printf("GETPREV %d %d %d\n", m_iId, pos, m_uiPosition); pos = getFramePos(pos); if (pos > 0) pos--; // go at least one frame back if (m_Header.dwSampleSize == 0) { if (pos >= m_Offsets.size()) pos = (framepos_t)m_Offsets.size() - 1; while (pos > 0 && !(m_Offsets[--pos] & 1)) ; } //printf("GETPREV return %d\n", pos + m_Header.dwStart); return m_Header.dwStart + pos; } StreamInfo* AviReadStream::GetStreamInfo() const { if (m_StreamInfo.m_p->m_dLengthTime == 0.) { m_StreamInfo.m_p->setKfFrames(m_uiKeyMaxSize, (m_uiKeyMinSize > m_uiKeyMaxSize) ? m_uiKeyMaxSize : m_uiKeyMinSize, m_uiKeyChunks, m_uiKeySize); m_StreamInfo.m_p->setFrames(m_uiDeltaMaxSize, (m_uiDeltaMinSize > m_uiDeltaMaxSize) // usually no delta frames ? m_uiDeltaMaxSize : m_uiDeltaMinSize, (uint_t)(m_Offsets.size() - m_uiKeyChunks), m_uiStreamSize - m_uiKeySize); m_StreamInfo.m_p->m_dLengthTime = GetLengthTime(); m_StreamInfo.m_p->m_iQuality = m_Header.dwQuality; m_StreamInfo.m_p->m_iSampleSize = m_Header.dwSampleSize; if (m_pcFormat) switch (GetType()) { case IStream::Video: m_StreamInfo.m_p->m_Type = StreamInfo::Video; m_StreamInfo.m_p->m_uiFormat = m_BITMAPINFOHEADER->biCompression; m_StreamInfo.m_p->setVideo(m_BITMAPINFOHEADER->biWidth, m_BITMAPINFOHEADER->biHeight); break; case IStream::Audio: m_StreamInfo.m_p->m_Type = StreamInfo::Audio; m_StreamInfo.m_p->m_uiFormat = m_WAVEFORMATEX->wFormatTag; m_StreamInfo.m_p->setAudio(m_WAVEFORMATEX->nChannels, m_WAVEFORMATEX->nSamplesPerSec, m_WAVEFORMATEX->wBitsPerSample); break; default: ; // FIXME } } return new StreamInfo(m_StreamInfo); } double AviReadStream::GetTime(framepos_t pos) const { pos = getFramePos(pos); if (m_Header.dwSampleSize || !m_Positions.size()) { pos += m_Header.dwStart; framepos_t l = GetLength(); if (pos > l) pos = l; } else pos = m_Header.dwStart + ((pos < m_Positions.size()) ? m_Positions[pos] : m_Positions.back()); //printf("AviGetTime: %d %f (%f, %d, %.4s s: %d/%" PRIsz ") ss:%d\n", // pos, pos / m_dFrameRate, m_dFrameRate, m_Header.dwStart, // (const char*)&m_Header.fccType, m_uiPosition, m_Positions.size(), m_Header.dwSampleSize); return pos / m_dFrameRate; } IStream::StreamType AviReadStream::GetType() const { switch (m_Header.fccType) { case streamtypeAUDIO: return IStream::Audio; case streamtypeIAVS: case streamtypeVIDEO: return IStream::Video; default: return IStream::Other; } } bool AviReadStream::IsKeyFrame(framepos_t pos) const { if (m_Header.dwSampleSize || pos < m_Header.dwStart) return true; //audio pos = getFramePos(pos); return (pos < m_Offsets.size()) ? m_Offsets[pos] & 1 : true; } StreamPacket* AviReadStream::ReadPacket() { StreamPacket* p = m_pHandler->m_Input.readPacket(m_iId, m_uiChunk); //printf("ReadPacket: %p id:%d chunk:%d pos:%d %f ss:%d\n", p, m_iId, m_uiChunk, m_uiPosition, GetTime(), m_Header.dwSampleSize); if (p) { p->SetPos(m_uiPosition); p->SetTime(GetTime(m_uiPosition)); //if (m_Header.dwSampleSize) printf("readpacketpos %d %d id:%d %lld %p pos:%lld\n", m_uiPosition, p->size, m_iId, p->timestamp, p, m_pHandler->m_Input.pos()); m_uiChunk++; m_uiPosition = m_Header.dwStart; if (m_Header.dwSampleSize) m_uiPosition += (m_uiChunk < m_Positions.size()) ? m_Positions[m_uiChunk] : m_Positions.back(); else m_uiPosition += m_uiChunk; //printf("SETNEW RP %d/%d ck:%d/%d ss:%d ts: %" PRId64 "\n", m_uiPosition, p->position, m_uiChunk, (int)m_Positions.size(), m_Header.dwSampleSize, p->timestamp); } return p; } int AviReadStream::Seek(framepos_t framepos) { if ((m_uiChunk = find(framepos)) == ERR) m_uiPosition = m_uiChunk = 0; else m_uiPosition = m_Header.dwStart + ((m_Header.dwSampleSize) ? m_Positions[m_uiChunk] : m_uiChunk); AVM_WRITE("AVI reader", 3, "AviReadStream::Seek(%u) -> %d (%d)\n", framepos, m_uiChunk, m_iId); return 0; } int AviReadStream::SeekTime(double timepos) { AVM_WRITE("AVI reader", 3, "AviReadStream::SeekTime(%f)\n", timepos); return Seek((framepos_t)(timepos * m_dFrameRate)); } // takes normal pos // returns chunk or pos without dwStart! framepos_t AviReadStream::find(framepos_t pos) const { if (pos < m_Header.dwStart) return ERR; framepos_t len = GetLength(); //printf("FIND %d %d %d\n", pos, len, (int)m_Positions.size()); if (pos > len) pos = len; pos -= m_Header.dwStart; // when we don't have translation table -> position is found if (!m_Positions.size()) return pos; framepos_t low_limit = 0; framepos_t high_limit = (framepos_t)m_Positions.size() - 1; while (low_limit < high_limit) { // http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html framepos_t middle = low_limit + (high_limit - low_limit) / 2; if (pos >= m_Positions[middle]) { // this fix is necessary to avoid deadlock if (middle == low_limit) break; low_limit = middle; if (pos < m_Positions[middle + 1]) break; } else high_limit = middle; } //printf("FOUNDPOS %d %d \n", low_limit, m_Positions[low_limit]); return low_limit; } void AviReadStream::addChunk(off_t coffset, size_t clen, bool iskf) { if (iskf) { m_uiKeyChunks++; m_uiKeySize += clen; if (clen > m_uiKeyMaxSize) m_uiKeyMaxSize = clen; if (clen < m_uiKeyMinSize) m_uiKeyMinSize = clen; // AVI chunks begins on 'even' stream position // so use this the lowest bit as the keyframe flag // saving space coffset |= 1; } else { m_uiDeltaSize += clen; if (clen > m_uiDeltaMaxSize) m_uiDeltaMaxSize = clen; if (clen < m_uiDeltaMinSize) m_uiDeltaMinSize = clen; } m_uiStreamSize += clen; m_Offsets.push_back((uint32_t)coffset); if (m_Header.dwSampleSize) { // position in bytes for chunk stream is not need, it is always 1 // - so use them only for wave audio frame position m_Positions.push_back((framepos_t)(m_uiStreamSize / m_Header.dwSampleSize)); } else if (GetType() == IStream::Audio && m_Header.dwScale) { // VBR audio magic - we have to recalculate chunk position // if the chunk is bigger then nBlockAlign - it represents // more then one chunk in that case - rounding applies here! // http://www.virtualdub.org/blog/pivot/entry.php?id=27 // mencoder produces nonstandard VBR files with nBlockAlign == 1 // probably take it as one block per VBR audio chunk framepos_t balign = m_WAVEFORMATEX->nBlockAlign; m_uiAlignedSize += (balign < 32) ? 1 : (framepos_t)(clen + balign - 1) / balign; m_Positions.push_back(m_uiAlignedSize); } #if 0 if (m_iId > 0) printf("Id:%d/%5d offset:%10d sp:%10d len:%6d p:%5d (%d) -> %.3f\n", m_iId, (int)m_Offsets.size(), (int)coffset & ~1U, (int)m_uiStreamSize, (int)clen, (int)m_Positions.back(), (int)m_Positions.size(), m_Positions.back() * m_Header.dwScale / (double)m_Header.dwRate); else printf("Id:%d/%5d offset:%10d sp:%10d len:%6d p:%5d -> %.3f\n", m_iId, (int)m_Offsets.size(), (int)coffset & ~1U, (int)m_uiStreamSize, (int)clen, (int)m_Offsets.size(), (double)m_Offsets.size() * m_Header.dwScale / (double)m_Header.dwRate); #endif } void AviReadStream::fixHeader() { uint32_t n = (m_Header.dwSampleSize) ? (uint32_t)(m_uiStreamSize / m_Header.dwSampleSize) : (uint32_t)m_Offsets.size(); if (n != m_Header.dwLength) { AVM_WRITE("AVI reader", "WARNING: stream header has incorrect dwLength (%d -> %d)\n", m_Header.dwLength, n); m_Header.dwLength = n; } } int AviReadStream::FixAvgBytes(uint_t bps) { if (bps > 8000) { m_dFrameRate = bps; return 0; } // ok some broken files with vbr stream and nonvbr headers // are weird and we can't easily recognize them - they usually // have 32kbps blocks at the beginning // also this is hack to make playable several broken // sample files I have, thus it might fail for others... return -1; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviread/AviReadStream.h0000644000175000017500000000523711174145444020776 0ustar yavoryavor#ifndef AVIREADSTREAM_H #define AVIREADSTREAM_H #include "Cache.h" #include "ReadHandlers.h" AVM_BEGIN_NAMESPACE; class AviReadHandler; class AviReadStream : public IMediaReadStream { friend class AviReadHandler; public: AviReadStream(AviReadHandler* handler, const AVIStreamHeader& hdr, uint_t id, const void* format, size_t fsize); virtual ~AviReadStream(); virtual double CacheSize() const; virtual void ClearCache(); virtual size_t GetFormat(void *format = 0, size_t size = 0) const; virtual double GetFrameTime() const { return 1. / m_dFrameRate; } virtual size_t GetHeader(void* header, size_t size) const; virtual framepos_t GetLength() const; virtual double GetLengthTime() const; virtual bool IsKeyFrame(framepos_t frame = ERR) const; virtual framepos_t GetNextKeyFrame(framepos_t frame = ERR) const; virtual framepos_t GetNearestKeyFrame(framepos_t frame = ERR) const; virtual framepos_t GetPrevKeyFrame(framepos_t frame = ERR) const; virtual size_t GetSampleSize() const { return m_Header.dwSampleSize; } virtual StreamInfo* GetStreamInfo() const; virtual double GetTime(framepos_t frame = ERR) const; virtual IStream::StreamType GetType() const; virtual StreamPacket* ReadPacket(); virtual int Seek(framepos_t pos); virtual int SeekTime(double time); virtual int SkipFrame() { return Seek(m_uiPosition + 1); } virtual int SkipTo(double pos) { return SeekTime(pos); } virtual int FixAvgBytes(uint_t bps); void fixHeader(); protected: framepos_t find(framepos_t frame) const; framepos_t getFramePos(framepos_t frame) const { if (frame == ERR) frame = m_uiPosition; return (frame <= m_Header.dwStart) ? 0 : frame - m_Header.dwStart; } void addChunk(off_t off, size_t len, bool iskf); AviReadHandler* m_pHandler; mutable StreamInfo m_StreamInfo; uint_t m_iId; framepos_t m_uiChunk; framepos_t m_uiPosition; AVIStreamHeader m_Header; union { char* m_pcFormat; WAVEFORMATEX* m_WAVEFORMATEX; BITMAPINFOHEADER* m_BITMAPINFOHEADER; }; size_t m_uiFormatSize; double m_dFrameRate; uint_t m_uiStart; framepos_t m_uiLength; double m_dLengthTime; // chunk data for Avi Index avm::vector m_Offsets; avm::vector m_Positions; // needed for audio streams size_t m_uiStreamSize; framepos_t m_uiAlignedSize; uint_t m_uiKeyChunks; size_t m_uiKeySize; size_t m_uiKeyMaxSize; size_t m_uiKeyMinSize; // delta chunks m_Offsets - m_uiKeyChunks size_t m_uiDeltaSize; size_t m_uiDeltaMaxSize; size_t m_uiDeltaMinSize; }; AVM_END_NAMESPACE; #endif // AVIREADSTREAM_H avifile-0.7.48~20090503.ds/lib/aviread/Cache.cpp0000644000175000017500000003623511176642755017660 0ustar yavoryavor#include "Cache.h" #include "avm_cpuinfo.h" #include "avm_output.h" #include "utils.h" #include #include #include #include #include #include #include // limit the maximum size of each prefetched stream in bytes #define STREAM_SIZE_LIMIT 3000000 #ifndef O_LARGEFILE #define O_LARGEFILE 0 #endif // Isn't this bug in NetBSD configuration - it should not have HAVE_LSEEK64 #ifdef __NetBSD__ #define lseek64 lseek #else #ifndef HAVE_LSEEK64 #define lseek64 lseek #endif #endif // uncomment if you do not want to use threads for precaching //#define NOTHREADS // do not commit with this define AVM_BEGIN_NAMESPACE; #define __MODULE__ "StreamCache" //static float ttt = 0; //static float ttt1 = 0; Cache::Cache(size_t size) :m_uiSize(size), thread(0), m_pPacket(0), m_iFd(-1), m_uiId(0), cache_access(0), cache_right(0), cache_miss(0), m_bQuit(false), #ifndef NOTHREADS m_bThreaded(true) // standard operation mode #else m_bThreaded(false) // for debugging purpose only - never commit #endif { } Cache::~Cache() { mutex.Lock(); m_bQuit = true; cond.Broadcast(); mutex.Unlock(); delete thread; clear(); //printf("Cache Access:%d Missed:%d Right:%d\n", cache_access, cache_miss, cache_right); if (cache_access != 0) AVM_WRITE(__MODULE__, "Destroy... (Total accesses %d, hits %.2f%%, misses %.2f%%, errors %.2f%%)\n", cache_access, 100. * double(cache_right - cache_miss) / cache_access, 100. * double(cache_miss) / cache_access, 100. * double(cache_access - cache_right) / cache_access); //printf("TTTT %f %f\n", ttt, ttt1); } int Cache::addStream(uint_t id, const avm::vector& table) { AVM_WRITE(__MODULE__, 3, "Adding stream, %" PRIsz " chunks\n", table.size()); Locker locker(mutex); m_streams.push_back(StreamEntry(&table, 0, m_uiSize)); cond.Broadcast(); return 0; } // starts caching thread once we know file descriptor int Cache::create(int fd) { m_iFd = fd; AVM_WRITE(__MODULE__, 1, "Creating cache for file descriptor: %d\n", m_iFd); if (m_streams.size() > 0) { if (m_bThreaded) { Locker locker(mutex); thread = new PthreadTask(0, &startThreadfunc, this); if (!thread) return -1; cond.Wait(mutex); } } else AVM_WRITE(__MODULE__, "WARNING: No stream for caching!\n"); return 0; } // return true if this stream should be waken and read new data inline bool Cache::isCachable(const StreamEntry& stream, uint_t id) const { // trick to allow precaching even very large image sizes //printf("ISCHACHE f:%d s:%d sum:%d l: %d ll: %d\n", stream.packets.full(), stream.packets.size(), stream.sum, stream.last, stream.table->size()); return ((stream.sum < STREAM_SIZE_LIMIT // assuming id=0 is video stream // uncompressed video could be really huge! //|| ((id == 0) && stream.packets.size() < 3) ) && stream.last < stream.table->size() && !stream.packets.full() && (stream.filling || (stream.sum < STREAM_SIZE_LIMIT/2 && stream.packets.size() < m_uiSize/2))); } // // currently preffered picking alghorithm // // seems to be having good seek strategy uint_t Cache::pickChunk() { uint_t id = m_uiId; do { StreamEntry& se = m_streams[id]; // determine next needed chunk in this stream se.last = (se.packets.empty()) ? se.position : se.packets.back()->GetPos() + 1; //printf("Pick sid:%d pos:%d wants:%d size:%d\n", id, se.last, se.position, se.packets.size()); if (isCachable(se, id)) return id; // try next stream if (++id >= m_streams.size()) id = 0; // wrap around } while (id != m_uiId); return WAIT; // nothing for caching found } // caching thread void* Cache::threadfunc() { size_t r = 0; mutex.Lock(); while (!m_bQuit) { m_uiId = pickChunk(); cond.Broadcast(); // allow waiting tasks to use cache during read or Wait() if (m_uiId == WAIT) { m_uiId = 0; // one could be trying to send signal to this thread //AVM_WRITE(__MODULE__, 4, "full packets - waiting for read: s#1: %d s#2: %d\n", // m_streams[0].packets.size(), m_streams[1].packets.size()); cond.Wait(mutex); //AVM_WRITE(__MODULE__, 4, "full packets - waiting done\n"); continue; } StreamEntry& stream = m_streams[m_uiId]; #if 0 if (stream.packets.size() > 0) { if (r > 20000) { r = 0; // don't stress hardrive too much //printf("sleep %d\n", stream.packets.size()); //cond.Wait(mutex, 0.05); continue; // recheck if the same chunk is still needed } } #endif //printf("read %d l:%d p:%d s:%d\n", m_uiId, stream.last, stream.position, stream.packets.size()); uint_t coffset = (*stream.table)[stream.last]; char bfr[8]; //ttt1 += avm_get_time_diff(avm_get_time_us(), sss); //cond.Broadcast(); mutex.Unlock(); //int64_t sss = avm_get_time_us(); if (lseek64(m_iFd, coffset & ~1, SEEK_SET) == -1 || ::read(m_iFd, bfr, 8) != 8) { AVM_WRITE(__MODULE__, "WARNING: Offset %d unreachable! %s\n", coffset & ~1, strerror(errno)); mutex.Lock(); stream.error = stream.last; cond.Broadcast(); cond.Wait(mutex); continue; } uint_t ckid = avm_get_le32(bfr); uint_t clen = avm_get_le32(bfr + 4); //printf("READ - pos %d ckid:0x%x %d of:0x%x\n", stream.last, ckid, clen, coffset); // get free buffer if (clen > StreamPacket::MAX_PACKET_SIZE) { // this is wrong and should be replaced by a better code AVM_WRITE(__MODULE__, "WARNING: Too large chunk %d\n", clen); clen = 10000; } if ((m_pPacket = new StreamPacket(clen))) { m_pPacket->SetPos(stream.last); //AVM_WRITE(__MODULE__, 4, "id: %d %d buffered: %d sum: %d - %d\n", // m_uiId, stream.last, (stream.last - stream.position), // m_streams[0].sum, m_streams[1].sum); // cache might be read while this chunk is being filled size_t rs = 0; while (rs < m_pPacket->GetSize()) { ssize_t rd = ::read(m_iFd, m_pPacket->GetData() + rs, m_pPacket->GetSize() - rs); //printf("READ %d %d of %d\n", rd, rs, m_pPacket->size); if (rd <= 0) { if (stream.error == stream.OK) AVM_WRITE(__MODULE__, "WARNING: Offset %d short read (%" PRIsz " < %" PRIsz ")! %s\n", coffset, rs, m_pPacket->GetSize(), (rd < 0) ? strerror(errno) : ""); break; } rs += rd; } r += rs; mutex.Lock(); //printf("readsize %d %d\n", (int)rs, (int)m_pPacket->size); //printf("memch: "); for (int i = 0; i < m_pPacket->size && i < 20; i++) printf(" 0x%02x", m_pPacket->memory[i]); printf("\n"); // check if we still want same buffer if (rs != m_pPacket->GetSize()) { stream.error = stream.last; m_pPacket->Release(); m_pPacket = 0; cond.Broadcast(); cond.Wait(mutex); continue; } //printf("Stream sum %d %d %d\n", stream.sum, stream.last, stream.position); if (stream.packets.empty() && stream.position != stream.last) { //printf("CH****************************** %d %d\n", stream.position, stream.last); m_pPacket->Release(); m_pPacket = 0; continue; } m_pPacket->SetFlags((coffset & 1) ? AVIIF_KEYFRAME : 0); stream.error = stream.OK; //uint_t sum = 0; for (uint_t i = 0 ; i < m_pPacket->size; i++) sum += ((unsigned char*) m_pPacket->memory)[i]; printf("PACKETSUM %d pos: %d size: %d\n", sum, m_pPacket->position, m_pPacket->size); stream.sum += rs; stream.filling = !(stream.sum > STREAM_SIZE_LIMIT); stream.packets.push(m_pPacket); //AVM_WRITE(__MODULE__, 4, // "--- id: %d pos: %d sum: %d size: %d filling: %d\n", // m_uiId, m_pPacket->position, stream.sum, m_pPacket->size, stream.filling); m_pPacket = 0; } } mutex.Unlock(); return 0; } // called by stream reader - most of the time this read should // be satisfied from already precached chunks StreamPacket* Cache::readPacket(uint_t id, framepos_t position) { //AVM_WRITE(__MODULE__, 4, "Cache: read(id %d, pos %d)\n", id, position); ssize_t rsize = 1; cache_access++; if (id >= m_streams.size()) { AVM_WRITE(__MODULE__, 1, "stream:%d out ouf bounds (%" PRIsz ")\n", id, m_streams.size()); return 0; } StreamEntry& stream = m_streams[id]; if (position >= stream.table->size()) { AVM_WRITE(__MODULE__, 1, "too large stream:%d pos: %d (of %" PRIsz ")\n", id, position, stream.table->size()); return 0; } if (!m_bThreaded) { // code path for single threaded reading //int64_t sss = avm_get_time_us(); Locker locker(mutex); char bfr[8]; if (lseek64(m_iFd, (*stream.table)[position] & ~1, SEEK_SET) == -1 || ::read(m_iFd, bfr, 8) != 8) { AVM_WRITE(__MODULE__, "WARNING: Read error\n"); return 0; } uint_t ckid = avm_get_le32(bfr); uint_t clen = avm_get_le32(bfr + 4); if (clen > StreamPacket::MAX_PACKET_SIZE) { AVM_WRITE(__MODULE__, "WARNING: Too large chunk %d\n", clen); clen = StreamPacket::MAX_PACKET_SIZE; } StreamPacket* p; if ((p = new StreamPacket(clen))) { if (p->GetSize() > 0) { // FIXME - this isn't going to give good result rsize = ::read(m_iFd, p->GetData(), p->GetSize()); //printf("read_packet: id:%x len:%d rsize:%d %d m:%x\n", ckid, clen, rsize, p->size, *(int*)(p->memory)); if (rsize <= 0) { p->Release(); return 0; } } p->SetFlags((*stream.table)[position] & 1 ? AVIIF_KEYFRAME : 0); p->SetPos(position); //ttt1 += avm_get_time_diff(avm_get_time_us(), sss); } return p; } mutex.Lock(); //while (stream.actual != position || stream.packets.size() == 0) StreamPacket* p = 0; while (!m_bQuit) { //printf("STREAMPOS:%d sp:%d id:%d ss:%d\n", position, stream.position, id, stream.packets.size()); if (!stream.packets.empty()) { p = stream.packets.front(); stream.packets.pop(); stream.sum -= p->GetSize(); if (p->GetPos() == position) { //AVM_WRITE(__MODULE__, 4, "id: %d bsize: %d memory: %p pp: %d\n", // id, stream.packets.size(), p->memory, p->position); cache_right++; break; } //AVM_WRITE(__MODULE__, 4, "position: 0x%x want: 0x%x\n", p->position, position); // remove this chunk //printf("delete chunkd %d (wants %d)\n", p->position, position); p->Release(); p = 0; continue; } if (stream.error == position) { //printf("READERROR e:%d p:%d pl:%d\n", stream.error, position, stream.last); break; } cache_miss++; rsize = 0; m_uiId = id; stream.position = position; //AVM_WRITE(__MODULE__, 4, "--- actual: %d size: %d\n", id, stream.packets.size()); //int64_t w = avm_get_time_us(); //printf("ToWait read sid:%d pos:%d size:%d\n", id, position, stream.packets.size()); cond.Broadcast(); cond.Wait(mutex); //printf("----------- DoneWait read size:%d\n", stream.packets.size()); //ttt += avm_get_time_diff(avm_get_time_us(), w); //AVM_WRITE(__MODULE__, 4, "--- actual: %d done - size: %d\n", id, stream.packets.size()); } if (stream.packets.size() < (CACHE_SIZE / 2)) cond.Broadcast(); // wakeup only when buffers are getting low... mutex.Unlock(); //printf("RETURN packet %p\n", p); return p; } int Cache::clear() { AVM_WRITE(__MODULE__, 4, "Cleared\n"); mutex.Lock(); for (unsigned i = 0; i < m_streams.size(); i++) { StreamEntry& stream = m_streams[i]; while (stream.packets.size()) { StreamPacket* r = stream.packets.front(); stream.packets.pop(); r->Release(); } stream.sum = 0; stream.position = 0; } m_uiId = 0; cond.Broadcast(); mutex.Unlock(); return 0; } double Cache::getSize() { /* int status=0; for(int i=0; imutex.Lock(); c->cond.Broadcast(); c->mutex.Unlock(); return c->threadfunc(); } /*************************************************************/ const uint_t InputStream::BFRSIZE = 1024; InputStream::InputStream() : m_iFd(-1), m_pCache(0), m_bEof(false), m_pBuffer(0) { } InputStream::~InputStream() { close(); delete[] m_pBuffer; } int InputStream::open(const char *pszFile) { if (!m_pBuffer && !(m_pBuffer = new uint8_t[BFRSIZE])) return -1; if ((m_iFd = ::open(pszFile, O_RDONLY | O_LARGEFILE)) < 0) { AVM_WRITE("InputStream", "Could not open file %s: %s\n", pszFile, strerror(errno)); return -1; } m_iPos = 0; m_iBuffered = 0; return m_iFd; } void InputStream::close() { delete m_pCache; m_pCache = 0; if (m_iFd >= 0) ::close(m_iFd); m_iFd = -1; } int InputStream::async() { if (!m_pCache) m_pCache = new Cache(); return (m_pCache) ? m_pCache->create(m_iFd) : -1; } int InputStream::addStream(uint_t id, const avm::vector& table) { if (!m_pCache) m_pCache = new Cache(); return (m_pCache) ? m_pCache->addStream(id, table) : -1; } off_t InputStream::len() const { struct stat st; fstat(m_iFd, &st); return st.st_size; } off_t InputStream::seek(int64_t offset) { off_t cur = offset - pos(); if (cur == 0) return offset; if (cur <= m_iBuffered && -cur <= m_iPos) return seekCur(cur); m_iBuffered = m_iPos = 0; m_bEof = false; return lseek64(m_iFd, offset, SEEK_SET); } off_t InputStream::seekCur(int64_t offset) { m_bEof = false; if (offset == 0) return pos(); //printf("seekcur %lld p:%d b:%d\n", offset, m_iPos, m_iBuffered); if (m_iPos >= m_iBuffered) lseek64(m_iFd, offset, SEEK_CUR); // buffer empty else if (offset > (m_iBuffered - m_iPos) || (m_iPos + offset) < 0) { // out of buffer offset -= (m_iBuffered - m_iPos); m_iBuffered = m_iPos = 0; lseek64(m_iFd, offset, SEEK_CUR); } else { //printf("seekcur %lld %d\n", offset, m_iPos); m_iPos += offset; } //printf("seekcur return %d\n", pos()); return pos(); } off_t InputStream::pos() const { off_t o = lseek64(m_iFd, 0, SEEK_CUR); //printf("POS: %lld %d %d %lld\n", o, m_iPos, m_iBuffered, len()); if (m_iPos < m_iBuffered) o -= (m_iBuffered - m_iPos); else if (o > len()) o = len(); return o; } ssize_t InputStream::read(void* buffer, size_t size) { ssize_t r = 0; if (m_iPos < m_iBuffered) { size_t copy = m_iBuffered - m_iPos; if (size < copy) copy = size; memcpy(buffer, m_pBuffer + m_iPos, copy); m_iPos += copy; r = copy; size -= copy; buffer = (char*) buffer + copy; } if (size > 0) { ssize_t s = ::read(m_iFd, buffer, size); if (s <= 0) { m_bEof = true; s = 0; } r += s; } return r; } uint8_t InputStream::readByte() { #if 1 if (m_iPos >= m_iBuffered) { ssize_t r = ::read(m_iFd, m_pBuffer, BFRSIZE); //printf("Read size %d %d\n", r, BFRSIZE); if (r <= 0) { m_bEof = true; return 0; } m_iBuffered = r; m_iPos = 0; } return m_pBuffer[m_iPos++]; #else uint8_t c; if (::read(m_iFd, &c, 1) <= 0) { m_bEof = true; c = 0; } return c; #endif } #undef __MODULE__ AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviread/Cache.h0000644000175000017500000000665111165744102017307 0ustar yavoryavor#ifndef AVIFILE_CACHE_H #define AVIFILE_CACHE_H #define _LARGEFILE64_SOURCE #ifdef AVIFILE_AVIFMT_H #error Cache.h has to be the first inlude file you use!!! #endif // These classes provide basic caching abilities for files // in AVI format. This is useful when files are played // over NFS or SMB. Relies heavily on AVI structure. #include "avifmt.h" #include "ReadHandlers.h" #include "avm_locker.h" #include "avm_stl.h" #include // size_t AVM_BEGIN_NAMESPACE; class Cache { public: // FIXME: add methods for setting/getting size of cache Cache(size_t size = CACHE_SIZE); ~Cache(); //int addStream(uint_t id, const avm::vector& table); int addStream(uint_t id, const avm::vector& table); int clear(); int create(int fd); double getSize(); uint_t pickChunk(); StreamPacket* readPacket(uint_t id, framepos_t pos); protected: struct StreamEntry { const avm::vector* table; avm::qring packets; uint_t position; // needed chunk // handled internaly size_t sum; // cached bytes in stream off_t offset; uint_t last; uint_t error; bool filling; static const uint_t OK = ~0U; //StreamEntry(const avm::vector* t = 0, StreamEntry(const avm::vector* t = 0, uint_t pos = 0, size_t size = CACHE_SIZE) :table(t), packets(size), position(pos), sum(0), offset(0), last(OK), error(OK), filling(false) {} }; void* threadfunc(); // main thread for cache handling inline bool isCachable(const StreamEntry& stream, uint_t id) const; // new data could be readed static void* startThreadfunc(void* arg); static const uint_t WAIT = ~0U; static const size_t CACHE_SIZE = 300; size_t m_uiSize; // preallocated chunks for one stream avm::vector m_streams; PthreadTask* thread; PthreadMutex mutex; PthreadCond cond; StreamPacket* m_pPacket; int m_iFd; // cached file descritor uint_t m_uiId; // currently processed stream uint_t cache_access; // total amount of cache access uint_t cache_right; // accesses satisfied by cache uint_t cache_miss; // how many times we had to wait bool m_bQuit; // quit caching thread bool m_bThreaded; }; class InputStream { public: InputStream(); ~InputStream(); int open(const char* file); void close(); off_t seek(off_t offset); off_t seekCur(off_t offset); off_t pos() const; off_t len() const; bool eof() const { return m_bEof; } //enter asynchronous mode int async(); //int addStream(uint_t id, const avm::vector& table) int addStream(uint_t id, const avm::vector& table); ssize_t read(void* buffer, size_t size); uint8_t readByte(); uint32_t readDword() { return readWord() | (readWord() << 16); } uint16_t readWord() { return (uint16_t) (readByte() | (readByte() << 8)); } //from cache: StreamPacket* readPacket(uint_t id, framepos_t fpos) { return (m_pCache) ? m_pCache->readPacket(id, fpos) : 0; } int clear() { return (m_pCache) ? m_pCache->clear() : -1; } double cacheSize() const { return (m_pCache) ? m_pCache->getSize() : 0.0; } protected: static const uint_t BFRSIZE; int m_iFd; Cache* m_pCache; ssize_t m_iPos; ssize_t m_iBuffered; bool m_bEof; uint8_t* m_pBuffer; }; AVM_END_NAMESPACE; #endif // AVIFILE_CACHE_H avifile-0.7.48~20090503.ds/lib/aviread/FFReadHandler.cpp0000644000175000017500000001646211176642755021242 0ustar yavoryavor#include "FFReadHandler.h" #include "FFReadStream.h" #include "avm_output.h" #include "avm_avformat.h" #include #include #include AVM_BEGIN_NAMESPACE; class AVStreamPacket : public StreamPacket { AVPacket packet; /// \internal disabled AVStreamPacket(const AVStreamPacket&) {} /// \internal disabled AVStreamPacket& operator=(const AVStreamPacket&) { return *this; } public: AVStreamPacket() : StreamPacket() {} virtual ~AVStreamPacket() { if (memory) { av_free_packet(&packet); memory = 0; } } AVPacket& GetAVPacket() { return packet; } const AVPacket& GetAVPacket() const { return packet; } void UpdateMembers() { memory = packet.data; size = packet.size; read = 0; } }; FFReadHandler::FFReadHandler() : m_pContext(0) { static int g_iInitilized = 0; if (!g_iInitilized) { av_register_all(); g_iInitilized++; } } FFReadHandler::~FFReadHandler() { if (m_pContext) { flush(); while (m_Streams.size() > 0) { delete m_Streams.back(); m_Streams.pop_back(); } av_close_input_file(m_pContext); } } int FFReadHandler::Init(const char* url) { AVFormatParameters avfp; AVInputFormat* fmt = 0; // av_find_input_format(url); //printf("find input format %p %s\n", fmt, b); memset(&avfp, 0, sizeof(avfp)); int r = av_open_input_file(&m_pContext, url, fmt, 64000, &avfp); if (r < 0) { AVM_WRITE("FF reader", "Open Input failed %d\n", r); return -1; } if (av_find_stream_info(m_pContext) < 0) return -1; AVM_WRITE("FF reader", "Format:'%s' Stream(s):%d\n", m_pContext->iformat->long_name, m_pContext->nb_streams); m_Streams.resize(m_pContext->nb_streams); for (unsigned i = 0; i < m_pContext->nb_streams; ++i) { AVCodecContext* avc = m_pContext->streams[i]->codec; AVCodec* codec = avcodec_find_decoder(avc->codec_id); AVM_WRITE("FF reader", "S: %d %s CodecID:%x bitrate:%d (%d) samplerate:%d chn:%d framerate:%d/%d wxh %dx%d %d/%d\n", i, codec ? codec->name : "", avc->codec_id, avc->bit_rate, avc->bit_rate_tolerance, avc->sample_rate, avc->channels, avc->time_base.num, avc->time_base.den, avc->width, avc->height, avc->sample_aspect_ratio.num, avc->sample_aspect_ratio.den); m_Streams[i] = new FFReadStream(this, i, m_pContext->streams[i]); } //m_pContext->iformat->read_header(m_pContext, &avfp); //printf("samprate %d\nchn %d\nframerate %d\nwidth %d\nheigth %d\n", // avfp.sample_rate, avfp.channels, avfp.frame_rate, avfp.width, avfp.height); return 0; } size_t FFReadHandler::GetHeader(void* header, size_t size) { if (header)//&& (size >= sizeof(AVIMainHeader))) { memset(header, 0, size); //memcpy(pheader, &m_MainHeader, sizeof(AVIMainHeader)); } return 0;//sizeof(AVIMainHeader); } IMediaReadStream* FFReadHandler::GetStream(uint_t stream_id, IStream::StreamType type) { int t; uint_t cnt = 0; switch (type) { case IStream::Audio: t = CODEC_TYPE_AUDIO; break; case IStream::Video: t = CODEC_TYPE_VIDEO; break; default: return 0; } for (unsigned i = 0; i < m_pContext->nb_streams; ++i) { if (m_pContext->streams[i]->codec->codec_type == t) { if (cnt == stream_id) return m_Streams[i]; cnt++; } } return 0; } size_t FFReadHandler::GetStreamCount(IStream::StreamType type) { int t; size_t cnt = 0; switch (type) { case IStream::Audio: t = CODEC_TYPE_AUDIO; break; case IStream::Video: t = CODEC_TYPE_VIDEO; break; default: return 0; } for (unsigned i = 0; i < m_pContext->nb_streams; ++i) if (m_pContext->streams[i]->codec->codec_type == t) cnt++; return cnt; } void FFReadHandler::flush() { for (size_t i = 0; i < m_Streams.size(); ++i) { while (m_Streams[i]->m_Packets.size()) { m_Streams[i]->m_Packets.front()->Release(); m_Streams[i]->m_Packets.pop(); } m_Streams[i]->m_uiPosition = 0; } } //int FFReadHandler::seek(framepos_t pos) int FFReadHandler::seek(double timepos) { Locker locker(m_Mutex); flush(); //AVM_WRITE("FF reader", 1, "seek(%f) %" PRId64 "\n", timepos, m_pContext->start_time); int64_t sp = ((m_pContext->start_time != (int64_t)AV_NOPTS_VALUE) ? m_pContext->start_time : 0) + int64_t(timepos * AV_TIME_BASE); #if 1 av_seek_frame(m_pContext, -1, sp, 0); #else #ifndef INT64_MIN #define INT64_MIN (-0x7fffffffffffffffLL-1) #endif #ifndef INT64_MAX #define INT64_MAX INT64_C(9223372036854775807) #endif avformat_seek_file(m_pContext, -1, INT64_MIN, sp, INT64_MAX, 0); #endif return 0; } int FFReadHandler::readPacket() { Locker locker(m_Mutex); AVStreamPacket* p = new AVStreamPacket(); AVPacket& pkt = p->GetAVPacket(); AVM_WRITE("FF reader", 5, "readPacket()\n"); if (av_read_frame(m_pContext, &pkt) < 0) { p->Release(); if (url_ferror(m_pContext->pb)) AVM_WRITE("FF reader", "error seen\n"); //if (!url_feof(m_pContext->pb)) // AVM_WRITE("FF reader", "ffmpeg packet error and not eof??\n"); return -1; } //printf("FFMPEG pktsize: %u %" PRId64 " %d\n", pkt.size, pkt.pts, pkt.stream_index);fflush(stdout); p->UpdateMembers(); if ((size_t)pkt.stream_index >= m_Streams.size()) { AVM_WRITE("FF reader", "new stream?? i:%d n:%d sz:%" PRIsz "\n", pkt.stream_index, m_pContext->nb_streams, m_Streams.size()); p->Release(); return 0; } FFReadStream& s = *m_Streams[pkt.stream_index]; AVStream& ast = *m_pContext->streams[pkt.stream_index]; p->SetPos(s.m_uiPosition); p->SetTimestamp(((pkt.pts != (int64_t)AV_NOPTS_VALUE) ? pkt.pts : pkt.dts) * AV_TIME_BASE * ast.time_base.num / ast.time_base.den - s.GetStartTime()); if (pkt.flags & PKT_FLAG_KEY) p->SetFlags(p->GetFlags() | KEYFRAME); if (p->GetTimestamp() < 0) p->SetTimestamp(0); //AVM_WRITE("FF reader", "st:%d n/d:%d/%d ts:%" PRId64 " d:%" PRId64 " dur:%d p:%" PRId64 "\n", // pkt.stream_index, ast.time_base.num, ast.time_base.den, // p->timestamp, pkt.dts, pkt.duration, pkt.pts); //if (ast->codec.codec_type == CODEC_TYPE_VIDEO) printf("FRATE %d pts:%lld %d %d t:%lld\n", p->position, pkt.pts,ast->codec.frame_rate_base, ast->codec.frame_rate, p->timestamp); //else printf("Bitrate %d\n", ast->codec.bit_rate); //printf("TIMESTAMP %" PRId64 " pts: %" PRId64 " dts: %" PRId64 "\n", p->timestamp, pkt.pts, pkt.dts); switch (ast.codec->codec_type) { case CODEC_TYPE_AUDIO: s.m_uiPosition += pkt.size; break; case CODEC_TYPE_VIDEO: default: s.m_uiPosition++; break; } #if 0 printf("---ReadPacket i:%d sz:%d pts:%" PRId64 " size:%d (%" PRId64 ", %d)\n", pkt.stream_index, s.m_Packets.size(), pkt.pts, pkt.size, p->timestamp, pkt.flags); #endif if (s.m_Packets.size() >= s.m_Packets.capacity() - 1) { if (1) AVM_WRITE("FF reader", "got too many packets in the queue %d??? (%" PRIsz ", %" PRIsz ")\n", pkt.stream_index, s.m_Packets.size(), s.m_Packets.capacity()); s.m_Packets.front()->Release(); s.m_Packets.pop(); } s.m_Packets.push(p); return 0; } IMediaReadHandler* CreateFFReadHandler(const char *pszFile) { FFReadHandler* h = new FFReadHandler(); if (h && h->Init(pszFile) == 0) return h; delete h; return 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviread/FFReadHandler.h0000644000175000017500000000217311171137417020666 0ustar yavoryavor#ifndef FFREADHANDLER_H #define FFREADHANDLER_H #include "ReadHandlers.h" #include "avm_locker.h" struct AVInputStream; struct AVFormatContext; AVM_BEGIN_NAMESPACE; class FFReadStream; class FFReadHandler : public IMediaReadHandler { friend class FFReadStream; public: FFReadHandler(); virtual ~FFReadHandler(); int Init(const char* url); virtual size_t GetHeader(void* pheader, size_t size); virtual IMediaReadStream* GetStream(uint_t stream_id, IStream::StreamType type); virtual size_t GetStreamCount(IStream::StreamType type); virtual bool GetURLs(avm::vector& urls) { return false; } virtual void Interrupt() {} /* avi files are opened synchronously */ virtual bool IsOpened() { return true; } virtual bool IsValid() { return true; } virtual bool IsRedirector() { return false; } protected: void flush(); //int seek(framepos_t pos); int seek(double pos); int readPacket(); AVFormatContext* m_pContext; avm::vector m_Streams; AVInputStream* m_pInput; PthreadMutex m_Mutex; }; AVM_END_NAMESPACE; #endif // FFREADHANDLER_H avifile-0.7.48~20090503.ds/lib/aviread/FFReadStream.cpp0000644000175000017500000002653711177256102021110 0ustar yavoryavor#include "FFReadStream.h" #include "FFReadHandler.h" #include "avm_fourcc.h" #include "avm_output.h" #include "utils.h" #include "avm_avformat.h" #include #include #include AVM_BEGIN_NAMESPACE; static int get_fcc(enum CodecID id) { const struct id2fcc { enum CodecID id; uint32_t fcc; } id2fcct[] = { { CODEC_ID_MPEG1VIDEO, RIFFINFO_MPG1 }, { CODEC_ID_MPEG1VIDEO, mmioFOURCC('P', 'I', 'M', '1') }, { CODEC_ID_MPEG2VIDEO, RIFFINFO_MPG2 }, { CODEC_ID_H263, mmioFOURCC('H', '2', '6', '3') }, { CODEC_ID_H263P, mmioFOURCC('H', '2', '6', '3') }, { CODEC_ID_H263I, mmioFOURCC('I', '2', '6', '3') }, { CODEC_ID_H264, mmioFOURCC('H', '2', '6', '4') }, { CODEC_ID_MSMPEG4V3, mmioFOURCC('D', 'I', 'V', '3') }, { CODEC_ID_MPEG4, mmioFOURCC('D', 'I', 'V', 'X') }, { CODEC_ID_MSMPEG4V2, mmioFOURCC('M', 'P', '4', '2') }, { CODEC_ID_FLV1, mmioFOURCC('F', 'L', 'V', '1') }, { CODEC_ID_MJPEG, mmioFOURCC('M', 'J', 'P', 'G') }, { CODEC_ID_DTS, 0x10 }, { CODEC_ID_MP2, 0x50 }, { CODEC_ID_MP3, 0x55 }, { CODEC_ID_AC3, WAVE_FORMAT_DVM }, { CODEC_ID_AAC, 'M' | ('P' << 8) }, // MP4A { CODEC_ID_DVVIDEO, mmioFOURCC('D', 'V', 'S', 'D') }, { CODEC_ID_DVAUDIO, ('D' << 8) | 'A' }, { CODEC_ID_NONE } }; //printf("TRANSLATE %d 0x%x\n", id, id); for (const struct id2fcc* p = id2fcct; p->id; p++) if (p->id == id) return p->fcc; //printf("FAILED\n"); return 0; } FFReadStream::FFReadStream(FFReadHandler* handler, uint_t sid, AVStream* avs) : m_pHandler(handler), m_pAvStream(avs), m_pAvContext(0), m_uiSId(sid), m_Packets(5000), m_uiPosition(0), m_dTimestamp(0.), m_uiKeyChunks(0), m_uiKeySize(0), m_uiKeyMaxSize(0), m_uiKeyMinSize(0), m_uiDeltaSize(0), m_uiDeltaMaxSize(0), m_uiDeltaMinSize(0) { m_StartTime = (m_pHandler->m_pContext->start_time != (int64_t)AV_NOPTS_VALUE) ? m_pHandler->m_pContext->start_time : 0; m_dLength = (double)m_pHandler->m_pContext->duration / (double)AV_TIME_BASE; AVM_WRITE("FF stream", "Starttime:%" PRId64 " Duration:%fs\n", m_StartTime, m_dLength); //printf("codec %d %.4s\n", avs->codec->codec_id, &avs->codec->codec_tag); //printf("CODECRA %d %d %d\n", avs->codec->frame_rate, avs->codec->frame_rate_base, avs->r_frame_rate_base); if (0 && avs->codec->codec_id == CODEC_ID_MPEG1VIDEO) { m_pAvContext = avcodec_alloc_context(); //AVCodec* codec = avcodec_find_encoder(avs->codec->codec_id); if (m_pAvContext) { AVCodec* codec = avcodec_find_decoder(avs->codec->codec_id); if (codec && avcodec_open(m_pAvContext, codec) == 0) { m_pAvContext->flags |= CODEC_FLAG_TRUNCATED; m_pAvContext->hurry_up = 5; //printf("Opened hurryup decoder %p %p\n", codec, m_pAvContext->codec->decode); } else { avcodec_close(m_pAvContext); m_pAvContext = 0; } } } } FFReadStream::~FFReadStream() { if (m_pAvContext) { avcodec_close(m_pAvContext); free(m_pAvContext); } } double FFReadStream::CacheSize() const { return 1.; //(double)m_Packets.size() / (double)m_Packets.capacity() + 0.2; } void FFReadStream::ClearCache() { } size_t FFReadStream::GetHeader(void* header, size_t size) const { return 0; } framepos_t FFReadStream::GetPrevKeyFrame(framepos_t frame) const { return ERR; } framepos_t FFReadStream::GetNextKeyFrame(framepos_t frame) const { return ERR; } framepos_t FFReadStream::GetNearestKeyFrame(framepos_t frame) const { return ERR; } framepos_t FFReadStream::GetLength() const { return 0x7fffffff; } double FFReadStream::GetFrameTime() const { return 1/24.; } double FFReadStream::GetLengthTime() const { return m_dLength; } StreamInfo* FFReadStream::GetStreamInfo() const { AVStream* avs = m_pHandler->m_pContext->streams[m_uiSId]; uint_t s; if (m_StreamInfo.m_p->m_dLengthTime == 0.0) { m_StreamInfo.m_p->setKfFrames(m_uiKeyMaxSize, m_uiKeyMinSize, m_uiKeyChunks, m_uiKeySize); m_StreamInfo.m_p->setFrames(m_uiDeltaMaxSize, (m_uiDeltaMinSize > m_uiDeltaMaxSize) // usually no delta frames ? m_uiDeltaMaxSize : m_uiDeltaMinSize, (uint_t)(m_Offsets.size() - m_uiKeyChunks), m_uiStreamSize - m_uiKeySize); m_StreamInfo.m_p->m_dLengthTime = GetLengthTime(); m_StreamInfo.m_p->m_iQuality = 0; m_StreamInfo.m_p->m_iSampleSize = 1;//m_Header.dwSampleSize; switch (avs->codec->codec_type) { case CODEC_TYPE_AUDIO: m_StreamInfo.m_p->setAudio(avs->codec->channels, avs->codec->sample_rate, avs->codec->frame_bits); m_StreamInfo.m_p->m_Type = StreamInfo::Audio; m_StreamInfo.m_p->m_uiFormat = avs->codec->codec_tag; AVM_WRITE("FF stream", "Audio Format: %.4s (0x%x)\n", (const char*)&avs->codec->codec_tag, avs->codec->codec_tag); break; case CODEC_TYPE_VIDEO: m_StreamInfo.m_p->setVideo(avs->codec->width, avs->codec->height, 0, (float)avs->codec->sample_aspect_ratio.num / (float)avs->codec->sample_aspect_ratio.den); m_StreamInfo.m_p->m_Type = StreamInfo::Video; m_StreamInfo.m_p->m_uiFormat = avs->codec->codec_tag; AVM_WRITE("FF stream", "Codec tag format %.4s\n", (char*) &m_StreamInfo.m_p->m_uiFormat); break; default: return 0; } if (m_StreamInfo.m_p->m_uiFormat == 0) { m_StreamInfo.m_p->m_uiFormat = get_fcc(avs->codec->codec_id); if (m_StreamInfo.m_p->m_uiFormat == 0) AVM_WRITE("FF stream", "StreamInfo extension neeeded\n"); } } return new StreamInfo(m_StreamInfo); } double FFReadStream::GetTime(framepos_t lSample) const { if (lSample == ERR) return m_dTimestamp; return 0.; } size_t FFReadStream::GetSampleSize() const { return 0; } IStream::StreamType FFReadStream::GetType() const { switch (m_pHandler->m_pContext->streams[m_uiSId]->codec->codec_type) { case CODEC_TYPE_AUDIO: return IStream::Audio; case CODEC_TYPE_VIDEO: return IStream::Video; default: return IStream::Other; } } size_t FFReadStream::GetFormat(void *format, size_t size) const { AVStream* avs = m_pHandler->m_pContext->streams[m_uiSId]; int tag = get_fcc(avs->codec->codec_id); switch (avs->codec->codec_type) { case CODEC_TYPE_AUDIO: if (format && size >= sizeof(WAVEFORMATEX)) { WAVEFORMATEX& wfx = *(WAVEFORMATEX*)format; FFMPEGWAVEFORMATEX& ffwfx = *(FFMPEGWAVEFORMATEX*)format; if (tag == 0) { if (size < sizeof(FFMPEGWAVEFORMATEX)) return 0; memset(&ffwfx, 0, sizeof(ffwfx)); // using extension - there is no free place in original WAVEFORMATEX wfx.wFormatTag = WAVE_FORMAT_EXTENSIBLE; avm_set_le32(&ffwfx.wfex.SubFormat.f1, CodecInfo::FFMPEG); avm_set_le32(&ffwfx.dwCodecID, avs->codec->codec_id); } else { memset(&wfx, 0, sizeof(wfx)); wfx.wFormatTag = (uint16_t)tag; } //if (avs->codec->codec_tag == 0) wf->wFormatTag = av_codec_get_fourcc(avs->codec->codec_id); //printf("CODEC %x %x %x\n", wf.wFormatTag, avs->codec->codec_id, avs->codec->codec_tag); wfx.nChannels = (uint16_t)avs->codec->channels; wfx.nSamplesPerSec = avs->codec->sample_rate; wfx.nAvgBytesPerSec = avs->codec->bit_rate / 8; //printf("SAMP:%d AVGBYTES:%d ALIGN:%d BITS:%d\n", avs->codec->sample_rate, avs->codec->bit_rate, avs->codec->block_align, avs->codec->bits_per_coded_sample); wfx.nBlockAlign = (uint16_t)avs->codec->block_align; wfx.wBitsPerSample = (uint16_t)avs->codec->bits_per_coded_sample; wfx.cbSize = tag ? 0 : sizeof(FFMPEGWAVEFORMATEX) - sizeof(WAVEFORMATEX); if (avs->codec->extradata && size >= (sizeof(WAVEFORMATEX) + wfx.cbSize + avs->codec->extradata_size)) { memcpy((uint8_t*)(&wfx + 1) + wfx.cbSize, avs->codec->extradata, avs->codec->extradata_size); wfx.cbSize = (uint16_t)(wfx.cbSize + avs->codec->extradata_size); } if (avs->codec->codec_id == CODEC_ID_AAC) { // hmm currenly hack - ffmpeg seems to fail properly detect this stream wfx.nChannels = 2; wfx.nSamplesPerSec = 44100; wfx.nAvgBytesPerSec = 16000; wfx.wBitsPerSample = 16; } ///printf("AUDIO %d %x %x %d\n", avs->codec->extradata_size, wf->wFormatTag, avs->codec->codec_tag, avs->codec->codec_id); } return (tag ? sizeof(WAVEFORMATEX) : sizeof(FFMPEGWAVEFORMATEX)) + ((avs->codec->extradata) ? avs->codec->extradata_size : 0); case CODEC_TYPE_VIDEO: if (format && size >= sizeof(BITMAPINFOHEADER)) { memset(format, 0, sizeof(BITMAPINFOHEADER)); BITMAPINFOHEADER& bih = *(BITMAPINFOHEADER*)format; //printf("FORMAT %p %d %d\n", format, m_uiSId, avc->width); bih.biSize = sizeof(BITMAPINFOHEADER); bih.biWidth = avs->codec->width; bih.biHeight = avs->codec->height; bih.biPlanes = 1; bih.biCompression = get_fcc(avs->codec->codec_id); bih.biBitCount = (uint16_t)avs->codec->bits_per_coded_sample; // hack which might be eventually usefull //memcpy(&bih->biXPelsPerMeter, &m_pHandler->m_pContext, sizeof(void*)); if (!bih.biCompression) { bih.biCompression = CodecInfo::FFMPEG; bih.biSizeImage = avs->codec->codec_id; } if (avs->codec->extradata && size >= (sizeof(BITMAPINFOHEADER) + avs->codec->extradata_size)) { bih.biSize += avs->codec->extradata_size; memcpy(&bih + 1, avs->codec->extradata, avs->codec->extradata_size); //printf("COPY EXTRA %d\n", avs->extradata_size); //for (unsigned i = 0; i < size; i++) printf("%d 0x%x\n", i, ((uint8_t*)format)[i]); } //BitmapInfo(*bih).Print(); } return sizeof(BITMAPINFOHEADER) + ((avs->codec->extradata) ? avs->codec->extradata_size : 0); default: return 0; } } bool FFReadStream::IsKeyFrame(framepos_t frame) const { if (frame == ERR && m_Packets.size()) return (m_Packets.front()->GetFlags() & KEYFRAME); AVM_WRITE("FF stream", "IsKeyFrame unimplemented!\n"); return true; } StreamPacket* FFReadStream::ReadPacket() { for (size_t i = 0; i < m_Packets.capacity() - 2; ++i) { if (m_Packets.size() > 0) break; if (m_pHandler->readPacket() < 0) { if (m_dLength < m_dTimestamp) m_dLength = m_dTimestamp; return 0; } } //printf("PACKET SIZE %d %d\n", m_Packets.size(), m_Packets.capacity()); if (!m_Packets.size()) return 0; Locker locker(m_pHandler->m_Mutex); StreamPacket* p = m_Packets.front(); m_Packets.pop(); m_dTimestamp = (double)p->GetTimestamp() / (double)AV_TIME_BASE; if (m_dLength < m_dTimestamp) m_dLength = m_dTimestamp; //printf("FFREADSTREAMPACKET %f sid:%d qsz:%" PRIsz " s:%d frm: %d\n", m_dTimestamp, m_uiSId, m_Packets.size(), p->size, m_pAvStream->codec->frame_number); return p; } int FFReadStream::Seek(framepos_t pos) { AVM_WRITE("FF stream", "SeekPos: %d\n", pos); if (pos == 0) { m_pHandler->seek(0); return 0; } return -1; } int FFReadStream::SeekTime(double time) { AVM_WRITE("FF stream", "SeekTime: %f\n", time); return m_pHandler->seek(time); if (time < 1.) { if (m_pAvStream->codec->codec_type == CODEC_TYPE_AUDIO) // check if more streams are available // and seek only with the video return 0; m_pHandler->seek(0); return 0; } return -1; } int FFReadStream::SkipFrame() { AVM_WRITE("FF stream", "SkipFrame\n"); StreamPacket* p = ReadPacket(); if (p) p->Release(); return p ? 0 : -1; } int FFReadStream::SkipTo(double pos) { AVM_WRITE("FF stream", "SkipTo: %f\n", pos); while (pos < GetTime()) SkipFrame(); return 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviread/FFReadStream.h0000644000175000017500000000404711171137260020542 0ustar yavoryavor#ifndef FFREADSTREAM_H #define FFREADSTREAM_H #include "ReadHandlers.h" struct AVStream; struct AVCodecContext; AVM_BEGIN_NAMESPACE; class FFReadHandler; class FFReadStream : public IMediaReadStream { friend class FFReadHandler; public: FFReadStream(FFReadHandler* handler, uint_t sid, AVStream*); virtual ~FFReadStream(); virtual double CacheSize() const; virtual void ClearCache(); virtual size_t GetHeader(void* header, size_t) const; virtual framepos_t GetPrevKeyFrame(framepos_t frame = ERR) const; virtual framepos_t GetNextKeyFrame(framepos_t frame = ERR) const; virtual framepos_t GetNearestKeyFrame(framepos_t frame = ERR) const; virtual framepos_t GetLength() const; virtual double GetFrameTime() const; virtual double GetLengthTime() const; virtual StreamInfo* GetStreamInfo() const; virtual double GetTime(framepos_t lSample = ERR) const; virtual size_t GetSampleSize() const; virtual IStream::StreamType GetType() const; virtual size_t GetFormat(void *format = 0, size_t size = 0) const; virtual bool IsKeyFrame(framepos_t frame = ERR) const; virtual StreamPacket* ReadPacket(); virtual int Seek(framepos_t pos); virtual int SeekTime(double time); virtual int SkipFrame(); virtual int SkipTo(double pos); int64_t GetStartTime() const { return m_StartTime; } protected: FFReadHandler* m_pHandler; AVStream* m_pAvStream; AVCodecContext* m_pAvContext; uint_t m_uiSId; avm::qring m_Packets; framepos_t m_uiPosition; int64_t m_StartTime; double m_dTimestamp; double m_dLength; mutable StreamInfo m_StreamInfo; avm::vector m_Offsets; avm::vector m_Positions; // needed for audio streams uint_t m_uiStreamSize; uint_t m_uiKeyChunks; uint_t m_uiKeySize; uint_t m_uiKeyMaxSize; uint_t m_uiKeyMinSize; // delta chunks m_Offsets - m_uiKeyChunks uint_t m_uiDeltaSize; uint_t m_uiDeltaMaxSize; uint_t m_uiDeltaMinSize; }; AVM_END_NAMESPACE; #endif // FFREADSTREAM_H avifile-0.7.48~20090503.ds/lib/aviread/ReadFile.cpp0000644000175000017500000000670711165744536020327 0ustar yavoryavor#include "ReadStreamV.h" #include "ReadStreamA.h" #include "avm_creators.h" #include "avm_output.h" #include #include #include AVM_BEGIN_NAMESPACE; IReadFile::~IReadFile() {} class ReadFile: public IReadFile { IMediaReadHandler* m_pHandler; const char* m_Name; int m_Flags; avm::vector m_vstreams; avm::vector m_astreams; public: ReadFile(const char* name, int flags) : m_pHandler(0), m_Name(name), m_Flags(flags) { } virtual ~ReadFile() { for (unsigned i = 0; i < m_vstreams.size(); i++) delete m_vstreams[i]; for (unsigned i = 0; i < m_astreams.size(); i++) delete m_astreams[i]; delete m_pHandler; } int init() { if (m_Name) { AVM_WRITE("reader", "Checking: %s\n", m_Name); const char* ff = getenv("AVIPLAY_FFMPEG"); if (ff) m_pHandler = CreateFFReadHandler(m_Name); if (!m_pHandler && !strstr(m_Name, "://")) m_pHandler = CreateAviReadHandler(m_Name, m_Flags); if (!m_pHandler) m_pHandler = CreateAsfReadHandler(m_Name); if (!m_pHandler && !ff) m_pHandler = CreateFFReadHandler(m_Name); } return (m_pHandler) ? 0 : -1; } virtual size_t StreamCount() { return VideoStreamCount() + AudioStreamCount(); } virtual size_t AudioStreamCount() { if (m_pHandler && !m_astreams.size()) { if (!m_vstreams.size() && !IsValid()) return 0; m_astreams.resize(m_pHandler->GetStreamCount(IStream::Audio)); for (uint_t i = 0; i < m_astreams.size(); i++) m_astreams[i] = 0; } return m_astreams.size(); } virtual size_t VideoStreamCount() { if (m_pHandler && !m_vstreams.size()) { if (!m_astreams.size() && !IsValid()) return 0; m_vstreams.resize(m_pHandler->GetStreamCount(IStream::Video)); for (uint_t i = 0; i < m_vstreams.size(); i++) m_vstreams[i] = 0; } return m_vstreams.size(); } virtual size_t GetHeader(void* header, size_t size) { return m_pHandler ? m_pHandler->GetHeader(header, size) : 0; } virtual IReadStream* GetStream(uint_t id, IStream::StreamType type) { switch (type) { case IStream::Audio: if (id < AudioStreamCount()) { if (!m_astreams[id]) { IMediaReadStream* s = m_pHandler->GetStream(id, type); if (!s || s->GetLength() > 0x7fffffff) return 0; m_astreams[id] = new ReadStreamA(s); } return m_astreams[id]; } break; case IStream::Video: if (id < VideoStreamCount()) { if (!m_vstreams[id]) { IMediaReadStream* s = m_pHandler->GetStream(id, type); if (!s || s->GetLength() > 0x7fffffff) return 0; m_vstreams[id] = new ReadStreamV(s); } return m_vstreams[id]; } break; default: break; } return 0; } virtual bool GetURLs(avm::vector& urls) { return m_pHandler ? m_pHandler->GetURLs(urls) : false; } virtual bool IsOpened() { return m_pHandler ? m_pHandler->IsOpened() : true; } virtual bool IsValid() { return m_pHandler ? m_pHandler->IsValid() : false; } virtual bool IsRedirector() { return m_pHandler ? m_pHandler->IsRedirector() : false; } }; IReadFile* CreateReadFile(const char* name, int flags) { ReadFile* r = new ReadFile(name, flags); if (r && r->init() == 0) return r; AVM_WRITE("reader", "Can't open stream\n"); delete r; return 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviread/ReadHandlers.h0000644000175000017500000001215211176642755020646 0ustar yavoryavor#ifndef READHANDLERS_H #define READHANDLERS_H /** * * Interfaces that provide uniform access to data in Audio Video streams, * local and networked files (Avi, Asf, maybe more later) * */ #include "avifile.h" #include "StreamInfoPriv.h" #include "string.h" AVM_BEGIN_NAMESPACE; // StreamPacket implemented in ReadStream.cpp class StreamPacket { protected: uint8_t* memory; size_t size; size_t read; int flags; framepos_t position; int64_t timestamp; // timestamp in microseconds uint_t refcount; public: static const size_t MAX_PACKET_SIZE = 10000000; static const int64_t NO_TIMESTAMP = -1LL; StreamPacket(size_t bsize = 0, void* mem = 0); virtual ~StreamPacket(); /** return number of read bytes from packet */ size_t Read(void* to, size_t read_size); uint8_t* GetData() const { return memory + read; } size_t GetSize() const { return size - read; } size_t GetRead() const { return read; } int GetFlags() const { return flags; } void SetFlags(int f) { flags = f; } framepos_t GetPos() const { return position; } void SetPos(framepos_t p) { position = p; } int64_t GetTimestamp() const { return timestamp; } void SetTimestamp(int64_t t) { timestamp = t; } double GetTime() const { return (double)timestamp / 1000000.; } void SetTime(double t) { timestamp = (int64_t)(t * 1000000.); } void SwapData(StreamPacket& p) { uint8_t* m = memory; memory = p.memory; p.memory = m; } void AddRef() { refcount++; } void Release() { refcount--; if (!refcount) delete this; } }; class IMediaReadStream : public IStream { public: virtual ~IMediaReadStream() {} /* 1 cache full, 0 cache empty */ virtual double CacheSize() const = 0; /* Clear the internal stream cache */ virtual void ClearCache() = 0; /** * Return structure describing main stream header * * NOTE: format is in the stream based one! * Use GetStreamInfo to obtain standard set of informations * about stream * this call will be eliminated later!! */ virtual size_t GetHeader(void *header, size_t size) const = 0; /** Retrieval of stream-specific format data */ // XXXXXXXXXXXXX virtual size_t GetFormat(void *format = 0, size_t size = 0) const = 0; /** Stream frame time - might be just average for whole stream */ // XXXXXXXXXXXXX virtual double GetFrameTime() const = 0; /** Length of the stream in samples - equals with last frame position */ virtual framepos_t GetLength() const = 0; /** Length of the stream in seconds */ // XXXXXXXXXXXXX virtual double GetLengthTime() const = 0; /** * position of previous, next and nearest key frame * related to frame pos ( ERR means current frame ) */ virtual framepos_t GetNearestKeyFrame(framepos_t pos = ERR) const = 0; virtual framepos_t GetNextKeyFrame(framepos_t pos = ERR) const = 0; virtual framepos_t GetPrevKeyFrame(framepos_t pos = ERR) const = 0; /** Timestamp of sample no. lSample ( ERR = current sample ) */ virtual double GetTime(framepos_t lSample = ERR) const = 0; /** Returns 0 for variable frame size stream (usually video), >0 for audio */ virtual size_t GetSampleSize() const = 0; /** * Various useful stream information * * this is preffered way to obtain information about stream! */ virtual StreamInfo* GetStreamInfo() const = 0; /** Type of stream - usually fcc 'vids' or 'auds' */ virtual StreamType GetType() const = 0; /** * Return true if frame no. pos ( ERR means current frame ) is keyframe */ virtual bool IsKeyFrame(framepos_t pos = ERR) const = 0; /** Obtain whole packet - new prefered way for reading streams */ virtual StreamPacket* ReadPacket() = 0; /** Seek to frame position pos in stream */ virtual int Seek(framepos_t pos) = 0; /** Seek to time */ virtual int SeekTime(double time) = 0; virtual int SkipFrame() = 0; virtual int SkipTo(double time) = 0; // this is currently cruel hack virtual int FixAvgBytes(uint_t bps) { return -1; } }; class IMediaReadHandler : public IStream { public: virtual ~IMediaReadHandler() {} /* vids/auds, 0-... */ virtual IMediaReadStream* GetStream(uint_t stream_id, StreamType type) = 0; virtual size_t GetStreamCount(StreamType type) = 0; virtual size_t GetHeader(void* header, size_t size) = 0; /* All calls for network-oriented readers should be interruptible */ virtual void Interrupt() = 0; /* in case of asynchronous opening */ virtual bool IsOpened() = 0; virtual bool IsValid() = 0; virtual bool IsRedirector() = 0; virtual bool GetURLs(avm::vector &urls) = 0; }; /* Read handler for AVI file */ IMediaReadHandler* CreateAviReadHandler(const char *pszFile, int flags); /* Read handler for ASF/WMV/ASX file */ IMediaReadHandler* CreateAsfReadHandler(const char *pszFile); /* Read handler for everything :) file */ IMediaReadHandler* CreateFFReadHandler(const char *pszFile); AVM_END_NAMESPACE; #endif // READHANDLERS_H avifile-0.7.48~20090503.ds/lib/aviread/ReadStream.cpp0000644000175000017500000002217511176642755020702 0ustar yavoryavor#include "ReadStream.h" #include "avm_output.h" #include #include #include #ifdef HAVE_MEMALIGN #include // memalign #endif // HAVE_MEMALIGN AVM_BEGIN_NAMESPACE; #define __MODULE__ "reader" StreamPacket::StreamPacket(size_t bsize, void* mem) : memory((uint8_t*)mem), size(bsize), read(0), flags(0), timestamp(NO_TIMESTAMP), refcount(1) { if (!memory && size > 0) { #ifdef HAVE_MEMALIGN memory = (uint8_t*) memalign(16, size + 16); #else memory = (uint8_t*) malloc(size + 16); #endif } } StreamPacket::~StreamPacket() { //printf("******** Destroy stream packet %d\n", size); assert(refcount == 0); free(memory); } size_t StreamPacket::Read(void* to, size_t read_size) { if (read_size > GetSize()) read_size = GetSize(); if (to) memcpy(to, GetData(), read_size); read += read_size; return read_size; } IStream::~IStream() {} ReadStream::ReadStream(IMediaReadStream* stream) : m_pStream(stream), m_pPacket(0), m_iEof(0), rem_size(0), rem_local(0), rem_limit(0), m_uiLastPos(0), m_dLastTime(0.) { assert(m_pStream != 0); //assert(m_pStream->GetLength() < 0x7fffffff); m_uiFormatSize = m_pStream->GetFormat(); m_pFormat = new char[m_uiFormatSize]; m_pStream->GetFormat(m_pFormat, m_uiFormatSize); const char* tname; switch (GetType()) { case Video: tname = "video"; break; case Audio: tname = "audio"; break; default: tname = "unknown"; break; } AVM_WRITE(__MODULE__, "Initialized %s stream (chunk tblsz: %d, fmtsz: %" PRIsz ")\n", tname, m_pStream->GetLength(), m_uiFormatSize); } ReadStream::~ReadStream() { delete[] m_pFormat; if (m_pPacket) m_pPacket->Release(); } bool ReadStream::Eof() const { //printf("EOF %d %d\n", m_iEof, GetType()); return (m_iEof > 1); //AVM_WRITE(__MODULE__, "EOF %d Pos: %d Len: %d\n", m_iEof, GetPos(), m_pStream->GetLength()); //if (GetType() == IStream::Audio) // AVM_WRITE(__MODULE__, "%p EOF %d Pos: %f Len: %f t:%d\n", this, m_iEof, GetTime(), m_pStream->GetLengthTime(), GetType()); // using delta difference as comparing two doubles might have some epsilon problems if (m_iEof > 1 || (m_pStream->GetLengthTime() - GetTime()) < 0.001) { //AVM_WRITE(__MODULE__, "EOF\n"); return true; } return false; } void ReadStream::Flush() { m_iEof = 0; if (!m_pPacket) { rem_size = rem_local = 0; ReadPacket(); } } int ReadStream::GetFrameFlags(int* flags) const { int f = (m_pPacket && m_pPacket->GetFlags()) ? KEYFRAME : 0; if (flags) *flags = f; return f; } double ReadStream::GetFrameTime() const { return m_pStream->GetFrameTime(); } size_t ReadStream::GetHeader(void* pheader, size_t s) const { return m_pStream->GetHeader(pheader, s); } framepos_t ReadStream::GetLength() const { return m_pStream->GetLength(); } double ReadStream::GetLengthTime() const { return m_pStream->GetLengthTime(); } framepos_t ReadStream::GetPos() const { return m_uiLastPos; } framepos_t ReadStream::GetNextKeyFrame(framepos_t pos) const { AVM_WRITE(__MODULE__, 3, "GetNextKeyFrame() %d\n", pos); return m_pStream->GetNextKeyFrame((pos == ERR) ? GetPos() : pos); } framepos_t ReadStream::GetPrevKeyFrame(framepos_t pos) const { AVM_WRITE(__MODULE__, 3, "GetPrevKeyFrame() %d\n", pos); return m_pStream->GetPrevKeyFrame((pos == ERR) ? GetPos() : pos); } StreamInfo* ReadStream::GetStreamInfo() const { return m_pStream->GetStreamInfo(); } double ReadStream::GetTime(framepos_t pos) const { return (pos == ERR) ? m_dLastTime : m_pStream->GetTime(pos); } ReadStream::StreamType ReadStream::GetType() const { return m_pStream->GetType(); } int ReadStream::ReadDirect(void* buffer, size_t bufsize, size_t samples, size_t& samples_read, size_t& bytes_read, int* flags) { //printf("ReadDirect remsize:%d remlimit:%d bufsize:%d %p\n", (int)rem_size, (int)rem_limit, (int)bufsize, m_pPacket); if (!rem_size) { if (!m_iEof) ReadPacket(); if (!m_pPacket) { m_iEof++; return -1; } //printf("ReadDirect IN2 %d, %d\n", m_pPacket->read, m_pPacket->size); if (m_pPacket->GetSize()) { if (rem_limit < m_pPacket->GetSize()) { rem_limit = m_pPacket->GetSize(); rem_buffer.reserve(rem_limit + PADDING); } rem_flags = m_pPacket->GetFlags(); rem_local = 0; rem_size = m_pPacket->Read(&rem_buffer[rem_local], m_pPacket->GetSize()); ReadPacket(); } } //printf("ReadDirect b:%d r:%d\n", bufsize, rem_size); if (buffer) { bytes_read = (bufsize > rem_size) ? rem_size : bufsize; memcpy(buffer, &rem_buffer[rem_local], bytes_read); rem_local += bytes_read; rem_size -= bytes_read; samples_read = bytes_read; } else { // without buffer return size of available data bytes_read = rem_size; samples_read = rem_size; } size_t ssize = m_pStream->GetSampleSize(); if (ssize > 1) samples_read /= ssize; if (flags) *flags = rem_flags; //printf("ReadDirect br:%d sr:%d ssize:%d flg:%d\n", bytes_read, samples_read, ssize, rem_flags); return 0; } StreamPacket* ReadStream::ReadPacket() { //printf("READPACKET %d %f\n", GetType(), m_dLastTime); if (m_pPacket && !m_pPacket->GetSize()) { m_pPacket->Release(); m_pPacket = 0; } if (!m_pPacket) m_pPacket = m_pStream->ReadPacket(); if (m_pPacket) { if (m_pPacket->GetTimestamp() != StreamPacket::NO_TIMESTAMP) { m_uiLastPos = m_pPacket->GetPos(); m_dLastTime = m_pPacket->GetTime(); } } else { double t = m_pStream->GetTime(); AVM_WRITE(__MODULE__, 2, "FailedPacket GetTime %f\n", t); if (t != m_dLastTime) { m_dLastTime = t; m_uiLastPos++;// = ERR; } } //printf("ReadPacket type:%d tm:%f sz:%d\n", GetType(), m_dLastTime, m_pPacket ? m_pPacket->size : 0); return m_pPacket; } int ReadStream::Seek(framepos_t pos) { AVM_WRITE(__MODULE__, 2, "Seek(%d)\n", pos); int hr = m_pStream->Seek(pos); if (hr == 0) { if (m_pPacket) //m_pPacket->read = m_pPacket->size; m_pPacket->Release(); m_pPacket = 0; Flush(); } return hr; } int ReadStream::SeekTime(double timepos) { AVM_WRITE(__MODULE__, 2, "SeekTime(%f) (%f)\n", timepos, m_dLastTime); int hr = m_pStream->SeekTime(timepos); if (hr == 0) { if (m_pPacket) m_pPacket->Release(); m_pPacket = 0; Flush(); } return hr; } framepos_t ReadStream::SeekToKeyFrame(framepos_t pos) { return (Seek(pos) == 0) ? GetPos() : ERR; } double ReadStream::SeekTimeToKeyFrame(double timepos) { return (SeekTime(timepos) == 0) ? GetTime() : -1.0; } int ReadStream::SkipFrame() { AVM_WRITE(__MODULE__, 2, "SkipFrame()\n"); if (m_pPacket) m_pPacket->Release(); m_pPacket = 0; Flush(); return m_pPacket ? 0 : -1; } int ReadStream::SkipTo(double pos) { AVM_WRITE(__MODULE__, 2, "SkipTo()\n"); int hr = m_pStream->SkipTo(pos); if (hr == 0) { if (m_pPacket) m_pPacket->Release(); m_pPacket = 0; Flush(); } return hr; } framepos_t ReadStream::SeekToNextKeyFrame() { AVM_WRITE(__MODULE__, 3, "SeekToNextKeyFrame()\n"); framepos_t newpos = GetNextKeyFrame(); if (newpos == ERR) { // try to iterate to next keyframe in this case int kf; while (SkipFrame() == 0 && !GetFrameFlags(&kf)) ; } else Seek(newpos); return GetPos(); } framepos_t ReadStream::SeekToPrevKeyFrame() { AVM_WRITE(__MODULE__, 3, "SeekToPrevKeyFrame() (lp:%d)\n", m_uiLastPos); framepos_t newpos = GetPrevKeyFrame(); if (newpos == ERR) { double t = GetTime(); if (t > 20.) { SeekTimeToKeyFrame(t - 20); // just a wilde guess return GetPos(); } newpos = 0; } Seek(newpos); return GetPos(); } size_t ReadStream::GetAudioFormat(void* bi, size_t size) const { AVM_WRITE(__MODULE__, "WARNING: GetAudioFormat() for non-audio stream\n"); return 0; } size_t ReadStream::GetVideoFormat(void* bi, size_t size) const { AVM_WRITE(__MODULE__, "WARNING: GetVideoFormat() for non-video stream\n"); return 0; } IAudioDecoder* ReadStream::GetAudioDecoder() const { AVM_WRITE(__MODULE__, "WARNING: Getting audio decoder for non-audio stream\n"); return 0; } IVideoDecoder* ReadStream::GetVideoDecoder() const { AVM_WRITE(__MODULE__, "WARNING: Getting video decoder for non-video stream\n"); return 0; } CImage* ReadStream::GetFrame(bool readframe) { AVM_WRITE(__MODULE__, "WARNING: GetFrame() called for non-video stream\n"); return 0; } size_t ReadStream::GetFrameSize() const { AVM_WRITE(__MODULE__, "WARNING: GetFrameSize() called for non-video stream\n"); return 0; } int ReadStream::ReadFrame(bool render) { AVM_WRITE(__MODULE__, "WARNING: ReadFrame() called for non-video stream\n"); return -1; } int ReadStream::ReadFrames(void* buffer, size_t bufsize, size_t samples, size_t& samples_read, size_t& bytes_read) { AVM_WRITE(__MODULE__, "WARNING: ReadFrames() called for non-audio stream\n"); return -1; } int ReadStream::SetOutputFormat(void* bi, size_t size) { AVM_WRITE(__MODULE__, "WARNING: SetOutputFormat() called\n"); return -1; } #undef __MODULE__ AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviread/ReadStream.h0000644000175000017500000000550711172715233020333 0ustar yavoryavor#ifndef AVIFILE_READSTREAM_H #define AVIFILE_READSTREAM_H #include "ReadHandlers.h" AVM_BEGIN_NAMESPACE; class AviReadFile; class ReadStream : public IReadStream { friend class AviReadFile; public: ReadStream(IMediaReadStream* stream); virtual ~ReadStream(); virtual size_t GetBuffering(size_t*) const { return 0; } virtual StreamType GetType() const; virtual size_t GetHeader(void* pheader = 0, size_t size = 0) const; virtual size_t GetAudioFormat(void* format = 0, size_t size = 0) const; virtual size_t GetVideoFormat(void* format = 0, size_t size = 0) const; virtual IAudioDecoder* GetAudioDecoder() const; virtual IVideoDecoder* GetVideoDecoder() const; //Size of stream and one frame virtual framepos_t GetLength() const; virtual double GetLengthTime() const; virtual int GetFrameFlags(int* flags) const; virtual double GetFrameTime() const; virtual framepos_t GetPos() const; virtual StreamInfo* GetStreamInfo() const; virtual double GetTime(framepos_t frame = ERR) const; //Positioning in stream virtual int Seek(framepos_t pos); virtual int SeekTime(double pos); virtual framepos_t SeekToKeyFrame(framepos_t pos); virtual double SeekTimeToKeyFrame(double pos); virtual int SkipFrame(); virtual int SkipTo(double pos); //Reading decompressed data virtual int SetDirection(bool d) { return -1; } virtual int SetBuffering(size_t maxsz = 1, IImageAllocator* ia = 0) { return -1; } virtual int SetOutputFormat(void* bi, size_t size); virtual int ReadFrame(bool render = true); virtual CImage* GetFrame(bool readframe = false); virtual size_t GetFrameSize() const; virtual int ReadFrames(void* buffer, size_t bufsize, size_t samples, size_t& samples_read, size_t& bytes_read); virtual int ReadDirect(void* buffer, size_t bufsize, size_t samples, size_t& samples_read, size_t& bytes_read, int* flags = 0); virtual framepos_t GetNextKeyFrame(framepos_t frame = ERR) const; virtual framepos_t GetPrevKeyFrame(framepos_t frame = ERR) const; virtual framepos_t SeekToNextKeyFrame(); virtual framepos_t SeekToPrevKeyFrame(); virtual bool Eof() const; virtual double CacheSize() const { return m_pStream->CacheSize(); } protected: StreamPacket* ReadPacket(); virtual void Flush(); static const size_t PADDING = 128; // padding after local buffer for decommpress IMediaReadStream* m_pStream; StreamPacket* m_pPacket; union { char* m_pFormat; WAVEFORMATEX* m_WF; MPEGLAYER3WAVEFORMAT* m_MP3WF; }; size_t m_uiFormatSize; int m_iEof; avm::vector rem_buffer; size_t rem_size; size_t rem_local; size_t rem_limit; int rem_flags; framepos_t m_uiLastPos; double m_dLastTime; }; AVM_END_NAMESPACE; #endif // AVIPLAY_READSTREAM_H avifile-0.7.48~20090503.ds/lib/aviread/ReadStreamA.cpp0000644000175000017500000005051711176341630020770 0ustar yavoryavor/* * audio stream functions */ #include "ReadStreamA.h" #include "avifmt.h" #include "avm_creators.h" #include "audiodecoder.h" #include "avm_cpuinfo.h" #include "utils.h" #include "avm_output.h" #include // memcpy #include #include #include #include #include #include AVM_BEGIN_NAMESPACE; static const short mpeg_bitrates[6][16] = { /* -== MPEG-1 ==- */ /* Layer I */ { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 }, /* Layer II */ { 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 }, /* Layer III */ { 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 }, /* -== MPEG-2 LSF ==- */ /* Layer I */ { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256 }, /* Layers II & III */ { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 }, { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 }, }; static const int mpeg_sample_rates[4][3] = { { 44100, 48000, 32000 }, // MPEG1 { 22050, 24000, 16000 }, // MPEG2 { 0, 0, 0 }, // ERR { 11025, 12000, 8000 } // MPEG2.5 }; /* bits name comments -------------------------------------------------- 12 sync 0xFFF (12 bit is 0 for mpeg2.5 !) 1 version 1=mpeg1.0, 0=mpeg2.0 2 lay 4-lay = layerI, II or III 1 error protection 0=yes, 1=no 4 bitrate_index see table below 2 sampling_freq see table below 1 padding 1 extension see table below 2 mode see table below 2 mode_ext used with "joint stereo" mode 1 copyright 0=no 1=yes 1 original 0=no 1=yes 2 emphasis see table below -------------------------------------------------- */ #define MPEG_ID_MASK 0x00180000 #define MPEG_MPEG1 0x00180000 #define MPEG_MPEG2 0x00100000 #define MPEG_MPEG2_5 0x00000000 #define MPEG_LAYER_MASK 0x00060000 #define MPEG_LAYER_III 0x00020000 #define MPEG_LAYER_II 0x00040000 #define MPEG_LAYER_I 0x00060000 #define MPEG_PROTECTION 0x00010000 #define MPEG_BITRATE_MASK 0x0000F000 #define MPEG_FREQUENCY_MASK 0x00000C00 #define MPEG_PAD_MASK 0x00000200 #define MPEG_PRIVATE_MASK 0x00000100 #define MPEG_MODE_MASK 0x000000C0 #define MPEG_MODE_EXT_MASK 0x00000030 #define MPEG_COPYRIGHT_MASK 0x00000008 #define MPEG_HOME_MASK 0x00000004 #define MPEG_EMPHASIS_MASK 0x00000003 #define LAYER_I_SAMPLES 384 #define LAYER_II_III_SAMPLES 1152 Mp3AudioInfo::Mp3AudioInfo() : frame_size(0) {} // MP3 header needs 40 bytes int Mp3AudioInfo::Init(const void* buf, int fast) { header = avm_get_be32(buf); //AVM_WRITE("audio reader", "HDR %x %.4s\n", header, (char*)&header); // CHECK if it's mpeg & Get the sampling frequency int frequency_index; if ((header & 0xffe00000) != 0xffe00000 || ((layer = 4 - ((header & MPEG_LAYER_MASK) >> 17)) > 3) || ((mode = (MPEG_MODE) (3 - ((header >> 19) & 3))) == Mp3AudioInfo::ERR) // MPEG_ID_MASK || ((frequency_index = (header & MPEG_FREQUENCY_MASK)) == MPEG_FREQUENCY_MASK)) return 0; // not mp3 header sample_rate = mpeg_sample_rates[mode][frequency_index >> 10]; //AVM_WRITE("audio reader", "HDR %x m:%d fi:%d sr:%d\n", header, mode, frequency_index, sample_rate); // Get stereo mode index stereo_mode = (STEREO_MODE)((header & MPEG_MODE_MASK) >> 6); num_channels = (stereo_mode == MODE_MONO) ? 1 : 2; // Get layer samples_per_frame = LAYER_I_SAMPLES; if (layer > 1) samples_per_frame = LAYER_II_III_SAMPLES; start_offset = 40; if (fast) return start_offset; if (mode == MPEG2) samples_per_frame /= 2; else if (mode == MPEG2_5) samples_per_frame /= 4; // Check for VBR stream (Xing header) int b = 4; if (header & MPEG_ID_MASK) b += (stereo_mode != MODE_MONO) ? 32 : 17; // mpeg1 mpeg2 else b += (stereo_mode != MODE_MONO) ? 17 : 9; // mpeg2_5 xing = (avm_get_le32((uint8_t*)buf + b) == mmioFOURCC('X', 'i', 'n', 'g')); bitrate = (xing) ? 0 : GetBitrate(); //printf ("%d %d l:%d %d ch:%d\n", sample_rate, bitrate, layer, samples_per_frame, num_channels); frame_size = GetFrameSize(); if (xing) start_offset += frame_size + 4; return start_offset; } int Mp3AudioInfo::GetBitrate() const { int bitrate_idx = (header & MPEG_BITRATE_MASK) >> 12; int layer_idx = layer + ((layer > 0 && mode == MPEG1) ? -1 : 2); return mpeg_bitrates[layer_idx][bitrate_idx] * 1000; } int Mp3AudioInfo::GetFrameSize() const { int tmp_bitrate = GetBitrate(); if (!tmp_bitrate) return 0; int ret = (layer == 1) ? 48 : 144; if (mode == MPEG2 || mode == MPEG2_5) ret /= 2; //ret /= 4; //AVM_WRITE("audio reader", "%d %d %d \n", ret, tmp_bitrate, sample_rate); ret = ret * tmp_bitrate / sample_rate; if (header & MPEG_PAD_MASK) ret++; return ret; } void Mp3AudioInfo::PrintHeader() const { static const char sf[][8] = { "MPEG1", "MPEG2", "ERR", "MPEG2.5" }; static const char sm[][13] = { "Stereo", "JointStereo", "DualChannel", "Mono" }; if (frame_size) AVM_WRITE("audio reader", "%s Layer-%d %dHz %dkbps %s %s" "(%d,%d,%d)\n", sf[mode], layer, sample_rate, bitrate / 1000, sm[stereo_mode], xing ? "Xing " : "", samples_per_frame, start_offset, frame_size); } ReadStreamA::ReadStreamA(IMediaReadStream* stream) : ReadStream(stream), m_pAudiodecoder(0), m_uiMinSize(0), m_uiSrcSize(0), m_uiRead(0), m_bIsMp3(false) { // FIXME - asf reading needs to know also about VideoStreams // currently this isn't possible to use it this way // Flush(); // fix incorrect header if (m_WF->wFormatTag == 0x55 && (m_WF->cbSize != 12 || m_uiFormatSize < sizeof(MPEGLAYER3WAVEFORMAT))) { if (m_uiFormatSize < sizeof(MPEGLAYER3WAVEFORMAT)) AVM_WRITE("audio reader", "WARNING: WAVEFORMAT header missing MP3 header extension for MP3 audio track (sz:%lu != %" PRIsz ")\n", (unsigned long)m_uiFormatSize, sizeof(MPEGLAYER3WAVEFORMAT)); else AVM_WRITE("audio reader", "WARNING: WAVEFORMAT header missing MP3 header extension for MP3 audio track (cb:%lu != 12)\n", (unsigned long)m_WF->cbSize); m_uiFormatSize = sizeof(MPEGLAYER3WAVEFORMAT); char* n = new char[m_uiFormatSize]; if (n) { memcpy(n, m_pFormat, sizeof(WAVEFORMATEX)); delete[] m_pFormat; m_pFormat = n; } m_WF->cbSize = sizeof(MPEGLAYER3WAVEFORMAT) - sizeof(WAVEFORMATEX);//12 // everything past WAVEFORMATEX must be kept in stream native format avm_set_le16(&m_MP3WF->wID, MPEGLAYER3_ID_MPEG); // These values based on an old avm_set_le32(&m_MP3WF->fdwFlags, MPEGLAYER3_FLAG_PADDING_OFF); // Usenet post!! avm_set_le16(&m_MP3WF->nBlockSize, 0); avm_set_le16(&m_MP3WF->nFramesPerBlock, 1); avm_set_le16(&m_MP3WF->nCodecDelay, 1393); // 0x571 for F-IIS MP3 Codec } m_uiBps = m_WF->nAvgBytesPerSec; m_uiSampleSize = m_WF->nBlockAlign; switch (m_WF->wFormatTag) { case 0x55: case 0x50: { Mp3AudioInfo ai; Mp3AudioInfo last; char b[8]; size_t bf = 0; size_t rb = 0; int maxloop = 3000; memset(&last, 0, sizeof(last)); while (ai.frame_size == 0) { if (bf) { memmove(b, b + 1, bf); bf--; // next byte } size_t samp, bytes = 4 - bf; //printf("BYTES %" PRIsz " %" PRIsz "\n", bytes, bf); // SampleSize is 1 if (ReadDirect(b + bf, bytes, bytes, samp, bytes) < 0) //|| !bytes) break; //printf("Mp3Header READ %" PRIsz " %" PRIsz "\n", bytes, samp); bf += bytes; rb += bytes; //printf("RB %d %d 0x%x\n", rb, bytes, *(int*)b); if (!ai.Init(b, true)) continue; //ai.PrintHeader(); if (rem_size > 36 && rem_local >= 4) ai.Init(&rem_buffer[rem_local - 4]); // full init else { ai.xing = 0; ai.bitrate = ai.GetBitrate(); ai.frame_size = ai.GetFrameSize(); } // now we have found 4 bytes which might be mp3 header // let's do some more checking //printf("BFSCAN %d %d %d\n", bf, rem_size, rem_local); if ((ai.frame_size - 4) == rem_size && rem_local >= 4) { // heuristic 1: // looks like we have found reasonable good mp3 header // it's matching block boundary of the input frame //printf("YES 1st. match\n"); break; } //printf("AAA %d %d\n", ai.frame_size, rem_size); if ((ai.frame_size - 4) < rem_size) { // we could check if the next packet has the same // characteristic Mp3AudioInfo bi; if (bi.Init(&rem_buffer[rem_local + ai.frame_size - 4], true) && bi.sample_rate == ai.sample_rate && bi.layer == ai.layer) { //printf("YES 2nd. match\n"); break; } ai.frame_size = 0; continue; // failed - try to get next mp3 header } // this is unsolved if we get here with to short packet //ai.PrintHeader(); if (maxloop--) { //last.PrintHeader(); if (last.sample_rate == ai.sample_rate && last.layer == ai.layer) break; last = ai; ai.frame_size = 0; } else AVM_WRITE("audio reader", "failed to easily identify mp3 header! (%lu, %lu, %lu)\n", (unsigned long)rem_size, (unsigned long)rem_local, (unsigned long)ai.frame_size); //int ss = 0; for (uint_t x = 0; x < bytes; x++) ss += b[x]; //AVM_WRITE("audio reader", "HR %d lb %d samp: %d %d sum %d\n", hr, bytes, samp, bf, ss); } if (ai.frame_size) { if (rem_local >= 4) { // restore last mp3 header rem_local -= 4; // so unread rem_size += 4; rb -= 4; } ai.PrintHeader(); m_WF->nChannels = (uint16_t)ai.num_channels; m_WF->nSamplesPerSec = ai.sample_rate; m_WF->nBlockAlign = 1; // Windows likes that this way... //printf("BLOCKALIGN %d %d\n", m_WF->nBlockAlign, ai.frame_size); m_uiSampleSize = ai.frame_size; if (ai.layer == 3) { if (m_WF->wFormatTag != 0x55) { AVM_WRITE("audio reader", "WARNING: fixing bad MP3 Layer3 tag 0x%x -> 0x55\n", m_WF->wFormatTag); m_WF->wFormatTag = 0x55; // for layer3 }// FIXME ai.xing if (!ai.xing && stream->GetSampleSize()) { if (ai.bitrate) { // hard to calculate for VBR - so check only CBR int bt = m_uiBps - ai.bitrate / 8; if (bt < 0) bt = -bt; //labs // do bitrate fix - but only if the difference // is huge // I've seen stream where packets where // 16kbps 24kbps 16kbps --> ~20kbps if (bt > 1000) { if (stream->FixAvgBytes(ai.bitrate / 8) == 0) { AVM_WRITE("audio reader", "WARNING: fixing wrong avg bitrate %dB/s -> %dB/s\n", m_uiBps, ai.bitrate / 8); m_uiBps = m_WF->nAvgBytesPerSec = ai.bitrate / 8; } } } //printf("SAMELESIZE %d\n", stream->GetSampleSize()); int bs = avm_get_le16(&m_MP3WF->nBlockSize) - ai.frame_size; if (bs < 0) bs = -bs; if (bs > 256) { AVM_WRITE("audio reader", "WARNING: fixing bad MP3 block size %d -> %d\n", avm_get_le16(&m_MP3WF->nBlockSize), ai.frame_size); avm_set_le16(&m_MP3WF->nBlockSize, (uint16_t)ai.frame_size); } } } else { if (m_WF->wFormatTag != 0x50) { AVM_WRITE("audio reader", "WARNING: fixing bad MP3 Layer2 tag 0x%x - should be 0x50\n", m_WF->wFormatTag); m_WF->wFormatTag = 0x50; // for layer2 } } if (rb > 0) AVM_WRITE("audio reader", "junk size at the begining: time:%.2fs pos:%u (%" PRIsz "b)\n", GetTime(), GetPos(), rb); } } if (m_WF->wFormatTag == 0x55) m_bIsMp3 = true; break; case 0x2000: if (m_WF->nSamplesPerSec > 48000) m_WF->nSamplesPerSec = 48000; break; } //printf("AFTERCONST pos: %d l:%d s:%d\n", m_uiLastPos, rem_local, rem_size); } ReadStreamA::~ReadStreamA() { StopStreaming(); } void ReadStreamA::Flush() { ReadStream::Flush(); if (m_pAudiodecoder) m_pAudiodecoder->Flush(); } // FIXME - when m_pAudiodecoder is running we may supply real data size_t ReadStreamA::GetAudioFormat(void* wf, size_t size) const { //printf("DATE %p %d\n", wf, size); //for (int i = 0; i < m_format_size; i++) // printf("### %d %x\n", i, ((unsigned char*)m_format)[i]); if (wf) memcpy(wf, m_pFormat, (size < m_uiFormatSize) ? size : m_uiFormatSize); return m_uiFormatSize; } size_t ReadStreamA::GetFrameSize() const { return m_uiMinSize; } size_t ReadStreamA::GetOutputFormat(void* format, size_t size) const { if (!m_pAudiodecoder) return 0; if (!format || size < sizeof(WAVEFORMATEX)) return sizeof(WAVEFORMATEX); return m_pAudiodecoder->GetOutputFormat((WAVEFORMATEX*)format); } framepos_t ReadStreamA::GetPos() const { //printf("READA %d\n", m_uiSampleSize); framepos_t fp = m_uiLastPos; if (m_uiSampleSize) { //printf("READAAAAA %d %d %d\n", (int)m_uiLastPos, (int)rem_size, (int)m_uiRead); fp += (framepos_t)(((int)m_uiRead - (int)rem_size) / (int)m_uiSampleSize); } return fp; } double ReadStreamA::GetTime(framepos_t pos) const { //AVM_WRITE("audio reader", "AGetTime: %d last:%f rem_size:%d bps:%d\n", pos, m_dLastTime, rem_size, m_uiBps); if (pos == ERR) { // Compensate time which is in buffer double smtime = m_dLastTime; if (m_uiBps > 0) { //AVM_WRITE("audio reader", "AudioGetTime remsize %f time: %f pos: %d\n", rem_size/(double)m_uiBps, smtime, pos); // rem_size must be kept small otherwise there will be sync problems with VBR audio smtime += (double)((int)m_uiRead - (int)rem_size) / (double)m_uiBps; if (smtime < 0.) smtime = 0.; } //printf("ret %f -> %f %" PRIsz " %" PRIsz " (%f)\n", m_dLastTime, smtime, rem_size, // m_uiRead, (double)rem_size/(double)m_uiBps); return smtime; } return m_pStream->GetTime(pos); } bool ReadStreamA::IsStreaming() const { return (m_pAudiodecoder != NULL); } int ReadStreamA::ReadFrames(void* buffer, size_t bufsize, size_t samples, size_t& samples_read, size_t& bytes_read) { if (!m_pAudiodecoder || !samples || bufsize < m_uiMinSize) return -1; bool bHadPacket = false; //printf("***ReadFrames*** MIN %d SRC %d reml:%d rems:%d bs:%d\n", m_uiMinSize, srcsize, rem_local, rem_size, bufsize); if (0 && m_bIsMp3 && rem_size >= 4) { // for vbr audio keep buffer minimal for the good timing Mp3AudioInfo ai; if (ai.Init(&rem_buffer[rem_local], false)) m_uiSrcSize = ai.frame_size * 2; //printf("RESULT %d %d\n", (int)m_uiSrcSize, (int)ai.frame_size); } //printf("REMSIZE s:%" PRIsz " lp:%" PRIsz " lim:%" PRIsz "\n", rem_size, rem_local, rem_limit); while (rem_size < m_uiSrcSize) { //printf("SRCSIZE %d %d %d sam:%d loc:%d lim:%d\n", (int)bufsize, (int)m_uiSrcSize, (int)rem_size, (int)samples, (int)rem_local, (int)rem_limit); //AVM_WRITE("audio reader", "***********convert %d -> %d (rem: %d) %f\n", m_uiSrcSize, bufsize, rem_size); //AVM_WRITE("audio reader", "-----------bufsize: %d rem_size: %d srcsize: %d samples: %d\n", bufsize, rem_size, m_uiSrcSize, samples); if (m_pPacket) { // wrap the buffer around if ((rem_local + m_uiSrcSize) >= rem_limit) { //printf("MEMMOVE s:%" PRIsz " lp:%" PRIsz "\n", rem_size, rem_local); memmove(&rem_buffer[0], &rem_buffer[rem_local], rem_size); rem_local = 0; } bHadPacket = true; //printf("PACKETSIZE %" PRIsz "\n", m_pPacket->size); // add samples to internal buffer rem_size += m_pPacket->Read(&rem_buffer[rem_local + rem_size], m_uiSrcSize - rem_size); m_uiRead = m_pPacket->GetRead(); if (m_pPacket->GetSize() > 0) break; // packet empty -> read next packet } if (!ReadPacket()) { m_uiRead = 0; if (!rem_size) m_iEof++; break; } //printf("-----SAMPLES %d %d\n", rem_size, p->size); } if (1 && m_bIsMp3) { while (rem_size > 4) { Mp3AudioInfo ai; // using AudioInfo is slower but also more safe... // this will skip bad mp3 chunks for Layer-3 audio stream if (ai.Init(&rem_buffer[rem_local], true) > 0 && ai.sample_rate == ((WAVEFORMATEX*)m_pFormat)->nSamplesPerSec && ai.layer == 3) break; //uint32_t t = avm_get_be32(rem_buffer + rem_local); printf("SKIP %d %d %x\n", rem_size, srcsize, t); // check next byte rem_local++; rem_size--; } } //for (int i = 0; i < 32; i++) printf(" %02x", (unsigned char) rem_buffer[rem_local + i]); printf("\n"); //Mp3AudioInfo ai; ai.Init(rem_buffer + rem_local, false); printf("AI SIZE %d\n", ai.frame_size); size_t ocnt = 0; size_t lr = 0; int hr = m_pAudiodecoder->Convert(&rem_buffer[rem_local], (m_uiSrcSize < rem_size) ? m_uiSrcSize : rem_size, (char*)buffer, bufsize, &lr, &ocnt); //int ds = open("/tmp/xyz", O_WRONLY | O_CREAT | O_APPEND, 0666); write(ds, &rem_buffer[rem_local], lr); close(ds); //int ws = open("/tmp/wav", O_WRONLY | O_CREAT | O_APPEND, 0666); write(ws, buffer, ocnt); close(ws); //printf("CONVSZE bytes:%d samples:%d r:%d rem_size:%d/%d bs:%d\n", (int)lr, (int)ocnt, hr, (int)rem_size, (int)m_uiSrcSize, (int)bufsize); if (hr >= 0 && (ocnt > 0 || lr > 0)) { if (lr > rem_size) lr = rem_size; rem_local += lr; rem_size -= lr; } else { //size_t ba = (m_uiSrcSize < rem_size) ? m_uiSrcSize : rem_size; size_t ba = ((WAVEFORMATEX*)m_pFormat)->nBlockAlign ? : 1; //printf("ERRORCONVSZE hr:%d lr:%d oc:%d rs:%d ba:%d\n", hr, (int)lr, (int)ocnt, (int)rem_size, (int)ba); if (rem_size > ba) { rem_size -= ba; rem_local += ba; } else if (!bHadPacket) rem_size = 0; ocnt = 0; } //AVM_WRITE("audio reader", "locread:%6d outputsz:%7d convsz:%6d lr:%d bs:%d\n", rem_local, ocnt, convsz, lr, rem_size); #if 0 unsigned char* p = (unsigned char*)buffer + convsz; for (int i = -32; i < 64; i++) { if (!(i % 8)) AVM_WRITE("audio reader", "\n%4d ", i); //AVM_WRITE("audio reader", " 0x%4.4x", abs(p[i] - p[i-2]) & 0xffff); AVM_WRITE("audio reader", " 0x%02X", p[i]); } #endif //printf("PACKET %d %d\n", bHadPacket, rem_size); //AVM_WRITE("audio reader", 1, "ReadStreamA::ReadFrames conv %d bytes to %d (%d)\n", // (int)rem_local, (int)ocnt, (int)bufsize); bytes_read = ocnt; samples_read = bytes_read; if (m_uiSampleSize > 1) samples_read /= m_uiSampleSize; //AVM_WRITE("audio reader", 3, "ReadStreamA: new sample is %d\n", m_pStream->GetPos()); return 0; } int ReadStreamA::SkipTo(double pos) { //printf("SKIPPOS %f %f %d bps:%d\n", pos, GetTime(), m_uiSampleSize, m_uiBps); if (!m_uiSampleSize) return 0; // FIXME: can't skip in VBR audio stream for now uint8_t buf[MINSIZE]; const size_t max = (sizeof(buf) - PADDING) / m_uiSampleSize; while ((pos - GetTime()) > 0.001) { size_t samples_read, bytes_read; size_t r = 2; if (m_uiBps > 0) { if ((r = size_t((pos - GetTime()) * m_uiBps) / m_uiSampleSize) == 0) break; // can't get any closer if (r > max) r = max; } AVM_WRITE("audio reader", 3, "Skip blocks %d %d pos:%f t:%f\n", (int)r, (int)m_uiSampleSize, pos, GetTime()); if (ReadDirect(buf, r * m_uiSampleSize, r, samples_read, bytes_read) < 0 || !bytes_read) break; } return 0; } int ReadStreamA::SeekTime(double timepos) { double t = GetTime(); if ((timepos - t) < 0.002 && (timepos - t) > -0.002 && timepos > 0.002) { //printf("---------SEEK DISCARD %f %f\n", t, timepos); return 0; } return ReadStream::SeekTime(timepos); } int ReadStreamA::StartStreaming(const char* privname) { if (m_pAudiodecoder) return 0; // already streaming m_pAudiodecoder = CreateDecoderAudio((WAVEFORMATEX*)m_pFormat, privname); if (!m_pAudiodecoder) { AVM_WRITE("audio reader", "Failed to initialize audio decoder for format 0x%x\n", ((WAVEFORMATEX*)m_pFormat)->wFormatTag); return -1; } m_uiMinSize = m_pAudiodecoder->GetMinSize(); if (m_uiMinSize < MINSIZE) m_uiMinSize = MINSIZE; m_uiSrcSize = m_pAudiodecoder->GetSrcSize(SRCSIZE); if (m_uiSrcSize < SRCSIZE) m_uiSrcSize = SRCSIZE; if (rem_limit < (MINSIZE + m_uiSrcSize)) { rem_limit = MINSIZE + m_uiSrcSize; rem_buffer.reserve(rem_limit + PADDING); memset(rem_buffer.begin(), 0, rem_limit + PADDING); } AVM_WRITE("audio reader", 1, "Initialize audio decoder - minsize: %" PRIsz " srsize: %" PRIsz "\n", m_uiMinSize, m_uiSrcSize); return 0; } int ReadStreamA::StopStreaming() { if (m_pAudiodecoder) { FreeDecoderAudio(m_pAudiodecoder); m_pAudiodecoder = 0; m_uiMinSize = 0; } return 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviread/ReadStreamA.h0000644000175000017500000000242111172614727020432 0ustar yavoryavor#ifndef AVIPLAY_READSTREAMA_H #define AVIPLAY_READSTREAMA_H #include "ReadStream.h" AVM_BEGIN_NAMESPACE; class IAudioDecoder; class AudioInfoMp3; class ReadStreamA : public ReadStream { public: ReadStreamA(IMediaReadStream* stream); virtual ~ReadStreamA(); virtual size_t GetAudioFormat(void* format = 0, size_t size = 0) const; virtual IAudioDecoder* GetAudioDecoder() const { return m_pAudiodecoder; } virtual size_t GetFrameSize() const; virtual size_t GetOutputFormat(void* format = 0, size_t size = 0) const; virtual framepos_t GetPos() const; virtual double GetTime(framepos_t frame = ERR) const; virtual bool IsStreaming() const; virtual int SkipTo(double pos); virtual int ReadFrames(void* buffer, size_t bufsize, size_t samples, size_t& samples_read, size_t& bytes_read); virtual int SeekTime(double pos); virtual int StartStreaming(const char*); virtual int StopStreaming(); protected: static const size_t MINSIZE = 8192; static const size_t SRCSIZE = 1536; virtual void Flush(); IAudioDecoder* m_pAudiodecoder; uint_t m_uiBps; size_t m_uiMinSize; size_t m_uiSrcSize; size_t m_uiSampleSize; size_t m_uiRead; bool m_bIsMp3; }; AVM_END_NAMESPACE; #endif // AVIPLAY_READSTREAMA_H avifile-0.7.48~20090503.ds/lib/aviread/ReadStreamV.cpp0000644000175000017500000003306111176642755021024 0ustar yavoryavor/* * ReadStreamV ( video AVI stream ) functions */ #include "ReadStreamV.h" #include "videodecoder.h" #include "avm_creators.h" #include "avm_fourcc.h" #include "avm_cpuinfo.h" #include "avm_output.h" #include "utils.h" #include #include AVM_BEGIN_NAMESPACE; //static float ttt = 0; //static float pttt = 0; //static float gttt = 0; // it's quite similar to qring - but // for now there are few differencies which do not // make possible to use qring instead of this VideoQueue class VideoQueue : public IImageAllocator { friend class ReadStreamV; static const size_t MAX_QSIZE = 100; public: VideoQueue(IVideoDecoder* vd, size_t maxsize, IImageAllocator* ia) : m_Free(MAX_QSIZE), m_Ready(MAX_QSIZE), m_pIA(ia), m_uiImages(0) { const BITMAPINFOHEADER& bh = vd->GetDestFmt(); IVideoDecoder::CAPS caps = vd->GetCapabilities(); uint_t align = 0; if (caps & IVideoDecoder::CAP_ALIGN16) align = 16; if (caps & IVideoDecoder::CAP_ALIGN64) align = 64; //printf("CAPS %d %d %p\n", align, caps, m_pIA); //BitmapInfo(bh).Print(); if (!m_pIA) m_pIA = this; while (m_Buffers.size() < maxsize) { CImage* ci = m_pIA->ImageAlloc(bh, (uint_t)m_Buffers.size(), align); if (!ci) { if (!m_Buffers.size() && m_pIA) { m_pIA = this; // no direct AVM_WRITE("video reader", "NODIRECT\n"); continue; } break; } m_Buffers.push_back(ci); //AVM_WRITE("video reader", "w:%d h:%d bpp:%d 0x%08x - %" PRIsz ":%" PRIsz "\n", bh.biWidth, bh.biHeight, bh.biBitCount, bh.biCompression, m_Buffers.size(), maxsize); } //assert(m_Buffers.size() < m_Free.capacity()); //for (unsigned i = 0; i < m_Buffers.size(); i++) m_Free.push(m_Buffers[i]); Flush(); //AVM_WRITE("video reader", "VideoQueue: size %d (%p)\n", m_Buffers.size(), ia); } virtual ~VideoQueue() { if (m_pIA) m_pIA->ReleaseImages(); for (size_t i = 0; i < m_Buffers.size(); i++) m_Buffers[i]->Release(); } void Flush() { m_Free.clear(); m_Ready.clear(); for (unsigned i = 0; i < m_Buffers.size(); i++) { m_Buffers[i]->Age(); m_Buffers[i]->m_lTimestamp = 0; m_Free.push(m_Buffers[i]); } } size_t GetSize() const { return m_Buffers.size(); } size_t GetFreeSize() const { return m_Free.size(); } size_t GetReadySize() const { return m_Ready.size(); } CImage* FrontFree() const { return m_Free.size() ? m_Free.front() : 0; } void PopFree() { if (m_Free.size()) m_Free.pop(); } void PushFree(CImage* ci) { if (m_Free.size() < m_Buffers.size()) m_Free.push(ci); } CImage* FrontReady() const { return m_Ready.size() ? m_Ready.front() : 0; } void PopReady() { if (m_Ready.size()) m_Ready.pop(); } void PushReady(CImage* ci) { if (m_Ready.size() < m_Buffers.size()) m_Ready.push(ci); } // implement ImageAllocator interface virtual size_t GetImages() const { return m_uiImages; } virtual CImage* ImageAlloc(const BITMAPINFOHEADER& bh, uint_t idx, size_t align) { CImage* ci = new CImage((const BitmapInfo*)&bh); if (ci) { m_uiImages++; ci->SetAllocator(this); } return ci; } virtual void ReleaseImages() { m_uiImages = 0; } protected: avm::qring m_Free; avm::qring m_Ready; IImageAllocator* m_pIA; avm::vector m_Buffers; size_t m_uiImages; }; ReadStreamV::ReadStreamV(IMediaReadStream* stream) :ReadStream(stream), m_pVideodecoder(0), m_pQueue(0), m_pFrame(0), m_pQueueAllocator(0), m_uiQueueSize(1), flip(0) { Flush(); } ReadStreamV::~ReadStreamV() { StopStreaming(); //printf("XXTTT %f %f %f\n", ttt, pttt, gttt); } bool ReadStreamV::Eof() const { if (GetBuffering() > 0) return false; //AVM_WRITE("video reader", "-- %d p:%d l:%d %d\n", ReadStream::Eof(), GetPos(), GetLength(), GetBuffering()); return ReadStream::Eof(); } void ReadStreamV::Flush() { ReadStream::Flush(); if (m_pVideodecoder) m_pVideodecoder->Flush(); if (m_pQueue) m_pQueue->Flush(); m_pFrame = 0; Update(); m_bHadKeyFrame = false; //m_bHadKeyFrame = true; } size_t ReadStreamV::GetBuffering(size_t* bufsz) const { size_t bs = m_uiQueueSize; size_t s; if (m_pQueue) { s = m_pQueue->GetReadySize(); bs = m_pQueue->GetFreeSize() + s; //printf("free:%" PRIsz " sz:%" PRIsz " fil:%" PRIsz "\n", m_pQueue->GetSize(), bs, s); } else s = 0; if (bufsz) *bufsz = bs; return s; } framepos_t ReadStreamV::GetPos() const { return m_uiVPos; } double ReadStreamV::GetTime(framepos_t framep) const { if (framep == ERR) return m_dVTime; return m_pStream->GetTime(framep); } /****************************************************************** These functions are meaningless for 'unknown type' stream ******************************************************************/ size_t ReadStreamV::GetVideoFormat(void* format, size_t size) const { if (format) memcpy(format, m_pFormat, (size < m_uiFormatSize) ? size : m_uiFormatSize); return m_uiFormatSize; } CImage* ReadStreamV::GetFrame(bool readframe) { if (m_pVideodecoder) { //printf("GETGRAME %p %d\n", m_pFrame, readframe); // we decode frame here in direct unbuffered mode // it's not being decoded in separate thread if (!m_pFrame && readframe) ReadFrame(); if (m_pFrame) { CImage* ci = m_pFrame; ci->AddRef(); m_pQueue->PopReady(); //printf("GETFRAME:READY %d f:%d\n", m_pQueue->GetReadySize(),m_pQueue->GetFreeSize()); m_pQueue->PushFree(m_pFrame); m_pFrame = m_pQueue->GetReadySize() ? m_pQueue->FrontReady() : 0; //printf("GetFrame new: %p (ready: %d)\n", m_pFrame, m_pQueue->GetReadySize()); Update(); return ci; } //else { printf("Avifile ERROR\n"); abort(); } } return 0; } size_t ReadStreamV::GetFrameSize() const { return (m_pVideodecoder) ? m_pVideodecoder->GetDestFmt().biSizeImage : 0; } size_t ReadStreamV::GetOutputFormat(void* format, size_t size) const { if (!m_pVideodecoder) return 0; if (format) memcpy(format, &m_pVideodecoder->GetDestFmt(), (size < sizeof(BITMAPINFOHEADER)) ? size : sizeof(BITMAPINFOHEADER)); return sizeof(BITMAPINFOHEADER); } int ReadStreamV::ReadDirect(void* buffer, size_t bufsize, size_t samples, size_t& samples_read, size_t& bytes_read, int* flags) { int r = ReadStream::ReadDirect(buffer, bufsize, samples, samples_read, bytes_read, flags); m_pFrame = 0; Update(); return r; } int ReadStreamV::ReadFrame(bool render) { if (!m_pVideodecoder) return -1; CImage* pFrame = 0; int hr = -1; for (;;) { if (!ReadPacket()) { // regular Eof usually - we should check if we have reached last pos m_iEof++; return -1; } m_iEof = 0; size_t size = m_pPacket->GetSize(); //printf("pkttm %" PRId64 " %d\n", m_pPacket->timestamp, size); if (size > 0) { if (!pFrame) { if (m_pQueue) { //printf("READFRAME F:%" PRIsz " R:%" PRIsz " %p\n", m_pQueue->GetFreeSize(), m_pQueue->GetReadySize(), pFrame); if (!m_pQueue->GetFreeSize()) { pFrame = m_pQueue->FrontReady(); m_pQueue->PopReady(); m_pQueue->PushFree(pFrame); AVM_WRITE("video reader", 0, "???NO FREE FRAME???\n"); //abort(); } const BITMAPINFOHEADER& bh = m_pVideodecoder->GetDestFmt(); pFrame = m_pQueue->FrontFree(); if (!pFrame) return -1; if (pFrame->GetFmt()->biCompression != bh.biCompression) { int x = pFrame->Format(); //printf("Frame format: 0x%x %.4s 0x%x %.4s\n", //x, (char*)&x, bh.biCompression, (char*)&bh.biCompression); //frame->GetImage()->GetFmt()->Print(); //AVM_WRITE("video reader", "FORMAT doesn't match!!!\n"); // reinitialize queue delete m_pQueue; m_pQueue = 0; } } if (!m_pQueue) { AVM_WRITE("video reader", 1, "queue create: %" PRIsz " %p\n", m_uiQueueSize, m_pQueueAllocator); m_pFrame = 0; if ((m_pQueue = new VideoQueue(m_pVideodecoder, m_uiQueueSize, m_pQueueAllocator))) pFrame = m_pQueue->FrontFree(); } assert(pFrame); } //printf("READFRAME F:%d R:%d %p\n", m_pQueue->GetFreeSize(), m_pQueue->GetReadySize(), pFrame); if (m_pPacket->GetTimestamp() != StreamPacket::NO_TIMESTAMP) { pFrame->m_uiPosition = m_pPacket->GetPos(); pFrame->m_lTimestamp = m_pPacket->GetTimestamp(); } if (avm_is_mmx_state()) { m_pPacket->Read(0, m_pPacket->GetSize()); AVM_WRITE("AVI Read", "Internal ERROR - avifile left MMX STATE!\n"); break; } //uint_t sum = 0; for (uint_t i = 0 ; i < m_pPacket->size; i++) sum += ((unsigned char*) m_pPacket->memory)[i]; //printf("Mem %p Size %d Flg %d PACKETSUM %d pos: %d size: %d\n", m_pPacket->memory, m_pPacket->size, m_pPacket->flags, sum, m_pPacket->position, m_pPacket->size); //int s = 0; for (unsigned i = 0; i < lBytes; i++) s += ((unsigned char*)temp_buffer)[i]; printf("SUM %d\n", s); hr = 0; if (!m_bHadKeyFrame && m_pPacket->GetFlags()) m_bHadKeyFrame = true; CImage* pOut = 0; //printf("FRAMEin %p %lld\n", pFrame, m_pPacket->timestamp); if (m_bHadKeyFrame) { if (m_pPacket->GetRead()) memset(m_pPacket->GetData() + m_pPacket->GetSize(), 0, 8); hr = m_pVideodecoder->DecodeFrame(pFrame, m_pPacket->GetData(), size, m_pPacket->GetFlags(), render, &pOut); } if (avm_is_mmx_state()) { AVM_WRITE("AVI Read", "Warning - codec left MMX STATE!\n"); #if ARCH_X86 __asm__ __volatile__ ("emms");// ::: "memory" ); #endif } m_pPacket->Read(0, (hr <= 0) ? size : hr & ~(IVideoDecoder::NEXT_PICTURE | IVideoDecoder::NO_PICTURE)); if (hr >= 0) { //printf("PACKET %p %f %f\n", frame, m_pPacket->timestamp, m_dSubBTime); //printf("SETTIME %d %f %f\n", m_uiLastPos, m_dLastTime, frame->GetTime()); // even when there is no new picture always // rotate buffers - as it could be used to store // temporal image (i.e. by ffmpeg) if (hr & IVideoDecoder::NEXT_PICTURE) { //printf("GET NEW %f\n", m_pPacket->timestamp); assert(m_pQueue->GetFreeSize()); m_pQueue->PopFree(); pFrame = 0; //printf("NEXTPIC %d\n", m_pQueue->GetFreeSize()); hr &= ~IVideoDecoder::NEXT_PICTURE; } if (hr & IVideoDecoder::NO_PICTURE) { if (pOut) { m_pQueue->PushFree(pOut); printf("???OUTPUSH-NOPICTURE %" PRId64 " FREE: %" PRIsz "\n", pOut->m_lTimestamp, m_pQueue->GetFreeSize()); } //printf("NOPICTURE %x\n", hr); continue; } //printf("HAVE PICTURE %p %p\n", pOut, pFrame); if (!pOut) { if (pFrame) { m_pQueue->PopFree(); //printf("NOOUTPOP_FRAME %d\n", m_pQueue->GetFreeSize()); } } else // pOut pFrame = pOut; if (render) { if (!m_pQueue->m_Ready.size() || m_pQueue->m_Ready.back() != pFrame) m_pQueue->PushReady(pFrame); else printf("FFMPEG BUG - repeated insert\n"); m_pFrame = m_pQueue->FrontReady(); } else m_pQueue->PushFree(pFrame); #if 0 printf("PACKET %p Frame %p Queue %p\n", m_pPacket, pFrame, m_pQueue); if (pFrame) printf("Packet %d %d 0x%x t:%f p:%d ft:%f f:%d tp:%d p:%p\n", m_pPacket->size, m_pPacket->read, hr, m_pPacket->timestamp / 1000000.0, m_pPacket->position, pFrame->m_lTimestamp / 1000000.0, pFrame->m_iType, m_pQueue->GetFreeSize(), pOut); #endif //printf("FRAMEout %p %f\n", pFrame, pFrame->m_dTimestamp); pFrame = 0; ///printf("SETPF %d %d\n", m_pQueue->GetReadySize(), m_pQueue->GetFreeSize()); //printf("SetFrame %p %d %f\n", m_pFrame, m_pFrame->GetPos(), m_pFrame->GetTime()); break; } } } ReadPacket(); // just to be sure we always try next packet Update(); return hr; } framepos_t ReadStreamV::SeekToKeyFrame(framepos_t pos) { AVM_WRITE("video reader", 1, "SeekToKeyFrame() %d\n", pos); framepos_t n = ReadStream::SeekToKeyFrame(pos); if (!(GetFrameFlags(0) & KEYFRAME)) n = SeekToPrevKeyFrame(); return n; } double ReadStreamV::SeekTimeToKeyFrame(double timepos) { AVM_WRITE("video reader", 1, "SeekTimeToKeyFrame() %f\n", timepos); double t = ReadStream::SeekTimeToKeyFrame(timepos); if (t >= 0. && !(GetFrameFlags(0) & KEYFRAME)) SeekToPrevKeyFrame(); return GetTime(); } int ReadStreamV::SetDirection(bool d) { flip = d; return 0; } int ReadStreamV::SetBuffering(size_t maxsz, IImageAllocator* ia) { m_pFrame = 0; delete m_pQueue; m_pQueue = 0; m_pQueueAllocator = ia; m_uiQueueSize = maxsz; AVM_WRITE("video reader", 5, "Queue size %" PRIsz "\n", m_uiQueueSize); return 0; } int ReadStreamV::SetOutputFormat(void* bi, size_t size) { if (!m_pVideodecoder) return -1; // FIXME AVM_WRITE("video reader", "ReadStreamV::SetOutputFormat: not implemented!\n"); return -1; //not implemented } int ReadStreamV::StartStreaming(const char* privname) { if (m_pVideodecoder) return 0; // already streaming if (!(m_pVideodecoder = CreateDecoderVideo(*(const BITMAPINFOHEADER*)m_pFormat, 24, flip, privname))) return -1; m_pVideodecoder->Start(); AVM_WRITE("video reader", 2, "ReadStreamV::StartStreaming() %f\n", m_dLastTime); return 0; } int ReadStreamV::StopStreaming() { if (m_pVideodecoder) { AVM_WRITE("video reader", "ReadStreamV::StopStreaming()\n"); FreeDecoderVideo(m_pVideodecoder); m_pVideodecoder = 0; m_pFrame = 0; delete m_pQueue; m_pQueue = 0; } return 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviread/ReadStreamV.h0000644000175000017500000000420311165745376020466 0ustar yavoryavor#ifndef AVIPLAY_AVIREADSTREAM_H #define AVIPLAY_AVIREADSTREAM_H #include "ReadStream.h" #include "image.h" //#include AVM_BEGIN_NAMESPACE; class IVideoDecoder; class VideoQueue; class ReadStreamV : public ReadStream { public: ReadStreamV(IMediaReadStream* stream); virtual ~ReadStreamV(); virtual bool Eof() const; virtual size_t GetBuffering(size_t* b = 0) const; virtual IVideoDecoder* GetVideoDecoder() const { return m_pVideodecoder; } virtual CImage* GetFrame(bool readframe = false); virtual size_t GetFrameSize() const; virtual framepos_t GetPos() const; virtual size_t GetOutputFormat(void* format = 0, size_t size = 0) const; virtual double GetTime(framepos_t frame = ERR) const; virtual size_t GetVideoFormat(void* format, size_t size) const; virtual bool IsStreaming() const { return (m_pVideodecoder != 0); } virtual int ReadDirect(void* buffer, size_t bufsize, size_t samples, size_t& samples_read, size_t& bytes_read, int* flags = 0); virtual int ReadFrame(bool render = true); virtual framepos_t SeekToKeyFrame(framepos_t pos); virtual double SeekTimeToKeyFrame(double pos); virtual int SetDirection(bool d); virtual int SetBuffering(size_t maxsz = 1, IImageAllocator* ia = 0); virtual int SetOutputFormat(void* bi, size_t size); virtual int StartStreaming(const char*); virtual int StopStreaming(); protected: /* flush all precached frames */ virtual void Flush(); void ResetBuffers(); void Update() { if (m_pFrame) { m_dVTime = (double)m_pFrame->m_lTimestamp / 1000000.; m_uiVPos = m_pFrame->m_uiPosition; //printf("UpdateF %f %d\n", m_dVTime, m_uiVPos); } else { m_dVTime = m_dLastTime; m_uiVPos = m_uiLastPos; //printf("UpdateL %f %d\n", m_dVTime, m_uiVPos); } } IVideoDecoder* m_pVideodecoder; VideoQueue* m_pQueue; CImage* m_pFrame; IImageAllocator* m_pQueueAllocator; double m_dVTime; uint_t m_uiVPos; size_t m_uiQueueSize; int flip; bool m_bCapable16b; bool m_bHadKeyFrame; }; AVM_END_NAMESPACE; #endif // AVIPLAY_READSTREAM_H avifile-0.7.48~20090503.ds/lib/aviread/StreamInfo.cpp0000644000175000017500000001275111174014533020702 0ustar yavoryavor#include "StreamInfoPriv.h" #include "utils.h" #include #include AVM_BEGIN_NAMESPACE; StreamInfo::StreamInfoPriv::StreamInfoPriv() { memset(this, 0, sizeof(*this)); } StreamInfo::StreamInfo() : m_p(new StreamInfoPriv) { // FIXME - check other returning values or rewrite this class m_p->m_dLengthTime = 0.; m_p->m_Type = Video; } StreamInfo::StreamInfo(const StreamInfo& si) : m_p(new StreamInfoPriv) { *m_p = *si.m_p; } StreamInfo::~StreamInfo() { delete m_p; } StreamInfo::Type StreamInfo::GetType() const { return m_p->m_Type; } uint_t StreamInfo::GetFormat() const { return m_p->m_uiFormat; } const char* StreamInfo::GetFormatName() const { return (m_p->m_Type == Audio) ? avm_wave_format_name((short)m_p->m_uiFormat) : avm_fcc_name(m_p->m_uiFormat); } double StreamInfo::GetBps() const { return (m_p->m_dLengthTime && m_p->m_dLengthTime < 0x7fffffff && GetStreamSize() > 0) ? (double) GetStreamSize() / m_p->m_dLengthTime : (double) m_p->m_uiBps; } double StreamInfo::GetFps() const { return (m_p->m_dLengthTime) ? GetStreamFrames() / m_p->m_dLengthTime : 0.; } double StreamInfo::GetLengthTime() const { return m_p->m_dLengthTime; } int64_t StreamInfo::GetStreamSize() const { return m_p->m_uiKfFramesSize + m_p->m_uiFramesSize; } uint_t StreamInfo::GetStreamFrames() const { return m_p->m_uiKfFrames + m_p->m_uiFrames; } size_t StreamInfo::GetMaxKfFrameSize() const { return m_p->m_uiMaxKfFrameSize; } size_t StreamInfo::GetMinKfFrameSize() const { return m_p->m_uiMinKfFrameSize; } size_t StreamInfo::GetAvgKfFrameSize() const { return (m_p->m_uiKfFrames > 0) ? (m_p->m_uiKfFramesSize / m_p->m_uiKfFrames) : 0; } int64_t StreamInfo::GetKfFramesSize() const { return m_p->m_uiKfFramesSize; } uint_t StreamInfo::GetKfFrames() const { return m_p->m_uiKfFrames; } size_t StreamInfo::GetMaxFrameSize() const { return m_p->m_uiMaxFrameSize; } size_t StreamInfo::GetMinFrameSize() const { return m_p->m_uiMinFrameSize; } size_t StreamInfo::GetAvgFrameSize() const { return (m_p->m_uiFrames > 0) ? (m_p->m_uiFramesSize / m_p->m_uiFrames) : 0; } int64_t StreamInfo::GetFramesSize() const { return m_p->m_uiFramesSize; } uint_t StreamInfo::GetFrames() const { return m_p->m_uiFrames; } size_t StreamInfo::GetSampleSize() const { return m_p->m_iSampleSize; } int StreamInfo::GetQuality() const { return m_p->m_iQuality; } int StreamInfo::GetVideoWidth() const { return (m_p->m_Type == Video) ? m_p->vid.m_iWidth : -1; } int StreamInfo::GetVideoHeight() const { return (m_p->m_Type == Video) ? m_p->vid.m_iHeight : -1; } float StreamInfo::GetAspectRatio() const { return (m_p->m_Type == Video) ? m_p->vid.m_fAspect : -1; } int StreamInfo::GetAudioChannels() const { return (m_p->m_Type == Audio) ? m_p->aud.m_iChannels : -1; } int StreamInfo::GetAudioSamplesPerSec() const { return (m_p->m_Type == Audio) ? m_p->aud.m_iSamplesPerSec : -1; } int StreamInfo::GetAudioBitsPerSample() const { return (m_p->m_Type == Audio) ? m_p->aud.m_iBitsPerSample : -1; } avm::string StreamInfo::GetString() const { double keyproc = 0., delproc = 0.; double skeyproc = 0., sdelproc = 0.; char buffer[2048]; if (GetStreamFrames() > 0) { keyproc = GetKfFrames()/(double)GetStreamFrames() * 100.; delproc = 100. - keyproc; skeyproc = (GetStreamSize() > 0) ? (double)GetKfFramesSize()/(double)GetStreamSize() : 0.; skeyproc *= 100.; sdelproc = 100. - skeyproc; } int i = 0; if (m_p->m_Type == Audio) { i = sprintf(buffer, " AudioInfo - %s (0x%x) %dHz %db Channels: %d Sample Size: %" PRIsz "\n", avm_wave_format_name((short)GetFormat()), GetFormat(), GetAudioSamplesPerSec(), GetAudioBitsPerSample(), GetAudioChannels(), GetSampleSize()); } else if (m_p->m_Type == Video) { char b[4]; avm_set_le32(b, GetFormat()); i = sprintf(buffer, " VideoInfo - %.4s (0x%x) %dx%d Fps: %.3f Quality: %d\n", b, GetFormat(), GetVideoWidth(), GetVideoHeight(), GetFps(), GetQuality()); } char tlen[30]; sprintf(tlen, "%.2f", GetLengthTime()); if (GetLengthTime() >= 0x7fffffff) strcpy(tlen, "Live"); i += sprintf(buffer + i, " Time length: %s Size: %.0f bytes (%.2fKB)\n" " Chunks: %d Bps: %.2f kbps (%.2fKB/s)\n", tlen, (double)GetStreamSize(), (double)GetStreamSize() / 1024., GetStreamFrames(), GetBps() * 8 / 1000, GetBps() / 1024.); if (m_p->m_Type == Video) { if (GetMinKfFrameSize() != ~0U || GetMinFrameSize() != ~0U) i += sprintf(buffer + i, " Key frames/size %.2f%% (%.2f%%) delta frames/size %.2f%%\n" " Min/avg/max/total key frame size: %" PRIsz "/%" PRIsz "/%" PRIsz " (%.2fKB) in %d frames\n" " Min/avg/max/total delta frame size: %" PRIsz "/%" PRIsz "/%" PRIsz "(%.2fKB) in %d frames\n", keyproc, skeyproc, sdelproc, GetMinKfFrameSize(), GetAvgKfFrameSize(), GetMaxKfFrameSize(), (double)GetKfFramesSize() / 1024., GetKfFrames(), GetMinFrameSize(), GetAvgFrameSize(), GetMaxFrameSize(), (double)GetFramesSize() / 1024., GetFrames()); } else if (m_p->m_Type == Audio) { if (GetMinKfFrameSize() != ~0U || GetMinFrameSize() != ~0U) i += sprintf(buffer + i, " Min/avg/max/total chunk size: %" PRIsz "/%" PRIsz "/%" PRIsz " (%.2fKB) in %d frames\n", GetMinKfFrameSize(), GetAvgKfFrameSize(), GetMaxKfFrameSize(), (double)GetKfFramesSize() / 1024., GetKfFrames()); } return avm::string(buffer); } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviread/StreamInfoPriv.h0000644000175000017500000000362611171733574021223 0ustar yavoryavor#ifndef STREAMINFOPRIV_H #define STREAMINFOPRIV_H #include "infotypes.h" AVM_BEGIN_NAMESPACE; struct StreamInfo::StreamInfoPriv { Type m_Type; uint32_t m_uiFormat; // stream format double m_dLengthTime; // time in seconds for all packets uint_t m_uiBps; // bits per second size_t m_uiMaxKfFrameSize; // biggest keyframe chunk size size_t m_uiMinKfFrameSize; // smallest keyframe chunk size uint_t m_uiKfFrames; // keyframe chunks int64_t m_uiKfFramesSize; // total keyframe chunk size // should make sence probably only for video stream size_t m_uiMaxFrameSize; // biggest non-keyframe chunk size size_t m_uiMinFrameSize; // smallest non-keyframe chunk size uint_t m_uiFrames; // non-keyframe chunks int64_t m_uiFramesSize; // total non-keyframe chunk size int m_iQuality; // quality of the stream (0..10000) int m_iSampleSize; // sample size union { struct { int m_iChannels; int m_iSamplesPerSec; int m_iBitsPerSample; bool m_bVbr; } aud; struct { int m_iWidth; int m_iHeight; float m_fAspect; } vid; }; StreamInfoPriv(); void setKfFrames(size_t max, size_t min, uint_t chunks, int64_t size) { m_uiMaxKfFrameSize = max; m_uiMinKfFrameSize = min; m_uiKfFrames = chunks; m_uiKfFramesSize = size; } void setFrames(size_t max, size_t min, uint_t chunks, int64_t size) { m_uiMaxFrameSize = max; m_uiMinFrameSize = min; m_uiFrames = chunks; m_uiFramesSize = size; } void setVideo(int width, int height, int bps = 0, float aspect = 0.0) { vid.m_iWidth = width; vid.m_iHeight = height; vid.m_fAspect = aspect; m_uiBps = bps; } void setAudio(int channels, int freq, int bits, int bps = 0) { if (bits == 0) bits = 16; aud.m_iChannels = channels; aud.m_iSamplesPerSec = freq; aud.m_iBitsPerSample = bits; m_uiBps = bps; } }; AVM_END_NAMESPACE; #endif avifile-0.7.48~20090503.ds/lib/aviread/asf_guids.cpp0000644000175000017500000001156611106431517020602 0ustar yavoryavor#include "asffmt.h" #include "asf_guids.h" #include // memcmp #include // sprintf // Advanced System Format // // based upon ASF documentation made by Eugene and on M$ Documentation // discovered on mplayer list (Bertrand) // http://avifile.sourceforge.net/asf-1.0.htm // http://www.microsoft.com/windows/windowsmedia/WM7/format/asfspec11300e.asp // http://go.microsoft.com/fwlink/?LinkId=31334 static const struct { const char name[32]; // save runtime relocation const GUID guid; } guids[] = { { "error", { 0x0,} }, // base ASF objects { "header", { 0x75b22630, 0x668e, 0x11cf, { 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }} }, { "data", { 0x75b22636, 0x668e, 0x11cf, { 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }} }, { "simple index", { 0x33000890, 0xe5b1, 0x11cf, { 0x89, 0xf4, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb }} }, // header ASF objects { "file properties", { 0x8cabdca1, 0xa947, 0x11cf, { 0x8e, 0xe4, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }} }, { "stream header", { 0xb7dc0791, 0xa9b7, 0x11cf, { 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }} }, { "stream bitrate properties", /* (http://get.to/sdp) */ { 0x7bf875ce, 0x468d, 0x11d1, { 0x8d, 0x82, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2 }} }, { "content description", { 0x75b22633, 0x668e, 0x11cf, { 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }} }, { "extended content encryption", { 0x298ae614, 0x2622, 0x4c17, { 0xb9, 0x35, 0xda, 0xe0, 0x7e, 0xe9, 0x28, 0x9c }} }, { "script command", { 0x1efb1a30, 0x0b62, 0x11d0, { 0xa3, 0x9b, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6 }} }, { "marker", { 0xf487cd01, 0xa951, 0x11cf, { 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }} }, { "header extension", { 0x5fbf03b5, 0xa92e, 0x11cf, { 0x8e, 0xe3, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }} }, { "bitrate mutual exclusion", { 0xd6e229dc, 0x35da, 0x11d1, { 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe }} }, { "codec list", { 0x86d15240, 0x311d, 0x11d0, { 0xa3, 0xa4, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6 }} }, { "extended content description", { 0xd2d0a440, 0xe307, 0x11d2, { 0x97, 0xf0, 0x00, 0xa0, 0xc9, 0x5e, 0xa8, 0x50 }} }, { "error correction", { 0x75b22635, 0x668e, 0x11cf, { 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }} }, { "padding", { 0x1806d474, 0xcadf, 0x4509, { 0xa4, 0xba, 0x9a, 0xab, 0xcb, 0x96, 0xaa, 0xe8 }} }, // stream properties object stream type { "audio media", { 0xf8699e40, 0x5b4d, 0x11cf, { 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b }} }, { "video media", { 0xbc19efc0, 0x5b4d, 0x11cf, { 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b }} }, { "command media", { 0x59dacfc0, 0x59e6, 0x11d0, { 0xa3, 0xac, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6 }} }, // stream properties object error correction { "no error correction", { 0x20fb5700, 0x5b55, 0x11cf, { 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b }} }, { "audio spread", { 0xbfc3cd50, 0x618f, 0x11cf, { 0x8b, 0xb2, 0x00, 0xaa, 0x00, 0xb4, 0xe2, 0x20 }} }, // mutual exclusion object exlusion type { "mutex bitrate", { 0xd6e22a01, 0x35da, 0x11d1, { 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe }} }, { "mutex unknown", { 0xd6e22a02, 0x35da, 0x11d1, { 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe }} }, // header extension { "reserved_1", { 0xabd3d211, 0xa9ba, 0x11cf, { 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }} }, // script command { "reserved script command", { 0x4B1ACBE3, 0x100B, 0x11D0, { 0xA3, 0x9B, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6 }} }, // marker object { "reserved marker", { 0x4CFEDB20, 0x75F6, 0x11CF, { 0x9C, 0x0F, 0x00, 0xA0, 0xC9, 0x03, 0x49, 0xCB }} }, // various { "head2", { 0xabd3d211, 0xa9ba, 0x11cf, { 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }} }, { "audio conceal none", { 0x49f1a440, 0x4ece, 0x11d0, { 0xa3, 0xac, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6 }} }, { "codec comment1 header", { 0x86d15241, 0x311d, 0x11d0, { 0xa3, 0xa4, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6 }} }, { "asf 2.0 header", { 0xd6e229d1, 0x35da, 0x11d1, { 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe }} }, }; int guid_is_guidid(const GUID* u, guidid_t g) { return (memcmp(u, &guids[g].guid, sizeof(GUID)) == 0); } guidid_t guid_get_guidid(const GUID* u) { unsigned i; for (i = GUID_ASF_HEADER; i < GUID_END; i++) if (guid_is_guidid(u, (guidid_t) i)) return (guidid_t) i; return GUID_ERROR; } char* guid_to_string(char* buffer, const GUID* guid) { sprintf(buffer, "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", guid->f1, guid->f2, guid->f3, guid->f4[0], guid->f4[1], guid->f4[2], guid->f4[3], guid->f4[4], guid->f4[5], guid->f4[6], guid->f4[7]); return buffer; } const char* guidid_to_text(guidid_t g) { return guids[g].name; } avifile-0.7.48~20090503.ds/lib/aviread/asf_guids.h0000644000175000017500000000276607425524475020270 0ustar yavoryavor#ifndef AVIFILE_GUIDS_H #define AVIFILE_GUIDS_H #include "avifmt.h" typedef enum { GUID_ERROR = 0, // base ASF objects GUID_ASF_HEADER, GUID_ASF_DATA, GUID_ASF_SIMPLE_INDEX, // header ASF objects GUID_ASF_FILE_PROPERTIES, GUID_ASF_STREAM_PROPERTIES, GUID_ASF_STREAM_BITRATE_PROPERTIES, GUID_ASF_CONTENT_DESCRIPTION, GUID_ASF_EXTENDED_CONTENT_ENCRYPTION, GUID_ASF_SCRIPT_COMMAND, GUID_ASF_MARKER, GUID_ASF_HEADER_EXTENSION, GUID_ASF_BITRATE_MUTUAL_EXCLUSION, GUID_ASF_CODEC_LIST, GUID_ASF_EXTENDED_CONTENT_DESCRIPTION, GUID_ASF_ERROR_CORRECTION, GUID_ASF_PADDING, // stream properties object stream type GUID_ASF_AUDIO_MEDIA, GUID_ASF_VIDEO_MEDIA, GUID_ASF_COMMAND_MEDIA, // stream properties object error correction type GUID_ASF_NO_ERROR_CORRECTION, GUID_ASF_AUDIO_SPREAD, // mutual exclusion object exlusion type GUID_ASF_MUTEX_BITRATE, GUID_ASF_MUTEX_UKNOWN, // header extension GUID_ASF_RESERVED_1, // script command GUID_ASF_RESERVED_SCRIPT_COMMNAND, // marker object GUID_ASF_RESERVED_MARKER, // various GUID_ASF_HEAD2, GUID_ASF_AUDIO_CONCEAL_NONE, GUID_ASF_CODEC_COMMENT1_HEADER, GUID_ASF_2_0_HEADER, GUID_END } guidid_t; guidid_t guid_get_guidid(const GUID* guid); int guid_is_guidid(const GUID* guid, guidid_t gid); // char* guid_to_string(char* buffer, const GUID* guid); const char* guidid_to_text(guidid_t g); #endif // AVIFILE_GUIDS_H avifile-0.7.48~20090503.ds/lib/aviread/asffmt.cpp0000644000175000017500000001300011176642755020116 0ustar yavoryavor#include "asffmt.h" #include "utils.h" #include "avm_output.h" #include #include #define Debug if (0) AVM_BEGIN_NAMESPACE; AsfPacket::AsfPacket(size_t psize) : avm::vector(psize), refcount(1) { } int AsfPacket::init(uint_t timeshift) { uint8_t* memory = this->begin(); uint8_t* memory2 = memory + 1; // parse packet header //for (int i = 0 ; i < 15; i++) printf("%02x ", memory[i]); printf("\n"); length = 0xff; if (memory[0] & 0x80) { if (memory[0] & 0x60) { AVM_WRITE("ASF reader", "WARNING: unknown error correction length 0x%x\n", memory[0]); const uint8_t* me = memory + size() - 64; do { if (++memory >= me) return -1; } while (memory[0] != 0x82 || memory[1] != 0 || memory[2] != 0); AVM_WRITE("ASF reader", "WARNING: resynced to 0x82\n"); } int edl = memory[0] & 0x0f; if (edl == 2) { if (memory[1] != 0 || memory[2] != 0) { AVM_WRITE("ASF reader", "WARNING: unexpected error correction for 0x%x\n", memory[0]); return -1; } } memory2 += edl; // skip Error Correction bytes (usually [0, 0]) } else memory2++; length_flags = *memory2++; property_flags = *memory2++; size_t psize; size_t padding; #define DO_2BITS(bits, var, defval) \ switch (bits & 3) \ { \ case 3: var = avm_get_le32(memory2); memory2 += 4; break; \ case 2: var = avm_get_le16(memory2); memory2 += 2; break; \ case 1: var = memory2[0]; memory2++; break; \ default: var = defval; break; \ } DO_2BITS(length_flags >> 5, psize, size()); DO_2BITS(length_flags >> 1, padding, 0); //sequence -> ignored DO_2BITS(length_flags >> 3, padding, 0); send_time = avm_get_le32(memory2); if (timeshift > 0) { send_time -= timeshift; avm_set_le32(memory2, send_time); } memory2 += 4; duration = avm_get_le16(memory2); memory2 += 2; //AVM_WRITE("ASF reader", "time %f len %d\n", send_time/1000.0, duration); if (length_flags & 0x01) { segments = (uint8_t)(memory2[0] & 0x3f); segsizetype = memory2[0]; memory2++; } else { segments = 1; segsizetype = 0x80; } //printf("PSIZE %d PAD %d LEN %d\n", psize, padding, length); length = memory2 - memory; packet_length = (uint16_t)(psize - padding - length); size_t offset = length; // find all fragments in this packet for (unsigned i = 0; i < segments; ++i) { int l = segment(memory, offset, timeshift); if (l < 0) { segments = (uint8_t)i; break; } offset += l; if (offset > size()) { AVM_WRITE("ASF reader", "WARNING: packet size overflow %" PRIsz " - %" PRIsz "\n", offset, size()); segments = (uint8_t)i; break; } } Debug AVM_WRITE("ASF reader", 2, "Created packet header for send_time %f, length %d, %d segments\n", send_time/1000., packet_length, segments); return 0; } int AsfPacket::segment(uint8_t* memory, size_t offset, uint_t timeshift) { uint8_t* memory2 = memory + offset; uint8_t* timepos = 0; AsfPacketFragment f; f.keyframe = ((memory2[0] >> 7) & 0x1); f.stream_id = memory2[0] & 0x7f; memory2++; uint32_t fragment_offset; // == present_time; size_t replicated_length; DO_2BITS(property_flags >> 4, f.seq_num, 0); timepos = memory2; // remmeber for time modification DO_2BITS(property_flags >> 2, fragment_offset, 0); // 0 is illegal DO_2BITS(property_flags, replicated_length, 0); Debug AVM_WRITE("ASF reader", 2, "StreamId: %3d flags: 0x%x seq: %d offset: %d\n", f.stream_id, length_flags, f.seq_num, fragment_offset); if (replicated_length > 1) { // by the ASF spec it should contain at least these two elements f.object_length = avm_get_le32(memory2); f.object_start_time = avm_get_le32(memory2 + 4); if (timeshift > 0) { f.object_start_time -= timeshift; avm_set_le32(memory2 + 4, f.object_start_time); } if ((int)replicated_length > (packet_length - (memory2 - (memory + offset)))) return -1; memory2 += replicated_length; } else { f.object_start_time = send_time; f.object_length = 0; if (replicated_length == 1) // compressed memory2++; // skip presentation time delta } size_t plen; if (length_flags & 0x01) // multiple fragment { // read packet length DO_2BITS(segsizetype >> 6, plen, 0); // 0 is illegal if ((int)plen > (packet_length - (memory2 - (memory + offset)))) return -1; } else // single fragment // determine remaing packet length plen = packet_length - (memory2 - (memory + offset)); //AVM_WRITE("ASF reader", "repli %d plen %d\n", replicated_length, plen); if (replicated_length == 1) // compressed { f.fragment_offset = 0; // fragment_offset becomes object_start_time if (timeshift > 0) { fragment_offset -= timeshift; avm_set_le32(timepos, fragment_offset); } f.object_start_time = fragment_offset; const uint8_t* pend = memory2 + plen; while (memory2 < pend) { f.object_length = f.data_length = *memory2++; //printf("********* ------ %d\n", f.data_length); f.pointer = memory2; memory2 += f.data_length; fragments.push_back(f); } } else { f.fragment_offset = fragment_offset; f.data_length = (uint32_t)plen; //printf("____%d\n", plen); f.pointer = memory2; memory2 += f.data_length; fragments.push_back(f); } //AVM_WRITE("ASF reader", 2, "Created segment header for stream %d, %d fragments\n", // f.stream_id, fragments.size()); return (int) (memory2 - (memory + offset)); } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviread/asffmt.h0000644000175000017500000001523111177255670017570 0ustar yavoryavor#ifndef AVIFILE_ASFFMT_H #define AVIFILE_ASFFMT_H #include "avm_stl.h" #include "formats.h" // GUID, WAVEFORMATEX #include "utils.h" #include "asf_guids.h" AVM_BEGIN_NAMESPACE; // Data is stored in ASF packets in a relatively complicated manner // ( see details in http://divx.euro.ru/asf-1.0.htm ). // The following objects represent that data in convenient form. struct AsfPacketFragment { uint32_t object_start_time; uint32_t fragment_offset; ///< offset of fragment within object ///< ( needed for reconstruction of fragmented packets ) uint32_t object_length; ///< length of object that this fragment beints to uint32_t data_length; ///< length of this fragment uint32_t seq_num; ///< sequential id for fragmented packet const uint8_t* pointer; ///< pointer to data inside packet ///< first byte of fragment N in packet p ///< is p[p.fragments[N].pointer] uint8_t keyframe :1; ///< is this a keyframe uint8_t stream_id :7; ///< stream id - valid 1 - 127 }; struct AsfPacket: avm::vector { size_t length; ///< of header itself uint8_t length_flags; ///< see spec masks: ///< 0x01 Multiple payloads present ///< 0x06 Sequence_type ///< 0x18 Padding length ///< 0x60 Packet length ///< 0x80 Error Correction Present uint8_t property_flags; ///< masks: ///< 0x03 Replicated data length type ///< 0x0c Offset into media object type ///< 0x30 Media object number length type ///< 0xc0 Stream number length type uint8_t segsizetype; uint8_t segments; ///< number of segments uint32_t send_time; ///< timestamp in milliseconds uint16_t packet_length; ///< of data following header uint16_t duration; ///< in milliseconds avm::vector fragments; AsfPacket(size_t psize = 0); int init(uint_t timeshift = 0); // packet could be time shifted void addRef() { refcount++; } void release() { if (!--refcount) delete this; } protected: int segment(uint8_t* memory, size_t offset, uint_t ts); int refcount; }; struct AVMPACKED ASFMainHeader { GUID guid; ///< generated by client computer uint64_t file_size; ///< in bytes ///< invalid if broadcasting uint64_t create_time; ///< time of creation, in 100-nanosecond units since 1.1.1601 ///< invalid if broadcasting uint64_t pkts_count; ///< how many packets are there in the file ///< invalid if broadcasting uint64_t play_time; ///< play time, in 100-nanosecond units ///< invalid if broadcasting uint64_t send_time; ///< time to send file, in 100-nanosecond units ///< invalid if broadcasting (could be ignored) uint32_t preroll; ///< timestamp of the first packet, in milliseconds ///< if nonzero - substract from time uint32_t ignore; ///< preroll is 64bit - but let's just ignore it int32_t flags; ///< 0x01 - broadcast ///< 0x02 - seekable ///< rest is reserved should be 0 uint32_t min_pktsize; ///< size of a data packet ///< invalid if broadcasting uint32_t max_pktsize; ///< shall be the same as for min_pktsize ///< invalid if broadcasting uint32_t max_bitrate; ///< bandwith of stream in bps ///< should be the sum of bitrates of the ///< individual media streams }; static inline ASFMainHeader* avm_get_leASFMainHeader(void* asfmainheader) { ASFMainHeader* h = (ASFMainHeader*)asfmainheader; avm_get_leGUID(&h->guid); h->file_size = avm_get_le64(&h->file_size); h->create_time = avm_get_le64(&h->create_time); h->pkts_count = avm_get_le64(&h->pkts_count); h->play_time = avm_get_le64(&h->play_time); h->send_time = avm_get_le64(&h->send_time); h->preroll = avm_get_le32(&h->preroll); h->flags = avm_get_le32(&h->flags); h->min_pktsize = avm_get_le32(&h->min_pktsize); h->max_pktsize = avm_get_le32(&h->max_pktsize); h->max_bitrate = avm_get_le32(&h->max_bitrate); return h; } void avm_print_ASFMainHeader(const ASFMainHeader*); union ASFStreamHeader { char buf[1024]; struct AVMPACKED { GUID stream_guid; ///< type of media stream GUID error_guid; ///< data error correction used uint64_t time_offset; ///< presentation time (in 100-nanosecond unit) uint32_t stream_size; ///< size of type-specific data uint32_t error_size; ///< size of error correct data uint16_t stream; ///< number ( 1, 2 ... ) uint32_t reserved; ///< usually the same in both streams: ///< Eyes on me.asf: 0x62dffd4 ///< Alsou - Solo.asf: 0x10 ///< Baby one more time.asf: 0x10 ///< Cure_LastDayOfSummer.wma: 0x818f900c ///< Windows Movie Maker Sample File.wmv: 0x3f ///< KellssyV_500VBR.wmv: 0x0 union { struct AVMPACKED { int32_t width; ///< width of encoded image int32_t height; ///< height of encoded image int8_t flags; ///< shall be set to 2 uint16_t data_size; BITMAPINFOHEADER bih; } vid; struct AVMPACKED { WAVEFORMATEX wfx; // audio scramble data follows } aud; }; } hdr; }; static inline ASFStreamHeader* avm_get_leASFStreamHeader(void* asfstreamheader) { ASFStreamHeader* h = (ASFStreamHeader*)asfstreamheader; avm_get_leGUID(&h->hdr.stream_guid); avm_get_leGUID(&h->hdr.error_guid); h->hdr.time_offset = avm_get_le64(&h->hdr.time_offset); h->hdr.stream_size = avm_get_le32(&h->hdr.stream_size); h->hdr.error_size = avm_get_le32(&h->hdr.error_size); h->hdr.stream = avm_get_le16(&h->hdr.stream); h->hdr.reserved = avm_get_le32(&h->hdr.reserved); if (!guid_is_guidid(&h->hdr.stream_guid, GUID_ASF_AUDIO_MEDIA)) { h->hdr.vid.width = avm_get_le32(&h->hdr.vid.width); h->hdr.vid.height = avm_get_le32(&h->hdr.vid.height); h->hdr.vid.data_size = avm_get_le16(&h->hdr.vid.data_size); avm_get_leBITMAPINFOHEADER(&h->hdr.vid.bih); } else avm_get_leWAVEFORMATEX(&h->hdr.aud); return h; } static inline char* avm_convert_asfstring(void* str, size_t size) { if (str) { char* s = (char*) str; uint_t i,j; for (i = 0, j = 0; i < size && s[i] != '\0'; i += 2, j++) s[j] = s[i]; s[j] = '\0'; } return (char*)str; } struct AVMPACKED ASFSpreadAudio { uint8_t span; ///< total number of audio blocks in each scramble group uint16_t packet_length; ///< byte size of each scrambling chunk uint16_t chunk_length; ///< usually = nBlockAlign Chunks Per Data Unit uint16_t data_length; ///< usually = nBlockAlign Chunk Distance uint8_t silence_data; }; static inline void avm_get_leASFSpreadAudio(ASFSpreadAudio* h) { h->packet_length = avm_get_le16(&h->packet_length); h->chunk_length = avm_get_le16(&h->chunk_length); h->data_length = avm_get_le16(&h->data_length); } AVM_END_NAMESPACE; #endif // AVIFILE_ASFFMT_H avifile-0.7.48~20090503.ds/lib/aviread/avifmt.h0000644000175000017500000002651611174014475017577 0ustar yavoryavor#ifndef AVIFILE_AVIFMT_H #define AVIFILE_AVIFMT_H /**************************************************************************** * * AVIFMT - AVI file format definitions * ****************************************************************************/ #include "utils.h" #ifndef NOAVIFMT #ifndef __WINE_WINDEF_H #define LOBYTE(w) ((uint8_t)(uint16_t)(w)) #define HIBYTE(w) ((uint8_t)((uint16_t)(w) >> 8)) #define LOWORD(l) ((uint16_t)(uint32_t)(l)) #define HIWORD(l) ((uint16_t)((uint32_t)(l) >> 16)) #define MAKELONG(low,high) ((int32_t)(((uint16_t)(low)) | (((uint32_t)((uint16_t)(high))) << 16))) typedef struct __attribute__((__packed__)) { int16_t left; int16_t top; int16_t right; int16_t bottom; } RECT, *PRECT, *LPRECT; #endif // __WINE_WINDEF_H #ifdef _MSC_VER #pragma warning(disable:4200) #endif /* The following is a short description of the AVI file format. * Please see the accompanying documentation for a full explanation. * * An AVI file is the following RIFF form: * * RIFF('AVI' * LIST('hdrl' * avih() * LIST ('strl' * strh() * strf() * [junk(data)] * ... additional header data * LIST('movi' * { LIST('rec' * SubChunk... * ) * | SubChunk } .... * ) * [ ] * ) * * The main file header specifies how many streams are present. For * each one, there must be a stream header chunk and a stream format * chunk, enlosed in a 'strl' LIST chunk. The 'strf' chunk contains * type-specific format information; for a video stream, this should * be a BITMAPINFO structure, including palette. For an audio stream, * this should be a WAVEFORMAT (or PCMWAVEFORMAT) structure. * * The actual data is contained in subchunks within the 'movi' LIST * chunk. The first two characters of each data chunk are the * stream number with which that data is associated. * * Some defined chunk types: * Video Streams: * ##db: RGB DIB bits * ##dc: RLE8 compressed DIB bits * ##pc: Palette Change * * Audio Streams: * ##wb: waveform audio bytes * * The grouping into LIST 'rec' chunks implies only that the contents of * the chunk should be read into memory at the same time. This grouping * is used for files specifically intended to be played from CD-ROM. * * The index chunk at the end of the file should contain one entry for * each data chunk in the file. * * Limitations for the current software: * Only one video stream and one audio stream are allowed. * The streams must start at the beginning of the file. * * * To register codec types please obtain a copy of the Multimedia * Developer Registration Kit from: * * Microsoft Corporation * Multimedia Systems Group * Product Marketing * One Microsoft Way * Redmond, WA 98052-6399 * */ #ifndef mmioFOURCC #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \ ( (int)(unsigned char)(ch0) | ( (int)(unsigned char)(ch1) << 8 ) | \ ( (int)(unsigned char)(ch2) << 16 ) | ( (int)(unsigned char)(ch3) << 24 ) ) #endif /* Macro to make a TWOCC out of two characters */ #ifndef aviTWOCC #define aviTWOCC(ch0, ch1) ((unsigned short)(unsigned char)(ch0) | ((unsigned short)(unsigned char)(ch1) << 8)) #endif //typedef uint16_t TWOCC; /* form types, list types, and chunk types */ #define formtypeAVI mmioFOURCC('A', 'V', 'I', ' ') #define listtypeAVIHEADER mmioFOURCC('h', 'd', 'r', 'l') #define listtypeSTREAMHEADER mmioFOURCC('s', 't', 'r', 'l') #define listtypeAVIMOVIE mmioFOURCC('m', 'o', 'v', 'i') #define listtypeAVIRECORD mmioFOURCC('r', 'e', 'c', ' ') #define listtypeINFO mmioFOURCC('I', 'N', 'F', 'O') #define ckidAVIMAINHDR mmioFOURCC('a', 'v', 'i', 'h') #define ckidSTREAMHEADER mmioFOURCC('s', 't', 'r', 'h') #define ckidSTREAMFORMAT mmioFOURCC('s', 't', 'r', 'f') #define ckidSTREAMHANDLERDATA mmioFOURCC('s', 't', 'r', 'd') #define ckidSTREAMNAME mmioFOURCC('s', 't', 'r', 'n') #define ckidAVINEWINDEX mmioFOURCC('i', 'd', 'x', '1') /* Chunk id to use for extra chunks for padding. */ #define ckidAVIPADDING mmioFOURCC('J', 'U', 'N', 'K') /* ** Stream types for the field of the stream header. */ #define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's') #define streamtypeIAVS mmioFOURCC('i', 'a', 'v', 's') #define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's') #define streamtypeMIDI mmioFOURCC('m', 'i', 'd', 's') #define streamtypeTEXT mmioFOURCC('t', 'x', 't', 's') /* Basic chunk types */ #define cktypeDIBbits aviTWOCC('d', 'b') #define cktypeDIBcompressed aviTWOCC('d', 'c') #define cktypePALchange aviTWOCC('p', 'c') #define cktypeWAVEbytes aviTWOCC('w', 'b') #define cktypeINDEX aviTWOCC('i', 'x') /* * Useful macros * * Warning: These are nasty macro, and MS C 6.0 compiles some of them * incorrectly if optimizations are on. Ack. */ /* Macro to get stream number out of a FOURCC ckid */ #define FromHex(n) (((n) >= 'A') ? ((n) + 10 - 'A') : ((n) - '0')) #define StreamFromFOURCC(fcc) \ ((uint16_t) ((FromHex(LOBYTE(LOWORD(fcc))) << 4) + \ (FromHex(HIBYTE(LOWORD(fcc)))))) /* Macro to get TWOCC chunk type out of a FOURCC ckid */ #define TWOCCFromFOURCC(fcc) HIWORD(fcc) /* Macro to make a ckid for a chunk out of a TWOCC and a stream number * from 0-255. */ #define ToHex(n) ((uint8_t) (((n) > 9) ? ((n) - 10 + 'A') : ((n) + '0'))) #define MAKEAVICKID(tcc, stream) \ MAKELONG((ToHex((stream) & 0x0f) << 8) | (ToHex(((stream) & 0xf0) >> 4)), tcc) /* The AVI File Header LIST chunk should be padded to this size */ #define AVI_HEADERSIZE 2048 ///< size of AVI header list /** * Main AVI File Header */ typedef struct __attribute__((__packed__)) { uint32_t dwMicroSecPerFrame; ///< frame display rate (or 0L) uint32_t dwMaxBytesPerSec; ///< max. transfer rate uint32_t dwPaddingGranularity; ///< pad to multiples of this ///< size; normally 2K int32_t dwFlags; ///< the ever-present flags #define AVIF_HASINDEX 0x00000010 ///< AVI file has index #define AVIF_MUSTUSEINDEX 0x00000020 ///< Index should be used for determining presentation order ///< i.e flag could be used to create a list of frames for editing #define AVIF_ISINTERLEAVED 0x00000100 ///< AVI is interleave #define AVIF_TRUSTCKTYPE 0x00000800 ///< Use CKType to find key frames? #define AVIF_WASCAPTUREFILE 0x00010000 ///< From capturing real time video #define AVIF_COPYRIGHTED 0x00020000 ///< User should not copy this material uint32_t dwTotalFrames; ///< # frames in file uint32_t dwInitialFrames; ///< # frames prior init frame of AVI sequence ///< for interleaved file uint32_t dwStreams; uint32_t dwSuggestedBufferSize; ///< largets needed buffer (fits larges chunk) uint32_t dwWidth; uint32_t dwHeight; uint32_t dwScale; uint32_t dwRate; uint32_t dwStart; uint32_t dwLength; } AVIMainHeader; /** * Stream header */ typedef struct __attribute__((__packed__)) { uint32_t fccType; uint32_t fccHandler; int32_t dwFlags; ///< Contains AVISF_* flags #define AVISF_DISABLED 0x00000001 ///< Stream should not be enabled by default #define AVISF_VIDEO_PALCHANGES 0x00010000 ///< Video stream contains palette changes uint16_t wPriority; ///< Priority level selects between multiple audio stream uint16_t wLanguage; uint32_t dwInitialFrames; ///< Specifies how far audio data is skewed ahead of the video frames in interleaved files ///< typically about 0.75sec uint32_t dwScale; uint32_t dwRate; ///< dwRate / dwScale == samples per second uint32_t dwStart; uint32_t dwLength; ///< In units above... uint32_t dwSuggestedBufferSize; int32_t dwQuality; ///< Quality parameter passed to compressor 1..10000, -1 == default quality uint32_t dwSampleSize; ///< Specifies the size of a single sample of data ///< This is set to zero if the samples can vary in size. ///< If this number is non-zero, then multiple ///< samples of data can be grouped into a single chunk within the file. If ///< it is zero, each sample of data (such as a video frame) must be in a ///< separate chunk. ///< For video streams, this number is typically zero, although it can be ///< non-zero if all video frames are the same size. ///< For audio streams, this number should be the same as the nBlockAlign ///< field of the WAVEFORMAT structure describing the audio. RECT rcFrame; ///< Specifies the destination rectangle for a text or video stream within ///< the movie rectangle specified by the dwWidth and dwHeight members of the AVIMainHeader. } AVIStreamHeader; #define FOURCC_RIFF mmioFOURCC('R', 'I', 'F', 'F') #define FOURCC_LIST mmioFOURCC('L', 'I', 'S', 'T') // The following comes from the OpenDML 1.0 spec for extended AVI files // bIndexType codes // #define AVI_INDEX_OF_INDEXES 0x00 // when each entry in aIndex // array points to an index chunk #define AVI_INDEX_OF_CHUNKS 0x01 // when each entry in aIndex // array points to a chunk in the file #define AVI_INDEX_IS_DATA 0x80 // when each entry is aIndex is // really the data // bIndexSubtype codes for INDEX_OF_CHUNKS #define AVI_INDEX_2FIELD 0x01 // when fields within frames typedef struct __attribute__((__packed__)) { uint32_t ckid; int32_t dwFlags; #define AVIIF_LIST 0x00000001 ///< chunk is a 'LIST' #define AVIIF_KEYFRAME 0x00000010 ///< this frame is a key frame. #define AVIIF_NOTIME 0x00000100 ///< this frame doesn't take any time #define AVIIF_COMPUSE 0x0FFF0000 ///< these bits are for compressor use uint32_t dwChunkOffset; ///< Position of chunk uint32_t dwChunkLength; ///< Length of chunk } AVIIndexEntry; typedef struct __attribute__((__packed__)) { uint64_t qwOffset; ///< absolute file offset, offset 0 is // unused entry?? uint32_t dwSize; ///< size of index chunk at this offset uint32_t dwDuration; ///< time span in stream ticks } AVISuperIndexEntry; typedef struct __attribute__((__packed__)) { uint32_t fccType; uint32_t cb; uint16_t wLongsPerEntry; ///< must be 4 (size of each entry in aIndex array) uint8_t bIndexSubType; ///< must be 0 or AVI_INDEX_2FIELD uint8_t bIndexType; ///< must be AVI_INDEX_OF_INDEXES uint32_t nEntriesInUse; ///< used entries in aIndex array uint32_t dwChunkId; ///< ##dc or ##db or ##wb.. uint32_t dwReserved[3]; ///< must be 0 AVISuperIndexEntry* aIndex; uint32_t dwChunkOffset; ///< Position of chunk uint32_t dwChunkLength; ///< Length of chunk } AVISuperIndex; typedef struct __attribute__((__packed__)) { int32_t dwOffset; ///< qwBaseOffset + this is absolute file offset int32_t dwSize; ///< bit 31 is set if this is NOT a keyframe } AVIStdIndexEntry; typedef struct __attribute__((__packed__)) { uint32_t fcc; ///< ##ix uint32_t cb; uint16_t wLongsPerEntry; ///< must be sizeof(aIndex[0])/sizeof(DWORD) uint8_t bIndexSubType; ///< must be 0 uint8_t bIndexType; ///< must be AVI_INDEX_OF_CHUNKS uint32_t nEntriesInUse; ///< used entries uint32_t dwChunkId; ///< ##dc or ##db or ##wb uint64_t qwBaseOffset; ///< all dwOffsets in aIndex array are // relative to this uint64_t dwReserved3; ///< must be 0 AVIStdIndexEntry* aIndex; } AVIStdIndex; #define AVISTREAMREAD_CONVENIENT (-1L) /* * Palette change chunk * * Used in video streams. */ #endif /* NOAVIFMT */ #endif /* AVIFILE_AVIFMT_H */ avifile-0.7.48~20090503.ds/lib/aviwrite/0000755000175000017500000000000011267637352016355 5ustar yavoryavoravifile-0.7.48~20090503.ds/lib/aviwrite/AviAudioWriteStream.cpp0000644000175000017500000000511411164473636022751 0ustar yavoryavor#include "AviWrite.h" #include "audioencoder.h" #include "avm_output.h" #include "avm_creators.h" #include AVM_BEGIN_NAMESPACE; #define __MODULE__ "AudioWrite" AviAudioWriteStream::AviAudioWriteStream(AviWriteFile* file, int ckid, const CodecInfo& ci, const WAVEFORMATEX* fmt, int bitrate, int flags) :AviWriteStream(file, ckid, IStream::Audio, ci.fourcc, bitrate, flags), m_pAudioEnc(0), m_astatus(0), m_bitrate(bitrate) { if (fmt) srcfmt = *fmt; m_pAudioEnc = CreateEncoderAudio(ci, &srcfmt); if (!m_pAudioEnc) throw FATAL("Could not create audio encoder"); AviWriteStream::m_stop = 1; } AviAudioWriteStream::~AviAudioWriteStream() { //AVM_WRITE("AVI writer", "AviAudioWriteStream::~AviAudioWriteStream()\n"); fflush(stdout); Stop(); FreeEncoderAudio(m_pAudioEnc); } int AviAudioWriteStream::AddData(void* data, size_t size) { if (!m_astatus) return -1; size_t outsize = 2*size/srcfmt.nBlockAlign+7200; char* buf = new char[outsize]; size_t written = 0; int hr; if (data) { hr = m_pAudioEnc->Convert((uint8_t*)data, size/(size_t)srcfmt.nBlockAlign, buf, outsize, (size_t*)0, &written); //AVM_WRITE("AVI writer", "Converted %d bytes to %d bytes\n", size, written); if (hr == 0) hr = AviWriteStream::AddChunk(buf, written, AVIIF_KEYFRAME); } else hr = AviWriteStream::AddChunk(NULL, 0); delete[] buf; return hr; } const CodecInfo& AviAudioWriteStream::GetCodecInfo() const { return m_pAudioEnc->GetCodecInfo(); } int AviAudioWriteStream::AviAudioWriteStream::Start() { if (m_astatus) return -1; m_pAudioEnc->SetBitrate(m_bitrate); m_uiFormatSize = m_pAudioEnc->GetFormatSize(); delete[] m_pcFormat; m_pcFormat = new char[m_uiFormatSize]; m_pAudioEnc->GetFormat(m_pcFormat, m_uiFormatSize); WAVEFORMATEX* fmt = (WAVEFORMATEX*)m_pcFormat; #if 1 SetAudioHeader(fmt->nBlockAlign, m_bitrate, fmt->nBlockAlign); #else printf("BITRATE %d %d\n", m_bitrate, fmt->nBlockAlign); //SetAudioHeader(0, 44100, 23040); SetAudioHeader(0, 44100, 41472); #endif m_pAudioEnc->Start(); m_astatus = 1; return 0; } int AviAudioWriteStream::Stop() { if (!m_astatus) return -1; size_t written = 0; char* buf = new char[7200];// given by mp3 spec if (buf) { m_pAudioEnc->Close(buf, 7200, &written); if (written) AviWriteStream::AddChunk(buf, written); m_astatus = 0; delete[] buf; } return 0; } size_t AviAudioWriteStream::GetLength() const { return AviWriteStream::GetLength(); } #undef __MODULE__ AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviwrite/AviVideoWriteStream.cpp0000644000175000017500000000451111165743554022756 0ustar yavoryavor#include "AviWrite.h" #include "avm_creators.h" #include "videoencoder.h" #include #include AVM_BEGIN_NAMESPACE; #define __MODULE__ "VideoWrite" AviVideoWriteStream::AviVideoWriteStream(AviWriteFile* file, int ckid, const CodecInfo& ci, const BITMAPINFOHEADER* src_header, int frame_rate, int flags) :AviWriteStream(file, ckid, Video, ci.fourcc, frame_rate, flags), m_vstatus(0), m_pBuffer(0) { m_pVideoEnc = CreateEncoderVideo(ci, *src_header); if (!m_pVideoEnc) throw FATAL("Could not create encoder"); AviWriteStream::m_stop = 1; } AviVideoWriteStream::~AviVideoWriteStream() { //AVM_WRITEI("AVI writer", "AviAudioWriteStream::~AviAudioWriteStream()\n"); fflush(stdout); Stop(); FreeEncoderVideo(m_pVideoEnc); } int AviVideoWriteStream::AddFrame(CImage* chunk, size_t* pSize, int* pKeyframe, char** ppData) { if (m_vstatus != 1) { if (pSize) *pSize = 0; return -1; } size_t size = 0; int is_keyframe = 0; int hr; if (chunk) { hr = m_pVideoEnc->EncodeFrame(chunk, m_pBuffer, &is_keyframe, &size); if (hr == 0) { hr = AviWriteStream::AddChunk(m_pBuffer, size, is_keyframe); } else { size = 0; is_keyframe = 0; } } else hr = AviWriteStream::AddChunk(NULL, 0); if (pSize) *pSize = size; if (pKeyframe) *pKeyframe = (is_keyframe != 0); if (ppData) *ppData = m_pBuffer; return hr; } const CodecInfo& AviVideoWriteStream::GetCodecInfo() const { return m_pVideoEnc->GetCodecInfo(); } int AviVideoWriteStream::Start() { if (m_vstatus) return -1; const BITMAPINFOHEADER& bh = m_pVideoEnc->GetOutputFormat(); m_uiFormatSize = bh.biSize; delete[] m_pcFormat; m_pcFormat = new char[bh.biSize]; if (m_pcFormat) { memcpy(m_pcFormat, &bh, bh.biSize); m_pVideoEnc->Start(); m_pBuffer = new char[m_pVideoEnc->GetOutputSize()]; SetVideoHeader(100, //m_pVideoEnc->GetQuality(), bh.biWidth, bh.biHeight); m_vstatus = 1; return 0; } return -1; } int AviVideoWriteStream::Stop() { if (!m_vstatus) return -1; m_pVideoEnc->Stop(); delete[] m_pBuffer; m_pBuffer = 0; m_vstatus = 0; return 0; } size_t AviVideoWriteStream::GetLength() const { return AviWriteStream::GetLength(); } #undef __MODULE__ AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviwrite/AviWrite.cpp0000644000175000017500000003600211175130107020574 0ustar yavoryavor/******************************************************** AviWriteStream/AviWriteFile class implementation Copyright 2000 Eugene Kuznetsov (divx@euro.ru) *********************************************************/ #define _LARGEFILE64_SOURCE #include "AviWrite.h" #include "audioencoder.h" #include "avm_output.h" #include #include #include #if defined(__FreeBSD__) || defined(__NetBSD__) #define lseek64 lseek #define O_LARGEFILE 0 #endif /* audiopreloadtime; (ms) audiopreloadsize; bytes avm::vector x; audio/video add_buffer() { if (size + chunks > XX) syncfile(); if (iskeyframe) } avi flush_buffer() { lastvideo() while () { audiochunk += audiochunksize; if (audiochunk > limit) { write(); } } addindex() write() } */ AVM_BEGIN_NAMESPACE; #define __MODULE__ "WriteFile" IWriteFile::~IWriteFile() {} IAudioWriteStream::~IAudioWriteStream() {} IVideoWriteStream::~IVideoWriteStream() {} AviWriteStream::AviWriteStream(AviWriteFile* file, int ckid, IStream::StreamType type, fourcc_t handler, int frame_rate, int flags, const void* format, size_t format_size, size_t samplesize, int quality) :m_pFile(file), m_pcFormat(0), m_uiLength(0), m_ckid(ckid), m_stop(0) { m_type = type; memset(&m_Header, 0, sizeof(m_Header)); switch (type) { case Video: if (format) { const BITMAPINFOHEADER* bh = (const BITMAPINFOHEADER*) format; m_Header.rcFrame.right = (int16_t) bh->biWidth; m_Header.rcFrame.bottom = (int16_t) bh->biHeight; } m_Header.dwRate = 1000000; m_Header.dwScale = frame_rate; m_Header.fccType = streamtypeVIDEO; break; case Audio: m_Header.dwRate = frame_rate; printf("frame rate for audio: %d\n",frame_rate); m_Header.dwScale = format ? (uint32_t) ((const WAVEFORMATEX*) format)->nBlockAlign : (uint32_t) samplesize; m_Header.fccType = streamtypeAUDIO; break; default: throw FATAL("Unsupported stream type"); } if (format && format_size > 0) { m_pcFormat = new char[format_size]; m_uiFormatSize = format_size; memcpy(m_pcFormat, format, format_size); } m_Header.fccHandler = handler; m_Header.dwFlags = flags; m_Header.dwLength = 0; m_Header.dwSampleSize = (uint32_t)samplesize; m_Header.dwQuality = quality; } AviWriteStream::~AviWriteStream() { delete[] m_pcFormat; } int AviWriteStream::AddChunk(const void* chunk, size_t size, int flags) { if (!chunk && size) { AVM_WRITE("AVI writer", "Invalid argument to AviWriteStream::AddChunk()\n"); return -1; } m_pFile->AddChunk(chunk, size, m_ckid, flags); //AVM_WRITE("AVI writer", "Addchunk %d %d\n", m_Header.dwSampleSize, size); if (m_Header.dwSampleSize) { m_uiLength += size; m_Header.dwLength = (uint32_t) m_uiLength / m_Header.dwSampleSize; } else m_Header.dwLength++; return 0; } /* * * WriteFile * */ AviWriteFile::AviWriteFile(const char* name, int64_t limit, int flags, int mask) :m_pFileBuffer(0), m_lFlimit(limit), m_Filename(name), m_iFlags(flags), m_iMask(mask) { init(); //AVM_WRITE("AVI writer", "AviWriteFile::AviWriteFile()\n"); } AviWriteFile::~AviWriteFile() { //AVM_WRITE("AVI writer", "AviWriteFile::~AviWriteFile()\n"); if (!m_iStatus) return; try { // Stop encoders on all opened streams so it may flush // all buffered data for (size_t i = 0; i < m_Streams.size(); ++i) { if (m_Streams[i]->m_stop) { switch (m_Streams[i]->GetType()) { case AviWriteStream::Video: ((AviVideoWriteStream*)m_Streams[i])->Stop(); break; case AviWriteStream::Audio: ((AviAudioWriteStream*)m_Streams[i])->Stop(); break; default: break; } } } finish(); } catch (...) {} for (unsigned i = 0; i < m_Streams.size(); i++) delete m_Streams[i]; m_Streams.clear(); } void AviWriteFile::init() { segment_flag=false; segmenting_name=""; m_iStatus = 0; memset(&m_Header, 0, sizeof(m_Header)); m_Header.dwFlags = m_iFlags; m_Index.clear(); for (size_t i = 0; i < m_Streams.size(); i++) { m_Streams[i]->m_Header.dwLength = 0; m_Streams[i]->Start(); } m_pFileBuffer = new FileBuffer(m_Filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE, m_iMask); } void AviWriteFile::finish() { off_t videoendpos = m_pFileBuffer->lseek(0, SEEK_CUR); if (videoendpos & 1) { // padding int junk = -1; m_pFileBuffer->write(&junk, 1); videoendpos++; } WriteHeaders(); write_le32(ckidAVINEWINDEX); write_le32((uint32_t)(m_Index.size() * sizeof(AVIIndexEntry))); m_pFileBuffer->write(&m_Index[0], m_Index.size() * sizeof(AVIIndexEntry)); //printf("INDEX SIZE %d\n", m_Index.size()*sizeof(AVIINDEXENTRY)); videoendpos = m_pFileBuffer->lseek(0, SEEK_END); m_pFileBuffer->lseek(4, SEEK_SET); write_le32((uint32_t)(videoendpos - 8)); delete m_pFileBuffer; m_pFileBuffer = 0; for (size_t i = 0; i < m_Streams.size(); i++) m_Streams[i]->Stop(); } IWriteStream* AviWriteFile::AddStream(IStream::StreamType type, const void* format, size_t format_size, fourcc_t handler, int frame_rate, size_t samplesize, int quality, int flags) { int ckid = MAKEAVICKID((type==AviWriteStream::Video) ? cktypeDIBcompressed : cktypeWAVEbytes, m_Streams.size()); AviWriteStream* r = new AviWriteStream(this, ckid, type, handler, frame_rate, flags, format, format_size, samplesize, quality); m_Streams.push_back(r); return r; } IWriteStream* AviWriteFile::AddStream(IReadStream* pStream) { AviWriteStream* r = 0; IStream::StreamType type = pStream->GetType(); size_t format_size = 0; char* format = 0; int flags = 0; int frame_rate; int ckid; StreamInfo* si = pStream->GetStreamInfo(); size_t samplesize = si->GetSampleSize(); int quality = si->GetQuality(); fourcc_t handler = si->GetFormat(); switch (type) { case IStream::Video: format_size = pStream->GetVideoFormat(); if (!format_size) goto end; format = new char[format_size]; pStream->GetVideoFormat(format, format_size); ckid = MAKEAVICKID(cktypeDIBcompressed, m_Streams.size()); frame_rate = (unsigned int)(1000000.*pStream->GetFrameTime()); break; case IStream::Audio: format_size = pStream->GetAudioFormat(); if (!format_size) goto end; format = new char[format_size]; pStream->GetAudioFormat(format, format_size); ckid = MAKEAVICKID(cktypeWAVEbytes, m_Streams.size()); frame_rate = si->GetAudioSamplesPerSec(); break; default: return 0; } r = new AviWriteStream(this, ckid, type, handler, frame_rate, flags, format, format_size, samplesize, quality); delete[] format; m_Streams.push_back(r); end: delete si; return r; } IVideoWriteStream* AviWriteFile::AddVideoStream(const CodecInfo& ci, const BITMAPINFOHEADER* srchdr, int frame_rate, int flags) { int ckid = MAKEAVICKID(cktypeDIBcompressed, m_Streams.size()); AviVideoWriteStream* r = new AviVideoWriteStream(this, ckid, ci, srchdr, frame_rate, flags); m_Streams.push_back(r); return r; } IVideoWriteStream* AviWriteFile::AddVideoStream(fourcc_t fourcc, const BITMAPINFOHEADER* srchdr, int frame_rate, int flags) { const CodecInfo* pci = CodecInfo::match(fourcc, CodecInfo::Video, 0, CodecInfo::Encode); if (!pci) throw FATAL("No known video codecs for this fourcc"); return AddVideoStream(*pci, srchdr, frame_rate, flags); } IVideoWriteStream* AviWriteFile::AddVideoStream(const VideoEncoderInfo* vi, int frame_rate, int flags) { const CodecInfo* pci = CodecInfo::match(CodecInfo::Video, vi->cname.c_str()); if (!pci) throw FATAL("No known video codecs for this VideoEncoderInfo"); return AddVideoStream(*pci, &vi->header, frame_rate, flags); } IAudioWriteStream* AviWriteFile::AddAudioStream(const CodecInfo& ci, const WAVEFORMATEX* fmt, int bitrate, int flags) { int ckid = MAKEAVICKID(cktypeWAVEbytes, m_Streams.size()); AviAudioWriteStream* r = new AviAudioWriteStream(this, ckid, ci, fmt, bitrate, flags); m_Streams.push_back(r); return r; } IAudioWriteStream* AviWriteFile::AddAudioStream(fourcc_t fourcc, const WAVEFORMATEX* fmt, int bitrate, int flags) { const CodecInfo* pci = CodecInfo::match(fourcc, CodecInfo::Audio, 0, CodecInfo::Encode); if (!pci) throw FATAL("No known audio codecs for this fourcc"); return AddAudioStream(*pci, fmt, bitrate, flags); } void AviWriteFile::AddChunk(const void* chunk, size_t size, uint_t ckid, int flags) { if ( (m_lFlimit && GetFileSize() > m_lFlimit) || segment_flag) { //AVM_WRITE("AVI writer", "Size %lld limit %lld\n", GetFileSize(), m_lFlimit); if( ( ((ckid >> 16) & 0xffff) == ('c' << 8 | 'd') ) && flags){ printf("segmenting\n"); Segment(); } } if (m_Index.size() == 0) { const int junk_size = 0x800; char* junk = new char[junk_size]; memset(junk, 0, junk_size); m_pFileBuffer->write(junk, junk_size); delete[] junk; m_iStatus = 1; } off_t offset = m_pFileBuffer->lseek(0, SEEK_CUR); // let's make some fun if (offset > 0xffff0000) throw FATAL("Unsupported AVI file size!"); write_le32(ckid); write_le32((uint32_t)size); if (chunk) { m_pFileBuffer->write(chunk, size); if (size & 1) m_pFileBuffer->write(chunk, 1); } //AVM_WRITE("AVI writer", "CKID 0x%x %5d %8d %8d %d\n", ckid, flags, size, m_lFlimit, GetFileSize()); AVIIndexEntry entry; entry.ckid = ckid; entry.dwFlags = flags; entry.dwChunkOffset = (uint32_t)(offset - 0x7fc); entry.dwChunkLength = (uint32_t)size; m_Index.push_back(entry); if (m_Index.size() % 1000 == 1) WriteHeaders(); } int64_t AviWriteFile::GetFileSize() const { return m_pFileBuffer->lseek(0, SEEK_CUR); } int AviWriteFile::Reserve(size_t size) { return -1; } int AviWriteFile::WriteChunk(fourcc_t fourcc, void* data, size_t size) { return -1; } void AviWriteFile::SetSegmentName(const avm::string& new_name) { segmenting_name=new_name; } void AviWriteFile::SegmentAtKeyframe() { segment_flag=true; } int AviWriteFile::Segment() { avm::string newfilename; if(segmenting_name==""){ newfilename=m_Filename; } else{ newfilename=segmenting_name; } if (newfilename.size() < 6) newfilename = avm::string("_____")+newfilename; avm::string::size_type st = newfilename.find(".avi"); if (st == avm::string::npos) newfilename += ".000.avi"; else { if (newfilename[st-4]=='.') { char* newval=&newfilename[st-3]; int i = atoi(newval) + 1; if (i >= 1000) i = 0; char s[4]; sprintf(s, "%03d", i); memcpy(newval, s, 3); } else newfilename.insert(st, ".000"); } segment_flag=false; segmenting_name=""; finish(); m_Filename=newfilename; init(); return 0; } void AviWriteFile::WriteHeaders() { //printf("**** Writing headers **** %d\n", m_iStatus);; if (m_iStatus == 0) return; off_t endpos = m_pFileBuffer->lseek(0, SEEK_END); if (m_pFileBuffer->lseek(0, SEEK_SET) != 0) return; m_Header.dwFlags |= AVIF_HASINDEX | AVIF_TRUSTCKTYPE; m_Header.dwPaddingGranularity = 0; m_Header.dwStreams = (uint32_t)m_Streams.size(); m_Header.dwTotalFrames = 0; for (unsigned i = 0; i < m_Streams.size(); i++) { if (m_Streams[i]->GetType() == AviWriteStream::Video) { m_Header.dwTotalFrames = (uint32_t) m_Streams[i]->GetLength(); m_Header.dwMicroSecPerFrame = m_Header.dwScale = m_Streams[i]->m_Header.dwScale; m_Header.dwWidth = m_Streams[i]->m_Header.rcFrame.right; m_Header.dwHeight = (uint32_t) labs(m_Streams[i]->m_Header.rcFrame.bottom); m_Header.dwRate = m_Streams[i]->m_Header.dwRate; m_Header.dwStart = m_Streams[i]->m_Header.dwStart; printf("header: video stream %d mspframe=%d rate=%d start=%d\n",i,m_Header.dwMicroSecPerFrame,m_Header.dwRate,m_Header.dwStart); break; } } if (m_Header.dwTotalFrames == 0) if (m_Streams.size()) { m_Header.dwTotalFrames = (uint32_t) m_Streams[0]->GetLength(); m_Header.dwWidth = m_Header.dwHeight = 0; } write_le32(FOURCC_RIFF); write_le32((uint32_t)endpos - 8); write_le32(formtypeAVI);// Here goes chunk with all headers write_le32(FOURCC_LIST); // header pos = 0x10 write_le32(0);//here header chunk size hdr_size will be size_t hdr_size = 12 + sizeof(AVIMainHeader); // Write AVIMainHeader write_le32(listtypeAVIHEADER); write_le32(ckidAVIMAINHDR); write_le32(sizeof(AVIMainHeader)); write_le32(m_Header.dwMicroSecPerFrame); write_le32(m_Header.dwMaxBytesPerSec); write_le32(m_Header.dwPaddingGranularity); write_le32(m_Header.dwFlags); write_le32(m_Header.dwTotalFrames); write_le32(m_Header.dwInitialFrames); write_le32(m_Header.dwStreams); write_le32(m_Header.dwSuggestedBufferSize); write_le32(m_Header.dwWidth); write_le32(m_Header.dwHeight); write_le32(m_Header.dwScale); write_le32(m_Header.dwRate); write_le32(m_Header.dwStart); write_le32(m_Header.dwLength); for (unsigned j = 0; j < m_Streams.size(); j++) { size_t s = sizeof(AVIStreamHeader) + m_Streams[j]->m_uiFormatSize + (m_Streams[j]->m_uiFormatSize & 1); hdr_size += 28 + s; write_le32(FOURCC_LIST); write_le32((uint32_t)(20 + s)); write_le32(listtypeSTREAMHEADER); write_le32(ckidSTREAMHEADER); write_le32(sizeof(AVIStreamHeader)); m_pFileBuffer->write(&m_Streams[j]->m_Header, sizeof(AVIStreamHeader)); write_le32(ckidSTREAMFORMAT); #if 0 if (m_Streams[j]->m_uiFormatSize == 30) { char b[200]; avm_wave_format(b, sizeof(b), (const WAVEFORMATEX*)m_Streams[j]->m_pcFormat); AVM_WRITE("AVI writer", "STORE %p %s\n", m_Streams[j]->m_pcFormat, b); } #endif if (m_Streams[j]->m_uiFormatSize) { AVM_WRITE("AVI writer", 1, "WriteHdr %" PRIsz "\n", m_Streams[j]->m_uiFormatSize); write_le32((uint32_t)(m_Streams[j]->m_uiFormatSize)); m_pFileBuffer->write(m_Streams[j]->m_pcFormat, m_Streams[j]->m_uiFormatSize); if (m_Streams[j]->m_uiFormatSize & 1) m_pFileBuffer->write(&m_pFileBuffer, 1); } else { // fake header write_le32(4); write_le32(0); } } if (hdr_size > 0x700) throw FATAL("Too large header. Aborting"); uint32_t curpos = (uint32_t) m_pFileBuffer->lseek(0, SEEK_CUR); write_le32(ckidAVIPADDING); write_le32(0x7F4 - (curpos + 8)); m_pFileBuffer->lseek(0x7F4, SEEK_SET); write_le32(FOURCC_LIST); write_le32((uint32_t)(endpos - 0x7FC)); write_le32(listtypeAVIMOVIE); m_pFileBuffer->lseek(0x10, SEEK_SET); write_le32((uint32_t)hdr_size); m_pFileBuffer->lseek(0, SEEK_END); } IWriteFile* CreateWriteFile(const char* name, int64_t flimit, IStream::StreamFormat fmt, int flags, int mask) { return new AviWriteFile(name, flimit, flags, mask); } #undef __MODULE__ AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/aviwrite/AviWrite.h0000644000175000017500000001205611172414764020257 0ustar yavoryavor#ifndef AVIFILE_AVIWRITE_H #define AVIFILE_AVIWRITE_H #include "avifile.h" #include "avifmt.h" #include "FileBuffer.h" AVM_BEGIN_NAMESPACE; class AviWriteFile; class AviWriteStream : public IWriteStream { friend class AviWriteFile; public: AviWriteStream(AviWriteFile* file, int ckid, IStream::StreamType type, fourcc_t handler, int frame_rate, int flags = 0, const void* format = 0, size_t format_size = 0, size_t sample_size = 0, int quality = 0); virtual ~AviWriteStream(); virtual int AddChunk(const void* chunk, size_t size, int flags = 0); // // these two should be called before data insertion begins // // // for video streams, specify time in microsecs per frame in frame_rate // for audio streams - count of bytes per second // virtual size_t GetLength() const { return m_Header.dwLength; } virtual StreamType GetType() const { return m_type; } virtual int Start() { return 0; }; virtual int Stop() { return 0; }; protected: void SetAudioHeader(int samplesize, int bitrate, int scale) { m_Header.dwSampleSize = samplesize; m_Header.dwRate = bitrate; m_Header.dwScale = scale; } void SetVideoHeader(int quality, int width, int height) { m_Header.dwQuality = quality; m_Header.rcFrame.right = (int16_t) width; m_Header.rcFrame.bottom = (height < 0) ? (int16_t) -height : (int16_t) height; } AviWriteFile* m_pFile; AVIStreamHeader m_Header; StreamType m_type; char* m_pcFormat; size_t m_uiFormatSize; size_t m_uiLength; int m_ckid; int m_stop; // marks if Stop should be called - for Audio or Video stream }; class IAudioEncoder; class AviAudioWriteStream : public AviWriteStream, public IAudioWriteStream { public: AviAudioWriteStream(AviWriteFile* file, int ckid, const CodecInfo& ci, const WAVEFORMATEX* fmt, int bitrate, int flags = 0); virtual ~AviAudioWriteStream(); virtual int AddData(void* data, size_t size); virtual const CodecInfo& GetCodecInfo() const; virtual size_t GetLength() const; // IAudioWriteStream virtual int Start(); virtual int Stop(); private: IAudioEncoder* m_pAudioEnc; WAVEFORMATEX srcfmt; int m_astatus; int m_bitrate; }; class IVideoEncoder; class AviVideoWriteStream : public AviWriteStream, public IVideoWriteStream { public: AviVideoWriteStream(AviWriteFile* file, int ckid, const CodecInfo& ci, const BITMAPINFOHEADER* srchdr, int frame_rate, int flags = 0); virtual ~AviVideoWriteStream(); virtual int AddFrame(CImage* chunk, size_t* = 0, int* = 0, char** = 0); virtual const CodecInfo& GetCodecInfo() const; virtual size_t GetLength() const; // IVideoWriteStream virtual int Start(); virtual int Stop(); private: IVideoEncoder* m_pVideoEnc; int m_vstatus; char* m_pBuffer; }; class AviSegWriteFile; class AviWriteFile: public IWriteFile { friend class AviWriteStream; friend class AviSegWriteFile; public: AviWriteFile(const char* name, int64_t limit = 0, int flags = 0, int mask = 00666); virtual ~AviWriteFile(); virtual IVideoWriteStream* AddVideoStream(fourcc_t fourcc, const BITMAPINFOHEADER* srchdr, int frame_rate, int flags = 0); virtual IVideoWriteStream* AddVideoStream(const CodecInfo& ci, const BITMAPINFOHEADER* srchdr, int frame_rate, int flags = 0); virtual IVideoWriteStream* AddVideoStream(const VideoEncoderInfo* vi, int frame_rate, int flags = 0); virtual IAudioWriteStream* AddAudioStream(fourcc_t fourcc, const WAVEFORMATEX* format, int bitrate, int flags = 0); virtual IAudioWriteStream* AddAudioStream(const CodecInfo& ci, const WAVEFORMATEX* format, int bitrate, int flags = 0); virtual IWriteStream* AddStream(IStream::StreamType type, const void* format, size_t format_size, fourcc_t handler, int frame_rate, size_t samplesize = 0, int quality = 0, int flags = 0); virtual IWriteStream* AddStream(IReadStream* pCopyStream); virtual const char* GetFileName() const { return m_Filename.c_str(); } virtual int64_t GetFileSize() const; virtual int Reserve(size_t size); virtual int WriteChunk(fourcc_t fourcc, void* data, size_t size); virtual void WriteHeaders(); virtual int Segment(); virtual void SegmentAtKeyframe(); virtual void SetSegmentName(const avm::string& new_name); protected: // //called when data is added to stream // void AddChunk(const void* offset, size_t size, uint_t ckid, int flags = 0); void init(); void finish(); void write_le32(int x) { m_pFileBuffer->write_le32(x); } FileBuffer* m_pFileBuffer; int64_t m_lFlimit; // local AVIMainHeader m_Header; avm::string m_Filename; avm::vector m_Streams; avm::vector m_Index; int m_iStatus; int m_iFlags; int m_iMask; bool m_bSegmented; bool segment_flag; avm::string segmenting_name; }; AVM_END_NAMESPACE; #endif // AVIFILE_AVIWRITE_H avifile-0.7.48~20090503.ds/lib/aviwrite/FileBuffer.h0000644000175000017500000000421711175130054020524 0ustar yavoryavor#ifndef FILEBUFFER_H #define FILEBUFFER_H #include "avm_default.h" #ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE #endif #include "avm_except.h" #include #include #include // memcpy AVM_BEGIN_NAMESPACE; #define __MODULE__ "File buffer" class FileBuffer { int _fd; char* _buffer; size_t _bufsize; size_t _intlimit; size_t _used; public: FileBuffer(const char* fn, int mode = O_WRONLY | O_TRUNC | O_CREAT, int mask = 00644, size_t bufsize = 131072) { if (bufsize < 0) throw FATAL("Invalid argument"); //printf("Opening %s\n", fn); _fd = open(fn, mode, mask); if (_fd < 0) throw FATAL("Could not open file"); _buffer = new char[bufsize]; _bufsize = bufsize; _intlimit = bufsize - 4; _used = 0; } ~FileBuffer() { sync(); close(_fd); delete[] _buffer; } void sync() { ::write(_fd, _buffer, _used); _used = 0; } off_t lseek(off_t offset, int whence) { // return ::lseek(_fd, offset, whence); if (offset==0 && whence==SEEK_CUR) return ::lseek(_fd, 0, SEEK_CUR)+_used; sync(); return ::lseek(_fd, offset, whence); } ssize_t write(const void* buffer, size_t count) { // return ::write(_fd, buffer, count); ssize_t written = 0; while (count) { size_t size = (_bufsize-_used); if (count < size) size = count; memcpy(_buffer+_used, buffer, size); count -= size; _used += size; written += size; buffer = (const char*)buffer+size; if (_used == _bufsize) sync(); if ((_used == 0) && (count > _bufsize)) { // FIXME - check returned value!!! if (::write(_fd, buffer, count) < 0) return -1; written += count; break; } } return written; } void write_le32(int32_t value) { //::write(_fd, &value, 4); if (_used >= _intlimit) sync(); avm_set_le32(_buffer + _used, value); _used += 4; } void write_be32(int32_t value) { //::write(_fd, &value, 4); if (_used >= _intlimit) sync(); avm_set_be32(_buffer + _used, value); _used += 4; } }; #undef __MODULE__ AVM_END_NAMESPACE; #endif // FILEBUFFER_H avifile-0.7.48~20090503.ds/lib/common/0000755000175000017500000000000011267637356016017 5ustar yavoryavoravifile-0.7.48~20090503.ds/lib/common/Args.cpp0000644000175000017500000002647011171057145017412 0ustar yavoryavor#include "avm_args.h" #include "plugin.h" #include "configfile.h" #include "aviplay.h" #include #include #include #include #include AVM_BEGIN_NAMESPACE; static bool is_help(const char* str) { return (((toupper(str[0]) == 'H') && (str[1] == 0 || (strcasecmp(str + 1, "ELP") == 0))) || (str[0] == '?' && str[1] == 0)); } static void split(avm::vector& arr, const char* str) { if (str) { //printf("SPLIT %s\n", str); const char* b; while ((b = strchr(str, ':'))) { if (b > str) arr.push_back(avm::string(str, (uint_t)(b - str))); str = b + 1; } if (str[0]) arr.push_back(str); for (unsigned i = 0; i < arr.size(); ++i) printf("ARR %d %s\n", i, arr[i].c_str()); } } static void show_attrs(const CodecInfo& ci, const avm::vector& attr, const char* title) { if (attr.size()) { int val; printf(" %s:\n", title); for (unsigned i = 0; i < attr.size(); i++) { printf(" %20s", attr[i].GetName()); switch (attr[i].GetKind()) { case AttributeInfo::Integer: PluginGetAttrInt(ci, attr[i].GetName(), &val); printf(" %d default: %d <%d, %d>", val, attr[i].GetDefault(), attr[i].GetMin(), attr[i].GetMax()); break; case AttributeInfo::Select: PluginGetAttrInt(ci, attr[i].GetName(), &val); printf(" %s default: %s <", attr[i].GetOptions()[val].c_str(), attr[i].GetOptions()[attr[i].GetDefault()].c_str()); for (int j = attr[i].GetMin(); j < attr[i].GetMax(); j++) { if (j != attr[i].GetMin()) fputs(", ", stdout); fputs(attr[i].GetOptions()[j].c_str(), stdout); } fputc('>', stdout); break; default: ; } fputc('\n', stdout); } } else printf(" No %s\n", title); } static void set_codec_defaults(const CodecInfo& ci, const avm::vector& attr) { for (unsigned i = 0; i < attr.size(); i++) { switch (attr[i].GetKind()) { case AttributeInfo::Integer: case AttributeInfo::Select: PluginSetAttrInt(ci, attr[i].GetName(), attr[i].GetDefault()); default: break; } } } static bool read_bool(const Args::Option& o, const char* arg, const char* par, const char* r) { bool b = true; bool rs = false; if (par) { if (!strcasecmp(par, "off") || !strcmp(par, "0") || !strcasecmp(par, "false")) { b = false; rs = true; } else if (!strcasecmp(par, "on") || !strcmp(par, "1") || !strcasecmp(par, "true")) { rs = true; } } if (o.is(Args::Option::REGBOOL)) RegWriteInt(r, o.getLongOption(), b ? 1 : 0); else o.setBool(b); return rs; } static int read_double(const Args::Option& o, const char* arg, const char* par, const char* r) { if (!par) { printf("Option: %s - missing float value\n", arg); return -1; } double d = atof(par); if (!o.isInRange((int32_t)d)) { printf("Option: %s - value: %f out of range <%d, %d>", arg, d, o.getMin(), o.getMax()); return -1; } if (o.is(Args::Option::REGDOUBLE)) return RegWriteFloat(r, o.getLongOption(), (float)d); return o.setDouble(d); } static int read_int(const Args::Option& o, const char* arg, const char* par, const char* r) { if (!par) { printf("Option: %s - missing integer value\n", arg); return -1; } int v = 0; sscanf(par, "%i", &v); //printf("READINT %s %s %d\n", arg, par, v); if (!o.isInRange(v)) { printf("Option: %s - value: %d out of range <%d, %d>", arg, v, o.getMin(), o.getMax()); return -1; } if (o.is(Args::Option::REGINT)) return RegWriteInt(r, o.getLongOption(), v); return o.setInt(v); } static int read_string(const Args::Option& o, const char* arg, const char* par, const char* r) { if (!par) { printf("Option: %s - missing string value\n", arg); return -1; } if (o.is(Args::Option::REGSTRING)) return RegWriteString(r, o.getLongOption(), par); if (o.setString(strdup(par))) return -1; return 0; } static void show_help(const Args::Option* o, bool prefix) { size_t max = 0; avm::vector l; for (unsigned i = 0; !o[i].is(Args::Option::NONE); ++i) { avm::string s; if (o[i].is(Args::Option::HELP)) s.sprintf(" -h --help"); else s.sprintf(" %c%s %s%s", (o[i].getShortOption()[0] && prefix) ? '-' : ' ', o[i].getShortOption()[0] ? o[i].getShortOption() : " ", (o[i].getLongOption()[0] && prefix) ? "--" : "", o[i].getLongOption()[0] ? o[i].getLongOption() : "" //opt[i].options ? opt[i].options : "", //o[i].help ? o[i].help : "" ); l.push_back(s); size_t len = l.back().size(); if (max < len) max = len; } for (unsigned i = 0; !o[i].is(Args::Option::NONE); ++i) { if (!o[i].getShortOption()[0] && !o[i].getLongOption()[0] && !o[i].is(Args::Option::HELP) && !o[i].is(Args::Option::OPTIONS)) continue; if (!o[i].is(Args::Option::OPTIONS)) { fputs(l[i].c_str(), stdout); for (size_t s = l[i].size(); s <= max; s++) fputc(' ', stdout); if (o[i].is(Args::Option::HELP)) fputs("this help message", stdout); } if (o[i].getString()) { switch (o[i].getType()) { case Args::Option::INT: case Args::Option::REGINT: if (o[i].getHelp()[0]) printf(o[i].getHelp(), o[i].getInt(), o[i].getMin(), o[i].getMax()); break; case Args::Option::STRING: case Args::Option::REGSTRING: case Args::Option::SELECTSTRING: if (o[i].getHelp()[0]) printf(o[i].getHelp(), o[i].getString()); break; case Args::Option::OPTIONS: show_help(o[i].getOptions(), prefix); continue; default: if (o[i].getHelp()[0]) fputs(o[i].getHelp(), stdout); break; } } else if (o[i].getHelp()[0]) fputs(o[i].getHelp(), stdout); fputs("\n", stdout); } } static void parse_suboptions(const Args::Option* o, const char* oname, const char* pars, const char* r) { avm::vector arr; split(arr, pars); if (!arr.size() || is_help(arr[0].c_str())) { printf("Available options for '%s' (optA=x:optB=...)\n", oname); show_help(o, false); exit(0); } for (unsigned i = 0; i < arr.size(); ++i) { char* par = strchr(&arr[i][0], '='); if (par) { *par = 0; par++; } for (unsigned j = 0; !o[j].is(Args::Option::NONE); j++) { if ((arr[i] == o[j].getShortOption()) || (arr[i] == o[j].getLongOption())) { switch(o[j].getType()) { case Args::Option::BOOL: read_bool(o[j], arr[i].c_str(), par, r); break; case Args::Option::DOUBLE: read_double(o[j], arr[i].c_str(), par, r); break; case Args::Option::INT: read_int(o[j], arr[i].c_str(), par, r); break; case Args::Option::STRING: read_string(o[j], arr[i].c_str(), par, r); break; default: ; } } } } } static void parse_codec(const Args::Option* o, const char* a) { avm::vector ci; CodecInfo::Get(ci, CodecInfo::Video, CodecInfo::Both); CodecInfo::Get(ci, CodecInfo::Audio, CodecInfo::Both); avm::vector arr; split(arr, a); if (!arr.size() || arr[0] == "help") { const char nm[][8] = { "audio", "video" }; const char nd[][12] = { "", "encoder", "decoder", "de/encoder" }; fputs("Available codecs:\n" "Idx Short name Long name\n", stdout); for (unsigned i = 0; i < ci.size(); i++) printf("%3d %15s %s (%s %s)\n", i + 1, ci[i]->GetPrivateName(), ci[i]->GetName(), nm[ci[i]->media], nd[ci[i]->direction]); exit(0); } for (unsigned i = 0; i < ci.size(); ++i) { const char* cname = ci[i]->GetPrivateName(); if (arr[0] == cname) { if (arr[1] == "help") { printf(" Options for %s:\n", cname); show_attrs(*ci[i], ci[i]->decoder_info, "Decoding Options"); show_attrs(*ci[i], ci[i]->encoder_info, "Encoding Options"); exit(0); } else if (arr[1] == "defaults") { set_codec_defaults(*ci[i], ci[i]->decoder_info); set_codec_defaults(*ci[i], ci[i]->encoder_info); } else { for (unsigned j = 1; j < arr.size(); j++) { char* p = strchr(&arr[j][0], '='); int val = 0; bool valid = false; if (p) { *p++ = 0; if (sscanf(p, "%i", &val) > 0) valid = true; } const AttributeInfo* ai = ci[i]->FindAttribute(arr[j].c_str()); if (ai) { switch (ai->GetKind()) { case AttributeInfo::Integer: if (!valid) { printf(" Option %s for %s needs integer value! (given: %s)\n", arr[j].c_str(), cname, p); exit(1); } printf("Setting %s = %d\n", arr[j].c_str(), val); PluginSetAttrInt(*ci[i], arr[j].c_str(), val); break; case AttributeInfo::Select: default: ; } } else { printf(" Unknown attribute name '%s' for '%s'\n", arr[j].c_str(), cname); exit(1); } } } if (o) o->setString(strdup(cname)); // FIXME - use const ptr break; } } //for (unsigned i = 0; i < arr.size(); i++) printf("ARG %d %s\n", i, arr[i].c_str()); } void Args::ParseCodecInfo(const char* str) { parse_codec(0, str); } Args::Args(const Option* _o, int* _argc, char** _argv, const char* _help, const char* rname) : opts(_o), argc(_argc), argv(_argv), help(_help), regname(rname) { int sidx = 1; for (idx = 1; idx < *argc; ++idx) { if (argv[idx][0] == '-') { int olong = (argv[idx][1] == '-'); if (olong && argv[idx][2] == 0) { while (++idx < *argc) /* copy after '--' */ argv[sidx++] = argv[idx]; break; // end of options } if (findOpt(olong) == 0) continue; } else if (sidx != idx) argv[sidx] = argv[idx]; sidx++; } *argc = sidx; //for (idx = 1; idx < sidx; ++idx) printf("Left %d %s\n", idx, argv[idx]); } Args::~Args() { } int Args::findOpt(int olong) { char* arg = argv[idx] + olong + 1; char* par = strchr(arg, '='); if (par) *par++ = 0; else if ((idx + 1) < *argc) par = argv[++idx]; avm::vector ol; ol.push_back(opts); const Option* o = 0; while (ol.size() && (!o || !o->is(Option::NONE))) { o = ol.front(); ol.pop_front(); for (; !o->is(Option::NONE); ++o) { //printf("OPTION %c '%s' %d '%s' '%s'\n", o->getType(), arg, olong, o->getShortOption(), o->getLongOption()); if (o->is(Option::OPTIONS)) { ol.push_back(o->getOptions()); continue; } if (o->is(Option::HELP) && (is_help(arg))) break; const char* oarg = (olong) ? o->getLongOption() : o->getShortOption(); if (oarg && strcmp(arg, oarg) == 0) break; } } switch (o->getType()) { default: case Option::NONE: return -1; case Option::BOOL: case Option::REGBOOL: if (!read_bool(*o, arg, par, regname)) idx--; // no argument given break; case Option::DOUBLE: case Option::REGDOUBLE: read_double(*o, arg, par, regname); break; case Option::INT: case Option::REGINT: read_int(*o, arg, par, regname); break; case Option::STRING: case Option::REGSTRING: read_string(*o, arg, par, regname); break; case Option::CODEC: parse_codec(o, par); break; case Option::SUBOPTIONS: parse_suboptions(o->getOptions(), arg, par, regname); break; case Option::HELP: printf("\nUsage: %s %s\n\n", argv[0], help); show_help(opts, true); exit(0); } return 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/common/BaseError.cpp0000644000175000017500000000475210473077450020406 0ustar yavoryavor#include "avm_except.h" #include "utils.h" #include "avm_output.h" #include #include #include //vsnprintf #include //free AVM_BEGIN_NAMESPACE; BaseError::~BaseError() { if (module) free(module); if (description) free(description); if (severity) free(severity); } BaseError::BaseError() :file(0), module(0), description(0), severity(0), line(0) { } BaseError::BaseError(const char* sev, const char* mod, const char* f, int l, const char* desc) :file(f), line(l) { module = (char*) malloc(strlen(mod) + 1); if (!module) abort(); strcpy(module, mod); description = (char*) malloc(strlen(desc) + 256); if (!description) abort(); description[0] = 0; severity = (char*) malloc(strlen(sev) + 1); if (!severity) abort(); strcpy(severity, sev); } BaseError::BaseError(const BaseError& f) :module(0), description(0), severity(0) { operator=(f); } BaseError& BaseError::operator=(const BaseError& f) { file = f.file; line = f.line; if (module) free(module); if (description) free(description); if (severity) free(severity); module = (char*) malloc(strlen(f.module) + 1); if (!module) abort(); strcpy(module, f.module); description = (char*) malloc(strlen(f.description) + 1); if (!description) abort(); strcpy(description, f.description); severity = (char*) malloc(strlen(f.severity) + 1); if (!severity) abort(); strcpy(severity, f.severity); return *this; } void BaseError::Print() { AVM_WRITE("exception", "%s: %s: %s\n", module, severity, description); } void BaseError::PrintAll() { char bf[256]; int p = 0; if (file && strlen(file) < 230) p = sprintf(bf, " at %s", file); if (line) p += sprintf(bf + p, ": %d", line); AVM_WRITE("exception", "%s: %s: %s%s\n", module, severity, description, bf); } const char* BaseError::GetModule() const { return module; } const char* BaseError::GetDesc() const { return description; } FatalError::FatalError(const char* mod, const char* f, int l, const char* desc,...) :BaseError("FATAL", mod, f, l, desc) { va_list va; va_start(va, desc); vsnprintf(description, strlen(desc)+255, desc, va); va_end(va); } GenError::GenError(const char* mod, const char* f, int l, const char* desc,...) :BaseError("WARNING", mod, f, l, desc) { va_list va; va_start(va, desc); vsnprintf(description, strlen(desc)+255, desc, va); va_end(va); } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/common/BitmapInfo.cpp0000644000175000017500000000766411164473506020557 0ustar yavoryavor#include "image.h" #include "avm_fourcc.h" #include "avm_output.h" #include // labs #include //#include AVM_BEGIN_NAMESPACE; BitmapInfo::BitmapInfo() { } BitmapInfo::BitmapInfo(int width, int height, int bpp) { memset(this, 0, sizeof(BitmapInfo)); biWidth = width; biHeight = height; biPlanes = 1; switch (bpp) { case 8: case 15: case 16: case 24: case 32: SetBits(bpp); break; default: SetSpace(bpp); break; } } BitmapInfo::BitmapInfo(const BITMAPINFOHEADER& hdr) { unsigned int c = hdr.biSize; if (c > sizeof(BitmapInfo)) { AVM_WRITE("BitmapInfo", "BitmapInfo::Unknown format (BIH) - size: %d\n", c); c = sizeof(BitmapInfo); } memcpy(this, &hdr, c); if (c <= sizeof(BITMAPINFOHEADER)) { m_iColors[0] = m_iColors[1] = m_iColors[2] = 0; } } BitmapInfo::BitmapInfo(const BitmapInfo& bi) { if (bi.biSize > int(sizeof(BitmapInfo))) AVM_WRITE("BitmapInfo", "BitmapInfo::Unknown format (BI) - size: %d\n", bi.biSize); memcpy(this, &bi, sizeof(BitmapInfo)); } BitmapInfo::BitmapInfo(const BitmapInfo* bi) { if (!bi) AVM_WRITE("BitmapInfo", "BitmapInfo::Invalid argument\n"); else { if (bi->biSize > int(sizeof(BitmapInfo))) AVM_WRITE("BitmapInfo", "BitmapInfo::Unknown format (BI*) - size: %d\n", bi->biSize); memcpy(this, bi, sizeof(BitmapInfo)); } } int BitmapInfo::BitCount(int csp) { switch (csp) { case IMG_FMT_RGB32: return 32; case IMG_FMT_YUV: case IMG_FMT_I444: case IMG_FMT_RGB24: return 24; case IMG_FMT_I422: case IMG_FMT_Y422: case IMG_FMT_YUY2: case IMG_FMT_UYVY: case IMG_FMT_YVYU: case IMG_FMT_RGB16: return 16; case IMG_FMT_YV12: case IMG_FMT_IYUV: case IMG_FMT_I420: case IMG_FMT_I411: return 12; case IMG_FMT_Y800: return 8; } return 0; } int BitmapInfo::Bpp() const { if (biCompression == BI_RGB && biBitCount == 16) return 15; // 16bit BI_RGB is 5-5-5 if (biCompression == BI_BITFIELDS && m_iColors[0] == 0x7c00) return 15; return biBitCount; } void BitmapInfo::SetBitFields16() { biBitCount = 16; SetRGB(); biSize = sizeof(BitmapInfo); biCompression = BI_BITFIELDS; m_iColors[0] = 0xF800; m_iColors[1] = 0x07E0; m_iColors[2] = 0x001F; } void BitmapInfo::SetBitFields15() { biBitCount = 16; SetRGB(); biSize = sizeof(BitmapInfo); biCompression = BI_BITFIELDS; m_iColors[0] = 0x7C00; m_iColors[1] = 0x03E0; m_iColors[2] = 0x001F; } void BitmapInfo::SetRGB() { biSize = sizeof(BITMAPINFOHEADER); biCompression = BI_RGB; biPlanes = 1; biSizeImage = uint32_t(biWidth * labs(biHeight) * ((biBitCount + 7) / 8)); biHeight = int32_t(-labs(biHeight)); } void BitmapInfo::SetBits(int bits) { switch (bits) { case 16: SetBitFields16(); break; case 15: bits = 16; // this is legal and probably prefered way by M$ // we will use BI_RGB format instead of BI_BITFIELD // this format says it's 16 bit - but it is in reality 15 bit //SetBitFields15(); //break; default: biBitCount = uint16_t(bits); SetRGB(); break; } } void BitmapInfo::SetSpace(int csp) { biSize = sizeof(BITMAPINFOHEADER); biCompression = csp; biPlanes = 1; biBitCount = uint16_t(BitCount(csp)); biHeight = int32_t(-labs(biHeight)); biSizeImage = uint32_t(biWidth * labs(biHeight) * biBitCount / 8); } void BitmapInfo::Print() const { AVM_WRITE("BitmapInfo", 0, "BitmapInfo, format: \n"); AVM_WRITE("BitmapInfo", 0, " biSize %d ( %d x %d x %db ) %d bytes\n", biSize, biWidth, biHeight, biBitCount, biSizeImage); AVM_WRITE("BitmapInfo", 0, " biPlanes %d, biCompression 0x%08x='%.4s'\n", biPlanes, biCompression, (const char*)&biCompression); if (biSize > 40) AVM_WRITE("BitmapInfo", 0, " colors: 0x%04x 0x%04x 0x%04x\n", m_iColors[0], m_iColors[1], m_iColors[2]); } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/common/Config.cpp0000644000175000017500000001027411170620216017710 0ustar yavoryavor#include "Config.h" #include "configfile.h" #include "avm_output.h" #include #include #include #include #include #include AVM_BEGIN_NAMESPACE; static int compare_entry(const void* e1, const void* e2) { const ConfigEntry* ce1 = (const ConfigEntry*) e1; const ConfigEntry* ce2 = (const ConfigEntry*) e2; int r = strcmp(ce1->appname.c_str(), ce2->appname.c_str()); if (r == 0) r = strcmp(ce1->valname.c_str(), ce2->valname.c_str()); return r; } ConfigEntry::~ConfigEntry() { } ConfigFile::ConfigFile(const char* fn) : dirty(false), opened(false) { Open(fn); } ConfigFile::~ConfigFile() { Close(); } ConfigEntry* ConfigFile::Find(const char* appname, const char* valname) { if (opened) { for (size_t i = 0; i < entries.size(); ++i) { #if 0 printf("FIND %d:%d %s %s %s %s \n", i, entries.size(), (const char*)appname, (const char*)valname, (const char*)entries[i].appname, (const char*)entries[i].valname); #endif if (entries[i].appname == appname && entries[i].valname == valname) return &entries[i]; } } return 0; } void ConfigFile::Open(const char* fn) { if (opened) { if (filename == fn) return; Close(); } FILE* f = fopen(fn, "rb"); filename = fn; opened = true; dirty = false; if(!f) return; char appname[256], buf[4096], type; while (fgets(buf, sizeof(buf), f)) { char* bp = buf; buf[sizeof(buf) - 1] = 0; while (isspace(*bp)) bp++; if (!*bp) continue; if (*bp == '[') { sscanf(++bp, "%s", appname); continue; } char* bpt = bp; while (!isspace(*bp) && *bp) bp++; if (*bp) *bp++ = 0; while (isspace(*bp)) bp++; ConfigEntry e(appname, bpt); bpt = bp; while (*bp != '\n' && *bp) bp++; *bp = 0; e.value = bpt; if (e.valname.size() > 0) { e.type = ConfigEntry::Binary; entries.push_back(e); } } fclose(f); } void ConfigFile::Save() { if (!opened || !dirty) return; avm::string tempfile = filename; avm::string::size_type pos; const char* dname = tempfile.c_str(); const char* bname = ""; if ((pos = tempfile.rfind('/')) != avm::string::npos) { tempfile[pos] = 0; bname = &tempfile[pos] + 1; } char* tname = tempnam(dname, bname); if (!tname) { AVM_WRITE("Config", "WARNING: can't create temporary name\n"); return; } qsort(entries.begin(), entries.size(), sizeof(ConfigEntry), compare_entry); //printf("PATHNAME %s< %s\n", filename.c_str(), tname); FILE* f = fopen(tname, "wb"); if (!f) { free(tname); AVM_WRITE("Config", "WARNING: can't save configuration %s\n", strerror(errno)); return; } avm::string last; for (unsigned i = 0; !ferror(f) && (i < entries.size()); ++i) { if (entries[i].appname != last) { if (fprintf(f, "\n[ %s ]\n", entries[i].appname.c_str()) < 0) break; last = entries[i].appname; } if (fprintf(f, "%s ", entries[i].valname.c_str()) < 0) break; switch(entries[i].type) { case ConfigEntry::Int: fprintf(f, "%d\n", entries[i].i); break; case ConfigEntry::Float: fprintf(f, "%f\n", entries[i].f); break; case ConfigEntry::Binary: fwrite(entries[i].value.c_str(), entries[i].value.size(), 1, f); if (!ferror(f)) fprintf(f, "\n"); break; } } // note: always needed to run all commands ferror(), fsync(),fclose() if ((ferror(f) | fsync(fileno(f)) | fclose(f)) || rename(tname, filename.c_str()) != 0) { AVM_WRITE("Config", "WARNING: can't save configuration %s\n", strerror(errno)); unlink(tname); } free(tname); } void ConfigFile::Close() { Save(); entries.clear(); opened = false; } void ConfigFile::push_back(const ConfigEntry& e) { dirty = true; entries.push_back(e); } ConfigEntry& ConfigEntry::operator=(const ConfigEntry& e) { type = e.type; appname = e.appname; valname = e.valname; value.erase(); switch (type) { case Binary: value = e.value; break; case Int: i = e.i; break; case Float: f = e.f; break; } return *this; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/common/Config.h0000644000175000017500000000323211164774363017371 0ustar yavoryavor#ifndef AVIFILE_CONFIG_H #define AVIFILE_CONFIG_H #include "avm_stl.h" AVM_BEGIN_NAMESPACE; /********** * WARNING - this file is meant to be used by internal avifile application * DO NOT USE in your own project! * the API here could change in any minute */ struct ConfigEntry { enum Types { Int, Float, Binary } type; avm::string appname; avm::string valname; avm::string value; union { int i; float f; }; ConfigEntry(const char* _appname = 0, const char* _valname = 0, int _i = 0) : type(Int), appname(_appname), valname(_valname), i(_i) {} ConfigEntry(const char* _appname, const char* _valname, float _f) : type(Float), appname(_appname), valname(_valname), f(_f) {} ConfigEntry(const char* _appname, const char* _valname, const char* _v) : type(Binary), appname(_appname), valname(_valname), value(_v) {} ~ConfigEntry(); ConfigEntry(const ConfigEntry& e) { operator=(e); } ConfigEntry& operator= (const ConfigEntry& e); ConfigEntry& SetFloat(float _f) { value.erase(); f = _f; type = Float; return *this; } ConfigEntry& SetInt(int _i) { value.erase(); i = _i; type = Int; return *this; } ConfigEntry& SetString(const char* _value) { value = _value; type = Binary; return *this; } }; struct ConfigFile { avm::string filename; avm::vector entries; bool dirty; bool opened; ConfigFile(const char* fn); ~ConfigFile(); void Close(); void Save(); void Open(const char* fn); ConfigEntry* Find(const char* appname, const char* valname); void push_back(const ConfigEntry& e); void sort(); }; AVM_END_NAMESPACE; #endif // AVIFILE_CONFIG_H avifile-0.7.48~20090503.ds/lib/common/Locker.cpp0000644000175000017500000000562711164473217017742 0ustar yavoryavor#include "avm_locker.h" // to get recursive mutexes // #define __USE_UNIX98 #include #include //EDEADLK #include #include // doesn't exists on BSD systems ?? #include AVM_BEGIN_NAMESPACE; PthreadMutex::PthreadMutex( /*Attr mattr */ ) { m_pMutex = new pthread_mutex_t; #if 0 pthread_mutexattr_t pma; pthread_mutexattr_init(&pma); if (mattr == RECURSIVE) pthread_mutexattr_settype(&pma, PTHREAD_MUTEX_RECURSIVE_NP); pthread_mutex_init((pthread_mutex_t*) m_pMutex, &pma); #endif pthread_mutex_init((pthread_mutex_t*) m_pMutex, NULL); } PthreadMutex::~PthreadMutex() { pthread_mutex_destroy((pthread_mutex_t*) m_pMutex); delete (pthread_mutex_t*) m_pMutex; } int PthreadMutex::Lock() { return pthread_mutex_lock((pthread_mutex_t*) m_pMutex); } int PthreadMutex::TryLock() { return (pthread_mutex_trylock((pthread_mutex_t*) m_pMutex) != EBUSY) ? 0 : -1; } int PthreadMutex::Unlock() { return pthread_mutex_unlock((pthread_mutex_t*) m_pMutex); } PthreadCond::PthreadCond() { m_pCond = new pthread_cond_t; pthread_cond_init((pthread_cond_t*) m_pCond, NULL); } PthreadCond::~PthreadCond() { pthread_cond_destroy((pthread_cond_t*) m_pCond); delete (pthread_cond_t*) m_pCond; } int PthreadCond::Wait(PthreadMutex& m, float waitTime) { if (waitTime >= 0.f) { struct timespec timeout; struct timeval now; unsigned int round = (unsigned int) waitTime; gettimeofday(&now, 0); //timeout.tv_sec = now.tv_sec + (int)waitTime; //waitTime -= (int)waitTime; //timeout.tv_nsec = (now.tv_usec + (int)(waitTime * 1000000)) * 1000; timeout.tv_sec = now.tv_sec + round; timeout.tv_nsec = (now.tv_usec + (unsigned int)((waitTime - (float)round) * 1000000.f)) * 1000; //printf("Wait %f %d %ld\n", waitTime, round, timeout.tv_nsec ); if (timeout.tv_nsec >= 1000000000) { timeout.tv_nsec -= 1000000000; timeout.tv_sec++; } // time limited conditional waiting here! // sometimes decoder thread could be stoped // and we would have wait here forever int r = pthread_cond_timedwait((pthread_cond_t*) m_pCond, (pthread_mutex_t*) m.m_pMutex, &timeout); if (r < 0) perror("PthreadCond::Wait()"); return r; } return pthread_cond_wait((pthread_cond_t*) m_pCond, (pthread_mutex_t*) m.m_pMutex); } int PthreadCond::Broadcast() { return pthread_cond_broadcast((pthread_cond_t*) m_pCond); } PthreadTask::PthreadTask(void* attr, void* (*start_routine)(void *), void* arg) { m_pTask = new pthread_t; if (pthread_create((pthread_t*) m_pTask, (pthread_attr_t*) attr, start_routine, arg)) perror("PthreadTask()"); } PthreadTask::~PthreadTask() { int result = pthread_join(* ((pthread_t*)m_pTask), 0); delete (pthread_t*) m_pTask; if (result == EDEADLK) { perror("~PthreadTask()"); pthread_exit(NULL); } } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/common/Registry.cpp0000644000175000017500000000646311164473322020327 0ustar yavoryavor#include "configfile.h" #include "Config.h" #include "avm_output.h" #include #include #include #include #include // atexit #include #include AVM_BEGIN_NAMESPACE /* avoiding using static objects - using just pointers */ #define DEFAULT_DIR ".avm" #define DEFAULT_NAME "default" static avm::string sConfigDir(DEFAULT_DIR); static avm::string sConfigName(DEFAULT_NAME); static ConfigFile* config = 0; // called at exit static void destroy_config() { delete config; config = 0; } static ConfigFile* get_config() { if (!config) { const char* home = getenv("HOME"); if (home == 0) { const struct passwd* pwent = getpwuid(getuid()); home = pwent->pw_dir; } avm::string s(home); s += "/"; s += sConfigDir; struct stat st; if (stat(s.c_str(), &st)) { AVM_WRITE("Registry", "creating dir: %s\n", s.c_str()); mkdir(s.c_str(), 0755); } s += "/"; s += sConfigName; config = new ConfigFile(s.c_str()); atexit(destroy_config); } return config; } void* RegInit(const char* regname, const char* dirname) { destroy_config(); sConfigDir = dirname ? : DEFAULT_DIR; sConfigName = regname ? : DEFAULT_NAME; return get_config(); } void RegSave() { get_config()->Save(); } int RegReadInt(const char* appname, const char* valname, int def_value) { if (ConfigEntry* e = get_config()->Find(appname, valname)) { if (e->type == ConfigEntry::Int) return e->i; if (e->type == ConfigEntry::Binary && (sscanf(e->value.c_str(), "%d", &e->i) == 1)) { e->type = ConfigEntry::Int; return e->i; } } RegWriteInt(appname, valname, def_value); return def_value; } int RegWriteInt(const char* appname, const char* valname, int value) { if (ConfigEntry* e = get_config()->Find(appname, valname)) { e->SetInt(value); get_config()->dirty = true; } else get_config()->push_back(ConfigEntry(appname, valname, value)); return 0; } float RegReadFloat(const char* appname, const char* valname, float def_value) { if (ConfigEntry* e = get_config()->Find(appname, valname)) { if (e->type != ConfigEntry::Float) { if (e->type != ConfigEntry::Binary || (sscanf(e->value.c_str(), "%f", &e->f) != 1)) return -1; e->type = ConfigEntry::Float; } return e->f; } RegWriteFloat(appname, valname, def_value); return def_value; } int RegWriteFloat(const char* appname, const char* valname, float value) { if (ConfigEntry* e = get_config()->Find(appname, valname)) { e->SetFloat(value); get_config()->dirty = true; } else get_config()->push_back(ConfigEntry(appname, valname, value)); return 0; } const char* RegReadString(const char* appname, const char* valname, const char* def_value) { if (ConfigEntry* e = get_config()->Find(appname, valname)) return (e->type == ConfigEntry::Binary) ? e->value.c_str() : ""; RegWriteString(appname, valname, def_value); return def_value; } int RegWriteString(const char* appname, const char* valname, const char* value) { if (ConfigEntry* e = get_config()->Find(appname, valname)) { e->SetString(value); get_config()->dirty = true; } else get_config()->push_back(ConfigEntry(appname, valname, value)); return 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/common/Statistic.cpp0000644000175000017500000000170611164473420020460 0ustar yavoryavor#include "Statistic.h" #include AVM_BEGIN_NAMESPACE; Statistic::Statistic(const char* name, uint_t size) :m_pName(name), m_pValues(0), m_uiSize(size), m_uiPos(0), m_dSum(0) { } Statistic::~Statistic() { delete[] m_pValues; } Statistic::Statistic(const Statistic& s) { m_pName = s.m_pName; m_uiSize = s.m_uiSize; if ((m_pValues = new float[m_uiSize])) memcpy(m_pValues, s.m_pValues, sizeof(float) * m_uiSize); m_dSum = s.m_dSum; m_uiPos = s.m_uiPos; } void Statistic::clear() { m_dSum = 0; delete[] m_pValues; m_pValues = 0; } void Statistic::insert(float v) { if (!m_pValues) { m_pValues = new float[m_uiSize]; if (!m_pValues) return; for (unsigned i = 0; i < m_uiSize; i++) m_pValues[i] = v; m_dSum = v * float(m_uiSize); } m_dSum -= m_pValues[m_uiPos]; m_pValues[m_uiPos] = v; m_dSum += v; m_uiPos = (m_uiPos + 1) % m_uiSize; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/common/Statistic.h0000644000175000017500000000115111171057145020117 0ustar yavoryavor#ifndef AVIFILE_STATISTIC_H #define AVIFILE_STATISTIC_H #include "avm_stl.h" AVM_BEGIN_NAMESPACE; class Statistic { static const int STAT_SIZE = 25; avm::string m_pName; float* m_pValues; uint_t m_uiSize; uint_t m_uiPos; double m_dSum; public: explicit Statistic(const char* name, uint_t msize = STAT_SIZE); Statistic(const Statistic& s); ~Statistic(); float average() const { return (float)(m_dSum / m_uiSize); } void clear(); void insert(float v); const char* getName() const { return m_pName.c_str(); } }; AVM_END_NAMESPACE; #endif // AVIFILE_STATISTIC_H avifile-0.7.48~20090503.ds/lib/common/String.cpp0000644000175000017500000000722511164473506017766 0ustar yavoryavor#include "avm_stl.h" #include #include #include #include #include AVM_BEGIN_NAMESPACE; static char empty_string[] = ""; // used as empty string - shall never be overwritten string::string() { //str = new char[1]; //str[0] = 0; str = empty_string; } string::string(char s) { str = new char[2]; str[0] = s; str[1] = 0; } string::string(const char* s, size_type len) { size_t slen = (s) ? strlen(s) : 0; if (len == 0 || len > slen) len = slen; str = new char[len + 1]; if (str) { if (s) memcpy(str, s, len); str[len] = 0; } else str = empty_string; } string::string(const string& s, size_type len) { if (len == 0 || len > s.size()) len = s.size(); str = new char[len + 1]; if (str) { memcpy(str, s.str, len); str[len] = 0; } else str = empty_string; } string::~string() { if (str != empty_string) { //AVM_WRITE("Init", 0, "delete %s\n", str); delete[] str; } } bool string::operator==(const char* s) const { if (s) return !strcmp(str, s); return (size() == 0); } bool string::operator<(const string& s) const { return (strcmp(str, s.str)<0); } string& string::operator=(const char* s) { if (str != s) { if (str != empty_string) delete[] str; size_t sz = (!s) ? 0 : strlen(s) + 1; if (sz > 1 && (str = new char[sz])) memcpy(str, s, sz); else str = empty_string; } return *this; } string& string::operator+=(const char* s) { if (s) { size_type s1 = size(); size_t s2 = strlen(s) + 1; // with '0' if (s2 > 1) { char* p = new char[s1 + s2]; if (p) { memcpy(p, str, s1); memcpy(p + s1, s, s2); if (str != empty_string) delete[] str; str = p; } } } return *this; } string& string::erase(size_type from, size_type to) { if (str != empty_string) { char* p = str + from; if (to != npos && to > 0 && to < size()) { // add check for size() ??? char* i = p + to; while (*i) *p++ = *i++; } if (p == str) { delete[] str; str = empty_string; } else *p = 0; } return *this; } void string::insert(size_type pos, const string& s) { size_type l = s.size(); size_type k = size(); char* p = new char[k + l + 1]; if (p) { strcpy(p, str); strcpy(p + pos, s.str); strcpy(p + pos + l, str + pos); if (str != empty_string) delete[] str; str = p; str[k + l] = 0; } } string::size_type string::find(const string& s, size_type startpos) const { const char* p = strstr(str + startpos, s.str); return (p) ? p - str : npos; } string::size_type string::find(char c) const { const char* p = strchr(str, c); return (p) ? p - str : npos; } string::size_type string::rfind(char c) const { const char* p = strrchr(str, c); return (p) ? p - str : npos; } int string::sprintf(const char* fmt, ...) { int r; char* s = 0; va_list ap; va_start(ap, fmt); if (str != empty_string) delete[] str; #ifdef _GNU_SOURCE r = vasprintf(&s, fmt, ap); #else // a bit poor hack but should be sufficient // eventually write full implementation s = malloc(1000); r = vsnprintf(s, 999, fmt, ap); #endif if (s && (str = new char[r + 1])) { memcpy(str, s, r); str[r] = 0; free(s); } else { str = empty_string; r = 0; } return r; } string& string::tolower() { char* p = str; while (*p) { *p = (char)::tolower(*p); p++; } return *this; } string& string::toupper() { char* p = str; while (*p) { *p = (char)::toupper(*p); p++; } return *this; } AVM_END_NAMESPACE avifile-0.7.48~20090503.ds/lib/common/avm_output.cpp0000644000175000017500000001204010747174026020713 0ustar yavoryavor#include "avm_output.h" #include "avm_stl.h" #include "avm_locker.h" #include "avm_map.h" #include "avm_cpuinfo.h" #include #include #include // ALL STATIC OBJECTS are defined HERE avm::CPU_Info freq; // will be initialized first thing AVM_BEGIN_NAMESPACE; AvmOutput::AvmOutput* AvmOutput::m_pSelf = 0; int AvmOutput::m_iLevel = 0; // debug level struct AvmOutput::AvmOutputPrivate { struct Less { bool operator()(const char* p1, const char* p2) const; }; struct Equal { bool operator()(const char* p1, const char* p2) const; bool operator()(const char* p1, int p2) const; }; avm::string m_sString; const char* m_sCurrentMode; char tmps[1024]; PthreadMutex m_Mutex; int m_iDebugLevel; avm::avm_map m_sMap; }; AvmOutput::AvmOutput() : priv(0) { assert(m_pSelf == 0); m_pSelf = this; resetDebugLevels(); // static initilization - runs only once freq.Init(); } AvmOutput::~AvmOutput() { delete priv; m_pSelf = 0; } void AvmOutput::createAvmOutput() { new AvmOutput(); } AvmOutput::AvmOutput* AvmOutput::singleton() { assert(m_pSelf != 0); return m_pSelf; } void AvmOutput::setDebugLevel(const char* mode, int level) { if (mode) *priv->m_sMap.find_insert(mode) = level; } // referenced internaly void AvmOutput::vwrite(const char* format, va_list va) { vsnprintf(priv->tmps, sizeof(priv->tmps)-1, format, va); priv->m_sString += priv->tmps; if (errno && (priv->m_iDebugLevel & AVML_STRERROR)) { priv->m_sString += " "; priv->m_sString += strerror(errno); } flush(); } void AvmOutput::vwrite(const char* mode, const char* format, va_list va) { Locker locker(priv->m_Mutex); priv->m_sCurrentMode = mode; priv->m_iDebugLevel = 0; vwrite(format, va); } void AvmOutput::vwrite(const char* mode, int debuglevel, const char* format, va_list va) { Locker locker(priv->m_Mutex); priv->m_sCurrentMode = mode; priv->m_iDebugLevel = debuglevel; vwrite(format, va); } /* void AvmOutput::write(const char* format, ...) { // if(m_iDebugLevel<=m_iWriterDebugLevel) // return; m_iDebugLevel=0; m_sCurrentMode=""; va_list va; va_start(va, format); vwrite(format, va); va_end(va); if((m_sString.size()>80) || (m_sString.find('\n')!=string::npos)) flush(); } */ void AvmOutput::write(const char* mode, const char* format, ...) { // if(m_iDebugLevel<=m_iWriterDebugLevel) // return; Locker locker(priv->m_Mutex); va_list va; // string sOldMode=m_sCurrentMode; priv->m_sCurrentMode = mode; priv->m_iDebugLevel = 0; va_start(va, format); vwrite(format, va); va_end(va); // m_sCurrentMode=sOldMode; } /* void AvmOutput::write(int debuglevel, const char* format, ...) { // if(m_iDebugLevel<=debuglevel) // return; m_sCurrentMode=""; m_iDebugLevel=debuglevel; va_list va; va_start(va, format); vwrite(format, va); va_end(va); if((m_sString.size()>80) || (m_sString.find('\n')!=string::npos)) flush(); } */ void AvmOutput::write(const char* mode, int debuglevel, const char* format, ...) { // if(m_iDebugLevel<=debuglevel) // return; va_list va; Locker locker(priv->m_Mutex); // string sOldMode=m_sCurrentMode; priv->m_sCurrentMode = mode; priv->m_iDebugLevel = debuglevel; va_start(va, format); vwrite(format, va); va_end(va); // m_sCurrentMode=sOldMode; } void AvmOutput::resetDebugLevels(int level) { if (!priv) priv = new AvmOutput::AvmOutputPrivate(); for(avm_map::const_iterator i = priv->m_sMap.begin(); i != priv->m_sMap.end(); i++) i->value=level; } void AvmOutput::flush() { if (!priv->m_sString.size()) return; int p = *priv->m_sMap.find_default(priv->m_sCurrentMode); //printf("PPP: %d leve %d\n", p, priv->m_iDebugLevel); if (p >= priv->m_iDebugLevel) { printf("<%s> : %s", priv->m_sCurrentMode, priv->m_sString.c_str()); if (!priv->m_sString.find('\n')) puts(""); } priv->m_sString.erase(); } bool AvmOutput::AvmOutputPrivate::Less::operator()(const char* p1, const char* p2) const { if(!p1) return true; if(!p2) return false; return strcmp(p1, p2); } bool AvmOutput::AvmOutputPrivate::Equal::operator()(const char* p1, const char* p2) const { //printf("P1: %p %s\n", p1, p1); printf("P2: %p %s\n", p2, p2); printf("done\n"); if (!p1) return (!p2); if (!p2) return false; return strcmp(p1, p2); } bool AvmOutput::AvmOutputPrivate::Equal::operator()(const char* p1, int p2) const { assert(!p2); if (!p1) return true; return (p1[0]==0); } AVM_END_NAMESPACE; void avm_printf(const char* mode, const char* format, ...) { va_list va; va_start(va, format); avm::AvmOutput()->vwrite(mode, format, va); va_end(va); } void avm_dprintf(const char* mode, int debuglevel, const char* format, ...) { va_list va; va_start(va, format); avm::AvmOutput()->vwrite(mode, debuglevel, format, va); va_end(va); } avifile-0.7.48~20090503.ds/lib/common/fcc_type.c0000644000175000017500000000557411164473506017761 0ustar yavoryavor#include "utils.h" #include "avm_fourcc.h" #include "formats.h" //#include const char* avm_fcc_name(fourcc_t fcc) { switch (fcc) { case fccdiv3: case fccDIV3: return "DIV3 (divx)"; case fccdiv4: case fccDIV4: return "DIV4 (divx)"; case fccdiv5: case fccDIV5: return "DIV5 (divx)"; case fccdiv6: case fccDIV6: return "DIV6 (divx)"; case fccmp41: case fccMP41: return "MP41 (divx)"; case fccMP43: return "MP43 (divx)"; case fccMP42: case fccmp42: return "MP42 (MS MPEG-4)"; case fccmp43: return "MP43 (MS MPEG-4)"; case fccmpg4: case fccMPG4: return "MPG4 (MS MPEG-4)"; case fccWMV1: case fccwmv1: return "WMV1 (WinMP)"; case fccWMV2: case fccwmv2: return "WMV2 (WinMP)"; case fccIV32: return "IV32 (Indeo)"; case fccIV41: return "IV41 (Indeo)"; case fccIV50: return "IV50 (Indeo)"; case fccI263: return "I263 (Indeo)"; case fcccvid: return "CVID (Cinepak)"; case fccVCR2: return "VCR2"; case fccMJPG: return "MLPG"; case fccYUV: return "YUV"; case fccYUY2: return "YUV2"; case fccYV12: return "YV12"; case fccIYUV: return "IYUV"; case fccUYVY: return "UYVY"; case fccYVYU: return "YVYU"; } return "unknown"; } const char *avm_img_format_name(fourcc_t fmt) { static const struct dts { fourcc_t fmt; const char name[16]; } const data[] = { { IMG_FMT_BGR32, "BGR 32-bit" }, { IMG_FMT_BGR24, "BGR 24-bit" }, { IMG_FMT_BGR16, "BGR 16-bit" }, { IMG_FMT_BGR15, "BGR 15-bit" }, { IMG_FMT_BGR8, "BGR 8-bit" }, { IMG_FMT_RGB32, "RGB 32-bit" }, { IMG_FMT_RGB24, "RGB 24-bit" }, { IMG_FMT_RGB16, "RGB 16-bit" }, { IMG_FMT_RGB15, "RGB 15-bit" }, { IMG_FMT_RGB8, "RGB 8-bit" }, { IMG_FMT_CLPL, "Planar CLPL" }, { IMG_FMT_I420, "Planar I420" }, { IMG_FMT_I422, "Planar I422" }, { IMG_FMT_I444, "Planar I444" }, { IMG_FMT_IF09, "Planar IF09" }, { IMG_FMT_IYUV, "Planar IYUV" }, { IMG_FMT_Y8, "Planar Y8" }, { IMG_FMT_Y800, "Planar Y800" }, { IMG_FMT_YV12, "Planar YV12" }, { IMG_FMT_YVU9, "Planar YVU9" }, { IMG_FMT_CLJR, "Packed CLJR" }, { IMG_FMT_IUYV, "Packed IUYV" }, { IMG_FMT_IY41, "Packed IY41" }, { IMG_FMT_IYU1, "Packed IYU1" }, { IMG_FMT_IYU2, "Packed IYU2" }, { IMG_FMT_UYNV, "Packed UYNV" }, { IMG_FMT_UYVP, "Packed UYVP" }, { IMG_FMT_UYVY, "Packed UYVY" }, { IMG_FMT_V422, "Packed V422" }, { IMG_FMT_V655, "Packed V655" }, { IMG_FMT_Y211, "Packed Y211" }, { IMG_FMT_Y41P, "Packed Y41P" }, { IMG_FMT_Y41T, "Packed Y41T" }, { IMG_FMT_Y422, "Packed Y422" }, { IMG_FMT_Y42T, "Packed Y42T" }, { IMG_FMT_YUNV, "Packed YUNV" }, { IMG_FMT_YUVP, "Packed YUVP" }, { IMG_FMT_YUY2, "Packed YUY2" }, { IMG_FMT_YVYU, "Packed YVYU" }, { IMG_FMT_cyuv, "Packed CYUV" }, { IMG_FMT_MPEGPES, "Mpeg PES" }, { 0, "Unknown" } }; const struct dts* t = data; while (t->fmt && t->fmt != fmt) t++; return t->name; } avifile-0.7.48~20090503.ds/lib/common/frame.h0000644000175000017500000000157707553216757017275 0ustar yavoryavor#ifndef AVIFILE_FRAME_H #define AVIFILE_FRAME_H #include "image.h" // internal representation for one frame AVM_BEGIN_NAMESPACE; class frame { CImage *m_pData; double m_dTime; framepos_t m_uiPos; public: frame() : m_pData(0), m_dTime(-1.0), m_uiPos(0) {} ~frame() { if (m_pData) m_pData->Release(); } CImage* getData() { return m_pData; } framepos_t getPos() { return m_uiPos; } double getTime() { return m_dTime; } void setData(CImage* newData) { if (m_pData) m_pData->Release(); m_pData = newData; } void setDataQuality(float q) { if (m_pData) m_pData->SetQuality(q); } float getDataQuality() { return (m_pData) ? m_pData->GetQuality() : 0.0f; } void setPos(framepos_t p) { m_uiPos = p; } void setTime(double t) { m_dTime = t; } }; AVM_END_NAMESPACE; #endif // AVIFILE_FRAME_H avifile-0.7.48~20090503.ds/lib/common/image.cpp0000644000175000017500000011751011167212026017570 0ustar yavoryavor#include "image.h" #include "avm_cpuinfo.h" #include "mmx.h" #include "avm_fourcc.h" #include "avm_output.h" #include "utils.h" #include #include #include #include #include #include AVM_BEGIN_NAMESPACE; #define VALGRIND #define STDCONV_PARAMS \ CImage* to, const CImage* from, bool flip_dir #define SHORTLINEARGS \ uint8_t* dest, const uint8_t* src, int w #define LONGLINEARGS \ uint8_t* dest_y, uint8_t* dest_cr, uint8_t* dest_cb, \ int ds_y, int ds_cr, int ds_cb, \ const uint8_t* src_y, const uint8_t* src_cr, const uint8_t* src_cb, \ int ss_y, int ss_cr, int ss_cb, \ int w, int h #define SETWHS() \ int w = (to->m_Window.w < from->m_Window.w) ? to->m_Window.w : from->m_Window.w; \ int h = (to->m_Window.h < from->m_Window.h) ? to->m_Window.h : from->m_Window.h; \ int ss_y = (flip_dir) ? -from->m_iStride[0] : from->m_iStride[0]; \ int ds_y = to->m_iStride[0] #ifdef XXX_ARCH_X86 //MMX versions #undef RENAME #define HAVE_MMX #undef HAVE_MMX2 #undef HAVE_3DNOW #define RENAME(a) a ## _MMX #include "image_mmx.h" //MMX2 versions #undef RENAME #define HAVE_MMX #define HAVE_MMX2 #undef HAVE_3DNOW #define RENAME(a) a ## _MMX2 #include "image_mmx.h" #endif static inline void emms() { #if ARCH_X86 if (freq.HaveMMX()) __asm__ __volatile__ ("emms":::"memory"); #endif } static void stride_memcpy(void* to, int strideout, const void* from, int stridein, int bpl, int h) { //printf("Stride %p - %d ::: %p - %d %d %d\n", out, strideout, in, stridein, bpl, h); if (bpl & 0x1f || !freq.HaveMMX()) { //printf("wrong h: %d bpl: %d %d %d\n", h, bpl, strideout, stridein); while (--h >= 0) { memcpy(to, from, bpl); to = (char*) to + strideout; from = (const char*) from + stridein; } } #if ARCH_X86 // mmx2 doesn't write into l2 cache // XXX: sometimes this doesn't have to be a good idea so be careful here else if (freq.HaveMMXEXT()) { //printf("stridecpy h: %d bpl: %d so:%d si:%d\n", h, bpl, strideout, stridein); char* tout = (char*)to + bpl; const char* tin = (const char*)from + bpl; while (--h >= 0) { long tbpl = -bpl; __asm__ __volatile__ ( ".balign 8 \n\t" "1: \n\t" "movq (%1, %0), %%mm0 \n\t" "prefetchnta 32(%1, %0) \n\t" "movq 8(%1, %0), %%mm1 \n\t" "movq 16(%1, %0), %%mm2 \n\t" "movq 24(%1, %0), %%mm3 \n\t" "prefetchnta 64(%1, %0) \n\t" "movntq %%mm0, (%2, %0) \n\t" "movntq %%mm1, 8(%2, %0) \n\t" "movntq %%mm2, 16(%2, %0) \n\t" "movntq %%mm3, 24(%2, %0) \n\t" "add $32, %0 \n\t" "js 1b \n\t" :"+r"(tbpl) :"r"(tin), "r"(tout) :"memory" ); tout += strideout; tin += stridein; } } else { //printf("stridecpy h: %d bpl: %d so:%d si:%d\n", h, bpl, strideout, stridein); char* tout = (char*)to + bpl; const char* tin = (const char*)from + bpl; while (--h >= 0) { long tbpl = -bpl; __asm__ __volatile__ ( ".balign 8 \n\t" "1: \n\t" "movq (%1, %0), %%mm0 \n\t" "movq %%mm0, (%2, %0) \n\t" "movq 8(%1, %0), %%mm1 \n\t" "movq 16(%1, %0), %%mm2 \n\t" "movq 24(%1, %0), %%mm3 \n\t" "movq %%mm1, 8(%2, %0) \n\t" "movq %%mm2, 16(%2, %0) \n\t" "movq %%mm3, 24(%2, %0) \n\t" "add $32, %0 \n\t" "js 1b \n\t" :"+r"(tbpl) :"r"(tin), "r"(tout) :"memory" ); tout += strideout; tin += stridein; } } #endif // ARCH_X86 } static void bgr32_bgr32_c(SHORTLINEARGS) { stride_memcpy(dest, w * 4, src, w * 4, w * 4, 1); } static void bgr24_bgr24_c(SHORTLINEARGS) { stride_memcpy(dest, w * 3, src, w * 3, w * 3, 1); } static void bgr16_bgr16_c(SHORTLINEARGS) { stride_memcpy(dest, w * 2, src, w * 2, w * 2, 1); } static void bgr15_bgr16_c(SHORTLINEARGS) { const uint16_t* s = (const uint16_t*) src; uint16_t* d = (uint16_t*) dest; while (w > 1) { w -= 2; uint32_t q = *((const uint32_t *)&s[w]); *((uint32_t *)&d[w]) = (q & 0x7FFF7FFFU) + (q & 0x7FE07FE0U); } if (w) { uint16_t q = s[0]; d[0] = uint16_t(q + uint16_t(q & 0x7FE0U)); } } /* * From BGR24 conversions */ static void bgr24_bgr15_c(SHORTLINEARGS) { uint16_t* d = (uint16_t*) dest; while (--w >= 0) // looks ugly but gives good compiled code d[w] = uint16_t(((((((src[w*3+2]<<5)&0xff00)|src[w*3+1])<<5)&0xfff00)|src[w*3+0])>>3); } static void bgr24_bgr16_c(SHORTLINEARGS) { //printf("bgr24_bgr16_c %d\n", w); uint16_t* d = (uint16_t*)dest; while (--w >= 0) d[w] = uint16_t(((((((src[w*3+2]<<5)&0xff00)|src[w*3+1])<<6)&0xfff00)|src[w*3+0])>>3); } /* test code - but speed is nearly the same as with version above static void bgr24_bgr16_cl(SHORTLINEARGS, int h, int ds_y, int ss_y) { while (h--) { #if 0 uint16_t* d = (uint16_t*) dest; uint16_t* e = (uint16_t*) dest + w; const uint8_t* s = src; do { // looks ugly but gives very fast compiled code *d++ = ((((((s[2]<<5)&0xff00)|s[1])<<6)&0xfff00)|s[0])>>3; s += 3; } while (d < e); #else uint16_t* d = (uint16_t*)dest; for (int i = w - 1; i >= 0; i--) d[i] = ((((((src[i*3+2]<<5)&0xff00)|src[i*3+1])<<6)&0xfff00)|src[i*3+0])>>3; #endif dest += ds_y; src += ss_y; } } */ static void bgr24_bgr32_c(SHORTLINEARGS) { uint32_t* d = (uint32_t*) dest; while (w--) { #ifndef WORDS_BIGENDIAN // FIXME - BIGENDIAN should be handled everywhere!!! *d++ = src[0] | (src[1] << 8) | (src[2] << 16); // b g r #else *d++ = src[0] << 24 | (src[1] << 16) | (src[2] << 8); // b g r //dest[0] = src[0]; dest[1] = src[1]; dest[2] = src[2]; dest[3] = 0; dest += 4; #endif src += 3; } } /* * To BGR24 conversion */ static void bgr15_bgr24_c(SHORTLINEARGS) { while (w--) { uint16_t sh = *(const uint16_t*)src; dest[0] = uint8_t((sh & 0x1f) << 3); // b dest[1] = uint8_t((sh & 0x3e0) >> 2); // g dest[2] = uint8_t((sh & 0x7c00) >> 7); // r dest += 3; src += 2; } } static void bgr16_bgr24_c(SHORTLINEARGS) { while (w--) { uint16_t sh = *(const uint16_t*)src; dest[0] = uint8_t((sh & 0x1f) << 3); // b dest[1] = uint8_t((sh & 0x7e0) >> 3); // g dest[2] = uint8_t((sh & 0xf800) >> 8); // r dest += 3; src += 2; } } static void bgr32_bgr24_c(SHORTLINEARGS) { while (w--) { dest[0] = src[0]; dest[1] = src[1]; dest[2] = src[2]; src += 4; dest += 3; } } /* * YUV conversions */ static void bgr24_yuv_c(SHORTLINEARGS) { const col* s = (const col*) src; yuv* d = (yuv*) dest; while (w--) *d++ = *s++; } static void yuv_bgr24_c(SHORTLINEARGS) { const yuv* s = (const yuv*) src; col* d = (col*) dest; while (w--) *d++ = *s++; } static void bgr24_yuy2_c(SHORTLINEARGS) { const col* s = (const col*) src; uint32_t* d = (uint32_t*) dest; while (w--) { yuv yuvt(*s++); dest[0] = yuvt.Y; dest[1] = yuvt.Cb; dest[2] = s->Y(); dest[3] = yuvt.Cr; s++; dest += 4; } } static void yuy2_bgr24_c(SHORTLINEARGS) { col* d = (col*) dest; while (w--) { yuv p; p.Y = src[0]; p.Cb = src[1]; p.Cr = src[3]; d[0] = p; p.Y = src[2]; d[1] = p; src += 4; d += 2; } } static void uyvy_bgr24_c(SHORTLINEARGS) { //printf("uyvy_bgr24_c %d\n", w); col* d = (col*) dest; while (w--) { yuv p; p.Cb = src[0]; p.Y = src[1]; p.Cr = src[2]; d[0] = p; p.Y = src[3]; d[1] = p; src += 4; d += 2; } } static void yv12_yuy2_c(LONGLINEARGS) { //printf("yv12_yuy2_c\n"); while (h--) { int i = w; while (--i >= 0) { dest_y[i * 4] = src_y[i * 2]; dest_y[i * 4 + 2] = src_y[i * 2 + 1]; dest_y[i * 4 + ds_y] = src_y[i * 2 + ss_y]; dest_y[i * 4 + ds_y + 2] = src_y[i * 2 + ss_y + 1]; dest_y[i * 4 + 1] = dest_y[i * 4 + ds_y + 1] = src_cb[i]; dest_y[i * 4 + 3] = dest_y[i * 4 + ds_y + 3] = src_cr[i]; } src_y += 2 * ss_y; src_cr += ss_cr; src_cb += ss_cb; dest_y += 2 * ds_y; } } static void yv12_bgr16_cSLOW(LONGLINEARGS) { uint8_t l1[5000]; uint8_t l2[5000]; //printf("YV12 tgb16\n"); while (h--) { //printf("H %d %d %d\n", i, fromstride, tostride); col* dest = (col*) l1; col* dest2 = (col*) l2; int i; for (i = 0; i < w; i++) { yuv p; p.Cr = src_cr[i]; p.Cb = src_cb[i]; p.Y = src_y[i * 2]; dest[i * 2] = p; p.Y = src_y[i * 2 + 1]; dest[i * 2 + 1] = p; p.Y = src_y[i * 2 + ss_y]; dest2[i * 2] = p; p.Y = src_y[i * 2 + ss_y + 1]; dest2[i * 2 + 1] = p; } bgr24_bgr16_c(dest_y, l1, w * 2); bgr24_bgr16_c(dest_y + ds_y, l2, w * 2); src_y += 2 * ss_y; src_cr += ss_cr; src_cb += ss_cb; dest_y += 2 * ds_y; } } static void yv12_bgr16_c(LONGLINEARGS) { //printf("YV12 tgb16\n"); while (h--) { //printf("H %d %d %d\n", i, fromstride, tostride); uint16_t* dest = (uint16_t*) dest_y; uint16_t* dest2 = (uint16_t*) (dest_y + ds_y); int i; for (i = 0; i < w; i++) { yuv p; p.Cr = src_cr[i]; p.Cb = src_cb[i]; p.Y = src_y[i * 2]; dest[i * 2] = col(p).bgr16(); p.Y = src_y[i * 2 + 1]; dest[i * 2 + 1] = col(p).bgr16(); p.Y = src_y[i * 2 + ss_y]; dest2[i * 2] = col(p).bgr16(); p.Y = src_y[i * 2 + ss_y + 1]; dest2[i * 2 + 1] = col(p).bgr16(); } src_y += 2 * ss_y; src_cr += ss_cr; src_cb += ss_cb; dest_y += 2 * ds_y; } } static void yv12_bgr24_c(LONGLINEARGS) { while (h--) { //printf("H %d %d %d\n", i, fromstride, tostride); col* dest = (col*) dest_y; col* dest2 = (col*) (dest_y + ds_y); int i; for (i = 0; i < w; i++) { yuv p; p.Cr = src_cr[i]; p.Cb = src_cb[i]; p.Y = src_y[i * 2]; dest[i * 2] = p; p.Y = src_y[i * 2 + 1]; dest[i * 2 + 1] = p; p.Y = src_y[i * 2 + ss_y]; dest2[i * 2] = p; p.Y = src_y[i * 2 + ss_y + 1]; dest2[i * 2 + 1] = p; } src_y += 2 * ss_y; src_cr += ss_cr; src_cb += ss_cb; dest_y += 2 * ds_y; } } static void y800_bgr24_c(LONGLINEARGS) { printf("HxW %dx%d ssy:%d dsy:%d\n", h, w, ss_y, ds_y); while (h--) { col* dest = (col*) dest_y; int i; for (i = 0; i < w; i++) { yuv p; p.Cr = 0x80; p.Cb = 0x80; p.Y = src_y[i]; dest[i] = p; } src_y += ss_y; dest_y += ds_y; } } static void bgr24_yv12_c(LONGLINEARGS) { //printf("bgr24ToYv12 %d %d\n", w, h); while (h--) { const uint8_t* s = src_y; uint8_t* dest_y1 = dest_y + ds_y; for (int i = 0; i < w; i++) { yuv yuvt(*(const col*)s); dest_cb[i] = yuvt.Cb; dest_cr[i] = yuvt.Cr; dest_y[i * 2] = yuvt.Y; dest_y[i * 2 + 1] = ((const col*)(s + 3))->Y(); dest_y1[i * 2] = ((const col*)(s + ss_y))->Y(); dest_y1[i * 2 + 1] = ((const col*)(s + ss_y + 3))->Y(); s += 6; } src_y += 2 * ss_y; dest_y += 2 * ds_y; dest_cr += ds_cr; dest_cb += ds_cb; } } static void yuy2_yv12_c(LONGLINEARGS) { //printf("yuy2ToYv12\n"); while (h--) { uint8_t* d1 = dest_y; uint8_t* d2 = dest_y + ds_y; int i = w; while (--i >= 0) { d1[i * 2] = src_y[i * 4]; dest_cb[i] = src_y[i * 4 + 1]; d2[i * 2] = src_y[i * 4 + ss_y]; d1[i * 2 + 1] = src_y[i * 4 + 2]; d2[i * 2 + 1] = src_y[i * 4 + 2 + ss_y]; dest_cr[i] = src_y[i * 4 + 3]; } src_y += 2 * ss_y; dest_y += 2 * ds_y; dest_cr += ds_cr; dest_cb += ds_cb; } } static void uyvy_yv12_c(LONGLINEARGS) { //printf("uyvyToYv12\n"); while (h--) { uint8_t* d1 = dest_y; uint8_t* d2 = dest_y + ds_y; int i = w; while (--i >= 0) { dest_cb[i] = src_y[i * 4]; d1[i * 2] = src_y[i * 4 + 1]; d2[i * 2] = src_y[i * 4 + ss_y + 1]; dest_cr[i] = src_y[i * 4 + 2]; d1[i * 2 + 2] = src_y[i * 4 + 3]; d2[i * 2 + 2] = src_y[i * 4 + 3 + ss_y]; } src_y += 2 * ss_y; dest_y += 2 * ds_y; dest_cr += ds_cr; dest_cb += ds_cb; } } static void i420_yv12_c(LONGLINEARGS) { //printf("i420ToYv12\n"); stride_memcpy(dest_y, ds_y, src_y, ss_y, w, h); // src_cr & src_cb are already swapped when this // routine is being called - that's why it looks like // pure copy stride_memcpy(dest_cr, ds_cr, src_cr, ss_cr, w / 2, h / 2); stride_memcpy(dest_cb, ds_cb, src_cb, ss_cb, w / 2, h / 2); } static void i411_yv12_c(LONGLINEARGS) { // mainly ffmpeg mjpeg //printf("i411ToYv12\n"); stride_memcpy(dest_y, ds_y, src_y, ss_y, w, h); h /= 2; w /= 4; while (h--) { int i = w; while (--i >= 0) { dest_cb[i * 2] = src_cr[i]; dest_cr[i * 2] = src_cb[i]; // for next pixels use pixels from the next line dest_cb[i * 2 + 1] = src_cr[i + ss_cr]; dest_cr[i * 2 + 1] = src_cb[i + ss_cb]; } src_cr += 2 * ss_cr; src_cb += 2 * ss_cb; dest_cr += ds_cr; dest_cb += ds_cb; } } static void i422_yv12_c(LONGLINEARGS) { // mainly ffmpeg mjpeg //printf("i422ToYv12 %d %p %d %d %d %d %d\n", ds_y, src_y, ss_y, w, h, ss_cb, ss_cr); stride_memcpy(dest_y, ds_y, src_y, ss_y, w, h); stride_memcpy(dest_cr, ds_cr, src_cb, 2 * ss_cb, w / 2, h / 2); stride_memcpy(dest_cb, ds_cb, src_cr, 2 * ss_cr, w / 2, h / 2); } static void i444_yv12_c(LONGLINEARGS) { // another mjpeg output from ffmpeg //printf("i444ToYv12\n"); stride_memcpy(dest_y, ds_y, src_y, ss_y, w, h); h /= 2; w /= 2; while (h--) { int i = w; while (--i >= 0) { dest_cb[i] = src_cr[i * 2]; dest_cr[i] = src_cb[i * 2]; } src_cr += 2 * ss_cr; src_cb += 2 * ss_cb; dest_cr += ds_cr; dest_cb += ds_cb; } } static void i410_yv12_c(LONGLINEARGS) { // mainly ffmpeg indeo //printf("i410ToYv12\n"); stride_memcpy(dest_y, ds_y, src_y, ss_y, w, h); h /= 4; w /= 4; while (h--) { int i = w; while (--i >= 0) { dest_cr[i * 2] = dest_cr[i * 2 + 1] = src_cb[i]; dest_cb[i * 2] = dest_cb[i * 2 + 1] = src_cr[i]; // for next pixels use pixels from the next line dest_cr[i * 2 + ds_cr] = dest_cr[i * 2 + 1 + ds_cr] = src_cb[i]; dest_cb[i * 2 + ds_cb] = dest_cb[i * 2 + 1 + ds_cb] = src_cr[i]; //dest_cb[i * 2 + 1] = src_cr[i + ss_cr]; //dest_cr[i * 2 + 1] = src_cb[i + ss_cb]; } src_cr += ss_cr; src_cb += ss_cb; dest_cr += 2 * ds_cr; dest_cb += 2 * ds_cb; } } static void y800_yv12_c(LONGLINEARGS) { printf("y800ToYv12 not yet implemented\n"); return; stride_memcpy(dest_y, ds_y, src_y, ss_y, w, h); h /= 4; w /= 4; while (h--) { memset(dest_cr, 0x80, w); dest_cr += ds_cr; memset(dest_cb, 0x80, w); dest_cb += ds_cb; } } enum { // short BGR32TOBGR32, BGR24TOBGR24, BGR16TOBGR16, BGR15TOBGR16, BGR24TOBGR15, BGR15TOBGR24, BGR24TOBGR16, BGR16TOBGR24, BGR24TOBGR32, BGR32TOBGR24, BGR24TOYUV, YUVTOBGR24, BGR24TOYUV2, YUV2TOBGR24, UYVYTOBGR24, Y800TOBGR24, MAXSHORT, // long BGR24TOYV12, YV12TOBGR24, //BGR24TOYV12, YV12TOBGR16, YV12TOYUY2, YUY2TOYV12, UYVYTOYV12, I420TOYV12, I411TOYV12, I422TOYV12, I444TOYV12, I410TOYV12, Y800TOYV12, MAXLONG }; #define V(a) (void*)a // mapping table - order hs to match above enum static const struct lconvmap_s { int div_w; const void* s_c; const void* s_mmx; const void* s_mmx2; } lconvmap[] = { // short options (only width is divided) { 1, V(bgr32_bgr32_c), V(bgr32_bgr32_c), V(bgr32_bgr32_c) }, { 1, V(bgr24_bgr24_c), V(bgr24_bgr24_c), V(bgr24_bgr24_c) }, { 1, V(bgr16_bgr16_c), V(bgr16_bgr16_c), V(bgr16_bgr16_c) }, { 1, V(bgr15_bgr16_c), V(bgr15_bgr16_c), V(bgr15_bgr16_c) }, { 1, V(bgr24_bgr15_c), V(bgr24_bgr15_c), V(bgr24_bgr15_c) }, { 1, V(bgr15_bgr24_c), V(bgr15_bgr24_c), V(bgr15_bgr24_c) }, { 1, V(bgr24_bgr16_c), V(bgr24_bgr16_c), V(bgr24_bgr16_c) }, { 1, V(bgr16_bgr24_c), V(bgr16_bgr24_c), V(bgr16_bgr24_c) }, { 1, V(bgr24_bgr32_c), V(bgr24_bgr32_c), V(bgr24_bgr32_c) }, { 1, V(bgr32_bgr24_c), V(bgr32_bgr24_c), V(bgr32_bgr24_c) }, { 1, V(bgr24_yuv_c), V(bgr24_yuv_c), V(bgr24_yuv_c) }, { 1, V(yuv_bgr24_c), V(yuv_bgr24_c), V(yuv_bgr24_c) }, { 2, V(bgr24_yuy2_c), V(bgr24_yuy2_c), V(bgr24_yuy2_c) }, { 2, V(yuy2_bgr24_c), V(yuy2_bgr24_c), V(yuy2_bgr24_c) }, { 2, V(uyvy_bgr24_c), V(uyvy_bgr24_c), V(uyvy_bgr24_c) }, { 1, V(y800_bgr24_c), V(y800_bgr24_c), V(y800_bgr24_c) }, { 0 }, // long options { 2, V(bgr24_yv12_c), V(bgr24_yv12_c), V(bgr24_yv12_c) }, { 2, V(yv12_bgr24_c), V(yv12_bgr24_c), V(yv12_bgr24_c) }, { 2, V(yv12_bgr16_c), V(yv12_bgr16_c), V(yv12_bgr16_c) }, { 2, V(yv12_yuy2_c), V(yv12_yuy2_c), V(yv12_yuy2_c) }, { 2, V(yuy2_yv12_c), V(yuy2_yv12_c), V(yuy2_yv12_c) }, { 2, V(uyvy_yv12_c), V(uyvy_yv12_c), V(uyvy_yv12_c) }, { 1, V(i420_yv12_c), V(i420_yv12_c), V(i422_yv12_c) }, { 1, V(i411_yv12_c), V(i411_yv12_c), V(i411_yv12_c) }, { 1, V(i422_yv12_c), V(i422_yv12_c), V(i422_yv12_c) }, { 1, V(i444_yv12_c), V(i444_yv12_c), V(i444_yv12_c) }, { 1, V(i410_yv12_c), V(i410_yv12_c), V(i410_yv12_c) }, { 1, V(y800_yv12_c), V(y800_yv12_c), V(y800_yv12_c) }, }; #undef V /* * generic conversion for 1plane routines */ static void lineconvert(STDCONV_PARAMS, unsigned type) { typedef void (*LCONV)(SHORTLINEARGS); LCONV lconv; //flip_dir = true; const uint8_t* src = from->GetWindow(0); uint8_t* dest = to->GetWindow(0); SETWHS(); if (flip_dir) src += (from->m_Window.h - 1) * from->Stride(); //printf("W %d %d %d w: %d flip: %d\n", from->Width(), from->Stride(), from->m_Window.h, w, flip_dir); w /= lconvmap[type].div_w; assert(type < MAXSHORT); lconv = (LCONV) lconvmap[type].s_c; #if 1 if (w == to->Width() && 1 && w == from->Width() && to->Bpl() == ds_y && from->Bpl() == ss_y) { // one stright call is enough in this case lconv(dest, src, w * h); } else while (h--) { //printf("DEST %p %p %d ds: %d ss: %d %d\n", dest, src, to->Stride(), ds_y, ss_y, h); lconv(dest, src, w); dest += ds_y; src += ss_y; } #else bgr24_bgr16_cl(dest, src, w, h, ds_y, ss_y); #endif emms(); } static void yuvconv(STDCONV_PARAMS, unsigned type) { typedef void (*LCONV)(LONGLINEARGS); LCONV lconv; //flip_dir = true; const uint8_t* src_y = from->GetWindow(0); const uint8_t* src_cr = from->GetWindow(1); const uint8_t* src_cb = from->GetWindow(2); SETWHS(); w = (w + 1) & ~1; int ss_cr; int ss_cb; //printf("YUVCON %d %d %d %d %d\n", w, h, from->m_Window.x, from->m_Window.y, to->m_Window.x); if (flip_dir) { src_y += (from->m_Window.h - 1) * from->m_iStride[0]; src_cr += (from->m_Window.h / lconvmap[type].div_w - 1) * from->m_iStride[1]; src_cb += (from->m_Window.h / lconvmap[type].div_w - 1) * from->m_iStride[2]; ss_cr = -from->m_iStride[1]; ss_cb = -from->m_iStride[2]; } else { ss_cr = from->m_iStride[1]; ss_cb = from->m_iStride[2]; } if (from->Format() == IMG_FMT_I420) { // swap U V const uint8_t* t = src_cb; int s = ss_cb; src_cb = src_cr; src_cr = t; ss_cb = ss_cr; ss_cr = s; } int swds = (to->Format() == IMG_FMT_I420) ? 1 : 0; lconv = (LCONV) lconvmap[type].s_c; w /= lconvmap[type].div_w; h /= lconvmap[type].div_w; lconv(to->GetWindow(0), to->GetWindow(1 + swds), to->GetWindow(2 - swds), to->m_iStride[0], to->m_iStride[1 + swds], to->m_iStride[2 - swds], src_y, src_cr, src_cb, ss_y, ss_cr, ss_cb, w, h); emms(); } static void anyFromBGR24(STDCONV_PARAMS) { switch (to->Format()) { case 15: lineconvert(to, from, flip_dir, BGR24TOBGR15); return; case 16: lineconvert(to, from, flip_dir, BGR24TOBGR16); return; case 24: lineconvert(to, from, flip_dir, BGR24TOBGR24); return; case 32: lineconvert(to, from, flip_dir, BGR24TOBGR32); return; case IMG_FMT_YUV: lineconvert(to, from, flip_dir, BGR24TOYUV); return; case IMG_FMT_YUY2: lineconvert(to, from, flip_dir, BGR24TOYUV2); return; case IMG_FMT_YV12: yuvconv(to, from, flip_dir, BGR24TOYV12); return; } int f = to->Format(); AVM_WRITE("CImage", "Cannot convert from 24 bit image to unimplemented %.4s 0x%x\n", (const char*)&f, f); } static void anyToBGR24(STDCONV_PARAMS) { switch(from->Format()) { case 15: lineconvert(to, from, flip_dir, BGR15TOBGR24); return; case 16: lineconvert(to, from, flip_dir, BGR16TOBGR24); return; case 24: lineconvert(to, from, flip_dir, BGR24TOBGR24); return; case 32: lineconvert(to, from, flip_dir, BGR32TOBGR24); return; case IMG_FMT_YUV: lineconvert(to, from, flip_dir, YUVTOBGR24); return; case IMG_FMT_YUY2: lineconvert(to, from, flip_dir, YUV2TOBGR24); return; case IMG_FMT_Y422: case IMG_FMT_UYVY: lineconvert(to, from, flip_dir, UYVYTOBGR24); return; case IMG_FMT_YV12: case IMG_FMT_I420: // handles both yv12 & i420 yuvconv(to, from, flip_dir, YV12TOBGR24); return;; case IMG_FMT_Y800: // handles both yv12 & i420 yuvconv(to, from, flip_dir, Y800TOBGR24); return;; } int f = from->Format(); AVM_WRITE("CImage", "Cannot convert to 24 bit image from unimplemented %.4s 0x%x\n", (const char*)&f, f); } lookuptable col::t = lookuptable(); lookuptable::lookuptable() { for(int i = 255; i >= 0; i--) { m_plY[i] = 298 * (i - 16); m_plRV[i] = 408 * (i - 128); m_plGV[i] = -208 * (i - 128); m_plGU[i] = -100 * (i - 128); m_plBU[i] = 517 * (i - 128); } } /** * Creates new image in format 'header' from specified memory area. * Either allocates its own memory area & copies src data into it, or reuses * parent data. */ CImage::CImage(const BitmapInfo* header, const uint8_t* data, bool copy) :m_pInfo(header) { fillMembers(); if (!copy) { m_pPlane[0] = const_cast(data); } else { int s = m_iBytes[0] + m_iBytes[1] + m_iBytes[2] + m_iBytes[3]; m_pPlane[0] = new uint8_t[s]; m_bDataOwner[0] = true; if (data) memcpy(m_pPlane[0], data, s); } setPlanes(); //printf("COMPRESSTRIDE %.4s\n", (char*)&m_iFormat); } CImage::CImage(const BitmapInfo* header, const uint8_t* plane[], const int stride[], bool copy) :m_pInfo(header) { //printf("CONST2\n"); fillMembers(); if (!copy) { memcpy(m_pPlane, plane, sizeof(uint8_t*) * 3); memcpy(m_iStride, stride, sizeof(int) * 3); //printf("CIMAGE %p %p %p\n", m_pPlane[0], m_pPlane[1], m_pPlane[2]); //printf("CIMAGE %d %d %d\n", m_iStride[0], m_iStride[1], m_iStride[2]); } else { m_pPlane[0] = new uint8_t[m_iBytes[0] + m_iBytes[1] + m_iBytes[2]]; m_bDataOwner[0] = true; for (int i = 0; i < 3; i++) { if (m_iBytes[i] && plane[i]) stride_memcpy(m_pPlane[i], m_iStride[i], plane[i], stride[i], m_iWidth, m_iHeight); } emms(); } setPlanes(); } /* Creates 24-bit RGB image from 24-bit RGB 'data' */ CImage::CImage(const uint8_t* data, int width, int height) :m_pInfo(BitmapInfo(width, height, 24)) { fillMembers(); m_pPlane[0] = new uint8_t[m_iBytes[0]]; m_bDataOwner[0] = true; if (data) memcpy(m_pPlane[0], data, m_iBytes[0]); } // non-conversion constructors CImage::CImage(const CImage* im) :m_pInfo(im->GetFmt()) { fillMembers(); m_fQuality = im->GetQuality(); int s = m_iBytes[0] + m_iBytes[1] + m_iBytes[2] + m_iBytes[3]; m_pPlane[0] = new uint8_t[s]; m_iStride[0] = im->m_iStride[0]; m_iBytes[0] = im->m_iBytes[0]; m_bDataOwner[0] = true; memcpy(m_pPlane[0], im->m_pPlane[0], m_iBytes[0]); for (unsigned i = 1; i < CIMAGE_MAX_PLANES; i++) { m_iStride[i] = im->m_iStride[i]; m_iBytes[i] = im->m_iBytes[i]; m_pPlane[i] = m_pPlane[i - 1] + m_iBytes[i - 1]; memcpy(m_pPlane[i], im->m_pPlane[i], m_iBytes[i]); //printf("COPY STRIDE %i %p %d %d\n", i, m_pPlane[i], m_iStride[i], m_iBytes[i]); //printf("ALLOCPLANE %p(%d): %p\n", this, i, m_pPlane[i]); } } // Conversion constructors CImage::CImage(const CImage* im, uint_t csp_bits) :m_pInfo(im->GetFmt()) { if (csp_bits <= 32) m_pInfo.SetBits(csp_bits); else m_pInfo.SetSpace(csp_bits); fillMembers(); m_fQuality = im->GetQuality(); int s = m_iBytes[0] + m_iBytes[1] + m_iBytes[2] + m_iBytes[3]; m_pPlane[0] = new uint8_t[s]; m_bDataOwner[0] = true; setPlanes(); Convert(im); } CImage::CImage(const CImage* im, const BitmapInfo* header) :m_pInfo(header) { fillMembers(); m_fQuality = im->GetQuality(); int s = m_iBytes[0] + m_iBytes[1] + m_iBytes[2] + m_iBytes[3]; m_pPlane[0] = new uint8_t[s]; m_bDataOwner[0] = true; setPlanes(); Convert(im); } CImage::~CImage() { //printf("CIMDELETE %p cnt: %d own:%d (%p %p %p\n", this, m_iRefcount, m_bDataOwner, m_pPlane[0],m_pPlane[1],m_pPlane[2]); if (m_iRefcount > 1) { AVM_WRITE("CImage", "Unexpected delete of referenced image ! (%d) (USE RELEASE)\n", m_iRefcount); } for (uint_t i = 0; i < CIMAGE_MAX_PLANES; i++) if (m_bDataOwner[i]) delete[] m_pPlane[i]; } void CImage::fillMembers() { m_iRefcount = 1; m_pUserData = 0; m_pAllocator = 0; m_fQuality = 0.0f; m_iType = 0; m_fAspectRatio = 1.0; for (unsigned i = 0; i < CIMAGE_MAX_PLANES; i++) { m_pPlane[i] = 0; m_iStride[i] = 0; m_iBytes[i] = 0; m_bDataOwner[i] = false; } // setup most common values // for some colorspaces these HAVE TO BE FIXED m_iDepth = m_pInfo.biBitCount; m_iFormat = m_pInfo.biCompression; if (m_pInfo.IsRGB()) m_iFormat = m_pInfo.Bpp(); m_iBpp = (m_iDepth + 7) / 8; m_iBpl = m_iBpp * m_pInfo.biWidth; m_Window.x = m_Window.y = 0; m_iWidth = m_Window.w = m_pInfo.biWidth; m_iHeight = m_Window.h = (int) labs(m_pInfo.biHeight); m_iPixels = m_iWidth * m_iHeight; m_iBytes[0] = m_iBpl * m_iHeight; m_iStride[0] = m_iBpl; switch (m_iFormat) { case IMG_FMT_YV12: case IMG_FMT_I420: m_iBpp = 1; m_iStride[0] = m_iBpl = m_iWidth; m_iStride[1] = m_iStride[2] = m_iWidth / 2; m_iBytes[0] = m_iStride[0] * m_iHeight; m_iBytes[1] = m_iStride[1] * m_iHeight / 2; m_iBytes[2] = m_iStride[2] * m_iHeight / 2; break; case IMG_FMT_I422: m_iBpp = 1; m_iStride[0] = m_iBpl = m_iWidth; m_iStride[1] = m_iStride[2] = m_iWidth / 2; m_iBytes[0] = m_iStride[0] * m_iHeight; m_iBytes[1] = m_iStride[1] * m_iHeight; m_iBytes[2] = m_iStride[2] * m_iHeight; break; case IMG_FMT_I444: m_iBpp = 1; m_iStride[0] = m_iStride[1] = m_iStride[2] = m_iBpl = m_iWidth; m_iBytes[0] = m_iStride[0] * m_iHeight; m_iBytes[1] = m_iStride[1] * m_iHeight; m_iBytes[2] = m_iStride[2] * m_iHeight; break; case IMG_FMT_YUY2: case IMG_FMT_UYVY: m_iBpp = 2; m_iBpl = m_iBpp * m_pInfo.biWidth; break; } } void CImage::setPlanes() { switch (m_iFormat) { case IMG_FMT_YV12: case IMG_FMT_I420: case IMG_FMT_I422: case IMG_FMT_I444: if (!m_pPlane[1]) m_pPlane[1] = m_pPlane[0] + m_iBytes[0]; if (!m_pPlane[2]) m_pPlane[2] = m_pPlane[0] + m_iBytes[0] + m_iBytes[1]; break; } } void CImage::Release() const { //printf("CIMRELEASE %p cnt: %d own:%d p0:%p\n", this, m_iRefcount, m_bDataOwner, m_pPlane[0]); m_iRefcount--; if (!m_iRefcount) delete this; } void CImage::ToYUV() { if (m_pInfo.biCompression != 0) return; yuv* src; src = (yuv*)Data() + m_iPixels - 1; if (m_iDepth != 24) { AVM_WRITE("CImage", "Cannot convert non-24 bit image to YUV\n"); return; } while ((uint8_t*)src > Data() + 3) { *src = *(col*) src; src--; *src = *(col*) src; src--; *src = *(col*) src; src--; *src = *(col*) src; src--; } m_iFormat = m_pInfo.biCompression = IMG_FMT_YUV; } void CImage::ToRGB() { if (m_pInfo.biCompression != IMG_FMT_YUV || m_iDepth != 24) { AVM_WRITE("CImage", "Cannot convert non-YUV image to BGR24\n"); return; } col* src= (col*)Data() + m_iPixels - 1; while ((uint8_t*)src > Data() + 3) { *src= *(struct yuv*) src; src--; *src= *(struct yuv*) src; src--; *src= *(struct yuv*) src; src--; *src= *(struct yuv*) src; src--; } //m_pInfo.SetBits(24); m_iFormat = m_pInfo.biCompression = 0; } void CImage::Blur(int range, int from) { if(range<=0)return; if(from<0)return; if(range<=from)return; #if ARCH_X86_32 int limit = m_iPixels * 3; unsigned lim=1<<(range+1); unsigned ach=3*(1<<(from+1)); uint8_t* p = Data(); while (ach < 3 * lim) { //printf("Blur %d\n", ach); asm volatile ( //p %0 //ach %1 //limit %2 "pushl %%eax \n\t" "pushl %%ebx \n\t" "pushl %%ecx \n\t" "pushl %%edx \n\t" "pushl %%edi \n\t" "movl %0, %%ebx \n\t" "movl %1, %%ecx \n\t" "movl %0, %%edx \n\t" "addl %2, %%edx \n\t" "subl %1, %%edx \n\t" "movl %%edx, %%edi \n\t" "pxor %%mm2, %%mm2 \n\t" "xorl %%eax, %%eax \n\t" "xorl %%edx, %%edx \n\t" // align 8 "1: \n\t" "movd (%%ebx), %%mm0\n\t" // "movd %%ebx(%%ecx), %%mm1 \n\t" "movd (%%ecx,%%ebx), %%mm1 \n\t" "punpcklbw %%mm2, %%mm1\n\t" "punpcklbw %%mm2, %%mm0\n\t" "paddusw %%mm1, %%mm0 \n\t" "psrlw $1, %%mm0\n\t" "packuswb %%mm2, %%mm0\n\t" "movd %%mm0, (%%ebx)\n\t" "addl $4, %%ebx \n\t" "cmpl %%edi, %%ebx \n\t" "jb 1b \n\t" "popl %%edi \n\t" "popl %%edx \n\t" "popl %%ecx \n\t" "popl %%ebx \n\t" "popl %%eax \n\t" : :"r"(p), "r"(ach), "r"(limit) ); ach*=m_iWidth; asm volatile ( //p %0 //ach %1 //limit %2 "pushl %%eax \n\t" "pushl %%ebx \n\t" "pushl %%ecx \n\t" "pushl %%edx \n\t" "pushl %%edi \n\t" "movl %0, %%ebx \n\t" "movl %0, %%ebx \n\t" "movl %1, %%ecx \n\t" "movl %0, %%edx \n\t" "addl %2, %%edx \n\t" "subl %1, %%edx \n\t" "movl %%edx, %%edi \n\t" "pxor %%mm2, %%mm2 \n\t" "xorl %%eax, %%eax \n\t" "xorl %%edx, %%edx \n\t" // align 8 "1: \n\t" "movd (%%ebx), %%mm0\n\t" "movd (%%ebx,%%ecx), %%mm1 \n\t" "punpcklbw %%mm2, %%mm1\n\t" "punpcklbw %%mm2, %%mm0\n\t" "paddusw %%mm1, %%mm0\n\t" "psrlw $1, %%mm0\n\t" "packuswb %%mm2, %%mm0\n\t" "movd %%mm0, (%%ebx)\n\t" "addl $4, %%ebx \n\t" "cmpl %%edi, %%ebx \n\t" "jb 1b \n\t" "popl %%edi \n\t" "popl %%edx \n\t" "popl %%ecx \n\t" "popl %%ebx \n\t" "popl %%eax \n\t" : :"r"(p), "r"(ach), "r"(limit) ); ach/=m_iWidth; ach*=2; } emms(); #else #warning BLUR not implemented in C code #endif } bool CImage::Supported(int csp, int bitcount) { //AVM_WRITE("CImage", "SUPPORTED 0x%x (%.4s) %d\n", csp, (char*)&csp, bitcount); if (csp == 0) { switch(bitcount) { case 15: case 16: case 24: case 32: return true; } } else if (csp == 3) { switch(bitcount) { case 15: case 16: return true; } } else { switch (StandardFOURCC(csp)) { case IMG_FMT_YUV: case IMG_FMT_YUY2: case IMG_FMT_UYVY: case IMG_FMT_YV12: case IMG_FMT_I420: case IMG_FMT_Y422: case IMG_FMT_I422: case IMG_FMT_I444: //case IMG_FMT_YVYU: //case IMG_FMT_IYUV: return true; } } return false; // unsupported } bool CImage::Supported(const BITMAPINFOHEADER& head) { return Supported(head.biCompression, head.biBitCount); } fourcc_t CImage::StandardFOURCC(fourcc_t csp) { switch (csp) { case IMG_FMT_V422: case IMG_FMT_YUNV: return IMG_FMT_YUY2; case IMG_FMT_IYUV: return IMG_FMT_I420; case IMG_FMT_IYU2: case IMG_FMT_Y422: return IMG_FMT_UYVY; case IMG_FMT_Y8: return IMG_FMT_Y800; } return csp; } void CImage::ByteSwap() { if (m_pInfo.biCompression != 0 || m_pInfo.biBitCount != 24) return; uint8_t* t = Data(); uint8_t* e = Data() + m_iPixels * 3 - 11; while (t < e) { uint8_t tmp = t[0]; t[0] = t[2]; t[2] = tmp; uint8_t tmp1 = t[3]; t[3] = t[5]; t[5] = tmp1; uint8_t tmp2 = t[6]; t[6] = t[8]; t[8] = tmp2; uint8_t tmp3 = t[9]; t[9] = t[11]; t[11] = tmp3; t += 12; } } void CImage::Dump(const char* filename) { int fd; #ifndef WIN32 fd=open(filename, O_WRONLY|O_CREAT|O_TRUNC, 00666); #else fd=open(filename, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 00666); #endif if(fd<0) { AVM_WRITE("CImage", "Warning: could not open %s for writing", filename); return; } // int w=im->width(); // int h=im->height(); BitmapInfo bi(m_iWidth, m_iHeight, 24); CImage* im=0; if (!IsFmt(&bi)) im = new CImage(this, &bi); const uint8_t* ptr = (im) ? im->Data() : Data(); int bs = m_iPixels * 3; uint16_t bfh[7]; bfh[0] = 'B' + 256 * 'M'; int* ibfh = (int*) (bfh + 1); ibfh[0]=bs+0x36; ibfh[1]=0; ibfh[2]=0x36; write(fd, bfh, 14); write(fd, &bi, 40); write(fd, ptr, bs); close(fd); if (im) im->Release(); } void CImage::Clear() { //AVM_WRITE("CImage", "CLEAR IMAGE 0x%x %d,%d,%d\n", Format(), m_iBytes[0], m_iBytes[1], m_iBytes[2]); switch (StandardFOURCC(Format())) { case IMG_FMT_YV12: case IMG_FMT_I420: case IMG_FMT_I422: case IMG_FMT_I444: #if 1 memset(m_pPlane[0], 0x10, m_iBytes[0]); memset(m_pPlane[1], 0x80, m_iBytes[1]); memset(m_pPlane[2], 0x80, m_iBytes[2]); #else { const uint8_t b[3] = { 0x10, 0x80, 0x80 }; for (int j = 0; j < 3; ++j) { uint8_t c = b[j]; fprintf(stderr, "CLEAN b:%d p:%p c:%x\n", m_iBytes[j], m_pPlane[j], c); for (unsigned i = 0; i < m_iBytes[j]; i++) m_pPlane[j][i] = c; } } #endif break; case IMG_FMT_YUY2: for (unsigned i = 0; i < m_iBytes[0] / 4; i++) avm_set_le32(((uint32_t*)m_pPlane[0]) + i, 0x80108010U); break; default: // RGB formats memset(m_pPlane[0], 0, m_iBytes[0]); break; } } void CImage::Convert(const uint8_t* from_data, const BitmapInfo* from_fmt) { CImage ci(from_fmt, from_data); Convert(&ci); } void CImage::Convert(const CImage* from_img) { #if 0 AVM_WRITE("CImage", "Convert from\n"); from_img->GetFmt()->Print(); const CImage* f = from_img; printf("From strides: %d, %d, %d planes: %p, %p, %p\n", f->m_iStride[0], f->m_iStride[1], f->m_iStride[2], f->m_pPlane[0], f->m_pPlane[1], f->m_pPlane[2]); AVM_WRITE("CImage", "To 0x%x -> 0x%x\n", Format(), from_img->Format()); m_pInfo.Print(); #endif //assert(m_iHeight == from_img->m_iHeight // && m_iWidth == from_img->m_iWidth); // FIXME bool flip_dir = ((GetFmt()->biHeight * from_img->GetFmt()->biHeight) < 0); //printf("FLIP %d\n", flip_dir); if (Format() == from_img->Format()) { switch (Format()) { case IMG_FMT_YV12: case IMG_FMT_I420: yuvconv(this, from_img, flip_dir, I420TOYV12); return; case IMG_FMT_Y422: case IMG_FMT_UYVY: case IMG_FMT_YUY2: case 15: case 16: lineconvert(this, from_img, flip_dir, BGR16TOBGR16); return; case 24: lineconvert(this, from_img, flip_dir, BGR24TOBGR24); return; case 32: lineconvert(this, from_img, flip_dir, BGR32TOBGR32); return; default: printf("Format %.4s 0x%x\n", (const char*) &m_iFormat, m_iFormat); //abort(); } } if (from_img->Format() == 24) { anyFromBGR24(this, from_img, flip_dir); return; } switch (Format()) { case 24: anyToBGR24(this, from_img, flip_dir); return; //shortcuts here case 16: switch (from_img->Format()) { case 15: lineconvert(this, from_img, flip_dir, BGR15TOBGR16); return; case IMG_FMT_YV12: case IMG_FMT_I420: yuvconv(this, from_img, flip_dir, YV12TOBGR16); return; } break; case IMG_FMT_YUY2: switch (from_img->Format()) { case IMG_FMT_YV12: case IMG_FMT_I420: yuvconv(this, from_img, flip_dir, YV12TOYUY2); return; } break; case IMG_FMT_YV12: switch (from_img->Format()) { case IMG_FMT_YUY2: yuvconv(this, from_img, flip_dir, YUY2TOYV12); return; case IMG_FMT_Y422: case IMG_FMT_UYVY: yuvconv(this, from_img, flip_dir, UYVYTOYV12); return; case IMG_FMT_I420: case IMG_FMT_YV12: // copy yuvconv(this, from_img, flip_dir, I420TOYV12); return; case IMG_FMT_I411: yuvconv(this, from_img, flip_dir, I411TOYV12); return; case IMG_FMT_I422: yuvconv(this, from_img, flip_dir, I422TOYV12); return; case IMG_FMT_I444: yuvconv(this, from_img, flip_dir, I444TOYV12); return; case IMG_FMT_I410: yuvconv(this, from_img, flip_dir, I410TOYV12); return; case IMG_FMT_Y800: yuvconv(this, from_img, flip_dir, Y800TOYV12); return; } break; } CImage tmp(0, m_iWidth, m_iHeight); anyToBGR24(&tmp, from_img, flip_dir); anyFromBGR24(this, &tmp, false); } void CImage::Slice(const ci_surface_t* ci, int alpha) { //printf("aaa %p %d %d %d %d x %d h:%d\n", planes, strides[0], strides[1], strides[2], w, h, y); //printf("bbb %p %d %d %d %d x %d\n", m_pPlane, m_iStride[0], m_iStride[1], m_iStride[2], m_iWidth, m_iHeight); //printf("W %d H %d %d, %d %d\n", m_Window.w, m_Window.h, m_Window.x, m_Window.y, ci->m_Window.y); if (m_iFormat == ci->m_iFormat) { int w = ci->m_iWidth; if (m_Window.w < w) w = m_Window.w; int h = ci->m_iHeight; if (m_Window.h < h) h = m_Window.h; int d = 1; int dx = m_Window.x; int dy = m_Window.y; int cx = ci->m_Window.x; int cy = ci->m_Window.y; if (cx < dx) { w -= (dx - dx); cx = dx; } else dx = cx; if (cy < dy) { h -= (dy - cy); cy = dy; } else dy = cy; //printf("WWW %d HHH %d %d %d %d %d \n", w, h, dx, cx, dy, cy); if (w > 0 && h > 0) { switch (m_iFormat) { case IMG_FMT_YV12: case IMG_FMT_I420: for (int i = 0; i < 3; i++) { stride_memcpy(m_pPlane[i] + m_iStride[i] * dy / d + dx / d, m_iStride[i], ci->m_pPlane[i] + ci->m_iStride[i] * (cy - ci->m_Window.y) / d + (cx - ci->m_Window.x) / d, ci->m_iStride[i], w / d, h / d); d = 2; } emms(); break; } } } } void CImage::Interlaced(CImage* from) { int dv = 1; switch (m_iFormat) { case IMG_FMT_YV12: case IMG_FMT_I420: for (int i = 0; i < 3; ++i) { for (int j = 0; j < m_iHeight / dv; j += 2) { memcpy(GetWindow(i) + j * m_iStride[i], from->GetWindow(i) + (j + 1) * m_iStride[i], m_iWidth / dv); #if 1 memcpy(GetWindow(i) + (j + 1) * m_iStride[i], from->GetWindow(i) + (j + 1) * m_iStride[i], m_iWidth / dv); #else memset(GetWindow(i) + (j + 1) * m_iStride[i], 0, m_iWidth / dv); #endif memcpy(from->GetWindow(i) + (j + 1) * m_iStride[i], from->GetWindow(i) + j * m_iStride[i], m_iWidth / dv); } dv = 2; } //return m_pPlane[idx] + m_iStride[idx] * m_Window.y / dv + m_iBpp * m_Window.x / dv; emms(); break; } } void ci_surface_t::SetWindow(int x, int y, int w, int h) { //printf("SET WINDOWS %d %d %d %d\n", x, y, w, h); m_Window.x = x; m_Window.y = y, m_Window.w = w; m_Window.h = h; if (w <= 0 || h <= 0 || x < 0 || y < 0 || x > m_iWidth || y > m_iWidth) { x = y = 0; m_Window.w = m_iWidth; m_Window.h = m_iHeight; } else { if ((x + w) > m_iWidth) m_Window.w = m_iWidth - x; if ((y + h) > m_iHeight) m_Window.h = m_iHeight - y; } //printf("SET WINDOWS DONE %d %d %d %d\n", m_Window.x, m_Window.y, m_Window.w, m_Window.h); } uint8_t* ci_surface_t::GetWindow(uint_t idx) { int dv = 1; //printf("GETWIN1 %d %d\n", m_Window.x, m_iBpp); if (idx > 0) { switch (m_iFormat) { case IMG_FMT_YV12: case IMG_FMT_I420: dv = 2; } } return m_pPlane[idx] + m_iStride[idx] * m_Window.y / dv + m_iBpp * m_Window.x / dv; } const uint8_t* ci_surface_t::GetWindow(uint_t idx) const { int dv = 1; //printf("GETWIN2 %d %d\n", m_Window.x, m_iBpp); if (idx > 0) { switch (m_iFormat) { case IMG_FMT_YV12: case IMG_FMT_I420: dv = 2; } } return m_pPlane[idx] + m_iStride[idx] * m_Window.y / dv + m_iBpp * m_Window.x / dv; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/common/impl_audio.cpp0000644000175000017500000000656711171737043020647 0ustar yavoryavor#include "audiodecoder.h" #include "audioencoder.h" #include "utils.h" #include "avm_output.h" #include //#include AVM_BEGIN_NAMESPACE; IAudioDecoder::IAudioDecoder(const CodecInfo& info, const WAVEFORMATEX* inw) :m_Info(info), m_pFormat(0) { size_t sz = sizeof(WAVEFORMATEX) + inw->cbSize; m_pFormat = (WAVEFORMATEX*) new char[sz]; memcpy(m_pFormat, inw, sz); m_uiBytesPerSec = m_pFormat->wBitsPerSample; switch (m_uiBytesPerSec) { case 0: case 2: // IMC case 4: // IMA_ADPCM m_uiBytesPerSec = 16; break; } switch (m_pFormat->wFormatTag) { case 6: // A-Law 8 -> 16b case 7: // u-Law 8 -> 16b m_uiBytesPerSec = 16; break; } m_uiBytesPerSec = ((m_uiBytesPerSec + 7) / 8) * m_pFormat->nSamplesPerSec * m_pFormat->nChannels; } IAudioDecoder::~IAudioDecoder() { delete[] m_pFormat; } void IAudioDecoder::Flush() { } const CodecInfo& IAudioDecoder::GetCodecInfo() const { return m_Info; } size_t IAudioDecoder::GetMinSize() const { return (m_pFormat->nBlockAlign > 2) ? m_pFormat->nBlockAlign : 2; } int IAudioDecoder::GetOutputFormat(WAVEFORMATEX* destfmt) const { if (!destfmt) return -1; // couple tricks here switch (m_pFormat->wBitsPerSample) { case 0: case 2: // IMC case 4: // IMA_ADPCM destfmt->wBitsPerSample = 16; break; default: destfmt->wBitsPerSample = m_pFormat->wBitsPerSample; } destfmt->nSamplesPerSec = m_pFormat->nSamplesPerSec; destfmt->nChannels = m_pFormat->nChannels; if (destfmt->nChannels > 2) destfmt->nChannels = 2; // AC3 5 channel switch (m_pFormat->wFormatTag) { case 6: // A-Law 8 -> 16b case 7: // u-Law 8 -> 16b destfmt->wBitsPerSample = 16; break; case 0x2000: if (destfmt->nSamplesPerSec > 48000) destfmt->nSamplesPerSec = 48000; if (m_pFormat->nAvgBytesPerSec < m_pFormat->nSamplesPerSec) m_pFormat->nAvgBytesPerSec = m_pFormat->nSamplesPerSec; } destfmt->wFormatTag = WAVE_FORMAT_PCM; destfmt->nBlockAlign = (uint16_t) (destfmt->nChannels * ((destfmt->wBitsPerSample + 7) / 8)); destfmt->nAvgBytesPerSec = destfmt->nSamplesPerSec * destfmt->nBlockAlign; destfmt->cbSize = 0; return 0; } IRtConfig* IAudioDecoder::GetRtConfig() { return 0; } size_t IAudioDecoder::GetSrcSize(size_t dest_size) const { //printf("GET SRC Bps:%d ch:%d bps:%d sps:%d align:%d avgBps:%d\n", (int)m_uiBytesPerSec, m_pFormat->nChannels, // m_pFormat->wBitsPerSample, m_pFormat->nSamplesPerSec, m_pFormat->nBlockAlign, m_pFormat->nAvgBytesPerSec); if (!m_uiBytesPerSec || !m_pFormat->nBlockAlign) { if (!m_pFormat->nSamplesPerSec) return 1500; return dest_size; } size_t frames = dest_size * m_pFormat->nAvgBytesPerSec / m_uiBytesPerSec; if (frames < m_pFormat->nBlockAlign) frames = m_pFormat->nBlockAlign; else if (m_pFormat->nBlockAlign > 1) frames -= frames % m_pFormat->nBlockAlign; return frames; } int IAudioDecoder::SetOutputFormat(const WAVEFORMATEX* destfmt) { return -1; } IAudioEncoder::IAudioEncoder(const CodecInfo& info) :m_Info(info) { } IAudioEncoder::~IAudioEncoder() { } const CodecInfo& IAudioEncoder::GetCodecInfo() const { return m_Info; } int IAudioEncoder::SetBitrate(int bitrate) { return -1; } int IAudioEncoder::SetQuality(int quality) { return -1; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/common/impl_video.cpp0000644000175000017500000000405611170321573020637 0ustar yavoryavor#include "frame.h" #include "videodecoder.h" #include "videoencoder.h" #include "avm_fourcc.h" #include "avm_cpuinfo.h" #include "renderer.h" #include "utils.h" #include #include //gettimeofday #include // labs #include // memset AVM_BEGIN_NAMESPACE; IVideoDecoder::IVideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& format) :m_Info(info), m_pFormat(0), m_Dest(format.biWidth, format.biHeight, 24), //m_Dest(format), m_pImage(0) { // m_Dest.biWidth = format.biWidth; // m_Dest.biHeight = format.biHeight; // m_Dest.SetBits(24); size_t bihs = (format.biSize < sizeof(BITMAPINFOHEADER)) ? sizeof(BITMAPINFOHEADER) : format.biSize; // some parsers are bit-reading data slightly behind the bounds bihs += 3; m_pFormat = (BITMAPINFOHEADER*) new char[bihs]; memset(m_pFormat, 0, bihs); memcpy(m_pFormat, &format, format.biSize); } IVideoDecoder::~IVideoDecoder() { delete[] (char*) m_pFormat; if (m_pImage) m_pImage->Release(); } const BITMAPINFOHEADER& IVideoDecoder::GetDestFmt() const { return (const BITMAPINFOHEADER&) m_Dest; } IVideoDecoder::CAPS IVideoDecoder::GetCapabilities() const { return CAP_NONE; } const CodecInfo& IVideoDecoder::GetCodecInfo() const { return m_Info; } IRtConfig* IVideoDecoder::GetRtConfig() { return 0; } void IVideoDecoder::Flush() { } int IVideoDecoder::Start() { return 0; } int IVideoDecoder::Stop() { return 0; } int IVideoDecoder::Restart() { Stop(); return Start(); } int IVideoDecoder::SetDirection(int d) { if (m_Dest.biHeight < 0) m_Dest.biHeight = -m_Dest.biHeight; if (!d) m_Dest.biHeight = -m_Dest.biHeight; return 0; } /** * Implementation for Encoder */ IVideoEncoder::IVideoEncoder(const CodecInfo& info) :m_Info(info) { } IVideoEncoder::~IVideoEncoder() { } const CodecInfo& IVideoEncoder::GetCodecInfo() const { return m_Info; } float IVideoEncoder::GetFps() const { return -1.; } int IVideoEncoder::SetFps(float fps) { return -1; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/common/mmx.cpp0000644000175000017500000003563711167212026017320 0ustar yavoryavor/******************************************************** Miscellaneous MMX-accelerated routines Copyright 2000 Eugene Kuznetsov (divx@euro.ru) *********************************************************/ #include "avm_cpuinfo.h" #include "mmx.h" #include #include #if !defined WIN32 && ARCH_X86_32 static inline void emms(void) { __asm __volatile ("emms;": : :"memory"); } #define emms_c() \ { \ emms(); \ } void mmx_copy(void* to, const void* from, uint_t size) { uint_t sx = size; uint_t s = size & 0x3f; if (s) { int dummy; asm volatile ( "rep; movsb" :"=&D"(to), "=&S"(from), "=&c"(dummy) :"0"(to), "1"(from), "2"(s) : "memory" ); } while (s < sx) { asm volatile ( #if 0 ".balign 16 \n\t" "1: \n\t" "movq (%0, %2), %%mm0\n\t" "movq 8(%0, %2), %%mm1\n\t" "movq 16(%0, %2), %%mm2\n\t" "movq 24(%0, %2), %%mm3\n\t" "movq 32(%0, %2), %%mm4\n\t" "movq 40(%0, %2), %%mm5\n\t" "movq 48(%0, %2), %%mm6\n\t" "movq 56(%0, %2), %%mm7\n\t" "movq %%mm0, (%1, %2)\n\t" "movq %%mm1, 8(%1, %2)\n\t" "movq %%mm2, 16(%1, %2)\n\t" "movq %%mm3, 24(%1, %2)\n\t" "movq %%mm4, 32(%1, %2)\n\t" "movq %%mm5, 40(%1, %2)\n\t" "movq %%mm6, 48(%1, %2)\n\t" "movq %%mm7, 56(%1, %2)\n\t" #else ".balign 16 \n\t" "1: \n\t" "movq (%0, %2), %%mm0\n\t" "movq 8(%0, %2), %%mm1\n\t" "movq %%mm0, (%1, %2)\n\t" "movq 16(%0, %2), %%mm2\n\t" "movq 24(%0, %2), %%mm3\n\t" "movq 32(%0, %2), %%mm4\n\t" "movq 40(%0, %2), %%mm5\n\t" "movq 48(%0, %2), %%mm6\n\t" "movq 56(%0, %2), %%mm7\n\t" "movq %%mm1, 8(%1, %2)\n\t" "movq %%mm2, 16(%1, %2)\n\t" "movq %%mm3, 24(%1, %2)\n\t" "movq %%mm4, 32(%1, %2)\n\t" "movq %%mm5, 40(%1, %2)\n\t" "movq %%mm6, 48(%1, %2)\n\t" "movq %%mm7, 56(%1, %2)\n\t" #endif : :"r"(from), "r"(to), "r"(s) :"memory" ); s += 64; } emms_c(); } static void zoom_16_bpp(uint16_t* dest, const uint16_t* src, int dst_w, int dst_h, int src_w, int src_h, int xdim) { int x_min = (src_w%dst_w); int y_min = src_h%dst_h; int x_accum = 0; int y_accum = 0; const uint16_t *src2=src; int dest_delta = (xdim!=0 ? xdim-dst_w : 0); int x_maj = src_w/dst_w*2; int y_maj = (src_h/dst_h)*src_w; if ((x_maj>0) || (y_maj>0)) { for(int i=0; i=dst_h) { y_accum-=dst_h; src2+=src_w; } src=src2; } } else // cout << "FIXME error - Tried to use ASM code which is not shlib friendly" << endl; // has to be fixed - causes reference .rel.text // objdump --headers --private-headers -T libaviplay.so | less // if this output doesn't contain .rel.text than its OK! #if 0 // BUGGY { int dest2=0; int i=0; __asm__ __volatile__ ( "pushal \n\t" "subl $16, %%esp \n\t" "movl %5, %%ebx \n\t" // 8(%%esp) = dest_h "movl %%ebx, 8(%%esp) \n\t" "movl %4, %%ebx \n\t" // 12(%%esp) = dest_w "movl %%ebx, 12(%%esp) \n\t" "movl %5, %%ebx \n\t" // i = src_h "movl %%ebx, (%%esp) \n\t" "for_i: \n\t" "movl %0, 4(%%esp) \n\t" // 4(%%esp) = dest "movl 12(%%esp), %%edx \n\t" "movl %4, %%ecx \n\t" // j = src_w "for_j: \n\t" "movw (%1), %%bx \n\t" "x_dest_copy_again: \n\t" "movw %%bx, (%0) \n\t" // *dest = *src "addl $2, %0 \n\t" // dest++; "subl %6, %%edx \n\t" // 12(%%esp)-=x_min "jnc x_dest_copy_again \n\t" // while (12(%%esp) > 0) "no_xdestcopy: \n\t" "addl %2, %%edx \n\t" // 12(%%esp) += dest_w "addl $2, %1 \n\t" // src++; "decl %%ecx \n\t" // j--; "jnz for_j \n\t" // while (j>0) Next "y: \n\t" "movl %%edx, 12(%%esp) \n\t" "addl %8, %0 \n\t" // dest += dest_delta "movl 8(%%esp), %%edx \n\t" "push %1 \n\t" // safe src "y_dest_copy_again: \n\t" "subl %7, %%edx \n\t" // 8(%%esp) -= y_min "jc y_no_cpy_again \n\t" // while (8(%%esp)>0) "movl 8(%%esp),%%esi \n\t" "movl %2, %%ecx \n\t" "shrl $1,%%ecx \n\t" "cld \n\t" "rep; movsl \n\t" "addl %8, %0 \n\t" // dest += dest_delta "jmp y_dest_copy_again \n\t" "y_no_cpy_again: \n\t" "addl %3, %%edx \n\t" // 8(%%esp) += dest_h "movl %%edx, 12(%%esp) \n\t" "pop %1 \n\t" // get src "decl (%%esp) \n\t" "jnz for_i \n\t" "addl $16, %%esp \n\t" "popal \n\t" : : "D"(dest), "S"(src), "r"(dst_w), "r"(dst_h), "r"(src_w), "r"(src_h), "a"(x_min), "r"(y_min), "r"(dest_delta) :"memory" ); } #else { // slow dumb implementation which doesn't work uint16_t* pdest = dest; for (int i = 0; i < src_w && i < dst_h; i++) { for (int j = 0; j < src_h; j++) pdest[j] = *src++; pdest += dst_w; } } #endif } static void zoom_24_bpp(int* dest, const int* src, int dst_w, int dst_h, int src_w, int src_h, int xdim) { int x_maj = src_w/dst_w; int x_min = src_w%dst_w; int y_maj = (src_h/dst_h)*src_w; int y_min = src_h%dst_h; int x_accum = 0; int y_accum = 0; const int *src2=src; int dest_delta = (xdim!=0 ? 3*(xdim-dst_w) : 0); // cout << "(" << dst_w << "," << dst_h << "," << src_w << "," << src_h << ")" << endl; for (int i=0; i=dst_w) { x_accum-=dst_w; src=(const int*)((const char*)src+3); } } dest = (int*) ((char*) dest + dest_delta); src2=(const int*)((const char*)src2+y_maj*3); y_accum+=y_min; if(y_accum>=dst_h) { y_accum-=dst_h; src2=(const int*)((const char*)src2+3*src_w); } src=src2; } } static void zoom_32_bpp(int* dest, const int* src, int dst_w, int dst_h, int src_w, int src_h, int xdim) { int x_maj = src_w/dst_w; int x_min = src_w%dst_w; int y_maj = (src_h/dst_h)*src_w; int y_min = src_h%dst_h; int x_accum = 0; int y_accum = 0; const int *src2=src; int dest_delta = (xdim!=0 ? xdim-dst_w : 0); // cout << "(" << dst_w << "," << dst_h << "," << src_w << "," << src_h << ")" << endl; for(int i=0; i=dst_w) { x_accum-=dst_w; src++; } } dest+=dest_delta; src2+=y_maj; y_accum+=y_min; if(y_accum>=dst_h) { y_accum-=dst_h; src2+=src_w; } src=src2; } } void zoom(uint16_t* dest, const uint16_t* src, int dst_w, int dst_h, int src_w, int src_h, int bpp, int xdim) { switch(bpp) { case 15: case 16: return zoom_16_bpp(dest,src,dst_w,dst_h,src_w,src_h,xdim); case 24: return zoom_24_bpp((int*)dest,(const int*)src,dst_w,dst_h,src_w,src_h,xdim); case 32: return zoom_32_bpp((int*)dest,(const int*)src,dst_w,dst_h,src_w,src_h,xdim); } } #endif // WIN32 static void zoom_2_16_nommx(uint16_t* dest, const uint16_t* src, int w, int h) { for(int i=0; i 1) { w -= 2; unsigned q = *((uint32_t *)&s[w]); *((uint32_t *)&d[w]) = (q & 0x7FFF7FFFU) + (q & 0x7FE07FE0U); } if (w) { uint16_t q = s[0]; ; d[0] = uint16_t(q + uint16_t(q & 0x7FE0U)); } } #if !defined WIN32 && ARCH_X86_32 /********************************************* WARNING All MMX code assumes that dest scanline sizes are multiple of 8 bytes. *********************************************/ static void v555to565_mmx(uint16_t* dest, const uint16_t* src, int w, int h) { static uint64_t line __attribute__ ((aligned(8))) = 0xFFE0FFE0FFE0FFE0LL; bool flip=(h<0); if(flip) { h=-h; src+=w*(h-1); } __asm__ __volatile__ ( "movq %0, %%mm2 \n\t" : : "m"(line) ); // dest+=w*(h-1); for(int i=0; i 565. "movq %%mm0, %%mm1 \n\t" "pand %%mm2, %%mm1 \n\t" "paddw %%mm1, %%mm0 \n\t" //Store the result. "movq %%mm0, (%1) \n\t" "addl $8, %%ecx \n\t" "cmpl %0, %2 \n\t" "ja 1b \n\t" : :"r"(src), "r"(dest), "r"(src + 2*w) :"memory" ); src+=2*w; dest+=w/2; } emms_c(); } static void zoom_2_16_mmx(uint16_t *dest, const uint16_t *src, int w, int h) { static uint64_t line2 __attribute__ ((aligned(8))) = 0x0000FFFF0000FFFFLL; __asm__ __volatile__ ( "movq %0, %%mm3 \n\t" : : "m"(line2) ); for(int i=0; i #else #include #endif #include #include #include #include #include #include "utils.h" #include "aviplay.h" #define USEMMX //#define USE8 void mmx_copy(void* to, const void* from, uint_t size) { //memcpy(to, from, size); //return; uint_t s = size & 0x3f; if (s) { int dummy; __asm__ __volatile__ ( "rep; movsb" :"=&D"(to), "=&S"(from), "=&c"(dummy) :"0" (to), "1" (from),"2" (s) : "memory" ); if (size < 0x40) return; size &= 0x3f; } #define MOVNTQ "movntq" //#define MOVNTQ "movq" //printf("FROM %p %p \n", from, to); __asm__ __volatile__ (".balign 8"); do { __asm__ __volatile__ ( #ifdef USE8 #if 1 "movq (%0, %2), %%mm0\n\t" "movq %%mm0, (%1, %2)\n\t" "movq 8(%0, %2), %%mm1\n\t" "movq 16(%0, %2), %%mm2\n\t" "movq 24(%0, %2), %%mm3\n\t" "movq 32(%0, %2), %%mm4\n\t" "movq 40(%0, %2), %%mm5\n\t" "movq 48(%0, %2), %%mm6\n\t" "movq 56(%0, %2), %%mm7\n\t" "movq %%mm1, 8(%1, %2)\n\t" "movq %%mm2, 16(%1, %2)\n\t" "movq %%mm3, 24(%1, %2)\n\t" "movq %%mm4, 32(%1, %2)\n\t" "movq %%mm5, 40(%1, %2)\n\t" "movq %%mm6, 48(%1, %2)\n\t" "movq %%mm7, 56(%1, %2)\n\t" #else "movq (%0, %2), %%mm0\n\t" "movq 32(%0, %2), %%mm4\n\t" //"movq %%mm0, (%1, %2)\n\t" "movq 8(%0, %2), %%mm1\n\t" "movq 40(%0, %2), %%mm5\n\t" "movq 16(%0, %2), %%mm2\n\t" "movq 24(%0, %2), %%mm3\n\t" "movq 48(%0, %2), %%mm6\n\t" "movq 56(%0, %2), %%mm7\n\t" "prefetchnta 64(%0, %2)\n\t" "prefetchnta 96(%0, %2)\n\t" "prefetchnta 320(%0, %2)\n\t" MOVNTQ" %%mm0, (%1, %2)\n\t" MOVNTQ" %%mm1, 8(%1, %2)\n\t" MOVNTQ" %%mm2, 16(%1, %2)\n\t" MOVNTQ" %%mm3, 24(%1, %2)\n\t" MOVNTQ" %%mm4, 32(%1, %2)\n\t" MOVNTQ" %%mm5, 40(%1, %2)\n\t" MOVNTQ" %%mm6, 48(%1, %2)\n\t" MOVNTQ" %%mm7, 56(%1, %2)\n\t" #endif #else "movq (%0, %2), %%mm0\n\t" "movq %%mm0, (%1, %2)\n\t" "movq 8(%0, %2), %%mm1\n\t" "movq 16(%0, %2), %%mm2\n\t" "movq 24(%0, %2), %%mm3\n\t" //"movl 32(%0, %2), %%eax\n\t" "movq %%mm1, 8(%1, %2)\n\t" "movq %%mm2, 16(%1, %2)\n\t" "movq %%mm3, 24(%1, %2)\n\t" #endif : :"r"(from), "r"(to), "r"(s) :"eax", "memory" ); #ifdef USE8 s += 64; //(const char*)from += 64; //(char*)to += 64; #else s += 32; #endif } while (s < size); __asm__ __volatile__ ("emms"); } #define MOVQ_WONE(regd) \ __asm __volatile ( \ "pcmpeqd %%" #regd ", %%" #regd " ;" \ "psrlw $15, %%" #regd " ;") #define MOVQ_WTWO(regd) \ __asm __volatile ( \ "pcmpeqd %%" #regd ", %%" #regd " \n\t" \ "psrlw $14, %%" #regd " \n\t") int main(int argc, char* argv[]) { GetAvifileVersion(); #if 0 int MB = 1024 * 1024; char* a = (char*) memalign(64, 8 * MB); for (int i = 0; i < 8 * MB; i++) a[i] = (int) (i); int x = 10, y = 0; // MOVQ_WONE(mm7); __asm __volatile ( " pcmpeqd %%mm7, %%mm7 ;" " psrlw $15, %%mm7 ;" " psllw $1, %%mm7 ;" " movd %%mm7, %%eax ;" " movl %%eax, %0 ;" :"=r"(y) :"r"(x) :"%eax"); printf("Regset 0x%x\n", y); return 0; #endif #if 0 int ite; for (int j = 1624/2; j < 2024/2; j += 32) { MB = 1024 * j; int64_t m1 = avm_get_time_us(); for (ite = 0; ite < 20; ite++) #ifdef USEMMX mmx_copy(a + MB , a, MB & ~0x3f); #else memcpy(a + MB, a, MB & ~0x3f); #endif float tt = avm_get_time_diff(avm_get_time_us(), m1); AVM_WRITE("MMX_COPY", "TIME %f %fMB/s %d %dB\n", tt, (ite * MB / 1024 / 1024) / tt, memcmp(a, a + 2 * MB, MB), MB); } for (int i = 0; i < 4000000; i++) a[i] = (int) (a + i); return 0; #endif BITMAPINFOHEADER bh; bh.biSize = sizeof(BITMAPINFOHEADER); bh.biWidth = 640; bh.biHeight = 480; bh.biCompression = 0; BitmapInfo bii(bh); BitmapInfo bio(bh); //bii.SetBits(24); bii.SetSpace(IMG_FMT_YUY2); //bio.SetBits(15); bio.SetSpace(IMG_FMT_YV12); CImage* cii = new CImage(&bii); CImage* cio = new CImage(&bio); int64_t t1 = avm_get_time_us(); const int iter = 100;//0; for (int i = 0; i < iter; i++) cio->Convert(cii); int64_t t2 = avm_get_time_us(); float tm = avm_get_time_diff(t2, t1); AVM_WRITE("CImage", "TIME %f %f\n", tm, tm / iter); return 0; } avifile-0.7.48~20090503.ds/lib/common/util.cpp0000644000175000017500000002226011174451012017456 0ustar yavoryavor#include "avm_cpuinfo.h" #include "avm_creators.h" #include "avm_output.h" #include "infotypes.h" #include "utils.h" #include "plugin.h" #include "version.h" #include #include //atof #ifndef WIN32 #include #include #else #include #endif #include #ifdef HAVE_KSTAT #include #endif #include #include #ifdef AVM_COMPATIBLE int64_t longcount_notsc(void) { #ifndef WIN32 static const uint32_t limit= ~0U / 1000000; struct timeval tv; gettimeofday(&tv, 0); int64_t result; result=tv.tv_sec; result<<=32; result+=limit*tv.tv_usec; return result; #else return time(NULL); #endif } static uint_t localcount_notsc() { #ifndef WIN32 static const uint32_t limit= ~0U / 1000000; struct timeval tv; gettimeofday(&tv, 0); return limit*(uint32_t)tv.tv_usec; #else return time(NULL); #endif } #endif AVM_BEGIN_NAMESPACE; BaseInfo::BaseInfo() { } BaseInfo::BaseInfo(const char* info, const char* _about) : name(info), about(_about) { } BaseInfo::~BaseInfo() { } AttributeInfo::AttributeInfo(const char* n, const char* a, const char* const* o, int defitem) : BaseInfo(n, a), kind(Select), i_min(0), i_max(-1), i_default(defitem) { while (*o) { options.push_back(*o); o++; } i_max = (int)options.size(); } AttributeInfo::AttributeInfo() { } AttributeInfo::AttributeInfo(const char* n, const char* a, Kind k, int minval, int maxval, int defval) : BaseInfo(n, (a) ? a : ""), kind(k), i_min(minval), i_max(maxval), i_default(defval) { if (i_default == -1) i_default = (i_min + i_max) / 2; } AttributeInfo::AttributeInfo(const char* n, const char* a, float defval, float minval, float maxval) : BaseInfo(n, (a) ? a : ""), kind(Float), f_min(minval), f_max(maxval), f_default(defval) { } AttributeInfo::~AttributeInfo() { } bool AttributeInfo::IsAttr(const char* attribute) const { return (strcmp(GetName(), attribute) == 0 || strcmp(GetAbout(), attribute) == 0); } CodecInfo::CodecInfo() :handle(0) //, codec(0) { } CodecInfo::CodecInfo(const fourcc_t* array, const char* info, const char* path, const char* a, Kind _kind, const char* pn, Media _media, Direction _direction, const GUID* id, const avm::vector& ei, const avm::vector& di) : BaseInfo(info, a), fourcc(array[0]), privatename(pn), kind(_kind), media(_media), direction(_direction), dll(path), decoder_info(di), encoder_info(ei), handle(0)//, codec(0), { if (id) guid = *id; if (!*array) // uncompressed codec { fourcc_array.push_back(0); array++; } while (*array) { fourcc_array.push_back(*array); array++; } } const GUID CodecInfo::FFMPEG_GUID = { FFMPEG, }; CodecInfo::CodecInfo(const CodecInfo& ci) :handle(0) { operator=(ci); } CodecInfo::~CodecInfo() { if (handle) { //((PluginPrivate*)handle)->refcount--; //printf("HAND-\n"); } } const AttributeInfo* CodecInfo::FindAttribute(const char* attr, Direction dir) const { if (attr) { if (dir == Both || dir == Encode) { avm::vector::const_iterator it; for (it = encoder_info.begin(); it != encoder_info.end(); it++) if (it->IsAttr(attr)) return &(*it); } if (dir == Both || dir == Decode) { avm::vector::const_iterator it; for (it = decoder_info.begin(); it != decoder_info.end(); it++) if (it->IsAttr(attr)) return &(*it); } } return 0; } CodecInfo& CodecInfo::operator=(const CodecInfo& ci) { name = ci.name; about = ci.about; handle = ci.handle; if (handle) { //((PluginPrivate*)handle)->refcount++; //printf("HAND+\n"); } assert(handle == 0); #if 0 if (ci.handle) { (plugin_internal*) handle = new plugin_internal; ((plugin_internal*)handle)->dlhandle = ((plugin_internal*)ci.handle)->dlhandle; ((plugin_internal*)handle)->plhandle = ((plugin_internal*)ci.handle)->plhandle; } else handle = 0; codec = ci.codec; #endif fourcc = ci.fourcc; fourcc_array = ci.fourcc_array; kind = ci.kind; media = ci.media; direction = ci.direction; decoder_info = ci.decoder_info; encoder_info = ci.encoder_info; modulename = ci.modulename; guid = ci.guid; dll = ci.dll; privatename = ci.privatename; return *this; } // CodecInfo::match is in codeckeeper.cpp - it's using Create functions IRtConfig::~IRtConfig() { } #ifdef WIN32 #define rdtsc __asm _emit 0fh __asm _emit 031h #define cpuid __asm _emit 0fh __asm _emit 0a2h #define strncasecmp strnicmp #endif static void do_cpuid(uint_t *regs, int op) { unsigned int ax, cx; *regs = 0; #if ARCH_X86_32 /* first check if cpuid is supported - ffmpeg */ __asm__ __volatile__ ( /* See if CPUID instruction is supported ... */ /* ... Get copies of EFLAGS into eax and ecx */ "pushf\n\t" "popl %0\n\t" "movl %0, %1\n\t" /* ... Toggle the ID bit in one copy and store */ /* to the EFLAGS reg */ "xorl $0x200000, %0\n\t" "push %0\n\t" "popf\n\t" /* ... Get the (hopefully modified) EFLAGS */ "pushf\n\t" "popl %0\n\t" : "=a" (ax), "=c" (cx) : : "cc" ); if (ax == cx) return; /* CPUID not supported */ ax = op; __asm__ __volatile__ ( "pushl %%ebx; pushl %%ecx; pushl %%edx;" ".byte 0x0f, 0xa2;" "movl %%eax, (%2);" "movl %%ebx, 4(%2);" "movl %%ecx, 8(%2);" "movl %%edx, 12(%2);" "popl %%edx; popl %%ecx; popl %%ebx;" : "=a" (ax) : "0" (ax), "S" (regs)); #endif return; } #if 0 static uint_t localcount_tsc() { int a; #ifndef WIN32 #if ARCH_X86 __asm__ __volatile__("rdtsc\n\t" : "=a"(a) : : "edx"); #else a = 0; #endif #else __asm { rdtsc mov a, eax } #endif return a; } static int64_t longcount_tsc() { #ifndef WIN32 #if ARCH_X86 int64_t l; __asm__ __volatile__("rdtsc\n\t":"=A"(l)); return l; #else return 0; #endif #else unsigned long i; unsigned long j; __asm { rdtsc mov i, eax mov j, edx } return ((int64_t)j<<32)+(int64_t)i; #endif } #endif static double old_freq() { #if HAVE_KSTAT /* * try to extact the CPU speed from the Solaris kernel's kstat data */ kstat_ctl_t *kc; kstat_t *ksp; kstat_named_t *kdata; int mhz = 0; kc = kstat_open(); if (kc != NULL) { ksp = kstat_lookup(kc, "cpu_info", 0, "cpu_info0"); /* kstat found and name/value pairs? */ if (ksp != NULL && ksp->ks_type == KSTAT_TYPE_NAMED) { /* read the kstat data from the kernel */ if (kstat_read(kc, ksp, NULL) != -1) { /* * lookup desired "clock_MHz" entry, check the expected * data type */ kdata = (kstat_named_t *)kstat_data_lookup(ksp, "clock_MHz"); if (kdata != NULL && kdata->data_type == KSTAT_DATA_INT32) mhz = kdata->value.i32; } } kstat_close(kc); } if (mhz > 0) return mhz * 1000.; #endif /* HAVE_KSTAT */ time_t i=time(NULL); int64_t x,y; while(i==time(NULL)); x=avm_get_time_us(); i++; while(i==time(NULL)); y=avm_get_time_us(); return (double)(y-x)/1000.; } CPU_Info::CPU_Info() { AvmOutput::createAvmOutput(); } CPU_Info::~CPU_Info() { delete AvmOutput(); } void CPU_Info::Init() { char line[200]; char model[200]="unknown"; char flags[500]=""; char* s, *value; bool is_AMD=false; freq = -1; have_tsc = have_mmx = have_mmxext = have_sse = false; FILE *f = fopen("/proc/cpuinfo", "r"); if (!f) { uint_t regs[4]; do_cpuid(regs, 0); is_AMD = ((regs[1] == 0x68747541) && (regs[2] == 0x444d4163) && (regs[3] == 0x69746e65)); do_cpuid(regs, 1); have_tsc=regs[3] & 0x00000010; have_mmx=regs[3] & 0x00800000; have_mmxext=regs[3] & 0x02000000; have_sse=regs[3] & 0x02000000; do_cpuid(regs, 0x80000000); if (regs[0] >= 0x80000001) { do_cpuid(regs, 0x80000001); if(is_AMD && (regs[3] & 0x00400000)) have_mmxext=1; } freq = old_freq(); return; } while (fgets(line, 200, f) != NULL) { /* NOTE: the ':' is the only character we can rely on */ value = strchr(line,':'); if (!value) continue; /* terminate the valuename */ *value++ = '\0'; /* skip any leading spaces */ while (*value == ' ') value++; s = strchr(value, '\n'); if (s) *s = '\0'; if (!strncasecmp(line, "cpu MHz",strlen("cpu MHz"))) { freq = atof(value); freq *= 1000.; } if (!strncasecmp(line, "model name", strlen("model name"))) strncpy(model, value, sizeof(model)-1); if (!strncasecmp(line, "flags", strlen("flags")) || !strncasecmp(line, "features", strlen("features"))) strncpy(flags, value, sizeof(flags)-1); continue; } fclose(f); AVM_WRITE("init", 0, "Avifile %s\n", AVIFILE_BUILD); AVM_WRITE("init", 0, "Available CPU flags: %s\n", flags); have_tsc = (strstr(flags, "tsc") != 0); have_mmx = (strstr(flags, "mmx") != 0); have_sse = (strstr(flags, "sse") != 0); have_mmxext = (strstr(flags, "mmxext") != 0) | have_sse; if (freq < 0) freq = old_freq(); if (have_tsc) AVM_WRITE("init", 0, "%.2f MHz %s %sdetected\n", freq/1000., model, strstr(model, "rocessor") ? "" : "processor "); } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/common/utils.c0000644000175000017500000000623511176341443017315 0ustar yavoryavor#include "utils.h" #include #include #include // getenv, malloc,... #include // strcat,... // mutex for locking parallelism in large memory transfers #ifdef AVM_COMPATIBLE uint_t (*localcount)(void); int64_t (*longcount)(void); #endif WAVEFORMATEX* avm_get_leWAVEFORMATEX(void* waveformatex) { WAVEFORMATEX* wf = (WAVEFORMATEX*) waveformatex; wf->wFormatTag = avm_get_le16(&wf->wFormatTag); wf->nChannels = avm_get_le16(&wf->nChannels); wf->nSamplesPerSec = avm_get_le32(&wf->nSamplesPerSec); wf->nAvgBytesPerSec = avm_get_le32(&wf->nAvgBytesPerSec); wf->nBlockAlign = avm_get_le16(&wf->nBlockAlign); wf->wBitsPerSample = avm_get_le16(&wf->wBitsPerSample); wf->cbSize = avm_get_le16(&wf->cbSize); /* convert other types */ return wf; } BITMAPINFOHEADER* avm_get_leBITMAPINFOHEADER(void* bitmapinfoheader) { BITMAPINFOHEADER* bi = (BITMAPINFOHEADER*) bitmapinfoheader; bi->biSize = avm_get_le32(&bi->biSize); bi->biWidth = (int32_t)avm_get_le32(&bi->biWidth); bi->biHeight = (int32_t)avm_get_le32(&bi->biHeight); bi->biPlanes = avm_get_le16(&bi->biPlanes); bi->biBitCount = avm_get_le16(&bi->biBitCount); bi->biCompression = avm_get_le32(&bi->biCompression); bi->biSizeImage = avm_get_le32(&bi->biCompression); bi->biXPelsPerMeter = (int32_t)avm_get_le32(&bi->biXPelsPerMeter); bi->biYPelsPerMeter = (int32_t)avm_get_le32(&bi->biYPelsPerMeter); bi->biClrUsed = avm_get_le32(&bi->biClrUsed); bi->biClrImportant = avm_get_le32(&bi->biClrImportant); return bi; } GUID* avm_get_leGUID(void* guid) { GUID* g = (GUID*) guid; g->f1 = avm_get_le32(&g->f1); g->f2 = avm_get_le16(&g->f2); g->f3 = avm_get_le16(&g->f3); return g; } /* * A thread-safe usec sleep * (Note: on solaris, usleep is not thread-safe) */ #ifndef WIN32 int avm_usleep(unsigned long delay) { #if HAVE_NANOSLEEP struct timespec tsp; tsp.tv_sec = (time_t)(delay / 1000000); tsp.tv_nsec = (long)((delay % 1000000) * 1000); return nanosleep(&tsp, NULL); #else return usleep(delay); #endif } #endif int64_t avm_get_time_us(void) { #ifndef WIN32 struct timeval tv; gettimeofday(&tv, 0); int64_t result = tv.tv_usec; result += (int64_t)tv.tv_sec * 1000000; return result; #else return time(NULL); #endif } /* * Solaris (maybe other operating systems, too) does not have avm_setenv(), * and avm_unsetenv() in libc, provide our own implementation. */ int avm_setenv(const char *name, const char *value, int overwrite) { #if HAVE_SETENV return setenv(name, value, overwrite); #else char *env; if (getenv(name) != NULL && !overwrite) return 0; env = malloc(strlen(name) + strlen(value) + 2); strcpy(env, name); strcat(env, "="); strcat(env, value); return putenv(env); #endif } void avm_unsetenv(const char *name) { #if HAVE_UNSETENV unsetenv(name); #else extern char **environ; char **ep; int len = strlen(name); for (ep = environ; *ep; ep++) { if (strncmp(*ep, name, len) == 0 && (*ep)[len] == '=') { while ((ep[0] = ep[1]) != NULL) ep++; break; } } #endif } avifile-0.7.48~20090503.ds/lib/common/vbrctrl.c0000644000175000017500000002657211055071154017634 0ustar yavoryavor/* * This file 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * * 2-pass code OpenDivX port: * Copyright (C) 2001 Christoph Lampert * * transcode port: * Copyright (C) Thomas Östreich - June 2001 * * avifile port: * Copyright (C) Zdenek Kabelac - July 2002 * */ /* * Two-pass-code from OpenDivX * * Large parts of this code were taken from VbrControl() * from the OpenDivX project, (C) divxnetworks, * this code is published under DivX Open license, which * can be found... somewhere... oh, whatever... */ /* * I don't like it at all - ok avifile is C++ project originaly * but there seems to be a big aversion in linux comunity for C++ * ok so let's write C code in C++ way - this should have make * everyone happy... * */ #include #include #include #include #include #include #include #include "vbrctrl.h" #define FALSE 0 #define TRUE 1 /* Absolute maximum and minimum quantizers used in VBR modes */ static const int MIN_QUANTIZER = 1; static const int MAX_QUANTIZER = 31; /* Limits on frame-level deviation of quantizer ( higher values * correspond to frames with more changes and vice versa ) */ static const float MIN_QUANT_DELTA = -10.; static const float MAX_QUANT_DELTA = 5.; /* Limits on stream-level deviation of quantizer ( used to make * overall bitrate of stream close to requested value ) */ static const float MIN_RC_QUANT_DELTA = .6; static const float MAX_RC_QUANT_DELTA = 1.5; /* Crispness parameter controls threshold for decision whether * to skip the frame or to code it. */ //static const float MAX_CRISPENSS=100.f; /* Maximum allowed number of skipped frames in a line. */ //static const int MAX_DROP_LINE=0; // CHL We don't drop frames at the moment! // methods from class VbrControl typedef struct { /* max 28 bytes/frame or 5 Mb for 2-hour movie */ int quant; int text_bits; int motion_bits; int total_bits; float mult; short is_key_frame; short drop; } vbrentry_t; struct vbrctrl_s { int m_iCount; int m_iQuant; int m_iCrispness; short m_bDrop; float m_fQuant; int64_t m_lEncodedBits; int64_t m_lExpectedBits; FILE *m_pFile; int m_iEntries; vbrentry_t *m_pFrames; int iNumFrames; }; vbrctrl_t* vbrctrl_init_1pass(int quality, int crispness) { vbrctrl_t* t = malloc(sizeof(vbrctrl_t)); if (t) { memset(t, 0, sizeof(vbrctrl_t)); t->m_fQuant = MIN_QUANTIZER + ((MAX_QUANTIZER - MIN_QUANTIZER) / 6.) * (6 - quality); t->m_iCount = 0; t->m_bDrop = FALSE; vbrctrl_update_1pass(t); } return t; } vbrctrl_t* vbrctrl_init_2pass_analysis(const char *filename, int quality, int crispness) { vbrctrl_t* t; FILE *f = fopen(filename, "wb"); if (!f == 0) return 0; t = vbrctrl_init_1pass(quality, crispness); if (!t) { fclose(f); return 0; } t->m_iCount = 0; t->m_bDrop = FALSE; t->m_pFile = f; fprintf(f, "##version 1\n"); fprintf(f, "quality %d\n", quality); return t; } vbrctrl_t* vbrctrl_init_2pass_encoding(const char *filename, int bitrate, double framerate, int quality, int crispness) { int i; vbrctrl_t* t; int64_t text_bits = 0; int64_t total_bits = 0; int64_t complexity = 0; int64_t new_complexity = 0; int64_t motion_bits = 0; int64_t denominator = 0; float qual_multiplier = 1.; char head[20]; int64_t desired_bits; int64_t non_text_bits; float average_complexity; FILE *f = fopen(filename, "rb"); if (!f) return 0; t = vbrctrl_init_1pass(quality, 0); if (!t) { fclose(f); return 0; } t->m_bDrop = FALSE; t->m_iCount = 0; fread(head, 10, 1, f); if (!strncmp("##version ", head, 10)) { int version; int iOldQual; float old_qual, new_qual; fscanf(f, "%d\n", &version); fscanf(f, "quality %d\n", &iOldQual); switch (iOldQual) { case 5: old_qual = 1.; break; case 4: old_qual = 1.1; break; case 3: old_qual = 1.25; break; case 2: old_qual = 1.4; break; case 1: default: old_qual = 2.; break; } switch (quality) { case 5: new_qual = 1.; break; case 4: new_qual = 1.1; break; case 3: new_qual = 1.25; break; case 2: new_qual = 1.4; break; case 1: default: new_qual = 2.; break; } qual_multiplier = new_qual / old_qual; } else fseek(f, 0, SEEK_SET); /* removed C++ dependencies, now read file twice :-( */ t->iNumFrames = 0; while (!feof(f)) { vbrentry_t *e; if (t->m_iEntries < (t->iNumFrames + 1)) { t->m_iEntries += 20000; // realloc for every 20000 frames; t->m_pFrames = realloc(t->m_pFrames, t->m_iEntries * sizeof(vbrentry_t)); if (!t->m_pFrames) { fclose(f); vbrctrl_close(t); return 0; // out of memory } } e = &(t->m_pFrames[t->iNumFrames]); fscanf(f, "Frame %*d: intra %hd, quant %d, texture %d, motion %d, total %d\n", &(e->is_key_frame), &(e->quant), &(e->text_bits), &(e->motion_bits), &(e->total_bits)); e->total_bits += e->text_bits * (qual_multiplier - 1); e->text_bits *= qual_multiplier; text_bits += e->text_bits; motion_bits += e->motion_bits; total_bits += e->total_bits; complexity += e->text_bits * e->quant; t->iNumFrames++; // printf("Frames %d, texture %d, motion %d, quant %d total %d ", // iNumFrames, vFrame.text_bits, vFrame.motion_bits, vFrame.quant, vFrame.total_bits); // printf("texture %d, total %d, complexity %lld \n",vFrame.text_bits,vFrame.total_bits, complexity); } fclose(f); desired_bits = (int64_t) bitrate *(int64_t) t->iNumFrames / framerate; non_text_bits = total_bits - text_bits; //if (verbose & TC_DEBUG) { // fprintf(stderr, "(%s) frames %d, texture %lld, motion %lld, total %lld, complexity %lld\n", __FILE__, iNumFrames, text_bits, motion_bits, total_bits, complexity); //} if (desired_bits <= non_text_bits) { char s[200]; printf("Specified bitrate is too low for this clip.\n" "Minimum possible bitrate for the clip is %.0f kbps. Overriding\n" "user-specified value.\n", (float) (non_text_bits * framerate / (int64_t) t->iNumFrames)); desired_bits = non_text_bits * 3 / 2; /* m_fQuant=MAX_QUANTIZER; for(int i=0; iiNumFrames; for (i = 0; i < t->iNumFrames; i++) { float mult; if (t->m_pFrames[i].is_key_frame) { if ((i + 1 < t->iNumFrames) && (t->m_pFrames[i + 1].is_key_frame)) mult = 1.25; else mult = .75; } else { mult = t->m_pFrames[i].text_bits * t->m_pFrames[i].quant; mult = (float) sqrt(mult / average_complexity); //if(i && m_pFrames[i-1].is_key_frame) // mult *= 0.75; if (mult < 0.5) mult = 0.5; if (mult > 1.5) mult = 1.5; } t->m_pFrames[i].mult = mult; t->m_pFrames[i].drop = FALSE; new_complexity += t->m_pFrames[i].text_bits * t->m_pFrames[i].quant; denominator += desired_bits * t->m_pFrames[i].mult / t->iNumFrames; } t->m_fQuant = ((double) new_complexity) / (double) denominator; if (t->m_fQuant < MIN_QUANTIZER) t->m_fQuant = MIN_QUANTIZER; if (t->m_fQuant > MAX_QUANTIZER) t->m_fQuant = MAX_QUANTIZER; t->m_pFile = fopen("analyse.log", "wb"); if (t->m_pFile) { fprintf(t->m_pFile, "Total frames: %d Avg quantizer: %f\n", t->iNumFrames, t->m_fQuant); fprintf(t->m_pFile, "Expecting %12" PRId64 " bits\n", desired_bits + non_text_bits); fflush(t->m_pFile); } vbrctrl_set_quant(t, t->m_fQuant * t->m_pFrames[0].mult); t->m_lEncodedBits = t->m_lExpectedBits = 0; return t; } int vbrctrl_get_intra(vbrctrl_t* t) { return t->m_pFrames[t->m_iCount].is_key_frame; } int vbrctrl_get_drop(vbrctrl_t* t) { return t->m_bDrop; } int vbrctrl_get_quant(vbrctrl_t* t) { return t->m_iQuant; } void vbrctrl_set_quant(vbrctrl_t* t, float quant) { t->m_iQuant = quant; if ((rand() % 10) < ((quant - t->m_iQuant) * 10)) t->m_iQuant++; if (t->m_iQuant < MIN_QUANTIZER) t->m_iQuant = MIN_QUANTIZER; else if (t->m_iQuant > MAX_QUANTIZER) t->m_iQuant = MAX_QUANTIZER; } void vbrctrl_update_1pass(vbrctrl_t* t) { vbrctrl_set_quant(t, t->m_fQuant); t->m_iCount++; } void vbrctrl_update_2pass_analysis(vbrctrl_t* t, int is_key_frame, int motion_bits, int texture_bits, int total_bits, int quant) { if (t->m_pFile) { fprintf(t->m_pFile, "Frame %d: intra %d, quant %d, texture %d, motion %d, total %d\n", t->m_iCount, is_key_frame, quant, texture_bits, motion_bits, total_bits); t->m_iCount++; } } void vbrctrl_update_2pass_encoding(vbrctrl_t* t, int motion_bits, int texture_bits, int total_bits) { float q; double dq; vbrentry_t *e; if (t->m_iCount >= t->iNumFrames) return; e = &(t->m_pFrames[t->m_iCount]); t->m_lExpectedBits += (e->total_bits - e->text_bits) + e->text_bits * e->quant / t->m_fQuant; t->m_lEncodedBits += (int64_t) total_bits; if (t->m_pFile) { fprintf(t->m_pFile, "Frame %d: PRESENT, complexity %d, quant multiplier %f, texture %d, total %d ", t->m_iCount, e->text_bits * e->quant, e->mult, texture_bits, total_bits); } t->m_iCount++; q = t->m_fQuant * t->m_pFrames[t->m_iCount].mult; if (q < t->m_fQuant + MIN_QUANT_DELTA) q = t->m_fQuant + MIN_QUANT_DELTA; if (q > t->m_fQuant + MAX_QUANT_DELTA) q = t->m_fQuant + MAX_QUANT_DELTA; dq = (float) t->m_lEncodedBits / (float) t->m_lExpectedBits; dq *= dq; if (dq < MIN_RC_QUANT_DELTA) dq = MIN_RC_QUANT_DELTA; if (dq > MAX_RC_QUANT_DELTA) dq = MAX_RC_QUANT_DELTA; if (t->m_iCount < 20) // no framerate corrections in first frames dq = 1.; q *= dq; vbrctrl_set_quant(t, q); if (t->m_pFile) fprintf(t->m_pFile, "Progress: expected %12" PRId64 ", achieved %12" PRId64 ", " "dq %f, new quant %d\n", t->m_lExpectedBits, t->m_lEncodedBits, dq, t->m_iQuant); } void vbrctrl_close(vbrctrl_t* t) { if (t) { if (t->m_pFile) fclose(t->m_pFile); if (t->m_pFrames) free(t->m_pFrames); free(t); } } avifile-0.7.48~20090503.ds/lib/common/wave_type.c0000644000175000017500000002212011177255220020145 0ustar yavoryavor#include "utils.h" #include "formats.h" #include #include const char* avm_wave_format_name(short fmt) { unsigned i; const struct s_t { fourcc_t format; const char* name; } const formats[] = { { 0x0000, "Microsoft Unknown Wave Format" }, { WAVE_FORMAT_PCM, "Microsoft PCM" }, { WAVE_FORMAT_ADPCM, "Microsoft ADPCM" }, { WAVE_FORMAT_IEEE_FLOAT, "IEEE Float" }, { WAVE_FORMAT_VSELP, "Compaq Computer VSELP Ima-0ADPCM" }, { WAVE_FORMAT_IBM_CVSD, "IBM CVSD" }, { WAVE_FORMAT_ALAW, "Microsoft ALAW (CCITT A-Law)" }, { WAVE_FORMAT_MULAW, "Microsoft MULAW (CCITT u-Law)" }, { WAVE_FORMAT_DVI_ADPCM, "DVI ADPCM" }, { WAVE_FORMAT_GSM610, "MS GSM 6.10" }, { WAVE_FORMAT_MSNAUDIO, "MSN Audio" }, { WAVE_FORMAT_MPEG, "MPEG Layer-1/2" }, { WAVE_FORMAT_MPEGLAYER3, "MPEG Layer-3" }, { WAVE_FORMAT_VOXWARE_BYTE_ALIGNED, }, { WAVE_FORMAT_VOXWARE_AC8, }, { WAVE_FORMAT_VOXWARE_AC10, }, { WAVE_FORMAT_VOXWARE_AC16, }, { WAVE_FORMAT_VOXWARE_RT24, }, { WAVE_FORMAT_VOXWARE_RT29HW, }, { WAVE_FORMAT_VOXWARE_VR12, }, { WAVE_FORMAT_VOXWARE_VR18, }, { WAVE_FORMAT_VOXWARE_RT29, "Voxware Metasound" }, { WAVE_FORMAT_SIPROLAB_ACELP4800, }, { WAVE_FORMAT_SIPROLAB_ACELP8V3, }, { WAVE_FORMAT_SIPROLAB_G729, }, { WAVE_FORMAT_SIPROLAB_G729A, }, { WAVE_FORMAT_SIPROLAB_KELVIN, }, { WAVE_FORMAT_SIPROLAB_ACEPLNET, "ACELP.net" }, { WAVE_FORMAT_MSAUDIO1, "WMA v1" }, { 0x0161, "WMA v2" }, { 0x0162, "WMA v3" }, { 0x0401, "Intel Music Coder" }, { 0x181c, "VoxWare RT24 Speech codec" }, { 0x1fc4, "ALF2" }, { WAVE_FORMAT_DVM, "AC3 DVM" }, { WAVE_FORMAT_EXTENSIBLE, "Extended" } }; for (i = 0; i < (sizeof(formats)/sizeof(formats[0])); ++i) if (fmt == formats[i].format) { if (formats[i].name != 0) return formats[i].name; fmt = formats[i + 1].format; // use next string } return "unknown?"; #if 0 * 0x0008 Microsoft DTS * 0x0009 Microsoft DRM * 0x0010 OKI ADPCM * 0x0011 Intel DVI ADPCM (IMA ADPCM) * 0x0012 Videologic MediaSpace ADPCM * 0x0013 Sierra Semiconductor ADPCM * 0x0014 Antex Electronics G.723 ADPCM * 0x0015 DSP Solutions DigiSTD * 0x0016 DSP Solutions DigiFIX * 0x0017 Dialogic OKI ADPCM * 0x0018 MediaVision ADPCM * 0x0019 Hewlett-Packard CU codec * 0x0020 Yamaha ADPCM * 0x0021 Speech Compression SONARC * 0x0022 DSP Group True Speech * 0x0023 Echo Speech EchoSC1 * 0x0024 Audiofile AF36 * 0x0025 Audio Processing Technology APTX * 0x0026 AudioFile AF10 * 0x0027 Prosody 1612 codec for CTI Speech Card * 0x0028 Merging Technologies S.A. LRC * 0x0030 Dolby Labs AC2 * 0x0031 Microsoft GSM 6.10 * 0x0032 MSNAudio * 0x0033 Antex Electronics ADPCME * 0x0034 Control Resources VQLPC * 0x0035 DSP Solutions DigiREAL * 0x0036 DSP Solutions DigiADPCM * 0x0037 Control Resources CR10 * 0x0038 Natural MicroSystems VBXADPCM * 0x0039 Roland RDAC (Crystal Semiconductor IMA ADPCM) * 0x003A Echo Speech EchoSC3 * 0x003B Rockwell ADPCM * 0x003C Rockwell Digit LK * 0x003D Xebec Multimedia Solutions * 0x0040 Antex Electronics G.721 ADPCM * 0x0041 Antex Electronics G.728 CELP * 0x0042 Microsoft MSG723 * 0x0043 IBM AVC ADPCM * 0x0045 ITU-T G.726 ADPCM * 0x0050 MPEG-1 layer 1, 2 * 0x0052 InSoft RT24 (ACM codec is an alternative codec) * 0x0053 InSoft PAC * 0x0055 MPEG-1 Layer 3 (MP3) * 0x0059 Lucent G.723 * 0x0060 Cirrus Logic * 0x0061 ESS Technology ESPCM / Duck DK4 ADPCM * 0x0062 Voxware file-mode codec / Duck DK3 ADPCM * 0x0063 Canopus Atrac * 0x0064 APICOM G.726 ADPCM * 0x0065 APICOM G.722 ADPCM * 0x0066 Microsoft DSAT * 0x0067 Microsoft DSAT Display * 0x0069 Voxware Byte Aligned (bitstream-mode codec) * 0x0070 Voxware AC8 (Lernout & Hauspie CELP 4.8 kbps) * 0x0071 Voxware AC10 (Lernout & Hauspie CBS 8kbps) * 0x0072 Voxware AC16 (Lernout & Hauspie CBS 12kbps) * 0x0073 Voxware AC20 (Lernout & Hauspie CBS 16kbps) * 0x0074 Voxware MetaVoice (file and stream oriented) * 0x0075 Voxware MetaSound (file and stream oriented) * 0x0076 Voxware RT29HW * 0x0077 Voxware VR12 * 0x0078 Voxware VR18 * 0x0079 Voxware TQ40 * 0x0080 Softsound * 0x0081 Voxware TQ60 * 0x0082 Microsoft MSRT24 (ACM codec is an alternative codec) * 0x0083 AT&T Labs G.729A * 0x0084 Motion Pixels MVI MV12 * 0x0085 DataFusion Systems G.726 * 0x0086 DataFusion Systems GSM610 * 0x0088 Iterated Systems ISIAudio * 0x0089 Onlive * 0x0091 Siemens Business Communications SBC24 * 0x0092 Sonic Foundry Dolby AC3 SPDIF * 0x0093 MediaSonic G.723 * 0x0094 Aculab PLC Prosody 8KBPS * 0x0097 ZyXEL ADPCM * 0x0098 Philips LPCBB * 0x0099 Studer Professional Audio AG Packed * 0x00A0 Malden Electronics PHONYTALK * 0x00FF AAC * 0x0100 Rhetorex ADPCM * 0x0101 IBM mu-law / BeCubed Software IRAT * 0x0102 IBM A-law * 0x0103 IBM AVC ADPCM * 0x0111 Vivo G.723 * 0x0112 Vivo Siren * 0x0123 Digital G.723 * 0x0125 Sanyo LD ADPCM * 0x0130 Sipro Lab Telecom ACELP.net * 0x0131 Sipro Lab Telecom ACELP.4800 * 0x0132 Sipro Lab Telecom ACELP.8V3 * 0x0133 Sipro Lab Telecom ACELP.G.729 * 0x0134 Sipro Lab Telecom ACELP.G.729A * 0x0135 Sipro Lab Telecom ACELP.KELVIN * 0x0140 Dictaphone G.726 ADPCM * 0x0150 Qualcomm PureVoice * 0x0151 Qualcomm HalfRate * 0x0155 Ring Zero Systems TUB GSM * 0x0160 Windows Media Audio V1 / DivX audio (WMA) * 0x0161 Windows Media Audio V2 V7 V8 V9 / DivX audio (WMA) / Alex AC3 Audio * 0x0162 Windows Media Audio Professional V9 * 0x0163 Windows Media Audio Lossless V9 * 0x0170 UNISYS NAP ADPCM * 0x0171 UNISYS NAP ULAW * 0x0172 UNISYS NAP ALAW * 0x0173 UNISYS NAP 16K * 0x0200 Creative Labs ADPCM * 0x0202 Creative Labs FastSpeech8 * 0x0203 Creative Labs FastSpeech10 * 0x0210 UHER Informatic ADPCM * 0x0215 Ulead DV ACM * 0x0216 Ulead DV ACM * 0x0220 Quarterdeck * 0x0230 I-link Worldwide ILINK VC * 0x0240 Aureal Semiconductor RAW SPORT * 0x0241 ESST AC3 * 0x0250 Interactive Products HSX * 0x0251 Interactive Products RPELP * 0x0260 Consistent Software CS2 * 0x0270 Sony ATRAC3 (SCX, same as MiniDisk LP2) * 0x0300 Fujitsu FM TOWNS SND * 0x0400 BTV Digital (Brooktree digital audio format) * 0x0401 Intel Music Coder (IMC) * 0x0402 Ligos Indeo Audio * 0x0450 QDesign Music * 0x0680 AT&T Labs VME VMPCM * 0x0681 AT&T Labs TPC * 0x0700 YMPEG Alpha (dummy for MPEG-2 compressor) * 0x08AE ClearJump LiteWave * 0x1000 Olivetti GSM * 0x1001 Olivetti ADPCM * 0x1002 Olivetti CELP * 0x1003 Olivetti SBC * 0x1004 Olivetti OPR * 0x1100 Lernout & Hauspie codec * 0x1101 Lernout & Hauspie CELP codec * 0x1102 Lernout & Hauspie SBC codec * 0x1103 Lernout & Hauspie SBC codec * 0x1104 Lernout & Hauspie SBC codec * 0x1400 Norris Communication * 0x1401 AT&T Labs ISIAudio * 0x1500 AT&T Labs Soundspace Music Compression * 0x181C VoxWare RT24 speech codec * 0x181E Lucent elemedia AX24000P Music codec * 0x1C07 Lucent SX8300P speech codec * 0x1C0C Lucent SX5363S G.723 compliant codec * 0x1F03 CUseeMe DigiTalk (ex-Rocwell) * 0x1FC4 NCT Soft ALF2CD ACM * 0x2000 Dolby AC3 / FAST Multimedia AG DVM * 0x2001 Dolby DTS (Digital Theater System) * 0x2002 RealAudio 1 / 2 14.4 * 0x2003 RealAudio 1 / 2 28.8 * 0x2004 RealAudio G2 / 8 Cook (low bitrate) * 0x2005 RealAudio 3 / 4 / 5 Music (DNET) * 0x2006 RealAudio 10 AAC (RAAC) * 0x2007 RealAudio 10 AAC+ (RACP) * 0x3313 makeAVIS (ffvfw fake AVI sound from AviSynth scripts) * 0x4143 Divio MPEG-4 AAC audio * 0x434C LEAD Speech * 0x564C LEAD Vorbis * 0x674f Ogg Vorbis (mode 1) * 0x6750 Ogg Vorbis (mode 2) * 0x6751 Ogg Vorbis (mode 3) * 0x676f Ogg Vorbis (mode 1+) * 0x6770 Ogg Vorbis (mode 2+) * 0x6771 Ogg Vorbis (mode 3+) * 0x7A21 GSM-AMR (CBR, no SID) * 0x7A22 GSM-AMR (VBR, including SID) * 0xDFAC DebugMode SonicFoundry Vegas FrameServer ACM Codec * 0xF1AC Free Lossless Audio Codec FLAC * 0xFFFE Extensible wave format * 0xFFFF In Development / Unregistered #endif } char* avm_wave_format(char* buf, size_t s, const WAVEFORMATEX* wfx) { if (buf && s > 0) { char b[200]; int c = sprintf(b, "fmt=0x%02x %uch %uHz %2ub %6uB/s balign=%u cbsz=%u", wfx->wFormatTag, wfx->nChannels, wfx->nSamplesPerSec, wfx->wBitsPerSample, wfx->nAvgBytesPerSec, wfx->nBlockAlign, wfx->cbSize); if (c >= --s) b[s] = 0; strcpy(buf, b); } return buf; } char* avm_mp3wave_format(char* buf, size_t s, const MPEGLAYER3WAVEFORMAT* wfx) { if (buf && s > 0) { const char ids[][18] = { "Unknown", "MPEG", "ConstanFrameSize" }; const char flags[][12] = { "PaddingISO", "PaddingOn", "PaddingOff" }; char b[200]; int c = sprintf(b, "ID=%d (%s) flags=%d (%s) blocksize=%d frms/blk=%d delay=%d", wfx->wID, ids[wfx->wID], wfx->fdwFlags, flags[wfx->fdwFlags], wfx->nBlockSize, wfx->nFramesPerBlock, wfx->nCodecDelay); if (c >= --s) b[s] = 0; strcpy(buf, b); } return buf; } avifile-0.7.48~20090503.ds/lib/subtitle/0000755000175000017500000000000011267637357016363 5ustar yavoryavoravifile-0.7.48~20090503.ds/lib/subtitle/subread.c0000644000175000017500000003625511177255374020162 0ustar yavoryavor#include "config.h" #include "subtitle.h" #include #include #include #include #include #include #include #include #include #ifdef HAVE_ICONV #include #include #endif static void skip_to_eol(FILE* file) { int c; while ((c = fgetc(file)) && (c == '\r' || c == '\n')) ; ungetc(c, file); } static inline char* skip_spaces(char* buf) { while (*buf && isspace((int)*buf)) buf++; return buf; } static inline char* trim_spaces(char* buf) { char* e = buf = skip_spaces(buf); // move to the end of buffer while (*e) e++; while (e > buf && isspace((int)e[-1])) e--; *e = 0; return buf; } static inline void trim_http(char* buf) { enum { NORMAL, HTTP } state = NORMAL; char* e = buf; char* d = buf; while (*e) { if (*e == '<' && (toupper(e[1]) == 'I' || e[1] == '/')) state = HTTP; else if (state == HTTP) { if (*e == '>') state = NORMAL; } else *d++ = *e; e++; } *d = 0; } static inline unsigned get_subtime(unsigned sh, unsigned sm, unsigned ss, unsigned su) { return ((sh * 60 + sm) * 60 + ss) * 1000 + su; } // read line and remove window \r character from it static char* read_line(char* buf, size_t size, FILE* file) { unsigned pos = 0; size--; while (pos < size) { int c = fgetc(file); if (c == EOF) { if (pos == 0) return 0; // no new line available EOF break; } if (c == '\n') break; // we have line if (c != '\r') buf[pos++] = (char)c; } buf[pos] = 0; return buf; } static void add_line(subtitles_t* l, subtitle_line_t* sl, char *txt) { if (sl->lines < SUBTITLE_MAX_LINES && txt) { size_t n; char* t; char* b = trim_spaces(txt); trim_http(b); // skip color and font-style change - not supported right now // {c:$00ffff} {y:i} if ((t = strchr(b, '{'))) { int u = toupper(t[1]); if ((u == 'C' || u == 'Y') && t[2] == ':' && (t = strchr(t + 3, '}'))) b = t + 1; } n = strlen(b); if (sl->lines > 0 || n > 0) { size_t sz = n + 1; char* e; #ifdef HAVE_ICONV char local[1024]; // at most this chars per line char* out_p = local; iconv_t icvsts = iconv_open("UTF-8", l->encoding); if (icvsts != (iconv_t)(-1)) { char* in_p = b; size_t in_size = n; size_t out_size = sizeof(local) - 1; if (-1 == iconv(icvsts, (ICONV_CONST_CAST char**) &in_p, &in_size, &out_p, &out_size)) { printf("subtitles: iconv convert error %s %s\n", b, strerror(errno)); } iconv_close(icvsts); //printf("SZ %d -> %d (%s)\n", (int)sz, (int)(out_p - b + 1), l->encoding); b = local; sz = (size_t)(out_p - b + 1); } else printf("subtitles: iconv open error\n"); #endif e = (char*) malloc(sz); if (e) { memcpy(e, b, sz - 1); e[sz - 1] = 0; sl->line[sl->lines++] = e; } } } else printf("Too many subtitle lines: %d ignoring: %s\n", sl->lines, txt); if (sl->end < sl->start) // some subtitles end with {XX}{0} - confusing our searcher sl->end = sl->start + 1; //printf("ADDLINE %d >%s< %d %d\n", l->lines, txt, l->start, l->end); } static void add_line_columned(subtitles_t* l, subtitle_line_t* sl, char* text) { char* s; while ((s = strchr(text, '|'))) { //printf("text %s %p\n", text, s); *s++ = 0; add_line(l, sl, text); text = s; } add_line(l, sl, text); } static void add_sub_line(subtitles_t* l, subtitle_line_t* sl) { if (l->allocated <= (l->count + 1)) { l->allocated += 200; //printf("Realloc %p %d\n", l->subtitle, sizeof(*sl) * l->allocated); l->subtitle = (subtitle_line_t*) realloc(l->subtitle, sizeof(*sl) * l->allocated); } if (l->subtitle) { if (l->count > 0) { // this trick is for weird subtitles // i.e. joined two files subtitles from 2 CDs sl->start = (unsigned int)(sl->start + l->time_diff); sl->end = (unsigned int)(sl->start + l->time_diff); if (l->subtitle[l->count - 1].end > sl->start) { //printf("TIMEDIFF %d %d s:%d e:%d\n", l->time_diff, sl->start, l->subtitle[l->count - 1].start, l->subtitle[l->count - 1].end); if (l->subtitle[l->count - 1].start < sl->start) l->subtitle[l->count - 1].end = sl->start - 1; l->time_diff = l->subtitle[l->count - 1].end - sl->start; if (l->time_diff < 1000000) { l->time_diff = 0; //return; // discard } //printf("TM %d %s\n", l->time_diff, sl->line[0]); } } memcpy(&l->subtitle[l->count], sl, sizeof(*sl)); l->count++; } } typedef enum { SAMI_START, SAMI_P, SAMI_INSIDE_P, SAMI_TEXT, SAMI_SKIP, SAMI_END } sami_state_t; /** * parse one line of SAMI subtitles * \return new state */ static sami_state_t parse_SAMI(subtitles_t* l, subtitle_line_t* sl, char* s, sami_state_t state, char* temp) { char* p = temp + strlen(temp); do { char* q; //printf("SAMI %d %s\n", state, s); switch (state) { case SAMI_START: /* find "START=" */ if ((s = strstr(s, "Start="))) { sl->start = (unsigned)strtol(s + 6, &s, 0); state = SAMI_P; continue; } break; case SAMI_P: /* find "" */ if ((s = strchr(s, '>'))) { s++; p = temp; state = SAMI_TEXT; continue; } break; case SAMI_TEXT: /* get all text until '<' appears */ if (*s == '<') state = SAMI_SKIP; else if (!strncasecmp(s, " ", 6)) { *p++ = ' '; s += 6; } else if (!strncasecmp(s, "
", 4) || *s == 0) { *p = 0; add_line(l, sl, temp); p = temp; if (*s == 0) break; s += 4; //
} else *p++ = *s++; // copy continue; case SAMI_SKIP: /* get end or skip */ q = strstr(s, "Start="); if (q) { sl->end = (unsigned)strtol(q + 6, &q, 0) - 1; *p = 0; state = SAMI_END; // finished one subtitle break; } s = strchr(s, '>'); if (s) { s++; state = SAMI_TEXT; continue; } break; case SAMI_END: assert(1 == 0); // never happens } // when we get here we need next line } while (0); *p = 0; return state; } #define IS_SUB(type) (!stype || (stype == type)) #define SHOWSUBTIME 5 /* approx. 5 seconds */ static void subtitle_reread(subtitles_t* l) { unsigned dummy, sh, sm, ss, su, eh, em, es, eu; int c = 0; int line = 0; subtitle_t stype = SUBTITLE_UNSELECTED; char bfr[1024]; fpos_t fpos; int tdiff = 0; float mpsub_position = 0; FILE* file = fdopen(l->fd, "rt"); if (!file) { perror("subtitle open:"); return; } // ORDER OF 'if's IS IMPORTANT!!!!! // this piece of code seem to be looking a bit complicated // but it is quite efficient and allows to read even subtitles // with different types in the same file :) (not very useful thought :)) while (read_line(bfr, sizeof(bfr), file)) { subtitle_line_t sl; int n = 0; memset(&sl, 0, sizeof(sl)); //printf("LINE %d %d %s\n", line, stype, bfr); // MicroDVD (.sub) if (IS_SUB(SUBTITLE_MICRODVD)) { if (sscanf(bfr, "{%d}{%d}%n", &sl.start, &sl.end, &n) == 2) { stype = SUBTITLE_MICRODVD; if (sl.end < sl.start) { if (l->fps > 0. && sl.end / l->fps > SHOWSUBTIME) sl.end = SHOWSUBTIME; sl.end = sl.start + (unsigned)(sl.end * l->fps); } add_line_columned(l, &sl, bfr + n); skip_to_eol(file); } else if (sscanf(bfr, "{%d}{}%n", &sl.start, &n) == 1) { stype = SUBTITLE_MICRODVD; sl.end = sl.start + (unsigned)(SHOWSUBTIME * l->fps); add_line_columned(l, &sl, bfr + n); skip_to_eol(file); } } // SubRipper if (IS_SUB(SUBTITLE_SUBRIP) && sscanf(bfr, "%d:%d:%d.%d,%d:%d:%d.%d", &sh, &sm, &ss, &su, &eh, &em, &es, &eu) == 8) { stype = SUBTITLE_SUBRIP; sl.start = get_subtime(sh, sm, ss, su); sl.end = get_subtime(eh, em, es, eu); // now there can be 0, 1 or 2 lines of subtitles... ended by a newline while (read_line(bfr, sizeof(bfr), file)) { // we skip whitespace and check whether the line's empty char* p = skip_spaces(bfr); char* out; if (*p == '\0') break; // this was a blank line -> end of titles here // replace [br] [BR] -> | out = p = bfr; while (*p != 0) { if (!strncasecmp(p, "[br]", 4)) { *p = 0; p += 4; add_line(l, &sl, out); out = p; } else p++; } if (out < p) add_line(l, &sl, out); } } // vplayer format if (IS_SUB(SUBTITLE_VPLAYER) && sscanf(bfr, "%d:%d:%d:%n", &sh, &sm, &ss, &n) == 3) { stype = SUBTITLE_VPLAYER; sl.start = get_subtime(sh, sm, ss, 0); sl.end = sl.start + SHOWSUBTIME * 1000; add_line_columned(l, &sl, &bfr[n]); skip_to_eol(file); } // Aqt (not sure who this is supposed to work) if (IS_SUB(SUBTITLE_AQT) && sscanf(bfr, "-->> %d", &sl.start) == 1) { int lineadded = 0; unsigned chr = 0; stype = SUBTITLE_AQT; while (read_line(bfr, sizeof(bfr), file)) { // we skip whitespace and check whether the line's empty if (lineadded) { char *p = skip_spaces(bfr); if (*p == '\0') break; // this was a blank line -> end of titles here } // line's not empty, we add as much as we can to name add_line(l, &sl, bfr); chr += (unsigned)strlen(bfr); lineadded = 1; } sl.end = sl.start + chr * 5; } // SAMI (.smi) if (IS_SUB(SUBTITLE_SAMI) && (stype || strstr(bfr, "SAMI"))) { char temp[sizeof(bfr)]; sami_state_t state = SAMI_START; stype = SUBTITLE_SAMI; for (;;) { state = parse_SAMI(l, &sl, bfr, state, temp); if (state == SAMI_END) { fsetpos(file, &fpos); // back to the begining of the current line break; } fgetpos(file, &fpos); if (!read_line(bfr, sizeof(bfr), file)) break; } if (feof(file)) break; fgetpos(file, &fpos); } // OldSubViewer (.srt) {%d:%d:%d}{%d:%d:%d} // SubViewer (.srt) if (IS_SUB(SUBTITLE_SUBVIEWER) && sscanf(bfr, "%d", &dummy) == 1) { // Skip this buffer with only one number // this should be tested as last case // as it destructs the line in buffer !!! missnl: if (read_line(bfr, sizeof(bfr), file) // sscanf(bfr, "%02d%*c%02d%*c%02d%*c%03d --> %d:%d:%d,%d", && sscanf(bfr, "%d:%d:%d,%d --> %d:%d:%d,%d", &sh, &sm, &ss, &su, &eh, &em, &es, &eu) == 8) { int lineadded = 0; stype = SUBTITLE_SUBVIEWER; sl.start = get_subtime(sh, sm, ss, su); sl.end = get_subtime(eh, em, es, eu); // now there can be 0, 1 or 2 lines of subtitles... // usually ended by a newline - but sometime this new line is missing while (read_line(bfr, sizeof(bfr), file)) { unsigned dummy1; // we skip whitespace and check whether the line's empty if (lineadded) { char* p = skip_spaces(bfr); if (*p == '\0') break; // this was a blank line -> end of titles here } // if line's not empty, we add as much as we can to name // but we check if there is not begin of the new subtitle if (sscanf(bfr, "%u", &dummy1) == 1 && ((dummy + 1) == dummy1)) { int i; //printf("DUMM %d %d\n", dummy, dummy1); dummy = dummy1; add_sub_line(l, &sl); for (i = 0; i < sl.lines; i++) sl.line[i] = NULL; // no freeing lines -just reset counter sl.lines = 0; goto missnl; } add_line(l, &sl, bfr); lineadded = 1; } } } if (IS_SUB(SUBTITLE_MPSUB) && (stype || strstr(bfr, "FORMAT=TIME") //|| (stype = SUBTIsscanf(line, "FORMAT=%d", &i) == 1) )) { float a, b; stype = SUBTITLE_MPSUB; if (sscanf(bfr, "%f %f", &a, &b) == 2) { int lineadded = 0; mpsub_position += a * 1000.f; sl.start = (unsigned)mpsub_position; mpsub_position += b * 1000.f; sl.end = (unsigned)mpsub_position; while (read_line(bfr, sizeof(bfr), file)) { // we skip whitespace and check whether the line's empty if (lineadded) { char *p = skip_spaces(bfr); if (*p == '\0') break; // this was a blank line -> end of titles here } add_line(l, &sl, bfr); lineadded = 1; } } } if (!stype) { unsigned errch = 0; unsigned i; for (i = 0; bfr[i]; i++) { if (bfr[i] < ' ' && bfr[i] != '\t') errch++; } if (errch > 10) break; // these are not ASCII subtitles //printf("ERR %d %d\n", errch, i); if (line++ > 100) break; // at most 100 unidentified lines } if (sl.lines > 0) add_sub_line(l, &sl); } fclose(file); l->type = stype; switch (stype) { case SUBTITLE_MICRODVD: /* formats which are using frames */ l->frame_based = 1; break; default: l->frame_based = 0; } } // SubRip example // // [INFORMATION] // [TITLE]Me, myself and Irene // [AUTHOR]Mysak // [SOURCE]Subtitles captured by SubRip 0.93b // [PRG] // [FILEPATH] // [DELAY]0 // [CD TRACK]0 // [COMMENT] // [END INFORMATION] // [SUBTITLE] // [COLF]&HFFFFFF,[STYLE]bd,[SIZE]18,[FONT]Arial // 00:00:01.02,00:00:07.00 // Titulky beta verze by My.. // // 00:00:07.03,00:00:10.59 // text[br]text static int test_filename_suffix(const char* filename, char** f) { const char const exts[][5] = { "", ".sub", ".SUB", ".srt", ".SRT", ".txt", ".TXT", ".aqt", ".AQT", ".smi", ".SMI", ".utf", ".UTF", /*".rt", ".RT", ".ssa", ".SSA",*/ "!" }; int fd; int i; size_t n = strlen(filename); char* fn = (char*) malloc(n + 8); if (!fn) return -1; fd = -1; for (i = 0; fd < 0 && exts[i][0] != '!'; i++) { strcpy(fn, filename); strcpy(fn + n, exts[i]); //printf("test %s %s %s\n", fn, filename, *s); fd = open(fn, O_RDONLY); } if (fd >= 0 && f) { free(*f); *f = fn; } else free(fn); return fd; } /* * create name for subtitle file */ int subtitle_filename(const char* filename, char** opened_filename) { int fd; char* fn, *fdup; unsigned long n; if (!filename) return -1; if ((fd = test_filename_suffix(filename, opened_filename)) >= 0) return fd; /* try to cut .suffix */ if (!(fdup = strrchr(filename, '.')) || strchr(fdup, '/')) return fd; n = (unsigned long)(fdup - filename); if (!(fdup = (char*) malloc(n + 1))) return -1; memcpy(fdup, filename, n); fdup[n] = 0; fd = test_filename_suffix(fdup, opened_filename); free(fdup); return fd; } subtitles_t* subtitle_open(int fd, double fps, const char* enc) { char* subname; subtitles_t* l = (subtitles_t*) malloc(sizeof(*l)); if (!l) return NULL; memset(l, 0, sizeof(*l)); l->fd = fd; l->fps = fps; if (!enc || strstr(enc, "default")) enc = nl_langinfo(CODESET); l->encoding = strdup(enc); subtitle_reread(l); return l; } avifile-0.7.48~20090503.ds/lib/subtitle/subtest.c0000644000175000017500000000332107611004543020176 0ustar yavoryavor#include "subtitle.h" #include #include #include #include static void subtitle_print(const subtitles_t* l) { if (l != NULL) { int i; printf("Subtitles: %d line(s)\n", l->count); for (i = 0; i < l->count; i++) { subtitle_line_t* sl = &l->subtitle[i]; int j; //break; printf("Start: %d End: %d (%d)\n", sl->start, sl->end, sl->lines); for (j = 0; j < sl->lines; j++) printf(" %d: >%s<\n", j, sl->line[j]); } } } int main(int argc, char **argv) { // for testing int i; subtitles_t *subs; subtitle_line_t sl; //unsigned int ar[] = { 1165, 1493, 0 }; //double ar[] = { 42.874, 47.1, 0 }; double ar[] = { 22.14, 53.1, 0 }; int fd; if (argc<2) { printf("\nUsage: subtitle filename.sub write.{sub|srt}\n\n"); exit(1); } fd = open(argv[1], O_RDONLY); if (fd < 0) { fprintf(stderr, "can't open: %s\n", argv[1]); exit(1); } subs = subtitle_open(fd, 23.976, NULL); if (!subs) { printf("Couldn't load file: %s\n", argv[1]); exit(1); } subtitle_print(subs); #if 0 for (i = 0; ar[i]; i++) { if (subtitle_get(&sl, subs, ar[i])) { int j; printf("%f: Start: %d End: %d\n", ar[i], sl.start, sl.end); for (j = 0; j < sl.lines; j++) printf(" %d: %s\n", j, sl.line[j]); } else printf("Not found: %f\n", ar[i]); } #endif if (argc >= 2) { subs->fps = 23.976; subtitle_write(subs, argv[2], SUBTITLE_MICRODVD); } subtitle_close(subs); //printf ("Subtitle format %s time.\n", sub_uses_time?"uses":"doesn't use"); //printf ("Read %i subtitles, %i errors.\n", sub_num, sub_errs); return 0; } avifile-0.7.48~20090503.ds/lib/subtitle/subtitle.c0000644000175000017500000000637511176341370020357 0ustar yavoryavor#include "subtitle.h" #include #include #include static subtitle_line_t* copy_line(subtitle_line_t* to, const subtitle_line_t* from) { int i; if (to) { for (i = 0; i < SUBTITLE_MAX_LINES; i++) { if (from->line[i] && i < from->lines) { size_t l = strlen(from->line[i]); to->line[i] = (char*) realloc(to->line[i], l + 1); if (to->line[i]) strcpy(to->line[i], from->line[i]); } else if (to->line[i]) { free(to->line[i]); to->line[i] = NULL; } } to->start = from->start; to->end = from->end; to->lines = from->lines; } return to; } static void free_line(subtitle_line_t* sl) { int i; for (i = 0; i < sl->lines; i++) { free(sl->line[i]); sl->line[i] = NULL; } sl->start = 0; sl->end = 0; sl->lines = 0; } void subtitle_close(subtitles_t* st) { if (st->subtitle) { int i; for (i = 0; i < st->count; i++) { int j; for (j = 0; j < SUBTITLE_MAX_LINES; j++) { if (st->subtitle[i].line[j]) free(st->subtitle[i].line[j]); } } free(st->subtitle); } if (st->encoding) free(st->encoding); free(st); } int subtitle_get(subtitle_line_t* sl, subtitles_t* st, double timepos) { unsigned int lo = 0; unsigned int hi; unsigned int fp = (unsigned int) (timepos * 1000.0); subtitle_line_t* line = NULL; if (st->count > 1) { hi = st->count - 1; if (st->frame_based && st->fps > 0.0) fp = (unsigned int) (timepos * st->fps); //printf("get: %f -> %d %f\n", timepos, fp, st->fps); while (lo < hi) { unsigned int m = lo + (hi - lo) / 2; if (fp < st->subtitle[m].start) hi = m; else if (fp >= st->subtitle[m + 1].start) lo = m + 1; else { lo = m; break; } } if (st->subtitle[lo].start <= fp && fp < st->subtitle[lo].end) line = &st->subtitle[lo]; } //printf("pos %d %p %d %d %d\n", lo, line, fp, st->subtitle[lo].start, st->subtitle[lo].end); if (line) { if (!subtitle_line_equals(sl, line)) copy_line(sl, line); } else free_line(sl); return (!line) ? -1 : 0 ; } unsigned int subtitle_get_lines(subtitles_t* st) { return st->count; } subtitle_t subtitle_get_type(subtitles_t* st, const char** r) { const char t[][11] = { "unknown", "microdvd", "subrip", "vplayer", "aqt", "sami", "subviewer", "mpsub" }; if (r && st->type < SUBTITLE_LAST) *r = t[st->type]; return st->type; } subtitle_line_t* subtitle_line_new() { subtitle_line_t* nl; nl = (subtitle_line_t*) malloc(sizeof(*nl)); if (nl != NULL) memset(nl, 0, sizeof(*nl)); return nl; } subtitle_line_t* subtitle_line_copy(const subtitle_line_t* sl) { return (!sl) ? NULL : copy_line(subtitle_line_new(), sl); } int subtitle_line_equals(const subtitle_line_t* l1, const subtitle_line_t* l2) { /* * for now we assume we have just one subtitle with the same time * and the line count */ return (l1 != NULL && l2 != NULL && l1->lines == l2->lines && l1->start == l2->start && l1->end == l2->end); } void subtitle_line_free(subtitle_line_t* sl) { if (sl != NULL) { free_line(sl); free(sl); } } void subtitle_set_fps(subtitles_t* st, double fps) { st->fps = fps; } avifile-0.7.48~20090503.ds/lib/subtitle/subwrite.c0000644000175000017500000000316211106633036020353 0ustar yavoryavor#include "subtitle.h" #include #include #include #include #include int subtitle_write(const subtitles_t* st, const char* filename, subtitle_t type) { const char* nl = "\r\n"; FILE* file = fopen(filename, "wt"); if (!file) return -1; if (st->subtitle) { unsigned int i; for (i = 0; i < st->count; ++i) { unsigned int t1 = st->subtitle[i].start; unsigned int t2 = st->subtitle[i].end; unsigned int hh1 = (t1/60/60/1000); unsigned int mm1 = (t1/60/1000)%60; unsigned int ss1 = (t1/1000)%60; unsigned int ms1 = (t1)%1000; unsigned int hh2 = (t2/60/60/1000); unsigned int mm2 = (t2/60/1000)%60; unsigned int ss2 = (t2/1000)%60; unsigned int ms2 = (t2)%1000; int tmp = 0; int j; switch (type) { case SUBTITLE_SUBRIP: fprintf(file, "%d%s%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d%s", i + 1, nl, hh1, mm1, ss1, ms1, hh2, mm2, ss2, ms2, nl); for (j = 0; j < SUBTITLE_MAX_LINES; j++) if (st->subtitle[i].line[j]) fprintf(file, "%s%s", st->subtitle[i].line[j], nl); fputs(nl, file); /* extra new line */ break; case SUBTITLE_MICRODVD: fprintf(file, "{%d}{%d}", (int)(t1 * st->fps / 1000. + 0.5), (int)(t2 * st->fps / 1000. + 0.5)); for (j = 0; j < SUBTITLE_MAX_LINES; j++) { if (st->subtitle[i].line[j]) { if (tmp) fputc('|', file); fprintf(file, "%s", st->subtitle[i].line[j]); tmp++; } } fputs(nl, file); break; default: return -1; } } } return 0; } avifile-0.7.48~20090503.ds/lib/video/0000755000175000017500000000000011267637362015632 5ustar yavoryavoravifile-0.7.48~20090503.ds/lib/video/VideoDPMS.cpp0000644000175000017500000000432207547603650020070 0ustar yavoryavor#include "VideoDPMS.h" #include "avm_output.h" #ifdef HAVE_DPMS #include #include #include #include #endif #ifdef HAVE_OK_DPMS_H extern "C" { #include } //#include #ifndef sun // on linux its just int #undef CARD32 #define CARD32 int #endif // sun #else // !HAVE_OK_DPMS_H #ifndef sun #undef CARD32 #define CARD32 int #endif // sun /* there are several prototypes missing on solaris 8: */ #ifdef HAVE_DPMS extern "C" { Bool DPMSQueryExtension(Display*, CARD32*, CARD32*); Status DPMSEnable(Display*); Status DPMSDisable(Display*); Status DPMSInfo(Display*, CARD16*, BOOL*); } #endif #endif // !HAVE_OK_DPMS_H AVM_BEGIN_NAMESPACE; // copy from mplayer // FIXME - create class and add it as a member later.. // with construtor Off destructor On VideoDPMS::VideoDPMS(Display *dpy) :m_pDisplay(dpy), m_bDisabled(false) { #ifdef HAVE_DPMS int interval, prefer_blank, allow_exp; CARD32 nothing; if (DPMSQueryExtension(m_pDisplay, ¬hing, ¬hing)) { BOOL onoff; CARD16 state; DPMSInfo(m_pDisplay, &state, &onoff); if (onoff) { AVM_WRITE("DPMS module", "Disabling DPMS\n"); m_bDisabled = true; DPMSDisable(m_pDisplay); // monitor powersave off } } XGetScreenSaver(m_pDisplay, &m_iTimeoutSave, &interval, &prefer_blank, &allow_exp); if (m_iTimeoutSave) // turning off screensaver XSetScreenSaver(m_pDisplay, 0, interval, prefer_blank, allow_exp); #else AVM_WRITE("DPMS module", "DPMS suppport not compiled\n"); #endif } VideoDPMS::~VideoDPMS() { #ifdef HAVE_DPMS CARD32 nothing; if (m_bDisabled) { if (DPMSQueryExtension(m_pDisplay, ¬hing, ¬hing)) { AVM_WRITE("DPMS module", "Enabling DPMS\n"); DPMSEnable(m_pDisplay); // restoring power saving settings DPMSQueryExtension(m_pDisplay, ¬hing, ¬hing); } } if (m_iTimeoutSave) { int dummy, interval, prefer_blank, allow_exp; XGetScreenSaver(m_pDisplay, &dummy, &interval, &prefer_blank, &allow_exp); XSetScreenSaver(m_pDisplay, m_iTimeoutSave, interval, prefer_blank, allow_exp); XGetScreenSaver(m_pDisplay, &m_iTimeoutSave, &interval, &prefer_blank, &allow_exp); } #endif } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/lib/video/oldrenderer.cpp0000644000175000017500000010152107521265074020636 0ustar yavoryavor/******************************************************** * * Video renderers * Copyright 2000 Eugene Kuznetsov (divx@euro.ru) * ********************************************************/ #include "default.h" #if 0 // do not compile #include "fourcc.h" #include "Locker.h" #include "except.h" #include "renderer.h" #include "playerwidget.h" #include "cpuinfo.h" #include "utils.h" #include "mmx.h" #include #include #include #include #include #ifndef X_DISPLAY_MISSING #if defined(__FreeBSD__) || defined(__NetBSD__) #include #include #endif #include #include #include #include #include #include #include //XGetExtensionVersion #include #ifdef HAVE_LIBXV #include #include #endif #ifdef HAVE_LIBXXF86DGA #include #endif #ifdef HAVE_LIBXXF86VM #include #endif #ifdef HAVE_LIBXFT #include //#include #endif #include /* #ifdef USE_QT #include #include #endif */ #ifdef USE_SDL /* #ifdef USE_OPENGL #include #include #include #endif */ #include #include #include #include #ifndef SDL_DISABLE #define SDL_DISABLE 0 #endif #ifndef SDL_ENABLE #define SDL_ENABLE 1 #endif #endif #include #include #include #include #include using namespace std; /*fold00*/ /* inline static void qSafeXDestroyImage( XImage *x ) { if ( x->data ) { free( x->data ); x->data = 0; } XDestroyImage( x ); } class ShmRenderer : public VideoRenderer { bool xshminit; XShmSegmentInfo xshminfo; XImage *xshmimg; Pixmap xshmpm; GC gc; pthread_mutex_t mutex; int xpos; int screen; public: ShmRenderer() : xshminit(0), xshmimg(0), xshmpm(0) { pthread_mutex_init(&mutex, 0); } void Alloc() { static int major, minor; static Bool pixmaps_ok; // int dd = dev->x11Depth(); // dpy = dev->x11Display(); // vis = (Visual*)dev->x11Visual(); printf("Creating SHM renderer, width %d, height %d\n", pic_w, pic_h); printf("Server vendor %s, release %d\n", ServerVendor(_dpy), VendorRelease(_dpy)); try { XGCValues xcg; xcg.graphics_exposures=false; gc=XCreateGC(_dpy, _vis, GCGraphicsExposures, &xcg); if ( !XShmQueryVersion(_dpy, &major, &minor, &pixmaps_ok) ) throw FATAL("MIT SHM extension not supported"); bool ok; int _pic_w=((pic_w+m_w-1)/m_w)*m_w; int _pic_h=((pic_h+m_h-1)/m_h)*m_h; xshminfo.shmid = shmget( IPC_PRIVATE, _pic_w*_pic_h*4, IPC_CREAT | 0777 ); ok = xshminfo.shmid != -1; if(!ok) throw FATAL("Can't get shared memory segment"); xshminfo.shmaddr = (char*)shmat( xshminfo.shmid, 0, 0 ); ok = xshminfo.shmaddr != 0; xshminfo.readOnly = FALSE; if ( !ok ) throw FATAL("Can't attach shared memory segment"); ok = XShmAttach( _dpy, &xshminfo ); if ( !ok ) throw FATAL("XShmAttach failed"); int dd=DefaultDepth(_dpy, DefaultScreen(dpy)); xshmimg = XShmCreateImage( _dpy, _vis, dd, ZPixmap, xshminfo.shmaddr, &xshminfo, _pic_w, _pic_h ); if ( !xshmimg ) throw FATAL("Can't create shared image"); printf("Video device: %d bpp ( physical %d ), color masks %X,%X,%X\n", dd, GetPhysicalDepth(_dpy), _vis->red_mask, _vis->green_mask, _vis->blue_mask); } catch(...) { xshmimg = 0; if ( xshminfo.shmaddr ) shmdt( xshminfo.shmaddr ); if ( xshminfo.shmid != -1 ) shmctl( xshminfo.shmid, IPC_RMID, 0 ); throw; } } int Create(Display *_dpy, Visual *_vis, int x, int y, int _xpos=0, int sub=0) { dpy=_dpy; vis=_vis; m_w=x; m_h=y; pic_w=x; pic_h=y; width=x; height=y; xpos=_xpos; Alloc(); } int Free() { cerr<<"Free()"<data = 0; qSafeXDestroyImage( xshmimg ); xshmimg = 0; shmdt( xshminfo.shmaddr ); shmctl( xshminfo.shmid, IPC_RMID, 0 ); XFreeGC(_dpy, gc); xshminfo.shmaddr=0; xshminfo.shmid=0; } int Resize(int& new_w, int& new_h) { if(new_w<0)return -1; if(new_h<0)return -1; new_w&=(~7); new_h&=(~7); int xratio=(new_w+m_w-1)/m_w; int yratio=(new_h+m_h-1)/m_h; int old_xratio=(pic_w+m_w-1)/m_w; int old_yratio=(pic_h+m_h-1)/m_h; cerr<<"New size: "<data; if(outpic==0) return 0; if(data==0) return 0; int bit_depth=GetPhysicalDepth(_dpy); if(pthread_mutex_trylock(&mutex)==EBUSY) return -1; // pthread_mutex_lock(&mutex); sync(); const char* src; if((pic_h==m_h) && (pic_w==m_w)) memcpy(outpic, data->data(), data->bytes()); else zoom((short*)outpic, (short*)data->data(), pic_w, pic_h, m_w, m_h, bit_depth, m_w*((pic_w+m_w-1)/m_w)); XShmPutImage(_dpy, _vis, gc, xshmimg, 0, 0, xpos, 0, pic_w, pic_h, true); pthread_mutex_unlock(&mutex); return 0; } virtual int sync() { XSync(_dpy, false); return 0; } virtual ~ShmRenderer() { Free(); pthread_mutex_destroy(&mutex); } virtual int toggle_fullscreen(bool=false); virtual int drawSubtitles(const char*); }; int ShmRenderer::ToggleFullscreen(bool maximize=false) { return 0; } int ShmRenderer::DrawSubtitles(const char* sub) { return 0; } VideoRenderer* CreateRenderer() { return new ShmRenderer; } */ /*FOLD00*/ #if 0 /*FOLD00*/ #ifdef HAVE_LIBXV class XvYUVRenderer : public VideoRendererWithLock { Display* dpy; Window win; #ifdef I18N XFontSet font; #else XFontStruct* font; #endif int screen; XShmSegmentInfo xshminfo[2]; XvImage* xvimage[2]; uint_t xv_format; uint_t xv_port; const char* title; GC gc; Pixmap xshmpm; XSizeHints hint; XVisualInfo vinfo; XEvent xev; XWindowAttributes attribs; public: XvYUVRenderer(PlayerWidget* pw, Display* _dpy, int width, int height, unsigned long format, bool subtitle = false) : VideoRendererWithLock(width, height, subtitle), dpy(_dpy), font(0), xv_format(0), xv_port(0), xshmpm(0) { //g_pw=pw; cout << XInitThreads() << endl; title = "Xv rulez"; screen = DefaultScreen(dpy); hint.x = 0; hint.y = 0; hint.width = m_w; hint.height = m_h; hint.flags = /*PPosition | */PSize; XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs); int depth = GetPhysicalDepth(dpy); XMatchVisualInfo(dpy, screen, depth, TrueColor, &vinfo); Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, screen), vinfo.visual, AllocNone); XSetWindowAttributes xswa; unsigned long xswamask; xswa.background_pixel = 0; xswa.border_pixel = 1; xswa.colormap = cmap; xswamask = CWBackPixel | CWBorderPixel |CWColormap; XLockDisplay(dpy); win = XCreateWindow(dpy, RootWindow(dpy, screen), hint.x, hint.y, hint.width, hint.height, 4, depth, CopyFromParent, vinfo.visual, xswamask, &xswa); XSelectInput(dpy, win, StructureNotifyMask); XSetStandardProperties(dpy, win, title, title, None, NULL, 0, &hint); //if ( fullscreen ) vo_x11_decoration( mydisplay,mywindow,0 ); /* Map window. */ XMapWindow(dpy, win); /* Wait for map. */ do { XNextEvent(dpy, &xev); //cout << "T: " << xev.xany.type << " w: " << xev.xany.window << endl; } while (xev.type != MapNotify || xev.xmap.event != win); XSelectInput(dpy, win, NoEventMask); XFlush(dpy); XSync(dpy, False); uint_t ver,rel,req,ev,err; if (Success != XvQueryExtension(dpy, &ver,&rel,&req,&ev,&err)) throw FATAL("Xv: XvQueryExtension failed"); /* check for Xvideo support */ uint_t adaptors; XvAdaptorInfo *ai; if (Success != XvQueryAdaptors(dpy, DefaultRootWindow(dpy), &adaptors,&ai)) throw FATAL("Xv: XvQueryAdaptors failed"); /* check adaptors */ for (unsigned i = 0; i < adaptors; i++) { if (!xv_port && (ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) xv_port = ai[i].base_id; } XvFreeAdaptorInfo(ai); /* check image formats */ if (!xv_port) throw FATAL("Xv: XvQueryAdaptors no port"); uint_t formats; XvImageFormatValues* fo = XvListImageFormats(dpy, xv_port, (int*)&formats); for(unsigned i = 0; i < formats; i++) { fprintf(stderr, "Xvideo image format: 0x%x (%4.4s) %s\n", fo[i].id, (char*)&fo[i].id, (fo[i].format == XvPacked) ? "packed" : "planar"); if (fo[i].id == (signed) format) xv_format = fo[i].id; } if (!xv_format) /* no matching image format not */ throw FATAL("Xv: XvQueryAdaptors no port"); fprintf(stderr,"using Xvideo port %d for hw scaling\n", xv_port); //allocate_xvimage(0); /* catch window resizes */ XSelectInput(dpy, win, EnterWindowMask | LeaveWindowMask | PointerMotionMask | StructureNotifyMask | KeyPressMask); //XSelectInput(mydisplay, mywindow, StructureNotifyMask); // resize: XMoveResizeWindow(dpy, win, 0, 0, m_w, m_h); XUnlockDisplay(dpy); Alloc(); } virtual ~XvYUVRenderer() { cout <<"XvYUV: Destroy" << endl; Lock(); Free(); } void Alloc() { printf("Creating Xv renderer, width %d, height %d\n", pic_w, pic_h); printf("Server vendor %s, release %d\n", ServerVendor(dpy), VendorRelease(dpy)); try { bool ok = true; int width=((pic_w+m_w-1)/m_w)*m_w; int height=((pic_h+m_h-1)/m_h)*m_h; if (! ok) throw FATAL("XShmAttach failed"); XGCValues xgcv; xgcv.graphics_exposures = false; XLockDisplay(dpy); gc = XCreateGC(dpy, win, 0L, &xgcv); //int dd = DefaultDepth(dpy, DefaultScreen(dpy)); xvimage[0] = XvShmCreateImage(dpy, xv_port, xv_format, 0, width, height, &xshminfo[0]); if (! xvimage[0]) throw FATAL("Can't create shared image"); xshminfo[0].shmid = shmget(IPC_PRIVATE, xvimage[0]->data_size, IPC_CREAT | 0777); xshminfo[0].shmaddr = (char *) shmat(xshminfo[0].shmid, 0, 0); xshminfo[0].readOnly = False; xvimage[0]->data = xshminfo[0].shmaddr; XShmAttach(dpy, &xshminfo[0]); XSync(dpy, False); XUnlockDisplay(dpy); shmctl(xshminfo[0].shmid, IPC_RMID, 0); /* so we can do grayscale while testing... */ memset(xvimage[0]->data, 128, xvimage[0]->data_size); //printf("Video device: %d bpp ( physical %d ), color masks %lX,%lX,%lX\n", // dd, GetPhysicalDepth(dpy), // vis->red_mask, vis->green_mask, vis->blue_mask); //Alloc(); } catch(...) { throw; } } int Free() { //cout <<"XvYUV: Free()" << endl; if (xvimage[0] == 0) return 0; XLockDisplay(dpy); XFreeGC(dpy, gc); XSync(dpy, False); XShmDetach(dpy, &xshminfo[0]); XUnlockDisplay(dpy); XFree(xvimage[0]); xvimage[0] = 0; shmdt( xshminfo[0].shmaddr ); shmctl( xshminfo[0].shmid, IPC_RMID, 0 ); return 0; } int Resize(int& new_w, int& new_h) { if (new_w < 0 || new_h < 0) return -1; new_w&=(~7); new_h&=(~7); int xratio=(new_w+m_w-1)/m_w; int yratio=(new_h+m_h-1)/m_h; int old_xratio=(pic_w+m_w-1)/m_w; int old_yratio=(pic_h+m_h-1)/m_h; cerr<<"New size: "<data; if (outpic==0 || data==0) return 0; //int bit_depth=GetPhysicalDepth(dpy); if (TryLock()==EBUSY) return -1; memcpy(outpic, data->Data(), data->Bytes()); //cout << "b " << data->bytes(); XLockDisplay(dpy); XvShmPutImage(dpy, xv_port, win, gc, xvimage[0], 0, 0, m_w, m_h, 0, 0, pic_w, pic_h, True); XFlush(dpy); XUnlockDisplay(dpy); Unlock(); return 0; int ret=0; XEvent xevent; char buf[100]; KeySym keySym; XComposeStatus cstat; ///XNextEvent( dpy, &xevent ); cout << "T: " << xevent.xany.type << " w: " << xevent.xany.window << endl; //cout << XPending( dpy ) << endl; //while ( NonblockXPending( dpy ) ) while ( XPending( dpy ) ) { cout << "event " << endl; XNextEvent( dpy, &xevent ); switch( xevent.type ) { case EnterNotify: cout << "Enter" << endl; break; case LeaveNotify: cout << "Enter" << endl; break; case Expose: //ret|=VO_EVENT_EXPOSE; break; case ConfigureNotify: { int width=xevent.xconfigure.width; int height=xevent.xconfigure.height; //ret|=VO_EVENT_RESIZE; cout << "Resize " << width << " " << height << endl; } break; case KeyPress: XLookupString( &xevent.xkey,buf,sizeof(buf),&keySym,&cstat ); //vo_x11_putkey( ( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ) ); //ret|=VO_EVENT_KEYPRESS; break; } } return 0; } virtual int Sync() { //XFlush(dpy); return 0; } virtual int ToggleFullscreen(bool=false) { return 0; } virtual int DrawSubtitles(const char*) { return 0; } int Refresh() { return 0; } }; VideoRenderer* CreateXvYUVRenderer(PlayerWidget* pw, Display* dpy, int width, int height, fourcc_t yuv_fmt, bool sub) { return new XvYUVRenderer(pw, dpy, width, height, yuv_fmt, sub); } #endif /* HAVE_LIBXV */ /*FOLD00*/ #endif /* #ifdef USE_OPENGL struct texts { int w; int h; int u_w; int u_h; GLuint *texture; int quad_1; int quad_2; int quad_3; int quad_4; }; class GLFullscreenRenderer: public VideoRenderer { SDL_Surface *screen; int dim_w, dim_h; int fs; int m_sub; int zoom_divider; int dirty; Window wnd; pthread_mutex_t mutex; struct texts *textures; GLuint *textureids; GLubyte* pixels; int textcount_w; int textcount_h; int max_texture_size; public: GLFullscreenRenderer():screen(0){} virtual int Create(QWidget* w, int width, int height, int xpos=0, int subtitles=0) { fs=SDL_RESIZABLE | SDL_OPENGL; char SDL_windowhack[256]; dev=w; Display *dpy = dev->x11Display(); ::dpy=dpy; unsigned long mask; int glxMajorVersion, glxMinorVersion; if(SDL_Init(SDL_INIT_VIDEO ) <0) throw FATAL("Failed to init SDL"); m_w=width; m_h=height; width=1024; height=768; pic_w=width; pic_h=height; m_sub=subtitles; dirty=0; dim_w=pic_w; dim_h=pic_h+(subtitles?80:0); pthread_mutex_init(&mutex, 0); // screen = SDL_SetVideoMode(1024, 768, 0, SDL_OPENGL); | SDL_INIT_EVENTTHREAD screen=SDL_SetVideoMode(dim_w, dim_h, GetPhysicalDepth(dev), fs); if(screen ) { // SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE); // SDL_SetEventFilter(EventFilter); valid_filter=1; SDL_WM_SetCaption("Movie window", 0); SDL_SysWMinfo info; SDL_VERSION(&info.version); SDL_GetWMInfo(&info); Display *dpy=dev->x11Display(); GLint maxsize=0; GLboolean b= false; SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); cerr<<"Texturemaxsize="<0) { cerr<<"Fatal Error : can't create Textures"<w = text_size_w; // width and height of texture (textures+i)->h = text_size_h; cerr<<"Texturesize("<u_w = skip_w; // Pixels zu skip in row (textures+i)->u_h = skip_h; // Rows to skip (textures+i)->texture = (textureids+i); (textures+i)->quad_1 = skip_w; // is the vortex of the texture, so we can (textures+i)->quad_2 = skip_h; // draw faster (later) (textures+i)->quad_3 = (textures+i)->quad_1 + (textures+i)->w; (textures+i)->quad_4 = (textures+i)->quad_2 + (textures+i)->h; skip_w +=text_size_w; glBindTexture( GL_TEXTURE_2D, (GLuint) (textures+i)->texture); glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); //GL_DECAL glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, (textures+i)->w, (textures+i)->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels ); int error = glGetError( ); if (error) return error; i++; } skip_h +=text_size_h; } // Simple state setup at the end. glClearColor( 0.0, 0.0, 0.0, 0.0 ); return glGetError( ); } int getPowerOf2(int value) { int i,e; for(i=1;((i<=value) && (i<=max_texture_size)) ; i*=2) e=i; return e; } int Resize(int& new_w, int& new_h) { if(new_w<0)return -1; if(new_h<0)return -1; if(new_hData(), data->Bytes()); for (int i=0;iBytes();i+=3) { GLubyte tmp; tmp = *(pixels+i); *(pixels+i)=* (pixels+i+2); *(pixels+i+2)=tmp; } // load picture in textures and draw them for(int i=0; i<(textcount_w*textcount_h); i++) { glBindTexture( GL_TEXTURE_2D, (GLuint)(textures+i)->texture); glPixelStorei( GL_UNPACK_SKIP_PIXELS, (textures+i)->u_w ); glPixelStorei( GL_UNPACK_SKIP_ROWS, (textures+i)->u_h ); glPixelStorei( GL_UNPACK_ROW_LENGTH, m_w ); glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, (textures+i)->w, (textures+i)->h, GL_RGB, GL_UNSIGNED_BYTE, pixels ); glBegin( GL_QUADS ); glTexCoord2f( 0.0, 0.0 ); glVertex2i((textures+i)->quad_1, (textures+i)->quad_2); glTexCoord2f( 0.0, 1.0 ); glVertex2i( (textures+i)->quad_1, (textures+i)->quad_4); glTexCoord2f( 1.0, 1.0 ); glVertex2i( (textures+i)->quad_3, (textures+i)->quad_4 ); glTexCoord2f( 1.0, 0.0 ); glVertex2i((textures+i)->quad_3, (textures+i)->quad_2 ); glEnd( ); int error = glGetError( ); if (error) cerr<<"Drawerror :"<x11Display(), dev->x11Screen(), &unused, &mode) ) { w = mode.hdisplay; h = mode.vdisplay-(m_sub?fm_height*4:0); ratio_x=double(w)/pic_w; ratio_y=double(h)/pic_h; double ratio=(ratio_xx11Display(); gcv.graphics_exposures = False; win=info.info.x11.window; if(old_text && (!strcmp(text, old_text))) return 0; QFont font=RegAccess::ReadFont(); GC gc=XCreateGC(dpy, win, GCGraphicsExposures, &gcv); #ifndef I18N XSetFont(dpy, gc, font.handle()); #endif XSetForeground(dpy, gc, 0x0); if(old_text && strcmp(text, old_text)) XFillRectangle(dpy, win, gc, 0, dim_h-80, dim_w, 80); XSetForeground(dpy, gc, 0xFFFFFFFF); if(old_text)delete old_text; old_text=new char[strlen(text)+1]; strcpy(old_text, text); char* sub=new char[strlen(text)+1]; char* sub_orig=sub; strcpy(sub, text); char* run=sub; int line=0; while(*run!=0) { run=strchr(run, '|'); if(run)*run=0; // XDrawString16(dpy, win, gc, // dim_w/2-6*strlen(sub)/2, dim_h-65+20*line, // (XChar2b*)(short*)QString::fromLocal8Bit(sub).unicode(), strlen(sub)); XDrawString(dpy, win, gc, dim_w/2-6*strlen(sub)/2, dim_h-65+20*line, sub, strlen(sub)); if(run==0)break; line++; run++; sub=run; } delete sub_orig; XFreeGC(dpy, gc); return 0; } }; VideoRenderer* CreateGLFullscreenRenderer() { return new GLFullscreenRenderer; } #endif //USE_OPENGL */ #ifdef HAVE_LIBXXF86DGA #ifdef HAVE_LIBXXF86VM /******************************************************** DGA video renderer Copyright 2000 Heinrich Langos *********************************************************/ /* #define INT32 __my_int32 #define INT8 __my_int8 // damn qglobal.h defines INT32 and INT8 without saying anything about signs // thanx to roots__ from #c for helping me out with this. //#include "mmx_dga.cpp" #include #include #include #include #define VIDMODE_SWITCHING_DELAY 100 #include #include class DGARenderer: public VideoRenderer // vm_* videomode variables // vp_* vievport variables { Display *dpy; int ppl; //pixel per line (scan line, not frame line !! ) char* base; //frame buffer base address int zoom_divider; int vm_count; //number of available videomodes XF86VidModeModeInfo **vm_modelines; // the modes themself bool vm_switched; //only used to decide if we have to switch back on quit int vp_width,vp_height; // the viewport size int vp_flip_offset; // memory offset to the next frame in framebuffer int vp_current; // currently used viewport (0..vp_frames-1) const static int vp_frames=2; // the number of viewports that we use. int bit_depth,byte_depth; //self explaining ... char *conversionbuf; // only used if we dont render directly into the framebuffer void set_vidmode(int nr) { printf("switching video mode to %dx%d/%d now\n", vm_modelines[nr]->hdisplay, vm_modelines[nr]->vdisplay, vm_modelines[nr]->dotclock); // XF86VidModeSwitchToMode(dpy,XDefaultScreen(dpy),vm_modelines[nr]); avm_usleep(VIDMODE_SWITCHING_DELAY*1000); } public: DGARenderer() {} int toggle_fullscreen() {} virtual int Create(QWidget* w, int x, int y, int zoom=1, int xpos=0, int sub=0) { zoom_divider=zoom; if(zoom!=1 && zoom!=2)throw FATAL("Unsupported zoom factor"); vp_current=0; dev=(QPaintDevice*)w; dpy = dev->x11Display(); m_w=x; m_h=y; width=x; height=y; Visual *vis = (Visual*)dev->x11Visual(); bool have_dga=false; int minor, major, bank, ram, flags; int i,bestmatch, diff_x=99999, diff_y=99999; XF86VidModeGetAllModeLines(dpy,XDefaultScreen(dpy), &vm_count,&vm_modelines); for (i = 0; i < vm_count; i++) { if ((width/zoom_divider <= vm_modelines[i]->hdisplay) && (height/zoom_divider <= vm_modelines[i]->vdisplay)) if ( ( (vm_modelines[i]->hdisplay - width/zoom_divider) <= diff_x) && ( (vm_modelines[i]->vdisplay - height/zoom_divider) <= diff_y) ) { bestmatch=i; diff_x =vm_modelines[i]->hdisplay - width/zoom_divider ; diff_y =vm_modelines[i]->vdisplay - height/zoom_divider ; } } i=bestmatch; if (i != 0 && i != vm_count) { set_vidmode(i); vm_switched = 1; vp_width = vm_modelines[i]->hdisplay; vp_height = vm_modelines[i]->vdisplay; } else { vm_switched = 0; vp_width = vm_modelines[0]->hdisplay; vp_height = vm_modelines[0]->vdisplay; } // XWarpPointer(dpy, None, RootWindow(dpy, DefaultScreen(dpy)), // 0, 0, 0, 0, 0,0); XF86VidModeSetViewPort(dpy,XDefaultScreen(dpy),0,0); if(XF86DGAQueryExtension(dpy, &major, &minor)) { XF86DGAQueryDirectVideo(dpy, XDefaultScreen(dpy), &flags); if(flags & XF86DGADirectPresent) { have_dga=true; XF86DGAGetVideo(dpy, DefaultScreen(dpy), &base, &ppl, &bank, &ram); if(!base) return -1; // This is quoted from xmms-1.0.1 dga.c // The things we must go through to get a proper depth... // If I find the idiot that thought making 32bit report 24bit // was a good idea, there may be one less `programmer' in this // world... { XImage *img; img = XGetImage(dpy, RootWindow(dpy, DefaultScreen(dpy)), 0, 0, 1, 1, AllPlanes, ZPixmap); bit_depth = img->bits_per_pixel; XDestroyImage(img); } byte_depth = (bit_depth+7)/8; // end quote :-) XF86DGAGetViewPortSize(dpy, DefaultScreen(dpy), &vp_width, &vp_height); } } if(have_dga) { // printf("DGA: base:%x , ppl:%d, bank:%d, ram:%d \n",base, ppl, bank, ram ); // flip_offset=ppl*vp_height*byte_depth; vp_flip_offset=vp_height*ppl*byte_depth; XF86DGADirectVideo(dpy, DefaultScreen(dpy), XF86DGADirectGraphics); // XF86DGADirectMouse| // XF86DGADirectKeyb); XF86DGASetViewPort(dpy, DefaultScreen(dpy), 0, 0); // h}%@h}% zero=0; for (int v=0;v0; y--) // { // memcpy(conversionbuf, data, bpl); // data+=bpl; // conversionbuf-=bpl; // } for(int i=0; iat(i), data->bpl()); return 0; }; virtual int sync() { Display *dpy = dev->x11Display(); XSync(dpy, false); return 0; }; virtual ~DGARenderer(){ Display *dpy = dev->x11Display(); if (vm_switched) set_vidmode(0); XF86DGASetViewPort(dpy, DefaultScreen(dpy), 0, 0); XF86DGADirectVideo(dpy, DefaultScreen(dpy), 0); // free(conversionbuf); } virtual int drawSubtitles(const char*) { return 0; } }; VideoRenderer* CreateDGARenderer() { h}%@h}%@rn new DGARenderer; } */ #endif /*HAVE_LIBXXF86VM*/ #endif /*HAVE_LIBXXF86DGA*/ #endif /*X_DISPLAY_MISSING*/ /* vim: tabstop=8 */ #endif // do not compile avifile-0.7.48~20090503.ds/lib/video/renderer.cpp0000644000175000017500000023466611176341513020152 0ustar yavoryavor/******************************************************** * * Video renderers * Copyright 2000 Eugene Kuznetsov (divx@euro.ru) * ********************************************************/ #include "rendlock.h" #include "subrend.h" #include "avm_fourcc.h" #include "mmx.h" #include "avm_output.h" #define DECLARE_REGISTRY_SHORTCUT #include "configfile.h" #undef DECLARE_REGISTRY_SHORTCUT #include #include #include #include #include #include #include bool avm::IVideoRenderer::allow_sw_yuv = true;//false; #ifndef X_DISPLAY_MISSING #include #include #include #include #include #include #include //XGetExtensionVersion #include //#ifdef HAVE_LIBXXF86DGA //#include //#endif #ifdef HAVE_LIBXXF86VM #include #endif //#undef HAVE_LIBXFT #ifdef HAVE_LIBXFT #include //#include #endif #ifdef HAVE_LIBXV #include #include #endif #include "VideoDPMS.h" #include #include #include #include #define __MODULE__ "VideoRenderer" AVM_BEGIN_NAMESPACE; static const char __RENDERER__[] = "renderer"; int GetPhysicalDepth(void* _dpy) { Display* dpy = (Display*) _dpy; if (!dpy) return 0; int n, pixmap_bits = 0; XPixmapFormatValues* pf = XListPixmapFormats(dpy, &n); int screen = DefaultScreen(dpy); int planes = DefaultDepth(dpy, screen); for (int i = 0; i < n; ++i) if (pf[i].depth == planes) { pixmap_bits = pf[i].bits_per_pixel; break; } XFree(pf); if (pixmap_bits == 16 && DefaultVisual(dpy, screen)->red_mask == 0x7c00) pixmap_bits = 15; return pixmap_bits; } #ifdef HAVE_LIBSDL #include #include #include #include #ifndef SDL_VERSIONNUM #define SDL_VERSIONNUM(X, Y, Z) (X)*1000 + (Y)*100 + (Z) #endif #define _SDL_VER SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) #ifndef SDL_DISABLE #define SDL_DISABLE 0 #endif #ifndef SDL_ENABLE #define SDL_ENABLE 1 #endif #ifndef SDL_BUTTON_LEFT #define SDL_BUTTON_LEFT 1 #define SDL_BUTTON_MIDDLE 2 #define SDL_BUTTON_RIGHT 3 #endif #ifndef SDL_BUTTON_WHEELUP #define SDL_BUTTON_WHEELUP 4 #define SDL_BUTTON_WHEELDOWN 5 #endif /* XPM */ static const char* const mouse_arrow[] = { /* width height num_colors chars_per_pixel */ " 32 32 3 1", /* colors */ "X c #000000", ". c #ffffff", " c None", /* pixels */ "X ", "XX ", "X.X ", "X..X ", "X...X ", "X....X ", "X.....X ", "X......X ", "X.......X ", "X........X ", "X.....XXXXX ", "X..X..X ", "X.X X..X ", "XX X..X ", "X X..X ", " X..X ", " X..X ", " X..X ", " XX ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "0,0" }; static const char* const mouse_zoomlu[] = { /* width height num_colors chars_per_pixel */ " 32 32 3 1", /* colors */ "X c #000000", ". c #ffffff", " c None", /* pixels */ "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "X..............................X", "X..............................X", "X..XXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "X..X ", "XXXX ", "0,0" }; static const char* const mouse_zoomrb[] = { /* width height num_colors chars_per_pixel */ " 32 32 3 1", /* colors */ "X c #000000", ". c #ffffff", " c None", /* pixels */ " XXXX", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", " X..X", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX..X", "X..............................X", "X..............................X", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "31,31" }; static const char* const hidden_arrow[] = { /* width height num_colors chars_per_pixel */ " 8 1 3 1", /* colors */ "X c #000000", ". c #ffffff", " c None", /* pixels */ " ", "0,0" }; static SDL_Cursor* init_system_cursor(const char* const image[]) { int i, row, col; int hot_x, hot_y; Uint8* data, *mask; int rows, cols, colors, per_pix; int s; SDL_Cursor* cret; sscanf(image[0], "%d %d %d %d", &cols, &rows, &colors, &per_pix); //printf("col %d row %d colo: %d %d\n", cols, rows, colors, per_pix); s = ((cols + 7) / 8) * rows; data = new Uint8[s]; mask = new Uint8[s]; memset(data, 0, s); memset(mask, 0, s); colors++; // skip definition i = -1; for ( row=0; row 1.0) Off(); else if (m_lMouseTime != m_lMouseLast && --m_iMouseOff == 0) On(); m_lMouseLast = m_lMouseTime; } } void Set(Uint16 x, Uint16 y) { m_iMouseX = x; m_iMouseY = y; m_lMouseTime = avm_get_time_us(); } void Store() { // save original mouse position // using mouse motion event m_iX = m_iMouseX; m_iY = m_iMouseY; } void Restore() { // recover original mouse position // called with LOCK SDL_WarpMouse(m_iX, m_iY); // this seems to be doing same thing } }; #endif // HAVE_LIBSDL #ifdef HAVE_ICONV #include XFontSet XLoadQueryFontSet(Display* disp, const char* fontset_name) { int missing_charset_count; char** missing_charset_list; char* def_string; XFontSet fontset = XCreateFontSet(disp, fontset_name, &missing_charset_list, &missing_charset_count, &def_string); if (missing_charset_count) { AVM_WRITE(__RENDERER__, "Missing charsets in FontSet(%s) creation.\n", fontset_name); XFreeStringList(missing_charset_list); } return fontset; } #define XLoadQueryFont XLoadQueryFontSet #define XFreeFont XFreeFontSet #define XDrawString(d,w,gc,x,y,s,l) XmbDrawString(d,w,font,gc,x,y,s,l) #define XDrawImageString(d,w,gc,x,y,s,l) XmbDrawImageString(d,w,font,gc,x,y,s,l) #define XTextWidth XmbTextEscapement #define XftTextExtents8 XftTextExtentsUtf8 #define XftDrawString8 XftDrawStringUtf8 #endif /* HAVE_ICONV */ VideoRendererWithLock::~VideoRendererWithLock() { } void* VideoRendererWithLock::eventThread(void* arg) { VideoRendererWithLock* vr = (VideoRendererWithLock*) arg; while (!vr->m_bQuit) { //static int c = 0; printf("EventRunning %d\n", c++); vr->processEvent(); } return 0; } #if _SDL_VER > 1104 class SDLGRtConfig : public IRtConfig { VideoRendererWithLock* vr; avm::vector val; public: SDLGRtConfig(VideoRendererWithLock* _vr) : vr(_vr) { m_Attrs.push_back(AttributeInfo("SDL_GAMMA_RED", "Gamma Red", AttributeInfo::Integer, 0, 30, 10)); m_Attrs.push_back(AttributeInfo("SDL_GAMMA_GREEN", "Gamma Green", AttributeInfo::Integer, 0, 30, 10)); m_Attrs.push_back(AttributeInfo("SDL_GAMMA_BLUE", "Gamma Blue", AttributeInfo::Integer, 0, 30, 10)); val.resize(m_Attrs.size()); for (unsigned i = 0; i < m_Attrs.size(); ++i) val[i] = RegReadInt("aviplay", m_Attrs[i].GetName(), 10); setGamma(); } virtual ~SDLGRtConfig() { // restore to defaults or at least those from the begining for (unsigned i = 0; i < m_Attrs.size(); ++i) RegWriteInt("aviplay", m_Attrs[i].GetName(), val[i]); val[0] = val[1] = val[2] = 10; setGamma(); } // IRtConfig interface virtual int GetValue(const char* attr, int* result) const { AVM_WRITE(__RENDERER__, 1, "sdlg: get %s\n", attr); for (unsigned i = 0; i < m_Attrs.size(); ++i) if (attr == m_Attrs[i].GetName()) { *result = val[i]; return 0; } return -1; } virtual int SetValue(const char* attr, int value) { AVM_WRITE(__RENDERER__, 1, "sdlg: set %s value: %d\n", attr, value); for (unsigned i = 0; i < m_Attrs.size(); ++i) if (attr == m_Attrs[i].GetName()) { val[i] = value; setGamma(); return 0; } return -1; } private: void setGamma() { vr->Lock(); SDL_SetGamma((float)val[0]/10.f, (float)val[1]/10.f, (float)val[2]/10.f); vr->Unlock(); } }; #else class SDLGRtConfig : public IRtConfig { public: virtual int GetValue(const char* attr, int* result) const { return 0; } virtual int SetValue(const char* attr, int value) { return 0; } }; #endif // _SDL_VER > 1104 #undef __MODULE__ #define __MODULE__ "Fullscreen renderer" #ifdef HAVE_LIBSDL // according to SDL we should not use this // new XFree should have this fixed //static EnvKeeper keeper; static const char sdl_var[] = "SDL_VIDEO_X11_NODIRECTCOLOR"; class EnvKeeper { avm::string m_str; public: EnvKeeper() : m_str(getenv(sdl_var)) { avm_setenv(sdl_var, "1", true); } ~EnvKeeper() { if (!m_str.size()) avm_unsetenv(sdl_var); } }; class FullscreenRenderer: public VideoRendererWithLock { protected: Display* dpy; GC xgc; ISubRenderer* m_pSubRenderer; SDL_Event keyrepev; SDL_Rect cliprect; SDL_SysWMinfo info; SDL_Surface* screen; SDLGRtConfig* m_pSdlgRtConfig; MouseKeeper m_Mouse; int max_w, max_h; SDL_Rect m_Zoom; int fs; int bit_depth; int bpp; const CImage* image; char* convbuf; PthreadTask* eventchecker; VideoDPMS* dpmsSafe; size_t m_uiImages; avm::vector sflist; const subtitle_line_t* m_pSublineRef; subtitle_line_t* m_pSubline; char* charset; #ifdef HAVE_ICONV XFontSet font; char* i18nfileencoding; char* i18ndisplayencoding; bool i18ncodeconvert; #else XFontStruct* font; #endif #ifdef HAVE_LIBXFT XftDraw* xftdraw; XftFont* xftfont; XftColor* xftcolor; #endif Uint32 sdl_systems; bool dga; bool m_bDirty; bool m_bResizeEnabled; bool m_bSubRefresh; public: static const unsigned int SUBTITLE_SPACE = 3; FullscreenRenderer(PlayerWidget* pw, Display* _dpy, int width, int height, bool subt = false) :VideoRendererWithLock(width, height, subt), dpy(_dpy), xgc(0), m_pSubRenderer(0), screen(0), m_pSdlgRtConfig(0), max_w(0), max_h(0), fs(0), image(0), convbuf(0), eventchecker(0), dpmsSafe(0), m_uiImages(0), m_pSublineRef(0), m_pSubline(0), charset(0), font(0), #ifdef HAVE_LIBXFT xftdraw(0), xftfont(0), xftcolor(0), #endif sdl_systems(0), dga(false), m_bDirty(false), m_bResizeEnabled(true), m_bSubRefresh(false) { m_pPw = pw; m_Zoom.w = 0; } virtual ~FullscreenRenderer() { if (fs) { m_bQuit = true; emutex.Lock(); econd.Broadcast(); emutex.Unlock(); delete m_pSdlgRtConfig; Lock(); delete dpmsSafe; #if _SDL_VER > 1102 if (screen && (screen->flags & SDL_FULLSCREEN)) SDL_WM_ToggleFullScreen(screen); #endif delete eventchecker; delete[] convbuf; m_Mouse.Close(); if (image) image->Release(); while (sflist.size() > 0) { //printf("SFLIST FREE %p\n", sflist.back()->GetUserData()); SDL_FreeSurface((SDL_Surface*) sflist.back()->GetUserData()); sflist.pop_back(); } if (m_pSubline) subtitle_line_free(m_pSubline); if (dpy) freeFont(); if (xgc) XFreeGC(dpy, xgc); if (charset) free(charset); //if (screen) SDL_FreeSurface(screen); Unlock(); #if _SDL_VER > 1102 SDL_QuitSubSystem(sdl_systems); #else SDL_Quit(); #endif } } virtual int init() { if (VideoRendererWithLock::init() < 0) return -1; //avm_setenv("SDL_WINDOWID", "0x200000e", 1); if (setlocale(LC_CTYPE, "") == 0) AVM_WRITE(__RENDERER__, "Warning: Locale not supported by C library\n"); else { if (!XSupportsLocale()) { AVM_WRITE(__RENDERER__, "warning: Locale not supported by Xlib\n"); setlocale(LC_CTYPE, "C"); } charset = strdup(nl_langinfo(CODESET)); } #if _SDL_VER < 1103 SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE); atexit(SDL_Quit); #else Uint32 subsystem_init = SDL_WasInit(SDL_INIT_EVERYTHING); if (!(subsystem_init & SDL_INIT_VIDEO)) { if (subsystem_init == 0) { SDL_Init(SDL_INIT_NOPARACHUTE); atexit(SDL_Quit); } if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) { AVM_WRITE(__RENDERER__, "Failed to initialize SDL_VIDEO"); return -1; } sdl_systems |= SDL_INIT_VIDEO; } #endif //fs = SDL_RESIZABLE | SDL_SWSURFACE | SDL_HWACCEL | SDL_ANYFORMAT; fs = SDL_SWSURFACE | SDL_HWACCEL | SDL_ANYFORMAT; #if _SDL_VER > 1103 fs |= SDL_RESIZABLE; //fs |= SDL_DOUBLEBUF; //fs |= SDL_ASYNCBLIT; // Async blit makes this a bit faster - however we prefer // to know when the image is drawn // - Async uses XFlush, Sync calls XSync // using double buffering would be great // but for some reason it doesn't work for YUV char vname[100]; SDL_VideoDriverName(vname, sizeof(vname)); AVM_WRITE(__RENDERER__, "SDL video driver: %s\n", vname); #endif const SDL_VideoInfo* vi = SDL_GetVideoInfo(); AVM_WRITE(__RENDERER__, 1, "VideoInfo: %s%s%s%s%s - %s%s%s - %s\n", (vi->hw_available) ? "hw_available" : "", (vi->wm_available) ? " wm_available" : "", (vi->blit_hw) ? " blit_hw" : "", (vi->blit_hw_CC) ? " blit_hw_CC" : "", (vi->blit_hw_A) ? " blit_hw_A" : "", (vi->blit_sw) ? " blit_sw" : "", (vi->blit_sw_CC) ? " blit_sw_CC" : "", (vi->blit_sw_A) ? " blit_sw_A" : "", (vi->blit_fill) ? " blit_fill" : ""); #if 0 AVM_WRITE(__RENDERER__, 1, "VideoInfo: vmem:%d colorkey:0x%x alpha:0x%x\n", vi->video_mem, vi->vfmt->colorkey, vi->vfmt->alpha); #endif pic_w = -1; int dim_w = m_w; int dim_h = m_h; const char* e = getenv("SDL_VIDEODRIVER"); if (e && strcmp(e, "dga") == 0) { const char* px = getenv("AVIPLAY_DGA_WIDTH"); const char* py = getenv("AVIPLAY_DGA_HEIGHT"); float ratio_x = (px == NULL) ? 800.f : (float) atof(px); float ratio_y = (py == NULL) ? 600.f : (float) atof(py); float ratio; ratio_x = ratio_x / (float) m_w; ratio_y = ratio_y / (float) m_h; ratio = (ratio_x < ratio_y) ? ratio_x : ratio_y; //dim_w = (int) rint(ratio * m_w); //dim_h = (int) rint(ratio * m_h); dga = true; } /*int newbpp = SDL_VideoModeOK(dim_w, dim_h, GetPhysicalDepth(dpy), fs); if (!newbpp) { AVM_WRITE(__RENDERER__, "Failed to set up video mode"); return -1; } */ doResize(dim_w, dim_h); // creates screen = SDL_SetVideoMode(dim_w, dim_h, 0, fs); if (!screen) { AVM_WRITE(__RENDERER__, "Failed to set up video mode"); return -1; } if (dga) { m_bResizeEnabled = false; dpy = 0; } SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE); bit_depth = screen->format->BitsPerPixel; if (bit_depth == 16 && screen->format->Rmask == 0x7c00) bit_depth = 15; bpp = (bit_depth + 7) / 8; if (dpy) { SDL_VERSION(&info.version); if (!SDL_GetWMInfo(&info)) { AVM_WRITE(__RENDERER__, "Failed SDL GetWMInfo"); return -1; } dpy = info.info.x11.display; Window& win = info.info.x11.window; m_Mouse.Open(); dpmsSafe = new VideoDPMS(dpy); keyrepev.type = 0; #ifdef HAVE_LIBXXF86VM int lines; XF86VidModeModeInfo** modesinfo = 0; Bool r = XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &lines, &modesinfo); if (r && modesinfo) { for (int i = 0; modesinfo[i] && i < lines; ++i) modes.push_back(VideoMode(modesinfo[i]->hdisplay, modesinfo[i]->vdisplay, // some systems have zeroes here... ??? // ATI Radeon VE 32MB @ 1280x1024 some user (modesinfo[i]->htotal && modesinfo[i]->vtotal) ? ((float)modesinfo[i]->dotclock * 1000.f / (float)modesinfo[i]->htotal / (float)modesinfo[i]->vtotal) : 0.f) ); XFree(modesinfo); } else AVM_WRITE(__RENDERER__, "Can't resolve video modes...\n"); #else // Get available fullscreen/hardware modes // no call to FREE for smodes!! const SDL_Rect** smodes = const_cast(SDL_ListModes(0, SDL_FULLSCREEN | SDL_HWSURFACE)); // Check if there are any modes available if (smodes) { /* Check if our resolution is restricted */ if (smodes != (SDL_Rect **)-1) for (int i = 0; smodes[i]; ++i) modes.push_back(VideoMode(smodes[i]->w, smodes[i]->h)); else AVM_WRITE(__RENDERER__, "All resolutions available.\n"); } else AVM_WRITE(__RENDERER__, "Can't resolve video modes...\n"); #endif XGCValues gcv; gcv.graphics_exposures = False; xgc = XCreateGC(dpy, win, GCGraphicsExposures, &gcv); #if 0 #ifdef HAVE_FREETYPE m_pSubRenderer = new SubRenderer_Ft(); #endif // HAVE_FREETYPE #ifdef HAVE_XFT if (!m_pSubRenderer) m_pSubRenderer = new SubRenderer_Xft(dpy, win); #endif // HAVE_XFT if (!m_pSubRenderer) m_pSubRenderer = new SubRenderer_X11(dpy, win); #endif // 0 SetCaption("AviPlayer: M/F max/fullscreen", 0); } AVM_WRITE(__RENDERER__, "created surface: %dx%d %d bits\n", pic_w, pic_h, bit_depth); m_pSdlgRtConfig = new SDLGRtConfig(this); if (m_pPw) eventchecker = new PthreadTask(0, eventThread, this); return 0; } virtual int Set(...) { va_list args; Property prop; va_start(args, this); while ((prop = (Property) va_arg(args, int)) != 0) { } va_end(args); return 0; } virtual int Get(...) const { va_list args; Property prop; //printf("Sizeof %d\n", sizeof(Property)); va_start(args, this); va_end(args); return 0; } virtual IRtConfig* GetRtConfig() const { return m_pSdlgRtConfig; } virtual size_t GetImages() const { return m_uiImages; } virtual CImage* ImageAlloc(const BITMAPINFOHEADER& bh, uint_t idx, size_t align) { // for direct rendering bitdepth must match! m_bResizeEnabled = false; // not allowed for x11 resizing BitmapInfo bi(m_w, m_h, bit_depth); //printf("--ImageAlloc\n"); BitmapInfo(bh).Print(); //printf("--ImageAllocated\n"); bi.Print(); if (!(bi == BitmapInfo(bh))) return 0; SDL_Surface* sf = 0; Lock(); while (idx >= sflist.size()) { if (idx == 0) sf = screen; else if (idx > 10000) // disabled { SDL_Surface* cs = SDL_GetVideoSurface(); sf = SDL_CreateRGBSurface(SDL_HWSURFACE, cs->w, cs->h, cs->format->BitsPerPixel, cs->format->Rmask, cs->format->Gmask, cs->format->Bmask, cs->format->Amask); //printf("SDL SURFACE %d %d\n", sf->w, sf->h); } if (!sf) break; CImage* ci = new CImage(&bi, (uint8_t*) sf->pixels, false); ci->SetUserData(sf); ci->SetAllocator(this); sflist.push_back(ci); } Unlock(); if (!sf) return 0; if (m_uiImages <= idx) m_uiImages = idx + 1; return sflist[idx]; } virtual void ReleaseImages() { m_uiImages = 0; } virtual int Draw(const CImage* data) { // we have to prevent resizing of screen->pixels #if 0 char* tmp_array=new char[m_w*m_h]; char* tmp_array2=new char[m_w*m_h]; uint_t t3=localcount(); memcpy(tmp_array2, tmp_array, m_w*m_h); uint_t t4=localcount(); SDL_LockSurface(screen); uint_t t1=localcount(); memcpy(screen->pixels, tmp_array, m_w*m_h); uint_t t2=localcount(); SDL_UnlockSurface(screen); delete[] tmp_array; delete[] tmp_array2; AVM_WRITE("Pixels: %f Mb/s System: %f Mb/s\n", (m_w*m_h/1048576.)/((t2-t1)/freq/1000.), (m_w*m_h/1048576.)/((t4-t3)/freq/1000.) ); #endif // if we do not want to block our renderer while // keyboard event processing tries to lock this system Lock(); if (!data) { if (!image) { Unlock(); return -1; } data = image; } data->AddRef(); if (image) image->Release(); image = data; m_lLastDrawStamp = avm_get_time_us(); char* dest = (char*)screen->pixels; if (pic_w != m_w || pic_h != m_h || dga) { if (!convbuf) convbuf = new char[m_w * m_h * bpp]; dest = convbuf; } if (SDL_MUSTLOCK(screen)) SDL_LockSurface(screen); if (!data->GetUserData() || !data->Format() != bit_depth) { int w = m_w; int h = m_h; if (m_Zoom.w) { w = m_Zoom.w; h = m_Zoom.h; //printf("%d %d %d %d\n", pic_w, w, pic_h, h); if (pic_w == w && pic_h == h) dest = (char*) screen->pixels; } // make a local non-const copy of data // so we could set Zoom const uint8_t* p[CIMAGE_MAX_PLANES] = { data->Data(0), data->Data(1), data->Data(2) }; int s[CIMAGE_MAX_PLANES] = { data->Stride(0), data->Stride(1), data->Stride(2) }; CImage datah(data->GetFmt(), p, s, false); if (m_Zoom.w) datah.SetWindow(m_Zoom.x, m_Zoom.y, m_Zoom.w, m_Zoom.h); BitmapInfo bi(w, h, bit_depth); //data->GetFmt()->Print(); //bi.Print(); // convert image into either buffer or // directly into the screen surface in case we do not need // more scaling //printf("SCREEN %d\n", screen->pitch); CImage ci(&bi, (const uint8_t*) dest, false); ci.Convert(&datah); //printf("COVERT %d -> %d %d,%d 0x%08x\n", data->GetFmt()->Bpp(), bit_depth, //data->GetFmt()->biHeight, bi.biHeight, data->GetFmt()->biCompression); m_bResizeEnabled = true; } if (dest == convbuf) { //printf("Zoom %d %d %d h: %d %d\n", pic_w, screen->pitch, screen->pitch / (bit_depth / 8), pic_h, m_h); // scaling is necessary zoom((uint16_t*)screen->pixels, (const uint16_t*)dest, screen->pitch / (bit_depth / 8), //pic_w, pic_h, m_w, m_h, bit_depth); //for (int i = 0; i < screen->h; ++i) for (int j = 0; j < 50; ++j) // ((char*)screen->pixels)[i * screen->pitch + j] = i * j; } if (SDL_MUSTLOCK(screen)) SDL_UnlockSurface(screen); m_bDirty = true; Unlock(); return 0; } virtual int Sync() { if (m_bDirty && !dga) { Lock(); m_bDirty = false; //SDL_Flip(screen); // equals for non double buffered surface //printf("Update %d %d %d %d\n",cliprect.x, cliprect.x,cliprect.w, cliprect.h); SDL_UpdateRect(screen, cliprect.x, cliprect.x, cliprect.w, cliprect.h); Unlock(); } //printf("FSMOD %x %d\n", screen->flags, screen->flags & SDL_FULLSCREEN); emutex.Lock(); econd.Broadcast(); emutex.Unlock(); return 0; } virtual int ToggleFullscreen(bool maximize = false) { if (dga) return -1; Lock(); if (!(screen->flags & SDL_FULLSCREEN)) { m_Mouse.Store(); if (maximize && m_bResizeEnabled) { int w = max_w = pic_w; // set some defaults int h = pic_h + m_sub; max_h = pic_h; GetModeLine(w, h); //printf("GETMODELINE %dx%d %dx%d\n", w, h, pic_w, pic_h); float ratio_x = (float)w / (float)pic_w; float ratio_y = (float)(h - m_sub) / (float)pic_h; float ratio = (ratio_x < ratio_y) ? ratio_x : ratio_y; w = (int) rint(ratio * (float)pic_w); h = (int) rint(ratio * (float)pic_h); if (pic_w != w || pic_h != h) { // FIXME - needs to flush XQueue here to be able to move // this window before Toggle occures if (doResize(w, h) < 0) max_w = max_h = 0; } } } #if _SDL_VER > 1102 SDL_WM_ToggleFullScreen(screen); fs = screen->flags & SDL_FULLSCREEN; #else screen->flags ^= SDL_FULLSCREEN; fs = screen->flags & SDL_FULLSCREEN; if (fs && max_w > 0) XMoveWindow(dpy, info.info.x11.window, 0, 0); #endif if (!fs) { m_Mouse.Restore(); if (max_w && max_h) doResize(max_w, max_h); max_w = max_h = 0; } m_Mouse.Off(); Unlock(); Refresh(); return fs; } virtual int DrawSubtitles(const subtitle_line_t* sl) { if (!dpy || !xgc) return -1; Lock(); if ((!m_bSubRefresh && subtitle_line_equals(sl, m_pSubline)) || (!sl && !m_pSubline) || !m_iFontHeight) { Unlock(); return 0; } // prepare line - calc width of each line // append each overlap to next line m_bSubRefresh = false; subtitle_line_t* nsl = (sl) ? subtitle_line_copy(sl) : NULL; subtitle_line_free(m_pSubline); m_pSubline = nsl; //if (m_pSubRenderer) m_pSubRenderer->Draw(m_pSubline); Window& win = info.info.x11.window; GC lxgc = xgc; XSetForeground(dpy, lxgc, 0x0); XFillRectangle(dpy, win, lxgc, 0, pic_h, pic_w, m_sub); XSetForeground(dpy, lxgc, 0xFFFFFFFF); if (!m_pSubline) { Unlock(); return 0; } char sub[1000]; *sub = 0; bool copy = true; for (unsigned i = 0; i < SUBTITLE_SPACE; ++i) { if (copy && i < m_pSubline->lines) { strncat(sub, m_pSubline->line[i], sizeof(sub) - strlen(sub) - 2); if ((m_sub / (unsigned)m_iFontHeight) < m_pSubline->lines) { for (unsigned j = 1; j < m_pSubline->lines; ++j) { // compress all subtitles lines into just one line strcat(sub, " "); strncat(sub, m_pSubline->line[j], sizeof(sub) - strlen(sub) - 2); } copy = false; } } // XDrawString16(dpy, win, lxgc, dim_w/2-6*strlen(sub)/2, // dim_h-65+20*i, // (XChar2b*)(short*)QString::fromLocal8Bit(sub).unicode(), // strlen(sub)); size_t slen = strlen(sub); if (!slen) break; int draw_h = pic_h + (i + 1) * m_iFontHeight; #ifdef HAVE_LIBXFT if (slen && xftfont) { size_t clen = slen; size_t nlen = slen; for (;;) { XGlyphInfo extents; XftTextExtents8(dpy, xftfont, (XftChar8*)sub, (int)clen, &extents); int fm_width_sub = extents.xOff; if (fm_width_sub > pic_w) { while (clen > 0 && !isspace(sub[clen - 1])) clen--; if (clen > 0 && clen < nlen) { nlen = clen; while (clen > 0 && isspace(sub[clen - 1])) clen--; if (clen > 0) continue; // try next for loop } clen = nlen; } XftDrawString8(xftdraw, xftcolor, xftfont, (pic_w - fm_width_sub) / 2, draw_h, (XftChar8*)sub, (int)clen); //printf("n:%d s:%d\n", nlen, slen); if (nlen != slen) { slen -= nlen; memcpy(sub, sub + nlen, slen); sub[slen++] = ' '; sub[slen] = 0; } else *sub = 0; break; } } else #endif /* HAVE_LIBXFT */ if (slen && font) { #ifdef HAVE_ICONV size_t in_size = slen; size_t out_size = slen * 6; char* out_buffer = (char*)malloc(out_size); char* out_p = out_buffer; iconv_t icvsts = iconv_open(charset, "UTF-8"); if (icvsts != (iconv_t)(-1)) { char* in_p = sub; while (in_size > 0 && out_size > 10) if ((size_t)(-1) == iconv(icvsts, (ICONV_CONST_CAST char**) &in_p, &in_size, &out_p, &out_size) && --in_size > 0) in_p++; // skip and try next iconv_close(icvsts); } int out_count = (int)(out_p - out_buffer); //printf("OUTLEN %d - %d %d (%s)\n", out_size, out_count, slen, charset); //for (unsigned i =0; i < out_size / sizeof(wchar_t); ++i) // printf("char %d %d 0x%x\n", i, out_buffer[i], out_buffer[i]); int fm_width_sub = XTextWidth(font, out_buffer, out_count); XDrawString(dpy, win, lxgc, (pic_w - fm_width_sub) / 2, draw_h, out_buffer, out_count); free(out_buffer); #else /* HAVE_ICONV */ int fm_width_sub = XTextWidth(font, sub, slen); //printf("Width %d, height %d %s\n", fm_width_sub, m_iFontHeight, sub); XDrawString(dpy, win, lxgc, (pic_w - fm_width_sub) / 2, draw_h, sub, slen); #endif /* HAVE_ICONV */ } XFlush(dpy); } Unlock(); return 0; } virtual int Resize(int& new_w, int& new_h) { if (dga) return -1; Lock(); int r = doResize(new_w, new_h); //printf("DORESIZE %d %d %d\n", new_w, new_h, r); Unlock(); if (r == 0) Refresh(); return r; } virtual int Zoom(int x, int y, int width, int height) { if (!m_bResizeEnabled) return -1; Lock(); width = (width + 7) & ~7; height = (height + 1) & ~1; m_Zoom.x = (Sint16)(x & ~7); m_Zoom.y = (Sint16)(y & ~1); m_Zoom.w = (Uint16)width; m_Zoom.h = (Uint16)height; if (m_Zoom.w > 0 && m_Zoom.h > 0 && doResize(width, height) == 0) for (unsigned i = 0; i < sflist.size(); ++i) sflist[i]->SetWindow(m_Zoom.x, m_Zoom.y, m_Zoom.w, m_Zoom.h); else m_Zoom.w = m_Zoom.h = 0; Unlock(); return 0; } virtual int Refresh() { if (avm_get_time_diff(avm_get_time_us(), m_lLastDrawStamp) > 0.01) { // wait until we could really refresh image Lock(); subtitle_line_t* sl = m_pSubline; m_pSubline = 0; Unlock(); // because of scaling we need to call Draw if (Draw(0) == 0) { if (sl) DrawSubtitles(sl); Sync(); return 0; } } else m_bSubRefresh = true; return -1; } virtual int SetCaption(const char* title, const char* icon) { if (!dpy) return -1; Lock(); SDL_WM_SetCaption(title, icon); Unlock(); return 0; } virtual int GetPosition(int& x, int& y) const { if (!dpy) return -1; Lock(); doGetPosition(x, y); Unlock(); //printf("Window position is %d %d s:%d\n", x, y, s); return 0; } virtual int SetPosition(int new_x, int new_y) { if (!dpy) return -1; Lock(); #if _SDL_VER > 1102 Window& win = info.info.x11.wmwindow; #else Window& win = info.info.x11.window; #endif XMoveWindow(dpy, win, new_x, new_y); Unlock(); Refresh(); return 0; } virtual int SetFont(const char* subfont) { if (!dpy) return -1; avm::string lf = subfont; avm::string::size_type n = lf.find(":qtfont="); if (n != avm::string::npos) lf[n] = 0; if (lf.size() == 0) return 0; Lock(); freeFont(); n = lf.find("-iso"); if (n != avm::string::npos) { lf[n + 1] = '*'; lf[n + 2] = 0; } Window& win = info.info.x11.window; //XSetWindowAttributes attr; //XWindowAttributes src; //XGetWindowAttributes(dpy, info.info.x11.window, &src); //attr.event_mask=VisibilityChangeMask; //XChangeWindowAttributes(dpy, info.info.x11.wmwindow, CWEventMask, &attr); //XChangeWindowAttributes(dpy, info.info.x11.window, CWEventMask, &attr); //::wnd=info.info.x11.wmwindow; if (lf.size()) AVM_WRITE(__RENDERER__, "Loading font: \"%s\"\n", lf.c_str()); m_iFontHeight = 0; //font = XLoadQueryFont(dpy, lf); #ifdef HAVE_LIBXFT xftfont = 0; // only truetype fonts if (XftDefaultHasRender(dpy) == 1 && lf.size()) { xftcolor = new XftColor; xftcolor->color.red = 0xd700; xftcolor->color.green = 0xdc00; xftcolor->color.blue = 0xed00; xftcolor->color.alpha = 0xffff; xftcolor->pixel = 0xd7dced; avm::string lfn = lf; #ifdef HAVE_ICONV /* Check Font Name Style Type1. Single Font Style. "-sony-fixed-medium-r-normal--24-230-75-75-c-120-iso8859-1" Type2 Multi Font Style. "-sony-fixed-medium-r-normal--24-230-75-75-c-120-jisx0208.1983-0,-sony-fixed-medium-r-normal--24-230-75-75-c-120-jisx0201.1976-0,-sony-fixed-medium-r-normal--24-230-75-75-c-120-iso8859-1" Type 3 Xft Font Name Style "MS UI Gothic-16" */ XftPattern* pat = XftXlfdParse(lf.c_str(), 0, 1); if (pat) { XftResult res; XftPattern* match = XftFontMatch(dpy, DefaultScreen(dpy), pat, &res); if (match) { Bool bIsCore; XftPatternGetBool(match, XFT_CORE, 0, &bIsCore); if (!bIsCore) { AVM_WRITE(__RENDERER__, "XftFont %p\n", match); xftfont = XftFontOpenXlfd(dpy, DefaultScreen(dpy), lfn.c_str()); } XftPatternDestroy(match); } AVM_WRITE(__RENDERER__, "XftFont Not Match\n"); XftPatternDestroy(pat); } else { if (lf[0] != '-') xftfont = XftFontOpenName(dpy, DefaultScreen(dpy), lf.c_str()); } #else /* HAVE_ICONV */ // stupid check for truetype font // FIXME: char* p = strstr(lfn.c_str(), "type-"); if (p || strstr(lfn.c_str(), "ttf-")) { // the purpose of the following code is to replace last digit // in the fontname: *-iso8859-2 -> *-iso8859-* // it's necessary so the Xft renderer will work correctly p = strstr(lfn.c_str(), "iso8859-"); if (p) { p += 9; *p = '*'; AVM_WRITE(__RENDERER__, "Modified font name for iso8859 support\n"); } #if 0 xftfont = XftFontOpen(dpy, DefaultScreen(dpy), XFT_FAMILY, XftTypeString, "Arial", //XFT_ENCODING, XftTypeString, "iso10646", XFT_ENCODING, XftTypeString, "iso8859-2", XFT_SIZE, XftTypeDouble, 20.0, 0); #endif // just testing family open xftfont = XftFontOpenXlfd(dpy, win, lfn.c_str()); } //xftfont = XftFontOpenName(d, info.info.x11.window, "verdana:pixelsize=30"); #endif /* HAVE_ICONV */ } int iDescent = 0; if (xftfont) { m_iFontHeight = xftfont->height; iDescent = xftfont->descent; xftdraw = XftDrawCreate(dpy, win, DefaultVisual(dpy, DefaultScreen(dpy)), DefaultColormap(dpy, DefaultScreen(dpy))); AVM_WRITE(__RENDERER__, "Successfully opened Xft font\n"); } else { AVM_WRITE(__RENDERER__, "Failed to open Xft Font\n"); } if (!xftfont) #endif // HAVE_LIBXFT if (lf.size()) { font = XLoadQueryFont(dpy, lf.c_str()); if (!font) AVM_WRITE(__RENDERER__, "Failed to open X11 font\n"); } if (font) { #ifdef HAVE_ICONV XFontSetExtents *extent = XExtentsOfFontSet(font); m_iFontHeight = extent->max_logical_extent.height; #else /* HAVE_ICONV */ XSetFont(dpy, xgc, font->fid); m_iFontHeight = font->max_bounds.ascent + font->max_bounds.descent; iDescent = font->max_bounds.descent; //printf("Max bounds: %d, %d\n", // _font->max_bounds.ascent, _font->max_bounds.descent); #endif /* HAVE_ICONV */ } m_sub = m_iFontHeight * SUBTITLE_SPACE + iDescent; //printf("MSUB %d %d\n", m_sub, m_iFontHeight); SDL_Surface* s = SDL_SetVideoMode(pic_w, pic_h + m_sub, 0, fs); if (s) screen = s; //printf("Max bounds: %d, %d\n", // _font->max_bounds.ascent, _font->max_bounds.descent); Unlock(); return 0; } void GetModeLine(int& w, int& h) { // method to detect screen resolution in pixels // e.g. when user switches resolution with Ctrl Alt '+' if (!dpy) return; // this could be called either under SDL or // within SDL context - thus open/close new connectins // for this query - not very efficient but safe // and avoids mixture of Xevents with older XServers Display* d = XOpenDisplay(0); #ifdef HAVE_LIBXXF86VM int unused; XF86VidModeModeLine vidmode; XF86VidModeGetModeLine(d, DefaultScreen(d), &unused, &vidmode); w = vidmode.hdisplay; h = vidmode.vdisplay; #else // this will return just size of the whole screen // and I don't know other way then XF86VidMode lugins/libffmpeg // to read current screen size w = DisplayWidth(d, DefaultScreen(d)); h = DisplayHeight(d, DefaultScreen(d)); #endif // HAVE_LIBXXF86VM XCloseDisplay(d); } virtual int Lock() const { int r = VideoRendererWithLock::Lock(); if (r == 0 && !dga && info.info.x11.lock_func) info.info.x11.lock_func(); return r; } virtual int TryLock() const { int r = VideoRendererWithLock::TryLock(); if (r == 0 && !dga && info.info.x11.lock_func) info.info.x11.lock_func(); return r; } virtual int Unlock() const { if (!dga && info.info.x11.unlock_func) info.info.x11.unlock_func(); return VideoRendererWithLock::Unlock(); } virtual int processEvent() { /** * * This function processes events received by SDL window. * */ static const char* const event_names[]= { "SDL_NOEVENT", "SDL_ACTIVEEVENT", "SDL_KEYDOWN", "SDL_KEYUP", "SDL_MOUSEMOTION", "SDL_MOUSEBUTTONDOWN", "SDL_MOUSEBUTTONUP", "SDL_JOYAXISMOTION", "SDL_JOYBALLMOTION", "SDL_JOYHATMOTION", "SDL_JOYBUTTONDOWN", "SDL_JOYBUTTONUP", "SDL_QUIT", "SDL_SYSWMEVENT", "SDL_EVENT_RESERVEDA", "SDL_EVENT_RESERVEDB", "SDL_VIDEORESIZE", "SDL_VIDEOEXPOSE", "SDL_EVENT_RESERVED2", "SDL_EVENT_RESERVED3", "SDL_EVENT_RESERVED4", "SDL_EVENT_RESERVED5", "SDL_EVENT_RESERVED6", "SDL_EVENT_RESERVED7" }; int r = 0; SDL_Event event; if (TryLock() == 0) { m_Mouse.Process(); // MouseOn/Off r = SDL_PollEvent(&event); Unlock(); } if (!r || !m_pPw) { // in case there is no incomming event // check if there is some 'autorepeated' event if (m_pPw && keyrepev.type == SDL_USEREVENT) { // small initial resistance after keypress if (m_iAuto++ > 4) { switch (keyrepev.key.keysym.sym) { case SDLK_F1: case SDLK_F2: case SDLK_F3: case SDLK_F4: case SDLK_F5: case SDLK_F6: case SDLK_F7: case SDLK_F8: case SDLK_F9: case SDLK_F10: case SDLK_F11: case SDLK_F12: case SDLK_F13: case SDLK_F14: case SDLK_F15: case SDLK_9: case SDLK_0: m_iAuto = 5; //printf("SLOW\n"); default: m_pPw->PW_key_func(keyrepev.key.keysym.sym, keyrepev.key.keysym.mod); if (m_iAuto >= 30) { m_iAuto = 30; //return 0; // without wait -> creates CPU busy loop } } } } emutex.Lock(); //AVM_WRITE(__RENDERER__, "nokey %d \n", m_iAuto); econd.Wait(emutex, 0.1f / (float)m_iAuto); emutex.Unlock(); return 0; } //printf("EvenType: %d %s\n", event.type, event_names[event.type]); if (event.type == SDL_KEYUP) { //printf("Key s:%d m:%d\n", (int) event.key.keysym.sym, event.key.keysym.mod); keyrepev.type = 0; // disable autorepeat m_iAuto = 1; } else if (event.type == SDL_KEYDOWN && keyrepev.type == 0) { //printf("KeyDown s:%d m:%d\n", (int) event.key.keysym.sym, event.key.keysym.mod); bool autorep = true; switch (event.key.keysym.sym) { case SDLK_RETURN: if (!(event.key.keysym.mod & (KMOD_ALT | KMOD_META))) break; // fall through - alt + enter case SDLK_ESCAPE: case SDLK_f: autorep = false; m_pPw->PW_fullscreen(); return 1; case SDLK_m: autorep = false; m_pPw->PW_maximize_func(); return 1; case SDLK_x: autorep = false; m_pPw->PW_stop_func(); return 1; case SDLK_v: autorep = false; m_pPw->PW_play_func(); return 1; case SDLK_q: autorep = false; m_pPw->PW_quit_func(); return 1; case SDLK_p: case SDLK_c: case SDLK_SPACE: autorep = false; m_pPw->PW_pause_func(); return 1; //break; case SDLK_LEFTBRACKET: case SDLK_RIGHTBRACKET: autorep = false; break; default: break; } //printf("KEYFUNC %d\n",event.key.keysym.sym); // passing all keys m_pPw->PW_key_func(event.key.keysym.sym, event.key.keysym.mod); if (autorep && !keyrepev.type) { memcpy(&keyrepev, &event, sizeof(keyrepev)); keyrepev.type = SDL_USEREVENT; } } #if _SDL_VER > 1102 else if (event.type == SDL_VIDEORESIZE) { //printf("RESIZE EVENT %d %d\n", event.resize.w, event.resize.h); m_pPw->PW_resize(event.resize.w, event.resize.h - m_sub); } #endif else if (event.type == SDL_MOUSEBUTTONDOWN) { if (!(SDL_GetModState() & (KMOD_CTRL | KMOD_SHIFT | KMOD_ALT | KMOD_META))) { switch (event.button.button) { case SDL_BUTTON_RIGHT: if (SDL_GetVideoSurface()->flags & SDL_FULLSCREEN) m_pPw->PW_fullscreen(); #if 0 // defined(HAVE_LIBQT) && (HAVE_LIBQT < 302 || HAVE_LIBQT > 303 ) // fix race for Pointer grab Lock(); XUngrabPointer(info.info.x11.display, CurrentTime); XUngrabKeyboard(info.info.x11.display, CurrentTime); Unlock(); #endif m_pPw->PW_menu_slot(); break; case SDL_BUTTON_MIDDLE: m_pPw->PW_middle_button(); break; case SDL_BUTTON_LEFT: m_pPw->PW_pause_func(); break; case SDL_BUTTON_WHEELUP: m_pPw->PW_key_func(SDLK_PAGEUP, 0); break; case SDL_BUTTON_WHEELDOWN: m_pPw->PW_key_func(SDLK_PAGEDOWN, 0); break; } } } #ifdef SDL_VIDEOEXPOSE else if (event.type == SDL_VIDEOEXPOSE) { // we are not receiving this event so far !! AVM_WRITE(__RENDERER__, "SDL_VIDEOEXPOSE arrived\n"); } #endif else if (event.type == SDL_ACTIVEEVENT) { if (event.active.state == SDL_APPINPUTFOCUS) { //m_bKeyboardOn = (event.active.gain) ? true : false; m_pPw->PW_refresh(); } // FIXME - check position change } else if (event.type == SDL_VIDEOEXPOSE) { m_pPw->PW_refresh(); } else if (event.type == SDL_MOUSEMOTION) { m_Mouse.Set(event.motion.x, event.motion.y); } else if (event.type == SDL_QUIT) { m_pPw->PW_quit_func(); } return 1; // try once more again } protected: virtual void doGetPosition(int& x, int& y) const { XWindowAttributes xwa; Window win; #if _SDL_VER > 1102 win = info.info.x11.wmwindow; #else win = info.info.x11.window; #endif Status s = XGetWindowAttributes(info.info.x11.display, win, &xwa); XTranslateCoordinates(info.info.x11.display, win, xwa.root, -xwa.border_width, -xwa.border_width, &x, &y, &win); //printf("WINDOWS %ld %ld %ld\n", info.info.x11.window, info.info.x11.wmwindow, xwa.root); } virtual int doResize(int& new_w, int& new_h) { // allow original size if (new_w != m_w) new_w = (new_w + 7) & ~7; if (new_h != m_h) // some resizing algorithms requires this for now new_h = (new_h + 1) & ~1; if (!m_bResizeEnabled) { AVM_WRITE(__RENDERER__, "Resize is unsupported for RGB Direct mode!\n"); //printf("Disabled %dx%d %dx%d\n", new_w, new_h, pic_w, pic_h); new_w = m_w; new_h = m_h; return -1; } if (new_w < 8 || new_h < 2) return -1; if (pic_w != new_w || pic_h != new_h) { if (image && screen && image->Data() == screen->pixels) { AVM_WRITE(__RENDERER__, "Resize is unsupported for RGB Direct mode!\n"); new_w = m_w; new_h = m_h; return -1; CImage* ci = new CImage(image); image->Release(); // replace direct image with a new copy image = ci; } pic_w = new_w; pic_h = new_h; cliprect.x = cliprect.y = 0; cliprect.w = (Uint16)new_w; cliprect.h = (Uint16)new_h; // 0 is intentional -> use current screen depth and color model screen = SDL_SetVideoMode(pic_w, pic_h + m_sub, 0, fs); //printf("SetVideoMode pic_w: %d x %d %d\n", pic_w, pic_h, m_sub); delete[] convbuf; convbuf = 0; } return 0; } private: virtual void freeFont() { #ifdef HAVE_LIBXFT if (xftfont) XftFontClose(dpy, xftfont); xftfont = 0; if (xftdraw) XftDrawDestroy(xftdraw); xftdraw = 0; if (xftcolor) delete xftcolor; xftcolor = 0; #endif if (font) XFreeFont(dpy, font); font = 0; } #if 0 // not really needed anymore void nvidiaCheck() { if (s_iTrickNvidia == -1) { int lines; //XExtensionVersion* ext = XGetExtensionVersion(dpy, "NVIDIA-GLX"); int n = 0; char **extlist = XListExtensions(dpy, &n); //AVM_WRITE (__RENDERER__, 1, "number of extensions: %d\n", n); s_iTrickNvidia = 0; if (extlist) { int i; int opcode, event, error; for (i = 0; i < n; ++i) if (strcmp("NVIDIA-GLX", extlist[i]) == 0) { AVM_WRITE(__RENDERER__, 0, "Detected nVidia GLX driver\n"); AVM_WRITE(__RENDERER__, 0, "If you need to clear two lowest lines set the shell variable AVIPLAY_NVIDIA_ENABLE\n"); } /* ??? do not free ??? could Xlib depend on contents being unaltered */ XFreeExtensionList(extlist); } } } #endif }; #undef __MODULE__ #define __MODULE__ "YUV renderer" #ifdef HAVE_LIBXV static const char xvset[] = "XV_SET_DEFAULTS"; #if 0 static void xv_write_attr(Display* dpy, int xv_port, const char* attr, int value) { if (attr->id == ATTR_ID_NORM || attr->id == ATTR_ID_INPUT) { if (attr->id == ATTR_ID_NORM) h->norm = value; if (attr->id == ATTR_ID_INPUT) h->input = value; for (i = 0; i < h->encodings; ++i) { if (h->enc_map[i].norm == h->norm && h->enc_map[i].input == h->input) { h->enc = i; XvSetPortAttribute(dpy,h->vi_port,h->xv_encoding,h->enc); break; } } } /* needed for proper timing on the "mute - wait - switch - wait - unmute" channel switches */ //XSync(dpy, False); } #endif // 0 static int xv_scan_attrs(avm::vector& vattrs, Display* dpy, int* xv_port) { struct { const char* atom; const char* name; } const xvattrs[] = { { "XV_HUE", "Hue" }, { "XV_BRIGHTNESS", "Brightness" }, { "XV_CONTRAST", "Contrast" }, { "XV_SATURATION", "Saturation" }, { "XV_RED_INTENSITY", "Red intensity" }, { "XV_GREEN_INTENSITY", "Green intensity" }, { "XV_BLUE_INTENSITY", "Blue intensity" }, { "XV_COLORKEY", "Colorkey" }, { "XV_DOUBLE_BUFFER", "Double buffering" }, { "XV_SYNC_TO_VBLANK", "Sync to VBlank" }, /* this shouldn't be exposed to the user { "XV_COLOR", "Color" }, { "XV_MUTE", "Mute" }, { "XV_VOLUME", "Volume" }, { "XV_FREQ", "Freq" }, { "XV_ENCODING", "Encoding" }, { "XV_SET_DEFAULTS", "Set default" }, { "XV_AUTOPAINT_COLORKEY", "Autopaint" }, */ { 0 } }; int have_def = 0; if (*xv_port == 0) { unsigned int ver, rev, req, evn, err; if (Success != XvQueryExtension(dpy, &ver, &rev, &req, &evn, &err)) return 0; unsigned int adaptors; XvAdaptorInfo* ai; /* check for Xvideo support */ if (Success != XvQueryAdaptors(dpy, DefaultRootWindow(dpy), &adaptors, &ai)) { AVM_WRITE(__RENDERER__, "Xv: XvQueryAdaptors failed"); return 0; } /* check adaptors */ for (unsigned i = 0; i < adaptors && *xv_port == 0; ++i) { if ((ai[i].type & (XvInputMask | XvImageMask))) { for (unsigned p = (unsigned)ai[i].base_id; p < (unsigned)ai[i].base_id + ai[i].num_ports; ++p) { *xv_port = p; break; XvUngrabPort(dpy, p, CurrentTime); if (!XvGrabPort(dpy, p, CurrentTime)) { AVM_WRITE(__RENDERER__, "Adaptor %d; format list:\n", i); for (unsigned j = 0; j < ai[i].num_formats; ++j) { AVM_WRITE(__RENDERER__, "depth=%d, visual=%ld\n", ai[i].formats[j].depth, ai[i].formats[j].visual_id); } *xv_port = p; // 4616 HLA MISS 1 (az 18) break; } else { AVM_WRITE(__RENDERER__, "Xv: could not grab port %i\n", (int)p); } } } } } //printf(" attribute list for port %d\n", xv_port); int attributes; XvAttribute* at = XvQueryPortAttributes(dpy, *xv_port, &attributes); if (at) { for (int j = 0; j < attributes; ++j) { const char* nm = 0;//at[j].name; for (int n = 0; xvattrs[n].atom != 0; n++) { if (!strcmp(xvattrs[n].atom, xvset)) have_def++; if (!strcmp(xvattrs[n].atom, at[j].name)) { nm = xvattrs[n].name; break; } } if (at[j].flags & XvGettable && at[j].flags & XvSettable) { int result; Atom atom = XInternAtom(dpy, at[j].name, True); XvGetPortAttribute(dpy, *xv_port, atom, &result); AVM_WRITE(__RENDERER__, 0, "XV attribute: %s" " %s%s <%i, %i> = %d\n", at[j].name, (at[j].flags & XvGettable) ? "G" : "", (at[j].flags & XvSettable) ? "S" : "", at[j].min_value, at[j].max_value, result); if (nm) vattrs.push_back(AttributeInfo(at[j].name, nm, AttributeInfo::Integer, at[j].min_value, at[j].max_value, result)); } } XFree(at); } return have_def; } class XvRtConfig : public IRtConfig { VideoRendererWithLock* vr; avm::vector vattrsorig; Display* dpy; int xv_port; int have_def; public: XvRtConfig(VideoRendererWithLock* _vr, Display* _dpy, int _xv_port) : vr(_vr), dpy(_dpy), xv_port(_xv_port) { AVM_WRITE(__RENDERER__, "XV port: %d\n", xv_port); vr->Lock(); have_def = xv_scan_attrs(m_Attrs, dpy, &xv_port); vr->Unlock(); vattrsorig.resize(m_Attrs.size()); if (have_def) SetValue(xvset, 0); for (unsigned i = 0; i < m_Attrs.size(); ++i) SetValue(m_Attrs[i].GetName(), RegReadInt("aviplay", m_Attrs[i].GetName(), m_Attrs[i].GetDefault())); } virtual ~XvRtConfig() { // restore to defaults or at least those from the begining if (have_def) SetValue(xvset, 0); else for (unsigned i = 0; i < m_Attrs.size(); ++i) { int val = 0; GetValue(m_Attrs[i].GetName(), &val); RegWriteInt("aviplay", m_Attrs[i].GetName(), val); SetValue(m_Attrs[i].GetName(), m_Attrs[i].GetDefault()); } } // IRtConfig interface virtual int GetValue(const char* attr, int* result) const { vr->Lock(); Atom atom = XInternAtom(dpy, attr, True); XvGetPortAttribute(dpy, xv_port, atom, result); AVM_WRITE(__RENDERER__, 1, "xv: get %s:%d %d\n", attr, xv_port, *result); vr->Unlock(); return 0; } virtual int SetValue(const char* attr, int value) { vr->Lock(); Atom atom = XInternAtom(dpy, attr, True); XvSetPortAttribute(dpy, xv_port, atom, value); AVM_WRITE(__RENDERER__, 1, "xv: set %s:%d atom:%d value: %d\n", attr, xv_port, (int)atom, value); vr->Unlock(); return 0; } }; #else // HAVE_LIBXV class XvRtConfig : public IRtConfig { public: virtual int GetValue(const char* attr, int* result) const { return 0; } virtual int SetValue(const char* attr, int value) { return 0; } }; #endif // HAVE_LIBXV #if _SDL_VER > 1103 /** * * SDL YUV Renderer * * currently SDL is able to use only XShm XV extension * * * * */ class YUVRenderer: public FullscreenRenderer { protected: SDL_Overlay* m_ov; SDL_Overlay* m_zoomov; fourcc_t m_fmt; avm::vector ovlist; XvRtConfig* m_pXvRtConfig; public: YUVRenderer(PlayerWidget* pw, Display* _dpy, int _width, int _height, fourcc_t yuvm_fmt, bool _subtitles = false) : FullscreenRenderer(pw, _dpy, _width, _height, _subtitles), m_ov(0), m_zoomov(0), m_fmt(yuvm_fmt), m_pXvRtConfig(0) { } ~YUVRenderer() { delete m_pXvRtConfig; if (screen) { ReleaseImages(); Lock(); if (m_zoomov) SDL_FreeYUVOverlay(m_zoomov); if (m_ov) SDL_FreeYUVOverlay(m_ov); Unlock(); } } virtual int init() { if (dga) { AVM_WRITE(__MODULE__, "Requested DGA driver - YUV not available!"); return -1; } if (FullscreenRenderer::init() < 0) return -1; Lock(); // event thread is already running screen = SDL_SetVideoMode(pic_w, pic_h + m_sub, 0, fs); // fs &= ~SDL_DOUBLEBUF; // doesn't work with HW overlay // fs |= SDL_HWSURFACE; //screen->flags = fs; #if 0 AVM_WRITE(__RENDERER__, 1, "ScreenInfo: colorkey:0x%x alpha:0x%x\n", screen->format->colorkey, screen->format->alpha); #endif #if 0 char* tmp_array=new char[m_w*m_h*2]; char* tmp_array2=new char[m_w*m_h*2]; uint_t t1=localcount(); memcpy(tmp_array2, tmp_array, m_w*m_h*2); uint_t t2=localcount(); AVM_WRITE("Memory->memory copy: %f Mb/s\n", (_width*_height*3/2/1048576.)/((t2-t1)/freq/1000.)); delete[] tmp_array2; SDL_Overlay* ovs[200]; for (int i=0; i<200; ++i) { ovs[i]=SDL_CreateYUVOverlay(_width, _height, fccYV12, screen); SDL_LockYUVOverlay(ovs[i]); uint_t t=localcount(); memcpy(ovs[i]->pixels[0], tmp_array, _width*_height*3/2); uint_t t2=localcount(); SDL_UnlockYUVOverlay(ovs[i]); AVM_WRITE("overlay %d ( %f Mb used ): %f Mb/s\n", i, i*_width*_height*3/2/1048576., (_width*_height*3/2/1048576.)/((t2-t1)/freq/1000.)); } for (int i=0; i<200; ++i) SDL_FreeYUVOverlay(ovs[i]); delete[] tmp_array; #endif //printf("IMGFMT %x %.4s\n", m_fmt, (char*)&m_fmt); Unlock(); BitmapInfo bi(m_w, m_h, m_fmt); CImage* ci = ImageAlloc(bi, 0, 0); // creates m_ov if possible ci->Release(); if (!m_ov #if _SDL_VER>1104 // SDL <=1.1.5 does not have hw_overlay flag || !m_ov->hw_overlay #endif ) { const char* errmsg = (!m_ov) ? "Failed to create overlay" : "No hardware YUV acceleration detected!"; AVM_WRITE(__RENDERER__, "%s\n", errmsg); #if _SDL_VER>1106 if (m_ov && allow_sw_yuv) { AVM_WRITE(__RENDERER__, "*** Using SDL software YUV emulation ***\n" " Some codecs supports RGB modes natively - then you may\n" " achieve better performance with disabled YUV flag\n"); // do not bother user with Xlib warning messages avm_setenv("SDL_VIDEO_YUV_HWACCEL", "0", 1); } else #endif { if (m_ov) AVM_WRITE(__RENDERER__, "Your SDL library is too old and doesn't support software YUV emulation - upgrade SDL package!\n"); return -1; } } else { delete m_pSdlgRtConfig; m_pSdlgRtConfig = 0; } AVM_WRITE(__RENDERER__, 0, "created overlay: %dx%d %s\n", m_w, m_h, avm_img_format_name(m_fmt)); #ifdef HAVE_LIBXV if (!m_pSdlgRtConfig && m_ov->hw_overlay) { // hack - we want to get to the grabbed Xv port struct hack_privdata { int port; }; int port = ((struct hack_privdata*) m_ov->hwdata)->port; m_pXvRtConfig = new XvRtConfig(this, dpy, port); } #endif return 0; } virtual IRtConfig* GetRtConfig() const { return m_pXvRtConfig ? (IRtConfig*) m_pXvRtConfig : (IRtConfig*) m_pSdlgRtConfig; } virtual CImage* ImageAlloc(const BITMAPINFOHEADER& bh, uint_t idx, size_t align) { //printf("IA 0x%x==0x%x %d %d %d %d align:%" PRIsz " idx:%d-%" PRIsz "\n",bh.biCompression, m_fmt, // m_w, bh.biWidth, m_h, bh.biHeight, align, idx, ovlist.size()); align = 15; //HACK FIXME if (m_w != (int)bh.biWidth || m_h != (int)-bh.biHeight || bh.biCompression <= 32) return 0; Lock(); while (idx >= ovlist.size()) { // ok here is little trick // we need to use aligned size - but for display // we do not want to show these extra pixels // so here we will modify the size a little bit int mh = m_h; switch (bh.biCompression) { case fccI420: case fccYV12: if (align > 0) mh = ((m_h + (int)align) & (int)~align); break; } // make the image rounded for 16 // width aligned by 8 - fix for my broken i855 YUV driver //SDL_Overlay* o = SDL_CreateYUVOverlay((m_w + 7) & ~7, mh+8, bh.biCompression, screen); SDL_Overlay* o = SDL_CreateYUVOverlay((m_w + (int)align) & (int)~align, mh, bh.biCompression, screen); if (!o || o->h < mh || o->w < m_w) { AVM_WRITE(__RENDERER__, "Failed to create SDL Overlay: %dx%d\n", m_w, mh); return 0; } //printf("M_H:%d MH:%d H:%d W:%d M_W:%d 0x%x ,%d\n", m_h, mh, o->h, o->w, m_w, o->pixels[0], o->pitches[0]); if (m_h < mh) { #ifdef HAVE_LIBXV struct private_yuvhwdata { // copy from SDL header file int port; XShmSegmentInfo yuvshm; XvImage *image; }; //((struct private_yuvhwdata*) o->hwdata)->image->height = m_h; #endif // now modify the size //o->h = m_h - 8; // HACK!! } BitmapInfo bi(m_w, mh, bh.biCompression); // CHECKME return SDL1.1.3 compatibility const uint8_t* planes[3]; int stride[3]; planes[0] = o->pixels[0]; stride[0] = o->pitches[0]; switch (bh.biCompression) { case fccI420: case fccYV12: planes[1] = o->pixels[1]; planes[2] = o->pixels[2]; stride[1] = o->pitches[1]; stride[2] = o->pitches[2]; break; default: planes[1] = planes[2] = 0; stride[1] = stride[2] = 0; } CImage* ci = new CImage(&bi, planes, stride, false); //printf("NEW DATA %p %x\n", ci, ci->Format()); //AVM_WRITE("AFTERORIMGALO %d %d %p\n", idx, ovlist.size(), ovlist[idx]->pixels); ci->SetUserData(o); ci->SetAllocator(this); ci->Clear(); ovlist.push_back(ci); if (!m_ov) { SDL_Rect rect = { 0, 0, (Uint16)o->w, (Uint16)o->h }; // activate overlay so YUV preferencies // for brightness etc. can be set SDL_DisplayYUVOverlay(o, &rect); m_ov = o; } else if (idx == 0 && o) { // ok let's make it as a leading FMT SDL_FreeYUVOverlay(m_ov); m_ov = o; m_fmt = bh.biCompression; //printf("NEW GROUP %x\n", m_fmt); } } Unlock(); if (idx >= ovlist.size()) return 0; ovlist[idx]->AddRef(); if (m_uiImages <= idx) m_uiImages = idx + 1; return ovlist[idx]; } virtual void ReleaseImages() { Lock(); m_uiImages = 0; if (image) image->Release(); image = 0; while (ovlist.size() > 0) { SDL_Overlay* o = (SDL_Overlay*) ovlist.back()->GetUserData(); // leave initially allocate if (o != m_ov) SDL_FreeYUVOverlay(o); ovlist.back()->Release(); ovlist.pop_back(); } Unlock(); } virtual int Draw(const CImage* data) { // if we do not want to block our renderer while // keyboard event processing tries to lock this system // using just normal MUTEX - we are not writing anything to Xfree Lock(); if (!data) { if (!image) { Unlock(); return -1; } data = image; } m_lLastDrawStamp = avm_get_time_us(); data->AddRef(); if (image) image->Release(); image = data; //AVM_WRITE("DATA %x %x\n", data->GetFmt()->biCompression, m_fmt); //printf("ALLOCATOR %p %p %x %x %p\n", data->GetAllocator(), // data->GetUserData(), data->Format(), m_fmt, m_zoomov); if (m_zoomov || !data->GetUserData()) { SDL_Overlay* o = m_ov; CImage* datah = 0; if (m_zoomov) { o = m_zoomov; if (data->m_Window.w != m_Zoom.w) { const uint8_t* p[CIMAGE_MAX_PLANES] = { data->Data(0), data->Data(1), data->Data(2) }; int s[CIMAGE_MAX_PLANES] = { data->Stride(0), data->Stride(1), data->Stride(2) }; datah = new CImage(data->GetFmt(), p, s, false); datah->SetWindow(m_Zoom.x, m_Zoom.y, m_Zoom.w, m_Zoom.h); } } assert(o != 0); //SDL_LockYUVOverlay(o); BitmapInfo bi(o->w, o->h, m_fmt); //data->GetFmt()->Print(); //bi.Print(); // CHECKME return SDL1.0 compatibility const int stride[3] = { o->pitches[0], o->pitches[1], o->pitches[2] }; CImage ci(&bi, const_cast(o->pixels), stride, false); //printf("Set %d %d %d %d\n", m_Zoom.x, m_Zoom.y, m_Zoom.w, m_Zoom.h); ci.SetWindow(0, 0, m_Zoom.w, m_Zoom.h); if (datah) { ci.Convert(datah); datah->Release(); } else ci.Convert(data); //printf("CONVERT %p %x-%x %p\n", m_zoomov, data->Format(), m_fmt, data->GetUserData()); //SDL_UnlockYUVOverlay(o); } Unlock(); return 0; } virtual int Sync() { Lock(); //SDL_Rect rect = { -300, -300, (Uint16)pic_w*2, (Uint16)pic_h*2 };// + 1; SDL_Rect rect = { 0, 0, (Uint16)pic_w, (Uint16)pic_h };// + 1; SDL_Overlay* o = (m_zoomov) ? m_zoomov : (SDL_Overlay*) image->GetUserData(); if (!o) o = m_ov; assert(o != 0); #if 0 printf("OVERLA %p w:%d h:%d %d %d\n", o, o->w, o->h, pic_w, pic_h); // no surface lock as SDL documentation recommends! // the following operation might lock itself in XServer #ifdef HAVE_LIBXV struct private_yuvhwdata { // copy from SDL header file int port; XShmSegmentInfo yuvshm; XvImage *image; }; ((struct private_yuvhwdata*) o->hwdata)->image->height--; ((struct private_yuvhwdata*) o->hwdata)->image->width--; #endif #endif // now modify the size //o->h = m_h - 8; // HACK!! SDL_DisplayYUVOverlay(o, &rect); /* for (int i = 0; i < pic_h + 50; ++i) for (int j = 0; j < pic_w; ++j) ((short*)screen->pixels)[i * pic_w + j] = 0xffff - j; */ //SDL_UpdateRect(screen, rect.x, rect.y, rect.w, rect.h); //SDL_UpdateRect(screen, 0, 0, 0, 0); Unlock(); emutex.Lock(); econd.Broadcast(); emutex.Unlock(); return 0; } virtual int Zoom(int x, int y, int width, int height) { Lock(); if (m_zoomov) { SDL_FreeYUVOverlay(m_zoomov); m_zoomov = 0; } width = (width + 7) & ~7; height = (height + 1) & ~1; m_Zoom.x = (Sint16)(x & ~7); m_Zoom.y = (Sint16)(y & ~1); m_Zoom.w = (Uint16)width; m_Zoom.h = (Uint16)height; //printf("ZOOOM x:%d y:%d w:%d h:%d 0x%x %p\n", m_Zoom.x, m_Zoom.y, m_Zoom.w, m_Zoom.h, m_fmt, screen); if ((width == m_w && height == m_h) || m_Zoom.w <= 0 || m_Zoom.h <= 0) m_Zoom.w = m_Zoom.h = 0; // no cropping needed else m_zoomov = SDL_CreateYUVOverlay(m_Zoom.w, m_Zoom.h, m_fmt, screen); //printf("%d %d %d %d %d %d\n", m_Zoom.x, m_Zoom.y, m_Zoom.w, m_Zoom.h, width, height); if (m_zoomov) for (unsigned i = 0; i < ovlist.size(); ++i) ovlist[i]->SetWindow(m_Zoom.x, m_Zoom.y, m_Zoom.w, m_Zoom.h); //avm_vector_iterate(CImage*, ovlist, i) //(*i)->SetWindow(m_Zoom.x, m_Zoom.y, m_Zoom.w, m_Zoom.h); Unlock(); return 0; } protected: virtual int doResize(int& new_w, int& new_h) { if (new_w != m_w) new_w = (new_w + 7) & ~7; if (new_h != m_h) new_h = (new_h + 1) & ~1; if (new_w >= 8 && new_h >= 2 && (pic_w != new_w || pic_h != new_h)) { #if _SDL_VER > 1103 fs |= SDL_RESIZABLE; #endif screen = SDL_SetVideoMode(new_w, new_h + m_sub, 0, fs); if (screen) { pic_w = new_w; pic_h = new_h; return 0; } screen = SDL_SetVideoMode(pic_w, pic_h + m_sub, 0, fs); } new_w = pic_w; new_h = pic_h; //printf("Failed SET SCREEN2 = %p %d,%d,%d fs:%d\n", screen, pic_w, pic_h, m_sub, fs); return -1; } }; #endif // _SDL_VER > 1103 #ifdef HAVE_VIDIX #include #include #undef __MODULE__ #define __MODULE__ "VIDIX renderer" #define VIDIXCSTR(name) \ static const char name[] = #name VIDIXCSTR(VIDIX_BRIGHTNESS); VIDIXCSTR(VIDIX_CONTRAST); VIDIXCSTR(VIDIX_SATURATION); VIDIXCSTR(VIDIX_HUE); class VidixRtConfig : public IRtConfig { VideoRendererWithLock* vr; VDL_HANDLE handler; mutable vidix_video_eq_t info; public: VidixRtConfig(VideoRendererWithLock* _vr, VDL_HANDLE _handler) : vr(_vr), handler(_handler) { vdlPlaybackGetEq(handler, &info); if (info.cap & VEQ_CAP_BRIGHTNESS) m_Attrs.push_back(AttributeInfo(VIDIX_BRIGHTNESS, "Brightness", AttributeInfo::Integer, -1000, 1000, info.brightness)); if (info.cap & VEQ_CAP_CONTRAST) m_Attrs.push_back(AttributeInfo(VIDIX_CONTRAST, "Contrast", AttributeInfo::Integer, -1000, 1000, info.contrast)); if (info.cap & VEQ_CAP_SATURATION) m_Attrs.push_back(AttributeInfo(VIDIX_SATURATION, "Saturation", AttributeInfo::Integer, -1000, 1000, info.saturation)); if (info.cap & VEQ_CAP_HUE) m_Attrs.push_back(AttributeInfo(VIDIX_HUE, "Hue", AttributeInfo::Integer, -1000, 1000, info.hue)); //for (avm::vector::const_iterator it = m_Attrs.begin(); it != m_Attrs.end(); ++it) //vector_iterate_const(avm::AttributeInfo, m_Attrs, i) // SetValue((*i).GetName(), RegReadInt("aviplay", (*i).GetName(), (*i).GetDefault())); for (unsigned i = 0; i < m_Attrs.size(); ++i) SetValue(m_Attrs[i].GetName(), RegReadInt("aviplay", m_Attrs[i].GetName(), m_Attrs[i].GetDefault())); } virtual ~VidixRtConfig() { for (unsigned i = 0; i < m_Attrs.size(); ++i) { int val = 0; GetValue(m_Attrs[i].GetName(), &val); RegWriteInt("aviplay", m_Attrs[i].GetName(), val); //printf("WRITE %s %d\n", m_Attrs[i].GetName(), val); SetValue(m_Attrs[i].GetName(), m_Attrs[i].GetDefault()); } } // IRtConfig interface virtual int GetValue(const char* attr, int* result) const { int r = 0; vr->Lock(); if (vdlPlaybackGetEq(handler, &info) != 0) r = -1; else if (info.cap & VEQ_CAP_BRIGHTNESS && !strcasecmp(attr, VIDIX_BRIGHTNESS)) *result = info.brightness; else if (info.cap & VEQ_CAP_CONTRAST && !strcasecmp(attr, VIDIX_CONTRAST)) *result = info.contrast; else if (info.cap & VEQ_CAP_SATURATION && !strcasecmp(attr, VIDIX_SATURATION)) *result = info.saturation; else if (info.cap & VEQ_CAP_HUE && !strcasecmp(attr, VIDIX_HUE)) *result = info.hue; else r = -1; vr->Unlock(); //printf("RESULT %s %d\n", attr, *result); return r; } virtual int SetValue(const char* attr, int value) { int r = 0; vr->Lock(); if (!strcmp(attr, VIDIX_BRIGHTNESS)) info.brightness = value; else if (!strcmp(attr, VIDIX_CONTRAST)) info.contrast = value; else if (!strcmp(attr, VIDIX_SATURATION)) info.saturation = value; else if (!strcmp(attr, VIDIX_HUE)) info.hue = value; else r = -1; if (r == 0 && vdlPlaybackSetEq(handler, &info) != 0) r = -1; vr->Unlock(); return r; } }; #undef VIDIXCSTR class VidixRenderer : public FullscreenRenderer { VDL_HANDLE m_vidix_handler; vidix_capability_t m_vidix_cap; vidix_playback_t m_vidix_play; vidix_fourcc_t m_vidix_fourcc; vidix_yuv_t dstrides; uint32_t apitch; uint8_t* vidix_mem; int next_frame; int image_Bpp; int x, y; uint32_t bgclr; VidixRtConfig* m_pVidixRtConfig; avm::vector ovlist; public: VidixRenderer(PlayerWidget* pw, Display* _dpy, int _width, int _height, fourcc_t fmt, bool _subtitles = false) : FullscreenRenderer(pw, _dpy, _width, _height, _subtitles), next_frame(0), bgclr(0), m_pVidixRtConfig(0) { m_vidix_fourcc.fourcc = fmt; m_vidix_fourcc.srcw = m_w; m_vidix_fourcc.srch = m_h; } virtual ~VidixRenderer() { delete m_pVidixRtConfig; vdlPlaybackOff(m_vidix_handler); vdlClose(m_vidix_handler); } virtual int init() { if (vdlGetVersion() != VIDIX_VERSION) { AVM_WRITE(__MODULE__, "vidix incompatible library version"); return -1; } m_vidix_handler = vdlOpen(VIDIX_LIBDIR, 0, TYPE_OUTPUT, 0); //m_vidix_handler = vdlOpen(VIDIX_LIBDIR, "librage128.so", TYPE_OUTPUT, 0/*verbose*/); //m_vidix_handler = vdlOpen(VIDIX_LIBDIR, "libmga_crtc2.so", TYPE_OUTPUT, 0/*verbose*/); if (!m_vidix_handler) { AVM_WRITE(__MODULE__, "can't be opened"); return -1; } if (vdlGetCapability(m_vidix_handler, &m_vidix_cap) != 0) { AVM_WRITE(__MODULE__, "can't get capabilities"); return -1; } char fc[4]; avm_set_le32(fc, m_vidix_fourcc.fourcc); AVM_WRITE(__MODULE__, "Opened vidix renderer - FCC: %.4s\n", fc); AVM_WRITE(__MODULE__, "Description: %s\n", m_vidix_cap.name); AVM_WRITE(__MODULE__, "Author: %s\n", m_vidix_cap.author); if (((m_vidix_cap.maxwidth != -1) && (m_w > m_vidix_cap.maxwidth)) || ((m_vidix_cap.minwidth != -1) && (m_w < m_vidix_cap.minwidth)) || ((m_vidix_cap.maxheight != -1) && (m_h > m_vidix_cap.maxheight)) || ((m_vidix_cap.minwidth != -1 ) && (m_h < m_vidix_cap.minheight))) { AVM_WRITE(__MODULE__, "unsupported resolution (min/max width/height)"); return -1; } if (vdlQueryFourcc(m_vidix_handler, &m_vidix_fourcc) != 0) { AVM_WRITE(__MODULE__, "unsupported fourcc"); return -1; } unsigned int err; switch (bit_depth) { case 1: err = VID_DEPTH_1BPP; break; case 2: err = VID_DEPTH_2BPP; break; case 4: err = VID_DEPTH_4BPP; break; case 8: err = VID_DEPTH_8BPP; break; case 12: err = VID_DEPTH_12BPP; break; case 15: err = VID_DEPTH_15BPP; break; case 16: err = VID_DEPTH_16BPP; break; case 24: err = VID_DEPTH_24BPP; break; case 32: err = VID_DEPTH_32BPP; break; default: err=~0U; break; } err = ((m_vidix_fourcc.depth & err) != err); if (m_vidix_fourcc.flags & VID_CAP_COLORKEY) { vidix_grkey_t gr_key; vdlGetGrKeys(m_vidix_handler, &gr_key); gr_key.key_op = KEYS_PUT; gr_key.ckey.op = CKEY_TRUE; gr_key.ckey.red = 4; gr_key.ckey.green = 0; gr_key.ckey.blue = 247; #if _SDL_VER > 1103 bgclr = SDL_MapRGBA(screen->format, gr_key.ckey.red, gr_key.ckey.green, gr_key.ckey.blue, 0); #else #warning RGB map missing #endif vdlSetGrKeys(m_vidix_handler, &gr_key); } doResize(pic_w, pic_h); delete m_pSdlgRtConfig; m_pSdlgRtConfig = 0; m_pVidixRtConfig = new VidixRtConfig(this, m_vidix_handler); return 0; } virtual IRtConfig* GetRtConfig() const { return m_pVidixRtConfig; } //virtual uint_t GetImages() const { return 0; } virtual CImage* ImageAlloc(const BITMAPINFOHEADER& bh, uint_t idx, uint_t align) { // vidix provides slow real graphics card memory // so it could be only usable with draw_band //printf("IMAGEALLOC %d %d\n", idx, m_vidix_play.num_frames); Locker locker(m_Mutex); if (0 || idx >= m_vidix_play.num_frames || bh.biCompression != IMG_FMT_YV12) return 0; if (idx >= ovlist.size()) { BitmapInfo bi(m_w, m_h, m_vidix_fourcc.fourcc); const uint8_t* plane[3] = { vidix_mem + m_vidix_play.offsets[idx] + m_vidix_play.offset.y, vidix_mem + m_vidix_play.offsets[idx] + m_vidix_play.offset.u, vidix_mem + m_vidix_play.offsets[idx] + m_vidix_play.offset.v }; const int stride[3] = { dstrides.y, dstrides.u, dstrides.v }; //printf("stride %d %d %d\n", dstrides.y, dstrides.u, dstrides.v); CImage* ci = new CImage(&bi, plane, stride, false); m_uiImages = ++idx; ci->SetUserData((void*)idx); ci->SetAllocator(this); ovlist.push_back(ci); } return ovlist[idx]; } virtual void ReleaseImages() { Locker locker(m_Mutex); m_uiImages = 0; if (image) image->Release(); image = 0; while (ovlist.size() > 0) { ovlist.back()->Release(); ovlist.pop_back(); } } virtual int Draw(const CImage* data) { // if we do not want to block our renderer while // keyboard event processing tries to lock this system // using just normal MUTEX - we are not writing anything to Xfree Locker locker(m_Mutex); if (!data) { if (!image) return -1; data = image; } m_lLastDrawStamp = avm_get_time_us(); data->AddRef(); if (image) image->Release(); if (data->GetAllocator() == this) { image = data; return 0; } //AVM_WRITE("DATA %x %x\n", data->GetFmt()->biCompression, m_fmt); BitmapInfo bi(m_w, m_h, m_vidix_fourcc.fourcc); //printf("CONVERT from to ############ %.4s\n", (char*)&m_vidix_fourcc.fourcc); //data->GetFmt()->Print(); //bi.Print(); const uint8_t* plane[3] = { vidix_mem + m_vidix_play.offsets[next_frame] + m_vidix_play.offset.y, vidix_mem + m_vidix_play.offsets[next_frame] + m_vidix_play.offset.u, vidix_mem + m_vidix_play.offsets[next_frame] + m_vidix_play.offset.v }; const int stride[3] = { dstrides.y, dstrides.u, dstrides.v }; //printf("%.4s %d %d %d %p %p %p %p %p %p\n", (char*)&m_vidix_fourcc.fourcc, stride[0], stride[1], stride[2], //plane[0], plane[1], plane[2], data->Data(0), data->Data(1), data->Data(2)); // FIXME direct memcopy should be handled with DMA here // reading memory from MGA G400 is about 22 times slower then real RAM //int64_t ys = avm_get_time_us(); int b = 0; for(int i = 0; i < 100000; ++i) b += plane[0][i]; int64_t ye = avm_get_time_us(); //int64_t xs = avm_get_time_us(); int a = 0; for(int i = 0; i < 100000; ++i) a += data->m_pPlane[0][i]; int64_t xe = avm_get_time_us(); //printf("XF %d %lld %d %lld\n", a, xe - xs, b, ye - ys); CImage* ci = new CImage(&bi, plane, stride, false); ci->Convert(data); data->Release(); image = ci; return 0; } virtual int Sync() { if (m_vidix_play.num_frames > 1) { Locker locker(m_Mutex); if (image && image->GetAllocator() == this) { next_frame = (int)image->GetUserData() % m_uiImages; //printf("NEXT %d %d\n", next_frame, m_vidix_play.num_frames); } vdlPlaybackFrameSelect(m_vidix_handler, next_frame); next_frame = (next_frame + 1) % m_vidix_play.num_frames; } emutex.Lock(); econd.Broadcast(); emutex.Unlock(); return 0; } virtual int Refresh() { Lock(); int nx = 0, ny = 0; doGetPosition(nx, ny); //printf("XPO %d %d %d %d\n", nx, ny, x, y); if (x != nx || y != ny || screen->flags & SDL_FULLSCREEN) doResize(pic_w, pic_h); Unlock(); return FullscreenRenderer::Refresh(); } protected: virtual int doResize(int& new_w, int& new_h) { int i = FullscreenRenderer::doResize(new_w, new_h); if (reinit() != 0) return -1; SDL_FillRect(screen, &cliprect, bgclr); SDL_UpdateRect(screen, cliprect.x, cliprect.x, cliprect.w, cliprect.h); return i; } int reinit() { //printf("FLAG %x %x\n", screen->flags & SDL_FULLSCREEN, screen->flags); if (screen->flags & SDL_FULLSCREEN) x = y = 0; else doGetPosition(x, y); //printf("POS X %d Y %d \n", x, y); memset(&m_vidix_play, 0, sizeof(vidix_playback_t)); m_vidix_play.fourcc = m_vidix_fourcc.fourcc; m_vidix_play.capability = m_vidix_cap.flags; /* every ;) */ m_vidix_play.blend_factor = 0; /* for now */ m_vidix_play.src.x = (x < 0) ? 0 * -x : 0; m_vidix_play.src.y = (y < 0) ? 0 * -y : 0; m_vidix_play.src.w = (x < 0) ? m_w + 0*x : m_w; m_vidix_play.src.h = (y < 0) ? m_h + 0*y : m_h; m_vidix_play.dest.x = (x < 0) ? 0 : x; m_vidix_play.dest.y = (y < 0) ? 0 : y; m_vidix_play.dest.w = (x < 0) ? pic_w + x : pic_w; m_vidix_play.dest.h = (y < 0) ? pic_h + y : pic_h; m_vidix_play.num_frames = 6;//vo_doublebuffering?NUM_FRAMES-1:1; m_vidix_play.src.pitch.y = m_vidix_play.src.pitch.u = m_vidix_play.src.pitch.v = 0; vidix_video_eq_t vinfo; vdlPlaybackGetEq(m_vidix_handler, &vinfo); vdlPlaybackOff(m_vidix_handler); if (vdlConfigPlayback(m_vidix_handler, &m_vidix_play) != 0) { AVM_WRITE(__MODULE__, "can't configure playback"); return -1; } vidix_mem = (uint8_t*) m_vidix_play.dga_addr; // vdlPlaybackFrameSelect(vidix_handler,next_frame); /* clear every frame with correct address and frame_size */ for (unsigned i = 0; i < m_vidix_play.num_frames; ++i) memset(vidix_mem + m_vidix_play.offsets[i], 0x80, m_vidix_play.frame_size); vdlPlaybackOn(m_vidix_handler); vdlPlaybackSetEq(m_vidix_handler, &vinfo); //int err; //if ((err = vdlPlaybackOn(m_vidix_handler))!=0) // throw FATAL("can't start playback: %s\n", strerror(err)); //printf("PITCH %d %d %d\n",m_vidix_play.dest.pitch.y,m_vidix_play.dest.pitch.u,m_vidix_play.dest.pitch.v); apitch = m_vidix_play.dest.pitch.y - 1; dstrides.y = (m_w + apitch) & ~apitch; dstrides.u = dstrides.v = 0; switch(m_vidix_fourcc.fourcc) { case IMG_FMT_YV12: case IMG_FMT_I420: case IMG_FMT_IYUV: case IMG_FMT_YVU9: case IMG_FMT_IF09: case IMG_FMT_Y800: case IMG_FMT_Y8: dstrides.v = dstrides.u = dstrides.y; image_Bpp=1; break; case IMG_FMT_RGB32: case IMG_FMT_BGR32: dstrides.y *= 4; image_Bpp=4; break; case IMG_FMT_RGB24: case IMG_FMT_BGR24: dstrides.y *= 3; image_Bpp=3; break; default: dstrides.y *= 2; image_Bpp=2; break; } switch(m_vidix_fourcc.fourcc) { case IMG_FMT_YVU9: case IMG_FMT_IF09: dstrides.u /= 4; dstrides.v /= 4; break; case IMG_FMT_I420: case IMG_FMT_IYUV: case IMG_FMT_YV12: dstrides.u /= 2; dstrides.v /= 2; break; } //printf("strideB %d %d %d\n", dstrides.y, dstrides.u, dstrides.v); /* apitch = m_vidix_play.dest.pitch.y - 1; dstrides.y = (dstrides.y + apitch) & ~apitch; apitch = m_vidix_play.dest.pitch.v - 1; dstrides.v = (dstrides.v + apitch) & ~apitch; apitch = m_vidix_play.dest.pitch.u - 1; dstrides.u = (dstrides.u + apitch) & ~apitch; */ //printf("strideC %d %d %d\n", dstrides.y, dstrides.u, dstrides.v); //printf("strideXX %d %d %d\n", m_vidix_play.dest.pitch.y, m_vidix_play.dest.pitch.v, m_vidix_play.dest.pitch.u); return 0; } }; #endif /* HAVE_VIDIX */ IVideoRenderer* CreateFullscreenRenderer(IPlayerWidget* pw, void* dpy, int width, int height, bool sub) { FullscreenRenderer* fr = new FullscreenRenderer(pw, (Display*)dpy, width, height, sub); if (fr && (fr->init() == 0)) return fr; delete fr; return 0; } IVideoRenderer* CreateYUVRenderer(IPlayerWidget* pw, void* dpy, int width, int height, fourcc_t yuv_fmt, bool sub) { #ifdef HAVE_VIDIX if (geteuid() == 0) { // for root user try to use VIDIX VidixRenderer* vr = new VidixRenderer(pw, (Display*)dpy, width, height, yuv_fmt, sub); if (vr && (vr->init() == 0)) return vr; delete vr; } #endif // HAVE_VIDIX #if _SDL_VER > 1103 YUVRenderer* yr = new YUVRenderer(pw, (Display*)dpy, width, height, yuv_fmt, sub); if (yr && (yr->init() == 0)) return yr; delete yr; #else AVM_WRITE(__RENDERER__, "SDL library too old - no XV support available\n"); #endif // _SDL_VER return 0; } IVideoRenderer* CreateVidixRenderer(IPlayerWidget* pw, void* dpy, int width, int height, fourcc_t yuv_fmt, bool sub) { #ifdef HAVE_VIDIX VidixRenderer* vr = new VidixRenderer(pw, (Display*)dpy, width, height, yuv_fmt, sub); if (vr && (vr->init() == 0)) return vr; delete vr; #else // HAVE_VIDIX AVM_WRITE(__RENDERER__, "library compiled without VIDIX support - sorry no rendering\n"); #endif // HAVE_VIDIX return 0; } #else /* HAVE_LIBSDL */ static const char norend[] = "\n\n!!! libaviplay library has been compiled WITHOUT SDL support !!!\n" " sorry no rendering available - if you want to see VIDEO\n" " recompile library with SDL support - check why detection of SDL failed\n" " if you have problems send message to zdenek.kabelac@gmail.com\n\n"; IVideoRenderer* CreateFullscreenRenderer(IPlayerWidget* pw, void* dpy, int width, int height, bool sub) { AVM_WRITE(__RENDERER__, norend); return 0; } IVideoRenderer* CreateYUVRenderer(IPlayerWidget* pw, void* dpy, int width, int height, fourcc_t yuv_fmt, bool sub) { AVM_WRITE(__RENDERER__, norend); return 0; } #endif /* HAVE_LIBSDL */ #undef __MODULE__ AVM_END_NAMESPACE; #endif /* X_DISPLAY_MISSING */ avifile-0.7.48~20090503.ds/lib/video/rendlock.h0000644000175000017500000000264111176341513017574 0ustar yavoryavor#ifndef RENDLOCK_H #define RENDLOCK_H #include "avm_locker.h" #include "avm_cpuinfo.h" #include "renderer.h" #include "playerwidget.h" #include "utils.h" AVM_BEGIN_NAMESPACE; // use our internal class for our renderers; class VideoRendererWithLock : public IVideoRenderer { public: VideoRendererWithLock(int width, int height, bool _subtitles = false) :m_w(width), m_h(height), pic_w(width), pic_h(height), m_sub(0), m_iFontHeight(0), m_lLastDrawStamp(0), m_pPw(0), m_iAuto(1), m_bQuit(false), m_bSubtitles(_subtitles) {} virtual ~VideoRendererWithLock(); virtual int Lock() const { return m_Mutex.Lock(); } virtual int TryLock() const { return m_Mutex.TryLock(); } virtual int Unlock() const { return m_Mutex.Unlock(); } virtual const avm::vector& GetVideoModes() const { return modes; } virtual int GetSize(int& width, int& height) const { width = pic_w; height = pic_h; return 0; } virtual int processEvent() = 0; protected: virtual int init() { return 0; } static void* eventThread(void *arg); mutable PthreadMutex m_Mutex; int m_w, m_h; int pic_w, pic_h; unsigned int m_sub; int m_iFontHeight; PthreadMutex emutex; PthreadCond econd; int64_t m_lLastDrawStamp; avm::vector modes; PlayerWidget* m_pPw; int m_iAuto; // keyboard autorepeat bool m_bQuit; bool m_bSubtitles; }; AVM_END_NAMESPACE; #endif avifile-0.7.48~20090503.ds/lib/video/sub_ft.cpp0000644000175000017500000000571607760345556017635 0ustar yavoryavor #include #include #include #include #ifdef HAVE_LIBFREETYPE #include #include FT_FREETYPE_H //#include #if (FREETYPE_MAJOR > 2) || (FREETYPE_MAJOR == 2 && FREETYPE_MINOR >= 1) #define HAVE_FREETYPE21 #endif AVM_BEGIN_NAMESPACE; struct ci_font_t { ci_surface_t* bitmap; int width; int height; int index; // local vars - used by ft2 }; static inline int int_f266(int x) { return x * 64; } static inline int f266_int(int x) { return x / 64; } class FontRend_FT { public: FontRend_FT() : m_Lib(0), m_Face(0) {} int Open(const char* filename, int faceindex, int size) { if (FT_Init_FreeType(&m_Lib)) { AVM_WRITE("FTREND", "error Open FT Library\n"); return -1; } int r = FT_New_Face(m_Lib, filename, 0, &m_Face); if (r == FT_Err_Unknown_File_Format) { AVM_WRITE("FTREND", "the font file could be opened and read," "but it appears that its font format is unsupported\n"); return -1; } else if (r) { AVM_WRITE("FTREND", "font file can't be open\n"); return -1; } FT_Select_Charmap(m_Face, ft_encoding_unicode); if (!m_Face->charmap || m_Face->charmap->encoding != ft_encoding_unicode) { AVM_WRITE("FTREND", "unicode charmap not available for this font!\n"); if (FT_Set_Charmap(m_Face, m_Face->charmaps[0])) AVM_WRITE("FTREND", "no charmaps!\n"); } if (FT_IS_SCALABLE(m_Face)) { if (FT_Set_Char_Size(m_Face, 0, int_f266(size), 0, 0)); //72dpi AVM_WRITE("FTREND", "Set_Char_Size for scalable font fails???"); } else { // FIXME Set_Pixel_Sizes } if (FT_IS_FIXED_WIDTH(m_Face)) AVM_WRITE("FTREND", "fixed width.\n"); m_bKerning = FT_HAS_KERNING(m_Face); // read font return 0; } void Close() { FT_Done_FreeType(m_Lib); } const ci_font_t* GetChar(int ch, const ci_font_t* prev = 0, int* kern_x = 0) { const ci_font_t* t = m_Map.find(ch); if (!t) { ci_font_t n; n.index = FT_Get_Char_Index(m_Face, ch); int r = FT_Load_Glyph(m_Face, n.index, FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING); FT_Bitmap bit; if (m_Face->glyph->format == ft_glyph_format_outline) { // bit.pixel_mode = ft_pixel_mode_mono; //bit.rows = bit.pixel_mode = ft_pixel_mode_grays; memset(bit.buffer, 0, bit.rows * bit.pitch); } //if (FT_Get_Glyph_Bitmap(m_Face, &bit)) // AVM_WRITE("FTREND", "error GetGlyphBitmap\n"); m_Map.insert(ch, n); t = m_Map.find(ch); } if (m_bKerning && prev && kern_x) { FT_Vector delta; FT_Get_Kerning(m_Face, prev->index, t->index, ft_kerning_default, &delta); *kern_x = f266_int(delta.x); } return t; } protected: avm::avm_map m_Map; FT_Library m_Lib; FT_Face m_Face; int m_iSpace; bool m_bKerning; }; AVM_END_NAMESPACE; #endif // HAVE_FREETYPE avifile-0.7.48~20090503.ds/lib/video/sub_x11.cpp0000644000175000017500000000016007557515124017613 0ustar yavoryavor class FontRendX11 { public: FontRendX11(Display* d, Window* w) {} Draw() {} Convert() {} } avifile-0.7.48~20090503.ds/lib/video/subrend.h0000644000175000017500000000057407557515124017451 0ustar yavoryavor#include "avm_stl.h" class ISubRenderer { public: virtual ~ISubRenderer() {} virtual int Open(const char* fontname) =0; virtual int Draw(const char* lines) =0; protected: virtual int addChar(int i); // add one char to current line virtual int getWidth(); // get actual width of current text virtual int parse(); avm::vector m_Lines; }; avifile-0.7.48~20090503.ds/libavqt/0000755000175000017500000000000011267646347015423 5ustar yavoryavoravifile-0.7.48~20090503.ds/libavqt/Makefile.am0000644000175000017500000000236111110536760017441 0ustar yavoryavorif AMM_USE_QT lib_LTLIBRARIES = libqavm.la check_PROGRAMS = testcodecs endif noinst_HEADERS = \ codecdialog.h \ okdialog.h \ pixmapbutton.h libqavm_la_SOURCES = \ codecdialog.cpp \ okdialog.cpp EXTRA_DIST = \ audc_p.cpp \ audc.cpp \ audc_p.h \ audc.h testcodecs_SOURCES = testcodecs.cpp # hierarchyview.cpp \ # propertyeditor.cpp if AMM_LINK_SHARED LINK_AVIPLAY = ../lib/libaviplay.la endif #testt libqavm_la_LDFLAGS = -release $(AVIFILE_MAJOR_VERSION).$(AVIFILE_MINOR_VERSION) -version-info 0:$(AVIFILE_MICRO_VERSION):0 libqavm_la_LIBADD = $(LINK_AVIPLAY) $(QT_LIBS) TEST_LIBS = ../lib/libaviplay.la $(lib_LTLIBRARIES) #testt_SOURCES = testt.cpp #testt_LDFLAGS = $(TEST_LIBS) #order.cpp testcodecs_LDFLAGS = $(TEST_LIBS) #noinst_PROGRAMS = ordertest #ordertest_SOURCES = order.cpp #ordertest_LDADD = $(LIBRARY) #LIBRARY = ../lib/libaviplay.la -lm AM_CXXFLAGS = $(VISIBILITYFLAG) AM_CPPFLAGS = $(QT_CFLAGS) -DPIXMAP_PATH=\"$(pkgdatadir)/pixmaps\" CLEANFILES = ordertest testcodecs *.moc #SUFFIXES = .moc .ui #%.moc: %.h # $(MOC) < $< > $@ .h.moc: $(MOC) < $< > $@ # this is how we have to handle dependencies to .moc files $(srcdir)/okdialog.cpp: okdialog.moc $(srcdir)/codecdialog.cpp: codecdialog.moc MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/libavqt/audc.cpp0000644000175000017500000000104407400674376017037 0ustar yavoryavor#include "audc.h" #include /* * Constructs a Test which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ AvOrderedDialog::AvOrderedDialog( QWidget* parent ) { } /* * Destroys the object and frees any allocated resources */ AvOrderedDialog::~AvOrderedDialog() { // no need to delete child widgets, Qt does it all for us } void AvOrderedDialog::accept() { } #include "audc.moc" avifile-0.7.48~20090503.ds/libavqt/audc.h0000644000175000017500000000040407340561453016475 0ustar yavoryavor#ifndef QTAVORDEREDDIALOG_H #define QTAVORDEREDDIALOG_H #include "audc_p.h" class AvOrderedDialog : public QtavOrderedDialogG { Q_OBJECT public: AvOrderedDialog( QWidget* parent); ~AvOrderedDialog(); void accept(); }; #endif // AUDIOCOMP_H avifile-0.7.48~20090503.ds/libavqt/audc_p.cpp0000644000175000017500000000324007454636275017363 0ustar yavoryavor/**************************************************************************** ****************************************************************************/ #include "audc_p.h" #include #include #include #include //#include #include #include /* */ QtavOrderedDialogG::QtavOrderedDialogG( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "AudioCompress" ); resize( 256, 102 ); setCaption( tr( "Audio compression format" ) ); PushButton1_2 = new QPushButton( this, "PushButton1_2" ); PushButton1_2->setGeometry( QRect( 162, 56, 80, 26 ) ); PushButton1_2->setText( tr( "Cancel" ) ); TextLabel1 = new QLabel( this, "TextLabel1" ); TextLabel1->setGeometry( QRect( 14, 19, 92, 22 ) ); TextLabel1->setText( tr( "Audio compression:" ) ); ComboBox1 = new QComboBox( FALSE, this, "ComboBox1" ); ComboBox1->insertItem( tr( "None" ) ); ComboBox1->insertItem( tr( "MP3" ) ); ComboBox1->setGeometry( QRect( 112, 19, 130, 22 ) ); PushButton1 = new QPushButton( this, "PushButton1" ); PushButton1->setGeometry( QRect( 67, 56, 89, 26 ) ); PushButton1->setText( tr( "Ok" ) ); // signals and slots connections connect( PushButton1, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( PushButton1_2, SIGNAL( clicked() ), this, SLOT( reject() ) ); } /* * Destroys the object and frees any allocated resources */ QtavOrderedDialogG::~QtavOrderedDialogG() { // no need to delete child widgets, Qt does it all for us } #include "audc_p.moc" avifile-0.7.48~20090503.ds/libavqt/audc_p.h0000644000175000017500000000160107340511523017005 0ustar yavoryavor/**************************************************************************** ** Form interface generated from reading ui file './audc.ui' ** ** Created: Sun Sep 24 03:34:28 2000 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ #ifndef QTAVORDEREDDIALOGG_H #define QTAVORDEREDDIALOGG_H #include class QVBoxLayout; class QHBoxLayout; class QGridLayout; class QComboBox; class QLabel; class QPushButton; class QtavOrderedDialogG : public QDialog { Q_OBJECT public: QtavOrderedDialogG( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~QtavOrderedDialogG(); QPushButton* PushButton1_2; QLabel* TextLabel1; QComboBox* ComboBox1; QPushButton* PushButton1; }; #endif // QTAVORDEREDDIALOGG_H avifile-0.7.48~20090503.ds/libavqt/codecdialog.cpp0000644000175000017500000003673311004337416020357 0ustar yavoryavor#include "codecdialog.h" #include "codecdialog.moc" #include "pixmapbutton.h" #include "avm_cpuinfo.h" #include "avm_creators.h" #include "configfile.h" #include "videoencoder.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if QT_VERSION > 220 #include #include #include #endif #include #include QavmPixmapButton::QavmPixmapButton(const char* ficon, QWidget* _parent) :QToolButton( _parent ) //:QPushButton( _parent ) { QString file = QString::fromLatin1( PIXMAP_PATH "/" ) + QString::fromLatin1( ficon ) + QString::fromLatin1( ".ppm" ); QPixmap p(file); p.setMask(p.createHeuristicMask()); setIconSet(QIconSet(p)); #if QT_VERSION >= 300 // setFlat(TRUE); #endif //setFixedSize(p.width() + 8, p.height() + 8); } QavmCodecDialog::Input::Input(QWidget* parent, const QString& title, const QString& defval) :QavmOkDialog( parent, title, true ), val(defval) { setCaption( QString( tr("Enter new ") ) + title ); m_pEdit = new QLineEdit( val, this ); gridLayout()->addWidget( m_pEdit, 0, 0 ); } void QavmCodecDialog::Input::accept() { val = m_pEdit->text(); return QDialog::accept(); } /* QavmCodecDialog::QInputBoolean::QInputBoolean(QWidget* parent, QString title, int defval) :QavmOkDialog( parent, title, true ), _defval(defval) { char txt[256]; sprintf(txt, "%d", defval); setCaption( QString( "Enter new " ) + title ); m_pEdit = new QLineEdit( txt, this ); gridLayout()->addWidget( m_pEdit, 0, 0 ); } */ QavmCodecDialog::InputSelect::InputSelect(QWidget* parent, const QString& title, const avm::vector& options, int defval) :QavmOkDialog( parent, title, true ), _options(options), _defval(defval) { setCaption( QString( tr("Enter new ") ) + title ); m_pBox = new QComboBox( QString().sprintf("%d", defval), this ); gridLayout()->addWidget( m_pBox, 0, 0); int i = 0; avm::vector::const_iterator it; for(it = _options.begin(); it != _options.end(); it++) { m_pBox->insertItem(_options[i].c_str(), i); i++; } m_pBox->setCurrentItem(_defval); } void QavmCodecDialog::InputSelect::accept() { _defval = m_pBox->currentItem(); return QDialog::accept(); } QavmCodecDialog::QavmCodecDialog( QWidget* parent, const avm::vector& codecs, avm::CodecInfo::Direction dir ) :QavmOkDialog( parent, "Select codec", true ), m_Codecs(codecs), m_Direction(dir), m_pKeyframe(0), m_pQuality(0) { m_Order.resize(codecs.size()); for (unsigned i = 0; i < codecs.size(); i++) m_Order[i] = i; createGui(); //printf("CodecDialog: %x q:%d, %s\n", info.compressor, info.quality, info.cname.c_str()); #if QT_VERSION > 220 connect(m_pListCodecs, SIGNAL( selectionChanged() ), this, SLOT( selectCodec() ) ); #else // Qt2.0 compatible - instead connect(m_pListCodecs, SIGNAL( highlighted( int ) ), this, SLOT( selectCodec() ) ); #endif connect(m_pListCodecs, SIGNAL( selected( QListBoxItem* ) ), this, SLOT( selectCodec() ) ); codecUpdateList(); setCurrent( 0 ); } /* * Destroys the object and frees any allocated resources */ QavmCodecDialog::~QavmCodecDialog() { // no need to delete child widgets, Qt does it all for us } avm::VideoEncoderInfo QavmCodecDialog::getInfo() { avm::VideoEncoderInfo info; int codec = getCurrent(); info.compressor = m_Codecs[codec]->fourcc; info.cname = m_Codecs[codec]->GetName(); printf("CodecDialog returns: %x, %s\n", info.compressor, info.cname.c_str()); return info; } int QavmCodecDialog::getCurrent() const { int c = m_pListCodecs->currentItem(); return c < (int) m_Order.size() ? m_Order[c] : 0; } void QavmCodecDialog::setCurrent( int c ) { m_pListCodecs->setCurrentItem( c ); } void QavmCodecDialog::about() { int codec = getCurrent(); if (codec < (int) m_Codecs.size()) QMessageBox::information( this, m_Codecs[codec]->GetName(), QString("

") + m_Codecs[codec]->GetAbout(), QMessageBox::Ok ); } void QavmCodecDialog::shortNames(int) { //selectCodec(); codecUpdateList(); } void QavmCodecDialog::accept() { return QDialog::accept(); } void QavmCodecDialog::clickedAttr( QListViewItem* item ) { //const AttributeInfo& ai = m_Codecs[codec].encoder_info; if (!item) return; QString str = item->text(1); int codec = getCurrent(); const avm::vector ci = m_Codecs[codec]->encoder_info; int row = 0; avm::vector::const_iterator it; for (it = ci.begin(); it != ci.end(); row++, it++) if (!strcmp(it->GetAbout(), str.ascii())) { if (it->GetMin() == 0 && it->GetMax() == 1) { avm::CodecSetAttr(*m_Codecs[codec], it->GetName(), ((QCheckListItem*)item)->isOn() ? 1 : 0); //printf("STR %s %d %d\n", str.ascii(), row, ((QCheckListItem*)item)->isOn()); } break; } } // backward compatible method void QavmCodecDialog::rightClickedAttr( QListViewItem* item, const QPoint&, int ) { clickedAttr(item); } void QavmCodecDialog::changeAttr( QListViewItem* item ) { if (!item) return; QString str = item->text(1); QString qs; int defval = 0; float deffval = 0.; const char* def_str; int codec = getCurrent(); bool setc = false; //printf("Getting %s for %s\n", str.ascii(), m_Codecs[codec].GetName()); Input* inp; InputSelect* qit; const avm::AttributeInfo* ai = m_Codecs[codec]->FindAttribute( str.ascii(), m_Direction ); if (!ai) return; switch(ai->kind) { case avm::AttributeInfo::Integer: avm::CodecGetAttr(*m_Codecs[codec], ai->GetName(), &defval); { Input i(this, str + QString( tr(" value") ), qs.setNum(defval)); if (i.exec() == QDialog::Accepted) { //cerr<<"Setting "<GetName()<<" to "<value()<<" for "<GetName(), i.getInt()); setc = true; } } break; case avm::AttributeInfo::Select: avm::CodecGetAttr(*m_Codecs[codec], ai->GetName(), &defval); { InputSelect i(this, str + QString( tr(" value") ), ai->options, defval); if (i.exec() == QDialog::Accepted) { //cerr<<"Setting "<GetName()<<" to "<value()<<" for "<GetName(), i.value()); setc = true; } } break; case avm::AttributeInfo::String: avm::CodecGetAttr(*m_Codecs[codec], ai->GetName(), &def_str); { Input i(this, str + QString( tr(" value") ), def_str); if (i.exec() == QDialog::Accepted) { //cerr<<"Setting "<GetName()<<" to "<value()<<" for "<GetName(), i.getString()); setc = true; } } break; case avm::AttributeInfo::Float: avm::CodecGetAttr(*m_Codecs[codec], ai->GetName(), &deffval); { Input i(this, str + QString( tr(" value") ), qs.setNum(deffval)); if (i.exec() == QDialog::Accepted) { //cerr<<"Setting "<GetName()<<" to "<value()<<" for "<GetName(), i.getFloat()); setc = true; } } break; } if (setc) selectCodec(); } void QavmCodecDialog::selectCodec() { int codec = getCurrent(); m_pTabAttr->clear(); //m_pTabAttr->setSorting(0, false); //m_pTabAttr->setSorting(1, false); if (m_Direction == avm::CodecInfo::Encode || m_Direction == avm::CodecInfo::Both) addAttributes(*m_Codecs[codec], m_Codecs[codec]->encoder_info); if (m_Direction == avm::CodecInfo::Decode || m_Direction == avm::CodecInfo::Both) addAttributes(*m_Codecs[codec], m_Codecs[codec]->decoder_info); } void QavmCodecDialog::addAttributes(const avm::CodecInfo& cdi, const avm::vector& ci) { QListViewItem* litem = 0; avm::vector::const_iterator it; int i = 0; bool use_short = (m_pShortBox->state() == QButton::On); m_pTabAttr->setEnabled( (ci.size() != 0) ); for (it = ci.begin(); it != ci.end(); it++) { //printf("attr %s\n", it->GetAbout()); avm::string val = ""; int param; float fparam; bool check = false; switch (it->kind) { case avm::AttributeInfo::Integer: if (avm::CodecGetAttr(cdi, it->GetName(), ¶m) == 0) { //val=itoa(param, tmp, 10); check = (it->GetMin() == 0 && it->GetMax() == 1); val.sprintf("%d", param); } break; case avm::AttributeInfo::Select: if (avm::CodecGetAttr(cdi, it->GetName(), ¶m) == 0) { //val=itoa(param, tmp, 10); val.sprintf("%d", param); val += " ( "; val += it->options[param]; val += " )"; break; } case avm::AttributeInfo::String: { const char* n = 0; avm::CodecGetAttr(cdi, it->GetName(), &n); if (n) val = n; else val[0] = 0; } break; case avm::AttributeInfo::Float: if (avm::CodecGetAttr(cdi, it->GetName(), &fparam) == 0) { //val=itoa(param, tmp, 10); val.sprintf("%f", fparam); } break; } QListViewItem* item; const char* n = (use_short) ? it->GetName() : it->GetAbout(); if (check) { item = new QCheckListItem( m_pTabAttr, "", QCheckListItem::CheckBox ); ((QCheckListItem*)item)->setOn( param ); #if QT_VERSION > 220 if (litem) item->moveItem( litem ); #endif } else { item = new QListViewItem( m_pTabAttr, litem ); item->setText( 0, val.c_str() ); } item->setText( 1, n ); litem = item; } } void QavmCodecDialog::createGui() { setCaption( tr( "Configure codecs" ) ); #if QT_VERSION > 220 setSizeGripEnabled( TRUE ); QSplitter* spl = new QSplitter( this ); spl->setOpaqueResize( TRUE ); #else QHBox* spl = new QHBox( this ); #endif gridLayout()->addMultiCellWidget( spl, 0, 3, 0, 0 ); // left QVBox* vbl = new QVBox( spl ); vbl->setMargin( 5 ); // Codecs list QGroupBox* gb = new QVGroupBox( vbl ); gb->setTitle( tr( "Codecs" ) ); m_pListCodecs = new QListBox( gb ); createMoveGroup( gb ); // right vbl = new QVBox( spl ); vbl->setMargin( 5 ); // Attributes list gb = new QVGroupBox( vbl ); gb->setTitle( tr( "Attributes" ) ); //gb->setColumnLayout(0, Qt::Vertical); m_pTabAttr = new QListView( gb ); m_pTabAttr->addColumn( tr( "Value" ) ); m_pTabAttr->addColumn( tr( "Attribute" ) ); //m_pTabAttr->setColumnAlignment( 1, Qt::AlignRight ); m_pTabAttr->setSorting( -1, true ); //QListViewItem * item = new QListViewItem( m_pTabAttr, 0 ); //createLCD( vbl ); QHBox* hb = new QHBox( vbl ); m_pShortBox = new QCheckBox( tr( "&Shortcuts" ), hb ); QWidget* w = new QWidget( hb ); hb->setStretchFactor( w, 1 ); QButton* pAbout = new QPushButton( tr( "&About..." ), hb ); w = new QWidget( hb ); hb->setStretchFactor( w, 1 ); connect( m_pShortBox, SIGNAL( stateChanged(int) ), this, SLOT( shortNames(int) ) ); connect( pAbout, SIGNAL( clicked() ), this, SLOT( about() ) ); #if QT_VERSION > 220 connect( m_pTabAttr, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( clickedAttr( QListViewItem* ) ) ); #else connect( m_pTabAttr, SIGNAL( rightButtonClicked( QListViewItem*, const QPoint&, int ) ), this, SLOT( rightClickedAttr( QListViewItem*, const QPoint&, int ) ) ); #endif connect( m_pTabAttr, SIGNAL( doubleClicked( QListViewItem* ) ), this, SLOT( changeAttr( QListViewItem* ) ) ); } void QavmCodecDialog::createLCD( QWidget* parent ) { #if QT_VERSION > 220 QHBox* hbl = new QHBox( parent ); // Quality QGroupBox* gb = new QGroupBox( hbl ); gb->setTitle( tr( "Quality" ) ); gb->setMaximumHeight( 100 ); gb->setColumnLayout( 0, Qt::Horizontal ); QHBoxLayout* hl = new QHBoxLayout( gb->layout() ); QDial* d = new QDial( gb ); d->setMaxValue( 100 ); d->setValue( 95 ); m_pQuality = d; m_pLCDNumber1 = new QLCDNumber( gb ); m_pLCDNumber1->setFrameShadow( QLCDNumber::Raised ); m_pLCDNumber1->setSegmentStyle( QLCDNumber::Flat ); m_pLCDNumber1->setNumDigits( 3 ); m_pLCDNumber1->setProperty( "intValue", 95 ); hl->addWidget( m_pQuality ); hl->addWidget( m_pLCDNumber1 ); // KeyFrame frequency gb = new QGroupBox( hbl ); gb->setTitle( tr( "Keyframe frequency" ) ); gb->setMaximumHeight( 100 ); gb->setColumnLayout( 0, Qt::Horizontal ); hl = new QHBoxLayout( gb->layout() ); d = new QDial( gb ); d->setMaxValue( 200 ); d->setValue( 75 ); d->setMinValue( 1 ); m_pKeyframe = d; m_pLCDNumber2 = new QLCDNumber( gb ); m_pLCDNumber2->setSegmentStyle( QLCDNumber::Flat ); m_pLCDNumber2->setNumDigits( 3 ); m_pLCDNumber2->setProperty( "intValue", 75 ); hl->addWidget( m_pKeyframe ); hl->addWidget( m_pLCDNumber2 ); // signals and slots connections connect( m_pKeyframe, SIGNAL( valueChanged( int ) ), m_pLCDNumber2, SLOT( display( int ) ) ); connect( m_pQuality, SIGNAL( valueChanged( int ) ), m_pLCDNumber1, SLOT( display( int ) ) ); #endif } void QavmCodecDialog::createMoveGroup( QWidget* parent ) { QHBox* hb = new QHBox( parent ); hb->setMargin( 5 ); //hb->setSpacing( 5 ); QWidget* w = new QWidget( hb ); hb->setStretchFactor( w, 1 ); QButton* pTop = new QavmPixmapButton( "top", hb ); QButton* pUp = new QavmPixmapButton( "up", hb ); pUp->setAutoRepeat( TRUE ); QButton* pDown = new QavmPixmapButton( "down", hb ); pDown->setAutoRepeat( TRUE ); QButton* pBottom = new QavmPixmapButton( "bottom", hb ); w = new QWidget( hb ); hb->setStretchFactor( w, 1 ); connect( pTop, SIGNAL( clicked() ), this, SLOT( codecTop() ) ); connect( pUp, SIGNAL( clicked() ), this, SLOT( codecUp() ) ); connect( pDown, SIGNAL( clicked() ), this, SLOT( codecDown() ) ); connect( pBottom, SIGNAL( clicked() ), this, SLOT( codecBottom() ) ); } void QavmCodecDialog::codecMove(int dir) { //printf("MOVE %d\n", dir); if (m_Order.size() < 2) return; unsigned c = m_pListCodecs->currentItem(); switch (dir) { case 1: if (c < (m_Order.size() - 1)) { unsigned cs = m_Order[c + 1]; m_Order[c + 1] = m_Order[c]; m_Order[c] = cs; c++; } break; case -1: if (c > 0) { unsigned cs = m_Order[c - 1]; m_Order[c - 1] = m_Order[c]; m_Order[c] = cs; c--; } break; case 0: for (unsigned i = c; i > 0; i--) { unsigned cs = m_Order[i - 1]; m_Order[i - 1] = m_Order[i]; m_Order[i] = cs; } break; case -1000: for (unsigned i = c; i < m_Order.size() - 1; i++) { unsigned cs = m_Order[i + 1]; m_Order[i + 1] = m_Order[i]; m_Order[i] = cs; } break; } setCurrent( c ); codecUpdateList(); selectCodec(); } void QavmCodecDialog::codecUpdateList() { bool use_short = (m_pShortBox->state() == QButton::On); int codec = m_pListCodecs->currentItem(); m_pListCodecs->clear(); for (unsigned i = 0; i < m_Order.size(); i++) { const avm::CodecInfo& ci = *m_Codecs[m_Order[i]]; const char* n = (use_short) ? ci.GetPrivateName() : ci.GetName(); m_pListCodecs->insertItem( n ); } setCurrent( codec ); } avifile-0.7.48~20090503.ds/libavqt/codecdialog.h0000644000175000017500000000466010747177436020037 0ustar yavoryavor#ifndef CODECCONFIG_H #define CODECCONFIG_H #include "avm_default.h" #include "okdialog.h" #include #define HAVE_NEWQT // ok - MOC can't work with macros // thus using QWidget for QDial objects class QLCDNumber; class QListBox; class QListView; class QListViewItem; class QLineEdit; class QComboBox; class QCheckBox; class AVMEXPORT QavmCodecDialog : public QavmOkDialog { Q_OBJECT; class Input: public QavmOkDialog { QLineEdit* m_pEdit; QString val; public: Input(QWidget* parent, const QString& title, const QString& defval); virtual void accept(); float getFloat() const { return val.toFloat(); } int getInt() const { return val.toInt(); }; const char* getString() const { return val.latin1(); } }; class InputSelect: public QavmOkDialog { QComboBox* m_pBox; const avm::vector& _options; int _defval; public: InputSelect(QWidget* parent, const QString& title, const avm::vector& options, int defval); virtual void accept(); int value() const { return _defval; } }; public: QavmCodecDialog( QWidget*, const avm::vector& codecs, avm::CodecInfo::Direction dir = avm::CodecInfo::Encode ); ~QavmCodecDialog(); avm::VideoEncoderInfo getInfo(); int getCurrent() const; void setCurrent(int i); public slots: virtual void about(); virtual void accept(); virtual void changeAttr( QListViewItem* item ); virtual void clickedAttr( QListViewItem* item ); virtual void selectCodec(); virtual void shortNames(int); void codecUp() { codecMove( -1 ); } void codecDown() { codecMove( 1 ); } void codecTop() { codecMove( 0 ); } void codecBottom() { codecMove( -1000 ); } // Qt2.0 compatibility void rightClickedAttr( QListViewItem* item, const QPoint&, int ); protected: void addAttributes( const avm::CodecInfo&, const avm::vector& ci ); void codecMove( int dir ); void codecUpdateList(); void createGui(); void createLCD( QWidget* parent ); void createMoveGroup( QWidget* parent ); const avm::vector& m_Codecs; avm::vector m_Order; avm::CodecInfo::Direction m_Direction; QLCDNumber* m_pLCDNumber1; QLCDNumber* m_pLCDNumber2; QWidget* m_pKeyframe; QWidget* m_pQuality; QCheckBox* m_pShortBox; QListBox* m_pListCodecs; QListView* m_pTabAttr; }; #endif // CODECCONFIG_H avifile-0.7.48~20090503.ds/libavqt/okdialog.cpp0000644000175000017500000000251307664452416017717 0ustar yavoryavor#include "okdialog.h" #include "okdialog.moc" #include #include #include QavmOkDialog::QavmOkDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) :QDialog( parent, name, modal, fl ), m_bApplyEnabled(false), m_bOkDefault(true) { setCaption( name ); m_pGl = new QGridLayout( this, 1, 1 ); m_pGl->setMargin( 5 ); m_pGl->setSpacing( 5 ); } void QavmOkDialog::apply() { // to be overloaded } int QavmOkDialog::exec() { QGridLayout* tgl = new QGridLayout( 0, 1, 3 ); int col = 1; QPushButton* ok = new QPushButton( tr( "&Ok" ), this ); if (m_bOkDefault) ok->setDefault( TRUE ); else ok->setAutoDefault( TRUE ); tgl->addWidget( ok, 0, col++ ); if (m_bApplyEnabled) { QPushButton* apply = new QPushButton( tr( "&Apply" ), this ); connect( apply, SIGNAL( clicked() ), this, SLOT( apply() ) ); tgl->addWidget( apply, 0, col++ ); } QPushButton* cancel = new QPushButton( tr( "&Cancel" ), this ); tgl->addWidget( cancel, 0, col ); tgl->setColStretch( 0, 1 ); m_pGl->addMultiCell( tgl, m_pGl->numRows(), m_pGl->numRows(), 0, m_pGl->numCols() - 1 ); connect( ok, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( cancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); return QDialog::exec(); } avifile-0.7.48~20090503.ds/libavqt/okdialog.h0000644000175000017500000000142211174014361017342 0ustar yavoryavor#ifndef OKDIALOG_H #define OKDIALOG_H #include "avm_default.h" #include class QGridLayout; // base resizable dialog with Ok Apply Cancel buttons class AVMEXPORT QavmOkDialog : public QDialog { Q_OBJECT; bool m_bApplyEnabled; public: QavmOkDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 ); QGridLayout* gridLayout() { return m_pGl; } void setApplyEnabled(bool enabled) { m_bApplyEnabled = enabled; } void setApplyName(const QString& apply) { m_Apply = apply; } void setOkDefault(bool enabled) { m_bOkDefault = enabled; } virtual int exec(); // overload public slots: virtual void apply(); protected: QGridLayout* m_pGl; QString m_Apply; bool m_bOkDefault; }; #endif // OKDIALOG_H avifile-0.7.48~20090503.ds/libavqt/pixmapbutton.h0000644000175000017500000000034510747177436020330 0ustar yavoryavor#include "avm_default.h" #include // maybe use QToolButton class AVMEXPORT QavmPixmapButton: public QToolButton //QPushButton //QToolButton { public: QavmPixmapButton(const char* ficon, QWidget* _parent); }; avifile-0.7.48~20090503.ds/libavqt/testcodecs.cpp0000644000175000017500000000342211106773426020257 0ustar yavoryavor/** * * Test sample for checking memory leaks in codec quering * * It's good idea to use single threaded operation mode * so modify Cache.cpp to no use thread for precaching #define NOTHREADS * */ #include #include #include #include #include #include #include #define __MODULE__ "testcl" #include "codecdialog.h" #include int main(int argc, char** argv) { BITMAPINFOHEADER bih; bih.biCompression = 0xffffffff; // just to fill video_codecs list avm::CreateDecoderVideo(bih, 0, 0); avm::vector codecs; QApplication a( argc, argv ); QavmCodecDialog* m = new QavmCodecDialog( 0, codecs ); return m->exec(); //a.setMainWidget(m); return a.exec(); for(int round = 0; round < 5; round++) { int i = 0; avm::VideoEncoderInfo _info; avm::vector::iterator it; avm::vector private_list; private_list.clear(); fourcc_t fcc = 24; switch (round % 3) { case 1: fcc = fccYUY2; break; case 2: fcc = fccYV12; break; } avm::BitmapInfo bi(160, 120, fcc); printf("VideoCodes list size: %d\n", video_codecs.size()); for (it = video_codecs.begin(); it != video_codecs.end(); it++) { if(!(it->direction & avm::CodecInfo::Encode)) continue; avm::IVideoEncoder* enc = avm::CreateEncoderVideo(it->fourcc, bi); // checking if this code is the one we have asked for... if (!enc) continue; bool ok = (strcmp(it->GetName(), enc->GetCodecInfo().GetName()) == 0); avm::FreeEncoderVideo(enc); if (!ok) continue; private_list.push_back(*it); i++; } printf("round: %d (fcc: %d) found: %d\n", round, fcc, i); } return 0; } avifile-0.7.48~20090503.ds/libmmxnow/0000755000175000017500000000000011267646347015775 5ustar yavoryavoravifile-0.7.48~20090503.ds/libmmxnow/doc/0000755000175000017500000000000011267646347016542 5ustar yavoryavoravifile-0.7.48~20090503.ds/libmmxnow/doc/Makefile.am0000644000175000017500000000012407364747623020575 0ustar yavoryavornoinst_DATA = README EXTRA_DIST = $(noinst_DATA) MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/libmmxnow/doc/README0000644000175000017500000000042207342747435017417 0ustar yavoryavor Library for simple routine which should be executed with maximum speed you CPU allow by using MMX, 3DNow, and various other extra instruction. All the time simple plain C version should be available For now its pretty simple and experimental. Basic usage. mmxnow() avifile-0.7.48~20090503.ds/libmmxnow/src/0000755000175000017500000000000011267646347016564 5ustar yavoryavoravifile-0.7.48~20090503.ds/libmmxnow/src/generic/0000755000175000017500000000000011267646347020200 5ustar yavoryavoravifile-0.7.48~20090503.ds/libmmxnow/src/generic/video/0000755000175000017500000000000011267646347021306 5ustar yavoryavoravifile-0.7.48~20090503.ds/libmmxnow/src/generic/video/Makefile.am0000644000175000017500000000033607457537372023347 0ustar yavoryavornoinst_LTLIBRARIES = libgenericvideo.la noinst_HEADERS = create.h libgenericvideo_la_SOURCES = create.c rgb_yuv.c AM_CPPFLAGS = -I$(srcdir)/.. -I$(srcdir)/../.. -I$(top_srcdir)/include MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/libmmxnow/src/generic/video/create.c0000644000175000017500000000024707345203231022677 0ustar yavoryavor#include "create.h" #include void mmxnow_create_generic_video(mmxnow_context_t* ctx, int method) { mmxnow_create_generic_video_rgb_yuv(ctx, method); } avifile-0.7.48~20090503.ds/libmmxnow/src/generic/video/create.h0000644000175000017500000000042207345203231022677 0ustar yavoryavor#ifndef MMXNOW_GENERIC_VIDEO_CREATE_H #define MMXNOW_GENERIC_VIDEO_CREATE_H #include "mmxnow_private.h" void mmxnow_create_generic_video_rgb_yuv(mmxnow_context_t*, int); void mmxnow_create_generic_video(mmxnow_context_t*, int); #endif /* MMXNOW_GENERIC_VIDEO_CREATE_H */ avifile-0.7.48~20090503.ds/libmmxnow/src/generic/video/rgb.c0000644000175000017500000000157207345203231022210 0ustar yavoryavor#include "mmxnow_private.h" static void rgb16_to_rgb24(STDCONV_PARAMS) { col* dest; const uint16_t* src; uint16_t sh; int i; dest=(col*)to+width*height-1; if(!flip_dir) src=(const uint16_t*)from+width*height-1; else src=(const uint16_t*)from+width-1; for(i = height-1; i>=0; i--) { int j; for(j = width - 1; j >= 0; j--) { sh = *src; dest->r=(sh & 0xF800) >> 8; dest->g=(sh & 0x7E0) >> 3; dest->b=(sh & 0x1F) << 3; dest--; src--; } if (flip_dir) src+=2*width; } } static rgb32ToRgb24(STDCONV_PARAMS) { col* dest; dest=(col*)to+width*height-1; if(!flip_dir) from+=4*(width*height-1); else from+=4*(width-1); for(int i=height-1; i>=0; i--) { for(int j=width-1; j>=0; j--) { *dest=*(const col*)from; dest--; from-=4; } if(flip_dir)from+=8*width; } } avifile-0.7.48~20090503.ds/libmmxnow/src/generic/video/rgb_yuv.c0000644000175000017500000001105607441632752023124 0ustar yavoryavor#include "create.h" #include static inline void rgb_yuv(mmxnow_yuv_t* yuv, const mmxnow_rgb_t* rgb) { int Y, Cb, Cr; uint8_t r = rgb->r; uint8_t g = rgb->g; uint8_t b = rgb->b; Y = 66 * r + 129 * g + 25 * b + 0x1000; Cb = -38 * r - 74 * g + 112 * b + 0x8000; Cr = 112 * r - 94 * g - 18 * b + 0x8000; if (Y < 0x1000) Y = 0x1000; else if ( Y > 0xef00) Y = 0xef00; if (Cb < 0x1000) Cb = 0x1000; else if(Cb > 0xef00) Cb = 0xef00; if (Cr < 0x1000) Cr = 0x1000; else if (Cr > 0xef00) Cr = 0xef00; yuv->y = (uint8_t) (Y >> 8); yuv->cb = (uint8_t) (Cb >> 8); yuv->cr = (uint8_t) (Cr >> 8); } static inline int rgb_y(const mmxnow_rgb_t* rgb) { return (16853l * rgb->r) + (33055l * rgb->g) + (6392l * rgb->b) + 0x8000; } // add stride calculation static int rgb24_to_yuv(struct mmxnow_context_t* ctx) { mmxnow_image_data_t* data = (mmxnow_image_data_t*) ctx->data; int width = data->in.width; int height = data->in.height; int flip = data->flip; mmxnow_yuv_t* dest = (mmxnow_yuv_t*) data->out.plane[0] + width * height - 1; const mmxnow_rgb_t* src; int i; if (!flip) src = (const mmxnow_rgb_t*) data->in.plane[0] + width * height - 1; else src = (const mmxnow_rgb_t*) data->in.plane[0] + width - 1; for (i = height-1; i >= 0; i--) { int j; for (j = width-1; j >= 0; j--) { rgb_yuv(dest, src); src--; dest--; } if (flip) src += 2 * width; } return 0; } static int rgb24_to_yuy2(struct mmxnow_context_t* ctx) { mmxnow_image_data_t* data = (mmxnow_image_data_t*) ctx->data; int width = data->in.width; int height = data->in.height; int flip = data->flip; // yuv2 - 16bit uint8_t* dest = (uint8_t*)data->out.plane[0] + 2 * width * height - 1; const mmxnow_rgb_t* src; int i; if (!flip) src = (const mmxnow_rgb_t*)data->in.plane[0] + width * height - 1; else src = (const mmxnow_rgb_t*)data->in.plane[0] + width - 1; for(i = height - 1; i >= 0; i--) { int j; for(j = width / 2- 1; j >= 0; j--) { mmxnow_yuv_t yuvt; int y; rgb_yuv(&yuvt, src); *src--; *dest--= yuvt.cr; *dest--= yuvt.y; *dest--= yuvt.cb; y = rgb_y(src); *dest-- = (y >> 16) + 16; src--; } if (flip) src += 2 * width; } return 0; } static int rgb24_to_yv12(struct mmxnow_context_t* ctx) { mmxnow_image_data_t* data = (mmxnow_image_data_t*) ctx->data; int width = data->in.width; int height = data->in.height; int flip = data->flip; int i; const mmxnow_rgb_t* src1, *src2; //from+=2*width*height-1; uint8_t* dest_y1 = data->out.plane[0]; uint8_t* dest_y2 = data->out.plane[0] + data->out.stride[0]; //uint8_t* dest_cb = data->out.plane[0] + width * height; //uint8_t* dest_cr = data->out.plane[0] + 5 * width * height / 4; uint8_t* dest_cb = data->out.plane[1]; uint8_t* dest_cr = data->out.plane[2]; if (flip) { src1 = (const mmxnow_rgb_t*) data->in.plane[0] + width * (height - 1); src2 = (const mmxnow_rgb_t*) data->in.plane[0] + width * (height - 2); } else { src1 = (const mmxnow_rgb_t*) data->in.plane[0]; src2 = (const mmxnow_rgb_t*) data->in.plane[0] + width; } // uint8_t* dest; // const col* src; // dest=to+2*(width*height-1); // if(!flip_dir) // src=(const col*)from+width*height-1; // else // src=(const col*)from+width-1; for(i = height / 2 - 1; i >= 0; i--) { int j; for(j = width / 2 - 1; j >= 0; j--) { mmxnow_yuv_t yuvt; rgb_yuv(&yuvt, src1); *src1++; *dest_cb++ = yuvt.cb; *dest_cr++ = yuvt.cr; *dest_y1++ = yuvt.y; *dest_y1++ = rgb_y(src1); src1++; *dest_y2++ = rgb_y(src2); src2++; *dest_y2++ = rgb_y(src2); src2++; } dest_y1 += width; dest_y2 += width; if (flip) { src1 -= 3*width; src2 -= 3*width; } else { src1 += width; src2 += width; } } return 0; } void mmxnow_create_generic_video_rgb_yuv(mmxnow_context_t* ctx, int method) { if (ctx->method == 0) { switch (method) { case MMXNOW_BGR24_TO_YUV: ctx->method = rgb24_to_yuv; ctx->name = "rgb24_to_yuv"; break; case MMXNOW_BGR24_TO_YUY2: ctx->method = rgb24_to_yuy2; ctx->name = "rgb24_to_yuv2"; break; case MMXNOW_BGR24_TO_YV12: ctx->method = rgb24_to_yv12; ctx->name = "rgb24_to_yv12"; break; } if (ctx->method) ctx->data = calloc(1, sizeof(mmxnow_image_data_t)); } } avifile-0.7.48~20090503.ds/libmmxnow/src/generic/video/yuv2rgb.c0000644000175000017500000002277207345203231023043 0ustar yavoryavor/* * yuv2rgb.c, Software YUV to RGB coverter * * Copyright (C) 1999, Aaron Holtzman * All Rights Reserved. * * Functions broken out from display_x11.c and several new modes * added by Håkan Hjort * * 15 & 16 bpp support by Franck Sicard * * This file is part of mpeg2dec, a free MPEG-2 video decoder * * mpeg2dec is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * mpeg2dec 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include #include #include "config.h" #include "video_out.h" #include "yuv2rgb.h" static uint32_t matrix_coefficients = 6; static const int32_t Inverse_Table_6_9[8][4] = { {117504, 138453, 13954, 34903}, /* no sequence_display_extension */ {117504, 138453, 13954, 34903}, /* ITU-R Rec. 709 (1990) */ {104597, 132201, 25675, 53279}, /* unspecified */ {104597, 132201, 25675, 53279}, /* reserved */ {104448, 132798, 24759, 53109}, /* FCC */ {104597, 132201, 25675, 53279}, /* ITU-R Rec. 624-4 System B, G */ {104597, 132201, 25675, 53279}, /* SMPTE 170M */ {117579, 136230, 16907, 35559} /* SMPTE 240M (1987) */ }; static void yuv2rgb_c_init (int bpp, int mode); yuv2rgb_fun yuv2rgb; static void (* yuv2rgb_c_internal) (uint8_t *, uint8_t *, uint8_t *, uint8_t *, void *, void *, int); static void yuv2rgb_c (void * dst, uint8_t * py, uint8_t * pu, uint8_t * pv, int h_size, int v_size, int rgb_stride, int y_stride, int uv_stride) { v_size >>= 1; while (v_size--) { yuv2rgb_c_internal (py, py + y_stride, pu, pv, dst, dst + rgb_stride, h_size); py += 2 * y_stride; pu += uv_stride; pv += uv_stride; dst += 2 * rgb_stride; } } void yuv2rgb_init (int bpp, int mode) { yuv2rgb = NULL; #ifdef HAVE_MMX if (yuv2rgb == NULL /*&& (config.flags & VO_MMX_ENABLE)*/) { yuv2rgb = yuv2rgb_init_mmx (bpp, mode); if (yuv2rgb != NULL) printf ("Using MMX for colorspace transform\n"); else printf ("Cannot init MMX colorspace transform\n"); } #endif #ifdef HAVE_MLIB if (yuv2rgb == NULL /*&& (config.flags & VO_MLIB_ENABLE)*/) { yuv2rgb = yuv2rgb_init_mlib (bpp, mode); if (yuv2rgb != NULL) printf ("Using mlib for colorspace transform\n"); } #endif if (yuv2rgb == NULL) { printf ("No accelerated colorspace conversion found\n"); yuv2rgb_c_init (bpp, mode); yuv2rgb = (yuv2rgb_fun)yuv2rgb_c; } } #define RGB(i) \ U = pu[i]; \ V = pv[i]; \ r = table_rV[V]; \ g = table_gU[U] + table_gV[V]; \ b = table_bU[U]; #define DST1(i) \ Y = py_1[2*i]; \ dst_1[2*i] = r[Y] + g[Y] + b[Y]; \ Y = py_1[2*i+1]; \ dst_1[2*i+1] = r[Y] + g[Y] + b[Y]; #define DST2(i) \ Y = py_2[2*i]; \ dst_2[2*i] = r[Y] + g[Y] + b[Y]; \ Y = py_2[2*i+1]; \ dst_2[2*i+1] = r[Y] + g[Y] + b[Y]; #define DST1RGB(i) \ Y = py_1[2*i]; \ dst_1[6*i] = r[Y]; dst_1[6*i+1] = g[Y]; dst_1[6*i+2] = b[Y]; \ Y = py_1[2*i+1]; \ dst_1[6*i+3] = r[Y]; dst_1[6*i+4] = g[Y]; dst_1[6*i+5] = b[Y]; #define DST2RGB(i) \ Y = py_2[2*i]; \ dst_2[6*i] = r[Y]; dst_2[6*i+1] = g[Y]; dst_2[6*i+2] = b[Y]; \ Y = py_2[2*i+1]; \ dst_2[6*i+3] = r[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = b[Y]; #define DST1BGR(i) \ Y = py_1[2*i]; \ dst_1[6*i] = b[Y]; dst_1[6*i+1] = g[Y]; dst_1[6*i+2] = r[Y]; \ Y = py_1[2*i+1]; \ dst_1[6*i+3] = b[Y]; dst_1[6*i+4] = g[Y]; dst_1[6*i+5] = r[Y]; #define DST2BGR(i) \ Y = py_2[2*i]; \ dst_2[6*i] = b[Y]; dst_2[6*i+1] = g[Y]; dst_2[6*i+2] = r[Y]; \ Y = py_2[2*i+1]; \ dst_2[6*i+3] = b[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = r[Y]; static void yuv2rgb_c_32(struct mmxnow_contex_t* ctx) { uint8_t * py_1, uint8_t * py_2, uint8_t * pu, uint8_t * pv, void * _dst_1, void * _dst_2, int h_size) int U, V, Y; uint32_t * r, * g, * b; uint32_t * dst_1, * dst_2; mmxnow_data_img_t* data = (mmxnow_data_img_t*) ctx->data; py_1 = data->plane_y; h_size >>= 3; dst_1 = _dst_1; dst_2 = _dst_2; while (h_size--) { RGB(0); DST1(0); DST2(0); RGB(1); DST2(1); DST1(1); RGB(2); DST1(2); DST2(2); RGB(3); DST2(3); DST1(3); pu += 4; pv += 4; py_1 += 8; py_2 += 8; dst_1 += 8; dst_2 += 8; } } // This is very near from the yuv2rgb_c_32 code static void yuv2rgb_c_24_rgb (uint8_t * py_1, uint8_t * py_2, uint8_t * pu, uint8_t * pv, void * _dst_1, void * _dst_2, int h_size) { int U, V, Y; uint8_t * r, * g, * b; uint8_t * dst_1, * dst_2; h_size >>= 3; dst_1 = _dst_1; dst_2 = _dst_2; while (h_size--) { RGB(0); DST1RGB(0); DST2RGB(0); RGB(1); DST2RGB(1); DST1RGB(1); RGB(2); DST1RGB(2); DST2RGB(2); RGB(3); DST2RGB(3); DST1RGB(3); pu += 4; pv += 4; py_1 += 8; py_2 += 8; dst_1 += 24; dst_2 += 24; } } // only trivial mods from yuv2rgb_c_24_rgb static void yuv2rgb_c_24_bgr (uint8_t * py_1, uint8_t * py_2, uint8_t * pu, uint8_t * pv, void * _dst_1, void * _dst_2, int h_size) { int U, V, Y; uint8_t * r, * g, * b; uint8_t * dst_1, * dst_2; h_size >>= 3; dst_1 = _dst_1; dst_2 = _dst_2; while (h_size--) { RGB(0); DST1BGR(0); DST2BGR(0); RGB(1); DST2BGR(1); DST1BGR(1); RGB(2); DST1BGR(2); DST2BGR(2); RGB(3); DST2BGR(3); DST1BGR(3); pu += 4; pv += 4; py_1 += 8; py_2 += 8; dst_1 += 24; dst_2 += 24; } } // This is exactly the same code as yuv2rgb_c_32 except for the types of // r, g, b, dst_1, dst_2 static void yuv2rgb_c_16 (uint8_t * py_1, uint8_t * py_2, uint8_t * pu, uint8_t * pv, void * _dst_1, void * _dst_2, int h_size) { int U, V, Y; uint16_t * r, * g, * b; uint16_t * dst_1, * dst_2; h_size >>= 3; dst_1 = _dst_1; dst_2 = _dst_2; while (h_size--) { RGB(0); DST1(0); DST2(0); RGB(1); DST2(1); DST1(1); RGB(2); DST1(2); DST2(2); RGB(3); DST2(3); DST1(3); pu += 4; pv += 4; py_1 += 8; py_2 += 8; dst_1 += 8; dst_2 += 8; } } static int div_round (int dividend, int divisor) { if (dividend > 0) return (dividend + (divisor>>1)) / divisor; else return -((-dividend + (divisor>>1)) / divisor); } static void yuv2rgb_c_init (int bpp, int mode) { int i; uint8_t table_Y[1024]; uint32_t *table_32 = 0; uint16_t *table_16 = 0; uint8_t *table_8 = 0; uint32_t entry_size = 0; void *table_r = 0, *table_g = 0, *table_b = 0; int crv = Inverse_Table_6_9[matrix_coefficients][0]; int cbu = Inverse_Table_6_9[matrix_coefficients][1]; int cgu = -Inverse_Table_6_9[matrix_coefficients][2]; int cgv = -Inverse_Table_6_9[matrix_coefficients][3]; for (i = 0; i < 1024; i++) { int j; j = (76309 * (i - 384 - 16) + 32768) >> 16; j = (j < 0) ? 0 : ((j > 255) ? 255 : j); table_Y[i] = j; } switch (bpp) { case 32: yuv2rgb_c_internal = yuv2rgb_c_32; table_32 = malloc ((197 + 2*682 + 256 + 132) * sizeof (uint32_t)); entry_size = sizeof (uint32_t); table_r = table_32 + 197; table_b = table_32 + 197 + 685; table_g = table_32 + 197 + 2*682; for (i = -197; i < 256+197; i++) ((uint32_t *)table_r)[i] = table_Y[i+384] << ((mode==MODE_RGB) ? 16 : 0); for (i = -132; i < 256+132; i++) ((uint32_t *)table_g)[i] = table_Y[i+384] << 8; for (i = -232; i < 256+232; i++) ((uint32_t *)table_b)[i] = table_Y[i+384] << ((mode==MODE_RGB) ? 0 : 16); break; case 24: // yuv2rgb_c_internal = (mode==MODE_RGB) ? yuv2rgb_c_24_rgb : yuv2rgb_c_24_bgr; yuv2rgb_c_internal = (mode!=MODE_RGB) ? yuv2rgb_c_24_rgb : yuv2rgb_c_24_bgr; table_8 = malloc ((256 + 2*232) * sizeof (uint8_t)); entry_size = sizeof (uint8_t); table_r = table_g = table_b = table_8 + 232; for (i = -232; i < 256+232; i++) ((uint8_t * )table_b)[i] = table_Y[i+384]; break; case 15: case 16: yuv2rgb_c_internal = yuv2rgb_c_16; table_16 = malloc ((197 + 2*682 + 256 + 132) * sizeof (uint16_t)); entry_size = sizeof (uint16_t); table_r = table_16 + 197; table_b = table_16 + 197 + 685; table_g = table_16 + 197 + 2*682; for (i = -197; i < 256+197; i++) { int j = table_Y[i+384] >> 3; if (mode == MODE_RGB) j <<= ((bpp==16) ? 11 : 10); ((uint16_t *)table_r)[i] = j; } for (i = -132; i < 256+132; i++) { int j = table_Y[i+384] >> ((bpp==16) ? 2 : 3); ((uint16_t *)table_g)[i] = j << 5; } for (i = -232; i < 256+232; i++) { int j = table_Y[i+384] >> 3; if (mode == MODE_BGR) j <<= ((bpp==16) ? 11 : 10); ((uint16_t *)table_b)[i] = j; } break; default: printf ("%ibpp not supported by yuv2rgb\n", bpp); //exit (1); } for (i = 0; i < 256; i++) { table_rV[i] = table_r + entry_size * div_round (crv * (i-128), 76309); table_gU[i] = table_g + entry_size * div_round (cgu * (i-128), 76309); table_gV[i] = entry_size * div_round (cgv * (i-128), 76309); table_bU[i] = table_b + entry_size * div_round (cbu * (i-128), 76309); } } void register_noaccel_yuv2rgb() { } void unregister_noaccel_ avifile-0.7.48~20090503.ds/libmmxnow/src/generic/video/yuv2rgb.h0000644000175000017500000000276607345203231023051 0ustar yavoryavor/* * * yuv2rgb.h, Software YUV to RGB coverter * * * Copyright (C) 1999, Aaron Holtzman * All Rights Reserved. * * Functions broken out from display_x11.c and several new modes * added by Håkan Hjort * * 15 & 16 bpp support by Franck Sicard * * This file is part of mpeg2dec, a free MPEG-2 video decoder * * mpeg2dec is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * mpeg2dec 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #define MODE_RGB 0x1 #define MODE_BGR 0x2 typedef void (* yuv2rgb_fun) (uint8_t * image, uint8_t * py, uint8_t * pu, uint8_t * pv, int h_size, int v_size, int rgb_stride, int y_stride, int uv_stride); extern yuv2rgb_fun yuv2rgb; void yuv2rgb_init (int bpp, int mode); yuv2rgb_fun yuv2rgb_init_mmx (int bpp, int mode); yuv2rgb_fun yuv2rgb_init_mlib (int bpp, int mode); avifile-0.7.48~20090503.ds/libmmxnow/src/generic/Makefile.am0000644000175000017500000000030707457537372022237 0ustar yavoryavorSUBDIRS = video noinst_LTLIBRARIES = libgeneric.la libgeneric_la_SOURCES = create.c libgeneric_la_LIBADD = video/libgenericvideo.la AM_CPPFLAGS = -I$(srcdir)/.. MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/libmmxnow/src/generic/create.c0000644000175000017500000000027607345203231021573 0ustar yavoryavor#include "mmxnow.h" #include void mmxnow_create_generic(mmxnow_context_t* ctx, int method) { mmxnow_create_generic_video(ctx, method); if (ctx->method) return; } avifile-0.7.48~20090503.ds/libmmxnow/src/Makefile.am0000644000175000017500000000112007532425711020600 0ustar yavoryavorDIST_SUBDIRS = generic i386 noinst_HEADERS = mmxnow_private.h lib_LTLIBRARIES = libmmxnow.la if AMM_BUILD_I386 SUBDIR_I386 = i386 LIBADD_I386 = i386/libi386.la endif SUBDIRS = generic $(SUBDIR_I386) libmmxnow_la_SOURCES = mmxnow.c names.c libmmxnow_la_LDFLAGS = -release $(MMXNOWLT_RELEASE) -version-info $(MMXNOWLT_VERSION) libmmxnow_la_LIBADD = \ generic/libgeneric.la \ $(LIBADD_I386) MYAVILIBRARY = $(top_srcdir)/../lib/libaviplay.la -lm #check_PROGRAMS = ordertest #ordertest_SOURCES = order.cpp #ordertest_LDADD = $(MYAVILIBRARY) MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/libmmxnow/src/filter.c0000644000175000017500000000512307441633027020204 0ustar yavoryavor enum { MMXNOW_FILTERV_SOURCE, MMXNOW_FILTERV_CONVERT, MMXNOW_FILTERV_RESIZE_BILINEAR_WIDTH, MMXNOW_FILTERV_RESIZE_BILINEAR_HEIGHT, }; // C, mmx, mmx2, sse, sse2, 3dnow table_MMXNOW_FILTER_SOURCE { { mmxnow_flt_source, 0, } struct mmxnow_filter_s; // filter processing function typedef int(*mmxnow_func_destroy)(struct mmxnow_filter_s* filter); typedef int(*mmxnow_func_process)(int lines, uint8_t planes[3], ...); typedef struct mmxnow_filter_s { int type; struct mmxnow_filter_s* parent; unsigned char* to_plane[3]; int to_stride[3]; int to_width; int to_height; unsigned char* from_plane[3]; int from_stride[3]; int from_width; int from_height; mmxnow_func_destroy destroy; mmxnow_func_process process; } mmxnow_filter_t; static inline add_planes(mmxnow_filter_t* f) { f->to_plane[0] = f->from_plane[0]; f->from_plane[0] += f->from_stride[0]; f->to_plane[1] = f->from_plane[1]; f->from_plane[1] += f->from_stride[1]; f->to_plane[2] = f->from_plane[2]; f->from_plane[2] += f->from_stride[2]; } mmxnow_filter_t* mmxnow_filter_create(int flags, int type, mmxnow_filter_t* parent) { mmxnow_filter_t* flt; if (type != MMXNOW_FILTER_SOURCE && !parent) { // must be SOURCE filter when there is no parent!! abort(); return 0; } flt = malloc(sizeof(mmxnow_filter_t)); if (!flt) return 0; memset(flt, 0, sizeof(mmxnow_filter_t)); flt->type = type; flt->patent = parent; switch (type) { case MMXNOW_FILTER_SOURCE: table = table_MMXNOW_FILTER_SOURCE; break; case MMXNOW_FILTER_CONVERT: break; case MMXNOW_FILTER_RESIZE_BILINEAR_WIDTH: break; case MMXNOW_FILTER_RESIZE_BILINEAR_HEIGHT: break; } flt->destroy = get_table(table, flags); flt->process = get_table(table, flags); return flt; } int mmxnow_filter_destroy_convert(mmxnow_filter_t* filter) { if (filter->parent) mmxnow_filter_destroy( free(filter); } int mmxnow_filter_init_convert(int param, ...) { } int mmxnow_filter_process(uint8_t planes[3], int lines, ...) { } static sourcef() { } int mmxnow_filter_process_source_planar(mmxnow_filter_t* f, uint8_t* planes[3]) { return 1; } int mmxnow_filter_process_convert_planar(mmxnow_filter_t* f, uint8_t* dstplanes[3]) { uint8_t* p[0]; int i; int l = f->parent->process(f->parent, f->planes, 1); for (i = 0; i < f->width; i++) f->from_plane[0] = p[0]; } int proce2() { f = top; while (f) { f->proces(f); f = f->next(); } } avifile-0.7.48~20090503.ds/libmmxnow/src/mmxnow.c0000644000175000017500000000235507402710416020243 0ustar yavoryavor#include "mmxnow_private.h" #include #include /* memset */ #include static int mmxnow_free_context(struct mmxnow_context_t* ctx) { if (ctx->data) { free(ctx->data); ctx->data = 0; } return 0; } static char buffer[200]; char* mmxnow_flags_text(unsigned int flags) { sprintf(buffer, "(%s%s%s%s)", (flags & MMXNOW_MMX) ? " mmx " : "", (flags & MMXNOW_3DNOW) ? " 3dnow " : "", (flags & MMXNOW_SSE) ? " sse " : "", (flags & MMXNOW_SSE2) ? " sse2 " : "" ); return buffer; } mmxnow_context_t* mmxnow_create(int method, unsigned int flags) { mmxnow_context_t* ctx = malloc(sizeof(mmxnow_context_t)); memset(ctx, 0, sizeof(mmxnow_context_t)); ctx->flags = flags; mmxnow_create_i386(ctx, method); if (ctx->method == 0) mmxnow_create_generic(ctx, method); /* flags not used */ if (ctx->method == 0) { printf("Method \"%s\" (%d) not found???\n", mmxnow_method_name(method), method); /* method not found */ free(ctx); ctx = 0; } else if (ctx->free == 0) ctx->free = mmxnow_free_context; return ctx; } void mmxnow_destroy(mmxnow_context_t* ctx) { if (ctx) { ctx->free(ctx); free(ctx); } } avifile-0.7.48~20090503.ds/libmmxnow/src/mmxnow_private.h0000644000175000017500000000065507441632752022014 0ustar yavoryavor#ifndef MMXNOW_PRIVATE_H #define MMXNOW_PRIVATE_H #include "mmxnow.h" /* private header file - never use outside of this directory */ void mmxnow_create_i386(mmxnow_context_t* ctx, int method); void mmxnow_create_generic(mmxnow_context_t* ctx, int method); /* debug info */ char* mmxnow_flags_text(unsigned int flags); /* pointer to static buffer */ const char* mmxnow_method_name(int method); #endif /* MMXNOW_PRIVATE_H */ avifile-0.7.48~20090503.ds/libmmxnow/src/names.c0000644000175000017500000000175007441632752020030 0ustar yavoryavor#include "mmxnow_private.h" static struct convtable { int id; const char* text; } id_string[] = { { MMXNOW_YUY2_TO_BGR16, "yuy2_to_bgr16" }, { MMXNOW_YUY2_TO_BGR24, "yuy2_to_bgr24" }, { MMXNOW_YUY2_TO_BGR32, "yuy2_to_bgr32" }, { MMXNOW_YV12_TO_BGR16, "yv12_to_bgr16" }, { MMXNOW_YV12_TO_BGR24, "yv12_to_bgr24" }, { MMXNOW_YV12_TO_BGR32, "yv12_to_bgr32" }, { MMXNOW_BGR16_TO_YUY2, "rgb16_to_yuy2" }, { MMXNOW_BGR24_TO_YUY2, "rgb24_to_yuy2" }, { MMXNOW_BGR32_TO_YUY2, "rgb32_to_yuy2" }, { MMXNOW_BGR16_TO_YV12, "rgb16_to_yv12" }, { MMXNOW_BGR24_TO_YV12, "rgb24_to_yv12" }, { MMXNOW_BGR32_TO_YV12, "rgb32_to_yv12" }, { MMXNOW_BGR16_TO_YUV, "rgb16_to_yuv" }, { MMXNOW_BGR24_TO_YUV, "rgb24_to_yuv" }, { MMXNOW_BGR32_TO_YUV, "rgb32_to_yuv" }, {0, 0} }; const char* mmxnow_method_name(int id) { struct convtable* c = id_string; for (; c->id; c++) if (c->id == id) return c->text; return "missing in table!"; } avifile-0.7.48~20090503.ds/libmmxnow/src/i386/0000755000175000017500000000000011267646347017255 5ustar yavoryavoravifile-0.7.48~20090503.ds/libmmxnow/src/i386/video/0000755000175000017500000000000011267646347020363 5ustar yavoryavoravifile-0.7.48~20090503.ds/libmmxnow/src/i386/video/Makefile.am0000644000175000017500000000030407457537372022417 0ustar yavoryavornoinst_LTLIBRARIES = libi386video.la noinst_HEADERS = create.h libi386video_la_SOURCES = create.c yuv2rgb_mmx.c AM_CPPFLAGS = -I$(srcdir)/.. -I$(srcdir)/../.. MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/libmmxnow/src/i386/video/create.c0000644000175000017500000000037607441632752021772 0ustar yavoryavor#include "create.h" //#include void mmxnow_create_i386_video(mmxnow_context_t* ctx, int method) { switch (method) { case MMXNOW_YV12_TO_BGR16: case MMXNOW_YV12_TO_BGR32: mmxnow_create_yuv2rgb_mmx(ctx, method); break; } } avifile-0.7.48~20090503.ds/libmmxnow/src/i386/video/create.h0000644000175000017500000000037407345203231021762 0ustar yavoryavor#ifndef MMXNOW_CREATE_I386_VIDEO_H #define MMXNOW_CREATE_I386_VIDEO_H #include "mmxnow_private.h" void mmxnow_create_i386_video(mmxnow_context_t*, int); void mmxnow_create_yuv2rgb_mmx(mmxnow_context_t*, int); #endif /* MMXNOW_CREATE_I386_VIDEO_H */ avifile-0.7.48~20090503.ds/libmmxnow/src/i386/video/rgb15to16mmx.c0000644000175000017500000000155207441632752022700 0ustar yavoryavor// Original by Strepto/Astral // ported to gcc & bugfixed : A'rpi #include //#include "attributes.h" #include "mmx.h" void rgb15to16_mmx(char* s0,char* d0,int count) { static uint64_t mask_b = 0x001F001F001F001FLL; // 00000000 00011111 xxB static uint64_t mask_rg = 0x7FE07FE07FE07FE0LL; // 01111111 11100000 RGx register char* s=s0+count; register char* d=d0+count; register int offs=-count; movq_m2r (mask_b, mm4); movq_m2r (mask_rg, mm5); while(offs<0){ movq_m2r (*(s+offs), mm0); movq_r2r (mm0, mm1); movq_m2r (*(s+8+offs), mm2); movq_r2r (mm2, mm3); pand_r2r (mm4, mm0); pand_r2r (mm5, mm1); psllq_i2r(1,mm1); pand_r2r (mm4, mm2); pand_r2r (mm5, mm3); por_r2r (mm1, mm0); psllq_i2r(1,mm3); movq_r2m (mm0,*(d+offs)); por_r2r (mm3,mm2); movq_r2m (mm2,*(d+8+offs)); offs+=16; } emms(); } avifile-0.7.48~20090503.ds/libmmxnow/src/i386/video/yuv2rgb_mmx.c0000644000175000017500000003545007441632752023011 0ustar yavoryavor /* * yuv2rgb_mmx.c, Software YUV to RGB coverter with Intel MMX "technology" * * Copyright (C) 2000, Silicon Integrated System Corp. * All Rights Reserved. * * Author: Olie Lho * * This file is part of mpeg2dec, a free MPEG-2 video decoder * * mpeg2dec is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * mpeg2dec 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* modified for mmxnow library */ #include "mmxnow_private.h" #include "mmx.h" //#include "yuv2rgb.h" #include #include /* hope these constant values are cache line aligned */ static const uint64_t mmx_80w = 0x0080008000800080; static const uint64_t mmx_10w = 0x1010101010101010; static const uint64_t mmx_00ffw = 0x00ff00ff00ff00ff; static const uint64_t mmx_Y_coeff = 0x253f253f253f253f; /* hope these constant values are cache line aligned */ static const uint64_t mmx_U_green = 0xf37df37df37df37d; static const uint64_t mmx_U_blue = 0x4093409340934093; static const uint64_t mmx_V_red = 0x3312331233123312; static const uint64_t mmx_V_green = 0xe5fce5fce5fce5fc; /* hope these constant values are cache line aligned */ static const uint64_t mmx_redmask = 0xf8f8f8f8f8f8f8f8; static const uint64_t mmx_grnmask = 0xfcfcfcfcfcfcfcfc; static const uint64_t mmx_grnshift = 0x03; static const uint64_t mmx_blueshift = 0x03; #if 0 #ifdef HAVE_MMX2 /* use this for K7 and p3 only */ #define MOVNTQ "movntq" #else /* for MMX-only processors */ #define MOVNTQ "movq" #endif #endif /* MMX2 */ /* for now this usage */ #define MOVNTQ "movq" static int yuv420_rgb16_mmx(struct mmxnow_context_t* ctx) { mmxnow_image_data_t* data = (mmxnow_image_data_t*) ctx->data; uint8_t* py = data->in.plane[0]; uint8_t* pu = data->in.plane[1]; uint8_t* pv = data->in.plane[2]; int y_stride = data->in.stride[0]; int uv_stride = data->in.stride[1]; int v_size = data->in.width; int h_size = data->in.height; uint8_t* image = data->out.plane[0]; int stride = data->out.stride[0]; int even = 1; int x, y; __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ ); for (y = v_size; --y >= 0; ) { uint8_t *_image = image; uint8_t *_py = py; uint8_t *_pu = pu; uint8_t *_pv = pv; /* load data for start of next scan line */ __asm__ __volatile__ ( "movd (%1), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ "movd (%2), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ "movq (%0), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ : : "r" (_py), "r" (_pu), "r" (_pv)); for (x = h_size >> 3; --x >= 0; ) { /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8 pixels in each iteration */ __asm__ __volatile__ ( /* Do the multiply part of the conversion for even and odd pixels, register usage: mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels, mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels, mm6 -> Y even, mm7 -> Y odd */ /* convert the chroma part */ "punpcklbw %%mm4, %%mm0;" /* scatter 4 Cb 00 u3 00 u2 00 u1 00 u0 */ "punpcklbw %%mm4, %%mm1;" /* scatter 4 Cr 00 v3 00 v2 00 v1 00 v0 */ "psubsw mmx_80w, %%mm0;" /* Cb -= 128 */ "psubsw mmx_80w, %%mm1;" /* Cr -= 128 */ "psllw $3, %%mm0;" /* Promote precision */ "psllw $3, %%mm1;" /* Promote precision */ "movq %%mm0, %%mm2;" /* Copy 4 Cb 00 u3 00 u2 00 u1 00 u0 */ "movq %%mm1, %%mm3;" /* Copy 4 Cr 00 v3 00 v2 00 v1 00 v0 */ "pmulhw mmx_U_green, %%mm2;" /* Mul Cb with green coeff -> Cb green */ "pmulhw mmx_V_green, %%mm3;" /* Mul Cr with green coeff -> Cr green */ "pmulhw mmx_U_blue, %%mm0;" /* Mul Cb -> Cblue 00 b3 00 b2 00 b1 00 b0 */ "pmulhw mmx_V_red, %%mm1;" /* Mul Cr -> Cred 00 r3 00 r2 00 r1 00 r0 */ "paddsw %%mm3, %%mm2;" /* Cb green + Cr green -> Cgreen */ /* convert the luma part */ "psubusb mmx_10w, %%mm6;" /* Y -= 16 */ "movq %%mm6, %%mm7;" /* Copy 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ "pand mmx_00ffw, %%mm6;" /* get Y even 00 Y6 00 Y4 00 Y2 00 Y0 */ "psrlw $8, %%mm7;" /* get Y odd 00 Y7 00 Y5 00 Y3 00 Y1 */ "psllw $3, %%mm6;" /* Promote precision */ "psllw $3, %%mm7;" /* Promote precision */ "pmulhw mmx_Y_coeff, %%mm6;" /* Mul 4 Y even 00 y6 00 y4 00 y2 00 y0 */ "pmulhw mmx_Y_coeff, %%mm7;" /* Mul 4 Y odd 00 y7 00 y5 00 y3 00 y1 */ /* Do the addition part of the conversion for even and odd pixels, register usage: mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels, mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels, mm6 -> Y even, mm7 -> Y odd */ "movq %%mm0, %%mm3;" /* Copy Cblue */ "movq %%mm1, %%mm4;" /* Copy Cred */ "movq %%mm2, %%mm5;" /* Copy Cgreen */ "paddsw %%mm6, %%mm0;" /* Y even + Cblue 00 B6 00 B4 00 B2 00 B0 */ "paddsw %%mm7, %%mm3;" /* Y odd + Cblue 00 B7 00 B5 00 B3 00 B1 */ "paddsw %%mm6, %%mm1;" /* Y even + Cred 00 R6 00 R4 00 R2 00 R0 */ "paddsw %%mm7, %%mm4;" /* Y odd + Cred 00 R7 00 R5 00 R3 00 R1 */ "paddsw %%mm6, %%mm2;" /* Y even + Cgreen 00 G6 00 G4 00 G2 00 G0 */ "paddsw %%mm7, %%mm5;" /* Y odd + Cgreen 00 G7 00 G5 00 G3 00 G1 */ /* Limit RGB even to 0..255 */ "packuswb %%mm0, %%mm0;" /* B6 B4 B2 B0 B6 B4 B2 B0 */ "packuswb %%mm1, %%mm1;" /* R6 R4 R2 R0 R6 R4 R2 R0 */ "packuswb %%mm2, %%mm2;" /* G6 G4 G2 G0 G6 G4 G2 G0 */ /* Limit RGB odd to 0..255 */ "packuswb %%mm3, %%mm3;" /* B7 B5 B3 B1 B7 B5 B3 B1 */ "packuswb %%mm4, %%mm4;" /* R7 R5 R3 R1 R7 R5 R3 R1 */ "packuswb %%mm5, %%mm5;" /* G7 G5 G3 G1 G7 G5 G3 G1 */ /* Interleave RGB even and odd */ "punpcklbw %%mm3, %%mm0;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ "punpcklbw %%mm4, %%mm1;" /* R7 R6 R5 R4 R3 R2 R1 R0 */ "punpcklbw %%mm5, %%mm2;" /* G7 G6 G5 G4 G3 G2 G1 G0 */ /* mask unneeded bits off */ "pand mmx_redmask, %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */ "pand mmx_grnmask, %%mm2;" /* g7g6g5g4 g3g2_0_0 g7g6g5g4 g3g2_0_0 */ "pand mmx_redmask, %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */ "psrlw mmx_blueshift,%%mm0;" /* 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3 */ "pxor %%mm4, %%mm4;" /* zero mm4 */ "movq %%mm0, %%mm5;" /* Copy B7-B0 */ "movq %%mm2, %%mm7;" /* Copy G7-G0 */ /* convert rgb24 plane to rgb16 pack for pixel 0-3 */ "punpcklbw %%mm4, %%mm2;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */ "punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */ "psllw mmx_blueshift,%%mm2;" /* 0_0_0_0 0_g7g6g5 g4g3g2_0 0_0_0_0 */ "por %%mm2, %%mm0;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */ "movq 8 (%0), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ MOVNTQ " %%mm0, (%3);" /* store pixel 0-3 */ /* convert rgb24 plane to rgb16 pack for pixel 0-3 */ "punpckhbw %%mm4, %%mm7;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */ "punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */ "psllw mmx_blueshift,%%mm7;" /* 0_0_0_0 0_g7g6g5 g4g3g2_0 0_0_0_0 */ "movd 4 (%1), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ "por %%mm7, %%mm5;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */ "movd 4 (%2), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ MOVNTQ " %%mm5, 8 (%3);" /* store pixel 4-7 */ : : "r" (_py), "r" (_pu), "r" (_pv), "r" (_image)); _py += 8; _pu += 4; _pv += 4; _image += 16; } if (!even) { pu += uv_stride; pv += uv_stride; } py += y_stride; image += stride; even = (!even); } emms(); return 0; } static int yuv420_argb32_mmx (struct mmxnow_context_t* ctx) { mmxnow_image_data_t* data = (mmxnow_image_data_t*) ctx->data; uint8_t* py = data->in.plane[0]; uint8_t* pu = data->in.plane[1]; uint8_t* pv = data->in.plane[2]; int y_stride = data->in.stride[0]; int uv_stride = data->in.stride[1]; int v_size = data->in.width; int h_size = data->in.height; uint8_t* image = data->out.plane[0]; int stride = data->out.stride[0]; int even = 1; int x, y; __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ ); for (y = v_size; --y >= 0; ) { uint8_t *_image = image; uint8_t *_py = py; uint8_t *_pu = pu; uint8_t *_pv = pv; /* load data for start of next scan line */ __asm__ __volatile__ ( "movd (%1), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ "movd (%2), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ "movq (%0), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ : : "r" (_py), "r" (_pu), "r" (_pv) ); for (x = h_size >> 3; --x >= 0; ) { /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8 pixels in each iteration */ __asm__ __volatile__ ( /* Do the multiply part of the conversion for even and odd pixels, register usage: mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels, mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels, mm6 -> Y even, mm7 -> Y odd */ /* convert the chroma part */ "punpcklbw %%mm4, %%mm0;" /* scatter 4 Cb 00 u3 00 u2 00 u1 00 u0 */ "punpcklbw %%mm4, %%mm1;" /* scatter 4 Cr 00 v3 00 v2 00 v1 00 v0 */ "psubsw mmx_80w, %%mm0;" /* Cb -= 128 */ "psubsw mmx_80w, %%mm1;" /* Cr -= 128 */ "psllw $3, %%mm0;" /* Promote precision */ "psllw $3, %%mm1;" /* Promote precision */ "movq %%mm0, %%mm2;" /* Copy 4 Cb 00 u3 00 u2 00 u1 00 u0 */ "movq %%mm1, %%mm3;" /* Copy 4 Cr 00 v3 00 v2 00 v1 00 v0 */ "pmulhw mmx_U_green, %%mm2;" /* Mul Cb with green coeff -> Cb green */ "pmulhw mmx_V_green, %%mm3;" /* Mul Cr with green coeff -> Cr green */ "pmulhw mmx_U_blue, %%mm0;" /* Mul Cb -> Cblue 00 b3 00 b2 00 b1 00 b0 */ "pmulhw mmx_V_red, %%mm1;" /* Mul Cr -> Cred 00 r3 00 r2 00 r1 00 r0 */ "paddsw %%mm3, %%mm2;" /* Cb green + Cr green -> Cgreen */ /* convert the luma part */ "psubusb mmx_10w, %%mm6;" /* Y -= 16 */ "movq %%mm6, %%mm7;" /* Copy 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ "pand mmx_00ffw, %%mm6;" /* get Y even 00 Y6 00 Y4 00 Y2 00 Y0 */ "psrlw $8, %%mm7;" /* get Y odd 00 Y7 00 Y5 00 Y3 00 Y1 */ "psllw $3, %%mm6;" /* Promote precision */ "psllw $3, %%mm7;" /* Promote precision */ "pmulhw mmx_Y_coeff, %%mm6;" /* Mul 4 Y even 00 y6 00 y4 00 y2 00 y0 */ "pmulhw mmx_Y_coeff, %%mm7;" /* Mul 4 Y odd 00 y7 00 y5 00 y3 00 y1 */ /* Do the addition part of the conversion for even and odd pixels, register usage: mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels, mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels, mm6 -> Y even, mm7 -> Y odd */ "movq %%mm0, %%mm3;" /* Copy Cblue */ "movq %%mm1, %%mm4;" /* Copy Cred */ "movq %%mm2, %%mm5;" /* Copy Cgreen */ "paddsw %%mm6, %%mm0;" /* Y even + Cblue 00 B6 00 B4 00 B2 00 B0 */ "paddsw %%mm7, %%mm3;" /* Y odd + Cblue 00 B7 00 B5 00 B3 00 B1 */ "paddsw %%mm6, %%mm1;" /* Y even + Cred 00 R6 00 R4 00 R2 00 R0 */ "paddsw %%mm7, %%mm4;" /* Y odd + Cred 00 R7 00 R5 00 R3 00 R1 */ "paddsw %%mm6, %%mm2;" /* Y even + Cgreen 00 G6 00 G4 00 G2 00 G0 */ "paddsw %%mm7, %%mm5;" /* Y odd + Cgreen 00 G7 00 G5 00 G3 00 G1 */ /* Limit RGB even to 0..255 */ "packuswb %%mm0, %%mm0;" /* B6 B4 B2 B0 B6 B4 B2 B0 */ "packuswb %%mm1, %%mm1;" /* R6 R4 R2 R0 R6 R4 R2 R0 */ "packuswb %%mm2, %%mm2;" /* G6 G4 G2 G0 G6 G4 G2 G0 */ /* Limit RGB odd to 0..255 */ "packuswb %%mm3, %%mm3;" /* B7 B5 B3 B1 B7 B5 B3 B1 */ "packuswb %%mm4, %%mm4;" /* R7 R5 R3 R1 R7 R5 R3 R1 */ "packuswb %%mm5, %%mm5;" /* G7 G5 G3 G1 G7 G5 G3 G1 */ /* Interleave RGB even and odd */ "punpcklbw %%mm3, %%mm0;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ "punpcklbw %%mm4, %%mm1;" /* R7 R6 R5 R4 R3 R2 R1 R0 */ "punpcklbw %%mm5, %%mm2;" /* G7 G6 G5 G4 G3 G2 G1 G0 */ /* convert RGB plane to RGB packed format, mm0 -> B, mm1 -> R, mm2 -> G, mm3 -> 0, mm4 -> GB, mm5 -> AR pixel 4-7, mm6 -> GB, mm7 -> AR pixel 0-3 */ "pxor %%mm3, %%mm3;" /* zero mm3 */ "movq %%mm0, %%mm6;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ "movq %%mm1, %%mm7;" /* R7 R6 R5 R4 R3 R2 R1 R0 */ "movq %%mm0, %%mm4;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ "movq %%mm1, %%mm5;" /* R7 R6 R5 R4 R3 R2 R1 R0 */ "punpcklbw %%mm2, %%mm6;" /* G3 B3 G2 B2 G1 B1 G0 B0 */ "punpcklbw %%mm3, %%mm7;" /* 00 R3 00 R2 00 R1 00 R0 */ "punpcklwd %%mm7, %%mm6;" /* 00 R1 B1 G1 00 R0 B0 G0 */ MOVNTQ " %%mm6, (%3);" /* Store ARGB1 ARGB0 */ "movq %%mm0, %%mm6;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ "punpcklbw %%mm2, %%mm6;" /* G3 B3 G2 B2 G1 B1 G0 B0 */ "punpckhwd %%mm7, %%mm6;" /* 00 R3 G3 B3 00 R2 B3 G2 */ MOVNTQ " %%mm6, 8 (%3);" /* Store ARGB3 ARGB2 */ "punpckhbw %%mm2, %%mm4;" /* G7 B7 G6 B6 G5 B5 G4 B4 */ "punpckhbw %%mm3, %%mm5;" /* 00 R7 00 R6 00 R5 00 R4 */ "punpcklwd %%mm5, %%mm4;" /* 00 R5 B5 G5 00 R4 B4 G4 */ MOVNTQ " %%mm4, 16 (%3);" /* Store ARGB5 ARGB4 */ "movq %%mm0, %%mm4;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ "punpckhbw %%mm2, %%mm4;" /* G7 B7 G6 B6 G5 B5 G4 B4 */ "punpckhwd %%mm5, %%mm4;" /* 00 R7 G7 B7 00 R6 B6 G6 */ MOVNTQ " %%mm4, 24 (%3);" /* Store ARGB7 ARGB6 */ "movd 4 (%1), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ "movd 4 (%2), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ "pxor %%mm4, %%mm4;" /* zero mm4 */ "movq 8 (%0), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ : : "r" (_py), "r" (_pu), "r" (_pv), "r" (_image)); _py += 8; _pu += 4; _pv += 4; _image += 32; } if (!even) { pu += uv_stride; pv += uv_stride; } py += y_stride; image += stride; even = (!even); } emms(); return 0; } void mmxnow_create_yuv2rgb_mmx(mmxnow_context_t* ctx, int method) { if ((ctx->flags & MMXNOW_MMX) && ctx->method == NULL) { switch (method) { case MMXNOW_YV12_TO_BGR16: ctx->method = yuv420_rgb16_mmx; ctx->name = "yuv2rgb_mmx YV12 to BGR16"; break; case MMXNOW_YV12_TO_BGR32: ctx->method = yuv420_argb32_mmx; ctx->name = "yuv2rgb_mmx YV12 to BGR32"; break; } if (ctx->method) ctx->data = calloc(1, sizeof(mmxnow_image_data_t)); } } avifile-0.7.48~20090503.ds/libmmxnow/src/i386/Makefile.am0000644000175000017500000000037607457537372021322 0ustar yavoryavorSUBDIRS = video noinst_HEADERS = mmx.h create.h cpudetect.h cputable.h noinst_LTLIBRARIES = libi386.la libi386_la_SOURCES = create.c cpudetect.c libi386_la_LIBADD = video/libi386video.la AM_CPPFLAGS = -I$(srcdir)/.. MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/libmmxnow/src/i386/cpudetect.c0000644000175000017500000002522507441633027021375 0ustar yavoryavor/* * code from mplayer * ffmpeg * renamed to match mmxnow style */ #include "cpudetect.h" #ifdef HAVE_MALLOC_H #include #endif #include #ifdef ARCH_X86 #include #ifdef __FreeBSD__ #include #include #endif #ifdef __linux__ #include #endif //#define X86_FXSR_MAGIC /* Thanks to the FreeBSD project for some of this cpuid code, and * help understanding how to use it. Thanks to the Mesa * team for SSE support detection and more cpu detect code. */ /* I believe this code works. However, it has only been used on a PII and PIII */ static void check_os_katmai_support( void ); #if 1 // return TRUE if cpuid supported static int has_cpuid() { int a, c; // code from libavcodec: __asm__ __volatile__ ( /* See if CPUID instruction is supported ... */ /* ... Get copies of EFLAGS into eax and ecx */ "pushf\n\t" "popl %0\n\t" "movl %0, %1\n\t" /* ... Toggle the ID bit in one copy and store */ /* to the EFLAGS reg */ "xorl $0x200000, %0\n\t" "push %0\n\t" "popf\n\t" /* ... Get the (hopefully modified) EFLAGS */ "pushf\n\t" "popl %0\n\t" : "=a" (a), "=c" (c) : : "cc" ); return (a!=c); } #endif static void do_cpuid(unsigned int ax, unsigned int *p) { #if 0 __asm __volatile( "cpuid;" : "=a" (p[0]), "=b" (p[1]), "=c" (p[2]), "=d" (p[3]) : "0" (ax) ); #else // code from libavcodec: __asm __volatile ("movl %%ebx, %%esi\n\t" "cpuid\n\t" "xchgl %%ebx, %%esi" : "=a" (p[0]), "=S" (p[1]), "=c" (p[2]), "=d" (p[3]) : "0" (ax)); #endif } void mmxnow_get_cpu_caps(cpu_caps_t *caps) { unsigned int regs[4]; unsigned int regs2[4]; caps->is_X86=1; memset(caps, 0, sizeof(*caps)); if (!has_cpuid()) { printf("CPUID not supported!???\n"); return; } do_cpuid(0x00000000, regs); // get _max_ cpuid level and vendor name printf("CPU vendor name: %.4s%.4s%.4s max cpuid level: %d\n", (char*) (regs+1),(char*) (regs+3),(char*) (regs+2), regs[0]); if (regs[0]>=0x00000001) { char *tmpstr; do_cpuid(0x00000001, regs2); tmpstr=GetCpuFriendlyName(regs, regs2); printf("CPU: %s ",tmpstr); free(tmpstr); caps->cpu_type=(regs2[0] >> 8)&0xf; if(caps->cpu_type==0xf){ // use extended family (P4, IA64) caps->cpu_type=8+((regs2[0]>>20)&255); } caps->cpu_stepping=regs2[0] & 0xf; printf("(Type: %d, Stepping: %d)\n", caps->cpu_type, caps->cpu_stepping); // general feature flags: caps->has_MMX = (regs2[3] & (1 << 23 )) >> 23; // 0x0800000 caps->has_SSE = (regs2[3] & (1 << 25 )) >> 25; // 0x2000000 caps->has_SSE2 = (regs2[3] & (1 << 26 )) >> 26; // 0x4000000 caps->has_MMX2 = caps->has_SSE; // SSE cpus supports mmxext too } do_cpuid(0x80000000, regs); if (regs[0]>=0x80000001) { printf("extended cpuid-level: %d\n",regs[0]&0x7FFFFFFF); do_cpuid(0x80000001, regs2); caps->has_MMX |= (regs2[3] & (1 << 23 )) >> 23; // 0x0800000 caps->has_MMX2 |= (regs2[3] & (1 << 22 )) >> 22; // 0x400000 caps->has_3DNow = (regs2[3] & (1 << 31 )) >> 31; //0x80000000 caps->has_3DNowExt = (regs2[3] & (1 << 30 )) >> 30; } #if 0 printf("cpudetect: MMX=%d MMX2=%d SSE=%d SSE2=%d 3DNow=%d 3DNowExt=%d\n", gCpuCaps.hasMMX, gCpuCaps.hasMMX2, gCpuCaps.hasSSE, gCpuCaps.hasSSE2, gCpuCaps.has3DNow, gCpuCaps.has3DNowExt ); #endif /* FIXME: Does SSE2 need more OS support, too? */ #if defined(__linux__) || defined(__FreeBSD__) if (caps->has_SSE) check_os_katmai_support(); if (!caps->has_SSE) caps->has_SSE2 = 0; #else caps->has_SSE=0; caps->has_SSE2 = 0; #endif // caps->has_3DNow=1; // caps->has_MMX2 = 0; // caps->has_MMX = 0; } #define CPUID_EXTFAMILY ((regs2[0] >> 20)&0xFF) /* 27..20 */ #define CPUID_EXTMODEL ((regs2[0] >> 16)&0x0F) /* 19..16 */ #define CPUID_TYPE ((regs2[0] >> 12)&0x04) /* 13..12 */ #define CPUID_FAMILY ((regs2[0] >> 8)&0x0F) /* 11..08 */ #define CPUID_MODEL ((regs2[0] >> 4)&0x0F) /* 07..04 */ #define CPUID_STEPPING ((regs2[0] >> 0)&0x0F) /* 03..00 */ char *mmxnow_get_cpu_name(unsigned int regs[], unsigned int regs2[]){ #include "cputable.h" /* get cpuname and cpuvendors */ char vendor[17]; char *retname; int i; if (NULL==(retname=(char*)malloc(256))) { printf("Error: GetCpuFriendlyName() not enough memory\n"); exit(1); } sprintf(vendor,"%.4s%.4s%.4s",(char*)(regs+1),(char*)(regs+3),(char*)(regs+2)); for(i=0; imagic != 0xffff ) { /* Our signal context has the extended FPU state, so reset the * divide-by-zero exception mask and clear the divide-by-zero * exception bit. */ sc.fpstate->mxcsr |= 0x00000200; sc.fpstate->mxcsr &= 0xfffffffb; } else { /* If we ever get here, we're completely hosed. */ printf( "\n\n" ); printf( "SSE enabling test failed badly!" ); } } #endif /* __linux__ && _POSIX_SOURCE && X86_FXSR_MAGIC */ /* If we're running on a processor that can do SSE, let's see if we * are allowed to or not. This will catch 2.4.0 or later kernels that * haven't been configured for a Pentium III but are running on one, * and RedHat patched 2.2 kernels that have broken exception handling * support for user space apps that do SSE. */ static void check_os_katmai_support( void ) { #if defined(__FreeBSD__) int has_sse=0, ret; size_t len=sizeof(has_sse); ret = sysctlbyname("hw.instruction_sse", &has_sse, &len, NULL, 0); if (ret || !has_sse) gCpuCaps.hasSSE=0; #elif defined(__linux__) #if defined(_POSIX_SOURCE) && defined(X86_FXSR_MAGIC) struct sigaction saved_sigill; struct sigaction saved_sigfpe; /* Save the original signal handlers. */ sigaction( SIGILL, NULL, &saved_sigill ); sigaction( SIGFPE, NULL, &saved_sigfpe ); signal( SIGILL, (void (*)(int))sigill_handler_sse ); signal( SIGFPE, (void (*)(int))sigfpe_handler_sse ); /* Emulate test for OSFXSR in CR4. The OS will set this bit if it * supports the extended FPU save and restore required for SSE. If * we execute an SSE instruction on a PIII and get a SIGILL, the OS * doesn't support Streaming SIMD Exceptions, even if the processor * does. */ if ( gCpuCaps.hasSSE ) { printf( "Testing OS support for SSE... " ); // __asm __volatile ("xorps %%xmm0, %%xmm0"); __asm __volatile ("xorps %xmm0, %xmm0"); if ( gCpuCaps.hasSSE ) { printf( "yes.\n" ); } else { printf( "no!\n" ); } } /* Emulate test for OSXMMEXCPT in CR4. The OS will set this bit if * it supports unmasked SIMD FPU exceptions. If we unmask the * exceptions, do a SIMD divide-by-zero and get a SIGILL, the OS * doesn't support unmasked SIMD FPU exceptions. If we get a SIGFPE * as expected, we're okay but we need to clean up after it. * * Are we being too stringent in our requirement that the OS support * unmasked exceptions? Certain RedHat 2.2 kernels enable SSE by * setting CR4.OSFXSR but don't support unmasked exceptions. Win98 * doesn't even support them. We at least know the user-space SSE * support is good in kernels that do support unmasked exceptions, * and therefore to be safe I'm going to leave this test in here. */ if ( gCpuCaps.hasSSE ) { printf( "Testing OS support for SSE unmasked exceptions... " ); // test_os_katmai_exception_support(); if ( gCpuCaps.hasSSE ) { printf( "yes.\n" ); } else { printf( "no!\n" ); } } /* Restore the original signal handlers. */ sigaction( SIGILL, &saved_sigill, NULL ); sigaction( SIGFPE, &saved_sigfpe, NULL ); /* If we've gotten to here and the XMM CPUID bit is still set, we're * safe to go ahead and hook out the SSE code throughout Mesa. */ if ( gCpuCaps.hasSSE ) { printf( "Tests of OS support for SSE passed.\n" ); } else { printf( "Tests of OS support for SSE failed!\n" ); } #else /* We can't use POSIX signal handling to test the availability of * SSE, so we disable it by default. */ printf( "Cannot test OS support for SSE, disabling to be safe.\n" ); gCpuCaps.has_SSE=0; #endif /* _POSIX_SOURCE && X86_FXSR_MAGIC */ #else /* Do nothing on other platforms for now. */ printf( "Not testing OS support for SSE, leaving disabled.\n" ); gCpuCaps.has_SSE=0; #endif /* __linux__ */ } #else /* ARCH_X86 */ void mmxnow_get_cpu_caps(cpu_caps_t* caps) { caps->cpu_type=0; caps->cpu_stepping=0; caps->has_MMX=0; caps->has_MMX2=0; caps->has_3DNow=0; caps->has_3DNowExt=0; caps->has_SSE=0; caps->has_SSE2=0; caps->is_x86=0; } #endif /* !ARCH_X86 */ avifile-0.7.48~20090503.ds/libmmxnow/src/i386/cpudetect.h0000644000175000017500000000101207441633027021366 0ustar yavoryavor#ifndef CPUDETECT_H #define CPUDETECT_H #define CPUTYPE_I386 3 #define CPUTYPE_I486 4 #define CPUTYPE_I586 5 #define CPUTYPE_I686 6 typedef struct cpu_caps_s { int cpu_type; int cpu_stepping; int has_MMX; int has_MMX2; int has_3DNow; int has_3DNowExt; int has_SSE; int has_SSE2; int is_x86; } cpu_caps_t; void mmxnow_get_cpu_caps(cpu_caps_t *caps); /* returned value is malloc()'ed so free() it after use */ char *mmxnow_get_cpu_name(unsigned int regs[], unsigned int regs2[]); #endif /* !CPUDETECT_H */ avifile-0.7.48~20090503.ds/libmmxnow/src/i386/cputable.h0000644000175000017500000002637407441633027021227 0ustar yavoryavor/* cputable.h - Maps CPUID to real CPU name. * Copyleft 2001 by Felix Buenemann * This file comes under the GNU GPL, see www.fsf.org for more info! */ #define MAX_VENDORS 8 /* Number of CPU Vendors */ //#define N_UNKNOWN "unknown" //#define N_UNKNOWNEXT "unknown extended model" #define N_UNKNOWN "" #define N_UNKNOWNEXT "" #define F_UNKNOWN { \ N_UNKNOWN, \ N_UNKNOWN, \ N_UNKNOWN, \ N_UNKNOWN, \ N_UNKNOWN, \ N_UNKNOWN, \ N_UNKNOWN, \ N_UNKNOWN, \ N_UNKNOWN, \ N_UNKNOWN, \ N_UNKNOWN, \ N_UNKNOWN, \ N_UNKNOWN, \ N_UNKNOWN, \ N_UNKNOWN, \ N_UNKNOWN \ } static const char *cpuname /* Vendor */ [MAX_VENDORS] /* Family */ [16] /* Model */ [16] = { /* Intel Corporation, "GenuineIntel" */ { /* 0 */ F_UNKNOWN, /* 1 */ F_UNKNOWN, /* 2 */ F_UNKNOWN, /* 3 i386 */ F_UNKNOWN, /* XXX new 386 chips may support CPUID! */ /* 4 i486 */ { /* 0 */ "i486DX-25/33", /* only few of these */ /* 1 */ "i486DX-50", /* support CPUID! */ /* 2 */ "i486SX", /* 3 */ "i486DX2", /* CPUID only on new chips! */ /* 4 */ "i486SL", /* 5 */ "i486SX2", /* 6 */ N_UNKNOWN, /* 7 */ "i486DX2/write-back", /* returns 3 in write-through mode */ /* 8 */ "i486DX4", /* 9 */ "i486DX4/write-back", /* A */ N_UNKNOWN, /* B */ N_UNKNOWN, /* C */ N_UNKNOWN, /* D */ N_UNKNOWN, /* E */ N_UNKNOWN, /* F */ N_UNKNOWNEXT }, /* 5 i586 */ { /* 0 */ "Pentium P5 A-step", /* 1 */ "Pentium P5", /* 2 */ "Pentium P54C", /* 3 */ "Pentium OverDrive P24T", /* 4 */ "Pentium MMX P55C", /* 5 */ N_UNKNOWN, /* XXX DX4 OverDrive? */ /* 6 */ N_UNKNOWN, /* XXX P5 OverDrive? */ /* 7 */ "Pentium P54C (new)", /* 8 */ "Pentium MMX P55C (new)", /* 9 */ N_UNKNOWN, /* A */ N_UNKNOWN, /* B */ N_UNKNOWN, /* C */ N_UNKNOWN, /* D */ N_UNKNOWN, /* E */ N_UNKNOWN, /* F */ N_UNKNOWNEXT }, /* 6 i686 */ { /* 0 */ "PentiumPro A-step", /* 1 */ "PentiumPro", /* 2 */ N_UNKNOWN, /* 3 */ "Pentium II Klamath/Pentium II OverDrive", /* 4 */ N_UNKNOWN, /* XXX P55CT - OverDrive for P54? */ /* 5 */ "Celeron Covington/Pentium II Deschutes,Tonga/Pentium II Xeon", /* 6 */ "Celeron A Mendocino/Pentium II Dixon", /* 7 */ "Pentium III Katmai/Pentium III Xeon Tanner", /* 8 */ "Celeron 2/Pentium III Coppermine,Geyserville", /* 9 */ N_UNKNOWN, /* A */ "Pentium III Xeon Cascades", /* B */ "Celeron 2/Pentium III Tualatin", /* C */ N_UNKNOWN, /* D */ N_UNKNOWN, /* E */ N_UNKNOWN, /* F */ N_UNKNOWNEXT }, /* 7 IA-64 */ { /* FIXME */ /* 0 */ N_UNKNOWN, /* 1 */ N_UNKNOWN, /* 2 */ N_UNKNOWN, /* 3 */ N_UNKNOWN, /* 4 */ N_UNKNOWN, /* 5 */ N_UNKNOWN, /* 6 */ N_UNKNOWN, /* 7 */ N_UNKNOWN, /* 8 */ N_UNKNOWN, /* 9 */ N_UNKNOWN, /* A */ N_UNKNOWN, /* B */ N_UNKNOWN, /* C */ N_UNKNOWN, /* D */ N_UNKNOWN, /* E */ N_UNKNOWN, /* F */ N_UNKNOWNEXT }, /* 8 */ F_UNKNOWN, /* 9 */ F_UNKNOWN, /* A */ F_UNKNOWN, /* B */ F_UNKNOWN, /* C */ F_UNKNOWN, /* D */ F_UNKNOWN, /* E */ F_UNKNOWN, /* F extended family (P4/new IA-64)*/ { /* 0 */ "Pentium 4 Willamette", /* 1 */ "Pentium 4 Xeon Foster", /*?*/ /* XXX 0.13µm P4 Northwood ??? */ /* 2 */ N_UNKNOWN, /* 3 */ N_UNKNOWN, /* 4 */ N_UNKNOWN, /* 5 */ N_UNKNOWN, /* 6 */ N_UNKNOWN, /* 7 */ N_UNKNOWN, /* 8 */ N_UNKNOWN, /* 9 */ N_UNKNOWN, /* A */ N_UNKNOWN, /* B */ N_UNKNOWN, /* C */ N_UNKNOWN, /* D */ N_UNKNOWN, /* E */ N_UNKNOWN, /* F */ N_UNKNOWNEXT } }, /* United Microelectronics Corporation, "UMC UMC UMC " */ { /* 0 */ F_UNKNOWN, /* 1 */ F_UNKNOWN, /* 2 */ F_UNKNOWN, /* 3 */ F_UNKNOWN, /* 4 486 (U5) */ { /* 0 */ N_UNKNOWN, /* 1 */ "486DX U5D", /* 2 */ "486SX U5S", /* 3 */ N_UNKNOWN, /* 4 */ N_UNKNOWN, /* 5 */ N_UNKNOWN, /* 6 */ N_UNKNOWN, /* 7 */ N_UNKNOWN, /* 8 */ N_UNKNOWN, /* 9 */ N_UNKNOWN, /* A */ N_UNKNOWN, /* B */ N_UNKNOWN, /* C */ N_UNKNOWN, /* D */ N_UNKNOWN, /* E */ N_UNKNOWN, /* F */ N_UNKNOWN }, /* 5 */ F_UNKNOWN, /* 6 */ F_UNKNOWN, /* 7 */ F_UNKNOWN, /* 8 */ F_UNKNOWN, /* 9 */ F_UNKNOWN, /* A */ F_UNKNOWN, /* B */ F_UNKNOWN, /* C */ F_UNKNOWN, /* D */ F_UNKNOWN, /* E */ F_UNKNOWN, /* F */ F_UNKNOWN }, /* Advanced Micro Devices, "AuthenticAMD" (very rare: "AMD ISBETTER") */ { /* 0 */ F_UNKNOWN, /* 1 */ F_UNKNOWN, /* 2 */ F_UNKNOWN, /* 3 */ F_UNKNOWN, /* 4 486/5x86 */ { /* 0 */ N_UNKNOWN, /* 1 */ N_UNKNOWN, /* 2 */ N_UNKNOWN, /* 3 */ "486DX2", /* 4 */ N_UNKNOWN, /* 5 */ N_UNKNOWN, /* 6 */ N_UNKNOWN, /* 7 */ "486DX2/write-back", /* 8 */ "486DX4/5x86", /* 9 */ "486DX4/write-back", /* A */ N_UNKNOWN, /* B */ N_UNKNOWN, /* C */ N_UNKNOWN, /* D */ N_UNKNOWN, /* E */ "5x86", /* F */ "5x86/write-back" }, /* 5 K5/K6 */ { /* 0 */ "K5 SSA5 (PR75,PR90,PR100)", /* 1 */ "K5 5k86 (PR120,PR133)", /* 2 */ "K5 5k86 (PR166)", /* 3 */ "K5 5k86 (PR200)", /* 4 */ N_UNKNOWN, /* 5 */ N_UNKNOWN, /* 6 */ "K6", /* 7 */ "K6 Little Foot", /* 8 */ "K6-2", /* 9 */ "K6-III Chomper", /* A */ N_UNKNOWN, /* B */ N_UNKNOWN, /* C */ N_UNKNOWN, /* D */ "K6-2+/K6-III+ Sharptooth", /* E */ N_UNKNOWN, /* F */ N_UNKNOWN }, /* 6 K7 */ { /* 0 */ N_UNKNOWN, /* Argon? */ /* 1 */ "Athlon K7", /* 2 */ "Athlon K75 Pluto,Orion", /* 3 */ "Duron SF Spitfire", /* 4 */ "Athlon TB Thunderbird", /* 5 */ N_UNKNOWN, /* 6 */ "Athlon 4 PM Palomino/Athlon MP Multiprocessor/Athlon XP eXtreme Performance", /* 7 */ "Duron MG Morgan", /* 8 */ N_UNKNOWN, /* 9 */ N_UNKNOWN, /* A */ N_UNKNOWN, /* B */ N_UNKNOWN, /* E */ N_UNKNOWN, /* C */ N_UNKNOWN, /* D */ N_UNKNOWN, /* F */ N_UNKNOWN }, /* 7 */ F_UNKNOWN, /* 8 */ F_UNKNOWN, /* 9 */ F_UNKNOWN, /* A */ F_UNKNOWN, /* B */ F_UNKNOWN, /* C */ F_UNKNOWN, /* D */ F_UNKNOWN, /* E */ F_UNKNOWN, /* F */ F_UNKNOWN }, /* Cyrix Corp./VIA Inc., "CyrixInstead" */ { /* 0 */ F_UNKNOWN, /* 1 */ F_UNKNOWN, /* 2 */ F_UNKNOWN, /* 3 */ F_UNKNOWN, /* 4 5x86 */ { /* 0 */ N_UNKNOWN, /* 1 */ N_UNKNOWN, /* 2 */ N_UNKNOWN, /* 3 */ N_UNKNOWN, /* 4 */ "MediaGX", /* 5 */ N_UNKNOWN, /* 6 */ N_UNKNOWN, /* 7 */ N_UNKNOWN, /* 8 */ N_UNKNOWN, /* 9 */ "5x86", /* CPUID maybe only on newer chips */ /* A */ N_UNKNOWN, /* B */ N_UNKNOWN, /* E */ N_UNKNOWN, /* C */ N_UNKNOWN, /* D */ N_UNKNOWN, /* F */ N_UNKNOWN }, /* 5 M1 */ { /* 0 */ "M1 test-sample", /*?*/ /* 1 */ N_UNKNOWN, /* 2 */ "6x86 M1", /* 3 */ N_UNKNOWN, /* 4 */ "GXm", /* 5 */ N_UNKNOWN, /* 6 */ N_UNKNOWN, /* 7 */ N_UNKNOWN, /* 8 */ N_UNKNOWN, /* 9 */ N_UNKNOWN, /* A */ N_UNKNOWN, /* B */ N_UNKNOWN, /* E */ N_UNKNOWN, /* C */ N_UNKNOWN, /* D */ N_UNKNOWN, /* F */ N_UNKNOWN }, /* 6 M2 */ { /* 0 */ "6x86MX M2/M-II", /* 1 */ N_UNKNOWN, /* 2 */ N_UNKNOWN, /* 3 */ N_UNKNOWN, /* 4 */ N_UNKNOWN, /* 5 */ "Cyrix III Joshua (M2 core)", /* 6 */ "Cyrix III Samuel (WinChip C5A core)", /* 7 */ "C3 Samuel 2 (WinChip C5B core)", /* 8 */ N_UNKNOWN, /* XXX Samuel 3/Ezra? */ /* 9 */ N_UNKNOWN, /* A */ N_UNKNOWN, /* B */ N_UNKNOWN, /* E */ N_UNKNOWN, /* C */ N_UNKNOWN, /* D */ N_UNKNOWN, /* F */ N_UNKNOWN }, /* 7 */ F_UNKNOWN, /* 8 */ F_UNKNOWN, /* 9 */ F_UNKNOWN, /* A */ F_UNKNOWN, /* B */ F_UNKNOWN, /* C */ F_UNKNOWN, /* D */ F_UNKNOWN, /* E */ F_UNKNOWN, /* F */ F_UNKNOWN }, /* NexGen Inc., "NexGenDriven" */ { /* 0 */ F_UNKNOWN, /* 1 */ F_UNKNOWN, /* 2 */ F_UNKNOWN, /* 3 */ F_UNKNOWN, /* 4 */ F_UNKNOWN, /* 5 Nx586 */ { /* 0 */ "Nx586/Nx586FPU", /* only newer ones support CPUID! */ /* 1 */ N_UNKNOWN, /* 2 */ N_UNKNOWN, /* 3 */ N_UNKNOWN, /* 4 */ N_UNKNOWN, /* 5 */ N_UNKNOWN, /* 6 */ N_UNKNOWN, /* 7 */ N_UNKNOWN, /* 8 */ N_UNKNOWN, /* 9 */ N_UNKNOWN, /* A */ N_UNKNOWN, /* B */ N_UNKNOWN, /* E */ N_UNKNOWN, /* C */ N_UNKNOWN, /* D */ N_UNKNOWN, /* F */ N_UNKNOWN }, /* 6 */ F_UNKNOWN, /* 7 */ F_UNKNOWN, /* 8 */ F_UNKNOWN, /* 9 */ F_UNKNOWN, /* A */ F_UNKNOWN, /* B */ F_UNKNOWN, /* C */ F_UNKNOWN, /* D */ F_UNKNOWN, /* E */ F_UNKNOWN, /* F */ F_UNKNOWN }, /* IDT/Centaur/VIA, "CentaurHauls" */ { /* 0 */ F_UNKNOWN, /* 1 */ F_UNKNOWN, /* 2 */ F_UNKNOWN, /* 3 */ F_UNKNOWN, /* 4 */ F_UNKNOWN, /* 5 IDT C6 WinChip */ { /* 0 */ N_UNKNOWN, /* 1 */ N_UNKNOWN, /* 2 */ N_UNKNOWN, /* 3 */ N_UNKNOWN, /* 4 */ "WinChip C6", /* 5 */ N_UNKNOWN, /* 6 */ "Samuel", /* 7 */ N_UNKNOWN, /* 8 */ "WinChip 2 C6+,W2,W2A,W2B", /* 9 */ "WinChip 3 W3", /* A */ N_UNKNOWN, /* B */ N_UNKNOWN, /* E */ N_UNKNOWN, /* C */ N_UNKNOWN, /* D */ N_UNKNOWN, /* F */ N_UNKNOWN }, /* 6 */ F_UNKNOWN, /* 7 */ F_UNKNOWN, /* 8 */ F_UNKNOWN, /* 9 */ F_UNKNOWN, /* A */ F_UNKNOWN, /* B */ F_UNKNOWN, /* C */ F_UNKNOWN, /* D */ F_UNKNOWN, /* E */ F_UNKNOWN, /* F */ F_UNKNOWN }, /* Rise, "RiseRiseRise" */ { /* 0 */ F_UNKNOWN, /* 1 */ F_UNKNOWN, /* 2 */ F_UNKNOWN, /* 3 */ F_UNKNOWN, /* 4 */ F_UNKNOWN, /* 5 mP6 */ { /* 0 */ "mP6 iDragon 6401,6441 Kirin", /* 1 */ "mP6 iDragon 6510 Lynx", /* 2 */ N_UNKNOWN, /* 3 */ N_UNKNOWN, /* 4 */ N_UNKNOWN, /* 5 */ N_UNKNOWN, /* 6 */ N_UNKNOWN, /* 7 */ N_UNKNOWN, /* 8 */ "mP6 iDragon II", /* 9 */ "mP6 iDragon II (new)", /* A */ N_UNKNOWN, /* B */ N_UNKNOWN, /* E */ N_UNKNOWN, /* C */ N_UNKNOWN, /* D */ N_UNKNOWN, /* F */ N_UNKNOWN }, /* 6 */ F_UNKNOWN, /* 7 */ F_UNKNOWN, /* 8 */ F_UNKNOWN, /* 9 */ F_UNKNOWN, /* A */ F_UNKNOWN, /* B */ F_UNKNOWN, /* C */ F_UNKNOWN, /* D */ F_UNKNOWN, /* E */ F_UNKNOWN, /* F */ F_UNKNOWN }, /* Transmeta, "GenuineTMx86" */ { /* 0 */ F_UNKNOWN, /* 1 */ F_UNKNOWN, /* 2 */ F_UNKNOWN, /* 3 */ F_UNKNOWN, /* 4 */ F_UNKNOWN, /* 5 Crusoe */ { /* 0 */ N_UNKNOWN, /* 1 */ N_UNKNOWN, /* 2 */ N_UNKNOWN, /* 3 */ N_UNKNOWN, /* 4 */ "Crusoe TM3x00,TM5x00", /* 5 */ N_UNKNOWN, /* 6 */ N_UNKNOWN, /* 7 */ N_UNKNOWN, /* 8 */ N_UNKNOWN, /* 9 */ N_UNKNOWN, /* A */ N_UNKNOWN, /* B */ N_UNKNOWN, /* E */ N_UNKNOWN, /* C */ N_UNKNOWN, /* D */ N_UNKNOWN, /* F */ N_UNKNOWN }, /* 6 */ F_UNKNOWN, /* 7 */ F_UNKNOWN, /* 8 */ F_UNKNOWN, /* 9 */ F_UNKNOWN, /* A */ F_UNKNOWN, /* B */ F_UNKNOWN, /* C */ F_UNKNOWN, /* D */ F_UNKNOWN, /* E */ F_UNKNOWN, /* F */ F_UNKNOWN } }; #undef N_UNKNOWNEXT #undef N_UNKNOWN #undef F_UNKNOWN static const struct { char string[13]; char name[48]; } cpuvendors[MAX_VENDORS] ={ {"GenuineIntel","Intel"}, {"UMC UMC UMC ","United Microelectronics Corporation"}, {"AuthenticAMD","Advanced Micro Devices"}, {"CyrixInstead","Cyrix/VIA"}, {"NexGenDriven","NexGen"}, {"CentaurHauls","IDT/Centaur/VIA"}, {"RiseRiseRise","Rise"}, {"GenuineTMx86","Transmeta"} }; avifile-0.7.48~20090503.ds/libmmxnow/src/i386/create.c0000644000175000017500000000022207345203231020637 0ustar yavoryavor#include "create.h" #include void mmxnow_create_i386(mmxnow_context_t* ctx, int method) { mmxnow_create_i386_video(ctx, method); } avifile-0.7.48~20090503.ds/libmmxnow/src/i386/create.h0000644000175000017500000000025607345203231020653 0ustar yavoryavor#ifndef MMXNOW_I386_CREATE_H #define MMXNOW_I386_CREATE_H #include "mmxnow_private.h" //void mmxnow_create_i386(mmxnow_context_t*, int); #endif /* MMXNOW_I386_CREATE_H */ avifile-0.7.48~20090503.ds/libmmxnow/src/i386/mmx.h0000644000175000017500000002241007342747435020225 0ustar yavoryavor/* * mmx.h * Copyright (C) 1997-2001 H. Dietz and R. Fisher */ /* * The type of an value that fits in an MMX register (note that long * long constant values MUST be suffixed by LL and unsigned long long * values by ULL, lest they be truncated by the compiler) */ typedef union { long long q; /* Quadword (64-bit) value */ unsigned long long uq; /* Unsigned Quadword */ int d[2]; /* 2 Doubleword (32-bit) values */ unsigned int ud[2]; /* 2 Unsigned Doubleword */ short w[4]; /* 4 Word (16-bit) values */ unsigned short uw[4]; /* 4 Unsigned Word */ char b[8]; /* 8 Byte (8-bit) values */ unsigned char ub[8]; /* 8 Unsigned Byte */ float s[2]; /* Single-precision (32-bit) value */ } mmx_t; /* On an 8-byte (64-bit) boundary */ #define mmx_i2r(op,imm,reg) \ __asm__ __volatile__ (#op " %0, %%" #reg \ : /* nothing */ \ : "i" (imm) ) #define mmx_m2r(op,mem,reg) \ __asm__ __volatile__ (#op " %0, %%" #reg \ : /* nothing */ \ : "m" (mem)) #define mmx_r2m(op,reg,mem) \ __asm__ __volatile__ (#op " %%" #reg ", %0" \ : "=m" (mem) \ : /* nothing */ ) #define mmx_r2r(op,regs,regd) \ __asm__ __volatile__ (#op " %" #regs ", %" #regd) #define emms() __asm__ __volatile__ ("emms") #define movd_m2r(var,reg) mmx_m2r (movd, var, reg) #define movd_r2m(reg,var) mmx_r2m (movd, reg, var) #define movd_r2r(regs,regd) mmx_r2r (movd, regs, regd) #define movq_m2r(var,reg) mmx_m2r (movq, var, reg) #define movq_r2m(reg,var) mmx_r2m (movq, reg, var) #define movq_r2r(regs,regd) mmx_r2r (movq, regs, regd) #define packssdw_m2r(var,reg) mmx_m2r (packssdw, var, reg) #define packssdw_r2r(regs,regd) mmx_r2r (packssdw, regs, regd) #define packsswb_m2r(var,reg) mmx_m2r (packsswb, var, reg) #define packsswb_r2r(regs,regd) mmx_r2r (packsswb, regs, regd) #define packuswb_m2r(var,reg) mmx_m2r (packuswb, var, reg) #define packuswb_r2r(regs,regd) mmx_r2r (packuswb, regs, regd) #define paddb_m2r(var,reg) mmx_m2r (paddb, var, reg) #define paddb_r2r(regs,regd) mmx_r2r (paddb, regs, regd) #define paddd_m2r(var,reg) mmx_m2r (paddd, var, reg) #define paddd_r2r(regs,regd) mmx_r2r (paddd, regs, regd) #define paddw_m2r(var,reg) mmx_m2r (paddw, var, reg) #define paddw_r2r(regs,regd) mmx_r2r (paddw, regs, regd) #define paddsb_m2r(var,reg) mmx_m2r (paddsb, var, reg) #define paddsb_r2r(regs,regd) mmx_r2r (paddsb, regs, regd) #define paddsw_m2r(var,reg) mmx_m2r (paddsw, var, reg) #define paddsw_r2r(regs,regd) mmx_r2r (paddsw, regs, regd) #define paddusb_m2r(var,reg) mmx_m2r (paddusb, var, reg) #define paddusb_r2r(regs,regd) mmx_r2r (paddusb, regs, regd) #define paddusw_m2r(var,reg) mmx_m2r (paddusw, var, reg) #define paddusw_r2r(regs,regd) mmx_r2r (paddusw, regs, regd) #define pand_m2r(var,reg) mmx_m2r (pand, var, reg) #define pand_r2r(regs,regd) mmx_r2r (pand, regs, regd) #define pandn_m2r(var,reg) mmx_m2r (pandn, var, reg) #define pandn_r2r(regs,regd) mmx_r2r (pandn, regs, regd) #define pcmpeqb_m2r(var,reg) mmx_m2r (pcmpeqb, var, reg) #define pcmpeqb_r2r(regs,regd) mmx_r2r (pcmpeqb, regs, regd) #define pcmpeqd_m2r(var,reg) mmx_m2r (pcmpeqd, var, reg) #define pcmpeqd_r2r(regs,regd) mmx_r2r (pcmpeqd, regs, regd) #define pcmpeqw_m2r(var,reg) mmx_m2r (pcmpeqw, var, reg) #define pcmpeqw_r2r(regs,regd) mmx_r2r (pcmpeqw, regs, regd) #define pcmpgtb_m2r(var,reg) mmx_m2r (pcmpgtb, var, reg) #define pcmpgtb_r2r(regs,regd) mmx_r2r (pcmpgtb, regs, regd) #define pcmpgtd_m2r(var,reg) mmx_m2r (pcmpgtd, var, reg) #define pcmpgtd_r2r(regs,regd) mmx_r2r (pcmpgtd, regs, regd) #define pcmpgtw_m2r(var,reg) mmx_m2r (pcmpgtw, var, reg) #define pcmpgtw_r2r(regs,regd) mmx_r2r (pcmpgtw, regs, regd) #define pmaddwd_m2r(var,reg) mmx_m2r (pmaddwd, var, reg) #define pmaddwd_r2r(regs,regd) mmx_r2r (pmaddwd, regs, regd) #define pmulhw_m2r(var,reg) mmx_m2r (pmulhw, var, reg) #define pmulhw_r2r(regs,regd) mmx_r2r (pmulhw, regs, regd) #define pmullw_m2r(var,reg) mmx_m2r (pmullw, var, reg) #define pmullw_r2r(regs,regd) mmx_r2r (pmullw, regs, regd) #define por_m2r(var,reg) mmx_m2r (por, var, reg) #define por_r2r(regs,regd) mmx_r2r (por, regs, regd) #define pslld_i2r(imm,reg) mmx_i2r (pslld, imm, reg) #define pslld_m2r(var,reg) mmx_m2r (pslld, var, reg) #define pslld_r2r(regs,regd) mmx_r2r (pslld, regs, regd) #define psllq_i2r(imm,reg) mmx_i2r (psllq, imm, reg) #define psllq_m2r(var,reg) mmx_m2r (psllq, var, reg) #define psllq_r2r(regs,regd) mmx_r2r (psllq, regs, regd) #define psllw_i2r(imm,reg) mmx_i2r (psllw, imm, reg) #define psllw_m2r(var,reg) mmx_m2r (psllw, var, reg) #define psllw_r2r(regs,regd) mmx_r2r (psllw, regs, regd) #define psrad_i2r(imm,reg) mmx_i2r (psrad, imm, reg) #define psrad_m2r(var,reg) mmx_m2r (psrad, var, reg) #define psrad_r2r(regs,regd) mmx_r2r (psrad, regs, regd) #define psraw_i2r(imm,reg) mmx_i2r (psraw, imm, reg) #define psraw_m2r(var,reg) mmx_m2r (psraw, var, reg) #define psraw_r2r(regs,regd) mmx_r2r (psraw, regs, regd) #define psrld_i2r(imm,reg) mmx_i2r (psrld, imm, reg) #define psrld_m2r(var,reg) mmx_m2r (psrld, var, reg) #define psrld_r2r(regs,regd) mmx_r2r (psrld, regs, regd) #define psrlq_i2r(imm,reg) mmx_i2r (psrlq, imm, reg) #define psrlq_m2r(var,reg) mmx_m2r (psrlq, var, reg) #define psrlq_r2r(regs,regd) mmx_r2r (psrlq, regs, regd) #define psrlw_i2r(imm,reg) mmx_i2r (psrlw, imm, reg) #define psrlw_m2r(var,reg) mmx_m2r (psrlw, var, reg) #define psrlw_r2r(regs,regd) mmx_r2r (psrlw, regs, regd) #define psubb_m2r(var,reg) mmx_m2r (psubb, var, reg) #define psubb_r2r(regs,regd) mmx_r2r (psubb, regs, regd) #define psubd_m2r(var,reg) mmx_m2r (psubd, var, reg) #define psubd_r2r(regs,regd) mmx_r2r (psubd, regs, regd) #define psubw_m2r(var,reg) mmx_m2r (psubw, var, reg) #define psubw_r2r(regs,regd) mmx_r2r (psubw, regs, regd) #define psubsb_m2r(var,reg) mmx_m2r (psubsb, var, reg) #define psubsb_r2r(regs,regd) mmx_r2r (psubsb, regs, regd) #define psubsw_m2r(var,reg) mmx_m2r (psubsw, var, reg) #define psubsw_r2r(regs,regd) mmx_r2r (psubsw, regs, regd) #define psubusb_m2r(var,reg) mmx_m2r (psubusb, var, reg) #define psubusb_r2r(regs,regd) mmx_r2r (psubusb, regs, regd) #define psubusw_m2r(var,reg) mmx_m2r (psubusw, var, reg) #define psubusw_r2r(regs,regd) mmx_r2r (psubusw, regs, regd) #define punpckhbw_m2r(var,reg) mmx_m2r (punpckhbw, var, reg) #define punpckhbw_r2r(regs,regd) mmx_r2r (punpckhbw, regs, regd) #define punpckhdq_m2r(var,reg) mmx_m2r (punpckhdq, var, reg) #define punpckhdq_r2r(regs,regd) mmx_r2r (punpckhdq, regs, regd) #define punpckhwd_m2r(var,reg) mmx_m2r (punpckhwd, var, reg) #define punpckhwd_r2r(regs,regd) mmx_r2r (punpckhwd, regs, regd) #define punpcklbw_m2r(var,reg) mmx_m2r (punpcklbw, var, reg) #define punpcklbw_r2r(regs,regd) mmx_r2r (punpcklbw, regs, regd) #define punpckldq_m2r(var,reg) mmx_m2r (punpckldq, var, reg) #define punpckldq_r2r(regs,regd) mmx_r2r (punpckldq, regs, regd) #define punpcklwd_m2r(var,reg) mmx_m2r (punpcklwd, var, reg) #define punpcklwd_r2r(regs,regd) mmx_r2r (punpcklwd, regs, regd) #define pxor_m2r(var,reg) mmx_m2r (pxor, var, reg) #define pxor_r2r(regs,regd) mmx_r2r (pxor, regs, regd) /* 3DNOW extensions */ #define pavgusb_m2r(var,reg) mmx_m2r (pavgusb, var, reg) #define pavgusb_r2r(regs,regd) mmx_r2r (pavgusb, regs, regd) /* AMD MMX extensions - also available in intel SSE */ #define mmx_m2ri(op,mem,reg,imm) \ __asm__ __volatile__ (#op " %1, %0, %%" #reg \ : /* nothing */ \ : "X" (mem), "X" (imm)) #define mmx_r2ri(op,regs,regd,imm) \ __asm__ __volatile__ (#op " %0, %%" #regs ", %%" #regd \ : /* nothing */ \ : "X" (imm) ) #define mmx_fetch(mem,hint) \ __asm__ __volatile__ ("prefetch" #hint " %0" \ : /* nothing */ \ : "X" (mem)) #define maskmovq(regs,maskreg) mmx_r2ri (maskmovq, regs, maskreg) #define movntq_r2m(mmreg,var) mmx_r2m (movntq, mmreg, var) #define pavgb_m2r(var,reg) mmx_m2r (pavgb, var, reg) #define pavgb_r2r(regs,regd) mmx_r2r (pavgb, regs, regd) #define pavgw_m2r(var,reg) mmx_m2r (pavgw, var, reg) #define pavgw_r2r(regs,regd) mmx_r2r (pavgw, regs, regd) #define pextrw_r2r(mmreg,reg,imm) mmx_r2ri (pextrw, mmreg, reg, imm) #define pinsrw_r2r(reg,mmreg,imm) mmx_r2ri (pinsrw, reg, mmreg, imm) #define pmaxsw_m2r(var,reg) mmx_m2r (pmaxsw, var, reg) #define pmaxsw_r2r(regs,regd) mmx_r2r (pmaxsw, regs, regd) #define pmaxub_m2r(var,reg) mmx_m2r (pmaxub, var, reg) #define pmaxub_r2r(regs,regd) mmx_r2r (pmaxub, regs, regd) #define pminsw_m2r(var,reg) mmx_m2r (pminsw, var, reg) #define pminsw_r2r(regs,regd) mmx_r2r (pminsw, regs, regd) #define pminub_m2r(var,reg) mmx_m2r (pminub, var, reg) #define pminub_r2r(regs,regd) mmx_r2r (pminub, regs, regd) #define pmovmskb(mmreg,reg) \ __asm__ __volatile__ ("movmskps %" #mmreg ", %" #reg) #define pmulhuw_m2r(var,reg) mmx_m2r (pmulhuw, var, reg) #define pmulhuw_r2r(regs,regd) mmx_r2r (pmulhuw, regs, regd) #define prefetcht0(mem) mmx_fetch (mem, t0) #define prefetcht1(mem) mmx_fetch (mem, t1) #define prefetcht2(mem) mmx_fetch (mem, t2) #define prefetchnta(mem) mmx_fetch (mem, nta) #define psadbw_m2r(var,reg) mmx_m2r (psadbw, var, reg) #define psadbw_r2r(regs,regd) mmx_r2r (psadbw, regs, regd) #define pshufw_m2r(var,reg,imm) mmx_m2ri(pshufw, var, reg, imm) #define pshufw_r2r(regs,regd,imm) mmx_r2ri(pshufw, regs, regd, imm) #define sfence() __asm__ __volatile__ ("sfence\n\t") avifile-0.7.48~20090503.ds/libmmxnow/src/i386/mmx_defines.h0000644000175000017500000000121207441633027021706 0ustar yavoryavor#ifndef MMX_DEFINES_H #define MMX_DEFINES_H #ifdef HAVE_3DNOW #define PREFETCH "prefetch" #define PREFETCHW "prefetchw" #elif defined ( HAVE_MMX2 ) #define PREFETCH "prefetchnta" #define PREFETCHW "prefetcht0" #else #define PREFETCH "/nop" #define PREFETCHW "/nop" #endif #ifdef HAVE_MMX2 #define SFENCE "sfence" #else #define SFENCE "/nop" #endif #ifdef HAVE_MMX2 #define PAVGB(a,b) "pavgb " #a ", " #b "\n\t" #elif defined (HAVE_3DNOW) #define PAVGB(a,b) "pavgusb " #a ", " #b "\n\t" #endif #ifdef HAVE_MMX2 #define MOVNTQ(a,b) "movntq " #a ", " #b "\n\t" #else #define MOVNTQ(a,b) "movq " #a ", " #b "\n\t" #endif #endif /* MMX_DEFINES_H */ avifile-0.7.48~20090503.ds/libmmxnow/src/i386/rgb15to16mmx.c0000644000175000017500000000151607441632752021572 0ustar yavoryavor// Original by Strepto/Astral // ported to gcc & bugfixed : A'rpi #include //#include "attributes.h" #include "mmx.h" void rgb15to16_mmx(char* dst, const char* src, int count) { static uint64_t mask_b = 0x001F001F001F001FLL; // 00000000 00011111 xxB static uint64_t mask_rg = 0x7FE07FE07FE07FE0LL; // 01111111 11100000 RGx char* s=s0+count; char* d=d0+count; int offs=-count; movq_m2r (mask_b, mm4); movq_m2r (mask_rg, mm5); while(offs<0){ movq_m2r (*(s+offs), mm0); movq_r2r (mm0, mm1); movq_m2r (*(s+8+offs), mm2); movq_r2r (mm2, mm3); pand_r2r (mm4, mm0); pand_r2r (mm5, mm1); psllq_i2r(1, mm1); pand_r2r (mm4, mm2); pand_r2r (mm5, mm3); por_r2r (mm1, mm0); psllq_i2r(1,mm3); movq_r2m (mm0,*(d+offs)); por_r2r (mm3,mm2); movq_r2m (mm2,*(d+8+offs)); offs+=16; } } avifile-0.7.48~20090503.ds/libmmxnow/src/i386/yuv2rgb_mmx.c0000644000175000017500000003553007441632752021702 0ustar yavoryavor /* * yuv2rgb_mmx.c, Software YUV to RGB coverter with Intel MMX "technology" * * Copyright (C) 2000, Silicon Integrated System Corp. * All Rights Reserved. * * Author: Olie Lho * * This file is part of mpeg2dec, a free MPEG-2 video decoder * * mpeg2dec is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * mpeg2dec 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* modified for mmxnow */ #include "mmxnow.h" #include "mmxnow_private.h" #include "mmx.h" //#include "yuv2rgb.h" #include #include /* hope these constant values are cache line aligned */ static const uint64_t mmx_80w = 0x0080008000800080; static const uint64_t mmx_10w = 0x1010101010101010; static const uint64_t mmx_00ffw = 0x00ff00ff00ff00ff; static const uint64_t mmx_Y_coeff = 0x253f253f253f253f; /* hope these constant values are cache line aligned */ static const uint64_t mmx_U_green = 0xf37df37df37df37d; static const uint64_t mmx_U_blue = 0x4093409340934093; static const uint64_t mmx_V_red = 0x3312331233123312; static const uint64_t mmx_V_green = 0xe5fce5fce5fce5fc; /* hope these constant values are cache line aligned */ static const uint64_t mmx_redmask = 0xf8f8f8f8f8f8f8f8; static const uint64_t mmx_grnmask = 0xfcfcfcfcfcfcfcfc; static const uint64_t mmx_grnshift = 0x03; static const uint64_t mmx_blueshift = 0x03; #if 0 #ifdef HAVE_MMX2 /* use this for K7 and p3 only */ #define MOVNTQ "movntq" #else /* for MMX-only processors */ #define MOVNTQ "movq" #endif #endif /* MMX2 */ /* for now this usage */ #define MOVNTQ "movq" static int yuv420_rgb16_mmx(struct mmxnow_context_t* ctx) { mmxnow_image_data_t* data = (mmxnow_image_data_t*) ctx->data; uint8_t* py = data->in.plane_y; uint8_t* pu = data->in.plane_u; uint8_t* pv = data->in.plane_v; int y_stride = data->in.stride_y; int uv_stride = data->in.stride_uv; int v_size = data->in.width; int h_size = data->in.height; uint8_t* image = data->out.image; int rgb_stride = data->out.stride; int even = 1; int x, y; __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ ); for (y = v_size; --y >= 0; ) { uint8_t *_image = image; uint8_t *_py = py; uint8_t *_pu = pu; uint8_t *_pv = pv; /* load data for start of next scan line */ __asm__ __volatile__ ( "movd (%1), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ "movd (%2), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ "movq (%0), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ : : "r" (_py), "r" (_pu), "r" (_pv)); for (x = h_size >> 3; --x >= 0; ) { /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8 pixels in each iteration */ __asm__ __volatile__ ( /* Do the multiply part of the conversion for even and odd pixels, register usage: mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels, mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels, mm6 -> Y even, mm7 -> Y odd */ /* convert the chroma part */ "punpcklbw %%mm4, %%mm0;" /* scatter 4 Cb 00 u3 00 u2 00 u1 00 u0 */ "punpcklbw %%mm4, %%mm1;" /* scatter 4 Cr 00 v3 00 v2 00 v1 00 v0 */ "psubsw mmx_80w, %%mm0;" /* Cb -= 128 */ "psubsw mmx_80w, %%mm1;" /* Cr -= 128 */ "psllw $3, %%mm0;" /* Promote precision */ "psllw $3, %%mm1;" /* Promote precision */ "movq %%mm0, %%mm2;" /* Copy 4 Cb 00 u3 00 u2 00 u1 00 u0 */ "movq %%mm1, %%mm3;" /* Copy 4 Cr 00 v3 00 v2 00 v1 00 v0 */ "pmulhw mmx_U_green, %%mm2;" /* Mul Cb with green coeff -> Cb green */ "pmulhw mmx_V_green, %%mm3;" /* Mul Cr with green coeff -> Cr green */ "pmulhw mmx_U_blue, %%mm0;" /* Mul Cb -> Cblue 00 b3 00 b2 00 b1 00 b0 */ "pmulhw mmx_V_red, %%mm1;" /* Mul Cr -> Cred 00 r3 00 r2 00 r1 00 r0 */ "paddsw %%mm3, %%mm2;" /* Cb green + Cr green -> Cgreen */ /* convert the luma part */ "psubusb mmx_10w, %%mm6;" /* Y -= 16 */ "movq %%mm6, %%mm7;" /* Copy 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ "pand mmx_00ffw, %%mm6;" /* get Y even 00 Y6 00 Y4 00 Y2 00 Y0 */ "psrlw $8, %%mm7;" /* get Y odd 00 Y7 00 Y5 00 Y3 00 Y1 */ "psllw $3, %%mm6;" /* Promote precision */ "psllw $3, %%mm7;" /* Promote precision */ "pmulhw mmx_Y_coeff, %%mm6;" /* Mul 4 Y even 00 y6 00 y4 00 y2 00 y0 */ "pmulhw mmx_Y_coeff, %%mm7;" /* Mul 4 Y odd 00 y7 00 y5 00 y3 00 y1 */ /* Do the addition part of the conversion for even and odd pixels, register usage: mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels, mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels, mm6 -> Y even, mm7 -> Y odd */ "movq %%mm0, %%mm3;" /* Copy Cblue */ "movq %%mm1, %%mm4;" /* Copy Cred */ "movq %%mm2, %%mm5;" /* Copy Cgreen */ "paddsw %%mm6, %%mm0;" /* Y even + Cblue 00 B6 00 B4 00 B2 00 B0 */ "paddsw %%mm7, %%mm3;" /* Y odd + Cblue 00 B7 00 B5 00 B3 00 B1 */ "paddsw %%mm6, %%mm1;" /* Y even + Cred 00 R6 00 R4 00 R2 00 R0 */ "paddsw %%mm7, %%mm4;" /* Y odd + Cred 00 R7 00 R5 00 R3 00 R1 */ "paddsw %%mm6, %%mm2;" /* Y even + Cgreen 00 G6 00 G4 00 G2 00 G0 */ "paddsw %%mm7, %%mm5;" /* Y odd + Cgreen 00 G7 00 G5 00 G3 00 G1 */ /* Limit RGB even to 0..255 */ "packuswb %%mm0, %%mm0;" /* B6 B4 B2 B0 B6 B4 B2 B0 */ "packuswb %%mm1, %%mm1;" /* R6 R4 R2 R0 R6 R4 R2 R0 */ "packuswb %%mm2, %%mm2;" /* G6 G4 G2 G0 G6 G4 G2 G0 */ /* Limit RGB odd to 0..255 */ "packuswb %%mm3, %%mm3;" /* B7 B5 B3 B1 B7 B5 B3 B1 */ "packuswb %%mm4, %%mm4;" /* R7 R5 R3 R1 R7 R5 R3 R1 */ "packuswb %%mm5, %%mm5;" /* G7 G5 G3 G1 G7 G5 G3 G1 */ /* Interleave RGB even and odd */ "punpcklbw %%mm3, %%mm0;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ "punpcklbw %%mm4, %%mm1;" /* R7 R6 R5 R4 R3 R2 R1 R0 */ "punpcklbw %%mm5, %%mm2;" /* G7 G6 G5 G4 G3 G2 G1 G0 */ /* mask unneeded bits off */ "pand mmx_redmask, %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */ "pand mmx_grnmask, %%mm2;" /* g7g6g5g4 g3g2_0_0 g7g6g5g4 g3g2_0_0 */ "pand mmx_redmask, %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */ "psrlw mmx_blueshift,%%mm0;" /* 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3 */ "pxor %%mm4, %%mm4;" /* zero mm4 */ "movq %%mm0, %%mm5;" /* Copy B7-B0 */ "movq %%mm2, %%mm7;" /* Copy G7-G0 */ /* convert rgb24 plane to rgb16 pack for pixel 0-3 */ "punpcklbw %%mm4, %%mm2;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */ "punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */ "psllw mmx_blueshift,%%mm2;" /* 0_0_0_0 0_g7g6g5 g4g3g2_0 0_0_0_0 */ "por %%mm2, %%mm0;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */ "movq 8 (%0), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ MOVNTQ " %%mm0, (%3);" /* store pixel 0-3 */ /* convert rgb24 plane to rgb16 pack for pixel 0-3 */ "punpckhbw %%mm4, %%mm7;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */ "punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */ "psllw mmx_blueshift,%%mm7;" /* 0_0_0_0 0_g7g6g5 g4g3g2_0 0_0_0_0 */ "movd 4 (%1), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ "por %%mm7, %%mm5;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */ "movd 4 (%2), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ MOVNTQ " %%mm5, 8 (%3);" /* store pixel 4-7 */ : : "r" (_py), "r" (_pu), "r" (_pv), "r" (_image)); _py += 8; _pu += 4; _pv += 4; _image += 16; } if (!even) { pu += uv_stride; pv += uv_stride; } py += y_stride; image += rgb_stride; even = (!even); } emms(); return 0; } static int yuv420_argb32_mmx (struct mmxnow_context_t* ctx) { mmxnow_image_data_t* data = (mmxnow_image_data_t*) ctx->data; uint8_t* py = data->in.plane_y; uint8_t* pu = data->in.plane_u; uint8_t* pv = data->in.plane_v; int y_stride = data->in.stride_y; int uv_stride = data->in.stride_uv; int v_size = data->in.width; int h_size = data->in.height; uint8_t* image = data->out.image; int rgb_stride = data->out.stride; int even = 1; int x, y; __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ ); for (y = v_size; --y >= 0; ) { uint8_t *_image = image; uint8_t *_py = py; uint8_t *_pu = pu; uint8_t *_pv = pv; /* load data for start of next scan line */ __asm__ __volatile__ ( "movd (%1), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ "movd (%2), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ "movq (%0), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ : : "r" (_py), "r" (_pu), "r" (_pv) ); for (x = h_size >> 3; --x >= 0; ) { /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8 pixels in each iteration */ __asm__ __volatile__ ( /* Do the multiply part of the conversion for even and odd pixels, register usage: mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels, mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels, mm6 -> Y even, mm7 -> Y odd */ /* convert the chroma part */ "punpcklbw %%mm4, %%mm0;" /* scatter 4 Cb 00 u3 00 u2 00 u1 00 u0 */ "punpcklbw %%mm4, %%mm1;" /* scatter 4 Cr 00 v3 00 v2 00 v1 00 v0 */ "psubsw mmx_80w, %%mm0;" /* Cb -= 128 */ "psubsw mmx_80w, %%mm1;" /* Cr -= 128 */ "psllw $3, %%mm0;" /* Promote precision */ "psllw $3, %%mm1;" /* Promote precision */ "movq %%mm0, %%mm2;" /* Copy 4 Cb 00 u3 00 u2 00 u1 00 u0 */ "movq %%mm1, %%mm3;" /* Copy 4 Cr 00 v3 00 v2 00 v1 00 v0 */ "pmulhw mmx_U_green, %%mm2;" /* Mul Cb with green coeff -> Cb green */ "pmulhw mmx_V_green, %%mm3;" /* Mul Cr with green coeff -> Cr green */ "pmulhw mmx_U_blue, %%mm0;" /* Mul Cb -> Cblue 00 b3 00 b2 00 b1 00 b0 */ "pmulhw mmx_V_red, %%mm1;" /* Mul Cr -> Cred 00 r3 00 r2 00 r1 00 r0 */ "paddsw %%mm3, %%mm2;" /* Cb green + Cr green -> Cgreen */ /* convert the luma part */ "psubusb mmx_10w, %%mm6;" /* Y -= 16 */ "movq %%mm6, %%mm7;" /* Copy 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ "pand mmx_00ffw, %%mm6;" /* get Y even 00 Y6 00 Y4 00 Y2 00 Y0 */ "psrlw $8, %%mm7;" /* get Y odd 00 Y7 00 Y5 00 Y3 00 Y1 */ "psllw $3, %%mm6;" /* Promote precision */ "psllw $3, %%mm7;" /* Promote precision */ "pmulhw mmx_Y_coeff, %%mm6;" /* Mul 4 Y even 00 y6 00 y4 00 y2 00 y0 */ "pmulhw mmx_Y_coeff, %%mm7;" /* Mul 4 Y odd 00 y7 00 y5 00 y3 00 y1 */ /* Do the addition part of the conversion for even and odd pixels, register usage: mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels, mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels, mm6 -> Y even, mm7 -> Y odd */ "movq %%mm0, %%mm3;" /* Copy Cblue */ "movq %%mm1, %%mm4;" /* Copy Cred */ "movq %%mm2, %%mm5;" /* Copy Cgreen */ "paddsw %%mm6, %%mm0;" /* Y even + Cblue 00 B6 00 B4 00 B2 00 B0 */ "paddsw %%mm7, %%mm3;" /* Y odd + Cblue 00 B7 00 B5 00 B3 00 B1 */ "paddsw %%mm6, %%mm1;" /* Y even + Cred 00 R6 00 R4 00 R2 00 R0 */ "paddsw %%mm7, %%mm4;" /* Y odd + Cred 00 R7 00 R5 00 R3 00 R1 */ "paddsw %%mm6, %%mm2;" /* Y even + Cgreen 00 G6 00 G4 00 G2 00 G0 */ "paddsw %%mm7, %%mm5;" /* Y odd + Cgreen 00 G7 00 G5 00 G3 00 G1 */ /* Limit RGB even to 0..255 */ "packuswb %%mm0, %%mm0;" /* B6 B4 B2 B0 B6 B4 B2 B0 */ "packuswb %%mm1, %%mm1;" /* R6 R4 R2 R0 R6 R4 R2 R0 */ "packuswb %%mm2, %%mm2;" /* G6 G4 G2 G0 G6 G4 G2 G0 */ /* Limit RGB odd to 0..255 */ "packuswb %%mm3, %%mm3;" /* B7 B5 B3 B1 B7 B5 B3 B1 */ "packuswb %%mm4, %%mm4;" /* R7 R5 R3 R1 R7 R5 R3 R1 */ "packuswb %%mm5, %%mm5;" /* G7 G5 G3 G1 G7 G5 G3 G1 */ /* Interleave RGB even and odd */ "punpcklbw %%mm3, %%mm0;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ "punpcklbw %%mm4, %%mm1;" /* R7 R6 R5 R4 R3 R2 R1 R0 */ "punpcklbw %%mm5, %%mm2;" /* G7 G6 G5 G4 G3 G2 G1 G0 */ /* convert RGB plane to RGB packed format, mm0 -> B, mm1 -> R, mm2 -> G, mm3 -> 0, mm4 -> GB, mm5 -> AR pixel 4-7, mm6 -> GB, mm7 -> AR pixel 0-3 */ "pxor %%mm3, %%mm3;" /* zero mm3 */ "movq %%mm0, %%mm6;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ "movq %%mm1, %%mm7;" /* R7 R6 R5 R4 R3 R2 R1 R0 */ "movq %%mm0, %%mm4;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ "movq %%mm1, %%mm5;" /* R7 R6 R5 R4 R3 R2 R1 R0 */ "punpcklbw %%mm2, %%mm6;" /* G3 B3 G2 B2 G1 B1 G0 B0 */ "punpcklbw %%mm3, %%mm7;" /* 00 R3 00 R2 00 R1 00 R0 */ "punpcklwd %%mm7, %%mm6;" /* 00 R1 B1 G1 00 R0 B0 G0 */ MOVNTQ " %%mm6, (%3);" /* Store ARGB1 ARGB0 */ "movq %%mm0, %%mm6;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ "punpcklbw %%mm2, %%mm6;" /* G3 B3 G2 B2 G1 B1 G0 B0 */ "punpckhwd %%mm7, %%mm6;" /* 00 R3 G3 B3 00 R2 B3 G2 */ MOVNTQ " %%mm6, 8 (%3);" /* Store ARGB3 ARGB2 */ "punpckhbw %%mm2, %%mm4;" /* G7 B7 G6 B6 G5 B5 G4 B4 */ "punpckhbw %%mm3, %%mm5;" /* 00 R7 00 R6 00 R5 00 R4 */ "punpcklwd %%mm5, %%mm4;" /* 00 R5 B5 G5 00 R4 B4 G4 */ MOVNTQ " %%mm4, 16 (%3);" /* Store ARGB5 ARGB4 */ "movq %%mm0, %%mm4;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ "punpckhbw %%mm2, %%mm4;" /* G7 B7 G6 B6 G5 B5 G4 B4 */ "punpckhwd %%mm5, %%mm4;" /* 00 R7 G7 B7 00 R6 B6 G6 */ MOVNTQ " %%mm4, 24 (%3);" /* Store ARGB7 ARGB6 */ "movd 4 (%1), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ "movd 4 (%2), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ "pxor %%mm4, %%mm4;" /* zero mm4 */ "movq 8 (%0), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ : : "r" (_py), "r" (_pu), "r" (_pv), "r" (_image)); _py += 8; _pu += 4; _pv += 4; _image += 32; } if (!even) { pu += uv_stride; pv += uv_stride; } py += y_stride; image += rgb_stride; even = (!even); } emms(); return 0; } void create_yuv2rgb_mmx(mmxnow_context_t* ctx, int method) { if ((ctx->flags & MMXNOW_MMX) && ctx->method == NULL) { switch (method) { case MMXNOW_YV12_TO_RGB16: ctx->method = yuv420_rgb16_mmx; ctx->data = calloc(1, sizeof(mmxnow_image_data_t)); ctx->name = "yuv2rgb_mmx YV12 to RGB16"; break; case MMXNOW_YV12_TO_RGB32: ctx->method = yuv420_argb32_mmx; ctx->data = calloc(1, sizeof(mmxnow_image_data_t)); ctx->name = "yuv2rgb_mmx YV12 to RGB32"; break; } } } avifile-0.7.48~20090503.ds/libmmxnow/Makefile.am0000644000175000017500000000045611106632677020027 0ustar yavoryavorSUBDIRS = doc include src test bin_SCRIPTS = mmxnow-config EXTRA_DIST = autogen.sh depcomp MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure \ config.log config.guess config.status config.sub configure.ac \ install-sh libtool ltmain.sh missing mkinstalldirs depcomp \ confdefs.h acconfig.h avifile-0.7.48~20090503.ds/libmmxnow/autogen.sh0000755000175000017500000001331007377164766020003 0ustar yavoryavor#!/bin/sh # #set -x acdir="" # can't be made default - some automake will fail here - using only privately # for snapshot creation #use_copy="--copy" use_copy="" forceon="" removeconf="" while [ $# -gt 0 ]; do case "$1" in --acdir) acdir=$2 shift ;; --force) forceon="force" shift ;; --copy) use_copy="--copy" shift ;; --linkac) test -h configure.ac || ln -sf configure.in configure.ac ;; --remconf) removeconf="yes" ;; -h|--help) echo "Usage: $0 [OPTIONS]" echo echo "Run all necesary programs to create configure files" echo echo "Options:" echo " --help print this help, then exit" echo " --acdir pass this parameter to aclocal (see aclocal --help for more details)" echo " --force ignore FATAL error message" echo " --linkac create symbolic link configure.in ->configure.ac" echo " --copy use option --copy with automake and libtoolize" echo " --remconf remove configure script (forcing its recreation)" exit 0 ;; *) echo "WARNING: unrecognized option: $1 (see --help)" ;; esac shift done echo "Generating build information..." # Touch the timestamps on all the files since CVS messes them up #directory=`dirname $0` #touch $directory/configure.in #touch configure.in # Debian unstable allows to have several different versions of autoconf # in the one system use_automake=automake use_aclocal=aclocal use_libtool=libtool use_autoconf=autoconf use_autoheader=autoheader # some freebsd compatibility lookups for prefered versions findver=14 export findver ( which automake${findver} 2>/dev/null | grep -q "^/" ) && use_automake=`which automake${findver}` ( which aclocal${findver} 2>/dev/null | grep -q "^/" ) && use_aclocal=`which aclocal${findver}` findver=213 ( which autoconf${findver} 2>/dev/null | grep -q "^/" ) && use_autoconf=`which autoconf${findver}` ( which autoheader${findver} 2>/dev/null | grep -q "^/" ) && use_autoheader=`which autoheader${findver}` unset findver # I think links are now OK # Debian will use 2.50 for configure.ac files automaticaly #( which autoconf2.50 2>/dev/null | grep -q "^/" ) && use_autoconf=autoconf2.50 #( which autoheader2.50 2>/dev/null | grep -q "^/" ) && use_autoheader=autoheader2.50 DIE=0 ($use_autoconf --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`autoconf' installed ." DIE=1 } ($use_automake --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`automake' installed." DIE=1 NO_AUTOMAKE=yes } ($use_aclocal --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: Missing \`aclocal'." DIE=1 } ($use_libtool --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`libtool' installed." DIE=1 } if test -z "$acdir" -a -d /usr/local/share/aclocal ; then if !(ls -ld /usr/local/share | grep /usr/share > /dev/null 2>/dev/null ); then if test "`$use_aclocal --print-ac-dir`" != "/usr/local/share/aclocal" ; then INCLUDESTRING="-I /usr/local/share/aclocal" # ACLOCAL_FLAGS=`echo $ACLOCAL_FLAGS | sed s/-I\ \/z//` ACLOCAL_FLAGS="-I /usr/local/share/aclocal $ACLOCAL_FLAGS" ACLOCAL_MAINDIR=`$use_aclocal --print-ac-dir` for FILENAME in `ls $ACLOCAL_MAINDIR`; do if test -e /usr/local/share/aclocal/$FILENAME ; then echo "FATAL: both $ACLOCAL_MAINDIR/$FILENAME and /usr/local/share/aclocal/$FILENAME exist; you must manually delete one of them" echo "or use: autogen.sh --acdir /usr/share/aclocal" if test -z "$forceon" ; then echo "if you still want to continue - use force option" echo "but do not expect it will work! - fix the problem" exit 0; fi fi done fi else echo /usr/local/share is link to /usr/share fi fi # Regenerate configuration files ok=0 rm -f aclocal.m4 configure config.guess config.log config.sub ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh # test if configure.in is newer the created configure script testfornewer() { test $1.in -nt $1 -o -n "$removeconf" && rm -f $1; } testfornewer libmmxnow/configure testfornewer plugins/libmad/libmad/configure echo "Running libtoolize..." libtoolize --force $use_copy > /dev/null || ok=1 if test -z "$acdir" ; then echo "Running aclocal $ACLOCAL_FLAGS..." $use_aclocal $ACLOCAL_FLAGS || ok=1 else echo "Running aclocal with forced acdir: $acdir" $use_aclocal --acdir=$acdir || ok=1 fi # echo "Running autoupdate..." # autoupdate || ok=1 echo "Running autoheader..." $use_autoheader || ok=1 echo "Running autoconf..." $use_autoconf || ok=1 echo "Running automake..." $use_automake $use_copy --add-missing --foreign || ok=1 if [ "${ok}" -eq 0 ]; then echo "Now you are ready to run ./configure" #echo " for optimal performance use with this option --cache-file=config.cache" else echo "Problems detected. Please investigate." echo "Suggested version of used programs (try to use them)" echo " libtool 1.4.1 or better" echo " automake 1.4 or better" echo " autoconf 2.52 or better" echo "Your installed version:" $use_libtool --version | head -1 $use_automake --version | head -1 $use_autoconf --version | head -1 echo "Report aclocal = " $use_aclocal --print-ac-dir echo "Please report your problem on avifile-admin@prak.org" echo "with this log of build process together with system description." fi avifile-0.7.48~20090503.ds/libmmxnow/configure.in0000644000175000017500000000576607533234766020323 0ustar yavoryavordnl Process this file with autoconf to produce a configure script dnl ------------------------------------------------ dnl Initialization and Versioning dnl ------------------------------------------------ AC_INIT(include/mmxnow.h) configure_options="$@" AC_MSG_RESULT([libmmxnow configure options: $configure_options]) AM_INIT_AUTOMAKE(libmmxnow, 0.1) dnl Library versioning MMXNOW_MAJOR_VERSION=0 MMXNOW_MINOR_VERSION=1 MMXNOW_MICRO_VERSION=1 MMXNOW_INTERFACE_AGE=1 MMXNOW_BINARY_AGE=1 MMXNOW_VERSION=$MMXNOW_MAJOR_VERSION.$MMXNOW_MINOR_VERSION.$MMXNOW_MICRO_VERSION # libtool versioning # # +1 : ? : +1 == new interface that does not break old one # +1 : ? : 0 == new interface that breaks old one # ? : ? : 0 == no new interfaces, but breaks apps # ? :+1 : ? == just some internal changes, nothing breaks but might work # better # CURRENT: REVISION : AGE MMXNOWLT_RELEASE=$MMXNOW_MAJOR_VERSION.$MMXNOW_MINOR_VERSION MMXNOWLT_CURRENT=`expr $MMXNOW_MICRO_VERSION - $MMXNOW_INTERFACE_AGE` MMXNOWLT_REVISION=$MMXNOW_INTERFACE_AGE MMXNOWLT_AGE=`expr $MMXNOW_BINARY_AGE - $MMXNOW_INTERFACE_AGE` MMXNOWLT_VERSION=$MMXNOWLT_CURRENT:$MMXNOWLT_REVISION:$MMXNOWLT_AGE AC_SUBST(MMXNOWLT_RELEASE) AC_SUBST(MMXNOWLT_VERSION) dnl -------------------------------------------------- dnl Check for programs dnl -------------------------------------------------- dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2" dnl if $CFLAGS is blank cflags_save="$CFLAGS" AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_LANG_C AM_CONFIG_HEADER(include/config.h) AM_DISABLE_STATIC AM_PROG_LIBTOOL dnl -------------------------------------------------- dnl Set build flags based on environment dnl -------------------------------------------------- dnl AC_CANONICAL_HOST AC_CANONICAL_TARGET build_i386= case "$target" in i?86-*-*) build_i386=yes ;; *) ;; esac dnl Set some target options cflags_save="$CFLAGS" ldflags_save="$LDFLAGS" CFLAGS="$CFLAGS $cflags_save" LDFLAGS="$LDFLAGS $ldflags_save" dnl -------------------------------------------------- dnl Check for headers dnl -------------------------------------------------- dnl AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:) dnl -------------------------------------------------- dnl Check for typedefs, structures, etc dnl -------------------------------------------------- dnl none dnl -------------------------------------------------- dnl Check for library functions dnl -------------------------------------------------- AC_FUNC_ALLOCA AC_FUNC_MEMCMP dnl -------------------------------------------------- dnl Do substitutions dnl -------------------------------------------------- AC_SUBST(DEBUG) AC_SUBST(PROFILE) dnl help make distcheck CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/include" AM_CONDITIONAL(AMM_BUILD_I386, test x$build_i386 = xyes ) AC_OUTPUT(Makefile \ doc/Makefile \ include/Makefile \ src/Makefile \ src/generic/Makefile \ src/generic/video/Makefile \ src/i386/Makefile \ src/i386/video/Makefile \ test/Makefile \ mmxnow-config \ ) avifile-0.7.48~20090503.ds/libmmxnow/mmxnow-config.in0000644000175000017500000000353007457537372021121 0ustar yavoryavor#!/bin/sh # mmxnow-config # # Tool for retrieving the library/include paths mmxnow was compiled with. # # Written by Unknown Author # Based *HEAVILY* on xmps-config from the XMPS program. # Based *HEAVILY* on xmms-config from the XMMS program. # Based *HEAVILY* on gtk-config from the GTK+ library package. # # This work is released under the GNU GPL, version 2 or later. prefix="@prefix@" exec_prefix="@exec_prefix@" exec_prefix_set=no data_dir="@datadir@/@PACKAGE@" include_dir="@includedir@/mmxnow" lib_dir="@libdir@" usage() { cat <&2 fi while test $# -gt 0; do case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac case $1 in --prefix=*) prefix=$optarg if test $exec_prefix_set = no ; then exec_prefix=$optarg fi ;; --prefix) echo_prefix=yes ;; --exec-prefix=*) exec_prefix=$optarg exec_prefix_set=yes ;; --exec-prefix) echo_exec_prefix=yes ;; --cflags) echo_cflags=yes ;; --libs) echo_libs=yes ;; --data-dir) echo_data_dir=yes ;; *) usage 1 1>&2 ;; esac shift done if test "$echo_prefix" = "yes"; then echo $prefix fi if test "$echo_exec_prefix" = "yes"; then echo $exec_prefix fi if test "$include_dir" != "/usr/include"; then cflags="-I$include_dir" else cflags="" fi if test "$lib_dir" != "/usr/lib"; then libs="-L$lib_dir @MMXNOW_RLD_FLAGS@ -lmmxnow" else libs="@MMXNOW_RLD_FLAGS@ -lmmxnow" fi if test "$echo_cflags" = "yes"; then echo $cflags fi if test "$echo_libs" = "yes"; then echo $libs fi if test "$echo_data_dir" = "yes"; then echo $data_dir fi avifile-0.7.48~20090503.ds/libmmxnow/include/0000755000175000017500000000000011267646347017420 5ustar yavoryavoravifile-0.7.48~20090503.ds/libmmxnow/include/Makefile.am0000644000175000017500000000012607364747623021455 0ustar yavoryavorinclude_HEADERS = mmxnow.h MAINTAINERCLEANFILES = Makefile.in stamp-h.in config.h.in avifile-0.7.48~20090503.ds/libmmxnow/include/mmxnow.h0000644000175000017500000001013107441632751021103 0ustar yavoryavor#ifndef MMXNOW_H #define MMXNOW_H #include /* * General interface for mmxnow library * * call mmxnow_create with flags - choose whatever implementation * you wish to use (probably should match your CPU capabilities) */ #ifdef __cplusplus extern "C" { #endif enum { // shuld be in order of prefered usage MMXNOW_K7 = 1, MMXNOW_MMX = 2, MMXNOW_MMX2 = 4, MMXNOW_3DNOW = 8, MMXNOW_SSE = 16, MMXNOW_SSE2 = 32, }; enum { MMXNOW_TAGEND, /* marks taglist end */ MMXNOW_MEMCPY, /* for larger memory blocks */ MMXNOW_MEMSET, /* image conversion methods */ /* converts just few lines per call (usually just one) * depends on the convertor function and its context * parameters - * struct { int w; uint8_t* dst[16]; uint8_t* src[16]; } * * e.g. rgb conversion just w, dst[0] & src[0] would be used */ /* planar YV12 */ MMXNOW_YV12_TO_BGR15 = 1000, MMXNOW_YV12_TO_BGR16, MMXNOW_YV12_TO_BGR24, MMXNOW_YV12_TO_BGR32, MMXNOW_BGR15_TO_YV12, MMXNOW_BGR16_TO_YV12, MMXNOW_BGR24_TO_YV12, MMXNOW_BGR32_TO_YV12, /* packed YUY2 */ MMXNOW_YUY2_TO_BGR15, MMXNOW_YUY2_TO_BGR16, MMXNOW_YUY2_TO_BGR24, MMXNOW_YUY2_TO_BGR32, MMXNOW_BGR15_TO_YUY2, MMXNOW_BGR16_TO_YUY2, MMXNOW_BGR24_TO_YUY2, MMXNOW_BGR32_TO_YUY2, /* 3 byte YUV */ MMXNOW_BGR15_TO_YUV, MMXNOW_BGR16_TO_YUV, MMXNOW_BGR24_TO_YUV, MMXNOW_BGR32_TO_YUV, MMXNOW_YUV_TO_BGR15, MMXNOW_YUV_TO_BGR16, MMXNOW_YUV_TO_BGR24, MMXNOW_YUV_TO_BGR32, /* all RGB conversions */ MMXNOW_BGR15_TO_BGR16, MMXNOW_BGR15_TO_BGR24, MMXNOW_BGR15_TO_BGR32, MMXNOW_BGR16_TO_BGR15, MMXNOW_BGR16_TO_BGR24, MMXNOW_BGR16_TO_BGR32, MMXNOW_BGR24_TO_BGR15, MMXNOW_BGR24_TO_BGR16, MMXNOW_BGR24_TO_BGR32, MMXNOW_BGR32_TO_BGR15, MMXNOW_BGR32_TO_BGR16, MMXNOW_BGR32_TO_BGR24, /* audio - proposition */ MMXNOW_AUDIO_SOMETHING = 2000, }; struct mmxnow_context_t; typedef struct mmxnow_context_t { /* * address of function for given CPU flags * data will be casted to the expected type * user has to provide thread safety locking himself - * or he could create new context for each thread * but generally - its better to leave running only * one MMX task - otherwice there is big speed penaly hit! */ int (*method)(struct mmxnow_context_t*); /* free static data data */ int (*free)(struct mmxnow_context_t*); void* data; /* data - paramaters for function */ void* user; /* private data for user - e.g. -store mutex */ const char* name; /* text name of method - for debugging */ unsigned int flags; /* copy of initialization CPU flags */ } mmxnow_context_t; /* * only few calls here - so if should be simple to dlopen library in * runtime and use it if its available on the system */ /* * get requested method - private context will be initialized when * necesseary */ mmxnow_context_t* mmxnow_create(int method, unsigned int flags); /* * when function is no longer necessary - call delete to free all * allocated resources */ void mmxnow_destroy(mmxnow_context_t* cntx); unsigned int mmxnow_detect(void); /* not implemented yet */ /**** DATASTRUCTURES ****/ /* * data structure used for image conversion * many fields might not be supported by various function */ typedef struct { int width, height; /* width of processed image */ int x, y; uint8_t* plane[3]; /* Y U V */ int stride[3]; int format; int bpp; /* bits per plane */ } mmxnow_image_t; typedef struct { uint8_t r,g,b; } mmxnow_rgb_t; typedef struct { uint8_t y,cb,cr; } mmxnow_yuv_t; typedef struct { void* context; /* private data structure */ unsigned int supports; /* flag of supported operation * e.g - support rescale, flip, * bit plane conversion,... */ mmxnow_image_t in; /* input image */ mmxnow_image_t out; /* output image */ int flip; /* flip image during processing */ int bottom_up; /* process image from bottom */ int reserved[20]; } mmxnow_image_data_t; #ifdef __cplusplus } #endif #endif /* MMXNOW_H */ avifile-0.7.48~20090503.ds/libmmxnow/test/0000755000175000017500000000000011267646347016754 5ustar yavoryavoravifile-0.7.48~20090503.ds/libmmxnow/test/Makefile.am0000644000175000017500000000054107457552534021010 0ustar yavoryavor# various test code LIBRARY = ../src/libmmxnow.la -lm check_PROGRAMS = testyv12 testsdl testyv12_SOURCES = rw_pgm.c testyv12_LDADD = $(LIBRARY) testsdl_SOURCES = testsdl.c testsdl_LDADD = $(LIBRARY) -lSDL -L/usr/X11R6/lib -lXext -lX11 -lpthread AM_CPPFLAGS = -I$(srcdir)/../include CLEANFILES = testyv12 testsdl MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/libmmxnow/test/rw_pgm.c0000644000175000017500000000404507441632752020410 0ustar yavoryavor #include "mmxnow.h" #include #include #include mmxnow_image_t* read_pgm(const char* filename) { mmxnow_image_t* img = malloc(sizeof(mmxnow_image_t)); FILE* f; char b[1000]; size_t size; if (!img) return 0; memset(img, 0, sizeof(img)); f = fopen(filename, "r"); if (!f) { perror("file open"); goto fail; } if (!fgets(b, sizeof(b), f)) goto fail; if (strncmp(b, "P6", 2)) { printf("unsupported format %s\n", b); goto fail; } // skip comment lines for (;;) { fgets(b, sizeof(b), f); if (b[0] != '#') break; } sscanf(b, "%d %d", &img->width, &img->height); fgets(b, sizeof(b), f); if (!strcmp(b, "255")) { printf("unsupported img format %s\n", b); goto fail; } size = img->width * img->height * 3; img->plane[0] = (uint8_t*) malloc(size); if (!img->plane[0]) goto fail; if (!feof(f)) fread(img->plane[0], size, 1, f); //printf("Found image %dx%d\n", img->width, img->height); return img; fail: free(img); return 0; } void write_pgm(const char* filename, mmxnow_image_t* img) { FILE* f = fopen(filename, "w"); if (f) { fprintf(f, "P6\n# mmxnow test image\n%d %d\n255\n", img->width, img->height); fwrite(img->plane[0], 1, (unsigned) (3 * img->width * img->height), f); printf("Written image: %s %dx%d\n", filename, img->width, img->height); } } int main(int argc, char* argv[]) { mmxnow_image_t* img; img = read_pgm("test.pgm"); if (img) { mmxnow_context_t* rgb24_yv12, *yv12_rgb16, *rgb16_rgb24; unsigned int flags = MMXNOW_MMX; rgb24_yv12 = mmxnow_create(MMXNOW_BGR24_TO_YV12, flags); yv12_rgb16 = mmxnow_create(MMXNOW_YV12_TO_BGR16, flags); rgb16_rgb24 = mmxnow_create(MMXNOW_BGR16_TO_BGR24, flags); if (rgb24_yv12 && yv12_rgb16 && rgb16_rgb24) { printf("converting image\n"); } else printf("context %p %p %p\n", rgb24_yv12, yv12_rgb16, rgb16_rgb24); write_pgm("testX.pgm", img); } return 0; } avifile-0.7.48~20090503.ds/libmmxnow/test/testsdl.c0000644000175000017500000001037207457552534020605 0ustar yavoryavor /* Simple program: Test bitmap blits */ #include #include #include #include "SDL/SDL.h" #include "SDL/SDL_video.h" #include "SDL/SDL_mouse.h" #include "SDL/SDL_syswm.h" #ifndef SDL_VERSIONNUM #define SDL_VERSIONNUM(X, Y, Z) (X)*1000 + (Y)*100 + (Z) #endif #define _SDL_VER SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) #if _SDL_VER < 1103 int main(int argc, char *argv[]) { return 0; } #else static const char* def_file = "KylieMinogue.bmp"; static int width = 640; static int height = 480; static int fourcc = SDL_YV12_OVERLAY; int main(int argc, char *argv[]) { SDL_Surface* screen; SDL_Surface* bitmap; SDL_Overlay* overlay; Uint8 video_bpp; Uint32 videoflags; Uint8 *buffer; int i, done; SDL_Event event; SDL_Rect rect; int use_yuv; /* Initialize SDL */ if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) { fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError()); exit(1); } atexit(SDL_Quit); SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE); video_bpp = 0; videoflags = SDL_SWSURFACE | SDL_RESIZABLE; while ( argc > 1 ) { --argc; if ( strcmp(argv[argc-1], "-bpp") == 0 ) { video_bpp = atoi(argv[argc]); --argc; } else if ( strcmp(argv[argc], "-warp") == 0 ) { videoflags |= SDL_HWPALETTE; } else if ( strcmp(argv[argc], "-w") == 0 ) { width = atoi(argv[++argc]); } else if ( strcmp(argv[argc], "-h") == 0 ) { height = atoi(argv[++argc]); } else if ( strcmp(argv[argc], "-hw") == 0 ) { videoflags |= SDL_HWSURFACE; } else if ( strcmp(argv[argc], "-yv12") == 0 ) { fourcc = SDL_YV12_OVERLAY; } else if ( strcmp(argv[argc], "-iyuv") == 0 ) { fourcc = SDL_IYUV_OVERLAY; } else if ( strcmp(argv[argc], "-yuy2") == 0 ) { fourcc = SDL_YV12_OVERLAY; } else if ( strcmp(argv[argc], "-uyvy") == 0 ) { fourcc = SDL_UYVY_OVERLAY; } else if ( strcmp(argv[argc], "-yvyu") == 0 ) { fourcc = SDL_YVYU_OVERLAY; } else if ( strcmp(argv[argc], "-fullscreen") == 0 ) { videoflags |= SDL_FULLSCREEN; } else { fprintf(stderr, "Usage: %s [-bpp N] [-warp] [-hw] [-fullscreen]" "[-yuy2|-iyuv|-yv12|-uyvy|-yvyu] [-w #width] [-h #height]" "\n", argv[0]); exit(1); } } /* Set 640x480 video mode */ if ( (screen=SDL_SetVideoMode(width, height, video_bpp, videoflags)) == NULL ) { fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n", video_bpp, SDL_GetError()); exit(2); } overlay = SDL_CreateYUVOverlay(width, height, fourcc, screen); /* Set the surface pixels and refresh! */ if ( SDL_LockSurface(screen) < 0 ) { fprintf(stderr, "Couldn't lock the display surface: %s\n", SDL_GetError()); exit(2); } buffer=(Uint8 *)screen->pixels; for ( i=screen->h/2; ih; i++ ) { memset(buffer, (i*255)/screen->h, screen->pitch); buffer += screen->pitch; } SDL_UnlockSurface(screen); SDL_UpdateRect(screen, 0, 0, 0, 0); buffer = (Uint8 *)overlay->pixels[0]; for (i = 0; i < screen->h; i++) { memset(buffer, i, overlay->pitches[0]); buffer += overlay->pitches[0]; } rect.x = rect.y = 0; rect.w = width; rect.h = height; SDL_DisplayYUVOverlay(overlay, &rect); /* Load the bitmap */ bitmap = SDL_LoadBMP(def_file); if ( bitmap == NULL ) { exit(1); } /* Wait for a keystroke */ done = 0; while ( !done ) { /* Check for events */ while ( SDL_PollEvent(&event) ) { switch (event.type) { case SDL_MOUSEBUTTONDOWN: { SDL_Rect dst; dst.x = event.button.x - bitmap->w/2; dst.y = event.button.y - bitmap->h/2; dst.w = bitmap->w; dst.h = bitmap->h; SDL_BlitSurface(bitmap, NULL, screen, &dst); SDL_UpdateRects(screen,1,&dst); SDL_DisplayYUVOverlay(overlay, &rect); } break; case SDL_KEYDOWN: switch (event.key.keysym.sym) { case SDLK_q: case SDLK_ESCAPE: case SDLK_RETURN: done = 1; break; case SDLK_SPACE: // ( printf("KEYSPACE\n"); break; } break; case SDL_QUIT: done = 1; break; default: //printf("EVENT %d\n", event.type); SDL_DisplayYUVOverlay(overlay, &rect); break; } } } SDL_FreeSurface(bitmap); return(0); } #endif avifile-0.7.48~20090503.ds/m4/0000755000175000017500000000000011267637371014276 5ustar yavoryavoravifile-0.7.48~20090503.ds/m4/compiler.m40000644000175000017500000001065310747170733016353 0ustar yavoryavordnl AC_GCC_VERSION dnl check for compiler version dnl sets COMPILER_VERSION and GCC_VERSION AC_DEFUN([AC_CC_VERSION], [ AC_MSG_CHECKING([C compiler version]) COMPILER_VERSION=`$CC -v 2>&1 | grep version` case "$COMPILER_VERSION" in *gcc*) dnl Ok, how to turn $3 into the real $3 GCC_VERSION=`echo $COMPILER_VERSION | \ sed -e 's/[[^ ]]*\ [[^ ]]*\ \([[^ ]]*\)\ .*/\1/'` ;; *) GCC_VERSION=unknown ;; esac AC_MSG_RESULT($GCC_VERSION) ]) dnl AC_TRY_CFLAGS(CFLAGS, [ACTION-IF-WORKS], [ACTION-IF-FAILS]) dnl check if $CC supports a given set of cflags AC_DEFUN([AC_TRY_CFLAGS], [ AC_REQUIRE([AC_PROG_CC]) AC_MSG_CHECKING([whether $CC accepts $1 flag(s)]) ac_save_CFLAGS=$CFLAGS CFLAGS="$1" AC_COMPILE_IFELSE(AC_LANG_PROGRAM(), ac_cv_try_cflags_ok=yes, ac_cv_try_cflags_ok=no) CFLAGS=$ac_save_CFLAGS AC_MSG_RESULT($ac_cv_try_cflags_ok) if test "$ac_cv_try_cflags_ok" = yes; then ifelse([$2], [], [:], [$2]) else ifelse([$3], [], [:], [$3]) fi ]) dnl AC_TRY_CXXFLAGS(CXXFLAGS, [ACTION-IF-WORKS], [ACTION-IF-FAILS]) dnl check if $CXX supports a given set of cxxflags AC_DEFUN([AC_TRY_CXXFLAGS], [ AC_REQUIRE([AC_PROG_CXX]) AC_MSG_CHECKING([if $CXX supports $1 flag(s)]) AC_LANG_PUSH(C++) ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="$1" AC_COMPILE_IFELSE(AC_LANG_PROGRAM(), ac_cv_try_cxxflags_ok=yes, ac_cv_try_cxxflags_ok=no) CXXFLAGS=$ac_save_CXXFLAGS AC_MSG_RESULT($ac_cv_try_cxxflags_ok) AC_LANG_POP if test "$ac_cv_try_cxxflags_ok" = yes; then ifelse([$2], [], [:], [$2]) else ifelse([$3], [], [:], [$3]) fi ]) dnl AC_CHECK_GNU_EXTENSIONS([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) AC_DEFUN([AC_CHECK_GNU_EXTENSIONS], [ AC_CACHE_CHECK([if you need GNU extensions], ac_cv_gnu_extensions, AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include ], [ #ifndef __GNU_LIBRARY__ gnuneeded #endif ]), ac_cv_gnu_extensions=yes, ac_cv_gnu_extensions=no) ) if test "$ac_cv_gnu_extensions" = yes; then ifelse([$1], [], [:], [$1]) dnl AC_DEFINE_UNQUOTED(_GNU_SOURCE) else ifelse([$2], [], [:], [$2]) fi ]) dnl dnl AC_CHECK_GNU_VECTOR([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl AC_DEFUN([AC_CHECK_GNU_VECTOR], [ AC_CACHE_CHECK([whether $CC supports vector builtins], ac_cv_gnu_vector, AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include ], [ int main(void) { #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2) return 0; #else #error no vector builtins #endif } ]), ac_cv_gnu_vector=yes, ac_cv_gnu_vector=no) ) if test "$ac_cv_gnu_vector" = yes; then ifelse([$1], [], [:], [$1]) else ifelse([$2], [], [:], [$2]) fi ]) dnl dnl AC_CHECK_ALIGN_POWER([ACTION-IF-FOUND-ALIGN_POWER], [ACTION-IF-NOT-FOUND-ALIGN_POWER]) dnl AC_DEFUN([AC_CHECK_ALIGN_POWER], [ AC_REQUIRE([AC_PROG_CC]) AC_CACHE_CHECK([whether .align arg is power-of-two], ac_cv_val_have_align_power, AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], [ asm (".align 3") ]), ac_cv_val_have_align_power=yes, ac_cv_val_have_align_power=no) ) if test "$ac_cv_val_have_align_power" = yes; then ifelse([$1], , :, [$1]) else ifelse([$2], , :, [$2]) fi ]) dnl dnl AC_CHECK_RESTRICT_KEYWORD([ACTION]) dnl AC_DEFUN([AC_CHECK_RESTRICT_KEYWORD], [ AC_REQUIRE([AC_PROG_CC]) AC_CACHE_CHECK([for restrict keyword], ac_cv_val_restrict_keyword, AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], [ void foo(char * restrict p); ]), ac_cv_val_restrict_keyword=restrict, AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], [ void foo(char * _restrict p); ]), ac_cv_val_restrict_keyword=_restrict, AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], [ void foo(char * __restrict__ p); ]), ac_cv_val_restrict_keyword=__restrict__, AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], [ void foo(char * __restrict p); ]), ac_cv_val_restrict_keyword=__restrict, ac_cv_val_restrict_keyword=) ) ) ) ) have_restrict_keyword=$ac_cv_val_restrict_keyword ifelse([$1], , :, [$1]) ]) avifile-0.7.48~20090503.ds/m4/a52.m40000644000175000017500000000103310746104725015115 0ustar yavoryavor dnl AM_PATH_A52([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl test for libogg dnl defines A52_CFLAGS and A52_LIBS AC_DEFUN([AM_PATH_A52], [ AC_AVM_CHECK_LIB(a52, [for a52 (AC3)], [where liba52 is installed], [-la52 -lm], [ #if HAVE_INTTYPES_H # include #endif #if HAVE_STDINT_H # include #endif #include ], [], [$1], [$2]) ]) avifile-0.7.48~20090503.ds/m4/as.m40000644000175000017500000000114610512440500015117 0ustar yavoryavordnl as.m4 dnl Figure out how to run the assembler. dnl AM_PROG_AS AC_DEFUN([AM_PROG_AS], [ dnl By default we simply use the C compiler to build assembly code. AC_REQUIRE([AC_PROG_CC]) : ${CCAS='$(CC)'} # Set CCASFLAGS if not already set. : ${CCASFLAGS='$(CFLAGS)'} # Set ASCOMPILE if not already set. if test $CCAS = '$'CC; then : ${CCASCOMPILE='$(LIBTOOL) --mode=compile $(CCAS) $(AM_ASFLAGS) $(CCASFLAGS) -c'} else : ${CCASCOMPILE='$(LIBTOOL) --mode=compile $(CCAS) $(AM_ASFLAGS) $(CCASFLAGS)'} fi AC_SUBST(CCAS) AC_SUBST(CCASFLAGS) AC_SUBST(CCASCOMPILE) ]) avifile-0.7.48~20090503.ds/m4/dc1394.m40000644000175000017500000000070010745413462015435 0ustar yavoryavor dnl AM_PATH_DC1394([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl test for libdc1394_control dnl defines DC1394_CFLAGS and DC1394_LIBS AC_DEFUN([AM_PATH_DC1394], [ AC_AVM_CHECK_LIB(dc1394, [for dc1394_create_handle in -ldc1394_control], [where DC1394 is installed], [-ldc1394_control -lraw1394], [#include ], [dc1394_create_handle(0)], [$1], [$2]) ]) avifile-0.7.48~20090503.ds/m4/divx.m40000644000175000017500000000351710472607215015507 0ustar yavoryavor# Configure paths for DivX dnl Usage: dnl AM_PATH_DIVX([ACTION-IF-FOUND-DECORE [, ACTION-IF-NOT-FOUND-DECORE dnl [, ACTION-IF-FOUND-ENCORE, [ACTION-IF-NOT-FOUND-DECORE]]]] ) dnl Test for libdivxdecore, libdivxencore, and define DIVX_CFLAGS and DIVX_LIBS dnl AC_DEFUN([AM_PATH_DIVX], [ AC_ARG_WITH(divx4_prefix, [ --with-divx4-prefix=PFX where divx4linux is installed.], [], with_divx4_prefix=) have_divx_decore=no have_divx_encore=no DIVX_CFLAGS="" DIVX_LIBS="" ac_save_CPPFLAGS=$CPPFLAGS if test -n "$with_divx4_prefix"; then dnl user has specified extra path for DivX4 instalation CPPFLAGS="-I$with_divx4_prefix $CPPFLAGS" AC_CHECK_HEADER(include/decore.h, DIVX_CFLAGS="-I$with_divx4_prefix/include" DIVX_LIBS="-L$with_divx4_prefix/lib" have_divx_decore=yes) if test "$have_divx_decore" = no; then AC_CHECK_HEADER(decore.h, DIVX_CFLAGS="-I$with_divx4_prefix" DIVX_LIBS="-L$with_divx4_prefix" have_divx_decore=yes) fi else AC_CHECK_HEADER(decore.h, have_divx_decore=yes) fi AC_CHECK_HEADER(encore2.h, have_divx_encore=yes) CPPFLAGS=$ac_save_CPPFLAGS ac_save_LIBS=$LIBS if test "$have_divx_decore" = yes; then AC_CHECK_LIB(divxdecore, decore, [], have_divx_decore=no, $DIVX_LIBS) fi if test "$have_divx_encore" = yes; then AC_CHECK_LIB(divxencore, encore, [], have_divx_encore=no, $DIVX_LIBS) fi LIBS=$ac_save_LIBS if test "$have_divx_decore" = yes; then DIVX_LIBS="$DIVX_LIBS -ldivxdecore" ifelse([$1], , :, [$1]) else ifelse([$2], , :, [$2]) fi if test "$have_divx_encore" = yes; then DIVX_LIBS="$DIVX_LIBS -ldivxencore" ifelse([$3], , :, [$3]) else ifelse([$4], , :, [$4]) fi AC_SUBST(DIVX_CFLAGS) AC_SUBST(DIVX_LIBS) ]) avifile-0.7.48~20090503.ds/m4/dts.m40000644000175000017500000000115410745413462015324 0ustar yavoryavor dnl AM_PATH_DTS([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl test for libdts dnl defines DTS_CFLAGS and DTS_LIBS AC_DEFUN([AM_PATH_DTS], [ dnl dts.h needs stdint.h/inttypes.h for plain compile! AC_AVM_CHECK_LIB(dts, [for dts_init in -ldts], [where DTS is installed], [-ldts -lm], [ #if HAVE_INTTYPES_H # include #endif #if HAVE_STDINT_H # include #endif #include ], [dts_state_t* d = dts_init(0)], [$1], [$2]) ]) avifile-0.7.48~20090503.ds/m4/faad.m40000644000175000017500000000054610745413462015431 0ustar yavoryavor dnl AM_PATH_FAAD([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl test for libfaad dnl defines FAAD_CFLAGS and FAAD_LIBS AC_DEFUN([AM_PATH_FAAD], [ AC_AVM_CHECK_LIB(faad, [for faacDecOpen in -lfaad], [where FAAD is installed], [-lfaad -lm], [#include ], [faacDecHandle h = faacDecOpen()], [$1], [$2]) ]) avifile-0.7.48~20090503.ds/m4/ffmpeg.m40000644000175000017500000002723511167211522015776 0ustar yavoryavordnl Che dnl currently needed only by ffmpeg dnl AC_FUNC_LRINTF([ACTION-IF-FOUND-LRINTF [, ACTION-IF-NOT-FOUND-LRINTF]]) dnl AC_DEFUN([AC_FUNC_LRINTF], [ AC_CACHE_CHECK([whether system declares lrintf function in math.h], ac_cv_val_have_lrintf, [ac_save_CFLAGS=$CFLAGS ac_save_LIBS=$LIBS CFLAGS="$CFLAGS -O2" LIBS="$LIBS -lm" AC_RUN_IFELSE(AC_LANG_SOURCE([ #define _ISOC99_SOURCE 1 #include int main( void ) { return (lrintf(3.999f) > 0)?0:1; }]), ac_cv_val_have_lrintf=yes, ac_cv_val_have_lrintf=no, [ echo $ac_n "cross compiling; assumed OK... $ac_c" ]) CFLAGS=$ac_save_CFLAGS LIBS=$ac_save_LIBS ]) if test "$ac_cv_val_have_lrintf" = yes; then ifelse([$1], , :, [$1]) else ifelse([$2], , :, [$2]) fi ]) dnl dnl AC_CHECK_IPV6([ACTION-IF-FOUND-IPV6 [, ACTION-IF-NOT-FOUND-IPV6]]) dnl AC_DEFUN([AC_CHECK_IPV6], [ AC_CACHE_CHECK([whether system supports IPv6], ac_cv_val_have_ipv6, AC_COMPILE_IFELSE(AC_LANG_PROGRAM([ #include #include #include #include ], [ struct sockaddr_storage saddr; struct ipv6_mreq mreq6; getaddrinfo(0,0,0,0); getnameinfo(0,0,0,0,0,0,0); IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0); ]), ac_cv_val_have_ipv6=yes, ac_cv_val_have_ipv6=no) ) if test "$ac_cv_val_have_ipv6" = yes; then ifelse([$1], , :, [$1]) else ifelse([$2], , :, [$2]) fi ]) dnl Usage: dnl AM_PATH_FFMPEG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for ffmpeg, and define FFMPEG_CFLAGS and FFMPEG_LIBS AC_DEFUN([AM_PATH_FFMPEG], [ AC_FUNC_LRINTF([ AC_DEFINE(HAVE_LRINTF, 1, [Define if you have lrintf on your system.]) # HACK - add detection AC_DEFINE(HAVE_LLRINT, 1, [llrint]) AC_DEFINE(HAVE_LRINT, 1, [lrint]) AC_DEFINE(HAVE_LRINTF, 1, [lrint]) AC_DEFINE(HAVE_ROUND, 1, [round]) AC_DEFINE(HAVE_ROUNDF, 1, [roundf]) AC_DEFINE(HAVE_TRUNCF, 1, [roundf]) ]) AC_CHECK_FUNCS(mkstemp) AC_CHECK_ALIGN_POWER([ AC_DEFINE(ASMALIGN(ZEROBITS), [".align " #ZEROBITS "\n\t"], [ffmpeg Define if your .align arg is power-of-two.])],[ AC_DEFINE(ASMALIGN(ZEROBITS), [".align 1<<" #ZEROBITS "\n\t"], [ffmpeg Define if your .align arg is not power-of-two.]) ]) AC_CACHE_CHECK([for socklen_t], ac_cv_val_socklen_t, AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include ], [ socklen_t slen ]), ac_cv_val_socklen_t=yes, ac_cv_val_socklen_t=no) ) if test "$ac_cv_val_socklen_t" = yes; then AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define if you have socklen_t in header file.]) fi AC_CHECK_RESTRICT_KEYWORD(AC_DEFINE_UNQUOTED(restrict, $have_restrict_keyword, [Define restrict keyword.])) AC_CHECK_HEADERS(poll.h termios.h conio.h sys/resource.h) dnl !!! - it really sucks - Makefile.am can not be optimized even by dnl !!! preparing some extra variable forward dnl !!! FFAVFORMAT_SRC= ac_enablef_mmx=0 ac_enablef_arm=0 ac_enablef_mlib=0 ac_enablef_vis=0 ac_enablef_sparc=0 ac_enablef_alpha=0 ac_enablef_ppc=0 ac_enablef_mmi=0 ac_enablef_sh4=0 ac_enablef_bfin=0 case "$target" in i?86*|ia64*|x86_64*|amd64*) ac_enablef_mmx=1 ;; alpha*) ac_enablef_alpha=1 ;; arm*) ac_enablef_arm=1 ;; sparc*) ac_enablef_vis=1 ;; mips*) ac_enablef_mmi=1 ;; ppc*|powerpc*) ac_enablef_ppc=1 ;; esac AC_DEFINE_UNQUOTED(HAVE_MMX, $ac_enablef_mmx, [ffmpeg]) AC_DEFINE_UNQUOTED(HAVE_SSE, $ac_enablef_mmx, [ffmpeg]) AC_DEFINE_UNQUOTED(ARCH_ARM, $ac_enablef_arm, [ffmpeg]) AC_DEFINE_UNQUOTED(CONFIG_MLIB, $ac_enablef_mlib, [ffmpeg]) AC_DEFINE_UNQUOTED(HAVE_VIS, $ac_enablef_vis, [ffmpeg]) AC_DEFINE_UNQUOTED(ARCH_ALPHA, $ac_enablef_alpha, [ffmpeg]) AC_DEFINE_UNQUOTED(ARCH_PPC, $ac_enablef_ppc, [ffmpeg]) AC_DEFINE_UNQUOTED(HAVE_MMI, $ac_enablef_mmi, [ffmpeg]) AC_DEFINE_UNQUOTED(ARCH_SH4, $ac_enablef_sh4, [ffmpeg]) AC_DEFINE_UNQUOTED(ARCH_BFIN, $ac_enablef_bfin, [ffmpeg]) dnl these should be checked AC_DEFINE(HAVE_EBX_AVAILABLE, 0, [ffmpeg]) AC_DEFINE(HAVE_EBP_AVAILABLE, 0, [ffmpeg]) dnl AC_DEFINE(BROKEN_RELOCATION, 1, [ffmpeg]) AC_DEFINE(HAVE_CMOV, 1, [ffmpeg]) AC_DEFINE(HAVE_FAST_CMOV, 1, [ffmpeg]) AC_DEFINE(CONFIG_ENCODERS, 1, [ffmpeg Define if you want to build encoders.]) AC_DEFINE(CONFIG_DECODERS, 1, [ffmpeg Define if you want to build decoders.]) AC_DEFINE(CONFIG_MUXERS, 1, [ffmpeg Define if you want to build muxers.]) AC_DEFINE(CONFIG_DEMUXERS, 1, [ffmpeg Define if you want to build demuxers.]) AC_DEFINE(CONFIG_SMALL, 0, [ffmpeg Define if you want to optimize for size.]) AC_DEFINE(CONFIG_GRAY, 0, [ffmpeg Define if you want to full grayscale support.]) dnl GPL AC_ARG_ENABLE(ffmpeg_gpl, [ --disable-ffmpeg-gpl disable GPL code in ffmpeg. [[enabled]]], [], enable_ffmpeg_gpl=yes) if test "$enable_ffmpeg_gpl" = yes; then AC_DEFINE(CONFIG_GPL, 1, [ffmpeg]) fi AC_DEFINE(RUNTIME_CPUDETECT, 1, [ffmpeg for libpostprocess and libswscale]) dnl SMALL AC_ARG_ENABLE(ffmpeg_small, [ --enable-ffmpeg-small optimize ffmpeg for size. [[disabled]]], [], enable_ffmpeg_small=no) if test "$enable_ffmpeg_small" = yes; then ac_enablef_small=1 else ac_enablef_small=0 fi AC_DEFINE_UNQUOTED(ENABLE_SMALL, $ac_enablef_small, [ffmpeg]) dnl GRAY AC_ARG_ENABLE(ffmpeg_gray, [ --enable-ffmpeg-gray enable full grayscale support (slower color). [[disabled]]], [], enable_ffmpeg_gray=no) if test "$enable_ffmpeg_gray" = yes; then ac_enablef_gray=1 else ac_enablef_gray=0 fi AC_DEFINE_UNQUOTED(ENABLE_GRAY, $ac_enablef_gray, [ffmpeg]) dnl THREADS AC_ARG_ENABLE(ffmpeg_threads, [ --disable-ffmpeg-threads support threads in ffmpeg. [[enabled]]], [], enable_ffmpeg_threads=yes) if test "$enable_ffmpeg_threads" = yes; then AC_DEFINE(HAVE_THREADS, 1, [ffmpeg Define if you want to use threads.]) fi dnl DV1394 AC_ARG_ENABLE(ffmpeg_dv1394, [ --disable-ffmpeg-dv1394 disable ffmpeg DV1394 support. [[enabled]]], [], enable_ffmpeg_dv1394=yes) if test "$enable_ffmpeg_dv1394" = yes; then enablef_dv1394=1 else enablef_dv1394=0 fi AC_DEFINE_UNQUOTED(CONFIG_DV1394_DEMUXER, $enablef_dv1394, [ffmpeg Define if you want to have DV1394 support compiled.]) dnl LIBDC1394 AC_ARG_ENABLE(ffmpeg_dc1394, [ --enable-ffmpeg-dc1394 ffmpeg DC1394 support. [[disabled]]], [], enable_ffmpeg_dc1394=no) enablef_dc1394=0 if test "$enable_ffmpeg_dc1394" = yes; then AM_PATH_DC1394([enablef_dc1394=1], []) fi AC_DEFINE_UNQUOTED(CONFIG_LIBDC1394_DEMUXER, $enablef_dc1394, [ffmpeg Define if you want to have DV1394 support compiled.]) dnl LIBFAAD AC_REQUIRE([AM_PATH_FAAD]) if test "$have_faad" = yes; then enablef_aac=1 dnl fix ffmpeg - mov.c needs libfaad AC_ARG_ENABLE(ffmpeg_faadbin, [ --disable-ffmpeg-faadbin do not build ffmpeg with FAAD bin.support. [[enabled]]], [], enable_ffmpeg_faadbin=yes) if test "$enable_ffmpeg_faadbin" = yes; then AC_DEFINE(CONFIG_LIBFAADBIN, 1, [ffmpeg Define if you want to build support for runtime linked libfaad.]) fi else enablef_aac=0 fi AC_DEFINE_UNQUOTED(CONFIG_LIBFAAD_DECODER, $enablef_aac, [ffmpeg Define if you want to have LibFAAD decoder compiled.]) dnl OpenJPEG AC_ARG_ENABLE(ffmpeg_openjpeg, [ --enable-ffmpeg-openjpeg ffmpeg OpenJPEG support. [[disabled]]], [], enable_ffmpeg_openjpeg=no) enablef_openjpeg=0 if test "$enable_ffmpeg_openjpeg" = yes; then dnl AM_PATH_OPENJPEG([enablef_openjpeg=1], []) enablef_openjpeg=1 fi AC_DEFINE_UNQUOTED(CONFIG_LIBOPENJPEG_DECODER, $enablef_openjpeg, [ffmpeg Define if you want to have OpenJPEG decoder.]) dnl OSS audio AC_REQUIRE([AC_CHECK_OSS]) if test "$enable_oss" = yes; then enablef_audio=1 else enablef_audio=0 fi AC_DEFINE_UNQUOTED(CONFIG_OSS_DEMUXER, $enablef_audio, [ffmpeg Define if you want to have OSS audio demuxer.]) AC_DEFINE_UNQUOTED(CONFIG_OSS_MUXER, $enablef_audio, [ffmpeg Define if you want to have OSS audio demuxer.]) dnl UNUSED!!! AC_ARG_ENABLE(ffmpeg_pp, [ --disable-ffmpeg-pp disable postprocessing support in ffmpeg. [[enabled]]], [], enable_ffmpeg_pp=yes) if test "$enable_ffmpeg_pp" = yes; then AC_DEFINE(CONFIG_PP, 1, [ffmpeg Define if you want to build with PP support.]) fi AC_ARG_ENABLE(ffmpeg_swscaler, [ --enable-ffmpeg-swscaler build ffmpeg with SWScaler. [[disabled]]], [], enable_ffmpeg_swscaler=no) if test "$enable_ffmpeg_swscaler" = yes; then AC_DEFINE(CONFIG_SWSCALER, 1, [ffmpeg Define if you want to build with SWScaler.]) fi AC_ARG_ENABLE(ffmpeg_mpegaudiohp, [ --disable-ffmpeg-mpegaudiohp build ffmpeg with MPEG HighPrecision. [[enabled]]], [], enable_ffmpeg_mpegaudiohp=yes) if test "$enable_ffmpeg_mpegaudiohp" = yes; then AC_DEFINE(CONFIG_MPEGAUDIO_HP, 1, [ffmpeg Define if you want to have highprecision mpeg audio support compiled.]) fi AC_REQUIRE([AC_CHECK_V4L]) if test "$enable_v4l" = yes; then AC_DEFINE(CONFIG_VIDEO4LINUX, 1, [ffmpeg Define if you have video4linux device.]) fi AC_REQUIRE([AC_CHECK_V4L2]) if test "$enable_v4l2" = yes; then AC_DEFINE(CONFIG_VIDEO4LINUX2, 1, [ffmpeg Define if you have video4linux2 device.]) fi AC_ARG_ENABLE(ffmpeg_network, [ --disable-ffmpeg-network disable network support. [[enabled]]], [], enable_ffmpeg_network=yes) if test "$enable_ffmpeg_network" = yes; then AC_DEFINE(CONFIG_NETWORK, 1, [ffmpeg Define if you want to build with network support.]) fi AC_CHECK_IPV6([ if test "$enable_ffmpeg_network" = yes; then AC_DEFINE(CONFIG_IPV6, 1, [ffmpeg Define if you want to build with IPv6 support.]) fi], []) AC_ARG_ENABLE(ffmpeg_protocol, [ --disable-ffmpeg-protocol disable ffmpeg protocol support. [[enabled]]], [], enable_ffmpeg_protocol=yes) if test "$enable_ffmpeg_protocol" = yes; then AC_DEFINE(CONFIG_PROTOCOLS, 1, [ffmpeg Define if you want to build with protocols registered.]) fi AC_REQUIRE([AC_FIND_ZLIB]) if test "$have_zlib" = yes; then enablef_zlib=1 AC_DEFINE(CONFIG_ZLIB, 1, [ffmpeg Define if you have z library (-lz)]) else enablef_zlib=0 fi AC_DEFINE_UNQUOTED(CONFIG_DXA_DECODER, $enablef_zlib, [ffmpeg]) AC_DEFINE_UNQUOTED(CONFIG_FLASHSV_DECODER, $enablef_zlib, [ffmpeg]) AC_DEFINE_UNQUOTED(CONFIG_FLASHSV_ENCODER, $enablef_zlib, [ffmpeg]) AC_DEFINE_UNQUOTED(CONFIG_PNG_DECODER, $enablef_zlib, [ffmpeg]) AC_DEFINE_UNQUOTED(CONFIG_PNG_ENCODER, $enablef_zlib, [ffmpeg]) AC_DEFINE_UNQUOTED(CONFIG_TSCC_DECODER, $enablef_zlib, [ffmpeg]) AC_DEFINE_UNQUOTED(CONFIG_ZMBV_DECODER, $enablef_zlib, [ffmpeg]) AC_DEFINE_UNQUOTED(CONFIG_ZMBV_ENCODER, $enablef_zlib, [ffmpeg]) AC_DEFINE(CONFIG_FFSERVER, 1, [ffmpeg Define if you want to build server.]) AC_DEFINE(SIMPLE_IDCT, 1, [ffmpeg Define if you want to build with simples idct.]) AC_DEFINE(HAVE_PTHREADS, 1, [ffmpeg Define if you want to have pthread support compiled.]) AC_DEFINE_UNQUOTED(EXTERN_PREFIX, "", [ffmpeg Define for extern prefix.]) AC_CHECK_GNU_VECTOR(FFMPEG_OPTFLAGS="$FFMPEG_OPTFLAGS -msse"; AC_DEFINE(HAVE_BUILTIN_VECTOR, 1, [ffmpeg Define if your compiler supports vector builtins (MMX).]), []) AC_SUBST(FFMPEG_OPTFLAGS) case "$target" in i?86*) FFMPEG_PREFERNONPIC="-prefer-non-pic" ;; *) FFMPEG_PREFERNONPIC="" ;; esac AC_SUBST(FFMPEG_PREFERNONPIC) AC_SUBST(FFMPEG_CFLAGS) AC_SUBST(FFMPEG_LIBS) dnl ffmpeg_x86opt= dnl test x$enable_x86opt = xno && ffmpeg_x86opt="--disable-mmx" dnl AC_MSG_RESULT([=== configuring ffmpeg ===]) dnl ( cd $srcdir/ffmpeg ; \ dnl ./configure --prefix=$prefix --cc=$CC \ dnl $ffmpeg_cpu \ dnl $ffmpeg_x86opt --disable-mp3lib \ dnl --enable-simple_idct ) ]) avifile-0.7.48~20090503.ds/m4/freetype2.m40000644000175000017500000001163010472607215016435 0ustar yavoryavor# Configure paths for FreeType2 # Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor dnl AC_CHECK_FT2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for FreeType2, and define FT2_CFLAGS and FT2_LIBS dnl AC_DEFUN([AC_CHECK_FT2], [dnl dnl Get the cflags and libraries from the freetype-config script dnl AC_ARG_WITH(ft-prefix, [ --with-ft-prefix=PREFIX prefix where FreeType is installed], ft_config_prefix="$withval", ft_config_prefix="") AC_ARG_WITH(ft-exec-prefix, [ --with-ft-exec-prefix=PFX exec prefix where FreeType is installed], ft_config_exec_prefix="$withval", ft_config_exec_prefix="") AC_ARG_ENABLE(freetypetest, [ --disable-freetypetest do not try to compile and run a test FT2 program.], [], enable_fttest=yes) if test x$ft_config_exec_prefix != x ; then ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix" if test x${FT2_CONFIG+set} != xset ; then FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config fi fi if test x$ft_config_prefix != x ; then ft_config_args="$ft_config_args --prefix=$ft_config_prefix" if test x${FT2_CONFIG+set} != xset ; then FT2_CONFIG=$ft_config_prefix/bin/freetype-config fi fi AC_PATH_PROG(FT2_CONFIG, freetype-config, no) min_ft_version=ifelse([$1], ,6.1.0,$1) AC_MSG_CHECKING(for FreeType - version >= $min_ft_version) no_ft="" if test "$FT2_CONFIG" = "no" ; then no_ft=yes else FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags` FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs` ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` ft_min_major_version=`echo $min_ft_version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` ft_min_minor_version=`echo $min_ft_version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` ft_min_micro_version=`echo $min_ft_version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test x$enable_fttest = xyes ; then ft_config_is_lt="" if test $ft_config_major_version -lt $ft_min_major_version ; then ft_config_is_lt=yes else if test $ft_config_major_version -eq $ft_min_major_version ; then if test $ft_config_minor_version -lt $ft_min_minor_version ; then ft_config_is_lt=yes else if test $ft_config_minor_version -eq $ft_min_minor_version ; then if test $ft_config_micro_version -lt $ft_min_micro_version ; then ft_config_is_lt=yes fi fi fi fi fi if test x$ft_config_is_lt = xyes ; then no_ft=yes else ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $FT2_CFLAGS" LIBS="$FT2_LIBS $LIBS" dnl dnl Sanity checks for the results of freetype-config to some extent dnl AC_RUN_IFELSE(AC_LANG_SOURCE([ #include #include FT_FREETYPE_H #include #include int main() { FT_Library library; FT_Error error; error = FT_Init_FreeType(&library); if (error) return 1; else { FT_Done_FreeType(library); return 0; } } ]), [], no_ft=yes, [echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi # test $ft_config_version -lt $ft_min_version fi # test x$enable_fttest = xyes fi # test "$FT2_CONFIG" = "no" if test x$no_ft = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$FT2_CONFIG" = "no" ; then echo "*** The freetype-config script installed by FreeType 2 could not be found." echo "*** If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the FT2_CONFIG environment variable to the" echo "*** full path to freetype-config." else if test x$ft_config_is_lt = xyes ; then echo "*** Your installed version of the FreeType 2 library is too old." echo "*** If you have different versions of FreeType 2, make sure that" echo "*** correct values for --with-ft-prefix or --with-ft-exec-prefix" echo "*** are used, or set the FT2_CONFIG environment variable to the" echo "*** full path to freetype-config." else echo "*** The FreeType test program failed to run. If your system uses" echo "*** shared libraries and they are installed outside the normal" echo "*** system library path, make sure the variable LD_LIBRARY_PATH" echo "*** (or whatever is appropiate for your system) is correctly set." fi fi FT2_CFLAGS="" FT2_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(FT2_CFLAGS) AC_SUBST(FT2_LIBS) ]) avifile-0.7.48~20090503.ds/m4/iconv.m40000644000175000017500000000366610472607215015660 0ustar yavoryavor# Configure paths for iconv dnl Usage: dnl AC_ICONV(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for ares, and defines dnl - ICONV_CFLAGS (compiler flags) dnl - ICONV_LIBS (linker flags, stripping and path) dnl prerequisites: AC_DEFUN([AC_ICONV], [ dnl check it it is part of the libc AC_CHECK_LIB(c, iconv_open, ac_cv_have_iconv=yes, ac_cv_have_iconv=no) ICONV_CFLAGS= ICONV_LIBS= AC_ARG_WITH(iconv, [ --with-iconv=PATH where iconv is installed], [ if test x$ac_cv_have_iconv = xno; then ac_iconv_path= case "$with_iconv" in 'yes') ac_iconv_path="/usr" ;; 'no') ;; *) ac_iconv_path=$with_iconv ;; esac if test -n "$ac_iconv_path"; then ac_save_ICONVLIBS=$LIBS LIBS="-L$ac_iconv_path/lib $LIBS" AC_CHECK_LIB(iconv, iconv_open, ac_cv_have_iconv=yes, []) if test "$ac_cv_have_iconv" = yes; then ICONV_LIBS="-liconv" if test "$ac_iconv_path" != "/usr"; then ICONV_CFLAGS="-I$ac_iconv_path/include" ICONV_LIBS="$ac_iconv_path/lib $ICONV_LIBS" fi fi LIBS=$ac_save_ICONVLIBS fi fi ]) if test x$ac_cv_have_iconv = xyes ; then AC_MSG_CHECKING([for iconv declaration]) AC_CACHE_VAL(ac_cv_proto_iconv, AC_COMPILE_IFELSE(AC_LANG_PROGRAM([ #include #include #ifdef __cplusplus extern "C" #endif #if defined(__STDC__) || defined(__cplusplus) size_t iconv(iconv_t cd, char**, size_t*, char**, size_t*); #else size_t iconv(); #endif ], []), ac_cv_proto_iconv="", ac_cv_proto_iconv="const") ) AC_DEFINE_UNQUOTED(ICONV_CONST_CAST, $ac_cv_proto_iconv, [Use casting for iconv's inputbuffer - don't ask me.]) if test "$ac_cv_proto_iconv" = const; then AC_MSG_RESULT([using const]) else AC_MSG_RESULT([not using const]) fi ifelse([$2], , :, [$2]) else ICONV_CFLAGS="" ICONV_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(ICONV_CFLAGS) AC_SUBST(ICONV_LIBS) ]) avifile-0.7.48~20090503.ds/m4/mad.m40000644000175000017500000000541210747452375015304 0ustar yavoryavordnl Usage: dnl AM_PATH_MAD([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for MAD audio library, and defines dnl prerequisites: AC_DEFUN([AM_PATH_MAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_CANONICAL_TARGET]) MAD_CFLAGS= MAD_LIBS= ac_enable_libmad=yes AC_ARG_WITH(mad_prefix, AC_HELP_STRING(--with-mad-prefix=PFX,[where MAD library is installed. [[internal]]]), [], with_mad_prefix=internal) if test "$with_mad_prefix" != internal; then ac_save_LDFLAGS=$LDFLAGS ac_save_LIBS=$LIBS if test -n "$with_mad_prefix" -a "$with_mad_prefix" != "/usr"; then MAD_CFLAGS="-I$with_mad_prefix/include" LDFLAGS="-L$with_mad_prefix/lib" fi AC_CHECK_LIB(mad, mad_stream_init, MAD_LIBS="$LDFLAGS -lmad", ac_enable_libmad=no) LDFLAGS=$ac_save_LDFLAGS LIBS=$ac_save_LIBS AC_SUBST(MAD_CFLAGS) AC_SUBST(MAD_LIBS) else AC_MSG_RESULT(checking for mad library... using internal version) fi AC_ARG_ENABLE(mad_speed, [ --disable-mad-speed build internal MAD for speed. [[enabled]]], [], enable_mad_speed=yes) if test "$enable_mad_speed" = yes; then AC_DEFINE(OPT_SPEED, 1, [MAD Define to optimize for speed over accuracy.]) fi AC_ARG_ENABLE(mad, [ --enable-mad-accuracy build internal MAD for accuracy. [[disabled]]], [], enable_mad=no) if test "$enable_mad_speed" = yes -a "$enable_mad_speed" = no; then AC_DEFINE(OPT_ACCURACY, 1, [MAD Define to optimize for accuracy over speed.]) fi case "$target" in i?86*) AC_DEFINE(FPM_INTEL, 1, [MAD Define intel fixed-point math routines.]) ;; arm*) AC_DEFINE(FPM_ARM, 1, [MAD Define arm fixed-point math routines.]) ;; mips*) AC_DEFINE(FPM_MIPS, 1, [MAD Define mips fixed-point math routines.]) ;; sparc*) AC_DEFINE(FPM_SPARC, 1, [MAD Define sparc fixed-point math routines.]) ;; powerpc*) AC_DEFINE(FPM_PPC, 1, [MAD Define powerpc fixed-point math routines.]) ;; *) AC_DEFINE(FPM_DEFAULT, 1, [MAD Define default fixed-point math routines.]) ;; esac AC_ARG_ENABLE(madsso, [ --disable-mad-sso use subband synthesis optimization. [[enabled]]], [], enable_madsso=yes) if test "$enable_madsso" = yes; then AC_DEFINE(OPT_SSO, 1, [MAD Define to enable a fast subband synthesis approximation optimization.]) fi AC_ARG_ENABLE(madaso, [ --disable-mad-aso disable architecture-specific optimizations. [[enabled]]], [], enable_madaso=yes) if test "$enable_madaso" = yes; then case "$target" in i?86*) AC_DEFINE(ASO_ZEROCHECK, 1, [MAD Define for fast subband synthesis approximation.]) ;; esac fi if test "$ac_enable_libmad" = yes; then ifelse([$1], , :, [$1]) else ifelse([$2], , :, [$2]) fi ]) avifile-0.7.48~20090503.ds/m4/ogg.m40000644000175000017500000000043210745413462015304 0ustar yavoryavor dnl AM_PATH_OGG([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl test for libogg dnl defines OGG_CFLAGS and OGG_LIBS AC_DEFUN([AM_PATH_OGG], [ AC_AVM_CHECK_LIB(ogg, [for ogg], [where libogg is installed], [-logg], [#include ], [], [$1], [$2]) ]) avifile-0.7.48~20090503.ds/m4/oss.m40000644000175000017500000000157610472607215015344 0ustar yavoryavordnl Usage: dnl AC_CHECK_OSS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for OSS audio interface, and defines dnl prerequisites: AC_DEFUN([AC_CHECK_OSS], [ AC_ARG_ENABLE(oss, [ --enable-oss support the OSS audio API. [[autodetect]]], [], enable_oss=yes) if test x$enable_oss = xyes; then AC_CACHE_CHECK([for OSS audio support], ac_cv_val_have_oss_audio, [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #ifdef __NetBSD__ #include #include #else #include #endif ]], [[ int arg = SNDCTL_DSP_SETFRAGMENT; ]])],[ ac_cv_val_have_oss_audio=yes ],[ ac_cv_val_have_oss_audio=no ]) ]) enable_oss=$ac_cv_val_have_oss_audio fi if test x$enable_oss = xyes; then AC_CHECK_LIB([ossaudio], [_oss_ioctl]) ifelse([$1], , :, [$1]) else ifelse([$2], , :, [$2]) fi ]) avifile-0.7.48~20090503.ds/m4/pkg.m40000644000175000017500000001206311050117644015305 0ustar yavoryavor# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 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 # General Public License for more details. # # You should have received a copy of the GNU 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. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # # Similar to PKG_CHECK_MODULES, make sure that the first instance of # this or PKG_CHECK_MODULES is called, or make sure to call # PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_ifval([$2], [$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD ifelse([$4], , [AC_MSG_ERROR(dnl [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT ])], [AC_MSG_RESULT([no]) $4]) elif test $pkg_failed = untried; then ifelse([$4], , [AC_MSG_FAILURE(dnl [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])], [$4]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) ifelse([$3], , :, [$3]) fi[]dnl ])# PKG_CHECK_MODULES avifile-0.7.48~20090503.ds/m4/sdl.m40000644000175000017500000001567210472607215015324 0ustar yavoryavor# Configure paths for SDL # Sam Lantinga 9/21/99 # stolen from Manish Singh # stolen back from Frank Belew # stolen from Manish Singh # shamelessly stolen from Owen Taylor # modified for avifile dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS dnl AC_DEFUN([AM_PATH_SDL], [dnl dnl Get the cflags and libraries from the sdl-config script dnl AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX prefix where SDL is installed.], sdl_prefix="$withval", sdl_prefix="") AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX exec prefix where SDL is installed.], sdl_exec_prefix="$withval", sdl_exec_prefix="") AC_ARG_ENABLE(sdltest, [ --disable-sdltest do not try to compile and run a test SDL program.], , enable_sdltest=yes) if test x$sdl_exec_prefix != x ; then sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config fi fi if test x$sdl_prefix != x ; then sdl_args="$sdl_args --prefix=$sdl_prefix" if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_prefix/bin/sdl-config fi fi if test -z "$SDL_CONFIG"; then AC_CHECK_PROGS(SDL_MY_CONFIG, sdl-config sdl11-config, "") if test -n "$SDL_MY_CONFIG"; then SDL_CONFIG=`which $SDL_MY_CONFIG` AC_MSG_RESULT(setting SDL_CONFIG to $SDL_CONFIG) fi fi AC_REQUIRE([AC_CANONICAL_TARGET]) PATH="$prefix/bin:$prefix/usr/bin:$PATH" AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH]) min_sdl_version=ifelse([$1], ,0.11.0,$1) AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) no_sdl="" if test "$SDL_CONFIG" = "no" ; then no_sdl=yes else SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs | sed -e 's!-L/usr/lib[[^/]]!!g'` sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_sdltest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" dnl dnl Now check if the installed SDL is sufficiently new. (Also sanity dnl checks the results of sdl-config to some extent dnl rm -f conf.sdltest AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include #include #include "SDL.h" char* my_strdup (char *str) { char *new_str; if (str) { new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); strcpy (new_str, str); } else new_str = NULL; return new_str; } int main (int argc, char *argv[]) { int major, minor, micro; char *tmp_version; /* This hangs on some systems (?) system ("touch conf.sdltest"); */ { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = my_strdup("$min_sdl_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_sdl_version"); exit(1); } if (($sdl_major_version > major) || (($sdl_major_version == major) && ($sdl_minor_version > minor)) || (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) { return 0; } else { printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); printf("*** to point to the correct copy of sdl-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } } ]])],[],[no_sdl=yes],[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_sdl" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$SDL_CONFIG" = "no" ; then echo "*** The sdl-config script installed by SDL could not be found" echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the SDL_CONFIG environment variable to the" echo "*** full path to sdl-config." else if test -f conf.sdltest ; then : else echo "*** Could not run SDL test program, checking why..." CFLAGS="$CFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include #include "SDL.h" int main(int argc, char *argv[]) { return 0; } #undef main #define main K_and_R_C_main ]], [[ return 0; ]])],[ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding SDL or finding the wrong" echo "*** version of SDL. If it is not finding SDL, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],[ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means SDL was incorrectly installed" echo "*** or that you have moved SDL since it was installed. In the latter case, you" echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi SDL_CFLAGS="" SDL_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(SDL_CFLAGS) AC_SUBST(SDL_LIBS) rm -f conf.sdltest ]) AC_DEFUN([MY_TEST_SDL], [ AC_MSG_CHECKING([for SDL development libraries]) cat > conftest.c <&5 2>&5; then AC_MSG_RESULT([found]) GOOD_SDL_INSTALLATION=yes else AC_MSG_RESULT([linking against SDL library failed. Check config.log for details.]) GOOD_SDL_INSTALLATION=no fi else AC_MSG_RESULT([not found]) GOOD_SDL_INSTALLATION=no fi rm -f conftest.c conftest ]) avifile-0.7.48~20090503.ds/m4/v4l.m40000644000175000017500000000104110472607215015230 0ustar yavoryavor# Configure paths for video4linux dnl Usage: dnl AC_CHECK_V4L([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for video4linux interface, and defines dnl prerequisites: AC_DEFUN([AC_CHECK_V4L], [ AC_ARG_ENABLE(v4l, [ --enable-v4l support v4l video interface. [[autodetect]]], [], enable_v4l=yes) if test "$enable_v4l" = yes; then AC_CHECK_HEADER([linux/videodev.h], [], enable_v4l=no) fi if test "$enable_v4l" = yes; then ifelse([$1], , :, [$1]) else ifelse([$2], , :, [$2]) fi ]) avifile-0.7.48~20090503.ds/m4/v4l2.m40000644000175000017500000000165510472607215015325 0ustar yavoryavor# Configure paths for video4linux v2 dnl Usage: dnl AC_CHECK_V4L2([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for video4linux v2 interface, and defines dnl prerequisites: AC_DEFUN([AC_CHECK_V4L2], [ AC_ARG_ENABLE(v4l2, [ --enable-v4l2 support v4l2 video interface. [[autodetect]]], [], enable_v4l2=yes) if test "$enable_v4l2" = yes; then AC_CACHE_CHECK([whether system supports Video4Linux2], ac_cv_val_have_v4l2, AC_COMPILE_IFELSE(AC_LANG_PROGRAM([ #include #include #include ], [ int dummy = V4L2_PIX_FMT_YUV420; struct v4l2_buffer dummy1 ]), ac_cv_val_have_v4l2=yes, ac_cv_val_have_v4l2=no) ) test "$ac_cv_val_have_v4l2" = no && enable_v4l2=no fi if test "$enable_v4l2" = yes; then ifelse([$1], , :, [$1]) else ifelse([$2], , :, [$2]) fi ]) avifile-0.7.48~20090503.ds/m4/various.m40000644000175000017500000005265611164471024016231 0ustar yavoryavordnl -*- shell-script -*- dnl This file is part of the Avifile packages dnl and has been heavily modified for its purposes dnl Copyright (C) 2002-8 Zdenek Kabelac (kabi@users.sourceforge.net) dnl dnl Originaly this file was part of the KDE libraries/packages dnl Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu) dnl (C) 1997 Stephan Kulow (coolo@kde.org) dnl This file is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Library General Public dnl License as published by the Free Software Foundation; either dnl version 2 of the License, or (at your option) any later version. dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Library General Public License for more details. dnl You should have received a copy of the GNU Library General Public License dnl along with this library; see the file COPYING.LIB. If not, write to dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, dnl Boston, MA 02111-1307, USA. dnl ------------------------------------------------------------------------ dnl Find a file (or one of more files in a list of dirs) dnl ------------------------------------------------------------------------ dnl AC_DEFUN([AC_FIND_FILE], [ $3=NO for i in $2; do for j in $1; do if test -r "$i/$j"; then $3=$i break 2 fi done done ]) dnl KDE_MOC_ERROR_MESSAGE dnl AC_DEFUN([KDE_MOC_ERROR_MESSAGE], [ AC_MSG_ERROR([No valid Qt meta object compiler (moc) found! Please check whether you installed Qt correctly. You need to have a running moc binary. configure tried to run $ac_cv_path_moc and the test did not succeed. If configure should not have tried this one, set the environment variable MOC to the right one before running configure.]) ]) AC_DEFUN([KDE_UIC_ERROR_MESSAGE], [ AC_MSG_WARN([No valid Qt ui compiler (uic) found! Please check whether you installed Qt correctly. You need to have a running uic binary. configure tried to run $ac_cv_path_uic and the test did not succeed. If configure should not have tried this one, set the environment variable UIC to the right one before running configure.]) ]) dnl ------------------------------------------------------------------------ dnl Find the meta object compiler in the PATH, in $QTDIR/bin, and some dnl more usual places dnl ------------------------------------------------------------------------ dnl AC_DEFUN([AC_PATH_QT_MOC_UIC], [ dnl usually qt is installed in such a way it might help to dnl try this binpath first cutlib_binpath=`echo "$ac_qt_libraries" | sed 's%/[[^/]]*$%%'` lc_qt_binpath="$ac_qt_binpath:$cutlib_binpath/bin:$PATH:/usr/local/bin:/usr/local/qt3/bin:/usr/local/qt2/bin:/usr/local/qt/bin:/usr/lib/qt3/bin:/usr/lib/qt2/bin:/usr/lib/qt/bin:/usr/bin:/usr/X11R6/bin" AC_PATH_PROGS(MOC, moc moc3 moc2, , $lc_qt_binpath) dnl AC_PATH_PROGS(UIC, uic, , $lc_qt_binpath) if test -z "$MOC"; then if test -n "$ac_cv_path_moc"; then output=`eval "$ac_cv_path_moc --help 2>&1 | sed -e '1q' | grep Qt"` fi echo "configure:__oline__: tried to call $ac_cv_path_moc --help 2>&1 | sed -e '1q' | grep Qt" >&AS_MESSAGE_LOG_FD echo "configure:__oline__: moc output: $output" >&AS_MESSAGE_LOG_FD if test -z "$output"; then KDE_MOC_ERROR_MESSAGE fi fi AC_SUBST(MOC) dnl We do not need UIC dnl [KDE_UIC_ERROR_MESSAGE]) dnl AC_SUBST(UIC) ]) dnl AC_PATH_QT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl ------------------------------------------------------------------------ dnl Try to find the Qt headers and libraries. dnl $(QT_LIBS) will be -Lqtliblocation (if needed) -lqt_library_name dnl and $(QT_CFLAGS) will be -Iqthdrlocation (if needed) dnl ------------------------------------------------------------------------ dnl AC_DEFUN([AC_PATH_QT], [ AC_REQUIRE([AC_PATH_XTRA]) ac_have_qt=yes ac_qt_binpath= ac_qt_includes= ac_qt_libraries= ac_qt_notfound= qt_libraries= qt_includes= min_qt_version=ifelse([$1], ,100, $1) AC_ARG_WITH(qt_prefix, [ --with-qt-prefix where the root of Qt is installed.], [ ac_qt_includes="$withval"/include ac_qt_libraries="$withval"/lib ac_qt_binpath="$withval"/bin ]) test -n "$QTDIR" && ac_qt_binpath="$ac_qt_binpath:$QTDIR/bin:$QTDIR" AC_ARG_WITH(qt_includes, [ --with-qt-includes where the Qt includes are installed.], [ ac_qt_includes=$withval ]) AC_ARG_WITH(qt_libraries, [ --with-qt-libraries where the Qt library is installed.], [ ac_qt_libraries=$withval ]) if test -z "$ac_qt_includes" || test -z "$ac_qt_libraries" ; then AC_CACHE_VAL(ac_cv_have_qt, [ AC_LANG_PUSH(C++) # try to guess Qt locations # various paths from various distros - # you are welcome to suggest another qt_incdirs="$QTINC /usr/local/lib/qt3/include /usr/local/lib/qt2/include /usr/local/qt/include /usr/local/include /usr/lib/qt-3.1/include /usr/lib/qt3/include /usr/lib/qt-2.3.1/include /usr/lib/qt2/include /usr/include/qt3 /usr/include/qt /usr/lib/qt/include $x_includes/qt3 $x_includes/qt2 $x_includes/X11/qt $x_includes /usr/include" qt_libdirs="$QTLIB /usr/local/lib/qt3/lib /usr/local/lib/qt2/lib /usr/local/qt/lib /usr/local/lib /usr/lib/qt-3.1/lib /usr/lib/qt3/lib /usr/lib/qt-2.3.1/lib /usr/lib/qt2/lib /usr/lib/qt/lib /usr/lib/qt $x_libraries/qt3 $x_libraries/qt2 $x_libraries /usr/lib" if test -n "$QTDIR" ; then qt_incdirs="$QTDIR/include $QTDIR $qt_incdirs" qt_libdirs="$QTDIR/lib $QTDIR $qt_libdirs" fi qt_incdirs="$ac_qt_includes $qt_incdirs" qt_libdirs="$ac_qt_libraries $qt_libdirs" AC_FIND_FILE(qmovie.h, $qt_incdirs, qt_incdir) ac_qt_includes="$qt_incdir" qt_libdir=NONE for dir in $qt_libdirs ; do for qtname in qt3 qt2 qt ; do try="ls -1 $dir/lib$qtname.* $dir/lib$qtname-mt.*" if test -n "`$try 2> /dev/null`"; then test -z "$QTNAME" && QTNAME=$qtname qt_libdir=$dir break fi done if test x$qt_libdir != xNONE ; then break fi echo "tried $dir" >&AS_MESSAGE_LOG_FD done ac_qt_libraries=$qt_libdir test -z "$QTNAME" && QTNAME=qt ac_QTNAME=$QTNAME ac_save_QTLIBS=$LIBS LIBS="-L$ac_qt_libraries $LIBS $PTHREAD_LIBS" AC_CHECK_LIB($QTNAME-mt, main, ac_QTNAME=$QTNAME-mt) LIBS=$ac_save_QTLIBS ac_cv_have_qt="ac_have_qt=yes ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries ac_QTNAME=$ac_QTNAME" if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NONE ; then ac_cv_have_qt="ac_have_qt=no" ac_qt_notfound="(headers)" if test "$ac_qt_includes" = NO; then if test "$ac_qt_libraries" = NONE; then ac_qt_notfound="(headers and libraries)" fi else ac_qt_notfound="(libraries)"; fi fi AC_LANG_POP ]) eval "$ac_cv_have_qt" else for qtname in qt3 qt2 qt ; do try="ls -1 $ac_qt_libraries/lib$qtname.* $ac_qt_libraries/lib$qtname-mt.*" if test -n "`$try 2> /dev/null`"; then test -z "$QTNAME" && QTNAME=$qtname break fi done ac_QTNAME=$QTNAME ac_save_QTLIBS=$LIBS LIBS="-L$ac_qt_libraries $LIBS $PTHREAD_LIBS" AC_CHECK_LIB($QTNAME-mt, main, ac_QTNAME=$QTNAME-mt) LIBS=$ac_save_QTLIBS fi if test x$ac_have_qt = xyes ; then AC_MSG_CHECKING([for Qt library (version >= $min_qt_version)]) AC_CACHE_VAL(ac_cv_qt_version, [ AC_LANG_PUSH(C++) ac_save_QTCXXFLAGS=$CXXFLAGS ac_save_QTLIBS=$LIBS CXXFLAGS="$CXXFLAGS -I$ac_qt_includes" LIBS="-L$ac_qt_libraries -l$ac_QTNAME $X_LIBS $LIBS $PTHREAD_LIBS" AC_RUN_IFELSE([AC_LANG_SOURCE([[ /*#include */ /*#include */ #include #include #include int main(int argc, char* argv[]) { /*QApplication a( argc, argv );*/ /*QMovie m; int s = m.speed();*/ QString qa("test"); unsigned int v = QT_VERSION; FILE* f = fopen("conf.qttest", "w"); if (v > 400) v = (((v >> 16) & 0xff) * 100) + (((v >> 8) & 0xff) * 10) + (v & 0xff); if (f) fprintf(f, "%d\n", v); return 0; } ]])],[ AC_MSG_RESULT(yes); ac_cv_qt_version=`cat conf.qttest`; rm -f conf.qttest ],[ AC_MSG_RESULT(no); ac_have_qt=no; ac_cv_qt_version=ERROR ],[ echo $ac_n "cross compiling; assumed OK... $ac_c" ]) if test x$ac_cv_qt_version = xERROR ; then AC_MSG_WARN([ *** Could not run Qt test program, checking why... *** Configure discovered/uses these settings: *** Qt libraries: $ac_qt_libraries *** Qt headers: $ac_qt_includes *** Note: *** Compilation of Qt utilities also might be turned off (if not wanted). *** If you are experiencing problems which will not be described *** bellow please report then on 'avifile@prak.org' mailing list *** (i.e. some misdetection or omitted path)] ) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include ]], [[ QString qa("test") ]])],[ AC_MSG_ERROR([ *** Qt test program compiled, but did not run. This usually means *** that the run-time linker is not finding Qt library or finding the wrong *** version of Qt. If it is not finding Qt, you will need to set your *** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point *** to the installed location Also, make sure you have run ldconfig if that *** is required on your system. *** *** If you have an old version installed, it is best to remove it, although *** you may also be able to get things to work by modifying LD_LIBRARY_PATH *** *** i.e. bash> export LD_LIBRARY_PATH=$ac_qt_libraries:\$LD_LIBRARY_PATH]) ],[ AC_MSG_ERROR([ *** The test program failed to compile or link. See the file config.log for the *** exact error that occured. This usually means Qt was incorrectly installed *** or that you have moved Qt since it was installed. In the latter case, you *** may want to set QTDIR shell variable *** *** Another possibility is you try to link Qt libraries compiled with *** different version of g++. Unfortunately you can not mix C++ libraries *** and object files created with different C++ compiler *** i.e. g++-2.96 libraries and g++-2.95 objects *** The most common case: Some users seems to be downgrading their *** compiler without thinking about consequencies...]) ]) fi CXXFLAGS=$ac_save_QTCXXFLAGS LIBS=$ac_save_QTLIBS AC_LANG_POP ]) qt_version=$ac_cv_qt_version fi if test x$ac_have_qt != xyes; then AC_MSG_WARN([ *** Could not find usable Qt $ac_qt_notfound on your system! *** If it _is_ installed, delete ./config.cache and re-run ./configure, *** specifying path to Qt headers and libraries in configure options. *** Switching off Qt compilation!]) ac_have_qt=no else AC_MSG_RESULT([found $ac_QTNAME version $qt_version, libraries $ac_qt_libraries, headers $ac_qt_includes]) if test $min_qt_version -le $qt_version ; then qt_libraries=$ac_qt_libraries qt_includes=$ac_qt_includes if test "$qt_includes" = "$x_includes" -o -z "$qt_includes" ; then QT_CFLAGS= else QT_CFLAGS="-I$qt_includes" all_includes="$QT_CFLAGS $all_includes" fi QT_CFLAGS="$QT_CFLAGS -DQT_THREAD_SUPPORT" if test "$qt_libraries" = NONE -o "$qt_libraries" = "$x_libraries" -o -z "$qt_libraries" -o "$qt_libraries" = "/usr/lib" ; then QT_LIBS= else QT_LIBS="-L$qt_libraries" all_libraries="$QT_LIBS $all_libraries" fi QT_LIBS="$QT_LIBS -l$ac_QTNAME" if test x$ac_have_qt = xyes ; then AC_PATH_QT_MOC_UIC fi AC_SUBST(qt_version) AC_SUBST(QT_CFLAGS) AC_SUBST(QT_LIBS) else AC_MSG_WARN([ *** Unsupported old version of Qt library found. Please upgrade.]) ac_have_qt=no fi fi if test x$ac_have_qt = xyes ; then ifelse([$2], , :, [$2]) else ifelse([$3], , :, [$3]) fi ]) AC_DEFUN([AC_FIND_ZLIB], [ AC_CACHE_CHECK([for libz], ac_cv_lib_z, ac_save_LIBS=$LIBS LIBS="$LIBS -lz" AC_LINK_IFELSE(AC_LANG_PROGRAM([#include], [return (zlibVersion() == ZLIB_VERSION)]), ac_cv_lib_z=yes, ac_cv_lib_z=no) LIBS=$ac_save_LIBS) if test "$ac_cv_lib_z" = yes; then Z_LIBS="-lz" have_zlib=yes ifelse([$1], , :, [$1]) else Z_LIBS= have_zlib=no ifelse([$2], , :, [$2]) fi AC_SUBST(Z_LIBS) ]) AC_DEFUN([AC_FIND_PNG], [ AC_REQUIRE([AC_FIND_ZLIB]) AC_MSG_CHECKING([for libpng]) AC_CACHE_VAL(ac_cv_lib_png, [ac_save_LIBS="$LIBS" LIBS="$all_libraries -lpng $Z_LIBS -lm -lX11 $LIBSOCKET" AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include]], [[ png_structp png_ptr = png_create_read_struct( // image ptr PNG_LIBPNG_VER_STRING, 0, 0, 0 ); return( png_ptr != 0 ); ]])],[eval "ac_cv_lib_png='-lpng $Z_LIBS -lm'"],[eval "ac_cv_lib_png=no"]) LIBS=$ac_save_LIBS ]) if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then AC_DEFINE_UNQUOTED(HAVE_LIBPNG) LIBPNG="$ac_cv_lib_png" AC_SUBST(LIBPNG) AC_MSG_RESULT($ac_cv_lib_png) else AC_MSG_RESULT(no) LIBPNG="" AC_SUBST(LIBPNG) fi ]) dnl just a wrapper to clean up configure.in AC_DEFUN([KDE_PROG_LIBTOOL], [ AC_REQUIRE([AM_ENABLE_SHARED]) AC_REQUIRE([AM_ENABLE_STATIC]) dnl libtool is only for C, so I must force him dnl to find the correct flags for C++ ac_save_cc=$CC ac_save_cflags="$CFLAGS" CC=$CXX CFLAGS="$CXXFLAGS" dnl AM_PROG_LIBTOOL dnl for libraries CC=$ac_save_cc CFLAGS="$ac_save_cflags" ]) dnl Check for the type of the third argument of getsockname AC_DEFUN([AC_CHECK_KSIZE_T], [AC_MSG_CHECKING(for the third argument of getsockname) AC_LANG([C++]) AC_CACHE_VAL(ac_cv_ksize_t, [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include #include ]], [[ socklen_t a=0; getsockname(0,(struct sockaddr*)0, &a); ]])],[ac_cv_ksize_t=socklen_t],[ac_cv_ksize_t=]) if test -z "$ac_cv_ksize_t"; then ac_save_cxxflags="$CXXFLAGS" if test "$GCC" = "yes"; then CXXFLAGS="-Werror $CXXFLAGS" fi AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include #include ]], [[ int a=0; getsockname(0,(struct sockaddr*)0, &a); ]])],[ac_cv_ksize_t=int],[ac_cv_ksize_t=size_t]) CXXFLAGS=$ac_save_cxxflags fi ]) if test -z "$ac_cv_ksize_t"; then ac_cv_ksize_t=int fi AC_MSG_RESULT($ac_cv_ksize_t) AC_DEFINE_UNQUOTED(ksize_t, $ac_cv_ksize_t) ]) # Search path for a program which passes the given test. # Ulrich Drepper , 1996. # Stephan Kulow: I appended a _KDE against name conflicts dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) AC_DEFUN([AM_PATH_PROG_WITH_TEST_KDE], [# Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) AC_CACHE_VAL(ac_cv_path_$1, [case "[$]$1" in /*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in ifelse([$5], , $PATH, [$5]); do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if [$3]; then ac_cv_path_$1="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" dnl If no 4th arg is given, leave the cache variable unset, dnl so AC_PATH_PROGS will keep looking. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" ]) ;; esac ]) $1="$ac_cv_path_$1" if test -n "[$]$1"; then AC_MSG_RESULT([$]$1) else AC_MSG_RESULT(no) fi AC_SUBST($1)dnl ]) AC_DEFUN([AM_DISABLE_LIBRARIES], [ AC_PROVIDE([AM_ENABLE_STATIC]) AC_PROVIDE([AM_ENABLE_SHARED]) enable_static=no enable_shared=no ]) # Check whether LC_MESSAGES is available in . # Ulrich Drepper , 1995. # # This file can be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU General Public # License or the GNU Library General Public License but which still want # to provide support for the GNU gettext functionality. # Please note that the actual code of the GNU gettext library is covered # by the GNU Library General Public License, and the rest of the GNU # gettext package package is covered by the GNU General Public License. # They are *not* in the public domain. AC_DEFUN([AM_LC_MESSAGES], [ if test $ac_cv_header_locale_h = yes; then AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[return LC_MESSAGES]])],[am_cv_val_LC_MESSAGES=yes],[am_cv_val_LC_MESSAGES=no])]) if test $am_cv_val_LC_MESSAGES = yes; then AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your file defines LC_MESSAGES.]) fi fi ]) dnl AM_PATH_LINUX([DEFAULT-PATH], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl define LINUX_PATH and LINUX_CFLAGS AC_DEFUN([AM_PATH_LINUX], [ AC_ARG_WITH(linux_prefix, [ --with-linux-prefix=PFX where are linux sources [[=/usr/src/linux]]], [], with_linux_prefix=ifelse([$1], [], /usr/src/linux, $1)) if test -f $with_linux_prefix/include/linux/modversions.h ; then LINUX_CFLAGS="-D__KERNEL__ -DMODULE -I$with_linux_prefix/include -include $with_linux_prefix/include/linux/modversions.h" LINUX_PREFIX=$with_linux_prefix else LINUX_CFLAGS="" LINUX_PREFIX="" fi AC_SUBST(LINUX_CFLAGS) AC_SUBST(LINUX_PREFIX) if test -n "$LINUX_PREFIX"; then ifelse([$2], [], [:], [$2]) else ifelse([$3], [], [:], [$3]) fi ]) dnl AC_AVM_CHECK_LIB([NAME], [TEXT], [TEST-TEXT], [ADLIBS], dnl [HEADER], [CODE], [ACTION-m4_toupper([$1])IF-TRUE], [ACTION-IF-FALSE]) dnl advanced macro for testing library presence AC_DEFUN([AC_AVM_CHECK_LIB], [ AC_ARG_WITH($1_prefix, AC_HELP_STRING([--with-$1-prefix=PFX],[$3.]), m4_toupper([$1])_CFLAGS="-I$withval/include";m4_toupper([$1])_LIBS="-L$withval/lib", m4_toupper([$1])_CFLAGS="";m4_toupper([$1])_LIBS="") AC_ARG_ENABLE($1test, [AC_HELP_STRING([--disable-$1test],[do not try to compile and run a $1 test program.])], [], enable_$1test=yes) test "${have_$1+set}" = set || have_$1=yes if test "$have_$1" = yes -a "$enable_$1test" = yes; then ac_save_CFLAGS=$CFLAGS ac_save_LDFLAGS=$LDFLAGS ac_save_LIBS=$LIBS CFLAGS="$CFLAGS $m4_toupper([$1])_CFLAGS" LDFLAGS="$LDFLAGS $m4_toupper([$1])_LIBS" LIBS="$LIBS $4" unset ac_run_ifelse AC_CACHE_CHECK([$2], ac_cv_val_have_$1, [ rm -f conf.$1test ac_run_ifelse=yes AC_RUN_IFELSE(AC_LANG_SOURCE([#include $5 int main() { int ret = 0; $6; system("touch conf.$1test"); return ret; } ]), ac_cv_val_have_$1=yes, ac_cv_val_have_$1=no, [ echo $ac_n "cross compiling; assumed OK... $ac_c" ])]) if test -n "$ac_run_ifelse" -a ! -f conf.$1test; then AC_MSG_WARN([Could not run $1 test program, checking why...]) AC_LINK_IFELSE(AC_LANG_PROGRAM([$5], []), [ AC_MSG_RESULT([*** The test program compiled, but did not run. This usually means *** that the run-time linker is not finding $1 or finding the wrong *** version of $1. If it is not finding $1, you will need to set your *** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point *** to the installed location Also, make sure you have run ldconfig if that *** is required on your system *** *** If you have an old version installed, it is best to remove it, although *** you may also be able to get things to work by modifying LD_LIBRARY_PATH])], [ AC_MSG_RESULT([*** The test program failed to compile or link. See the file config.log for the *** exact error that occured. This usually means $1 was incorrectly installed.])]) fi rm -f conf.$1test CFLAGS=$ac_save_CFLAGS LDFLAGS=$ac_save_LDFLAGS LIBS=$ac_save_LIBS test "$ac_cv_val_have_$1" = no && have_$1=no fi if test "$have_$1" = yes; then m4_toupper([$1])_LIBS="$m4_toupper([$1])_LIBS $4" ifelse([$7], , :, [$7]) else m4_toupper([$1])_CFLAGS="" m4_toupper([$1])_LIBS="" ifelse([$8], , :, [$8]) fi AC_SUBST(m4_toupper([$1])_CFLAGS) AC_SUBST(m4_toupper([$1])_LIBS) ]) dnl AC_IF_YES([TEST-FOR-YES], [ACTION-IF-TRUE], [ACTION-IF-FALSE]) dnl AS_IF() abstraction, checks shell variable for 'yes' AC_DEFUN([AC_IF_YES], [AS_IF([test $$1 = yes], [$2], [$3])]) avifile-0.7.48~20090503.ds/m4/vidix.m40000644000175000017500000000162711110353520015643 0ustar yavoryavor# Configure paths for VIDIX dnl Check if vidix support should be build AC_DEFUN([AM_PATH_VIDIX], [ AC_ARG_ENABLE(vidix, [ --enable-vidix build vidix drivers. [[disabled]]], [], enable_vidix=no) AC_MSG_CHECKING([for vidix]) if test "$enable_vidix" = yes -a "$ac_cv_prog_AWK" != no; then case "$target" in i?86-*-linux* | k?-*-linux* | athlon-*-linux*) enable_vidix=yes enable_linux=yes ;; i386-*-freebsd*) enable_vidix=yes enable_dha_kmod=no ;; *) enable_dha_kmod=no enable_vidix=no ;; esac fi dnl for now without linux kernel support enable_linux=no test "$have_x" = no && enable_vidix=no AC_MSG_RESULT([$enable_vidix]) if test "$enable_vidix" = yes ; then AC_DEFINE(HAVE_VIDIX, 1, [Define if you want to have vidix support.]) fi ]) avifile-0.7.48~20090503.ds/m4/vorbis.m40000644000175000017500000000104411107404735016030 0ustar yavoryavor dnl AM_PATH_VORBIS([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl test for libvorbis dnl defines VORBIS_CFLAGS and VORBIS_LIBS AC_DEFUN([AM_PATH_VORBIS], [ AC_AVM_CHECK_LIB(vorbis, [for vorbis], [where libvorbis is installed], [-lvorbis -lm], [#include ], [], [$1], [$2]) dnl VORBISFILE_LIBS="-lvorbisfile" dnl VORBISENC_LIBS="-lvorbisenc" dnl LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS" dnl VORBISFILE_LIBS="" VORBISENC_LIBS="" dnl AC_SUBST(VORBISFILE_LIBS) dnl AC_SUBST(VORBISENC_LIBS) ]) avifile-0.7.48~20090503.ds/m4/xvid.m40000644000175000017500000000144410745413462015506 0ustar yavoryavor dnl AM_PATH_XVID([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl test for libxvidcore (old version 1.0) dnl defines XVID_CFLAGS and XVID_LIBS AC_DEFUN([AM_PATH_XVID], [ AC_AVM_CHECK_LIB(xvid, [for xvid_init in -lxvidcore], [where old XviD is installed], [-lxvidcore], [ #include #include "xvid.h"], [ XVID_INIT_PARAM xinit; xinit.cpu_flags = 0; xvid_init(NULL, 0, &xinit, NULL); if (xinit.api_version != API_VERSION) { printf("Header file and library are out of sync. Header file supports\n" "version %d.%d API and shared library supports version %d.%d API.\n", API_VERSION >> 16, API_VERSION & 0xFFFF, xinit.api_version >> 16, xinit.api_version & 0xFFFF); ret = 1; }], [$1], [$2]) ]) avifile-0.7.48~20090503.ds/m4/xvid4.m40000644000175000017500000000145010745413462015567 0ustar yavoryavor dnl AM_PATH_XVID([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl test for libxvidcore version 4.0 dnl defines XVID4_CFLAGS and XVID4_LIBS AC_DEFUN([AM_PATH_XVID4], [ AC_AVM_CHECK_LIB(xvid4, [for xvid_global in -lxvidcore (4)], [where XviD4 is installed], [-lxvidcore], [ #include #include #include "xvid.h"], [ xvid_gbl_info_t xinfo; memset(&xinfo, 0, sizeof(xinfo)); xinfo.version = XVID_VERSION; if (xvid_global(NULL, XVID_GBL_INIT, &xinfo, NULL) == XVID_ERR_FAIL) { printf("Header file and library are out of sync. Header file supports\n" "version %d.%d API and shared library supports version %d.%d API.\n", XVID_VERSION >> 16, XVID_VERSION & 0xFFFF, xinfo.version >> 16, xinfo.version & 0xFFFF); ret = 1; }], [$1], [$2]) ]) avifile-0.7.48~20090503.ds/player/0000755000175000017500000000000011267646347015255 5ustar yavoryavoravifile-0.7.48~20090503.ds/player/Makefile.am0000644000175000017500000000163111110536760017272 0ustar yavoryavorEXTRA_DIST = $(pkgdata_DATA) if AMM_USE_QT bin_PROGRAMS = aviplay endif noinst_HEADERS = \ actioncfg.h \ configdialog.h \ configdialog_impl.h \ decoder_config.h \ playercontrol.h aviplay_SOURCES = \ actioncfg.cpp \ main.cpp \ playercontrol.cpp \ decoder_config.cpp \ configdialog.cpp \ configdialog_impl.cpp pkgdata_DATA = \ action.cfg aviplay_LDADD = \ ../libavqt/libqavm.la \ $(QT_LIBS) \ ../lib/libaviplay.la AM_CXXFLAGS = $(VISIBILITYFLAG) AM_CPPFLAGS = $(QT_CFLAGS) $(SDL_CFLAGS) $(X_CFLAGS) \ -I$(top_srcdir)/libavqt \ -DPIXMAP_PATH=\"$(pkgdatadir)/pixmaps\" #SUFFIXES = .moc .ui #%.moc: %.h # $(MOC) < $< > $@ .h.moc: $(MOC) < $< > $@ $(srcdir)/configdialog.cpp: configdialog.moc $(srcdir)/configdialog_impl.cpp: configdialog_impl.moc $(srcdir)/decoder_config.cpp: decoder_config.moc $(srcdir)/playercontrol.cpp: playercontrol.moc CLEANFILES = *.moc MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/player/action.cfg0000644000175000017500000000201207553217600017173 0ustar yavoryavor# # autorepeat_behavior key_name function args # f-fast s-slow n-none s F1 saturation -1 s F2 saturation 1 s F3 contrast -1 s F4 contrast 1 s F5 contrast -1 s F6 contrast 1 s F7 contrast -1 s F8 contrast 1 f LEFT seek_keyframe -1 f RIGHT seek_keyframe 1 f UP seek -60000 f DOWN seek 60000 f PGUP seek -10000 f PGDOWN seek 10000 s [ audio_delay 100 s ] audio_delay -100 s { subtitle_delay 1000 s } subtitle_delay -1000 s KP_PLUS audio_volume 1 s KP_MINUS audio_volume -1 n q quit n m maximize n ESC fullscreen n ALT+ENTER fullscreen f ENTER seek_frame 1 n BACKSPACE seek_frame -1 n m maximize n l open movie n j grab jpg n p pause n c pause n SPACE pause n x play n 1 zoom 50 n 2 zoom 100 n 3 zoom 200 n HOME seek 0 n END seek end n MOUSE_BUTTON_MIDDLE zoom 200 50 100 n MOUSE_BUTTON_LEFT pause_play n MOUSE_BUTTON_RIGHT popup n MOUSE_BUTTON_WHEELUP seek -10000 n MOUSE_BUTTON_WHEELDOWN seek 10000 avifile-0.7.48~20090503.ds/player/actioncfg.cpp0000644000175000017500000000014007547604373017710 0ustar yavoryavor/* static avm_event evn; int ReadEvents(const char* filename) { //fopen return 0; } */ avifile-0.7.48~20090503.ds/player/actioncfg.h0000644000175000017500000000564207547604373017371 0ustar yavoryavor#ifndef ACTIONCFG_H #define ACTIONCFG_H class Actions { public: enum Autorepeat { NONE, SLOW, FAST }; enum State { }; enum Action { ACT_PLAY, ACT_STOP, ACT_PAUSE, ACT_REFRESH, ACT_FULLSCREEN, ACT_MAXIMIZE, }; enum Key { KEY_ESCAPE = 0x1000, // Misc Keys KEY_TAB, KEY_BACKTAB, KEY_BACKSPACE, KEY_RETURN KEY_ENTER, KEY_INSERT, KEY_DELETE, KEY_PAUSE, KEY_PRINT, KEY_SYSREQ, KEY_HOME, // Cursor Movement KEY_END, KEY_LEFT, KEY_UP, KEY_RIGHT, KEY_DOWN, KEY_PAGEUP, KEY_PAGEDOWN, KEY_SHIFT = 0x1020, // Modifiers KEY_CONTROL, KEY_META, KEY_ALT, KEY_CAPSLOCK, KEY_NUMLOCK, KEY_SCROLLLOCK, KEY_F1 = 0x1030, // Function Keys KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12, KEY_SPACE = 0x20, // 7 Bit Printable ASCII KEY_EXCLAM, KEY_QUOTEDBL, KEY_NUMBERSIGN, KEY_DOLLAR, KEY_PERCENT, KEY_AMPERSAND, KEY_APOSTROPHE, KEY_PARENLEFT, KEY_PARENRIGHT, KEY_ASTERISK, KEY_PLUS, KEY_COMMA, KEY_MINUS, KEY_PERIOD, KEY_SLASH, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_COLON, KEY_SEMICOLON, KEY_LESS, KEY_EQUAL, KEY_GREATER, KEY_QUESTION, KEY_AT, KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N, KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, KEY_BRACKETLEFT, KEY_BACKSLASH, KEY_BRACKETRIGHT, KEY_ASCIICIRCUM, KEY_UNDERSCORE, KEY_QUOTELEFT = 0x60, KEY_BRACELEFT = 0x7b, KEY_BAR, KEY_BRACERIGHT, KEY_ASCIITILDE, }; struct { State stateflags; Action action; int arg1; } event; struct { Autorepeat arep; Key key; event e; } eventmap; Actions() {} ~Actions() {} // -1 - no event // 200 - 10 - sleep ms // 0 - no sleep int getEvent(Action& a, int& arg); int insertEvent(Action a, int arg); int insertQtKeyEvent(int modifiers, int qtkey); int insertSdlKeyEvent(int modifiers, int sdlkey); void parseFile(const char* filename); protected: PthreadMutex m_Mutex; qring equeue; int keypressed; } #endif // ACTIONCFG_H avifile-0.7.48~20090503.ds/player/configdialog.cpp0000644000175000017500000003115507637627402020410 0ustar yavoryavor#include "configdialog.h" #include "configdialog.moc" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if QT_VERSION > 300 #include #endif #include const unsigned int ConfigDialog::frequencyList[] = { 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 0 }; #if QT_VERSION <= 220 #define LAYOUTCOL 1 #else #define LAYOUTCOL 0 #endif /* * Constructs a ConfigDialog which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ ConfigDialog::ConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QavmOkDialog( parent, name, modal, fl ), m_pNoDefaultTheme(0), m_pThemeList(0) { setCaption( tr( "Configuration" ) ); #if QT_VERSION > 220 setSizeGripEnabled( TRUE ); #endif #if 0 QFont f( font() ); f.setFamily( "adobe-helvetica" ); f.setPointSize( 15 ); setFont( f ); #endif QTabWidget* tabWidget = new QTabWidget( this ); // ok we don't need this now tabWidget->setTabShape(QTabWidget::Rounded); tabWidget->insertTab( createVideo(tabWidget), tr( "&Video" ) ); tabWidget->insertTab( createAudio(tabWidget), tr( "&Audio" ) ); tabWidget->insertTab( createMisc(tabWidget), tr( "&Misc" ) ); tabWidget->insertTab( createSync(tabWidget), tr( "&Sync" ) ); tabWidget->insertTab( createSubtitles(tabWidget), tr( "S&ubtitles" ) ); tabWidget->insertTab( createDecoder(tabWidget), tr( "&Decoder" ) ); setApplyEnabled( TRUE ); setOkDefault( FALSE ); gridLayout()->addWidget( tabWidget, 0, 0 ); } QWidget* ConfigDialog::createSubtitles(QWidget* parent) { QWidget* w = new QWidget(parent); QVBoxLayout* vl = new QVBoxLayout( w ); vl->setMargin( 5 ); vl->setSpacing( 5 ); QGridLayout* gl = new QGridLayout( vl, 1, 1 ); gl->setSpacing( 5 ); m_pSubFGColor = new QPushButton( tr( " " ), w ); gl->addWidget( m_pSubFGColor, 0, 0 ); QLabel* l = new QLabel( tr( "Foreground" ), w ); gl->addWidget( l, 0, 1 ); m_pSubBGColor = new QPushButton( tr( " " ), w ); gl->addWidget( m_pSubBGColor, 1, 0 ); l = new QLabel( tr( "Background" ), w ); gl->addWidget( l, 1, 1 ); QGroupBox* gb = new QGroupBox( LAYOUTCOL, Qt::Horizontal, tr( "Subtitle font" ), w ); vl->addWidget( gb ); gl = new QGridLayout( gb->layout(), 1, 1 ); gl->setSpacing( 5 ); m_pFontButton = new QPushButton( tr( "Select font..." ), gb ); gl->addWidget(m_pFontButton, 0, 0); m_pFontType = new QLabel( gb ); m_pFontType->setAlignment( QLabel::AlignCenter ); gl->addWidget(m_pFontType, 0, 1); m_pFontName = new QLineEdit( gb ); gl->addMultiCellWidget( m_pFontName, 1, 1, 0, 2 ); gl->setColStretch( 2, 1 ); m_pPreview = new QLabel( tr( "Quick brown fox jumps over the lazy dog." ), gb ); m_pPreview->setAlignment( QLabel::AlignCenter ); #if QT_VERSION > 220 m_pPreview->setFrameShadow( QLabel::Sunken ); m_pPreview->setFrameShape( QLabel::Panel ); #endif gl->addMultiCellWidget( m_pPreview, 2, 2, 0, 2 ); return w; } class DefAudioGroupBox: public QGroupBox { public: DefAudioGroupBox( ConfigDialog& m, QWidget* parent ) : QGroupBox( parent ) { setTitle( tr( "Default audio stream" ) ); setColumnLayout( LAYOUTCOL, Qt::Horizontal ); QHBoxLayout* hl = new QHBoxLayout( layout() ); QLabel* l1 = new QLabel( tr( "Default played audio stream is # " ), this ); hl->addWidget( l1 ); m.m_pDefAudio = new QSpinBox( 0, 127, 1, this ); hl->addWidget( m.m_pDefAudio ); } }; class HttpGroupBox: public QGroupBox { public: HttpGroupBox( ConfigDialog& m, QWidget* parent ) : QGroupBox( parent ) { setTitle( tr( "HTTP proxy" ) ); setColumnLayout( LAYOUTCOL, Qt::Horizontal ); QHBoxLayout* httpb = new QHBoxLayout( layout() ); httpb->setMargin(15); m.m_pUseProxy = new QCheckBox( tr( "Use proxy" ), this ); QFont UseProxy_font( m.m_pUseProxy->font() ); m.m_pUseProxy->setFont( UseProxy_font ); httpb->addWidget( m.m_pUseProxy ); m.m_pProxyName = new QLineEdit( this ); //m_pProxyName->setMinimumSize( m_pProxyName->minimumSizeHint() ); //QFontInfo finfo( f ); //ProxyName->setFixedHeight ( 2 * finfo.pointSize() ); m.m_pProxyName->setEnabled( FALSE ); //ProxyName->setEnabled( TRUE ); httpb->addWidget( m.m_pProxyName ); } }; class RenderingModeGroupBox: public QGroupBox { public: RenderingModeGroupBox( ConfigDialog& m, QWidget* parent ) : QGroupBox( parent ) { //setTitle( tr( "Rendering mode" ) ); setColumnLayout( LAYOUTCOL, Qt::Horizontal ); QVBoxLayout* v = new QVBoxLayout( layout() ); m.m_pHwaccel = new QCheckBox( tr( "Use YUV overlay if available (hw accelerated or sw emulation)" ), this ); m.m_pQualityAuto = new QCheckBox( tr( "Set CPU quality automagicaly (needs buffering)" ), this ); m.m_pVideoDirect = new QCheckBox( tr( "Use direct rendering if possible (scaling disabled without hw accel)" ), this ); m.m_pVideoBuffered = new QCheckBox( tr( "Buffer frames ahead - smoother video, but more CPU intensive" ), this ); m.m_pVideoDropping = new QCheckBox( tr( "Dropping frames" ), this ); m.m_pPreserveAspect = new QCheckBox( tr( "Preserve video aspect ratio" ), this ); v->addWidget( m.m_pHwaccel ); v->addWidget( m.m_pQualityAuto ); v->addWidget( m.m_pVideoDirect ); v->addWidget( m.m_pVideoBuffered ); v->addWidget( m.m_pVideoDropping ); v->addWidget( m.m_pPreserveAspect ); } }; class ResamplingGroupBox: public QGroupBox { public: ResamplingGroupBox( ConfigDialog& m, QWidget* parent ) : QGroupBox( parent ) { setTitle( tr( "Audio resampling" ) ); setColumnLayout( LAYOUTCOL, Qt::Horizontal ); QGridLayout* gl = new QGridLayout( layout(), 1, 1 ); gl->setSpacing(5); m.m_pAudioResampling = new QCheckBox( tr( "&Enable sound resampling" ), this ); gl->addWidget(m.m_pAudioResampling, 1, 0); //m.m_pAudioResamplingRate = new QSpinBox( this, "AudioResamplingRate" ); m.m_pAudioResamplingRate = new QComboBox( this ); #if QT_VERSION > 220 m.m_pAudioResamplingRate->setEditable( true ); #endif // !!!!FIXME - leak - destroy later QValidator* qv = new QIntValidator( 1000, 128000, m.m_pAudioResamplingRate ); m.m_pAudioResamplingRate->setValidator( qv ); gl->addWidget(m.m_pAudioResamplingRate, 2, 0); QLabel* l = new QLabel( tr( "Resampling frequency " ), this ); gl->addWidget( l, 2, 1 ); m.m_pAudioPlayingRate = new QComboBox( this ); for (unsigned int i = 0; m.frequencyList[i]; i++) { m.m_pAudioResamplingRate->insertItem(QString::number(m.frequencyList[i]), i); m.m_pAudioPlayingRate->insertItem(QString::number(m.frequencyList[i]), i); } gl->addWidget(m.m_pAudioPlayingRate, 3, 0); l = new QLabel( tr( "Playing frequency " ), this ); gl->addWidget( l, 3, 1 ); gl->setColStretch( 10, 1 ); /* m.m_pUseProxy = new QCheckBox( this, "UseProxy" ); m.m_pUseProxy->setText( tr( "Use proxy" ) ); QFont UseProxy_font( m.m_pUseProxy->font() ); m.m_pUseProxy->setFont( UseProxy_font ); httpb->addWidget( m.m_pUseProxy ); m.m_pProxyName = new QLineEdit( this, "ProxyName" ); m.m_pProxyName->setEnabled( FALSE ); httpb->addWidget( m.m_pProxyName ); */ } }; #if QT_VERSION >= 300 class ThemeGroupBox: public QGroupBox { public: ThemeGroupBox( ConfigDialog& m, QWidget* parent ) : QGroupBox( parent ) { setTitle( tr( "Theme selector" ) ); setColumnLayout( LAYOUTCOL, Qt::Horizontal ); QGridLayout* gl = new QGridLayout( layout(), 1, 1 ); gl->setSpacing(10); m.m_pNoDefaultTheme = new QCheckBox( tr( "&Use theme" ), this ); gl->addWidget( m.m_pNoDefaultTheme, 0, 0 ); m.m_pThemeList = new QComboBox( this ); QStringList list = QStyleFactory::keys(); list.sort(); m.m_pThemeList->insertStringList( list ); m.m_pThemeList->setEnabled( FALSE ); gl->addWidget( m.m_pThemeList, 0, 1 ); } }; #endif class DecoderGroupBox: public QGroupBox { public: DecoderGroupBox( ConfigDialog& m, QWidget* parent ) : QGroupBox( parent ) { //setTitle( tr( "Rendering mode" ) ); setColumnLayout( LAYOUTCOL, Qt::Horizontal ); QHBoxLayout* vl = new QHBoxLayout( layout() ); m.m_pVideoList = new QListBox( this ); m.m_pVideoList->insertItem( tr( "New Item" ) ); vl->addWidget(m.m_pVideoList); m.m_pAudioList = new QListBox( this ); m.m_pAudioList->insertItem( tr( "New Item" ) ); vl->addWidget(m.m_pAudioList); } }; QWidget* ConfigDialog::createMisc(QWidget* parent) { QWidget* w = new QWidget( parent ); QGridLayout* gl = new QGridLayout( w, 1, 1 ); gl->setMargin(5); gl->setSpacing(5); QGroupBox* gb2 = new HttpGroupBox( *this, w ); gl->addWidget(gb2, 0, 0); // Miscellaneous QGroupBox* gb3 = new QGroupBox( LAYOUTCOL, Qt::Horizontal, tr( "Miscellaneous" ), w ); QVBoxLayout* vl = new QVBoxLayout( gb3->layout() ); vl->setMargin(5); m_pAutorepeat = new QCheckBox( tr( "Auto&replay - restart video when finished" ), gb3 ); vl->addWidget(m_pAutorepeat); m_pDisplayFramePos = new QCheckBox( tr( "D&isplay frame position" ), gb3 ); vl->addWidget(m_pDisplayFramePos); gl->addWidget(gb3, 1, 0); #if QT_VERSION >= 300 QGroupBox* t = new ThemeGroupBox( *this, w ); gl->addWidget(t, 2, 0); #endif gl->setColStretch(10, 1); gl->setRowStretch(10, 1); return w; } QWidget* ConfigDialog::createAudio(QWidget* parent) { QWidget* w = new QWidget(parent); QGridLayout* gl = new QGridLayout( w, 1, 1 ); gl->setMargin(5); gl->setSpacing(5); QGroupBox* gb1 = new DefAudioGroupBox( *this, w ); gl->addWidget(gb1, 0, 0); QGroupBox* gb2 = new ResamplingGroupBox( *this, w ); gl->addWidget(gb2, 1, 0); gl->setColStretch(10, 1); gl->setRowStretch(10, 1); return w; } QWidget* ConfigDialog::createVideo(QWidget* parent) { QWidget* w = new QWidget(parent); QGridLayout* gl = new QGridLayout( w, 1, 1 ); gl->setMargin(5); gl->setSpacing(5); QGroupBox* gb = new RenderingModeGroupBox( *this, w ); gl->addWidget(gb, 0, 0); return w; } QWidget* ConfigDialog::createDecoder(QWidget* parent) { QWidget* w = new QWidget( parent ); QGridLayout* gl = new QGridLayout( w, 1, 1 ); gl->setMargin( 5 ); gl->setSpacing( 5 ); QGroupBox* gb = new DecoderGroupBox( *this, w ); gl->addWidget( gb, 0, 0 ); return w; } QWidget* ConfigDialog::createSync(QWidget* parent) { QWidget* w = new QWidget( parent ); QGridLayout* gl = new QGridLayout( w, 1, 1 ); gl->setMargin( 5 ); gl->setSpacing( 5 ); QGroupBox* gb = new QGroupBox( tr( "Audio/video synch adjustment" ), w ); gb->setColumnLayout( LAYOUTCOL, Qt::Horizontal ); gl->addWidget( gb, 0, 0 ); QHBoxLayout* hl1 = new QHBoxLayout( gb->layout() ); m_pAsyncSlider = new QSlider( -1000, 1000, 10, 0, QSlider::Horizontal, gb ); m_pAsyncSlider->setTickmarks( QSlider::Right ); m_pAsyncSlider->setTickInterval( 60 ); hl1->addWidget(m_pAsyncSlider); hl1->setStretchFactor(m_pAsyncSlider, 16); m_pAsync = new QLabel( gb ); m_pAsync->setAlignment( QLabel::AlignCenter ); hl1->addWidget(m_pAsync); hl1->setStretchFactor(m_pAsync, 3); QGroupBox* sgb = new QGroupBox( tr( "Subtitle synch adjustment" ), w ); sgb->setColumnLayout( LAYOUTCOL, Qt::Horizontal ); gl->addWidget( sgb, 1, 0 ); QHBoxLayout* hl2 = new QHBoxLayout( sgb->layout() ); hl2->setSpacing( 5 ); m_pSubNegative = new QCheckBox( tr( "Negative" ), sgb ); hl2->addWidget( m_pSubNegative ); m_pSubAsyncMin = new QSpinBox( 0, 999, 1, sgb ); hl2->addWidget( m_pSubAsyncMin ); QLabel* l = new QLabel( tr( "minutes" ), sgb ); l->setAlignment( QLabel::AlignCenter ); hl2->addWidget( l ); m_pSubAsyncSec = new QSpinBox( 0, 59, 1, sgb ); hl2->addWidget( m_pSubAsyncSec ); l = new QLabel( tr( "seconds" ), sgb ); l->setAlignment( QLabel::AlignCenter ); hl2->addWidget( l ); gl->setRowStretch(2, 1); gl->setColStretch(1, 1); return w; } /* * Main event handler. Reimplemented to handle application * font changes */ bool ConfigDialog::event( QEvent* ev ) { bool ret = QDialog::event( ev ); #if QT_VERSION > 220 if ( ev->type() == QEvent::ApplicationFontChange ) { QFont CheckBox1_font( m_pSubNegative->font() ); m_pSubNegative->setFont( CheckBox1_font ); QFont UseProxy_font( m_pUseProxy->font() ); m_pUseProxy->setFont( UseProxy_font ); } #endif return ret; } avifile-0.7.48~20090503.ds/player/configdialog.h0000644000175000017500000000341311173313503020031 0ustar yavoryavor#ifndef CONFIGDIALOG_H #define CONFIGDIALOG_H #include "okdialog.h" class QVBoxLayout; class QHBoxLayout; class QGridLayout; class QCheckBox; class QComboBox; class QGroupBox; class QLabel; class QLineEdit; class QListBox; class QPushButton; class QSlider; class QSpinBox; class ConfigDialog : public QavmOkDialog { Q_OBJECT; public: static const unsigned int frequencyList[]; ConfigDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 ); //QSpinBox* m_pAudioResamplingRate; QComboBox* m_pAudioResamplingRate; QComboBox* m_pAudioPlayingRate; QCheckBox* m_pAudioResampling; QCheckBox* m_pAutorepeat; QCheckBox* m_pHwaccel; QCheckBox* m_pPreserveAspect; QCheckBox* m_pQualityAuto; QCheckBox* m_pDisplayFramePos; QCheckBox* m_pVideoBuffered; QCheckBox* m_pVideoDirect; QCheckBox* m_pVideoDropping; QCheckBox* m_pUseProxy; QCheckBox* m_pNoDefaultTheme; QLabel* m_pAsync; QLabel* m_pFontType; QLabel* m_pPreview; QLineEdit* m_pFontName; QLineEdit* m_pProxyName; QPushButton* m_pFontButton; QPushButton* m_pSubFGColor; QPushButton* m_pSubBGColor; QCheckBox* m_pSubWrap; QCheckBox* m_pSubEnabled; QSlider* m_pAsyncSlider; QSpinBox* m_pDefAudio; QSpinBox* m_pSubAsyncMin; QSpinBox* m_pSubAsyncSec; QCheckBox* m_pSubNegative; QListBox* m_pVideoList; QListBox* m_pAudioList; QComboBox* m_pThemeList; protected: bool event( QEvent* ); QWidget* createAudio(QWidget* parent); QWidget* createMisc(QWidget* parent); QWidget* createSubtitles(QWidget* parent); QWidget* createSync(QWidget* parent); QWidget* createVideo(QWidget* parent); QWidget* createDecoder(QWidget* parent); }; #endif // CONFIGDIALOG_H avifile-0.7.48~20090503.ds/player/configdialog_impl.cpp0000644000175000017500000003315611174014310021407 0ustar yavoryavor#include "configdialog_impl.h" #include "configdialog_impl.moc" #include "playercontrol.h" #include "aviplay.h" #include "avm_creators.h" #define DECLARE_REGISTRY_SHORTCUT #include "configfile.h" #undef DECLARE_REGISTRY_SHORTCUT #include #include #include #include #include #include #include #include #include #include #include #include #include ConfigDialog_impl::ConfigDialog_impl(PlayerControl* control) : ConfigDialog(0, "Configuration", true), m_pControl(control), itemLast(0), m_bFontChanged(false), m_bAudioChanged(false), m_bVideoChanged(false) { char* fs = 0; char* http_proxy = 0; unsigned int audio_resampling_rate; int subtitle_async; unsigned int rate; bool audio_resampling; bool use_yuv; bool use_http_proxy; bool autorepeat; bool quality_auto; bool preserve_aspect; bool display_frame_pos; bool video_buffered; bool video_direct; bool video_dropping; avm::IAviPlayer* p = m_pControl->getPlayer(); // shortcut p->Get(p->ASYNC_TIME_MS, &m_iAsyncOriginal, p->SUBTITLE_FONT, &fs, p->SUBTITLE_ASYNC_TIME_MS, &subtitle_async, p->AUDIO_STREAM, &m_iAudioStreamOriginal, p->HTTP_PROXY, &http_proxy, p->USE_HTTP_PROXY, &use_http_proxy, p->USE_YUV, &use_yuv, p->AUDIO_RESAMPLING, &audio_resampling, p->AUDIO_RESAMPLING_RATE, &audio_resampling_rate, p->AUDIO_PLAYING_RATE, &rate, p->AUTOREPEAT, &autorepeat, p->VIDEO_QUALITY_AUTO, &quality_auto, p->VIDEO_PRESERVE_ASPECT, &preserve_aspect, p->DISPLAY_FRAME_POS, &display_frame_pos, p->VIDEO_BUFFERED, &video_buffered, p->VIDEO_DIRECT, &video_direct, p->VIDEO_DROPPING, &video_dropping, 0); m_iSubAsyncOriginal = subtitle_async; m_pAsyncSlider->setValue(m_iAsyncOriginal / 10); onAsyncValChanged(0); if (fs) { char* n = strstr(fs, ":qtfont="); m_pFontName->setText( (n) ? n + 8 : fs ); free(fs); } onFontChanged(); m_bFontChanged = false; if (subtitle_async < 0) { m_pSubNegative->setChecked( true ); subtitle_async *= -1; } else m_pSubNegative->setChecked( false ); subtitle_async /= 1000; m_pSubAsyncMin->setValue( subtitle_async / 60 ); m_pSubAsyncSec->setValue( subtitle_async % 60 ); m_pDefAudio->setValue( m_iAudioStreamOriginal ); if (http_proxy) { if (strlen(http_proxy) > 0) m_pProxyName->setText( http_proxy ); free(http_proxy); } if (use_http_proxy) { m_pUseProxy->setChecked(true); m_pProxyName->setEnabled(true); } m_pHwaccel->setChecked(use_yuv); #if QT_VERSION >= 300 QString usedefth = RS("theme", "default"); m_pNoDefaultTheme->setChecked( (usedefth != "default") ); m_pThemeList->setEnabled( m_pNoDefaultTheme->isChecked() ); m_pThemeList->setCurrentText( usedefth.ascii() ); #endif #if QT_VERSION > 220 QString b; b.sprintf("%d", audio_resampling_rate); m_pAudioResamplingRate->lineEdit()->setText(b); #else for (unsigned i = 0; frequencyList[i]; i++) if (audio_resampling_rate <= frequencyList[i]) m_pAudioResamplingRate->setCurrentItem(i); #endif for (unsigned i = 0; frequencyList[i]; i++) if (frequencyList[i] == rate) { m_pAudioPlayingRate->setCurrentItem(i); break; } m_pAudioResampling->setChecked(audio_resampling); onAudioResamplingToggled(); m_pAutorepeat->setChecked(autorepeat); m_pQualityAuto->setChecked(quality_auto); m_pPreserveAspect->setChecked(preserve_aspect); m_pDisplayFramePos->setChecked(display_frame_pos); m_pVideoBuffered->setChecked(video_buffered); m_pVideoDirect->setChecked(video_direct); m_pVideoDropping->setChecked(video_dropping); avm::StreamInfo* si = p->GetVideoStreamInfo(); fourcc_t fcc = (si) ? si->GetFormat() : avm::CodecInfo::ANY; delete si; avm::vector infos; avm::CodecInfo::Get(infos, avm::CodecInfo::Video, avm::CodecInfo::Decode, fcc); int sel=0; m_pVideoList->clear(); avm::vector::iterator it; for (it = infos.begin(); it != infos.end(); it++) m_pVideoList->insertItem((*it)->GetName()); si = p->GetAudioStreamInfo(); fcc = (si) ? si->GetFormat() : avm::CodecInfo::ANY; delete si; infos.clear(); avm::CodecInfo::Get(infos, avm::CodecInfo::Audio, avm::CodecInfo::Decode, fcc); m_pAudioList->clear(); for (it = infos.begin(); it != infos.end(); it++) m_pAudioList->insertItem((*it)->GetName()); connect(m_pAsyncSlider, SIGNAL(valueChanged(int)), this, SLOT(onAsyncValChanged(int))); connect(m_pSubAsyncMin, SIGNAL(valueChanged(int)), this, SLOT(onSubAsyncValChanged(int))); connect(m_pSubAsyncSec, SIGNAL(valueChanged(int)), this, SLOT(onSubAsyncValChanged(int))); connect(m_pUseProxy, SIGNAL(clicked()), this, SLOT(onProxyToggled())); connect(m_pAudioResampling, SIGNAL(clicked()), this, SLOT(onAudioResamplingToggled())); connect(m_pFontButton, SIGNAL(clicked()), this, SLOT(onFont())); connect(m_pSubBGColor, SIGNAL(clicked()), this, SLOT(onBGColor())); connect(m_pSubFGColor, SIGNAL(clicked()), this, SLOT(onFGColor())); connect(m_pDefAudio, SIGNAL(valueChanged(int)), this, SLOT(onAudioStreamChanged(int))); connect(m_pFontName, SIGNAL(returnPressed()), this, SLOT(onFontChanged())); //connect(m_pVideoList, SIGNAL(selectionChanged(QListBoxItem*)), this, SLOT(onSelectionChanged(QListBoxItem*))); #if QT_VERSION > 220 connect(m_pVideoList, SIGNAL(currentChanged(QListBoxItem*)), this, SLOT(onSelectionChanged(QListBoxItem*))); connect(m_pVideoList, SIGNAL(pressed(QListBoxItem*)), this, SLOT(onListPressed(QListBoxItem*))); connect(m_pVideoList, SIGNAL(clicked(QListBoxItem*)), this, SLOT(onListClicked(QListBoxItem*))); connect(m_pAudioList, SIGNAL(currentChanged(QListBoxItem*)), this, SLOT(onSelectionChanged(QListBoxItem*))); connect(m_pAudioList, SIGNAL(pressed(QListBoxItem*)), this, SLOT(onListPressed(QListBoxItem*))); connect(m_pAudioList, SIGNAL(clicked(QListBoxItem*)), this, SLOT(onListClicked(QListBoxItem*))); #endif #if QT_VERSION >= 300 connect(m_pNoDefaultTheme, SIGNAL(clicked()), this, SLOT(onNoDefaultTheme())); #endif // 3.0 //connect(m_pVideoList, SIGNAL(mouseButtonPressed(int, QListBoxItem*, const QPOint&)), this, // SLOT(onMouseButtonPressed(int, QListBoxItem*, const QPOint& ))); } void ConfigDialog_impl::onSelectionChanged(QListBoxItem* item) { if (m_Mutex.TryLock() < 0) return; //printf("ONSEL %p last: %p\n", item, itemLast); if (itemLast) { QListBox* lb = item->listBox(); int i = lb->index(item); int ilast = lb->index(itemLast); //printf("ONSEL locked %d <-> %d\n", i, ilast); if (i >= 0 && ilast >= 0 && labs(i - ilast) < 2) { QString t = item->text(); QString tlast = itemLast->text(); // swap two items //printf("swap %s %s\n idx1 %d idx2 %d\n", t.ascii(), tlast.ascii(), i, ilast); lb->changeItem(tlast, i); lb->changeItem(t, ilast); //printf("New itemLast %p\n", itemLast); itemLast = lb->item(i); if (lb == m_pAudioList) m_bAudioChanged = true; else if (lb == m_pVideoList) m_bVideoChanged = true; } } m_Mutex.Unlock(); } void ConfigDialog_impl::onListPressed(QListBoxItem* item) { //printf("onlistpressed\n"); itemLast = item;//(!itemLast) ? item : 0; } void ConfigDialog_impl::onListClicked(QListBoxItem* item) { //printf("onlistclicked\n"); itemLast = 0; } void ConfigDialog_impl::onMouseButtonPressed(int button, QListBoxItem* item, const QPoint& pos) { printf("Onmouse %d %s\n", button, item->text().ascii()); } void ConfigDialog_impl::onProxyToggled() { m_pProxyName->setEnabled(m_pUseProxy->isChecked()); } void ConfigDialog_impl::onAudioResamplingToggled() { bool s = m_pAudioResampling->isChecked(); m_pAudioResamplingRate->setEnabled(s); m_pAudioPlayingRate->setEnabled(s); } void ConfigDialog_impl::onNoDefaultTheme() { m_pThemeList->setEnabled( m_pNoDefaultTheme->isChecked() ); } void ConfigDialog_impl::apply() { avm::IAviPlayer* p = m_pControl->getPlayer(); #if QT_VERSION >= 300 if (m_pNoDefaultTheme->isChecked()) { qApp->setStyle( m_pThemeList->currentText() ); WS("theme", m_pThemeList->currentText()); } else WS("theme", "default"); #endif if (m_bFontChanged) { QString raw = m_defFont.rawName(); if (raw.find('-') == -1) { raw = m_defFont.family(); QString s; //encoding=iso10646-1: s.sprintf("-%d:weight=", m_defFont.pointSize()); raw += s; int w = m_defFont.weight(); if (w <= 25) raw += "light"; else if (w <= 50) raw += "medium"; else if (w <= 63) raw += "demibold"; else if (w <= 75) raw += "bold"; else raw += "black"; if (m_defFont.italic()) raw += ":slant=italic"; else raw += ":slant=roman"; } #if QT_VERSION >= 300 raw += ":qtfont="; raw += m_defFont.toString(); #endif p->Set(p->SUBTITLE_FONT, raw.ascii(), 0); } QString vcodecs; for (unsigned i = 0; i < m_pVideoList->count(); ++i) { if (!vcodecs.isEmpty()) vcodecs += ","; vcodecs += m_pVideoList->text(i); } QString acodecs; for (unsigned i = 0; i < m_pAudioList->count(); i++) { if (!acodecs.isEmpty()) acodecs += ","; acodecs += m_pAudioList->text(i); } m_iAsyncOriginal = m_pAsyncSlider->value() * 10; int sub_async = m_pSubAsyncMin->value()*60 + m_pSubAsyncSec->value(); sub_async *= (m_pSubNegative->isChecked()) ? -1000 : 1000; m_iSubAsyncOriginal = sub_async; p->Set(p->ASYNC_TIME_MS, m_iAsyncOriginal, p->SUBTITLE_ASYNC_TIME_MS, sub_async, p->USE_YUV, m_pHwaccel->isChecked(), p->AUDIO_STREAM, m_pDefAudio->value(), p->AUDIO_RESAMPLING, m_pAudioResampling->isChecked(), p->AUDIO_RESAMPLING_RATE, #if QT_VERSION > 220 atoi(m_pAudioResamplingRate->lineEdit()->text().ascii()), #else frequencyList[m_pAudioResamplingRate->currentItem()], #endif p->AUDIO_PLAYING_RATE, frequencyList[m_pAudioPlayingRate->currentItem()], p->USE_HTTP_PROXY, m_pUseProxy->isChecked(), p->HTTP_PROXY, m_pProxyName->text().ascii(), p->DISPLAY_FRAME_POS, m_pDisplayFramePos->isChecked(), p->AUTOREPEAT, m_pAutorepeat->isChecked(), p->VIDEO_PRESERVE_ASPECT, m_pPreserveAspect->isChecked(), p->VIDEO_QUALITY_AUTO, m_pQualityAuto->isChecked(), p->VIDEO_BUFFERED, m_pVideoBuffered->isChecked(), p->VIDEO_DIRECT, m_pVideoDirect->isChecked(), p->VIDEO_DROPPING, m_pVideoDropping->isChecked(), 0); if (m_bVideoChanged) p->Set(p->VIDEO_CODECS, vcodecs.ascii(), 0); if (m_bAudioChanged) p->Set(p->AUDIO_CODECS, acodecs.ascii(), 0); m_pControl->setDisplayFramePos(m_pDisplayFramePos->isChecked()); m_bVideoChanged = m_bAudioChanged = m_bFontChanged = false; } void ConfigDialog_impl::accept() { apply(); ConfigDialog::accept(); } void ConfigDialog_impl::reject() { avm::IAviPlayer* p; m_pAsyncSlider->setValue( m_iAsyncOriginal / 10 ); m_pDefAudio->setValue( m_iAudioStreamOriginal ); if ((p = m_pControl->getPlayer())) p->Set(p->SUBTITLE_ASYNC_TIME_MS, m_iSubAsyncOriginal, 0); ConfigDialog::reject(); } void ConfigDialog_impl::onAsyncValChanged(int) { avm::IAviPlayer* p; QString t; float value = (float)m_pAsyncSlider->value() / 100.f; m_pAsync->setText(t.sprintf("%2.2f s", value)); if ((p = m_pControl->getPlayer())) p->Set(p->ASYNC_TIME_MS, int(value * 1000), 0); } void ConfigDialog_impl::onSubAsyncValChanged(int) { avm::IAviPlayer* p = m_pControl->getPlayer(); if (p) { int sub_async = m_pSubAsyncMin->value() * 60 + m_pSubAsyncSec->value(); sub_async *= (m_pSubNegative->isChecked()) ? -1000 : 1000; p->Set(p->SUBTITLE_ASYNC_TIME_MS, sub_async, 0); } } void ConfigDialog_impl::onAudioStreamChanged(int) { avm::IAviPlayer* p = m_pControl->getPlayer(); if (p) p->Set(p->AUDIO_STREAM, m_pDefAudio->value(), 0); } void ConfigDialog_impl::onFont() { bool isOk; QFont font = QFontDialog::getFont(&isOk, m_defFont, this, "Select font"); #if QT_VERSION >= 300 //printf("WITH FONT:%s\nWITH RAW:%s\n", font.toString().ascii(), font.rawName().ascii()); //printf("Family %s size: %d bold: %d\n", m_defFont.family().ascii(), m_defFont.pointSize(), m_defFont.bold()); #endif if (isOk) { //printf("QFONT %s\n>>> %s\n", font.toString().ascii(), font.rawName().ascii()); QString s = font.rawName().ascii(); #if QT_VERSION >= 300 if (s[0] != '-') s = font.toString().ascii(); #endif m_pFontName->setText( s ); onFontChanged(); } } void ConfigDialog_impl::onBGColor() { QColor color = QColorDialog::getColor(QColor(0, 0, 0)); } void ConfigDialog_impl::onFGColor() { #if QT_VERSION >= 300 QRgb color = QColorDialog::getRgba(0); #else QColor color = QColorDialog::getColor(QColor(0, 0, 0)); #endif } void ConfigDialog_impl::onFontChanged() { QString s = m_pFontName->text(); #if QT_VERSION >= 300 if (s[0] != '-') m_defFont.fromString( s ); else #endif m_defFont.setRawName( s ); //printf("ONFONTCHANGE %s\n", s.ascii()); if (!m_defFont.family().isNull()) s = m_defFont.family(); int i = s.find(':'); if (i != -1) s[i] = 0; if (s.isEmpty()) s = "default"; QString str; s += str.sprintf(", %d pt", m_defFont.pointSize()); if (m_defFont.bold()) s += ", bold"; if (m_defFont.italic()) s += ", italic"; m_pFontType->setText( str ); m_pPreview->setFont( m_defFont ); m_bFontChanged = true; update(); } avifile-0.7.48~20090503.ds/player/configdialog_impl.h0000644000175000017500000000225607767630046021100 0ustar yavoryavor#ifndef CONFIGDIALOG_IMPL_H #define CONFIGDIALOG_IMPL_H #include "configdialog.h" #include "avm_locker.h" class QListBoxItem; class PlayerControl; class QListBoxItem; class ConfigDialog_impl : public ConfigDialog { Q_OBJECT; public: ConfigDialog_impl(PlayerControl*); public slots: virtual void accept(); virtual void reject(); virtual void apply(); void onAsyncValChanged(int); void onSubAsyncValChanged(int); void onAudioResamplingToggled(); void onNoDefaultTheme(); void onAudioStreamChanged(int); void onBGColor(); void onFGColor(); void onFont(); void onFontChanged(); void onProxyToggled(); void onSelectionChanged(QListBoxItem*); void onListPressed(QListBoxItem*); void onListClicked(QListBoxItem*); void onMouseButtonPressed(int, QListBoxItem*, const QPoint&); private: PlayerControl* m_pControl; QFont m_defFont; QListBoxItem* itemLast; avm::PthreadMutex m_Mutex; // copy of properties int m_iAsyncOriginal; int m_iSubAsyncOriginal; int m_iAudioStreamOriginal; bool m_bFontChanged; bool m_bAudioChanged; bool m_bVideoChanged; }; #endif // CONFIGDIALOG_IMPL_H avifile-0.7.48~20090503.ds/player/decoder_config.cpp0000644000175000017500000001114311174014423020670 0ustar yavoryavor#include "decoder_config.h" #include "decoder_config.moc" #include "playercontrol.h" #include "avm_creators.h" #include "videodecoder.h" #include "renderer.h" #include "avm_except.h" #include #include #include #include #include #ifndef Qt4 #include #else #include #endif #include QConfDialog::QConfDialog(const avm::vector& _attrs) :QDialog(0, "", true), attrs(_attrs) { #if QT_VERSION > 220 setSizeGripEnabled( TRUE ); #endif QVBoxLayout *top_vbl = new QVBoxLayout(this, 5); top_vbl->setSpacing(2); //m_pTabAttr = new QListView( gb ); sliders.resize(attrs.size()); original.resize(attrs.size()); for (size_t i = 0; i < attrs.size(); ++i) { sliders[i] = 0; if (attrs[i].kind == avm::AttributeInfo::Integer) { if (attrs[i].i_min + 0 >= attrs[i].i_max) continue;//integers with unlimited values //and boolean attributes are not supported QGroupBox* box = new QGroupBox( this ); box->setTitle( attrs[i].GetAbout() ); box->setColumnLayout( #if QT_VERSION > 220 0, #else 1, // there is bug and 0 doesn't work #endif Qt::Vertical ); top_vbl->addWidget(box); QVBoxLayout *box_vbl = new QVBoxLayout( box->layout() ); int pgs = 1; if (attrs[i].i_max - attrs[i].i_min > 20) pgs = (attrs[i].i_max - attrs[i].i_min) / 10; QSlider* slider = new QSlider( attrs[i].i_min, attrs[i].i_max, pgs, 0, QSlider::Horizontal, box ); #if QT_VERSION > 220 slider->setLineStep(1); #endif sliders[i] = slider; box_vbl->addWidget(slider); slider->setTickmarks(QSlider::Both); QGridLayout *box_hbl = new QGridLayout( box_vbl, 1, 1 ); char txt[100]; sprintf(txt, "%d", attrs[i].i_min); QLabel* label = new QLabel( txt, box ); box_hbl->addWidget(label, 0, 0); sprintf(txt, "%d", attrs[i].i_max); label = new QLabel( txt, box ); box_hbl->setColStretch(1, 1); box_hbl->addWidget(label, 0, 2); } //other types of atributes are not supported } top_vbl->addStretch(1); QHBox* hbox = new QHBox(this); top_vbl->addWidget(hbox); QPushButton* b_ok = new QPushButton( tr( "&Ok" ), hbox ); b_ok->setDefault( TRUE ); QPushButton* b_reset = new QPushButton( tr ( "&Reset" ), hbox ); QPushButton* b_cancel = new QPushButton( tr( "&Cancel" ), hbox ); connect( b_ok, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( b_reset, SIGNAL( clicked() ), this, SLOT( reset() ) ); connect( b_cancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); } void QConfDialog::reject() { // restore original values & reject for (size_t i = 0; i < attrs.size(); ++i) if (sliders[i] && (original[i] != sliders[i]->value())) sliders[i]->setValue(original[i]); return QDialog::reject(); } void QConfDialog::reset() { for (size_t i = 0; i < attrs.size(); ++i) if (sliders[i]) sliders[i]->setValue(attrs[i].GetDefault()); } QCodecConf::QCodecConf( const avm::CodecInfo& _info, avm::IRtConfig* _rt ) : QConfDialog( _rt ? _rt->GetAttrs() : _info.decoder_info ), info(_info), rt(_rt) { setCaption( tr( "Decoder configuration" ) ); for (unsigned i = 0; i < attrs.size(); i++) { int val = 0; if (rt) rt->GetValue(attrs[i].GetName(), &val); else avm::CodecGetAttr(info, attrs[i].GetName(), &val); if (sliders[i]) { sliders[i]->setValue(val); // so we have arrays of the same length original[i] = val; if (rt) connect(sliders[i], SIGNAL(valueChanged(int)), this, SLOT(valueChanged(int))); } } } void QCodecConf::valueChanged(int) { for (size_t i = 0; i < attrs.size(); ++i) if (sliders[i]) { int v = sliders[i]->value(); if (rt) rt->SetValue(attrs[i].GetName(), v); // store to registers avm::CodecSetAttr(info, attrs[i].GetName(), v); } } #define __MODULE__ "RendererConfig" QRendererConf::QRendererConf( const avm::vector& _attrs, avm::IRtConfig* _rt ) : QConfDialog( _attrs ), rt(_rt) { if (!rt) throw FATAL("Missing IRtConfig"); setCaption( tr( "Renderer configuration" ) ); for (size_t i = 0; i < attrs.size(); ++i) { if (sliders[i]) { int val = 0; rt->GetValue(attrs[i].GetName(), &val); original[i] = val; sliders[i]->setValue(val); connect(sliders[i], SIGNAL(valueChanged(int)), this, SLOT(valueChanged(int))); } } } void QRendererConf::valueChanged(int) { for (size_t i = 0; i < attrs.size(); ++i) if (sliders[i]) rt->SetValue(attrs[i].GetName(), sliders[i]->value()); } avifile-0.7.48~20090503.ds/player/decoder_config.h0000644000175000017500000000175007664346037020362 0ustar yavoryavor#ifndef DECODER_CONFIG_H #define DECODER_CONFIG_H #include #include #include class QSlider; class QConfDialog: public QDialog { Q_OBJECT; public: QConfDialog(const avm::vector&); public slots: virtual void reset(); virtual void reject(); virtual void valueChanged(int) = 0; protected: const avm::vector& attrs; avm::vector sliders; avm::vector original; }; class QCodecConf: public QConfDialog { Q_OBJECT; public: QCodecConf(const avm::CodecInfo&, avm::IRtConfig* _rt=0); public slots: virtual void valueChanged(int); protected: const avm::CodecInfo& info; avm::IRtConfig* rt; }; class QRendererConf: public QConfDialog { Q_OBJECT; public: QRendererConf(const avm::vector&, avm::IRtConfig* _rt=0); public slots: virtual void valueChanged(int); protected: avm::IRtConfig* rt; }; #endif //DECODER_CONFIG_H avifile-0.7.48~20090503.ds/player/main.cpp0000644000175000017500000001217411165103660016671 0ustar yavoryavor/******************************************************** AVI player Copyright 2000 Eugene Kuznetsov (divx@euro.ru) *********************************************************/ #include "playercontrol.h" #include "version.h" #include "avm_args.h" #include "avm_output.h" #include "avm_except.h" #include "configfile.h" #include #include #include #include #include #include #include #ifdef __FreeBSD__ #include #endif #ifdef __NetBSD__ #include #endif #include #include // atoi #include PlayerControl *m; extern void killer(int); extern const char* g_pcProgramName; int main(int argc, char* argv[]) { #if defined(__FreeBSD__) || defined(__NetBSD__) fpsetmask(fpgetmask() & ~(FP_X_DZ|FP_X_INV)); #endif if (GetAvifileVersion() != AVIFILE_VERSION) { fprintf(stderr, "This binary was compiled for Avifile ver. %x " ", but the library is ver. %x.\nAborting...\n", GetAvifileVersion(), AVIFILE_VERSION); return 0; } char* acodec = 0; char* vcodec = 0; char* subname = 0; AviPlayerInitParams apip; apip.x = apip.y = 0x7fffffff; const avm::Args::Option sizesubopts[] = { avm::ARGSOPTION("i", "width", "w", "window width", &apip.width, 8, 8192), avm::ARGSOPTION("i", "height", "h", "window height", &apip.height, 2, 8192), avm::ARGSOPTION("i", "x", "x", "window position x", &apip.x, -8192, 8192), avm::ARGSOPTION("i", "y", "y", "window position y", &apip.y, -8192, 8192), avm::ARGSOPTION("#",,,) }; const avm::Args::Option opts[] = { avm::ARGSOPTION("b", "auto", "a", "use autoquality for postprocessing", &apip.quiet), avm::ARGSOPTION("o", "size", "s", "set windows size", &sizesubopts), avm::ARGSOPTION("d", "seek", "", "seek to given position", &apip.seek), avm::ARGSOPTION("c", "video-codec", "vc", "preferred video codec (use help for select)", &vcodec), avm::ARGSOPTION("c", "audio-codec", "ac", "preferred audio codec (use help for select)", &acodec), //avm::ARGSOPTION("i", "shift", "", "shift frame buffer by <%d> bytes [%d, %d]", &shift, -8192, 8192), //avm::ARGSOPTION("b", "nogui", "", "start playing without gui", &apip.nogui), avm::ARGSOPTION("b", "fullscreen", "f", "start playing in fullscreen", &apip.fullscreen), avm::ARGSOPTION("b", "maximize", "m", "start playing in maximized", &apip.maximize), avm::ARGSOPTION("b", "quiet", "q", "be quiet", &apip.quiet), avm::ARGSOPTION("s", "subtitle", "sub", "subtitle filename", &subname), //{ "b", "verbose", "t", "be verbose", &verbose), //{ "b", "version", "v", "show version"), avm::ARGSOPTION("c", "codec", "c", "use with help for more info"), avm::ARGSOPTION("h",,,), avm::ARGSOPTION("O",,,, avm::IAviPlayer::getOptions()), avm::ARGSOPTION("#",,,) }; int rc=0; // remote control support over stdin/stdout avm::Args(opts, &argc, argv, " [options] [

Usage:

" "aviplay [options] [your-file(s)]
" "

Key bindings:

" "Cursor left/right - previous/next keyframe.
" "Cursor up/down - 60 seconds backward/forward.
" "PageUp/PageDown - 10 seconds backward/forward.
" "Enter/Backspace - display next/previous(slow!) frame.
" "Home/End - movie begin/end.
" "Back, Insert, < / >, Delete, Forward - previous/next file. (if more files given)
" "Keypad '+', 9/0, Keypad'-' - volume up/down.
" "F, Escape, Alt + Enter - toggles fullscreen/windowed mode.
" "M - toggles fullscreen/windowed mode with maximization.
" "N - swith to next audio stream (if available).
" "Q - quit
" "X - stop
" "V - play
" "[ / ] - adjust A-V sync by 0.1 second.
" "C, P, Space - pause
" "1, 2, 3 - switch zoom 0.5x, 1x, 2x.
" "Left-click in player window - pause/play.
" "Right-click in movie window brings up zoom/fullscreen menu.
" "F1/F2, F5/F6, F7/F8, F9/F10 - set Saturation, Brightness, Hue, Contrast.
" //"Double-click in player window when paused/stopped " //"to bring up configuration menu.
" ), QMessageBox::Ok ); } void PlayerControl::about() { QMessageBox::information( 0, tr( "aviplay about" ), tr( "aviplay version: %1
" "(C) 2000 - 2009 Zdenek Kabelác, Eugene Kuznetsov
" "Based on avifile ( http://avifile.sourceforge.net/).
" "Distributed under the GNU Public Licence (GPL) version 2.
" "Special thanks to: " "
    " "
  • Authors of ffmpeg project." "
  • Authors of Wine project for Win32 DLL loading code." "
  • Avery Lee for AVI and ASF parser and his VirtualDub." "
  • Hiroshi Yamashita for porting sources to FreeBSD." "
  • Jürgen Keil for porting sources to Solaris 8 x86." "
  • Árpád Gereöffy (A'rpi/ESP-team) and the rest of Mplayer team." "
  • All people from avifile mailing lists for their patience and support." "
" ).arg( AVIFILE_BUILD ), QMessageBox::Ok ); } void PlayerControl::dropEvent(QDropEvent* e) { QStrList i; QUriDrag::decode(e, i); const char* uri = i.first(); if (!uri || strlen(uri) < 6) return; QString file; if (0 == qstrnicmp(uri,"file:/",6) ) { uri += 6; if ( uri[0] != '/' || uri[1] == '/' ) { // It is local. file = QUriDrag::uriToUnicodeUri(uri); if ( (uri[1] == '/') && (uri[0]=='/') ) file.remove(0,1); else file.insert(0,'/'); apip.urls.push_back((const char*)file.ascii()); initPlayer(apip); } } } void PlayerControl::dragEnterEvent(QDragEnterEvent* e) { e->accept(QUriDrag::canDecode(e)); } void PlayerControl::hideSlot() { m_pTimer->stop(); updatePos(); } void PlayerControl::showSlot() { updatePos(); m_pTimer->start(1000); // updatepos timer } avifile-0.7.48~20090503.ds/player/playercontrol.h0000644000175000017500000001603211173435740020312 0ustar yavoryavor#ifndef PLAYERCONTROL_H #define PLAYERCONTROL_H #include #include #include #include "aviplay.h" #include "playerwidget.h" #include "renderer.h" #include "avm_locker.h" class ConfigDialog; class QLabel; class QMessageBox; class QPixmap; class QPopupMenu; class QProgressBar; class QPushButton; class QSlider; class QTimer; class Q3PopupMenu; #define Q_MenuEvent QEvent::User #define Q_MyCloseEvent QEvent::Type(QEvent::User+2) #define Q_MyResizeEvent QEvent::Type(QEvent::User+3) #define Q_MyRefreshEvent QEvent::Type(QEvent::User+4) #define Q_MyPosEvent QEvent::Type(QEvent::User+5) #define Q_MyOpenEvent QEvent::Type(QEvent::User+6) #define Q_MyAboutEvent QEvent::Type(QEvent::User+7) #define Q_MyConfigEvent QEvent::Type(QEvent::User+8) struct AviPlayerInitParams { QString acodec; QString vcodec; QString subname; avm::vector urls; double seek; unsigned idx; int x; int y; int width; int height; int quality; bool fullscreen; bool maximize; bool nogui; bool quiet; bool autoq; AviPlayerInitParams() : seek(0.), idx(0), x(0), y(0), width(0), height(0), quality(0), fullscreen(false), maximize(false), nogui(false), quiet(false), autoq(false) {} }; class QMyResizeEvent : public QEvent { public: int m_x, m_y; QMyResizeEvent(int x, int y) :QEvent(Q_MyResizeEvent), m_x(x), m_y(y) {} }; class PlayerControl; class QButton; class QPlayerWidget : public QWidget { PlayerControl* m_pControl; public: QPlayerWidget(PlayerControl* c); virtual bool event(QEvent* e); QSlider* m_pScroller; QSlider* vbar; QProgressBar* pbar; QLabel* m_pLStatus; QLabel* m_pLTime; QButton* b_about; QButton* b_mute; QButton* b_open; QButton* b_pause; QButton* b_play; QButton* b_stop; }; class PlayerControl : public QObject, public PlayerWidget { friend class QPlayerWidget; Q_OBJECT; enum { RATIO_ORIG, RATIO_16_9, RATIO_4_3, ZOOM_PLUS, ZOOM_MINUS, CROP_TOP, CROP_BOTTOM, CROP_LEFT, CROP_RIGHT, CROP_4_3, CROP_16_9, CROP_16_10, }; public: PlayerControl(); ~PlayerControl(); int initPlayer(AviPlayerInitParams& avip); bool isValid() { return (player) ? true : false; } bool isStopped() { return (player) ? player->IsStopped() : true; } bool isPlaying() { return (player) ? player->IsPlaying() : false; } bool isPaused() { return (player) ? player->IsPaused() : false; } void decoderConfig(int); void endPlayer(); void ratio(int); void setDisplayFramePos(bool b) { m_bDisplayFramePos = b; } void sendKeyEvent(int qtkey, int qtascii = 0, int qtstate = 0); void sendRefresh(); void updatePosDisplay(double timepos); void zoom(float scale); void zoom_mode(int); void setRatio(int& x, int& y, int& w, int& h, int rw, int rh) { if (rh * w >= rw * h) { int n = rw * h / rh; x = (w - n) / 2; if (x < 8) { x = 0; n = w; } w = n; } else { int n = rh * w / rw; y = (h - n) / 2; if (y < 8) { y = 0; n = h; } h = n; } } void zoomWH(int width, int height, int original_w, int original_h); double getTime() { return (player) ? player->GetTime() : 0.; } avm::IAviPlayer2* getPlayer() { return player; } QWidget* getWidget() { return m_pMW; } // PlayerWidget virtual void PW_showconf_func() {return showconfSlot();} virtual void PW_stop_func() { return stopSlot(); } virtual void PW_middle_button() {return middle_button();} virtual void PW_pause_func() { return pauseSlot(); } virtual void PW_play_func() { return playSlot(); } virtual void PW_quit_func() { return sendEvent(Q_MyCloseEvent); } virtual void PW_menu_slot() { return sendEvent(Q_MenuEvent); } virtual void PW_fullscreen() { return sendFullscreen(); } virtual void PW_key_func(int sym, int mod) { return keySlot(sym, mod); } virtual void PW_resize(int w, int h) { return sendQt(new QMyResizeEvent(w, h)); } virtual void PW_refresh() { return sendEvent(Q_MyRefreshEvent); } virtual void PW_maximize_func() { return sendMaximize(); } public slots: void aboutSlot(); void changedSlot(int); void fullscreen(); void keySlot(int sym, int mod); void maximize(); void maximizeMode(int); void menuSlot(); void middle_button(); void movedSlot(int); void muteChanged(); void nextPage(); void openSlot(); void openaudSlot(); void openpopupSlot(); void opensubSlot(); void pauseSlot(); void playSlot(); void prevPage(); void ratio_16_9() { ratio(RATIO_16_9); } void ratio_4_3() { ratio(RATIO_4_3); } void ratio_orig() { ratio(RATIO_ORIG); } void refresh(); void reseekSlot(); void resizePlayer(int, int); void sendConfig() { sendEvent(Q_MyConfigEvent); } void sendEvent(QEvent ev) { sendQt(new QEvent(ev)); } void sendFullscreen() { sendKeyEvent(Qt::Key_F, 'F'); } void sendMaximize() { sendKeyEvent(Qt::Key_M, 'M'); } void sendQt(QEvent* ev); void showconfSlot(); void sliderSlot() { m_bIsTracking = 1; } void stopSlot(); void updatePos(); void volumeChanged(int); void zoom_0_5x() { zoom(0.5); } void zoom_1x() { zoom(1.0); } void zoom_2x() { zoom(2.0); } void zoom_plus() { zoom_mode(ZOOM_PLUS); } void zoom_minus() { zoom_mode(ZOOM_MINUS); } void crop_top() { zoom_mode(CROP_TOP); } void crop_bottom() { zoom_mode(CROP_BOTTOM); } void crop_left() { zoom_mode(CROP_LEFT); } void crop_right() { zoom_mode(CROP_RIGHT); } void crop_16_9() { zoom_mode(CROP_16_9); } void crop_16_10() { zoom_mode(CROP_16_10); } void crop_4_3() { zoom_mode(CROP_4_3); } void remote_command(); void help(); void about(); void aboutMovie(); void audioDecoderConfig() { decoderConfig(player->AUDIO_CODECS); } void videoDecoderConfig() { decoderConfig(player->VIDEO_CODECS); } void rendererConfig(); void dropEvent(QDropEvent*); void dragEnterEvent(QDragEnterEvent* event); void starterSlot(); void keyPressEvent(QKeyEvent *); void mouseDoubleClickEvent(QMouseEvent*); void readConfig(); void hideSlot(); void showSlot(); protected: // GUI QPlayerWidget* m_pMW; #ifndef Qt3 QPopupMenu* popup; QPopupMenu* modes; QPopupMenu* m_pAboutPopup; QPopupMenu* m_pOpenPopup; #else Q3PopupMenu* popup; Q3PopupMenu* modes; Q3PopupMenu* m_pAboutPopup; Q3PopupMenu* m_pOpenPopup; #endif QString m_Theme; // player avm::IAviPlayer2* player; avm::PthreadMutex m_Mutex; avm::PthreadMutex m_Dialog; ConfigDialog* dlg; QTimer* m_pTimer; QTimer* m_TimerStarter; QString m_Filename; QString m_Subname; double m_dStartTime; double m_dLengthTime; int last_slider; int m_iLastVolume; int m_iResizeCount; // pick better name here AviPlayerInitParams apip; bool m_bSettingScroller; bool m_bKeyProcessed; bool m_bDisplayFramePos; bool m_bIsTracking; bool m_bInReseek; //bool m_bOpenFileDlg; bool m_bUnpause; }; #endif // PLAYERCONTROL_H avifile-0.7.48~20090503.ds/plugins/0000755000175000017500000000000011267646347015442 5ustar yavoryavoravifile-0.7.48~20090503.ds/plugins/libac3pass/0000755000175000017500000000000011267646347017466 5ustar yavoryavoravifile-0.7.48~20090503.ds/plugins/libac3pass/Makefile.am0000644000175000017500000000153211110406017021472 0ustar yavoryavorif AMM_USE_AC3PASS pkglib_LTLIBRARIES = ac3pass.la endif pkgdocdir = $(datadir)/$(PACKAGE)/doc pkgdoc_DATA = README.ac3pass EXTRA_DIST = Makefile.emu $(pkgdoc_DATA) $(ac3pass_la_SOURCES) noinst_HEADERS =\ ac3-iec958.h\ fillplugins.h ac3pass_la_SOURCES = ac3-iec958.c libac3pass.cpp ac3pass_la_LIBADD = ../../lib/libaviplay.la ac3pass_la_LDFLAGS = -avoid-version -module -no-undefined #-release $(LT_RELEASE) AM_CXXFLAGS = $(CXXRTTIEXCEPT) $(VISIBILITYFLAG) #check_PROGRAMS = play_ac3 #play_ac3_SOURCES = play-ac3.c ac3-iec958.c LINE1="Digital L" LINE2="Digital R" SPCS=1 load: unload emu-config -t $(SPCS) emu-dspmgr -a"fx15:$(LINE1)" emu-dspmgr -a"fx15:$(LINE2)" emu-dspmgr -l "$(LINE1)" -l "$(LINE2)" -f /usr/local/share/emu10k1/ac3pass.bin unload: emu-dspmgr -z emu-config -t 0 CLEANFILES = play-ac3 MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libac3pass/Makefile.emu0000644000175000017500000000104307340503576021702 0ustar yavoryavorCFLAGS=-g -Wall LINE1=Digital L LINE2=Digital R SPCS=1 #LINE1=Rear L #LINE2=Rear R #SPCS=4 all: play-ac3 play-raw load: unload emu-config -t $(SPCS) emu-dspmgr -a"fx15:$(LINE1)" emu-dspmgr -a"fx15:$(LINE2)" emu-dspmgr -l "$(LINE1)" -l "$(LINE2)" -f /usr/local/share/emu10k1/ac3pass.bin unload: emu-dspmgr -z emu-config -t 0 # emu-dspmgr -r"fx15:$(LINE1)" # emu-dspmgr -r"fx15:$(LINE2)" # emu-dspmgr -l "$(LINE1)" -l "$(LINE2)" --unload=AC3pass play-ac3: play-ac3.c ac3-iec958.o play-raw: play-raw.c clean: rm -f *.o play-ac3 play-raw avifile-0.7.48~20090503.ds/plugins/libac3pass/README0000644000175000017500000000163307340503576020342 0ustar yavoryavor play-ac3 -- play Dolby Digital AC3 streams with Emu10k1 OSS drivers 1. Make sure you have ac3pass.bin in /usr/local/share/emu10k1. If not, do a 'make install' in utils/as10k1. 2. Type 'make load' 3. If everything goes well, you should be able to play AC3 streams with './play-ac3 '. You can also feed data from stdin, eg. 'extract_ac3 stream.vob | ./play-ac3 -'. Use 'play-raw' to play raw PCM streams. The stream must be 16-bit stereo with 48 kHz sampling rate. Note: You first have to enable digital pass-through with 'emu-config -t x', where x indicates which S/PDIF ports to use for playback. (1 = Port 0, 2 = Port 1 and 4 = Port 2) E.g. 'emu-config -t 7' enables all the three S/PDIF ports. If you choose not to use port 0, you have to change the line that the AC3pass patch is bound to (see Makefile) -- Juha Yrjölä avifile-0.7.48~20090503.ds/plugins/libac3pass/README.ac3pass0000644000175000017500000000657407562173701021706 0ustar yavoryavor A C 3 p a s s - t h r o u g h H O W T O !!!NOTE!!!: This plugin is intended to be used only by those who own the audio device which is capable to recive AC3 audio data stream via digital line. If you want to listen AC3 though your sound card DO NOT USE this plugin - instead put ahead some AC3 decoding plugin (at this moment FFMPEG AC3 decoder) Some notes about usage of AC3 passthrough with aviplay: Files: ac3-iec958.c ac3-iec958.h play-ac3.c are copied from emu10k1 CVS AC3 pass-through has been developed and tested only with my quite old SBLive card together with Dolby Digital AV receiver Yamaha RX-V42ORDS within 1 day and I do not have regular access to this device - if there is bug - you will have to help me to fix it !! For AC3 signal transmition 5m long 75ohm standard coaxial cable has been used (just that you should know you don't really have to buy expensive metal cable or even optical cables for such thing - you want to transfer just few bits - they will not look better with optical cable - and bitrate is just 384kbps. Last test has been made with kernel: 2.4.19-pre7 and emu10k1 driver from sourceforge (emu10k1.sf.net) CVS 2001/08/17 Previous check and original development 2001/08/17 For this day - 2001/08/19 - the Dolby Digital control led is signalizing that AC3 5.1 is correctly delivered to and played by AV device The code is based on 'play-ac3' line command tool which could be found in emu10k1 CVS tree (and copy is present here as well so you could check if your setup is working correctly with just pure ac3 stream.) You should always try to download and use the latest driver and tools from emu10k1 CVS tree!!! You can find them at http://emu10k1.sourceforge.net (originaly developed at http://opensource.creative.com) (There is big chance it will contain less bugs - as of 2001/08/19 its definitely causing some SMP deadlocks in 2.4.9 locks) also 2.4.19-pre6 doesn't seems to work properly and computer lock if pcm signal is used again after ac3 passthrough usage. So now how it work with aviplay: - select AC3 pass-through audio decoder (for this moment you will probably have to remove ffmpeg plugin as you could not pick decoder that easily for not - this will change soon) - select OSS audio renderer (the only one which supports AC3 passthough code in (SDL driver should be automaticaly skiped in this case) (manual change is not that easy - open ~/.avirc find line: AviPlayer AudioRenderer = 8 [ Binary ] SDL,OSS and switch order of OSS and SDL and save the file - later you should be able to use config dialog for this) cd plugins/libac3pass make load (this should initialize emu10k1 driver with ac3 pass-through code - you need to have emu-config & emu-dspmgr utils for emu driver properly installed - don't forget to place ac3pass.bin to /usr/local/share/emu10k1/ basically you should read some info about how to get ac3 passthrough working in the emu10k1 source tree) after all this has been done - just use your avi with AC3 stream and it should hopefully work. I know its not easy - but I've been unable to play AC3 stream with M$WinME at all - so it's better then nothing - also with xine you will have to mostly do the same thing. -- Zdenek Kabelac 26. Apr 2002 avifile-0.7.48~20090503.ds/plugins/libac3pass/ac3-iec958.c0000644000175000017500000001037011165742046021273 0ustar yavoryavor/* ---------------------------------------------------------------------- Copyright (C) 2001 Juha Yrjölä (jyrjola@cc.hut.fi) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ---------------------------------------------------------------------- */ #include #include #include #ifndef __USE_XOPEN void swab(const void *from, void *to, ssize_t n); #endif #include "ac3-iec958.h" struct frmsize_s { unsigned short bit_rate; unsigned short frm_size[3]; }; static const struct frmsize_s const frmsizecod_tbl[64] = { { 32 ,{64 ,69 ,96 } }, { 32 ,{64 ,70 ,96 } }, { 40 ,{80 ,87 ,120 } }, { 40 ,{80 ,88 ,120 } }, { 48 ,{96 ,104 ,144 } }, { 48 ,{96 ,105 ,144 } }, { 56 ,{112 ,121 ,168 } }, { 56 ,{112 ,122 ,168 } }, { 64 ,{128 ,139 ,192 } }, { 64 ,{128 ,140 ,192 } }, { 80 ,{160 ,174 ,240 } }, { 80 ,{160 ,175 ,240 } }, { 96 ,{192 ,208 ,288 } }, { 96 ,{192 ,209 ,288 } }, { 112 ,{224 ,243 ,336 } }, { 112 ,{224 ,244 ,336 } }, { 128 ,{256 ,278 ,384 } }, { 128 ,{256 ,279 ,384 } }, { 160 ,{320 ,348 ,480 } }, { 160 ,{320 ,349 ,480 } }, { 192 ,{384 ,417 ,576 } }, { 192 ,{384 ,418 ,576 } }, { 224 ,{448 ,487 ,672 } }, { 224 ,{448 ,488 ,672 } }, { 256 ,{512 ,557 ,768 } }, { 256 ,{512 ,558 ,768 } }, { 320 ,{640 ,696 ,960 } }, { 320 ,{640 ,697 ,960 } }, { 384 ,{768 ,835 ,1152 } }, { 384 ,{768 ,836 ,1152 } }, { 448 ,{896 ,975 ,1344 } }, { 448 ,{896 ,976 ,1344 } }, { 512 ,{1024 ,1114 ,1536 } }, { 512 ,{1024 ,1115 ,1536 } }, { 576 ,{1152 ,1253 ,1728 } }, { 576 ,{1152 ,1254 ,1728 } }, { 640 ,{1280 ,1393 ,1920 } }, { 640 ,{1280 ,1394 ,1920 } } }; struct syncframe { struct syncinfo { unsigned char syncword[2]; unsigned char crc1[2]; unsigned char code; } syncinfo; struct bsi { unsigned char bsidmod; unsigned char acmod; } bsi; }; void ac3_iec958_build_burst(unsigned int length, int data_type, int big_endian, unsigned char * data, unsigned char * out) { static const unsigned char syncd[4] = { 0x72, 0xF8, 0x1F, 0x4E }; memcpy(out, syncd, 4); if (length) out[4] = (unsigned char)data_type; /* & 0x1F; */ else out[4] = 0; out[5] = 0x00; out[6] = (unsigned char) (length*8); out[7] = (unsigned char) ((length*8) >> 8); if (big_endian) swab(data, out + 8, (int) length); else memcpy(data, out + 8, length); memset(out + 8 + length, 0, 6144 - 8 - length); } int ac3_iec958_parse_syncinfo(unsigned char *buf, int size, struct ac3info *ai, int *skipped) { static const int samplerates[4] = { 48000, 44100, 32000, -1 }; unsigned short syncn = 0; unsigned char *ptr = buf; int fscod, frmsizecod; struct syncframe *sf; syncn = buf[0] << 8; syncn |= buf[1]; ptr = buf + 2; *skipped = 0; while (syncn != 0xb77 && *skipped < size - 8) { syncn <<= 8; syncn |= *ptr; ptr++; *skipped += 1; } if (syncn != 0xb77) return -1; ptr -= 2; sf = (struct syncframe *) ptr; fscod = (sf->syncinfo.code >> 6) & 0x03; ai->samplerate = samplerates[fscod]; if (ai->samplerate == -1) return -1; frmsizecod = sf->syncinfo.code & 0x3f; ai->framesize = 2 * frmsizecod_tbl[frmsizecod].frm_size[fscod]; ai->bitrate = frmsizecod_tbl[frmsizecod].bit_rate; if (((sf->bsi.bsidmod >> 3) & 0x1f) != 0x08) return -1; ai->bsmod = sf->bsi.bsidmod & 0x7; return 0; } avifile-0.7.48~20090503.ds/plugins/libac3pass/ac3-iec958.h0000644000175000017500000000067110015350371021270 0ustar yavoryavor#ifndef _AC3_IEC958_H #define _AC3_IEC958_H #define IEC61937_DATA_TYPE_AC3 1 #ifdef __cplusplus extern "C" { #endif struct ac3info { int bitrate, framesize, samplerate, bsmod; }; void ac3_iec958_build_burst(unsigned int length, int data_type, int big_endian, unsigned char * data, unsigned char * out); int ac3_iec958_parse_syncinfo(unsigned char *buf, int size, struct ac3info *ai, int *skipped); #ifdef __cplusplus } #endif #endif avifile-0.7.48~20090503.ds/plugins/libac3pass/fillplugins.h0000644000175000017500000000073710746721552022167 0ustar yavoryavor#ifndef AC3PASS_FILLPLUGINS_H #define AC3PASS_FILLPLUGINS_H #include "infotypes.h" AVM_BEGIN_NAMESPACE; static void ac3pass_FillPlugins(avm::vector& ac) { const fourcc_t ac3pass_codecs[] = { 0x2000, 0 }; ac.push_back(CodecInfo(ac3pass_codecs, "AC3 pass-through", "", "AC3 hardware pass through SPDIF on SBLive card", CodecInfo::Plugin, "hwac3", CodecInfo::Audio, CodecInfo::Decode)); } AVM_END_NAMESPACE; #endif // AC3PASS_FILLPLUGINS_H avifile-0.7.48~20090503.ds/plugins/libac3pass/libac3pass.cpp0000644000175000017500000000523211165744234022207 0ustar yavoryavor#include "fillplugins.h" #include "audiodecoder.h" #include "utils.h" #include "plugin.h" #include "ac3-iec958.h" #include "avm_output.h" #include #include #include AVM_BEGIN_NAMESPACE; PLUGIN_TEMP(ac3pass); class AC3_PassDecoder : public IAudioDecoder { public: // Note: AudioQueue has this value hardcoded and it is used // as block size when ac3 passthrough stream is played! static const size_t AC3_BLOCK_SIZE = 6144; AC3_PassDecoder(const CodecInfo& info, const WAVEFORMATEX* wf) :IAudioDecoder(info, wf) { } int Convert(const void* in_data, size_t in_size, void* out_data, size_t out_size, size_t* size_read, size_t* size_written) { if (!in_data || !out_data) return -1; int skipped; struct ac3info ai; int data_type = 1; int i = ac3_iec958_parse_syncinfo((unsigned char*)in_data, (int)in_size, &ai, &skipped); if (i < 0) { AVM_WRITE("AC3_PassThrough", "AC3 stream not valid.\n"); return -1; } if (ai.samplerate != 48000) { AVM_WRITE("AC3_PassThrough", "Only 48000 Hz streams supported.\n"); return -1; } // we are reading just one frame - easier to synchronize // speed is not ours biggest problem :) ... // so I don't care we call write more offten then play-ac3 ac3_iec958_build_burst(ai.framesize, data_type, 1, (unsigned char*)in_data + skipped, (unsigned char*)out_data); if (size_read) *size_read = skipped + ai.framesize; if (size_written) *size_written = AC3_BLOCK_SIZE; return 0; } int GetOutputFormat(WAVEFORMATEX* destfmt) const { if (!destfmt) return -1; *destfmt = *m_pFormat; destfmt->wBitsPerSample = 16; destfmt->wFormatTag = 0x2000; destfmt->nAvgBytesPerSec = 192000; // after conversion destfmt->nBlockAlign = AC3_BLOCK_SIZE; destfmt->nSamplesPerSec = destfmt->nAvgBytesPerSec / destfmt->nChannels / (destfmt->wBitsPerSample / 8); destfmt->cbSize = 0; /* destfmt->nBlockAlign = destfmt->nChannels * destfmt->wBitsPerSample / 8; destfmt->nAvgBytesPerSec = destfmt->nSamplesPerSec * destfmt->nBlockAlign; */ return 0; } }; // PLUGIN loading part static IAudioDecoder* ac3pass_CreateAudioDecoder(const CodecInfo& info, const WAVEFORMATEX* format) { if (info.fourcc == 0x2000) //AC3 return new AC3_PassDecoder(info, format); ac3pass_error_set("format unsupported"); return 0; } AVM_END_NAMESPACE; extern "C" AVMEXPORT avm::codec_plugin_t avm_codec_plugin_ac3pass; avm::codec_plugin_t avm_codec_plugin_ac3pass = { PLUGIN_API_VERSION, 0, // err 0,0, 0, 0, 0, 0, // attrs avm::ac3pass_FillPlugins, avm::ac3pass_CreateAudioDecoder, 0, 0, 0, }; avifile-0.7.48~20090503.ds/plugins/libac3pass/play-ac3.c0000644000175000017500000000664607343301302021232 0ustar yavoryavor/* ---------------------------------------------------------------------- Copyright (C) 2001 Juha Yrjölä (jyrjola@cc.hut.fi) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ---------------------------------------------------------------------- */ #ifdef __NetBSD__ #include #else #include #endif #include #include #include #include #include #include "ac3-iec958.h" #define FRAMES 4 #ifndef AFMT_AC3 #define AFMT_AC3 0x400 #endif void usage() { fprintf(stderr, "Usage: play-ac3 [-t ] \n"); fprintf(stderr, "\tUse -t to change the data type field in output data\n"); exit(1); } int check_ac3_stream(int in, int *frame_size) { int i, skipped; unsigned char buffer[4096]; struct ac3info ai; i = read(in, buffer, sizeof(buffer)); if (i != sizeof(buffer)) { fprintf(stderr, "Error reading AC3 stream.\n"); return -1; } i = ac3_iec958_parse_syncinfo(buffer, sizeof(buffer), &ai, &skipped); if (i < 0) { fprintf(stderr, "AC3 stream not valid.\n"); return -1; } if (ai.samplerate != 48000) { fprintf(stderr, "Only 48000 Hz streams supported.\n"); return -1; } if (in != 0) i = lseek(in, skipped, SEEK_SET); else { i = read(in, buffer, ai.framesize-(sizeof(buffer)%ai.framesize)+skipped); } if (i < 0) { fprintf(stderr, "Error seeking in AC3 stream.\n"); return -1; } *frame_size = ai.framesize; return 0; } int main(int argc, char *argv[]) { int fd, in; int tmp, i, c = 1, bytes_read, data_type = 1, frame_size; unsigned char *ac3buf, *iecbuf; if (argc < 2) usage(); if (argc == 4) { if (strcmp(argv[c++], "-t") == 0) { data_type = atoi(argv[c++]); printf("Using data type %d.\n", data_type); } else usage(); } if (strcmp(argv[c], "-") == 0) { fprintf(stderr, "Reading from stdin.\n"); in = 0; } else { in = open(argv[c], O_RDONLY); if (in < 0) { fprintf(stderr, "Error opening file \"%s\".\n", argv[c]); exit(1); } } switch (data_type & 0x1F) { case IEC61937_DATA_TYPE_AC3: default: if (check_ac3_stream(in, &frame_size)) exit(1); break; } fd = open("/dev/dsp", O_WRONLY); if (fd < 0) { fprintf(stderr, "Error opening DSP.\n"); exit(1); } tmp = AFMT_AC3; if (ioctl(fd, SNDCTL_DSP_SETFMT, &tmp) < 0 || tmp != AFMT_AC3) { fprintf(stderr, "SNDCTL_DSP_SETFMT failed.\n"); exit(1); } ac3buf = malloc(FRAMES * frame_size); iecbuf = malloc(FRAMES * 6144); bytes_read = read(in, ac3buf, FRAMES * frame_size); while (bytes_read == FRAMES * frame_size) { for (i = 0; i < FRAMES; i++) { ac3_iec958_build_burst(frame_size, data_type, 1, ac3buf + i * frame_size, iecbuf + i * 6144); } write(fd, iecbuf, FRAMES * 6144); bytes_read = read(in, ac3buf, FRAMES * frame_size); } return 0; } avifile-0.7.48~20090503.ds/plugins/Makefile.am0000644000175000017500000000126410011721020017441 0ustar yavoryavor# for testing only - swap S SSUBDIRS = $(SUBDIRS_VORBIS) SUBDIRS = \ libac3pass \ libaudiodec \ libdivx4 \ libffmpeg \ libmad \ libmp3lamebin_audioenc \ libmp3lame_audioenc \ libmpeg_audiodec \ libvorbis \ libwin32 \ libxvid \ libxvid4 #noinst_LTLIBRARIES = libplugins.la #libplugins_la_SOURCES = libplugins.cpp plugins.c AM_CPPFLAGS = -Ilibac3pass -Ilibwin32 -Ilibwin32/audiodec \ -Ilibwin32/videocodec -Ilibwin32/loader \ -Ilibwin32/loader/dshow -I../ffmpeg/libavcodec \ -DWIN32_PATH=\"$(WIN32_PATH)\" -D__WINE__ -DUNICODE \ -Ddbg_printf=__vprintf -DTRACE=__vprintf \ -Wmissing-prototypes -Wimplicit-function-declaration \ -DAVIFILE MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libplugins.cpp0000644000175000017500000000261707547604373020323 0ustar yavoryavor #include "libdivx4/divx4.cpp" #include "libac3pass/libac3pass.cpp" #include "libaudiodec/gsm61dec.cpp" #include "libaudiodec/aulaw.cpp" #include "libaudiodec/audiodecoder.cpp" #include "libaudiodec/pcm.cpp" #include "libaudiodec/adpcm.cpp" #include "libaudiodec/a52.cpp" #include "libffmpeg/libffmpeg.cpp" #include "libffmpeg/FFAudioDecoder.cpp" #include "libffmpeg/FFVideoEncoder.cpp" #include "libffmpeg/FFVideoDecoder.cpp" #include "libmad/libmad.cpp" #include "libmp3lamebin_audioenc/lameencoder.cpp" //#include "libmp3lame_audioenc/mp3encoder.cpp" //#include "libmp3lame_audioenc/audioencoder.cpp" #include "libmpeg_audiodec/mpegtable.cpp" #include "libmpeg_audiodec/mpeglayer1.cpp" #include "libmpeg_audiodec/mpeglayer2.cpp" #include "libmpeg_audiodec/mpeglayer3.cpp" #include "libmpeg_audiodec/huffmantable.cpp" #include "libmpeg_audiodec/filter.cpp" #include "libmpeg_audiodec/mpegtoraw.cpp" #include "libmpeg_audiodec/filter_2.cpp" #include "libmpeg_audiodec/bitwindow.cpp" #include "libvorbis/libvorbis.cpp" #include "libwin32/audiodec/ACM_AudioDecoder.cpp" #include "libwin32/audiodec/DS_AudioDecoder.cpp" #include "libwin32/libwin32.cpp" #include "libwin32/videocodec/Module.cpp" #include "libwin32/videocodec/DS_VideoDecoder.cpp" #include "libwin32/videocodec/VideoCodec.cpp" #include "libwin32/videocodec/VideoEncoder.cpp" #include "libwin32/videocodec/VideoDecoder.cpp" #include "libxvid/xvid.cpp" avifile-0.7.48~20090503.ds/plugins/plugins.c0000644000175000017500000000140707547604374017271 0ustar yavoryavor#include "libac3pass/ac3-iec958.c" #include "libaudiodec/xa_gsm.c" #include "libaudiodec/adpcm_impl.c" #include "libwin32/loader/resource.c" #include "libwin32/loader/elfdll.c" #include "libwin32/loader/afl.c" #include "libwin32/loader/ext.c" #include "libwin32/loader/module.c" #include "libwin32/loader/ldt_keeper.c" #include "libwin32/loader/driver.c" #include "libwin32/loader/pe_image.c" #include "libwin32/loader/pe_resource.c" #include "libwin32/loader/win32.c" #include "libwin32/loader/registry.c" #include "libwin32/loader/dshow/cmediasample.c" #include "libwin32/loader/dshow/DS_Filter.c" #include "libwin32/loader/dshow/outputpin.c" #include "libwin32/loader/dshow/guids.c" #include "libwin32/loader/dshow/allocator.c" #include "libwin32/loader/dshow/inputpin.c" avifile-0.7.48~20090503.ds/plugins/libaudiodec/0000755000175000017500000000000011267646347017706 5ustar yavoryavoravifile-0.7.48~20090503.ds/plugins/libaudiodec/Makefile.am0000644000175000017500000000111411110406017021706 0ustar yavoryavorpkglib_LTLIBRARIES = audiodec.la noinst_HEADERS =\ adpcm_impl.h\ aulaw.h\ fillplugins.h\ xa_gsm.h\ xa_gsm_state.h audiodec_la_SOURCES =\ audiodecoder.cpp\ adpcm_impl.c\ xa_gsm.c if AMM_USE_A52 audiodec_la_SOURCES += a52.cpp endif audiodec_la_LDFLAGS = -avoid-version -module audiodec_la_LIBADD = ../../lib/libaviplay.la AM_CPPFLAGS = $(A52_CFLAGS) AM_CXXFLAGS = $(CXXRTTIEXCEPT) $(VISIBILITYFLAG) if AMM_USE_A52BIN AM_CPPFLAGS += -DA52BIN audiodec_la_LIBADD += $(DL_LIBS) else if AMM_USE_A52 audiodec_la_LIBADD += $(A52_LIBS) endif endif MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libaudiodec/a52.cpp0000644000175000017500000001361611164472232020772 0ustar yavoryavor#include "fillplugins.h" #include "audiodecoder.h" #include "plugin.h" #include "utils.h" #include #ifdef A52BIN #include /** * copy of A52 defines here * * have to match with the a52 library * hopefully they will not change often */ #define A52_CHANNEL 0 #define A52_MONO 1 #define A52_STEREO 2 #define A52_3F 3 #define A52_2F1R 4 #define A52_3F1R 5 #define A52_2F2R 6 #define A52_3F2R 7 #define A52_CHANNEL1 8 #define A52_CHANNEL2 9 #define A52_DOLBY 10 #define A52_CHANNEL_MASK 15 #define A52_LFE 16 #define A52_ADJUST_LEVEL 32 /* generic accelerations */ #define MM_ACCEL_DJBFFT 0x00000001 /* x86 accelerations */ #define MM_ACCEL_X86_MMX 0x80000000 #define MM_ACCEL_X86_3DNOW 0x40000000 #define MM_ACCEL_X86_MMXEXT 0x20000000 typedef struct a52_state_s a52_state_t; typedef float sample_t; /** end of a52.h and mm_accel.h **/ #else #include #endif AVM_BEGIN_NAMESPACE; // library name class A52_Decoder : public IAudioDecoder { public: A52_Decoder(const CodecInfo& info, const WAVEFORMATEX* wf) :IAudioDecoder(info, wf) { m_Error[0] = 0; } int init() { #ifdef A52BIN const char* a52name = "liba52.so.0"; m_pHandle = dlopen(a52name, RTLD_LAZY); if (!m_pHandle) { sprintf(m_Error, "library '%s' could not be opened: %s\n", a52name, dlerror()); return -1; } // resolve all needed function calls p_a52_init = (a52_state_t* (*)(uint32_t)) dlsymm("a52_init"); p_a52_samples = (sample_t* (*)(a52_state_t*)) dlsymm("a52_samples"); p_a52_syncinfo = (int (*)(uint8_t*, int*, int*, int*)) dlsymm("a52_syncinfo"); p_a52_frame = (int (*)(a52_state_t*, uint8_t*, int*, sample_t*, sample_t)) dlsymm("a52_frame"); p_a52_block = (int (*)(a52_state_t*)) dlsymm("a52_block"); p_a52_free = (void (*)(a52_state_t*)) dlsymm("a52_free"); #else p_a52_init = a52_init; p_a52_samples = a52_samples; p_a52_syncinfo = a52_syncinfo; p_a52_frame = a52_frame; p_a52_block = a52_block; p_a52_free = a52_free; #endif m_pState = p_a52_init(0); if (!m_pState) { sprintf(m_Error, "initialization failed"); return -1; } m_pSamples = p_a52_samples(m_pState); return 0; } virtual ~A52_Decoder() { if (m_pState) p_a52_free(m_pState); #ifdef A52BIN if (m_pHandle) dlclose(m_pHandle); #endif } virtual int Convert(const void* in_data, size_t in_size, void* out_data, size_t out_size, size_t* size_read, size_t* size_written) { size_t written = 0; size_t bread = 0; //while ((written + (6 * 2 * 256 * 2)) < out_size && (bread + 2000) < in_size) for (;;) { int len = p_a52_syncinfo((unsigned char*)in_data + bread, &flags, &sample_rate, &bit_rate); //printf("syncinfo %d %d %d insz: %d\n", sample_rate, bit_rate, flags, in_size); if (len <= 0) { //printf("AC3 stream not valid.\n"); if (bread + 128 < in_size) { bread++; continue; } break; } if (flags != A52_MONO) flags = A52_STEREO; sample_t level = 1; if (p_a52_frame(m_pState, (unsigned char*)in_data + bread, &flags, &level, 384)) break; bread += len; for (int i = 0; i < 6; i++) { if (p_a52_block(m_pState)) break; float_to_int(m_pSamples, (int16_t*)out_data + i * 256 * 2/*channels*/, 2); written += 2 * 2 * 256; } break; } //printf("READ %d WR %d\n", bread, written); // we are reading just one frame - easier to synchronize // speed is not ours biggest problem :) ... // so I don't care we call write more offten then play-ac3 if (size_read) *size_read = bread; if (size_written) *size_written = written; return 0; } #if 0 virtual int GetOutputFormat(WAVEFORMATEX* destfmt) const { if (!destfmt) return -1; *destfmt = *m_pFormat; destfmt->wBitsPerSample = 16; destfmt->wFormatTag = 0x2000; destfmt->nAvgBytesPerSec = 192000; // after conversion destfmt->nChannels = 0 destfmt->nBlockAlign = A52_BLOCK_SIZE; destfmt->nSamplesPerSec = destfmt->nAvgBytesPerSec / destfmt->nChannels / (destfmt->wBitsPerSample / 8); destfmt->cbSize = 0; /* destfmt->nBlockAlign = destfmt->nChannels * destfmt->wBitsPerSample / 8; destfmt->nAvgBytesPerSec = destfmt->nSamplesPerSec * destfmt->nBlockAlign; */ return 0; } #endif const char* getError() const { return m_Error; } protected: /**** the following two functions comes from a52dec */ int16_t blah(int32_t i) { if (i > 0x43c07fff) return 32767; else if (i < 0x43bf8000) return -32768; return (int16_t)(i - 0x43c00000); } void float_to_int(float* _f, int16_t* s16, int nchannels) { int32_t* f = (int32_t*)_f; // XXX assumes IEEE float format unsigned j = 0; nchannels *= 256; for (unsigned i = 0; i < 256; ++i) { for (int c = 0; c < nchannels; c += 256) s16[j++] = blah(f[i + c]); } } #ifdef A52BIN void* m_pHandle; void* dlsymm(const char* symbol, bool fatal = true) { if (m_Error[0] != 0) return 0; void* f = dlsym(m_pHandle, symbol); if (!f && fatal) sprintf(m_Error, "function '%s' can't be resolved", symbol); return f; } #endif a52_state_t* m_pState; sample_t* m_pSamples; int flags, sample_rate, bit_rate; a52_state_t* (*p_a52_init)(uint32_t mm_accel); sample_t* (*p_a52_samples)(a52_state_t * state); int (*p_a52_syncinfo)(uint8_t * buf, int * flags, int * sample_rate, int * bit_rate); int (*p_a52_frame)(a52_state_t * state, uint8_t * buf, int * flags, sample_t * level, sample_t bias); void (*p_a52_dynrng)(a52_state_t * state, sample_t (* call) (sample_t, void *), void * data); int (*p_a52_block)(a52_state_t * state); void (*p_a52_free)(a52_state_t * state); char m_Error[128]; }; IAudioDecoder* CreateA52_Decoder(const CodecInfo& info, const WAVEFORMATEX* format) { A52_Decoder* d = new A52_Decoder(info, format); if (d->init() == 0) return d; delete d; return 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/plugins/libaudiodec/adpcm_impl.c0000644000175000017500000001715707573451404022163 0ustar yavoryavor/*********************************************************** Copyright 1992 by Stichting Mathematisch Centrum, Amsterdam, The Netherlands. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Stichting Mathematisch Centrum or CWI not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* ** Intel/DVI ADPCM coder/decoder. ** ** The algorithm for this coder was taken from the IMA Compatability Project ** proceedings, Vol 2, Number 2; May 1992. ** ** Version 1.2, 18-Dec-92. ** ** Change log: ** - Decoder finaly fixed by kabi@users.sourceforge.net 20011204 ** - Some major modification by kabi@users.sourceforge.net ** - Fixed a stupid bug, where the delta was computed as ** stepsize*code/4 in stead of stepsize*(code+0.5)/4. ** - There was an off-by-one error causing it to pick ** an incorrect delta once in a blue moon. ** - The NODIVMUL define has been removed. Computations are now always done ** using shifts, adds and subtracts. It turned out that, because the standard ** is defined using shift/add/subtract, you needed bits of fixup code ** (because the div/mul simulation using shift/add/sub made some rounding ** errors that real div/mul don't make) and all together the resultant code ** ran slower than just using the shifts all the time. ** - Changed some of the variable names to be more meaningful. */ #include "adpcm_impl.h" #if 0 #include /*DBG*/ #endif #ifndef __STDC__ #define signed #endif /* Intel ADPCM step variation table */ /* 4bit DVI ADPCM */ static const int index_table[16] = { -1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8, }; /* 3bit is different */ /* * * Lookup tables for IMA ADPCM format * */ #define ISSTMAX 88 static const int stepsize_table[ISSTMAX + 1] = { 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 }; /* +0 - +3, decrease step size */ /* +4 - +7, increase step size */ /* -0 - -3, decrease step size */ /* -4 - -7, increase step size */ static int tabinit = 0; static unsigned char index_adjust_table[ISSTMAX+1][8]; void adpcm_init_table(void) { if (!tabinit) { int i, j, k; for (i = 0; i <= ISSTMAX; i++) { for (j = 0; j < 8; j++) { k = i + (j < 4) ? -1: (2* j -6); if (k < 0) k = 0; else if (k > ISSTMAX) k = ISSTMAX; index_adjust_table[i][j] = k; } } tabinit = 1; } } void adpcm_coder(unsigned char* outdata, const short* indata, unsigned int len, struct adpcm_state* state) { int val; /* Current input sample value */ int sign; /* Current adpcm sign bit */ int delta; /* Current adpcm output value */ int diff; /* Difference between val and valprev */ int step; /* Stepsize */ int valpred; /* Predicted output value */ int vpdiff; /* Current change to valpred */ int index; /* Current step change index */ int outputbuffer = 0; /* place to keep previous 4-bit value */ int bufferstep = 1; /* toggle between outputbuffer/output */ valpred = state->valprev; index = state->index; step = stepsize_table[index]; for ( ; len > 0 ; len-- ) { val = *indata++; /* Step 1 - compute difference with previous value */ diff = val - valpred; sign = (diff < 0) ? 8 : 0; if ( sign ) diff = (-diff); /* Step 2 - Divide and clamp */ /* Note: ** This code *approximately* computes: ** delta = diff*4/step; ** vpdiff = (delta+0.5)*step/4; ** but in shift step bits are dropped. The net result of this is ** that even if you have fast mul/div hardware you cannot put it to ** good use since the fixup would be too expensive. */ vpdiff = (step >> 3); if ( diff >= step ) { delta = 4; diff -= step; vpdiff += step; } else delta = 0; step >>= 1; if ( diff >= step ) { delta |= 2; diff -= step; vpdiff += step; } step >>= 1; if ( diff >= step ) { delta |= 1; vpdiff += step; } /* Step 3 - Update previous value */ if ( sign ) valpred -= vpdiff; else valpred += vpdiff; /* Step 4 - Clamp previous value to 16 bits */ if ( valpred > 32767 ) valpred = 32767; else if ( valpred < -32768 ) valpred = -32768; /* Step 5 - Assemble value, update index and step values */ delta |= sign; index += index_table[delta]; if ( index < 0 ) index = 0; if ( index > 88 ) index = 88; step = stepsize_table[index]; /* Step 6 - Output value */ if ( bufferstep ) { outputbuffer = (delta << 4) & 0xf0; } else { *outdata++ = (delta & 0x0f) | outputbuffer; } bufferstep = !bufferstep; } /* Output last step, if needed */ if ( !bufferstep ) *outdata++ = outputbuffer; state->valprev = valpred; state->index = index; } void adpcm_decoder(short* outdata, const void* indata, unsigned int len, struct adpcm_state* state, unsigned int channels) { const unsigned char* inp = (const unsigned char *)indata; /* Input buffer pointer */ int valpred; /* Predicted value */ int index; /* Current step change index */ int i; valpred = state->valprev; index = state->index; inp -= 4 * (channels - 1); // compensate first add for (i = 0; i < len; i++) { int delta; /* Current adpcm output value */ int step; /* Stepsize */ int vpdiff; /* Current change to valpred */ /* Step 1 - get the delta value */ if (i & 1) { delta = (*inp++ >> 4) & 0x0f; } else { if (!(i & 7)) inp += 4 * channels - 4; delta = *inp & 0x0f; } /* Step 1.5 - Update step value */ step = stepsize_table[index]; /* Step 2 - Find new index value (for later) */ index += index_table[delta]; if ( index < 0 ) index = 0; else if ( index > 88 ) index = 88; /* Step 4 - Compute difference and new predicted value */ /* ** Computes 'vpdiff = (delta+0.5)*step/4', but see comment ** in adpcm_coder. */ #if 0 vpdiff = step >> 3; if ( delta & 4 ) vpdiff += step; if ( delta & 2 ) vpdiff += step >> 1; if ( delta & 1 ) vpdiff += step >> 2; #else /** but we will use (2*delta + 1) * step / 8 */ vpdiff = ((2 * (delta & 7) + 1) * step) >> 3; #endif /* Step 3 - Separate sign and magnitude */ if ( delta & 8 ) { valpred -= vpdiff; if (valpred < -32768) valpred = -32768; } else { valpred += vpdiff; if (valpred > 32767) valpred = 32767; } /* Step 7 - Output value */ *outdata = valpred; outdata += channels; } state->valprev = valpred; state->index = index; } avifile-0.7.48~20090503.ds/plugins/libaudiodec/adpcm_impl.h0000644000175000017500000000076107403221304022143 0ustar yavoryavor#ifndef ADPCM_H #define ADPCM_H /* * adpcm.h - include file for adpcm coder. */ #ifdef __cplusplus extern "C" { #endif struct adpcm_state { short valprev; /* Previous output value */ char index; /* Index into stepsize table */ }; void adpcm_coder(unsigned char*, const short*, unsigned int, struct adpcm_state*); void adpcm_decoder(short*, const void*, unsigned int, struct adpcm_state*, unsigned int); void adpcm_init_table(void); #ifdef __cplusplus } #endif #endif /* ADPCM_H */ avifile-0.7.48~20090503.ds/plugins/libaudiodec/audiodecoder.cpp0000644000175000017500000001272411165742004023027 0ustar yavoryavor#include "audiodecoder.h" #include "aulaw.h" #include "adpcm_impl.h" #include "xa_gsm_state.h" #include "fillplugins.h" #include "avm_output.h" #include "utils.h" #include "plugin.h" #include #include #include AVM_BEGIN_NAMESPACE; PLUGIN_TEMP(audiodec); class ADPCM_Decoder : public IAudioDecoder { adpcm_state state; public: ADPCM_Decoder(const CodecInfo& info, const WAVEFORMATEX* wf) :IAudioDecoder(info, wf) { adpcm_init_table(); Flush(); } size_t GetMinSize() const { return m_pFormat->nBlockAlign * m_pFormat->nChannels; } void Flush() { state.valprev = 0; state.index = 0; } int Convert(const void* in_data, size_t in_size, void* out_data, size_t out_size, size_t* size_read, size_t* size_written) { size_t nblocks = in_size / m_pFormat->nBlockAlign; int smpl = 2 * m_pFormat->nBlockAlign / m_pFormat->nChannels - 4 * m_pFormat->nChannels; // 4 bytes per channel int16_t* out_ptr = (int16_t*) out_data; size_t minosmpl = out_size / (2 * (smpl + 1) * m_pFormat->nChannels); if (nblocks > minosmpl) nblocks = minosmpl; const int* in_ptr = (const int*) in_data; //printf("in: %d al: %d ch: %d ns %d sampl %d\n", // in_size, m_pFormat.nBlockAlign, m_pFormat.nChannels, nblocks, smpl); for (unsigned i = 0; i < nblocks; ++i) { for (int c = 0; c < m_pFormat->nChannels; ++c) { const int32_t* inp = in_ptr + m_pFormat->nChannels + c; const uint8_t* hdr = (const uint8_t*) (in_ptr + c); state.valprev = (unsigned short)((hdr[1] << 8) | hdr[0]); state.index = hdr[2]; if (hdr[3] != 0) { AVM_WRITE("ADPCM_Decoder", "out of sync()\n"); //printf("Data 0x08%x 0x%08x %d\n", in_ptr[c], state.valprev, state.index); } else adpcm_decoder(out_ptr + c, inp, smpl, &state, m_pFormat->nChannels); } in_ptr += m_pFormat->nBlockAlign / sizeof(int); out_ptr += (smpl + 0) * m_pFormat->nChannels; } if (size_read) *size_read = nblocks * m_pFormat->nBlockAlign; if (size_written) *size_written = nblocks * 2 * smpl * m_pFormat->nChannels; //printf("### %d %d\n", *size_read, *size_written); return 0; } }; class AULAW_Decoder : public IAudioDecoder { const short* table; public: AULAW_Decoder(const CodecInfo& info, const WAVEFORMATEX* wf) :IAudioDecoder(info, wf) { table = (info.fourcc == 0x06) ? alaw2short : ulaw2short; } int Convert(const void* in_data, size_t in_size, void* out_data, size_t out_size, size_t* size_read, size_t* size_written) { size_t csize = (in_size < out_size / 2) ? in_size : out_size / 2; const uint8_t* in = (const uint8_t*) in_data; short* o = (short*) out_data; short* end = o + csize; while (o < end) *o++ = table[*in++]; if (size_read) *size_read = csize; if (size_written) *size_written = 2 * csize; return 0; } }; class MSGSM_Decoder : public IAudioDecoder { public: MSGSM_Decoder(const CodecInfo& info, const WAVEFORMATEX* wf) :IAudioDecoder(info, wf) { GSM_Init(); } virtual size_t GetMinSize() const { return 640; } virtual int Convert(const void* in_data, size_t in_size, void* out_data, size_t out_size, size_t* size_read, size_t* size_written) { size_t num_samples=in_size/65; if (out_size<640*num_samples) num_samples=out_size/640; if (num_samples==0) { if(size_read)*size_read=0; if(size_written)*size_written=0; return -1; } size_t ocnt = XA_ADecode_GSMM_PCMxM(num_samples*65, num_samples, (char*)in_data, // no const - interface (uint8_t*)out_data, out_size); /* if(format) { format->is_stereo=0;//mono format->freq=local_wf.nSamplesPerSec;//unsure //format->freq=44100; format->valid=OUT_FORMAT_VALID; } */ // if(ocnt& audiocodecs) { const char* const none_about_ad = ""; const fourcc_t pcm_codecs[] = { 0x01, 0x6172 /* raw */, 0 }; const fourcc_t alaw_codecs[] = { 0x06, 0 }; const fourcc_t ulaw_codecs[] = { 0x07, 0 }; const fourcc_t ima_adpcm_codecs[] = { 0x11, 0x200, 0 }; const fourcc_t gsm_codecs[] = { 0x31, 0x32, 0 }; audiocodecs.push_back(CodecInfo(pcm_codecs, "PCM", "", none_about_ad, CodecInfo::Plugin, "pcm", CodecInfo::Audio, CodecInfo::Decode)); audiocodecs.push_back(CodecInfo(alaw_codecs, "ALaw", "", none_about_ad, CodecInfo::Plugin, "alaw", CodecInfo::Audio, CodecInfo::Decode)); audiocodecs.push_back(CodecInfo(ulaw_codecs, "uLaw", "", none_about_ad, CodecInfo::Plugin, "ulaw", CodecInfo::Audio, CodecInfo::Decode)); audiocodecs.push_back(CodecInfo(ima_adpcm_codecs, "IMA ADPCM", "", none_about_ad, CodecInfo::Plugin, "imaadpcm", CodecInfo::Audio, CodecInfo::Decode)); audiocodecs.push_back(CodecInfo(gsm_codecs, "GSM", "", none_about_ad, CodecInfo::Plugin, "msgsm", CodecInfo::Audio, CodecInfo::Decode)); #ifdef HAVE_LIBA52 const fourcc_t ac3_codecs[] = { 0x2000, 0 }; audiocodecs.push_back(CodecInfo(ac3_codecs, "A52", "", none_about_ad, CodecInfo::Plugin, "a52", CodecInfo::Audio, CodecInfo::Decode)); #endif } AVM_END_NAMESPACE; #endif // AUDIODEC_FILLPLUGINS_H avifile-0.7.48~20090503.ds/plugins/libaudiodec/xa_gsm.c0000644000175000017500000007657610747447247021355 0ustar yavoryavor /******************************************************************** Copyright 1992 by Jutta Degener and Carsten Bormann, Technische Universitaet Berlin Any use of this software is permitted provided that this notice is not removed and that neither the authors nor the Technische Universitaet Berlin are deemed to have made any representations as to the suitability of this software for any purpose nor are held responsible for any defects of this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. As a matter of courtesy, the authors request to be informed about uses this software has found, about bugs in this software, and about any improvements that may be of general interest. Berlin, 15.09.1992 Jutta Degener Carsten Bormann ********************************************************************/ #include #include /* memset */ #include /* POD optional */ #include "xa_gsm.h" void XA_MSGSM_Decoder(); static void GSM_Decode(); static void Gsm_RPE_Decoding(); static short gsm_buf[320]; static XA_GSM_STATE gsm_state; unsigned char xa_sign_2_ulaw[256]; static unsigned char XA_Signed_To_uLaw(long ch) { long mask; if (ch < 0) { ch = -ch; mask = 0x7f; } else { mask = 0xff; } if (ch < 32) { ch = 0xF0 | (15 - (ch / 2)); } else if (ch < 96) { ch = 0xE0 | (15 - (ch - 32) / 4); } else if (ch < 224) { ch = 0xD0 | (15 - (ch - 96) / 8); } else if (ch < 480) { ch = 0xC0 | (15 - (ch - 224) / 16); } else if (ch < 992) { ch = 0xB0 | (15 - (ch - 480) / 32); } else if (ch < 2016) { ch = 0xA0 | (15 - (ch - 992) / 64); } else if (ch < 4064) { ch = 0x90 | (15 - (ch - 2016) / 128); } else if (ch < 8160) { ch = 0x80 | (15 - (ch - 4064) / 256); } else { ch = 0x80; } return (mask & ch); } static void Gen_Signed_2_uLaw() { unsigned long i; for(i=0;i<256;i++) { unsigned char d; char ch = i; long chr = ch; d = XA_Signed_To_uLaw(chr * 16); xa_sign_2_ulaw[i] = d; } } void GSM_Init() { memset((char *)(&gsm_state), 0, sizeof(XA_GSM_STATE)); gsm_state.nrp = 40; Gen_Signed_2_uLaw(); } /*************************************************************************** * * */ unsigned long XA_ADecode_GSMM_PCMxM ( //XA_SND *snd_hdr, long byte_cnt, long samp_cnt, char* ibuf, unsigned char* obuf, unsigned long buff_size) { // unsigned char *ibuf; int ocnt=0; int flag=0; unsigned long inc_cnt=0; long dataL, dataR; unsigned long out_cnt = 320; // printf("Received %d bytes in %d samples\n", byte_cnt, samp_cnt); //spec = snd_hdr->spec; // misc flags // 0x80: AVI vs QT // 0x8: ulaw translation // 0x4: 8-bit sound // 0x2: signed/unsigned // 0x1: big-endian // inc = snd_hdr->inc; // inc_cnt = snd_hdr->inc_cnt; // inc_cnt=0; // byte_cnt = snd_hdr->byte_cnt; // samp_cnt = snd_hdr->samp_cnt; // dataL = snd_hdr->dataL; // dataR = snd_hdr->dataR; // ibuf = snd_hdr->snd; // ibuf += byte_cnt; while(ocnt < buff_size) { // if (inc_cnt < (1<<24)) // { if (flag == 0) { unsigned long icnt; if(byte_cnt<=0) return(ocnt); /* Quicktime and AVI used different formats */ // if (spec & 0x80) XA_MSGSM_Decoder(&gsm_state, ibuf, gsm_buf, &icnt, &out_cnt); // printf("Read %d bytes into decoder\n", icnt); // else // XA_GSM_Decoder(&gsm_state, ibuf, gsm_buf, &icnt, &out_cnt); ibuf += icnt; byte_cnt -= icnt; samp_cnt--; } /*** Decode Sample and increment byte_cnt ***/ if (flag < out_cnt) dataL = (unsigned long)gsm_buf[ flag ]; else /* ERROR */ dataL = 0; flag++; if (flag >= out_cnt) flag = 0; // inc_cnt += inc; // } // while(inc_cnt >= (1<<24)) // { /*** Output Sample ***/ // if (spec & 4) /* 1 byte output */ // { unsigned char d0 = ((unsigned long)(dataL) >> 8) & 0xff; // if (spec & 8) *obuf++ = xa_sign_2_ulaw[ (unsigned long)(d0) ]; // else *obuf++ = (spec & 2)?(d0 ^ 0x80):(d0); // } // else { unsigned char d1,d0; d1 = (dataL>>8) & 0xff; d0 = dataL & 0xff; // if (spec & 0x02) // d1 ^= 0x80; // if (spec & 0x01) // { // *obuf++ = d0; *obuf++ = d1; // } // else // { *(short*)(obuf)=dataL;//^0x8000; obuf+=2; // *obuf++ = d1; *obuf++ = d0; // } // } ocnt+=2; // inc_cnt -= (1<<24); if (ocnt >= buff_size) break; }//while(inc_cnt>=(1<<24)) // if (samp_cnt <= 0) // return(ocnt); // { // if ( (snd_hdr = XA_Audio_Next_Snd(snd_hdr)) != 0) // { // snd_hdr->inc_cnt = inc_cnt; // snd_hdr->dataL = dataL; // snd_hdr->dataR = dataL; // ocnt = snd_hdr->delta(snd_hdr,obuf,ocnt,buff_size); // } // return(ocnt); // }//if (sa }//big while(ocntinc_cnt = inc_cnt; snd_hdr->byte_cnt = byte_cnt; snd_hdr->samp_cnt = samp_cnt; snd_hdr->dataL = dataL; snd_hdr->dataR = dataL; */ return(ocnt); } /* Table 4.3b Quantization levels of the LTP gain quantizer */ /* bc 0 1 2 3 */ static const word gsm_QLB[4] = { 3277, 11469, 21299, 32767 }; /* Table 4.6 Normalized direct mantissa used to compute xM/xmax */ /* i 0 1 2 3 4 5 6 7 */ static const word gsm_FAC[8] = { 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767 }; /****************/ #define saturate(x) \ ((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x)) /****************/ static word gsm_sub (a,b) word a; word b; { longword diff = (longword)a - (longword)b; return saturate(diff); } /****************/ static word gsm_asr (a,n) word a; int n; { if (n >= 16) return -(a < 0); if (n <= -16) return 0; if (n < 0) return a << -n; # ifdef SASR return a >> n; # else if (a >= 0) return a >> n; else return -(word)( -(uword)a >> n ); # endif } /****************/ static word gsm_asl (a,n) word a; int n; { if (n >= 16) return 0; if (n <= -16) return -(a < 0); if (n < 0) return gsm_asr(a, -n); return a << n; } /* * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische * Universitaet Berlin. See the accompanying file "COPYRIGHT" for * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. */ /**** 4.2.17 */ static void RPE_grid_positioning(Mc,xMp,ep) word Mc; /* grid position IN */ register word * xMp; /* [0..12] IN */ register word * ep; /* [0..39] OUT */ /* * This procedure computes the reconstructed long term residual signal * ep[0..39] for the LTP analysis filter. The inputs are the Mc * which is the grid position selection and the xMp[0..12] decoded * RPE samples which are upsampled by a factor of 3 by inserting zero * values. */ { int i = 13; assert(0 <= Mc && Mc <= 3); switch (Mc) { case 3: *ep++ = 0; case 2: do { *ep++ = 0; case 1: *ep++ = 0; case 0: *ep++ = *xMp++; } while (--i); } while (++Mc < 4) *ep++ = 0; /* int i, k; for (k = 0; k <= 39; k++) ep[k] = 0; for (i = 0; i <= 12; i++) { ep[ Mc + (3*i) ] = xMp[i]; } */ } /**** 4.2.16 */ static void APCM_inverse_quantization (xMc,mant,exp,xMp) register word * xMc; /* [0..12] IN */ word mant; word exp; register word * xMp; /* [0..12] OUT */ /* * This part is for decoding the RPE sequence of coded xMc[0..12] * samples to obtain the xMp[0..12] array. Table 4.6 is used to get * the mantissa of xmaxc (FAC[0..7]). */ { int i; word temp, temp1, temp2, temp3; longword ltmp; assert( mant >= 0 && mant <= 7 ); temp1 = gsm_FAC[ mant ]; /* see 4.2-15 for mant */ temp2 = gsm_sub( 6, exp ); /* see 4.2-15 for exp */ temp3 = gsm_asl( 1, gsm_sub( temp2, 1 )); for (i = 13; i--;) { assert( *xMc <= 7 && *xMc >= 0 ); /* 3 bit unsigned */ /* temp = gsm_sub( *xMc++ << 1, 7 ); */ temp = (*xMc++ << 1) - 7; /* restore sign */ assert( temp <= 7 && temp >= -7 ); /* 4 bit signed */ temp <<= 12; /* 16 bit signed */ temp = GSM_MULT_R( temp1, temp ); temp = GSM_ADD( temp, temp3 ); *xMp++ = gsm_asr( temp, temp2 ); } } /**** 4.12.15 */ static void APCM_quantization_xmaxc_to_exp_mant (xmaxc,exp_out,mant_out) word xmaxc; /* IN */ word * exp_out; /* OUT */ word * mant_out; /* OUT */ { word exp, mant; /* Compute exponent and mantissa of the decoded version of xmaxc */ exp = 0; if (xmaxc > 15) exp = SASR(xmaxc, 3) - 1; mant = xmaxc - (exp << 3); if (mant == 0) { exp = -4; mant = 7; } else { while (mant <= 7) { mant = mant << 1 | 1; exp--; } mant -= 8; } assert( exp >= -4 && exp <= 6 ); assert( mant >= 0 && mant <= 7 ); *exp_out = exp; *mant_out = mant; } static void Gsm_RPE_Decoding (S, xmaxcr, Mcr, xMcr, erp) XA_GSM_STATE * S; word xmaxcr; word Mcr; word * xMcr; /* [0..12], 3 bits IN */ word * erp; /* [0..39] OUT */ { word exp, mant; word xMp[ 13 ]; APCM_quantization_xmaxc_to_exp_mant( xmaxcr, &exp, &mant ); APCM_inverse_quantization( xMcr, mant, exp, xMp ); RPE_grid_positioning( Mcr, xMp, erp ); } /* * 4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER */ static void Postprocessing(S,s) XA_GSM_STATE * S; register word * s; { register int k; register word msr = S->msr; register longword ltmp; /* for GSM_ADD */ register word tmp; for (k = 160; k--; s++) { tmp = GSM_MULT_R( msr, 28180 ); msr = GSM_ADD(*s, tmp); /* Deemphasis */ *s = GSM_ADD(msr, msr) & 0xFFF8; /* Truncation & Upscaling */ } S->msr = msr; } /**** 4.3.2 */ static void Gsm_Long_Term_Synthesis_Filtering (S,Ncr,bcr,erp,drp) XA_GSM_STATE * S; word Ncr; word bcr; register word * erp; /* [0..39] IN */ register word * drp; /* [-120..-1] IN, [-120..40] OUT */ /* * This procedure uses the bcr and Ncr parameter to realize the * long term synthesis filtering. The decoding of bcr needs * table 4.3b. */ { register longword ltmp; /* for ADD */ register int k; word brp, drpp, Nr; /* Check the limits of Nr. */ Nr = Ncr < 40 || Ncr > 120 ? S->nrp : Ncr; S->nrp = Nr; assert(Nr >= 40 && Nr <= 120); /* Decoding of the LTP gain bcr */ brp = gsm_QLB[ bcr ]; /* Computation of the reconstructed short term residual * signal drp[0..39] */ assert(brp != MIN_WORD); for (k = 0; k <= 39; k++) { drpp = GSM_MULT_R( brp, drp[ k - Nr ] ); drp[k] = GSM_ADD( erp[k], drpp ); } /* * Update of the reconstructed short term residual signal * drp[ -1..-120 ] */ for (k = 0; k <= 119; k++) drp[ -120 + k ] = drp[ -80 + k ]; } static void Short_term_synthesis_filtering (S,rrp,k,wt,sr) XA_GSM_STATE *S; register word *rrp; /* [0..7] IN */ register int k; /* k_end - k_start */ register word *wt; /* [0..k-1] IN */ register word *sr; /* [0..k-1] OUT */ { register word * v = S->v; register int i; register word sri, tmp1, tmp2; register longword ltmp; /* for GSM_ADD & GSM_SUB */ while (k--) { sri = *wt++; for (i = 8; i--;) { /* sri = GSM_SUB( sri, gsm_mult_r( rrp[i], v[i] ) ); */ tmp1 = rrp[i]; tmp2 = v[i]; tmp2 = ( tmp1 == MIN_WORD && tmp2 == MIN_WORD ? MAX_WORD : 0x0FFFF & (( (longword)tmp1 * (longword)tmp2 + 16384) >> 15)) ; sri = GSM_SUB( sri, tmp2 ); /* v[i+1] = GSM_ADD( v[i], gsm_mult_r( rrp[i], sri ) ); */ tmp1 = ( tmp1 == MIN_WORD && sri == MIN_WORD ? MAX_WORD : 0x0FFFF & (( (longword)tmp1 * (longword)sri + 16384) >> 15)) ; v[i+1] = GSM_ADD( v[i], tmp1); } *sr++ = v[0] = sri; } } /* 4.2.8 */ static void Decoding_of_the_coded_Log_Area_Ratios (LARc,LARpp) word * LARc; /* coded log area ratio [0..7] IN */ word * LARpp; /* out: decoded .. */ { register word temp1 /* , temp2 */; register long ltmp; /* for GSM_ADD */ /* This procedure requires for efficient implementation * two tables. * * INVA[1..8] = integer( (32768 * 8) / real_A[1..8]) * MIC[1..8] = minimum value of the LARc[1..8] */ /* Compute the LARpp[1..8] */ /* for (i = 1; i <= 8; i++, B++, MIC++, INVA++, LARc++, LARpp++) { * * temp1 = GSM_ADD( *LARc, *MIC ) << 10; * temp2 = *B << 1; * temp1 = GSM_SUB( temp1, temp2 ); * * assert(*INVA != MIN_WORD); * * temp1 = GSM_MULT_R( *INVA, temp1 ); * *LARpp = GSM_ADD( temp1, temp1 ); * } */ #undef STEP #define STEP( B, MIC, INVA ) \ temp1 = GSM_ADD( *LARc++, MIC ) << 10; \ temp1 = GSM_SUB( temp1, B << 1 ); \ temp1 = GSM_MULT_R( INVA, temp1 ); \ *LARpp++ = GSM_ADD( temp1, temp1 ); STEP( 0, -32, 13107 ); STEP( 0, -32, 13107 ); STEP( 2048, -16, 13107 ); STEP( -2560, -16, 13107 ); STEP( 94, -8, 19223 ); STEP( -1792, -8, 17476 ); STEP( -341, -4, 31454 ); STEP( -1144, -4, 29708 ); /* NOTE: the addition of *MIC is used to restore * the sign of *LARc. */ } /* 4.2.9 */ /* Computation of the quantized reflection coefficients */ /* 4.2.9.1 Interpolation of the LARpp[1..8] to get the LARp[1..8] */ /* * Within each frame of 160 analyzed speech samples the short term * analysis and synthesis filters operate with four different sets of * coefficients, derived from the previous set of decoded LARs(LARpp(j-1)) * and the actual set of decoded LARs (LARpp(j)) * * (Initial value: LARpp(j-1)[1..8] = 0.) */ static void Coefficients_0_12 (LARpp_j_1, LARpp_j, LARp) register word * LARpp_j_1; register word * LARpp_j; register word * LARp; { register int i; register longword ltmp; for (i = 1; i <= 8; i++, LARp++, LARpp_j_1++, LARpp_j++) { *LARp = GSM_ADD( SASR( *LARpp_j_1, 2 ), SASR( *LARpp_j, 2 )); *LARp = GSM_ADD( *LARp, SASR( *LARpp_j_1, 1)); } } static void Coefficients_13_26 (LARpp_j_1, LARpp_j, LARp) register word * LARpp_j_1; register word * LARpp_j; register word * LARp; { register int i; register longword ltmp; for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) { *LARp = GSM_ADD( SASR( *LARpp_j_1, 1), SASR( *LARpp_j, 1 )); } } static void Coefficients_27_39 (LARpp_j_1, LARpp_j, LARp) register word * LARpp_j_1; register word * LARpp_j; register word * LARp; { register int i; register longword ltmp; for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) { *LARp = GSM_ADD( SASR( *LARpp_j_1, 2 ), SASR( *LARpp_j, 2 )); *LARp = GSM_ADD( *LARp, SASR( *LARpp_j, 1 )); } } static void Coefficients_40_159 (LARpp_j, LARp) register word * LARpp_j; register word * LARp; { register int i; for (i = 1; i <= 8; i++, LARp++, LARpp_j++) *LARp = *LARpp_j; } /* 4.2.9.2 */ static void LARp_to_rp (LARp) register word * LARp; /* [0..7] IN/OUT */ /* * The input of this procedure is the interpolated LARp[0..7] array. * The reflection coefficients, rp[i], are used in the analysis * filter and in the synthesis filter. */ { register int i; register word temp; register longword ltmp; for (i = 1; i <= 8; i++, LARp++) { /* temp = GSM_ABS( *LARp ); * * if (temp < 11059) temp <<= 1; * else if (temp < 20070) temp += 11059; * else temp = GSM_ADD( temp >> 2, 26112 ); * * *LARp = *LARp < 0 ? -temp : temp; */ if (*LARp < 0) { temp = *LARp == MIN_WORD ? MAX_WORD : -(*LARp); *LARp = - ((temp < 11059) ? temp << 1 : ((temp < 20070) ? temp + 11059 : GSM_ADD( temp >> 2, 26112 ))); } else { temp = *LARp; *LARp = (temp < 11059) ? temp << 1 : ((temp < 20070) ? temp + 11059 : GSM_ADD( temp >> 2, 26112 )); } } } /**** */ static void Gsm_Short_Term_Synthesis_Filter (S, LARcr, wt, s) XA_GSM_STATE * S; word * LARcr; /* received log area ratios [0..7] IN */ word * wt; /* received d [0..159] IN */ word * s; /* signal s [0..159] OUT */ { word * LARpp_j = S->LARpp[ S->j ]; word * LARpp_j_1 = S->LARpp[ S->j ^=1 ]; word LARp[8]; #undef FILTER #if defined(FAST) && defined(USE_FLOAT_MUL) # define FILTER (* (S->fast \ ? Fast_Short_term_synthesis_filtering \ : Short_term_synthesis_filtering )) #else # define FILTER Short_term_synthesis_filtering #endif Decoding_of_the_coded_Log_Area_Ratios( LARcr, LARpp_j ); Coefficients_0_12( LARpp_j_1, LARpp_j, LARp ); LARp_to_rp( LARp ); FILTER( S, LARp, 13, wt, s ); Coefficients_13_26( LARpp_j_1, LARpp_j, LARp); LARp_to_rp( LARp ); FILTER( S, LARp, 14, wt + 13, s + 13 ); Coefficients_27_39( LARpp_j_1, LARpp_j, LARp); LARp_to_rp( LARp ); FILTER( S, LARp, 13, wt + 27, s + 27 ); Coefficients_40_159( LARpp_j, LARp ); LARp_to_rp( LARp ); FILTER(S, LARp, 120, wt + 40, s + 40); } static void GSM_Decode(S,LARcr, Ncr,bcr,Mcr,xmaxcr,xMcr,s) XA_GSM_STATE *S; word *LARcr; /* [0..7] IN */ word *Ncr; /* [0..3] IN */ word *bcr; /* [0..3] IN */ word *Mcr; /* [0..3] IN */ word *xmaxcr; /* [0..3] IN */ word *xMcr; /* [0..13*4] IN */ word *s; /* [0..159] OUT */ { int j, k; word erp[40], wt[160]; word *drp = S->dp0 + 120; for (j=0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) { Gsm_RPE_Decoding( S, *xmaxcr, *Mcr, xMcr, erp ); Gsm_Long_Term_Synthesis_Filtering( S, *Ncr, *bcr, erp, drp ); for (k = 0; k <= 39; k++) wt[ j * 40 + k ] = drp[ k ]; } Gsm_Short_Term_Synthesis_Filter( S, LARcr, wt, s ); Postprocessing(S, s); } /****-------------------------------------------------------------------**** **** Podlipec: For AVI/WAV files GSM 6.10 combines two 33 bytes frames **** into one 65 byte frame. ****-------------------------------------------------------------------****/ void XA_MSGSM_Decoder(gsm_state,ibuf,obuf,icnt,ocnt) XA_GSM_STATE *gsm_state; unsigned char *ibuf; word *obuf; ulongword *icnt, *ocnt; { word sr; word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4]; sr = *ibuf++; LARc[0] = sr & 0x3f; sr >>= 6; sr |= (word)*ibuf++ << 2; LARc[1] = sr & 0x3f; sr >>= 6; sr |= (word)*ibuf++ << 4; LARc[2] = sr & 0x1f; sr >>= 5; LARc[3] = sr & 0x1f; sr >>= 5; sr |= (word)*ibuf++ << 2; LARc[4] = sr & 0xf; sr >>= 4; LARc[5] = sr & 0xf; sr >>= 4; sr |= (word)*ibuf++ << 2; /* 5 */ LARc[6] = sr & 0x7; sr >>= 3; LARc[7] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 4; Nc[0] = sr & 0x7f; sr >>= 7; bc[0] = sr & 0x3; sr >>= 2; Mc[0] = sr & 0x3; sr >>= 2; sr |= (word)*ibuf++ << 1; xmaxc[0] = sr & 0x3f; sr >>= 6; xmc[0] = sr & 0x7; sr >>= 3; sr = *ibuf++; xmc[1] = sr & 0x7; sr >>= 3; xmc[2] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 2; xmc[3] = sr & 0x7; sr >>= 3; xmc[4] = sr & 0x7; sr >>= 3; xmc[5] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 1; /* 10 */ xmc[6] = sr & 0x7; sr >>= 3; xmc[7] = sr & 0x7; sr >>= 3; xmc[8] = sr & 0x7; sr >>= 3; sr = *ibuf++; xmc[9] = sr & 0x7; sr >>= 3; xmc[10] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 2; xmc[11] = sr & 0x7; sr >>= 3; xmc[12] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 4; Nc[1] = sr & 0x7f; sr >>= 7; bc[1] = sr & 0x3; sr >>= 2; Mc[1] = sr & 0x3; sr >>= 2; sr |= (word)*ibuf++ << 1; xmaxc[1] = sr & 0x3f; sr >>= 6; xmc[13] = sr & 0x7; sr >>= 3; sr = *ibuf++; /* 15 */ xmc[14] = sr & 0x7; sr >>= 3; xmc[15] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 2; xmc[16] = sr & 0x7; sr >>= 3; xmc[17] = sr & 0x7; sr >>= 3; xmc[18] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 1; xmc[19] = sr & 0x7; sr >>= 3; xmc[20] = sr & 0x7; sr >>= 3; xmc[21] = sr & 0x7; sr >>= 3; sr = *ibuf++; xmc[22] = sr & 0x7; sr >>= 3; xmc[23] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 2; xmc[24] = sr & 0x7; sr >>= 3; xmc[25] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 4; /* 20 */ Nc[2] = sr & 0x7f; sr >>= 7; bc[2] = sr & 0x3; sr >>= 2; Mc[2] = sr & 0x3; sr >>= 2; sr |= (word)*ibuf++ << 1; xmaxc[2] = sr & 0x3f; sr >>= 6; xmc[26] = sr & 0x7; sr >>= 3; sr = *ibuf++; xmc[27] = sr & 0x7; sr >>= 3; xmc[28] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 2; xmc[29] = sr & 0x7; sr >>= 3; xmc[30] = sr & 0x7; sr >>= 3; xmc[31] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 1; xmc[32] = sr & 0x7; sr >>= 3; xmc[33] = sr & 0x7; sr >>= 3; xmc[34] = sr & 0x7; sr >>= 3; sr = *ibuf++; /* 25 */ xmc[35] = sr & 0x7; sr >>= 3; xmc[36] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 2; xmc[37] = sr & 0x7; sr >>= 3; xmc[38] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 4; Nc[3] = sr & 0x7f; sr >>= 7; bc[3] = sr & 0x3; sr >>= 2; Mc[3] = sr & 0x3; sr >>= 2; sr |= (word)*ibuf++ << 1; xmaxc[3] = sr & 0x3f; sr >>= 6; xmc[39] = sr & 0x7; sr >>= 3; sr = *ibuf++; xmc[40] = sr & 0x7; sr >>= 3; xmc[41] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 2; /* 30 */ xmc[42] = sr & 0x7; sr >>= 3; xmc[43] = sr & 0x7; sr >>= 3; xmc[44] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 1; xmc[45] = sr & 0x7; sr >>= 3; xmc[46] = sr & 0x7; sr >>= 3; xmc[47] = sr & 0x7; sr >>= 3; sr = *ibuf++; xmc[48] = sr & 0x7; sr >>= 3; xmc[49] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 2; xmc[50] = sr & 0x7; sr >>= 3; xmc[51] = sr & 0x7; sr >>= 3; GSM_Decode(gsm_state, LARc, Nc, bc, Mc, xmaxc, xmc, obuf); /* carry = sr & 0xf; sr = carry; */ /* 2nd frame */ sr &= 0xf; sr |= (word)*ibuf++ << 4; /* 1 */ LARc[0] = sr & 0x3f; sr >>= 6; LARc[1] = sr & 0x3f; sr >>= 6; sr = *ibuf++; LARc[2] = sr & 0x1f; sr >>= 5; sr |= (word)*ibuf++ << 3; LARc[3] = sr & 0x1f; sr >>= 5; LARc[4] = sr & 0xf; sr >>= 4; sr |= (word)*ibuf++ << 2; LARc[5] = sr & 0xf; sr >>= 4; LARc[6] = sr & 0x7; sr >>= 3; LARc[7] = sr & 0x7; sr >>= 3; sr = *ibuf++; /* 5 */ Nc[0] = sr & 0x7f; sr >>= 7; sr |= (word)*ibuf++ << 1; bc[0] = sr & 0x3; sr >>= 2; Mc[0] = sr & 0x3; sr >>= 2; sr |= (word)*ibuf++ << 5; xmaxc[0] = sr & 0x3f; sr >>= 6; xmc[0] = sr & 0x7; sr >>= 3; xmc[1] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 1; xmc[2] = sr & 0x7; sr >>= 3; xmc[3] = sr & 0x7; sr >>= 3; xmc[4] = sr & 0x7; sr >>= 3; sr = *ibuf++; xmc[5] = sr & 0x7; sr >>= 3; xmc[6] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 2; /* 10 */ xmc[7] = sr & 0x7; sr >>= 3; xmc[8] = sr & 0x7; sr >>= 3; xmc[9] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 1; xmc[10] = sr & 0x7; sr >>= 3; xmc[11] = sr & 0x7; sr >>= 3; xmc[12] = sr & 0x7; sr >>= 3; sr = *ibuf++; Nc[1] = sr & 0x7f; sr >>= 7; sr |= (word)*ibuf++ << 1; bc[1] = sr & 0x3; sr >>= 2; Mc[1] = sr & 0x3; sr >>= 2; sr |= (word)*ibuf++ << 5; xmaxc[1] = sr & 0x3f; sr >>= 6; xmc[13] = sr & 0x7; sr >>= 3; xmc[14] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 1; /* 15 */ xmc[15] = sr & 0x7; sr >>= 3; xmc[16] = sr & 0x7; sr >>= 3; xmc[17] = sr & 0x7; sr >>= 3; sr = *ibuf++; xmc[18] = sr & 0x7; sr >>= 3; xmc[19] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 2; xmc[20] = sr & 0x7; sr >>= 3; xmc[21] = sr & 0x7; sr >>= 3; xmc[22] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 1; xmc[23] = sr & 0x7; sr >>= 3; xmc[24] = sr & 0x7; sr >>= 3; xmc[25] = sr & 0x7; sr >>= 3; sr = *ibuf++; Nc[2] = sr & 0x7f; sr >>= 7; sr |= (word)*ibuf++ << 1; /* 20 */ bc[2] = sr & 0x3; sr >>= 2; Mc[2] = sr & 0x3; sr >>= 2; sr |= (word)*ibuf++ << 5; xmaxc[2] = sr & 0x3f; sr >>= 6; xmc[26] = sr & 0x7; sr >>= 3; xmc[27] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 1; xmc[28] = sr & 0x7; sr >>= 3; xmc[29] = sr & 0x7; sr >>= 3; xmc[30] = sr & 0x7; sr >>= 3; sr = *ibuf++; xmc[31] = sr & 0x7; sr >>= 3; xmc[32] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 2; xmc[33] = sr & 0x7; sr >>= 3; xmc[34] = sr & 0x7; sr >>= 3; xmc[35] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 1; /* 25 */ xmc[36] = sr & 0x7; sr >>= 3; xmc[37] = sr & 0x7; sr >>= 3; xmc[38] = sr & 0x7; sr >>= 3; sr = *ibuf++; Nc[3] = sr & 0x7f; sr >>= 7; sr |= (word)*ibuf++ << 1; bc[3] = sr & 0x3; sr >>= 2; Mc[3] = sr & 0x3; sr >>= 2; sr |= (word)*ibuf++ << 5; xmaxc[3] = sr & 0x3f; sr >>= 6; xmc[39] = sr & 0x7; sr >>= 3; xmc[40] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 1; xmc[41] = sr & 0x7; sr >>= 3; xmc[42] = sr & 0x7; sr >>= 3; xmc[43] = sr & 0x7; sr >>= 3; sr = (word)*ibuf++; /* 30 */ xmc[44] = sr & 0x7; sr >>= 3; xmc[45] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 2; xmc[46] = sr & 0x7; sr >>= 3; xmc[47] = sr & 0x7; sr >>= 3; xmc[48] = sr & 0x7; sr >>= 3; sr |= (word)*ibuf++ << 1; xmc[49] = sr & 0x7; sr >>= 3; xmc[50] = sr & 0x7; sr >>= 3; xmc[51] = sr & 0x7; sr >>= 3; GSM_Decode(gsm_state, LARc, Nc, bc, Mc, xmaxc, xmc, &obuf[160]); /* Return number of source bytes consumed and output samples produced */ *icnt = 65; *ocnt = 320; return; } #define GSM_MAGIC 0xd void XA_GSM_Decoder(gsm_state,ibuf,obuf,icnt,ocnt) XA_GSM_STATE *gsm_state; unsigned char *ibuf; word *obuf; ulongword *icnt, *ocnt; { word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4]; /* Sanity */ if (((*ibuf >> 4) & 0x0F) != GSM_MAGIC) { int i; for(i=0;i<160;i++) obuf[i] = 0; *icnt = 33; *ocnt = 160; return; } LARc[0] = (*ibuf++ & 0xF) << 2; /* 1 */ LARc[0] |= (*ibuf >> 6) & 0x3; LARc[1] = *ibuf++ & 0x3F; LARc[2] = (*ibuf >> 3) & 0x1F; LARc[3] = (*ibuf++ & 0x7) << 2; LARc[3] |= (*ibuf >> 6) & 0x3; LARc[4] = (*ibuf >> 2) & 0xF; LARc[5] = (*ibuf++ & 0x3) << 2; LARc[5] |= (*ibuf >> 6) & 0x3; LARc[6] = (*ibuf >> 3) & 0x7; LARc[7] = *ibuf++ & 0x7; Nc[0] = (*ibuf >> 1) & 0x7F; bc[0] = (*ibuf++ & 0x1) << 1; bc[0] |= (*ibuf >> 7) & 0x1; Mc[0] = (*ibuf >> 5) & 0x3; xmaxc[0] = (*ibuf++ & 0x1F) << 1; xmaxc[0] |= (*ibuf >> 7) & 0x1; xmc[0] = (*ibuf >> 4) & 0x7; xmc[1] = (*ibuf >> 1) & 0x7; xmc[2] = (*ibuf++ & 0x1) << 2; xmc[2] |= (*ibuf >> 6) & 0x3; xmc[3] = (*ibuf >> 3) & 0x7; xmc[4] = *ibuf++ & 0x7; xmc[5] = (*ibuf >> 5) & 0x7; xmc[6] = (*ibuf >> 2) & 0x7; xmc[7] = (*ibuf++ & 0x3) << 1; /* 10 */ xmc[7] |= (*ibuf >> 7) & 0x1; xmc[8] = (*ibuf >> 4) & 0x7; xmc[9] = (*ibuf >> 1) & 0x7; xmc[10] = (*ibuf++ & 0x1) << 2; xmc[10] |= (*ibuf >> 6) & 0x3; xmc[11] = (*ibuf >> 3) & 0x7; xmc[12] = *ibuf++ & 0x7; Nc[1] = (*ibuf >> 1) & 0x7F; bc[1] = (*ibuf++ & 0x1) << 1; bc[1] |= (*ibuf >> 7) & 0x1; Mc[1] = (*ibuf >> 5) & 0x3; xmaxc[1] = (*ibuf++ & 0x1F) << 1; xmaxc[1] |= (*ibuf >> 7) & 0x1; xmc[13] = (*ibuf >> 4) & 0x7; xmc[14] = (*ibuf >> 1) & 0x7; xmc[15] = (*ibuf++ & 0x1) << 2; xmc[15] |= (*ibuf >> 6) & 0x3; xmc[16] = (*ibuf >> 3) & 0x7; xmc[17] = *ibuf++ & 0x7; xmc[18] = (*ibuf >> 5) & 0x7; xmc[19] = (*ibuf >> 2) & 0x7; xmc[20] = (*ibuf++ & 0x3) << 1; xmc[20] |= (*ibuf >> 7) & 0x1; xmc[21] = (*ibuf >> 4) & 0x7; xmc[22] = (*ibuf >> 1) & 0x7; xmc[23] = (*ibuf++ & 0x1) << 2; xmc[23] |= (*ibuf >> 6) & 0x3; xmc[24] = (*ibuf >> 3) & 0x7; xmc[25] = *ibuf++ & 0x7; Nc[2] = (*ibuf >> 1) & 0x7F; bc[2] = (*ibuf++ & 0x1) << 1; /* 20 */ bc[2] |= (*ibuf >> 7) & 0x1; Mc[2] = (*ibuf >> 5) & 0x3; xmaxc[2] = (*ibuf++ & 0x1F) << 1; xmaxc[2] |= (*ibuf >> 7) & 0x1; xmc[26] = (*ibuf >> 4) & 0x7; xmc[27] = (*ibuf >> 1) & 0x7; xmc[28] = (*ibuf++ & 0x1) << 2; xmc[28] |= (*ibuf >> 6) & 0x3; xmc[29] = (*ibuf >> 3) & 0x7; xmc[30] = *ibuf++ & 0x7; xmc[31] = (*ibuf >> 5) & 0x7; xmc[32] = (*ibuf >> 2) & 0x7; xmc[33] = (*ibuf++ & 0x3) << 1; xmc[33] |= (*ibuf >> 7) & 0x1; xmc[34] = (*ibuf >> 4) & 0x7; xmc[35] = (*ibuf >> 1) & 0x7; xmc[36] = (*ibuf++ & 0x1) << 2; xmc[36] |= (*ibuf >> 6) & 0x3; xmc[37] = (*ibuf >> 3) & 0x7; xmc[38] = *ibuf++ & 0x7; Nc[3] = (*ibuf >> 1) & 0x7F; bc[3] = (*ibuf++ & 0x1) << 1; bc[3] |= (*ibuf >> 7) & 0x1; Mc[3] = (*ibuf >> 5) & 0x3; xmaxc[3] = (*ibuf++ & 0x1F) << 1; xmaxc[3] |= (*ibuf >> 7) & 0x1; xmc[39] = (*ibuf >> 4) & 0x7; xmc[40] = (*ibuf >> 1) & 0x7; xmc[41] = (*ibuf++ & 0x1) << 2; xmc[41] |= (*ibuf >> 6) & 0x3; xmc[42] = (*ibuf >> 3) & 0x7; xmc[43] = *ibuf++ & 0x7; /* 30 */ xmc[44] = (*ibuf >> 5) & 0x7; xmc[45] = (*ibuf >> 2) & 0x7; xmc[46] = (*ibuf++ & 0x3) << 1; xmc[46] |= (*ibuf >> 7) & 0x1; xmc[47] = (*ibuf >> 4) & 0x7; xmc[48] = (*ibuf >> 1) & 0x7; xmc[49] = (*ibuf++ & 0x1) << 2; xmc[49] |= (*ibuf >> 6) & 0x3; xmc[50] = (*ibuf >> 3) & 0x7; xmc[51] = *ibuf & 0x7; /* 33 */ GSM_Decode(gsm_state, LARc, Nc, bc, Mc, xmaxc, xmc, obuf); /* Return number of source bytes consumed and output samples produced */ *icnt = 33; *ocnt = 160; } avifile-0.7.48~20090503.ds/plugins/libaudiodec/xa_gsm.h0000644000175000017500000000654707233220543021331 0ustar yavoryavor/******************************************************************** * * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische * Universitaet Berlin. See the accompanying file "COPYRIGHT" for * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. * ********************************************************************/ #include "xa_gsm_state.h" typedef short word; /* 16 bit signed int */ typedef int longword; /* 32 bit signed int */ typedef unsigned short uword; /* unsigned word */ typedef unsigned int ulongword; /* unsigned longword */ typedef struct { word dp0[ 280 ]; word z1; /* preprocessing.c, Offset_com. */ longword L_z2; /* Offset_com. */ int mp; /* Preemphasis */ word u[8]; /* short_term_aly_filter.c */ word LARpp[2][8]; /* */ word j; /* */ word ltp_cut; /* long_term.c, LTP crosscorr. */ word nrp; /* 40 */ /* long_term.c, synthesis */ word v[9]; /* short_term.c, synthesis */ word msr; /* decoder.c, Postprocessing */ char verbose; /* only used if !NDEBUG */ char fast; /* only used if FAST */ char wav_fmt; /* only used if WAV49 defined */ unsigned char frame_index; /* odd/even chaining */ unsigned char frame_chain; /* half-byte to carry forward */ } XA_GSM_STATE; #define MIN_WORD (-32767 - 1) #define MAX_WORD 32767 #define MIN_LONGWORD (-2147483647 - 1) #define MAX_LONGWORD 2147483647 #ifdef SASR /* flag: >> is a signed arithmetic shift right */ #undef SASR #define SASR(x, by) ((x) >> (by)) #else #define SASR(x, by) ((x) >= 0 ? (x) >> (by) : (~(-((x) + 1) >> (by)))) #endif /* SASR */ /* * Inlined functions from add.h */ /* * #define GSM_MULT_R(a, b) (* word a, word b, !(a == b == MIN_WORD) *) \ * (0x0FFFF & SASR(((longword)(a) * (longword)(b) + 16384), 15)) */ #define GSM_MULT_R(a, b) /* word a, word b, !(a == b == MIN_WORD) */ \ (SASR( ((longword)(a) * (longword)(b) + 16384), 15 )) # define GSM_MULT(a,b) /* word a, word b, !(a == b == MIN_WORD) */ \ (SASR( ((longword)(a) * (longword)(b)), 15 )) # define GSM_L_MULT(a, b) /* word a, word b */ \ (((longword)(a) * (longword)(b)) << 1) # define GSM_L_ADD(a, b) \ ( (a) < 0 ? ( (b) >= 0 ? (a) + (b) \ : (utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1)) \ >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)utmp-2 ) \ : ((b) <= 0 ? (a) + (b) \ : (utmp = (ulongword)(a) + (ulongword)(b)) >= MAX_LONGWORD \ ? MAX_LONGWORD : utmp)) /* * # define GSM_ADD(a, b) \ * ((ltmp = (longword)(a) + (longword)(b)) >= MAX_WORD \ * ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp) */ /* Nonportable, but faster: */ #define GSM_ADD(a, b) \ ((ulongword)((ltmp = (longword)(a) + (longword)(b)) - MIN_WORD) > \ MAX_WORD - MIN_WORD ? (ltmp > 0 ? MAX_WORD : MIN_WORD) : ltmp) # define GSM_SUB(a, b) \ ((ltmp = (longword)(a) - (longword)(b)) >= MAX_WORD \ ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp) # define GSM_ABS(a) ((a) < 0 ? ((a) == MIN_WORD ? MAX_WORD : -(a)) : (a)) /* Use these if necessary: # define GSM_MULT_R(a, b) gsm_mult_r(a, b) # define GSM_MULT(a, b) gsm_mult(a, b) # define GSM_L_MULT(a, b) gsm_L_mult(a, b) # define GSM_L_ADD(a, b) gsm_L_add(a, b) # define GSM_ADD(a, b) gsm_add(a, b) # define GSM_SUB(a, b) gsm_sub(a, b) # define GSM_ABS(a) gsm_abs(a) */ avifile-0.7.48~20090503.ds/plugins/libaudiodec/xa_gsm_state.h0000644000175000017500000000033510015352634022515 0ustar yavoryavor#ifdef __cplusplus extern "C" #endif unsigned long XA_ADecode_GSMM_PCMxM( long byte_cnt, long samp_cnt, char* ibuf, unsigned char* obuf, unsigned long buff_size); #ifdef __cplusplus extern "C" #endif void GSM_Init(void); avifile-0.7.48~20090503.ds/plugins/libdivx4/0000755000175000017500000000000011267646347017167 5ustar yavoryavoravifile-0.7.48~20090503.ds/plugins/libdivx4/Makefile.am0000755000175000017500000000076611110406017021206 0ustar yavoryavorif AMM_USE_DIVX pkglib_LTLIBRARIES = divx4.la check_PROGRAMS = test endif noinst_HEADERS = fillplugins.h divx4_la_SOURCES = divx4.cpp divx4_la_LIBADD = ../../lib/libaviplay.la divx4_la_LDFLAGS = -avoid-version -module AM_CPPFLAGS = -DLINUX $(DIVX_CFLAGS) AM_CXXFLAGS = $(CXXRTTIEXCEPT) if AMM_USE_DIVXBIN AM_CPPFLAGS += -DDIVXBIN divx4_la_LIBADD += $(DL_LIBS) else divx4_la_LIBADD += $(DIVX_LIBS) endif test_SOURCES = test.cpp test_LDFLAGS = $(divx4_la_LIBADD) MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libdivx4/divx4.cpp0000755000175000017500000005225111167340245020724 0ustar yavoryavor#include "fillplugins.h" #include "videodecoder.h" #include "videoencoder.h" #include "avm_fourcc.h" #include "configfile.h" #include "avm_output.h" #include "plugin.h" #include #include #include AVM_BEGIN_NAMESPACE; #ifdef DIVXBIN #include static const char* divxdecore = "libdivxdecore.so.0"; static const char* divxencore = "libdivxencore.so.0"; #endif /* DIVXBIN */ PLUGIN_TEMP(divx4); static const int DIVX4_MAX_QUALITY = 6; static const char* strDebugEnc = "DivX4 plugin"; #ifndef DECORE_VERSION #define DECORE_VERSION 0 #endif #if DECORE_VERSION >= 20021112 typedef void* divxhandle_t; typedef int divxopts_t; #else extern "C" int quiet_encore; typedef unsigned long divxhandle_t; typedef unsigned long divxopts_t; #endif #ifdef HAVE_LIBDIVXDECORE class DIVX_VideoDecoder: public IVideoDecoder, public IRtConfig { void* m_pDll; divxhandle_t m_Handle; int m_iLastPPMode; int m_iMaxAuto; int m_iLastBrightness; int m_iLastContrast; int m_iLastSaturation; // bool m_bCompatWMV2; bool m_bCompat311; bool m_bSetFlg; bool m_bFlip; char m_cFormatBuf[128]; avm::vector m_YvAttrs; typedef int STDCALL (*pDecoreFun)(divxhandle_t handle, // handle - the handle of the calling entity, must be unique divxopts_t dec_opt, // dec_opt - the option for docoding, see below void *param1, // param1 - the parameter 1 (it's actually meaning depends on dec_opt void *param2); // param2 - the parameter 2 (it's actually meaning depends on dec_opt pDecoreFun m_pDecore; public: DIVX_VideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& bh, int flip) : IVideoDecoder(info, bh), m_pDll(0), m_Handle(0), m_iLastPPMode(0), m_iLastBrightness(0), m_iLastContrast(0), m_iLastSaturation(0), m_bSetFlg(true), m_bFlip(flip) { } virtual ~DIVX_VideoDecoder() { Stop(); #ifdef DIVXBIN if (m_pDll) dlclose(m_pDll); #endif } int init() { #ifdef DIVXBIN if (!m_pDll && !(m_pDll = dlopen(divxdecore, RTLD_LAZY))) { divx4_error_set("can't open %s", divxdecore); return -1; } if (!(m_pDecore = (pDecoreFun) dlsym(m_pDll, "decore"))) { divx4_error_set("can't resolve %s:decore", divxdecore); return -1; } int ver = m_pDecore(0, DEC_OPT_VERSION, 0, 0); if ((DECORE_VERSION == 20020322 && ver != 2)) { divx4_error_set("plugin version %d is different from %s library version %d!", DECORE_VERSION, divxdecore, ver); return -1; } #else m_pDecore = decore; #endif switch(m_Dest.biCompression) { #ifdef USE_311_DECODER case fccdiv3: case fccDIV3: case fccdiv4: case fccDIV4: case fccdiv5: case fccDIV5: case fccdiv6: case fccDIV6: case fccMP41: case fccMP43: m_bCompat311=true; // m_bCompatWMV2=false; break; // case fccWMV2: // m_bCompat311=true; // m_bCompatWMV2=true; // break; #endif default: m_bCompat311=false; break; } memset(m_cFormatBuf, 0, sizeof(m_cFormatBuf)); memcpy(m_cFormatBuf, ((const char*)&m_Dest) + sizeof(BITMAPINFOHEADER), m_Dest.biSize - sizeof(BITMAPINFOHEADER)); m_Dest.SetBits(24); if (m_bFlip) m_Dest.biHeight *= -1; PluginGetAttrInt(m_Info, divx4str_postprocessing, &m_iLastPPMode); PluginGetAttrInt(m_Info, divx4str_maxauto, &m_iMaxAuto); PluginGetAttrInt(m_Info, divx4str_brightness, &m_iLastBrightness); PluginGetAttrInt(m_Info, divx4str_contrast, &m_iLastContrast); PluginGetAttrInt(m_Info, divx4str_saturation, &m_iLastSaturation); m_YvAttrs.push_back(AttributeInfo(divx4str_postprocessing, "Image postprocessing mode (6 slowest)", AttributeInfo::Integer, 0, 6)); m_YvAttrs.push_back(AttributeInfo(divx4str_maxauto, "Maximum autoquality level", AttributeInfo::Integer, 0, 6, 6)); return 0; } void Flush() { #ifdef DEC_OPT_FLUSH if (m_Handle) m_pDecore(m_Handle, (divxopts_t)DEC_OPT_FLUSH, 0, 0); #endif } virtual CAPS GetCapabilities() const { return CAPS(CAP_YV12|CAP_YUY2); } virtual IRtConfig* GetRtConfig() { return this; } virtual int Start() { fprintf(stderr,"Decore START %d\n", DECORE_VERSION); #if DECORE_VERSION >= 20021112 DEC_INIT dinit; memset(&dinit, 0, sizeof(dinit)); switch(m_Info.fourcc) { case fccDIV3: dinit.codec_version = 311; break; case fccDIVX: dinit.codec_version = 412; break; default: case fccDX50: dinit.codec_version = 500; break; } AVM_WRITE(strDebugEnc, "Decore Version %d\n", dinit.codec_version); int result = m_pDecore(&m_Handle, (divxopts_t)DEC_OPT_INIT, &dinit, 0); if (result || !m_Handle) { divx4_error_set("Error %d creating decoder instance", result); return -1; } if ((result = m_pDecore(m_Handle, (divxopts_t)DEC_OPT_SETOUT, &m_Dest, 0))) { // unacceptable color space divx4_error_set("Error %d setting output", result); return -1; } #else /* version < 20021112 */ DEC_PARAM param; memset(¶m, 0, sizeof(param)); uint32_t& csp = m_Dest.biCompression; //AVM_WRITE(strDebugEnc, "csp: 0x%x %.4s bitcount: %d height: %d\n", csp, (char*)&csp, m_Dest.biBitCount, m_Dest.biHeight); if (csp == 0 || csp == 3) { bool up = (m_Dest.biHeight > 0); switch (m_Dest.biBitCount) { case 16: if (csp == 3) { param.output_format = (up) ? DEC_RGB565 : DEC_RGB565_INV; break; } // 16 bit with csp == 0 is 15bit /* fall through */ case 15: param.output_format = (up) ? DEC_RGB555 : DEC_RGB555_INV; break; case 24: param.output_format = (up) ? DEC_RGB24 : DEC_RGB24_INV; break; case 32: param.output_format = (up) ? DEC_RGB32 : DEC_RGB32_INV; break; default: return -1; } } else { switch (csp) { case IMG_FMT_I420: param.output_format = DEC_420; break; case IMG_FMT_YV12: param.output_format = DEC_YV12; break; case IMG_FMT_YUY2: param.output_format = DEC_YUV2; break; case IMG_FMT_I422: case IMG_FMT_UYVY: param.output_format = DEC_UYVY; break; default: return -1; } } param.x_dim = m_Dest.biWidth; param.y_dim = labs(m_Dest.biHeight); param.time_incr = 15; // DEC_MEM_REQS dmr; // decore((unsigned long)this, DEC_OPT_MEMORY_REQS, &dmr, 0); memset(¶m.buffers, 0, sizeof(param.buffers)); #if DECORE_VERSION >= 20020303 switch(m_Info.fourcc) { case fccDIV3: param.codec_version = 311; break; case fccDIVX: param.codec_version = 412; break; default: case fccDX50: param.codec_version = 500; break; } param.build_number = 0; #endif /* 20020303 */ m_Handle = (divxhandle_t) this; m_pDecore(m_Handle, DEC_OPT_INIT, ¶m, m_cFormatBuf); #endif /* 20021112 */ return 0; } virtual int Stop() { #if DECORE_VERSION >= 20021112 if (!m_Handle) return -1; m_pDecore(m_Handle, (divxopts_t)DEC_OPT_RELEASE, 0, 0); #else /* 20021112 */ if (!m_Handle) return -1; #if DECORE_VERSION > 20011009 // older DivX4 release has been broken and crashed here - // so release memory only with newer versions // and leave the memory leak with the older version m_pDecore(m_Handle, DEC_OPT_RELEASE, 0, 0); #else /* 20011009 */ #warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #warning !USING OLD DIVX4 library - memory will be unreleased! #warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #endif /* 20011009 */ #endif /* 20021112 */ PluginSetAttrInt(m_Info, divx4str_saturation, m_iLastSaturation); PluginSetAttrInt(m_Info, divx4str_contrast, m_iLastContrast); PluginSetAttrInt(m_Info, divx4str_brightness, m_iLastBrightness); PluginSetAttrInt(m_Info, divx4str_maxauto, m_iMaxAuto); PluginSetAttrInt(m_Info, divx4str_postprocessing, m_iLastPPMode); m_Handle = 0; return 0; } virtual int DecodeFrame(CImage* pImage, const void* src, size_t size, int is_keyframe, bool render = true, CImage** pOut = 0) { DEC_FRAME param; if (!size || !m_Handle) return 0; if (m_Dest.biHeight != pImage->GetFmt()->biHeight) { m_Dest = pImage->GetFmt(); Restart(); } memset(¶m, 0, sizeof(param)); // leave here for some time - until all users will use new headers param.bitstream = const_cast(src); param.length = size; if (pImage) { param.bmp = pImage->Data(); param.stride = pImage->Width(); param.render_flag = 1; } else { param.bmp = 0; param.stride = 0; param.render_flag = 0; } if (m_bSetFlg) { m_bSetFlg = false; #if DECORE_VERSION >= 20021112 int iSetOperation = DEC_ADJ_SET | DEC_ADJ_POSTPROCESSING; int iPP=m_iLastPPMode * 10; m_pDecore(m_Handle, (divxopts_t)DEC_OPT_ADJUST, &iSetOperation, &iPP); iSetOperation = DEC_ADJ_SET | DEC_ADJ_BRIGHTNESS; m_pDecore(m_Handle, (divxopts_t)DEC_OPT_ADJUST, &iSetOperation, &m_iLastBrightness); iSetOperation = DEC_ADJ_SET | DEC_ADJ_CONTRAST; m_pDecore(m_Handle, (divxopts_t)DEC_OPT_ADJUST, &iSetOperation, &m_iLastContrast); iSetOperation = DEC_ADJ_SET | DEC_ADJ_SATURATION; m_pDecore(m_Handle, (divxopts_t)DEC_OPT_ADJUST, &iSetOperation, &m_iLastSaturation); #else /* version < 20021112 */ DEC_SET set; set.postproc_level = m_iLastPPMode * 10; m_pDecore(m_Handle, DEC_OPT_SETPP, &set, 0); #ifdef DEC_OPT_GAMMA m_pDecore(m_Handle, DEC_OPT_GAMMA, (void*)DEC_GAMMA_BRIGHTNESS, (void*)m_iLastBrightness); m_pDecore(m_Handle, DEC_OPT_GAMMA, (void*)DEC_GAMMA_CONTRAST, (void*)m_iLastContrast); m_pDecore(m_Handle, DEC_OPT_GAMMA, (void*)DEC_GAMMA_SATURATION, (void*)m_iLastSaturation); #endif /* DEC_OPT_GAMMA */ #endif /* 20021112 */ } int r; #if DECORE_VERSION >= 20021112 r = m_pDecore(m_Handle, (divxopts_t)DEC_OPT_FRAME, ¶m, 0); #else /* version < 20021112 */ #ifdef USE_311_DECODER #if DECORE_VERSION < 20020303 if(m_bCompat311) { r = m_pDecore(m_Handle, DEC_OPT_FRAME_311, ¶m, 0); } else #endif /* 20020303 */ #endif /* USE_311_DECODER */ { r = m_pDecore(m_Handle, DEC_OPT_FRAME, ¶m, 0); } #endif pImage->SetQuality((float) m_iLastPPMode / DIVX4_MAX_QUALITY); //fprintf(stderr,"Decore result %d\n", r); if (r != 0) { AVM_WRITE(strDebugEnc, "Reinitializing codec\n"); Restart(); // restart codec completely in this case } return size; } virtual int SetDestFmt(int bits = 24, fourcc_t csp = 0) { //AVM_WRITE(strDebugEnc, "SetDestFmt %x %x\n", bits, csp); if (csp) bits = csp; switch (bits) { case 15: case 16: case 24: case 32: m_Dest.SetBits(bits); break; case IMG_FMT_I420: case IMG_FMT_YV12: case IMG_FMT_YUY2: case IMG_FMT_I422: case IMG_FMT_UYVY: m_Dest.SetSpace(bits); break; default: return -1; } #if DECORE_VERSION >= 20021112 if(m_Handle) m_pDecore(m_Handle, (divxopts_t)DEC_OPT_SETOUT, &m_Dest, 0); #else if (m_Handle) Restart(); #endif return 0; } virtual const avm::vector& GetAttrs() const { switch (m_Dest.biCompression) { case IMG_FMT_I420: case IMG_FMT_YV12: // only limited set of supported attrs return m_YvAttrs; } return m_Info.decoder_info; } virtual int GetValue(const char* name, int* value) const { if (strcmp(name, divx4str_postprocessing) == 0) *value = m_iLastPPMode; else if (strcmp(name, divx4str_maxauto) == 0) *value = m_iMaxAuto; else if (strcmp(name, divx4str_brightness) == 0) *value = m_iLastBrightness; else if (strcmp(name, divx4str_contrast) == 0) *value = m_iLastContrast; else if (strcmp(name, divx4str_saturation) == 0) *value = m_iLastSaturation; else return -1; return 0; } virtual int SetValue(const char* name, int value) { if (strcmp(name, divx4str_postprocessing) == 0) { m_iLastPPMode = value; m_bSetFlg = true; return 0; } else if (strcmp(name, divx4str_maxauto) == 0 && value >= 0 && value <= 6) { m_iMaxAuto = value; return 0; } else if (strcmp(name, divx4str_brightness) == 0 && value >= -128 && value <= 127) { m_iLastBrightness = value; m_bSetFlg = true; return 0; } else if (strcmp(name, divx4str_contrast) == 0 && value >= -128 && value <= 127) { m_iLastContrast = value; m_bSetFlg = true; return 0; } else if (strcmp(name, divx4str_saturation) == 0 && value >= -128 && value <= 127) { m_iLastSaturation = value; m_bSetFlg = true; return 0; } return -1; } }; #endif #ifdef HAVE_LIBDIVXENCORE class DIVX_VideoEncoder: public IVideoEncoder { BitmapInfo m_bh; BITMAPINFOHEADER m_obh; void* m_pDll; void* m_pHandle; int m_iState; int m_iQuant; int m_iCSP; bool m_bRtMode; int (*m_pEncore)(void *handle, // handle - the handle of the call int enc_opt, // enc_opt - the option for encodin void *param1, // param1 - the parameter 1 (its a void *param2); // param2 - the parameter 2 (its a public: DIVX_VideoEncoder(const CodecInfo& info, int compressor, const BITMAPINFOHEADER& bh) :IVideoEncoder(info), m_bh(bh), m_obh(bh), m_pDll(0), m_iState(0), m_bRtMode(false) {} virtual ~DIVX_VideoEncoder() { Stop(); #ifdef DIVXBIN if (m_pDll) dlclose(m_pDll); #endif } int init() { #ifdef DIVXBIN m_pDll = dlopen(divxencore, RTLD_LAZY); if (!m_pDll) { divx4_error_set("can't open %s", divxencore); return -1; } m_pEncore = (int (*)(void *, int, void *, void *)) dlsym(m_pDll, "encore"); if (!m_pEncore) { divx4_error_set("can't resolve %s:encore", divxencore); dlclose(m_pDll); return -1; } #else m_pEncore = encore; #endif AVM_WRITE(strDebugEnc, "%s linux encoder\n", (m_Info.fourcc == fccDIVX) ? "DivX4" : "DivX5" ); m_obh.biCompression = m_Info.fourcc; m_obh.biHeight = labs(m_obh.biHeight); #if ENCORE_VERSION < 5200 switch (m_bh.biCompression) { // supports only bottom-up RGB for encoding case 0: if (m_bh.biBitCount != 24) { divx4_error_set("Unsupported input bit depth"); return -1; } m_iCSP = ENC_CSP_RGB24; m_bh.SetDirection(true); break; case fccYUY2: m_iCSP = ENC_CSP_YUY2; break; case fccYV12: m_iCSP = ENC_CSP_YV12; break; case fccI420: m_iCSP = ENC_CSP_I420; break; default: divx4_error_set("Unsupported input format"); return -1; } #else switch (m_bh.biCompression) { // supports only bottom-up RGB for encoding case 0: if (m_bh.biBitCount != 24) { divx4_error_set("Unsupported input bit depth"); return -1; } break; case fccYUY2: case fccYV12: case fccI420: break; default: divx4_error_set("Unsupported input format"); return -1; } #endif return 0; } virtual int Start() { #if ENCORE_MAJOR_VERSION < 5200 ENC_PARAM param; #else SETTINGS param; #endif memset(¶m, 0, sizeof(param)); #if ENCORE_MAJOR_VERSION < 5200 param.x_dim = m_bh.biWidth; //param.y_dim=m_bh.biHeight;// labs(m_bh.biHeight); param.y_dim = labs(m_bh.biHeight); param.framerate = 30;//frames/sec #else param.input_clock = 1000000; param.input_frame_period = 33333; #endif PluginGetAttrInt(m_Info, divx4str_bitrate, ¶m.bitrate);//bits/sec #if ENCORE_MAJOR_VERSION < 5200 PluginGetAttrInt(m_Info, divx4str_rc_period, ¶m.rc_period); PluginGetAttrInt(m_Info, divx4str_rc_reaction_period, ¶m.rc_reaction_period); PluginGetAttrInt(m_Info, divx4str_rc_reaction_ratio, ¶m.rc_reaction_ratio); PluginGetAttrInt(m_Info, divx4str_max_quantizer, ¶m.max_quantizer);//just guess PluginGetAttrInt(m_Info, divx4str_min_quantizer, ¶m.min_quantizer); #endif PluginGetAttrInt(m_Info, divx4str_max_key_interval, ¶m.max_key_interval); PluginGetAttrInt(m_Info, divx4str_quality, ¶m.quality); int deinterlace = 0; int bidirect = 0; int obmc = 0; #if ENCORE_MAJOR_VERSION < 5200 // to be done: all extended parameters of new encore #ifdef IF_SUPPORT_PRO // fast deinterlace PluginGetAttrInt(m_Info, divx4str_deinterlace, &deinterlace); // use bidirectional coding PluginGetAttrInt(m_Info, divx4str_bidirect, &bidirect); // flag to enable overlapped block motion compensation mode PluginGetAttrInt(m_Info, divx4str_obmc, &obmc); #endif /* IF_SUPPORT_PRO */ param.deinterlace = deinterlace; #ifndef ENCORE_MAJOR_VERSION param.use_bidirect = bidirect; param.obmc = obmc; #else /* ENCORE_MAJOR_VERSION */ memset(¶m.extensions, 0, sizeof(param.extensions)); #ifdef IF_SUPPORT_PRO param.extensions.use_bidirect = bidirect; param.extensions.obmc = obmc; #if ENCORE_MAJOR_VERSION >= 5010 PluginGetAttrInt(m_Info, divx4str_enable_crop, ¶m.extensions.enable_crop); PluginGetAttrInt(m_Info, divx4str_crop_left, ¶m.extensions.crop_left); PluginGetAttrInt(m_Info, divx4str_crop_right, ¶m.extensions.crop_right); PluginGetAttrInt(m_Info, divx4str_crop_top, ¶m.extensions.crop_top); PluginGetAttrInt(m_Info, divx4str_crop_bottom, ¶m.extensions.crop_bottom); PluginGetAttrInt(m_Info, divx4str_enable_resize, ¶m.extensions.enable_resize); PluginGetAttrInt(m_Info, divx4str_resize_width, ¶m.extensions.resize_width); PluginGetAttrInt(m_Info, divx4str_resize_height, ¶m.extensions.resize_height); PluginGetAttrInt(m_Info, divx4str_resize_mode, ¶m.extensions.resize_mode); int tmp; PluginGetAttrInt(m_Info, divx4str_resize_bicubic_B, &tmp); param.extensions.bicubic_B = tmp / (double) 1000.0; PluginGetAttrInt(m_Info, divx4str_resize_bicubic_C, &tmp); param.extensions.bicubic_C = tmp / (double) 1000.0; PluginGetAttrInt(m_Info, divx4str_interlace_mode, ¶m.extensions.interlace_mode); PluginGetAttrInt(m_Info, divx4str_temporal_enable, ¶m.extensions.temporal_enable); PluginGetAttrInt(m_Info, divx4str_temporal_level, &tmp); param.extensions.temporal_level = tmp / (double) 1000.0; PluginGetAttrInt(m_Info, divx4str_spatial_passes, ¶m.extensions.spatial_passes); PluginGetAttrInt(m_Info, divx4str_spatial_level, &tmp); param.extensions.spatial_level = tmp / (double) 1000.0; #endif /* ENCORE_MAJOR_VERSION >= 5010 */ #endif /* IF_SUPPORT_PRO */ #endif /* ENCORE_MAJOR_VERSION */ #endif /* 5200 */ if (param.quality == 1) { m_bRtMode=true; int quality = 0;//GetQuality(); m_iQuant=int(1+.003*(10000-quality)); AVM_WRITE(strDebugEnc, "New quant: %d\n", m_iQuant); if(m_iQuant>31) m_iQuant=31; if(m_iQuant<1) m_iQuant=1; } else m_bRtMode=false; // param.flip=1; #if ENCORE_MAJOR_VERSION < 5200 m_pEncore(0, ENC_OPT_INIT, ¶m, 0); m_pHandle=param.handle; #else int result=m_pEncore((void*)&m_pHandle, ENC_OPT_INIT, ¶m, &m_bh); if(result!=ENC_OK) { divx4_error_set("Error %d creating encoder", result); return -1; } #endif return 0; } virtual int Stop() { if (!m_iState) return -1; m_pEncore(m_pHandle, ENC_OPT_RELEASE, 0, 0); m_pHandle = 0; return 0; } virtual size_t GetOutputSize() const { return m_bh.biWidth * labs(m_bh.biHeight) * 4; } virtual const BITMAPINFOHEADER& GetOutputFormat() const { return m_obh; } virtual int EncodeFrame(const CImage* src, void* dest, int* is_keyframe, size_t* size, int* lpckid=0) { CImage* ci = 0; //src->GetFmt()->Print(); if (!src->IsFmt(&m_bh)) { // slow conversion ci = new CImage(src, &m_bh); //src->GetFmt()->Print(); //AVM_WRITE(strDebugEnc, "enconding format doesn't match!\n"); if (!ci) return -1; } ENC_FRAME param; memset(¶m, 0, sizeof(param)); ENC_RESULT result; param.bitstream = dest; #if ENCORE_MAJOR_VERSION < 5200 param.colorspace = m_iCSP; param.mvs = 0; #endif param.image = (ci) ? ci->Data() : (void*) src->Data(); param.length = GetOutputSize(); #if ENCORE_MAJOR_VERSION < 5200 if (m_bRtMode) { param.quant=m_iQuant; // let encoder decide if frame is INTER/INTRA param.intra=-1; m_pEncore(m_pHandle, ENC_OPT_ENCODE_VBR, ¶m, &result); } else #endif m_pEncore(m_pHandle, ENC_OPT_ENCODE, ¶m, &result); #if ENCORE_MAJOR_VERSION < 5200 if (is_keyframe) *is_keyframe = result.is_key_frame ? 16 : 0; #else if (is_keyframe) *is_keyframe = (result.cType == 'I') ? 16 : 0; #endif if (size) *size = param.length; if (ci) ci->Release(); return 0; } }; #endif static IVideoDecoder* divx4_CreateVideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& bh, int flip) { #if DECORE_VERSION < 20020303 quiet_encore = 1; #endif if (bh.biSize < 40) { divx4_error_set("to short biSize"); return 0; } #ifdef HAVE_LIBDIVXDECORE DIVX_VideoDecoder* d = new DIVX_VideoDecoder(info, bh, flip); if (d->init() == 0) return d; delete d; #endif return 0; } static IVideoEncoder* divx4_CreateVideoEncoder(const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& bh) { #if DECORE_VERSION < 20020303 quiet_encore = 1; #endif #ifdef HAVE_LIBDIVXENCORE DIVX_VideoEncoder* e = new DIVX_VideoEncoder(info, compressor, bh); if (e->init() == 0) return e; delete e; #endif return 0; } AVM_END_NAMESPACE; extern "C" avm::codec_plugin_t avm_codec_plugin_divx4; avm::codec_plugin_t avm_codec_plugin_divx4 = { PLUGIN_API_VERSION, 0, 0, 0, avm::PluginGetAttrInt, avm::PluginSetAttrInt, 0, 0, avm::divx4_FillPlugins, 0, 0, avm::divx4_CreateVideoDecoder, avm::divx4_CreateVideoEncoder, }; avifile-0.7.48~20090503.ds/plugins/libdivx4/fillplugins.h0000644000175000017500000001643311106773130021656 0ustar yavoryavor#ifndef DIVX4_FILLPLUGINS_H #define DIVX4_FILLPLUGINS_H #include "infotypes.h" #include "avm_fourcc.h" #ifdef BIG_ENDIAN #undef BIG_ENDIAN #endif #ifdef HAVE_LIBDIVXENCORE #include "encore2.h" #endif #ifdef HAVE_LIBDIVXDECORE #include "decore.h" #endif #ifdef BIG_ENDIAN #undef BIG_ENDIAN #endif AVM_BEGIN_NAMESPACE; #define DIVX4CSTR(name) \ static const char divx4str_ ## name[] = #name DIVX4CSTR(bitrate); DIVX4CSTR(rc_period); DIVX4CSTR(rc_reaction_period); DIVX4CSTR(rc_reaction_ratio); DIVX4CSTR(min_quantizer); DIVX4CSTR(max_quantizer); DIVX4CSTR(max_key_interval); DIVX4CSTR(quality); DIVX4CSTR(deinterlace); DIVX4CSTR(bidirect); DIVX4CSTR(obmc); DIVX4CSTR(enable_crop); DIVX4CSTR(crop_left); DIVX4CSTR(crop_right); DIVX4CSTR(crop_top); DIVX4CSTR(crop_bottom); DIVX4CSTR(enable_resize); DIVX4CSTR(resize_width); DIVX4CSTR(resize_height); DIVX4CSTR(resize_mode); DIVX4CSTR(resize_bicubic_B); DIVX4CSTR(resize_bicubic_C); DIVX4CSTR(interlace_mode); DIVX4CSTR(temporal_enable); DIVX4CSTR(temporal_level); DIVX4CSTR(spatial_passes); DIVX4CSTR(spatial_level); DIVX4CSTR(postprocessing); DIVX4CSTR(maxauto); DIVX4CSTR(saturation); DIVX4CSTR(brightness); DIVX4CSTR(contrast); #define USE_311_DECODER static void divx4_FillPlugins(avm::vector& ci) { const char divx_about[] = "DivX4" #if DECORE_VERSION >= 20020303 "/DivX5" #endif "\n MPEG-4 Codec is produced by DivXNetworks, Inc. " "Visit: " "http://www.divx.com"; const char* resize_opt[] = { "bilinear", "bicubic", 0 }; const char* ivtc_opt[] = { "progressive (off)", "adaptive", "intelligent IVTC", 0 }; const fourcc_t divx4_codecs[] = { fccDIVX, fccdivx, fccDIV1, fccdiv1, fccMP4S, fccmp4s, RIFFINFO_XVID, RIFFINFO_XviD, RIFFINFO_xvid, 0x4, 0 }; const fourcc_t divx3_codecs[] = { fccDIV3, fccdiv3, fccDIV4, fccdiv4, fccDIV5, fccdiv5, fccDIV6, fccdiv6, /* untested, may work */ fccMP43, fccmp43, 0 }; // FIFO order is important - if this will ever change - few things // would have to be repaired avm::vector vs; vs.push_back(AttributeInfo(divx4str_bitrate, "Desired stream bitrate in bits/second", AttributeInfo::Integer, 0, 10000000, 800000)); vs.push_back(AttributeInfo(divx4str_quality, "Performance/quality balance ( 5 slowest )", AttributeInfo::Integer, 0, 5, 3)); vs.push_back(AttributeInfo(divx4str_rc_period, "Rate control averaging period", AttributeInfo::Integer, 0, 10000, 2000)); vs.push_back(AttributeInfo(divx4str_rc_reaction_period, "Rate control reaction period", AttributeInfo::Integer, 0, 100, 10)); vs.push_back(AttributeInfo(divx4str_rc_reaction_ratio, "Rate control motion sensitivity", AttributeInfo::Integer, 0, 100, 20)); vs.push_back(AttributeInfo(divx4str_max_key_interval, "Maximum key frame interval", AttributeInfo::Integer, 0, 500, 100)); vs.push_back(AttributeInfo(divx4str_min_quantizer, "Minimum quantizer", AttributeInfo::Integer, 1, 31, 1)); vs.push_back(AttributeInfo(divx4str_max_quantizer, "Maximum quantizer", AttributeInfo::Integer, 1, 31, 16)); #ifdef IF_SUPPORT_PRO vs.push_back(AttributeInfo(divx4str_deinterlace, "Deinterlace", AttributeInfo::Integer, 0, 1)); #if defined(ENC_MAJOR_VERSION) || defined(ENCORE_MAJOR_VERSION) vs.push_back(AttributeInfo(divx4str_bidirect, "Bidirectional encoding", AttributeInfo::Integer, 0, 1)); vs.push_back(AttributeInfo(divx4str_obmc, "Overlapped block motion compensation", AttributeInfo::Integer, 0, 1)); #endif #if ENCORE_MAJOR_VERSION >= 5010 vs.push_back(AttributeInfo(divx4str_interlace_mode, "IVTC/Deinterlace", ivtc_opt)); vs.push_back(AttributeInfo(divx4str_temporal_enable, "Temporal filter", AttributeInfo::Integer, 0, 1)); vs.push_back(AttributeInfo(divx4str_temporal_level, " Temporal filter level (0..1000)", AttributeInfo::Integer, 0, 1000, 0)); vs.push_back(AttributeInfo(divx4str_spatial_passes, "Spatial filter passes (0=off,..3)", AttributeInfo::Integer, 0, 3, 0)); vs.push_back(AttributeInfo(divx4str_spatial_level, " Spatial filter level (0..1000)", AttributeInfo::Integer, 0, 1000, 0)); vs.push_back(AttributeInfo(divx4str_enable_crop, "Cropping", AttributeInfo::Integer, 0, 1)); vs.push_back(AttributeInfo(divx4str_crop_left, " Cropping Left", AttributeInfo::Integer, 0, 3000, 0)); vs.push_back(AttributeInfo(divx4str_crop_right, " Cropping Right", AttributeInfo::Integer, 0, 3000, 0)); vs.push_back(AttributeInfo(divx4str_crop_top, " Cropping Top", AttributeInfo::Integer, 0, 3000, 0)); vs.push_back(AttributeInfo(divx4str_crop_bottom, " Cropping Bottom", AttributeInfo::Integer, 0, 3000, 0)); vs.push_back(AttributeInfo(divx4str_enable_resize, "Resize", AttributeInfo::Integer, 0, 1)); vs.push_back(AttributeInfo(divx4str_resize_width, " Resize Width", AttributeInfo::Integer, 0, 3000, 0)); vs.push_back(AttributeInfo(divx4str_resize_height, " Resize Height", AttributeInfo::Integer, 0, 3000, 0)); vs.push_back(AttributeInfo(divx4str_resize_mode, " Resize", resize_opt)); vs.push_back(AttributeInfo(divx4str_resize_bicubic_B, " Resize Bicubic B (0..1000)", AttributeInfo::Integer, 0, 1000, 500)); vs.push_back(AttributeInfo(divx4str_resize_bicubic_C, " Resize Bicubic C (0..1000)", AttributeInfo::Integer, 0, 1000, 0)); #endif // ENCORE_MAJOR_VERSION >= 5010 #endif // IF_SUPPORT_PRO avm::vector ds; ds.push_back(AttributeInfo(divx4str_postprocessing, "Image postprocessing mode ( 6 slowest )", AttributeInfo::Integer, 0, 6)); ds.push_back(AttributeInfo(divx4str_maxauto, "Maximum autoquality level", AttributeInfo::Integer, 0, 6, 6)); #ifdef DEC_OPT_GAMMA ds.push_back(AttributeInfo(divx4str_brightness, "Brightness", AttributeInfo::Integer, -128, 127)); ds.push_back(AttributeInfo(divx4str_contrast, "Contrast", AttributeInfo::Integer, -128, 127)); ds.push_back(AttributeInfo(divx4str_saturation, "Saturation", AttributeInfo::Integer, -128, 127)); #endif ci.push_back(CodecInfo(divx4_codecs, "DivX4.0", "", divx_about, CodecInfo::Plugin, "odivx4", CodecInfo::Video, #if ENCORE_MAJOR_VERSION >= 5010 CodecInfo::Decode, 0, 0, ds #else CodecInfo::Both, 0, vs, ds #endif )); #if DECORE_VERSION >= 20020303 const fourcc_t divx5_codecs[] = { fccDX50, fccdx50, 0 }; ci.push_back(CodecInfo(divx5_codecs, "DivX5.0", "", divx_about, CodecInfo::Plugin, "odivx5", CodecInfo::Video, CodecInfo::Both, 0, vs, ds)); #endif #ifdef USE_311_DECODER ci.push_back(CodecInfo(divx3_codecs, "OpenDivX 3.11 compatible decoder", "", divx_about, CodecInfo::Plugin, "odivx", CodecInfo::Video, CodecInfo::Decode, 0, 0, ds)); #endif } AVM_END_NAMESPACE; #endif // DIVX4_FILLPLUGINS_H avifile-0.7.48~20090503.ds/plugins/libdivx4/test.cpp0000755000175000017500000002044510474277540020654 0ustar yavoryavor#include #include #include #include #include #include #include #include #include #include #include #include #include // atoi #include // memset #include #include #include #include extern "C" { extern int quiet_encore; } using namespace std; extern "C" const avm::vector& RegisterPlugin(); extern "C" const double frequency=700000.; #define __MODULE__ "test codec" bool no_encode=false; bool no_decode=false; bool quiet; int intra_decisions; int inter_decisions; double avgsnr=0; int BLOCK_DEBUG; int MOTION_DEBUG; int num_frames=5; double ac_effect; float start_time=599.; bool use_deblock_filter; int averager; int quant=10; int quant2=10; bool no_16; bool no_8; bool draw=false; bool use_stretcher; extern "C" int neigh_tend_16x16; extern "C" int neigh_tend_8x8; extern "C" int32_t iMv16x16; extern "C" int32_t mv_size_parameter; static bool exact=false; bool verify=true; int quality=9; int yoff=0; int intra_freq=300; const char* filename="/c/trailers/matrix-div4-500.avi"; template inline T max(const T x, const T y) { return (x>y)?x:y; } inline int get_dc_scaler(int qp, int i) { if(qp<=4)return 8; if(i<4) { if(qp<=8)return 2*qp; if(qp<=25)return qp+8; return 2*qp-16; } if(qp<=25)return (qp+13)/2; return qp-6; } double diff(CImage* im1, CImage* im2) { int sum=0; for(unsigned i=0; iBytes(); i++) sum+=abs((int)im1->Data()[i]-(int)im2->Data()[i]); return (double)sum/im1->Bytes(); } int main(int argc, char** argv) { quiet=true; quiet_encore=0; for(int i=1; iGetStream(0, AviStream::Video); if (!stream) { printf("No video stream!\n"); return 1; } stream->SetDirection(true); if(stream->StartStreaming()) { printf("Can't start streaming!\n"); return 1; } stream->SeekTimeToKeyFrame((double)start_time); // stream->GetDecoder()->SetDestFmt(0, fccYV12); if(exact) while(stream->GetTime()ReadFrame(false); // IRtConfig* rtc=dynamic_cast(stream->GetDecoder()); // if(rtc)rtc->SetValue("Quality", 4); BitmapInfo bi=stream->GetDecoder()->GetDestFmt(); w = bi.biWidth; h = labs(bi.biHeight); /** Create encoder **/ ENC_PARAM param; memset(¶m, 0, sizeof(param)); param.x_dim=w; param.y_dim=h-yoff; param.framerate=25.; param.min_quantizer=quant; param.max_quantizer=quant; param.bitrate=600000; param.quality=quality; param.max_key_interval=intra_freq; #ifndef ENCORE_MAJOR_VERSION param.use_bidirect=1; #else param.extensions.use_bidirect=1; #endif encore(0, ENC_OPT_INIT, ¶m, 0); void* handle=param.handle; /** Create decoder **/ #if DECORE_VERSION >= 20021112 DEC_INIT dp; decore(&handle, DEC_OPT_INIT, &dp, 0); #else DEC_PARAM dp; dp.x_dim=w; dp.y_dim=h; dp.output_format=DEC_YUY2; memset(&dp.buffers, 0, sizeof(dp.buffers)); decore(1, DEC_OPT_INIT, &dp, 0); #endif BitmapInfo bi2(w, h, fccYUY2); CImage* dec_out=new CImage(&bi2); for(i=0; iReadFrame(); im=stream->GetFrame(); t2=avm_get_time_us(); ttt3+=t2-t1; char s[20]; if(draw) { sprintf(s, "unc-%03d.bmp", i); im->Dump(s); } ENC_FRAME fr; //#define DIRECT_ENCODING //#define TEST_YUY2 #ifdef DIRECT_ENCODING fr.image=im->Data(); fr.colorspace=ENC_CSP_YV12; #else #ifdef TEST_YUY2 BitmapInfo bi(im->Width(), im->Height(), fccYUY2); fr.colorspace=ENC_CSP_YUY2; #else BitmapInfo bi(im->Width(), im->Height(), 24); fr.colorspace=ENC_CSP_RGB24; #endif CImage* im2=new CImage(im, &bi); fr.image=im2->Data(); #endif fr.bitstream=dest; fr.length=3000000; fr.mvs=0; if(i==0) fr.quant=quant; else fr.quant=quant2; fr.intra=-1; ENC_RESULT res; t1=avm_get_time_us(); encore(handle, ENC_OPT_ENCODE_VBR, &fr, &res); t2=avm_get_time_us(); ttt+=t2-t1; // im->Release(); #ifndef DIRECT_ENCODING im2->Release(); #endif printf("Frame %d encoded as %s into %d bytes\n", i, res.is_key_frame?"INTRA":"INTER", fr.length); progress+=fr.length; if(i==0) printf("ATTN: quant %d->%d, text %d, non-text %d\n", quant, quant2, res.texture_bits, res.total_bits-res.texture_bits); DEC_FRAME df; df.bmp=dec_out->Data(); df.bitstream=dest; df.length=fr.length; df.render_flag=1; df.stride=w; t1=avm_get_time_us(); #if DECORE_VERSION >= 20021112 decore(handle, DEC_OPT_INIT, &dp, 0); #else decore(1, DEC_OPT_FRAME, &df, 0); #endif t2=avm_get_time_us(); ttt2+=t2-t1; BitmapInfo bb(w, h, 24); CImage* im3=new CImage(dec_out, &bb); double snr=diff(im, im3); im3->Release(); printf("SNR: %f ( %f db )\n", snr, 10*log(snr/256.)/log(10.)); avgsnr+=snr; if(draw) { sprintf(s, "dec-%03d.bmp", i); dec_out->Dump(s); } } float qual_mul = 1; switch(quality) { case 5: case 4: qual_mul=5; break; case 3: case 2: qual_mul=3.5; break; case 1: qual_mul=2; break; } cout<<"Encoded "< #include AVM_BEGIN_NAMESPACE; FFAudioDecoder::FFAudioDecoder(AVCodec* av, const CodecInfo& info, const WAVEFORMATEX* wf) :IAudioDecoder(info, wf), m_pAvCodec(av), m_pAvContext(0) { } FFAudioDecoder::~FFAudioDecoder() { if (m_pAvContext) { avcodec_close(m_pAvContext); free(m_pAvContext); } } int FFAudioDecoder::Convert(const void* in_data, size_t in_size, void* out_data, size_t out_size, size_t* size_read, size_t* size_written) { if (!m_pAvContext) { if (!(m_pAvContext = avcodec_alloc_context2(m_pAvCodec->type))) return -1; m_pAvContext->channels = m_pFormat->nChannels; if (m_pAvContext->channels > 2) m_pAvContext->channels = 2; m_pAvContext->bit_rate = m_pFormat->nAvgBytesPerSec * 8; m_pAvContext->sample_rate = m_pFormat->nSamplesPerSec; m_pAvContext->block_align = m_pFormat->nBlockAlign; m_pAvContext->codec_id = m_pAvCodec->id; //printf("INITIALIZE ch:%d avg:%d sam:%d\n", m_pFormat->nChannels, m_pFormat->nAvgBytesPerSec, m_pFormat->nSamplesPerSec); if (m_pFormat->cbSize > 0) { int skip = (m_pFormat->wFormatTag == WAVE_FORMAT_EXTENSIBLE) ? sizeof(FFMPEGWAVEFORMATEX) - sizeof(WAVEFORMATEX) : 0; m_pAvContext->extradata = (uint8_t*)(m_pFormat + 1) + skip; m_pAvContext->extradata_size = m_pFormat->cbSize - skip; } if (avcodec_open(m_pAvContext, m_pAvCodec) < 0) { AVM_WRITE("FFAudioDecoder", "WARNING: can't open avcodec\n"); free(m_pAvContext); m_pAvContext = 0; return -1; } } //printf("%0lx %0lx %0lx %0lx\n", ((long*)in_data)[0], ((long*)in_data)[1], ((long*)in_data)[2], ((long*)in_data)[3]); AVPacket avpkt; av_init_packet(&avpkt); avpkt.data = (uint8_t*)in_data; avpkt.size = (int)in_size; int framesz = AVCODEC_MAX_AUDIO_FRAME_SIZE; int hr = avcodec_decode_audio3(m_pAvContext, (int16_t*)out_data, &framesz, &avpkt); //printf("CONVERT ins: %d outs:%" PRIsz " fs:%d h:%d\n", avpkt.size, out_size, framesz, hr); if (size_read) *size_read = (hr < 0) ? 1 : hr; if (size_written) *size_written = (hr < 0) ? 0 : framesz; if (hr < 0) { avcodec_close(m_pAvContext); free(m_pAvContext); m_pAvContext = 0; } return (hr < 0 || in_size == 0) ? -1 : 0; } size_t FFAudioDecoder::GetMinSize() const { size_t r; switch (m_Info.fourcc) { case WAVE_FORMAT_DVM: r = MIN_AC3_CHUNK_SIZE; break; case WAVE_FORMAT_MSAUDIO1: r = 16 * m_pFormat->nBlockAlign * (uint_t)m_uiBytesPerSec / m_pFormat->nAvgBytesPerSec; break; case WAVE_FORMAT_DVI_ADPCM: r = (!m_pFormat->nBlockAlign) ? 1024 : m_pFormat->nBlockAlign * m_pFormat->nChannels; break; default: r = 2; } //printf("minsize %d 0x%x\n", r, m_Info.fourcc); return (r < AVCODEC_MAX_AUDIO_FRAME_SIZE) ? AVCODEC_MAX_AUDIO_FRAME_SIZE : r; } size_t FFAudioDecoder::GetSrcSize(size_t dest_size) const { switch (m_Info.fourcc) { case WAVE_FORMAT_MSAUDIO1: case WAVE_FORMAT_WMAUDIO2: return m_pFormat->nBlockAlign; case WAVE_FORMAT_DVI_ADPCM: if (!m_pFormat->nBlockAlign) return 1024; default: return IAudioDecoder::GetSrcSize(dest_size); } } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFAudioDecoder.h0000644000175000017500000000116411164472233022276 0ustar yavoryavor#ifndef AVIFILE_FFAUDIODECODER_H #define AVIFILE_FFAUDIODECODER_H #include "audiodecoder.h" #include "avm_avcodec.h" AVM_BEGIN_NAMESPACE; class FFAudioDecoder: public IAudioDecoder { static const uint_t MIN_AC3_CHUNK_SIZE = 16384; AVCodec *m_pAvCodec; AVCodecContext* m_pAvContext; public: FFAudioDecoder(AVCodec*, const CodecInfo&, const WAVEFORMATEX*); ~FFAudioDecoder(); virtual int Convert(const void*, size_t, void*, size_t, size_t*, size_t*); virtual size_t GetMinSize() const; virtual size_t GetSrcSize(size_t dest_size) const; }; AVM_END_NAMESPACE; #endif //AVIFILE_FFAUDIODECODER_H avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFVideoDecoder.cpp0000644000175000017500000003520111174175566022647 0ustar yavoryavor#include "FFVideoDecoder.h" #include "fillplugins.h" #include "plugin.h" #include "avm_output.h" #include #include // free #include #if 0 #define FFTIMING(a) a #include "avm_cpuinfo.h" #include "utils.h" static float ftm = 0; #else #define FFTIMING(a) #endif #define Debug if (0) AVM_BEGIN_NAMESPACE; FFVideoDecoder::FFVideoDecoder(AVCodec* av, const CodecInfo& info, const BITMAPINFOHEADER& bh, int flip) :IVideoDecoder(info, bh), m_pAvCodec(av), m_pAvContext(0), m_Caps((CAPS)(CAP_YV12 | CAP_ALIGN16)), m_uiBuffers(0), m_bRestart(true), m_Order(20), m_pImg(0), m_bUsed(false) { m_Dest.SetSpace(fccYV12); // not supported if (flip) m_Dest.biHeight *= -1; Flush(); //m_pAvStream = (struct AVStream*)bh.biXPelsPerMeter; Debug printf("Context %p\n", m_pAvStream); if (0 && m_pFormat->biCompression == fccHFYU) { // for now disabled m_pAvCodec->capabilities &= ~(CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1); AVM_WRITE(m_Info.GetPrivateName(), "if you have troubles - use Win32 codec instead\n"); m_Caps = (CAPS) (m_Caps | CAP_YUY2); } } FFVideoDecoder::~FFVideoDecoder() { Stop(); FFTIMING(printf("ftm %f\n", ftm)); } void FFVideoDecoder::Flush() { Debug printf("\nFF: Flush\n\n"); if (m_pAvContext) avcodec_flush_buffers(m_pAvContext); m_bFlushed = true; m_Order.clear(); //m_iAgeB = m_iAgeIP[0] = m_iAgeIP[1] = (1 << 30); } // callback to draw horizontal slice static void draw_slice(struct AVCodecContext *avctx, const AVFrame *src, int offset[4], int y, int type, int height) { FFVideoDecoder* d = (FFVideoDecoder*) avctx->opaque; ci_surface_t ci; ci.m_pPlane[0] = src->data[0] + offset[0]; ci.m_pPlane[1] = src->data[2] + offset[2]; ci.m_pPlane[2] = src->data[1] + offset[1]; ci.m_iStride[0] = src->linesize[0]; ci.m_iStride[1] = src->linesize[2]; ci.m_iStride[2] = src->linesize[1]; ci.m_iWidth = ci.m_Window.w = avctx->width; ci.m_iHeight = ci.m_Window.h = height; ci.m_Window.x = 0; ci.m_Window.y = y; ci.m_iFormat = IMG_FMT_YV12; //printf("DrawSlice %p %p y:%d w:%d h:%d\n", d->m_pImg, src, ci.m_Window.y, ci.m_Window.w, height); d->m_pImg->Slice(&ci); } // callback to supply rendering buffer to ffmpeg static int get_buffer(AVCodecContext* avctx, AVFrame* pic) { static const char ftypes[][3] = { "I", "P", "B", "S", "SI", "SP" }; FFVideoDecoder* d = (FFVideoDecoder*) avctx->opaque; CImage* pImage = d->m_pImg; if ((avctx->pix_fmt != PIX_FMT_YUV420P && avctx->pix_fmt != PIX_FMT_YUVJ420P) || !pImage || !d->m_bDirect) { Debug printf("FF: Unsupported pixel format for Dr1 %d\n", avctx->pix_fmt); //abort(); return avcodec_default_get_buffer(avctx, pic); } d->m_bUsed = true; Debug if (pic->buffer_hints) printf("FF bufhints 0x%x\n", pic->buffer_hints); pic->opaque = pImage; #if 0 { const uint8_t b[3] = { 0x10, 0x80, 0x80 }; for (int j = 0; j < 3; ++j) { uint8_t c = b[j]; fprintf(stderr, "CLEANbuff b:%d p:%p c:%x\n", pImage->Stride(j), pImage->Data(j), c); for (unsigned i = 0; i < pImage->Stride(j); ++i) pImage->Data(j)[i] = c; } } #endif // we are using YV12 - ffmpeg uses I420 pic->data[0] = pImage->Data(0); pic->data[1] = pImage->Data(2); pic->data[2] = pImage->Data(1); pic->linesize[0] = pImage->Stride(0); pic->linesize[1] = pImage->Stride(2); // Note: for ffmpeg linsize[1] == linesize[2]! pic->linesize[2] = pImage->Stride(1); pic->pts = pImage->m_lTimestamp; pic->type = FF_BUFFER_TYPE_USER; pImage->m_iType = pic->pict_type; pic->age = (pImage->GetAge() != pImage->MAX_AGE) ? pic->coded_picture_number - pImage->GetAge() : (1 << 30); if (pic->reference) pImage->Age(pic->coded_picture_number); else pImage->Age(); Debug printf("FF: <<<< GetBuffer %p %s %dx%d %p:%p:%p s:%f f:%d r:%d age:%d\n", pImage, ftypes[pic->pict_type], avctx->width, avctx->height, pImage->Data(0), pImage->Data(2), pImage->Data(1), (double)pImage->m_lTimestamp / 1000000., avctx->pix_fmt, pic->reference, pic->age); return 0; } static void release_buffer(struct AVCodecContext* avctx, AVFrame* pic) { if (pic->type == FF_BUFFER_TYPE_USER) { FFVideoDecoder* d = (FFVideoDecoder*) avctx->opaque; d->m_pReleased = (CImage*) pic->opaque; Debug printf("FF: >>>> Released buffer %p %p\n", pic->opaque, pic); memset(pic->data, 0, sizeof(void*) * 4); pic->opaque = NULL; } else { Debug printf(">>>> released default buffer *****************\n"); avcodec_default_release_buffer(avctx, pic); } } int FFVideoDecoder::DecodeFrame(CImage* pImage, const void* src, size_t size, int is_keyframe, bool render, CImage** pOut) { FFTIMING(int64_t ts = avm_get_time_us()); if (//(m_bFlushed && !is_keyframe) || (pImage && pImage->GetAllocator() && m_uiBuffers != pImage->GetAllocator()->GetImages()) || m_bRestart) { //printf("RES %d %" PRIsz " %" PRIsz "\n", m_bRestart, m_uiBuffers, pImage->GetAllocator()->GetImages()); Stop(); } //printf("FFMPEG space %p \n", m_pAvContext); m_Dest.Print(); pImage->GetFmt()->Print(); if (!m_pAvContext) { if (!(m_pAvContext = avcodec_alloc_context2(m_pAvCodec->type))) return -1; // for autodetection errors m_pAvContext->codec_tag = m_pFormat->biCompression; m_pAvContext->bits_per_coded_sample = m_pFormat->biBitCount; m_pAvContext->width = m_Dest.biWidth; m_pAvContext->height = (m_Dest.biHeight < 0) ? -m_Dest.biHeight : m_Dest.biHeight; if (m_pFormat->biSize > sizeof(BITMAPINFOHEADER)) { m_pAvContext->extradata_size = int(m_pFormat->biSize - sizeof(BITMAPINFOHEADER)); m_pAvContext->extradata = (uint8_t*)m_pFormat + sizeof(BITMAPINFOHEADER); if (m_pAvContext->extradata_size > 40) m_pAvContext->flags |= CODEC_FLAG_EXTERN_HUFF; // somewhat useless } m_uiBuffers = (pImage && pImage->GetAllocator()) ? pImage->GetAllocator()->GetImages() : 0; //printf("IMAGES %d\n", m_uiBuffers); // for SVQ1 - align 63 will be needed FIXME int v = 0; const char* drtxt = "doesn't support"; m_bDirect = false; if (m_pAvCodec->capabilities & CODEC_CAP_DR1) { drtxt = "not using"; if (pImage) { size_t require = 2; //fprintf(stderr, "buff %" PRIsz " %" PRIsz "\n", m_uiBuffers, require); switch (m_Info.fourcc) { case fccDVSD: require = 1; break; } if (m_Info.FindAttribute(ffstr_dr1) && PluginGetAttrInt(m_Info, ffstr_dr1, &v) == 0 && v && pImage->Format() == IMG_FMT_YV12) { // for DR we needs some special width aligment // also there are some more limitation m_pAvContext->flags |= CODEC_FLAG_EMU_EDGE; drtxt = "using"; m_bDirect = true; //m_pAvContext->skip_top = 32; /* m_pAvContext->skip_loop_filter = AVDISCARD_BIDIR; m_pAvContext->skip_idct = AVDISCARD_BIDIR; m_pAvContext->skip_frame = AVDISCARD_BIDIR; */ m_pAvContext->get_buffer = get_buffer; m_pAvContext->reget_buffer = get_buffer; m_pAvContext->release_buffer = release_buffer; } } } if (m_bRestart) AVM_WRITE(m_Info.GetPrivateName(), "%s DR1\n", drtxt); m_bRestart = false; #if 0 if (m_Info.fourcc == RIFFINFO_MPG1 && m_pAvCodec->capabilities & CODEC_CAP_TRUNCATED) m_pAvContext->flags |= CODEC_FLAG_TRUNCATED; #endif #if 1 m_pAvContext->error_recognition = FF_ER_COMPLIANT; m_pAvContext->error_concealment = FF_EC_GUESS_MVS; m_pAvContext->workaround_bugs = FF_BUG_AUTODETECT; #endif #if 0 if (codec->options) { avm::vector::const_iterator it; for (it = m_Info.decoder_info.begin(); it != m_Info.decoder_info.end(); it++) { char b[100]; float f; b[0] = 0; switch (it->GetKind()) { case AttributeInfo::Integer: PluginGetAttrInt(m_Info, it->GetName(), &v); sprintf(b, "%s=%d", it->GetName(), v); break; case AttributeInfo::Float: PluginGetAttrFloat(m_Info, it->GetName(), &f); sprintf(b, "%s=%f", it->GetName(), f); break; default: ; } Debug printf("pass options '%s': %s\n", it->GetName(), b); avoption_parse(m_pAvContext, codec->options, b); } } #endif /* static const struct fftable { const char* attr; int flag; } fftab[] = { { ffstr_bug_old_msmpeg4, FF_BUG_OLD_MSMPEG4 }, { ffstr_bug_xvid_ilace, FF_BUG_XVID_ILACE }, { ffstr_bug_ump4, FF_BUG_UMP4 }, { ffstr_bug_no_padding, FF_BUG_NO_PADDING }, { ffstr_bug_ac_vlc, FF_BUG_AC_VLC }, { ffstr_bug_qpel_chroma, FF_BUG_QPEL_CHROMA }, { 0, 0 } }; for (const struct fftable* p = fftab; p->attr; p++) { if (m_Info.FindAttribute(p->attr) && PluginGetAttrInt(m_Info, p->attr, &v) == 0 && v) m_pAvContext->workaround_bugs |= p->flag; } */ if (avcodec_open(m_pAvContext, m_pAvCodec) < 0) { AVM_WRITE(m_Info.GetPrivateName(), "WARNING: FFVideoDecoder::DecodeFrame() can't open avcodec\n"); Stop(); return -1; } } // try using draw_horiz_band if DR1 is unsupported m_pAvContext->draw_horiz_band = (!m_bDirect && pImage && pImage->Format() == IMG_FMT_YV12 && (m_pAvCodec->capabilities & CODEC_CAP_DRAW_HORIZ_BAND) && !pImage->Direction() && render) ? draw_slice : 0; m_pAvContext->opaque = this; Debug printf("FF: Decode start %p pkt size: %" PRIsz " horiz:%d\n", pImage, size, (m_pAvContext->draw_horiz_band != 0)); m_pImg = pImage; m_bUsed = false; m_pReleased = 0; AVFrame pic; int got_picture = 0; AVPacket avpkt; av_init_packet(&avpkt); avpkt.data = (uint8_t*)src; avpkt.size = (int)size; int hr = avcodec_decode_video2(m_pAvContext, &pic, &got_picture, &avpkt); //printf("DECFF got_picture %d %p del:%d hr:%d size:%d\n", got_picture, src, m_pAvContext->delay, hr, size); //printf("PictType %d\n", m_pAvContext->pict_type); //static int ctr=0; printf("WIDTH %dx%d %d r:%d\n", m_pAvContext->width, m_pAvContext->height, ctr++, m_pAvContext->pict_type); Debug printf("FF: Decoded used=%d got_pic=%d res=%d\n", m_bUsed, got_picture, hr); if (hr < 0) { AVM_WRITE(m_Info.GetPrivateName(), "WARNING: FFVideoDecoder::DecodeFrame() hr=%d\n", hr); return hr; } if (!(m_pAvContext->flags & CODEC_FLAG_TRUNCATED)) { hr = (int)size; //m_bUsed = true; } if (!m_bDirect || m_bUsed) { size_t i = m_Order.size(); int64_t timestamp; uint_t position; if (pImage) { timestamp = pImage->m_lTimestamp; position = pImage->m_uiPosition; while (i > 0) { // keep data ordered by timestamps if (timestamp > m_Order[i - 1].timestamp) break; i--; } } else { timestamp = 0; position = 0; } Debug printf("FF: Insert %" PRIsz " %" PRId64 " %" PRId64 " gotpic:%d\n", i, timestamp, m_Order[i].timestamp, got_picture); m_Order.insert(i, fpair(timestamp, position)); if (m_bDirect) hr |= NEXT_PICTURE; } Debug printf("FF: r=0x%x sz=%" PRIsz " %d b:%d img:%p out:%p\n", hr, size, got_picture, m_bUsed, pImage, pOut); Debug printf("FF: frame_size %d number %d picnum %d\n", m_pAvContext->frame_size, m_pAvContext->frame_number, m_pAvContext->real_pict_num); if (!got_picture) { Debug printf("FF: NO PICTURE released=%p\n", m_pReleased); if (!m_pReleased) return hr | NO_PICTURE; // let's fake got_picture; if (!pic.opaque) { pic.type = FF_BUFFER_TYPE_USER; pic.opaque = m_pReleased; } got_picture = true; } //printf("CONTEXT %d %x %.4s\n", got_picture, m_pAvContext->pix_fmt, (char*)&imfmt); if (render && pImage && got_picture && !m_bDirect && !m_pAvContext->draw_horiz_band) { int imfmt = 0; Debug printf("PIXFMPT %d\n", m_pAvContext->pix_fmt); switch (m_pAvContext->pix_fmt) { case PIX_FMT_BGR24: imfmt = IMG_FMT_BGR24; break; case PIX_FMT_RGBA: imfmt = IMG_FMT_BGR32; break; case PIX_FMT_YUYV422: imfmt = IMG_FMT_YUY2; break; case PIX_FMT_YUV410P: imfmt = IMG_FMT_I410; break; case PIX_FMT_YUV411P: imfmt = IMG_FMT_I411; break; case PIX_FMT_YUV420P: imfmt = IMG_FMT_I420; break; case PIX_FMT_YUVJ420P: imfmt = IMG_FMT_I420; break; // strange case PIX_FMT_YUV422P: imfmt = IMG_FMT_I422; break; case PIX_FMT_YUV444P: imfmt = IMG_FMT_I444; break; default: break; } if (imfmt) { BitmapInfo bi(m_Dest); bi.SetSpace(imfmt); //bi.Print(); //printf("FFMPEG SETSPACE\n"); pImage->GetFmt()->Print(); bi.Print(); //printf("LINE %d %d %d\n", pic.linesize[0], pic.linesize[1], pic.linesize[2]); //printf("LINE %p %p %p\n", pic.data[0], pic.data[1], pic.data[2]); CImage ci(&bi, const_cast(pic.data), pic.linesize, false); pImage->Convert(&ci); //printf("xxx %p\n", m_AvPicture.data[0]); //memcpy(pImage->Data(), pic.data[0], 320 * 150); } else { AVM_WRITE(m_Info.GetPrivateName(), "Unsupported colorspace: %d, FIXME\n", m_pAvContext->pix_fmt); pImage->Clear(); } } //printf("SWAP %lld %lld\n", m_Order.front().timestamp, pImage->m_lTimestamp); //printf("SWAP %d %d\n", m_Order.front().position, pImage->m_uiPosition); //printf("P %d %lld\n", p, m_Order[0].timestamp, m_Order.size()); Debug printf("FF: release:%p out:%p tuc:%d(%d/%d)\n", m_pReleased, pOut, pic.type, FF_BUFFER_TYPE_USER, FF_BUFFER_TYPE_COPY); #if 1 if (pOut && pic.opaque && ((pic.type == FF_BUFFER_TYPE_USER) || (pic.type == FF_BUFFER_TYPE_COPY))) { *pOut = (CImage*) pic.opaque; (*pOut)->m_lTimestamp = m_Order[0].timestamp; (*pOut)->m_uiPosition = m_Order[0].position; } else if (pImage) { pImage->m_lTimestamp = m_Order[0].timestamp; pImage->m_uiPosition = m_Order[0].position; } #endif m_Order.pop(); //printf("OUT %d %p\n", got_picture, *pOut); FFTIMING(ftm += avm_get_time_diff(avm_get_time_us(), ts)); Debug printf("FF: pictype %d time:%f c:%d d:%d %" PRId64 " %p\n", pic.pict_type, (double) pic.pts / 1000000., pic.coded_picture_number, pic.display_picture_number, pImage->m_lTimestamp, pic.opaque); //pImage->m_lTimestamp = pic.pts / (double) AV_TIME_BASE; m_bFlushed = false; return hr; } int FFVideoDecoder::SetDestFmt(int bits, fourcc_t csp) { if (!CImage::Supported(csp, bits) || csp != fccYV12) return -1; Restart(); return 0; } int FFVideoDecoder::Stop() { if (m_pAvContext) { avcodec_close(m_pAvContext); free(m_pAvContext); m_pAvContext = 0; } return 0; } const avm::vector& FFVideoDecoder::GetAttrs() const { return m_Info.decoder_info; } int FFVideoDecoder::GetValue(const char* name, int* value) const { return PluginGetAttrInt(m_Info, name, value); } int FFVideoDecoder::SetValue(const char* name, int value) { int r = PluginSetAttrInt(m_Info, name, value); m_bRestart = (r == 0); return r; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFVideoDecoder.h0000644000175000017500000000271611170700664022306 0ustar yavoryavor#ifndef AVIFILE_FFVIDEODECODER_H #define AVIFILE_FFVIDEODECODER_H #include "videodecoder.h" #ifndef int64_t_C #define int64_t_C(c) (c ## LL) #define uint64_t_C(c) (c ## ULL) #endif #include "avm_avcodec.h" AVM_BEGIN_NAMESPACE; class FFVideoDecoder: public IVideoDecoder, public IRtConfig { public: FFVideoDecoder(AVCodec* av,const CodecInfo& info, const BITMAPINFOHEADER& format, int flip); virtual ~FFVideoDecoder(); virtual int DecodeFrame(CImage* pImage, const void* src, size_t size, int is_keyframe, bool render = true, CImage** pOut = 0); virtual CAPS GetCapabilities() const { return m_Caps; } virtual void Flush(); virtual int SetDestFmt(int bits = 24, fourcc_t csp = 0); virtual int Stop(); virtual IRtConfig* GetRtConfig() { return this; } virtual const avm::vector& GetAttrs() const; virtual int GetValue(const char* name, int* value) const; virtual int SetValue(const char* name, int value); protected: AVCodec *m_pAvCodec; AVCodecContext* m_pAvContext; struct AVStream* m_pAvStream; CAPS m_Caps; size_t m_uiBuffers; bool m_bFlushed; bool m_bRestart; struct fpair { int64_t timestamp; uint_t position; fpair(int64_t t = 0, uint_t p = 0) : timestamp(t), position(p) {} }; avm::qring m_Order; public: CImage* m_pImg; bool m_bUsed; bool m_bDirect; CImage* m_pReleased; }; AVM_END_NAMESPACE; #endif //AVIFILE_FFVIDEODECODER_H avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFVideoEncoder.cpp0000644000175000017500000001456211165743734022666 0ustar yavoryavor#include "FFVideoEncoder.h" #include "fillplugins.h" #include #include AVM_BEGIN_NAMESPACE; static void libffmpeg_set_attr(avm::vector& a, AVCodec* codec) { if (!codec) return; const AVOption* c = 0;//codec->options; #if 0 if (c) { const AVOption *stack[FF_OPT_MAX_DEPTH]; int depth = 0; for (;;) { //printf("NAME %s\n", c->name); if (!c->name) { if (c->help) { stack[depth++] = c; c = (const AVOption*)c->help; } else { if (depth == 0) break; // finished c = stack[--depth]; c++; } } else { int t = c->type & FF_OPT_TYPE_MASK; char* arr[100]; char* dealloc; #if 0 printf("Config %s %s\n", t == FF_OPT_TYPE_BOOL ? "bool " : t == FF_OPT_TYPE_DOUBLE ? "double " : t == FF_OPT_TYPE_INT ? "integer" : t == FF_OPT_TYPE_STRING ? "string " : "unknown??", c->name); #endif switch (t) { case FF_OPT_TYPE_BOOL: a.push_back(AttributeInfo(c->name, c->help, AttributeInfo::Integer, 0, 1, (int)c->defval)); break; case FF_OPT_TYPE_DOUBLE: a.push_back(AttributeInfo(c->name, c->help, c->defval, c->min,c->max)); break; case FF_OPT_TYPE_INT: a.push_back(AttributeInfo(c->name, c->help, AttributeInfo::Integer, (int)c->min, (int)c->max, (int)c->defval)); break; case FF_OPT_TYPE_STRING: t = 0; dealloc = 0; if (c->defstr) { char* tmp = dealloc = strdup(c->defstr); if (tmp) { char* semi; while (tmp && (semi = strchr(tmp, ';'))) { *semi++ = 0; arr[t++] = tmp; if (t > 97) break; // weird - too many string options ??? tmp = semi; } arr[t++] = tmp; } arr[t] = 0; } //printf("%d %s\n", i, cnf->name); a.push_back((t > 1) ? AttributeInfo(c->name, c->help, (const char**)arr, (int)c->defval) : AttributeInfo(c->name, c->help, AttributeInfo::String)); if (dealloc) free(dealloc); break; /* if (c->defstr) { char* d = av_strdup(c->defstr); char* f = strchr(d, ','); if (f) *f = 0; i += sprintf(def + i, "%s%s=%s", col, c->name, d); av_free(d); } break; */ } c++; } } } #endif } FFVideoEncoder::FFVideoEncoder(AVCodec* av, const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& bh) :IVideoEncoder(info), m_pAvCodec(av), m_pAvContext(0), m_Caps(CAP_YV12), m_bh(bh), m_obh(bh) { m_obh.biCompression = info.fourcc; m_obh.biHeight = (int32_t)labs(m_obh.biHeight); } FFVideoEncoder::~FFVideoEncoder() { Stop(); } int FFVideoEncoder::EncodeFrame(const CImage* src, void* dest, int* is_keyframe, size_t* size, int* lpckid) { int hr = 0; if (!m_pAvContext) { m_pAvContext = avcodec_alloc_context(); m_pAvContext->width = m_bh.biWidth; m_pAvContext->height = m_obh.biHeight; //m_pAvContext->pix_fmt = PIX_FMT_YUV420P; m_pAvContext->bit_rate = 1000000; #warning fixme // m_pAvContext->frame_rate_base = 1000000; // m_pAvContext->frame_rate = (int)(m_fFps * m_pAvContext->frame_rate_base + 0.5); m_pAvContext->gop_size = 250; m_pAvContext->qmin = 2; m_pAvContext->qmax = 31; //m_pAvContext->flags = CODEC_FLAG_HQ; printf("CODEC opening %dx%d\n", m_bh.biWidth, m_obh.biHeight); if (avcodec_open(m_pAvContext, m_pAvCodec) < 0) { free(m_pAvContext); m_pAvContext = 0; return -1; } #if 0 if (!codec) return; const AVOption* c = codec->options; if (c) { const AVOption *stack[FF_OPT_MAX_DEPTH]; int depth = 0; for (;;) { double d; //printf("NAME %s\n", c->name); if (!c->name) { if (c->help) { stack[depth++] = c; c = (const AVOption*)c->help; } else { if (depth == 0) break; // finished c = stack[--depth]; c++; } } else { int t = c->type & FF_OPT_TYPE_MASK; char* arg[200]; char* sval = 0; switch (t) { case FF_OPT_TYPE_BOOL: PluginGetAttrInt(m_Info, c->name, &ival); sprintf(arg, "%150s=%d", c->name, ival); break; case FF_OPT_TYPE_DOUBLE: PluginGetAttrFloat(m_Info, c->name, &dval); sprintf(arg, "%150s=%f", c->name, dval); break; case FF_OPT_TYPE_INT: PluginGetAttrInt(m_Info, c->name, &ival); sprintf(arg, "%150s=%d", c->name, ival); break; case FF_OPT_TYPE_STRING: PluginGetAttrString(m_Info, c->name, &sval); if (sval) sprintf(arg, "%s=%s", c->name, d); break; } col = ":"; c++; avoption_parse(m_pAvContext, codec->options, arg); } } } #endif } const CImage* ci = src; CImage* conv = 0; //printf("CODEC format 0x%x\n", src->Format()); if (src->Format() != IMG_FMT_YV12) { printf("Converted\n"); ci = conv = new CImage(src, IMG_FMT_YV12); if (!conv) return -1; } AVFrame f; // YV12 only memset(&f, 0, sizeof(AVFrame)); f.data[0] = const_cast(ci->Data(0)); f.data[1] = const_cast(ci->Data(2)); f.data[2] = const_cast(ci->Data(1)); f.linesize[0] = ci->Stride(0); f.linesize[1] = ci->Stride(2); f.linesize[2] = ci->Stride(1); //printf("ECDING FF %p %p %p sz:%d\n", f.data[0], f.data[1], f.data[2], GetOutputSize()); //printf("ECDING FF %d %d %d\n", f.linesize[0], f.linesize[1], f.linesize[2]); int rsize = avcodec_encode_video(m_pAvContext, (unsigned char*) dest, GetOutputSize(), &f); //printf("ECDING FF size %d\n", rsize); if (size) *size = rsize; if (is_keyframe) { *is_keyframe = m_pAvContext->coded_frame->key_frame ? 16 : 0; //printf("KEYFRAME %d\n", *is_keyframe); } if (conv) conv->Release(); return hr; } int FFVideoEncoder::Start() { return 0; } int FFVideoEncoder::Stop() { if (m_pAvContext) { avcodec_close(m_pAvContext); free(m_pAvContext); m_pAvContext = 0; } return 0; } int FFVideoEncoder::SetQuality(int quality) { if (quality < 0 || quality >10000) return - 1; m_iQual = quality; return 0; } int FFVideoEncoder::SetKeyFrame(int freq) { return 0; } int FFVideoEncoder::SetFps(float fps) { m_fFps = fps; return 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFVideoEncoder.h0000644000175000017500000000321311164472233022312 0ustar yavoryavor#ifndef AVIFILE_FFVIDEOENCODER_H #define AVIFILE_FFVIDEOENCODER_H #include "videoencoder.h" #include "avm_avcodec.h" #include AVM_BEGIN_NAMESPACE; class FFVideoEncoder: public IVideoEncoder { public: FFVideoEncoder(AVCodec* av, const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& header); ~FFVideoEncoder(); // // Encodes single frame // On success, is_keyframe contains 0 if frame was encoded into delta frame, otherwise AVIIF_KEYFRAME (?) // size receives size of compressed frame // virtual int EncodeFrame(const CImage* src, void* dest, int* is_keyframe, size_t* size, int* lpckid = 0); // // Queries encoder about desired buffer size for compression // You should allocate at least this much bytes for dest ( arg for EncodeFrame ) // virtual const BITMAPINFOHEADER& GetOutputFormat() const { return m_obh; } virtual size_t GetOutputSize() const { return m_bh.biWidth * (int) labs(m_bh.biHeight) * 4; } virtual int Start(); virtual int Stop(); // // Quality takes values from 0 to 10000, 10000 the best // virtual int SetQuality(int quality); virtual int GetQuality() const { return m_iQual; } virtual int SetKeyFrame(int frequency); virtual int GetKeyFrame() const { return m_iKfFreq; } virtual float GetFps() const { return m_fFps; } virtual int SetFps(float fps); protected: AVCodec* m_pAvCodec; AVCodecContext* m_pAvContext; CAPS m_Caps; BITMAPINFOHEADER m_bh; BITMAPINFOHEADER m_obh; int m_iQual; int m_iKfFreq; float m_fFps; }; AVM_END_NAMESPACE; #endif //AVIFILE_FFVIDEOENCODER_H avifile-0.7.48~20090503.ds/plugins/libffmpeg/Makefile.am0000644000175000017500000000115511110406660021406 0ustar yavoryavorpkglib_LTLIBRARIES = ffmpeg.la noinst_HEADERS = \ FFAudioDecoder.h \ FFVideoDecoder.h \ FFVideoEncoder.h \ fillplugins.h ffmpeg_la_SOURCES = \ FFAudioDecoder.cpp \ FFVideoDecoder.cpp \ FFVideoEncoder.cpp \ libffmpeg.cpp FFMPEG_CFLAGS = -I$(top_srcdir)/ffmpeg ffmpeg_la_LIBADD = ../../lib/libaviplay.la ffmpeg_la_LDFLAGS = -module -avoid-version AM_CPPFLAGS = $(LTNOPIC) $(INSTRUMENT) $(FFMPEG_CFLAGS) AM_CXXFLAGS = $(CXXRTTIEXCEPT) $(VISIBILITYFLAG) check_PROGRAMS = testvideo testvideo_SOURCES = testvideo.cpp testvideo_LDFLAGS = -g -export-dynamic $(pkglib_LTLIBRARIES) MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libffmpeg/fillplugins.h0000644000175000017500000003167111176643025022073 0ustar yavoryavor#ifndef FFMPEG_FILLPLUGINS_H #define FFMPEG_FILLPLUGINS_H #include "infotypes.h" #include "avm_fourcc.h" #include "avm_avformat.h" //#include "libavcodec/opt.h" #include #include //#include // remove AVM_BEGIN_NAMESPACE; #define FFCSTR(name) \ static const char ffstr_ ## name[] = #name FFCSTR(dr1); struct FCodec { const char* const ffname; // name in ffmpeg library const char* const optname; // "ff" + optional name for user, 0 = "ff" + "ffname" const char* const info; // short info const char* const about; // long about, 0 = repeat last const fourcc_t* const fcc; // list of FourCC's const GUID* const guid; // list of FourCC's }; static void libffmpeg_get_attr(avm::vector& a, AVCodec* codec) { if (!codec) return; #if 0 AVCodecContext* ctx = avcodec_alloc_context(); static bool first = true; const AVOption* o = ctx->av_class->option; while (first) { if (o->name) printf("OPT %s\n", o->name); else first = false; o++; } free(ctx); #endif #if 0 if (c) { const AVOption *stack[FF_OPT_MAX_DEPTH]; int depth = 0; for (;;) { //printf("NAME %s\n", c->name); if (!c->name) { if (c->help) { stack[depth++] = c; c = (const AVOption*)c->help; } else { if (depth == 0) break; // finished c = stack[--depth]; c++; } } else { int t = c->type & FF_OPT_TYPE_MASK; char* arr[100]; char* dealloc; #if 0 printf("Config %s %s\n", t == FF_OPT_TYPE_BOOL ? "bool " : t == FF_OPT_TYPE_DOUBLE ? "double " : t == FF_OPT_TYPE_INT ? "integer" : t == FF_OPT_TYPE_STRING ? "string " : "unknown??", c->name); #endif switch (t) { case FF_OPT_TYPE_BOOL: a.push_back(AttributeInfo(c->name, c->help, AttributeInfo::Integer, 0, 1, (int)c->defval)); break; case FF_OPT_TYPE_DOUBLE: a.push_back(AttributeInfo(c->name, c->help, c->defval, c->min,c->max)); break; case FF_OPT_TYPE_INT: a.push_back(AttributeInfo(c->name, c->help, AttributeInfo::Integer, (int)c->min, (int)c->max, (int)c->defval)); break; case FF_OPT_TYPE_STRING: t = 0; dealloc = 0; if (c->defstr) { char* tmp = dealloc = strdup(c->defstr); if (tmp) { char* semi; while (tmp && (semi = strchr(tmp, ';'))) { *semi++ = 0; arr[t++] = tmp; if (t > 97) break; // weird - too many string options ??? tmp = semi; } arr[t++] = tmp; } arr[t] = 0; } //printf("%d %s\n", i, cnf->name); a.push_back((t > 1) ? AttributeInfo(c->name, c->help, (const char**)arr, (int)c->defval) : AttributeInfo(c->name, c->help, AttributeInfo::String)); if (dealloc) free(dealloc); break; /* if (c->defstr) { char* d = av_strdup(c->defstr); char* f = strchr(d, ','); if (f) *f = 0; i += sprintf(def + i, "%s%s=%s", col, c->name, d); av_free(d); } break; */ } c++; } } } #endif } static void libffmpeg_fill_decattr(avm::vector& a, const char* cd) { a.clear(); a.push_back(AttributeInfo(ffstr_dr1, "Direct Rendering 1", AttributeInfo::Integer, 0, 1, 1)); if (cd) libffmpeg_get_attr(a, avcodec_find_decoder_by_name(cd)); } static void libffmpeg_fill_encattr(avm::vector& a, const char* cd) { a.clear(); libffmpeg_get_attr(a, avcodec_find_encoder_by_name(cd)); } static void libffmpeg_add(avm::vector& ci, const FCodec* s, CodecInfo::Media m, CodecInfo::Direction d) { char loptname[40] = "ff"; char linfo[50] = "FF "; char labout[300] = "FFMPEG "; avm::vector da; if (m == CodecInfo::Video) libffmpeg_fill_decattr(da, 0); while (s->fcc) { const char* coder; strcpy(loptname + 2, s->optname ? s->optname : s->ffname); strcpy(linfo + 3, s->info); strcpy(labout + 7, (s->about) ? s->about : s->info); switch (d) { case CodecInfo::Decode: coder = " decoder"; break; case CodecInfo::Encode: coder = " encoder"; break; case CodecInfo::Both: default: coder = " codec"; break; } strcat(labout, coder); ci.push_back(CodecInfo(s->fcc, linfo, s->ffname, labout, CodecInfo::Plugin, loptname, m, d, s->guid, 0, da)); s++; } } static void libffmpeg_add_video(avm::vector& ci) { const fourcc_t s_DIV3[] = { fccDIV3, fccdiv3, fccDIV4, fccdiv4, fccDIV5, fccdiv5, fccDIV6, fccdiv6, fccMP41, fccMP43, RIFFINFO_MPG3, RIFFINFO_mpg3, fccAP41, fccap41, fccAP42, fccap42, mmioFOURCC('C', 'O', 'L', '1'), // Cool codec mmioFOURCC('c', 'o', 'l', '1'), mmioFOURCC('C', 'O', 'L', '0'), mmioFOURCC('c', 'o', 'l', '0'), mmioFOURCC('3', 'I', 'V', 'D'), // 3ivx.com mmioFOURCC('3', 'i', 'v', 'd'), 0 }; const fourcc_t s_DIVX[] = { // OpenDivX fccDIVX, fccdivx, fccMP4S, fccmp4s, RIFFINFO_XVID, RIFFINFO_XviD, RIFFINFO_xvid, mmioFOURCC('m', 'p', '4', 'v'), mmioFOURCC('U', 'M', 'P', '4'), mmioFOURCC('3', 'I', 'V', '1'), mmioFOURCC('3', 'I', 'V', '2'), mmioFOURCC('3', 'i', 'v', '2'), mmioFOURCC('F', 'M', 'P', '4'), 0x4, 0 }; const fourcc_t s_MPEG12[] = { RIFFINFO_MPG1, RIFFINFO_MPG2, 0x10000001, 0x10000002, // mplayer's MPEG-PES 1/2 mmioFOURCC('M', 'P', 'E', 'G'), 0 }; const fourcc_t s_DX50[] = { fccDX50, fccdx50, 0 }; const fourcc_t s_WMV1[] = { fccWMV1, fccwmv1, 0 }; const fourcc_t s_WMV2[] = { fccWMV2, fccwmv2, 0 }; const fourcc_t s_WMV3[] = { RIFFINFO_WMV3, RIFFINFO_wmv3, 0 }; const fourcc_t s_MP41[] = { fccMPG4, fccmpg4, fccDIV1, fccdiv1, 0 }; const fourcc_t s_MP42[] = { fccMP42, fccmp42, fccDIV2, fccdiv2, 0 }; const fourcc_t s_VP3[] = { fccVP31, fccvp31, fccVP30, fccVP30, 0 }; const fourcc_t s_PIM1[] = { fccPIM1, 0 }; const fourcc_t s_SVQ1[] = { mmioFOURCC('S', 'V', 'Q', '1'), 0 }; const fourcc_t s_SVQ3[] = { mmioFOURCC('S', 'V', 'Q', '3'), 0 }; const fourcc_t s_MJPG[] = { fccMJPG, fccmjpg, mmioFOURCC('A', 'V', 'R', 'n'), mmioFOURCC('A', 'V', 'D', 'J'), mmioFOURCC('J', 'P', 'E', 'G'), mmioFOURCC('j', 'p', 'e', 'g'), mmioFOURCC('m', 'j', 'p', 'b'), 0 }; const fourcc_t s_H264[] = { mmioFOURCC('H', '2', '6', '4'), mmioFOURCC('h', '2', '6', '4'), mmioFOURCC('a', 'v', 'c', '1'), mmioFOURCC('d', 'a', 'v', 'c'), mmioFOURCC('D', 'A', 'V', 'C'), 0 }; const fourcc_t s_H263[] = { fccH263, fcch263, fccU263, fccu263, mmioFOURCC('s', '2', '6', '3'), 0 }; const fourcc_t s_I263[] = { fccI263, fcci263, 0 }; const fourcc_t s_DV[] = { fccDVSD, fccdvsd, fccdvhd, fccdvsl, mmioFOURCC('D', 'V', 'C', 'S'), mmioFOURCC('d', 'v', 'c', 's'), mmioFOURCC('d', 'v', 'c', 'p'), mmioFOURCC('d', 'v', 'c', ' '), 0 }; const fourcc_t s_HUF[] = { fccHFYU, 0 }; const fourcc_t s_INDEO3[] = { RIFFINFO_IV31, RIFFINFO_iv31, RIFFINFO_IV32, RIFFINFO_iv31, 0 }; const fourcc_t s_ASV1[] = { fccASV1, 0 }; const fourcc_t s_ASV2[] = { fccASV1, 0 }; const fourcc_t s_FFV1[] = { mmioFOURCC('F', 'F', 'V', '1'), 0 }; const fourcc_t s_VCR1[] = { fccVCR1, 0 }; const fourcc_t s_VCR2[] = { fccVCR2, 0 }; const fourcc_t s_MSVIDEO1[] = { fccCRAM, fcccram, fccMSVC, mmioFOURCC('m', 's', 'v', 'c'), mmioFOURCC('w', 'h', 'a', 'm'), mmioFOURCC('W', 'H', 'A', 'M'), 0 }; const fourcc_t s_FLV1[] = { mmioFOURCC('F', 'L', 'V', '1'), mmioFOURCC('f', 'l', 'v', '1'), 0 }; const fourcc_t s_WVC1[] = { mmioFOURCC('W', 'V', 'C', '1'), mmioFOURCC('w', 'v', 'c', '1'), 0 }; const fourcc_t s_CODECID[] = { CodecInfo::FFMPEG, 0 }; // video decoders const FCodec dec_video[] = { { "mpeg4", "dx50", "DivX5", "DivX 5.0", s_DX50, 0 }, // both { "huffyuv", 0, "Huffyuv", 0, s_HUF, 0 }, //both { "msmpeg4", "divx", "DivX ;-)", "LGPL version of popular M$ MPEG-4 video codec v3. " "Advanced compression technologies allow it to " "compress 640x480x25 video with a perfect " "quality into 100-150 kbytes/s ( 3-4 times " "less than MPEG-2 ).", s_DIV3, 0 }, { "mpeg4", "odivx", "OpenDivX", "OpenDivX MPEG-4", s_DIVX, 0 }, { "wmv1", 0, "Windows Media Video 7", "Windows Media Video 7/WMV1", s_WMV1, 0 }, { "wmv2", 0, "Windows Media Video 8", "Windows Media Video 8/WMV2", s_WMV2, 0 }, { "wmv3", 0, "Windows Media Video 9", "Windows Media Video 9/WMV3", s_WMV3, 0 }, { "msmpeg4v1", "mp41", "M$ MPEG-4 v1", 0, s_MP41, 0 }, { "msmpeg4v2", "mp42", "M$ MPEG-4 v2", 0, s_MP42, 0 }, { "mpegvideo", "mpeg", "MPEG 1/2", 0, s_MPEG12, 0 }, { "vp3", 0, "VP3", 0, s_VP3, 0 }, { "mpegvideo", "pim1", "PinnacleS PIM1", 0, s_PIM1, 0 }, { "svq1", 0, "SVQ1", "Sorenson 1", s_SVQ1, 0 }, { "svq3", 0, "SVQ3", "Sorenson 3", s_SVQ3, 0 }, { "mjpeg", 0, "Motion JPEG", 0, s_MJPG, 0 }, { "h264", 0, "H264", 0, s_H264, 0 }, { "h263", 0, "H263+", 0, s_H263, 0 }, { "h263i", 0, "I263", 0, s_I263, 0 }, { "dvvideo", "dv", "DV Video", 0, s_DV, 0 }, { "indeo3", 0, "Indeo 3", 0, s_INDEO3, 0 }, { "asv1", 0, "ASUS V1", 0, s_ASV1, 0 }, { "asv2", 0, "ASUS V2", 0, s_ASV2, 0 }, { "vcr1", 0, "VCR1", "ATI VCR-1", s_VCR1, 0 }, { "vcr2", 0, "VCR2", "ATI VCR-2", s_VCR2, 0 }, { "ffv1", 0, "FFV1", "FFV1 looseless", s_FFV1, 0 }, { "flv", 0, "FLV", "FLV", s_FLV1, 0 }, { "vc1", 0, "WVC", "WVC", s_WVC1, 0 }, { "msvideo1", "video1", "MSVideo1", "Microsoft Video 1", s_MSVIDEO1, 0 }, { "vcodec", 0, "FFMPEG", "Universal FFMPEG Video Codec", s_CODECID, 0 }, /* ci.push_back(CodecInfo(msvideo1_codecs, "FF MSVideo1", "msvideo1", "FF Microsoft Video 1 codec", CodecInfo::Plugin, "ffvideo1", CodecInfo::Video, CodecInfo::Decode, 0, 0, da)); */ { 0, 0, 0, 0, 0, 0 } }; libffmpeg_add(ci, dec_video, CodecInfo::Video, CodecInfo::Decode); } //da.push_back(AttributeInfo("Hue", "Hue", AttributeInfo::Integer, 0, 100)); //libffmpeg_fill_decattr(da, mpeg4_str); //avm::vector va; //libffmpeg_fill_encattr(va, mpeg4_str); static void libffmpeg_add_audio(avm::vector& ci) { const fourcc_t s_MP2[] = { WAVE_FORMAT_MPEG, 0 }; const fourcc_t s_MP3[] = { WAVE_FORMAT_MPEGLAYER3, mmioFOURCC('.', 'm', 'p', '3'), mmioFOURCC('L', 'A', 'M', 'E'), mmioFOURCC('M', 'P', '3', ' '), 0 }; const fourcc_t s_MS[] = { WAVE_FORMAT_ADPCM, 0 }; const fourcc_t s_ALAW[] = { WAVE_FORMAT_ALAW, 0 }; const fourcc_t s_ULAW[] = { WAVE_FORMAT_MULAW, 0 }; const fourcc_t s_IMAWAV[] = { WAVE_FORMAT_DVI_ADPCM, 0 }; // unsure const fourcc_t s_IMAQT[] = { 0x11, ('m' | ('i' << 8)), // ima4 0x34616d69 0 }; // unsure const fourcc_t s_YAMAHA[] = { WAVE_FORMAT_YAMAHA_ADPCM, 0 }; const fourcc_t s_G726[] = { WAVE_FORMAT_SPG726, 0 }; const fourcc_t s_IMA_DK4[] = { WAVE_FORMAT_ESPCM, 0 }; const fourcc_t s_IMA_DK3[] = { WAVE_FORMAT_VOXWARE, 0 }; const fourcc_t s_WMA1[] = { WAVE_FORMAT_MSAUDIO1, 0 }; const fourcc_t s_WMA2[] = { WAVE_FORMAT_MSAUDIO2, 0 }; const fourcc_t s_DVAUDIO[] = { (('D' << 8) | 'A'), 0 }; const fourcc_t s_MACE6[] = { ('A' | ('M' << 8)), 0 }; // unsure const fourcc_t s_RA144[] = { mmioFOURCC('1', '4', '_', '4'), 0x3431, 0 }; const fourcc_t s_RA288[] = { mmioFOURCC('2', '8', '_', '8'), 0x3431, 0 }; const fourcc_t s_AAC[] = { ('m' | ('p' << 8)), ('M' | ('P' << 8)), mmioFOURCC('m', 'p', '4', 'a'), mmioFOURCC('M', 'P', '4', 'A'), 0 }; const fourcc_t s_AC3[] = { WAVE_FORMAT_DVM, 0 }; const fourcc_t s_DTS[] = { 0x2001, 0x10, 0 }; const fourcc_t s_EXTENSIBLE[] = { WAVE_FORMAT_EXTENSIBLE, 0 }; const GUID vorbis_guid = { 0x6bA47966, 0x3F83, 0x4178, {0x96, 0x65, 0x00, 0xF0, 0xBF, 0x62, 0x92, 0xE5} }; const FCodec dec_audio[] = { { "mp2", 0, "MPEG Layer-2", "MPEG Layer-II", s_MP2, 0 }, { "mp3", 0, "MPEG Layer-3", "MPEG Layer-III", s_MP3, 0 }, { "adpcm_ms", "adpcmms", "MS ADPCM", 0, s_MS, 0 }, { "pcm_alaw", "alaw", "ALaw", 0, s_ALAW, 0 }, { "pcm_mulaw", "mulaw", "uLaw", 0, s_ULAW, 0 }, { "wmav1", 0, "WMA v1", "Windows Media Audio v1", s_WMA1, 0 }, { "wmav2", 0, "WMA v2", "Windows Media Audio v2", s_WMA2, 0 }, { "adpcm_ima_qt", "imaqt", "IMA Qt", 0, s_IMAQT, 0 }, { "adpcm_ima_wav", "imawav", "IMA WAV", 0, s_IMAWAV, 0 }, { "dvaudio", "dva", "DV Audio", 0, s_DVAUDIO, 0 }, { "mace6", "mac6", "MACE6 Qt", "Macintosh Audio Compression and Expansion 6:1", s_MACE6, 0 }, { "real_144", "ra144", "Real 144", "Real Audio 14.4kbps", s_RA144, 0 }, { "real_288", "ra288", "Real 288", "Real Audio 28.8kbps", s_RA288, 0 }, { "ac3", 0, "AC3", "ATSC A/52A AC-3", s_AC3, 0 }, { "eac3", 0, "EAC3", "ATSC A/52B (AC-3, E-AC-3)", s_AC3, 0 }, { "dts", 0, "DTS", 0, s_DTS, 0 }, { "libfaad", "aac", "FAAD (runtime)", "FAAD - MPEG2/MPEG4 AAC Freeware Advanced Audio Decoder, " "http://www.audiocoding.com/ Copyright (C) 2002 M. Bakker", s_AAC, 0 }, { "acodec", 0, "FFMPEG", "Universal FFMPEG Audio Codec", s_EXTENSIBLE, &CodecInfo::FFMPEG_GUID }, { 0, 0, 0, 0, 0, 0 } }; libffmpeg_add(ci, dec_audio, CodecInfo::Audio, CodecInfo::Decode); } static void ffmpeg_FillPlugins(avm::vector& ci) { libffmpeg_add_video(ci); libffmpeg_add_audio(ci); } AVM_END_NAMESPACE; #endif // FFMPEG_FILLPLUGINS_H avifile-0.7.48~20090503.ds/plugins/libffmpeg/libffmpeg.cpp0000644000175000017500000001303411174451070022015 0ustar yavoryavor#include "fillplugins.h" #include "FFAudioDecoder.h" #include "FFVideoDecoder.h" #include "FFVideoEncoder.h" #include "videoencoder.h" #include "avm_output.h" #include "plugin.h" #include "utils.h" #include #include AVM_BEGIN_NAMESPACE; PLUGIN_TEMP(ffmpeg); #if 0 class FFVideoDec: public IVideoDecoder { public: FFVideoDec(AVCodec* av,const CodecInfo& info, const BITMAPINFOHEADER& format, int flip); :IVideoDecoder(info, bh), m_pAvCodec(av), m_Caps(CAP_YV12), m_bOpened(false) { m_Dest.SetSpace(fccYV12); if (flip) m_Dest.biHeight *= -1; if (avcodec(0, AVCODEC_OPEN_BY_FCC, (void*)info.fourcc, &m_pHandle) < 0) throw; AVM_WRITE("FFMPEG video decoder", "opened\n"); } virtual ~FFVideoDec(); { Stop(); } virtual int DecodeFrame(CImage* pImage, const void* src, uint_t size, int is_keyframe, bool render = true); { if (!m_bOpened) { memset(&m_AvContext, 0, sizeof(AVCodecContext)); m_AvContext.width = m_Dest.biWidth; m_AvContext.height = labs(m_Dest.biHeight); m_AvContext.pix_fmt = PIX_FMT_YUV422; if (avcodec_open(&m_AvContext, m_pAvCodec) < 0) { AVM_WRITE("FFMPEG video decoder", "WARNING: FFVideoDecoder::DecodeFrame() can't open avcodec\n"); return -1; } else m_bOpened = true; } while (size > 0) { int got_picture = 0; int hr = avcodec_decode_video(&m_AvContext, &m_AvPicture, &got_picture, (unsigned char*) src, size); if (hr < 0) { AVM_WRITE("FFMPEG video decoder", "WARNING: FFVideoDecoder::DecodeFrame() hr=%d\n", hr); return hr; } //printf("DECFF got_picture %d %p %d del:%d hr:%d\n" , got_picture, src, size, m_AvContext.delay, hr); if (!got_picture) return hr + 1; int imfmt; switch (m_AvContext.pix_fmt) { case PIX_FMT_YUV420P: imfmt = IMG_FMT_I420; break; case PIX_FMT_YUV422: imfmt = IMG_FMT_I420; break; case PIX_FMT_RGB24: imfmt = IMG_FMT_RGB24; break; case PIX_FMT_BGR24: imfmt = IMG_FMT_BGR24; break; case PIX_FMT_YUV422P: imfmt = IMG_FMT_Y422; break; case PIX_FMT_YUV444P: imfmt = IMG_FMT_IYU2; break; default: AVM_WRITE("FFMPEG video decoder", "Unknown colorspace\n"); return -1; } //printf("CONTEXT %d %x %.4s\n", got_picture, m_AvContext.pix_fmt, (char*)&imfmt); if (got_picture && pImage && render) { BitmapInfo bi(m_Dest); bi.SetSpace(imfmt); //printf("LINE %d %d %d\n", m_AvPicture.linesize[0], m_AvPicture.linesize[1], m_AvPicture.linesize[2]); //printf("LINE %p %p %p\n", m_AvPicture.data[0], m_AvPicture.data[1], m_AvPicture.data[2]); CImage ci(&bi, (const uint8_t**) m_AvPicture.data, m_AvPicture.linesize, false); pImage->Convert(&ci); //printf("xxx %p\n", m_AvPicture.data[0]); //memcpy(pImage->Data(), m_AvPicture.data[0], 320 * 50); } size -= hr; src = (const char*) src + hr; } return 0; } virtual CAPS GetCapabilities() const { return m_Caps; } virtual void Flush(); { if (m_bOpened) avcodec_flush_buffers(&m_AvContext); } virtual int SetDestFmt(int bits = 24, fourcc_t csp = 0); { if (!CImage::Supported(csp, bits) || csp != fccYV12) return -1; Restart(); return 0; } virtual int Stop(); { if (m_bOpened) avcodec_close(&m_AvContext); m_bOpened = false; return 0; } protected: void* m_pHandle; AVPicture m_AvPicture; CAPS m_Caps; bool m_bOpened; bool m_bFlushed; }; #endif // figure out which codec we need to use static IVideoEncoder* ffmpeg_CreateVideoEncoder(const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& bh) { AVCodec* av = avcodec_find_encoder_by_name(info.dll.c_str()); if (av) { switch (bh.biCompression) { case 0: case fccYUY2: case fccYV12: case fccI420: case fccDIVX: case fccDX50: return new FFVideoEncoder(av, info, compressor, bh); default: ffmpeg_error_set("unsupported input format"); } } else ffmpeg_error_set("video codec not found"); return 0; } static IVideoDecoder* ffmpeg_CreateVideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& bh, int flip) { AVM_WRITE("FFMPEG video decoder", "looking for %s %d\n", info.dll.c_str(), bh.biSizeImage); AVCodec* av = (bh.biCompression == CodecInfo::FFMPEG) ? avcodec_find_decoder(CodecID(bh.biSizeImage)) : avcodec_find_decoder_by_name(info.dll.c_str()); if (av) return new FFVideoDecoder(av, info, bh, flip); ffmpeg_error_set("video codec not found"); return 0; } static IAudioDecoder* ffmpeg_CreateAudioDecoder(const CodecInfo& info, const WAVEFORMATEX* fmt) { FFMPEGWAVEFORMATEX& ffwfe = *(FFMPEGWAVEFORMATEX*)fmt; AVM_WRITE("FFMPEG video decoder", "looking for %s %x\n", info.dll.c_str(), fmt->wFormatTag); AVCodec* av = (fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE && avm_get_le32(&ffwfe.wfex.SubFormat.f1) == CodecInfo::FFMPEG) ? avcodec_find_decoder(CodecID(avm_get_le32(&ffwfe.dwCodecID))) : avcodec_find_decoder_by_name(info.dll.c_str()); if (av) return new FFAudioDecoder(av, info, fmt); ffmpeg_error_set("audio codec not found"); return 0; } AVM_END_NAMESPACE; extern "C" AVMEXPORT avm::codec_plugin_t avm_codec_plugin_ffmpeg; avm::codec_plugin_t avm_codec_plugin_ffmpeg = { PLUGIN_API_VERSION, 0, avm::PluginGetAttrFloat, avm::PluginSetAttrFloat, avm::PluginGetAttrInt, avm::PluginSetAttrInt, avm::PluginGetAttrString, avm::PluginSetAttrString, avm::ffmpeg_FillPlugins, avm::ffmpeg_CreateAudioDecoder, 0, avm::ffmpeg_CreateVideoDecoder, avm::ffmpeg_CreateVideoEncoder, }; avifile-0.7.48~20090503.ds/plugins/libffmpeg/testvideo.cpp0000644000175000017500000000554610642711725022106 0ustar yavoryavor/** * * Test sample for checking codec options for ffmpeg codecs * */ #include "fillplugins.h" #include #include #include #include #include #include #include static const char* filename = // "/net/hdd2/movies/test/wm8_vandread.wmv"; // "/net/hdd2/movies/test/Lucky.asf"; // "/net/hdd2/movies/test3/imaadcmp.avi"; // "/net/hdd2/movies/test2/tm20.avi"; // "/net/hdd2/movies/test7/p_mjpg.avi"; // "/net/hdd2/movies/test7/pimj.avi"; // "/net/hdd2/movies/test/Tool_Sober.avi"; // "/net/hdd2/movies/test/Gone.avi"; "/net/hdd2/movies/test2/avid.avi"; // "/net/hdd2/movies/test/fs306fs-20meg.avi"; static double tot_time = 0.0; void testspeed(const char* fn) { IAviReadFile* file = CreateIAviReadFile(fn); if (!file) { fprintf(stderr, "can't open file: %s\n", fn); return; } IAviReadStream* vrs = file->GetStream(0, AviStream::Video); if (!vrs) { fprintf(stderr, "no video stream in %s\n", fn); delete file; return; } if (vrs->StartStreaming() == 0) { //vrs->GetDecoder()->SetDestFmt(0, fccUYVY); //vrs->GetDecoder()->SetDestFmt(0, fccUYVY); //vrs->GetDecoder()->SetDestFmt(24); BitmapInfo(vrs->GetDecoder()->GetDestFmt()).Print(); vrs->Seek(702); int counter = 50000; while (counter-- > 0 && !vrs->Eof()) { uint_t samples_read, bytes_read; int64_t x = avm_get_time_us(); vrs->ReadFrame(false); tot_time += avm_get_time_diff(avm_get_time_us(), x); //printf("read %d %d\n", counter, vrs->Eof()); } vrs->StopStreaming(); } printf("Total decompression time: %f\n", tot_time); delete file; } void testwrite(const char* fn) { IAviReadFile* file = CreateIAviReadFile(fn); if (!file) { fprintf(stderr, "can't open file: %s\n", fn); return; } IAviReadStream* vrs = file->GetStream(0, AviStream::Video); if (!vrs) { fprintf(stderr, "no video stream in %s\n", fn); delete file; return; } //IAviReadStream* if (vrs->StartStreaming() == 0) { //vrs->GetDecoder()->SetDestFmt(0, fccUYVY); //vrs->GetDecoder()->SetDestFmt(0, fccUYVY); //vrs->GetDecoder()->SetDestFmt(24); BitmapInfo(vrs->GetDecoder()->GetDestFmt()).Print(); vrs->Seek(702); int counter = 50000; while (counter-- > 0 && !vrs->Eof()) { uint_t samples_read, bytes_read; int64_t x = avm_get_time_us(); vrs->ReadFrame(false); tot_time += avm_get_time_diff(avm_get_time_us(), x); //printf("read %d %d\n", counter, vrs->Eof()); } vrs->StopStreaming(); } printf("Total decompression time: %f\n", tot_time); delete file; } extern "C" struct kprof_thread* kprof_init(void); int main(int argc, char* argv[]) { //kprof_init(); if (argc > 1) filename = argv[1]; char zz[100000]; for (int i = 0; i < 1; i++) testspeed(filename); return 0; } avifile-0.7.48~20090503.ds/plugins/libmad/0000755000175000017500000000000011267646347016672 5ustar yavoryavoravifile-0.7.48~20090503.ds/plugins/libmad/libmad/0000755000175000017500000000000011267646347020122 5ustar yavoryavoravifile-0.7.48~20090503.ds/plugins/libmad/libmad/COPYRIGHT0000644000175000017500000000162610403644441021402 0ustar yavoryavor libmad - MPEG audio decoder library Copyright (C) 2000-2004 Underbit Technologies, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU 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 If you would like to negotiate alternate licensing terms, you may do so by contacting: Underbit Technologies, Inc. avifile-0.7.48~20090503.ds/plugins/libmad/libmad/D.dat0000644000175000017500000006355210403644441020772 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: D.dat,v 1.2 2006/03/08 21:14:09 kabi Exp $ */ /* * These are the coefficients for the subband synthesis window. This is a * reordered version of Table B.3 from ISO/IEC 11172-3. * * Every value is parameterized so that shift optimizations can be made at * compile-time. For example, every value can be right-shifted 12 bits to * minimize multiply instruction times without any loss of accuracy. */ { PRESHIFT(0x00000000) /* 0.000000000 */, /* 0 */ -PRESHIFT(0x0001d000) /* -0.000442505 */, PRESHIFT(0x000d5000) /* 0.003250122 */, -PRESHIFT(0x001cb000) /* -0.007003784 */, PRESHIFT(0x007f5000) /* 0.031082153 */, -PRESHIFT(0x01421000) /* -0.078628540 */, PRESHIFT(0x019ae000) /* 0.100311279 */, -PRESHIFT(0x09271000) /* -0.572036743 */, PRESHIFT(0x1251e000) /* 1.144989014 */, PRESHIFT(0x09271000) /* 0.572036743 */, PRESHIFT(0x019ae000) /* 0.100311279 */, PRESHIFT(0x01421000) /* 0.078628540 */, PRESHIFT(0x007f5000) /* 0.031082153 */, PRESHIFT(0x001cb000) /* 0.007003784 */, PRESHIFT(0x000d5000) /* 0.003250122 */, PRESHIFT(0x0001d000) /* 0.000442505 */, PRESHIFT(0x00000000) /* 0.000000000 */, -PRESHIFT(0x0001d000) /* -0.000442505 */, PRESHIFT(0x000d5000) /* 0.003250122 */, -PRESHIFT(0x001cb000) /* -0.007003784 */, PRESHIFT(0x007f5000) /* 0.031082153 */, -PRESHIFT(0x01421000) /* -0.078628540 */, PRESHIFT(0x019ae000) /* 0.100311279 */, -PRESHIFT(0x09271000) /* -0.572036743 */, PRESHIFT(0x1251e000) /* 1.144989014 */, PRESHIFT(0x09271000) /* 0.572036743 */, PRESHIFT(0x019ae000) /* 0.100311279 */, PRESHIFT(0x01421000) /* 0.078628540 */, PRESHIFT(0x007f5000) /* 0.031082153 */, PRESHIFT(0x001cb000) /* 0.007003784 */, PRESHIFT(0x000d5000) /* 0.003250122 */, PRESHIFT(0x0001d000) /* 0.000442505 */ }, { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 1 */ -PRESHIFT(0x0001f000) /* -0.000473022 */, PRESHIFT(0x000da000) /* 0.003326416 */, -PRESHIFT(0x00207000) /* -0.007919312 */, PRESHIFT(0x007d0000) /* 0.030517578 */, -PRESHIFT(0x0158d000) /* -0.084182739 */, PRESHIFT(0x01747000) /* 0.090927124 */, -PRESHIFT(0x099a8000) /* -0.600219727 */, PRESHIFT(0x124f0000) /* 1.144287109 */, PRESHIFT(0x08b38000) /* 0.543823242 */, PRESHIFT(0x01bde000) /* 0.108856201 */, PRESHIFT(0x012b4000) /* 0.073059082 */, PRESHIFT(0x0080f000) /* 0.031478882 */, PRESHIFT(0x00191000) /* 0.006118774 */, PRESHIFT(0x000d0000) /* 0.003173828 */, PRESHIFT(0x0001a000) /* 0.000396729 */, -PRESHIFT(0x00001000) /* -0.000015259 */, -PRESHIFT(0x0001f000) /* -0.000473022 */, PRESHIFT(0x000da000) /* 0.003326416 */, -PRESHIFT(0x00207000) /* -0.007919312 */, PRESHIFT(0x007d0000) /* 0.030517578 */, -PRESHIFT(0x0158d000) /* -0.084182739 */, PRESHIFT(0x01747000) /* 0.090927124 */, -PRESHIFT(0x099a8000) /* -0.600219727 */, PRESHIFT(0x124f0000) /* 1.144287109 */, PRESHIFT(0x08b38000) /* 0.543823242 */, PRESHIFT(0x01bde000) /* 0.108856201 */, PRESHIFT(0x012b4000) /* 0.073059082 */, PRESHIFT(0x0080f000) /* 0.031478882 */, PRESHIFT(0x00191000) /* 0.006118774 */, PRESHIFT(0x000d0000) /* 0.003173828 */, PRESHIFT(0x0001a000) /* 0.000396729 */ }, { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 2 */ -PRESHIFT(0x00023000) /* -0.000534058 */, PRESHIFT(0x000de000) /* 0.003387451 */, -PRESHIFT(0x00245000) /* -0.008865356 */, PRESHIFT(0x007a0000) /* 0.029785156 */, -PRESHIFT(0x016f7000) /* -0.089706421 */, PRESHIFT(0x014a8000) /* 0.080688477 */, -PRESHIFT(0x0a0d8000) /* -0.628295898 */, PRESHIFT(0x12468000) /* 1.142211914 */, PRESHIFT(0x083ff000) /* 0.515609741 */, PRESHIFT(0x01dd8000) /* 0.116577148 */, PRESHIFT(0x01149000) /* 0.067520142 */, PRESHIFT(0x00820000) /* 0.031738281 */, PRESHIFT(0x0015b000) /* 0.005294800 */, PRESHIFT(0x000ca000) /* 0.003082275 */, PRESHIFT(0x00018000) /* 0.000366211 */, -PRESHIFT(0x00001000) /* -0.000015259 */, -PRESHIFT(0x00023000) /* -0.000534058 */, PRESHIFT(0x000de000) /* 0.003387451 */, -PRESHIFT(0x00245000) /* -0.008865356 */, PRESHIFT(0x007a0000) /* 0.029785156 */, -PRESHIFT(0x016f7000) /* -0.089706421 */, PRESHIFT(0x014a8000) /* 0.080688477 */, -PRESHIFT(0x0a0d8000) /* -0.628295898 */, PRESHIFT(0x12468000) /* 1.142211914 */, PRESHIFT(0x083ff000) /* 0.515609741 */, PRESHIFT(0x01dd8000) /* 0.116577148 */, PRESHIFT(0x01149000) /* 0.067520142 */, PRESHIFT(0x00820000) /* 0.031738281 */, PRESHIFT(0x0015b000) /* 0.005294800 */, PRESHIFT(0x000ca000) /* 0.003082275 */, PRESHIFT(0x00018000) /* 0.000366211 */ }, { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 3 */ -PRESHIFT(0x00026000) /* -0.000579834 */, PRESHIFT(0x000e1000) /* 0.003433228 */, -PRESHIFT(0x00285000) /* -0.009841919 */, PRESHIFT(0x00765000) /* 0.028884888 */, -PRESHIFT(0x0185d000) /* -0.095169067 */, PRESHIFT(0x011d1000) /* 0.069595337 */, -PRESHIFT(0x0a7fe000) /* -0.656219482 */, PRESHIFT(0x12386000) /* 1.138763428 */, PRESHIFT(0x07ccb000) /* 0.487472534 */, PRESHIFT(0x01f9c000) /* 0.123474121 */, PRESHIFT(0x00fdf000) /* 0.061996460 */, PRESHIFT(0x00827000) /* 0.031845093 */, PRESHIFT(0x00126000) /* 0.004486084 */, PRESHIFT(0x000c4000) /* 0.002990723 */, PRESHIFT(0x00015000) /* 0.000320435 */, -PRESHIFT(0x00001000) /* -0.000015259 */, -PRESHIFT(0x00026000) /* -0.000579834 */, PRESHIFT(0x000e1000) /* 0.003433228 */, -PRESHIFT(0x00285000) /* -0.009841919 */, PRESHIFT(0x00765000) /* 0.028884888 */, -PRESHIFT(0x0185d000) /* -0.095169067 */, PRESHIFT(0x011d1000) /* 0.069595337 */, -PRESHIFT(0x0a7fe000) /* -0.656219482 */, PRESHIFT(0x12386000) /* 1.138763428 */, PRESHIFT(0x07ccb000) /* 0.487472534 */, PRESHIFT(0x01f9c000) /* 0.123474121 */, PRESHIFT(0x00fdf000) /* 0.061996460 */, PRESHIFT(0x00827000) /* 0.031845093 */, PRESHIFT(0x00126000) /* 0.004486084 */, PRESHIFT(0x000c4000) /* 0.002990723 */, PRESHIFT(0x00015000) /* 0.000320435 */ }, { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 4 */ -PRESHIFT(0x00029000) /* -0.000625610 */, PRESHIFT(0x000e3000) /* 0.003463745 */, -PRESHIFT(0x002c7000) /* -0.010848999 */, PRESHIFT(0x0071e000) /* 0.027801514 */, -PRESHIFT(0x019bd000) /* -0.100540161 */, PRESHIFT(0x00ec0000) /* 0.057617187 */, -PRESHIFT(0x0af15000) /* -0.683914185 */, PRESHIFT(0x12249000) /* 1.133926392 */, PRESHIFT(0x075a0000) /* 0.459472656 */, PRESHIFT(0x0212c000) /* 0.129577637 */, PRESHIFT(0x00e79000) /* 0.056533813 */, PRESHIFT(0x00825000) /* 0.031814575 */, PRESHIFT(0x000f4000) /* 0.003723145 */, PRESHIFT(0x000be000) /* 0.002899170 */, PRESHIFT(0x00013000) /* 0.000289917 */, -PRESHIFT(0x00001000) /* -0.000015259 */, -PRESHIFT(0x00029000) /* -0.000625610 */, PRESHIFT(0x000e3000) /* 0.003463745 */, -PRESHIFT(0x002c7000) /* -0.010848999 */, PRESHIFT(0x0071e000) /* 0.027801514 */, -PRESHIFT(0x019bd000) /* -0.100540161 */, PRESHIFT(0x00ec0000) /* 0.057617187 */, -PRESHIFT(0x0af15000) /* -0.683914185 */, PRESHIFT(0x12249000) /* 1.133926392 */, PRESHIFT(0x075a0000) /* 0.459472656 */, PRESHIFT(0x0212c000) /* 0.129577637 */, PRESHIFT(0x00e79000) /* 0.056533813 */, PRESHIFT(0x00825000) /* 0.031814575 */, PRESHIFT(0x000f4000) /* 0.003723145 */, PRESHIFT(0x000be000) /* 0.002899170 */, PRESHIFT(0x00013000) /* 0.000289917 */ }, { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 5 */ -PRESHIFT(0x0002d000) /* -0.000686646 */, PRESHIFT(0x000e4000) /* 0.003479004 */, -PRESHIFT(0x0030b000) /* -0.011886597 */, PRESHIFT(0x006cb000) /* 0.026535034 */, -PRESHIFT(0x01b17000) /* -0.105819702 */, PRESHIFT(0x00b77000) /* 0.044784546 */, -PRESHIFT(0x0b619000) /* -0.711318970 */, PRESHIFT(0x120b4000) /* 1.127746582 */, PRESHIFT(0x06e81000) /* 0.431655884 */, PRESHIFT(0x02288000) /* 0.134887695 */, PRESHIFT(0x00d17000) /* 0.051132202 */, PRESHIFT(0x0081b000) /* 0.031661987 */, PRESHIFT(0x000c5000) /* 0.003005981 */, PRESHIFT(0x000b7000) /* 0.002792358 */, PRESHIFT(0x00011000) /* 0.000259399 */, -PRESHIFT(0x00001000) /* -0.000015259 */, -PRESHIFT(0x0002d000) /* -0.000686646 */, PRESHIFT(0x000e4000) /* 0.003479004 */, -PRESHIFT(0x0030b000) /* -0.011886597 */, PRESHIFT(0x006cb000) /* 0.026535034 */, -PRESHIFT(0x01b17000) /* -0.105819702 */, PRESHIFT(0x00b77000) /* 0.044784546 */, -PRESHIFT(0x0b619000) /* -0.711318970 */, PRESHIFT(0x120b4000) /* 1.127746582 */, PRESHIFT(0x06e81000) /* 0.431655884 */, PRESHIFT(0x02288000) /* 0.134887695 */, PRESHIFT(0x00d17000) /* 0.051132202 */, PRESHIFT(0x0081b000) /* 0.031661987 */, PRESHIFT(0x000c5000) /* 0.003005981 */, PRESHIFT(0x000b7000) /* 0.002792358 */, PRESHIFT(0x00011000) /* 0.000259399 */ }, { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 6 */ -PRESHIFT(0x00031000) /* -0.000747681 */, PRESHIFT(0x000e4000) /* 0.003479004 */, -PRESHIFT(0x00350000) /* -0.012939453 */, PRESHIFT(0x0066c000) /* 0.025085449 */, -PRESHIFT(0x01c67000) /* -0.110946655 */, PRESHIFT(0x007f5000) /* 0.031082153 */, -PRESHIFT(0x0bd06000) /* -0.738372803 */, PRESHIFT(0x11ec7000) /* 1.120223999 */, PRESHIFT(0x06772000) /* 0.404083252 */, PRESHIFT(0x023b3000) /* 0.139450073 */, PRESHIFT(0x00bbc000) /* 0.045837402 */, PRESHIFT(0x00809000) /* 0.031387329 */, PRESHIFT(0x00099000) /* 0.002334595 */, PRESHIFT(0x000b0000) /* 0.002685547 */, PRESHIFT(0x00010000) /* 0.000244141 */, -PRESHIFT(0x00001000) /* -0.000015259 */, -PRESHIFT(0x00031000) /* -0.000747681 */, PRESHIFT(0x000e4000) /* 0.003479004 */, -PRESHIFT(0x00350000) /* -0.012939453 */, PRESHIFT(0x0066c000) /* 0.025085449 */, -PRESHIFT(0x01c67000) /* -0.110946655 */, PRESHIFT(0x007f5000) /* 0.031082153 */, -PRESHIFT(0x0bd06000) /* -0.738372803 */, PRESHIFT(0x11ec7000) /* 1.120223999 */, PRESHIFT(0x06772000) /* 0.404083252 */, PRESHIFT(0x023b3000) /* 0.139450073 */, PRESHIFT(0x00bbc000) /* 0.045837402 */, PRESHIFT(0x00809000) /* 0.031387329 */, PRESHIFT(0x00099000) /* 0.002334595 */, PRESHIFT(0x000b0000) /* 0.002685547 */, PRESHIFT(0x00010000) /* 0.000244141 */ }, { -PRESHIFT(0x00002000) /* -0.000030518 */, /* 7 */ -PRESHIFT(0x00035000) /* -0.000808716 */, PRESHIFT(0x000e3000) /* 0.003463745 */, -PRESHIFT(0x00397000) /* -0.014022827 */, PRESHIFT(0x005ff000) /* 0.023422241 */, -PRESHIFT(0x01dad000) /* -0.115921021 */, PRESHIFT(0x0043a000) /* 0.016510010 */, -PRESHIFT(0x0c3d9000) /* -0.765029907 */, PRESHIFT(0x11c83000) /* 1.111373901 */, PRESHIFT(0x06076000) /* 0.376800537 */, PRESHIFT(0x024ad000) /* 0.143264771 */, PRESHIFT(0x00a67000) /* 0.040634155 */, PRESHIFT(0x007f0000) /* 0.031005859 */, PRESHIFT(0x0006f000) /* 0.001693726 */, PRESHIFT(0x000a9000) /* 0.002578735 */, PRESHIFT(0x0000e000) /* 0.000213623 */, -PRESHIFT(0x00002000) /* -0.000030518 */, -PRESHIFT(0x00035000) /* -0.000808716 */, PRESHIFT(0x000e3000) /* 0.003463745 */, -PRESHIFT(0x00397000) /* -0.014022827 */, PRESHIFT(0x005ff000) /* 0.023422241 */, -PRESHIFT(0x01dad000) /* -0.115921021 */, PRESHIFT(0x0043a000) /* 0.016510010 */, -PRESHIFT(0x0c3d9000) /* -0.765029907 */, PRESHIFT(0x11c83000) /* 1.111373901 */, PRESHIFT(0x06076000) /* 0.376800537 */, PRESHIFT(0x024ad000) /* 0.143264771 */, PRESHIFT(0x00a67000) /* 0.040634155 */, PRESHIFT(0x007f0000) /* 0.031005859 */, PRESHIFT(0x0006f000) /* 0.001693726 */, PRESHIFT(0x000a9000) /* 0.002578735 */, PRESHIFT(0x0000e000) /* 0.000213623 */ }, { -PRESHIFT(0x00002000) /* -0.000030518 */, /* 8 */ -PRESHIFT(0x0003a000) /* -0.000885010 */, PRESHIFT(0x000e0000) /* 0.003417969 */, -PRESHIFT(0x003df000) /* -0.015121460 */, PRESHIFT(0x00586000) /* 0.021575928 */, -PRESHIFT(0x01ee6000) /* -0.120697021 */, PRESHIFT(0x00046000) /* 0.001068115 */, -PRESHIFT(0x0ca8d000) /* -0.791213989 */, PRESHIFT(0x119e9000) /* 1.101211548 */, PRESHIFT(0x05991000) /* 0.349868774 */, PRESHIFT(0x02578000) /* 0.146362305 */, PRESHIFT(0x0091a000) /* 0.035552979 */, PRESHIFT(0x007d1000) /* 0.030532837 */, PRESHIFT(0x00048000) /* 0.001098633 */, PRESHIFT(0x000a1000) /* 0.002456665 */, PRESHIFT(0x0000d000) /* 0.000198364 */, -PRESHIFT(0x00002000) /* -0.000030518 */, -PRESHIFT(0x0003a000) /* -0.000885010 */, PRESHIFT(0x000e0000) /* 0.003417969 */, -PRESHIFT(0x003df000) /* -0.015121460 */, PRESHIFT(0x00586000) /* 0.021575928 */, -PRESHIFT(0x01ee6000) /* -0.120697021 */, PRESHIFT(0x00046000) /* 0.001068115 */, -PRESHIFT(0x0ca8d000) /* -0.791213989 */, PRESHIFT(0x119e9000) /* 1.101211548 */, PRESHIFT(0x05991000) /* 0.349868774 */, PRESHIFT(0x02578000) /* 0.146362305 */, PRESHIFT(0x0091a000) /* 0.035552979 */, PRESHIFT(0x007d1000) /* 0.030532837 */, PRESHIFT(0x00048000) /* 0.001098633 */, PRESHIFT(0x000a1000) /* 0.002456665 */, PRESHIFT(0x0000d000) /* 0.000198364 */ }, { -PRESHIFT(0x00002000) /* -0.000030518 */, /* 9 */ -PRESHIFT(0x0003f000) /* -0.000961304 */, PRESHIFT(0x000dd000) /* 0.003372192 */, -PRESHIFT(0x00428000) /* -0.016235352 */, PRESHIFT(0x00500000) /* 0.019531250 */, -PRESHIFT(0x02011000) /* -0.125259399 */, -PRESHIFT(0x003e6000) /* -0.015228271 */, -PRESHIFT(0x0d11e000) /* -0.816864014 */, PRESHIFT(0x116fc000) /* 1.089782715 */, PRESHIFT(0x052c5000) /* 0.323318481 */, PRESHIFT(0x02616000) /* 0.148773193 */, PRESHIFT(0x007d6000) /* 0.030609131 */, PRESHIFT(0x007aa000) /* 0.029937744 */, PRESHIFT(0x00024000) /* 0.000549316 */, PRESHIFT(0x0009a000) /* 0.002349854 */, PRESHIFT(0x0000b000) /* 0.000167847 */, -PRESHIFT(0x00002000) /* -0.000030518 */, -PRESHIFT(0x0003f000) /* -0.000961304 */, PRESHIFT(0x000dd000) /* 0.003372192 */, -PRESHIFT(0x00428000) /* -0.016235352 */, PRESHIFT(0x00500000) /* 0.019531250 */, -PRESHIFT(0x02011000) /* -0.125259399 */, -PRESHIFT(0x003e6000) /* -0.015228271 */, -PRESHIFT(0x0d11e000) /* -0.816864014 */, PRESHIFT(0x116fc000) /* 1.089782715 */, PRESHIFT(0x052c5000) /* 0.323318481 */, PRESHIFT(0x02616000) /* 0.148773193 */, PRESHIFT(0x007d6000) /* 0.030609131 */, PRESHIFT(0x007aa000) /* 0.029937744 */, PRESHIFT(0x00024000) /* 0.000549316 */, PRESHIFT(0x0009a000) /* 0.002349854 */, PRESHIFT(0x0000b000) /* 0.000167847 */ }, { -PRESHIFT(0x00002000) /* -0.000030518 */, /* 10 */ -PRESHIFT(0x00044000) /* -0.001037598 */, PRESHIFT(0x000d7000) /* 0.003280640 */, -PRESHIFT(0x00471000) /* -0.017349243 */, PRESHIFT(0x0046b000) /* 0.017257690 */, -PRESHIFT(0x0212b000) /* -0.129562378 */, -PRESHIFT(0x0084a000) /* -0.032379150 */, -PRESHIFT(0x0d78a000) /* -0.841949463 */, PRESHIFT(0x113be000) /* 1.077117920 */, PRESHIFT(0x04c16000) /* 0.297210693 */, PRESHIFT(0x02687000) /* 0.150497437 */, PRESHIFT(0x0069c000) /* 0.025817871 */, PRESHIFT(0x0077f000) /* 0.029281616 */, PRESHIFT(0x00002000) /* 0.000030518 */, PRESHIFT(0x00093000) /* 0.002243042 */, PRESHIFT(0x0000a000) /* 0.000152588 */, -PRESHIFT(0x00002000) /* -0.000030518 */, -PRESHIFT(0x00044000) /* -0.001037598 */, PRESHIFT(0x000d7000) /* 0.003280640 */, -PRESHIFT(0x00471000) /* -0.017349243 */, PRESHIFT(0x0046b000) /* 0.017257690 */, -PRESHIFT(0x0212b000) /* -0.129562378 */, -PRESHIFT(0x0084a000) /* -0.032379150 */, -PRESHIFT(0x0d78a000) /* -0.841949463 */, PRESHIFT(0x113be000) /* 1.077117920 */, PRESHIFT(0x04c16000) /* 0.297210693 */, PRESHIFT(0x02687000) /* 0.150497437 */, PRESHIFT(0x0069c000) /* 0.025817871 */, PRESHIFT(0x0077f000) /* 0.029281616 */, PRESHIFT(0x00002000) /* 0.000030518 */, PRESHIFT(0x00093000) /* 0.002243042 */, PRESHIFT(0x0000a000) /* 0.000152588 */ }, { -PRESHIFT(0x00003000) /* -0.000045776 */, /* 11 */ -PRESHIFT(0x00049000) /* -0.001113892 */, PRESHIFT(0x000d0000) /* 0.003173828 */, -PRESHIFT(0x004ba000) /* -0.018463135 */, PRESHIFT(0x003ca000) /* 0.014801025 */, -PRESHIFT(0x02233000) /* -0.133590698 */, -PRESHIFT(0x00ce4000) /* -0.050354004 */, -PRESHIFT(0x0ddca000) /* -0.866363525 */, PRESHIFT(0x1102f000) /* 1.063217163 */, PRESHIFT(0x04587000) /* 0.271591187 */, PRESHIFT(0x026cf000) /* 0.151596069 */, PRESHIFT(0x0056c000) /* 0.021179199 */, PRESHIFT(0x0074e000) /* 0.028533936 */, -PRESHIFT(0x0001d000) /* -0.000442505 */, PRESHIFT(0x0008b000) /* 0.002120972 */, PRESHIFT(0x00009000) /* 0.000137329 */, -PRESHIFT(0x00003000) /* -0.000045776 */, -PRESHIFT(0x00049000) /* -0.001113892 */, PRESHIFT(0x000d0000) /* 0.003173828 */, -PRESHIFT(0x004ba000) /* -0.018463135 */, PRESHIFT(0x003ca000) /* 0.014801025 */, -PRESHIFT(0x02233000) /* -0.133590698 */, -PRESHIFT(0x00ce4000) /* -0.050354004 */, -PRESHIFT(0x0ddca000) /* -0.866363525 */, PRESHIFT(0x1102f000) /* 1.063217163 */, PRESHIFT(0x04587000) /* 0.271591187 */, PRESHIFT(0x026cf000) /* 0.151596069 */, PRESHIFT(0x0056c000) /* 0.021179199 */, PRESHIFT(0x0074e000) /* 0.028533936 */, -PRESHIFT(0x0001d000) /* -0.000442505 */, PRESHIFT(0x0008b000) /* 0.002120972 */, PRESHIFT(0x00009000) /* 0.000137329 */ }, { -PRESHIFT(0x00003000) /* -0.000045776 */, /* 12 */ -PRESHIFT(0x0004f000) /* -0.001205444 */, PRESHIFT(0x000c8000) /* 0.003051758 */, -PRESHIFT(0x00503000) /* -0.019577026 */, PRESHIFT(0x0031a000) /* 0.012115479 */, -PRESHIFT(0x02326000) /* -0.137298584 */, -PRESHIFT(0x011b5000) /* -0.069168091 */, -PRESHIFT(0x0e3dd000) /* -0.890090942 */, PRESHIFT(0x10c54000) /* 1.048156738 */, PRESHIFT(0x03f1b000) /* 0.246505737 */, PRESHIFT(0x026ee000) /* 0.152069092 */, PRESHIFT(0x00447000) /* 0.016708374 */, PRESHIFT(0x00719000) /* 0.027725220 */, -PRESHIFT(0x00039000) /* -0.000869751 */, PRESHIFT(0x00084000) /* 0.002014160 */, PRESHIFT(0x00008000) /* 0.000122070 */, -PRESHIFT(0x00003000) /* -0.000045776 */, -PRESHIFT(0x0004f000) /* -0.001205444 */, PRESHIFT(0x000c8000) /* 0.003051758 */, -PRESHIFT(0x00503000) /* -0.019577026 */, PRESHIFT(0x0031a000) /* 0.012115479 */, -PRESHIFT(0x02326000) /* -0.137298584 */, -PRESHIFT(0x011b5000) /* -0.069168091 */, -PRESHIFT(0x0e3dd000) /* -0.890090942 */, PRESHIFT(0x10c54000) /* 1.048156738 */, PRESHIFT(0x03f1b000) /* 0.246505737 */, PRESHIFT(0x026ee000) /* 0.152069092 */, PRESHIFT(0x00447000) /* 0.016708374 */, PRESHIFT(0x00719000) /* 0.027725220 */, -PRESHIFT(0x00039000) /* -0.000869751 */, PRESHIFT(0x00084000) /* 0.002014160 */, PRESHIFT(0x00008000) /* 0.000122070 */ }, { -PRESHIFT(0x00004000) /* -0.000061035 */, /* 13 */ -PRESHIFT(0x00055000) /* -0.001296997 */, PRESHIFT(0x000bd000) /* 0.002883911 */, -PRESHIFT(0x0054c000) /* -0.020690918 */, PRESHIFT(0x0025d000) /* 0.009231567 */, -PRESHIFT(0x02403000) /* -0.140670776 */, -PRESHIFT(0x016ba000) /* -0.088775635 */, -PRESHIFT(0x0e9be000) /* -0.913055420 */, PRESHIFT(0x1082d000) /* 1.031936646 */, PRESHIFT(0x038d4000) /* 0.221984863 */, PRESHIFT(0x026e7000) /* 0.151962280 */, PRESHIFT(0x0032e000) /* 0.012420654 */, PRESHIFT(0x006df000) /* 0.026840210 */, -PRESHIFT(0x00053000) /* -0.001266479 */, PRESHIFT(0x0007d000) /* 0.001907349 */, PRESHIFT(0x00007000) /* 0.000106812 */, -PRESHIFT(0x00004000) /* -0.000061035 */, -PRESHIFT(0x00055000) /* -0.001296997 */, PRESHIFT(0x000bd000) /* 0.002883911 */, -PRESHIFT(0x0054c000) /* -0.020690918 */, PRESHIFT(0x0025d000) /* 0.009231567 */, -PRESHIFT(0x02403000) /* -0.140670776 */, -PRESHIFT(0x016ba000) /* -0.088775635 */, -PRESHIFT(0x0e9be000) /* -0.913055420 */, PRESHIFT(0x1082d000) /* 1.031936646 */, PRESHIFT(0x038d4000) /* 0.221984863 */, PRESHIFT(0x026e7000) /* 0.151962280 */, PRESHIFT(0x0032e000) /* 0.012420654 */, PRESHIFT(0x006df000) /* 0.026840210 */, -PRESHIFT(0x00053000) /* -0.001266479 */, PRESHIFT(0x0007d000) /* 0.001907349 */, PRESHIFT(0x00007000) /* 0.000106812 */ }, { -PRESHIFT(0x00004000) /* -0.000061035 */, /* 14 */ -PRESHIFT(0x0005b000) /* -0.001388550 */, PRESHIFT(0x000b1000) /* 0.002700806 */, -PRESHIFT(0x00594000) /* -0.021789551 */, PRESHIFT(0x00192000) /* 0.006134033 */, -PRESHIFT(0x024c8000) /* -0.143676758 */, -PRESHIFT(0x01bf2000) /* -0.109161377 */, -PRESHIFT(0x0ef69000) /* -0.935195923 */, PRESHIFT(0x103be000) /* 1.014617920 */, PRESHIFT(0x032b4000) /* 0.198059082 */, PRESHIFT(0x026bc000) /* 0.151306152 */, PRESHIFT(0x00221000) /* 0.008316040 */, PRESHIFT(0x006a2000) /* 0.025909424 */, -PRESHIFT(0x0006a000) /* -0.001617432 */, PRESHIFT(0x00075000) /* 0.001785278 */, PRESHIFT(0x00007000) /* 0.000106812 */, -PRESHIFT(0x00004000) /* -0.000061035 */, -PRESHIFT(0x0005b000) /* -0.001388550 */, PRESHIFT(0x000b1000) /* 0.002700806 */, -PRESHIFT(0x00594000) /* -0.021789551 */, PRESHIFT(0x00192000) /* 0.006134033 */, -PRESHIFT(0x024c8000) /* -0.143676758 */, -PRESHIFT(0x01bf2000) /* -0.109161377 */, -PRESHIFT(0x0ef69000) /* -0.935195923 */, PRESHIFT(0x103be000) /* 1.014617920 */, PRESHIFT(0x032b4000) /* 0.198059082 */, PRESHIFT(0x026bc000) /* 0.151306152 */, PRESHIFT(0x00221000) /* 0.008316040 */, PRESHIFT(0x006a2000) /* 0.025909424 */, -PRESHIFT(0x0006a000) /* -0.001617432 */, PRESHIFT(0x00075000) /* 0.001785278 */, PRESHIFT(0x00007000) /* 0.000106812 */ }, { -PRESHIFT(0x00005000) /* -0.000076294 */, /* 15 */ -PRESHIFT(0x00061000) /* -0.001480103 */, PRESHIFT(0x000a3000) /* 0.002487183 */, -PRESHIFT(0x005da000) /* -0.022857666 */, PRESHIFT(0x000b9000) /* 0.002822876 */, -PRESHIFT(0x02571000) /* -0.146255493 */, -PRESHIFT(0x0215c000) /* -0.130310059 */, -PRESHIFT(0x0f4dc000) /* -0.956481934 */, PRESHIFT(0x0ff0a000) /* 0.996246338 */, PRESHIFT(0x02cbf000) /* 0.174789429 */, PRESHIFT(0x0266e000) /* 0.150115967 */, PRESHIFT(0x00120000) /* 0.004394531 */, PRESHIFT(0x00662000) /* 0.024932861 */, -PRESHIFT(0x0007f000) /* -0.001937866 */, PRESHIFT(0x0006f000) /* 0.001693726 */, PRESHIFT(0x00006000) /* 0.000091553 */, -PRESHIFT(0x00005000) /* -0.000076294 */, -PRESHIFT(0x00061000) /* -0.001480103 */, PRESHIFT(0x000a3000) /* 0.002487183 */, -PRESHIFT(0x005da000) /* -0.022857666 */, PRESHIFT(0x000b9000) /* 0.002822876 */, -PRESHIFT(0x02571000) /* -0.146255493 */, -PRESHIFT(0x0215c000) /* -0.130310059 */, -PRESHIFT(0x0f4dc000) /* -0.956481934 */, PRESHIFT(0x0ff0a000) /* 0.996246338 */, PRESHIFT(0x02cbf000) /* 0.174789429 */, PRESHIFT(0x0266e000) /* 0.150115967 */, PRESHIFT(0x00120000) /* 0.004394531 */, PRESHIFT(0x00662000) /* 0.024932861 */, -PRESHIFT(0x0007f000) /* -0.001937866 */, PRESHIFT(0x0006f000) /* 0.001693726 */, PRESHIFT(0x00006000) /* 0.000091553 */ }, { -PRESHIFT(0x00005000) /* -0.000076294 */, /* 16 */ -PRESHIFT(0x00068000) /* -0.001586914 */, PRESHIFT(0x00092000) /* 0.002227783 */, -PRESHIFT(0x0061f000) /* -0.023910522 */, -PRESHIFT(0x0002d000) /* -0.000686646 */, -PRESHIFT(0x025ff000) /* -0.148422241 */, -PRESHIFT(0x026f7000) /* -0.152206421 */, -PRESHIFT(0x0fa13000) /* -0.976852417 */, PRESHIFT(0x0fa13000) /* 0.976852417 */, PRESHIFT(0x026f7000) /* 0.152206421 */, PRESHIFT(0x025ff000) /* 0.148422241 */, PRESHIFT(0x0002d000) /* 0.000686646 */, PRESHIFT(0x0061f000) /* 0.023910522 */, -PRESHIFT(0x00092000) /* -0.002227783 */, PRESHIFT(0x00068000) /* 0.001586914 */, PRESHIFT(0x00005000) /* 0.000076294 */, -PRESHIFT(0x00005000) /* -0.000076294 */, -PRESHIFT(0x00068000) /* -0.001586914 */, PRESHIFT(0x00092000) /* 0.002227783 */, -PRESHIFT(0x0061f000) /* -0.023910522 */, -PRESHIFT(0x0002d000) /* -0.000686646 */, -PRESHIFT(0x025ff000) /* -0.148422241 */, -PRESHIFT(0x026f7000) /* -0.152206421 */, -PRESHIFT(0x0fa13000) /* -0.976852417 */, PRESHIFT(0x0fa13000) /* 0.976852417 */, PRESHIFT(0x026f7000) /* 0.152206421 */, PRESHIFT(0x025ff000) /* 0.148422241 */, PRESHIFT(0x0002d000) /* 0.000686646 */, PRESHIFT(0x0061f000) /* 0.023910522 */, -PRESHIFT(0x00092000) /* -0.002227783 */, PRESHIFT(0x00068000) /* 0.001586914 */, PRESHIFT(0x00005000) /* 0.000076294 */ } avifile-0.7.48~20090503.ds/plugins/libmad/libmad/Makefile.am0000644000175000017500000000117411106663644022150 0ustar yavoryavornoinst_LTLIBRARIES = libmad.la noinst_HEADERS = \ bit.h \ decoder.h \ fixed.h \ frame.h \ global.h \ huffman.h \ layer12.h \ layer3.h \ mad.h \ stream.h \ synth.h \ timer.h \ version.h if !AMM_USE_LIBMAD libmad_la_SOURCES = \ bit.c \ decoder.c \ fixed.c \ frame.c \ huffman.c \ layer12.c \ layer3.c \ stream.c \ synth.c \ timer.c \ version.c endif EXTRA_DIST = \ acinclude.m4.mad \ configure.in \ COPYRIGHT \ D.dat \ imdct_l_arm.S \ imdct_s.dat \ Makefile.am.mad \ qc_table.dat \ README \ rq_table.dat \ sf_table.dat \ TODO \ VERSION AM_CPPFLAGS = $(LTNOPIC) MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libmad/libmad/Makefile.am.mad0000644000175000017500000001043710403657206022706 0ustar yavoryavor## ## libmad - MPEG audio decoder library ## Copyright (C) 2000-2004 Underbit Technologies, Inc. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 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 General Public License for more details. ## ## You should have received a copy of the GNU 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 ## ## $Id: Makefile.am.mad,v 1.3 2006/03/08 22:45:26 kabi Exp $ ## ## Process this file with automake to produce Makefile.in SUBDIRS = DIST_SUBDIRS = msvc++ lib_LTLIBRARIES = libmad.la include_HEADERS = mad.h EXTRA_PROGRAMS = minimad minimad_SOURCES = minimad.c minimad_INCLUDES = minimad_LDADD = libmad.la EXTRA_DIST = mad.h.sed \ CHANGES COPYRIGHT CREDITS README TODO VERSION exported_headers = version.h fixed.h bit.h timer.h stream.h frame.h \ synth.h decoder.h headers = $(exported_headers) \ global.h layer12.h layer3.h huffman.h data_includes = D.dat imdct_s.dat qc_table.dat rq_table.dat \ sf_table.dat libmad_la_SOURCES = version.c fixed.c bit.c timer.c stream.c frame.c \ synth.c decoder.c layer12.c layer3.c huffman.c \ $(headers) $(data_includes) EXTRA_libmad_la_SOURCES = imdct_l_arm.S #synth_mmx.S libmad_la_DEPENDENCIES = @ASO_OBJS@ libmad_la_LIBADD = @ASO_OBJS@ INCLUDES = $(FPM) $(ASO) BUILT_SOURCES = mad.h CLEANFILES = mad.h ## From the libtool documentation on library versioning: ## ## CURRENT ## The most recent interface number that this library implements. ## ## REVISION ## The implementation number of the CURRENT interface. ## ## AGE ## The difference between the newest and oldest interfaces that this ## library implements. In other words, the library implements all the ## interface numbers in the range from number `CURRENT - AGE' to ## `CURRENT'. ## ## If two libraries have identical CURRENT and AGE numbers, then the ## dynamic linker chooses the library with the greater REVISION number. ## ## 1. Start with version information of `0:0:0' for each libtool library. ## ## 2. Update the version information only immediately before a public ## release of your software. More frequent updates are unnecessary, ## and only guarantee that the current interface number gets larger ## faster. ## ## 3. If the library source code has changed at all since the last ## update, then increment REVISION (`C:R:A' becomes `C:r+1:A'). ## ## 4. If any interfaces have been added, removed, or changed since the ## last update, increment CURRENT, and set REVISION to 0. ## ## 5. If any interfaces have been added since the last public release, ## then increment AGE. ## ## 6. If any interfaces have been removed since the last public release, ## then set AGE to 0. version_current = 2 version_revision = 1 version_age = 2 version_info = $(version_current):$(version_revision):$(version_age) libmad_la_LDFLAGS = -version-info $(version_info) mad.h: config.status config.h Makefile.am \ $(srcdir)/COPYRIGHT $(srcdir)/mad.h.sed $(exported_headers) (sed -e '1s|.*|/*|' -e '1b' -e '$$s|.*| */|' -e '$$b' \ -e 's/^.*/ *&/' $(srcdir)/COPYRIGHT; echo; \ echo "# ifdef __cplusplus"; \ echo 'extern "C" {'; \ echo "# endif"; echo; \ if [ ".$(FPM)" != "." ]; then \ echo ".$(FPM)" | sed -e 's|^\.-D|# define |'; echo; \ fi; \ sed -ne 's/^# *define *\(HAVE_.*_ASM\).*/# define \1/p' \ config.h; echo; \ sed -ne 's/^# *define *OPT_\(SPEED\|ACCURACY\).*/# define OPT_\1/p' \ config.h; echo; \ sed -ne 's/^# *define *\(SIZEOF_.*\)/# define \1/p' \ config.h; echo; \ for header in $(exported_headers); do \ echo; \ sed -n -f $(srcdir)/mad.h.sed $(srcdir)/$$header; \ done; echo; \ echo "# ifdef __cplusplus"; \ echo '}'; \ echo "# endif") >$@ libtool: $(LIBTOOL_DEPS) $(SHELL) ./config.status --recheck .c.s: $(COMPILE) -S $< again: $(MAKE) clean $(MAKE) .PHONY: again avifile-0.7.48~20090503.ds/plugins/libmad/libmad/README0000644000175000017500000002420010403644441020760 0ustar yavoryavor libmad - MPEG audio decoder library Copyright (C) 2000-2004 Underbit Technologies, Inc. $Id: README,v 1.1 2006/03/08 21:14:09 kabi Exp $ =============================================================================== INTRODUCTION MAD (libmad) is a high-quality MPEG audio decoder. It currently supports MPEG-1 and the MPEG-2 extension to Lower Sampling Frequencies, as well as the so-called MPEG 2.5 format. All three audio layers (Layer I, Layer II, and Layer III a.k.a. MP3) are fully implemented. MAD does not yet support MPEG-2 multichannel audio (although it should be backward compatible with such streams) nor does it currently support AAC. MAD has the following special features: - 24-bit PCM output - 100% fixed-point (integer) computation - completely new implementation based on the ISO/IEC standards - distributed under the terms of the GNU General Public License (GPL) Because MAD provides full 24-bit PCM output, applications using MAD are able to produce high quality audio. Even when the output device supports only 16-bit PCM, applications can use the extra resolution to increase the audible dynamic range through the use of dithering or noise shaping. Because MAD uses integer computation rather than floating point, it is well suited for architectures without a floating point unit. All calculations are performed with a 32-bit fixed-point integer representation. Because MAD is a new implementation of the ISO/IEC standards, it is unencumbered by the errors of other implementations. MAD is NOT a derivation of the ISO reference source or any other code. Considerable effort has been expended to ensure a correct implementation, even in cases where the standards are ambiguous or misleading. Because MAD is distributed under the terms of the GPL, its redistribution is not generally restricted, so long as the terms of the GPL are followed. This means MAD can be incorporated into other software as long as that software is also distributed under the GPL. (Should this be undesirable, alternate arrangements may be possible by contacting Underbit.) =============================================================================== ABOUT THE CODE The code is optimized and performs very well, although specific improvements can still be made. The output from the decoder library consists of 32-bit signed linear fixed-point values that can be easily scaled for any size PCM output, up to 24 bits per sample. The API for libmad can be found in the `mad.h' header file. Note that this file is automatically generated, and will not exist until after you have built the library. There are two APIs available, one high-level, and the other low-level. With the low-level API, each step of the decoding process must be handled explicitly, offering the greatest amount of control. With the high-level API, after callbacks are configured, a single routine will decode an entire bitstream. The high-level API may either be used synchronously or asynchronously. If used asynchronously, decoding will occur in a separate process. Communication is possible with the decoding process by passing control messages. The file `minimad.c' contains an example usage of the libmad API that shows only the bare minimum required to implement a useful decoder. It expects a regular file to be redirected to standard input, and it sends decoded 16-bit signed little-endian PCM samples to standard output. If a decoding error occurs, it is reported to standard error and decoding continues. Note that the scale() routine in this code is only provided as an example; it rounds MAD's high-resolution samples down to 16 bits, but does not perform any dithering or noise shaping. It is therefore not recommended to use this routine as-is in your own code if sound quality is important. Integer Performance To get the best possible performance, it is recommended that an assembly version of the fixed-point multiply and related routines be selected. Several such assembly routines have been written for various CPUs. If an assembly version is not available, a fast approximation version will be used. This will result in reduced accuracy of the decoder. Alternatively, if 64-bit integers are supported as a datatype by the compiler, another version can be used that is much more accurate. However, using an assembly version is generally much faster and just as accurate. More information can be gathered from the `fixed.h' header file. MAD's CPU-intensive subband synthesis routine can be further optimized at the expense of a slight loss in output accuracy due to a modified method for fixed-point multiplication with a small windowing constant. While this is helpful for performance and the output accuracy loss is generally undetectable, it is disabled by default and must be explicitly enabled. Under some architectures, other special optimizations may also be available. Audio Quality The output from MAD has been found to satisfy the ISO/IEC 11172-4 computational accuracy requirements for compliance. In most configurations, MAD is a Full Layer III ISO/IEC 11172-3 audio decoder as defined by the standard. When the approximation version of the fixed-point multiply is used, MAD is a limited accuracy ISO/IEC 11172-3 audio decoder as defined by the standard. MAD can alternatively be configured to produce output with less or more accuracy than the default, as a tradeoff with performance. MAD produces output samples with a precision greater than 24 bits. Because most output formats use fewer bits, typically 16, it is recommended that a dithering algorithm be used (rather than rounding or truncating) to obtain the highest quality audio. However, dithering may unfavorably affect an analytic examination of the output (such as compliance testing); you may therefore wish to use rounding in this case instead. Portability Issues GCC is preferred to compile the code, but other compilers may also work. The assembly code in `fixed.h' depends on the inline assembly features of your compiler. If you're not using GCC or MSVC++, you can either write your own assembly macros or use the default (low quality output) version. The union initialization of `huffman.c' may not be portable to all platforms when GCC is not used. The code should not be sensitive to word sizes or byte ordering, however it does assume A % B has the same sign as A. =============================================================================== BUILDING AND INSTALLING Windows Platforms MAD can be built under Windows using either MSVC++ or Cygwin. A MSVC++ project file can be found under the `msvc++' subdirectory. To build libmad using Cygwin, you will first need to install the Cygwin tools: http://www.cygwin.com/ You may then proceed with the following POSIX instructions within the Cygwin shell. Note that by default Cygwin will build a library that depends on the Cygwin DLL. You can use MinGW to build a library that does not depend on the Cygwin DLL. To do so, give the option --host=mingw32 to `configure'. POSIX Platforms (including Cygwin) The code is distributed with a `configure' script that will generate for you a `Makefile' and a `config.h' for your platform. See the file `INSTALL' for generic instructions. The specific options you may want to give `configure' are: --enable-speed optimize for speed over accuracy --enable-accuracy optimize for accuracy over speed --disable-debugging do not compile with debugging support, and use more optimizations --disable-shared do not build a shared library Note that you need not specify one of --enable-speed or --enable-accuracy; in its default configuration, MAD is optimized for both. You should only use one of these options if you wish to compromise speed or accuracy for the other. By default the package will build a shared library if possible for your platform. If you want only a static library, use --disable-shared. It is not normally necessary to use the following options, but you may fine-tune the configuration with them if desired: --enable-fpm=ARCH use the ARCH-specific version of the fixed-point math assembly routines (current options are: intel, arm, mips, sparc, ppc; also allowed are: 64bit, approx) --enable-sso use the subband synthesis optimization, with reduced accuracy --disable-aso do not use certain architecture-specific optimizations By default an appropriate fixed-point assembly routine will be selected for the configured host type, if it can be determined. Thus if you are cross-compiling for another architecture, you should be sure either to give `configure' a host type argument (--host) or to use an explicit --enable-fpm option. If an appropriate assembly routine cannot be determined, the default approximation version will be used. In this case, use of an alternate --enable-fpm is highly recommended. Experimenting and Developing Further options for `configure' that may be useful to developers and experimenters are: --enable-debugging enable diagnostic debugging support and debugging symbols --enable-profiling generate `gprof' profiling code --enable-experimental enable code using the EXPERIMENTAL preprocessor define =============================================================================== COPYRIGHT Please read the `COPYRIGHT' file for copyright and warranty information. Also, the file `COPYING' contains the full text of the GNU GPL. Send inquiries, comments, bug reports, suggestions, patches, etc. to: Underbit Technologies, Inc. See also the MAD home page on the Web: http://www.underbit.com/products/mad/ =============================================================================== avifile-0.7.48~20090503.ds/plugins/libmad/libmad/TODO0000644000175000017500000000343110403644441020573 0ustar yavoryavor libmad - MPEG audio decoder library Copyright (C) 2000-2004 Underbit Technologies, Inc. $Id: TODO,v 1.1 2006/03/08 21:14:09 kabi Exp $ =============================================================================== libmad: - more API layers (buffering, PCM samples, dithering, etc.) - x86 performance optimization compiler flags - function documentation, general docs - finish async API - parse system streams? - MPEG-2 MC, AAC? - logarithmic multiplication? - multiple frame decoding for better locality of reference? - frame serial numbers, Layer III frame continuity checks fixed.h: - experiment with FPM_INTEL: # if 1 # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result; \ asm ("shrl %3,%1\n\t" \ "shll %4,%2\n\t" \ "orl %2,%1" \ : "=rm" (__result) \ : "0" (lo), "r" (hi), \ "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ : "cc"); \ __result; \ }) # else # define mad_f_scale64(hi, lo) \ ({ mad_fixed64hi_t __hi_; \ mad_fixed64lo_t __lo_; \ mad_fixed_t __result; \ asm ("sall %2,%1" \ : "=r" (__hi_) \ : "0" (hi), "I" (32 - MAD_F_SCALEBITS) \ : "cc"); \ asm ("shrl %2,%1" \ : "=r" (__lo_) \ : "0" (lo), "I" (MAD_F_SCALEBITS) \ : "cc"); \ asm ("orl %1,%2" \ : "=rm" (__result) \ : "r" (__hi_), "0" (__lo_) \ : "cc"); \ __result; \ }) # endif libmad Layer I: - check frame length sanity libmad Layer II: - check frame length sanity libmad Layer III: - circular buffer - optimize zero_part from Huffman decoding throughout - MPEG 2.5 8000 Hz sf bands? mixed blocks? - stereo->mono conversion optimization? - enable frame-at-a-time decoding - improve portability of huffman.c avifile-0.7.48~20090503.ds/plugins/libmad/libmad/VERSION0000644000175000017500000000015210403644441021150 0ustar yavoryavor0.15.1b configure.ac:24 version.h:25-28 msvc++/config.h:99,105,120 msvc++/mad.h:41-44 Makefile.am:98-100 avifile-0.7.48~20090503.ds/plugins/libmad/libmad/acconfig.h0000644000175000017500000000420507365332203022030 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2001 Robert Leslie * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: acconfig.h,v 1.1 2001/10/23 18:18:43 kabi Exp $ */ # ifndef LIBMAD_CONFIG_H # define LIBMAD_CONFIG_H /***************************************************************************** * Definitions selected automatically by `configure' * *****************************************************************************/ @TOP@ /* Define to optimize for speed over accuracy. */ #undef OPT_SPEED /* Define to optimize for accuracy over speed. */ #undef OPT_ACCURACY /* Define to enable a fast subband synthesis approximation optimization. */ #undef OPT_SSO /* Define to influence a strict interpretation of the ISO/IEC standards, even if this is in opposition with best accepted practices. */ #undef OPT_STRICT /* Define if your MIPS CPU supports a 2-operand MADD instruction. */ #undef HAVE_MADD_ASM /* Define if your MIPS CPU supports a 2-operand MADD16 instruction. */ #undef HAVE_MADD16_ASM /* Define to enable diagnostic debugging support. */ #undef DEBUG /* Define to disable debugging assertions. */ #undef NDEBUG /* Define to enable experimental code. */ #undef EXPERIMENTAL @BOTTOM@ /***************************************************************************** * End of automatically configured definitions * *****************************************************************************/ # endif avifile-0.7.48~20090503.ds/plugins/libmad/libmad/acinclude.m4.mad0000644000175000017500000003540707365332203023047 0ustar yavoryavor## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*- ## Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc. ## Originally by Gordon Matzigkeit , 1996 ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 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 ## General Public License for more details. ## ## You should have received a copy of the GNU 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. ## ## As a special exception to the GNU General Public License, if you ## distribute this file as part of a program that contains a ## configuration script generated by Autoconf, you may include it under ## the same distribution terms that you use for the rest of that program. # serial 40 AC_PROG_LIBTOOL AC_DEFUN(AC_PROG_LIBTOOL, [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl # Save cache, so that ltconfig can load it AC_CACHE_SAVE # Actually configure libtool. ac_aux_dir is where install-sh is found. CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ || AC_MSG_ERROR([libtool configure failed]) # Reload cache, that may have been modified by ltconfig AC_CACHE_LOAD # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log ]) AC_DEFUN(AC_LIBTOOL_SETUP, [AC_PREREQ(2.13)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_LD])dnl AC_REQUIRE([AC_PROG_NM])dnl AC_REQUIRE([AC_PROG_LN_S])dnl dnl case "$target" in NONE) lt_target="$host" ;; *) lt_target="$target" ;; esac # Check for any special flags to pass to ltconfig. libtool_flags="--cache-file=$cache_file" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], [libtool_flags="$libtool_flags --enable-dlopen"]) ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [libtool_flags="$libtool_flags --enable-win32-dll"]) AC_ARG_ENABLE(libtool-lock, [ --disable-libtool-lock avoid locking (might break parallel builds)]) test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" # Some flags need to be propagated to the compiler or linker for good # libtool support. case "$lt_target" in *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case "`/usr/bin/file conftest.o`" in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [*-*-cygwin* | *-*-mingw*) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; ]) esac ]) # AC_LIBTOOL_DLOPEN - enable checks for dlopen support AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) # AC_ENABLE_SHARED - implement the --enable-shared flag # Usage: AC_ENABLE_SHARED[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_SHARED, [dnl define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(shared, changequote(<<, >>)dnl << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$ac_save_ifs" ;; esac], enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl ]) # AC_DISABLE_SHARED - set the default shared flag to --disable-shared AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_SHARED(no)]) # AC_ENABLE_STATIC - implement the --enable-static flag # Usage: AC_ENABLE_STATIC[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_STATIC, [dnl define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(static, changequote(<<, >>)dnl << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$ac_save_ifs" ;; esac], enable_static=AC_ENABLE_STATIC_DEFAULT)dnl ]) # AC_DISABLE_STATIC - set the default static flag to --disable-static AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_STATIC(no)]) # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(fast-install, changequote(<<, >>)dnl << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$ac_save_ifs" ;; esac], enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl ]) # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_FAST_INSTALL(no)]) # AC_PROG_LD - find the path to the GNU or non-GNU linker AC_DEFUN(AC_PROG_LD, [AC_ARG_WITH(gnu-ld, [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl ac_prog=ld if test "$ac_cv_prog_gcc" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by GCC]) ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. changequote(,)dnl [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' changequote([,])dnl # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(ac_cv_path_LD, [if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then ac_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" else ac_cv_path_LD="$LD" # Let the user override the test with a path. fi]) LD="$ac_cv_path_LD" if test -n "$LD"; then AC_MSG_RESULT($LD) else AC_MSG_RESULT(no) fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_PROG_LD_GNU ]) AC_DEFUN(AC_PROG_LD_GNU, [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then ac_cv_prog_gnu_ld=yes else ac_cv_prog_gnu_ld=no fi]) ]) # AC_PROG_NM - find the path to a BSD-compatible name lister AC_DEFUN(AC_PROG_NM, [AC_MSG_CHECKING([for BSD-compatible nm]) AC_CACHE_VAL(ac_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. ac_cv_path_NM="$NM" else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -B" break elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -p" break else ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm fi]) NM="$ac_cv_path_NM" AC_MSG_RESULT([$NM]) ]) # AC_CHECK_LIBM - check for math library AC_DEFUN(AC_CHECK_LIBM, [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case "$lt_target" in *-*-beos* | *-*-cygwin*) # These system don't have libm ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, main, LIBM="-lm") ;; esac ]) # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for # the libltdl convenience library and INCLTDL to the include flags for # the libltdl header and adds --enable-ltdl-convenience to the # configure arguments. Note that LIBLTDL and INCLTDL are not # AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not # provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed # with '${top_builddir}/' and INCLTDL will be prefixed with # '${top_srcdir}/' (note the single quotes!). If your package is not # flat and you're not using automake, define top_builddir and # top_srcdir appropriately in the Makefiles. AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl case "$enable_ltdl_convenience" in no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) ]) # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for # the libltdl installable library and INCLTDL to the include flags for # the libltdl header and adds --enable-ltdl-install to the configure # arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is # AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed # libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will # be prefixed with '${top_builddir}/' and INCLTDL will be prefixed # with '${top_srcdir}/' (note the single quotes!). If your package is # not flat and you're not using automake, define top_builddir and # top_srcdir appropriately in the Makefiles. # In the future, this macro may have to be called after AC_PROG_LIBTOOL. AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_CHECK_LIB(ltdl, main, [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], [if test x"$enable_ltdl_install" = xno; then AC_MSG_WARN([libltdl not installed, but installation disabled]) else enable_ltdl_install=yes fi ]) if test x"$enable_ltdl_install" = x"yes"; then ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) else ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" INCLTDL= fi ]) dnl old names AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl dnl This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL])dnl avifile-0.7.48~20090503.ds/plugins/libmad/libmad/bit.c0000644000175000017500000001530510403657206021033 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: bit.c,v 1.3 2006/03/08 22:45:26 kabi Exp $ */ # ifdef HAVE_CONFIG_H # include "config.h" # endif # include "global.h" # ifdef HAVE_LIMITS_H # include # else # define CHAR_BIT 8 # endif # include "bit.h" /* * This is the lookup table for computing the CRC-check word. * As described in section 2.4.3.1 and depicted in Figure A.9 * of ISO/IEC 11172-3, the generator polynomial is: * * G(X) = X^16 + X^15 + X^2 + 1 */ static unsigned short const crc_table[256] = { 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011, 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022, 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072, 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041, 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2, 0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1, 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1, 0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082, 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192, 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1, 0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1, 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2, 0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151, 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162, 0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132, 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101, 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312, 0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321, 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371, 0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342, 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1, 0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2, 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2, 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381, 0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291, 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2, 0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2, 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1, 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252, 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261, 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231, 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202 }; # define CRC_POLY 0x8005 /* * NAME: bit->init() * DESCRIPTION: initialize bit pointer struct */ void mad_bit_init(struct mad_bitptr *bitptr, unsigned char const *byte) { bitptr->byte = byte; bitptr->cache = 0; bitptr->left = CHAR_BIT; } /* * NAME: bit->length() * DESCRIPTION: return number of bits between start and end points */ unsigned int mad_bit_length(struct mad_bitptr const *begin, struct mad_bitptr const *end) { return begin->left + CHAR_BIT * (end->byte - (begin->byte + 1)) + (CHAR_BIT - end->left); } /* * NAME: bit->nextbyte() * DESCRIPTION: return pointer to next unprocessed byte */ unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *bitptr) { return bitptr->left == CHAR_BIT ? bitptr->byte : bitptr->byte + 1; } /* * NAME: bit->skip() * DESCRIPTION: advance bit pointer */ void mad_bit_skip(struct mad_bitptr *bitptr, unsigned int len) { bitptr->byte += len / CHAR_BIT; bitptr->left -= len % CHAR_BIT; if (bitptr->left > CHAR_BIT) { bitptr->byte++; bitptr->left += CHAR_BIT; } if (bitptr->left < CHAR_BIT) bitptr->cache = *bitptr->byte; } /* * NAME: bit->read() * DESCRIPTION: read an arbitrary number of bits and return their UIMSBF value */ unsigned long mad_bit_read(struct mad_bitptr *bitptr, unsigned int len) { register unsigned long value; if (bitptr->left == CHAR_BIT) bitptr->cache = *bitptr->byte; if (len < bitptr->left) { value = (bitptr->cache & ((1 << bitptr->left) - 1)) >> (bitptr->left - len); bitptr->left -= len; return value; } /* remaining bits in current byte */ value = bitptr->cache & ((1 << bitptr->left) - 1); len -= bitptr->left; bitptr->byte++; bitptr->left = CHAR_BIT; /* more bytes */ while (len >= CHAR_BIT) { value = (value << CHAR_BIT) | *bitptr->byte++; len -= CHAR_BIT; } if (len > 0) { bitptr->cache = *bitptr->byte; value = (value << len) | (bitptr->cache >> (CHAR_BIT - len)); bitptr->left -= len; } return value; } # if 0 /* * NAME: bit->write() * DESCRIPTION: write an arbitrary number of bits */ void mad_bit_write(struct mad_bitptr *bitptr, unsigned int len, unsigned long value) { unsigned char *ptr; ptr = (unsigned char *) bitptr->byte; /* ... */ } # endif /* * NAME: bit->crc() * DESCRIPTION: compute CRC-check word */ unsigned short mad_bit_crc(struct mad_bitptr bitptr, unsigned int len, unsigned short init) { register unsigned int crc; for (crc = init; len >= 32; len -= 32) { register unsigned long data; data = mad_bit_read(&bitptr, 32); crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 24)) & 0xff]; crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 16)) & 0xff]; crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 8)) & 0xff]; crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 0)) & 0xff]; } switch (len / 8) { case 3: crc = (crc << 8) ^ crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; case 2: crc = (crc << 8) ^ crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; case 1: crc = (crc << 8) ^ crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; len %= 8; case 0: break; } while (len--) { register unsigned int msb; msb = mad_bit_read(&bitptr, 1) ^ (crc >> 15); crc <<= 1; if (msb & 1) crc ^= CRC_POLY; } return crc & 0xffff; } avifile-0.7.48~20090503.ds/plugins/libmad/libmad/bit.h0000644000175000017500000000311510403657206021034 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: bit.h,v 1.2 2006/03/08 22:45:26 kabi Exp $ */ # ifndef LIBMAD_BIT_H # define LIBMAD_BIT_H struct mad_bitptr { unsigned char const *byte; unsigned short cache; unsigned short left; }; void mad_bit_init(struct mad_bitptr *, unsigned char const *); # define mad_bit_finish(bitptr) /* nothing */ unsigned int mad_bit_length(struct mad_bitptr const *, struct mad_bitptr const *); # define mad_bit_bitsleft(bitptr) ((bitptr)->left) unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *); void mad_bit_skip(struct mad_bitptr *, unsigned int); unsigned long mad_bit_read(struct mad_bitptr *, unsigned int); void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long); unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short); # endif avifile-0.7.48~20090503.ds/plugins/libmad/libmad/configure.in0000644000175000017500000002106407612727712022431 0ustar yavoryavordnl -*- m4 -*- dnl dnl libmad - MPEG audio decoder library dnl Copyright (C) 2000-2001 Robert Leslie dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA dnl dnl Process this file with autoconf to produce a configure script. AC_INIT(decoder.h) AC_REVISION([$Id: configure.in,v 1.6 2003/01/20 08:14:02 kabi Exp $])dnl AM_INIT_AUTOMAKE(libmad, 0.14.0b) AM_CONFIG_HEADER(config.h) dnl System type. AC_CANONICAL_HOST dnl Checks for programs. AC_PROG_CC CCAS=gcc CCASFLAGS= AC_SUBST(CCAS) AC_SUBST(CCASFLAGS) dnl Support for libtool. AC_DISABLE_SHARED dnl AC_LIBTOOL_WIN32_DLL AM_PROG_LIBTOOL AC_SUBST(LIBTOOL_DEPS) dnl Compiler options. arch="" debug="" optimize="" profile="" set -- $CFLAGS CFLAGS="$CFLAGS -Wall" while test $# -gt 0 do case "$1" in -Wall) shift ;; -g) debug="-g" shift ;; -m*) arch="$arch $1" shift ;; -O2) optimize="-O" shift ;; -fomit-frame-pointer) shift ;; -O*|-f*) optimize="$optimize $1" shift ;; *) CFLAGS="$CFLAGS $1" shift ;; esac done if test "$GCC" = yesNO then if test -z "$arch" then case "$host" in i386-*) ;; i?86-*) arch="-m486" ;; arm*-empeg-*) arch="-march=armv4 -mtune=strongarm1100" ;; armv4*-*) arch="-march=armv4 -mtune=strongarm" ;; powerpc-*) ;; mips*-agenda-*) arch="-mcpu=vr4100" ;; mips*-luxsonor-*) arch="-mips1 -mcpu=r3000 -Wa,-m4010" ;; esac fi case "$optimize" in -O|"-O "*) optimize="-O" optimize="$optimize -fforce-mem" optimize="$optimize -fforce-addr" : #x optimize="$optimize -finline-functions" : #- optimize="$optimize -fstrength-reduce" optimize="$optimize -fthread-jumps" optimize="$optimize -fcse-follow-jumps" optimize="$optimize -fcse-skip-blocks" : #x optimize="$optimize -frerun-cse-after-loop" : #x optimize="$optimize -frerun-loop-opt" : #x optimize="$optimize -fgcse" optimize="$optimize -fexpensive-optimizations" optimize="$optimize -fregmove" : #* optimize="$optimize -fdelayed-branch" : #x optimize="$optimize -fschedule-insns" optimize="$optimize -fschedule-insns2" : #? optimize="$optimize -ffunction-sections" : #? optimize="$optimize -fcaller-saves" : #> optimize="$optimize -funroll-loops" : #> optimize="$optimize -funroll-all-loops" : #x optimize="$optimize -fmove-all-movables" : #x optimize="$optimize -freduce-all-givs" : #? optimize="$optimize -fstrict-aliasing" : #* optimize="$optimize -fstructure-noalias" case "$host" in arm*-*) # this may provoke bugs in gcc 2.95.2 optimize="$optimize -fstrength-reduce" # # this may actually be slower but it # triggers bugs if not included optimize="$optimize -finline-functions" ;; mips*-*) optimize="$optimize -fstrength-reduce" optimize="$optimize -finline-functions" ;; i?86-*) optimize="$optimize -fstrength-reduce" ;; *) # this sometimes provokes bugs in gcc 2.95.2 : #optimize="$optimize -fstrength-reduce" ;; esac ;; esac fi case "$host" in mips*-agenda-*) AC_DEFINE(HAVE_MADD16_ASM) ;; mips*-luxsonor-*) AC_DEFINE(HAVE_MADD_ASM) ;; esac dnl Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(limits.h unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_TYPE_PID_T AC_CHECK_SIZEOF(int, 2) AC_CHECK_SIZEOF(long, 4) AC_CHECK_SIZEOF(long long, 8) dnl Other options. AC_SUBST(FPM) AC_SUBST(ASO) AC_SUBST(ASO_OBJS) dnl handle --enable and --disable options AC_MSG_CHECKING(whether to optimize for speed or for accuracy) AC_ARG_ENABLE(speed, [ --enable-speed optimize for speed over accuracy], [ case "$enableval" in yes) optimize_for="speed" AC_DEFINE(OPT_SPEED) ;; esac ]) AC_ARG_ENABLE(accuracy, [ --enable-accuracy optimize for accuracy over speed], [ case "$enableval" in yes) if test "$optimize_for" = "speed" then optimize_for="both" else optimize_for="accuracy" fi AC_DEFINE(OPT_ACCURACY) ;; esac ]) AC_MSG_RESULT(${optimize_for-default}) if test "$optimize_for" = "both" then AC_MSG_ERROR(cannot optimize for both speed and accuracy) fi AC_MSG_CHECKING(for architecture-specific fixed-point math routines) AC_ARG_ENABLE(fpm, [ --enable-fpm= use -specific fixed-point math routines (one of: intel, arm, mips, sparc, ppc, 64bit, default)], [ case "$enableval" in yes) ;; no|default|approx) FPM="DEFAULT" ;; intel|i?86) FPM="INTEL" ;; arm) FPM="ARM" ;; mips) FPM="MIPS" ;; sparc) FPM="SPARC" ;; ppc|powerpc) FPM="PPC" ;; 64bit) FPM="64BIT" ;; float) FPM="FLOAT" ;; *) AC_MSG_RESULT(failed) AC_MSG_ERROR([bad --enable-fpm option]) ;; esac ]) if test -z "$FPM" && test "$GCC" = yes then case "$host" in i?86-*) FPM="INTEL" ;; arm*-*) FPM="ARM" ;; mips*-*) FPM="MIPS" ;; sparc*-*) FPM="SPARC" ;; powerpc*-*) FPM="PPC" ;; # FIXME: need to test for 64-bit long long... esac fi AC_MSG_RESULT(${FPM=DEFAULT}) if test "$FPM" = "DEFAULT" then AC_MSG_WARN([default fixed-point math will yield limited accuracy]) fi FPM="-DFPM_$FPM" AC_ARG_ENABLE(sso, [ --enable-sso use subband synthesis optimization], [ case "$enableval" in yes) AC_DEFINE(OPT_SSO) ;; esac ]) AC_ARG_ENABLE(aso, [ --disable-aso disable architecture-specific optimizations], [], [enable_aso=yes]) if test "$enable_aso" = yes then case "$host" in i?86-*) : #ASO="$ASO -DASO_INTERLEAVE1" ASO="$ASO -DASO_ZEROCHECK" : #not yet #ASO="$ASO -DASO_SYNTH" : #not yet #ASO_OBJS="synth_mmx.lo" ;; arm*-*) ASO="$ASO -DASO_INTERLEAVE1" ASO="$ASO -DASO_IMDCT" ASO_OBJS="imdct_l_arm.lo" ;; mips*-*) ASO="$ASO -DASO_INTERLEAVE2" ASO="$ASO -DASO_ZEROCHECK" ;; esac fi AC_MSG_CHECKING(for ISO/IEC interpretation) AC_ARG_ENABLE(strict-iso, [ --enable-strict-iso use strict ISO/IEC interpretations], [ case "$enableval" in yes) AC_DEFINE(OPT_STRICT) interpretation="strict" ;; esac ]) AC_MSG_RESULT(${interpretation-best accepted practices}) AC_MSG_CHECKING(whether to enable profiling) AC_ARG_ENABLE(profiling, [ --enable-profiling generate profiling code], [ case "$enableval" in yes) profile="-pg" ;; esac ]) AC_MSG_RESULT(${enable_profiling-no}) AC_MSG_CHECKING(whether to enable debugging) AC_ARG_ENABLE(debugging, [ --enable-debugging enable diagnostic debugging support --disable-debugging do not enable debugging and use more optimization], [ case "$enableval" in yes) AC_DEFINE(DEBUG) optimize="" ;; no) if test -n "$profile" then AC_MSG_ERROR(--enable-profiling and --disable-debugging are incompatible) fi AC_DEFINE(NDEBUG) debug="" if test "$GCC" = yes then optimize="$optimize -fomit-frame-pointer" fi ;; esac ]) AC_MSG_RESULT(${enable_debugging-default}) AC_MSG_CHECKING(whether to enable experimental code) AC_ARG_ENABLE(experimental, [ --enable-experimental enable experimental code], [ case "$enableval" in yes) AC_DEFINE(EXPERIMENTAL) ;; esac ]) AC_MSG_RESULT(${enable_experimental-no}) dnl Create output files. test -n "$arch" && CFLAGS="$CFLAGS $arch" test -n "$debug" && CFLAGS="$CFLAGS $debug" test -n "$optimize" && CFLAGS="$CFLAGS $optimize" test -n "$profile" && CFLAGS="$CFLAGS $profile" LDFLAGS="$LDFLAGS $profile" dnl AC_LIBOBJS= dnl AC_SUBST(AC_LIBOBJS) dnl LTLIBOBJS=`echo "$AC_LIBOBJS" | sed -e 's/\.o/.lo/g'` dnl AC_SUBST(LTLIBOBJS) AC_OUTPUT(Makefile) avifile-0.7.48~20090503.ds/plugins/libmad/libmad/decoder.c0000644000175000017500000002646210403657206021670 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: decoder.c,v 1.3 2006/03/08 22:45:26 kabi Exp $ */ # ifdef HAVE_CONFIG_H # include "config.h" # endif # include "global.h" # ifdef HAVE_SYS_TYPES_H # include # endif # ifdef HAVE_SYS_WAIT_H # include # endif # ifdef HAVE_UNISTD_H # include # endif # ifdef HAVE_FCNTL_H # include # endif # include # ifdef HAVE_ERRNO_H # include # endif # include "stream.h" # include "frame.h" # include "synth.h" # include "decoder.h" /* * NAME: decoder->init() * DESCRIPTION: initialize a decoder object with callback routines */ void mad_decoder_init(struct mad_decoder *decoder, void *data, enum mad_flow (*input_func)(void *, struct mad_stream *), enum mad_flow (*header_func)(void *, struct mad_header const *), enum mad_flow (*filter_func)(void *, struct mad_stream const *, struct mad_frame *), enum mad_flow (*output_func)(void *, struct mad_header const *, struct mad_pcm *), enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *), enum mad_flow (*message_func)(void *, void *, unsigned int *)) { decoder->mode = -1; decoder->options = 0; decoder->async.pid = 0; decoder->async.in = -1; decoder->async.out = -1; decoder->sync = 0; decoder->cb_data = data; decoder->input_func = input_func; decoder->header_func = header_func; decoder->filter_func = filter_func; decoder->output_func = output_func; decoder->error_func = error_func; decoder->message_func = message_func; } int mad_decoder_finish(struct mad_decoder *decoder) { # if defined(USE_ASYNC) if (decoder->mode == MAD_DECODER_MODE_ASYNC && decoder->async.pid) { pid_t pid; int status; close(decoder->async.in); do pid = waitpid(decoder->async.pid, &status, 0); while (pid == -1 && errno == EINTR); decoder->mode = -1; close(decoder->async.out); decoder->async.pid = 0; decoder->async.in = -1; decoder->async.out = -1; if (pid == -1) return -1; return (!WIFEXITED(status) || WEXITSTATUS(status)) ? -1 : 0; } # endif return 0; } # if defined(USE_ASYNC) static enum mad_flow send_io(int fd, void const *data, size_t len) { char const *ptr = data; ssize_t count; while (len) { do count = write(fd, ptr, len); while (count == -1 && errno == EINTR); if (count == -1) return MAD_FLOW_BREAK; len -= count; ptr += count; } return MAD_FLOW_CONTINUE; } static enum mad_flow receive_io(int fd, void *buffer, size_t len) { char *ptr = buffer; ssize_t count; while (len) { do count = read(fd, ptr, len); while (count == -1 && errno == EINTR); if (count == -1) return (errno == EAGAIN) ? MAD_FLOW_IGNORE : MAD_FLOW_BREAK; else if (count == 0) return MAD_FLOW_STOP; len -= count; ptr += count; } return MAD_FLOW_CONTINUE; } static enum mad_flow receive_io_blocking(int fd, void *buffer, size_t len) { int flags, blocking; enum mad_flow result; flags = fcntl(fd, F_GETFL); if (flags == -1) return MAD_FLOW_BREAK; blocking = flags & ~O_NONBLOCK; if (blocking != flags && fcntl(fd, F_SETFL, blocking) == -1) return MAD_FLOW_BREAK; result = receive_io(fd, buffer, len); if (flags != blocking && fcntl(fd, F_SETFL, flags) == -1) return MAD_FLOW_BREAK; return result; } static enum mad_flow send(int fd, void const *message, unsigned int size) { enum mad_flow result; /* send size */ result = send_io(fd, &size, sizeof(size)); /* send message */ if (result == MAD_FLOW_CONTINUE) result = send_io(fd, message, size); return result; } static enum mad_flow receive(int fd, void **message, unsigned int *size) { enum mad_flow result; unsigned int actual; if (*message == 0) *size = 0; /* receive size */ result = receive_io(fd, &actual, sizeof(actual)); /* receive message */ if (result == MAD_FLOW_CONTINUE) { if (actual > *size) actual -= *size; else { *size = actual; actual = 0; } if (*size > 0) { if (*message == 0) { *message = malloc(*size); if (*message == 0) return MAD_FLOW_BREAK; } result = receive_io_blocking(fd, *message, *size); } /* throw away remainder of message */ while (actual && result == MAD_FLOW_CONTINUE) { char sink[256]; unsigned int len; len = actual > sizeof(sink) ? sizeof(sink) : actual; result = receive_io_blocking(fd, sink, len); actual -= len; } } return result; } static enum mad_flow check_message(struct mad_decoder *decoder) { enum mad_flow result; void *message = 0; unsigned int size; result = receive(decoder->async.in, &message, &size); if (result == MAD_FLOW_CONTINUE) { if (decoder->message_func == 0) size = 0; else { result = decoder->message_func(decoder->cb_data, message, &size); if (result == MAD_FLOW_IGNORE || result == MAD_FLOW_BREAK) size = 0; } if (send(decoder->async.out, message, size) != MAD_FLOW_CONTINUE) result = MAD_FLOW_BREAK; } if (message) free(message); return result; } # endif static enum mad_flow error_default(void *data, struct mad_stream *stream, struct mad_frame *frame) { int *bad_last_frame = data; switch (stream->error) { case MAD_ERROR_BADCRC: if (*bad_last_frame) mad_frame_mute(frame); else *bad_last_frame = 1; return MAD_FLOW_IGNORE; default: return MAD_FLOW_CONTINUE; } } static int run_sync(struct mad_decoder *decoder) { enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); void *error_data; int bad_last_frame = 0; struct mad_stream *stream; struct mad_frame *frame; struct mad_synth *synth; int result = 0; if (decoder->input_func == 0) return 0; if (decoder->error_func) { error_func = decoder->error_func; error_data = decoder->cb_data; } else { error_func = error_default; error_data = &bad_last_frame; } stream = &decoder->sync->stream; frame = &decoder->sync->frame; synth = &decoder->sync->synth; mad_stream_init(stream); mad_frame_init(frame); mad_synth_init(synth); mad_stream_options(stream, decoder->options); do { switch (decoder->input_func(decoder->cb_data, stream)) { case MAD_FLOW_STOP: goto done; case MAD_FLOW_BREAK: goto fail; case MAD_FLOW_IGNORE: continue; case MAD_FLOW_CONTINUE: break; } while (1) { # if defined(USE_ASYNC) if (decoder->mode == MAD_DECODER_MODE_ASYNC) { switch (check_message(decoder)) { case MAD_FLOW_IGNORE: case MAD_FLOW_CONTINUE: break; case MAD_FLOW_BREAK: goto fail; case MAD_FLOW_STOP: goto done; } } # endif if (decoder->header_func) { if (mad_header_decode(&frame->header, stream) == -1) { if (!MAD_RECOVERABLE(stream->error)) break; switch (error_func(error_data, stream, frame)) { case MAD_FLOW_STOP: goto done; case MAD_FLOW_BREAK: goto fail; case MAD_FLOW_IGNORE: case MAD_FLOW_CONTINUE: default: continue; } } switch (decoder->header_func(decoder->cb_data, &frame->header)) { case MAD_FLOW_STOP: goto done; case MAD_FLOW_BREAK: goto fail; case MAD_FLOW_IGNORE: continue; case MAD_FLOW_CONTINUE: break; } } if (mad_frame_decode(frame, stream) == -1) { if (!MAD_RECOVERABLE(stream->error)) break; switch (error_func(error_data, stream, frame)) { case MAD_FLOW_STOP: goto done; case MAD_FLOW_BREAK: goto fail; case MAD_FLOW_IGNORE: break; case MAD_FLOW_CONTINUE: default: continue; } } else bad_last_frame = 0; if (decoder->filter_func) { switch (decoder->filter_func(decoder->cb_data, stream, frame)) { case MAD_FLOW_STOP: goto done; case MAD_FLOW_BREAK: goto fail; case MAD_FLOW_IGNORE: continue; case MAD_FLOW_CONTINUE: break; } } mad_synth_frame(synth, frame); if (decoder->output_func) { switch (decoder->output_func(decoder->cb_data, &frame->header, &synth->pcm)) { case MAD_FLOW_STOP: goto done; case MAD_FLOW_BREAK: goto fail; case MAD_FLOW_IGNORE: case MAD_FLOW_CONTINUE: break; } } } } while (stream->error == MAD_ERROR_BUFLEN); fail: result = -1; done: mad_synth_finish(synth); mad_frame_finish(frame); mad_stream_finish(stream); return result; } # if defined(USE_ASYNC) static int run_async(struct mad_decoder *decoder) { pid_t pid; int ptoc[2], ctop[2], flags; if (pipe(ptoc) == -1) return -1; if (pipe(ctop) == -1) { close(ptoc[0]); close(ptoc[1]); return -1; } flags = fcntl(ptoc[0], F_GETFL); if (flags == -1 || fcntl(ptoc[0], F_SETFL, flags | O_NONBLOCK) == -1) { close(ctop[0]); close(ctop[1]); close(ptoc[0]); close(ptoc[1]); return -1; } pid = fork(); if (pid == -1) { close(ctop[0]); close(ctop[1]); close(ptoc[0]); close(ptoc[1]); return -1; } decoder->async.pid = pid; if (pid) { /* parent */ close(ptoc[0]); close(ctop[1]); decoder->async.in = ctop[0]; decoder->async.out = ptoc[1]; return 0; } /* child */ close(ptoc[1]); close(ctop[0]); decoder->async.in = ptoc[0]; decoder->async.out = ctop[1]; _exit(run_sync(decoder)); /* not reached */ return -1; } # endif /* * NAME: decoder->run() * DESCRIPTION: run the decoder thread either synchronously or asynchronously */ int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode) { int result; int (*run)(struct mad_decoder *) = 0; switch (decoder->mode = mode) { case MAD_DECODER_MODE_SYNC: run = run_sync; break; case MAD_DECODER_MODE_ASYNC: # if defined(USE_ASYNC) run = run_async; # endif break; } if (run == 0) return -1; decoder->sync = malloc(sizeof(*decoder->sync)); if (decoder->sync == 0) return -1; result = run(decoder); free(decoder->sync); decoder->sync = 0; return result; } /* * NAME: decoder->message() * DESCRIPTION: send a message to and receive a reply from the decoder process */ int mad_decoder_message(struct mad_decoder *decoder, void *message, unsigned int *len) { # if defined(USE_ASYNC) if (decoder->mode != MAD_DECODER_MODE_ASYNC || send(decoder->async.out, message, *len) != MAD_FLOW_CONTINUE || receive(decoder->async.in, &message, len) != MAD_FLOW_CONTINUE) return -1; return 0; # else return -1; # endif } avifile-0.7.48~20090503.ds/plugins/libmad/libmad/decoder.h0000644000175000017500000000543410403657206021671 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: decoder.h,v 1.3 2006/03/08 22:45:26 kabi Exp $ */ # ifndef LIBMAD_DECODER_H # define LIBMAD_DECODER_H # include "stream.h" # include "frame.h" # include "synth.h" enum mad_decoder_mode { MAD_DECODER_MODE_SYNC = 0, MAD_DECODER_MODE_ASYNC }; enum mad_flow { MAD_FLOW_CONTINUE = 0x0000, /* continue normally */ MAD_FLOW_STOP = 0x0010, /* stop decoding normally */ MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */ MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */ }; struct mad_decoder { enum mad_decoder_mode mode; int options; struct { long pid; int in; int out; } async; struct { struct mad_stream stream; struct mad_frame frame; struct mad_synth synth; } *sync; void *cb_data; enum mad_flow (*input_func)(void *, struct mad_stream *); enum mad_flow (*header_func)(void *, struct mad_header const *); enum mad_flow (*filter_func)(void *, struct mad_stream const *, struct mad_frame *); enum mad_flow (*output_func)(void *, struct mad_header const *, struct mad_pcm *); enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); enum mad_flow (*message_func)(void *, void *, unsigned int *); }; void mad_decoder_init(struct mad_decoder *, void *, enum mad_flow (*)(void *, struct mad_stream *), enum mad_flow (*)(void *, struct mad_header const *), enum mad_flow (*)(void *, struct mad_stream const *, struct mad_frame *), enum mad_flow (*)(void *, struct mad_header const *, struct mad_pcm *), enum mad_flow (*)(void *, struct mad_stream *, struct mad_frame *), enum mad_flow (*)(void *, void *, unsigned int *)); int mad_decoder_finish(struct mad_decoder *); # define mad_decoder_options(decoder, opts) \ ((void) ((decoder)->options = (opts))) int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode); int mad_decoder_message(struct mad_decoder *, void *, unsigned int *); # endif avifile-0.7.48~20090503.ds/plugins/libmad/libmad/fixed.c0000644000175000017500000000340310403657206021350 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: fixed.c,v 1.2 2006/03/08 22:45:26 kabi Exp $ */ # ifdef HAVE_CONFIG_H # include "config.h" # endif # include "global.h" # include "fixed.h" /* * NAME: fixed->abs() * DESCRIPTION: return absolute value of a fixed-point number */ mad_fixed_t mad_f_abs(mad_fixed_t x) { return x < 0 ? -x : x; } /* * NAME: fixed->div() * DESCRIPTION: perform division using fixed-point math */ mad_fixed_t mad_f_div(mad_fixed_t x, mad_fixed_t y) { mad_fixed_t q, r; unsigned int bits; q = mad_f_abs(x / y); if (x < 0) { x = -x; y = -y; } r = x % y; if (y < 0) { x = -x; y = -y; } if (q > mad_f_intpart(MAD_F_MAX) && !(q == -mad_f_intpart(MAD_F_MIN) && r == 0 && (x < 0) != (y < 0))) return 0; for (bits = MAD_F_FRACBITS; bits && r; --bits) { q <<= 1, r <<= 1; if (r >= y) r -= y, ++q; } /* round */ if (2 * r >= y) ++q; /* fix sign */ if ((x < 0) != (y < 0)) q = -q; return q << bits; } avifile-0.7.48~20090503.ds/plugins/libmad/libmad/fixed.h0000644000175000017500000003237010403657206021362 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: fixed.h,v 1.4 2006/03/08 22:45:26 kabi Exp $ */ # ifndef LIBMAD_FIXED_H # define LIBMAD_FIXED_H # if SIZEOF_INT >= 4 typedef signed int mad_fixed_t; typedef signed int mad_fixed64hi_t; typedef unsigned int mad_fixed64lo_t; # else typedef signed long mad_fixed_t; typedef signed long mad_fixed64hi_t; typedef unsigned long mad_fixed64lo_t; # endif # if defined(_MSC_VER) # define mad_fixed64_t signed __int64 # elif 1 || defined(__GNUC__) # define mad_fixed64_t signed long long # endif # if defined(FPM_FLOAT) typedef double mad_sample_t; # else typedef mad_fixed_t mad_sample_t; # endif /* * Fixed-point format: 0xABBBBBBB * A == whole part (sign + 3 bits) * B == fractional part (28 bits) * * Values are signed two's complement, so the effective range is: * 0x80000000 to 0x7fffffff * -8.0 to +7.9999999962747097015380859375 * * The smallest representable value is: * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9) * * 28 bits of fractional accuracy represent about * 8.6 digits of decimal accuracy. * * Fixed-point numbers can be added or subtracted as normal * integers, but multiplication requires shifting the 64-bit result * from 56 fractional bits back to 28 (and rounding.) * * Changing the definition of MAD_F_FRACBITS is only partially * supported, and must be done with care. */ # define MAD_F_FRACBITS 28 # if MAD_F_FRACBITS == 28 # define MAD_F(x) ((mad_fixed_t) (x##L)) # else # if MAD_F_FRACBITS < 28 # warning "MAD_F_FRACBITS < 28" # define MAD_F(x) ((mad_fixed_t) \ (((x##L) + \ (1L << (28 - MAD_F_FRACBITS - 1))) >> \ (28 - MAD_F_FRACBITS))) # elif MAD_F_FRACBITS > 28 # error "MAD_F_FRACBITS > 28 not currently supported" # define MAD_F(x) ((mad_fixed_t) \ ((x##L) << (MAD_F_FRACBITS - 28))) # endif # endif # define MAD_F_MIN ((mad_fixed_t) -0x80000000L) # define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) # define MAD_F_ONE MAD_F(0x10000000) # define mad_f_tofixed(x) ((mad_fixed_t) \ ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) # define mad_f_todouble(x) ((double) \ ((x) / (double) (1L << MAD_F_FRACBITS))) # define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS) # define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1)) /* (x should be positive) */ # define mad_f_fromint(x) ((x) << MAD_F_FRACBITS) # define mad_f_add(x, y) ((x) + (y)) # define mad_f_sub(x, y) ((x) - (y)) # if defined(FPM_FLOAT) # error "FPM_FLOAT not yet supported" # undef MAD_F # define MAD_F(x) mad_f_todouble(x) # define mad_f_mul(x, y) ((x) * (y)) # define mad_f_scale64 # undef ASO_ZEROCHECK # elif defined(FPM_64BIT) /* * This version should be the most accurate if 64-bit types are supported by * the compiler, although it may not be the most efficient. */ # if defined(OPT_ACCURACY) # define mad_f_mul(x, y) \ ((mad_fixed_t) \ ((((mad_fixed64_t) (x) * (y)) + \ (1L << (MAD_F_SCALEBITS - 1))) >> MAD_F_SCALEBITS)) # else # define mad_f_mul(x, y) \ ((mad_fixed_t) (((mad_fixed64_t) (x) * (y)) >> MAD_F_SCALEBITS)) # endif # define MAD_F_SCALEBITS MAD_F_FRACBITS /* --- Intel --------------------------------------------------------------- */ # elif defined(FPM_INTEL) # if defined(_MSC_VER) # pragma warning(push) # pragma warning(disable: 4035) /* no return value */ static __forceinline mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) { enum { fracbits = MAD_F_FRACBITS }; __asm { mov eax, x imul y shrd eax, edx, fracbits } /* implicit return of eax */ } # pragma warning(pop) # define mad_f_mul mad_f_mul_inline # define mad_f_scale64 # else /* * This Intel version is fast and accurate; the disposition of the least * significant bit depends on OPT_ACCURACY via mad_f_scale64(). */ # define MAD_F_MLX(hi, lo, x, y) \ asm ("imull %3" \ : "=a" (lo), "=d" (hi) \ : "%a" (x), "rm" (y) \ : "cc") # if defined(OPT_ACCURACY) /* * This gives best accuracy but is not very fast. */ # define MAD_F_MLA(hi, lo, x, y) \ ({ mad_fixed64hi_t __hi; \ mad_fixed64lo_t __lo; \ MAD_F_MLX(__hi, __lo, (x), (y)); \ asm ("addl %2,%0\n\t" \ "adcl %3,%1" \ : "=rm" (lo), "=rm" (hi) \ : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ : "cc"); \ }) # endif /* OPT_ACCURACY */ # if defined(OPT_ACCURACY) /* * Surprisingly, this is faster than SHRD followed by ADC. */ # define mad_f_scale64(hi, lo) \ ({ mad_fixed64hi_t __hi_; \ mad_fixed64lo_t __lo_; \ mad_fixed_t __result; \ asm ("addl %4,%2\n\t" \ "adcl %5,%3" \ : "=rm" (__lo_), "=rm" (__hi_) \ : "0" (lo), "1" (hi), \ "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ : "cc"); \ asm ("shrdl %3,%2,%1" \ : "=rm" (__result) \ : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ : "cc"); \ __result; \ }) # elif defined(OPT_INTEL) /* * Alternate Intel scaling that may or may not perform better. */ # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result; \ asm ("shrl %3,%1\n\t" \ "shll %4,%2\n\t" \ "orl %2,%1" \ : "=rm" (__result) \ : "0" (lo), "r" (hi), \ "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ : "cc"); \ __result; \ }) # else # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result; \ asm ("shrdl %3,%2,%1" \ : "=rm" (__result) \ : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ : "cc"); \ __result; \ }) # endif /* OPT_ACCURACY */ # define MAD_F_SCALEBITS MAD_F_FRACBITS # endif /* --- ARM ----------------------------------------------------------------- */ # elif defined(FPM_ARM) /* * This ARM V4 version is as accurate as FPM_64BIT but much faster. The * least significant bit is properly rounded at no CPU cycle cost! */ # if 1 /* * This is faster than the default implementation via MAD_F_MLX() and * mad_f_scale64(). */ # define mad_f_mul(x, y) \ ({ mad_fixed64hi_t __hi; \ mad_fixed64lo_t __lo; \ mad_fixed_t __result; \ asm ("smull %0, %1, %3, %4\n\t" \ "movs %0, %0, lsr %5\n\t" \ "adc %2, %0, %1, lsl %6" \ : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ : "%r" (x), "r" (y), \ "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ : "cc"); \ __result; \ }) # endif # define MAD_F_MLX(hi, lo, x, y) \ asm ("smull %0, %1, %2, %3" \ : "=&r" (lo), "=&r" (hi) \ : "%r" (x), "r" (y)) # define MAD_F_MLA(hi, lo, x, y) \ asm ("smlal %0, %1, %2, %3" \ : "+r" (lo), "+r" (hi) \ : "%r" (x), "r" (y)) # define MAD_F_MLN(hi, lo) \ asm ("rsbs %0, %2, #0\n\t" \ "rsc %1, %3, #0" \ : "=r" (lo), "=r" (hi) \ : "0" (lo), "1" (hi) \ : "cc") # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result; \ asm ("movs %0, %1, lsr %3\n\t" \ "adc %0, %0, %2, lsl %4" \ : "=&r" (__result) \ : "r" (lo), "r" (hi), \ "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ : "cc"); \ __result; \ }) # define MAD_F_SCALEBITS MAD_F_FRACBITS /* --- MIPS ---------------------------------------------------------------- */ # elif defined(FPM_MIPS) /* * This MIPS version is fast and accurate; the disposition of the least * significant bit depends on OPT_ACCURACY via mad_f_scale64(). */ # define MAD_F_MLX(hi, lo, x, y) \ asm ("mult %2,%3" \ : "=l" (lo), "=h" (hi) \ : "%r" (x), "r" (y)) # if defined(HAVE_MADD_ASM) # define MAD_F_MLA(hi, lo, x, y) \ asm ("madd %2,%3" \ : "+l" (lo), "+h" (hi) \ : "%r" (x), "r" (y)) # elif defined(HAVE_MADD16_ASM) /* * This loses significant accuracy due to the 16-bit integer limit in the * multiply/accumulate instruction. */ # define MAD_F_ML0(hi, lo, x, y) \ asm ("mult %2,%3" \ : "=l" (lo), "=h" (hi) \ : "%r" ((x) >> 12), "r" ((y) >> 16)) # define MAD_F_MLA(hi, lo, x, y) \ asm ("madd16 %2,%3" \ : "+l" (lo), "+h" (hi) \ : "%r" ((x) >> 12), "r" ((y) >> 16)) # define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo)) # endif # if defined(OPT_SPEED) # define mad_f_scale64(hi, lo) \ ((mad_fixed_t) ((hi) << (32 - MAD_F_SCALEBITS))) # define MAD_F_SCALEBITS MAD_F_FRACBITS # endif /* --- SPARC --------------------------------------------------------------- */ # elif defined(FPM_SPARC) /* * This SPARC V8 version is fast and accurate; the disposition of the least * significant bit depends on OPT_ACCURACY via mad_f_scale64(). */ # define MAD_F_MLX(hi, lo, x, y) \ asm ("smul %2, %3, %0\n\t" \ "rd %%y, %1" \ : "=r" (lo), "=r" (hi) \ : "%r" (x), "rI" (y)) /* --- PowerPC ------------------------------------------------------------- */ # elif defined(FPM_PPC) /* * This PowerPC version is fast and accurate; the disposition of the least * significant bit depends on OPT_ACCURACY via mad_f_scale64(). */ # define MAD_F_MLX(hi, lo, x, y) \ do { \ asm ("mullw %0,%1,%2" \ : "=r" (lo) \ : "%r" (x), "r" (y)); \ asm ("mulhw %0,%1,%2" \ : "=r" (hi) \ : "%r" (x), "r" (y)); \ } \ while (0) # if defined(OPT_ACCURACY) /* * This gives best accuracy but is not very fast. */ # define MAD_F_MLA(hi, lo, x, y) \ ({ mad_fixed64hi_t __hi; \ mad_fixed64lo_t __lo; \ MAD_F_MLX(__hi, __lo, (x), (y)); \ asm ("addc %0,%2,%3\n\t" \ "adde %1,%4,%5" \ : "=r" (lo), "=r" (hi) \ : "%r" (lo), "r" (__lo), \ "%r" (hi), "r" (__hi) \ : "xer"); \ }) # endif # if defined(OPT_ACCURACY) /* * This is slower than the truncating version below it. */ # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result, __round; \ asm ("rotrwi %0,%1,%2" \ : "=r" (__result) \ : "r" (lo), "i" (MAD_F_SCALEBITS)); \ asm ("extrwi %0,%1,1,0" \ : "=r" (__round) \ : "r" (__result)); \ asm ("insrwi %0,%1,%2,0" \ : "+r" (__result) \ : "r" (hi), "i" (MAD_F_SCALEBITS)); \ asm ("add %0,%1,%2" \ : "=r" (__result) \ : "%r" (__result), "r" (__round)); \ __result; \ }) # else # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result; \ asm ("rotrwi %0,%1,%2" \ : "=r" (__result) \ : "r" (lo), "i" (MAD_F_SCALEBITS)); \ asm ("insrwi %0,%1,%2,0" \ : "+r" (__result) \ : "r" (hi), "i" (MAD_F_SCALEBITS)); \ __result; \ }) # endif # define MAD_F_SCALEBITS MAD_F_FRACBITS /* --- Default ------------------------------------------------------------- */ # elif defined(FPM_DEFAULT) /* * This version is the most portable but it loses significant accuracy. * Furthermore, accuracy is biased against the second argument, so care * should be taken when ordering operands. * * The scale factors are constant as this is not used with SSO. * * Pre-rounding is required to stay within the limits of compliance. */ # if defined(OPT_SPEED) # define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16)) # else # define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \ (((y) + (1L << 15)) >> 16)) # endif /* ------------------------------------------------------------------------- */ # else # error "no FPM selected" # endif /* default implementations */ # if !defined(mad_f_mul) # define mad_f_mul(x, y) \ ({ register mad_fixed64hi_t __hi; \ register mad_fixed64lo_t __lo; \ MAD_F_MLX(__hi, __lo, (x), (y)); \ mad_f_scale64(__hi, __lo); \ }) # endif # if !defined(MAD_F_MLA) # define MAD_F_ML0(hi, lo, x, y) ((lo) = mad_f_mul((x), (y))) # define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y))) # define MAD_F_MLN(hi, lo) ((lo) = -(lo)) # define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) # endif # if !defined(MAD_F_ML0) # define MAD_F_ML0(hi, lo, x, y) MAD_F_MLX((hi), (lo), (x), (y)) # endif # if !defined(MAD_F_MLN) # define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) # endif # if !defined(MAD_F_MLZ) # define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) # endif # if !defined(mad_f_scale64) # if defined(OPT_ACCURACY) # define mad_f_scale64(hi, lo) \ ((((mad_fixed_t) \ (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \ ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) # else # define mad_f_scale64(hi, lo) \ ((mad_fixed_t) \ (((hi) << (32 - MAD_F_SCALEBITS)) | \ ((lo) >> MAD_F_SCALEBITS))) # endif # define MAD_F_SCALEBITS MAD_F_FRACBITS # endif /* C routines */ mad_fixed_t mad_f_abs(mad_fixed_t); mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t); # endif avifile-0.7.48~20090503.ds/plugins/libmad/libmad/frame.c0000644000175000017500000002750210403657206021351 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: frame.c,v 1.2 2006/03/08 22:45:26 kabi Exp $ */ # ifdef HAVE_CONFIG_H # include "config.h" # endif # include "global.h" # include # include "bit.h" # include "stream.h" # include "frame.h" # include "timer.h" # include "layer12.h" # include "layer3.h" static unsigned long const bitrate_table[5][15] = { /* MPEG-1 */ { 0, 32000, 64000, 96000, 128000, 160000, 192000, 224000, /* Layer I */ 256000, 288000, 320000, 352000, 384000, 416000, 448000 }, { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer II */ 128000, 160000, 192000, 224000, 256000, 320000, 384000 }, { 0, 32000, 40000, 48000, 56000, 64000, 80000, 96000, /* Layer III */ 112000, 128000, 160000, 192000, 224000, 256000, 320000 }, /* MPEG-2 LSF */ { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer I */ 128000, 144000, 160000, 176000, 192000, 224000, 256000 }, { 0, 8000, 16000, 24000, 32000, 40000, 48000, 56000, /* Layers */ 64000, 80000, 96000, 112000, 128000, 144000, 160000 } /* II & III */ }; static unsigned int const samplerate_table[3] = { 44100, 48000, 32000 }; static int (*const decoder_table[3])(struct mad_stream *, struct mad_frame *) = { mad_layer_I, mad_layer_II, mad_layer_III }; /* * NAME: header->init() * DESCRIPTION: initialize header struct */ void mad_header_init(struct mad_header *header) { header->layer = 0; header->mode = 0; header->mode_extension = 0; header->emphasis = 0; header->bitrate = 0; header->samplerate = 0; header->crc_check = 0; header->crc_target = 0; header->flags = 0; header->private_bits = 0; header->duration = mad_timer_zero; } /* * NAME: frame->init() * DESCRIPTION: initialize frame struct */ void mad_frame_init(struct mad_frame *frame) { mad_header_init(&frame->header); frame->options = 0; frame->overlap = 0; mad_frame_mute(frame); } /* * NAME: frame->finish() * DESCRIPTION: deallocate any dynamic memory associated with frame */ void mad_frame_finish(struct mad_frame *frame) { mad_header_finish(&frame->header); if (frame->overlap) { free(frame->overlap); frame->overlap = 0; } } /* * NAME: decode_header() * DESCRIPTION: read header data and following CRC word */ static int decode_header(struct mad_header *header, struct mad_stream *stream) { unsigned int index; header->flags = 0; header->private_bits = 0; /* header() */ /* syncword */ mad_bit_skip(&stream->ptr, 11); /* MPEG 2.5 indicator (really part of syncword) */ if (mad_bit_read(&stream->ptr, 1) == 0) header->flags |= MAD_FLAG_MPEG_2_5_EXT; /* ID */ if (mad_bit_read(&stream->ptr, 1) == 0) header->flags |= MAD_FLAG_LSF_EXT; else if (header->flags & MAD_FLAG_MPEG_2_5_EXT) { stream->error = MAD_ERROR_LOSTSYNC; return -1; } /* layer */ header->layer = 4 - mad_bit_read(&stream->ptr, 2); if (header->layer == 4) { stream->error = MAD_ERROR_BADLAYER; return -1; } /* protection_bit */ if (mad_bit_read(&stream->ptr, 1) == 0) { header->flags |= MAD_FLAG_PROTECTION; header->crc_check = mad_bit_crc(stream->ptr, 16, 0xffff); } /* bitrate_index */ index = mad_bit_read(&stream->ptr, 4); if (index == 15) { stream->error = MAD_ERROR_BADBITRATE; return -1; } if (header->flags & MAD_FLAG_LSF_EXT) header->bitrate = bitrate_table[3 + (header->layer >> 1)][index]; else header->bitrate = bitrate_table[header->layer - 1][index]; /* sampling_frequency */ index = mad_bit_read(&stream->ptr, 2); if (index == 3) { stream->error = MAD_ERROR_BADSAMPLERATE; return -1; } header->samplerate = samplerate_table[index]; if (header->flags & MAD_FLAG_LSF_EXT) { header->samplerate /= 2; if (header->flags & MAD_FLAG_MPEG_2_5_EXT) header->samplerate /= 2; } /* padding_bit */ if (mad_bit_read(&stream->ptr, 1)) header->flags |= MAD_FLAG_PADDING; /* private_bit */ if (mad_bit_read(&stream->ptr, 1)) header->private_bits |= MAD_PRIVATE_HEADER; /* mode */ header->mode = 3 - mad_bit_read(&stream->ptr, 2); /* mode_extension */ header->mode_extension = mad_bit_read(&stream->ptr, 2); /* copyright */ if (mad_bit_read(&stream->ptr, 1)) header->flags |= MAD_FLAG_COPYRIGHT; /* original/copy */ if (mad_bit_read(&stream->ptr, 1)) header->flags |= MAD_FLAG_ORIGINAL; /* emphasis */ header->emphasis = mad_bit_read(&stream->ptr, 2); # if defined(OPT_STRICT) /* * ISO/IEC 11172-3 says this is a reserved emphasis value, but * streams exist which use it anyway. Since the value is not important * to the decoder proper, we allow it unless OPT_STRICT is defined. */ if (header->emphasis == MAD_EMPHASIS_RESERVED) { stream->error = MAD_ERROR_BADEMPHASIS; return -1; } # endif /* error_check() */ /* crc_check */ if (header->flags & MAD_FLAG_PROTECTION) header->crc_target = mad_bit_read(&stream->ptr, 16); return 0; } /* * NAME: free_bitrate() * DESCRIPTION: attempt to discover the bitstream's free bitrate */ static int free_bitrate(struct mad_stream *stream, struct mad_header const *header) { struct mad_bitptr keep_ptr; unsigned long rate = 0; unsigned int pad_slot, slots_per_frame; unsigned char const *ptr = 0; keep_ptr = stream->ptr; pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0; slots_per_frame = (header->layer == MAD_LAYER_III && (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144; while (mad_stream_sync(stream) == 0) { struct mad_stream peek_stream; struct mad_header peek_header; peek_stream = *stream; peek_header = *header; if (decode_header(&peek_header, &peek_stream) == 0 && peek_header.layer == header->layer && peek_header.samplerate == header->samplerate) { unsigned int N; ptr = mad_bit_nextbyte(&stream->ptr); N = ptr - stream->this_frame; if (header->layer == MAD_LAYER_I) { rate = (unsigned long) header->samplerate * (N - 4 * pad_slot + 4) / 48 / 1000; } else { rate = (unsigned long) header->samplerate * (N - pad_slot + 1) / slots_per_frame / 1000; } if (rate >= 8) break; } mad_bit_skip(&stream->ptr, 8); } stream->ptr = keep_ptr; if (rate < 8 || (header->layer == MAD_LAYER_III && rate > 640)) { stream->error = MAD_ERROR_LOSTSYNC; return -1; } stream->freerate = rate * 1000; return 0; } /* * NAME: header->decode() * DESCRIPTION: read the next frame header from the stream */ int mad_header_decode(struct mad_header *header, struct mad_stream *stream) { register unsigned char const *ptr, *end; unsigned int pad_slot, N; ptr = stream->next_frame; end = stream->bufend; if (ptr == 0) { stream->error = MAD_ERROR_BUFPTR; goto fail; } /* stream skip */ if (stream->skiplen) { if (!stream->sync) ptr = stream->this_frame; if (end - ptr < stream->skiplen) { stream->skiplen -= end - ptr; stream->next_frame = end; stream->error = MAD_ERROR_BUFLEN; goto fail; } ptr += stream->skiplen; stream->skiplen = 0; stream->sync = 1; } sync: /* synchronize */ if (stream->sync) { if (end - ptr < MAD_BUFFER_GUARD) { stream->next_frame = ptr; stream->error = MAD_ERROR_BUFLEN; goto fail; } else if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) { /* mark point where frame sync word was expected */ stream->this_frame = ptr; stream->next_frame = ptr + 1; stream->error = MAD_ERROR_LOSTSYNC; goto fail; } } else { mad_bit_init(&stream->ptr, ptr); if (mad_stream_sync(stream) == -1) { if (end - stream->next_frame >= MAD_BUFFER_GUARD) stream->next_frame = end - MAD_BUFFER_GUARD; stream->error = MAD_ERROR_BUFLEN; goto fail; } ptr = mad_bit_nextbyte(&stream->ptr); } /* begin processing */ stream->this_frame = ptr; stream->next_frame = ptr + 1; /* possibly bogus sync word */ mad_bit_init(&stream->ptr, stream->this_frame); if (decode_header(header, stream) == -1) goto fail; /* calculate frame duration */ mad_timer_set(&header->duration, 0, 32 * MAD_NSBSAMPLES(header), header->samplerate); /* calculate free bit rate */ if (header->bitrate == 0) { if ((stream->freerate == 0 || !stream->sync || (header->layer == MAD_LAYER_III && stream->freerate > 640000)) && free_bitrate(stream, header) == -1) goto fail; header->bitrate = stream->freerate; header->flags |= MAD_FLAG_FREEFORMAT; } /* calculate beginning of next frame */ pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0; if (header->layer == MAD_LAYER_I) N = ((12 * header->bitrate / header->samplerate) + pad_slot) * 4; else { unsigned int slots_per_frame; slots_per_frame = (header->layer == MAD_LAYER_III && (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144; N = (slots_per_frame * header->bitrate / header->samplerate) + pad_slot; } /* verify there is enough data left in buffer to decode this frame */ if (N + MAD_BUFFER_GUARD > end - stream->this_frame) { stream->next_frame = stream->this_frame; stream->error = MAD_ERROR_BUFLEN; goto fail; } stream->next_frame = stream->this_frame + N; if (!stream->sync) { /* check that a valid frame header follows this frame */ ptr = stream->next_frame; if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) { ptr = stream->next_frame = stream->this_frame + 1; goto sync; } stream->sync = 1; } header->flags |= MAD_FLAG_INCOMPLETE; return 0; fail: stream->sync = 0; return -1; } /* * NAME: frame->decode() * DESCRIPTION: decode a single frame from a bitstream */ int mad_frame_decode(struct mad_frame *frame, struct mad_stream *stream) { frame->options = stream->options; /* header() */ /* error_check() */ if (!(frame->header.flags & MAD_FLAG_INCOMPLETE) && mad_header_decode(&frame->header, stream) == -1) goto fail; /* audio_data() */ frame->header.flags &= ~MAD_FLAG_INCOMPLETE; if (decoder_table[frame->header.layer - 1](stream, frame) == -1) { if (!MAD_RECOVERABLE(stream->error)) stream->next_frame = stream->this_frame; goto fail; } /* ancillary_data() */ if (frame->header.layer != MAD_LAYER_III) { struct mad_bitptr next_frame; mad_bit_init(&next_frame, stream->next_frame); stream->anc_ptr = stream->ptr; stream->anc_bitlen = mad_bit_length(&stream->ptr, &next_frame); mad_bit_finish(&next_frame); } return 0; fail: stream->anc_bitlen = 0; return -1; } /* * NAME: frame->mute() * DESCRIPTION: zero all subband values so the frame becomes silent */ void mad_frame_mute(struct mad_frame *frame) { unsigned int s, sb; for (s = 0; s < 36; ++s) { for (sb = 0; sb < 32; ++sb) { frame->sbsample[0][s][sb] = frame->sbsample[1][s][sb] = 0; } } if (frame->overlap) { for (s = 0; s < 18; ++s) { for (sb = 0; sb < 32; ++sb) { (*frame->overlap)[0][sb][s] = (*frame->overlap)[1][sb][s] = 0; } } } } avifile-0.7.48~20090503.ds/plugins/libmad/libmad/frame.h0000644000175000017500000000772310403657206021361 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: frame.h,v 1.2 2006/03/08 22:45:26 kabi Exp $ */ # ifndef LIBMAD_FRAME_H # define LIBMAD_FRAME_H # include "fixed.h" # include "timer.h" # include "stream.h" enum mad_layer { MAD_LAYER_I = 1, /* Layer I */ MAD_LAYER_II = 2, /* Layer II */ MAD_LAYER_III = 3 /* Layer III */ }; enum mad_mode { MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */ MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */ MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */ MAD_MODE_STEREO = 3 /* normal LR stereo */ }; enum mad_emphasis { MAD_EMPHASIS_NONE = 0, /* no emphasis */ MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */ MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */ }; struct mad_header { enum mad_layer layer; /* audio layer (1, 2, or 3) */ enum mad_mode mode; /* channel mode (see above) */ int mode_extension; /* additional mode info */ enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ unsigned long bitrate; /* stream bitrate (bps) */ unsigned int samplerate; /* sampling frequency (Hz) */ unsigned short crc_check; /* frame CRC accumulator */ unsigned short crc_target; /* final target CRC checksum */ int flags; /* flags (see below) */ int private_bits; /* private bits (see below) */ mad_timer_t duration; /* audio playing time of frame */ }; struct mad_frame { struct mad_header header; /* MPEG audio header */ int options; /* decoding options (from stream) */ mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */ mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */ }; # define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1) # define MAD_NSBSAMPLES(header) \ ((header)->layer == MAD_LAYER_I ? 12 : \ (((header)->layer == MAD_LAYER_III && \ ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36)) enum { MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */ MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */ MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */ MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */ MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */ MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */ MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */ MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */ MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */ MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */ MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */ MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */ }; enum { MAD_PRIVATE_HEADER = 0x0100, /* header private bit */ MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */ }; void mad_header_init(struct mad_header *); # define mad_header_finish(header) /* nothing */ int mad_header_decode(struct mad_header *, struct mad_stream *); void mad_frame_init(struct mad_frame *); void mad_frame_finish(struct mad_frame *); int mad_frame_decode(struct mad_frame *, struct mad_stream *); void mad_frame_mute(struct mad_frame *); # endif avifile-0.7.48~20090503.ds/plugins/libmad/libmad/global.h0000644000175000017500000000315610403657206021523 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: global.h,v 1.3 2006/03/08 22:45:26 kabi Exp $ */ # ifndef LIBMAD_GLOBAL_H # define LIBMAD_GLOBAL_H /* conditional debugging */ # if defined(DEBUG) && defined(NDEBUG) # error "cannot define both DEBUG and NDEBUG" # endif # if defined(DEBUG) # include # endif /* conditional features */ # if defined(OPT_SPEED) && defined(OPT_ACCURACY) # error "cannot optimize for both speed and accuracy" # endif # if defined(OPT_SPEED) && !defined(OPT_SSO) # define OPT_SSO # endif # if defined(HAVE_UNISTD_H) && defined(HAVE_WAITPID) && \ defined(HAVE_FCNTL) && defined(HAVE_PIPE) && defined(HAVE_FORK) # define USE_ASYNC # endif # if !defined(HAVE_ASSERT_H) # if defined(NDEBUG) # define assert(x) /* nothing */ # else # define assert(x) do { if (!(x)) abort(); } while (0) # endif # endif # endif avifile-0.7.48~20090503.ds/plugins/libmad/libmad/huffman.c0000644000175000017500000021672610403657206021713 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: huffman.c,v 1.2 2006/03/08 22:45:26 kabi Exp $ */ # ifdef HAVE_CONFIG_H # include "config.h" # endif # include "global.h" # include "huffman.h" /* * These are the Huffman code words for Layer III. * The data for these tables are derived from Table B.7 of ISO/IEC 11172-3. * * These tables support decoding up to 4 Huffman code bits at a time. */ # if defined(__GNUC__) || \ (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901) # define PTR(offs, bits) { .ptr = { 0, bits, offs } } # define V(v, w, x, y, hlen) { .value = { 1, hlen, v, w, x, y } } # else # define PTR(offs, bits) { { 0, bits, offs } } # if defined(WORDS_BIGENDIAN) # define V(v, w, x, y, hlen) { { 1, hlen, (v << 11) | (w << 10) | \ (x << 9) | (y << 8) } } # else # define V(v, w, x, y, hlen) { { 1, hlen, (v << 0) | (w << 1) | \ (x << 2) | (y << 3) } } # endif # endif static union huffquad const hufftabA[] = { /* 0000 */ PTR(16, 2), /* 0001 */ PTR(20, 2), /* 0010 */ PTR(24, 1), /* 0011 */ PTR(26, 1), /* 0100 */ V(0, 0, 1, 0, 4), /* 0101 */ V(0, 0, 0, 1, 4), /* 0110 */ V(0, 1, 0, 0, 4), /* 0111 */ V(1, 0, 0, 0, 4), /* 1000 */ V(0, 0, 0, 0, 1), /* 1001 */ V(0, 0, 0, 0, 1), /* 1010 */ V(0, 0, 0, 0, 1), /* 1011 */ V(0, 0, 0, 0, 1), /* 1100 */ V(0, 0, 0, 0, 1), /* 1101 */ V(0, 0, 0, 0, 1), /* 1110 */ V(0, 0, 0, 0, 1), /* 1111 */ V(0, 0, 0, 0, 1), /* 0000 ... */ /* 00 */ V(1, 0, 1, 1, 2), /* 16 */ /* 01 */ V(1, 1, 1, 1, 2), /* 10 */ V(1, 1, 0, 1, 2), /* 11 */ V(1, 1, 1, 0, 2), /* 0001 ... */ /* 00 */ V(0, 1, 1, 1, 2), /* 20 */ /* 01 */ V(0, 1, 0, 1, 2), /* 10 */ V(1, 0, 0, 1, 1), /* 11 */ V(1, 0, 0, 1, 1), /* 0010 ... */ /* 0 */ V(0, 1, 1, 0, 1), /* 24 */ /* 1 */ V(0, 0, 1, 1, 1), /* 0011 ... */ /* 0 */ V(1, 0, 1, 0, 1), /* 26 */ /* 1 */ V(1, 1, 0, 0, 1) }; static union huffquad const hufftabB[] = { /* 0000 */ V(1, 1, 1, 1, 4), /* 0001 */ V(1, 1, 1, 0, 4), /* 0010 */ V(1, 1, 0, 1, 4), /* 0011 */ V(1, 1, 0, 0, 4), /* 0100 */ V(1, 0, 1, 1, 4), /* 0101 */ V(1, 0, 1, 0, 4), /* 0110 */ V(1, 0, 0, 1, 4), /* 0111 */ V(1, 0, 0, 0, 4), /* 1000 */ V(0, 1, 1, 1, 4), /* 1001 */ V(0, 1, 1, 0, 4), /* 1010 */ V(0, 1, 0, 1, 4), /* 1011 */ V(0, 1, 0, 0, 4), /* 1100 */ V(0, 0, 1, 1, 4), /* 1101 */ V(0, 0, 1, 0, 4), /* 1110 */ V(0, 0, 0, 1, 4), /* 1111 */ V(0, 0, 0, 0, 4) }; # undef V # undef PTR # if defined(__GNUC__) || \ (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901) # define PTR(offs, bits) { .ptr = { 0, bits, offs } } # define V(x, y, hlen) { .value = { 1, hlen, x, y } } # else # define PTR(offs, bits) { { 0, bits, offs } } # if defined(WORDS_BIGENDIAN) # define V(x, y, hlen) { { 1, hlen, (x << 8) | (y << 4) } } # else # define V(x, y, hlen) { { 1, hlen, (x << 0) | (y << 4) } } # endif # endif static union huffpair const hufftab0[] = { /* */ V(0, 0, 0) }; static union huffpair const hufftab1[] = { /* 000 */ V(1, 1, 3), /* 001 */ V(0, 1, 3), /* 010 */ V(1, 0, 2), /* 011 */ V(1, 0, 2), /* 100 */ V(0, 0, 1), /* 101 */ V(0, 0, 1), /* 110 */ V(0, 0, 1), /* 111 */ V(0, 0, 1) }; static union huffpair const hufftab2[] = { /* 000 */ PTR(8, 3), /* 001 */ V(1, 1, 3), /* 010 */ V(0, 1, 3), /* 011 */ V(1, 0, 3), /* 100 */ V(0, 0, 1), /* 101 */ V(0, 0, 1), /* 110 */ V(0, 0, 1), /* 111 */ V(0, 0, 1), /* 000 ... */ /* 000 */ V(2, 2, 3), /* 8 */ /* 001 */ V(0, 2, 3), /* 010 */ V(1, 2, 2), /* 011 */ V(1, 2, 2), /* 100 */ V(2, 1, 2), /* 101 */ V(2, 1, 2), /* 110 */ V(2, 0, 2), /* 111 */ V(2, 0, 2) }; static union huffpair const hufftab3[] = { /* 000 */ PTR(8, 3), /* 001 */ V(1, 0, 3), /* 010 */ V(1, 1, 2), /* 011 */ V(1, 1, 2), /* 100 */ V(0, 1, 2), /* 101 */ V(0, 1, 2), /* 110 */ V(0, 0, 2), /* 111 */ V(0, 0, 2), /* 000 ... */ /* 000 */ V(2, 2, 3), /* 8 */ /* 001 */ V(0, 2, 3), /* 010 */ V(1, 2, 2), /* 011 */ V(1, 2, 2), /* 100 */ V(2, 1, 2), /* 101 */ V(2, 1, 2), /* 110 */ V(2, 0, 2), /* 111 */ V(2, 0, 2) }; static union huffpair const hufftab5[] = { /* 000 */ PTR(8, 4), /* 001 */ V(1, 1, 3), /* 010 */ V(0, 1, 3), /* 011 */ V(1, 0, 3), /* 100 */ V(0, 0, 1), /* 101 */ V(0, 0, 1), /* 110 */ V(0, 0, 1), /* 111 */ V(0, 0, 1), /* 000 ... */ /* 0000 */ PTR(24, 1), /* 8 */ /* 0001 */ V(3, 2, 4), /* 0010 */ V(3, 1, 3), /* 0011 */ V(3, 1, 3), /* 0100 */ V(1, 3, 4), /* 0101 */ V(0, 3, 4), /* 0110 */ V(3, 0, 4), /* 0111 */ V(2, 2, 4), /* 1000 */ V(1, 2, 3), /* 1001 */ V(1, 2, 3), /* 1010 */ V(2, 1, 3), /* 1011 */ V(2, 1, 3), /* 1100 */ V(0, 2, 3), /* 1101 */ V(0, 2, 3), /* 1110 */ V(2, 0, 3), /* 1111 */ V(2, 0, 3), /* 000 0000 ... */ /* 0 */ V(3, 3, 1), /* 24 */ /* 1 */ V(2, 3, 1) }; static union huffpair const hufftab6[] = { /* 0000 */ PTR(16, 3), /* 0001 */ PTR(24, 1), /* 0010 */ PTR(26, 1), /* 0011 */ V(1, 2, 4), /* 0100 */ V(2, 1, 4), /* 0101 */ V(2, 0, 4), /* 0110 */ V(0, 1, 3), /* 0111 */ V(0, 1, 3), /* 1000 */ V(1, 1, 2), /* 1001 */ V(1, 1, 2), /* 1010 */ V(1, 1, 2), /* 1011 */ V(1, 1, 2), /* 1100 */ V(1, 0, 3), /* 1101 */ V(1, 0, 3), /* 1110 */ V(0, 0, 3), /* 1111 */ V(0, 0, 3), /* 0000 ... */ /* 000 */ V(3, 3, 3), /* 16 */ /* 001 */ V(0, 3, 3), /* 010 */ V(2, 3, 2), /* 011 */ V(2, 3, 2), /* 100 */ V(3, 2, 2), /* 101 */ V(3, 2, 2), /* 110 */ V(3, 0, 2), /* 111 */ V(3, 0, 2), /* 0001 ... */ /* 0 */ V(1, 3, 1), /* 24 */ /* 1 */ V(3, 1, 1), /* 0010 ... */ /* 0 */ V(2, 2, 1), /* 26 */ /* 1 */ V(0, 2, 1) }; static union huffpair const hufftab7[] = { /* 0000 */ PTR(16, 4), /* 0001 */ PTR(32, 4), /* 0010 */ PTR(48, 2), /* 0011 */ V(1, 1, 4), /* 0100 */ V(0, 1, 3), /* 0101 */ V(0, 1, 3), /* 0110 */ V(1, 0, 3), /* 0111 */ V(1, 0, 3), /* 1000 */ V(0, 0, 1), /* 1001 */ V(0, 0, 1), /* 1010 */ V(0, 0, 1), /* 1011 */ V(0, 0, 1), /* 1100 */ V(0, 0, 1), /* 1101 */ V(0, 0, 1), /* 1110 */ V(0, 0, 1), /* 1111 */ V(0, 0, 1), /* 0000 ... */ /* 0000 */ PTR(52, 2), /* 16 */ /* 0001 */ PTR(56, 1), /* 0010 */ PTR(58, 1), /* 0011 */ V(1, 5, 4), /* 0100 */ V(5, 1, 4), /* 0101 */ PTR(60, 1), /* 0110 */ V(5, 0, 4), /* 0111 */ PTR(62, 1), /* 1000 */ V(2, 4, 4), /* 1001 */ V(4, 2, 4), /* 1010 */ V(1, 4, 3), /* 1011 */ V(1, 4, 3), /* 1100 */ V(4, 1, 3), /* 1101 */ V(4, 1, 3), /* 1110 */ V(4, 0, 3), /* 1111 */ V(4, 0, 3), /* 0001 ... */ /* 0000 */ V(0, 4, 4), /* 32 */ /* 0001 */ V(2, 3, 4), /* 0010 */ V(3, 2, 4), /* 0011 */ V(0, 3, 4), /* 0100 */ V(1, 3, 3), /* 0101 */ V(1, 3, 3), /* 0110 */ V(3, 1, 3), /* 0111 */ V(3, 1, 3), /* 1000 */ V(3, 0, 3), /* 1001 */ V(3, 0, 3), /* 1010 */ V(2, 2, 3), /* 1011 */ V(2, 2, 3), /* 1100 */ V(1, 2, 2), /* 1101 */ V(1, 2, 2), /* 1110 */ V(1, 2, 2), /* 1111 */ V(1, 2, 2), /* 0010 ... */ /* 00 */ V(2, 1, 1), /* 48 */ /* 01 */ V(2, 1, 1), /* 10 */ V(0, 2, 2), /* 11 */ V(2, 0, 2), /* 0000 0000 ... */ /* 00 */ V(5, 5, 2), /* 52 */ /* 01 */ V(4, 5, 2), /* 10 */ V(5, 4, 2), /* 11 */ V(5, 3, 2), /* 0000 0001 ... */ /* 0 */ V(3, 5, 1), /* 56 */ /* 1 */ V(4, 4, 1), /* 0000 0010 ... */ /* 0 */ V(2, 5, 1), /* 58 */ /* 1 */ V(5, 2, 1), /* 0000 0101 ... */ /* 0 */ V(0, 5, 1), /* 60 */ /* 1 */ V(3, 4, 1), /* 0000 0111 ... */ /* 0 */ V(4, 3, 1), /* 62 */ /* 1 */ V(3, 3, 1) }; # if 0 /* this version saves 8 entries (16 bytes) at the expense of an extra lookup in 4 out of 36 cases */ static union huffpair const hufftab8[] = { /* 0000 */ PTR(16, 4), /* 0001 */ PTR(32, 2), /* 0010 */ V(1, 2, 4), /* 0011 */ V(2, 1, 4), /* 0100 */ V(1, 1, 2), /* 0101 */ V(1, 1, 2), /* 0110 */ V(1, 1, 2), /* 0111 */ V(1, 1, 2), /* 1000 */ V(0, 1, 3), /* 1001 */ V(0, 1, 3), /* 1010 */ V(1, 0, 3), /* 1011 */ V(1, 0, 3), /* 1100 */ V(0, 0, 2), /* 1101 */ V(0, 0, 2), /* 1110 */ V(0, 0, 2), /* 1111 */ V(0, 0, 2), /* 0000 ... */ /* 0000 */ PTR(36, 3), /* 16 */ /* 0001 */ PTR(44, 2), /* 0010 */ PTR(48, 1), /* 0011 */ V(1, 5, 4), /* 0100 */ V(5, 1, 4), /* 0101 */ PTR(50, 1), /* 0110 */ PTR(52, 1), /* 0111 */ V(2, 4, 4), /* 1000 */ V(4, 2, 4), /* 1001 */ V(1, 4, 4), /* 1010 */ V(4, 1, 3), /* 1011 */ V(4, 1, 3), /* 1100 */ V(0, 4, 4), /* 1101 */ V(4, 0, 4), /* 1110 */ V(2, 3, 4), /* 1111 */ V(3, 2, 4), /* 0001 ... */ /* 00 */ PTR(54, 2), /* 32 */ /* 01 */ V(2, 2, 2), /* 10 */ V(0, 2, 2), /* 11 */ V(2, 0, 2), /* 0000 0000 ... */ /* 000 */ V(5, 5, 3), /* 36 */ /* 001 */ V(5, 4, 3), /* 010 */ V(4, 5, 2), /* 011 */ V(4, 5, 2), /* 100 */ V(5, 3, 1), /* 101 */ V(5, 3, 1), /* 110 */ V(5, 3, 1), /* 111 */ V(5, 3, 1), /* 0000 0001 ... */ /* 00 */ V(3, 5, 2), /* 44 */ /* 01 */ V(4, 4, 2), /* 10 */ V(2, 5, 1), /* 11 */ V(2, 5, 1), /* 0000 0010 ... */ /* 0 */ V(5, 2, 1), /* 48 */ /* 1 */ V(0, 5, 1), /* 0000 0101 ... */ /* 0 */ V(3, 4, 1), /* 50 */ /* 1 */ V(4, 3, 1), /* 0000 0110 ... */ /* 0 */ V(5, 0, 1), /* 52 */ /* 1 */ V(3, 3, 1), /* 0001 00 ... */ /* 00 */ V(1, 3, 2), /* 54 */ /* 01 */ V(3, 1, 2), /* 10 */ V(0, 3, 2), /* 11 */ V(3, 0, 2), }; # else static union huffpair const hufftab8[] = { /* 0000 */ PTR(16, 4), /* 0001 */ PTR(32, 4), /* 0010 */ V(1, 2, 4), /* 0011 */ V(2, 1, 4), /* 0100 */ V(1, 1, 2), /* 0101 */ V(1, 1, 2), /* 0110 */ V(1, 1, 2), /* 0111 */ V(1, 1, 2), /* 1000 */ V(0, 1, 3), /* 1001 */ V(0, 1, 3), /* 1010 */ V(1, 0, 3), /* 1011 */ V(1, 0, 3), /* 1100 */ V(0, 0, 2), /* 1101 */ V(0, 0, 2), /* 1110 */ V(0, 0, 2), /* 1111 */ V(0, 0, 2), /* 0000 ... */ /* 0000 */ PTR(48, 3), /* 16 */ /* 0001 */ PTR(56, 2), /* 0010 */ PTR(60, 1), /* 0011 */ V(1, 5, 4), /* 0100 */ V(5, 1, 4), /* 0101 */ PTR(62, 1), /* 0110 */ PTR(64, 1), /* 0111 */ V(2, 4, 4), /* 1000 */ V(4, 2, 4), /* 1001 */ V(1, 4, 4), /* 1010 */ V(4, 1, 3), /* 1011 */ V(4, 1, 3), /* 1100 */ V(0, 4, 4), /* 1101 */ V(4, 0, 4), /* 1110 */ V(2, 3, 4), /* 1111 */ V(3, 2, 4), /* 0001 ... */ /* 0000 */ V(1, 3, 4), /* 32 */ /* 0001 */ V(3, 1, 4), /* 0010 */ V(0, 3, 4), /* 0011 */ V(3, 0, 4), /* 0100 */ V(2, 2, 2), /* 0101 */ V(2, 2, 2), /* 0110 */ V(2, 2, 2), /* 0111 */ V(2, 2, 2), /* 1000 */ V(0, 2, 2), /* 1001 */ V(0, 2, 2), /* 1010 */ V(0, 2, 2), /* 1011 */ V(0, 2, 2), /* 1100 */ V(2, 0, 2), /* 1101 */ V(2, 0, 2), /* 1110 */ V(2, 0, 2), /* 1111 */ V(2, 0, 2), /* 0000 0000 ... */ /* 000 */ V(5, 5, 3), /* 48 */ /* 001 */ V(5, 4, 3), /* 010 */ V(4, 5, 2), /* 011 */ V(4, 5, 2), /* 100 */ V(5, 3, 1), /* 101 */ V(5, 3, 1), /* 110 */ V(5, 3, 1), /* 111 */ V(5, 3, 1), /* 0000 0001 ... */ /* 00 */ V(3, 5, 2), /* 56 */ /* 01 */ V(4, 4, 2), /* 10 */ V(2, 5, 1), /* 11 */ V(2, 5, 1), /* 0000 0010 ... */ /* 0 */ V(5, 2, 1), /* 60 */ /* 1 */ V(0, 5, 1), /* 0000 0101 ... */ /* 0 */ V(3, 4, 1), /* 62 */ /* 1 */ V(4, 3, 1), /* 0000 0110 ... */ /* 0 */ V(5, 0, 1), /* 64 */ /* 1 */ V(3, 3, 1) }; # endif static union huffpair const hufftab9[] = { /* 0000 */ PTR(16, 4), /* 0001 */ PTR(32, 3), /* 0010 */ PTR(40, 2), /* 0011 */ PTR(44, 2), /* 0100 */ PTR(48, 1), /* 0101 */ V(1, 2, 4), /* 0110 */ V(2, 1, 4), /* 0111 */ V(2, 0, 4), /* 1000 */ V(1, 1, 3), /* 1001 */ V(1, 1, 3), /* 1010 */ V(0, 1, 3), /* 1011 */ V(0, 1, 3), /* 1100 */ V(1, 0, 3), /* 1101 */ V(1, 0, 3), /* 1110 */ V(0, 0, 3), /* 1111 */ V(0, 0, 3), /* 0000 ... */ /* 0000 */ PTR(50, 1), /* 16 */ /* 0001 */ V(3, 5, 4), /* 0010 */ V(5, 3, 4), /* 0011 */ PTR(52, 1), /* 0100 */ V(4, 4, 4), /* 0101 */ V(2, 5, 4), /* 0110 */ V(5, 2, 4), /* 0111 */ V(1, 5, 4), /* 1000 */ V(5, 1, 3), /* 1001 */ V(5, 1, 3), /* 1010 */ V(3, 4, 3), /* 1011 */ V(3, 4, 3), /* 1100 */ V(4, 3, 3), /* 1101 */ V(4, 3, 3), /* 1110 */ V(5, 0, 4), /* 1111 */ V(0, 4, 4), /* 0001 ... */ /* 000 */ V(2, 4, 3), /* 32 */ /* 001 */ V(4, 2, 3), /* 010 */ V(3, 3, 3), /* 011 */ V(4, 0, 3), /* 100 */ V(1, 4, 2), /* 101 */ V(1, 4, 2), /* 110 */ V(4, 1, 2), /* 111 */ V(4, 1, 2), /* 0010 ... */ /* 00 */ V(2, 3, 2), /* 40 */ /* 01 */ V(3, 2, 2), /* 10 */ V(1, 3, 1), /* 11 */ V(1, 3, 1), /* 0011 ... */ /* 00 */ V(3, 1, 1), /* 44 */ /* 01 */ V(3, 1, 1), /* 10 */ V(0, 3, 2), /* 11 */ V(3, 0, 2), /* 0100 ... */ /* 0 */ V(2, 2, 1), /* 48 */ /* 1 */ V(0, 2, 1), /* 0000 0000 ... */ /* 0 */ V(5, 5, 1), /* 50 */ /* 1 */ V(4, 5, 1), /* 0000 0011 ... */ /* 0 */ V(5, 4, 1), /* 52 */ /* 1 */ V(0, 5, 1) }; static union huffpair const hufftab10[] = { /* 0000 */ PTR(16, 4), /* 0001 */ PTR(32, 4), /* 0010 */ PTR(48, 2), /* 0011 */ V(1, 1, 4), /* 0100 */ V(0, 1, 3), /* 0101 */ V(0, 1, 3), /* 0110 */ V(1, 0, 3), /* 0111 */ V(1, 0, 3), /* 1000 */ V(0, 0, 1), /* 1001 */ V(0, 0, 1), /* 1010 */ V(0, 0, 1), /* 1011 */ V(0, 0, 1), /* 1100 */ V(0, 0, 1), /* 1101 */ V(0, 0, 1), /* 1110 */ V(0, 0, 1), /* 1111 */ V(0, 0, 1), /* 0000 ... */ /* 0000 */ PTR(52, 3), /* 16 */ /* 0001 */ PTR(60, 2), /* 0010 */ PTR(64, 3), /* 0011 */ PTR(72, 1), /* 0100 */ PTR(74, 2), /* 0101 */ PTR(78, 2), /* 0110 */ PTR(82, 2), /* 0111 */ V(1, 7, 4), /* 1000 */ V(7, 1, 4), /* 1001 */ PTR(86, 1), /* 1010 */ PTR(88, 2), /* 1011 */ PTR(92, 2), /* 1100 */ V(1, 6, 4), /* 1101 */ V(6, 1, 4), /* 1110 */ V(6, 0, 4), /* 1111 */ PTR(96, 1), /* 0001 ... */ /* 0000 */ PTR(98, 1), /* 32 */ /* 0001 */ PTR(100, 1), /* 0010 */ V(1, 4, 4), /* 0011 */ V(4, 1, 4), /* 0100 */ V(4, 0, 4), /* 0101 */ V(2, 3, 4), /* 0110 */ V(3, 2, 4), /* 0111 */ V(0, 3, 4), /* 1000 */ V(1, 3, 3), /* 1001 */ V(1, 3, 3), /* 1010 */ V(3, 1, 3), /* 1011 */ V(3, 1, 3), /* 1100 */ V(3, 0, 3), /* 1101 */ V(3, 0, 3), /* 1110 */ V(2, 2, 3), /* 1111 */ V(2, 2, 3), /* 0010 ... */ /* 00 */ V(1, 2, 2), /* 48 */ /* 01 */ V(2, 1, 2), /* 10 */ V(0, 2, 2), /* 11 */ V(2, 0, 2), /* 0000 0000 ... */ /* 000 */ V(7, 7, 3), /* 52 */ /* 001 */ V(6, 7, 3), /* 010 */ V(7, 6, 3), /* 011 */ V(5, 7, 3), /* 100 */ V(7, 5, 3), /* 101 */ V(6, 6, 3), /* 110 */ V(4, 7, 2), /* 111 */ V(4, 7, 2), /* 0000 0001 ... */ /* 00 */ V(7, 4, 2), /* 60 */ /* 01 */ V(5, 6, 2), /* 10 */ V(6, 5, 2), /* 11 */ V(3, 7, 2), /* 0000 0010 ... */ /* 000 */ V(7, 3, 2), /* 64 */ /* 001 */ V(7, 3, 2), /* 010 */ V(4, 6, 2), /* 011 */ V(4, 6, 2), /* 100 */ V(5, 5, 3), /* 101 */ V(5, 4, 3), /* 110 */ V(6, 3, 2), /* 111 */ V(6, 3, 2), /* 0000 0011 ... */ /* 0 */ V(2, 7, 1), /* 72 */ /* 1 */ V(7, 2, 1), /* 0000 0100 ... */ /* 00 */ V(6, 4, 2), /* 74 */ /* 01 */ V(0, 7, 2), /* 10 */ V(7, 0, 1), /* 11 */ V(7, 0, 1), /* 0000 0101 ... */ /* 00 */ V(6, 2, 1), /* 78 */ /* 01 */ V(6, 2, 1), /* 10 */ V(4, 5, 2), /* 11 */ V(3, 5, 2), /* 0000 0110 ... */ /* 00 */ V(0, 6, 1), /* 82 */ /* 01 */ V(0, 6, 1), /* 10 */ V(5, 3, 2), /* 11 */ V(4, 4, 2), /* 0000 1001 ... */ /* 0 */ V(3, 6, 1), /* 86 */ /* 1 */ V(2, 6, 1), /* 0000 1010 ... */ /* 00 */ V(2, 5, 2), /* 88 */ /* 01 */ V(5, 2, 2), /* 10 */ V(1, 5, 1), /* 11 */ V(1, 5, 1), /* 0000 1011 ... */ /* 00 */ V(5, 1, 1), /* 92 */ /* 01 */ V(5, 1, 1), /* 10 */ V(3, 4, 2), /* 11 */ V(4, 3, 2), /* 0000 1111 ... */ /* 0 */ V(0, 5, 1), /* 96 */ /* 1 */ V(5, 0, 1), /* 0001 0000 ... */ /* 0 */ V(2, 4, 1), /* 98 */ /* 1 */ V(4, 2, 1), /* 0001 0001 ... */ /* 0 */ V(3, 3, 1), /* 100 */ /* 1 */ V(0, 4, 1) }; static union huffpair const hufftab11[] = { /* 0000 */ PTR(16, 4), /* 0001 */ PTR(32, 4), /* 0010 */ PTR(48, 4), /* 0011 */ PTR(64, 3), /* 0100 */ V(1, 2, 4), /* 0101 */ PTR(72, 1), /* 0110 */ V(1, 1, 3), /* 0111 */ V(1, 1, 3), /* 1000 */ V(0, 1, 3), /* 1001 */ V(0, 1, 3), /* 1010 */ V(1, 0, 3), /* 1011 */ V(1, 0, 3), /* 1100 */ V(0, 0, 2), /* 1101 */ V(0, 0, 2), /* 1110 */ V(0, 0, 2), /* 1111 */ V(0, 0, 2), /* 0000 ... */ /* 0000 */ PTR(74, 2), /* 16 */ /* 0001 */ PTR(78, 3), /* 0010 */ PTR(86, 2), /* 0011 */ PTR(90, 1), /* 0100 */ PTR(92, 2), /* 0101 */ V(2, 7, 4), /* 0110 */ V(7, 2, 4), /* 0111 */ PTR(96, 1), /* 1000 */ V(7, 1, 3), /* 1001 */ V(7, 1, 3), /* 1010 */ V(1, 7, 4), /* 1011 */ V(7, 0, 4), /* 1100 */ V(3, 6, 4), /* 1101 */ V(6, 3, 4), /* 1110 */ V(6, 0, 4), /* 1111 */ PTR(98, 1), /* 0001 ... */ /* 0000 */ PTR(100, 1), /* 32 */ /* 0001 */ V(1, 5, 4), /* 0010 */ V(6, 2, 3), /* 0011 */ V(6, 2, 3), /* 0100 */ V(2, 6, 4), /* 0101 */ V(0, 6, 4), /* 0110 */ V(1, 6, 3), /* 0111 */ V(1, 6, 3), /* 1000 */ V(6, 1, 3), /* 1001 */ V(6, 1, 3), /* 1010 */ V(5, 1, 4), /* 1011 */ V(3, 4, 4), /* 1100 */ V(5, 0, 4), /* 1101 */ PTR(102, 1), /* 1110 */ V(2, 4, 4), /* 1111 */ V(4, 2, 4), /* 0010 ... */ /* 0000 */ V(1, 4, 4), /* 48 */ /* 0001 */ V(4, 1, 4), /* 0010 */ V(0, 4, 4), /* 0011 */ V(4, 0, 4), /* 0100 */ V(2, 3, 3), /* 0101 */ V(2, 3, 3), /* 0110 */ V(3, 2, 3), /* 0111 */ V(3, 2, 3), /* 1000 */ V(1, 3, 2), /* 1001 */ V(1, 3, 2), /* 1010 */ V(1, 3, 2), /* 1011 */ V(1, 3, 2), /* 1100 */ V(3, 1, 2), /* 1101 */ V(3, 1, 2), /* 1110 */ V(3, 1, 2), /* 1111 */ V(3, 1, 2), /* 0011 ... */ /* 000 */ V(0, 3, 3), /* 64 */ /* 001 */ V(3, 0, 3), /* 010 */ V(2, 2, 2), /* 011 */ V(2, 2, 2), /* 100 */ V(2, 1, 1), /* 101 */ V(2, 1, 1), /* 110 */ V(2, 1, 1), /* 111 */ V(2, 1, 1), /* 0101 ... */ /* 0 */ V(0, 2, 1), /* 72 */ /* 1 */ V(2, 0, 1), /* 0000 0000 ... */ /* 00 */ V(7, 7, 2), /* 74 */ /* 01 */ V(6, 7, 2), /* 10 */ V(7, 6, 2), /* 11 */ V(7, 5, 2), /* 0000 0001 ... */ /* 000 */ V(6, 6, 2), /* 78 */ /* 001 */ V(6, 6, 2), /* 010 */ V(4, 7, 2), /* 011 */ V(4, 7, 2), /* 100 */ V(7, 4, 2), /* 101 */ V(7, 4, 2), /* 110 */ V(5, 7, 3), /* 111 */ V(5, 5, 3), /* 0000 0010 ... */ /* 00 */ V(5, 6, 2), /* 86 */ /* 01 */ V(6, 5, 2), /* 10 */ V(3, 7, 1), /* 11 */ V(3, 7, 1), /* 0000 0011 ... */ /* 0 */ V(7, 3, 1), /* 90 */ /* 1 */ V(4, 6, 1), /* 0000 0100 ... */ /* 00 */ V(4, 5, 2), /* 92 */ /* 01 */ V(5, 4, 2), /* 10 */ V(3, 5, 2), /* 11 */ V(5, 3, 2), /* 0000 0111 ... */ /* 0 */ V(6, 4, 1), /* 96 */ /* 1 */ V(0, 7, 1), /* 0000 1111 ... */ /* 0 */ V(4, 4, 1), /* 98 */ /* 1 */ V(2, 5, 1), /* 0001 0000 ... */ /* 0 */ V(5, 2, 1), /* 100 */ /* 1 */ V(0, 5, 1), /* 0001 1101 ... */ /* 0 */ V(4, 3, 1), /* 102 */ /* 1 */ V(3, 3, 1) }; static union huffpair const hufftab12[] = { /* 0000 */ PTR(16, 4), /* 0001 */ PTR(32, 4), /* 0010 */ PTR(48, 4), /* 0011 */ PTR(64, 2), /* 0100 */ PTR(68, 3), /* 0101 */ PTR(76, 1), /* 0110 */ V(1, 2, 4), /* 0111 */ V(2, 1, 4), /* 1000 */ PTR(78, 1), /* 1001 */ V(0, 0, 4), /* 1010 */ V(1, 1, 3), /* 1011 */ V(1, 1, 3), /* 1100 */ V(0, 1, 3), /* 1101 */ V(0, 1, 3), /* 1110 */ V(1, 0, 3), /* 1111 */ V(1, 0, 3), /* 0000 ... */ /* 0000 */ PTR(80, 2), /* 16 */ /* 0001 */ PTR(84, 1), /* 0010 */ PTR(86, 1), /* 0011 */ PTR(88, 1), /* 0100 */ V(5, 6, 4), /* 0101 */ V(3, 7, 4), /* 0110 */ PTR(90, 1), /* 0111 */ V(2, 7, 4), /* 1000 */ V(7, 2, 4), /* 1001 */ V(4, 6, 4), /* 1010 */ V(6, 4, 4), /* 1011 */ V(1, 7, 4), /* 1100 */ V(7, 1, 4), /* 1101 */ PTR(92, 1), /* 1110 */ V(3, 6, 4), /* 1111 */ V(6, 3, 4), /* 0001 ... */ /* 0000 */ V(4, 5, 4), /* 32 */ /* 0001 */ V(5, 4, 4), /* 0010 */ V(4, 4, 4), /* 0011 */ PTR(94, 1), /* 0100 */ V(2, 6, 3), /* 0101 */ V(2, 6, 3), /* 0110 */ V(6, 2, 3), /* 0111 */ V(6, 2, 3), /* 1000 */ V(6, 1, 3), /* 1001 */ V(6, 1, 3), /* 1010 */ V(1, 6, 4), /* 1011 */ V(6, 0, 4), /* 1100 */ V(3, 5, 4), /* 1101 */ V(5, 3, 4), /* 1110 */ V(2, 5, 4), /* 1111 */ V(5, 2, 4), /* 0010 ... */ /* 0000 */ V(1, 5, 3), /* 48 */ /* 0001 */ V(1, 5, 3), /* 0010 */ V(5, 1, 3), /* 0011 */ V(5, 1, 3), /* 0100 */ V(3, 4, 3), /* 0101 */ V(3, 4, 3), /* 0110 */ V(4, 3, 3), /* 0111 */ V(4, 3, 3), /* 1000 */ V(5, 0, 4), /* 1001 */ V(0, 4, 4), /* 1010 */ V(2, 4, 3), /* 1011 */ V(2, 4, 3), /* 1100 */ V(4, 2, 3), /* 1101 */ V(4, 2, 3), /* 1110 */ V(1, 4, 3), /* 1111 */ V(1, 4, 3), /* 0011 ... */ /* 00 */ V(3, 3, 2), /* 64 */ /* 01 */ V(4, 1, 2), /* 10 */ V(2, 3, 2), /* 11 */ V(3, 2, 2), /* 0100 ... */ /* 000 */ V(4, 0, 3), /* 68 */ /* 001 */ V(0, 3, 3), /* 010 */ V(3, 0, 2), /* 011 */ V(3, 0, 2), /* 100 */ V(1, 3, 1), /* 101 */ V(1, 3, 1), /* 110 */ V(1, 3, 1), /* 111 */ V(1, 3, 1), /* 0101 ... */ /* 0 */ V(3, 1, 1), /* 76 */ /* 1 */ V(2, 2, 1), /* 1000 ... */ /* 0 */ V(0, 2, 1), /* 78 */ /* 1 */ V(2, 0, 1), /* 0000 0000 ... */ /* 00 */ V(7, 7, 2), /* 80 */ /* 01 */ V(6, 7, 2), /* 10 */ V(7, 6, 1), /* 11 */ V(7, 6, 1), /* 0000 0001 ... */ /* 0 */ V(5, 7, 1), /* 84 */ /* 1 */ V(7, 5, 1), /* 0000 0010 ... */ /* 0 */ V(6, 6, 1), /* 86 */ /* 1 */ V(4, 7, 1), /* 0000 0011 ... */ /* 0 */ V(7, 4, 1), /* 88 */ /* 1 */ V(6, 5, 1), /* 0000 0110 ... */ /* 0 */ V(7, 3, 1), /* 90 */ /* 1 */ V(5, 5, 1), /* 0000 1101 ... */ /* 0 */ V(0, 7, 1), /* 92 */ /* 1 */ V(7, 0, 1), /* 0001 0011 ... */ /* 0 */ V(0, 6, 1), /* 94 */ /* 1 */ V(0, 5, 1) }; static union huffpair const hufftab13[] = { /* 0000 */ PTR(16, 4), /* 0001 */ PTR(32, 4), /* 0010 */ PTR(48, 4), /* 0011 */ PTR(64, 2), /* 0100 */ V(1, 1, 4), /* 0101 */ V(0, 1, 4), /* 0110 */ V(1, 0, 3), /* 0111 */ V(1, 0, 3), /* 1000 */ V(0, 0, 1), /* 1001 */ V(0, 0, 1), /* 1010 */ V(0, 0, 1), /* 1011 */ V(0, 0, 1), /* 1100 */ V(0, 0, 1), /* 1101 */ V(0, 0, 1), /* 1110 */ V(0, 0, 1), /* 1111 */ V(0, 0, 1), /* 0000 ... */ /* 0000 */ PTR(68, 4), /* 16 */ /* 0001 */ PTR(84, 4), /* 0010 */ PTR(100, 4), /* 0011 */ PTR(116, 4), /* 0100 */ PTR(132, 4), /* 0101 */ PTR(148, 4), /* 0110 */ PTR(164, 3), /* 0111 */ PTR(172, 3), /* 1000 */ PTR(180, 3), /* 1001 */ PTR(188, 3), /* 1010 */ PTR(196, 3), /* 1011 */ PTR(204, 3), /* 1100 */ PTR(212, 1), /* 1101 */ PTR(214, 2), /* 1110 */ PTR(218, 3), /* 1111 */ PTR(226, 1), /* 0001 ... */ /* 0000 */ PTR(228, 2), /* 32 */ /* 0001 */ PTR(232, 2), /* 0010 */ PTR(236, 2), /* 0011 */ PTR(240, 2), /* 0100 */ V(8, 1, 4), /* 0101 */ PTR(244, 1), /* 0110 */ PTR(246, 1), /* 0111 */ PTR(248, 1), /* 1000 */ PTR(250, 2), /* 1001 */ PTR(254, 1), /* 1010 */ V(1, 5, 4), /* 1011 */ V(5, 1, 4), /* 1100 */ PTR(256, 1), /* 1101 */ PTR(258, 1), /* 1110 */ PTR(260, 1), /* 1111 */ V(1, 4, 4), /* 0010 ... */ /* 0000 */ V(4, 1, 3), /* 48 */ /* 0001 */ V(4, 1, 3), /* 0010 */ V(0, 4, 4), /* 0011 */ V(4, 0, 4), /* 0100 */ V(2, 3, 4), /* 0101 */ V(3, 2, 4), /* 0110 */ V(1, 3, 3), /* 0111 */ V(1, 3, 3), /* 1000 */ V(3, 1, 3), /* 1001 */ V(3, 1, 3), /* 1010 */ V(0, 3, 3), /* 1011 */ V(0, 3, 3), /* 1100 */ V(3, 0, 3), /* 1101 */ V(3, 0, 3), /* 1110 */ V(2, 2, 3), /* 1111 */ V(2, 2, 3), /* 0011 ... */ /* 00 */ V(1, 2, 2), /* 64 */ /* 01 */ V(2, 1, 2), /* 10 */ V(0, 2, 2), /* 11 */ V(2, 0, 2), /* 0000 0000 ... */ /* 0000 */ PTR(262, 4), /* 68 */ /* 0001 */ PTR(278, 4), /* 0010 */ PTR(294, 4), /* 0011 */ PTR(310, 3), /* 0100 */ PTR(318, 2), /* 0101 */ PTR(322, 2), /* 0110 */ PTR(326, 3), /* 0111 */ PTR(334, 2), /* 1000 */ PTR(338, 1), /* 1001 */ PTR(340, 2), /* 1010 */ PTR(344, 2), /* 1011 */ PTR(348, 2), /* 1100 */ PTR(352, 2), /* 1101 */ PTR(356, 2), /* 1110 */ V(1, 15, 4), /* 1111 */ V(15, 1, 4), /* 0000 0001 ... */ /* 0000 */ V(15, 0, 4), /* 84 */ /* 0001 */ PTR(360, 1), /* 0010 */ PTR(362, 1), /* 0011 */ PTR(364, 1), /* 0100 */ V(14, 2, 4), /* 0101 */ PTR(366, 1), /* 0110 */ V(1, 14, 4), /* 0111 */ V(14, 1, 4), /* 1000 */ PTR(368, 1), /* 1001 */ PTR(370, 1), /* 1010 */ PTR(372, 1), /* 1011 */ PTR(374, 1), /* 1100 */ PTR(376, 1), /* 1101 */ PTR(378, 1), /* 1110 */ V(12, 6, 4), /* 1111 */ V(3, 13, 4), /* 0000 0010 ... */ /* 0000 */ PTR(380, 1), /* 100 */ /* 0001 */ V(2, 13, 4), /* 0010 */ V(13, 2, 4), /* 0011 */ V(1, 13, 4), /* 0100 */ V(11, 7, 4), /* 0101 */ PTR(382, 1), /* 0110 */ PTR(384, 1), /* 0111 */ V(12, 3, 4), /* 1000 */ PTR(386, 1), /* 1001 */ V(4, 11, 4), /* 1010 */ V(13, 1, 3), /* 1011 */ V(13, 1, 3), /* 1100 */ V(0, 13, 4), /* 1101 */ V(13, 0, 4), /* 1110 */ V(8, 10, 4), /* 1111 */ V(10, 8, 4), /* 0000 0011 ... */ /* 0000 */ V(4, 12, 4), /* 116 */ /* 0001 */ V(12, 4, 4), /* 0010 */ V(6, 11, 4), /* 0011 */ V(11, 6, 4), /* 0100 */ V(3, 12, 3), /* 0101 */ V(3, 12, 3), /* 0110 */ V(2, 12, 3), /* 0111 */ V(2, 12, 3), /* 1000 */ V(12, 2, 3), /* 1001 */ V(12, 2, 3), /* 1010 */ V(5, 11, 3), /* 1011 */ V(5, 11, 3), /* 1100 */ V(11, 5, 4), /* 1101 */ V(8, 9, 4), /* 1110 */ V(1, 12, 3), /* 1111 */ V(1, 12, 3), /* 0000 0100 ... */ /* 0000 */ V(12, 1, 3), /* 132 */ /* 0001 */ V(12, 1, 3), /* 0010 */ V(9, 8, 4), /* 0011 */ V(0, 12, 4), /* 0100 */ V(12, 0, 3), /* 0101 */ V(12, 0, 3), /* 0110 */ V(11, 4, 4), /* 0111 */ V(6, 10, 4), /* 1000 */ V(10, 6, 4), /* 1001 */ V(7, 9, 4), /* 1010 */ V(3, 11, 3), /* 1011 */ V(3, 11, 3), /* 1100 */ V(11, 3, 3), /* 1101 */ V(11, 3, 3), /* 1110 */ V(8, 8, 4), /* 1111 */ V(5, 10, 4), /* 0000 0101 ... */ /* 0000 */ V(2, 11, 3), /* 148 */ /* 0001 */ V(2, 11, 3), /* 0010 */ V(10, 5, 4), /* 0011 */ V(6, 9, 4), /* 0100 */ V(10, 4, 3), /* 0101 */ V(10, 4, 3), /* 0110 */ V(7, 8, 4), /* 0111 */ V(8, 7, 4), /* 1000 */ V(9, 4, 3), /* 1001 */ V(9, 4, 3), /* 1010 */ V(7, 7, 4), /* 1011 */ V(7, 6, 4), /* 1100 */ V(11, 2, 2), /* 1101 */ V(11, 2, 2), /* 1110 */ V(11, 2, 2), /* 1111 */ V(11, 2, 2), /* 0000 0110 ... */ /* 000 */ V(1, 11, 2), /* 164 */ /* 001 */ V(1, 11, 2), /* 010 */ V(11, 1, 2), /* 011 */ V(11, 1, 2), /* 100 */ V(0, 11, 3), /* 101 */ V(11, 0, 3), /* 110 */ V(9, 6, 3), /* 111 */ V(4, 10, 3), /* 0000 0111 ... */ /* 000 */ V(3, 10, 3), /* 172 */ /* 001 */ V(10, 3, 3), /* 010 */ V(5, 9, 3), /* 011 */ V(9, 5, 3), /* 100 */ V(2, 10, 2), /* 101 */ V(2, 10, 2), /* 110 */ V(10, 2, 2), /* 111 */ V(10, 2, 2), /* 0000 1000 ... */ /* 000 */ V(1, 10, 2), /* 180 */ /* 001 */ V(1, 10, 2), /* 010 */ V(10, 1, 2), /* 011 */ V(10, 1, 2), /* 100 */ V(0, 10, 3), /* 101 */ V(6, 8, 3), /* 110 */ V(10, 0, 2), /* 111 */ V(10, 0, 2), /* 0000 1001 ... */ /* 000 */ V(8, 6, 3), /* 188 */ /* 001 */ V(4, 9, 3), /* 010 */ V(9, 3, 2), /* 011 */ V(9, 3, 2), /* 100 */ V(3, 9, 3), /* 101 */ V(5, 8, 3), /* 110 */ V(8, 5, 3), /* 111 */ V(6, 7, 3), /* 0000 1010 ... */ /* 000 */ V(2, 9, 2), /* 196 */ /* 001 */ V(2, 9, 2), /* 010 */ V(9, 2, 2), /* 011 */ V(9, 2, 2), /* 100 */ V(5, 7, 3), /* 101 */ V(7, 5, 3), /* 110 */ V(3, 8, 2), /* 111 */ V(3, 8, 2), /* 0000 1011 ... */ /* 000 */ V(8, 3, 2), /* 204 */ /* 001 */ V(8, 3, 2), /* 010 */ V(6, 6, 3), /* 011 */ V(4, 7, 3), /* 100 */ V(7, 4, 3), /* 101 */ V(5, 6, 3), /* 110 */ V(6, 5, 3), /* 111 */ V(7, 3, 3), /* 0000 1100 ... */ /* 0 */ V(1, 9, 1), /* 212 */ /* 1 */ V(9, 1, 1), /* 0000 1101 ... */ /* 00 */ V(0, 9, 2), /* 214 */ /* 01 */ V(9, 0, 2), /* 10 */ V(4, 8, 2), /* 11 */ V(8, 4, 2), /* 0000 1110 ... */ /* 000 */ V(7, 2, 2), /* 218 */ /* 001 */ V(7, 2, 2), /* 010 */ V(4, 6, 3), /* 011 */ V(6, 4, 3), /* 100 */ V(2, 8, 1), /* 101 */ V(2, 8, 1), /* 110 */ V(2, 8, 1), /* 111 */ V(2, 8, 1), /* 0000 1111 ... */ /* 0 */ V(8, 2, 1), /* 226 */ /* 1 */ V(1, 8, 1), /* 0001 0000 ... */ /* 00 */ V(3, 7, 2), /* 228 */ /* 01 */ V(2, 7, 2), /* 10 */ V(1, 7, 1), /* 11 */ V(1, 7, 1), /* 0001 0001 ... */ /* 00 */ V(7, 1, 1), /* 232 */ /* 01 */ V(7, 1, 1), /* 10 */ V(5, 5, 2), /* 11 */ V(0, 7, 2), /* 0001 0010 ... */ /* 00 */ V(7, 0, 2), /* 236 */ /* 01 */ V(3, 6, 2), /* 10 */ V(6, 3, 2), /* 11 */ V(4, 5, 2), /* 0001 0011 ... */ /* 00 */ V(5, 4, 2), /* 240 */ /* 01 */ V(2, 6, 2), /* 10 */ V(6, 2, 2), /* 11 */ V(3, 5, 2), /* 0001 0101 ... */ /* 0 */ V(0, 8, 1), /* 244 */ /* 1 */ V(8, 0, 1), /* 0001 0110 ... */ /* 0 */ V(1, 6, 1), /* 246 */ /* 1 */ V(6, 1, 1), /* 0001 0111 ... */ /* 0 */ V(0, 6, 1), /* 248 */ /* 1 */ V(6, 0, 1), /* 0001 1000 ... */ /* 00 */ V(5, 3, 2), /* 250 */ /* 01 */ V(4, 4, 2), /* 10 */ V(2, 5, 1), /* 11 */ V(2, 5, 1), /* 0001 1001 ... */ /* 0 */ V(5, 2, 1), /* 254 */ /* 1 */ V(0, 5, 1), /* 0001 1100 ... */ /* 0 */ V(3, 4, 1), /* 256 */ /* 1 */ V(4, 3, 1), /* 0001 1101 ... */ /* 0 */ V(5, 0, 1), /* 258 */ /* 1 */ V(2, 4, 1), /* 0001 1110 ... */ /* 0 */ V(4, 2, 1), /* 260 */ /* 1 */ V(3, 3, 1), /* 0000 0000 0000 ... */ /* 0000 */ PTR(388, 3), /* 262 */ /* 0001 */ V(15, 15, 4), /* 0010 */ V(14, 15, 4), /* 0011 */ V(13, 15, 4), /* 0100 */ V(14, 14, 4), /* 0101 */ V(12, 15, 4), /* 0110 */ V(13, 14, 4), /* 0111 */ V(11, 15, 4), /* 1000 */ V(15, 11, 4), /* 1001 */ V(12, 14, 4), /* 1010 */ V(13, 12, 4), /* 1011 */ PTR(396, 1), /* 1100 */ V(14, 12, 3), /* 1101 */ V(14, 12, 3), /* 1110 */ V(13, 13, 3), /* 1111 */ V(13, 13, 3), /* 0000 0000 0001 ... */ /* 0000 */ V(15, 10, 4), /* 278 */ /* 0001 */ V(12, 13, 4), /* 0010 */ V(11, 14, 3), /* 0011 */ V(11, 14, 3), /* 0100 */ V(14, 11, 3), /* 0101 */ V(14, 11, 3), /* 0110 */ V(9, 15, 3), /* 0111 */ V(9, 15, 3), /* 1000 */ V(15, 9, 3), /* 1001 */ V(15, 9, 3), /* 1010 */ V(14, 10, 3), /* 1011 */ V(14, 10, 3), /* 1100 */ V(11, 13, 3), /* 1101 */ V(11, 13, 3), /* 1110 */ V(13, 11, 3), /* 1111 */ V(13, 11, 3), /* 0000 0000 0010 ... */ /* 0000 */ V(8, 15, 3), /* 294 */ /* 0001 */ V(8, 15, 3), /* 0010 */ V(15, 8, 3), /* 0011 */ V(15, 8, 3), /* 0100 */ V(12, 12, 3), /* 0101 */ V(12, 12, 3), /* 0110 */ V(10, 14, 4), /* 0111 */ V(9, 14, 4), /* 1000 */ V(8, 14, 3), /* 1001 */ V(8, 14, 3), /* 1010 */ V(7, 15, 4), /* 1011 */ V(7, 14, 4), /* 1100 */ V(15, 7, 2), /* 1101 */ V(15, 7, 2), /* 1110 */ V(15, 7, 2), /* 1111 */ V(15, 7, 2), /* 0000 0000 0011 ... */ /* 000 */ V(13, 10, 2), /* 310 */ /* 001 */ V(13, 10, 2), /* 010 */ V(10, 13, 3), /* 011 */ V(11, 12, 3), /* 100 */ V(12, 11, 3), /* 101 */ V(15, 6, 3), /* 110 */ V(6, 15, 2), /* 111 */ V(6, 15, 2), /* 0000 0000 0100 ... */ /* 00 */ V(14, 8, 2), /* 318 */ /* 01 */ V(5, 15, 2), /* 10 */ V(9, 13, 2), /* 11 */ V(13, 9, 2), /* 0000 0000 0101 ... */ /* 00 */ V(15, 5, 2), /* 322 */ /* 01 */ V(14, 7, 2), /* 10 */ V(10, 12, 2), /* 11 */ V(11, 11, 2), /* 0000 0000 0110 ... */ /* 000 */ V(4, 15, 2), /* 326 */ /* 001 */ V(4, 15, 2), /* 010 */ V(15, 4, 2), /* 011 */ V(15, 4, 2), /* 100 */ V(12, 10, 3), /* 101 */ V(14, 6, 3), /* 110 */ V(15, 3, 2), /* 111 */ V(15, 3, 2), /* 0000 0000 0111 ... */ /* 00 */ V(3, 15, 1), /* 334 */ /* 01 */ V(3, 15, 1), /* 10 */ V(8, 13, 2), /* 11 */ V(13, 8, 2), /* 0000 0000 1000 ... */ /* 0 */ V(2, 15, 1), /* 338 */ /* 1 */ V(15, 2, 1), /* 0000 0000 1001 ... */ /* 00 */ V(6, 14, 2), /* 340 */ /* 01 */ V(9, 12, 2), /* 10 */ V(0, 15, 1), /* 11 */ V(0, 15, 1), /* 0000 0000 1010 ... */ /* 00 */ V(12, 9, 2), /* 344 */ /* 01 */ V(5, 14, 2), /* 10 */ V(10, 11, 1), /* 11 */ V(10, 11, 1), /* 0000 0000 1011 ... */ /* 00 */ V(7, 13, 2), /* 348 */ /* 01 */ V(13, 7, 2), /* 10 */ V(4, 14, 1), /* 11 */ V(4, 14, 1), /* 0000 0000 1100 ... */ /* 00 */ V(12, 8, 2), /* 352 */ /* 01 */ V(13, 6, 2), /* 10 */ V(3, 14, 1), /* 11 */ V(3, 14, 1), /* 0000 0000 1101 ... */ /* 00 */ V(11, 9, 1), /* 356 */ /* 01 */ V(11, 9, 1), /* 10 */ V(9, 11, 2), /* 11 */ V(10, 10, 2), /* 0000 0001 0001 ... */ /* 0 */ V(11, 10, 1), /* 360 */ /* 1 */ V(14, 5, 1), /* 0000 0001 0010 ... */ /* 0 */ V(14, 4, 1), /* 362 */ /* 1 */ V(8, 12, 1), /* 0000 0001 0011 ... */ /* 0 */ V(6, 13, 1), /* 364 */ /* 1 */ V(14, 3, 1), /* 0000 0001 0101 ... */ /* 0 */ V(2, 14, 1), /* 366 */ /* 1 */ V(0, 14, 1), /* 0000 0001 1000 ... */ /* 0 */ V(14, 0, 1), /* 368 */ /* 1 */ V(5, 13, 1), /* 0000 0001 1001 ... */ /* 0 */ V(13, 5, 1), /* 370 */ /* 1 */ V(7, 12, 1), /* 0000 0001 1010 ... */ /* 0 */ V(12, 7, 1), /* 372 */ /* 1 */ V(4, 13, 1), /* 0000 0001 1011 ... */ /* 0 */ V(8, 11, 1), /* 374 */ /* 1 */ V(11, 8, 1), /* 0000 0001 1100 ... */ /* 0 */ V(13, 4, 1), /* 376 */ /* 1 */ V(9, 10, 1), /* 0000 0001 1101 ... */ /* 0 */ V(10, 9, 1), /* 378 */ /* 1 */ V(6, 12, 1), /* 0000 0010 0000 ... */ /* 0 */ V(13, 3, 1), /* 380 */ /* 1 */ V(7, 11, 1), /* 0000 0010 0101 ... */ /* 0 */ V(5, 12, 1), /* 382 */ /* 1 */ V(12, 5, 1), /* 0000 0010 0110 ... */ /* 0 */ V(9, 9, 1), /* 384 */ /* 1 */ V(7, 10, 1), /* 0000 0010 1000 ... */ /* 0 */ V(10, 7, 1), /* 386 */ /* 1 */ V(9, 7, 1), /* 0000 0000 0000 0000 ... */ /* 000 */ V(15, 14, 3), /* 388 */ /* 001 */ V(15, 12, 3), /* 010 */ V(15, 13, 2), /* 011 */ V(15, 13, 2), /* 100 */ V(14, 13, 1), /* 101 */ V(14, 13, 1), /* 110 */ V(14, 13, 1), /* 111 */ V(14, 13, 1), /* 0000 0000 0000 1011 ... */ /* 0 */ V(10, 15, 1), /* 396 */ /* 1 */ V(14, 9, 1) }; static union huffpair const hufftab15[] = { /* 0000 */ PTR(16, 4), /* 0001 */ PTR(32, 4), /* 0010 */ PTR(48, 4), /* 0011 */ PTR(64, 4), /* 0100 */ PTR(80, 4), /* 0101 */ PTR(96, 3), /* 0110 */ PTR(104, 3), /* 0111 */ PTR(112, 2), /* 1000 */ PTR(116, 1), /* 1001 */ PTR(118, 1), /* 1010 */ V(1, 1, 3), /* 1011 */ V(1, 1, 3), /* 1100 */ V(0, 1, 4), /* 1101 */ V(1, 0, 4), /* 1110 */ V(0, 0, 3), /* 1111 */ V(0, 0, 3), /* 0000 ... */ /* 0000 */ PTR(120, 4), /* 16 */ /* 0001 */ PTR(136, 4), /* 0010 */ PTR(152, 4), /* 0011 */ PTR(168, 4), /* 0100 */ PTR(184, 4), /* 0101 */ PTR(200, 3), /* 0110 */ PTR(208, 3), /* 0111 */ PTR(216, 4), /* 1000 */ PTR(232, 3), /* 1001 */ PTR(240, 3), /* 1010 */ PTR(248, 3), /* 1011 */ PTR(256, 3), /* 1100 */ PTR(264, 2), /* 1101 */ PTR(268, 3), /* 1110 */ PTR(276, 3), /* 1111 */ PTR(284, 2), /* 0001 ... */ /* 0000 */ PTR(288, 2), /* 32 */ /* 0001 */ PTR(292, 2), /* 0010 */ PTR(296, 2), /* 0011 */ PTR(300, 2), /* 0100 */ PTR(304, 2), /* 0101 */ PTR(308, 2), /* 0110 */ PTR(312, 2), /* 0111 */ PTR(316, 2), /* 1000 */ PTR(320, 1), /* 1001 */ PTR(322, 1), /* 1010 */ PTR(324, 1), /* 1011 */ PTR(326, 2), /* 1100 */ PTR(330, 1), /* 1101 */ PTR(332, 1), /* 1110 */ PTR(334, 2), /* 1111 */ PTR(338, 1), /* 0010 ... */ /* 0000 */ PTR(340, 1), /* 48 */ /* 0001 */ PTR(342, 1), /* 0010 */ V(9, 1, 4), /* 0011 */ PTR(344, 1), /* 0100 */ PTR(346, 1), /* 0101 */ PTR(348, 1), /* 0110 */ PTR(350, 1), /* 0111 */ PTR(352, 1), /* 1000 */ V(2, 8, 4), /* 1001 */ V(8, 2, 4), /* 1010 */ V(1, 8, 4), /* 1011 */ V(8, 1, 4), /* 1100 */ PTR(354, 1), /* 1101 */ PTR(356, 1), /* 1110 */ PTR(358, 1), /* 1111 */ PTR(360, 1), /* 0011 ... */ /* 0000 */ V(2, 7, 4), /* 64 */ /* 0001 */ V(7, 2, 4), /* 0010 */ V(6, 4, 4), /* 0011 */ V(1, 7, 4), /* 0100 */ V(5, 5, 4), /* 0101 */ V(7, 1, 4), /* 0110 */ PTR(362, 1), /* 0111 */ V(3, 6, 4), /* 1000 */ V(6, 3, 4), /* 1001 */ V(4, 5, 4), /* 1010 */ V(5, 4, 4), /* 1011 */ V(2, 6, 4), /* 1100 */ V(6, 2, 4), /* 1101 */ V(1, 6, 4), /* 1110 */ PTR(364, 1), /* 1111 */ V(3, 5, 4), /* 0100 ... */ /* 0000 */ V(6, 1, 3), /* 80 */ /* 0001 */ V(6, 1, 3), /* 0010 */ V(5, 3, 4), /* 0011 */ V(4, 4, 4), /* 0100 */ V(2, 5, 3), /* 0101 */ V(2, 5, 3), /* 0110 */ V(5, 2, 3), /* 0111 */ V(5, 2, 3), /* 1000 */ V(1, 5, 3), /* 1001 */ V(1, 5, 3), /* 1010 */ V(5, 1, 3), /* 1011 */ V(5, 1, 3), /* 1100 */ V(0, 5, 4), /* 1101 */ V(5, 0, 4), /* 1110 */ V(3, 4, 3), /* 1111 */ V(3, 4, 3), /* 0101 ... */ /* 000 */ V(4, 3, 3), /* 96 */ /* 001 */ V(2, 4, 3), /* 010 */ V(4, 2, 3), /* 011 */ V(3, 3, 3), /* 100 */ V(4, 1, 2), /* 101 */ V(4, 1, 2), /* 110 */ V(1, 4, 3), /* 111 */ V(0, 4, 3), /* 0110 ... */ /* 000 */ V(2, 3, 2), /* 104 */ /* 001 */ V(2, 3, 2), /* 010 */ V(3, 2, 2), /* 011 */ V(3, 2, 2), /* 100 */ V(4, 0, 3), /* 101 */ V(0, 3, 3), /* 110 */ V(1, 3, 2), /* 111 */ V(1, 3, 2), /* 0111 ... */ /* 00 */ V(3, 1, 2), /* 112 */ /* 01 */ V(3, 0, 2), /* 10 */ V(2, 2, 1), /* 11 */ V(2, 2, 1), /* 1000 ... */ /* 0 */ V(1, 2, 1), /* 116 */ /* 1 */ V(2, 1, 1), /* 1001 ... */ /* 0 */ V(0, 2, 1), /* 118 */ /* 1 */ V(2, 0, 1), /* 0000 0000 ... */ /* 0000 */ PTR(366, 1), /* 120 */ /* 0001 */ PTR(368, 1), /* 0010 */ V(14, 14, 4), /* 0011 */ PTR(370, 1), /* 0100 */ PTR(372, 1), /* 0101 */ PTR(374, 1), /* 0110 */ V(15, 11, 4), /* 0111 */ PTR(376, 1), /* 1000 */ V(13, 13, 4), /* 1001 */ V(10, 15, 4), /* 1010 */ V(15, 10, 4), /* 1011 */ V(11, 14, 4), /* 1100 */ V(14, 11, 4), /* 1101 */ V(12, 13, 4), /* 1110 */ V(13, 12, 4), /* 1111 */ V(9, 15, 4), /* 0000 0001 ... */ /* 0000 */ V(15, 9, 4), /* 136 */ /* 0001 */ V(14, 10, 4), /* 0010 */ V(11, 13, 4), /* 0011 */ V(13, 11, 4), /* 0100 */ V(8, 15, 4), /* 0101 */ V(15, 8, 4), /* 0110 */ V(12, 12, 4), /* 0111 */ V(9, 14, 4), /* 1000 */ V(14, 9, 4), /* 1001 */ V(7, 15, 4), /* 1010 */ V(15, 7, 4), /* 1011 */ V(10, 13, 4), /* 1100 */ V(13, 10, 4), /* 1101 */ V(11, 12, 4), /* 1110 */ V(6, 15, 4), /* 1111 */ PTR(378, 1), /* 0000 0010 ... */ /* 0000 */ V(12, 11, 3), /* 152 */ /* 0001 */ V(12, 11, 3), /* 0010 */ V(15, 6, 3), /* 0011 */ V(15, 6, 3), /* 0100 */ V(8, 14, 4), /* 0101 */ V(14, 8, 4), /* 0110 */ V(5, 15, 4), /* 0111 */ V(9, 13, 4), /* 1000 */ V(15, 5, 3), /* 1001 */ V(15, 5, 3), /* 1010 */ V(7, 14, 3), /* 1011 */ V(7, 14, 3), /* 1100 */ V(14, 7, 3), /* 1101 */ V(14, 7, 3), /* 1110 */ V(10, 12, 3), /* 1111 */ V(10, 12, 3), /* 0000 0011 ... */ /* 0000 */ V(12, 10, 3), /* 168 */ /* 0001 */ V(12, 10, 3), /* 0010 */ V(11, 11, 3), /* 0011 */ V(11, 11, 3), /* 0100 */ V(13, 9, 4), /* 0101 */ V(8, 13, 4), /* 0110 */ V(4, 15, 3), /* 0111 */ V(4, 15, 3), /* 1000 */ V(15, 4, 3), /* 1001 */ V(15, 4, 3), /* 1010 */ V(3, 15, 3), /* 1011 */ V(3, 15, 3), /* 1100 */ V(15, 3, 3), /* 1101 */ V(15, 3, 3), /* 1110 */ V(13, 8, 3), /* 1111 */ V(13, 8, 3), /* 0000 0100 ... */ /* 0000 */ V(14, 6, 3), /* 184 */ /* 0001 */ V(14, 6, 3), /* 0010 */ V(2, 15, 3), /* 0011 */ V(2, 15, 3), /* 0100 */ V(15, 2, 3), /* 0101 */ V(15, 2, 3), /* 0110 */ V(6, 14, 4), /* 0111 */ V(15, 0, 4), /* 1000 */ V(1, 15, 3), /* 1001 */ V(1, 15, 3), /* 1010 */ V(15, 1, 3), /* 1011 */ V(15, 1, 3), /* 1100 */ V(9, 12, 3), /* 1101 */ V(9, 12, 3), /* 1110 */ V(12, 9, 3), /* 1111 */ V(12, 9, 3), /* 0000 0101 ... */ /* 000 */ V(5, 14, 3), /* 200 */ /* 001 */ V(10, 11, 3), /* 010 */ V(11, 10, 3), /* 011 */ V(14, 5, 3), /* 100 */ V(7, 13, 3), /* 101 */ V(13, 7, 3), /* 110 */ V(4, 14, 3), /* 111 */ V(14, 4, 3), /* 0000 0110 ... */ /* 000 */ V(8, 12, 3), /* 208 */ /* 001 */ V(12, 8, 3), /* 010 */ V(3, 14, 3), /* 011 */ V(6, 13, 3), /* 100 */ V(13, 6, 3), /* 101 */ V(14, 3, 3), /* 110 */ V(9, 11, 3), /* 111 */ V(11, 9, 3), /* 0000 0111 ... */ /* 0000 */ V(2, 14, 3), /* 216 */ /* 0001 */ V(2, 14, 3), /* 0010 */ V(10, 10, 3), /* 0011 */ V(10, 10, 3), /* 0100 */ V(14, 2, 3), /* 0101 */ V(14, 2, 3), /* 0110 */ V(1, 14, 3), /* 0111 */ V(1, 14, 3), /* 1000 */ V(14, 1, 3), /* 1001 */ V(14, 1, 3), /* 1010 */ V(0, 14, 4), /* 1011 */ V(14, 0, 4), /* 1100 */ V(5, 13, 3), /* 1101 */ V(5, 13, 3), /* 1110 */ V(13, 5, 3), /* 1111 */ V(13, 5, 3), /* 0000 1000 ... */ /* 000 */ V(7, 12, 3), /* 232 */ /* 001 */ V(12, 7, 3), /* 010 */ V(4, 13, 3), /* 011 */ V(8, 11, 3), /* 100 */ V(13, 4, 2), /* 101 */ V(13, 4, 2), /* 110 */ V(11, 8, 3), /* 111 */ V(9, 10, 3), /* 0000 1001 ... */ /* 000 */ V(10, 9, 3), /* 240 */ /* 001 */ V(6, 12, 3), /* 010 */ V(12, 6, 3), /* 011 */ V(3, 13, 3), /* 100 */ V(13, 3, 2), /* 101 */ V(13, 3, 2), /* 110 */ V(13, 2, 2), /* 111 */ V(13, 2, 2), /* 0000 1010 ... */ /* 000 */ V(2, 13, 3), /* 248 */ /* 001 */ V(0, 13, 3), /* 010 */ V(1, 13, 2), /* 011 */ V(1, 13, 2), /* 100 */ V(7, 11, 2), /* 101 */ V(7, 11, 2), /* 110 */ V(11, 7, 2), /* 111 */ V(11, 7, 2), /* 0000 1011 ... */ /* 000 */ V(13, 1, 2), /* 256 */ /* 001 */ V(13, 1, 2), /* 010 */ V(5, 12, 3), /* 011 */ V(13, 0, 3), /* 100 */ V(12, 5, 2), /* 101 */ V(12, 5, 2), /* 110 */ V(8, 10, 2), /* 111 */ V(8, 10, 2), /* 0000 1100 ... */ /* 00 */ V(10, 8, 2), /* 264 */ /* 01 */ V(4, 12, 2), /* 10 */ V(12, 4, 2), /* 11 */ V(6, 11, 2), /* 0000 1101 ... */ /* 000 */ V(11, 6, 2), /* 268 */ /* 001 */ V(11, 6, 2), /* 010 */ V(9, 9, 3), /* 011 */ V(0, 12, 3), /* 100 */ V(3, 12, 2), /* 101 */ V(3, 12, 2), /* 110 */ V(12, 3, 2), /* 111 */ V(12, 3, 2), /* 0000 1110 ... */ /* 000 */ V(7, 10, 2), /* 276 */ /* 001 */ V(7, 10, 2), /* 010 */ V(10, 7, 2), /* 011 */ V(10, 7, 2), /* 100 */ V(10, 6, 2), /* 101 */ V(10, 6, 2), /* 110 */ V(12, 0, 3), /* 111 */ V(0, 11, 3), /* 0000 1111 ... */ /* 00 */ V(12, 2, 1), /* 284 */ /* 01 */ V(12, 2, 1), /* 10 */ V(2, 12, 2), /* 11 */ V(5, 11, 2), /* 0001 0000 ... */ /* 00 */ V(11, 5, 2), /* 288 */ /* 01 */ V(1, 12, 2), /* 10 */ V(8, 9, 2), /* 11 */ V(9, 8, 2), /* 0001 0001 ... */ /* 00 */ V(12, 1, 2), /* 292 */ /* 01 */ V(4, 11, 2), /* 10 */ V(11, 4, 2), /* 11 */ V(6, 10, 2), /* 0001 0010 ... */ /* 00 */ V(3, 11, 2), /* 296 */ /* 01 */ V(7, 9, 2), /* 10 */ V(11, 3, 1), /* 11 */ V(11, 3, 1), /* 0001 0011 ... */ /* 00 */ V(9, 7, 2), /* 300 */ /* 01 */ V(8, 8, 2), /* 10 */ V(2, 11, 2), /* 11 */ V(5, 10, 2), /* 0001 0100 ... */ /* 00 */ V(11, 2, 1), /* 304 */ /* 01 */ V(11, 2, 1), /* 10 */ V(10, 5, 2), /* 11 */ V(1, 11, 2), /* 0001 0101 ... */ /* 00 */ V(11, 1, 1), /* 308 */ /* 01 */ V(11, 1, 1), /* 10 */ V(11, 0, 2), /* 11 */ V(6, 9, 2), /* 0001 0110 ... */ /* 00 */ V(9, 6, 2), /* 312 */ /* 01 */ V(4, 10, 2), /* 10 */ V(10, 4, 2), /* 11 */ V(7, 8, 2), /* 0001 0111 ... */ /* 00 */ V(8, 7, 2), /* 316 */ /* 01 */ V(3, 10, 2), /* 10 */ V(10, 3, 1), /* 11 */ V(10, 3, 1), /* 0001 1000 ... */ /* 0 */ V(5, 9, 1), /* 320 */ /* 1 */ V(9, 5, 1), /* 0001 1001 ... */ /* 0 */ V(2, 10, 1), /* 322 */ /* 1 */ V(10, 2, 1), /* 0001 1010 ... */ /* 0 */ V(1, 10, 1), /* 324 */ /* 1 */ V(10, 1, 1), /* 0001 1011 ... */ /* 00 */ V(0, 10, 2), /* 326 */ /* 01 */ V(10, 0, 2), /* 10 */ V(6, 8, 1), /* 11 */ V(6, 8, 1), /* 0001 1100 ... */ /* 0 */ V(8, 6, 1), /* 330 */ /* 1 */ V(4, 9, 1), /* 0001 1101 ... */ /* 0 */ V(9, 4, 1), /* 332 */ /* 1 */ V(3, 9, 1), /* 0001 1110 ... */ /* 00 */ V(9, 3, 1), /* 334 */ /* 01 */ V(9, 3, 1), /* 10 */ V(7, 7, 2), /* 11 */ V(0, 9, 2), /* 0001 1111 ... */ /* 0 */ V(5, 8, 1), /* 338 */ /* 1 */ V(8, 5, 1), /* 0010 0000 ... */ /* 0 */ V(2, 9, 1), /* 340 */ /* 1 */ V(6, 7, 1), /* 0010 0001 ... */ /* 0 */ V(7, 6, 1), /* 342 */ /* 1 */ V(9, 2, 1), /* 0010 0011 ... */ /* 0 */ V(1, 9, 1), /* 344 */ /* 1 */ V(9, 0, 1), /* 0010 0100 ... */ /* 0 */ V(4, 8, 1), /* 346 */ /* 1 */ V(8, 4, 1), /* 0010 0101 ... */ /* 0 */ V(5, 7, 1), /* 348 */ /* 1 */ V(7, 5, 1), /* 0010 0110 ... */ /* 0 */ V(3, 8, 1), /* 350 */ /* 1 */ V(8, 3, 1), /* 0010 0111 ... */ /* 0 */ V(6, 6, 1), /* 352 */ /* 1 */ V(4, 7, 1), /* 0010 1100 ... */ /* 0 */ V(7, 4, 1), /* 354 */ /* 1 */ V(0, 8, 1), /* 0010 1101 ... */ /* 0 */ V(8, 0, 1), /* 356 */ /* 1 */ V(5, 6, 1), /* 0010 1110 ... */ /* 0 */ V(6, 5, 1), /* 358 */ /* 1 */ V(3, 7, 1), /* 0010 1111 ... */ /* 0 */ V(7, 3, 1), /* 360 */ /* 1 */ V(4, 6, 1), /* 0011 0110 ... */ /* 0 */ V(0, 7, 1), /* 362 */ /* 1 */ V(7, 0, 1), /* 0011 1110 ... */ /* 0 */ V(0, 6, 1), /* 364 */ /* 1 */ V(6, 0, 1), /* 0000 0000 0000 ... */ /* 0 */ V(15, 15, 1), /* 366 */ /* 1 */ V(14, 15, 1), /* 0000 0000 0001 ... */ /* 0 */ V(15, 14, 1), /* 368 */ /* 1 */ V(13, 15, 1), /* 0000 0000 0011 ... */ /* 0 */ V(15, 13, 1), /* 370 */ /* 1 */ V(12, 15, 1), /* 0000 0000 0100 ... */ /* 0 */ V(15, 12, 1), /* 372 */ /* 1 */ V(13, 14, 1), /* 0000 0000 0101 ... */ /* 0 */ V(14, 13, 1), /* 374 */ /* 1 */ V(11, 15, 1), /* 0000 0000 0111 ... */ /* 0 */ V(12, 14, 1), /* 376 */ /* 1 */ V(14, 12, 1), /* 0000 0001 1111 ... */ /* 0 */ V(10, 14, 1), /* 378 */ /* 1 */ V(0, 15, 1) }; static union huffpair const hufftab16[] = { /* 0000 */ PTR(16, 4), /* 0001 */ PTR(32, 4), /* 0010 */ PTR(48, 4), /* 0011 */ PTR(64, 2), /* 0100 */ V(1, 1, 4), /* 0101 */ V(0, 1, 4), /* 0110 */ V(1, 0, 3), /* 0111 */ V(1, 0, 3), /* 1000 */ V(0, 0, 1), /* 1001 */ V(0, 0, 1), /* 1010 */ V(0, 0, 1), /* 1011 */ V(0, 0, 1), /* 1100 */ V(0, 0, 1), /* 1101 */ V(0, 0, 1), /* 1110 */ V(0, 0, 1), /* 1111 */ V(0, 0, 1), /* 0000 ... */ /* 0000 */ PTR(68, 3), /* 16 */ /* 0001 */ PTR(76, 3), /* 0010 */ PTR(84, 2), /* 0011 */ V(15, 15, 4), /* 0100 */ PTR(88, 2), /* 0101 */ PTR(92, 1), /* 0110 */ PTR(94, 4), /* 0111 */ V(15, 2, 4), /* 1000 */ PTR(110, 1), /* 1001 */ V(1, 15, 4), /* 1010 */ V(15, 1, 4), /* 1011 */ PTR(112, 4), /* 1100 */ PTR(128, 4), /* 1101 */ PTR(144, 4), /* 1110 */ PTR(160, 4), /* 1111 */ PTR(176, 4), /* 0001 ... */ /* 0000 */ PTR(192, 4), /* 32 */ /* 0001 */ PTR(208, 3), /* 0010 */ PTR(216, 3), /* 0011 */ PTR(224, 3), /* 0100 */ PTR(232, 3), /* 0101 */ PTR(240, 3), /* 0110 */ PTR(248, 3), /* 0111 */ PTR(256, 3), /* 1000 */ PTR(264, 2), /* 1001 */ PTR(268, 2), /* 1010 */ PTR(272, 1), /* 1011 */ PTR(274, 2), /* 1100 */ PTR(278, 2), /* 1101 */ PTR(282, 1), /* 1110 */ V(5, 1, 4), /* 1111 */ PTR(284, 1), /* 0010 ... */ /* 0000 */ PTR(286, 1), /* 48 */ /* 0001 */ PTR(288, 1), /* 0010 */ PTR(290, 1), /* 0011 */ V(1, 4, 4), /* 0100 */ V(4, 1, 4), /* 0101 */ PTR(292, 1), /* 0110 */ V(2, 3, 4), /* 0111 */ V(3, 2, 4), /* 1000 */ V(1, 3, 3), /* 1001 */ V(1, 3, 3), /* 1010 */ V(3, 1, 3), /* 1011 */ V(3, 1, 3), /* 1100 */ V(0, 3, 4), /* 1101 */ V(3, 0, 4), /* 1110 */ V(2, 2, 3), /* 1111 */ V(2, 2, 3), /* 0011 ... */ /* 00 */ V(1, 2, 2), /* 64 */ /* 01 */ V(2, 1, 2), /* 10 */ V(0, 2, 2), /* 11 */ V(2, 0, 2), /* 0000 0000 ... */ /* 000 */ V(14, 15, 3), /* 68 */ /* 001 */ V(15, 14, 3), /* 010 */ V(13, 15, 3), /* 011 */ V(15, 13, 3), /* 100 */ V(12, 15, 3), /* 101 */ V(15, 12, 3), /* 110 */ V(11, 15, 3), /* 111 */ V(15, 11, 3), /* 0000 0001 ... */ /* 000 */ V(10, 15, 2), /* 76 */ /* 001 */ V(10, 15, 2), /* 010 */ V(15, 10, 3), /* 011 */ V(9, 15, 3), /* 100 */ V(15, 9, 3), /* 101 */ V(15, 8, 3), /* 110 */ V(8, 15, 2), /* 111 */ V(8, 15, 2), /* 0000 0010 ... */ /* 00 */ V(7, 15, 2), /* 84 */ /* 01 */ V(15, 7, 2), /* 10 */ V(6, 15, 2), /* 11 */ V(15, 6, 2), /* 0000 0100 ... */ /* 00 */ V(5, 15, 2), /* 88 */ /* 01 */ V(15, 5, 2), /* 10 */ V(4, 15, 1), /* 11 */ V(4, 15, 1), /* 0000 0101 ... */ /* 0 */ V(15, 4, 1), /* 92 */ /* 1 */ V(15, 3, 1), /* 0000 0110 ... */ /* 0000 */ V(15, 0, 1), /* 94 */ /* 0001 */ V(15, 0, 1), /* 0010 */ V(15, 0, 1), /* 0011 */ V(15, 0, 1), /* 0100 */ V(15, 0, 1), /* 0101 */ V(15, 0, 1), /* 0110 */ V(15, 0, 1), /* 0111 */ V(15, 0, 1), /* 1000 */ V(3, 15, 2), /* 1001 */ V(3, 15, 2), /* 1010 */ V(3, 15, 2), /* 1011 */ V(3, 15, 2), /* 1100 */ PTR(294, 4), /* 1101 */ PTR(310, 3), /* 1110 */ PTR(318, 3), /* 1111 */ PTR(326, 3), /* 0000 1000 ... */ /* 0 */ V(2, 15, 1), /* 110 */ /* 1 */ V(0, 15, 1), /* 0000 1011 ... */ /* 0000 */ PTR(334, 2), /* 112 */ /* 0001 */ PTR(338, 2), /* 0010 */ PTR(342, 2), /* 0011 */ PTR(346, 1), /* 0100 */ PTR(348, 2), /* 0101 */ PTR(352, 2), /* 0110 */ PTR(356, 1), /* 0111 */ PTR(358, 2), /* 1000 */ PTR(362, 2), /* 1001 */ PTR(366, 2), /* 1010 */ PTR(370, 2), /* 1011 */ V(14, 3, 4), /* 1100 */ PTR(374, 1), /* 1101 */ PTR(376, 1), /* 1110 */ PTR(378, 1), /* 1111 */ PTR(380, 1), /* 0000 1100 ... */ /* 0000 */ PTR(382, 1), /* 128 */ /* 0001 */ PTR(384, 1), /* 0010 */ PTR(386, 1), /* 0011 */ V(0, 13, 4), /* 0100 */ PTR(388, 1), /* 0101 */ PTR(390, 1), /* 0110 */ PTR(392, 1), /* 0111 */ V(3, 12, 4), /* 1000 */ PTR(394, 1), /* 1001 */ V(1, 12, 4), /* 1010 */ V(12, 0, 4), /* 1011 */ PTR(396, 1), /* 1100 */ V(14, 2, 3), /* 1101 */ V(14, 2, 3), /* 1110 */ V(2, 14, 4), /* 1111 */ V(1, 14, 4), /* 0000 1101 ... */ /* 0000 */ V(13, 3, 4), /* 144 */ /* 0001 */ V(2, 13, 4), /* 0010 */ V(13, 2, 4), /* 0011 */ V(13, 1, 4), /* 0100 */ V(3, 11, 4), /* 0101 */ PTR(398, 1), /* 0110 */ V(1, 13, 3), /* 0111 */ V(1, 13, 3), /* 1000 */ V(12, 4, 4), /* 1001 */ V(6, 11, 4), /* 1010 */ V(12, 3, 4), /* 1011 */ V(10, 7, 4), /* 1100 */ V(2, 12, 3), /* 1101 */ V(2, 12, 3), /* 1110 */ V(12, 2, 4), /* 1111 */ V(11, 5, 4), /* 0000 1110 ... */ /* 0000 */ V(12, 1, 4), /* 160 */ /* 0001 */ V(0, 12, 4), /* 0010 */ V(4, 11, 4), /* 0011 */ V(11, 4, 4), /* 0100 */ V(6, 10, 4), /* 0101 */ V(10, 6, 4), /* 0110 */ V(11, 3, 3), /* 0111 */ V(11, 3, 3), /* 1000 */ V(5, 10, 4), /* 1001 */ V(10, 5, 4), /* 1010 */ V(2, 11, 3), /* 1011 */ V(2, 11, 3), /* 1100 */ V(11, 2, 3), /* 1101 */ V(11, 2, 3), /* 1110 */ V(1, 11, 3), /* 1111 */ V(1, 11, 3), /* 0000 1111 ... */ /* 0000 */ V(11, 1, 3), /* 176 */ /* 0001 */ V(11, 1, 3), /* 0010 */ V(0, 11, 4), /* 0011 */ V(11, 0, 4), /* 0100 */ V(6, 9, 4), /* 0101 */ V(9, 6, 4), /* 0110 */ V(4, 10, 4), /* 0111 */ V(10, 4, 4), /* 1000 */ V(7, 8, 4), /* 1001 */ V(8, 7, 4), /* 1010 */ V(10, 3, 3), /* 1011 */ V(10, 3, 3), /* 1100 */ V(3, 10, 4), /* 1101 */ V(5, 9, 4), /* 1110 */ V(2, 10, 3), /* 1111 */ V(2, 10, 3), /* 0001 0000 ... */ /* 0000 */ V(9, 5, 4), /* 192 */ /* 0001 */ V(6, 8, 4), /* 0010 */ V(10, 1, 3), /* 0011 */ V(10, 1, 3), /* 0100 */ V(8, 6, 4), /* 0101 */ V(7, 7, 4), /* 0110 */ V(9, 4, 3), /* 0111 */ V(9, 4, 3), /* 1000 */ V(4, 9, 4), /* 1001 */ V(5, 7, 4), /* 1010 */ V(6, 7, 3), /* 1011 */ V(6, 7, 3), /* 1100 */ V(10, 2, 2), /* 1101 */ V(10, 2, 2), /* 1110 */ V(10, 2, 2), /* 1111 */ V(10, 2, 2), /* 0001 0001 ... */ /* 000 */ V(1, 10, 2), /* 208 */ /* 001 */ V(1, 10, 2), /* 010 */ V(0, 10, 3), /* 011 */ V(10, 0, 3), /* 100 */ V(3, 9, 3), /* 101 */ V(9, 3, 3), /* 110 */ V(5, 8, 3), /* 111 */ V(8, 5, 3), /* 0001 0010 ... */ /* 000 */ V(2, 9, 2), /* 216 */ /* 001 */ V(2, 9, 2), /* 010 */ V(9, 2, 2), /* 011 */ V(9, 2, 2), /* 100 */ V(7, 6, 3), /* 101 */ V(0, 9, 3), /* 110 */ V(1, 9, 2), /* 111 */ V(1, 9, 2), /* 0001 0011 ... */ /* 000 */ V(9, 1, 2), /* 224 */ /* 001 */ V(9, 1, 2), /* 010 */ V(9, 0, 3), /* 011 */ V(4, 8, 3), /* 100 */ V(8, 4, 3), /* 101 */ V(7, 5, 3), /* 110 */ V(3, 8, 3), /* 111 */ V(8, 3, 3), /* 0001 0100 ... */ /* 000 */ V(6, 6, 3), /* 232 */ /* 001 */ V(2, 8, 3), /* 010 */ V(8, 2, 2), /* 011 */ V(8, 2, 2), /* 100 */ V(4, 7, 3), /* 101 */ V(7, 4, 3), /* 110 */ V(1, 8, 2), /* 111 */ V(1, 8, 2), /* 0001 0101 ... */ /* 000 */ V(8, 1, 2), /* 240 */ /* 001 */ V(8, 1, 2), /* 010 */ V(8, 0, 2), /* 011 */ V(8, 0, 2), /* 100 */ V(0, 8, 3), /* 101 */ V(5, 6, 3), /* 110 */ V(3, 7, 2), /* 111 */ V(3, 7, 2), /* 0001 0110 ... */ /* 000 */ V(7, 3, 2), /* 248 */ /* 001 */ V(7, 3, 2), /* 010 */ V(6, 5, 3), /* 011 */ V(4, 6, 3), /* 100 */ V(2, 7, 2), /* 101 */ V(2, 7, 2), /* 110 */ V(7, 2, 2), /* 111 */ V(7, 2, 2), /* 0001 0111 ... */ /* 000 */ V(6, 4, 3), /* 256 */ /* 001 */ V(5, 5, 3), /* 010 */ V(0, 7, 2), /* 011 */ V(0, 7, 2), /* 100 */ V(1, 7, 1), /* 101 */ V(1, 7, 1), /* 110 */ V(1, 7, 1), /* 111 */ V(1, 7, 1), /* 0001 1000 ... */ /* 00 */ V(7, 1, 1), /* 264 */ /* 01 */ V(7, 1, 1), /* 10 */ V(7, 0, 2), /* 11 */ V(3, 6, 2), /* 0001 1001 ... */ /* 00 */ V(6, 3, 2), /* 268 */ /* 01 */ V(4, 5, 2), /* 10 */ V(5, 4, 2), /* 11 */ V(2, 6, 2), /* 0001 1010 ... */ /* 0 */ V(6, 2, 1), /* 272 */ /* 1 */ V(1, 6, 1), /* 0001 1011 ... */ /* 00 */ V(6, 1, 1), /* 274 */ /* 01 */ V(6, 1, 1), /* 10 */ V(0, 6, 2), /* 11 */ V(6, 0, 2), /* 0001 1100 ... */ /* 00 */ V(5, 3, 1), /* 278 */ /* 01 */ V(5, 3, 1), /* 10 */ V(3, 5, 2), /* 11 */ V(4, 4, 2), /* 0001 1101 ... */ /* 0 */ V(2, 5, 1), /* 282 */ /* 1 */ V(5, 2, 1), /* 0001 1111 ... */ /* 0 */ V(1, 5, 1), /* 284 */ /* 1 */ V(0, 5, 1), /* 0010 0000 ... */ /* 0 */ V(3, 4, 1), /* 286 */ /* 1 */ V(4, 3, 1), /* 0010 0001 ... */ /* 0 */ V(5, 0, 1), /* 288 */ /* 1 */ V(2, 4, 1), /* 0010 0010 ... */ /* 0 */ V(4, 2, 1), /* 290 */ /* 1 */ V(3, 3, 1), /* 0010 0101 ... */ /* 0 */ V(0, 4, 1), /* 292 */ /* 1 */ V(4, 0, 1), /* 0000 0110 1100 ... */ /* 0000 */ V(12, 14, 4), /* 294 */ /* 0001 */ PTR(400, 1), /* 0010 */ V(13, 14, 3), /* 0011 */ V(13, 14, 3), /* 0100 */ V(14, 9, 3), /* 0101 */ V(14, 9, 3), /* 0110 */ V(14, 10, 4), /* 0111 */ V(13, 9, 4), /* 1000 */ V(14, 14, 2), /* 1001 */ V(14, 14, 2), /* 1010 */ V(14, 14, 2), /* 1011 */ V(14, 14, 2), /* 1100 */ V(14, 13, 3), /* 1101 */ V(14, 13, 3), /* 1110 */ V(14, 11, 3), /* 1111 */ V(14, 11, 3), /* 0000 0110 1101 ... */ /* 000 */ V(11, 14, 2), /* 310 */ /* 001 */ V(11, 14, 2), /* 010 */ V(12, 13, 2), /* 011 */ V(12, 13, 2), /* 100 */ V(13, 12, 3), /* 101 */ V(13, 11, 3), /* 110 */ V(10, 14, 2), /* 111 */ V(10, 14, 2), /* 0000 0110 1110 ... */ /* 000 */ V(12, 12, 2), /* 318 */ /* 001 */ V(12, 12, 2), /* 010 */ V(10, 13, 3), /* 011 */ V(13, 10, 3), /* 100 */ V(7, 14, 3), /* 101 */ V(10, 12, 3), /* 110 */ V(12, 10, 2), /* 111 */ V(12, 10, 2), /* 0000 0110 1111 ... */ /* 000 */ V(12, 9, 3), /* 326 */ /* 001 */ V(7, 13, 3), /* 010 */ V(5, 14, 2), /* 011 */ V(5, 14, 2), /* 100 */ V(11, 13, 1), /* 101 */ V(11, 13, 1), /* 110 */ V(11, 13, 1), /* 111 */ V(11, 13, 1), /* 0000 1011 0000 ... */ /* 00 */ V(9, 14, 1), /* 334 */ /* 01 */ V(9, 14, 1), /* 10 */ V(11, 12, 2), /* 11 */ V(12, 11, 2), /* 0000 1011 0001 ... */ /* 00 */ V(8, 14, 2), /* 338 */ /* 01 */ V(14, 8, 2), /* 10 */ V(9, 13, 2), /* 11 */ V(14, 7, 2), /* 0000 1011 0010 ... */ /* 00 */ V(11, 11, 2), /* 342 */ /* 01 */ V(8, 13, 2), /* 10 */ V(13, 8, 2), /* 11 */ V(6, 14, 2), /* 0000 1011 0011 ... */ /* 0 */ V(14, 6, 1), /* 346 */ /* 1 */ V(9, 12, 1), /* 0000 1011 0100 ... */ /* 00 */ V(10, 11, 2), /* 348 */ /* 01 */ V(11, 10, 2), /* 10 */ V(14, 5, 2), /* 11 */ V(13, 7, 2), /* 0000 1011 0101 ... */ /* 00 */ V(4, 14, 1), /* 352 */ /* 01 */ V(4, 14, 1), /* 10 */ V(14, 4, 2), /* 11 */ V(8, 12, 2), /* 0000 1011 0110 ... */ /* 0 */ V(12, 8, 1), /* 356 */ /* 1 */ V(3, 14, 1), /* 0000 1011 0111 ... */ /* 00 */ V(6, 13, 1), /* 358 */ /* 01 */ V(6, 13, 1), /* 10 */ V(13, 6, 2), /* 11 */ V(9, 11, 2), /* 0000 1011 1000 ... */ /* 00 */ V(11, 9, 2), /* 362 */ /* 01 */ V(10, 10, 2), /* 10 */ V(14, 1, 1), /* 11 */ V(14, 1, 1), /* 0000 1011 1001 ... */ /* 00 */ V(13, 4, 1), /* 366 */ /* 01 */ V(13, 4, 1), /* 10 */ V(11, 8, 2), /* 11 */ V(10, 9, 2), /* 0000 1011 1010 ... */ /* 00 */ V(7, 11, 1), /* 370 */ /* 01 */ V(7, 11, 1), /* 10 */ V(11, 7, 2), /* 11 */ V(13, 0, 2), /* 0000 1011 1100 ... */ /* 0 */ V(0, 14, 1), /* 374 */ /* 1 */ V(14, 0, 1), /* 0000 1011 1101 ... */ /* 0 */ V(5, 13, 1), /* 376 */ /* 1 */ V(13, 5, 1), /* 0000 1011 1110 ... */ /* 0 */ V(7, 12, 1), /* 378 */ /* 1 */ V(12, 7, 1), /* 0000 1011 1111 ... */ /* 0 */ V(4, 13, 1), /* 380 */ /* 1 */ V(8, 11, 1), /* 0000 1100 0000 ... */ /* 0 */ V(9, 10, 1), /* 382 */ /* 1 */ V(6, 12, 1), /* 0000 1100 0001 ... */ /* 0 */ V(12, 6, 1), /* 384 */ /* 1 */ V(3, 13, 1), /* 0000 1100 0010 ... */ /* 0 */ V(5, 12, 1), /* 386 */ /* 1 */ V(12, 5, 1), /* 0000 1100 0100 ... */ /* 0 */ V(8, 10, 1), /* 388 */ /* 1 */ V(10, 8, 1), /* 0000 1100 0101 ... */ /* 0 */ V(9, 9, 1), /* 390 */ /* 1 */ V(4, 12, 1), /* 0000 1100 0110 ... */ /* 0 */ V(11, 6, 1), /* 392 */ /* 1 */ V(7, 10, 1), /* 0000 1100 1000 ... */ /* 0 */ V(5, 11, 1), /* 394 */ /* 1 */ V(8, 9, 1), /* 0000 1100 1011 ... */ /* 0 */ V(9, 8, 1), /* 396 */ /* 1 */ V(7, 9, 1), /* 0000 1101 0101 ... */ /* 0 */ V(9, 7, 1), /* 398 */ /* 1 */ V(8, 8, 1), /* 0000 0110 1100 0001 ... */ /* 0 */ V(14, 12, 1), /* 400 */ /* 1 */ V(13, 13, 1) }; static union huffpair const hufftab24[] = { /* 0000 */ PTR(16, 4), /* 0001 */ PTR(32, 4), /* 0010 */ PTR(48, 4), /* 0011 */ V(15, 15, 4), /* 0100 */ PTR(64, 4), /* 0101 */ PTR(80, 4), /* 0110 */ PTR(96, 4), /* 0111 */ PTR(112, 4), /* 1000 */ PTR(128, 4), /* 1001 */ PTR(144, 4), /* 1010 */ PTR(160, 3), /* 1011 */ PTR(168, 2), /* 1100 */ V(1, 1, 4), /* 1101 */ V(0, 1, 4), /* 1110 */ V(1, 0, 4), /* 1111 */ V(0, 0, 4), /* 0000 ... */ /* 0000 */ V(14, 15, 4), /* 16 */ /* 0001 */ V(15, 14, 4), /* 0010 */ V(13, 15, 4), /* 0011 */ V(15, 13, 4), /* 0100 */ V(12, 15, 4), /* 0101 */ V(15, 12, 4), /* 0110 */ V(11, 15, 4), /* 0111 */ V(15, 11, 4), /* 1000 */ V(15, 10, 3), /* 1001 */ V(15, 10, 3), /* 1010 */ V(10, 15, 4), /* 1011 */ V(9, 15, 4), /* 1100 */ V(15, 9, 3), /* 1101 */ V(15, 9, 3), /* 1110 */ V(15, 8, 3), /* 1111 */ V(15, 8, 3), /* 0001 ... */ /* 0000 */ V(8, 15, 4), /* 32 */ /* 0001 */ V(7, 15, 4), /* 0010 */ V(15, 7, 3), /* 0011 */ V(15, 7, 3), /* 0100 */ V(6, 15, 3), /* 0101 */ V(6, 15, 3), /* 0110 */ V(15, 6, 3), /* 0111 */ V(15, 6, 3), /* 1000 */ V(5, 15, 3), /* 1001 */ V(5, 15, 3), /* 1010 */ V(15, 5, 3), /* 1011 */ V(15, 5, 3), /* 1100 */ V(4, 15, 3), /* 1101 */ V(4, 15, 3), /* 1110 */ V(15, 4, 3), /* 1111 */ V(15, 4, 3), /* 0010 ... */ /* 0000 */ V(3, 15, 3), /* 48 */ /* 0001 */ V(3, 15, 3), /* 0010 */ V(15, 3, 3), /* 0011 */ V(15, 3, 3), /* 0100 */ V(2, 15, 3), /* 0101 */ V(2, 15, 3), /* 0110 */ V(15, 2, 3), /* 0111 */ V(15, 2, 3), /* 1000 */ V(15, 1, 3), /* 1001 */ V(15, 1, 3), /* 1010 */ V(1, 15, 4), /* 1011 */ V(15, 0, 4), /* 1100 */ PTR(172, 3), /* 1101 */ PTR(180, 3), /* 1110 */ PTR(188, 3), /* 1111 */ PTR(196, 3), /* 0100 ... */ /* 0000 */ PTR(204, 4), /* 64 */ /* 0001 */ PTR(220, 3), /* 0010 */ PTR(228, 3), /* 0011 */ PTR(236, 3), /* 0100 */ PTR(244, 2), /* 0101 */ PTR(248, 2), /* 0110 */ PTR(252, 2), /* 0111 */ PTR(256, 2), /* 1000 */ PTR(260, 2), /* 1001 */ PTR(264, 2), /* 1010 */ PTR(268, 2), /* 1011 */ PTR(272, 2), /* 1100 */ PTR(276, 2), /* 1101 */ PTR(280, 3), /* 1110 */ PTR(288, 2), /* 1111 */ PTR(292, 2), /* 0101 ... */ /* 0000 */ PTR(296, 2), /* 80 */ /* 0001 */ PTR(300, 3), /* 0010 */ PTR(308, 2), /* 0011 */ PTR(312, 3), /* 0100 */ PTR(320, 1), /* 0101 */ PTR(322, 2), /* 0110 */ PTR(326, 2), /* 0111 */ PTR(330, 1), /* 1000 */ PTR(332, 2), /* 1001 */ PTR(336, 1), /* 1010 */ PTR(338, 1), /* 1011 */ PTR(340, 1), /* 1100 */ PTR(342, 1), /* 1101 */ PTR(344, 1), /* 1110 */ PTR(346, 1), /* 1111 */ PTR(348, 1), /* 0110 ... */ /* 0000 */ PTR(350, 1), /* 96 */ /* 0001 */ PTR(352, 1), /* 0010 */ PTR(354, 1), /* 0011 */ PTR(356, 1), /* 0100 */ PTR(358, 1), /* 0101 */ PTR(360, 1), /* 0110 */ PTR(362, 1), /* 0111 */ PTR(364, 1), /* 1000 */ PTR(366, 1), /* 1001 */ PTR(368, 1), /* 1010 */ PTR(370, 2), /* 1011 */ PTR(374, 1), /* 1100 */ PTR(376, 2), /* 1101 */ V(7, 3, 4), /* 1110 */ PTR(380, 1), /* 1111 */ V(7, 2, 4), /* 0111 ... */ /* 0000 */ V(4, 6, 4), /* 112 */ /* 0001 */ V(6, 4, 4), /* 0010 */ V(5, 5, 4), /* 0011 */ V(7, 1, 4), /* 0100 */ V(3, 6, 4), /* 0101 */ V(6, 3, 4), /* 0110 */ V(4, 5, 4), /* 0111 */ V(5, 4, 4), /* 1000 */ V(2, 6, 4), /* 1001 */ V(6, 2, 4), /* 1010 */ V(1, 6, 4), /* 1011 */ V(6, 1, 4), /* 1100 */ PTR(382, 1), /* 1101 */ V(3, 5, 4), /* 1110 */ V(5, 3, 4), /* 1111 */ V(4, 4, 4), /* 1000 ... */ /* 0000 */ V(2, 5, 4), /* 128 */ /* 0001 */ V(5, 2, 4), /* 0010 */ V(1, 5, 4), /* 0011 */ PTR(384, 1), /* 0100 */ V(5, 1, 3), /* 0101 */ V(5, 1, 3), /* 0110 */ V(3, 4, 4), /* 0111 */ V(4, 3, 4), /* 1000 */ V(2, 4, 3), /* 1001 */ V(2, 4, 3), /* 1010 */ V(4, 2, 3), /* 1011 */ V(4, 2, 3), /* 1100 */ V(3, 3, 3), /* 1101 */ V(3, 3, 3), /* 1110 */ V(1, 4, 3), /* 1111 */ V(1, 4, 3), /* 1001 ... */ /* 0000 */ V(4, 1, 3), /* 144 */ /* 0001 */ V(4, 1, 3), /* 0010 */ V(0, 4, 4), /* 0011 */ V(4, 0, 4), /* 0100 */ V(2, 3, 3), /* 0101 */ V(2, 3, 3), /* 0110 */ V(3, 2, 3), /* 0111 */ V(3, 2, 3), /* 1000 */ V(1, 3, 2), /* 1001 */ V(1, 3, 2), /* 1010 */ V(1, 3, 2), /* 1011 */ V(1, 3, 2), /* 1100 */ V(3, 1, 2), /* 1101 */ V(3, 1, 2), /* 1110 */ V(3, 1, 2), /* 1111 */ V(3, 1, 2), /* 1010 ... */ /* 000 */ V(0, 3, 3), /* 160 */ /* 001 */ V(3, 0, 3), /* 010 */ V(2, 2, 2), /* 011 */ V(2, 2, 2), /* 100 */ V(1, 2, 1), /* 101 */ V(1, 2, 1), /* 110 */ V(1, 2, 1), /* 111 */ V(1, 2, 1), /* 1011 ... */ /* 00 */ V(2, 1, 1), /* 168 */ /* 01 */ V(2, 1, 1), /* 10 */ V(0, 2, 2), /* 11 */ V(2, 0, 2), /* 0010 1100 ... */ /* 000 */ V(0, 15, 1), /* 172 */ /* 001 */ V(0, 15, 1), /* 010 */ V(0, 15, 1), /* 011 */ V(0, 15, 1), /* 100 */ V(14, 14, 3), /* 101 */ V(13, 14, 3), /* 110 */ V(14, 13, 3), /* 111 */ V(12, 14, 3), /* 0010 1101 ... */ /* 000 */ V(14, 12, 3), /* 180 */ /* 001 */ V(13, 13, 3), /* 010 */ V(11, 14, 3), /* 011 */ V(14, 11, 3), /* 100 */ V(12, 13, 3), /* 101 */ V(13, 12, 3), /* 110 */ V(10, 14, 3), /* 111 */ V(14, 10, 3), /* 0010 1110 ... */ /* 000 */ V(11, 13, 3), /* 188 */ /* 001 */ V(13, 11, 3), /* 010 */ V(12, 12, 3), /* 011 */ V(9, 14, 3), /* 100 */ V(14, 9, 3), /* 101 */ V(10, 13, 3), /* 110 */ V(13, 10, 3), /* 111 */ V(11, 12, 3), /* 0010 1111 ... */ /* 000 */ V(12, 11, 3), /* 196 */ /* 001 */ V(8, 14, 3), /* 010 */ V(14, 8, 3), /* 011 */ V(9, 13, 3), /* 100 */ V(13, 9, 3), /* 101 */ V(7, 14, 3), /* 110 */ V(14, 7, 3), /* 111 */ V(10, 12, 3), /* 0100 0000 ... */ /* 0000 */ V(12, 10, 3), /* 204 */ /* 0001 */ V(12, 10, 3), /* 0010 */ V(11, 11, 3), /* 0011 */ V(11, 11, 3), /* 0100 */ V(8, 13, 3), /* 0101 */ V(8, 13, 3), /* 0110 */ V(13, 8, 3), /* 0111 */ V(13, 8, 3), /* 1000 */ V(0, 14, 4), /* 1001 */ V(14, 0, 4), /* 1010 */ V(0, 13, 3), /* 1011 */ V(0, 13, 3), /* 1100 */ V(14, 6, 2), /* 1101 */ V(14, 6, 2), /* 1110 */ V(14, 6, 2), /* 1111 */ V(14, 6, 2), /* 0100 0001 ... */ /* 000 */ V(6, 14, 3), /* 220 */ /* 001 */ V(9, 12, 3), /* 010 */ V(12, 9, 2), /* 011 */ V(12, 9, 2), /* 100 */ V(5, 14, 2), /* 101 */ V(5, 14, 2), /* 110 */ V(11, 10, 2), /* 111 */ V(11, 10, 2), /* 0100 0010 ... */ /* 000 */ V(14, 5, 2), /* 228 */ /* 001 */ V(14, 5, 2), /* 010 */ V(10, 11, 3), /* 011 */ V(7, 13, 3), /* 100 */ V(13, 7, 2), /* 101 */ V(13, 7, 2), /* 110 */ V(14, 4, 2), /* 111 */ V(14, 4, 2), /* 0100 0011 ... */ /* 000 */ V(8, 12, 2), /* 236 */ /* 001 */ V(8, 12, 2), /* 010 */ V(12, 8, 2), /* 011 */ V(12, 8, 2), /* 100 */ V(4, 14, 3), /* 101 */ V(2, 14, 3), /* 110 */ V(3, 14, 2), /* 111 */ V(3, 14, 2), /* 0100 0100 ... */ /* 00 */ V(6, 13, 2), /* 244 */ /* 01 */ V(13, 6, 2), /* 10 */ V(14, 3, 2), /* 11 */ V(9, 11, 2), /* 0100 0101 ... */ /* 00 */ V(11, 9, 2), /* 248 */ /* 01 */ V(10, 10, 2), /* 10 */ V(14, 2, 2), /* 11 */ V(1, 14, 2), /* 0100 0110 ... */ /* 00 */ V(14, 1, 2), /* 252 */ /* 01 */ V(5, 13, 2), /* 10 */ V(13, 5, 2), /* 11 */ V(7, 12, 2), /* 0100 0111 ... */ /* 00 */ V(12, 7, 2), /* 256 */ /* 01 */ V(4, 13, 2), /* 10 */ V(8, 11, 2), /* 11 */ V(11, 8, 2), /* 0100 1000 ... */ /* 00 */ V(13, 4, 2), /* 260 */ /* 01 */ V(9, 10, 2), /* 10 */ V(10, 9, 2), /* 11 */ V(6, 12, 2), /* 0100 1001 ... */ /* 00 */ V(12, 6, 2), /* 264 */ /* 01 */ V(3, 13, 2), /* 10 */ V(13, 3, 2), /* 11 */ V(2, 13, 2), /* 0100 1010 ... */ /* 00 */ V(13, 2, 2), /* 268 */ /* 01 */ V(1, 13, 2), /* 10 */ V(7, 11, 2), /* 11 */ V(11, 7, 2), /* 0100 1011 ... */ /* 00 */ V(13, 1, 2), /* 272 */ /* 01 */ V(5, 12, 2), /* 10 */ V(12, 5, 2), /* 11 */ V(8, 10, 2), /* 0100 1100 ... */ /* 00 */ V(10, 8, 2), /* 276 */ /* 01 */ V(9, 9, 2), /* 10 */ V(4, 12, 2), /* 11 */ V(12, 4, 2), /* 0100 1101 ... */ /* 000 */ V(6, 11, 2), /* 280 */ /* 001 */ V(6, 11, 2), /* 010 */ V(11, 6, 2), /* 011 */ V(11, 6, 2), /* 100 */ V(13, 0, 3), /* 101 */ V(0, 12, 3), /* 110 */ V(3, 12, 2), /* 111 */ V(3, 12, 2), /* 0100 1110 ... */ /* 00 */ V(12, 3, 2), /* 288 */ /* 01 */ V(7, 10, 2), /* 10 */ V(10, 7, 2), /* 11 */ V(2, 12, 2), /* 0100 1111 ... */ /* 00 */ V(12, 2, 2), /* 292 */ /* 01 */ V(5, 11, 2), /* 10 */ V(11, 5, 2), /* 11 */ V(1, 12, 2), /* 0101 0000 ... */ /* 00 */ V(8, 9, 2), /* 296 */ /* 01 */ V(9, 8, 2), /* 10 */ V(12, 1, 2), /* 11 */ V(4, 11, 2), /* 0101 0001 ... */ /* 000 */ V(12, 0, 3), /* 300 */ /* 001 */ V(0, 11, 3), /* 010 */ V(3, 11, 2), /* 011 */ V(3, 11, 2), /* 100 */ V(11, 0, 3), /* 101 */ V(0, 10, 3), /* 110 */ V(1, 10, 2), /* 111 */ V(1, 10, 2), /* 0101 0010 ... */ /* 00 */ V(11, 4, 1), /* 308 */ /* 01 */ V(11, 4, 1), /* 10 */ V(6, 10, 2), /* 11 */ V(10, 6, 2), /* 0101 0011 ... */ /* 000 */ V(7, 9, 2), /* 312 */ /* 001 */ V(7, 9, 2), /* 010 */ V(9, 7, 2), /* 011 */ V(9, 7, 2), /* 100 */ V(10, 0, 3), /* 101 */ V(0, 9, 3), /* 110 */ V(9, 0, 2), /* 111 */ V(9, 0, 2), /* 0101 0100 ... */ /* 0 */ V(11, 3, 1), /* 320 */ /* 1 */ V(8, 8, 1), /* 0101 0101 ... */ /* 00 */ V(2, 11, 2), /* 322 */ /* 01 */ V(5, 10, 2), /* 10 */ V(11, 2, 1), /* 11 */ V(11, 2, 1), /* 0101 0110 ... */ /* 00 */ V(10, 5, 2), /* 326 */ /* 01 */ V(1, 11, 2), /* 10 */ V(11, 1, 2), /* 11 */ V(6, 9, 2), /* 0101 0111 ... */ /* 0 */ V(9, 6, 1), /* 330 */ /* 1 */ V(10, 4, 1), /* 0101 1000 ... */ /* 00 */ V(4, 10, 2), /* 332 */ /* 01 */ V(7, 8, 2), /* 10 */ V(8, 7, 1), /* 11 */ V(8, 7, 1), /* 0101 1001 ... */ /* 0 */ V(3, 10, 1), /* 336 */ /* 1 */ V(10, 3, 1), /* 0101 1010 ... */ /* 0 */ V(5, 9, 1), /* 338 */ /* 1 */ V(9, 5, 1), /* 0101 1011 ... */ /* 0 */ V(2, 10, 1), /* 340 */ /* 1 */ V(10, 2, 1), /* 0101 1100 ... */ /* 0 */ V(10, 1, 1), /* 342 */ /* 1 */ V(6, 8, 1), /* 0101 1101 ... */ /* 0 */ V(8, 6, 1), /* 344 */ /* 1 */ V(7, 7, 1), /* 0101 1110 ... */ /* 0 */ V(4, 9, 1), /* 346 */ /* 1 */ V(9, 4, 1), /* 0101 1111 ... */ /* 0 */ V(3, 9, 1), /* 348 */ /* 1 */ V(9, 3, 1), /* 0110 0000 ... */ /* 0 */ V(5, 8, 1), /* 350 */ /* 1 */ V(8, 5, 1), /* 0110 0001 ... */ /* 0 */ V(2, 9, 1), /* 352 */ /* 1 */ V(6, 7, 1), /* 0110 0010 ... */ /* 0 */ V(7, 6, 1), /* 354 */ /* 1 */ V(9, 2, 1), /* 0110 0011 ... */ /* 0 */ V(1, 9, 1), /* 356 */ /* 1 */ V(9, 1, 1), /* 0110 0100 ... */ /* 0 */ V(4, 8, 1), /* 358 */ /* 1 */ V(8, 4, 1), /* 0110 0101 ... */ /* 0 */ V(5, 7, 1), /* 360 */ /* 1 */ V(7, 5, 1), /* 0110 0110 ... */ /* 0 */ V(3, 8, 1), /* 362 */ /* 1 */ V(8, 3, 1), /* 0110 0111 ... */ /* 0 */ V(6, 6, 1), /* 364 */ /* 1 */ V(2, 8, 1), /* 0110 1000 ... */ /* 0 */ V(8, 2, 1), /* 366 */ /* 1 */ V(1, 8, 1), /* 0110 1001 ... */ /* 0 */ V(4, 7, 1), /* 368 */ /* 1 */ V(7, 4, 1), /* 0110 1010 ... */ /* 00 */ V(8, 1, 1), /* 370 */ /* 01 */ V(8, 1, 1), /* 10 */ V(0, 8, 2), /* 11 */ V(8, 0, 2), /* 0110 1011 ... */ /* 0 */ V(5, 6, 1), /* 374 */ /* 1 */ V(6, 5, 1), /* 0110 1100 ... */ /* 00 */ V(1, 7, 1), /* 376 */ /* 01 */ V(1, 7, 1), /* 10 */ V(0, 7, 2), /* 11 */ V(7, 0, 2), /* 0110 1110 ... */ /* 0 */ V(3, 7, 1), /* 380 */ /* 1 */ V(2, 7, 1), /* 0111 1100 ... */ /* 0 */ V(0, 6, 1), /* 382 */ /* 1 */ V(6, 0, 1), /* 1000 0011 ... */ /* 0 */ V(0, 5, 1), /* 384 */ /* 1 */ V(5, 0, 1) }; # undef V # undef PTR /* external tables */ union huffquad const *const mad_huff_quad_table[2] = { hufftabA, hufftabB }; struct hufftable const mad_huff_pair_table[32] = { /* 0 */ { hufftab0, 0, 0 }, /* 1 */ { hufftab1, 0, 3 }, /* 2 */ { hufftab2, 0, 3 }, /* 3 */ { hufftab3, 0, 3 }, /* 4 */ { 0 /* not used */ }, /* 5 */ { hufftab5, 0, 3 }, /* 6 */ { hufftab6, 0, 4 }, /* 7 */ { hufftab7, 0, 4 }, /* 8 */ { hufftab8, 0, 4 }, /* 9 */ { hufftab9, 0, 4 }, /* 10 */ { hufftab10, 0, 4 }, /* 11 */ { hufftab11, 0, 4 }, /* 12 */ { hufftab12, 0, 4 }, /* 13 */ { hufftab13, 0, 4 }, /* 14 */ { 0 /* not used */ }, /* 15 */ { hufftab15, 0, 4 }, /* 16 */ { hufftab16, 1, 4 }, /* 17 */ { hufftab16, 2, 4 }, /* 18 */ { hufftab16, 3, 4 }, /* 19 */ { hufftab16, 4, 4 }, /* 20 */ { hufftab16, 6, 4 }, /* 21 */ { hufftab16, 8, 4 }, /* 22 */ { hufftab16, 10, 4 }, /* 23 */ { hufftab16, 13, 4 }, /* 24 */ { hufftab24, 4, 4 }, /* 25 */ { hufftab24, 5, 4 }, /* 26 */ { hufftab24, 6, 4 }, /* 27 */ { hufftab24, 7, 4 }, /* 28 */ { hufftab24, 8, 4 }, /* 29 */ { hufftab24, 9, 4 }, /* 30 */ { hufftab24, 11, 4 }, /* 31 */ { hufftab24, 13, 4 } }; avifile-0.7.48~20090503.ds/plugins/libmad/libmad/huffman.h0000644000175000017500000000350610403657206021706 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: huffman.h,v 1.2 2006/03/08 22:45:26 kabi Exp $ */ # ifndef LIBMAD_HUFFMAN_H # define LIBMAD_HUFFMAN_H union huffquad { struct { unsigned short final : 1; unsigned short bits : 3; unsigned short offset : 12; } ptr; struct { unsigned short final : 1; unsigned short hlen : 3; unsigned short v : 1; unsigned short w : 1; unsigned short x : 1; unsigned short y : 1; } value; unsigned short final : 1; }; union huffpair { struct { unsigned short final : 1; unsigned short bits : 3; unsigned short offset : 12; } ptr; struct { unsigned short final : 1; unsigned short hlen : 3; unsigned short x : 4; unsigned short y : 4; } value; unsigned short final : 1; }; struct hufftable { union huffpair const *table; unsigned short linbits; unsigned short startbits; }; extern union huffquad const *const mad_huff_quad_table[2]; extern struct hufftable const mad_huff_pair_table[32]; # endif avifile-0.7.48~20090503.ds/plugins/libmad/libmad/imdct_l_arm.S0000644000175000017500000010320210403657206022501 0ustar yavoryavor/***************************************************************************** * Copyright (C) 2000-2001 Andre McCurdy * * This program is free software. you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation@ either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * ***************************************************************************** * * Notes: * * ***************************************************************************** * * $Id: imdct_l_arm.S,v 1.2 2006/03/08 22:45:26 kabi Exp $ * * 2001/03/24: Andre McCurdy * - Corrected PIC unsafe loading of address of 'imdct36_long_karray' * * 2000/09/20: Robert Leslie * - Added a global symbol with leading underscore per suggestion of * Simon Burge to support linking with the a.out format. * * 2000/09/15: Robert Leslie * - Fixed a small bug where flags were changed before a conditional branch. * * 2000/09/15: Andre McCurdy * - Applied Nicolas Pitre's rounding optimisation in all remaining places. * * 2000/09/09: Nicolas Pitre * - Optimized rounding + scaling operations. * * 2000/08/09: Andre McCurdy * - Original created. * ****************************************************************************/ /* On entry: r0 = pointer to 18 element input array r1 = pointer to 36 element output array r2 = windowing block type Stack frame created during execution of the function: Initial Holds: Stack pointer minus: 0 4 lr 8 r11 12 r10 16 r9 20 r8 24 r7 28 r6 32 r5 36 r4 40 r2 : windowing block type 44 ct00 high 48 ct00 low 52 ct01 high 56 ct01 low 60 ct04 high 64 ct04 low 68 ct06 high 72 ct06 low 76 ct05 high 80 ct05 low 84 ct03 high 88 ct03 low 92 -ct05 high 96 -ct05 low 100 -ct07 high 104 -ct07 low 108 ct07 high 112 ct07 low 116 ct02 high 120 ct02 low */ #define BLOCK_MODE_NORMAL 0 #define BLOCK_MODE_START 1 #define BLOCK_MODE_STOP 3 #define X0 0x00 #define X1 0x04 #define X2 0x08 #define X3 0x0C #define X4 0x10 #define X5 0x14 #define X6 0x18 #define X7 0x1c #define X8 0x20 #define X9 0x24 #define X10 0x28 #define X11 0x2c #define X12 0x30 #define X13 0x34 #define X14 0x38 #define X15 0x3c #define X16 0x40 #define X17 0x44 #define x0 0x00 #define x1 0x04 #define x2 0x08 #define x3 0x0C #define x4 0x10 #define x5 0x14 #define x6 0x18 #define x7 0x1c #define x8 0x20 #define x9 0x24 #define x10 0x28 #define x11 0x2c #define x12 0x30 #define x13 0x34 #define x14 0x38 #define x15 0x3c #define x16 0x40 #define x17 0x44 #define x18 0x48 #define x19 0x4c #define x20 0x50 #define x21 0x54 #define x22 0x58 #define x23 0x5c #define x24 0x60 #define x25 0x64 #define x26 0x68 #define x27 0x6c #define x28 0x70 #define x29 0x74 #define x30 0x78 #define x31 0x7c #define x32 0x80 #define x33 0x84 #define x34 0x88 #define x35 0x8c #define K00 0x0ffc19fd #define K01 0x00b2aa3e #define K02 0x0fdcf549 #define K03 0x0216a2a2 #define K04 0x0f9ee890 #define K05 0x03768962 #define K06 0x0f426cb5 #define K07 0x04cfb0e2 #define K08 0x0ec835e8 #define K09 0x061f78aa #define K10 0x0e313245 #define K11 0x07635284 #define K12 0x0d7e8807 #define K13 0x0898c779 #define K14 0x0cb19346 #define K15 0x09bd7ca0 #define K16 0x0bcbe352 #define K17 0x0acf37ad #define minus_K02 0xf0230ab7 #define WL0 0x00b2aa3e #define WL1 0x0216a2a2 #define WL2 0x03768962 #define WL3 0x04cfb0e2 #define WL4 0x061f78aa #define WL5 0x07635284 #define WL6 0x0898c779 #define WL7 0x09bd7ca0 #define WL8 0x0acf37ad #define WL9 0x0bcbe352 #define WL10 0x0cb19346 #define WL11 0x0d7e8807 #define WL12 0x0e313245 #define WL13 0x0ec835e8 #define WL14 0x0f426cb5 #define WL15 0x0f9ee890 #define WL16 0x0fdcf549 #define WL17 0x0ffc19fd @***************************************************************************** .text .align .global III_imdct_l .global _III_imdct_l III_imdct_l: _III_imdct_l: stmdb sp!, { r2, r4 - r11, lr } @ all callee saved regs, plus arg3 ldr r4, =K08 @ r4 = K08 ldr r5, =K09 @ r5 = K09 ldr r8, [r0, #X4] @ r8 = X4 ldr r9, [r0, #X13] @ r9 = X13 rsb r6, r4, #0 @ r6 = -K08 rsb r7, r5, #0 @ r7 = -K09 smull r2, r3, r4, r8 @ r2..r3 = (X4 * K08) smlal r2, r3, r5, r9 @ r2..r3 = (X4 * K08) + (X13 * K09) = ct01 smull r10, lr, r8, r5 @ r10..lr = (X4 * K09) smlal r10, lr, r9, r6 @ r10..lr = (X4 * K09) + (X13 * -K08) = ct00 ldr r8, [r0, #X7] @ r8 = X7 ldr r9, [r0, #X16] @ r9 = X16 stmdb sp!, { r2, r3, r10, lr } @ stack ct00_h, ct00_l, ct01_h, ct01_l add r8, r8, r9 @ r8 = (X7 + X16) ldr r9, [r0, #X1] @ r9 = X1 smlal r2, r3, r6, r8 @ r2..r3 = ct01 + ((X7 + X16) * -K08) smlal r2, r3, r7, r9 @ r2..r3 += (X1 * -K09) ldr r7, [r0, #X10] @ r7 = X10 rsbs r10, r10, #0 rsc lr, lr, #0 @ r10..lr = -ct00 smlal r2, r3, r5, r7 @ r2..r3 += (X10 * K09) = ct06 smlal r10, lr, r9, r6 @ r10..lr = -ct00 + ( X1 * -K08) smlal r10, lr, r8, r5 @ r10..lr += ((X7 + X16) * K09) smlal r10, lr, r7, r4 @ r10..lr += ( X10 * K08) = ct04 stmdb sp!, { r2, r3, r10, lr } @ stack ct04_h, ct04_l, ct06_h, ct06_l @---- ldr r7, [r0, #X0] ldr r8, [r0, #X11] ldr r9, [r0, #X12] sub r7, r7, r8 sub r7, r7, r9 @ r7 = (X0 - X11 -X12) = ct14 ldr r9, [r0, #X3] ldr r8, [r0, #X8] ldr r11, [r0, #X15] sub r8, r8, r9 add r8, r8, r11 @ r8 = (X8 - X3 + X15) = ct16 add r11, r7, r8 @ r11 = ct14 + ct16 = ct18 smlal r2, r3, r6, r11 @ r2..r3 = ct06 + ((X0 - X11 - X3 + X15 + X8 - X12) * -K08) ldr r6, [r0, #X2] ldr r9, [r0, #X9] ldr r12, [r0, #X14] sub r6, r6, r9 sub r6, r6, r12 @ r6 = (X2 - X9 - X14) = ct15 ldr r9, [r0, #X5] ldr r12, [r0, #X6] sub r9, r9, r12 ldr r12, [r0, #X17] sub r9, r9, r12 @ r9 = (X5 - X6 - X17) = ct17 add r12, r9, r6 @ r12 = ct15 + ct17 = ct19 smlal r2, r3, r5, r12 @ r2..r3 += ((X2 - X9 + X5 - X6 - X17 - X14) * K09) smlal r10, lr, r11, r5 @ r10..lr = ct04 + (ct18 * K09) smlal r10, lr, r12, r4 @ r10..lr = ct04 + (ct18 * K09) + (ct19 * K08) movs r2, r2, lsr #28 adc r2, r2, r3, lsl #4 @ r2 = bits[59..28] of r2..r3 str r2, [r1, #x22] @ store result x22 movs r10, r10, lsr #28 adc r10, r10, lr, lsl #4 @ r10 = bits[59..28] of r10..lr str r10, [r1, #x4] @ store result x4 @---- ldmia sp, { r2, r3, r4, r5 } @ r2..r3 = ct06, r4..r5 = ct04 (dont update sp) @ r2..r3 = ct06 @ r4..r5 = ct04 @ r6 = ct15 @ r7 = ct14 @ r8 = ct16 @ r9 = ct17 @ r10 = . @ r11 = . @ r12 = . @ lr = . ldr r10, =K03 @ r10 = K03 ldr lr, =K15 @ lr = K15 smlal r2, r3, r10, r7 @ r2..r3 = ct06 + (ct14 * K03) smlal r4, r5, lr, r7 @ r4..r5 = ct04 + (ct14 * K15) ldr r12, =K14 @ r12 = K14 rsb r10, r10, #0 @ r10 = -K03 smlal r2, r3, lr, r6 @ r2..r3 += (ct15 * K15) smlal r4, r5, r10, r6 @ r4..r5 += (ct15 * -K03) smlal r2, r3, r12, r8 @ r2..r3 += (ct16 * K14) ldr r11, =minus_K02 @ r11 = -K02 rsb r12, r12, #0 @ r12 = -K14 smlal r4, r5, r12, r9 @ r4..r5 += (ct17 * -K14) smlal r2, r3, r11, r9 @ r2..r3 += (ct17 * -K02) smlal r4, r5, r11, r8 @ r4..r5 += (ct16 * -K02) movs r2, r2, lsr #28 adc r2, r2, r3, lsl #4 @ r2 = bits[59..28] of r2..r3 str r2, [r1, #x7] @ store result x7 movs r4, r4, lsr #28 adc r4, r4, r5, lsl #4 @ r4 = bits[59..28] of r4..r5 str r4, [r1, #x1] @ store result x1 @---- ldmia sp, { r2, r3, r4, r5 } @ r2..r3 = ct06, r4..r5 = ct04 (dont update sp) @ r2..r3 = ct06 @ r4..r5 = ct04 @ r6 = ct15 @ r7 = ct14 @ r8 = ct16 @ r9 = ct17 @ r10 = -K03 @ r11 = -K02 @ r12 = -K14 @ lr = K15 rsbs r2, r2, #0 rsc r3, r3, #0 @ r2..r3 = -ct06 smlal r2, r3, r12, r7 @ r2..r3 = -ct06 + (ct14 * -K14) smlal r2, r3, r10, r8 @ r2..r3 += (ct16 * -K03) smlal r4, r5, r12, r6 @ r4..r5 = ct04 + (ct15 * -K14) smlal r4, r5, r10, r9 @ r4..r5 += (ct17 * -K03) smlal r4, r5, lr, r8 @ r4..r5 += (ct16 * K15) smlal r4, r5, r11, r7 @ r4..r5 += (ct14 * -K02) rsb lr, lr, #0 @ lr = -K15 rsb r11, r11, #0 @ r11 = K02 smlal r2, r3, lr, r9 @ r2..r3 += (ct17 * -K15) smlal r2, r3, r11, r6 @ r2..r3 += (ct15 * K02) movs r4, r4, lsr #28 adc r4, r4, r5, lsl #4 @ r4 = bits[59..28] of r4..r5 str r4, [r1, #x25] @ store result x25 movs r2, r2, lsr #28 adc r2, r2, r3, lsl #4 @ r2 = bits[59..28] of r2..r3 str r2, [r1, #x19] @ store result x19 @---- ldr r2, [sp, #16] @ r2 = ct01_l ldr r3, [sp, #20] @ r3 = ct01_h ldr r6, [r0, #X1] ldr r8, [r0, #X7] ldr r9, [r0, #X10] ldr r7, [r0, #X16] rsbs r2, r2, #0 rsc r3, r3, #0 @ r2..r3 = -ct01 mov r4, r2 mov r5, r3 @ r4..r5 = -ct01 @ r2..r3 = -ct01 @ r4..r5 = -ct01 @ r6 = X1 @ r7 = X16 @ r8 = X7 @ r9 = X10 @ r10 = -K03 @ r11 = K02 @ r12 = -K14 @ lr = -K15 smlal r4, r5, r12, r7 @ r4..r5 = -ct01 + (X16 * -K14) smlal r2, r3, lr, r9 @ r2..r3 = -ct01 + (X10 * -K15) smlal r4, r5, r10, r8 @ r4..r5 += (X7 * -K03) smlal r2, r3, r10, r7 @ r2..r3 += (X16 * -K03) smlal r4, r5, r11, r9 @ r4..r5 += (X10 * K02) smlal r2, r3, r12, r8 @ r2..r3 += (X7 * -K14) rsb lr, lr, #0 @ lr = K15 rsb r11, r11, #0 @ r11 = -K02 smlal r4, r5, lr, r6 @ r4..r5 += (X1 * K15) = ct05 smlal r2, r3, r11, r6 @ r2..r3 += (X1 * -K02) = ct03 stmdb sp!, { r2, r3, r4, r5 } @ stack ct05_h, ct05_l, ct03_h, ct03_l rsbs r4, r4, #0 rsc r5, r5, #0 @ r4..r5 = -ct05 stmdb sp!, { r4, r5 } @ stack -ct05_h, -ct05_l ldr r2, [sp, #48] @ r2 = ct00_l ldr r3, [sp, #52] @ r3 = ct00_h rsb r10, r10, #0 @ r10 = K03 rsbs r4, r2, #0 rsc r5, r3, #0 @ r4..r5 = -ct00 @ r2..r3 = ct00 @ r4..r5 = -ct00 @ r6 = X1 @ r7 = X16 @ r8 = X7 @ r9 = X10 @ r10 = K03 @ r11 = -K02 @ r12 = -K14 @ lr = K15 smlal r4, r5, r10, r6 @ r4..r5 = -ct00 + (X1 * K03) smlal r2, r3, r10, r9 @ r2..r3 = ct00 + (X10 * K03) smlal r4, r5, r12, r9 @ r4..r5 += (X10 * -K14) smlal r2, r3, r12, r6 @ r2..r3 += (X1 * -K14) smlal r4, r5, r11, r7 @ r4..r5 += (X16 * -K02) smlal r4, r5, lr, r8 @ r4..r5 += (X7 * K15) = ct07 rsb lr, lr, #0 @ lr = -K15 rsb r11, r11, #0 @ r11 = K02 smlal r2, r3, r11, r8 @ r2..r3 += (X7 * K02) smlal r2, r3, lr, r7 @ r2..r3 += (X16 * -K15) = ct02 rsbs r6, r4, #0 rsc r7, r5, #0 @ r6..r7 = -ct07 stmdb sp!, { r2 - r7 } @ stack -ct07_h, -ct07_l, ct07_h, ct07_l, ct02_h, ct02_l @---- add r2, pc, #(imdct36_long_karray-.-8) @ r2 = base address of Knn array (PIC safe ?) loop: ldr r12, [r0, #X0] ldmia r2!, { r5 - r11 } @ first 7 words from Karray element smull r3, r4, r5, r12 @ sum = (Kxx * X0) ldr r12, [r0, #X2] ldr r5, [r0, #X3] smlal r3, r4, r6, r12 @ sum += (Kxx * X2) ldr r12, [r0, #X5] ldr r6, [r0, #X6] smlal r3, r4, r7, r5 @ sum += (Kxx * X3) smlal r3, r4, r8, r12 @ sum += (Kxx * X5) ldr r12, [r0, #X8] ldr r5, [r0, #X9] smlal r3, r4, r9, r6 @ sum += (Kxx * X6) smlal r3, r4, r10, r12 @ sum += (Kxx * X8) smlal r3, r4, r11, r5 @ sum += (Kxx * X9) ldmia r2!, { r5 - r10 } @ final 6 words from Karray element ldr r11, [r0, #X11] ldr r12, [r0, #X12] smlal r3, r4, r5, r11 @ sum += (Kxx * X11) ldr r11, [r0, #X14] ldr r5, [r0, #X15] smlal r3, r4, r6, r12 @ sum += (Kxx * X12) smlal r3, r4, r7, r11 @ sum += (Kxx * X14) ldr r11, [r0, #X17] smlal r3, r4, r8, r5 @ sum += (Kxx * X15) smlal r3, r4, r9, r11 @ sum += (Kxx * X17) add r5, sp, r10, lsr #16 @ create index back into stack for required ctxx ldmia r5, { r6, r7 } @ r6..r7 = ctxx mov r8, r10, lsl #16 @ push ctxx index off the top end adds r3, r3, r6 @ add low words adc r4, r4, r7 @ add high words, with carry movs r3, r3, lsr #28 adc r3, r3, r4, lsl #4 @ r3 = bits[59..28] of r3..r4 str r3, [r1, r8, lsr #24] @ push completion flag off the bottom end movs r8, r8, lsl #8 @ push result location index off the top end beq loop @ loop back if completion flag not set b imdct_l_windowing @ branch to windowing stage if looping finished imdct36_long_karray: .word K17, -K13, K10, -K06, -K05, K01, -K00, K04, -K07, K11, K12, -K16, 0x00000000 .word K13, K07, K16, K01, K10, -K05, K04, -K11, K00, -K17, K06, -K12, 0x00200800 .word K11, K17, K05, K12, -K01, K06, -K07, K00, -K13, K04, -K16, K10, 0x00200c00 .word K07, K00, -K12, K05, -K16, -K10, K11, -K17, K04, K13, K01, K06, 0x00001400 .word K05, K10, -K00, -K17, K07, -K13, K12, K06, -K16, K01, -K11, -K04, 0x00181800 .word K01, K05, -K07, -K11, K13, K17, -K16, -K12, K10, K06, -K04, -K00, 0x00102000 .word -K16, K12, -K11, K07, K04, -K00, -K01, K05, -K06, K10, K13, -K17, 0x00284800 .word -K12, K06, K17, -K00, -K11, K04, K05, -K10, K01, K16, -K07, -K13, 0x00085000 .word -K10, K16, K04, -K13, -K00, K07, K06, -K01, -K12, -K05, K17, K11, 0x00105400 .word -K06, -K01, K13, K04, K17, -K11, -K10, -K16, -K05, K12, K00, K07, 0x00185c00 .word -K04, -K11, -K01, K16, K06, K12, K13, -K07, -K17, -K00, -K10, -K05, 0x00006000 .word -K00, -K04, -K06, -K10, -K12, -K16, -K17, -K13, -K11, -K07, -K05, -K01, 0x00206801 @---- @------------------------------------------------------------------------- @---- imdct_l_windowing: ldr r11, [sp, #80] @ fetch function parameter 3 from out of the stack ldmia r1!, { r0, r2 - r9 } @ load 9 words from x0, update pointer @ r0 = x0 @ r1 = &x[9] @ r2 = x1 @ r3 = x2 @ r4 = x3 @ r5 = x4 @ r6 = x5 @ r7 = x6 @ r8 = x7 @ r9 = x8 @ r10 = . @ r11 = window mode: (0 == normal), (1 == start block), (3 == stop block) @ r12 = . @ lr = . cmp r11, #BLOCK_MODE_STOP @ setup flags rsb r10, r0, #0 @ r10 = -x0 (DONT change flags !!) beq stop_block_x0_to_x17 @ start and normal blocks are treated the same for x[0]..x[17] normal_block_x0_to_x17: ldr r12, =WL9 @ r12 = window_l[9] rsb r0, r9, #0 @ r0 = -x8 rsb r9, r2, #0 @ r9 = -x1 rsb r2, r8, #0 @ r2 = -x7 rsb r8, r3, #0 @ r8 = -x2 rsb r3, r7, #0 @ r3 = -x6 rsb r7, r4, #0 @ r7 = -x3 rsb r4, r6, #0 @ r4 = -x5 rsb r6, r5, #0 @ r6 = -x4 @ r0 = -x8 @ r1 = &x[9] @ r2 = -x7 @ r3 = -x6 @ r4 = -x5 @ r5 = . @ r6 = -x4 @ r7 = -x3 @ r8 = -x2 @ r9 = -x1 @ r10 = -x0 @ r11 = window mode: (0 == normal), (1 == start block), (3 == stop block) @ r12 = window_l[9] @ lr = . smull r5, lr, r12, r0 @ r5..lr = (window_l[9] * (x[9] == -x[8])) ldr r12, =WL10 @ r12 = window_l[10] movs r5, r5, lsr #28 adc r0, r5, lr, lsl #4 @ r0 = bits[59..28] of windowed x9 smull r5, lr, r12, r2 @ r5..lr = (window_l[10] * (x[10] == -x[7])) ldr r12, =WL11 @ r12 = window_l[11] movs r5, r5, lsr #28 adc r2, r5, lr, lsl #4 @ r2 = bits[59..28] of windowed x10 smull r5, lr, r12, r3 @ r5..lr = (window_l[11] * (x[11] == -x[6])) ldr r12, =WL12 @ r12 = window_l[12] movs r5, r5, lsr #28 adc r3, r5, lr, lsl #4 @ r3 = bits[59..28] of windowed x11 smull r5, lr, r12, r4 @ r5..lr = (window_l[12] * (x[12] == -x[5])) ldr r12, =WL13 @ r12 = window_l[13] movs r5, r5, lsr #28 adc r4, r5, lr, lsl #4 @ r4 = bits[59..28] of windowed x12 smull r5, lr, r12, r6 @ r5..lr = (window_l[13] * (x[13] == -x[4])) ldr r12, =WL14 @ r12 = window_l[14] movs r5, r5, lsr #28 adc r6, r5, lr, lsl #4 @ r6 = bits[59..28] of windowed x13 smull r5, lr, r12, r7 @ r5..lr = (window_l[14] * (x[14] == -x[3])) ldr r12, =WL15 @ r12 = window_l[15] movs r5, r5, lsr #28 adc r7, r5, lr, lsl #4 @ r7 = bits[59..28] of windowed x14 smull r5, lr, r12, r8 @ r5..lr = (window_l[15] * (x[15] == -x[2])) ldr r12, =WL16 @ r12 = window_l[16] movs r5, r5, lsr #28 adc r8, r5, lr, lsl #4 @ r8 = bits[59..28] of windowed x15 smull r5, lr, r12, r9 @ r5..lr = (window_l[16] * (x[16] == -x[1])) ldr r12, =WL17 @ r12 = window_l[17] movs r5, r5, lsr #28 adc r9, r5, lr, lsl #4 @ r9 = bits[59..28] of windowed x16 smull r5, lr, r12, r10 @ r5..lr = (window_l[17] * (x[17] == -x[0])) ldr r12, =WL0 @ r12 = window_l[0] movs r5, r5, lsr #28 adc r10, r5, lr, lsl #4 @ r10 = bits[59..28] of windowed x17 stmia r1, { r0, r2 - r4, r6 - r10 } @ store windowed x[9] .. x[17] ldmdb r1!, { r0, r2 - r9 } @ load 9 words downto (and including) x0 smull r10, lr, r12, r0 @ r10..lr = (window_l[0] * x[0]) ldr r12, =WL1 @ r12 = window_l[1] movs r10, r10, lsr #28 adc r0, r10, lr, lsl #4 @ r0 = bits[59..28] of windowed x0 smull r10, lr, r12, r2 @ r10..lr = (window_l[1] * x[1]) ldr r12, =WL2 @ r12 = window_l[2] movs r10, r10, lsr #28 adc r2, r10, lr, lsl #4 @ r2 = bits[59..28] of windowed x1 smull r10, lr, r12, r3 @ r10..lr = (window_l[2] * x[2]) ldr r12, =WL3 @ r12 = window_l[3] movs r10, r10, lsr #28 adc r3, r10, lr, lsl #4 @ r3 = bits[59..28] of windowed x2 smull r10, lr, r12, r4 @ r10..lr = (window_l[3] * x[3]) ldr r12, =WL4 @ r12 = window_l[4] movs r10, r10, lsr #28 adc r4, r10, lr, lsl #4 @ r4 = bits[59..28] of windowed x3 smull r10, lr, r12, r5 @ r10..lr = (window_l[4] * x[4]) ldr r12, =WL5 @ r12 = window_l[5] movs r10, r10, lsr #28 adc r5, r10, lr, lsl #4 @ r5 = bits[59..28] of windowed x4 smull r10, lr, r12, r6 @ r10..lr = (window_l[5] * x[5]) ldr r12, =WL6 @ r12 = window_l[6] movs r10, r10, lsr #28 adc r6, r10, lr, lsl #4 @ r6 = bits[59..28] of windowed x5 smull r10, lr, r12, r7 @ r10..lr = (window_l[6] * x[6]) ldr r12, =WL7 @ r12 = window_l[7] movs r10, r10, lsr #28 adc r7, r10, lr, lsl #4 @ r7 = bits[59..28] of windowed x6 smull r10, lr, r12, r8 @ r10..lr = (window_l[7] * x[7]) ldr r12, =WL8 @ r12 = window_l[8] movs r10, r10, lsr #28 adc r8, r10, lr, lsl #4 @ r8 = bits[59..28] of windowed x7 smull r10, lr, r12, r9 @ r10..lr = (window_l[8] * x[8]) movs r10, r10, lsr #28 adc r9, r10, lr, lsl #4 @ r9 = bits[59..28] of windowed x8 stmia r1, { r0, r2 - r9 } @ store windowed x[0] .. x[8] cmp r11, #BLOCK_MODE_START beq start_block_x18_to_x35 @---- normal_block_x18_to_x35: ldr r11, =WL3 @ r11 = window_l[3] ldr r12, =WL4 @ r12 = window_l[4] add r1, r1, #(18*4) @ r1 = &x[18] ldmia r1!, { r0, r2 - r4, r6 - r10 } @ load 9 words from x18, update pointer @ r0 = x18 @ r1 = &x[27] @ r2 = x19 @ r3 = x20 @ r4 = x21 @ r5 = . @ r6 = x22 @ r7 = x23 @ r8 = x24 @ r9 = x25 @ r10 = x26 @ r11 = window_l[3] @ r12 = window_l[4] @ lr = . smull r5, lr, r12, r6 @ r5..lr = (window_l[4] * (x[22] == x[31])) movs r5, r5, lsr #28 adc r5, r5, lr, lsl #4 @ r5 = bits[59..28] of windowed x31 smull r6, lr, r11, r4 @ r5..lr = (window_l[3] * (x[21] == x[32])) ldr r12, =WL5 @ r12 = window_l[5] movs r6, r6, lsr #28 adc r6, r6, lr, lsl #4 @ r6 = bits[59..28] of windowed x32 smull r4, lr, r12, r7 @ r4..lr = (window_l[5] * (x[23] == x[30])) ldr r11, =WL1 @ r11 = window_l[1] ldr r12, =WL2 @ r12 = window_l[2] movs r4, r4, lsr #28 adc r4, r4, lr, lsl #4 @ r4 = bits[59..28] of windowed x30 smull r7, lr, r12, r3 @ r7..lr = (window_l[2] * (x[20] == x[33])) ldr r12, =WL6 @ r12 = window_l[6] movs r7, r7, lsr #28 adc r7, r7, lr, lsl #4 @ r7 = bits[59..28] of windowed x33 smull r3, lr, r12, r8 @ r3..lr = (window_l[6] * (x[24] == x[29])) movs r3, r3, lsr #28 adc r3, r3, lr, lsl #4 @ r3 = bits[59..28] of windowed x29 smull r8, lr, r11, r2 @ r7..lr = (window_l[1] * (x[19] == x[34])) ldr r12, =WL7 @ r12 = window_l[7] ldr r11, =WL8 @ r11 = window_l[8] movs r8, r8, lsr #28 adc r8, r8, lr, lsl #4 @ r8 = bits[59..28] of windowed x34 smull r2, lr, r12, r9 @ r7..lr = (window_l[7] * (x[25] == x[28])) ldr r12, =WL0 @ r12 = window_l[0] movs r2, r2, lsr #28 adc r2, r2, lr, lsl #4 @ r2 = bits[59..28] of windowed x28 smull r9, lr, r12, r0 @ r3..lr = (window_l[0] * (x[18] == x[35])) movs r9, r9, lsr #28 adc r9, r9, lr, lsl #4 @ r9 = bits[59..28] of windowed x35 smull r0, lr, r11, r10 @ r7..lr = (window_l[8] * (x[26] == x[27])) ldr r11, =WL16 @ r11 = window_l[16] ldr r12, =WL17 @ r12 = window_l[17] movs r0, r0, lsr #28 adc r0, r0, lr, lsl #4 @ r0 = bits[59..28] of windowed x27 stmia r1, { r0, r2 - r9 } @ store windowed x[27] .. x[35] ldmdb r1!, { r0, r2 - r9 } @ load 9 words downto (and including) x18 smull r10, lr, r12, r0 @ r10..lr = (window_l[17] * x[18]) movs r10, r10, lsr #28 adc r0, r10, lr, lsl #4 @ r0 = bits[59..28] of windowed x0 smull r10, lr, r11, r2 @ r10..lr = (window_l[16] * x[19]) ldr r11, =WL14 @ r11 = window_l[14] ldr r12, =WL15 @ r12 = window_l[15] movs r10, r10, lsr #28 adc r2, r10, lr, lsl #4 @ r2 = bits[59..28] of windowed x1 smull r10, lr, r12, r3 @ r10..lr = (window_l[15] * x[20]) movs r10, r10, lsr #28 adc r3, r10, lr, lsl #4 @ r3 = bits[59..28] of windowed x2 smull r10, lr, r11, r4 @ r10..lr = (window_l[14] * x[21]) ldr r11, =WL12 @ r11 = window_l[12] ldr r12, =WL13 @ r12 = window_l[13] movs r10, r10, lsr #28 adc r4, r10, lr, lsl #4 @ r4 = bits[59..28] of windowed x3 smull r10, lr, r12, r5 @ r10..lr = (window_l[13] * x[22]) movs r10, r10, lsr #28 adc r5, r10, lr, lsl #4 @ r5 = bits[59..28] of windowed x4 smull r10, lr, r11, r6 @ r10..lr = (window_l[12] * x[23]) ldr r11, =WL10 @ r12 = window_l[10] ldr r12, =WL11 @ r12 = window_l[11] movs r10, r10, lsr #28 adc r6, r10, lr, lsl #4 @ r6 = bits[59..28] of windowed x5 smull r10, lr, r12, r7 @ r10..lr = (window_l[11] * x[24]) movs r10, r10, lsr #28 adc r7, r10, lr, lsl #4 @ r7 = bits[59..28] of windowed x6 smull r10, lr, r11, r8 @ r10..lr = (window_l[10] * x[25]) ldr r12, =WL9 @ r12 = window_l[9] movs r10, r10, lsr #28 adc r8, r10, lr, lsl #4 @ r8 = bits[59..28] of windowed x7 smull r10, lr, r12, r9 @ r10..lr = (window_l[9] * x[26]) movs r10, r10, lsr #28 adc r9, r10, lr, lsl #4 @ r9 = bits[59..28] of windowed x8 stmia r1, { r0, r2 - r9 } @ store windowed x[18] .. x[26] @---- @ NB there are 2 possible exits from this function - this is only one of them @---- add sp, sp, #(21*4) @ return stack frame ldmia sp!, { r4 - r11, pc } @ restore callee saved regs, and return @---- stop_block_x0_to_x17: @ r0 = x0 @ r1 = &x[9] @ r2 = x1 @ r3 = x2 @ r4 = x3 @ r5 = x4 @ r6 = x5 @ r7 = x6 @ r8 = x7 @ r9 = x8 @ r10 = -x0 @ r11 = window mode: (0 == normal), (1 == start block), (3 == stop block) @ r12 = . @ lr = . rsb r0, r6, #0 @ r0 = -x5 rsb r6, r2, #0 @ r6 = -x1 rsb r2, r5, #0 @ r2 = -x4 rsb r5, r3, #0 @ r5 = -x2 rsb r3, r4, #0 @ r3 = -x3 add r1, r1, #(3*4) @ r1 = &x[12] stmia r1, { r0, r2, r3, r5, r6, r10 } @ store unchanged x[12] .. x[17] ldr r0, =WL1 @ r0 = window_l[1] == window_s[0] rsb r10, r9, #0 @ r10 = -x8 rsb r12, r8, #0 @ r12 = -x7 rsb lr, r7, #0 @ lr = -x6 @ r0 = WL1 @ r1 = &x[12] @ r2 = . @ r3 = . @ r4 = . @ r5 = . @ r6 = . @ r7 = x6 @ r8 = x7 @ r9 = x8 @ r10 = -x8 @ r11 = window mode: (0 == normal), (1 == start block), (3 == stop block) @ r12 = -x7 @ lr = -x6 smull r5, r6, r0, r7 @ r5..r6 = (window_l[1] * x[6]) ldr r2, =WL4 @ r2 = window_l[4] == window_s[1] movs r5, r5, lsr #28 adc r7, r5, r6, lsl #4 @ r7 = bits[59..28] of windowed x6 smull r5, r6, r2, r8 @ r5..r6 = (window_l[4] * x[7]) ldr r3, =WL7 @ r3 = window_l[7] == window_s[2] movs r5, r5, lsr #28 adc r8, r5, r6, lsl #4 @ r8 = bits[59..28] of windowed x7 smull r5, r6, r3, r9 @ r5..r6 = (window_l[7] * x[8]) ldr r4, =WL10 @ r4 = window_l[10] == window_s[3] movs r5, r5, lsr #28 adc r9, r5, r6, lsl #4 @ r9 = bits[59..28] of windowed x8 smull r5, r6, r4, r10 @ r5..r6 = (window_l[10] * (x[9] == -x[8])) ldr r0, =WL13 @ r0 = window_l[13] == window_s[4] movs r5, r5, lsr #28 adc r10, r5, r6, lsl #4 @ r10 = bits[59..28] of windowed x9 smull r5, r6, r0, r12 @ r5..r6 = (window_l[13] * (x[10] == -x[7])) ldr r2, =WL16 @ r2 = window_l[16] == window_s[5] movs r5, r5, lsr #28 adc r12, r5, r6, lsl #4 @ r10 = bits[59..28] of windowed x9 smull r5, r6, r2, lr @ r5..r6 = (window_l[16] * (x[11] == -x[6])) ldr r0, =0x00 movs r5, r5, lsr #28 adc lr, r5, r6, lsl #4 @ r10 = bits[59..28] of windowed x9 stmdb r1!, { r7 - r10, r12, lr } @ store windowed x[6] .. x[11] ldr r5, =0x00 ldr r6, =0x00 ldr r2, =0x00 ldr r3, =0x00 ldr r4, =0x00 stmdb r1!, { r0, r2 - r6 } @ store windowed x[0] .. x[5] b normal_block_x18_to_x35 @---- start_block_x18_to_x35: ldr r4, =WL1 @ r0 = window_l[1] == window_s[0] add r1, r1, #(24*4) @ r1 = &x[24] ldmia r1, { r0, r2, r3 } @ load 3 words from x24, dont update pointer @ r0 = x24 @ r1 = &x[24] @ r2 = x25 @ r3 = x26 @ r4 = WL1 @ r5 = WL4 @ r6 = WL7 @ r7 = WL10 @ r8 = WL13 @ r9 = WL16 @ r10 = . @ r11 = . @ r12 = . @ lr = . ldr r5, =WL4 @ r5 = window_l[4] == window_s[1] smull r10, r11, r4, r0 @ r10..r11 = (window_l[1] * (x[24] == x[29])) ldr r6, =WL7 @ r6 = window_l[7] == window_s[2] movs r10, r10, lsr #28 adc lr, r10, r11, lsl #4 @ lr = bits[59..28] of windowed x29 smull r10, r11, r5, r2 @ r10..r11 = (window_l[4] * (x[25] == x[28])) ldr r7, =WL10 @ r7 = window_l[10] == window_s[3] movs r10, r10, lsr #28 adc r12, r10, r11, lsl #4 @ r12 = bits[59..28] of windowed x28 smull r10, r11, r6, r3 @ r10..r11 = (window_l[7] * (x[26] == x[27])) ldr r8, =WL13 @ r8 = window_l[13] == window_s[4] movs r10, r10, lsr #28 adc r4, r10, r11, lsl #4 @ r4 = bits[59..28] of windowed x27 smull r10, r11, r7, r3 @ r10..r11 = (window_l[10] * x[26]) ldr r9, =WL16 @ r9 = window_l[16] == window_s[5] movs r10, r10, lsr #28 adc r3, r10, r11, lsl #4 @ r3 = bits[59..28] of windowed x26 smull r10, r11, r8, r2 @ r10..r11 = (window_l[13] * x[25]) ldr r5, =0x00 movs r10, r10, lsr #28 adc r2, r10, r11, lsl #4 @ r2 = bits[59..28] of windowed x25 smull r10, r11, r9, r0 @ r10..r11 = (window_l[16] * x[24]) ldr r6, =0x00 movs r10, r10, lsr #28 adc r0, r10, r11, lsl #4 @ r0 = bits[59..28] of windowed x24 stmia r1!, { r0, r2, r3, r4, r12, lr } @ store windowed x[24] .. x[29] ldr r7, =0x00 ldr r8, =0x00 ldr r9, =0x00 ldr r10, =0x00 stmia r1!, { r5 - r10 } @ store windowed x[30] .. x[35] @---- @ NB there are 2 possible exits from this function - this is only one of them @---- add sp, sp, #(21*4) @ return stack frame ldmia sp!, { r4 - r11, pc } @ restore callee saved regs, and return @---- @END @---- avifile-0.7.48~20090503.ds/plugins/libmad/libmad/imdct_s.dat0000644000175000017500000000504010403657206022220 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: imdct_s.dat,v 1.2 2006/03/08 22:45:26 kabi Exp $ */ /* 0 */ { MAD_F(0x09bd7ca0) /* 0.608761429 */, -MAD_F(0x0ec835e8) /* -0.923879533 */, -MAD_F(0x0216a2a2) /* -0.130526192 */, MAD_F(0x0fdcf549) /* 0.991444861 */, -MAD_F(0x061f78aa) /* -0.382683432 */, -MAD_F(0x0cb19346) /* -0.793353340 */ }, /* 6 */ { -MAD_F(0x0cb19346) /* -0.793353340 */, MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0216a2a2) /* 0.130526192 */, -MAD_F(0x0ec835e8) /* -0.923879533 */, -MAD_F(0x09bd7ca0) /* -0.608761429 */ }, /* 1 */ { MAD_F(0x061f78aa) /* 0.382683432 */, -MAD_F(0x0ec835e8) /* -0.923879533 */, MAD_F(0x0ec835e8) /* 0.923879533 */, -MAD_F(0x061f78aa) /* -0.382683432 */, -MAD_F(0x061f78aa) /* -0.382683432 */, MAD_F(0x0ec835e8) /* 0.923879533 */ }, /* 7 */ { -MAD_F(0x0ec835e8) /* -0.923879533 */, -MAD_F(0x061f78aa) /* -0.382683432 */, MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x061f78aa) /* 0.382683432 */ }, /* 2 */ { MAD_F(0x0216a2a2) /* 0.130526192 */, -MAD_F(0x061f78aa) /* -0.382683432 */, MAD_F(0x09bd7ca0) /* 0.608761429 */, -MAD_F(0x0cb19346) /* -0.793353340 */, MAD_F(0x0ec835e8) /* 0.923879533 */, -MAD_F(0x0fdcf549) /* -0.991444861 */ }, /* 8 */ { -MAD_F(0x0fdcf549) /* -0.991444861 */, -MAD_F(0x0ec835e8) /* -0.923879533 */, -MAD_F(0x0cb19346) /* -0.793353340 */, -MAD_F(0x09bd7ca0) /* -0.608761429 */, -MAD_F(0x061f78aa) /* -0.382683432 */, -MAD_F(0x0216a2a2) /* -0.130526192 */ } avifile-0.7.48~20090503.ds/plugins/libmad/libmad/layer12.c0000644000175000017500000003246710403657206021544 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: layer12.c,v 1.2 2006/03/08 22:45:26 kabi Exp $ */ # ifdef HAVE_CONFIG_H # include "config.h" # endif # include "global.h" # ifdef HAVE_LIMITS_H # include # else # define CHAR_BIT 8 # endif # include "fixed.h" # include "bit.h" # include "stream.h" # include "frame.h" # include "layer12.h" /* * scalefactor table * used in both Layer I and Layer II decoding */ static mad_fixed_t const sf_table[64] = { # include "sf_table.dat" }; /* --- Layer I ------------------------------------------------------------- */ /* linear scaling table */ static mad_fixed_t const linear_table[14] = { MAD_F(0x15555555), /* 2^2 / (2^2 - 1) == 1.33333333333333 */ MAD_F(0x12492492), /* 2^3 / (2^3 - 1) == 1.14285714285714 */ MAD_F(0x11111111), /* 2^4 / (2^4 - 1) == 1.06666666666667 */ MAD_F(0x10842108), /* 2^5 / (2^5 - 1) == 1.03225806451613 */ MAD_F(0x10410410), /* 2^6 / (2^6 - 1) == 1.01587301587302 */ MAD_F(0x10204081), /* 2^7 / (2^7 - 1) == 1.00787401574803 */ MAD_F(0x10101010), /* 2^8 / (2^8 - 1) == 1.00392156862745 */ MAD_F(0x10080402), /* 2^9 / (2^9 - 1) == 1.00195694716243 */ MAD_F(0x10040100), /* 2^10 / (2^10 - 1) == 1.00097751710655 */ MAD_F(0x10020040), /* 2^11 / (2^11 - 1) == 1.00048851978505 */ MAD_F(0x10010010), /* 2^12 / (2^12 - 1) == 1.00024420024420 */ MAD_F(0x10008004), /* 2^13 / (2^13 - 1) == 1.00012208521548 */ MAD_F(0x10004001), /* 2^14 / (2^14 - 1) == 1.00006103888177 */ MAD_F(0x10002000) /* 2^15 / (2^15 - 1) == 1.00003051850948 */ }; /* * NAME: I_sample() * DESCRIPTION: decode one requantized Layer I sample from a bitstream */ static mad_fixed_t I_sample(struct mad_bitptr *ptr, unsigned int nb) { mad_fixed_t sample; sample = mad_bit_read(ptr, nb); /* invert most significant bit, extend sign, then scale to fixed format */ sample ^= 1 << (nb - 1); sample |= -(sample & (1 << (nb - 1))); sample <<= MAD_F_FRACBITS - (nb - 1); /* requantize the sample */ /* s'' = (2^nb / (2^nb - 1)) * (s''' + 2^(-nb + 1)) */ sample += MAD_F_ONE >> (nb - 1); return mad_f_mul(sample, linear_table[nb - 2]); /* s' = factor * s'' */ /* (to be performed by caller) */ } /* * NAME: layer->I() * DESCRIPTION: decode a single Layer I frame */ int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) { struct mad_header *header = &frame->header; unsigned int nch, bound, ch, s, sb, nb; unsigned char allocation[2][32], scalefactor[2][32]; nch = MAD_NCHANNELS(header); bound = 32; if (header->mode == MAD_MODE_JOINT_STEREO) { header->flags |= MAD_FLAG_I_STEREO; bound = 4 + header->mode_extension * 4; } /* check CRC word */ if (header->flags & MAD_FLAG_PROTECTION) { header->crc_check = mad_bit_crc(stream->ptr, 4 * (bound * nch + (32 - bound)), header->crc_check); if (header->crc_check != header->crc_target && !(frame->options & MAD_OPTION_IGNORECRC)) { stream->error = MAD_ERROR_BADCRC; return -1; } } /* decode bit allocations */ for (sb = 0; sb < bound; ++sb) { for (ch = 0; ch < nch; ++ch) { nb = mad_bit_read(&stream->ptr, 4); if (nb == 15) { stream->error = MAD_ERROR_BADBITALLOC; return -1; } allocation[ch][sb] = nb ? nb + 1 : 0; } } for (sb = bound; sb < 32; ++sb) { nb = mad_bit_read(&stream->ptr, 4); if (nb == 15) { stream->error = MAD_ERROR_BADBITALLOC; return -1; } allocation[0][sb] = allocation[1][sb] = nb ? nb + 1 : 0; } /* decode scalefactors */ for (sb = 0; sb < 32; ++sb) { for (ch = 0; ch < nch; ++ch) { if (allocation[ch][sb]) { scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6); # if defined(OPT_STRICT) /* * Scalefactor index 63 does not appear in Table B.1 of * ISO/IEC 11172-3. Nonetheless, other implementations accept it, * so we only reject it if OPT_STRICT is defined. */ if (scalefactor[ch][sb] == 63) { stream->error = MAD_ERROR_BADSCALEFACTOR; return -1; } # endif } } } /* decode samples */ for (s = 0; s < 12; ++s) { for (sb = 0; sb < bound; ++sb) { for (ch = 0; ch < nch; ++ch) { nb = allocation[ch][sb]; frame->sbsample[ch][s][sb] = nb ? mad_f_mul(I_sample(&stream->ptr, nb), sf_table[scalefactor[ch][sb]]) : 0; } } for (sb = bound; sb < 32; ++sb) { if ((nb = allocation[0][sb])) { mad_fixed_t sample; sample = I_sample(&stream->ptr, nb); for (ch = 0; ch < nch; ++ch) { frame->sbsample[ch][s][sb] = mad_f_mul(sample, sf_table[scalefactor[ch][sb]]); } } else { for (ch = 0; ch < nch; ++ch) frame->sbsample[ch][s][sb] = 0; } } } return 0; } /* --- Layer II ------------------------------------------------------------ */ /* possible quantization per subband table */ static struct { unsigned int sblimit; unsigned char const offsets[30]; } const sbquant_table[5] = { /* ISO/IEC 11172-3 Table B.2a */ { 27, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 0 */ 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0 } }, /* ISO/IEC 11172-3 Table B.2b */ { 30, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 1 */ 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0 } }, /* ISO/IEC 11172-3 Table B.2c */ { 8, { 5, 5, 2, 2, 2, 2, 2, 2 } }, /* 2 */ /* ISO/IEC 11172-3 Table B.2d */ { 12, { 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }, /* 3 */ /* ISO/IEC 13818-3 Table B.1 */ { 30, { 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, /* 4 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } } }; /* bit allocation table */ static struct { unsigned short nbal; unsigned short offset; } const bitalloc_table[8] = { { 2, 0 }, /* 0 */ { 2, 3 }, /* 1 */ { 3, 3 }, /* 2 */ { 3, 1 }, /* 3 */ { 4, 2 }, /* 4 */ { 4, 3 }, /* 5 */ { 4, 4 }, /* 6 */ { 4, 5 } /* 7 */ }; /* offsets into quantization class table */ static unsigned char const offset_table[6][15] = { { 0, 1, 16 }, /* 0 */ { 0, 1, 2, 3, 4, 5, 16 }, /* 1 */ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, /* 2 */ { 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, /* 3 */ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16 }, /* 4 */ { 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 } /* 5 */ }; /* quantization class table */ static struct quantclass { unsigned short nlevels; unsigned char group; unsigned char bits; mad_fixed_t C; mad_fixed_t D; } const qc_table[17] = { # include "qc_table.dat" }; /* * NAME: II_samples() * DESCRIPTION: decode three requantized Layer II samples from a bitstream */ static void II_samples(struct mad_bitptr *ptr, struct quantclass const *quantclass, mad_fixed_t output[3]) { unsigned int nb, s, sample[3]; if ((nb = quantclass->group)) { unsigned int c, nlevels; /* degrouping */ c = mad_bit_read(ptr, quantclass->bits); nlevels = quantclass->nlevels; for (s = 0; s < 3; ++s) { sample[s] = c % nlevels; c /= nlevels; } } else { nb = quantclass->bits; for (s = 0; s < 3; ++s) sample[s] = mad_bit_read(ptr, nb); } for (s = 0; s < 3; ++s) { mad_fixed_t requantized; /* invert most significant bit, extend sign, then scale to fixed format */ requantized = sample[s] ^ (1 << (nb - 1)); requantized |= -(requantized & (1 << (nb - 1))); requantized <<= MAD_F_FRACBITS - (nb - 1); /* requantize the sample */ /* s'' = C * (s''' + D) */ output[s] = mad_f_mul(requantized + quantclass->D, quantclass->C); /* s' = factor * s'' */ /* (to be performed by caller) */ } } /* * NAME: layer->II() * DESCRIPTION: decode a single Layer II frame */ int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) { struct mad_header *header = &frame->header; struct mad_bitptr start; unsigned int index, sblimit, nbal, nch, bound, gr, ch, s, sb; unsigned char const *offsets; unsigned char allocation[2][32], scfsi[2][32], scalefactor[2][32][3]; mad_fixed_t samples[3]; nch = MAD_NCHANNELS(header); if (header->flags & MAD_FLAG_LSF_EXT) index = 4; else if (header->flags & MAD_FLAG_FREEFORMAT) goto freeformat; else { unsigned long bitrate_per_channel; bitrate_per_channel = header->bitrate; if (nch == 2) { bitrate_per_channel /= 2; # if defined(OPT_STRICT) /* * ISO/IEC 11172-3 allows only single channel mode for 32, 48, 56, and * 80 kbps bitrates in Layer II, but some encoders ignore this * restriction. We enforce it if OPT_STRICT is defined. */ if (bitrate_per_channel <= 28000 || bitrate_per_channel == 40000) { stream->error = MAD_ERROR_BADMODE; return -1; } # endif } else { /* nch == 1 */ if (bitrate_per_channel > 192000) { /* * ISO/IEC 11172-3 does not allow single channel mode for 224, 256, * 320, or 384 kbps bitrates in Layer II. */ stream->error = MAD_ERROR_BADMODE; return -1; } } if (bitrate_per_channel <= 48000) index = (header->samplerate == 32000) ? 3 : 2; else if (bitrate_per_channel <= 80000) index = 0; else { freeformat: index = (header->samplerate == 48000) ? 0 : 1; } } sblimit = sbquant_table[index].sblimit; offsets = sbquant_table[index].offsets; bound = 32; if (header->mode == MAD_MODE_JOINT_STEREO) { header->flags |= MAD_FLAG_I_STEREO; bound = 4 + header->mode_extension * 4; } if (bound > sblimit) bound = sblimit; start = stream->ptr; /* decode bit allocations */ for (sb = 0; sb < bound; ++sb) { nbal = bitalloc_table[offsets[sb]].nbal; for (ch = 0; ch < nch; ++ch) allocation[ch][sb] = mad_bit_read(&stream->ptr, nbal); } for (sb = bound; sb < sblimit; ++sb) { nbal = bitalloc_table[offsets[sb]].nbal; allocation[0][sb] = allocation[1][sb] = mad_bit_read(&stream->ptr, nbal); } /* decode scalefactor selection info */ for (sb = 0; sb < sblimit; ++sb) { for (ch = 0; ch < nch; ++ch) { if (allocation[ch][sb]) scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2); } } /* check CRC word */ if (header->flags & MAD_FLAG_PROTECTION) { header->crc_check = mad_bit_crc(start, mad_bit_length(&start, &stream->ptr), header->crc_check); if (header->crc_check != header->crc_target && !(frame->options & MAD_OPTION_IGNORECRC)) { stream->error = MAD_ERROR_BADCRC; return -1; } } /* decode scalefactors */ for (sb = 0; sb < sblimit; ++sb) { for (ch = 0; ch < nch; ++ch) { if (allocation[ch][sb]) { scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6); switch (scfsi[ch][sb]) { case 2: scalefactor[ch][sb][2] = scalefactor[ch][sb][1] = scalefactor[ch][sb][0]; break; case 0: scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6); /* fall through */ case 1: case 3: scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6); } if (scfsi[ch][sb] & 1) scalefactor[ch][sb][1] = scalefactor[ch][sb][scfsi[ch][sb] - 1]; # if defined(OPT_STRICT) /* * Scalefactor index 63 does not appear in Table B.1 of * ISO/IEC 11172-3. Nonetheless, other implementations accept it, * so we only reject it if OPT_STRICT is defined. */ if (scalefactor[ch][sb][0] == 63 || scalefactor[ch][sb][1] == 63 || scalefactor[ch][sb][2] == 63) { stream->error = MAD_ERROR_BADSCALEFACTOR; return -1; } # endif } } } /* decode samples */ for (gr = 0; gr < 12; ++gr) { for (sb = 0; sb < bound; ++sb) { for (ch = 0; ch < nch; ++ch) { if ((index = allocation[ch][sb])) { index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1]; II_samples(&stream->ptr, &qc_table[index], samples); for (s = 0; s < 3; ++s) { frame->sbsample[ch][3 * gr + s][sb] = mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]); } } else { for (s = 0; s < 3; ++s) frame->sbsample[ch][3 * gr + s][sb] = 0; } } } for (sb = bound; sb < sblimit; ++sb) { if ((index = allocation[0][sb])) { index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1]; II_samples(&stream->ptr, &qc_table[index], samples); for (ch = 0; ch < nch; ++ch) { for (s = 0; s < 3; ++s) { frame->sbsample[ch][3 * gr + s][sb] = mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]); } } } else { for (ch = 0; ch < nch; ++ch) { for (s = 0; s < 3; ++s) frame->sbsample[ch][3 * gr + s][sb] = 0; } } } for (ch = 0; ch < nch; ++ch) { for (s = 0; s < 3; ++s) { for (sb = sblimit; sb < 32; ++sb) frame->sbsample[ch][3 * gr + s][sb] = 0; } } } return 0; } avifile-0.7.48~20090503.ds/plugins/libmad/libmad/layer12.h0000644000175000017500000000211110403657206021530 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: layer12.h,v 1.2 2006/03/08 22:45:26 kabi Exp $ */ # ifndef LIBMAD_LAYER12_H # define LIBMAD_LAYER12_H # include "stream.h" # include "frame.h" int mad_layer_I(struct mad_stream *, struct mad_frame *); int mad_layer_II(struct mad_stream *, struct mad_frame *); # endif avifile-0.7.48~20090503.ds/plugins/libmad/libmad/layer3.c0000644000175000017500000021100310403657206021445 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: layer3.c,v 1.3 2006/03/08 22:45:26 kabi Exp $ */ # ifdef HAVE_CONFIG_H # include "config.h" # endif # include "global.h" # include # include # ifdef HAVE_ASSERT_H # include # endif # ifdef HAVE_LIMITS_H # include # else # define CHAR_BIT 8 # endif # include "fixed.h" # include "bit.h" # include "stream.h" # include "frame.h" # include "huffman.h" # include "layer3.h" /* --- Layer III ----------------------------------------------------------- */ enum { count1table_select = 0x01, scalefac_scale = 0x02, preflag = 0x04, mixed_block_flag = 0x08 }; enum { I_STEREO = 0x1, MS_STEREO = 0x2 }; struct sideinfo { unsigned int main_data_begin; unsigned int private_bits; unsigned char scfsi[2]; struct granule { struct channel { /* from side info */ unsigned short part2_3_length; unsigned short big_values; unsigned short global_gain; unsigned short scalefac_compress; unsigned char flags; unsigned char block_type; unsigned char table_select[3]; unsigned char subblock_gain[3]; unsigned char region0_count; unsigned char region1_count; /* from main_data */ unsigned char scalefac[39]; /* scalefac_l and/or scalefac_s */ } ch[2]; } gr[2]; }; /* * scalefactor bit lengths * derived from section 2.4.2.7 of ISO/IEC 11172-3 */ static struct { unsigned char slen1; unsigned char slen2; } const sflen_table[16] = { { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 }, { 3, 0 }, { 1, 1 }, { 1, 2 }, { 1, 3 }, { 2, 1 }, { 2, 2 }, { 2, 3 }, { 3, 1 }, { 3, 2 }, { 3, 3 }, { 4, 2 }, { 4, 3 } }; /* * number of LSF scalefactor band values * derived from section 2.4.3.2 of ISO/IEC 13818-3 */ static unsigned char const nsfb_table[6][3][4] = { { { 6, 5, 5, 5 }, { 9, 9, 9, 9 }, { 6, 9, 9, 9 } }, { { 6, 5, 7, 3 }, { 9, 9, 12, 6 }, { 6, 9, 12, 6 } }, { { 11, 10, 0, 0 }, { 18, 18, 0, 0 }, { 15, 18, 0, 0 } }, { { 7, 7, 7, 0 }, { 12, 12, 12, 0 }, { 6, 15, 12, 0 } }, { { 6, 6, 6, 3 }, { 12, 9, 9, 6 }, { 6, 12, 9, 6 } }, { { 8, 8, 5, 0 }, { 15, 12, 9, 0 }, { 6, 18, 9, 0 } } }; /* * MPEG-1 scalefactor band widths * derived from Table B.8 of ISO/IEC 11172-3 */ static unsigned char const sfb_48000_long[] = { 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 10, 12, 16, 18, 22, 28, 34, 40, 46, 54, 54, 192 }; static unsigned char const sfb_44100_long[] = { 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10, 12, 16, 20, 24, 28, 34, 42, 50, 54, 76, 158 }; static unsigned char const sfb_32000_long[] = { 4, 4, 4, 4, 4, 4, 6, 6, 8, 10, 12, 16, 20, 24, 30, 38, 46, 56, 68, 84, 102, 26 }; static unsigned char const sfb_48000_short[] = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 10, 10, 10, 12, 12, 12, 14, 14, 14, 16, 16, 16, 20, 20, 20, 26, 26, 26, 66, 66, 66 }; static unsigned char const sfb_44100_short[] = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18, 18, 22, 22, 22, 30, 30, 30, 56, 56, 56 }; static unsigned char const sfb_32000_short[] = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 8, 8, 12, 12, 12, 16, 16, 16, 20, 20, 20, 26, 26, 26, 34, 34, 34, 42, 42, 42, 12, 12, 12 }; static unsigned char const sfb_48000_mixed[] = { /* long */ 4, 4, 4, 4, 4, 4, 6, 6, /* short */ 4, 4, 4, 6, 6, 6, 6, 6, 6, 10, 10, 10, 12, 12, 12, 14, 14, 14, 16, 16, 16, 20, 20, 20, 26, 26, 26, 66, 66, 66 }; static unsigned char const sfb_44100_mixed[] = { /* long */ 4, 4, 4, 4, 4, 4, 6, 6, /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18, 18, 22, 22, 22, 30, 30, 30, 56, 56, 56 }; static unsigned char const sfb_32000_mixed[] = { /* long */ 4, 4, 4, 4, 4, 4, 6, 6, /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 12, 12, 12, 16, 16, 16, 20, 20, 20, 26, 26, 26, 34, 34, 34, 42, 42, 42, 12, 12, 12 }; /* * MPEG-2 scalefactor band widths * derived from Table B.2 of ISO/IEC 13818-3 */ static unsigned char const sfb_24000_long[] = { 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, 18, 22, 26, 32, 38, 46, 54, 62, 70, 76, 36 }; static unsigned char const sfb_22050_long[] = { 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54 }; # define sfb_16000_long sfb_22050_long static unsigned char const sfb_24000_short[] = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18, 18, 24, 24, 24, 32, 32, 32, 44, 44, 44, 12, 12, 12 }; static unsigned char const sfb_22050_short[] = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 8, 8, 8, 10, 10, 10, 14, 14, 14, 18, 18, 18, 26, 26, 26, 32, 32, 32, 42, 42, 42, 18, 18, 18 }; static unsigned char const sfb_16000_short[] = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18, 18, 24, 24, 24, 30, 30, 30, 40, 40, 40, 18, 18, 18 }; static unsigned char const sfb_24000_mixed[] = { /* long */ 6, 6, 6, 6, 6, 6, /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18, 18, 24, 24, 24, 32, 32, 32, 44, 44, 44, 12, 12, 12 }; static unsigned char const sfb_22050_mixed[] = { /* long */ 6, 6, 6, 6, 6, 6, /* short */ 6, 6, 6, 6, 6, 6, 8, 8, 8, 10, 10, 10, 14, 14, 14, 18, 18, 18, 26, 26, 26, 32, 32, 32, 42, 42, 42, 18, 18, 18 }; static unsigned char const sfb_16000_mixed[] = { /* long */ 6, 6, 6, 6, 6, 6, /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18, 18, 24, 24, 24, 30, 30, 30, 40, 40, 40, 18, 18, 18 }; /* * MPEG 2.5 scalefactor band widths * derived from public sources */ # define sfb_12000_long sfb_16000_long # define sfb_11025_long sfb_12000_long static unsigned char const sfb_8000_long[] = { 12, 12, 12, 12, 12, 12, 16, 20, 24, 28, 32, 40, 48, 56, 64, 76, 90, 2, 2, 2, 2, 2 }; # define sfb_12000_short sfb_16000_short # define sfb_11025_short sfb_12000_short static unsigned char const sfb_8000_short[] = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 16, 16, 16, 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36, 36, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26 }; # define sfb_12000_mixed sfb_16000_mixed # define sfb_11025_mixed sfb_12000_mixed /* the 8000 Hz short block scalefactor bands do not break after the first 36 frequency lines, so this is probably wrong */ static unsigned char const sfb_8000_mixed[] = { /* long */ 12, 12, 12, /* short */ 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16, 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36, 36, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26 }; static struct { unsigned char const *l; unsigned char const *s; unsigned char const *m; } const sfbwidth_table[9] = { { sfb_48000_long, sfb_48000_short, sfb_48000_mixed }, { sfb_44100_long, sfb_44100_short, sfb_44100_mixed }, { sfb_32000_long, sfb_32000_short, sfb_32000_mixed }, { sfb_24000_long, sfb_24000_short, sfb_24000_mixed }, { sfb_22050_long, sfb_22050_short, sfb_22050_mixed }, { sfb_16000_long, sfb_16000_short, sfb_16000_mixed }, { sfb_12000_long, sfb_12000_short, sfb_12000_mixed }, { sfb_11025_long, sfb_11025_short, sfb_11025_mixed }, { sfb_8000_long, sfb_8000_short, sfb_8000_mixed } }; /* * scalefactor band preemphasis (used only when preflag is set) * derived from Table B.6 of ISO/IEC 11172-3 */ static unsigned char const pretab[22] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0 }; /* * table for requantization * * rq_table[x].mantissa * 2^(rq_table[x].exponent) = x^(4/3) */ static struct fixedfloat { unsigned long mantissa : 27; unsigned short exponent : 5; } const rq_table[8207] = { # include "rq_table.dat" }; /* * fractional powers of two * used for requantization and joint stereo decoding * * root_table[3 + x] = 2^(x/4) */ static mad_fixed_t const root_table[7] = { MAD_F(0x09837f05) /* 2^(-3/4) == 0.59460355750136 */, MAD_F(0x0b504f33) /* 2^(-2/4) == 0.70710678118655 */, MAD_F(0x0d744fcd) /* 2^(-1/4) == 0.84089641525371 */, MAD_F(0x10000000) /* 2^( 0/4) == 1.00000000000000 */, MAD_F(0x1306fe0a) /* 2^(+1/4) == 1.18920711500272 */, MAD_F(0x16a09e66) /* 2^(+2/4) == 1.41421356237310 */, MAD_F(0x1ae89f99) /* 2^(+3/4) == 1.68179283050743 */ }; /* * coefficients for aliasing reduction * derived from Table B.9 of ISO/IEC 11172-3 * * c[] = { -0.6, -0.535, -0.33, -0.185, -0.095, -0.041, -0.0142, -0.0037 } * cs[i] = 1 / sqrt(1 + c[i]^2) * ca[i] = c[i] / sqrt(1 + c[i]^2) */ static mad_fixed_t const cs[8] = { +MAD_F(0x0db84a81) /* +0.857492926 */, +MAD_F(0x0e1b9d7f) /* +0.881741997 */, +MAD_F(0x0f31adcf) /* +0.949628649 */, +MAD_F(0x0fbba815) /* +0.983314592 */, +MAD_F(0x0feda417) /* +0.995517816 */, +MAD_F(0x0ffc8fc8) /* +0.999160558 */, +MAD_F(0x0fff964c) /* +0.999899195 */, +MAD_F(0x0ffff8d3) /* +0.999993155 */ }; static mad_fixed_t const ca[8] = { -MAD_F(0x083b5fe7) /* -0.514495755 */, -MAD_F(0x078c36d2) /* -0.471731969 */, -MAD_F(0x05039814) /* -0.313377454 */, -MAD_F(0x02e91dd1) /* -0.181913200 */, -MAD_F(0x0183603a) /* -0.094574193 */, -MAD_F(0x00a7cb87) /* -0.040965583 */, -MAD_F(0x003a2847) /* -0.014198569 */, -MAD_F(0x000f27b4) /* -0.003699975 */ }; /* * IMDCT coefficients for short blocks * derived from section 2.4.3.4.10.2 of ISO/IEC 11172-3 * * imdct_s[i/even][k] = cos((PI / 24) * (2 * (i / 2) + 7) * (2 * k + 1)) * imdct_s[i /odd][k] = cos((PI / 24) * (2 * (6 + (i-1)/2) + 7) * (2 * k + 1)) */ static mad_fixed_t const imdct_s[6][6] = { # include "imdct_s.dat" }; # if !defined(ASO_IMDCT) /* * windowing coefficients for long blocks * derived from section 2.4.3.4.10.3 of ISO/IEC 11172-3 * * window_l[i] = sin((PI / 36) * (i + 1/2)) */ static mad_fixed_t const window_l[36] = { MAD_F(0x00b2aa3e) /* 0.043619387 */, MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x03768962) /* 0.216439614 */, MAD_F(0x04cfb0e2) /* 0.300705800 */, MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x07635284) /* 0.461748613 */, MAD_F(0x0898c779) /* 0.537299608 */, MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0acf37ad) /* 0.675590208 */, MAD_F(0x0bcbe352) /* 0.737277337 */, MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x0d7e8807) /* 0.843391446 */, MAD_F(0x0e313245) /* 0.887010833 */, MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0f426cb5) /* 0.953716951 */, MAD_F(0x0f9ee890) /* 0.976296007 */, MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ffc19fd) /* 0.999048222 */, MAD_F(0x0ffc19fd) /* 0.999048222 */, MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0f9ee890) /* 0.976296007 */, MAD_F(0x0f426cb5) /* 0.953716951 */, MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0e313245) /* 0.887010833 */, MAD_F(0x0d7e8807) /* 0.843391446 */, MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x0bcbe352) /* 0.737277337 */, MAD_F(0x0acf37ad) /* 0.675590208 */, MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0898c779) /* 0.537299608 */, MAD_F(0x07635284) /* 0.461748613 */, MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x04cfb0e2) /* 0.300705800 */, MAD_F(0x03768962) /* 0.216439614 */, MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x00b2aa3e) /* 0.043619387 */, }; # endif /* ASO_IMDCT */ /* * windowing coefficients for short blocks * derived from section 2.4.3.4.10.3 of ISO/IEC 11172-3 * * window_s[i] = sin((PI / 12) * (i + 1/2)) */ static mad_fixed_t const window_s[12] = { MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x0216a2a2) /* 0.130526192 */, }; /* * coefficients for intensity stereo processing * derived from section 2.4.3.4.9.3 of ISO/IEC 11172-3 * * is_ratio[i] = tan(i * (PI / 12)) * is_table[i] = is_ratio[i] / (1 + is_ratio[i]) */ static mad_fixed_t const is_table[7] = { MAD_F(0x00000000) /* 0.000000000 */, MAD_F(0x0361962f) /* 0.211324865 */, MAD_F(0x05db3d74) /* 0.366025404 */, MAD_F(0x08000000) /* 0.500000000 */, MAD_F(0x0a24c28c) /* 0.633974596 */, MAD_F(0x0c9e69d1) /* 0.788675135 */, MAD_F(0x10000000) /* 1.000000000 */ }; /* * coefficients for LSF intensity stereo processing * derived from section 2.4.3.2 of ISO/IEC 13818-3 * * is_lsf_table[0][i] = (1 / sqrt(sqrt(2)))^(i + 1) * is_lsf_table[1][i] = (1 / sqrt(2)) ^(i + 1) */ static mad_fixed_t const is_lsf_table[2][15] = { { MAD_F(0x0d744fcd) /* 0.840896415 */, MAD_F(0x0b504f33) /* 0.707106781 */, MAD_F(0x09837f05) /* 0.594603558 */, MAD_F(0x08000000) /* 0.500000000 */, MAD_F(0x06ba27e6) /* 0.420448208 */, MAD_F(0x05a8279a) /* 0.353553391 */, MAD_F(0x04c1bf83) /* 0.297301779 */, MAD_F(0x04000000) /* 0.250000000 */, MAD_F(0x035d13f3) /* 0.210224104 */, MAD_F(0x02d413cd) /* 0.176776695 */, MAD_F(0x0260dfc1) /* 0.148650889 */, MAD_F(0x02000000) /* 0.125000000 */, MAD_F(0x01ae89fa) /* 0.105112052 */, MAD_F(0x016a09e6) /* 0.088388348 */, MAD_F(0x01306fe1) /* 0.074325445 */ }, { MAD_F(0x0b504f33) /* 0.707106781 */, MAD_F(0x08000000) /* 0.500000000 */, MAD_F(0x05a8279a) /* 0.353553391 */, MAD_F(0x04000000) /* 0.250000000 */, MAD_F(0x02d413cd) /* 0.176776695 */, MAD_F(0x02000000) /* 0.125000000 */, MAD_F(0x016a09e6) /* 0.088388348 */, MAD_F(0x01000000) /* 0.062500000 */, MAD_F(0x00b504f3) /* 0.044194174 */, MAD_F(0x00800000) /* 0.031250000 */, MAD_F(0x005a827a) /* 0.022097087 */, MAD_F(0x00400000) /* 0.015625000 */, MAD_F(0x002d413d) /* 0.011048543 */, MAD_F(0x00200000) /* 0.007812500 */, MAD_F(0x0016a09e) /* 0.005524272 */ } }; /* * NAME: III_sideinfo() * DESCRIPTION: decode frame side information from a bitstream */ static enum mad_error III_sideinfo(struct mad_bitptr *ptr, unsigned int nch, int lsf, struct sideinfo *si, unsigned int *data_bitlen, unsigned int *priv_bitlen) { unsigned int ngr, gr, ch, i; enum mad_error result = MAD_ERROR_NONE; *data_bitlen = 0; *priv_bitlen = lsf ? ((nch == 1) ? 1 : 2) : ((nch == 1) ? 5 : 3); si->main_data_begin = mad_bit_read(ptr, lsf ? 8 : 9); si->private_bits = mad_bit_read(ptr, *priv_bitlen); ngr = 1; if (!lsf) { ngr = 2; for (ch = 0; ch < nch; ++ch) si->scfsi[ch] = mad_bit_read(ptr, 4); } for (gr = 0; gr < ngr; ++gr) { struct granule *granule = &si->gr[gr]; for (ch = 0; ch < nch; ++ch) { struct channel *channel = &granule->ch[ch]; channel->part2_3_length = mad_bit_read(ptr, 12); channel->big_values = mad_bit_read(ptr, 9); channel->global_gain = mad_bit_read(ptr, 8); channel->scalefac_compress = mad_bit_read(ptr, lsf ? 9 : 4); *data_bitlen += channel->part2_3_length; if (channel->big_values > 288 && result == 0) result = MAD_ERROR_BADBIGVALUES; channel->flags = 0; /* window_switching_flag */ if (mad_bit_read(ptr, 1)) { channel->block_type = mad_bit_read(ptr, 2); if (channel->block_type == 0 && result == 0) result = MAD_ERROR_BADBLOCKTYPE; if (!lsf && channel->block_type == 2 && si->scfsi[ch] && result == 0) result = MAD_ERROR_BADSCFSI; channel->region0_count = 7; channel->region1_count = 36; if (mad_bit_read(ptr, 1)) channel->flags |= mixed_block_flag; else if (channel->block_type == 2) channel->region0_count = 8; for (i = 0; i < 2; ++i) channel->table_select[i] = mad_bit_read(ptr, 5); # if defined(DEBUG) channel->table_select[2] = 4; /* not used */ # endif for (i = 0; i < 3; ++i) channel->subblock_gain[i] = mad_bit_read(ptr, 3); } else { channel->block_type = 0; for (i = 0; i < 3; ++i) channel->table_select[i] = mad_bit_read(ptr, 5); channel->region0_count = mad_bit_read(ptr, 4); channel->region1_count = mad_bit_read(ptr, 3); } /* [preflag,] scalefac_scale, count1table_select */ channel->flags |= mad_bit_read(ptr, lsf ? 2 : 3); } } return result; } /* * NAME: III_scalefactors_lsf() * DESCRIPTION: decode channel scalefactors for LSF from a bitstream */ static unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr, struct channel *channel, struct channel *gr1ch, int mode_extension) { struct mad_bitptr start; unsigned int scalefac_compress, index, slen[4], part, n, i; unsigned char const *nsfb; start = *ptr; scalefac_compress = channel->scalefac_compress; index = (channel->block_type == 2) ? ((channel->flags & mixed_block_flag) ? 2 : 1) : 0; if (!((mode_extension & I_STEREO) && gr1ch)) { if (scalefac_compress < 400) { slen[0] = (scalefac_compress >> 4) / 5; slen[1] = (scalefac_compress >> 4) % 5; slen[2] = (scalefac_compress % 16) >> 2; slen[3] = scalefac_compress % 4; nsfb = nsfb_table[0][index]; } else if (scalefac_compress < 500) { scalefac_compress -= 400; slen[0] = (scalefac_compress >> 2) / 5; slen[1] = (scalefac_compress >> 2) % 5; slen[2] = scalefac_compress % 4; slen[3] = 0; nsfb = nsfb_table[1][index]; } else { scalefac_compress -= 500; slen[0] = scalefac_compress / 3; slen[1] = scalefac_compress % 3; slen[2] = 0; slen[3] = 0; channel->flags |= preflag; nsfb = nsfb_table[2][index]; } n = 0; for (part = 0; part < 4; ++part) { for (i = 0; i < nsfb[part]; ++i) channel->scalefac[n++] = mad_bit_read(ptr, slen[part]); } while (n < 39) channel->scalefac[n++] = 0; } else { /* (mode_extension & I_STEREO) && gr1ch (i.e. ch == 1) */ scalefac_compress >>= 1; if (scalefac_compress < 180) { slen[0] = scalefac_compress / 36; slen[1] = (scalefac_compress % 36) / 6; slen[2] = (scalefac_compress % 36) % 6; slen[3] = 0; nsfb = nsfb_table[3][index]; } else if (scalefac_compress < 244) { scalefac_compress -= 180; slen[0] = (scalefac_compress % 64) >> 4; slen[1] = (scalefac_compress % 16) >> 2; slen[2] = scalefac_compress % 4; slen[3] = 0; nsfb = nsfb_table[4][index]; } else { scalefac_compress -= 244; slen[0] = scalefac_compress / 3; slen[1] = scalefac_compress % 3; slen[2] = 0; slen[3] = 0; nsfb = nsfb_table[5][index]; } n = 0; for (part = 0; part < 4; ++part) { unsigned int max, is_pos; max = (1 << slen[part]) - 1; for (i = 0; i < nsfb[part]; ++i) { is_pos = mad_bit_read(ptr, slen[part]); channel->scalefac[n] = is_pos; gr1ch->scalefac[n++] = (is_pos == max); } } while (n < 39) { channel->scalefac[n] = 0; gr1ch->scalefac[n++] = 0; /* apparently not illegal */ } } return mad_bit_length(&start, ptr); } /* * NAME: III_scalefactors() * DESCRIPTION: decode channel scalefactors of one granule from a bitstream */ static unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel, struct channel const *gr0ch, unsigned int scfsi) { struct mad_bitptr start; unsigned int slen1, slen2, sfbi; start = *ptr; slen1 = sflen_table[channel->scalefac_compress].slen1; slen2 = sflen_table[channel->scalefac_compress].slen2; if (channel->block_type == 2) { unsigned int nsfb; sfbi = 0; nsfb = (channel->flags & mixed_block_flag) ? 8 + 3 * 3 : 6 * 3; while (nsfb--) channel->scalefac[sfbi++] = mad_bit_read(ptr, slen1); nsfb = 6 * 3; while (nsfb--) channel->scalefac[sfbi++] = mad_bit_read(ptr, slen2); nsfb = 1 * 3; while (nsfb--) channel->scalefac[sfbi++] = 0; } else { /* channel->block_type != 2 */ if (scfsi & 0x8) { for (sfbi = 0; sfbi < 6; ++sfbi) channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; } else { for (sfbi = 0; sfbi < 6; ++sfbi) channel->scalefac[sfbi] = mad_bit_read(ptr, slen1); } if (scfsi & 0x4) { for (sfbi = 6; sfbi < 11; ++sfbi) channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; } else { for (sfbi = 6; sfbi < 11; ++sfbi) channel->scalefac[sfbi] = mad_bit_read(ptr, slen1); } if (scfsi & 0x2) { for (sfbi = 11; sfbi < 16; ++sfbi) channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; } else { for (sfbi = 11; sfbi < 16; ++sfbi) channel->scalefac[sfbi] = mad_bit_read(ptr, slen2); } if (scfsi & 0x1) { for (sfbi = 16; sfbi < 21; ++sfbi) channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; } else { for (sfbi = 16; sfbi < 21; ++sfbi) channel->scalefac[sfbi] = mad_bit_read(ptr, slen2); } channel->scalefac[21] = 0; } return mad_bit_length(&start, ptr); } /* * The Layer III formula for requantization and scaling is defined by * section 2.4.3.4.7.1 of ISO/IEC 11172-3, as follows: * * long blocks: * xr[i] = sign(is[i]) * abs(is[i])^(4/3) * * 2^((1/4) * (global_gain - 210)) * * 2^-(scalefac_multiplier * * (scalefac_l[sfb] + preflag * pretab[sfb])) * * short blocks: * xr[i] = sign(is[i]) * abs(is[i])^(4/3) * * 2^((1/4) * (global_gain - 210 - 8 * subblock_gain[w])) * * 2^-(scalefac_multiplier * scalefac_s[sfb][w]) * * where: * scalefac_multiplier = (scalefac_scale + 1) / 2 * * The routines III_exponents() and III_requantize() facilitate this * calculation. */ /* * NAME: III_exponents() * DESCRIPTION: calculate scalefactor exponents */ static void III_exponents(struct channel const *channel, unsigned char const *sfbwidth, signed int exponents[39]) { signed int gain; unsigned int scalefac_multiplier, sfbi; gain = (signed int) channel->global_gain - 210; scalefac_multiplier = (channel->flags & scalefac_scale) ? 2 : 1; if (channel->block_type == 2) { unsigned int l; signed int gain0, gain1, gain2; sfbi = l = 0; if (channel->flags & mixed_block_flag) { unsigned int premask; premask = (channel->flags & preflag) ? ~0 : 0; /* long block subbands 0-1 */ while (l < 36) { exponents[sfbi] = gain - (signed int) ((channel->scalefac[sfbi] + (pretab[sfbi] & premask)) << scalefac_multiplier); l += sfbwidth[sfbi++]; } } /* this is probably wrong for 8000 Hz short/mixed blocks */ gain0 = gain - 8 * (signed int) channel->subblock_gain[0]; gain1 = gain - 8 * (signed int) channel->subblock_gain[1]; gain2 = gain - 8 * (signed int) channel->subblock_gain[2]; while (l < 576) { exponents[sfbi + 0] = gain0 - (signed int) (channel->scalefac[sfbi + 0] << scalefac_multiplier); exponents[sfbi + 1] = gain1 - (signed int) (channel->scalefac[sfbi + 1] << scalefac_multiplier); exponents[sfbi + 2] = gain2 - (signed int) (channel->scalefac[sfbi + 2] << scalefac_multiplier); l += 3 * sfbwidth[sfbi]; sfbi += 3; } } else { /* channel->block_type != 2 */ if (channel->flags & preflag) { for (sfbi = 0; sfbi < 22; ++sfbi) { exponents[sfbi] = gain - (signed int) ((channel->scalefac[sfbi] + pretab[sfbi]) << scalefac_multiplier); } } else { for (sfbi = 0; sfbi < 22; ++sfbi) { exponents[sfbi] = gain - (signed int) (channel->scalefac[sfbi] << scalefac_multiplier); } } } } /* * NAME: III_requantize() * DESCRIPTION: requantize one (positive) value */ static mad_fixed_t III_requantize(unsigned int value, signed int exp) { mad_fixed_t requantized; signed int frac; struct fixedfloat const *power; frac = exp % 4; /* assumes sign(frac) == sign(exp) */ exp /= 4; power = &rq_table[value]; requantized = power->mantissa; exp += power->exponent; if (exp < 0) { if (-exp >= sizeof(mad_fixed_t) * CHAR_BIT) { /* underflow */ requantized = 0; } else { requantized += 1L << (-exp - 1); requantized >>= -exp; } } else { if (exp >= 5) { /* overflow */ # if defined(DEBUG) fprintf(stderr, "requantize overflow (%f * 2^%d)\n", mad_f_todouble(requantized), exp); # endif requantized = MAD_F_MAX; } else requantized <<= exp; } return frac ? mad_f_mul(requantized, root_table[3 + frac]) : requantized; } /* we must take care that sz >= bits and sz < sizeof(long) lest bits == 0 */ # define MASK(cache, sz, bits) \ (((cache) >> ((sz) - (bits))) & ((1 << (bits)) - 1)) # define MASK1BIT(cache, sz) \ ((cache) & (1 << ((sz) - 1))) /* * NAME: III_huffdecode() * DESCRIPTION: decode Huffman code words of one channel of one granule */ static enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xr[576], struct channel *channel, unsigned char const *sfbwidth, unsigned int part2_length) { signed int exponents[39], exp; signed int const *expptr; struct mad_bitptr peek; signed int bits_left, cachesz; register mad_fixed_t *xrptr; mad_fixed_t const *sfbound; register unsigned long bitcache; bits_left = (signed) channel->part2_3_length - (signed) part2_length; if (bits_left < 0) return MAD_ERROR_BADPART3LEN; III_exponents(channel, sfbwidth, exponents); peek = *ptr; mad_bit_skip(ptr, bits_left); /* align bit reads to byte boundaries */ cachesz = mad_bit_bitsleft(&peek); cachesz += ((32 - 1 - 24) + (24 - cachesz)) & ~7; bitcache = mad_bit_read(&peek, cachesz); bits_left -= cachesz; xrptr = &xr[0]; /* big_values */ { unsigned int region, rcount; struct hufftable const *entry; union huffpair const *table; unsigned int linbits, startbits, big_values, reqhits; mad_fixed_t reqcache[16]; sfbound = xrptr + *sfbwidth++; rcount = channel->region0_count + 1; entry = &mad_huff_pair_table[channel->table_select[region = 0]]; table = entry->table; linbits = entry->linbits; startbits = entry->startbits; if (table == 0) return MAD_ERROR_BADHUFFTABLE; expptr = &exponents[0]; exp = *expptr++; reqhits = 0; big_values = channel->big_values; while (big_values-- && cachesz + bits_left > 0) { union huffpair const *pair; unsigned int clumpsz, value; register mad_fixed_t requantized; if (xrptr == sfbound) { sfbound += *sfbwidth++; /* change table if region boundary */ if (--rcount == 0) { if (region == 0) rcount = channel->region1_count + 1; else rcount = 0; /* all remaining */ entry = &mad_huff_pair_table[channel->table_select[++region]]; table = entry->table; linbits = entry->linbits; startbits = entry->startbits; if (table == 0) return MAD_ERROR_BADHUFFTABLE; } if (exp != *expptr) { exp = *expptr; reqhits = 0; } ++expptr; } if (cachesz < 21) { unsigned int bits; bits = ((32 - 1 - 21) + (21 - cachesz)) & ~7; bitcache = (bitcache << bits) | mad_bit_read(&peek, bits); cachesz += bits; bits_left -= bits; } /* hcod (0..19) */ clumpsz = startbits; pair = &table[MASK(bitcache, cachesz, clumpsz)]; while (!pair->final) { cachesz -= clumpsz; clumpsz = pair->ptr.bits; pair = &table[pair->ptr.offset + MASK(bitcache, cachesz, clumpsz)]; } cachesz -= pair->value.hlen; if (linbits) { /* x (0..14) */ value = pair->value.x; switch (value) { case 0: xrptr[0] = 0; break; case 15: if (cachesz < linbits + 2) { bitcache = (bitcache << 16) | mad_bit_read(&peek, 16); cachesz += 16; bits_left -= 16; } value += MASK(bitcache, cachesz, linbits); cachesz -= linbits; requantized = III_requantize(value, exp); goto x_final; default: if (reqhits & (1 << value)) requantized = reqcache[value]; else { reqhits |= (1 << value); requantized = reqcache[value] = III_requantize(value, exp); } x_final: xrptr[0] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; } /* y (0..14) */ value = pair->value.y; switch (value) { case 0: xrptr[1] = 0; break; case 15: if (cachesz < linbits + 1) { bitcache = (bitcache << 16) | mad_bit_read(&peek, 16); cachesz += 16; bits_left -= 16; } value += MASK(bitcache, cachesz, linbits); cachesz -= linbits; requantized = III_requantize(value, exp); goto y_final; default: if (reqhits & (1 << value)) requantized = reqcache[value]; else { reqhits |= (1 << value); requantized = reqcache[value] = III_requantize(value, exp); } y_final: xrptr[1] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; } } else { /* x (0..1) */ value = pair->value.x; if (value == 0) xrptr[0] = 0; else { if (reqhits & (1 << value)) requantized = reqcache[value]; else { reqhits |= (1 << value); requantized = reqcache[value] = III_requantize(value, exp); } xrptr[0] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; } /* y (0..1) */ value = pair->value.y; if (value == 0) xrptr[1] = 0; else { if (reqhits & (1 << value)) requantized = reqcache[value]; else { reqhits |= (1 << value); requantized = reqcache[value] = III_requantize(value, exp); } xrptr[1] = MASK1BIT(bitcache, cachesz--) ? -requantized : requantized; } } xrptr += 2; } } if (cachesz + bits_left < 0) return MAD_ERROR_BADHUFFDATA; /* big_values overrun */ /* count1 */ { union huffquad const *table; register mad_fixed_t requantized; table = mad_huff_quad_table[channel->flags & count1table_select]; requantized = III_requantize(1, exp); while (cachesz + bits_left > 0 && xrptr <= &xr[572]) { union huffquad const *quad; /* hcod (1..6) */ if (cachesz < 10) { bitcache = (bitcache << 16) | mad_bit_read(&peek, 16); cachesz += 16; bits_left -= 16; } quad = &table[MASK(bitcache, cachesz, 4)]; /* quad tables guaranteed to have at most one extra lookup */ if (!quad->final) { cachesz -= 4; quad = &table[quad->ptr.offset + MASK(bitcache, cachesz, quad->ptr.bits)]; } cachesz -= quad->value.hlen; if (xrptr == sfbound) { sfbound += *sfbwidth++; if (exp != *expptr) { exp = *expptr; requantized = III_requantize(1, exp); } ++expptr; } /* v (0..1) */ xrptr[0] = quad->value.v ? (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; /* w (0..1) */ xrptr[1] = quad->value.w ? (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; xrptr += 2; if (xrptr == sfbound) { sfbound += *sfbwidth++; if (exp != *expptr) { exp = *expptr; requantized = III_requantize(1, exp); } ++expptr; } /* x (0..1) */ xrptr[0] = quad->value.x ? (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; /* y (0..1) */ xrptr[1] = quad->value.y ? (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; xrptr += 2; } if (cachesz + bits_left < 0) { # if 0 && defined(DEBUG) fprintf(stderr, "huffman count1 overrun (%d bits)\n", -(cachesz + bits_left)); # endif /* technically the bitstream is misformatted, but apparently some encoders are just a bit sloppy with stuffing bits */ xrptr -= 4; } } assert(-bits_left <= MAD_BUFFER_GUARD * CHAR_BIT); # if 0 && defined(DEBUG) if (bits_left < 0) fprintf(stderr, "read %d bits too many\n", -bits_left); else if (cachesz + bits_left > 0) fprintf(stderr, "%d stuffing bits\n", cachesz + bits_left); # endif /* rzero */ while (xrptr < &xr[576]) { xrptr[0] = 0; xrptr[1] = 0; xrptr += 2; } return MAD_ERROR_NONE; } # undef MASK # undef MASK1BIT /* * NAME: III_reorder() * DESCRIPTION: reorder frequency lines of a short block into subband order */ static void III_reorder(mad_fixed_t xr[576], struct channel const *channel, unsigned char const sfbwidth[39]) { mad_fixed_t tmp[32][3][6]; unsigned int sb, l, f, w, sbw[3], sw[3]; /* this is probably wrong for 8000 Hz mixed blocks */ sb = 0; if (channel->flags & mixed_block_flag) { sb = 2; l = 0; while (l < 36) l += *sfbwidth++; } for (w = 0; w < 3; ++w) { sbw[w] = sb; sw[w] = 0; } f = *sfbwidth++; w = 0; for (l = 18 * sb; l < 576; ++l) { if (f-- == 0) { f = *sfbwidth++ - 1; w = (w + 1) % 3; } tmp[sbw[w]][w][sw[w]++] = xr[l]; if (sw[w] == 6) { sw[w] = 0; ++sbw[w]; } } memcpy(&xr[18 * sb], &tmp[sb], (576 - 18 * sb) * sizeof(mad_fixed_t)); } /* * NAME: III_stereo() * DESCRIPTION: perform joint stereo processing on a granule */ static enum mad_error III_stereo(mad_fixed_t xr[2][576], struct granule const *granule, struct mad_header *header, unsigned char const *sfbwidth) { short modes[39]; unsigned int sfbi, l, n, i; if (granule->ch[0].block_type != granule->ch[1].block_type || (granule->ch[0].flags & mixed_block_flag) != (granule->ch[1].flags & mixed_block_flag)) return MAD_ERROR_BADSTEREO; for (i = 0; i < 39; ++i) modes[i] = header->mode_extension; /* intensity stereo */ if (header->mode_extension & I_STEREO) { struct channel const *right_ch = &granule->ch[1]; mad_fixed_t const *right_xr = xr[1]; unsigned int is_pos; header->flags |= MAD_FLAG_I_STEREO; /* first determine which scalefactor bands are to be processed */ if (right_ch->block_type == 2) { unsigned int lower, start, max, bound[3], w; lower = start = max = bound[0] = bound[1] = bound[2] = 0; sfbi = l = 0; if (right_ch->flags & mixed_block_flag) { while (l < 36) { n = sfbwidth[sfbi++]; for (i = 0; i < n; ++i) { if (right_xr[i]) { lower = sfbi; break; } } right_xr += n; l += n; } start = sfbi; } w = 0; while (l < 576) { n = sfbwidth[sfbi++]; for (i = 0; i < n; ++i) { if (right_xr[i]) { max = bound[w] = sfbi; break; } } right_xr += n; l += n; w = (w + 1) % 3; } if (max) lower = start; /* long blocks */ for (i = 0; i < lower; ++i) modes[i] = header->mode_extension & ~I_STEREO; /* short blocks */ w = 0; for (i = start; i < max; ++i) { if (i < bound[w]) modes[i] = header->mode_extension & ~I_STEREO; w = (w + 1) % 3; } } else { /* right_ch->block_type != 2 */ unsigned int bound; bound = 0; for (sfbi = l = 0; l < 576; l += n) { n = sfbwidth[sfbi++]; for (i = 0; i < n; ++i) { if (right_xr[i]) { bound = sfbi; break; } } right_xr += n; } for (i = 0; i < bound; ++i) modes[i] = header->mode_extension & ~I_STEREO; } /* now do the actual processing */ if (header->flags & MAD_FLAG_LSF_EXT) { unsigned char const *illegal_pos = granule[1].ch[1].scalefac; mad_fixed_t const *lsf_scale; /* intensity_scale */ lsf_scale = is_lsf_table[right_ch->scalefac_compress & 0x1]; for (sfbi = l = 0; l < 576; ++sfbi, l += n) { n = sfbwidth[sfbi]; if (!(modes[sfbi] & I_STEREO)) continue; if (illegal_pos[sfbi]) { modes[sfbi] &= ~I_STEREO; continue; } is_pos = right_ch->scalefac[sfbi]; for (i = 0; i < n; ++i) { register mad_fixed_t left; left = xr[0][l + i]; if (is_pos == 0) xr[1][l + i] = left; else { register mad_fixed_t opposite; opposite = mad_f_mul(left, lsf_scale[(is_pos - 1) / 2]); if (is_pos & 1) { xr[0][l + i] = opposite; xr[1][l + i] = left; } else xr[1][l + i] = opposite; } } } } else { /* !(header->flags & MAD_FLAG_LSF_EXT) */ for (sfbi = l = 0; l < 576; ++sfbi, l += n) { n = sfbwidth[sfbi]; if (!(modes[sfbi] & I_STEREO)) continue; is_pos = right_ch->scalefac[sfbi]; if (is_pos >= 7) { /* illegal intensity position */ modes[sfbi] &= ~I_STEREO; continue; } for (i = 0; i < n; ++i) { register mad_fixed_t left; left = xr[0][l + i]; xr[0][l + i] = mad_f_mul(left, is_table[ is_pos]); xr[1][l + i] = mad_f_mul(left, is_table[6 - is_pos]); } } } } /* middle/side stereo */ if (header->mode_extension & MS_STEREO) { register mad_fixed_t invsqrt2; header->flags |= MAD_FLAG_MS_STEREO; invsqrt2 = root_table[3 + -2]; for (sfbi = l = 0; l < 576; ++sfbi, l += n) { n = sfbwidth[sfbi]; if (modes[sfbi] != MS_STEREO) continue; for (i = 0; i < n; ++i) { register mad_fixed_t m, s; m = xr[0][l + i]; s = xr[1][l + i]; xr[0][l + i] = mad_f_mul(m + s, invsqrt2); /* l = (m + s) / sqrt(2) */ xr[1][l + i] = mad_f_mul(m - s, invsqrt2); /* r = (m - s) / sqrt(2) */ } } } return MAD_ERROR_NONE; } /* * NAME: III_aliasreduce() * DESCRIPTION: perform frequency line alias reduction */ static void III_aliasreduce(mad_fixed_t xr[576], int lines) { mad_fixed_t const *bound; int i; bound = &xr[lines]; for (xr += 18; xr < bound; xr += 18) { for (i = 0; i < 8; ++i) { register mad_fixed_t a, b; register mad_fixed64hi_t hi; register mad_fixed64lo_t lo; a = xr[-1 - i]; b = xr[ i]; # if defined(ASO_ZEROCHECK) if (a | b) { # endif MAD_F_ML0(hi, lo, a, cs[i]); MAD_F_MLA(hi, lo, -b, ca[i]); xr[-1 - i] = MAD_F_MLZ(hi, lo); MAD_F_ML0(hi, lo, b, cs[i]); MAD_F_MLA(hi, lo, a, ca[i]); xr[ i] = MAD_F_MLZ(hi, lo); # if defined(ASO_ZEROCHECK) } # endif } } } # if defined(ASO_IMDCT) void III_imdct_l(mad_fixed_t const [18], mad_fixed_t [36], unsigned int); # else # if 1 static void fastsdct(mad_fixed_t const x[9], mad_fixed_t y[18]) { mad_fixed_t a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12; mad_fixed_t a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25; mad_fixed_t m0, m1, m2, m3, m4, m5, m6, m7; enum { c0 = MAD_F(0x1f838b8d), /* 2 * cos( 1 * PI / 18) */ c1 = MAD_F(0x1bb67ae8), /* 2 * cos( 3 * PI / 18) */ c2 = MAD_F(0x18836fa3), /* 2 * cos( 4 * PI / 18) */ c3 = MAD_F(0x1491b752), /* 2 * cos( 5 * PI / 18) */ c4 = MAD_F(0x0af1d43a), /* 2 * cos( 7 * PI / 18) */ c5 = MAD_F(0x058e86a0), /* 2 * cos( 8 * PI / 18) */ c6 = -MAD_F(0x1e11f642) /* 2 * cos(16 * PI / 18) */ }; a0 = x[3] + x[5]; a1 = x[3] - x[5]; a2 = x[6] + x[2]; a3 = x[6] - x[2]; a4 = x[1] + x[7]; a5 = x[1] - x[7]; a6 = x[8] + x[0]; a7 = x[8] - x[0]; a8 = a0 + a2; a9 = a0 - a2; a10 = a0 - a6; a11 = a2 - a6; a12 = a8 + a6; a13 = a1 - a3; a14 = a13 + a7; a15 = a3 + a7; a16 = a1 - a7; a17 = a1 + a3; m0 = mad_f_mul(a17, -c3); m1 = mad_f_mul(a16, -c0); m2 = mad_f_mul(a15, -c4); m3 = mad_f_mul(a14, -c1); m4 = mad_f_mul(a5, -c1); m5 = mad_f_mul(a11, -c6); m6 = mad_f_mul(a10, -c5); m7 = mad_f_mul(a9, -c2); a18 = x[4] + a4; a19 = 2 * x[4] - a4; a20 = a19 + m5; a21 = a19 - m5; a22 = a19 + m6; a23 = m4 + m2; a24 = m4 - m2; a25 = m4 + m1; /* output to every other slot for convenience */ y[ 0] = a18 + a12; y[ 2] = m0 - a25; y[ 4] = m7 - a20; y[ 6] = m3; y[ 8] = a21 - m6; y[10] = a24 - m1; y[12] = a12 - 2 * a18; y[14] = a23 + m0; y[16] = a22 + m7; } static inline void sdctII(mad_fixed_t const x[18], mad_fixed_t X[18]) { mad_fixed_t tmp[9]; int i; /* scale[i] = 2 * cos(PI * (2 * i + 1) / (2 * 18)) */ static mad_fixed_t const scale[9] = { MAD_F(0x1fe0d3b4), MAD_F(0x1ee8dd47), MAD_F(0x1d007930), MAD_F(0x1a367e59), MAD_F(0x16a09e66), MAD_F(0x125abcf8), MAD_F(0x0d8616bc), MAD_F(0x08483ee1), MAD_F(0x02c9fad7) }; /* divide the 18-point SDCT-II into two 9-point SDCT-IIs */ /* even input butterfly */ for (i = 0; i < 9; i += 3) { tmp[i + 0] = x[i + 0] + x[18 - (i + 0) - 1]; tmp[i + 1] = x[i + 1] + x[18 - (i + 1) - 1]; tmp[i + 2] = x[i + 2] + x[18 - (i + 2) - 1]; } fastsdct(tmp, &X[0]); /* odd input butterfly and scaling */ for (i = 0; i < 9; i += 3) { tmp[i + 0] = mad_f_mul(x[i + 0] - x[18 - (i + 0) - 1], scale[i + 0]); tmp[i + 1] = mad_f_mul(x[i + 1] - x[18 - (i + 1) - 1], scale[i + 1]); tmp[i + 2] = mad_f_mul(x[i + 2] - x[18 - (i + 2) - 1], scale[i + 2]); } fastsdct(tmp, &X[1]); /* output accumulation */ for (i = 3; i < 18; i += 8) { X[i + 0] -= X[(i + 0) - 2]; X[i + 2] -= X[(i + 2) - 2]; X[i + 4] -= X[(i + 4) - 2]; X[i + 6] -= X[(i + 6) - 2]; } } static inline void dctIV(mad_fixed_t const y[18], mad_fixed_t X[18]) { mad_fixed_t tmp[18]; int i; /* scale[i] = 2 * cos(PI * (2 * i + 1) / (4 * 18)) */ static mad_fixed_t const scale[18] = { MAD_F(0x1ff833fa), MAD_F(0x1fb9ea93), MAD_F(0x1f3dd120), MAD_F(0x1e84d969), MAD_F(0x1d906bcf), MAD_F(0x1c62648b), MAD_F(0x1afd100f), MAD_F(0x1963268b), MAD_F(0x1797c6a4), MAD_F(0x159e6f5b), MAD_F(0x137af940), MAD_F(0x11318ef3), MAD_F(0x0ec6a507), MAD_F(0x0c3ef153), MAD_F(0x099f61c5), MAD_F(0x06ed12c5), MAD_F(0x042d4544), MAD_F(0x0165547c) }; /* scaling */ for (i = 0; i < 18; i += 3) { tmp[i + 0] = mad_f_mul(y[i + 0], scale[i + 0]); tmp[i + 1] = mad_f_mul(y[i + 1], scale[i + 1]); tmp[i + 2] = mad_f_mul(y[i + 2], scale[i + 2]); } /* SDCT-II */ sdctII(tmp, X); /* scale reduction and output accumulation */ X[0] /= 2; for (i = 1; i < 17; i += 4) { X[i + 0] = X[i + 0] / 2 - X[(i + 0) - 1]; X[i + 1] = X[i + 1] / 2 - X[(i + 1) - 1]; X[i + 2] = X[i + 2] / 2 - X[(i + 2) - 1]; X[i + 3] = X[i + 3] / 2 - X[(i + 3) - 1]; } X[17] = X[17] / 2 - X[16]; } /* * NAME: imdct36 * DESCRIPTION: perform X[18]->x[36] IMDCT using Szu-Wei Lee's fast algorithm */ static inline void imdct36(mad_fixed_t const x[18], mad_fixed_t y[36]) { mad_fixed_t tmp[18]; int i; /* DCT-IV */ dctIV(x, tmp); /* convert 18-point DCT-IV to 36-point IMDCT */ for (i = 0; i < 9; i += 3) { y[i + 0] = tmp[9 + (i + 0)]; y[i + 1] = tmp[9 + (i + 1)]; y[i + 2] = tmp[9 + (i + 2)]; } for (i = 9; i < 27; i += 3) { y[i + 0] = -tmp[36 - (9 + (i + 0)) - 1]; y[i + 1] = -tmp[36 - (9 + (i + 1)) - 1]; y[i + 2] = -tmp[36 - (9 + (i + 2)) - 1]; } for (i = 27; i < 36; i += 3) { y[i + 0] = -tmp[(i + 0) - 27]; y[i + 1] = -tmp[(i + 1) - 27]; y[i + 2] = -tmp[(i + 2) - 27]; } } # else /* * NAME: imdct36 * DESCRIPTION: perform X[18]->x[36] IMDCT */ static inline void imdct36(mad_fixed_t const X[18], mad_fixed_t x[36]) { mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7; mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15; register mad_fixed64hi_t hi; register mad_fixed64lo_t lo; MAD_F_ML0(hi, lo, X[4], MAD_F(0x0ec835e8)); MAD_F_MLA(hi, lo, X[13], MAD_F(0x061f78aa)); t6 = MAD_F_MLZ(hi, lo); MAD_F_MLA(hi, lo, (t14 = X[1] - X[10]), -MAD_F(0x061f78aa)); MAD_F_MLA(hi, lo, (t15 = X[7] + X[16]), -MAD_F(0x0ec835e8)); t0 = MAD_F_MLZ(hi, lo); MAD_F_MLA(hi, lo, (t8 = X[0] - X[11] - X[12]), MAD_F(0x0216a2a2)); MAD_F_MLA(hi, lo, (t9 = X[2] - X[9] - X[14]), MAD_F(0x09bd7ca0)); MAD_F_MLA(hi, lo, (t10 = X[3] - X[8] - X[15]), -MAD_F(0x0cb19346)); MAD_F_MLA(hi, lo, (t11 = X[5] - X[6] - X[17]), -MAD_F(0x0fdcf549)); x[7] = MAD_F_MLZ(hi, lo); x[10] = -x[7]; MAD_F_ML0(hi, lo, t8, -MAD_F(0x0cb19346)); MAD_F_MLA(hi, lo, t9, MAD_F(0x0fdcf549)); MAD_F_MLA(hi, lo, t10, MAD_F(0x0216a2a2)); MAD_F_MLA(hi, lo, t11, -MAD_F(0x09bd7ca0)); x[19] = x[34] = MAD_F_MLZ(hi, lo) - t0; t12 = X[0] - X[3] + X[8] - X[11] - X[12] + X[15]; t13 = X[2] + X[5] - X[6] - X[9] - X[14] - X[17]; MAD_F_ML0(hi, lo, t12, -MAD_F(0x0ec835e8)); MAD_F_MLA(hi, lo, t13, MAD_F(0x061f78aa)); x[22] = x[31] = MAD_F_MLZ(hi, lo) + t0; MAD_F_ML0(hi, lo, X[1], -MAD_F(0x09bd7ca0)); MAD_F_MLA(hi, lo, X[7], MAD_F(0x0216a2a2)); MAD_F_MLA(hi, lo, X[10], -MAD_F(0x0fdcf549)); MAD_F_MLA(hi, lo, X[16], MAD_F(0x0cb19346)); t1 = MAD_F_MLZ(hi, lo) + t6; MAD_F_ML0(hi, lo, X[0], MAD_F(0x03768962)); MAD_F_MLA(hi, lo, X[2], MAD_F(0x0e313245)); MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0ffc19fd)); MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0acf37ad)); MAD_F_MLA(hi, lo, X[6], MAD_F(0x04cfb0e2)); MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0898c779)); MAD_F_MLA(hi, lo, X[9], MAD_F(0x0d7e8807)); MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f426cb5)); MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0bcbe352)); MAD_F_MLA(hi, lo, X[14], MAD_F(0x00b2aa3e)); MAD_F_MLA(hi, lo, X[15], -MAD_F(0x07635284)); MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0f9ee890)); x[6] = MAD_F_MLZ(hi, lo) + t1; x[11] = -x[6]; MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f426cb5)); MAD_F_MLA(hi, lo, X[2], -MAD_F(0x00b2aa3e)); MAD_F_MLA(hi, lo, X[3], MAD_F(0x0898c779)); MAD_F_MLA(hi, lo, X[5], MAD_F(0x0f9ee890)); MAD_F_MLA(hi, lo, X[6], MAD_F(0x0acf37ad)); MAD_F_MLA(hi, lo, X[8], -MAD_F(0x07635284)); MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0e313245)); MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0bcbe352)); MAD_F_MLA(hi, lo, X[12], -MAD_F(0x03768962)); MAD_F_MLA(hi, lo, X[14], MAD_F(0x0d7e8807)); MAD_F_MLA(hi, lo, X[15], MAD_F(0x0ffc19fd)); MAD_F_MLA(hi, lo, X[17], MAD_F(0x04cfb0e2)); x[23] = x[30] = MAD_F_MLZ(hi, lo) + t1; MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0bcbe352)); MAD_F_MLA(hi, lo, X[2], MAD_F(0x0d7e8807)); MAD_F_MLA(hi, lo, X[3], -MAD_F(0x07635284)); MAD_F_MLA(hi, lo, X[5], MAD_F(0x04cfb0e2)); MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f9ee890)); MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0ffc19fd)); MAD_F_MLA(hi, lo, X[9], -MAD_F(0x00b2aa3e)); MAD_F_MLA(hi, lo, X[11], MAD_F(0x03768962)); MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0f426cb5)); MAD_F_MLA(hi, lo, X[14], MAD_F(0x0e313245)); MAD_F_MLA(hi, lo, X[15], MAD_F(0x0898c779)); MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0acf37ad)); x[18] = x[35] = MAD_F_MLZ(hi, lo) - t1; MAD_F_ML0(hi, lo, X[4], MAD_F(0x061f78aa)); MAD_F_MLA(hi, lo, X[13], -MAD_F(0x0ec835e8)); t7 = MAD_F_MLZ(hi, lo); MAD_F_MLA(hi, lo, X[1], -MAD_F(0x0cb19346)); MAD_F_MLA(hi, lo, X[7], MAD_F(0x0fdcf549)); MAD_F_MLA(hi, lo, X[10], MAD_F(0x0216a2a2)); MAD_F_MLA(hi, lo, X[16], -MAD_F(0x09bd7ca0)); t2 = MAD_F_MLZ(hi, lo); MAD_F_MLA(hi, lo, X[0], MAD_F(0x04cfb0e2)); MAD_F_MLA(hi, lo, X[2], MAD_F(0x0ffc19fd)); MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0d7e8807)); MAD_F_MLA(hi, lo, X[5], MAD_F(0x03768962)); MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0bcbe352)); MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0e313245)); MAD_F_MLA(hi, lo, X[9], MAD_F(0x07635284)); MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0acf37ad)); MAD_F_MLA(hi, lo, X[12], MAD_F(0x0f9ee890)); MAD_F_MLA(hi, lo, X[14], MAD_F(0x0898c779)); MAD_F_MLA(hi, lo, X[15], MAD_F(0x00b2aa3e)); MAD_F_MLA(hi, lo, X[17], MAD_F(0x0f426cb5)); x[5] = MAD_F_MLZ(hi, lo); x[12] = -x[5]; MAD_F_ML0(hi, lo, X[0], MAD_F(0x0acf37ad)); MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0898c779)); MAD_F_MLA(hi, lo, X[3], MAD_F(0x0e313245)); MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0f426cb5)); MAD_F_MLA(hi, lo, X[6], -MAD_F(0x03768962)); MAD_F_MLA(hi, lo, X[8], MAD_F(0x00b2aa3e)); MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0ffc19fd)); MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f9ee890)); MAD_F_MLA(hi, lo, X[12], -MAD_F(0x04cfb0e2)); MAD_F_MLA(hi, lo, X[14], MAD_F(0x07635284)); MAD_F_MLA(hi, lo, X[15], MAD_F(0x0d7e8807)); MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0bcbe352)); x[0] = MAD_F_MLZ(hi, lo) + t2; x[17] = -x[0]; MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f9ee890)); MAD_F_MLA(hi, lo, X[2], -MAD_F(0x07635284)); MAD_F_MLA(hi, lo, X[3], -MAD_F(0x00b2aa3e)); MAD_F_MLA(hi, lo, X[5], MAD_F(0x0bcbe352)); MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f426cb5)); MAD_F_MLA(hi, lo, X[8], MAD_F(0x0d7e8807)); MAD_F_MLA(hi, lo, X[9], MAD_F(0x0898c779)); MAD_F_MLA(hi, lo, X[11], -MAD_F(0x04cfb0e2)); MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0acf37ad)); MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0ffc19fd)); MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0e313245)); MAD_F_MLA(hi, lo, X[17], -MAD_F(0x03768962)); x[24] = x[29] = MAD_F_MLZ(hi, lo) + t2; MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0216a2a2)); MAD_F_MLA(hi, lo, X[7], -MAD_F(0x09bd7ca0)); MAD_F_MLA(hi, lo, X[10], MAD_F(0x0cb19346)); MAD_F_MLA(hi, lo, X[16], MAD_F(0x0fdcf549)); t3 = MAD_F_MLZ(hi, lo) + t7; MAD_F_ML0(hi, lo, X[0], MAD_F(0x00b2aa3e)); MAD_F_MLA(hi, lo, X[2], MAD_F(0x03768962)); MAD_F_MLA(hi, lo, X[3], -MAD_F(0x04cfb0e2)); MAD_F_MLA(hi, lo, X[5], -MAD_F(0x07635284)); MAD_F_MLA(hi, lo, X[6], MAD_F(0x0898c779)); MAD_F_MLA(hi, lo, X[8], MAD_F(0x0acf37ad)); MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0bcbe352)); MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0d7e8807)); MAD_F_MLA(hi, lo, X[12], MAD_F(0x0e313245)); MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f426cb5)); MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0f9ee890)); MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0ffc19fd)); x[8] = MAD_F_MLZ(hi, lo) + t3; x[9] = -x[8]; MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0e313245)); MAD_F_MLA(hi, lo, X[2], MAD_F(0x0bcbe352)); MAD_F_MLA(hi, lo, X[3], MAD_F(0x0f9ee890)); MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0898c779)); MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0ffc19fd)); MAD_F_MLA(hi, lo, X[8], MAD_F(0x04cfb0e2)); MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f426cb5)); MAD_F_MLA(hi, lo, X[11], -MAD_F(0x00b2aa3e)); MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0d7e8807)); MAD_F_MLA(hi, lo, X[14], -MAD_F(0x03768962)); MAD_F_MLA(hi, lo, X[15], MAD_F(0x0acf37ad)); MAD_F_MLA(hi, lo, X[17], MAD_F(0x07635284)); x[21] = x[32] = MAD_F_MLZ(hi, lo) + t3; MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0d7e8807)); MAD_F_MLA(hi, lo, X[2], MAD_F(0x0f426cb5)); MAD_F_MLA(hi, lo, X[3], MAD_F(0x0acf37ad)); MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0ffc19fd)); MAD_F_MLA(hi, lo, X[6], -MAD_F(0x07635284)); MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f9ee890)); MAD_F_MLA(hi, lo, X[9], MAD_F(0x03768962)); MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0e313245)); MAD_F_MLA(hi, lo, X[12], MAD_F(0x00b2aa3e)); MAD_F_MLA(hi, lo, X[14], MAD_F(0x0bcbe352)); MAD_F_MLA(hi, lo, X[15], -MAD_F(0x04cfb0e2)); MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0898c779)); x[20] = x[33] = MAD_F_MLZ(hi, lo) - t3; MAD_F_ML0(hi, lo, t14, -MAD_F(0x0ec835e8)); MAD_F_MLA(hi, lo, t15, MAD_F(0x061f78aa)); t4 = MAD_F_MLZ(hi, lo) - t7; MAD_F_ML0(hi, lo, t12, MAD_F(0x061f78aa)); MAD_F_MLA(hi, lo, t13, MAD_F(0x0ec835e8)); x[4] = MAD_F_MLZ(hi, lo) + t4; x[13] = -x[4]; MAD_F_ML0(hi, lo, t8, MAD_F(0x09bd7ca0)); MAD_F_MLA(hi, lo, t9, -MAD_F(0x0216a2a2)); MAD_F_MLA(hi, lo, t10, MAD_F(0x0fdcf549)); MAD_F_MLA(hi, lo, t11, -MAD_F(0x0cb19346)); x[1] = MAD_F_MLZ(hi, lo) + t4; x[16] = -x[1]; MAD_F_ML0(hi, lo, t8, -MAD_F(0x0fdcf549)); MAD_F_MLA(hi, lo, t9, -MAD_F(0x0cb19346)); MAD_F_MLA(hi, lo, t10, -MAD_F(0x09bd7ca0)); MAD_F_MLA(hi, lo, t11, -MAD_F(0x0216a2a2)); x[25] = x[28] = MAD_F_MLZ(hi, lo) + t4; MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0fdcf549)); MAD_F_MLA(hi, lo, X[7], -MAD_F(0x0cb19346)); MAD_F_MLA(hi, lo, X[10], -MAD_F(0x09bd7ca0)); MAD_F_MLA(hi, lo, X[16], -MAD_F(0x0216a2a2)); t5 = MAD_F_MLZ(hi, lo) - t6; MAD_F_ML0(hi, lo, X[0], MAD_F(0x0898c779)); MAD_F_MLA(hi, lo, X[2], MAD_F(0x04cfb0e2)); MAD_F_MLA(hi, lo, X[3], MAD_F(0x0bcbe352)); MAD_F_MLA(hi, lo, X[5], MAD_F(0x00b2aa3e)); MAD_F_MLA(hi, lo, X[6], MAD_F(0x0e313245)); MAD_F_MLA(hi, lo, X[8], -MAD_F(0x03768962)); MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f9ee890)); MAD_F_MLA(hi, lo, X[11], -MAD_F(0x07635284)); MAD_F_MLA(hi, lo, X[12], MAD_F(0x0ffc19fd)); MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0acf37ad)); MAD_F_MLA(hi, lo, X[15], MAD_F(0x0f426cb5)); MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0d7e8807)); x[2] = MAD_F_MLZ(hi, lo) + t5; x[15] = -x[2]; MAD_F_ML0(hi, lo, X[0], MAD_F(0x07635284)); MAD_F_MLA(hi, lo, X[2], MAD_F(0x0acf37ad)); MAD_F_MLA(hi, lo, X[3], MAD_F(0x03768962)); MAD_F_MLA(hi, lo, X[5], MAD_F(0x0d7e8807)); MAD_F_MLA(hi, lo, X[6], -MAD_F(0x00b2aa3e)); MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f426cb5)); MAD_F_MLA(hi, lo, X[9], -MAD_F(0x04cfb0e2)); MAD_F_MLA(hi, lo, X[11], MAD_F(0x0ffc19fd)); MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0898c779)); MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f9ee890)); MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0bcbe352)); MAD_F_MLA(hi, lo, X[17], MAD_F(0x0e313245)); x[3] = MAD_F_MLZ(hi, lo) + t5; x[14] = -x[3]; MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0ffc19fd)); MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0f9ee890)); MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0f426cb5)); MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0e313245)); MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0d7e8807)); MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0bcbe352)); MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0acf37ad)); MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0898c779)); MAD_F_MLA(hi, lo, X[12], -MAD_F(0x07635284)); MAD_F_MLA(hi, lo, X[14], -MAD_F(0x04cfb0e2)); MAD_F_MLA(hi, lo, X[15], -MAD_F(0x03768962)); MAD_F_MLA(hi, lo, X[17], -MAD_F(0x00b2aa3e)); x[26] = x[27] = MAD_F_MLZ(hi, lo) + t5; } # endif /* * NAME: III_imdct_l() * DESCRIPTION: perform IMDCT and windowing for long blocks */ static void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36], unsigned int block_type) { unsigned int i; /* IMDCT */ imdct36(X, z); /* windowing */ switch (block_type) { case 0: /* normal window */ # if defined(ASO_INTERLEAVE1) { register mad_fixed_t tmp1, tmp2; tmp1 = window_l[0]; tmp2 = window_l[1]; for (i = 0; i < 34; i += 2) { z[i + 0] = mad_f_mul(z[i + 0], tmp1); tmp1 = window_l[i + 2]; z[i + 1] = mad_f_mul(z[i + 1], tmp2); tmp2 = window_l[i + 3]; } z[34] = mad_f_mul(z[34], tmp1); z[35] = mad_f_mul(z[35], tmp2); } # elif defined(ASO_INTERLEAVE2) { register mad_fixed_t tmp1, tmp2; tmp1 = z[0]; tmp2 = window_l[0]; for (i = 0; i < 35; ++i) { z[i] = mad_f_mul(tmp1, tmp2); tmp1 = z[i + 1]; tmp2 = window_l[i + 1]; } z[35] = mad_f_mul(tmp1, tmp2); } # elif 1 for (i = 0; i < 36; i += 4) { z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]); z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]); z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]); z[i + 3] = mad_f_mul(z[i + 3], window_l[i + 3]); } # else for (i = 0; i < 36; ++i) z[i] = mad_f_mul(z[i], window_l[i]); # endif break; case 1: /* start block */ for (i = 0; i < 18; i += 3) { z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]); z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]); z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]); } /* (i = 18; i < 24; ++i) z[i] unchanged */ for (i = 24; i < 30; ++i) z[i] = mad_f_mul(z[i], window_s[i - 18]); for (i = 30; i < 36; ++i) z[i] = 0; break; case 3: /* stop block */ for (i = 0; i < 6; ++i) z[i] = 0; for (i = 6; i < 12; ++i) z[i] = mad_f_mul(z[i], window_s[i - 6]); /* (i = 12; i < 18; ++i) z[i] unchanged */ for (i = 18; i < 36; i += 3) { z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]); z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]); z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]); } break; } } # endif /* ASO_IMDCT */ /* * NAME: III_imdct_s() * DESCRIPTION: perform IMDCT and windowing for short blocks */ static void III_imdct_s(mad_fixed_t const X[18], mad_fixed_t z[36]) { mad_fixed_t y[36], *yptr; mad_fixed_t const *wptr; int w, i; register mad_fixed64hi_t hi; register mad_fixed64lo_t lo; /* IMDCT */ yptr = &y[0]; for (w = 0; w < 3; ++w) { register mad_fixed_t const (*s)[6]; s = imdct_s; for (i = 0; i < 3; ++i) { MAD_F_ML0(hi, lo, X[0], (*s)[0]); MAD_F_MLA(hi, lo, X[1], (*s)[1]); MAD_F_MLA(hi, lo, X[2], (*s)[2]); MAD_F_MLA(hi, lo, X[3], (*s)[3]); MAD_F_MLA(hi, lo, X[4], (*s)[4]); MAD_F_MLA(hi, lo, X[5], (*s)[5]); yptr[i + 0] = MAD_F_MLZ(hi, lo); yptr[5 - i] = -yptr[i + 0]; ++s; MAD_F_ML0(hi, lo, X[0], (*s)[0]); MAD_F_MLA(hi, lo, X[1], (*s)[1]); MAD_F_MLA(hi, lo, X[2], (*s)[2]); MAD_F_MLA(hi, lo, X[3], (*s)[3]); MAD_F_MLA(hi, lo, X[4], (*s)[4]); MAD_F_MLA(hi, lo, X[5], (*s)[5]); yptr[ i + 6] = MAD_F_MLZ(hi, lo); yptr[11 - i] = yptr[i + 6]; ++s; } yptr += 12; X += 6; } /* windowing, overlapping and concatenation */ yptr = &y[0]; wptr = &window_s[0]; for (i = 0; i < 6; ++i) { z[i + 0] = 0; z[i + 6] = mad_f_mul(yptr[ 0 + 0], wptr[0]); MAD_F_ML0(hi, lo, yptr[ 0 + 6], wptr[6]); MAD_F_MLA(hi, lo, yptr[12 + 0], wptr[0]); z[i + 12] = MAD_F_MLZ(hi, lo); MAD_F_ML0(hi, lo, yptr[12 + 6], wptr[6]); MAD_F_MLA(hi, lo, yptr[24 + 0], wptr[0]); z[i + 18] = MAD_F_MLZ(hi, lo); z[i + 24] = mad_f_mul(yptr[24 + 6], wptr[6]); z[i + 30] = 0; ++yptr; ++wptr; } } /* * NAME: III_overlap() * DESCRIPTION: perform overlap-add of windowed IMDCT outputs */ static void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], mad_fixed_t sample[18][32], unsigned int sb) { unsigned int i; # if defined(ASO_INTERLEAVE2) { register mad_fixed_t tmp1, tmp2; tmp1 = overlap[0]; tmp2 = overlap[1]; for (i = 0; i < 16; i += 2) { sample[i + 0][sb] = output[i + 0 + 0] + tmp1; overlap[i + 0] = output[i + 0 + 18]; tmp1 = overlap[i + 2]; sample[i + 1][sb] = output[i + 1 + 0] + tmp2; overlap[i + 1] = output[i + 1 + 18]; tmp2 = overlap[i + 3]; } sample[16][sb] = output[16 + 0] + tmp1; overlap[16] = output[16 + 18]; sample[17][sb] = output[17 + 0] + tmp2; overlap[17] = output[17 + 18]; } # elif 0 for (i = 0; i < 18; i += 2) { sample[i + 0][sb] = output[i + 0 + 0] + overlap[i + 0]; overlap[i + 0] = output[i + 0 + 18]; sample[i + 1][sb] = output[i + 1 + 0] + overlap[i + 1]; overlap[i + 1] = output[i + 1 + 18]; } # else for (i = 0; i < 18; ++i) { sample[i][sb] = output[i + 0] + overlap[i]; overlap[i] = output[i + 18]; } # endif } /* * NAME: III_overlap_z() * DESCRIPTION: perform "overlap-add" of zero IMDCT outputs */ static inline void III_overlap_z(mad_fixed_t overlap[18], mad_fixed_t sample[18][32], unsigned int sb) { unsigned int i; # if defined(ASO_INTERLEAVE2) { register mad_fixed_t tmp1, tmp2; tmp1 = overlap[0]; tmp2 = overlap[1]; for (i = 0; i < 16; i += 2) { sample[i + 0][sb] = tmp1; overlap[i + 0] = 0; tmp1 = overlap[i + 2]; sample[i + 1][sb] = tmp2; overlap[i + 1] = 0; tmp2 = overlap[i + 3]; } sample[16][sb] = tmp1; overlap[16] = 0; sample[17][sb] = tmp2; overlap[17] = 0; } # else for (i = 0; i < 18; ++i) { sample[i][sb] = overlap[i]; overlap[i] = 0; } # endif } /* * NAME: III_freqinver() * DESCRIPTION: perform subband frequency inversion for odd sample lines */ static void III_freqinver(mad_fixed_t sample[18][32], unsigned int sb) { unsigned int i; # if 1 || defined(ASO_INTERLEAVE1) || defined(ASO_INTERLEAVE2) { register mad_fixed_t tmp1, tmp2; tmp1 = sample[1][sb]; tmp2 = sample[3][sb]; for (i = 1; i < 13; i += 4) { sample[i + 0][sb] = -tmp1; tmp1 = sample[i + 4][sb]; sample[i + 2][sb] = -tmp2; tmp2 = sample[i + 6][sb]; } sample[13][sb] = -tmp1; tmp1 = sample[17][sb]; sample[15][sb] = -tmp2; sample[17][sb] = -tmp1; } # else for (i = 1; i < 18; i += 2) sample[i][sb] = -sample[i][sb]; # endif } /* * NAME: III_decode() * DESCRIPTION: decode frame main_data */ static enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, struct sideinfo *si, unsigned int nch) { struct mad_header *header = &frame->header; unsigned int sfreqi, ngr, gr; { unsigned int sfreq; sfreq = header->samplerate; if (header->flags & MAD_FLAG_MPEG_2_5_EXT) sfreq *= 2; /* 48000 => 0, 44100 => 1, 32000 => 2, 24000 => 3, 22050 => 4, 16000 => 5 */ sfreqi = ((sfreq >> 7) & 0x000f) + ((sfreq >> 15) & 0x0001) - 8; if (header->flags & MAD_FLAG_MPEG_2_5_EXT) sfreqi += 3; } /* scalefactors, Huffman decoding, requantization */ ngr = (header->flags & MAD_FLAG_LSF_EXT) ? 1 : 2; for (gr = 0; gr < ngr; ++gr) { struct granule *granule = &si->gr[gr]; unsigned char const *sfbwidth[2]; mad_fixed_t xr[2][576]; unsigned int ch; enum mad_error error; for (ch = 0; ch < nch; ++ch) { struct channel *channel = &granule->ch[ch]; unsigned int part2_length; sfbwidth[ch] = sfbwidth_table[sfreqi].l; if (channel->block_type == 2) { sfbwidth[ch] = (channel->flags & mixed_block_flag) ? sfbwidth_table[sfreqi].m : sfbwidth_table[sfreqi].s; } if (header->flags & MAD_FLAG_LSF_EXT) { part2_length = III_scalefactors_lsf(ptr, channel, ch == 0 ? 0 : &si->gr[1].ch[1], header->mode_extension); } else { part2_length = III_scalefactors(ptr, channel, &si->gr[0].ch[ch], gr == 0 ? 0 : si->scfsi[ch]); } error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part2_length); if (error) return error; } /* joint stereo processing */ if (header->mode == MAD_MODE_JOINT_STEREO && header->mode_extension) { error = III_stereo(xr, granule, header, sfbwidth[0]); if (error) return error; } /* reordering, alias reduction, IMDCT, overlap-add, frequency inversion */ for (ch = 0; ch < nch; ++ch) { struct channel const *channel = &granule->ch[ch]; mad_fixed_t (*sample)[32] = &frame->sbsample[ch][18 * gr]; unsigned int sb, l, i, sblimit; mad_fixed_t output[36]; if (channel->block_type == 2) { III_reorder(xr[ch], channel, sfbwidth[ch]); # if !defined(OPT_STRICT) /* * According to ISO/IEC 11172-3, "Alias reduction is not applied for * granules with block_type == 2 (short block)." However, other * sources suggest alias reduction should indeed be performed on the * lower two subbands of mixed blocks. Most other implementations do * this, so by default we will too. */ if (channel->flags & mixed_block_flag) III_aliasreduce(xr[ch], 36); # endif } else III_aliasreduce(xr[ch], 576); l = 0; /* subbands 0-1 */ if (channel->block_type != 2 || (channel->flags & mixed_block_flag)) { unsigned int block_type; block_type = channel->block_type; if (channel->flags & mixed_block_flag) block_type = 0; /* long blocks */ for (sb = 0; sb < 2; ++sb, l += 18) { III_imdct_l(&xr[ch][l], output, block_type); III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); } } else { /* short blocks */ for (sb = 0; sb < 2; ++sb, l += 18) { III_imdct_s(&xr[ch][l], output); III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); } } III_freqinver(sample, 1); /* (nonzero) subbands 2-31 */ i = 576; while (i > 36 && xr[ch][i - 1] == 0) --i; sblimit = 32 - (576 - i) / 18; if (channel->block_type != 2) { /* long blocks */ for (sb = 2; sb < sblimit; ++sb, l += 18) { III_imdct_l(&xr[ch][l], output, channel->block_type); III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); if (sb & 1) III_freqinver(sample, sb); } } else { /* short blocks */ for (sb = 2; sb < sblimit; ++sb, l += 18) { III_imdct_s(&xr[ch][l], output); III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); if (sb & 1) III_freqinver(sample, sb); } } /* remaining (zero) subbands */ for (sb = sblimit; sb < 32; ++sb) { III_overlap_z((*frame->overlap)[ch][sb], sample, sb); if (sb & 1) III_freqinver(sample, sb); } } } return MAD_ERROR_NONE; } /* * NAME: layer->III() * DESCRIPTION: decode a single Layer III frame */ int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) { struct mad_header *header = &frame->header; unsigned int nch, priv_bitlen, next_md_begin = 0; unsigned int si_len, data_bitlen, md_len; unsigned int frame_space, frame_used, frame_free; struct mad_bitptr ptr; struct sideinfo si; enum mad_error error; int result = 0; /* allocate Layer III dynamic structures */ if (stream->main_data == 0) { stream->main_data = malloc(MAD_BUFFER_MDLEN); if (stream->main_data == 0) { stream->error = MAD_ERROR_NOMEM; return -1; } } if (frame->overlap == 0) { frame->overlap = calloc(2 * 32 * 18, sizeof(mad_fixed_t)); if (frame->overlap == 0) { stream->error = MAD_ERROR_NOMEM; return -1; } } nch = MAD_NCHANNELS(header); si_len = (header->flags & MAD_FLAG_LSF_EXT) ? (nch == 1 ? 9 : 17) : (nch == 1 ? 17 : 32); /* check frame sanity */ if (stream->next_frame - mad_bit_nextbyte(&stream->ptr) < (signed int) si_len) { stream->error = MAD_ERROR_BADFRAMELEN; stream->md_len = 0; return -1; } /* check CRC word */ if (header->flags & MAD_FLAG_PROTECTION) { header->crc_check = mad_bit_crc(stream->ptr, si_len * CHAR_BIT, header->crc_check); if (header->crc_check != header->crc_target && !(frame->options & MAD_OPTION_IGNORECRC)) { stream->error = MAD_ERROR_BADCRC; result = -1; } } /* decode frame side information */ error = III_sideinfo(&stream->ptr, nch, header->flags & MAD_FLAG_LSF_EXT, &si, &data_bitlen, &priv_bitlen); if (error && result == 0) { stream->error = error; result = -1; } header->flags |= priv_bitlen; header->private_bits |= si.private_bits; /* find main_data of next frame */ { struct mad_bitptr peek; unsigned long header; mad_bit_init(&peek, stream->next_frame); header = mad_bit_read(&peek, 32); if ((header & 0xffe60000L) /* syncword | layer */ == 0xffe20000L) { if (!(header & 0x00010000L)) /* protection_bit */ mad_bit_skip(&peek, 16); /* crc_check */ next_md_begin = mad_bit_read(&peek, (header & 0x00080000L) /* ID */ ? 9 : 8); } mad_bit_finish(&peek); } /* find main_data of this frame */ frame_space = stream->next_frame - mad_bit_nextbyte(&stream->ptr); if (next_md_begin > si.main_data_begin + frame_space) next_md_begin = 0; md_len = si.main_data_begin + frame_space - next_md_begin; frame_used = 0; if (si.main_data_begin == 0) { ptr = stream->ptr; stream->md_len = 0; frame_used = md_len; } else { if (si.main_data_begin > stream->md_len) { if (result == 0) { stream->error = MAD_ERROR_BADDATAPTR; result = -1; } } else { mad_bit_init(&ptr, *stream->main_data + stream->md_len - si.main_data_begin); if (md_len > si.main_data_begin) { assert(stream->md_len + md_len - si.main_data_begin <= MAD_BUFFER_MDLEN); memcpy(*stream->main_data + stream->md_len, mad_bit_nextbyte(&stream->ptr), frame_used = md_len - si.main_data_begin); stream->md_len += frame_used; } } } frame_free = frame_space - frame_used; /* decode main_data */ if (result == 0) { error = III_decode(&ptr, frame, &si, nch); if (error) { stream->error = error; result = -1; } /* designate ancillary bits */ stream->anc_ptr = ptr; stream->anc_bitlen = md_len * CHAR_BIT - data_bitlen; } # if 0 && defined(DEBUG) fprintf(stderr, "main_data_begin:%u, md_len:%u, frame_free:%u, " "data_bitlen:%u, anc_bitlen: %u\n", si.main_data_begin, md_len, frame_free, data_bitlen, stream->anc_bitlen); # endif /* preload main_data buffer with up to 511 bytes for next frame(s) */ if (frame_free >= next_md_begin) { memcpy(*stream->main_data, stream->next_frame - next_md_begin, next_md_begin); stream->md_len = next_md_begin; } else { if (md_len < si.main_data_begin) { unsigned int extra; extra = si.main_data_begin - md_len; if (extra + frame_free > next_md_begin) extra = next_md_begin - frame_free; if (extra < stream->md_len) { memmove(*stream->main_data, *stream->main_data + stream->md_len - extra, extra); stream->md_len = extra; } } else stream->md_len = 0; memcpy(*stream->main_data + stream->md_len, stream->next_frame - frame_free, frame_free); stream->md_len += frame_free; } return result; } avifile-0.7.48~20090503.ds/plugins/libmad/libmad/layer3.h0000644000175000017500000000201510403657206021453 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: layer3.h,v 1.2 2006/03/08 22:45:26 kabi Exp $ */ # ifndef LIBMAD_LAYER3_H # define LIBMAD_LAYER3_H # include "stream.h" # include "frame.h" int mad_layer_III(struct mad_stream *, struct mad_frame *); # endif avifile-0.7.48~20090503.ds/plugins/libmad/libmad/mad.h0000644000175000017500000006500010403657206021020 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * If you would like to negotiate alternate licensing terms, you may do * so by contacting: Underbit Technologies, Inc. */ # ifdef __cplusplus extern "C" { # endif #if 0 # define FPM_INTEL # define SIZEOF_INT 4 # define SIZEOF_LONG 4 # define SIZEOF_LONG_LONG 8 /* Id: version.h,v 1.26 2004/01/23 09:41:33 rob Exp */ # ifndef LIBMAD_VERSION_H # define LIBMAD_VERSION_H # define MAD_VERSION_MAJOR 0 # define MAD_VERSION_MINOR 15 # define MAD_VERSION_PATCH 1 # define MAD_VERSION_EXTRA " (beta)" # define MAD_VERSION_STRINGIZE(str) #str # define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num) # define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ MAD_VERSION_STRING(MAD_VERSION_PATCH) \ MAD_VERSION_EXTRA # define MAD_PUBLISHYEAR "2000-2004" # define MAD_AUTHOR "Underbit Technologies, Inc." # define MAD_EMAIL "info@underbit.com" #endif extern char const mad_version[]; extern char const mad_copyright[]; extern char const mad_author[]; extern char const mad_build[]; # endif /* Id: fixed.h,v 1.38 2004/02/17 02:02:03 rob Exp */ # ifndef LIBMAD_FIXED_H # define LIBMAD_FIXED_H # if SIZEOF_INT >= 4 typedef signed int mad_fixed_t; typedef signed int mad_fixed64hi_t; typedef unsigned int mad_fixed64lo_t; # else typedef signed long mad_fixed_t; typedef signed long mad_fixed64hi_t; typedef unsigned long mad_fixed64lo_t; # endif # if defined(_MSC_VER) # define mad_fixed64_t signed __int64 # elif 1 || defined(__GNUC__) # define mad_fixed64_t signed long long # endif # if defined(FPM_FLOAT) typedef double mad_sample_t; # else typedef mad_fixed_t mad_sample_t; # endif /* * Fixed-point format: 0xABBBBBBB * A == whole part (sign + 3 bits) * B == fractional part (28 bits) * * Values are signed two's complement, so the effective range is: * 0x80000000 to 0x7fffffff * -8.0 to +7.9999999962747097015380859375 * * The smallest representable value is: * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9) * * 28 bits of fractional accuracy represent about * 8.6 digits of decimal accuracy. * * Fixed-point numbers can be added or subtracted as normal * integers, but multiplication requires shifting the 64-bit result * from 56 fractional bits back to 28 (and rounding.) * * Changing the definition of MAD_F_FRACBITS is only partially * supported, and must be done with care. */ # define MAD_F_FRACBITS 28 # if MAD_F_FRACBITS == 28 # define MAD_F(x) ((mad_fixed_t) (x##L)) # else # if MAD_F_FRACBITS < 28 # warning "MAD_F_FRACBITS < 28" # define MAD_F(x) ((mad_fixed_t) \ (((x##L) + \ (1L << (28 - MAD_F_FRACBITS - 1))) >> \ (28 - MAD_F_FRACBITS))) # elif MAD_F_FRACBITS > 28 # error "MAD_F_FRACBITS > 28 not currently supported" # define MAD_F(x) ((mad_fixed_t) \ ((x##L) << (MAD_F_FRACBITS - 28))) # endif # endif # define MAD_F_MIN ((mad_fixed_t) -0x80000000L) # define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) # define MAD_F_ONE MAD_F(0x10000000) # define mad_f_tofixed(x) ((mad_fixed_t) \ ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) # define mad_f_todouble(x) ((double) \ ((x) / (double) (1L << MAD_F_FRACBITS))) # define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS) # define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1)) /* (x should be positive) */ # define mad_f_fromint(x) ((x) << MAD_F_FRACBITS) # define mad_f_add(x, y) ((x) + (y)) # define mad_f_sub(x, y) ((x) - (y)) # if defined(FPM_FLOAT) # error "FPM_FLOAT not yet supported" # undef MAD_F # define MAD_F(x) mad_f_todouble(x) # define mad_f_mul(x, y) ((x) * (y)) # define mad_f_scale64 # undef ASO_ZEROCHECK # elif defined(FPM_64BIT) /* * This version should be the most accurate if 64-bit types are supported by * the compiler, although it may not be the most efficient. */ # if defined(OPT_ACCURACY) # define mad_f_mul(x, y) \ ((mad_fixed_t) \ ((((mad_fixed64_t) (x) * (y)) + \ (1L << (MAD_F_SCALEBITS - 1))) >> MAD_F_SCALEBITS)) # else # define mad_f_mul(x, y) \ ((mad_fixed_t) (((mad_fixed64_t) (x) * (y)) >> MAD_F_SCALEBITS)) # endif # define MAD_F_SCALEBITS MAD_F_FRACBITS /* --- Intel --------------------------------------------------------------- */ # elif defined(FPM_INTEL) # if defined(_MSC_VER) # pragma warning(push) # pragma warning(disable: 4035) /* no return value */ static __forceinline mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) { enum { fracbits = MAD_F_FRACBITS }; __asm { mov eax, x imul y shrd eax, edx, fracbits } /* implicit return of eax */ } # pragma warning(pop) # define mad_f_mul mad_f_mul_inline # define mad_f_scale64 # else /* * This Intel version is fast and accurate; the disposition of the least * significant bit depends on OPT_ACCURACY via mad_f_scale64(). */ # define MAD_F_MLX(hi, lo, x, y) \ asm ("imull %3" \ : "=a" (lo), "=d" (hi) \ : "%a" (x), "rm" (y) \ : "cc") # if defined(OPT_ACCURACY) /* * This gives best accuracy but is not very fast. */ # define MAD_F_MLA(hi, lo, x, y) \ ({ mad_fixed64hi_t __hi; \ mad_fixed64lo_t __lo; \ MAD_F_MLX(__hi, __lo, (x), (y)); \ asm ("addl %2,%0\n\t" \ "adcl %3,%1" \ : "=rm" (lo), "=rm" (hi) \ : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ : "cc"); \ }) # endif /* OPT_ACCURACY */ # if defined(OPT_ACCURACY) /* * Surprisingly, this is faster than SHRD followed by ADC. */ # define mad_f_scale64(hi, lo) \ ({ mad_fixed64hi_t __hi_; \ mad_fixed64lo_t __lo_; \ mad_fixed_t __result; \ asm ("addl %4,%2\n\t" \ "adcl %5,%3" \ : "=rm" (__lo_), "=rm" (__hi_) \ : "0" (lo), "1" (hi), \ "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ : "cc"); \ asm ("shrdl %3,%2,%1" \ : "=rm" (__result) \ : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ : "cc"); \ __result; \ }) # elif defined(OPT_INTEL) /* * Alternate Intel scaling that may or may not perform better. */ # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result; \ asm ("shrl %3,%1\n\t" \ "shll %4,%2\n\t" \ "orl %2,%1" \ : "=rm" (__result) \ : "0" (lo), "r" (hi), \ "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ : "cc"); \ __result; \ }) # else # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result; \ asm ("shrdl %3,%2,%1" \ : "=rm" (__result) \ : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ : "cc"); \ __result; \ }) # endif /* OPT_ACCURACY */ # define MAD_F_SCALEBITS MAD_F_FRACBITS # endif /* --- ARM ----------------------------------------------------------------- */ # elif defined(FPM_ARM) /* * This ARM V4 version is as accurate as FPM_64BIT but much faster. The * least significant bit is properly rounded at no CPU cycle cost! */ # if 1 /* * This is faster than the default implementation via MAD_F_MLX() and * mad_f_scale64(). */ # define mad_f_mul(x, y) \ ({ mad_fixed64hi_t __hi; \ mad_fixed64lo_t __lo; \ mad_fixed_t __result; \ asm ("smull %0, %1, %3, %4\n\t" \ "movs %0, %0, lsr %5\n\t" \ "adc %2, %0, %1, lsl %6" \ : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ : "%r" (x), "r" (y), \ "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ : "cc"); \ __result; \ }) # endif # define MAD_F_MLX(hi, lo, x, y) \ asm ("smull %0, %1, %2, %3" \ : "=&r" (lo), "=&r" (hi) \ : "%r" (x), "r" (y)) # define MAD_F_MLA(hi, lo, x, y) \ asm ("smlal %0, %1, %2, %3" \ : "+r" (lo), "+r" (hi) \ : "%r" (x), "r" (y)) # define MAD_F_MLN(hi, lo) \ asm ("rsbs %0, %2, #0\n\t" \ "rsc %1, %3, #0" \ : "=r" (lo), "=r" (hi) \ : "0" (lo), "1" (hi) \ : "cc") # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result; \ asm ("movs %0, %1, lsr %3\n\t" \ "adc %0, %0, %2, lsl %4" \ : "=&r" (__result) \ : "r" (lo), "r" (hi), \ "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ : "cc"); \ __result; \ }) # define MAD_F_SCALEBITS MAD_F_FRACBITS /* --- MIPS ---------------------------------------------------------------- */ # elif defined(FPM_MIPS) /* * This MIPS version is fast and accurate; the disposition of the least * significant bit depends on OPT_ACCURACY via mad_f_scale64(). */ # define MAD_F_MLX(hi, lo, x, y) \ asm ("mult %2,%3" \ : "=l" (lo), "=h" (hi) \ : "%r" (x), "r" (y)) # if defined(HAVE_MADD_ASM) # define MAD_F_MLA(hi, lo, x, y) \ asm ("madd %2,%3" \ : "+l" (lo), "+h" (hi) \ : "%r" (x), "r" (y)) # elif defined(HAVE_MADD16_ASM) /* * This loses significant accuracy due to the 16-bit integer limit in the * multiply/accumulate instruction. */ # define MAD_F_ML0(hi, lo, x, y) \ asm ("mult %2,%3" \ : "=l" (lo), "=h" (hi) \ : "%r" ((x) >> 12), "r" ((y) >> 16)) # define MAD_F_MLA(hi, lo, x, y) \ asm ("madd16 %2,%3" \ : "+l" (lo), "+h" (hi) \ : "%r" ((x) >> 12), "r" ((y) >> 16)) # define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo)) # endif # if defined(OPT_SPEED) # define mad_f_scale64(hi, lo) \ ((mad_fixed_t) ((hi) << (32 - MAD_F_SCALEBITS))) # define MAD_F_SCALEBITS MAD_F_FRACBITS # endif /* --- SPARC --------------------------------------------------------------- */ # elif defined(FPM_SPARC) /* * This SPARC V8 version is fast and accurate; the disposition of the least * significant bit depends on OPT_ACCURACY via mad_f_scale64(). */ # define MAD_F_MLX(hi, lo, x, y) \ asm ("smul %2, %3, %0\n\t" \ "rd %%y, %1" \ : "=r" (lo), "=r" (hi) \ : "%r" (x), "rI" (y)) /* --- PowerPC ------------------------------------------------------------- */ # elif defined(FPM_PPC) /* * This PowerPC version is fast and accurate; the disposition of the least * significant bit depends on OPT_ACCURACY via mad_f_scale64(). */ # define MAD_F_MLX(hi, lo, x, y) \ do { \ asm ("mullw %0,%1,%2" \ : "=r" (lo) \ : "%r" (x), "r" (y)); \ asm ("mulhw %0,%1,%2" \ : "=r" (hi) \ : "%r" (x), "r" (y)); \ } \ while (0) # if defined(OPT_ACCURACY) /* * This gives best accuracy but is not very fast. */ # define MAD_F_MLA(hi, lo, x, y) \ ({ mad_fixed64hi_t __hi; \ mad_fixed64lo_t __lo; \ MAD_F_MLX(__hi, __lo, (x), (y)); \ asm ("addc %0,%2,%3\n\t" \ "adde %1,%4,%5" \ : "=r" (lo), "=r" (hi) \ : "%r" (lo), "r" (__lo), \ "%r" (hi), "r" (__hi) \ : "xer"); \ }) # endif # if defined(OPT_ACCURACY) /* * This is slower than the truncating version below it. */ # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result, __round; \ asm ("rotrwi %0,%1,%2" \ : "=r" (__result) \ : "r" (lo), "i" (MAD_F_SCALEBITS)); \ asm ("extrwi %0,%1,1,0" \ : "=r" (__round) \ : "r" (__result)); \ asm ("insrwi %0,%1,%2,0" \ : "+r" (__result) \ : "r" (hi), "i" (MAD_F_SCALEBITS)); \ asm ("add %0,%1,%2" \ : "=r" (__result) \ : "%r" (__result), "r" (__round)); \ __result; \ }) # else # define mad_f_scale64(hi, lo) \ ({ mad_fixed_t __result; \ asm ("rotrwi %0,%1,%2" \ : "=r" (__result) \ : "r" (lo), "i" (MAD_F_SCALEBITS)); \ asm ("insrwi %0,%1,%2,0" \ : "+r" (__result) \ : "r" (hi), "i" (MAD_F_SCALEBITS)); \ __result; \ }) # endif # define MAD_F_SCALEBITS MAD_F_FRACBITS /* --- Default ------------------------------------------------------------- */ # elif defined(FPM_DEFAULT) /* * This version is the most portable but it loses significant accuracy. * Furthermore, accuracy is biased against the second argument, so care * should be taken when ordering operands. * * The scale factors are constant as this is not used with SSO. * * Pre-rounding is required to stay within the limits of compliance. */ # if defined(OPT_SPEED) # define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16)) # else # define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \ (((y) + (1L << 15)) >> 16)) # endif /* ------------------------------------------------------------------------- */ # else # error "no FPM selected" # endif /* default implementations */ # if !defined(mad_f_mul) # define mad_f_mul(x, y) \ ({ register mad_fixed64hi_t __hi; \ register mad_fixed64lo_t __lo; \ MAD_F_MLX(__hi, __lo, (x), (y)); \ mad_f_scale64(__hi, __lo); \ }) # endif # if !defined(MAD_F_MLA) # define MAD_F_ML0(hi, lo, x, y) ((lo) = mad_f_mul((x), (y))) # define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y))) # define MAD_F_MLN(hi, lo) ((lo) = -(lo)) # define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) # endif # if !defined(MAD_F_ML0) # define MAD_F_ML0(hi, lo, x, y) MAD_F_MLX((hi), (lo), (x), (y)) # endif # if !defined(MAD_F_MLN) # define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) # endif # if !defined(MAD_F_MLZ) # define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) # endif # if !defined(mad_f_scale64) # if defined(OPT_ACCURACY) # define mad_f_scale64(hi, lo) \ ((((mad_fixed_t) \ (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \ ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) # else # define mad_f_scale64(hi, lo) \ ((mad_fixed_t) \ (((hi) << (32 - MAD_F_SCALEBITS)) | \ ((lo) >> MAD_F_SCALEBITS))) # endif # define MAD_F_SCALEBITS MAD_F_FRACBITS # endif /* C routines */ mad_fixed_t mad_f_abs(mad_fixed_t); mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t); # endif /* Id: bit.h,v 1.12 2004/01/23 09:41:32 rob Exp */ # ifndef LIBMAD_BIT_H # define LIBMAD_BIT_H struct mad_bitptr { unsigned char const *byte; unsigned short cache; unsigned short left; }; void mad_bit_init(struct mad_bitptr *, unsigned char const *); # define mad_bit_finish(bitptr) /* nothing */ unsigned int mad_bit_length(struct mad_bitptr const *, struct mad_bitptr const *); # define mad_bit_bitsleft(bitptr) ((bitptr)->left) unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *); void mad_bit_skip(struct mad_bitptr *, unsigned int); unsigned long mad_bit_read(struct mad_bitptr *, unsigned int); void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long); unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short); # endif /* Id: timer.h,v 1.16 2004/01/23 09:41:33 rob Exp */ # ifndef LIBMAD_TIMER_H # define LIBMAD_TIMER_H typedef struct { signed long seconds; /* whole seconds */ unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */ } mad_timer_t; extern mad_timer_t const mad_timer_zero; # define MAD_TIMER_RESOLUTION 352800000UL enum mad_units { MAD_UNITS_HOURS = -2, MAD_UNITS_MINUTES = -1, MAD_UNITS_SECONDS = 0, /* metric units */ MAD_UNITS_DECISECONDS = 10, MAD_UNITS_CENTISECONDS = 100, MAD_UNITS_MILLISECONDS = 1000, /* audio sample units */ MAD_UNITS_8000_HZ = 8000, MAD_UNITS_11025_HZ = 11025, MAD_UNITS_12000_HZ = 12000, MAD_UNITS_16000_HZ = 16000, MAD_UNITS_22050_HZ = 22050, MAD_UNITS_24000_HZ = 24000, MAD_UNITS_32000_HZ = 32000, MAD_UNITS_44100_HZ = 44100, MAD_UNITS_48000_HZ = 48000, /* video frame/field units */ MAD_UNITS_24_FPS = 24, MAD_UNITS_25_FPS = 25, MAD_UNITS_30_FPS = 30, MAD_UNITS_48_FPS = 48, MAD_UNITS_50_FPS = 50, MAD_UNITS_60_FPS = 60, /* CD audio frames */ MAD_UNITS_75_FPS = 75, /* video drop-frame units */ MAD_UNITS_23_976_FPS = -24, MAD_UNITS_24_975_FPS = -25, MAD_UNITS_29_97_FPS = -30, MAD_UNITS_47_952_FPS = -48, MAD_UNITS_49_95_FPS = -50, MAD_UNITS_59_94_FPS = -60 }; # define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero)) int mad_timer_compare(mad_timer_t, mad_timer_t); # define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero) void mad_timer_negate(mad_timer_t *); mad_timer_t mad_timer_abs(mad_timer_t); void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long); void mad_timer_add(mad_timer_t *, mad_timer_t); void mad_timer_multiply(mad_timer_t *, signed long); signed long mad_timer_count(mad_timer_t, enum mad_units); unsigned long mad_timer_fraction(mad_timer_t, unsigned long); void mad_timer_string(mad_timer_t, char *, char const *, enum mad_units, enum mad_units, unsigned long); # endif /* Id: stream.h,v 1.20 2004/02/05 09:02:39 rob Exp */ # ifndef LIBMAD_STREAM_H # define LIBMAD_STREAM_H # define MAD_BUFFER_GUARD 8 # define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD) enum mad_error { MAD_ERROR_NONE = 0x0000, /* no error */ MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */ MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */ MAD_ERROR_NOMEM = 0x0031, /* not enough memory */ MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */ MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */ MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */ MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */ MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */ MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */ MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */ MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */ MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */ MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */ MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */ MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */ MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */ MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */ MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */ MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */ MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */ MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */ }; # define MAD_RECOVERABLE(error) ((error) & 0xff00) struct mad_stream { unsigned char const *buffer; /* input bitstream buffer */ unsigned char const *bufend; /* end of buffer */ unsigned long skiplen; /* bytes to skip before next frame */ int sync; /* stream sync found */ unsigned long freerate; /* free bitrate (fixed) */ unsigned char const *this_frame; /* start of current frame */ unsigned char const *next_frame; /* start of next frame */ struct mad_bitptr ptr; /* current processing bit pointer */ struct mad_bitptr anc_ptr; /* ancillary bits pointer */ unsigned int anc_bitlen; /* number of ancillary bits */ unsigned char (*main_data)[MAD_BUFFER_MDLEN]; /* Layer III main_data() */ unsigned int md_len; /* bytes in main_data */ int options; /* decoding options (see below) */ enum mad_error error; /* error code (see above) */ }; enum { MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */ MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */ # if 0 /* not yet implemented */ MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */ MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */ MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */ # endif }; void mad_stream_init(struct mad_stream *); void mad_stream_finish(struct mad_stream *); # define mad_stream_options(stream, opts) \ ((void) ((stream)->options = (opts))) void mad_stream_buffer(struct mad_stream *, unsigned char const *, unsigned long); void mad_stream_skip(struct mad_stream *, unsigned long); int mad_stream_sync(struct mad_stream *); char const *mad_stream_errorstr(struct mad_stream const *); # endif /* Id: frame.h,v 1.20 2004/01/23 09:41:32 rob Exp */ # ifndef LIBMAD_FRAME_H # define LIBMAD_FRAME_H enum mad_layer { MAD_LAYER_I = 1, /* Layer I */ MAD_LAYER_II = 2, /* Layer II */ MAD_LAYER_III = 3 /* Layer III */ }; enum mad_mode { MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */ MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */ MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */ MAD_MODE_STEREO = 3 /* normal LR stereo */ }; enum mad_emphasis { MAD_EMPHASIS_NONE = 0, /* no emphasis */ MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */ MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */ }; struct mad_header { enum mad_layer layer; /* audio layer (1, 2, or 3) */ enum mad_mode mode; /* channel mode (see above) */ int mode_extension; /* additional mode info */ enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ unsigned long bitrate; /* stream bitrate (bps) */ unsigned int samplerate; /* sampling frequency (Hz) */ unsigned short crc_check; /* frame CRC accumulator */ unsigned short crc_target; /* final target CRC checksum */ int flags; /* flags (see below) */ int private_bits; /* private bits (see below) */ mad_timer_t duration; /* audio playing time of frame */ }; struct mad_frame { struct mad_header header; /* MPEG audio header */ int options; /* decoding options (from stream) */ mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */ mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */ }; # define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1) # define MAD_NSBSAMPLES(header) \ ((header)->layer == MAD_LAYER_I ? 12 : \ (((header)->layer == MAD_LAYER_III && \ ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36)) enum { MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */ MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */ MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */ MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */ MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */ MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */ MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */ MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */ MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */ MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */ MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */ MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */ }; enum { MAD_PRIVATE_HEADER = 0x0100, /* header private bit */ MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */ }; void mad_header_init(struct mad_header *); # define mad_header_finish(header) /* nothing */ int mad_header_decode(struct mad_header *, struct mad_stream *); void mad_frame_init(struct mad_frame *); void mad_frame_finish(struct mad_frame *); int mad_frame_decode(struct mad_frame *, struct mad_stream *); void mad_frame_mute(struct mad_frame *); # endif /* Id: synth.h,v 1.15 2004/01/23 09:41:33 rob Exp */ # ifndef LIBMAD_SYNTH_H # define LIBMAD_SYNTH_H struct mad_pcm { unsigned int samplerate; /* sampling frequency (Hz) */ unsigned short channels; /* number of channels */ unsigned short length; /* number of samples per channel */ mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */ }; struct mad_synth { mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */ /* [ch][eo][peo][s][v] */ unsigned int phase; /* current processing phase */ struct mad_pcm pcm; /* PCM output */ }; /* single channel PCM selector */ enum { MAD_PCM_CHANNEL_SINGLE = 0 }; /* dual channel PCM selector */ enum { MAD_PCM_CHANNEL_DUAL_1 = 0, MAD_PCM_CHANNEL_DUAL_2 = 1 }; /* stereo PCM selector */ enum { MAD_PCM_CHANNEL_STEREO_LEFT = 0, MAD_PCM_CHANNEL_STEREO_RIGHT = 1 }; void mad_synth_init(struct mad_synth *); # define mad_synth_finish(synth) /* nothing */ void mad_synth_mute(struct mad_synth *); void mad_synth_frame(struct mad_synth *, struct mad_frame const *); # endif /* Id: decoder.h,v 1.17 2004/01/23 09:41:32 rob Exp */ # ifndef LIBMAD_DECODER_H # define LIBMAD_DECODER_H enum mad_decoder_mode { MAD_DECODER_MODE_SYNC = 0, MAD_DECODER_MODE_ASYNC }; enum mad_flow { MAD_FLOW_CONTINUE = 0x0000, /* continue normally */ MAD_FLOW_STOP = 0x0010, /* stop decoding normally */ MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */ MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */ }; struct mad_decoder { enum mad_decoder_mode mode; int options; struct { long pid; int in; int out; } async; struct { struct mad_stream stream; struct mad_frame frame; struct mad_synth synth; } *sync; void *cb_data; enum mad_flow (*input_func)(void *, struct mad_stream *); enum mad_flow (*header_func)(void *, struct mad_header const *); enum mad_flow (*filter_func)(void *, struct mad_stream const *, struct mad_frame *); enum mad_flow (*output_func)(void *, struct mad_header const *, struct mad_pcm *); enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); enum mad_flow (*message_func)(void *, void *, unsigned int *); }; void mad_decoder_init(struct mad_decoder *, void *, enum mad_flow (*)(void *, struct mad_stream *), enum mad_flow (*)(void *, struct mad_header const *), enum mad_flow (*)(void *, struct mad_stream const *, struct mad_frame *), enum mad_flow (*)(void *, struct mad_header const *, struct mad_pcm *), enum mad_flow (*)(void *, struct mad_stream *, struct mad_frame *), enum mad_flow (*)(void *, void *, unsigned int *)); int mad_decoder_finish(struct mad_decoder *); # define mad_decoder_options(decoder, opts) \ ((void) ((decoder)->options = (opts))) int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode); int mad_decoder_message(struct mad_decoder *, void *, unsigned int *); # endif # ifdef __cplusplus } # endif avifile-0.7.48~20090503.ds/plugins/libmad/libmad/qc_table.dat0000644000175000017500000000762410403657206022362 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: qc_table.dat,v 1.2 2006/03/08 22:45:26 kabi Exp $ */ /* * These are the Layer II classes of quantization. * The table is derived from Table B.4 of ISO/IEC 11172-3. */ { 3, 2, 5, MAD_F(0x15555555) /* 1.33333333333 => 1.33333333209, e 0.00000000124 */, MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ }, { 5, 3, 7, MAD_F(0x1999999a) /* 1.60000000000 => 1.60000000149, e -0.00000000149 */, MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ }, { 7, 0, 3, MAD_F(0x12492492) /* 1.14285714286 => 1.14285714179, e 0.00000000107 */, MAD_F(0x04000000) /* 0.25000000000 => 0.25000000000, e 0.00000000000 */ }, { 9, 4, 10, MAD_F(0x1c71c71c) /* 1.77777777777 => 1.77777777612, e 0.00000000165 */, MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ }, { 15, 0, 4, MAD_F(0x11111111) /* 1.06666666666 => 1.06666666642, e 0.00000000024 */, MAD_F(0x02000000) /* 0.12500000000 => 0.12500000000, e 0.00000000000 */ }, { 31, 0, 5, MAD_F(0x10842108) /* 1.03225806452 => 1.03225806355, e 0.00000000097 */, MAD_F(0x01000000) /* 0.06250000000 => 0.06250000000, e 0.00000000000 */ }, { 63, 0, 6, MAD_F(0x10410410) /* 1.01587301587 => 1.01587301493, e 0.00000000094 */, MAD_F(0x00800000) /* 0.03125000000 => 0.03125000000, e 0.00000000000 */ }, { 127, 0, 7, MAD_F(0x10204081) /* 1.00787401575 => 1.00787401572, e 0.00000000003 */, MAD_F(0x00400000) /* 0.01562500000 => 0.01562500000, e 0.00000000000 */ }, { 255, 0, 8, MAD_F(0x10101010) /* 1.00392156863 => 1.00392156839, e 0.00000000024 */, MAD_F(0x00200000) /* 0.00781250000 => 0.00781250000, e 0.00000000000 */ }, { 511, 0, 9, MAD_F(0x10080402) /* 1.00195694716 => 1.00195694715, e 0.00000000001 */, MAD_F(0x00100000) /* 0.00390625000 => 0.00390625000, e 0.00000000000 */ }, { 1023, 0, 10, MAD_F(0x10040100) /* 1.00097751711 => 1.00097751617, e 0.00000000094 */, MAD_F(0x00080000) /* 0.00195312500 => 0.00195312500, e 0.00000000000 */ }, { 2047, 0, 11, MAD_F(0x10020040) /* 1.00048851979 => 1.00048851967, e 0.00000000012 */, MAD_F(0x00040000) /* 0.00097656250 => 0.00097656250, e 0.00000000000 */ }, { 4095, 0, 12, MAD_F(0x10010010) /* 1.00024420024 => 1.00024420023, e 0.00000000001 */, MAD_F(0x00020000) /* 0.00048828125 => 0.00048828125, e 0.00000000000 */ }, { 8191, 0, 13, MAD_F(0x10008004) /* 1.00012208522 => 1.00012208521, e 0.00000000001 */, MAD_F(0x00010000) /* 0.00024414063 => 0.00024414062, e 0.00000000000 */ }, { 16383, 0, 14, MAD_F(0x10004001) /* 1.00006103888 => 1.00006103888, e -0.00000000000 */, MAD_F(0x00008000) /* 0.00012207031 => 0.00012207031, e -0.00000000000 */ }, { 32767, 0, 15, MAD_F(0x10002000) /* 1.00003051851 => 1.00003051758, e 0.00000000093 */, MAD_F(0x00004000) /* 0.00006103516 => 0.00006103516, e 0.00000000000 */ }, { 65535, 0, 16, MAD_F(0x10001000) /* 1.00001525902 => 1.00001525879, e 0.00000000023 */, MAD_F(0x00002000) /* 0.00003051758 => 0.00003051758, e 0.00000000000 */ } avifile-0.7.48~20090503.ds/plugins/libmad/libmad/rq_table.dat0000644000175000017500000166477010403657206022415 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: rq_table.dat,v 1.2 2006/03/08 22:45:26 kabi Exp $ */ /* * This is the lookup table used to compute x^(4/3) for Layer III * requantization. To maintain the best possible accuracy, the value is * stored as a normalized mantissa with exponent. The requantization * algorithm recombines these parts with appropriate scaling. */ /* 0 */ { MAD_F(0x00000000) /* 0.000000000 */, 0 }, /* 1 */ { MAD_F(0x04000000) /* 0.250000000 */, 2 }, /* 2 */ { MAD_F(0x050a28be) /* 0.314980262 */, 3 }, /* 3 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 4 }, /* 4 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 4 }, /* 5 */ { MAD_F(0x04466275) /* 0.267183742 */, 5 }, /* 6 */ { MAD_F(0x05738c72) /* 0.340710111 */, 5 }, /* 7 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 5 }, /* 8 */ { MAD_F(0x04000000) /* 0.250000000 */, 6 }, /* 9 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 6 }, /* 10 */ { MAD_F(0x0562d694) /* 0.336630420 */, 6 }, /* 11 */ { MAD_F(0x061dae96) /* 0.382246578 */, 6 }, /* 12 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 6 }, /* 13 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 6 }, /* 14 */ { MAD_F(0x0437be65) /* 0.263609310 */, 7 }, /* 15 */ { MAD_F(0x049fc824) /* 0.289009227 */, 7 }, /* 16 */ { MAD_F(0x050a28be) /* 0.314980262 */, 7 }, /* 17 */ { MAD_F(0x0576c6f5) /* 0.341498336 */, 7 }, /* 18 */ { MAD_F(0x05e58c0b) /* 0.368541759 */, 7 }, /* 19 */ { MAD_F(0x06566361) /* 0.396090870 */, 7 }, /* 20 */ { MAD_F(0x06c93a2e) /* 0.424127753 */, 7 }, /* 21 */ { MAD_F(0x073dff3e) /* 0.452635998 */, 7 }, /* 22 */ { MAD_F(0x07b4a2bc) /* 0.481600510 */, 7 }, /* 23 */ { MAD_F(0x04168b05) /* 0.255503674 */, 8 }, /* 24 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 8 }, /* 25 */ { MAD_F(0x04919b6a) /* 0.285548607 */, 8 }, /* 26 */ { MAD_F(0x04d065fb) /* 0.300878507 */, 8 }, /* 27 */ { MAD_F(0x05100000) /* 0.316406250 */, 8 }, /* 28 */ { MAD_F(0x05506451) /* 0.332126919 */, 8 }, /* 29 */ { MAD_F(0x05918e15) /* 0.348035890 */, 8 }, /* 30 */ { MAD_F(0x05d378bb) /* 0.364128809 */, 8 }, /* 31 */ { MAD_F(0x06161ff3) /* 0.380401563 */, 8 }, /* 32 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 8 }, /* 33 */ { MAD_F(0x069d9400) /* 0.413471222 */, 8 }, /* 34 */ { MAD_F(0x06e2594c) /* 0.430260942 */, 8 }, /* 35 */ { MAD_F(0x0727cc11) /* 0.447216097 */, 8 }, /* 36 */ { MAD_F(0x076de8fc) /* 0.464333519 */, 8 }, /* 37 */ { MAD_F(0x07b4ace3) /* 0.481610189 */, 8 }, /* 38 */ { MAD_F(0x07fc14bf) /* 0.499043224 */, 8 }, /* 39 */ { MAD_F(0x04220ed7) /* 0.258314934 */, 9 }, /* 40 */ { MAD_F(0x04466275) /* 0.267183742 */, 9 }, /* 41 */ { MAD_F(0x046b03e7) /* 0.276126771 */, 9 }, /* 42 */ { MAD_F(0x048ff1e8) /* 0.285142811 */, 9 }, /* 43 */ { MAD_F(0x04b52b3f) /* 0.294230696 */, 9 }, /* 44 */ { MAD_F(0x04daaec0) /* 0.303389310 */, 9 }, /* 45 */ { MAD_F(0x05007b49) /* 0.312617576 */, 9 }, /* 46 */ { MAD_F(0x05268fc6) /* 0.321914457 */, 9 }, /* 47 */ { MAD_F(0x054ceb2a) /* 0.331278957 */, 9 }, /* 48 */ { MAD_F(0x05738c72) /* 0.340710111 */, 9 }, /* 49 */ { MAD_F(0x059a72a5) /* 0.350206992 */, 9 }, /* 50 */ { MAD_F(0x05c19cd3) /* 0.359768701 */, 9 }, /* 51 */ { MAD_F(0x05e90a12) /* 0.369394372 */, 9 }, /* 52 */ { MAD_F(0x0610b982) /* 0.379083164 */, 9 }, /* 53 */ { MAD_F(0x0638aa48) /* 0.388834268 */, 9 }, /* 54 */ { MAD_F(0x0660db91) /* 0.398646895 */, 9 }, /* 55 */ { MAD_F(0x06894c90) /* 0.408520284 */, 9 }, /* 56 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 9 }, /* 57 */ { MAD_F(0x06daeaa1) /* 0.428446415 */, 9 }, /* 58 */ { MAD_F(0x07041636) /* 0.438497744 */, 9 }, /* 59 */ { MAD_F(0x072d7e8b) /* 0.448607009 */, 9 }, /* 60 */ { MAD_F(0x075722ef) /* 0.458773552 */, 9 }, /* 61 */ { MAD_F(0x078102b8) /* 0.468996735 */, 9 }, /* 62 */ { MAD_F(0x07ab1d3e) /* 0.479275937 */, 9 }, /* 63 */ { MAD_F(0x07d571e0) /* 0.489610555 */, 9 }, /* 64 */ { MAD_F(0x04000000) /* 0.250000000 */, 10 }, /* 65 */ { MAD_F(0x04156381) /* 0.255221850 */, 10 }, /* 66 */ { MAD_F(0x042ae32a) /* 0.260470548 */, 10 }, /* 67 */ { MAD_F(0x04407eb1) /* 0.265745823 */, 10 }, /* 68 */ { MAD_F(0x045635cf) /* 0.271047409 */, 10 }, /* 69 */ { MAD_F(0x046c083e) /* 0.276375048 */, 10 }, /* 70 */ { MAD_F(0x0481f5bb) /* 0.281728487 */, 10 }, /* 71 */ { MAD_F(0x0497fe03) /* 0.287107481 */, 10 }, /* 72 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 10 }, /* 73 */ { MAD_F(0x04c45df6) /* 0.297941173 */, 10 }, /* 74 */ { MAD_F(0x04dab524) /* 0.303395408 */, 10 }, /* 75 */ { MAD_F(0x04f12624) /* 0.308874267 */, 10 }, /* 76 */ { MAD_F(0x0507b0bc) /* 0.314377532 */, 10 }, /* 77 */ { MAD_F(0x051e54b1) /* 0.319904987 */, 10 }, /* 78 */ { MAD_F(0x053511cb) /* 0.325456423 */, 10 }, /* 79 */ { MAD_F(0x054be7d4) /* 0.331031635 */, 10 }, /* 80 */ { MAD_F(0x0562d694) /* 0.336630420 */, 10 }, /* 81 */ { MAD_F(0x0579ddd8) /* 0.342252584 */, 10 }, /* 82 */ { MAD_F(0x0590fd6c) /* 0.347897931 */, 10 }, /* 83 */ { MAD_F(0x05a8351c) /* 0.353566275 */, 10 }, /* 84 */ { MAD_F(0x05bf84b8) /* 0.359257429 */, 10 }, /* 85 */ { MAD_F(0x05d6ec0e) /* 0.364971213 */, 10 }, /* 86 */ { MAD_F(0x05ee6aef) /* 0.370707448 */, 10 }, /* 87 */ { MAD_F(0x0606012b) /* 0.376465960 */, 10 }, /* 88 */ { MAD_F(0x061dae96) /* 0.382246578 */, 10 }, /* 89 */ { MAD_F(0x06357302) /* 0.388049134 */, 10 }, /* 90 */ { MAD_F(0x064d4e43) /* 0.393873464 */, 10 }, /* 91 */ { MAD_F(0x0665402d) /* 0.399719406 */, 10 }, /* 92 */ { MAD_F(0x067d4896) /* 0.405586801 */, 10 }, /* 93 */ { MAD_F(0x06956753) /* 0.411475493 */, 10 }, /* 94 */ { MAD_F(0x06ad9c3d) /* 0.417385331 */, 10 }, /* 95 */ { MAD_F(0x06c5e72b) /* 0.423316162 */, 10 }, /* 96 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 10 }, /* 97 */ { MAD_F(0x06f6be73) /* 0.435240221 */, 10 }, /* 98 */ { MAD_F(0x070f4a80) /* 0.441233161 */, 10 }, /* 99 */ { MAD_F(0x0727ebf7) /* 0.447246519 */, 10 }, /* 100 */ { MAD_F(0x0740a2b2) /* 0.453280160 */, 10 }, /* 101 */ { MAD_F(0x07596e8d) /* 0.459333946 */, 10 }, /* 102 */ { MAD_F(0x07724f64) /* 0.465407744 */, 10 }, /* 103 */ { MAD_F(0x078b4514) /* 0.471501425 */, 10 }, /* 104 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 10 }, /* 105 */ { MAD_F(0x07bd6e75) /* 0.483747918 */, 10 }, /* 106 */ { MAD_F(0x07d6a1e2) /* 0.489900479 */, 10 }, /* 107 */ { MAD_F(0x07efe9a1) /* 0.496072418 */, 10 }, /* 108 */ { MAD_F(0x0404a2c9) /* 0.251131807 */, 11 }, /* 109 */ { MAD_F(0x04115aca) /* 0.254236974 */, 11 }, /* 110 */ { MAD_F(0x041e1cc4) /* 0.257351652 */, 11 }, /* 111 */ { MAD_F(0x042ae8a7) /* 0.260475783 */, 11 }, /* 112 */ { MAD_F(0x0437be65) /* 0.263609310 */, 11 }, /* 113 */ { MAD_F(0x04449dee) /* 0.266752177 */, 11 }, /* 114 */ { MAD_F(0x04518733) /* 0.269904329 */, 11 }, /* 115 */ { MAD_F(0x045e7a26) /* 0.273065710 */, 11 }, /* 116 */ { MAD_F(0x046b76b9) /* 0.276236269 */, 11 }, /* 117 */ { MAD_F(0x04787cdc) /* 0.279415952 */, 11 }, /* 118 */ { MAD_F(0x04858c83) /* 0.282604707 */, 11 }, /* 119 */ { MAD_F(0x0492a59f) /* 0.285802482 */, 11 }, /* 120 */ { MAD_F(0x049fc824) /* 0.289009227 */, 11 }, /* 121 */ { MAD_F(0x04acf402) /* 0.292224893 */, 11 }, /* 122 */ { MAD_F(0x04ba292e) /* 0.295449429 */, 11 }, /* 123 */ { MAD_F(0x04c7679a) /* 0.298682788 */, 11 }, /* 124 */ { MAD_F(0x04d4af3a) /* 0.301924921 */, 11 }, /* 125 */ { MAD_F(0x04e20000) /* 0.305175781 */, 11 }, /* 126 */ { MAD_F(0x04ef59e0) /* 0.308435322 */, 11 }, /* 127 */ { MAD_F(0x04fcbcce) /* 0.311703498 */, 11 }, /* 128 */ { MAD_F(0x050a28be) /* 0.314980262 */, 11 }, /* 129 */ { MAD_F(0x05179da4) /* 0.318265572 */, 11 }, /* 130 */ { MAD_F(0x05251b73) /* 0.321559381 */, 11 }, /* 131 */ { MAD_F(0x0532a220) /* 0.324861647 */, 11 }, /* 132 */ { MAD_F(0x054031a0) /* 0.328172327 */, 11 }, /* 133 */ { MAD_F(0x054dc9e7) /* 0.331491377 */, 11 }, /* 134 */ { MAD_F(0x055b6ae9) /* 0.334818756 */, 11 }, /* 135 */ { MAD_F(0x0569149c) /* 0.338154423 */, 11 }, /* 136 */ { MAD_F(0x0576c6f5) /* 0.341498336 */, 11 }, /* 137 */ { MAD_F(0x058481e9) /* 0.344850455 */, 11 }, /* 138 */ { MAD_F(0x0592456d) /* 0.348210741 */, 11 }, /* 139 */ { MAD_F(0x05a01176) /* 0.351579152 */, 11 }, /* 140 */ { MAD_F(0x05ade5fa) /* 0.354955651 */, 11 }, /* 141 */ { MAD_F(0x05bbc2ef) /* 0.358340200 */, 11 }, /* 142 */ { MAD_F(0x05c9a84a) /* 0.361732758 */, 11 }, /* 143 */ { MAD_F(0x05d79601) /* 0.365133291 */, 11 }, /* 144 */ { MAD_F(0x05e58c0b) /* 0.368541759 */, 11 }, /* 145 */ { MAD_F(0x05f38a5d) /* 0.371958126 */, 11 }, /* 146 */ { MAD_F(0x060190ee) /* 0.375382356 */, 11 }, /* 147 */ { MAD_F(0x060f9fb3) /* 0.378814413 */, 11 }, /* 148 */ { MAD_F(0x061db6a5) /* 0.382254261 */, 11 }, /* 149 */ { MAD_F(0x062bd5b8) /* 0.385701865 */, 11 }, /* 150 */ { MAD_F(0x0639fce4) /* 0.389157191 */, 11 }, /* 151 */ { MAD_F(0x06482c1f) /* 0.392620204 */, 11 }, /* 152 */ { MAD_F(0x06566361) /* 0.396090870 */, 11 }, /* 153 */ { MAD_F(0x0664a2a0) /* 0.399569155 */, 11 }, /* 154 */ { MAD_F(0x0672e9d4) /* 0.403055027 */, 11 }, /* 155 */ { MAD_F(0x068138f3) /* 0.406548452 */, 11 }, /* 156 */ { MAD_F(0x068f8ff5) /* 0.410049398 */, 11 }, /* 157 */ { MAD_F(0x069deed1) /* 0.413557833 */, 11 }, /* 158 */ { MAD_F(0x06ac557f) /* 0.417073724 */, 11 }, /* 159 */ { MAD_F(0x06bac3f6) /* 0.420597041 */, 11 }, /* 160 */ { MAD_F(0x06c93a2e) /* 0.424127753 */, 11 }, /* 161 */ { MAD_F(0x06d7b81f) /* 0.427665827 */, 11 }, /* 162 */ { MAD_F(0x06e63dc0) /* 0.431211234 */, 11 }, /* 163 */ { MAD_F(0x06f4cb09) /* 0.434763944 */, 11 }, /* 164 */ { MAD_F(0x07035ff3) /* 0.438323927 */, 11 }, /* 165 */ { MAD_F(0x0711fc75) /* 0.441891153 */, 11 }, /* 166 */ { MAD_F(0x0720a087) /* 0.445465593 */, 11 }, /* 167 */ { MAD_F(0x072f4c22) /* 0.449047217 */, 11 }, /* 168 */ { MAD_F(0x073dff3e) /* 0.452635998 */, 11 }, /* 169 */ { MAD_F(0x074cb9d3) /* 0.456231906 */, 11 }, /* 170 */ { MAD_F(0x075b7bdb) /* 0.459834914 */, 11 }, /* 171 */ { MAD_F(0x076a454c) /* 0.463444993 */, 11 }, /* 172 */ { MAD_F(0x07791620) /* 0.467062117 */, 11 }, /* 173 */ { MAD_F(0x0787ee50) /* 0.470686258 */, 11 }, /* 174 */ { MAD_F(0x0796cdd4) /* 0.474317388 */, 11 }, /* 175 */ { MAD_F(0x07a5b4a5) /* 0.477955481 */, 11 }, /* 176 */ { MAD_F(0x07b4a2bc) /* 0.481600510 */, 11 }, /* 177 */ { MAD_F(0x07c39812) /* 0.485252449 */, 11 }, /* 178 */ { MAD_F(0x07d294a0) /* 0.488911273 */, 11 }, /* 179 */ { MAD_F(0x07e1985f) /* 0.492576954 */, 11 }, /* 180 */ { MAD_F(0x07f0a348) /* 0.496249468 */, 11 }, /* 181 */ { MAD_F(0x07ffb554) /* 0.499928790 */, 11 }, /* 182 */ { MAD_F(0x0407673f) /* 0.251807447 */, 12 }, /* 183 */ { MAD_F(0x040ef75e) /* 0.253653877 */, 12 }, /* 184 */ { MAD_F(0x04168b05) /* 0.255503674 */, 12 }, /* 185 */ { MAD_F(0x041e2230) /* 0.257356825 */, 12 }, /* 186 */ { MAD_F(0x0425bcdd) /* 0.259213318 */, 12 }, /* 187 */ { MAD_F(0x042d5b07) /* 0.261073141 */, 12 }, /* 188 */ { MAD_F(0x0434fcad) /* 0.262936282 */, 12 }, /* 189 */ { MAD_F(0x043ca1c9) /* 0.264802730 */, 12 }, /* 190 */ { MAD_F(0x04444a5a) /* 0.266672472 */, 12 }, /* 191 */ { MAD_F(0x044bf65d) /* 0.268545497 */, 12 }, /* 192 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 12 }, /* 193 */ { MAD_F(0x045b58a9) /* 0.272301352 */, 12 }, /* 194 */ { MAD_F(0x04630eed) /* 0.274184158 */, 12 }, /* 195 */ { MAD_F(0x046ac896) /* 0.276070203 */, 12 }, /* 196 */ { MAD_F(0x047285a2) /* 0.277959474 */, 12 }, /* 197 */ { MAD_F(0x047a460c) /* 0.279851960 */, 12 }, /* 198 */ { MAD_F(0x048209d3) /* 0.281747652 */, 12 }, /* 199 */ { MAD_F(0x0489d0f4) /* 0.283646538 */, 12 }, /* 200 */ { MAD_F(0x04919b6a) /* 0.285548607 */, 12 }, /* 201 */ { MAD_F(0x04996935) /* 0.287453849 */, 12 }, /* 202 */ { MAD_F(0x04a13a50) /* 0.289362253 */, 12 }, /* 203 */ { MAD_F(0x04a90eba) /* 0.291273810 */, 12 }, /* 204 */ { MAD_F(0x04b0e66e) /* 0.293188507 */, 12 }, /* 205 */ { MAD_F(0x04b8c16c) /* 0.295106336 */, 12 }, /* 206 */ { MAD_F(0x04c09faf) /* 0.297027285 */, 12 }, /* 207 */ { MAD_F(0x04c88135) /* 0.298951346 */, 12 }, /* 208 */ { MAD_F(0x04d065fb) /* 0.300878507 */, 12 }, /* 209 */ { MAD_F(0x04d84dff) /* 0.302808759 */, 12 }, /* 210 */ { MAD_F(0x04e0393e) /* 0.304742092 */, 12 }, /* 211 */ { MAD_F(0x04e827b6) /* 0.306678497 */, 12 }, /* 212 */ { MAD_F(0x04f01963) /* 0.308617963 */, 12 }, /* 213 */ { MAD_F(0x04f80e44) /* 0.310560480 */, 12 }, /* 214 */ { MAD_F(0x05000655) /* 0.312506041 */, 12 }, /* 215 */ { MAD_F(0x05080195) /* 0.314454634 */, 12 }, /* 216 */ { MAD_F(0x05100000) /* 0.316406250 */, 12 }, /* 217 */ { MAD_F(0x05180194) /* 0.318360880 */, 12 }, /* 218 */ { MAD_F(0x0520064f) /* 0.320318516 */, 12 }, /* 219 */ { MAD_F(0x05280e2d) /* 0.322279147 */, 12 }, /* 220 */ { MAD_F(0x0530192e) /* 0.324242764 */, 12 }, /* 221 */ { MAD_F(0x0538274e) /* 0.326209359 */, 12 }, /* 222 */ { MAD_F(0x0540388a) /* 0.328178922 */, 12 }, /* 223 */ { MAD_F(0x05484ce2) /* 0.330151445 */, 12 }, /* 224 */ { MAD_F(0x05506451) /* 0.332126919 */, 12 }, /* 225 */ { MAD_F(0x05587ed5) /* 0.334105334 */, 12 }, /* 226 */ { MAD_F(0x05609c6e) /* 0.336086683 */, 12 }, /* 227 */ { MAD_F(0x0568bd17) /* 0.338070956 */, 12 }, /* 228 */ { MAD_F(0x0570e0cf) /* 0.340058145 */, 12 }, /* 229 */ { MAD_F(0x05790793) /* 0.342048241 */, 12 }, /* 230 */ { MAD_F(0x05813162) /* 0.344041237 */, 12 }, /* 231 */ { MAD_F(0x05895e39) /* 0.346037122 */, 12 }, /* 232 */ { MAD_F(0x05918e15) /* 0.348035890 */, 12 }, /* 233 */ { MAD_F(0x0599c0f4) /* 0.350037532 */, 12 }, /* 234 */ { MAD_F(0x05a1f6d5) /* 0.352042040 */, 12 }, /* 235 */ { MAD_F(0x05aa2fb5) /* 0.354049405 */, 12 }, /* 236 */ { MAD_F(0x05b26b92) /* 0.356059619 */, 12 }, /* 237 */ { MAD_F(0x05baaa69) /* 0.358072674 */, 12 }, /* 238 */ { MAD_F(0x05c2ec39) /* 0.360088563 */, 12 }, /* 239 */ { MAD_F(0x05cb3100) /* 0.362107278 */, 12 }, /* 240 */ { MAD_F(0x05d378bb) /* 0.364128809 */, 12 }, /* 241 */ { MAD_F(0x05dbc368) /* 0.366153151 */, 12 }, /* 242 */ { MAD_F(0x05e41105) /* 0.368180294 */, 12 }, /* 243 */ { MAD_F(0x05ec6190) /* 0.370210231 */, 12 }, /* 244 */ { MAD_F(0x05f4b507) /* 0.372242955 */, 12 }, /* 245 */ { MAD_F(0x05fd0b68) /* 0.374278458 */, 12 }, /* 246 */ { MAD_F(0x060564b1) /* 0.376316732 */, 12 }, /* 247 */ { MAD_F(0x060dc0e0) /* 0.378357769 */, 12 }, /* 248 */ { MAD_F(0x06161ff3) /* 0.380401563 */, 12 }, /* 249 */ { MAD_F(0x061e81e8) /* 0.382448106 */, 12 }, /* 250 */ { MAD_F(0x0626e6bc) /* 0.384497391 */, 12 }, /* 251 */ { MAD_F(0x062f4e6f) /* 0.386549409 */, 12 }, /* 252 */ { MAD_F(0x0637b8fd) /* 0.388604155 */, 12 }, /* 253 */ { MAD_F(0x06402666) /* 0.390661620 */, 12 }, /* 254 */ { MAD_F(0x064896a7) /* 0.392721798 */, 12 }, /* 255 */ { MAD_F(0x065109be) /* 0.394784681 */, 12 }, /* 256 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 12 }, /* 257 */ { MAD_F(0x0661f867) /* 0.398918536 */, 12 }, /* 258 */ { MAD_F(0x066a73f5) /* 0.400989493 */, 12 }, /* 259 */ { MAD_F(0x0672f252) /* 0.403063128 */, 12 }, /* 260 */ { MAD_F(0x067b737c) /* 0.405139433 */, 12 }, /* 261 */ { MAD_F(0x0683f771) /* 0.407218402 */, 12 }, /* 262 */ { MAD_F(0x068c7e2f) /* 0.409300027 */, 12 }, /* 263 */ { MAD_F(0x069507b5) /* 0.411384303 */, 12 }, /* 264 */ { MAD_F(0x069d9400) /* 0.413471222 */, 12 }, /* 265 */ { MAD_F(0x06a6230f) /* 0.415560778 */, 12 }, /* 266 */ { MAD_F(0x06aeb4e0) /* 0.417652964 */, 12 }, /* 267 */ { MAD_F(0x06b74971) /* 0.419747773 */, 12 }, /* 268 */ { MAD_F(0x06bfe0c0) /* 0.421845199 */, 12 }, /* 269 */ { MAD_F(0x06c87acc) /* 0.423945235 */, 12 }, /* 270 */ { MAD_F(0x06d11794) /* 0.426047876 */, 12 }, /* 271 */ { MAD_F(0x06d9b714) /* 0.428153114 */, 12 }, /* 272 */ { MAD_F(0x06e2594c) /* 0.430260942 */, 12 }, /* 273 */ { MAD_F(0x06eafe3a) /* 0.432371356 */, 12 }, /* 274 */ { MAD_F(0x06f3a5dc) /* 0.434484348 */, 12 }, /* 275 */ { MAD_F(0x06fc5030) /* 0.436599912 */, 12 }, /* 276 */ { MAD_F(0x0704fd35) /* 0.438718042 */, 12 }, /* 277 */ { MAD_F(0x070dacea) /* 0.440838732 */, 12 }, /* 278 */ { MAD_F(0x07165f4b) /* 0.442961975 */, 12 }, /* 279 */ { MAD_F(0x071f1459) /* 0.445087765 */, 12 }, /* 280 */ { MAD_F(0x0727cc11) /* 0.447216097 */, 12 }, /* 281 */ { MAD_F(0x07308671) /* 0.449346964 */, 12 }, /* 282 */ { MAD_F(0x07394378) /* 0.451480360 */, 12 }, /* 283 */ { MAD_F(0x07420325) /* 0.453616280 */, 12 }, /* 284 */ { MAD_F(0x074ac575) /* 0.455754717 */, 12 }, /* 285 */ { MAD_F(0x07538a67) /* 0.457895665 */, 12 }, /* 286 */ { MAD_F(0x075c51fa) /* 0.460039119 */, 12 }, /* 287 */ { MAD_F(0x07651c2c) /* 0.462185072 */, 12 }, /* 288 */ { MAD_F(0x076de8fc) /* 0.464333519 */, 12 }, /* 289 */ { MAD_F(0x0776b867) /* 0.466484455 */, 12 }, /* 290 */ { MAD_F(0x077f8a6d) /* 0.468637872 */, 12 }, /* 291 */ { MAD_F(0x07885f0b) /* 0.470793767 */, 12 }, /* 292 */ { MAD_F(0x07913641) /* 0.472952132 */, 12 }, /* 293 */ { MAD_F(0x079a100c) /* 0.475112962 */, 12 }, /* 294 */ { MAD_F(0x07a2ec6c) /* 0.477276252 */, 12 }, /* 295 */ { MAD_F(0x07abcb5f) /* 0.479441997 */, 12 }, /* 296 */ { MAD_F(0x07b4ace3) /* 0.481610189 */, 12 }, /* 297 */ { MAD_F(0x07bd90f6) /* 0.483780825 */, 12 }, /* 298 */ { MAD_F(0x07c67798) /* 0.485953899 */, 12 }, /* 299 */ { MAD_F(0x07cf60c7) /* 0.488129404 */, 12 }, /* 300 */ { MAD_F(0x07d84c81) /* 0.490307336 */, 12 }, /* 301 */ { MAD_F(0x07e13ac5) /* 0.492487690 */, 12 }, /* 302 */ { MAD_F(0x07ea2b92) /* 0.494670459 */, 12 }, /* 303 */ { MAD_F(0x07f31ee6) /* 0.496855639 */, 12 }, /* 304 */ { MAD_F(0x07fc14bf) /* 0.499043224 */, 12 }, /* 305 */ { MAD_F(0x0402868e) /* 0.250616605 */, 13 }, /* 306 */ { MAD_F(0x040703ff) /* 0.251712795 */, 13 }, /* 307 */ { MAD_F(0x040b82b0) /* 0.252810180 */, 13 }, /* 308 */ { MAD_F(0x041002a1) /* 0.253908756 */, 13 }, /* 309 */ { MAD_F(0x041483d1) /* 0.255008523 */, 13 }, /* 310 */ { MAD_F(0x04190640) /* 0.256109476 */, 13 }, /* 311 */ { MAD_F(0x041d89ed) /* 0.257211614 */, 13 }, /* 312 */ { MAD_F(0x04220ed7) /* 0.258314934 */, 13 }, /* 313 */ { MAD_F(0x042694fe) /* 0.259419433 */, 13 }, /* 314 */ { MAD_F(0x042b1c60) /* 0.260525110 */, 13 }, /* 315 */ { MAD_F(0x042fa4fe) /* 0.261631960 */, 13 }, /* 316 */ { MAD_F(0x04342ed7) /* 0.262739982 */, 13 }, /* 317 */ { MAD_F(0x0438b9e9) /* 0.263849174 */, 13 }, /* 318 */ { MAD_F(0x043d4635) /* 0.264959533 */, 13 }, /* 319 */ { MAD_F(0x0441d3b9) /* 0.266071056 */, 13 }, /* 320 */ { MAD_F(0x04466275) /* 0.267183742 */, 13 }, /* 321 */ { MAD_F(0x044af269) /* 0.268297587 */, 13 }, /* 322 */ { MAD_F(0x044f8393) /* 0.269412589 */, 13 }, /* 323 */ { MAD_F(0x045415f3) /* 0.270528746 */, 13 }, /* 324 */ { MAD_F(0x0458a989) /* 0.271646056 */, 13 }, /* 325 */ { MAD_F(0x045d3e53) /* 0.272764515 */, 13 }, /* 326 */ { MAD_F(0x0461d451) /* 0.273884123 */, 13 }, /* 327 */ { MAD_F(0x04666b83) /* 0.275004875 */, 13 }, /* 328 */ { MAD_F(0x046b03e7) /* 0.276126771 */, 13 }, /* 329 */ { MAD_F(0x046f9d7e) /* 0.277249808 */, 13 }, /* 330 */ { MAD_F(0x04743847) /* 0.278373983 */, 13 }, /* 331 */ { MAD_F(0x0478d440) /* 0.279499294 */, 13 }, /* 332 */ { MAD_F(0x047d716a) /* 0.280625739 */, 13 }, /* 333 */ { MAD_F(0x04820fc3) /* 0.281753315 */, 13 }, /* 334 */ { MAD_F(0x0486af4c) /* 0.282882021 */, 13 }, /* 335 */ { MAD_F(0x048b5003) /* 0.284011853 */, 13 }, /* 336 */ { MAD_F(0x048ff1e8) /* 0.285142811 */, 13 }, /* 337 */ { MAD_F(0x049494fb) /* 0.286274891 */, 13 }, /* 338 */ { MAD_F(0x0499393a) /* 0.287408091 */, 13 }, /* 339 */ { MAD_F(0x049ddea5) /* 0.288542409 */, 13 }, /* 340 */ { MAD_F(0x04a2853c) /* 0.289677844 */, 13 }, /* 341 */ { MAD_F(0x04a72cfe) /* 0.290814392 */, 13 }, /* 342 */ { MAD_F(0x04abd5ea) /* 0.291952051 */, 13 }, /* 343 */ { MAD_F(0x04b08000) /* 0.293090820 */, 13 }, /* 344 */ { MAD_F(0x04b52b3f) /* 0.294230696 */, 13 }, /* 345 */ { MAD_F(0x04b9d7a7) /* 0.295371678 */, 13 }, /* 346 */ { MAD_F(0x04be8537) /* 0.296513762 */, 13 }, /* 347 */ { MAD_F(0x04c333ee) /* 0.297656947 */, 13 }, /* 348 */ { MAD_F(0x04c7e3cc) /* 0.298801231 */, 13 }, /* 349 */ { MAD_F(0x04cc94d1) /* 0.299946611 */, 13 }, /* 350 */ { MAD_F(0x04d146fb) /* 0.301093085 */, 13 }, /* 351 */ { MAD_F(0x04d5fa4b) /* 0.302240653 */, 13 }, /* 352 */ { MAD_F(0x04daaec0) /* 0.303389310 */, 13 }, /* 353 */ { MAD_F(0x04df6458) /* 0.304539056 */, 13 }, /* 354 */ { MAD_F(0x04e41b14) /* 0.305689888 */, 13 }, /* 355 */ { MAD_F(0x04e8d2f3) /* 0.306841804 */, 13 }, /* 356 */ { MAD_F(0x04ed8bf5) /* 0.307994802 */, 13 }, /* 357 */ { MAD_F(0x04f24618) /* 0.309148880 */, 13 }, /* 358 */ { MAD_F(0x04f7015d) /* 0.310304037 */, 13 }, /* 359 */ { MAD_F(0x04fbbdc3) /* 0.311460269 */, 13 }, /* 360 */ { MAD_F(0x05007b49) /* 0.312617576 */, 13 }, /* 361 */ { MAD_F(0x050539ef) /* 0.313775954 */, 13 }, /* 362 */ { MAD_F(0x0509f9b4) /* 0.314935403 */, 13 }, /* 363 */ { MAD_F(0x050eba98) /* 0.316095920 */, 13 }, /* 364 */ { MAD_F(0x05137c9a) /* 0.317257503 */, 13 }, /* 365 */ { MAD_F(0x05183fba) /* 0.318420150 */, 13 }, /* 366 */ { MAD_F(0x051d03f7) /* 0.319583859 */, 13 }, /* 367 */ { MAD_F(0x0521c950) /* 0.320748629 */, 13 }, /* 368 */ { MAD_F(0x05268fc6) /* 0.321914457 */, 13 }, /* 369 */ { MAD_F(0x052b5757) /* 0.323081342 */, 13 }, /* 370 */ { MAD_F(0x05302003) /* 0.324249281 */, 13 }, /* 371 */ { MAD_F(0x0534e9ca) /* 0.325418273 */, 13 }, /* 372 */ { MAD_F(0x0539b4ab) /* 0.326588316 */, 13 }, /* 373 */ { MAD_F(0x053e80a6) /* 0.327759407 */, 13 }, /* 374 */ { MAD_F(0x05434db9) /* 0.328931546 */, 13 }, /* 375 */ { MAD_F(0x05481be5) /* 0.330104730 */, 13 }, /* 376 */ { MAD_F(0x054ceb2a) /* 0.331278957 */, 13 }, /* 377 */ { MAD_F(0x0551bb85) /* 0.332454225 */, 13 }, /* 378 */ { MAD_F(0x05568cf8) /* 0.333630533 */, 13 }, /* 379 */ { MAD_F(0x055b5f81) /* 0.334807879 */, 13 }, /* 380 */ { MAD_F(0x05603321) /* 0.335986261 */, 13 }, /* 381 */ { MAD_F(0x056507d6) /* 0.337165677 */, 13 }, /* 382 */ { MAD_F(0x0569dda0) /* 0.338346125 */, 13 }, /* 383 */ { MAD_F(0x056eb47f) /* 0.339527604 */, 13 }, /* 384 */ { MAD_F(0x05738c72) /* 0.340710111 */, 13 }, /* 385 */ { MAD_F(0x05786578) /* 0.341893646 */, 13 }, /* 386 */ { MAD_F(0x057d3f92) /* 0.343078205 */, 13 }, /* 387 */ { MAD_F(0x05821abf) /* 0.344263788 */, 13 }, /* 388 */ { MAD_F(0x0586f6fd) /* 0.345450393 */, 13 }, /* 389 */ { MAD_F(0x058bd44e) /* 0.346638017 */, 13 }, /* 390 */ { MAD_F(0x0590b2b0) /* 0.347826659 */, 13 }, /* 391 */ { MAD_F(0x05959222) /* 0.349016318 */, 13 }, /* 392 */ { MAD_F(0x059a72a5) /* 0.350206992 */, 13 }, /* 393 */ { MAD_F(0x059f5438) /* 0.351398678 */, 13 }, /* 394 */ { MAD_F(0x05a436da) /* 0.352591376 */, 13 }, /* 395 */ { MAD_F(0x05a91a8c) /* 0.353785083 */, 13 }, /* 396 */ { MAD_F(0x05adff4c) /* 0.354979798 */, 13 }, /* 397 */ { MAD_F(0x05b2e51a) /* 0.356175519 */, 13 }, /* 398 */ { MAD_F(0x05b7cbf5) /* 0.357372244 */, 13 }, /* 399 */ { MAD_F(0x05bcb3de) /* 0.358569972 */, 13 }, /* 400 */ { MAD_F(0x05c19cd3) /* 0.359768701 */, 13 }, /* 401 */ { MAD_F(0x05c686d5) /* 0.360968429 */, 13 }, /* 402 */ { MAD_F(0x05cb71e2) /* 0.362169156 */, 13 }, /* 403 */ { MAD_F(0x05d05dfb) /* 0.363370878 */, 13 }, /* 404 */ { MAD_F(0x05d54b1f) /* 0.364573594 */, 13 }, /* 405 */ { MAD_F(0x05da394d) /* 0.365777304 */, 13 }, /* 406 */ { MAD_F(0x05df2885) /* 0.366982004 */, 13 }, /* 407 */ { MAD_F(0x05e418c7) /* 0.368187694 */, 13 }, /* 408 */ { MAD_F(0x05e90a12) /* 0.369394372 */, 13 }, /* 409 */ { MAD_F(0x05edfc66) /* 0.370602036 */, 13 }, /* 410 */ { MAD_F(0x05f2efc2) /* 0.371810684 */, 13 }, /* 411 */ { MAD_F(0x05f7e426) /* 0.373020316 */, 13 }, /* 412 */ { MAD_F(0x05fcd992) /* 0.374230929 */, 13 }, /* 413 */ { MAD_F(0x0601d004) /* 0.375442522 */, 13 }, /* 414 */ { MAD_F(0x0606c77d) /* 0.376655093 */, 13 }, /* 415 */ { MAD_F(0x060bbffd) /* 0.377868641 */, 13 }, /* 416 */ { MAD_F(0x0610b982) /* 0.379083164 */, 13 }, /* 417 */ { MAD_F(0x0615b40c) /* 0.380298661 */, 13 }, /* 418 */ { MAD_F(0x061aaf9c) /* 0.381515130 */, 13 }, /* 419 */ { MAD_F(0x061fac2f) /* 0.382732569 */, 13 }, /* 420 */ { MAD_F(0x0624a9c7) /* 0.383950977 */, 13 }, /* 421 */ { MAD_F(0x0629a863) /* 0.385170352 */, 13 }, /* 422 */ { MAD_F(0x062ea802) /* 0.386390694 */, 13 }, /* 423 */ { MAD_F(0x0633a8a3) /* 0.387611999 */, 13 }, /* 424 */ { MAD_F(0x0638aa48) /* 0.388834268 */, 13 }, /* 425 */ { MAD_F(0x063dacee) /* 0.390057497 */, 13 }, /* 426 */ { MAD_F(0x0642b096) /* 0.391281687 */, 13 }, /* 427 */ { MAD_F(0x0647b53f) /* 0.392506834 */, 13 }, /* 428 */ { MAD_F(0x064cbae9) /* 0.393732939 */, 13 }, /* 429 */ { MAD_F(0x0651c193) /* 0.394959999 */, 13 }, /* 430 */ { MAD_F(0x0656c93d) /* 0.396188012 */, 13 }, /* 431 */ { MAD_F(0x065bd1e7) /* 0.397416978 */, 13 }, /* 432 */ { MAD_F(0x0660db91) /* 0.398646895 */, 13 }, /* 433 */ { MAD_F(0x0665e639) /* 0.399877761 */, 13 }, /* 434 */ { MAD_F(0x066af1df) /* 0.401109575 */, 13 }, /* 435 */ { MAD_F(0x066ffe84) /* 0.402342335 */, 13 }, /* 436 */ { MAD_F(0x06750c26) /* 0.403576041 */, 13 }, /* 437 */ { MAD_F(0x067a1ac6) /* 0.404810690 */, 13 }, /* 438 */ { MAD_F(0x067f2a62) /* 0.406046281 */, 13 }, /* 439 */ { MAD_F(0x06843afb) /* 0.407282813 */, 13 }, /* 440 */ { MAD_F(0x06894c90) /* 0.408520284 */, 13 }, /* 441 */ { MAD_F(0x068e5f21) /* 0.409758693 */, 13 }, /* 442 */ { MAD_F(0x069372ae) /* 0.410998038 */, 13 }, /* 443 */ { MAD_F(0x06988735) /* 0.412238319 */, 13 }, /* 444 */ { MAD_F(0x069d9cb7) /* 0.413479532 */, 13 }, /* 445 */ { MAD_F(0x06a2b333) /* 0.414721679 */, 13 }, /* 446 */ { MAD_F(0x06a7caa9) /* 0.415964756 */, 13 }, /* 447 */ { MAD_F(0x06ace318) /* 0.417208762 */, 13 }, /* 448 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 13 }, /* 449 */ { MAD_F(0x06b716e2) /* 0.419699557 */, 13 }, /* 450 */ { MAD_F(0x06bc323b) /* 0.420946343 */, 13 }, /* 451 */ { MAD_F(0x06c14e8d) /* 0.422194054 */, 13 }, /* 452 */ { MAD_F(0x06c66bd6) /* 0.423442686 */, 13 }, /* 453 */ { MAD_F(0x06cb8a17) /* 0.424692240 */, 13 }, /* 454 */ { MAD_F(0x06d0a94e) /* 0.425942714 */, 13 }, /* 455 */ { MAD_F(0x06d5c97c) /* 0.427194106 */, 13 }, /* 456 */ { MAD_F(0x06daeaa1) /* 0.428446415 */, 13 }, /* 457 */ { MAD_F(0x06e00cbb) /* 0.429699640 */, 13 }, /* 458 */ { MAD_F(0x06e52fca) /* 0.430953779 */, 13 }, /* 459 */ { MAD_F(0x06ea53cf) /* 0.432208832 */, 13 }, /* 460 */ { MAD_F(0x06ef78c8) /* 0.433464796 */, 13 }, /* 461 */ { MAD_F(0x06f49eb6) /* 0.434721671 */, 13 }, /* 462 */ { MAD_F(0x06f9c597) /* 0.435979455 */, 13 }, /* 463 */ { MAD_F(0x06feed6d) /* 0.437238146 */, 13 }, /* 464 */ { MAD_F(0x07041636) /* 0.438497744 */, 13 }, /* 465 */ { MAD_F(0x07093ff2) /* 0.439758248 */, 13 }, /* 466 */ { MAD_F(0x070e6aa0) /* 0.441019655 */, 13 }, /* 467 */ { MAD_F(0x07139641) /* 0.442281965 */, 13 }, /* 468 */ { MAD_F(0x0718c2d3) /* 0.443545176 */, 13 }, /* 469 */ { MAD_F(0x071df058) /* 0.444809288 */, 13 }, /* 470 */ { MAD_F(0x07231ecd) /* 0.446074298 */, 13 }, /* 471 */ { MAD_F(0x07284e34) /* 0.447340205 */, 13 }, /* 472 */ { MAD_F(0x072d7e8b) /* 0.448607009 */, 13 }, /* 473 */ { MAD_F(0x0732afd2) /* 0.449874708 */, 13 }, /* 474 */ { MAD_F(0x0737e209) /* 0.451143300 */, 13 }, /* 475 */ { MAD_F(0x073d1530) /* 0.452412785 */, 13 }, /* 476 */ { MAD_F(0x07424946) /* 0.453683161 */, 13 }, /* 477 */ { MAD_F(0x07477e4b) /* 0.454954427 */, 13 }, /* 478 */ { MAD_F(0x074cb43e) /* 0.456226581 */, 13 }, /* 479 */ { MAD_F(0x0751eb20) /* 0.457499623 */, 13 }, /* 480 */ { MAD_F(0x075722ef) /* 0.458773552 */, 13 }, /* 481 */ { MAD_F(0x075c5bac) /* 0.460048365 */, 13 }, /* 482 */ { MAD_F(0x07619557) /* 0.461324062 */, 13 }, /* 483 */ { MAD_F(0x0766cfee) /* 0.462600642 */, 13 }, /* 484 */ { MAD_F(0x076c0b72) /* 0.463878102 */, 13 }, /* 485 */ { MAD_F(0x077147e2) /* 0.465156443 */, 13 }, /* 486 */ { MAD_F(0x0776853e) /* 0.466435663 */, 13 }, /* 487 */ { MAD_F(0x077bc385) /* 0.467715761 */, 13 }, /* 488 */ { MAD_F(0x078102b8) /* 0.468996735 */, 13 }, /* 489 */ { MAD_F(0x078642d6) /* 0.470278584 */, 13 }, /* 490 */ { MAD_F(0x078b83de) /* 0.471561307 */, 13 }, /* 491 */ { MAD_F(0x0790c5d1) /* 0.472844904 */, 13 }, /* 492 */ { MAD_F(0x079608ae) /* 0.474129372 */, 13 }, /* 493 */ { MAD_F(0x079b4c74) /* 0.475414710 */, 13 }, /* 494 */ { MAD_F(0x07a09124) /* 0.476700918 */, 13 }, /* 495 */ { MAD_F(0x07a5d6bd) /* 0.477987994 */, 13 }, /* 496 */ { MAD_F(0x07ab1d3e) /* 0.479275937 */, 13 }, /* 497 */ { MAD_F(0x07b064a8) /* 0.480564746 */, 13 }, /* 498 */ { MAD_F(0x07b5acfb) /* 0.481854420 */, 13 }, /* 499 */ { MAD_F(0x07baf635) /* 0.483144957 */, 13 }, /* 500 */ { MAD_F(0x07c04056) /* 0.484436356 */, 13 }, /* 501 */ { MAD_F(0x07c58b5f) /* 0.485728617 */, 13 }, /* 502 */ { MAD_F(0x07cad74e) /* 0.487021738 */, 13 }, /* 503 */ { MAD_F(0x07d02424) /* 0.488315717 */, 13 }, /* 504 */ { MAD_F(0x07d571e0) /* 0.489610555 */, 13 }, /* 505 */ { MAD_F(0x07dac083) /* 0.490906249 */, 13 }, /* 506 */ { MAD_F(0x07e0100a) /* 0.492202799 */, 13 }, /* 507 */ { MAD_F(0x07e56078) /* 0.493500203 */, 13 }, /* 508 */ { MAD_F(0x07eab1ca) /* 0.494798460 */, 13 }, /* 509 */ { MAD_F(0x07f00401) /* 0.496097570 */, 13 }, /* 510 */ { MAD_F(0x07f5571d) /* 0.497397530 */, 13 }, /* 511 */ { MAD_F(0x07faab1c) /* 0.498698341 */, 13 }, /* 512 */ { MAD_F(0x04000000) /* 0.250000000 */, 14 }, /* 513 */ { MAD_F(0x0402aae3) /* 0.250651254 */, 14 }, /* 514 */ { MAD_F(0x04055638) /* 0.251302930 */, 14 }, /* 515 */ { MAD_F(0x040801ff) /* 0.251955030 */, 14 }, /* 516 */ { MAD_F(0x040aae37) /* 0.252607552 */, 14 }, /* 517 */ { MAD_F(0x040d5ae0) /* 0.253260495 */, 14 }, /* 518 */ { MAD_F(0x041007fa) /* 0.253913860 */, 14 }, /* 519 */ { MAD_F(0x0412b586) /* 0.254567645 */, 14 }, /* 520 */ { MAD_F(0x04156381) /* 0.255221850 */, 14 }, /* 521 */ { MAD_F(0x041811ee) /* 0.255876475 */, 14 }, /* 522 */ { MAD_F(0x041ac0cb) /* 0.256531518 */, 14 }, /* 523 */ { MAD_F(0x041d7018) /* 0.257186980 */, 14 }, /* 524 */ { MAD_F(0x04201fd5) /* 0.257842860 */, 14 }, /* 525 */ { MAD_F(0x0422d003) /* 0.258499157 */, 14 }, /* 526 */ { MAD_F(0x042580a0) /* 0.259155872 */, 14 }, /* 527 */ { MAD_F(0x042831ad) /* 0.259813002 */, 14 }, /* 528 */ { MAD_F(0x042ae32a) /* 0.260470548 */, 14 }, /* 529 */ { MAD_F(0x042d9516) /* 0.261128510 */, 14 }, /* 530 */ { MAD_F(0x04304772) /* 0.261786886 */, 14 }, /* 531 */ { MAD_F(0x0432fa3d) /* 0.262445676 */, 14 }, /* 532 */ { MAD_F(0x0435ad76) /* 0.263104880 */, 14 }, /* 533 */ { MAD_F(0x0438611f) /* 0.263764497 */, 14 }, /* 534 */ { MAD_F(0x043b1536) /* 0.264424527 */, 14 }, /* 535 */ { MAD_F(0x043dc9bc) /* 0.265084969 */, 14 }, /* 536 */ { MAD_F(0x04407eb1) /* 0.265745823 */, 14 }, /* 537 */ { MAD_F(0x04433414) /* 0.266407088 */, 14 }, /* 538 */ { MAD_F(0x0445e9e5) /* 0.267068763 */, 14 }, /* 539 */ { MAD_F(0x0448a024) /* 0.267730848 */, 14 }, /* 540 */ { MAD_F(0x044b56d1) /* 0.268393343 */, 14 }, /* 541 */ { MAD_F(0x044e0dec) /* 0.269056248 */, 14 }, /* 542 */ { MAD_F(0x0450c575) /* 0.269719560 */, 14 }, /* 543 */ { MAD_F(0x04537d6b) /* 0.270383281 */, 14 }, /* 544 */ { MAD_F(0x045635cf) /* 0.271047409 */, 14 }, /* 545 */ { MAD_F(0x0458ee9f) /* 0.271711944 */, 14 }, /* 546 */ { MAD_F(0x045ba7dd) /* 0.272376886 */, 14 }, /* 547 */ { MAD_F(0x045e6188) /* 0.273042234 */, 14 }, /* 548 */ { MAD_F(0x04611ba0) /* 0.273707988 */, 14 }, /* 549 */ { MAD_F(0x0463d625) /* 0.274374147 */, 14 }, /* 550 */ { MAD_F(0x04669116) /* 0.275040710 */, 14 }, /* 551 */ { MAD_F(0x04694c74) /* 0.275707677 */, 14 }, /* 552 */ { MAD_F(0x046c083e) /* 0.276375048 */, 14 }, /* 553 */ { MAD_F(0x046ec474) /* 0.277042822 */, 14 }, /* 554 */ { MAD_F(0x04718116) /* 0.277710999 */, 14 }, /* 555 */ { MAD_F(0x04743e25) /* 0.278379578 */, 14 }, /* 556 */ { MAD_F(0x0476fb9f) /* 0.279048558 */, 14 }, /* 557 */ { MAD_F(0x0479b984) /* 0.279717940 */, 14 }, /* 558 */ { MAD_F(0x047c77d6) /* 0.280387722 */, 14 }, /* 559 */ { MAD_F(0x047f3693) /* 0.281057905 */, 14 }, /* 560 */ { MAD_F(0x0481f5bb) /* 0.281728487 */, 14 }, /* 561 */ { MAD_F(0x0484b54e) /* 0.282399469 */, 14 }, /* 562 */ { MAD_F(0x0487754c) /* 0.283070849 */, 14 }, /* 563 */ { MAD_F(0x048a35b6) /* 0.283742628 */, 14 }, /* 564 */ { MAD_F(0x048cf68a) /* 0.284414805 */, 14 }, /* 565 */ { MAD_F(0x048fb7c8) /* 0.285087379 */, 14 }, /* 566 */ { MAD_F(0x04927972) /* 0.285760350 */, 14 }, /* 567 */ { MAD_F(0x04953b85) /* 0.286433717 */, 14 }, /* 568 */ { MAD_F(0x0497fe03) /* 0.287107481 */, 14 }, /* 569 */ { MAD_F(0x049ac0eb) /* 0.287781640 */, 14 }, /* 570 */ { MAD_F(0x049d843e) /* 0.288456194 */, 14 }, /* 571 */ { MAD_F(0x04a047fa) /* 0.289131142 */, 14 }, /* 572 */ { MAD_F(0x04a30c20) /* 0.289806485 */, 14 }, /* 573 */ { MAD_F(0x04a5d0af) /* 0.290482221 */, 14 }, /* 574 */ { MAD_F(0x04a895a8) /* 0.291158351 */, 14 }, /* 575 */ { MAD_F(0x04ab5b0b) /* 0.291834873 */, 14 }, /* 576 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 14 }, /* 577 */ { MAD_F(0x04b0e70c) /* 0.293189094 */, 14 }, /* 578 */ { MAD_F(0x04b3adaa) /* 0.293866792 */, 14 }, /* 579 */ { MAD_F(0x04b674b1) /* 0.294544881 */, 14 }, /* 580 */ { MAD_F(0x04b93c21) /* 0.295223360 */, 14 }, /* 581 */ { MAD_F(0x04bc03fa) /* 0.295902229 */, 14 }, /* 582 */ { MAD_F(0x04becc3b) /* 0.296581488 */, 14 }, /* 583 */ { MAD_F(0x04c194e4) /* 0.297261136 */, 14 }, /* 584 */ { MAD_F(0x04c45df6) /* 0.297941173 */, 14 }, /* 585 */ { MAD_F(0x04c72771) /* 0.298621598 */, 14 }, /* 586 */ { MAD_F(0x04c9f153) /* 0.299302411 */, 14 }, /* 587 */ { MAD_F(0x04ccbb9d) /* 0.299983611 */, 14 }, /* 588 */ { MAD_F(0x04cf864f) /* 0.300665198 */, 14 }, /* 589 */ { MAD_F(0x04d25169) /* 0.301347172 */, 14 }, /* 590 */ { MAD_F(0x04d51ceb) /* 0.302029532 */, 14 }, /* 591 */ { MAD_F(0x04d7e8d4) /* 0.302712277 */, 14 }, /* 592 */ { MAD_F(0x04dab524) /* 0.303395408 */, 14 }, /* 593 */ { MAD_F(0x04dd81dc) /* 0.304078923 */, 14 }, /* 594 */ { MAD_F(0x04e04efb) /* 0.304762823 */, 14 }, /* 595 */ { MAD_F(0x04e31c81) /* 0.305447106 */, 14 }, /* 596 */ { MAD_F(0x04e5ea6e) /* 0.306131773 */, 14 }, /* 597 */ { MAD_F(0x04e8b8c2) /* 0.306816823 */, 14 }, /* 598 */ { MAD_F(0x04eb877c) /* 0.307502256 */, 14 }, /* 599 */ { MAD_F(0x04ee569d) /* 0.308188071 */, 14 }, /* 600 */ { MAD_F(0x04f12624) /* 0.308874267 */, 14 }, /* 601 */ { MAD_F(0x04f3f612) /* 0.309560845 */, 14 }, /* 602 */ { MAD_F(0x04f6c666) /* 0.310247804 */, 14 }, /* 603 */ { MAD_F(0x04f99721) /* 0.310935143 */, 14 }, /* 604 */ { MAD_F(0x04fc6841) /* 0.311622862 */, 14 }, /* 605 */ { MAD_F(0x04ff39c7) /* 0.312310961 */, 14 }, /* 606 */ { MAD_F(0x05020bb3) /* 0.312999439 */, 14 }, /* 607 */ { MAD_F(0x0504de05) /* 0.313688296 */, 14 }, /* 608 */ { MAD_F(0x0507b0bc) /* 0.314377532 */, 14 }, /* 609 */ { MAD_F(0x050a83d8) /* 0.315067145 */, 14 }, /* 610 */ { MAD_F(0x050d575b) /* 0.315757136 */, 14 }, /* 611 */ { MAD_F(0x05102b42) /* 0.316447504 */, 14 }, /* 612 */ { MAD_F(0x0512ff8e) /* 0.317138249 */, 14 }, /* 613 */ { MAD_F(0x0515d440) /* 0.317829370 */, 14 }, /* 614 */ { MAD_F(0x0518a956) /* 0.318520867 */, 14 }, /* 615 */ { MAD_F(0x051b7ed1) /* 0.319212739 */, 14 }, /* 616 */ { MAD_F(0x051e54b1) /* 0.319904987 */, 14 }, /* 617 */ { MAD_F(0x05212af5) /* 0.320597609 */, 14 }, /* 618 */ { MAD_F(0x0524019e) /* 0.321290606 */, 14 }, /* 619 */ { MAD_F(0x0526d8ab) /* 0.321983976 */, 14 }, /* 620 */ { MAD_F(0x0529b01d) /* 0.322677720 */, 14 }, /* 621 */ { MAD_F(0x052c87f2) /* 0.323371837 */, 14 }, /* 622 */ { MAD_F(0x052f602c) /* 0.324066327 */, 14 }, /* 623 */ { MAD_F(0x053238ca) /* 0.324761189 */, 14 }, /* 624 */ { MAD_F(0x053511cb) /* 0.325456423 */, 14 }, /* 625 */ { MAD_F(0x0537eb30) /* 0.326152028 */, 14 }, /* 626 */ { MAD_F(0x053ac4f9) /* 0.326848005 */, 14 }, /* 627 */ { MAD_F(0x053d9f25) /* 0.327544352 */, 14 }, /* 628 */ { MAD_F(0x054079b5) /* 0.328241070 */, 14 }, /* 629 */ { MAD_F(0x054354a8) /* 0.328938157 */, 14 }, /* 630 */ { MAD_F(0x05462ffe) /* 0.329635614 */, 14 }, /* 631 */ { MAD_F(0x05490bb7) /* 0.330333440 */, 14 }, /* 632 */ { MAD_F(0x054be7d4) /* 0.331031635 */, 14 }, /* 633 */ { MAD_F(0x054ec453) /* 0.331730198 */, 14 }, /* 634 */ { MAD_F(0x0551a134) /* 0.332429129 */, 14 }, /* 635 */ { MAD_F(0x05547e79) /* 0.333128427 */, 14 }, /* 636 */ { MAD_F(0x05575c20) /* 0.333828093 */, 14 }, /* 637 */ { MAD_F(0x055a3a2a) /* 0.334528126 */, 14 }, /* 638 */ { MAD_F(0x055d1896) /* 0.335228525 */, 14 }, /* 639 */ { MAD_F(0x055ff764) /* 0.335929290 */, 14 }, /* 640 */ { MAD_F(0x0562d694) /* 0.336630420 */, 14 }, /* 641 */ { MAD_F(0x0565b627) /* 0.337331916 */, 14 }, /* 642 */ { MAD_F(0x0568961b) /* 0.338033777 */, 14 }, /* 643 */ { MAD_F(0x056b7671) /* 0.338736002 */, 14 }, /* 644 */ { MAD_F(0x056e5729) /* 0.339438592 */, 14 }, /* 645 */ { MAD_F(0x05713843) /* 0.340141545 */, 14 }, /* 646 */ { MAD_F(0x057419be) /* 0.340844862 */, 14 }, /* 647 */ { MAD_F(0x0576fb9a) /* 0.341548541 */, 14 }, /* 648 */ { MAD_F(0x0579ddd8) /* 0.342252584 */, 14 }, /* 649 */ { MAD_F(0x057cc077) /* 0.342956988 */, 14 }, /* 650 */ { MAD_F(0x057fa378) /* 0.343661754 */, 14 }, /* 651 */ { MAD_F(0x058286d9) /* 0.344366882 */, 14 }, /* 652 */ { MAD_F(0x05856a9b) /* 0.345072371 */, 14 }, /* 653 */ { MAD_F(0x05884ebe) /* 0.345778221 */, 14 }, /* 654 */ { MAD_F(0x058b3342) /* 0.346484431 */, 14 }, /* 655 */ { MAD_F(0x058e1827) /* 0.347191002 */, 14 }, /* 656 */ { MAD_F(0x0590fd6c) /* 0.347897931 */, 14 }, /* 657 */ { MAD_F(0x0593e311) /* 0.348605221 */, 14 }, /* 658 */ { MAD_F(0x0596c917) /* 0.349312869 */, 14 }, /* 659 */ { MAD_F(0x0599af7d) /* 0.350020876 */, 14 }, /* 660 */ { MAD_F(0x059c9643) /* 0.350729240 */, 14 }, /* 661 */ { MAD_F(0x059f7d6a) /* 0.351437963 */, 14 }, /* 662 */ { MAD_F(0x05a264f0) /* 0.352147044 */, 14 }, /* 663 */ { MAD_F(0x05a54cd6) /* 0.352856481 */, 14 }, /* 664 */ { MAD_F(0x05a8351c) /* 0.353566275 */, 14 }, /* 665 */ { MAD_F(0x05ab1dc2) /* 0.354276426 */, 14 }, /* 666 */ { MAD_F(0x05ae06c7) /* 0.354986932 */, 14 }, /* 667 */ { MAD_F(0x05b0f02b) /* 0.355697795 */, 14 }, /* 668 */ { MAD_F(0x05b3d9f0) /* 0.356409012 */, 14 }, /* 669 */ { MAD_F(0x05b6c413) /* 0.357120585 */, 14 }, /* 670 */ { MAD_F(0x05b9ae95) /* 0.357832512 */, 14 }, /* 671 */ { MAD_F(0x05bc9977) /* 0.358544794 */, 14 }, /* 672 */ { MAD_F(0x05bf84b8) /* 0.359257429 */, 14 }, /* 673 */ { MAD_F(0x05c27057) /* 0.359970419 */, 14 }, /* 674 */ { MAD_F(0x05c55c56) /* 0.360683761 */, 14 }, /* 675 */ { MAD_F(0x05c848b3) /* 0.361397456 */, 14 }, /* 676 */ { MAD_F(0x05cb356e) /* 0.362111504 */, 14 }, /* 677 */ { MAD_F(0x05ce2289) /* 0.362825904 */, 14 }, /* 678 */ { MAD_F(0x05d11001) /* 0.363540655 */, 14 }, /* 679 */ { MAD_F(0x05d3fdd8) /* 0.364255759 */, 14 }, /* 680 */ { MAD_F(0x05d6ec0e) /* 0.364971213 */, 14 }, /* 681 */ { MAD_F(0x05d9daa1) /* 0.365687018 */, 14 }, /* 682 */ { MAD_F(0x05dcc993) /* 0.366403174 */, 14 }, /* 683 */ { MAD_F(0x05dfb8e2) /* 0.367119680 */, 14 }, /* 684 */ { MAD_F(0x05e2a890) /* 0.367836535 */, 14 }, /* 685 */ { MAD_F(0x05e5989b) /* 0.368553740 */, 14 }, /* 686 */ { MAD_F(0x05e88904) /* 0.369271294 */, 14 }, /* 687 */ { MAD_F(0x05eb79cb) /* 0.369989197 */, 14 }, /* 688 */ { MAD_F(0x05ee6aef) /* 0.370707448 */, 14 }, /* 689 */ { MAD_F(0x05f15c70) /* 0.371426047 */, 14 }, /* 690 */ { MAD_F(0x05f44e4f) /* 0.372144994 */, 14 }, /* 691 */ { MAD_F(0x05f7408b) /* 0.372864289 */, 14 }, /* 692 */ { MAD_F(0x05fa3324) /* 0.373583930 */, 14 }, /* 693 */ { MAD_F(0x05fd261b) /* 0.374303918 */, 14 }, /* 694 */ { MAD_F(0x0600196e) /* 0.375024253 */, 14 }, /* 695 */ { MAD_F(0x06030d1e) /* 0.375744934 */, 14 }, /* 696 */ { MAD_F(0x0606012b) /* 0.376465960 */, 14 }, /* 697 */ { MAD_F(0x0608f595) /* 0.377187332 */, 14 }, /* 698 */ { MAD_F(0x060bea5c) /* 0.377909049 */, 14 }, /* 699 */ { MAD_F(0x060edf7f) /* 0.378631110 */, 14 }, /* 700 */ { MAD_F(0x0611d4fe) /* 0.379353516 */, 14 }, /* 701 */ { MAD_F(0x0614cada) /* 0.380076266 */, 14 }, /* 702 */ { MAD_F(0x0617c112) /* 0.380799360 */, 14 }, /* 703 */ { MAD_F(0x061ab7a6) /* 0.381522798 */, 14 }, /* 704 */ { MAD_F(0x061dae96) /* 0.382246578 */, 14 }, /* 705 */ { MAD_F(0x0620a5e3) /* 0.382970701 */, 14 }, /* 706 */ { MAD_F(0x06239d8b) /* 0.383695167 */, 14 }, /* 707 */ { MAD_F(0x0626958f) /* 0.384419975 */, 14 }, /* 708 */ { MAD_F(0x06298def) /* 0.385145124 */, 14 }, /* 709 */ { MAD_F(0x062c86aa) /* 0.385870615 */, 14 }, /* 710 */ { MAD_F(0x062f7fc1) /* 0.386596448 */, 14 }, /* 711 */ { MAD_F(0x06327934) /* 0.387322621 */, 14 }, /* 712 */ { MAD_F(0x06357302) /* 0.388049134 */, 14 }, /* 713 */ { MAD_F(0x06386d2b) /* 0.388775988 */, 14 }, /* 714 */ { MAD_F(0x063b67b0) /* 0.389503182 */, 14 }, /* 715 */ { MAD_F(0x063e6290) /* 0.390230715 */, 14 }, /* 716 */ { MAD_F(0x06415dcb) /* 0.390958588 */, 14 }, /* 717 */ { MAD_F(0x06445960) /* 0.391686799 */, 14 }, /* 718 */ { MAD_F(0x06475551) /* 0.392415349 */, 14 }, /* 719 */ { MAD_F(0x064a519c) /* 0.393144238 */, 14 }, /* 720 */ { MAD_F(0x064d4e43) /* 0.393873464 */, 14 }, /* 721 */ { MAD_F(0x06504b44) /* 0.394603028 */, 14 }, /* 722 */ { MAD_F(0x0653489f) /* 0.395332930 */, 14 }, /* 723 */ { MAD_F(0x06564655) /* 0.396063168 */, 14 }, /* 724 */ { MAD_F(0x06594465) /* 0.396793743 */, 14 }, /* 725 */ { MAD_F(0x065c42d0) /* 0.397524655 */, 14 }, /* 726 */ { MAD_F(0x065f4195) /* 0.398255903 */, 14 }, /* 727 */ { MAD_F(0x066240b4) /* 0.398987487 */, 14 }, /* 728 */ { MAD_F(0x0665402d) /* 0.399719406 */, 14 }, /* 729 */ { MAD_F(0x06684000) /* 0.400451660 */, 14 }, /* 730 */ { MAD_F(0x066b402d) /* 0.401184249 */, 14 }, /* 731 */ { MAD_F(0x066e40b3) /* 0.401917173 */, 14 }, /* 732 */ { MAD_F(0x06714194) /* 0.402650431 */, 14 }, /* 733 */ { MAD_F(0x067442ce) /* 0.403384024 */, 14 }, /* 734 */ { MAD_F(0x06774462) /* 0.404117949 */, 14 }, /* 735 */ { MAD_F(0x067a464f) /* 0.404852209 */, 14 }, /* 736 */ { MAD_F(0x067d4896) /* 0.405586801 */, 14 }, /* 737 */ { MAD_F(0x06804b36) /* 0.406321726 */, 14 }, /* 738 */ { MAD_F(0x06834e2f) /* 0.407056983 */, 14 }, /* 739 */ { MAD_F(0x06865181) /* 0.407792573 */, 14 }, /* 740 */ { MAD_F(0x0689552c) /* 0.408528495 */, 14 }, /* 741 */ { MAD_F(0x068c5931) /* 0.409264748 */, 14 }, /* 742 */ { MAD_F(0x068f5d8e) /* 0.410001332 */, 14 }, /* 743 */ { MAD_F(0x06926245) /* 0.410738247 */, 14 }, /* 744 */ { MAD_F(0x06956753) /* 0.411475493 */, 14 }, /* 745 */ { MAD_F(0x06986cbb) /* 0.412213070 */, 14 }, /* 746 */ { MAD_F(0x069b727b) /* 0.412950976 */, 14 }, /* 747 */ { MAD_F(0x069e7894) /* 0.413689213 */, 14 }, /* 748 */ { MAD_F(0x06a17f05) /* 0.414427779 */, 14 }, /* 749 */ { MAD_F(0x06a485cf) /* 0.415166674 */, 14 }, /* 750 */ { MAD_F(0x06a78cf1) /* 0.415905897 */, 14 }, /* 751 */ { MAD_F(0x06aa946b) /* 0.416645450 */, 14 }, /* 752 */ { MAD_F(0x06ad9c3d) /* 0.417385331 */, 14 }, /* 753 */ { MAD_F(0x06b0a468) /* 0.418125540 */, 14 }, /* 754 */ { MAD_F(0x06b3acea) /* 0.418866076 */, 14 }, /* 755 */ { MAD_F(0x06b6b5c4) /* 0.419606940 */, 14 }, /* 756 */ { MAD_F(0x06b9bef6) /* 0.420348132 */, 14 }, /* 757 */ { MAD_F(0x06bcc880) /* 0.421089650 */, 14 }, /* 758 */ { MAD_F(0x06bfd261) /* 0.421831494 */, 14 }, /* 759 */ { MAD_F(0x06c2dc9a) /* 0.422573665 */, 14 }, /* 760 */ { MAD_F(0x06c5e72b) /* 0.423316162 */, 14 }, /* 761 */ { MAD_F(0x06c8f213) /* 0.424058985 */, 14 }, /* 762 */ { MAD_F(0x06cbfd52) /* 0.424802133 */, 14 }, /* 763 */ { MAD_F(0x06cf08e9) /* 0.425545607 */, 14 }, /* 764 */ { MAD_F(0x06d214d7) /* 0.426289405 */, 14 }, /* 765 */ { MAD_F(0x06d5211c) /* 0.427033528 */, 14 }, /* 766 */ { MAD_F(0x06d82db8) /* 0.427777975 */, 14 }, /* 767 */ { MAD_F(0x06db3aaa) /* 0.428522746 */, 14 }, /* 768 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 14 }, /* 769 */ { MAD_F(0x06e15595) /* 0.430013259 */, 14 }, /* 770 */ { MAD_F(0x06e4638d) /* 0.430759001 */, 14 }, /* 771 */ { MAD_F(0x06e771db) /* 0.431505065 */, 14 }, /* 772 */ { MAD_F(0x06ea807f) /* 0.432251452 */, 14 }, /* 773 */ { MAD_F(0x06ed8f7b) /* 0.432998162 */, 14 }, /* 774 */ { MAD_F(0x06f09ecc) /* 0.433745193 */, 14 }, /* 775 */ { MAD_F(0x06f3ae75) /* 0.434492546 */, 14 }, /* 776 */ { MAD_F(0x06f6be73) /* 0.435240221 */, 14 }, /* 777 */ { MAD_F(0x06f9cec8) /* 0.435988217 */, 14 }, /* 778 */ { MAD_F(0x06fcdf72) /* 0.436736534 */, 14 }, /* 779 */ { MAD_F(0x06fff073) /* 0.437485172 */, 14 }, /* 780 */ { MAD_F(0x070301ca) /* 0.438234130 */, 14 }, /* 781 */ { MAD_F(0x07061377) /* 0.438983408 */, 14 }, /* 782 */ { MAD_F(0x0709257a) /* 0.439733006 */, 14 }, /* 783 */ { MAD_F(0x070c37d2) /* 0.440482924 */, 14 }, /* 784 */ { MAD_F(0x070f4a80) /* 0.441233161 */, 14 }, /* 785 */ { MAD_F(0x07125d84) /* 0.441983717 */, 14 }, /* 786 */ { MAD_F(0x071570de) /* 0.442734592 */, 14 }, /* 787 */ { MAD_F(0x0718848d) /* 0.443485785 */, 14 }, /* 788 */ { MAD_F(0x071b9891) /* 0.444237296 */, 14 }, /* 789 */ { MAD_F(0x071eaceb) /* 0.444989126 */, 14 }, /* 790 */ { MAD_F(0x0721c19a) /* 0.445741273 */, 14 }, /* 791 */ { MAD_F(0x0724d69e) /* 0.446493738 */, 14 }, /* 792 */ { MAD_F(0x0727ebf7) /* 0.447246519 */, 14 }, /* 793 */ { MAD_F(0x072b01a6) /* 0.447999618 */, 14 }, /* 794 */ { MAD_F(0x072e17a9) /* 0.448753033 */, 14 }, /* 795 */ { MAD_F(0x07312e01) /* 0.449506765 */, 14 }, /* 796 */ { MAD_F(0x073444ae) /* 0.450260813 */, 14 }, /* 797 */ { MAD_F(0x07375bb0) /* 0.451015176 */, 14 }, /* 798 */ { MAD_F(0x073a7307) /* 0.451769856 */, 14 }, /* 799 */ { MAD_F(0x073d8ab2) /* 0.452524850 */, 14 }, /* 800 */ { MAD_F(0x0740a2b2) /* 0.453280160 */, 14 }, /* 801 */ { MAD_F(0x0743bb06) /* 0.454035784 */, 14 }, /* 802 */ { MAD_F(0x0746d3af) /* 0.454791723 */, 14 }, /* 803 */ { MAD_F(0x0749ecac) /* 0.455547976 */, 14 }, /* 804 */ { MAD_F(0x074d05fe) /* 0.456304543 */, 14 }, /* 805 */ { MAD_F(0x07501fa3) /* 0.457061423 */, 14 }, /* 806 */ { MAD_F(0x0753399d) /* 0.457818618 */, 14 }, /* 807 */ { MAD_F(0x075653eb) /* 0.458576125 */, 14 }, /* 808 */ { MAD_F(0x07596e8d) /* 0.459333946 */, 14 }, /* 809 */ { MAD_F(0x075c8983) /* 0.460092079 */, 14 }, /* 810 */ { MAD_F(0x075fa4cc) /* 0.460850524 */, 14 }, /* 811 */ { MAD_F(0x0762c06a) /* 0.461609282 */, 14 }, /* 812 */ { MAD_F(0x0765dc5b) /* 0.462368352 */, 14 }, /* 813 */ { MAD_F(0x0768f8a0) /* 0.463127733 */, 14 }, /* 814 */ { MAD_F(0x076c1538) /* 0.463887426 */, 14 }, /* 815 */ { MAD_F(0x076f3224) /* 0.464647430 */, 14 }, /* 816 */ { MAD_F(0x07724f64) /* 0.465407744 */, 14 }, /* 817 */ { MAD_F(0x07756cf7) /* 0.466168370 */, 14 }, /* 818 */ { MAD_F(0x07788add) /* 0.466929306 */, 14 }, /* 819 */ { MAD_F(0x077ba916) /* 0.467690552 */, 14 }, /* 820 */ { MAD_F(0x077ec7a3) /* 0.468452108 */, 14 }, /* 821 */ { MAD_F(0x0781e683) /* 0.469213973 */, 14 }, /* 822 */ { MAD_F(0x078505b5) /* 0.469976148 */, 14 }, /* 823 */ { MAD_F(0x0788253b) /* 0.470738632 */, 14 }, /* 824 */ { MAD_F(0x078b4514) /* 0.471501425 */, 14 }, /* 825 */ { MAD_F(0x078e653f) /* 0.472264527 */, 14 }, /* 826 */ { MAD_F(0x079185be) /* 0.473027937 */, 14 }, /* 827 */ { MAD_F(0x0794a68f) /* 0.473791655 */, 14 }, /* 828 */ { MAD_F(0x0797c7b2) /* 0.474555681 */, 14 }, /* 829 */ { MAD_F(0x079ae929) /* 0.475320014 */, 14 }, /* 830 */ { MAD_F(0x079e0af1) /* 0.476084655 */, 14 }, /* 831 */ { MAD_F(0x07a12d0c) /* 0.476849603 */, 14 }, /* 832 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 14 }, /* 833 */ { MAD_F(0x07a7723a) /* 0.478380420 */, 14 }, /* 834 */ { MAD_F(0x07aa954c) /* 0.479146288 */, 14 }, /* 835 */ { MAD_F(0x07adb8b0) /* 0.479912463 */, 14 }, /* 836 */ { MAD_F(0x07b0dc67) /* 0.480678943 */, 14 }, /* 837 */ { MAD_F(0x07b4006f) /* 0.481445729 */, 14 }, /* 838 */ { MAD_F(0x07b724ca) /* 0.482212820 */, 14 }, /* 839 */ { MAD_F(0x07ba4976) /* 0.482980216 */, 14 }, /* 840 */ { MAD_F(0x07bd6e75) /* 0.483747918 */, 14 }, /* 841 */ { MAD_F(0x07c093c5) /* 0.484515924 */, 14 }, /* 842 */ { MAD_F(0x07c3b967) /* 0.485284235 */, 14 }, /* 843 */ { MAD_F(0x07c6df5a) /* 0.486052849 */, 14 }, /* 844 */ { MAD_F(0x07ca059f) /* 0.486821768 */, 14 }, /* 845 */ { MAD_F(0x07cd2c36) /* 0.487590991 */, 14 }, /* 846 */ { MAD_F(0x07d0531e) /* 0.488360517 */, 14 }, /* 847 */ { MAD_F(0x07d37a57) /* 0.489130346 */, 14 }, /* 848 */ { MAD_F(0x07d6a1e2) /* 0.489900479 */, 14 }, /* 849 */ { MAD_F(0x07d9c9be) /* 0.490670914 */, 14 }, /* 850 */ { MAD_F(0x07dcf1ec) /* 0.491441651 */, 14 }, /* 851 */ { MAD_F(0x07e01a6a) /* 0.492212691 */, 14 }, /* 852 */ { MAD_F(0x07e3433a) /* 0.492984033 */, 14 }, /* 853 */ { MAD_F(0x07e66c5a) /* 0.493755677 */, 14 }, /* 854 */ { MAD_F(0x07e995cc) /* 0.494527623 */, 14 }, /* 855 */ { MAD_F(0x07ecbf8e) /* 0.495299870 */, 14 }, /* 856 */ { MAD_F(0x07efe9a1) /* 0.496072418 */, 14 }, /* 857 */ { MAD_F(0x07f31405) /* 0.496845266 */, 14 }, /* 858 */ { MAD_F(0x07f63eba) /* 0.497618416 */, 14 }, /* 859 */ { MAD_F(0x07f969c0) /* 0.498391866 */, 14 }, /* 860 */ { MAD_F(0x07fc9516) /* 0.499165616 */, 14 }, /* 861 */ { MAD_F(0x07ffc0bc) /* 0.499939666 */, 14 }, /* 862 */ { MAD_F(0x04017659) /* 0.250357008 */, 15 }, /* 863 */ { MAD_F(0x04030c7d) /* 0.250744333 */, 15 }, /* 864 */ { MAD_F(0x0404a2c9) /* 0.251131807 */, 15 }, /* 865 */ { MAD_F(0x0406393d) /* 0.251519431 */, 15 }, /* 866 */ { MAD_F(0x0407cfd9) /* 0.251907204 */, 15 }, /* 867 */ { MAD_F(0x0409669d) /* 0.252295127 */, 15 }, /* 868 */ { MAD_F(0x040afd89) /* 0.252683198 */, 15 }, /* 869 */ { MAD_F(0x040c949e) /* 0.253071419 */, 15 }, /* 870 */ { MAD_F(0x040e2bda) /* 0.253459789 */, 15 }, /* 871 */ { MAD_F(0x040fc33e) /* 0.253848307 */, 15 }, /* 872 */ { MAD_F(0x04115aca) /* 0.254236974 */, 15 }, /* 873 */ { MAD_F(0x0412f27e) /* 0.254625790 */, 15 }, /* 874 */ { MAD_F(0x04148a5a) /* 0.255014755 */, 15 }, /* 875 */ { MAD_F(0x0416225d) /* 0.255403867 */, 15 }, /* 876 */ { MAD_F(0x0417ba89) /* 0.255793128 */, 15 }, /* 877 */ { MAD_F(0x041952dc) /* 0.256182537 */, 15 }, /* 878 */ { MAD_F(0x041aeb57) /* 0.256572095 */, 15 }, /* 879 */ { MAD_F(0x041c83fa) /* 0.256961800 */, 15 }, /* 880 */ { MAD_F(0x041e1cc4) /* 0.257351652 */, 15 }, /* 881 */ { MAD_F(0x041fb5b6) /* 0.257741653 */, 15 }, /* 882 */ { MAD_F(0x04214ed0) /* 0.258131801 */, 15 }, /* 883 */ { MAD_F(0x0422e811) /* 0.258522097 */, 15 }, /* 884 */ { MAD_F(0x04248179) /* 0.258912540 */, 15 }, /* 885 */ { MAD_F(0x04261b0a) /* 0.259303130 */, 15 }, /* 886 */ { MAD_F(0x0427b4c2) /* 0.259693868 */, 15 }, /* 887 */ { MAD_F(0x04294ea1) /* 0.260084752 */, 15 }, /* 888 */ { MAD_F(0x042ae8a7) /* 0.260475783 */, 15 }, /* 889 */ { MAD_F(0x042c82d6) /* 0.260866961 */, 15 }, /* 890 */ { MAD_F(0x042e1d2b) /* 0.261258286 */, 15 }, /* 891 */ { MAD_F(0x042fb7a8) /* 0.261649758 */, 15 }, /* 892 */ { MAD_F(0x0431524c) /* 0.262041376 */, 15 }, /* 893 */ { MAD_F(0x0432ed17) /* 0.262433140 */, 15 }, /* 894 */ { MAD_F(0x0434880a) /* 0.262825051 */, 15 }, /* 895 */ { MAD_F(0x04362324) /* 0.263217107 */, 15 }, /* 896 */ { MAD_F(0x0437be65) /* 0.263609310 */, 15 }, /* 897 */ { MAD_F(0x043959cd) /* 0.264001659 */, 15 }, /* 898 */ { MAD_F(0x043af55d) /* 0.264394153 */, 15 }, /* 899 */ { MAD_F(0x043c9113) /* 0.264786794 */, 15 }, /* 900 */ { MAD_F(0x043e2cf1) /* 0.265179580 */, 15 }, /* 901 */ { MAD_F(0x043fc8f6) /* 0.265572511 */, 15 }, /* 902 */ { MAD_F(0x04416522) /* 0.265965588 */, 15 }, /* 903 */ { MAD_F(0x04430174) /* 0.266358810 */, 15 }, /* 904 */ { MAD_F(0x04449dee) /* 0.266752177 */, 15 }, /* 905 */ { MAD_F(0x04463a8f) /* 0.267145689 */, 15 }, /* 906 */ { MAD_F(0x0447d756) /* 0.267539347 */, 15 }, /* 907 */ { MAD_F(0x04497445) /* 0.267933149 */, 15 }, /* 908 */ { MAD_F(0x044b115a) /* 0.268327096 */, 15 }, /* 909 */ { MAD_F(0x044cae96) /* 0.268721187 */, 15 }, /* 910 */ { MAD_F(0x044e4bf9) /* 0.269115423 */, 15 }, /* 911 */ { MAD_F(0x044fe983) /* 0.269509804 */, 15 }, /* 912 */ { MAD_F(0x04518733) /* 0.269904329 */, 15 }, /* 913 */ { MAD_F(0x0453250a) /* 0.270298998 */, 15 }, /* 914 */ { MAD_F(0x0454c308) /* 0.270693811 */, 15 }, /* 915 */ { MAD_F(0x0456612d) /* 0.271088768 */, 15 }, /* 916 */ { MAD_F(0x0457ff78) /* 0.271483869 */, 15 }, /* 917 */ { MAD_F(0x04599dea) /* 0.271879114 */, 15 }, /* 918 */ { MAD_F(0x045b3c82) /* 0.272274503 */, 15 }, /* 919 */ { MAD_F(0x045cdb41) /* 0.272670035 */, 15 }, /* 920 */ { MAD_F(0x045e7a26) /* 0.273065710 */, 15 }, /* 921 */ { MAD_F(0x04601932) /* 0.273461530 */, 15 }, /* 922 */ { MAD_F(0x0461b864) /* 0.273857492 */, 15 }, /* 923 */ { MAD_F(0x046357bd) /* 0.274253597 */, 15 }, /* 924 */ { MAD_F(0x0464f73c) /* 0.274649846 */, 15 }, /* 925 */ { MAD_F(0x046696e2) /* 0.275046238 */, 15 }, /* 926 */ { MAD_F(0x046836ae) /* 0.275442772 */, 15 }, /* 927 */ { MAD_F(0x0469d6a0) /* 0.275839449 */, 15 }, /* 928 */ { MAD_F(0x046b76b9) /* 0.276236269 */, 15 }, /* 929 */ { MAD_F(0x046d16f7) /* 0.276633232 */, 15 }, /* 930 */ { MAD_F(0x046eb75c) /* 0.277030337 */, 15 }, /* 931 */ { MAD_F(0x047057e8) /* 0.277427584 */, 15 }, /* 932 */ { MAD_F(0x0471f899) /* 0.277824973 */, 15 }, /* 933 */ { MAD_F(0x04739971) /* 0.278222505 */, 15 }, /* 934 */ { MAD_F(0x04753a6f) /* 0.278620179 */, 15 }, /* 935 */ { MAD_F(0x0476db92) /* 0.279017995 */, 15 }, /* 936 */ { MAD_F(0x04787cdc) /* 0.279415952 */, 15 }, /* 937 */ { MAD_F(0x047a1e4c) /* 0.279814051 */, 15 }, /* 938 */ { MAD_F(0x047bbfe2) /* 0.280212292 */, 15 }, /* 939 */ { MAD_F(0x047d619e) /* 0.280610675 */, 15 }, /* 940 */ { MAD_F(0x047f0380) /* 0.281009199 */, 15 }, /* 941 */ { MAD_F(0x0480a588) /* 0.281407864 */, 15 }, /* 942 */ { MAD_F(0x048247b6) /* 0.281806670 */, 15 }, /* 943 */ { MAD_F(0x0483ea0a) /* 0.282205618 */, 15 }, /* 944 */ { MAD_F(0x04858c83) /* 0.282604707 */, 15 }, /* 945 */ { MAD_F(0x04872f22) /* 0.283003936 */, 15 }, /* 946 */ { MAD_F(0x0488d1e8) /* 0.283403307 */, 15 }, /* 947 */ { MAD_F(0x048a74d3) /* 0.283802818 */, 15 }, /* 948 */ { MAD_F(0x048c17e3) /* 0.284202470 */, 15 }, /* 949 */ { MAD_F(0x048dbb1a) /* 0.284602263 */, 15 }, /* 950 */ { MAD_F(0x048f5e76) /* 0.285002195 */, 15 }, /* 951 */ { MAD_F(0x049101f8) /* 0.285402269 */, 15 }, /* 952 */ { MAD_F(0x0492a59f) /* 0.285802482 */, 15 }, /* 953 */ { MAD_F(0x0494496c) /* 0.286202836 */, 15 }, /* 954 */ { MAD_F(0x0495ed5f) /* 0.286603329 */, 15 }, /* 955 */ { MAD_F(0x04979177) /* 0.287003963 */, 15 }, /* 956 */ { MAD_F(0x049935b5) /* 0.287404737 */, 15 }, /* 957 */ { MAD_F(0x049ada19) /* 0.287805650 */, 15 }, /* 958 */ { MAD_F(0x049c7ea1) /* 0.288206703 */, 15 }, /* 959 */ { MAD_F(0x049e2350) /* 0.288607895 */, 15 }, /* 960 */ { MAD_F(0x049fc824) /* 0.289009227 */, 15 }, /* 961 */ { MAD_F(0x04a16d1d) /* 0.289410699 */, 15 }, /* 962 */ { MAD_F(0x04a3123b) /* 0.289812309 */, 15 }, /* 963 */ { MAD_F(0x04a4b77f) /* 0.290214059 */, 15 }, /* 964 */ { MAD_F(0x04a65ce8) /* 0.290615948 */, 15 }, /* 965 */ { MAD_F(0x04a80277) /* 0.291017976 */, 15 }, /* 966 */ { MAD_F(0x04a9a82b) /* 0.291420143 */, 15 }, /* 967 */ { MAD_F(0x04ab4e04) /* 0.291822449 */, 15 }, /* 968 */ { MAD_F(0x04acf402) /* 0.292224893 */, 15 }, /* 969 */ { MAD_F(0x04ae9a26) /* 0.292627476 */, 15 }, /* 970 */ { MAD_F(0x04b0406e) /* 0.293030197 */, 15 }, /* 971 */ { MAD_F(0x04b1e6dc) /* 0.293433057 */, 15 }, /* 972 */ { MAD_F(0x04b38d6f) /* 0.293836055 */, 15 }, /* 973 */ { MAD_F(0x04b53427) /* 0.294239192 */, 15 }, /* 974 */ { MAD_F(0x04b6db05) /* 0.294642466 */, 15 }, /* 975 */ { MAD_F(0x04b88207) /* 0.295045879 */, 15 }, /* 976 */ { MAD_F(0x04ba292e) /* 0.295449429 */, 15 }, /* 977 */ { MAD_F(0x04bbd07a) /* 0.295853118 */, 15 }, /* 978 */ { MAD_F(0x04bd77ec) /* 0.296256944 */, 15 }, /* 979 */ { MAD_F(0x04bf1f82) /* 0.296660907 */, 15 }, /* 980 */ { MAD_F(0x04c0c73d) /* 0.297065009 */, 15 }, /* 981 */ { MAD_F(0x04c26f1d) /* 0.297469248 */, 15 }, /* 982 */ { MAD_F(0x04c41722) /* 0.297873624 */, 15 }, /* 983 */ { MAD_F(0x04c5bf4c) /* 0.298278137 */, 15 }, /* 984 */ { MAD_F(0x04c7679a) /* 0.298682788 */, 15 }, /* 985 */ { MAD_F(0x04c9100d) /* 0.299087576 */, 15 }, /* 986 */ { MAD_F(0x04cab8a6) /* 0.299492500 */, 15 }, /* 987 */ { MAD_F(0x04cc6163) /* 0.299897562 */, 15 }, /* 988 */ { MAD_F(0x04ce0a44) /* 0.300302761 */, 15 }, /* 989 */ { MAD_F(0x04cfb34b) /* 0.300708096 */, 15 }, /* 990 */ { MAD_F(0x04d15c76) /* 0.301113568 */, 15 }, /* 991 */ { MAD_F(0x04d305c5) /* 0.301519176 */, 15 }, /* 992 */ { MAD_F(0x04d4af3a) /* 0.301924921 */, 15 }, /* 993 */ { MAD_F(0x04d658d2) /* 0.302330802 */, 15 }, /* 994 */ { MAD_F(0x04d80290) /* 0.302736820 */, 15 }, /* 995 */ { MAD_F(0x04d9ac72) /* 0.303142973 */, 15 }, /* 996 */ { MAD_F(0x04db5679) /* 0.303549263 */, 15 }, /* 997 */ { MAD_F(0x04dd00a4) /* 0.303955689 */, 15 }, /* 998 */ { MAD_F(0x04deaaf3) /* 0.304362251 */, 15 }, /* 999 */ { MAD_F(0x04e05567) /* 0.304768948 */, 15 }, /* 1000 */ { MAD_F(0x04e20000) /* 0.305175781 */, 15 }, /* 1001 */ { MAD_F(0x04e3aabd) /* 0.305582750 */, 15 }, /* 1002 */ { MAD_F(0x04e5559e) /* 0.305989854 */, 15 }, /* 1003 */ { MAD_F(0x04e700a3) /* 0.306397094 */, 15 }, /* 1004 */ { MAD_F(0x04e8abcd) /* 0.306804470 */, 15 }, /* 1005 */ { MAD_F(0x04ea571c) /* 0.307211980 */, 15 }, /* 1006 */ { MAD_F(0x04ec028e) /* 0.307619626 */, 15 }, /* 1007 */ { MAD_F(0x04edae25) /* 0.308027406 */, 15 }, /* 1008 */ { MAD_F(0x04ef59e0) /* 0.308435322 */, 15 }, /* 1009 */ { MAD_F(0x04f105bf) /* 0.308843373 */, 15 }, /* 1010 */ { MAD_F(0x04f2b1c3) /* 0.309251558 */, 15 }, /* 1011 */ { MAD_F(0x04f45dea) /* 0.309659879 */, 15 }, /* 1012 */ { MAD_F(0x04f60a36) /* 0.310068333 */, 15 }, /* 1013 */ { MAD_F(0x04f7b6a6) /* 0.310476923 */, 15 }, /* 1014 */ { MAD_F(0x04f9633a) /* 0.310885647 */, 15 }, /* 1015 */ { MAD_F(0x04fb0ff2) /* 0.311294505 */, 15 }, /* 1016 */ { MAD_F(0x04fcbcce) /* 0.311703498 */, 15 }, /* 1017 */ { MAD_F(0x04fe69ce) /* 0.312112625 */, 15 }, /* 1018 */ { MAD_F(0x050016f3) /* 0.312521885 */, 15 }, /* 1019 */ { MAD_F(0x0501c43b) /* 0.312931280 */, 15 }, /* 1020 */ { MAD_F(0x050371a7) /* 0.313340809 */, 15 }, /* 1021 */ { MAD_F(0x05051f37) /* 0.313750472 */, 15 }, /* 1022 */ { MAD_F(0x0506cceb) /* 0.314160269 */, 15 }, /* 1023 */ { MAD_F(0x05087ac2) /* 0.314570199 */, 15 }, /* 1024 */ { MAD_F(0x050a28be) /* 0.314980262 */, 15 }, /* 1025 */ { MAD_F(0x050bd6de) /* 0.315390460 */, 15 }, /* 1026 */ { MAD_F(0x050d8521) /* 0.315800790 */, 15 }, /* 1027 */ { MAD_F(0x050f3388) /* 0.316211255 */, 15 }, /* 1028 */ { MAD_F(0x0510e213) /* 0.316621852 */, 15 }, /* 1029 */ { MAD_F(0x051290c2) /* 0.317032582 */, 15 }, /* 1030 */ { MAD_F(0x05143f94) /* 0.317443446 */, 15 }, /* 1031 */ { MAD_F(0x0515ee8a) /* 0.317854442 */, 15 }, /* 1032 */ { MAD_F(0x05179da4) /* 0.318265572 */, 15 }, /* 1033 */ { MAD_F(0x05194ce1) /* 0.318676834 */, 15 }, /* 1034 */ { MAD_F(0x051afc42) /* 0.319088229 */, 15 }, /* 1035 */ { MAD_F(0x051cabc7) /* 0.319499756 */, 15 }, /* 1036 */ { MAD_F(0x051e5b6f) /* 0.319911417 */, 15 }, /* 1037 */ { MAD_F(0x05200b3a) /* 0.320323209 */, 15 }, /* 1038 */ { MAD_F(0x0521bb2a) /* 0.320735134 */, 15 }, /* 1039 */ { MAD_F(0x05236b3d) /* 0.321147192 */, 15 }, /* 1040 */ { MAD_F(0x05251b73) /* 0.321559381 */, 15 }, /* 1041 */ { MAD_F(0x0526cbcd) /* 0.321971703 */, 15 }, /* 1042 */ { MAD_F(0x05287c4a) /* 0.322384156 */, 15 }, /* 1043 */ { MAD_F(0x052a2cea) /* 0.322796742 */, 15 }, /* 1044 */ { MAD_F(0x052bddae) /* 0.323209460 */, 15 }, /* 1045 */ { MAD_F(0x052d8e96) /* 0.323622309 */, 15 }, /* 1046 */ { MAD_F(0x052f3fa1) /* 0.324035290 */, 15 }, /* 1047 */ { MAD_F(0x0530f0cf) /* 0.324448403 */, 15 }, /* 1048 */ { MAD_F(0x0532a220) /* 0.324861647 */, 15 }, /* 1049 */ { MAD_F(0x05345395) /* 0.325275023 */, 15 }, /* 1050 */ { MAD_F(0x0536052d) /* 0.325688530 */, 15 }, /* 1051 */ { MAD_F(0x0537b6e8) /* 0.326102168 */, 15 }, /* 1052 */ { MAD_F(0x053968c6) /* 0.326515938 */, 15 }, /* 1053 */ { MAD_F(0x053b1ac8) /* 0.326929839 */, 15 }, /* 1054 */ { MAD_F(0x053ccced) /* 0.327343870 */, 15 }, /* 1055 */ { MAD_F(0x053e7f35) /* 0.327758033 */, 15 }, /* 1056 */ { MAD_F(0x054031a0) /* 0.328172327 */, 15 }, /* 1057 */ { MAD_F(0x0541e42e) /* 0.328586751 */, 15 }, /* 1058 */ { MAD_F(0x054396df) /* 0.329001306 */, 15 }, /* 1059 */ { MAD_F(0x054549b4) /* 0.329415992 */, 15 }, /* 1060 */ { MAD_F(0x0546fcab) /* 0.329830808 */, 15 }, /* 1061 */ { MAD_F(0x0548afc6) /* 0.330245755 */, 15 }, /* 1062 */ { MAD_F(0x054a6303) /* 0.330660832 */, 15 }, /* 1063 */ { MAD_F(0x054c1663) /* 0.331076039 */, 15 }, /* 1064 */ { MAD_F(0x054dc9e7) /* 0.331491377 */, 15 }, /* 1065 */ { MAD_F(0x054f7d8d) /* 0.331906845 */, 15 }, /* 1066 */ { MAD_F(0x05513156) /* 0.332322443 */, 15 }, /* 1067 */ { MAD_F(0x0552e542) /* 0.332738170 */, 15 }, /* 1068 */ { MAD_F(0x05549951) /* 0.333154028 */, 15 }, /* 1069 */ { MAD_F(0x05564d83) /* 0.333570016 */, 15 }, /* 1070 */ { MAD_F(0x055801d8) /* 0.333986133 */, 15 }, /* 1071 */ { MAD_F(0x0559b64f) /* 0.334402380 */, 15 }, /* 1072 */ { MAD_F(0x055b6ae9) /* 0.334818756 */, 15 }, /* 1073 */ { MAD_F(0x055d1fa6) /* 0.335235262 */, 15 }, /* 1074 */ { MAD_F(0x055ed486) /* 0.335651898 */, 15 }, /* 1075 */ { MAD_F(0x05608988) /* 0.336068662 */, 15 }, /* 1076 */ { MAD_F(0x05623ead) /* 0.336485556 */, 15 }, /* 1077 */ { MAD_F(0x0563f3f5) /* 0.336902579 */, 15 }, /* 1078 */ { MAD_F(0x0565a960) /* 0.337319732 */, 15 }, /* 1079 */ { MAD_F(0x05675eed) /* 0.337737013 */, 15 }, /* 1080 */ { MAD_F(0x0569149c) /* 0.338154423 */, 15 }, /* 1081 */ { MAD_F(0x056aca6f) /* 0.338571962 */, 15 }, /* 1082 */ { MAD_F(0x056c8064) /* 0.338989630 */, 15 }, /* 1083 */ { MAD_F(0x056e367b) /* 0.339407426 */, 15 }, /* 1084 */ { MAD_F(0x056fecb5) /* 0.339825351 */, 15 }, /* 1085 */ { MAD_F(0x0571a311) /* 0.340243405 */, 15 }, /* 1086 */ { MAD_F(0x05735990) /* 0.340661587 */, 15 }, /* 1087 */ { MAD_F(0x05751032) /* 0.341079898 */, 15 }, /* 1088 */ { MAD_F(0x0576c6f5) /* 0.341498336 */, 15 }, /* 1089 */ { MAD_F(0x05787ddc) /* 0.341916903 */, 15 }, /* 1090 */ { MAD_F(0x057a34e4) /* 0.342335598 */, 15 }, /* 1091 */ { MAD_F(0x057bec0f) /* 0.342754421 */, 15 }, /* 1092 */ { MAD_F(0x057da35d) /* 0.343173373 */, 15 }, /* 1093 */ { MAD_F(0x057f5acc) /* 0.343592452 */, 15 }, /* 1094 */ { MAD_F(0x0581125e) /* 0.344011659 */, 15 }, /* 1095 */ { MAD_F(0x0582ca12) /* 0.344430993 */, 15 }, /* 1096 */ { MAD_F(0x058481e9) /* 0.344850455 */, 15 }, /* 1097 */ { MAD_F(0x058639e2) /* 0.345270045 */, 15 }, /* 1098 */ { MAD_F(0x0587f1fd) /* 0.345689763 */, 15 }, /* 1099 */ { MAD_F(0x0589aa3a) /* 0.346109608 */, 15 }, /* 1100 */ { MAD_F(0x058b629a) /* 0.346529580 */, 15 }, /* 1101 */ { MAD_F(0x058d1b1b) /* 0.346949679 */, 15 }, /* 1102 */ { MAD_F(0x058ed3bf) /* 0.347369906 */, 15 }, /* 1103 */ { MAD_F(0x05908c85) /* 0.347790260 */, 15 }, /* 1104 */ { MAD_F(0x0592456d) /* 0.348210741 */, 15 }, /* 1105 */ { MAD_F(0x0593fe77) /* 0.348631348 */, 15 }, /* 1106 */ { MAD_F(0x0595b7a3) /* 0.349052083 */, 15 }, /* 1107 */ { MAD_F(0x059770f1) /* 0.349472945 */, 15 }, /* 1108 */ { MAD_F(0x05992a61) /* 0.349893933 */, 15 }, /* 1109 */ { MAD_F(0x059ae3f3) /* 0.350315048 */, 15 }, /* 1110 */ { MAD_F(0x059c9da8) /* 0.350736290 */, 15 }, /* 1111 */ { MAD_F(0x059e577e) /* 0.351157658 */, 15 }, /* 1112 */ { MAD_F(0x05a01176) /* 0.351579152 */, 15 }, /* 1113 */ { MAD_F(0x05a1cb90) /* 0.352000773 */, 15 }, /* 1114 */ { MAD_F(0x05a385cc) /* 0.352422520 */, 15 }, /* 1115 */ { MAD_F(0x05a5402a) /* 0.352844394 */, 15 }, /* 1116 */ { MAD_F(0x05a6faa9) /* 0.353266393 */, 15 }, /* 1117 */ { MAD_F(0x05a8b54b) /* 0.353688519 */, 15 }, /* 1118 */ { MAD_F(0x05aa700e) /* 0.354110771 */, 15 }, /* 1119 */ { MAD_F(0x05ac2af3) /* 0.354533148 */, 15 }, /* 1120 */ { MAD_F(0x05ade5fa) /* 0.354955651 */, 15 }, /* 1121 */ { MAD_F(0x05afa123) /* 0.355378281 */, 15 }, /* 1122 */ { MAD_F(0x05b15c6d) /* 0.355801035 */, 15 }, /* 1123 */ { MAD_F(0x05b317d9) /* 0.356223916 */, 15 }, /* 1124 */ { MAD_F(0x05b4d367) /* 0.356646922 */, 15 }, /* 1125 */ { MAD_F(0x05b68f16) /* 0.357070053 */, 15 }, /* 1126 */ { MAD_F(0x05b84ae7) /* 0.357493310 */, 15 }, /* 1127 */ { MAD_F(0x05ba06da) /* 0.357916692 */, 15 }, /* 1128 */ { MAD_F(0x05bbc2ef) /* 0.358340200 */, 15 }, /* 1129 */ { MAD_F(0x05bd7f25) /* 0.358763832 */, 15 }, /* 1130 */ { MAD_F(0x05bf3b7c) /* 0.359187590 */, 15 }, /* 1131 */ { MAD_F(0x05c0f7f5) /* 0.359611472 */, 15 }, /* 1132 */ { MAD_F(0x05c2b490) /* 0.360035480 */, 15 }, /* 1133 */ { MAD_F(0x05c4714c) /* 0.360459613 */, 15 }, /* 1134 */ { MAD_F(0x05c62e2a) /* 0.360883870 */, 15 }, /* 1135 */ { MAD_F(0x05c7eb29) /* 0.361308252 */, 15 }, /* 1136 */ { MAD_F(0x05c9a84a) /* 0.361732758 */, 15 }, /* 1137 */ { MAD_F(0x05cb658c) /* 0.362157390 */, 15 }, /* 1138 */ { MAD_F(0x05cd22ef) /* 0.362582145 */, 15 }, /* 1139 */ { MAD_F(0x05cee074) /* 0.363007026 */, 15 }, /* 1140 */ { MAD_F(0x05d09e1b) /* 0.363432030 */, 15 }, /* 1141 */ { MAD_F(0x05d25be2) /* 0.363857159 */, 15 }, /* 1142 */ { MAD_F(0x05d419cb) /* 0.364282412 */, 15 }, /* 1143 */ { MAD_F(0x05d5d7d5) /* 0.364707789 */, 15 }, /* 1144 */ { MAD_F(0x05d79601) /* 0.365133291 */, 15 }, /* 1145 */ { MAD_F(0x05d9544e) /* 0.365558916 */, 15 }, /* 1146 */ { MAD_F(0x05db12bc) /* 0.365984665 */, 15 }, /* 1147 */ { MAD_F(0x05dcd14c) /* 0.366410538 */, 15 }, /* 1148 */ { MAD_F(0x05de8ffc) /* 0.366836535 */, 15 }, /* 1149 */ { MAD_F(0x05e04ece) /* 0.367262655 */, 15 }, /* 1150 */ { MAD_F(0x05e20dc1) /* 0.367688900 */, 15 }, /* 1151 */ { MAD_F(0x05e3ccd5) /* 0.368115267 */, 15 }, /* 1152 */ { MAD_F(0x05e58c0b) /* 0.368541759 */, 15 }, /* 1153 */ { MAD_F(0x05e74b61) /* 0.368968373 */, 15 }, /* 1154 */ { MAD_F(0x05e90ad9) /* 0.369395111 */, 15 }, /* 1155 */ { MAD_F(0x05eaca72) /* 0.369821973 */, 15 }, /* 1156 */ { MAD_F(0x05ec8a2b) /* 0.370248957 */, 15 }, /* 1157 */ { MAD_F(0x05ee4a06) /* 0.370676065 */, 15 }, /* 1158 */ { MAD_F(0x05f00a02) /* 0.371103295 */, 15 }, /* 1159 */ { MAD_F(0x05f1ca1f) /* 0.371530649 */, 15 }, /* 1160 */ { MAD_F(0x05f38a5d) /* 0.371958126 */, 15 }, /* 1161 */ { MAD_F(0x05f54abc) /* 0.372385725 */, 15 }, /* 1162 */ { MAD_F(0x05f70b3c) /* 0.372813448 */, 15 }, /* 1163 */ { MAD_F(0x05f8cbdc) /* 0.373241292 */, 15 }, /* 1164 */ { MAD_F(0x05fa8c9e) /* 0.373669260 */, 15 }, /* 1165 */ { MAD_F(0x05fc4d81) /* 0.374097350 */, 15 }, /* 1166 */ { MAD_F(0x05fe0e84) /* 0.374525563 */, 15 }, /* 1167 */ { MAD_F(0x05ffcfa8) /* 0.374953898 */, 15 }, /* 1168 */ { MAD_F(0x060190ee) /* 0.375382356 */, 15 }, /* 1169 */ { MAD_F(0x06035254) /* 0.375810936 */, 15 }, /* 1170 */ { MAD_F(0x060513da) /* 0.376239638 */, 15 }, /* 1171 */ { MAD_F(0x0606d582) /* 0.376668462 */, 15 }, /* 1172 */ { MAD_F(0x0608974a) /* 0.377097408 */, 15 }, /* 1173 */ { MAD_F(0x060a5934) /* 0.377526476 */, 15 }, /* 1174 */ { MAD_F(0x060c1b3d) /* 0.377955667 */, 15 }, /* 1175 */ { MAD_F(0x060ddd68) /* 0.378384979 */, 15 }, /* 1176 */ { MAD_F(0x060f9fb3) /* 0.378814413 */, 15 }, /* 1177 */ { MAD_F(0x0611621f) /* 0.379243968 */, 15 }, /* 1178 */ { MAD_F(0x061324ac) /* 0.379673646 */, 15 }, /* 1179 */ { MAD_F(0x0614e759) /* 0.380103444 */, 15 }, /* 1180 */ { MAD_F(0x0616aa27) /* 0.380533365 */, 15 }, /* 1181 */ { MAD_F(0x06186d16) /* 0.380963407 */, 15 }, /* 1182 */ { MAD_F(0x061a3025) /* 0.381393570 */, 15 }, /* 1183 */ { MAD_F(0x061bf354) /* 0.381823855 */, 15 }, /* 1184 */ { MAD_F(0x061db6a5) /* 0.382254261 */, 15 }, /* 1185 */ { MAD_F(0x061f7a15) /* 0.382684788 */, 15 }, /* 1186 */ { MAD_F(0x06213da7) /* 0.383115436 */, 15 }, /* 1187 */ { MAD_F(0x06230158) /* 0.383546205 */, 15 }, /* 1188 */ { MAD_F(0x0624c52a) /* 0.383977096 */, 15 }, /* 1189 */ { MAD_F(0x0626891d) /* 0.384408107 */, 15 }, /* 1190 */ { MAD_F(0x06284d30) /* 0.384839239 */, 15 }, /* 1191 */ { MAD_F(0x062a1164) /* 0.385270492 */, 15 }, /* 1192 */ { MAD_F(0x062bd5b8) /* 0.385701865 */, 15 }, /* 1193 */ { MAD_F(0x062d9a2c) /* 0.386133359 */, 15 }, /* 1194 */ { MAD_F(0x062f5ec1) /* 0.386564974 */, 15 }, /* 1195 */ { MAD_F(0x06312376) /* 0.386996709 */, 15 }, /* 1196 */ { MAD_F(0x0632e84b) /* 0.387428565 */, 15 }, /* 1197 */ { MAD_F(0x0634ad41) /* 0.387860541 */, 15 }, /* 1198 */ { MAD_F(0x06367257) /* 0.388292637 */, 15 }, /* 1199 */ { MAD_F(0x0638378d) /* 0.388724854 */, 15 }, /* 1200 */ { MAD_F(0x0639fce4) /* 0.389157191 */, 15 }, /* 1201 */ { MAD_F(0x063bc25b) /* 0.389589648 */, 15 }, /* 1202 */ { MAD_F(0x063d87f2) /* 0.390022225 */, 15 }, /* 1203 */ { MAD_F(0x063f4da9) /* 0.390454922 */, 15 }, /* 1204 */ { MAD_F(0x06411380) /* 0.390887739 */, 15 }, /* 1205 */ { MAD_F(0x0642d978) /* 0.391320675 */, 15 }, /* 1206 */ { MAD_F(0x06449f8f) /* 0.391753732 */, 15 }, /* 1207 */ { MAD_F(0x064665c7) /* 0.392186908 */, 15 }, /* 1208 */ { MAD_F(0x06482c1f) /* 0.392620204 */, 15 }, /* 1209 */ { MAD_F(0x0649f297) /* 0.393053619 */, 15 }, /* 1210 */ { MAD_F(0x064bb92f) /* 0.393487154 */, 15 }, /* 1211 */ { MAD_F(0x064d7fe8) /* 0.393920808 */, 15 }, /* 1212 */ { MAD_F(0x064f46c0) /* 0.394354582 */, 15 }, /* 1213 */ { MAD_F(0x06510db8) /* 0.394788475 */, 15 }, /* 1214 */ { MAD_F(0x0652d4d0) /* 0.395222488 */, 15 }, /* 1215 */ { MAD_F(0x06549c09) /* 0.395656619 */, 15 }, /* 1216 */ { MAD_F(0x06566361) /* 0.396090870 */, 15 }, /* 1217 */ { MAD_F(0x06582ad9) /* 0.396525239 */, 15 }, /* 1218 */ { MAD_F(0x0659f271) /* 0.396959728 */, 15 }, /* 1219 */ { MAD_F(0x065bba29) /* 0.397394336 */, 15 }, /* 1220 */ { MAD_F(0x065d8201) /* 0.397829062 */, 15 }, /* 1221 */ { MAD_F(0x065f49f9) /* 0.398263907 */, 15 }, /* 1222 */ { MAD_F(0x06611211) /* 0.398698871 */, 15 }, /* 1223 */ { MAD_F(0x0662da49) /* 0.399133954 */, 15 }, /* 1224 */ { MAD_F(0x0664a2a0) /* 0.399569155 */, 15 }, /* 1225 */ { MAD_F(0x06666b17) /* 0.400004475 */, 15 }, /* 1226 */ { MAD_F(0x066833ae) /* 0.400439913 */, 15 }, /* 1227 */ { MAD_F(0x0669fc65) /* 0.400875470 */, 15 }, /* 1228 */ { MAD_F(0x066bc53c) /* 0.401311145 */, 15 }, /* 1229 */ { MAD_F(0x066d8e32) /* 0.401746938 */, 15 }, /* 1230 */ { MAD_F(0x066f5748) /* 0.402182850 */, 15 }, /* 1231 */ { MAD_F(0x0671207e) /* 0.402618879 */, 15 }, /* 1232 */ { MAD_F(0x0672e9d4) /* 0.403055027 */, 15 }, /* 1233 */ { MAD_F(0x0674b349) /* 0.403491293 */, 15 }, /* 1234 */ { MAD_F(0x06767cde) /* 0.403927676 */, 15 }, /* 1235 */ { MAD_F(0x06784692) /* 0.404364178 */, 15 }, /* 1236 */ { MAD_F(0x067a1066) /* 0.404800797 */, 15 }, /* 1237 */ { MAD_F(0x067bda5a) /* 0.405237535 */, 15 }, /* 1238 */ { MAD_F(0x067da46d) /* 0.405674390 */, 15 }, /* 1239 */ { MAD_F(0x067f6ea0) /* 0.406111362 */, 15 }, /* 1240 */ { MAD_F(0x068138f3) /* 0.406548452 */, 15 }, /* 1241 */ { MAD_F(0x06830365) /* 0.406985660 */, 15 }, /* 1242 */ { MAD_F(0x0684cdf6) /* 0.407422985 */, 15 }, /* 1243 */ { MAD_F(0x068698a8) /* 0.407860427 */, 15 }, /* 1244 */ { MAD_F(0x06886378) /* 0.408297987 */, 15 }, /* 1245 */ { MAD_F(0x068a2e68) /* 0.408735664 */, 15 }, /* 1246 */ { MAD_F(0x068bf978) /* 0.409173458 */, 15 }, /* 1247 */ { MAD_F(0x068dc4a7) /* 0.409611370 */, 15 }, /* 1248 */ { MAD_F(0x068f8ff5) /* 0.410049398 */, 15 }, /* 1249 */ { MAD_F(0x06915b63) /* 0.410487544 */, 15 }, /* 1250 */ { MAD_F(0x069326f0) /* 0.410925806 */, 15 }, /* 1251 */ { MAD_F(0x0694f29c) /* 0.411364185 */, 15 }, /* 1252 */ { MAD_F(0x0696be68) /* 0.411802681 */, 15 }, /* 1253 */ { MAD_F(0x06988a54) /* 0.412241294 */, 15 }, /* 1254 */ { MAD_F(0x069a565e) /* 0.412680024 */, 15 }, /* 1255 */ { MAD_F(0x069c2288) /* 0.413118870 */, 15 }, /* 1256 */ { MAD_F(0x069deed1) /* 0.413557833 */, 15 }, /* 1257 */ { MAD_F(0x069fbb3a) /* 0.413996912 */, 15 }, /* 1258 */ { MAD_F(0x06a187c1) /* 0.414436108 */, 15 }, /* 1259 */ { MAD_F(0x06a35468) /* 0.414875420 */, 15 }, /* 1260 */ { MAD_F(0x06a5212f) /* 0.415314849 */, 15 }, /* 1261 */ { MAD_F(0x06a6ee14) /* 0.415754393 */, 15 }, /* 1262 */ { MAD_F(0x06a8bb18) /* 0.416194054 */, 15 }, /* 1263 */ { MAD_F(0x06aa883c) /* 0.416633831 */, 15 }, /* 1264 */ { MAD_F(0x06ac557f) /* 0.417073724 */, 15 }, /* 1265 */ { MAD_F(0x06ae22e1) /* 0.417513734 */, 15 }, /* 1266 */ { MAD_F(0x06aff062) /* 0.417953859 */, 15 }, /* 1267 */ { MAD_F(0x06b1be03) /* 0.418394100 */, 15 }, /* 1268 */ { MAD_F(0x06b38bc2) /* 0.418834457 */, 15 }, /* 1269 */ { MAD_F(0x06b559a1) /* 0.419274929 */, 15 }, /* 1270 */ { MAD_F(0x06b7279e) /* 0.419715518 */, 15 }, /* 1271 */ { MAD_F(0x06b8f5bb) /* 0.420156222 */, 15 }, /* 1272 */ { MAD_F(0x06bac3f6) /* 0.420597041 */, 15 }, /* 1273 */ { MAD_F(0x06bc9251) /* 0.421037977 */, 15 }, /* 1274 */ { MAD_F(0x06be60cb) /* 0.421479027 */, 15 }, /* 1275 */ { MAD_F(0x06c02f63) /* 0.421920193 */, 15 }, /* 1276 */ { MAD_F(0x06c1fe1b) /* 0.422361475 */, 15 }, /* 1277 */ { MAD_F(0x06c3ccf1) /* 0.422802871 */, 15 }, /* 1278 */ { MAD_F(0x06c59be7) /* 0.423244383 */, 15 }, /* 1279 */ { MAD_F(0x06c76afb) /* 0.423686010 */, 15 }, /* 1280 */ { MAD_F(0x06c93a2e) /* 0.424127753 */, 15 }, /* 1281 */ { MAD_F(0x06cb0981) /* 0.424569610 */, 15 }, /* 1282 */ { MAD_F(0x06ccd8f2) /* 0.425011582 */, 15 }, /* 1283 */ { MAD_F(0x06cea881) /* 0.425453669 */, 15 }, /* 1284 */ { MAD_F(0x06d07830) /* 0.425895871 */, 15 }, /* 1285 */ { MAD_F(0x06d247fe) /* 0.426338188 */, 15 }, /* 1286 */ { MAD_F(0x06d417ea) /* 0.426780620 */, 15 }, /* 1287 */ { MAD_F(0x06d5e7f5) /* 0.427223166 */, 15 }, /* 1288 */ { MAD_F(0x06d7b81f) /* 0.427665827 */, 15 }, /* 1289 */ { MAD_F(0x06d98868) /* 0.428108603 */, 15 }, /* 1290 */ { MAD_F(0x06db58cf) /* 0.428551493 */, 15 }, /* 1291 */ { MAD_F(0x06dd2955) /* 0.428994497 */, 15 }, /* 1292 */ { MAD_F(0x06def9fa) /* 0.429437616 */, 15 }, /* 1293 */ { MAD_F(0x06e0cabe) /* 0.429880849 */, 15 }, /* 1294 */ { MAD_F(0x06e29ba0) /* 0.430324197 */, 15 }, /* 1295 */ { MAD_F(0x06e46ca1) /* 0.430767659 */, 15 }, /* 1296 */ { MAD_F(0x06e63dc0) /* 0.431211234 */, 15 }, /* 1297 */ { MAD_F(0x06e80efe) /* 0.431654924 */, 15 }, /* 1298 */ { MAD_F(0x06e9e05b) /* 0.432098728 */, 15 }, /* 1299 */ { MAD_F(0x06ebb1d6) /* 0.432542647 */, 15 }, /* 1300 */ { MAD_F(0x06ed8370) /* 0.432986678 */, 15 }, /* 1301 */ { MAD_F(0x06ef5529) /* 0.433430824 */, 15 }, /* 1302 */ { MAD_F(0x06f12700) /* 0.433875084 */, 15 }, /* 1303 */ { MAD_F(0x06f2f8f5) /* 0.434319457 */, 15 }, /* 1304 */ { MAD_F(0x06f4cb09) /* 0.434763944 */, 15 }, /* 1305 */ { MAD_F(0x06f69d3c) /* 0.435208545 */, 15 }, /* 1306 */ { MAD_F(0x06f86f8d) /* 0.435653259 */, 15 }, /* 1307 */ { MAD_F(0x06fa41fd) /* 0.436098087 */, 15 }, /* 1308 */ { MAD_F(0x06fc148b) /* 0.436543029 */, 15 }, /* 1309 */ { MAD_F(0x06fde737) /* 0.436988083 */, 15 }, /* 1310 */ { MAD_F(0x06ffba02) /* 0.437433251 */, 15 }, /* 1311 */ { MAD_F(0x07018ceb) /* 0.437878533 */, 15 }, /* 1312 */ { MAD_F(0x07035ff3) /* 0.438323927 */, 15 }, /* 1313 */ { MAD_F(0x07053319) /* 0.438769435 */, 15 }, /* 1314 */ { MAD_F(0x0707065d) /* 0.439215056 */, 15 }, /* 1315 */ { MAD_F(0x0708d9c0) /* 0.439660790 */, 15 }, /* 1316 */ { MAD_F(0x070aad41) /* 0.440106636 */, 15 }, /* 1317 */ { MAD_F(0x070c80e1) /* 0.440552596 */, 15 }, /* 1318 */ { MAD_F(0x070e549f) /* 0.440998669 */, 15 }, /* 1319 */ { MAD_F(0x0710287b) /* 0.441444855 */, 15 }, /* 1320 */ { MAD_F(0x0711fc75) /* 0.441891153 */, 15 }, /* 1321 */ { MAD_F(0x0713d08d) /* 0.442337564 */, 15 }, /* 1322 */ { MAD_F(0x0715a4c4) /* 0.442784088 */, 15 }, /* 1323 */ { MAD_F(0x07177919) /* 0.443230724 */, 15 }, /* 1324 */ { MAD_F(0x07194d8c) /* 0.443677473 */, 15 }, /* 1325 */ { MAD_F(0x071b221e) /* 0.444124334 */, 15 }, /* 1326 */ { MAD_F(0x071cf6ce) /* 0.444571308 */, 15 }, /* 1327 */ { MAD_F(0x071ecb9b) /* 0.445018394 */, 15 }, /* 1328 */ { MAD_F(0x0720a087) /* 0.445465593 */, 15 }, /* 1329 */ { MAD_F(0x07227591) /* 0.445912903 */, 15 }, /* 1330 */ { MAD_F(0x07244ab9) /* 0.446360326 */, 15 }, /* 1331 */ { MAD_F(0x07262000) /* 0.446807861 */, 15 }, /* 1332 */ { MAD_F(0x0727f564) /* 0.447255509 */, 15 }, /* 1333 */ { MAD_F(0x0729cae7) /* 0.447703268 */, 15 }, /* 1334 */ { MAD_F(0x072ba087) /* 0.448151139 */, 15 }, /* 1335 */ { MAD_F(0x072d7646) /* 0.448599122 */, 15 }, /* 1336 */ { MAD_F(0x072f4c22) /* 0.449047217 */, 15 }, /* 1337 */ { MAD_F(0x0731221d) /* 0.449495424 */, 15 }, /* 1338 */ { MAD_F(0x0732f835) /* 0.449943742 */, 15 }, /* 1339 */ { MAD_F(0x0734ce6c) /* 0.450392173 */, 15 }, /* 1340 */ { MAD_F(0x0736a4c1) /* 0.450840715 */, 15 }, /* 1341 */ { MAD_F(0x07387b33) /* 0.451289368 */, 15 }, /* 1342 */ { MAD_F(0x073a51c4) /* 0.451738133 */, 15 }, /* 1343 */ { MAD_F(0x073c2872) /* 0.452187010 */, 15 }, /* 1344 */ { MAD_F(0x073dff3e) /* 0.452635998 */, 15 }, /* 1345 */ { MAD_F(0x073fd628) /* 0.453085097 */, 15 }, /* 1346 */ { MAD_F(0x0741ad30) /* 0.453534308 */, 15 }, /* 1347 */ { MAD_F(0x07438456) /* 0.453983630 */, 15 }, /* 1348 */ { MAD_F(0x07455b9a) /* 0.454433063 */, 15 }, /* 1349 */ { MAD_F(0x074732fc) /* 0.454882607 */, 15 }, /* 1350 */ { MAD_F(0x07490a7b) /* 0.455332262 */, 15 }, /* 1351 */ { MAD_F(0x074ae218) /* 0.455782029 */, 15 }, /* 1352 */ { MAD_F(0x074cb9d3) /* 0.456231906 */, 15 }, /* 1353 */ { MAD_F(0x074e91ac) /* 0.456681894 */, 15 }, /* 1354 */ { MAD_F(0x075069a3) /* 0.457131993 */, 15 }, /* 1355 */ { MAD_F(0x075241b7) /* 0.457582203 */, 15 }, /* 1356 */ { MAD_F(0x075419e9) /* 0.458032524 */, 15 }, /* 1357 */ { MAD_F(0x0755f239) /* 0.458482956 */, 15 }, /* 1358 */ { MAD_F(0x0757caa7) /* 0.458933498 */, 15 }, /* 1359 */ { MAD_F(0x0759a332) /* 0.459384151 */, 15 }, /* 1360 */ { MAD_F(0x075b7bdb) /* 0.459834914 */, 15 }, /* 1361 */ { MAD_F(0x075d54a1) /* 0.460285788 */, 15 }, /* 1362 */ { MAD_F(0x075f2d85) /* 0.460736772 */, 15 }, /* 1363 */ { MAD_F(0x07610687) /* 0.461187867 */, 15 }, /* 1364 */ { MAD_F(0x0762dfa6) /* 0.461639071 */, 15 }, /* 1365 */ { MAD_F(0x0764b8e3) /* 0.462090387 */, 15 }, /* 1366 */ { MAD_F(0x0766923e) /* 0.462541812 */, 15 }, /* 1367 */ { MAD_F(0x07686bb6) /* 0.462993348 */, 15 }, /* 1368 */ { MAD_F(0x076a454c) /* 0.463444993 */, 15 }, /* 1369 */ { MAD_F(0x076c1eff) /* 0.463896749 */, 15 }, /* 1370 */ { MAD_F(0x076df8d0) /* 0.464348615 */, 15 }, /* 1371 */ { MAD_F(0x076fd2be) /* 0.464800591 */, 15 }, /* 1372 */ { MAD_F(0x0771acca) /* 0.465252676 */, 15 }, /* 1373 */ { MAD_F(0x077386f3) /* 0.465704872 */, 15 }, /* 1374 */ { MAD_F(0x0775613a) /* 0.466157177 */, 15 }, /* 1375 */ { MAD_F(0x07773b9e) /* 0.466609592 */, 15 }, /* 1376 */ { MAD_F(0x07791620) /* 0.467062117 */, 15 }, /* 1377 */ { MAD_F(0x077af0bf) /* 0.467514751 */, 15 }, /* 1378 */ { MAD_F(0x077ccb7c) /* 0.467967495 */, 15 }, /* 1379 */ { MAD_F(0x077ea656) /* 0.468420349 */, 15 }, /* 1380 */ { MAD_F(0x0780814d) /* 0.468873312 */, 15 }, /* 1381 */ { MAD_F(0x07825c62) /* 0.469326384 */, 15 }, /* 1382 */ { MAD_F(0x07843794) /* 0.469779566 */, 15 }, /* 1383 */ { MAD_F(0x078612e3) /* 0.470232857 */, 15 }, /* 1384 */ { MAD_F(0x0787ee50) /* 0.470686258 */, 15 }, /* 1385 */ { MAD_F(0x0789c9da) /* 0.471139767 */, 15 }, /* 1386 */ { MAD_F(0x078ba581) /* 0.471593386 */, 15 }, /* 1387 */ { MAD_F(0x078d8146) /* 0.472047114 */, 15 }, /* 1388 */ { MAD_F(0x078f5d28) /* 0.472500951 */, 15 }, /* 1389 */ { MAD_F(0x07913927) /* 0.472954896 */, 15 }, /* 1390 */ { MAD_F(0x07931543) /* 0.473408951 */, 15 }, /* 1391 */ { MAD_F(0x0794f17d) /* 0.473863115 */, 15 }, /* 1392 */ { MAD_F(0x0796cdd4) /* 0.474317388 */, 15 }, /* 1393 */ { MAD_F(0x0798aa48) /* 0.474771769 */, 15 }, /* 1394 */ { MAD_F(0x079a86d9) /* 0.475226259 */, 15 }, /* 1395 */ { MAD_F(0x079c6388) /* 0.475680858 */, 15 }, /* 1396 */ { MAD_F(0x079e4053) /* 0.476135565 */, 15 }, /* 1397 */ { MAD_F(0x07a01d3c) /* 0.476590381 */, 15 }, /* 1398 */ { MAD_F(0x07a1fa42) /* 0.477045306 */, 15 }, /* 1399 */ { MAD_F(0x07a3d765) /* 0.477500339 */, 15 }, /* 1400 */ { MAD_F(0x07a5b4a5) /* 0.477955481 */, 15 }, /* 1401 */ { MAD_F(0x07a79202) /* 0.478410731 */, 15 }, /* 1402 */ { MAD_F(0x07a96f7d) /* 0.478866089 */, 15 }, /* 1403 */ { MAD_F(0x07ab4d14) /* 0.479321555 */, 15 }, /* 1404 */ { MAD_F(0x07ad2ac8) /* 0.479777130 */, 15 }, /* 1405 */ { MAD_F(0x07af089a) /* 0.480232813 */, 15 }, /* 1406 */ { MAD_F(0x07b0e688) /* 0.480688604 */, 15 }, /* 1407 */ { MAD_F(0x07b2c494) /* 0.481144503 */, 15 }, /* 1408 */ { MAD_F(0x07b4a2bc) /* 0.481600510 */, 15 }, /* 1409 */ { MAD_F(0x07b68102) /* 0.482056625 */, 15 }, /* 1410 */ { MAD_F(0x07b85f64) /* 0.482512848 */, 15 }, /* 1411 */ { MAD_F(0x07ba3de4) /* 0.482969179 */, 15 }, /* 1412 */ { MAD_F(0x07bc1c80) /* 0.483425618 */, 15 }, /* 1413 */ { MAD_F(0x07bdfb39) /* 0.483882164 */, 15 }, /* 1414 */ { MAD_F(0x07bfda0f) /* 0.484338818 */, 15 }, /* 1415 */ { MAD_F(0x07c1b902) /* 0.484795580 */, 15 }, /* 1416 */ { MAD_F(0x07c39812) /* 0.485252449 */, 15 }, /* 1417 */ { MAD_F(0x07c5773f) /* 0.485709426 */, 15 }, /* 1418 */ { MAD_F(0x07c75689) /* 0.486166511 */, 15 }, /* 1419 */ { MAD_F(0x07c935ef) /* 0.486623703 */, 15 }, /* 1420 */ { MAD_F(0x07cb1573) /* 0.487081002 */, 15 }, /* 1421 */ { MAD_F(0x07ccf513) /* 0.487538409 */, 15 }, /* 1422 */ { MAD_F(0x07ced4d0) /* 0.487995923 */, 15 }, /* 1423 */ { MAD_F(0x07d0b4aa) /* 0.488453544 */, 15 }, /* 1424 */ { MAD_F(0x07d294a0) /* 0.488911273 */, 15 }, /* 1425 */ { MAD_F(0x07d474b3) /* 0.489369108 */, 15 }, /* 1426 */ { MAD_F(0x07d654e4) /* 0.489827051 */, 15 }, /* 1427 */ { MAD_F(0x07d83530) /* 0.490285101 */, 15 }, /* 1428 */ { MAD_F(0x07da159a) /* 0.490743258 */, 15 }, /* 1429 */ { MAD_F(0x07dbf620) /* 0.491201522 */, 15 }, /* 1430 */ { MAD_F(0x07ddd6c3) /* 0.491659892 */, 15 }, /* 1431 */ { MAD_F(0x07dfb783) /* 0.492118370 */, 15 }, /* 1432 */ { MAD_F(0x07e1985f) /* 0.492576954 */, 15 }, /* 1433 */ { MAD_F(0x07e37958) /* 0.493035645 */, 15 }, /* 1434 */ { MAD_F(0x07e55a6e) /* 0.493494443 */, 15 }, /* 1435 */ { MAD_F(0x07e73ba0) /* 0.493953348 */, 15 }, /* 1436 */ { MAD_F(0x07e91cef) /* 0.494412359 */, 15 }, /* 1437 */ { MAD_F(0x07eafe5a) /* 0.494871476 */, 15 }, /* 1438 */ { MAD_F(0x07ecdfe2) /* 0.495330701 */, 15 }, /* 1439 */ { MAD_F(0x07eec187) /* 0.495790031 */, 15 }, /* 1440 */ { MAD_F(0x07f0a348) /* 0.496249468 */, 15 }, /* 1441 */ { MAD_F(0x07f28526) /* 0.496709012 */, 15 }, /* 1442 */ { MAD_F(0x07f46720) /* 0.497168662 */, 15 }, /* 1443 */ { MAD_F(0x07f64937) /* 0.497628418 */, 15 }, /* 1444 */ { MAD_F(0x07f82b6a) /* 0.498088280 */, 15 }, /* 1445 */ { MAD_F(0x07fa0dba) /* 0.498548248 */, 15 }, /* 1446 */ { MAD_F(0x07fbf026) /* 0.499008323 */, 15 }, /* 1447 */ { MAD_F(0x07fdd2af) /* 0.499468503 */, 15 }, /* 1448 */ { MAD_F(0x07ffb554) /* 0.499928790 */, 15 }, /* 1449 */ { MAD_F(0x0400cc0b) /* 0.250194591 */, 16 }, /* 1450 */ { MAD_F(0x0401bd7a) /* 0.250424840 */, 16 }, /* 1451 */ { MAD_F(0x0402aef7) /* 0.250655143 */, 16 }, /* 1452 */ { MAD_F(0x0403a083) /* 0.250885498 */, 16 }, /* 1453 */ { MAD_F(0x0404921c) /* 0.251115906 */, 16 }, /* 1454 */ { MAD_F(0x040583c4) /* 0.251346367 */, 16 }, /* 1455 */ { MAD_F(0x0406757a) /* 0.251576880 */, 16 }, /* 1456 */ { MAD_F(0x0407673f) /* 0.251807447 */, 16 }, /* 1457 */ { MAD_F(0x04085911) /* 0.252038066 */, 16 }, /* 1458 */ { MAD_F(0x04094af1) /* 0.252268738 */, 16 }, /* 1459 */ { MAD_F(0x040a3ce0) /* 0.252499463 */, 16 }, /* 1460 */ { MAD_F(0x040b2edd) /* 0.252730240 */, 16 }, /* 1461 */ { MAD_F(0x040c20e8) /* 0.252961071 */, 16 }, /* 1462 */ { MAD_F(0x040d1301) /* 0.253191953 */, 16 }, /* 1463 */ { MAD_F(0x040e0529) /* 0.253422889 */, 16 }, /* 1464 */ { MAD_F(0x040ef75e) /* 0.253653877 */, 16 }, /* 1465 */ { MAD_F(0x040fe9a1) /* 0.253884918 */, 16 }, /* 1466 */ { MAD_F(0x0410dbf3) /* 0.254116011 */, 16 }, /* 1467 */ { MAD_F(0x0411ce53) /* 0.254347157 */, 16 }, /* 1468 */ { MAD_F(0x0412c0c1) /* 0.254578356 */, 16 }, /* 1469 */ { MAD_F(0x0413b33d) /* 0.254809606 */, 16 }, /* 1470 */ { MAD_F(0x0414a5c7) /* 0.255040910 */, 16 }, /* 1471 */ { MAD_F(0x0415985f) /* 0.255272266 */, 16 }, /* 1472 */ { MAD_F(0x04168b05) /* 0.255503674 */, 16 }, /* 1473 */ { MAD_F(0x04177db9) /* 0.255735135 */, 16 }, /* 1474 */ { MAD_F(0x0418707c) /* 0.255966648 */, 16 }, /* 1475 */ { MAD_F(0x0419634c) /* 0.256198213 */, 16 }, /* 1476 */ { MAD_F(0x041a562a) /* 0.256429831 */, 16 }, /* 1477 */ { MAD_F(0x041b4917) /* 0.256661501 */, 16 }, /* 1478 */ { MAD_F(0x041c3c11) /* 0.256893223 */, 16 }, /* 1479 */ { MAD_F(0x041d2f1a) /* 0.257124998 */, 16 }, /* 1480 */ { MAD_F(0x041e2230) /* 0.257356825 */, 16 }, /* 1481 */ { MAD_F(0x041f1555) /* 0.257588704 */, 16 }, /* 1482 */ { MAD_F(0x04200888) /* 0.257820635 */, 16 }, /* 1483 */ { MAD_F(0x0420fbc8) /* 0.258052619 */, 16 }, /* 1484 */ { MAD_F(0x0421ef17) /* 0.258284654 */, 16 }, /* 1485 */ { MAD_F(0x0422e273) /* 0.258516742 */, 16 }, /* 1486 */ { MAD_F(0x0423d5de) /* 0.258748882 */, 16 }, /* 1487 */ { MAD_F(0x0424c956) /* 0.258981074 */, 16 }, /* 1488 */ { MAD_F(0x0425bcdd) /* 0.259213318 */, 16 }, /* 1489 */ { MAD_F(0x0426b071) /* 0.259445614 */, 16 }, /* 1490 */ { MAD_F(0x0427a414) /* 0.259677962 */, 16 }, /* 1491 */ { MAD_F(0x042897c4) /* 0.259910362 */, 16 }, /* 1492 */ { MAD_F(0x04298b83) /* 0.260142814 */, 16 }, /* 1493 */ { MAD_F(0x042a7f4f) /* 0.260375318 */, 16 }, /* 1494 */ { MAD_F(0x042b7329) /* 0.260607874 */, 16 }, /* 1495 */ { MAD_F(0x042c6711) /* 0.260840481 */, 16 }, /* 1496 */ { MAD_F(0x042d5b07) /* 0.261073141 */, 16 }, /* 1497 */ { MAD_F(0x042e4f0b) /* 0.261305852 */, 16 }, /* 1498 */ { MAD_F(0x042f431d) /* 0.261538616 */, 16 }, /* 1499 */ { MAD_F(0x0430373d) /* 0.261771431 */, 16 }, /* 1500 */ { MAD_F(0x04312b6b) /* 0.262004297 */, 16 }, /* 1501 */ { MAD_F(0x04321fa6) /* 0.262237216 */, 16 }, /* 1502 */ { MAD_F(0x043313f0) /* 0.262470186 */, 16 }, /* 1503 */ { MAD_F(0x04340847) /* 0.262703208 */, 16 }, /* 1504 */ { MAD_F(0x0434fcad) /* 0.262936282 */, 16 }, /* 1505 */ { MAD_F(0x0435f120) /* 0.263169407 */, 16 }, /* 1506 */ { MAD_F(0x0436e5a1) /* 0.263402584 */, 16 }, /* 1507 */ { MAD_F(0x0437da2f) /* 0.263635813 */, 16 }, /* 1508 */ { MAD_F(0x0438cecc) /* 0.263869093 */, 16 }, /* 1509 */ { MAD_F(0x0439c377) /* 0.264102425 */, 16 }, /* 1510 */ { MAD_F(0x043ab82f) /* 0.264335808 */, 16 }, /* 1511 */ { MAD_F(0x043bacf5) /* 0.264569243 */, 16 }, /* 1512 */ { MAD_F(0x043ca1c9) /* 0.264802730 */, 16 }, /* 1513 */ { MAD_F(0x043d96ab) /* 0.265036267 */, 16 }, /* 1514 */ { MAD_F(0x043e8b9b) /* 0.265269857 */, 16 }, /* 1515 */ { MAD_F(0x043f8098) /* 0.265503498 */, 16 }, /* 1516 */ { MAD_F(0x044075a3) /* 0.265737190 */, 16 }, /* 1517 */ { MAD_F(0x04416abc) /* 0.265970933 */, 16 }, /* 1518 */ { MAD_F(0x04425fe3) /* 0.266204728 */, 16 }, /* 1519 */ { MAD_F(0x04435518) /* 0.266438574 */, 16 }, /* 1520 */ { MAD_F(0x04444a5a) /* 0.266672472 */, 16 }, /* 1521 */ { MAD_F(0x04453fab) /* 0.266906421 */, 16 }, /* 1522 */ { MAD_F(0x04463508) /* 0.267140421 */, 16 }, /* 1523 */ { MAD_F(0x04472a74) /* 0.267374472 */, 16 }, /* 1524 */ { MAD_F(0x04481fee) /* 0.267608575 */, 16 }, /* 1525 */ { MAD_F(0x04491575) /* 0.267842729 */, 16 }, /* 1526 */ { MAD_F(0x044a0b0a) /* 0.268076934 */, 16 }, /* 1527 */ { MAD_F(0x044b00ac) /* 0.268311190 */, 16 }, /* 1528 */ { MAD_F(0x044bf65d) /* 0.268545497 */, 16 }, /* 1529 */ { MAD_F(0x044cec1b) /* 0.268779856 */, 16 }, /* 1530 */ { MAD_F(0x044de1e7) /* 0.269014265 */, 16 }, /* 1531 */ { MAD_F(0x044ed7c0) /* 0.269248726 */, 16 }, /* 1532 */ { MAD_F(0x044fcda8) /* 0.269483238 */, 16 }, /* 1533 */ { MAD_F(0x0450c39c) /* 0.269717800 */, 16 }, /* 1534 */ { MAD_F(0x0451b99f) /* 0.269952414 */, 16 }, /* 1535 */ { MAD_F(0x0452afaf) /* 0.270187079 */, 16 }, /* 1536 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 16 }, /* 1537 */ { MAD_F(0x04549bf9) /* 0.270656561 */, 16 }, /* 1538 */ { MAD_F(0x04559232) /* 0.270891379 */, 16 }, /* 1539 */ { MAD_F(0x04568879) /* 0.271126247 */, 16 }, /* 1540 */ { MAD_F(0x04577ece) /* 0.271361166 */, 16 }, /* 1541 */ { MAD_F(0x04587530) /* 0.271596136 */, 16 }, /* 1542 */ { MAD_F(0x04596ba0) /* 0.271831157 */, 16 }, /* 1543 */ { MAD_F(0x045a621e) /* 0.272066229 */, 16 }, /* 1544 */ { MAD_F(0x045b58a9) /* 0.272301352 */, 16 }, /* 1545 */ { MAD_F(0x045c4f42) /* 0.272536525 */, 16 }, /* 1546 */ { MAD_F(0x045d45e9) /* 0.272771749 */, 16 }, /* 1547 */ { MAD_F(0x045e3c9d) /* 0.273007024 */, 16 }, /* 1548 */ { MAD_F(0x045f335e) /* 0.273242350 */, 16 }, /* 1549 */ { MAD_F(0x04602a2e) /* 0.273477726 */, 16 }, /* 1550 */ { MAD_F(0x0461210b) /* 0.273713153 */, 16 }, /* 1551 */ { MAD_F(0x046217f5) /* 0.273948630 */, 16 }, /* 1552 */ { MAD_F(0x04630eed) /* 0.274184158 */, 16 }, /* 1553 */ { MAD_F(0x046405f3) /* 0.274419737 */, 16 }, /* 1554 */ { MAD_F(0x0464fd06) /* 0.274655366 */, 16 }, /* 1555 */ { MAD_F(0x0465f427) /* 0.274891046 */, 16 }, /* 1556 */ { MAD_F(0x0466eb55) /* 0.275126776 */, 16 }, /* 1557 */ { MAD_F(0x0467e291) /* 0.275362557 */, 16 }, /* 1558 */ { MAD_F(0x0468d9db) /* 0.275598389 */, 16 }, /* 1559 */ { MAD_F(0x0469d132) /* 0.275834270 */, 16 }, /* 1560 */ { MAD_F(0x046ac896) /* 0.276070203 */, 16 }, /* 1561 */ { MAD_F(0x046bc009) /* 0.276306185 */, 16 }, /* 1562 */ { MAD_F(0x046cb788) /* 0.276542218 */, 16 }, /* 1563 */ { MAD_F(0x046daf15) /* 0.276778302 */, 16 }, /* 1564 */ { MAD_F(0x046ea6b0) /* 0.277014435 */, 16 }, /* 1565 */ { MAD_F(0x046f9e58) /* 0.277250619 */, 16 }, /* 1566 */ { MAD_F(0x0470960e) /* 0.277486854 */, 16 }, /* 1567 */ { MAD_F(0x04718dd1) /* 0.277723139 */, 16 }, /* 1568 */ { MAD_F(0x047285a2) /* 0.277959474 */, 16 }, /* 1569 */ { MAD_F(0x04737d80) /* 0.278195859 */, 16 }, /* 1570 */ { MAD_F(0x0474756c) /* 0.278432294 */, 16 }, /* 1571 */ { MAD_F(0x04756d65) /* 0.278668780 */, 16 }, /* 1572 */ { MAD_F(0x0476656b) /* 0.278905316 */, 16 }, /* 1573 */ { MAD_F(0x04775d7f) /* 0.279141902 */, 16 }, /* 1574 */ { MAD_F(0x047855a1) /* 0.279378538 */, 16 }, /* 1575 */ { MAD_F(0x04794dd0) /* 0.279615224 */, 16 }, /* 1576 */ { MAD_F(0x047a460c) /* 0.279851960 */, 16 }, /* 1577 */ { MAD_F(0x047b3e56) /* 0.280088747 */, 16 }, /* 1578 */ { MAD_F(0x047c36ae) /* 0.280325583 */, 16 }, /* 1579 */ { MAD_F(0x047d2f12) /* 0.280562470 */, 16 }, /* 1580 */ { MAD_F(0x047e2784) /* 0.280799406 */, 16 }, /* 1581 */ { MAD_F(0x047f2004) /* 0.281036393 */, 16 }, /* 1582 */ { MAD_F(0x04801891) /* 0.281273429 */, 16 }, /* 1583 */ { MAD_F(0x0481112b) /* 0.281510516 */, 16 }, /* 1584 */ { MAD_F(0x048209d3) /* 0.281747652 */, 16 }, /* 1585 */ { MAD_F(0x04830288) /* 0.281984838 */, 16 }, /* 1586 */ { MAD_F(0x0483fb4b) /* 0.282222075 */, 16 }, /* 1587 */ { MAD_F(0x0484f41b) /* 0.282459361 */, 16 }, /* 1588 */ { MAD_F(0x0485ecf8) /* 0.282696697 */, 16 }, /* 1589 */ { MAD_F(0x0486e5e3) /* 0.282934082 */, 16 }, /* 1590 */ { MAD_F(0x0487dedb) /* 0.283171518 */, 16 }, /* 1591 */ { MAD_F(0x0488d7e1) /* 0.283409003 */, 16 }, /* 1592 */ { MAD_F(0x0489d0f4) /* 0.283646538 */, 16 }, /* 1593 */ { MAD_F(0x048aca14) /* 0.283884123 */, 16 }, /* 1594 */ { MAD_F(0x048bc341) /* 0.284121757 */, 16 }, /* 1595 */ { MAD_F(0x048cbc7c) /* 0.284359441 */, 16 }, /* 1596 */ { MAD_F(0x048db5c4) /* 0.284597175 */, 16 }, /* 1597 */ { MAD_F(0x048eaf1a) /* 0.284834959 */, 16 }, /* 1598 */ { MAD_F(0x048fa87d) /* 0.285072792 */, 16 }, /* 1599 */ { MAD_F(0x0490a1ed) /* 0.285310675 */, 16 }, /* 1600 */ { MAD_F(0x04919b6a) /* 0.285548607 */, 16 }, /* 1601 */ { MAD_F(0x049294f5) /* 0.285786589 */, 16 }, /* 1602 */ { MAD_F(0x04938e8d) /* 0.286024621 */, 16 }, /* 1603 */ { MAD_F(0x04948833) /* 0.286262702 */, 16 }, /* 1604 */ { MAD_F(0x049581e5) /* 0.286500832 */, 16 }, /* 1605 */ { MAD_F(0x04967ba5) /* 0.286739012 */, 16 }, /* 1606 */ { MAD_F(0x04977573) /* 0.286977242 */, 16 }, /* 1607 */ { MAD_F(0x04986f4d) /* 0.287215521 */, 16 }, /* 1608 */ { MAD_F(0x04996935) /* 0.287453849 */, 16 }, /* 1609 */ { MAD_F(0x049a632a) /* 0.287692227 */, 16 }, /* 1610 */ { MAD_F(0x049b5d2c) /* 0.287930654 */, 16 }, /* 1611 */ { MAD_F(0x049c573c) /* 0.288169131 */, 16 }, /* 1612 */ { MAD_F(0x049d5159) /* 0.288407657 */, 16 }, /* 1613 */ { MAD_F(0x049e4b83) /* 0.288646232 */, 16 }, /* 1614 */ { MAD_F(0x049f45ba) /* 0.288884857 */, 16 }, /* 1615 */ { MAD_F(0x04a03ffe) /* 0.289123530 */, 16 }, /* 1616 */ { MAD_F(0x04a13a50) /* 0.289362253 */, 16 }, /* 1617 */ { MAD_F(0x04a234af) /* 0.289601026 */, 16 }, /* 1618 */ { MAD_F(0x04a32f1b) /* 0.289839847 */, 16 }, /* 1619 */ { MAD_F(0x04a42995) /* 0.290078718 */, 16 }, /* 1620 */ { MAD_F(0x04a5241b) /* 0.290317638 */, 16 }, /* 1621 */ { MAD_F(0x04a61eaf) /* 0.290556607 */, 16 }, /* 1622 */ { MAD_F(0x04a71950) /* 0.290795626 */, 16 }, /* 1623 */ { MAD_F(0x04a813fe) /* 0.291034693 */, 16 }, /* 1624 */ { MAD_F(0x04a90eba) /* 0.291273810 */, 16 }, /* 1625 */ { MAD_F(0x04aa0982) /* 0.291512975 */, 16 }, /* 1626 */ { MAD_F(0x04ab0458) /* 0.291752190 */, 16 }, /* 1627 */ { MAD_F(0x04abff3b) /* 0.291991453 */, 16 }, /* 1628 */ { MAD_F(0x04acfa2b) /* 0.292230766 */, 16 }, /* 1629 */ { MAD_F(0x04adf528) /* 0.292470128 */, 16 }, /* 1630 */ { MAD_F(0x04aef032) /* 0.292709539 */, 16 }, /* 1631 */ { MAD_F(0x04afeb4a) /* 0.292948998 */, 16 }, /* 1632 */ { MAD_F(0x04b0e66e) /* 0.293188507 */, 16 }, /* 1633 */ { MAD_F(0x04b1e1a0) /* 0.293428065 */, 16 }, /* 1634 */ { MAD_F(0x04b2dcdf) /* 0.293667671 */, 16 }, /* 1635 */ { MAD_F(0x04b3d82b) /* 0.293907326 */, 16 }, /* 1636 */ { MAD_F(0x04b4d384) /* 0.294147031 */, 16 }, /* 1637 */ { MAD_F(0x04b5ceea) /* 0.294386784 */, 16 }, /* 1638 */ { MAD_F(0x04b6ca5e) /* 0.294626585 */, 16 }, /* 1639 */ { MAD_F(0x04b7c5de) /* 0.294866436 */, 16 }, /* 1640 */ { MAD_F(0x04b8c16c) /* 0.295106336 */, 16 }, /* 1641 */ { MAD_F(0x04b9bd06) /* 0.295346284 */, 16 }, /* 1642 */ { MAD_F(0x04bab8ae) /* 0.295586281 */, 16 }, /* 1643 */ { MAD_F(0x04bbb463) /* 0.295826327 */, 16 }, /* 1644 */ { MAD_F(0x04bcb024) /* 0.296066421 */, 16 }, /* 1645 */ { MAD_F(0x04bdabf3) /* 0.296306564 */, 16 }, /* 1646 */ { MAD_F(0x04bea7cf) /* 0.296546756 */, 16 }, /* 1647 */ { MAD_F(0x04bfa3b8) /* 0.296786996 */, 16 }, /* 1648 */ { MAD_F(0x04c09faf) /* 0.297027285 */, 16 }, /* 1649 */ { MAD_F(0x04c19bb2) /* 0.297267623 */, 16 }, /* 1650 */ { MAD_F(0x04c297c2) /* 0.297508009 */, 16 }, /* 1651 */ { MAD_F(0x04c393df) /* 0.297748444 */, 16 }, /* 1652 */ { MAD_F(0x04c49009) /* 0.297988927 */, 16 }, /* 1653 */ { MAD_F(0x04c58c41) /* 0.298229459 */, 16 }, /* 1654 */ { MAD_F(0x04c68885) /* 0.298470039 */, 16 }, /* 1655 */ { MAD_F(0x04c784d6) /* 0.298710668 */, 16 }, /* 1656 */ { MAD_F(0x04c88135) /* 0.298951346 */, 16 }, /* 1657 */ { MAD_F(0x04c97da0) /* 0.299192071 */, 16 }, /* 1658 */ { MAD_F(0x04ca7a18) /* 0.299432846 */, 16 }, /* 1659 */ { MAD_F(0x04cb769e) /* 0.299673668 */, 16 }, /* 1660 */ { MAD_F(0x04cc7330) /* 0.299914539 */, 16 }, /* 1661 */ { MAD_F(0x04cd6fcf) /* 0.300155459 */, 16 }, /* 1662 */ { MAD_F(0x04ce6c7b) /* 0.300396426 */, 16 }, /* 1663 */ { MAD_F(0x04cf6935) /* 0.300637443 */, 16 }, /* 1664 */ { MAD_F(0x04d065fb) /* 0.300878507 */, 16 }, /* 1665 */ { MAD_F(0x04d162ce) /* 0.301119620 */, 16 }, /* 1666 */ { MAD_F(0x04d25fae) /* 0.301360781 */, 16 }, /* 1667 */ { MAD_F(0x04d35c9b) /* 0.301601990 */, 16 }, /* 1668 */ { MAD_F(0x04d45995) /* 0.301843247 */, 16 }, /* 1669 */ { MAD_F(0x04d5569c) /* 0.302084553 */, 16 }, /* 1670 */ { MAD_F(0x04d653b0) /* 0.302325907 */, 16 }, /* 1671 */ { MAD_F(0x04d750d1) /* 0.302567309 */, 16 }, /* 1672 */ { MAD_F(0x04d84dff) /* 0.302808759 */, 16 }, /* 1673 */ { MAD_F(0x04d94b3a) /* 0.303050257 */, 16 }, /* 1674 */ { MAD_F(0x04da4881) /* 0.303291804 */, 16 }, /* 1675 */ { MAD_F(0x04db45d6) /* 0.303533399 */, 16 }, /* 1676 */ { MAD_F(0x04dc4337) /* 0.303775041 */, 16 }, /* 1677 */ { MAD_F(0x04dd40a6) /* 0.304016732 */, 16 }, /* 1678 */ { MAD_F(0x04de3e21) /* 0.304258471 */, 16 }, /* 1679 */ { MAD_F(0x04df3ba9) /* 0.304500257 */, 16 }, /* 1680 */ { MAD_F(0x04e0393e) /* 0.304742092 */, 16 }, /* 1681 */ { MAD_F(0x04e136e0) /* 0.304983975 */, 16 }, /* 1682 */ { MAD_F(0x04e2348f) /* 0.305225906 */, 16 }, /* 1683 */ { MAD_F(0x04e3324b) /* 0.305467885 */, 16 }, /* 1684 */ { MAD_F(0x04e43013) /* 0.305709911 */, 16 }, /* 1685 */ { MAD_F(0x04e52de9) /* 0.305951986 */, 16 }, /* 1686 */ { MAD_F(0x04e62bcb) /* 0.306194108 */, 16 }, /* 1687 */ { MAD_F(0x04e729ba) /* 0.306436279 */, 16 }, /* 1688 */ { MAD_F(0x04e827b6) /* 0.306678497 */, 16 }, /* 1689 */ { MAD_F(0x04e925bf) /* 0.306920763 */, 16 }, /* 1690 */ { MAD_F(0x04ea23d4) /* 0.307163077 */, 16 }, /* 1691 */ { MAD_F(0x04eb21f7) /* 0.307405438 */, 16 }, /* 1692 */ { MAD_F(0x04ec2026) /* 0.307647848 */, 16 }, /* 1693 */ { MAD_F(0x04ed1e62) /* 0.307890305 */, 16 }, /* 1694 */ { MAD_F(0x04ee1cab) /* 0.308132810 */, 16 }, /* 1695 */ { MAD_F(0x04ef1b01) /* 0.308375362 */, 16 }, /* 1696 */ { MAD_F(0x04f01963) /* 0.308617963 */, 16 }, /* 1697 */ { MAD_F(0x04f117d3) /* 0.308860611 */, 16 }, /* 1698 */ { MAD_F(0x04f2164f) /* 0.309103306 */, 16 }, /* 1699 */ { MAD_F(0x04f314d8) /* 0.309346050 */, 16 }, /* 1700 */ { MAD_F(0x04f4136d) /* 0.309588841 */, 16 }, /* 1701 */ { MAD_F(0x04f51210) /* 0.309831679 */, 16 }, /* 1702 */ { MAD_F(0x04f610bf) /* 0.310074565 */, 16 }, /* 1703 */ { MAD_F(0x04f70f7b) /* 0.310317499 */, 16 }, /* 1704 */ { MAD_F(0x04f80e44) /* 0.310560480 */, 16 }, /* 1705 */ { MAD_F(0x04f90d19) /* 0.310803509 */, 16 }, /* 1706 */ { MAD_F(0x04fa0bfc) /* 0.311046586 */, 16 }, /* 1707 */ { MAD_F(0x04fb0aeb) /* 0.311289710 */, 16 }, /* 1708 */ { MAD_F(0x04fc09e7) /* 0.311532881 */, 16 }, /* 1709 */ { MAD_F(0x04fd08ef) /* 0.311776100 */, 16 }, /* 1710 */ { MAD_F(0x04fe0805) /* 0.312019366 */, 16 }, /* 1711 */ { MAD_F(0x04ff0727) /* 0.312262680 */, 16 }, /* 1712 */ { MAD_F(0x05000655) /* 0.312506041 */, 16 }, /* 1713 */ { MAD_F(0x05010591) /* 0.312749449 */, 16 }, /* 1714 */ { MAD_F(0x050204d9) /* 0.312992905 */, 16 }, /* 1715 */ { MAD_F(0x0503042e) /* 0.313236408 */, 16 }, /* 1716 */ { MAD_F(0x0504038f) /* 0.313479959 */, 16 }, /* 1717 */ { MAD_F(0x050502fe) /* 0.313723556 */, 16 }, /* 1718 */ { MAD_F(0x05060279) /* 0.313967202 */, 16 }, /* 1719 */ { MAD_F(0x05070200) /* 0.314210894 */, 16 }, /* 1720 */ { MAD_F(0x05080195) /* 0.314454634 */, 16 }, /* 1721 */ { MAD_F(0x05090136) /* 0.314698420 */, 16 }, /* 1722 */ { MAD_F(0x050a00e3) /* 0.314942255 */, 16 }, /* 1723 */ { MAD_F(0x050b009e) /* 0.315186136 */, 16 }, /* 1724 */ { MAD_F(0x050c0065) /* 0.315430064 */, 16 }, /* 1725 */ { MAD_F(0x050d0039) /* 0.315674040 */, 16 }, /* 1726 */ { MAD_F(0x050e0019) /* 0.315918063 */, 16 }, /* 1727 */ { MAD_F(0x050f0006) /* 0.316162133 */, 16 }, /* 1728 */ { MAD_F(0x05100000) /* 0.316406250 */, 16 }, /* 1729 */ { MAD_F(0x05110006) /* 0.316650414 */, 16 }, /* 1730 */ { MAD_F(0x05120019) /* 0.316894625 */, 16 }, /* 1731 */ { MAD_F(0x05130039) /* 0.317138884 */, 16 }, /* 1732 */ { MAD_F(0x05140065) /* 0.317383189 */, 16 }, /* 1733 */ { MAD_F(0x0515009e) /* 0.317627541 */, 16 }, /* 1734 */ { MAD_F(0x051600e3) /* 0.317871941 */, 16 }, /* 1735 */ { MAD_F(0x05170135) /* 0.318116387 */, 16 }, /* 1736 */ { MAD_F(0x05180194) /* 0.318360880 */, 16 }, /* 1737 */ { MAD_F(0x051901ff) /* 0.318605421 */, 16 }, /* 1738 */ { MAD_F(0x051a0277) /* 0.318850008 */, 16 }, /* 1739 */ { MAD_F(0x051b02fc) /* 0.319094642 */, 16 }, /* 1740 */ { MAD_F(0x051c038d) /* 0.319339323 */, 16 }, /* 1741 */ { MAD_F(0x051d042a) /* 0.319584051 */, 16 }, /* 1742 */ { MAD_F(0x051e04d4) /* 0.319828826 */, 16 }, /* 1743 */ { MAD_F(0x051f058b) /* 0.320073647 */, 16 }, /* 1744 */ { MAD_F(0x0520064f) /* 0.320318516 */, 16 }, /* 1745 */ { MAD_F(0x0521071f) /* 0.320563431 */, 16 }, /* 1746 */ { MAD_F(0x052207fb) /* 0.320808393 */, 16 }, /* 1747 */ { MAD_F(0x052308e4) /* 0.321053402 */, 16 }, /* 1748 */ { MAD_F(0x052409da) /* 0.321298457 */, 16 }, /* 1749 */ { MAD_F(0x05250adc) /* 0.321543560 */, 16 }, /* 1750 */ { MAD_F(0x05260bea) /* 0.321788709 */, 16 }, /* 1751 */ { MAD_F(0x05270d06) /* 0.322033904 */, 16 }, /* 1752 */ { MAD_F(0x05280e2d) /* 0.322279147 */, 16 }, /* 1753 */ { MAD_F(0x05290f62) /* 0.322524436 */, 16 }, /* 1754 */ { MAD_F(0x052a10a3) /* 0.322769771 */, 16 }, /* 1755 */ { MAD_F(0x052b11f0) /* 0.323015154 */, 16 }, /* 1756 */ { MAD_F(0x052c134a) /* 0.323260583 */, 16 }, /* 1757 */ { MAD_F(0x052d14b0) /* 0.323506058 */, 16 }, /* 1758 */ { MAD_F(0x052e1623) /* 0.323751580 */, 16 }, /* 1759 */ { MAD_F(0x052f17a2) /* 0.323997149 */, 16 }, /* 1760 */ { MAD_F(0x0530192e) /* 0.324242764 */, 16 }, /* 1761 */ { MAD_F(0x05311ac6) /* 0.324488426 */, 16 }, /* 1762 */ { MAD_F(0x05321c6b) /* 0.324734134 */, 16 }, /* 1763 */ { MAD_F(0x05331e1c) /* 0.324979889 */, 16 }, /* 1764 */ { MAD_F(0x05341fda) /* 0.325225690 */, 16 }, /* 1765 */ { MAD_F(0x053521a4) /* 0.325471538 */, 16 }, /* 1766 */ { MAD_F(0x0536237b) /* 0.325717432 */, 16 }, /* 1767 */ { MAD_F(0x0537255e) /* 0.325963372 */, 16 }, /* 1768 */ { MAD_F(0x0538274e) /* 0.326209359 */, 16 }, /* 1769 */ { MAD_F(0x0539294a) /* 0.326455392 */, 16 }, /* 1770 */ { MAD_F(0x053a2b52) /* 0.326701472 */, 16 }, /* 1771 */ { MAD_F(0x053b2d67) /* 0.326947598 */, 16 }, /* 1772 */ { MAD_F(0x053c2f89) /* 0.327193770 */, 16 }, /* 1773 */ { MAD_F(0x053d31b6) /* 0.327439989 */, 16 }, /* 1774 */ { MAD_F(0x053e33f1) /* 0.327686254 */, 16 }, /* 1775 */ { MAD_F(0x053f3637) /* 0.327932565 */, 16 }, /* 1776 */ { MAD_F(0x0540388a) /* 0.328178922 */, 16 }, /* 1777 */ { MAD_F(0x05413aea) /* 0.328425326 */, 16 }, /* 1778 */ { MAD_F(0x05423d56) /* 0.328671776 */, 16 }, /* 1779 */ { MAD_F(0x05433fce) /* 0.328918272 */, 16 }, /* 1780 */ { MAD_F(0x05444253) /* 0.329164814 */, 16 }, /* 1781 */ { MAD_F(0x054544e4) /* 0.329411403 */, 16 }, /* 1782 */ { MAD_F(0x05464781) /* 0.329658038 */, 16 }, /* 1783 */ { MAD_F(0x05474a2b) /* 0.329904718 */, 16 }, /* 1784 */ { MAD_F(0x05484ce2) /* 0.330151445 */, 16 }, /* 1785 */ { MAD_F(0x05494fa4) /* 0.330398218 */, 16 }, /* 1786 */ { MAD_F(0x054a5273) /* 0.330645037 */, 16 }, /* 1787 */ { MAD_F(0x054b554e) /* 0.330891903 */, 16 }, /* 1788 */ { MAD_F(0x054c5836) /* 0.331138814 */, 16 }, /* 1789 */ { MAD_F(0x054d5b2a) /* 0.331385771 */, 16 }, /* 1790 */ { MAD_F(0x054e5e2b) /* 0.331632774 */, 16 }, /* 1791 */ { MAD_F(0x054f6138) /* 0.331879824 */, 16 }, /* 1792 */ { MAD_F(0x05506451) /* 0.332126919 */, 16 }, /* 1793 */ { MAD_F(0x05516776) /* 0.332374060 */, 16 }, /* 1794 */ { MAD_F(0x05526aa8) /* 0.332621247 */, 16 }, /* 1795 */ { MAD_F(0x05536de6) /* 0.332868480 */, 16 }, /* 1796 */ { MAD_F(0x05547131) /* 0.333115759 */, 16 }, /* 1797 */ { MAD_F(0x05557487) /* 0.333363084 */, 16 }, /* 1798 */ { MAD_F(0x055677ea) /* 0.333610455 */, 16 }, /* 1799 */ { MAD_F(0x05577b5a) /* 0.333857872 */, 16 }, /* 1800 */ { MAD_F(0x05587ed5) /* 0.334105334 */, 16 }, /* 1801 */ { MAD_F(0x0559825e) /* 0.334352843 */, 16 }, /* 1802 */ { MAD_F(0x055a85f2) /* 0.334600397 */, 16 }, /* 1803 */ { MAD_F(0x055b8992) /* 0.334847997 */, 16 }, /* 1804 */ { MAD_F(0x055c8d3f) /* 0.335095642 */, 16 }, /* 1805 */ { MAD_F(0x055d90f9) /* 0.335343334 */, 16 }, /* 1806 */ { MAD_F(0x055e94be) /* 0.335591071 */, 16 }, /* 1807 */ { MAD_F(0x055f9890) /* 0.335838854 */, 16 }, /* 1808 */ { MAD_F(0x05609c6e) /* 0.336086683 */, 16 }, /* 1809 */ { MAD_F(0x0561a058) /* 0.336334557 */, 16 }, /* 1810 */ { MAD_F(0x0562a44f) /* 0.336582477 */, 16 }, /* 1811 */ { MAD_F(0x0563a851) /* 0.336830443 */, 16 }, /* 1812 */ { MAD_F(0x0564ac60) /* 0.337078454 */, 16 }, /* 1813 */ { MAD_F(0x0565b07c) /* 0.337326511 */, 16 }, /* 1814 */ { MAD_F(0x0566b4a3) /* 0.337574614 */, 16 }, /* 1815 */ { MAD_F(0x0567b8d7) /* 0.337822762 */, 16 }, /* 1816 */ { MAD_F(0x0568bd17) /* 0.338070956 */, 16 }, /* 1817 */ { MAD_F(0x0569c163) /* 0.338319195 */, 16 }, /* 1818 */ { MAD_F(0x056ac5bc) /* 0.338567480 */, 16 }, /* 1819 */ { MAD_F(0x056bca20) /* 0.338815811 */, 16 }, /* 1820 */ { MAD_F(0x056cce91) /* 0.339064186 */, 16 }, /* 1821 */ { MAD_F(0x056dd30e) /* 0.339312608 */, 16 }, /* 1822 */ { MAD_F(0x056ed798) /* 0.339561075 */, 16 }, /* 1823 */ { MAD_F(0x056fdc2d) /* 0.339809587 */, 16 }, /* 1824 */ { MAD_F(0x0570e0cf) /* 0.340058145 */, 16 }, /* 1825 */ { MAD_F(0x0571e57d) /* 0.340306748 */, 16 }, /* 1826 */ { MAD_F(0x0572ea37) /* 0.340555397 */, 16 }, /* 1827 */ { MAD_F(0x0573eefd) /* 0.340804091 */, 16 }, /* 1828 */ { MAD_F(0x0574f3d0) /* 0.341052830 */, 16 }, /* 1829 */ { MAD_F(0x0575f8ae) /* 0.341301615 */, 16 }, /* 1830 */ { MAD_F(0x0576fd99) /* 0.341550445 */, 16 }, /* 1831 */ { MAD_F(0x05780290) /* 0.341799321 */, 16 }, /* 1832 */ { MAD_F(0x05790793) /* 0.342048241 */, 16 }, /* 1833 */ { MAD_F(0x057a0ca3) /* 0.342297207 */, 16 }, /* 1834 */ { MAD_F(0x057b11be) /* 0.342546219 */, 16 }, /* 1835 */ { MAD_F(0x057c16e6) /* 0.342795275 */, 16 }, /* 1836 */ { MAD_F(0x057d1c1a) /* 0.343044377 */, 16 }, /* 1837 */ { MAD_F(0x057e2159) /* 0.343293524 */, 16 }, /* 1838 */ { MAD_F(0x057f26a6) /* 0.343542717 */, 16 }, /* 1839 */ { MAD_F(0x05802bfe) /* 0.343791954 */, 16 }, /* 1840 */ { MAD_F(0x05813162) /* 0.344041237 */, 16 }, /* 1841 */ { MAD_F(0x058236d2) /* 0.344290564 */, 16 }, /* 1842 */ { MAD_F(0x05833c4f) /* 0.344539937 */, 16 }, /* 1843 */ { MAD_F(0x058441d8) /* 0.344789356 */, 16 }, /* 1844 */ { MAD_F(0x0585476c) /* 0.345038819 */, 16 }, /* 1845 */ { MAD_F(0x05864d0d) /* 0.345288327 */, 16 }, /* 1846 */ { MAD_F(0x058752ba) /* 0.345537880 */, 16 }, /* 1847 */ { MAD_F(0x05885873) /* 0.345787479 */, 16 }, /* 1848 */ { MAD_F(0x05895e39) /* 0.346037122 */, 16 }, /* 1849 */ { MAD_F(0x058a640a) /* 0.346286811 */, 16 }, /* 1850 */ { MAD_F(0x058b69e7) /* 0.346536545 */, 16 }, /* 1851 */ { MAD_F(0x058c6fd1) /* 0.346786323 */, 16 }, /* 1852 */ { MAD_F(0x058d75c6) /* 0.347036147 */, 16 }, /* 1853 */ { MAD_F(0x058e7bc8) /* 0.347286015 */, 16 }, /* 1854 */ { MAD_F(0x058f81d5) /* 0.347535929 */, 16 }, /* 1855 */ { MAD_F(0x059087ef) /* 0.347785887 */, 16 }, /* 1856 */ { MAD_F(0x05918e15) /* 0.348035890 */, 16 }, /* 1857 */ { MAD_F(0x05929447) /* 0.348285939 */, 16 }, /* 1858 */ { MAD_F(0x05939a84) /* 0.348536032 */, 16 }, /* 1859 */ { MAD_F(0x0594a0ce) /* 0.348786170 */, 16 }, /* 1860 */ { MAD_F(0x0595a724) /* 0.349036353 */, 16 }, /* 1861 */ { MAD_F(0x0596ad86) /* 0.349286580 */, 16 }, /* 1862 */ { MAD_F(0x0597b3f4) /* 0.349536853 */, 16 }, /* 1863 */ { MAD_F(0x0598ba6e) /* 0.349787170 */, 16 }, /* 1864 */ { MAD_F(0x0599c0f4) /* 0.350037532 */, 16 }, /* 1865 */ { MAD_F(0x059ac786) /* 0.350287939 */, 16 }, /* 1866 */ { MAD_F(0x059bce25) /* 0.350538391 */, 16 }, /* 1867 */ { MAD_F(0x059cd4cf) /* 0.350788887 */, 16 }, /* 1868 */ { MAD_F(0x059ddb85) /* 0.351039428 */, 16 }, /* 1869 */ { MAD_F(0x059ee247) /* 0.351290014 */, 16 }, /* 1870 */ { MAD_F(0x059fe915) /* 0.351540645 */, 16 }, /* 1871 */ { MAD_F(0x05a0efef) /* 0.351791320 */, 16 }, /* 1872 */ { MAD_F(0x05a1f6d5) /* 0.352042040 */, 16 }, /* 1873 */ { MAD_F(0x05a2fdc7) /* 0.352292804 */, 16 }, /* 1874 */ { MAD_F(0x05a404c5) /* 0.352543613 */, 16 }, /* 1875 */ { MAD_F(0x05a50bcf) /* 0.352794467 */, 16 }, /* 1876 */ { MAD_F(0x05a612e5) /* 0.353045365 */, 16 }, /* 1877 */ { MAD_F(0x05a71a07) /* 0.353296308 */, 16 }, /* 1878 */ { MAD_F(0x05a82135) /* 0.353547296 */, 16 }, /* 1879 */ { MAD_F(0x05a9286f) /* 0.353798328 */, 16 }, /* 1880 */ { MAD_F(0x05aa2fb5) /* 0.354049405 */, 16 }, /* 1881 */ { MAD_F(0x05ab3707) /* 0.354300526 */, 16 }, /* 1882 */ { MAD_F(0x05ac3e65) /* 0.354551691 */, 16 }, /* 1883 */ { MAD_F(0x05ad45ce) /* 0.354802901 */, 16 }, /* 1884 */ { MAD_F(0x05ae4d44) /* 0.355054156 */, 16 }, /* 1885 */ { MAD_F(0x05af54c6) /* 0.355305455 */, 16 }, /* 1886 */ { MAD_F(0x05b05c53) /* 0.355556799 */, 16 }, /* 1887 */ { MAD_F(0x05b163ed) /* 0.355808187 */, 16 }, /* 1888 */ { MAD_F(0x05b26b92) /* 0.356059619 */, 16 }, /* 1889 */ { MAD_F(0x05b37343) /* 0.356311096 */, 16 }, /* 1890 */ { MAD_F(0x05b47b00) /* 0.356562617 */, 16 }, /* 1891 */ { MAD_F(0x05b582c9) /* 0.356814182 */, 16 }, /* 1892 */ { MAD_F(0x05b68a9e) /* 0.357065792 */, 16 }, /* 1893 */ { MAD_F(0x05b7927f) /* 0.357317446 */, 16 }, /* 1894 */ { MAD_F(0x05b89a6c) /* 0.357569145 */, 16 }, /* 1895 */ { MAD_F(0x05b9a265) /* 0.357820887 */, 16 }, /* 1896 */ { MAD_F(0x05baaa69) /* 0.358072674 */, 16 }, /* 1897 */ { MAD_F(0x05bbb27a) /* 0.358324506 */, 16 }, /* 1898 */ { MAD_F(0x05bcba96) /* 0.358576381 */, 16 }, /* 1899 */ { MAD_F(0x05bdc2be) /* 0.358828301 */, 16 }, /* 1900 */ { MAD_F(0x05becaf2) /* 0.359080265 */, 16 }, /* 1901 */ { MAD_F(0x05bfd332) /* 0.359332273 */, 16 }, /* 1902 */ { MAD_F(0x05c0db7e) /* 0.359584326 */, 16 }, /* 1903 */ { MAD_F(0x05c1e3d6) /* 0.359836423 */, 16 }, /* 1904 */ { MAD_F(0x05c2ec39) /* 0.360088563 */, 16 }, /* 1905 */ { MAD_F(0x05c3f4a9) /* 0.360340748 */, 16 }, /* 1906 */ { MAD_F(0x05c4fd24) /* 0.360592977 */, 16 }, /* 1907 */ { MAD_F(0x05c605ab) /* 0.360845251 */, 16 }, /* 1908 */ { MAD_F(0x05c70e3e) /* 0.361097568 */, 16 }, /* 1909 */ { MAD_F(0x05c816dd) /* 0.361349929 */, 16 }, /* 1910 */ { MAD_F(0x05c91f87) /* 0.361602335 */, 16 }, /* 1911 */ { MAD_F(0x05ca283e) /* 0.361854784 */, 16 }, /* 1912 */ { MAD_F(0x05cb3100) /* 0.362107278 */, 16 }, /* 1913 */ { MAD_F(0x05cc39ce) /* 0.362359815 */, 16 }, /* 1914 */ { MAD_F(0x05cd42a8) /* 0.362612397 */, 16 }, /* 1915 */ { MAD_F(0x05ce4b8d) /* 0.362865022 */, 16 }, /* 1916 */ { MAD_F(0x05cf547f) /* 0.363117692 */, 16 }, /* 1917 */ { MAD_F(0x05d05d7c) /* 0.363370405 */, 16 }, /* 1918 */ { MAD_F(0x05d16685) /* 0.363623163 */, 16 }, /* 1919 */ { MAD_F(0x05d26f9a) /* 0.363875964 */, 16 }, /* 1920 */ { MAD_F(0x05d378bb) /* 0.364128809 */, 16 }, /* 1921 */ { MAD_F(0x05d481e7) /* 0.364381698 */, 16 }, /* 1922 */ { MAD_F(0x05d58b1f) /* 0.364634632 */, 16 }, /* 1923 */ { MAD_F(0x05d69463) /* 0.364887608 */, 16 }, /* 1924 */ { MAD_F(0x05d79db3) /* 0.365140629 */, 16 }, /* 1925 */ { MAD_F(0x05d8a70f) /* 0.365393694 */, 16 }, /* 1926 */ { MAD_F(0x05d9b076) /* 0.365646802 */, 16 }, /* 1927 */ { MAD_F(0x05dab9e9) /* 0.365899955 */, 16 }, /* 1928 */ { MAD_F(0x05dbc368) /* 0.366153151 */, 16 }, /* 1929 */ { MAD_F(0x05dcccf2) /* 0.366406390 */, 16 }, /* 1930 */ { MAD_F(0x05ddd689) /* 0.366659674 */, 16 }, /* 1931 */ { MAD_F(0x05dee02b) /* 0.366913001 */, 16 }, /* 1932 */ { MAD_F(0x05dfe9d8) /* 0.367166372 */, 16 }, /* 1933 */ { MAD_F(0x05e0f392) /* 0.367419787 */, 16 }, /* 1934 */ { MAD_F(0x05e1fd57) /* 0.367673246 */, 16 }, /* 1935 */ { MAD_F(0x05e30728) /* 0.367926748 */, 16 }, /* 1936 */ { MAD_F(0x05e41105) /* 0.368180294 */, 16 }, /* 1937 */ { MAD_F(0x05e51aed) /* 0.368433883 */, 16 }, /* 1938 */ { MAD_F(0x05e624e1) /* 0.368687517 */, 16 }, /* 1939 */ { MAD_F(0x05e72ee1) /* 0.368941193 */, 16 }, /* 1940 */ { MAD_F(0x05e838ed) /* 0.369194914 */, 16 }, /* 1941 */ { MAD_F(0x05e94304) /* 0.369448678 */, 16 }, /* 1942 */ { MAD_F(0x05ea4d27) /* 0.369702485 */, 16 }, /* 1943 */ { MAD_F(0x05eb5756) /* 0.369956336 */, 16 }, /* 1944 */ { MAD_F(0x05ec6190) /* 0.370210231 */, 16 }, /* 1945 */ { MAD_F(0x05ed6bd6) /* 0.370464169 */, 16 }, /* 1946 */ { MAD_F(0x05ee7628) /* 0.370718151 */, 16 }, /* 1947 */ { MAD_F(0x05ef8085) /* 0.370972177 */, 16 }, /* 1948 */ { MAD_F(0x05f08aee) /* 0.371226245 */, 16 }, /* 1949 */ { MAD_F(0x05f19563) /* 0.371480358 */, 16 }, /* 1950 */ { MAD_F(0x05f29fe3) /* 0.371734513 */, 16 }, /* 1951 */ { MAD_F(0x05f3aa6f) /* 0.371988712 */, 16 }, /* 1952 */ { MAD_F(0x05f4b507) /* 0.372242955 */, 16 }, /* 1953 */ { MAD_F(0x05f5bfab) /* 0.372497241 */, 16 }, /* 1954 */ { MAD_F(0x05f6ca5a) /* 0.372751570 */, 16 }, /* 1955 */ { MAD_F(0x05f7d514) /* 0.373005943 */, 16 }, /* 1956 */ { MAD_F(0x05f8dfdb) /* 0.373260359 */, 16 }, /* 1957 */ { MAD_F(0x05f9eaad) /* 0.373514819 */, 16 }, /* 1958 */ { MAD_F(0x05faf58a) /* 0.373769322 */, 16 }, /* 1959 */ { MAD_F(0x05fc0073) /* 0.374023868 */, 16 }, /* 1960 */ { MAD_F(0x05fd0b68) /* 0.374278458 */, 16 }, /* 1961 */ { MAD_F(0x05fe1669) /* 0.374533091 */, 16 }, /* 1962 */ { MAD_F(0x05ff2175) /* 0.374787767 */, 16 }, /* 1963 */ { MAD_F(0x06002c8d) /* 0.375042486 */, 16 }, /* 1964 */ { MAD_F(0x060137b0) /* 0.375297249 */, 16 }, /* 1965 */ { MAD_F(0x060242df) /* 0.375552055 */, 16 }, /* 1966 */ { MAD_F(0x06034e19) /* 0.375806904 */, 16 }, /* 1967 */ { MAD_F(0x0604595f) /* 0.376061796 */, 16 }, /* 1968 */ { MAD_F(0x060564b1) /* 0.376316732 */, 16 }, /* 1969 */ { MAD_F(0x0606700f) /* 0.376571710 */, 16 }, /* 1970 */ { MAD_F(0x06077b77) /* 0.376826732 */, 16 }, /* 1971 */ { MAD_F(0x060886ec) /* 0.377081797 */, 16 }, /* 1972 */ { MAD_F(0x0609926c) /* 0.377336905 */, 16 }, /* 1973 */ { MAD_F(0x060a9df8) /* 0.377592057 */, 16 }, /* 1974 */ { MAD_F(0x060ba98f) /* 0.377847251 */, 16 }, /* 1975 */ { MAD_F(0x060cb532) /* 0.378102489 */, 16 }, /* 1976 */ { MAD_F(0x060dc0e0) /* 0.378357769 */, 16 }, /* 1977 */ { MAD_F(0x060ecc9a) /* 0.378613093 */, 16 }, /* 1978 */ { MAD_F(0x060fd860) /* 0.378868460 */, 16 }, /* 1979 */ { MAD_F(0x0610e431) /* 0.379123870 */, 16 }, /* 1980 */ { MAD_F(0x0611f00d) /* 0.379379322 */, 16 }, /* 1981 */ { MAD_F(0x0612fbf5) /* 0.379634818 */, 16 }, /* 1982 */ { MAD_F(0x061407e9) /* 0.379890357 */, 16 }, /* 1983 */ { MAD_F(0x061513e8) /* 0.380145939 */, 16 }, /* 1984 */ { MAD_F(0x06161ff3) /* 0.380401563 */, 16 }, /* 1985 */ { MAD_F(0x06172c09) /* 0.380657231 */, 16 }, /* 1986 */ { MAD_F(0x0618382b) /* 0.380912942 */, 16 }, /* 1987 */ { MAD_F(0x06194458) /* 0.381168695 */, 16 }, /* 1988 */ { MAD_F(0x061a5091) /* 0.381424492 */, 16 }, /* 1989 */ { MAD_F(0x061b5cd5) /* 0.381680331 */, 16 }, /* 1990 */ { MAD_F(0x061c6925) /* 0.381936213 */, 16 }, /* 1991 */ { MAD_F(0x061d7581) /* 0.382192138 */, 16 }, /* 1992 */ { MAD_F(0x061e81e8) /* 0.382448106 */, 16 }, /* 1993 */ { MAD_F(0x061f8e5a) /* 0.382704117 */, 16 }, /* 1994 */ { MAD_F(0x06209ad8) /* 0.382960171 */, 16 }, /* 1995 */ { MAD_F(0x0621a761) /* 0.383216267 */, 16 }, /* 1996 */ { MAD_F(0x0622b3f6) /* 0.383472406 */, 16 }, /* 1997 */ { MAD_F(0x0623c096) /* 0.383728588 */, 16 }, /* 1998 */ { MAD_F(0x0624cd42) /* 0.383984813 */, 16 }, /* 1999 */ { MAD_F(0x0625d9f9) /* 0.384241080 */, 16 }, /* 2000 */ { MAD_F(0x0626e6bc) /* 0.384497391 */, 16 }, /* 2001 */ { MAD_F(0x0627f38a) /* 0.384753744 */, 16 }, /* 2002 */ { MAD_F(0x06290064) /* 0.385010139 */, 16 }, /* 2003 */ { MAD_F(0x062a0d49) /* 0.385266578 */, 16 }, /* 2004 */ { MAD_F(0x062b1a3a) /* 0.385523059 */, 16 }, /* 2005 */ { MAD_F(0x062c2736) /* 0.385779582 */, 16 }, /* 2006 */ { MAD_F(0x062d343d) /* 0.386036149 */, 16 }, /* 2007 */ { MAD_F(0x062e4150) /* 0.386292758 */, 16 }, /* 2008 */ { MAD_F(0x062f4e6f) /* 0.386549409 */, 16 }, /* 2009 */ { MAD_F(0x06305b99) /* 0.386806104 */, 16 }, /* 2010 */ { MAD_F(0x063168ce) /* 0.387062840 */, 16 }, /* 2011 */ { MAD_F(0x0632760f) /* 0.387319620 */, 16 }, /* 2012 */ { MAD_F(0x0633835b) /* 0.387576442 */, 16 }, /* 2013 */ { MAD_F(0x063490b2) /* 0.387833306 */, 16 }, /* 2014 */ { MAD_F(0x06359e15) /* 0.388090213 */, 16 }, /* 2015 */ { MAD_F(0x0636ab83) /* 0.388347163 */, 16 }, /* 2016 */ { MAD_F(0x0637b8fd) /* 0.388604155 */, 16 }, /* 2017 */ { MAD_F(0x0638c682) /* 0.388861190 */, 16 }, /* 2018 */ { MAD_F(0x0639d413) /* 0.389118267 */, 16 }, /* 2019 */ { MAD_F(0x063ae1af) /* 0.389375386 */, 16 }, /* 2020 */ { MAD_F(0x063bef56) /* 0.389632548 */, 16 }, /* 2021 */ { MAD_F(0x063cfd09) /* 0.389889752 */, 16 }, /* 2022 */ { MAD_F(0x063e0ac7) /* 0.390146999 */, 16 }, /* 2023 */ { MAD_F(0x063f1891) /* 0.390404289 */, 16 }, /* 2024 */ { MAD_F(0x06402666) /* 0.390661620 */, 16 }, /* 2025 */ { MAD_F(0x06413446) /* 0.390918994 */, 16 }, /* 2026 */ { MAD_F(0x06424232) /* 0.391176411 */, 16 }, /* 2027 */ { MAD_F(0x06435029) /* 0.391433869 */, 16 }, /* 2028 */ { MAD_F(0x06445e2b) /* 0.391691371 */, 16 }, /* 2029 */ { MAD_F(0x06456c39) /* 0.391948914 */, 16 }, /* 2030 */ { MAD_F(0x06467a52) /* 0.392206500 */, 16 }, /* 2031 */ { MAD_F(0x06478877) /* 0.392464128 */, 16 }, /* 2032 */ { MAD_F(0x064896a7) /* 0.392721798 */, 16 }, /* 2033 */ { MAD_F(0x0649a4e2) /* 0.392979511 */, 16 }, /* 2034 */ { MAD_F(0x064ab328) /* 0.393237266 */, 16 }, /* 2035 */ { MAD_F(0x064bc17a) /* 0.393495063 */, 16 }, /* 2036 */ { MAD_F(0x064ccfd8) /* 0.393752902 */, 16 }, /* 2037 */ { MAD_F(0x064dde40) /* 0.394010784 */, 16 }, /* 2038 */ { MAD_F(0x064eecb4) /* 0.394268707 */, 16 }, /* 2039 */ { MAD_F(0x064ffb33) /* 0.394526673 */, 16 }, /* 2040 */ { MAD_F(0x065109be) /* 0.394784681 */, 16 }, /* 2041 */ { MAD_F(0x06521854) /* 0.395042732 */, 16 }, /* 2042 */ { MAD_F(0x065326f5) /* 0.395300824 */, 16 }, /* 2043 */ { MAD_F(0x065435a1) /* 0.395558959 */, 16 }, /* 2044 */ { MAD_F(0x06554459) /* 0.395817135 */, 16 }, /* 2045 */ { MAD_F(0x0656531c) /* 0.396075354 */, 16 }, /* 2046 */ { MAD_F(0x065761ea) /* 0.396333615 */, 16 }, /* 2047 */ { MAD_F(0x065870c4) /* 0.396591918 */, 16 }, /* 2048 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 16 }, /* 2049 */ { MAD_F(0x065a8e99) /* 0.397108650 */, 16 }, /* 2050 */ { MAD_F(0x065b9d95) /* 0.397367079 */, 16 }, /* 2051 */ { MAD_F(0x065cac9c) /* 0.397625550 */, 16 }, /* 2052 */ { MAD_F(0x065dbbae) /* 0.397884063 */, 16 }, /* 2053 */ { MAD_F(0x065ecacb) /* 0.398142619 */, 16 }, /* 2054 */ { MAD_F(0x065fd9f4) /* 0.398401216 */, 16 }, /* 2055 */ { MAD_F(0x0660e928) /* 0.398659855 */, 16 }, /* 2056 */ { MAD_F(0x0661f867) /* 0.398918536 */, 16 }, /* 2057 */ { MAD_F(0x066307b1) /* 0.399177259 */, 16 }, /* 2058 */ { MAD_F(0x06641707) /* 0.399436024 */, 16 }, /* 2059 */ { MAD_F(0x06652668) /* 0.399694831 */, 16 }, /* 2060 */ { MAD_F(0x066635d4) /* 0.399953679 */, 16 }, /* 2061 */ { MAD_F(0x0667454c) /* 0.400212570 */, 16 }, /* 2062 */ { MAD_F(0x066854ce) /* 0.400471503 */, 16 }, /* 2063 */ { MAD_F(0x0669645c) /* 0.400730477 */, 16 }, /* 2064 */ { MAD_F(0x066a73f5) /* 0.400989493 */, 16 }, /* 2065 */ { MAD_F(0x066b839a) /* 0.401248551 */, 16 }, /* 2066 */ { MAD_F(0x066c9349) /* 0.401507651 */, 16 }, /* 2067 */ { MAD_F(0x066da304) /* 0.401766793 */, 16 }, /* 2068 */ { MAD_F(0x066eb2ca) /* 0.402025976 */, 16 }, /* 2069 */ { MAD_F(0x066fc29b) /* 0.402285202 */, 16 }, /* 2070 */ { MAD_F(0x0670d278) /* 0.402544469 */, 16 }, /* 2071 */ { MAD_F(0x0671e25f) /* 0.402803777 */, 16 }, /* 2072 */ { MAD_F(0x0672f252) /* 0.403063128 */, 16 }, /* 2073 */ { MAD_F(0x06740250) /* 0.403322520 */, 16 }, /* 2074 */ { MAD_F(0x0675125a) /* 0.403581954 */, 16 }, /* 2075 */ { MAD_F(0x0676226e) /* 0.403841430 */, 16 }, /* 2076 */ { MAD_F(0x0677328e) /* 0.404100947 */, 16 }, /* 2077 */ { MAD_F(0x067842b9) /* 0.404360506 */, 16 }, /* 2078 */ { MAD_F(0x067952ef) /* 0.404620107 */, 16 }, /* 2079 */ { MAD_F(0x067a6330) /* 0.404879749 */, 16 }, /* 2080 */ { MAD_F(0x067b737c) /* 0.405139433 */, 16 }, /* 2081 */ { MAD_F(0x067c83d4) /* 0.405399159 */, 16 }, /* 2082 */ { MAD_F(0x067d9436) /* 0.405658926 */, 16 }, /* 2083 */ { MAD_F(0x067ea4a4) /* 0.405918735 */, 16 }, /* 2084 */ { MAD_F(0x067fb51d) /* 0.406178585 */, 16 }, /* 2085 */ { MAD_F(0x0680c5a2) /* 0.406438477 */, 16 }, /* 2086 */ { MAD_F(0x0681d631) /* 0.406698410 */, 16 }, /* 2087 */ { MAD_F(0x0682e6cb) /* 0.406958385 */, 16 }, /* 2088 */ { MAD_F(0x0683f771) /* 0.407218402 */, 16 }, /* 2089 */ { MAD_F(0x06850822) /* 0.407478460 */, 16 }, /* 2090 */ { MAD_F(0x068618de) /* 0.407738559 */, 16 }, /* 2091 */ { MAD_F(0x068729a5) /* 0.407998700 */, 16 }, /* 2092 */ { MAD_F(0x06883a77) /* 0.408258883 */, 16 }, /* 2093 */ { MAD_F(0x06894b55) /* 0.408519107 */, 16 }, /* 2094 */ { MAD_F(0x068a5c3d) /* 0.408779372 */, 16 }, /* 2095 */ { MAD_F(0x068b6d31) /* 0.409039679 */, 16 }, /* 2096 */ { MAD_F(0x068c7e2f) /* 0.409300027 */, 16 }, /* 2097 */ { MAD_F(0x068d8f39) /* 0.409560417 */, 16 }, /* 2098 */ { MAD_F(0x068ea04e) /* 0.409820848 */, 16 }, /* 2099 */ { MAD_F(0x068fb16e) /* 0.410081321 */, 16 }, /* 2100 */ { MAD_F(0x0690c299) /* 0.410341834 */, 16 }, /* 2101 */ { MAD_F(0x0691d3cf) /* 0.410602390 */, 16 }, /* 2102 */ { MAD_F(0x0692e511) /* 0.410862986 */, 16 }, /* 2103 */ { MAD_F(0x0693f65d) /* 0.411123624 */, 16 }, /* 2104 */ { MAD_F(0x069507b5) /* 0.411384303 */, 16 }, /* 2105 */ { MAD_F(0x06961917) /* 0.411645024 */, 16 }, /* 2106 */ { MAD_F(0x06972a85) /* 0.411905785 */, 16 }, /* 2107 */ { MAD_F(0x06983bfe) /* 0.412166588 */, 16 }, /* 2108 */ { MAD_F(0x06994d82) /* 0.412427433 */, 16 }, /* 2109 */ { MAD_F(0x069a5f11) /* 0.412688318 */, 16 }, /* 2110 */ { MAD_F(0x069b70ab) /* 0.412949245 */, 16 }, /* 2111 */ { MAD_F(0x069c8250) /* 0.413210213 */, 16 }, /* 2112 */ { MAD_F(0x069d9400) /* 0.413471222 */, 16 }, /* 2113 */ { MAD_F(0x069ea5bb) /* 0.413732273 */, 16 }, /* 2114 */ { MAD_F(0x069fb781) /* 0.413993364 */, 16 }, /* 2115 */ { MAD_F(0x06a0c953) /* 0.414254497 */, 16 }, /* 2116 */ { MAD_F(0x06a1db2f) /* 0.414515671 */, 16 }, /* 2117 */ { MAD_F(0x06a2ed16) /* 0.414776886 */, 16 }, /* 2118 */ { MAD_F(0x06a3ff09) /* 0.415038142 */, 16 }, /* 2119 */ { MAD_F(0x06a51106) /* 0.415299440 */, 16 }, /* 2120 */ { MAD_F(0x06a6230f) /* 0.415560778 */, 16 }, /* 2121 */ { MAD_F(0x06a73522) /* 0.415822157 */, 16 }, /* 2122 */ { MAD_F(0x06a84741) /* 0.416083578 */, 16 }, /* 2123 */ { MAD_F(0x06a9596a) /* 0.416345040 */, 16 }, /* 2124 */ { MAD_F(0x06aa6b9f) /* 0.416606542 */, 16 }, /* 2125 */ { MAD_F(0x06ab7ddf) /* 0.416868086 */, 16 }, /* 2126 */ { MAD_F(0x06ac9029) /* 0.417129671 */, 16 }, /* 2127 */ { MAD_F(0x06ada27f) /* 0.417391297 */, 16 }, /* 2128 */ { MAD_F(0x06aeb4e0) /* 0.417652964 */, 16 }, /* 2129 */ { MAD_F(0x06afc74b) /* 0.417914672 */, 16 }, /* 2130 */ { MAD_F(0x06b0d9c2) /* 0.418176420 */, 16 }, /* 2131 */ { MAD_F(0x06b1ec43) /* 0.418438210 */, 16 }, /* 2132 */ { MAD_F(0x06b2fed0) /* 0.418700041 */, 16 }, /* 2133 */ { MAD_F(0x06b41168) /* 0.418961912 */, 16 }, /* 2134 */ { MAD_F(0x06b5240a) /* 0.419223825 */, 16 }, /* 2135 */ { MAD_F(0x06b636b8) /* 0.419485778 */, 16 }, /* 2136 */ { MAD_F(0x06b74971) /* 0.419747773 */, 16 }, /* 2137 */ { MAD_F(0x06b85c34) /* 0.420009808 */, 16 }, /* 2138 */ { MAD_F(0x06b96f03) /* 0.420271884 */, 16 }, /* 2139 */ { MAD_F(0x06ba81dc) /* 0.420534001 */, 16 }, /* 2140 */ { MAD_F(0x06bb94c1) /* 0.420796159 */, 16 }, /* 2141 */ { MAD_F(0x06bca7b0) /* 0.421058358 */, 16 }, /* 2142 */ { MAD_F(0x06bdbaaa) /* 0.421320597 */, 16 }, /* 2143 */ { MAD_F(0x06becdb0) /* 0.421582878 */, 16 }, /* 2144 */ { MAD_F(0x06bfe0c0) /* 0.421845199 */, 16 }, /* 2145 */ { MAD_F(0x06c0f3db) /* 0.422107561 */, 16 }, /* 2146 */ { MAD_F(0x06c20702) /* 0.422369964 */, 16 }, /* 2147 */ { MAD_F(0x06c31a33) /* 0.422632407 */, 16 }, /* 2148 */ { MAD_F(0x06c42d6f) /* 0.422894891 */, 16 }, /* 2149 */ { MAD_F(0x06c540b6) /* 0.423157416 */, 16 }, /* 2150 */ { MAD_F(0x06c65408) /* 0.423419982 */, 16 }, /* 2151 */ { MAD_F(0x06c76765) /* 0.423682588 */, 16 }, /* 2152 */ { MAD_F(0x06c87acc) /* 0.423945235 */, 16 }, /* 2153 */ { MAD_F(0x06c98e3f) /* 0.424207923 */, 16 }, /* 2154 */ { MAD_F(0x06caa1bd) /* 0.424470652 */, 16 }, /* 2155 */ { MAD_F(0x06cbb545) /* 0.424733421 */, 16 }, /* 2156 */ { MAD_F(0x06ccc8d9) /* 0.424996230 */, 16 }, /* 2157 */ { MAD_F(0x06cddc77) /* 0.425259081 */, 16 }, /* 2158 */ { MAD_F(0x06cef020) /* 0.425521972 */, 16 }, /* 2159 */ { MAD_F(0x06d003d4) /* 0.425784903 */, 16 }, /* 2160 */ { MAD_F(0x06d11794) /* 0.426047876 */, 16 }, /* 2161 */ { MAD_F(0x06d22b5e) /* 0.426310889 */, 16 }, /* 2162 */ { MAD_F(0x06d33f32) /* 0.426573942 */, 16 }, /* 2163 */ { MAD_F(0x06d45312) /* 0.426837036 */, 16 }, /* 2164 */ { MAD_F(0x06d566fd) /* 0.427100170 */, 16 }, /* 2165 */ { MAD_F(0x06d67af2) /* 0.427363345 */, 16 }, /* 2166 */ { MAD_F(0x06d78ef3) /* 0.427626561 */, 16 }, /* 2167 */ { MAD_F(0x06d8a2fe) /* 0.427889817 */, 16 }, /* 2168 */ { MAD_F(0x06d9b714) /* 0.428153114 */, 16 }, /* 2169 */ { MAD_F(0x06dacb35) /* 0.428416451 */, 16 }, /* 2170 */ { MAD_F(0x06dbdf61) /* 0.428679828 */, 16 }, /* 2171 */ { MAD_F(0x06dcf398) /* 0.428943246 */, 16 }, /* 2172 */ { MAD_F(0x06de07d9) /* 0.429206704 */, 16 }, /* 2173 */ { MAD_F(0x06df1c26) /* 0.429470203 */, 16 }, /* 2174 */ { MAD_F(0x06e0307d) /* 0.429733743 */, 16 }, /* 2175 */ { MAD_F(0x06e144df) /* 0.429997322 */, 16 }, /* 2176 */ { MAD_F(0x06e2594c) /* 0.430260942 */, 16 }, /* 2177 */ { MAD_F(0x06e36dc4) /* 0.430524603 */, 16 }, /* 2178 */ { MAD_F(0x06e48246) /* 0.430788304 */, 16 }, /* 2179 */ { MAD_F(0x06e596d4) /* 0.431052045 */, 16 }, /* 2180 */ { MAD_F(0x06e6ab6c) /* 0.431315826 */, 16 }, /* 2181 */ { MAD_F(0x06e7c00f) /* 0.431579648 */, 16 }, /* 2182 */ { MAD_F(0x06e8d4bd) /* 0.431843511 */, 16 }, /* 2183 */ { MAD_F(0x06e9e976) /* 0.432107413 */, 16 }, /* 2184 */ { MAD_F(0x06eafe3a) /* 0.432371356 */, 16 }, /* 2185 */ { MAD_F(0x06ec1308) /* 0.432635339 */, 16 }, /* 2186 */ { MAD_F(0x06ed27e2) /* 0.432899362 */, 16 }, /* 2187 */ { MAD_F(0x06ee3cc6) /* 0.433163426 */, 16 }, /* 2188 */ { MAD_F(0x06ef51b4) /* 0.433427530 */, 16 }, /* 2189 */ { MAD_F(0x06f066ae) /* 0.433691674 */, 16 }, /* 2190 */ { MAD_F(0x06f17bb3) /* 0.433955859 */, 16 }, /* 2191 */ { MAD_F(0x06f290c2) /* 0.434220083 */, 16 }, /* 2192 */ { MAD_F(0x06f3a5dc) /* 0.434484348 */, 16 }, /* 2193 */ { MAD_F(0x06f4bb01) /* 0.434748653 */, 16 }, /* 2194 */ { MAD_F(0x06f5d030) /* 0.435012998 */, 16 }, /* 2195 */ { MAD_F(0x06f6e56b) /* 0.435277383 */, 16 }, /* 2196 */ { MAD_F(0x06f7fab0) /* 0.435541809 */, 16 }, /* 2197 */ { MAD_F(0x06f91000) /* 0.435806274 */, 16 }, /* 2198 */ { MAD_F(0x06fa255a) /* 0.436070780 */, 16 }, /* 2199 */ { MAD_F(0x06fb3ac0) /* 0.436335326 */, 16 }, /* 2200 */ { MAD_F(0x06fc5030) /* 0.436599912 */, 16 }, /* 2201 */ { MAD_F(0x06fd65ab) /* 0.436864538 */, 16 }, /* 2202 */ { MAD_F(0x06fe7b31) /* 0.437129204 */, 16 }, /* 2203 */ { MAD_F(0x06ff90c2) /* 0.437393910 */, 16 }, /* 2204 */ { MAD_F(0x0700a65d) /* 0.437658657 */, 16 }, /* 2205 */ { MAD_F(0x0701bc03) /* 0.437923443 */, 16 }, /* 2206 */ { MAD_F(0x0702d1b4) /* 0.438188269 */, 16 }, /* 2207 */ { MAD_F(0x0703e76f) /* 0.438453136 */, 16 }, /* 2208 */ { MAD_F(0x0704fd35) /* 0.438718042 */, 16 }, /* 2209 */ { MAD_F(0x07061306) /* 0.438982988 */, 16 }, /* 2210 */ { MAD_F(0x070728e2) /* 0.439247975 */, 16 }, /* 2211 */ { MAD_F(0x07083ec9) /* 0.439513001 */, 16 }, /* 2212 */ { MAD_F(0x070954ba) /* 0.439778067 */, 16 }, /* 2213 */ { MAD_F(0x070a6ab6) /* 0.440043173 */, 16 }, /* 2214 */ { MAD_F(0x070b80bc) /* 0.440308320 */, 16 }, /* 2215 */ { MAD_F(0x070c96ce) /* 0.440573506 */, 16 }, /* 2216 */ { MAD_F(0x070dacea) /* 0.440838732 */, 16 }, /* 2217 */ { MAD_F(0x070ec310) /* 0.441103997 */, 16 }, /* 2218 */ { MAD_F(0x070fd942) /* 0.441369303 */, 16 }, /* 2219 */ { MAD_F(0x0710ef7e) /* 0.441634649 */, 16 }, /* 2220 */ { MAD_F(0x071205c5) /* 0.441900034 */, 16 }, /* 2221 */ { MAD_F(0x07131c17) /* 0.442165460 */, 16 }, /* 2222 */ { MAD_F(0x07143273) /* 0.442430925 */, 16 }, /* 2223 */ { MAD_F(0x071548da) /* 0.442696430 */, 16 }, /* 2224 */ { MAD_F(0x07165f4b) /* 0.442961975 */, 16 }, /* 2225 */ { MAD_F(0x071775c8) /* 0.443227559 */, 16 }, /* 2226 */ { MAD_F(0x07188c4f) /* 0.443493184 */, 16 }, /* 2227 */ { MAD_F(0x0719a2e0) /* 0.443758848 */, 16 }, /* 2228 */ { MAD_F(0x071ab97d) /* 0.444024552 */, 16 }, /* 2229 */ { MAD_F(0x071bd024) /* 0.444290296 */, 16 }, /* 2230 */ { MAD_F(0x071ce6d6) /* 0.444556079 */, 16 }, /* 2231 */ { MAD_F(0x071dfd92) /* 0.444821902 */, 16 }, /* 2232 */ { MAD_F(0x071f1459) /* 0.445087765 */, 16 }, /* 2233 */ { MAD_F(0x07202b2b) /* 0.445353668 */, 16 }, /* 2234 */ { MAD_F(0x07214207) /* 0.445619610 */, 16 }, /* 2235 */ { MAD_F(0x072258ee) /* 0.445885592 */, 16 }, /* 2236 */ { MAD_F(0x07236fe0) /* 0.446151614 */, 16 }, /* 2237 */ { MAD_F(0x072486dc) /* 0.446417675 */, 16 }, /* 2238 */ { MAD_F(0x07259de3) /* 0.446683776 */, 16 }, /* 2239 */ { MAD_F(0x0726b4f4) /* 0.446949917 */, 16 }, /* 2240 */ { MAD_F(0x0727cc11) /* 0.447216097 */, 16 }, /* 2241 */ { MAD_F(0x0728e338) /* 0.447482317 */, 16 }, /* 2242 */ { MAD_F(0x0729fa69) /* 0.447748576 */, 16 }, /* 2243 */ { MAD_F(0x072b11a5) /* 0.448014875 */, 16 }, /* 2244 */ { MAD_F(0x072c28ec) /* 0.448281214 */, 16 }, /* 2245 */ { MAD_F(0x072d403d) /* 0.448547592 */, 16 }, /* 2246 */ { MAD_F(0x072e5799) /* 0.448814010 */, 16 }, /* 2247 */ { MAD_F(0x072f6f00) /* 0.449080467 */, 16 }, /* 2248 */ { MAD_F(0x07308671) /* 0.449346964 */, 16 }, /* 2249 */ { MAD_F(0x07319ded) /* 0.449613501 */, 16 }, /* 2250 */ { MAD_F(0x0732b573) /* 0.449880076 */, 16 }, /* 2251 */ { MAD_F(0x0733cd04) /* 0.450146692 */, 16 }, /* 2252 */ { MAD_F(0x0734e4a0) /* 0.450413347 */, 16 }, /* 2253 */ { MAD_F(0x0735fc46) /* 0.450680041 */, 16 }, /* 2254 */ { MAD_F(0x073713f7) /* 0.450946775 */, 16 }, /* 2255 */ { MAD_F(0x07382bb2) /* 0.451213548 */, 16 }, /* 2256 */ { MAD_F(0x07394378) /* 0.451480360 */, 16 }, /* 2257 */ { MAD_F(0x073a5b49) /* 0.451747213 */, 16 }, /* 2258 */ { MAD_F(0x073b7324) /* 0.452014104 */, 16 }, /* 2259 */ { MAD_F(0x073c8b0a) /* 0.452281035 */, 16 }, /* 2260 */ { MAD_F(0x073da2fa) /* 0.452548005 */, 16 }, /* 2261 */ { MAD_F(0x073ebaf5) /* 0.452815015 */, 16 }, /* 2262 */ { MAD_F(0x073fd2fa) /* 0.453082064 */, 16 }, /* 2263 */ { MAD_F(0x0740eb0a) /* 0.453349152 */, 16 }, /* 2264 */ { MAD_F(0x07420325) /* 0.453616280 */, 16 }, /* 2265 */ { MAD_F(0x07431b4a) /* 0.453883447 */, 16 }, /* 2266 */ { MAD_F(0x0744337a) /* 0.454150653 */, 16 }, /* 2267 */ { MAD_F(0x07454bb4) /* 0.454417899 */, 16 }, /* 2268 */ { MAD_F(0x074663f8) /* 0.454685184 */, 16 }, /* 2269 */ { MAD_F(0x07477c48) /* 0.454952508 */, 16 }, /* 2270 */ { MAD_F(0x074894a2) /* 0.455219872 */, 16 }, /* 2271 */ { MAD_F(0x0749ad06) /* 0.455487275 */, 16 }, /* 2272 */ { MAD_F(0x074ac575) /* 0.455754717 */, 16 }, /* 2273 */ { MAD_F(0x074bddee) /* 0.456022198 */, 16 }, /* 2274 */ { MAD_F(0x074cf672) /* 0.456289719 */, 16 }, /* 2275 */ { MAD_F(0x074e0f01) /* 0.456557278 */, 16 }, /* 2276 */ { MAD_F(0x074f279a) /* 0.456824877 */, 16 }, /* 2277 */ { MAD_F(0x0750403e) /* 0.457092516 */, 16 }, /* 2278 */ { MAD_F(0x075158ec) /* 0.457360193 */, 16 }, /* 2279 */ { MAD_F(0x075271a4) /* 0.457627909 */, 16 }, /* 2280 */ { MAD_F(0x07538a67) /* 0.457895665 */, 16 }, /* 2281 */ { MAD_F(0x0754a335) /* 0.458163460 */, 16 }, /* 2282 */ { MAD_F(0x0755bc0d) /* 0.458431294 */, 16 }, /* 2283 */ { MAD_F(0x0756d4f0) /* 0.458699167 */, 16 }, /* 2284 */ { MAD_F(0x0757eddd) /* 0.458967079 */, 16 }, /* 2285 */ { MAD_F(0x075906d5) /* 0.459235030 */, 16 }, /* 2286 */ { MAD_F(0x075a1fd7) /* 0.459503021 */, 16 }, /* 2287 */ { MAD_F(0x075b38e3) /* 0.459771050 */, 16 }, /* 2288 */ { MAD_F(0x075c51fa) /* 0.460039119 */, 16 }, /* 2289 */ { MAD_F(0x075d6b1c) /* 0.460307226 */, 16 }, /* 2290 */ { MAD_F(0x075e8448) /* 0.460575373 */, 16 }, /* 2291 */ { MAD_F(0x075f9d7f) /* 0.460843559 */, 16 }, /* 2292 */ { MAD_F(0x0760b6c0) /* 0.461111783 */, 16 }, /* 2293 */ { MAD_F(0x0761d00b) /* 0.461380047 */, 16 }, /* 2294 */ { MAD_F(0x0762e961) /* 0.461648350 */, 16 }, /* 2295 */ { MAD_F(0x076402c1) /* 0.461916691 */, 16 }, /* 2296 */ { MAD_F(0x07651c2c) /* 0.462185072 */, 16 }, /* 2297 */ { MAD_F(0x076635a2) /* 0.462453492 */, 16 }, /* 2298 */ { MAD_F(0x07674f22) /* 0.462721950 */, 16 }, /* 2299 */ { MAD_F(0x076868ac) /* 0.462990448 */, 16 }, /* 2300 */ { MAD_F(0x07698240) /* 0.463258984 */, 16 }, /* 2301 */ { MAD_F(0x076a9be0) /* 0.463527560 */, 16 }, /* 2302 */ { MAD_F(0x076bb589) /* 0.463796174 */, 16 }, /* 2303 */ { MAD_F(0x076ccf3d) /* 0.464064827 */, 16 }, /* 2304 */ { MAD_F(0x076de8fc) /* 0.464333519 */, 16 }, /* 2305 */ { MAD_F(0x076f02c5) /* 0.464602250 */, 16 }, /* 2306 */ { MAD_F(0x07701c98) /* 0.464871020 */, 16 }, /* 2307 */ { MAD_F(0x07713676) /* 0.465139829 */, 16 }, /* 2308 */ { MAD_F(0x0772505e) /* 0.465408676 */, 16 }, /* 2309 */ { MAD_F(0x07736a51) /* 0.465677563 */, 16 }, /* 2310 */ { MAD_F(0x0774844e) /* 0.465946488 */, 16 }, /* 2311 */ { MAD_F(0x07759e55) /* 0.466215452 */, 16 }, /* 2312 */ { MAD_F(0x0776b867) /* 0.466484455 */, 16 }, /* 2313 */ { MAD_F(0x0777d283) /* 0.466753496 */, 16 }, /* 2314 */ { MAD_F(0x0778ecaa) /* 0.467022577 */, 16 }, /* 2315 */ { MAD_F(0x077a06db) /* 0.467291696 */, 16 }, /* 2316 */ { MAD_F(0x077b2117) /* 0.467560854 */, 16 }, /* 2317 */ { MAD_F(0x077c3b5d) /* 0.467830050 */, 16 }, /* 2318 */ { MAD_F(0x077d55ad) /* 0.468099285 */, 16 }, /* 2319 */ { MAD_F(0x077e7008) /* 0.468368560 */, 16 }, /* 2320 */ { MAD_F(0x077f8a6d) /* 0.468637872 */, 16 }, /* 2321 */ { MAD_F(0x0780a4dc) /* 0.468907224 */, 16 }, /* 2322 */ { MAD_F(0x0781bf56) /* 0.469176614 */, 16 }, /* 2323 */ { MAD_F(0x0782d9da) /* 0.469446043 */, 16 }, /* 2324 */ { MAD_F(0x0783f469) /* 0.469715510 */, 16 }, /* 2325 */ { MAD_F(0x07850f02) /* 0.469985016 */, 16 }, /* 2326 */ { MAD_F(0x078629a5) /* 0.470254561 */, 16 }, /* 2327 */ { MAD_F(0x07874453) /* 0.470524145 */, 16 }, /* 2328 */ { MAD_F(0x07885f0b) /* 0.470793767 */, 16 }, /* 2329 */ { MAD_F(0x078979ce) /* 0.471063427 */, 16 }, /* 2330 */ { MAD_F(0x078a949a) /* 0.471333126 */, 16 }, /* 2331 */ { MAD_F(0x078baf72) /* 0.471602864 */, 16 }, /* 2332 */ { MAD_F(0x078cca53) /* 0.471872641 */, 16 }, /* 2333 */ { MAD_F(0x078de53f) /* 0.472142456 */, 16 }, /* 2334 */ { MAD_F(0x078f0035) /* 0.472412309 */, 16 }, /* 2335 */ { MAD_F(0x07901b36) /* 0.472682201 */, 16 }, /* 2336 */ { MAD_F(0x07913641) /* 0.472952132 */, 16 }, /* 2337 */ { MAD_F(0x07925156) /* 0.473222101 */, 16 }, /* 2338 */ { MAD_F(0x07936c76) /* 0.473492108 */, 16 }, /* 2339 */ { MAD_F(0x079487a0) /* 0.473762155 */, 16 }, /* 2340 */ { MAD_F(0x0795a2d4) /* 0.474032239 */, 16 }, /* 2341 */ { MAD_F(0x0796be13) /* 0.474302362 */, 16 }, /* 2342 */ { MAD_F(0x0797d95c) /* 0.474572524 */, 16 }, /* 2343 */ { MAD_F(0x0798f4af) /* 0.474842724 */, 16 }, /* 2344 */ { MAD_F(0x079a100c) /* 0.475112962 */, 16 }, /* 2345 */ { MAD_F(0x079b2b74) /* 0.475383239 */, 16 }, /* 2346 */ { MAD_F(0x079c46e7) /* 0.475653554 */, 16 }, /* 2347 */ { MAD_F(0x079d6263) /* 0.475923908 */, 16 }, /* 2348 */ { MAD_F(0x079e7dea) /* 0.476194300 */, 16 }, /* 2349 */ { MAD_F(0x079f997b) /* 0.476464731 */, 16 }, /* 2350 */ { MAD_F(0x07a0b516) /* 0.476735200 */, 16 }, /* 2351 */ { MAD_F(0x07a1d0bc) /* 0.477005707 */, 16 }, /* 2352 */ { MAD_F(0x07a2ec6c) /* 0.477276252 */, 16 }, /* 2353 */ { MAD_F(0x07a40827) /* 0.477546836 */, 16 }, /* 2354 */ { MAD_F(0x07a523eb) /* 0.477817459 */, 16 }, /* 2355 */ { MAD_F(0x07a63fba) /* 0.478088119 */, 16 }, /* 2356 */ { MAD_F(0x07a75b93) /* 0.478358818 */, 16 }, /* 2357 */ { MAD_F(0x07a87777) /* 0.478629555 */, 16 }, /* 2358 */ { MAD_F(0x07a99364) /* 0.478900331 */, 16 }, /* 2359 */ { MAD_F(0x07aaaf5c) /* 0.479171145 */, 16 }, /* 2360 */ { MAD_F(0x07abcb5f) /* 0.479441997 */, 16 }, /* 2361 */ { MAD_F(0x07ace76b) /* 0.479712887 */, 16 }, /* 2362 */ { MAD_F(0x07ae0382) /* 0.479983816 */, 16 }, /* 2363 */ { MAD_F(0x07af1fa3) /* 0.480254782 */, 16 }, /* 2364 */ { MAD_F(0x07b03bcf) /* 0.480525787 */, 16 }, /* 2365 */ { MAD_F(0x07b15804) /* 0.480796831 */, 16 }, /* 2366 */ { MAD_F(0x07b27444) /* 0.481067912 */, 16 }, /* 2367 */ { MAD_F(0x07b3908e) /* 0.481339032 */, 16 }, /* 2368 */ { MAD_F(0x07b4ace3) /* 0.481610189 */, 16 }, /* 2369 */ { MAD_F(0x07b5c941) /* 0.481881385 */, 16 }, /* 2370 */ { MAD_F(0x07b6e5aa) /* 0.482152620 */, 16 }, /* 2371 */ { MAD_F(0x07b8021d) /* 0.482423892 */, 16 }, /* 2372 */ { MAD_F(0x07b91e9b) /* 0.482695202 */, 16 }, /* 2373 */ { MAD_F(0x07ba3b22) /* 0.482966551 */, 16 }, /* 2374 */ { MAD_F(0x07bb57b4) /* 0.483237938 */, 16 }, /* 2375 */ { MAD_F(0x07bc7450) /* 0.483509362 */, 16 }, /* 2376 */ { MAD_F(0x07bd90f6) /* 0.483780825 */, 16 }, /* 2377 */ { MAD_F(0x07beada7) /* 0.484052326 */, 16 }, /* 2378 */ { MAD_F(0x07bfca61) /* 0.484323865 */, 16 }, /* 2379 */ { MAD_F(0x07c0e726) /* 0.484595443 */, 16 }, /* 2380 */ { MAD_F(0x07c203f5) /* 0.484867058 */, 16 }, /* 2381 */ { MAD_F(0x07c320cf) /* 0.485138711 */, 16 }, /* 2382 */ { MAD_F(0x07c43db2) /* 0.485410402 */, 16 }, /* 2383 */ { MAD_F(0x07c55aa0) /* 0.485682131 */, 16 }, /* 2384 */ { MAD_F(0x07c67798) /* 0.485953899 */, 16 }, /* 2385 */ { MAD_F(0x07c7949a) /* 0.486225704 */, 16 }, /* 2386 */ { MAD_F(0x07c8b1a7) /* 0.486497547 */, 16 }, /* 2387 */ { MAD_F(0x07c9cebd) /* 0.486769429 */, 16 }, /* 2388 */ { MAD_F(0x07caebde) /* 0.487041348 */, 16 }, /* 2389 */ { MAD_F(0x07cc0909) /* 0.487313305 */, 16 }, /* 2390 */ { MAD_F(0x07cd263e) /* 0.487585300 */, 16 }, /* 2391 */ { MAD_F(0x07ce437d) /* 0.487857333 */, 16 }, /* 2392 */ { MAD_F(0x07cf60c7) /* 0.488129404 */, 16 }, /* 2393 */ { MAD_F(0x07d07e1b) /* 0.488401513 */, 16 }, /* 2394 */ { MAD_F(0x07d19b79) /* 0.488673660 */, 16 }, /* 2395 */ { MAD_F(0x07d2b8e1) /* 0.488945845 */, 16 }, /* 2396 */ { MAD_F(0x07d3d653) /* 0.489218067 */, 16 }, /* 2397 */ { MAD_F(0x07d4f3cf) /* 0.489490328 */, 16 }, /* 2398 */ { MAD_F(0x07d61156) /* 0.489762626 */, 16 }, /* 2399 */ { MAD_F(0x07d72ee6) /* 0.490034962 */, 16 }, /* 2400 */ { MAD_F(0x07d84c81) /* 0.490307336 */, 16 }, /* 2401 */ { MAD_F(0x07d96a26) /* 0.490579748 */, 16 }, /* 2402 */ { MAD_F(0x07da87d5) /* 0.490852198 */, 16 }, /* 2403 */ { MAD_F(0x07dba58f) /* 0.491124686 */, 16 }, /* 2404 */ { MAD_F(0x07dcc352) /* 0.491397211 */, 16 }, /* 2405 */ { MAD_F(0x07dde120) /* 0.491669774 */, 16 }, /* 2406 */ { MAD_F(0x07defef7) /* 0.491942375 */, 16 }, /* 2407 */ { MAD_F(0x07e01cd9) /* 0.492215014 */, 16 }, /* 2408 */ { MAD_F(0x07e13ac5) /* 0.492487690 */, 16 }, /* 2409 */ { MAD_F(0x07e258bc) /* 0.492760404 */, 16 }, /* 2410 */ { MAD_F(0x07e376bc) /* 0.493033156 */, 16 }, /* 2411 */ { MAD_F(0x07e494c6) /* 0.493305946 */, 16 }, /* 2412 */ { MAD_F(0x07e5b2db) /* 0.493578773 */, 16 }, /* 2413 */ { MAD_F(0x07e6d0f9) /* 0.493851638 */, 16 }, /* 2414 */ { MAD_F(0x07e7ef22) /* 0.494124541 */, 16 }, /* 2415 */ { MAD_F(0x07e90d55) /* 0.494397481 */, 16 }, /* 2416 */ { MAD_F(0x07ea2b92) /* 0.494670459 */, 16 }, /* 2417 */ { MAD_F(0x07eb49d9) /* 0.494943475 */, 16 }, /* 2418 */ { MAD_F(0x07ec682a) /* 0.495216529 */, 16 }, /* 2419 */ { MAD_F(0x07ed8686) /* 0.495489620 */, 16 }, /* 2420 */ { MAD_F(0x07eea4eb) /* 0.495762748 */, 16 }, /* 2421 */ { MAD_F(0x07efc35b) /* 0.496035915 */, 16 }, /* 2422 */ { MAD_F(0x07f0e1d4) /* 0.496309119 */, 16 }, /* 2423 */ { MAD_F(0x07f20058) /* 0.496582360 */, 16 }, /* 2424 */ { MAD_F(0x07f31ee6) /* 0.496855639 */, 16 }, /* 2425 */ { MAD_F(0x07f43d7e) /* 0.497128956 */, 16 }, /* 2426 */ { MAD_F(0x07f55c20) /* 0.497402310 */, 16 }, /* 2427 */ { MAD_F(0x07f67acc) /* 0.497675702 */, 16 }, /* 2428 */ { MAD_F(0x07f79982) /* 0.497949132 */, 16 }, /* 2429 */ { MAD_F(0x07f8b842) /* 0.498222598 */, 16 }, /* 2430 */ { MAD_F(0x07f9d70c) /* 0.498496103 */, 16 }, /* 2431 */ { MAD_F(0x07faf5e1) /* 0.498769645 */, 16 }, /* 2432 */ { MAD_F(0x07fc14bf) /* 0.499043224 */, 16 }, /* 2433 */ { MAD_F(0x07fd33a8) /* 0.499316841 */, 16 }, /* 2434 */ { MAD_F(0x07fe529a) /* 0.499590496 */, 16 }, /* 2435 */ { MAD_F(0x07ff7197) /* 0.499864188 */, 16 }, /* 2436 */ { MAD_F(0x0400484f) /* 0.250068959 */, 17 }, /* 2437 */ { MAD_F(0x0400d7d7) /* 0.250205842 */, 17 }, /* 2438 */ { MAD_F(0x04016764) /* 0.250342744 */, 17 }, /* 2439 */ { MAD_F(0x0401f6f7) /* 0.250479665 */, 17 }, /* 2440 */ { MAD_F(0x0402868e) /* 0.250616605 */, 17 }, /* 2441 */ { MAD_F(0x0403162b) /* 0.250753563 */, 17 }, /* 2442 */ { MAD_F(0x0403a5cc) /* 0.250890540 */, 17 }, /* 2443 */ { MAD_F(0x04043573) /* 0.251027536 */, 17 }, /* 2444 */ { MAD_F(0x0404c51e) /* 0.251164550 */, 17 }, /* 2445 */ { MAD_F(0x040554cf) /* 0.251301583 */, 17 }, /* 2446 */ { MAD_F(0x0405e484) /* 0.251438635 */, 17 }, /* 2447 */ { MAD_F(0x0406743f) /* 0.251575706 */, 17 }, /* 2448 */ { MAD_F(0x040703ff) /* 0.251712795 */, 17 }, /* 2449 */ { MAD_F(0x040793c3) /* 0.251849903 */, 17 }, /* 2450 */ { MAD_F(0x0408238d) /* 0.251987029 */, 17 }, /* 2451 */ { MAD_F(0x0408b35b) /* 0.252124174 */, 17 }, /* 2452 */ { MAD_F(0x0409432f) /* 0.252261338 */, 17 }, /* 2453 */ { MAD_F(0x0409d308) /* 0.252398520 */, 17 }, /* 2454 */ { MAD_F(0x040a62e5) /* 0.252535721 */, 17 }, /* 2455 */ { MAD_F(0x040af2c8) /* 0.252672941 */, 17 }, /* 2456 */ { MAD_F(0x040b82b0) /* 0.252810180 */, 17 }, /* 2457 */ { MAD_F(0x040c129c) /* 0.252947436 */, 17 }, /* 2458 */ { MAD_F(0x040ca28e) /* 0.253084712 */, 17 }, /* 2459 */ { MAD_F(0x040d3284) /* 0.253222006 */, 17 }, /* 2460 */ { MAD_F(0x040dc280) /* 0.253359319 */, 17 }, /* 2461 */ { MAD_F(0x040e5281) /* 0.253496651 */, 17 }, /* 2462 */ { MAD_F(0x040ee286) /* 0.253634001 */, 17 }, /* 2463 */ { MAD_F(0x040f7291) /* 0.253771369 */, 17 }, /* 2464 */ { MAD_F(0x041002a1) /* 0.253908756 */, 17 }, /* 2465 */ { MAD_F(0x041092b5) /* 0.254046162 */, 17 }, /* 2466 */ { MAD_F(0x041122cf) /* 0.254183587 */, 17 }, /* 2467 */ { MAD_F(0x0411b2ed) /* 0.254321030 */, 17 }, /* 2468 */ { MAD_F(0x04124311) /* 0.254458491 */, 17 }, /* 2469 */ { MAD_F(0x0412d339) /* 0.254595971 */, 17 }, /* 2470 */ { MAD_F(0x04136367) /* 0.254733470 */, 17 }, /* 2471 */ { MAD_F(0x0413f399) /* 0.254870987 */, 17 }, /* 2472 */ { MAD_F(0x041483d1) /* 0.255008523 */, 17 }, /* 2473 */ { MAD_F(0x0415140d) /* 0.255146077 */, 17 }, /* 2474 */ { MAD_F(0x0415a44f) /* 0.255283650 */, 17 }, /* 2475 */ { MAD_F(0x04163495) /* 0.255421241 */, 17 }, /* 2476 */ { MAD_F(0x0416c4e1) /* 0.255558851 */, 17 }, /* 2477 */ { MAD_F(0x04175531) /* 0.255696480 */, 17 }, /* 2478 */ { MAD_F(0x0417e586) /* 0.255834127 */, 17 }, /* 2479 */ { MAD_F(0x041875e1) /* 0.255971792 */, 17 }, /* 2480 */ { MAD_F(0x04190640) /* 0.256109476 */, 17 }, /* 2481 */ { MAD_F(0x041996a4) /* 0.256247179 */, 17 }, /* 2482 */ { MAD_F(0x041a270d) /* 0.256384900 */, 17 }, /* 2483 */ { MAD_F(0x041ab77b) /* 0.256522639 */, 17 }, /* 2484 */ { MAD_F(0x041b47ef) /* 0.256660397 */, 17 }, /* 2485 */ { MAD_F(0x041bd867) /* 0.256798174 */, 17 }, /* 2486 */ { MAD_F(0x041c68e4) /* 0.256935969 */, 17 }, /* 2487 */ { MAD_F(0x041cf966) /* 0.257073782 */, 17 }, /* 2488 */ { MAD_F(0x041d89ed) /* 0.257211614 */, 17 }, /* 2489 */ { MAD_F(0x041e1a79) /* 0.257349465 */, 17 }, /* 2490 */ { MAD_F(0x041eab0a) /* 0.257487334 */, 17 }, /* 2491 */ { MAD_F(0x041f3b9f) /* 0.257625221 */, 17 }, /* 2492 */ { MAD_F(0x041fcc3a) /* 0.257763127 */, 17 }, /* 2493 */ { MAD_F(0x04205cda) /* 0.257901051 */, 17 }, /* 2494 */ { MAD_F(0x0420ed7f) /* 0.258038994 */, 17 }, /* 2495 */ { MAD_F(0x04217e28) /* 0.258176955 */, 17 }, /* 2496 */ { MAD_F(0x04220ed7) /* 0.258314934 */, 17 }, /* 2497 */ { MAD_F(0x04229f8a) /* 0.258452932 */, 17 }, /* 2498 */ { MAD_F(0x04233043) /* 0.258590948 */, 17 }, /* 2499 */ { MAD_F(0x0423c100) /* 0.258728983 */, 17 }, /* 2500 */ { MAD_F(0x042451c3) /* 0.258867036 */, 17 }, /* 2501 */ { MAD_F(0x0424e28a) /* 0.259005108 */, 17 }, /* 2502 */ { MAD_F(0x04257356) /* 0.259143198 */, 17 }, /* 2503 */ { MAD_F(0x04260428) /* 0.259281307 */, 17 }, /* 2504 */ { MAD_F(0x042694fe) /* 0.259419433 */, 17 }, /* 2505 */ { MAD_F(0x042725d9) /* 0.259557579 */, 17 }, /* 2506 */ { MAD_F(0x0427b6b9) /* 0.259695742 */, 17 }, /* 2507 */ { MAD_F(0x0428479e) /* 0.259833924 */, 17 }, /* 2508 */ { MAD_F(0x0428d888) /* 0.259972124 */, 17 }, /* 2509 */ { MAD_F(0x04296976) /* 0.260110343 */, 17 }, /* 2510 */ { MAD_F(0x0429fa6a) /* 0.260248580 */, 17 }, /* 2511 */ { MAD_F(0x042a8b63) /* 0.260386836 */, 17 }, /* 2512 */ { MAD_F(0x042b1c60) /* 0.260525110 */, 17 }, /* 2513 */ { MAD_F(0x042bad63) /* 0.260663402 */, 17 }, /* 2514 */ { MAD_F(0x042c3e6a) /* 0.260801712 */, 17 }, /* 2515 */ { MAD_F(0x042ccf77) /* 0.260940041 */, 17 }, /* 2516 */ { MAD_F(0x042d6088) /* 0.261078388 */, 17 }, /* 2517 */ { MAD_F(0x042df19e) /* 0.261216754 */, 17 }, /* 2518 */ { MAD_F(0x042e82b9) /* 0.261355137 */, 17 }, /* 2519 */ { MAD_F(0x042f13d9) /* 0.261493540 */, 17 }, /* 2520 */ { MAD_F(0x042fa4fe) /* 0.261631960 */, 17 }, /* 2521 */ { MAD_F(0x04303628) /* 0.261770399 */, 17 }, /* 2522 */ { MAD_F(0x0430c757) /* 0.261908856 */, 17 }, /* 2523 */ { MAD_F(0x0431588b) /* 0.262047331 */, 17 }, /* 2524 */ { MAD_F(0x0431e9c3) /* 0.262185825 */, 17 }, /* 2525 */ { MAD_F(0x04327b01) /* 0.262324337 */, 17 }, /* 2526 */ { MAD_F(0x04330c43) /* 0.262462867 */, 17 }, /* 2527 */ { MAD_F(0x04339d8a) /* 0.262601416 */, 17 }, /* 2528 */ { MAD_F(0x04342ed7) /* 0.262739982 */, 17 }, /* 2529 */ { MAD_F(0x0434c028) /* 0.262878568 */, 17 }, /* 2530 */ { MAD_F(0x0435517e) /* 0.263017171 */, 17 }, /* 2531 */ { MAD_F(0x0435e2d9) /* 0.263155792 */, 17 }, /* 2532 */ { MAD_F(0x04367439) /* 0.263294432 */, 17 }, /* 2533 */ { MAD_F(0x0437059e) /* 0.263433090 */, 17 }, /* 2534 */ { MAD_F(0x04379707) /* 0.263571767 */, 17 }, /* 2535 */ { MAD_F(0x04382876) /* 0.263710461 */, 17 }, /* 2536 */ { MAD_F(0x0438b9e9) /* 0.263849174 */, 17 }, /* 2537 */ { MAD_F(0x04394b61) /* 0.263987905 */, 17 }, /* 2538 */ { MAD_F(0x0439dcdf) /* 0.264126655 */, 17 }, /* 2539 */ { MAD_F(0x043a6e61) /* 0.264265422 */, 17 }, /* 2540 */ { MAD_F(0x043affe8) /* 0.264404208 */, 17 }, /* 2541 */ { MAD_F(0x043b9174) /* 0.264543012 */, 17 }, /* 2542 */ { MAD_F(0x043c2305) /* 0.264681834 */, 17 }, /* 2543 */ { MAD_F(0x043cb49a) /* 0.264820674 */, 17 }, /* 2544 */ { MAD_F(0x043d4635) /* 0.264959533 */, 17 }, /* 2545 */ { MAD_F(0x043dd7d4) /* 0.265098410 */, 17 }, /* 2546 */ { MAD_F(0x043e6979) /* 0.265237305 */, 17 }, /* 2547 */ { MAD_F(0x043efb22) /* 0.265376218 */, 17 }, /* 2548 */ { MAD_F(0x043f8cd0) /* 0.265515149 */, 17 }, /* 2549 */ { MAD_F(0x04401e83) /* 0.265654099 */, 17 }, /* 2550 */ { MAD_F(0x0440b03b) /* 0.265793066 */, 17 }, /* 2551 */ { MAD_F(0x044141f7) /* 0.265932052 */, 17 }, /* 2552 */ { MAD_F(0x0441d3b9) /* 0.266071056 */, 17 }, /* 2553 */ { MAD_F(0x04426580) /* 0.266210078 */, 17 }, /* 2554 */ { MAD_F(0x0442f74b) /* 0.266349119 */, 17 }, /* 2555 */ { MAD_F(0x0443891b) /* 0.266488177 */, 17 }, /* 2556 */ { MAD_F(0x04441af0) /* 0.266627254 */, 17 }, /* 2557 */ { MAD_F(0x0444acca) /* 0.266766349 */, 17 }, /* 2558 */ { MAD_F(0x04453ea9) /* 0.266905462 */, 17 }, /* 2559 */ { MAD_F(0x0445d08d) /* 0.267044593 */, 17 }, /* 2560 */ { MAD_F(0x04466275) /* 0.267183742 */, 17 }, /* 2561 */ { MAD_F(0x0446f463) /* 0.267322909 */, 17 }, /* 2562 */ { MAD_F(0x04478655) /* 0.267462094 */, 17 }, /* 2563 */ { MAD_F(0x0448184c) /* 0.267601298 */, 17 }, /* 2564 */ { MAD_F(0x0448aa48) /* 0.267740519 */, 17 }, /* 2565 */ { MAD_F(0x04493c49) /* 0.267879759 */, 17 }, /* 2566 */ { MAD_F(0x0449ce4f) /* 0.268019017 */, 17 }, /* 2567 */ { MAD_F(0x044a6059) /* 0.268158293 */, 17 }, /* 2568 */ { MAD_F(0x044af269) /* 0.268297587 */, 17 }, /* 2569 */ { MAD_F(0x044b847d) /* 0.268436899 */, 17 }, /* 2570 */ { MAD_F(0x044c1696) /* 0.268576229 */, 17 }, /* 2571 */ { MAD_F(0x044ca8b4) /* 0.268715577 */, 17 }, /* 2572 */ { MAD_F(0x044d3ad7) /* 0.268854943 */, 17 }, /* 2573 */ { MAD_F(0x044dccff) /* 0.268994328 */, 17 }, /* 2574 */ { MAD_F(0x044e5f2b) /* 0.269133730 */, 17 }, /* 2575 */ { MAD_F(0x044ef15d) /* 0.269273150 */, 17 }, /* 2576 */ { MAD_F(0x044f8393) /* 0.269412589 */, 17 }, /* 2577 */ { MAD_F(0x045015ce) /* 0.269552045 */, 17 }, /* 2578 */ { MAD_F(0x0450a80e) /* 0.269691520 */, 17 }, /* 2579 */ { MAD_F(0x04513a53) /* 0.269831013 */, 17 }, /* 2580 */ { MAD_F(0x0451cc9c) /* 0.269970523 */, 17 }, /* 2581 */ { MAD_F(0x04525eeb) /* 0.270110052 */, 17 }, /* 2582 */ { MAD_F(0x0452f13e) /* 0.270249599 */, 17 }, /* 2583 */ { MAD_F(0x04538396) /* 0.270389163 */, 17 }, /* 2584 */ { MAD_F(0x045415f3) /* 0.270528746 */, 17 }, /* 2585 */ { MAD_F(0x0454a855) /* 0.270668347 */, 17 }, /* 2586 */ { MAD_F(0x04553abb) /* 0.270807965 */, 17 }, /* 2587 */ { MAD_F(0x0455cd27) /* 0.270947602 */, 17 }, /* 2588 */ { MAD_F(0x04565f97) /* 0.271087257 */, 17 }, /* 2589 */ { MAD_F(0x0456f20c) /* 0.271226930 */, 17 }, /* 2590 */ { MAD_F(0x04578486) /* 0.271366620 */, 17 }, /* 2591 */ { MAD_F(0x04581705) /* 0.271506329 */, 17 }, /* 2592 */ { MAD_F(0x0458a989) /* 0.271646056 */, 17 }, /* 2593 */ { MAD_F(0x04593c11) /* 0.271785800 */, 17 }, /* 2594 */ { MAD_F(0x0459ce9e) /* 0.271925563 */, 17 }, /* 2595 */ { MAD_F(0x045a6130) /* 0.272065343 */, 17 }, /* 2596 */ { MAD_F(0x045af3c7) /* 0.272205142 */, 17 }, /* 2597 */ { MAD_F(0x045b8663) /* 0.272344958 */, 17 }, /* 2598 */ { MAD_F(0x045c1903) /* 0.272484793 */, 17 }, /* 2599 */ { MAD_F(0x045caba9) /* 0.272624645 */, 17 }, /* 2600 */ { MAD_F(0x045d3e53) /* 0.272764515 */, 17 }, /* 2601 */ { MAD_F(0x045dd102) /* 0.272904403 */, 17 }, /* 2602 */ { MAD_F(0x045e63b6) /* 0.273044310 */, 17 }, /* 2603 */ { MAD_F(0x045ef66e) /* 0.273184234 */, 17 }, /* 2604 */ { MAD_F(0x045f892b) /* 0.273324176 */, 17 }, /* 2605 */ { MAD_F(0x04601bee) /* 0.273464136 */, 17 }, /* 2606 */ { MAD_F(0x0460aeb5) /* 0.273604113 */, 17 }, /* 2607 */ { MAD_F(0x04614180) /* 0.273744109 */, 17 }, /* 2608 */ { MAD_F(0x0461d451) /* 0.273884123 */, 17 }, /* 2609 */ { MAD_F(0x04626727) /* 0.274024154 */, 17 }, /* 2610 */ { MAD_F(0x0462fa01) /* 0.274164204 */, 17 }, /* 2611 */ { MAD_F(0x04638ce0) /* 0.274304271 */, 17 }, /* 2612 */ { MAD_F(0x04641fc4) /* 0.274444356 */, 17 }, /* 2613 */ { MAD_F(0x0464b2ac) /* 0.274584459 */, 17 }, /* 2614 */ { MAD_F(0x0465459a) /* 0.274724580 */, 17 }, /* 2615 */ { MAD_F(0x0465d88c) /* 0.274864719 */, 17 }, /* 2616 */ { MAD_F(0x04666b83) /* 0.275004875 */, 17 }, /* 2617 */ { MAD_F(0x0466fe7f) /* 0.275145050 */, 17 }, /* 2618 */ { MAD_F(0x0467917f) /* 0.275285242 */, 17 }, /* 2619 */ { MAD_F(0x04682485) /* 0.275425452 */, 17 }, /* 2620 */ { MAD_F(0x0468b78f) /* 0.275565681 */, 17 }, /* 2621 */ { MAD_F(0x04694a9e) /* 0.275705926 */, 17 }, /* 2622 */ { MAD_F(0x0469ddb2) /* 0.275846190 */, 17 }, /* 2623 */ { MAD_F(0x046a70ca) /* 0.275986472 */, 17 }, /* 2624 */ { MAD_F(0x046b03e7) /* 0.276126771 */, 17 }, /* 2625 */ { MAD_F(0x046b970a) /* 0.276267088 */, 17 }, /* 2626 */ { MAD_F(0x046c2a31) /* 0.276407423 */, 17 }, /* 2627 */ { MAD_F(0x046cbd5c) /* 0.276547776 */, 17 }, /* 2628 */ { MAD_F(0x046d508d) /* 0.276688147 */, 17 }, /* 2629 */ { MAD_F(0x046de3c2) /* 0.276828535 */, 17 }, /* 2630 */ { MAD_F(0x046e76fc) /* 0.276968942 */, 17 }, /* 2631 */ { MAD_F(0x046f0a3b) /* 0.277109366 */, 17 }, /* 2632 */ { MAD_F(0x046f9d7e) /* 0.277249808 */, 17 }, /* 2633 */ { MAD_F(0x047030c7) /* 0.277390267 */, 17 }, /* 2634 */ { MAD_F(0x0470c414) /* 0.277530745 */, 17 }, /* 2635 */ { MAD_F(0x04715766) /* 0.277671240 */, 17 }, /* 2636 */ { MAD_F(0x0471eabc) /* 0.277811753 */, 17 }, /* 2637 */ { MAD_F(0x04727e18) /* 0.277952284 */, 17 }, /* 2638 */ { MAD_F(0x04731178) /* 0.278092832 */, 17 }, /* 2639 */ { MAD_F(0x0473a4dd) /* 0.278233399 */, 17 }, /* 2640 */ { MAD_F(0x04743847) /* 0.278373983 */, 17 }, /* 2641 */ { MAD_F(0x0474cbb5) /* 0.278514584 */, 17 }, /* 2642 */ { MAD_F(0x04755f29) /* 0.278655204 */, 17 }, /* 2643 */ { MAD_F(0x0475f2a1) /* 0.278795841 */, 17 }, /* 2644 */ { MAD_F(0x0476861d) /* 0.278936496 */, 17 }, /* 2645 */ { MAD_F(0x0477199f) /* 0.279077169 */, 17 }, /* 2646 */ { MAD_F(0x0477ad25) /* 0.279217860 */, 17 }, /* 2647 */ { MAD_F(0x047840b0) /* 0.279358568 */, 17 }, /* 2648 */ { MAD_F(0x0478d440) /* 0.279499294 */, 17 }, /* 2649 */ { MAD_F(0x047967d5) /* 0.279640037 */, 17 }, /* 2650 */ { MAD_F(0x0479fb6e) /* 0.279780799 */, 17 }, /* 2651 */ { MAD_F(0x047a8f0c) /* 0.279921578 */, 17 }, /* 2652 */ { MAD_F(0x047b22af) /* 0.280062375 */, 17 }, /* 2653 */ { MAD_F(0x047bb657) /* 0.280203189 */, 17 }, /* 2654 */ { MAD_F(0x047c4a03) /* 0.280344021 */, 17 }, /* 2655 */ { MAD_F(0x047cddb4) /* 0.280484871 */, 17 }, /* 2656 */ { MAD_F(0x047d716a) /* 0.280625739 */, 17 }, /* 2657 */ { MAD_F(0x047e0524) /* 0.280766624 */, 17 }, /* 2658 */ { MAD_F(0x047e98e4) /* 0.280907527 */, 17 }, /* 2659 */ { MAD_F(0x047f2ca8) /* 0.281048447 */, 17 }, /* 2660 */ { MAD_F(0x047fc071) /* 0.281189385 */, 17 }, /* 2661 */ { MAD_F(0x0480543e) /* 0.281330341 */, 17 }, /* 2662 */ { MAD_F(0x0480e811) /* 0.281471315 */, 17 }, /* 2663 */ { MAD_F(0x04817be8) /* 0.281612306 */, 17 }, /* 2664 */ { MAD_F(0x04820fc3) /* 0.281753315 */, 17 }, /* 2665 */ { MAD_F(0x0482a3a4) /* 0.281894341 */, 17 }, /* 2666 */ { MAD_F(0x04833789) /* 0.282035386 */, 17 }, /* 2667 */ { MAD_F(0x0483cb73) /* 0.282176447 */, 17 }, /* 2668 */ { MAD_F(0x04845f62) /* 0.282317527 */, 17 }, /* 2669 */ { MAD_F(0x0484f355) /* 0.282458624 */, 17 }, /* 2670 */ { MAD_F(0x0485874d) /* 0.282599738 */, 17 }, /* 2671 */ { MAD_F(0x04861b4a) /* 0.282740871 */, 17 }, /* 2672 */ { MAD_F(0x0486af4c) /* 0.282882021 */, 17 }, /* 2673 */ { MAD_F(0x04874352) /* 0.283023188 */, 17 }, /* 2674 */ { MAD_F(0x0487d75d) /* 0.283164373 */, 17 }, /* 2675 */ { MAD_F(0x04886b6d) /* 0.283305576 */, 17 }, /* 2676 */ { MAD_F(0x0488ff82) /* 0.283446796 */, 17 }, /* 2677 */ { MAD_F(0x0489939b) /* 0.283588034 */, 17 }, /* 2678 */ { MAD_F(0x048a27b9) /* 0.283729290 */, 17 }, /* 2679 */ { MAD_F(0x048abbdc) /* 0.283870563 */, 17 }, /* 2680 */ { MAD_F(0x048b5003) /* 0.284011853 */, 17 }, /* 2681 */ { MAD_F(0x048be42f) /* 0.284153161 */, 17 }, /* 2682 */ { MAD_F(0x048c7860) /* 0.284294487 */, 17 }, /* 2683 */ { MAD_F(0x048d0c96) /* 0.284435831 */, 17 }, /* 2684 */ { MAD_F(0x048da0d0) /* 0.284577192 */, 17 }, /* 2685 */ { MAD_F(0x048e350f) /* 0.284718570 */, 17 }, /* 2686 */ { MAD_F(0x048ec953) /* 0.284859966 */, 17 }, /* 2687 */ { MAD_F(0x048f5d9b) /* 0.285001380 */, 17 }, /* 2688 */ { MAD_F(0x048ff1e8) /* 0.285142811 */, 17 }, /* 2689 */ { MAD_F(0x0490863a) /* 0.285284259 */, 17 }, /* 2690 */ { MAD_F(0x04911a91) /* 0.285425726 */, 17 }, /* 2691 */ { MAD_F(0x0491aeec) /* 0.285567209 */, 17 }, /* 2692 */ { MAD_F(0x0492434c) /* 0.285708711 */, 17 }, /* 2693 */ { MAD_F(0x0492d7b0) /* 0.285850229 */, 17 }, /* 2694 */ { MAD_F(0x04936c1a) /* 0.285991766 */, 17 }, /* 2695 */ { MAD_F(0x04940088) /* 0.286133319 */, 17 }, /* 2696 */ { MAD_F(0x049494fb) /* 0.286274891 */, 17 }, /* 2697 */ { MAD_F(0x04952972) /* 0.286416480 */, 17 }, /* 2698 */ { MAD_F(0x0495bdee) /* 0.286558086 */, 17 }, /* 2699 */ { MAD_F(0x0496526f) /* 0.286699710 */, 17 }, /* 2700 */ { MAD_F(0x0496e6f5) /* 0.286841351 */, 17 }, /* 2701 */ { MAD_F(0x04977b7f) /* 0.286983010 */, 17 }, /* 2702 */ { MAD_F(0x0498100e) /* 0.287124686 */, 17 }, /* 2703 */ { MAD_F(0x0498a4a1) /* 0.287266380 */, 17 }, /* 2704 */ { MAD_F(0x0499393a) /* 0.287408091 */, 17 }, /* 2705 */ { MAD_F(0x0499cdd7) /* 0.287549820 */, 17 }, /* 2706 */ { MAD_F(0x049a6278) /* 0.287691566 */, 17 }, /* 2707 */ { MAD_F(0x049af71f) /* 0.287833330 */, 17 }, /* 2708 */ { MAD_F(0x049b8bca) /* 0.287975111 */, 17 }, /* 2709 */ { MAD_F(0x049c207a) /* 0.288116909 */, 17 }, /* 2710 */ { MAD_F(0x049cb52e) /* 0.288258725 */, 17 }, /* 2711 */ { MAD_F(0x049d49e7) /* 0.288400559 */, 17 }, /* 2712 */ { MAD_F(0x049ddea5) /* 0.288542409 */, 17 }, /* 2713 */ { MAD_F(0x049e7367) /* 0.288684278 */, 17 }, /* 2714 */ { MAD_F(0x049f082f) /* 0.288826163 */, 17 }, /* 2715 */ { MAD_F(0x049f9cfa) /* 0.288968067 */, 17 }, /* 2716 */ { MAD_F(0x04a031cb) /* 0.289109987 */, 17 }, /* 2717 */ { MAD_F(0x04a0c6a0) /* 0.289251925 */, 17 }, /* 2718 */ { MAD_F(0x04a15b7a) /* 0.289393881 */, 17 }, /* 2719 */ { MAD_F(0x04a1f059) /* 0.289535854 */, 17 }, /* 2720 */ { MAD_F(0x04a2853c) /* 0.289677844 */, 17 }, /* 2721 */ { MAD_F(0x04a31a24) /* 0.289819851 */, 17 }, /* 2722 */ { MAD_F(0x04a3af10) /* 0.289961876 */, 17 }, /* 2723 */ { MAD_F(0x04a44401) /* 0.290103919 */, 17 }, /* 2724 */ { MAD_F(0x04a4d8f7) /* 0.290245979 */, 17 }, /* 2725 */ { MAD_F(0x04a56df2) /* 0.290388056 */, 17 }, /* 2726 */ { MAD_F(0x04a602f1) /* 0.290530150 */, 17 }, /* 2727 */ { MAD_F(0x04a697f5) /* 0.290672262 */, 17 }, /* 2728 */ { MAD_F(0x04a72cfe) /* 0.290814392 */, 17 }, /* 2729 */ { MAD_F(0x04a7c20b) /* 0.290956538 */, 17 }, /* 2730 */ { MAD_F(0x04a8571d) /* 0.291098703 */, 17 }, /* 2731 */ { MAD_F(0x04a8ec33) /* 0.291240884 */, 17 }, /* 2732 */ { MAD_F(0x04a9814e) /* 0.291383083 */, 17 }, /* 2733 */ { MAD_F(0x04aa166e) /* 0.291525299 */, 17 }, /* 2734 */ { MAD_F(0x04aaab93) /* 0.291667532 */, 17 }, /* 2735 */ { MAD_F(0x04ab40bc) /* 0.291809783 */, 17 }, /* 2736 */ { MAD_F(0x04abd5ea) /* 0.291952051 */, 17 }, /* 2737 */ { MAD_F(0x04ac6b1c) /* 0.292094337 */, 17 }, /* 2738 */ { MAD_F(0x04ad0053) /* 0.292236640 */, 17 }, /* 2739 */ { MAD_F(0x04ad958f) /* 0.292378960 */, 17 }, /* 2740 */ { MAD_F(0x04ae2ad0) /* 0.292521297 */, 17 }, /* 2741 */ { MAD_F(0x04aec015) /* 0.292663652 */, 17 }, /* 2742 */ { MAD_F(0x04af555e) /* 0.292806024 */, 17 }, /* 2743 */ { MAD_F(0x04afeaad) /* 0.292948414 */, 17 }, /* 2744 */ { MAD_F(0x04b08000) /* 0.293090820 */, 17 }, /* 2745 */ { MAD_F(0x04b11557) /* 0.293233244 */, 17 }, /* 2746 */ { MAD_F(0x04b1aab4) /* 0.293375686 */, 17 }, /* 2747 */ { MAD_F(0x04b24015) /* 0.293518144 */, 17 }, /* 2748 */ { MAD_F(0x04b2d57a) /* 0.293660620 */, 17 }, /* 2749 */ { MAD_F(0x04b36ae4) /* 0.293803113 */, 17 }, /* 2750 */ { MAD_F(0x04b40053) /* 0.293945624 */, 17 }, /* 2751 */ { MAD_F(0x04b495c7) /* 0.294088151 */, 17 }, /* 2752 */ { MAD_F(0x04b52b3f) /* 0.294230696 */, 17 }, /* 2753 */ { MAD_F(0x04b5c0bc) /* 0.294373259 */, 17 }, /* 2754 */ { MAD_F(0x04b6563d) /* 0.294515838 */, 17 }, /* 2755 */ { MAD_F(0x04b6ebc3) /* 0.294658435 */, 17 }, /* 2756 */ { MAD_F(0x04b7814e) /* 0.294801049 */, 17 }, /* 2757 */ { MAD_F(0x04b816dd) /* 0.294943680 */, 17 }, /* 2758 */ { MAD_F(0x04b8ac71) /* 0.295086329 */, 17 }, /* 2759 */ { MAD_F(0x04b9420a) /* 0.295228995 */, 17 }, /* 2760 */ { MAD_F(0x04b9d7a7) /* 0.295371678 */, 17 }, /* 2761 */ { MAD_F(0x04ba6d49) /* 0.295514378 */, 17 }, /* 2762 */ { MAD_F(0x04bb02ef) /* 0.295657095 */, 17 }, /* 2763 */ { MAD_F(0x04bb989a) /* 0.295799830 */, 17 }, /* 2764 */ { MAD_F(0x04bc2e4a) /* 0.295942582 */, 17 }, /* 2765 */ { MAD_F(0x04bcc3fe) /* 0.296085351 */, 17 }, /* 2766 */ { MAD_F(0x04bd59b7) /* 0.296228138 */, 17 }, /* 2767 */ { MAD_F(0x04bdef74) /* 0.296370941 */, 17 }, /* 2768 */ { MAD_F(0x04be8537) /* 0.296513762 */, 17 }, /* 2769 */ { MAD_F(0x04bf1afd) /* 0.296656600 */, 17 }, /* 2770 */ { MAD_F(0x04bfb0c9) /* 0.296799455 */, 17 }, /* 2771 */ { MAD_F(0x04c04699) /* 0.296942327 */, 17 }, /* 2772 */ { MAD_F(0x04c0dc6d) /* 0.297085217 */, 17 }, /* 2773 */ { MAD_F(0x04c17247) /* 0.297228124 */, 17 }, /* 2774 */ { MAD_F(0x04c20824) /* 0.297371048 */, 17 }, /* 2775 */ { MAD_F(0x04c29e07) /* 0.297513989 */, 17 }, /* 2776 */ { MAD_F(0x04c333ee) /* 0.297656947 */, 17 }, /* 2777 */ { MAD_F(0x04c3c9da) /* 0.297799922 */, 17 }, /* 2778 */ { MAD_F(0x04c45fca) /* 0.297942915 */, 17 }, /* 2779 */ { MAD_F(0x04c4f5bf) /* 0.298085925 */, 17 }, /* 2780 */ { MAD_F(0x04c58bb8) /* 0.298228951 */, 17 }, /* 2781 */ { MAD_F(0x04c621b6) /* 0.298371996 */, 17 }, /* 2782 */ { MAD_F(0x04c6b7b9) /* 0.298515057 */, 17 }, /* 2783 */ { MAD_F(0x04c74dc0) /* 0.298658135 */, 17 }, /* 2784 */ { MAD_F(0x04c7e3cc) /* 0.298801231 */, 17 }, /* 2785 */ { MAD_F(0x04c879dd) /* 0.298944343 */, 17 }, /* 2786 */ { MAD_F(0x04c90ff2) /* 0.299087473 */, 17 }, /* 2787 */ { MAD_F(0x04c9a60c) /* 0.299230620 */, 17 }, /* 2788 */ { MAD_F(0x04ca3c2a) /* 0.299373784 */, 17 }, /* 2789 */ { MAD_F(0x04cad24d) /* 0.299516965 */, 17 }, /* 2790 */ { MAD_F(0x04cb6874) /* 0.299660163 */, 17 }, /* 2791 */ { MAD_F(0x04cbfea0) /* 0.299803378 */, 17 }, /* 2792 */ { MAD_F(0x04cc94d1) /* 0.299946611 */, 17 }, /* 2793 */ { MAD_F(0x04cd2b06) /* 0.300089860 */, 17 }, /* 2794 */ { MAD_F(0x04cdc140) /* 0.300233127 */, 17 }, /* 2795 */ { MAD_F(0x04ce577f) /* 0.300376411 */, 17 }, /* 2796 */ { MAD_F(0x04ceedc2) /* 0.300519711 */, 17 }, /* 2797 */ { MAD_F(0x04cf8409) /* 0.300663029 */, 17 }, /* 2798 */ { MAD_F(0x04d01a55) /* 0.300806364 */, 17 }, /* 2799 */ { MAD_F(0x04d0b0a6) /* 0.300949716 */, 17 }, /* 2800 */ { MAD_F(0x04d146fb) /* 0.301093085 */, 17 }, /* 2801 */ { MAD_F(0x04d1dd55) /* 0.301236472 */, 17 }, /* 2802 */ { MAD_F(0x04d273b4) /* 0.301379875 */, 17 }, /* 2803 */ { MAD_F(0x04d30a17) /* 0.301523295 */, 17 }, /* 2804 */ { MAD_F(0x04d3a07f) /* 0.301666733 */, 17 }, /* 2805 */ { MAD_F(0x04d436eb) /* 0.301810187 */, 17 }, /* 2806 */ { MAD_F(0x04d4cd5c) /* 0.301953659 */, 17 }, /* 2807 */ { MAD_F(0x04d563d1) /* 0.302097147 */, 17 }, /* 2808 */ { MAD_F(0x04d5fa4b) /* 0.302240653 */, 17 }, /* 2809 */ { MAD_F(0x04d690ca) /* 0.302384175 */, 17 }, /* 2810 */ { MAD_F(0x04d7274d) /* 0.302527715 */, 17 }, /* 2811 */ { MAD_F(0x04d7bdd5) /* 0.302671271 */, 17 }, /* 2812 */ { MAD_F(0x04d85461) /* 0.302814845 */, 17 }, /* 2813 */ { MAD_F(0x04d8eaf2) /* 0.302958436 */, 17 }, /* 2814 */ { MAD_F(0x04d98187) /* 0.303102044 */, 17 }, /* 2815 */ { MAD_F(0x04da1821) /* 0.303245668 */, 17 }, /* 2816 */ { MAD_F(0x04daaec0) /* 0.303389310 */, 17 }, /* 2817 */ { MAD_F(0x04db4563) /* 0.303532969 */, 17 }, /* 2818 */ { MAD_F(0x04dbdc0a) /* 0.303676645 */, 17 }, /* 2819 */ { MAD_F(0x04dc72b7) /* 0.303820337 */, 17 }, /* 2820 */ { MAD_F(0x04dd0967) /* 0.303964047 */, 17 }, /* 2821 */ { MAD_F(0x04dda01d) /* 0.304107774 */, 17 }, /* 2822 */ { MAD_F(0x04de36d7) /* 0.304251517 */, 17 }, /* 2823 */ { MAD_F(0x04decd95) /* 0.304395278 */, 17 }, /* 2824 */ { MAD_F(0x04df6458) /* 0.304539056 */, 17 }, /* 2825 */ { MAD_F(0x04dffb20) /* 0.304682850 */, 17 }, /* 2826 */ { MAD_F(0x04e091ec) /* 0.304826662 */, 17 }, /* 2827 */ { MAD_F(0x04e128bc) /* 0.304970491 */, 17 }, /* 2828 */ { MAD_F(0x04e1bf92) /* 0.305114336 */, 17 }, /* 2829 */ { MAD_F(0x04e2566b) /* 0.305258199 */, 17 }, /* 2830 */ { MAD_F(0x04e2ed4a) /* 0.305402078 */, 17 }, /* 2831 */ { MAD_F(0x04e3842d) /* 0.305545974 */, 17 }, /* 2832 */ { MAD_F(0x04e41b14) /* 0.305689888 */, 17 }, /* 2833 */ { MAD_F(0x04e4b200) /* 0.305833818 */, 17 }, /* 2834 */ { MAD_F(0x04e548f1) /* 0.305977765 */, 17 }, /* 2835 */ { MAD_F(0x04e5dfe6) /* 0.306121729 */, 17 }, /* 2836 */ { MAD_F(0x04e676df) /* 0.306265710 */, 17 }, /* 2837 */ { MAD_F(0x04e70dde) /* 0.306409708 */, 17 }, /* 2838 */ { MAD_F(0x04e7a4e0) /* 0.306553723 */, 17 }, /* 2839 */ { MAD_F(0x04e83be7) /* 0.306697755 */, 17 }, /* 2840 */ { MAD_F(0x04e8d2f3) /* 0.306841804 */, 17 }, /* 2841 */ { MAD_F(0x04e96a04) /* 0.306985869 */, 17 }, /* 2842 */ { MAD_F(0x04ea0118) /* 0.307129952 */, 17 }, /* 2843 */ { MAD_F(0x04ea9832) /* 0.307274051 */, 17 }, /* 2844 */ { MAD_F(0x04eb2f50) /* 0.307418168 */, 17 }, /* 2845 */ { MAD_F(0x04ebc672) /* 0.307562301 */, 17 }, /* 2846 */ { MAD_F(0x04ec5d99) /* 0.307706451 */, 17 }, /* 2847 */ { MAD_F(0x04ecf4c5) /* 0.307850618 */, 17 }, /* 2848 */ { MAD_F(0x04ed8bf5) /* 0.307994802 */, 17 }, /* 2849 */ { MAD_F(0x04ee2329) /* 0.308139003 */, 17 }, /* 2850 */ { MAD_F(0x04eeba63) /* 0.308283220 */, 17 }, /* 2851 */ { MAD_F(0x04ef51a0) /* 0.308427455 */, 17 }, /* 2852 */ { MAD_F(0x04efe8e2) /* 0.308571706 */, 17 }, /* 2853 */ { MAD_F(0x04f08029) /* 0.308715974 */, 17 }, /* 2854 */ { MAD_F(0x04f11774) /* 0.308860260 */, 17 }, /* 2855 */ { MAD_F(0x04f1aec4) /* 0.309004561 */, 17 }, /* 2856 */ { MAD_F(0x04f24618) /* 0.309148880 */, 17 }, /* 2857 */ { MAD_F(0x04f2dd71) /* 0.309293216 */, 17 }, /* 2858 */ { MAD_F(0x04f374cf) /* 0.309437568 */, 17 }, /* 2859 */ { MAD_F(0x04f40c30) /* 0.309581938 */, 17 }, /* 2860 */ { MAD_F(0x04f4a397) /* 0.309726324 */, 17 }, /* 2861 */ { MAD_F(0x04f53b02) /* 0.309870727 */, 17 }, /* 2862 */ { MAD_F(0x04f5d271) /* 0.310015147 */, 17 }, /* 2863 */ { MAD_F(0x04f669e5) /* 0.310159583 */, 17 }, /* 2864 */ { MAD_F(0x04f7015d) /* 0.310304037 */, 17 }, /* 2865 */ { MAD_F(0x04f798da) /* 0.310448507 */, 17 }, /* 2866 */ { MAD_F(0x04f8305c) /* 0.310592994 */, 17 }, /* 2867 */ { MAD_F(0x04f8c7e2) /* 0.310737498 */, 17 }, /* 2868 */ { MAD_F(0x04f95f6c) /* 0.310882018 */, 17 }, /* 2869 */ { MAD_F(0x04f9f6fb) /* 0.311026556 */, 17 }, /* 2870 */ { MAD_F(0x04fa8e8f) /* 0.311171110 */, 17 }, /* 2871 */ { MAD_F(0x04fb2627) /* 0.311315681 */, 17 }, /* 2872 */ { MAD_F(0x04fbbdc3) /* 0.311460269 */, 17 }, /* 2873 */ { MAD_F(0x04fc5564) /* 0.311604874 */, 17 }, /* 2874 */ { MAD_F(0x04fced0a) /* 0.311749495 */, 17 }, /* 2875 */ { MAD_F(0x04fd84b4) /* 0.311894133 */, 17 }, /* 2876 */ { MAD_F(0x04fe1c62) /* 0.312038788 */, 17 }, /* 2877 */ { MAD_F(0x04feb415) /* 0.312183460 */, 17 }, /* 2878 */ { MAD_F(0x04ff4bcd) /* 0.312328148 */, 17 }, /* 2879 */ { MAD_F(0x04ffe389) /* 0.312472854 */, 17 }, /* 2880 */ { MAD_F(0x05007b49) /* 0.312617576 */, 17 }, /* 2881 */ { MAD_F(0x0501130e) /* 0.312762314 */, 17 }, /* 2882 */ { MAD_F(0x0501aad8) /* 0.312907070 */, 17 }, /* 2883 */ { MAD_F(0x050242a6) /* 0.313051842 */, 17 }, /* 2884 */ { MAD_F(0x0502da78) /* 0.313196631 */, 17 }, /* 2885 */ { MAD_F(0x0503724f) /* 0.313341437 */, 17 }, /* 2886 */ { MAD_F(0x05040a2b) /* 0.313486259 */, 17 }, /* 2887 */ { MAD_F(0x0504a20b) /* 0.313631098 */, 17 }, /* 2888 */ { MAD_F(0x050539ef) /* 0.313775954 */, 17 }, /* 2889 */ { MAD_F(0x0505d1d8) /* 0.313920827 */, 17 }, /* 2890 */ { MAD_F(0x050669c5) /* 0.314065716 */, 17 }, /* 2891 */ { MAD_F(0x050701b7) /* 0.314210622 */, 17 }, /* 2892 */ { MAD_F(0x050799ae) /* 0.314355545 */, 17 }, /* 2893 */ { MAD_F(0x050831a9) /* 0.314500484 */, 17 }, /* 2894 */ { MAD_F(0x0508c9a8) /* 0.314645440 */, 17 }, /* 2895 */ { MAD_F(0x050961ac) /* 0.314790413 */, 17 }, /* 2896 */ { MAD_F(0x0509f9b4) /* 0.314935403 */, 17 }, /* 2897 */ { MAD_F(0x050a91c1) /* 0.315080409 */, 17 }, /* 2898 */ { MAD_F(0x050b29d2) /* 0.315225432 */, 17 }, /* 2899 */ { MAD_F(0x050bc1e8) /* 0.315370472 */, 17 }, /* 2900 */ { MAD_F(0x050c5a02) /* 0.315515528 */, 17 }, /* 2901 */ { MAD_F(0x050cf221) /* 0.315660601 */, 17 }, /* 2902 */ { MAD_F(0x050d8a44) /* 0.315805690 */, 17 }, /* 2903 */ { MAD_F(0x050e226c) /* 0.315950797 */, 17 }, /* 2904 */ { MAD_F(0x050eba98) /* 0.316095920 */, 17 }, /* 2905 */ { MAD_F(0x050f52c9) /* 0.316241059 */, 17 }, /* 2906 */ { MAD_F(0x050feafe) /* 0.316386216 */, 17 }, /* 2907 */ { MAD_F(0x05108337) /* 0.316531388 */, 17 }, /* 2908 */ { MAD_F(0x05111b75) /* 0.316676578 */, 17 }, /* 2909 */ { MAD_F(0x0511b3b8) /* 0.316821784 */, 17 }, /* 2910 */ { MAD_F(0x05124bff) /* 0.316967007 */, 17 }, /* 2911 */ { MAD_F(0x0512e44a) /* 0.317112247 */, 17 }, /* 2912 */ { MAD_F(0x05137c9a) /* 0.317257503 */, 17 }, /* 2913 */ { MAD_F(0x051414ee) /* 0.317402775 */, 17 }, /* 2914 */ { MAD_F(0x0514ad47) /* 0.317548065 */, 17 }, /* 2915 */ { MAD_F(0x051545a5) /* 0.317693371 */, 17 }, /* 2916 */ { MAD_F(0x0515de06) /* 0.317838693 */, 17 }, /* 2917 */ { MAD_F(0x0516766d) /* 0.317984033 */, 17 }, /* 2918 */ { MAD_F(0x05170ed7) /* 0.318129388 */, 17 }, /* 2919 */ { MAD_F(0x0517a746) /* 0.318274761 */, 17 }, /* 2920 */ { MAD_F(0x05183fba) /* 0.318420150 */, 17 }, /* 2921 */ { MAD_F(0x0518d832) /* 0.318565555 */, 17 }, /* 2922 */ { MAD_F(0x051970ae) /* 0.318710978 */, 17 }, /* 2923 */ { MAD_F(0x051a092f) /* 0.318856416 */, 17 }, /* 2924 */ { MAD_F(0x051aa1b5) /* 0.319001872 */, 17 }, /* 2925 */ { MAD_F(0x051b3a3f) /* 0.319147344 */, 17 }, /* 2926 */ { MAD_F(0x051bd2cd) /* 0.319292832 */, 17 }, /* 2927 */ { MAD_F(0x051c6b60) /* 0.319438338 */, 17 }, /* 2928 */ { MAD_F(0x051d03f7) /* 0.319583859 */, 17 }, /* 2929 */ { MAD_F(0x051d9c92) /* 0.319729398 */, 17 }, /* 2930 */ { MAD_F(0x051e3532) /* 0.319874952 */, 17 }, /* 2931 */ { MAD_F(0x051ecdd7) /* 0.320020524 */, 17 }, /* 2932 */ { MAD_F(0x051f6680) /* 0.320166112 */, 17 }, /* 2933 */ { MAD_F(0x051fff2d) /* 0.320311716 */, 17 }, /* 2934 */ { MAD_F(0x052097df) /* 0.320457337 */, 17 }, /* 2935 */ { MAD_F(0x05213095) /* 0.320602975 */, 17 }, /* 2936 */ { MAD_F(0x0521c950) /* 0.320748629 */, 17 }, /* 2937 */ { MAD_F(0x0522620f) /* 0.320894300 */, 17 }, /* 2938 */ { MAD_F(0x0522fad3) /* 0.321039987 */, 17 }, /* 2939 */ { MAD_F(0x0523939b) /* 0.321185691 */, 17 }, /* 2940 */ { MAD_F(0x05242c68) /* 0.321331411 */, 17 }, /* 2941 */ { MAD_F(0x0524c538) /* 0.321477148 */, 17 }, /* 2942 */ { MAD_F(0x05255e0e) /* 0.321622901 */, 17 }, /* 2943 */ { MAD_F(0x0525f6e8) /* 0.321768671 */, 17 }, /* 2944 */ { MAD_F(0x05268fc6) /* 0.321914457 */, 17 }, /* 2945 */ { MAD_F(0x052728a9) /* 0.322060260 */, 17 }, /* 2946 */ { MAD_F(0x0527c190) /* 0.322206079 */, 17 }, /* 2947 */ { MAD_F(0x05285a7b) /* 0.322351915 */, 17 }, /* 2948 */ { MAD_F(0x0528f36b) /* 0.322497768 */, 17 }, /* 2949 */ { MAD_F(0x05298c5f) /* 0.322643636 */, 17 }, /* 2950 */ { MAD_F(0x052a2558) /* 0.322789522 */, 17 }, /* 2951 */ { MAD_F(0x052abe55) /* 0.322935424 */, 17 }, /* 2952 */ { MAD_F(0x052b5757) /* 0.323081342 */, 17 }, /* 2953 */ { MAD_F(0x052bf05d) /* 0.323227277 */, 17 }, /* 2954 */ { MAD_F(0x052c8968) /* 0.323373228 */, 17 }, /* 2955 */ { MAD_F(0x052d2277) /* 0.323519196 */, 17 }, /* 2956 */ { MAD_F(0x052dbb8a) /* 0.323665180 */, 17 }, /* 2957 */ { MAD_F(0x052e54a2) /* 0.323811180 */, 17 }, /* 2958 */ { MAD_F(0x052eedbe) /* 0.323957197 */, 17 }, /* 2959 */ { MAD_F(0x052f86de) /* 0.324103231 */, 17 }, /* 2960 */ { MAD_F(0x05302003) /* 0.324249281 */, 17 }, /* 2961 */ { MAD_F(0x0530b92d) /* 0.324395347 */, 17 }, /* 2962 */ { MAD_F(0x0531525b) /* 0.324541430 */, 17 }, /* 2963 */ { MAD_F(0x0531eb8d) /* 0.324687530 */, 17 }, /* 2964 */ { MAD_F(0x053284c4) /* 0.324833646 */, 17 }, /* 2965 */ { MAD_F(0x05331dff) /* 0.324979778 */, 17 }, /* 2966 */ { MAD_F(0x0533b73e) /* 0.325125926 */, 17 }, /* 2967 */ { MAD_F(0x05345082) /* 0.325272091 */, 17 }, /* 2968 */ { MAD_F(0x0534e9ca) /* 0.325418273 */, 17 }, /* 2969 */ { MAD_F(0x05358317) /* 0.325564471 */, 17 }, /* 2970 */ { MAD_F(0x05361c68) /* 0.325710685 */, 17 }, /* 2971 */ { MAD_F(0x0536b5be) /* 0.325856916 */, 17 }, /* 2972 */ { MAD_F(0x05374f17) /* 0.326003163 */, 17 }, /* 2973 */ { MAD_F(0x0537e876) /* 0.326149427 */, 17 }, /* 2974 */ { MAD_F(0x053881d9) /* 0.326295707 */, 17 }, /* 2975 */ { MAD_F(0x05391b40) /* 0.326442003 */, 17 }, /* 2976 */ { MAD_F(0x0539b4ab) /* 0.326588316 */, 17 }, /* 2977 */ { MAD_F(0x053a4e1b) /* 0.326734645 */, 17 }, /* 2978 */ { MAD_F(0x053ae78f) /* 0.326880990 */, 17 }, /* 2979 */ { MAD_F(0x053b8108) /* 0.327027352 */, 17 }, /* 2980 */ { MAD_F(0x053c1a85) /* 0.327173730 */, 17 }, /* 2981 */ { MAD_F(0x053cb407) /* 0.327320125 */, 17 }, /* 2982 */ { MAD_F(0x053d4d8d) /* 0.327466536 */, 17 }, /* 2983 */ { MAD_F(0x053de717) /* 0.327612963 */, 17 }, /* 2984 */ { MAD_F(0x053e80a6) /* 0.327759407 */, 17 }, /* 2985 */ { MAD_F(0x053f1a39) /* 0.327905867 */, 17 }, /* 2986 */ { MAD_F(0x053fb3d0) /* 0.328052344 */, 17 }, /* 2987 */ { MAD_F(0x05404d6c) /* 0.328198837 */, 17 }, /* 2988 */ { MAD_F(0x0540e70c) /* 0.328345346 */, 17 }, /* 2989 */ { MAD_F(0x054180b1) /* 0.328491871 */, 17 }, /* 2990 */ { MAD_F(0x05421a5a) /* 0.328638413 */, 17 }, /* 2991 */ { MAD_F(0x0542b407) /* 0.328784971 */, 17 }, /* 2992 */ { MAD_F(0x05434db9) /* 0.328931546 */, 17 }, /* 2993 */ { MAD_F(0x0543e76f) /* 0.329078137 */, 17 }, /* 2994 */ { MAD_F(0x0544812a) /* 0.329224744 */, 17 }, /* 2995 */ { MAD_F(0x05451ae9) /* 0.329371367 */, 17 }, /* 2996 */ { MAD_F(0x0545b4ac) /* 0.329518007 */, 17 }, /* 2997 */ { MAD_F(0x05464e74) /* 0.329664663 */, 17 }, /* 2998 */ { MAD_F(0x0546e840) /* 0.329811336 */, 17 }, /* 2999 */ { MAD_F(0x05478211) /* 0.329958024 */, 17 }, /* 3000 */ { MAD_F(0x05481be5) /* 0.330104730 */, 17 }, /* 3001 */ { MAD_F(0x0548b5bf) /* 0.330251451 */, 17 }, /* 3002 */ { MAD_F(0x05494f9c) /* 0.330398189 */, 17 }, /* 3003 */ { MAD_F(0x0549e97e) /* 0.330544943 */, 17 }, /* 3004 */ { MAD_F(0x054a8364) /* 0.330691713 */, 17 }, /* 3005 */ { MAD_F(0x054b1d4f) /* 0.330838499 */, 17 }, /* 3006 */ { MAD_F(0x054bb73e) /* 0.330985302 */, 17 }, /* 3007 */ { MAD_F(0x054c5132) /* 0.331132121 */, 17 }, /* 3008 */ { MAD_F(0x054ceb2a) /* 0.331278957 */, 17 }, /* 3009 */ { MAD_F(0x054d8526) /* 0.331425808 */, 17 }, /* 3010 */ { MAD_F(0x054e1f26) /* 0.331572676 */, 17 }, /* 3011 */ { MAD_F(0x054eb92b) /* 0.331719560 */, 17 }, /* 3012 */ { MAD_F(0x054f5334) /* 0.331866461 */, 17 }, /* 3013 */ { MAD_F(0x054fed42) /* 0.332013377 */, 17 }, /* 3014 */ { MAD_F(0x05508754) /* 0.332160310 */, 17 }, /* 3015 */ { MAD_F(0x0551216b) /* 0.332307260 */, 17 }, /* 3016 */ { MAD_F(0x0551bb85) /* 0.332454225 */, 17 }, /* 3017 */ { MAD_F(0x055255a4) /* 0.332601207 */, 17 }, /* 3018 */ { MAD_F(0x0552efc8) /* 0.332748205 */, 17 }, /* 3019 */ { MAD_F(0x055389f0) /* 0.332895219 */, 17 }, /* 3020 */ { MAD_F(0x0554241c) /* 0.333042249 */, 17 }, /* 3021 */ { MAD_F(0x0554be4c) /* 0.333189296 */, 17 }, /* 3022 */ { MAD_F(0x05555881) /* 0.333336359 */, 17 }, /* 3023 */ { MAD_F(0x0555f2ba) /* 0.333483438 */, 17 }, /* 3024 */ { MAD_F(0x05568cf8) /* 0.333630533 */, 17 }, /* 3025 */ { MAD_F(0x0557273a) /* 0.333777645 */, 17 }, /* 3026 */ { MAD_F(0x0557c180) /* 0.333924772 */, 17 }, /* 3027 */ { MAD_F(0x05585bcb) /* 0.334071916 */, 17 }, /* 3028 */ { MAD_F(0x0558f61a) /* 0.334219076 */, 17 }, /* 3029 */ { MAD_F(0x0559906d) /* 0.334366253 */, 17 }, /* 3030 */ { MAD_F(0x055a2ac5) /* 0.334513445 */, 17 }, /* 3031 */ { MAD_F(0x055ac521) /* 0.334660654 */, 17 }, /* 3032 */ { MAD_F(0x055b5f81) /* 0.334807879 */, 17 }, /* 3033 */ { MAD_F(0x055bf9e6) /* 0.334955120 */, 17 }, /* 3034 */ { MAD_F(0x055c944f) /* 0.335102377 */, 17 }, /* 3035 */ { MAD_F(0x055d2ebd) /* 0.335249651 */, 17 }, /* 3036 */ { MAD_F(0x055dc92e) /* 0.335396941 */, 17 }, /* 3037 */ { MAD_F(0x055e63a5) /* 0.335544246 */, 17 }, /* 3038 */ { MAD_F(0x055efe1f) /* 0.335691568 */, 17 }, /* 3039 */ { MAD_F(0x055f989e) /* 0.335838906 */, 17 }, /* 3040 */ { MAD_F(0x05603321) /* 0.335986261 */, 17 }, /* 3041 */ { MAD_F(0x0560cda8) /* 0.336133631 */, 17 }, /* 3042 */ { MAD_F(0x05616834) /* 0.336281018 */, 17 }, /* 3043 */ { MAD_F(0x056202c4) /* 0.336428421 */, 17 }, /* 3044 */ { MAD_F(0x05629d59) /* 0.336575840 */, 17 }, /* 3045 */ { MAD_F(0x056337f2) /* 0.336723275 */, 17 }, /* 3046 */ { MAD_F(0x0563d28f) /* 0.336870726 */, 17 }, /* 3047 */ { MAD_F(0x05646d30) /* 0.337018193 */, 17 }, /* 3048 */ { MAD_F(0x056507d6) /* 0.337165677 */, 17 }, /* 3049 */ { MAD_F(0x0565a280) /* 0.337313176 */, 17 }, /* 3050 */ { MAD_F(0x05663d2f) /* 0.337460692 */, 17 }, /* 3051 */ { MAD_F(0x0566d7e1) /* 0.337608224 */, 17 }, /* 3052 */ { MAD_F(0x05677298) /* 0.337755772 */, 17 }, /* 3053 */ { MAD_F(0x05680d54) /* 0.337903336 */, 17 }, /* 3054 */ { MAD_F(0x0568a814) /* 0.338050916 */, 17 }, /* 3055 */ { MAD_F(0x056942d8) /* 0.338198513 */, 17 }, /* 3056 */ { MAD_F(0x0569dda0) /* 0.338346125 */, 17 }, /* 3057 */ { MAD_F(0x056a786d) /* 0.338493753 */, 17 }, /* 3058 */ { MAD_F(0x056b133e) /* 0.338641398 */, 17 }, /* 3059 */ { MAD_F(0x056bae13) /* 0.338789059 */, 17 }, /* 3060 */ { MAD_F(0x056c48ed) /* 0.338936736 */, 17 }, /* 3061 */ { MAD_F(0x056ce3cb) /* 0.339084429 */, 17 }, /* 3062 */ { MAD_F(0x056d7ead) /* 0.339232138 */, 17 }, /* 3063 */ { MAD_F(0x056e1994) /* 0.339379863 */, 17 }, /* 3064 */ { MAD_F(0x056eb47f) /* 0.339527604 */, 17 }, /* 3065 */ { MAD_F(0x056f4f6e) /* 0.339675361 */, 17 }, /* 3066 */ { MAD_F(0x056fea62) /* 0.339823134 */, 17 }, /* 3067 */ { MAD_F(0x0570855a) /* 0.339970924 */, 17 }, /* 3068 */ { MAD_F(0x05712056) /* 0.340118729 */, 17 }, /* 3069 */ { MAD_F(0x0571bb56) /* 0.340266550 */, 17 }, /* 3070 */ { MAD_F(0x0572565b) /* 0.340414388 */, 17 }, /* 3071 */ { MAD_F(0x0572f164) /* 0.340562242 */, 17 }, /* 3072 */ { MAD_F(0x05738c72) /* 0.340710111 */, 17 }, /* 3073 */ { MAD_F(0x05742784) /* 0.340857997 */, 17 }, /* 3074 */ { MAD_F(0x0574c29a) /* 0.341005899 */, 17 }, /* 3075 */ { MAD_F(0x05755db4) /* 0.341153816 */, 17 }, /* 3076 */ { MAD_F(0x0575f8d3) /* 0.341301750 */, 17 }, /* 3077 */ { MAD_F(0x057693f6) /* 0.341449700 */, 17 }, /* 3078 */ { MAD_F(0x05772f1d) /* 0.341597666 */, 17 }, /* 3079 */ { MAD_F(0x0577ca49) /* 0.341745648 */, 17 }, /* 3080 */ { MAD_F(0x05786578) /* 0.341893646 */, 17 }, /* 3081 */ { MAD_F(0x057900ad) /* 0.342041659 */, 17 }, /* 3082 */ { MAD_F(0x05799be5) /* 0.342189689 */, 17 }, /* 3083 */ { MAD_F(0x057a3722) /* 0.342337735 */, 17 }, /* 3084 */ { MAD_F(0x057ad263) /* 0.342485797 */, 17 }, /* 3085 */ { MAD_F(0x057b6da8) /* 0.342633875 */, 17 }, /* 3086 */ { MAD_F(0x057c08f2) /* 0.342781969 */, 17 }, /* 3087 */ { MAD_F(0x057ca440) /* 0.342930079 */, 17 }, /* 3088 */ { MAD_F(0x057d3f92) /* 0.343078205 */, 17 }, /* 3089 */ { MAD_F(0x057ddae9) /* 0.343226347 */, 17 }, /* 3090 */ { MAD_F(0x057e7644) /* 0.343374505 */, 17 }, /* 3091 */ { MAD_F(0x057f11a3) /* 0.343522679 */, 17 }, /* 3092 */ { MAD_F(0x057fad06) /* 0.343670869 */, 17 }, /* 3093 */ { MAD_F(0x0580486e) /* 0.343819075 */, 17 }, /* 3094 */ { MAD_F(0x0580e3da) /* 0.343967296 */, 17 }, /* 3095 */ { MAD_F(0x05817f4a) /* 0.344115534 */, 17 }, /* 3096 */ { MAD_F(0x05821abf) /* 0.344263788 */, 17 }, /* 3097 */ { MAD_F(0x0582b638) /* 0.344412058 */, 17 }, /* 3098 */ { MAD_F(0x058351b5) /* 0.344560343 */, 17 }, /* 3099 */ { MAD_F(0x0583ed36) /* 0.344708645 */, 17 }, /* 3100 */ { MAD_F(0x058488bc) /* 0.344856963 */, 17 }, /* 3101 */ { MAD_F(0x05852446) /* 0.345005296 */, 17 }, /* 3102 */ { MAD_F(0x0585bfd4) /* 0.345153646 */, 17 }, /* 3103 */ { MAD_F(0x05865b67) /* 0.345302011 */, 17 }, /* 3104 */ { MAD_F(0x0586f6fd) /* 0.345450393 */, 17 }, /* 3105 */ { MAD_F(0x05879298) /* 0.345598790 */, 17 }, /* 3106 */ { MAD_F(0x05882e38) /* 0.345747203 */, 17 }, /* 3107 */ { MAD_F(0x0588c9dc) /* 0.345895632 */, 17 }, /* 3108 */ { MAD_F(0x05896583) /* 0.346044077 */, 17 }, /* 3109 */ { MAD_F(0x058a0130) /* 0.346192538 */, 17 }, /* 3110 */ { MAD_F(0x058a9ce0) /* 0.346341015 */, 17 }, /* 3111 */ { MAD_F(0x058b3895) /* 0.346489508 */, 17 }, /* 3112 */ { MAD_F(0x058bd44e) /* 0.346638017 */, 17 }, /* 3113 */ { MAD_F(0x058c700b) /* 0.346786542 */, 17 }, /* 3114 */ { MAD_F(0x058d0bcd) /* 0.346935082 */, 17 }, /* 3115 */ { MAD_F(0x058da793) /* 0.347083639 */, 17 }, /* 3116 */ { MAD_F(0x058e435d) /* 0.347232211 */, 17 }, /* 3117 */ { MAD_F(0x058edf2b) /* 0.347380799 */, 17 }, /* 3118 */ { MAD_F(0x058f7afe) /* 0.347529403 */, 17 }, /* 3119 */ { MAD_F(0x059016d5) /* 0.347678023 */, 17 }, /* 3120 */ { MAD_F(0x0590b2b0) /* 0.347826659 */, 17 }, /* 3121 */ { MAD_F(0x05914e8f) /* 0.347975311 */, 17 }, /* 3122 */ { MAD_F(0x0591ea73) /* 0.348123979 */, 17 }, /* 3123 */ { MAD_F(0x0592865b) /* 0.348272662 */, 17 }, /* 3124 */ { MAD_F(0x05932247) /* 0.348421362 */, 17 }, /* 3125 */ { MAD_F(0x0593be37) /* 0.348570077 */, 17 }, /* 3126 */ { MAD_F(0x05945a2c) /* 0.348718808 */, 17 }, /* 3127 */ { MAD_F(0x0594f625) /* 0.348867555 */, 17 }, /* 3128 */ { MAD_F(0x05959222) /* 0.349016318 */, 17 }, /* 3129 */ { MAD_F(0x05962e24) /* 0.349165097 */, 17 }, /* 3130 */ { MAD_F(0x0596ca2a) /* 0.349313892 */, 17 }, /* 3131 */ { MAD_F(0x05976634) /* 0.349462702 */, 17 }, /* 3132 */ { MAD_F(0x05980242) /* 0.349611528 */, 17 }, /* 3133 */ { MAD_F(0x05989e54) /* 0.349760370 */, 17 }, /* 3134 */ { MAD_F(0x05993a6b) /* 0.349909228 */, 17 }, /* 3135 */ { MAD_F(0x0599d686) /* 0.350058102 */, 17 }, /* 3136 */ { MAD_F(0x059a72a5) /* 0.350206992 */, 17 }, /* 3137 */ { MAD_F(0x059b0ec9) /* 0.350355897 */, 17 }, /* 3138 */ { MAD_F(0x059baaf1) /* 0.350504818 */, 17 }, /* 3139 */ { MAD_F(0x059c471d) /* 0.350653756 */, 17 }, /* 3140 */ { MAD_F(0x059ce34d) /* 0.350802708 */, 17 }, /* 3141 */ { MAD_F(0x059d7f81) /* 0.350951677 */, 17 }, /* 3142 */ { MAD_F(0x059e1bba) /* 0.351100662 */, 17 }, /* 3143 */ { MAD_F(0x059eb7f7) /* 0.351249662 */, 17 }, /* 3144 */ { MAD_F(0x059f5438) /* 0.351398678 */, 17 }, /* 3145 */ { MAD_F(0x059ff07e) /* 0.351547710 */, 17 }, /* 3146 */ { MAD_F(0x05a08cc7) /* 0.351696758 */, 17 }, /* 3147 */ { MAD_F(0x05a12915) /* 0.351845821 */, 17 }, /* 3148 */ { MAD_F(0x05a1c567) /* 0.351994901 */, 17 }, /* 3149 */ { MAD_F(0x05a261be) /* 0.352143996 */, 17 }, /* 3150 */ { MAD_F(0x05a2fe18) /* 0.352293107 */, 17 }, /* 3151 */ { MAD_F(0x05a39a77) /* 0.352442233 */, 17 }, /* 3152 */ { MAD_F(0x05a436da) /* 0.352591376 */, 17 }, /* 3153 */ { MAD_F(0x05a4d342) /* 0.352740534 */, 17 }, /* 3154 */ { MAD_F(0x05a56fad) /* 0.352889708 */, 17 }, /* 3155 */ { MAD_F(0x05a60c1d) /* 0.353038898 */, 17 }, /* 3156 */ { MAD_F(0x05a6a891) /* 0.353188103 */, 17 }, /* 3157 */ { MAD_F(0x05a7450a) /* 0.353337325 */, 17 }, /* 3158 */ { MAD_F(0x05a7e186) /* 0.353486562 */, 17 }, /* 3159 */ { MAD_F(0x05a87e07) /* 0.353635814 */, 17 }, /* 3160 */ { MAD_F(0x05a91a8c) /* 0.353785083 */, 17 }, /* 3161 */ { MAD_F(0x05a9b715) /* 0.353934367 */, 17 }, /* 3162 */ { MAD_F(0x05aa53a2) /* 0.354083667 */, 17 }, /* 3163 */ { MAD_F(0x05aaf034) /* 0.354232983 */, 17 }, /* 3164 */ { MAD_F(0x05ab8cca) /* 0.354382314 */, 17 }, /* 3165 */ { MAD_F(0x05ac2964) /* 0.354531662 */, 17 }, /* 3166 */ { MAD_F(0x05acc602) /* 0.354681025 */, 17 }, /* 3167 */ { MAD_F(0x05ad62a5) /* 0.354830403 */, 17 }, /* 3168 */ { MAD_F(0x05adff4c) /* 0.354979798 */, 17 }, /* 3169 */ { MAD_F(0x05ae9bf7) /* 0.355129208 */, 17 }, /* 3170 */ { MAD_F(0x05af38a6) /* 0.355278634 */, 17 }, /* 3171 */ { MAD_F(0x05afd559) /* 0.355428075 */, 17 }, /* 3172 */ { MAD_F(0x05b07211) /* 0.355577533 */, 17 }, /* 3173 */ { MAD_F(0x05b10ecd) /* 0.355727006 */, 17 }, /* 3174 */ { MAD_F(0x05b1ab8d) /* 0.355876494 */, 17 }, /* 3175 */ { MAD_F(0x05b24851) /* 0.356025999 */, 17 }, /* 3176 */ { MAD_F(0x05b2e51a) /* 0.356175519 */, 17 }, /* 3177 */ { MAD_F(0x05b381e6) /* 0.356325054 */, 17 }, /* 3178 */ { MAD_F(0x05b41eb7) /* 0.356474606 */, 17 }, /* 3179 */ { MAD_F(0x05b4bb8c) /* 0.356624173 */, 17 }, /* 3180 */ { MAD_F(0x05b55866) /* 0.356773756 */, 17 }, /* 3181 */ { MAD_F(0x05b5f543) /* 0.356923354 */, 17 }, /* 3182 */ { MAD_F(0x05b69225) /* 0.357072969 */, 17 }, /* 3183 */ { MAD_F(0x05b72f0b) /* 0.357222598 */, 17 }, /* 3184 */ { MAD_F(0x05b7cbf5) /* 0.357372244 */, 17 }, /* 3185 */ { MAD_F(0x05b868e3) /* 0.357521905 */, 17 }, /* 3186 */ { MAD_F(0x05b905d6) /* 0.357671582 */, 17 }, /* 3187 */ { MAD_F(0x05b9a2cd) /* 0.357821275 */, 17 }, /* 3188 */ { MAD_F(0x05ba3fc8) /* 0.357970983 */, 17 }, /* 3189 */ { MAD_F(0x05badcc7) /* 0.358120707 */, 17 }, /* 3190 */ { MAD_F(0x05bb79ca) /* 0.358270446 */, 17 }, /* 3191 */ { MAD_F(0x05bc16d2) /* 0.358420201 */, 17 }, /* 3192 */ { MAD_F(0x05bcb3de) /* 0.358569972 */, 17 }, /* 3193 */ { MAD_F(0x05bd50ee) /* 0.358719758 */, 17 }, /* 3194 */ { MAD_F(0x05bdee02) /* 0.358869560 */, 17 }, /* 3195 */ { MAD_F(0x05be8b1a) /* 0.359019378 */, 17 }, /* 3196 */ { MAD_F(0x05bf2837) /* 0.359169211 */, 17 }, /* 3197 */ { MAD_F(0x05bfc558) /* 0.359319060 */, 17 }, /* 3198 */ { MAD_F(0x05c0627d) /* 0.359468925 */, 17 }, /* 3199 */ { MAD_F(0x05c0ffa6) /* 0.359618805 */, 17 }, /* 3200 */ { MAD_F(0x05c19cd3) /* 0.359768701 */, 17 }, /* 3201 */ { MAD_F(0x05c23a05) /* 0.359918612 */, 17 }, /* 3202 */ { MAD_F(0x05c2d73a) /* 0.360068540 */, 17 }, /* 3203 */ { MAD_F(0x05c37474) /* 0.360218482 */, 17 }, /* 3204 */ { MAD_F(0x05c411b2) /* 0.360368440 */, 17 }, /* 3205 */ { MAD_F(0x05c4aef5) /* 0.360518414 */, 17 }, /* 3206 */ { MAD_F(0x05c54c3b) /* 0.360668404 */, 17 }, /* 3207 */ { MAD_F(0x05c5e986) /* 0.360818409 */, 17 }, /* 3208 */ { MAD_F(0x05c686d5) /* 0.360968429 */, 17 }, /* 3209 */ { MAD_F(0x05c72428) /* 0.361118466 */, 17 }, /* 3210 */ { MAD_F(0x05c7c17f) /* 0.361268517 */, 17 }, /* 3211 */ { MAD_F(0x05c85eda) /* 0.361418585 */, 17 }, /* 3212 */ { MAD_F(0x05c8fc3a) /* 0.361568668 */, 17 }, /* 3213 */ { MAD_F(0x05c9999e) /* 0.361718766 */, 17 }, /* 3214 */ { MAD_F(0x05ca3706) /* 0.361868881 */, 17 }, /* 3215 */ { MAD_F(0x05cad472) /* 0.362019010 */, 17 }, /* 3216 */ { MAD_F(0x05cb71e2) /* 0.362169156 */, 17 }, /* 3217 */ { MAD_F(0x05cc0f57) /* 0.362319316 */, 17 }, /* 3218 */ { MAD_F(0x05ccaccf) /* 0.362469493 */, 17 }, /* 3219 */ { MAD_F(0x05cd4a4c) /* 0.362619685 */, 17 }, /* 3220 */ { MAD_F(0x05cde7cd) /* 0.362769892 */, 17 }, /* 3221 */ { MAD_F(0x05ce8552) /* 0.362920115 */, 17 }, /* 3222 */ { MAD_F(0x05cf22dc) /* 0.363070354 */, 17 }, /* 3223 */ { MAD_F(0x05cfc069) /* 0.363220608 */, 17 }, /* 3224 */ { MAD_F(0x05d05dfb) /* 0.363370878 */, 17 }, /* 3225 */ { MAD_F(0x05d0fb91) /* 0.363521163 */, 17 }, /* 3226 */ { MAD_F(0x05d1992b) /* 0.363671464 */, 17 }, /* 3227 */ { MAD_F(0x05d236c9) /* 0.363821780 */, 17 }, /* 3228 */ { MAD_F(0x05d2d46c) /* 0.363972112 */, 17 }, /* 3229 */ { MAD_F(0x05d37212) /* 0.364122459 */, 17 }, /* 3230 */ { MAD_F(0x05d40fbd) /* 0.364272822 */, 17 }, /* 3231 */ { MAD_F(0x05d4ad6c) /* 0.364423200 */, 17 }, /* 3232 */ { MAD_F(0x05d54b1f) /* 0.364573594 */, 17 }, /* 3233 */ { MAD_F(0x05d5e8d6) /* 0.364724004 */, 17 }, /* 3234 */ { MAD_F(0x05d68691) /* 0.364874429 */, 17 }, /* 3235 */ { MAD_F(0x05d72451) /* 0.365024869 */, 17 }, /* 3236 */ { MAD_F(0x05d7c215) /* 0.365175325 */, 17 }, /* 3237 */ { MAD_F(0x05d85fdc) /* 0.365325796 */, 17 }, /* 3238 */ { MAD_F(0x05d8fda8) /* 0.365476283 */, 17 }, /* 3239 */ { MAD_F(0x05d99b79) /* 0.365626786 */, 17 }, /* 3240 */ { MAD_F(0x05da394d) /* 0.365777304 */, 17 }, /* 3241 */ { MAD_F(0x05dad726) /* 0.365927837 */, 17 }, /* 3242 */ { MAD_F(0x05db7502) /* 0.366078386 */, 17 }, /* 3243 */ { MAD_F(0x05dc12e3) /* 0.366228950 */, 17 }, /* 3244 */ { MAD_F(0x05dcb0c8) /* 0.366379530 */, 17 }, /* 3245 */ { MAD_F(0x05dd4eb1) /* 0.366530125 */, 17 }, /* 3246 */ { MAD_F(0x05ddec9e) /* 0.366680736 */, 17 }, /* 3247 */ { MAD_F(0x05de8a90) /* 0.366831362 */, 17 }, /* 3248 */ { MAD_F(0x05df2885) /* 0.366982004 */, 17 }, /* 3249 */ { MAD_F(0x05dfc67f) /* 0.367132661 */, 17 }, /* 3250 */ { MAD_F(0x05e0647d) /* 0.367283334 */, 17 }, /* 3251 */ { MAD_F(0x05e1027f) /* 0.367434022 */, 17 }, /* 3252 */ { MAD_F(0x05e1a085) /* 0.367584725 */, 17 }, /* 3253 */ { MAD_F(0x05e23e8f) /* 0.367735444 */, 17 }, /* 3254 */ { MAD_F(0x05e2dc9e) /* 0.367886179 */, 17 }, /* 3255 */ { MAD_F(0x05e37ab0) /* 0.368036929 */, 17 }, /* 3256 */ { MAD_F(0x05e418c7) /* 0.368187694 */, 17 }, /* 3257 */ { MAD_F(0x05e4b6e2) /* 0.368338475 */, 17 }, /* 3258 */ { MAD_F(0x05e55501) /* 0.368489271 */, 17 }, /* 3259 */ { MAD_F(0x05e5f324) /* 0.368640082 */, 17 }, /* 3260 */ { MAD_F(0x05e6914c) /* 0.368790909 */, 17 }, /* 3261 */ { MAD_F(0x05e72f77) /* 0.368941752 */, 17 }, /* 3262 */ { MAD_F(0x05e7cda7) /* 0.369092610 */, 17 }, /* 3263 */ { MAD_F(0x05e86bda) /* 0.369243483 */, 17 }, /* 3264 */ { MAD_F(0x05e90a12) /* 0.369394372 */, 17 }, /* 3265 */ { MAD_F(0x05e9a84e) /* 0.369545276 */, 17 }, /* 3266 */ { MAD_F(0x05ea468e) /* 0.369696195 */, 17 }, /* 3267 */ { MAD_F(0x05eae4d3) /* 0.369847130 */, 17 }, /* 3268 */ { MAD_F(0x05eb831b) /* 0.369998080 */, 17 }, /* 3269 */ { MAD_F(0x05ec2168) /* 0.370149046 */, 17 }, /* 3270 */ { MAD_F(0x05ecbfb8) /* 0.370300027 */, 17 }, /* 3271 */ { MAD_F(0x05ed5e0d) /* 0.370451024 */, 17 }, /* 3272 */ { MAD_F(0x05edfc66) /* 0.370602036 */, 17 }, /* 3273 */ { MAD_F(0x05ee9ac3) /* 0.370753063 */, 17 }, /* 3274 */ { MAD_F(0x05ef3924) /* 0.370904105 */, 17 }, /* 3275 */ { MAD_F(0x05efd78a) /* 0.371055163 */, 17 }, /* 3276 */ { MAD_F(0x05f075f3) /* 0.371206237 */, 17 }, /* 3277 */ { MAD_F(0x05f11461) /* 0.371357326 */, 17 }, /* 3278 */ { MAD_F(0x05f1b2d3) /* 0.371508430 */, 17 }, /* 3279 */ { MAD_F(0x05f25148) /* 0.371659549 */, 17 }, /* 3280 */ { MAD_F(0x05f2efc2) /* 0.371810684 */, 17 }, /* 3281 */ { MAD_F(0x05f38e40) /* 0.371961834 */, 17 }, /* 3282 */ { MAD_F(0x05f42cc3) /* 0.372113000 */, 17 }, /* 3283 */ { MAD_F(0x05f4cb49) /* 0.372264181 */, 17 }, /* 3284 */ { MAD_F(0x05f569d3) /* 0.372415377 */, 17 }, /* 3285 */ { MAD_F(0x05f60862) /* 0.372566589 */, 17 }, /* 3286 */ { MAD_F(0x05f6a6f5) /* 0.372717816 */, 17 }, /* 3287 */ { MAD_F(0x05f7458b) /* 0.372869058 */, 17 }, /* 3288 */ { MAD_F(0x05f7e426) /* 0.373020316 */, 17 }, /* 3289 */ { MAD_F(0x05f882c5) /* 0.373171589 */, 17 }, /* 3290 */ { MAD_F(0x05f92169) /* 0.373322877 */, 17 }, /* 3291 */ { MAD_F(0x05f9c010) /* 0.373474181 */, 17 }, /* 3292 */ { MAD_F(0x05fa5ebb) /* 0.373625500 */, 17 }, /* 3293 */ { MAD_F(0x05fafd6b) /* 0.373776834 */, 17 }, /* 3294 */ { MAD_F(0x05fb9c1e) /* 0.373928184 */, 17 }, /* 3295 */ { MAD_F(0x05fc3ad6) /* 0.374079549 */, 17 }, /* 3296 */ { MAD_F(0x05fcd992) /* 0.374230929 */, 17 }, /* 3297 */ { MAD_F(0x05fd7852) /* 0.374382325 */, 17 }, /* 3298 */ { MAD_F(0x05fe1716) /* 0.374533735 */, 17 }, /* 3299 */ { MAD_F(0x05feb5de) /* 0.374685162 */, 17 }, /* 3300 */ { MAD_F(0x05ff54aa) /* 0.374836603 */, 17 }, /* 3301 */ { MAD_F(0x05fff37b) /* 0.374988060 */, 17 }, /* 3302 */ { MAD_F(0x0600924f) /* 0.375139532 */, 17 }, /* 3303 */ { MAD_F(0x06013128) /* 0.375291019 */, 17 }, /* 3304 */ { MAD_F(0x0601d004) /* 0.375442522 */, 17 }, /* 3305 */ { MAD_F(0x06026ee5) /* 0.375594040 */, 17 }, /* 3306 */ { MAD_F(0x06030dca) /* 0.375745573 */, 17 }, /* 3307 */ { MAD_F(0x0603acb3) /* 0.375897122 */, 17 }, /* 3308 */ { MAD_F(0x06044ba0) /* 0.376048685 */, 17 }, /* 3309 */ { MAD_F(0x0604ea91) /* 0.376200265 */, 17 }, /* 3310 */ { MAD_F(0x06058987) /* 0.376351859 */, 17 }, /* 3311 */ { MAD_F(0x06062880) /* 0.376503468 */, 17 }, /* 3312 */ { MAD_F(0x0606c77d) /* 0.376655093 */, 17 }, /* 3313 */ { MAD_F(0x0607667f) /* 0.376806733 */, 17 }, /* 3314 */ { MAD_F(0x06080585) /* 0.376958389 */, 17 }, /* 3315 */ { MAD_F(0x0608a48f) /* 0.377110059 */, 17 }, /* 3316 */ { MAD_F(0x0609439c) /* 0.377261745 */, 17 }, /* 3317 */ { MAD_F(0x0609e2ae) /* 0.377413446 */, 17 }, /* 3318 */ { MAD_F(0x060a81c4) /* 0.377565163 */, 17 }, /* 3319 */ { MAD_F(0x060b20df) /* 0.377716894 */, 17 }, /* 3320 */ { MAD_F(0x060bbffd) /* 0.377868641 */, 17 }, /* 3321 */ { MAD_F(0x060c5f1f) /* 0.378020403 */, 17 }, /* 3322 */ { MAD_F(0x060cfe46) /* 0.378172181 */, 17 }, /* 3323 */ { MAD_F(0x060d9d70) /* 0.378323973 */, 17 }, /* 3324 */ { MAD_F(0x060e3c9f) /* 0.378475781 */, 17 }, /* 3325 */ { MAD_F(0x060edbd1) /* 0.378627604 */, 17 }, /* 3326 */ { MAD_F(0x060f7b08) /* 0.378779442 */, 17 }, /* 3327 */ { MAD_F(0x06101a43) /* 0.378931296 */, 17 }, /* 3328 */ { MAD_F(0x0610b982) /* 0.379083164 */, 17 }, /* 3329 */ { MAD_F(0x061158c5) /* 0.379235048 */, 17 }, /* 3330 */ { MAD_F(0x0611f80c) /* 0.379386947 */, 17 }, /* 3331 */ { MAD_F(0x06129757) /* 0.379538862 */, 17 }, /* 3332 */ { MAD_F(0x061336a6) /* 0.379690791 */, 17 }, /* 3333 */ { MAD_F(0x0613d5fa) /* 0.379842736 */, 17 }, /* 3334 */ { MAD_F(0x06147551) /* 0.379994696 */, 17 }, /* 3335 */ { MAD_F(0x061514ad) /* 0.380146671 */, 17 }, /* 3336 */ { MAD_F(0x0615b40c) /* 0.380298661 */, 17 }, /* 3337 */ { MAD_F(0x06165370) /* 0.380450666 */, 17 }, /* 3338 */ { MAD_F(0x0616f2d8) /* 0.380602687 */, 17 }, /* 3339 */ { MAD_F(0x06179243) /* 0.380754723 */, 17 }, /* 3340 */ { MAD_F(0x061831b3) /* 0.380906774 */, 17 }, /* 3341 */ { MAD_F(0x0618d127) /* 0.381058840 */, 17 }, /* 3342 */ { MAD_F(0x0619709f) /* 0.381210921 */, 17 }, /* 3343 */ { MAD_F(0x061a101b) /* 0.381363018 */, 17 }, /* 3344 */ { MAD_F(0x061aaf9c) /* 0.381515130 */, 17 }, /* 3345 */ { MAD_F(0x061b4f20) /* 0.381667257 */, 17 }, /* 3346 */ { MAD_F(0x061beea8) /* 0.381819399 */, 17 }, /* 3347 */ { MAD_F(0x061c8e34) /* 0.381971556 */, 17 }, /* 3348 */ { MAD_F(0x061d2dc5) /* 0.382123728 */, 17 }, /* 3349 */ { MAD_F(0x061dcd59) /* 0.382275916 */, 17 }, /* 3350 */ { MAD_F(0x061e6cf2) /* 0.382428118 */, 17 }, /* 3351 */ { MAD_F(0x061f0c8f) /* 0.382580336 */, 17 }, /* 3352 */ { MAD_F(0x061fac2f) /* 0.382732569 */, 17 }, /* 3353 */ { MAD_F(0x06204bd4) /* 0.382884817 */, 17 }, /* 3354 */ { MAD_F(0x0620eb7d) /* 0.383037080 */, 17 }, /* 3355 */ { MAD_F(0x06218b2a) /* 0.383189358 */, 17 }, /* 3356 */ { MAD_F(0x06222adb) /* 0.383341652 */, 17 }, /* 3357 */ { MAD_F(0x0622ca90) /* 0.383493960 */, 17 }, /* 3358 */ { MAD_F(0x06236a49) /* 0.383646284 */, 17 }, /* 3359 */ { MAD_F(0x06240a06) /* 0.383798623 */, 17 }, /* 3360 */ { MAD_F(0x0624a9c7) /* 0.383950977 */, 17 }, /* 3361 */ { MAD_F(0x0625498d) /* 0.384103346 */, 17 }, /* 3362 */ { MAD_F(0x0625e956) /* 0.384255730 */, 17 }, /* 3363 */ { MAD_F(0x06268923) /* 0.384408129 */, 17 }, /* 3364 */ { MAD_F(0x062728f5) /* 0.384560544 */, 17 }, /* 3365 */ { MAD_F(0x0627c8ca) /* 0.384712973 */, 17 }, /* 3366 */ { MAD_F(0x062868a4) /* 0.384865418 */, 17 }, /* 3367 */ { MAD_F(0x06290881) /* 0.385017878 */, 17 }, /* 3368 */ { MAD_F(0x0629a863) /* 0.385170352 */, 17 }, /* 3369 */ { MAD_F(0x062a4849) /* 0.385322842 */, 17 }, /* 3370 */ { MAD_F(0x062ae832) /* 0.385475347 */, 17 }, /* 3371 */ { MAD_F(0x062b8820) /* 0.385627867 */, 17 }, /* 3372 */ { MAD_F(0x062c2812) /* 0.385780402 */, 17 }, /* 3373 */ { MAD_F(0x062cc808) /* 0.385932953 */, 17 }, /* 3374 */ { MAD_F(0x062d6802) /* 0.386085518 */, 17 }, /* 3375 */ { MAD_F(0x062e0800) /* 0.386238098 */, 17 }, /* 3376 */ { MAD_F(0x062ea802) /* 0.386390694 */, 17 }, /* 3377 */ { MAD_F(0x062f4808) /* 0.386543304 */, 17 }, /* 3378 */ { MAD_F(0x062fe812) /* 0.386695930 */, 17 }, /* 3379 */ { MAD_F(0x06308820) /* 0.386848570 */, 17 }, /* 3380 */ { MAD_F(0x06312832) /* 0.387001226 */, 17 }, /* 3381 */ { MAD_F(0x0631c849) /* 0.387153897 */, 17 }, /* 3382 */ { MAD_F(0x06326863) /* 0.387306582 */, 17 }, /* 3383 */ { MAD_F(0x06330881) /* 0.387459283 */, 17 }, /* 3384 */ { MAD_F(0x0633a8a3) /* 0.387611999 */, 17 }, /* 3385 */ { MAD_F(0x063448ca) /* 0.387764730 */, 17 }, /* 3386 */ { MAD_F(0x0634e8f4) /* 0.387917476 */, 17 }, /* 3387 */ { MAD_F(0x06358923) /* 0.388070237 */, 17 }, /* 3388 */ { MAD_F(0x06362955) /* 0.388223013 */, 17 }, /* 3389 */ { MAD_F(0x0636c98c) /* 0.388375804 */, 17 }, /* 3390 */ { MAD_F(0x063769c6) /* 0.388528610 */, 17 }, /* 3391 */ { MAD_F(0x06380a05) /* 0.388681431 */, 17 }, /* 3392 */ { MAD_F(0x0638aa48) /* 0.388834268 */, 17 }, /* 3393 */ { MAD_F(0x06394a8e) /* 0.388987119 */, 17 }, /* 3394 */ { MAD_F(0x0639ead9) /* 0.389139985 */, 17 }, /* 3395 */ { MAD_F(0x063a8b28) /* 0.389292866 */, 17 }, /* 3396 */ { MAD_F(0x063b2b7b) /* 0.389445762 */, 17 }, /* 3397 */ { MAD_F(0x063bcbd1) /* 0.389598674 */, 17 }, /* 3398 */ { MAD_F(0x063c6c2c) /* 0.389751600 */, 17 }, /* 3399 */ { MAD_F(0x063d0c8b) /* 0.389904541 */, 17 }, /* 3400 */ { MAD_F(0x063dacee) /* 0.390057497 */, 17 }, /* 3401 */ { MAD_F(0x063e4d55) /* 0.390210468 */, 17 }, /* 3402 */ { MAD_F(0x063eedc0) /* 0.390363455 */, 17 }, /* 3403 */ { MAD_F(0x063f8e2f) /* 0.390516456 */, 17 }, /* 3404 */ { MAD_F(0x06402ea2) /* 0.390669472 */, 17 }, /* 3405 */ { MAD_F(0x0640cf19) /* 0.390822503 */, 17 }, /* 3406 */ { MAD_F(0x06416f94) /* 0.390975549 */, 17 }, /* 3407 */ { MAD_F(0x06421013) /* 0.391128611 */, 17 }, /* 3408 */ { MAD_F(0x0642b096) /* 0.391281687 */, 17 }, /* 3409 */ { MAD_F(0x0643511d) /* 0.391434778 */, 17 }, /* 3410 */ { MAD_F(0x0643f1a8) /* 0.391587884 */, 17 }, /* 3411 */ { MAD_F(0x06449237) /* 0.391741005 */, 17 }, /* 3412 */ { MAD_F(0x064532ca) /* 0.391894141 */, 17 }, /* 3413 */ { MAD_F(0x0645d361) /* 0.392047292 */, 17 }, /* 3414 */ { MAD_F(0x064673fc) /* 0.392200458 */, 17 }, /* 3415 */ { MAD_F(0x0647149c) /* 0.392353638 */, 17 }, /* 3416 */ { MAD_F(0x0647b53f) /* 0.392506834 */, 17 }, /* 3417 */ { MAD_F(0x064855e6) /* 0.392660045 */, 17 }, /* 3418 */ { MAD_F(0x0648f691) /* 0.392813271 */, 17 }, /* 3419 */ { MAD_F(0x06499740) /* 0.392966511 */, 17 }, /* 3420 */ { MAD_F(0x064a37f4) /* 0.393119767 */, 17 }, /* 3421 */ { MAD_F(0x064ad8ab) /* 0.393273038 */, 17 }, /* 3422 */ { MAD_F(0x064b7966) /* 0.393426323 */, 17 }, /* 3423 */ { MAD_F(0x064c1a25) /* 0.393579623 */, 17 }, /* 3424 */ { MAD_F(0x064cbae9) /* 0.393732939 */, 17 }, /* 3425 */ { MAD_F(0x064d5bb0) /* 0.393886269 */, 17 }, /* 3426 */ { MAD_F(0x064dfc7b) /* 0.394039614 */, 17 }, /* 3427 */ { MAD_F(0x064e9d4b) /* 0.394192974 */, 17 }, /* 3428 */ { MAD_F(0x064f3e1e) /* 0.394346349 */, 17 }, /* 3429 */ { MAD_F(0x064fdef5) /* 0.394499739 */, 17 }, /* 3430 */ { MAD_F(0x06507fd0) /* 0.394653144 */, 17 }, /* 3431 */ { MAD_F(0x065120b0) /* 0.394806564 */, 17 }, /* 3432 */ { MAD_F(0x0651c193) /* 0.394959999 */, 17 }, /* 3433 */ { MAD_F(0x0652627a) /* 0.395113448 */, 17 }, /* 3434 */ { MAD_F(0x06530366) /* 0.395266913 */, 17 }, /* 3435 */ { MAD_F(0x0653a455) /* 0.395420392 */, 17 }, /* 3436 */ { MAD_F(0x06544548) /* 0.395573886 */, 17 }, /* 3437 */ { MAD_F(0x0654e640) /* 0.395727395 */, 17 }, /* 3438 */ { MAD_F(0x0655873b) /* 0.395880919 */, 17 }, /* 3439 */ { MAD_F(0x0656283a) /* 0.396034458 */, 17 }, /* 3440 */ { MAD_F(0x0656c93d) /* 0.396188012 */, 17 }, /* 3441 */ { MAD_F(0x06576a45) /* 0.396341581 */, 17 }, /* 3442 */ { MAD_F(0x06580b50) /* 0.396495164 */, 17 }, /* 3443 */ { MAD_F(0x0658ac5f) /* 0.396648763 */, 17 }, /* 3444 */ { MAD_F(0x06594d73) /* 0.396802376 */, 17 }, /* 3445 */ { MAD_F(0x0659ee8a) /* 0.396956004 */, 17 }, /* 3446 */ { MAD_F(0x065a8fa5) /* 0.397109647 */, 17 }, /* 3447 */ { MAD_F(0x065b30c4) /* 0.397263305 */, 17 }, /* 3448 */ { MAD_F(0x065bd1e7) /* 0.397416978 */, 17 }, /* 3449 */ { MAD_F(0x065c730f) /* 0.397570666 */, 17 }, /* 3450 */ { MAD_F(0x065d143a) /* 0.397724368 */, 17 }, /* 3451 */ { MAD_F(0x065db569) /* 0.397878085 */, 17 }, /* 3452 */ { MAD_F(0x065e569c) /* 0.398031818 */, 17 }, /* 3453 */ { MAD_F(0x065ef7d3) /* 0.398185565 */, 17 }, /* 3454 */ { MAD_F(0x065f990e) /* 0.398339326 */, 17 }, /* 3455 */ { MAD_F(0x06603a4e) /* 0.398493103 */, 17 }, /* 3456 */ { MAD_F(0x0660db91) /* 0.398646895 */, 17 }, /* 3457 */ { MAD_F(0x06617cd8) /* 0.398800701 */, 17 }, /* 3458 */ { MAD_F(0x06621e23) /* 0.398954522 */, 17 }, /* 3459 */ { MAD_F(0x0662bf72) /* 0.399108358 */, 17 }, /* 3460 */ { MAD_F(0x066360c5) /* 0.399262209 */, 17 }, /* 3461 */ { MAD_F(0x0664021c) /* 0.399416075 */, 17 }, /* 3462 */ { MAD_F(0x0664a377) /* 0.399569955 */, 17 }, /* 3463 */ { MAD_F(0x066544d6) /* 0.399723851 */, 17 }, /* 3464 */ { MAD_F(0x0665e639) /* 0.399877761 */, 17 }, /* 3465 */ { MAD_F(0x066687a0) /* 0.400031686 */, 17 }, /* 3466 */ { MAD_F(0x0667290b) /* 0.400185625 */, 17 }, /* 3467 */ { MAD_F(0x0667ca79) /* 0.400339580 */, 17 }, /* 3468 */ { MAD_F(0x06686bec) /* 0.400493549 */, 17 }, /* 3469 */ { MAD_F(0x06690d63) /* 0.400647534 */, 17 }, /* 3470 */ { MAD_F(0x0669aede) /* 0.400801533 */, 17 }, /* 3471 */ { MAD_F(0x066a505d) /* 0.400955546 */, 17 }, /* 3472 */ { MAD_F(0x066af1df) /* 0.401109575 */, 17 }, /* 3473 */ { MAD_F(0x066b9366) /* 0.401263618 */, 17 }, /* 3474 */ { MAD_F(0x066c34f1) /* 0.401417676 */, 17 }, /* 3475 */ { MAD_F(0x066cd67f) /* 0.401571749 */, 17 }, /* 3476 */ { MAD_F(0x066d7812) /* 0.401725837 */, 17 }, /* 3477 */ { MAD_F(0x066e19a9) /* 0.401879939 */, 17 }, /* 3478 */ { MAD_F(0x066ebb43) /* 0.402034056 */, 17 }, /* 3479 */ { MAD_F(0x066f5ce2) /* 0.402188188 */, 17 }, /* 3480 */ { MAD_F(0x066ffe84) /* 0.402342335 */, 17 }, /* 3481 */ { MAD_F(0x0670a02a) /* 0.402496497 */, 17 }, /* 3482 */ { MAD_F(0x067141d5) /* 0.402650673 */, 17 }, /* 3483 */ { MAD_F(0x0671e383) /* 0.402804864 */, 17 }, /* 3484 */ { MAD_F(0x06728535) /* 0.402959070 */, 17 }, /* 3485 */ { MAD_F(0x067326ec) /* 0.403113291 */, 17 }, /* 3486 */ { MAD_F(0x0673c8a6) /* 0.403267526 */, 17 }, /* 3487 */ { MAD_F(0x06746a64) /* 0.403421776 */, 17 }, /* 3488 */ { MAD_F(0x06750c26) /* 0.403576041 */, 17 }, /* 3489 */ { MAD_F(0x0675adec) /* 0.403730320 */, 17 }, /* 3490 */ { MAD_F(0x06764fb6) /* 0.403884615 */, 17 }, /* 3491 */ { MAD_F(0x0676f184) /* 0.404038924 */, 17 }, /* 3492 */ { MAD_F(0x06779356) /* 0.404193247 */, 17 }, /* 3493 */ { MAD_F(0x0678352c) /* 0.404347586 */, 17 }, /* 3494 */ { MAD_F(0x0678d706) /* 0.404501939 */, 17 }, /* 3495 */ { MAD_F(0x067978e4) /* 0.404656307 */, 17 }, /* 3496 */ { MAD_F(0x067a1ac6) /* 0.404810690 */, 17 }, /* 3497 */ { MAD_F(0x067abcac) /* 0.404965087 */, 17 }, /* 3498 */ { MAD_F(0x067b5e95) /* 0.405119499 */, 17 }, /* 3499 */ { MAD_F(0x067c0083) /* 0.405273926 */, 17 }, /* 3500 */ { MAD_F(0x067ca275) /* 0.405428368 */, 17 }, /* 3501 */ { MAD_F(0x067d446a) /* 0.405582824 */, 17 }, /* 3502 */ { MAD_F(0x067de664) /* 0.405737295 */, 17 }, /* 3503 */ { MAD_F(0x067e8861) /* 0.405891781 */, 17 }, /* 3504 */ { MAD_F(0x067f2a62) /* 0.406046281 */, 17 }, /* 3505 */ { MAD_F(0x067fcc68) /* 0.406200796 */, 17 }, /* 3506 */ { MAD_F(0x06806e71) /* 0.406355326 */, 17 }, /* 3507 */ { MAD_F(0x0681107e) /* 0.406509870 */, 17 }, /* 3508 */ { MAD_F(0x0681b28f) /* 0.406664429 */, 17 }, /* 3509 */ { MAD_F(0x068254a4) /* 0.406819003 */, 17 }, /* 3510 */ { MAD_F(0x0682f6bd) /* 0.406973592 */, 17 }, /* 3511 */ { MAD_F(0x068398da) /* 0.407128195 */, 17 }, /* 3512 */ { MAD_F(0x06843afb) /* 0.407282813 */, 17 }, /* 3513 */ { MAD_F(0x0684dd20) /* 0.407437445 */, 17 }, /* 3514 */ { MAD_F(0x06857f49) /* 0.407592093 */, 17 }, /* 3515 */ { MAD_F(0x06862176) /* 0.407746754 */, 17 }, /* 3516 */ { MAD_F(0x0686c3a6) /* 0.407901431 */, 17 }, /* 3517 */ { MAD_F(0x068765db) /* 0.408056122 */, 17 }, /* 3518 */ { MAD_F(0x06880814) /* 0.408210828 */, 17 }, /* 3519 */ { MAD_F(0x0688aa50) /* 0.408365549 */, 17 }, /* 3520 */ { MAD_F(0x06894c90) /* 0.408520284 */, 17 }, /* 3521 */ { MAD_F(0x0689eed5) /* 0.408675034 */, 17 }, /* 3522 */ { MAD_F(0x068a911d) /* 0.408829798 */, 17 }, /* 3523 */ { MAD_F(0x068b3369) /* 0.408984577 */, 17 }, /* 3524 */ { MAD_F(0x068bd5b9) /* 0.409139371 */, 17 }, /* 3525 */ { MAD_F(0x068c780e) /* 0.409294180 */, 17 }, /* 3526 */ { MAD_F(0x068d1a66) /* 0.409449003 */, 17 }, /* 3527 */ { MAD_F(0x068dbcc1) /* 0.409603840 */, 17 }, /* 3528 */ { MAD_F(0x068e5f21) /* 0.409758693 */, 17 }, /* 3529 */ { MAD_F(0x068f0185) /* 0.409913560 */, 17 }, /* 3530 */ { MAD_F(0x068fa3ed) /* 0.410068441 */, 17 }, /* 3531 */ { MAD_F(0x06904658) /* 0.410223338 */, 17 }, /* 3532 */ { MAD_F(0x0690e8c8) /* 0.410378249 */, 17 }, /* 3533 */ { MAD_F(0x06918b3c) /* 0.410533174 */, 17 }, /* 3534 */ { MAD_F(0x06922db3) /* 0.410688114 */, 17 }, /* 3535 */ { MAD_F(0x0692d02e) /* 0.410843069 */, 17 }, /* 3536 */ { MAD_F(0x069372ae) /* 0.410998038 */, 17 }, /* 3537 */ { MAD_F(0x06941531) /* 0.411153022 */, 17 }, /* 3538 */ { MAD_F(0x0694b7b8) /* 0.411308021 */, 17 }, /* 3539 */ { MAD_F(0x06955a43) /* 0.411463034 */, 17 }, /* 3540 */ { MAD_F(0x0695fcd2) /* 0.411618062 */, 17 }, /* 3541 */ { MAD_F(0x06969f65) /* 0.411773104 */, 17 }, /* 3542 */ { MAD_F(0x069741fb) /* 0.411928161 */, 17 }, /* 3543 */ { MAD_F(0x0697e496) /* 0.412083232 */, 17 }, /* 3544 */ { MAD_F(0x06988735) /* 0.412238319 */, 17 }, /* 3545 */ { MAD_F(0x069929d7) /* 0.412393419 */, 17 }, /* 3546 */ { MAD_F(0x0699cc7e) /* 0.412548535 */, 17 }, /* 3547 */ { MAD_F(0x069a6f28) /* 0.412703664 */, 17 }, /* 3548 */ { MAD_F(0x069b11d6) /* 0.412858809 */, 17 }, /* 3549 */ { MAD_F(0x069bb489) /* 0.413013968 */, 17 }, /* 3550 */ { MAD_F(0x069c573f) /* 0.413169142 */, 17 }, /* 3551 */ { MAD_F(0x069cf9f9) /* 0.413324330 */, 17 }, /* 3552 */ { MAD_F(0x069d9cb7) /* 0.413479532 */, 17 }, /* 3553 */ { MAD_F(0x069e3f78) /* 0.413634750 */, 17 }, /* 3554 */ { MAD_F(0x069ee23e) /* 0.413789982 */, 17 }, /* 3555 */ { MAD_F(0x069f8508) /* 0.413945228 */, 17 }, /* 3556 */ { MAD_F(0x06a027d5) /* 0.414100489 */, 17 }, /* 3557 */ { MAD_F(0x06a0caa7) /* 0.414255765 */, 17 }, /* 3558 */ { MAD_F(0x06a16d7c) /* 0.414411055 */, 17 }, /* 3559 */ { MAD_F(0x06a21055) /* 0.414566359 */, 17 }, /* 3560 */ { MAD_F(0x06a2b333) /* 0.414721679 */, 17 }, /* 3561 */ { MAD_F(0x06a35614) /* 0.414877012 */, 17 }, /* 3562 */ { MAD_F(0x06a3f8f9) /* 0.415032361 */, 17 }, /* 3563 */ { MAD_F(0x06a49be2) /* 0.415187723 */, 17 }, /* 3564 */ { MAD_F(0x06a53ece) /* 0.415343101 */, 17 }, /* 3565 */ { MAD_F(0x06a5e1bf) /* 0.415498493 */, 17 }, /* 3566 */ { MAD_F(0x06a684b4) /* 0.415653899 */, 17 }, /* 3567 */ { MAD_F(0x06a727ac) /* 0.415809320 */, 17 }, /* 3568 */ { MAD_F(0x06a7caa9) /* 0.415964756 */, 17 }, /* 3569 */ { MAD_F(0x06a86da9) /* 0.416120206 */, 17 }, /* 3570 */ { MAD_F(0x06a910ad) /* 0.416275670 */, 17 }, /* 3571 */ { MAD_F(0x06a9b3b5) /* 0.416431149 */, 17 }, /* 3572 */ { MAD_F(0x06aa56c1) /* 0.416586643 */, 17 }, /* 3573 */ { MAD_F(0x06aaf9d1) /* 0.416742151 */, 17 }, /* 3574 */ { MAD_F(0x06ab9ce5) /* 0.416897673 */, 17 }, /* 3575 */ { MAD_F(0x06ac3ffc) /* 0.417053210 */, 17 }, /* 3576 */ { MAD_F(0x06ace318) /* 0.417208762 */, 17 }, /* 3577 */ { MAD_F(0x06ad8637) /* 0.417364328 */, 17 }, /* 3578 */ { MAD_F(0x06ae295b) /* 0.417519909 */, 17 }, /* 3579 */ { MAD_F(0x06aecc82) /* 0.417675504 */, 17 }, /* 3580 */ { MAD_F(0x06af6fad) /* 0.417831113 */, 17 }, /* 3581 */ { MAD_F(0x06b012dc) /* 0.417986737 */, 17 }, /* 3582 */ { MAD_F(0x06b0b60f) /* 0.418142376 */, 17 }, /* 3583 */ { MAD_F(0x06b15946) /* 0.418298029 */, 17 }, /* 3584 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 17 }, /* 3585 */ { MAD_F(0x06b29fbf) /* 0.418609378 */, 17 }, /* 3586 */ { MAD_F(0x06b34302) /* 0.418765075 */, 17 }, /* 3587 */ { MAD_F(0x06b3e648) /* 0.418920786 */, 17 }, /* 3588 */ { MAD_F(0x06b48992) /* 0.419076511 */, 17 }, /* 3589 */ { MAD_F(0x06b52ce0) /* 0.419232251 */, 17 }, /* 3590 */ { MAD_F(0x06b5d032) /* 0.419388005 */, 17 }, /* 3591 */ { MAD_F(0x06b67388) /* 0.419543774 */, 17 }, /* 3592 */ { MAD_F(0x06b716e2) /* 0.419699557 */, 17 }, /* 3593 */ { MAD_F(0x06b7ba3f) /* 0.419855355 */, 17 }, /* 3594 */ { MAD_F(0x06b85da1) /* 0.420011167 */, 17 }, /* 3595 */ { MAD_F(0x06b90106) /* 0.420166994 */, 17 }, /* 3596 */ { MAD_F(0x06b9a470) /* 0.420322835 */, 17 }, /* 3597 */ { MAD_F(0x06ba47dd) /* 0.420478690 */, 17 }, /* 3598 */ { MAD_F(0x06baeb4e) /* 0.420634560 */, 17 }, /* 3599 */ { MAD_F(0x06bb8ec3) /* 0.420790445 */, 17 }, /* 3600 */ { MAD_F(0x06bc323b) /* 0.420946343 */, 17 }, /* 3601 */ { MAD_F(0x06bcd5b8) /* 0.421102257 */, 17 }, /* 3602 */ { MAD_F(0x06bd7939) /* 0.421258184 */, 17 }, /* 3603 */ { MAD_F(0x06be1cbd) /* 0.421414127 */, 17 }, /* 3604 */ { MAD_F(0x06bec045) /* 0.421570083 */, 17 }, /* 3605 */ { MAD_F(0x06bf63d1) /* 0.421726054 */, 17 }, /* 3606 */ { MAD_F(0x06c00761) /* 0.421882040 */, 17 }, /* 3607 */ { MAD_F(0x06c0aaf5) /* 0.422038039 */, 17 }, /* 3608 */ { MAD_F(0x06c14e8d) /* 0.422194054 */, 17 }, /* 3609 */ { MAD_F(0x06c1f229) /* 0.422350082 */, 17 }, /* 3610 */ { MAD_F(0x06c295c8) /* 0.422506125 */, 17 }, /* 3611 */ { MAD_F(0x06c3396c) /* 0.422662183 */, 17 }, /* 3612 */ { MAD_F(0x06c3dd13) /* 0.422818255 */, 17 }, /* 3613 */ { MAD_F(0x06c480be) /* 0.422974341 */, 17 }, /* 3614 */ { MAD_F(0x06c5246d) /* 0.423130442 */, 17 }, /* 3615 */ { MAD_F(0x06c5c820) /* 0.423286557 */, 17 }, /* 3616 */ { MAD_F(0x06c66bd6) /* 0.423442686 */, 17 }, /* 3617 */ { MAD_F(0x06c70f91) /* 0.423598830 */, 17 }, /* 3618 */ { MAD_F(0x06c7b34f) /* 0.423754988 */, 17 }, /* 3619 */ { MAD_F(0x06c85712) /* 0.423911161 */, 17 }, /* 3620 */ { MAD_F(0x06c8fad8) /* 0.424067348 */, 17 }, /* 3621 */ { MAD_F(0x06c99ea2) /* 0.424223550 */, 17 }, /* 3622 */ { MAD_F(0x06ca4270) /* 0.424379765 */, 17 }, /* 3623 */ { MAD_F(0x06cae641) /* 0.424535996 */, 17 }, /* 3624 */ { MAD_F(0x06cb8a17) /* 0.424692240 */, 17 }, /* 3625 */ { MAD_F(0x06cc2df0) /* 0.424848499 */, 17 }, /* 3626 */ { MAD_F(0x06ccd1ce) /* 0.425004772 */, 17 }, /* 3627 */ { MAD_F(0x06cd75af) /* 0.425161060 */, 17 }, /* 3628 */ { MAD_F(0x06ce1994) /* 0.425317362 */, 17 }, /* 3629 */ { MAD_F(0x06cebd7d) /* 0.425473678 */, 17 }, /* 3630 */ { MAD_F(0x06cf6169) /* 0.425630009 */, 17 }, /* 3631 */ { MAD_F(0x06d0055a) /* 0.425786354 */, 17 }, /* 3632 */ { MAD_F(0x06d0a94e) /* 0.425942714 */, 17 }, /* 3633 */ { MAD_F(0x06d14d47) /* 0.426099088 */, 17 }, /* 3634 */ { MAD_F(0x06d1f143) /* 0.426255476 */, 17 }, /* 3635 */ { MAD_F(0x06d29543) /* 0.426411878 */, 17 }, /* 3636 */ { MAD_F(0x06d33947) /* 0.426568295 */, 17 }, /* 3637 */ { MAD_F(0x06d3dd4e) /* 0.426724726 */, 17 }, /* 3638 */ { MAD_F(0x06d4815a) /* 0.426881172 */, 17 }, /* 3639 */ { MAD_F(0x06d52569) /* 0.427037632 */, 17 }, /* 3640 */ { MAD_F(0x06d5c97c) /* 0.427194106 */, 17 }, /* 3641 */ { MAD_F(0x06d66d93) /* 0.427350594 */, 17 }, /* 3642 */ { MAD_F(0x06d711ae) /* 0.427507097 */, 17 }, /* 3643 */ { MAD_F(0x06d7b5cd) /* 0.427663614 */, 17 }, /* 3644 */ { MAD_F(0x06d859f0) /* 0.427820146 */, 17 }, /* 3645 */ { MAD_F(0x06d8fe16) /* 0.427976692 */, 17 }, /* 3646 */ { MAD_F(0x06d9a240) /* 0.428133252 */, 17 }, /* 3647 */ { MAD_F(0x06da466f) /* 0.428289826 */, 17 }, /* 3648 */ { MAD_F(0x06daeaa1) /* 0.428446415 */, 17 }, /* 3649 */ { MAD_F(0x06db8ed6) /* 0.428603018 */, 17 }, /* 3650 */ { MAD_F(0x06dc3310) /* 0.428759635 */, 17 }, /* 3651 */ { MAD_F(0x06dcd74d) /* 0.428916267 */, 17 }, /* 3652 */ { MAD_F(0x06dd7b8f) /* 0.429072913 */, 17 }, /* 3653 */ { MAD_F(0x06de1fd4) /* 0.429229573 */, 17 }, /* 3654 */ { MAD_F(0x06dec41d) /* 0.429386248 */, 17 }, /* 3655 */ { MAD_F(0x06df686a) /* 0.429542937 */, 17 }, /* 3656 */ { MAD_F(0x06e00cbb) /* 0.429699640 */, 17 }, /* 3657 */ { MAD_F(0x06e0b10f) /* 0.429856357 */, 17 }, /* 3658 */ { MAD_F(0x06e15567) /* 0.430013089 */, 17 }, /* 3659 */ { MAD_F(0x06e1f9c4) /* 0.430169835 */, 17 }, /* 3660 */ { MAD_F(0x06e29e24) /* 0.430326595 */, 17 }, /* 3661 */ { MAD_F(0x06e34287) /* 0.430483370 */, 17 }, /* 3662 */ { MAD_F(0x06e3e6ef) /* 0.430640159 */, 17 }, /* 3663 */ { MAD_F(0x06e48b5b) /* 0.430796962 */, 17 }, /* 3664 */ { MAD_F(0x06e52fca) /* 0.430953779 */, 17 }, /* 3665 */ { MAD_F(0x06e5d43d) /* 0.431110611 */, 17 }, /* 3666 */ { MAD_F(0x06e678b4) /* 0.431267457 */, 17 }, /* 3667 */ { MAD_F(0x06e71d2f) /* 0.431424317 */, 17 }, /* 3668 */ { MAD_F(0x06e7c1ae) /* 0.431581192 */, 17 }, /* 3669 */ { MAD_F(0x06e86630) /* 0.431738080 */, 17 }, /* 3670 */ { MAD_F(0x06e90ab7) /* 0.431894983 */, 17 }, /* 3671 */ { MAD_F(0x06e9af41) /* 0.432051900 */, 17 }, /* 3672 */ { MAD_F(0x06ea53cf) /* 0.432208832 */, 17 }, /* 3673 */ { MAD_F(0x06eaf860) /* 0.432365778 */, 17 }, /* 3674 */ { MAD_F(0x06eb9cf6) /* 0.432522737 */, 17 }, /* 3675 */ { MAD_F(0x06ec418f) /* 0.432679712 */, 17 }, /* 3676 */ { MAD_F(0x06ece62d) /* 0.432836700 */, 17 }, /* 3677 */ { MAD_F(0x06ed8ace) /* 0.432993703 */, 17 }, /* 3678 */ { MAD_F(0x06ee2f73) /* 0.433150720 */, 17 }, /* 3679 */ { MAD_F(0x06eed41b) /* 0.433307751 */, 17 }, /* 3680 */ { MAD_F(0x06ef78c8) /* 0.433464796 */, 17 }, /* 3681 */ { MAD_F(0x06f01d78) /* 0.433621856 */, 17 }, /* 3682 */ { MAD_F(0x06f0c22c) /* 0.433778929 */, 17 }, /* 3683 */ { MAD_F(0x06f166e4) /* 0.433936017 */, 17 }, /* 3684 */ { MAD_F(0x06f20ba0) /* 0.434093120 */, 17 }, /* 3685 */ { MAD_F(0x06f2b060) /* 0.434250236 */, 17 }, /* 3686 */ { MAD_F(0x06f35523) /* 0.434407367 */, 17 }, /* 3687 */ { MAD_F(0x06f3f9eb) /* 0.434564512 */, 17 }, /* 3688 */ { MAD_F(0x06f49eb6) /* 0.434721671 */, 17 }, /* 3689 */ { MAD_F(0x06f54385) /* 0.434878844 */, 17 }, /* 3690 */ { MAD_F(0x06f5e857) /* 0.435036032 */, 17 }, /* 3691 */ { MAD_F(0x06f68d2e) /* 0.435193233 */, 17 }, /* 3692 */ { MAD_F(0x06f73208) /* 0.435350449 */, 17 }, /* 3693 */ { MAD_F(0x06f7d6e6) /* 0.435507679 */, 17 }, /* 3694 */ { MAD_F(0x06f87bc8) /* 0.435664924 */, 17 }, /* 3695 */ { MAD_F(0x06f920ae) /* 0.435822182 */, 17 }, /* 3696 */ { MAD_F(0x06f9c597) /* 0.435979455 */, 17 }, /* 3697 */ { MAD_F(0x06fa6a85) /* 0.436136741 */, 17 }, /* 3698 */ { MAD_F(0x06fb0f76) /* 0.436294042 */, 17 }, /* 3699 */ { MAD_F(0x06fbb46b) /* 0.436451358 */, 17 }, /* 3700 */ { MAD_F(0x06fc5964) /* 0.436608687 */, 17 }, /* 3701 */ { MAD_F(0x06fcfe60) /* 0.436766031 */, 17 }, /* 3702 */ { MAD_F(0x06fda361) /* 0.436923388 */, 17 }, /* 3703 */ { MAD_F(0x06fe4865) /* 0.437080760 */, 17 }, /* 3704 */ { MAD_F(0x06feed6d) /* 0.437238146 */, 17 }, /* 3705 */ { MAD_F(0x06ff9279) /* 0.437395547 */, 17 }, /* 3706 */ { MAD_F(0x07003788) /* 0.437552961 */, 17 }, /* 3707 */ { MAD_F(0x0700dc9c) /* 0.437710389 */, 17 }, /* 3708 */ { MAD_F(0x070181b3) /* 0.437867832 */, 17 }, /* 3709 */ { MAD_F(0x070226ce) /* 0.438025289 */, 17 }, /* 3710 */ { MAD_F(0x0702cbed) /* 0.438182760 */, 17 }, /* 3711 */ { MAD_F(0x0703710f) /* 0.438340245 */, 17 }, /* 3712 */ { MAD_F(0x07041636) /* 0.438497744 */, 17 }, /* 3713 */ { MAD_F(0x0704bb60) /* 0.438655258 */, 17 }, /* 3714 */ { MAD_F(0x0705608e) /* 0.438812785 */, 17 }, /* 3715 */ { MAD_F(0x070605c0) /* 0.438970327 */, 17 }, /* 3716 */ { MAD_F(0x0706aaf5) /* 0.439127883 */, 17 }, /* 3717 */ { MAD_F(0x0707502f) /* 0.439285453 */, 17 }, /* 3718 */ { MAD_F(0x0707f56c) /* 0.439443037 */, 17 }, /* 3719 */ { MAD_F(0x07089aad) /* 0.439600635 */, 17 }, /* 3720 */ { MAD_F(0x07093ff2) /* 0.439758248 */, 17 }, /* 3721 */ { MAD_F(0x0709e53a) /* 0.439915874 */, 17 }, /* 3722 */ { MAD_F(0x070a8a86) /* 0.440073515 */, 17 }, /* 3723 */ { MAD_F(0x070b2fd7) /* 0.440231170 */, 17 }, /* 3724 */ { MAD_F(0x070bd52a) /* 0.440388839 */, 17 }, /* 3725 */ { MAD_F(0x070c7a82) /* 0.440546522 */, 17 }, /* 3726 */ { MAD_F(0x070d1fde) /* 0.440704219 */, 17 }, /* 3727 */ { MAD_F(0x070dc53d) /* 0.440861930 */, 17 }, /* 3728 */ { MAD_F(0x070e6aa0) /* 0.441019655 */, 17 }, /* 3729 */ { MAD_F(0x070f1007) /* 0.441177395 */, 17 }, /* 3730 */ { MAD_F(0x070fb571) /* 0.441335148 */, 17 }, /* 3731 */ { MAD_F(0x07105ae0) /* 0.441492916 */, 17 }, /* 3732 */ { MAD_F(0x07110052) /* 0.441650697 */, 17 }, /* 3733 */ { MAD_F(0x0711a5c8) /* 0.441808493 */, 17 }, /* 3734 */ { MAD_F(0x07124b42) /* 0.441966303 */, 17 }, /* 3735 */ { MAD_F(0x0712f0bf) /* 0.442124127 */, 17 }, /* 3736 */ { MAD_F(0x07139641) /* 0.442281965 */, 17 }, /* 3737 */ { MAD_F(0x07143bc6) /* 0.442439817 */, 17 }, /* 3738 */ { MAD_F(0x0714e14f) /* 0.442597683 */, 17 }, /* 3739 */ { MAD_F(0x071586db) /* 0.442755564 */, 17 }, /* 3740 */ { MAD_F(0x07162c6c) /* 0.442913458 */, 17 }, /* 3741 */ { MAD_F(0x0716d200) /* 0.443071366 */, 17 }, /* 3742 */ { MAD_F(0x07177798) /* 0.443229289 */, 17 }, /* 3743 */ { MAD_F(0x07181d34) /* 0.443387226 */, 17 }, /* 3744 */ { MAD_F(0x0718c2d3) /* 0.443545176 */, 17 }, /* 3745 */ { MAD_F(0x07196877) /* 0.443703141 */, 17 }, /* 3746 */ { MAD_F(0x071a0e1e) /* 0.443861120 */, 17 }, /* 3747 */ { MAD_F(0x071ab3c9) /* 0.444019113 */, 17 }, /* 3748 */ { MAD_F(0x071b5977) /* 0.444177119 */, 17 }, /* 3749 */ { MAD_F(0x071bff2a) /* 0.444335140 */, 17 }, /* 3750 */ { MAD_F(0x071ca4e0) /* 0.444493175 */, 17 }, /* 3751 */ { MAD_F(0x071d4a9a) /* 0.444651224 */, 17 }, /* 3752 */ { MAD_F(0x071df058) /* 0.444809288 */, 17 }, /* 3753 */ { MAD_F(0x071e9619) /* 0.444967365 */, 17 }, /* 3754 */ { MAD_F(0x071f3bde) /* 0.445125456 */, 17 }, /* 3755 */ { MAD_F(0x071fe1a8) /* 0.445283561 */, 17 }, /* 3756 */ { MAD_F(0x07208774) /* 0.445441680 */, 17 }, /* 3757 */ { MAD_F(0x07212d45) /* 0.445599814 */, 17 }, /* 3758 */ { MAD_F(0x0721d319) /* 0.445757961 */, 17 }, /* 3759 */ { MAD_F(0x072278f1) /* 0.445916122 */, 17 }, /* 3760 */ { MAD_F(0x07231ecd) /* 0.446074298 */, 17 }, /* 3761 */ { MAD_F(0x0723c4ad) /* 0.446232487 */, 17 }, /* 3762 */ { MAD_F(0x07246a90) /* 0.446390690 */, 17 }, /* 3763 */ { MAD_F(0x07251077) /* 0.446548908 */, 17 }, /* 3764 */ { MAD_F(0x0725b662) /* 0.446707139 */, 17 }, /* 3765 */ { MAD_F(0x07265c51) /* 0.446865385 */, 17 }, /* 3766 */ { MAD_F(0x07270244) /* 0.447023644 */, 17 }, /* 3767 */ { MAD_F(0x0727a83a) /* 0.447181918 */, 17 }, /* 3768 */ { MAD_F(0x07284e34) /* 0.447340205 */, 17 }, /* 3769 */ { MAD_F(0x0728f431) /* 0.447498507 */, 17 }, /* 3770 */ { MAD_F(0x07299a33) /* 0.447656822 */, 17 }, /* 3771 */ { MAD_F(0x072a4038) /* 0.447815152 */, 17 }, /* 3772 */ { MAD_F(0x072ae641) /* 0.447973495 */, 17 }, /* 3773 */ { MAD_F(0x072b8c4e) /* 0.448131853 */, 17 }, /* 3774 */ { MAD_F(0x072c325e) /* 0.448290224 */, 17 }, /* 3775 */ { MAD_F(0x072cd873) /* 0.448448609 */, 17 }, /* 3776 */ { MAD_F(0x072d7e8b) /* 0.448607009 */, 17 }, /* 3777 */ { MAD_F(0x072e24a7) /* 0.448765422 */, 17 }, /* 3778 */ { MAD_F(0x072ecac6) /* 0.448923850 */, 17 }, /* 3779 */ { MAD_F(0x072f70e9) /* 0.449082291 */, 17 }, /* 3780 */ { MAD_F(0x07301710) /* 0.449240746 */, 17 }, /* 3781 */ { MAD_F(0x0730bd3b) /* 0.449399216 */, 17 }, /* 3782 */ { MAD_F(0x0731636a) /* 0.449557699 */, 17 }, /* 3783 */ { MAD_F(0x0732099c) /* 0.449716196 */, 17 }, /* 3784 */ { MAD_F(0x0732afd2) /* 0.449874708 */, 17 }, /* 3785 */ { MAD_F(0x0733560c) /* 0.450033233 */, 17 }, /* 3786 */ { MAD_F(0x0733fc49) /* 0.450191772 */, 17 }, /* 3787 */ { MAD_F(0x0734a28b) /* 0.450350325 */, 17 }, /* 3788 */ { MAD_F(0x073548d0) /* 0.450508892 */, 17 }, /* 3789 */ { MAD_F(0x0735ef18) /* 0.450667473 */, 17 }, /* 3790 */ { MAD_F(0x07369565) /* 0.450826068 */, 17 }, /* 3791 */ { MAD_F(0x07373bb5) /* 0.450984677 */, 17 }, /* 3792 */ { MAD_F(0x0737e209) /* 0.451143300 */, 17 }, /* 3793 */ { MAD_F(0x07388861) /* 0.451301937 */, 17 }, /* 3794 */ { MAD_F(0x07392ebc) /* 0.451460588 */, 17 }, /* 3795 */ { MAD_F(0x0739d51c) /* 0.451619252 */, 17 }, /* 3796 */ { MAD_F(0x073a7b7f) /* 0.451777931 */, 17 }, /* 3797 */ { MAD_F(0x073b21e5) /* 0.451936623 */, 17 }, /* 3798 */ { MAD_F(0x073bc850) /* 0.452095330 */, 17 }, /* 3799 */ { MAD_F(0x073c6ebe) /* 0.452254050 */, 17 }, /* 3800 */ { MAD_F(0x073d1530) /* 0.452412785 */, 17 }, /* 3801 */ { MAD_F(0x073dbba6) /* 0.452571533 */, 17 }, /* 3802 */ { MAD_F(0x073e621f) /* 0.452730295 */, 17 }, /* 3803 */ { MAD_F(0x073f089c) /* 0.452889071 */, 17 }, /* 3804 */ { MAD_F(0x073faf1d) /* 0.453047861 */, 17 }, /* 3805 */ { MAD_F(0x074055a2) /* 0.453206665 */, 17 }, /* 3806 */ { MAD_F(0x0740fc2a) /* 0.453365483 */, 17 }, /* 3807 */ { MAD_F(0x0741a2b6) /* 0.453524315 */, 17 }, /* 3808 */ { MAD_F(0x07424946) /* 0.453683161 */, 17 }, /* 3809 */ { MAD_F(0x0742efd9) /* 0.453842020 */, 17 }, /* 3810 */ { MAD_F(0x07439671) /* 0.454000894 */, 17 }, /* 3811 */ { MAD_F(0x07443d0c) /* 0.454159781 */, 17 }, /* 3812 */ { MAD_F(0x0744e3aa) /* 0.454318683 */, 17 }, /* 3813 */ { MAD_F(0x07458a4d) /* 0.454477598 */, 17 }, /* 3814 */ { MAD_F(0x074630f3) /* 0.454636527 */, 17 }, /* 3815 */ { MAD_F(0x0746d79d) /* 0.454795470 */, 17 }, /* 3816 */ { MAD_F(0x07477e4b) /* 0.454954427 */, 17 }, /* 3817 */ { MAD_F(0x074824fc) /* 0.455113397 */, 17 }, /* 3818 */ { MAD_F(0x0748cbb1) /* 0.455272382 */, 17 }, /* 3819 */ { MAD_F(0x0749726a) /* 0.455431381 */, 17 }, /* 3820 */ { MAD_F(0x074a1927) /* 0.455590393 */, 17 }, /* 3821 */ { MAD_F(0x074abfe7) /* 0.455749419 */, 17 }, /* 3822 */ { MAD_F(0x074b66ab) /* 0.455908459 */, 17 }, /* 3823 */ { MAD_F(0x074c0d73) /* 0.456067513 */, 17 }, /* 3824 */ { MAD_F(0x074cb43e) /* 0.456226581 */, 17 }, /* 3825 */ { MAD_F(0x074d5b0d) /* 0.456385663 */, 17 }, /* 3826 */ { MAD_F(0x074e01e0) /* 0.456544759 */, 17 }, /* 3827 */ { MAD_F(0x074ea8b7) /* 0.456703868 */, 17 }, /* 3828 */ { MAD_F(0x074f4f91) /* 0.456862992 */, 17 }, /* 3829 */ { MAD_F(0x074ff66f) /* 0.457022129 */, 17 }, /* 3830 */ { MAD_F(0x07509d51) /* 0.457181280 */, 17 }, /* 3831 */ { MAD_F(0x07514437) /* 0.457340445 */, 17 }, /* 3832 */ { MAD_F(0x0751eb20) /* 0.457499623 */, 17 }, /* 3833 */ { MAD_F(0x0752920d) /* 0.457658816 */, 17 }, /* 3834 */ { MAD_F(0x075338fd) /* 0.457818022 */, 17 }, /* 3835 */ { MAD_F(0x0753dff2) /* 0.457977243 */, 17 }, /* 3836 */ { MAD_F(0x075486ea) /* 0.458136477 */, 17 }, /* 3837 */ { MAD_F(0x07552de6) /* 0.458295725 */, 17 }, /* 3838 */ { MAD_F(0x0755d4e5) /* 0.458454987 */, 17 }, /* 3839 */ { MAD_F(0x07567be8) /* 0.458614262 */, 17 }, /* 3840 */ { MAD_F(0x075722ef) /* 0.458773552 */, 17 }, /* 3841 */ { MAD_F(0x0757c9fa) /* 0.458932855 */, 17 }, /* 3842 */ { MAD_F(0x07587108) /* 0.459092172 */, 17 }, /* 3843 */ { MAD_F(0x0759181a) /* 0.459251503 */, 17 }, /* 3844 */ { MAD_F(0x0759bf30) /* 0.459410848 */, 17 }, /* 3845 */ { MAD_F(0x075a664a) /* 0.459570206 */, 17 }, /* 3846 */ { MAD_F(0x075b0d67) /* 0.459729579 */, 17 }, /* 3847 */ { MAD_F(0x075bb488) /* 0.459888965 */, 17 }, /* 3848 */ { MAD_F(0x075c5bac) /* 0.460048365 */, 17 }, /* 3849 */ { MAD_F(0x075d02d5) /* 0.460207779 */, 17 }, /* 3850 */ { MAD_F(0x075daa01) /* 0.460367206 */, 17 }, /* 3851 */ { MAD_F(0x075e5130) /* 0.460526648 */, 17 }, /* 3852 */ { MAD_F(0x075ef864) /* 0.460686103 */, 17 }, /* 3853 */ { MAD_F(0x075f9f9b) /* 0.460845572 */, 17 }, /* 3854 */ { MAD_F(0x076046d6) /* 0.461005055 */, 17 }, /* 3855 */ { MAD_F(0x0760ee14) /* 0.461164552 */, 17 }, /* 3856 */ { MAD_F(0x07619557) /* 0.461324062 */, 17 }, /* 3857 */ { MAD_F(0x07623c9d) /* 0.461483586 */, 17 }, /* 3858 */ { MAD_F(0x0762e3e6) /* 0.461643124 */, 17 }, /* 3859 */ { MAD_F(0x07638b34) /* 0.461802676 */, 17 }, /* 3860 */ { MAD_F(0x07643285) /* 0.461962242 */, 17 }, /* 3861 */ { MAD_F(0x0764d9d9) /* 0.462121821 */, 17 }, /* 3862 */ { MAD_F(0x07658132) /* 0.462281414 */, 17 }, /* 3863 */ { MAD_F(0x0766288e) /* 0.462441021 */, 17 }, /* 3864 */ { MAD_F(0x0766cfee) /* 0.462600642 */, 17 }, /* 3865 */ { MAD_F(0x07677751) /* 0.462760276 */, 17 }, /* 3866 */ { MAD_F(0x07681eb9) /* 0.462919924 */, 17 }, /* 3867 */ { MAD_F(0x0768c624) /* 0.463079586 */, 17 }, /* 3868 */ { MAD_F(0x07696d92) /* 0.463239262 */, 17 }, /* 3869 */ { MAD_F(0x076a1505) /* 0.463398951 */, 17 }, /* 3870 */ { MAD_F(0x076abc7b) /* 0.463558655 */, 17 }, /* 3871 */ { MAD_F(0x076b63f4) /* 0.463718372 */, 17 }, /* 3872 */ { MAD_F(0x076c0b72) /* 0.463878102 */, 17 }, /* 3873 */ { MAD_F(0x076cb2f3) /* 0.464037847 */, 17 }, /* 3874 */ { MAD_F(0x076d5a78) /* 0.464197605 */, 17 }, /* 3875 */ { MAD_F(0x076e0200) /* 0.464357377 */, 17 }, /* 3876 */ { MAD_F(0x076ea98c) /* 0.464517163 */, 17 }, /* 3877 */ { MAD_F(0x076f511c) /* 0.464676962 */, 17 }, /* 3878 */ { MAD_F(0x076ff8b0) /* 0.464836776 */, 17 }, /* 3879 */ { MAD_F(0x0770a047) /* 0.464996603 */, 17 }, /* 3880 */ { MAD_F(0x077147e2) /* 0.465156443 */, 17 }, /* 3881 */ { MAD_F(0x0771ef80) /* 0.465316298 */, 17 }, /* 3882 */ { MAD_F(0x07729723) /* 0.465476166 */, 17 }, /* 3883 */ { MAD_F(0x07733ec9) /* 0.465636048 */, 17 }, /* 3884 */ { MAD_F(0x0773e672) /* 0.465795943 */, 17 }, /* 3885 */ { MAD_F(0x07748e20) /* 0.465955853 */, 17 }, /* 3886 */ { MAD_F(0x077535d1) /* 0.466115776 */, 17 }, /* 3887 */ { MAD_F(0x0775dd85) /* 0.466275713 */, 17 }, /* 3888 */ { MAD_F(0x0776853e) /* 0.466435663 */, 17 }, /* 3889 */ { MAD_F(0x07772cfa) /* 0.466595627 */, 17 }, /* 3890 */ { MAD_F(0x0777d4ba) /* 0.466755605 */, 17 }, /* 3891 */ { MAD_F(0x07787c7d) /* 0.466915597 */, 17 }, /* 3892 */ { MAD_F(0x07792444) /* 0.467075602 */, 17 }, /* 3893 */ { MAD_F(0x0779cc0f) /* 0.467235621 */, 17 }, /* 3894 */ { MAD_F(0x077a73dd) /* 0.467395654 */, 17 }, /* 3895 */ { MAD_F(0x077b1baf) /* 0.467555701 */, 17 }, /* 3896 */ { MAD_F(0x077bc385) /* 0.467715761 */, 17 }, /* 3897 */ { MAD_F(0x077c6b5f) /* 0.467875835 */, 17 }, /* 3898 */ { MAD_F(0x077d133c) /* 0.468035922 */, 17 }, /* 3899 */ { MAD_F(0x077dbb1d) /* 0.468196023 */, 17 }, /* 3900 */ { MAD_F(0x077e6301) /* 0.468356138 */, 17 }, /* 3901 */ { MAD_F(0x077f0ae9) /* 0.468516267 */, 17 }, /* 3902 */ { MAD_F(0x077fb2d5) /* 0.468676409 */, 17 }, /* 3903 */ { MAD_F(0x07805ac5) /* 0.468836565 */, 17 }, /* 3904 */ { MAD_F(0x078102b8) /* 0.468996735 */, 17 }, /* 3905 */ { MAD_F(0x0781aaaf) /* 0.469156918 */, 17 }, /* 3906 */ { MAD_F(0x078252aa) /* 0.469317115 */, 17 }, /* 3907 */ { MAD_F(0x0782faa8) /* 0.469477326 */, 17 }, /* 3908 */ { MAD_F(0x0783a2aa) /* 0.469637550 */, 17 }, /* 3909 */ { MAD_F(0x07844aaf) /* 0.469797788 */, 17 }, /* 3910 */ { MAD_F(0x0784f2b8) /* 0.469958040 */, 17 }, /* 3911 */ { MAD_F(0x07859ac5) /* 0.470118305 */, 17 }, /* 3912 */ { MAD_F(0x078642d6) /* 0.470278584 */, 17 }, /* 3913 */ { MAD_F(0x0786eaea) /* 0.470438877 */, 17 }, /* 3914 */ { MAD_F(0x07879302) /* 0.470599183 */, 17 }, /* 3915 */ { MAD_F(0x07883b1e) /* 0.470759503 */, 17 }, /* 3916 */ { MAD_F(0x0788e33d) /* 0.470919836 */, 17 }, /* 3917 */ { MAD_F(0x07898b60) /* 0.471080184 */, 17 }, /* 3918 */ { MAD_F(0x078a3386) /* 0.471240545 */, 17 }, /* 3919 */ { MAD_F(0x078adbb0) /* 0.471400919 */, 17 }, /* 3920 */ { MAD_F(0x078b83de) /* 0.471561307 */, 17 }, /* 3921 */ { MAD_F(0x078c2c10) /* 0.471721709 */, 17 }, /* 3922 */ { MAD_F(0x078cd445) /* 0.471882125 */, 17 }, /* 3923 */ { MAD_F(0x078d7c7e) /* 0.472042554 */, 17 }, /* 3924 */ { MAD_F(0x078e24ba) /* 0.472202996 */, 17 }, /* 3925 */ { MAD_F(0x078eccfb) /* 0.472363453 */, 17 }, /* 3926 */ { MAD_F(0x078f753e) /* 0.472523923 */, 17 }, /* 3927 */ { MAD_F(0x07901d86) /* 0.472684406 */, 17 }, /* 3928 */ { MAD_F(0x0790c5d1) /* 0.472844904 */, 17 }, /* 3929 */ { MAD_F(0x07916e20) /* 0.473005414 */, 17 }, /* 3930 */ { MAD_F(0x07921672) /* 0.473165939 */, 17 }, /* 3931 */ { MAD_F(0x0792bec8) /* 0.473326477 */, 17 }, /* 3932 */ { MAD_F(0x07936722) /* 0.473487029 */, 17 }, /* 3933 */ { MAD_F(0x07940f80) /* 0.473647594 */, 17 }, /* 3934 */ { MAD_F(0x0794b7e1) /* 0.473808173 */, 17 }, /* 3935 */ { MAD_F(0x07956045) /* 0.473968765 */, 17 }, /* 3936 */ { MAD_F(0x079608ae) /* 0.474129372 */, 17 }, /* 3937 */ { MAD_F(0x0796b11a) /* 0.474289991 */, 17 }, /* 3938 */ { MAD_F(0x0797598a) /* 0.474450625 */, 17 }, /* 3939 */ { MAD_F(0x079801fd) /* 0.474611272 */, 17 }, /* 3940 */ { MAD_F(0x0798aa74) /* 0.474771932 */, 17 }, /* 3941 */ { MAD_F(0x079952ee) /* 0.474932606 */, 17 }, /* 3942 */ { MAD_F(0x0799fb6d) /* 0.475093294 */, 17 }, /* 3943 */ { MAD_F(0x079aa3ef) /* 0.475253995 */, 17 }, /* 3944 */ { MAD_F(0x079b4c74) /* 0.475414710 */, 17 }, /* 3945 */ { MAD_F(0x079bf4fd) /* 0.475575439 */, 17 }, /* 3946 */ { MAD_F(0x079c9d8a) /* 0.475736181 */, 17 }, /* 3947 */ { MAD_F(0x079d461b) /* 0.475896936 */, 17 }, /* 3948 */ { MAD_F(0x079deeaf) /* 0.476057705 */, 17 }, /* 3949 */ { MAD_F(0x079e9747) /* 0.476218488 */, 17 }, /* 3950 */ { MAD_F(0x079f3fe2) /* 0.476379285 */, 17 }, /* 3951 */ { MAD_F(0x079fe881) /* 0.476540095 */, 17 }, /* 3952 */ { MAD_F(0x07a09124) /* 0.476700918 */, 17 }, /* 3953 */ { MAD_F(0x07a139ca) /* 0.476861755 */, 17 }, /* 3954 */ { MAD_F(0x07a1e274) /* 0.477022606 */, 17 }, /* 3955 */ { MAD_F(0x07a28b22) /* 0.477183470 */, 17 }, /* 3956 */ { MAD_F(0x07a333d3) /* 0.477344348 */, 17 }, /* 3957 */ { MAD_F(0x07a3dc88) /* 0.477505239 */, 17 }, /* 3958 */ { MAD_F(0x07a48541) /* 0.477666144 */, 17 }, /* 3959 */ { MAD_F(0x07a52dfd) /* 0.477827062 */, 17 }, /* 3960 */ { MAD_F(0x07a5d6bd) /* 0.477987994 */, 17 }, /* 3961 */ { MAD_F(0x07a67f80) /* 0.478148940 */, 17 }, /* 3962 */ { MAD_F(0x07a72847) /* 0.478309899 */, 17 }, /* 3963 */ { MAD_F(0x07a7d112) /* 0.478470871 */, 17 }, /* 3964 */ { MAD_F(0x07a879e1) /* 0.478631857 */, 17 }, /* 3965 */ { MAD_F(0x07a922b3) /* 0.478792857 */, 17 }, /* 3966 */ { MAD_F(0x07a9cb88) /* 0.478953870 */, 17 }, /* 3967 */ { MAD_F(0x07aa7462) /* 0.479114897 */, 17 }, /* 3968 */ { MAD_F(0x07ab1d3e) /* 0.479275937 */, 17 }, /* 3969 */ { MAD_F(0x07abc61f) /* 0.479436991 */, 17 }, /* 3970 */ { MAD_F(0x07ac6f03) /* 0.479598058 */, 17 }, /* 3971 */ { MAD_F(0x07ad17eb) /* 0.479759139 */, 17 }, /* 3972 */ { MAD_F(0x07adc0d6) /* 0.479920233 */, 17 }, /* 3973 */ { MAD_F(0x07ae69c6) /* 0.480081341 */, 17 }, /* 3974 */ { MAD_F(0x07af12b8) /* 0.480242463 */, 17 }, /* 3975 */ { MAD_F(0x07afbbaf) /* 0.480403598 */, 17 }, /* 3976 */ { MAD_F(0x07b064a8) /* 0.480564746 */, 17 }, /* 3977 */ { MAD_F(0x07b10da6) /* 0.480725908 */, 17 }, /* 3978 */ { MAD_F(0x07b1b6a7) /* 0.480887083 */, 17 }, /* 3979 */ { MAD_F(0x07b25fac) /* 0.481048272 */, 17 }, /* 3980 */ { MAD_F(0x07b308b5) /* 0.481209475 */, 17 }, /* 3981 */ { MAD_F(0x07b3b1c1) /* 0.481370691 */, 17 }, /* 3982 */ { MAD_F(0x07b45ad0) /* 0.481531920 */, 17 }, /* 3983 */ { MAD_F(0x07b503e4) /* 0.481693163 */, 17 }, /* 3984 */ { MAD_F(0x07b5acfb) /* 0.481854420 */, 17 }, /* 3985 */ { MAD_F(0x07b65615) /* 0.482015690 */, 17 }, /* 3986 */ { MAD_F(0x07b6ff33) /* 0.482176973 */, 17 }, /* 3987 */ { MAD_F(0x07b7a855) /* 0.482338270 */, 17 }, /* 3988 */ { MAD_F(0x07b8517b) /* 0.482499580 */, 17 }, /* 3989 */ { MAD_F(0x07b8faa4) /* 0.482660904 */, 17 }, /* 3990 */ { MAD_F(0x07b9a3d0) /* 0.482822242 */, 17 }, /* 3991 */ { MAD_F(0x07ba4d01) /* 0.482983592 */, 17 }, /* 3992 */ { MAD_F(0x07baf635) /* 0.483144957 */, 17 }, /* 3993 */ { MAD_F(0x07bb9f6c) /* 0.483306335 */, 17 }, /* 3994 */ { MAD_F(0x07bc48a7) /* 0.483467726 */, 17 }, /* 3995 */ { MAD_F(0x07bcf1e6) /* 0.483629131 */, 17 }, /* 3996 */ { MAD_F(0x07bd9b28) /* 0.483790549 */, 17 }, /* 3997 */ { MAD_F(0x07be446e) /* 0.483951980 */, 17 }, /* 3998 */ { MAD_F(0x07beedb8) /* 0.484113426 */, 17 }, /* 3999 */ { MAD_F(0x07bf9705) /* 0.484274884 */, 17 }, /* 4000 */ { MAD_F(0x07c04056) /* 0.484436356 */, 17 }, /* 4001 */ { MAD_F(0x07c0e9aa) /* 0.484597842 */, 17 }, /* 4002 */ { MAD_F(0x07c19302) /* 0.484759341 */, 17 }, /* 4003 */ { MAD_F(0x07c23c5e) /* 0.484920853 */, 17 }, /* 4004 */ { MAD_F(0x07c2e5bd) /* 0.485082379 */, 17 }, /* 4005 */ { MAD_F(0x07c38f20) /* 0.485243918 */, 17 }, /* 4006 */ { MAD_F(0x07c43887) /* 0.485405471 */, 17 }, /* 4007 */ { MAD_F(0x07c4e1f1) /* 0.485567037 */, 17 }, /* 4008 */ { MAD_F(0x07c58b5f) /* 0.485728617 */, 17 }, /* 4009 */ { MAD_F(0x07c634d0) /* 0.485890210 */, 17 }, /* 4010 */ { MAD_F(0x07c6de45) /* 0.486051817 */, 17 }, /* 4011 */ { MAD_F(0x07c787bd) /* 0.486213436 */, 17 }, /* 4012 */ { MAD_F(0x07c83139) /* 0.486375070 */, 17 }, /* 4013 */ { MAD_F(0x07c8dab9) /* 0.486536717 */, 17 }, /* 4014 */ { MAD_F(0x07c9843c) /* 0.486698377 */, 17 }, /* 4015 */ { MAD_F(0x07ca2dc3) /* 0.486860051 */, 17 }, /* 4016 */ { MAD_F(0x07cad74e) /* 0.487021738 */, 17 }, /* 4017 */ { MAD_F(0x07cb80dc) /* 0.487183438 */, 17 }, /* 4018 */ { MAD_F(0x07cc2a6e) /* 0.487345152 */, 17 }, /* 4019 */ { MAD_F(0x07ccd403) /* 0.487506879 */, 17 }, /* 4020 */ { MAD_F(0x07cd7d9c) /* 0.487668620 */, 17 }, /* 4021 */ { MAD_F(0x07ce2739) /* 0.487830374 */, 17 }, /* 4022 */ { MAD_F(0x07ced0d9) /* 0.487992142 */, 17 }, /* 4023 */ { MAD_F(0x07cf7a7d) /* 0.488153923 */, 17 }, /* 4024 */ { MAD_F(0x07d02424) /* 0.488315717 */, 17 }, /* 4025 */ { MAD_F(0x07d0cdcf) /* 0.488477525 */, 17 }, /* 4026 */ { MAD_F(0x07d1777e) /* 0.488639346 */, 17 }, /* 4027 */ { MAD_F(0x07d22130) /* 0.488801181 */, 17 }, /* 4028 */ { MAD_F(0x07d2cae5) /* 0.488963029 */, 17 }, /* 4029 */ { MAD_F(0x07d3749f) /* 0.489124890 */, 17 }, /* 4030 */ { MAD_F(0x07d41e5c) /* 0.489286765 */, 17 }, /* 4031 */ { MAD_F(0x07d4c81c) /* 0.489448653 */, 17 }, /* 4032 */ { MAD_F(0x07d571e0) /* 0.489610555 */, 17 }, /* 4033 */ { MAD_F(0x07d61ba8) /* 0.489772470 */, 17 }, /* 4034 */ { MAD_F(0x07d6c573) /* 0.489934398 */, 17 }, /* 4035 */ { MAD_F(0x07d76f42) /* 0.490096340 */, 17 }, /* 4036 */ { MAD_F(0x07d81915) /* 0.490258295 */, 17 }, /* 4037 */ { MAD_F(0x07d8c2eb) /* 0.490420263 */, 17 }, /* 4038 */ { MAD_F(0x07d96cc4) /* 0.490582245 */, 17 }, /* 4039 */ { MAD_F(0x07da16a2) /* 0.490744240 */, 17 }, /* 4040 */ { MAD_F(0x07dac083) /* 0.490906249 */, 17 }, /* 4041 */ { MAD_F(0x07db6a67) /* 0.491068271 */, 17 }, /* 4042 */ { MAD_F(0x07dc144f) /* 0.491230306 */, 17 }, /* 4043 */ { MAD_F(0x07dcbe3b) /* 0.491392355 */, 17 }, /* 4044 */ { MAD_F(0x07dd682a) /* 0.491554417 */, 17 }, /* 4045 */ { MAD_F(0x07de121d) /* 0.491716492 */, 17 }, /* 4046 */ { MAD_F(0x07debc13) /* 0.491878581 */, 17 }, /* 4047 */ { MAD_F(0x07df660d) /* 0.492040683 */, 17 }, /* 4048 */ { MAD_F(0x07e0100a) /* 0.492202799 */, 17 }, /* 4049 */ { MAD_F(0x07e0ba0c) /* 0.492364928 */, 17 }, /* 4050 */ { MAD_F(0x07e16410) /* 0.492527070 */, 17 }, /* 4051 */ { MAD_F(0x07e20e19) /* 0.492689225 */, 17 }, /* 4052 */ { MAD_F(0x07e2b824) /* 0.492851394 */, 17 }, /* 4053 */ { MAD_F(0x07e36234) /* 0.493013576 */, 17 }, /* 4054 */ { MAD_F(0x07e40c47) /* 0.493175772 */, 17 }, /* 4055 */ { MAD_F(0x07e4b65e) /* 0.493337981 */, 17 }, /* 4056 */ { MAD_F(0x07e56078) /* 0.493500203 */, 17 }, /* 4057 */ { MAD_F(0x07e60a95) /* 0.493662438 */, 17 }, /* 4058 */ { MAD_F(0x07e6b4b7) /* 0.493824687 */, 17 }, /* 4059 */ { MAD_F(0x07e75edc) /* 0.493986949 */, 17 }, /* 4060 */ { MAD_F(0x07e80904) /* 0.494149225 */, 17 }, /* 4061 */ { MAD_F(0x07e8b330) /* 0.494311514 */, 17 }, /* 4062 */ { MAD_F(0x07e95d60) /* 0.494473816 */, 17 }, /* 4063 */ { MAD_F(0x07ea0793) /* 0.494636131 */, 17 }, /* 4064 */ { MAD_F(0x07eab1ca) /* 0.494798460 */, 17 }, /* 4065 */ { MAD_F(0x07eb5c04) /* 0.494960802 */, 17 }, /* 4066 */ { MAD_F(0x07ec0642) /* 0.495123158 */, 17 }, /* 4067 */ { MAD_F(0x07ecb084) /* 0.495285526 */, 17 }, /* 4068 */ { MAD_F(0x07ed5ac9) /* 0.495447908 */, 17 }, /* 4069 */ { MAD_F(0x07ee0512) /* 0.495610304 */, 17 }, /* 4070 */ { MAD_F(0x07eeaf5e) /* 0.495772712 */, 17 }, /* 4071 */ { MAD_F(0x07ef59ae) /* 0.495935134 */, 17 }, /* 4072 */ { MAD_F(0x07f00401) /* 0.496097570 */, 17 }, /* 4073 */ { MAD_F(0x07f0ae58) /* 0.496260018 */, 17 }, /* 4074 */ { MAD_F(0x07f158b3) /* 0.496422480 */, 17 }, /* 4075 */ { MAD_F(0x07f20311) /* 0.496584955 */, 17 }, /* 4076 */ { MAD_F(0x07f2ad72) /* 0.496747444 */, 17 }, /* 4077 */ { MAD_F(0x07f357d8) /* 0.496909945 */, 17 }, /* 4078 */ { MAD_F(0x07f40240) /* 0.497072460 */, 17 }, /* 4079 */ { MAD_F(0x07f4acad) /* 0.497234989 */, 17 }, /* 4080 */ { MAD_F(0x07f5571d) /* 0.497397530 */, 17 }, /* 4081 */ { MAD_F(0x07f60190) /* 0.497560085 */, 17 }, /* 4082 */ { MAD_F(0x07f6ac07) /* 0.497722653 */, 17 }, /* 4083 */ { MAD_F(0x07f75682) /* 0.497885235 */, 17 }, /* 4084 */ { MAD_F(0x07f80100) /* 0.498047829 */, 17 }, /* 4085 */ { MAD_F(0x07f8ab82) /* 0.498210437 */, 17 }, /* 4086 */ { MAD_F(0x07f95607) /* 0.498373058 */, 17 }, /* 4087 */ { MAD_F(0x07fa0090) /* 0.498535693 */, 17 }, /* 4088 */ { MAD_F(0x07faab1c) /* 0.498698341 */, 17 }, /* 4089 */ { MAD_F(0x07fb55ac) /* 0.498861002 */, 17 }, /* 4090 */ { MAD_F(0x07fc0040) /* 0.499023676 */, 17 }, /* 4091 */ { MAD_F(0x07fcaad7) /* 0.499186364 */, 17 }, /* 4092 */ { MAD_F(0x07fd5572) /* 0.499349064 */, 17 }, /* 4093 */ { MAD_F(0x07fe0010) /* 0.499511778 */, 17 }, /* 4094 */ { MAD_F(0x07feaab2) /* 0.499674506 */, 17 }, /* 4095 */ { MAD_F(0x07ff5557) /* 0.499837246 */, 17 }, /* 4096 */ { MAD_F(0x04000000) /* 0.250000000 */, 18 }, /* 4097 */ { MAD_F(0x04005556) /* 0.250081384 */, 18 }, /* 4098 */ { MAD_F(0x0400aaae) /* 0.250162774 */, 18 }, /* 4099 */ { MAD_F(0x04010008) /* 0.250244170 */, 18 }, /* 4100 */ { MAD_F(0x04015563) /* 0.250325574 */, 18 }, /* 4101 */ { MAD_F(0x0401aac1) /* 0.250406984 */, 18 }, /* 4102 */ { MAD_F(0x04020020) /* 0.250488400 */, 18 }, /* 4103 */ { MAD_F(0x04025581) /* 0.250569824 */, 18 }, /* 4104 */ { MAD_F(0x0402aae3) /* 0.250651254 */, 18 }, /* 4105 */ { MAD_F(0x04030048) /* 0.250732690 */, 18 }, /* 4106 */ { MAD_F(0x040355ae) /* 0.250814133 */, 18 }, /* 4107 */ { MAD_F(0x0403ab16) /* 0.250895583 */, 18 }, /* 4108 */ { MAD_F(0x04040080) /* 0.250977039 */, 18 }, /* 4109 */ { MAD_F(0x040455eb) /* 0.251058502 */, 18 }, /* 4110 */ { MAD_F(0x0404ab59) /* 0.251139971 */, 18 }, /* 4111 */ { MAD_F(0x040500c8) /* 0.251221448 */, 18 }, /* 4112 */ { MAD_F(0x04055638) /* 0.251302930 */, 18 }, /* 4113 */ { MAD_F(0x0405abab) /* 0.251384420 */, 18 }, /* 4114 */ { MAD_F(0x0406011f) /* 0.251465916 */, 18 }, /* 4115 */ { MAD_F(0x04065696) /* 0.251547418 */, 18 }, /* 4116 */ { MAD_F(0x0406ac0e) /* 0.251628927 */, 18 }, /* 4117 */ { MAD_F(0x04070187) /* 0.251710443 */, 18 }, /* 4118 */ { MAD_F(0x04075703) /* 0.251791965 */, 18 }, /* 4119 */ { MAD_F(0x0407ac80) /* 0.251873494 */, 18 }, /* 4120 */ { MAD_F(0x040801ff) /* 0.251955030 */, 18 }, /* 4121 */ { MAD_F(0x04085780) /* 0.252036572 */, 18 }, /* 4122 */ { MAD_F(0x0408ad02) /* 0.252118121 */, 18 }, /* 4123 */ { MAD_F(0x04090287) /* 0.252199676 */, 18 }, /* 4124 */ { MAD_F(0x0409580d) /* 0.252281238 */, 18 }, /* 4125 */ { MAD_F(0x0409ad95) /* 0.252362807 */, 18 }, /* 4126 */ { MAD_F(0x040a031e) /* 0.252444382 */, 18 }, /* 4127 */ { MAD_F(0x040a58aa) /* 0.252525963 */, 18 }, /* 4128 */ { MAD_F(0x040aae37) /* 0.252607552 */, 18 }, /* 4129 */ { MAD_F(0x040b03c6) /* 0.252689147 */, 18 }, /* 4130 */ { MAD_F(0x040b5957) /* 0.252770748 */, 18 }, /* 4131 */ { MAD_F(0x040baee9) /* 0.252852356 */, 18 }, /* 4132 */ { MAD_F(0x040c047e) /* 0.252933971 */, 18 }, /* 4133 */ { MAD_F(0x040c5a14) /* 0.253015592 */, 18 }, /* 4134 */ { MAD_F(0x040cafab) /* 0.253097220 */, 18 }, /* 4135 */ { MAD_F(0x040d0545) /* 0.253178854 */, 18 }, /* 4136 */ { MAD_F(0x040d5ae0) /* 0.253260495 */, 18 }, /* 4137 */ { MAD_F(0x040db07d) /* 0.253342143 */, 18 }, /* 4138 */ { MAD_F(0x040e061c) /* 0.253423797 */, 18 }, /* 4139 */ { MAD_F(0x040e5bbd) /* 0.253505457 */, 18 }, /* 4140 */ { MAD_F(0x040eb15f) /* 0.253587125 */, 18 }, /* 4141 */ { MAD_F(0x040f0703) /* 0.253668799 */, 18 }, /* 4142 */ { MAD_F(0x040f5ca9) /* 0.253750479 */, 18 }, /* 4143 */ { MAD_F(0x040fb251) /* 0.253832166 */, 18 }, /* 4144 */ { MAD_F(0x041007fa) /* 0.253913860 */, 18 }, /* 4145 */ { MAD_F(0x04105da6) /* 0.253995560 */, 18 }, /* 4146 */ { MAD_F(0x0410b353) /* 0.254077266 */, 18 }, /* 4147 */ { MAD_F(0x04110901) /* 0.254158980 */, 18 }, /* 4148 */ { MAD_F(0x04115eb2) /* 0.254240700 */, 18 }, /* 4149 */ { MAD_F(0x0411b464) /* 0.254322426 */, 18 }, /* 4150 */ { MAD_F(0x04120a18) /* 0.254404159 */, 18 }, /* 4151 */ { MAD_F(0x04125fce) /* 0.254485899 */, 18 }, /* 4152 */ { MAD_F(0x0412b586) /* 0.254567645 */, 18 }, /* 4153 */ { MAD_F(0x04130b3f) /* 0.254649397 */, 18 }, /* 4154 */ { MAD_F(0x041360fa) /* 0.254731157 */, 18 }, /* 4155 */ { MAD_F(0x0413b6b7) /* 0.254812922 */, 18 }, /* 4156 */ { MAD_F(0x04140c75) /* 0.254894695 */, 18 }, /* 4157 */ { MAD_F(0x04146236) /* 0.254976474 */, 18 }, /* 4158 */ { MAD_F(0x0414b7f8) /* 0.255058259 */, 18 }, /* 4159 */ { MAD_F(0x04150dbc) /* 0.255140051 */, 18 }, /* 4160 */ { MAD_F(0x04156381) /* 0.255221850 */, 18 }, /* 4161 */ { MAD_F(0x0415b949) /* 0.255303655 */, 18 }, /* 4162 */ { MAD_F(0x04160f12) /* 0.255385467 */, 18 }, /* 4163 */ { MAD_F(0x041664dd) /* 0.255467285 */, 18 }, /* 4164 */ { MAD_F(0x0416baaa) /* 0.255549110 */, 18 }, /* 4165 */ { MAD_F(0x04171078) /* 0.255630941 */, 18 }, /* 4166 */ { MAD_F(0x04176648) /* 0.255712779 */, 18 }, /* 4167 */ { MAD_F(0x0417bc1a) /* 0.255794624 */, 18 }, /* 4168 */ { MAD_F(0x041811ee) /* 0.255876475 */, 18 }, /* 4169 */ { MAD_F(0x041867c3) /* 0.255958332 */, 18 }, /* 4170 */ { MAD_F(0x0418bd9b) /* 0.256040196 */, 18 }, /* 4171 */ { MAD_F(0x04191374) /* 0.256122067 */, 18 }, /* 4172 */ { MAD_F(0x0419694e) /* 0.256203944 */, 18 }, /* 4173 */ { MAD_F(0x0419bf2b) /* 0.256285828 */, 18 }, /* 4174 */ { MAD_F(0x041a1509) /* 0.256367718 */, 18 }, /* 4175 */ { MAD_F(0x041a6ae9) /* 0.256449615 */, 18 }, /* 4176 */ { MAD_F(0x041ac0cb) /* 0.256531518 */, 18 }, /* 4177 */ { MAD_F(0x041b16ae) /* 0.256613428 */, 18 }, /* 4178 */ { MAD_F(0x041b6c94) /* 0.256695344 */, 18 }, /* 4179 */ { MAD_F(0x041bc27b) /* 0.256777267 */, 18 }, /* 4180 */ { MAD_F(0x041c1863) /* 0.256859197 */, 18 }, /* 4181 */ { MAD_F(0x041c6e4e) /* 0.256941133 */, 18 }, /* 4182 */ { MAD_F(0x041cc43a) /* 0.257023076 */, 18 }, /* 4183 */ { MAD_F(0x041d1a28) /* 0.257105025 */, 18 }, /* 4184 */ { MAD_F(0x041d7018) /* 0.257186980 */, 18 }, /* 4185 */ { MAD_F(0x041dc60a) /* 0.257268942 */, 18 }, /* 4186 */ { MAD_F(0x041e1bfd) /* 0.257350911 */, 18 }, /* 4187 */ { MAD_F(0x041e71f2) /* 0.257432886 */, 18 }, /* 4188 */ { MAD_F(0x041ec7e9) /* 0.257514868 */, 18 }, /* 4189 */ { MAD_F(0x041f1de1) /* 0.257596856 */, 18 }, /* 4190 */ { MAD_F(0x041f73dc) /* 0.257678851 */, 18 }, /* 4191 */ { MAD_F(0x041fc9d8) /* 0.257760852 */, 18 }, /* 4192 */ { MAD_F(0x04201fd5) /* 0.257842860 */, 18 }, /* 4193 */ { MAD_F(0x042075d5) /* 0.257924875 */, 18 }, /* 4194 */ { MAD_F(0x0420cbd6) /* 0.258006895 */, 18 }, /* 4195 */ { MAD_F(0x042121d9) /* 0.258088923 */, 18 }, /* 4196 */ { MAD_F(0x042177de) /* 0.258170957 */, 18 }, /* 4197 */ { MAD_F(0x0421cde5) /* 0.258252997 */, 18 }, /* 4198 */ { MAD_F(0x042223ed) /* 0.258335044 */, 18 }, /* 4199 */ { MAD_F(0x042279f7) /* 0.258417097 */, 18 }, /* 4200 */ { MAD_F(0x0422d003) /* 0.258499157 */, 18 }, /* 4201 */ { MAD_F(0x04232611) /* 0.258581224 */, 18 }, /* 4202 */ { MAD_F(0x04237c20) /* 0.258663297 */, 18 }, /* 4203 */ { MAD_F(0x0423d231) /* 0.258745376 */, 18 }, /* 4204 */ { MAD_F(0x04242844) /* 0.258827462 */, 18 }, /* 4205 */ { MAD_F(0x04247e58) /* 0.258909555 */, 18 }, /* 4206 */ { MAD_F(0x0424d46e) /* 0.258991654 */, 18 }, /* 4207 */ { MAD_F(0x04252a87) /* 0.259073760 */, 18 }, /* 4208 */ { MAD_F(0x042580a0) /* 0.259155872 */, 18 }, /* 4209 */ { MAD_F(0x0425d6bc) /* 0.259237990 */, 18 }, /* 4210 */ { MAD_F(0x04262cd9) /* 0.259320115 */, 18 }, /* 4211 */ { MAD_F(0x042682f8) /* 0.259402247 */, 18 }, /* 4212 */ { MAD_F(0x0426d919) /* 0.259484385 */, 18 }, /* 4213 */ { MAD_F(0x04272f3b) /* 0.259566529 */, 18 }, /* 4214 */ { MAD_F(0x04278560) /* 0.259648680 */, 18 }, /* 4215 */ { MAD_F(0x0427db86) /* 0.259730838 */, 18 }, /* 4216 */ { MAD_F(0x042831ad) /* 0.259813002 */, 18 }, /* 4217 */ { MAD_F(0x042887d7) /* 0.259895173 */, 18 }, /* 4218 */ { MAD_F(0x0428de02) /* 0.259977350 */, 18 }, /* 4219 */ { MAD_F(0x0429342f) /* 0.260059533 */, 18 }, /* 4220 */ { MAD_F(0x04298a5e) /* 0.260141723 */, 18 }, /* 4221 */ { MAD_F(0x0429e08e) /* 0.260223920 */, 18 }, /* 4222 */ { MAD_F(0x042a36c0) /* 0.260306123 */, 18 }, /* 4223 */ { MAD_F(0x042a8cf4) /* 0.260388332 */, 18 }, /* 4224 */ { MAD_F(0x042ae32a) /* 0.260470548 */, 18 }, /* 4225 */ { MAD_F(0x042b3962) /* 0.260552771 */, 18 }, /* 4226 */ { MAD_F(0x042b8f9b) /* 0.260635000 */, 18 }, /* 4227 */ { MAD_F(0x042be5d6) /* 0.260717235 */, 18 }, /* 4228 */ { MAD_F(0x042c3c12) /* 0.260799477 */, 18 }, /* 4229 */ { MAD_F(0x042c9251) /* 0.260881725 */, 18 }, /* 4230 */ { MAD_F(0x042ce891) /* 0.260963980 */, 18 }, /* 4231 */ { MAD_F(0x042d3ed3) /* 0.261046242 */, 18 }, /* 4232 */ { MAD_F(0x042d9516) /* 0.261128510 */, 18 }, /* 4233 */ { MAD_F(0x042deb5c) /* 0.261210784 */, 18 }, /* 4234 */ { MAD_F(0x042e41a3) /* 0.261293065 */, 18 }, /* 4235 */ { MAD_F(0x042e97ec) /* 0.261375352 */, 18 }, /* 4236 */ { MAD_F(0x042eee36) /* 0.261457646 */, 18 }, /* 4237 */ { MAD_F(0x042f4482) /* 0.261539946 */, 18 }, /* 4238 */ { MAD_F(0x042f9ad1) /* 0.261622253 */, 18 }, /* 4239 */ { MAD_F(0x042ff120) /* 0.261704566 */, 18 }, /* 4240 */ { MAD_F(0x04304772) /* 0.261786886 */, 18 }, /* 4241 */ { MAD_F(0x04309dc5) /* 0.261869212 */, 18 }, /* 4242 */ { MAD_F(0x0430f41a) /* 0.261951545 */, 18 }, /* 4243 */ { MAD_F(0x04314a71) /* 0.262033884 */, 18 }, /* 4244 */ { MAD_F(0x0431a0c9) /* 0.262116229 */, 18 }, /* 4245 */ { MAD_F(0x0431f723) /* 0.262198581 */, 18 }, /* 4246 */ { MAD_F(0x04324d7f) /* 0.262280940 */, 18 }, /* 4247 */ { MAD_F(0x0432a3dd) /* 0.262363305 */, 18 }, /* 4248 */ { MAD_F(0x0432fa3d) /* 0.262445676 */, 18 }, /* 4249 */ { MAD_F(0x0433509e) /* 0.262528054 */, 18 }, /* 4250 */ { MAD_F(0x0433a701) /* 0.262610438 */, 18 }, /* 4251 */ { MAD_F(0x0433fd65) /* 0.262692829 */, 18 }, /* 4252 */ { MAD_F(0x043453cc) /* 0.262775227 */, 18 }, /* 4253 */ { MAD_F(0x0434aa34) /* 0.262857630 */, 18 }, /* 4254 */ { MAD_F(0x0435009d) /* 0.262940040 */, 18 }, /* 4255 */ { MAD_F(0x04355709) /* 0.263022457 */, 18 }, /* 4256 */ { MAD_F(0x0435ad76) /* 0.263104880 */, 18 }, /* 4257 */ { MAD_F(0x043603e5) /* 0.263187310 */, 18 }, /* 4258 */ { MAD_F(0x04365a56) /* 0.263269746 */, 18 }, /* 4259 */ { MAD_F(0x0436b0c9) /* 0.263352188 */, 18 }, /* 4260 */ { MAD_F(0x0437073d) /* 0.263434637 */, 18 }, /* 4261 */ { MAD_F(0x04375db3) /* 0.263517093 */, 18 }, /* 4262 */ { MAD_F(0x0437b42a) /* 0.263599554 */, 18 }, /* 4263 */ { MAD_F(0x04380aa4) /* 0.263682023 */, 18 }, /* 4264 */ { MAD_F(0x0438611f) /* 0.263764497 */, 18 }, /* 4265 */ { MAD_F(0x0438b79c) /* 0.263846979 */, 18 }, /* 4266 */ { MAD_F(0x04390e1a) /* 0.263929466 */, 18 }, /* 4267 */ { MAD_F(0x0439649b) /* 0.264011960 */, 18 }, /* 4268 */ { MAD_F(0x0439bb1d) /* 0.264094461 */, 18 }, /* 4269 */ { MAD_F(0x043a11a1) /* 0.264176968 */, 18 }, /* 4270 */ { MAD_F(0x043a6826) /* 0.264259481 */, 18 }, /* 4271 */ { MAD_F(0x043abead) /* 0.264342001 */, 18 }, /* 4272 */ { MAD_F(0x043b1536) /* 0.264424527 */, 18 }, /* 4273 */ { MAD_F(0x043b6bc1) /* 0.264507060 */, 18 }, /* 4274 */ { MAD_F(0x043bc24d) /* 0.264589599 */, 18 }, /* 4275 */ { MAD_F(0x043c18dc) /* 0.264672145 */, 18 }, /* 4276 */ { MAD_F(0x043c6f6c) /* 0.264754697 */, 18 }, /* 4277 */ { MAD_F(0x043cc5fd) /* 0.264837255 */, 18 }, /* 4278 */ { MAD_F(0x043d1c91) /* 0.264919820 */, 18 }, /* 4279 */ { MAD_F(0x043d7326) /* 0.265002392 */, 18 }, /* 4280 */ { MAD_F(0x043dc9bc) /* 0.265084969 */, 18 }, /* 4281 */ { MAD_F(0x043e2055) /* 0.265167554 */, 18 }, /* 4282 */ { MAD_F(0x043e76ef) /* 0.265250144 */, 18 }, /* 4283 */ { MAD_F(0x043ecd8b) /* 0.265332741 */, 18 }, /* 4284 */ { MAD_F(0x043f2429) /* 0.265415345 */, 18 }, /* 4285 */ { MAD_F(0x043f7ac8) /* 0.265497955 */, 18 }, /* 4286 */ { MAD_F(0x043fd169) /* 0.265580571 */, 18 }, /* 4287 */ { MAD_F(0x0440280c) /* 0.265663194 */, 18 }, /* 4288 */ { MAD_F(0x04407eb1) /* 0.265745823 */, 18 }, /* 4289 */ { MAD_F(0x0440d557) /* 0.265828459 */, 18 }, /* 4290 */ { MAD_F(0x04412bff) /* 0.265911101 */, 18 }, /* 4291 */ { MAD_F(0x044182a9) /* 0.265993749 */, 18 }, /* 4292 */ { MAD_F(0x0441d955) /* 0.266076404 */, 18 }, /* 4293 */ { MAD_F(0x04423002) /* 0.266159065 */, 18 }, /* 4294 */ { MAD_F(0x044286b1) /* 0.266241733 */, 18 }, /* 4295 */ { MAD_F(0x0442dd61) /* 0.266324407 */, 18 }, /* 4296 */ { MAD_F(0x04433414) /* 0.266407088 */, 18 }, /* 4297 */ { MAD_F(0x04438ac8) /* 0.266489775 */, 18 }, /* 4298 */ { MAD_F(0x0443e17e) /* 0.266572468 */, 18 }, /* 4299 */ { MAD_F(0x04443835) /* 0.266655168 */, 18 }, /* 4300 */ { MAD_F(0x04448eef) /* 0.266737874 */, 18 }, /* 4301 */ { MAD_F(0x0444e5aa) /* 0.266820587 */, 18 }, /* 4302 */ { MAD_F(0x04453c66) /* 0.266903306 */, 18 }, /* 4303 */ { MAD_F(0x04459325) /* 0.266986031 */, 18 }, /* 4304 */ { MAD_F(0x0445e9e5) /* 0.267068763 */, 18 }, /* 4305 */ { MAD_F(0x044640a7) /* 0.267151501 */, 18 }, /* 4306 */ { MAD_F(0x0446976a) /* 0.267234246 */, 18 }, /* 4307 */ { MAD_F(0x0446ee30) /* 0.267316997 */, 18 }, /* 4308 */ { MAD_F(0x044744f7) /* 0.267399755 */, 18 }, /* 4309 */ { MAD_F(0x04479bc0) /* 0.267482518 */, 18 }, /* 4310 */ { MAD_F(0x0447f28a) /* 0.267565289 */, 18 }, /* 4311 */ { MAD_F(0x04484956) /* 0.267648065 */, 18 }, /* 4312 */ { MAD_F(0x0448a024) /* 0.267730848 */, 18 }, /* 4313 */ { MAD_F(0x0448f6f4) /* 0.267813638 */, 18 }, /* 4314 */ { MAD_F(0x04494dc5) /* 0.267896434 */, 18 }, /* 4315 */ { MAD_F(0x0449a498) /* 0.267979236 */, 18 }, /* 4316 */ { MAD_F(0x0449fb6d) /* 0.268062045 */, 18 }, /* 4317 */ { MAD_F(0x044a5243) /* 0.268144860 */, 18 }, /* 4318 */ { MAD_F(0x044aa91c) /* 0.268227681 */, 18 }, /* 4319 */ { MAD_F(0x044afff6) /* 0.268310509 */, 18 }, /* 4320 */ { MAD_F(0x044b56d1) /* 0.268393343 */, 18 }, /* 4321 */ { MAD_F(0x044badaf) /* 0.268476184 */, 18 }, /* 4322 */ { MAD_F(0x044c048e) /* 0.268559031 */, 18 }, /* 4323 */ { MAD_F(0x044c5b6f) /* 0.268641885 */, 18 }, /* 4324 */ { MAD_F(0x044cb251) /* 0.268724744 */, 18 }, /* 4325 */ { MAD_F(0x044d0935) /* 0.268807611 */, 18 }, /* 4326 */ { MAD_F(0x044d601b) /* 0.268890483 */, 18 }, /* 4327 */ { MAD_F(0x044db703) /* 0.268973362 */, 18 }, /* 4328 */ { MAD_F(0x044e0dec) /* 0.269056248 */, 18 }, /* 4329 */ { MAD_F(0x044e64d7) /* 0.269139139 */, 18 }, /* 4330 */ { MAD_F(0x044ebbc4) /* 0.269222037 */, 18 }, /* 4331 */ { MAD_F(0x044f12b3) /* 0.269304942 */, 18 }, /* 4332 */ { MAD_F(0x044f69a3) /* 0.269387853 */, 18 }, /* 4333 */ { MAD_F(0x044fc095) /* 0.269470770 */, 18 }, /* 4334 */ { MAD_F(0x04501788) /* 0.269553694 */, 18 }, /* 4335 */ { MAD_F(0x04506e7e) /* 0.269636624 */, 18 }, /* 4336 */ { MAD_F(0x0450c575) /* 0.269719560 */, 18 }, /* 4337 */ { MAD_F(0x04511c6e) /* 0.269802503 */, 18 }, /* 4338 */ { MAD_F(0x04517368) /* 0.269885452 */, 18 }, /* 4339 */ { MAD_F(0x0451ca64) /* 0.269968408 */, 18 }, /* 4340 */ { MAD_F(0x04522162) /* 0.270051370 */, 18 }, /* 4341 */ { MAD_F(0x04527862) /* 0.270134338 */, 18 }, /* 4342 */ { MAD_F(0x0452cf63) /* 0.270217312 */, 18 }, /* 4343 */ { MAD_F(0x04532666) /* 0.270300293 */, 18 }, /* 4344 */ { MAD_F(0x04537d6b) /* 0.270383281 */, 18 }, /* 4345 */ { MAD_F(0x0453d472) /* 0.270466275 */, 18 }, /* 4346 */ { MAD_F(0x04542b7a) /* 0.270549275 */, 18 }, /* 4347 */ { MAD_F(0x04548284) /* 0.270632281 */, 18 }, /* 4348 */ { MAD_F(0x0454d98f) /* 0.270715294 */, 18 }, /* 4349 */ { MAD_F(0x0455309c) /* 0.270798313 */, 18 }, /* 4350 */ { MAD_F(0x045587ab) /* 0.270881339 */, 18 }, /* 4351 */ { MAD_F(0x0455debc) /* 0.270964371 */, 18 }, /* 4352 */ { MAD_F(0x045635cf) /* 0.271047409 */, 18 }, /* 4353 */ { MAD_F(0x04568ce3) /* 0.271130454 */, 18 }, /* 4354 */ { MAD_F(0x0456e3f9) /* 0.271213505 */, 18 }, /* 4355 */ { MAD_F(0x04573b10) /* 0.271296562 */, 18 }, /* 4356 */ { MAD_F(0x04579229) /* 0.271379626 */, 18 }, /* 4357 */ { MAD_F(0x0457e944) /* 0.271462696 */, 18 }, /* 4358 */ { MAD_F(0x04584061) /* 0.271545772 */, 18 }, /* 4359 */ { MAD_F(0x0458977f) /* 0.271628855 */, 18 }, /* 4360 */ { MAD_F(0x0458ee9f) /* 0.271711944 */, 18 }, /* 4361 */ { MAD_F(0x045945c1) /* 0.271795040 */, 18 }, /* 4362 */ { MAD_F(0x04599ce5) /* 0.271878142 */, 18 }, /* 4363 */ { MAD_F(0x0459f40a) /* 0.271961250 */, 18 }, /* 4364 */ { MAD_F(0x045a4b31) /* 0.272044365 */, 18 }, /* 4365 */ { MAD_F(0x045aa259) /* 0.272127486 */, 18 }, /* 4366 */ { MAD_F(0x045af984) /* 0.272210613 */, 18 }, /* 4367 */ { MAD_F(0x045b50b0) /* 0.272293746 */, 18 }, /* 4368 */ { MAD_F(0x045ba7dd) /* 0.272376886 */, 18 }, /* 4369 */ { MAD_F(0x045bff0d) /* 0.272460033 */, 18 }, /* 4370 */ { MAD_F(0x045c563e) /* 0.272543185 */, 18 }, /* 4371 */ { MAD_F(0x045cad71) /* 0.272626344 */, 18 }, /* 4372 */ { MAD_F(0x045d04a5) /* 0.272709510 */, 18 }, /* 4373 */ { MAD_F(0x045d5bdc) /* 0.272792681 */, 18 }, /* 4374 */ { MAD_F(0x045db313) /* 0.272875859 */, 18 }, /* 4375 */ { MAD_F(0x045e0a4d) /* 0.272959044 */, 18 }, /* 4376 */ { MAD_F(0x045e6188) /* 0.273042234 */, 18 }, /* 4377 */ { MAD_F(0x045eb8c5) /* 0.273125431 */, 18 }, /* 4378 */ { MAD_F(0x045f1004) /* 0.273208635 */, 18 }, /* 4379 */ { MAD_F(0x045f6745) /* 0.273291844 */, 18 }, /* 4380 */ { MAD_F(0x045fbe87) /* 0.273375060 */, 18 }, /* 4381 */ { MAD_F(0x046015cb) /* 0.273458283 */, 18 }, /* 4382 */ { MAD_F(0x04606d10) /* 0.273541511 */, 18 }, /* 4383 */ { MAD_F(0x0460c457) /* 0.273624747 */, 18 }, /* 4384 */ { MAD_F(0x04611ba0) /* 0.273707988 */, 18 }, /* 4385 */ { MAD_F(0x046172eb) /* 0.273791236 */, 18 }, /* 4386 */ { MAD_F(0x0461ca37) /* 0.273874490 */, 18 }, /* 4387 */ { MAD_F(0x04622185) /* 0.273957750 */, 18 }, /* 4388 */ { MAD_F(0x046278d5) /* 0.274041017 */, 18 }, /* 4389 */ { MAD_F(0x0462d026) /* 0.274124290 */, 18 }, /* 4390 */ { MAD_F(0x0463277a) /* 0.274207569 */, 18 }, /* 4391 */ { MAD_F(0x04637ece) /* 0.274290855 */, 18 }, /* 4392 */ { MAD_F(0x0463d625) /* 0.274374147 */, 18 }, /* 4393 */ { MAD_F(0x04642d7d) /* 0.274457445 */, 18 }, /* 4394 */ { MAD_F(0x046484d7) /* 0.274540749 */, 18 }, /* 4395 */ { MAD_F(0x0464dc33) /* 0.274624060 */, 18 }, /* 4396 */ { MAD_F(0x04653390) /* 0.274707378 */, 18 }, /* 4397 */ { MAD_F(0x04658aef) /* 0.274790701 */, 18 }, /* 4398 */ { MAD_F(0x0465e250) /* 0.274874031 */, 18 }, /* 4399 */ { MAD_F(0x046639b2) /* 0.274957367 */, 18 }, /* 4400 */ { MAD_F(0x04669116) /* 0.275040710 */, 18 }, /* 4401 */ { MAD_F(0x0466e87c) /* 0.275124059 */, 18 }, /* 4402 */ { MAD_F(0x04673fe3) /* 0.275207414 */, 18 }, /* 4403 */ { MAD_F(0x0467974d) /* 0.275290775 */, 18 }, /* 4404 */ { MAD_F(0x0467eeb7) /* 0.275374143 */, 18 }, /* 4405 */ { MAD_F(0x04684624) /* 0.275457517 */, 18 }, /* 4406 */ { MAD_F(0x04689d92) /* 0.275540897 */, 18 }, /* 4407 */ { MAD_F(0x0468f502) /* 0.275624284 */, 18 }, /* 4408 */ { MAD_F(0x04694c74) /* 0.275707677 */, 18 }, /* 4409 */ { MAD_F(0x0469a3e7) /* 0.275791076 */, 18 }, /* 4410 */ { MAD_F(0x0469fb5c) /* 0.275874482 */, 18 }, /* 4411 */ { MAD_F(0x046a52d3) /* 0.275957894 */, 18 }, /* 4412 */ { MAD_F(0x046aaa4b) /* 0.276041312 */, 18 }, /* 4413 */ { MAD_F(0x046b01c5) /* 0.276124737 */, 18 }, /* 4414 */ { MAD_F(0x046b5941) /* 0.276208167 */, 18 }, /* 4415 */ { MAD_F(0x046bb0bf) /* 0.276291605 */, 18 }, /* 4416 */ { MAD_F(0x046c083e) /* 0.276375048 */, 18 }, /* 4417 */ { MAD_F(0x046c5fbf) /* 0.276458498 */, 18 }, /* 4418 */ { MAD_F(0x046cb741) /* 0.276541954 */, 18 }, /* 4419 */ { MAD_F(0x046d0ec5) /* 0.276625416 */, 18 }, /* 4420 */ { MAD_F(0x046d664b) /* 0.276708885 */, 18 }, /* 4421 */ { MAD_F(0x046dbdd3) /* 0.276792360 */, 18 }, /* 4422 */ { MAD_F(0x046e155c) /* 0.276875841 */, 18 }, /* 4423 */ { MAD_F(0x046e6ce7) /* 0.276959328 */, 18 }, /* 4424 */ { MAD_F(0x046ec474) /* 0.277042822 */, 18 }, /* 4425 */ { MAD_F(0x046f1c02) /* 0.277126322 */, 18 }, /* 4426 */ { MAD_F(0x046f7392) /* 0.277209829 */, 18 }, /* 4427 */ { MAD_F(0x046fcb24) /* 0.277293341 */, 18 }, /* 4428 */ { MAD_F(0x047022b8) /* 0.277376860 */, 18 }, /* 4429 */ { MAD_F(0x04707a4d) /* 0.277460385 */, 18 }, /* 4430 */ { MAD_F(0x0470d1e4) /* 0.277543917 */, 18 }, /* 4431 */ { MAD_F(0x0471297c) /* 0.277627455 */, 18 }, /* 4432 */ { MAD_F(0x04718116) /* 0.277710999 */, 18 }, /* 4433 */ { MAD_F(0x0471d8b2) /* 0.277794549 */, 18 }, /* 4434 */ { MAD_F(0x04723050) /* 0.277878106 */, 18 }, /* 4435 */ { MAD_F(0x047287ef) /* 0.277961669 */, 18 }, /* 4436 */ { MAD_F(0x0472df90) /* 0.278045238 */, 18 }, /* 4437 */ { MAD_F(0x04733733) /* 0.278128813 */, 18 }, /* 4438 */ { MAD_F(0x04738ed7) /* 0.278212395 */, 18 }, /* 4439 */ { MAD_F(0x0473e67d) /* 0.278295983 */, 18 }, /* 4440 */ { MAD_F(0x04743e25) /* 0.278379578 */, 18 }, /* 4441 */ { MAD_F(0x047495ce) /* 0.278463178 */, 18 }, /* 4442 */ { MAD_F(0x0474ed79) /* 0.278546785 */, 18 }, /* 4443 */ { MAD_F(0x04754526) /* 0.278630398 */, 18 }, /* 4444 */ { MAD_F(0x04759cd4) /* 0.278714018 */, 18 }, /* 4445 */ { MAD_F(0x0475f484) /* 0.278797643 */, 18 }, /* 4446 */ { MAD_F(0x04764c36) /* 0.278881275 */, 18 }, /* 4447 */ { MAD_F(0x0476a3ea) /* 0.278964914 */, 18 }, /* 4448 */ { MAD_F(0x0476fb9f) /* 0.279048558 */, 18 }, /* 4449 */ { MAD_F(0x04775356) /* 0.279132209 */, 18 }, /* 4450 */ { MAD_F(0x0477ab0e) /* 0.279215866 */, 18 }, /* 4451 */ { MAD_F(0x047802c8) /* 0.279299529 */, 18 }, /* 4452 */ { MAD_F(0x04785a84) /* 0.279383199 */, 18 }, /* 4453 */ { MAD_F(0x0478b242) /* 0.279466875 */, 18 }, /* 4454 */ { MAD_F(0x04790a01) /* 0.279550557 */, 18 }, /* 4455 */ { MAD_F(0x047961c2) /* 0.279634245 */, 18 }, /* 4456 */ { MAD_F(0x0479b984) /* 0.279717940 */, 18 }, /* 4457 */ { MAD_F(0x047a1149) /* 0.279801641 */, 18 }, /* 4458 */ { MAD_F(0x047a690f) /* 0.279885348 */, 18 }, /* 4459 */ { MAD_F(0x047ac0d6) /* 0.279969061 */, 18 }, /* 4460 */ { MAD_F(0x047b18a0) /* 0.280052781 */, 18 }, /* 4461 */ { MAD_F(0x047b706b) /* 0.280136507 */, 18 }, /* 4462 */ { MAD_F(0x047bc837) /* 0.280220239 */, 18 }, /* 4463 */ { MAD_F(0x047c2006) /* 0.280303978 */, 18 }, /* 4464 */ { MAD_F(0x047c77d6) /* 0.280387722 */, 18 }, /* 4465 */ { MAD_F(0x047ccfa8) /* 0.280471473 */, 18 }, /* 4466 */ { MAD_F(0x047d277b) /* 0.280555230 */, 18 }, /* 4467 */ { MAD_F(0x047d7f50) /* 0.280638994 */, 18 }, /* 4468 */ { MAD_F(0x047dd727) /* 0.280722764 */, 18 }, /* 4469 */ { MAD_F(0x047e2eff) /* 0.280806540 */, 18 }, /* 4470 */ { MAD_F(0x047e86d9) /* 0.280890322 */, 18 }, /* 4471 */ { MAD_F(0x047edeb5) /* 0.280974110 */, 18 }, /* 4472 */ { MAD_F(0x047f3693) /* 0.281057905 */, 18 }, /* 4473 */ { MAD_F(0x047f8e72) /* 0.281141706 */, 18 }, /* 4474 */ { MAD_F(0x047fe653) /* 0.281225513 */, 18 }, /* 4475 */ { MAD_F(0x04803e35) /* 0.281309326 */, 18 }, /* 4476 */ { MAD_F(0x04809619) /* 0.281393146 */, 18 }, /* 4477 */ { MAD_F(0x0480edff) /* 0.281476972 */, 18 }, /* 4478 */ { MAD_F(0x048145e7) /* 0.281560804 */, 18 }, /* 4479 */ { MAD_F(0x04819dd0) /* 0.281644643 */, 18 }, /* 4480 */ { MAD_F(0x0481f5bb) /* 0.281728487 */, 18 }, /* 4481 */ { MAD_F(0x04824da7) /* 0.281812338 */, 18 }, /* 4482 */ { MAD_F(0x0482a595) /* 0.281896195 */, 18 }, /* 4483 */ { MAD_F(0x0482fd85) /* 0.281980059 */, 18 }, /* 4484 */ { MAD_F(0x04835577) /* 0.282063928 */, 18 }, /* 4485 */ { MAD_F(0x0483ad6a) /* 0.282147804 */, 18 }, /* 4486 */ { MAD_F(0x0484055f) /* 0.282231686 */, 18 }, /* 4487 */ { MAD_F(0x04845d56) /* 0.282315574 */, 18 }, /* 4488 */ { MAD_F(0x0484b54e) /* 0.282399469 */, 18 }, /* 4489 */ { MAD_F(0x04850d48) /* 0.282483370 */, 18 }, /* 4490 */ { MAD_F(0x04856544) /* 0.282567277 */, 18 }, /* 4491 */ { MAD_F(0x0485bd41) /* 0.282651190 */, 18 }, /* 4492 */ { MAD_F(0x04861540) /* 0.282735109 */, 18 }, /* 4493 */ { MAD_F(0x04866d40) /* 0.282819035 */, 18 }, /* 4494 */ { MAD_F(0x0486c543) /* 0.282902967 */, 18 }, /* 4495 */ { MAD_F(0x04871d47) /* 0.282986905 */, 18 }, /* 4496 */ { MAD_F(0x0487754c) /* 0.283070849 */, 18 }, /* 4497 */ { MAD_F(0x0487cd54) /* 0.283154800 */, 18 }, /* 4498 */ { MAD_F(0x0488255d) /* 0.283238757 */, 18 }, /* 4499 */ { MAD_F(0x04887d67) /* 0.283322720 */, 18 }, /* 4500 */ { MAD_F(0x0488d574) /* 0.283406689 */, 18 }, /* 4501 */ { MAD_F(0x04892d82) /* 0.283490665 */, 18 }, /* 4502 */ { MAD_F(0x04898591) /* 0.283574646 */, 18 }, /* 4503 */ { MAD_F(0x0489dda3) /* 0.283658634 */, 18 }, /* 4504 */ { MAD_F(0x048a35b6) /* 0.283742628 */, 18 }, /* 4505 */ { MAD_F(0x048a8dca) /* 0.283826629 */, 18 }, /* 4506 */ { MAD_F(0x048ae5e1) /* 0.283910635 */, 18 }, /* 4507 */ { MAD_F(0x048b3df9) /* 0.283994648 */, 18 }, /* 4508 */ { MAD_F(0x048b9612) /* 0.284078667 */, 18 }, /* 4509 */ { MAD_F(0x048bee2e) /* 0.284162692 */, 18 }, /* 4510 */ { MAD_F(0x048c464b) /* 0.284246723 */, 18 }, /* 4511 */ { MAD_F(0x048c9e69) /* 0.284330761 */, 18 }, /* 4512 */ { MAD_F(0x048cf68a) /* 0.284414805 */, 18 }, /* 4513 */ { MAD_F(0x048d4eac) /* 0.284498855 */, 18 }, /* 4514 */ { MAD_F(0x048da6cf) /* 0.284582911 */, 18 }, /* 4515 */ { MAD_F(0x048dfef5) /* 0.284666974 */, 18 }, /* 4516 */ { MAD_F(0x048e571c) /* 0.284751042 */, 18 }, /* 4517 */ { MAD_F(0x048eaf44) /* 0.284835117 */, 18 }, /* 4518 */ { MAD_F(0x048f076f) /* 0.284919198 */, 18 }, /* 4519 */ { MAD_F(0x048f5f9b) /* 0.285003285 */, 18 }, /* 4520 */ { MAD_F(0x048fb7c8) /* 0.285087379 */, 18 }, /* 4521 */ { MAD_F(0x04900ff8) /* 0.285171479 */, 18 }, /* 4522 */ { MAD_F(0x04906829) /* 0.285255584 */, 18 }, /* 4523 */ { MAD_F(0x0490c05b) /* 0.285339697 */, 18 }, /* 4524 */ { MAD_F(0x04911890) /* 0.285423815 */, 18 }, /* 4525 */ { MAD_F(0x049170c6) /* 0.285507939 */, 18 }, /* 4526 */ { MAD_F(0x0491c8fd) /* 0.285592070 */, 18 }, /* 4527 */ { MAD_F(0x04922137) /* 0.285676207 */, 18 }, /* 4528 */ { MAD_F(0x04927972) /* 0.285760350 */, 18 }, /* 4529 */ { MAD_F(0x0492d1ae) /* 0.285844499 */, 18 }, /* 4530 */ { MAD_F(0x049329ed) /* 0.285928655 */, 18 }, /* 4531 */ { MAD_F(0x0493822c) /* 0.286012816 */, 18 }, /* 4532 */ { MAD_F(0x0493da6e) /* 0.286096984 */, 18 }, /* 4533 */ { MAD_F(0x049432b1) /* 0.286181158 */, 18 }, /* 4534 */ { MAD_F(0x04948af6) /* 0.286265338 */, 18 }, /* 4535 */ { MAD_F(0x0494e33d) /* 0.286349525 */, 18 }, /* 4536 */ { MAD_F(0x04953b85) /* 0.286433717 */, 18 }, /* 4537 */ { MAD_F(0x049593cf) /* 0.286517916 */, 18 }, /* 4538 */ { MAD_F(0x0495ec1b) /* 0.286602121 */, 18 }, /* 4539 */ { MAD_F(0x04964468) /* 0.286686332 */, 18 }, /* 4540 */ { MAD_F(0x04969cb7) /* 0.286770550 */, 18 }, /* 4541 */ { MAD_F(0x0496f508) /* 0.286854773 */, 18 }, /* 4542 */ { MAD_F(0x04974d5a) /* 0.286939003 */, 18 }, /* 4543 */ { MAD_F(0x0497a5ae) /* 0.287023239 */, 18 }, /* 4544 */ { MAD_F(0x0497fe03) /* 0.287107481 */, 18 }, /* 4545 */ { MAD_F(0x0498565a) /* 0.287191729 */, 18 }, /* 4546 */ { MAD_F(0x0498aeb3) /* 0.287275983 */, 18 }, /* 4547 */ { MAD_F(0x0499070e) /* 0.287360244 */, 18 }, /* 4548 */ { MAD_F(0x04995f6a) /* 0.287444511 */, 18 }, /* 4549 */ { MAD_F(0x0499b7c8) /* 0.287528784 */, 18 }, /* 4550 */ { MAD_F(0x049a1027) /* 0.287613063 */, 18 }, /* 4551 */ { MAD_F(0x049a6889) /* 0.287697348 */, 18 }, /* 4552 */ { MAD_F(0x049ac0eb) /* 0.287781640 */, 18 }, /* 4553 */ { MAD_F(0x049b1950) /* 0.287865937 */, 18 }, /* 4554 */ { MAD_F(0x049b71b6) /* 0.287950241 */, 18 }, /* 4555 */ { MAD_F(0x049bca1e) /* 0.288034551 */, 18 }, /* 4556 */ { MAD_F(0x049c2287) /* 0.288118867 */, 18 }, /* 4557 */ { MAD_F(0x049c7af2) /* 0.288203190 */, 18 }, /* 4558 */ { MAD_F(0x049cd35f) /* 0.288287518 */, 18 }, /* 4559 */ { MAD_F(0x049d2bce) /* 0.288371853 */, 18 }, /* 4560 */ { MAD_F(0x049d843e) /* 0.288456194 */, 18 }, /* 4561 */ { MAD_F(0x049ddcaf) /* 0.288540541 */, 18 }, /* 4562 */ { MAD_F(0x049e3523) /* 0.288624894 */, 18 }, /* 4563 */ { MAD_F(0x049e8d98) /* 0.288709253 */, 18 }, /* 4564 */ { MAD_F(0x049ee60e) /* 0.288793619 */, 18 }, /* 4565 */ { MAD_F(0x049f3e87) /* 0.288877990 */, 18 }, /* 4566 */ { MAD_F(0x049f9701) /* 0.288962368 */, 18 }, /* 4567 */ { MAD_F(0x049fef7c) /* 0.289046752 */, 18 }, /* 4568 */ { MAD_F(0x04a047fa) /* 0.289131142 */, 18 }, /* 4569 */ { MAD_F(0x04a0a079) /* 0.289215538 */, 18 }, /* 4570 */ { MAD_F(0x04a0f8f9) /* 0.289299941 */, 18 }, /* 4571 */ { MAD_F(0x04a1517c) /* 0.289384349 */, 18 }, /* 4572 */ { MAD_F(0x04a1a9ff) /* 0.289468764 */, 18 }, /* 4573 */ { MAD_F(0x04a20285) /* 0.289553185 */, 18 }, /* 4574 */ { MAD_F(0x04a25b0c) /* 0.289637612 */, 18 }, /* 4575 */ { MAD_F(0x04a2b395) /* 0.289722045 */, 18 }, /* 4576 */ { MAD_F(0x04a30c20) /* 0.289806485 */, 18 }, /* 4577 */ { MAD_F(0x04a364ac) /* 0.289890930 */, 18 }, /* 4578 */ { MAD_F(0x04a3bd3a) /* 0.289975382 */, 18 }, /* 4579 */ { MAD_F(0x04a415c9) /* 0.290059840 */, 18 }, /* 4580 */ { MAD_F(0x04a46e5a) /* 0.290144304 */, 18 }, /* 4581 */ { MAD_F(0x04a4c6ed) /* 0.290228774 */, 18 }, /* 4582 */ { MAD_F(0x04a51f81) /* 0.290313250 */, 18 }, /* 4583 */ { MAD_F(0x04a57818) /* 0.290397733 */, 18 }, /* 4584 */ { MAD_F(0x04a5d0af) /* 0.290482221 */, 18 }, /* 4585 */ { MAD_F(0x04a62949) /* 0.290566716 */, 18 }, /* 4586 */ { MAD_F(0x04a681e4) /* 0.290651217 */, 18 }, /* 4587 */ { MAD_F(0x04a6da80) /* 0.290735724 */, 18 }, /* 4588 */ { MAD_F(0x04a7331f) /* 0.290820237 */, 18 }, /* 4589 */ { MAD_F(0x04a78bbf) /* 0.290904756 */, 18 }, /* 4590 */ { MAD_F(0x04a7e460) /* 0.290989281 */, 18 }, /* 4591 */ { MAD_F(0x04a83d03) /* 0.291073813 */, 18 }, /* 4592 */ { MAD_F(0x04a895a8) /* 0.291158351 */, 18 }, /* 4593 */ { MAD_F(0x04a8ee4f) /* 0.291242894 */, 18 }, /* 4594 */ { MAD_F(0x04a946f7) /* 0.291327444 */, 18 }, /* 4595 */ { MAD_F(0x04a99fa1) /* 0.291412001 */, 18 }, /* 4596 */ { MAD_F(0x04a9f84c) /* 0.291496563 */, 18 }, /* 4597 */ { MAD_F(0x04aa50fa) /* 0.291581131 */, 18 }, /* 4598 */ { MAD_F(0x04aaa9a8) /* 0.291665706 */, 18 }, /* 4599 */ { MAD_F(0x04ab0259) /* 0.291750286 */, 18 }, /* 4600 */ { MAD_F(0x04ab5b0b) /* 0.291834873 */, 18 }, /* 4601 */ { MAD_F(0x04abb3bf) /* 0.291919466 */, 18 }, /* 4602 */ { MAD_F(0x04ac0c74) /* 0.292004065 */, 18 }, /* 4603 */ { MAD_F(0x04ac652b) /* 0.292088670 */, 18 }, /* 4604 */ { MAD_F(0x04acbde4) /* 0.292173281 */, 18 }, /* 4605 */ { MAD_F(0x04ad169e) /* 0.292257899 */, 18 }, /* 4606 */ { MAD_F(0x04ad6f5a) /* 0.292342522 */, 18 }, /* 4607 */ { MAD_F(0x04adc818) /* 0.292427152 */, 18 }, /* 4608 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 18 }, /* 4609 */ { MAD_F(0x04ae7998) /* 0.292596430 */, 18 }, /* 4610 */ { MAD_F(0x04aed25a) /* 0.292681078 */, 18 }, /* 4611 */ { MAD_F(0x04af2b1e) /* 0.292765732 */, 18 }, /* 4612 */ { MAD_F(0x04af83e4) /* 0.292850392 */, 18 }, /* 4613 */ { MAD_F(0x04afdcac) /* 0.292935058 */, 18 }, /* 4614 */ { MAD_F(0x04b03575) /* 0.293019731 */, 18 }, /* 4615 */ { MAD_F(0x04b08e40) /* 0.293104409 */, 18 }, /* 4616 */ { MAD_F(0x04b0e70c) /* 0.293189094 */, 18 }, /* 4617 */ { MAD_F(0x04b13fda) /* 0.293273785 */, 18 }, /* 4618 */ { MAD_F(0x04b198aa) /* 0.293358482 */, 18 }, /* 4619 */ { MAD_F(0x04b1f17b) /* 0.293443185 */, 18 }, /* 4620 */ { MAD_F(0x04b24a4e) /* 0.293527894 */, 18 }, /* 4621 */ { MAD_F(0x04b2a322) /* 0.293612609 */, 18 }, /* 4622 */ { MAD_F(0x04b2fbf9) /* 0.293697331 */, 18 }, /* 4623 */ { MAD_F(0x04b354d1) /* 0.293782058 */, 18 }, /* 4624 */ { MAD_F(0x04b3adaa) /* 0.293866792 */, 18 }, /* 4625 */ { MAD_F(0x04b40685) /* 0.293951532 */, 18 }, /* 4626 */ { MAD_F(0x04b45f62) /* 0.294036278 */, 18 }, /* 4627 */ { MAD_F(0x04b4b840) /* 0.294121029 */, 18 }, /* 4628 */ { MAD_F(0x04b51120) /* 0.294205788 */, 18 }, /* 4629 */ { MAD_F(0x04b56a02) /* 0.294290552 */, 18 }, /* 4630 */ { MAD_F(0x04b5c2e6) /* 0.294375322 */, 18 }, /* 4631 */ { MAD_F(0x04b61bcb) /* 0.294460098 */, 18 }, /* 4632 */ { MAD_F(0x04b674b1) /* 0.294544881 */, 18 }, /* 4633 */ { MAD_F(0x04b6cd99) /* 0.294629669 */, 18 }, /* 4634 */ { MAD_F(0x04b72683) /* 0.294714464 */, 18 }, /* 4635 */ { MAD_F(0x04b77f6f) /* 0.294799265 */, 18 }, /* 4636 */ { MAD_F(0x04b7d85c) /* 0.294884072 */, 18 }, /* 4637 */ { MAD_F(0x04b8314b) /* 0.294968885 */, 18 }, /* 4638 */ { MAD_F(0x04b88a3b) /* 0.295053704 */, 18 }, /* 4639 */ { MAD_F(0x04b8e32d) /* 0.295138529 */, 18 }, /* 4640 */ { MAD_F(0x04b93c21) /* 0.295223360 */, 18 }, /* 4641 */ { MAD_F(0x04b99516) /* 0.295308197 */, 18 }, /* 4642 */ { MAD_F(0x04b9ee0d) /* 0.295393041 */, 18 }, /* 4643 */ { MAD_F(0x04ba4706) /* 0.295477890 */, 18 }, /* 4644 */ { MAD_F(0x04baa000) /* 0.295562746 */, 18 }, /* 4645 */ { MAD_F(0x04baf8fc) /* 0.295647608 */, 18 }, /* 4646 */ { MAD_F(0x04bb51fa) /* 0.295732476 */, 18 }, /* 4647 */ { MAD_F(0x04bbaaf9) /* 0.295817349 */, 18 }, /* 4648 */ { MAD_F(0x04bc03fa) /* 0.295902229 */, 18 }, /* 4649 */ { MAD_F(0x04bc5cfc) /* 0.295987115 */, 18 }, /* 4650 */ { MAD_F(0x04bcb600) /* 0.296072008 */, 18 }, /* 4651 */ { MAD_F(0x04bd0f06) /* 0.296156906 */, 18 }, /* 4652 */ { MAD_F(0x04bd680d) /* 0.296241810 */, 18 }, /* 4653 */ { MAD_F(0x04bdc116) /* 0.296326721 */, 18 }, /* 4654 */ { MAD_F(0x04be1a21) /* 0.296411637 */, 18 }, /* 4655 */ { MAD_F(0x04be732d) /* 0.296496560 */, 18 }, /* 4656 */ { MAD_F(0x04becc3b) /* 0.296581488 */, 18 }, /* 4657 */ { MAD_F(0x04bf254a) /* 0.296666423 */, 18 }, /* 4658 */ { MAD_F(0x04bf7e5b) /* 0.296751364 */, 18 }, /* 4659 */ { MAD_F(0x04bfd76e) /* 0.296836311 */, 18 }, /* 4660 */ { MAD_F(0x04c03083) /* 0.296921264 */, 18 }, /* 4661 */ { MAD_F(0x04c08999) /* 0.297006223 */, 18 }, /* 4662 */ { MAD_F(0x04c0e2b0) /* 0.297091188 */, 18 }, /* 4663 */ { MAD_F(0x04c13bca) /* 0.297176159 */, 18 }, /* 4664 */ { MAD_F(0x04c194e4) /* 0.297261136 */, 18 }, /* 4665 */ { MAD_F(0x04c1ee01) /* 0.297346120 */, 18 }, /* 4666 */ { MAD_F(0x04c2471f) /* 0.297431109 */, 18 }, /* 4667 */ { MAD_F(0x04c2a03f) /* 0.297516105 */, 18 }, /* 4668 */ { MAD_F(0x04c2f960) /* 0.297601106 */, 18 }, /* 4669 */ { MAD_F(0x04c35283) /* 0.297686114 */, 18 }, /* 4670 */ { MAD_F(0x04c3aba8) /* 0.297771128 */, 18 }, /* 4671 */ { MAD_F(0x04c404ce) /* 0.297856147 */, 18 }, /* 4672 */ { MAD_F(0x04c45df6) /* 0.297941173 */, 18 }, /* 4673 */ { MAD_F(0x04c4b720) /* 0.298026205 */, 18 }, /* 4674 */ { MAD_F(0x04c5104b) /* 0.298111243 */, 18 }, /* 4675 */ { MAD_F(0x04c56978) /* 0.298196287 */, 18 }, /* 4676 */ { MAD_F(0x04c5c2a7) /* 0.298281337 */, 18 }, /* 4677 */ { MAD_F(0x04c61bd7) /* 0.298366393 */, 18 }, /* 4678 */ { MAD_F(0x04c67508) /* 0.298451456 */, 18 }, /* 4679 */ { MAD_F(0x04c6ce3c) /* 0.298536524 */, 18 }, /* 4680 */ { MAD_F(0x04c72771) /* 0.298621598 */, 18 }, /* 4681 */ { MAD_F(0x04c780a7) /* 0.298706679 */, 18 }, /* 4682 */ { MAD_F(0x04c7d9df) /* 0.298791765 */, 18 }, /* 4683 */ { MAD_F(0x04c83319) /* 0.298876858 */, 18 }, /* 4684 */ { MAD_F(0x04c88c55) /* 0.298961956 */, 18 }, /* 4685 */ { MAD_F(0x04c8e592) /* 0.299047061 */, 18 }, /* 4686 */ { MAD_F(0x04c93ed1) /* 0.299132172 */, 18 }, /* 4687 */ { MAD_F(0x04c99811) /* 0.299217288 */, 18 }, /* 4688 */ { MAD_F(0x04c9f153) /* 0.299302411 */, 18 }, /* 4689 */ { MAD_F(0x04ca4a97) /* 0.299387540 */, 18 }, /* 4690 */ { MAD_F(0x04caa3dc) /* 0.299472675 */, 18 }, /* 4691 */ { MAD_F(0x04cafd23) /* 0.299557816 */, 18 }, /* 4692 */ { MAD_F(0x04cb566b) /* 0.299642963 */, 18 }, /* 4693 */ { MAD_F(0x04cbafb5) /* 0.299728116 */, 18 }, /* 4694 */ { MAD_F(0x04cc0901) /* 0.299813275 */, 18 }, /* 4695 */ { MAD_F(0x04cc624e) /* 0.299898440 */, 18 }, /* 4696 */ { MAD_F(0x04ccbb9d) /* 0.299983611 */, 18 }, /* 4697 */ { MAD_F(0x04cd14ee) /* 0.300068789 */, 18 }, /* 4698 */ { MAD_F(0x04cd6e40) /* 0.300153972 */, 18 }, /* 4699 */ { MAD_F(0x04cdc794) /* 0.300239161 */, 18 }, /* 4700 */ { MAD_F(0x04ce20e9) /* 0.300324357 */, 18 }, /* 4701 */ { MAD_F(0x04ce7a40) /* 0.300409558 */, 18 }, /* 4702 */ { MAD_F(0x04ced399) /* 0.300494765 */, 18 }, /* 4703 */ { MAD_F(0x04cf2cf3) /* 0.300579979 */, 18 }, /* 4704 */ { MAD_F(0x04cf864f) /* 0.300665198 */, 18 }, /* 4705 */ { MAD_F(0x04cfdfad) /* 0.300750424 */, 18 }, /* 4706 */ { MAD_F(0x04d0390c) /* 0.300835656 */, 18 }, /* 4707 */ { MAD_F(0x04d0926d) /* 0.300920893 */, 18 }, /* 4708 */ { MAD_F(0x04d0ebcf) /* 0.301006137 */, 18 }, /* 4709 */ { MAD_F(0x04d14533) /* 0.301091387 */, 18 }, /* 4710 */ { MAD_F(0x04d19e99) /* 0.301176643 */, 18 }, /* 4711 */ { MAD_F(0x04d1f800) /* 0.301261904 */, 18 }, /* 4712 */ { MAD_F(0x04d25169) /* 0.301347172 */, 18 }, /* 4713 */ { MAD_F(0x04d2aad4) /* 0.301432446 */, 18 }, /* 4714 */ { MAD_F(0x04d30440) /* 0.301517726 */, 18 }, /* 4715 */ { MAD_F(0x04d35dae) /* 0.301603012 */, 18 }, /* 4716 */ { MAD_F(0x04d3b71d) /* 0.301688304 */, 18 }, /* 4717 */ { MAD_F(0x04d4108e) /* 0.301773602 */, 18 }, /* 4718 */ { MAD_F(0x04d46a01) /* 0.301858906 */, 18 }, /* 4719 */ { MAD_F(0x04d4c375) /* 0.301944216 */, 18 }, /* 4720 */ { MAD_F(0x04d51ceb) /* 0.302029532 */, 18 }, /* 4721 */ { MAD_F(0x04d57662) /* 0.302114854 */, 18 }, /* 4722 */ { MAD_F(0x04d5cfdb) /* 0.302200182 */, 18 }, /* 4723 */ { MAD_F(0x04d62956) /* 0.302285516 */, 18 }, /* 4724 */ { MAD_F(0x04d682d2) /* 0.302370856 */, 18 }, /* 4725 */ { MAD_F(0x04d6dc50) /* 0.302456203 */, 18 }, /* 4726 */ { MAD_F(0x04d735d0) /* 0.302541555 */, 18 }, /* 4727 */ { MAD_F(0x04d78f51) /* 0.302626913 */, 18 }, /* 4728 */ { MAD_F(0x04d7e8d4) /* 0.302712277 */, 18 }, /* 4729 */ { MAD_F(0x04d84258) /* 0.302797648 */, 18 }, /* 4730 */ { MAD_F(0x04d89bde) /* 0.302883024 */, 18 }, /* 4731 */ { MAD_F(0x04d8f566) /* 0.302968406 */, 18 }, /* 4732 */ { MAD_F(0x04d94eef) /* 0.303053794 */, 18 }, /* 4733 */ { MAD_F(0x04d9a87a) /* 0.303139189 */, 18 }, /* 4734 */ { MAD_F(0x04da0207) /* 0.303224589 */, 18 }, /* 4735 */ { MAD_F(0x04da5b95) /* 0.303309995 */, 18 }, /* 4736 */ { MAD_F(0x04dab524) /* 0.303395408 */, 18 }, /* 4737 */ { MAD_F(0x04db0eb6) /* 0.303480826 */, 18 }, /* 4738 */ { MAD_F(0x04db6849) /* 0.303566251 */, 18 }, /* 4739 */ { MAD_F(0x04dbc1dd) /* 0.303651681 */, 18 }, /* 4740 */ { MAD_F(0x04dc1b73) /* 0.303737117 */, 18 }, /* 4741 */ { MAD_F(0x04dc750b) /* 0.303822560 */, 18 }, /* 4742 */ { MAD_F(0x04dccea5) /* 0.303908008 */, 18 }, /* 4743 */ { MAD_F(0x04dd2840) /* 0.303993463 */, 18 }, /* 4744 */ { MAD_F(0x04dd81dc) /* 0.304078923 */, 18 }, /* 4745 */ { MAD_F(0x04dddb7a) /* 0.304164390 */, 18 }, /* 4746 */ { MAD_F(0x04de351a) /* 0.304249862 */, 18 }, /* 4747 */ { MAD_F(0x04de8ebc) /* 0.304335340 */, 18 }, /* 4748 */ { MAD_F(0x04dee85f) /* 0.304420825 */, 18 }, /* 4749 */ { MAD_F(0x04df4203) /* 0.304506315 */, 18 }, /* 4750 */ { MAD_F(0x04df9baa) /* 0.304591812 */, 18 }, /* 4751 */ { MAD_F(0x04dff552) /* 0.304677314 */, 18 }, /* 4752 */ { MAD_F(0x04e04efb) /* 0.304762823 */, 18 }, /* 4753 */ { MAD_F(0x04e0a8a6) /* 0.304848337 */, 18 }, /* 4754 */ { MAD_F(0x04e10253) /* 0.304933858 */, 18 }, /* 4755 */ { MAD_F(0x04e15c01) /* 0.305019384 */, 18 }, /* 4756 */ { MAD_F(0x04e1b5b1) /* 0.305104917 */, 18 }, /* 4757 */ { MAD_F(0x04e20f63) /* 0.305190455 */, 18 }, /* 4758 */ { MAD_F(0x04e26916) /* 0.305275999 */, 18 }, /* 4759 */ { MAD_F(0x04e2c2cb) /* 0.305361550 */, 18 }, /* 4760 */ { MAD_F(0x04e31c81) /* 0.305447106 */, 18 }, /* 4761 */ { MAD_F(0x04e37639) /* 0.305532669 */, 18 }, /* 4762 */ { MAD_F(0x04e3cff3) /* 0.305618237 */, 18 }, /* 4763 */ { MAD_F(0x04e429ae) /* 0.305703811 */, 18 }, /* 4764 */ { MAD_F(0x04e4836b) /* 0.305789392 */, 18 }, /* 4765 */ { MAD_F(0x04e4dd29) /* 0.305874978 */, 18 }, /* 4766 */ { MAD_F(0x04e536e9) /* 0.305960571 */, 18 }, /* 4767 */ { MAD_F(0x04e590ab) /* 0.306046169 */, 18 }, /* 4768 */ { MAD_F(0x04e5ea6e) /* 0.306131773 */, 18 }, /* 4769 */ { MAD_F(0x04e64433) /* 0.306217383 */, 18 }, /* 4770 */ { MAD_F(0x04e69df9) /* 0.306303000 */, 18 }, /* 4771 */ { MAD_F(0x04e6f7c1) /* 0.306388622 */, 18 }, /* 4772 */ { MAD_F(0x04e7518b) /* 0.306474250 */, 18 }, /* 4773 */ { MAD_F(0x04e7ab56) /* 0.306559885 */, 18 }, /* 4774 */ { MAD_F(0x04e80523) /* 0.306645525 */, 18 }, /* 4775 */ { MAD_F(0x04e85ef2) /* 0.306731171 */, 18 }, /* 4776 */ { MAD_F(0x04e8b8c2) /* 0.306816823 */, 18 }, /* 4777 */ { MAD_F(0x04e91293) /* 0.306902481 */, 18 }, /* 4778 */ { MAD_F(0x04e96c67) /* 0.306988145 */, 18 }, /* 4779 */ { MAD_F(0x04e9c63b) /* 0.307073816 */, 18 }, /* 4780 */ { MAD_F(0x04ea2012) /* 0.307159492 */, 18 }, /* 4781 */ { MAD_F(0x04ea79ea) /* 0.307245174 */, 18 }, /* 4782 */ { MAD_F(0x04ead3c4) /* 0.307330862 */, 18 }, /* 4783 */ { MAD_F(0x04eb2d9f) /* 0.307416556 */, 18 }, /* 4784 */ { MAD_F(0x04eb877c) /* 0.307502256 */, 18 }, /* 4785 */ { MAD_F(0x04ebe15b) /* 0.307587962 */, 18 }, /* 4786 */ { MAD_F(0x04ec3b3b) /* 0.307673674 */, 18 }, /* 4787 */ { MAD_F(0x04ec951c) /* 0.307759392 */, 18 }, /* 4788 */ { MAD_F(0x04ecef00) /* 0.307845115 */, 18 }, /* 4789 */ { MAD_F(0x04ed48e5) /* 0.307930845 */, 18 }, /* 4790 */ { MAD_F(0x04eda2cb) /* 0.308016581 */, 18 }, /* 4791 */ { MAD_F(0x04edfcb3) /* 0.308102323 */, 18 }, /* 4792 */ { MAD_F(0x04ee569d) /* 0.308188071 */, 18 }, /* 4793 */ { MAD_F(0x04eeb088) /* 0.308273824 */, 18 }, /* 4794 */ { MAD_F(0x04ef0a75) /* 0.308359584 */, 18 }, /* 4795 */ { MAD_F(0x04ef6464) /* 0.308445350 */, 18 }, /* 4796 */ { MAD_F(0x04efbe54) /* 0.308531121 */, 18 }, /* 4797 */ { MAD_F(0x04f01846) /* 0.308616899 */, 18 }, /* 4798 */ { MAD_F(0x04f07239) /* 0.308702682 */, 18 }, /* 4799 */ { MAD_F(0x04f0cc2e) /* 0.308788472 */, 18 }, /* 4800 */ { MAD_F(0x04f12624) /* 0.308874267 */, 18 }, /* 4801 */ { MAD_F(0x04f1801d) /* 0.308960068 */, 18 }, /* 4802 */ { MAD_F(0x04f1da16) /* 0.309045876 */, 18 }, /* 4803 */ { MAD_F(0x04f23412) /* 0.309131689 */, 18 }, /* 4804 */ { MAD_F(0x04f28e0f) /* 0.309217508 */, 18 }, /* 4805 */ { MAD_F(0x04f2e80d) /* 0.309303334 */, 18 }, /* 4806 */ { MAD_F(0x04f3420d) /* 0.309389165 */, 18 }, /* 4807 */ { MAD_F(0x04f39c0f) /* 0.309475002 */, 18 }, /* 4808 */ { MAD_F(0x04f3f612) /* 0.309560845 */, 18 }, /* 4809 */ { MAD_F(0x04f45017) /* 0.309646694 */, 18 }, /* 4810 */ { MAD_F(0x04f4aa1e) /* 0.309732549 */, 18 }, /* 4811 */ { MAD_F(0x04f50426) /* 0.309818410 */, 18 }, /* 4812 */ { MAD_F(0x04f55e30) /* 0.309904277 */, 18 }, /* 4813 */ { MAD_F(0x04f5b83b) /* 0.309990150 */, 18 }, /* 4814 */ { MAD_F(0x04f61248) /* 0.310076028 */, 18 }, /* 4815 */ { MAD_F(0x04f66c56) /* 0.310161913 */, 18 }, /* 4816 */ { MAD_F(0x04f6c666) /* 0.310247804 */, 18 }, /* 4817 */ { MAD_F(0x04f72078) /* 0.310333700 */, 18 }, /* 4818 */ { MAD_F(0x04f77a8b) /* 0.310419603 */, 18 }, /* 4819 */ { MAD_F(0x04f7d4a0) /* 0.310505511 */, 18 }, /* 4820 */ { MAD_F(0x04f82eb7) /* 0.310591426 */, 18 }, /* 4821 */ { MAD_F(0x04f888cf) /* 0.310677346 */, 18 }, /* 4822 */ { MAD_F(0x04f8e2e9) /* 0.310763272 */, 18 }, /* 4823 */ { MAD_F(0x04f93d04) /* 0.310849205 */, 18 }, /* 4824 */ { MAD_F(0x04f99721) /* 0.310935143 */, 18 }, /* 4825 */ { MAD_F(0x04f9f13f) /* 0.311021087 */, 18 }, /* 4826 */ { MAD_F(0x04fa4b5f) /* 0.311107037 */, 18 }, /* 4827 */ { MAD_F(0x04faa581) /* 0.311192993 */, 18 }, /* 4828 */ { MAD_F(0x04faffa4) /* 0.311278955 */, 18 }, /* 4829 */ { MAD_F(0x04fb59c9) /* 0.311364923 */, 18 }, /* 4830 */ { MAD_F(0x04fbb3ef) /* 0.311450897 */, 18 }, /* 4831 */ { MAD_F(0x04fc0e17) /* 0.311536877 */, 18 }, /* 4832 */ { MAD_F(0x04fc6841) /* 0.311622862 */, 18 }, /* 4833 */ { MAD_F(0x04fcc26c) /* 0.311708854 */, 18 }, /* 4834 */ { MAD_F(0x04fd1c99) /* 0.311794851 */, 18 }, /* 4835 */ { MAD_F(0x04fd76c7) /* 0.311880855 */, 18 }, /* 4836 */ { MAD_F(0x04fdd0f7) /* 0.311966864 */, 18 }, /* 4837 */ { MAD_F(0x04fe2b29) /* 0.312052880 */, 18 }, /* 4838 */ { MAD_F(0x04fe855c) /* 0.312138901 */, 18 }, /* 4839 */ { MAD_F(0x04fedf91) /* 0.312224928 */, 18 }, /* 4840 */ { MAD_F(0x04ff39c7) /* 0.312310961 */, 18 }, /* 4841 */ { MAD_F(0x04ff93ff) /* 0.312397000 */, 18 }, /* 4842 */ { MAD_F(0x04ffee38) /* 0.312483045 */, 18 }, /* 4843 */ { MAD_F(0x05004874) /* 0.312569096 */, 18 }, /* 4844 */ { MAD_F(0x0500a2b0) /* 0.312655153 */, 18 }, /* 4845 */ { MAD_F(0x0500fcef) /* 0.312741216 */, 18 }, /* 4846 */ { MAD_F(0x0501572e) /* 0.312827284 */, 18 }, /* 4847 */ { MAD_F(0x0501b170) /* 0.312913359 */, 18 }, /* 4848 */ { MAD_F(0x05020bb3) /* 0.312999439 */, 18 }, /* 4849 */ { MAD_F(0x050265f8) /* 0.313085526 */, 18 }, /* 4850 */ { MAD_F(0x0502c03e) /* 0.313171618 */, 18 }, /* 4851 */ { MAD_F(0x05031a86) /* 0.313257716 */, 18 }, /* 4852 */ { MAD_F(0x050374cf) /* 0.313343820 */, 18 }, /* 4853 */ { MAD_F(0x0503cf1a) /* 0.313429931 */, 18 }, /* 4854 */ { MAD_F(0x05042967) /* 0.313516047 */, 18 }, /* 4855 */ { MAD_F(0x050483b5) /* 0.313602168 */, 18 }, /* 4856 */ { MAD_F(0x0504de05) /* 0.313688296 */, 18 }, /* 4857 */ { MAD_F(0x05053856) /* 0.313774430 */, 18 }, /* 4858 */ { MAD_F(0x050592a9) /* 0.313860570 */, 18 }, /* 4859 */ { MAD_F(0x0505ecfd) /* 0.313946715 */, 18 }, /* 4860 */ { MAD_F(0x05064754) /* 0.314032867 */, 18 }, /* 4861 */ { MAD_F(0x0506a1ab) /* 0.314119024 */, 18 }, /* 4862 */ { MAD_F(0x0506fc04) /* 0.314205187 */, 18 }, /* 4863 */ { MAD_F(0x0507565f) /* 0.314291357 */, 18 }, /* 4864 */ { MAD_F(0x0507b0bc) /* 0.314377532 */, 18 }, /* 4865 */ { MAD_F(0x05080b1a) /* 0.314463713 */, 18 }, /* 4866 */ { MAD_F(0x05086579) /* 0.314549900 */, 18 }, /* 4867 */ { MAD_F(0x0508bfdb) /* 0.314636092 */, 18 }, /* 4868 */ { MAD_F(0x05091a3d) /* 0.314722291 */, 18 }, /* 4869 */ { MAD_F(0x050974a2) /* 0.314808496 */, 18 }, /* 4870 */ { MAD_F(0x0509cf08) /* 0.314894706 */, 18 }, /* 4871 */ { MAD_F(0x050a296f) /* 0.314980923 */, 18 }, /* 4872 */ { MAD_F(0x050a83d8) /* 0.315067145 */, 18 }, /* 4873 */ { MAD_F(0x050ade43) /* 0.315153373 */, 18 }, /* 4874 */ { MAD_F(0x050b38af) /* 0.315239607 */, 18 }, /* 4875 */ { MAD_F(0x050b931d) /* 0.315325847 */, 18 }, /* 4876 */ { MAD_F(0x050bed8d) /* 0.315412093 */, 18 }, /* 4877 */ { MAD_F(0x050c47fe) /* 0.315498345 */, 18 }, /* 4878 */ { MAD_F(0x050ca271) /* 0.315584603 */, 18 }, /* 4879 */ { MAD_F(0x050cfce5) /* 0.315670866 */, 18 }, /* 4880 */ { MAD_F(0x050d575b) /* 0.315757136 */, 18 }, /* 4881 */ { MAD_F(0x050db1d2) /* 0.315843411 */, 18 }, /* 4882 */ { MAD_F(0x050e0c4b) /* 0.315929693 */, 18 }, /* 4883 */ { MAD_F(0x050e66c5) /* 0.316015980 */, 18 }, /* 4884 */ { MAD_F(0x050ec141) /* 0.316102273 */, 18 }, /* 4885 */ { MAD_F(0x050f1bbf) /* 0.316188572 */, 18 }, /* 4886 */ { MAD_F(0x050f763e) /* 0.316274877 */, 18 }, /* 4887 */ { MAD_F(0x050fd0bf) /* 0.316361187 */, 18 }, /* 4888 */ { MAD_F(0x05102b42) /* 0.316447504 */, 18 }, /* 4889 */ { MAD_F(0x051085c6) /* 0.316533826 */, 18 }, /* 4890 */ { MAD_F(0x0510e04b) /* 0.316620155 */, 18 }, /* 4891 */ { MAD_F(0x05113ad3) /* 0.316706489 */, 18 }, /* 4892 */ { MAD_F(0x0511955b) /* 0.316792829 */, 18 }, /* 4893 */ { MAD_F(0x0511efe6) /* 0.316879175 */, 18 }, /* 4894 */ { MAD_F(0x05124a72) /* 0.316965527 */, 18 }, /* 4895 */ { MAD_F(0x0512a4ff) /* 0.317051885 */, 18 }, /* 4896 */ { MAD_F(0x0512ff8e) /* 0.317138249 */, 18 }, /* 4897 */ { MAD_F(0x05135a1f) /* 0.317224618 */, 18 }, /* 4898 */ { MAD_F(0x0513b4b1) /* 0.317310994 */, 18 }, /* 4899 */ { MAD_F(0x05140f45) /* 0.317397375 */, 18 }, /* 4900 */ { MAD_F(0x051469da) /* 0.317483762 */, 18 }, /* 4901 */ { MAD_F(0x0514c471) /* 0.317570155 */, 18 }, /* 4902 */ { MAD_F(0x05151f0a) /* 0.317656554 */, 18 }, /* 4903 */ { MAD_F(0x051579a4) /* 0.317742959 */, 18 }, /* 4904 */ { MAD_F(0x0515d440) /* 0.317829370 */, 18 }, /* 4905 */ { MAD_F(0x05162edd) /* 0.317915786 */, 18 }, /* 4906 */ { MAD_F(0x0516897c) /* 0.318002209 */, 18 }, /* 4907 */ { MAD_F(0x0516e41c) /* 0.318088637 */, 18 }, /* 4908 */ { MAD_F(0x05173ebe) /* 0.318175071 */, 18 }, /* 4909 */ { MAD_F(0x05179962) /* 0.318261511 */, 18 }, /* 4910 */ { MAD_F(0x0517f407) /* 0.318347957 */, 18 }, /* 4911 */ { MAD_F(0x05184eae) /* 0.318434409 */, 18 }, /* 4912 */ { MAD_F(0x0518a956) /* 0.318520867 */, 18 }, /* 4913 */ { MAD_F(0x05190400) /* 0.318607330 */, 18 }, /* 4914 */ { MAD_F(0x05195eab) /* 0.318693800 */, 18 }, /* 4915 */ { MAD_F(0x0519b958) /* 0.318780275 */, 18 }, /* 4916 */ { MAD_F(0x051a1407) /* 0.318866756 */, 18 }, /* 4917 */ { MAD_F(0x051a6eb7) /* 0.318953243 */, 18 }, /* 4918 */ { MAD_F(0x051ac969) /* 0.319039736 */, 18 }, /* 4919 */ { MAD_F(0x051b241c) /* 0.319126235 */, 18 }, /* 4920 */ { MAD_F(0x051b7ed1) /* 0.319212739 */, 18 }, /* 4921 */ { MAD_F(0x051bd987) /* 0.319299250 */, 18 }, /* 4922 */ { MAD_F(0x051c3440) /* 0.319385766 */, 18 }, /* 4923 */ { MAD_F(0x051c8ef9) /* 0.319472288 */, 18 }, /* 4924 */ { MAD_F(0x051ce9b4) /* 0.319558816 */, 18 }, /* 4925 */ { MAD_F(0x051d4471) /* 0.319645350 */, 18 }, /* 4926 */ { MAD_F(0x051d9f2f) /* 0.319731890 */, 18 }, /* 4927 */ { MAD_F(0x051df9ef) /* 0.319818435 */, 18 }, /* 4928 */ { MAD_F(0x051e54b1) /* 0.319904987 */, 18 }, /* 4929 */ { MAD_F(0x051eaf74) /* 0.319991544 */, 18 }, /* 4930 */ { MAD_F(0x051f0a38) /* 0.320078107 */, 18 }, /* 4931 */ { MAD_F(0x051f64ff) /* 0.320164676 */, 18 }, /* 4932 */ { MAD_F(0x051fbfc6) /* 0.320251251 */, 18 }, /* 4933 */ { MAD_F(0x05201a90) /* 0.320337832 */, 18 }, /* 4934 */ { MAD_F(0x0520755b) /* 0.320424419 */, 18 }, /* 4935 */ { MAD_F(0x0520d027) /* 0.320511011 */, 18 }, /* 4936 */ { MAD_F(0x05212af5) /* 0.320597609 */, 18 }, /* 4937 */ { MAD_F(0x052185c5) /* 0.320684213 */, 18 }, /* 4938 */ { MAD_F(0x0521e096) /* 0.320770823 */, 18 }, /* 4939 */ { MAD_F(0x05223b69) /* 0.320857439 */, 18 }, /* 4940 */ { MAD_F(0x0522963d) /* 0.320944061 */, 18 }, /* 4941 */ { MAD_F(0x0522f113) /* 0.321030688 */, 18 }, /* 4942 */ { MAD_F(0x05234bea) /* 0.321117322 */, 18 }, /* 4943 */ { MAD_F(0x0523a6c3) /* 0.321203961 */, 18 }, /* 4944 */ { MAD_F(0x0524019e) /* 0.321290606 */, 18 }, /* 4945 */ { MAD_F(0x05245c7a) /* 0.321377257 */, 18 }, /* 4946 */ { MAD_F(0x0524b758) /* 0.321463913 */, 18 }, /* 4947 */ { MAD_F(0x05251237) /* 0.321550576 */, 18 }, /* 4948 */ { MAD_F(0x05256d18) /* 0.321637244 */, 18 }, /* 4949 */ { MAD_F(0x0525c7fb) /* 0.321723919 */, 18 }, /* 4950 */ { MAD_F(0x052622df) /* 0.321810599 */, 18 }, /* 4951 */ { MAD_F(0x05267dc4) /* 0.321897285 */, 18 }, /* 4952 */ { MAD_F(0x0526d8ab) /* 0.321983976 */, 18 }, /* 4953 */ { MAD_F(0x05273394) /* 0.322070674 */, 18 }, /* 4954 */ { MAD_F(0x05278e7e) /* 0.322157377 */, 18 }, /* 4955 */ { MAD_F(0x0527e96a) /* 0.322244087 */, 18 }, /* 4956 */ { MAD_F(0x05284457) /* 0.322330802 */, 18 }, /* 4957 */ { MAD_F(0x05289f46) /* 0.322417523 */, 18 }, /* 4958 */ { MAD_F(0x0528fa37) /* 0.322504249 */, 18 }, /* 4959 */ { MAD_F(0x05295529) /* 0.322590982 */, 18 }, /* 4960 */ { MAD_F(0x0529b01d) /* 0.322677720 */, 18 }, /* 4961 */ { MAD_F(0x052a0b12) /* 0.322764465 */, 18 }, /* 4962 */ { MAD_F(0x052a6609) /* 0.322851215 */, 18 }, /* 4963 */ { MAD_F(0x052ac101) /* 0.322937971 */, 18 }, /* 4964 */ { MAD_F(0x052b1bfb) /* 0.323024732 */, 18 }, /* 4965 */ { MAD_F(0x052b76f7) /* 0.323111500 */, 18 }, /* 4966 */ { MAD_F(0x052bd1f4) /* 0.323198273 */, 18 }, /* 4967 */ { MAD_F(0x052c2cf2) /* 0.323285052 */, 18 }, /* 4968 */ { MAD_F(0x052c87f2) /* 0.323371837 */, 18 }, /* 4969 */ { MAD_F(0x052ce2f4) /* 0.323458628 */, 18 }, /* 4970 */ { MAD_F(0x052d3df7) /* 0.323545425 */, 18 }, /* 4971 */ { MAD_F(0x052d98fc) /* 0.323632227 */, 18 }, /* 4972 */ { MAD_F(0x052df403) /* 0.323719036 */, 18 }, /* 4973 */ { MAD_F(0x052e4f0b) /* 0.323805850 */, 18 }, /* 4974 */ { MAD_F(0x052eaa14) /* 0.323892670 */, 18 }, /* 4975 */ { MAD_F(0x052f051f) /* 0.323979496 */, 18 }, /* 4976 */ { MAD_F(0x052f602c) /* 0.324066327 */, 18 }, /* 4977 */ { MAD_F(0x052fbb3a) /* 0.324153165 */, 18 }, /* 4978 */ { MAD_F(0x0530164a) /* 0.324240008 */, 18 }, /* 4979 */ { MAD_F(0x0530715b) /* 0.324326857 */, 18 }, /* 4980 */ { MAD_F(0x0530cc6e) /* 0.324413712 */, 18 }, /* 4981 */ { MAD_F(0x05312783) /* 0.324500572 */, 18 }, /* 4982 */ { MAD_F(0x05318299) /* 0.324587439 */, 18 }, /* 4983 */ { MAD_F(0x0531ddb0) /* 0.324674311 */, 18 }, /* 4984 */ { MAD_F(0x053238ca) /* 0.324761189 */, 18 }, /* 4985 */ { MAD_F(0x053293e4) /* 0.324848073 */, 18 }, /* 4986 */ { MAD_F(0x0532ef01) /* 0.324934963 */, 18 }, /* 4987 */ { MAD_F(0x05334a1e) /* 0.325021858 */, 18 }, /* 4988 */ { MAD_F(0x0533a53e) /* 0.325108760 */, 18 }, /* 4989 */ { MAD_F(0x0534005f) /* 0.325195667 */, 18 }, /* 4990 */ { MAD_F(0x05345b81) /* 0.325282580 */, 18 }, /* 4991 */ { MAD_F(0x0534b6a5) /* 0.325369498 */, 18 }, /* 4992 */ { MAD_F(0x053511cb) /* 0.325456423 */, 18 }, /* 4993 */ { MAD_F(0x05356cf2) /* 0.325543353 */, 18 }, /* 4994 */ { MAD_F(0x0535c81b) /* 0.325630290 */, 18 }, /* 4995 */ { MAD_F(0x05362345) /* 0.325717232 */, 18 }, /* 4996 */ { MAD_F(0x05367e71) /* 0.325804179 */, 18 }, /* 4997 */ { MAD_F(0x0536d99f) /* 0.325891133 */, 18 }, /* 4998 */ { MAD_F(0x053734ce) /* 0.325978092 */, 18 }, /* 4999 */ { MAD_F(0x05378ffe) /* 0.326065057 */, 18 }, /* 5000 */ { MAD_F(0x0537eb30) /* 0.326152028 */, 18 }, /* 5001 */ { MAD_F(0x05384664) /* 0.326239005 */, 18 }, /* 5002 */ { MAD_F(0x0538a199) /* 0.326325988 */, 18 }, /* 5003 */ { MAD_F(0x0538fcd0) /* 0.326412976 */, 18 }, /* 5004 */ { MAD_F(0x05395808) /* 0.326499970 */, 18 }, /* 5005 */ { MAD_F(0x0539b342) /* 0.326586970 */, 18 }, /* 5006 */ { MAD_F(0x053a0e7d) /* 0.326673976 */, 18 }, /* 5007 */ { MAD_F(0x053a69ba) /* 0.326760988 */, 18 }, /* 5008 */ { MAD_F(0x053ac4f9) /* 0.326848005 */, 18 }, /* 5009 */ { MAD_F(0x053b2039) /* 0.326935028 */, 18 }, /* 5010 */ { MAD_F(0x053b7b7b) /* 0.327022057 */, 18 }, /* 5011 */ { MAD_F(0x053bd6be) /* 0.327109092 */, 18 }, /* 5012 */ { MAD_F(0x053c3203) /* 0.327196132 */, 18 }, /* 5013 */ { MAD_F(0x053c8d49) /* 0.327283178 */, 18 }, /* 5014 */ { MAD_F(0x053ce891) /* 0.327370231 */, 18 }, /* 5015 */ { MAD_F(0x053d43da) /* 0.327457288 */, 18 }, /* 5016 */ { MAD_F(0x053d9f25) /* 0.327544352 */, 18 }, /* 5017 */ { MAD_F(0x053dfa72) /* 0.327631421 */, 18 }, /* 5018 */ { MAD_F(0x053e55c0) /* 0.327718497 */, 18 }, /* 5019 */ { MAD_F(0x053eb10f) /* 0.327805578 */, 18 }, /* 5020 */ { MAD_F(0x053f0c61) /* 0.327892665 */, 18 }, /* 5021 */ { MAD_F(0x053f67b3) /* 0.327979757 */, 18 }, /* 5022 */ { MAD_F(0x053fc308) /* 0.328066855 */, 18 }, /* 5023 */ { MAD_F(0x05401e5e) /* 0.328153960 */, 18 }, /* 5024 */ { MAD_F(0x054079b5) /* 0.328241070 */, 18 }, /* 5025 */ { MAD_F(0x0540d50e) /* 0.328328185 */, 18 }, /* 5026 */ { MAD_F(0x05413068) /* 0.328415307 */, 18 }, /* 5027 */ { MAD_F(0x05418bc4) /* 0.328502434 */, 18 }, /* 5028 */ { MAD_F(0x0541e722) /* 0.328589567 */, 18 }, /* 5029 */ { MAD_F(0x05424281) /* 0.328676706 */, 18 }, /* 5030 */ { MAD_F(0x05429de2) /* 0.328763850 */, 18 }, /* 5031 */ { MAD_F(0x0542f944) /* 0.328851001 */, 18 }, /* 5032 */ { MAD_F(0x054354a8) /* 0.328938157 */, 18 }, /* 5033 */ { MAD_F(0x0543b00d) /* 0.329025319 */, 18 }, /* 5034 */ { MAD_F(0x05440b74) /* 0.329112486 */, 18 }, /* 5035 */ { MAD_F(0x054466dd) /* 0.329199660 */, 18 }, /* 5036 */ { MAD_F(0x0544c247) /* 0.329286839 */, 18 }, /* 5037 */ { MAD_F(0x05451db2) /* 0.329374024 */, 18 }, /* 5038 */ { MAD_F(0x0545791f) /* 0.329461215 */, 18 }, /* 5039 */ { MAD_F(0x0545d48e) /* 0.329548411 */, 18 }, /* 5040 */ { MAD_F(0x05462ffe) /* 0.329635614 */, 18 }, /* 5041 */ { MAD_F(0x05468b70) /* 0.329722822 */, 18 }, /* 5042 */ { MAD_F(0x0546e6e3) /* 0.329810036 */, 18 }, /* 5043 */ { MAD_F(0x05474258) /* 0.329897255 */, 18 }, /* 5044 */ { MAD_F(0x05479dce) /* 0.329984481 */, 18 }, /* 5045 */ { MAD_F(0x0547f946) /* 0.330071712 */, 18 }, /* 5046 */ { MAD_F(0x054854c0) /* 0.330158949 */, 18 }, /* 5047 */ { MAD_F(0x0548b03b) /* 0.330246191 */, 18 }, /* 5048 */ { MAD_F(0x05490bb7) /* 0.330333440 */, 18 }, /* 5049 */ { MAD_F(0x05496735) /* 0.330420694 */, 18 }, /* 5050 */ { MAD_F(0x0549c2b5) /* 0.330507954 */, 18 }, /* 5051 */ { MAD_F(0x054a1e36) /* 0.330595220 */, 18 }, /* 5052 */ { MAD_F(0x054a79b9) /* 0.330682491 */, 18 }, /* 5053 */ { MAD_F(0x054ad53d) /* 0.330769768 */, 18 }, /* 5054 */ { MAD_F(0x054b30c3) /* 0.330857051 */, 18 }, /* 5055 */ { MAD_F(0x054b8c4b) /* 0.330944340 */, 18 }, /* 5056 */ { MAD_F(0x054be7d4) /* 0.331031635 */, 18 }, /* 5057 */ { MAD_F(0x054c435e) /* 0.331118935 */, 18 }, /* 5058 */ { MAD_F(0x054c9eea) /* 0.331206241 */, 18 }, /* 5059 */ { MAD_F(0x054cfa78) /* 0.331293553 */, 18 }, /* 5060 */ { MAD_F(0x054d5607) /* 0.331380870 */, 18 }, /* 5061 */ { MAD_F(0x054db197) /* 0.331468193 */, 18 }, /* 5062 */ { MAD_F(0x054e0d2a) /* 0.331555522 */, 18 }, /* 5063 */ { MAD_F(0x054e68bd) /* 0.331642857 */, 18 }, /* 5064 */ { MAD_F(0x054ec453) /* 0.331730198 */, 18 }, /* 5065 */ { MAD_F(0x054f1fe9) /* 0.331817544 */, 18 }, /* 5066 */ { MAD_F(0x054f7b82) /* 0.331904896 */, 18 }, /* 5067 */ { MAD_F(0x054fd71c) /* 0.331992254 */, 18 }, /* 5068 */ { MAD_F(0x055032b7) /* 0.332079617 */, 18 }, /* 5069 */ { MAD_F(0x05508e54) /* 0.332166986 */, 18 }, /* 5070 */ { MAD_F(0x0550e9f3) /* 0.332254361 */, 18 }, /* 5071 */ { MAD_F(0x05514593) /* 0.332341742 */, 18 }, /* 5072 */ { MAD_F(0x0551a134) /* 0.332429129 */, 18 }, /* 5073 */ { MAD_F(0x0551fcd8) /* 0.332516521 */, 18 }, /* 5074 */ { MAD_F(0x0552587c) /* 0.332603919 */, 18 }, /* 5075 */ { MAD_F(0x0552b423) /* 0.332691323 */, 18 }, /* 5076 */ { MAD_F(0x05530fca) /* 0.332778732 */, 18 }, /* 5077 */ { MAD_F(0x05536b74) /* 0.332866147 */, 18 }, /* 5078 */ { MAD_F(0x0553c71f) /* 0.332953568 */, 18 }, /* 5079 */ { MAD_F(0x055422cb) /* 0.333040995 */, 18 }, /* 5080 */ { MAD_F(0x05547e79) /* 0.333128427 */, 18 }, /* 5081 */ { MAD_F(0x0554da29) /* 0.333215865 */, 18 }, /* 5082 */ { MAD_F(0x055535da) /* 0.333303309 */, 18 }, /* 5083 */ { MAD_F(0x0555918c) /* 0.333390759 */, 18 }, /* 5084 */ { MAD_F(0x0555ed40) /* 0.333478214 */, 18 }, /* 5085 */ { MAD_F(0x055648f6) /* 0.333565675 */, 18 }, /* 5086 */ { MAD_F(0x0556a4ad) /* 0.333653142 */, 18 }, /* 5087 */ { MAD_F(0x05570066) /* 0.333740615 */, 18 }, /* 5088 */ { MAD_F(0x05575c20) /* 0.333828093 */, 18 }, /* 5089 */ { MAD_F(0x0557b7dc) /* 0.333915577 */, 18 }, /* 5090 */ { MAD_F(0x05581399) /* 0.334003067 */, 18 }, /* 5091 */ { MAD_F(0x05586f58) /* 0.334090562 */, 18 }, /* 5092 */ { MAD_F(0x0558cb19) /* 0.334178063 */, 18 }, /* 5093 */ { MAD_F(0x055926db) /* 0.334265570 */, 18 }, /* 5094 */ { MAD_F(0x0559829e) /* 0.334353083 */, 18 }, /* 5095 */ { MAD_F(0x0559de63) /* 0.334440601 */, 18 }, /* 5096 */ { MAD_F(0x055a3a2a) /* 0.334528126 */, 18 }, /* 5097 */ { MAD_F(0x055a95f2) /* 0.334615655 */, 18 }, /* 5098 */ { MAD_F(0x055af1bb) /* 0.334703191 */, 18 }, /* 5099 */ { MAD_F(0x055b4d87) /* 0.334790732 */, 18 }, /* 5100 */ { MAD_F(0x055ba953) /* 0.334878279 */, 18 }, /* 5101 */ { MAD_F(0x055c0522) /* 0.334965832 */, 18 }, /* 5102 */ { MAD_F(0x055c60f1) /* 0.335053391 */, 18 }, /* 5103 */ { MAD_F(0x055cbcc3) /* 0.335140955 */, 18 }, /* 5104 */ { MAD_F(0x055d1896) /* 0.335228525 */, 18 }, /* 5105 */ { MAD_F(0x055d746a) /* 0.335316100 */, 18 }, /* 5106 */ { MAD_F(0x055dd040) /* 0.335403682 */, 18 }, /* 5107 */ { MAD_F(0x055e2c17) /* 0.335491269 */, 18 }, /* 5108 */ { MAD_F(0x055e87f0) /* 0.335578861 */, 18 }, /* 5109 */ { MAD_F(0x055ee3cb) /* 0.335666460 */, 18 }, /* 5110 */ { MAD_F(0x055f3fa7) /* 0.335754064 */, 18 }, /* 5111 */ { MAD_F(0x055f9b85) /* 0.335841674 */, 18 }, /* 5112 */ { MAD_F(0x055ff764) /* 0.335929290 */, 18 }, /* 5113 */ { MAD_F(0x05605344) /* 0.336016911 */, 18 }, /* 5114 */ { MAD_F(0x0560af27) /* 0.336104538 */, 18 }, /* 5115 */ { MAD_F(0x05610b0a) /* 0.336192171 */, 18 }, /* 5116 */ { MAD_F(0x056166f0) /* 0.336279809 */, 18 }, /* 5117 */ { MAD_F(0x0561c2d7) /* 0.336367453 */, 18 }, /* 5118 */ { MAD_F(0x05621ebf) /* 0.336455103 */, 18 }, /* 5119 */ { MAD_F(0x05627aa9) /* 0.336542759 */, 18 }, /* 5120 */ { MAD_F(0x0562d694) /* 0.336630420 */, 18 }, /* 5121 */ { MAD_F(0x05633281) /* 0.336718087 */, 18 }, /* 5122 */ { MAD_F(0x05638e70) /* 0.336805760 */, 18 }, /* 5123 */ { MAD_F(0x0563ea60) /* 0.336893439 */, 18 }, /* 5124 */ { MAD_F(0x05644651) /* 0.336981123 */, 18 }, /* 5125 */ { MAD_F(0x0564a244) /* 0.337068813 */, 18 }, /* 5126 */ { MAD_F(0x0564fe39) /* 0.337156508 */, 18 }, /* 5127 */ { MAD_F(0x05655a2f) /* 0.337244209 */, 18 }, /* 5128 */ { MAD_F(0x0565b627) /* 0.337331916 */, 18 }, /* 5129 */ { MAD_F(0x05661220) /* 0.337419629 */, 18 }, /* 5130 */ { MAD_F(0x05666e1a) /* 0.337507347 */, 18 }, /* 5131 */ { MAD_F(0x0566ca17) /* 0.337595071 */, 18 }, /* 5132 */ { MAD_F(0x05672614) /* 0.337682801 */, 18 }, /* 5133 */ { MAD_F(0x05678214) /* 0.337770537 */, 18 }, /* 5134 */ { MAD_F(0x0567de15) /* 0.337858278 */, 18 }, /* 5135 */ { MAD_F(0x05683a17) /* 0.337946025 */, 18 }, /* 5136 */ { MAD_F(0x0568961b) /* 0.338033777 */, 18 }, /* 5137 */ { MAD_F(0x0568f220) /* 0.338121535 */, 18 }, /* 5138 */ { MAD_F(0x05694e27) /* 0.338209299 */, 18 }, /* 5139 */ { MAD_F(0x0569aa30) /* 0.338297069 */, 18 }, /* 5140 */ { MAD_F(0x056a063a) /* 0.338384844 */, 18 }, /* 5141 */ { MAD_F(0x056a6245) /* 0.338472625 */, 18 }, /* 5142 */ { MAD_F(0x056abe52) /* 0.338560412 */, 18 }, /* 5143 */ { MAD_F(0x056b1a61) /* 0.338648204 */, 18 }, /* 5144 */ { MAD_F(0x056b7671) /* 0.338736002 */, 18 }, /* 5145 */ { MAD_F(0x056bd283) /* 0.338823806 */, 18 }, /* 5146 */ { MAD_F(0x056c2e96) /* 0.338911616 */, 18 }, /* 5147 */ { MAD_F(0x056c8aab) /* 0.338999431 */, 18 }, /* 5148 */ { MAD_F(0x056ce6c1) /* 0.339087252 */, 18 }, /* 5149 */ { MAD_F(0x056d42d9) /* 0.339175078 */, 18 }, /* 5150 */ { MAD_F(0x056d9ef2) /* 0.339262910 */, 18 }, /* 5151 */ { MAD_F(0x056dfb0d) /* 0.339350748 */, 18 }, /* 5152 */ { MAD_F(0x056e5729) /* 0.339438592 */, 18 }, /* 5153 */ { MAD_F(0x056eb347) /* 0.339526441 */, 18 }, /* 5154 */ { MAD_F(0x056f0f66) /* 0.339614296 */, 18 }, /* 5155 */ { MAD_F(0x056f6b87) /* 0.339702157 */, 18 }, /* 5156 */ { MAD_F(0x056fc7aa) /* 0.339790023 */, 18 }, /* 5157 */ { MAD_F(0x057023cd) /* 0.339877895 */, 18 }, /* 5158 */ { MAD_F(0x05707ff3) /* 0.339965773 */, 18 }, /* 5159 */ { MAD_F(0x0570dc1a) /* 0.340053656 */, 18 }, /* 5160 */ { MAD_F(0x05713843) /* 0.340141545 */, 18 }, /* 5161 */ { MAD_F(0x0571946d) /* 0.340229440 */, 18 }, /* 5162 */ { MAD_F(0x0571f098) /* 0.340317340 */, 18 }, /* 5163 */ { MAD_F(0x05724cc5) /* 0.340405246 */, 18 }, /* 5164 */ { MAD_F(0x0572a8f4) /* 0.340493158 */, 18 }, /* 5165 */ { MAD_F(0x05730524) /* 0.340581075 */, 18 }, /* 5166 */ { MAD_F(0x05736156) /* 0.340668999 */, 18 }, /* 5167 */ { MAD_F(0x0573bd89) /* 0.340756927 */, 18 }, /* 5168 */ { MAD_F(0x057419be) /* 0.340844862 */, 18 }, /* 5169 */ { MAD_F(0x057475f4) /* 0.340932802 */, 18 }, /* 5170 */ { MAD_F(0x0574d22c) /* 0.341020748 */, 18 }, /* 5171 */ { MAD_F(0x05752e65) /* 0.341108699 */, 18 }, /* 5172 */ { MAD_F(0x05758aa0) /* 0.341196656 */, 18 }, /* 5173 */ { MAD_F(0x0575e6dc) /* 0.341284619 */, 18 }, /* 5174 */ { MAD_F(0x0576431a) /* 0.341372587 */, 18 }, /* 5175 */ { MAD_F(0x05769f59) /* 0.341460562 */, 18 }, /* 5176 */ { MAD_F(0x0576fb9a) /* 0.341548541 */, 18 }, /* 5177 */ { MAD_F(0x057757dd) /* 0.341636527 */, 18 }, /* 5178 */ { MAD_F(0x0577b421) /* 0.341724518 */, 18 }, /* 5179 */ { MAD_F(0x05781066) /* 0.341812515 */, 18 }, /* 5180 */ { MAD_F(0x05786cad) /* 0.341900517 */, 18 }, /* 5181 */ { MAD_F(0x0578c8f5) /* 0.341988525 */, 18 }, /* 5182 */ { MAD_F(0x0579253f) /* 0.342076539 */, 18 }, /* 5183 */ { MAD_F(0x0579818b) /* 0.342164558 */, 18 }, /* 5184 */ { MAD_F(0x0579ddd8) /* 0.342252584 */, 18 }, /* 5185 */ { MAD_F(0x057a3a27) /* 0.342340614 */, 18 }, /* 5186 */ { MAD_F(0x057a9677) /* 0.342428651 */, 18 }, /* 5187 */ { MAD_F(0x057af2c8) /* 0.342516693 */, 18 }, /* 5188 */ { MAD_F(0x057b4f1c) /* 0.342604741 */, 18 }, /* 5189 */ { MAD_F(0x057bab70) /* 0.342692794 */, 18 }, /* 5190 */ { MAD_F(0x057c07c6) /* 0.342780853 */, 18 }, /* 5191 */ { MAD_F(0x057c641e) /* 0.342868918 */, 18 }, /* 5192 */ { MAD_F(0x057cc077) /* 0.342956988 */, 18 }, /* 5193 */ { MAD_F(0x057d1cd2) /* 0.343045064 */, 18 }, /* 5194 */ { MAD_F(0x057d792e) /* 0.343133146 */, 18 }, /* 5195 */ { MAD_F(0x057dd58c) /* 0.343221233 */, 18 }, /* 5196 */ { MAD_F(0x057e31eb) /* 0.343309326 */, 18 }, /* 5197 */ { MAD_F(0x057e8e4c) /* 0.343397425 */, 18 }, /* 5198 */ { MAD_F(0x057eeaae) /* 0.343485529 */, 18 }, /* 5199 */ { MAD_F(0x057f4712) /* 0.343573639 */, 18 }, /* 5200 */ { MAD_F(0x057fa378) /* 0.343661754 */, 18 }, /* 5201 */ { MAD_F(0x057fffde) /* 0.343749876 */, 18 }, /* 5202 */ { MAD_F(0x05805c47) /* 0.343838003 */, 18 }, /* 5203 */ { MAD_F(0x0580b8b1) /* 0.343926135 */, 18 }, /* 5204 */ { MAD_F(0x0581151c) /* 0.344014273 */, 18 }, /* 5205 */ { MAD_F(0x05817189) /* 0.344102417 */, 18 }, /* 5206 */ { MAD_F(0x0581cdf7) /* 0.344190566 */, 18 }, /* 5207 */ { MAD_F(0x05822a67) /* 0.344278722 */, 18 }, /* 5208 */ { MAD_F(0x058286d9) /* 0.344366882 */, 18 }, /* 5209 */ { MAD_F(0x0582e34c) /* 0.344455049 */, 18 }, /* 5210 */ { MAD_F(0x05833fc0) /* 0.344543221 */, 18 }, /* 5211 */ { MAD_F(0x05839c36) /* 0.344631398 */, 18 }, /* 5212 */ { MAD_F(0x0583f8ae) /* 0.344719582 */, 18 }, /* 5213 */ { MAD_F(0x05845527) /* 0.344807771 */, 18 }, /* 5214 */ { MAD_F(0x0584b1a1) /* 0.344895965 */, 18 }, /* 5215 */ { MAD_F(0x05850e1e) /* 0.344984165 */, 18 }, /* 5216 */ { MAD_F(0x05856a9b) /* 0.345072371 */, 18 }, /* 5217 */ { MAD_F(0x0585c71a) /* 0.345160583 */, 18 }, /* 5218 */ { MAD_F(0x0586239b) /* 0.345248800 */, 18 }, /* 5219 */ { MAD_F(0x0586801d) /* 0.345337023 */, 18 }, /* 5220 */ { MAD_F(0x0586dca1) /* 0.345425251 */, 18 }, /* 5221 */ { MAD_F(0x05873926) /* 0.345513485 */, 18 }, /* 5222 */ { MAD_F(0x058795ac) /* 0.345601725 */, 18 }, /* 5223 */ { MAD_F(0x0587f235) /* 0.345689970 */, 18 }, /* 5224 */ { MAD_F(0x05884ebe) /* 0.345778221 */, 18 }, /* 5225 */ { MAD_F(0x0588ab49) /* 0.345866478 */, 18 }, /* 5226 */ { MAD_F(0x058907d6) /* 0.345954740 */, 18 }, /* 5227 */ { MAD_F(0x05896464) /* 0.346043008 */, 18 }, /* 5228 */ { MAD_F(0x0589c0f4) /* 0.346131281 */, 18 }, /* 5229 */ { MAD_F(0x058a1d85) /* 0.346219560 */, 18 }, /* 5230 */ { MAD_F(0x058a7a18) /* 0.346307845 */, 18 }, /* 5231 */ { MAD_F(0x058ad6ac) /* 0.346396135 */, 18 }, /* 5232 */ { MAD_F(0x058b3342) /* 0.346484431 */, 18 }, /* 5233 */ { MAD_F(0x058b8fd9) /* 0.346572733 */, 18 }, /* 5234 */ { MAD_F(0x058bec72) /* 0.346661040 */, 18 }, /* 5235 */ { MAD_F(0x058c490c) /* 0.346749353 */, 18 }, /* 5236 */ { MAD_F(0x058ca5a8) /* 0.346837671 */, 18 }, /* 5237 */ { MAD_F(0x058d0246) /* 0.346925996 */, 18 }, /* 5238 */ { MAD_F(0x058d5ee4) /* 0.347014325 */, 18 }, /* 5239 */ { MAD_F(0x058dbb85) /* 0.347102661 */, 18 }, /* 5240 */ { MAD_F(0x058e1827) /* 0.347191002 */, 18 }, /* 5241 */ { MAD_F(0x058e74ca) /* 0.347279348 */, 18 }, /* 5242 */ { MAD_F(0x058ed16f) /* 0.347367700 */, 18 }, /* 5243 */ { MAD_F(0x058f2e15) /* 0.347456058 */, 18 }, /* 5244 */ { MAD_F(0x058f8abd) /* 0.347544422 */, 18 }, /* 5245 */ { MAD_F(0x058fe766) /* 0.347632791 */, 18 }, /* 5246 */ { MAD_F(0x05904411) /* 0.347721165 */, 18 }, /* 5247 */ { MAD_F(0x0590a0be) /* 0.347809546 */, 18 }, /* 5248 */ { MAD_F(0x0590fd6c) /* 0.347897931 */, 18 }, /* 5249 */ { MAD_F(0x05915a1b) /* 0.347986323 */, 18 }, /* 5250 */ { MAD_F(0x0591b6cc) /* 0.348074720 */, 18 }, /* 5251 */ { MAD_F(0x0592137e) /* 0.348163123 */, 18 }, /* 5252 */ { MAD_F(0x05927032) /* 0.348251531 */, 18 }, /* 5253 */ { MAD_F(0x0592cce8) /* 0.348339945 */, 18 }, /* 5254 */ { MAD_F(0x0593299f) /* 0.348428365 */, 18 }, /* 5255 */ { MAD_F(0x05938657) /* 0.348516790 */, 18 }, /* 5256 */ { MAD_F(0x0593e311) /* 0.348605221 */, 18 }, /* 5257 */ { MAD_F(0x05943fcd) /* 0.348693657 */, 18 }, /* 5258 */ { MAD_F(0x05949c8a) /* 0.348782099 */, 18 }, /* 5259 */ { MAD_F(0x0594f948) /* 0.348870547 */, 18 }, /* 5260 */ { MAD_F(0x05955608) /* 0.348959000 */, 18 }, /* 5261 */ { MAD_F(0x0595b2ca) /* 0.349047459 */, 18 }, /* 5262 */ { MAD_F(0x05960f8c) /* 0.349135923 */, 18 }, /* 5263 */ { MAD_F(0x05966c51) /* 0.349224393 */, 18 }, /* 5264 */ { MAD_F(0x0596c917) /* 0.349312869 */, 18 }, /* 5265 */ { MAD_F(0x059725de) /* 0.349401350 */, 18 }, /* 5266 */ { MAD_F(0x059782a7) /* 0.349489837 */, 18 }, /* 5267 */ { MAD_F(0x0597df72) /* 0.349578329 */, 18 }, /* 5268 */ { MAD_F(0x05983c3e) /* 0.349666827 */, 18 }, /* 5269 */ { MAD_F(0x0598990c) /* 0.349755331 */, 18 }, /* 5270 */ { MAD_F(0x0598f5db) /* 0.349843840 */, 18 }, /* 5271 */ { MAD_F(0x059952ab) /* 0.349932355 */, 18 }, /* 5272 */ { MAD_F(0x0599af7d) /* 0.350020876 */, 18 }, /* 5273 */ { MAD_F(0x059a0c51) /* 0.350109402 */, 18 }, /* 5274 */ { MAD_F(0x059a6926) /* 0.350197933 */, 18 }, /* 5275 */ { MAD_F(0x059ac5fc) /* 0.350286470 */, 18 }, /* 5276 */ { MAD_F(0x059b22d4) /* 0.350375013 */, 18 }, /* 5277 */ { MAD_F(0x059b7fae) /* 0.350463562 */, 18 }, /* 5278 */ { MAD_F(0x059bdc89) /* 0.350552116 */, 18 }, /* 5279 */ { MAD_F(0x059c3965) /* 0.350640675 */, 18 }, /* 5280 */ { MAD_F(0x059c9643) /* 0.350729240 */, 18 }, /* 5281 */ { MAD_F(0x059cf323) /* 0.350817811 */, 18 }, /* 5282 */ { MAD_F(0x059d5004) /* 0.350906388 */, 18 }, /* 5283 */ { MAD_F(0x059dace6) /* 0.350994970 */, 18 }, /* 5284 */ { MAD_F(0x059e09cb) /* 0.351083557 */, 18 }, /* 5285 */ { MAD_F(0x059e66b0) /* 0.351172150 */, 18 }, /* 5286 */ { MAD_F(0x059ec397) /* 0.351260749 */, 18 }, /* 5287 */ { MAD_F(0x059f2080) /* 0.351349353 */, 18 }, /* 5288 */ { MAD_F(0x059f7d6a) /* 0.351437963 */, 18 }, /* 5289 */ { MAD_F(0x059fda55) /* 0.351526579 */, 18 }, /* 5290 */ { MAD_F(0x05a03742) /* 0.351615200 */, 18 }, /* 5291 */ { MAD_F(0x05a09431) /* 0.351703827 */, 18 }, /* 5292 */ { MAD_F(0x05a0f121) /* 0.351792459 */, 18 }, /* 5293 */ { MAD_F(0x05a14e12) /* 0.351881097 */, 18 }, /* 5294 */ { MAD_F(0x05a1ab05) /* 0.351969740 */, 18 }, /* 5295 */ { MAD_F(0x05a207fa) /* 0.352058389 */, 18 }, /* 5296 */ { MAD_F(0x05a264f0) /* 0.352147044 */, 18 }, /* 5297 */ { MAD_F(0x05a2c1e7) /* 0.352235704 */, 18 }, /* 5298 */ { MAD_F(0x05a31ee1) /* 0.352324369 */, 18 }, /* 5299 */ { MAD_F(0x05a37bdb) /* 0.352413041 */, 18 }, /* 5300 */ { MAD_F(0x05a3d8d7) /* 0.352501718 */, 18 }, /* 5301 */ { MAD_F(0x05a435d5) /* 0.352590400 */, 18 }, /* 5302 */ { MAD_F(0x05a492d4) /* 0.352679088 */, 18 }, /* 5303 */ { MAD_F(0x05a4efd4) /* 0.352767782 */, 18 }, /* 5304 */ { MAD_F(0x05a54cd6) /* 0.352856481 */, 18 }, /* 5305 */ { MAD_F(0x05a5a9da) /* 0.352945186 */, 18 }, /* 5306 */ { MAD_F(0x05a606df) /* 0.353033896 */, 18 }, /* 5307 */ { MAD_F(0x05a663e5) /* 0.353122612 */, 18 }, /* 5308 */ { MAD_F(0x05a6c0ed) /* 0.353211333 */, 18 }, /* 5309 */ { MAD_F(0x05a71df7) /* 0.353300061 */, 18 }, /* 5310 */ { MAD_F(0x05a77b02) /* 0.353388793 */, 18 }, /* 5311 */ { MAD_F(0x05a7d80e) /* 0.353477531 */, 18 }, /* 5312 */ { MAD_F(0x05a8351c) /* 0.353566275 */, 18 }, /* 5313 */ { MAD_F(0x05a8922c) /* 0.353655024 */, 18 }, /* 5314 */ { MAD_F(0x05a8ef3c) /* 0.353743779 */, 18 }, /* 5315 */ { MAD_F(0x05a94c4f) /* 0.353832540 */, 18 }, /* 5316 */ { MAD_F(0x05a9a963) /* 0.353921306 */, 18 }, /* 5317 */ { MAD_F(0x05aa0678) /* 0.354010077 */, 18 }, /* 5318 */ { MAD_F(0x05aa638f) /* 0.354098855 */, 18 }, /* 5319 */ { MAD_F(0x05aac0a8) /* 0.354187637 */, 18 }, /* 5320 */ { MAD_F(0x05ab1dc2) /* 0.354276426 */, 18 }, /* 5321 */ { MAD_F(0x05ab7add) /* 0.354365220 */, 18 }, /* 5322 */ { MAD_F(0x05abd7fa) /* 0.354454019 */, 18 }, /* 5323 */ { MAD_F(0x05ac3518) /* 0.354542824 */, 18 }, /* 5324 */ { MAD_F(0x05ac9238) /* 0.354631635 */, 18 }, /* 5325 */ { MAD_F(0x05acef5a) /* 0.354720451 */, 18 }, /* 5326 */ { MAD_F(0x05ad4c7d) /* 0.354809272 */, 18 }, /* 5327 */ { MAD_F(0x05ada9a1) /* 0.354898100 */, 18 }, /* 5328 */ { MAD_F(0x05ae06c7) /* 0.354986932 */, 18 }, /* 5329 */ { MAD_F(0x05ae63ee) /* 0.355075771 */, 18 }, /* 5330 */ { MAD_F(0x05aec117) /* 0.355164615 */, 18 }, /* 5331 */ { MAD_F(0x05af1e41) /* 0.355253464 */, 18 }, /* 5332 */ { MAD_F(0x05af7b6d) /* 0.355342319 */, 18 }, /* 5333 */ { MAD_F(0x05afd89b) /* 0.355431180 */, 18 }, /* 5334 */ { MAD_F(0x05b035c9) /* 0.355520046 */, 18 }, /* 5335 */ { MAD_F(0x05b092fa) /* 0.355608917 */, 18 }, /* 5336 */ { MAD_F(0x05b0f02b) /* 0.355697795 */, 18 }, /* 5337 */ { MAD_F(0x05b14d5f) /* 0.355786677 */, 18 }, /* 5338 */ { MAD_F(0x05b1aa94) /* 0.355875566 */, 18 }, /* 5339 */ { MAD_F(0x05b207ca) /* 0.355964460 */, 18 }, /* 5340 */ { MAD_F(0x05b26502) /* 0.356053359 */, 18 }, /* 5341 */ { MAD_F(0x05b2c23b) /* 0.356142264 */, 18 }, /* 5342 */ { MAD_F(0x05b31f76) /* 0.356231175 */, 18 }, /* 5343 */ { MAD_F(0x05b37cb2) /* 0.356320091 */, 18 }, /* 5344 */ { MAD_F(0x05b3d9f0) /* 0.356409012 */, 18 }, /* 5345 */ { MAD_F(0x05b4372f) /* 0.356497940 */, 18 }, /* 5346 */ { MAD_F(0x05b4946f) /* 0.356586872 */, 18 }, /* 5347 */ { MAD_F(0x05b4f1b2) /* 0.356675811 */, 18 }, /* 5348 */ { MAD_F(0x05b54ef5) /* 0.356764754 */, 18 }, /* 5349 */ { MAD_F(0x05b5ac3a) /* 0.356853704 */, 18 }, /* 5350 */ { MAD_F(0x05b60981) /* 0.356942659 */, 18 }, /* 5351 */ { MAD_F(0x05b666c9) /* 0.357031619 */, 18 }, /* 5352 */ { MAD_F(0x05b6c413) /* 0.357120585 */, 18 }, /* 5353 */ { MAD_F(0x05b7215e) /* 0.357209557 */, 18 }, /* 5354 */ { MAD_F(0x05b77eab) /* 0.357298534 */, 18 }, /* 5355 */ { MAD_F(0x05b7dbf9) /* 0.357387516 */, 18 }, /* 5356 */ { MAD_F(0x05b83948) /* 0.357476504 */, 18 }, /* 5357 */ { MAD_F(0x05b89699) /* 0.357565498 */, 18 }, /* 5358 */ { MAD_F(0x05b8f3ec) /* 0.357654497 */, 18 }, /* 5359 */ { MAD_F(0x05b95140) /* 0.357743502 */, 18 }, /* 5360 */ { MAD_F(0x05b9ae95) /* 0.357832512 */, 18 }, /* 5361 */ { MAD_F(0x05ba0bec) /* 0.357921528 */, 18 }, /* 5362 */ { MAD_F(0x05ba6945) /* 0.358010550 */, 18 }, /* 5363 */ { MAD_F(0x05bac69f) /* 0.358099576 */, 18 }, /* 5364 */ { MAD_F(0x05bb23fa) /* 0.358188609 */, 18 }, /* 5365 */ { MAD_F(0x05bb8157) /* 0.358277647 */, 18 }, /* 5366 */ { MAD_F(0x05bbdeb6) /* 0.358366690 */, 18 }, /* 5367 */ { MAD_F(0x05bc3c16) /* 0.358455739 */, 18 }, /* 5368 */ { MAD_F(0x05bc9977) /* 0.358544794 */, 18 }, /* 5369 */ { MAD_F(0x05bcf6da) /* 0.358633854 */, 18 }, /* 5370 */ { MAD_F(0x05bd543e) /* 0.358722920 */, 18 }, /* 5371 */ { MAD_F(0x05bdb1a4) /* 0.358811991 */, 18 }, /* 5372 */ { MAD_F(0x05be0f0b) /* 0.358901067 */, 18 }, /* 5373 */ { MAD_F(0x05be6c74) /* 0.358990150 */, 18 }, /* 5374 */ { MAD_F(0x05bec9df) /* 0.359079237 */, 18 }, /* 5375 */ { MAD_F(0x05bf274a) /* 0.359168331 */, 18 }, /* 5376 */ { MAD_F(0x05bf84b8) /* 0.359257429 */, 18 }, /* 5377 */ { MAD_F(0x05bfe226) /* 0.359346534 */, 18 }, /* 5378 */ { MAD_F(0x05c03f97) /* 0.359435644 */, 18 }, /* 5379 */ { MAD_F(0x05c09d08) /* 0.359524759 */, 18 }, /* 5380 */ { MAD_F(0x05c0fa7c) /* 0.359613880 */, 18 }, /* 5381 */ { MAD_F(0x05c157f0) /* 0.359703006 */, 18 }, /* 5382 */ { MAD_F(0x05c1b566) /* 0.359792138 */, 18 }, /* 5383 */ { MAD_F(0x05c212de) /* 0.359881276 */, 18 }, /* 5384 */ { MAD_F(0x05c27057) /* 0.359970419 */, 18 }, /* 5385 */ { MAD_F(0x05c2cdd2) /* 0.360059567 */, 18 }, /* 5386 */ { MAD_F(0x05c32b4e) /* 0.360148721 */, 18 }, /* 5387 */ { MAD_F(0x05c388cb) /* 0.360237881 */, 18 }, /* 5388 */ { MAD_F(0x05c3e64b) /* 0.360327046 */, 18 }, /* 5389 */ { MAD_F(0x05c443cb) /* 0.360416216 */, 18 }, /* 5390 */ { MAD_F(0x05c4a14d) /* 0.360505392 */, 18 }, /* 5391 */ { MAD_F(0x05c4fed1) /* 0.360594574 */, 18 }, /* 5392 */ { MAD_F(0x05c55c56) /* 0.360683761 */, 18 }, /* 5393 */ { MAD_F(0x05c5b9dc) /* 0.360772953 */, 18 }, /* 5394 */ { MAD_F(0x05c61764) /* 0.360862152 */, 18 }, /* 5395 */ { MAD_F(0x05c674ed) /* 0.360951355 */, 18 }, /* 5396 */ { MAD_F(0x05c6d278) /* 0.361040564 */, 18 }, /* 5397 */ { MAD_F(0x05c73005) /* 0.361129779 */, 18 }, /* 5398 */ { MAD_F(0x05c78d93) /* 0.361218999 */, 18 }, /* 5399 */ { MAD_F(0x05c7eb22) /* 0.361308225 */, 18 }, /* 5400 */ { MAD_F(0x05c848b3) /* 0.361397456 */, 18 }, /* 5401 */ { MAD_F(0x05c8a645) /* 0.361486693 */, 18 }, /* 5402 */ { MAD_F(0x05c903d9) /* 0.361575935 */, 18 }, /* 5403 */ { MAD_F(0x05c9616e) /* 0.361665183 */, 18 }, /* 5404 */ { MAD_F(0x05c9bf05) /* 0.361754436 */, 18 }, /* 5405 */ { MAD_F(0x05ca1c9d) /* 0.361843695 */, 18 }, /* 5406 */ { MAD_F(0x05ca7a37) /* 0.361932959 */, 18 }, /* 5407 */ { MAD_F(0x05cad7d2) /* 0.362022229 */, 18 }, /* 5408 */ { MAD_F(0x05cb356e) /* 0.362111504 */, 18 }, /* 5409 */ { MAD_F(0x05cb930d) /* 0.362200785 */, 18 }, /* 5410 */ { MAD_F(0x05cbf0ac) /* 0.362290071 */, 18 }, /* 5411 */ { MAD_F(0x05cc4e4d) /* 0.362379362 */, 18 }, /* 5412 */ { MAD_F(0x05ccabf0) /* 0.362468660 */, 18 }, /* 5413 */ { MAD_F(0x05cd0994) /* 0.362557962 */, 18 }, /* 5414 */ { MAD_F(0x05cd6739) /* 0.362647271 */, 18 }, /* 5415 */ { MAD_F(0x05cdc4e0) /* 0.362736584 */, 18 }, /* 5416 */ { MAD_F(0x05ce2289) /* 0.362825904 */, 18 }, /* 5417 */ { MAD_F(0x05ce8033) /* 0.362915228 */, 18 }, /* 5418 */ { MAD_F(0x05ceddde) /* 0.363004559 */, 18 }, /* 5419 */ { MAD_F(0x05cf3b8b) /* 0.363093894 */, 18 }, /* 5420 */ { MAD_F(0x05cf9939) /* 0.363183236 */, 18 }, /* 5421 */ { MAD_F(0x05cff6e9) /* 0.363272582 */, 18 }, /* 5422 */ { MAD_F(0x05d0549a) /* 0.363361935 */, 18 }, /* 5423 */ { MAD_F(0x05d0b24d) /* 0.363451292 */, 18 }, /* 5424 */ { MAD_F(0x05d11001) /* 0.363540655 */, 18 }, /* 5425 */ { MAD_F(0x05d16db7) /* 0.363630024 */, 18 }, /* 5426 */ { MAD_F(0x05d1cb6e) /* 0.363719398 */, 18 }, /* 5427 */ { MAD_F(0x05d22927) /* 0.363808778 */, 18 }, /* 5428 */ { MAD_F(0x05d286e1) /* 0.363898163 */, 18 }, /* 5429 */ { MAD_F(0x05d2e49d) /* 0.363987554 */, 18 }, /* 5430 */ { MAD_F(0x05d3425a) /* 0.364076950 */, 18 }, /* 5431 */ { MAD_F(0x05d3a018) /* 0.364166352 */, 18 }, /* 5432 */ { MAD_F(0x05d3fdd8) /* 0.364255759 */, 18 }, /* 5433 */ { MAD_F(0x05d45b9a) /* 0.364345171 */, 18 }, /* 5434 */ { MAD_F(0x05d4b95d) /* 0.364434589 */, 18 }, /* 5435 */ { MAD_F(0x05d51721) /* 0.364524013 */, 18 }, /* 5436 */ { MAD_F(0x05d574e7) /* 0.364613442 */, 18 }, /* 5437 */ { MAD_F(0x05d5d2af) /* 0.364702877 */, 18 }, /* 5438 */ { MAD_F(0x05d63078) /* 0.364792317 */, 18 }, /* 5439 */ { MAD_F(0x05d68e42) /* 0.364881762 */, 18 }, /* 5440 */ { MAD_F(0x05d6ec0e) /* 0.364971213 */, 18 }, /* 5441 */ { MAD_F(0x05d749db) /* 0.365060669 */, 18 }, /* 5442 */ { MAD_F(0x05d7a7aa) /* 0.365150131 */, 18 }, /* 5443 */ { MAD_F(0x05d8057a) /* 0.365239599 */, 18 }, /* 5444 */ { MAD_F(0x05d8634c) /* 0.365329072 */, 18 }, /* 5445 */ { MAD_F(0x05d8c11f) /* 0.365418550 */, 18 }, /* 5446 */ { MAD_F(0x05d91ef4) /* 0.365508034 */, 18 }, /* 5447 */ { MAD_F(0x05d97cca) /* 0.365597523 */, 18 }, /* 5448 */ { MAD_F(0x05d9daa1) /* 0.365687018 */, 18 }, /* 5449 */ { MAD_F(0x05da387a) /* 0.365776518 */, 18 }, /* 5450 */ { MAD_F(0x05da9655) /* 0.365866024 */, 18 }, /* 5451 */ { MAD_F(0x05daf431) /* 0.365955536 */, 18 }, /* 5452 */ { MAD_F(0x05db520e) /* 0.366045052 */, 18 }, /* 5453 */ { MAD_F(0x05dbafed) /* 0.366134574 */, 18 }, /* 5454 */ { MAD_F(0x05dc0dce) /* 0.366224102 */, 18 }, /* 5455 */ { MAD_F(0x05dc6baf) /* 0.366313635 */, 18 }, /* 5456 */ { MAD_F(0x05dcc993) /* 0.366403174 */, 18 }, /* 5457 */ { MAD_F(0x05dd2778) /* 0.366492718 */, 18 }, /* 5458 */ { MAD_F(0x05dd855e) /* 0.366582267 */, 18 }, /* 5459 */ { MAD_F(0x05dde346) /* 0.366671822 */, 18 }, /* 5460 */ { MAD_F(0x05de412f) /* 0.366761383 */, 18 }, /* 5461 */ { MAD_F(0x05de9f1a) /* 0.366850949 */, 18 }, /* 5462 */ { MAD_F(0x05defd06) /* 0.366940520 */, 18 }, /* 5463 */ { MAD_F(0x05df5af3) /* 0.367030097 */, 18 }, /* 5464 */ { MAD_F(0x05dfb8e2) /* 0.367119680 */, 18 }, /* 5465 */ { MAD_F(0x05e016d3) /* 0.367209267 */, 18 }, /* 5466 */ { MAD_F(0x05e074c5) /* 0.367298861 */, 18 }, /* 5467 */ { MAD_F(0x05e0d2b8) /* 0.367388459 */, 18 }, /* 5468 */ { MAD_F(0x05e130ad) /* 0.367478064 */, 18 }, /* 5469 */ { MAD_F(0x05e18ea4) /* 0.367567673 */, 18 }, /* 5470 */ { MAD_F(0x05e1ec9c) /* 0.367657288 */, 18 }, /* 5471 */ { MAD_F(0x05e24a95) /* 0.367746909 */, 18 }, /* 5472 */ { MAD_F(0x05e2a890) /* 0.367836535 */, 18 }, /* 5473 */ { MAD_F(0x05e3068c) /* 0.367926167 */, 18 }, /* 5474 */ { MAD_F(0x05e3648a) /* 0.368015804 */, 18 }, /* 5475 */ { MAD_F(0x05e3c289) /* 0.368105446 */, 18 }, /* 5476 */ { MAD_F(0x05e4208a) /* 0.368195094 */, 18 }, /* 5477 */ { MAD_F(0x05e47e8c) /* 0.368284747 */, 18 }, /* 5478 */ { MAD_F(0x05e4dc8f) /* 0.368374406 */, 18 }, /* 5479 */ { MAD_F(0x05e53a94) /* 0.368464070 */, 18 }, /* 5480 */ { MAD_F(0x05e5989b) /* 0.368553740 */, 18 }, /* 5481 */ { MAD_F(0x05e5f6a3) /* 0.368643415 */, 18 }, /* 5482 */ { MAD_F(0x05e654ac) /* 0.368733096 */, 18 }, /* 5483 */ { MAD_F(0x05e6b2b7) /* 0.368822782 */, 18 }, /* 5484 */ { MAD_F(0x05e710c4) /* 0.368912473 */, 18 }, /* 5485 */ { MAD_F(0x05e76ed2) /* 0.369002170 */, 18 }, /* 5486 */ { MAD_F(0x05e7cce1) /* 0.369091873 */, 18 }, /* 5487 */ { MAD_F(0x05e82af2) /* 0.369181581 */, 18 }, /* 5488 */ { MAD_F(0x05e88904) /* 0.369271294 */, 18 }, /* 5489 */ { MAD_F(0x05e8e718) /* 0.369361013 */, 18 }, /* 5490 */ { MAD_F(0x05e9452d) /* 0.369450737 */, 18 }, /* 5491 */ { MAD_F(0x05e9a343) /* 0.369540467 */, 18 }, /* 5492 */ { MAD_F(0x05ea015c) /* 0.369630202 */, 18 }, /* 5493 */ { MAD_F(0x05ea5f75) /* 0.369719942 */, 18 }, /* 5494 */ { MAD_F(0x05eabd90) /* 0.369809688 */, 18 }, /* 5495 */ { MAD_F(0x05eb1bad) /* 0.369899440 */, 18 }, /* 5496 */ { MAD_F(0x05eb79cb) /* 0.369989197 */, 18 }, /* 5497 */ { MAD_F(0x05ebd7ea) /* 0.370078959 */, 18 }, /* 5498 */ { MAD_F(0x05ec360b) /* 0.370168727 */, 18 }, /* 5499 */ { MAD_F(0x05ec942d) /* 0.370258500 */, 18 }, /* 5500 */ { MAD_F(0x05ecf251) /* 0.370348279 */, 18 }, /* 5501 */ { MAD_F(0x05ed5076) /* 0.370438063 */, 18 }, /* 5502 */ { MAD_F(0x05edae9d) /* 0.370527853 */, 18 }, /* 5503 */ { MAD_F(0x05ee0cc5) /* 0.370617648 */, 18 }, /* 5504 */ { MAD_F(0x05ee6aef) /* 0.370707448 */, 18 }, /* 5505 */ { MAD_F(0x05eec91a) /* 0.370797254 */, 18 }, /* 5506 */ { MAD_F(0x05ef2746) /* 0.370887065 */, 18 }, /* 5507 */ { MAD_F(0x05ef8574) /* 0.370976882 */, 18 }, /* 5508 */ { MAD_F(0x05efe3a4) /* 0.371066704 */, 18 }, /* 5509 */ { MAD_F(0x05f041d5) /* 0.371156532 */, 18 }, /* 5510 */ { MAD_F(0x05f0a007) /* 0.371246365 */, 18 }, /* 5511 */ { MAD_F(0x05f0fe3b) /* 0.371336203 */, 18 }, /* 5512 */ { MAD_F(0x05f15c70) /* 0.371426047 */, 18 }, /* 5513 */ { MAD_F(0x05f1baa7) /* 0.371515897 */, 18 }, /* 5514 */ { MAD_F(0x05f218df) /* 0.371605751 */, 18 }, /* 5515 */ { MAD_F(0x05f27719) /* 0.371695612 */, 18 }, /* 5516 */ { MAD_F(0x05f2d554) /* 0.371785477 */, 18 }, /* 5517 */ { MAD_F(0x05f33390) /* 0.371875348 */, 18 }, /* 5518 */ { MAD_F(0x05f391cf) /* 0.371965225 */, 18 }, /* 5519 */ { MAD_F(0x05f3f00e) /* 0.372055107 */, 18 }, /* 5520 */ { MAD_F(0x05f44e4f) /* 0.372144994 */, 18 }, /* 5521 */ { MAD_F(0x05f4ac91) /* 0.372234887 */, 18 }, /* 5522 */ { MAD_F(0x05f50ad5) /* 0.372324785 */, 18 }, /* 5523 */ { MAD_F(0x05f5691b) /* 0.372414689 */, 18 }, /* 5524 */ { MAD_F(0x05f5c761) /* 0.372504598 */, 18 }, /* 5525 */ { MAD_F(0x05f625aa) /* 0.372594513 */, 18 }, /* 5526 */ { MAD_F(0x05f683f3) /* 0.372684433 */, 18 }, /* 5527 */ { MAD_F(0x05f6e23f) /* 0.372774358 */, 18 }, /* 5528 */ { MAD_F(0x05f7408b) /* 0.372864289 */, 18 }, /* 5529 */ { MAD_F(0x05f79ed9) /* 0.372954225 */, 18 }, /* 5530 */ { MAD_F(0x05f7fd29) /* 0.373044167 */, 18 }, /* 5531 */ { MAD_F(0x05f85b7a) /* 0.373134114 */, 18 }, /* 5532 */ { MAD_F(0x05f8b9cc) /* 0.373224066 */, 18 }, /* 5533 */ { MAD_F(0x05f91820) /* 0.373314024 */, 18 }, /* 5534 */ { MAD_F(0x05f97675) /* 0.373403987 */, 18 }, /* 5535 */ { MAD_F(0x05f9d4cc) /* 0.373493956 */, 18 }, /* 5536 */ { MAD_F(0x05fa3324) /* 0.373583930 */, 18 }, /* 5537 */ { MAD_F(0x05fa917e) /* 0.373673910 */, 18 }, /* 5538 */ { MAD_F(0x05faefd9) /* 0.373763895 */, 18 }, /* 5539 */ { MAD_F(0x05fb4e36) /* 0.373853885 */, 18 }, /* 5540 */ { MAD_F(0x05fbac94) /* 0.373943881 */, 18 }, /* 5541 */ { MAD_F(0x05fc0af3) /* 0.374033882 */, 18 }, /* 5542 */ { MAD_F(0x05fc6954) /* 0.374123889 */, 18 }, /* 5543 */ { MAD_F(0x05fcc7b7) /* 0.374213901 */, 18 }, /* 5544 */ { MAD_F(0x05fd261b) /* 0.374303918 */, 18 }, /* 5545 */ { MAD_F(0x05fd8480) /* 0.374393941 */, 18 }, /* 5546 */ { MAD_F(0x05fde2e7) /* 0.374483970 */, 18 }, /* 5547 */ { MAD_F(0x05fe414f) /* 0.374574003 */, 18 }, /* 5548 */ { MAD_F(0x05fe9fb9) /* 0.374664042 */, 18 }, /* 5549 */ { MAD_F(0x05fefe24) /* 0.374754087 */, 18 }, /* 5550 */ { MAD_F(0x05ff5c91) /* 0.374844137 */, 18 }, /* 5551 */ { MAD_F(0x05ffbaff) /* 0.374934192 */, 18 }, /* 5552 */ { MAD_F(0x0600196e) /* 0.375024253 */, 18 }, /* 5553 */ { MAD_F(0x060077df) /* 0.375114319 */, 18 }, /* 5554 */ { MAD_F(0x0600d651) /* 0.375204391 */, 18 }, /* 5555 */ { MAD_F(0x060134c5) /* 0.375294468 */, 18 }, /* 5556 */ { MAD_F(0x0601933b) /* 0.375384550 */, 18 }, /* 5557 */ { MAD_F(0x0601f1b1) /* 0.375474638 */, 18 }, /* 5558 */ { MAD_F(0x0602502a) /* 0.375564731 */, 18 }, /* 5559 */ { MAD_F(0x0602aea3) /* 0.375654830 */, 18 }, /* 5560 */ { MAD_F(0x06030d1e) /* 0.375744934 */, 18 }, /* 5561 */ { MAD_F(0x06036b9b) /* 0.375835043 */, 18 }, /* 5562 */ { MAD_F(0x0603ca19) /* 0.375925158 */, 18 }, /* 5563 */ { MAD_F(0x06042898) /* 0.376015278 */, 18 }, /* 5564 */ { MAD_F(0x06048719) /* 0.376105404 */, 18 }, /* 5565 */ { MAD_F(0x0604e59c) /* 0.376195535 */, 18 }, /* 5566 */ { MAD_F(0x0605441f) /* 0.376285671 */, 18 }, /* 5567 */ { MAD_F(0x0605a2a5) /* 0.376375813 */, 18 }, /* 5568 */ { MAD_F(0x0606012b) /* 0.376465960 */, 18 }, /* 5569 */ { MAD_F(0x06065fb4) /* 0.376556113 */, 18 }, /* 5570 */ { MAD_F(0x0606be3d) /* 0.376646271 */, 18 }, /* 5571 */ { MAD_F(0x06071cc8) /* 0.376736434 */, 18 }, /* 5572 */ { MAD_F(0x06077b55) /* 0.376826603 */, 18 }, /* 5573 */ { MAD_F(0x0607d9e3) /* 0.376916777 */, 18 }, /* 5574 */ { MAD_F(0x06083872) /* 0.377006957 */, 18 }, /* 5575 */ { MAD_F(0x06089703) /* 0.377097141 */, 18 }, /* 5576 */ { MAD_F(0x0608f595) /* 0.377187332 */, 18 }, /* 5577 */ { MAD_F(0x06095429) /* 0.377277528 */, 18 }, /* 5578 */ { MAD_F(0x0609b2be) /* 0.377367729 */, 18 }, /* 5579 */ { MAD_F(0x060a1155) /* 0.377457935 */, 18 }, /* 5580 */ { MAD_F(0x060a6fed) /* 0.377548147 */, 18 }, /* 5581 */ { MAD_F(0x060ace86) /* 0.377638364 */, 18 }, /* 5582 */ { MAD_F(0x060b2d21) /* 0.377728587 */, 18 }, /* 5583 */ { MAD_F(0x060b8bbe) /* 0.377818815 */, 18 }, /* 5584 */ { MAD_F(0x060bea5c) /* 0.377909049 */, 18 }, /* 5585 */ { MAD_F(0x060c48fb) /* 0.377999288 */, 18 }, /* 5586 */ { MAD_F(0x060ca79c) /* 0.378089532 */, 18 }, /* 5587 */ { MAD_F(0x060d063e) /* 0.378179781 */, 18 }, /* 5588 */ { MAD_F(0x060d64e1) /* 0.378270036 */, 18 }, /* 5589 */ { MAD_F(0x060dc387) /* 0.378360297 */, 18 }, /* 5590 */ { MAD_F(0x060e222d) /* 0.378450563 */, 18 }, /* 5591 */ { MAD_F(0x060e80d5) /* 0.378540834 */, 18 }, /* 5592 */ { MAD_F(0x060edf7f) /* 0.378631110 */, 18 }, /* 5593 */ { MAD_F(0x060f3e29) /* 0.378721392 */, 18 }, /* 5594 */ { MAD_F(0x060f9cd6) /* 0.378811680 */, 18 }, /* 5595 */ { MAD_F(0x060ffb83) /* 0.378901972 */, 18 }, /* 5596 */ { MAD_F(0x06105a33) /* 0.378992270 */, 18 }, /* 5597 */ { MAD_F(0x0610b8e3) /* 0.379082574 */, 18 }, /* 5598 */ { MAD_F(0x06111795) /* 0.379172883 */, 18 }, /* 5599 */ { MAD_F(0x06117649) /* 0.379263197 */, 18 }, /* 5600 */ { MAD_F(0x0611d4fe) /* 0.379353516 */, 18 }, /* 5601 */ { MAD_F(0x061233b4) /* 0.379443841 */, 18 }, /* 5602 */ { MAD_F(0x0612926c) /* 0.379534172 */, 18 }, /* 5603 */ { MAD_F(0x0612f125) /* 0.379624507 */, 18 }, /* 5604 */ { MAD_F(0x06134fe0) /* 0.379714848 */, 18 }, /* 5605 */ { MAD_F(0x0613ae9c) /* 0.379805195 */, 18 }, /* 5606 */ { MAD_F(0x06140d5a) /* 0.379895547 */, 18 }, /* 5607 */ { MAD_F(0x06146c19) /* 0.379985904 */, 18 }, /* 5608 */ { MAD_F(0x0614cada) /* 0.380076266 */, 18 }, /* 5609 */ { MAD_F(0x0615299c) /* 0.380166634 */, 18 }, /* 5610 */ { MAD_F(0x0615885f) /* 0.380257008 */, 18 }, /* 5611 */ { MAD_F(0x0615e724) /* 0.380347386 */, 18 }, /* 5612 */ { MAD_F(0x061645ea) /* 0.380437770 */, 18 }, /* 5613 */ { MAD_F(0x0616a4b2) /* 0.380528160 */, 18 }, /* 5614 */ { MAD_F(0x0617037b) /* 0.380618555 */, 18 }, /* 5615 */ { MAD_F(0x06176246) /* 0.380708955 */, 18 }, /* 5616 */ { MAD_F(0x0617c112) /* 0.380799360 */, 18 }, /* 5617 */ { MAD_F(0x06181fdf) /* 0.380889771 */, 18 }, /* 5618 */ { MAD_F(0x06187eae) /* 0.380980187 */, 18 }, /* 5619 */ { MAD_F(0x0618dd7e) /* 0.381070609 */, 18 }, /* 5620 */ { MAD_F(0x06193c50) /* 0.381161036 */, 18 }, /* 5621 */ { MAD_F(0x06199b24) /* 0.381251468 */, 18 }, /* 5622 */ { MAD_F(0x0619f9f8) /* 0.381341906 */, 18 }, /* 5623 */ { MAD_F(0x061a58ce) /* 0.381432349 */, 18 }, /* 5624 */ { MAD_F(0x061ab7a6) /* 0.381522798 */, 18 }, /* 5625 */ { MAD_F(0x061b167f) /* 0.381613251 */, 18 }, /* 5626 */ { MAD_F(0x061b7559) /* 0.381703711 */, 18 }, /* 5627 */ { MAD_F(0x061bd435) /* 0.381794175 */, 18 }, /* 5628 */ { MAD_F(0x061c3313) /* 0.381884645 */, 18 }, /* 5629 */ { MAD_F(0x061c91f1) /* 0.381975120 */, 18 }, /* 5630 */ { MAD_F(0x061cf0d2) /* 0.382065601 */, 18 }, /* 5631 */ { MAD_F(0x061d4fb3) /* 0.382156087 */, 18 }, /* 5632 */ { MAD_F(0x061dae96) /* 0.382246578 */, 18 }, /* 5633 */ { MAD_F(0x061e0d7b) /* 0.382337075 */, 18 }, /* 5634 */ { MAD_F(0x061e6c61) /* 0.382427577 */, 18 }, /* 5635 */ { MAD_F(0x061ecb48) /* 0.382518084 */, 18 }, /* 5636 */ { MAD_F(0x061f2a31) /* 0.382608597 */, 18 }, /* 5637 */ { MAD_F(0x061f891b) /* 0.382699115 */, 18 }, /* 5638 */ { MAD_F(0x061fe807) /* 0.382789638 */, 18 }, /* 5639 */ { MAD_F(0x062046f4) /* 0.382880167 */, 18 }, /* 5640 */ { MAD_F(0x0620a5e3) /* 0.382970701 */, 18 }, /* 5641 */ { MAD_F(0x062104d3) /* 0.383061241 */, 18 }, /* 5642 */ { MAD_F(0x062163c4) /* 0.383151786 */, 18 }, /* 5643 */ { MAD_F(0x0621c2b7) /* 0.383242336 */, 18 }, /* 5644 */ { MAD_F(0x062221ab) /* 0.383332891 */, 18 }, /* 5645 */ { MAD_F(0x062280a1) /* 0.383423452 */, 18 }, /* 5646 */ { MAD_F(0x0622df98) /* 0.383514018 */, 18 }, /* 5647 */ { MAD_F(0x06233e91) /* 0.383604590 */, 18 }, /* 5648 */ { MAD_F(0x06239d8b) /* 0.383695167 */, 18 }, /* 5649 */ { MAD_F(0x0623fc86) /* 0.383785749 */, 18 }, /* 5650 */ { MAD_F(0x06245b83) /* 0.383876337 */, 18 }, /* 5651 */ { MAD_F(0x0624ba82) /* 0.383966930 */, 18 }, /* 5652 */ { MAD_F(0x06251981) /* 0.384057528 */, 18 }, /* 5653 */ { MAD_F(0x06257883) /* 0.384148132 */, 18 }, /* 5654 */ { MAD_F(0x0625d785) /* 0.384238741 */, 18 }, /* 5655 */ { MAD_F(0x06263689) /* 0.384329355 */, 18 }, /* 5656 */ { MAD_F(0x0626958f) /* 0.384419975 */, 18 }, /* 5657 */ { MAD_F(0x0626f496) /* 0.384510600 */, 18 }, /* 5658 */ { MAD_F(0x0627539e) /* 0.384601230 */, 18 }, /* 5659 */ { MAD_F(0x0627b2a8) /* 0.384691866 */, 18 }, /* 5660 */ { MAD_F(0x062811b3) /* 0.384782507 */, 18 }, /* 5661 */ { MAD_F(0x062870c0) /* 0.384873153 */, 18 }, /* 5662 */ { MAD_F(0x0628cfce) /* 0.384963805 */, 18 }, /* 5663 */ { MAD_F(0x06292ede) /* 0.385054462 */, 18 }, /* 5664 */ { MAD_F(0x06298def) /* 0.385145124 */, 18 }, /* 5665 */ { MAD_F(0x0629ed01) /* 0.385235792 */, 18 }, /* 5666 */ { MAD_F(0x062a4c15) /* 0.385326465 */, 18 }, /* 5667 */ { MAD_F(0x062aab2a) /* 0.385417143 */, 18 }, /* 5668 */ { MAD_F(0x062b0a41) /* 0.385507827 */, 18 }, /* 5669 */ { MAD_F(0x062b6959) /* 0.385598516 */, 18 }, /* 5670 */ { MAD_F(0x062bc873) /* 0.385689211 */, 18 }, /* 5671 */ { MAD_F(0x062c278e) /* 0.385779910 */, 18 }, /* 5672 */ { MAD_F(0x062c86aa) /* 0.385870615 */, 18 }, /* 5673 */ { MAD_F(0x062ce5c8) /* 0.385961326 */, 18 }, /* 5674 */ { MAD_F(0x062d44e8) /* 0.386052041 */, 18 }, /* 5675 */ { MAD_F(0x062da408) /* 0.386142762 */, 18 }, /* 5676 */ { MAD_F(0x062e032a) /* 0.386233489 */, 18 }, /* 5677 */ { MAD_F(0x062e624e) /* 0.386324221 */, 18 }, /* 5678 */ { MAD_F(0x062ec173) /* 0.386414958 */, 18 }, /* 5679 */ { MAD_F(0x062f209a) /* 0.386505700 */, 18 }, /* 5680 */ { MAD_F(0x062f7fc1) /* 0.386596448 */, 18 }, /* 5681 */ { MAD_F(0x062fdeeb) /* 0.386687201 */, 18 }, /* 5682 */ { MAD_F(0x06303e16) /* 0.386777959 */, 18 }, /* 5683 */ { MAD_F(0x06309d42) /* 0.386868723 */, 18 }, /* 5684 */ { MAD_F(0x0630fc6f) /* 0.386959492 */, 18 }, /* 5685 */ { MAD_F(0x06315b9e) /* 0.387050266 */, 18 }, /* 5686 */ { MAD_F(0x0631bacf) /* 0.387141045 */, 18 }, /* 5687 */ { MAD_F(0x06321a01) /* 0.387231830 */, 18 }, /* 5688 */ { MAD_F(0x06327934) /* 0.387322621 */, 18 }, /* 5689 */ { MAD_F(0x0632d869) /* 0.387413416 */, 18 }, /* 5690 */ { MAD_F(0x0633379f) /* 0.387504217 */, 18 }, /* 5691 */ { MAD_F(0x063396d7) /* 0.387595023 */, 18 }, /* 5692 */ { MAD_F(0x0633f610) /* 0.387685835 */, 18 }, /* 5693 */ { MAD_F(0x0634554a) /* 0.387776652 */, 18 }, /* 5694 */ { MAD_F(0x0634b486) /* 0.387867474 */, 18 }, /* 5695 */ { MAD_F(0x063513c3) /* 0.387958301 */, 18 }, /* 5696 */ { MAD_F(0x06357302) /* 0.388049134 */, 18 }, /* 5697 */ { MAD_F(0x0635d242) /* 0.388139972 */, 18 }, /* 5698 */ { MAD_F(0x06363184) /* 0.388230816 */, 18 }, /* 5699 */ { MAD_F(0x063690c7) /* 0.388321665 */, 18 }, /* 5700 */ { MAD_F(0x0636f00b) /* 0.388412519 */, 18 }, /* 5701 */ { MAD_F(0x06374f51) /* 0.388503378 */, 18 }, /* 5702 */ { MAD_F(0x0637ae99) /* 0.388594243 */, 18 }, /* 5703 */ { MAD_F(0x06380de1) /* 0.388685113 */, 18 }, /* 5704 */ { MAD_F(0x06386d2b) /* 0.388775988 */, 18 }, /* 5705 */ { MAD_F(0x0638cc77) /* 0.388866869 */, 18 }, /* 5706 */ { MAD_F(0x06392bc4) /* 0.388957755 */, 18 }, /* 5707 */ { MAD_F(0x06398b12) /* 0.389048646 */, 18 }, /* 5708 */ { MAD_F(0x0639ea62) /* 0.389139542 */, 18 }, /* 5709 */ { MAD_F(0x063a49b4) /* 0.389230444 */, 18 }, /* 5710 */ { MAD_F(0x063aa906) /* 0.389321352 */, 18 }, /* 5711 */ { MAD_F(0x063b085a) /* 0.389412264 */, 18 }, /* 5712 */ { MAD_F(0x063b67b0) /* 0.389503182 */, 18 }, /* 5713 */ { MAD_F(0x063bc707) /* 0.389594105 */, 18 }, /* 5714 */ { MAD_F(0x063c265f) /* 0.389685033 */, 18 }, /* 5715 */ { MAD_F(0x063c85b9) /* 0.389775967 */, 18 }, /* 5716 */ { MAD_F(0x063ce514) /* 0.389866906 */, 18 }, /* 5717 */ { MAD_F(0x063d4471) /* 0.389957850 */, 18 }, /* 5718 */ { MAD_F(0x063da3cf) /* 0.390048800 */, 18 }, /* 5719 */ { MAD_F(0x063e032f) /* 0.390139755 */, 18 }, /* 5720 */ { MAD_F(0x063e6290) /* 0.390230715 */, 18 }, /* 5721 */ { MAD_F(0x063ec1f2) /* 0.390321681 */, 18 }, /* 5722 */ { MAD_F(0x063f2156) /* 0.390412651 */, 18 }, /* 5723 */ { MAD_F(0x063f80bb) /* 0.390503628 */, 18 }, /* 5724 */ { MAD_F(0x063fe022) /* 0.390594609 */, 18 }, /* 5725 */ { MAD_F(0x06403f8a) /* 0.390685596 */, 18 }, /* 5726 */ { MAD_F(0x06409ef3) /* 0.390776588 */, 18 }, /* 5727 */ { MAD_F(0x0640fe5e) /* 0.390867585 */, 18 }, /* 5728 */ { MAD_F(0x06415dcb) /* 0.390958588 */, 18 }, /* 5729 */ { MAD_F(0x0641bd38) /* 0.391049596 */, 18 }, /* 5730 */ { MAD_F(0x06421ca7) /* 0.391140609 */, 18 }, /* 5731 */ { MAD_F(0x06427c18) /* 0.391231627 */, 18 }, /* 5732 */ { MAD_F(0x0642db8a) /* 0.391322651 */, 18 }, /* 5733 */ { MAD_F(0x06433afd) /* 0.391413680 */, 18 }, /* 5734 */ { MAD_F(0x06439a72) /* 0.391504714 */, 18 }, /* 5735 */ { MAD_F(0x0643f9e9) /* 0.391595754 */, 18 }, /* 5736 */ { MAD_F(0x06445960) /* 0.391686799 */, 18 }, /* 5737 */ { MAD_F(0x0644b8d9) /* 0.391777849 */, 18 }, /* 5738 */ { MAD_F(0x06451854) /* 0.391868905 */, 18 }, /* 5739 */ { MAD_F(0x064577d0) /* 0.391959966 */, 18 }, /* 5740 */ { MAD_F(0x0645d74d) /* 0.392051032 */, 18 }, /* 5741 */ { MAD_F(0x064636cc) /* 0.392142103 */, 18 }, /* 5742 */ { MAD_F(0x0646964c) /* 0.392233180 */, 18 }, /* 5743 */ { MAD_F(0x0646f5ce) /* 0.392324262 */, 18 }, /* 5744 */ { MAD_F(0x06475551) /* 0.392415349 */, 18 }, /* 5745 */ { MAD_F(0x0647b4d5) /* 0.392506442 */, 18 }, /* 5746 */ { MAD_F(0x0648145b) /* 0.392597540 */, 18 }, /* 5747 */ { MAD_F(0x064873e3) /* 0.392688643 */, 18 }, /* 5748 */ { MAD_F(0x0648d36b) /* 0.392779751 */, 18 }, /* 5749 */ { MAD_F(0x064932f6) /* 0.392870865 */, 18 }, /* 5750 */ { MAD_F(0x06499281) /* 0.392961984 */, 18 }, /* 5751 */ { MAD_F(0x0649f20e) /* 0.393053108 */, 18 }, /* 5752 */ { MAD_F(0x064a519c) /* 0.393144238 */, 18 }, /* 5753 */ { MAD_F(0x064ab12c) /* 0.393235372 */, 18 }, /* 5754 */ { MAD_F(0x064b10be) /* 0.393326513 */, 18 }, /* 5755 */ { MAD_F(0x064b7050) /* 0.393417658 */, 18 }, /* 5756 */ { MAD_F(0x064bcfe4) /* 0.393508809 */, 18 }, /* 5757 */ { MAD_F(0x064c2f7a) /* 0.393599965 */, 18 }, /* 5758 */ { MAD_F(0x064c8f11) /* 0.393691126 */, 18 }, /* 5759 */ { MAD_F(0x064ceea9) /* 0.393782292 */, 18 }, /* 5760 */ { MAD_F(0x064d4e43) /* 0.393873464 */, 18 }, /* 5761 */ { MAD_F(0x064dadde) /* 0.393964641 */, 18 }, /* 5762 */ { MAD_F(0x064e0d7a) /* 0.394055823 */, 18 }, /* 5763 */ { MAD_F(0x064e6d18) /* 0.394147011 */, 18 }, /* 5764 */ { MAD_F(0x064eccb8) /* 0.394238204 */, 18 }, /* 5765 */ { MAD_F(0x064f2c59) /* 0.394329402 */, 18 }, /* 5766 */ { MAD_F(0x064f8bfb) /* 0.394420605 */, 18 }, /* 5767 */ { MAD_F(0x064feb9e) /* 0.394511814 */, 18 }, /* 5768 */ { MAD_F(0x06504b44) /* 0.394603028 */, 18 }, /* 5769 */ { MAD_F(0x0650aaea) /* 0.394694247 */, 18 }, /* 5770 */ { MAD_F(0x06510a92) /* 0.394785472 */, 18 }, /* 5771 */ { MAD_F(0x06516a3b) /* 0.394876702 */, 18 }, /* 5772 */ { MAD_F(0x0651c9e6) /* 0.394967937 */, 18 }, /* 5773 */ { MAD_F(0x06522992) /* 0.395059177 */, 18 }, /* 5774 */ { MAD_F(0x06528940) /* 0.395150423 */, 18 }, /* 5775 */ { MAD_F(0x0652e8ef) /* 0.395241673 */, 18 }, /* 5776 */ { MAD_F(0x0653489f) /* 0.395332930 */, 18 }, /* 5777 */ { MAD_F(0x0653a851) /* 0.395424191 */, 18 }, /* 5778 */ { MAD_F(0x06540804) /* 0.395515458 */, 18 }, /* 5779 */ { MAD_F(0x065467b9) /* 0.395606730 */, 18 }, /* 5780 */ { MAD_F(0x0654c76f) /* 0.395698007 */, 18 }, /* 5781 */ { MAD_F(0x06552726) /* 0.395789289 */, 18 }, /* 5782 */ { MAD_F(0x065586df) /* 0.395880577 */, 18 }, /* 5783 */ { MAD_F(0x0655e699) /* 0.395971870 */, 18 }, /* 5784 */ { MAD_F(0x06564655) /* 0.396063168 */, 18 }, /* 5785 */ { MAD_F(0x0656a612) /* 0.396154472 */, 18 }, /* 5786 */ { MAD_F(0x065705d0) /* 0.396245780 */, 18 }, /* 5787 */ { MAD_F(0x06576590) /* 0.396337094 */, 18 }, /* 5788 */ { MAD_F(0x0657c552) /* 0.396428414 */, 18 }, /* 5789 */ { MAD_F(0x06582514) /* 0.396519738 */, 18 }, /* 5790 */ { MAD_F(0x065884d9) /* 0.396611068 */, 18 }, /* 5791 */ { MAD_F(0x0658e49e) /* 0.396702403 */, 18 }, /* 5792 */ { MAD_F(0x06594465) /* 0.396793743 */, 18 }, /* 5793 */ { MAD_F(0x0659a42e) /* 0.396885089 */, 18 }, /* 5794 */ { MAD_F(0x065a03f7) /* 0.396976440 */, 18 }, /* 5795 */ { MAD_F(0x065a63c3) /* 0.397067796 */, 18 }, /* 5796 */ { MAD_F(0x065ac38f) /* 0.397159157 */, 18 }, /* 5797 */ { MAD_F(0x065b235d) /* 0.397250524 */, 18 }, /* 5798 */ { MAD_F(0x065b832d) /* 0.397341896 */, 18 }, /* 5799 */ { MAD_F(0x065be2fe) /* 0.397433273 */, 18 }, /* 5800 */ { MAD_F(0x065c42d0) /* 0.397524655 */, 18 }, /* 5801 */ { MAD_F(0x065ca2a3) /* 0.397616043 */, 18 }, /* 5802 */ { MAD_F(0x065d0279) /* 0.397707436 */, 18 }, /* 5803 */ { MAD_F(0x065d624f) /* 0.397798834 */, 18 }, /* 5804 */ { MAD_F(0x065dc227) /* 0.397890237 */, 18 }, /* 5805 */ { MAD_F(0x065e2200) /* 0.397981646 */, 18 }, /* 5806 */ { MAD_F(0x065e81db) /* 0.398073059 */, 18 }, /* 5807 */ { MAD_F(0x065ee1b7) /* 0.398164479 */, 18 }, /* 5808 */ { MAD_F(0x065f4195) /* 0.398255903 */, 18 }, /* 5809 */ { MAD_F(0x065fa174) /* 0.398347333 */, 18 }, /* 5810 */ { MAD_F(0x06600154) /* 0.398438767 */, 18 }, /* 5811 */ { MAD_F(0x06606136) /* 0.398530207 */, 18 }, /* 5812 */ { MAD_F(0x0660c119) /* 0.398621653 */, 18 }, /* 5813 */ { MAD_F(0x066120fd) /* 0.398713103 */, 18 }, /* 5814 */ { MAD_F(0x066180e3) /* 0.398804559 */, 18 }, /* 5815 */ { MAD_F(0x0661e0cb) /* 0.398896020 */, 18 }, /* 5816 */ { MAD_F(0x066240b4) /* 0.398987487 */, 18 }, /* 5817 */ { MAD_F(0x0662a09e) /* 0.399078958 */, 18 }, /* 5818 */ { MAD_F(0x06630089) /* 0.399170435 */, 18 }, /* 5819 */ { MAD_F(0x06636077) /* 0.399261917 */, 18 }, /* 5820 */ { MAD_F(0x0663c065) /* 0.399353404 */, 18 }, /* 5821 */ { MAD_F(0x06642055) /* 0.399444897 */, 18 }, /* 5822 */ { MAD_F(0x06648046) /* 0.399536395 */, 18 }, /* 5823 */ { MAD_F(0x0664e039) /* 0.399627898 */, 18 }, /* 5824 */ { MAD_F(0x0665402d) /* 0.399719406 */, 18 }, /* 5825 */ { MAD_F(0x0665a022) /* 0.399810919 */, 18 }, /* 5826 */ { MAD_F(0x06660019) /* 0.399902438 */, 18 }, /* 5827 */ { MAD_F(0x06666011) /* 0.399993962 */, 18 }, /* 5828 */ { MAD_F(0x0666c00b) /* 0.400085491 */, 18 }, /* 5829 */ { MAD_F(0x06672006) /* 0.400177026 */, 18 }, /* 5830 */ { MAD_F(0x06678003) /* 0.400268565 */, 18 }, /* 5831 */ { MAD_F(0x0667e000) /* 0.400360110 */, 18 }, /* 5832 */ { MAD_F(0x06684000) /* 0.400451660 */, 18 }, /* 5833 */ { MAD_F(0x0668a000) /* 0.400543216 */, 18 }, /* 5834 */ { MAD_F(0x06690003) /* 0.400634776 */, 18 }, /* 5835 */ { MAD_F(0x06696006) /* 0.400726342 */, 18 }, /* 5836 */ { MAD_F(0x0669c00b) /* 0.400817913 */, 18 }, /* 5837 */ { MAD_F(0x066a2011) /* 0.400909489 */, 18 }, /* 5838 */ { MAD_F(0x066a8019) /* 0.401001071 */, 18 }, /* 5839 */ { MAD_F(0x066ae022) /* 0.401092657 */, 18 }, /* 5840 */ { MAD_F(0x066b402d) /* 0.401184249 */, 18 }, /* 5841 */ { MAD_F(0x066ba039) /* 0.401275847 */, 18 }, /* 5842 */ { MAD_F(0x066c0046) /* 0.401367449 */, 18 }, /* 5843 */ { MAD_F(0x066c6055) /* 0.401459057 */, 18 }, /* 5844 */ { MAD_F(0x066cc065) /* 0.401550670 */, 18 }, /* 5845 */ { MAD_F(0x066d2076) /* 0.401642288 */, 18 }, /* 5846 */ { MAD_F(0x066d8089) /* 0.401733911 */, 18 }, /* 5847 */ { MAD_F(0x066de09e) /* 0.401825540 */, 18 }, /* 5848 */ { MAD_F(0x066e40b3) /* 0.401917173 */, 18 }, /* 5849 */ { MAD_F(0x066ea0cb) /* 0.402008812 */, 18 }, /* 5850 */ { MAD_F(0x066f00e3) /* 0.402100457 */, 18 }, /* 5851 */ { MAD_F(0x066f60fd) /* 0.402192106 */, 18 }, /* 5852 */ { MAD_F(0x066fc118) /* 0.402283761 */, 18 }, /* 5853 */ { MAD_F(0x06702135) /* 0.402375420 */, 18 }, /* 5854 */ { MAD_F(0x06708153) /* 0.402467086 */, 18 }, /* 5855 */ { MAD_F(0x0670e173) /* 0.402558756 */, 18 }, /* 5856 */ { MAD_F(0x06714194) /* 0.402650431 */, 18 }, /* 5857 */ { MAD_F(0x0671a1b6) /* 0.402742112 */, 18 }, /* 5858 */ { MAD_F(0x067201da) /* 0.402833798 */, 18 }, /* 5859 */ { MAD_F(0x067261ff) /* 0.402925489 */, 18 }, /* 5860 */ { MAD_F(0x0672c226) /* 0.403017186 */, 18 }, /* 5861 */ { MAD_F(0x0673224e) /* 0.403108887 */, 18 }, /* 5862 */ { MAD_F(0x06738277) /* 0.403200594 */, 18 }, /* 5863 */ { MAD_F(0x0673e2a2) /* 0.403292306 */, 18 }, /* 5864 */ { MAD_F(0x067442ce) /* 0.403384024 */, 18 }, /* 5865 */ { MAD_F(0x0674a2fc) /* 0.403475746 */, 18 }, /* 5866 */ { MAD_F(0x0675032b) /* 0.403567474 */, 18 }, /* 5867 */ { MAD_F(0x0675635b) /* 0.403659207 */, 18 }, /* 5868 */ { MAD_F(0x0675c38d) /* 0.403750945 */, 18 }, /* 5869 */ { MAD_F(0x067623c0) /* 0.403842688 */, 18 }, /* 5870 */ { MAD_F(0x067683f4) /* 0.403934437 */, 18 }, /* 5871 */ { MAD_F(0x0676e42a) /* 0.404026190 */, 18 }, /* 5872 */ { MAD_F(0x06774462) /* 0.404117949 */, 18 }, /* 5873 */ { MAD_F(0x0677a49b) /* 0.404209714 */, 18 }, /* 5874 */ { MAD_F(0x067804d5) /* 0.404301483 */, 18 }, /* 5875 */ { MAD_F(0x06786510) /* 0.404393258 */, 18 }, /* 5876 */ { MAD_F(0x0678c54d) /* 0.404485037 */, 18 }, /* 5877 */ { MAD_F(0x0679258c) /* 0.404576822 */, 18 }, /* 5878 */ { MAD_F(0x067985cb) /* 0.404668613 */, 18 }, /* 5879 */ { MAD_F(0x0679e60c) /* 0.404760408 */, 18 }, /* 5880 */ { MAD_F(0x067a464f) /* 0.404852209 */, 18 }, /* 5881 */ { MAD_F(0x067aa693) /* 0.404944014 */, 18 }, /* 5882 */ { MAD_F(0x067b06d8) /* 0.405035825 */, 18 }, /* 5883 */ { MAD_F(0x067b671f) /* 0.405127642 */, 18 }, /* 5884 */ { MAD_F(0x067bc767) /* 0.405219463 */, 18 }, /* 5885 */ { MAD_F(0x067c27b1) /* 0.405311290 */, 18 }, /* 5886 */ { MAD_F(0x067c87fc) /* 0.405403122 */, 18 }, /* 5887 */ { MAD_F(0x067ce848) /* 0.405494959 */, 18 }, /* 5888 */ { MAD_F(0x067d4896) /* 0.405586801 */, 18 }, /* 5889 */ { MAD_F(0x067da8e5) /* 0.405678648 */, 18 }, /* 5890 */ { MAD_F(0x067e0935) /* 0.405770501 */, 18 }, /* 5891 */ { MAD_F(0x067e6987) /* 0.405862359 */, 18 }, /* 5892 */ { MAD_F(0x067ec9da) /* 0.405954222 */, 18 }, /* 5893 */ { MAD_F(0x067f2a2f) /* 0.406046090 */, 18 }, /* 5894 */ { MAD_F(0x067f8a85) /* 0.406137963 */, 18 }, /* 5895 */ { MAD_F(0x067feadd) /* 0.406229842 */, 18 }, /* 5896 */ { MAD_F(0x06804b36) /* 0.406321726 */, 18 }, /* 5897 */ { MAD_F(0x0680ab90) /* 0.406413615 */, 18 }, /* 5898 */ { MAD_F(0x06810beb) /* 0.406505509 */, 18 }, /* 5899 */ { MAD_F(0x06816c49) /* 0.406597408 */, 18 }, /* 5900 */ { MAD_F(0x0681cca7) /* 0.406689313 */, 18 }, /* 5901 */ { MAD_F(0x06822d07) /* 0.406781223 */, 18 }, /* 5902 */ { MAD_F(0x06828d68) /* 0.406873138 */, 18 }, /* 5903 */ { MAD_F(0x0682edcb) /* 0.406965058 */, 18 }, /* 5904 */ { MAD_F(0x06834e2f) /* 0.407056983 */, 18 }, /* 5905 */ { MAD_F(0x0683ae94) /* 0.407148914 */, 18 }, /* 5906 */ { MAD_F(0x06840efb) /* 0.407240850 */, 18 }, /* 5907 */ { MAD_F(0x06846f63) /* 0.407332791 */, 18 }, /* 5908 */ { MAD_F(0x0684cfcd) /* 0.407424737 */, 18 }, /* 5909 */ { MAD_F(0x06853038) /* 0.407516688 */, 18 }, /* 5910 */ { MAD_F(0x068590a4) /* 0.407608645 */, 18 }, /* 5911 */ { MAD_F(0x0685f112) /* 0.407700606 */, 18 }, /* 5912 */ { MAD_F(0x06865181) /* 0.407792573 */, 18 }, /* 5913 */ { MAD_F(0x0686b1f2) /* 0.407884545 */, 18 }, /* 5914 */ { MAD_F(0x06871264) /* 0.407976522 */, 18 }, /* 5915 */ { MAD_F(0x068772d7) /* 0.408068505 */, 18 }, /* 5916 */ { MAD_F(0x0687d34c) /* 0.408160492 */, 18 }, /* 5917 */ { MAD_F(0x068833c2) /* 0.408252485 */, 18 }, /* 5918 */ { MAD_F(0x06889439) /* 0.408344483 */, 18 }, /* 5919 */ { MAD_F(0x0688f4b2) /* 0.408436486 */, 18 }, /* 5920 */ { MAD_F(0x0689552c) /* 0.408528495 */, 18 }, /* 5921 */ { MAD_F(0x0689b5a8) /* 0.408620508 */, 18 }, /* 5922 */ { MAD_F(0x068a1625) /* 0.408712527 */, 18 }, /* 5923 */ { MAD_F(0x068a76a4) /* 0.408804551 */, 18 }, /* 5924 */ { MAD_F(0x068ad724) /* 0.408896580 */, 18 }, /* 5925 */ { MAD_F(0x068b37a5) /* 0.408988614 */, 18 }, /* 5926 */ { MAD_F(0x068b9827) /* 0.409080653 */, 18 }, /* 5927 */ { MAD_F(0x068bf8ac) /* 0.409172698 */, 18 }, /* 5928 */ { MAD_F(0x068c5931) /* 0.409264748 */, 18 }, /* 5929 */ { MAD_F(0x068cb9b8) /* 0.409356803 */, 18 }, /* 5930 */ { MAD_F(0x068d1a40) /* 0.409448863 */, 18 }, /* 5931 */ { MAD_F(0x068d7aca) /* 0.409540928 */, 18 }, /* 5932 */ { MAD_F(0x068ddb54) /* 0.409632999 */, 18 }, /* 5933 */ { MAD_F(0x068e3be1) /* 0.409725074 */, 18 }, /* 5934 */ { MAD_F(0x068e9c6f) /* 0.409817155 */, 18 }, /* 5935 */ { MAD_F(0x068efcfe) /* 0.409909241 */, 18 }, /* 5936 */ { MAD_F(0x068f5d8e) /* 0.410001332 */, 18 }, /* 5937 */ { MAD_F(0x068fbe20) /* 0.410093428 */, 18 }, /* 5938 */ { MAD_F(0x06901eb4) /* 0.410185530 */, 18 }, /* 5939 */ { MAD_F(0x06907f48) /* 0.410277637 */, 18 }, /* 5940 */ { MAD_F(0x0690dfde) /* 0.410369748 */, 18 }, /* 5941 */ { MAD_F(0x06914076) /* 0.410461865 */, 18 }, /* 5942 */ { MAD_F(0x0691a10f) /* 0.410553988 */, 18 }, /* 5943 */ { MAD_F(0x069201a9) /* 0.410646115 */, 18 }, /* 5944 */ { MAD_F(0x06926245) /* 0.410738247 */, 18 }, /* 5945 */ { MAD_F(0x0692c2e2) /* 0.410830385 */, 18 }, /* 5946 */ { MAD_F(0x06932380) /* 0.410922528 */, 18 }, /* 5947 */ { MAD_F(0x06938420) /* 0.411014676 */, 18 }, /* 5948 */ { MAD_F(0x0693e4c1) /* 0.411106829 */, 18 }, /* 5949 */ { MAD_F(0x06944563) /* 0.411198987 */, 18 }, /* 5950 */ { MAD_F(0x0694a607) /* 0.411291151 */, 18 }, /* 5951 */ { MAD_F(0x069506ad) /* 0.411383320 */, 18 }, /* 5952 */ { MAD_F(0x06956753) /* 0.411475493 */, 18 }, /* 5953 */ { MAD_F(0x0695c7fc) /* 0.411567672 */, 18 }, /* 5954 */ { MAD_F(0x069628a5) /* 0.411659857 */, 18 }, /* 5955 */ { MAD_F(0x06968950) /* 0.411752046 */, 18 }, /* 5956 */ { MAD_F(0x0696e9fc) /* 0.411844240 */, 18 }, /* 5957 */ { MAD_F(0x06974aaa) /* 0.411936440 */, 18 }, /* 5958 */ { MAD_F(0x0697ab59) /* 0.412028645 */, 18 }, /* 5959 */ { MAD_F(0x06980c09) /* 0.412120855 */, 18 }, /* 5960 */ { MAD_F(0x06986cbb) /* 0.412213070 */, 18 }, /* 5961 */ { MAD_F(0x0698cd6e) /* 0.412305290 */, 18 }, /* 5962 */ { MAD_F(0x06992e23) /* 0.412397516 */, 18 }, /* 5963 */ { MAD_F(0x06998ed9) /* 0.412489746 */, 18 }, /* 5964 */ { MAD_F(0x0699ef90) /* 0.412581982 */, 18 }, /* 5965 */ { MAD_F(0x069a5049) /* 0.412674223 */, 18 }, /* 5966 */ { MAD_F(0x069ab103) /* 0.412766469 */, 18 }, /* 5967 */ { MAD_F(0x069b11bf) /* 0.412858720 */, 18 }, /* 5968 */ { MAD_F(0x069b727b) /* 0.412950976 */, 18 }, /* 5969 */ { MAD_F(0x069bd33a) /* 0.413043238 */, 18 }, /* 5970 */ { MAD_F(0x069c33f9) /* 0.413135505 */, 18 }, /* 5971 */ { MAD_F(0x069c94ba) /* 0.413227776 */, 18 }, /* 5972 */ { MAD_F(0x069cf57d) /* 0.413320053 */, 18 }, /* 5973 */ { MAD_F(0x069d5641) /* 0.413412335 */, 18 }, /* 5974 */ { MAD_F(0x069db706) /* 0.413504623 */, 18 }, /* 5975 */ { MAD_F(0x069e17cc) /* 0.413596915 */, 18 }, /* 5976 */ { MAD_F(0x069e7894) /* 0.413689213 */, 18 }, /* 5977 */ { MAD_F(0x069ed95e) /* 0.413781515 */, 18 }, /* 5978 */ { MAD_F(0x069f3a28) /* 0.413873823 */, 18 }, /* 5979 */ { MAD_F(0x069f9af4) /* 0.413966136 */, 18 }, /* 5980 */ { MAD_F(0x069ffbc2) /* 0.414058454 */, 18 }, /* 5981 */ { MAD_F(0x06a05c91) /* 0.414150778 */, 18 }, /* 5982 */ { MAD_F(0x06a0bd61) /* 0.414243106 */, 18 }, /* 5983 */ { MAD_F(0x06a11e32) /* 0.414335440 */, 18 }, /* 5984 */ { MAD_F(0x06a17f05) /* 0.414427779 */, 18 }, /* 5985 */ { MAD_F(0x06a1dfda) /* 0.414520122 */, 18 }, /* 5986 */ { MAD_F(0x06a240b0) /* 0.414612471 */, 18 }, /* 5987 */ { MAD_F(0x06a2a187) /* 0.414704826 */, 18 }, /* 5988 */ { MAD_F(0x06a3025f) /* 0.414797185 */, 18 }, /* 5989 */ { MAD_F(0x06a36339) /* 0.414889549 */, 18 }, /* 5990 */ { MAD_F(0x06a3c414) /* 0.414981919 */, 18 }, /* 5991 */ { MAD_F(0x06a424f1) /* 0.415074294 */, 18 }, /* 5992 */ { MAD_F(0x06a485cf) /* 0.415166674 */, 18 }, /* 5993 */ { MAD_F(0x06a4e6ae) /* 0.415259059 */, 18 }, /* 5994 */ { MAD_F(0x06a5478f) /* 0.415351449 */, 18 }, /* 5995 */ { MAD_F(0x06a5a871) /* 0.415443844 */, 18 }, /* 5996 */ { MAD_F(0x06a60955) /* 0.415536244 */, 18 }, /* 5997 */ { MAD_F(0x06a66a3a) /* 0.415628650 */, 18 }, /* 5998 */ { MAD_F(0x06a6cb20) /* 0.415721061 */, 18 }, /* 5999 */ { MAD_F(0x06a72c08) /* 0.415813476 */, 18 }, /* 6000 */ { MAD_F(0x06a78cf1) /* 0.415905897 */, 18 }, /* 6001 */ { MAD_F(0x06a7eddb) /* 0.415998324 */, 18 }, /* 6002 */ { MAD_F(0x06a84ec7) /* 0.416090755 */, 18 }, /* 6003 */ { MAD_F(0x06a8afb4) /* 0.416183191 */, 18 }, /* 6004 */ { MAD_F(0x06a910a3) /* 0.416275633 */, 18 }, /* 6005 */ { MAD_F(0x06a97193) /* 0.416368079 */, 18 }, /* 6006 */ { MAD_F(0x06a9d284) /* 0.416460531 */, 18 }, /* 6007 */ { MAD_F(0x06aa3377) /* 0.416552988 */, 18 }, /* 6008 */ { MAD_F(0x06aa946b) /* 0.416645450 */, 18 }, /* 6009 */ { MAD_F(0x06aaf561) /* 0.416737917 */, 18 }, /* 6010 */ { MAD_F(0x06ab5657) /* 0.416830389 */, 18 }, /* 6011 */ { MAD_F(0x06abb750) /* 0.416922867 */, 18 }, /* 6012 */ { MAD_F(0x06ac1849) /* 0.417015349 */, 18 }, /* 6013 */ { MAD_F(0x06ac7944) /* 0.417107837 */, 18 }, /* 6014 */ { MAD_F(0x06acda41) /* 0.417200330 */, 18 }, /* 6015 */ { MAD_F(0x06ad3b3e) /* 0.417292828 */, 18 }, /* 6016 */ { MAD_F(0x06ad9c3d) /* 0.417385331 */, 18 }, /* 6017 */ { MAD_F(0x06adfd3e) /* 0.417477839 */, 18 }, /* 6018 */ { MAD_F(0x06ae5e40) /* 0.417570352 */, 18 }, /* 6019 */ { MAD_F(0x06aebf43) /* 0.417662871 */, 18 }, /* 6020 */ { MAD_F(0x06af2047) /* 0.417755394 */, 18 }, /* 6021 */ { MAD_F(0x06af814d) /* 0.417847923 */, 18 }, /* 6022 */ { MAD_F(0x06afe255) /* 0.417940457 */, 18 }, /* 6023 */ { MAD_F(0x06b0435e) /* 0.418032996 */, 18 }, /* 6024 */ { MAD_F(0x06b0a468) /* 0.418125540 */, 18 }, /* 6025 */ { MAD_F(0x06b10573) /* 0.418218089 */, 18 }, /* 6026 */ { MAD_F(0x06b16680) /* 0.418310643 */, 18 }, /* 6027 */ { MAD_F(0x06b1c78e) /* 0.418403203 */, 18 }, /* 6028 */ { MAD_F(0x06b2289e) /* 0.418495767 */, 18 }, /* 6029 */ { MAD_F(0x06b289af) /* 0.418588337 */, 18 }, /* 6030 */ { MAD_F(0x06b2eac1) /* 0.418680911 */, 18 }, /* 6031 */ { MAD_F(0x06b34bd5) /* 0.418773491 */, 18 }, /* 6032 */ { MAD_F(0x06b3acea) /* 0.418866076 */, 18 }, /* 6033 */ { MAD_F(0x06b40e00) /* 0.418958666 */, 18 }, /* 6034 */ { MAD_F(0x06b46f18) /* 0.419051262 */, 18 }, /* 6035 */ { MAD_F(0x06b4d031) /* 0.419143862 */, 18 }, /* 6036 */ { MAD_F(0x06b5314c) /* 0.419236467 */, 18 }, /* 6037 */ { MAD_F(0x06b59268) /* 0.419329078 */, 18 }, /* 6038 */ { MAD_F(0x06b5f385) /* 0.419421694 */, 18 }, /* 6039 */ { MAD_F(0x06b654a4) /* 0.419514314 */, 18 }, /* 6040 */ { MAD_F(0x06b6b5c4) /* 0.419606940 */, 18 }, /* 6041 */ { MAD_F(0x06b716e6) /* 0.419699571 */, 18 }, /* 6042 */ { MAD_F(0x06b77808) /* 0.419792208 */, 18 }, /* 6043 */ { MAD_F(0x06b7d92d) /* 0.419884849 */, 18 }, /* 6044 */ { MAD_F(0x06b83a52) /* 0.419977495 */, 18 }, /* 6045 */ { MAD_F(0x06b89b79) /* 0.420070147 */, 18 }, /* 6046 */ { MAD_F(0x06b8fca1) /* 0.420162803 */, 18 }, /* 6047 */ { MAD_F(0x06b95dcb) /* 0.420255465 */, 18 }, /* 6048 */ { MAD_F(0x06b9bef6) /* 0.420348132 */, 18 }, /* 6049 */ { MAD_F(0x06ba2023) /* 0.420440803 */, 18 }, /* 6050 */ { MAD_F(0x06ba8150) /* 0.420533481 */, 18 }, /* 6051 */ { MAD_F(0x06bae280) /* 0.420626163 */, 18 }, /* 6052 */ { MAD_F(0x06bb43b0) /* 0.420718850 */, 18 }, /* 6053 */ { MAD_F(0x06bba4e2) /* 0.420811542 */, 18 }, /* 6054 */ { MAD_F(0x06bc0615) /* 0.420904240 */, 18 }, /* 6055 */ { MAD_F(0x06bc674a) /* 0.420996942 */, 18 }, /* 6056 */ { MAD_F(0x06bcc880) /* 0.421089650 */, 18 }, /* 6057 */ { MAD_F(0x06bd29b7) /* 0.421182362 */, 18 }, /* 6058 */ { MAD_F(0x06bd8af0) /* 0.421275080 */, 18 }, /* 6059 */ { MAD_F(0x06bdec2a) /* 0.421367803 */, 18 }, /* 6060 */ { MAD_F(0x06be4d66) /* 0.421460531 */, 18 }, /* 6061 */ { MAD_F(0x06beaea3) /* 0.421553264 */, 18 }, /* 6062 */ { MAD_F(0x06bf0fe1) /* 0.421646003 */, 18 }, /* 6063 */ { MAD_F(0x06bf7120) /* 0.421738746 */, 18 }, /* 6064 */ { MAD_F(0x06bfd261) /* 0.421831494 */, 18 }, /* 6065 */ { MAD_F(0x06c033a4) /* 0.421924248 */, 18 }, /* 6066 */ { MAD_F(0x06c094e7) /* 0.422017007 */, 18 }, /* 6067 */ { MAD_F(0x06c0f62c) /* 0.422109770 */, 18 }, /* 6068 */ { MAD_F(0x06c15773) /* 0.422202539 */, 18 }, /* 6069 */ { MAD_F(0x06c1b8bb) /* 0.422295313 */, 18 }, /* 6070 */ { MAD_F(0x06c21a04) /* 0.422388092 */, 18 }, /* 6071 */ { MAD_F(0x06c27b4e) /* 0.422480876 */, 18 }, /* 6072 */ { MAD_F(0x06c2dc9a) /* 0.422573665 */, 18 }, /* 6073 */ { MAD_F(0x06c33de8) /* 0.422666460 */, 18 }, /* 6074 */ { MAD_F(0x06c39f36) /* 0.422759259 */, 18 }, /* 6075 */ { MAD_F(0x06c40086) /* 0.422852064 */, 18 }, /* 6076 */ { MAD_F(0x06c461d8) /* 0.422944873 */, 18 }, /* 6077 */ { MAD_F(0x06c4c32a) /* 0.423037688 */, 18 }, /* 6078 */ { MAD_F(0x06c5247f) /* 0.423130508 */, 18 }, /* 6079 */ { MAD_F(0x06c585d4) /* 0.423223333 */, 18 }, /* 6080 */ { MAD_F(0x06c5e72b) /* 0.423316162 */, 18 }, /* 6081 */ { MAD_F(0x06c64883) /* 0.423408997 */, 18 }, /* 6082 */ { MAD_F(0x06c6a9dd) /* 0.423501838 */, 18 }, /* 6083 */ { MAD_F(0x06c70b38) /* 0.423594683 */, 18 }, /* 6084 */ { MAD_F(0x06c76c94) /* 0.423687533 */, 18 }, /* 6085 */ { MAD_F(0x06c7cdf2) /* 0.423780389 */, 18 }, /* 6086 */ { MAD_F(0x06c82f51) /* 0.423873249 */, 18 }, /* 6087 */ { MAD_F(0x06c890b1) /* 0.423966115 */, 18 }, /* 6088 */ { MAD_F(0x06c8f213) /* 0.424058985 */, 18 }, /* 6089 */ { MAD_F(0x06c95376) /* 0.424151861 */, 18 }, /* 6090 */ { MAD_F(0x06c9b4da) /* 0.424244742 */, 18 }, /* 6091 */ { MAD_F(0x06ca1640) /* 0.424337628 */, 18 }, /* 6092 */ { MAD_F(0x06ca77a8) /* 0.424430519 */, 18 }, /* 6093 */ { MAD_F(0x06cad910) /* 0.424523415 */, 18 }, /* 6094 */ { MAD_F(0x06cb3a7a) /* 0.424616316 */, 18 }, /* 6095 */ { MAD_F(0x06cb9be5) /* 0.424709222 */, 18 }, /* 6096 */ { MAD_F(0x06cbfd52) /* 0.424802133 */, 18 }, /* 6097 */ { MAD_F(0x06cc5ec0) /* 0.424895050 */, 18 }, /* 6098 */ { MAD_F(0x06ccc030) /* 0.424987971 */, 18 }, /* 6099 */ { MAD_F(0x06cd21a0) /* 0.425080898 */, 18 }, /* 6100 */ { MAD_F(0x06cd8313) /* 0.425173829 */, 18 }, /* 6101 */ { MAD_F(0x06cde486) /* 0.425266766 */, 18 }, /* 6102 */ { MAD_F(0x06ce45fb) /* 0.425359708 */, 18 }, /* 6103 */ { MAD_F(0x06cea771) /* 0.425452655 */, 18 }, /* 6104 */ { MAD_F(0x06cf08e9) /* 0.425545607 */, 18 }, /* 6105 */ { MAD_F(0x06cf6a62) /* 0.425638564 */, 18 }, /* 6106 */ { MAD_F(0x06cfcbdc) /* 0.425731526 */, 18 }, /* 6107 */ { MAD_F(0x06d02d58) /* 0.425824493 */, 18 }, /* 6108 */ { MAD_F(0x06d08ed5) /* 0.425917465 */, 18 }, /* 6109 */ { MAD_F(0x06d0f053) /* 0.426010443 */, 18 }, /* 6110 */ { MAD_F(0x06d151d3) /* 0.426103425 */, 18 }, /* 6111 */ { MAD_F(0x06d1b354) /* 0.426196412 */, 18 }, /* 6112 */ { MAD_F(0x06d214d7) /* 0.426289405 */, 18 }, /* 6113 */ { MAD_F(0x06d2765a) /* 0.426382403 */, 18 }, /* 6114 */ { MAD_F(0x06d2d7e0) /* 0.426475405 */, 18 }, /* 6115 */ { MAD_F(0x06d33966) /* 0.426568413 */, 18 }, /* 6116 */ { MAD_F(0x06d39aee) /* 0.426661426 */, 18 }, /* 6117 */ { MAD_F(0x06d3fc77) /* 0.426754444 */, 18 }, /* 6118 */ { MAD_F(0x06d45e02) /* 0.426847467 */, 18 }, /* 6119 */ { MAD_F(0x06d4bf8e) /* 0.426940495 */, 18 }, /* 6120 */ { MAD_F(0x06d5211c) /* 0.427033528 */, 18 }, /* 6121 */ { MAD_F(0x06d582aa) /* 0.427126566 */, 18 }, /* 6122 */ { MAD_F(0x06d5e43a) /* 0.427219609 */, 18 }, /* 6123 */ { MAD_F(0x06d645cc) /* 0.427312657 */, 18 }, /* 6124 */ { MAD_F(0x06d6a75f) /* 0.427405711 */, 18 }, /* 6125 */ { MAD_F(0x06d708f3) /* 0.427498769 */, 18 }, /* 6126 */ { MAD_F(0x06d76a88) /* 0.427591833 */, 18 }, /* 6127 */ { MAD_F(0x06d7cc1f) /* 0.427684901 */, 18 }, /* 6128 */ { MAD_F(0x06d82db8) /* 0.427777975 */, 18 }, /* 6129 */ { MAD_F(0x06d88f51) /* 0.427871054 */, 18 }, /* 6130 */ { MAD_F(0x06d8f0ec) /* 0.427964137 */, 18 }, /* 6131 */ { MAD_F(0x06d95288) /* 0.428057226 */, 18 }, /* 6132 */ { MAD_F(0x06d9b426) /* 0.428150320 */, 18 }, /* 6133 */ { MAD_F(0x06da15c5) /* 0.428243419 */, 18 }, /* 6134 */ { MAD_F(0x06da7766) /* 0.428336523 */, 18 }, /* 6135 */ { MAD_F(0x06dad907) /* 0.428429632 */, 18 }, /* 6136 */ { MAD_F(0x06db3aaa) /* 0.428522746 */, 18 }, /* 6137 */ { MAD_F(0x06db9c4f) /* 0.428615865 */, 18 }, /* 6138 */ { MAD_F(0x06dbfdf5) /* 0.428708989 */, 18 }, /* 6139 */ { MAD_F(0x06dc5f9c) /* 0.428802119 */, 18 }, /* 6140 */ { MAD_F(0x06dcc145) /* 0.428895253 */, 18 }, /* 6141 */ { MAD_F(0x06dd22ee) /* 0.428988392 */, 18 }, /* 6142 */ { MAD_F(0x06dd849a) /* 0.429081537 */, 18 }, /* 6143 */ { MAD_F(0x06dde646) /* 0.429174686 */, 18 }, /* 6144 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 18 }, /* 6145 */ { MAD_F(0x06dea9a4) /* 0.429361001 */, 18 }, /* 6146 */ { MAD_F(0x06df0b54) /* 0.429454165 */, 18 }, /* 6147 */ { MAD_F(0x06df6d06) /* 0.429547335 */, 18 }, /* 6148 */ { MAD_F(0x06dfceba) /* 0.429640510 */, 18 }, /* 6149 */ { MAD_F(0x06e0306f) /* 0.429733690 */, 18 }, /* 6150 */ { MAD_F(0x06e09225) /* 0.429826874 */, 18 }, /* 6151 */ { MAD_F(0x06e0f3dc) /* 0.429920064 */, 18 }, /* 6152 */ { MAD_F(0x06e15595) /* 0.430013259 */, 18 }, /* 6153 */ { MAD_F(0x06e1b74f) /* 0.430106459 */, 18 }, /* 6154 */ { MAD_F(0x06e2190b) /* 0.430199664 */, 18 }, /* 6155 */ { MAD_F(0x06e27ac8) /* 0.430292875 */, 18 }, /* 6156 */ { MAD_F(0x06e2dc86) /* 0.430386090 */, 18 }, /* 6157 */ { MAD_F(0x06e33e46) /* 0.430479310 */, 18 }, /* 6158 */ { MAD_F(0x06e3a007) /* 0.430572535 */, 18 }, /* 6159 */ { MAD_F(0x06e401c9) /* 0.430665765 */, 18 }, /* 6160 */ { MAD_F(0x06e4638d) /* 0.430759001 */, 18 }, /* 6161 */ { MAD_F(0x06e4c552) /* 0.430852241 */, 18 }, /* 6162 */ { MAD_F(0x06e52718) /* 0.430945487 */, 18 }, /* 6163 */ { MAD_F(0x06e588e0) /* 0.431038737 */, 18 }, /* 6164 */ { MAD_F(0x06e5eaa9) /* 0.431131993 */, 18 }, /* 6165 */ { MAD_F(0x06e64c73) /* 0.431225253 */, 18 }, /* 6166 */ { MAD_F(0x06e6ae3f) /* 0.431318519 */, 18 }, /* 6167 */ { MAD_F(0x06e7100c) /* 0.431411790 */, 18 }, /* 6168 */ { MAD_F(0x06e771db) /* 0.431505065 */, 18 }, /* 6169 */ { MAD_F(0x06e7d3ab) /* 0.431598346 */, 18 }, /* 6170 */ { MAD_F(0x06e8357c) /* 0.431691632 */, 18 }, /* 6171 */ { MAD_F(0x06e8974e) /* 0.431784923 */, 18 }, /* 6172 */ { MAD_F(0x06e8f922) /* 0.431878218 */, 18 }, /* 6173 */ { MAD_F(0x06e95af8) /* 0.431971519 */, 18 }, /* 6174 */ { MAD_F(0x06e9bcce) /* 0.432064825 */, 18 }, /* 6175 */ { MAD_F(0x06ea1ea6) /* 0.432158136 */, 18 }, /* 6176 */ { MAD_F(0x06ea807f) /* 0.432251452 */, 18 }, /* 6177 */ { MAD_F(0x06eae25a) /* 0.432344773 */, 18 }, /* 6178 */ { MAD_F(0x06eb4436) /* 0.432438099 */, 18 }, /* 6179 */ { MAD_F(0x06eba614) /* 0.432531431 */, 18 }, /* 6180 */ { MAD_F(0x06ec07f2) /* 0.432624767 */, 18 }, /* 6181 */ { MAD_F(0x06ec69d2) /* 0.432718108 */, 18 }, /* 6182 */ { MAD_F(0x06eccbb4) /* 0.432811454 */, 18 }, /* 6183 */ { MAD_F(0x06ed2d97) /* 0.432904805 */, 18 }, /* 6184 */ { MAD_F(0x06ed8f7b) /* 0.432998162 */, 18 }, /* 6185 */ { MAD_F(0x06edf160) /* 0.433091523 */, 18 }, /* 6186 */ { MAD_F(0x06ee5347) /* 0.433184889 */, 18 }, /* 6187 */ { MAD_F(0x06eeb52f) /* 0.433278261 */, 18 }, /* 6188 */ { MAD_F(0x06ef1719) /* 0.433371637 */, 18 }, /* 6189 */ { MAD_F(0x06ef7904) /* 0.433465019 */, 18 }, /* 6190 */ { MAD_F(0x06efdaf0) /* 0.433558405 */, 18 }, /* 6191 */ { MAD_F(0x06f03cde) /* 0.433651797 */, 18 }, /* 6192 */ { MAD_F(0x06f09ecc) /* 0.433745193 */, 18 }, /* 6193 */ { MAD_F(0x06f100bd) /* 0.433838595 */, 18 }, /* 6194 */ { MAD_F(0x06f162ae) /* 0.433932001 */, 18 }, /* 6195 */ { MAD_F(0x06f1c4a1) /* 0.434025413 */, 18 }, /* 6196 */ { MAD_F(0x06f22696) /* 0.434118830 */, 18 }, /* 6197 */ { MAD_F(0x06f2888b) /* 0.434212251 */, 18 }, /* 6198 */ { MAD_F(0x06f2ea82) /* 0.434305678 */, 18 }, /* 6199 */ { MAD_F(0x06f34c7b) /* 0.434399110 */, 18 }, /* 6200 */ { MAD_F(0x06f3ae75) /* 0.434492546 */, 18 }, /* 6201 */ { MAD_F(0x06f41070) /* 0.434585988 */, 18 }, /* 6202 */ { MAD_F(0x06f4726c) /* 0.434679435 */, 18 }, /* 6203 */ { MAD_F(0x06f4d46a) /* 0.434772887 */, 18 }, /* 6204 */ { MAD_F(0x06f53669) /* 0.434866344 */, 18 }, /* 6205 */ { MAD_F(0x06f59869) /* 0.434959806 */, 18 }, /* 6206 */ { MAD_F(0x06f5fa6b) /* 0.435053272 */, 18 }, /* 6207 */ { MAD_F(0x06f65c6e) /* 0.435146744 */, 18 }, /* 6208 */ { MAD_F(0x06f6be73) /* 0.435240221 */, 18 }, /* 6209 */ { MAD_F(0x06f72079) /* 0.435333703 */, 18 }, /* 6210 */ { MAD_F(0x06f78280) /* 0.435427190 */, 18 }, /* 6211 */ { MAD_F(0x06f7e489) /* 0.435520682 */, 18 }, /* 6212 */ { MAD_F(0x06f84693) /* 0.435614179 */, 18 }, /* 6213 */ { MAD_F(0x06f8a89e) /* 0.435707681 */, 18 }, /* 6214 */ { MAD_F(0x06f90aaa) /* 0.435801188 */, 18 }, /* 6215 */ { MAD_F(0x06f96cb8) /* 0.435894700 */, 18 }, /* 6216 */ { MAD_F(0x06f9cec8) /* 0.435988217 */, 18 }, /* 6217 */ { MAD_F(0x06fa30d8) /* 0.436081739 */, 18 }, /* 6218 */ { MAD_F(0x06fa92ea) /* 0.436175266 */, 18 }, /* 6219 */ { MAD_F(0x06faf4fe) /* 0.436268799 */, 18 }, /* 6220 */ { MAD_F(0x06fb5712) /* 0.436362336 */, 18 }, /* 6221 */ { MAD_F(0x06fbb928) /* 0.436455878 */, 18 }, /* 6222 */ { MAD_F(0x06fc1b40) /* 0.436549425 */, 18 }, /* 6223 */ { MAD_F(0x06fc7d58) /* 0.436642977 */, 18 }, /* 6224 */ { MAD_F(0x06fcdf72) /* 0.436736534 */, 18 }, /* 6225 */ { MAD_F(0x06fd418e) /* 0.436830096 */, 18 }, /* 6226 */ { MAD_F(0x06fda3ab) /* 0.436923664 */, 18 }, /* 6227 */ { MAD_F(0x06fe05c9) /* 0.437017236 */, 18 }, /* 6228 */ { MAD_F(0x06fe67e8) /* 0.437110813 */, 18 }, /* 6229 */ { MAD_F(0x06feca09) /* 0.437204395 */, 18 }, /* 6230 */ { MAD_F(0x06ff2c2b) /* 0.437297982 */, 18 }, /* 6231 */ { MAD_F(0x06ff8e4f) /* 0.437391575 */, 18 }, /* 6232 */ { MAD_F(0x06fff073) /* 0.437485172 */, 18 }, /* 6233 */ { MAD_F(0x0700529a) /* 0.437578774 */, 18 }, /* 6234 */ { MAD_F(0x0700b4c1) /* 0.437672381 */, 18 }, /* 6235 */ { MAD_F(0x070116ea) /* 0.437765994 */, 18 }, /* 6236 */ { MAD_F(0x07017914) /* 0.437859611 */, 18 }, /* 6237 */ { MAD_F(0x0701db40) /* 0.437953233 */, 18 }, /* 6238 */ { MAD_F(0x07023d6c) /* 0.438046860 */, 18 }, /* 6239 */ { MAD_F(0x07029f9b) /* 0.438140493 */, 18 }, /* 6240 */ { MAD_F(0x070301ca) /* 0.438234130 */, 18 }, /* 6241 */ { MAD_F(0x070363fb) /* 0.438327772 */, 18 }, /* 6242 */ { MAD_F(0x0703c62d) /* 0.438421419 */, 18 }, /* 6243 */ { MAD_F(0x07042861) /* 0.438515072 */, 18 }, /* 6244 */ { MAD_F(0x07048a96) /* 0.438608729 */, 18 }, /* 6245 */ { MAD_F(0x0704eccc) /* 0.438702391 */, 18 }, /* 6246 */ { MAD_F(0x07054f04) /* 0.438796059 */, 18 }, /* 6247 */ { MAD_F(0x0705b13d) /* 0.438889731 */, 18 }, /* 6248 */ { MAD_F(0x07061377) /* 0.438983408 */, 18 }, /* 6249 */ { MAD_F(0x070675b3) /* 0.439077090 */, 18 }, /* 6250 */ { MAD_F(0x0706d7f0) /* 0.439170778 */, 18 }, /* 6251 */ { MAD_F(0x07073a2e) /* 0.439264470 */, 18 }, /* 6252 */ { MAD_F(0x07079c6e) /* 0.439358167 */, 18 }, /* 6253 */ { MAD_F(0x0707feaf) /* 0.439451869 */, 18 }, /* 6254 */ { MAD_F(0x070860f1) /* 0.439545577 */, 18 }, /* 6255 */ { MAD_F(0x0708c335) /* 0.439639289 */, 18 }, /* 6256 */ { MAD_F(0x0709257a) /* 0.439733006 */, 18 }, /* 6257 */ { MAD_F(0x070987c0) /* 0.439826728 */, 18 }, /* 6258 */ { MAD_F(0x0709ea08) /* 0.439920456 */, 18 }, /* 6259 */ { MAD_F(0x070a4c51) /* 0.440014188 */, 18 }, /* 6260 */ { MAD_F(0x070aae9b) /* 0.440107925 */, 18 }, /* 6261 */ { MAD_F(0x070b10e7) /* 0.440201667 */, 18 }, /* 6262 */ { MAD_F(0x070b7334) /* 0.440295414 */, 18 }, /* 6263 */ { MAD_F(0x070bd583) /* 0.440389167 */, 18 }, /* 6264 */ { MAD_F(0x070c37d2) /* 0.440482924 */, 18 }, /* 6265 */ { MAD_F(0x070c9a23) /* 0.440576686 */, 18 }, /* 6266 */ { MAD_F(0x070cfc76) /* 0.440670453 */, 18 }, /* 6267 */ { MAD_F(0x070d5eca) /* 0.440764225 */, 18 }, /* 6268 */ { MAD_F(0x070dc11f) /* 0.440858002 */, 18 }, /* 6269 */ { MAD_F(0x070e2375) /* 0.440951784 */, 18 }, /* 6270 */ { MAD_F(0x070e85cd) /* 0.441045572 */, 18 }, /* 6271 */ { MAD_F(0x070ee826) /* 0.441139364 */, 18 }, /* 6272 */ { MAD_F(0x070f4a80) /* 0.441233161 */, 18 }, /* 6273 */ { MAD_F(0x070facdc) /* 0.441326963 */, 18 }, /* 6274 */ { MAD_F(0x07100f39) /* 0.441420770 */, 18 }, /* 6275 */ { MAD_F(0x07107198) /* 0.441514582 */, 18 }, /* 6276 */ { MAD_F(0x0710d3f8) /* 0.441608399 */, 18 }, /* 6277 */ { MAD_F(0x07113659) /* 0.441702221 */, 18 }, /* 6278 */ { MAD_F(0x071198bb) /* 0.441796048 */, 18 }, /* 6279 */ { MAD_F(0x0711fb1f) /* 0.441889880 */, 18 }, /* 6280 */ { MAD_F(0x07125d84) /* 0.441983717 */, 18 }, /* 6281 */ { MAD_F(0x0712bfeb) /* 0.442077559 */, 18 }, /* 6282 */ { MAD_F(0x07132253) /* 0.442171406 */, 18 }, /* 6283 */ { MAD_F(0x071384bc) /* 0.442265257 */, 18 }, /* 6284 */ { MAD_F(0x0713e726) /* 0.442359114 */, 18 }, /* 6285 */ { MAD_F(0x07144992) /* 0.442452976 */, 18 }, /* 6286 */ { MAD_F(0x0714abff) /* 0.442546843 */, 18 }, /* 6287 */ { MAD_F(0x07150e6e) /* 0.442640715 */, 18 }, /* 6288 */ { MAD_F(0x071570de) /* 0.442734592 */, 18 }, /* 6289 */ { MAD_F(0x0715d34f) /* 0.442828473 */, 18 }, /* 6290 */ { MAD_F(0x071635c1) /* 0.442922360 */, 18 }, /* 6291 */ { MAD_F(0x07169835) /* 0.443016252 */, 18 }, /* 6292 */ { MAD_F(0x0716faaa) /* 0.443110148 */, 18 }, /* 6293 */ { MAD_F(0x07175d21) /* 0.443204050 */, 18 }, /* 6294 */ { MAD_F(0x0717bf99) /* 0.443297957 */, 18 }, /* 6295 */ { MAD_F(0x07182212) /* 0.443391868 */, 18 }, /* 6296 */ { MAD_F(0x0718848d) /* 0.443485785 */, 18 }, /* 6297 */ { MAD_F(0x0718e709) /* 0.443579706 */, 18 }, /* 6298 */ { MAD_F(0x07194986) /* 0.443673633 */, 18 }, /* 6299 */ { MAD_F(0x0719ac04) /* 0.443767564 */, 18 }, /* 6300 */ { MAD_F(0x071a0e84) /* 0.443861501 */, 18 }, /* 6301 */ { MAD_F(0x071a7105) /* 0.443955442 */, 18 }, /* 6302 */ { MAD_F(0x071ad388) /* 0.444049389 */, 18 }, /* 6303 */ { MAD_F(0x071b360c) /* 0.444143340 */, 18 }, /* 6304 */ { MAD_F(0x071b9891) /* 0.444237296 */, 18 }, /* 6305 */ { MAD_F(0x071bfb18) /* 0.444331258 */, 18 }, /* 6306 */ { MAD_F(0x071c5d9f) /* 0.444425224 */, 18 }, /* 6307 */ { MAD_F(0x071cc029) /* 0.444519195 */, 18 }, /* 6308 */ { MAD_F(0x071d22b3) /* 0.444613171 */, 18 }, /* 6309 */ { MAD_F(0x071d853f) /* 0.444707153 */, 18 }, /* 6310 */ { MAD_F(0x071de7cc) /* 0.444801139 */, 18 }, /* 6311 */ { MAD_F(0x071e4a5b) /* 0.444895130 */, 18 }, /* 6312 */ { MAD_F(0x071eaceb) /* 0.444989126 */, 18 }, /* 6313 */ { MAD_F(0x071f0f7c) /* 0.445083127 */, 18 }, /* 6314 */ { MAD_F(0x071f720e) /* 0.445177133 */, 18 }, /* 6315 */ { MAD_F(0x071fd4a2) /* 0.445271144 */, 18 }, /* 6316 */ { MAD_F(0x07203737) /* 0.445365160 */, 18 }, /* 6317 */ { MAD_F(0x072099ce) /* 0.445459181 */, 18 }, /* 6318 */ { MAD_F(0x0720fc66) /* 0.445553206 */, 18 }, /* 6319 */ { MAD_F(0x07215eff) /* 0.445647237 */, 18 }, /* 6320 */ { MAD_F(0x0721c19a) /* 0.445741273 */, 18 }, /* 6321 */ { MAD_F(0x07222436) /* 0.445835314 */, 18 }, /* 6322 */ { MAD_F(0x072286d3) /* 0.445929359 */, 18 }, /* 6323 */ { MAD_F(0x0722e971) /* 0.446023410 */, 18 }, /* 6324 */ { MAD_F(0x07234c11) /* 0.446117466 */, 18 }, /* 6325 */ { MAD_F(0x0723aeb2) /* 0.446211526 */, 18 }, /* 6326 */ { MAD_F(0x07241155) /* 0.446305592 */, 18 }, /* 6327 */ { MAD_F(0x072473f9) /* 0.446399662 */, 18 }, /* 6328 */ { MAD_F(0x0724d69e) /* 0.446493738 */, 18 }, /* 6329 */ { MAD_F(0x07253944) /* 0.446587818 */, 18 }, /* 6330 */ { MAD_F(0x07259bec) /* 0.446681903 */, 18 }, /* 6331 */ { MAD_F(0x0725fe95) /* 0.446775994 */, 18 }, /* 6332 */ { MAD_F(0x07266140) /* 0.446870089 */, 18 }, /* 6333 */ { MAD_F(0x0726c3ec) /* 0.446964189 */, 18 }, /* 6334 */ { MAD_F(0x07272699) /* 0.447058294 */, 18 }, /* 6335 */ { MAD_F(0x07278947) /* 0.447152404 */, 18 }, /* 6336 */ { MAD_F(0x0727ebf7) /* 0.447246519 */, 18 }, /* 6337 */ { MAD_F(0x07284ea8) /* 0.447340639 */, 18 }, /* 6338 */ { MAD_F(0x0728b15b) /* 0.447434764 */, 18 }, /* 6339 */ { MAD_F(0x0729140f) /* 0.447528894 */, 18 }, /* 6340 */ { MAD_F(0x072976c4) /* 0.447623029 */, 18 }, /* 6341 */ { MAD_F(0x0729d97a) /* 0.447717169 */, 18 }, /* 6342 */ { MAD_F(0x072a3c32) /* 0.447811314 */, 18 }, /* 6343 */ { MAD_F(0x072a9eeb) /* 0.447905463 */, 18 }, /* 6344 */ { MAD_F(0x072b01a6) /* 0.447999618 */, 18 }, /* 6345 */ { MAD_F(0x072b6461) /* 0.448093778 */, 18 }, /* 6346 */ { MAD_F(0x072bc71e) /* 0.448187942 */, 18 }, /* 6347 */ { MAD_F(0x072c29dd) /* 0.448282112 */, 18 }, /* 6348 */ { MAD_F(0x072c8c9d) /* 0.448376286 */, 18 }, /* 6349 */ { MAD_F(0x072cef5e) /* 0.448470466 */, 18 }, /* 6350 */ { MAD_F(0x072d5220) /* 0.448564650 */, 18 }, /* 6351 */ { MAD_F(0x072db4e4) /* 0.448658839 */, 18 }, /* 6352 */ { MAD_F(0x072e17a9) /* 0.448753033 */, 18 }, /* 6353 */ { MAD_F(0x072e7a6f) /* 0.448847233 */, 18 }, /* 6354 */ { MAD_F(0x072edd37) /* 0.448941437 */, 18 }, /* 6355 */ { MAD_F(0x072f4000) /* 0.449035646 */, 18 }, /* 6356 */ { MAD_F(0x072fa2ca) /* 0.449129860 */, 18 }, /* 6357 */ { MAD_F(0x07300596) /* 0.449224079 */, 18 }, /* 6358 */ { MAD_F(0x07306863) /* 0.449318303 */, 18 }, /* 6359 */ { MAD_F(0x0730cb32) /* 0.449412531 */, 18 }, /* 6360 */ { MAD_F(0x07312e01) /* 0.449506765 */, 18 }, /* 6361 */ { MAD_F(0x073190d2) /* 0.449601004 */, 18 }, /* 6362 */ { MAD_F(0x0731f3a5) /* 0.449695247 */, 18 }, /* 6363 */ { MAD_F(0x07325678) /* 0.449789496 */, 18 }, /* 6364 */ { MAD_F(0x0732b94d) /* 0.449883749 */, 18 }, /* 6365 */ { MAD_F(0x07331c23) /* 0.449978008 */, 18 }, /* 6366 */ { MAD_F(0x07337efb) /* 0.450072271 */, 18 }, /* 6367 */ { MAD_F(0x0733e1d4) /* 0.450166540 */, 18 }, /* 6368 */ { MAD_F(0x073444ae) /* 0.450260813 */, 18 }, /* 6369 */ { MAD_F(0x0734a78a) /* 0.450355091 */, 18 }, /* 6370 */ { MAD_F(0x07350a67) /* 0.450449374 */, 18 }, /* 6371 */ { MAD_F(0x07356d45) /* 0.450543662 */, 18 }, /* 6372 */ { MAD_F(0x0735d025) /* 0.450637955 */, 18 }, /* 6373 */ { MAD_F(0x07363306) /* 0.450732253 */, 18 }, /* 6374 */ { MAD_F(0x073695e8) /* 0.450826556 */, 18 }, /* 6375 */ { MAD_F(0x0736f8cb) /* 0.450920864 */, 18 }, /* 6376 */ { MAD_F(0x07375bb0) /* 0.451015176 */, 18 }, /* 6377 */ { MAD_F(0x0737be96) /* 0.451109494 */, 18 }, /* 6378 */ { MAD_F(0x0738217e) /* 0.451203817 */, 18 }, /* 6379 */ { MAD_F(0x07388467) /* 0.451298144 */, 18 }, /* 6380 */ { MAD_F(0x0738e751) /* 0.451392477 */, 18 }, /* 6381 */ { MAD_F(0x07394a3d) /* 0.451486814 */, 18 }, /* 6382 */ { MAD_F(0x0739ad29) /* 0.451581156 */, 18 }, /* 6383 */ { MAD_F(0x073a1017) /* 0.451675503 */, 18 }, /* 6384 */ { MAD_F(0x073a7307) /* 0.451769856 */, 18 }, /* 6385 */ { MAD_F(0x073ad5f8) /* 0.451864213 */, 18 }, /* 6386 */ { MAD_F(0x073b38ea) /* 0.451958575 */, 18 }, /* 6387 */ { MAD_F(0x073b9bdd) /* 0.452052942 */, 18 }, /* 6388 */ { MAD_F(0x073bfed2) /* 0.452147313 */, 18 }, /* 6389 */ { MAD_F(0x073c61c8) /* 0.452241690 */, 18 }, /* 6390 */ { MAD_F(0x073cc4bf) /* 0.452336072 */, 18 }, /* 6391 */ { MAD_F(0x073d27b8) /* 0.452430458 */, 18 }, /* 6392 */ { MAD_F(0x073d8ab2) /* 0.452524850 */, 18 }, /* 6393 */ { MAD_F(0x073dedae) /* 0.452619246 */, 18 }, /* 6394 */ { MAD_F(0x073e50aa) /* 0.452713648 */, 18 }, /* 6395 */ { MAD_F(0x073eb3a8) /* 0.452808054 */, 18 }, /* 6396 */ { MAD_F(0x073f16a8) /* 0.452902465 */, 18 }, /* 6397 */ { MAD_F(0x073f79a8) /* 0.452996882 */, 18 }, /* 6398 */ { MAD_F(0x073fdcaa) /* 0.453091303 */, 18 }, /* 6399 */ { MAD_F(0x07403fad) /* 0.453185729 */, 18 }, /* 6400 */ { MAD_F(0x0740a2b2) /* 0.453280160 */, 18 }, /* 6401 */ { MAD_F(0x074105b8) /* 0.453374595 */, 18 }, /* 6402 */ { MAD_F(0x074168bf) /* 0.453469036 */, 18 }, /* 6403 */ { MAD_F(0x0741cbc8) /* 0.453563482 */, 18 }, /* 6404 */ { MAD_F(0x07422ed2) /* 0.453657932 */, 18 }, /* 6405 */ { MAD_F(0x074291dd) /* 0.453752388 */, 18 }, /* 6406 */ { MAD_F(0x0742f4e9) /* 0.453846848 */, 18 }, /* 6407 */ { MAD_F(0x074357f7) /* 0.453941314 */, 18 }, /* 6408 */ { MAD_F(0x0743bb06) /* 0.454035784 */, 18 }, /* 6409 */ { MAD_F(0x07441e17) /* 0.454130259 */, 18 }, /* 6410 */ { MAD_F(0x07448129) /* 0.454224739 */, 18 }, /* 6411 */ { MAD_F(0x0744e43c) /* 0.454319224 */, 18 }, /* 6412 */ { MAD_F(0x07454750) /* 0.454413714 */, 18 }, /* 6413 */ { MAD_F(0x0745aa66) /* 0.454508209 */, 18 }, /* 6414 */ { MAD_F(0x07460d7d) /* 0.454602708 */, 18 }, /* 6415 */ { MAD_F(0x07467095) /* 0.454697213 */, 18 }, /* 6416 */ { MAD_F(0x0746d3af) /* 0.454791723 */, 18 }, /* 6417 */ { MAD_F(0x074736ca) /* 0.454886237 */, 18 }, /* 6418 */ { MAD_F(0x074799e7) /* 0.454980756 */, 18 }, /* 6419 */ { MAD_F(0x0747fd04) /* 0.455075281 */, 18 }, /* 6420 */ { MAD_F(0x07486023) /* 0.455169810 */, 18 }, /* 6421 */ { MAD_F(0x0748c344) /* 0.455264344 */, 18 }, /* 6422 */ { MAD_F(0x07492665) /* 0.455358883 */, 18 }, /* 6423 */ { MAD_F(0x07498988) /* 0.455453427 */, 18 }, /* 6424 */ { MAD_F(0x0749ecac) /* 0.455547976 */, 18 }, /* 6425 */ { MAD_F(0x074a4fd2) /* 0.455642529 */, 18 }, /* 6426 */ { MAD_F(0x074ab2f9) /* 0.455737088 */, 18 }, /* 6427 */ { MAD_F(0x074b1621) /* 0.455831652 */, 18 }, /* 6428 */ { MAD_F(0x074b794b) /* 0.455926220 */, 18 }, /* 6429 */ { MAD_F(0x074bdc75) /* 0.456020793 */, 18 }, /* 6430 */ { MAD_F(0x074c3fa1) /* 0.456115372 */, 18 }, /* 6431 */ { MAD_F(0x074ca2cf) /* 0.456209955 */, 18 }, /* 6432 */ { MAD_F(0x074d05fe) /* 0.456304543 */, 18 }, /* 6433 */ { MAD_F(0x074d692e) /* 0.456399136 */, 18 }, /* 6434 */ { MAD_F(0x074dcc5f) /* 0.456493733 */, 18 }, /* 6435 */ { MAD_F(0x074e2f92) /* 0.456588336 */, 18 }, /* 6436 */ { MAD_F(0x074e92c6) /* 0.456682944 */, 18 }, /* 6437 */ { MAD_F(0x074ef5fb) /* 0.456777556 */, 18 }, /* 6438 */ { MAD_F(0x074f5932) /* 0.456872174 */, 18 }, /* 6439 */ { MAD_F(0x074fbc6a) /* 0.456966796 */, 18 }, /* 6440 */ { MAD_F(0x07501fa3) /* 0.457061423 */, 18 }, /* 6441 */ { MAD_F(0x075082de) /* 0.457156056 */, 18 }, /* 6442 */ { MAD_F(0x0750e61a) /* 0.457250693 */, 18 }, /* 6443 */ { MAD_F(0x07514957) /* 0.457345335 */, 18 }, /* 6444 */ { MAD_F(0x0751ac96) /* 0.457439981 */, 18 }, /* 6445 */ { MAD_F(0x07520fd6) /* 0.457534633 */, 18 }, /* 6446 */ { MAD_F(0x07527317) /* 0.457629290 */, 18 }, /* 6447 */ { MAD_F(0x0752d659) /* 0.457723951 */, 18 }, /* 6448 */ { MAD_F(0x0753399d) /* 0.457818618 */, 18 }, /* 6449 */ { MAD_F(0x07539ce2) /* 0.457913289 */, 18 }, /* 6450 */ { MAD_F(0x07540029) /* 0.458007965 */, 18 }, /* 6451 */ { MAD_F(0x07546371) /* 0.458102646 */, 18 }, /* 6452 */ { MAD_F(0x0754c6ba) /* 0.458197332 */, 18 }, /* 6453 */ { MAD_F(0x07552a04) /* 0.458292023 */, 18 }, /* 6454 */ { MAD_F(0x07558d50) /* 0.458386719 */, 18 }, /* 6455 */ { MAD_F(0x0755f09d) /* 0.458481420 */, 18 }, /* 6456 */ { MAD_F(0x075653eb) /* 0.458576125 */, 18 }, /* 6457 */ { MAD_F(0x0756b73b) /* 0.458670836 */, 18 }, /* 6458 */ { MAD_F(0x07571a8c) /* 0.458765551 */, 18 }, /* 6459 */ { MAD_F(0x07577dde) /* 0.458860271 */, 18 }, /* 6460 */ { MAD_F(0x0757e131) /* 0.458954996 */, 18 }, /* 6461 */ { MAD_F(0x07584486) /* 0.459049726 */, 18 }, /* 6462 */ { MAD_F(0x0758a7dd) /* 0.459144461 */, 18 }, /* 6463 */ { MAD_F(0x07590b34) /* 0.459239201 */, 18 }, /* 6464 */ { MAD_F(0x07596e8d) /* 0.459333946 */, 18 }, /* 6465 */ { MAD_F(0x0759d1e7) /* 0.459428695 */, 18 }, /* 6466 */ { MAD_F(0x075a3542) /* 0.459523450 */, 18 }, /* 6467 */ { MAD_F(0x075a989f) /* 0.459618209 */, 18 }, /* 6468 */ { MAD_F(0x075afbfd) /* 0.459712973 */, 18 }, /* 6469 */ { MAD_F(0x075b5f5d) /* 0.459807742 */, 18 }, /* 6470 */ { MAD_F(0x075bc2bd) /* 0.459902516 */, 18 }, /* 6471 */ { MAD_F(0x075c261f) /* 0.459997295 */, 18 }, /* 6472 */ { MAD_F(0x075c8983) /* 0.460092079 */, 18 }, /* 6473 */ { MAD_F(0x075cece7) /* 0.460186867 */, 18 }, /* 6474 */ { MAD_F(0x075d504d) /* 0.460281661 */, 18 }, /* 6475 */ { MAD_F(0x075db3b5) /* 0.460376459 */, 18 }, /* 6476 */ { MAD_F(0x075e171d) /* 0.460471262 */, 18 }, /* 6477 */ { MAD_F(0x075e7a87) /* 0.460566071 */, 18 }, /* 6478 */ { MAD_F(0x075eddf2) /* 0.460660884 */, 18 }, /* 6479 */ { MAD_F(0x075f415f) /* 0.460755701 */, 18 }, /* 6480 */ { MAD_F(0x075fa4cc) /* 0.460850524 */, 18 }, /* 6481 */ { MAD_F(0x0760083b) /* 0.460945352 */, 18 }, /* 6482 */ { MAD_F(0x07606bac) /* 0.461040184 */, 18 }, /* 6483 */ { MAD_F(0x0760cf1e) /* 0.461135022 */, 18 }, /* 6484 */ { MAD_F(0x07613291) /* 0.461229864 */, 18 }, /* 6485 */ { MAD_F(0x07619605) /* 0.461324711 */, 18 }, /* 6486 */ { MAD_F(0x0761f97b) /* 0.461419563 */, 18 }, /* 6487 */ { MAD_F(0x07625cf2) /* 0.461514420 */, 18 }, /* 6488 */ { MAD_F(0x0762c06a) /* 0.461609282 */, 18 }, /* 6489 */ { MAD_F(0x076323e3) /* 0.461704149 */, 18 }, /* 6490 */ { MAD_F(0x0763875e) /* 0.461799020 */, 18 }, /* 6491 */ { MAD_F(0x0763eadb) /* 0.461893897 */, 18 }, /* 6492 */ { MAD_F(0x07644e58) /* 0.461988778 */, 18 }, /* 6493 */ { MAD_F(0x0764b1d7) /* 0.462083664 */, 18 }, /* 6494 */ { MAD_F(0x07651557) /* 0.462178555 */, 18 }, /* 6495 */ { MAD_F(0x076578d8) /* 0.462273451 */, 18 }, /* 6496 */ { MAD_F(0x0765dc5b) /* 0.462368352 */, 18 }, /* 6497 */ { MAD_F(0x07663fdf) /* 0.462463257 */, 18 }, /* 6498 */ { MAD_F(0x0766a364) /* 0.462558168 */, 18 }, /* 6499 */ { MAD_F(0x076706eb) /* 0.462653083 */, 18 }, /* 6500 */ { MAD_F(0x07676a73) /* 0.462748003 */, 18 }, /* 6501 */ { MAD_F(0x0767cdfc) /* 0.462842928 */, 18 }, /* 6502 */ { MAD_F(0x07683187) /* 0.462937858 */, 18 }, /* 6503 */ { MAD_F(0x07689513) /* 0.463032793 */, 18 }, /* 6504 */ { MAD_F(0x0768f8a0) /* 0.463127733 */, 18 }, /* 6505 */ { MAD_F(0x07695c2e) /* 0.463222678 */, 18 }, /* 6506 */ { MAD_F(0x0769bfbe) /* 0.463317627 */, 18 }, /* 6507 */ { MAD_F(0x076a234f) /* 0.463412581 */, 18 }, /* 6508 */ { MAD_F(0x076a86e2) /* 0.463507540 */, 18 }, /* 6509 */ { MAD_F(0x076aea75) /* 0.463602504 */, 18 }, /* 6510 */ { MAD_F(0x076b4e0a) /* 0.463697473 */, 18 }, /* 6511 */ { MAD_F(0x076bb1a1) /* 0.463792447 */, 18 }, /* 6512 */ { MAD_F(0x076c1538) /* 0.463887426 */, 18 }, /* 6513 */ { MAD_F(0x076c78d1) /* 0.463982409 */, 18 }, /* 6514 */ { MAD_F(0x076cdc6c) /* 0.464077398 */, 18 }, /* 6515 */ { MAD_F(0x076d4007) /* 0.464172391 */, 18 }, /* 6516 */ { MAD_F(0x076da3a4) /* 0.464267389 */, 18 }, /* 6517 */ { MAD_F(0x076e0742) /* 0.464362392 */, 18 }, /* 6518 */ { MAD_F(0x076e6ae2) /* 0.464457399 */, 18 }, /* 6519 */ { MAD_F(0x076ece82) /* 0.464552412 */, 18 }, /* 6520 */ { MAD_F(0x076f3224) /* 0.464647430 */, 18 }, /* 6521 */ { MAD_F(0x076f95c8) /* 0.464742452 */, 18 }, /* 6522 */ { MAD_F(0x076ff96c) /* 0.464837479 */, 18 }, /* 6523 */ { MAD_F(0x07705d12) /* 0.464932511 */, 18 }, /* 6524 */ { MAD_F(0x0770c0ba) /* 0.465027548 */, 18 }, /* 6525 */ { MAD_F(0x07712462) /* 0.465122590 */, 18 }, /* 6526 */ { MAD_F(0x0771880c) /* 0.465217637 */, 18 }, /* 6527 */ { MAD_F(0x0771ebb7) /* 0.465312688 */, 18 }, /* 6528 */ { MAD_F(0x07724f64) /* 0.465407744 */, 18 }, /* 6529 */ { MAD_F(0x0772b312) /* 0.465502806 */, 18 }, /* 6530 */ { MAD_F(0x077316c1) /* 0.465597872 */, 18 }, /* 6531 */ { MAD_F(0x07737a71) /* 0.465692943 */, 18 }, /* 6532 */ { MAD_F(0x0773de23) /* 0.465788018 */, 18 }, /* 6533 */ { MAD_F(0x077441d6) /* 0.465883099 */, 18 }, /* 6534 */ { MAD_F(0x0774a58a) /* 0.465978184 */, 18 }, /* 6535 */ { MAD_F(0x07750940) /* 0.466073275 */, 18 }, /* 6536 */ { MAD_F(0x07756cf7) /* 0.466168370 */, 18 }, /* 6537 */ { MAD_F(0x0775d0af) /* 0.466263470 */, 18 }, /* 6538 */ { MAD_F(0x07763468) /* 0.466358575 */, 18 }, /* 6539 */ { MAD_F(0x07769823) /* 0.466453684 */, 18 }, /* 6540 */ { MAD_F(0x0776fbdf) /* 0.466548799 */, 18 }, /* 6541 */ { MAD_F(0x07775f9d) /* 0.466643918 */, 18 }, /* 6542 */ { MAD_F(0x0777c35c) /* 0.466739043 */, 18 }, /* 6543 */ { MAD_F(0x0778271c) /* 0.466834172 */, 18 }, /* 6544 */ { MAD_F(0x07788add) /* 0.466929306 */, 18 }, /* 6545 */ { MAD_F(0x0778ee9f) /* 0.467024445 */, 18 }, /* 6546 */ { MAD_F(0x07795263) /* 0.467119588 */, 18 }, /* 6547 */ { MAD_F(0x0779b629) /* 0.467214737 */, 18 }, /* 6548 */ { MAD_F(0x077a19ef) /* 0.467309890 */, 18 }, /* 6549 */ { MAD_F(0x077a7db7) /* 0.467405048 */, 18 }, /* 6550 */ { MAD_F(0x077ae180) /* 0.467500211 */, 18 }, /* 6551 */ { MAD_F(0x077b454b) /* 0.467595379 */, 18 }, /* 6552 */ { MAD_F(0x077ba916) /* 0.467690552 */, 18 }, /* 6553 */ { MAD_F(0x077c0ce3) /* 0.467785729 */, 18 }, /* 6554 */ { MAD_F(0x077c70b2) /* 0.467880912 */, 18 }, /* 6555 */ { MAD_F(0x077cd481) /* 0.467976099 */, 18 }, /* 6556 */ { MAD_F(0x077d3852) /* 0.468071291 */, 18 }, /* 6557 */ { MAD_F(0x077d9c24) /* 0.468166488 */, 18 }, /* 6558 */ { MAD_F(0x077dfff8) /* 0.468261690 */, 18 }, /* 6559 */ { MAD_F(0x077e63cd) /* 0.468356896 */, 18 }, /* 6560 */ { MAD_F(0x077ec7a3) /* 0.468452108 */, 18 }, /* 6561 */ { MAD_F(0x077f2b7a) /* 0.468547324 */, 18 }, /* 6562 */ { MAD_F(0x077f8f53) /* 0.468642545 */, 18 }, /* 6563 */ { MAD_F(0x077ff32d) /* 0.468737771 */, 18 }, /* 6564 */ { MAD_F(0x07805708) /* 0.468833002 */, 18 }, /* 6565 */ { MAD_F(0x0780bae5) /* 0.468928237 */, 18 }, /* 6566 */ { MAD_F(0x07811ec3) /* 0.469023478 */, 18 }, /* 6567 */ { MAD_F(0x078182a2) /* 0.469118723 */, 18 }, /* 6568 */ { MAD_F(0x0781e683) /* 0.469213973 */, 18 }, /* 6569 */ { MAD_F(0x07824a64) /* 0.469309228 */, 18 }, /* 6570 */ { MAD_F(0x0782ae47) /* 0.469404488 */, 18 }, /* 6571 */ { MAD_F(0x0783122c) /* 0.469499752 */, 18 }, /* 6572 */ { MAD_F(0x07837612) /* 0.469595022 */, 18 }, /* 6573 */ { MAD_F(0x0783d9f9) /* 0.469690296 */, 18 }, /* 6574 */ { MAD_F(0x07843de1) /* 0.469785575 */, 18 }, /* 6575 */ { MAD_F(0x0784a1ca) /* 0.469880859 */, 18 }, /* 6576 */ { MAD_F(0x078505b5) /* 0.469976148 */, 18 }, /* 6577 */ { MAD_F(0x078569a2) /* 0.470071442 */, 18 }, /* 6578 */ { MAD_F(0x0785cd8f) /* 0.470166740 */, 18 }, /* 6579 */ { MAD_F(0x0786317e) /* 0.470262043 */, 18 }, /* 6580 */ { MAD_F(0x0786956e) /* 0.470357351 */, 18 }, /* 6581 */ { MAD_F(0x0786f95f) /* 0.470452664 */, 18 }, /* 6582 */ { MAD_F(0x07875d52) /* 0.470547982 */, 18 }, /* 6583 */ { MAD_F(0x0787c146) /* 0.470643305 */, 18 }, /* 6584 */ { MAD_F(0x0788253b) /* 0.470738632 */, 18 }, /* 6585 */ { MAD_F(0x07888932) /* 0.470833964 */, 18 }, /* 6586 */ { MAD_F(0x0788ed2a) /* 0.470929301 */, 18 }, /* 6587 */ { MAD_F(0x07895123) /* 0.471024643 */, 18 }, /* 6588 */ { MAD_F(0x0789b51d) /* 0.471119990 */, 18 }, /* 6589 */ { MAD_F(0x078a1919) /* 0.471215341 */, 18 }, /* 6590 */ { MAD_F(0x078a7d16) /* 0.471310698 */, 18 }, /* 6591 */ { MAD_F(0x078ae114) /* 0.471406059 */, 18 }, /* 6592 */ { MAD_F(0x078b4514) /* 0.471501425 */, 18 }, /* 6593 */ { MAD_F(0x078ba915) /* 0.471596796 */, 18 }, /* 6594 */ { MAD_F(0x078c0d17) /* 0.471692171 */, 18 }, /* 6595 */ { MAD_F(0x078c711a) /* 0.471787552 */, 18 }, /* 6596 */ { MAD_F(0x078cd51f) /* 0.471882937 */, 18 }, /* 6597 */ { MAD_F(0x078d3925) /* 0.471978327 */, 18 }, /* 6598 */ { MAD_F(0x078d9d2d) /* 0.472073722 */, 18 }, /* 6599 */ { MAD_F(0x078e0135) /* 0.472169122 */, 18 }, /* 6600 */ { MAD_F(0x078e653f) /* 0.472264527 */, 18 }, /* 6601 */ { MAD_F(0x078ec94b) /* 0.472359936 */, 18 }, /* 6602 */ { MAD_F(0x078f2d57) /* 0.472455350 */, 18 }, /* 6603 */ { MAD_F(0x078f9165) /* 0.472550769 */, 18 }, /* 6604 */ { MAD_F(0x078ff574) /* 0.472646193 */, 18 }, /* 6605 */ { MAD_F(0x07905985) /* 0.472741622 */, 18 }, /* 6606 */ { MAD_F(0x0790bd96) /* 0.472837055 */, 18 }, /* 6607 */ { MAD_F(0x079121a9) /* 0.472932493 */, 18 }, /* 6608 */ { MAD_F(0x079185be) /* 0.473027937 */, 18 }, /* 6609 */ { MAD_F(0x0791e9d3) /* 0.473123384 */, 18 }, /* 6610 */ { MAD_F(0x07924dea) /* 0.473218837 */, 18 }, /* 6611 */ { MAD_F(0x0792b202) /* 0.473314295 */, 18 }, /* 6612 */ { MAD_F(0x0793161c) /* 0.473409757 */, 18 }, /* 6613 */ { MAD_F(0x07937a37) /* 0.473505224 */, 18 }, /* 6614 */ { MAD_F(0x0793de53) /* 0.473600696 */, 18 }, /* 6615 */ { MAD_F(0x07944270) /* 0.473696173 */, 18 }, /* 6616 */ { MAD_F(0x0794a68f) /* 0.473791655 */, 18 }, /* 6617 */ { MAD_F(0x07950aaf) /* 0.473887141 */, 18 }, /* 6618 */ { MAD_F(0x07956ed0) /* 0.473982632 */, 18 }, /* 6619 */ { MAD_F(0x0795d2f2) /* 0.474078128 */, 18 }, /* 6620 */ { MAD_F(0x07963716) /* 0.474173629 */, 18 }, /* 6621 */ { MAD_F(0x07969b3b) /* 0.474269135 */, 18 }, /* 6622 */ { MAD_F(0x0796ff62) /* 0.474364645 */, 18 }, /* 6623 */ { MAD_F(0x07976389) /* 0.474460161 */, 18 }, /* 6624 */ { MAD_F(0x0797c7b2) /* 0.474555681 */, 18 }, /* 6625 */ { MAD_F(0x07982bdd) /* 0.474651205 */, 18 }, /* 6626 */ { MAD_F(0x07989008) /* 0.474746735 */, 18 }, /* 6627 */ { MAD_F(0x0798f435) /* 0.474842270 */, 18 }, /* 6628 */ { MAD_F(0x07995863) /* 0.474937809 */, 18 }, /* 6629 */ { MAD_F(0x0799bc92) /* 0.475033353 */, 18 }, /* 6630 */ { MAD_F(0x079a20c3) /* 0.475128902 */, 18 }, /* 6631 */ { MAD_F(0x079a84f5) /* 0.475224456 */, 18 }, /* 6632 */ { MAD_F(0x079ae929) /* 0.475320014 */, 18 }, /* 6633 */ { MAD_F(0x079b4d5d) /* 0.475415578 */, 18 }, /* 6634 */ { MAD_F(0x079bb193) /* 0.475511146 */, 18 }, /* 6635 */ { MAD_F(0x079c15ca) /* 0.475606719 */, 18 }, /* 6636 */ { MAD_F(0x079c7a03) /* 0.475702296 */, 18 }, /* 6637 */ { MAD_F(0x079cde3c) /* 0.475797879 */, 18 }, /* 6638 */ { MAD_F(0x079d4277) /* 0.475893466 */, 18 }, /* 6639 */ { MAD_F(0x079da6b4) /* 0.475989058 */, 18 }, /* 6640 */ { MAD_F(0x079e0af1) /* 0.476084655 */, 18 }, /* 6641 */ { MAD_F(0x079e6f30) /* 0.476180257 */, 18 }, /* 6642 */ { MAD_F(0x079ed370) /* 0.476275863 */, 18 }, /* 6643 */ { MAD_F(0x079f37b2) /* 0.476371475 */, 18 }, /* 6644 */ { MAD_F(0x079f9bf5) /* 0.476467091 */, 18 }, /* 6645 */ { MAD_F(0x07a00039) /* 0.476562712 */, 18 }, /* 6646 */ { MAD_F(0x07a0647e) /* 0.476658338 */, 18 }, /* 6647 */ { MAD_F(0x07a0c8c5) /* 0.476753968 */, 18 }, /* 6648 */ { MAD_F(0x07a12d0c) /* 0.476849603 */, 18 }, /* 6649 */ { MAD_F(0x07a19156) /* 0.476945243 */, 18 }, /* 6650 */ { MAD_F(0x07a1f5a0) /* 0.477040888 */, 18 }, /* 6651 */ { MAD_F(0x07a259ec) /* 0.477136538 */, 18 }, /* 6652 */ { MAD_F(0x07a2be39) /* 0.477232193 */, 18 }, /* 6653 */ { MAD_F(0x07a32287) /* 0.477327852 */, 18 }, /* 6654 */ { MAD_F(0x07a386d7) /* 0.477423516 */, 18 }, /* 6655 */ { MAD_F(0x07a3eb28) /* 0.477519185 */, 18 }, /* 6656 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 18 }, /* 6657 */ { MAD_F(0x07a4b3ce) /* 0.477710537 */, 18 }, /* 6658 */ { MAD_F(0x07a51822) /* 0.477806220 */, 18 }, /* 6659 */ { MAD_F(0x07a57c78) /* 0.477901908 */, 18 }, /* 6660 */ { MAD_F(0x07a5e0d0) /* 0.477997601 */, 18 }, /* 6661 */ { MAD_F(0x07a64528) /* 0.478093299 */, 18 }, /* 6662 */ { MAD_F(0x07a6a982) /* 0.478189001 */, 18 }, /* 6663 */ { MAD_F(0x07a70ddd) /* 0.478284708 */, 18 }, /* 6664 */ { MAD_F(0x07a7723a) /* 0.478380420 */, 18 }, /* 6665 */ { MAD_F(0x07a7d698) /* 0.478476137 */, 18 }, /* 6666 */ { MAD_F(0x07a83af7) /* 0.478571858 */, 18 }, /* 6667 */ { MAD_F(0x07a89f57) /* 0.478667585 */, 18 }, /* 6668 */ { MAD_F(0x07a903b9) /* 0.478763316 */, 18 }, /* 6669 */ { MAD_F(0x07a9681c) /* 0.478859052 */, 18 }, /* 6670 */ { MAD_F(0x07a9cc80) /* 0.478954793 */, 18 }, /* 6671 */ { MAD_F(0x07aa30e5) /* 0.479050538 */, 18 }, /* 6672 */ { MAD_F(0x07aa954c) /* 0.479146288 */, 18 }, /* 6673 */ { MAD_F(0x07aaf9b4) /* 0.479242043 */, 18 }, /* 6674 */ { MAD_F(0x07ab5e1e) /* 0.479337803 */, 18 }, /* 6675 */ { MAD_F(0x07abc288) /* 0.479433568 */, 18 }, /* 6676 */ { MAD_F(0x07ac26f4) /* 0.479529337 */, 18 }, /* 6677 */ { MAD_F(0x07ac8b61) /* 0.479625111 */, 18 }, /* 6678 */ { MAD_F(0x07acefd0) /* 0.479720890 */, 18 }, /* 6679 */ { MAD_F(0x07ad543f) /* 0.479816674 */, 18 }, /* 6680 */ { MAD_F(0x07adb8b0) /* 0.479912463 */, 18 }, /* 6681 */ { MAD_F(0x07ae1d23) /* 0.480008256 */, 18 }, /* 6682 */ { MAD_F(0x07ae8196) /* 0.480104054 */, 18 }, /* 6683 */ { MAD_F(0x07aee60b) /* 0.480199857 */, 18 }, /* 6684 */ { MAD_F(0x07af4a81) /* 0.480295664 */, 18 }, /* 6685 */ { MAD_F(0x07afaef9) /* 0.480391477 */, 18 }, /* 6686 */ { MAD_F(0x07b01372) /* 0.480487294 */, 18 }, /* 6687 */ { MAD_F(0x07b077ec) /* 0.480583116 */, 18 }, /* 6688 */ { MAD_F(0x07b0dc67) /* 0.480678943 */, 18 }, /* 6689 */ { MAD_F(0x07b140e4) /* 0.480774774 */, 18 }, /* 6690 */ { MAD_F(0x07b1a561) /* 0.480870611 */, 18 }, /* 6691 */ { MAD_F(0x07b209e1) /* 0.480966452 */, 18 }, /* 6692 */ { MAD_F(0x07b26e61) /* 0.481062298 */, 18 }, /* 6693 */ { MAD_F(0x07b2d2e3) /* 0.481158148 */, 18 }, /* 6694 */ { MAD_F(0x07b33766) /* 0.481254004 */, 18 }, /* 6695 */ { MAD_F(0x07b39bea) /* 0.481349864 */, 18 }, /* 6696 */ { MAD_F(0x07b4006f) /* 0.481445729 */, 18 }, /* 6697 */ { MAD_F(0x07b464f6) /* 0.481541598 */, 18 }, /* 6698 */ { MAD_F(0x07b4c97e) /* 0.481637473 */, 18 }, /* 6699 */ { MAD_F(0x07b52e08) /* 0.481733352 */, 18 }, /* 6700 */ { MAD_F(0x07b59292) /* 0.481829236 */, 18 }, /* 6701 */ { MAD_F(0x07b5f71e) /* 0.481925125 */, 18 }, /* 6702 */ { MAD_F(0x07b65bac) /* 0.482021019 */, 18 }, /* 6703 */ { MAD_F(0x07b6c03a) /* 0.482116917 */, 18 }, /* 6704 */ { MAD_F(0x07b724ca) /* 0.482212820 */, 18 }, /* 6705 */ { MAD_F(0x07b7895b) /* 0.482308728 */, 18 }, /* 6706 */ { MAD_F(0x07b7eded) /* 0.482404640 */, 18 }, /* 6707 */ { MAD_F(0x07b85281) /* 0.482500558 */, 18 }, /* 6708 */ { MAD_F(0x07b8b716) /* 0.482596480 */, 18 }, /* 6709 */ { MAD_F(0x07b91bac) /* 0.482692407 */, 18 }, /* 6710 */ { MAD_F(0x07b98044) /* 0.482788339 */, 18 }, /* 6711 */ { MAD_F(0x07b9e4dc) /* 0.482884275 */, 18 }, /* 6712 */ { MAD_F(0x07ba4976) /* 0.482980216 */, 18 }, /* 6713 */ { MAD_F(0x07baae12) /* 0.483076162 */, 18 }, /* 6714 */ { MAD_F(0x07bb12ae) /* 0.483172113 */, 18 }, /* 6715 */ { MAD_F(0x07bb774c) /* 0.483268069 */, 18 }, /* 6716 */ { MAD_F(0x07bbdbeb) /* 0.483364029 */, 18 }, /* 6717 */ { MAD_F(0x07bc408c) /* 0.483459994 */, 18 }, /* 6718 */ { MAD_F(0x07bca52d) /* 0.483555964 */, 18 }, /* 6719 */ { MAD_F(0x07bd09d0) /* 0.483651939 */, 18 }, /* 6720 */ { MAD_F(0x07bd6e75) /* 0.483747918 */, 18 }, /* 6721 */ { MAD_F(0x07bdd31a) /* 0.483843902 */, 18 }, /* 6722 */ { MAD_F(0x07be37c1) /* 0.483939891 */, 18 }, /* 6723 */ { MAD_F(0x07be9c69) /* 0.484035885 */, 18 }, /* 6724 */ { MAD_F(0x07bf0113) /* 0.484131883 */, 18 }, /* 6725 */ { MAD_F(0x07bf65bd) /* 0.484227886 */, 18 }, /* 6726 */ { MAD_F(0x07bfca69) /* 0.484323894 */, 18 }, /* 6727 */ { MAD_F(0x07c02f16) /* 0.484419907 */, 18 }, /* 6728 */ { MAD_F(0x07c093c5) /* 0.484515924 */, 18 }, /* 6729 */ { MAD_F(0x07c0f875) /* 0.484611946 */, 18 }, /* 6730 */ { MAD_F(0x07c15d26) /* 0.484707973 */, 18 }, /* 6731 */ { MAD_F(0x07c1c1d8) /* 0.484804005 */, 18 }, /* 6732 */ { MAD_F(0x07c2268b) /* 0.484900041 */, 18 }, /* 6733 */ { MAD_F(0x07c28b40) /* 0.484996083 */, 18 }, /* 6734 */ { MAD_F(0x07c2eff6) /* 0.485092128 */, 18 }, /* 6735 */ { MAD_F(0x07c354ae) /* 0.485188179 */, 18 }, /* 6736 */ { MAD_F(0x07c3b967) /* 0.485284235 */, 18 }, /* 6737 */ { MAD_F(0x07c41e21) /* 0.485380295 */, 18 }, /* 6738 */ { MAD_F(0x07c482dc) /* 0.485476360 */, 18 }, /* 6739 */ { MAD_F(0x07c4e798) /* 0.485572430 */, 18 }, /* 6740 */ { MAD_F(0x07c54c56) /* 0.485668504 */, 18 }, /* 6741 */ { MAD_F(0x07c5b115) /* 0.485764583 */, 18 }, /* 6742 */ { MAD_F(0x07c615d6) /* 0.485860667 */, 18 }, /* 6743 */ { MAD_F(0x07c67a97) /* 0.485956756 */, 18 }, /* 6744 */ { MAD_F(0x07c6df5a) /* 0.486052849 */, 18 }, /* 6745 */ { MAD_F(0x07c7441e) /* 0.486148948 */, 18 }, /* 6746 */ { MAD_F(0x07c7a8e4) /* 0.486245051 */, 18 }, /* 6747 */ { MAD_F(0x07c80daa) /* 0.486341158 */, 18 }, /* 6748 */ { MAD_F(0x07c87272) /* 0.486437271 */, 18 }, /* 6749 */ { MAD_F(0x07c8d73c) /* 0.486533388 */, 18 }, /* 6750 */ { MAD_F(0x07c93c06) /* 0.486629510 */, 18 }, /* 6751 */ { MAD_F(0x07c9a0d2) /* 0.486725637 */, 18 }, /* 6752 */ { MAD_F(0x07ca059f) /* 0.486821768 */, 18 }, /* 6753 */ { MAD_F(0x07ca6a6d) /* 0.486917905 */, 18 }, /* 6754 */ { MAD_F(0x07cacf3d) /* 0.487014045 */, 18 }, /* 6755 */ { MAD_F(0x07cb340e) /* 0.487110191 */, 18 }, /* 6756 */ { MAD_F(0x07cb98e0) /* 0.487206342 */, 18 }, /* 6757 */ { MAD_F(0x07cbfdb4) /* 0.487302497 */, 18 }, /* 6758 */ { MAD_F(0x07cc6288) /* 0.487398657 */, 18 }, /* 6759 */ { MAD_F(0x07ccc75e) /* 0.487494821 */, 18 }, /* 6760 */ { MAD_F(0x07cd2c36) /* 0.487590991 */, 18 }, /* 6761 */ { MAD_F(0x07cd910e) /* 0.487687165 */, 18 }, /* 6762 */ { MAD_F(0x07cdf5e8) /* 0.487783344 */, 18 }, /* 6763 */ { MAD_F(0x07ce5ac3) /* 0.487879528 */, 18 }, /* 6764 */ { MAD_F(0x07cebfa0) /* 0.487975716 */, 18 }, /* 6765 */ { MAD_F(0x07cf247d) /* 0.488071909 */, 18 }, /* 6766 */ { MAD_F(0x07cf895c) /* 0.488168107 */, 18 }, /* 6767 */ { MAD_F(0x07cfee3c) /* 0.488264310 */, 18 }, /* 6768 */ { MAD_F(0x07d0531e) /* 0.488360517 */, 18 }, /* 6769 */ { MAD_F(0x07d0b801) /* 0.488456729 */, 18 }, /* 6770 */ { MAD_F(0x07d11ce5) /* 0.488552946 */, 18 }, /* 6771 */ { MAD_F(0x07d181ca) /* 0.488649167 */, 18 }, /* 6772 */ { MAD_F(0x07d1e6b0) /* 0.488745394 */, 18 }, /* 6773 */ { MAD_F(0x07d24b98) /* 0.488841625 */, 18 }, /* 6774 */ { MAD_F(0x07d2b081) /* 0.488937860 */, 18 }, /* 6775 */ { MAD_F(0x07d3156c) /* 0.489034101 */, 18 }, /* 6776 */ { MAD_F(0x07d37a57) /* 0.489130346 */, 18 }, /* 6777 */ { MAD_F(0x07d3df44) /* 0.489226596 */, 18 }, /* 6778 */ { MAD_F(0x07d44432) /* 0.489322851 */, 18 }, /* 6779 */ { MAD_F(0x07d4a922) /* 0.489419110 */, 18 }, /* 6780 */ { MAD_F(0x07d50e13) /* 0.489515375 */, 18 }, /* 6781 */ { MAD_F(0x07d57305) /* 0.489611643 */, 18 }, /* 6782 */ { MAD_F(0x07d5d7f8) /* 0.489707917 */, 18 }, /* 6783 */ { MAD_F(0x07d63cec) /* 0.489804195 */, 18 }, /* 6784 */ { MAD_F(0x07d6a1e2) /* 0.489900479 */, 18 }, /* 6785 */ { MAD_F(0x07d706d9) /* 0.489996766 */, 18 }, /* 6786 */ { MAD_F(0x07d76bd2) /* 0.490093059 */, 18 }, /* 6787 */ { MAD_F(0x07d7d0cb) /* 0.490189356 */, 18 }, /* 6788 */ { MAD_F(0x07d835c6) /* 0.490285658 */, 18 }, /* 6789 */ { MAD_F(0x07d89ac2) /* 0.490381965 */, 18 }, /* 6790 */ { MAD_F(0x07d8ffc0) /* 0.490478277 */, 18 }, /* 6791 */ { MAD_F(0x07d964be) /* 0.490574593 */, 18 }, /* 6792 */ { MAD_F(0x07d9c9be) /* 0.490670914 */, 18 }, /* 6793 */ { MAD_F(0x07da2ebf) /* 0.490767239 */, 18 }, /* 6794 */ { MAD_F(0x07da93c2) /* 0.490863570 */, 18 }, /* 6795 */ { MAD_F(0x07daf8c6) /* 0.490959905 */, 18 }, /* 6796 */ { MAD_F(0x07db5dcb) /* 0.491056245 */, 18 }, /* 6797 */ { MAD_F(0x07dbc2d1) /* 0.491152589 */, 18 }, /* 6798 */ { MAD_F(0x07dc27d9) /* 0.491248939 */, 18 }, /* 6799 */ { MAD_F(0x07dc8ce1) /* 0.491345293 */, 18 }, /* 6800 */ { MAD_F(0x07dcf1ec) /* 0.491441651 */, 18 }, /* 6801 */ { MAD_F(0x07dd56f7) /* 0.491538015 */, 18 }, /* 6802 */ { MAD_F(0x07ddbc04) /* 0.491634383 */, 18 }, /* 6803 */ { MAD_F(0x07de2111) /* 0.491730756 */, 18 }, /* 6804 */ { MAD_F(0x07de8621) /* 0.491827134 */, 18 }, /* 6805 */ { MAD_F(0x07deeb31) /* 0.491923516 */, 18 }, /* 6806 */ { MAD_F(0x07df5043) /* 0.492019903 */, 18 }, /* 6807 */ { MAD_F(0x07dfb556) /* 0.492116295 */, 18 }, /* 6808 */ { MAD_F(0x07e01a6a) /* 0.492212691 */, 18 }, /* 6809 */ { MAD_F(0x07e07f80) /* 0.492309093 */, 18 }, /* 6810 */ { MAD_F(0x07e0e496) /* 0.492405499 */, 18 }, /* 6811 */ { MAD_F(0x07e149ae) /* 0.492501909 */, 18 }, /* 6812 */ { MAD_F(0x07e1aec8) /* 0.492598325 */, 18 }, /* 6813 */ { MAD_F(0x07e213e2) /* 0.492694745 */, 18 }, /* 6814 */ { MAD_F(0x07e278fe) /* 0.492791170 */, 18 }, /* 6815 */ { MAD_F(0x07e2de1b) /* 0.492887599 */, 18 }, /* 6816 */ { MAD_F(0x07e3433a) /* 0.492984033 */, 18 }, /* 6817 */ { MAD_F(0x07e3a859) /* 0.493080472 */, 18 }, /* 6818 */ { MAD_F(0x07e40d7a) /* 0.493176916 */, 18 }, /* 6819 */ { MAD_F(0x07e4729c) /* 0.493273365 */, 18 }, /* 6820 */ { MAD_F(0x07e4d7c0) /* 0.493369818 */, 18 }, /* 6821 */ { MAD_F(0x07e53ce4) /* 0.493466275 */, 18 }, /* 6822 */ { MAD_F(0x07e5a20a) /* 0.493562738 */, 18 }, /* 6823 */ { MAD_F(0x07e60732) /* 0.493659205 */, 18 }, /* 6824 */ { MAD_F(0x07e66c5a) /* 0.493755677 */, 18 }, /* 6825 */ { MAD_F(0x07e6d184) /* 0.493852154 */, 18 }, /* 6826 */ { MAD_F(0x07e736af) /* 0.493948635 */, 18 }, /* 6827 */ { MAD_F(0x07e79bdb) /* 0.494045122 */, 18 }, /* 6828 */ { MAD_F(0x07e80109) /* 0.494141612 */, 18 }, /* 6829 */ { MAD_F(0x07e86638) /* 0.494238108 */, 18 }, /* 6830 */ { MAD_F(0x07e8cb68) /* 0.494334608 */, 18 }, /* 6831 */ { MAD_F(0x07e93099) /* 0.494431113 */, 18 }, /* 6832 */ { MAD_F(0x07e995cc) /* 0.494527623 */, 18 }, /* 6833 */ { MAD_F(0x07e9fb00) /* 0.494624137 */, 18 }, /* 6834 */ { MAD_F(0x07ea6035) /* 0.494720656 */, 18 }, /* 6835 */ { MAD_F(0x07eac56b) /* 0.494817180 */, 18 }, /* 6836 */ { MAD_F(0x07eb2aa3) /* 0.494913709 */, 18 }, /* 6837 */ { MAD_F(0x07eb8fdc) /* 0.495010242 */, 18 }, /* 6838 */ { MAD_F(0x07ebf516) /* 0.495106780 */, 18 }, /* 6839 */ { MAD_F(0x07ec5a51) /* 0.495203322 */, 18 }, /* 6840 */ { MAD_F(0x07ecbf8e) /* 0.495299870 */, 18 }, /* 6841 */ { MAD_F(0x07ed24cc) /* 0.495396422 */, 18 }, /* 6842 */ { MAD_F(0x07ed8a0b) /* 0.495492978 */, 18 }, /* 6843 */ { MAD_F(0x07edef4c) /* 0.495589540 */, 18 }, /* 6844 */ { MAD_F(0x07ee548e) /* 0.495686106 */, 18 }, /* 6845 */ { MAD_F(0x07eeb9d1) /* 0.495782677 */, 18 }, /* 6846 */ { MAD_F(0x07ef1f15) /* 0.495879252 */, 18 }, /* 6847 */ { MAD_F(0x07ef845b) /* 0.495975833 */, 18 }, /* 6848 */ { MAD_F(0x07efe9a1) /* 0.496072418 */, 18 }, /* 6849 */ { MAD_F(0x07f04ee9) /* 0.496169007 */, 18 }, /* 6850 */ { MAD_F(0x07f0b433) /* 0.496265602 */, 18 }, /* 6851 */ { MAD_F(0x07f1197d) /* 0.496362201 */, 18 }, /* 6852 */ { MAD_F(0x07f17ec9) /* 0.496458804 */, 18 }, /* 6853 */ { MAD_F(0x07f1e416) /* 0.496555413 */, 18 }, /* 6854 */ { MAD_F(0x07f24965) /* 0.496652026 */, 18 }, /* 6855 */ { MAD_F(0x07f2aeb5) /* 0.496748644 */, 18 }, /* 6856 */ { MAD_F(0x07f31405) /* 0.496845266 */, 18 }, /* 6857 */ { MAD_F(0x07f37958) /* 0.496941894 */, 18 }, /* 6858 */ { MAD_F(0x07f3deab) /* 0.497038526 */, 18 }, /* 6859 */ { MAD_F(0x07f44400) /* 0.497135162 */, 18 }, /* 6860 */ { MAD_F(0x07f4a956) /* 0.497231804 */, 18 }, /* 6861 */ { MAD_F(0x07f50ead) /* 0.497328450 */, 18 }, /* 6862 */ { MAD_F(0x07f57405) /* 0.497425100 */, 18 }, /* 6863 */ { MAD_F(0x07f5d95f) /* 0.497521756 */, 18 }, /* 6864 */ { MAD_F(0x07f63eba) /* 0.497618416 */, 18 }, /* 6865 */ { MAD_F(0x07f6a416) /* 0.497715081 */, 18 }, /* 6866 */ { MAD_F(0x07f70974) /* 0.497811750 */, 18 }, /* 6867 */ { MAD_F(0x07f76ed3) /* 0.497908425 */, 18 }, /* 6868 */ { MAD_F(0x07f7d433) /* 0.498005103 */, 18 }, /* 6869 */ { MAD_F(0x07f83994) /* 0.498101787 */, 18 }, /* 6870 */ { MAD_F(0x07f89ef7) /* 0.498198475 */, 18 }, /* 6871 */ { MAD_F(0x07f9045a) /* 0.498295168 */, 18 }, /* 6872 */ { MAD_F(0x07f969c0) /* 0.498391866 */, 18 }, /* 6873 */ { MAD_F(0x07f9cf26) /* 0.498488568 */, 18 }, /* 6874 */ { MAD_F(0x07fa348e) /* 0.498585275 */, 18 }, /* 6875 */ { MAD_F(0x07fa99f6) /* 0.498681987 */, 18 }, /* 6876 */ { MAD_F(0x07faff60) /* 0.498778704 */, 18 }, /* 6877 */ { MAD_F(0x07fb64cc) /* 0.498875425 */, 18 }, /* 6878 */ { MAD_F(0x07fbca38) /* 0.498972150 */, 18 }, /* 6879 */ { MAD_F(0x07fc2fa6) /* 0.499068881 */, 18 }, /* 6880 */ { MAD_F(0x07fc9516) /* 0.499165616 */, 18 }, /* 6881 */ { MAD_F(0x07fcfa86) /* 0.499262356 */, 18 }, /* 6882 */ { MAD_F(0x07fd5ff8) /* 0.499359101 */, 18 }, /* 6883 */ { MAD_F(0x07fdc56b) /* 0.499455850 */, 18 }, /* 6884 */ { MAD_F(0x07fe2adf) /* 0.499552604 */, 18 }, /* 6885 */ { MAD_F(0x07fe9054) /* 0.499649362 */, 18 }, /* 6886 */ { MAD_F(0x07fef5cb) /* 0.499746126 */, 18 }, /* 6887 */ { MAD_F(0x07ff5b43) /* 0.499842894 */, 18 }, /* 6888 */ { MAD_F(0x07ffc0bc) /* 0.499939666 */, 18 }, /* 6889 */ { MAD_F(0x0400131b) /* 0.250018222 */, 19 }, /* 6890 */ { MAD_F(0x040045d9) /* 0.250066613 */, 19 }, /* 6891 */ { MAD_F(0x04007897) /* 0.250115006 */, 19 }, /* 6892 */ { MAD_F(0x0400ab57) /* 0.250163402 */, 19 }, /* 6893 */ { MAD_F(0x0400de16) /* 0.250211800 */, 19 }, /* 6894 */ { MAD_F(0x040110d7) /* 0.250260200 */, 19 }, /* 6895 */ { MAD_F(0x04014398) /* 0.250308603 */, 19 }, /* 6896 */ { MAD_F(0x04017659) /* 0.250357008 */, 19 }, /* 6897 */ { MAD_F(0x0401a91c) /* 0.250405415 */, 19 }, /* 6898 */ { MAD_F(0x0401dbdf) /* 0.250453825 */, 19 }, /* 6899 */ { MAD_F(0x04020ea2) /* 0.250502237 */, 19 }, /* 6900 */ { MAD_F(0x04024166) /* 0.250550652 */, 19 }, /* 6901 */ { MAD_F(0x0402742b) /* 0.250599068 */, 19 }, /* 6902 */ { MAD_F(0x0402a6f0) /* 0.250647488 */, 19 }, /* 6903 */ { MAD_F(0x0402d9b6) /* 0.250695909 */, 19 }, /* 6904 */ { MAD_F(0x04030c7d) /* 0.250744333 */, 19 }, /* 6905 */ { MAD_F(0x04033f44) /* 0.250792759 */, 19 }, /* 6906 */ { MAD_F(0x0403720c) /* 0.250841187 */, 19 }, /* 6907 */ { MAD_F(0x0403a4d5) /* 0.250889618 */, 19 }, /* 6908 */ { MAD_F(0x0403d79e) /* 0.250938051 */, 19 }, /* 6909 */ { MAD_F(0x04040a68) /* 0.250986487 */, 19 }, /* 6910 */ { MAD_F(0x04043d32) /* 0.251034924 */, 19 }, /* 6911 */ { MAD_F(0x04046ffd) /* 0.251083365 */, 19 }, /* 6912 */ { MAD_F(0x0404a2c9) /* 0.251131807 */, 19 }, /* 6913 */ { MAD_F(0x0404d595) /* 0.251180252 */, 19 }, /* 6914 */ { MAD_F(0x04050862) /* 0.251228699 */, 19 }, /* 6915 */ { MAD_F(0x04053b30) /* 0.251277148 */, 19 }, /* 6916 */ { MAD_F(0x04056dfe) /* 0.251325600 */, 19 }, /* 6917 */ { MAD_F(0x0405a0cd) /* 0.251374054 */, 19 }, /* 6918 */ { MAD_F(0x0405d39c) /* 0.251422511 */, 19 }, /* 6919 */ { MAD_F(0x0406066c) /* 0.251470970 */, 19 }, /* 6920 */ { MAD_F(0x0406393d) /* 0.251519431 */, 19 }, /* 6921 */ { MAD_F(0x04066c0e) /* 0.251567894 */, 19 }, /* 6922 */ { MAD_F(0x04069ee0) /* 0.251616360 */, 19 }, /* 6923 */ { MAD_F(0x0406d1b3) /* 0.251664828 */, 19 }, /* 6924 */ { MAD_F(0x04070486) /* 0.251713299 */, 19 }, /* 6925 */ { MAD_F(0x0407375a) /* 0.251761772 */, 19 }, /* 6926 */ { MAD_F(0x04076a2e) /* 0.251810247 */, 19 }, /* 6927 */ { MAD_F(0x04079d03) /* 0.251858724 */, 19 }, /* 6928 */ { MAD_F(0x0407cfd9) /* 0.251907204 */, 19 }, /* 6929 */ { MAD_F(0x040802af) /* 0.251955686 */, 19 }, /* 6930 */ { MAD_F(0x04083586) /* 0.252004171 */, 19 }, /* 6931 */ { MAD_F(0x0408685e) /* 0.252052658 */, 19 }, /* 6932 */ { MAD_F(0x04089b36) /* 0.252101147 */, 19 }, /* 6933 */ { MAD_F(0x0408ce0f) /* 0.252149638 */, 19 }, /* 6934 */ { MAD_F(0x040900e8) /* 0.252198132 */, 19 }, /* 6935 */ { MAD_F(0x040933c2) /* 0.252246628 */, 19 }, /* 6936 */ { MAD_F(0x0409669d) /* 0.252295127 */, 19 }, /* 6937 */ { MAD_F(0x04099978) /* 0.252343627 */, 19 }, /* 6938 */ { MAD_F(0x0409cc54) /* 0.252392131 */, 19 }, /* 6939 */ { MAD_F(0x0409ff31) /* 0.252440636 */, 19 }, /* 6940 */ { MAD_F(0x040a320e) /* 0.252489144 */, 19 }, /* 6941 */ { MAD_F(0x040a64ec) /* 0.252537654 */, 19 }, /* 6942 */ { MAD_F(0x040a97cb) /* 0.252586166 */, 19 }, /* 6943 */ { MAD_F(0x040acaaa) /* 0.252634681 */, 19 }, /* 6944 */ { MAD_F(0x040afd89) /* 0.252683198 */, 19 }, /* 6945 */ { MAD_F(0x040b306a) /* 0.252731718 */, 19 }, /* 6946 */ { MAD_F(0x040b634b) /* 0.252780240 */, 19 }, /* 6947 */ { MAD_F(0x040b962c) /* 0.252828764 */, 19 }, /* 6948 */ { MAD_F(0x040bc90e) /* 0.252877290 */, 19 }, /* 6949 */ { MAD_F(0x040bfbf1) /* 0.252925819 */, 19 }, /* 6950 */ { MAD_F(0x040c2ed5) /* 0.252974350 */, 19 }, /* 6951 */ { MAD_F(0x040c61b9) /* 0.253022883 */, 19 }, /* 6952 */ { MAD_F(0x040c949e) /* 0.253071419 */, 19 }, /* 6953 */ { MAD_F(0x040cc783) /* 0.253119957 */, 19 }, /* 6954 */ { MAD_F(0x040cfa69) /* 0.253168498 */, 19 }, /* 6955 */ { MAD_F(0x040d2d4f) /* 0.253217040 */, 19 }, /* 6956 */ { MAD_F(0x040d6037) /* 0.253265585 */, 19 }, /* 6957 */ { MAD_F(0x040d931e) /* 0.253314133 */, 19 }, /* 6958 */ { MAD_F(0x040dc607) /* 0.253362682 */, 19 }, /* 6959 */ { MAD_F(0x040df8f0) /* 0.253411234 */, 19 }, /* 6960 */ { MAD_F(0x040e2bda) /* 0.253459789 */, 19 }, /* 6961 */ { MAD_F(0x040e5ec4) /* 0.253508345 */, 19 }, /* 6962 */ { MAD_F(0x040e91af) /* 0.253556904 */, 19 }, /* 6963 */ { MAD_F(0x040ec49b) /* 0.253605466 */, 19 }, /* 6964 */ { MAD_F(0x040ef787) /* 0.253654029 */, 19 }, /* 6965 */ { MAD_F(0x040f2a74) /* 0.253702595 */, 19 }, /* 6966 */ { MAD_F(0x040f5d61) /* 0.253751164 */, 19 }, /* 6967 */ { MAD_F(0x040f904f) /* 0.253799734 */, 19 }, /* 6968 */ { MAD_F(0x040fc33e) /* 0.253848307 */, 19 }, /* 6969 */ { MAD_F(0x040ff62d) /* 0.253896883 */, 19 }, /* 6970 */ { MAD_F(0x0410291d) /* 0.253945460 */, 19 }, /* 6971 */ { MAD_F(0x04105c0e) /* 0.253994040 */, 19 }, /* 6972 */ { MAD_F(0x04108eff) /* 0.254042622 */, 19 }, /* 6973 */ { MAD_F(0x0410c1f1) /* 0.254091207 */, 19 }, /* 6974 */ { MAD_F(0x0410f4e3) /* 0.254139794 */, 19 }, /* 6975 */ { MAD_F(0x041127d6) /* 0.254188383 */, 19 }, /* 6976 */ { MAD_F(0x04115aca) /* 0.254236974 */, 19 }, /* 6977 */ { MAD_F(0x04118dbe) /* 0.254285568 */, 19 }, /* 6978 */ { MAD_F(0x0411c0b3) /* 0.254334165 */, 19 }, /* 6979 */ { MAD_F(0x0411f3a9) /* 0.254382763 */, 19 }, /* 6980 */ { MAD_F(0x0412269f) /* 0.254431364 */, 19 }, /* 6981 */ { MAD_F(0x04125996) /* 0.254479967 */, 19 }, /* 6982 */ { MAD_F(0x04128c8d) /* 0.254528572 */, 19 }, /* 6983 */ { MAD_F(0x0412bf85) /* 0.254577180 */, 19 }, /* 6984 */ { MAD_F(0x0412f27e) /* 0.254625790 */, 19 }, /* 6985 */ { MAD_F(0x04132577) /* 0.254674403 */, 19 }, /* 6986 */ { MAD_F(0x04135871) /* 0.254723017 */, 19 }, /* 6987 */ { MAD_F(0x04138b6c) /* 0.254771635 */, 19 }, /* 6988 */ { MAD_F(0x0413be67) /* 0.254820254 */, 19 }, /* 6989 */ { MAD_F(0x0413f163) /* 0.254868876 */, 19 }, /* 6990 */ { MAD_F(0x0414245f) /* 0.254917500 */, 19 }, /* 6991 */ { MAD_F(0x0414575c) /* 0.254966126 */, 19 }, /* 6992 */ { MAD_F(0x04148a5a) /* 0.255014755 */, 19 }, /* 6993 */ { MAD_F(0x0414bd58) /* 0.255063386 */, 19 }, /* 6994 */ { MAD_F(0x0414f057) /* 0.255112019 */, 19 }, /* 6995 */ { MAD_F(0x04152356) /* 0.255160655 */, 19 }, /* 6996 */ { MAD_F(0x04155657) /* 0.255209292 */, 19 }, /* 6997 */ { MAD_F(0x04158957) /* 0.255257933 */, 19 }, /* 6998 */ { MAD_F(0x0415bc59) /* 0.255306575 */, 19 }, /* 6999 */ { MAD_F(0x0415ef5b) /* 0.255355220 */, 19 }, /* 7000 */ { MAD_F(0x0416225d) /* 0.255403867 */, 19 }, /* 7001 */ { MAD_F(0x04165561) /* 0.255452517 */, 19 }, /* 7002 */ { MAD_F(0x04168864) /* 0.255501169 */, 19 }, /* 7003 */ { MAD_F(0x0416bb69) /* 0.255549823 */, 19 }, /* 7004 */ { MAD_F(0x0416ee6e) /* 0.255598479 */, 19 }, /* 7005 */ { MAD_F(0x04172174) /* 0.255647138 */, 19 }, /* 7006 */ { MAD_F(0x0417547a) /* 0.255695799 */, 19 }, /* 7007 */ { MAD_F(0x04178781) /* 0.255744463 */, 19 }, /* 7008 */ { MAD_F(0x0417ba89) /* 0.255793128 */, 19 }, /* 7009 */ { MAD_F(0x0417ed91) /* 0.255841796 */, 19 }, /* 7010 */ { MAD_F(0x0418209a) /* 0.255890467 */, 19 }, /* 7011 */ { MAD_F(0x041853a3) /* 0.255939139 */, 19 }, /* 7012 */ { MAD_F(0x041886ad) /* 0.255987814 */, 19 }, /* 7013 */ { MAD_F(0x0418b9b8) /* 0.256036492 */, 19 }, /* 7014 */ { MAD_F(0x0418ecc3) /* 0.256085171 */, 19 }, /* 7015 */ { MAD_F(0x04191fcf) /* 0.256133853 */, 19 }, /* 7016 */ { MAD_F(0x041952dc) /* 0.256182537 */, 19 }, /* 7017 */ { MAD_F(0x041985e9) /* 0.256231224 */, 19 }, /* 7018 */ { MAD_F(0x0419b8f7) /* 0.256279913 */, 19 }, /* 7019 */ { MAD_F(0x0419ec05) /* 0.256328604 */, 19 }, /* 7020 */ { MAD_F(0x041a1f15) /* 0.256377297 */, 19 }, /* 7021 */ { MAD_F(0x041a5224) /* 0.256425993 */, 19 }, /* 7022 */ { MAD_F(0x041a8534) /* 0.256474691 */, 19 }, /* 7023 */ { MAD_F(0x041ab845) /* 0.256523392 */, 19 }, /* 7024 */ { MAD_F(0x041aeb57) /* 0.256572095 */, 19 }, /* 7025 */ { MAD_F(0x041b1e69) /* 0.256620800 */, 19 }, /* 7026 */ { MAD_F(0x041b517c) /* 0.256669507 */, 19 }, /* 7027 */ { MAD_F(0x041b848f) /* 0.256718217 */, 19 }, /* 7028 */ { MAD_F(0x041bb7a3) /* 0.256766929 */, 19 }, /* 7029 */ { MAD_F(0x041beab8) /* 0.256815643 */, 19 }, /* 7030 */ { MAD_F(0x041c1dcd) /* 0.256864359 */, 19 }, /* 7031 */ { MAD_F(0x041c50e3) /* 0.256913078 */, 19 }, /* 7032 */ { MAD_F(0x041c83fa) /* 0.256961800 */, 19 }, /* 7033 */ { MAD_F(0x041cb711) /* 0.257010523 */, 19 }, /* 7034 */ { MAD_F(0x041cea28) /* 0.257059249 */, 19 }, /* 7035 */ { MAD_F(0x041d1d41) /* 0.257107977 */, 19 }, /* 7036 */ { MAD_F(0x041d505a) /* 0.257156708 */, 19 }, /* 7037 */ { MAD_F(0x041d8373) /* 0.257205440 */, 19 }, /* 7038 */ { MAD_F(0x041db68e) /* 0.257254175 */, 19 }, /* 7039 */ { MAD_F(0x041de9a8) /* 0.257302913 */, 19 }, /* 7040 */ { MAD_F(0x041e1cc4) /* 0.257351652 */, 19 }, /* 7041 */ { MAD_F(0x041e4fe0) /* 0.257400394 */, 19 }, /* 7042 */ { MAD_F(0x041e82fd) /* 0.257449139 */, 19 }, /* 7043 */ { MAD_F(0x041eb61a) /* 0.257497885 */, 19 }, /* 7044 */ { MAD_F(0x041ee938) /* 0.257546634 */, 19 }, /* 7045 */ { MAD_F(0x041f1c57) /* 0.257595386 */, 19 }, /* 7046 */ { MAD_F(0x041f4f76) /* 0.257644139 */, 19 }, /* 7047 */ { MAD_F(0x041f8296) /* 0.257692895 */, 19 }, /* 7048 */ { MAD_F(0x041fb5b6) /* 0.257741653 */, 19 }, /* 7049 */ { MAD_F(0x041fe8d7) /* 0.257790414 */, 19 }, /* 7050 */ { MAD_F(0x04201bf9) /* 0.257839176 */, 19 }, /* 7051 */ { MAD_F(0x04204f1b) /* 0.257887941 */, 19 }, /* 7052 */ { MAD_F(0x0420823e) /* 0.257936709 */, 19 }, /* 7053 */ { MAD_F(0x0420b561) /* 0.257985478 */, 19 }, /* 7054 */ { MAD_F(0x0420e885) /* 0.258034250 */, 19 }, /* 7055 */ { MAD_F(0x04211baa) /* 0.258083025 */, 19 }, /* 7056 */ { MAD_F(0x04214ed0) /* 0.258131801 */, 19 }, /* 7057 */ { MAD_F(0x042181f6) /* 0.258180580 */, 19 }, /* 7058 */ { MAD_F(0x0421b51c) /* 0.258229361 */, 19 }, /* 7059 */ { MAD_F(0x0421e843) /* 0.258278145 */, 19 }, /* 7060 */ { MAD_F(0x04221b6b) /* 0.258326931 */, 19 }, /* 7061 */ { MAD_F(0x04224e94) /* 0.258375719 */, 19 }, /* 7062 */ { MAD_F(0x042281bd) /* 0.258424509 */, 19 }, /* 7063 */ { MAD_F(0x0422b4e6) /* 0.258473302 */, 19 }, /* 7064 */ { MAD_F(0x0422e811) /* 0.258522097 */, 19 }, /* 7065 */ { MAD_F(0x04231b3c) /* 0.258570894 */, 19 }, /* 7066 */ { MAD_F(0x04234e67) /* 0.258619694 */, 19 }, /* 7067 */ { MAD_F(0x04238193) /* 0.258668496 */, 19 }, /* 7068 */ { MAD_F(0x0423b4c0) /* 0.258717300 */, 19 }, /* 7069 */ { MAD_F(0x0423e7ee) /* 0.258766106 */, 19 }, /* 7070 */ { MAD_F(0x04241b1c) /* 0.258814915 */, 19 }, /* 7071 */ { MAD_F(0x04244e4a) /* 0.258863726 */, 19 }, /* 7072 */ { MAD_F(0x04248179) /* 0.258912540 */, 19 }, /* 7073 */ { MAD_F(0x0424b4a9) /* 0.258961356 */, 19 }, /* 7074 */ { MAD_F(0x0424e7da) /* 0.259010174 */, 19 }, /* 7075 */ { MAD_F(0x04251b0b) /* 0.259058994 */, 19 }, /* 7076 */ { MAD_F(0x04254e3d) /* 0.259107817 */, 19 }, /* 7077 */ { MAD_F(0x0425816f) /* 0.259156642 */, 19 }, /* 7078 */ { MAD_F(0x0425b4a2) /* 0.259205469 */, 19 }, /* 7079 */ { MAD_F(0x0425e7d6) /* 0.259254298 */, 19 }, /* 7080 */ { MAD_F(0x04261b0a) /* 0.259303130 */, 19 }, /* 7081 */ { MAD_F(0x04264e3f) /* 0.259351964 */, 19 }, /* 7082 */ { MAD_F(0x04268174) /* 0.259400801 */, 19 }, /* 7083 */ { MAD_F(0x0426b4aa) /* 0.259449639 */, 19 }, /* 7084 */ { MAD_F(0x0426e7e1) /* 0.259498480 */, 19 }, /* 7085 */ { MAD_F(0x04271b18) /* 0.259547324 */, 19 }, /* 7086 */ { MAD_F(0x04274e50) /* 0.259596169 */, 19 }, /* 7087 */ { MAD_F(0x04278188) /* 0.259645017 */, 19 }, /* 7088 */ { MAD_F(0x0427b4c2) /* 0.259693868 */, 19 }, /* 7089 */ { MAD_F(0x0427e7fb) /* 0.259742720 */, 19 }, /* 7090 */ { MAD_F(0x04281b36) /* 0.259791575 */, 19 }, /* 7091 */ { MAD_F(0x04284e71) /* 0.259840432 */, 19 }, /* 7092 */ { MAD_F(0x042881ac) /* 0.259889291 */, 19 }, /* 7093 */ { MAD_F(0x0428b4e8) /* 0.259938153 */, 19 }, /* 7094 */ { MAD_F(0x0428e825) /* 0.259987017 */, 19 }, /* 7095 */ { MAD_F(0x04291b63) /* 0.260035883 */, 19 }, /* 7096 */ { MAD_F(0x04294ea1) /* 0.260084752 */, 19 }, /* 7097 */ { MAD_F(0x042981df) /* 0.260133623 */, 19 }, /* 7098 */ { MAD_F(0x0429b51f) /* 0.260182496 */, 19 }, /* 7099 */ { MAD_F(0x0429e85f) /* 0.260231372 */, 19 }, /* 7100 */ { MAD_F(0x042a1b9f) /* 0.260280249 */, 19 }, /* 7101 */ { MAD_F(0x042a4ee0) /* 0.260329129 */, 19 }, /* 7102 */ { MAD_F(0x042a8222) /* 0.260378012 */, 19 }, /* 7103 */ { MAD_F(0x042ab564) /* 0.260426896 */, 19 }, /* 7104 */ { MAD_F(0x042ae8a7) /* 0.260475783 */, 19 }, /* 7105 */ { MAD_F(0x042b1beb) /* 0.260524673 */, 19 }, /* 7106 */ { MAD_F(0x042b4f2f) /* 0.260573564 */, 19 }, /* 7107 */ { MAD_F(0x042b8274) /* 0.260622458 */, 19 }, /* 7108 */ { MAD_F(0x042bb5ba) /* 0.260671354 */, 19 }, /* 7109 */ { MAD_F(0x042be900) /* 0.260720252 */, 19 }, /* 7110 */ { MAD_F(0x042c1c46) /* 0.260769153 */, 19 }, /* 7111 */ { MAD_F(0x042c4f8e) /* 0.260818056 */, 19 }, /* 7112 */ { MAD_F(0x042c82d6) /* 0.260866961 */, 19 }, /* 7113 */ { MAD_F(0x042cb61e) /* 0.260915869 */, 19 }, /* 7114 */ { MAD_F(0x042ce967) /* 0.260964779 */, 19 }, /* 7115 */ { MAD_F(0x042d1cb1) /* 0.261013691 */, 19 }, /* 7116 */ { MAD_F(0x042d4ffb) /* 0.261062606 */, 19 }, /* 7117 */ { MAD_F(0x042d8346) /* 0.261111522 */, 19 }, /* 7118 */ { MAD_F(0x042db692) /* 0.261160441 */, 19 }, /* 7119 */ { MAD_F(0x042de9de) /* 0.261209363 */, 19 }, /* 7120 */ { MAD_F(0x042e1d2b) /* 0.261258286 */, 19 }, /* 7121 */ { MAD_F(0x042e5078) /* 0.261307212 */, 19 }, /* 7122 */ { MAD_F(0x042e83c6) /* 0.261356140 */, 19 }, /* 7123 */ { MAD_F(0x042eb715) /* 0.261405071 */, 19 }, /* 7124 */ { MAD_F(0x042eea64) /* 0.261454004 */, 19 }, /* 7125 */ { MAD_F(0x042f1db4) /* 0.261502939 */, 19 }, /* 7126 */ { MAD_F(0x042f5105) /* 0.261551876 */, 19 }, /* 7127 */ { MAD_F(0x042f8456) /* 0.261600816 */, 19 }, /* 7128 */ { MAD_F(0x042fb7a8) /* 0.261649758 */, 19 }, /* 7129 */ { MAD_F(0x042feafa) /* 0.261698702 */, 19 }, /* 7130 */ { MAD_F(0x04301e4d) /* 0.261747649 */, 19 }, /* 7131 */ { MAD_F(0x043051a1) /* 0.261796597 */, 19 }, /* 7132 */ { MAD_F(0x043084f5) /* 0.261845548 */, 19 }, /* 7133 */ { MAD_F(0x0430b84a) /* 0.261894502 */, 19 }, /* 7134 */ { MAD_F(0x0430eb9f) /* 0.261943458 */, 19 }, /* 7135 */ { MAD_F(0x04311ef5) /* 0.261992416 */, 19 }, /* 7136 */ { MAD_F(0x0431524c) /* 0.262041376 */, 19 }, /* 7137 */ { MAD_F(0x043185a3) /* 0.262090338 */, 19 }, /* 7138 */ { MAD_F(0x0431b8fb) /* 0.262139303 */, 19 }, /* 7139 */ { MAD_F(0x0431ec54) /* 0.262188270 */, 19 }, /* 7140 */ { MAD_F(0x04321fad) /* 0.262237240 */, 19 }, /* 7141 */ { MAD_F(0x04325306) /* 0.262286211 */, 19 }, /* 7142 */ { MAD_F(0x04328661) /* 0.262335185 */, 19 }, /* 7143 */ { MAD_F(0x0432b9bc) /* 0.262384162 */, 19 }, /* 7144 */ { MAD_F(0x0432ed17) /* 0.262433140 */, 19 }, /* 7145 */ { MAD_F(0x04332074) /* 0.262482121 */, 19 }, /* 7146 */ { MAD_F(0x043353d0) /* 0.262531104 */, 19 }, /* 7147 */ { MAD_F(0x0433872e) /* 0.262580089 */, 19 }, /* 7148 */ { MAD_F(0x0433ba8c) /* 0.262629077 */, 19 }, /* 7149 */ { MAD_F(0x0433edea) /* 0.262678067 */, 19 }, /* 7150 */ { MAD_F(0x0434214a) /* 0.262727059 */, 19 }, /* 7151 */ { MAD_F(0x043454aa) /* 0.262776054 */, 19 }, /* 7152 */ { MAD_F(0x0434880a) /* 0.262825051 */, 19 }, /* 7153 */ { MAD_F(0x0434bb6b) /* 0.262874050 */, 19 }, /* 7154 */ { MAD_F(0x0434eecd) /* 0.262923051 */, 19 }, /* 7155 */ { MAD_F(0x0435222f) /* 0.262972055 */, 19 }, /* 7156 */ { MAD_F(0x04355592) /* 0.263021061 */, 19 }, /* 7157 */ { MAD_F(0x043588f6) /* 0.263070069 */, 19 }, /* 7158 */ { MAD_F(0x0435bc5a) /* 0.263119079 */, 19 }, /* 7159 */ { MAD_F(0x0435efbf) /* 0.263168092 */, 19 }, /* 7160 */ { MAD_F(0x04362324) /* 0.263217107 */, 19 }, /* 7161 */ { MAD_F(0x0436568a) /* 0.263266125 */, 19 }, /* 7162 */ { MAD_F(0x043689f1) /* 0.263315144 */, 19 }, /* 7163 */ { MAD_F(0x0436bd58) /* 0.263364166 */, 19 }, /* 7164 */ { MAD_F(0x0436f0c0) /* 0.263413191 */, 19 }, /* 7165 */ { MAD_F(0x04372428) /* 0.263462217 */, 19 }, /* 7166 */ { MAD_F(0x04375791) /* 0.263511246 */, 19 }, /* 7167 */ { MAD_F(0x04378afb) /* 0.263560277 */, 19 }, /* 7168 */ { MAD_F(0x0437be65) /* 0.263609310 */, 19 }, /* 7169 */ { MAD_F(0x0437f1d0) /* 0.263658346 */, 19 }, /* 7170 */ { MAD_F(0x0438253c) /* 0.263707384 */, 19 }, /* 7171 */ { MAD_F(0x043858a8) /* 0.263756424 */, 19 }, /* 7172 */ { MAD_F(0x04388c14) /* 0.263805466 */, 19 }, /* 7173 */ { MAD_F(0x0438bf82) /* 0.263854511 */, 19 }, /* 7174 */ { MAD_F(0x0438f2f0) /* 0.263903558 */, 19 }, /* 7175 */ { MAD_F(0x0439265e) /* 0.263952607 */, 19 }, /* 7176 */ { MAD_F(0x043959cd) /* 0.264001659 */, 19 }, /* 7177 */ { MAD_F(0x04398d3d) /* 0.264050713 */, 19 }, /* 7178 */ { MAD_F(0x0439c0ae) /* 0.264099769 */, 19 }, /* 7179 */ { MAD_F(0x0439f41f) /* 0.264148827 */, 19 }, /* 7180 */ { MAD_F(0x043a2790) /* 0.264197888 */, 19 }, /* 7181 */ { MAD_F(0x043a5b02) /* 0.264246951 */, 19 }, /* 7182 */ { MAD_F(0x043a8e75) /* 0.264296016 */, 19 }, /* 7183 */ { MAD_F(0x043ac1e9) /* 0.264345084 */, 19 }, /* 7184 */ { MAD_F(0x043af55d) /* 0.264394153 */, 19 }, /* 7185 */ { MAD_F(0x043b28d2) /* 0.264443225 */, 19 }, /* 7186 */ { MAD_F(0x043b5c47) /* 0.264492300 */, 19 }, /* 7187 */ { MAD_F(0x043b8fbd) /* 0.264541376 */, 19 }, /* 7188 */ { MAD_F(0x043bc333) /* 0.264590455 */, 19 }, /* 7189 */ { MAD_F(0x043bf6aa) /* 0.264639536 */, 19 }, /* 7190 */ { MAD_F(0x043c2a22) /* 0.264688620 */, 19 }, /* 7191 */ { MAD_F(0x043c5d9a) /* 0.264737706 */, 19 }, /* 7192 */ { MAD_F(0x043c9113) /* 0.264786794 */, 19 }, /* 7193 */ { MAD_F(0x043cc48d) /* 0.264835884 */, 19 }, /* 7194 */ { MAD_F(0x043cf807) /* 0.264884976 */, 19 }, /* 7195 */ { MAD_F(0x043d2b82) /* 0.264934071 */, 19 }, /* 7196 */ { MAD_F(0x043d5efd) /* 0.264983168 */, 19 }, /* 7197 */ { MAD_F(0x043d9279) /* 0.265032268 */, 19 }, /* 7198 */ { MAD_F(0x043dc5f6) /* 0.265081369 */, 19 }, /* 7199 */ { MAD_F(0x043df973) /* 0.265130473 */, 19 }, /* 7200 */ { MAD_F(0x043e2cf1) /* 0.265179580 */, 19 }, /* 7201 */ { MAD_F(0x043e6070) /* 0.265228688 */, 19 }, /* 7202 */ { MAD_F(0x043e93ef) /* 0.265277799 */, 19 }, /* 7203 */ { MAD_F(0x043ec76e) /* 0.265326912 */, 19 }, /* 7204 */ { MAD_F(0x043efaef) /* 0.265376027 */, 19 }, /* 7205 */ { MAD_F(0x043f2e6f) /* 0.265425145 */, 19 }, /* 7206 */ { MAD_F(0x043f61f1) /* 0.265474264 */, 19 }, /* 7207 */ { MAD_F(0x043f9573) /* 0.265523387 */, 19 }, /* 7208 */ { MAD_F(0x043fc8f6) /* 0.265572511 */, 19 }, /* 7209 */ { MAD_F(0x043ffc79) /* 0.265621638 */, 19 }, /* 7210 */ { MAD_F(0x04402ffd) /* 0.265670766 */, 19 }, /* 7211 */ { MAD_F(0x04406382) /* 0.265719898 */, 19 }, /* 7212 */ { MAD_F(0x04409707) /* 0.265769031 */, 19 }, /* 7213 */ { MAD_F(0x0440ca8d) /* 0.265818167 */, 19 }, /* 7214 */ { MAD_F(0x0440fe13) /* 0.265867305 */, 19 }, /* 7215 */ { MAD_F(0x0441319a) /* 0.265916445 */, 19 }, /* 7216 */ { MAD_F(0x04416522) /* 0.265965588 */, 19 }, /* 7217 */ { MAD_F(0x044198aa) /* 0.266014732 */, 19 }, /* 7218 */ { MAD_F(0x0441cc33) /* 0.266063880 */, 19 }, /* 7219 */ { MAD_F(0x0441ffbc) /* 0.266113029 */, 19 }, /* 7220 */ { MAD_F(0x04423346) /* 0.266162181 */, 19 }, /* 7221 */ { MAD_F(0x044266d1) /* 0.266211334 */, 19 }, /* 7222 */ { MAD_F(0x04429a5c) /* 0.266260491 */, 19 }, /* 7223 */ { MAD_F(0x0442cde8) /* 0.266309649 */, 19 }, /* 7224 */ { MAD_F(0x04430174) /* 0.266358810 */, 19 }, /* 7225 */ { MAD_F(0x04433501) /* 0.266407973 */, 19 }, /* 7226 */ { MAD_F(0x0443688f) /* 0.266457138 */, 19 }, /* 7227 */ { MAD_F(0x04439c1d) /* 0.266506305 */, 19 }, /* 7228 */ { MAD_F(0x0443cfac) /* 0.266555475 */, 19 }, /* 7229 */ { MAD_F(0x0444033c) /* 0.266604647 */, 19 }, /* 7230 */ { MAD_F(0x044436cc) /* 0.266653822 */, 19 }, /* 7231 */ { MAD_F(0x04446a5d) /* 0.266702998 */, 19 }, /* 7232 */ { MAD_F(0x04449dee) /* 0.266752177 */, 19 }, /* 7233 */ { MAD_F(0x0444d180) /* 0.266801358 */, 19 }, /* 7234 */ { MAD_F(0x04450513) /* 0.266850541 */, 19 }, /* 7235 */ { MAD_F(0x044538a6) /* 0.266899727 */, 19 }, /* 7236 */ { MAD_F(0x04456c39) /* 0.266948915 */, 19 }, /* 7237 */ { MAD_F(0x04459fce) /* 0.266998105 */, 19 }, /* 7238 */ { MAD_F(0x0445d363) /* 0.267047298 */, 19 }, /* 7239 */ { MAD_F(0x044606f8) /* 0.267096492 */, 19 }, /* 7240 */ { MAD_F(0x04463a8f) /* 0.267145689 */, 19 }, /* 7241 */ { MAD_F(0x04466e25) /* 0.267194888 */, 19 }, /* 7242 */ { MAD_F(0x0446a1bd) /* 0.267244090 */, 19 }, /* 7243 */ { MAD_F(0x0446d555) /* 0.267293294 */, 19 }, /* 7244 */ { MAD_F(0x044708ee) /* 0.267342500 */, 19 }, /* 7245 */ { MAD_F(0x04473c87) /* 0.267391708 */, 19 }, /* 7246 */ { MAD_F(0x04477021) /* 0.267440919 */, 19 }, /* 7247 */ { MAD_F(0x0447a3bb) /* 0.267490131 */, 19 }, /* 7248 */ { MAD_F(0x0447d756) /* 0.267539347 */, 19 }, /* 7249 */ { MAD_F(0x04480af2) /* 0.267588564 */, 19 }, /* 7250 */ { MAD_F(0x04483e8e) /* 0.267637783 */, 19 }, /* 7251 */ { MAD_F(0x0448722b) /* 0.267687005 */, 19 }, /* 7252 */ { MAD_F(0x0448a5c9) /* 0.267736229 */, 19 }, /* 7253 */ { MAD_F(0x0448d967) /* 0.267785456 */, 19 }, /* 7254 */ { MAD_F(0x04490d05) /* 0.267834685 */, 19 }, /* 7255 */ { MAD_F(0x044940a5) /* 0.267883915 */, 19 }, /* 7256 */ { MAD_F(0x04497445) /* 0.267933149 */, 19 }, /* 7257 */ { MAD_F(0x0449a7e5) /* 0.267982384 */, 19 }, /* 7258 */ { MAD_F(0x0449db86) /* 0.268031622 */, 19 }, /* 7259 */ { MAD_F(0x044a0f28) /* 0.268080862 */, 19 }, /* 7260 */ { MAD_F(0x044a42ca) /* 0.268130104 */, 19 }, /* 7261 */ { MAD_F(0x044a766d) /* 0.268179349 */, 19 }, /* 7262 */ { MAD_F(0x044aaa11) /* 0.268228595 */, 19 }, /* 7263 */ { MAD_F(0x044addb5) /* 0.268277844 */, 19 }, /* 7264 */ { MAD_F(0x044b115a) /* 0.268327096 */, 19 }, /* 7265 */ { MAD_F(0x044b44ff) /* 0.268376349 */, 19 }, /* 7266 */ { MAD_F(0x044b78a5) /* 0.268425605 */, 19 }, /* 7267 */ { MAD_F(0x044bac4c) /* 0.268474863 */, 19 }, /* 7268 */ { MAD_F(0x044bdff3) /* 0.268524123 */, 19 }, /* 7269 */ { MAD_F(0x044c139b) /* 0.268573386 */, 19 }, /* 7270 */ { MAD_F(0x044c4743) /* 0.268622651 */, 19 }, /* 7271 */ { MAD_F(0x044c7aec) /* 0.268671918 */, 19 }, /* 7272 */ { MAD_F(0x044cae96) /* 0.268721187 */, 19 }, /* 7273 */ { MAD_F(0x044ce240) /* 0.268770459 */, 19 }, /* 7274 */ { MAD_F(0x044d15eb) /* 0.268819733 */, 19 }, /* 7275 */ { MAD_F(0x044d4997) /* 0.268869009 */, 19 }, /* 7276 */ { MAD_F(0x044d7d43) /* 0.268918287 */, 19 }, /* 7277 */ { MAD_F(0x044db0ef) /* 0.268967568 */, 19 }, /* 7278 */ { MAD_F(0x044de49d) /* 0.269016851 */, 19 }, /* 7279 */ { MAD_F(0x044e184b) /* 0.269066136 */, 19 }, /* 7280 */ { MAD_F(0x044e4bf9) /* 0.269115423 */, 19 }, /* 7281 */ { MAD_F(0x044e7fa8) /* 0.269164713 */, 19 }, /* 7282 */ { MAD_F(0x044eb358) /* 0.269214005 */, 19 }, /* 7283 */ { MAD_F(0x044ee708) /* 0.269263299 */, 19 }, /* 7284 */ { MAD_F(0x044f1ab9) /* 0.269312595 */, 19 }, /* 7285 */ { MAD_F(0x044f4e6b) /* 0.269361894 */, 19 }, /* 7286 */ { MAD_F(0x044f821d) /* 0.269411195 */, 19 }, /* 7287 */ { MAD_F(0x044fb5cf) /* 0.269460498 */, 19 }, /* 7288 */ { MAD_F(0x044fe983) /* 0.269509804 */, 19 }, /* 7289 */ { MAD_F(0x04501d37) /* 0.269559111 */, 19 }, /* 7290 */ { MAD_F(0x045050eb) /* 0.269608421 */, 19 }, /* 7291 */ { MAD_F(0x045084a0) /* 0.269657734 */, 19 }, /* 7292 */ { MAD_F(0x0450b856) /* 0.269707048 */, 19 }, /* 7293 */ { MAD_F(0x0450ec0d) /* 0.269756365 */, 19 }, /* 7294 */ { MAD_F(0x04511fc4) /* 0.269805684 */, 19 }, /* 7295 */ { MAD_F(0x0451537b) /* 0.269855005 */, 19 }, /* 7296 */ { MAD_F(0x04518733) /* 0.269904329 */, 19 }, /* 7297 */ { MAD_F(0x0451baec) /* 0.269953654 */, 19 }, /* 7298 */ { MAD_F(0x0451eea5) /* 0.270002982 */, 19 }, /* 7299 */ { MAD_F(0x0452225f) /* 0.270052313 */, 19 }, /* 7300 */ { MAD_F(0x0452561a) /* 0.270101645 */, 19 }, /* 7301 */ { MAD_F(0x045289d5) /* 0.270150980 */, 19 }, /* 7302 */ { MAD_F(0x0452bd91) /* 0.270200317 */, 19 }, /* 7303 */ { MAD_F(0x0452f14d) /* 0.270249656 */, 19 }, /* 7304 */ { MAD_F(0x0453250a) /* 0.270298998 */, 19 }, /* 7305 */ { MAD_F(0x045358c8) /* 0.270348341 */, 19 }, /* 7306 */ { MAD_F(0x04538c86) /* 0.270397687 */, 19 }, /* 7307 */ { MAD_F(0x0453c045) /* 0.270447036 */, 19 }, /* 7308 */ { MAD_F(0x0453f405) /* 0.270496386 */, 19 }, /* 7309 */ { MAD_F(0x045427c5) /* 0.270545739 */, 19 }, /* 7310 */ { MAD_F(0x04545b85) /* 0.270595094 */, 19 }, /* 7311 */ { MAD_F(0x04548f46) /* 0.270644451 */, 19 }, /* 7312 */ { MAD_F(0x0454c308) /* 0.270693811 */, 19 }, /* 7313 */ { MAD_F(0x0454f6cb) /* 0.270743173 */, 19 }, /* 7314 */ { MAD_F(0x04552a8e) /* 0.270792537 */, 19 }, /* 7315 */ { MAD_F(0x04555e51) /* 0.270841903 */, 19 }, /* 7316 */ { MAD_F(0x04559216) /* 0.270891271 */, 19 }, /* 7317 */ { MAD_F(0x0455c5db) /* 0.270940642 */, 19 }, /* 7318 */ { MAD_F(0x0455f9a0) /* 0.270990015 */, 19 }, /* 7319 */ { MAD_F(0x04562d66) /* 0.271039390 */, 19 }, /* 7320 */ { MAD_F(0x0456612d) /* 0.271088768 */, 19 }, /* 7321 */ { MAD_F(0x045694f4) /* 0.271138148 */, 19 }, /* 7322 */ { MAD_F(0x0456c8bc) /* 0.271187530 */, 19 }, /* 7323 */ { MAD_F(0x0456fc84) /* 0.271236914 */, 19 }, /* 7324 */ { MAD_F(0x0457304e) /* 0.271286301 */, 19 }, /* 7325 */ { MAD_F(0x04576417) /* 0.271335689 */, 19 }, /* 7326 */ { MAD_F(0x045797e2) /* 0.271385080 */, 19 }, /* 7327 */ { MAD_F(0x0457cbac) /* 0.271434474 */, 19 }, /* 7328 */ { MAD_F(0x0457ff78) /* 0.271483869 */, 19 }, /* 7329 */ { MAD_F(0x04583344) /* 0.271533267 */, 19 }, /* 7330 */ { MAD_F(0x04586711) /* 0.271582667 */, 19 }, /* 7331 */ { MAD_F(0x04589ade) /* 0.271632069 */, 19 }, /* 7332 */ { MAD_F(0x0458ceac) /* 0.271681474 */, 19 }, /* 7333 */ { MAD_F(0x0459027b) /* 0.271730880 */, 19 }, /* 7334 */ { MAD_F(0x0459364a) /* 0.271780289 */, 19 }, /* 7335 */ { MAD_F(0x04596a19) /* 0.271829701 */, 19 }, /* 7336 */ { MAD_F(0x04599dea) /* 0.271879114 */, 19 }, /* 7337 */ { MAD_F(0x0459d1bb) /* 0.271928530 */, 19 }, /* 7338 */ { MAD_F(0x045a058c) /* 0.271977948 */, 19 }, /* 7339 */ { MAD_F(0x045a395e) /* 0.272027368 */, 19 }, /* 7340 */ { MAD_F(0x045a6d31) /* 0.272076790 */, 19 }, /* 7341 */ { MAD_F(0x045aa104) /* 0.272126215 */, 19 }, /* 7342 */ { MAD_F(0x045ad4d8) /* 0.272175642 */, 19 }, /* 7343 */ { MAD_F(0x045b08ad) /* 0.272225071 */, 19 }, /* 7344 */ { MAD_F(0x045b3c82) /* 0.272274503 */, 19 }, /* 7345 */ { MAD_F(0x045b7058) /* 0.272323936 */, 19 }, /* 7346 */ { MAD_F(0x045ba42e) /* 0.272373372 */, 19 }, /* 7347 */ { MAD_F(0x045bd805) /* 0.272422810 */, 19 }, /* 7348 */ { MAD_F(0x045c0bdd) /* 0.272472251 */, 19 }, /* 7349 */ { MAD_F(0x045c3fb5) /* 0.272521693 */, 19 }, /* 7350 */ { MAD_F(0x045c738e) /* 0.272571138 */, 19 }, /* 7351 */ { MAD_F(0x045ca767) /* 0.272620585 */, 19 }, /* 7352 */ { MAD_F(0x045cdb41) /* 0.272670035 */, 19 }, /* 7353 */ { MAD_F(0x045d0f1b) /* 0.272719486 */, 19 }, /* 7354 */ { MAD_F(0x045d42f7) /* 0.272768940 */, 19 }, /* 7355 */ { MAD_F(0x045d76d2) /* 0.272818396 */, 19 }, /* 7356 */ { MAD_F(0x045daaaf) /* 0.272867855 */, 19 }, /* 7357 */ { MAD_F(0x045dde8c) /* 0.272917315 */, 19 }, /* 7358 */ { MAD_F(0x045e1269) /* 0.272966778 */, 19 }, /* 7359 */ { MAD_F(0x045e4647) /* 0.273016243 */, 19 }, /* 7360 */ { MAD_F(0x045e7a26) /* 0.273065710 */, 19 }, /* 7361 */ { MAD_F(0x045eae06) /* 0.273115180 */, 19 }, /* 7362 */ { MAD_F(0x045ee1e6) /* 0.273164652 */, 19 }, /* 7363 */ { MAD_F(0x045f15c6) /* 0.273214126 */, 19 }, /* 7364 */ { MAD_F(0x045f49a7) /* 0.273263602 */, 19 }, /* 7365 */ { MAD_F(0x045f7d89) /* 0.273313081 */, 19 }, /* 7366 */ { MAD_F(0x045fb16c) /* 0.273362561 */, 19 }, /* 7367 */ { MAD_F(0x045fe54f) /* 0.273412044 */, 19 }, /* 7368 */ { MAD_F(0x04601932) /* 0.273461530 */, 19 }, /* 7369 */ { MAD_F(0x04604d16) /* 0.273511017 */, 19 }, /* 7370 */ { MAD_F(0x046080fb) /* 0.273560507 */, 19 }, /* 7371 */ { MAD_F(0x0460b4e1) /* 0.273609999 */, 19 }, /* 7372 */ { MAD_F(0x0460e8c7) /* 0.273659493 */, 19 }, /* 7373 */ { MAD_F(0x04611cad) /* 0.273708989 */, 19 }, /* 7374 */ { MAD_F(0x04615094) /* 0.273758488 */, 19 }, /* 7375 */ { MAD_F(0x0461847c) /* 0.273807989 */, 19 }, /* 7376 */ { MAD_F(0x0461b864) /* 0.273857492 */, 19 }, /* 7377 */ { MAD_F(0x0461ec4d) /* 0.273906997 */, 19 }, /* 7378 */ { MAD_F(0x04622037) /* 0.273956505 */, 19 }, /* 7379 */ { MAD_F(0x04625421) /* 0.274006015 */, 19 }, /* 7380 */ { MAD_F(0x0462880c) /* 0.274055527 */, 19 }, /* 7381 */ { MAD_F(0x0462bbf7) /* 0.274105041 */, 19 }, /* 7382 */ { MAD_F(0x0462efe3) /* 0.274154558 */, 19 }, /* 7383 */ { MAD_F(0x046323d0) /* 0.274204076 */, 19 }, /* 7384 */ { MAD_F(0x046357bd) /* 0.274253597 */, 19 }, /* 7385 */ { MAD_F(0x04638bab) /* 0.274303121 */, 19 }, /* 7386 */ { MAD_F(0x0463bf99) /* 0.274352646 */, 19 }, /* 7387 */ { MAD_F(0x0463f388) /* 0.274402174 */, 19 }, /* 7388 */ { MAD_F(0x04642778) /* 0.274451704 */, 19 }, /* 7389 */ { MAD_F(0x04645b68) /* 0.274501236 */, 19 }, /* 7390 */ { MAD_F(0x04648f59) /* 0.274550771 */, 19 }, /* 7391 */ { MAD_F(0x0464c34a) /* 0.274600307 */, 19 }, /* 7392 */ { MAD_F(0x0464f73c) /* 0.274649846 */, 19 }, /* 7393 */ { MAD_F(0x04652b2f) /* 0.274699387 */, 19 }, /* 7394 */ { MAD_F(0x04655f22) /* 0.274748931 */, 19 }, /* 7395 */ { MAD_F(0x04659316) /* 0.274798476 */, 19 }, /* 7396 */ { MAD_F(0x0465c70a) /* 0.274848024 */, 19 }, /* 7397 */ { MAD_F(0x0465faff) /* 0.274897574 */, 19 }, /* 7398 */ { MAD_F(0x04662ef5) /* 0.274947126 */, 19 }, /* 7399 */ { MAD_F(0x046662eb) /* 0.274996681 */, 19 }, /* 7400 */ { MAD_F(0x046696e2) /* 0.275046238 */, 19 }, /* 7401 */ { MAD_F(0x0466cad9) /* 0.275095797 */, 19 }, /* 7402 */ { MAD_F(0x0466fed1) /* 0.275145358 */, 19 }, /* 7403 */ { MAD_F(0x046732ca) /* 0.275194921 */, 19 }, /* 7404 */ { MAD_F(0x046766c3) /* 0.275244487 */, 19 }, /* 7405 */ { MAD_F(0x04679abd) /* 0.275294055 */, 19 }, /* 7406 */ { MAD_F(0x0467ceb7) /* 0.275343625 */, 19 }, /* 7407 */ { MAD_F(0x046802b2) /* 0.275393198 */, 19 }, /* 7408 */ { MAD_F(0x046836ae) /* 0.275442772 */, 19 }, /* 7409 */ { MAD_F(0x04686aaa) /* 0.275492349 */, 19 }, /* 7410 */ { MAD_F(0x04689ea7) /* 0.275541928 */, 19 }, /* 7411 */ { MAD_F(0x0468d2a4) /* 0.275591509 */, 19 }, /* 7412 */ { MAD_F(0x046906a2) /* 0.275641093 */, 19 }, /* 7413 */ { MAD_F(0x04693aa1) /* 0.275690679 */, 19 }, /* 7414 */ { MAD_F(0x04696ea0) /* 0.275740267 */, 19 }, /* 7415 */ { MAD_F(0x0469a2a0) /* 0.275789857 */, 19 }, /* 7416 */ { MAD_F(0x0469d6a0) /* 0.275839449 */, 19 }, /* 7417 */ { MAD_F(0x046a0aa1) /* 0.275889044 */, 19 }, /* 7418 */ { MAD_F(0x046a3ea3) /* 0.275938641 */, 19 }, /* 7419 */ { MAD_F(0x046a72a5) /* 0.275988240 */, 19 }, /* 7420 */ { MAD_F(0x046aa6a8) /* 0.276037842 */, 19 }, /* 7421 */ { MAD_F(0x046adaab) /* 0.276087445 */, 19 }, /* 7422 */ { MAD_F(0x046b0eaf) /* 0.276137051 */, 19 }, /* 7423 */ { MAD_F(0x046b42b3) /* 0.276186659 */, 19 }, /* 7424 */ { MAD_F(0x046b76b9) /* 0.276236269 */, 19 }, /* 7425 */ { MAD_F(0x046baabe) /* 0.276285882 */, 19 }, /* 7426 */ { MAD_F(0x046bdec5) /* 0.276335497 */, 19 }, /* 7427 */ { MAD_F(0x046c12cc) /* 0.276385113 */, 19 }, /* 7428 */ { MAD_F(0x046c46d3) /* 0.276434733 */, 19 }, /* 7429 */ { MAD_F(0x046c7adb) /* 0.276484354 */, 19 }, /* 7430 */ { MAD_F(0x046caee4) /* 0.276533978 */, 19 }, /* 7431 */ { MAD_F(0x046ce2ee) /* 0.276583604 */, 19 }, /* 7432 */ { MAD_F(0x046d16f7) /* 0.276633232 */, 19 }, /* 7433 */ { MAD_F(0x046d4b02) /* 0.276682862 */, 19 }, /* 7434 */ { MAD_F(0x046d7f0d) /* 0.276732495 */, 19 }, /* 7435 */ { MAD_F(0x046db319) /* 0.276782129 */, 19 }, /* 7436 */ { MAD_F(0x046de725) /* 0.276831766 */, 19 }, /* 7437 */ { MAD_F(0x046e1b32) /* 0.276881406 */, 19 }, /* 7438 */ { MAD_F(0x046e4f40) /* 0.276931047 */, 19 }, /* 7439 */ { MAD_F(0x046e834e) /* 0.276980691 */, 19 }, /* 7440 */ { MAD_F(0x046eb75c) /* 0.277030337 */, 19 }, /* 7441 */ { MAD_F(0x046eeb6c) /* 0.277079985 */, 19 }, /* 7442 */ { MAD_F(0x046f1f7c) /* 0.277129635 */, 19 }, /* 7443 */ { MAD_F(0x046f538c) /* 0.277179288 */, 19 }, /* 7444 */ { MAD_F(0x046f879d) /* 0.277228942 */, 19 }, /* 7445 */ { MAD_F(0x046fbbaf) /* 0.277278600 */, 19 }, /* 7446 */ { MAD_F(0x046fefc1) /* 0.277328259 */, 19 }, /* 7447 */ { MAD_F(0x047023d4) /* 0.277377920 */, 19 }, /* 7448 */ { MAD_F(0x047057e8) /* 0.277427584 */, 19 }, /* 7449 */ { MAD_F(0x04708bfc) /* 0.277477250 */, 19 }, /* 7450 */ { MAD_F(0x0470c011) /* 0.277526918 */, 19 }, /* 7451 */ { MAD_F(0x0470f426) /* 0.277576588 */, 19 }, /* 7452 */ { MAD_F(0x0471283c) /* 0.277626261 */, 19 }, /* 7453 */ { MAD_F(0x04715c52) /* 0.277675936 */, 19 }, /* 7454 */ { MAD_F(0x04719069) /* 0.277725613 */, 19 }, /* 7455 */ { MAD_F(0x0471c481) /* 0.277775292 */, 19 }, /* 7456 */ { MAD_F(0x0471f899) /* 0.277824973 */, 19 }, /* 7457 */ { MAD_F(0x04722cb2) /* 0.277874657 */, 19 }, /* 7458 */ { MAD_F(0x047260cc) /* 0.277924343 */, 19 }, /* 7459 */ { MAD_F(0x047294e6) /* 0.277974031 */, 19 }, /* 7460 */ { MAD_F(0x0472c900) /* 0.278023722 */, 19 }, /* 7461 */ { MAD_F(0x0472fd1b) /* 0.278073414 */, 19 }, /* 7462 */ { MAD_F(0x04733137) /* 0.278123109 */, 19 }, /* 7463 */ { MAD_F(0x04736554) /* 0.278172806 */, 19 }, /* 7464 */ { MAD_F(0x04739971) /* 0.278222505 */, 19 }, /* 7465 */ { MAD_F(0x0473cd8e) /* 0.278272207 */, 19 }, /* 7466 */ { MAD_F(0x047401ad) /* 0.278321910 */, 19 }, /* 7467 */ { MAD_F(0x047435cb) /* 0.278371616 */, 19 }, /* 7468 */ { MAD_F(0x047469eb) /* 0.278421324 */, 19 }, /* 7469 */ { MAD_F(0x04749e0b) /* 0.278471035 */, 19 }, /* 7470 */ { MAD_F(0x0474d22c) /* 0.278520747 */, 19 }, /* 7471 */ { MAD_F(0x0475064d) /* 0.278570462 */, 19 }, /* 7472 */ { MAD_F(0x04753a6f) /* 0.278620179 */, 19 }, /* 7473 */ { MAD_F(0x04756e91) /* 0.278669898 */, 19 }, /* 7474 */ { MAD_F(0x0475a2b4) /* 0.278719619 */, 19 }, /* 7475 */ { MAD_F(0x0475d6d7) /* 0.278769343 */, 19 }, /* 7476 */ { MAD_F(0x04760afc) /* 0.278819069 */, 19 }, /* 7477 */ { MAD_F(0x04763f20) /* 0.278868797 */, 19 }, /* 7478 */ { MAD_F(0x04767346) /* 0.278918527 */, 19 }, /* 7479 */ { MAD_F(0x0476a76c) /* 0.278968260 */, 19 }, /* 7480 */ { MAD_F(0x0476db92) /* 0.279017995 */, 19 }, /* 7481 */ { MAD_F(0x04770fba) /* 0.279067731 */, 19 }, /* 7482 */ { MAD_F(0x047743e1) /* 0.279117471 */, 19 }, /* 7483 */ { MAD_F(0x0477780a) /* 0.279167212 */, 19 }, /* 7484 */ { MAD_F(0x0477ac33) /* 0.279216956 */, 19 }, /* 7485 */ { MAD_F(0x0477e05c) /* 0.279266701 */, 19 }, /* 7486 */ { MAD_F(0x04781486) /* 0.279316449 */, 19 }, /* 7487 */ { MAD_F(0x047848b1) /* 0.279366200 */, 19 }, /* 7488 */ { MAD_F(0x04787cdc) /* 0.279415952 */, 19 }, /* 7489 */ { MAD_F(0x0478b108) /* 0.279465707 */, 19 }, /* 7490 */ { MAD_F(0x0478e535) /* 0.279515464 */, 19 }, /* 7491 */ { MAD_F(0x04791962) /* 0.279565223 */, 19 }, /* 7492 */ { MAD_F(0x04794d8f) /* 0.279614984 */, 19 }, /* 7493 */ { MAD_F(0x047981be) /* 0.279664748 */, 19 }, /* 7494 */ { MAD_F(0x0479b5ed) /* 0.279714513 */, 19 }, /* 7495 */ { MAD_F(0x0479ea1c) /* 0.279764281 */, 19 }, /* 7496 */ { MAD_F(0x047a1e4c) /* 0.279814051 */, 19 }, /* 7497 */ { MAD_F(0x047a527d) /* 0.279863824 */, 19 }, /* 7498 */ { MAD_F(0x047a86ae) /* 0.279913598 */, 19 }, /* 7499 */ { MAD_F(0x047abae0) /* 0.279963375 */, 19 }, /* 7500 */ { MAD_F(0x047aef12) /* 0.280013154 */, 19 }, /* 7501 */ { MAD_F(0x047b2346) /* 0.280062935 */, 19 }, /* 7502 */ { MAD_F(0x047b5779) /* 0.280112719 */, 19 }, /* 7503 */ { MAD_F(0x047b8bad) /* 0.280162504 */, 19 }, /* 7504 */ { MAD_F(0x047bbfe2) /* 0.280212292 */, 19 }, /* 7505 */ { MAD_F(0x047bf418) /* 0.280262082 */, 19 }, /* 7506 */ { MAD_F(0x047c284e) /* 0.280311875 */, 19 }, /* 7507 */ { MAD_F(0x047c5c84) /* 0.280361669 */, 19 }, /* 7508 */ { MAD_F(0x047c90bb) /* 0.280411466 */, 19 }, /* 7509 */ { MAD_F(0x047cc4f3) /* 0.280461265 */, 19 }, /* 7510 */ { MAD_F(0x047cf92c) /* 0.280511066 */, 19 }, /* 7511 */ { MAD_F(0x047d2d65) /* 0.280560869 */, 19 }, /* 7512 */ { MAD_F(0x047d619e) /* 0.280610675 */, 19 }, /* 7513 */ { MAD_F(0x047d95d8) /* 0.280660483 */, 19 }, /* 7514 */ { MAD_F(0x047dca13) /* 0.280710292 */, 19 }, /* 7515 */ { MAD_F(0x047dfe4e) /* 0.280760105 */, 19 }, /* 7516 */ { MAD_F(0x047e328a) /* 0.280809919 */, 19 }, /* 7517 */ { MAD_F(0x047e66c7) /* 0.280859736 */, 19 }, /* 7518 */ { MAD_F(0x047e9b04) /* 0.280909554 */, 19 }, /* 7519 */ { MAD_F(0x047ecf42) /* 0.280959375 */, 19 }, /* 7520 */ { MAD_F(0x047f0380) /* 0.281009199 */, 19 }, /* 7521 */ { MAD_F(0x047f37bf) /* 0.281059024 */, 19 }, /* 7522 */ { MAD_F(0x047f6bff) /* 0.281108852 */, 19 }, /* 7523 */ { MAD_F(0x047fa03f) /* 0.281158682 */, 19 }, /* 7524 */ { MAD_F(0x047fd47f) /* 0.281208514 */, 19 }, /* 7525 */ { MAD_F(0x048008c1) /* 0.281258348 */, 19 }, /* 7526 */ { MAD_F(0x04803d02) /* 0.281308184 */, 19 }, /* 7527 */ { MAD_F(0x04807145) /* 0.281358023 */, 19 }, /* 7528 */ { MAD_F(0x0480a588) /* 0.281407864 */, 19 }, /* 7529 */ { MAD_F(0x0480d9cc) /* 0.281457707 */, 19 }, /* 7530 */ { MAD_F(0x04810e10) /* 0.281507552 */, 19 }, /* 7531 */ { MAD_F(0x04814255) /* 0.281557400 */, 19 }, /* 7532 */ { MAD_F(0x0481769a) /* 0.281607250 */, 19 }, /* 7533 */ { MAD_F(0x0481aae0) /* 0.281657101 */, 19 }, /* 7534 */ { MAD_F(0x0481df27) /* 0.281706956 */, 19 }, /* 7535 */ { MAD_F(0x0482136e) /* 0.281756812 */, 19 }, /* 7536 */ { MAD_F(0x048247b6) /* 0.281806670 */, 19 }, /* 7537 */ { MAD_F(0x04827bfe) /* 0.281856531 */, 19 }, /* 7538 */ { MAD_F(0x0482b047) /* 0.281906394 */, 19 }, /* 7539 */ { MAD_F(0x0482e491) /* 0.281956259 */, 19 }, /* 7540 */ { MAD_F(0x048318db) /* 0.282006127 */, 19 }, /* 7541 */ { MAD_F(0x04834d26) /* 0.282055996 */, 19 }, /* 7542 */ { MAD_F(0x04838171) /* 0.282105868 */, 19 }, /* 7543 */ { MAD_F(0x0483b5bd) /* 0.282155742 */, 19 }, /* 7544 */ { MAD_F(0x0483ea0a) /* 0.282205618 */, 19 }, /* 7545 */ { MAD_F(0x04841e57) /* 0.282255496 */, 19 }, /* 7546 */ { MAD_F(0x048452a4) /* 0.282305377 */, 19 }, /* 7547 */ { MAD_F(0x048486f3) /* 0.282355260 */, 19 }, /* 7548 */ { MAD_F(0x0484bb42) /* 0.282405145 */, 19 }, /* 7549 */ { MAD_F(0x0484ef91) /* 0.282455032 */, 19 }, /* 7550 */ { MAD_F(0x048523e1) /* 0.282504921 */, 19 }, /* 7551 */ { MAD_F(0x04855832) /* 0.282554813 */, 19 }, /* 7552 */ { MAD_F(0x04858c83) /* 0.282604707 */, 19 }, /* 7553 */ { MAD_F(0x0485c0d5) /* 0.282654603 */, 19 }, /* 7554 */ { MAD_F(0x0485f527) /* 0.282704501 */, 19 }, /* 7555 */ { MAD_F(0x0486297a) /* 0.282754401 */, 19 }, /* 7556 */ { MAD_F(0x04865dce) /* 0.282804304 */, 19 }, /* 7557 */ { MAD_F(0x04869222) /* 0.282854209 */, 19 }, /* 7558 */ { MAD_F(0x0486c677) /* 0.282904116 */, 19 }, /* 7559 */ { MAD_F(0x0486facc) /* 0.282954025 */, 19 }, /* 7560 */ { MAD_F(0x04872f22) /* 0.283003936 */, 19 }, /* 7561 */ { MAD_F(0x04876379) /* 0.283053850 */, 19 }, /* 7562 */ { MAD_F(0x048797d0) /* 0.283103766 */, 19 }, /* 7563 */ { MAD_F(0x0487cc28) /* 0.283153684 */, 19 }, /* 7564 */ { MAD_F(0x04880080) /* 0.283203604 */, 19 }, /* 7565 */ { MAD_F(0x048834d9) /* 0.283253527 */, 19 }, /* 7566 */ { MAD_F(0x04886933) /* 0.283303451 */, 19 }, /* 7567 */ { MAD_F(0x04889d8d) /* 0.283353378 */, 19 }, /* 7568 */ { MAD_F(0x0488d1e8) /* 0.283403307 */, 19 }, /* 7569 */ { MAD_F(0x04890643) /* 0.283453238 */, 19 }, /* 7570 */ { MAD_F(0x04893a9f) /* 0.283503172 */, 19 }, /* 7571 */ { MAD_F(0x04896efb) /* 0.283553107 */, 19 }, /* 7572 */ { MAD_F(0x0489a358) /* 0.283603045 */, 19 }, /* 7573 */ { MAD_F(0x0489d7b6) /* 0.283652985 */, 19 }, /* 7574 */ { MAD_F(0x048a0c14) /* 0.283702927 */, 19 }, /* 7575 */ { MAD_F(0x048a4073) /* 0.283752872 */, 19 }, /* 7576 */ { MAD_F(0x048a74d3) /* 0.283802818 */, 19 }, /* 7577 */ { MAD_F(0x048aa933) /* 0.283852767 */, 19 }, /* 7578 */ { MAD_F(0x048add93) /* 0.283902718 */, 19 }, /* 7579 */ { MAD_F(0x048b11f5) /* 0.283952671 */, 19 }, /* 7580 */ { MAD_F(0x048b4656) /* 0.284002627 */, 19 }, /* 7581 */ { MAD_F(0x048b7ab9) /* 0.284052584 */, 19 }, /* 7582 */ { MAD_F(0x048baf1c) /* 0.284102544 */, 19 }, /* 7583 */ { MAD_F(0x048be37f) /* 0.284152506 */, 19 }, /* 7584 */ { MAD_F(0x048c17e3) /* 0.284202470 */, 19 }, /* 7585 */ { MAD_F(0x048c4c48) /* 0.284252436 */, 19 }, /* 7586 */ { MAD_F(0x048c80ad) /* 0.284302405 */, 19 }, /* 7587 */ { MAD_F(0x048cb513) /* 0.284352376 */, 19 }, /* 7588 */ { MAD_F(0x048ce97a) /* 0.284402349 */, 19 }, /* 7589 */ { MAD_F(0x048d1de1) /* 0.284452324 */, 19 }, /* 7590 */ { MAD_F(0x048d5249) /* 0.284502301 */, 19 }, /* 7591 */ { MAD_F(0x048d86b1) /* 0.284552281 */, 19 }, /* 7592 */ { MAD_F(0x048dbb1a) /* 0.284602263 */, 19 }, /* 7593 */ { MAD_F(0x048def83) /* 0.284652246 */, 19 }, /* 7594 */ { MAD_F(0x048e23ed) /* 0.284702233 */, 19 }, /* 7595 */ { MAD_F(0x048e5858) /* 0.284752221 */, 19 }, /* 7596 */ { MAD_F(0x048e8cc3) /* 0.284802211 */, 19 }, /* 7597 */ { MAD_F(0x048ec12f) /* 0.284852204 */, 19 }, /* 7598 */ { MAD_F(0x048ef59b) /* 0.284902199 */, 19 }, /* 7599 */ { MAD_F(0x048f2a08) /* 0.284952196 */, 19 }, /* 7600 */ { MAD_F(0x048f5e76) /* 0.285002195 */, 19 }, /* 7601 */ { MAD_F(0x048f92e4) /* 0.285052197 */, 19 }, /* 7602 */ { MAD_F(0x048fc753) /* 0.285102201 */, 19 }, /* 7603 */ { MAD_F(0x048ffbc2) /* 0.285152206 */, 19 }, /* 7604 */ { MAD_F(0x04903032) /* 0.285202214 */, 19 }, /* 7605 */ { MAD_F(0x049064a3) /* 0.285252225 */, 19 }, /* 7606 */ { MAD_F(0x04909914) /* 0.285302237 */, 19 }, /* 7607 */ { MAD_F(0x0490cd86) /* 0.285352252 */, 19 }, /* 7608 */ { MAD_F(0x049101f8) /* 0.285402269 */, 19 }, /* 7609 */ { MAD_F(0x0491366b) /* 0.285452288 */, 19 }, /* 7610 */ { MAD_F(0x04916ade) /* 0.285502309 */, 19 }, /* 7611 */ { MAD_F(0x04919f52) /* 0.285552332 */, 19 }, /* 7612 */ { MAD_F(0x0491d3c7) /* 0.285602358 */, 19 }, /* 7613 */ { MAD_F(0x0492083c) /* 0.285652386 */, 19 }, /* 7614 */ { MAD_F(0x04923cb2) /* 0.285702416 */, 19 }, /* 7615 */ { MAD_F(0x04927128) /* 0.285752448 */, 19 }, /* 7616 */ { MAD_F(0x0492a59f) /* 0.285802482 */, 19 }, /* 7617 */ { MAD_F(0x0492da17) /* 0.285852519 */, 19 }, /* 7618 */ { MAD_F(0x04930e8f) /* 0.285902557 */, 19 }, /* 7619 */ { MAD_F(0x04934308) /* 0.285952598 */, 19 }, /* 7620 */ { MAD_F(0x04937781) /* 0.286002641 */, 19 }, /* 7621 */ { MAD_F(0x0493abfb) /* 0.286052687 */, 19 }, /* 7622 */ { MAD_F(0x0493e076) /* 0.286102734 */, 19 }, /* 7623 */ { MAD_F(0x049414f1) /* 0.286152784 */, 19 }, /* 7624 */ { MAD_F(0x0494496c) /* 0.286202836 */, 19 }, /* 7625 */ { MAD_F(0x04947de9) /* 0.286252890 */, 19 }, /* 7626 */ { MAD_F(0x0494b266) /* 0.286302946 */, 19 }, /* 7627 */ { MAD_F(0x0494e6e3) /* 0.286353005 */, 19 }, /* 7628 */ { MAD_F(0x04951b61) /* 0.286403065 */, 19 }, /* 7629 */ { MAD_F(0x04954fe0) /* 0.286453128 */, 19 }, /* 7630 */ { MAD_F(0x0495845f) /* 0.286503193 */, 19 }, /* 7631 */ { MAD_F(0x0495b8df) /* 0.286553260 */, 19 }, /* 7632 */ { MAD_F(0x0495ed5f) /* 0.286603329 */, 19 }, /* 7633 */ { MAD_F(0x049621e0) /* 0.286653401 */, 19 }, /* 7634 */ { MAD_F(0x04965662) /* 0.286703475 */, 19 }, /* 7635 */ { MAD_F(0x04968ae4) /* 0.286753551 */, 19 }, /* 7636 */ { MAD_F(0x0496bf67) /* 0.286803629 */, 19 }, /* 7637 */ { MAD_F(0x0496f3ea) /* 0.286853709 */, 19 }, /* 7638 */ { MAD_F(0x0497286e) /* 0.286903792 */, 19 }, /* 7639 */ { MAD_F(0x04975cf2) /* 0.286953876 */, 19 }, /* 7640 */ { MAD_F(0x04979177) /* 0.287003963 */, 19 }, /* 7641 */ { MAD_F(0x0497c5fd) /* 0.287054052 */, 19 }, /* 7642 */ { MAD_F(0x0497fa83) /* 0.287104143 */, 19 }, /* 7643 */ { MAD_F(0x04982f0a) /* 0.287154237 */, 19 }, /* 7644 */ { MAD_F(0x04986392) /* 0.287204332 */, 19 }, /* 7645 */ { MAD_F(0x0498981a) /* 0.287254430 */, 19 }, /* 7646 */ { MAD_F(0x0498cca2) /* 0.287304530 */, 19 }, /* 7647 */ { MAD_F(0x0499012c) /* 0.287354632 */, 19 }, /* 7648 */ { MAD_F(0x049935b5) /* 0.287404737 */, 19 }, /* 7649 */ { MAD_F(0x04996a40) /* 0.287454843 */, 19 }, /* 7650 */ { MAD_F(0x04999ecb) /* 0.287504952 */, 19 }, /* 7651 */ { MAD_F(0x0499d356) /* 0.287555063 */, 19 }, /* 7652 */ { MAD_F(0x049a07e2) /* 0.287605176 */, 19 }, /* 7653 */ { MAD_F(0x049a3c6f) /* 0.287655291 */, 19 }, /* 7654 */ { MAD_F(0x049a70fc) /* 0.287705409 */, 19 }, /* 7655 */ { MAD_F(0x049aa58a) /* 0.287755528 */, 19 }, /* 7656 */ { MAD_F(0x049ada19) /* 0.287805650 */, 19 }, /* 7657 */ { MAD_F(0x049b0ea8) /* 0.287855774 */, 19 }, /* 7658 */ { MAD_F(0x049b4337) /* 0.287905900 */, 19 }, /* 7659 */ { MAD_F(0x049b77c8) /* 0.287956028 */, 19 }, /* 7660 */ { MAD_F(0x049bac58) /* 0.288006159 */, 19 }, /* 7661 */ { MAD_F(0x049be0ea) /* 0.288056292 */, 19 }, /* 7662 */ { MAD_F(0x049c157c) /* 0.288106427 */, 19 }, /* 7663 */ { MAD_F(0x049c4a0e) /* 0.288156564 */, 19 }, /* 7664 */ { MAD_F(0x049c7ea1) /* 0.288206703 */, 19 }, /* 7665 */ { MAD_F(0x049cb335) /* 0.288256844 */, 19 }, /* 7666 */ { MAD_F(0x049ce7ca) /* 0.288306988 */, 19 }, /* 7667 */ { MAD_F(0x049d1c5e) /* 0.288357134 */, 19 }, /* 7668 */ { MAD_F(0x049d50f4) /* 0.288407282 */, 19 }, /* 7669 */ { MAD_F(0x049d858a) /* 0.288457432 */, 19 }, /* 7670 */ { MAD_F(0x049dba21) /* 0.288507584 */, 19 }, /* 7671 */ { MAD_F(0x049deeb8) /* 0.288557739 */, 19 }, /* 7672 */ { MAD_F(0x049e2350) /* 0.288607895 */, 19 }, /* 7673 */ { MAD_F(0x049e57e8) /* 0.288658054 */, 19 }, /* 7674 */ { MAD_F(0x049e8c81) /* 0.288708215 */, 19 }, /* 7675 */ { MAD_F(0x049ec11b) /* 0.288758379 */, 19 }, /* 7676 */ { MAD_F(0x049ef5b5) /* 0.288808544 */, 19 }, /* 7677 */ { MAD_F(0x049f2a50) /* 0.288858712 */, 19 }, /* 7678 */ { MAD_F(0x049f5eeb) /* 0.288908881 */, 19 }, /* 7679 */ { MAD_F(0x049f9387) /* 0.288959053 */, 19 }, /* 7680 */ { MAD_F(0x049fc824) /* 0.289009227 */, 19 }, /* 7681 */ { MAD_F(0x049ffcc1) /* 0.289059404 */, 19 }, /* 7682 */ { MAD_F(0x04a0315e) /* 0.289109582 */, 19 }, /* 7683 */ { MAD_F(0x04a065fd) /* 0.289159763 */, 19 }, /* 7684 */ { MAD_F(0x04a09a9b) /* 0.289209946 */, 19 }, /* 7685 */ { MAD_F(0x04a0cf3b) /* 0.289260131 */, 19 }, /* 7686 */ { MAD_F(0x04a103db) /* 0.289310318 */, 19 }, /* 7687 */ { MAD_F(0x04a1387b) /* 0.289360507 */, 19 }, /* 7688 */ { MAD_F(0x04a16d1d) /* 0.289410699 */, 19 }, /* 7689 */ { MAD_F(0x04a1a1be) /* 0.289460893 */, 19 }, /* 7690 */ { MAD_F(0x04a1d661) /* 0.289511088 */, 19 }, /* 7691 */ { MAD_F(0x04a20b04) /* 0.289561287 */, 19 }, /* 7692 */ { MAD_F(0x04a23fa7) /* 0.289611487 */, 19 }, /* 7693 */ { MAD_F(0x04a2744b) /* 0.289661689 */, 19 }, /* 7694 */ { MAD_F(0x04a2a8f0) /* 0.289711894 */, 19 }, /* 7695 */ { MAD_F(0x04a2dd95) /* 0.289762101 */, 19 }, /* 7696 */ { MAD_F(0x04a3123b) /* 0.289812309 */, 19 }, /* 7697 */ { MAD_F(0x04a346e2) /* 0.289862521 */, 19 }, /* 7698 */ { MAD_F(0x04a37b89) /* 0.289912734 */, 19 }, /* 7699 */ { MAD_F(0x04a3b030) /* 0.289962949 */, 19 }, /* 7700 */ { MAD_F(0x04a3e4d8) /* 0.290013167 */, 19 }, /* 7701 */ { MAD_F(0x04a41981) /* 0.290063387 */, 19 }, /* 7702 */ { MAD_F(0x04a44e2b) /* 0.290113609 */, 19 }, /* 7703 */ { MAD_F(0x04a482d5) /* 0.290163833 */, 19 }, /* 7704 */ { MAD_F(0x04a4b77f) /* 0.290214059 */, 19 }, /* 7705 */ { MAD_F(0x04a4ec2a) /* 0.290264288 */, 19 }, /* 7706 */ { MAD_F(0x04a520d6) /* 0.290314519 */, 19 }, /* 7707 */ { MAD_F(0x04a55582) /* 0.290364751 */, 19 }, /* 7708 */ { MAD_F(0x04a58a2f) /* 0.290414986 */, 19 }, /* 7709 */ { MAD_F(0x04a5bedd) /* 0.290465224 */, 19 }, /* 7710 */ { MAD_F(0x04a5f38b) /* 0.290515463 */, 19 }, /* 7711 */ { MAD_F(0x04a62839) /* 0.290565705 */, 19 }, /* 7712 */ { MAD_F(0x04a65ce8) /* 0.290615948 */, 19 }, /* 7713 */ { MAD_F(0x04a69198) /* 0.290666194 */, 19 }, /* 7714 */ { MAD_F(0x04a6c648) /* 0.290716442 */, 19 }, /* 7715 */ { MAD_F(0x04a6faf9) /* 0.290766692 */, 19 }, /* 7716 */ { MAD_F(0x04a72fab) /* 0.290816945 */, 19 }, /* 7717 */ { MAD_F(0x04a7645d) /* 0.290867199 */, 19 }, /* 7718 */ { MAD_F(0x04a79910) /* 0.290917456 */, 19 }, /* 7719 */ { MAD_F(0x04a7cdc3) /* 0.290967715 */, 19 }, /* 7720 */ { MAD_F(0x04a80277) /* 0.291017976 */, 19 }, /* 7721 */ { MAD_F(0x04a8372b) /* 0.291068239 */, 19 }, /* 7722 */ { MAD_F(0x04a86be0) /* 0.291118505 */, 19 }, /* 7723 */ { MAD_F(0x04a8a096) /* 0.291168772 */, 19 }, /* 7724 */ { MAD_F(0x04a8d54c) /* 0.291219042 */, 19 }, /* 7725 */ { MAD_F(0x04a90a03) /* 0.291269314 */, 19 }, /* 7726 */ { MAD_F(0x04a93eba) /* 0.291319588 */, 19 }, /* 7727 */ { MAD_F(0x04a97372) /* 0.291369865 */, 19 }, /* 7728 */ { MAD_F(0x04a9a82b) /* 0.291420143 */, 19 }, /* 7729 */ { MAD_F(0x04a9dce4) /* 0.291470424 */, 19 }, /* 7730 */ { MAD_F(0x04aa119d) /* 0.291520706 */, 19 }, /* 7731 */ { MAD_F(0x04aa4658) /* 0.291570991 */, 19 }, /* 7732 */ { MAD_F(0x04aa7b13) /* 0.291621278 */, 19 }, /* 7733 */ { MAD_F(0x04aaafce) /* 0.291671568 */, 19 }, /* 7734 */ { MAD_F(0x04aae48a) /* 0.291721859 */, 19 }, /* 7735 */ { MAD_F(0x04ab1947) /* 0.291772153 */, 19 }, /* 7736 */ { MAD_F(0x04ab4e04) /* 0.291822449 */, 19 }, /* 7737 */ { MAD_F(0x04ab82c2) /* 0.291872747 */, 19 }, /* 7738 */ { MAD_F(0x04abb780) /* 0.291923047 */, 19 }, /* 7739 */ { MAD_F(0x04abec3f) /* 0.291973349 */, 19 }, /* 7740 */ { MAD_F(0x04ac20fe) /* 0.292023653 */, 19 }, /* 7741 */ { MAD_F(0x04ac55be) /* 0.292073960 */, 19 }, /* 7742 */ { MAD_F(0x04ac8a7f) /* 0.292124269 */, 19 }, /* 7743 */ { MAD_F(0x04acbf40) /* 0.292174580 */, 19 }, /* 7744 */ { MAD_F(0x04acf402) /* 0.292224893 */, 19 }, /* 7745 */ { MAD_F(0x04ad28c5) /* 0.292275208 */, 19 }, /* 7746 */ { MAD_F(0x04ad5d88) /* 0.292325526 */, 19 }, /* 7747 */ { MAD_F(0x04ad924b) /* 0.292375845 */, 19 }, /* 7748 */ { MAD_F(0x04adc70f) /* 0.292426167 */, 19 }, /* 7749 */ { MAD_F(0x04adfbd4) /* 0.292476491 */, 19 }, /* 7750 */ { MAD_F(0x04ae3099) /* 0.292526817 */, 19 }, /* 7751 */ { MAD_F(0x04ae655f) /* 0.292577145 */, 19 }, /* 7752 */ { MAD_F(0x04ae9a26) /* 0.292627476 */, 19 }, /* 7753 */ { MAD_F(0x04aeceed) /* 0.292677808 */, 19 }, /* 7754 */ { MAD_F(0x04af03b4) /* 0.292728143 */, 19 }, /* 7755 */ { MAD_F(0x04af387d) /* 0.292778480 */, 19 }, /* 7756 */ { MAD_F(0x04af6d45) /* 0.292828819 */, 19 }, /* 7757 */ { MAD_F(0x04afa20f) /* 0.292879160 */, 19 }, /* 7758 */ { MAD_F(0x04afd6d9) /* 0.292929504 */, 19 }, /* 7759 */ { MAD_F(0x04b00ba3) /* 0.292979849 */, 19 }, /* 7760 */ { MAD_F(0x04b0406e) /* 0.293030197 */, 19 }, /* 7761 */ { MAD_F(0x04b0753a) /* 0.293080547 */, 19 }, /* 7762 */ { MAD_F(0x04b0aa06) /* 0.293130899 */, 19 }, /* 7763 */ { MAD_F(0x04b0ded3) /* 0.293181253 */, 19 }, /* 7764 */ { MAD_F(0x04b113a1) /* 0.293231610 */, 19 }, /* 7765 */ { MAD_F(0x04b1486f) /* 0.293281968 */, 19 }, /* 7766 */ { MAD_F(0x04b17d3d) /* 0.293332329 */, 19 }, /* 7767 */ { MAD_F(0x04b1b20c) /* 0.293382692 */, 19 }, /* 7768 */ { MAD_F(0x04b1e6dc) /* 0.293433057 */, 19 }, /* 7769 */ { MAD_F(0x04b21bad) /* 0.293483424 */, 19 }, /* 7770 */ { MAD_F(0x04b2507d) /* 0.293533794 */, 19 }, /* 7771 */ { MAD_F(0x04b2854f) /* 0.293584165 */, 19 }, /* 7772 */ { MAD_F(0x04b2ba21) /* 0.293634539 */, 19 }, /* 7773 */ { MAD_F(0x04b2eef4) /* 0.293684915 */, 19 }, /* 7774 */ { MAD_F(0x04b323c7) /* 0.293735293 */, 19 }, /* 7775 */ { MAD_F(0x04b3589b) /* 0.293785673 */, 19 }, /* 7776 */ { MAD_F(0x04b38d6f) /* 0.293836055 */, 19 }, /* 7777 */ { MAD_F(0x04b3c244) /* 0.293886440 */, 19 }, /* 7778 */ { MAD_F(0x04b3f71a) /* 0.293936826 */, 19 }, /* 7779 */ { MAD_F(0x04b42bf0) /* 0.293987215 */, 19 }, /* 7780 */ { MAD_F(0x04b460c7) /* 0.294037606 */, 19 }, /* 7781 */ { MAD_F(0x04b4959e) /* 0.294087999 */, 19 }, /* 7782 */ { MAD_F(0x04b4ca76) /* 0.294138395 */, 19 }, /* 7783 */ { MAD_F(0x04b4ff4e) /* 0.294188792 */, 19 }, /* 7784 */ { MAD_F(0x04b53427) /* 0.294239192 */, 19 }, /* 7785 */ { MAD_F(0x04b56901) /* 0.294289593 */, 19 }, /* 7786 */ { MAD_F(0x04b59ddb) /* 0.294339997 */, 19 }, /* 7787 */ { MAD_F(0x04b5d2b6) /* 0.294390403 */, 19 }, /* 7788 */ { MAD_F(0x04b60791) /* 0.294440812 */, 19 }, /* 7789 */ { MAD_F(0x04b63c6d) /* 0.294491222 */, 19 }, /* 7790 */ { MAD_F(0x04b6714a) /* 0.294541635 */, 19 }, /* 7791 */ { MAD_F(0x04b6a627) /* 0.294592049 */, 19 }, /* 7792 */ { MAD_F(0x04b6db05) /* 0.294642466 */, 19 }, /* 7793 */ { MAD_F(0x04b70fe3) /* 0.294692885 */, 19 }, /* 7794 */ { MAD_F(0x04b744c2) /* 0.294743306 */, 19 }, /* 7795 */ { MAD_F(0x04b779a1) /* 0.294793730 */, 19 }, /* 7796 */ { MAD_F(0x04b7ae81) /* 0.294844155 */, 19 }, /* 7797 */ { MAD_F(0x04b7e362) /* 0.294894583 */, 19 }, /* 7798 */ { MAD_F(0x04b81843) /* 0.294945013 */, 19 }, /* 7799 */ { MAD_F(0x04b84d24) /* 0.294995445 */, 19 }, /* 7800 */ { MAD_F(0x04b88207) /* 0.295045879 */, 19 }, /* 7801 */ { MAD_F(0x04b8b6ea) /* 0.295096315 */, 19 }, /* 7802 */ { MAD_F(0x04b8ebcd) /* 0.295146753 */, 19 }, /* 7803 */ { MAD_F(0x04b920b1) /* 0.295197194 */, 19 }, /* 7804 */ { MAD_F(0x04b95596) /* 0.295247637 */, 19 }, /* 7805 */ { MAD_F(0x04b98a7b) /* 0.295298082 */, 19 }, /* 7806 */ { MAD_F(0x04b9bf61) /* 0.295348529 */, 19 }, /* 7807 */ { MAD_F(0x04b9f447) /* 0.295398978 */, 19 }, /* 7808 */ { MAD_F(0x04ba292e) /* 0.295449429 */, 19 }, /* 7809 */ { MAD_F(0x04ba5e16) /* 0.295499883 */, 19 }, /* 7810 */ { MAD_F(0x04ba92fe) /* 0.295550338 */, 19 }, /* 7811 */ { MAD_F(0x04bac7e6) /* 0.295600796 */, 19 }, /* 7812 */ { MAD_F(0x04bafcd0) /* 0.295651256 */, 19 }, /* 7813 */ { MAD_F(0x04bb31b9) /* 0.295701718 */, 19 }, /* 7814 */ { MAD_F(0x04bb66a4) /* 0.295752183 */, 19 }, /* 7815 */ { MAD_F(0x04bb9b8f) /* 0.295802649 */, 19 }, /* 7816 */ { MAD_F(0x04bbd07a) /* 0.295853118 */, 19 }, /* 7817 */ { MAD_F(0x04bc0566) /* 0.295903588 */, 19 }, /* 7818 */ { MAD_F(0x04bc3a53) /* 0.295954061 */, 19 }, /* 7819 */ { MAD_F(0x04bc6f40) /* 0.296004536 */, 19 }, /* 7820 */ { MAD_F(0x04bca42e) /* 0.296055013 */, 19 }, /* 7821 */ { MAD_F(0x04bcd91d) /* 0.296105493 */, 19 }, /* 7822 */ { MAD_F(0x04bd0e0c) /* 0.296155974 */, 19 }, /* 7823 */ { MAD_F(0x04bd42fb) /* 0.296206458 */, 19 }, /* 7824 */ { MAD_F(0x04bd77ec) /* 0.296256944 */, 19 }, /* 7825 */ { MAD_F(0x04bdacdc) /* 0.296307432 */, 19 }, /* 7826 */ { MAD_F(0x04bde1ce) /* 0.296357922 */, 19 }, /* 7827 */ { MAD_F(0x04be16c0) /* 0.296408414 */, 19 }, /* 7828 */ { MAD_F(0x04be4bb2) /* 0.296458908 */, 19 }, /* 7829 */ { MAD_F(0x04be80a5) /* 0.296509405 */, 19 }, /* 7830 */ { MAD_F(0x04beb599) /* 0.296559904 */, 19 }, /* 7831 */ { MAD_F(0x04beea8d) /* 0.296610404 */, 19 }, /* 7832 */ { MAD_F(0x04bf1f82) /* 0.296660907 */, 19 }, /* 7833 */ { MAD_F(0x04bf5477) /* 0.296711413 */, 19 }, /* 7834 */ { MAD_F(0x04bf896d) /* 0.296761920 */, 19 }, /* 7835 */ { MAD_F(0x04bfbe64) /* 0.296812429 */, 19 }, /* 7836 */ { MAD_F(0x04bff35b) /* 0.296862941 */, 19 }, /* 7837 */ { MAD_F(0x04c02852) /* 0.296913455 */, 19 }, /* 7838 */ { MAD_F(0x04c05d4b) /* 0.296963971 */, 19 }, /* 7839 */ { MAD_F(0x04c09243) /* 0.297014489 */, 19 }, /* 7840 */ { MAD_F(0x04c0c73d) /* 0.297065009 */, 19 }, /* 7841 */ { MAD_F(0x04c0fc37) /* 0.297115531 */, 19 }, /* 7842 */ { MAD_F(0x04c13131) /* 0.297166056 */, 19 }, /* 7843 */ { MAD_F(0x04c1662d) /* 0.297216582 */, 19 }, /* 7844 */ { MAD_F(0x04c19b28) /* 0.297267111 */, 19 }, /* 7845 */ { MAD_F(0x04c1d025) /* 0.297317642 */, 19 }, /* 7846 */ { MAD_F(0x04c20521) /* 0.297368175 */, 19 }, /* 7847 */ { MAD_F(0x04c23a1f) /* 0.297418710 */, 19 }, /* 7848 */ { MAD_F(0x04c26f1d) /* 0.297469248 */, 19 }, /* 7849 */ { MAD_F(0x04c2a41b) /* 0.297519787 */, 19 }, /* 7850 */ { MAD_F(0x04c2d91b) /* 0.297570329 */, 19 }, /* 7851 */ { MAD_F(0x04c30e1a) /* 0.297620873 */, 19 }, /* 7852 */ { MAD_F(0x04c3431b) /* 0.297671418 */, 19 }, /* 7853 */ { MAD_F(0x04c3781c) /* 0.297721967 */, 19 }, /* 7854 */ { MAD_F(0x04c3ad1d) /* 0.297772517 */, 19 }, /* 7855 */ { MAD_F(0x04c3e21f) /* 0.297823069 */, 19 }, /* 7856 */ { MAD_F(0x04c41722) /* 0.297873624 */, 19 }, /* 7857 */ { MAD_F(0x04c44c25) /* 0.297924180 */, 19 }, /* 7858 */ { MAD_F(0x04c48129) /* 0.297974739 */, 19 }, /* 7859 */ { MAD_F(0x04c4b62d) /* 0.298025300 */, 19 }, /* 7860 */ { MAD_F(0x04c4eb32) /* 0.298075863 */, 19 }, /* 7861 */ { MAD_F(0x04c52038) /* 0.298126429 */, 19 }, /* 7862 */ { MAD_F(0x04c5553e) /* 0.298176996 */, 19 }, /* 7863 */ { MAD_F(0x04c58a44) /* 0.298227565 */, 19 }, /* 7864 */ { MAD_F(0x04c5bf4c) /* 0.298278137 */, 19 }, /* 7865 */ { MAD_F(0x04c5f453) /* 0.298328711 */, 19 }, /* 7866 */ { MAD_F(0x04c6295c) /* 0.298379287 */, 19 }, /* 7867 */ { MAD_F(0x04c65e65) /* 0.298429865 */, 19 }, /* 7868 */ { MAD_F(0x04c6936e) /* 0.298480445 */, 19 }, /* 7869 */ { MAD_F(0x04c6c878) /* 0.298531028 */, 19 }, /* 7870 */ { MAD_F(0x04c6fd83) /* 0.298581612 */, 19 }, /* 7871 */ { MAD_F(0x04c7328e) /* 0.298632199 */, 19 }, /* 7872 */ { MAD_F(0x04c7679a) /* 0.298682788 */, 19 }, /* 7873 */ { MAD_F(0x04c79ca7) /* 0.298733379 */, 19 }, /* 7874 */ { MAD_F(0x04c7d1b4) /* 0.298783972 */, 19 }, /* 7875 */ { MAD_F(0x04c806c1) /* 0.298834567 */, 19 }, /* 7876 */ { MAD_F(0x04c83bcf) /* 0.298885165 */, 19 }, /* 7877 */ { MAD_F(0x04c870de) /* 0.298935764 */, 19 }, /* 7878 */ { MAD_F(0x04c8a5ed) /* 0.298986366 */, 19 }, /* 7879 */ { MAD_F(0x04c8dafd) /* 0.299036970 */, 19 }, /* 7880 */ { MAD_F(0x04c9100d) /* 0.299087576 */, 19 }, /* 7881 */ { MAD_F(0x04c9451e) /* 0.299138184 */, 19 }, /* 7882 */ { MAD_F(0x04c97a30) /* 0.299188794 */, 19 }, /* 7883 */ { MAD_F(0x04c9af42) /* 0.299239406 */, 19 }, /* 7884 */ { MAD_F(0x04c9e455) /* 0.299290021 */, 19 }, /* 7885 */ { MAD_F(0x04ca1968) /* 0.299340638 */, 19 }, /* 7886 */ { MAD_F(0x04ca4e7c) /* 0.299391256 */, 19 }, /* 7887 */ { MAD_F(0x04ca8391) /* 0.299441877 */, 19 }, /* 7888 */ { MAD_F(0x04cab8a6) /* 0.299492500 */, 19 }, /* 7889 */ { MAD_F(0x04caedbb) /* 0.299543126 */, 19 }, /* 7890 */ { MAD_F(0x04cb22d1) /* 0.299593753 */, 19 }, /* 7891 */ { MAD_F(0x04cb57e8) /* 0.299644382 */, 19 }, /* 7892 */ { MAD_F(0x04cb8d00) /* 0.299695014 */, 19 }, /* 7893 */ { MAD_F(0x04cbc217) /* 0.299745648 */, 19 }, /* 7894 */ { MAD_F(0x04cbf730) /* 0.299796284 */, 19 }, /* 7895 */ { MAD_F(0x04cc2c49) /* 0.299846922 */, 19 }, /* 7896 */ { MAD_F(0x04cc6163) /* 0.299897562 */, 19 }, /* 7897 */ { MAD_F(0x04cc967d) /* 0.299948204 */, 19 }, /* 7898 */ { MAD_F(0x04cccb98) /* 0.299998849 */, 19 }, /* 7899 */ { MAD_F(0x04cd00b3) /* 0.300049495 */, 19 }, /* 7900 */ { MAD_F(0x04cd35cf) /* 0.300100144 */, 19 }, /* 7901 */ { MAD_F(0x04cd6aeb) /* 0.300150795 */, 19 }, /* 7902 */ { MAD_F(0x04cda008) /* 0.300201448 */, 19 }, /* 7903 */ { MAD_F(0x04cdd526) /* 0.300252103 */, 19 }, /* 7904 */ { MAD_F(0x04ce0a44) /* 0.300302761 */, 19 }, /* 7905 */ { MAD_F(0x04ce3f63) /* 0.300353420 */, 19 }, /* 7906 */ { MAD_F(0x04ce7482) /* 0.300404082 */, 19 }, /* 7907 */ { MAD_F(0x04cea9a2) /* 0.300454745 */, 19 }, /* 7908 */ { MAD_F(0x04cedec3) /* 0.300505411 */, 19 }, /* 7909 */ { MAD_F(0x04cf13e4) /* 0.300556079 */, 19 }, /* 7910 */ { MAD_F(0x04cf4906) /* 0.300606749 */, 19 }, /* 7911 */ { MAD_F(0x04cf7e28) /* 0.300657421 */, 19 }, /* 7912 */ { MAD_F(0x04cfb34b) /* 0.300708096 */, 19 }, /* 7913 */ { MAD_F(0x04cfe86e) /* 0.300758772 */, 19 }, /* 7914 */ { MAD_F(0x04d01d92) /* 0.300809451 */, 19 }, /* 7915 */ { MAD_F(0x04d052b6) /* 0.300860132 */, 19 }, /* 7916 */ { MAD_F(0x04d087db) /* 0.300910815 */, 19 }, /* 7917 */ { MAD_F(0x04d0bd01) /* 0.300961500 */, 19 }, /* 7918 */ { MAD_F(0x04d0f227) /* 0.301012187 */, 19 }, /* 7919 */ { MAD_F(0x04d1274e) /* 0.301062876 */, 19 }, /* 7920 */ { MAD_F(0x04d15c76) /* 0.301113568 */, 19 }, /* 7921 */ { MAD_F(0x04d1919e) /* 0.301164261 */, 19 }, /* 7922 */ { MAD_F(0x04d1c6c6) /* 0.301214957 */, 19 }, /* 7923 */ { MAD_F(0x04d1fbef) /* 0.301265655 */, 19 }, /* 7924 */ { MAD_F(0x04d23119) /* 0.301316355 */, 19 }, /* 7925 */ { MAD_F(0x04d26643) /* 0.301367057 */, 19 }, /* 7926 */ { MAD_F(0x04d29b6e) /* 0.301417761 */, 19 }, /* 7927 */ { MAD_F(0x04d2d099) /* 0.301468468 */, 19 }, /* 7928 */ { MAD_F(0x04d305c5) /* 0.301519176 */, 19 }, /* 7929 */ { MAD_F(0x04d33af2) /* 0.301569887 */, 19 }, /* 7930 */ { MAD_F(0x04d3701f) /* 0.301620599 */, 19 }, /* 7931 */ { MAD_F(0x04d3a54d) /* 0.301671314 */, 19 }, /* 7932 */ { MAD_F(0x04d3da7b) /* 0.301722031 */, 19 }, /* 7933 */ { MAD_F(0x04d40faa) /* 0.301772751 */, 19 }, /* 7934 */ { MAD_F(0x04d444d9) /* 0.301823472 */, 19 }, /* 7935 */ { MAD_F(0x04d47a09) /* 0.301874195 */, 19 }, /* 7936 */ { MAD_F(0x04d4af3a) /* 0.301924921 */, 19 }, /* 7937 */ { MAD_F(0x04d4e46b) /* 0.301975649 */, 19 }, /* 7938 */ { MAD_F(0x04d5199c) /* 0.302026378 */, 19 }, /* 7939 */ { MAD_F(0x04d54ecf) /* 0.302077110 */, 19 }, /* 7940 */ { MAD_F(0x04d58401) /* 0.302127845 */, 19 }, /* 7941 */ { MAD_F(0x04d5b935) /* 0.302178581 */, 19 }, /* 7942 */ { MAD_F(0x04d5ee69) /* 0.302229319 */, 19 }, /* 7943 */ { MAD_F(0x04d6239d) /* 0.302280060 */, 19 }, /* 7944 */ { MAD_F(0x04d658d2) /* 0.302330802 */, 19 }, /* 7945 */ { MAD_F(0x04d68e08) /* 0.302381547 */, 19 }, /* 7946 */ { MAD_F(0x04d6c33e) /* 0.302432294 */, 19 }, /* 7947 */ { MAD_F(0x04d6f875) /* 0.302483043 */, 19 }, /* 7948 */ { MAD_F(0x04d72dad) /* 0.302533794 */, 19 }, /* 7949 */ { MAD_F(0x04d762e5) /* 0.302584547 */, 19 }, /* 7950 */ { MAD_F(0x04d7981d) /* 0.302635303 */, 19 }, /* 7951 */ { MAD_F(0x04d7cd56) /* 0.302686060 */, 19 }, /* 7952 */ { MAD_F(0x04d80290) /* 0.302736820 */, 19 }, /* 7953 */ { MAD_F(0x04d837ca) /* 0.302787581 */, 19 }, /* 7954 */ { MAD_F(0x04d86d05) /* 0.302838345 */, 19 }, /* 7955 */ { MAD_F(0x04d8a240) /* 0.302889111 */, 19 }, /* 7956 */ { MAD_F(0x04d8d77c) /* 0.302939879 */, 19 }, /* 7957 */ { MAD_F(0x04d90cb9) /* 0.302990650 */, 19 }, /* 7958 */ { MAD_F(0x04d941f6) /* 0.303041422 */, 19 }, /* 7959 */ { MAD_F(0x04d97734) /* 0.303092197 */, 19 }, /* 7960 */ { MAD_F(0x04d9ac72) /* 0.303142973 */, 19 }, /* 7961 */ { MAD_F(0x04d9e1b1) /* 0.303193752 */, 19 }, /* 7962 */ { MAD_F(0x04da16f0) /* 0.303244533 */, 19 }, /* 7963 */ { MAD_F(0x04da4c30) /* 0.303295316 */, 19 }, /* 7964 */ { MAD_F(0x04da8171) /* 0.303346101 */, 19 }, /* 7965 */ { MAD_F(0x04dab6b2) /* 0.303396889 */, 19 }, /* 7966 */ { MAD_F(0x04daebf4) /* 0.303447678 */, 19 }, /* 7967 */ { MAD_F(0x04db2136) /* 0.303498469 */, 19 }, /* 7968 */ { MAD_F(0x04db5679) /* 0.303549263 */, 19 }, /* 7969 */ { MAD_F(0x04db8bbc) /* 0.303600059 */, 19 }, /* 7970 */ { MAD_F(0x04dbc100) /* 0.303650857 */, 19 }, /* 7971 */ { MAD_F(0x04dbf644) /* 0.303701657 */, 19 }, /* 7972 */ { MAD_F(0x04dc2b8a) /* 0.303752459 */, 19 }, /* 7973 */ { MAD_F(0x04dc60cf) /* 0.303803263 */, 19 }, /* 7974 */ { MAD_F(0x04dc9616) /* 0.303854070 */, 19 }, /* 7975 */ { MAD_F(0x04dccb5c) /* 0.303904878 */, 19 }, /* 7976 */ { MAD_F(0x04dd00a4) /* 0.303955689 */, 19 }, /* 7977 */ { MAD_F(0x04dd35ec) /* 0.304006502 */, 19 }, /* 7978 */ { MAD_F(0x04dd6b34) /* 0.304057317 */, 19 }, /* 7979 */ { MAD_F(0x04dda07d) /* 0.304108134 */, 19 }, /* 7980 */ { MAD_F(0x04ddd5c7) /* 0.304158953 */, 19 }, /* 7981 */ { MAD_F(0x04de0b11) /* 0.304209774 */, 19 }, /* 7982 */ { MAD_F(0x04de405c) /* 0.304260597 */, 19 }, /* 7983 */ { MAD_F(0x04de75a7) /* 0.304311423 */, 19 }, /* 7984 */ { MAD_F(0x04deaaf3) /* 0.304362251 */, 19 }, /* 7985 */ { MAD_F(0x04dee040) /* 0.304413080 */, 19 }, /* 7986 */ { MAD_F(0x04df158d) /* 0.304463912 */, 19 }, /* 7987 */ { MAD_F(0x04df4adb) /* 0.304514746 */, 19 }, /* 7988 */ { MAD_F(0x04df8029) /* 0.304565582 */, 19 }, /* 7989 */ { MAD_F(0x04dfb578) /* 0.304616421 */, 19 }, /* 7990 */ { MAD_F(0x04dfeac7) /* 0.304667261 */, 19 }, /* 7991 */ { MAD_F(0x04e02017) /* 0.304718103 */, 19 }, /* 7992 */ { MAD_F(0x04e05567) /* 0.304768948 */, 19 }, /* 7993 */ { MAD_F(0x04e08ab8) /* 0.304819795 */, 19 }, /* 7994 */ { MAD_F(0x04e0c00a) /* 0.304870644 */, 19 }, /* 7995 */ { MAD_F(0x04e0f55c) /* 0.304921495 */, 19 }, /* 7996 */ { MAD_F(0x04e12aaf) /* 0.304972348 */, 19 }, /* 7997 */ { MAD_F(0x04e16002) /* 0.305023203 */, 19 }, /* 7998 */ { MAD_F(0x04e19556) /* 0.305074060 */, 19 }, /* 7999 */ { MAD_F(0x04e1caab) /* 0.305124920 */, 19 }, /* 8000 */ { MAD_F(0x04e20000) /* 0.305175781 */, 19 }, /* 8001 */ { MAD_F(0x04e23555) /* 0.305226645 */, 19 }, /* 8002 */ { MAD_F(0x04e26aac) /* 0.305277511 */, 19 }, /* 8003 */ { MAD_F(0x04e2a002) /* 0.305328379 */, 19 }, /* 8004 */ { MAD_F(0x04e2d55a) /* 0.305379249 */, 19 }, /* 8005 */ { MAD_F(0x04e30ab2) /* 0.305430121 */, 19 }, /* 8006 */ { MAD_F(0x04e3400a) /* 0.305480995 */, 19 }, /* 8007 */ { MAD_F(0x04e37563) /* 0.305531872 */, 19 }, /* 8008 */ { MAD_F(0x04e3aabd) /* 0.305582750 */, 19 }, /* 8009 */ { MAD_F(0x04e3e017) /* 0.305633631 */, 19 }, /* 8010 */ { MAD_F(0x04e41572) /* 0.305684513 */, 19 }, /* 8011 */ { MAD_F(0x04e44acd) /* 0.305735398 */, 19 }, /* 8012 */ { MAD_F(0x04e48029) /* 0.305786285 */, 19 }, /* 8013 */ { MAD_F(0x04e4b585) /* 0.305837174 */, 19 }, /* 8014 */ { MAD_F(0x04e4eae2) /* 0.305888066 */, 19 }, /* 8015 */ { MAD_F(0x04e52040) /* 0.305938959 */, 19 }, /* 8016 */ { MAD_F(0x04e5559e) /* 0.305989854 */, 19 }, /* 8017 */ { MAD_F(0x04e58afd) /* 0.306040752 */, 19 }, /* 8018 */ { MAD_F(0x04e5c05c) /* 0.306091652 */, 19 }, /* 8019 */ { MAD_F(0x04e5f5bc) /* 0.306142554 */, 19 }, /* 8020 */ { MAD_F(0x04e62b1c) /* 0.306193457 */, 19 }, /* 8021 */ { MAD_F(0x04e6607d) /* 0.306244364 */, 19 }, /* 8022 */ { MAD_F(0x04e695df) /* 0.306295272 */, 19 }, /* 8023 */ { MAD_F(0x04e6cb41) /* 0.306346182 */, 19 }, /* 8024 */ { MAD_F(0x04e700a3) /* 0.306397094 */, 19 }, /* 8025 */ { MAD_F(0x04e73607) /* 0.306448009 */, 19 }, /* 8026 */ { MAD_F(0x04e76b6b) /* 0.306498925 */, 19 }, /* 8027 */ { MAD_F(0x04e7a0cf) /* 0.306549844 */, 19 }, /* 8028 */ { MAD_F(0x04e7d634) /* 0.306600765 */, 19 }, /* 8029 */ { MAD_F(0x04e80b99) /* 0.306651688 */, 19 }, /* 8030 */ { MAD_F(0x04e84100) /* 0.306702613 */, 19 }, /* 8031 */ { MAD_F(0x04e87666) /* 0.306753540 */, 19 }, /* 8032 */ { MAD_F(0x04e8abcd) /* 0.306804470 */, 19 }, /* 8033 */ { MAD_F(0x04e8e135) /* 0.306855401 */, 19 }, /* 8034 */ { MAD_F(0x04e9169e) /* 0.306906334 */, 19 }, /* 8035 */ { MAD_F(0x04e94c07) /* 0.306957270 */, 19 }, /* 8036 */ { MAD_F(0x04e98170) /* 0.307008208 */, 19 }, /* 8037 */ { MAD_F(0x04e9b6da) /* 0.307059148 */, 19 }, /* 8038 */ { MAD_F(0x04e9ec45) /* 0.307110090 */, 19 }, /* 8039 */ { MAD_F(0x04ea21b0) /* 0.307161034 */, 19 }, /* 8040 */ { MAD_F(0x04ea571c) /* 0.307211980 */, 19 }, /* 8041 */ { MAD_F(0x04ea8c88) /* 0.307262928 */, 19 }, /* 8042 */ { MAD_F(0x04eac1f5) /* 0.307313879 */, 19 }, /* 8043 */ { MAD_F(0x04eaf762) /* 0.307364831 */, 19 }, /* 8044 */ { MAD_F(0x04eb2cd0) /* 0.307415786 */, 19 }, /* 8045 */ { MAD_F(0x04eb623f) /* 0.307466743 */, 19 }, /* 8046 */ { MAD_F(0x04eb97ae) /* 0.307517702 */, 19 }, /* 8047 */ { MAD_F(0x04ebcd1e) /* 0.307568663 */, 19 }, /* 8048 */ { MAD_F(0x04ec028e) /* 0.307619626 */, 19 }, /* 8049 */ { MAD_F(0x04ec37ff) /* 0.307670591 */, 19 }, /* 8050 */ { MAD_F(0x04ec6d71) /* 0.307721558 */, 19 }, /* 8051 */ { MAD_F(0x04eca2e3) /* 0.307772528 */, 19 }, /* 8052 */ { MAD_F(0x04ecd855) /* 0.307823499 */, 19 }, /* 8053 */ { MAD_F(0x04ed0dc8) /* 0.307874473 */, 19 }, /* 8054 */ { MAD_F(0x04ed433c) /* 0.307925449 */, 19 }, /* 8055 */ { MAD_F(0x04ed78b0) /* 0.307976426 */, 19 }, /* 8056 */ { MAD_F(0x04edae25) /* 0.308027406 */, 19 }, /* 8057 */ { MAD_F(0x04ede39a) /* 0.308078389 */, 19 }, /* 8058 */ { MAD_F(0x04ee1910) /* 0.308129373 */, 19 }, /* 8059 */ { MAD_F(0x04ee4e87) /* 0.308180359 */, 19 }, /* 8060 */ { MAD_F(0x04ee83fe) /* 0.308231347 */, 19 }, /* 8061 */ { MAD_F(0x04eeb976) /* 0.308282338 */, 19 }, /* 8062 */ { MAD_F(0x04eeeeee) /* 0.308333331 */, 19 }, /* 8063 */ { MAD_F(0x04ef2467) /* 0.308384325 */, 19 }, /* 8064 */ { MAD_F(0x04ef59e0) /* 0.308435322 */, 19 }, /* 8065 */ { MAD_F(0x04ef8f5a) /* 0.308486321 */, 19 }, /* 8066 */ { MAD_F(0x04efc4d5) /* 0.308537322 */, 19 }, /* 8067 */ { MAD_F(0x04effa50) /* 0.308588325 */, 19 }, /* 8068 */ { MAD_F(0x04f02fcb) /* 0.308639331 */, 19 }, /* 8069 */ { MAD_F(0x04f06547) /* 0.308690338 */, 19 }, /* 8070 */ { MAD_F(0x04f09ac4) /* 0.308741348 */, 19 }, /* 8071 */ { MAD_F(0x04f0d041) /* 0.308792359 */, 19 }, /* 8072 */ { MAD_F(0x04f105bf) /* 0.308843373 */, 19 }, /* 8073 */ { MAD_F(0x04f13b3e) /* 0.308894389 */, 19 }, /* 8074 */ { MAD_F(0x04f170bd) /* 0.308945407 */, 19 }, /* 8075 */ { MAD_F(0x04f1a63c) /* 0.308996427 */, 19 }, /* 8076 */ { MAD_F(0x04f1dbbd) /* 0.309047449 */, 19 }, /* 8077 */ { MAD_F(0x04f2113d) /* 0.309098473 */, 19 }, /* 8078 */ { MAD_F(0x04f246bf) /* 0.309149499 */, 19 }, /* 8079 */ { MAD_F(0x04f27c40) /* 0.309200528 */, 19 }, /* 8080 */ { MAD_F(0x04f2b1c3) /* 0.309251558 */, 19 }, /* 8081 */ { MAD_F(0x04f2e746) /* 0.309302591 */, 19 }, /* 8082 */ { MAD_F(0x04f31cc9) /* 0.309353626 */, 19 }, /* 8083 */ { MAD_F(0x04f3524d) /* 0.309404663 */, 19 }, /* 8084 */ { MAD_F(0x04f387d2) /* 0.309455702 */, 19 }, /* 8085 */ { MAD_F(0x04f3bd57) /* 0.309506743 */, 19 }, /* 8086 */ { MAD_F(0x04f3f2dd) /* 0.309557786 */, 19 }, /* 8087 */ { MAD_F(0x04f42864) /* 0.309608831 */, 19 }, /* 8088 */ { MAD_F(0x04f45dea) /* 0.309659879 */, 19 }, /* 8089 */ { MAD_F(0x04f49372) /* 0.309710928 */, 19 }, /* 8090 */ { MAD_F(0x04f4c8fa) /* 0.309761980 */, 19 }, /* 8091 */ { MAD_F(0x04f4fe83) /* 0.309813033 */, 19 }, /* 8092 */ { MAD_F(0x04f5340c) /* 0.309864089 */, 19 }, /* 8093 */ { MAD_F(0x04f56996) /* 0.309915147 */, 19 }, /* 8094 */ { MAD_F(0x04f59f20) /* 0.309966207 */, 19 }, /* 8095 */ { MAD_F(0x04f5d4ab) /* 0.310017269 */, 19 }, /* 8096 */ { MAD_F(0x04f60a36) /* 0.310068333 */, 19 }, /* 8097 */ { MAD_F(0x04f63fc2) /* 0.310119400 */, 19 }, /* 8098 */ { MAD_F(0x04f6754f) /* 0.310170468 */, 19 }, /* 8099 */ { MAD_F(0x04f6aadc) /* 0.310221539 */, 19 }, /* 8100 */ { MAD_F(0x04f6e06a) /* 0.310272611 */, 19 }, /* 8101 */ { MAD_F(0x04f715f8) /* 0.310323686 */, 19 }, /* 8102 */ { MAD_F(0x04f74b87) /* 0.310374763 */, 19 }, /* 8103 */ { MAD_F(0x04f78116) /* 0.310425842 */, 19 }, /* 8104 */ { MAD_F(0x04f7b6a6) /* 0.310476923 */, 19 }, /* 8105 */ { MAD_F(0x04f7ec37) /* 0.310528006 */, 19 }, /* 8106 */ { MAD_F(0x04f821c8) /* 0.310579091 */, 19 }, /* 8107 */ { MAD_F(0x04f85759) /* 0.310630179 */, 19 }, /* 8108 */ { MAD_F(0x04f88cec) /* 0.310681268 */, 19 }, /* 8109 */ { MAD_F(0x04f8c27e) /* 0.310732360 */, 19 }, /* 8110 */ { MAD_F(0x04f8f812) /* 0.310783453 */, 19 }, /* 8111 */ { MAD_F(0x04f92da6) /* 0.310834549 */, 19 }, /* 8112 */ { MAD_F(0x04f9633a) /* 0.310885647 */, 19 }, /* 8113 */ { MAD_F(0x04f998cf) /* 0.310936747 */, 19 }, /* 8114 */ { MAD_F(0x04f9ce65) /* 0.310987849 */, 19 }, /* 8115 */ { MAD_F(0x04fa03fb) /* 0.311038953 */, 19 }, /* 8116 */ { MAD_F(0x04fa3992) /* 0.311090059 */, 19 }, /* 8117 */ { MAD_F(0x04fa6f29) /* 0.311141168 */, 19 }, /* 8118 */ { MAD_F(0x04faa4c1) /* 0.311192278 */, 19 }, /* 8119 */ { MAD_F(0x04fada59) /* 0.311243390 */, 19 }, /* 8120 */ { MAD_F(0x04fb0ff2) /* 0.311294505 */, 19 }, /* 8121 */ { MAD_F(0x04fb458c) /* 0.311345622 */, 19 }, /* 8122 */ { MAD_F(0x04fb7b26) /* 0.311396741 */, 19 }, /* 8123 */ { MAD_F(0x04fbb0c1) /* 0.311447862 */, 19 }, /* 8124 */ { MAD_F(0x04fbe65c) /* 0.311498985 */, 19 }, /* 8125 */ { MAD_F(0x04fc1bf8) /* 0.311550110 */, 19 }, /* 8126 */ { MAD_F(0x04fc5194) /* 0.311601237 */, 19 }, /* 8127 */ { MAD_F(0x04fc8731) /* 0.311652366 */, 19 }, /* 8128 */ { MAD_F(0x04fcbcce) /* 0.311703498 */, 19 }, /* 8129 */ { MAD_F(0x04fcf26c) /* 0.311754631 */, 19 }, /* 8130 */ { MAD_F(0x04fd280b) /* 0.311805767 */, 19 }, /* 8131 */ { MAD_F(0x04fd5daa) /* 0.311856905 */, 19 }, /* 8132 */ { MAD_F(0x04fd934a) /* 0.311908044 */, 19 }, /* 8133 */ { MAD_F(0x04fdc8ea) /* 0.311959186 */, 19 }, /* 8134 */ { MAD_F(0x04fdfe8b) /* 0.312010330 */, 19 }, /* 8135 */ { MAD_F(0x04fe342c) /* 0.312061476 */, 19 }, /* 8136 */ { MAD_F(0x04fe69ce) /* 0.312112625 */, 19 }, /* 8137 */ { MAD_F(0x04fe9f71) /* 0.312163775 */, 19 }, /* 8138 */ { MAD_F(0x04fed514) /* 0.312214927 */, 19 }, /* 8139 */ { MAD_F(0x04ff0ab8) /* 0.312266082 */, 19 }, /* 8140 */ { MAD_F(0x04ff405c) /* 0.312317238 */, 19 }, /* 8141 */ { MAD_F(0x04ff7601) /* 0.312368397 */, 19 }, /* 8142 */ { MAD_F(0x04ffaba6) /* 0.312419558 */, 19 }, /* 8143 */ { MAD_F(0x04ffe14c) /* 0.312470720 */, 19 }, /* 8144 */ { MAD_F(0x050016f3) /* 0.312521885 */, 19 }, /* 8145 */ { MAD_F(0x05004c9a) /* 0.312573052 */, 19 }, /* 8146 */ { MAD_F(0x05008241) /* 0.312624222 */, 19 }, /* 8147 */ { MAD_F(0x0500b7e9) /* 0.312675393 */, 19 }, /* 8148 */ { MAD_F(0x0500ed92) /* 0.312726566 */, 19 }, /* 8149 */ { MAD_F(0x0501233b) /* 0.312777742 */, 19 }, /* 8150 */ { MAD_F(0x050158e5) /* 0.312828919 */, 19 }, /* 8151 */ { MAD_F(0x05018e90) /* 0.312880099 */, 19 }, /* 8152 */ { MAD_F(0x0501c43b) /* 0.312931280 */, 19 }, /* 8153 */ { MAD_F(0x0501f9e6) /* 0.312982464 */, 19 }, /* 8154 */ { MAD_F(0x05022f92) /* 0.313033650 */, 19 }, /* 8155 */ { MAD_F(0x0502653f) /* 0.313084838 */, 19 }, /* 8156 */ { MAD_F(0x05029aec) /* 0.313136028 */, 19 }, /* 8157 */ { MAD_F(0x0502d09a) /* 0.313187220 */, 19 }, /* 8158 */ { MAD_F(0x05030648) /* 0.313238414 */, 19 }, /* 8159 */ { MAD_F(0x05033bf7) /* 0.313289611 */, 19 }, /* 8160 */ { MAD_F(0x050371a7) /* 0.313340809 */, 19 }, /* 8161 */ { MAD_F(0x0503a757) /* 0.313392010 */, 19 }, /* 8162 */ { MAD_F(0x0503dd07) /* 0.313443212 */, 19 }, /* 8163 */ { MAD_F(0x050412b9) /* 0.313494417 */, 19 }, /* 8164 */ { MAD_F(0x0504486a) /* 0.313545624 */, 19 }, /* 8165 */ { MAD_F(0x05047e1d) /* 0.313596833 */, 19 }, /* 8166 */ { MAD_F(0x0504b3cf) /* 0.313648044 */, 19 }, /* 8167 */ { MAD_F(0x0504e983) /* 0.313699257 */, 19 }, /* 8168 */ { MAD_F(0x05051f37) /* 0.313750472 */, 19 }, /* 8169 */ { MAD_F(0x050554eb) /* 0.313801689 */, 19 }, /* 8170 */ { MAD_F(0x05058aa0) /* 0.313852909 */, 19 }, /* 8171 */ { MAD_F(0x0505c056) /* 0.313904130 */, 19 }, /* 8172 */ { MAD_F(0x0505f60c) /* 0.313955354 */, 19 }, /* 8173 */ { MAD_F(0x05062bc3) /* 0.314006579 */, 19 }, /* 8174 */ { MAD_F(0x0506617a) /* 0.314057807 */, 19 }, /* 8175 */ { MAD_F(0x05069732) /* 0.314109037 */, 19 }, /* 8176 */ { MAD_F(0x0506cceb) /* 0.314160269 */, 19 }, /* 8177 */ { MAD_F(0x050702a4) /* 0.314211502 */, 19 }, /* 8178 */ { MAD_F(0x0507385d) /* 0.314262739 */, 19 }, /* 8179 */ { MAD_F(0x05076e17) /* 0.314313977 */, 19 }, /* 8180 */ { MAD_F(0x0507a3d2) /* 0.314365217 */, 19 }, /* 8181 */ { MAD_F(0x0507d98d) /* 0.314416459 */, 19 }, /* 8182 */ { MAD_F(0x05080f49) /* 0.314467704 */, 19 }, /* 8183 */ { MAD_F(0x05084506) /* 0.314518950 */, 19 }, /* 8184 */ { MAD_F(0x05087ac2) /* 0.314570199 */, 19 }, /* 8185 */ { MAD_F(0x0508b080) /* 0.314621449 */, 19 }, /* 8186 */ { MAD_F(0x0508e63e) /* 0.314672702 */, 19 }, /* 8187 */ { MAD_F(0x05091bfd) /* 0.314723957 */, 19 }, /* 8188 */ { MAD_F(0x050951bc) /* 0.314775214 */, 19 }, /* 8189 */ { MAD_F(0x0509877c) /* 0.314826473 */, 19 }, /* 8190 */ { MAD_F(0x0509bd3c) /* 0.314877734 */, 19 }, /* 8191 */ { MAD_F(0x0509f2fd) /* 0.314928997 */, 19 }, /* 8192 */ { MAD_F(0x050a28be) /* 0.314980262 */, 19 }, /* 8193 */ { MAD_F(0x050a5e80) /* 0.315031530 */, 19 }, /* 8194 */ { MAD_F(0x050a9443) /* 0.315082799 */, 19 }, /* 8195 */ { MAD_F(0x050aca06) /* 0.315134071 */, 19 }, /* 8196 */ { MAD_F(0x050affc9) /* 0.315185344 */, 19 }, /* 8197 */ { MAD_F(0x050b358e) /* 0.315236620 */, 19 }, /* 8198 */ { MAD_F(0x050b6b52) /* 0.315287898 */, 19 }, /* 8199 */ { MAD_F(0x050ba118) /* 0.315339178 */, 19 }, /* 8200 */ { MAD_F(0x050bd6de) /* 0.315390460 */, 19 }, /* 8201 */ { MAD_F(0x050c0ca4) /* 0.315441744 */, 19 }, /* 8202 */ { MAD_F(0x050c426b) /* 0.315493030 */, 19 }, /* 8203 */ { MAD_F(0x050c7833) /* 0.315544318 */, 19 }, /* 8204 */ { MAD_F(0x050cadfb) /* 0.315595608 */, 19 }, /* 8205 */ { MAD_F(0x050ce3c4) /* 0.315646901 */, 19 }, /* 8206 */ { MAD_F(0x050d198d) /* 0.315698195 */, 19 } avifile-0.7.48~20090503.ds/plugins/libmad/libmad/sf_table.dat0000644000175000017500000001464210403657206022365 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: sf_table.dat,v 1.2 2006/03/08 22:45:26 kabi Exp $ */ /* * These are the scalefactor values for Layer I and Layer II. * The values are from Table B.1 of ISO/IEC 11172-3. * * There is some error introduced by the 32-bit fixed-point representation; * the amount of error is shown. For 16-bit PCM output, this shouldn't be * too much of a problem. * * Strictly speaking, Table B.1 has only 63 entries (0-62), thus a strict * interpretation of ISO/IEC 11172-3 would suggest that a scalefactor index of * 63 is invalid. However, for better compatibility with current practices, we * add a 64th entry. */ MAD_F(0x20000000), /* 2.000000000000 => 2.000000000000, e 0.000000000000 */ MAD_F(0x1965fea5), /* 1.587401051968 => 1.587401051074, e 0.000000000894 */ MAD_F(0x1428a2fa), /* 1.259921049895 => 1.259921051562, e -0.000000001667 */ MAD_F(0x10000000), /* 1.000000000000 => 1.000000000000, e 0.000000000000 */ MAD_F(0x0cb2ff53), /* 0.793700525984 => 0.793700527400, e -0.000000001416 */ MAD_F(0x0a14517d), /* 0.629960524947 => 0.629960525781, e -0.000000000833 */ MAD_F(0x08000000), /* 0.500000000000 => 0.500000000000, e 0.000000000000 */ MAD_F(0x06597fa9), /* 0.396850262992 => 0.396850261837, e 0.000000001155 */ MAD_F(0x050a28be), /* 0.314980262474 => 0.314980261028, e 0.000000001446 */ MAD_F(0x04000000), /* 0.250000000000 => 0.250000000000, e 0.000000000000 */ MAD_F(0x032cbfd5), /* 0.198425131496 => 0.198425132781, e -0.000000001285 */ MAD_F(0x0285145f), /* 0.157490131237 => 0.157490130514, e 0.000000000723 */ MAD_F(0x02000000), /* 0.125000000000 => 0.125000000000, e 0.000000000000 */ MAD_F(0x01965fea), /* 0.099212565748 => 0.099212564528, e 0.000000001220 */ MAD_F(0x01428a30), /* 0.078745065618 => 0.078745067120, e -0.000000001501 */ MAD_F(0x01000000), /* 0.062500000000 => 0.062500000000, e 0.000000000000 */ MAD_F(0x00cb2ff5), /* 0.049606282874 => 0.049606282264, e 0.000000000610 */ MAD_F(0x00a14518), /* 0.039372532809 => 0.039372533560, e -0.000000000751 */ MAD_F(0x00800000), /* 0.031250000000 => 0.031250000000, e 0.000000000000 */ MAD_F(0x006597fb), /* 0.024803141437 => 0.024803142995, e -0.000000001558 */ MAD_F(0x0050a28c), /* 0.019686266405 => 0.019686266780, e -0.000000000375 */ MAD_F(0x00400000), /* 0.015625000000 => 0.015625000000, e 0.000000000000 */ MAD_F(0x0032cbfd), /* 0.012401570719 => 0.012401569635, e 0.000000001084 */ MAD_F(0x00285146), /* 0.009843133202 => 0.009843133390, e -0.000000000188 */ MAD_F(0x00200000), /* 0.007812500000 => 0.007812500000, e 0.000000000000 */ MAD_F(0x001965ff), /* 0.006200785359 => 0.006200786680, e -0.000000001321 */ MAD_F(0x001428a3), /* 0.004921566601 => 0.004921566695, e -0.000000000094 */ MAD_F(0x00100000), /* 0.003906250000 => 0.003906250000, e 0.000000000000 */ MAD_F(0x000cb2ff), /* 0.003100392680 => 0.003100391477, e 0.000000001202 */ MAD_F(0x000a1451), /* 0.002460783301 => 0.002460781485, e 0.000000001816 */ MAD_F(0x00080000), /* 0.001953125000 => 0.001953125000, e 0.000000000000 */ MAD_F(0x00065980), /* 0.001550196340 => 0.001550197601, e -0.000000001262 */ MAD_F(0x00050a29), /* 0.001230391650 => 0.001230392605, e -0.000000000955 */ MAD_F(0x00040000), /* 0.000976562500 => 0.000976562500, e 0.000000000000 */ MAD_F(0x00032cc0), /* 0.000775098170 => 0.000775098801, e -0.000000000631 */ MAD_F(0x00028514), /* 0.000615195825 => 0.000615194440, e 0.000000001385 */ MAD_F(0x00020000), /* 0.000488281250 => 0.000488281250, e 0.000000000000 */ MAD_F(0x00019660), /* 0.000387549085 => 0.000387549400, e -0.000000000315 */ MAD_F(0x0001428a), /* 0.000307597913 => 0.000307597220, e 0.000000000693 */ MAD_F(0x00010000), /* 0.000244140625 => 0.000244140625, e 0.000000000000 */ MAD_F(0x0000cb30), /* 0.000193774542 => 0.000193774700, e -0.000000000158 */ MAD_F(0x0000a145), /* 0.000153798956 => 0.000153798610, e 0.000000000346 */ MAD_F(0x00008000), /* 0.000122070313 => 0.000122070313, e 0.000000000000 */ MAD_F(0x00006598), /* 0.000096887271 => 0.000096887350, e -0.000000000079 */ MAD_F(0x000050a3), /* 0.000076899478 => 0.000076901168, e -0.000000001689 */ MAD_F(0x00004000), /* 0.000061035156 => 0.000061035156, e 0.000000000000 */ MAD_F(0x000032cc), /* 0.000048443636 => 0.000048443675, e -0.000000000039 */ MAD_F(0x00002851), /* 0.000038449739 => 0.000038448721, e 0.000000001018 */ MAD_F(0x00002000), /* 0.000030517578 => 0.000030517578, e 0.000000000000 */ MAD_F(0x00001966), /* 0.000024221818 => 0.000024221838, e -0.000000000020 */ MAD_F(0x00001429), /* 0.000019224870 => 0.000019226223, e -0.000000001354 */ MAD_F(0x00001000), /* 0.000015258789 => 0.000015258789, e -0.000000000000 */ MAD_F(0x00000cb3), /* 0.000012110909 => 0.000012110919, e -0.000000000010 */ MAD_F(0x00000a14), /* 0.000009612435 => 0.000009611249, e 0.000000001186 */ MAD_F(0x00000800), /* 0.000007629395 => 0.000007629395, e -0.000000000000 */ MAD_F(0x00000659), /* 0.000006055454 => 0.000006053597, e 0.000000001858 */ MAD_F(0x0000050a), /* 0.000004806217 => 0.000004805624, e 0.000000000593 */ MAD_F(0x00000400), /* 0.000003814697 => 0.000003814697, e 0.000000000000 */ MAD_F(0x0000032d), /* 0.000003027727 => 0.000003028661, e -0.000000000934 */ MAD_F(0x00000285), /* 0.000002403109 => 0.000002402812, e 0.000000000296 */ MAD_F(0x00000200), /* 0.000001907349 => 0.000001907349, e -0.000000000000 */ MAD_F(0x00000196), /* 0.000001513864 => 0.000001512468, e 0.000000001396 */ MAD_F(0x00000143), /* 0.000001201554 => 0.000001203269, e -0.000000001714 */ MAD_F(0x00000000) /* this compatibility entry is not part of Table B.1 */ avifile-0.7.48~20090503.ds/plugins/libmad/libmad/stream.c0000644000175000017500000001057310403657206021552 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: stream.c,v 1.3 2006/03/08 22:45:26 kabi Exp $ */ # ifdef HAVE_CONFIG_H # include "config.h" # endif # include "global.h" # include # include "bit.h" # include "stream.h" /* * NAME: stream->init() * DESCRIPTION: initialize stream struct */ void mad_stream_init(struct mad_stream *stream) { stream->buffer = 0; stream->bufend = 0; stream->skiplen = 0; stream->sync = 0; stream->freerate = 0; stream->this_frame = 0; stream->next_frame = 0; mad_bit_init(&stream->ptr, 0); mad_bit_init(&stream->anc_ptr, 0); stream->anc_bitlen = 0; stream->main_data = 0; stream->md_len = 0; stream->options = 0; stream->error = MAD_ERROR_NONE; } /* * NAME: stream->finish() * DESCRIPTION: deallocate any dynamic memory associated with stream */ void mad_stream_finish(struct mad_stream *stream) { if (stream->main_data) { free(stream->main_data); stream->main_data = 0; } mad_bit_finish(&stream->anc_ptr); mad_bit_finish(&stream->ptr); } /* * NAME: stream->buffer() * DESCRIPTION: set stream buffer pointers */ void mad_stream_buffer(struct mad_stream *stream, unsigned char const *buffer, unsigned long length) { stream->buffer = buffer; stream->bufend = buffer + length; stream->this_frame = buffer; stream->next_frame = buffer; stream->sync = 1; mad_bit_init(&stream->ptr, buffer); } /* * NAME: stream->skip() * DESCRIPTION: arrange to skip bytes before the next frame */ void mad_stream_skip(struct mad_stream *stream, unsigned long length) { stream->skiplen += length; } /* * NAME: stream->sync() * DESCRIPTION: locate the next stream sync word */ int mad_stream_sync(struct mad_stream *stream) { register unsigned char const *ptr, *end; ptr = mad_bit_nextbyte(&stream->ptr); end = stream->bufend; while (ptr < end - 1 && !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) ++ptr; if (end - ptr < MAD_BUFFER_GUARD) return -1; mad_bit_init(&stream->ptr, ptr); return 0; } /* * NAME: stream->errorstr() * DESCRIPTION: return a string description of the current error condition */ char const *mad_stream_errorstr(struct mad_stream const *stream) { switch (stream->error) { case MAD_ERROR_NONE: return "no error"; case MAD_ERROR_BUFLEN: return "input buffer too small (or EOF)"; case MAD_ERROR_BUFPTR: return "invalid (null) buffer pointer"; case MAD_ERROR_NOMEM: return "not enough memory"; case MAD_ERROR_LOSTSYNC: return "lost synchronization"; case MAD_ERROR_BADLAYER: return "reserved header layer value"; case MAD_ERROR_BADBITRATE: return "forbidden bitrate value"; case MAD_ERROR_BADSAMPLERATE: return "reserved sample frequency value"; case MAD_ERROR_BADEMPHASIS: return "reserved emphasis value"; case MAD_ERROR_BADCRC: return "CRC check failed"; case MAD_ERROR_BADBITALLOC: return "forbidden bit allocation value"; case MAD_ERROR_BADSCALEFACTOR: return "bad scalefactor index"; case MAD_ERROR_BADMODE: return "bad bitrate/mode combination"; case MAD_ERROR_BADFRAMELEN: return "bad frame length"; case MAD_ERROR_BADBIGVALUES: return "bad big_values count"; case MAD_ERROR_BADBLOCKTYPE: return "reserved block_type"; case MAD_ERROR_BADSCFSI: return "bad scalefactor selection info"; case MAD_ERROR_BADDATAPTR: return "bad main_data_begin pointer"; case MAD_ERROR_BADPART3LEN: return "bad audio data length"; case MAD_ERROR_BADHUFFTABLE: return "bad Huffman table select"; case MAD_ERROR_BADHUFFDATA: return "Huffman data overrun"; case MAD_ERROR_BADSTEREO: return "incompatible block_type for JS"; } return 0; } avifile-0.7.48~20090503.ds/plugins/libmad/libmad/stream.h0000644000175000017500000001017310403657206021553 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: stream.h,v 1.3 2006/03/08 22:45:26 kabi Exp $ */ # ifndef LIBMAD_STREAM_H # define LIBMAD_STREAM_H # include "bit.h" # define MAD_BUFFER_GUARD 8 # define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD) enum mad_error { MAD_ERROR_NONE = 0x0000, /* no error */ MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */ MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */ MAD_ERROR_NOMEM = 0x0031, /* not enough memory */ MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */ MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */ MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */ MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */ MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */ MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */ MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */ MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */ MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */ MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */ MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */ MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */ MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */ MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */ MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */ MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */ MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */ MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */ }; # define MAD_RECOVERABLE(error) ((error) & 0xff00) struct mad_stream { unsigned char const *buffer; /* input bitstream buffer */ unsigned char const *bufend; /* end of buffer */ unsigned long skiplen; /* bytes to skip before next frame */ int sync; /* stream sync found */ unsigned long freerate; /* free bitrate (fixed) */ unsigned char const *this_frame; /* start of current frame */ unsigned char const *next_frame; /* start of next frame */ struct mad_bitptr ptr; /* current processing bit pointer */ struct mad_bitptr anc_ptr; /* ancillary bits pointer */ unsigned int anc_bitlen; /* number of ancillary bits */ unsigned char (*main_data)[MAD_BUFFER_MDLEN]; /* Layer III main_data() */ unsigned int md_len; /* bytes in main_data */ int options; /* decoding options (see below) */ enum mad_error error; /* error code (see above) */ }; enum { MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */ MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */ # if 0 /* not yet implemented */ MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */ MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */ MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */ # endif }; void mad_stream_init(struct mad_stream *); void mad_stream_finish(struct mad_stream *); # define mad_stream_options(stream, opts) \ ((void) ((stream)->options = (opts))) void mad_stream_buffer(struct mad_stream *, unsigned char const *, unsigned long); void mad_stream_skip(struct mad_stream *, unsigned long); int mad_stream_sync(struct mad_stream *); char const *mad_stream_errorstr(struct mad_stream const *); # endif avifile-0.7.48~20090503.ds/plugins/libmad/libmad/synth.c0000644000175000017500000005745610403657206021437 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: synth.c,v 1.2 2006/03/08 22:45:26 kabi Exp $ */ # ifdef HAVE_CONFIG_H # include "config.h" # endif # include "global.h" # include "fixed.h" # include "frame.h" # include "synth.h" /* * NAME: synth->init() * DESCRIPTION: initialize synth struct */ void mad_synth_init(struct mad_synth *synth) { mad_synth_mute(synth); synth->phase = 0; synth->pcm.samplerate = 0; synth->pcm.channels = 0; synth->pcm.length = 0; } /* * NAME: synth->mute() * DESCRIPTION: zero all polyphase filterbank values, resetting synthesis */ void mad_synth_mute(struct mad_synth *synth) { unsigned int ch, s, v; for (ch = 0; ch < 2; ++ch) { for (s = 0; s < 16; ++s) { for (v = 0; v < 8; ++v) { synth->filter[ch][0][0][s][v] = synth->filter[ch][0][1][s][v] = synth->filter[ch][1][0][s][v] = synth->filter[ch][1][1][s][v] = 0; } } } } /* * An optional optimization called here the Subband Synthesis Optimization * (SSO) improves the performance of subband synthesis at the expense of * accuracy. * * The idea is to simplify 32x32->64-bit multiplication to 32x32->32 such * that extra scaling and rounding are not necessary. This often allows the * compiler to use faster 32-bit multiply-accumulate instructions instead of * explicit 64-bit multiply, shift, and add instructions. * * SSO works like this: a full 32x32->64-bit multiply of two mad_fixed_t * values requires the result to be right-shifted 28 bits to be properly * scaled to the same fixed-point format. Right shifts can be applied at any * time to either operand or to the result, so the optimization involves * careful placement of these shifts to minimize the loss of accuracy. * * First, a 14-bit shift is applied with rounding at compile-time to the D[] * table of coefficients for the subband synthesis window. This only loses 2 * bits of accuracy because the lower 12 bits are always zero. A second * 12-bit shift occurs after the DCT calculation. This loses 12 bits of * accuracy. Finally, a third 2-bit shift occurs just before the sample is * saved in the PCM buffer. 14 + 12 + 2 == 28 bits. */ /* FPM_DEFAULT without OPT_SSO will actually lose accuracy and performance */ # if defined(FPM_DEFAULT) && !defined(OPT_SSO) # define OPT_SSO # endif /* second SSO shift, with rounding */ # if defined(OPT_SSO) # define SHIFT(x) (((x) + (1L << 11)) >> 12) # else # define SHIFT(x) (x) # endif /* possible DCT speed optimization */ # if defined(OPT_SPEED) && defined(MAD_F_MLX) # define OPT_DCTO # define MUL(x, y) \ ({ mad_fixed64hi_t hi; \ mad_fixed64lo_t lo; \ MAD_F_MLX(hi, lo, (x), (y)); \ hi << (32 - MAD_F_SCALEBITS - 3); \ }) # else # undef OPT_DCTO # define MUL(x, y) mad_f_mul((x), (y)) # endif /* * NAME: dct32() * DESCRIPTION: perform fast in[32]->out[32] DCT */ static void dct32(mad_fixed_t const in[32], unsigned int slot, mad_fixed_t lo[16][8], mad_fixed_t hi[16][8]) { mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7; mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15; mad_fixed_t t16, t17, t18, t19, t20, t21, t22, t23; mad_fixed_t t24, t25, t26, t27, t28, t29, t30, t31; mad_fixed_t t32, t33, t34, t35, t36, t37, t38, t39; mad_fixed_t t40, t41, t42, t43, t44, t45, t46, t47; mad_fixed_t t48, t49, t50, t51, t52, t53, t54, t55; mad_fixed_t t56, t57, t58, t59, t60, t61, t62, t63; mad_fixed_t t64, t65, t66, t67, t68, t69, t70, t71; mad_fixed_t t72, t73, t74, t75, t76, t77, t78, t79; mad_fixed_t t80, t81, t82, t83, t84, t85, t86, t87; mad_fixed_t t88, t89, t90, t91, t92, t93, t94, t95; mad_fixed_t t96, t97, t98, t99, t100, t101, t102, t103; mad_fixed_t t104, t105, t106, t107, t108, t109, t110, t111; mad_fixed_t t112, t113, t114, t115, t116, t117, t118, t119; mad_fixed_t t120, t121, t122, t123, t124, t125, t126, t127; mad_fixed_t t128, t129, t130, t131, t132, t133, t134, t135; mad_fixed_t t136, t137, t138, t139, t140, t141, t142, t143; mad_fixed_t t144, t145, t146, t147, t148, t149, t150, t151; mad_fixed_t t152, t153, t154, t155, t156, t157, t158, t159; mad_fixed_t t160, t161, t162, t163, t164, t165, t166, t167; mad_fixed_t t168, t169, t170, t171, t172, t173, t174, t175; mad_fixed_t t176; /* costab[i] = cos(PI / (2 * 32) * i) */ # if defined(OPT_DCTO) # define costab1 MAD_F(0x7fd8878e) # define costab2 MAD_F(0x7f62368f) # define costab3 MAD_F(0x7e9d55fc) # define costab4 MAD_F(0x7d8a5f40) # define costab5 MAD_F(0x7c29fbee) # define costab6 MAD_F(0x7a7d055b) # define costab7 MAD_F(0x78848414) # define costab8 MAD_F(0x7641af3d) # define costab9 MAD_F(0x73b5ebd1) # define costab10 MAD_F(0x70e2cbc6) # define costab11 MAD_F(0x6dca0d14) # define costab12 MAD_F(0x6a6d98a4) # define costab13 MAD_F(0x66cf8120) # define costab14 MAD_F(0x62f201ac) # define costab15 MAD_F(0x5ed77c8a) # define costab16 MAD_F(0x5a82799a) # define costab17 MAD_F(0x55f5a4d2) # define costab18 MAD_F(0x5133cc94) # define costab19 MAD_F(0x4c3fdff4) # define costab20 MAD_F(0x471cece7) # define costab21 MAD_F(0x41ce1e65) # define costab22 MAD_F(0x3c56ba70) # define costab23 MAD_F(0x36ba2014) # define costab24 MAD_F(0x30fbc54d) # define costab25 MAD_F(0x2b1f34eb) # define costab26 MAD_F(0x25280c5e) # define costab27 MAD_F(0x1f19f97b) # define costab28 MAD_F(0x18f8b83c) # define costab29 MAD_F(0x12c8106f) # define costab30 MAD_F(0x0c8bd35e) # define costab31 MAD_F(0x0647d97c) # else # define costab1 MAD_F(0x0ffb10f2) /* 0.998795456 */ # define costab2 MAD_F(0x0fec46d2) /* 0.995184727 */ # define costab3 MAD_F(0x0fd3aac0) /* 0.989176510 */ # define costab4 MAD_F(0x0fb14be8) /* 0.980785280 */ # define costab5 MAD_F(0x0f853f7e) /* 0.970031253 */ # define costab6 MAD_F(0x0f4fa0ab) /* 0.956940336 */ # define costab7 MAD_F(0x0f109082) /* 0.941544065 */ # define costab8 MAD_F(0x0ec835e8) /* 0.923879533 */ # define costab9 MAD_F(0x0e76bd7a) /* 0.903989293 */ # define costab10 MAD_F(0x0e1c5979) /* 0.881921264 */ # define costab11 MAD_F(0x0db941a3) /* 0.857728610 */ # define costab12 MAD_F(0x0d4db315) /* 0.831469612 */ # define costab13 MAD_F(0x0cd9f024) /* 0.803207531 */ # define costab14 MAD_F(0x0c5e4036) /* 0.773010453 */ # define costab15 MAD_F(0x0bdaef91) /* 0.740951125 */ # define costab16 MAD_F(0x0b504f33) /* 0.707106781 */ # define costab17 MAD_F(0x0abeb49a) /* 0.671558955 */ # define costab18 MAD_F(0x0a267993) /* 0.634393284 */ # define costab19 MAD_F(0x0987fbfe) /* 0.595699304 */ # define costab20 MAD_F(0x08e39d9d) /* 0.555570233 */ # define costab21 MAD_F(0x0839c3cd) /* 0.514102744 */ # define costab22 MAD_F(0x078ad74e) /* 0.471396737 */ # define costab23 MAD_F(0x06d74402) /* 0.427555093 */ # define costab24 MAD_F(0x061f78aa) /* 0.382683432 */ # define costab25 MAD_F(0x0563e69d) /* 0.336889853 */ # define costab26 MAD_F(0x04a5018c) /* 0.290284677 */ # define costab27 MAD_F(0x03e33f2f) /* 0.242980180 */ # define costab28 MAD_F(0x031f1708) /* 0.195090322 */ # define costab29 MAD_F(0x0259020e) /* 0.146730474 */ # define costab30 MAD_F(0x01917a6c) /* 0.098017140 */ # define costab31 MAD_F(0x00c8fb30) /* 0.049067674 */ # endif t0 = in[0] + in[31]; t16 = MUL(in[0] - in[31], costab1); t1 = in[15] + in[16]; t17 = MUL(in[15] - in[16], costab31); t41 = t16 + t17; t59 = MUL(t16 - t17, costab2); t33 = t0 + t1; t50 = MUL(t0 - t1, costab2); t2 = in[7] + in[24]; t18 = MUL(in[7] - in[24], costab15); t3 = in[8] + in[23]; t19 = MUL(in[8] - in[23], costab17); t42 = t18 + t19; t60 = MUL(t18 - t19, costab30); t34 = t2 + t3; t51 = MUL(t2 - t3, costab30); t4 = in[3] + in[28]; t20 = MUL(in[3] - in[28], costab7); t5 = in[12] + in[19]; t21 = MUL(in[12] - in[19], costab25); t43 = t20 + t21; t61 = MUL(t20 - t21, costab14); t35 = t4 + t5; t52 = MUL(t4 - t5, costab14); t6 = in[4] + in[27]; t22 = MUL(in[4] - in[27], costab9); t7 = in[11] + in[20]; t23 = MUL(in[11] - in[20], costab23); t44 = t22 + t23; t62 = MUL(t22 - t23, costab18); t36 = t6 + t7; t53 = MUL(t6 - t7, costab18); t8 = in[1] + in[30]; t24 = MUL(in[1] - in[30], costab3); t9 = in[14] + in[17]; t25 = MUL(in[14] - in[17], costab29); t45 = t24 + t25; t63 = MUL(t24 - t25, costab6); t37 = t8 + t9; t54 = MUL(t8 - t9, costab6); t10 = in[6] + in[25]; t26 = MUL(in[6] - in[25], costab13); t11 = in[9] + in[22]; t27 = MUL(in[9] - in[22], costab19); t46 = t26 + t27; t64 = MUL(t26 - t27, costab26); t38 = t10 + t11; t55 = MUL(t10 - t11, costab26); t12 = in[2] + in[29]; t28 = MUL(in[2] - in[29], costab5); t13 = in[13] + in[18]; t29 = MUL(in[13] - in[18], costab27); t47 = t28 + t29; t65 = MUL(t28 - t29, costab10); t39 = t12 + t13; t56 = MUL(t12 - t13, costab10); t14 = in[5] + in[26]; t30 = MUL(in[5] - in[26], costab11); t15 = in[10] + in[21]; t31 = MUL(in[10] - in[21], costab21); t48 = t30 + t31; t66 = MUL(t30 - t31, costab22); t40 = t14 + t15; t57 = MUL(t14 - t15, costab22); t69 = t33 + t34; t89 = MUL(t33 - t34, costab4); t70 = t35 + t36; t90 = MUL(t35 - t36, costab28); t71 = t37 + t38; t91 = MUL(t37 - t38, costab12); t72 = t39 + t40; t92 = MUL(t39 - t40, costab20); t73 = t41 + t42; t94 = MUL(t41 - t42, costab4); t74 = t43 + t44; t95 = MUL(t43 - t44, costab28); t75 = t45 + t46; t96 = MUL(t45 - t46, costab12); t76 = t47 + t48; t97 = MUL(t47 - t48, costab20); t78 = t50 + t51; t100 = MUL(t50 - t51, costab4); t79 = t52 + t53; t101 = MUL(t52 - t53, costab28); t80 = t54 + t55; t102 = MUL(t54 - t55, costab12); t81 = t56 + t57; t103 = MUL(t56 - t57, costab20); t83 = t59 + t60; t106 = MUL(t59 - t60, costab4); t84 = t61 + t62; t107 = MUL(t61 - t62, costab28); t85 = t63 + t64; t108 = MUL(t63 - t64, costab12); t86 = t65 + t66; t109 = MUL(t65 - t66, costab20); t113 = t69 + t70; t114 = t71 + t72; /* 0 */ hi[15][slot] = SHIFT(t113 + t114); /* 16 */ lo[ 0][slot] = SHIFT(MUL(t113 - t114, costab16)); t115 = t73 + t74; t116 = t75 + t76; t32 = t115 + t116; /* 1 */ hi[14][slot] = SHIFT(t32); t118 = t78 + t79; t119 = t80 + t81; t58 = t118 + t119; /* 2 */ hi[13][slot] = SHIFT(t58); t121 = t83 + t84; t122 = t85 + t86; t67 = t121 + t122; t49 = (t67 * 2) - t32; /* 3 */ hi[12][slot] = SHIFT(t49); t125 = t89 + t90; t126 = t91 + t92; t93 = t125 + t126; /* 4 */ hi[11][slot] = SHIFT(t93); t128 = t94 + t95; t129 = t96 + t97; t98 = t128 + t129; t68 = (t98 * 2) - t49; /* 5 */ hi[10][slot] = SHIFT(t68); t132 = t100 + t101; t133 = t102 + t103; t104 = t132 + t133; t82 = (t104 * 2) - t58; /* 6 */ hi[ 9][slot] = SHIFT(t82); t136 = t106 + t107; t137 = t108 + t109; t110 = t136 + t137; t87 = (t110 * 2) - t67; t77 = (t87 * 2) - t68; /* 7 */ hi[ 8][slot] = SHIFT(t77); t141 = MUL(t69 - t70, costab8); t142 = MUL(t71 - t72, costab24); t143 = t141 + t142; /* 8 */ hi[ 7][slot] = SHIFT(t143); /* 24 */ lo[ 8][slot] = SHIFT((MUL(t141 - t142, costab16) * 2) - t143); t144 = MUL(t73 - t74, costab8); t145 = MUL(t75 - t76, costab24); t146 = t144 + t145; t88 = (t146 * 2) - t77; /* 9 */ hi[ 6][slot] = SHIFT(t88); t148 = MUL(t78 - t79, costab8); t149 = MUL(t80 - t81, costab24); t150 = t148 + t149; t105 = (t150 * 2) - t82; /* 10 */ hi[ 5][slot] = SHIFT(t105); t152 = MUL(t83 - t84, costab8); t153 = MUL(t85 - t86, costab24); t154 = t152 + t153; t111 = (t154 * 2) - t87; t99 = (t111 * 2) - t88; /* 11 */ hi[ 4][slot] = SHIFT(t99); t157 = MUL(t89 - t90, costab8); t158 = MUL(t91 - t92, costab24); t159 = t157 + t158; t127 = (t159 * 2) - t93; /* 12 */ hi[ 3][slot] = SHIFT(t127); t160 = (MUL(t125 - t126, costab16) * 2) - t127; /* 20 */ lo[ 4][slot] = SHIFT(t160); /* 28 */ lo[12][slot] = SHIFT((((MUL(t157 - t158, costab16) * 2) - t159) * 2) - t160); t161 = MUL(t94 - t95, costab8); t162 = MUL(t96 - t97, costab24); t163 = t161 + t162; t130 = (t163 * 2) - t98; t112 = (t130 * 2) - t99; /* 13 */ hi[ 2][slot] = SHIFT(t112); t164 = (MUL(t128 - t129, costab16) * 2) - t130; t166 = MUL(t100 - t101, costab8); t167 = MUL(t102 - t103, costab24); t168 = t166 + t167; t134 = (t168 * 2) - t104; t120 = (t134 * 2) - t105; /* 14 */ hi[ 1][slot] = SHIFT(t120); t135 = (MUL(t118 - t119, costab16) * 2) - t120; /* 18 */ lo[ 2][slot] = SHIFT(t135); t169 = (MUL(t132 - t133, costab16) * 2) - t134; t151 = (t169 * 2) - t135; /* 22 */ lo[ 6][slot] = SHIFT(t151); t170 = (((MUL(t148 - t149, costab16) * 2) - t150) * 2) - t151; /* 26 */ lo[10][slot] = SHIFT(t170); /* 30 */ lo[14][slot] = SHIFT((((((MUL(t166 - t167, costab16) * 2) - t168) * 2) - t169) * 2) - t170); t171 = MUL(t106 - t107, costab8); t172 = MUL(t108 - t109, costab24); t173 = t171 + t172; t138 = (t173 * 2) - t110; t123 = (t138 * 2) - t111; t139 = (MUL(t121 - t122, costab16) * 2) - t123; t117 = (t123 * 2) - t112; /* 15 */ hi[ 0][slot] = SHIFT(t117); t124 = (MUL(t115 - t116, costab16) * 2) - t117; /* 17 */ lo[ 1][slot] = SHIFT(t124); t131 = (t139 * 2) - t124; /* 19 */ lo[ 3][slot] = SHIFT(t131); t140 = (t164 * 2) - t131; /* 21 */ lo[ 5][slot] = SHIFT(t140); t174 = (MUL(t136 - t137, costab16) * 2) - t138; t155 = (t174 * 2) - t139; t147 = (t155 * 2) - t140; /* 23 */ lo[ 7][slot] = SHIFT(t147); t156 = (((MUL(t144 - t145, costab16) * 2) - t146) * 2) - t147; /* 25 */ lo[ 9][slot] = SHIFT(t156); t175 = (((MUL(t152 - t153, costab16) * 2) - t154) * 2) - t155; t165 = (t175 * 2) - t156; /* 27 */ lo[11][slot] = SHIFT(t165); t176 = (((((MUL(t161 - t162, costab16) * 2) - t163) * 2) - t164) * 2) - t165; /* 29 */ lo[13][slot] = SHIFT(t176); /* 31 */ lo[15][slot] = SHIFT((((((((MUL(t171 - t172, costab16) * 2) - t173) * 2) - t174) * 2) - t175) * 2) - t176); /* * Totals: * 80 multiplies * 80 additions * 119 subtractions * 49 shifts (not counting SSO) */ } # undef MUL # undef SHIFT /* third SSO shift and/or D[] optimization preshift */ # if defined(OPT_SSO) # if MAD_F_FRACBITS != 28 # error "MAD_F_FRACBITS must be 28 to use OPT_SSO" # endif # define ML0(hi, lo, x, y) ((lo) = (x) * (y)) # define MLA(hi, lo, x, y) ((lo) += (x) * (y)) # define MLN(hi, lo) ((lo) = -(lo)) # define MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) # define SHIFT(x) ((x) >> 2) # define PRESHIFT(x) ((MAD_F(x) + (1L << 13)) >> 14) # else # define ML0(hi, lo, x, y) MAD_F_ML0((hi), (lo), (x), (y)) # define MLA(hi, lo, x, y) MAD_F_MLA((hi), (lo), (x), (y)) # define MLN(hi, lo) MAD_F_MLN((hi), (lo)) # define MLZ(hi, lo) MAD_F_MLZ((hi), (lo)) # define SHIFT(x) (x) # if defined(MAD_F_SCALEBITS) # undef MAD_F_SCALEBITS # define MAD_F_SCALEBITS (MAD_F_FRACBITS - 12) # define PRESHIFT(x) (MAD_F(x) >> 12) # else # define PRESHIFT(x) MAD_F(x) # endif # endif static mad_fixed_t const D[17][32] = { # include "D.dat" }; # if defined(ASO_SYNTH) void synth_full(struct mad_synth *, struct mad_frame const *, unsigned int, unsigned int); # else /* * NAME: synth->full() * DESCRIPTION: perform full frequency PCM synthesis */ static void synth_full(struct mad_synth *synth, struct mad_frame const *frame, unsigned int nch, unsigned int ns) { unsigned int phase, ch, s, sb, pe, po; mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8]; mad_fixed_t const (*sbsample)[36][32]; register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8]; register mad_fixed_t const (*Dptr)[32], *ptr; register mad_fixed64hi_t hi; register mad_fixed64lo_t lo; for (ch = 0; ch < nch; ++ch) { sbsample = &frame->sbsample[ch]; filter = &synth->filter[ch]; phase = synth->phase; pcm1 = synth->pcm.samples[ch]; for (s = 0; s < ns; ++s) { dct32((*sbsample)[s], phase >> 1, (*filter)[0][phase & 1], (*filter)[1][phase & 1]); pe = phase & ~1; po = ((phase - 1) & 0xf) | 1; /* calculate 32 samples */ fe = &(*filter)[0][ phase & 1][0]; fx = &(*filter)[0][~phase & 1][0]; fo = &(*filter)[1][~phase & 1][0]; Dptr = &D[0]; ptr = *Dptr + po; ML0(hi, lo, (*fx)[0], ptr[ 0]); MLA(hi, lo, (*fx)[1], ptr[14]); MLA(hi, lo, (*fx)[2], ptr[12]); MLA(hi, lo, (*fx)[3], ptr[10]); MLA(hi, lo, (*fx)[4], ptr[ 8]); MLA(hi, lo, (*fx)[5], ptr[ 6]); MLA(hi, lo, (*fx)[6], ptr[ 4]); MLA(hi, lo, (*fx)[7], ptr[ 2]); MLN(hi, lo); ptr = *Dptr + pe; MLA(hi, lo, (*fe)[0], ptr[ 0]); MLA(hi, lo, (*fe)[1], ptr[14]); MLA(hi, lo, (*fe)[2], ptr[12]); MLA(hi, lo, (*fe)[3], ptr[10]); MLA(hi, lo, (*fe)[4], ptr[ 8]); MLA(hi, lo, (*fe)[5], ptr[ 6]); MLA(hi, lo, (*fe)[6], ptr[ 4]); MLA(hi, lo, (*fe)[7], ptr[ 2]); *pcm1++ = SHIFT(MLZ(hi, lo)); pcm2 = pcm1 + 30; for (sb = 1; sb < 16; ++sb) { ++fe; ++Dptr; /* D[32 - sb][i] == -D[sb][31 - i] */ ptr = *Dptr + po; ML0(hi, lo, (*fo)[0], ptr[ 0]); MLA(hi, lo, (*fo)[1], ptr[14]); MLA(hi, lo, (*fo)[2], ptr[12]); MLA(hi, lo, (*fo)[3], ptr[10]); MLA(hi, lo, (*fo)[4], ptr[ 8]); MLA(hi, lo, (*fo)[5], ptr[ 6]); MLA(hi, lo, (*fo)[6], ptr[ 4]); MLA(hi, lo, (*fo)[7], ptr[ 2]); MLN(hi, lo); ptr = *Dptr + pe; MLA(hi, lo, (*fe)[7], ptr[ 2]); MLA(hi, lo, (*fe)[6], ptr[ 4]); MLA(hi, lo, (*fe)[5], ptr[ 6]); MLA(hi, lo, (*fe)[4], ptr[ 8]); MLA(hi, lo, (*fe)[3], ptr[10]); MLA(hi, lo, (*fe)[2], ptr[12]); MLA(hi, lo, (*fe)[1], ptr[14]); MLA(hi, lo, (*fe)[0], ptr[ 0]); *pcm1++ = SHIFT(MLZ(hi, lo)); ptr = *Dptr - pe; ML0(hi, lo, (*fe)[0], ptr[31 - 16]); MLA(hi, lo, (*fe)[1], ptr[31 - 14]); MLA(hi, lo, (*fe)[2], ptr[31 - 12]); MLA(hi, lo, (*fe)[3], ptr[31 - 10]); MLA(hi, lo, (*fe)[4], ptr[31 - 8]); MLA(hi, lo, (*fe)[5], ptr[31 - 6]); MLA(hi, lo, (*fe)[6], ptr[31 - 4]); MLA(hi, lo, (*fe)[7], ptr[31 - 2]); ptr = *Dptr - po; MLA(hi, lo, (*fo)[7], ptr[31 - 2]); MLA(hi, lo, (*fo)[6], ptr[31 - 4]); MLA(hi, lo, (*fo)[5], ptr[31 - 6]); MLA(hi, lo, (*fo)[4], ptr[31 - 8]); MLA(hi, lo, (*fo)[3], ptr[31 - 10]); MLA(hi, lo, (*fo)[2], ptr[31 - 12]); MLA(hi, lo, (*fo)[1], ptr[31 - 14]); MLA(hi, lo, (*fo)[0], ptr[31 - 16]); *pcm2-- = SHIFT(MLZ(hi, lo)); ++fo; } ++Dptr; ptr = *Dptr + po; ML0(hi, lo, (*fo)[0], ptr[ 0]); MLA(hi, lo, (*fo)[1], ptr[14]); MLA(hi, lo, (*fo)[2], ptr[12]); MLA(hi, lo, (*fo)[3], ptr[10]); MLA(hi, lo, (*fo)[4], ptr[ 8]); MLA(hi, lo, (*fo)[5], ptr[ 6]); MLA(hi, lo, (*fo)[6], ptr[ 4]); MLA(hi, lo, (*fo)[7], ptr[ 2]); *pcm1 = SHIFT(-MLZ(hi, lo)); pcm1 += 16; phase = (phase + 1) % 16; } } } # endif /* * NAME: synth->half() * DESCRIPTION: perform half frequency PCM synthesis */ static void synth_half(struct mad_synth *synth, struct mad_frame const *frame, unsigned int nch, unsigned int ns) { unsigned int phase, ch, s, sb, pe, po; mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8]; mad_fixed_t const (*sbsample)[36][32]; register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8]; register mad_fixed_t const (*Dptr)[32], *ptr; register mad_fixed64hi_t hi; register mad_fixed64lo_t lo; for (ch = 0; ch < nch; ++ch) { sbsample = &frame->sbsample[ch]; filter = &synth->filter[ch]; phase = synth->phase; pcm1 = synth->pcm.samples[ch]; for (s = 0; s < ns; ++s) { dct32((*sbsample)[s], phase >> 1, (*filter)[0][phase & 1], (*filter)[1][phase & 1]); pe = phase & ~1; po = ((phase - 1) & 0xf) | 1; /* calculate 16 samples */ fe = &(*filter)[0][ phase & 1][0]; fx = &(*filter)[0][~phase & 1][0]; fo = &(*filter)[1][~phase & 1][0]; Dptr = &D[0]; ptr = *Dptr + po; ML0(hi, lo, (*fx)[0], ptr[ 0]); MLA(hi, lo, (*fx)[1], ptr[14]); MLA(hi, lo, (*fx)[2], ptr[12]); MLA(hi, lo, (*fx)[3], ptr[10]); MLA(hi, lo, (*fx)[4], ptr[ 8]); MLA(hi, lo, (*fx)[5], ptr[ 6]); MLA(hi, lo, (*fx)[6], ptr[ 4]); MLA(hi, lo, (*fx)[7], ptr[ 2]); MLN(hi, lo); ptr = *Dptr + pe; MLA(hi, lo, (*fe)[0], ptr[ 0]); MLA(hi, lo, (*fe)[1], ptr[14]); MLA(hi, lo, (*fe)[2], ptr[12]); MLA(hi, lo, (*fe)[3], ptr[10]); MLA(hi, lo, (*fe)[4], ptr[ 8]); MLA(hi, lo, (*fe)[5], ptr[ 6]); MLA(hi, lo, (*fe)[6], ptr[ 4]); MLA(hi, lo, (*fe)[7], ptr[ 2]); *pcm1++ = SHIFT(MLZ(hi, lo)); pcm2 = pcm1 + 14; for (sb = 1; sb < 16; ++sb) { ++fe; ++Dptr; /* D[32 - sb][i] == -D[sb][31 - i] */ if (!(sb & 1)) { ptr = *Dptr + po; ML0(hi, lo, (*fo)[0], ptr[ 0]); MLA(hi, lo, (*fo)[1], ptr[14]); MLA(hi, lo, (*fo)[2], ptr[12]); MLA(hi, lo, (*fo)[3], ptr[10]); MLA(hi, lo, (*fo)[4], ptr[ 8]); MLA(hi, lo, (*fo)[5], ptr[ 6]); MLA(hi, lo, (*fo)[6], ptr[ 4]); MLA(hi, lo, (*fo)[7], ptr[ 2]); MLN(hi, lo); ptr = *Dptr + pe; MLA(hi, lo, (*fe)[7], ptr[ 2]); MLA(hi, lo, (*fe)[6], ptr[ 4]); MLA(hi, lo, (*fe)[5], ptr[ 6]); MLA(hi, lo, (*fe)[4], ptr[ 8]); MLA(hi, lo, (*fe)[3], ptr[10]); MLA(hi, lo, (*fe)[2], ptr[12]); MLA(hi, lo, (*fe)[1], ptr[14]); MLA(hi, lo, (*fe)[0], ptr[ 0]); *pcm1++ = SHIFT(MLZ(hi, lo)); ptr = *Dptr - po; ML0(hi, lo, (*fo)[7], ptr[31 - 2]); MLA(hi, lo, (*fo)[6], ptr[31 - 4]); MLA(hi, lo, (*fo)[5], ptr[31 - 6]); MLA(hi, lo, (*fo)[4], ptr[31 - 8]); MLA(hi, lo, (*fo)[3], ptr[31 - 10]); MLA(hi, lo, (*fo)[2], ptr[31 - 12]); MLA(hi, lo, (*fo)[1], ptr[31 - 14]); MLA(hi, lo, (*fo)[0], ptr[31 - 16]); ptr = *Dptr - pe; MLA(hi, lo, (*fe)[0], ptr[31 - 16]); MLA(hi, lo, (*fe)[1], ptr[31 - 14]); MLA(hi, lo, (*fe)[2], ptr[31 - 12]); MLA(hi, lo, (*fe)[3], ptr[31 - 10]); MLA(hi, lo, (*fe)[4], ptr[31 - 8]); MLA(hi, lo, (*fe)[5], ptr[31 - 6]); MLA(hi, lo, (*fe)[6], ptr[31 - 4]); MLA(hi, lo, (*fe)[7], ptr[31 - 2]); *pcm2-- = SHIFT(MLZ(hi, lo)); } ++fo; } ++Dptr; ptr = *Dptr + po; ML0(hi, lo, (*fo)[0], ptr[ 0]); MLA(hi, lo, (*fo)[1], ptr[14]); MLA(hi, lo, (*fo)[2], ptr[12]); MLA(hi, lo, (*fo)[3], ptr[10]); MLA(hi, lo, (*fo)[4], ptr[ 8]); MLA(hi, lo, (*fo)[5], ptr[ 6]); MLA(hi, lo, (*fo)[6], ptr[ 4]); MLA(hi, lo, (*fo)[7], ptr[ 2]); *pcm1 = SHIFT(-MLZ(hi, lo)); pcm1 += 8; phase = (phase + 1) % 16; } } } /* * NAME: synth->frame() * DESCRIPTION: perform PCM synthesis of frame subband samples */ void mad_synth_frame(struct mad_synth *synth, struct mad_frame const *frame) { unsigned int nch, ns; void (*synth_frame)(struct mad_synth *, struct mad_frame const *, unsigned int, unsigned int); nch = MAD_NCHANNELS(&frame->header); ns = MAD_NSBSAMPLES(&frame->header); synth->pcm.samplerate = frame->header.samplerate; synth->pcm.channels = nch; synth->pcm.length = 32 * ns; synth_frame = synth_full; if (frame->options & MAD_OPTION_HALFSAMPLERATE) { synth->pcm.samplerate /= 2; synth->pcm.length /= 2; synth_frame = synth_half; } synth_frame(synth, frame, nch, ns); synth->phase = (synth->phase + ns) % 16; } avifile-0.7.48~20090503.ds/plugins/libmad/libmad/synth.h0000644000175000017500000000363610403657206021433 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: synth.h,v 1.3 2006/03/08 22:45:26 kabi Exp $ */ # ifndef LIBMAD_SYNTH_H # define LIBMAD_SYNTH_H # include "fixed.h" # include "frame.h" struct mad_pcm { unsigned int samplerate; /* sampling frequency (Hz) */ unsigned short channels; /* number of channels */ unsigned short length; /* number of samples per channel */ mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */ }; struct mad_synth { mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */ /* [ch][eo][peo][s][v] */ unsigned int phase; /* current processing phase */ struct mad_pcm pcm; /* PCM output */ }; /* single channel PCM selector */ enum { MAD_PCM_CHANNEL_SINGLE = 0 }; /* dual channel PCM selector */ enum { MAD_PCM_CHANNEL_DUAL_1 = 0, MAD_PCM_CHANNEL_DUAL_2 = 1 }; /* stereo PCM selector */ enum { MAD_PCM_CHANNEL_STEREO_LEFT = 0, MAD_PCM_CHANNEL_STEREO_RIGHT = 1 }; void mad_synth_init(struct mad_synth *); # define mad_synth_finish(synth) /* nothing */ void mad_synth_mute(struct mad_synth *); void mad_synth_frame(struct mad_synth *, struct mad_frame const *); # endif avifile-0.7.48~20090503.ds/plugins/libmad/libmad/timer.c0000644000175000017500000002452110403657206021375 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: timer.c,v 1.3 2006/03/08 22:45:26 kabi Exp $ */ # ifdef HAVE_CONFIG_H # include "config.h" # endif # include "global.h" # include # ifdef HAVE_ASSERT_H # include # endif # include "timer.h" mad_timer_t const mad_timer_zero = { 0, 0 }; /* * NAME: timer->compare() * DESCRIPTION: indicate relative order of two timers */ int mad_timer_compare(mad_timer_t timer1, mad_timer_t timer2) { signed long diff; diff = timer1.seconds - timer2.seconds; if (diff < 0) return -1; else if (diff > 0) return +1; diff = timer1.fraction - timer2.fraction; if (diff < 0) return -1; else if (diff > 0) return +1; return 0; } /* * NAME: timer->negate() * DESCRIPTION: invert the sign of a timer */ void mad_timer_negate(mad_timer_t *timer) { timer->seconds = -timer->seconds; if (timer->fraction) { timer->seconds -= 1; timer->fraction = MAD_TIMER_RESOLUTION - timer->fraction; } } /* * NAME: timer->abs() * DESCRIPTION: return the absolute value of a timer */ mad_timer_t mad_timer_abs(mad_timer_t timer) { if (timer.seconds < 0) mad_timer_negate(&timer); return timer; } /* * NAME: reduce_timer() * DESCRIPTION: carry timer fraction into seconds */ static void reduce_timer(mad_timer_t *timer) { timer->seconds += timer->fraction / MAD_TIMER_RESOLUTION; timer->fraction %= MAD_TIMER_RESOLUTION; } /* * NAME: gcd() * DESCRIPTION: compute greatest common denominator */ static unsigned long gcd(unsigned long num1, unsigned long num2) { unsigned long tmp; while (num2) { tmp = num2; num2 = num1 % num2; num1 = tmp; } return num1; } /* * NAME: reduce_rational() * DESCRIPTION: convert rational expression to lowest terms */ static void reduce_rational(unsigned long *numer, unsigned long *denom) { unsigned long factor; factor = gcd(*numer, *denom); assert(factor != 0); *numer /= factor; *denom /= factor; } /* * NAME: scale_rational() * DESCRIPTION: solve numer/denom == ?/scale avoiding overflowing */ static unsigned long scale_rational(unsigned long numer, unsigned long denom, unsigned long scale) { reduce_rational(&numer, &denom); reduce_rational(&scale, &denom); assert(denom != 0); if (denom < scale) return numer * (scale / denom) + numer * (scale % denom) / denom; if (denom < numer) return scale * (numer / denom) + scale * (numer % denom) / denom; return numer * scale / denom; } /* * NAME: timer->set() * DESCRIPTION: set timer to specific (positive) value */ void mad_timer_set(mad_timer_t *timer, unsigned long seconds, unsigned long numer, unsigned long denom) { timer->seconds = seconds; if (numer >= denom && denom > 0) { timer->seconds += numer / denom; numer %= denom; } switch (denom) { case 0: case 1: timer->fraction = 0; break; case MAD_TIMER_RESOLUTION: timer->fraction = numer; break; case 1000: timer->fraction = numer * (MAD_TIMER_RESOLUTION / 1000); break; case 8000: timer->fraction = numer * (MAD_TIMER_RESOLUTION / 8000); break; case 11025: timer->fraction = numer * (MAD_TIMER_RESOLUTION / 11025); break; case 12000: timer->fraction = numer * (MAD_TIMER_RESOLUTION / 12000); break; case 16000: timer->fraction = numer * (MAD_TIMER_RESOLUTION / 16000); break; case 22050: timer->fraction = numer * (MAD_TIMER_RESOLUTION / 22050); break; case 24000: timer->fraction = numer * (MAD_TIMER_RESOLUTION / 24000); break; case 32000: timer->fraction = numer * (MAD_TIMER_RESOLUTION / 32000); break; case 44100: timer->fraction = numer * (MAD_TIMER_RESOLUTION / 44100); break; case 48000: timer->fraction = numer * (MAD_TIMER_RESOLUTION / 48000); break; default: timer->fraction = scale_rational(numer, denom, MAD_TIMER_RESOLUTION); break; } if (timer->fraction >= MAD_TIMER_RESOLUTION) reduce_timer(timer); } /* * NAME: timer->add() * DESCRIPTION: add one timer to another */ void mad_timer_add(mad_timer_t *timer, mad_timer_t incr) { timer->seconds += incr.seconds; timer->fraction += incr.fraction; if (timer->fraction >= MAD_TIMER_RESOLUTION) reduce_timer(timer); } /* * NAME: timer->multiply() * DESCRIPTION: multiply a timer by a scalar value */ void mad_timer_multiply(mad_timer_t *timer, signed long scalar) { mad_timer_t addend; unsigned long factor; factor = scalar; if (scalar < 0) { factor = -scalar; mad_timer_negate(timer); } addend = *timer; *timer = mad_timer_zero; while (factor) { if (factor & 1) mad_timer_add(timer, addend); mad_timer_add(&addend, addend); factor >>= 1; } } /* * NAME: timer->count() * DESCRIPTION: return timer value in selected units */ signed long mad_timer_count(mad_timer_t timer, enum mad_units units) { switch (units) { case MAD_UNITS_HOURS: return timer.seconds / 60 / 60; case MAD_UNITS_MINUTES: return timer.seconds / 60; case MAD_UNITS_SECONDS: return timer.seconds; case MAD_UNITS_DECISECONDS: case MAD_UNITS_CENTISECONDS: case MAD_UNITS_MILLISECONDS: case MAD_UNITS_8000_HZ: case MAD_UNITS_11025_HZ: case MAD_UNITS_12000_HZ: case MAD_UNITS_16000_HZ: case MAD_UNITS_22050_HZ: case MAD_UNITS_24000_HZ: case MAD_UNITS_32000_HZ: case MAD_UNITS_44100_HZ: case MAD_UNITS_48000_HZ: case MAD_UNITS_24_FPS: case MAD_UNITS_25_FPS: case MAD_UNITS_30_FPS: case MAD_UNITS_48_FPS: case MAD_UNITS_50_FPS: case MAD_UNITS_60_FPS: case MAD_UNITS_75_FPS: return timer.seconds * (signed long) units + (signed long) scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, units); case MAD_UNITS_23_976_FPS: case MAD_UNITS_24_975_FPS: case MAD_UNITS_29_97_FPS: case MAD_UNITS_47_952_FPS: case MAD_UNITS_49_95_FPS: case MAD_UNITS_59_94_FPS: return (mad_timer_count(timer, -units) + 1) * 1000 / 1001; } /* unsupported units */ return 0; } /* * NAME: timer->fraction() * DESCRIPTION: return fractional part of timer in arbitrary terms */ unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long denom) { timer = mad_timer_abs(timer); switch (denom) { case 0: return timer.fraction ? MAD_TIMER_RESOLUTION / timer.fraction : MAD_TIMER_RESOLUTION + 1; case MAD_TIMER_RESOLUTION: return timer.fraction; default: return scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, denom); } } /* * NAME: timer->string() * DESCRIPTION: write a string representation of a timer using a template */ void mad_timer_string(mad_timer_t timer, char *dest, char const *format, enum mad_units units, enum mad_units fracunits, unsigned long subparts) { unsigned long hours, minutes, seconds, sub; unsigned int frac; timer = mad_timer_abs(timer); seconds = timer.seconds; frac = sub = 0; switch (fracunits) { case MAD_UNITS_HOURS: case MAD_UNITS_MINUTES: case MAD_UNITS_SECONDS: break; case MAD_UNITS_DECISECONDS: case MAD_UNITS_CENTISECONDS: case MAD_UNITS_MILLISECONDS: case MAD_UNITS_8000_HZ: case MAD_UNITS_11025_HZ: case MAD_UNITS_12000_HZ: case MAD_UNITS_16000_HZ: case MAD_UNITS_22050_HZ: case MAD_UNITS_24000_HZ: case MAD_UNITS_32000_HZ: case MAD_UNITS_44100_HZ: case MAD_UNITS_48000_HZ: case MAD_UNITS_24_FPS: case MAD_UNITS_25_FPS: case MAD_UNITS_30_FPS: case MAD_UNITS_48_FPS: case MAD_UNITS_50_FPS: case MAD_UNITS_60_FPS: case MAD_UNITS_75_FPS: { unsigned long denom; denom = MAD_TIMER_RESOLUTION / fracunits; frac = timer.fraction / denom; sub = scale_rational(timer.fraction % denom, denom, subparts); } break; case MAD_UNITS_23_976_FPS: case MAD_UNITS_24_975_FPS: case MAD_UNITS_29_97_FPS: case MAD_UNITS_47_952_FPS: case MAD_UNITS_49_95_FPS: case MAD_UNITS_59_94_FPS: /* drop-frame encoding */ /* N.B. this is only well-defined for MAD_UNITS_29_97_FPS */ { unsigned long frame, cycle, d, m; frame = mad_timer_count(timer, fracunits); cycle = -fracunits * 60 * 10 - (10 - 1) * 2; d = frame / cycle; m = frame % cycle; frame += (10 - 1) * 2 * d; if (m > 2) frame += 2 * ((m - 2) / (cycle / 10)); frac = frame % -fracunits; seconds = frame / -fracunits; } break; } switch (units) { case MAD_UNITS_HOURS: minutes = seconds / 60; hours = minutes / 60; sprintf(dest, format, hours, (unsigned int) (minutes % 60), (unsigned int) (seconds % 60), frac, sub); break; case MAD_UNITS_MINUTES: minutes = seconds / 60; sprintf(dest, format, minutes, (unsigned int) (seconds % 60), frac, sub); break; case MAD_UNITS_SECONDS: sprintf(dest, format, seconds, frac, sub); break; case MAD_UNITS_23_976_FPS: case MAD_UNITS_24_975_FPS: case MAD_UNITS_29_97_FPS: case MAD_UNITS_47_952_FPS: case MAD_UNITS_49_95_FPS: case MAD_UNITS_59_94_FPS: if (fracunits < 0) { /* not yet implemented */ sub = 0; } /* fall through */ case MAD_UNITS_DECISECONDS: case MAD_UNITS_CENTISECONDS: case MAD_UNITS_MILLISECONDS: case MAD_UNITS_8000_HZ: case MAD_UNITS_11025_HZ: case MAD_UNITS_12000_HZ: case MAD_UNITS_16000_HZ: case MAD_UNITS_22050_HZ: case MAD_UNITS_24000_HZ: case MAD_UNITS_32000_HZ: case MAD_UNITS_44100_HZ: case MAD_UNITS_48000_HZ: case MAD_UNITS_24_FPS: case MAD_UNITS_25_FPS: case MAD_UNITS_30_FPS: case MAD_UNITS_48_FPS: case MAD_UNITS_50_FPS: case MAD_UNITS_60_FPS: case MAD_UNITS_75_FPS: sprintf(dest, format, mad_timer_count(timer, units), sub); break; } } avifile-0.7.48~20090503.ds/plugins/libmad/libmad/timer.h0000644000175000017500000000547710403657206021413 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: timer.h,v 1.3 2006/03/08 22:45:26 kabi Exp $ */ # ifndef LIBMAD_TIMER_H # define LIBMAD_TIMER_H typedef struct { signed long seconds; /* whole seconds */ unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */ } mad_timer_t; extern mad_timer_t const mad_timer_zero; # define MAD_TIMER_RESOLUTION 352800000UL enum mad_units { MAD_UNITS_HOURS = -2, MAD_UNITS_MINUTES = -1, MAD_UNITS_SECONDS = 0, /* metric units */ MAD_UNITS_DECISECONDS = 10, MAD_UNITS_CENTISECONDS = 100, MAD_UNITS_MILLISECONDS = 1000, /* audio sample units */ MAD_UNITS_8000_HZ = 8000, MAD_UNITS_11025_HZ = 11025, MAD_UNITS_12000_HZ = 12000, MAD_UNITS_16000_HZ = 16000, MAD_UNITS_22050_HZ = 22050, MAD_UNITS_24000_HZ = 24000, MAD_UNITS_32000_HZ = 32000, MAD_UNITS_44100_HZ = 44100, MAD_UNITS_48000_HZ = 48000, /* video frame/field units */ MAD_UNITS_24_FPS = 24, MAD_UNITS_25_FPS = 25, MAD_UNITS_30_FPS = 30, MAD_UNITS_48_FPS = 48, MAD_UNITS_50_FPS = 50, MAD_UNITS_60_FPS = 60, /* CD audio frames */ MAD_UNITS_75_FPS = 75, /* video drop-frame units */ MAD_UNITS_23_976_FPS = -24, MAD_UNITS_24_975_FPS = -25, MAD_UNITS_29_97_FPS = -30, MAD_UNITS_47_952_FPS = -48, MAD_UNITS_49_95_FPS = -50, MAD_UNITS_59_94_FPS = -60 }; # define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero)) int mad_timer_compare(mad_timer_t, mad_timer_t); # define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero) void mad_timer_negate(mad_timer_t *); mad_timer_t mad_timer_abs(mad_timer_t); void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long); void mad_timer_add(mad_timer_t *, mad_timer_t); void mad_timer_multiply(mad_timer_t *, signed long); signed long mad_timer_count(mad_timer_t, enum mad_units); unsigned long mad_timer_fraction(mad_timer_t, unsigned long); void mad_timer_string(mad_timer_t, char *, char const *, enum mad_units, enum mad_units, unsigned long); # endif avifile-0.7.48~20090503.ds/plugins/libmad/libmad/version.c0000644000175000017500000000407110403657206021740 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: version.c,v 1.2 2006/03/08 22:45:26 kabi Exp $ */ # ifdef HAVE_CONFIG_H # include "config.h" # endif # include "global.h" # include "version.h" char const mad_version[] = "MPEG Audio Decoder " MAD_VERSION; char const mad_copyright[] = "Copyright (C) " MAD_PUBLISHYEAR " " MAD_AUTHOR; char const mad_author[] = MAD_AUTHOR " <" MAD_EMAIL ">"; char const mad_build[] = "" # if defined(DEBUG) "DEBUG " # elif defined(NDEBUG) "NDEBUG " # endif # if defined(EXPERIMENTAL) "EXPERIMENTAL " # endif # if defined(FPM_64BIT) "FPM_64BIT " # elif defined(FPM_INTEL) "FPM_INTEL " # elif defined(FPM_ARM) "FPM_ARM " # elif defined(FPM_MIPS) "FPM_MIPS " # elif defined(FPM_SPARC) "FPM_SPARC " # elif defined(FPM_PPC) "FPM_PPC " # elif defined(FPM_DEFAULT) "FPM_DEFAULT " # endif # if defined(ASO_IMDCT) "ASO_IMDCT " # endif # if defined(ASO_INTERLEAVE1) "ASO_INTERLEAVE1 " # endif # if defined(ASO_INTERLEAVE2) "ASO_INTERLEAVE2 " # endif # if defined(ASO_ZEROCHECK) "ASO_ZEROCHECK " # endif # if defined(OPT_SPEED) "OPT_SPEED " # elif defined(OPT_ACCURACY) "OPT_ACCURACY " # endif # if defined(OPT_SSO) "OPT_SSO " # endif # if defined(OPT_DCTO) /* never defined here */ "OPT_DCTO " # endif # if defined(OPT_STRICT) "OPT_STRICT " # endif ; avifile-0.7.48~20090503.ds/plugins/libmad/libmad/version.h0000644000175000017500000000311210403657206021740 0ustar yavoryavor/* * libmad - MPEG audio decoder library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * $Id: version.h,v 1.3 2006/03/08 22:45:26 kabi Exp $ */ # ifndef LIBMAD_VERSION_H # define LIBMAD_VERSION_H # define MAD_VERSION_MAJOR 0 # define MAD_VERSION_MINOR 15 # define MAD_VERSION_PATCH 1 # define MAD_VERSION_EXTRA " (beta)" # define MAD_VERSION_STRINGIZE(str) #str # define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num) # define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ MAD_VERSION_STRING(MAD_VERSION_PATCH) \ MAD_VERSION_EXTRA # define MAD_PUBLISHYEAR "2000-2004" # define MAD_AUTHOR "Underbit Technologies, Inc." # define MAD_EMAIL "info@underbit.com" extern char const mad_version[]; extern char const mad_copyright[]; extern char const mad_author[]; extern char const mad_build[]; # endif avifile-0.7.48~20090503.ds/plugins/libmad/Makefile.am0000644000175000017500000000112111110406660020674 0ustar yavoryavor# libmad audio mpeg decoder pluging # using either internal version 0.15.1b # or system library SUBDIRS = libmad if AMM_USE_MAD pkglib_LTLIBRARIES = mad_audiodec.la endif noinst_HEADERS = fillplugins.h mad_audiodec_la_SOURCES = libmad.cpp mad_audiodec_la_LIBADD = ../../lib/libaviplay.la mad_audiodec_la_LDFLAGS = -module -avoid-version AM_CPPFLAGS = AM_CXXFLAGS = $(CXXRTTIEXCEPT) $(VISIBILITYFLAG) if AMM_USE_LIBMAD mad_audiodec_la_LIBADD += $(MAD_LIBS) else AM_CPPFLAGS += -I$(srcdir)/$(SUBDIRS) mad_audiodec_la_LIBADD += $(SUBDIRS)/libmad.la endif MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libmad/fillplugins.h0000644000175000017500000000137710747447716021404 0ustar yavoryavor#ifndef MAD_FILLPLUGINS_H #define MAD_FILLPLUGINS_H #include "infotypes.h" AVM_BEGIN_NAMESPACE; #define MADCSTR(name) \ static const char madstr_ ## name[] = #name MADCSTR(gain); static void mad_FillPlugins(avm::vector& ac) { const fourcc_t mad_codecs[] = { 0x55, 0x50, 0 }; avm::vector d; d.push_back(AttributeInfo(madstr_gain, "Gain", AttributeInfo::Integer, 1, 32, 8)); ac.push_back(CodecInfo(mad_codecs, "MAD MPEG Layer-2/3", "", "High quality MAD MPEG Layer-2/3 audio decoder " "made by Robert Leslie (c) 2000-2001", CodecInfo::Plugin, "mad", CodecInfo::Audio, CodecInfo::Decode, 0, 0, d)); } AVM_END_NAMESPACE; #endif // MAD_FILLPLUGINS_H avifile-0.7.48~20090503.ds/plugins/libmad/libmad.cpp0000644000175000017500000001432011164472233020611 0ustar yavoryavor#include "fillplugins.h" #include "mad.h" #include "audiodecoder.h" #include "plugin.h" #include "utils.h" #include "avm_fourcc.h" #include "avm_output.h" #include #include #include #include AVM_BEGIN_NAMESPACE; PLUGIN_TEMP(mad_audiodec); #define _ static const char* error_str(enum mad_error error) { static char str[17]; switch (error) { case MAD_ERROR_BUFLEN: case MAD_ERROR_BUFPTR: // some backward compatible #ifdef MAD_ERROR_NONE case MAD_ERROR_NONE: #endif // MAD_ERROR_NONE /* these errors are handled specially and/or should not occur */ break; case MAD_ERROR_NOMEM: return _("not enough memory"); case MAD_ERROR_LOSTSYNC: return _("lost synchronization"); case MAD_ERROR_BADLAYER: return _("reserved header layer value"); case MAD_ERROR_BADBITRATE: return _("forbidden bitrate value"); case MAD_ERROR_BADSAMPLERATE: return _("reserved sample frequency value"); case MAD_ERROR_BADEMPHASIS: return _("reserved emphasis value"); case MAD_ERROR_BADCRC: return _("CRC check failed"); case MAD_ERROR_BADBITALLOC: return _("forbidden bit allocation value"); case MAD_ERROR_BADSCALEFACTOR: return _("bad scalefactor index"); case MAD_ERROR_BADFRAMELEN: return _("bad frame length"); case MAD_ERROR_BADBIGVALUES: return _("bad big_values count"); case MAD_ERROR_BADBLOCKTYPE: return _("reserved block_type"); case MAD_ERROR_BADSCFSI: return _("bad scalefactor selection info"); case MAD_ERROR_BADDATAPTR: return _("bad main_data_begin pointer"); case MAD_ERROR_BADPART3LEN: return _("bad audio data length"); case MAD_ERROR_BADHUFFTABLE: return _("bad Huffman table select"); case MAD_ERROR_BADHUFFDATA: return _("Huffman data overrun"); case MAD_ERROR_BADSTEREO: return _("incompatible block_type for JS"); default:; } sprintf(str, "error 0x%04x", error); return str; } class MAD_Decoder : public IAudioDecoder, public IRtConfig { struct mad_stream stream; struct mad_frame frame; struct mad_synth synth; int m_iGain; bool m_bInitialized; public: MAD_Decoder(const CodecInfo& info, const WAVEFORMATEX* wf) :IAudioDecoder(info, wf), m_iGain(8), m_bInitialized(false) { mad_stream_init(&stream); mad_frame_init(&frame); Flush(); } ~MAD_Decoder() { mad_synth_finish(&synth); mad_frame_finish(&frame); mad_stream_finish(&stream); } virtual int Convert(const void* in_data, size_t in_size, void* out_data, size_t out_size, size_t* size_read, size_t* size_written) { mad_stream_buffer(&stream, (const unsigned char*) in_data, in_size); if (mad_frame_decode(&frame, &stream) == -1) { //printf("mad_frame_decode: stream error: %s (harmless after seeking)\n", error_str(stream.error)); Flush(); } else { if (!m_bInitialized) { AVM_WRITE("MAD decoder", "MAD header MPEG Layer-%d %dHz %ldkbps\n", frame.header.layer, frame.header.samplerate, frame.header.bitrate / 1000); m_bInitialized = true; } mad_synth_frame(&synth, &frame); // Convert mad_fixed to int16_t int16_t* samples = (int16_t*) out_data; #if 0 printf("Synth %d ch:%d l:%d\n", synth.pcm.samplerate, synth.pcm.channels, synth.pcm.length); printf("Timer %d %f mode: %d \n", frame.header.duration.seconds, 1/(double)frame.header.duration.fraction, frame.header.mode); #endif for(int i = 0; i < synth.pcm.channels; i++) { if (m_iGain != 8) { for(int j = 0; j < synth.pcm.length; j++) { mad_fixed_t sample = mad_fixed_t((int64_t)((synth.pcm.samples[i][j] >> 6) * m_iGain) >> (MAD_F_FRACBITS - 16 - 2)); //printf("%x %d --- %x %d\n", s1, s1, sample, sample); if (sample > 32767) { //printf("SAMPLEBIG %d\n", sample); sample = 32767; } else if (sample < -32768) { //printf("SAMPLESMALL %d\n", sample); sample = -32768; } samples[j * synth.pcm.channels + i] = (int16_t)(sample); } } else { for(int j = 0; j < synth.pcm.length; j++) { int sample = synth.pcm.samples[i][j] >> (MAD_F_FRACBITS + 1 - 16); #if 1 if (sample > 32767) sample = 32767; else if (sample < -32768) sample = -32768; #endif samples[j * synth.pcm.channels + i] = (int16_t)(sample); } } } } if (size_read) *size_read = (uint_t)(stream.next_frame - (const unsigned char*)in_data); if (size_written) *size_written = 2 * synth.pcm.channels * synth.pcm.length; return 0; } virtual void Flush() { mad_frame_mute(&frame); mad_synth_init(&synth); } IRtConfig* GetRtConfig() { return this; } const avm::vector& GetAttrs() const { return m_Info.decoder_info; } int GetValue(const char* name, int* value) const { if (strcmp(name, madstr_gain) == 0) { *value = m_iGain; return 0; } return -1; } int SetValue(const char* name, int value) { if (strcmp(name, madstr_gain) == 0) { m_iGain = value; return 0; } return -1; } #if 0 int GetOutputFormat(WAVEFORMATEX* destfmt) { if (!destfmt) return -1; *destfmt = in_fmt; destfmt->wBitsPerSample = 16; destfmt->wFormatTag = 0x2000; destfmt->nAvgBytesPerSec = 192000; // after conversion destfmt->nBlockAlign = MAD_BLOCK_SIZE; destfmt->nSamplesPerSec = destfmt->nAvgBytesPerSec / destfmt->nChannels / (destfmt->wBitsPerSample / 8); /* destfmt->nBlockAlign = destfmt->nChannels * destfmt->wBitsPerSample / 8; destfmt->nAvgBytesPerSec = destfmt->nSamplesPerSec * destfmt->nBlockAlign; destfmt->cbSize = 0; */ char b[200]; avm_wave_format(b, sizeof(b), &in_fmt); printf("src %s\n", b); avm_wave_format(b, sizeof(b), destfmt); printf("dst %s\n", b); return 0; } #endif }; static IAudioDecoder* mad_CreateAudioDecoder(const CodecInfo& info, const WAVEFORMATEX* format) { return new MAD_Decoder(info, format); } AVM_END_NAMESPACE; extern "C" AVMEXPORT avm::codec_plugin_t avm_codec_plugin_mad_audiodec; avm::codec_plugin_t avm_codec_plugin_mad_audiodec = { PLUGIN_API_VERSION, 0, // err 0, 0, avm::PluginGetAttrInt, avm::PluginSetAttrInt, 0, 0, // attrs avm::mad_FillPlugins, avm::mad_CreateAudioDecoder, 0, 0, 0, }; avifile-0.7.48~20090503.ds/plugins/libmp3lame_audioenc/0000755000175000017500000000000011267646347021336 5ustar yavoryavoravifile-0.7.48~20090503.ds/plugins/libmp3lame_audioenc/Makefile.am0000644000175000017500000000057311110406660023352 0ustar yavoryavorSUBDIRS = lame3.70 if AMM_USE_MP3LAME pkglib_LTLIBRARIES = mp3lame_audioenc.la endif noinst_HEADERS = fillplugins.h mp3lame_audioenc_la_SOURCES = mp3encoder.cpp mp3lame_audioenc_la_LDFLAGS = -avoid-version -module mp3lame_audioenc_la_LIBADD = lame3.70/libmp3lame.la ../../lib/libaviplay.la AM_CXXFLAGS = $(CXXRTTIEXCEPT) $(VISIBILITYFLAG) MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libmp3lame_audioenc/fillplugins.h0000644000175000017500000000102610746735757024043 0ustar yavoryavor#ifndef MP3LAME_FILLPLUGINS_H #define MP3LAME_FILLPLUGINS_H #include "infotypes.h" AVM_BEGIN_NAMESPACE; static void mp3lame_FillPlugins(avm::vector& ci) { const fourcc_t mp3_codecs[] = { 0x55, 0 }; const char* mp3_about = "Open-source MPEG layer-3 encoder, based on Lame Encoder 3.70."; ci.push_back(CodecInfo(mp3_codecs, "Lame 3.70 MPEG layer-3 encoder", "", mp3_about, CodecInfo::Plugin, "mp3lame", CodecInfo::Audio, CodecInfo::Encode)); } AVM_END_NAMESPACE; #endif // MP3LAME_FILLPLUGINS_H avifile-0.7.48~20090503.ds/plugins/libmp3lame_audioenc/mp3encoder.cpp0000644000175000017500000000647711165741653024110 0ustar yavoryavor#include "audioencoder.h" #include "avm_output.h" #include "plugin.h" #include "fillplugins.h" #include #include #include extern "C" { #include "lame3.70/lame.h" } AVM_BEGIN_NAMESPACE; PLUGIN_TEMP(mp3lame_audioenc) class MP3Encoder: public IAudioEncoder { lame_global_flags gf; WAVEFORMATEX in_fmt; struct __attribute__((__packed__)) strf_mp3 { short wID; int fdwFlags; short nBlockSize; short nFramesPerBlock; short nCodecDelay; }; public: MP3Encoder(const CodecInfo& info, const WAVEFORMATEX* format) :IAudioEncoder(info) { in_fmt=*format; lame_init(&gf); gf.silent=1; gf.padding_type=2; gf.VBR=0; gf.in_samplerate=format->nSamplesPerSec; gf.num_channels=format->nChannels; if (format->nChannels==1) gf.mode=3; else gf.mode=1; lame_init_params(&gf); //int mode; /* 0,1,2,3 stereo,jstereo,dual channel,mono */ } virtual int SetBitrate(int bitrate) { gf.brate=bitrate/125; lame_init_params(&gf); AVM_WRITE("Lame MP3 encoder", "Setting bit rate to %d (%dkbps)\n", bitrate, gf.brate); return 0; } virtual int SetQuality(int quality) { gf.quality=quality; lame_init_params(&gf); return 0; } virtual size_t GetFormat(void* extension = 0, size_t size = 0) const { if (!extension) return 30; if (size < 30) return 0; WAVEFORMATEX wf; strf_mp3 mp3extra; memcpy(&wf, &in_fmt, 18); wf.wFormatTag=0x55; wf.nAvgBytesPerSec=gf.brate*125; wf.nBlockAlign=1; wf.wBitsPerSample=0; wf.cbSize=12; memcpy(extension, &wf, 18); mp3extra.wID = 1; // mp3extra.fdwFlags = 2; // These values mp3extra.nBlockSize = (short)gf.framesize; // based on an mp3extra.nFramesPerBlock = 1; // old Usenet post!! mp3extra.nCodecDelay = 1393; // memcpy((char*)extension+18, &mp3extra, 12); return 30; } virtual int Start() { lame_init_params(&gf); return 0; } virtual int Close(void* out_data, size_t out_size, size_t* size_read) { char buffer[7200]; // printf("MP3Encoder::Close()\n"); size_t bytes = lame_encode_finish(&gf, buffer, sizeof(buffer)); if (out_size& ci) { const fourcc_t mp3_codecs[] = { 0x55, 0 }; const char* const stereo_opt[] = { "stereo", "joint", "dual", 0 }; avm::vector ea; ea.push_back(AttributeInfo("VBR", "VBR audio", AttributeInfo::Integer, 0, 1)); ea.push_back(AttributeInfo("stereo_mode", "Stereo mode", stereo_opt)); ci.push_back(CodecInfo(mp3_codecs, "Lame MPEG layer-3 encoder (runtime)", "", "Open-source MPEG layer-3 encoder, based on your " "currently installed libmp3lame library", CodecInfo::Plugin, "mp3lamebin", CodecInfo::Audio, CodecInfo::Encode, 0, ea)); } AVM_END_NAMESPACE; #endif // MP3LAMEBIN_FILLPLUGINS_H avifile-0.7.48~20090503.ds/plugins/libmp3lamebin_audioenc/lame.h0000644000175000017500000007541207323123556023115 0ustar yavoryavor/* * Interface to MP3 LAME encoding engine * * Copyright (c) 1999 Mark Taylor * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* $Id: lame.h,v 1.1 2001/07/11 19:22:22 kabi Exp $ */ #ifndef LAME_LAME_H #define LAME_LAME_H #include #include #if defined(__cplusplus) extern "C" { #endif #if defined(WIN32) #undef CDECL #define CDECL _cdecl #else #define CDECL #endif typedef enum vbr_mode_e { vbr_off=0, vbr_mt, vbr_rh, vbr_abr, vbr_mtrh, vbr_max_indicator, /* Don't use this! It's used for sanity checks. */ vbr_default=vbr_rh /* change this to change the default VBR mode of LAME */ } vbr_mode; /* MPEG modes */ typedef enum MPEG_mode_e { STEREO = 0, JOINT_STEREO, DUAL_CHANNEL, /* LAME doesn't supports this! */ MONO, NOT_SET, MAX_INDICATOR /* Don't use this! It's used for sanity checks. */ } MPEG_mode; /* Padding types */ typedef enum Padding_type_e { PAD_NO = 0, PAD_ALL, PAD_ADJUST, PAD_MAX_INDICATOR /* Don't use this! It's used for sanity checks. */ } Padding_type; struct lame_global_struct; typedef struct lame_global_struct lame_global_flags; typedef lame_global_flags *lame_t; /*********************************************************************** * * The LAME API * These functions should be called, in this order, for each * MP3 file to be encoded * ***********************************************************************/ /* * REQUIRED: * initialize the encoder. sets default for all encoder paramters, * returns -1 if some malloc()'s failed * otherwise returns 0 */ lame_global_flags * CDECL lame_init(void); /* obsolete version */ int CDECL lame_init_old(lame_global_flags *); /* * OPTIONAL: * set as needed to override defaults */ /******************************************************************** * input stream description ***********************************************************************/ // number of samples. default = 2^32-1 int CDECL lame_set_num_samples(lame_global_flags *, unsigned long); unsigned long CDECL lame_get_num_samples(const lame_global_flags *); // input sample rate in Hz. default = 44100hz int CDECL lame_set_in_samplerate(lame_global_flags *, int); int CDECL lame_get_in_samplerate(const lame_global_flags *); // number of channels in input stream. default=2 int CDECL lame_set_num_channels(lame_global_flags *, int); int CDECL lame_get_num_channels(const lame_global_flags *); // scale the input by this amount before encoding. default=0 (disabled) // (not used by decoding routines) int CDECL lame_set_scale(lame_global_flags *, float); float CDECL lame_get_scale(const lame_global_flags *); // output sample rate in Hz. default = 0, which means LAME picks best value // based on the amount of compression. MPEG only allows: // MPEG1 32, 44.1, 48khz // MPEG2 16, 22.05, 24 // MPEG2.5 8, 11.025, 12 // (not used by decoding routines) int CDECL lame_set_out_samplerate(lame_global_flags *, int); int CDECL lame_get_out_samplerate(const lame_global_flags *); /******************************************************************** * general control parameters ***********************************************************************/ // 1=cause LAME to collect data for an MP3 frame analzyer. default=0 int CDECL lame_set_analysis(lame_global_flags *, int); int CDECL lame_get_analysis(const lame_global_flags *); // 1 = write a Xing VBR header frame. // default = 1 for VBR/ABR modes, 0 for CBR mode // this variable must have been added by a Hungarian notation Windows programmer :-) int CDECL lame_set_bWriteVbrTag(lame_global_flags *, int); int CDECL lame_get_bWriteVbrTag(const lame_global_flags *); // 1=decode only. use lame/mpglib to convert mp3/ogg to wav. default=0 int CDECL lame_set_decode_only(lame_global_flags *, int); int CDECL lame_get_decode_only(const lame_global_flags *); // 1=encode a Vorbis .ogg file. default=0 int CDECL lame_set_ogg(lame_global_flags *, int); int CDECL lame_get_ogg(const lame_global_flags *); // internal algorithm selection. True quality is determined by the bitrate // but this variable will effect quality by selecting expensive or cheap algorithms. // quality=0..9. 0=best (very slow). 9=worst. // recommended: 2 near-best quality, not too slow // 5 good quality, fast // 7 ok quality, really fast int CDECL lame_set_quality(lame_global_flags *, int); int CDECL lame_get_quality(const lame_global_flags *); // mode = 0,1,2,3 = stereo, jstereo, dual channel (not supported), mono // default: lame picks based on compression ration and input channels int CDECL lame_set_mode(lame_global_flags *, MPEG_mode); MPEG_mode CDECL lame_get_mode(const lame_global_flags *); // mode_automs. Us a M/S mode with a switching threshold based on // compression ratio // default = 0 (disabled) int CDECL lame_set_mode_automs(lame_global_flags *, int); int CDECL lame_get_mode_automs(const lame_global_flags *); // force_ms. Force M/S for all frames. For testing only. // default = 0 (disabled) int CDECL lame_set_force_ms(lame_global_flags *, int); int CDECL lame_get_force_ms(const lame_global_flags *); // use free_format? default = 0 (disabled) int CDECL lame_set_free_format(lame_global_flags *, int); int CDECL lame_get_free_format(const lame_global_flags *); /* * OPTIONAL: * Set printf like error/debug/message reporting functions. * The second argument has to be a pointer to a function which looks like * void my_debugf(const char *format, va_list ap) * { * (void) vfprintf(stdout, format, ap); * } * If you use NULL as the value of the pointer in the set function, the * lame buildin function will be used (prints to stderr). * To quiet any output you have to replace the body of the example function * with just "return;" and use it in the set function. */ int CDECL lame_set_errorf(lame_global_flags *, void (*func)(const char *, va_list)); int CDECL lame_set_debugf(lame_global_flags *, void (*func)(const char *, va_list)); int CDECL lame_set_msgf (lame_global_flags *, void (*func)(const char *, va_list)); /* set one of brate compression ratio. default is compression ratio of 11. */ int CDECL lame_set_brate(lame_global_flags *, int); int CDECL lame_get_brate(const lame_global_flags *); int CDECL lame_set_compression_ratio(lame_global_flags *, float); float CDECL lame_get_compression_ratio(const lame_global_flags *); /******************************************************************** * frame params ***********************************************************************/ // mark as copyright. default=0 int CDECL lame_set_copyright(lame_global_flags *, int); int CDECL lame_get_copyright(const lame_global_flags *); // mark as original. default=1 int CDECL lame_set_original(lame_global_flags *, int); int CDECL lame_get_original(const lame_global_flags *); // error_protection. Use 2 bytes from each fraome for CRC checksum. default=0 int CDECL lame_set_error_protection(lame_global_flags *, int); int CDECL lame_get_error_protection(const lame_global_flags *); // padding_type. 0=pad no frames 1=pad all frames 2=adjust padding(default) int CDECL lame_set_padding_type(lame_global_flags *, Padding_type); Padding_type CDECL lame_get_padding_type(const lame_global_flags *); // MP3 'private extension' bit Meaningless int CDECL lame_set_extension(lame_global_flags *, int); int CDECL lame_get_extension(const lame_global_flags *); // enforce strict ISO complience. default=0 int CDECL lame_set_strict_ISO(lame_global_flags *, int); int CDECL lame_get_strict_ISO(const lame_global_flags *); /******************************************************************** * quantization/noise shaping ***********************************************************************/ // disable the bit reservoir. For testing only. default=0 int CDECL lame_set_disable_reservoir(lame_global_flags *, int); int CDECL lame_get_disable_reservoir(const lame_global_flags *); // select a different "best quantization" function. default=0 int CDECL lame_set_experimentalX(lame_global_flags *, int); int CDECL lame_get_experimentalX(const lame_global_flags *); // another experimental option. for testing only int CDECL lame_set_experimentalY(lame_global_flags *, int); int CDECL lame_get_experimentalY(const lame_global_flags *); // another experimental option. for testing only int CDECL lame_set_experimentalZ(lame_global_flags *, int); int CDECL lame_get_experimentalZ(const lame_global_flags *); // Naoki's psycho acoustic model. default=0 int CDECL lame_set_exp_nspsytune(lame_global_flags *, int); int CDECL lame_get_exp_nspsytune(const lame_global_flags *); /******************************************************************** * VBR control ***********************************************************************/ // Types of VBR. default = vbr_off = CBR int CDECL lame_set_VBR(lame_global_flags *, vbr_mode); vbr_mode CDECL lame_get_VBR(const lame_global_flags *); // VBR quality level. 0=highest 9=lowest int CDECL lame_set_VBR_q(lame_global_flags *, int); int CDECL lame_get_VBR_q(const lame_global_flags *); // Ignored except for VBR=vbr_abr (ABR mode) int CDECL lame_set_VBR_mean_bitrate_kbps(lame_global_flags *, int); int CDECL lame_get_VBR_mean_bitrate_kbps(const lame_global_flags *); int CDECL lame_set_VBR_min_bitrate_kbps(lame_global_flags *, int); int CDECL lame_get_VBR_min_bitrate_kbps(const lame_global_flags *); int CDECL lame_set_VBR_max_bitrate_kbps(lame_global_flags *, int); int CDECL lame_get_VBR_max_bitrate_kbps(const lame_global_flags *); // 1=stricetly enforce VBR_min_bitrate. Normally it will be violated for // analog silence int CDECL lame_set_VBR_hard_min(lame_global_flags *, int); int CDECL lame_get_VBR_hard_min(const lame_global_flags *); /******************************************************************** * Filtering control ***********************************************************************/ // freq in Hz to apply lowpass. Default = 0 = lame chooses. -1 = disabled int CDECL lame_set_lowpassfreq(lame_global_flags *, int); int CDECL lame_get_lowpassfreq(const lame_global_flags *); // width of transition band, in Hz. Default = one polyphase filter band int CDECL lame_set_lowpasswidth(lame_global_flags *, int); int CDECL lame_get_lowpasswidth(const lame_global_flags *); // freq in Hz to apply highpass. Default = 0 = lame chooses. -1 = disabled int CDECL lame_set_highpassfreq(lame_global_flags *, int); int CDECL lame_get_highpassfreq(const lame_global_flags *); // width of transition band, in Hz. Default = one polyphase filter band int CDECL lame_set_highpasswidth(lame_global_flags *, int); int CDECL lame_get_highpasswidth(const lame_global_flags *); /******************************************************************** * psycho acoustics and other arguments which you should not change * unless you know what you are doing ***********************************************************************/ // only use ATH for masking int CDECL lame_set_ATHonly(lame_global_flags *, int); int CDECL lame_get_ATHonly(const lame_global_flags *); // only use ATH for short blocks int CDECL lame_set_ATHshort(lame_global_flags *, int); int CDECL lame_get_ATHshort(const lame_global_flags *); // disable ATH int CDECL lame_set_noATH(lame_global_flags *, int); int CDECL lame_get_noATH(const lame_global_flags *); // select ATH formula int CDECL lame_set_ATHtype(lame_global_flags *, int); int CDECL lame_get_ATHtype(const lame_global_flags *); // lower ATH by this many db int CDECL lame_set_ATHlower(lame_global_flags *, float); float CDECL lame_get_ATHlower(const lame_global_flags *); // select adaptive ATH type int CDECL lame_set_adjust_type( lame_global_flags *, int); int CDECL lame_get_adjust_type( const lame_global_flags *); // select adaptive ATH level adjustment scheme int CDECL lame_set_adapt_thres_type( lame_global_flags *, int); int CDECL lame_get_adapt_thres_type( const lame_global_flags *); // adjust (in dB) the point below which adaptive ATH level adjustment occurs int CDECL lame_set_adapt_thres_level( lame_global_flags *, float); float CDECL lame_get_adapt_thres_level( const lame_global_flags* ); // predictability limit (ISO tonality formula) int CDECL lame_set_cwlimit(lame_global_flags *, int); int CDECL lame_get_cwlimit(const lame_global_flags *); // allow blocktypes to differ between channels? // default: 0 for jstereo, 1 for stereo int CDECL lame_set_allow_diff_short(lame_global_flags *, int); int CDECL lame_get_allow_diff_short(const lame_global_flags *); // use temporal masking effect (default = 1) int CDECL lame_set_useTemporal(lame_global_flags *, int); int CDECL lame_get_useTemporal(const lame_global_flags *); // disable short blocks int CDECL lame_set_no_short_blocks(lame_global_flags *, int); int CDECL lame_get_no_short_blocks(const lame_global_flags *); /* Input PCM is emphased PCM (for instance from one of the rarely emphased CDs), it is STRONGLY not recommended to use this, because psycho does not take it into account, and last but not least many decoders ignore these bits */ int CDECL lame_set_emphasis(lame_global_flags *, int); int CDECL lame_get_emphasis(const lame_global_flags *); /************************************************************************/ /* internal variables, cannot be set... */ /* provided because they may be of use to calling application */ /************************************************************************/ // version 0=MPEG-2 1=MPEG-1 (2=MPEG-2.5) int CDECL lame_get_version(const lame_global_flags *); // encoder delay int CDECL lame_get_encoder_delay(const lame_global_flags *); // size of MPEG frame int CDECL lame_get_framesize(const lame_global_flags *); // number of PCM samples buffered, but not yet encoded to mp3 data. int CDECL lame_get_mf_samples_to_encode( const lame_global_flags* gfp ); // size (bytes) of mp3 data buffered, but not yet encoded. // this is the number of bytes which would be output by a call to // lame_encode_flush_nogap. NOTE: lame_encode_flush() will return // more bytes than this because it will encode the reamining buffered // PCM samples before flushing the mp3 buffers. int CDECL lame_get_size_mp3buffer( const lame_global_flags* gfp ); // number of frames encoded so far int CDECL lame_get_frameNum(const lame_global_flags *); // lame's estimate of the total number of frames to be encoded // only valid if calling program set num_samples int CDECL lame_get_totalframes(const lame_global_flags *); /* * REQUIRED: * sets more internal configuration based on data provided above. * returns -1 if something failed. */ int CDECL lame_init_params(lame_global_flags *); /* * OPTIONAL: * get the version number, in a string. of the form: * "3.63 (beta)" or just "3.63". */ const char* CDECL get_lame_version ( void ); const char* CDECL get_lame_short_version ( void ); const char* CDECL get_psy_version ( void ); const char* CDECL get_mp3x_version ( void ); const char* CDECL get_lame_url ( void ); /* * OPTIONAL: * get the version numbers in numerical form. */ typedef struct { /* generic LAME version */ int major; int minor; int alpha; /* 0 if not an alpha version */ int beta; /* 0 if not a beta version */ /* version of the psy model */ int psy_major; int psy_minor; int psy_alpha; /* 0 if not an alpha version */ int psy_beta; /* 0 if not a beta version */ /* compile time features */ const char *features; /* Don't make assumptions about the contents! */ } lame_version_t; void CDECL get_lame_version_numerical ( lame_version_t *const ); /* * OPTIONAL: * print internal lame configuration to message handler */ void CDECL lame_print_config(const lame_global_flags* gfp); void CDECL lame_print_internals( const lame_global_flags *gfp); /* * input pcm data, output (maybe) mp3 frames. * This routine handles all buffering, resampling and filtering for you. * * return code number of bytes output in mp3buf. Can be 0 * -1: mp3buf was too small * -2: malloc() problem * -3: lame_init_params() not called * -4: psycho acoustic problems * -5: ogg cleanup encoding error * -6: ogg frame encoding error * * The required mp3buf_size can be computed from num_samples, * samplerate and encoding rate, but here is a worst case estimate: * * mp3buf_size in bytes = 1.25*num_samples + 7200 * * I think a tighter bound could be: (mt, March 2000) * MPEG1: * num_samples*(bitrate/8)/samplerate + 4*1152*(bitrate/8)/samplerate + 512 * MPEG2: * num_samples*(bitrate/8)/samplerate + 4*576*(bitrate/8)/samplerate + 256 * * but test first if you use that! * * set mp3buf_size = 0 and LAME will not check if mp3buf_size is * large enough. * * NOTE: * if gfp->num_channels=2, but gfp->mode = 3 (mono), the L & R channels * will be averaged into the L channel before encoding only the L channel * This will overwrite the data in buffer_l[] and buffer_r[]. * */ int CDECL lame_encode_buffer ( lame_global_flags* gfp, /* global context handle */ const short int buffer_l [], /* PCM data for left channel */ const short int buffer_r [], /* PCM data for right channel */ const int nsamples, /* number of samples per channel */ unsigned char* mp3buf, /* pointer to encoded MP3 stream */ const int mp3buf_size ); /* number of valid octets in this stream */ /* * as above, but input has L & R channel data interleaved. * NOTE: * num_samples = number of samples in the L (or R) * channel, not the total number of samples in pcm[] */ int CDECL lame_encode_buffer_interleaved( lame_global_flags* gfp, /* global context handlei */ short int pcm[], /* PCM data for left and right channel, interleaved */ int num_samples, /* number of samples per channel, _not_ number of samples in pcm[] */ unsigned char* mp3buf, /* pointer to encoded MP3 stream */ int mp3buf_size ); /* number of valid octets in this stream */ /* as lame_encode_buffer, but for 'float's */ int CDECL lame_encode_buffer_float( lame_global_flags* gfp, /* global context handle */ const float buffer_l [], /* PCM data for left channel */ const float buffer_r [], /* PCM data for right channel */ const int nsamples, /* number of samples per channel */ unsigned char* mp3buf, /* pointer to encoded MP3 stream */ const int mp3buf_size ); /* number of valid octets in this stream */ /* as lame_encode_buffer, but for int's */ int CDECL lame_encode_buffer_int( lame_global_flags* gfp, /* global context handle */ const int buffer_l [], /* PCM data for left channel */ const int buffer_r [], /* PCM data for right channel */ const int nsamples, /* number of samples per channel */ unsigned char* mp3buf, /* pointer to encoded MP3 stream */ const int mp3buf_size ); /* number of valid octets in this stream */ /* as lame_encode_buffer, but for long's */ int CDECL lame_encode_buffer_long( lame_global_flags* gfp, /* global context handle */ const long buffer_l [], /* PCM data for left channel */ const long buffer_r [], /* PCM data for right channel */ const int nsamples, /* number of samples per channel */ unsigned char* mp3buf, /* pointer to encoded MP3 stream */ const int mp3buf_size ); /* number of valid octets in this stream */ /* * REQUIRED: * lame_encode_flush will flush the intenal PCM buffers, padding with * 0's to make sure the final frame is complete, and then flush * the internal MP3 buffers, and thus may return a * final few mp3 frames. 'mp3buf' should be at least 7200 bytes long * to hold all possible emitted data. * * will also write id3v1 tags (if any) into the bitstream * * return code = number of bytes output to mp3buf. Can be 0 */ int CDECL lame_encode_flush( lame_global_flags * gfp, /* global context handle */ unsigned char* mp3buf, /* pointer to encoded MP3 stream */ int size); /* number of valid octets in this stream */ /* * OPTIONAL: * lame_encode_flush_nogap will flush the internal mp3 buffers and pad * the last frame with ancillary data so it is a complete mp3 frame. * * 'mp3buf' should be at least 7200 bytes long * to hold all possible emitted data. * * After a call to this routine, the outputed mp3 data is complete, but * you may continue to encode new PCM samples and write future mp3 data * to a different file. The two mp3 files will play back with no gaps * if they are concatenated together. * * This routine will NOT write id3v1 tags into the bitstream. * * return code = number of bytes output to mp3buf. Can be 0 */ int CDECL lame_encode_flush_nogap( lame_global_flags * gfp, /* global context handle */ unsigned char* mp3buf, /* pointer to encoded MP3 stream */ int size); /* number of valid octets in this stream */ /* * OPTIONAL: * Normally, this is called by lame_init_params(). It writes id3v2 and * Xing headers into the front of the bitstream, and sets frame counters * and bitrate histogram data to 0. You can also call this after * lame_encode_flush_nogap(). */ int CDECL lame_init_bitstream( lame_global_flags * gfp); /* global context handle */ /* * OPTIONAL: some simple statistics * a bitrate histogram to visualize the distribution of used frame sizes * a stereo mode histogram to visualize the distribution of used stereo * modes, useful in joint-stereo mode only * 0: LR left-right encoded * 1: LR-I left-right and intensity encoded (currently not supported) * 2: MS mid-side encoded * 3: MS-I mid-side and intensity encoded (currently not supported) * * attention: don't call them after lame_encode_finish * suggested: lame_encode_flush -> lame_*_hist -> lame_close */ void CDECL lame_bitrate_hist( const lame_global_flags *const gfp, int bitrate_count[14] ); void CDECL lame_bitrate_kbps( const lame_global_flags *const gfp, int bitrate_kbps [14] ); void CDECL lame_stereo_mode_hist( const lame_global_flags *const gfp, int stereo_mode_count[4] ); void CDECL lame_bitrate_stereo_mode_hist ( const lame_global_flags* gfp, int bitrate_stmode_count [14] [4] ); /* * OPTIONAL: * lame_mp3_tags_fid will append a Xing VBR tag to the mp3 file with file * pointer fid. These calls perform forward and backwards seeks, so make * sure fid is a real file. Make sure lame_encode_flush has been called, * and all mp3 data has been written to the file before calling this * function. * NOTE: * if VBR tags are turned off by the user, or turned off by LAME because * the output is not a regular file, this call does nothing */ void CDECL lame_mp3_tags_fid(lame_global_flags *,FILE* fid); /* * REQUIRED: * final call to free all remaining buffers */ int CDECL lame_close (lame_global_flags *); /* * OBSOLETE: * lame_encode_finish combines lame_encode_flush() and lame_close() in * one call. However, once this call is made, the statistics routines * will no longer work because the data will have been cleared */ int CDECL lame_encode_finish( lame_global_flags* gfp, unsigned char* mp3buf, int size ); /********************************************************************* * * decoding * * a simple interface to mpglib, part of mpg123, is also included if * libmp3lame is compiled with HAVE_MPGLIB * *********************************************************************/ typedef struct { int header_parsed; /* 1 if header was parsed and following data was computed */ int stereo; /* number of channels */ int samplerate; /* sample rate */ int bitrate; /* bitrate */ int mode; /* mp3 frame type */ int mode_ext; /* mp3 frame type */ int framesize; /* number of samples per mp3 frame */ /* this data is only computed if mpglib detects a Xing VBR header */ unsigned long nsamp; /* number of samples in mp3 file. */ int totalframes; /* total number of frames in mp3 file */ /* this data is not currently computed by the mpglib routines */ int framenum; /* frames decoded counter */ } mp3data_struct; /* required call to initialize decoder */ int CDECL lame_decode_init(void); /********************************************************************* * input 1 mp3 frame, output (maybe) pcm data. * lame_decode() return code: * -1: error * 0: need more data * n>0: size of pcm output *********************************************************************/ int CDECL lame_decode( unsigned char * mp3buf, int len, short pcm_l[], short pcm_r[] ); /* same as lame_decode, and also returns mp3 header data */ int CDECL lame_decode_headers( unsigned char* mp3buf, int len, short pcm_l[], short pcm_r[], mp3data_struct* mp3data ); /* same as lame_decode, but returns at most one frame */ int CDECL lame_decode1( unsigned char* mp3buf, int len, short pcm_l[], short pcm_r[] ); /* same as lame_decode1, but returns at most one frame and mp3 header data */ int CDECL lame_decode1_headers( unsigned char* mp3buf, int len, short pcm_l[], short pcm_r[], mp3data_struct* mp3data ); /********************************************************************* * * id3tag stuff * *********************************************************************/ /* * id3tag.h -- Interface to write ID3 version 1 and 2 tags. * * Copyright (C) 2000 Don Melton. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ /* utility to obtain alphabetically sorted list of genre names with numbers */ extern void id3tag_genre_list( void (*handler)(int, const char *, void *), void* cookie); extern void id3tag_init (lame_global_flags *gfp); /* force addition of version 2 tag */ extern void id3tag_add_v2 (lame_global_flags *gfp); /* add only a version 1 tag */ extern void id3tag_v1_only (lame_global_flags *gfp); /* add only a version 2 tag */ extern void id3tag_v2_only (lame_global_flags *gfp); /* pad version 1 tag with spaces instead of nulls */ extern void id3tag_space_v1 (lame_global_flags *gfp); /* pad version 2 tag with extra 128 bytes */ extern void id3tag_pad_v2 (lame_global_flags *gfp); extern void id3tag_set_title( lame_global_flags* gfp, const char* title ); extern void id3tag_set_artist( lame_global_flags* gfp, const char* artist ); extern void id3tag_set_album( lame_global_flags* gfp, const char* album ); extern void id3tag_set_year( lame_global_flags* gfp, const char* year ); extern void id3tag_set_comment( lame_global_flags* gfp, const char* comment ); extern void id3tag_set_track( lame_global_flags* gfp, const char* track ); /* return non-zero result if genre name or number is invalid */ extern int id3tag_set_genre( lame_global_flags* gfp, const char* genre ); /*********************************************************************** * * list of valid bitrates [kbps] & sample frequencies [Hz]. * first index: 0: MPEG-2 values (sample frequencies 16...24 kHz) * 1: MPEG-1 values (sample frequencies 32...48 kHz) * 2: MPEG-2.5 values (sample frequencies 8...12 kHz) ***********************************************************************/ extern const int bitrate_table [3] [16]; extern const int samplerate_table [3] [ 4]; /* maximum size of mp3buffer needed if you encode at most 1152 samples for each call to lame_encode_buffer. see lame_encode_buffer() below (LAME_MAXMP3BUFFER is now obsolete) */ #define LAME_MAXMP3BUFFER 16384 #if defined(__cplusplus) } #endif #endif /* LAME_LAME_H */ avifile-0.7.48~20090503.ds/plugins/libmp3lamebin_audioenc/lameencoder.cpp0000644000175000017500000002266211174446777025023 0ustar yavoryavor/* * Plugin for lame encoding * * this version loads the library in runtime * might look a bit complicated but has few advantages - you do not have * to have libmp3lame installed on your system while you still could build * this working plugin */ #include "audioencoder.h" #include "fillplugins.h" #include "plugin.h" #include "utils.h" #include "avm_output.h" #include #include #include #include #include "lame.h" AVM_BEGIN_NAMESPACE; PLUGIN_TEMP(mp3lamebin_audioenc); static const char mp3lamename[] = "libmp3lame.so.0"; static const char MODULE[] = "Lame mp3 Encoder"; class LameEncoder: public IAudioEncoder { void* handle; lame_global_flags* gf; WAVEFORMATEX in_fmt; int brate; char m_Error[128]; /* lame calls */ lame_global_flags* CDECL (*p_lame_init)(void); int CDECL (*p_lame_init_params)(lame_global_flags *); int CDECL (*p_lame_encode_buffer)(lame_global_flags* gfp, const short int buffer_l[], const short int buffer_r[], const int nsamples, unsigned char* mp3buf, const int mp3buf_size); int CDECL (*p_lame_encode_buffer_interleaved)(lame_global_flags* gfp, short int pcm[], int num_samples, unsigned char* mp3buf, int mp3buf_size); int CDECL (*p_lame_encode_finish)(lame_global_flags* gfp, unsigned char* mp3buf, int size); int CDECL (*p_lame_get_framesize)(const lame_global_flags *); int CDECL (*p_lame_get_size_mp3buffer)( const lame_global_flags*); int CDECL (*p_lame_get_brate)(const lame_global_flags *); int CDECL (*p_lame_get_VBR_mean_bitrate_kbps)( const lame_global_flags*); void CDECL (*p_lame_print_config)(const lame_global_flags*); void CDECL (*p_lame_print_internals)(const lame_global_flags *); int CDECL (*p_lame_set_bWriteVbrTag)(lame_global_flags *, int); int CDECL (*p_lame_set_padding_type)(lame_global_flags *, Padding_type); int CDECL (*p_lame_set_VBR)(lame_global_flags *, vbr_mode); int CDECL (*p_lame_set_VBR_q)(lame_global_flags *, int); int CDECL (*p_lame_set_VBR_mean_bitrate_kbps)(lame_global_flags *, int); int CDECL (*p_lame_set_VBR_min_bitrate_kbps)(lame_global_flags *, int); int CDECL (*p_lame_set_VBR_max_bitrate_kbps)(lame_global_flags *, int); int CDECL (*p_lame_set_in_samplerate)(lame_global_flags *, int); int CDECL (*p_lame_set_num_channels)(lame_global_flags *, int); int CDECL (*p_lame_set_mode)(lame_global_flags *, MPEG_mode); int CDECL (*p_lame_set_brate)(lame_global_flags *, int); int CDECL (*p_lame_set_quality)(lame_global_flags *, int); public: LameEncoder(const CodecInfo& info, const WAVEFORMATEX* format) :IAudioEncoder(info), handle(0) { m_Error[0] = 0; in_fmt = *format; } int init() { handle = dlopen(mp3lamename, RTLD_LAZY); if (!handle) { sprintf(m_Error, "Lame library %s could not be opened: %s\n" "If you want to use this plugin - install lame library\n" "on your system - see README for more details\n", mp3lamename, dlerror()); return -1; } // resolve all needed function calls #define d(a, b) p_lame_ ## a = b dlsymm( "lame_" #a ) d(init, (lame_global_flags * CDECL (*)(void))); d(init_params, (int CDECL (*)(lame_global_flags *))); d(print_config, (void CDECL (*)(const lame_global_flags *))); d(print_internals, (void CDECL (*)(const lame_global_flags *))); d(set_bWriteVbrTag, (int CDECL (*)(lame_global_flags *, int))); d(set_padding_type, (int CDECL (*)(lame_global_flags *, Padding_type))); d(set_VBR, (int CDECL (*)(lame_global_flags *, vbr_mode))); d(set_VBR_q, (int CDECL (*)(lame_global_flags *, int))); d(set_VBR_mean_bitrate_kbps, (int CDECL (*)(lame_global_flags *, int))); d(set_VBR_min_bitrate_kbps, (int CDECL (*)(lame_global_flags *, int))); d(set_VBR_max_bitrate_kbps, (int CDECL (*)(lame_global_flags *, int))); d(set_in_samplerate, (int CDECL (*)(lame_global_flags *, int))); d(set_num_channels, (int CDECL (*)(lame_global_flags *, int))); d(set_mode, (int CDECL (*)(lame_global_flags *, MPEG_mode))); d(set_brate, (int CDECL (*)(lame_global_flags *, int))); d(set_quality, (int CDECL (*)(lame_global_flags *, int))); d(get_framesize, (int CDECL (*)(const lame_global_flags *))); d(get_size_mp3buffer, (int CDECL (*)(const lame_global_flags *))); d(get_brate, (int CDECL (*)(const lame_global_flags *))); d(get_VBR_mean_bitrate_kbps, (int CDECL (*)(const lame_global_flags *))); d(encode_buffer_interleaved, (int CDECL (*)(lame_global_flags*, short int pcm[], int, unsigned char*, int))); d(encode_finish, (int CDECL (*)(lame_global_flags*, unsigned char*, int))); d(encode_buffer, (int CDECL (*)(lame_global_flags*, const short int buffer_l[], const short int buffer_r[], const int, unsigned char*, const int))); #undef d if (m_Error[0] != 0) return -1; gf = p_lame_init(); p_lame_set_bWriteVbrTag(gf, 0); p_lame_set_padding_type(gf, PAD_ADJUST); p_lame_set_in_samplerate(gf, in_fmt.nSamplesPerSec); p_lame_set_num_channels(gf, in_fmt.nChannels); #if 1 p_lame_set_VBR(gf, vbr_off); #else p_lame_set_VBR(gf, vbr_mtrh); p_lame_set_VBR_q(gf, 7); p_lame_set_bWriteVbrTag(gf, 1); p_lame_set_VBR_max_bitrate_kbps(gf, 64); p_lame_set_quality(gf, 9); #endif if (in_fmt.nChannels == 1) p_lame_set_mode(gf, MONO); else p_lame_set_mode(gf, JOINT_STEREO); /* 0,1,2,3 stereo,jstereo,dual channel,mono */ p_lame_init_params(gf); //p_lame_print_config(gf); //p_lame_print_internals(gf); AVM_WRITE(MODULE, "initialized\n"); return 0; } ~LameEncoder() { if (handle) dlclose(handle); } virtual int Convert(const void* in_data, size_t in_size, void* out_data, size_t out_size, size_t* size_read, size_t* size_written) { #warning FIXME 8-bit? int result; //printf("LAMEGETBUG %d\n", p_lame_get_size_mp3buffer(gf)); if (in_fmt.nChannels == 1) result = p_lame_encode_buffer(gf, (short*)in_data, (short*)in_data, (int)in_size, (unsigned char*)out_data, (int)out_size); else result = p_lame_encode_buffer_interleaved(gf, (short*)in_data, (int)in_size, (unsigned char*)out_data, (int)out_size); //printf("LAMEGETBUG2 b:%d i:%d s:%d\n", p_lame_get_size_mp3buffer(gf), in_size, result); if (result < 0) result = 0; if (size_read) *size_read = in_size; if (size_written) *size_written = result; return 0; } virtual size_t GetFormat(void* extension = 0, size_t size = 0) const { struct __attribute__((__packed__)) strf_mp3 { uint16_t wID; uint32_t fdwFlags; uint16_t nBlockSize; uint16_t nFramesPerBlock; uint16_t nCodecDelay; }; if (!extension) return 30; if (size < 30) return 0; int ibrate = p_lame_get_brate(gf); memset(extension, 0, size); WAVEFORMATEX wf; strf_mp3 mp3extra; memcpy(&wf, &in_fmt, sizeof(wf)); wf.wFormatTag = 0x55; wf.nAvgBytesPerSec = ibrate * 125; wf.nBlockAlign = 1; wf.wBitsPerSample = 0; wf.cbSize = 12; memcpy(extension, &wf, sizeof(wf)); //p_lame_init_params(gf); avm_set_le16(&mp3extra.wID, 1); // avm_set_le32(&mp3extra.fdwFlags, 2); // These values based avm_set_le16(&mp3extra.nBlockSize, (uint16_t)p_lame_get_framesize(gf)); avm_set_le16(&mp3extra.nFramesPerBlock, 1); // on an old Usenet post!! avm_set_le16(&mp3extra.nCodecDelay, 1393); // 0x571 for F-IIS MP3 Codec memcpy((uint8_t*)extension + sizeof(wf), &mp3extra, 12); AVM_WRITE(MODULE, "GetFormat() %d\n", ibrate); return 30; } virtual int Start() { //p_lame_init_params(gf); AVM_WRITE(MODULE, "Start() ch: %d freq: %d\n", in_fmt.nChannels, in_fmt.nSamplesPerSec); p_lame_init_params(gf); return 0; } virtual int SetBitrate(int bitrate) { brate = bitrate / 125; AVM_WRITE(MODULE, "SetBitrate(%d) %dkbps\n", bitrate, brate); return p_lame_set_brate(gf, brate); } virtual int SetQuality(int quality) { AVM_WRITE(MODULE, "SetQuality(%d)\n", quality); return p_lame_set_quality(gf, quality); } //virtual int SetVBR(int min, int max); const char* getError() { return m_Error; } private: int Close(void* out_data, size_t out_size, size_t* size_read) { uint8_t buffer[7200]; size_t bytes = p_lame_encode_finish(gf, buffer, sizeof(buffer)); if (out_size < bytes) bytes = out_size; if (out_data) memcpy(out_data, buffer, bytes); if (out_data && size_read) *size_read = bytes; AVM_WRITE(MODULE, "average %d kbps", p_lame_get_VBR_mean_bitrate_kbps(gf)); return 0; } void* dlsymm(const char* symbol, bool fatal = true) { if (m_Error[0] != 0) return 0; void* f = dlsym(handle, symbol); if (!f && fatal) sprintf(m_Error, "function '%s' can't be resolved\n", symbol); return f; } }; // plugin part static IAudioEncoder* mp3lamebin_CreateAudioEncoder(const CodecInfo& info, fourcc_t fourcc, const WAVEFORMATEX* fmt) { LameEncoder* e = new LameEncoder(info, fmt); if (e) { if (e->init() == 0) return e; mp3lamebin_audioenc_error_set(e->getError()); delete e; } return 0; } AVM_END_NAMESPACE; extern "C" avm::codec_plugin_t avm_codec_plugin_mp3lamebin_audioenc; avm::codec_plugin_t avm_codec_plugin_mp3lamebin_audioenc = { PLUGIN_API_VERSION, 0, // err 0, 0, 0, 0, 0, 0, // attrs avm::mp3lamebin_FillPlugins, 0, avm::mp3lamebin_CreateAudioEncoder, 0, 0, }; avifile-0.7.48~20090503.ds/plugins/libmpeg_audiodec/0000755000175000017500000000000011267646347020716 5ustar yavoryavoravifile-0.7.48~20090503.ds/plugins/libmpeg_audiodec/Makefile.am0000644000175000017500000000103611110406660022725 0ustar yavoryavorpkglib_LTLIBRARIES = mpeg_audiodec.la noinst_HEADERS =\ fillplugins.h\ mpegsound.h mpeg_audiodec_la_SOURCES = bitwindow.cpp filter.cpp filter_2.cpp \ huffmantable.cpp mpeglayer1.cpp mpeglayer2.cpp mpeglayer3.cpp \ mpegtable.cpp mpegtoraw.cpp mpeg_audiodec_la_LDFLAGS = -avoid-version -module mpeg_audiodec_la_LIBADD = ../../lib/libaviplay.la # currently it has to be compiled with optimalizations (inline has to work) #-D__NO_STRING_INLINES -DDEBUG AM_CXXFLAGS = $(CXXRTTIEXCEPT) $(VISIBILITYFLAG) MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libmpeg_audiodec/bitwindow.cpp0000644000175000017500000000134207454245445023425 0ustar yavoryavor/* MPEG/WAVE Sound library (C) 1997 by Jung woo-jae */ // Bitwindow.cc // It's bit reservior for MPEG layer 3 #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "mpegsound.h" AVM_BEGIN_NAMESPACE; int Mpegbitwindow::getbits(int bits) { int current; int bi; if(!bits)return 0; current=0; bi=(bitindex&7); current = buffer[bitindex>>3]<>3] & 0xff; bitindex+=8; bi=8; } if(bits>=bi) { current<<=bi; bits-=bi; bi=0; } else { current<<=bits; bi-=bits; bits=0; } } bitindex-=bi; return (current>>8); } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/plugins/libmpeg_audiodec/fillplugins.h0000644000175000017500000000226210747457411023413 0ustar yavoryavor#ifndef MPEG_AUDIODEC_FILLPLUGINS_H #define MPEG_AUDIODEC_FILLPLUGINS_H #include "infotypes.h" AVM_BEGIN_NAMESPACE; #define MPEGADCSTR(name) \ static const char mpegadstr_ ## name[] = #name MPEGADCSTR(gain); static void mpeg_audiodec_FillPlugins(avm::vector& audiocodecs) { const fourcc_t mpeg_codecs[] = { 0x55, 0x50, 0 }; avm::vector d; d.push_back(AttributeInfo(mpegadstr_gain, "Gain", AttributeInfo::Integer, 1, 32, 8)); audiocodecs.push_back(CodecInfo(mpeg_codecs, "MPEG Layer-1,2,3", "", "Also known as MP3. This is the third coding " "scheme for MPEG audio compression. MPEG Layer-3 " "uses perceptual audio coding and psychoacoustic " "compression to remove parts of the audio " "signal that are imperceptible to the human ear. " "The result is a compression ratio up to 12:1 " "without loss of audio quality. MP3 is a common " "format for distributing music files over the Internet.", CodecInfo::Plugin, "mp3splay", CodecInfo::Audio, CodecInfo::Decode, 0, 0, d)); } AVM_END_NAMESPACE; #endif // MPEG_AUDIODEC_FILLPLUGINS_H avifile-0.7.48~20090503.ds/plugins/libmpeg_audiodec/filter.cpp0000644000175000017500000002364007474366702022713 0ustar yavoryavor/* MPEG/WAVE Sound library (C) 1997 by Jung woo-jae */ // Filter.cc // Subbandsynthesis routines from maplay 1.2 for Linux // I've modified some macros for reducing source code. #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "mpegsound.h" //#ifdef DEBUG #define inline //#endif AVM_BEGIN_NAMESPACE; void Mpegtoraw::computebuffer(REAL *fraction,REAL buffer[2][CALCBUFFERSIZE]) { REAL p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,pa,pb,pc,pd,pe,pf; REAL q0,q1,q2,q3,q4,q5,q6,q7,q8,q9,qa,qb,qc,qd,qe,qf; REAL *out1,*out2; out1=buffer[currentcalcbuffer]+calcbufferoffset; out2=buffer[currentcalcbuffer^1]+calcbufferoffset; #define OUT1(v,t) out1[(32-(v))*16] =(-(out1[(v)*16]=t)) #define OUT2(v) out2[(96-(v)-32)*16]=out2[((v)-32)*16] // compute new values via a fast cosine transform: { register REAL *x=fraction; p0=x[ 0]+x[31];p1=x[ 1]+x[30];p2=x[ 2]+x[29];p3=x[ 3]+x[28]; p4=x[ 4]+x[27];p5=x[ 5]+x[26];p6=x[ 6]+x[25];p7=x[ 7]+x[24]; p8=x[ 8]+x[23];p9=x[ 9]+x[22];pa=x[10]+x[21];pb=x[11]+x[20]; pc=x[12]+x[19];pd=x[13]+x[18];pe=x[14]+x[17];pf=x[15]+x[16]; } q0=p0+pf;q1=p1+pe;q2=p2+pd;q3=p3+pc; q4=p4+pb;q5=p5+pa;q6=p6+p9;q7=p7+p8; q8=hcos_32[0]*(p0-pf);q9=hcos_32[1]*(p1-pe); qa=hcos_32[2]*(p2-pd);qb=hcos_32[3]*(p3-pc); qc=hcos_32[4]*(p4-pb);qd=hcos_32[5]*(p5-pa); qe=hcos_32[6]*(p6-p9);qf=hcos_32[7]*(p7-p8); p0=q0+q7;p1=q1+q6;p2=q2+q5;p3=q3+q4; p4=hcos_16[0]*(q0-q7);p5=hcos_16[1]*(q1-q6); p6=hcos_16[2]*(q2-q5);p7=hcos_16[3]*(q3-q4); p8=q8+qf;p9=q9+qe;pa=qa+qd;pb=qb+qc; pc=hcos_16[0]*(q8-qf);pd=hcos_16[1]*(q9-qe); pe=hcos_16[2]*(qa-qd);pf=hcos_16[3]*(qb-qc); q0=p0+p3;q1=p1+p2;q2=hcos_8[0]*(p0-p3);q3=hcos_8[1]*(p1-p2); q4=p4+p7;q5=p5+p6;q6=hcos_8[0]*(p4-p7);q7=hcos_8[1]*(p5-p6); q8=p8+pb;q9=p9+pa;qa=hcos_8[0]*(p8-pb);qb=hcos_8[1]*(p9-pa); qc=pc+pf;qd=pd+pe;qe=hcos_8[0]*(pc-pf);qf=hcos_8[1]*(pd-pe); p0=q0+q1;p1=hcos_4*(q0-q1);p2=q2+q3;p3=hcos_4*(q2-q3); p4=q4+q5;p5=hcos_4*(q4-q5);p6=q6+q7;p7=hcos_4*(q6-q7); p8=q8+q9;p9=hcos_4*(q8-q9);pa=qa+qb;pb=hcos_4*(qa-qb); pc=qc+qd;pd=hcos_4*(qc-qd);pe=qe+qf;pf=hcos_4*(qe-qf); { register REAL tmp; tmp=p6+p7; OUT2(36)=-(p5+tmp); OUT2(44)=-(p4+tmp); tmp=pb+pf; OUT1(10,tmp); OUT1(6,pd+tmp); tmp=pe+pf; OUT2(46)=-(p8+pc+tmp); OUT2(34)=-(p9+pd+tmp); tmp+=pa+pb; OUT2(38)=-(pd+tmp); OUT2(42)=-(pc+tmp); OUT1(2,p9+pd+pf); OUT1(4,p5+p7); OUT2(48)=-p0; out2[0]=-(out1[0]=p1); OUT1( 8,p3); OUT1(12,p7); OUT1(14,pf); OUT2(40)=-(p2+p3); } { register REAL *x=fraction; p0=hcos_64[ 0]*(x[ 0]-x[31]);p1=hcos_64[ 1]*(x[ 1]-x[30]); p2=hcos_64[ 2]*(x[ 2]-x[29]);p3=hcos_64[ 3]*(x[ 3]-x[28]); p4=hcos_64[ 4]*(x[ 4]-x[27]);p5=hcos_64[ 5]*(x[ 5]-x[26]); p6=hcos_64[ 6]*(x[ 6]-x[25]);p7=hcos_64[ 7]*(x[ 7]-x[24]); p8=hcos_64[ 8]*(x[ 8]-x[23]);p9=hcos_64[ 9]*(x[ 9]-x[22]); pa=hcos_64[10]*(x[10]-x[21]);pb=hcos_64[11]*(x[11]-x[20]); pc=hcos_64[12]*(x[12]-x[19]);pd=hcos_64[13]*(x[13]-x[18]); pe=hcos_64[14]*(x[14]-x[17]);pf=hcos_64[15]*(x[15]-x[16]); } q0=p0+pf;q1=p1+pe;q2=p2+pd;q3=p3+pc; q4=p4+pb;q5=p5+pa;q6=p6+p9;q7=p7+p8; q8=hcos_32[0]*(p0-pf);q9=hcos_32[1]*(p1-pe); qa=hcos_32[2]*(p2-pd);qb=hcos_32[3]*(p3-pc); qc=hcos_32[4]*(p4-pb);qd=hcos_32[5]*(p5-pa); qe=hcos_32[6]*(p6-p9);qf=hcos_32[7]*(p7-p8); p0=q0+q7;p1=q1+q6;p2=q2+q5;p3=q3+q4; p4=hcos_16[0]*(q0-q7);p5=hcos_16[1]*(q1-q6); p6=hcos_16[2]*(q2-q5);p7=hcos_16[3]*(q3-q4); p8=q8+qf;p9=q9+qe;pa=qa+qd;pb=qb+qc; pc=hcos_16[0]*(q8-qf);pd=hcos_16[1]*(q9-qe); pe=hcos_16[2]*(qa-qd);pf=hcos_16[3]*(qb-qc); q0=p0+p3;q1=p1+p2;q2=hcos_8[0]*(p0-p3);q3=hcos_8[1]*(p1-p2); q4=p4+p7;q5=p5+p6;q6=hcos_8[0]*(p4-p7);q7=hcos_8[1]*(p5-p6); q8=p8+pb;q9=p9+pa;qa=hcos_8[0]*(p8-pb);qb=hcos_8[1]*(p9-pa); qc=pc+pf;qd=pd+pe;qe=hcos_8[0]*(pc-pf);qf=hcos_8[1]*(pd-pe); p0=q0+q1;p1=hcos_4*(q0-q1); p2=q2+q3;p3=hcos_4*(q2-q3); p4=q4+q5;p5=hcos_4*(q4-q5); p6=q6+q7;p7=hcos_4*(q6-q7); p8=q8+q9;p9=hcos_4*(q8-q9); pa=qa+qb;pb=hcos_4*(qa-qb); pc=qc+qd;pd=hcos_4*(qc-qd); pe=qe+qf;pf=hcos_4*(qe-qf); { REAL tmp; tmp=pd+pf; OUT1(5,p5+p7+pb+tmp); tmp+=p9; OUT1(1,p1+tmp); OUT2(33)=-(p1+pe+tmp); tmp+=p5+p7; OUT1(3,tmp); OUT2(35)=-(p6+pe+tmp); tmp=pa+pb+pc+pd+pe+pf; OUT2(39)=-(p2+p3+tmp-pc); OUT2(43)=-(p4+p6+p7+tmp-pd); OUT2(37)=-(p5+p6+p7+tmp-pc); OUT2(41)=-(p2+p3+tmp-pd); tmp=p8+pc+pe+pf; OUT2(47)=-(p0+tmp); OUT2(45)=-(p4+p6+p7+tmp); tmp=pb+pf; OUT1(11,p7+tmp); tmp+=p3; OUT1( 9,tmp); OUT1( 7,pd+tmp); OUT1(13,p7+pf); OUT1(15,pf); } } #define SAVE \ raw=(int)(r*scalefactor); \ if(raw>MAXSCALE)raw=MAXSCALE;else if(rawMAXSCALE)raw=MAXSCALE;else if(rawMAXSCALE)raw=MAXSCALE;else if(rawMAXSCALE)raw=MAXSCALE;else if(rawMAXSCALE)raw=MAXSCALE;else if(rawMAXSCALE)raw=MAXSCALE;else if(raw>2][i]; fraction[LS][0][i]*=t; fraction[LS][1][i]*=t; fraction[LS][2][i]*=t; } if(bitalloc[RS][i]) { if(!group[RS][i]) { fraction[RS][0][i]=(fraction[RS][0][i]+d[RS][i])*c[LS][i]; fraction[RS][1][i]=(fraction[RS][1][i]+d[RS][i])*c[LS][i]; fraction[RS][2][i]=(fraction[RS][2][i]+d[RS][i])*c[LS][i]; } register REAL t=scalefactor[RS][l>>2][i]; fraction[RS][0][i]*=t; fraction[RS][1][i]*=t; fraction[RS][2][i]*=t; } } else for(i=0;i>2][i]; fraction[LS][0][i]*=t; fraction[LS][1][i]*=t; fraction[LS][2][i]*=t; } for(;i #include #include #ifdef DEBUG #define inline #endif AVM_BEGIN_NAMESPACE; #define MUL3(a) (((a)<<1)+(a)) #define REAL0 0 #define ARRAYSIZE (SBLIMIT*SSLIMIT) #define REALSIZE (sizeof(REAL)) #ifdef PI #undef PI #endif #define PI 3.141593 #define PI_12 (PI/12.0) #define PI_18 (PI/18.0) #define PI_24 (PI/24.0) #define PI_36 (PI/36.0) #define PI_72 (PI/72.0) #define FOURTHIRDSTABLENUMBER (1<<13) static REAL two_to_negative_half_pow[40]; static REAL TO_FOUR_THIRDSTABLE[FOURTHIRDSTABLENUMBER*2]; static REAL POW2[256]; static REAL POW2_1[8][2][16]; static REAL ca[8],cs[8]; static REAL cos1_6=cos(PI/6.0*1.0); static REAL cos2_6=cos(PI/6.0*2.0); static REAL win[4][36]; static REAL cos_18[9]; static REAL hsec_36[9],hsec_12[3]; typedef struct { REAL l,r; }RATIOS; static RATIOS rat_1[16],rat_2[2][64]; static inline REAL layer3twopow2(int scale,int preflag,int pretab_offset,int l) { int index=l; if(preflag)index+=pretab_offset; return(two_to_negative_half_pow[index<part2_3_length =getbits(12); gi->big_values =getbits(9); gi->global_gain =getbits(8); gi->scalefac_compress =getbits(4); gi->window_switching_flag=getbit(); if(gi->window_switching_flag) { gi->block_type =getbits(2); gi->mixed_block_flag=getbit(); gi->table_select[0] =getbits(5); gi->table_select[1] =getbits(5); gi->subblock_gain[0]=getbits(3); gi->subblock_gain[1]=getbits(3); gi->subblock_gain[2]=getbits(3); /* Set region_count parameters since they are implicit in this case. */ if(gi->block_type==0) { /* printf("Side info bad: block_type == 0 in split block.\n"); exit(0); */ //return false; } else if (gi->block_type==2 && gi->mixed_block_flag==0) gi->region0_count=8; /* MI 9; */ else gi->region0_count=7; /* MI 8; */ gi->region1_count=20-(gi->region0_count); } else { gi->table_select[0] =getbits(5); gi->table_select[1] =getbits(5); gi->table_select[2] =getbits(5); gi->region0_count =getbits(4); gi->region1_count =getbits(3); gi->block_type =0; gi->mixed_block_flag=0; } gi->preflag =getbit(); gi->scalefac_scale =getbit(); gi->count1table_select=getbit(); gi->generalflag=gi->window_switching_flag && (gi->block_type==2); if(!inputstereo || ch) break; } return true; } bool Mpegtoraw::layer3getsideinfo_2(void) { sideinfo.main_data_begin=getbits(8); if(!inputstereo)sideinfo.private_bits=getbit(); else sideinfo.private_bits=getbits(2); for(int ch=0;;ch++) { layer3grinfo *gi=&(sideinfo.ch[ch].gr[0]); gi->part2_3_length =getbits(12); gi->big_values =getbits(9); gi->global_gain =getbits(8); gi->scalefac_compress =getbits(9); gi->window_switching_flag=getbit(); if(gi->window_switching_flag) { gi->block_type =getbits(2); gi->mixed_block_flag=getbit(); gi->table_select[0] =getbits(5); gi->table_select[1] =getbits(5); gi->subblock_gain[0]=getbits(3); gi->subblock_gain[1]=getbits(3); gi->subblock_gain[2]=getbits(3); /* Set region_count parameters since they are implicit in this case. */ if(gi->block_type==0) { /* printf("Side info bad: block_type == 0 in split block.\n"); exit(0); */ //return false; } else if (gi->block_type==2 && gi->mixed_block_flag==0) gi->region0_count=8; /* MI 9; */ else gi->region0_count=7; /* MI 8; */ gi->region1_count=20-(gi->region0_count); } else { gi->table_select[0] =getbits(5); gi->table_select[1] =getbits(5); gi->table_select[2] =getbits(5); gi->region0_count =getbits(4); gi->region1_count =getbits(3); gi->block_type =0; } gi->scalefac_scale =getbit(); gi->count1table_select=getbit(); gi->generalflag=gi->window_switching_flag && (gi->block_type==2); if(!inputstereo || ch)break; } return true; } void Mpegtoraw::layer3getscalefactors(int ch,int gr) { static const int slen[2][16]={{0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4}, {0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3}}; layer3grinfo *gi=&(sideinfo.ch[ch].gr[gr]); register layer3scalefactor *sf=(&scalefactors[ch]); int l0,l1; { int scale_comp=gi->scalefac_compress; l0=slen[0][scale_comp]; l1=slen[1][scale_comp]; } if(gi->generalflag) { if(gi->mixed_block_flag) { /* MIXED */ /* NEW-ag 11/25 */ sf->l[0]=wgetbits9(l0);sf->l[1]=wgetbits9(l0); sf->l[2]=wgetbits9(l0);sf->l[3]=wgetbits9(l0); sf->l[4]=wgetbits9(l0);sf->l[5]=wgetbits9(l0); sf->l[6]=wgetbits9(l0);sf->l[7]=wgetbits9(l0); sf->s[0][ 3]=wgetbits9(l0);sf->s[1][ 3]=wgetbits9(l0); sf->s[2][ 3]=wgetbits9(l0); sf->s[0][ 4]=wgetbits9(l0);sf->s[1][ 4]=wgetbits9(l0); sf->s[2][ 4]=wgetbits9(l0); sf->s[0][ 5]=wgetbits9(l0);sf->s[1][ 5]=wgetbits9(l0); sf->s[2][ 5]=wgetbits9(l0); sf->s[0][ 6]=wgetbits9(l1);sf->s[1][ 6]=wgetbits9(l1); sf->s[2][ 6]=wgetbits9(l1); sf->s[0][ 7]=wgetbits9(l1);sf->s[1][ 7]=wgetbits9(l1); sf->s[2][ 7]=wgetbits9(l1); sf->s[0][ 8]=wgetbits9(l1);sf->s[1][ 8]=wgetbits9(l1); sf->s[2][ 8]=wgetbits9(l1); sf->s[0][ 9]=wgetbits9(l1);sf->s[1][ 9]=wgetbits9(l1); sf->s[2][ 9]=wgetbits9(l1); sf->s[0][10]=wgetbits9(l1);sf->s[1][10]=wgetbits9(l1); sf->s[2][10]=wgetbits9(l1); sf->s[0][11]=wgetbits9(l1);sf->s[1][11]=wgetbits9(l1); sf->s[2][11]=wgetbits9(l1); sf->s[0][12]=sf->s[1][12]=sf->s[2][12]=0; } else { /* SHORT*/ sf->s[0][ 0]=wgetbits9(l0);sf->s[1][ 0]=wgetbits9(l0); sf->s[2][ 0]=wgetbits9(l0); sf->s[0][ 1]=wgetbits9(l0);sf->s[1][ 1]=wgetbits9(l0); sf->s[2][ 1]=wgetbits9(l0); sf->s[0][ 2]=wgetbits9(l0);sf->s[1][ 2]=wgetbits9(l0); sf->s[2][ 2]=wgetbits9(l0); sf->s[0][ 3]=wgetbits9(l0);sf->s[1][ 3]=wgetbits9(l0); sf->s[2][ 3]=wgetbits9(l0); sf->s[0][ 4]=wgetbits9(l0);sf->s[1][ 4]=wgetbits9(l0); sf->s[2][ 4]=wgetbits9(l0); sf->s[0][ 5]=wgetbits9(l0);sf->s[1][ 5]=wgetbits9(l0); sf->s[2][ 5]=wgetbits9(l0); sf->s[0][ 6]=wgetbits9(l1);sf->s[1][ 6]=wgetbits9(l1); sf->s[2][ 6]=wgetbits9(l1); sf->s[0][ 7]=wgetbits9(l1);sf->s[1][ 7]=wgetbits9(l1); sf->s[2][ 7]=wgetbits9(l1); sf->s[0][ 8]=wgetbits9(l1);sf->s[1][ 8]=wgetbits9(l1); sf->s[2][ 8]=wgetbits9(l1); sf->s[0][ 9]=wgetbits9(l1);sf->s[1][ 9]=wgetbits9(l1); sf->s[2][ 9]=wgetbits9(l1); sf->s[0][10]=wgetbits9(l1);sf->s[1][10]=wgetbits9(l1); sf->s[2][10]=wgetbits9(l1); sf->s[0][11]=wgetbits9(l1);sf->s[1][11]=wgetbits9(l1); sf->s[2][11]=wgetbits9(l1); sf->s[0][12]=sf->s[1][12]=sf->s[2][12]=0; } } else { /* LONG types 0,1,3 */ if(gr==0) { sf->l[ 0]=wgetbits9(l0);sf->l[ 1]=wgetbits9(l0); sf->l[ 2]=wgetbits9(l0);sf->l[ 3]=wgetbits9(l0); sf->l[ 4]=wgetbits9(l0);sf->l[ 5]=wgetbits9(l0); sf->l[ 6]=wgetbits9(l0);sf->l[ 7]=wgetbits9(l0); sf->l[ 8]=wgetbits9(l0);sf->l[ 9]=wgetbits9(l0); sf->l[10]=wgetbits9(l0); sf->l[11]=wgetbits9(l1);sf->l[12]=wgetbits9(l1); sf->l[13]=wgetbits9(l1);sf->l[14]=wgetbits9(l1); sf->l[15]=wgetbits9(l1); sf->l[16]=wgetbits9(l1);sf->l[17]=wgetbits9(l1); sf->l[18]=wgetbits9(l1);sf->l[19]=wgetbits9(l1); sf->l[20]=wgetbits9(l1); } else { if(sideinfo.ch[ch].scfsi[0]==0) { sf->l[ 0]=wgetbits9(l0);sf->l[ 1]=wgetbits9(l0); sf->l[ 2]=wgetbits9(l0);sf->l[ 3]=wgetbits9(l0); sf->l[ 4]=wgetbits9(l0);sf->l[ 5]=wgetbits9(l0); } if(sideinfo.ch[ch].scfsi[1]==0) { sf->l[ 6]=wgetbits9(l0);sf->l[ 7]=wgetbits9(l0); sf->l[ 8]=wgetbits9(l0);sf->l[ 9]=wgetbits9(l0); sf->l[10]=wgetbits9(l0); } if(sideinfo.ch[ch].scfsi[2]==0) { sf->l[11]=wgetbits9(l1);sf->l[12]=wgetbits9(l1); sf->l[13]=wgetbits9(l1);sf->l[14]=wgetbits9(l1); sf->l[15]=wgetbits9(l1); } if(sideinfo.ch[ch].scfsi[3]==0) { sf->l[16]=wgetbits9(l1);sf->l[17]=wgetbits9(l1); sf->l[18]=wgetbits9(l1);sf->l[19]=wgetbits9(l1); sf->l[20]=wgetbits9(l1); } } sf->l[21]=sf->l[22]=0; } } void Mpegtoraw::layer3getscalefactors_2(int ch) { const int sfbblockindex[6][3][4]= { {{ 6, 5, 5, 5},{ 9, 9, 9, 9},{ 6, 9, 9, 9}}, {{ 6, 5, 7, 3},{ 9, 9,12, 6},{ 6, 9,12, 6}}, {{11,10, 0, 0},{18,18, 0, 0},{15,18, 0, 0}}, {{ 7, 7, 7, 0},{12,12,12, 0},{ 6,15,12, 0}}, {{ 6, 6, 6, 3},{12, 9, 9, 6},{ 6,12, 9, 6}}, {{ 8, 8, 5, 0},{15,12, 9, 0},{ 6,18, 9, 0}} }; int sb[54]; layer3grinfo *gi=&(sideinfo.ch[ch].gr[0]); register layer3scalefactor *sf=(&scalefactors[ch]); { int blocktypenumber,sc; int blocknumber; int slen[4]; if(gi->block_type==2)blocktypenumber=1+gi->mixed_block_flag; else blocktypenumber=0; sc=gi->scalefac_compress; if(!((extendedmode==1 || extendedmode==3) && (ch==1))) { if(sc<400) { slen[0]=(sc>>4)/5; slen[1]=(sc>>4)%5; slen[2]=(sc%16)>>2; slen[3]=(sc%4); gi->preflag=0; blocknumber=0; } else if(sc<500) { sc-=400; slen[0]=(sc>>2)/5; slen[1]=(sc>>2)%5; slen[2]=sc%4; slen[3]=0; gi->preflag=0; blocknumber=1; } else // if(sc<512) { sc-=500; slen[0]=sc/3; slen[1]=sc%3; slen[2]=0; slen[3]=0; gi->preflag=1; blocknumber=2; } } else { sc>>=1; if(sc<180) { slen[0]=sc/36; slen[1]=(sc%36)/6; slen[2]=(sc%36)%6; slen[3]=0; gi->preflag=0; blocknumber=3; } else if(sc<244) { sc-=180; slen[0]=(sc%64)>>4; slen[1]=(sc%16)>>2; slen[2]=sc%4; slen[3]=0; gi->preflag=0; blocknumber=4; } else // if(sc<255) { sc-=244; slen[0]=sc/3; slen[1]=sc%3; slen[2]= slen[3]=0; gi->preflag=0; blocknumber=5; } } { int i,j,k; const int* si; si=sfbblockindex[blocknumber][blocktypenumber]; for(i=0;i<45;i++)sb[i]=0; for(k=i=0;i<4;i++) for(j=0;jwindow_switching_flag && (gi->block_type==2)) { if(gi->mixed_block_flag) { for(sfb=0;sfb<8;sfb++)sf->l[sfb]=sb[k++]; sfb=3; } else sfb=0; for(;sfb<12;sfb++) for(window=0;window<3;window++) sf->s[window][sfb]=sb[k++]; sf->s[0][12]=sf->s[1][12]=sf->s[2][12]=0; } else { for(sfb=0;sfb<21;sfb++) sf->l[sfb]=sb[k++]; sf->l[21]=sf->l[22]=0; } } } typedef unsigned int HUFFBITS; #define MXOFF 250 /* do the huffman-decoding */ /* note! for counta,countb -the 4 bit value is returned in y, discard x */ // Huffman decoder for tablename<32 void Mpegtoraw::huffmandecoder_1(const HUFFMANCODETABLE *h,int *x,int *y) { HUFFBITS level=(1U<<(sizeof(HUFFBITS)*8-1)); int point=0; /* Lookup in Huffman table. */ for(;;) { if(h->val[point][0]==0) { /*end of tree*/ int xx,yy; xx=h->val[point][1]>>4; yy=h->val[point][1]&0xf; if(h->linbits) { if((h->xlen)==(unsigned)xx)xx+=wgetbits(h->linbits); if(xx)if(wgetbit())xx=-xx; if((h->ylen)==(unsigned)yy)yy+=wgetbits(h->linbits); if(yy)if(wgetbit())yy=-yy; } else { if(xx)if(wgetbit())xx=-xx; if(yy)if(wgetbit())yy=-yy; } *x=xx;*y=yy; break; } point+=h->val[point][wgetbit()]; level>>=1; if(!(level || ((unsigned)pointtreelen))) { register int xx,yy; xx=(h->xlen<<1);// set x and y to a medium value as a simple concealment yy=(h->ylen<<1); // h->xlen and h->ylen can't be 1 under tablename 32 // if(xx) if(wgetbit())xx=-xx; // if(yy) if(wgetbit())yy=-yy; *x=xx;*y=yy; break; } } } // Huffman decoder tablenumber>=32 void Mpegtoraw::huffmandecoder_2(const HUFFMANCODETABLE *h, int *x,int *y,int *v,int *w) { HUFFBITS level=(1U<<(sizeof(HUFFBITS)*8-1)); int point=0; /* Lookup in Huffman table. */ for(;;) { if(h->val[point][0]==0) { /*end of tree*/ register int t=h->val[point][1]; if(t&8)*v=1-(wgetbit()<<1); else *v=0; if(t&4)*w=1-(wgetbit()<<1); else *w=0; if(t&2)*x=1-(wgetbit()<<1); else *x=0; if(t&1)*y=1-(wgetbit()<<1); else *y=0; break; } point+=h->val[point][wgetbit()]; level>>=1; if(!(level || ((unsigned)pointtreelen))) { *v=1-(wgetbit()<<1); *w=1-(wgetbit()<<1); *x=1-(wgetbit()<<1); *y=1-(wgetbit()<<1); break; } } } typedef struct { int l[23]; int s[14]; }SFBANDINDEX; static const SFBANDINDEX sfBandIndextable[3][3]= { // MPEG 1 {{{0,4,8,12,16,20,24,30,36,44,52,62,74,90,110,134,162,196,238,288,342,418,576}, {0,4,8,12,16,22,30,40,52,66,84,106,136,192}}, {{0,4,8,12,16,20,24,30,36,42,50,60,72,88,106,128,156,190,230,276,330,384,576}, {0,4,8,12,16,22,28,38,50,64,80,100,126,192}}, {{0,4,8,12,16,20,24,30,36,44,54,66,82,102,126,156,194,240,296,364,448,550,576}, {0,4,8,12,16,22,30,42,58,78,104,138,180,192}}}, // MPEG 2 {{{0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, {0,4,8,12,18,24,32,42,56,74,100,132,174,192}}, {{0,6,12,18,24,30,36,44,54,66,80,96,114,136,162,194,232,278,330,394,464,540,576}, {0,4,8,12,18,26,36,48,62,80,104,136,180,192}}, {{0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, {0,4,8,12,18,26,36,48,62,80,104,134,174,192}}}, // MPEG 2.5 {{{0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, {0,4,8,12,18,26,36,48,62,80,104,134,174,192}}, {{0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, {0,4,8,12,18,26,36,48,62,80,104,134,174,192}}, {{0,12,24,36,48,60,72,88,108,132,160,192,232,280,336,400,476,566,568,570,572,576}, {0,8,16,24,36,52,72,96,124,160,162,164,166,192}}}, }; void Mpegtoraw::layer3huffmandecode(int ch,int gr,int out[SBLIMIT][SSLIMIT]) { layer3grinfo *gi=&(sideinfo.ch[ch].gr[gr]); int part2_3_end=layer3part2start+(gi->part2_3_length); int region1Start,region2Start; int i,e=gi->big_values<<1; /* Find region boundary for short block case. */ if(gi->generalflag) { /* Region2. */ region1Start=36; /* sfb[9/3]*3=36 */ region2Start=576;/* No Region2 for short block case. */ } else { /* Find region boundary for long block case. */ region1Start=sfBandIndextable[mpeg25?2:version][frequency].l[gi->region0_count+1]; region2Start=sfBandIndextable[mpeg25?2:version][frequency].l[gi->region0_count+ gi->region1_count+2]; } /* Read bigvalues area. */ for(i=0;itable_select[0]]; if(region1Start>e)end=e; else end=region1Start; } else if(itable_select[1]]; if(region2Start>e)end=e; else end=region2Start; } else { h=&ht[gi->table_select[2]]; end=e; } if(h->treelen) while(icount1table_select < 2); /* Read count1 area. */ const HUFFMANCODETABLE *h=&ht[gi->count1table_select+32]; //printf("HTALE %p %d\n", h, gi->count1table_select); while(bitwindow.gettotalbit()=ARRAYSIZE) { bitwindow.rewind(bitwindow.gettotalbit()-part2_3_end); return; } } for(;iglobal_gain] * gain_add / 8; REAL *TO_FOUR_THIRDS=TO_FOUR_THIRDSTABLE+FOURTHIRDSTABLENUMBER; //printf("GLOBAL GAIN %f\n", globalgain); /* choose correct scalefactor band per block type, initalize boundary */ /* and apply formula per block type */ if(!gi->generalflag) { /* LONG blocks: 0,1,3 */ int next_cb_boundary; int cb=-1,index=0; REAL factor; do { //printf("%p %p %d %d\n", in, out, cb, ch); next_cb_boundary=sfBandIndex->l[(++cb)+1]; factor=globalgain* layer3twopow2(gi->scalefac_scale,gi->preflag, pretab[cb],scalefactors[ch].l[cb]); for(;indexmixed_block_flag) { int cb=0,index=0; int cb_width; do { cb_width=(sfBandIndex->s[cb+1]-sfBandIndex->s[cb])>>1; for(register int k=0;k<3;k++) { register REAL factor; register int count=cb_width; factor=globalgain* layer3twopow2_1(gi->subblock_gain[k],gi->scalefac_scale, scalefactors[ch].s[k][cb]); do{ out[0][index]=factor*TO_FOUR_THIRDS[in[0][index]];index++; out[0][index]=factor*TO_FOUR_THIRDS[in[0][index]];index++; }while(--count); } cb++; }while(indexl[1]; /* LONG blocks: 0,1,3 */ int index; /* Compute overall (global) scaling. */ { for(int sb=0;sbl[8]) { next_cb_boundary=sfBandIndex->s[4]; next_cb_boundary=MUL3(next_cb_boundary); cb=3; cb_width=sfBandIndex->s[4]-sfBandIndex->s[3]; cb_begin=sfBandIndex->s[3]; cb_begin=MUL3(cb_begin); } else if(indexl[8]) next_cb_boundary=sfBandIndex->l[(++cb)+1]; else { next_cb_boundary=sfBandIndex->s[(++cb)+1]; next_cb_boundary=MUL3(next_cb_boundary); cb_begin=sfBandIndex->s[cb]; cb_width=sfBandIndex->s[cb+1]-cb_begin; cb_begin=MUL3(cb_begin); } } /* LONG block types 0,1,3 & 1st 2 subbands of switched blocks */ out[0][index]*=layer3twopow2(gi->scalefac_scale,gi->preflag, pretab[cb],scalefactors[ch].l[cb]); } for(;indexl[8]) { next_cb_boundary=sfBandIndex->s[4]; next_cb_boundary=MUL3(next_cb_boundary); cb=3; cb_width=sfBandIndex->s[4]-sfBandIndex->s[3]; cb_begin=sfBandIndex->s[3]; cb_begin=(cb_begin<<2)-cb_begin; } else if(indexl[8]) next_cb_boundary=sfBandIndex->l[(++cb)+1]; else { next_cb_boundary=sfBandIndex->s[(++cb)+1]; next_cb_boundary=MUL3(next_cb_boundary); cb_begin=sfBandIndex->s[cb]; cb_width=sfBandIndex->s[cb+1]-cb_begin; cb_begin=MUL3(cb_begin); } } if (cb_width > 0) { int t_index=(index-cb_begin)/cb_width; //printf("%d %d %d %d\n", cb , ch, t_index, cb_width); out[0][index]*=layer3twopow2_1(gi->subblock_gain[t_index], gi->scalefac_scale, scalefactors[ch].s[t_index][cb]); } } } } void Mpegtoraw::layer3fixtostereo(int gr,REAL in[2][SBLIMIT][SSLIMIT]) { layer3grinfo *gi=&(sideinfo.ch[0].gr[gr]); const SFBANDINDEX *sfBandIndex=&(sfBandIndextable[version][frequency]); int ms_stereo=(mode==joint) && (extendedmode & 0x2); int i_stereo =(mode==joint) && (extendedmode & 0x1); if(!inputstereo) { /* mono , bypass xr[0][][] to lr[0][][]*/ // memcpy(out[0][0],in[0][0],ARRAYSIZE*REALSIZE); return; } if(i_stereo) { int i; int is_pos[ARRAYSIZE]; RATIOS is_ratio[ARRAYSIZE]; RATIOS *ratios; if(version)ratios=rat_2[gi->scalefac_compress%2]; else ratios=rat_1; /* initialization */ for(i=0;igeneralflag) { if(gi->mixed_block_flag) // Part I { int max_sfb=0; for(int j=0;j<3;j++) { int sfb,sfbcnt=2; for(sfb=12;sfb>=3;sfb--) { int lines; i=sfBandIndex->s[sfb]; lines=sfBandIndex->s[sfb+1]-i; i=MUL3(i)+(j+1)*lines-1; for(;lines>0;lines--,i--) if(in[1][0][i]!=0.0f) { sfbcnt=sfb; sfb=0;break; // quit loop } } sfb=sfbcnt+1; if(sfb>max_sfb)max_sfb=sfb; for(;sfb<12;sfb++) { int k,t; t=sfBandIndex->s[sfb]; k=sfBandIndex->s[sfb+1]-t; i=MUL3(t)+j*k; t=scalefactors[1].s[j][sfb]; if(t!=7) { RATIOS r=ratios[t]; for(;k>0;k--,i++){ is_pos[i]=t;is_ratio[i]=r;} } else for(;k>0;k--,i++)is_pos[i]=t; } sfb=sfBandIndex->s[10]; sfb=MUL3(sfb)+j*(sfBandIndex->s[11]-sfb); { int k,t; t=sfBandIndex->s[11]; k=sfBandIndex->s[12]-t; i=MUL3(t)+j*k; t=is_pos[sfb]; if(t!=7) { RATIOS r=is_ratio[sfb]; for(;k>0;k--,i++){ is_pos[i]=t;is_ratio[i]=r;} } else for(;k>0;k--,i++)is_pos[i]=t; } } if(max_sfb<=3) { { REAL temp; int k; temp=in[1][0][0];in[1][0][0]=1.0; for(k=3*SSLIMIT-1;in[1][0][k]==0.0;k--); in[1][0][0]=temp; for(i=0;sfBandIndex->l[i]<=k;i++); } { int sfb=i; i=sfBandIndex->l[i]; for(;sfb<8;sfb++) { int t=scalefactors[1].l[sfb]; int k=sfBandIndex->l[sfb+1]-sfBandIndex->l[sfb]; if(t!=7) { RATIOS r=ratios[t]; for(;k>0;k--,i++){ is_pos[i]=t;is_ratio[i]=r;} } else for(;k>0;k--,i++)is_pos[i]=t; } } } } else // Part II { for(int j=0;j<3;j++) { int sfbcnt=-1; int sfb; for(sfb=12;sfb>=0;sfb--) { int lines; { int t; t=sfBandIndex->s[sfb]; lines=sfBandIndex->s[sfb+1]-t; i=MUL3(t)+(j+1)*lines-1; } for(;lines>0;lines--,i--) if(in[1][0][i]!=0.0f) { sfbcnt=sfb; sfb=0;break; // quit loop } } for(sfb=sfbcnt+1;sfb<12;sfb++) { int k,t; t=sfBandIndex->s[sfb]; k=sfBandIndex->s[sfb+1]-t; i=MUL3(t)+j*k; t=scalefactors[1].s[j][sfb]; if(t!=7) { RATIOS r=ratios[t]; for(;k>0;k--,i++){ is_pos[i]=t;is_ratio[i]=r;} } else for(;k>0;k--,i++)is_pos[i]=t; } { int t1=sfBandIndex->s[10], t2=sfBandIndex->s[11]; int k,tt; tt=MUL3(t1)+j*(t2-t1); k =sfBandIndex->s[12]-t2; if(is_pos[tt]!=7) { RATIOS r=is_ratio[tt]; int t=is_pos[tt]; i =MUL3(t1)+j*k; for(;k>0;k--,i++){ is_pos[i]=t;is_ratio[i]=r;} } else for(;k>0;k--,i++)is_pos[i]=7; } } } } else // ms-stereo (Part III) { { REAL temp; int k; temp=in[1][0][0];in[1][0][0]=1.0; for(k=ARRAYSIZE-1;in[1][0][k]==0.0;k--); in[1][0][0]=temp; for(i=0;sfBandIndex->l[i]<=k;i++); } { int sfb; sfb=i; i=sfBandIndex->l[i]; for(;sfb<21;sfb++) { int k,t; k=sfBandIndex->l[sfb+1]-sfBandIndex->l[sfb]; t=scalefactors[1].l[sfb]; if(t!=7) { RATIOS r=ratios[t]; for(;k>0;k--,i++){ is_pos[i]=t;is_ratio[i]=r;} } else for(;k>0;k--,i++)is_pos[i]=t; } } { int k,t,tt; tt=sfBandIndex->l[20]; k=576-sfBandIndex->l[21]; t=is_pos[tt]; //printf("TT %d K %d T %d I %d %d\n", tt, k, t, i, ARRAYSIZE); if(t!=7) { RATIOS r=is_ratio[tt]; for(;k>0 && i < ARRAYSIZE;k--,i++){ is_pos[i]=t; is_ratio[i]=r; } } else for(;k>0 && i < ARRAYSIZE;k--,i++) is_pos[i]=t; } } if(ms_stereo) { i=ARRAYSIZE-1; do{ if(is_pos[i]==7) { register REAL t=in[LS][0][i]; in[LS][0][i]=(t+in[RS][0][i])*0.7071068f; in[RS][0][i]=(t-in[RS][0][i])*0.7071068f; } else { in[RS][0][i]=in[LS][0][i]*is_ratio[i].r; in[LS][0][i]*=is_ratio[i].l; } }while(i--); } else { i=ARRAYSIZE-1; do{ if(is_pos[i]!=7) { in[RS][0][i]=in[LS][0][i]*is_ratio[i].r; in[LS][0][i]*=is_ratio[i].l; } }while(i--); } } else { if(ms_stereo) { int i=ARRAYSIZE-1; do{ register REAL t=in[LS][0][i]; in[LS][0][i]=(t+in[RS][0][i])*0.7071068f; in[RS][0][i]=(t-in[RS][0][i])*0.7071068f; }while(i--); } } // channels==2 } inline void layer3reorder_1(int version,int frequency, REAL in[SBLIMIT][SSLIMIT], REAL out[SBLIMIT][SSLIMIT]) { const SFBANDINDEX *sfBandIndex=&(sfBandIndextable[version][frequency]); int sfb,sfb_start,sfb_lines; /* NO REORDER FOR LOW 2 SUBBANDS */ out[0][ 0]=in[0][ 0];out[0][ 1]=in[0][ 1];out[0][ 2]=in[0][ 2]; out[0][ 3]=in[0][ 3];out[0][ 4]=in[0][ 4];out[0][ 5]=in[0][ 5]; out[0][ 6]=in[0][ 6];out[0][ 7]=in[0][ 7];out[0][ 8]=in[0][ 8]; out[0][ 9]=in[0][ 9];out[0][10]=in[0][10];out[0][11]=in[0][11]; out[0][12]=in[0][12];out[0][13]=in[0][13];out[0][14]=in[0][14]; out[0][15]=in[0][15];out[0][16]=in[0][16];out[0][17]=in[0][17]; out[1][ 0]=in[1][ 0];out[1][ 1]=in[1][ 1];out[1][ 2]=in[1][ 2]; out[1][ 3]=in[1][ 3];out[1][ 4]=in[1][ 4];out[1][ 5]=in[1][ 5]; out[1][ 6]=in[1][ 6];out[1][ 7]=in[1][ 7];out[1][ 8]=in[1][ 8]; out[1][ 9]=in[1][ 9];out[1][10]=in[1][10];out[1][11]=in[1][11]; out[1][12]=in[1][12];out[1][13]=in[1][13];out[1][14]=in[1][14]; out[1][15]=in[1][15];out[1][16]=in[1][16];out[1][17]=in[1][17]; /* REORDERING FOR REST SWITCHED SHORT */ for(sfb=3,sfb_start=sfBandIndex->s[3], sfb_lines=sfBandIndex->s[4]-sfb_start; sfb<13; sfb++,sfb_start=sfBandIndex->s[sfb], (sfb_lines=sfBandIndex->s[sfb+1]-sfb_start)) { for(int freq=0;freqs[1]; sfb<13; sfb++,sfb_start=sfBandIndex->s[sfb], (sfb_lines=sfBandIndex->s[sfb+1]-sfb_start)) { for(int freq=0;freqgeneralflag) { if(gi->mixed_block_flag) { //fprintf(stderr,"Notchecked!"); layer3reorder_1 (mpeg25?2:version,frequency,in,out); // Not checked... layer3antialias_1(out); } else layer3reorder_2(mpeg25?2:version,frequency,in,out); } else layer3antialias_2(in,out); } static void dct36(REAL *inbuf,REAL *prevblk1,REAL *prevblk2,REAL *wi,REAL *out) { #define MACRO0(v) { \ REAL tmp; \ out2[9+(v)]=(tmp=sum0+sum1)*wi[27+(v)]; \ out2[8-(v)]=tmp * wi[26-(v)]; } \ sum0-=sum1; \ ts[SBLIMIT*(8-(v))]=out1[8-(v)]+sum0*wi[8-(v)]; \ ts[SBLIMIT*(9+(v))]=out1[9+(v)]+sum0*wi[9+(v)]; #define MACRO1(v) { \ REAL sum0,sum1; \ sum0=tmp1a+tmp2a; \ sum1=(tmp1b+tmp2b)*hsec_36[(v)]; \ MACRO0(v); } #define MACRO2(v) { \ REAL sum0,sum1; \ sum0=tmp2a-tmp1a; \ sum1=(tmp2b-tmp1b) * hsec_36[(v)]; \ MACRO0(v); } { register REAL *in = inbuf; in[17]+=in[16];in[16]+=in[15];in[15]+=in[14];in[14]+=in[13]; in[13]+=in[12];in[12]+=in[11];in[11]+=in[10];in[10]+=in[ 9]; in[ 9]+=in[ 8];in[ 8]+=in[ 7];in[ 7]+=in[ 6];in[ 6]+=in[ 5]; in[ 5]+=in[ 4];in[ 4]+=in[ 3];in[ 3]+=in[ 2];in[ 2]+=in[ 1]; in[ 1]+=in[ 0]; in[17]+=in[15];in[15]+=in[13];in[13]+=in[11];in[11]+=in[ 9]; in[ 9]+=in[ 7];in[7] +=in[ 5];in[ 5]+=in[ 3];in[ 3]+=in[ 1]; { register REAL *c = cos_18; register REAL *out2 = prevblk2; register REAL *out1 = prevblk1; register REAL *ts = out; REAL ta33,ta66,tb33,tb66; ta33=in[2*3+0]*c[3]; ta66=in[2*6+0]*c[6]; tb33=in[2*3+1]*c[3]; tb66=in[2*6+1]*c[6]; { REAL tmp1a,tmp2a,tmp1b,tmp2b; tmp1a= in[2*1+0]*c[1]+ta33 +in[2*5+0]*c[5]+in[2*7+0]*c[7]; tmp1b= in[2*1+1]*c[1]+tb33 +in[2*5+1]*c[5]+in[2*7+1]*c[7]; tmp2a=in[2*0+0]+in[2*2+0]*c[2]+in[2*4+0]*c[4]+ta66 +in[2*8+0]*c[8]; tmp2b=in[2*0+1]+in[2*2+1]*c[2]+in[2*4+1]*c[4]+tb66 +in[2*8+1]*c[8]; MACRO1(0); MACRO2(8); } { REAL tmp1a,tmp2a,tmp1b,tmp2b; tmp1a=(in[2*1+0]-in[2*5+0]-in[2*7+0])*c[3]; tmp1b=(in[2*1+1]-in[2*5+1]-in[2*7+1])*c[3]; tmp2a=(in[2*2+0]-in[2*4+0]-in[2*8+0])*c[6]-in[2*6+0]+in[2*0+0]; tmp2b=(in[2*2+1]-in[2*4+1]-in[2*8+1])*c[6]-in[2*6+1]+in[2*0+1]; MACRO1(1); MACRO2(7); } { REAL tmp1a,tmp2a,tmp1b,tmp2b; tmp1a= in[2*1+0]*c[5]-ta33 -in[2*5+0]*c[7]+in[2*7+0]*c[1]; tmp1b= in[2*1+1]*c[5]-tb33 -in[2*5+1]*c[7]+in[2*7+1]*c[1]; tmp2a=in[2*0+0]-in[2*2+0]*c[8]-in[2*4+0]*c[2]+ta66 +in[2*8+0]*c[4]; tmp2b=in[2*0+1]-in[2*2+1]*c[8]-in[2*4+1]*c[2]+tb66 +in[2*8+1]*c[4]; MACRO1(2); MACRO2(6); } { REAL tmp1a,tmp2a,tmp1b,tmp2b; tmp1a= in[2*1+0]*c[7]-ta33 +in[2*5+0]*c[1]-in[2*7+0]*c[5]; tmp1b= in[2*1+1]*c[7]-tb33 +in[2*5+1]*c[1]-in[2*7+1]*c[5]; tmp2a=in[2*0+0]-in[2*2+0]*c[4]+in[2*4+0]*c[8]+ta66 -in[2*8+0]*c[2]; tmp2b=in[2*0+1]-in[2*2+1]*c[4]+in[2*4+1]*c[8]+tb66 -in[2*8+1]*c[2]; MACRO1(3); MACRO2(5); } { REAL sum0,sum1; sum0= in[2*0+0]-in[2*2+0]+in[2*4+0]-in[2*6+0]+in[2*8+0]; sum1=(in[2*0+1]-in[2*2+1]+in[2*4+1]-in[2*6+1]+in[2*8+1])*hsec_36[4]; MACRO0(4); } } } } static void dct12(REAL *in,REAL *prevblk1,REAL *prevblk2,register REAL *wi,register REAL *out) { #define DCT12_PART1 \ in5=in[5*3]; \ in5+=(in4=in[4*3]); \ in4+=(in3=in[3*3]); \ in3+=(in2=in[2*3]); \ in2+=(in1=in[1*3]); \ in1+=(in0=in[0*3]); \ \ in5+=in3;in3+=in1; \ \ in2*=cos1_6; \ in3*=cos1_6; #define DCT12_PART2 \ in0+=in4*cos2_6; \ \ in4=in0+in2; \ in0-=in2; \ \ in1+=in5*cos2_6; \ \ in5=(in1+in3)*hsec_12[0]; \ in1=(in1-in3)*hsec_12[2]; \ \ in3=in4+in5; \ in4-=in5; \ \ in2=in0+in1; \ in0-=in1; { REAL in0,in1,in2,in3,in4,in5; register REAL *pb1=prevblk1; out[SBLIMIT*0]=pb1[0];out[SBLIMIT*1]=pb1[1];out[SBLIMIT*2]=pb1[2]; out[SBLIMIT*3]=pb1[3];out[SBLIMIT*4]=pb1[4];out[SBLIMIT*5]=pb1[5]; DCT12_PART1; { REAL tmp0,tmp1=(in0-in4); { register REAL tmp2=(in1-in5)*hsec_12[1]; tmp0=tmp1+tmp2; tmp1-=tmp2; } out[(17-1)*SBLIMIT]=pb1[17-1]+tmp0*wi[11-1]; out[(12+1)*SBLIMIT]=pb1[12+1]+tmp0*wi[ 6+1]; out[(6 +1)*SBLIMIT]=pb1[6 +1]+tmp1*wi[ 1 ]; out[(11-1)*SBLIMIT]=pb1[11-1]+tmp1*wi[ 5-1]; } DCT12_PART2; out[(17-0)*SBLIMIT]=pb1[17-0]+in2*wi[11-0]; out[(12+0)*SBLIMIT]=pb1[12+0]+in2*wi[ 6+0]; out[(12+2)*SBLIMIT]=pb1[12+2]+in3*wi[ 6+2]; out[(17-2)*SBLIMIT]=pb1[17-2]+in3*wi[11-2]; out[( 6+0)*SBLIMIT]=pb1[ 6+0]+in0*wi[0]; out[(11-0)*SBLIMIT]=pb1[11-0]+in0*wi[5-0]; out[( 6+2)*SBLIMIT]=pb1[ 6+2]+in4*wi[2]; out[(11-2)*SBLIMIT]=pb1[11-2]+in4*wi[5-2]; } in++; { REAL in0,in1,in2,in3,in4,in5; register REAL *pb2 = prevblk2; DCT12_PART1; { REAL tmp0,tmp1=(in0-in4); { REAL tmp2=(in1-in5)*hsec_12[1]; tmp0=tmp1+tmp2; tmp1-=tmp2; } pb2[5-1]=tmp0*wi[11-1]; pb2[0+1]=tmp0*wi[6+1]; out[(12+1)*SBLIMIT]+=tmp1*wi[1]; out[(17-1)*SBLIMIT]+=tmp1*wi[5-1]; } DCT12_PART2; pb2[5-0]=in2*wi[11-0]; pb2[0+0]=in2*wi[6+0]; pb2[0+2]=in3*wi[6+2]; pb2[5-2]=in3*wi[11-2]; out[(12+0)*SBLIMIT]+=in0*wi[0]; out[(17-0)*SBLIMIT]+=in0*wi[5-0]; out[(12+2)*SBLIMIT]+=in4*wi[2]; out[(17-2)*SBLIMIT]+=in4*wi[5-2]; } in++; { REAL in0,in1,in2,in3,in4,in5; register REAL *pb2 = prevblk2; pb2[12]=pb2[13]=pb2[14]=pb2[15]=pb2[16]=pb2[17]=0.0; DCT12_PART1; { REAL tmp0,tmp1=(in0-in4); { REAL tmp2=(in1-in5)*hsec_12[1]; tmp0=tmp1+tmp2; tmp1-=tmp2; } pb2[11-1]=tmp0*wi[11-1]; pb2[ 6+1]=tmp0*wi[6+1]; pb2[ 0+1]+=tmp1*wi[1]; pb2[ 5-1]+=tmp1*wi[5-1]; } DCT12_PART2; pb2[11-0]=in2*wi[11-0]; pb2[ 6+0]=in2*wi[ 6+0]; pb2[ 6+2]=in3*wi[ 6+2]; pb2[11-2]=in3*wi[11-2]; pb2[ 0+0]+=in0*wi[0 ]; pb2[ 5-0]+=in0*wi[5-0]; pb2[ 0+2]+=in4*wi[2 ]; pb2[ 5-2]+=in4*wi[5-2]; } } void Mpegtoraw::layer3hybrid(int ch,int gr,REAL in[SBLIMIT][SSLIMIT], REAL out[SSLIMIT][SBLIMIT]) { layer3grinfo *gi=&(sideinfo.ch[ch].gr[gr]); int bt1,bt2; REAL *prev1,*prev2; prev1=prevblck[ch][currentprevblock][0]; prev2=prevblck[ch][currentprevblock^1][0]; bt1 = gi->mixed_block_flag ? 0 : gi->block_type; bt2 = gi->block_type; { REAL *ci=(REAL *)in, *co=(REAL *)out; int i; if(downfrequency)i=(SBLIMIT/2)-2; else i=SBLIMIT-2; if(bt2==2) { if(!bt1) { dct36(ci,prev1,prev2,win[0],co); ci+=SSLIMIT;prev1+=SSLIMIT;prev2+=SSLIMIT;co++; dct36(ci,prev1,prev2,win[0],co); } else { dct12(ci,prev1,prev2,win[2],co); ci+=SSLIMIT;prev1+=SSLIMIT;prev2+=SSLIMIT;co++; dct12(ci,prev1,prev2,win[2],co); } do{ ci+=SSLIMIT;prev1+=SSLIMIT;prev2+=SSLIMIT;co++; dct12(ci,prev1,prev2,win[2],co); }while(--i); } else { dct36(ci,prev1,prev2,win[bt1],co); ci+=SSLIMIT;prev1+=SSLIMIT;prev2+=SSLIMIT;co++; dct36(ci,prev1,prev2,win[bt1],co); do { ci+=SSLIMIT;prev1+=SSLIMIT;prev2+=SSLIMIT;co++; dct36(ci,prev1,prev2,win[bt2],co); }while(--i); } } } #define NEG(a) (a)=-(a) void Mpegtoraw::extractlayer3(void) { if(version) { extractlayer3_2(); return; } { int main_data_end,flush_main; int bytes_to_discard; layer3getsideinfo(); if(issync()) { for(register int i=layer3slots;i>0;i--) // read main data. bitwindow.putbyte(getbyte()); } else { for(register int i=layer3slots;i>0;i--) // read main data. bitwindow.putbyte(getbits8()); } main_data_end=bitwindow.gettotalbit()>>3;// of previous frame if((flush_main=(bitwindow.gettotalbit() & 0x7))) { bitwindow.forward(8-flush_main); main_data_end++; } bytes_to_discard=layer3framestart-(main_data_end+sideinfo.main_data_begin); if(main_data_end>WINDOWSIZE) { layer3framestart-=WINDOWSIZE; bitwindow.rewind(WINDOWSIZE*8); } layer3framestart+=layer3slots; bitwindow.wrap(); if(bytes_to_discard<0)return; bitwindow.forward(bytes_to_discard<<3); } for(int gr=0;gr<2;gr++) { union { int is [SBLIMIT][SSLIMIT]; REAL hin [2][SBLIMIT][SSLIMIT]; }b1; union { REAL ro [2][SBLIMIT][SSLIMIT]; REAL lr [2][SBLIMIT][SSLIMIT]; REAL hout [2][SSLIMIT][SBLIMIT]; }b2; layer3part2start=bitwindow.gettotalbit(); layer3getscalefactors (LS,gr); layer3huffmandecode (LS,gr ,b1.is); layer3dequantizesample(LS,gr,b1.is,b2.ro[LS]); if(inputstereo) { layer3part2start=bitwindow.gettotalbit(); layer3getscalefactors (RS,gr); layer3huffmandecode (RS,gr ,b1.is); layer3dequantizesample(RS,gr,b1.is,b2.ro[RS]); } layer3fixtostereo(gr,b2.ro); // b2.ro -> b2.lr currentprevblock^=1; layer3reorderandantialias(LS,gr,b2.lr[LS],b1.hin[LS]); layer3hybrid (LS,gr,b1.hin[LS],b2.hout[LS]); if(outputstereo) { layer3reorderandantialias(RS,gr,b2.lr[RS],b1.hin[RS]); layer3hybrid (RS,gr,b1.hin[RS],b2.hout[RS]); register int i=2*SSLIMIT*SBLIMIT-1; do{ NEG(b2.hout[0][0][i ]);NEG(b2.hout[0][0][i- 2]); NEG(b2.hout[0][0][i- 4]);NEG(b2.hout[0][0][i- 6]); NEG(b2.hout[0][0][i- 8]);NEG(b2.hout[0][0][i-10]); NEG(b2.hout[0][0][i-12]);NEG(b2.hout[0][0][i-14]); NEG(b2.hout[0][0][i-16]);NEG(b2.hout[0][0][i-18]); NEG(b2.hout[0][0][i-20]);NEG(b2.hout[0][0][i-22]); NEG(b2.hout[0][0][i-24]);NEG(b2.hout[0][0][i-26]); NEG(b2.hout[0][0][i-28]);NEG(b2.hout[0][0][i-30]); }while((i-=2*SBLIMIT)>0); } else { register int i=SSLIMIT*SBLIMIT-1; do{ NEG(b2.hout[0][0][i ]);NEG(b2.hout[0][0][i- 2]); NEG(b2.hout[0][0][i- 4]);NEG(b2.hout[0][0][i- 6]); NEG(b2.hout[0][0][i- 8]);NEG(b2.hout[0][0][i-10]); NEG(b2.hout[0][0][i-12]);NEG(b2.hout[0][0][i-14]); NEG(b2.hout[0][0][i-16]);NEG(b2.hout[0][0][i-18]); NEG(b2.hout[0][0][i-20]);NEG(b2.hout[0][0][i-22]); NEG(b2.hout[0][0][i-24]);NEG(b2.hout[0][0][i-26]); NEG(b2.hout[0][0][i-28]);NEG(b2.hout[0][0][i-30]); }while((i-=2*SBLIMIT)>0); } for(int ss=0;ss0;i--) // read main data. bitwindow.putbyte(getbyte()); } else { for(register int i=layer3slots;i>0;i--) // read main data. bitwindow.putbyte(getbits8()); } bitwindow.wrap(); main_data_end=bitwindow.gettotalbit()>>3;// of previous frame if((flush_main=(bitwindow.gettotalbit() & 0x7))) { bitwindow.forward(8-flush_main); main_data_end++; } bytes_to_discard=layer3framestart-main_data_end-sideinfo.main_data_begin; if(main_data_end>WINDOWSIZE) { layer3framestart-=WINDOWSIZE; bitwindow.rewind(WINDOWSIZE*8); } layer3framestart+=layer3slots; if(bytes_to_discard<0)return; bitwindow.forward(bytes_to_discard<<3); } // for(int gr=0;gr<2;gr++) { union { int is [SBLIMIT][SSLIMIT]; REAL hin [2][SBLIMIT][SSLIMIT]; }b1; union { REAL ro [2][SBLIMIT][SSLIMIT]; REAL lr [2][SBLIMIT][SSLIMIT]; REAL hout [2][SSLIMIT][SBLIMIT]; }b2; layer3part2start=bitwindow.gettotalbit(); layer3getscalefactors_2(LS); layer3huffmandecode (LS,0 ,b1.is); layer3dequantizesample (LS,0,b1.is,b2.ro[LS]); if(inputstereo) { layer3part2start=bitwindow.gettotalbit(); layer3getscalefactors_2(RS); layer3huffmandecode (RS,0 ,b1.is); layer3dequantizesample (RS,0,b1.is,b2.ro[RS]); } layer3fixtostereo(0,b2.ro); // b2.ro -> b2.lr currentprevblock^=1; layer3reorderandantialias(LS,0,b2.lr[LS],b1.hin[LS]); layer3hybrid (LS,0,b1.hin[LS],b2.hout[LS]); if(outputstereo) { layer3reorderandantialias(RS,0,b2.lr[RS],b1.hin[RS]); layer3hybrid (RS,0,b1.hin[RS],b2.hout[RS]); register int i=2*SSLIMIT*SBLIMIT-1; do{ NEG(b2.hout[0][0][i-16]);NEG(b2.hout[0][0][i-18]); NEG(b2.hout[0][0][i-20]);NEG(b2.hout[0][0][i-22]); NEG(b2.hout[0][0][i-24]);NEG(b2.hout[0][0][i-26]); NEG(b2.hout[0][0][i-28]);NEG(b2.hout[0][0][i-30]); }while((i-=2*SBLIMIT)>0); } else { register int i=SSLIMIT*SBLIMIT-1; do{ NEG(b2.hout[0][0][i-16]);NEG(b2.hout[0][0][i-18]); NEG(b2.hout[0][0][i-20]);NEG(b2.hout[0][0][i-22]); NEG(b2.hout[0][0][i-24]);NEG(b2.hout[0][0][i-26]); NEG(b2.hout[0][0][i-28]);NEG(b2.hout[0][0][i-30]); }while((i-=2*SBLIMIT)>0); } for(int ss=0;ss #include AVM_BEGIN_NAMESPACE; /****************/ /* Sound Errors */ /****************/ // General error #define SOUND_ERROR_OK 0 #define SOUND_ERROR_FINISH -1 // Device error (for player) #define SOUND_ERROR_DEVOPENFAIL 1 #define SOUND_ERROR_DEVBUSY 2 #define SOUND_ERROR_DEVBADBUFFERSIZE 3 #define SOUND_ERROR_DEVCTRLERROR 4 // Sound file (for reader) #define SOUND_ERROR_FILEOPENFAIL 5 #define SOUND_ERROR_FILEREADFAIL 6 // Network #define SOUND_ERROR_UNKNOWNPROXY 7 #define SOUND_ERROR_UNKNOWNHOST 8 #define SOUND_ERROR_SOCKET 9 #define SOUND_ERROR_CONNECT 10 #define SOUND_ERROR_FDOPEN 11 #define SOUND_ERROR_HTTPFAIL 12 #define SOUND_ERROR_HTTPWRITEFAIL 13 #define SOUND_ERROR_TOOMANYRELOC 14 // Miscellneous (for translater) #define SOUND_ERROR_MEMORYNOTENOUGH 15 #define SOUND_ERROR_EOF 16 #define SOUND_ERROR_BAD 17 #define SOUND_ERROR_THREADFAIL 18 #define SOUND_ERROR_UNKNOWN 19 /**************************/ /* Define values for MPEG */ /**************************/ #define SCALEBLOCK 12 #define CALCBUFFERSIZE 512 #define MAXSUBBAND 32 #define MAXCHANNEL 2 #define MAXTABLE 2 #define SCALE 32768 #define MAXSCALE (SCALE-1) #define MINSCALE (-SCALE) #define RAWDATASIZE (2*2*32*SSLIMIT) enum { LS = 0, RS = 1 }; #define SSLIMIT 18 #define SBLIMIT 32 #define WINDOWSIZE 4096 // Huffmancode #define HTN 34 /*******************************************/ /* Define values for Microsoft WAVE format */ /*******************************************/ #define RIFF 0x46464952 #define WAVE 0x45564157 #define FMT 0x20746D66 #define DATA 0x61746164 #define PCM_CODE 1 #define WAVE_MONO 1 #define WAVE_STEREO 2 #define MODE_MONO 0 #define MODE_STEREO 1 /********************/ /* Type definitions */ /********************/ typedef float REAL; #if defined(__sun__) && defined(__svr4__) typedef unsigned int u_int32_t; typedef unsigned short u_int16_t; #endif typedef struct _waveheader { u_int32_t main_chunk; // 'RIFF' u_int32_t length; // filelen u_int32_t chunk_type; // 'WAVE' u_int32_t sub_chunk; // 'fmt ' u_int32_t sc_len; // length of sub_chunk, =16 u_int16_t format; // should be 1 for PCM-code u_int16_t modus; // 1 Mono, 2 Stereo u_int32_t sample_fq; // frequence of sample u_int32_t byte_p_sec; u_int16_t byte_p_spl; // samplesize; 1 or 2 bytes u_int16_t bit_p_spl; // 8, 12 or 16 bit u_int32_t data_chunk; // 'data' u_int32_t data_length; // samplecount }WAVEHEADER; typedef struct { bool generalflag; unsigned int part2_3_length; unsigned int big_values; unsigned int global_gain; unsigned int scalefac_compress; unsigned int window_switching_flag; unsigned int block_type; unsigned int mixed_block_flag; unsigned int table_select[3]; unsigned int subblock_gain[3]; unsigned int region0_count; unsigned int region1_count; unsigned int preflag; unsigned int scalefac_scale; unsigned int count1table_select; }layer3grinfo; typedef struct { unsigned main_data_begin; unsigned private_bits; struct { unsigned scfsi[4]; layer3grinfo gr[2]; }ch[2]; }layer3sideinfo; typedef struct { int l[23]; /* [cb] */ int s[3][13]; /* [window][cb] */ }layer3scalefactor; /* [ch] */ typedef struct { int tablename; unsigned int xlen,ylen; unsigned int linbits; unsigned int treelen; const unsigned int (*val)[2]; }HUFFMANCODETABLE; /*********************************/ /* Sound input interface classes */ /*********************************/ // Superclass for Inputbitstream // Yet, Temporary // Class for Mpeg layer3 class Mpegbitwindow { public: Mpegbitwindow(){bitindex=point=0;}; void initialize(void) {bitindex=point=0;}; int gettotalbit(void) const {return bitindex;}; void putbyte(int c) {buffer[point&(WINDOWSIZE-1)]=c;point++;}; void wrap(void) { int p=bitindex>>3; point&=(WINDOWSIZE-1); if(p>=point) { for(register int i=4;i>3)&(WINDOWSIZE-1)]>>(7-(bitindex&7)))&1; register int r=(buffer[bitindex>>3]>>(7-(bitindex&7)))&1; bitindex++; return r; } int getbits9(int bits) { register unsigned short a; //#ifndef WORDS_BIGENDIAN { // int offset=(bitindex>>3)&(WINDOWSIZE-1); int offset=bitindex>>3; a = (unsigned char)buffer[offset] << 8; a |= (unsigned char)buffer[offset+1]; } //#else //wrong a=((unsigned short *)(buffer+((bixindex>>3)&(WINDOWSIZE-1)))); // a=*((unsigned short *)(buffer+((bitindex>>3)))); //#endif a<<=(bitindex&7); bitindex+=bits; return (int)((unsigned int)(a>>(16-bits))); } private: int point,bitindex; char buffer[2*WINDOWSIZE]; }; // Class for converting mpeg format to raw format class Mpegtoraw : public IAudioDecoder, public IRtConfig { private: /*********************************/ /* this was added for AVI player */ /*********************************/ const unsigned char* local_src_buffer; int local_src_buffer_size; unsigned char* local_dest_buffer; int local_dest_buffer_size; int gain_add; bool flushed; public: /* returns number of bytes written to output_buffer */ /* input_size contains number of bytes used in input_buffer */ /* if format!=0, writes info about audio stream into it */ /* output_buffer MUST be large enough !!! */ int Convert(const void* in_data, size_t in_size, void* out_data, size_t out_size, size_t* size_read, size_t* size_written); void Flush() { flushed = true; } IRtConfig* GetRtConfig() { return this; } const avm::vector& GetAttrs() const; int GetValue(const char* name, int* value) const; int SetValue(const char* name, int value); // this mpeg lib seems to have problems whitout this //uint_t GetMinSize() const { return IAudioDecoder::GetMinSize() * 2; } /*****************************/ /* Constant tables for layer */ /*****************************/ private: static const int bitrate[2][3][15],frequencies[3][3]; static const REAL scalefactorstable[64]; static const HUFFMANCODETABLE ht[HTN]; static const REAL filter[512]; static REAL hcos_64[16],hcos_32[8],hcos_16[4],hcos_8[2],hcos_4; /*************************/ /* MPEG header variables */ /*************************/ private: int layer,protection,bitrateindex,padding,extendedmode; enum _mpegversion {mpeg1,mpeg2} version; enum _mode {fullstereo,joint,dual,single} mode; enum _frequency {frequency44100,frequency48000,frequency32000} frequency; /*******************************************/ /* Functions getting MPEG header variables */ /*******************************************/ public: // General int getversion(void) const {return version;}; int getlayer(void) const {return layer;}; bool getcrccheck(void) const {return (!protection);}; // Stereo or not int getmode(void) const {return mode;}; bool isstereo(void) const {return (getmode()!=single);}; // Frequency and bitrate int getfrequency(void) const {return frequencies[version][frequency];}; int getbitrate(void) const {return bitrate[version][layer-1][bitrateindex];}; /***************************************/ /* Interface for setting music quality */ /***************************************/ private: bool forcetomonoflag; int downfrequency; public: void setforcetomono(bool flag); void setdownfrequency(int value); /******************************************/ /* Functions getting other MPEG variables */ /******************************************/ public: bool getforcetomono(void); int getdownfrequency(void); int getpcmperframe(void); /******************************/ /* Frame management variables */ /******************************/ private: int currentframe,totalframe; int decodeframe; // int *frameoffsets; /******************************/ /* Frame management functions */ /******************************/ public: int getcurrentframe(void) const {return currentframe;}; int gettotalframe(void) const {return totalframe;}; void setframe(int framenumber); /***************************************/ /* Variables made by MPEG-Audio header */ /***************************************/ private: int tableindex,channelbitrate; int stereobound,subbandnumber,inputstereo,outputstereo; REAL scalefactor; int framesize; bool mpeg25; /********************/ /* Song information */ /********************/ /* private: struct { char name [30+1]; char musican[30+1]; char type [30+1]; char year [ 7+1]; char etc [25+1]; }song; */ /* Song information functions */ /* const char *getsongname(void) const { return (const char *)song.name; }; const char *getmusican (void) const { return (const char *)song.musican;}; const char *getsongtype(void) const { return (const char *)song.type; }; const char *getsongyear(void) const { return (const char *)song.year; }; const char *getsongetc (void) const { return (const char *)song.etc; }; */ /*******************/ /* Mpegtoraw class */ /*******************/ public: Mpegtoraw(const CodecInfo&, const WAVEFORMATEX*); ~Mpegtoraw(); bool run(int frames); int geterrorcode(void) {return __errorcode;}; void clearbuffer(void); private: int __errorcode; bool seterrorcode(int errorno){__errorcode=errorno;return false;}; /*****************************/ /* Loading MPEG-Audio stream */ /*****************************/ private: // Soundinputstream *loader; // Interface union { unsigned char store[4]; unsigned int current; }u; // char buffer[4096]; const unsigned char* buffer; int bitindex; bool fillbuffer(unsigned size) { bitindex=0; if(local_src_buffer_size<(int)size) return false; else { buffer=local_src_buffer; local_src_buffer+=size; local_src_buffer_size-=size; return true; } }; void unwind(int z) { local_src_buffer_size+=z; local_src_buffer-=z; } void sync(void) {bitindex=(bitindex+7)&0xFFFFFFF8;}; bool issync(void){return (bitindex&7);}; int getbits(int bits); int getbyte(void) { int r=(unsigned char)buffer[bitindex>>3]; bitindex+=8; return r; } int getbits9(int bits) { register unsigned short a; //#ifndef WORDS_BIGENDIAN { int offset=bitindex>>3; a = (unsigned char)buffer[offset] << 8; a |= (unsigned char)buffer[offset+1]; } //#else // a=*((unsigned short *)(buffer+((bitindex>>3)))); //#endif a<<=(bitindex&7); bitindex+=bits; return (int)((unsigned int)(a>>(16-bits))); } int getbits8(void) { register unsigned short a; //#ifndef WORDS_BIGENDIAN { int offset=bitindex>>3; a = (unsigned char)buffer[offset] << 8; a |= (unsigned char)buffer[offset+1]; } //#else // a=*((unsigned short *)(buffer+((bitindex>>3)))); //#endif a<<=(bitindex&7); bitindex+=8; return (int)((unsigned int)(a>>8)); } int getbit(void) { register int r=(buffer[bitindex>>3]>>(7-(bitindex&7)))&1; bitindex++; return r; } /********************/ /* Global variables */ /********************/ private: int lastfrequency,laststereo; // for Layer3 int layer3slots,layer3framestart,layer3part2start; REAL prevblck[2][2][SBLIMIT][SSLIMIT]; int currentprevblock; layer3sideinfo sideinfo; layer3scalefactor scalefactors[2]; //#define MPEGNOINSTRUMENTFUNCTION __attribute__ ((no_instrument_function)) #define MPEGNOINSTRUMENTFUNCTION Mpegbitwindow bitwindow; int wgetbit(void) MPEGNOINSTRUMENTFUNCTION { return bitwindow.getbit(); } int wgetbits9(int bits) MPEGNOINSTRUMENTFUNCTION { return bitwindow.getbits9(bits); } int wgetbits (int bits) MPEGNOINSTRUMENTFUNCTION { return bitwindow.getbits (bits); } /*************************************/ /* Decoding functions for each layer */ /*************************************/ private: bool loadheader(void); // // Subbandsynthesis // REAL calcbufferL[2][CALCBUFFERSIZE],calcbufferR[2][CALCBUFFERSIZE]; int currentcalcbuffer,calcbufferoffset; void computebuffer(REAL *fraction,REAL buffer[2][CALCBUFFERSIZE]); void generatesingle(void); void generate(void) MPEGNOINSTRUMENTFUNCTION; #undef MPEGNOINSTRUMENTFUNCTION void subbandsynthesis(REAL *fractionL,REAL *fractionR); void computebuffer_2(REAL *fraction,REAL buffer[2][CALCBUFFERSIZE]); void generatesingle_2(void); void generate_2(void); void subbandsynthesis_2(REAL *fractionL,REAL *fractionR); // Extractor void extractlayer1(void); // MPEG-1 void extractlayer2(void); void extractlayer3(void); void extractlayer3_2(void); // MPEG-2 // Functions for layer 3 void layer3initialize(void); bool layer3getsideinfo(void); bool layer3getsideinfo_2(void); void layer3getscalefactors(int ch,int gr); void layer3getscalefactors_2(int ch); void layer3huffmandecode(int ch,int gr,int out[SBLIMIT][SSLIMIT]); void layer3dequantizesample(int ch,int gr,int in[SBLIMIT][SSLIMIT], REAL out[SBLIMIT][SSLIMIT]); void layer3fixtostereo(int gr,REAL in[2][SBLIMIT][SSLIMIT]); void layer3reorderandantialias(int ch,int gr,REAL in[SBLIMIT][SSLIMIT], REAL out[SBLIMIT][SSLIMIT]); void layer3hybrid(int ch,int gr,REAL in[SBLIMIT][SSLIMIT], REAL out[SSLIMIT][SBLIMIT]); void huffmandecoder_1(const HUFFMANCODETABLE *h,int *x,int *y); void huffmandecoder_2(const HUFFMANCODETABLE *h,int *x,int *y,int *v,int *w); /********************/ /* Playing raw data */ /********************/ private: int getbytedirect() { local_src_buffer_size--; return (local_src_buffer_size>=0)?(*local_src_buffer++):(-1); } int eof() { return (local_src_buffer_size<0); } void clearrawdata(void) { rawdataoffset=0; } void putraw(short int pcm) { rawdata[rawdataoffset++]=pcm; } int flushrawdata(void); int rawdataoffset; short int rawdata[RAWDATASIZE]; }; AVM_END_NAMESPACE; #endif // _L__SOUND__ avifile-0.7.48~20090503.ds/plugins/libmpeg_audiodec/mpegtable.cpp0000644000175000017500000002263107474366702023365 0ustar yavoryavor/* MPEG/WAVE Sound library (C) 1997 by Jung woo-jae */ // Mpegtable.cc // It has tables for MPEG layer 1, 2 and a part of layer 3 #include "mpegsound.h" AVM_BEGIN_NAMESPACE; // For header const int Mpegtoraw::frequencies[3][3]= { {44100,48000,32000}, // MPEG 1 {22050,24000,16000}, // MPEG 2 {11025, 12000, 8000} }; const int Mpegtoraw::bitrate[2][3][15]= { // MPEG 1 {{0,32,64,96,128,160,192,224,256,288,320,352,384,416,448}, {0,32,48,56,64,80,96,112,128,160,192,224,256,320,384}, {0,32,40,48,56,64,80,96,112,128,160,192,224,256,320}}, // MPEG 2 {{0,32,48,56,64,80,96,112,128,144,160,176,192,224,256}, {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160}, {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160}} }; // Mpeg general table const REAL Mpegtoraw::scalefactorstable[64] = { 2.00000000000000, 1.58740105196820, 1.25992104989487, 1.00000000000000, 0.79370052598410, 0.62996052494744, 0.50000000000000, 0.39685026299205, 0.31498026247372, 0.25000000000000, 0.19842513149602, 0.15749013123686, 0.12500000000000, 0.09921256574801, 0.07874506561843, 0.06250000000000, 0.04960628287401, 0.03937253280921, 0.03125000000000, 0.02480314143700, 0.01968626640461, 0.01562500000000, 0.01240157071850, 0.00984313320230, 0.00781250000000, 0.00620078535925, 0.00492156660115, 0.00390625000000, 0.00310039267963, 0.00246078330058, 0.00195312500000, 0.00155019633981, 0.00123039165029, 0.00097656250000, 0.00077509816991, 0.00061519582514, 0.00048828125000, 0.00038754908495, 0.00030759791257, 0.00024414062500, 0.00019377454248, 0.00015379895629, 0.00012207031250, 0.00009688727124, 0.00007689947814, 0.00006103515625, 0.00004844363562, 0.00003844973907, 0.00003051757813, 0.00002422181781, 0.00001922486954, 0.00001525878906, 0.00001211090890, 0.00000961243477, 0.00000762939453, 0.00000605545445, 0.00000480621738, 0.00000381469727, 0.00000302772723, 0.00000240310869, 0.00000190734863, 0.00000151386361, 0.00000120155435, 0.00000000000000 }; const REAL Mpegtoraw::filter[512]= { 0.000000000, -0.000442505, 0.003250122, -0.007003784, 0.031082153, -0.078628540, 0.100311279, -0.572036743, 1.144989014, 0.572036743, 0.100311279, 0.078628540, 0.031082153, 0.007003784, 0.003250122, 0.000442505, -0.000015259, -0.000473022, 0.003326416, -0.007919312, 0.030517578, -0.084182739, 0.090927124, -0.600219727, 1.144287109, 0.543823242, 0.108856201, 0.073059082, 0.031478882, 0.006118774, 0.003173828, 0.000396729, -0.000015259, -0.000534058, 0.003387451, -0.008865356, 0.029785156, -0.089706421, 0.080688477, -0.628295898, 1.142211914, 0.515609741, 0.116577148, 0.067520142, 0.031738281, 0.005294800, 0.003082275, 0.000366211, -0.000015259, -0.000579834, 0.003433228, -0.009841919, 0.028884888, -0.095169067, 0.069595337, -0.656219482, 1.138763428, 0.487472534, 0.123474121, 0.061996460, 0.031845093, 0.004486084, 0.002990723, 0.000320435, -0.000015259, -0.000625610, 0.003463745, -0.010848999, 0.027801514, -0.100540161, 0.057617188, -0.683914185, 1.133926392, 0.459472656, 0.129577637, 0.056533813, 0.031814575, 0.003723145, 0.002899170, 0.000289917, -0.000015259, -0.000686646, 0.003479004, -0.011886597, 0.026535034, -0.105819702, 0.044784546, -0.711318970, 1.127746582, 0.431655884, 0.134887695, 0.051132202, 0.031661987, 0.003005981, 0.002792358, 0.000259399, -0.000015259, -0.000747681, 0.003479004, -0.012939453, 0.025085449, -0.110946655, 0.031082153, -0.738372803, 1.120223999, 0.404083252, 0.139450073, 0.045837402, 0.031387329, 0.002334595, 0.002685547, 0.000244141, -0.000030518, -0.000808716, 0.003463745, -0.014022827, 0.023422241, -0.115921021, 0.016510010, -0.765029907, 1.111373901, 0.376800537, 0.143264771, 0.040634155, 0.031005859, 0.001693726, 0.002578735, 0.000213623, -0.000030518, -0.000885010, 0.003417969, -0.015121460, 0.021575928, -0.120697021, 0.001068115, -0.791213989, 1.101211548, 0.349868774, 0.146362305, 0.035552979, 0.030532837, 0.001098633, 0.002456665, 0.000198364, -0.000030518, -0.000961304, 0.003372192, -0.016235352, 0.019531250, -0.125259399, -0.015228271, -0.816864014, 1.089782715, 0.323318481, 0.148773193, 0.030609131, 0.029937744, 0.000549316, 0.002349854, 0.000167847, -0.000030518, -0.001037598, 0.003280640, -0.017349243, 0.017257690, -0.129562378, -0.032379150, -0.841949463, 1.077117920, 0.297210693, 0.150497437, 0.025817871, 0.029281616, 0.000030518, 0.002243042, 0.000152588, -0.000045776, -0.001113892, 0.003173828, -0.018463135, 0.014801025, -0.133590698, -0.050354004, -0.866363525, 1.063217163, 0.271591187, 0.151596069, 0.021179199, 0.028533936, -0.000442505, 0.002120972, 0.000137329, -0.000045776, -0.001205444, 0.003051758, -0.019577026, 0.012115479, -0.137298584, -0.069168091, -0.890090942, 1.048156738, 0.246505737, 0.152069092, 0.016708374, 0.027725220, -0.000869751, 0.002014160, 0.000122070, -0.000061035, -0.001296997, 0.002883911, -0.020690918, 0.009231567, -0.140670776, -0.088775635, -0.913055420, 1.031936646, 0.221984863, 0.151962280, 0.012420654, 0.026840210, -0.001266479, 0.001907349, 0.000106812, -0.000061035, -0.001388550, 0.002700806, -0.021789551, 0.006134033, -0.143676758, -0.109161377, -0.935195923, 1.014617920, 0.198059082, 0.151306152, 0.008316040, 0.025909424, -0.001617432, 0.001785278, 0.000106812, -0.000076294, -0.001480103, 0.002487183, -0.022857666, 0.002822876, -0.146255493, -0.130310059, -0.956481934, 0.996246338, 0.174789429, 0.150115967, 0.004394531, 0.024932861, -0.001937866, 0.001693726, 0.000091553, -0.000076294, -0.001586914, 0.002227783, -0.023910522, -0.000686646, -0.148422241, -0.152206421, -0.976852417, 0.976852417, 0.152206421, 0.148422241, 0.000686646, 0.023910522, -0.002227783, 0.001586914, 0.000076294, -0.000091553, -0.001693726, 0.001937866, -0.024932861, -0.004394531, -0.150115967, -0.174789429, -0.996246338, 0.956481934, 0.130310059, 0.146255493, -0.002822876, 0.022857666, -0.002487183, 0.001480103, 0.000076294, -0.000106812, -0.001785278, 0.001617432, -0.025909424, -0.008316040, -0.151306152, -0.198059082, -1.014617920, 0.935195923, 0.109161377, 0.143676758, -0.006134033, 0.021789551, -0.002700806, 0.001388550, 0.000061035, -0.000106812, -0.001907349, 0.001266479, -0.026840210, -0.012420654, -0.151962280, -0.221984863, -1.031936646, 0.913055420, 0.088775635, 0.140670776, -0.009231567, 0.020690918, -0.002883911, 0.001296997, 0.000061035, -0.000122070, -0.002014160, 0.000869751, -0.027725220, -0.016708374, -0.152069092, -0.246505737, -1.048156738, 0.890090942, 0.069168091, 0.137298584, -0.012115479, 0.019577026, -0.003051758, 0.001205444, 0.000045776, -0.000137329, -0.002120972, 0.000442505, -0.028533936, -0.021179199, -0.151596069, -0.271591187, -1.063217163, 0.866363525, 0.050354004, 0.133590698, -0.014801025, 0.018463135, -0.003173828, 0.001113892, 0.000045776, -0.000152588, -0.002243042, -0.000030518, -0.029281616, -0.025817871, -0.150497437, -0.297210693, -1.077117920, 0.841949463, 0.032379150, 0.129562378, -0.017257690, 0.017349243, -0.003280640, 0.001037598, 0.000030518, -0.000167847, -0.002349854, -0.000549316, -0.029937744, -0.030609131, -0.148773193, -0.323318481, -1.089782715, 0.816864014, 0.015228271, 0.125259399, -0.019531250, 0.016235352, -0.003372192, 0.000961304, 0.000030518, -0.000198364, -0.002456665, -0.001098633, -0.030532837, -0.035552979, -0.146362305, -0.349868774, -1.101211548, 0.791213989, -0.001068115, 0.120697021, -0.021575928, 0.015121460, -0.003417969, 0.000885010, 0.000030518, -0.000213623, -0.002578735, -0.001693726, -0.031005859, -0.040634155, -0.143264771, -0.376800537, -1.111373901, 0.765029907, -0.016510010, 0.115921021, -0.023422241, 0.014022827, -0.003463745, 0.000808716, 0.000030518, -0.000244141, -0.002685547, -0.002334595, -0.031387329, -0.045837402, -0.139450073, -0.404083252, -1.120223999, 0.738372803, -0.031082153, 0.110946655, -0.025085449, 0.012939453, -0.003479004, 0.000747681, 0.000015259, -0.000259399, -0.002792358, -0.003005981, -0.031661987, -0.051132202, -0.134887695, -0.431655884, -1.127746582, 0.711318970, -0.044784546, 0.105819702, -0.026535034, 0.011886597, -0.003479004, 0.000686646, 0.000015259, -0.000289917, -0.002899170, -0.003723145, -0.031814575, -0.056533813, -0.129577637, -0.459472656, -1.133926392, 0.683914185, -0.057617188, 0.100540161, -0.027801514, 0.010848999, -0.003463745, 0.000625610, 0.000015259, -0.000320435, -0.002990723, -0.004486084, -0.031845093, -0.061996460, -0.123474121, -0.487472534, -1.138763428, 0.656219482, -0.069595337, 0.095169067, -0.028884888, 0.009841919, -0.003433228, 0.000579834, 0.000015259, -0.000366211, -0.003082275, -0.005294800, -0.031738281, -0.067520142, -0.116577148, -0.515609741, -1.142211914, 0.628295898, -0.080688477, 0.089706421, -0.029785156, 0.008865356, -0.003387451, 0.000534058, 0.000015259, -0.000396729, -0.003173828, -0.006118774, -0.031478882, -0.073059082, -0.108856201, -0.543823242, -1.144287109, 0.600219727, -0.090927124, 0.084182739, -0.030517578, 0.007919312, -0.003326416, 0.000473022, 0.000015259 }; REAL Mpegtoraw::hcos_64[16], Mpegtoraw::hcos_32[ 8], Mpegtoraw::hcos_16[ 4], Mpegtoraw::hcos_8 [ 2], Mpegtoraw::hcos_4; AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/plugins/libmpeg_audiodec/mpegtoraw.cpp0000644000175000017500000003057111165741706023425 0ustar yavoryavor/* MPEG/WAVE Sound library (C) 1997 by Jung woo-jae */ // Mpegtoraw.cc // Server which get mpeg format and put raw format. #include "fillplugins.h" #include "mpegsound.h" #include "avm_output.h" #include "plugin.h" #include #include #include AVM_BEGIN_NAMESPACE; PLUGIN_TEMP(mpeg_audiodec); #define MY_PI 3.14159265358979323846 #ifndef WORDS_BIGENDIAN #define _KEY 0 #else #define _KEY 3 #endif int Mpegtoraw::getbits(int bits) { int current; int bi; if(!bits)return 0; current=0; bi=(bitindex&7); current = buffer[bitindex>>3]<>3] & 0xff; bitindex+=8; bi=8; } if(bits>=bi) { current<<=bi; bits-=bi; bi=0; } else { current<<=bits; bi-=bits; bits=0; } } bitindex-=bi; return (current>>8); } void Mpegtoraw::setforcetomono(bool flag) { forcetomonoflag=flag; } void Mpegtoraw::setdownfrequency(int value) { downfrequency=0; if(value)downfrequency=1; } bool Mpegtoraw::getforcetomono(void) { return forcetomonoflag; } int Mpegtoraw::getdownfrequency(void) { return downfrequency; } int Mpegtoraw::getpcmperframe(void) { int s; s=32; if(layer==3) { s*=18; if(version==0)s*=2; } else { s*=SCALEBLOCK; if(layer==2)s*=3; } return s; } int Mpegtoraw::flushrawdata(void) { // player->putblock((char *)rawdata,rawdataoffset<<1); if (rawdataoffset<<1 == 0) { return -2; } if(local_dest_buffer_size<(rawdataoffset<<1)) return -1; memcpy(local_dest_buffer, rawdata, rawdataoffset<<1); local_dest_buffer+=rawdataoffset<<1; local_dest_buffer_size-=rawdataoffset<<1; currentframe++; rawdataoffset=0; return 0; }; typedef struct { char *songname; char *musican; char *type; char *year; char *etc; }ID3; static void strman(char *str,int max) { int i; str[max]=0; for(i=max-1;i>=0;i--) if(((unsigned char)str[i])<26 || str[i]==' ')str[i]=0; else break; } /* inline void parseID3(Soundinputstream *fp,ID3 *data) { int c,flag=0; fp->setposition(fp->getsize()-1000); data->songname[0]=0; data->musican [0]=0; data->type [0]=0; data->year [0]=0; data->etc [0]=0; for(;;) { if((c=fp->getbytedirect())<0)break; else if(c==0xFF)flag++; else if(c==0x54 && flag>=28) { if(fp->getbytedirect()==0x41) { if(fp->getbytedirect()==0x47) { fp->_readbuffer(data->songname,30);strman(data->songname,30); fp->_readbuffer(data->musican ,30);strman(data->musican, 30); fp->_readbuffer(data->type ,30);strman(data->type, 30); fp->_readbuffer(data->year , 7);strman(data->year, 7); fp->_readbuffer(data->etc ,25);strman(data->etc, 25); break; } } flag=0; } else flag=0; } fp->setposition(0); } */ // Convert mpeg to raw // Mpeg headder class Mpegtoraw::Mpegtoraw(const CodecInfo& info, const WAVEFORMATEX* fmt) :IAudioDecoder(info, fmt), gain_add(8), flushed(true), lastfrequency(0) { static bool initialized=false; __errorcode=SOUND_ERROR_OK; // frameoffsets=NULL; forcetomonoflag=false; downfrequency=0; int i; REAL *s1,*s2; REAL *s3,*s4; scalefactor=SCALE; calcbufferoffset=15; currentcalcbuffer=0; s1=calcbufferL[0];s2=calcbufferR[0]; s3=calcbufferL[1];s4=calcbufferR[1]; for(i=CALCBUFFERSIZE-1;i>=0;i--) calcbufferL[0][i]=calcbufferL[1][i]= calcbufferR[0][i]=calcbufferR[1][i]=0.0; if(!initialized) { for(i=0;i<16;i++)hcos_64[i]=1.0/(2.0*cos(MY_PI*double(i*2+1)/64.0)); for(i=0;i< 8;i++)hcos_32[i]=1.0/(2.0*cos(MY_PI*double(i*2+1)/32.0)); for(i=0;i< 4;i++)hcos_16[i]=1.0/(2.0*cos(MY_PI*double(i*2+1)/16.0)); for(i=0;i< 2;i++)hcos_8 [i]=1.0/(2.0*cos(MY_PI*double(i*2+1)/ 8.0)); hcos_4=1.0/(2.0*cos(MY_PI*1.0/4.0)); initialized=true; } currentframe=decodeframe=0; /* if(loadheader()) { totalframe=(loader->getsize()+framesize-1)/framesize; loader->setposition(0); } else totalframe=0; if(frameoffsets)delete [] frameoffsets; song.name[0]=0; if(totalframe>0) { frameoffsets=new int[totalframe]; for(i=totalframe-1;i>=0;i--) frameoffsets[i]=0; { ID3 data; data.songname=song.name; data.musican =song.musican; data.type =song.type; data.year =song.year; data.etc =song.etc; parseID3(loader,&data); } } else frameoffsets=NULL; */ }; Mpegtoraw::~Mpegtoraw() { // if(frameoffsets)delete [] frameoffsets; } /* void Mpegtoraw::setframe(int framenumber) { int pos=0; if(frameoffsets==NULL)return; if(framenumber==0)pos=frameoffsets[0]; else { if(framenumber>=totalframe)framenumber=totalframe-1; pos=frameoffsets[framenumber]; if(pos==0) { int i; for(i=framenumber-1;i>0;i--) if(frameoffsets[i]!=0)break; loader->setposition(frameoffsets[i]); while(igetposition(); } pos=frameoffsets[framenumber]; } } clearbuffer(); loader->setposition(pos); decodeframe=currentframe=framenumber; } */ /* void Mpegtoraw::clearbuffer(void) { player->abort(); player->resetsoundtype(); }*/ int Mpegtoraw::Convert(const void* input_buffer, size_t in_size, void* output_buffer, size_t out_size, size_t* size_read, size_t* size_written) { int ret; local_src_buffer=(uint8_t*)input_buffer; local_dest_buffer=(uint8_t*)output_buffer; local_src_buffer_size=(int)in_size; local_dest_buffer_size=(int)out_size; if (flushed) { layer3initialize(); clearrawdata(); flushrawdata(); } // prevent deadlock in this loop!!! int maxloop; for (maxloop = 0; maxloop < 20; maxloop++) { //printf("Maxloop %d\n", maxloop); const unsigned char* rest_lb=local_src_buffer; unsigned rest_lc=local_src_buffer_size; unsigned rest_dc=local_dest_buffer_size; if (loadheader()==false) { local_src_buffer=rest_lb; local_src_buffer_size=rest_lc; local_dest_buffer_size=rest_dc; break; } if (frequency!=lastfrequency) { if(lastfrequency>0)seterrorcode(SOUND_ERROR_BAD); lastfrequency=frequency; } decodeframe++; if (layer==3)extractlayer3(); else if(layer==2)extractlayer2(); else if(layer==1)extractlayer1(); ret = flushrawdata(); //printf("WRIT out: %d in: %d %d\n", out_size-local_dest_buffer_size, in_size - local_src_buffer_size, ret); if(ret==-1) /* OutputBuffer Is Full!! */ { //printf("flushrawdata() failed: restoring %d/%d\n", rest_lc, rest_dc); // local_src_buffer=rest_lb; // local_src_buffer_size=rest_lc; // local_dest_buffer_size=rest_dc; // declined=*(int*)local_src_buffer; /* FILE* zz=fopen("./log.mp3", "ab"); fwrite(input_buffer, in_size-local_src_buffer_size, 1, zz); fclose(zz); zz=fopen("./log.raw", "ab"); fwrite(output_buffer, out_size-local_dest_buffer_size, 1, zz); fclose(zz);*/ break; } else if (ret == -2) { /* Convert Error? Clear All OutputData */ local_src_buffer=(uint8_t*)input_buffer; local_src_buffer_size=(int)in_size; local_dest_buffer=(uint8_t*)output_buffer; local_dest_buffer_size=(int)out_size; clearrawdata(); continue; } break; } //printf("done l:%d %d %d\n", maxloop, in_size - local_src_buffer_size, out_size-local_dest_buffer_size ); flushed = false; if (size_read) *size_read = in_size - local_src_buffer_size; int written = out_size - local_dest_buffer_size; if (size_written) *size_written = written; //printf(" JO %d %d\n ", *size_written, *size_read); return (written) ? 0 : -1; } bool Mpegtoraw::loadheader(void) { // unsigned char* rest_lb=local_src_buffer; // unsigned rest_lc=local_src_buffer_size; register int c; bool flag; unsigned int freqs; sync(); again: // Synchronize flag=false; do { if((c=getbytedirect())<0)break; if(c==0xff) while(!flag) { if((c=getbytedirect())<0) { flag=true; break; } if((c&0xe0)==0xe0) { flag=true; break; } else if(c!=0xff)break; } }while(!flag); //c=getbytedirect(); if(c<0) { return false; } // Analyzing if (c&0x10) { mpeg25=false; } else { mpeg25=true; c=c+0x10; } if ((c & 0xf0) != 0xf0) { goto again; } c&=0xf; protection=c&1; layer=4-((c>>1)&3); version=(_mpegversion)((c>>3)^1); //if ((m_pFormat->wFormatTag == 0x55) && (layer!=3)) goto again; c=((getbytedirect()))>>1; padding=(c&1); c>>=1; frequency=(_frequency)(c&3); c>>=2; bitrateindex=(int)c; if(bitrateindex==15) { goto again; } if (mpeg25) freqs=frequencies[2][frequency]; else freqs=frequencies[version][frequency]; if (freqs != m_pFormat->nSamplesPerSec) { goto again; } c=((unsigned int)(getbytedirect()))>>4; extendedmode=c&3; mode=(_mode)(c>>2); // Making information inputstereo= (mode==single)?0:1; if(forcetomonoflag)outputstereo=0; else outputstereo=inputstereo; /* if(layer==2) if((bitrateindex>=1 && bitrateindex<=3) || (bitrateindex==5)) { if(inputstereo)return seterrorcode(SOUND_ERROR_BAD); } else if(bitrateindex==11 && mode==single) return seterrorcode(SOUND_ERROR_BAD); */ channelbitrate=bitrateindex; if(inputstereo) { if(channelbitrate==4)channelbitrate=1; else channelbitrate-=4; } if(channelbitrate==1 || channelbitrate==2)tableindex=0; else tableindex=1; if(layer==1)subbandnumber=MAXSUBBAND; else { if(!tableindex) if(frequency==frequency32000)subbandnumber=12; else subbandnumber=8; else if(frequency==frequency48000|| (channelbitrate>=3 && channelbitrate<=5)) subbandnumber=27; else subbandnumber=30; } if(mode==single)stereobound=0; else if(mode==joint)stereobound=(extendedmode+1)<<2; else stereobound=subbandnumber; if(frequency==3) { goto again; } if(stereobound>subbandnumber)stereobound=subbandnumber; // printf("Layer %d, mode %d, frequency %d\n", layer, mode, frequency); // framesize & slots if(layer==1) { framesize=(12000*bitrate[version][0][bitrateindex])/ frequencies[version][frequency]; if(frequency==frequency44100 && padding)framesize++; framesize<<=2; } else { if(mpeg25) { framesize=(144000*bitrate[version][layer-1][bitrateindex])/ (frequencies[2][frequency]<& Mpegtoraw::GetAttrs() const { return m_Info.decoder_info; } int Mpegtoraw::GetValue(const char* name, int* value) const { if (strcmp(name, mpegadstr_gain) == 0) { *value = gain_add; return 0; } return -1; } int Mpegtoraw::SetValue(const char* name, int value) { if (strcmp(name, mpegadstr_gain) == 0) { gain_add = value; return 0; } return -1; } static IAudioDecoder* mpeg_audiodec_CreateAudioDecoder(const CodecInfo& info, const WAVEFORMATEX* format) { return new Mpegtoraw(info, format); } AVM_END_NAMESPACE; extern "C" AVMEXPORT avm::codec_plugin_t avm_codec_plugin_mpeg_audiodec; avm::codec_plugin_t avm_codec_plugin_mpeg_audiodec = { PLUGIN_API_VERSION, 0, // err 0, 0, avm::PluginGetAttrInt, avm::PluginSetAttrInt, 0, 0, // attrs avm::mpeg_audiodec_FillPlugins, avm::mpeg_audiodec_CreateAudioDecoder, 0, 0, 0, }; avifile-0.7.48~20090503.ds/plugins/libvorbis/0000755000175000017500000000000011267646347017435 5ustar yavoryavoravifile-0.7.48~20090503.ds/plugins/libvorbis/Makefile.am0000644000175000017500000000056411110406016021444 0ustar yavoryavorif AMM_USE_VORBIS pkglib_LTLIBRARIES = vorbis_audio.la endif noinst_HEADERS = fillplugins.h vorbis_audio_la_SOURCES = libvorbis.cpp vorbis_audio_la_LIBADD = ../../lib/libaviplay.la $(VORBIS_LIBS) $(OGG_LIBS) vorbis_audio_la_LDFLAGS = -avoid-version -module AM_CPPFLAGS = $(VORBIS_CFLAGS) $(OGG_CFLAGS) AM_CXXFLAGS = $(CXXRTTIEXCEPT) MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libvorbis/fillplugins.h0000644000175000017500000000112410746721716022127 0ustar yavoryavor#ifndef VORBIS_FILLPLUGINS_H #define VORBIS_FILLPLUGINS_H #include "infotypes.h" AVM_BEGIN_NAMESPACE; static void vorbis_FillPlugins(avm::vector& ci) { // just WAVE_FORMAT_EXTENSIBLE const fourcc_t vorbis_codecs[] = { 0xFFFE, 0 }; const GUID vorbis_clsid = { 0x6bA47966, 0x3F83, 0x4178, {0x96, 0x65, 0x00, 0xF0, 0xBF, 0x62, 0x92, 0xE5} }; ci.push_back(CodecInfo(vorbis_codecs, "Vorbis decoder", "", "", CodecInfo::Plugin, "vorbis", CodecInfo::Audio, CodecInfo::Decode, &vorbis_clsid)); } AVM_END_NAMESPACE; #endif // VORBIS_FILLPLUGINS_H avifile-0.7.48~20090503.ds/plugins/libvorbis/libvorbis.cpp0000644000175000017500000002450011174450236022120 0ustar yavoryavor/*** Ogg Vorbis audio decoder libvorbis interface is based on work by Felix 'Atmosfear' Buenemann ( atmosfear@users.sourceforge.net ) and taken from 'mplayer' ( http://mplayer.sourceforge.net ). some other parts are taken directly from Ogg/Vorbis source ***/ #include "fillplugins.h" #include "audiodecoder.h" #include "utils.h" #include "avm_output.h" #include "plugin.h" #include #include #include #include #include AVM_BEGIN_NAMESPACE; PLUGIN_TEMP(vorbis_audio) class VorbisDecoder : public IAudioDecoder { FILE* f; float m_fScaleFactor; ogg_sync_state oy; /* sync and verify incoming physical bitstream */ ogg_stream_state os; /* take physical pages, weld into a logical stream of packets */ ogg_page og; /* one Ogg bitstream page. Vorbis packets are inside */ ogg_packet op; /* one raw packet of data for decode */ vorbis_info vi; /* struct that stores all the static vorbis bitstream settings */ vorbis_comment vc; /* struct that stores all the bitstream user comments */ vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */ vorbis_block vb; /* local working space for packet->PCM decode */ uint32_t hdrsizes[3]; /* learned from mplayer */ int m_iSetNo; bool m_bInitialized; bool m_bInRead; public: VorbisDecoder(const CodecInfo& info, const WAVEFORMATEX* wf) :IAudioDecoder(info, wf) { } ~VorbisDecoder() { if (m_bInitialized) { ogg_stream_clear(&os); ogg_sync_clear(&oy); vorbis_block_clear(&vb); vorbis_dsp_clear(&vd); vorbis_comment_clear(&vc); vorbis_info_clear(&vi); } } int init() { /* originaly inspired from mplayer's header parsing */ VORBISWAVEFORMATEX& vwfex = *(VORBISWAVEFORMATEX*)m_pFormat; m_bInitialized = false; m_fScaleFactor = 40000; // boost volume - do as an option //cout << "Init vorbis decoder " << wf->cbSize << " " << sizeof(WAVEFORMATEXTENSIBLE) << endl; uint_t ogg_header_size; ogg_header_size = m_pFormat->cbSize; uint8_t* vorbishdr = (uint8_t*) (&vwfex + 1); //const char* ogg_header = vorbishdr; vorbis_info_init(&vi); vorbis_comment_init(&vc); op.packet = NULL; op.b_o_s = 1; /* beginning of stream for first packet */ op.bytes = avm_get_le32(&vwfex.nInitSize); op.packet = vorbishdr; vorbishdr += op.bytes; if (vorbis_synthesis_headerin(&vi, &vc, &op) < 0) { vorbis_audio_error_set("initial (identification) header broken!"); return -1; } op.b_o_s = 0; op.bytes = avm_get_le32(&vwfex.nCommentSize); op.packet = vorbishdr; vorbishdr += op.bytes; if (vorbis_synthesis_headerin(&vi, &vc, &op) < 0) { vorbis_audio_error_set("comment header broken!"); return -1; } op.bytes = avm_get_le32(&vwfex.nCodebookSize); op.packet = vorbishdr; vorbishdr += op.bytes; if (vorbis_synthesis_headerin(&vi, &vc, &op) < 0) { vorbis_audio_error_set("codebook header broken!"); return -1; } { char** ptr = vc.user_comments; while (*ptr) { AVM_WRITE("Ogg Vorbis decoder", "OggVorbisComment: %s\n", *ptr); ++ptr; } AVM_WRITE("Ogg Vorbis decoder", "Bitstream is %d channel, %ldHz, %ldkbit/s %cBR\n", vi.channels, vi.rate, vi.bitrate_nominal/1000, (vi.bitrate_lower != vi.bitrate_nominal) ||(vi.bitrate_upper != vi.bitrate_nominal) ? 'V' : 'C'); AVM_WRITE("Ogg Vorbis decoder", "Encoded by: %s\n", vc.vendor); } m_uiBytesPerSec = vi.channels * vi.rate * 2; //16bit //printf("HDR SZE %d diff %d\n", ogg_header_size, vorbishdr - ogg_header); /* OK, got and parsed all three headers. Initialize the Vorbis packet->PCM decoder. */ vorbis_synthesis_init(&vd, &vi); /* central decode state */ vorbis_block_init(&vd, &vb); /* local state for most of the decode so multiple block decodes can proceed in parallel. We could init multiple vorbis_block structures for vd here */ //printf("OggVorbis: synthesis and block init done.\n"); ogg_sync_init(&oy); /* Now we can read pages */ ogg_stream_reset(&os); m_bInRead = true; return 0; } int Convert(const void* in_data, size_t in_size, void* out_data, size_t out_size, size_t* size_read, size_t* size_written) { const char* in_data_base = (const char*) in_data; int r = 0; size_t outwrt = 0; //fwrite(in_data, 1, in_size, f); //fflush(f); // Note - m_bInRead checks if we haven't been reading new data // previously in that case we will not call packetout // OGG stream parsing while (m_bInRead || (r = ogg_stream_packetout(&os, &op)) != 1) { //printf("enter loop %d %d\n", r, m_bInRead); if (r == 0) { //while((r = ogg_sync_pageseek(&oy, &og)) <= 0) while ((r = ogg_sync_pageout(&oy, &og)) != 1 && in_size > 0) { /* submit in_sized block to libvorbis' Ogg layer */ //printf("OggVorbis: Pageout: need more data to verify page, reading more data. %d\n", in_size); char* buffer = ogg_sync_buffer(&oy, in_size); memcpy(buffer, in_data, in_size); ogg_sync_wrote(&oy, in_size); in_data = (const char*)in_data + in_size; in_size = 0; } if (r != 1) { m_bInRead = true; break; } m_bInRead = false; r = ogg_stream_pagein(&os, &og); if (r < 0 && m_bInitialized) { AVM_WRITE("Ogg Vorbis decoder", "Pagein failed!\n"); break; } else if (!m_bInitialized) { /* Get the serial number and set up the rest of decode. */ /* serialno first; use it to set up a logical stream */ m_iSetNo = ogg_page_serialno(&og); ogg_stream_init(&os, m_iSetNo); AVM_WRITE("Ogg Vorbis decoder", "Init OK! (%d)\n", m_iSetNo); m_bInitialized = true; } } } // Vorbis decoding if (r == 1) { //printf("valid loop %d\n", in_size); // we have valid packet if (vorbis_synthesis(&vb, &op) == 0) { /* test for success! */ vorbis_synthesis_blockin(&vd, &vb); float** pcm; size_t convsize = (out_size - outwrt) / vi.channels / sizeof(int16_t); int clipflag = 0; int samples; while ((samples = vorbis_synthesis_pcmout(&vd, &pcm)) > 0) { int bout = (samples < (int)convsize) ? samples : (int)convsize; if (bout <= 0) break; int16_t *ptr = 0; for (int i = 0; i < vi.channels; i++) { ptr = (int16_t *)out_data + i; float *mono=pcm[i]; for (int j = 0; j < bout; j++) { int val=(int)(mono[j] * m_fScaleFactor); /* might as well guard against clipping */ if (val > 32767) { val = 32767; clipflag = 1; } else if (val < -32768) { val = -32768; clipflag = 1; } *ptr = (int16_t) val; ptr += vi.channels; } } /* tell libvorbis about consumed samples */ vorbis_synthesis_read(&vd, bout); //printf("CONVERT %d %d\n", outwrt, bout); convsize -= bout; outwrt += bout; out_data = ptr; } if (clipflag) { if (m_fScaleFactor > 32768.f) { m_fScaleFactor *= 0.9f; if (m_fScaleFactor < 32768.f) m_fScaleFactor = 32768.f; } AVM_WRITE("Ogg Vorbis decoder", "OggVorbis: clipping -> %f\n", m_fScaleFactor); } } } if (size_read) *size_read = (const char*) in_data - in_data_base; if (size_written) *size_written = outwrt * vi.channels * sizeof(int16_t); //printf("DATA Read: %d Written: %d\n", *size_read, *size_written); return 0; } virtual void Flush() { // FIXME: for proper usage this would have to be fixed somehow //ogg_stream_flush(&os, &og); } virtual int GetOutputFormat(WAVEFORMATEX* destfmt) const { if (!destfmt) return -1; *destfmt = *m_pFormat; destfmt->wFormatTag = 1;//PCM destfmt->wBitsPerSample = 16; destfmt->nAvgBytesPerSec = (uint32_t)(vi.rate * vi.channels * 2); // after conversion destfmt->nBlockAlign = (uint16_t)(destfmt->nChannels * destfmt->wBitsPerSample / 8); destfmt->nSamplesPerSec = destfmt->nAvgBytesPerSec / destfmt->nChannels / (destfmt->wBitsPerSample / 8); destfmt->cbSize = 0; return 0; } virtual size_t GetMinSize() const { return 128000; } virtual size_t GetSrcSize(uint_t dest_size) const { //printf("SR %d %ld b:%d %ld\n", dest_size, vi.bitrate_nominal, m_uiBytesPerSec, (dest_size * vi.bitrate_nominal / 8) / m_uiBytesPerSec); return (dest_size * vi.bitrate_nominal / 8) / m_uiBytesPerSec; } }; // PLUGIN loading part static IAudioDecoder* vorbis_CreateAudioDecoder(const CodecInfo& info, const WAVEFORMATEX* format) { if (info.fourcc == WAVE_FORMAT_EXTENSIBLE) { VorbisDecoder* d = new VorbisDecoder(info, format); if (d && d->init() == 0) return d; delete d; } else vorbis_audio_error_set("format unsupported"); return 0; } AVM_END_NAMESPACE; extern "C" avm::codec_plugin_t avm_codec_plugin_vorbis_audio; avm::codec_plugin_t avm_codec_plugin_vorbis_audio = { PLUGIN_API_VERSION, 0, // err 0, 0, 0, 0, 0, 0, // attrs avm::vorbis_FillPlugins, avm::vorbis_CreateAudioDecoder, 0, 0, 0, }; // some useless junk #if 0 { { int i; int sum = 0; for (i = 0; i < rs; i++) sum += buffer[i]; printf("checksum %d\n", sum); } avm_usleep(100000); } #endif #if 0 char* bb = ogg_header; for (int i = 0; i < ogg_header_size; i++) { if (!(i % 8)) printf("\n-- %04x ", i); printf("0x%02x %c ", (unsigned char)bb[i], isprint(bb[i]) ? bb[i] : '.'); } #endif #if 0 f = fopen("/tmp/o", "w+"); cout << "opened" << endl; fwrite(ogg_header, 1, ogg_header_size, f); fflush(f); fclose(f); #endif #if 0 // example of vorbis headers static const char fakehd[] = { 'O','g','g','S', 0,2, 0,0,0,0, 0,0,0,0, 0xf0,0x0d,0,0, //ogg_page_serialno 14..17b 0,0,0,0, //ogg_page_pageno 18..21b 0x8d,0x4b,0xef,0x42, 1, // subpackets ??? 0x1e, 1,'v','o','r','b','i','s',0, 0,0,0,2, 0x80,0xbb,0,0, 0xff,0xff,0xff,0xff, 0,0x71,2,0, 0xff,0xff,0xff,0xff, 0xb8,1, //1e 'O','g','g','S', 0,0, 0,0,0,0, 0,0,0,0, 0xf0,0x0d,0,0, 1,0,0,0, // second packet 0xa4,0x7d,0xe5,0x92, 0x11, // 17 0x30,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 3 }; static const char fakehd1[] = { 'O','g','g','S', 0,1, 0,0,0,0, 0,0,0,0, 0xf0,0xd,0,0, 2,0,0,0, 0,0xe0,0x33,0x63, 2,0xff,0x2b }; #endif avifile-0.7.48~20090503.ds/plugins/libwin32/0000755000175000017500000000000011267646347017073 5ustar yavoryavoravifile-0.7.48~20090503.ds/plugins/libwin32/audiodec/0000755000175000017500000000000011267646347020650 5ustar yavoryavoravifile-0.7.48~20090503.ds/plugins/libwin32/audiodec/ACM_AudioDecoder.cpp0000644000175000017500000001153311171057001024337 0ustar yavoryavor/******************************************************** Windows ACM-based audio decoder Copyright 2000 Eugene Kuznetsov (divx@euro.ru) *********************************************************/ #include "ACM_AudioDecoder.h" #include "wineacm.h" #include "avm_output.h" #include #include //#define TIMING AVM_BEGIN_NAMESPACE; static int acmdrv = 0; ACM_AudioDecoder::ACM_AudioDecoder(const CodecInfo& info, const WAVEFORMATEX* pwf) :IAudioDecoder(info, pwf), m_iOpened(0), first(true) { } int ACM_AudioDecoder::init() { if (m_pFormat->nSamplesPerSec == 0) { sprintf(m_Error, "bad argument"); return -1; } MSACM_RegisterDriver(m_Info.dll.c_str(), m_pFormat->wFormatTag, 0); acmdrv++; GetOutputFormat(&wf); int hr = acmStreamOpen(&srcstream, (HACMDRIVER)NULL, m_pFormat, &wf, NULL, 0, 0, 0); //ACM_STREAMOPENF_NONREALTIME); if (hr != S_OK) { #if 0 char b[200]; avm_wave_format(b, sizeof(b), m_pFormat); printf("ACM_AudioDecoder: error src %s\n", b); avm_wave_format(b, sizeof(b), &wf); printf("ACM_AudioDecoder: error dst %s\n", b); #endif if (hr == ACMERR_NOTPOSSIBLE) sprintf(m_Error, "inappropriate audio format"); else sprintf(m_Error, "acmStreamOpen error %d", (int) hr); return -1; } m_iOpened++; acmStreamSize(srcstream, m_pFormat->nBlockAlign, (DWORD*)&m_uiMinSize, ACM_STREAMSIZEF_SOURCE); //printf("ACM data block align %d minimal buffer size: %d\n", m_pFormat->nBlockAlign, m_uiMinSize); return 0; } ACM_AudioDecoder::~ACM_AudioDecoder() { if (m_iOpened) acmStreamClose(srcstream, 0); if (--acmdrv == 0) MSACM_UnregisterAllDrivers(); } int ACM_AudioDecoder::Convert(const void* in_data, uint_t in_size, void* out_data, uint_t out_size, uint_t* size_read, uint_t* size_written) { int hr; DWORD srcsize = 0; //printf("ACM_AudioDecoder: data starts with %X %X %X\n", // *(int*)in_data, *(((int*)in_data)+1), *(((int*)in_data)+1)); #ifdef TIMING printf("ACM_AudioDecoder: received request to convert %d bytes to %d bytes\n", in_size, out_size); #endif for (;;) { ACMSTREAMHEADER ash; acmStreamSize(srcstream, out_size, &srcsize, ACM_STREAMSIZEF_DESTINATION); if (srcsize > in_size) srcsize = in_size; memset(&ash, 0, sizeof(ash)); ash.cbStruct = sizeof(ash); ash.pbSrc = (LPBYTE) in_data; ash.cbSrcLength = srcsize; ash.pbDst = (LPBYTE)out_data; ash.cbDstLength = out_size; hr = acmStreamPrepareHeader(srcstream, &ash, 0); if (hr != S_OK) { in_size = out_size = 0; break; } int flg = 0;//ACM_STREAMCONVERTF_BLOCKALIGN; if (first) { // process first block twice - there are some internal // buffers in codecs which might be good to be prefilled // otherwice the first block is larger then expected // flags seems to not help here at all ACMSTREAMHEADER ash2 = ash; //flg |= ACM_STREAMCONVERTF_START; hr = acmStreamConvert(srcstream, &ash2, flg); } hr = acmStreamConvert(srcstream, &ash, flg); //hr = acmStreamConvert(srcstream, &ash, 0); #ifdef TIMING printf("ACM_AudioDecoder: srclen: %ld srclenu: %ld dstlen: %ld dstlenu: %ld\n", ash.cbSrcLength, ash.cbSrcLengthUsed, ash.cbDstLength, ash.cbDstLengthUsed); #endif if (hr == S_OK) { if (ash.cbSrcLengthUsed < in_size) in_size = ash.cbSrcLengthUsed; out_size = ash.cbDstLengthUsed; //printf("ACM_AudioDecoder: acmStreamConvert %d %d\n", out_size, in_size); m_iOpened = 1; acmStreamUnprepareHeader(srcstream, &ash, 0); } else if (in_size > 0) { acmStreamUnprepareHeader(srcstream, &ash, 0); if (++m_iOpened < 3) { AVM_WRITE("ACM_AudioDecoder", "acmStreamConvert error, reinitializing...\n"); acmStreamClose(srcstream, 0); acmStreamOpen(&srcstream, (HACMDRIVER)NULL, (WAVEFORMATEX*)m_pFormat, (WAVEFORMATEX*)&wf, NULL, 0, 0, 0); //ACM_STREAMOPENF_NONREALTIME ); first = true; continue; // let's try again } out_size = 0; } break; } if (first) { first = false; //in_size = 0; } if (size_read) *size_read = in_size; if (size_written) *size_written = out_size; #if 0 unsigned short* xx = (unsigned short*) out_data; static unsigned short prev = 0; for (unsigned i = 0; i < out_size / 2; i++) { unsigned short d = xx[i]; printf("0x%x\n", d - prev); prev = d; //d += 0x8000; //printf("0x%x\n", d); xx[i] = d; } #endif return (hr == S_OK) ? (int)in_size : -1; } uint_t ACM_AudioDecoder::GetMinSize() const { return m_uiMinSize; } uint_t ACM_AudioDecoder::GetSrcSize(uint_t dest_size) const { DWORD srcsize = 0; acmStreamSize(srcstream, dest_size, &srcsize, ACM_STREAMSIZEF_DESTINATION); //printf("ACM %d %d\n", srcsize, IAudioDecoder::GetSrcSize(dest_size)); return srcsize; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/plugins/libwin32/audiodec/ACM_AudioDecoder.h0000644000175000017500000000151707505551341024021 0ustar yavoryavor#ifndef AVIFILE_ACM_AUDIODECODER_H #define AVIFILE_ACM_AUDIODECODER_H #ifndef NOAVIFILE_HEADERS #include "audiodecoder.h" #else #include "libwin32.h" #endif #ifndef __WINE_MSACM_H #include "wine/winerror.h" #include "wine/msacm.h" #endif AVM_BEGIN_NAMESPACE; class ACM_AudioDecoder : public IAudioDecoder { public: ACM_AudioDecoder(const CodecInfo&, const WAVEFORMATEX*); ~ACM_AudioDecoder(); virtual uint_t GetMinSize() const; virtual uint_t GetSrcSize(uint_t dest_size) const; virtual int Convert(const void*, uint_t, void*, uint_t, uint_t*, uint_t*); int init(); const char* getError() const { return m_Error; } protected: WAVEFORMATEX wf; HACMSTREAM srcstream; uint_t m_uiMinSize; int m_iOpened; bool first; char m_Error[128]; }; AVM_END_NAMESPACE; #endif //AVIFILE_ACM_AUDIODECODER_H avifile-0.7.48~20090503.ds/plugins/libwin32/audiodec/DMO_AudioDecoder.cpp0000644000175000017500000001360711171057001024362 0ustar yavoryavor/** * DMO audio decoder * Copyright 2002 Zdenek Kabelac (kabi@users.sf.net) */ #include "DMO_AudioDecoder.h" #include "ldt_keeper.h" #include #include #include #include #include "utils.h" AVM_BEGIN_NAMESPACE; DMO_AudioDecoder::DMO_AudioDecoder(const CodecInfo& info, const WAVEFORMATEX* wf) :IAudioDecoder(info, wf) { m_pDMO_Filter = 0; m_pVhdr = 0; m_iFlushed = 1; int sz = sizeof(WAVEFORMATEX) + wf->cbSize; m_pVhdr = (WAVEFORMATEX*) malloc(sz); memcpy(m_pVhdr, wf, sz); //m_Format.nBlockAlign *= 2; //for (int i = 0; i < WFSIZE + wf->cbSize; i++) // printf("%d %x\n", i, ((unsigned char*)m_pVhdr)[i]); m_sVhdr2 = *((WAVEFORMATEX*) m_pVhdr); m_sVhdr2.wFormatTag = 1; // PCM m_sVhdr2.wBitsPerSample = 16; m_sVhdr2.nChannels = (wf->nChannels > 1) ? 2 : 1; m_sVhdr2.nBlockAlign = m_sVhdr2.nChannels * ((m_sVhdr2.wBitsPerSample + 7) / 8); m_sVhdr2.nAvgBytesPerSec = m_sVhdr2.nBlockAlign * m_sVhdr2.nSamplesPerSec; m_sVhdr2.cbSize = 0; //char bb[200]; avm_wave_format(bb, sizeof(bb), &m_sVhdr2); //printf("DSFORMAT %d %s\n", sizeof(m_sVhdr2), bb); // in IAudioDecoder: m_Format = *wf; memset(&m_sOurType, 0, sizeof(m_sOurType)); m_sOurType.majortype = MEDIATYPE_Audio; m_sOurType.subtype = MEDIASUBTYPE_PCM; m_sOurType.subtype.f1 = wf->wFormatTag; m_sOurType.formattype = FORMAT_WaveFormatEx; m_sOurType.lSampleSize = wf->nBlockAlign; m_sOurType.bFixedSizeSamples = true; m_sOurType.bTemporalCompression = false; m_sOurType.cbFormat = sz; m_sOurType.pbFormat = (char*) m_pVhdr; memset(&m_sDestType, 0, sizeof(m_sDestType)); m_sDestType.majortype = MEDIATYPE_Audio; m_sDestType.subtype = MEDIASUBTYPE_PCM; m_sDestType.formattype = FORMAT_WaveFormatEx; m_sDestType.bFixedSizeSamples = true; m_sDestType.bTemporalCompression = false; m_sDestType.lSampleSize = m_sVhdr2.nBlockAlign; m_sDestType.cbFormat = sizeof(m_sVhdr2); m_sDestType.pbFormat = (char*) &m_sVhdr2; } int DMO_AudioDecoder::init() { Setup_FS_Segment(); m_pDMO_Filter = DMO_FilterCreate(m_Info.dll.c_str(), &m_Info.guid, &m_sOurType, &m_sDestType); if (!m_pDMO_Filter) { sprintf(m_Error, "can't open DMO_Filter"); return -1; } return 0; } DMO_AudioDecoder::~DMO_AudioDecoder() { Setup_FS_Segment(); if (m_pDMO_Filter) DMO_Filter_Destroy(m_pDMO_Filter); if (m_pVhdr) free(m_pVhdr); } void DMO_AudioDecoder::Flush() { Setup_FS_Segment(); m_pDMO_Filter->m_pMedia->vt->Flush(m_pDMO_Filter->m_pMedia); m_iFlushed = 1; } int DMO_AudioDecoder::Convert(const void* in_data, uint_t in_size, void* out_data, uint_t out_size, uint_t* size_read, uint_t* size_written) { DMO_OUTPUT_DATA_BUFFER db; CMediaBuffer* bufferin; unsigned long written = 0; unsigned long read = 0; int r = 0; Setup_FS_Segment(); //m_pDMO_Filter->m_pMedia->vt->Lock(m_pDMO_Filter->m_pMedia, 1); bufferin = CMediaBufferCreate(in_size, (void*)in_data, in_size, 1); r = m_pDMO_Filter->m_pMedia->vt->ProcessInput(m_pDMO_Filter->m_pMedia, 0, (IMediaBuffer*)bufferin, (m_iFlushed) ? DMO_INPUT_DATA_BUFFERF_SYNCPOINT : 0, 0, 0); if (r == 0) { ((IMediaBuffer*)bufferin)->vt->GetBufferAndLength((IMediaBuffer*)bufferin, 0, &read); m_iFlushed = 0; } ((IMediaBuffer*)bufferin)->vt->Release((IUnknown*)bufferin); //printf("RESULTA: %d 0x%x %ld %d %d\n", r, r, read, m_iFlushed, out_size); if (r == 0 || (unsigned)r == DMO_E_NOTACCEPTING) { unsigned long status = 0; /* something for process */ db.rtTimestamp = 0; db.rtTimelength = 0; db.dwStatus = 0; db.pBuffer = (IMediaBuffer*) CMediaBufferCreate(out_size, out_data, 0, 0); //printf("OUTSIZE %d\n", out_size); r = m_pDMO_Filter->m_pMedia->vt->ProcessOutput(m_pDMO_Filter->m_pMedia, 0, 1, &db, &status); ((IMediaBuffer*)db.pBuffer)->vt->GetBufferAndLength((IMediaBuffer*)db.pBuffer, 0, &written); ((IMediaBuffer*)db.pBuffer)->vt->Release((IUnknown*)db.pBuffer); //printf("RESULTB: %d 0x%x %ld\n", r, r, written); //printf("Converted %d -> %d\n", in_size, out_size); } else if (in_size > 0) printf("ProcessInputError r:0x%x=%d\n", r, r); //m_pDMO_Filter->m_pMedia->vt->Lock(m_pDMO_Filter->m_pMedia, 0); if (size_read) *size_read = read; if (size_written) *size_written = written; return r; } uint_t DMO_AudioDecoder::GetMinSize() const { unsigned long inputs, outputs; Setup_FS_Segment(); m_pDMO_Filter->m_pMedia->vt->GetOutputSizeInfo(m_pDMO_Filter->m_pMedia, 0, &inputs, &outputs); if (m_pFormat->wFormatTag == 0x162) return 500000; //printf("MINSIZE %ld\n", inputs); return inputs; // rewrite time calculation routine to use smalles chunks } #ifdef NOAVIFILE_HEADERS uint_t DMO_AudioDecoder::GetSrcSize(uint_t dest_size) const { #if 0 double efficiency = (double) m_pFormat.nAvgBytesPerSec / (m_pFormat.nSamplesPerSec*m_pFormat.nBlockAlign); int frames = int(dest_size*efficiency); if (frames < 1) frames = 1; return frames * m_pFormat.nBlockAlign; #endif printf(" %d -> %d\n", m_pFormat->nBlockAlign, dest_size); return m_pFormat->nBlockAlign; } #endif // // ohh yes - DMO supports decoding to 6 channels & 24 bits // int DMO_AudioDecoder::SetOutputFormat(const WAVEFORMATEX* destfmt) { int r; Setup_FS_Segment(); m_sVhdr2.wBitsPerSample = destfmt->wBitsPerSample; m_sVhdr2.nChannels = destfmt->nChannels; m_sVhdr2.nBlockAlign = m_sVhdr2.nChannels * ((m_sVhdr2.wBitsPerSample + 7) / 8); m_sVhdr2.nAvgBytesPerSec = m_sVhdr2.nBlockAlign * m_sVhdr2.nSamplesPerSec; r = m_pDMO_Filter->m_pMedia->vt->SetOutputType(m_pDMO_Filter->m_pMedia, 0, &m_sDestType, DMO_SET_TYPEF_TEST_ONLY); if (r == 0) r = m_pDMO_Filter->m_pMedia->vt->SetOutputType(m_pDMO_Filter->m_pMedia, 0, &m_sDestType, 0); return r; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/plugins/libwin32/audiodec/DMO_AudioDecoder.h0000644000175000017500000000167407570366464024060 0ustar yavoryavor#ifndef AVIFILE_DMO_AUDIODECODER_H #define AVIFILE_DMO_AUDIODECODER_H #ifndef NOAVIFILE_HEADERS #include "audiodecoder.h" #else #include "libwin32.h" #endif #include "DMO_Filter.h" AVM_BEGIN_NAMESPACE; class DMO_AudioDecoder : public IAudioDecoder { public: DMO_AudioDecoder(const CodecInfo& info, const WAVEFORMATEX*); virtual ~DMO_AudioDecoder(); virtual int Convert(const void*, uint_t, void*, uint_t, uint_t*, uint_t*); virtual void Flush(); virtual uint_t GetMinSize() const; #ifdef NOAVIFILE_HEADERS virtual uint_t GetSrcSize(uint_t) const; #endif virtual int SetOutputFormat(const WAVEFORMATEX* destfmt); int init(); const char* getError() const { return m_Error; } protected: DMO_MEDIA_TYPE m_sOurType, m_sDestType; DMO_Filter* m_pDMO_Filter; WAVEFORMATEX m_sVhdr2; WAVEFORMATEX* m_pVhdr; int m_iFlushed; char m_Error[128]; }; AVM_END_NAMESPACE; #endif // AVIFILE_DMO_AUDIODECODER_H avifile-0.7.48~20090503.ds/plugins/libwin32/audiodec/DS_AudioDecoder.cpp0000644000175000017500000001300111171057001024235 0ustar yavoryavor/** * DirectShow audio decoder * Copyright 2001 Eugene Kuznetsov (divx@euro.ru) */ #include "DS_AudioDecoder.h" #include "ldt_keeper.h" #include "utils.h" #include #include #include AVM_BEGIN_NAMESPACE; DS_AudioDecoder::DS_AudioDecoder(const CodecInfo& info, const WAVEFORMATEX* wf) :IAudioDecoder(info, wf), m_pDS_Filter(0), m_pVhdr(0) { const unsigned int WFSIZE = sizeof(WAVEFORMATEX); int sz = WFSIZE + wf->cbSize; m_pVhdr = (WAVEFORMATEX*) malloc(sz); memcpy(m_pVhdr, wf, sz); //m_Format.nBlockAlign *= 2; //for (int i = 0; i < WFSIZE + wf->cbSize; i++) // printf("%d %x\n", i, ((unsigned char*)m_pVhdr)[i]); m_sVhdr2 = *((WAVEFORMATEX*) m_pVhdr); m_sVhdr2.wFormatTag = 1; m_sVhdr2.wBitsPerSample = 16; m_sVhdr2.nBlockAlign = m_sVhdr2.nChannels * (m_sVhdr2.wBitsPerSample + 7) / 8; m_sVhdr2.cbSize = 0; m_sVhdr2.nAvgBytesPerSec = m_sVhdr2.nBlockAlign * m_sVhdr2.nSamplesPerSec; //char bb[200]; avm_wave_format(bb, sizeof(bb), &m_sVhdr2); //printf("DSFORMAT %d %s\n", sizeof(m_sVhdr2), bb); // in IAudioDecoder: m_Format = *wf; memset(&m_sOurType, 0, sizeof(m_sOurType)); m_sOurType.majortype = MEDIATYPE_Audio; m_sOurType.subtype = MEDIASUBTYPE_PCM; m_sOurType.subtype.f1 = wf->wFormatTag; m_sOurType.formattype = FORMAT_WaveFormatEx; m_sOurType.lSampleSize = wf->nBlockAlign; m_sOurType.bFixedSizeSamples = true; m_sOurType.bTemporalCompression = false; m_sOurType.pUnk = 0; m_sOurType.cbFormat = sz; m_sOurType.pbFormat = (char*) m_pVhdr; memset(&m_sDestType, 0, sizeof(m_sDestType)); m_sDestType.majortype = MEDIATYPE_Audio; m_sDestType.subtype = MEDIASUBTYPE_PCM; m_sDestType.formattype = FORMAT_WaveFormatEx; m_sDestType.bFixedSizeSamples = true; m_sDestType.bTemporalCompression = false; m_sDestType.lSampleSize = m_sVhdr2.nBlockAlign; if (wf->wFormatTag == 0x130) // ACEL hack to prevent memory corruption // obviosly we are missing something here m_sDestType.lSampleSize *= 288; m_sDestType.pUnk = 0; m_sDestType.cbFormat = sizeof(m_sVhdr2); m_sDestType.pbFormat = (char*) &m_sVhdr2; } int DS_AudioDecoder::init() { Setup_FS_Segment(); m_pDS_Filter = DS_FilterCreate(m_Info.dll.c_str(), &m_Info.guid, &m_sOurType, &m_sDestType); if (!m_pDS_Filter) { sprintf(m_Error, "can't open DS_Filter"); return -1; } m_pDS_Filter->Start(m_pDS_Filter); ALLOCATOR_PROPERTIES props, props1; props.cBuffers = 1; props.cbBuffer = m_sOurType.lSampleSize; props.cbAlign = props.cbPrefix = 0; //printf("CBBUFFER %d %d\n", props.cbBuffer, m_sDestType.lSampleSize); if (!m_pDS_Filter->m_pAll) { sprintf(m_Error, "can't open DS_Filter"); return -1; } m_pDS_Filter->m_pAll->vt->SetProperties(m_pDS_Filter->m_pAll, &props, &props1); m_pDS_Filter->m_pAll->vt->Commit(m_pDS_Filter->m_pAll); return 0; } DS_AudioDecoder::~DS_AudioDecoder() { Setup_FS_Segment(); if (m_pVhdr) free(m_pVhdr); if (m_pDS_Filter) DS_Filter_Destroy(m_pDS_Filter); } int DS_AudioDecoder::Convert(const void* in_data, uint_t in_size, void* out_data, uint_t out_size, uint_t* size_read, uint_t* size_written) { char* ptr; char* frame_pointer; uint_t frame_size = 0; uint_t written = 0; uint_t read = 0; IMediaSample* sample = 0; Setup_FS_Segment(); //printf("INSIZE %d %d %d\n", in_size,m_pFormat->nBlockAlign, in_size % m_pFormat->nBlockAlign); m_pDS_Filter->m_pOurOutput->SetFramePointer(m_pDS_Filter->m_pOurOutput, &frame_pointer); m_pDS_Filter->m_pOurOutput->SetFrameSizePointer(m_pDS_Filter->m_pOurOutput, (long*)&frame_size); m_pDS_Filter->m_pAll->vt->GetBuffer(m_pDS_Filter->m_pAll, &sample, 0, 0, 0); if (sample) { while (in_size >= m_pFormat->nBlockAlign) { int r; sample->vt->SetActualDataLength(sample, m_pFormat->nBlockAlign); sample->vt->GetPointer(sample, (BYTE **)&ptr); if (!ptr) break; memcpy(ptr, in_data, m_pFormat->nBlockAlign); sample->vt->SetSyncPoint(sample, true); sample->vt->SetPreroll(sample, 0); r = m_pDS_Filter->m_pImp->vt->Receive(m_pDS_Filter->m_pImp, sample); if (r) Debug printf("DS_AudioDecoder::Convert() Error: putting data into input pin %x\n", r); if (frame_size > out_size) frame_size = out_size; memcpy(out_data, frame_pointer, frame_size); //printf("Frame %p size: %d %d\n", frame_pointer, frame_size, m_pFormat->nBlockAlign); read = m_pFormat->nBlockAlign; written = frame_size; break; } sample->vt->Release((IUnknown*)sample); } else { Debug printf("DS_AudioDecoder::Convert() Error: null sample\n"); } //printf("READ %d %d %d %d\n", read, written, in_size, out_size); if (size_read) *size_read = read; if (size_written) *size_written = written; return (read > 0 || written > 0) ? 0 : -1; } uint_t DS_AudioDecoder::GetMinSize() const { // For Voxware - use 80KB large buffers // - minimizing ugly clics & pops in the sound //if (m_Info.fourcc == 0x75) // return 80000; return IAudioDecoder::GetMinSize(); } #ifdef NOAVIFILE_HEADERS uint_t DS_AudioDecoder::GetSrcSize(uint_t dest_size) const { double efficiency = (double) m_pFormat.nAvgBytesPerSec / (m_pFormat.nSamplesPerSec*m_pFormat.nBlockAlign); int frames = int(dest_size*efficiency); if (frames < 1) frames = 1; return frames * m_pFormat.nBlockAlign; } #endif AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/plugins/libwin32/audiodec/DS_AudioDecoder.h0000644000175000017500000000150607570366464023741 0ustar yavoryavor#ifndef AVIFILE_DS_AUDIODECODER_H #define AVIFILE_DS_AUDIODECODER_H #ifndef NOAVIFILE_HEADERS #include "audiodecoder.h" #else #include "libwin32.h" #endif #include "DS_Filter.h" AVM_BEGIN_NAMESPACE; class DS_AudioDecoder : public IAudioDecoder { public: DS_AudioDecoder(const CodecInfo& info, const WAVEFORMATEX*); virtual ~DS_AudioDecoder(); virtual int Convert(const void*, uint_t, void*, uint_t, uint_t*, uint_t*); virtual uint_t GetMinSize() const; #ifdef NOAVIFILE_HEADERS virtual uint_t GetSrcSize(uint_t) const; #endif int init(); const char* getError() const { return m_Error; } protected: AM_MEDIA_TYPE m_sOurType, m_sDestType; DS_Filter* m_pDS_Filter; WAVEFORMATEX m_sVhdr2; WAVEFORMATEX* m_pVhdr; char m_Error[128]; }; AVM_END_NAMESPACE; #endif // AVIFILE_DS_AUDIODECODER_H avifile-0.7.48~20090503.ds/plugins/libwin32/audiodec/Makefile.am0000644000175000017500000000063407570366464022710 0ustar yavoryavorif AMM_USE_WIN32 noinst_LTLIBRARIES = libaudiodec.la endif noinst_HEADERS = \ ACM_AudioDecoder.h \ DMO_AudioDecoder.h \ DS_AudioDecoder.h libaudiodec_la_SOURCES = \ ACM_AudioDecoder.cpp \ DMO_AudioDecoder.cpp \ DS_AudioDecoder.cpp AM_CPPFLAGS = -I$(srcdir)/../loader -I$(srcdir)/../loader/dmo -I$(srcdir)/../loader/dshow -I$(srcdir)/.. AM_CXXFLAGS = $(CXXRTTIEXCEPT) MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libwin32/Makefile.am0000644000175000017500000000241111110406016021073 0ustar yavoryavorSUBDIRS = loader audiodec videocodec if AMM_USE_WIN32 pkglib_LTLIBRARIES = win32.la check_PROGRAMS = test testaudio testvideo testcodecs testprepare endif noinst_HEADERS =\ fillplugins.h\ libwin32.h win32_la_SOURCES = libwin32.cpp win32_la_LDFLAGS = -avoid-version -module win32_la_LIBADD =\ audiodec/libaudiodec.la\ loader/libloader.la\ videocodec/libvideocodec.la\ ../../lib/libaviplay.la $(PTHREAD_LIBS) #$(pkglib_LTLIBRARIES) #TEST_LIBS = ../libffmpeg/ffmpeg.la ../../lib/libaviplay.la $(SDL_LIBS) TEST_LIBS = win32.la test_SOURCES = test.cpp test_LDFLAGS = $(TEST_LIBS) testaudio_SOURCES = testaudio.cpp testaudio_LDFLAGS = $(TEST_LIBS) testvideo_SOURCES = testvideo.cpp testvideo_LDFLAGS = $(TEST_LIBS) testcodecs_SOURCES = testcodecs.cpp testcodecs_LDFLAGS = $(TEST_LIBS) testprepare_SOURCES = testprepare.cpp testprepare_LDFLAGS = $(TEST_LIBS) EXTRA_DIST = testloader.c AM_CPPFLAGS = $(LTNOPIC) -I$(srcdir)/loader -I$(srcdir)/loader/dshow\ -I$(srcdir)/loader/wine -I$(srcdir)/videocodec -I$(srcdir)/audiodec\ -I$(srcdir)/loader/dmo AM_CXXFLAGS = $(CXXRTTIEXCEPT) # speedup compilation of libwin32.cpp - it's not necessary to have # this code fast anyway - runs only few times #AM_CXXFLAGS = $(CINLINEFLAGS) $(CXXRTTIEXCEPT) MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libwin32/fillplugins.h0000644000175000017500000012120411172166410021553 0ustar yavoryavor#ifndef WIN32_FILLPLUGINS_H #define WIN32_FILLPLUGINS_H #include "infotypes.h" #include "avm_fourcc.h" AVM_BEGIN_NAMESPACE; static const char* const none_about = "No help available for this codec."; static void add_divx(avm::vector& ci) { const char* const divx_about = "Very popular MPEG-4 video codec, based on " "Microsoft MPEG-4 implementation. Advanced " "compression technologies allow it to " "compress 640x480x25 video with a perfect " "quality into 100-150 kbytes/s ( 3-4 times " "less than MPEG-2 ), by the cost of increased " "requirements for playback.
" "See http://www.divx.com and " "http://www.mydivx.com"; const GUID CLSID_WMV1 = { 0x4facbba1, 0xffd8, 0x4cd7, {0x82, 0x28, 0x61, 0xe2, 0xf6, 0x5c, 0xb1, 0xae} }; const GUID CLSID_WMV2 = { 0x521fb373, 0x7654, 0x49f2, {0xbd, 0xb1, 0x0c, 0x6e, 0x66, 0x60, 0x71, 0x4f} }; const GUID CLSID_WMV2DMO = { 0x12b31b03, 0xaf47, 0x4106, {0xbb, 0xe8, 0xea, 0x29, 0x60, 0x28, 0x2c, 0x50} }; const GUID CLSID_WMV3DMO = { 0x82d353df, 0x90bd, 0x4382, {0x8b, 0xc2, 0x3f, 0x61, 0x92, 0xb7, 0x6e, 0x34} }; const GUID CLSID_WMV39DMO = { 0x724bb6a4, 0xe526, 0x450f, {0xaf, 0xfa, 0xab, 0x9b, 0x45, 0x12, 0x91, 0x11} }; #ifndef GUIDS_H const GUID CLSID_DivxDecompressorCF = { 0x82ccd3e0, 0xf71a, 0x11d0, { 0x9f, 0xe5, 0x00, 0x60, 0x97, 0x78, 0xaa, 0xaa} }; #endif #define DIVX_FCCS \ fccDIV3, fccdiv3, fccDIV4, fccdiv4, \ fccDIV5, fccdiv5, fccDIV6, fccdiv6, \ fccMP41, fccMP43, fccmp43, \ fccAP41, fccap41, fccAP42, fccap42 const fourcc_t wmv1_codecs[] = { fccWMV1, fccwmv1, 0 }; /* it may be able to decode wmv1, but it's not */ const fourcc_t wmv2_codecs[] = { fccWMV2, fccwmv2, 0 }; const fourcc_t wmv3_codecs[] = { RIFFINFO_WMV3, RIFFINFO_wmv3, fccWMV2, fccwmv2, fccWMV1, fccwmv1, mmioFOURCC('M', 'S', 'S', '2'), mmioFOURCC('W', 'M', 'V', 'P'), 0 }; const fourcc_t wmv39_codecs[] = { RIFFINFO_WMV3, RIFFINFO_wmv3, mmioFOURCC('W', 'M', 'V', 'P'), 0 }; /* divx directshow is able to decode large variety of formats */ const fourcc_t div3_codecsd[] = { DIVX_FCCS, 0 }; const fourcc_t div5_codecsd[] = { fccDIV5, DIVX_FCCS, 0 }; const fourcc_t div3_codecs[] = { fccDIV3, fccdiv3, DIVX_FCCS, 0 }; const fourcc_t div4_codecs[] = { fccDIV4, fccdiv4, 0 }; // using different codec - divxcfvk.ax when available const fourcc_t div5_codecs[] = { fccDIV5, fccdiv5, fccDIV3, fccdiv3, 0 }; const fourcc_t div6_codecs[] = { fccDIV6, fccdiv6, fccDIV4, fccdiv4, 0 }; // FIFO order is important - if this will ever change - few things // would have to be repaired avm::vector vs; avm::vector vs_empty; avm::vector ds; vs.push_back(AttributeInfo("BitRate", "BitRate (kbps)", AttributeInfo::Integer, 0, 10000)); vs.push_back(AttributeInfo("Crispness", "Crispness (0-100)", AttributeInfo::Integer, 0, 100, 100)); vs.push_back(AttributeInfo("KeyFrames", "Keyframes (in sec)", AttributeInfo::Integer, 0, 30, 3)); //ds.push_back(AttributeInfo("Quality", "Quality/CPU balance ( 0 fastest )", AttributeInfo::Integer, 0, 4)); avm::vector ds1; ds1.push_back(AttributeInfo("Quality", "Quality/CPU balance ( 0 fastest )", AttributeInfo::Integer, 0, 4)); ds1.push_back(AttributeInfo("maxauto", "Maximum autoquality level", AttributeInfo::Integer, 0, 4, 4)); ds1.push_back(AttributeInfo("Brightness", "Brightness", AttributeInfo::Integer, 0, 100)); ds1.push_back(AttributeInfo("Contrast", "Contrast", AttributeInfo::Integer, 0, 100)); ds1.push_back(AttributeInfo("Saturation", "Saturation", AttributeInfo::Integer, 0, 100)); ds1.push_back(AttributeInfo("Hue", "Hue", AttributeInfo::Integer, 0, 100)); // DS player ci.push_back(CodecInfo(div5_codecsd, "W32 DivX ;-) VKI DirectShow", "divxcvki.ax", divx_about, CodecInfo::DShow_Dec, "divxvkids", CodecInfo::Video, CodecInfo::Decode, &CLSID_DivxDecompressorCF, vs_empty, ds1)); // DS player ci.push_back(CodecInfo(div3_codecsd, "W32 DivX ;-) DirectShow", "divx_c32.ax", divx_about, CodecInfo::DShow_Dec, "divxds", CodecInfo::Video, CodecInfo::Decode, &CLSID_DivxDecompressorCF, vs_empty, ds1)); // for encoding ci.push_back(CodecInfo(div5_codecs, "W32 DivX ;-) VKI (Low-Motion)", "divxcvki.dll", divx_about, CodecInfo::Win32, "divxvkil", CodecInfo::Video, CodecInfo::Both, 0, vs, ds)); // for encoding ci.push_back(CodecInfo(div6_codecs, "W32 DivX ;-) VKI (Fast-Motion)", "divxcfvk.dll", divx_about, CodecInfo::Win32, "divxvkif", CodecInfo::Video, CodecInfo::Both, 0, vs, ds)); // for encoding ci.push_back(CodecInfo(div3_codecs, "W32 DivX ;-) Low-Motion", "divxc32.dll", divx_about, CodecInfo::Win32, "divx", CodecInfo::Video, CodecInfo::Both, 0, vs, ds)); // for encoding ci.push_back(CodecInfo(div4_codecs, "W32 DivX ;-) Fast-Motion", "divxc32f.dll", divx_about, CodecInfo::Win32, "divxf", CodecInfo::Video, CodecInfo::Both, 0, vs, ds)); ci.push_back(CodecInfo(wmv1_codecs, "W32 Windows Media Video 7 DirectShow", "wmvds32.ax", none_about, CodecInfo::DShow_Dec, "wmv7", CodecInfo::Video, CodecInfo::Decode, &CLSID_WMV1, vs_empty, ds1)); ci.push_back(CodecInfo(wmv2_codecs, "W32 Windows Media Video 8 DirectShow", "wmv8ds32.ax", none_about, CodecInfo::DShow_Dec, "wmv8", CodecInfo::Video, CodecInfo::Decode, &CLSID_WMV2, vs_empty, ds1)); avm::vector wmattr; wmattr.push_back(AttributeInfo("Quality", "Quality/CPU balance ( 0 fastest )", AttributeInfo::Integer, 0, 4)); wmattr.push_back(AttributeInfo("Fake Player Behind", "Fake Player Behind", AttributeInfo::Integer, 0, 1)); wmattr.push_back(AttributeInfo("Omit BF Mode", "Omit BF Mode", AttributeInfo::Integer, 0, 1)); wmattr.push_back(AttributeInfo("Adapt Post Process Mode", "Adapt Post Process Mode", AttributeInfo::Integer, 0, 1)); wmattr.push_back(AttributeInfo("Deinterlace", "Deinterlace", AttributeInfo::Integer, 0, 1)); ci.push_back(CodecInfo(wmv3_codecs, "W32 Windows Media Video DMO", "wmvdmod.dll", none_about, CodecInfo::DMO, "wmvdmod", CodecInfo::Video, CodecInfo::Decode, &CLSID_WMV3DMO, 0, wmattr)); ci.push_back(CodecInfo(wmv39_codecs, "W32 Windows Media Video 9 DMO", "wmv9dmod.dll", none_about, CodecInfo::DMO, "wmv9dmod", CodecInfo::Video, CodecInfo::Decode, &CLSID_WMV39DMO)); #if 0 ci.push_back(CodecInfo(wmv1_codecs, "W32 WMV enc dll", "wmvdmoe.dll", none_about, CodecInfo::Win32, "wmvdmo_enc", CodecInfo::Video, CodecInfo::Encode)); #endif #if 0 // doesn't work 0x80004005 ci.push_back(CodecInfo(wmv2_codecs, "W32 WMV8 DMO decoder", "wmv8dmod.dll", none_about, CodecInfo::DMO, "wmv8dmod", CodecInfo::Video, CodecInfo::Decode, &CLSID_WMV2DMO)); #endif const char* mpg4_about = "Old beta version of Microsoft MPEG-4 " "video codec, incompatible with DivX ;-)."; const fourcc_t mpg4_codecs[]= { fccMP42, fccmp42, fccmp43, fccMPG4, fccmpg4, fccDIV2, fccdiv2, 0 }; ci.push_back(CodecInfo(mpg4_codecs, "W32 Microsoft MPEG-4 DirectShow", "mpg4ds32.ax", mpg4_about, CodecInfo::DShow_Dec, "mpeg4ds", CodecInfo::Video, CodecInfo::Decode)); ci.push_back(CodecInfo(mpg4_codecs, "W32 Microsoft MPEG-4", "mpg4c32.dll", mpg4_about, CodecInfo::Win32, "mpeg4", CodecInfo::Video, CodecInfo::Both, 0, vs, ds)); } static void add_angel(avm::vector& ci) { // crashing - using divx instead of this const fourcc_t apxx_codecs[] = { fccAP41, fccap41, fccAP42, fccap42, 0 }; ci.push_back(CodecInfo(apxx_codecs, "W32 AngelPotion MPEG-4", "apmpg4v1.dll", none_about, CodecInfo::Win32, "angelpotion")); } static void add_ati(avm::vector& ci) { const fourcc_t vcr1_codecs[] = { fccVCR1, 0 }; const fourcc_t vcr2_codecs[] = { fccVCR2, 0 }; ci.push_back(CodecInfo(vcr1_codecs, "W32 ATI VCR-1", "ativcr1.dll", none_about, CodecInfo::Win32, "vcr1", CodecInfo::Video, CodecInfo::Decode)); ci.push_back(CodecInfo(vcr2_codecs, "W32 ATI VCR-2", "ativcr2.dll", none_about, CodecInfo::Win32, "vcr2", CodecInfo::Video, CodecInfo::Decode)); } static void add_asus(avm::vector& ci) { const fourcc_t asv1_codecs[] = { fccASV1, 0 }; const fourcc_t asv2_codecs[] = { fccASV2, 0 }; ci.push_back(CodecInfo(asv1_codecs, "W32 ASUS V1 - crash", "asusasvd.dll", none_about, CodecInfo::Win32, "asv1", CodecInfo::Video, CodecInfo::Decode)); ci.push_back(CodecInfo(asv2_codecs, "W32 ASUS V2", "asusasv2.dll", none_about, CodecInfo::Win32, "asv2", CodecInfo::Video, CodecInfo::Decode)); } static void add_brooktree(avm::vector& ci) { const char* brook_about = "W32 BtV Media Stream Version 1.0" "Copyright Brooktree Corporation 1994-1997"; const fourcc_t bt20_codecs[] = { mmioFOURCC('B', 'T', '2', '0'), 0 }; const fourcc_t yuv411_codecs[] = { mmioFOURCC('Y', '4', '1', 'P'), 0 }; const fourcc_t yvu9_codecs[] = { mmioFOURCC('Y', 'V', 'Y', '9'), 0 }; // missing: Called unk_GetWindowDC ci.push_back(CodecInfo(bt20_codecs, "W32 Brooktree(r) ProSummer Video", "btvvc32.drv", brook_about, CodecInfo::Win32, "btree", CodecInfo::Video, CodecInfo::Both)); ci.push_back(CodecInfo(yuv411_codecs, "W32 Brooktree(r) YUV411 Raw", "btvvc32.drv", brook_about, CodecInfo::Win32, "btree_yuv411", CodecInfo::Video, CodecInfo::Both)); ci.push_back(CodecInfo(yvu9_codecs, "W32 Brooktree(r) YVU9 Raw", "btvvc32.drv", brook_about, CodecInfo::Win32, "btree_yvu9", CodecInfo::Video, CodecInfo::Decode)); } static void add_dvsd(avm::vector& ci) { const char* dvsd_about = "W32 Sony Digital Video (DV)"; const fourcc_t dvsd_codecs[] = { fccdvsd, fccDVSD, fccdvhd, fccdvsl, 0 }; const GUID CLSID_DVSD = { 0xB1B77C00, 0xC3E4, 0x11CF, {0xAF, 0x79, 0x00, 0xAA, 0x00, 0xB6, 0x7A, 0x42} }; ci.push_back(CodecInfo(dvsd_codecs, "W32 DVSD (MainConcept)", "qdv.dll", dvsd_about, CodecInfo::DShow_Dec, "qdv", CodecInfo::Video, CodecInfo::Decode, &CLSID_DVSD)); // not a true Win32 library //ci.push_back(CodecInfo(dvsd_codecs, // "DVSD", "qdv.dll", // dvsd_about, CodecInfo::Win32, // CodecInfo::Video, CodecInfo::Both)); } static void add_divx4(avm::vector& ci) { // External func COMCTL32.dll:17 #ifndef GUIDS_H const GUID IID_IDivxFilterInterface = { 0x78766964, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} }; #endif avm::vector vs_empty; avm::vector ds; ds.push_back(AttributeInfo("postprocessing", "Image postprocessing mode ( 6 slowest )", AttributeInfo::Integer, 0, 6)); ds.push_back(AttributeInfo("maxauto", "Maximum autoquality level", AttributeInfo::Integer, 0, 6)); ds.push_back(AttributeInfo("Brightness", "Brightness", AttributeInfo::Integer, -128, 127)); ds.push_back(AttributeInfo("Contrast", "Contrast", AttributeInfo::Integer, -128, 127)); ds.push_back(AttributeInfo("Saturation", "Saturation", AttributeInfo::Integer, -128, 127)); avm::vector ds1; ds1.push_back(AttributeInfo("postprocessing", "Image postprocessing mode ( 6 slowest )", AttributeInfo::Integer, 0, 6)); const char* opendivxw_about = "W32 DivX 4.0 Beta Codec MPEG-4"; const fourcc_t opendivxw_codecs[] = { fccDIVX, fccdivx, fccDIV1, fccdiv1, fccMP4S, fccmp4s, 0x4, RIFFINFO_XVID, RIFFINFO_XviD, RIFFINFO_xvid, 0 }; const fourcc_t div3_codecs[] = { // DIV3 - works but only for some movies fccDIVX, fccDIV3, fccdiv3, fccDIV4, fccdiv4, fccDIV5, fccdiv5, fccDIV6, fccdiv6, fccMP41, fccMP43, fccmp43, // unsupported fccAP41, fccap41, fccAP42, fccap42, 0 }; const fourcc_t divxall_codecs[] = { fccDIVX, fccdivx, fccDIV1, fccdiv1, fccMP4S, fccmp4s, 0x4, fccDIVX, fccDIV3, fccdiv3, fccDIV4, fccdiv4, fccDIV5, fccdiv5, fccDIV6, fccdiv6, fccMP41, fccMP43, fccmp43, 0 }; // implementation of some Direct Draw interface is not necessary // check fails but codec works ci.push_back(CodecInfo(opendivxw_codecs, "W32 DivX4 OpenDivX DirectShow", "divxdec.ax", opendivxw_about, CodecInfo::DShow_Dec, "divx4ds", CodecInfo::Video, CodecInfo::Decode, &IID_IDivxFilterInterface, vs_empty, ds)); ci.push_back(CodecInfo(div3_codecs, "W32 DivX4 DivX ;-) DirectShow", "divxdec.ax", opendivxw_about, CodecInfo::DShow_Dec, "divx4ds311", CodecInfo::Video, CodecInfo::Decode, &IID_IDivxFilterInterface, vs_empty, ds)); ci.push_back(CodecInfo(divxall_codecs, "W32 DivX4 4.0 Beta Codec", "divx.dll", opendivxw_about, CodecInfo::Win32, "divx4vfw", CodecInfo::Video, // there is some bug while checking for support // for YUY2 & YV12 support for encoder FIXME CodecInfo::Decode, //CodecInfo::Both, &IID_IDivxFilterInterface, vs_empty, ds1)); } static void add_divx5(avm::vector& ci) { // maybe we could add support for DirectShow Win32 filter later #ifndef GUIDS_H const GUID IID_IDivxFilterInterface = { 0x78766964, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} }; #endif avm::vector vs_empty; avm::vector ds; ds.push_back(AttributeInfo("postprocessing", "Image postprocessing mode ( 6 slowest )", AttributeInfo::Integer, 0, 6)); ds.push_back(AttributeInfo("maxauto", "Maximum autoquality level", AttributeInfo::Integer, 0, 6)); ds.push_back(AttributeInfo("Brightness", "Brightness", AttributeInfo::Integer, -128, 127)); ds.push_back(AttributeInfo("Contrast", "Contrast", AttributeInfo::Integer, -128, 127)); ds.push_back(AttributeInfo("Saturation", "Saturation", AttributeInfo::Integer, -128, 127)); avm::vector ds1; ds1.push_back(AttributeInfo("postprocessing", "Image postprocessing mode ( 6 slowest )", AttributeInfo::Integer, 0, 6)); const char* opendivxw_about = "W32 DivX 5.0 MPEG-4"; const fourcc_t opendivxw_codecs[] = { fccDIVX, fccdivx, fccDIV1, fccdiv1, fccMP4S, fccmp4s, 0x4, 0 }; const fourcc_t div3_codecs[] = { // DIV3 - works but only for some movies fccDIVX, fccDIV3, fccdiv3, fccDIV4, fccdiv4, fccDIV5, fccdiv5, fccDIV6, fccdiv6, fccMP41, fccMP43, fccmp43, fccAP41, fccap41, fccAP42, fccap42, 0 }; const fourcc_t divxall_codecs[] = { fccDX50, fccdx50, fccDIVX, fccdivx, fccDIV1, fccdiv1, fccMP4S, fccmp4s, 0x4, fccDIVX, fccDIV3, fccdiv3, fccDIV4, fccdiv4, fccDIV5, fccdiv5, fccDIV6, fccdiv6, fccMP41, fccMP43, fccmp43, fccAP41, fccap41, fccAP42, fccap42, 0 }; // implementation of some Direct Draw interface is not necessary // check fails but codec works ci.push_back(CodecInfo(divxall_codecs, "W32 DivX5 5.0 DirectShow", "divxdec.ax", opendivxw_about, CodecInfo::DShow_Dec, "divx4ds", CodecInfo::Video, CodecInfo::Decode, &IID_IDivxFilterInterface, vs_empty, ds)); ci.push_back(CodecInfo(div3_codecs, "W32 DivX5 DirectShow 3.11 compatible decoder", "divxdec.ax", opendivxw_about, CodecInfo::DShow_Dec, "divx4ds311", CodecInfo::Video, CodecInfo::Decode, &IID_IDivxFilterInterface, vs_empty, ds)); #if 0 // is there someone who could 'make this' usable outside of Win32 :) ci.push_back(CodecInfo(divxall_codecs, "W32 DivX5 5.0 Codec MPEG-4", "divx5.dll", opendivxw_about, CodecInfo::Win32, "divx5vfw", CodecInfo::Video, CodecInfo::Decode, &IID_IDivxFilterInterface, vs_empty, ds1)); #endif } static void add_xvid(avm::vector& ci) { // maybe we could add support for DirectShow Win32 filter later avm::vector vs_empty; avm::vector ds; ds.push_back(AttributeInfo("post_enabled", "Enable postprocessing", AttributeInfo::Integer, 0, 1)); ds.push_back(AttributeInfo("post_mv_visible", "Show motion vectors", AttributeInfo::Integer, 0, 1)); ds.push_back(AttributeInfo("post_histogram", "Show histogram", AttributeInfo::Integer, 0, 1)); ds.push_back(AttributeInfo("post_comparision", "Show comparision", AttributeInfo::Integer, 0, 1)); ds.push_back(AttributeInfo("post_brightness", "Brightness", AttributeInfo::Integer, 0, 100)); ds.push_back(AttributeInfo("post_contrast", "Contrast", AttributeInfo::Integer, 0, 100)); ds.push_back(AttributeInfo("post_saturation", "Saturation", AttributeInfo::Integer, 0, 100)); avm::vector ds1; const char* xvid_about = "W32 XviD MPEG-4 (extra)
" "this code is very cool if you will download" "Win32 xvid.dll from:
" "" "http://www.geocities.com/avihpit/xvid/post.html"; const fourcc_t xvid_codecs[] = { fccXVID, fccDIVX, fccdivx, 0 }; const GUID IID_IXvidDecoder = { 0x00000000, 0x4fef, 0x40d3, {0xb3, 0xfa, 0xe0, 0x53, 0x1b, 0x89, 0x7f, 0x98} }; ci.push_back(CodecInfo(xvid_codecs, "W32 XviD MPEG-4 Video Decoder", "xvid.ax", xvid_about, CodecInfo::DShow_Dec, "xvidds", CodecInfo::Video, CodecInfo::Decode, &IID_IXvidDecoder, vs_empty, ds)); ci.push_back(CodecInfo(xvid_codecs, "W32 XviD MPEG-4 Codec", "xvid.dll", xvid_about, CodecInfo::Win32, "xvidvfw", CodecInfo::Video, CodecInfo::Decode, 0, vs_empty, ds)); } static void add_indeo(avm::vector& ci) { const char* ivxx_about = "A set of wavelet video codecs, developed " "by Intel and currently owned by Ligos corp. " "Indeo Video 5.0 with turned on \"QuickCompress\" " "option is a good choice for real-time video " "capture - it is faster than DivX ;-) and compresses " "data better than Motion JPEG.
" "Home page: " "http://www.ligos.com/indeo"; #ifndef GUIDS_H const GUID CLSID_IV50_Decoder = { 0x30355649, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} }; #endif const fourcc_t iv50_codecs[] = { fccIV50, fcciv50, 0 }; const fourcc_t iv41_codecs[] = { fccIV41, fcciv41, 0 }; const fourcc_t iv32_codecs[] = { fccIV32, fcciv32, 0 }; const fourcc_t iv31_codecs[] = { fccIV31, fcciv31, 0 }; const fourcc_t iv3132_codecs[] = { fccIV31, fcciv31, fccIV32, fcciv32, 0 }; avm::vector vs; avm::vector ds; ds.push_back(AttributeInfo("Brightness", "Brightness", AttributeInfo::Integer, -100, 100)); ds.push_back(AttributeInfo("Contrast", "Contrast", AttributeInfo::Integer, -100, 100)); ds.push_back(AttributeInfo("Saturation", "Saturation", AttributeInfo::Integer, -100, 100)); ci.push_back(CodecInfo(iv50_codecs, "W32 Indeo(r) Video 5.0 DirectShow", "ir50_32.dll", ivxx_about, CodecInfo::DShow_Dec, "indeo5ds", CodecInfo::Video, CodecInfo::Decode, &CLSID_IV50_Decoder, vs, ds)); vs.push_back(AttributeInfo("QuickCompress", "Quick Compress", AttributeInfo::Integer, 0, 1)); //vs.push_back(AttributeInfo("Transparency", "Transparency", AttributeInfo::Integer, 0, 1)); //vs.push_back(AttributeInfo("Scalability", "Scalability", AttributeInfo::Integer, 0, 1)); ci.push_back(CodecInfo(iv50_codecs, "W32 Indeo(r) Video 5.04", "ir50_32.dll", ivxx_about, CodecInfo::Win32, "indeo5", CodecInfo::Video, CodecInfo::Both, 0, vs)); ci.push_back(CodecInfo(iv41_codecs, "W32 Indeo(r) Video 4.1", "ir41_32.dll", ivxx_about, CodecInfo::Win32, "indeo4", CodecInfo::Video, CodecInfo::Both, 0, vs)); ci.push_back(CodecInfo(iv3132_codecs, "W32 Indeo(r) Video 3.1/3.2 decoder", "ir32_32.dll", ivxx_about, CodecInfo::Win32, "indeo3", CodecInfo::Video, CodecInfo::Decode)); #if 1 /* these two doesn't work and causes crashes */ ci.push_back(CodecInfo(iv32_codecs, "W32 Indeo(r) Video 3.2", "ir32_32.dll", ivxx_about, CodecInfo::Win32, "indeo32_enc", CodecInfo::Video, CodecInfo::Encode)); //ci.push_back(CodecInfo(iv31_codecs, "Indeo Video 3.1", "ir32_32.dll", // ivxx_about, CodecInfo::Win32, "indeo31_enc", // CodecInfo::Video, CodecInfo::Encode)); #endif } static void add_morgan(avm::vector& ci) { const char* mjpg_about = "Very fast Motion JPEG video codec, by Morgan " "Multimedia company. Recommended for " "video capture on slow machines or in high " "resolutions. Shareware. Current version " "is time-limited and will stop working after " "Mar. 1, 2001. Registration costs $25. Visit " "their web site for details.
" "Web site: " "http://www.morgan-multimedia.com"; const GUID CLSID_MorganMjpeg = { 0x6988b440, 0x8352, 0x11d3, {0x9b, 0xda, 0xca, 0x86, 0x73, 0x7c, 0x71, 0x68} }; const fourcc_t mjpg_codecs[] = { fccMJPG, fccmjpg, 0 }; const char* const mjpeg_modes[] = { "Fast integer", "Integer", "Float", 0 }; avm::vector vs; vs.push_back(AttributeInfo("Mode", "Calculation precision mode", mjpeg_modes)); vs.push_back(AttributeInfo("LicenseKey", "License key", AttributeInfo::String)); vs.push_back(AttributeInfo("UserName", "User name", AttributeInfo::String)); // ci.push_back(CodecInfo(mjpg_codecs, "Motion JPEG DirectShow Decoder", "m3jpegdec.ax",mjpg_about, CodecInfo::DShow_Dec, &CLSID_MorganMjpeg, vs)); /* missing ICOpen ci.push_back(CodecInfo(mjpg_codecs, "Morgan Motion JPEG Direct Show", "m3jpegdec.ax", mjpg_about, CodecInfo::DShow_Dec, CodecInfo::Video, CodecInfo::Decode, &CLSID_MorganMjpeg, 0, vs)); */ ci.push_back(CodecInfo(mjpg_codecs, "W32 Morgan Motion JPEG", "m3jpeg32.dll", mjpg_about, CodecInfo::Win32, "morgands", // this is actually not a morgands, but we don't care (?) CodecInfo::Video, // buggy - CompressBegin reference 0x0 FIXME // CodecInfo::Both, CodecInfo::Decode, 0, vs)); } static void add_mcmjpeg(avm::vector& ci) { const fourcc_t msjpeg_codecs[] = { fccMJPG, fccmjpg, mmioFOURCC('A', 'V', 'R', 'n'), mmioFOURCC('A', 'V', 'D', 'J'), 0 }; ci.push_back(CodecInfo(msjpeg_codecs, "W32 Microsoft Motion JPEG", "mcmjpg32.dll", "", CodecInfo::Win32, "mjpeg", CodecInfo::Video, CodecInfo::Both //CodecInfo::Video, CodecInfo::Decode )); } static void add_pegas(avm::vector& ci) { const fourcc_t mjpg_codecs[] = { fccMJPG, fccmjpg, mmioFOURCC('J', 'P', 'E', 'G'), 0 }; const fourcc_t pvw2_codecs[] = { mmioFOURCC('P', 'V', 'W', '2'), 0 }; const fourcc_t pimj_codecs[] = { fccPIM1, mmioFOURCC('P', 'I', 'M', 'J'), mmioFOURCC('J', 'P', 'G', 'L'), mmioFOURCC('J', 'P', 'E', 'G'), 0 }; const fourcc_t pim1_codecs[] = { fccPIM1, 0 }; ci.push_back(CodecInfo(pvw2_codecs, "W32 PicVideo [PVW2]", "pvwv220.dll", none_about, CodecInfo::Win32, "picvideo", //CodecInfo::Video, CodecInfo::Both CodecInfo::Video, CodecInfo::Decode )); ci.push_back(CodecInfo(mjpg_codecs, "W32 PicVideo [MJPG]", "pvmjpg21.dll", none_about, CodecInfo::Win32, "pv_mjpg", //CodecInfo::Video, CodecInfo::Both CodecInfo::Video, CodecInfo::Decode )); ci.push_back(CodecInfo(pimj_codecs, "W32 PicVideo [PIMJ]", "pvljpg20.dll", none_about, CodecInfo::Win32, "pv_pimj", //CodecInfo::Video, CodecInfo::Both CodecInfo::Video, CodecInfo::Decode )); ci.push_back(CodecInfo(pim1_codecs, "W32 PinnacleS [PIM1]", "avi_pass.ax", none_about, CodecInfo::DShow_Dec, "pv_pim1", //CodecInfo::Video, CodecInfo::Both CodecInfo::Video, CodecInfo::Decode )); } static void add_avid(avm::vector& ci) { const fourcc_t avrn_codecs[] = { mmioFOURCC('A', 'V', 'R', 'n'), mmioFOURCC('A', 'V', 'D', 'J'), 0 }; ci.push_back(CodecInfo(avrn_codecs, "W32 AVID Codec [AVRn]", "avidavicodec.dll", none_about, CodecInfo::Win32, "avid", CodecInfo::Video, CodecInfo::Both )); } static void add_techsmith(avm::vector& ci) { const fourcc_t tscc_codecs[] = { fccTSCC, fcctscc, 0 }; ci.push_back(CodecInfo(tscc_codecs, "W32 TechSmith Screen Capture [TSCC]", "tsccvid.dll", "TechSmith's Screen Capture Codec [TSCC]," "provides lossless image quality coupled with " "excellent compression ratios. Since the TSCC is " "lossless, it preserves 100% of the image quality, " "even through multiple decompression/recompression " "cycles that are typical during the production process." "The TSCC is optimized for screen capture so that " "the resulting files are small and highly compressed." "Visit " "http://www.techsmith.com " "for the latest product information.", CodecInfo::Win32, "tscc", CodecInfo::Video, CodecInfo::Both )); } static void add_huffyuv(avm::vector& ci) { const char* huffyuv_about = "Huffyuv is a very fast, lossless Win32 video " "codec. \"Lossless\" means that the output " "from the decompressor is bit-for-bit " "identical with the original input to the " "compressor. \"Fast\" means a compression " "throughput of up to 38 megabytes per second " "on author\'s 416 MHz Celeron." "Web site: " "http://http://www.math.berkeley.edu/~benrg/huffyuv.html"; const fourcc_t huffyuv_codecs[] = { fccHFYU, 0 }; const char* const huffyuv_modes[] = { "Predict left (fastest)", "Predict gradient", "Predict median (best)", 0 }; avm::vector vs; //vs.push_back(AttributeInfo("Mode", "Calculation precision mode", (const char**)mjpeg_modes)); //ci.push_back(CodecInfo(mjpg_codecs, "Motion JPEG DirectShow Decoder", "m3jpegdec.ax",mjpg_about, CodecInfo::DShow_Dec, &CLSID_MorganMjpeg, vs)); ci.push_back(CodecInfo(huffyuv_codecs, "W32 Huffyuv lossless codec [HFYU]", "huffyuv.dll", huffyuv_about, CodecInfo::Win32, "huffyuv", //CodecInfo::Video, CodecInfo::Decode)); CodecInfo::Video, CodecInfo::Both)); } /* On2 Truemotion VP3.x support */ static void add_vp3(avm::vector& ci) { /* The On2 copyright message taken from the Windows project resource file */ const char* vp3_about = "VP3 Codec " "- Version 3.2.1.0
Copyright (c) 2001 On2 Technologies. " "All Rights Reserved. " "" "http://www.on2.com"; const GUID CLSID_on2 = { 0x4cb63e61, 0xc611, 0x11d0, { 0x83, 0xaa, 0x00, 0x00, 0x92, 0x90, 0x01, 0x84 } }; const fourcc_t apxx_codecs[] = { fccVP31, fccvp31, fccVP30, fccVP30, mmioFOURCC('V', 'P', '4', '0'), mmioFOURCC('T', 'M', '2', 'X'), 0 }; avm::vector vs_empty; avm::vector ds; ds.push_back(AttributeInfo("strPostProcessingLevel", "Postprocessing", AttributeInfo::Integer, 0, 8)); /* vp3 codec contains a bug in ICDECOMPRESSEX initializer ( Codecs/vp31vfw/Win32/vp31vfw.h ) that breaks decoding upside-down images in 'normal' mode ( ICDECOMPRESS ) */ #if 1 /* crashing somewhere after IsRect == TRUE */ ci.push_back(CodecInfo(apxx_codecs, "W32 VP31(r) DirectShow", "on2.ax", vp3_about, CodecInfo::DShow_Dec, "vp3ds", CodecInfo::Video, CodecInfo::Decode, &CLSID_on2)); #endif ci.push_back(CodecInfo(apxx_codecs, "W32 VP31(r) Codec", "vp31vfw.dll", vp3_about, CodecInfo::Win32Ex, "vp3", CodecInfo::Video, CodecInfo::Both, 0, vs_empty, ds)); } static void add_3ivx(avm::vector& ci) { const GUID CLSID_3ivxO = { 0x73f7a062, 0x8829, 0x11d1, { 0xb5, 0x50, 0x00, 0x60, 0x97, 0x24, 0x2d, 0x8d } }; const GUID CLSID_3ivx = { 0x0e6772c0, 0xdd80, 0x11d4, { 0xb5, 0x8f, 0xa8, 0x6b, 0x66, 0xd0, 0x61, 0x1c } }; const fourcc_t ivx_codecs[] = { mmioFOURCC('3', 'I', 'V', '1'), mmioFOURCC('3', 'i', 'v', 'X'), 0 }; ci.push_back(CodecInfo(ivx_codecs, "W32 3ivX", "3ivxdmo.dll", none_about, CodecInfo::DMO, "3ivx", CodecInfo::Video, CodecInfo::Decode, &CLSID_3ivx)); const fourcc_t ucod_codecs[] = { mmioFOURCC('U', 'C', 'O', 'D'), 0 }; ci.push_back(CodecInfo(ucod_codecs, "W32 UCOD-ClearVideo", "clrviddd.dll", none_about, CodecInfo::Win32, "ucod", CodecInfo::Video, CodecInfo::Decode)); const fourcc_t ubmp4_codecs[] = { mmioFOURCC('U', 'M', 'P', '4'), mmioFOURCC('m', 'p', '4', 'v'), 0 }; ci.push_back(CodecInfo(ucod_codecs, "W32 UB Video MPEG 4", "ubvmp4d.dll", none_about, CodecInfo::Win32, "ubmp4", CodecInfo::Video, CodecInfo::Decode)); const fourcc_t qpeg_codecs[] = { mmioFOURCC('Q', '1', '.', '0'), mmioFOURCC('Q', 'P', 'E', 'G'), mmioFOURCC('Q', '1', '.', '1'), mmioFOURCC('q', 'p', 'e', 'q'), 0 }; ci.push_back(CodecInfo(qpeg_codecs, "W32 Q-Team's QPEG (www.q-team.de)", "qpeg32.dll", none_about, CodecInfo::Win32, "qpeg", CodecInfo::Video, CodecInfo::Decode)); const fourcc_t sp5x_codecs[] = { mmioFOURCC('S', 'P', '5', '3'), mmioFOURCC('S', 'P', '5', '4'), mmioFOURCC('S', 'P', '5', '5'), mmioFOURCC('S', 'P', '5', '6'), mmioFOURCC('S', 'P', '5', '7'), mmioFOURCC('S', 'P', '5', '8'), 0 }; ci.push_back(CodecInfo(sp5x_codecs, "W32 SP5x codec - used by Aiptek MegaCam", "sp5x_32.dll", none_about, CodecInfo::Win32, "sp5x", CodecInfo::Video, CodecInfo::Decode)); /* to be supported */ const fourcc_t qtsvq3_codecs[] = { mmioFOURCC('S', 'V', 'Q', '3'), 0 }; ci.push_back(CodecInfo(sp5x_codecs, "W32 Qt SVQ3 decoder", "QuickTime.qts", none_about, CodecInfo::Win32, "qtvideo", CodecInfo::Video, CodecInfo::Decode)); } static void add_audio(avm::vector& ci) { const fourcc_t msadpcm_codecs[] = { 0x02, 0 }; ci.push_back(CodecInfo(msadpcm_codecs, "W32 MS ADPCM", "msadp32.acm", "A Microsoft implementation of Adaptive " "Differential Pulse Code Modulation (ADPCM), " "a common digital audio format capable of " "storing CD-quality audio.", CodecInfo::Win32, "msadpcmacm", CodecInfo::Audio, CodecInfo::Decode)); const GUID CLSID_Voxware = { 0x73f7a062, 0x8829, 0x11d1, { 0xb5, 0x50, 0x00, 0x60, 0x97, 0x24, 0x2d, 0x8d } }; const fourcc_t voxware_codecs[] = { 0x75, 0}; ci.push_back(CodecInfo(voxware_codecs, "W32 Voxware Metasound", "voxmsdec.ax", none_about, CodecInfo::DShow_Dec, "dsvoxware", CodecInfo::Audio, CodecInfo::Decode, &CLSID_Voxware)); const GUID CLSID_Acelp = { 0x4009f700, 0xaeba, 0x11d1, { 0x83, 0x44, 0x00, 0xc0, 0x4f, 0xb9, 0x2e, 0xb7 } }; const fourcc_t acelp_codecs[] = { 0x130, 0 }; ci.push_back(CodecInfo(acelp_codecs, "W32 ACELP(r).net DirectShow", "acelpdec.ax", "A net-based codec using frame-concatenation and " "interlacing for improved music quality. " "ACELP(r).net allows a dual-rate bit-rate of 8.5/6.5 " "kbps or a fixed-rate bit-rate of 5.0 kbps.", CodecInfo::DShow_Dec, "acelp", CodecInfo::Audio, CodecInfo::Decode, &CLSID_Acelp)); // codec ID ? const fourcc_t anet_codecs[] = { 0x130, 0 }; ci.push_back(CodecInfo(anet_codecs, "W32 ACELP(r).net acm", "sl_anet.acm", "Sipro Lab Telcom Audio Codec ACELP(r).net codec", CodecInfo::Win32, "anetacm", CodecInfo::Audio, CodecInfo::Both)); const fourcc_t wma_codecs[] = { 0x160, 0x161, 0 }; ci.push_back(CodecInfo(wma_codecs, "W32 Windows Media Audio", "divxa32.acm", "More fully known as Microsoft(c) Windows Media(tm) " "audio compression. This is the standard codec for " "Microsoft Active Streaming Format which combines " "fast encoding with high music quality and is " "optimized for Pentium II (MMX) and Pentium III " "(SSE/SIMD) processors. WM-AUDIO has a wide bit-rate " "range from 5 kbps to 128 kbps and offers high quality " "sound over the Internet even over 28.8 modems. " "WM-AUDIO is considered a future replacement for MP3.", CodecInfo::Win32, "divxacm", CodecInfo::Audio, CodecInfo::Decode)); /* WMA3 */ const GUID CLSID_WMA3DMO = { 0x2eeb4adf, 0x4578, 0x4d10, { 0xbc, 0xa7, 0xbb, 0x95, 0x5f, 0x56, 0x32, 0x0a } }; const fourcc_t wma3_codecs[]={ 0x162, 0x160, 0x161, 0}; ci.push_back(CodecInfo(wma3_codecs, "W32 Windows Media Audio DMO", "wmadmod.dll", none_about, CodecInfo::DMO, "wmadmod", CodecInfo::Audio, CodecInfo::Decode, &CLSID_WMA3DMO)); const GUID CLSID_WMA39DMO = { 0x27ca0808, 0x01f5, 0x4e7a, { 0x8b, 0x05, 0x87, 0xf8, 0x07, 0xa2, 0x33, 0xd1 } }; ci.push_back(CodecInfo(wma3_codecs, "W32 Windows Media Audio 9 DMO", "wma9dmod.dll", none_about, CodecInfo::DMO, "wma9dmod", CodecInfo::Audio, CodecInfo::Decode, &CLSID_WMA39DMO)); const GUID CLSID_WMSP = { 0x874131cb, 0x4ecc, 0x443b, { 0x89, 0x48, 0x74, 0x6b, 0x89, 0x59, 0x5d, 0x20 } }; const fourcc_t wmsp_codecs[] = { 0xa, 0 }; ci.push_back(CodecInfo(wmsp_codecs, "W32 Windows Media Audio Speach DMO", "wmspdmod.dll", none_about, CodecInfo::DMO, "wmspdmod", CodecInfo::Audio, CodecInfo::Decode, &CLSID_WMSP)); #if 0 ci.push_back(CodecInfo(wma_codecs, "W32 WMA enc", "wmadmoe.dll", "Winmedadio", CodecInfo::Win32, "wmadmo_enc", CodecInfo::Audio, CodecInfo::Encode)); #endif const fourcc_t imc_codecs[] = { 0x401, 0 }; ci.push_back(CodecInfo(imc_codecs, "W32 Intel Music Coder", "imc32.acm", none_about, CodecInfo::Win32, "imcacm", CodecInfo::Audio, CodecInfo::Decode)); const fourcc_t ima_codecs[] = { 0x11, 0 }; ci.push_back(CodecInfo(ima_codecs, "W32 IMA ADPCM", "imaadp32.acm", "An implementation of Adaptive Differential Pulse" "Code Modulationn (ADPCM), useful for " "cross-platform audio for multimedia, " "developed by the Interactive Multimedia " "Association (IMA).", CodecInfo::Win32, "imaacm", CodecInfo::Audio, CodecInfo::Decode)); const fourcc_t msn_codecs[] = { 0x32, 0 }; ci.push_back(CodecInfo(msn_codecs, "W32 MSN", "msnaudio.acm", "MSN Audio codec", CodecInfo::Win32, "msnaudioacm", CodecInfo::Audio, CodecInfo::Decode)); const fourcc_t gsm_codecs[] = { 0x31, 0x32, 0 }; ci.push_back(CodecInfo(gsm_codecs, "W32 GSM", "msgsm32.acm", "MSN GSM Audio codec", CodecInfo::Win32, "msgsmacm", CodecInfo::Audio, CodecInfo::Decode)); const fourcc_t dsp_codecs[] = { 0x22, 0 }; ci.push_back(CodecInfo(dsp_codecs, "W32 DSP Group TrueSpeech(TM)", "tssoft32.acm", none_about, CodecInfo::Win32, "truespeechacm", CodecInfo::Audio, CodecInfo::Decode)); const fourcc_t lh_codecs[] = { 0x1101, 0x1102, 0x1103, 0x1104, 0 }; ci.push_back(CodecInfo(lh_codecs, "W32 Lernout & Hauspie", "lhacm.acm", "Lernout & Hauspie CELP, SCB", CodecInfo::Win32, "lhacm", CodecInfo::Audio, CodecInfo::Decode)); const fourcc_t vox_codecs[] = { 0x181c, 0 }; ci.push_back(CodecInfo(vox_codecs, "W32 VoxWare RT24 speech codec", "nsrt2432.acm", none_about, CodecInfo::Win32, "voxwarert24acm", CodecInfo::Audio, CodecInfo::Decode)); const fourcc_t alf2_codecs[] = { 0x1fc4, 0 }; ci.push_back(CodecInfo(alf2_codecs, "W32 ALF2 codec", "alf2cd.acm", "http://www.nctsoft.com/products/NCTALFCD/" "jdp@mail.sonofon.dk", CodecInfo::Win32, "alf2acm", CodecInfo::Audio, CodecInfo::Decode)); #if 0 const GUID CLSID_Vorbis = { 0x6bA47966, 0x3F83, 0x4178, {0x96, 0x65, 0x00, 0xF0, 0xBF, 0x62, 0x92, 0xE5} }; const fourcc_t vorbis_codecs[] = { 0xFFFE, 0 }; ci.push_back(CodecInfo(vorbis_codecs, "W32 Vorbis decoder", "vorbis.acm", "Vorbis Audio codec", CodecInfo::Win32, "vorbisacm", CodecInfo::Audio, CodecInfo::Decode, &CLSID_Vorbis)); #endif #if 0 // works now - but has some problems with buffering - somehow // we need to flash buffers after seek const fourcc_t mpeg_codecs[] = { 0x55, 0 }; #if 0 // DirectShow version causing segfault in Convert const GUID CLSID_Mpeg = { 0x38BE3000, 0xDBF4, 0x11D0, { 0x86, 0x0e, 0x00, 0xA0, 0x24, 0xCF, 0xEF, 0x6D } }; // DS doesn't work ci.push_back(CodecInfo(mpeg_codecs, "W32 MPEG Layer-3 DS", "l3codecx.ax", none_about, CodecInfo::DShow_Dec, "mp3ds", CodecInfo::Audio, CodecInfo::Decode, &CLSID_Mpeg)); #endif // acm version is somewhat problematic - disable ci.push_back(CodecInfo(mpeg_codecs, "W32 MPEG Layer-3", "l3codeca.acm", none_about, CodecInfo::Win32, "mp3acm", CodecInfo::Audio, CodecInfo::Decode)); #endif #if 0 // this works but only as a last resource - it has quite poor quality const fourcc_t mpeg_codecs[] = { 0x55, 0 }; ci.push_back(CodecInfo(mpeg_codecs, "W32 MPEG Layer-3", "divxa32.acm", none_about, CodecInfo::Win32, "divxmp3", CodecInfo::Audio, CodecInfo::Decode)); #endif } static void win32_FillPlugins(avm::vector& ci) { // disabled when crashing // add_angel(ci); - using divx instead add_divx(ci); //add_divx5(ci); add_divx4(ci); add_xvid(ci); add_ati(ci); add_asus(ci); add_brooktree(ci); add_dvsd(ci); add_indeo(ci); add_morgan(ci); add_mcmjpeg(ci); add_pegas(ci); add_avid(ci); add_techsmith(ci); add_huffyuv(ci); /* On2 Truemotion VP3.x support */ add_vp3(ci); add_3ivx(ci); add_audio(ci); //const fourcc_t zero[]={ 0 }; const char* cvid_about = "Very old video codec, usually " "available as a part of Windows."; const fourcc_t cvid_codecs[] = { fccCVID, fcccvid, 0 }; ci.push_back(CodecInfo(cvid_codecs, "W32 Cinepak Video", "iccvid.dll", cvid_about, CodecInfo::Win32, "cvid")); const fourcc_t i263_codecs[] = { fccI263, fcci263, 0 }; ci.push_back(CodecInfo(i263_codecs, "W32 I263", "i263_32.drv", none_about, CodecInfo::Win32, "i263")); const GUID CLSID_U263DecompressorCF = { 0x00af1181, 0x6ebb, 0x11D4, { 0x9d, 0x5a, 0x00, 0x50, 0x04, 0x79, 0x6c, 0xc0} }; const fourcc_t u263_codecs[] = { fccU263, 0 }; ci.push_back(CodecInfo(i263_codecs, "W32 U263", "ubv263d+.ax", none_about, CodecInfo::DShow_Dec, "u263", CodecInfo::Video, CodecInfo::Both, &CLSID_U263DecompressorCF)); const fourcc_t mwv1_codecs[] = { fccMWV1, 0 }; ci.push_back(CodecInfo(mwv1_codecs, "W32 Motion Wavelets", "icmw_32.dll", "Aware Motion Wavelets Video Codec [MWV1]", CodecInfo::Win32, "mwv1", CodecInfo::Video, CodecInfo::Both)); const fourcc_t mszh_codecs[] = { fccMSZH, 0 }; ci.push_back(CodecInfo(mszh_codecs, "W32 AVI Mszh", "avimszh.dll", none_about, CodecInfo::Win32, "mszh", CodecInfo::Video, CodecInfo::Both)); const fourcc_t zlib_codecs[] = { fccZLIB, 0 }; ci.push_back(CodecInfo(zlib_codecs, "W32 AVI Zlib", "avizlib.dll", none_about, CodecInfo::Win32, "zlib", CodecInfo::Video, CodecInfo::Both)); const fourcc_t m261_codecs[] = { fccM261, fccm261, 0 }; ci.push_back(CodecInfo(m261_codecs, "W32 M261", "msh261.drv", none_about, CodecInfo::Win32, "m261", // crash with encode FIXME CodecInfo::Video, CodecInfo::Decode)); const fourcc_t msrle_codecs[] = { 1, 0 }; ci.push_back(CodecInfo(msrle_codecs, "W32 MS RLE", "msrle32.dll", none_about, CodecInfo::Win32, "msrlevfw", CodecInfo::Video, CodecInfo::Both)); #if 1 /* * crash after IsRectEmpty and some memory allocation - mystery.... */ const GUID CLSID_Tm20 = { 0x4cb63e61, 0xc611, 0x11D0, { 0x83, 0xaa, 0x00, 0x00, 0x92, 0x90, 0x01, 0x84 } }; const fourcc_t tm20_codecs[] = { fccTM20, 0 }; ci.push_back(CodecInfo(tm20_codecs, "W32 TrueMotion 2.0 DS Decompressor", "tm20dec.ax", none_about, CodecInfo::DShow_Dec, "tm20ds", CodecInfo::Video, CodecInfo::Decode, &CLSID_Tm20)); #endif #if 0 ci.push_back(CodecInfo(tm20_codecs, "W32 TrueMotion 2.0 Decompressor", "tm2x.dll", none_about, CodecInfo::Win32, "tm20", CodecInfo::Video, CodecInfo::Decode)); #endif const fourcc_t cram_codecs[] = { fccCRAM, fcccram, fccMSVC, mmioFOURCC('m', 's', 'v', 'c'), mmioFOURCC('w', 'h', 'a', 'm'), mmioFOURCC('W', 'H', 'A', 'M'), 0 }; ci.push_back(CodecInfo(cram_codecs, "W32 Microsoft Video 1", "msvidc32.dll", none_about, CodecInfo::Win32, "cram", CodecInfo::Video, CodecInfo::Decode)); } AVM_END_NAMESPACE; #endif // WIN32_FILLPLUGINS_H avifile-0.7.48~20090503.ds/plugins/libwin32/libwin32.cpp0000644000175000017500000003276711171057000021217 0ustar yavoryavor#include "ACM_AudioDecoder.h" #include "DMO_AudioDecoder.h" #include "DS_AudioDecoder.h" #include "VideoDecoder.h" #include "DMO_VideoDecoder.h" #include "DS_VideoDecoder.h" #include "VideoEncoder.h" #include "guids.h" #include "registry.h" #include "avm_output.h" #include "configfile.h" #include "fillplugins.h" #include "plugin.h" #include "loader.h" // loader has to come first - some compilers have problems here #include #include #include extern char* def_path; AVM_BEGIN_NAMESPACE; PLUGIN_TEMP(win32); // sregistry entries static const char* crapname = "SOFTWARE\\Microcrap\\Scrunch"; static const char* softname = "SOFTWARE\\Microsoft\\Scrunch"; static const char* videoname = "SOFTWARE\\Microsoft\\Scrunch\\Video"; static const char* loadername = "Software\\LinuxLoader\\"; static const char* divxname = "Software\\DivXNetworks\\DivX4Windows"; static const char* indeo4name = "Software\\Intel\\Indeo\\4.1"; static const char* indeo5name = "Software\\Intel\\Indeo\\5.0"; static const char* vp31name = "SOFTWARE\\ON2\\VFW Encoder/Decoder\\VP31"; static const char* xvidname = "Software\\GNU\\XviD"; static int win32_GetRegValue(const char* keyname, const char* attribute, int fccHandler, int* value, int def); static IVideoEncoder* win32_CreateVideoEncoder(const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& bh) { VideoEncoder* e = new VideoEncoder(info, compressor, bh); if (e && e->init() == 0) return e; delete e; return 0; } static IVideoDecoder* win32_CreateVideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& bh, int flip) { if (info.kind == CodecInfo::DMO) { DMO_VideoDecoder* d = new DMO_VideoDecoder(info, bh, flip); if (d && d->init() == 0) return d; //win32_error_set(d->getError()); delete d; } else if (info.kind == CodecInfo::DShow_Dec) { DS_VideoDecoder* d = new DS_VideoDecoder(info, bh, flip); if (d && d->init() == 0) { if (info.fourcc == fccIV50) { // restore INDEO settings const char* at[] = { "Saturation", "Brightness", "Contrast" }; for (int i = 0; i < 3; i++) { int value; win32_GetRegValue(indeo5name, at[i], 0, &value, 0); d->SetValue(at[i], value); } } return d; } //win32_error_set(d->getError()); delete d; } else { VideoDecoder* d = new VideoDecoder(info, bh, flip); if (d && d->init() == 0) return d; //win32_error_set(d->getError()); delete d; } return 0; } static IAudioDecoder* win32_CreateAudioDecoder(const CodecInfo& info, const WAVEFORMATEX* fmt) { if (info.kind == CodecInfo::DMO) { DMO_AudioDecoder* d = new DMO_AudioDecoder(info, fmt); if (d) { if (d->init() == 0) return d; else win32_error_set(d->getError()); } delete d; } else if (info.kind == CodecInfo::DShow_Dec) { DS_AudioDecoder* d = new DS_AudioDecoder(info, fmt); if (d) { if (d->init() == 0) return d; else win32_error_set(d->getError()); } delete d; } else { ACM_AudioDecoder* d = new ACM_AudioDecoder(info, fmt); if (d) { if (d->init() == 0) return d; else win32_error_set(d->getError()); } delete d; } return 0; } /* * Here we've got attribute setting functions */ #define HKEY_CURRENT_USER (0x80000001) #if 0 #define HKEY_CLASSES_ROOT (0x80000000) #define HKEY_LOCAL_MACHINE (0x80000002) #define HKEY_USERS (0x80000003) #define HKEY_PERFORMANCE_DATA (0x80000004) #define HKEY_CURRENT_CONFIG (0x80000005) #define HKEY_DYN_DATA (0x80000006) #define REG_DWORD 4 /* DWORD in little endian format */ #endif static char* win32_GetKeyName(char* s, const char* n, fourcc_t fcc) { int i = strlen(n); strcpy(s, n); s[i++] = tolower(fcc & 0xff); fcc >>=8; s[i++] = tolower(fcc & 0xff); fcc >>=8; s[i++] = tolower(fcc & 0xff); fcc >>=8; s[i++] = tolower(fcc & 0xff); s[i] = 0; return s; } static int win32_SetRegValue(const char* keyname, const char* attribute, int value, int fccHandler) { int result, status, newkey; char full_name[100]; const char *k = keyname; if (fccHandler) k = win32_GetKeyName(full_name, keyname, fccHandler); //printf("win32setregvalue: %s\n",k); result = RegCreateKeyExA(HKEY_CURRENT_USER, k, 0, 0, 0, 0, 0, &newkey, &status); if (result != 0) { AVM_WRITE("Win32 plugin", "win32_SetRegValue: registry failure\n"); return -1; } //AVM_WRITE("Win32 plugin", "KEY: %s %s\n", named_key, attribute); result = RegSetValueExA(newkey, attribute, 0, REG_DWORD, &value, 4); if (result != 0) { AVM_WRITE("Win32 plugin", "win32_SetRegValue: error writing value\n"); } // special registry for DivX codec if (result == 0 && strstr(attribute, "ost Process Mode") != 0) { value = -1; result=RegSetValueExA(newkey, "Force Post Process Mode", 0, REG_DWORD, &value, 4); if (result != 0) { AVM_WRITE("Win32 plugin", "win32_SetRegValue: error writing value\n"); } } RegCloseKey(newkey); //AVM_WRITE("Win32 plugin", "*********SetregFullname %s %s %d\n", k, attribute, value); return result; } static int win32_GetRegValue(const char* keyname, const char* attribute, int fccHandler, int* value, int def) { int result, status, newkey, count = 4; char full_name[100]; const char *k = keyname; if (fccHandler) { k = win32_GetKeyName(full_name, keyname, fccHandler); result = RegOpenKeyExA(HKEY_CURRENT_USER, k, 0, 0, &newkey); } else result = RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status); //printf("win32getregvalue: %s\n",k); if (result != 0) { AVM_WRITE("Win32 plugin", "win32_GetRegValue: registry failure\n"); return -1; } result = RegQueryValueExA(newkey, attribute, 0, &status, value, &count); if (count != 4) result = -1; RegCloseKey(newkey); if (result != 0) { AVM_WRITE("Win32 plugin", 1, "win32_GetRegValue: no such value for %s %s\n", keyname, attribute); *value = def; result = 0; } //AVM_WRITE("Win32 plugin", "*********GetregFullname %s %s %d\n", k, attribute, *value); return result; } static int win32_GetAttrInt(const CodecInfo& info, const char* attribute, int* value) { int result; switch (info.fourcc) { case fccDIVX: if (strcmp(attribute, "Saturation") == 0 || strcmp(attribute, "Brightness") == 0 || strcmp(attribute, "Contrast") == 0) return win32_GetRegValue(divxname, attribute, 0, value, 50); if (strcmp(attribute + 1, "ostprocessing") == 0) { result = win32_GetRegValue(divxname, "Postprocessing", 0, value, 30); *value /= 10; return result; } if (strcmp(attribute, "maxauto") == 0) { *value = RegReadInt("win32DivX4", "maxauto", 6); return 0; } break; case fccDIV3: case fccDIV4: case fccDIV5: case fccDIV6: case fccMP42: if ((strcmp(attribute, "Crispness") == 0) || (strcmp(attribute, "KeyFrames") == 0) || (strcmp(attribute, "BitRate") == 0)) { return win32_GetRegValue(loadername, attribute, info.fourcc, value, 0); } /* Fall through */ case fccWMV1: case fccWMV2: case RIFFINFO_WMV3: if (strcmp(attribute + 1, "ostprocessing") == 0 ||strcmp(attribute, "Quality") == 0) { return win32_GetRegValue((info.kind == CodecInfo::Win32) ? crapname : softname, "Current Post Process Mode", 0, value, 0); //AVM_WRITE("Win32 plugin", "GETQUALITY %d\n", value); } if ((strcmp(attribute, "Saturation") == 0) || (strcmp(attribute, "Hue") == 0) || (strcmp(attribute, "Contrast") == 0) || (strcmp(attribute, "Brightness") == 0)) return win32_GetRegValue(videoname, attribute, 0, value, 50); if (strcmp(attribute, "maxauto") == 0) { *value = RegReadInt("win32", "maxauto", 4); return 0; } if (info.FindAttribute(attribute)) return win32_GetRegValue(softname, attribute, 0, value, info.FindAttribute(attribute)->GetDefault()); break; case fccIV31: case fccIV32: case fccIV41: case fccIV50: if (strcmp(attribute, "QuickCompress") == 0 || strcmp(attribute, "Transparency") == 0 || strcmp(attribute, "Scalability") == 0 || strcmp(attribute, "Saturation") == 0 || strcmp(attribute, "Brightness") == 0 || strcmp(attribute, "Contrast") == 0) return win32_GetRegValue((info.fourcc == fccIV50) ? indeo5name : indeo4name, attribute, 0, value, 0); break; case fccVP30: case fccVP31: if (strcmp(attribute, "strPostProcessingLevel") == 0 || strcmp(attribute, "strSettings") == 0) return win32_GetRegValue(vp31name, attribute, 0, value, 0); break; case fccXVID: return win32_GetRegValue(xvidname, attribute, 0, value, 0); case fccMJPG: if (strcmp(attribute, "Mode") == 0) { *value = _GetPrivateProfileIntA("Compress", attribute, 1, "M3JPEG.INI"); return 0; } break; } if (strcmp(attribute, "maxauto") == 0) { *value = 0; return 0; } AVM_WRITE("Win32 plugin", "GetAttrInt(): unknown attribute '%s' for codec %s\n", attribute, info.dll.c_str()); return -1; } static int win32_SetAttrInt(const CodecInfo& info, const char* attribute, int value) { int result; switch (info.fourcc) { case fccDIVX: if (strcmp(attribute, "Saturation") == 0 || strcmp(attribute, "Brightness") == 0 || strcmp(attribute, "Contrast") == 0) return win32_SetRegValue(divxname, attribute, value, 0); if (strcmp(attribute, "postprocessing") == 0) return win32_SetRegValue(divxname, "Postprocessing", value * 10, 0); if (strcmp(attribute, "maxauto") == 0) { RegWriteInt("win32DivX4", "maxauto", value); return 0; } break; case fccDIV3: case fccDIV4: case fccDIV5: case fccDIV6: case fccMP42: if ((strcmp(attribute, "Crispness") == 0) || (strcmp(attribute, "KeyFrames") == 0) || (strcmp(attribute, "BitRate") == 0)) return win32_SetRegValue(loadername, attribute, value, info.fourcc); /* fall through */ case fccWMV1: case fccWMV2: case RIFFINFO_WMV3: if (strcmp(attribute, "postprocessing") == 0 || strcmp(attribute, "Quality") == 0) { //AVM_WRITE("Win32 plugin", "SETQUALITY %d\n", value); return win32_SetRegValue((info.kind == CodecInfo::Win32) ? crapname : softname, "Current Post Process Mode", value, 0); } if ((strcmp(attribute, "Saturation") == 0) || (strcmp(attribute, "Hue") == 0) || (strcmp(attribute, "Brightness") == 0) || (strcmp(attribute, "Contrast") == 0)) return win32_SetRegValue(videoname, attribute, value, 0); if (strcmp(attribute, "maxauto") == 0) { RegWriteInt("win32", "maxauto", value); return 0; } if (info.FindAttribute(attribute)) return win32_SetRegValue(softname, attribute, value, 0); break; /* case RIFFINFO_WMV3: if (strcmp(attribute, "postprocessing") == 0 || strcmp(attribute, "Quality") == 0) { //AVM_WRITE("Win32 plugin", "SETQUALITY %d\n", value); return win32_SetRegValue((info.kind == CodecInfo::Win32) ? crapname : softname, "Current Post Process Mode", value, 0); }*/ case fccIV31: case fccIV32: case fccIV41: case fccIV50: if (strcmp(attribute, "QuickCompress") == 0 || strcmp(attribute, "Transparency") == 0 || strcmp(attribute, "Scalability") == 0 || strcmp(attribute, "Saturation") == 0 || strcmp(attribute, "Brightness") == 0 || strcmp(attribute, "Contrast") == 0) return win32_SetRegValue((info.fourcc == fccIV50) ? indeo5name : indeo4name, attribute, value, 0); break; case fccVP30: case fccVP31: if (strcmp(attribute, "strPostProcessingLevel") == 0 || strcmp(attribute, "strSettings") == 0) return win32_SetRegValue(vp31name, attribute, value, 0); break; case fccXVID: return win32_SetRegValue(xvidname, attribute, value, 0); case fccMJPG: if (info.dll == "m3jpeg32.dll") { if (strcmp(attribute, "Mode") == 0) { char s[256]; sprintf(s, "%d", value); _WritePrivateProfileStringA("Compress", attribute, s, "M3JPEG.INI"); return 0; } } break; } AVM_WRITE("Win32 plugin", "SetAttrInt(): unknown attribute '%s' for codec %s\n", attribute, info.dll.c_str()); return -1; } static int win32_SetAttrString(const CodecInfo& info, const char* attribute, const char* value) { if (!attribute) return -1; switch (info.fourcc) { case fccMJPG: if (info.dll == "m3jpeg32.dll") { if (strcmp(attribute, "UserName") == 0 || strcmp(attribute, "LicenseKey") == 0) { _WritePrivateProfileStringA("Register", attribute, value, "M3JPEG.INI"); return 0; } } break; } return -1; } static int win32_GetAttrString(const CodecInfo& info, const char* attribute, char* value, int size) { if (!attribute) return -1; switch (info.fourcc) { case fccMJPG: if (info.dll == "m3jpeg32.dll") { if (strcmp(attribute, "UserName") == 0 || strcmp(attribute, "LicenseKey") == 0) return _GetPrivateProfileStringA("Register", attribute, "", value, size, "M3JPEG.INI"); } break; } return -1; } AVM_END_NAMESPACE; extern "C" avm::codec_plugin_t avm_codec_plugin_win32; avm::codec_plugin_t avm_codec_plugin_win32 = { PLUGIN_API_VERSION, 0, 0, 0, avm::win32_GetAttrInt, avm::win32_SetAttrInt, 0, 0, avm::win32_FillPlugins, avm::win32_CreateAudioDecoder, 0, avm::win32_CreateVideoDecoder, avm::win32_CreateVideoEncoder, }; avifile-0.7.48~20090503.ds/plugins/libwin32/libwin32.h0000644000175000017500000001414407501414600020656 0ustar yavoryavor#ifndef __LIBWIN32_H #define __LIBWIN32_H #ifndef NOAVIFILE_HEADERS #error this header file should not be used without -DNOAVIFILE_HEADERS #endif // this file is only included when NOAVIFILE_HEADERS are defined // serves mainly for mplayer #define VFW_E_NOT_RUNNING 0x80040226 #include "default.h" #define FATAL(a) // you don't need exception - if you want - just fill more code #include "wine/mmreg.h" #include "wine/winreg.h" #include "wine/vfw.h" #include "com.h" typedef uint_t fourcc_t; struct FatalError { FatalError(); void PrintAll() {} }; struct CodecInfo { char* dll; GUID guid; }; struct CImage // public your_libvo_mem { char* Data() { return 0; // pointer to memory block } static bool Supported(fourcc_t csp, int bits) { return true; /* if you support such surface */ } }; struct BitmapInfo : public BITMAPINFOHEADER { void SetBits(int b) { return; /*fixme*/ } void SetSpace(int b) { return; /*fixme*/ } }; struct IAudioDecoder { WAVEFORMATEX in_fmt; const CodecInfo& record; IAudioDecoder(const CodecInfo& r, const WAVEFORMATEX* w) : record(r) { in_fmt = *w; } }; struct IAudioEncoder { IAudioEncoder(const CodecInfo&, WAVEFORMATEX*) {} // you do not need this one... }; struct IVideoDecoder { int VBUFSIZE; int QMARKHI; int QMARKLO; int DMARKHI; int DMARKLO; enum CAPS { CAP_NONE = 0, CAP_YUY2 = 1, CAP_YV12 = 2, CAP_IYUV = 4, CAP_UYVY = 8, CAP_YVYU = 16, CAP_I420 = 32, }; enum DecodingMode { DIRECT = 0, REALTIME, REALTIME_QUALITY_AUTO, }; enum DecodingState { STOP = 0, START, }; IVideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& format) : record(info) { // implement init part } virtual ~IVideoDecoder(); void Stop() { } void Start() { } const CodecInfo& record; DecodingMode m_Mode; // should we do precaching (or even change Quality on the fly) DecodingState m_State; int m_iDecpos; int m_iPlaypos; float m_fQuality; // quality for the progress bar 0..1(best) bool m_bCapable16b; BITMAPINFOHEADER* m_bh; // format of input data (might be larger - e.g. huffyuv) BitmapInfo m_decoder; // format of decoder output BitmapInfo m_obh; // format of returned frames }; struct IRtConfig { }; // might be minimalized to contain just those which are needed by DS_VideoDecoder #ifndef mmioFOURCC #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \ ( (long)(unsigned char)(ch0) | ( (long)(unsigned char)(ch1) << 8 ) | \ ( (long)(unsigned char)(ch2) << 16 ) | ( (long)(unsigned char)(ch3) << 24 ) ) #endif /* mmioFOURCC */ /* OpenDivX */ #define fccMP4S mmioFOURCC('M', 'P', '4', 'S') #define fccmp4s mmioFOURCC('m', 'p', '4', 's') #define fccDIVX mmioFOURCC('D', 'I', 'V', 'X') #define fccdivx mmioFOURCC('d', 'i', 'v', 'x') #define fccDIV1 mmioFOURCC('D', 'I', 'V', '1') #define fccdiv1 mmioFOURCC('d', 'i', 'v', '1') /* DivX codecs */ #define fccDIV2 mmioFOURCC('D', 'I', 'V', '2') #define fccdiv2 mmioFOURCC('d', 'i', 'v', '2') #define fccDIV3 mmioFOURCC('D', 'I', 'V', '3') #define fccdiv3 mmioFOURCC('d', 'i', 'v', '3') #define fccDIV4 mmioFOURCC('D', 'I', 'V', '4') #define fccdiv4 mmioFOURCC('d', 'i', 'v', '4') #define fccDIV5 mmioFOURCC('D', 'I', 'V', '5') #define fccdiv5 mmioFOURCC('d', 'i', 'v', '5') #define fccDIV6 mmioFOURCC('D', 'I', 'V', '6') #define fccdiv6 mmioFOURCC('d', 'i', 'v', '6') #define fccMP41 mmioFOURCC('M', 'P', '4', '1') #define fccmp41 mmioFOURCC('m', 'p', '4', '1') #define fccMP43 mmioFOURCC('M', 'P', '4', '3') #define fccmp43 mmioFOURCC('m', 'p', '4', '3') /* old ms mpeg-4 codecs */ #define fccMP42 mmioFOURCC('M', 'P', '4', '2') #define fccmp42 mmioFOURCC('m', 'p', '4', '2') #define fccMPG4 mmioFOURCC('M', 'P', 'G', '4') #define fccmpg4 mmioFOURCC('m', 'p', 'g', '4') /* Windows media codecs */ #define fccWMV1 mmioFOURCC('W', 'M', 'V', '1') #define fccwmv1 mmioFOURCC('w', 'm', 'v', '1') #define fccWMV2 mmioFOURCC('W', 'M', 'V', '2') #define fccwmv2 mmioFOURCC('w', 'm', 'v', '2') #define fccMWV1 mmioFOURCC('M', 'W', 'V', '1') /* Angel codecs */ #define fccAP41 mmioFOURCC('A', 'P', '4', '1') #define fccap41 mmioFOURCC('a', 'p', '4', '1') #define fccAP42 mmioFOURCC('A', 'P', '4', '2') #define fccap42 mmioFOURCC('a', 'p', '4', '2') /* other codecs */ #define fccIV31 mmioFOURCC('I', 'V', '3', '1') #define fcciv31 mmioFOURCC('i', 'v', '3', '1') #define fccIV32 mmioFOURCC('I', 'V', '3', '2') #define fcciv32 mmioFOURCC('i', 'v', '3', '2') #define fccIV41 mmioFOURCC('I', 'V', '4', '1') #define fcciv41 mmioFOURCC('i', 'v', '4', '1') #define fccIV50 mmioFOURCC('I', 'V', '5', '0') #define fcciv50 mmioFOURCC('i', 'v', '5', '0') #define fccI263 mmioFOURCC('I', '2', '6', '3') #define fcci263 mmioFOURCC('i', '2', '6', '3') #define fccMJPG mmioFOURCC('M', 'J', 'P', 'G') #define fccmjpg mmioFOURCC('m', 'j', 'p', 'g') #define fccHFYU mmioFOURCC('H', 'F', 'Y', 'U') #define fcccvid mmioFOURCC('c', 'v', 'i', 'd') #define fccdvsd mmioFOURCC('d', 'v', 's', 'd') /* Ati codecs */ #define fccVCR2 mmioFOURCC('V', 'C', 'R', '2') #define fccVCR1 mmioFOURCC('V', 'C', 'R', '1') #define fccVYUY mmioFOURCC('V', 'Y', 'U', 'Y') #define fccYVU9 mmioFOURCC('I', 'Y', 'U', '9') /* Asus codecs */ #define fccASV1 mmioFOURCC('A', 'S', 'V', '1') #define fccASV2 mmioFOURCC('A', 'S', 'V', '2') /* Microsoft video */ #define fcccram mmioFOURCC('c', 'r', 'a', 'm') #define fccCRAM mmioFOURCC('C', 'R', 'A', 'M') #define fccMSVC mmioFOURCC('M', 'S', 'V', 'C') #define fccMSZH mmioFOURCC('M', 'S', 'Z', 'H') #define fccZLIB mmioFOURCC('Z', 'L', 'I', 'B') #define fccTM20 mmioFOURCC('T', 'M', '2', '0') #define fccYUV mmioFOURCC('Y', 'U', 'V', ' ') #define fccYUY2 mmioFOURCC('Y', 'U', 'Y', '2') #define fccYV12 mmioFOURCC('Y', 'V', '1', '2')/* Planar mode: Y + V + U (3 planes) */ #define fccI420 mmioFOURCC('I', '4', '2', '0') #define fccIYUV mmioFOURCC('I', 'Y', 'U', 'V')/* Planar mode: Y + U + V (3 planes) */ #define fccUYVY mmioFOURCC('U', 'Y', 'V', 'Y')/* Packed mode: U0+Y0+V0+Y1 (1 plane) */ #define fccYVYU mmioFOURCC('Y', 'V', 'Y', 'U')/* Packed mode: Y0+V0+Y1+U0 (1 plane) */ #endif avifile-0.7.48~20090503.ds/plugins/libwin32/test.cpp0000644000175000017500000000135510474275144020552 0ustar yavoryavor #include "avm_default.h" #include "avifile.h" #include "utils.h" #ifdef USE_MPATROL #include "mpatrol.h" #endif #include //#include // test for compatibility with std::vector // this test probably should be here - but it's not // that important I guess... int main(int argc, char* argv[]) { avm::vector a1; avm::vector b1; a1.push_back(1); a1.push_back(2); a1.push_back(3); b1.push_back(4); b1.push_back(5); b1.push_back(6); avm::vector& c1 = a1; for (unsigned i = 0; i < a1.size(); i++) printf("elem:%d %d\n", i, a1[i]); a1 = b1; b1[0] = 0; c1[1] = 2; for (unsigned i = 0; i < a1.size(); i++) printf("elem:%d %d\n", i, a1[i]); return 0; } avifile-0.7.48~20090503.ds/plugins/libwin32/testaudio.cpp0000644000175000017500000000337111106424227021563 0ustar yavoryavor/** * * Test sample for checking memory leaks in audio decoding * * It's good idea to use single threaded operation mode * so modify Cache.cpp to no use thread for precaching #define NOTHREADS * */ #include #include #include #include #include #include #include #include const char* filename = "/net/hdd2/movies/wm9a/world_192_mulitchannel.wma"; //const char* filename = "/net/hdd2/movies/testE/indy_500.wmv"; //const char* filename = "/net/hdd2/movies/test/wm8_vandread.wmv"; //const char* filename = "/net/hdd2/movies/test/Lucky.asf"; //const char* filename = "/net/hdd2/movies/test/04.asf"; //const char* filename = "/net/hdd2/movies/test/Gone.avi"; //const char* filename = "/net/hdd2/movies/test3/imaadcmp.avi"; int main(int argc, char* argv[]) { IAviReadFile* file=0; int64_t excess = 4000; WAVEFORMATEX wfmtx; int fd; if (argc > 1) filename = argv[1]; char zz[100000]; fd = open("/tmp/outoftest", O_WRONLY|O_CREAT|O_TRUNC, 00666); for (int i = 0; i < 1; i++) { file = CreateIAviReadFile(filename); if (!file) break; IAviReadStream* ars = file->GetStream(0, AviStream::Audio); if (ars && ars->StartStreaming() == 0) { //ars->GetAudioFormatInfo(&wfmtx, 0); int counter = 100; while (counter-- > 0 && !ars->Eof()) { uint_t samples_read, bytes_read; ars->ReadFrames(zz, (excess > sizeof(zz)) ? excess : sizeof(zz), sizeof(zz), samples_read, bytes_read); if (fd >= 0) write(fd, zz, bytes_read); //avm_usleep(000000); printf("counter %d %d\n", counter, bytes_read); } ars->StopStreaming(); } delete file; file = 0; } delete file; return 0; } avifile-0.7.48~20090503.ds/plugins/libwin32/testcodecs.cpp0000644000175000017500000000370011110407512021707 0ustar yavoryavor/** * * Test sample for checking memory leaks in codec quering * * It's good idea to use single threaded operation mode * so modify Cache.cpp to no use thread for precaching #define NOTHREADS * */ #include #include #include #include #include #include #include #include #include #define __MODULE__ "testcl" //#define TESTE #ifdef TESTE class testcl { public: testcl() { throw exception(); } }; void teste() { for (int i = 0; ; i++) { testcl* c = 0; try { c = new testcl(); } catch (...) { if ((i % 1000) == 0) { printf("%d : \n", i); //error.PrintAll(); } } delete c; } } int main(int argc, char** argv) { teste(); return 0; } #else int main(int argc, char** argv) { BITMAPINFOHEADER bih; bih.biCompression = 0xffffffff; // just to fill video_codecs list Creators::CreateVideoDecoder(bih, 0, 0); for(int round = 0; round < 5; round++) { int i = 0; VideoEncoderInfo _info; avm::vector::iterator it; avm::vector private_list; private_list.clear(); fourcc_t fcc = 24; switch (round % 3) { case 1: fcc = fccYUY2; break; case 2: fcc = fccYV12; break; } BitmapInfo bi(160, 120, fcc); printf("VideoCodes list size: %d\n", video_codecs.size()); for (it = video_codecs.begin(); it != video_codecs.end(); it++) { if(!(it->direction&CodecInfo::Encode)) continue; IVideoEncoder* enc = Creators::CreateVideoEncoder(it->fourcc, bi); // checking if this code is the one we have asked for... if (!enc) continue; bool ok = (strcmp(it->GetName(), enc->GetCodecInfo().GetName()) == 0); Creators::FreeVideoEncoder(enc); if (!ok) continue; private_list.push_back(*it); i++; } printf("round: %d (fcc: %d) found: %d\n", round, fcc, i); } return 0; } #endif avifile-0.7.48~20090503.ds/plugins/libwin32/testloader.c0000644000175000017500000000127211106424227021366 0ustar yavoryavor/** * * Test sample for checking memory leaks in codec quering * * User should have mpatrol library installed * (In case it's not available - modify Makefile.am apropriately) * It's good idea to use single threaded operation mode * so modify Cache.cpp to no use thread for precaching #define NOTHREADS * */ #include #include static const char* outf = "/tmp/x"; int main(int argc, char* argv[]) { FILE* f = fopen(outf, "rb"); if (!f) return -1; //driver while (!feof(f)) { unsigned sz; char* tbuf; fread(&sz, sizeof(sz), 1, f); tbuf = (char*)malloc(sz); fread(tbuf, sz, 1, f); free(tbuf); } fclose(f); return 0; } avifile-0.7.48~20090503.ds/plugins/libwin32/testprepare.cpp0000644000175000017500000000321210571374370022122 0ustar yavoryavor/** * * Test sample for checking memory leaks in codec quering * * User should have mpatrol library installed * (In case it's not available - modify Makefile.am apropriately) * It's good idea to use single threaded operation mode * so modify Cache.cpp to no use thread for precaching #define NOTHREADS * */ #include #include #include #include #include //const char* filename = "/net/hdd2/movies/test/wm8_vandread.wmv"; //const char* filename = "/net/hdd2/movies/test/Lucky.asf"; //const char* filename = "/net/hdd2/movies/test3/imaadcmp.avi"; //const char* filename = "/net/hdd2/movies/test2/tm20.avi"; const char* filename = "/net/hdd2/movies/test7/p_mjpg.avi"; //const char* filename = "/net/hdd2/movies/test7/pimj.avi"; //const char* filename = "/net/hdd2/movies/test/Tool_Sober.avi"; //const char* filename = "/net/hdd2/movies/test2/avid.avi"; static const char* outf = "/tmp/x"; int main(int argc, char* argv[]) { FILE* f = fopen(outf, "wb"); if (!f) return -1; if (argc > 1) filename = argv[1]; IAviReadFile* file = CreateIAviReadFile(filename); if (!file) return 1; IAviReadStream* vrs = file->GetStream(0, AviStream::Video); int counter = 20; while (counter-- > 0 && !vrs->Eof()) { uint_t lSize, lSamples, lBytes; int hr = vrs->ReadDirect(0, 0, 0, lSamples, lSize); printf("write %d\n", lSize); fflush(stdout); char* tbuf = new char[lSize * 2]; vrs->ReadDirect(tbuf, lSize, 1, lSamples, lBytes); fwrite(&lSize, sizeof(lSize), 1, f); fwrite(tbuf, lBytes, 1, f); delete[] tbuf; } delete file; fclose(f); return 0; } avifile-0.7.48~20090503.ds/plugins/libwin32/testvideo.cpp0000644000175000017500000000343711106424227021573 0ustar yavoryavor/** * * Test sample for checking memory leaks in codec quering * * It's good idea to use single threaded operation mode * so modify Cache.cpp to no use thread for precaching #define NOTHREADS */ #include #include #include #include #include #include #include const char* filename = "/net/hdd2/movies/test4/vp30_logo.avi"; //const char* filename = "/net/hdd2/movies/test-asf/wm8_vandread.wmv"; //const char* filename = "/net/hdd2/movies/test/Lucky.asf"; //const char* filename = "/net/hdd2/movies/test3/imaadcmp.avi"; //const char* filename = "/net/hdd2/movies/test2/tm20.avi"; //const char* filename = "/net/hdd2/movies/test7/p_mjpg.avi"; //const char* filename = "/net/hdd2/movies/test7/pimj.avi"; //const char* filename = "/net/hdd2/movies/test/Tool_Sober.avi"; //const char* filename = "/net/hdd2/movies/wm9/xaa"; //const char* filename = "/home/kabi/avi/wm9.asf"; //const char* filename = "/net/hdd2/movies/test/Gone.avi"; int main(int argc, char* argv[]) { IAviReadFile* file=0; if (argc > 1) filename = argv[1]; char zz[100000]; for (int i = 0; i < 1; i++) { file = CreateIAviReadFile(filename); if (!file) break; IAviReadStream* vrs = file->GetStream(0, AviStream::Video); if (vrs->StartStreaming() == 0) { vrs->GetDecoder()->SetDestFmt(0, fccYV12); //vrs->GetDecoder()->SetDestFmt(0, fccUYVY); //vrs->GetDecoder()->SetDestFmt(24); int counter = 3;//00; while (counter-- > 0 && !vrs->Eof()) { uint_t samples_read, bytes_read; CImage* ci = vrs->GetFrame(true); if (ci) { ci->Release(); printf("read %d\n", counter); } } vrs->StopStreaming(); } delete file; file = 0; } delete file; return 0; } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/0000755000175000017500000000000011267646347020341 5ustar yavoryavoravifile-0.7.48~20090503.ds/plugins/libwin32/loader/dmo/0000755000175000017500000000000011267646347021120 5ustar yavoryavoravifile-0.7.48~20090503.ds/plugins/libwin32/loader/dmo/DMO_Filter.h0000644000175000017500000000214107570376424023211 0ustar yavoryavor #ifndef DMO_FILTER_H #define DMO_FILTER_H #include "dmo_guids.h" #include "dmo_interfaces.h" #if defined(__cplusplus) extern "C" { #endif typedef struct _DMO_Filter { int m_iHandle; IDMOVideoOutputOptimizations* m_pOptim; IMediaObject* m_pMedia; IMediaObjectInPlace* m_pInPlace; AM_MEDIA_TYPE *m_pOurType, *m_pDestType; } DMO_Filter; typedef struct _CMediaBuffer CMediaBuffer; /** * Create DMO_Filter object - similar syntax as for DS_Filter */ DMO_Filter* DMO_FilterCreate(const char* dllname, const GUID* id, AM_MEDIA_TYPE* in_fmt, AM_MEDIA_TYPE* out_fmt); /** * Destroy DMO_Filter object - release all allocated resources */ void DMO_Filter_Destroy(DMO_Filter* This); /** * Create IMediaBuffer object - to pass/receive data from DMO_Filter * * maxlen - maximum size for this buffer * mem - initial memory 0 - creates memory * len - initial size of used portion of the buffer * copy - make a local copy of data */ CMediaBuffer* CMediaBufferCreate(unsigned long maxlen, void* mem, unsigned long len, int copy); #if defined(__cplusplus) } #endif #endif /* DS_FILTER_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dmo/Makefile.am0000644000175000017500000000044611164472152023143 0ustar yavoryavorif AMM_USE_WIN32 noinst_LTLIBRARIES = libdmo.la endif noinst_HEADERS = \ DMO_Filter.h \ dmo.h \ dmo_guids.h \ dmo_interfaces.h libdmo_la_SOURCES = \ buffer.c \ dmo.c \ dmo_guids.c AM_CPPFLAGS = $(LTNOPIC) -I$(srcdir)/.. AM_CFLAGS = $(WIN32_CFLAGS) MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dmo/buffer.c0000644000175000017500000000562507570376424022543 0ustar yavoryavor#include "DMO_Filter.h" #include "wine/winerror.h" #include "wine/windef.h" #include #include #include struct _CMediaBuffer { IMediaBuffer_vt* vt; DECLARE_IUNKNOWN(); GUID interfaces[2]; void* mem; unsigned long len; unsigned long maxlen; int freemem; }; static HRESULT STDCALL CMediaBuffer_SetLength(IMediaBuffer* This, unsigned long cbLength) { CMediaBuffer* cmb = (CMediaBuffer*) This; Debug printf("CMediaBuffer_SetLength(%p) called (%ld, %ld)\n", This, cbLength, cmb->maxlen); if (cbLength > cmb->maxlen) return E_INVALIDARG; cmb->len = cbLength; return S_OK; } static HRESULT STDCALL CMediaBuffer_GetMaxLength(IMediaBuffer* This, /* [out] */ unsigned long *pcbMaxLength) { CMediaBuffer* cmb = (CMediaBuffer*) This; Debug printf("CMediaBuffer_GetMaxLength(%p) called -> %ld\n", This, cmb->maxlen); if (!pcbMaxLength) return E_POINTER; *pcbMaxLength = cmb->maxlen; return S_OK; } static HRESULT STDCALL CMediaBuffer_GetBufferAndLength(IMediaBuffer* This, /* [out] */ char** ppBuffer, /* [out] */ unsigned long* pcbLength) { CMediaBuffer* cmb = (CMediaBuffer*) This; Debug printf("CMediaBuffer_GetBufferAndLength(%p) called -> %p %ld\n", This, cmb->mem, cmb->len); if (!ppBuffer && !pcbLength) return E_POINTER; if (ppBuffer) *ppBuffer = cmb->mem; if (pcbLength) *pcbLength = cmb->len; return S_OK; } static void CMediaBuffer_Destroy(CMediaBuffer* This) { Debug printf("CMediaBuffer_Destroy(%p) called\n", This); if (This->freemem) free(This->mem); free(This->vt); free(This); } IMPLEMENT_IUNKNOWN(CMediaBuffer) CMediaBuffer* CMediaBufferCreate(unsigned long maxlen, void* mem, unsigned long len, int copy) { CMediaBuffer* This = (CMediaBuffer*) malloc(sizeof(CMediaBuffer)); if (!This) return NULL; This->vt = (IMediaBuffer_vt*) malloc(sizeof(IMediaBuffer_vt)); if (!This->vt) { CMediaBuffer_Destroy(This); return NULL; } This->refcount = 1; This->len = len; This->maxlen = maxlen; This->freemem = 0; This->mem = mem; if (copy) /* make a private copy of data */ This->mem = 0; if (This->mem == NULL) { if (This->maxlen) { This->mem = malloc(This->maxlen); if (!This->mem) { CMediaBuffer_Destroy(This); return NULL; } This->freemem = 1; if (copy) memcpy(This->mem, mem, This->len); } } This->vt->QueryInterface = CMediaBuffer_QueryInterface; This->vt->AddRef = CMediaBuffer_AddRef; This->vt->Release = CMediaBuffer_Release; This->vt->SetLength = CMediaBuffer_SetLength; This->vt->GetMaxLength = CMediaBuffer_GetMaxLength; This->vt->GetBufferAndLength = CMediaBuffer_GetBufferAndLength; This->interfaces[0] = IID_IUnknown; This->interfaces[1] = IID_IMediaBuffer; return This; } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dmo/dmo.c0000644000175000017500000001073310041227612022022 0ustar yavoryavor#include "DMO_Filter.h" #include "driver.h" #include "com.h" #include #include #include #include "win32.h" // printf macro typedef long STDCALL (*GETCLASS) (const GUID*, const GUID*, void**); void DMO_Filter_Destroy(DMO_Filter* This) { if (This->m_pOptim) This->m_pOptim->vt->Release((IUnknown*)This->m_pOptim); if (This->m_pInPlace) This->m_pInPlace->vt->Release((IUnknown*)This->m_pInPlace); if (This->m_pMedia) This->m_pMedia->vt->Release((IUnknown*)This->m_pMedia); free(This); CodecRelease(); } DMO_Filter* DMO_FilterCreate(const char* dllname, const GUID* id, DMO_MEDIA_TYPE* in_fmt, DMO_MEDIA_TYPE* out_fmt) { HRESULT hr = 0; const char* em = NULL; DMO_Filter* This = (DMO_Filter*) malloc(sizeof(DMO_Filter)); if (!This) return NULL; memset(This, 0, sizeof(DMO_Filter)); CodecAlloc(); //This->Start = DS_Filter_Start; //This->Stop = DS_Filter_Stop; do { GETCLASS func; struct IClassFactory* factory = NULL; struct IUnknown* object = NULL; unsigned int i; unsigned long inputs, outputs; This->m_iHandle = LoadLibraryA(dllname); if (!This->m_iHandle) { em = "could not open DMO DLL"; break; } func = (GETCLASS)GetProcAddress((unsigned)This->m_iHandle, "DllGetClassObject"); if (!func) { em = "illegal or corrupt DMO DLL"; break; } hr = func(id, &IID_IClassFactory, (void**)&factory); if (hr || !factory) { em = "no such class object"; break; } hr = factory->vt->CreateInstance(factory, 0, &IID_IUnknown, (void**)&object); factory->vt->Release((IUnknown*)factory); if (hr || !object) { em = "class factory failure"; break; } hr = object->vt->QueryInterface(object, &IID_IMediaObject, (void**)&This->m_pMedia); if (hr == 0) { /* query for some extra available interface */ HRESULT r = object->vt->QueryInterface(object, &IID_IMediaObjectInPlace, (void**)&This->m_pInPlace); #if 0 /* currently unused */ if (r == 0 && This->m_pInPlace) printf("DMO dll supports InPlace - PLEASE REPORT to developer\n"); r = object->vt->QueryInterface(object, &IID_IDMOVideoOutputOptimizations, (void**)&This->m_pOptim); if (r == 0 && This->m_pOptim) { unsigned long flags; r = This->m_pOptim->vt->QueryOperationModePreferences(This->m_pOptim, 0, &flags); printf("DMO dll supports VO Optimizations %ld %lx\n", r, flags); if (flags & DMO_VOSF_NEEDS_PREVIOUS_SAMPLE) printf("DMO dll might use previous sample when requested\n"); } #endif } object->vt->Release((IUnknown*)object); if (hr || !This->m_pMedia) { em = "object does not provide IMediaObject interface"; break; } hr = This->m_pMedia->vt->SetInputType(This->m_pMedia, 0, in_fmt, 0); if (hr) { em = "input format not accepted"; break; } if (0) { DMO_MEDIA_TYPE dmo; VIDEOINFOHEADER* vi; memset(&dmo, 0, sizeof(dmo)); i = This->m_pMedia->vt->GetOutputType(This->m_pMedia, 0, 2, &dmo); printf("GetOutputType %x \n", i); printf("DMO 0x%x (%.4s) 0x%x (%.4s)\n" //printf("DMO 0x%x 0x%x\n" ":: fixszsamp:%d tempcomp:%d sampsz:%ld\n" ":: formtype: 0x%x\n" ":: unk %p cbform: %ld pbform:%p\n", dmo.majortype.f1, (const char*)&dmo.majortype.f1, dmo.subtype.f1, (const char*)&dmo.subtype.f1, dmo.bFixedSizeSamples, dmo.bTemporalCompression, dmo.lSampleSize, dmo.formattype.f1, dmo.pUnk, dmo.cbFormat, dmo.pbFormat ); /* vi = (VIDEOINFOHEADER*) dmo.pbFormat; vi = (VIDEOINFOHEADER*) out_fmt->pbFormat; for (i = 0; i < out_fmt->cbFormat; i++) printf("BYTE %d %02x %02x\n", i, ((uint8_t*)dmo.pbFormat)[i], ((uint8_t*)out_fmt->pbFormat)[i]); */ } hr = This->m_pMedia->vt->SetOutputType(This->m_pMedia, 0, out_fmt, 0); if (hr) { em = "output format no accepted"; break; } inputs = outputs = 0; hr = This->m_pMedia->vt->GetOutputSizeInfo(This->m_pMedia, 0, &inputs, &outputs); //printf("GetOutput r=0x%lx size:%ld align:%ld\n", hr, inputs, outputs); // This->m_pMedia->vt->AllocateStreamingResources(This->m_pMedia); hr = This->m_pMedia->vt->GetStreamCount(This->m_pMedia, &inputs, &outputs); //printf("StreamCount r=0x%lx %ld %ld\n", hr, inputs, outputs); } while(0); if (em) { DMO_Filter_Destroy(This); printf("IMediaObject ERROR: %p %s (0x%lx : %ld)\n", em, em ? em : "", hr, hr); This = 0; } return This; } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dmo/dmo.h0000644000175000017500000000340307567250246022045 0ustar yavoryavor#ifndef DMO_H #define DMO_H /* * * Definition of important DMO interfaces. * Created using freely-available DirectX 8.1 SDK * ( http://msdn.microsoft.com ) * */ #include "dshow/iunk.h" #include "dshow/guids.h" typedef AM_MEDIA_TYPE DMO_MEDIA_TYPE; enum _DMO_INPUT_DATA_BUFFER_FLAGS { DMO_INPUT_DATA_BUFFERF_SYNCPOINT = 0x1, DMO_INPUT_DATA_BUFFERF_TIME = 0x2, DMO_INPUT_DATA_BUFFERF_TIMELENGTH = 0x4 }; enum _DMO_OUTPUT_DATA_BUFFER_FLAGS { DMO_OUTPUT_DATA_BUFFERF_SYNCPOINT = 0x1, DMO_OUTPUT_DATA_BUFFERF_TIME = 0x2, DMO_OUTPUT_DATA_BUFFERF_TIMELENGTH = 0x4, DMO_OUTPUT_DATA_BUFFERF_INCOMPLETE = 0x1000000 }; enum _DMO_INPUT_STATUS_FLAGS { DMO_INPUT_STATUSF_ACCEPT_DATA = 0x1 }; enum _DMO_INPUT_STREAM_INFO_FLAGS { DMO_INPUT_STREAMF_WHOLE_SAMPLES = 0x1, DMO_INPUT_STREAMF_SINGLE_SAMPLE_PER_BUFFER = 0x2, DMO_INPUT_STREAMF_FIXED_SAMPLE_SIZE = 0x4, DMO_INPUT_STREAMF_HOLDS_BUFFERS = 0x8 }; enum _DMO_OUTPUT_STREAM_INFO_FLAGS { DMO_OUTPUT_STREAMF_WHOLE_SAMPLES = 0x1, DMO_OUTPUT_STREAMF_SINGLE_SAMPLE_PER_BUFFER = 0x2, DMO_OUTPUT_STREAMF_FIXED_SAMPLE_SIZE = 0x4, DMO_OUTPUT_STREAMF_DISCARDABLE = 0x8, DMO_OUTPUT_STREAMF_OPTIONAL = 0x10 }; enum _DMO_SET_TYPE_FLAGS { DMO_SET_TYPEF_TEST_ONLY = 0x1, DMO_SET_TYPEF_CLEAR = 0x2 }; enum _DMO_PROCESS_OUTPUT_FLAGS { DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER = 0x1 }; enum _DMO_VIDEO_OUTPUT_STREAM_FLAGS { DMO_VOSF_NEEDS_PREVIOUS_SAMPLE = 0x1 }; /* MediaErr.h */ #define DMO_E_INVALIDSTREAMINDEX 0x80040201 #define DMO_E_INVALIDTYPE 0x80040202 #define DMO_E_TYPE_NOT_SET 0x80040203 #define DMO_E_NOTACCEPTING 0x80040204 #define DMO_E_TYPE_NOT_ACCEPTED 0x80040205 #define DMO_E_NO_MORE_ITEMS 0x80040206 #endif /* DMO_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dmo/dmo_guids.c0000644000175000017500000000365707540132675023242 0ustar yavoryavor#include "dmo_guids.h" int DMO_DEBUG = 0; const GUID IID_IMediaBuffer = { 0x59eff8b9, 0x938c, 0x4a26, { 0x82, 0xf2, 0x95, 0xcb, 0x84, 0xcd, 0xc8, 0x37}}; const GUID IID_IMediaObject = { 0xd8ad0f58, 0x5494, 0x4102, { 0x97, 0xc5, 0xec, 0x79, 0x8e, 0x59, 0xbc, 0xf4}}; const GUID IID_IEnumDMO = { 0x2c3cd98a, 0x2bfa, 0x4a53, { 0x9c, 0x27, 0x52, 0x49, 0xba, 0x64, 0xba, 0x0f}}; const GUID IID_IMediaObjectInPlace = { 0x651b9ad0, 0x0fc7, 0x4aa9, { 0x95, 0x38, 0xd8, 0x99, 0x31, 0x01, 0x07, 0x41}}; const GUID IID_IDMOQualityControl = { 0x65abea96, 0xcf36, 0x453f, { 0xaf, 0x8a, 0x70, 0x5e, 0x98, 0xf1, 0x62, 0x60}}; const GUID IID_IDMOVideoOutputOptimizations = { 0xbe8f4f4e, 0x5b16, 0x4d29, { 0xb3, 0x50, 0x7f, 0x6b, 0x5d, 0x92, 0x98, 0xac}}; const GUID DMOCATEGORY_AUDIO_DECODER = { 0x57f2db8b, 0xe6bb, 0x4513, { 0x9d, 0x43, 0xdc, 0xd2, 0xa6, 0x59, 0x31, 0x25}}; const GUID DMOCATEGORY_AUDIO_ENCODER = { 0x33d9a761, 0x90c8, 0x11d0, { 0xbd, 0x43, 0x00, 0xa0, 0xc9, 0x11, 0xce, 0x86}}; const GUID DMOCATEGORY_VIDEO_DECODER = { 0x4a69b442, 0x28be, 0x4991, { 0x96, 0x9c, 0xb5, 0x00, 0xad, 0xf5, 0xd8, 0xa8}}; const GUID DMOCATEGORY_VIDEO_ENCODER = { 0x33d9a760, 0x90c8, 0x11d0, { 0xbd, 0x43, 0x00, 0xa0, 0xc9, 0x11, 0xce, 0x86}}; const GUID DMOCATEGORY_AUDIO_EFFECT = { 0xf3602b3f, 0x0592, 0x48df, { 0xa4, 0xcd, 0x67, 0x47, 0x21, 0xe7, 0xeb, 0xeb}}; const GUID DMOCATEGORY_VIDEO_EFFECT = { 0xd990ee14, 0x776c, 0x4723, { 0xbe, 0x46, 0x3d, 0xa2, 0xf5, 0x6f, 0x10,0xb9}}; const GUID DMOCATEGORY_AUDIO_CAPTURE_EFFECT = { 0xf665aaba, 0x3e09, 0x4920, { 0xaa, 0x5f, 0x21, 0x98, 0x11, 0x14, 0x8f, 0x09}}; const GUID DMOCATEGORY_ACOUSTIC_ECHO_CANCEL = { 0xBF963D80L, 0xC559, 0x11D0, { 0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; const GUID DMOCATEGORY_AUDIO_NOISE_SUPPRESS = { 0xe07f903f, 0x62fd, 0x4e60, { 0x8c, 0xdd, 0xde, 0xa7, 0x23, 0x66, 0x65, 0xb5}}; const GUID DMOCATEGORY_AGC = { 0xe88c9ba0l, 0xc557, 0x11d0, { 0x8a, 0x2b, 0x00, 0xa0, 0xc9, 0x25, 0x5a, 0xc1}}; avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dmo/dmo_guids.h0000644000175000017500000000173007567250246023241 0ustar yavoryavor#ifndef DMO_GUIDS_H #define DMO_GUIDS_H #include "dshow/guids.h" extern const GUID IID_IMediaBuffer; extern const GUID IID_IMediaObject; extern const GUID IID_IEnumDMO; extern const GUID IID_IMediaObjectInPlace; extern const GUID IID_IDMOQualityControl; extern const GUID IID_IDMOVideoOutputOptimizations; /* to be removed extern const GUID DMOCATEGORY_AUDIO_DECODER; extern const GUID DMOCATEGORY_AUDIO_ENCODER; extern const GUID DMOCATEGORY_VIDEO_DECODER; extern const GUID DMOCATEGORY_VIDEO_ENCODER; extern const GUID DMOCATEGORY_AUDIO_EFFECT; extern const GUID DMOCATEGORY_VIDEO_EFFECT; extern const GUID DMOCATEGORY_AUDIO_CAPTURE_EFFECT; // Acoustic Echo Canceller // Matches KSNODETYPE_ACOUSTIC_ECHO_CANCEL extern const GUID DMOCATEGORY_ACOUSTIC_ECHO_CANCEL; // Noise Supression // Matches KSNODETYPE_AUDIO_NOISE_SUPPRESS extern const GUID DMOCATEGORY_AUDIO_NOISE_SUPPRESS; // Automatic Gain Control // Matches KSNODETYPE_AGC extern const GUID DMOCATEGORY_AGC; */ #endif avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dmo/dmo_interfaces.h0000644000175000017500000001617707540115360024250 0ustar yavoryavor#ifndef DMO_INTERFACE_H #define DMO_INTERFACE_H #include "dmo.h" /* * IMediaBuffer interface */ typedef struct _IMediaBuffer IMediaBuffer; typedef struct IMediaBuffer_vt { INHERIT_IUNKNOWN(); HRESULT STDCALL ( *SetLength )(IMediaBuffer* This, unsigned long cbLength); HRESULT STDCALL ( *GetMaxLength )(IMediaBuffer* This, /* [out] */ unsigned long *pcbMaxLength); HRESULT STDCALL ( *GetBufferAndLength )(IMediaBuffer* This, /* [out] */ char** ppBuffer, /* [out] */ unsigned long* pcbLength); } IMediaBuffer_vt; struct _IMediaBuffer { IMediaBuffer_vt* vt; }; typedef struct _DMO_OUTPUT_DATA_BUFFER { IMediaBuffer *pBuffer; unsigned long dwStatus; REFERENCE_TIME rtTimestamp; REFERENCE_TIME rtTimelength; } DMO_OUTPUT_DATA_BUFFER; /* * IMediaObject interface */ typedef struct _IMediaObject IMediaObject; typedef struct IMediaObject_vt { INHERIT_IUNKNOWN(); HRESULT STDCALL ( *GetStreamCount )(IMediaObject * This, /* [out] */ unsigned long *pcInputStreams, /* [out] */ unsigned long *pcOutputStreams); HRESULT STDCALL ( *GetInputStreamInfo )(IMediaObject * This, unsigned long dwInputStreamIndex, /* [out] */ unsigned long *pdwFlags); HRESULT STDCALL ( *GetOutputStreamInfo )(IMediaObject * This, unsigned long dwOutputStreamIndex, /* [out] */ unsigned long *pdwFlags); HRESULT STDCALL ( *GetInputType )(IMediaObject * This, unsigned long dwInputStreamIndex, unsigned long dwTypeIndex, /* [out] */ DMO_MEDIA_TYPE *pmt); HRESULT STDCALL ( *GetOutputType )(IMediaObject * This, unsigned long dwOutputStreamIndex, unsigned long dwTypeIndex, /* [out] */ DMO_MEDIA_TYPE *pmt); HRESULT STDCALL ( *SetInputType )(IMediaObject * This, unsigned long dwInputStreamIndex, /* [in] */ const DMO_MEDIA_TYPE *pmt, unsigned long dwFlags); HRESULT STDCALL ( *SetOutputType )(IMediaObject * This, unsigned long dwOutputStreamIndex, /* [in] */ const DMO_MEDIA_TYPE *pmt, unsigned long dwFlags); HRESULT STDCALL ( *GetInputCurrentType )(IMediaObject * This, unsigned long dwInputStreamIndex, /* [out] */ DMO_MEDIA_TYPE *pmt); HRESULT STDCALL ( *GetOutputCurrentType )(IMediaObject * This, unsigned long dwOutputStreamIndex, /* [out] */ DMO_MEDIA_TYPE *pmt); HRESULT STDCALL ( *GetInputSizeInfo )(IMediaObject * This, unsigned long dwInputStreamIndex, /* [out] */ unsigned long *pcbSize, /* [out] */ unsigned long *pcbMaxLookahead, /* [out] */ unsigned long *pcbAlignment); HRESULT STDCALL ( *GetOutputSizeInfo )(IMediaObject * This, unsigned long dwOutputStreamIndex, /* [out] */ unsigned long *pcbSize, /* [out] */ unsigned long *pcbAlignment); HRESULT STDCALL ( *GetInputMaxLatency )(IMediaObject * This, unsigned long dwInputStreamIndex, /* [out] */ REFERENCE_TIME *prtMaxLatency); HRESULT STDCALL ( *SetInputMaxLatency )(IMediaObject * This, unsigned long dwInputStreamIndex, REFERENCE_TIME rtMaxLatency); HRESULT STDCALL ( *Flush )(IMediaObject * This); HRESULT STDCALL ( *Discontinuity )(IMediaObject * This, unsigned long dwInputStreamIndex); HRESULT STDCALL ( *AllocateStreamingResources )(IMediaObject * This); HRESULT STDCALL ( *FreeStreamingResources )(IMediaObject * This); HRESULT STDCALL ( *GetInputStatus )(IMediaObject * This, unsigned long dwInputStreamIndex, /* [out] */ unsigned long *dwFlags); HRESULT STDCALL ( *ProcessInput )(IMediaObject * This, unsigned long dwInputStreamIndex, IMediaBuffer *pBuffer, unsigned long dwFlags, REFERENCE_TIME rtTimestamp, REFERENCE_TIME rtTimelength); HRESULT STDCALL ( *ProcessOutput )(IMediaObject * This, unsigned long dwFlags, unsigned long cOutputBufferCount, /* [size_is][out][in] */ DMO_OUTPUT_DATA_BUFFER *pOutputBuffers, /* [out] */ unsigned long *pdwStatus); HRESULT STDCALL ( *Lock )(IMediaObject * This, long bLock); } IMediaObject_vt; struct _IMediaObject { IMediaObject_vt* vt; }; /* * IEnumDMO interface */ typedef struct _IEnumDMO IEnumDMO; typedef struct IEnumDMO_vt { INHERIT_IUNKNOWN(); HRESULT STDCALL ( *Next )(IEnumDMO * This, unsigned long cItemsToFetch, /* [length_is][size_is][out] */ CLSID *pCLSID, /* [string][length_is][size_is][out] */ WCHAR **Names, /* [out] */ unsigned long *pcItemsFetched); HRESULT STDCALL ( *Skip )(IEnumDMO * This, unsigned long cItemsToSkip); HRESULT STDCALL ( *Reset )(IEnumDMO * This); HRESULT STDCALL ( *Clone )(IEnumDMO * This, /* [out] */ IEnumDMO **ppEnum); } IEnumDMO_vt; struct _IEnumDMO { IEnumDMO_vt* vt; }; /* * IMediaObjectInPlace interface */ typedef struct _IMediaObjectInPlace IMediaObjectInPlace; typedef struct IMediaObjectInPlace_vt { INHERIT_IUNKNOWN(); HRESULT STDCALL ( *Process )(IMediaObjectInPlace * This, /* [in] */ unsigned long ulSize, /* [size_is][out][in] */ BYTE *pData, /* [in] */ REFERENCE_TIME refTimeStart, /* [in] */ unsigned long dwFlags); HRESULT STDCALL ( *Clone )(IMediaObjectInPlace * This, /* [out] */ IMediaObjectInPlace **ppMediaObject); HRESULT STDCALL ( *GetLatency )(IMediaObjectInPlace * This, /* [out] */ REFERENCE_TIME *pLatencyTime); } IMediaObjectInPlace_vt; struct _IMediaObjectInPlace { IMediaObjectInPlace_vt* vt; }; /* * IDMOQualityControl interface */ typedef struct _IDMOQualityControl IDMOQualityControl; typedef struct IDMOQualityControl_vt { INHERIT_IUNKNOWN(); HRESULT STDCALL ( *SetNow )(IDMOQualityControl * This, /* [in] */ REFERENCE_TIME rtNow); HRESULT STDCALL ( *SetStatus )(IDMOQualityControl * This, /* [in] */ unsigned long dwFlags); HRESULT STDCALL ( *GetStatus )(IDMOQualityControl * This, /* [out] */ unsigned long *pdwFlags); } IDMOQualityControl_vt; struct _IDMOQualityControl { IDMOQualityControl_vt* vt; }; /* * IDMOVideoOutputOptimizations interface */ typedef struct _IDMOVideoOutputOptimizations IDMOVideoOutputOptimizations; typedef struct IDMOVideoOutputOptimizations_vt { INHERIT_IUNKNOWN(); HRESULT STDCALL ( *QueryOperationModePreferences )(IDMOVideoOutputOptimizations * This, unsigned long ulOutputStreamIndex, unsigned long *pdwRequestedCapabilities); HRESULT STDCALL ( *SetOperationMode )(IDMOVideoOutputOptimizations * This, unsigned long ulOutputStreamIndex, unsigned long dwEnabledFeatures); HRESULT STDCALL ( *GetCurrentOperationMode )(IDMOVideoOutputOptimizations * This, unsigned long ulOutputStreamIndex, unsigned long *pdwEnabledFeatures); HRESULT STDCALL ( *GetCurrentSampleRequirements )(IDMOVideoOutputOptimizations * This, unsigned long ulOutputStreamIndex, unsigned long *pdwRequestedFeatures); } IDMOVideoOutputOptimizations_vt; struct _IDMOVideoOutputOptimizations { IDMOVideoOutputOptimizations_vt* vt; }; #endif /* DMO_INTERFACE_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/0000755000175000017500000000000011267646347021303 5ustar yavoryavoravifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/Makefile.am0000644000175000017500000000056507463521215023332 0ustar yavoryavornoinst_HEADERS = \ basetsd.h heap.h msacmdrv.h pshpack2.h windef.h winreg.h \ ldt.h ntdef.h pshpack4.h windows.h winuser.h \ debugtools.h mmreg.h pe_image.h pshpack8.h winerror.h \ driver.h module.h poppack.h vfw.h winestring.h \ elfdll.h msacm.h pshpack1.h winbase.h winnt.h MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/basetsd.h0000644000175000017500000000625307233220457023073 0ustar yavoryavor/* * Compilers that uses ILP32, LP64 or P64 type models * for both Win32 and Win64 are supported by this file. */ #ifndef __WINE_BASETSD_H #define __WINE_BASETSD_H #ifdef __WINE__ #include "config.h" #endif /* defined(__WINE__) */ #ifdef __cplusplus extern "C" { #endif /* defined(__cplusplus) */ /* * Win32 was easy to implement under Unix since most (all?) 32-bit * Unices uses the same type model (ILP32) as Win32, where int, long * and pointer are 32-bit. * * Win64, however, will cause some problems when implemented under Unix. * Linux/{Alpha, Sparc64} and most (all?) other 64-bit Unices uses * the LP64 type model where int is 32-bit and long and pointer are * 64-bit. Win64 on the other hand uses the P64 (sometimes called LLP64) * type model where int and long are 32 bit and pointer is 64-bit. */ /* Type model indepent typedefs */ typedef char __int8; typedef unsigned char __uint8; typedef short __int16; typedef unsigned short __uint16; typedef int __int32; typedef unsigned int __uint32; typedef long long __int64; typedef unsigned long long __uint64; #if defined(_WIN64) typedef __uint32 __ptr32; typedef void *__ptr64; #else /* FIXME: defined(_WIN32) */ typedef void *__ptr32; typedef __uint64 __ptr64; #endif /* Always signed and 32 bit wide */ typedef __int32 LONG32; //typedef __int32 INT32; typedef LONG32 *PLONG32; //typedef INT32 *PINT32; /* Always unsigned and 32 bit wide */ typedef __uint32 ULONG32; typedef __uint32 DWORD32; typedef __uint32 UINT32; typedef ULONG32 *PULONG32; typedef DWORD32 *PDWORD32; typedef UINT32 *PUINT32; /* Always signed and 64 bit wide */ typedef __int64 LONG64; typedef __int64 INT64; typedef LONG64 *PLONG64; typedef INT64 *PINT64; /* Always unsigned and 64 bit wide */ typedef __uint64 ULONG64; typedef __uint64 DWORD64; typedef __uint64 UINT64; typedef ULONG64 *PULONG64; typedef DWORD64 *PDWORD64; typedef UINT64 *PUINT64; /* Win32 or Win64 dependent typedef/defines. */ #ifdef _WIN64 typedef __int64 INT_PTR, *PINT_PTR; typedef __uint64 UINT_PTR, *PUINT_PTR; #define MAXINT_PTR 0x7fffffffffffffff #define MININT_PTR 0x8000000000000000 #define MAXUINT_PTR 0xffffffffffffffff typedef __int32 HALF_PTR, *PHALF_PTR; typedef __int32 UHALF_PTR, *PUHALF_PTR; #define MAXHALF_PTR 0x7fffffff #define MINHALF_PTR 0x80000000 #define MAXUHALF_PTR 0xffffffff typedef __int64 LONG_PTR, *PLONG_PTR; typedef __uint64 ULONG_PTR, *PULONG_PTR; typedef __uint64 DWORD_PTR, *PDWORD_PTR; #else /* FIXME: defined(_WIN32) */ typedef __int32 INT_PTR, *PINT_PTR; typedef __uint32 UINT_PTR, *PUINT_PTR; #define MAXINT_PTR 0x7fffffff #define MININT_PTR 0x80000000 #define MAXUINT_PTR 0xffffffff typedef __int16 HALF_PTR, *PHALF_PTR; typedef __uint16 UHALF_PTR, *PUHALF_PTR; #define MAXUHALF_PTR 0xffff #define MAXHALF_PTR 0x7fff #define MINHALF_PTR 0x8000 typedef __int32 LONG_PTR, *PLONG_PTR; typedef __uint32 ULONG_PTR, *PULONG_PTR; typedef __uint32 DWORD_PTR, *PDWORD_PTR; #endif /* defined(_WIN64) || defined(_WIN32) */ typedef INT_PTR SSIZE_T, *PSSIZE_T; typedef UINT_PTR SIZE_T, *PSIZE_T; #ifdef __cplusplus } /* extern "C" */ #endif /* defined(__cplusplus) */ #endif /* !defined(__WINE_BASETSD_H) */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/debugtools.h0000644000175000017500000000553107233220460023605 0ustar yavoryavor #ifndef __WINE_DEBUGTOOLS_H #define __WINE_DEBUGTOOLS_H #ifdef __WINE__ /* Debugging interface is internal to Wine */ #include #include "config.h" #include "windef.h" struct _GUID; /* Internal definitions (do not use these directly) */ enum __DEBUG_CLASS { __DBCL_FIXME, __DBCL_ERR, __DBCL_WARN, __DBCL_TRACE, __DBCL_COUNT }; #ifndef NO_TRACE_MSGS # define __GET_DEBUGGING_trace(dbch) ((dbch)[0] & (1 << __DBCL_TRACE)) #else # define __GET_DEBUGGING_trace(dbch) 0 #endif #ifndef NO_DEBUG_MSGS # define __GET_DEBUGGING_warn(dbch) ((dbch)[0] & (1 << __DBCL_WARN)) # define __GET_DEBUGGING_fixme(dbch) ((dbch)[0] & (1 << __DBCL_FIXME)) #else # define __GET_DEBUGGING_warn(dbch) 0 # define __GET_DEBUGGING_fixme(dbch) 0 #endif /* define error macro regardless of what is configured */ #define __GET_DEBUGGING_err(dbch) ((dbch)[0] & (1 << __DBCL_ERR)) #define __GET_DEBUGGING(dbcl,dbch) __GET_DEBUGGING_##dbcl(dbch) #define __SET_DEBUGGING(dbcl,dbch,on) \ ((on) ? ((dbch)[0] |= 1 << (dbcl)) : ((dbch)[0] &= ~(1 << (dbcl)))) #ifndef __GNUC__ #define __FUNCTION__ "" #endif #define __DPRINTF(dbcl,dbch) \ (!__GET_DEBUGGING(dbcl,(dbch)) || (dbg_header_##dbcl((dbch),__FUNCTION__),0)) ? \ (void)0 : (void)dbg_printf /* Exported definitions and macros */ /* These function return a printable version of a string, including quotes. The string will be valid for some time, but not indefinitely as strings are re-used. */ extern LPCSTR debugstr_an (LPCSTR s, int n); extern LPCSTR debugstr_wn (LPCWSTR s, int n); extern LPCSTR debugres_a (LPCSTR res); extern LPCSTR debugres_w (LPCWSTR res); extern LPCSTR debugstr_guid( const struct _GUID *id ); extern LPCSTR debugstr_hex_dump (const void *ptr, int len); extern int dbg_header_err( const char *dbg_channel, const char *func ); extern int dbg_header_warn( const char *dbg_channel, const char *func ); extern int dbg_header_fixme( const char *dbg_channel, const char *func ); extern int dbg_header_trace( const char *dbg_channel, const char *func ); extern int dbg_vprintf( const char *format, va_list args ); static inline LPCSTR debugstr_a( LPCSTR s ) { return debugstr_an( s, 80 ); } static inline LPCSTR debugstr_w( LPCWSTR s ) { return debugstr_wn( s, 80 ); } #ifdef __GNUC__ extern int dbg_printf(const char *format, ...) __attribute__((format (printf,1,2))); #else extern int dbg_printf(const char *format, ...); #endif #define TRACE_(X) TRACE #define WARN_(X) TRACE #define WARN TRACE #define ERR_(X) printf #define ERR printf #define FIXME_(X) TRACE #define FIXME TRACE #define TRACE_ON(X) 1 #define ERR_ON(X) 1 #define DECLARE_DEBUG_CHANNEL(ch) \ extern char dbch_##ch[]; #define DEFAULT_DEBUG_CHANNEL(ch) \ extern char dbch_##ch[]; static char * const __dbch_default = dbch_##ch; #define DPRINTF dbg_printf #define MESSAGE dbg_printf #endif /* __WINE__ */ #endif /* __WINE_DEBUGTOOLS_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/driver.h0000644000175000017500000001021307233220462022724 0ustar yavoryavor/* * Drivers definitions */ #ifndef __WINE_DRIVER_H #define __WINE_DRIVER_H #include "windef.h" #define MMSYSERR_BASE 0 #define MMSYSERR_NOERROR 0 /* no error */ #define MMSYSERR_ERROR (MMSYSERR_BASE + 1) /* unspecified error */ #define MMSYSERR_BADDEVICEID (MMSYSERR_BASE + 2) /* device ID out of range */ #define MMSYSERR_NOTENABLED (MMSYSERR_BASE + 3) /* driver failed enable */ #define MMSYSERR_ALLOCATED (MMSYSERR_BASE + 4) /* device already allocated */ #define MMSYSERR_INVALHANDLE (MMSYSERR_BASE + 5) /* device handle is invalid */ #define MMSYSERR_NODRIVER (MMSYSERR_BASE + 6) /* no device driver present */ #define MMSYSERR_NOMEM (MMSYSERR_BASE + 7) /* memory allocation error */ #define MMSYSERR_NOTSUPPORTED (MMSYSERR_BASE + 8) /* function isn't supported */ #define MMSYSERR_BADERRNUM (MMSYSERR_BASE + 9) /* error value out of range */ #define MMSYSERR_INVALFLAG (MMSYSERR_BASE + 10) /* invalid flag passed */ #define MMSYSERR_INVALPARAM (MMSYSERR_BASE + 11) /* invalid parameter passed */ #define MMSYSERR_LASTERROR (MMSYSERR_BASE + 11) /* last error in range */ #define DRV_LOAD 0x0001 #define DRV_ENABLE 0x0002 #define DRV_OPEN 0x0003 #define DRV_CLOSE 0x0004 #define DRV_DISABLE 0x0005 #define DRV_FREE 0x0006 #define DRV_CONFIGURE 0x0007 #define DRV_QUERYCONFIGURE 0x0008 #define DRV_INSTALL 0x0009 #define DRV_REMOVE 0x000A #define DRV_EXITSESSION 0x000B #define DRV_EXITAPPLICATION 0x000C #define DRV_POWER 0x000F #define DRV_RESERVED 0x0800 #define DRV_USER 0x4000 #define DRVCNF_CANCEL 0x0000 #define DRVCNF_OK 0x0001 #define DRVCNF_RESTART 0x0002 #define DRVEA_NORMALEXIT 0x0001 #define DRVEA_ABNORMALEXIT 0x0002 #define DRV_SUCCESS 0x0001 #define DRV_FAILURE 0x0000 #define GND_FIRSTINSTANCEONLY 0x00000001 #define GND_FORWARD 0x00000000 #define GND_REVERSE 0x00000002 typedef struct { DWORD dwDCISize; LPCSTR lpszDCISectionName; LPCSTR lpszDCIAliasName; } DRVCONFIGINFO16, *LPDRVCONFIGINFO16; typedef struct { DWORD dwDCISize; LPCWSTR lpszDCISectionName; LPCWSTR lpszDCIAliasName; } DRVCONFIGINFO, *LPDRVCONFIGINFO; /* GetDriverInfo16 references this structure, so this a struct defined * in the Win16 API. * GetDriverInfo has been deprecated in Win32. */ typedef struct { UINT16 length; HDRVR16 hDriver; HINSTANCE16 hModule; CHAR szAliasName[128]; } DRIVERINFOSTRUCT16, *LPDRIVERINFOSTRUCT16; LRESULT WINAPI DefDriverProc16(DWORD dwDevID, HDRVR16 hDriv, UINT16 wMsg, LPARAM dwParam1, LPARAM dwParam2); LRESULT WINAPI DefDriverProc(DWORD dwDriverIdentifier, HDRVR hdrvr, UINT Msg, LPARAM lParam1, LPARAM lParam2); HDRVR16 WINAPI OpenDriver16(LPCSTR szDriverName, LPCSTR szSectionName, LPARAM lParam2); HDRVR WINAPI OpenDriverA(LPCSTR szDriverName, LPCSTR szSectionName, LPARAM lParam2); HDRVR WINAPI OpenDriverW(LPCWSTR szDriverName, LPCWSTR szSectionName, LPARAM lParam2); #define OpenDriver WINELIB_NAME_AW(OpenDriver) LRESULT WINAPI CloseDriver16(HDRVR16 hDriver, LPARAM lParam1, LPARAM lParam2); LRESULT WINAPI CloseDriver(HDRVR hDriver, LPARAM lParam1, LPARAM lParam2); LRESULT WINAPI SendDriverMessage16( HDRVR16 hDriver, UINT16 message, LPARAM lParam1, LPARAM lParam2 ); LRESULT WINAPI SendDriverMessage( HDRVR hDriver, UINT message, LPARAM lParam1, LPARAM lParam2 ); HMODULE16 WINAPI GetDriverModuleHandle16(HDRVR16 hDriver); HMODULE WINAPI GetDriverModuleHandle(HDRVR hDriver); DWORD WINAPI GetDriverFlags( HDRVR hDriver ); #ifdef __WINE__ /* this call (GetDriverFlags) is not documented, nor the flags returned. * here are Wine only definitions */ #define WINE_GDF_EXIST 0x80000000 #define WINE_GDF_16BIT 0x10000000 #endif #endif /* __WINE_DRIVER_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/elfdll.h0000644000175000017500000000053207233220462022676 0ustar yavoryavor#ifndef __WINE_ELFDLL_H #define __WINE_ELFDLL_H #include "module.h" #include "windef.h" WINE_MODREF *ELFDLL_LoadLibraryExA(LPCSTR libname, DWORD flags); HINSTANCE16 ELFDLL_LoadModule16(LPCSTR libname); void ELFDLL_UnloadLibrary(WINE_MODREF *wm); void *ELFDLL_dlopen(const char *libname, int flags); extern char *extra_ld_library_path; #endif avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/heap.h0000644000175000017500000000352507233220462022356 0ustar yavoryavor/* * Win32 heap definitions * * Copyright 1996 Alexandre Julliard */ #ifndef __WINE_HEAP_H #define __WINE_HEAP_H #include "config.h" #include "winbase.h" extern HANDLE SystemHeap; extern HANDLE SegptrHeap; extern int HEAP_IsInsideHeap( HANDLE heap, DWORD flags, LPCVOID ptr ); extern SEGPTR HEAP_GetSegptr( HANDLE heap, DWORD flags, LPCVOID ptr ); extern LPSTR HEAP_strdupA( HANDLE heap, DWORD flags, LPCSTR str ); extern LPWSTR HEAP_strdupW( HANDLE heap, DWORD flags, LPCWSTR str ); extern LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str ); extern LPSTR HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR str ); /* SEGPTR helper macros */ #define SEGPTR_ALLOC(size) \ (HeapAlloc( SegptrHeap, 0, (size) )) #define SEGPTR_NEW(type) \ ((type *)HeapAlloc( SegptrHeap, 0, sizeof(type) )) #define SEGPTR_STRDUP(str) \ (HIWORD(str) ? HEAP_strdupA( SegptrHeap, 0, (str) ) : (LPSTR)(str)) #define SEGPTR_STRDUP_WtoA(str) \ (HIWORD(str) ? HEAP_strdupWtoA( SegptrHeap, 0, (str) ) : (LPSTR)(str)) /* define an inline function, a macro won't do */ static inline SEGPTR WINE_UNUSED SEGPTR_Get(LPCVOID ptr) { return (HIWORD(ptr) ? HEAP_GetSegptr( SegptrHeap, 0, ptr ) : (SEGPTR)ptr); } #define SEGPTR_GET(ptr) SEGPTR_Get(ptr) #define SEGPTR_FREE(ptr) \ (HIWORD(ptr) ? HeapFree( SegptrHeap, 0, (ptr) ) : 0) /* system heap private data */ /* you must lock the system heap before using this structure */ typedef struct { void *gdi; /* GDI heap */ void *user; /* USER handle table */ void *cursor; /* cursor information */ void *queue; /* message queues descriptor */ void *win; /* windows descriptor */ void *root; /* X11 root window */ } SYSTEM_HEAP_DESCR; extern SYSTEM_HEAP_DESCR *SystemHeapDescr; #endif /* __WINE_HEAP_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/ldt.h0000644000175000017500000000675307233220462022232 0ustar yavoryavor/* * LDT copy * * Copyright 1995 Alexandre Julliard */ #ifndef __WINE_LDT_H #define __WINE_LDT_H #include "windef.h" enum seg_type { SEGMENT_DATA = 0, SEGMENT_STACK = 1, SEGMENT_CODE = 2 }; /* This structure represents a real LDT entry. */ /* It is used by get_ldt_entry() and set_ldt_entry(). */ typedef struct { unsigned long base; /* base address */ unsigned long limit; /* segment limit (in pages or bytes) */ int seg_32bit; /* is segment 32-bit? */ int read_only; /* is segment read-only? */ int limit_in_pages; /* is the limit in pages or bytes? */ enum seg_type type; /* segment type */ } ldt_entry; #ifdef __cplusplus extern "C" { #endif extern void LDT_BytesToEntry( const unsigned long *buffer, ldt_entry *content); extern void LDT_EntryToBytes( unsigned long *buffer, const ldt_entry *content); extern int LDT_GetEntry( int entry, ldt_entry *content ); extern int LDT_SetEntry( int entry, const ldt_entry *content ); extern void LDT_Print( int start, int length ); /* This structure is used to build the local copy of the LDT. */ typedef struct { unsigned long base; /* base address or 0 if entry is free */ unsigned long limit; /* limit in bytes or 0 if entry is free */ } ldt_copy_entry; #define LDT_SIZE 8192 extern ldt_copy_entry ldt_copy[LDT_SIZE]; #define __AHSHIFT 3 /* don't change! */ #define __AHINCR (1 << __AHSHIFT) #define SELECTOR_TO_ENTRY(sel) (((int)(sel) & 0xffff) >> __AHSHIFT) #define ENTRY_TO_SELECTOR(i) ((i) ? (((int)(i) << __AHSHIFT) | 7) : 0) #define IS_LDT_ENTRY_FREE(i) (!(ldt_flags_copy[(i)] & LDT_FLAGS_ALLOCATED)) #define IS_SELECTOR_FREE(sel) (IS_LDT_ENTRY_FREE(SELECTOR_TO_ENTRY(sel))) #define GET_SEL_BASE(sel) (ldt_copy[SELECTOR_TO_ENTRY(sel)].base) #define GET_SEL_LIMIT(sel) (ldt_copy[SELECTOR_TO_ENTRY(sel)].limit) /* Convert a segmented ptr (16:16) to a linear (32) pointer */ #define PTR_SEG_OFF_TO_LIN(seg,off) \ ((void*)(GET_SEL_BASE(seg) + (unsigned int)(off))) #define PTR_SEG_TO_LIN(ptr) \ PTR_SEG_OFF_TO_LIN(SELECTOROF(ptr),OFFSETOF(ptr)) #define PTR_SEG_OFF_TO_SEGPTR(seg,off) \ ((SEGPTR)MAKELONG(off,seg)) #define PTR_SEG_OFF_TO_HUGEPTR(seg,off) \ PTR_SEG_OFF_TO_SEGPTR( (seg) + (HIWORD(off) << __AHSHIFT), LOWORD(off) ) #define W32S_APPLICATION() (PROCESS_Current()->flags & PDB32_WIN32S_PROC) #define W32S_OFFSET 0x10000 #define W32S_APP2WINE(addr, offset) ((addr)? (DWORD)(addr) + (DWORD)(offset) : 0) #define W32S_WINE2APP(addr, offset) ((addr)? (DWORD)(addr) - (DWORD)(offset) : 0) extern unsigned char ldt_flags_copy[LDT_SIZE]; #define LDT_FLAGS_TYPE 0x03 /* Mask for segment type */ #define LDT_FLAGS_READONLY 0x04 /* Segment is read-only (data) */ #define LDT_FLAGS_EXECONLY 0x04 /* Segment is execute-only (code) */ #define LDT_FLAGS_32BIT 0x08 /* Segment is 32-bit (code or stack) */ #define LDT_FLAGS_BIG 0x10 /* Segment is big (limit is in pages) */ #define LDT_FLAGS_ALLOCATED 0x80 /* Segment is allocated (no longer free) */ #define GET_SEL_FLAGS(sel) (ldt_flags_copy[SELECTOR_TO_ENTRY(sel)]) #define FIRST_LDT_ENTRY_TO_ALLOC 17 /* Determine if sel is a system selector (i.e. not managed by Wine) */ #define IS_SELECTOR_SYSTEM(sel) \ (!((sel) & 4) || (SELECTOR_TO_ENTRY(sel) < FIRST_LDT_ENTRY_TO_ALLOC)) #define IS_SELECTOR_32BIT(sel) \ (IS_SELECTOR_SYSTEM(sel) || (GET_SEL_FLAGS(sel) & LDT_FLAGS_32BIT)) #ifdef __cplusplus } #endif #endif /* __WINE_LDT_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/mmreg.h0000644000175000017500000001057107377144556022571 0ustar yavoryavor/* * mmreg.h - Declarations for ??? */ #ifndef __WINE_MMREG_H #define __WINE_MMREG_H /*********************************************************************** * Defines/Enums */ #ifndef _ACM_WAVEFILTER #define _ACM_WAVEFILTER #include "windef.h" #define WAVE_FILTER_UNKNOWN 0x0000 #define WAVE_FILTER_DEVELOPMENT 0xFFFF typedef struct __attribute__((__packed__)) _WAVEFILTER { DWORD cbStruct; DWORD dwFilterTag; DWORD fdwFilter; DWORD dwReserved[5]; } WAVEFILTER, *PWAVEFILTER, *NPWAVEFILTER, *LPWAVEFILTER; #endif /* _ACM_WAVEFILTER */ #ifndef WAVE_FILTER_VOLUME #define WAVE_FILTER_VOLUME 0x0001 typedef struct __attribute__((__packed__)) _WAVEFILTER_VOLUME { WAVEFILTER wfltr; DWORD dwVolume; } VOLUMEWAVEFILTER, *PVOLUMEWAVEFILTER, *NPVOLUMEWAVEFILTER, *LPVOLUMEWAVEFILTER; #endif /* WAVE_FILTER_VOLUME */ #ifndef WAVE_FILTER_ECHO #define WAVE_FILTER_ECHO 0x0002 typedef struct __attribute__((__packed__)) WAVEFILTER_ECHO { WAVEFILTER wfltr; DWORD dwVolume; DWORD dwDelay; } ECHOWAVEFILTER, *PECHOWAVEFILTER, *NPECHOWAVEFILTER, *LPECHOWAVEFILTER; #endif /* WAVEFILTER_ECHO */ #ifndef _WAVEFORMATEX_ #define _WAVEFORMATEX_ typedef struct __attribute__((__packed__)) _WAVEFORMATEX { WORD wFormatTag; WORD nChannels; DWORD nSamplesPerSec; DWORD nAvgBytesPerSec; WORD nBlockAlign; WORD wBitsPerSample; WORD cbSize; } WAVEFORMATEX, *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX; #endif /* _WAVEFORMATEX_ */ /* WAVE form wFormatTag IDs */ #define WAVE_FORMAT_UNKNOWN 0x0000 /* Microsoft Corporation */ #define WAVE_FORMAT_ADPCM 0x0002 /* Microsoft Corporation */ #define WAVE_FORMAT_IBM_CVSD 0x0005 /* IBM Corporation */ #define WAVE_FORMAT_ALAW 0x0006 /* Microsoft Corporation */ #define WAVE_FORMAT_MULAW 0x0007 /* Microsoft Corporation */ #define WAVE_FORMAT_OKI_ADPCM 0x0010 /* OKI */ #define WAVE_FORMAT_DVI_ADPCM 0x0011 /* Intel Corporation */ #define WAVE_FORMAT_IMA_ADPCM (WAVE_FORMAT_DVI_ADPCM) /* Intel Corporation */ #define WAVE_FORMAT_MEDIASPACE_ADPCM 0x0012 /* Videologic */ #define WAVE_FORMAT_SIERRA_ADPCM 0x0013 /* Sierra Semiconductor Corp */ #define WAVE_FORMAT_G723_ADPCM 0x0014 /* Antex Electronics Corporation */ #define WAVE_FORMAT_DIGISTD 0x0015 /* DSP Solutions, Inc. */ #define WAVE_FORMAT_DIGIFIX 0x0016 /* DSP Solutions, Inc. */ #define WAVE_FORMAT_DIALOGIC_OKI_ADPCM 0x0017 /* Dialogic Corporation */ #define WAVE_FORMAT_YAMAHA_ADPCM 0x0020 /* Yamaha Corporation of America */ #define WAVE_FORMAT_SONARC 0x0021 /* Speech Compression */ #define WAVE_FORMAT_DSPGROUP_TRUESPEECH 0x0022 /* DSP Group, Inc */ #define WAVE_FORMAT_ECHOSC1 0x0023 /* Echo Speech Corporation */ #define WAVE_FORMAT_AUDIOFILE_AF36 0x0024 /* */ #define WAVE_FORMAT_APTX 0x0025 /* Audio Processing Technology */ #define WAVE_FORMAT_AUDIOFILE_AF10 0x0026 /* */ #define WAVE_FORMAT_DOLBY_AC2 0x0030 /* Dolby Laboratories */ #define WAVE_FORMAT_GSM610 0x0031 /* Microsoft Corporation */ #define WAVE_FORMAT_ANTEX_ADPCME 0x0033 /* Antex Electronics Corporation */ #define WAVE_FORMAT_CONTROL_RES_VQLPC 0x0034 /* Control Resources Limited */ #define WAVE_FORMAT_DIGIREAL 0x0035 /* DSP Solutions, Inc. */ #define WAVE_FORMAT_DIGIADPCM 0x0036 /* DSP Solutions, Inc. */ #define WAVE_FORMAT_CONTROL_RES_CR10 0x0037 /* Control Resources Limited */ #define WAVE_FORMAT_NMS_VBXADPCM 0x0038 /* Natural MicroSystems */ #define WAVE_FORMAT_G721_ADPCM 0x0040 /* Antex Electronics Corporation */ #define WAVE_FORMAT_MPEG 0x0050 /* Microsoft Corporation */ #define WAVE_FORMAT_CREATIVE_ADPCM 0x0200 /* Creative Labs, Inc */ #define WAVE_FORMAT_CREATIVE_FASTSPEECH8 0x0202 /* Creative Labs, Inc */ #define WAVE_FORMAT_CREATIVE_FASTSPEECH10 0x0203 /* Creative Labs, Inc */ #define WAVE_FORMAT_FM_TOWNS_SND 0x0300 /* Fujitsu Corp. */ #define WAVE_FORMAT_OLIGSM 0x1000 /* Ing C. Olivetti & C., S.p.A. */ #define WAVE_FORMAT_OLIADPCM 0x1001 /* Ing C. Olivetti & C., S.p.A. */ #define WAVE_FORMAT_OLICELP 0x1002 /* Ing C. Olivetti & C., S.p.A. */ #define WAVE_FORMAT_OLISBC 0x1003 /* Ing C. Olivetti & C., S.p.A. */ #define WAVE_FORMAT_OLIOPR 0x1004 /* Ing C. Olivetti & C., S.p.A. */ #define WAVE_FORMAT_DEVELOPMENT (0xFFFF) #endif /* __WINE_MMREG_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/module.h0000644000175000017500000000703607474366577022760 0ustar yavoryavor/* * Module definitions * * Copyright 1995 Alexandre Julliard */ #ifndef __WINE_MODULE_H #define __WINE_MODULE_H #include "windef.h" #include "pe_image.h" typedef struct { BYTE type; BYTE flags; BYTE segnum; WORD offs WINE_PACKED; } ET_ENTRY; typedef struct { WORD first; /* ordinal */ WORD last; /* ordinal */ WORD next; /* bundle */ } ET_BUNDLE; /* In-memory segment table */ typedef struct { WORD filepos; /* Position in file, in sectors */ WORD size; /* Segment size on disk */ WORD flags; /* Segment flags */ WORD minsize; /* Min. size of segment in memory */ HANDLE16 hSeg; /* Selector or handle (selector - 1) */ /* of segment in memory */ } SEGTABLEENTRY; /* Self-loading modules contain this structure in their first segment */ #include "pshpack1.h" typedef struct { WORD version; /* Must be "A0" (0x3041) */ WORD reserved; FARPROC16 BootApp; /* startup procedure */ FARPROC16 LoadAppSeg; /* procedure to load a segment */ FARPROC16 reserved2; FARPROC16 MyAlloc; /* memory allocation procedure, * wine must write this field */ FARPROC16 EntryAddrProc; FARPROC16 ExitProc; /* exit procedure */ WORD reserved3[4]; FARPROC16 SetOwner; /* Set Owner procedure, exported by wine */ } SELFLOADHEADER; /* Parameters for LoadModule() */ typedef struct { HGLOBAL16 hEnvironment; /* Environment segment */ SEGPTR cmdLine WINE_PACKED; /* Command-line */ SEGPTR showCmd WINE_PACKED; /* Code for ShowWindow() */ SEGPTR reserved WINE_PACKED; } LOADPARAMS16; typedef struct { LPSTR lpEnvAddress; LPSTR lpCmdLine; UINT16 *lpCmdShow; DWORD dwReserved; } LOADPARAMS; #include "poppack.h" /* internal representation of 32bit modules. per process. */ typedef enum { MODULE32_PE = 1, MODULE32_ELF, MODULE32_ELFDLL } MODULE32_TYPE; typedef struct _wine_modref { struct _wine_modref *next; struct _wine_modref *prev; MODULE32_TYPE type; union { PE_MODREF pe; ELF_MODREF elf; } binfmt; HMODULE module; int nDeps; struct _wine_modref **deps; int flags; int refCount; char *filename; char *modname; char *short_filename; char *short_modname; } WINE_MODREF; #define WINE_MODREF_INTERNAL 0x00000001 #define WINE_MODREF_NO_DLL_CALLS 0x00000002 #define WINE_MODREF_PROCESS_ATTACHED 0x00000004 #define WINE_MODREF_LOAD_AS_DATAFILE 0x00000010 #define WINE_MODREF_DONT_RESOLVE_REFS 0x00000020 #define WINE_MODREF_MARKER 0x80000000 /* Resource types */ typedef struct resource_typeinfo_s NE_TYPEINFO; typedef struct resource_nameinfo_s NE_NAMEINFO; #define NE_SEG_TABLE(pModule) \ ((SEGTABLEENTRY *)((char *)(pModule) + (pModule)->seg_table)) #define NE_MODULE_TABLE(pModule) \ ((WORD *)((char *)(pModule) + (pModule)->modref_table)) #define NE_MODULE_NAME(pModule) \ (((OFSTRUCT *)((char*)(pModule) + (pModule)->fileinfo))->szPathName) struct modref_list_t; typedef struct modref_list_t { WINE_MODREF* wm; struct modref_list_t *next; struct modref_list_t *prev; } modref_list; /* module.c */ extern FARPROC MODULE_GetProcAddress( HMODULE hModule, LPCSTR function, WIN_BOOL snoop ); extern WINE_MODREF *MODULE32_LookupHMODULE( HMODULE hModule ); extern WINE_MODREF *MODULE_FindModule( LPCSTR path ); /* resource.c */ extern INT WINAPI AccessResource(HMODULE,HRSRC); #endif /* __WINE_MODULE_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/msacm.h0000644000175000017500000006626507466224575022574 0ustar yavoryavor/* * msacm.h - Declarations for MSACM */ #ifndef __WINE_MSACM_H #define __WINE_MSACM_H #include "windef.h" #include "driver.h" #include "mmreg.h" #ifdef __cplusplus extern "C" { #endif /* defined(__cplusplus) */ //typedef WORD VERSION; /* major (high byte), minor (low byte) */ typedef UINT16 MMVERSION16; typedef UINT MMVERSION; typedef UINT16 MCIDEVICEID16; typedef UINT MCIDEVICEID; typedef UINT16 MMRESULT16; typedef UINT MMRESULT; typedef DWORD FOURCC; /* a four character code */ #if !defined(WAVE_FORMAT_PCM) #define WAVE_FORMAT_PCM 1 #endif /*********************************************************************** * Defines/Enums */ #define ACMERR_BASE 512 #define ACMERR_NOTPOSSIBLE (ACMERR_BASE + 0) #define ACMERR_BUSY (ACMERR_BASE + 1) #define ACMERR_UNPREPARED (ACMERR_BASE + 2) #define ACMERR_CANCELED (ACMERR_BASE + 3) #define MM_ACM_OPEN MM_STREAM_OPEN #define MM_ACM_CLOSE MM_STREAM_CLOSE #define MM_ACM_DONE MM_STREAM_DONE #define ACM_DRIVERADDF_FUNCTION 0x00000003L #define ACM_DRIVERADDF_NOTIFYHWND 0x00000004L #define ACM_DRIVERADDF_TYPEMASK 0x00000007L #define ACM_DRIVERADDF_LOCAL 0x00000000L #define ACM_DRIVERADDF_GLOBAL 0x00000008L #define ACMDRIVERDETAILS_SHORTNAME_CHARS 32 #define ACMDRIVERDETAILS_LONGNAME_CHARS 128 #define ACMDRIVERDETAILS_COPYRIGHT_CHARS 80 #define ACMDRIVERDETAILS_LICENSING_CHARS 128 #define ACMDRIVERDETAILS_FEATURES_CHARS 512 #define ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC mmioFOURCC('a', 'u', 'd', 'c') #define ACMDRIVERDETAILS_FCCCOMP_UNDEFINED mmioFOURCC('\0', '\0', '\0', '\0') #define ACMDRIVERDETAILS_SUPPORTF_CODEC 0x00000001L #define ACMDRIVERDETAILS_SUPPORTF_CONVERTER 0x00000002L #define ACMDRIVERDETAILS_SUPPORTF_FILTER 0x00000004L #define ACMDRIVERDETAILS_SUPPORTF_HARDWARE 0x00000008L #define ACMDRIVERDETAILS_SUPPORTF_ASYNC 0x00000010L #define ACMDRIVERDETAILS_SUPPORTF_LOCAL 0x40000000L #define ACMDRIVERDETAILS_SUPPORTF_DISABLED 0x80000000L #define ACM_DRIVERENUMF_NOLOCAL 0x40000000L #define ACM_DRIVERENUMF_DISABLED 0x80000000L #define ACM_DRIVERPRIORITYF_ENABLE 0x00000001L #define ACM_DRIVERPRIORITYF_DISABLE 0x00000002L #define ACM_DRIVERPRIORITYF_ABLEMASK 0x00000003L #define ACM_DRIVERPRIORITYF_BEGIN 0x00010000L #define ACM_DRIVERPRIORITYF_END 0x00020000L #define ACM_DRIVERPRIORITYF_DEFERMASK 0x00030000L #define MM_ACM_FILTERCHOOSE 0x8000 #define FILTERCHOOSE_MESSAGE 0 #define FILTERCHOOSE_FILTERTAG_VERIFY (FILTERCHOOSE_MESSAGE+0) #define FILTERCHOOSE_FILTER_VERIFY (FILTERCHOOSE_MESSAGE+1) #define FILTERCHOOSE_CUSTOM_VERIFY (FILTERCHOOSE_MESSAGE+2) #define ACMFILTERCHOOSE_STYLEF_SHOWHELP 0x00000004L #define ACMFILTERCHOOSE_STYLEF_ENABLEHOOK 0x00000008L #define ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATE 0x00000010L #define ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATEHANDLE 0x00000020L #define ACMFILTERCHOOSE_STYLEF_INITTOFILTERSTRUCT 0x00000040L #define ACMFILTERCHOOSE_STYLEF_CONTEXTHELP 0x00000080L #define ACMFILTERDETAILS_FILTER_CHARS 128 #define ACM_FILTERDETAILSF_INDEX 0x00000000L #define ACM_FILTERDETAILSF_FILTER 0x00000001L #define ACM_FILTERDETAILSF_QUERYMASK 0x0000000FL #define ACMFILTERTAGDETAILS_FILTERTAG_CHARS 48 #define ACM_FILTERTAGDETAILSF_INDEX 0x00000000L #define ACM_FILTERTAGDETAILSF_FILTERTAG 0x00000001L #define ACM_FILTERTAGDETAILSF_LARGESTSIZE 0x00000002L #define ACM_FILTERTAGDETAILSF_QUERYMASK 0x0000000FL #define ACM_FILTERENUMF_DWFILTERTAG 0x00010000L #define ACMHELPMSGSTRINGA "acmchoose_help" #define ACMHELPMSGSTRINGW L"acmchoose_help" #define ACMHELPMSGSTRING16 "acmchoose_help" #define ACMHELPMSGCONTEXTMENUA "acmchoose_contextmenu" #define ACMHELPMSGCONTEXTMENUW L"acmchoose_contextmenu" #define ACMHELPMSGCONTEXTMENU16 "acmchoose_contextmenu" #define ACMHELPMSGCONTEXTHELPA "acmchoose_contexthelp" #define ACMHELPMSGCONTEXTHELPW L"acmchoose_contexthelp" #define ACMHELPMSGCONTEXTHELP16 "acmchoose_contexthelp" #define MM_ACM_FORMATCHOOSE 0x8000 #define FORMATCHOOSE_MESSAGE 0 #define FORMATCHOOSE_FORMATTAG_VERIFY (FORMATCHOOSE_MESSAGE+0) #define FORMATCHOOSE_FORMAT_VERIFY (FORMATCHOOSE_MESSAGE+1) #define FORMATCHOOSE_CUSTOM_VERIFY (FORMATCHOOSE_MESSAGE+2) #define ACMFORMATCHOOSE_STYLEF_SHOWHELP 0x00000004L #define ACMFORMATCHOOSE_STYLEF_ENABLEHOOK 0x00000008L #define ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE 0x00000010L #define ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE 0x00000020L #define ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT 0x00000040L #define ACMFORMATCHOOSE_STYLEF_CONTEXTHELP 0x00000080L #define ACMFORMATDETAILS_FORMAT_CHARS 128 #define ACM_FORMATDETAILSF_INDEX 0x00000000L #define ACM_FORMATDETAILSF_FORMAT 0x00000001L #define ACM_FORMATDETAILSF_QUERYMASK 0x0000000FL #define ACM_FORMATENUMF_WFORMATTAG 0x00010000L #define ACM_FORMATENUMF_NCHANNELS 0x00020000L #define ACM_FORMATENUMF_NSAMPLESPERSEC 0x00040000L #define ACM_FORMATENUMF_WBITSPERSAMPLE 0x00080000L #define ACM_FORMATENUMF_CONVERT 0x00100000L #define ACM_FORMATENUMF_SUGGEST 0x00200000L #define ACM_FORMATENUMF_HARDWARE 0x00400000L #define ACM_FORMATENUMF_INPUT 0x00800000L #define ACM_FORMATENUMF_OUTPUT 0x01000000L #define ACM_FORMATSUGGESTF_WFORMATTAG 0x00010000L #define ACM_FORMATSUGGESTF_NCHANNELS 0x00020000L #define ACM_FORMATSUGGESTF_NSAMPLESPERSEC 0x00040000L #define ACM_FORMATSUGGESTF_WBITSPERSAMPLE 0x00080000L #define ACM_FORMATSUGGESTF_TYPEMASK 0x00FF0000L #define ACMFORMATTAGDETAILS_FORMATTAG_CHARS 48 #define ACM_FORMATTAGDETAILSF_INDEX 0x00000000L #define ACM_FORMATTAGDETAILSF_FORMATTAG 0x00000001L #define ACM_FORMATTAGDETAILSF_LARGESTSIZE 0x00000002L #define ACM_FORMATTAGDETAILSF_QUERYMASK 0x0000000FL #define ACM_METRIC_COUNT_DRIVERS 1 #define ACM_METRIC_COUNT_CODECS 2 #define ACM_METRIC_COUNT_CONVERTERS 3 #define ACM_METRIC_COUNT_FILTERS 4 #define ACM_METRIC_COUNT_DISABLED 5 #define ACM_METRIC_COUNT_HARDWARE 6 #define ACM_METRIC_COUNT_LOCAL_DRIVERS 20 #define ACM_METRIC_COUNT_LOCAL_CODECS 21 #define ACM_METRIC_COUNT_LOCAL_CONVERTERS 22 #define ACM_METRIC_COUNT_LOCAL_FILTERS 23 #define ACM_METRIC_COUNT_LOCAL_DISABLED 24 #define ACM_METRIC_HARDWARE_WAVE_INPUT 30 #define ACM_METRIC_HARDWARE_WAVE_OUTPUT 31 #define ACM_METRIC_MAX_SIZE_FORMAT 50 #define ACM_METRIC_MAX_SIZE_FILTER 51 #define ACM_METRIC_DRIVER_SUPPORT 100 #define ACM_METRIC_DRIVER_PRIORITY 101 #define ACM_STREAMCONVERTF_BLOCKALIGN 0x00000004 #define ACM_STREAMCONVERTF_START 0x00000010 #define ACM_STREAMCONVERTF_END 0x00000020 #define ACMSTREAMHEADER_STATUSF_DONE 0x00010000L #define ACMSTREAMHEADER_STATUSF_PREPARED 0x00020000L #define ACMSTREAMHEADER_STATUSF_INQUEUE 0x00100000L #define ACM_STREAMOPENF_QUERY 0x00000001 #define ACM_STREAMOPENF_ASYNC 0x00000002 #define ACM_STREAMOPENF_NONREALTIME 0x00000004 #define ACM_STREAMSIZEF_SOURCE 0x00000000L #define ACM_STREAMSIZEF_DESTINATION 0x00000001L #define ACM_STREAMSIZEF_QUERYMASK 0x0000000FL #define ACMDM_USER (DRV_USER + 0x0000) #define ACMDM_RESERVED_LOW (DRV_USER + 0x2000) #define ACMDM_RESERVED_HIGH (DRV_USER + 0x2FFF) #define ACMDM_BASE ACMDM_RESERVED_LOW #define ACMDM_DRIVER_ABOUT (ACMDM_BASE + 11) /*********************************************************************** * Callbacks */ typedef WIN_BOOL CALLBACK ( *ACMDRIVERENUMCB)( HACMDRIVERID hadid, DWORD dwInstance, DWORD fdwSupport ); typedef WIN_BOOL16 CALLBACK ( *ACMDRIVERENUMCB16)( HACMDRIVERID16 hadid, DWORD dwInstance, DWORD fdwSupport ); typedef UINT CALLBACK ( *ACMFILTERCHOOSEHOOKPROCA)( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); typedef UINT CALLBACK ( *ACMFILTERCHOOSEHOOKPROCW)( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); typedef UINT CALLBACK ( *ACMFILTERCHOOSEHOOKPROC16)( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); typedef UINT CALLBACK ( *ACMFORMATCHOOSEHOOKPROCA)( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); typedef UINT CALLBACK ( *ACMFORMATCHOOSEHOOKPROCW)( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); typedef UINT16 CALLBACK ( *ACMFORMATCHOOSEHOOKPROC16)( HWND16 hwnd, UINT16 uMsg, WPARAM16 wParam, LPARAM lParam ); /*********************************************************************** * Structures */ typedef struct _ACMDRIVERDETAILSA { DWORD cbStruct; FOURCC fccType; FOURCC fccComp; WORD wMid; WORD wPid; DWORD vdwACM; DWORD vdwDriver; DWORD fdwSupport; DWORD cFormatTags; DWORD cFilterTags; HICON hicon; CHAR szShortName[ACMDRIVERDETAILS_SHORTNAME_CHARS]; CHAR szLongName[ACMDRIVERDETAILS_LONGNAME_CHARS]; CHAR szCopyright[ACMDRIVERDETAILS_COPYRIGHT_CHARS]; CHAR szLicensing[ACMDRIVERDETAILS_LICENSING_CHARS]; CHAR szFeatures[ACMDRIVERDETAILS_FEATURES_CHARS]; } ACMDRIVERDETAILSA, *PACMDRIVERDETAILSA; typedef struct _ACMDRIVERDETAILSW { DWORD cbStruct; FOURCC fccType; FOURCC fccComp; WORD wMid; WORD wPid; DWORD vdwACM; DWORD vdwDriver; DWORD fdwSupport; DWORD cFormatTags; DWORD cFilterTags; HICON hicon; WCHAR szShortName[ACMDRIVERDETAILS_SHORTNAME_CHARS]; WCHAR szLongName[ACMDRIVERDETAILS_LONGNAME_CHARS]; WCHAR szCopyright[ACMDRIVERDETAILS_COPYRIGHT_CHARS]; WCHAR szLicensing[ACMDRIVERDETAILS_LICENSING_CHARS]; WCHAR szFeatures[ACMDRIVERDETAILS_FEATURES_CHARS]; } ACMDRIVERDETAILSW, *PACMDRIVERDETAILSW; typedef struct _ACMDRIVERDETAILS16 { DWORD cbStruct; FOURCC fccType; FOURCC fccComp; WORD wMid; WORD wPid; DWORD vdwACM; DWORD vdwDriver; DWORD fdwSupport; DWORD cFormatTags; DWORD cFilterTags; HICON16 hicon; CHAR szShortName[ACMDRIVERDETAILS_SHORTNAME_CHARS]; CHAR szLongName[ACMDRIVERDETAILS_LONGNAME_CHARS]; CHAR szCopyright[ACMDRIVERDETAILS_COPYRIGHT_CHARS]; CHAR szLicensing[ACMDRIVERDETAILS_LICENSING_CHARS]; CHAR szFeatures[ACMDRIVERDETAILS_FEATURES_CHARS]; } ACMDRIVERDETAILS16, *NPACMDRIVERDETAILS16, *LPACMDRIVERDETAILS16; typedef struct _ACMFILTERCHOOSEA { DWORD cbStruct; DWORD fdwStyle; HWND hwndOwner; PWAVEFILTER pwfltr; DWORD cbwfltr; LPCSTR pszTitle; CHAR szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS]; CHAR szFilter[ACMFILTERDETAILS_FILTER_CHARS]; LPSTR pszName; DWORD cchName; DWORD fdwEnum; PWAVEFILTER pwfltrEnum; HINSTANCE hInstance; LPCSTR pszTemplateName; LPARAM lCustData; ACMFILTERCHOOSEHOOKPROCA pfnHook; } ACMFILTERCHOOSEA, *PACMFILTERCHOOSEA; typedef struct _ACMFILTERCHOOSEW { DWORD cbStruct; DWORD fdwStyle; HWND hwndOwner; PWAVEFILTER pwfltr; DWORD cbwfltr; LPCWSTR pszTitle; WCHAR szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS]; WCHAR szFilter[ACMFILTERDETAILS_FILTER_CHARS]; LPWSTR pszName; DWORD cchName; DWORD fdwEnum; PWAVEFILTER pwfltrEnum; HINSTANCE hInstance; LPCWSTR pszTemplateName; LPARAM lCustData; ACMFILTERCHOOSEHOOKPROCW pfnHook; } ACMFILTERCHOOSEW, *PACMFILTERCHOOSEW; typedef struct _ACMFILTERCHOOSE16 { DWORD cbStruct; DWORD fdwStyle; HWND16 hwndOwner; LPWAVEFILTER pwfltr; DWORD cbwfltr; LPCSTR pszTitle; char szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS]; char szFilter[ACMFILTERDETAILS_FILTER_CHARS]; LPSTR pszName; DWORD cchName; DWORD fdwEnum; LPWAVEFILTER pwfltrEnum; HINSTANCE16 hInstance; LPCSTR pszTemplateName; LPARAM lCustData; ACMFILTERCHOOSEHOOKPROC16 pfnHook; } ACMFILTERCHOOSE16, *NPACMFILTERCHOOSE16, *LPACMFILTERCHOOSE16; typedef struct _ACMFILTERDETAILSA { DWORD cbStruct; DWORD dwFilterIndex; DWORD dwFilterTag; DWORD fdwSupport; PWAVEFILTER pwfltr; DWORD cbwfltr; CHAR szFilter[ACMFILTERDETAILS_FILTER_CHARS]; } ACMFILTERDETAILSA, *PACMFILTERDETAILSA; typedef struct _ACMFILTERDETAILSW { DWORD cbStruct; DWORD dwFilterIndex; DWORD dwFilterTag; DWORD fdwSupport; PWAVEFILTER pwfltr; DWORD cbwfltr; WCHAR szFilter[ACMFILTERDETAILS_FILTER_CHARS]; } ACMFILTERDETAILSW, *PACMFILTERDETAILSW; typedef struct _ACMFILTERDETAILS16 { DWORD cbStruct; DWORD dwFilterIndex; DWORD dwFilterTag; DWORD fdwSupport; LPWAVEFILTER pwfltr; DWORD cbwfltr; CHAR szFilter[ACMFILTERDETAILS_FILTER_CHARS]; } ACMFILTERDETAILS16, *NPACMFILTERDETAILS16, *LPACMFILTERDETAILS16; typedef struct _ACMFILTERTAGDETAILSA { DWORD cbStruct; DWORD dwFilterTagIndex; DWORD dwFilterTag; DWORD cbFilterSize; DWORD fdwSupport; DWORD cStandardFilters; CHAR szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS]; } ACMFILTERTAGDETAILSA, *PACMFILTERTAGDETAILSA; typedef struct _ACMFILTERTAGDETAILSW { DWORD cbStruct; DWORD dwFilterTagIndex; DWORD dwFilterTag; DWORD cbFilterSize; DWORD fdwSupport; DWORD cStandardFilters; WCHAR szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS]; } ACMFILTERTAGDETAILSW, *PACMFILTERTAGDETAILSW; typedef struct _ACMFILTERTAGDETAILS16 { DWORD cbStruct; DWORD dwFilterTagIndex; DWORD dwFilterTag; DWORD cbFilterSize; DWORD fdwSupport; DWORD cStandardFilters; CHAR szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS]; } ACMFILTERTAGDETAILS16, *NPACMFILTERTAGDETAILS16, *LPACMFILTERTAGDETAILS16; typedef struct _ACMFORMATCHOOSEA { DWORD cbStruct; DWORD fdwStyle; HWND hwndOwner; PWAVEFORMATEX pwfx; DWORD cbwfx; LPCSTR pszTitle; CHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]; CHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS]; LPSTR pszName; DWORD cchName; DWORD fdwEnum; PWAVEFORMATEX pwfxEnum; HINSTANCE hInstance; LPCSTR pszTemplateName; LPARAM lCustData; ACMFORMATCHOOSEHOOKPROCA pfnHook; } ACMFORMATCHOOSEA, *PACMFORMATCHOOSEA; typedef struct _ACMFORMATCHOOSEW { DWORD cbStruct; DWORD fdwStyle; HWND hwndOwner; PWAVEFORMATEX pwfx; DWORD cbwfx; LPCWSTR pszTitle; WCHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]; WCHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS]; LPWSTR pszName; DWORD cchName; DWORD fdwEnum; LPWAVEFORMATEX pwfxEnum; HINSTANCE hInstance; LPCWSTR pszTemplateName; LPARAM lCustData; ACMFORMATCHOOSEHOOKPROCW pfnHook; } ACMFORMATCHOOSEW, *PACMFORMATCHOOSEW; typedef struct _ACMFORMATCHOOSE16 { DWORD cbStruct; DWORD fdwStyle; HWND16 hwndOwner; LPWAVEFORMATEX pwfx; DWORD cbwfx; LPCSTR pszTitle; CHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]; CHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS]; LPSTR pszName; DWORD cchName; DWORD fdwEnum; LPWAVEFORMATEX pwfxEnum; HINSTANCE16 hInstance; LPCSTR pszTemplateName; LPARAM lCustData; ACMFORMATCHOOSEHOOKPROC16 pfnHook; } ACMFORMATCHOOSE16, *NPACMFORMATCHOOSE16, *LPACMFORMATCHOOSE16; typedef struct _ACMFORMATDETAILSA { DWORD cbStruct; DWORD dwFormatIndex; DWORD dwFormatTag; DWORD fdwSupport; PWAVEFORMATEX pwfx; DWORD cbwfx; CHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS]; } ACMFORMATDETAILSA, *PACMFORMATDETAILSA; typedef struct _ACMFORMATDETAILSW { DWORD cbStruct; DWORD dwFormatIndex; DWORD dwFormatTag; DWORD fdwSupport; PWAVEFORMATEX pwfx; DWORD cbwfx; WCHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS]; } ACMFORMATDETAILSW, *PACMFORMATDETAILSW; typedef struct _ACMFORMATDETAILS16 { DWORD cbStruct; DWORD dwFormatIndex; DWORD dwFormatTag; DWORD fdwSupport; LPWAVEFORMATEX pwfx; DWORD cbwfx; CHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS]; } ACMFORMATDETAILS16, *NPACMFORMATDETAILS16, *LPACMFORMATDETAILS16; typedef struct _ACMFORMATTAGDETAILSA { DWORD cbStruct; DWORD dwFormatTagIndex; DWORD dwFormatTag; DWORD cbFormatSize; DWORD fdwSupport; DWORD cStandardFormats; CHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]; } ACMFORMATTAGDETAILSA, *PACMFORMATTAGDETAILSA; typedef struct _ACMFORMATTAGDETAILSW { DWORD cbStruct; DWORD dwFormatTagIndex; DWORD dwFormatTag; DWORD cbFormatSize; DWORD fdwSupport; DWORD cStandardFormats; WCHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]; } ACMFORMATTAGDETAILSW, *PACMFORMATTAGDETAILSW; typedef struct _ACMFORMATTAGDETAILS16 { DWORD cbStruct; DWORD dwFormatTagIndex; DWORD dwFormatTag; DWORD cbFormatSize; DWORD fdwSupport; DWORD cStandardFormats; CHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]; } ACMFORMATTAGDETAILS16, *NPACMFORMATTAGDETAILS16, *LPACMFORMATTAGDETAILS16; typedef struct _ACMSTREAMHEADER { DWORD cbStruct; DWORD fdwStatus; DWORD dwUser; LPBYTE pbSrc; DWORD cbSrcLength; DWORD cbSrcLengthUsed; DWORD dwSrcUser; LPBYTE pbDst; DWORD cbDstLength; DWORD cbDstLengthUsed; DWORD dwDstUser; DWORD dwReservedDriver[10]; } ACMSTREAMHEADER16, *NPACMSTREAMHEADER16, *LPACMSTREAMHEADER16, ACMSTREAMHEADER, *PACMSTREAMHEADER; /*********************************************************************** * Callbacks 2 */ typedef WIN_BOOL CALLBACK ( *ACMFILTERENUMCBA)( HACMDRIVERID hadid, PACMFILTERDETAILSA pafd, DWORD dwInstance, DWORD fdwSupport ); typedef WIN_BOOL CALLBACK ( *ACMFILTERENUMCBW)( HACMDRIVERID hadid, PACMFILTERDETAILSW pafd, DWORD dwInstance, DWORD fdwSupport ); typedef WIN_BOOL16 CALLBACK ( *ACMFILTERENUMCB16)( HACMDRIVERID16 hadid, LPACMFILTERDETAILS16 pafd, DWORD dwInstance, DWORD fdwSupport ); typedef WIN_BOOL CALLBACK ( *ACMFILTERTAGENUMCBA)( HACMDRIVERID hadid, PACMFILTERTAGDETAILSA paftd, DWORD dwInstance, DWORD fdwSupport ); typedef WIN_BOOL CALLBACK ( *ACMFILTERTAGENUMCBW)( HACMDRIVERID hadid, PACMFILTERTAGDETAILSW paftd, DWORD dwInstance, DWORD fdwSupport ); typedef WIN_BOOL16 CALLBACK ( *ACMFILTERTAGENUMCB16)( HACMDRIVERID16 hadid, LPACMFILTERTAGDETAILS16 paftd, DWORD dwInstance, DWORD fdwSupport ); typedef WIN_BOOL CALLBACK ( *ACMFORMATENUMCBA)( HACMDRIVERID hadid, PACMFORMATDETAILSA pafd, DWORD dwInstance, DWORD fdwSupport ); typedef WIN_BOOL CALLBACK ( *ACMFORMATENUMCBW)( HACMDRIVERID hadid, PACMFORMATDETAILSW pafd, DWORD dwInstance, DWORD fdwSupport ); typedef WIN_BOOL16 CALLBACK ( *ACMFORMATENUMCB16)( HACMDRIVERID16 hadid, LPACMFORMATDETAILS16 pafd, DWORD dwInstance, DWORD fdwSupport ); typedef WIN_BOOL CALLBACK ( *ACMFORMATTAGENUMCBA)( HACMDRIVERID hadid, PACMFORMATTAGDETAILSA paftd, DWORD dwInstance, DWORD fdwSupport ); typedef WIN_BOOL CALLBACK ( *ACMFORMATTAGENUMCBW)( HACMDRIVERID hadid, PACMFORMATTAGDETAILSW paftd, DWORD dwInstance, DWORD fdwSupport ); typedef WIN_BOOL16 CALLBACK ( *ACMFORMATTAGENUMCB16)( HACMDRIVERID16 hadid, LPACMFORMATTAGDETAILS16 paftd, DWORD dwInstance, DWORD fdwSupport ); /*********************************************************************** * Functions - Win16 */ DWORD WINAPI acmGetVersion16( ); MMRESULT16 WINAPI acmMetrics16( HACMOBJ16 hao, UINT16 uMetric, LPVOID pMetric ); MMRESULT16 WINAPI acmDriverEnum16( ACMDRIVERENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum ); MMRESULT16 WINAPI acmDriverDetails16( HACMDRIVERID16 hadid, LPACMDRIVERDETAILS16 padd, DWORD fdwDetails ); MMRESULT16 WINAPI acmDriverAdd16( LPHACMDRIVERID16 phadid, HINSTANCE16 hinstModule, LPARAM lParam, DWORD dwPriority, DWORD fdwAdd ); MMRESULT16 WINAPI acmDriverRemove16( HACMDRIVERID16 hadid, DWORD fdwRemove ); MMRESULT16 WINAPI acmDriverOpen16( LPHACMDRIVER16 phad, HACMDRIVERID16 hadid, DWORD fdwOpen ); MMRESULT16 WINAPI acmDriverClose16( HACMDRIVER16 had, DWORD fdwClose ); LRESULT WINAPI acmDriverMessage16( HACMDRIVER16 had, UINT16 uMsg, LPARAM lParam1, LPARAM lParam2 ); MMRESULT16 WINAPI acmDriverID16( HACMOBJ16 hao, LPHACMDRIVERID16 phadid, DWORD fdwDriverID ); MMRESULT16 WINAPI acmDriverPriority16( HACMDRIVERID16 hadid, DWORD dwPriority, DWORD fdwPriority ); MMRESULT16 WINAPI acmFormatTagDetails16( HACMDRIVER16 had, LPACMFORMATTAGDETAILS16 paftd, DWORD fdwDetails ); MMRESULT16 WINAPI acmFormatTagEnum16( HACMDRIVER16 had, LPACMFORMATTAGDETAILS16 paftd, ACMFORMATTAGENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum ); MMRESULT16 WINAPI acmFormatChoose16( LPACMFORMATCHOOSE16 pafmtc ); MMRESULT16 WINAPI acmFormatDetails16( HACMDRIVER16 had, LPACMFORMATDETAILS16 pafd, DWORD fdwDetails ); MMRESULT16 WINAPI acmFormatEnum16( HACMDRIVER16 had, LPACMFORMATDETAILS16 pafd, ACMFORMATENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum ); MMRESULT16 WINAPI acmFormatSuggest16( HACMDRIVER16 had, LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest ); MMRESULT16 WINAPI acmFilterTagDetails16( HACMDRIVER16 had, LPACMFILTERTAGDETAILS16 paftd, DWORD fdwDetails ); MMRESULT16 WINAPI acmFilterTagEnum16( HACMDRIVER16 had, LPACMFILTERTAGDETAILS16 paftd, ACMFILTERTAGENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum ); MMRESULT16 WINAPI acmFilterChoose16( LPACMFILTERCHOOSE16 pafltrc ); MMRESULT16 WINAPI acmFilterDetails16( HACMDRIVER16 had, LPACMFILTERDETAILS16 pafd, DWORD fdwDetails ); MMRESULT16 WINAPI acmFilterEnum16( HACMDRIVER16 had, LPACMFILTERDETAILS16 pafd, ACMFILTERENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum ); MMRESULT16 WINAPI acmStreamOpen16( LPHACMSTREAM16 phas, HACMDRIVER16 had, LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst, LPWAVEFILTER pwfltr, DWORD dwCallback, DWORD dwInstance, DWORD fdwOpen ); MMRESULT16 WINAPI acmStreamClose16( HACMSTREAM16 has, DWORD fdwClose ); MMRESULT16 WINAPI acmStreamSize16( HACMSTREAM16 has, DWORD cbInput, LPDWORD pdwOutputBytes, DWORD fdwSize ); MMRESULT16 WINAPI acmStreamConvert16( HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwConvert ); MMRESULT16 WINAPI acmStreamReset16( HACMSTREAM16 has, DWORD fdwReset ); MMRESULT16 WINAPI acmStreamPrepareHeader16( HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwPrepare ); MMRESULT16 WINAPI acmStreamUnprepareHeader16( HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwUnprepare ); /*********************************************************************** * Functions - Win32 */ MMRESULT WINAPI acmDriverAddA( PHACMDRIVERID phadid, HINSTANCE hinstModule, LPARAM lParam, DWORD dwPriority, DWORD fdwAdd ); MMRESULT WINAPI acmDriverAddW( PHACMDRIVERID phadid, HINSTANCE hinstModule, LPARAM lParam, DWORD dwPriority, DWORD fdwAdd ); MMRESULT WINAPI acmDriverClose( HACMDRIVER had, DWORD fdwClose ); MMRESULT WINAPI acmDriverDetailsA( HACMDRIVERID hadid, PACMDRIVERDETAILSA padd, DWORD fdwDetails ); MMRESULT WINAPI acmDriverDetailsW( HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, DWORD fdwDetails ); MMRESULT WINAPI acmDriverEnum( ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWORD fdwEnum ); MMRESULT WINAPI acmDriverID( HACMOBJ hao, PHACMDRIVERID phadid, DWORD fdwDriverID ); LRESULT WINAPI acmDriverMessage( HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2 ); MMRESULT WINAPI acmDriverOpen( PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen ); MMRESULT WINAPI acmDriverPriority( HACMDRIVERID hadid, DWORD dwPriority, DWORD fdwPriority ); MMRESULT WINAPI acmDriverRemove( HACMDRIVERID hadid, DWORD fdwRemove ); MMRESULT WINAPI acmFilterChooseA( PACMFILTERCHOOSEA pafltrc ); MMRESULT WINAPI acmFilterChooseW( PACMFILTERCHOOSEW pafltrc ); MMRESULT WINAPI acmFilterDetailsA( HACMDRIVER had, PACMFILTERDETAILSA pafd, DWORD fdwDetails ); MMRESULT WINAPI acmFilterDetailsW( HACMDRIVER had, PACMFILTERDETAILSW pafd, DWORD fdwDetails ); MMRESULT WINAPI acmFilterEnumA( HACMDRIVER had, PACMFILTERDETAILSA pafd, ACMFILTERENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum ); MMRESULT WINAPI acmFilterEnumW( HACMDRIVER had, PACMFILTERDETAILSW pafd, ACMFILTERENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum ); MMRESULT WINAPI acmFilterTagDetailsA( HACMDRIVER had, PACMFILTERTAGDETAILSA paftd, DWORD fdwDetails ); MMRESULT WINAPI acmFilterTagDetailsW( HACMDRIVER had, PACMFILTERTAGDETAILSW paftd, DWORD fdwDetails ); MMRESULT WINAPI acmFilterTagEnumA( HACMDRIVER had, PACMFILTERTAGDETAILSA paftd, ACMFILTERTAGENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum ); MMRESULT WINAPI acmFilterTagEnumW( HACMDRIVER had, PACMFILTERTAGDETAILSW paftd, ACMFILTERTAGENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum ); MMRESULT WINAPI acmFormatChooseA( PACMFORMATCHOOSEA pafmtc ); MMRESULT WINAPI acmFormatChooseW( PACMFORMATCHOOSEW pafmtc ); MMRESULT WINAPI acmFormatDetailsA( HACMDRIVER had, PACMFORMATDETAILSA pafd, DWORD fdwDetails ); MMRESULT WINAPI acmFormatDetailsW( HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD fdwDetails ); MMRESULT WINAPI acmFormatEnumA( HACMDRIVER had, PACMFORMATDETAILSA pafd, ACMFORMATENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum ); MMRESULT WINAPI acmFormatEnumW( HACMDRIVER had, PACMFORMATDETAILSW pafd, ACMFORMATENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum ); MMRESULT WINAPI acmFormatSuggest( HACMDRIVER had, PWAVEFORMATEX pwfxSrc, PWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest ); MMRESULT WINAPI acmFormatTagDetailsA( HACMDRIVER had, PACMFORMATTAGDETAILSA paftd, DWORD fdwDetails ); MMRESULT WINAPI acmFormatTagDetailsW( HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, DWORD fdwDetails ); MMRESULT WINAPI acmFormatTagEnumA( HACMDRIVER had, PACMFORMATTAGDETAILSA paftd, ACMFORMATTAGENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum ); MMRESULT WINAPI acmFormatTagEnumW( HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, ACMFORMATTAGENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum ); DWORD WINAPI acmGetVersion( ); MMRESULT WINAPI acmMetrics( HACMOBJ hao, UINT uMetric, LPVOID pMetric ); MMRESULT WINAPI acmStreamClose( HACMSTREAM has, DWORD fdwClose ); MMRESULT WINAPI acmStreamConvert( HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwConvert ); MMRESULT WINAPI acmStreamMessage( HACMSTREAM has, UINT uMsg, LPARAM lParam1, LPARAM lParam2 ); MMRESULT WINAPI acmStreamOpen( PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc, PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD dwCallback, DWORD dwInstance, DWORD fdwOpen ); MMRESULT WINAPI acmStreamPrepareHeader( HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwPrepare ); MMRESULT WINAPI acmStreamReset( HACMSTREAM has, DWORD fdwReset ); MMRESULT WINAPI acmStreamSize( HACMSTREAM has, DWORD cbInput, LPDWORD pdwOutputBytes, DWORD fdwSize ); MMRESULT WINAPI acmStreamUnprepareHeader( HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwUnprepare ); #ifdef __cplusplus } /* extern "C" */ #endif /* defined(__cplusplus) */ #endif /* __WINE_MSACM_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/msacmdrv.h0000644000175000017500000001211107233220464023246 0ustar yavoryavor/* * msacmdrv.h - Declarations for MSACM driver */ #ifndef __WINE_MSACMDRV_H #define __WINE_MSACMDRV_H #include "windef.h" #include "msacm.h" /*********************************************************************** * Types */ /*********************************************************************** * Defines/Enums */ #define MAKE_ACM_VERSION(mjr, mnr, bld) \ (((long)(mjr)<<24) | ((long)(mnr)<<16) | ((long)bld)) #define ACMDRVOPENDESC_SECTIONNAME_CHARS #define ACMDM_DRIVER_NOTIFY (ACMDM_BASE + 1) #define ACMDM_DRIVER_DETAILS (ACMDM_BASE + 10) #define ACMDM_HARDWARE_WAVE_CAPS_INPUT (ACMDM_BASE + 20) #define ACMDM_HARDWARE_WAVE_CAPS_OUTPUT (ACMDM_BASE + 21) #define ACMDM_FORMATTAG_DETAILS (ACMDM_BASE + 25) #define ACMDM_FORMAT_DETAILS (ACMDM_BASE + 26) #define ACMDM_FORMAT_SUGGEST (ACMDM_BASE + 27) #define ACMDM_FILTERTAG_DETAILS (ACMDM_BASE + 50) #define ACMDM_FILTER_DETAILS (ACMDM_BASE + 51) #define ACMDM_STREAM_OPEN (ACMDM_BASE + 76) #define ACMDM_STREAM_CLOSE (ACMDM_BASE + 77) #define ACMDM_STREAM_SIZE (ACMDM_BASE + 78) #define ACMDM_STREAM_CONVERT (ACMDM_BASE + 79) #define ACMDM_STREAM_RESET (ACMDM_BASE + 80) #define ACMDM_STREAM_PREPARE (ACMDM_BASE + 81) #define ACMDM_STREAM_UNPREPARE (ACMDM_BASE + 82) #define ACMDM_STREAM_UPDATE (ACMDM_BASE + 83) /*********************************************************************** * Structures */ typedef struct _ACMDRVOPENDESCA { DWORD cbStruct; FOURCC fccType; FOURCC fccComp; DWORD dwVersion; DWORD dwFlags; DWORD dwError; LPCSTR pszSectionName; LPCSTR pszAliasName; DWORD dnDevNode; } ACMDRVOPENDESCA, *PACMDRVOPENDESCA; typedef struct _ACMDRVOPENDESCW { DWORD cbStruct; FOURCC fccType; FOURCC fccComp; DWORD dwVersion; DWORD dwFlags; DWORD dwError; LPCWSTR pszSectionName; LPCWSTR pszAliasName; DWORD dnDevNode; } ACMDRVOPENDESCW, *PACMDRVOPENDESCW; typedef struct _ACMDRVOPENDESC16 { DWORD cbStruct; FOURCC fccType; FOURCC fccComp; DWORD dwVersion; DWORD dwFlags; DWORD dwError; LPCSTR pszSectionName; LPCSTR pszAliasName; DWORD dnDevNode; } ACMDRVOPENDESC16, *NPACMDRVOPENDESC16, *LPACMDRVOPENDESC16; typedef struct _ACMDRVSTREAMINSTANCE16 { DWORD cbStruct; LPWAVEFORMATEX pwfxSrc; LPWAVEFORMATEX pwfxDst; LPWAVEFILTER pwfltr; DWORD dwCallback; DWORD dwInstance; DWORD fdwOpen; DWORD fdwDriver; DWORD dwDriver; HACMSTREAM16 has; } ACMDRVSTREAMINSTANCE16, *NPACMDRVSTREAMINSTANCE16, *LPACMDRVSTREAMINSTANCE16; typedef struct _ACMDRVSTREAMINSTANCE { DWORD cbStruct; PWAVEFORMATEX pwfxSrc; PWAVEFORMATEX pwfxDst; PWAVEFILTER pwfltr; DWORD dwCallback; DWORD dwInstance; DWORD fdwOpen; DWORD fdwDriver; DWORD dwDriver; HACMSTREAM has; } ACMDRVSTREAMINSTANCE, *PACMDRVSTREAMINSTANCE; typedef struct _ACMDRVSTREAMHEADER16 *LPACMDRVSTREAMHEADER16; typedef struct _ACMDRVSTREAMHEADER16 { DWORD cbStruct; DWORD fdwStatus; DWORD dwUser; LPBYTE pbSrc; DWORD cbSrcLength; DWORD cbSrcLengthUsed; DWORD dwSrcUser; LPBYTE pbDst; DWORD cbDstLength; DWORD cbDstLengthUsed; DWORD dwDstUser; DWORD fdwConvert; LPACMDRVSTREAMHEADER16 *padshNext; DWORD fdwDriver; DWORD dwDriver; /* Internal fields for ACM */ DWORD fdwPrepared; DWORD dwPrepared; LPBYTE pbPreparedSrc; DWORD cbPreparedSrcLength; LPBYTE pbPreparedDst; DWORD cbPreparedDstLength; } ACMDRVSTREAMHEADER16, *NPACMDRVSTREAMHEADER16; typedef struct _ACMDRVSTREAMHEADER *PACMDRVSTREAMHEADER; typedef struct _ACMDRVSTREAMHEADER { DWORD cbStruct; DWORD fdwStatus; DWORD dwUser; LPBYTE pbSrc; DWORD cbSrcLength; DWORD cbSrcLengthUsed; DWORD dwSrcUser; LPBYTE pbDst; DWORD cbDstLength; DWORD cbDstLengthUsed; DWORD dwDstUser; DWORD fdwConvert; PACMDRVSTREAMHEADER *padshNext; DWORD fdwDriver; DWORD dwDriver; /* Internal fields for ACM */ DWORD fdwPrepared; DWORD dwPrepared; LPBYTE pbPreparedSrc; DWORD cbPreparedSrcLength; LPBYTE pbPreparedDst; DWORD cbPreparedDstLength; } ACMDRVSTREAMHEADER; typedef struct _ACMDRVSTREAMSIZE { DWORD cbStruct; DWORD fdwSize; DWORD cbSrcLength; DWORD cbDstLength; } ACMDRVSTREAMSIZE16, *NPACMDRVSTREAMSIZE16, *LPACMDRVSTREAMSIZE16, ACMDRVSTREAMSIZE, *PACMDRVSTREAMSIZE; typedef struct _ACMDRVFORMATSUGGEST16 { DWORD cbStruct; DWORD fdwSuggest; LPWAVEFORMATEX pwfxSrc; DWORD cbwfxSrc; LPWAVEFORMATEX pwfxDst; DWORD cbwfxDst; } ACMDRVFORMATSUGGEST16, *NPACMDRVFORMATSUGGEST, *LPACMDRVFORMATSUGGEST; typedef struct _ACMDRVFORMATSUGGEST { DWORD cbStruct; DWORD fdwSuggest; PWAVEFORMATEX pwfxSrc; DWORD cbwfxSrc; PWAVEFORMATEX pwfxDst; DWORD cbwfxDst; } ACMDRVFORMATSUGGEST, *PACMDRVFORMATSUGGEST; #endif /* __WINE_MSACMDRV_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/ntdef.h0000644000175000017500000000370007233220464022536 0ustar yavoryavor#ifndef __WINE_NTDEF_H #define __WINE_NTDEF_H #include "basetsd.h" #include "windef.h" #include "pshpack1.h" #ifdef __cplusplus extern "C" { #endif #define NTAPI __stdcall #ifndef IN #define IN #endif #ifndef OUT #define OUT #endif #ifndef OPTIONAL #define OPTIONAL #endif #ifndef VOID #define VOID void #endif typedef LONG NTSTATUS; typedef NTSTATUS *PNTSTATUS; typedef short CSHORT; typedef CSHORT *PCSHORT; typedef WCHAR * PWCHAR; /* NT lowlevel Strings (handled by Rtl* functions in NTDLL) * If they are zero terminated, Length does not include the terminating 0. */ typedef struct _STRING { USHORT Length; USHORT MaximumLength; PSTR Buffer; } STRING,*PSTRING,ANSI_STRING,*PANSI_STRING; typedef struct _CSTRING { USHORT Length; USHORT MaximumLength; PCSTR Buffer; } CSTRING,*PCSTRING; typedef struct _UNICODE_STRING { USHORT Length; /* bytes */ USHORT MaximumLength; /* bytes */ PWSTR Buffer; } UNICODE_STRING,*PUNICODE_STRING; /* Objects */ #define OBJ_INHERIT 0x00000002L #define OBJ_PERMANENT 0x00000010L #define OBJ_EXCLUSIVE 0x00000020L #define OBJ_CASE_INSENSITIVE 0x00000040L #define OBJ_OPENIF 0x00000080L #define OBJ_OPENLINK 0x00000100L #define OBJ_KERNEL_HANDLE 0x00000200L #define OBJ_VALID_ATTRIBUTES 0x000003F2L typedef struct _OBJECT_ATTRIBUTES { ULONG Length; HANDLE RootDirectory; PUNICODE_STRING ObjectName; ULONG Attributes; PVOID SecurityDescriptor; /* type SECURITY_DESCRIPTOR */ PVOID SecurityQualityOfService; /* type SECURITY_QUALITY_OF_SERVICE */ } OBJECT_ATTRIBUTES; typedef OBJECT_ATTRIBUTES *POBJECT_ATTRIBUTES; #define InitializeObjectAttributes(p,n,a,r,s) \ { (p)->Length = sizeof(OBJECT_ATTRIBUTES); \ (p)->RootDirectory = r; \ (p)->Attributes = a; \ (p)->ObjectName = n; \ (p)->SecurityDescriptor = s; \ (p)->SecurityQualityOfService = NULL; \ } #ifdef __cplusplus } #endif #include "poppack.h" #endif avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/pe_image.h0000644000175000017500000000667607402762740023231 0ustar yavoryavor#ifndef __WINE_PE_IMAGE_H #define __WINE_PE_IMAGE_H #include "winnt.h" #include "winbase.h" #define PE_HEADER(module) \ ((IMAGE_NT_HEADERS*)((LPBYTE)(module) + \ (((IMAGE_DOS_HEADER*)(module))->e_lfanew))) #define PE_SECTIONS(module) \ ((IMAGE_SECTION_HEADER*)((LPBYTE)&PE_HEADER(module)->OptionalHeader + \ PE_HEADER(module)->FileHeader.SizeOfOptionalHeader)) #define RVA_PTR(module,field) ((LPBYTE)(module) + PE_HEADER(module)->field) /* modreference used for attached processes * all section are calculated here, relocations etc. */ typedef struct { PIMAGE_IMPORT_DESCRIPTOR pe_import; PIMAGE_EXPORT_DIRECTORY pe_export; PIMAGE_RESOURCE_DIRECTORY pe_resource; int tlsindex; } PE_MODREF; struct _wine_modref; extern int PE_unloadImage(HMODULE hModule); extern FARPROC PE_FindExportedFunction(struct _wine_modref *wm, LPCSTR funcName, WIN_BOOL snoop); extern WIN_BOOL PE_EnumResourceTypesA(HMODULE,ENUMRESTYPEPROCA,LONG); extern WIN_BOOL PE_EnumResourceTypesW(HMODULE,ENUMRESTYPEPROCW,LONG); extern WIN_BOOL PE_EnumResourceNamesA(HMODULE,LPCSTR,ENUMRESNAMEPROCA,LONG); extern WIN_BOOL PE_EnumResourceNamesW(HMODULE,LPCWSTR,ENUMRESNAMEPROCW,LONG); extern WIN_BOOL PE_EnumResourceLanguagesA(HMODULE,LPCSTR,LPCSTR,ENUMRESLANGPROCA,LONG); extern WIN_BOOL PE_EnumResourceLanguagesW(HMODULE,LPCWSTR,LPCWSTR,ENUMRESLANGPROCW,LONG); extern HRSRC PE_FindResourceExW(struct _wine_modref*,LPCWSTR,LPCWSTR,WORD); extern DWORD PE_SizeofResource(HMODULE,HRSRC); extern struct _wine_modref *PE_LoadLibraryExA(LPCSTR, DWORD); extern void PE_UnloadLibrary(struct _wine_modref *); extern HGLOBAL PE_LoadResource(struct _wine_modref *wm,HRSRC); extern HMODULE PE_LoadImage( int hFile, LPCSTR filename, WORD *version ); extern struct _wine_modref *PE_CreateModule( HMODULE hModule, LPCSTR filename, DWORD flags, WIN_BOOL builtin ); extern WIN_BOOL PE_CreateProcess( HANDLE hFile, LPCSTR filename, LPCSTR cmd_line, LPCSTR env, LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa, WIN_BOOL inherit, DWORD flags, LPSTARTUPINFOA startup, LPPROCESS_INFORMATION info ); extern void PE_InitTls(void); extern WIN_BOOL PE_InitDLL(struct _wine_modref *wm, DWORD type, LPVOID lpReserved); extern PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA(PIMAGE_RESOURCE_DIRECTORY,LPCSTR,DWORD,WIN_BOOL); extern PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY,LPCWSTR,DWORD,WIN_BOOL); typedef DWORD CALLBACK (*DLLENTRYPROC)(HMODULE,DWORD,LPVOID); typedef struct { WORD popl WINE_PACKED; /* 0x8f 0x05 */ DWORD addr_popped WINE_PACKED;/* ... */ BYTE pushl1 WINE_PACKED; /* 0x68 */ DWORD newret WINE_PACKED; /* ... */ BYTE pushl2 WINE_PACKED; /* 0x68 */ DWORD origfun WINE_PACKED; /* original function */ BYTE ret1 WINE_PACKED; /* 0xc3 */ WORD addesp WINE_PACKED; /* 0x83 0xc4 */ BYTE nrofargs WINE_PACKED; /* nr of arguments to add esp, */ BYTE pushl3 WINE_PACKED; /* 0x68 */ DWORD oldret WINE_PACKED; /* Filled out from popl above */ BYTE ret2 WINE_PACKED; /* 0xc3 */ } ELF_STDCALL_STUB; typedef struct { void* dlhandle; ELF_STDCALL_STUB *stubs; } ELF_MODREF; extern struct _wine_modref *ELF_LoadLibraryExA( LPCSTR libname, DWORD flags); extern void ELF_UnloadLibrary(struct _wine_modref *); extern FARPROC ELF_FindExportedFunction(struct _wine_modref *wm, LPCSTR funcName); #endif /* __WINE_PE_IMAGE_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/poppack.h0000644000175000017500000000102407233220464023070 0ustar yavoryavor#ifdef __WINE_PSHPACK_H #undef __WINE_PSHPACK_H #if defined(__GNUC__) || defined(__SUNPRO_C) #pragma pack() #elif defined(__SUNPRO_CC) #warning "Assumes default alignment is 4" #pragma pack(4) #elif !defined(RC_INVOKED) #error "Restoration of the previous alignment isn't supported by the compiler" #endif /* defined(__GNUC__) || defined(__SUNPRO_C) ; !defined(RC_INVOKED) */ #else /* defined(__WINE_PSHPACK_H) */ #error "Popping alignment isn't possible since no alignment has been pushed" #endif /* defined(__WINE_PSHPACK_H) */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/pshpack1.h0000644000175000017500000000073207233220464023152 0ustar yavoryavor#ifndef __WINE_PSHPACK_H #define __WINE_PSHPACK_H 1 #if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) //#pragma pack(1) #elif !defined(RC_INVOKED) #error "1 as alignment isn't supported by the compiler" #endif /* defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) ; !defined(RC_INVOKED) */ #else /* !defined(__WINE_PSHPACK_H) */ #error "Nested pushing of alignment isn't supported by the compiler" #endif /* !defined(__WINE_PSHPACK_H) */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/pshpack2.h0000644000175000017500000000070207233220464023150 0ustar yavoryavor#ifndef __WINE_PSHPACK_H #define __WINE_PSHPACK_H 2 #if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) //#pragma pack(2) #elif !defined(RC_INVOKED) #error "2 as alignment isn't supported by the compiler" #endif /* defined(__GNUC__) || defined(__SUNPRO_CC) ; !defined(RC_INVOKED) */ #else /* !defined(__WINE_PSHPACK_H) */ #error "Nested pushing of alignment isn't supported by the compiler" #endif /* !defined(__WINE_PSHPACK_H) */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/pshpack4.h0000644000175000017500000000072707233220464023161 0ustar yavoryavor#ifndef __WINE_PSHPACK_H #define __WINE_PSHPACK_H 4 #if defined(__GNUC__) || defined(__SUNPRO_CC) //#pragma pack(4) #elif defined(__SUNPRO_C) //#pragma pack() #elif !defined(RC_INVOKED) #error "4 as alignment isn't supported by the compiler" #endif /* defined(__GNUC__) || defined(__SUNPRO_CC) ; !defined(RC_INVOKED) */ #else /* !defined(__WINE_PSHPACK_H) */ #error "Nested pushing of alignment isn't supported by the compiler" #endif /* !defined(__WINE_PSHPACK_H) */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/pshpack8.h0000644000175000017500000000051407233220464023157 0ustar yavoryavor#ifndef __WINE_PSHPACK_H #define __WINE_PSHPACK_H 8 #if 0 //#pragma pack(8) #elif !defined(RC_INVOKED) #error "8 as alignment is not supported" #endif /* 0 ; !defined(RC_INVOKED) */ #else /* !defined(__WINE_PSHPACK_H) */ #error "Nested pushing of alignment isn't supported by the compiler" #endif /* !defined(__WINE_PSHPACK_H) */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/vfw.h0000644000175000017500000004404007506327310022243 0ustar yavoryavor#ifndef __WINE_VFW_H #define __WINE_VFW_H //#include "pshpack1.h" #ifdef __cplusplus extern "C" { #endif #ifndef __WINE_WINGDI_H typedef struct __attribute__((__packed__)) { short bfType; long bfSize; short bfReserved1; short bfReserved2; long bfOffBits; } BITMAPFILEHEADER; #ifndef _BITMAPINFOHEADER_ #define _BITMAPINFOHEADER_ typedef struct __attribute__((__packed__)) { long biSize; long biWidth; long biHeight; short biPlanes; short biBitCount; long biCompression; long biSizeImage; long biXPelsPerMeter; long biYPelsPerMeter; long biClrUsed; long biClrImportant; } BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER; typedef struct { BITMAPINFOHEADER bmiHeader; int bmiColors[1]; } BITMAPINFO, *LPBITMAPINFO; #endif #endif #define VFWAPI #define VFWAPIV #ifndef __WINE_WINDEF_H typedef long (__stdcall__ *DRIVERPROC)(long,HDRVR,unsigned int,long,long); #endif #ifndef mmioFOURCC #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \ ( (long)(unsigned char)(ch0) | ( (long)(unsigned char)(ch1) << 8 ) | \ ( (long)(unsigned char)(ch2) << 16 ) | ( (long)(unsigned char)(ch3) << 24 ) ) #endif #ifndef aviTWOCC #define aviTWOCC(ch0, ch1) ((short)(unsigned char)(ch0) | ((short)(unsigned char)(ch1) << 8)) #endif #define ICTYPE_VIDEO mmioFOURCC('v', 'i', 'd', 'c') #define ICTYPE_AUDIO mmioFOURCC('a', 'u', 'd', 'c') /* Installable Compressor M? */ /* HIC struct (same layout as Win95 one) */ typedef struct tagWINE_HIC { long magic; /* 00: 'Smag' */ HANDLE curthread; /* 04: */ long type; /* 08: */ long handler; /* 0C: */ HDRVR hdrv; /* 10: */ long driverid; /* 14:(handled by SendDriverMessage)*/ DRIVERPROC driverproc; /* 18:(handled by SendDriverMessage)*/ long x1; /* 1c: name? */ short x2; /* 20: */ long x3; /* 22: */ /* 26: */ } WINE_HIC; /* error return codes */ #define ICERR_OK 0 #define ICERR_DONTDRAW 1 #define ICERR_NEWPALETTE 2 #define ICERR_GOTOKEYFRAME 3 #define ICERR_STOPDRAWING 4 #define ICERR_UNSUPPORTED -1 #define ICERR_BADFORMAT -2 #define ICERR_MEMORY -3 #define ICERR_INTERNAL -4 #define ICERR_BADFLAGS -5 #define ICERR_BADPARAM -6 #define ICERR_BADSIZE -7 #define ICERR_BADHANDLE -8 #define ICERR_CANTUPDATE -9 #define ICERR_ABORT -10 #define ICERR_ERROR -100 #define ICERR_BADBITDEPTH -200 #define ICERR_BADIMAGESIZE -201 #define ICERR_CUSTOM -400 /* ICM Messages */ #define ICM_USER (DRV_USER+0x0000) /* ICM driver message range */ #define ICM_RESERVED_LOW (DRV_USER+0x1000) #define ICM_RESERVED_HIGH (DRV_USER+0x2000) #define ICM_RESERVED ICM_RESERVED_LOW #define ICM_GETSTATE (ICM_RESERVED+0) #define ICM_SETSTATE (ICM_RESERVED+1) #define ICM_GETINFO (ICM_RESERVED+2) #define ICM_CONFIGURE (ICM_RESERVED+10) #define ICM_ABOUT (ICM_RESERVED+11) /* */ #define ICM_GETDEFAULTQUALITY (ICM_RESERVED+30) #define ICM_GETQUALITY (ICM_RESERVED+31) #define ICM_SETQUALITY (ICM_RESERVED+32) #define ICM_SET (ICM_RESERVED+40) #define ICM_GET (ICM_RESERVED+41) /* 2 constant FOURCC codes */ #define ICM_FRAMERATE mmioFOURCC('F','r','m','R') #define ICM_KEYFRAMERATE mmioFOURCC('K','e','y','R') #define ICM_COMPRESS_GET_FORMAT (ICM_USER+4) #define ICM_COMPRESS_GET_SIZE (ICM_USER+5) #define ICM_COMPRESS_QUERY (ICM_USER+6) #define ICM_COMPRESS_BEGIN (ICM_USER+7) #define ICM_COMPRESS (ICM_USER+8) #define ICM_COMPRESS_END (ICM_USER+9) #define ICM_DECOMPRESS_GET_FORMAT (ICM_USER+10) #define ICM_DECOMPRESS_QUERY (ICM_USER+11) #define ICM_DECOMPRESS_BEGIN (ICM_USER+12) #define ICM_DECOMPRESS (ICM_USER+13) #define ICM_DECOMPRESS_END (ICM_USER+14) #define ICM_DECOMPRESS_SET_PALETTE (ICM_USER+29) #define ICM_DECOMPRESS_GET_PALETTE (ICM_USER+30) #define ICM_DRAW_QUERY (ICM_USER+31) #define ICM_DRAW_BEGIN (ICM_USER+15) #define ICM_DRAW_GET_PALETTE (ICM_USER+16) #define ICM_DRAW_START (ICM_USER+18) #define ICM_DRAW_STOP (ICM_USER+19) #define ICM_DRAW_END (ICM_USER+21) #define ICM_DRAW_GETTIME (ICM_USER+32) #define ICM_DRAW (ICM_USER+33) #define ICM_DRAW_WINDOW (ICM_USER+34) #define ICM_DRAW_SETTIME (ICM_USER+35) #define ICM_DRAW_REALIZE (ICM_USER+36) #define ICM_DRAW_FLUSH (ICM_USER+37) #define ICM_DRAW_RENDERBUFFER (ICM_USER+38) #define ICM_DRAW_START_PLAY (ICM_USER+39) #define ICM_DRAW_STOP_PLAY (ICM_USER+40) #define ICM_DRAW_SUGGESTFORMAT (ICM_USER+50) #define ICM_DRAW_CHANGEPALETTE (ICM_USER+51) #define ICM_GETBUFFERSWANTED (ICM_USER+41) #define ICM_GETDEFAULTKEYFRAMERATE (ICM_USER+42) #define ICM_DECOMPRESSEX_BEGIN (ICM_USER+60) #define ICM_DECOMPRESSEX_QUERY (ICM_USER+61) #define ICM_DECOMPRESSEX (ICM_USER+62) #define ICM_DECOMPRESSEX_END (ICM_USER+63) #define ICM_COMPRESS_FRAMES_INFO (ICM_USER+70) #define ICM_SET_STATUS_PROC (ICM_USER+72) /* structs */ typedef struct { long dwSize; /* 00: size */ long fccType; /* 04: type 'vidc' usually */ long fccHandler; /* 08: */ long dwVersion; /* 0c: version of compman opening you */ long dwFlags; /* 10: LOshort is type specific */ LRESULT dwError; /* 14: */ void* pV1Reserved; /* 18: */ void* pV2Reserved; /* 1c: */ long dnDevNode; /* 20: */ /* 24: */ } ICOPEN,*LPICOPEN; #define ICCOMPRESS_KEYFRAME 0x00000001L typedef struct { long dwFlags; LPBITMAPINFOHEADER lpbiOutput; void* lpOutput; LPBITMAPINFOHEADER lpbiInput; const void* lpInput; long* lpckid; long* lpdwFlags; long lFrameNum; long dwFrameSize; long dwQuality; LPBITMAPINFOHEADER lpbiPrev; void* lpPrev; } ICCOMPRESS; long VFWAPIV ICCompress( HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiOutput,void* lpData, LPBITMAPINFOHEADER lpbiInput,void* lpBits,long* lpckid, long* lpdwFlags,long lFrameNum,long dwFrameSize,long dwQuality, LPBITMAPINFOHEADER lpbiPrev,void* lpPrev ); #define ICCompressGetFormat(hic, lpbiInput, lpbiOutput) \ ICSendMessage( \ hic,ICM_COMPRESS_GET_FORMAT,(long)(void*)(lpbiInput), \ (long)(void*)(lpbiOutput) \ ) #define ICCompressGetFormatSize(hic,lpbi) ICCompressGetFormat(hic,lpbi,NULL) #define ICGetDefaultKeyFrameRate(hic,lpint) \ ICSendMessage( \ hic, ICM_GETDEFAULTKEYFRAMERATE, \ (long)(void*)(lpint), \ 0 ) #define ICGetDefaultQuality(hic,lpint) \ ICSendMessage( \ hic, ICM_GETDEFAULTQUALITY, \ (long)(void*)(lpint), \ 0 ) #define ICCompressBegin(hic, lpbiInput, lpbiOutput) \ ICSendMessage( \ hic, ICM_COMPRESS_BEGIN, (long)(void*)(lpbiInput), \ (long)(void*)(lpbiOutput) \ ) #define ICCompressGetSize(hic, lpbiInput, lpbiOutput) \ ICSendMessage( \ hic, ICM_COMPRESS_GET_SIZE, (long)(void*)(lpbiInput), \ (long)(void*)(lpbiOutput) \ ) #define ICCompressQuery(hic, lpbiInput, lpbiOutput) \ ICSendMessage( \ hic, ICM_COMPRESS_QUERY, (long)(void*)(lpbiInput), \ (long)(void*)(lpbiOutput) \ ) #define ICCompressEnd(hic) ICSendMessage(hic, ICM_COMPRESS_END, 0, 0) /* ICCOMPRESSFRAMES.dwFlags */ #define ICCOMPRESSFRAMES_PADDING 0x00000001 typedef struct { long dwFlags; LPBITMAPINFOHEADER lpbiOutput; LPARAM lOutput; LPBITMAPINFOHEADER lpbiInput; LPARAM lInput; long lStartFrame; long lFrameCount; long lQuality; long lDataRate; long lKeyRate; long dwRate; long dwScale; long dwOverheadPerFrame; long dwReserved2; long CALLBACK (*GetData)(LPARAM lInput,long lFrame,void* lpBits,long len); long CALLBACK (*PutData)(LPARAM lOutput,long lFrame,void* lpBits,long len); } ICCOMPRESSFRAMES; /* Values for wMode of ICOpen() */ #define ICMODE_COMPRESS 1 #define ICMODE_DECOMPRESS 2 #define ICMODE_FASTDECOMPRESS 3 #define ICMODE_QUERY 4 #define ICMODE_FASTCOMPRESS 5 #define ICMODE_DRAW 8 /* quality flags */ #define ICQUALITY_LOW 0 #define ICQUALITY_HIGH 10000 #define ICQUALITY_DEFAULT -1 typedef struct { long dwSize; /* 00: */ long fccType; /* 04:compressor type 'vidc' 'audc' */ long fccHandler; /* 08:compressor sub-type 'rle ' 'jpeg' 'pcm '*/ long dwFlags; /* 0c:flags LOshort is type specific */ long dwVersion; /* 10:version of the driver */ long dwVersionICM; /* 14:version of the ICM used */ /* * under Win32, the driver always returns UNICODE strings. */ WCHAR szName[16]; /* 18:short name */ WCHAR szDescription[128]; /* 38:long name */ WCHAR szDriver[128]; /* 138:driver that contains compressor*/ /* 238: */ } ICINFO; /* ICINFO.dwFlags */ #define VIDCF_QUALITY 0x0001 /* supports quality */ #define VIDCF_CRUNCH 0x0002 /* supports crunching to a frame size */ #define VIDCF_TEMPORAL 0x0004 /* supports inter-frame compress */ #define VIDCF_COMPRESSFRAMES 0x0008 /* wants the compress all frames message */ #define VIDCF_DRAW 0x0010 /* supports drawing */ #define VIDCF_FASTTEMPORALC 0x0020 /* does not need prev frame on compress */ #define VIDCF_FASTTEMPORALD 0x0080 /* does not need prev frame on decompress */ #define VIDCF_QUALITYTIME 0x0040 /* supports temporal quality */ #define VIDCF_FASTTEMPORAL (VIDCF_FASTTEMPORALC|VIDCF_FASTTEMPORALD) /* function shortcuts */ /* ICM_ABOUT */ #define ICMF_ABOUT_QUERY 0x00000001 #define ICQueryAbout(hic) \ (ICSendMessage(hic,ICM_ABOUT,(long)-1,ICMF_ABOUT_QUERY)==ICERR_OK) #define ICAbout(hic, hwnd) ICSendMessage(hic,ICM_ABOUT,(long)(unsigned int)(hwnd),0) /* ICM_CONFIGURE */ #define ICMF_CONFIGURE_QUERY 0x00000001 #define ICQueryConfigure(hic) \ (ICSendMessage(hic,ICM_CONFIGURE,(long)-1,ICMF_CONFIGURE_QUERY)==ICERR_OK) #define ICConfigure(hic,hwnd) \ ICSendMessage(hic,ICM_CONFIGURE,(long)(unsigned int)(hwnd),0) /* Decompression stuff */ #define ICDECOMPRESS_HURRYUP 0x80000000 /* don't draw just buffer (hurry up!) */ #define ICDECOMPRESS_UPDATE 0x40000000 /* don't draw just update screen */ #define ICDECOMPRESS_PREROL 0x20000000 /* this frame is before real start */ #define ICDECOMPRESS_NULLFRAME 0x10000000 /* repeat last frame */ #define ICDECOMPRESS_NOTKEYFRAME 0x08000000 /* this frame is not a key frame */ typedef struct { long dwFlags; /* flags (from AVI index...) */ LPBITMAPINFOHEADER lpbiInput; /* BITMAPINFO of compressed data */ const void* lpInput; /* compressed data */ LPBITMAPINFOHEADER lpbiOutput; /* DIB to decompress to */ void* lpOutput; long ckid; /* ckid from AVI file */ } ICDECOMPRESS; typedef struct { long dwFlags; LPBITMAPINFOHEADER lpbiSrc; const void* lpSrc; LPBITMAPINFOHEADER lpbiDst; void* lpDst; /* changed for ICM_DECOMPRESSEX */ INT xDst; /* destination rectangle */ INT yDst; INT dxDst; INT dyDst; INT xSrc; /* source rectangle */ INT ySrc; INT dxSrc; INT dySrc; } ICDECOMPRESSEX; long VFWAPIV ICDecompress(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits); #define ICDecompressBegin(hic, lpbiInput, lpbiOutput) \ ICSendMessage( \ hic, ICM_DECOMPRESS_BEGIN, (long)(void*)(lpbiInput), \ (long)(void*)(lpbiOutput) \ ) #define ICDecompressQuery(hic, lpbiInput, lpbiOutput) \ ICSendMessage( \ hic,ICM_DECOMPRESS_QUERY, (long)(void*)(lpbiInput), \ (long) (void*)(lpbiOutput) \ ) #define ICDecompressGetFormat(hic, lpbiInput, lpbiOutput) \ ((long)ICSendMessage( \ hic,ICM_DECOMPRESS_GET_FORMAT, (long)(void*)(lpbiInput), \ (long)(void*)(lpbiOutput) \ )) #define ICDecompressGetFormatSize(hic, lpbi) \ ICDecompressGetFormat(hic, lpbi, NULL) #define ICDecompressGetPalette(hic, lpbiInput, lpbiOutput) \ ICSendMessage( \ hic, ICM_DECOMPRESS_GET_PALETTE, (long)(void*)(lpbiInput), \ (long)(void*)(lpbiOutput) \ ) #define ICDecompressSetPalette(hic,lpbiPalette) \ ICSendMessage( \ hic,ICM_DECOMPRESS_SET_PALETTE, \ (long)(void*)(lpbiPalette),0 \ ) #define ICDecompressEnd(hic) ICSendMessage(hic, ICM_DECOMPRESS_END, 0, 0) #define ICDRAW_QUERY 0x00000001L /* test for support */ #define ICDRAW_FULLSCREEN 0x00000002L /* draw to full screen */ #define ICDRAW_HDC 0x00000004L /* draw to a HDC/HWND */ LRESULT VFWAPI ICClose(HIC hic); int VFWAPI ICSendMessage(HIC hic, unsigned int msg, long dw1, long dw2); #define ICDRAW_HURRYUP 0x80000000L /* don't draw just buffer (hurry up!) */ #define ICDRAW_UPDATE 0x40000000L /* don't draw just update screen */ #define ICDRAW_PREROLL 0x20000000L /* this frame is before real start */ #define ICDRAW_NULLFRAME 0x10000000L /* repeat last frame */ #define ICDRAW_NOTKEYFRAME 0x08000000L /* this frame is not a key frame */ typedef struct { long dwFlags; void* lpFormat; void* lpData; long cbData; long lTime; } ICDRAW; #define AVIGETFRAMEF_BESTDISPLAYFMT 1 typedef struct _AVISTREAMINFOA { long fccType; long fccHandler; long dwFlags; /* AVIIF_* */ long dwCaps; short wPriority; short wLanguage; long dwScale; long dwRate; /* dwRate / dwScale == samples/second */ long dwStart; long dwLength; /* In units above... */ long dwInitialFrames; long dwSuggestedBufferSize; long dwQuality; long dwSampleSize; RECT rcFrame; long dwEditCount; long dwFormatChangeCount; char szName[64]; } AVISTREAMINFOA, * LPAVISTREAMINFOA, *PAVISTREAMINFOA; typedef struct _AVISTREAMINFOW { long fccType; long fccHandler; long dwFlags; long dwCaps; short wPriority; short wLanguage; long dwScale; long dwRate; /* dwRate / dwScale == samples/second */ long dwStart; long dwLength; /* In units above... */ long dwInitialFrames; long dwSuggestedBufferSize; long dwQuality; long dwSampleSize; RECT rcFrame; long dwEditCount; long dwFormatChangeCount; short szName[64]; } AVISTREAMINFOW, * LPAVISTREAMINFOW, *PAVISTREAMINFOW; DECL_WINELIB_TYPE_AW(AVISTREAMINFO) DECL_WINELIB_TYPE_AW(LPAVISTREAMINFO) DECL_WINELIB_TYPE_AW(PAVISTREAMINFO) #define AVISTREAMINFO_DISABLED 0x00000001 #define AVISTREAMINFO_FORMATCHANGES 0x00010000 /* AVIFILEINFO.dwFlags */ #define AVIFILEINFO_HASINDEX 0x00000010 #define AVIFILEINFO_MUSTUSEINDEX 0x00000020 #define AVIFILEINFO_ISINTERLEAVED 0x00000100 #define AVIFILEINFO_WASCAPTUREFILE 0x00010000 #define AVIFILEINFO_COPYRIGHTED 0x00020000 /* AVIFILEINFO.dwCaps */ #define AVIFILECAPS_CANREAD 0x00000001 #define AVIFILECAPS_CANWRITE 0x00000002 #define AVIFILECAPS_ALLKEYFRAMES 0x00000010 #define AVIFILECAPS_NOCOMPRESSION 0x00000020 typedef struct _AVIFILEINFOW { long dwMaxBytesPerSec; long dwFlags; long dwCaps; long dwStreams; long dwSuggestedBufferSize; long dwWidth; long dwHeight; long dwScale; long dwRate; long dwLength; long dwEditCount; short szFileType[64]; } AVIFILEINFOW, * LPAVIFILEINFOW, *PAVIFILEINFOW; typedef struct _AVIFILEINFOA { long dwMaxBytesPerSec; long dwFlags; long dwCaps; long dwStreams; long dwSuggestedBufferSize; long dwWidth; long dwHeight; long dwScale; long dwRate; long dwLength; long dwEditCount; char szFileType[64]; } AVIFILEINFOA, * LPAVIFILEINFOA, *PAVIFILEINFOA; DECL_WINELIB_TYPE_AW(AVIFILEINFO) DECL_WINELIB_TYPE_AW(PAVIFILEINFO) DECL_WINELIB_TYPE_AW(LPAVIFILEINFO) /* AVICOMPRESSOPTIONS.dwFlags. determines presence of fields in below struct */ #define AVICOMPRESSF_INTERLEAVE 0x00000001 #define AVICOMPRESSF_DATARATE 0x00000002 #define AVICOMPRESSF_KEYFRAMES 0x00000004 #define AVICOMPRESSF_VALID 0x00000008 typedef struct { long fccType; /* stream type, for consistency */ long fccHandler; /* compressor */ long dwKeyFrameEvery; /* keyframe rate */ long dwQuality; /* compress quality 0-10,000 */ long dwBytesPerSecond; /* unsigned chars per second */ long dwFlags; /* flags... see below */ void* lpFormat; /* save format */ long cbFormat; void* lpParms; /* compressor options */ long cbParms; long dwInterleaveEvery; /* for non-video streams only */ } AVICOMPRESSOPTIONS, *LPAVICOMPRESSOPTIONS,*PAVICOMPRESSOPTIONS; typedef struct { long cbSize; // set to sizeof(COMPVARS) before // calling ICCompressorChoose long dwFlags; // see below... HIC hic; // HIC of chosen compressor long fccType; // basically ICTYPE_VIDEO long fccHandler; // handler of chosen compressor or // "" or "DIB " LPBITMAPINFO lpbiIn; // input format LPBITMAPINFO lpbiOut; // output format - will compress to this void* lpBitsOut; void* lpBitsPrev; long lFrame; long lKey; // key frames how often? long lDataRate; // desired data rate KB/Sec long lQ; // desired quality long lKeyCount; void* lpState; // state of compressor long cbState; // size of the state } COMPVARS, *PCOMPVARS; // FLAGS for dwFlags element of COMPVARS structure: #define AVIERR_OK 0 #define MAKE_AVIERR(error) MAKE_SCODE(SEVERITY_ERROR,FACILITY_ITF,0x4000+error) #define AVIERR_UNSUPPORTED MAKE_AVIERR(101) #define AVIERR_BADFORMAT MAKE_AVIERR(102) #define AVIERR_MEMORY MAKE_AVIERR(103) #define AVIERR_INTERNAL MAKE_AVIERR(104) #define AVIERR_BADFLAGS MAKE_AVIERR(105) #define AVIERR_BADPARAM MAKE_AVIERR(106) #define AVIERR_BADSIZE MAKE_AVIERR(107) #define AVIERR_BADHANDLE MAKE_AVIERR(108) #define AVIERR_FILEREAD MAKE_AVIERR(109) #define AVIERR_FILEWRITE MAKE_AVIERR(110) #define AVIERR_FILEOPEN MAKE_AVIERR(111) #define AVIERR_COMPRESSOR MAKE_AVIERR(112) #define AVIERR_NOCOMPRESSOR MAKE_AVIERR(113) #define AVIERR_READONLY MAKE_AVIERR(114) #define AVIERR_NODATA MAKE_AVIERR(115) #define AVIERR_BUFFERTOOSMALL MAKE_AVIERR(116) #define AVIERR_CANTCOMPRESS MAKE_AVIERR(117) #define AVIERR_USERABORT MAKE_AVIERR(198) #define AVIERR_ERROR MAKE_AVIERR(199) #ifdef __cplusplus } #endif #endif /* __WINE_VFW_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/winbase.h0000644000175000017500000021536607377233443023115 0ustar yavoryavor#ifndef __WINE_WINBASE_H #define __WINE_WINBASE_H #include "basetsd.h" #include "winnt.h" #include "winestring.h" #include "pshpack1.h" #ifdef __cplusplus extern "C" { #endif typedef struct tagCOORD { INT16 x; INT16 y; } COORD, *LPCOORD; /* Windows Exit Procedure flag values */ #define WEP_FREE_DLL 0 #define WEP_SYSTEM_EXIT 1 typedef DWORD CALLBACK (*LPTHREAD_START_ROUTINE)(LPVOID); #define EXCEPTION_DEBUG_EVENT 1 #define CREATE_THREAD_DEBUG_EVENT 2 #define CREATE_PROCESS_DEBUG_EVENT 3 #define EXIT_THREAD_DEBUG_EVENT 4 #define EXIT_PROCESS_DEBUG_EVENT 5 #define LOAD_DLL_DEBUG_EVENT 6 #define UNLOAD_DLL_DEBUG_EVENT 7 #define OUTPUT_DEBUG_STRING_EVENT 8 #define RIP_EVENT 9 typedef struct _EXCEPTION_DEBUG_INFO { EXCEPTION_RECORD ExceptionRecord; DWORD dwFirstChance; } EXCEPTION_DEBUG_INFO; typedef struct _CREATE_THREAD_DEBUG_INFO { HANDLE hThread; LPVOID lpThreadLocalBase; LPTHREAD_START_ROUTINE lpStartAddress; } CREATE_THREAD_DEBUG_INFO; typedef struct _CREATE_PROCESS_DEBUG_INFO { HANDLE hFile; HANDLE hProcess; HANDLE hThread; LPVOID lpBaseOfImage; DWORD dwDebugInfoFileOffset; DWORD nDebugInfoSize; LPVOID lpThreadLocalBase; LPTHREAD_START_ROUTINE lpStartAddress; LPVOID lpImageName; WORD fUnicode; } CREATE_PROCESS_DEBUG_INFO; typedef struct _EXIT_THREAD_DEBUG_INFO { DWORD dwExitCode; } EXIT_THREAD_DEBUG_INFO; typedef struct _EXIT_PROCESS_DEBUG_INFO { DWORD dwExitCode; } EXIT_PROCESS_DEBUG_INFO; typedef struct _LOAD_DLL_DEBUG_INFO { HANDLE hFile; LPVOID lpBaseOfDll; DWORD dwDebugInfoFileOffset; DWORD nDebugInfoSize; LPVOID lpImageName; WORD fUnicode; } LOAD_DLL_DEBUG_INFO; typedef struct _UNLOAD_DLL_DEBUG_INFO { LPVOID lpBaseOfDll; } UNLOAD_DLL_DEBUG_INFO; typedef struct _OUTPUT_DEBUG_STRING_INFO { LPSTR lpDebugStringData; WORD fUnicode; WORD nDebugStringLength; } OUTPUT_DEBUG_STRING_INFO; typedef struct _RIP_INFO { DWORD dwError; DWORD dwType; } RIP_INFO; typedef struct _DEBUG_EVENT { DWORD dwDebugEventCode; DWORD dwProcessId; DWORD dwThreadId; union { EXCEPTION_DEBUG_INFO Exception; CREATE_THREAD_DEBUG_INFO CreateThread; CREATE_PROCESS_DEBUG_INFO CreateProcessInfo; EXIT_THREAD_DEBUG_INFO ExitThread; EXIT_PROCESS_DEBUG_INFO ExitProcess; LOAD_DLL_DEBUG_INFO LoadDll; UNLOAD_DLL_DEBUG_INFO UnloadDll; OUTPUT_DEBUG_STRING_INFO DebugString; RIP_INFO RipInfo; } u; } DEBUG_EVENT, *LPDEBUG_EVENT; #define OFS_MAXPATHNAME 128 typedef struct { BYTE cBytes; BYTE fFixedDisk; WORD nErrCode; BYTE reserved[4]; BYTE szPathName[OFS_MAXPATHNAME]; } OFSTRUCT, *LPOFSTRUCT; #define OF_READ 0x0000 #define OF_WRITE 0x0001 #define OF_READWRITE 0x0002 #define OF_SHARE_COMPAT 0x0000 #define OF_SHARE_EXCLUSIVE 0x0010 #define OF_SHARE_DENY_WRITE 0x0020 #define OF_SHARE_DENY_READ 0x0030 #define OF_SHARE_DENY_NONE 0x0040 #define OF_PARSE 0x0100 #define OF_DELETE 0x0200 #define OF_VERIFY 0x0400 /* Used with OF_REOPEN */ #define OF_SEARCH 0x0400 /* Used without OF_REOPEN */ #define OF_CANCEL 0x0800 #define OF_CREATE 0x1000 #define OF_PROMPT 0x2000 #define OF_EXIST 0x4000 #define OF_REOPEN 0x8000 /* SetErrorMode values */ #define SEM_FAILCRITICALERRORS 0x0001 #define SEM_NOGPFAULTERRORBOX 0x0002 #define SEM_NOALIGNMENTFAULTEXCEPT 0x0004 #define SEM_NOOPENFILEERRORBOX 0x8000 /* CopyFileEx flags */ #define COPY_FILE_FAIL_IF_EXISTS 0x00000001 #define COPY_FILE_RESTARTABLE 0x00000002 #define COPY_FILE_OPEN_SOURCE_FOR_WRITE 0x00000004 /* GetTempFileName() Flags */ #define TF_FORCEDRIVE 0x80 #define DRIVE_CANNOTDETERMINE 0 #define DRIVE_DOESNOTEXIST 1 #define DRIVE_REMOVABLE 2 #define DRIVE_FIXED 3 #define DRIVE_REMOTE 4 /* Win32 additions */ #define DRIVE_CDROM 5 #define DRIVE_RAMDISK 6 /* The security attributes structure */ typedef struct _SECURITY_ATTRIBUTES { DWORD nLength; LPVOID lpSecurityDescriptor; WIN_BOOL bInheritHandle; } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; #ifndef _FILETIME_ #define _FILETIME_ /* 64 bit number of 100 nanoseconds intervals since January 1, 1601 */ typedef struct { DWORD dwLowDateTime; DWORD dwHighDateTime; } FILETIME, *LPFILETIME; #endif /* _FILETIME_ */ /* Find* structures */ typedef struct { DWORD dwFileAttributes; FILETIME ftCreationTime; FILETIME ftLastAccessTime; FILETIME ftLastWriteTime; DWORD nFileSizeHigh; DWORD nFileSizeLow; DWORD dwReserved0; DWORD dwReserved1; CHAR cFileName[260]; CHAR cAlternateFileName[14]; } WIN32_FIND_DATAA, *LPWIN32_FIND_DATAA; typedef struct { DWORD dwFileAttributes; FILETIME ftCreationTime; FILETIME ftLastAccessTime; FILETIME ftLastWriteTime; DWORD nFileSizeHigh; DWORD nFileSizeLow; DWORD dwReserved0; DWORD dwReserved1; WCHAR cFileName[260]; WCHAR cAlternateFileName[14]; } WIN32_FIND_DATAW, *LPWIN32_FIND_DATAW; DECL_WINELIB_TYPE_AW(WIN32_FIND_DATA) DECL_WINELIB_TYPE_AW(LPWIN32_FIND_DATA) typedef struct { LPVOID lpData; DWORD cbData; BYTE cbOverhead; BYTE iRegionIndex; WORD wFlags; union { struct { HANDLE hMem; DWORD dwReserved[3]; } Block; struct { DWORD dwCommittedSize; DWORD dwUnCommittedSize; LPVOID lpFirstBlock; LPVOID lpLastBlock; } Region; } Foo; } PROCESS_HEAP_ENTRY, *LPPROCESS_HEAP_ENTRY; #define PROCESS_HEAP_REGION 0x0001 #define PROCESS_HEAP_UNCOMMITTED_RANGE 0x0002 #define PROCESS_HEAP_ENTRY_BUSY 0x0004 #define PROCESS_HEAP_ENTRY_MOVEABLE 0x0010 #define PROCESS_HEAP_ENTRY_DDESHARE 0x0020 #define INVALID_HANDLE_VALUE16 ((HANDLE16) -1) #define INVALID_HANDLE_VALUE ((HANDLE) -1) #define TLS_OUT_OF_INDEXES ((DWORD)0xFFFFFFFF) /* comm */ #define CBR_110 0xFF10 #define CBR_300 0xFF11 #define CBR_600 0xFF12 #define CBR_1200 0xFF13 #define CBR_2400 0xFF14 #define CBR_4800 0xFF15 #define CBR_9600 0xFF16 #define CBR_14400 0xFF17 #define CBR_19200 0xFF18 #define CBR_38400 0xFF1B #define CBR_56000 0xFF1F #define CBR_128000 0xFF23 #define CBR_256000 0xFF27 #define NOPARITY 0 #define ODDPARITY 1 #define EVENPARITY 2 #define MARKPARITY 3 #define SPACEPARITY 4 #define ONESTOPBIT 0 #define ONE5STOPBITS 1 #define TWOSTOPBITS 2 #define IGNORE 0 #define INFINITE16 0xFFFF #define INFINITE 0xFFFFFFFF #define CE_RXOVER 0x0001 #define CE_OVERRUN 0x0002 #define CE_RXPARITY 0x0004 #define CE_FRAME 0x0008 #define CE_BREAK 0x0010 #define CE_CTSTO 0x0020 #define CE_DSRTO 0x0040 #define CE_RLSDTO 0x0080 #define CE_TXFULL 0x0100 #define CE_PTO 0x0200 #define CE_IOE 0x0400 #define CE_DNS 0x0800 #define CE_OOP 0x1000 #define CE_MODE 0x8000 #define IE_BADID -1 #define IE_OPEN -2 #define IE_NOPEN -3 #define IE_MEMORY -4 #define IE_DEFAULT -5 #define IE_HARDWARE -10 #define IE_BYTESIZE -11 #define IE_BAUDRATE -12 #define EV_RXCHAR 0x0001 #define EV_RXFLAG 0x0002 #define EV_TXEMPTY 0x0004 #define EV_CTS 0x0008 #define EV_DSR 0x0010 #define EV_RLSD 0x0020 #define EV_BREAK 0x0040 #define EV_ERR 0x0080 #define EV_RING 0x0100 #define EV_PERR 0x0200 #define EV_CTSS 0x0400 #define EV_DSRS 0x0800 #define EV_RLSDS 0x1000 #define EV_RINGTE 0x2000 #define EV_RingTe EV_RINGTE #define SETXOFF 1 #define SETXON 2 #define SETRTS 3 #define CLRRTS 4 #define SETDTR 5 #define CLRDTR 6 #define RESETDEV 7 #define SETBREAK 8 #define CLRBREAK 9 #define GETBASEIRQ 10 /* Purge functions for Comm Port */ #define PURGE_TXABORT 0x0001 /* Kill the pending/current writes to the comm port */ #define PURGE_RXABORT 0x0002 /*Kill the pending/current reads to the comm port */ #define PURGE_TXCLEAR 0x0004 /* Kill the transmit queue if there*/ #define PURGE_RXCLEAR 0x0008 /* Kill the typeahead buffer if there*/ /* Modem Status Flags */ #define MS_CTS_ON ((DWORD)0x0010) #define MS_DSR_ON ((DWORD)0x0020) #define MS_RING_ON ((DWORD)0x0040) #define MS_RLSD_ON ((DWORD)0x0080) #define RTS_CONTROL_DISABLE 0 #define RTS_CONTROL_ENABLE 1 #define RTS_CONTROL_HANDSHAKE 2 #define RTS_CONTROL_TOGGLE 3 #define DTR_CONTROL_DISABLE 0 #define DTR_CONTROL_ENABLE 1 #define DTR_CONTROL_HANDSHAKE 2 #define CSTF_CTSHOLD 0x01 #define CSTF_DSRHOLD 0x02 #define CSTF_RLSDHOLD 0x04 #define CSTF_XOFFHOLD 0x08 #define CSTF_XOFFSENT 0x10 #define CSTF_EOF 0x20 #define CSTF_TXIM 0x40 #define MAKEINTRESOURCEA(i) (LPSTR)((DWORD)((WORD)(i))) #define MAKEINTRESOURCEW(i) (LPWSTR)((DWORD)((WORD)(i))) #define MAKEINTRESOURCE WINELIB_NAME_AW(MAKEINTRESOURCE) /* Predefined resource types */ #define RT_CURSORA MAKEINTRESOURCEA(1) #define RT_CURSORW MAKEINTRESOURCEW(1) #define RT_CURSOR WINELIB_NAME_AW(RT_CURSOR) #define RT_BITMAPA MAKEINTRESOURCEA(2) #define RT_BITMAPW MAKEINTRESOURCEW(2) #define RT_BITMAP WINELIB_NAME_AW(RT_BITMAP) #define RT_ICONA MAKEINTRESOURCEA(3) #define RT_ICONW MAKEINTRESOURCEW(3) #define RT_ICON WINELIB_NAME_AW(RT_ICON) #define RT_MENUA MAKEINTRESOURCEA(4) #define RT_MENUW MAKEINTRESOURCEW(4) #define RT_MENU WINELIB_NAME_AW(RT_MENU) #define RT_DIALOGA MAKEINTRESOURCEA(5) #define RT_DIALOGW MAKEINTRESOURCEW(5) #define RT_DIALOG WINELIB_NAME_AW(RT_DIALOG) #define RT_STRINGA MAKEINTRESOURCEA(6) #define RT_STRINGW MAKEINTRESOURCEW(6) #define RT_STRING WINELIB_NAME_AW(RT_STRING) #define RT_FONTDIRA MAKEINTRESOURCEA(7) #define RT_FONTDIRW MAKEINTRESOURCEW(7) #define RT_FONTDIR WINELIB_NAME_AW(RT_FONTDIR) #define RT_FONTA MAKEINTRESOURCEA(8) #define RT_FONTW MAKEINTRESOURCEW(8) #define RT_FONT WINELIB_NAME_AW(RT_FONT) #define RT_ACCELERATORA MAKEINTRESOURCEA(9) #define RT_ACCELERATORW MAKEINTRESOURCEW(9) #define RT_ACCELERATOR WINELIB_NAME_AW(RT_ACCELERATOR) #define RT_RCDATAA MAKEINTRESOURCEA(10) #define RT_RCDATAW MAKEINTRESOURCEW(10) #define RT_RCDATA WINELIB_NAME_AW(RT_RCDATA) #define RT_MESSAGELISTA MAKEINTRESOURCEA(11) #define RT_MESSAGELISTW MAKEINTRESOURCEW(11) #define RT_MESSAGELIST WINELIB_NAME_AW(RT_MESSAGELIST) #define RT_GROUP_CURSORA MAKEINTRESOURCEA(12) #define RT_GROUP_CURSORW MAKEINTRESOURCEW(12) #define RT_GROUP_CURSOR WINELIB_NAME_AW(RT_GROUP_CURSOR) #define RT_GROUP_ICONA MAKEINTRESOURCEA(14) #define RT_GROUP_ICONW MAKEINTRESOURCEW(14) #define RT_GROUP_ICON WINELIB_NAME_AW(RT_GROUP_ICON) #define LMEM_FIXED 0 #define LMEM_MOVEABLE 0x0002 #define LMEM_NOCOMPACT 0x0010 #define LMEM_NODISCARD 0x0020 #define LMEM_ZEROINIT 0x0040 #define LMEM_MODIFY 0x0080 #define LMEM_DISCARDABLE 0x0F00 #define LMEM_DISCARDED 0x4000 #define LMEM_LOCKCOUNT 0x00FF #define LPTR (LMEM_FIXED | LMEM_ZEROINIT) #define GMEM_FIXED 0x0000 #define GMEM_MOVEABLE 0x0002 #define GMEM_NOCOMPACT 0x0010 #define GMEM_NODISCARD 0x0020 #define GMEM_ZEROINIT 0x0040 #define GMEM_MODIFY 0x0080 #define GMEM_DISCARDABLE 0x0100 #define GMEM_NOT_BANKED 0x1000 #define GMEM_SHARE 0x2000 #define GMEM_DDESHARE 0x2000 #define GMEM_NOTIFY 0x4000 #define GMEM_LOWER GMEM_NOT_BANKED #define GMEM_DISCARDED 0x4000 #define GMEM_LOCKCOUNT 0x00ff #define GMEM_INVALID_HANDLE 0x8000 #define GHND (GMEM_MOVEABLE | GMEM_ZEROINIT) #define GPTR (GMEM_FIXED | GMEM_ZEROINIT) typedef struct tagMEMORYSTATUS { DWORD dwLength; DWORD dwMemoryLoad; DWORD dwTotalPhys; DWORD dwAvailPhys; DWORD dwTotalPageFile; DWORD dwAvailPageFile; DWORD dwTotalVirtual; DWORD dwAvailVirtual; } MEMORYSTATUS, *LPMEMORYSTATUS; #ifndef NOLOGERROR /* LogParamError and LogError values */ /* Error modifier bits */ #define ERR_WARNING 0x8000 #define ERR_PARAM 0x4000 #define ERR_SIZE_MASK 0x3000 #define ERR_BYTE 0x1000 #define ERR_WORD 0x2000 #define ERR_DWORD 0x3000 /* LogParamError() values */ /* Generic parameter values */ #define ERR_BAD_VALUE 0x6001 #define ERR_BAD_FLAGS 0x6002 #define ERR_BAD_INDEX 0x6003 #define ERR_BAD_DVALUE 0x7004 #define ERR_BAD_DFLAGS 0x7005 #define ERR_BAD_DINDEX 0x7006 #define ERR_BAD_PTR 0x7007 #define ERR_BAD_FUNC_PTR 0x7008 #define ERR_BAD_SELECTOR 0x6009 #define ERR_BAD_STRING_PTR 0x700a #define ERR_BAD_HANDLE 0x600b /* KERNEL parameter errors */ #define ERR_BAD_HINSTANCE 0x6020 #define ERR_BAD_HMODULE 0x6021 #define ERR_BAD_GLOBAL_HANDLE 0x6022 #define ERR_BAD_LOCAL_HANDLE 0x6023 #define ERR_BAD_ATOM 0x6024 #define ERR_BAD_HFILE 0x6025 /* USER parameter errors */ #define ERR_BAD_HWND 0x6040 #define ERR_BAD_HMENU 0x6041 #define ERR_BAD_HCURSOR 0x6042 #define ERR_BAD_HICON 0x6043 #define ERR_BAD_HDWP 0x6044 #define ERR_BAD_CID 0x6045 #define ERR_BAD_HDRVR 0x6046 /* GDI parameter errors */ #define ERR_BAD_COORDS 0x7060 #define ERR_BAD_GDI_OBJECT 0x6061 #define ERR_BAD_HDC 0x6062 #define ERR_BAD_HPEN 0x6063 #define ERR_BAD_HFONT 0x6064 #define ERR_BAD_HBRUSH 0x6065 #define ERR_BAD_HBITMAP 0x6066 #define ERR_BAD_HRGN 0x6067 #define ERR_BAD_HPALETTE 0x6068 #define ERR_BAD_HMETAFILE 0x6069 /* LogError() values */ /* KERNEL errors */ #define ERR_GALLOC 0x0001 #define ERR_GREALLOC 0x0002 #define ERR_GLOCK 0x0003 #define ERR_LALLOC 0x0004 #define ERR_LREALLOC 0x0005 #define ERR_LLOCK 0x0006 #define ERR_ALLOCRES 0x0007 #define ERR_LOCKRES 0x0008 #define ERR_LOADMODULE 0x0009 /* USER errors */ #define ERR_CREATEDLG 0x0040 #define ERR_CREATEDLG2 0x0041 #define ERR_REGISTERCLASS 0x0042 #define ERR_DCBUSY 0x0043 #define ERR_CREATEWND 0x0044 #define ERR_STRUCEXTRA 0x0045 #define ERR_LOADSTR 0x0046 #define ERR_LOADMENU 0x0047 #define ERR_NESTEDBEGINPAINT 0x0048 #define ERR_BADINDEX 0x0049 #define ERR_CREATEMENU 0x004a /* GDI errors */ #define ERR_CREATEDC 0x0080 #define ERR_CREATEMETA 0x0081 #define ERR_DELOBJSELECTED 0x0082 #define ERR_SELBITMAP 0x0083 /* Debugging support (DEBUG SYSTEM ONLY) */ typedef struct { UINT16 flags; DWORD dwOptions WINE_PACKED; DWORD dwFilter WINE_PACKED; CHAR achAllocModule[8] WINE_PACKED; DWORD dwAllocBreak WINE_PACKED; DWORD dwAllocCount WINE_PACKED; } WINDEBUGINFO, *LPWINDEBUGINFO; /* WINDEBUGINFO flags values */ #define WDI_OPTIONS 0x0001 #define WDI_FILTER 0x0002 #define WDI_ALLOCBREAK 0x0004 /* dwOptions values */ #define DBO_CHECKHEAP 0x0001 #define DBO_BUFFERFILL 0x0004 #define DBO_DISABLEGPTRAPPING 0x0010 #define DBO_CHECKFREE 0x0020 #define DBO_SILENT 0x8000 #define DBO_TRACEBREAK 0x2000 #define DBO_WARNINGBREAK 0x1000 #define DBO_NOERRORBREAK 0x0800 #define DBO_NOFATALBREAK 0x0400 #define DBO_INT3BREAK 0x0100 /* DebugOutput flags values */ #define DBF_TRACE 0x0000 #define DBF_WARNING 0x4000 #define DBF_ERROR 0x8000 #define DBF_FATAL 0xc000 /* dwFilter values */ #define DBF_KERNEL 0x1000 #define DBF_KRN_MEMMAN 0x0001 #define DBF_KRN_LOADMODULE 0x0002 #define DBF_KRN_SEGMENTLOAD 0x0004 #define DBF_USER 0x0800 #define DBF_GDI 0x0400 #define DBF_MMSYSTEM 0x0040 #define DBF_PENWIN 0x0020 #define DBF_APPLICATION 0x0008 #define DBF_DRIVER 0x0010 #endif /* NOLOGERROR */ typedef struct { WORD wYear; WORD wMonth; WORD wDayOfWeek; WORD wDay; WORD wHour; WORD wMinute; WORD wSecond; WORD wMilliseconds; } SYSTEMTIME, *LPSYSTEMTIME; /* The 'overlapped' data structure used by async I/O functions. */ typedef struct { DWORD Internal; DWORD InternalHigh; DWORD Offset; DWORD OffsetHigh; HANDLE hEvent; } OVERLAPPED, *LPOVERLAPPED; /* Process startup information. */ /* STARTUPINFO.dwFlags */ #define STARTF_USESHOWWINDOW 0x00000001 #define STARTF_USESIZE 0x00000002 #define STARTF_USEPOSITION 0x00000004 #define STARTF_USECOUNTCHARS 0x00000008 #define STARTF_USEFILLATTRIBUTE 0x00000010 #define STARTF_RUNFULLSCREEN 0x00000020 #define STARTF_FORCEONFEEDBACK 0x00000040 #define STARTF_FORCEOFFFEEDBACK 0x00000080 #define STARTF_USESTDHANDLES 0x00000100 #define STARTF_USEHOTKEY 0x00000200 typedef struct { DWORD cb; /* 00: size of struct */ LPSTR lpReserved; /* 04: */ LPSTR lpDesktop; /* 08: */ LPSTR lpTitle; /* 0c: */ DWORD dwX; /* 10: */ DWORD dwY; /* 14: */ DWORD dwXSize; /* 18: */ DWORD dwYSize; /* 1c: */ DWORD dwXCountChars; /* 20: */ DWORD dwYCountChars; /* 24: */ DWORD dwFillAttribute; /* 28: */ DWORD dwFlags; /* 2c: */ WORD wShowWindow; /* 30: */ WORD cbReserved2; /* 32: */ BYTE *lpReserved2; /* 34: */ HANDLE hStdInput; /* 38: */ HANDLE hStdOutput; /* 3c: */ HANDLE hStdError; /* 40: */ } STARTUPINFOA, *LPSTARTUPINFOA; typedef struct { DWORD cb; LPWSTR lpReserved; LPWSTR lpDesktop; LPWSTR lpTitle; DWORD dwX; DWORD dwY; DWORD dwXSize; DWORD dwYSize; DWORD dwXCountChars; DWORD dwYCountChars; DWORD dwFillAttribute; DWORD dwFlags; WORD wShowWindow; WORD cbReserved2; BYTE *lpReserved2; HANDLE hStdInput; HANDLE hStdOutput; HANDLE hStdError; } STARTUPINFOW, *LPSTARTUPINFOW; DECL_WINELIB_TYPE_AW(STARTUPINFO) DECL_WINELIB_TYPE_AW(LPSTARTUPINFO) typedef struct { HANDLE hProcess; HANDLE hThread; DWORD dwProcessId; DWORD dwThreadId; } PROCESS_INFORMATION,*LPPROCESS_INFORMATION; typedef struct { LONG Bias; WCHAR StandardName[32]; SYSTEMTIME StandardDate; LONG StandardBias; WCHAR DaylightName[32]; SYSTEMTIME DaylightDate; LONG DaylightBias; } TIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION; #define TIME_ZONE_ID_UNKNOWN 0 #define TIME_ZONE_ID_STANDARD 1 #define TIME_ZONE_ID_DAYLIGHT 2 /* CreateProcess: dwCreationFlag values */ #define DEBUG_PROCESS 0x00000001 #define DEBUG_ONLY_THIS_PROCESS 0x00000002 #define CREATE_SUSPENDED 0x00000004 #define DETACHED_PROCESS 0x00000008 #define CREATE_NEW_CONSOLE 0x00000010 #define NORMAL_PRIORITY_CLASS 0x00000020 #define IDLE_PRIORITY_CLASS 0x00000040 #define HIGH_PRIORITY_CLASS 0x00000080 #define REALTIME_PRIORITY_CLASS 0x00000100 #define CREATE_NEW_PROCESS_GROUP 0x00000200 #define CREATE_UNICODE_ENVIRONMENT 0x00000400 #define CREATE_SEPARATE_WOW_VDM 0x00000800 #define CREATE_SHARED_WOW_VDM 0x00001000 #define CREATE_DEFAULT_ERROR_MODE 0x04000000 #define CREATE_NO_WINDOW 0x08000000 #define PROFILE_USER 0x10000000 #define PROFILE_KERNEL 0x20000000 #define PROFILE_SERVER 0x40000000 /* File object type definitions */ #define FILE_TYPE_UNKNOWN 0 #define FILE_TYPE_DISK 1 #define FILE_TYPE_CHAR 2 #define FILE_TYPE_PIPE 3 #define FILE_TYPE_REMOTE 32768 /* File creation flags */ #define FILE_FLAG_WRITE_THROUGH 0x80000000UL #define FILE_FLAG_OVERLAPPED 0x40000000L #define FILE_FLAG_NO_BUFFERING 0x20000000L #define FILE_FLAG_RANDOM_ACCESS 0x10000000L #define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000L #define FILE_FLAG_DELETE_ON_CLOSE 0x04000000L #define FILE_FLAG_BACKUP_SEMANTICS 0x02000000L #define FILE_FLAG_POSIX_SEMANTICS 0x01000000L #define CREATE_NEW 1 #define CREATE_ALWAYS 2 #define OPEN_EXISTING 3 #define OPEN_ALWAYS 4 #define TRUNCATE_EXISTING 5 /* Standard handle identifiers */ #define STD_INPUT_HANDLE ((DWORD) -10) #define STD_OUTPUT_HANDLE ((DWORD) -11) #define STD_ERROR_HANDLE ((DWORD) -12) typedef struct { int dwFileAttributes; FILETIME ftCreationTime; FILETIME ftLastAccessTime; FILETIME ftLastWriteTime; int dwVolumeSerialNumber; int nFileSizeHigh; int nFileSizeLow; int nNumberOfLinks; int nFileIndexHigh; int nFileIndexLow; } BY_HANDLE_FILE_INFORMATION ; typedef struct _SYSTEM_POWER_STATUS { WIN_BOOL16 ACLineStatus; BYTE BatteryFlag; BYTE BatteryLifePercent; BYTE reserved; DWORD BatteryLifeTime; DWORD BatteryFullLifeTime; } SYSTEM_POWER_STATUS, *LPSYSTEM_POWER_STATUS; typedef struct _MEMORY_BASIC_INFORMATION { LPVOID BaseAddress; LPVOID AllocationBase; DWORD AllocationProtect; DWORD RegionSize; DWORD State; DWORD Protect; DWORD Type; } MEMORY_BASIC_INFORMATION,*LPMEMORY_BASIC_INFORMATION; typedef WIN_BOOL CALLBACK (*CODEPAGE_ENUMPROCA)(LPSTR); typedef WIN_BOOL CALLBACK (*CODEPAGE_ENUMPROCW)(LPWSTR); DECL_WINELIB_TYPE_AW(CODEPAGE_ENUMPROC) typedef WIN_BOOL CALLBACK (*LOCALE_ENUMPROCA)(LPSTR); typedef WIN_BOOL CALLBACK (*LOCALE_ENUMPROCW)(LPWSTR); DECL_WINELIB_TYPE_AW(LOCALE_ENUMPROC) typedef struct tagSYSTEM_INFO { union { DWORD dwOemId; /* Obsolete field - do not use */ struct { WORD wProcessorArchitecture; WORD wReserved; } DUMMYSTRUCTNAME; } DUMMYUNIONNAME; DWORD dwPageSize; LPVOID lpMinimumApplicationAddress; LPVOID lpMaximumApplicationAddress; DWORD dwActiveProcessorMask; DWORD dwNumberOfProcessors; DWORD dwProcessorType; DWORD dwAllocationGranularity; WORD wProcessorLevel; WORD wProcessorRevision; } SYSTEM_INFO, *LPSYSTEM_INFO; /* {G,S}etPriorityClass */ #define NORMAL_PRIORITY_CLASS 0x00000020 #define IDLE_PRIORITY_CLASS 0x00000040 #define HIGH_PRIORITY_CLASS 0x00000080 #define REALTIME_PRIORITY_CLASS 0x00000100 typedef WIN_BOOL CALLBACK (*ENUMRESTYPEPROCA)(HMODULE,LPSTR,LONG); typedef WIN_BOOL CALLBACK (*ENUMRESTYPEPROCW)(HMODULE,LPWSTR,LONG); typedef WIN_BOOL CALLBACK (*ENUMRESNAMEPROCA)(HMODULE,LPCSTR,LPSTR,LONG); typedef WIN_BOOL CALLBACK (*ENUMRESNAMEPROCW)(HMODULE,LPCWSTR,LPWSTR,LONG); typedef WIN_BOOL CALLBACK (*ENUMRESLANGPROCA)(HMODULE,LPCSTR,LPCSTR,WORD,LONG); typedef WIN_BOOL CALLBACK (*ENUMRESLANGPROCW)(HMODULE,LPCWSTR,LPCWSTR,WORD,LONG); DECL_WINELIB_TYPE_AW(ENUMRESTYPEPROC) DECL_WINELIB_TYPE_AW(ENUMRESNAMEPROC) DECL_WINELIB_TYPE_AW(ENUMRESLANGPROC) /* flags that can be passed to LoadLibraryEx */ #define DONT_RESOLVE_DLL_REFERENCES 0x00000001 #define LOAD_LIBRARY_AS_DATAFILE 0x00000002 #define LOAD_WITH_ALTERED_SEARCH_PATH 0x00000008 /* ifdef _x86_ ... */ typedef struct _LDT_ENTRY { WORD LimitLow; WORD BaseLow; union { struct { BYTE BaseMid; BYTE Flags1;/*Declare as bytes to avoid alignment problems */ BYTE Flags2; BYTE BaseHi; } Bytes; struct { unsigned BaseMid : 8; unsigned Type : 5; unsigned Dpl : 2; unsigned Pres : 1; unsigned LimitHi : 4; unsigned Sys : 1; unsigned Reserved_0 : 1; unsigned Default_Big : 1; unsigned Granularity : 1; unsigned BaseHi : 8; } Bits; } HighWord; } LDT_ENTRY, *LPLDT_ENTRY; typedef enum _GET_FILEEX_INFO_LEVELS { GetFileExInfoStandard } GET_FILEEX_INFO_LEVELS; typedef struct _WIN32_FILE_ATTRIBUTES_DATA { DWORD dwFileAttributes; FILETIME ftCreationTime; FILETIME ftLastAccessTime; FILETIME ftLastWriteTime; DWORD nFileSizeHigh; DWORD nFileSizeLow; } WIN32_FILE_ATTRIBUTE_DATA, *LPWIN32_FILE_ATTRIBUTE_DATA; typedef struct _DllVersionInfo { DWORD cbSize; DWORD dwMajorVersion; DWORD dwMinorVersion; DWORD dwBuildNumber; DWORD dwPlatformID; } DLLVERSIONINFO; /* * This one seems to be a Win32 only definition. It also is defined with * WINAPI instead of CALLBACK in the windows headers. */ typedef DWORD WINAPI (*LPPROGRESS_ROUTINE)(LARGE_INTEGER, LARGE_INTEGER, LARGE_INTEGER, LARGE_INTEGER, DWORD, DWORD, HANDLE, HANDLE, LPVOID); #define WAIT_FAILED 0xffffffff #define WAIT_OBJECT_0 0 #define WAIT_ABANDONED STATUS_ABANDONED_WAIT_0 #define WAIT_ABANDONED_0 STATUS_ABANDONED_WAIT_0 #define WAIT_IO_COMPLETION STATUS_USER_APC #define WAIT_TIMEOUT STATUS_TIMEOUT #define STILL_ACTIVE STATUS_PENDING #define PAGE_NOACCESS 0x01 #define PAGE_READONLY 0x02 #define PAGE_READWRITE 0x04 #define PAGE_WRITECOPY 0x08 #define PAGE_EXECUTE 0x10 #define PAGE_EXECUTE_READ 0x20 #define PAGE_EXECUTE_READWRITE 0x40 #define PAGE_EXECUTE_WRITECOPY 0x80 #define PAGE_GUARD 0x100 #define PAGE_NOCACHE 0x200 #define MEM_COMMIT 0x00001000 #define MEM_RESERVE 0x00002000 #define MEM_DECOMMIT 0x00004000 #define MEM_RELEASE 0x00008000 #define MEM_FREE 0x00010000 #define MEM_PRIVATE 0x00020000 #define MEM_MAPPED 0x00040000 #define MEM_TOP_DOWN 0x00100000 #ifdef __WINE__ #define MEM_SYSTEM 0x80000000 #endif #define SEC_FILE 0x00800000 #define SEC_IMAGE 0x01000000 #define SEC_RESERVE 0x04000000 #define SEC_COMMIT 0x08000000 #define SEC_NOCACHE 0x10000000 #define FILE_BEGIN 0 #define FILE_CURRENT 1 #define FILE_END 2 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001 #define FILE_CASE_PRESERVED_NAMES 0x00000002 #define FILE_UNICODE_ON_DISK 0x00000004 #define FILE_PERSISTENT_ACLS 0x00000008 #define FILE_MAP_COPY 0x00000001 #define FILE_MAP_WRITE 0x00000002 #define FILE_MAP_READ 0x00000004 #define FILE_MAP_ALL_ACCESS 0x000f001f #define MOVEFILE_REPLACE_EXISTING 0x00000001 #define MOVEFILE_COPY_ALLOWED 0x00000002 #define MOVEFILE_DELAY_UNTIL_REBOOT 0x00000004 #define FS_CASE_SENSITIVE FILE_CASE_SENSITIVE_SEARCH #define FS_CASE_IS_PRESERVED FILE_CASE_PRESERVED_NAMES #define FS_UNICODE_STORED_ON_DISK FILE_UNICODE_ON_DISK #define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION #define EXCEPTION_DATATYPE_MISALIGNMENT STATUS_DATATYPE_MISALIGNMENT #define EXCEPTION_BREAKPOINT STATUS_BREAKPOINT #define EXCEPTION_SINGLE_STEP STATUS_SINGLE_STEP #define EXCEPTION_ARRAY_BOUNDS_EXCEEDED STATUS_ARRAY_BOUNDS_EXCEEDED #define EXCEPTION_FLT_DENORMAL_OPERAND STATUS_FLOAT_DENORMAL_OPERAND #define EXCEPTION_FLT_DIVIDE_BY_ZERO STATUS_FLOAT_DIVIDE_BY_ZERO #define EXCEPTION_FLT_INEXACT_RESULT STATUS_FLOAT_INEXACT_RESULT #define EXCEPTION_FLT_INVALID_OPERATION STATUS_FLOAT_INVALID_OPERATION #define EXCEPTION_FLT_OVERFLOW STATUS_FLOAT_OVERFLOW #define EXCEPTION_FLT_STACK_CHECK STATUS_FLOAT_STACK_CHECK #define EXCEPTION_FLT_UNDERFLOW STATUS_FLOAT_UNDERFLOW #define EXCEPTION_INT_DIVIDE_BY_ZERO STATUS_INTEGER_DIVIDE_BY_ZERO #define EXCEPTION_INT_OVERFLOW STATUS_INTEGER_OVERFLOW #define EXCEPTION_PRIV_INSTRUCTION STATUS_PRIVILEGED_INSTRUCTION #define EXCEPTION_IN_PAGE_ERROR STATUS_IN_PAGE_ERROR #define EXCEPTION_ILLEGAL_INSTRUCTION STATUS_ILLEGAL_INSTRUCTION #define EXCEPTION_NONCONTINUABLE_EXCEPTION STATUS_NONCONTINUABLE_EXCEPTION #define EXCEPTION_STACK_OVERFLOW STATUS_STACK_OVERFLOW #define EXCEPTION_INVALID_DISPOSITION STATUS_INVALID_DISPOSITION #define EXCEPTION_GUARD_PAGE STATUS_GUARD_PAGE_VIOLATION #define EXCEPTION_INVALID_HANDLE STATUS_INVALID_HANDLE #define CONTROL_C_EXIT STATUS_CONTROL_C_EXIT /* Wine extension; Windows doesn't have a name for this code */ #define EXCEPTION_CRITICAL_SECTION_WAIT 0xc0000194 #define DUPLICATE_CLOSE_SOURCE 0x00000001 #define DUPLICATE_SAME_ACCESS 0x00000002 #define HANDLE_FLAG_INHERIT 0x00000001 #define HANDLE_FLAG_PROTECT_FROM_CLOSE 0x00000002 #define HINSTANCE_ERROR 32 #define THREAD_PRIORITY_LOWEST THREAD_BASE_PRIORITY_MIN #define THREAD_PRIORITY_BELOW_NORMAL (THREAD_PRIORITY_LOWEST+1) #define THREAD_PRIORITY_NORMAL 0 #define THREAD_PRIORITY_HIGHEST THREAD_BASE_PRIORITY_MAX #define THREAD_PRIORITY_ABOVE_NORMAL (THREAD_PRIORITY_HIGHEST-1) #define THREAD_PRIORITY_ERROR_RETURN (0x7fffffff) #define THREAD_PRIORITY_TIME_CRITICAL THREAD_BASE_PRIORITY_LOWRT #define THREAD_PRIORITY_IDLE THREAD_BASE_PRIORITY_IDLE /* Could this type be considered opaque? */ typedef struct { LPVOID DebugInfo; LONG LockCount; LONG RecursionCount; HANDLE OwningThread; HANDLE LockSemaphore; DWORD Reserved; }CRITICAL_SECTION; #ifdef __WINE__ #define CRITICAL_SECTION_INIT { 0, -1, 0, 0, 0, 0 } #endif typedef struct { DWORD dwOSVersionInfoSize; DWORD dwMajorVersion; DWORD dwMinorVersion; DWORD dwBuildNumber; DWORD dwPlatformId; CHAR szCSDVersion[128]; } OSVERSIONINFO16; typedef struct { DWORD dwOSVersionInfoSize; DWORD dwMajorVersion; DWORD dwMinorVersion; DWORD dwBuildNumber; DWORD dwPlatformId; CHAR szCSDVersion[128]; } OSVERSIONINFOA; typedef struct { DWORD dwOSVersionInfoSize; DWORD dwMajorVersion; DWORD dwMinorVersion; DWORD dwBuildNumber; DWORD dwPlatformId; WCHAR szCSDVersion[128]; } OSVERSIONINFOW; DECL_WINELIB_TYPE_AW(OSVERSIONINFO) #define VER_PLATFORM_WIN32s 0 #define VER_PLATFORM_WIN32_WINDOWS 1 #define VER_PLATFORM_WIN32_NT 2 typedef struct tagCOMSTAT { DWORD status; DWORD cbInQue; DWORD cbOutQue; } COMSTAT,*LPCOMSTAT; typedef struct tagDCB { DWORD DCBlength; DWORD BaudRate; unsigned fBinary :1; unsigned fParity :1; unsigned fOutxCtsFlow :1; unsigned fOutxDsrFlow :1; unsigned fDtrControl :2; unsigned fDsrSensitivity :1; unsigned fTXContinueOnXoff :1; unsigned fOutX :1; unsigned fInX :1; unsigned fErrorChar :1; unsigned fNull :1; unsigned fRtsControl :2; unsigned fAbortOnError :1; unsigned fDummy2 :17; WORD wReserved; WORD XonLim; WORD XoffLim; BYTE ByteSize; BYTE Parity; BYTE StopBits; char XonChar; char XoffChar; char ErrorChar; char EofChar; char EvtChar; } DCB, *LPDCB; typedef struct tagCOMMTIMEOUTS { DWORD ReadIntervalTimeout; DWORD ReadTotalTimeoutMultiplier; DWORD ReadTotalTimeoutConstant; DWORD WriteTotalTimeoutMultiplier; DWORD WriteTotalTimeoutConstant; } COMMTIMEOUTS,*LPCOMMTIMEOUTS; #include "poppack.h" typedef void CALLBACK (*PAPCFUNC)(ULONG_PTR); typedef void CALLBACK (*PTIMERAPCROUTINE)(LPVOID,DWORD,DWORD); WIN_BOOL WINAPI ClearCommError(INT,LPDWORD,LPCOMSTAT); WIN_BOOL WINAPI BuildCommDCBA(LPCSTR,LPDCB); WIN_BOOL WINAPI BuildCommDCBW(LPCWSTR,LPDCB); #define BuildCommDCB WINELIB_NAME_AW(BuildCommDCB) WIN_BOOL WINAPI BuildCommDCBAndTimeoutsA(LPCSTR,LPDCB,LPCOMMTIMEOUTS); WIN_BOOL WINAPI BuildCommDCBAndTimeoutsW(LPCWSTR,LPDCB,LPCOMMTIMEOUTS); #define BuildCommDCBAndTimeouts WINELIB_NAME_AW(BuildCommDCBAndTimeouts) WIN_BOOL WINAPI GetCommTimeouts(HANDLE,LPCOMMTIMEOUTS); WIN_BOOL WINAPI SetCommTimeouts(HANDLE,LPCOMMTIMEOUTS); WIN_BOOL WINAPI GetCommState(INT,LPDCB); WIN_BOOL WINAPI SetCommState(INT,LPDCB); WIN_BOOL WINAPI TransmitCommChar(INT,CHAR); WIN_BOOL WINAPI SetupComm(HANDLE, DWORD, DWORD); WIN_BOOL WINAPI GetCommProperties(HANDLE, LPDCB *); /*DWORD WINAPI GetVersion( void );*/ WIN_BOOL16 WINAPI GetVersionEx16(OSVERSIONINFO16*); WIN_BOOL WINAPI GetVersionExA(OSVERSIONINFOA*); WIN_BOOL WINAPI GetVersionExW(OSVERSIONINFOW*); #define GetVersionEx WINELIB_NAME_AW(GetVersionEx) /*int WinMain(HINSTANCE, HINSTANCE prev, char *cmd, int show);*/ void WINAPI DeleteCriticalSection(CRITICAL_SECTION *lpCrit); void WINAPI EnterCriticalSection(CRITICAL_SECTION *lpCrit); WIN_BOOL WINAPI TryEnterCriticalSection(CRITICAL_SECTION *lpCrit); void WINAPI InitializeCriticalSection(CRITICAL_SECTION *lpCrit); void WINAPI LeaveCriticalSection(CRITICAL_SECTION *lpCrit); void WINAPI MakeCriticalSectionGlobal(CRITICAL_SECTION *lpCrit); WIN_BOOL WINAPI GetProcessWorkingSetSize(HANDLE,LPDWORD,LPDWORD); DWORD WINAPI QueueUserAPC(PAPCFUNC,HANDLE,ULONG_PTR); void WINAPI RaiseException(DWORD,DWORD,DWORD,const LPDWORD); WIN_BOOL WINAPI SetProcessWorkingSetSize(HANDLE,DWORD,DWORD); WIN_BOOL WINAPI TerminateProcess(HANDLE,DWORD); WIN_BOOL WINAPI TerminateThread(HANDLE,DWORD); WIN_BOOL WINAPI GetExitCodeThread(HANDLE,LPDWORD); /* GetBinaryType return values. */ #define SCS_32BIT_BINARY 0 #define SCS_DOS_BINARY 1 #define SCS_WOW_BINARY 2 #define SCS_PIF_BINARY 3 #define SCS_POSIX_BINARY 4 #define SCS_OS216_BINARY 5 WIN_BOOL WINAPI GetBinaryTypeA( LPCSTR lpApplicationName, LPDWORD lpBinaryType ); WIN_BOOL WINAPI GetBinaryTypeW( LPCWSTR lpApplicationName, LPDWORD lpBinaryType ); #define GetBinaryType WINELIB_NAME_AW(GetBinaryType) WIN_BOOL16 WINAPI GetWinDebugInfo16(LPWINDEBUGINFO,UINT16); WIN_BOOL16 WINAPI SetWinDebugInfo16(LPWINDEBUGINFO); /* Declarations for functions that exist only in Win32 */ WIN_BOOL WINAPI AttachThreadInput(DWORD,DWORD,WIN_BOOL); WIN_BOOL WINAPI AccessCheck(PSECURITY_DESCRIPTOR,HANDLE,DWORD,PGENERIC_MAPPING,PPRIVILEGE_SET,LPDWORD,LPDWORD,LPWIN_BOOL); WIN_BOOL WINAPI AdjustTokenPrivileges(HANDLE,WIN_BOOL,LPVOID,DWORD,LPVOID,LPDWORD); WIN_BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY,BYTE,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,PSID *); WIN_BOOL WINAPI AllocateLocallyUniqueId(PLUID); WIN_BOOL WINAPI AllocConsole(void); WIN_BOOL WINAPI AreFileApisANSI(void); WIN_BOOL WINAPI BackupEventLogA(HANDLE,LPCSTR); WIN_BOOL WINAPI BackupEventLogW(HANDLE,LPCWSTR); #define BackupEventLog WINELIB_NAME_AW(BackupEventLog) WIN_BOOL WINAPI Beep(DWORD,DWORD); WIN_BOOL WINAPI CancelWaitableTimer(HANDLE); WIN_BOOL WINAPI ClearEventLogA(HANDLE,LPCSTR); WIN_BOOL WINAPI ClearEventLogW(HANDLE,LPCWSTR); #define ClearEventLog WINELIB_NAME_AW(ClearEventLog) WIN_BOOL WINAPI CloseEventLog(HANDLE); WIN_BOOL WINAPI CloseHandle(HANDLE); WIN_BOOL WINAPI ContinueDebugEvent(DWORD,DWORD,DWORD); HANDLE WINAPI ConvertToGlobalHandle(HANDLE hSrc); WIN_BOOL WINAPI CopyFileA(LPCSTR,LPCSTR,WIN_BOOL); WIN_BOOL WINAPI CopyFileW(LPCWSTR,LPCWSTR,WIN_BOOL); #define CopyFile WINELIB_NAME_AW(CopyFile) WIN_BOOL WINAPI CopyFileExA(LPCSTR, LPCSTR, LPPROGRESS_ROUTINE, LPVOID, LPWIN_BOOL, DWORD); WIN_BOOL WINAPI CopyFileExW(LPCWSTR, LPCWSTR, LPPROGRESS_ROUTINE, LPVOID, LPWIN_BOOL, DWORD); #define CopyFileEx WINELIB_NAME_AW(CopyFileEx) WIN_BOOL WINAPI CopySid(DWORD,PSID,PSID); INT WINAPI CompareFileTime(LPFILETIME,LPFILETIME); HANDLE WINAPI CreateEventA(LPSECURITY_ATTRIBUTES,WIN_BOOL,WIN_BOOL,LPCSTR); HANDLE WINAPI CreateEventW(LPSECURITY_ATTRIBUTES,WIN_BOOL,WIN_BOOL,LPCWSTR); #define CreateEvent WINELIB_NAME_AW(CreateEvent) HANDLE WINAPI CreateFileA(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES, DWORD,DWORD,HANDLE); HANDLE WINAPI CreateFileW(LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES, DWORD,DWORD,HANDLE); #define CreateFile WINELIB_NAME_AW(CreateFile) HANDLE WINAPI CreateFileMappingA(HANDLE,LPSECURITY_ATTRIBUTES,DWORD, DWORD,DWORD,LPCSTR); HANDLE WINAPI CreateFileMappingW(HANDLE,LPSECURITY_ATTRIBUTES,DWORD, DWORD,DWORD,LPCWSTR); #define CreateFileMapping WINELIB_NAME_AW(CreateFileMapping) HANDLE WINAPI CreateMutexA(LPSECURITY_ATTRIBUTES,WIN_BOOL,LPCSTR); HANDLE WINAPI CreateMutexW(LPSECURITY_ATTRIBUTES,WIN_BOOL,LPCWSTR); #define CreateMutex WINELIB_NAME_AW(CreateMutex) WIN_BOOL WINAPI CreatePipe(PHANDLE,PHANDLE,LPSECURITY_ATTRIBUTES,DWORD); WIN_BOOL WINAPI CreateProcessA(LPCSTR,LPSTR,LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES,WIN_BOOL,DWORD,LPVOID,LPCSTR, LPSTARTUPINFOA,LPPROCESS_INFORMATION); WIN_BOOL WINAPI CreateProcessW(LPCWSTR,LPWSTR,LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES,WIN_BOOL,DWORD,LPVOID,LPCWSTR, LPSTARTUPINFOW,LPPROCESS_INFORMATION); #define CreateProcess WINELIB_NAME_AW(CreateProcess) HANDLE WINAPI CreateSemaphoreA(LPSECURITY_ATTRIBUTES,LONG,LONG,LPCSTR); HANDLE WINAPI CreateSemaphoreW(LPSECURITY_ATTRIBUTES,LONG,LONG,LPCWSTR); #define CreateSemaphore WINELIB_NAME_AW(CreateSemaphore) HANDLE WINAPI CreateThread(LPSECURITY_ATTRIBUTES,DWORD,LPTHREAD_START_ROUTINE,LPVOID,DWORD,LPDWORD); HANDLE WINAPI CreateWaitableTimerA(LPSECURITY_ATTRIBUTES,WIN_BOOL,LPCSTR); HANDLE WINAPI CreateWaitableTimerW(LPSECURITY_ATTRIBUTES,WIN_BOOL,LPCWSTR); #define CreateWaitableTimer WINELIB_NAME_AW(CreateWaitableTimer) WIN_BOOL WINAPI DebugActiveProcess(DWORD); void WINAPI DebugBreak(void); WIN_BOOL WINAPI DeregisterEventSource(HANDLE); WIN_BOOL WINAPI DisableThreadLibraryCalls(HMODULE); WIN_BOOL WINAPI DosDateTimeToFileTime(WORD,WORD,LPFILETIME); WIN_BOOL WINAPI DuplicateHandle(HANDLE,HANDLE,HANDLE,HANDLE*,DWORD,WIN_BOOL,DWORD); WIN_BOOL WINAPI EnumDateFormatsA(DATEFMT_ENUMPROCA lpDateFmtEnumProc, LCID Locale, DWORD dwFlags); WIN_BOOL WINAPI EnumDateFormatsW(DATEFMT_ENUMPROCW lpDateFmtEnumProc, LCID Locale, DWORD dwFlags); #define EnumDateFormats WINELIB_NAME_AW(EnumDateFormats) WIN_BOOL WINAPI EnumResourceLanguagesA(HMODULE,LPCSTR,LPCSTR, ENUMRESLANGPROCA,LONG); WIN_BOOL WINAPI EnumResourceLanguagesW(HMODULE,LPCWSTR,LPCWSTR, ENUMRESLANGPROCW,LONG); #define EnumResourceLanguages WINELIB_NAME_AW(EnumResourceLanguages) WIN_BOOL WINAPI EnumResourceNamesA(HMODULE,LPCSTR,ENUMRESNAMEPROCA, LONG); WIN_BOOL WINAPI EnumResourceNamesW(HMODULE,LPCWSTR,ENUMRESNAMEPROCW, LONG); #define EnumResourceNames WINELIB_NAME_AW(EnumResourceNames) WIN_BOOL WINAPI EnumResourceTypesA(HMODULE,ENUMRESTYPEPROCA,LONG); WIN_BOOL WINAPI EnumResourceTypesW(HMODULE,ENUMRESTYPEPROCW,LONG); #define EnumResourceTypes WINELIB_NAME_AW(EnumResourceTypes) WIN_BOOL WINAPI EnumSystemCodePagesA(CODEPAGE_ENUMPROCA,DWORD); WIN_BOOL WINAPI EnumSystemCodePagesW(CODEPAGE_ENUMPROCW,DWORD); #define EnumSystemCodePages WINELIB_NAME_AW(EnumSystemCodePages) WIN_BOOL WINAPI EnumSystemLocalesA(LOCALE_ENUMPROCA,DWORD); WIN_BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW,DWORD); #define EnumSystemLocales WINELIB_NAME_AW(EnumSystemLocales) WIN_BOOL WINAPI EnumTimeFormatsA(TIMEFMT_ENUMPROCA lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags); WIN_BOOL WINAPI EnumTimeFormatsW(TIMEFMT_ENUMPROCW lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags); #define EnumTimeFormats WINELIB_NAME_AW(EnumTimeFormats) WIN_BOOL WINAPI EqualSid(PSID, PSID); WIN_BOOL WINAPI EqualPrefixSid(PSID,PSID); VOID WINAPI ExitProcess(DWORD) WINE_NORETURN; VOID WINAPI ExitThread(DWORD) WINE_NORETURN; DWORD WINAPI ExpandEnvironmentStringsA(LPCSTR,LPSTR,DWORD); DWORD WINAPI ExpandEnvironmentStringsW(LPCWSTR,LPWSTR,DWORD); #define ExpandEnvironmentStrings WINELIB_NAME_AW(ExpandEnvironmentStrings) WIN_BOOL WINAPI FileTimeToDosDateTime(const FILETIME*,LPWORD,LPWORD); WIN_BOOL WINAPI FileTimeToLocalFileTime(const FILETIME*,LPFILETIME); WIN_BOOL WINAPI FileTimeToSystemTime(const FILETIME*,LPSYSTEMTIME); HANDLE WINAPI FindFirstChangeNotificationA(LPCSTR,WIN_BOOL,DWORD); HANDLE WINAPI FindFirstChangeNotificationW(LPCWSTR,WIN_BOOL,DWORD); #define FindFirstChangeNotification WINELIB_NAME_AW(FindFirstChangeNotification) WIN_BOOL WINAPI FindNextChangeNotification(HANDLE); WIN_BOOL WINAPI FindCloseChangeNotification(HANDLE); HRSRC WINAPI FindResourceExA(HMODULE,LPCSTR,LPCSTR,WORD); HRSRC WINAPI FindResourceExW(HMODULE,LPCWSTR,LPCWSTR,WORD); #define FindResourceEx WINELIB_NAME_AW(FindResourceEx) WIN_BOOL WINAPI FlushConsoleInputBuffer(HANDLE); WIN_BOOL WINAPI FlushFileBuffers(HANDLE); WIN_BOOL WINAPI FlushViewOfFile(LPCVOID, DWORD); DWORD WINAPI FormatMessageA(DWORD,LPCVOID,DWORD,DWORD,LPSTR, DWORD,LPDWORD); DWORD WINAPI FormatMessageW(DWORD,LPCVOID,DWORD,DWORD,LPWSTR, DWORD,LPDWORD); #define FormatMessage WINELIB_NAME_AW(FormatMessage) WIN_BOOL WINAPI FreeConsole(void); WIN_BOOL WINAPI FreeEnvironmentStringsA(LPSTR); WIN_BOOL WINAPI FreeEnvironmentStringsW(LPWSTR); #define FreeEnvironmentStrings WINELIB_NAME_AW(FreeEnvironmentStrings) PVOID WINAPI FreeSid(PSID); UINT WINAPI GetACP(void); LPCSTR WINAPI GetCommandLineA(void); LPCWSTR WINAPI GetCommandLineW(void); #define GetCommandLine WINELIB_NAME_AW(GetCommandLine) WIN_BOOL WINAPI GetComputerNameA(LPSTR,LPDWORD); WIN_BOOL WINAPI GetComputerNameW(LPWSTR,LPDWORD); #define GetComputerName WINELIB_NAME_AW(GetComputerName) UINT WINAPI GetConsoleCP(void); WIN_BOOL WINAPI GetConsoleMode(HANDLE,LPDWORD); UINT WINAPI GetConsoleOutputCP(void); DWORD WINAPI GetConsoleTitleA(LPSTR,DWORD); DWORD WINAPI GetConsoleTitleW(LPWSTR,DWORD); #define GetConsoleTitle WINELIB_NAME_AW(GetConsoleTitle) WIN_BOOL WINAPI GetCommMask(HANDLE, LPDWORD); WIN_BOOL WINAPI GetCommModemStatus(HANDLE, LPDWORD); HANDLE WINAPI GetCurrentProcess(void); HANDLE WINAPI GetCurrentThread(void); INT WINAPI GetDateFormatA(LCID,DWORD,LPSYSTEMTIME,LPCSTR,LPSTR,INT); INT WINAPI GetDateFormatW(LCID,DWORD,LPSYSTEMTIME,LPCWSTR,LPWSTR,INT); #define GetDateFormat WINELIB_NAME_AW(GetDateFormat) LPSTR WINAPI GetEnvironmentStringsA(void); LPWSTR WINAPI GetEnvironmentStringsW(void); #define GetEnvironmentStrings WINELIB_NAME_AW(GetEnvironmentStrings) DWORD WINAPI GetEnvironmentVariableA(LPCSTR,LPSTR,DWORD); DWORD WINAPI GetEnvironmentVariableW(LPCWSTR,LPWSTR,DWORD); #define GetEnvironmentVariable WINELIB_NAME_AW(GetEnvironmentVariable) WIN_BOOL WINAPI GetFileAttributesExA(LPCSTR,GET_FILEEX_INFO_LEVELS,LPVOID); WIN_BOOL WINAPI GetFileAttributesExW(LPCWSTR,GET_FILEEX_INFO_LEVELS,LPVOID); #define GetFileattributesEx WINELIB_NAME_AW(GetFileAttributesEx) DWORD WINAPI GetFileInformationByHandle(HANDLE,BY_HANDLE_FILE_INFORMATION*); WIN_BOOL WINAPI GetFileSecurityA(LPCSTR,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,DWORD,LPDWORD); WIN_BOOL WINAPI GetFileSecurityW(LPCWSTR,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,DWORD,LPDWORD); #define GetFileSecurity WINELIB_NAME_AW(GetFileSecurity) DWORD WINAPI GetFileSize(HANDLE,LPDWORD); WIN_BOOL WINAPI GetFileTime(HANDLE,LPFILETIME,LPFILETIME,LPFILETIME); DWORD WINAPI GetFileType(HANDLE); DWORD WINAPI GetFullPathNameA(LPCSTR,DWORD,LPSTR,LPSTR*); DWORD WINAPI GetFullPathNameW(LPCWSTR,DWORD,LPWSTR,LPWSTR*); #define GetFullPathName WINELIB_NAME_AW(GetFullPathName) WIN_BOOL WINAPI GetHandleInformation(HANDLE,LPDWORD); COORD WINAPI GetLargestConsoleWindowSize(HANDLE); DWORD WINAPI GetLengthSid(PSID); VOID WINAPI GetLocalTime(LPSYSTEMTIME); DWORD WINAPI GetLogicalDrives(void); DWORD WINAPI GetLongPathNameA(LPCSTR,LPSTR,DWORD); DWORD WINAPI GetLongPathNameW(LPCWSTR,LPWSTR,DWORD); #define GetLongPathName WINELIB_NAME_AW(GetLongPathName) WIN_BOOL WINAPI GetNumberOfConsoleInputEvents(HANDLE,LPDWORD); WIN_BOOL WINAPI GetNumberOfConsoleMouseButtons(LPDWORD); WIN_BOOL WINAPI GetNumberOfEventLogRecords(HANDLE,PDWORD); UINT WINAPI GetOEMCP(void); WIN_BOOL WINAPI GetOldestEventLogRecord(HANDLE,PDWORD); DWORD WINAPI GetPriorityClass(HANDLE); DWORD WINAPI GetProcessVersion(DWORD); WIN_BOOL WINAPI GetSecurityDescriptorControl(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR_CONTROL,LPDWORD); WIN_BOOL WINAPI GetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR,LPWIN_BOOL,PACL *,LPWIN_BOOL); WIN_BOOL WINAPI GetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR,PSID *,LPWIN_BOOL); DWORD WINAPI GetSecurityDescriptorLength(PSECURITY_DESCRIPTOR); WIN_BOOL WINAPI GetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR,PSID *,LPWIN_BOOL); WIN_BOOL WINAPI GetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR,LPWIN_BOOL,PACL *,LPWIN_BOOL); PSID_IDENTIFIER_AUTHORITY WINAPI GetSidIdentifierAuthority(PSID); DWORD WINAPI GetSidLengthRequired(BYTE); PDWORD WINAPI GetSidSubAuthority(PSID,DWORD); PUCHAR WINAPI GetSidSubAuthorityCount(PSID); DWORD WINAPI GetShortPathNameA(LPCSTR,LPSTR,DWORD); DWORD WINAPI GetShortPathNameW(LPCWSTR,LPWSTR,DWORD); #define GetShortPathName WINELIB_NAME_AW(GetShortPathName) HFILE WINAPI GetStdHandle(DWORD); WIN_BOOL WINAPI GetStringTypeExA(LCID,DWORD,LPCSTR,INT,LPWORD); WIN_BOOL WINAPI GetStringTypeExW(LCID,DWORD,LPCWSTR,INT,LPWORD); #define GetStringTypeEx WINELIB_NAME_AW(GetStringTypeEx) VOID WINAPI GetSystemInfo(LPSYSTEM_INFO); WIN_BOOL WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS); VOID WINAPI GetSystemTime(LPSYSTEMTIME); VOID WINAPI GetSystemTimeAsFileTime(LPFILETIME); INT WINAPI GetTimeFormatA(LCID,DWORD,LPSYSTEMTIME,LPCSTR,LPSTR,INT); INT WINAPI GetTimeFormatW(LCID,DWORD,LPSYSTEMTIME,LPCWSTR,LPWSTR,INT); #define GetTimeFormat WINELIB_NAME_AW(GetTimeFormat) WIN_BOOL WINAPI GetThreadContext(HANDLE,CONTEXT *); LCID WINAPI GetThreadLocale(void); INT WINAPI GetThreadPriority(HANDLE); WIN_BOOL WINAPI GetThreadSelectorEntry(HANDLE,DWORD,LPLDT_ENTRY); WIN_BOOL WINAPI GetThreadTimes(HANDLE,LPFILETIME,LPFILETIME,LPFILETIME,LPFILETIME); WIN_BOOL WINAPI GetTokenInformation(HANDLE,TOKEN_INFORMATION_CLASS,LPVOID,DWORD,LPDWORD); WIN_BOOL WINAPI GetUserNameA(LPSTR,LPDWORD); WIN_BOOL WINAPI GetUserNameW(LPWSTR,LPDWORD); #define GetUserName WINELIB_NAME_AW(GetUserName) VOID WINAPI GlobalMemoryStatus(LPMEMORYSTATUS); LPVOID WINAPI HeapAlloc(HANDLE,DWORD,DWORD); DWORD WINAPI HeapCompact(HANDLE,DWORD); HANDLE WINAPI HeapCreate(DWORD,DWORD,DWORD); WIN_BOOL WINAPI HeapDestroy(HANDLE); WIN_BOOL WINAPI HeapFree(HANDLE,DWORD,LPVOID); WIN_BOOL WINAPI HeapLock(HANDLE); LPVOID WINAPI HeapReAlloc(HANDLE,DWORD,LPVOID,DWORD); DWORD WINAPI HeapSize(HANDLE,DWORD,LPVOID); WIN_BOOL WINAPI HeapUnlock(HANDLE); WIN_BOOL WINAPI HeapValidate(HANDLE,DWORD,LPCVOID); WIN_BOOL WINAPI HeapWalk(HANDLE,LPPROCESS_HEAP_ENTRY); WIN_BOOL WINAPI InitializeSid(PSID,PSID_IDENTIFIER_AUTHORITY,BYTE); WIN_BOOL WINAPI IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR); WIN_BOOL WINAPI IsValidSid(PSID); WIN_BOOL WINAPI ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL); WIN_BOOL WINAPI IsDBCSLeadByteEx(UINT,BYTE); WIN_BOOL WINAPI IsProcessorFeaturePresent(DWORD); WIN_BOOL WINAPI IsValidLocale(DWORD,DWORD); WIN_BOOL WINAPI LookupAccountSidA(LPCSTR,PSID,LPSTR,LPDWORD,LPSTR,LPDWORD,PSID_NAME_USE); WIN_BOOL WINAPI LookupAccountSidW(LPCWSTR,PSID,LPWSTR,LPDWORD,LPWSTR,LPDWORD,PSID_NAME_USE); #define LookupAccountSid WINELIB_NAME_AW(LookupAccountSidW) WIN_BOOL WINAPI LocalFileTimeToFileTime(const FILETIME*,LPFILETIME); WIN_BOOL WINAPI LockFile(HANDLE,DWORD,DWORD,DWORD,DWORD); WIN_BOOL WINAPI LockFileEx(HANDLE, DWORD, DWORD, DWORD, DWORD, LPOVERLAPPED); WIN_BOOL WINAPI LookupPrivilegeValueA(LPCSTR,LPCSTR,LPVOID); WIN_BOOL WINAPI LookupPrivilegeValueW(LPCWSTR,LPCWSTR,LPVOID); #define LookupPrivilegeValue WINELIB_NAME_AW(LookupPrivilegeValue) WIN_BOOL WINAPI MakeSelfRelativeSD(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,LPDWORD); HMODULE WINAPI MapHModuleSL(HMODULE16); HMODULE16 WINAPI MapHModuleLS(HMODULE); SEGPTR WINAPI MapLS(LPVOID); LPVOID WINAPI MapSL(SEGPTR); LPVOID WINAPI MapViewOfFile(HANDLE,DWORD,DWORD,DWORD,DWORD); LPVOID WINAPI MapViewOfFileEx(HANDLE,DWORD,DWORD,DWORD,DWORD,LPVOID); WIN_BOOL WINAPI MoveFileA(LPCSTR,LPCSTR); WIN_BOOL WINAPI MoveFileW(LPCWSTR,LPCWSTR); #define MoveFile WINELIB_NAME_AW(MoveFile) WIN_BOOL WINAPI MoveFileExA(LPCSTR,LPCSTR,DWORD); WIN_BOOL WINAPI MoveFileExW(LPCWSTR,LPCWSTR,DWORD); #define MoveFileEx WINELIB_NAME_AW(MoveFileEx) INT WINAPI MultiByteToWideChar(UINT,DWORD,LPCSTR,INT,LPWSTR,INT); WIN_BOOL WINAPI NotifyChangeEventLog(HANDLE,HANDLE); INT WINAPI WideCharToMultiByte(UINT,DWORD,LPCWSTR,INT,LPSTR,INT,LPCSTR,WIN_BOOL*); HANDLE WINAPI OpenBackupEventLogA(LPCSTR,LPCSTR); HANDLE WINAPI OpenBackupEventLogW(LPCWSTR,LPCWSTR); #define OpenBackupEventLog WINELIB_NAME_AW(OpenBackupEventLog) HANDLE WINAPI OpenEventA(DWORD,WIN_BOOL,LPCSTR); HANDLE WINAPI OpenEventW(DWORD,WIN_BOOL,LPCWSTR); #define OpenEvent WINELIB_NAME_AW(OpenEvent) HANDLE WINAPI OpenEventLogA(LPCSTR,LPCSTR); HANDLE WINAPI OpenEventLogW(LPCWSTR,LPCWSTR); #define OpenEventLog WINELIB_NAME_AW(OpenEventLog) HANDLE WINAPI OpenFileMappingA(DWORD,WIN_BOOL,LPCSTR); HANDLE WINAPI OpenFileMappingW(DWORD,WIN_BOOL,LPCWSTR); #define OpenFileMapping WINELIB_NAME_AW(OpenFileMapping) HANDLE WINAPI OpenMutexA(DWORD,WIN_BOOL,LPCSTR); HANDLE WINAPI OpenMutexW(DWORD,WIN_BOOL,LPCWSTR); #define OpenMutex WINELIB_NAME_AW(OpenMutex) HANDLE WINAPI OpenProcess(DWORD,WIN_BOOL,DWORD); WIN_BOOL WINAPI OpenProcessToken(HANDLE,DWORD,PHANDLE); HANDLE WINAPI OpenSemaphoreA(DWORD,WIN_BOOL,LPCSTR); HANDLE WINAPI OpenSemaphoreW(DWORD,WIN_BOOL,LPCWSTR); #define OpenSemaphore WINELIB_NAME_AW(OpenSemaphore) WIN_BOOL WINAPI OpenThreadToken(HANDLE,DWORD,WIN_BOOL,PHANDLE); HANDLE WINAPI OpenWaitableTimerA(DWORD,WIN_BOOL,LPCSTR); HANDLE WINAPI OpenWaitableTimerW(DWORD,WIN_BOOL,LPCWSTR); #define OpenWaitableTimer WINELIB_NAME_AW(OpenWaitableTimer) WIN_BOOL WINAPI PulseEvent(HANDLE); WIN_BOOL WINAPI PurgeComm(HANDLE,DWORD); DWORD WINAPI QueryDosDeviceA(LPCSTR,LPSTR,DWORD); DWORD WINAPI QueryDosDeviceW(LPCWSTR,LPWSTR,DWORD); #define QueryDosDevice WINELIB_NAME_AW(QueryDosDevice) WIN_BOOL WINAPI QueryPerformanceCounter(PLARGE_INTEGER); WIN_BOOL WINAPI ReadConsoleA(HANDLE,LPVOID,DWORD,LPDWORD,LPVOID); WIN_BOOL WINAPI ReadConsoleW(HANDLE,LPVOID,DWORD,LPDWORD,LPVOID); #define ReadConsole WINELIB_NAME_AW(ReadConsole) WIN_BOOL WINAPI ReadConsoleOutputCharacterA(HANDLE,LPSTR,DWORD, COORD,LPDWORD); #define ReadConsoleOutputCharacter WINELIB_NAME_AW(ReadConsoleOutputCharacter) WIN_BOOL WINAPI ReadEventLogA(HANDLE,DWORD,DWORD,LPVOID,DWORD,DWORD *,DWORD *); WIN_BOOL WINAPI ReadEventLogW(HANDLE,DWORD,DWORD,LPVOID,DWORD,DWORD *,DWORD *); #define ReadEventLog WINELIB_NAME_AW(ReadEventLog) WIN_BOOL WINAPI ReadFile(HANDLE,LPVOID,DWORD,LPDWORD,LPOVERLAPPED); HANDLE WINAPI RegisterEventSourceA(LPCSTR,LPCSTR); HANDLE WINAPI RegisterEventSourceW(LPCWSTR,LPCWSTR); #define RegisterEventSource WINELIB_NAME_AW(RegisterEventSource) WIN_BOOL WINAPI ReleaseMutex(HANDLE); WIN_BOOL WINAPI ReleaseSemaphore(HANDLE,LONG,LPLONG); WIN_BOOL WINAPI ReportEventA(HANDLE,WORD,WORD,DWORD,PSID,WORD,DWORD,LPCSTR *,LPVOID); WIN_BOOL WINAPI ReportEventW(HANDLE,WORD,WORD,DWORD,PSID,WORD,DWORD,LPCWSTR *,LPVOID); #define ReportEvent WINELIB_NAME_AW(ReportEvent) WIN_BOOL WINAPI ResetEvent(HANDLE); DWORD WINAPI ResumeThread(HANDLE); WIN_BOOL WINAPI RevertToSelf(void); DWORD WINAPI SearchPathA(LPCSTR,LPCSTR,LPCSTR,DWORD,LPSTR,LPSTR*); DWORD WINAPI SearchPathW(LPCWSTR,LPCWSTR,LPCWSTR,DWORD,LPWSTR,LPWSTR*); #define SearchPath WINELIB_NAME_AW(SearchPath) WIN_BOOL WINAPI SetCommMask(INT,DWORD); WIN_BOOL WINAPI SetComputerNameA(LPCSTR); WIN_BOOL WINAPI SetComputerNameW(LPCWSTR); #define SetComputerName WINELIB_NAME_AW(SetComputerName) WIN_BOOL WINAPI SetConsoleCursorPosition(HANDLE,COORD); WIN_BOOL WINAPI SetConsoleMode(HANDLE,DWORD); WIN_BOOL WINAPI SetConsoleTitleA(LPCSTR); WIN_BOOL WINAPI SetConsoleTitleW(LPCWSTR); #define SetConsoleTitle WINELIB_NAME_AW(SetConsoleTitle) WIN_BOOL WINAPI SetEndOfFile(HANDLE); WIN_BOOL WINAPI SetEnvironmentVariableA(LPCSTR,LPCSTR); WIN_BOOL WINAPI SetEnvironmentVariableW(LPCWSTR,LPCWSTR); #define SetEnvironmentVariable WINELIB_NAME_AW(SetEnvironmentVariable) WIN_BOOL WINAPI SetEvent(HANDLE); VOID WINAPI SetFileApisToANSI(void); VOID WINAPI SetFileApisToOEM(void); DWORD WINAPI SetFilePointer(HANDLE,LONG,LPLONG,DWORD); WIN_BOOL WINAPI SetFileSecurityA(LPCSTR,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR); WIN_BOOL WINAPI SetFileSecurityW(LPCWSTR,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR); #define SetFileSecurity WINELIB_NAME_AW(SetFileSecurity) WIN_BOOL WINAPI SetFileTime(HANDLE,const FILETIME*,const FILETIME*,const FILETIME*); WIN_BOOL WINAPI SetHandleInformation(HANDLE,DWORD,DWORD); WIN_BOOL WINAPI SetPriorityClass(HANDLE,DWORD); WIN_BOOL WINAPI SetLocalTime(const SYSTEMTIME*); WIN_BOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR,WIN_BOOL,PACL,WIN_BOOL); WIN_BOOL WINAPI SetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR,PSID,WIN_BOOL); WIN_BOOL WINAPI SetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR,PSID,WIN_BOOL); WIN_BOOL WINAPI SetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR,WIN_BOOL,PACL,WIN_BOOL); WIN_BOOL WINAPI SetStdHandle(DWORD,HANDLE); WIN_BOOL WINAPI SetSystemPowerState(WIN_BOOL,WIN_BOOL); WIN_BOOL WINAPI SetSystemTime(const SYSTEMTIME*); DWORD WINAPI SetThreadAffinityMask(HANDLE,DWORD); WIN_BOOL WINAPI SetThreadContext(HANDLE,const CONTEXT *); WIN_BOOL WINAPI SetThreadLocale(LCID); WIN_BOOL WINAPI SetThreadPriority(HANDLE,INT); WIN_BOOL WINAPI SetTimeZoneInformation(const LPTIME_ZONE_INFORMATION); WIN_BOOL WINAPI SetWaitableTimer(HANDLE,const LARGE_INTEGER*,LONG,PTIMERAPCROUTINE,LPVOID,WIN_BOOL); VOID WINAPI Sleep(DWORD); DWORD WINAPI SleepEx(DWORD,WIN_BOOL); DWORD WINAPI SuspendThread(HANDLE); WIN_BOOL WINAPI SystemTimeToFileTime(const SYSTEMTIME*,LPFILETIME); DWORD WINAPI TlsAlloc(void); WIN_BOOL WINAPI TlsFree(DWORD); LPVOID WINAPI TlsGetValue(DWORD); WIN_BOOL WINAPI TlsSetValue(DWORD,LPVOID); VOID WINAPI UnMapLS(SEGPTR); WIN_BOOL WINAPI UnlockFile(HANDLE,DWORD,DWORD,DWORD,DWORD); WIN_BOOL WINAPI UnmapViewOfFile(LPVOID); LPVOID WINAPI VirtualAlloc(LPVOID,DWORD,DWORD,DWORD); WIN_BOOL WINAPI VirtualFree(LPVOID,SIZE_T,DWORD); WIN_BOOL WINAPI VirtualLock(LPVOID,DWORD); WIN_BOOL WINAPI VirtualProtect(LPVOID,DWORD,DWORD,LPDWORD); WIN_BOOL WINAPI VirtualProtectEx(HANDLE,LPVOID,DWORD,DWORD,LPDWORD); DWORD WINAPI VirtualQuery(LPCVOID,LPMEMORY_BASIC_INFORMATION,DWORD); DWORD WINAPI VirtualQueryEx(HANDLE,LPCVOID,LPMEMORY_BASIC_INFORMATION,DWORD); WIN_BOOL WINAPI VirtualUnlock(LPVOID,DWORD); WIN_BOOL WINAPI WaitCommEvent(HANDLE,LPDWORD,LPOVERLAPPED); WIN_BOOL WINAPI WaitForDebugEvent(LPDEBUG_EVENT,DWORD); DWORD WINAPI WaitForMultipleObjects(DWORD,const HANDLE*,WIN_BOOL,DWORD); DWORD WINAPI WaitForMultipleObjectsEx(DWORD,const HANDLE*,WIN_BOOL,DWORD,WIN_BOOL); DWORD WINAPI WaitForSingleObject(HANDLE,DWORD); DWORD WINAPI WaitForSingleObjectEx(HANDLE,DWORD,WIN_BOOL); WIN_BOOL WINAPI WriteConsoleA(HANDLE,LPCVOID,DWORD,LPDWORD,LPVOID); WIN_BOOL WINAPI WriteConsoleW(HANDLE,LPCVOID,DWORD,LPDWORD,LPVOID); #define WriteConsole WINELIB_NAME_AW(WriteConsole) WIN_BOOL WINAPI WriteFile(HANDLE,LPCVOID,DWORD,LPDWORD,LPOVERLAPPED); LANGID WINAPI GetSystemDefaultLangID(void); LCID WINAPI GetSystemDefaultLCID(void); LANGID WINAPI GetUserDefaultLangID(void); LCID WINAPI GetUserDefaultLCID(void); ATOM WINAPI AddAtomA(LPCSTR); ATOM WINAPI AddAtomW(LPCWSTR); #define AddAtom WINELIB_NAME_AW(AddAtom) UINT WINAPI CompareStringA(DWORD,DWORD,LPCSTR,DWORD,LPCSTR,DWORD); UINT WINAPI CompareStringW(DWORD,DWORD,LPCWSTR,DWORD,LPCWSTR,DWORD); #define CompareString WINELIB_NAME_AW(CompareString) WIN_BOOL WINAPI CreateDirectoryA(LPCSTR,LPSECURITY_ATTRIBUTES); WIN_BOOL WINAPI CreateDirectoryW(LPCWSTR,LPSECURITY_ATTRIBUTES); #define CreateDirectory WINELIB_NAME_AW(CreateDirectory) WIN_BOOL WINAPI CreateDirectoryExA(LPCSTR,LPCSTR,LPSECURITY_ATTRIBUTES); WIN_BOOL WINAPI CreateDirectoryExW(LPCWSTR,LPCWSTR,LPSECURITY_ATTRIBUTES); #define CreateDirectoryEx WINELIB_NAME_AW(CreateDirectoryEx) WIN_BOOL WINAPI DefineDosDeviceA(DWORD,LPCSTR,LPCSTR); #define DefineHandleTable(w) ((w),TRUE) ATOM WINAPI DeleteAtom(ATOM); WIN_BOOL WINAPI DeleteFileA(LPCSTR); WIN_BOOL WINAPI DeleteFileW(LPCWSTR); #define DeleteFile WINELIB_NAME_AW(DeleteFile) void WINAPI FatalAppExitA(UINT,LPCSTR); void WINAPI FatalAppExitW(UINT,LPCWSTR); #define FatalAppExit WINELIB_NAME_AW(FatalAppExit) ATOM WINAPI FindAtomA(LPCSTR); ATOM WINAPI FindAtomW(LPCWSTR); #define FindAtom WINELIB_NAME_AW(FindAtom) WIN_BOOL WINAPI FindClose(HANDLE); HANDLE16 WINAPI FindFirstFile16(LPCSTR,LPWIN32_FIND_DATAA); HANDLE WINAPI FindFirstFileA(LPCSTR,LPWIN32_FIND_DATAA); HANDLE WINAPI FindFirstFileW(LPCWSTR,LPWIN32_FIND_DATAW); #define FindFirstFile WINELIB_NAME_AW(FindFirstFile) WIN_BOOL16 WINAPI FindNextFile16(HANDLE16,LPWIN32_FIND_DATAA); WIN_BOOL WINAPI FindNextFileA(HANDLE,LPWIN32_FIND_DATAA); WIN_BOOL WINAPI FindNextFileW(HANDLE,LPWIN32_FIND_DATAW); #define FindNextFile WINELIB_NAME_AW(FindNextFile) HRSRC WINAPI FindResourceA(HMODULE,LPCSTR,LPCSTR); HRSRC WINAPI FindResourceW(HMODULE,LPCWSTR,LPCWSTR); #define FindResource WINELIB_NAME_AW(FindResource) VOID WINAPI FreeLibrary16(HINSTANCE16); WIN_BOOL WINAPI FreeLibrary(HMODULE); #define FreeModule(handle) FreeLibrary(handle) #define FreeProcInstance(proc) /*nothing*/ WIN_BOOL WINAPI FreeResource(HGLOBAL); UINT WINAPI GetAtomNameA(ATOM,LPSTR,INT); UINT WINAPI GetAtomNameW(ATOM,LPWSTR,INT); #define GetAtomName WINELIB_NAME_AW(GetAtomName) UINT WINAPI GetCurrentDirectoryA(UINT,LPSTR); UINT WINAPI GetCurrentDirectoryW(UINT,LPWSTR); #define GetCurrentDirectory WINELIB_NAME_AW(GetCurrentDirectory) WIN_BOOL WINAPI GetDiskFreeSpaceA(LPCSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD); WIN_BOOL WINAPI GetDiskFreeSpaceW(LPCWSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD); #define GetDiskFreeSpace WINELIB_NAME_AW(GetDiskFreeSpace) WIN_BOOL WINAPI GetDiskFreeSpaceExA(LPCSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER); WIN_BOOL WINAPI GetDiskFreeSpaceExW(LPCWSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER); #define GetDiskFreeSpaceEx WINELIB_NAME_AW(GetDiskFreeSpaceEx) UINT WINAPI GetDriveTypeA(LPCSTR); UINT WINAPI GetDriveTypeW(LPCWSTR); #define GetDriveType WINELIB_NAME_AW(GetDriveType) DWORD WINAPI GetFileAttributesA(LPCSTR); DWORD WINAPI GetFileAttributesW(LPCWSTR); #define GetFileAttributes WINELIB_NAME_AW(GetFileAttributes) #define GetFreeSpace(w) (0x100000L) UINT WINAPI GetLogicalDriveStringsA(UINT,LPSTR); UINT WINAPI GetLogicalDriveStringsW(UINT,LPWSTR); #define GetLogicalDriveStrings WINELIB_NAME_AW(GetLogicalDriveStrings) INT WINAPI GetLocaleInfoA(LCID,LCTYPE,LPSTR,INT); INT WINAPI GetLocaleInfoW(LCID,LCTYPE,LPWSTR,INT); #define GetLocaleInfo WINELIB_NAME_AW(GetLocaleInfo) DWORD WINAPI GetModuleFileNameA(HMODULE,LPSTR,DWORD); DWORD WINAPI GetModuleFileNameW(HMODULE,LPWSTR,DWORD); #define GetModuleFileName WINELIB_NAME_AW(GetModuleFileName) HMODULE WINAPI GetModuleHandleA(LPCSTR); HMODULE WINAPI GetModuleHandleW(LPCWSTR); #define GetModuleHandle WINELIB_NAME_AW(GetModuleHandle) WIN_BOOL WINAPI GetOverlappedResult(HANDLE,LPOVERLAPPED,LPDWORD,WIN_BOOL); UINT WINAPI GetPrivateProfileIntA(LPCSTR,LPCSTR,INT,LPCSTR); UINT WINAPI GetPrivateProfileIntW(LPCWSTR,LPCWSTR,INT,LPCWSTR); #define GetPrivateProfileInt WINELIB_NAME_AW(GetPrivateProfileInt) INT WINAPI GetPrivateProfileSectionA(LPCSTR,LPSTR,DWORD,LPCSTR); INT WINAPI GetPrivateProfileSectionW(LPCWSTR,LPWSTR,DWORD,LPCWSTR); #define GetPrivateProfileSection WINELIB_NAME_AW(GetPrivateProfileSection) DWORD WINAPI GetPrivateProfileSectionNamesA(LPSTR,DWORD,LPCSTR); DWORD WINAPI GetPrivateProfileSectionNamesW(LPWSTR,DWORD,LPCWSTR); #define GetPrivateProfileSectionNames WINELIB_NAME_AW(GetPrivateProfileSectionNames) INT WINAPI GetPrivateProfileStringA(LPCSTR,LPCSTR,LPCSTR,LPSTR,UINT,LPCSTR); INT WINAPI GetPrivateProfileStringW(LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,UINT,LPCWSTR); #define GetPrivateProfileString WINELIB_NAME_AW(GetPrivateProfileString) WIN_BOOL WINAPI GetPrivateProfileStructA(LPCSTR,LPCSTR,LPVOID,UINT,LPCSTR); WIN_BOOL WINAPI GetPrivateProfileStructW(LPCWSTR,LPCWSTR,LPVOID,UINT,LPCWSTR); #define GetPrivateProfileStruct WINELIB_NAME_AW(GetPrivateProfileStruct) FARPROC WINAPI GetProcAddress(HMODULE,LPCSTR); UINT WINAPI GetProfileIntA(LPCSTR,LPCSTR,INT); UINT WINAPI GetProfileIntW(LPCWSTR,LPCWSTR,INT); #define GetProfileInt WINELIB_NAME_AW(GetProfileInt) INT WINAPI GetProfileSectionA(LPCSTR,LPSTR,DWORD); INT WINAPI GetProfileSectionW(LPCWSTR,LPWSTR,DWORD); #define GetProfileSection WINELIB_NAME_AW(GetProfileSection) INT WINAPI GetProfileStringA(LPCSTR,LPCSTR,LPCSTR,LPSTR,UINT); INT WINAPI GetProfileStringW(LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,UINT); #define GetProfileString WINELIB_NAME_AW(GetProfileString) VOID WINAPI GetStartupInfoA(LPSTARTUPINFOA); VOID WINAPI GetStartupInfoW(LPSTARTUPINFOW); #define GetStartupInfo WINELIB_NAME_AW(GetStartupInfo) WIN_BOOL WINAPI GetStringTypeA(LCID,DWORD,LPCSTR,INT,LPWORD); WIN_BOOL WINAPI GetStringTypeW(DWORD,LPCWSTR,INT,LPWORD); #define GetStringType WINELIB_NAME_AW(GetStringType) UINT WINAPI GetSystemDirectoryA(LPSTR,UINT); UINT WINAPI GetSystemDirectoryW(LPWSTR,UINT); #define GetSystemDirectory WINELIB_NAME_AW(GetSystemDirectory) UINT WINAPI GetTempFileNameA(LPCSTR,LPCSTR,UINT,LPSTR); UINT WINAPI GetTempFileNameW(LPCWSTR,LPCWSTR,UINT,LPWSTR); #define GetTempFileName WINELIB_NAME_AW(GetTempFileName) UINT WINAPI GetTempPathA(UINT,LPSTR); UINT WINAPI GetTempPathW(UINT,LPWSTR); #define GetTempPath WINELIB_NAME_AW(GetTempPath) LONG WINAPI GetVersion(void); WIN_BOOL WINAPI GetExitCodeProcess(HANDLE,LPDWORD); WIN_BOOL WINAPI GetVolumeInformationA(LPCSTR,LPSTR,DWORD,LPDWORD,LPDWORD,LPDWORD,LPSTR,DWORD); WIN_BOOL WINAPI GetVolumeInformationW(LPCWSTR,LPWSTR,DWORD,LPDWORD,LPDWORD,LPDWORD,LPWSTR,DWORD); #define GetVolumeInformation WINELIB_NAME_AW(GetVolumeInformation) UINT WINAPI GetWindowsDirectoryA(LPSTR,UINT); UINT WINAPI GetWindowsDirectoryW(LPWSTR,UINT); #define GetWindowsDirectory WINELIB_NAME_AW(GetWindowsDirectory) HGLOBAL16 WINAPI GlobalAlloc16(UINT16,DWORD); HGLOBAL WINAPI GlobalAlloc(UINT,DWORD); DWORD WINAPI GlobalCompact(DWORD); UINT WINAPI GlobalFlags(HGLOBAL); HGLOBAL16 WINAPI GlobalFree16(HGLOBAL16); HGLOBAL WINAPI GlobalFree(HGLOBAL); HGLOBAL WINAPI GlobalHandle(LPCVOID); WORD WINAPI GlobalFix16(HGLOBAL16); VOID WINAPI GlobalFix(HGLOBAL); LPVOID WINAPI GlobalLock16(HGLOBAL16); LPVOID WINAPI GlobalLock(HGLOBAL); HGLOBAL WINAPI GlobalReAlloc(HGLOBAL,DWORD,UINT); DWORD WINAPI GlobalSize16(HGLOBAL16); DWORD WINAPI GlobalSize(HGLOBAL); VOID WINAPI GlobalUnfix16(HGLOBAL16); VOID WINAPI GlobalUnfix(HGLOBAL); WIN_BOOL16 WINAPI GlobalUnlock16(HGLOBAL16); WIN_BOOL WINAPI GlobalUnlock(HGLOBAL); WIN_BOOL16 WINAPI GlobalUnWire16(HGLOBAL16); WIN_BOOL WINAPI GlobalUnWire(HGLOBAL); SEGPTR WINAPI GlobalWire16(HGLOBAL16); LPVOID WINAPI GlobalWire(HGLOBAL); WIN_BOOL WINAPI InitAtomTable(DWORD); WIN_BOOL WINAPI IsBadCodePtr(FARPROC); WIN_BOOL WINAPI IsBadHugeReadPtr(LPCVOID,UINT); WIN_BOOL WINAPI IsBadHugeWritePtr(LPVOID,UINT); WIN_BOOL WINAPI IsBadReadPtr(LPCVOID,UINT); WIN_BOOL WINAPI IsBadStringPtrA(LPCSTR,UINT); WIN_BOOL WINAPI IsBadStringPtrW(LPCWSTR,UINT); #define IsBadStringPtr WINELIB_NAME_AW(IsBadStringPtr) WIN_BOOL WINAPI IsBadWritePtr(LPVOID,UINT); WIN_BOOL WINAPI IsDBCSLeadByte(BYTE); WIN_BOOL WINAPI IsDebuggerPresent(void); HINSTANCE16 WINAPI LoadLibrary16(LPCSTR); HMODULE WINAPI LoadLibraryA(LPCSTR); HMODULE WINAPI LoadLibraryW(LPCWSTR); #define LoadLibrary WINELIB_NAME_AW(LoadLibrary) HMODULE WINAPI LoadLibraryExA(LPCSTR,HANDLE,DWORD); HMODULE WINAPI LoadLibraryExW(LPCWSTR,HANDLE,DWORD); #define LoadLibraryEx WINELIB_NAME_AW(LoadLibraryEx) HINSTANCE16 WINAPI LoadModule16(LPCSTR,LPVOID); HINSTANCE WINAPI LoadModule(LPCSTR,LPVOID); HGLOBAL WINAPI LoadResource(HMODULE,HRSRC); HLOCAL WINAPI LocalAlloc(UINT,DWORD); UINT WINAPI LocalCompact(UINT); UINT WINAPI LocalFlags(HLOCAL); HLOCAL WINAPI LocalFree(HLOCAL); HLOCAL WINAPI LocalHandle(LPCVOID); LPVOID WINAPI LocalLock(HLOCAL); HLOCAL WINAPI LocalReAlloc(HLOCAL,DWORD,UINT); UINT WINAPI LocalShrink(HGLOBAL,UINT); UINT WINAPI LocalSize(HLOCAL); WIN_BOOL WINAPI LocalUnlock(HLOCAL); LPVOID WINAPI LockResource(HGLOBAL); #define LockSegment(handle) GlobalFix((HANDLE)(handle)) #define MakeProcInstance(proc,inst) (proc) HFILE16 WINAPI OpenFile16(LPCSTR,OFSTRUCT*,UINT16); HFILE WINAPI OpenFile(LPCSTR,OFSTRUCT*,UINT); VOID WINAPI OutputDebugStringA(LPCSTR); VOID WINAPI OutputDebugStringW(LPCWSTR); #define OutputDebugString WINELIB_NAME_AW(OutputDebugString) WIN_BOOL WINAPI ReadProcessMemory(HANDLE, LPCVOID, LPVOID, DWORD, LPDWORD); WIN_BOOL WINAPI RemoveDirectoryA(LPCSTR); WIN_BOOL WINAPI RemoveDirectoryW(LPCWSTR); #define RemoveDirectory WINELIB_NAME_AW(RemoveDirectory) WIN_BOOL WINAPI SetCurrentDirectoryA(LPCSTR); WIN_BOOL WINAPI SetCurrentDirectoryW(LPCWSTR); #define SetCurrentDirectory WINELIB_NAME_AW(SetCurrentDirectory) UINT WINAPI SetErrorMode(UINT); WIN_BOOL WINAPI SetFileAttributesA(LPCSTR,DWORD); WIN_BOOL WINAPI SetFileAttributesW(LPCWSTR,DWORD); #define SetFileAttributes WINELIB_NAME_AW(SetFileAttributes) UINT WINAPI SetHandleCount(UINT); #define SetSwapAreaSize(w) (w) WIN_BOOL WINAPI SetVolumeLabelA(LPCSTR,LPCSTR); WIN_BOOL WINAPI SetVolumeLabelW(LPCWSTR,LPCWSTR); #define SetVolumeLabel WINELIB_NAME_AW(SetVolumeLabel) DWORD WINAPI SizeofResource(HMODULE,HRSRC); #define UnlockSegment(handle) GlobalUnfix((HANDLE)(handle)) WIN_BOOL WINAPI WritePrivateProfileSectionA(LPCSTR,LPCSTR,LPCSTR); WIN_BOOL WINAPI WritePrivateProfileSectionW(LPCWSTR,LPCWSTR,LPCWSTR); #define WritePrivateProfileSection WINELIB_NAME_AW(WritePrivateProfileSection) WIN_BOOL WINAPI WritePrivateProfileStringA(LPCSTR,LPCSTR,LPCSTR,LPCSTR); WIN_BOOL WINAPI WritePrivateProfileStringW(LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR); #define WritePrivateProfileString WINELIB_NAME_AW(WritePrivateProfileString) WIN_BOOL WINAPI WriteProfileSectionA(LPCSTR,LPCSTR); WIN_BOOL WINAPI WriteProfileSectionW(LPCWSTR,LPCWSTR); #define WritePrivateProfileSection WINELIB_NAME_AW(WritePrivateProfileSection) WIN_BOOL WINAPI WritePrivateProfileStructA(LPCSTR,LPCSTR,LPVOID,UINT,LPCSTR); WIN_BOOL WINAPI WritePrivateProfileStructW(LPCWSTR,LPCWSTR,LPVOID,UINT,LPCWSTR); #define WritePrivateProfileStruct WINELIB_NAME_AW(WritePrivateProfileStruct) WIN_BOOL WINAPI WriteProcessMemory(HANDLE, LPVOID, LPVOID, DWORD, LPDWORD); WIN_BOOL WINAPI WriteProfileStringA(LPCSTR,LPCSTR,LPCSTR); WIN_BOOL WINAPI WriteProfileStringW(LPCWSTR,LPCWSTR,LPCWSTR); #define WriteProfileString WINELIB_NAME_AW(WriteProfileString) #define Yield32() LPSTR WINAPI lstrcatA(LPSTR,LPCSTR); LPWSTR WINAPI lstrcatW(LPWSTR,LPCWSTR); #define lstrcat WINELIB_NAME_AW(lstrcat) LPSTR WINAPI lstrcpyA(LPSTR,LPCSTR); LPWSTR WINAPI lstrcpyW(LPWSTR,LPCWSTR); #define lstrcpy WINELIB_NAME_AW(lstrcpy) LPSTR WINAPI lstrcpynA(LPSTR,LPCSTR,INT); LPWSTR WINAPI lstrcpynW(LPWSTR,LPCWSTR,INT); #define lstrcpyn WINELIB_NAME_AW(lstrcpyn) INT WINAPI lstrlenA(LPCSTR); INT WINAPI lstrlenW(LPCWSTR); #define lstrlen WINELIB_NAME_AW(lstrlen) HINSTANCE WINAPI WinExec(LPCSTR,UINT); LONG WINAPI _hread(HFILE,LPVOID,LONG); LONG WINAPI _hwrite(HFILE,LPCSTR,LONG); HFILE WINAPI _lcreat(LPCSTR,INT); HFILE WINAPI _lclose(HFILE); LONG WINAPI _llseek(HFILE,LONG,INT); HFILE WINAPI _lopen(LPCSTR,INT); UINT WINAPI _lread(HFILE,LPVOID,UINT); UINT WINAPI _lwrite(HFILE,LPCSTR,UINT); SEGPTR WINAPI WIN16_GlobalLock16(HGLOBAL16); INT WINAPI lstrcmpA(LPCSTR,LPCSTR); INT WINAPI lstrcmpW(LPCWSTR,LPCWSTR); #define lstrcmp WINELIB_NAME_AW(lstrcmp) INT WINAPI lstrcmpiA(LPCSTR,LPCSTR); INT WINAPI lstrcmpiW(LPCWSTR,LPCWSTR); #define lstrcmpi WINELIB_NAME_AW(lstrcmpi) /* compatibility macros */ #define FillMemory RtlFillMemory #define MoveMemory RtlMoveMemory #define ZeroMemory RtlZeroMemory #define CopyMemory RtlCopyMemory DWORD WINAPI GetCurrentProcessId(void); DWORD WINAPI GetCurrentThreadId(void); DWORD WINAPI GetLastError(void); HANDLE WINAPI GetProcessHeap(void); PVOID WINAPI InterlockedCompareExchange(PVOID*,PVOID,PVOID); LONG WINAPI InterlockedDecrement(PLONG); LONG WINAPI InterlockedExchange(PLONG,LONG); LONG WINAPI InterlockedExchangeAdd(PLONG,LONG); LONG WINAPI InterlockedIncrement(PLONG); VOID WINAPI SetLastError(DWORD); #ifdef __WINE__ #define GetCurrentProcess() ((HANDLE)0xffffffff) #define GetCurrentThread() ((HANDLE)0xfffffffe) #endif #ifdef __cplusplus } #endif #endif /* __WINE_WINBASE_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/windef.h0000644000175000017500000004404707547603652022737 0ustar yavoryavor/* * Basic types definitions * * Copyright 1996 Alexandre Julliard */ #ifndef __WINE_WINDEF_H #define __WINE_WINDEF_H #ifdef __WINE__ # include "config.h" # undef UNICODE #endif #ifdef _EGCS_ #define __stdcall #endif #ifdef __cplusplus extern "C" { #endif /* Misc. constants. */ #ifdef FALSE #undef FALSE #endif #define FALSE 0 #ifdef TRUE #undef TRUE #endif #define TRUE 1 #ifdef NULL #undef NULL #endif #define NULL 0 /* Macros to map Winelib names to the correct implementation name */ /* depending on __WINE__ and UNICODE macros. */ /* Note that Winelib is purely Win32. */ #ifdef __WINE__ # define WINELIB_NAME_AW(func) \ func##_must_be_suffixed_with_W_or_A_in_this_context \ func##_must_be_suffixed_with_W_or_A_in_this_context #else /* __WINE__ */ # ifdef UNICODE # define WINELIB_NAME_AW(func) func##W # else # define WINELIB_NAME_AW(func) func##A # endif /* UNICODE */ #endif /* __WINE__ */ #ifdef __WINE__ # define DECL_WINELIB_TYPE_AW(type) /* nothing */ #else /* __WINE__ */ # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type; #endif /* __WINE__ */ #ifndef NONAMELESSSTRUCT # if defined(__WINE__) || !defined(_FORCENAMELESSSTRUCT) # define NONAMELESSSTRUCT # endif #endif /* !defined(NONAMELESSSTRUCT) */ #ifndef NONAMELESSUNION # if defined(__WINE__) || !defined(_FORCENAMELESSUNION) || !defined(__cplusplus) # define NONAMELESSUNION # endif #endif /* !defined(NONAMELESSUNION) */ #ifndef NONAMELESSSTRUCT #define DUMMYSTRUCTNAME #define DUMMYSTRUCTNAME1 #define DUMMYSTRUCTNAME2 #define DUMMYSTRUCTNAME3 #define DUMMYSTRUCTNAME4 #define DUMMYSTRUCTNAME5 #else /* !defined(NONAMELESSSTRUCT) */ #define DUMMYSTRUCTNAME s #define DUMMYSTRUCTNAME1 s1 #define DUMMYSTRUCTNAME2 s2 #define DUMMYSTRUCTNAME3 s3 #define DUMMYSTRUCTNAME4 s4 #define DUMMYSTRUCTNAME5 s5 #endif /* !defined(NONAMELESSSTRUCT) */ #ifndef NONAMELESSUNION #define DUMMYUNIONNAME #define DUMMYUNIONNAME1 #define DUMMYUNIONNAME2 #define DUMMYUNIONNAME3 #define DUMMYUNIONNAME4 #define DUMMYUNIONNAME5 #else /* !defined(NONAMELESSUNION) */ #define DUMMYUNIONNAME u #define DUMMYUNIONNAME1 u1 #define DUMMYUNIONNAME2 u2 #define DUMMYUNIONNAME3 u3 #define DUMMYUNIONNAME4 u4 #define DUMMYUNIONNAME5 u5 #endif /* !defined(NONAMELESSUNION) */ /* Calling conventions definitions */ #ifdef __i386__ # if defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) # ifndef _EGCS_ #define __stdcall __attribute__((__stdcall__)) #define __cdecl __attribute__((__cdecl__)) # define __RESTORE_ES __asm__ __volatile__("pushl %ds\n\tpopl %es") # endif # else // # error You need gcc >= 2.7 to build Wine on a 386 # endif #else # define __stdcall # define __cdecl # define __RESTORE_ES #endif #define CALLBACK __stdcall #define WINAPI __stdcall #define APIPRIVATE __stdcall #define PASCAL __stdcall #define pascal __stdcall #define _pascal __stdcall #define _stdcall __stdcall #define _fastcall __stdcall #define __fastcall __stdcall #define __export __stdcall #define CDECL __cdecl #define _CDECL __cdecl #define cdecl __cdecl #define _cdecl __cdecl #define WINAPIV __cdecl #define APIENTRY WINAPI #define __declspec(x) #define dllimport #define dllexport #define CONST const /* Standard data types. These are the same for emulator and library. */ typedef void VOID; typedef int INT; typedef unsigned int UINT; typedef unsigned short WORD; typedef unsigned long DWORD; typedef unsigned long ULONG; typedef unsigned char BYTE; typedef long LONG; typedef short SHORT; typedef unsigned short USHORT; typedef char CHAR; typedef unsigned char UCHAR; typedef LONG SCODE; /* Some systems might have wchar_t, but we really need 16 bit characters */ typedef unsigned short WCHAR; typedef int WIN_BOOL; typedef double DATE; typedef double DOUBLE; typedef long long LONGLONG; typedef unsigned long long ULONGLONG; /* FIXME: Wine does not compile with strict on, therefore strict * handles are presently only usable on machines where sizeof(UINT) == * sizeof(void*). HANDLEs are supposed to be void* but a large amount * of WINE code operates on HANDLES as if they are UINTs. So to WINE * they exist as UINTs but to the Winelib user who turns on strict, * they exist as void*. If there is a size difference between UINT and * void* then things get ugly. */ #ifdef STRICT typedef VOID* HANDLE; #else typedef UINT HANDLE; #endif typedef HANDLE *LPHANDLE; /* Integer types. These are the same for emulator and library. */ typedef UINT WPARAM; typedef LONG LPARAM; typedef LONG HRESULT; typedef LONG LRESULT; typedef WORD ATOM; typedef WORD CATCHBUF[9]; typedef WORD *LPCATCHBUF; typedef HANDLE HHOOK; typedef HANDLE HMONITOR; typedef DWORD LCID; typedef WORD LANGID; typedef DWORD LCTYPE; typedef float FLOAT; /* Pointers types. These are the same for emulator and library. */ /* winnt types */ typedef VOID *PVOID; typedef const void *PCVOID; typedef CHAR *PCHAR; typedef UCHAR *PUCHAR; typedef BYTE *PBYTE; typedef WORD *PWORD; typedef USHORT *PUSHORT; typedef SHORT *PSHORT; typedef ULONG *PULONG; typedef LONG *PLONG; typedef DWORD *PDWORD; /* common win32 types */ typedef CHAR *LPSTR; typedef CHAR *PSTR; typedef const CHAR *LPCSTR; typedef const CHAR *PCSTR; typedef WCHAR *LPWSTR; typedef WCHAR *PWSTR; typedef const WCHAR *LPCWSTR; typedef const WCHAR *PCWSTR; typedef BYTE *LPBYTE; typedef WORD *LPWORD; typedef DWORD *LPDWORD; typedef LONG *LPLONG; typedef VOID *LPVOID; typedef const VOID *LPCVOID; typedef INT *PINT; typedef INT *LPINT; typedef UINT *PUINT; typedef UINT *LPUINT; typedef FLOAT *PFLOAT; typedef FLOAT *LPFLOAT; typedef WIN_BOOL *PWIN_BOOL; typedef WIN_BOOL *LPWIN_BOOL; /* Special case: a segmented pointer is just a pointer in the user's code. */ #ifdef __WINE__ typedef DWORD SEGPTR; #else typedef void* SEGPTR; #endif /* __WINE__ */ /* Handle types that exist both in Win16 and Win32. */ #ifdef STRICT #define DECLARE_HANDLE(a) \ typedef struct a##__ { int unused; } *a; \ typedef a *P##a; \ typedef a *LP##a #else /*STRICT*/ #define DECLARE_HANDLE(a) \ typedef HANDLE a; \ typedef a *P##a; \ typedef a *LP##a #endif /*STRICT*/ DECLARE_HANDLE(HACMDRIVERID); DECLARE_HANDLE(HACMDRIVER); DECLARE_HANDLE(HACMOBJ); DECLARE_HANDLE(HACMSTREAM); DECLARE_HANDLE(HMETAFILEPICT); DECLARE_HANDLE(HACCEL); DECLARE_HANDLE(HBITMAP); DECLARE_HANDLE(HBRUSH); DECLARE_HANDLE(HCOLORSPACE); DECLARE_HANDLE(HCURSOR); DECLARE_HANDLE(HDC); DECLARE_HANDLE(HDROP); DECLARE_HANDLE(HDRVR); DECLARE_HANDLE(HDWP); DECLARE_HANDLE(HENHMETAFILE); DECLARE_HANDLE(HFILE); DECLARE_HANDLE(HFONT); DECLARE_HANDLE(HICON); DECLARE_HANDLE(HINSTANCE); DECLARE_HANDLE(HKEY); DECLARE_HANDLE(HMENU); DECLARE_HANDLE(HMETAFILE); DECLARE_HANDLE(HMIDI); DECLARE_HANDLE(HMIDIIN); DECLARE_HANDLE(HMIDIOUT); DECLARE_HANDLE(HMIDISTRM); DECLARE_HANDLE(HMIXER); DECLARE_HANDLE(HMIXEROBJ); DECLARE_HANDLE(HMMIO); DECLARE_HANDLE(HPALETTE); DECLARE_HANDLE(HPEN); DECLARE_HANDLE(HQUEUE); DECLARE_HANDLE(HRGN); DECLARE_HANDLE(HRSRC); DECLARE_HANDLE(HTASK); DECLARE_HANDLE(HWAVE); DECLARE_HANDLE(HWAVEIN); DECLARE_HANDLE(HWAVEOUT); DECLARE_HANDLE(HWINSTA); DECLARE_HANDLE(HDESK); DECLARE_HANDLE(HWND); DECLARE_HANDLE(HKL); DECLARE_HANDLE(HIC); DECLARE_HANDLE(HRASCONN); /* Handle types that must remain interchangeable even with strict on */ typedef HINSTANCE HMODULE; typedef HANDLE HGDIOBJ; typedef HANDLE HGLOBAL; typedef HANDLE HLOCAL; typedef HANDLE GLOBALHANDLE; typedef HANDLE LOCALHANDLE; /* Callback function pointers types */ //WIN_BOOL CALLBACK DATEFMT_ENUMPROCA(LPSTR); typedef WIN_BOOL CALLBACK (* DATEFMT_ENUMPROCA)(LPSTR); typedef WIN_BOOL CALLBACK (* DATEFMT_ENUMPROCW)(LPWSTR); DECL_WINELIB_TYPE_AW(DATEFMT_ENUMPROC) typedef WIN_BOOL CALLBACK (*DLGPROC)(HWND,UINT,WPARAM,LPARAM); typedef LRESULT CALLBACK (*DRIVERPROC)(DWORD,HDRVR,UINT,LPARAM,LPARAM); typedef INT CALLBACK (*EDITWORDBREAKPROCA)(LPSTR,INT,INT,INT); typedef INT CALLBACK (*EDITWORDBREAKPROCW)(LPWSTR,INT,INT,INT); DECL_WINELIB_TYPE_AW(EDITWORDBREAKPROC) typedef LRESULT CALLBACK (*FARPROC)(void); typedef INT CALLBACK (*PROC)(void); typedef WIN_BOOL CALLBACK (*GRAYSTRINGPROC)(HDC,LPARAM,INT); typedef LRESULT CALLBACK (*HOOKPROC)(INT,WPARAM,LPARAM); typedef WIN_BOOL CALLBACK (*PROPENUMPROCA)(HWND,LPCSTR,HANDLE); typedef WIN_BOOL CALLBACK (*PROPENUMPROCW)(HWND,LPCWSTR,HANDLE); DECL_WINELIB_TYPE_AW(PROPENUMPROC) typedef WIN_BOOL CALLBACK (*PROPENUMPROCEXA)(HWND,LPCSTR,HANDLE,LPARAM); typedef WIN_BOOL CALLBACK (*PROPENUMPROCEXW)(HWND,LPCWSTR,HANDLE,LPARAM); DECL_WINELIB_TYPE_AW(PROPENUMPROCEX) typedef WIN_BOOL CALLBACK (* TIMEFMT_ENUMPROCA)(LPSTR); typedef WIN_BOOL CALLBACK (* TIMEFMT_ENUMPROCW)(LPWSTR); DECL_WINELIB_TYPE_AW(TIMEFMT_ENUMPROC) typedef VOID CALLBACK (*TIMERPROC)(HWND,UINT,UINT,DWORD); typedef WIN_BOOL CALLBACK (*WNDENUMPROC)(HWND,LPARAM); typedef LRESULT CALLBACK (*WNDPROC)(HWND,UINT,WPARAM,LPARAM); /*---------------------------------------------------------------------------- ** FIXME: Better isolate Wine's reliance on the xxx16 type definitions. ** For now, we just isolate them to make the situation clear. **--------------------------------------------------------------------------*/ /* * Basic type definitions for 16 bit variations on Windows types. * These types are provided mostly to insure compatibility with * 16 bit windows code. */ #ifndef __WINE_WINDEF16_H #define __WINE_WINDEF16_H #include "windef.h" /* Standard data types */ typedef short INT16; typedef unsigned short UINT16; typedef unsigned short WIN_BOOL16; typedef UINT16 HANDLE16; typedef HANDLE16 *LPHANDLE16; typedef UINT16 WPARAM16; typedef INT16 *LPINT16; typedef UINT16 *LPUINT16; #define DECLARE_HANDLE16(a) \ typedef HANDLE16 a##16; \ typedef a##16 *P##a##16; \ typedef a##16 *NP##a##16; \ typedef a##16 *LP##a##16 DECLARE_HANDLE16(HACMDRIVERID); DECLARE_HANDLE16(HACMDRIVER); DECLARE_HANDLE16(HACMOBJ); DECLARE_HANDLE16(HACMSTREAM); DECLARE_HANDLE16(HMETAFILEPICT); DECLARE_HANDLE16(HACCEL); DECLARE_HANDLE16(HBITMAP); DECLARE_HANDLE16(HBRUSH); DECLARE_HANDLE16(HCOLORSPACE); DECLARE_HANDLE16(HCURSOR); DECLARE_HANDLE16(HDC); DECLARE_HANDLE16(HDROP); DECLARE_HANDLE16(HDRVR); DECLARE_HANDLE16(HDWP); DECLARE_HANDLE16(HENHMETAFILE); DECLARE_HANDLE16(HFILE); DECLARE_HANDLE16(HFONT); DECLARE_HANDLE16(HICON); DECLARE_HANDLE16(HINSTANCE); DECLARE_HANDLE16(HKEY); DECLARE_HANDLE16(HMENU); DECLARE_HANDLE16(HMETAFILE); DECLARE_HANDLE16(HMIDI); DECLARE_HANDLE16(HMIDIIN); DECLARE_HANDLE16(HMIDIOUT); DECLARE_HANDLE16(HMIDISTRM); DECLARE_HANDLE16(HMIXER); DECLARE_HANDLE16(HMIXEROBJ); DECLARE_HANDLE16(HMMIO); DECLARE_HANDLE16(HPALETTE); DECLARE_HANDLE16(HPEN); DECLARE_HANDLE16(HQUEUE); DECLARE_HANDLE16(HRGN); DECLARE_HANDLE16(HRSRC); DECLARE_HANDLE16(HTASK); DECLARE_HANDLE16(HWAVE); DECLARE_HANDLE16(HWAVEIN); DECLARE_HANDLE16(HWAVEOUT); DECLARE_HANDLE16(HWINSTA); DECLARE_HANDLE16(HDESK); DECLARE_HANDLE16(HWND); DECLARE_HANDLE16(HKL); DECLARE_HANDLE16(HIC); DECLARE_HANDLE16(HRASCONN); #undef DECLARE_HANDLE16 typedef HINSTANCE16 HMODULE16; typedef HANDLE16 HGDIOBJ16; typedef HANDLE16 HGLOBAL16; typedef HANDLE16 HLOCAL16; /* The SIZE structure */ typedef struct { INT16 cx; INT16 cy; } SIZE16, *PSIZE16, *LPSIZE16; /* The POINT structure */ typedef struct { INT16 x; INT16 y; } POINT16, *PPOINT16, *LPPOINT16; /* The RECT structure */ typedef struct { INT16 left; INT16 top; INT16 right; INT16 bottom; } RECT16, *LPRECT16; /* Callback function pointers types */ typedef LRESULT CALLBACK (*DRIVERPROC16)(DWORD,HDRVR16,UINT16,LPARAM,LPARAM); typedef WIN_BOOL16 CALLBACK (*DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM); typedef INT16 CALLBACK (*EDITWORDBREAKPROC16)(LPSTR,INT16,INT16,INT16); typedef LRESULT CALLBACK (*FARPROC16)(void); typedef INT16 CALLBACK (*PROC16)(void); typedef WIN_BOOL16 CALLBACK (*GRAYSTRINGPROC16)(HDC16,LPARAM,INT16); typedef LRESULT CALLBACK (*HOOKPROC16)(INT16,WPARAM16,LPARAM); typedef WIN_BOOL16 CALLBACK (*PROPENUMPROC16)(HWND16,SEGPTR,HANDLE16); typedef VOID CALLBACK (*TIMERPROC16)(HWND16,UINT16,UINT16,DWORD); typedef LRESULT CALLBACK (*WNDENUMPROC16)(HWND16,LPARAM); typedef LRESULT CALLBACK (*WNDPROC16)(HWND16,UINT16,WPARAM16,LPARAM); #endif /* __WINE_WINDEF16_H */ /* Define some empty macros for compatibility with Windows code. */ #ifndef __WINE__ #define NEAR #define FAR #define near #define far #define _near #define _far #define IN #define OUT #define OPTIONAL #endif /* __WINE__ */ /* Macro for structure packing. */ #ifdef __GNUC__ #ifndef _EGCS_ #define WINE_PACKED __attribute__((packed)) #define WINE_UNUSED __attribute__((unused)) #define WINE_NORETURN __attribute__((noreturn)) #endif #else #define WINE_PACKED /* nothing */ #define WINE_UNUSED /* nothing */ #define WINE_NORETURN /* nothing */ #endif /* Macros to split words and longs. */ #define LOBYTE(w) ((BYTE)(WORD)(w)) #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8)) #define LOWORD(l) ((WORD)(DWORD)(l)) #define HIWORD(l) ((WORD)((DWORD)(l) >> 16)) #define SLOWORD(l) ((INT16)(LONG)(l)) #define SHIWORD(l) ((INT16)((LONG)(l) >> 16)) #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8)) #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16))) #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high)) #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high)) #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high)) #define MAKEINTATOM(atom) ((LPCSTR)MAKELONG((atom),0)) #define SELECTOROF(ptr) (HIWORD(ptr)) #define OFFSETOF(ptr) (LOWORD(ptr)) #ifdef __WINE__ /* macros to set parts of a DWORD (not in the Windows API) */ #define SET_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD(val)) #define SET_LOBYTE(dw,val) ((dw) = ((dw) & 0xffffff00) | LOBYTE(val)) #define SET_HIBYTE(dw,val) ((dw) = ((dw) & 0xffff00ff) | (LOWORD(val) & 0xff00)) #define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val))) #endif /* Macros to access unaligned or wrong-endian WORDs and DWORDs. */ /* Note: These macros are semantically broken, at least for wrc. wrc spits out data in the platform's current binary format, *not* in little-endian format. These macros are used throughout the resource code to load and store data to the resources. Since it is unlikely that we'll ever be dealing with little-endian resource data, the byte-swapping nature of these macros has been disabled. Rather than remove the use of these macros from the resource loading code, the macros have simply been disabled. In the future, someone may want to reactivate these macros for other purposes. In that case, the resource code will have to be modified to use different macros. */ #if 1 #define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w)) #define GET_WORD(ptr) (*(WORD *)(ptr)) #define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw)) #define GET_DWORD(ptr) (*(DWORD *)(ptr)) #else #define PUT_WORD(ptr,w) (*(BYTE *)(ptr) = LOBYTE(w), \ *((BYTE *)(ptr) + 1) = HIBYTE(w)) #define GET_WORD(ptr) ((WORD)(*(BYTE *)(ptr) | \ (WORD)(*((BYTE *)(ptr)+1) << 8))) #define PUT_DWORD(ptr,dw) (PUT_WORD((ptr),LOWORD(dw)), \ PUT_WORD((WORD *)(ptr)+1,HIWORD(dw))) #define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \ ((DWORD)GET_WORD((WORD *)(ptr)+1) << 16))) #endif /* 1 */ /* min and max macros */ #define __max(a,b) (((a) > (b)) ? (a) : (b)) #define __min(a,b) (((a) < (b)) ? (a) : (b)) #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif #define _MAX_PATH 260 #define MAX_PATH 260 #define _MAX_DRIVE 3 #define _MAX_DIR 256 #define _MAX_FNAME 255 #define _MAX_EXT 256 #define HFILE_ERROR16 ((HFILE16)-1) #define HFILE_ERROR ((HFILE)-1) /* The SIZE structure */ typedef struct tagSIZE { INT cx; INT cy; } SIZE, *PSIZE, *LPSIZE; typedef SIZE SIZEL, *PSIZEL, *LPSIZEL; #define CONV_SIZE16TO32(s16,s32) \ ((s32)->cx = (INT)(s16)->cx, (s32)->cy = (INT)(s16)->cy) #define CONV_SIZE32TO16(s32,s16) \ ((s16)->cx = (INT16)(s32)->cx, (s16)->cy = (INT16)(s32)->cy) /* The POINT structure */ typedef struct tagPOINT { LONG x; LONG y; } POINT, *PPOINT, *LPPOINT; typedef struct _POINTL { LONG x; LONG y; } POINTL; #define CONV_POINT16TO32(p16,p32) \ ((p32)->x = (INT)(p16)->x, (p32)->y = (INT)(p16)->y) #define CONV_POINT32TO16(p32,p16) \ ((p16)->x = (INT16)(p32)->x, (p16)->y = (INT16)(p32)->y) #define MAKEPOINT16(l) (*((POINT16 *)&(l))) /* The POINTS structure */ typedef struct tagPOINTS { SHORT x; SHORT y; } POINTS, *PPOINTS, *LPPOINTS; #define MAKEPOINTS(l) (*((POINTS *)&(l))) /* The RECT structure */ typedef struct tagRECT { short left; short top; short right; short bottom; } RECT, *PRECT, *LPRECT; typedef const RECT *LPCRECT; typedef struct tagRECTL { LONG left; LONG top; LONG right; LONG bottom; } RECTL, *PRECTL, *LPRECTL; typedef const RECTL *LPCRECTL; #define CONV_RECT16TO32(r16,r32) \ ((r32)->left = (INT)(r16)->left, (r32)->top = (INT)(r16)->top, \ (r32)->right = (INT)(r16)->right, (r32)->bottom = (INT)(r16)->bottom) #define CONV_RECT32TO16(r32,r16) \ ((r16)->left = (INT16)(r32)->left, (r16)->top = (INT16)(r32)->top, \ (r16)->right = (INT16)(r32)->right, (r16)->bottom = (INT16)(r32)->bottom) #ifdef __cplusplus } #endif #endif /* __WINE_WINDEF_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/windows.h0000644000175000017500000000123707233220476023136 0ustar yavoryavor#ifndef __WINE_WINDOWS_H #define __WINE_WINDOWS_H #ifdef __cplusplus extern "C" { #endif #include "windef.h" #include "winbase.h" #include "winuser.h" #include "shell.h" #include "winreg.h" #include "winnetwk.h" #include "winver.h" #include "lzexpand.h" #include "shellapi.h" #include "ole2.h" #include "winnls.h" #include "objbase.h" #include "winspool.h" #if 0 Where does this belong? Nobody uses this stuff anyway. typedef struct { BYTE i; /* much more .... */ } KANJISTRUCT; typedef KANJISTRUCT *LPKANJISTRUCT; typedef KANJISTRUCT *NPKANJISTRUCT; typedef KANJISTRUCT *PKANJISTRUCT; #endif /* 0 */ #ifdef __cplusplus } #endif #endif /* __WINE_WINDOWS_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/winerror.h0000644000175000017500000030122307233220504023301 0ustar yavoryavor#ifndef __WINE_WINERROR_H #define __WINE_WINERROR_H extern int WIN32_LastError; #define FACILITY_NULL 0 #define FACILITY_RPC 1 #define FACILITY_DISPATCH 2 #define FACILITY_STORAGE 3 #define FACILITY_ITF 4 #define FACILITY_WIN32 7 #define FACILITY_WINDOWS 8 #define FACILITY_SSPI 9 #define FACILITY_CONTROL 10 #define FACILITY_CERT 11 #define FACILITY_INTERNET 12 #define SEVERITY_ERROR 1 #define MAKE_HRESULT(sev,fac,code) \ ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) ) #define MAKE_SCODE(sev,fac,code) \ ((SCODE) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) ) #define SUCCEEDED(stat) ((HRESULT)(stat)>=0) #define FAILED(stat) ((HRESULT)(stat)<0) #define HRESULT_CODE(hr) ((hr) & 0xFFFF) #define SCODE_CODE(sc) ((sc) & 0xFFFF) #define HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1FFF) #define SCODE_FACILITY(sc) (((sc) >> 16) & 0x1FFF) /* ERROR_UNKNOWN is a placeholder for error conditions which haven't * been tested yet so we're not exactly sure what will be returned. * All instances of ERROR_UNKNOWN should be tested under Win95/NT * and replaced. */ #define ERROR_UNKNOWN 99999 #define SEVERITY_SUCCESS 0 #define SEVERITY_ERROR 1 #define NO_ERROR 0 #define ERROR_SUCCESS 0 #define ERROR_INVALID_FUNCTION 1 #define ERROR_FILE_NOT_FOUND 2 #define ERROR_PATH_NOT_FOUND 3 #define ERROR_TOO_MANY_OPEN_FILES 4 #define ERROR_ACCESS_DENIED 5 #define ERROR_INVALID_HANDLE 6 #define ERROR_ARENA_TRASHED 7 #define ERROR_NOT_ENOUGH_MEMORY 8 #define ERROR_INVALID_BLOCK 9 #define ERROR_BAD_ENVIRONMENT 10 #define ERROR_BAD_FORMAT 11 #define ERROR_INVALID_ACCESS 12 #define ERROR_INVALID_DATA 13 #define ERROR_OUTOFMEMORY 14 #define ERROR_INVALID_DRIVE 15 #define ERROR_CURRENT_DIRECTORY 16 #define ERROR_NOT_SAME_DEVICE 17 #define ERROR_NO_MORE_FILES 18 #define ERROR_WRITE_PROTECT 19 #define ERROR_BAD_UNIT 20 #define ERROR_NOT_READY 21 #define ERROR_BAD_COMMAND 22 #define ERROR_CRC 23 #define ERROR_BAD_LENGTH 24 #define ERROR_SEEK 25 #define ERROR_NOT_DOS_DISK 26 #define ERROR_SECTOR_NOT_FOUND 27 #define ERROR_OUT_OF_PAPER 28 #define ERROR_WRITE_FAULT 29 #define ERROR_READ_FAULT 30 #define ERROR_GEN_FAILURE 31 #define ERROR_SHARING_VIOLATION 32 #define ERROR_LOCK_VIOLATION 33 #define ERROR_WRONG_DISK 34 #define ERROR_SHARING_BUFFER_EXCEEDED 36 #define ERROR_HANDLE_EOF 38 #define ERROR_HANDLE_DISK_FULL 39 #define ERROR_NOT_SUPPORTED 50 #define ERROR_REM_NOT_LIST 51 #define ERROR_DUP_NAME 52 #define ERROR_BAD_NETPATH 53 #define ERROR_NETWORK_BUSY 54 #define ERROR_DEV_NOT_EXIST 55 #define ERROR_TOO_MANY_CMDS 56 #define ERROR_ADAP_HDW_ERR 57 #define ERROR_BAD_NET_RESP 58 #define ERROR_UNEXP_NET_ERR 59 #define ERROR_BAD_REM_ADAP 60 #define ERROR_PRINTQ_FULL 61 #define ERROR_NO_SPOOL_SPACE 62 #define ERROR_PRINT_CANCELLED 63 #define ERROR_NETNAME_DELETED 64 #define ERROR_NETWORK_ACCESS_DENIED 65 #define ERROR_BAD_DEV_TYPE 66 #define ERROR_BAD_NET_NAME 67 #define ERROR_TOO_MANY_NAMES 68 #define ERROR_TOO_MANY_SESS 69 #define ERROR_SHARING_PAUSED 70 #define ERROR_REQ_NOT_ACCEP 71 #define ERROR_REDIR_PAUSED 72 #define ERROR_FILE_EXISTS 80 #define ERROR_CANNOT_MAKE 82 #define ERROR_FAIL_I24 83 #define ERROR_OUT_OF_STRUCTURES 84 #define ERROR_ALREADY_ASSIGNED 85 #define ERROR_INVALID_PASSWORD 86 #define ERROR_INVALID_PARAMETER 87 #define ERROR_NET_WRITE_FAULT 88 #define ERROR_NO_PROC_SLOTS 89 #define ERROR_TOO_MANY_SEMAPHORES 100 #define ERROR_EXCL_SEM_ALREADY_OWNED 101 #define ERROR_SEM_IS_SET 102 #define ERROR_TOO_MANY_SEM_REQUESTS 103 #define ERROR_INVALID_AT_INTERRUPT_TIME 104 #define ERROR_SEM_OWNER_DIED 105 #define ERROR_SEM_USER_LIMIT 106 #define ERROR_DISK_CHANGE 107 #define ERROR_DRIVE_LOCKED 108 #define ERROR_BROKEN_PIPE 109 #define ERROR_OPEN_FAILED 110 #define ERROR_BUFFER_OVERFLOW 111 #define ERROR_DISK_FULL 112 #define ERROR_NO_MORE_SEARCH_HANDLES 113 #define ERROR_INVALID_TARGET_HANDLE 114 #define ERROR_INVALID_CATEGORY 117 #define ERROR_INVALID_VERIFY_SWITCH 118 #define ERROR_BAD_DRIVER_LEVEL 119 #define ERROR_CALL_NOT_IMPLEMENTED 120 #define ERROR_SEM_TIMEOUT 121 #define ERROR_INSUFFICIENT_BUFFER 122 #define ERROR_INVALID_NAME 123 #define ERROR_INVALID_LEVEL 124 #define ERROR_NO_VOLUME_LABEL 125 #define ERROR_MOD_NOT_FOUND 126 #define ERROR_PROC_NOT_FOUND 127 #define ERROR_WAIT_NO_CHILDREN 128 #define ERROR_CHILD_NOT_COMPLETE 129 #define ERROR_DIRECT_ACCESS_HANDLE 130 #define ERROR_NEGATIVE_SEEK 131 #define ERROR_SEEK_ON_DEVICE 132 #define ERROR_IS_JOIN_TARGET 133 #define ERROR_IS_JOINED 134 #define ERROR_IS_SUBSTED 135 #define ERROR_NOT_JOINED 136 #define ERROR_NOT_SUBSTED 137 #define ERROR_JOIN_TO_JOIN 138 #define ERROR_SUBST_TO_SUBST 139 #define ERROR_JOIN_TO_SUBST 140 #define ERROR_SUBST_TO_JOIN 141 #define ERROR_BUSY_DRIVE 142 #define ERROR_SAME_DRIVE 143 #define ERROR_DIR_NOT_ROOT 144 #define ERROR_DIR_NOT_EMPTY 145 #define ERROR_IS_SUBST_PATH 146 #define ERROR_IS_JOIN_PATH 147 #define ERROR_PATH_BUSY 148 #define ERROR_IS_SUBST_TARGET 149 #define ERROR_SYSTEM_TRACE 150 #define ERROR_INVALID_EVENT_COUNT 151 #define ERROR_TOO_MANY_MUXWAITERS 152 #define ERROR_INVALID_LIST_FORMAT 153 #define ERROR_LABEL_TOO_LONG 154 #define ERROR_TOO_MANY_TCBS 155 #define ERROR_SIGNAL_REFUSED 156 #define ERROR_DISCARDED 157 #define ERROR_NOT_LOCKED 158 #define ERROR_BAD_THREADID_ADDR 159 #define ERROR_BAD_ARGUMENTS 160 #define ERROR_BAD_PATHNAME 161 #define ERROR_SIGNAL_PENDING 162 #define ERROR_MAX_THRDS_REACHED 164 #define ERROR_LOCK_FAILED 167 #define ERROR_BUSY 170 #define ERROR_CANCEL_VIOLATION 173 #define ERROR_ATOMIC_LOCKS_NOT_SUPPORTED 174 #define ERROR_INVALID_SEGMENT_NUMBER 180 #define ERROR_INVALID_ORDINAL 182 #define ERROR_ALREADY_EXISTS 183 #define ERROR_INVALID_FLAG_NUMBER 186 #define ERROR_SEM_NOT_FOUND 187 #define ERROR_INVALID_STARTING_CODESEG 188 #define ERROR_INVALID_STACKSEG 189 #define ERROR_INVALID_MODULETYPE 190 #define ERROR_INVALID_EXE_SIGNATURE 191 #define ERROR_EXE_MARKED_INVALID 192 #define ERROR_BAD_EXE_FORMAT 193 #define ERROR_ITERATED_DATA_EXCEEDS_64k 194 #define ERROR_INVALID_MINALLOCSIZE 195 #define ERROR_DYNLINK_FROM_INVALID_RING 196 #define ERROR_IOPL_NOT_ENABLED 197 #define ERROR_INVALID_SEGDPL 198 #define ERROR_AUTODATASEG_EXCEEDS_64k 199 #define ERROR_RING2SEG_MUST_BE_MOVABLE 200 #define ERROR_RELOC_CHAIN_XEEDS_SEGLIM 201 #define ERROR_INFLOOP_IN_RELOC_CHAIN 202 #define ERROR_ENVVAR_NOT_FOUND 203 #define ERROR_NO_SIGNAL_SENT 205 #define ERROR_FILENAME_EXCED_RANGE 206 #define ERROR_RING2_STACK_IN_USE 207 #define ERROR_META_EXPANSION_TOO_LONG 208 #define ERROR_INVALID_SIGNAL_NUMBER 209 #define ERROR_THREAD_1_INACTIVE 210 #define ERROR_LOCKED 212 #define ERROR_TOO_MANY_MODULES 214 #define ERROR_NESTING_NOT_ALLOWED 215 #define ERROR_EXE_MACHINE_TYPE_MISMATCH 216 #define ERROR_BAD_PIPE 230 #define ERROR_PIPE_BUSY 231 #define ERROR_NO_DATA 232 #define ERROR_PIPE_NOT_CONNECTED 233 #define ERROR_MORE_DATA 234 #define ERROR_VC_DISCONNECTED 240 #define ERROR_INVALID_EA_NAME 254 #define ERROR_EA_LIST_INCONSISTENT 255 #define ERROR_NO_MORE_ITEMS 259 #define ERROR_CANNOT_COPY 266 #define ERROR_DIRECTORY 267 #define ERROR_EAS_DIDNT_FIT 275 #define ERROR_EA_FILE_CORRUPT 276 #define ERROR_EA_TABLE_FULL 277 #define ERROR_INVALID_EA_HANDLE 278 #define ERROR_EAS_NOT_SUPPORTED 282 #define ERROR_NOT_OWNER 288 #define ERROR_TOO_MANY_POSTS 298 #define ERROR_PARTIAL_COPY 299 #define ERROR_OPLOCK_NOT_GRANTED 300 #define ERROR_INVALID_OPLOCK_PROTOCOL 301 #define ERROR_MR_MID_NOT_FOUND 317 #define ERROR_INVALID_ADDRESS 487 #define ERROR_ARITHMETIC_OVERFLOW 534 #define ERROR_PIPE_CONNECTED 535 #define ERROR_PIPE_LISTENING 536 #define ERROR_EA_ACCESS_DENIED 994 #define ERROR_OPERATION_ABORTED 995 #define ERROR_IO_INCOMPLETE 996 #define ERROR_IO_PENDING 997 #define ERROR_NOACCESS 998 #define ERROR_SWAPERROR 999 #define ERROR_STACK_OVERFLOW 1001 #define ERROR_INVALID_MESSAGE 1002 #define ERROR_CAN_NOT_COMPLETE 1003 #define ERROR_INVALID_FLAGS 1004 #define ERROR_UNRECOGNIZED_VOLUME 1005 #define ERROR_FILE_INVALID 1006 #define ERROR_FULLSCREEN_MODE 1007 #define ERROR_NO_TOKEN 1008 #define ERROR_BADDB 1009 #define ERROR_BADKEY 1010 #define ERROR_CANTOPEN 1011 #define ERROR_CANTREAD 1012 #define ERROR_CANTWRITE 1013 #define ERROR_REGISTRY_RECOVERED 1014 #define ERROR_REGISTRY_CORRUPT 1015 #define ERROR_REGISTRY_IO_FAILED 1016 #define ERROR_NOT_REGISTRY_FILE 1017 #define ERROR_KEY_DELETED 1018 #define ERROR_NO_LOG_SPACE 1019 #define ERROR_KEY_HAS_CHILDREN 1020 #define ERROR_CHILD_MUST_BE_VOLATILE 1021 #define ERROR_NOTIFY_ENUM_DIR 1022 #define ERROR_DEPENDENT_SERVICES_RUNNING 1051 #define ERROR_INVALID_SERVICE_CONTROL 1052 #define ERROR_SERVICE_REQUEST_TIMEOUT 1053 #define ERROR_SERVICE_NO_THREAD 1054 #define ERROR_SERVICE_DATABASE_LOCKED 1055 #define ERROR_SERVICE_ALREADY_RUNNING 1056 #define ERROR_INVALID_SERVICE_ACCOUNT 1057 #define ERROR_SERVICE_DISABLED 1058 #define ERROR_CIRCULAR_DEPENDENCY 1059 #define ERROR_SERVICE_DOES_NOT_EXIST 1060 #define ERROR_SERVICE_CANNOT_ACCEPT_CTRL 1061 #define ERROR_SERVICE_NOT_ACTIVE 1062 #define ERROR_FAILED_SERVICE_CONTROLLER_CONNECT 1063 #define ERROR_EXCEPTION_IN_SERVICE 1064 #define ERROR_DATABASE_DOES_NOT_EXIST 1065 #define ERROR_SERVICE_SPECIFIC_ERROR 1066 #define ERROR_PROCESS_ABORTED 1067 #define ERROR_SERVICE_DEPENDENCY_FAIL 1068 #define ERROR_SERVICE_LOGON_FAILED 1069 #define ERROR_SERVICE_START_HANG 1070 #define ERROR_INVALID_SERVICE_LOCK 1071 #define ERROR_SERVICE_MARKED_FOR_DELETE 1072 #define ERROR_SERVICE_EXISTS 1073 #define ERROR_ALREADY_RUNNING_LKG 1074 #define ERROR_SERVICE_DEPENDENCY_DELETED 1075 #define ERROR_BOOT_ALREADY_ACCEPTED 1076 #define ERROR_SERVICE_NEVER_STARTED 1077 #define ERROR_DUPLICATE_SERVICE_NAME 1078 #define ERROR_DIFFERENT_SERVICE_ACCOUNT 1079 #define ERROR_CANNOT_DETECT_DRIVER_FAILURE 1080 #define ERROR_CANNOT_DETECT_PROCESS_ABORT 1081 #define ERROR_NO_RECOVERY_PROGRAM 1082 #define ERROR_SERVICE_NOT_IN_EXE 1083 #define ERROR_END_OF_MEDIA 1100 #define ERROR_FILEMARK_DETECTED 1101 #define ERROR_BEGINNING_OF_MEDIA 1102 #define ERROR_SETMARK_DETECTED 1103 #define ERROR_NO_DATA_DETECTED 1104 #define ERROR_PARTITION_FAILURE 1105 #define ERROR_INVALID_BLOCK_LENGTH 1106 #define ERROR_DEVICE_NOT_PARTITIONED 1107 #define ERROR_UNABLE_TO_LOCK_MEDIA 1108 #define ERROR_UNABLE_TO_UNLOAD_MEDIA 1109 #define ERROR_MEDIA_CHANGED 1110 #define ERROR_BUS_RESET 1111 #define ERROR_NO_MEDIA_IN_DRIVE 1112 #define ERROR_NO_UNICODE_TRANSLATION 1113 #define ERROR_DLL_INIT_FAILED 1114 #define ERROR_SHUTDOWN_IN_PROGRESS 1115 #define ERROR_NO_SHUTDOWN_IN_PROGRESS 1116 #define ERROR_IO_DEVICE 1117 #define ERROR_SERIAL_NO_DEVICE 1118 #define ERROR_IRQ_BUSY 1119 #define ERROR_MORE_WRITES 1120 #define ERROR_COUNTER_TIMEOUT 1121 #define ERROR_FLOPPY_ID_MARK_NOT_FOUND 1122 #define ERROR_FLOPPY_WRONG_CYLINDER 1123 #define ERROR_FLOPPY_UNKNOWN_ERROR 1124 #define ERROR_FLOPPY_BAD_REGISTERS 1125 #define ERROR_DISK_RECALIBRATE_FAILED 1126 #define ERROR_DISK_OPERATION_FAILED 1127 #define ERROR_DISK_RESET_FAILED 1128 #define ERROR_EOM_OVERFLOW 1129 #define ERROR_NOT_ENOUGH_SERVER_MEMORY 1130 #define ERROR_POSSIBLE_DEADLOCK 1131 #define ERROR_MAPPED_ALIGNMENT 1132 #define ERROR_SET_POWER_STATE_VETOED 1140 #define ERROR_SET_POWER_STATE_FAILED 1141 #define ERROR_TOO_MANY_LINKS 1142 #define ERROR_OLD_WIN_VERSION 1150 #define ERROR_APP_WRONG_OS 1151 #define ERROR_SINGLE_INSTANCE_APP 1152 #define ERROR_RMODE_APP 1153 #define ERROR_INVALID_DLL 1154 #define ERROR_NO_ASSOCIATION 1155 #define ERROR_DDE_FAIL 1156 #define ERROR_DLL_NOT_FOUND 1157 #define ERROR_NO_MORE_USER_HANDLES 1158 #define ERROR_MESSAGE_SYNC_ONLY 1159 #define ERROR_SOURCE_ELEMENT_EMPTY 1160 #define ERROR_DESTINATION_ELEMENT_FULL 1161 #define ERROR_ILLEGAL_ELEMENT_ADDRESS 1162 #define ERROR_MAGAZINE_NOT_PRESENT 1163 #define ERROR_DEVICE_REINITIALIZATION_NEEDED 1164 #define ERROR_DEVICE_REQUIRES_CLEANING 1165 #define ERROR_DEVICE_DOOR_OPEN 1166 #define ERROR_DEVICE_NOT_CONNECTED 1167 #define ERROR_NOT_FOUND 1168 #define ERROR_NO_MATCH 1169 #define ERROR_SET_NOT_FOUND 1170 #define ERROR_POINT_NOT_FOUND 1171 #define ERROR_NO_TRACKING_SERVICE 1172 #define ERROR_NO_VOLUME_ID 1173 #define ERROR_UNABLE_TO_REMOVE_REPLACED 1175 #define ERROR_UNABLE_TO_MOVE_REPLACEMENT 1176 #define ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 1177 #define ERROR_JOURNAL_DELETE_IN_PROGRESS 1178 #define ERROR_JOURNAL_NOT_ACTIVE 1179 #define ERROR_POTENTIAL_FILE_FOUND 1180 #define ERROR_JOURNAL_ENTRY_DELETED 1181 #define ERROR_BAD_DEVICE 1200 #define ERROR_CONNECTION_UNAVAIL 1201 #define ERROR_DEVICE_ALREADY_REMEMBERED 1202 #define ERROR_NO_NET_OR_BAD_PATH 1203 #define ERROR_BAD_PROVIDER 1204 #define ERROR_CANNOT_OPEN_PROFILE 1205 #define ERROR_BAD_PROFILE 1206 #define ERROR_NOT_CONTAINER 1207 #define ERROR_EXTENDED_ERROR 1208 #define ERROR_INVALID_GROUPNAME 1209 #define ERROR_INVALID_COMPUTERNAME 1210 #define ERROR_INVALID_EVENTNAME 1211 #define ERROR_INVALID_DOMAINNAME 1212 #define ERROR_INVALID_SERVICENAME 1213 #define ERROR_INVALID_NETNAME 1214 #define ERROR_INVALID_SHARENAME 1215 #define ERROR_INVALID_PASSWORDNAME 1216 #define ERROR_INVALID_MESSAGENAME 1217 #define ERROR_INVALID_MESSAGEDEST 1218 #define ERROR_SESSION_CREDENTIAL_CONFLICT 1219 #define ERROR_REMOTE_SESSION_LIMIT_EXCEEDED 1220 #define ERROR_DUP_DOMAINNAME 1221 #define ERROR_NO_NETWORK 1222 #define ERROR_CANCELLED 1223 #define ERROR_USER_MAPPED_FILE 1224 #define ERROR_CONNECTION_REFUSED 1225 #define ERROR_GRACEFUL_DISCONNECT 1226 #define ERROR_ADDRESS_ALREADY_ASSOCIATED 1227 #define ERROR_ADDRESS_NOT_ASSOCIATED 1228 #define ERROR_CONNECTION_INVALID 1229 #define ERROR_CONNECTION_ACTIVE 1230 #define ERROR_NETWORK_UNREACHABLE 1231 #define ERROR_HOST_UNREACHABLE 1232 #define ERROR_PROTOCOL_UNREACHABLE 1233 #define ERROR_PORT_UNREACHABLE 1234 #define ERROR_REQUEST_ABORTED 1235 #define ERROR_CONNECTION_ABORTED 1236 #define ERROR_RETRY 1237 #define ERROR_CONNECTION_COUNT_LIMIT 1238 #define ERROR_LOGIN_TIME_RESTRICTION 1239 #define ERROR_LOGIN_WKSTA_RESTRICTION 1240 #define ERROR_INCORRECT_ADDRESS 1241 #define ERROR_ALREADY_REGISTERED 1242 #define ERROR_SERVICE_NOT_FOUND 1243 #define ERROR_NOT_AUTHENTICATED 1244 #define ERROR_NOT_LOGGED_ON 1245 #define ERROR_CONTINUE 1246 #define ERROR_ALREADY_INITIALIZED 1247 #define ERROR_NO_MORE_DEVICES 1248 #define ERROR_NO_SUCH_SITE 1249 #define ERROR_DOMAIN_CONTROLLER_EXISTS 1250 #define ERROR_ONLY_IF_CONNECTED 1251 #define ERROR_OVERRIDE_NOCHANGES 1252 #define ERROR_BAD_USER_PROFILE 1253 #define ERROR_NOT_SUPPORTED_ON_SBS 1254 #define ERROR_NOT_ALL_ASSIGNED 1300 #define ERROR_SOME_NOT_MAPPED 1301 #define ERROR_NO_QUOTAS_FOR_ACCOUNT 1302 #define ERROR_LOCAL_USER_SESSION_KEY 1303 #define ERROR_NULL_LM_PASSWORD 1304 #define ERROR_UNKNOWN_REVISION 1305 #define ERROR_REVISION_MISMATCH 1306 #define ERROR_INVALID_OWNER 1307 #define ERROR_INVALID_PRIMARY_GROUP 1308 #define ERROR_NO_IMPERSONATION_TOKEN 1309 #define ERROR_CANT_DISABLE_MANDATORY 1310 #define ERROR_NO_LOGON_SERVERS 1311 #define ERROR_NO_SUCH_LOGON_SESSION 1312 #define ERROR_NO_SUCH_PRIVILEGE 1313 #define ERROR_PRIVILEGE_NOT_HELD 1314 #define ERROR_INVALID_ACCOUNT_NAME 1315 #define ERROR_USER_EXISTS 1316 #define ERROR_NO_SUCH_USER 1317 #define ERROR_GROUP_EXISTS 1318 #define ERROR_NO_SUCH_GROUP 1319 #define ERROR_MEMBER_IN_GROUP 1320 #define ERROR_MEMBER_NOT_IN_GROUP 1321 #define ERROR_LAST_ADMIN 1322 #define ERROR_WRONG_PASSWORD 1323 #define ERROR_ILL_FORMED_PASSWORD 1324 #define ERROR_PASSWORD_RESTRICTION 1325 #define ERROR_LOGON_FAILURE 1326 #define ERROR_ACCOUNT_RESTRICTION 1327 #define ERROR_INVALID_LOGON_HOURS 1328 #define ERROR_INVALID_WORKSTATION 1329 #define ERROR_PASSWORD_EXPIRED 1330 #define ERROR_ACCOUNT_DISABLED 1331 #define ERROR_NONE_MAPPED 1332 #define ERROR_TOO_MANY_LUIDS_REQUESTED 1333 #define ERROR_LUIDS_EXHAUSTED 1334 #define ERROR_INVALID_SUB_AUTHORITY 1335 #define ERROR_INVALID_ACL 1336 #define ERROR_INVALID_SID 1337 #define ERROR_INVALID_SECURITY_DESCR 1338 #define ERROR_BAD_INHERITANCE_ACL 1340 #define ERROR_SERVER_DISABLED 1341 #define ERROR_SERVER_NOT_DISABLED 1342 #define ERROR_INVALID_ID_AUTHORITY 1343 #define ERROR_ALLOTTED_SPACE_EXCEEDED 1344 #define ERROR_INVALID_GROUP_ATTRIBUTES 1345 #define ERROR_BAD_IMPERSONATION_LEVEL 1346 #define ERROR_CANT_OPEN_ANONYMOUS 1347 #define ERROR_BAD_VALIDATION_CLASS 1348 #define ERROR_BAD_TOKEN_TYPE 1349 #define ERROR_NO_SECURITY_ON_OBJECT 1350 #define ERROR_CANT_ACCESS_DOMAIN_INFO 1351 #define ERROR_INVALID_SERVER_STATE 1352 #define ERROR_INVALID_DOMAIN_STATE 1353 #define ERROR_INVALID_DOMAIN_ROLE 1354 #define ERROR_NO_SUCH_DOMAIN 1355 #define ERROR_DOMAIN_EXISTS 1356 #define ERROR_DOMAIN_LIMIT_EXCEEDED 1357 #define ERROR_INTERNAL_DB_CORRUPTION 1358 #define ERROR_INTERNAL_ERROR 1359 #define ERROR_GENERIC_NOT_MAPPED 1360 #define ERROR_BAD_DESCRIPTOR_FORMAT 1361 #define ERROR_NOT_LOGON_PROCESS 1362 #define ERROR_LOGON_SESSION_EXISTS 1363 #define ERROR_NO_SUCH_PACKAGE 1364 #define ERROR_BAD_LOGON_SESSION_STATE 1365 #define ERROR_LOGON_SESSION_COLLISION 1366 #define ERROR_INVALID_LOGON_TYPE 1367 #define ERROR_CANNOT_IMPERSONATE 1368 #define ERROR_RXACT_INVALID_STATE 1369 #define ERROR_RXACT_COMMIT_FAILURE 1370 #define ERROR_SPECIAL_ACCOUNT 1371 #define ERROR_SPECIAL_GROUP 1372 #define ERROR_SPECIAL_USER 1373 #define ERROR_MEMBERS_PRIMARY_GROUP 1374 #define ERROR_TOKEN_ALREADY_IN_USE 1375 #define ERROR_NO_SUCH_ALIAS 1376 #define ERROR_MEMBER_NOT_IN_ALIAS 1377 #define ERROR_MEMBER_IN_ALIAS 1378 #define ERROR_ALIAS_EXISTS 1379 #define ERROR_LOGON_NOT_GRANTED 1380 #define ERROR_TOO_MANY_SECRETS 1381 #define ERROR_SECRET_TOO_LONG 1382 #define ERROR_INTERNAL_DB_ERROR 1383 #define ERROR_TOO_MANY_CONTEXT_IDS 1384 #define ERROR_LOGON_TYPE_NOT_GRANTED 1385 #define ERROR_NT_CROSS_ENCRYPTION_REQUIRED 1386 #define ERROR_NO_SUCH_MEMBER 1387 #define ERROR_INVALID_MEMBER 1388 #define ERROR_TOO_MANY_SIDS 1389 #define ERROR_LM_CROSS_ENCRYPTION_REQUIRED 1390 #define ERROR_NO_INHERITANCE 1391 #define ERROR_FILE_CORRUPT 1392 #define ERROR_DISK_CORRUPT 1393 #define ERROR_NO_USER_SESSION_KEY 1394 #define ERROR_LICENSE_QUOTA_EXCEEDED 1395 #define ERROR_WRONG_TARGET_NAME 1396 #define ERROR_MUTUAL_AUTH_FAILED 1397 #define ERROR_TIME_SKEW 1398 #define ERROR_INVALID_WINDOW_HANDLE 1400 #define ERROR_INVALID_MENU_HANDLE 1401 #define ERROR_INVALID_CURSOR_HANDLE 1402 #define ERROR_INVALID_ACCEL_HANDLE 1403 #define ERROR_INVALID_HOOK_HANDLE 1404 #define ERROR_INVALID_DWP_HANDLE 1405 #define ERROR_TLW_WITH_WSCHILD 1406 #define ERROR_CANNOT_FIND_WND_CLASS 1407 #define ERROR_WINDOW_OF_OTHER_THREAD 1408 #define ERROR_HOTKEY_ALREADY_REGISTERED 1409 #define ERROR_CLASS_ALREADY_EXISTS 1410 #define ERROR_CLASS_DOES_NOT_EXIST 1411 #define ERROR_CLASS_HAS_WINDOWS 1412 #define ERROR_INVALID_INDEX 1413 #define ERROR_INVALID_ICON_HANDLE 1414 #define ERROR_PRIVATE_DIALOG_INDEX 1415 #define ERROR_LISTBOX_ID_NOT_FOUND 1416 #define ERROR_NO_WILDCARD_CHARACTERS 1417 #define ERROR_CLIPBOARD_NOT_OPEN 1418 #define ERROR_HOTKEY_NOT_REGISTERED 1419 #define ERROR_WINDOW_NOT_DIALOG 1420 #define ERROR_CONTROL_ID_NOT_FOUND 1421 #define ERROR_INVALID_COMBOBOX_MESSAGE 1422 #define ERROR_WINDOW_NOT_COMBOBOX 1423 #define ERROR_INVALID_EDIT_HEIGHT 1424 #define ERROR_DC_NOT_FOUND 1425 #define ERROR_INVALID_HOOK_FILTER 1426 #define ERROR_INVALID_FILTER_PROC 1427 #define ERROR_HOOK_NEEDS_HMOD 1428 #define ERROR_GLOBAL_ONLY_HOOK 1429 #define ERROR_JOURNAL_HOOK_SET 1430 #define ERROR_HOOK_NOT_INSTALLED 1431 #define ERROR_INVALID_LB_MESSAGE 1432 #define ERROR_SETCOUNT_ON_BAD_LB 1433 #define ERROR_LB_WITHOUT_TABSTOPS 1434 #define ERROR_DESTROY_OBJECT_OF_OTHER_THREAD 1435 #define ERROR_CHILD_WINDOW_MENU 1436 #define ERROR_NO_SYSTEM_MENU 1437 #define ERROR_INVALID_MSGBOX_STYLE 1438 #define ERROR_INVALID_SPI_VALUE 1439 #define ERROR_SCREEN_ALREADY_LOCKED 1440 #define ERROR_HWNDS_HAVE_DIFF_PARENT 1441 #define ERROR_NOT_CHILD_WINDOW 1442 #define ERROR_INVALID_GW_COMMAND 1443 #define ERROR_INVALID_THREAD_ID 1444 #define ERROR_NON_MDICHILD_WINDOW 1445 #define ERROR_POPUP_ALREADY_ACTIVE 1446 #define ERROR_NO_SCROLLBARS 1447 #define ERROR_INVALID_SCROLLBAR_RANGE 1448 #define ERROR_INVALID_SHOWWIN_COMMAND 1449 #define ERROR_NO_SYSTEM_RESOURCES 1450 #define ERROR_NONPAGED_SYSTEM_RESOURCES 1451 #define ERROR_PAGED_SYSTEM_RESOURCES 1452 #define ERROR_WORKING_SET_QUOTA 1453 #define ERROR_PAGEFILE_QUOTA 1454 #define ERROR_COMMITMENT_LIMIT 1455 #define ERROR_MENU_ITEM_NOT_FOUND 1456 #define ERROR_INVALID_KEYBOARD_HANDLE 1457 #define ERROR_HOOK_TYPE_NOT_ALLOWED 1458 #define ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION 1459 #define ERROR_TIMEOUT 1460 #define ERROR_INVALID_MONITOR_HANDLE 1461 #define ERROR_EVENTLOG_FILE_CORRUPT 1500 #define ERROR_EVENTLOG_CANT_START 1501 #define ERROR_LOG_FILE_FULL 1502 #define ERROR_EVENTLOG_FILE_CHANGED 1503 #define ERROR_INSTALL_SERVICE_FAILURE 1601 #define ERROR_INSTALL_USEREXIT 1602 #define ERROR_INSTALL_FAILURE 1603 #define ERROR_INSTALL_SUSPEND 1604 #define ERROR_UNKNOWN_PRODUCT 1605 #define ERROR_UNKNOWN_FEATURE 1606 #define ERROR_UNKNOWN_COMPONENT 1607 #define ERROR_UNKNOWN_PROPERTY 1608 #define ERROR_INVALID_HANDLE_STATE 1609 #define ERROR_BAD_CONFIGURATION 1610 #define ERROR_INDEX_ABSENT 1611 #define ERROR_INSTALL_SOURCE_ABSENT 1612 #define ERROR_INSTALL_PACKAGE_VERSION 1613 #define ERROR_PRODUCT_UNINSTALLED 1614 #define ERROR_BAD_QUERY_SYNTAX 1615 #define ERROR_INVALID_FIELD 1616 #define ERROR_DEVICE_REMOVED 1617 #define ERROR_INSTALL_ALREADY_RUNNING 1618 #define ERROR_INSTALL_PACKAGE_OPEN_FAILED 1619 #define ERROR_INSTALL_PACKAGE_INVALID 1620 #define ERROR_INSTALL_UI_FAILURE 1621 #define ERROR_INSTALL_LOG_FAILURE 1622 #define ERROR_INSTALL_LANGUAGE_UNSUPPORTED 1623 #define ERROR_INSTALL_TRANSFORM_FAILURE 1624 #define ERROR_INSTALL_PACKAGE_REJECTED 1625 #define ERROR_FUNCTION_NOT_CALLED 1626 #define ERROR_FUNCTION_FAILED 1627 #define ERROR_INVALID_TABLE 1628 #define ERROR_DATATYPE_MISMATCH 1629 #define ERROR_UNSUPPORTED_TYPE 1630 #define ERROR_CREATE_FAILED 1631 #define ERROR_INSTALL_TEMP_UNWRITABLE 1632 #define ERROR_INSTALL_PLATFORM_UNSUPPORTED 1633 #define ERROR_INSTALL_NOTUSED 1634 #define ERROR_PATCH_PACKAGE_OPEN_FAILED 1635 #define ERROR_PATCH_PACKAGE_INVALID 1636 #define ERROR_PATCH_PACKAGE_UNSUPPORTED 1637 #define ERROR_PRODUCT_VERSION 1638 #define ERROR_INVALID_COMMAND_LINE 1639 #define ERROR_INSTALL_REMOTE_DISALLOWED 1640 #define ERROR_SUCCESS_REBOOT_INITIATED 1641 #define RPC_S_INVALID_STRING_BINDING 1700 #define RPC_S_WRONG_KIND_OF_BINDING 1701 #define RPC_S_INVALID_BINDING 1702 #define RPC_S_PROTSEQ_NOT_SUPPORTED 1703 #define RPC_S_INVALID_RPC_PROTSEQ 1704 #define RPC_S_INVALID_STRING_UUID 1705 #define RPC_S_INVALID_ENDPOINT_FORMAT 1706 #define RPC_S_INVALID_NET_ADDR 1707 #define RPC_S_NO_ENDPOINT_FOUND 1708 #define RPC_S_INVALID_TIMEOUT 1709 #define RPC_S_OBJECT_NOT_FOUND 1710 #define RPC_S_ALREADY_REGISTERED 1711 #define RPC_S_TYPE_ALREADY_REGISTERED 1712 #define RPC_S_ALREADY_LISTENING 1713 #define RPC_S_NO_PROTSEQS_REGISTERED 1714 #define RPC_S_NOT_LISTENING 1715 #define RPC_S_UNKNOWN_MGR_TYPE 1716 #define RPC_S_UNKNOWN_IF 1717 #define RPC_S_NO_BINDINGS 1718 #define RPC_S_NO_PROTSEQS 1719 #define RPC_S_CANT_CREATE_ENDPOINT 1720 #define RPC_S_OUT_OF_RESOURCES 1721 #define RPC_S_SERVER_UNAVAILABLE 1722 #define RPC_S_SERVER_TOO_BUSY 1723 #define RPC_S_INVALID_NETWORK_OPTIONS 1724 #define RPC_S_NO_CALL_ACTIVE 1725 #define RPC_S_CALL_FAILED 1726 #define RPC_S_CALL_FAILED_DNE 1727 #define RPC_S_PROTOCOL_ERROR 1728 #define RPC_S_UNSUPPORTED_TRANS_SYN 1730 #define RPC_S_UNSUPPORTED_TYPE 1732 #define RPC_S_INVALID_TAG 1733 #define RPC_S_INVALID_BOUND 1734 #define RPC_S_NO_ENTRY_NAME 1735 #define RPC_S_INVALID_NAME_SYNTAX 1736 #define RPC_S_UNSUPPORTED_NAME_SYNTAX 1737 #define RPC_S_UUID_NO_ADDRESS 1739 #define RPC_S_DUPLICATE_ENDPOINT 1740 #define RPC_S_UNKNOWN_AUTHN_TYPE 1741 #define RPC_S_MAX_CALLS_TOO_SMALL 1742 #define RPC_S_STRING_TOO_LONG 1743 #define RPC_S_PROTSEQ_NOT_FOUND 1744 #define RPC_S_PROCNUM_OUT_OF_RANGE 1745 #define RPC_S_BINDING_HAS_NO_AUTH 1746 #define RPC_S_UNKNOWN_AUTHN_SERVICE 1747 #define RPC_S_UNKNOWN_AUTHN_LEVEL 1748 #define RPC_S_INVALID_AUTH_IDENTITY 1749 #define RPC_S_UNKNOWN_AUTHZ_SERVICE 1750 #define EPT_S_INVALID_ENTRY 1751 #define EPT_S_CANT_PERFORM_OP 1752 #define EPT_S_NOT_REGISTERED 1753 #define RPC_S_NOTHING_TO_EXPORT 1754 #define RPC_S_INCOMPLETE_NAME 1755 #define RPC_S_INVALID_VERS_OPTION 1756 #define RPC_S_NO_MORE_MEMBERS 1757 #define RPC_S_NOT_ALL_OBJS_UNEXPORTED 1758 #define RPC_S_INTERFACE_NOT_FOUND 1759 #define RPC_S_ENTRY_ALREADY_EXISTS 1760 #define RPC_S_ENTRY_NOT_FOUND 1761 #define RPC_S_NAME_SERVICE_UNAVAILABLE 1762 #define RPC_S_INVALID_NAF_ID 1763 #define RPC_S_CANNOT_SUPPORT 1764 #define RPC_S_NO_CONTEXT_AVAILABLE 1765 #define RPC_S_INTERNAL_ERROR 1766 #define RPC_S_ZERO_DIVIDE 1767 #define RPC_S_ADDRESS_ERROR 1768 #define RPC_S_FP_DIV_ZERO 1769 #define RPC_S_FP_UNDERFLOW 1770 #define RPC_S_FP_OVERFLOW 1771 #define RPC_X_NO_MORE_ENTRIES 1772 #define RPC_X_SS_CHAR_TRANS_OPEN_FAIL 1773 #define RPC_X_SS_CHAR_TRANS_SHORT_FILE 1774 #define RPC_X_SS_IN_NULL_CONTEXT 1775 #define RPC_X_SS_CONTEXT_DAMAGED 1777 #define RPC_X_SS_HANDLES_MISMATCH 1778 #define RPC_X_SS_CANNOT_GET_CALL_HANDLE 1779 #define RPC_X_NULL_REF_POINTER 1780 #define RPC_X_ENUM_VALUE_OUT_OF_RANGE 1781 #define RPC_X_BYTE_COUNT_TOO_SMALL 1782 #define RPC_X_BAD_STUB_DATA 1783 #define ERROR_INVALID_USER_BUFFER 1784 #define ERROR_UNRECOGNIZED_MEDIA 1785 #define ERROR_NO_TRUST_LSA_SECRET 1786 #define ERROR_NO_TRUST_SAM_ACCOUNT 1787 #define ERROR_TRUSTED_DOMAIN_FAILURE 1788 #define ERROR_TRUSTED_RELATIONSHIP_FAILURE 1789 #define ERROR_TRUST_FAILURE 1790 #define RPC_S_CALL_IN_PROGRESS 1791 #define ERROR_NETLOGON_NOT_STARTED 1792 #define ERROR_ACCOUNT_EXPIRED 1793 #define ERROR_REDIRECTOR_HAS_OPEN_HANDLES 1794 #define ERROR_PRINTER_DRIVER_ALREADY_INSTALLED 1795 #define ERROR_UNKNOWN_PORT 1796 #define ERROR_UNKNOWN_PRINTER_DRIVER 1797 #define ERROR_UNKNOWN_PRINTPROCESSOR 1798 #define ERROR_INVALID_SEPARATOR_FILE 1799 #define ERROR_INVALID_PRIORITY 1800 #define ERROR_INVALID_PRINTER_NAME 1801 #define ERROR_PRINTER_ALREADY_EXISTS 1802 #define ERROR_INVALID_PRINTER_COMMAND 1803 #define ERROR_INVALID_DATATYPE 1804 #define ERROR_INVALID_ENVIRONMENT 1805 #define RPC_S_NO_MORE_BINDINGS 1806 #define ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT 1807 #define ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT 1808 #define ERROR_NOLOGON_SERVER_TRUST_ACCOUNT 1809 #define ERROR_DOMAIN_TRUST_INCONSISTENT 1810 #define ERROR_SERVER_HAS_OPEN_HANDLES 1811 #define ERROR_RESOURCE_DATA_NOT_FOUND 1812 #define ERROR_RESOURCE_TYPE_NOT_FOUND 1813 #define ERROR_RESOURCE_NAME_NOT_FOUND 1814 #define ERROR_RESOURCE_LANG_NOT_FOUND 1815 #define ERROR_NOT_ENOUGH_QUOTA 1816 #define RPC_S_NO_INTERFACES 1817 #define RPC_S_CALL_CANCELLED 1818 #define RPC_S_BINDING_INCOMPLETE 1819 #define RPC_S_COMM_FAILURE 1820 #define RPC_S_UNSUPPORTED_AUTHN_LEVEL 1821 #define RPC_S_NO_PRINC_NAME 1822 #define RPC_S_NOT_RPC_ERROR 1823 #define RPC_S_UUID_LOCAL_ONLY 1824 #define RPC_S_SEC_PKG_ERROR 1825 #define RPC_S_NOT_CANCELLED 1826 #define RPC_X_INVALID_ES_ACTION 1827 #define RPC_X_WRONG_ES_VERSION 1828 #define RPC_X_WRONG_STUB_VERSION 1829 #define RPC_X_INVALID_PIPE_OBJECT 1830 #define RPC_X_WRONG_PIPE_ORDER 1831 #define RPC_X_WRONG_PIPE_VERSION 1832 #define RPC_S_GROUP_MEMBER_NOT_FOUND 1898 #define EPT_S_CANT_CREATE 1899 #define RPC_S_INVALID_OBJECT 1900 #define ERROR_INVALID_TIME 1901 #define ERROR_INVALID_FORM_NAME 1902 #define ERROR_INVALID_FORM_SIZE 1903 #define ERROR_ALREADY_WAITING 1904 #define ERROR_PRINTER_DELETED 1905 #define ERROR_INVALID_PRINTER_STATE 1906 #define ERROR_PASSWORD_MUST_CHANGE 1907 #define ERROR_DOMAIN_CONTROLLER_NOT_FOUND 1908 #define ERROR_ACCOUNT_LOCKED_OUT 1909 #define OR_INVALID_OXID 1910 #define OR_INVALID_OID 1911 #define OR_INVALID_SET 1912 #define RPC_S_SEND_INCOMPLETE 1913 #define RPC_S_INVALID_ASYNC_HANDLE 1914 #define RPC_S_INVALID_ASYNC_CALL 1915 #define RPC_X_PIPE_CLOSED 1916 #define RPC_X_PIPE_DISCIPLINE_ERROR 1917 #define RPC_X_PIPE_EMPTY 1918 #define ERROR_NO_SITENAME 1919 #define ERROR_CANT_ACCESS_FILE 1920 #define ERROR_CANT_RESOLVE_FILENAME 1921 #define RPC_S_ENTRY_TYPE_MISMATCH 1922 #define RPC_S_NOT_ALL_OBJS_EXPORTED 1923 #define RPC_S_INTERFACE_NOT_EXPORTED 1924 #define RPC_S_PROFILE_NOT_ADDED 1925 #define RPC_S_PRF_ELT_NOT_ADDED 1926 #define RPC_S_PRF_ELT_NOT_REMOVED 1927 #define RPC_S_GRP_ELT_NOT_ADDED 1928 #define RPC_S_GRP_ELT_NOT_REMOVED 1929 #define ERROR_INVALID_PIXEL_FORMAT 2000 #define ERROR_BAD_DRIVER 2001 #define ERROR_INVALID_WINDOW_STYLE 2002 #define ERROR_METAFILE_NOT_SUPPORTED 2003 #define ERROR_TRANSFORM_NOT_SUPPORTED 2004 #define ERROR_CLIPPING_NOT_SUPPORTED 2005 #define ERROR_INVALID_CMM 2010 #define ERROR_INVALID_PROFILE 2011 #define ERROR_TAG_NOT_FOUND 2012 #define ERROR_TAG_NOT_PRESENT 2013 #define ERROR_DUPLICATE_TAG 2014 #define ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE 2015 #define ERROR_PROFILE_NOT_FOUND 2016 #define ERROR_INVALID_COLORSPACE 2017 #define ERROR_ICM_NOT_ENABLED 2018 #define ERROR_DELETING_ICM_XFORM 2019 #define ERROR_INVALID_TRANSFORM 2020 #define ERROR_COLORSPACE_MISMATCH 2021 #define ERROR_INVALID_COLORINDEX 2022 #define ERROR_CONNECTED_OTHER_PASSWORD 2108 #define ERROR_BAD_USERNAME 2202 #define ERROR_NOT_CONNECTED 2250 #define ERROR_OPEN_FILES 2401 #define ERROR_ACTIVE_CONNECTIONS 2402 #define ERROR_DEVICE_IN_USE 2404 #define ERROR_UNKNOWN_PRINT_MONITOR 3000 #define ERROR_PRINTER_DRIVER_IN_USE 3001 #define ERROR_SPOOL_FILE_NOT_FOUND 3002 #define ERROR_SPL_NO_STARTDOC 3003 #define ERROR_SPL_NO_ADDJOB 3004 #define ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED 3005 #define ERROR_PRINT_MONITOR_ALREADY_INSTALLED 3006 #define ERROR_INVALID_PRINT_MONITOR 3007 #define ERROR_PRINT_MONITOR_IN_USE 3008 #define ERROR_PRINTER_HAS_JOBS_QUEUED 3009 #define ERROR_SUCCESS_REBOOT_REQUIRED 3010 #define ERROR_SUCCESS_RESTART_REQUIRED 3011 #define ERROR_PRINTER_NOT_FOUND 3012 #define ERROR_WINS_INTERNAL 4000 #define ERROR_CAN_NOT_DEL_LOCAL_WINS 4001 #define ERROR_STATIC_INIT 4002 #define ERROR_INC_BACKUP 4003 #define ERROR_FULL_BACKUP 4004 #define ERROR_REC_NON_EXISTENT 4005 #define ERROR_RPL_NOT_ALLOWED 4006 #define ERROR_DHCP_ADDRESS_CONFLICT 4100 #define ERROR_WMI_GUID_NOT_FOUND 4200 #define ERROR_WMI_INSTANCE_NOT_FOUND 4201 #define ERROR_WMI_ITEMID_NOT_FOUND 4202 #define ERROR_WMI_TRY_AGAIN 4203 #define ERROR_WMI_DP_NOT_FOUND 4204 #define ERROR_WMI_UNRESOLVED_INSTANCE_REF 4205 #define ERROR_WMI_ALREADY_ENABLED 4206 #define ERROR_WMI_GUID_DISCONNECTED 4207 #define ERROR_WMI_SERVER_UNAVAILABLE 4208 #define ERROR_WMI_DP_FAILED 4209 #define ERROR_WMI_INVALID_MOF 4210 #define ERROR_WMI_INVALID_REGINFO 4211 #define ERROR_WMI_ALREADY_DISABLED 4212 #define ERROR_WMI_READ_ONLY 4213 #define ERROR_WMI_SET_FAILURE 4214 #define ERROR_INVALID_MEDIA 4300 #define ERROR_INVALID_LIBRARY 4301 #define ERROR_INVALID_MEDIA_POOL 4302 #define ERROR_DRIVE_MEDIA_MISMATCH 4303 #define ERROR_MEDIA_OFFLINE 4304 #define ERROR_LIBRARY_OFFLINE 4305 #define ERROR_EMPTY 4306 #define ERROR_NOT_EMPTY 4307 #define ERROR_MEDIA_UNAVAILABLE 4308 #define ERROR_RESOURCE_DISABLED 4309 #define ERROR_INVALID_CLEANER 4310 #define ERROR_UNABLE_TO_CLEAN 4311 #define ERROR_OBJECT_NOT_FOUND 4312 #define ERROR_DATABASE_FAILURE 4313 #define ERROR_DATABASE_FULL 4314 #define ERROR_MEDIA_INCOMPATIBLE 4315 #define ERROR_RESOURCE_NOT_PRESENT 4316 #define ERROR_INVALID_OPERATION 4317 #define ERROR_MEDIA_NOT_AVAILABLE 4318 #define ERROR_DEVICE_NOT_AVAILABLE 4319 #define ERROR_REQUEST_REFUSED 4320 #define ERROR_INVALID_DRIVE_OBJECT 4321 #define ERROR_LIBRARY_FULL 4322 #define ERROR_MEDIUM_NOT_ACCESSIBLE 4323 #define ERROR_UNABLE_TO_LOAD_MEDIUM 4324 #define ERROR_UNABLE_TO_INVENTORY_DRIVE 4325 #define ERROR_UNABLE_TO_INVENTORY_SLOT 4326 #define ERROR_UNABLE_TO_INVENTORY_TRANSPORT 4327 #define ERROR_TRANSPORT_FULL 4328 #define ERROR_CONTROLLING_IEPORT 4329 #define ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA 4330 #define ERROR_CLEANER_SLOT_SET 4331 #define ERROR_CLEANER_SLOT_NOT_SET 4332 #define ERROR_CLEANER_CARTRIDGE_SPENT 4333 #define ERROR_UNEXPECTED_OMID 4334 #define ERROR_CANT_DELETE_LAST_ITEM 4335 #define ERROR_MESSAGE_EXCEEDS_MAX_SIZE 4336 #define ERROR_VOLUME_CONTAINS_SYS_FILES 4337 #define ERROR_INDIGENOUS_TYPE 4338 #define ERROR_NO_SUPPORTING_DRIVES 4339 #define ERROR_FILE_OFFLINE 4350 #define ERROR_REMOTE_STORAGE_NOT_ACTIVE 4351 #define ERROR_REMOTE_STORAGE_MEDIA_ERROR 4352 #define ERROR_NOT_A_REPARSE_POINT 4390 #define ERROR_REPARSE_ATTRIBUTE_CONFLICT 4391 #define ERROR_INVALID_REPARSE_DATA 4392 #define ERROR_REPARSE_TAG_INVALID 4393 #define ERROR_REPARSE_TAG_MISMATCH 4394 #define ERROR_VOLUME_NOT_SIS_ENABLED 4500 #define ERROR_DEPENDENT_RESOURCE_EXISTS 5001 #define ERROR_DEPENDENCY_NOT_FOUND 5002 #define ERROR_DEPENDENCY_ALREADY_EXISTS 5003 #define ERROR_RESOURCE_NOT_ONLINE 5004 #define ERROR_HOST_NODE_NOT_AVAILABLE 5005 #define ERROR_RESOURCE_NOT_AVAILABLE 5006 #define ERROR_RESOURCE_NOT_FOUND 5007 #define ERROR_SHUTDOWN_CLUSTER 5008 #define ERROR_CANT_EVICT_ACTIVE_NODE 5009 #define ERROR_OBJECT_ALREADY_EXISTS 5010 #define ERROR_OBJECT_IN_LIST 5011 #define ERROR_GROUP_NOT_AVAILABLE 5012 #define ERROR_GROUP_NOT_FOUND 5013 #define ERROR_GROUP_NOT_ONLINE 5014 #define ERROR_HOST_NODE_NOT_RESOURCE_OWNER 5015 #define ERROR_HOST_NODE_NOT_GROUP_OWNER 5016 #define ERROR_RESMON_CREATE_FAILED 5017 #define ERROR_RESMON_ONLINE_FAILED 5018 #define ERROR_RESOURCE_ONLINE 5019 #define ERROR_QUORUM_RESOURCE 5020 #define ERROR_NOT_QUORUM_CAPABLE 5021 #define ERROR_CLUSTER_SHUTTING_DOWN 5022 #define ERROR_INVALID_STATE 5023 #define ERROR_RESOURCE_PROPERTIES_STORED 5024 #define ERROR_NOT_QUORUM_CLASS 5025 #define ERROR_CORE_RESOURCE 5026 #define ERROR_QUORUM_RESOURCE_ONLINE_FAILED 5027 #define ERROR_QUORUMLOG_OPEN_FAILED 5028 #define ERROR_CLUSTERLOG_CORRUPT 5029 #define ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE 5030 #define ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE 5031 #define ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND 5032 #define ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE 5033 #define ERROR_QUORUM_OWNER_ALIVE 5034 #define ERROR_NETWORK_NOT_AVAILABLE 5035 #define ERROR_NODE_NOT_AVAILABLE 5036 #define ERROR_ALL_NODES_NOT_AVAILABLE 5037 #define ERROR_RESOURCE_FAILED 5038 #define ERROR_CLUSTER_INVALID_NODE 5039 #define ERROR_CLUSTER_NODE_EXISTS 5040 #define ERROR_CLUSTER_JOIN_IN_PROGRESS 5041 #define ERROR_CLUSTER_NODE_NOT_FOUND 5042 #define ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND 5043 #define ERROR_CLUSTER_NETWORK_EXISTS 5044 #define ERROR_CLUSTER_NETWORK_NOT_FOUND 5045 #define ERROR_CLUSTER_NETINTERFACE_EXISTS 5046 #define ERROR_CLUSTER_NETINTERFACE_NOT_FOUND 5047 #define ERROR_CLUSTER_INVALID_REQUEST 5048 #define ERROR_CLUSTER_INVALID_NETWORK_PROVIDER 5049 #define ERROR_CLUSTER_NODE_DOWN 5050 #define ERROR_CLUSTER_NODE_UNREACHABLE 5051 #define ERROR_CLUSTER_NODE_NOT_MEMBER 5052 #define ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS 5053 #define ERROR_CLUSTER_INVALID_NETWORK 5054 #define ERROR_CLUSTER_NODE_UP 5056 #define ERROR_CLUSTER_IPADDR_IN_USE 5057 #define ERROR_CLUSTER_NODE_NOT_PAUSED 5058 #define ERROR_CLUSTER_NO_SECURITY_CONTEXT 5059 #define ERROR_CLUSTER_NETWORK_NOT_INTERNAL 5060 #define ERROR_CLUSTER_NODE_ALREADY_UP 5061 #define ERROR_CLUSTER_NODE_ALREADY_DOWN 5062 #define ERROR_CLUSTER_NETWORK_ALREADY_ONLINE 5063 #define ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE 5064 #define ERROR_CLUSTER_NODE_ALREADY_MEMBER 5065 #define ERROR_CLUSTER_LAST_INTERNAL_NETWORK 5066 #define ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS 5067 #define ERROR_INVALID_OPERATION_ON_QUORUM 5068 #define ERROR_DEPENDENCY_NOT_ALLOWED 5069 #define ERROR_CLUSTER_NODE_PAUSED 5070 #define ERROR_NODE_CANT_HOST_RESOURCE 5071 #define ERROR_CLUSTER_NODE_NOT_READY 5072 #define ERROR_CLUSTER_NODE_SHUTTING_DOWN 5073 #define ERROR_CLUSTER_JOIN_ABORTED 5074 #define ERROR_CLUSTER_INCOMPATIBLE_VERSIONS 5075 #define ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED 5076 #define ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED 5077 #define ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND 5078 #define ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED 5079 #define ERROR_CLUSTER_RESNAME_NOT_FOUND 5080 #define ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED 5081 #define ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST 5082 #define ERROR_CLUSTER_DATABASE_SEQMISMATCH 5083 #define ERROR_RESMON_INVALID_STATE 5084 #define ERROR_CLUSTER_GUM_NOT_LOCKER 5085 #define ERROR_QUORUM_DISK_NOT_FOUND 5086 #define ERROR_DATABASE_BACKUP_CORRUPT 5087 #define ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT 5088 #define ERROR_RESOURCE_PROPERTY_UNCHANGEABLE 5089 #define ERROR_ENCRYPTION_FAILED 6000 #define ERROR_DECRYPTION_FAILED 6001 #define ERROR_FILE_ENCRYPTED 6002 #define ERROR_NO_RECOVERY_POLICY 6003 #define ERROR_NO_EFS 6004 #define ERROR_WRONG_EFS 6005 #define ERROR_NO_USER_KEYS 6006 #define ERROR_FILE_NOT_ENCRYPTED 6007 #define ERROR_NOT_EXPORT_FORMAT 6008 #define ERROR_FILE_READ_ONLY 6009 #define ERROR_DIR_EFS_DISALLOWED 6010 #define ERROR_EFS_SERVER_NOT_TRUSTED 6011 #define ERROR_NO_BROWSER_SERVERS_FOUND 6118 #define SCHED_E_SERVICE_NOT_LOCALSYSTEM 6200 #define ERROR_CTX_WINSTATION_NAME_INVALID 7001 #define ERROR_CTX_INVALID_PD 7002 #define ERROR_CTX_PD_NOT_FOUND 7003 #define ERROR_CTX_WD_NOT_FOUND 7004 #define ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY 7005 #define ERROR_CTX_SERVICE_NAME_COLLISION 7006 #define ERROR_CTX_CLOSE_PENDING 7007 #define ERROR_CTX_NO_OUTBUF 7008 #define ERROR_CTX_MODEM_INF_NOT_FOUND 7009 #define ERROR_CTX_INVALID_MODEMNAME 7010 #define ERROR_CTX_MODEM_RESPONSE_ERROR 7011 #define ERROR_CTX_MODEM_RESPONSE_TIMEOUT 7012 #define ERROR_CTX_MODEM_RESPONSE_NO_CARRIER 7013 #define ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE 7014 #define ERROR_CTX_MODEM_RESPONSE_BUSY 7015 #define ERROR_CTX_MODEM_RESPONSE_VOICE 7016 #define ERROR_CTX_TD_ERROR 7017 #define ERROR_CTX_WINSTATION_NOT_FOUND 7022 #define ERROR_CTX_WINSTATION_ALREADY_EXISTS 7023 #define ERROR_CTX_WINSTATION_BUSY 7024 #define ERROR_CTX_BAD_VIDEO_MODE 7025 #define ERROR_CTX_GRAPHICS_INVALID 7035 #define ERROR_CTX_LOGON_DISABLED 7037 #define ERROR_CTX_NOT_CONSOLE 7038 #define ERROR_CTX_CLIENT_QUERY_TIMEOUT 7040 #define ERROR_CTX_CONSOLE_DISCONNECT 7041 #define ERROR_CTX_CONSOLE_CONNECT 7042 #define ERROR_CTX_SHADOW_DENIED 7044 #define ERROR_CTX_WINSTATION_ACCESS_DENIED 7045 #define ERROR_CTX_INVALID_WD 7049 #define ERROR_CTX_SHADOW_INVALID 7050 #define ERROR_CTX_SHADOW_DISABLED 7051 #define ERROR_CTX_CLIENT_LICENSE_IN_USE 7052 #define ERROR_CTX_CLIENT_LICENSE_NOT_SET 7053 #define ERROR_CTX_LICENSE_NOT_AVAILABLE 7054 #define ERROR_CTX_LICENSE_CLIENT_INVALID 7055 #define ERROR_CTX_LICENSE_EXPIRED 7056 #define FRS_ERR_INVALID_API_SEQUENCE 8001 #define FRS_ERR_STARTING_SERVICE 8002 #define FRS_ERR_STOPPING_SERVICE 8003 #define FRS_ERR_INTERNAL_API 8004 #define FRS_ERR_INTERNAL 8005 #define FRS_ERR_SERVICE_COMM 8006 #define FRS_ERR_INSUFFICIENT_PRIV 8007 #define FRS_ERR_AUTHENTICATION 8008 #define FRS_ERR_PARENT_INSUFFICIENT_PRIV 8009 #define FRS_ERR_PARENT_AUTHENTICATION 8010 #define FRS_ERR_CHILD_TO_PARENT_COMM 8011 #define FRS_ERR_PARENT_TO_CHILD_COMM 8012 #define FRS_ERR_SYSVOL_POPULATE 8013 #define FRS_ERR_SYSVOL_POPULATE_TIMEOUT 8014 #define FRS_ERR_SYSVOL_IS_BUSY 8015 #define FRS_ERR_SYSVOL_DEMOTE 8016 #define FRS_ERR_INVALID_SERVICE_PARAMETER 8017 #define ERROR_DS_NOT_INSTALLED 8200 #define ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY 8201 #define ERROR_DS_NO_ATTRIBUTE_OR_VALUE 8202 #define ERROR_DS_INVALID_ATTRIBUTE_SYNTAX 8203 #define ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED 8204 #define ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS 8205 #define ERROR_DS_BUSY 8206 #define ERROR_DS_UNAVAILABLE 8207 #define ERROR_DS_NO_RIDS_ALLOCATED 8208 #define ERROR_DS_NO_MORE_RIDS 8209 #define ERROR_DS_INCORRECT_ROLE_OWNER 8210 #define ERROR_DS_RIDMGR_INIT_ERROR 8211 #define ERROR_DS_OBJ_CLASS_VIOLATION 8212 #define ERROR_DS_CANT_ON_NON_LEAF 8213 #define ERROR_DS_CANT_ON_RDN 8214 #define ERROR_DS_CANT_MOD_OBJ_CLASS 8215 #define ERROR_DS_CROSS_DOM_MOVE_ERROR 8216 #define ERROR_DS_GC_NOT_AVAILABLE 8217 #define ERROR_SHARED_POLICY 8218 #define ERROR_POLICY_OBJECT_NOT_FOUND 8219 #define ERROR_POLICY_ONLY_IN_DS 8220 #define ERROR_PROMOTION_ACTIVE 8221 #define ERROR_NO_PROMOTION_ACTIVE 8222 #define ERROR_DS_OPERATIONS_ERROR 8224 #define ERROR_DS_PROTOCOL_ERROR 8225 #define ERROR_DS_TIMELIMIT_EXCEEDED 8226 #define ERROR_DS_SIZELIMIT_EXCEEDED 8227 #define ERROR_DS_ADMIN_LIMIT_EXCEEDED 8228 #define ERROR_DS_COMPARE_FALSE 8229 #define ERROR_DS_COMPARE_TRUE 8230 #define ERROR_DS_AUTH_METHOD_NOT_SUPPORTED 8231 #define ERROR_DS_STRONG_AUTH_REQUIRED 8232 #define ERROR_DS_INAPPROPRIATE_AUTH 8233 #define ERROR_DS_AUTH_UNKNOWN 8234 #define ERROR_DS_REFERRAL 8235 #define ERROR_DS_UNAVAILABLE_CRIT_EXTENSION 8236 #define ERROR_DS_CONFIDENTIALITY_REQUIRED 8237 #define ERROR_DS_INAPPROPRIATE_MATCHING 8238 #define ERROR_DS_CONSTRAINT_VIOLATION 8239 #define ERROR_DS_NO_SUCH_OBJECT 8240 #define ERROR_DS_ALIAS_PROBLEM 8241 #define ERROR_DS_INVALID_DN_SYNTAX 8242 #define ERROR_DS_IS_LEAF 8243 #define ERROR_DS_ALIAS_DEREF_PROBLEM 8244 #define ERROR_DS_UNWILLING_TO_PERFORM 8245 #define ERROR_DS_LOOP_DETECT 8246 #define ERROR_DS_NAMING_VIOLATION 8247 #define ERROR_DS_OBJECT_RESULTS_TOO_LARGE 8248 #define ERROR_DS_AFFECTS_MULTIPLE_DSAS 8249 #define ERROR_DS_SERVER_DOWN 8250 #define ERROR_DS_LOCAL_ERROR 8251 #define ERROR_DS_ENCODING_ERROR 8252 #define ERROR_DS_DECODING_ERROR 8253 #define ERROR_DS_FILTER_UNKNOWN 8254 #define ERROR_DS_PARAM_ERROR 8255 #define ERROR_DS_NOT_SUPPORTED 8256 #define ERROR_DS_NO_RESULTS_RETURNED 8257 #define ERROR_DS_CONTROL_NOT_FOUND 8258 #define ERROR_DS_CLIENT_LOOP 8259 #define ERROR_DS_REFERRAL_LIMIT_EXCEEDED 8260 #define ERROR_DS_ROOT_MUST_BE_NC 8301 #define ERROR_DS_ADD_REPLICA_INHIBITED 8302 #define ERROR_DS_ATT_NOT_DEF_IN_SCHEMA 8303 #define ERROR_DS_MAX_OBJ_SIZE_EXCEEDED 8304 #define ERROR_DS_OBJ_STRING_NAME_EXISTS 8305 #define ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA 8306 #define ERROR_DS_RDN_DOESNT_MATCH_SCHEMA 8307 #define ERROR_DS_NO_REQUESTED_ATTS_FOUND 8308 #define ERROR_DS_USER_BUFFER_TO_SMALL 8309 #define ERROR_DS_ATT_IS_NOT_ON_OBJ 8310 #define ERROR_DS_ILLEGAL_MOD_OPERATION 8311 #define ERROR_DS_OBJ_TOO_LARGE 8312 #define ERROR_DS_BAD_INSTANCE_TYPE 8313 #define ERROR_DS_MASTERDSA_REQUIRED 8314 #define ERROR_DS_OBJECT_CLASS_REQUIRED 8315 #define ERROR_DS_MISSING_REQUIRED_ATT 8316 #define ERROR_DS_ATT_NOT_DEF_FOR_CLASS 8317 #define ERROR_DS_ATT_ALREADY_EXISTS 8318 #define ERROR_DS_CANT_ADD_ATT_VALUES 8320 #define ERROR_DS_SINGLE_VALUE_CONSTRAINT 8321 #define ERROR_DS_RANGE_CONSTRAINT 8322 #define ERROR_DS_ATT_VAL_ALREADY_EXISTS 8323 #define ERROR_DS_CANT_REM_MISSING_ATT 8324 #define ERROR_DS_CANT_REM_MISSING_ATT_VAL 8325 #define ERROR_DS_ROOT_CANT_BE_SUBREF 8326 #define ERROR_DS_NO_CHAINING 8327 #define ERROR_DS_NO_CHAINED_EVAL 8328 #define ERROR_DS_NO_PARENT_OBJECT 8329 #define ERROR_DS_PARENT_IS_AN_ALIAS 8330 #define ERROR_DS_CANT_MIX_MASTER_AND_REPS 8331 #define ERROR_DS_CHILDREN_EXIST 8332 #define ERROR_DS_OBJ_NOT_FOUND 8333 #define ERROR_DS_ALIASED_OBJ_MISSING 8334 #define ERROR_DS_BAD_NAME_SYNTAX 8335 #define ERROR_DS_ALIAS_POINTS_TO_ALIAS 8336 #define ERROR_DS_CANT_DEREF_ALIAS 8337 #define ERROR_DS_OUT_OF_SCOPE 8338 #define ERROR_DS_CANT_DELETE_DSA_OBJ 8340 #define ERROR_DS_GENERIC_ERROR 8341 #define ERROR_DS_DSA_MUST_BE_INT_MASTER 8342 #define ERROR_DS_CLASS_NOT_DSA 8343 #define ERROR_DS_INSUFF_ACCESS_RIGHTS 8344 #define ERROR_DS_ILLEGAL_SUPERIOR 8345 #define ERROR_DS_ATTRIBUTE_OWNED_BY_SAM 8346 #define ERROR_DS_NAME_TOO_MANY_PARTS 8347 #define ERROR_DS_NAME_TOO_LONG 8348 #define ERROR_DS_NAME_VALUE_TOO_LONG 8349 #define ERROR_DS_NAME_UNPARSEABLE 8350 #define ERROR_DS_NAME_TYPE_UNKNOWN 8351 #define ERROR_DS_NOT_AN_OBJECT 8352 #define ERROR_DS_SEC_DESC_TOO_SHORT 8353 #define ERROR_DS_SEC_DESC_INVALID 8354 #define ERROR_DS_NO_DELETED_NAME 8355 #define ERROR_DS_SUBREF_MUST_HAVE_PARENT 8356 #define ERROR_DS_NCNAME_MUST_BE_NC 8357 #define ERROR_DS_CANT_ADD_SYSTEM_ONLY 8358 #define ERROR_DS_CLASS_MUST_BE_CONCRETE 8359 #define ERROR_DS_INVALID_DMD 8360 #define ERROR_DS_OBJ_GUID_EXISTS 8361 #define ERROR_DS_NOT_ON_BACKLINK 8362 #define ERROR_DS_NO_CROSSREF_FOR_NC 8363 #define ERROR_DS_SHUTTING_DOWN 8364 #define ERROR_DS_UNKNOWN_OPERATION 8365 #define ERROR_DS_INVALID_ROLE_OWNER 8366 #define ERROR_DS_COULDNT_CONTACT_FSMO 8367 #define ERROR_DS_CROSS_NC_DN_RENAME 8368 #define ERROR_DS_CANT_MOD_SYSTEM_ONLY 8369 #define ERROR_DS_REPLICATOR_ONLY 8370 #define ERROR_DS_OBJ_CLASS_NOT_DEFINED 8371 #define ERROR_DS_OBJ_CLASS_NOT_SUBCLASS 8372 #define ERROR_DS_NAME_REFERENCE_INVALID 8373 #define ERROR_DS_CROSS_REF_EXISTS 8374 #define ERROR_DS_CANT_DEL_MASTER_CROSSREF 8375 #define ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD 8376 #define ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX 8377 #define ERROR_DS_DUP_RDN 8378 #define ERROR_DS_DUP_OID 8379 #define ERROR_DS_DUP_MAPI_ID 8380 #define ERROR_DS_DUP_SCHEMA_ID_GUID 8381 #define ERROR_DS_DUP_LDAP_DISPLAY_NAME 8382 #define ERROR_DS_SEMANTIC_ATT_TEST 8383 #define ERROR_DS_SYNTAX_MISMATCH 8384 #define ERROR_DS_EXISTS_IN_MUST_HAVE 8385 #define ERROR_DS_EXISTS_IN_MAY_HAVE 8386 #define ERROR_DS_NONEXISTENT_MAY_HAVE 8387 #define ERROR_DS_NONEXISTENT_MUST_HAVE 8388 #define ERROR_DS_AUX_CLS_TEST_FAIL 8389 #define ERROR_DS_NONEXISTENT_POSS_SUP 8390 #define ERROR_DS_SUB_CLS_TEST_FAIL 8391 #define ERROR_DS_BAD_RDN_ATT_ID_SYNTAX 8392 #define ERROR_DS_EXISTS_IN_AUX_CLS 8393 #define ERROR_DS_EXISTS_IN_SUB_CLS 8394 #define ERROR_DS_EXISTS_IN_POSS_SUP 8395 #define ERROR_DS_RECALCSCHEMA_FAILED 8396 #define ERROR_DS_TREE_DELETE_NOT_FINISHED 8397 #define ERROR_DS_CANT_DELETE 8398 #define ERROR_DS_ATT_SCHEMA_REQ_ID 8399 #define ERROR_DS_BAD_ATT_SCHEMA_SYNTAX 8400 #define ERROR_DS_CANT_CACHE_ATT 8401 #define ERROR_DS_CANT_CACHE_CLASS 8402 #define ERROR_DS_CANT_REMOVE_ATT_CACHE 8403 #define ERROR_DS_CANT_REMOVE_CLASS_CACHE 8404 #define ERROR_DS_CANT_RETRIEVE_DN 8405 #define ERROR_DS_MISSING_SUPREF 8406 #define ERROR_DS_CANT_RETRIEVE_INSTANCE 8407 #define ERROR_DS_CODE_INCONSISTENCY 8408 #define ERROR_DS_DATABASE_ERROR 8409 #define ERROR_DS_GOVERNSID_MISSING 8410 #define ERROR_DS_MISSING_EXPECTED_ATT 8411 #define ERROR_DS_NCNAME_MISSING_CR_REF 8412 #define ERROR_DS_SECURITY_CHECKING_ERROR 8413 #define ERROR_DS_SCHEMA_NOT_LOADED 8414 #define ERROR_DS_SCHEMA_ALLOC_FAILED 8415 #define ERROR_DS_ATT_SCHEMA_REQ_SYNTAX 8416 #define ERROR_DS_GCVERIFY_ERROR 8417 #define ERROR_DS_DRA_SCHEMA_MISMATCH 8418 #define ERROR_DS_CANT_FIND_DSA_OBJ 8419 #define ERROR_DS_CANT_FIND_EXPECTED_NC 8420 #define ERROR_DS_CANT_FIND_NC_IN_CACHE 8421 #define ERROR_DS_CANT_RETRIEVE_CHILD 8422 #define ERROR_DS_SECURITY_ILLEGAL_MODIFY 8423 #define ERROR_DS_CANT_REPLACE_HIDDEN_REC 8424 #define ERROR_DS_BAD_HIERARCHY_FILE 8425 #define ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED 8426 #define ERROR_DS_CONFIG_PARAM_MISSING 8427 #define ERROR_DS_COUNTING_AB_INDICES_FAILED 8428 #define ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED 8429 #define ERROR_DS_INTERNAL_FAILURE 8430 #define ERROR_DS_UNKNOWN_ERROR 8431 #define ERROR_DS_ROOT_REQUIRES_CLASS_TOP 8432 #define ERROR_DS_REFUSING_FSMO_ROLES 8433 #define ERROR_DS_MISSING_FSMO_SETTINGS 8434 #define ERROR_DS_UNABLE_TO_SURRENDER_ROLES 8435 #define ERROR_DS_DRA_GENERIC 8436 #define ERROR_DS_DRA_INVALID_PARAMETER 8437 #define ERROR_DS_DRA_BUSY 8438 #define ERROR_DS_DRA_BAD_DN 8439 #define ERROR_DS_DRA_BAD_NC 8440 #define ERROR_DS_DRA_DN_EXISTS 8441 #define ERROR_DS_DRA_INTERNAL_ERROR 8442 #define ERROR_DS_DRA_INCONSISTENT_DIT 8443 #define ERROR_DS_DRA_CONNECTION_FAILED 8444 #define ERROR_DS_DRA_BAD_INSTANCE_TYPE 8445 #define ERROR_DS_DRA_OUT_OF_MEM 8446 #define ERROR_DS_DRA_MAIL_PROBLEM 8447 #define ERROR_DS_DRA_REF_ALREADY_EXISTS 8448 #define ERROR_DS_DRA_REF_NOT_FOUND 8449 #define ERROR_DS_DRA_OBJ_IS_REP_SOURCE 8450 #define ERROR_DS_DRA_DB_ERROR 8451 #define ERROR_DS_DRA_NO_REPLICA 8452 #define ERROR_DS_DRA_ACCESS_DENIED 8453 #define ERROR_DS_DRA_NOT_SUPPORTED 8454 #define ERROR_DS_DRA_RPC_CANCELLED 8455 #define ERROR_DS_DRA_SOURCE_DISABLED 8456 #define ERROR_DS_DRA_SINK_DISABLED 8457 #define ERROR_DS_DRA_NAME_COLLISION 8458 #define ERROR_DS_DRA_SOURCE_REINSTALLED 8459 #define ERROR_DS_DRA_MISSING_PARENT 8460 #define ERROR_DS_DRA_PREEMPTED 8461 #define ERROR_DS_DRA_ABANDON_SYNC 8462 #define ERROR_DS_DRA_SHUTDOWN 8463 #define ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET 8464 #define ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA 8465 #define ERROR_DS_DRA_EXTN_CONNECTION_FAILED 8466 #define ERROR_DS_INSTALL_SCHEMA_MISMATCH 8467 #define ERROR_DS_DUP_LINK_ID 8468 #define ERROR_DS_NAME_ERROR_RESOLVING 8469 #define ERROR_DS_NAME_ERROR_NOT_FOUND 8470 #define ERROR_DS_NAME_ERROR_NOT_UNIQUE 8471 #define ERROR_DS_NAME_ERROR_NO_MAPPING 8472 #define ERROR_DS_NAME_ERROR_DOMAIN_ONLY 8473 #define ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING 8474 #define ERROR_DS_CONSTRUCTED_ATT_MOD 8475 #define ERROR_DS_WRONG_OM_OBJ_CLASS 8476 #define ERROR_DS_DRA_REPL_PENDING 8477 #define ERROR_DS_DS_REQUIRED 8478 #define ERROR_DS_INVALID_LDAP_DISPLAY_NAME 8479 #define ERROR_DS_NON_BASE_SEARCH 8480 #define ERROR_DS_CANT_RETRIEVE_ATTS 8481 #define ERROR_DS_BACKLINK_WITHOUT_LINK 8482 #define ERROR_DS_EPOCH_MISMATCH 8483 #define ERROR_DS_SRC_NAME_MISMATCH 8484 #define ERROR_DS_SRC_AND_DST_NC_IDENTICAL 8485 #define ERROR_DS_DST_NC_MISMATCH 8486 #define ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC 8487 #define ERROR_DS_SRC_GUID_MISMATCH 8488 #define ERROR_DS_CANT_MOVE_DELETED_OBJECT 8489 #define ERROR_DS_PDC_OPERATION_IN_PROGRESS 8490 #define ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD 8491 #define ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION 8492 #define ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS 8493 #define ERROR_DS_NC_MUST_HAVE_NC_PARENT 8494 #define ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE 8495 #define ERROR_DS_DST_DOMAIN_NOT_NATIVE 8496 #define ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER 8497 #define ERROR_DS_CANT_MOVE_ACCOUNT_GROUP 8498 #define ERROR_DS_CANT_MOVE_RESOURCE_GROUP 8499 #define ERROR_DS_INVALID_SEARCH_FLAG 8500 #define ERROR_DS_NO_TREE_DELETE_ABOVE_NC 8501 #define ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE 8502 #define ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE 8503 #define ERROR_DS_SAM_INIT_FAILURE 8504 #define ERROR_DS_SENSITIVE_GROUP_VIOLATION 8505 #define ERROR_DS_CANT_MOD_PRIMARYGROUPID 8506 #define ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD 8507 #define ERROR_DS_NONSAFE_SCHEMA_CHANGE 8508 #define ERROR_DS_SCHEMA_UPDATE_DISALLOWED 8509 #define ERROR_DS_CANT_CREATE_UNDER_SCHEMA 8510 #define ERROR_DS_INSTALL_NO_SRC_SCH_VERSION 8511 #define ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE 8512 #define ERROR_DS_INVALID_GROUP_TYPE 8513 #define ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN 8514 #define ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN 8515 #define ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER 8516 #define ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER 8517 #define ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER 8518 #define ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER 8519 #define ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER 8520 #define ERROR_DS_HAVE_PRIMARY_MEMBERS 8521 #define ERROR_DS_STRING_SD_CONVERSION_FAILED 8522 #define ERROR_DS_NAMING_MASTER_GC 8523 #define ERROR_DS_LOOKUP_FAILURE 8524 #define ERROR_DS_COULDNT_UPDATE_SPNS 8525 #define ERROR_DS_CANT_RETRIEVE_SD 8526 #define ERROR_DS_KEY_NOT_UNIQUE 8527 #define ERROR_DS_WRONG_LINKED_ATT_SYNTAX 8528 #define ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD 8529 #define ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY 8530 #define ERROR_DS_CANT_START 8531 #define ERROR_DS_INIT_FAILURE 8532 #define ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION 8533 #define ERROR_DS_SOURCE_DOMAIN_IN_FOREST 8534 #define ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST 8535 #define ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED 8536 #define ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN 8537 #define ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER 8538 #define ERROR_DS_SRC_SID_EXISTS_IN_FOREST 8539 #define ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH 8540 #define ERROR_SAM_INIT_FAILURE 8541 #define ERROR_DS_DRA_SCHEMA_INFO_SHIP 8542 #define ERROR_DS_DRA_SCHEMA_CONFLICT 8543 #define ERROR_DS_DRA_EARLIER_SCHEMA_CONLICT 8544 #define ERROR_DS_DRA_OBJ_NC_MISMATCH 8545 #define ERROR_DS_NC_STILL_HAS_DSAS 8546 #define ERROR_DS_GC_REQUIRED 8547 #define ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY 8548 #define ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS 8549 #define ERROR_DS_CANT_ADD_TO_GC 8550 #define ERROR_DS_NO_CHECKPOINT_WITH_PDC 8551 #define ERROR_DS_SOURCE_AUDITING_NOT_ENABLED 8552 #define ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC 8553 #define ERROR_DS_INVALID_NAME_FOR_SPN 8554 #define ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS 8555 #define ERROR_DS_UNICODEPWD_NOT_IN_QUOTES 8556 #define ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED 8557 #define ERROR_DS_MUST_BE_RUN_ON_DST_DC 8558 #define ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER 8559 #define ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ 8560 #define DNS_ERROR_RCODE_FORMAT_ERROR 9001 #define DNS_ERROR_RCODE_SERVER_FAILURE 9002 #define DNS_ERROR_RCODE_NAME_ERROR 9003 #define DNS_ERROR_RCODE_NOT_IMPLEMENTED 9004 #define DNS_ERROR_RCODE_REFUSED 9005 #define DNS_ERROR_RCODE_YXDOMAIN 9006 #define DNS_ERROR_RCODE_YXRRSET 9007 #define DNS_ERROR_RCODE_NXRRSET 9008 #define DNS_ERROR_RCODE_NOTAUTH 9009 #define DNS_ERROR_RCODE_NOTZONE 9010 #define DNS_ERROR_RCODE_BADSIG 9016 #define DNS_ERROR_RCODE_BADKEY 9017 #define DNS_ERROR_RCODE_BADTIME 9018 #define DNS_INFO_NO_RECORDS 9501 #define DNS_ERROR_BAD_PACKET 9502 #define DNS_ERROR_NO_PACKET 9503 #define DNS_ERROR_RCODE 9504 #define DNS_ERROR_UNSECURE_PACKET 9505 #define DNS_ERROR_INVALID_TYPE 9551 #define DNS_ERROR_INVALID_IP_ADDRESS 9552 #define DNS_ERROR_INVALID_PROPERTY 9553 #define DNS_ERROR_TRY_AGAIN_LATER 9554 #define DNS_ERROR_NOT_UNIQUE 9555 #define DNS_ERROR_NON_RFC_NAME 9556 #define DNS_STATUS_FQDN 9557 #define DNS_STATUS_DOTTED_NAME 9558 #define DNS_STATUS_SINGLE_PART_NAME 9559 #define DNS_ERROR_INVALID_NAME_CHAR 9560 #define DNS_ERROR_NUMERIC_NAME 9561 #define DNS_ERROR_ZONE_DOES_NOT_EXIST 9601 #define DNS_ERROR_NO_ZONE_INFO 9602 #define DNS_ERROR_INVALID_ZONE_OPERATION 9603 #define DNS_ERROR_ZONE_CONFIGURATION_ERROR 9604 #define DNS_ERROR_ZONE_HAS_NO_SOA_RECORD 9605 #define DNS_ERROR_ZONE_HAS_NO_NS_RECORDS 9606 #define DNS_ERROR_ZONE_LOCKED 9607 #define DNS_ERROR_ZONE_CREATION_FAILED 9608 #define DNS_ERROR_ZONE_ALREADY_EXISTS 9609 #define DNS_ERROR_AUTOZONE_ALREADY_EXISTS 9610 #define DNS_ERROR_INVALID_ZONE_TYPE 9611 #define DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP 9612 #define DNS_ERROR_ZONE_NOT_SECONDARY 9613 #define DNS_ERROR_NEED_SECONDARY_ADDRESSES 9614 #define DNS_ERROR_WINS_INIT_FAILED 9615 #define DNS_ERROR_NEED_WINS_SERVERS 9616 #define DNS_ERROR_NBSTAT_INIT_FAILED 9617 #define DNS_ERROR_SOA_DELETE_INVALID 9618 #define DNS_ERROR_PRIMARY_REQUIRES_DATAFILE 9651 #define DNS_ERROR_INVALID_DATAFILE_NAME 9652 #define DNS_ERROR_DATAFILE_OPEN_FAILURE 9653 #define DNS_ERROR_FILE_WRITEBACK_FAILED 9654 #define DNS_ERROR_DATAFILE_PARSING 9655 #define DNS_ERROR_RECORD_DOES_NOT_EXIST 9701 #define DNS_ERROR_RECORD_FORMAT 9702 #define DNS_ERROR_NODE_CREATION_FAILED 9703 #define DNS_ERROR_UNKNOWN_RECORD_TYPE 9704 #define DNS_ERROR_RECORD_TIMED_OUT 9705 #define DNS_ERROR_NAME_NOT_IN_ZONE 9706 #define DNS_ERROR_CNAME_LOOP 9707 #define DNS_ERROR_NODE_IS_CNAME 9708 #define DNS_ERROR_CNAME_COLLISION 9709 #define DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT 9710 #define DNS_ERROR_RECORD_ALREADY_EXISTS 9711 #define DNS_ERROR_SECONDARY_DATA 9712 #define DNS_ERROR_NO_CREATE_CACHE_DATA 9713 #define DNS_ERROR_NAME_DOES_NOT_EXIST 9714 #define DNS_WARNING_PTR_CREATE_FAILED 9715 #define DNS_WARNING_DOMAIN_UNDELETED 9716 #define DNS_ERROR_DS_UNAVAILABLE 9717 #define DNS_ERROR_DS_ZONE_ALREADY_EXISTS 9718 #define DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE 9719 #define DNS_INFO_AXFR_COMPLETE 9751 #define DNS_ERROR_AXFR 9752 #define DNS_INFO_ADDED_LOCAL_WINS 9753 #define DNS_STATUS_CONTINUE_NEEDED 9801 #define DNS_ERROR_NO_TCPIP 9851 #define DNS_ERROR_NO_DNS_SERVERS 9852 /* HRESULT values for OLE, SHELL and other Interface stuff */ /* the codes 4000-40ff are reserved for OLE */ #define NOERROR 0L #define S_OK ((HRESULT)0L) #define S_FALSE ((HRESULT)1L) #define DISP_E_UNKNOWNINTERFACE 0x80020001L #define DISP_E_MEMBERNOTFOUND 0x80020003L #define DISP_E_PARAMNOTFOUND 0x80020004L #define DISP_E_TYPEMISMATCH 0x80020005L #define DISP_E_UNKNOWNNAME 0x80020006L #define DISP_E_NONAMEDARGS 0x80020007L #define DISP_E_BADVARTYPE 0x80020008L #define DISP_E_EXCEPTION 0x80020009L #define DISP_E_OVERFLOW 0x8002000AL #define DISP_E_BADINDEX 0x8002000BL #define DISP_E_UNKNOWNLCID 0x8002000CL #define DISP_E_ARRAYISLOCKED 0x8002000DL #define DISP_E_BADPARAMCOUNT 0x8002000EL #define DISP_E_PARAMNOTOPTIONAL 0x8002000FL #define TYPE_E_ELEMENTNOTFOUND 0x8002802BL #define TYPE_E_CANTLOADLIBRARY 0x80029C4AL /* OLE Clipboard */ #define CLIPBRD_E_FIRST 0x800401D0L #define CLIPBRD_E_LAST 0x800401DFL #define CLIPBRD_S_FIRST 0x000401D0L #define CLIPBRD_S_LAST 0x000401DFL #define CLIPBRD_E_CANT_OPEN 0x800401D0L #define CLIPBRD_E_CANT_EMPTY 0x800401D1L #define CLIPBRD_E_CANT_SET 0x800401D2L #define CLIPBRD_E_BAD_DATA 0x800401D3L #define CLIPBRD_E_CANT_CLOSE 0x800401D4L /* Drag and Drop */ #define DRAGDROP_S_DROP 0x00040100L #define DRAGDROP_S_CANCEL 0x00040101L #define DRAGDROP_E_NOTREGISTERED 0x80040100L #define DRAGDROP_E_ALREADYREGISTERED 0x80040101L #define DRAGDROP_S_USEDEFAULTCURSORS 0x00040102L #define E_UNEXPECTED 0x8000FFFF #define E_NOTIMPL 0x80004001 #define E_NOINTERFACE 0x80004002 #define E_POINTER 0x80004003 #define E_ABORT 0x80004004 #define E_FAIL 0x80004005 #define E_UNSPEC E_FAIL /* must to be defined (used by FileMoniker, IOleLink and DoDragDrop as a return value) */ /*#define CO_E_INIT_TLS 0x80004006 #define CO_E_INIT_SHARED_ALLOCATOR 0x80004007 #define CO_E_INIT_MEMORY_ALLOCATOR 0x80004008 #define CO_E_INIT_CLASS_CACHE 0x80004009 #define CO_E_INIT_RPC_CHANNEL 0x8000400A #define CO_E_INIT_TLS_SET_CHANNEL_CONTROL 0x8000400B #define CO_E_INIT_TLS_CHANNEL_CONTROL 0x8000400C #define CO_E_INIT_UNACCEPTED_USER_ALLOCATOR 0x8000400D #define CO_E_INIT_SCM_MUTEX_EXISTS 0x8000400E #define CO_E_INIT_SCM_FILE_MAPPING_EXISTS 0x8000400F #define CO_E_INIT_SCM_MAP_VIEW_OF_FILE 0x80004010 #define CO_E_INIT_SCM_EXEC_FAILURE 0x80004011 #define CO_E_INIT_ONLY_SINGLE_THREADED 0x80004012 */ #define CO_S_NOTALLINTERFACES 0x00080012 #define CO_E_NOTINITIALIZED 0x800401F0 #define CO_E_ERRORINDLL 0x800401F9 #define CO_E_OBJISREG 0x800401FB #define OLE_E_FIRST 0x80040000L #define OLE_E_LAST 0x800400FFL #define OLE_S_FIRST 0x00040000L #define OLE_S_LAST 0x000400FFL #define OLE_E_ENUM_NOMORE 0x80040002 #define OLE_E_ADVISENOTSUPPORTED 0x80040003 #define OLE_E_NOCONNECTION 0x80040004 #define OLE_E_NOTRUNNING 0x80040005 #define OLE_E_NOCACHE 0x80040006 #define OLE_E_BLANK 0x80040007 #define OLE_E_NOT_INPLACEACTIVE 0x80040010 #define OLE_E_STATIC 0x8004000B #define OLE_E_PROMPTSAVECANCELLED 0x8004000C #define OLE_S_USEREG 0x00040000 #define OLE_S_STATIC 0x00040001 #define DV_E_FORMATETC 0x80040064 #define DV_E_DVASPECT 0x8004006B #define DV_E_LINDEX 0x80040068 #define DV_E_TYMED 0x80040069 #define CLASS_E_NOAGGREGATION 0x80040110 #define CLASS_E_CLASSNOTAVAILABLE 0x80040111 #define DATA_S_SAMEFORMATETC 0x80040130 #define E_ACCESSDENIED 0x80070005 #define E_HANDLE 0x80070006 #define E_OUTOFMEMORY 0x8007000E #define E_INVALIDARG 0x80070057 /*#define OLE_E_FIRST 0x80040000L */ /*#define OLE_E_LAST 0x800400FFL */ /*#define OLE_S_FIRST 0x00040000L */ /*#define OLE_S_LAST 0x000400FFL */ #define MK_S_REDUCED_TO_SELF 0x000401E2 #define MK_S_ME 0x000401E4 #define MK_S_HIM 0x000401E5 #define MK_S_US 0x000401E6 #define MK_S_MONIKERALREADYREGISTERED 0x000401E7 #define MK_E_EXCEEDEDDEADLINE 0x800401E1 #define MK_E_NEEDGENERIC 0x800401E2 #define MK_E_UNAVAILABLE 0x800401E3 #define MK_E_SYNTAX 0x800401E4 #define MK_E_NOOBJECT 0x800401E5 #define MK_E_INVALIDEXTENSION 0x800401E6 #define MK_E_INTERMEDIATEINTERFACENOTSUPPORTED 0x800401E7 #define MK_E_NOTBINDABLE 0x800401E8 #define MK_E_NOTBOUND 0x800401E9 #define MK_E_CANTOPENFILE 0x800401EA #define MK_E_MIUSTBOTHERUSER 0x800401EB #define MK_E_NOINVERSE 0x800401EC #define MK_E_NOSTORAGE 0x800401ED #define MK_E_NOPREFIX 0x800401EE #define STG_E_INVALIDFUNCTION 0x80030001 #define STG_E_FILENOTFOUND 0x80030002 #define STG_E_PATHNOTFOUND 0x80030003 #define STG_E_TOOMANYOPENFILES 0x80030004 #define STG_E_ACCESSDENIED 0x80030005 #define STG_E_INVALIDHANDLE 0x80030006 #define STG_E_INSUFFICIENTMEMORY 0x80030008 #define STG_E_INVALIDPOINTER 0x80030009 #define STG_E_NOMOREFILES 0x80030012 #define STG_E_DISKISWRITEPROTECTED 0x80030013 #define STG_E_SEEKERROR 0x80030019 #define STG_E_WRITEFAULT 0x8003001D #define STG_E_READFAULT 0x8003001E #define STG_E_SHAREVIOLATION 0x80030020 #define STG_E_LOCKVIOLATION 0x80030021 #define STG_E_FILEALREADYEXISTS 0x80030050 #define STG_E_INVALIDPARAMETER 0x80030057 #define STG_E_MEDIUMFULL 0x80030070 #define STG_E_ABNORMALAPIEXIT 0x800300FA #define STG_E_INVALIDHEADER 0x800300FB #define STG_E_INVALIDNAME 0x800300FC #define STG_E_UNKNOWN 0x800300FD #define STG_E_UNIMPLEMENTEDFUNCTION 0x800300FE #define STG_E_INVALIDFLAG 0x800300FF #define STG_E_INUSE 0x80030100 #define STG_E_NOTCURRENT 0x80030101 #define STG_E_REVERTED 0x80030102 #define STG_E_CANTSAVE 0x80030103 #define STG_E_OLDFORMAT 0x80030104 #define STG_E_OLDDLL 0x80030105 #define STG_E_SHAREREQUIRED 0x80030106 #define STG_E_NOTFILEBASEDSTORAGE 0x80030107 #define STG_E_EXTANTMARSHALLINGS 0x80030108 #define CONVERT10_E_OLESTREAM_GET 0x800401C0 #define CONVERT10_E_OLESTREAM_PUT 0x800401C1 #define CONVERT10_E_OLESTREAM_FMT 0x800401C2 #define CONVERT10_E_OLESTREAM_BITMAP_TO_DIB 0x800401C3 #define CONVERT10_E_STG_FMT 0x800401C4 #define CONVERT10_E_STG_NO_STD_STREAM 0x800401C5 #define CONVERT10_E_STG_DIB_TO_BITMAP 0x800401C6 /* alten versionen #define E_NOTIMPL 0x80000001 #define E_OUTOFMEMORY 0x80000002 #define E_INVALIDARG 0x80000003 #define E_NOINTERFACE 0x80000004 #define E_POINTER 0x80000005 #define E_HANDLE 0x80000006 #define E_ABORT 0x80000007 #define E_FAIL 0x80000008 #define E_ACCESSDENIED 0x80000009 */ /* Obtained from lcc-win32 include files */ #define GDI_ERROR 0xffffffff /* registry errors */ #define REGDB_E_READREGDB 0x80040150 #define REGDB_E_CLASSNOTREG 0x80040154 #define INPLACE_E_NOTUNDOABLE 0x800401A0 #define INPLACE_E_NOTOOLSPACE 0x800401A1 #define DATA_E_FORMATETC DV_E_FORMATETC #define CLASSFACTORY_E_FIRST 0x80040110L #define CLASSFACTORY_E_LAST 0x8004011FL #define CLASSFACTORY_S_FIRST 0x80040110L #define CLASSFACTORY_S_LAST 0x8004011FL #define CLASS_E_NOTLICENSED (CLASSFACTORY_E_FIRST+2) #define CLASS_E_NOAGGREGATION 0x80040110 #define CLASS_E_CLASSNOTAVAILABLE 0x80040111 #define OLEOBJ_E_NOVERBS 0x00040180L #define OLEOBJ_E_INVALIDVERB 0x00040181L #define OLEOBJ_S_INVALIDVERB 0x00040180L #endif /* __WINE_WINERROR_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/winestring.h0000644000175000017500000000054507233220504023626 0ustar yavoryavor#ifndef __WINE_WINE_WINESTRING_H #define __WINE_WINE_WINESTRING_H #include "windef.h" LPWSTR WINAPI lstrcpyAtoW(LPWSTR,LPCSTR); LPSTR WINAPI lstrcpyWtoA(LPSTR,LPCWSTR); LPWSTR WINAPI lstrcpynAtoW(LPWSTR,LPCSTR,INT); LPSTR WINAPI lstrcpynWtoA(LPSTR,LPCWSTR,INT); #define lstrncmpiA strncasecmp #endif /* __WINE_WINE_WINESTRING_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/winnt.h0000644000175000017500000024005307463521215022604 0ustar yavoryavor/* * Win32 definitions for Windows NT * * Copyright 1996 Alexandre Julliard */ #ifndef __WINE_WINNT_H #define __WINE_WINNT_H #include "windef.h" #ifndef RC_INVOKED #include #endif #include "pshpack1.h" /* Defines */ /* Argument 1 passed to the DllEntryProc. */ #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */ #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */ #define DLL_THREAD_ATTACH 2 /* attach new thread */ #define DLL_THREAD_DETACH 3 /* detach thread */ /* u.x.wProcessorArchitecture (NT) */ #define PROCESSOR_ARCHITECTURE_INTEL 0 #define PROCESSOR_ARCHITECTURE_MIPS 1 #define PROCESSOR_ARCHITECTURE_ALPHA 2 #define PROCESSOR_ARCHITECTURE_PPC 3 #define PROCESSOR_ARCHITECTURE_SHX 4 #define PROCESSOR_ARCHITECTURE_ARM 5 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF /* dwProcessorType */ #define PROCESSOR_INTEL_386 386 #define PROCESSOR_INTEL_486 486 #define PROCESSOR_INTEL_PENTIUM 586 #define PROCESSOR_INTEL_860 860 #define PROCESSOR_MIPS_R2000 2000 #define PROCESSOR_MIPS_R3000 3000 #define PROCESSOR_MIPS_R4000 4000 #define PROCESSOR_ALPHA_21064 21064 #define PROCESSOR_PPC_601 601 #define PROCESSOR_PPC_603 603 #define PROCESSOR_PPC_604 604 #define PROCESSOR_PPC_620 620 #define PROCESSOR_HITACHI_SH3 10003 #define PROCESSOR_HITACHI_SH3E 10004 #define PROCESSOR_HITACHI_SH4 10005 #define PROCESSOR_MOTOROLA_821 821 #define PROCESSOR_SHx_SH3 103 #define PROCESSOR_SHx_SH4 104 #define PROCESSOR_STRONGARM 2577 #define PROCESSOR_ARM720 1824 /* 0x720 */ #define PROCESSOR_ARM820 2080 /* 0x820 */ #define PROCESSOR_ARM920 2336 /* 0x920 */ #define PROCESSOR_ARM_7TDMI 70001 #define ANYSIZE_ARRAY 1 #define MINCHAR 0x80 #define MAXCHAR 0x7f #define MINSHORT 0x8000 #define MAXSHORT 0x7fff #define MINLONG 0x80000000 #define MAXLONG 0x7fffffff #define MAXBYTE 0xff #define MAXWORD 0xffff #define MAXDWORD 0xffffffff #define FIELD_OFFSET(type, field) \ ((LONG)(INT)&(((type *)0)->field)) #define CONTAINING_RECORD(address, type, field) \ ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field))) /* Types */ /* TCHAR data types definitions for Winelib. */ /* These types are _not_ defined for the emulator, because they */ /* depend on the UNICODE macro that only exists in user's code. */ //#ifndef __WINE__ # ifdef UNICODE typedef WCHAR TCHAR, *PTCHAR; typedef LPWSTR PTSTR, LPTSTR; typedef LPCWSTR PCTSTR, LPCTSTR; #define __TEXT(string) L##string /*probably wrong */ # else /* UNICODE */ typedef char TCHAR, *PTCHAR; typedef LPSTR PTSTR, LPTSTR; typedef LPCSTR PCTSTR, LPCTSTR; #define __TEXT(string) string # endif /* UNICODE */ //#endif /* __WINE__ */ #define TEXT(quote) __TEXT(quote) typedef BYTE BOOLEAN; typedef BOOLEAN *PBOOLEAN; typedef struct _LIST_ENTRY { struct _LIST_ENTRY *Flink; struct _LIST_ENTRY *Blink; } LIST_ENTRY, *PLIST_ENTRY; typedef struct _SINGLE_LIST_ENTRY { struct _SINGLE_LIST_ENTRY *Next; } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY; /* Heap flags */ #define HEAP_NO_SERIALIZE 0x00000001 #define HEAP_GROWABLE 0x00000002 #define HEAP_GENERATE_EXCEPTIONS 0x00000004 #define HEAP_ZERO_MEMORY 0x00000008 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020 #define HEAP_FREE_CHECKING_ENABLED 0x00000040 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080 #define HEAP_CREATE_ALIGN_16 0x00010000 #define HEAP_CREATE_ENABLE_TRACING 0x00020000 #define HEAP_WINE_SEGPTR 0x01000000 /* Not a Win32 flag */ #define HEAP_WINE_CODESEG 0x02000000 /* Not a Win32 flag */ #define HEAP_WINE_CODE16SEG 0x04000000 /* Not a Win32 flag */ #define HEAP_WINE_SHARED 0x08000000 /* Not a Win32 flag */ /* Processor feature flags. */ #define PF_FLOATING_POINT_PRECISION_ERRATA 0 #define PF_FLOATING_POINT_EMULATED 1 #define PF_COMPARE_EXCHANGE_DOUBLE 2 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3 #define PF_PPC_MOVEMEM_64BIT_OK 4 #define PF_ALPHA_BYTE_INSTRUCTIONS 5 /* based on wine-20010510 -- alex */ #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 #define PF_AMD3D_INSTRUCTIONS_AVAILABLE 7 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8 /* The Win32 register context */ /* CONTEXT is the CPU-dependent context; it should be used */ /* wherever a platform-specific context is needed (e.g. exception */ /* handling, Win32 register functions). */ /* CONTEXT86 is the i386-specific context; it should be used */ /* wherever only a 386 context makes sense (e.g. DOS interrupts, */ /* Win16 register functions), so that this code can be compiled */ /* on all platforms. */ #define SIZE_OF_80387_REGISTERS 80 typedef struct _FLOATING_SAVE_AREA { DWORD ControlWord; DWORD StatusWord; DWORD TagWord; DWORD ErrorOffset; DWORD ErrorSelector; DWORD DataOffset; DWORD DataSelector; BYTE RegisterArea[SIZE_OF_80387_REGISTERS]; DWORD Cr0NpxState; } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA; typedef struct _CONTEXT86 { DWORD ContextFlags; /* These are selected by CONTEXT_DEBUG_REGISTERS */ DWORD Dr0; DWORD Dr1; DWORD Dr2; DWORD Dr3; DWORD Dr6; DWORD Dr7; /* These are selected by CONTEXT_FLOATING_POINT */ FLOATING_SAVE_AREA FloatSave; /* These are selected by CONTEXT_SEGMENTS */ DWORD SegGs; DWORD SegFs; DWORD SegEs; DWORD SegDs; /* These are selected by CONTEXT_INTEGER */ DWORD Edi; DWORD Esi; DWORD Ebx; DWORD Edx; DWORD Ecx; DWORD Eax; /* These are selected by CONTEXT_CONTROL */ DWORD Ebp; DWORD Eip; DWORD SegCs; DWORD EFlags; DWORD Esp; DWORD SegSs; } CONTEXT86; #define CONTEXT_X86 0x00010000 #define CONTEXT_i386 CONTEXT_X86 #define CONTEXT_i486 CONTEXT_X86 #define CONTEXT86_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */ #define CONTEXT86_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */ #define CONTEXT86_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */ #define CONTEXT86_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */ #define CONTEXT86_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */ #define CONTEXT86_FULL (CONTEXT86_CONTROL | CONTEXT86_INTEGER | CONTEXT86_SEGMENTS) /* i386 context definitions */ #ifdef __i386__ #define CONTEXT_CONTROL CONTEXT86_CONTROL #define CONTEXT_INTEGER CONTEXT86_INTEGER #define CONTEXT_SEGMENTS CONTEXT86_SEGMENTS #define CONTEXT_FLOATING_POINT CONTEXT86_FLOATING_POINT #define CONTEXT_DEBUG_REGISTERS CONTEXT86_DEBUG_REGISTERS #define CONTEXT_FULL CONTEXT86_FULL typedef CONTEXT86 CONTEXT; #endif /* __i386__ */ /* Alpha context definitions */ #if defined(_ALPHA_) || defined(__alpha__) #define CONTEXT_ALPHA 0x00020000 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L) #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L) #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L) #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER) typedef struct _CONTEXT { /* selected by CONTEXT_FLOATING_POINT */ ULONGLONG FltF0; ULONGLONG FltF1; ULONGLONG FltF2; ULONGLONG FltF3; ULONGLONG FltF4; ULONGLONG FltF5; ULONGLONG FltF6; ULONGLONG FltF7; ULONGLONG FltF8; ULONGLONG FltF9; ULONGLONG FltF10; ULONGLONG FltF11; ULONGLONG FltF12; ULONGLONG FltF13; ULONGLONG FltF14; ULONGLONG FltF15; ULONGLONG FltF16; ULONGLONG FltF17; ULONGLONG FltF18; ULONGLONG FltF19; ULONGLONG FltF20; ULONGLONG FltF21; ULONGLONG FltF22; ULONGLONG FltF23; ULONGLONG FltF24; ULONGLONG FltF25; ULONGLONG FltF26; ULONGLONG FltF27; ULONGLONG FltF28; ULONGLONG FltF29; ULONGLONG FltF30; ULONGLONG FltF31; /* selected by CONTEXT_INTEGER */ ULONGLONG IntV0; ULONGLONG IntT0; ULONGLONG IntT1; ULONGLONG IntT2; ULONGLONG IntT3; ULONGLONG IntT4; ULONGLONG IntT5; ULONGLONG IntT6; ULONGLONG IntT7; ULONGLONG IntS0; ULONGLONG IntS1; ULONGLONG IntS2; ULONGLONG IntS3; ULONGLONG IntS4; ULONGLONG IntS5; ULONGLONG IntFp; ULONGLONG IntA0; ULONGLONG IntA1; ULONGLONG IntA2; ULONGLONG IntA3; ULONGLONG IntA4; ULONGLONG IntA5; ULONGLONG IntT8; ULONGLONG IntT9; ULONGLONG IntT10; ULONGLONG IntT11; ULONGLONG IntRa; ULONGLONG IntT12; ULONGLONG IntAt; ULONGLONG IntGp; ULONGLONG IntSp; ULONGLONG IntZero; /* selected by CONTEXT_FLOATING_POINT */ ULONGLONG Fpcr; ULONGLONG SoftFpcr; /* selected by CONTEXT_CONTROL */ ULONGLONG Fir; DWORD Psr; DWORD ContextFlags; DWORD Fill[4]; } CONTEXT; #define _QUAD_PSR_OFFSET HighSoftFpcr #define _QUAD_FLAGS_OFFSET HighFir #endif /* _ALPHA_ */ /* Mips context definitions */ #ifdef _MIPS_ #define CONTEXT_R4000 0x00010000 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001) #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002) #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004) #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER) typedef struct _CONTEXT { DWORD Argument[4]; /* These are selected by CONTEXT_FLOATING_POINT */ DWORD FltF0; DWORD FltF1; DWORD FltF2; DWORD FltF3; DWORD FltF4; DWORD FltF5; DWORD FltF6; DWORD FltF7; DWORD FltF8; DWORD FltF9; DWORD FltF10; DWORD FltF11; DWORD FltF12; DWORD FltF13; DWORD FltF14; DWORD FltF15; DWORD FltF16; DWORD FltF17; DWORD FltF18; DWORD FltF19; DWORD FltF20; DWORD FltF21; DWORD FltF22; DWORD FltF23; DWORD FltF24; DWORD FltF25; DWORD FltF26; DWORD FltF27; DWORD FltF28; DWORD FltF29; DWORD FltF30; DWORD FltF31; /* These are selected by CONTEXT_INTEGER */ DWORD IntZero; DWORD IntAt; DWORD IntV0; DWORD IntV1; DWORD IntA0; DWORD IntA1; DWORD IntA2; DWORD IntA3; DWORD IntT0; DWORD IntT1; DWORD IntT2; DWORD IntT3; DWORD IntT4; DWORD IntT5; DWORD IntT6; DWORD IntT7; DWORD IntS0; DWORD IntS1; DWORD IntS2; DWORD IntS3; DWORD IntS4; DWORD IntS5; DWORD IntS6; DWORD IntS7; DWORD IntT8; DWORD IntT9; DWORD IntK0; DWORD IntK1; DWORD IntGp; DWORD IntSp; DWORD IntS8; DWORD IntRa; DWORD IntLo; DWORD IntHi; /* These are selected by CONTEXT_FLOATING_POINT */ DWORD Fsr; /* These are selected by CONTEXT_CONTROL */ DWORD Fir; DWORD Psr; DWORD ContextFlags; DWORD Fill[2]; } CONTEXT; #endif /* _MIPS_ */ /* PowerPC context definitions */ #ifdef __PPC__ #define CONTEXT_CONTROL 0x0001 #define CONTEXT_FLOATING_POINT 0x0002 #define CONTEXT_INTEGER 0x0004 #define CONTEXT_DEBUG_REGISTERS 0x0008 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER) typedef struct { /* These are selected by CONTEXT_FLOATING_POINT */ double Fpr0; double Fpr1; double Fpr2; double Fpr3; double Fpr4; double Fpr5; double Fpr6; double Fpr7; double Fpr8; double Fpr9; double Fpr10; double Fpr11; double Fpr12; double Fpr13; double Fpr14; double Fpr15; double Fpr16; double Fpr17; double Fpr18; double Fpr19; double Fpr20; double Fpr21; double Fpr22; double Fpr23; double Fpr24; double Fpr25; double Fpr26; double Fpr27; double Fpr28; double Fpr29; double Fpr30; double Fpr31; double Fpscr; /* These are selected by CONTEXT_INTEGER */ DWORD Gpr0; DWORD Gpr1; DWORD Gpr2; DWORD Gpr3; DWORD Gpr4; DWORD Gpr5; DWORD Gpr6; DWORD Gpr7; DWORD Gpr8; DWORD Gpr9; DWORD Gpr10; DWORD Gpr11; DWORD Gpr12; DWORD Gpr13; DWORD Gpr14; DWORD Gpr15; DWORD Gpr16; DWORD Gpr17; DWORD Gpr18; DWORD Gpr19; DWORD Gpr20; DWORD Gpr21; DWORD Gpr22; DWORD Gpr23; DWORD Gpr24; DWORD Gpr25; DWORD Gpr26; DWORD Gpr27; DWORD Gpr28; DWORD Gpr29; DWORD Gpr30; DWORD Gpr31; DWORD Cr; DWORD Xer; /* These are selected by CONTEXT_CONTROL */ DWORD Msr; DWORD Iar; DWORD Lr; DWORD Ctr; DWORD ContextFlags; DWORD Fill[3]; /* These are selected by CONTEXT_DEBUG_REGISTERS */ DWORD Dr0; DWORD Dr1; DWORD Dr2; DWORD Dr3; DWORD Dr4; DWORD Dr5; DWORD Dr6; DWORD Dr7; } CONTEXT; typedef struct _STACK_FRAME_HEADER { DWORD BackChain; DWORD GlueSaved1; DWORD GlueSaved2; DWORD Reserved1; DWORD Spare1; DWORD Spare2; DWORD Parameter0; DWORD Parameter1; DWORD Parameter2; DWORD Parameter3; DWORD Parameter4; DWORD Parameter5; DWORD Parameter6; DWORD Parameter7; } STACK_FRAME_HEADER,*PSTACK_FRAME_HEADER; #endif /* __PPC__ */ #ifdef __sparc__ /* * FIXME: * * There is no official CONTEXT structure defined for the SPARC * architecture, so I just made one up. * * This structure is valid only for 32-bit SPARC architectures, * not for 64-bit SPARC. * * Note that this structure contains only the 'top-level' registers; * the rest of the register window chain is not visible. * * The layout follows the Solaris 'prgregset_t' structure. * */ #define CONTEXT_SPARC 0x10000000 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001) #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002) #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004) #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER) typedef struct _CONTEXT { DWORD ContextFlags; /* These are selected by CONTEXT_INTEGER */ DWORD g0; DWORD g1; DWORD g2; DWORD g3; DWORD g4; DWORD g5; DWORD g6; DWORD g7; DWORD o0; DWORD o1; DWORD o2; DWORD o3; DWORD o4; DWORD o5; DWORD o6; DWORD o7; DWORD l0; DWORD l1; DWORD l2; DWORD l3; DWORD l4; DWORD l5; DWORD l6; DWORD l7; DWORD i0; DWORD i1; DWORD i2; DWORD i3; DWORD i4; DWORD i5; DWORD i6; DWORD i7; /* These are selected by CONTEXT_CONTROL */ DWORD psr; DWORD pc; DWORD npc; DWORD y; DWORD wim; DWORD tbr; /* FIXME: floating point registers missing */ } CONTEXT; #endif /* __sparc__ */ #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED) #error You need to define a CONTEXT for your CPU #endif typedef CONTEXT *PCONTEXT; typedef HANDLE *PHANDLE; #ifdef __WINE__ /* Macros for easier access to i386 context registers */ #define EAX_reg(context) ((context)->Eax) #define EBX_reg(context) ((context)->Ebx) #define ECX_reg(context) ((context)->Ecx) #define EDX_reg(context) ((context)->Edx) #define ESI_reg(context) ((context)->Esi) #define EDI_reg(context) ((context)->Edi) #define EBP_reg(context) ((context)->Ebp) #define CS_reg(context) ((context)->SegCs) #define DS_reg(context) ((context)->SegDs) #define ES_reg(context) ((context)->SegEs) #define FS_reg(context) ((context)->SegFs) #define GS_reg(context) ((context)->SegGs) #define SS_reg(context) ((context)->SegSs) #define EFL_reg(context) ((context)->EFlags) #define EIP_reg(context) ((context)->Eip) #define ESP_reg(context) ((context)->Esp) #define AX_reg(context) (*(WORD*)&EAX_reg(context)) #define BX_reg(context) (*(WORD*)&EBX_reg(context)) #define CX_reg(context) (*(WORD*)&ECX_reg(context)) #define DX_reg(context) (*(WORD*)&EDX_reg(context)) #define SI_reg(context) (*(WORD*)&ESI_reg(context)) #define DI_reg(context) (*(WORD*)&EDI_reg(context)) #define BP_reg(context) (*(WORD*)&EBP_reg(context)) #define AL_reg(context) (*(BYTE*)&EAX_reg(context)) #define AH_reg(context) (*((BYTE*)&EAX_reg(context)+1)) #define BL_reg(context) (*(BYTE*)&EBX_reg(context)) #define BH_reg(context) (*((BYTE*)&EBX_reg(context)+1)) #define CL_reg(context) (*(BYTE*)&ECX_reg(context)) #define CH_reg(context) (*((BYTE*)&ECX_reg(context)+1)) #define DL_reg(context) (*(BYTE*)&EDX_reg(context)) #define DH_reg(context) (*((BYTE*)&EDX_reg(context)+1)) #define SET_CFLAG(context) (EFL_reg(context) |= 0x0001) #define RESET_CFLAG(context) (EFL_reg(context) &= ~0x0001) #define SET_ZFLAG(context) (EFL_reg(context) |= 0x0040) #define RESET_ZFLAG(context) (EFL_reg(context) &= ~0x0040) #define ISV86(context) (EFL_reg(context) & 0x00020000) #define V86BASE(context) ((context)->Dr7) /* ugly */ /* Macros to retrieve the current context */ #ifdef __i386__ #ifdef NEED_UNDERSCORE_PREFIX # define __ASM_NAME(name) "_" name #else # define __ASM_NAME(name) name #endif #ifdef __GNUC__ # define __ASM_GLOBAL_FUNC(name,code) \ __asm__( ".align 4\n\t" \ ".globl " __ASM_NAME(#name) "\n\t" \ ".type " __ASM_NAME(#name) ",@function\n" \ __ASM_NAME(#name) ":\n\t" \ code ); #else /* __GNUC__ */ # define __ASM_GLOBAL_FUNC(name,code) \ void __asm_dummy_##name(void) { \ asm( ".align 4\n\t" \ ".globl " __ASM_NAME(#name) "\n\t" \ ".type " __ASM_NAME(#name) ",@function\n" \ __ASM_NAME(#name) ":\n\t" \ code ); \ } #endif /* __GNUC__ */ #define _DEFINE_REGS_ENTRYPOINT( name, fn, args ) \ __ASM_GLOBAL_FUNC( name, \ "call " __ASM_NAME("CALL32_Regs") "\n\t" \ ".long " __ASM_NAME(#fn) "\n\t" \ ".byte " #args ", " #args ) #define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \ _DEFINE_REGS_ENTRYPOINT( name, fn, 0 ) #define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \ _DEFINE_REGS_ENTRYPOINT( name, fn, 4 ) #define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \ _DEFINE_REGS_ENTRYPOINT( name, fn, 8 ) #define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \ _DEFINE_REGS_ENTRYPOINT( name, fn, 12 ) #define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \ _DEFINE_REGS_ENTRYPOINT( name, fn, 16 ) #endif /* __i386__ */ #ifdef __sparc__ /* FIXME: use getcontext() to retrieve full context */ #define _GET_CONTEXT \ CONTEXT context; \ do { memset(&context, 0, sizeof(CONTEXT)); \ context.ContextFlags = CONTEXT_CONTROL; \ context.pc = (DWORD)__builtin_return_address(0); \ } while (0) #define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \ void WINAPI name ( void ) \ { _GET_CONTEXT; fn( &context ); } #define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \ void WINAPI name ( t1 a1 ) \ { _GET_CONTEXT; fn( a1, &context ); } #define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \ void WINAPI name ( t1 a1, t2 a2 ) \ { _GET_CONTEXT; fn( a1, a2, &context ); } #define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \ void WINAPI name ( t1 a1, t2 a2, t3 a3 ) \ { _GET_CONTEXT; fn( a1, a2, a3, &context ); } #define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \ void WINAPI name ( t1 a1, t2 a2, t3 a3, t4 a4 ) \ { _GET_CONTEXT; fn( a1, a2, a3, a4, &context ); } #endif /* __sparc__ */ #ifndef DEFINE_REGS_ENTRYPOINT_0 #error You need to define DEFINE_REGS_ENTRYPOINT macros for your CPU #endif #ifdef __i386__ # define GET_IP(context) ((LPVOID)(context)->Eip) #endif #ifdef __sparc__ # define GET_IP(context) ((LPVOID)(context)->pc) #endif #if !defined(GET_IP) && !defined(RC_INVOKED) # error You must define GET_IP for this CPU #endif #endif /* __WINE__ */ /* * Exception codes */ #define STATUS_SUCCESS 0x00000000 #define STATUS_WAIT_0 0x00000000 #define STATUS_ABANDONED_WAIT_0 0x00000080 #define STATUS_USER_APC 0x000000C0 #define STATUS_TIMEOUT 0x00000102 #define STATUS_PENDING 0x00000103 #define STATUS_GUARD_PAGE_VIOLATION 0x80000001 #define STATUS_DATATYPE_MISALIGNMENT 0x80000002 #define STATUS_BREAKPOINT 0x80000003 #define STATUS_SINGLE_STEP 0x80000004 #define STATUS_BUFFER_OVERFLOW 0x80000005 #define STATUS_NO_MORE_FILES 0x80000006 #define STATUS_WAKE_SYSTEM_DEBUGGER 0x80000007 #define STATUS_HANDLES_CLOSED 0x8000000A #define STATUS_NO_INHERITANCE 0x8000000B #define STATUS_GUID_SUBSTITUTION_MADE 0x8000000C #define STATUS_PARTIAL_COPY 0x8000000D #define STATUS_DEVICE_PAPER_EMPTY 0x8000000E #define STATUS_DEVICE_POWERED_OFF 0x8000000F #define STATUS_DEVICE_OFF_LINE 0x80000010 #define STATUS_DEVICE_BUSY 0x80000011 #define STATUS_NO_MORE_EAS 0x80000012 #define STATUS_INVALID_EA_NAME 0x80000013 #define STATUS_EA_LIST_INCONSISTENT 0x80000014 #define STATUS_INVALID_EA_FLAG 0x80000015 #define STATUS_VERIFY_REQUIRED 0x80000016 #define STATUS_EXTRANEOUS_INFORMATION 0x80000017 #define STATUS_RXACT_COMMIT_NECESSARY 0x80000018 #define STATUS_NO_MORE_ENTRIES 0x8000001A #define STATUS_FILEMARK_DETECTED 0x8000001B #define STATUS_MEDIA_CHANGED 0x8000001C #define STATUS_BUS_RESET 0x8000001D #define STATUS_END_OF_MEDIA 0x8000001E #define STATUS_BEGINNING_OF_MEDIA 0x8000001F #define STATUS_MEDIA_CHECK 0x80000020 #define STATUS_SETMARK_DETECTED 0x80000021 #define STATUS_NO_DATA_DETECTED 0x80000022 #define STATUS_REDIRECTOR_HAS_OPEN_HANDLES 0x80000023 #define STATUS_SERVER_HAS_OPEN_HANDLES 0x80000024 #define STATUS_ALREADY_DISCONNECTED 0x80000025 #define STATUS_LONGJUMP 0x80000026 #define STATUS_UNSUCCESSFUL 0xC0000001 #define STATUS_NOT_IMPLEMENTED 0xC0000002 #define STATUS_INVALID_INFO_CLASS 0xC0000003 #define STATUS_INFO_LENGTH_MISMATCH 0xC0000004 #define STATUS_ACCESS_VIOLATION 0xC0000005 #define STATUS_IN_PAGE_ERROR 0xC0000006 #define STATUS_PAGEFILE_QUOTA 0xC0000007 #define STATUS_INVALID_HANDLE 0xC0000008 #define STATUS_BAD_INITIAL_STACK 0xC0000009 #define STATUS_BAD_INITIAL_PC 0xC000000A #define STATUS_INVALID_CID 0xC000000B #define STATUS_TIMER_NOT_CANCELED 0xC000000C #define STATUS_INVALID_PARAMETER 0xC000000D #define STATUS_NO_SUCH_DEVICE 0xC000000E #define STATUS_NO_SUCH_FILE 0xC000000F #define STATUS_INVALID_DEVICE_REQUEST 0xC0000010 #define STATUS_END_OF_FILE 0xC0000011 #define STATUS_WRONG_VOLUME 0xC0000012 #define STATUS_NO_MEDIA_IN_DEVICE 0xC0000013 #define STATUS_UNRECOGNIZED_MEDIA 0xC0000014 #define STATUS_NONEXISTENT_SECTOR 0xC0000015 #define STATUS_MORE_PROCESSING_REQUIRED 0xC0000016 #define STATUS_NO_MEMORY 0xC0000017 #define STATUS_CONFLICTING_ADDRESSES 0xC0000018 #define STATUS_NOT_MAPPED_VIEW 0xC0000019 #define STATUS_UNABLE_TO_FREE_VM 0xC000001A #define STATUS_UNABLE_TO_DELETE_SECTION 0xC000001B #define STATUS_INVALID_SYSTEM_SERVICE 0xC000001C #define STATUS_ILLEGAL_INSTRUCTION 0xC000001D #define STATUS_INVALID_LOCK_SEQUENCE 0xC000001E #define STATUS_INVALID_VIEW_SIZE 0xC000001F #define STATUS_INVALID_FILE_FOR_SECTION 0xC0000020 #define STATUS_ALREADY_COMMITTED 0xC0000021 #define STATUS_ACCESS_DENIED 0xC0000022 #define STATUS_BUFFER_TOO_SMALL 0xC0000023 #define STATUS_OBJECT_TYPE_MISMATCH 0xC0000024 #define STATUS_NONCONTINUABLE_EXCEPTION 0xC0000025 #define STATUS_INVALID_DISPOSITION 0xC0000026 #define STATUS_UNWIND 0xC0000027 #define STATUS_BAD_STACK 0xC0000028 #define STATUS_INVALID_UNWIND_TARGET 0xC0000029 #define STATUS_NOT_LOCKED 0xC000002A #define STATUS_PARITY_ERROR 0xC000002B #define STATUS_UNABLE_TO_DECOMMIT_VM 0xC000002C #define STATUS_NOT_COMMITTED 0xC000002D #define STATUS_INVALID_PORT_ATTRIBUTES 0xC000002E #define STATUS_PORT_MESSAGE_TOO_LONG 0xC000002F #define STATUS_INVALID_PARAMETER_MIX 0xC0000030 #define STATUS_INVALID_QUOTA_LOWER 0xC0000031 #define STATUS_DISK_CORRUPT_ERROR 0xC0000032 #define STATUS_OBJECT_NAME_INVALID 0xC0000033 #define STATUS_OBJECT_NAME_NOT_FOUND 0xC0000034 #define STATUS_OBJECT_NAME_COLLISION 0xC0000035 #define STATUS_PORT_DISCONNECTED 0xC0000037 #define STATUS_DEVICE_ALREADY_ATTACHED 0xC0000038 #define STATUS_OBJECT_PATH_INVALID 0xC0000039 #define STATUS_OBJECT_PATH_NOT_FOUND 0xC000003A #define STATUS_PATH_SYNTAX_BAD 0xC000003B #define STATUS_DATA_OVERRUN 0xC000003C #define STATUS_DATA_LATE_ERROR 0xC000003D #define STATUS_DATA_ERROR 0xC000003E #define STATUS_CRC_ERROR 0xC000003F #define STATUS_SECTION_TOO_BIG 0xC0000040 #define STATUS_PORT_CONNECTION_REFUSED 0xC0000041 #define STATUS_INVALID_PORT_HANDLE 0xC0000042 #define STATUS_SHARING_VIOLATION 0xC0000043 #define STATUS_QUOTA_EXCEEDED 0xC0000044 #define STATUS_INVALID_PAGE_PROTECTION 0xC0000045 #define STATUS_MUTANT_NOT_OWNED 0xC0000046 #define STATUS_SEMAPHORE_LIMIT_EXCEEDED 0xC0000047 #define STATUS_PORT_ALREADY_SET 0xC0000048 #define STATUS_SUSPEND_COUNT_EXCEEDED 0xC000004A #define STATUS_LOCK_NOT_GRANTED 0xC0000054 /* FIXME: not sure */ #define STATUS_FILE_LOCK_CONFLICT 0xC0000055 /* FIXME: not sure */ #define STATUS_UNKNOWN_REVISION 0xC0000058 #define STATUS_INVALID_SECURITY_DESCR 0xC0000079 #define STATUS_DISK_FULL 0xC000007F #define STATUS_SECTION_NOT_EXTENDED 0xC0000087 #define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C #define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D #define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E #define STATUS_FLOAT_INEXACT_RESULT 0xC000008F #define STATUS_FLOAT_INVALID_OPERATION 0xC0000090 #define STATUS_FLOAT_OVERFLOW 0xC0000091 #define STATUS_FLOAT_STACK_CHECK 0xC0000092 #define STATUS_FLOAT_UNDERFLOW 0xC0000093 #define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094 #define STATUS_INTEGER_OVERFLOW 0xC0000095 #define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096 #define STATUS_MEDIA_WRITE_PROTECTED 0XC00000A2 #define STATUS_INVALID_PARAMETER_2 0xC00000F0 #define STATUS_STACK_OVERFLOW 0xC00000FD #define STATUS_DIRECTORY_NOT_EMPTY 0xC0000101 #define STATUS_TOO_MANY_OPENED_FILES 0xC000011F #define STATUS_CONTROL_C_EXIT 0xC000013A #define STATUS_PIPE_BROKEN 0xC000014B #define STATUS_NOT_REGISTRY_FILE 0xC000015C #define STATUS_PARTITION_FAILURE 0xC0000172 #define STATUS_INVALID_BLOCK_LENGTH 0xC0000173 #define STATUS_DEVICE_NOT_PARTITIONED 0xC0000174 #define STATUS_UNABLE_TO_LOCK_MEDIA 0xC0000175 #define STATUS_UNABLE_TO_UNLOAD_MEDIA 0xC0000176 #define STATUS_EOM_OVERFLOW 0xC0000177 #define STATUS_NO_MEDIA 0xC0000178 #define STATUS_NO_SUCH_MEMBER 0xC000017A #define STATUS_INVALID_MEMBER 0xC000017B #define STATUS_KEY_DELETED 0xC000017C #define STATUS_NO_LOG_SPACE 0xC000017D #define STATUS_TOO_MANY_SIDS 0xC000017E #define STATUS_LM_CROSS_ENCRYPTION_REQUIRED 0xC000017F #define STATUS_KEY_HAS_CHILDREN 0xC0000180 #define STATUS_CHILD_MUST_BE_VOLATILE 0xC0000181 #define STATUS_DEVICE_CONFIGURATION_ERROR0xC0000182 #define STATUS_DRIVER_INTERNAL_ERROR 0xC0000183 #define STATUS_INVALID_DEVICE_STATE 0xC0000184 #define STATUS_IO_DEVICE_ERROR 0xC0000185 #define STATUS_DEVICE_PROTOCOL_ERROR 0xC0000186 #define STATUS_BACKUP_CONTROLLER 0xC0000187 #define STATUS_LOG_FILE_FULL 0xC0000188 #define STATUS_TOO_LATE 0xC0000189 #define STATUS_NO_TRUST_LSA_SECRET 0xC000018A #define STATUS_NO_TRUST_SAM_ACCOUNT 0xC000018B #define STATUS_TRUSTED_DOMAIN_FAILURE 0xC000018C #define STATUS_TRUSTED_RELATIONSHIP_FAILURE 0xC000018D #define STATUS_EVENTLOG_FILE_CORRUPT 0xC000018E #define STATUS_EVENTLOG_CANT_START 0xC000018F #define STATUS_TRUST_FAILURE 0xC0000190 #define STATUS_MUTANT_LIMIT_EXCEEDED 0xC0000191 #define STATUS_NETLOGON_NOT_STARTED 0xC0000192 #define STATUS_ACCOUNT_EXPIRED 0xC0000193 #define STATUS_POSSIBLE_DEADLOCK 0xC0000194 #define STATUS_NETWORK_CREDENTIAL_CONFLICT 0xC0000195 #define STATUS_REMOTE_SESSION_LIMIT 0xC0000196 #define STATUS_EVENTLOG_FILE_CHANGED 0xC0000197 #define STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT 0xC0000198 #define STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT 0xC0000199 #define STATUS_NOLOGON_SERVER_TRUST_ACCOUNT 0xC000019A #define STATUS_DOMAIN_TRUST_INCONSISTENT 0xC000019B #define STATUS_FS_DRIVER_REQUIRED 0xC000019C #define STATUS_RESOURCE_LANG_NOT_FOUND 0xC0000204 #define MAXIMUM_WAIT_OBJECTS 64 #define MAXIMUM_SUSPEND_COUNT 127 /* * Return values from the actual exception handlers */ #define ExceptionContinueExecution 0 #define ExceptionContinueSearch 1 #define ExceptionNestedException 2 #define ExceptionCollidedUnwind 3 /* * Return values from filters in except() and from UnhandledExceptionFilter */ #define EXCEPTION_EXECUTE_HANDLER 1 #define EXCEPTION_CONTINUE_SEARCH 0 #define EXCEPTION_CONTINUE_EXECUTION -1 /* * From OS/2 2.0 exception handling * Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD */ #define EH_NONCONTINUABLE 0x01 #define EH_UNWINDING 0x02 #define EH_EXIT_UNWIND 0x04 #define EH_STACK_INVALID 0x08 #define EH_NESTED_CALL 0x10 #define EXCEPTION_CONTINUABLE 0 #define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE /* * The exception record used by Win32 to give additional information * about exception to exception handlers. */ #define EXCEPTION_MAXIMUM_PARAMETERS 15 typedef struct __EXCEPTION_RECORD { DWORD ExceptionCode; DWORD ExceptionFlags; struct __EXCEPTION_RECORD *ExceptionRecord; LPVOID ExceptionAddress; DWORD NumberParameters; DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; } EXCEPTION_RECORD, *PEXCEPTION_RECORD; /* * The exception pointers structure passed to exception filters * in except() and the UnhandledExceptionFilter(). */ typedef struct _EXCEPTION_POINTERS { PEXCEPTION_RECORD ExceptionRecord; PCONTEXT ContextRecord; } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS; /* * The exception frame, used for registering exception handlers * Win32 cares only about this, but compilers generally emit * larger exception frames for their own use. */ struct __EXCEPTION_FRAME; typedef DWORD (*PEXCEPTION_HANDLER)(PEXCEPTION_RECORD,struct __EXCEPTION_FRAME*, PCONTEXT,struct __EXCEPTION_FRAME **); typedef struct __EXCEPTION_FRAME { struct __EXCEPTION_FRAME *Prev; PEXCEPTION_HANDLER Handler; } EXCEPTION_FRAME, *PEXCEPTION_FRAME; #include "poppack.h" /* * function pointer to a exception filter */ typedef LONG CALLBACK (*PTOP_LEVEL_EXCEPTION_FILTER)(PEXCEPTION_POINTERS ExceptionInfo); typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER; DWORD WINAPI UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers ); LPTOP_LEVEL_EXCEPTION_FILTER WINAPI SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter ); /* status values for ContinueDebugEvent */ #define DBG_CONTINUE 0x00010002 #define DBG_TERMINATE_THREAD 0x40010003 #define DBG_TERMINATE_PROCESS 0x40010004 #define DBG_CONTROL_C 0x40010005 #define DBG_CONTROL_BREAK 0x40010008 #define DBG_EXCEPTION_NOT_HANDLED 0x80010001 typedef struct _NT_TIB { struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList; PVOID StackBase; PVOID StackLimit; PVOID SubSystemTib; union { PVOID FiberData; DWORD Version; } DUMMYUNIONNAME; PVOID ArbitraryUserPointer; struct _NT_TIB *Self; } NT_TIB, *PNT_TIB; struct _TEB; /* #if defined(__i386__) && defined(__GNUC__) extern inline struct _TEB * WINAPI NtCurrentTeb(void); extern inline struct _TEB * WINAPI NtCurrentTeb(void) { struct _TEB *teb; __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb)); return teb; } #else extern struct _TEB * WINAPI NtCurrentTeb(void); #endif */ /* * File formats definitions */ typedef struct _IMAGE_DOS_HEADER { WORD e_magic; /* 00: MZ Header signature */ WORD e_cblp; /* 02: Bytes on last page of file */ WORD e_cp; /* 04: Pages in file */ WORD e_crlc; /* 06: Relocations */ WORD e_cparhdr; /* 08: Size of header in paragraphs */ WORD e_minalloc; /* 0a: Minimum extra paragraphs needed */ WORD e_maxalloc; /* 0c: Maximum extra paragraphs needed */ WORD e_ss; /* 0e: Initial (relative) SS value */ WORD e_sp; /* 10: Initial SP value */ WORD e_csum; /* 12: Checksum */ WORD e_ip; /* 14: Initial IP value */ WORD e_cs; /* 16: Initial (relative) CS value */ WORD e_lfarlc; /* 18: File address of relocation table */ WORD e_ovno; /* 1a: Overlay number */ WORD e_res[4]; /* 1c: Reserved words */ WORD e_oemid; /* 24: OEM identifier (for e_oeminfo) */ WORD e_oeminfo; /* 26: OEM information; e_oemid specific */ WORD e_res2[10]; /* 28: Reserved words */ DWORD e_lfanew; /* 3c: Offset to extended header */ } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER; #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */ #define IMAGE_OS2_SIGNATURE 0x454E /* NE */ #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */ #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */ #define IMAGE_VXD_SIGNATURE 0x454C /* LE */ #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */ /* * This is the Windows executable (NE) header. * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way. */ typedef struct { WORD ne_magic; /* 00 NE signature 'NE' */ BYTE ne_ver; /* 02 Linker version number */ BYTE ne_rev; /* 03 Linker revision number */ WORD ne_enttab; /* 04 Offset to entry table relative to NE */ WORD ne_cbenttab; /* 06 Length of entry table in bytes */ LONG ne_crc; /* 08 Checksum */ WORD ne_flags; /* 0c Flags about segments in this file */ WORD ne_autodata; /* 0e Automatic data segment number */ WORD ne_heap; /* 10 Initial size of local heap */ WORD ne_stack; /* 12 Initial size of stack */ DWORD ne_csip; /* 14 Initial CS:IP */ DWORD ne_sssp; /* 18 Initial SS:SP */ WORD ne_cseg; /* 1c # of entries in segment table */ WORD ne_cmod; /* 1e # of entries in module reference tab. */ WORD ne_cbnrestab; /* 20 Length of nonresident-name table */ WORD ne_segtab; /* 22 Offset to segment table */ WORD ne_rsrctab; /* 24 Offset to resource table */ WORD ne_restab; /* 26 Offset to resident-name table */ WORD ne_modtab; /* 28 Offset to module reference table */ WORD ne_imptab; /* 2a Offset to imported name table */ DWORD ne_nrestab; /* 2c Offset to nonresident-name table */ WORD ne_cmovent; /* 30 # of movable entry points */ WORD ne_align; /* 32 Logical sector alignment shift count */ WORD ne_cres; /* 34 # of resource segments */ BYTE ne_exetyp; /* 36 Flags indicating target OS */ BYTE ne_flagsothers; /* 37 Additional information flags */ WORD fastload_offset; /* 38 Offset to fast load area (should be ne_pretthunks)*/ WORD fastload_length; /* 3a Length of fast load area (should be ne_psegrefbytes) */ WORD ne_swaparea; /* 3c Reserved by Microsoft */ WORD ne_expver; /* 3e Expected Windows version number */ } IMAGE_OS2_HEADER,*PIMAGE_OS2_HEADER; typedef struct _IMAGE_VXD_HEADER { WORD e32_magic; BYTE e32_border; BYTE e32_worder; DWORD e32_level; WORD e32_cpu; WORD e32_os; DWORD e32_ver; DWORD e32_mflags; DWORD e32_mpages; DWORD e32_startobj; DWORD e32_eip; DWORD e32_stackobj; DWORD e32_esp; DWORD e32_pagesize; DWORD e32_lastpagesize; DWORD e32_fixupsize; DWORD e32_fixupsum; DWORD e32_ldrsize; DWORD e32_ldrsum; DWORD e32_objtab; DWORD e32_objcnt; DWORD e32_objmap; DWORD e32_itermap; DWORD e32_rsrctab; DWORD e32_rsrccnt; DWORD e32_restab; DWORD e32_enttab; DWORD e32_dirtab; DWORD e32_dircnt; DWORD e32_fpagetab; DWORD e32_frectab; DWORD e32_impmod; DWORD e32_impmodcnt; DWORD e32_impproc; DWORD e32_pagesum; DWORD e32_datapage; DWORD e32_preload; DWORD e32_nrestab; DWORD e32_cbnrestab; DWORD e32_nressum; DWORD e32_autodata; DWORD e32_debuginfo; DWORD e32_debuglen; DWORD e32_instpreload; DWORD e32_instdemand; DWORD e32_heapsize; BYTE e32_res3[12]; DWORD e32_winresoff; DWORD e32_winreslen; WORD e32_devid; WORD e32_ddkver; } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER; /* These defines describe the meanings of the bits in the Characteristics field */ #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */ #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 #define IMAGE_FILE_16BIT_MACHINE 0x0040 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 #define IMAGE_FILE_32BIT_MACHINE 0x0100 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200 #define IMAGE_FILE_SYSTEM 0x1000 #define IMAGE_FILE_DLL 0x2000 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 /* These are the settings of the Machine field. */ #define IMAGE_FILE_MACHINE_UNKNOWN 0 #define IMAGE_FILE_MACHINE_I860 0x14d #define IMAGE_FILE_MACHINE_I386 0x14c #define IMAGE_FILE_MACHINE_R3000 0x162 #define IMAGE_FILE_MACHINE_R4000 0x166 #define IMAGE_FILE_MACHINE_R10000 0x168 #define IMAGE_FILE_MACHINE_ALPHA 0x184 #define IMAGE_FILE_MACHINE_POWERPC 0x1F0 #define IMAGE_SIZEOF_FILE_HEADER 20 /* Possible Magic values */ #define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107 /* These are indexes into the DataDirectory array */ #define IMAGE_FILE_EXPORT_DIRECTORY 0 #define IMAGE_FILE_IMPORT_DIRECTORY 1 #define IMAGE_FILE_RESOURCE_DIRECTORY 2 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3 #define IMAGE_FILE_SECURITY_DIRECTORY 4 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5 #define IMAGE_FILE_DEBUG_DIRECTORY 6 #define IMAGE_FILE_DESCRIPTION_STRING 7 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */ #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9 #define IMAGE_FILE_CALLBACK_DIRECTORY 10 /* Directory Entries, indices into the DataDirectory array */ #define IMAGE_DIRECTORY_ENTRY_EXPORT 0 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */ #define IMAGE_DIRECTORY_ENTRY_TLS 9 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */ #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14 /* Subsystem Values */ #define IMAGE_SUBSYSTEM_UNKNOWN 0 #define IMAGE_SUBSYSTEM_NATIVE 1 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */ #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem*/ #define IMAGE_SUBSYSTEM_OS2_CUI 5 #define IMAGE_SUBSYSTEM_POSIX_CUI 7 typedef struct _IMAGE_FILE_HEADER { WORD Machine; WORD NumberOfSections; DWORD TimeDateStamp; DWORD PointerToSymbolTable; DWORD NumberOfSymbols; WORD SizeOfOptionalHeader; WORD Characteristics; } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER; typedef struct _IMAGE_DATA_DIRECTORY { DWORD VirtualAddress; DWORD Size; } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY; #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 typedef struct _IMAGE_OPTIONAL_HEADER { /* Standard fields */ WORD Magic; BYTE MajorLinkerVersion; BYTE MinorLinkerVersion; DWORD SizeOfCode; DWORD SizeOfInitializedData; DWORD SizeOfUninitializedData; DWORD AddressOfEntryPoint; DWORD BaseOfCode; DWORD BaseOfData; /* NT additional fields */ DWORD ImageBase; DWORD SectionAlignment; DWORD FileAlignment; WORD MajorOperatingSystemVersion; WORD MinorOperatingSystemVersion; WORD MajorImageVersion; WORD MinorImageVersion; WORD MajorSubsystemVersion; WORD MinorSubsystemVersion; DWORD Win32VersionValue; DWORD SizeOfImage; DWORD SizeOfHeaders; DWORD CheckSum; WORD Subsystem; WORD DllCharacteristics; DWORD SizeOfStackReserve; DWORD SizeOfStackCommit; DWORD SizeOfHeapReserve; DWORD SizeOfHeapCommit; DWORD LoaderFlags; DWORD NumberOfRvaAndSizes; IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; } IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER; typedef struct _IMAGE_NT_HEADERS { DWORD Signature; IMAGE_FILE_HEADER FileHeader; IMAGE_OPTIONAL_HEADER OptionalHeader; } IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS; #define IMAGE_SIZEOF_SHORT_NAME 8 typedef struct _IMAGE_SECTION_HEADER { BYTE Name[IMAGE_SIZEOF_SHORT_NAME]; union { DWORD PhysicalAddress; DWORD VirtualSize; } Misc; DWORD VirtualAddress; DWORD SizeOfRawData; DWORD PointerToRawData; DWORD PointerToRelocations; DWORD PointerToLinenumbers; WORD NumberOfRelocations; WORD NumberOfLinenumbers; DWORD Characteristics; } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER; #define IMAGE_SIZEOF_SECTION_HEADER 40 #define IMAGE_FIRST_SECTION(ntheader) \ ((PIMAGE_SECTION_HEADER)((LPBYTE)&((PIMAGE_NT_HEADERS)(ntheader))->OptionalHeader + \ ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader)) /* These defines are for the Characteristics bitfield. */ /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */ /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */ /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */ /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */ /* #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 - Reserved */ /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */ #define IMAGE_SCN_CNT_CODE 0x00000020 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 #define IMAGE_SCN_LNK_OTHER 0x00000100 #define IMAGE_SCN_LNK_INFO 0x00000200 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */ #define IMAGE_SCN_LNK_REMOVE 0x00000800 #define IMAGE_SCN_LNK_COMDAT 0x00001000 /* 0x00002000 - Reserved */ /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */ #define IMAGE_SCN_MEM_FARDATA 0x00008000 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */ #define IMAGE_SCN_MEM_PURGEABLE 0x00020000 #define IMAGE_SCN_MEM_16BIT 0x00020000 #define IMAGE_SCN_MEM_LOCKED 0x00040000 #define IMAGE_SCN_MEM_PRELOAD 0x00080000 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */ #define IMAGE_SCN_ALIGN_32BYTES 0x00600000 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000 /* 0x00800000 - Unused */ #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 #define IMAGE_SCN_MEM_SHARED 0x10000000 #define IMAGE_SCN_MEM_EXECUTE 0x20000000 #define IMAGE_SCN_MEM_READ 0x40000000 #define IMAGE_SCN_MEM_WRITE 0x80000000 #include "pshpack2.h" typedef struct _IMAGE_SYMBOL { union { BYTE ShortName[8]; struct { DWORD Short; DWORD Long; } Name; DWORD LongName[2]; } N; DWORD Value; SHORT SectionNumber; WORD Type; BYTE StorageClass; BYTE NumberOfAuxSymbols; } IMAGE_SYMBOL; typedef IMAGE_SYMBOL *PIMAGE_SYMBOL; #define IMAGE_SIZEOF_SYMBOL 18 typedef struct _IMAGE_LINENUMBER { union { DWORD SymbolTableIndex; DWORD VirtualAddress; } Type; WORD Linenumber; } IMAGE_LINENUMBER; typedef IMAGE_LINENUMBER *PIMAGE_LINENUMBER; #define IMAGE_SIZEOF_LINENUMBER 6 typedef union _IMAGE_AUX_SYMBOL { struct { DWORD TagIndex; union { struct { WORD Linenumber; WORD Size; } LnSz; DWORD TotalSize; } Misc; union { struct { DWORD PointerToLinenumber; DWORD PointerToNextFunction; } Function; struct { WORD Dimension[4]; } Array; } FcnAry; WORD TvIndex; } Sym; struct { BYTE Name[IMAGE_SIZEOF_SYMBOL]; } File; struct { DWORD Length; WORD NumberOfRelocations; WORD NumberOfLinenumbers; DWORD CheckSum; SHORT Number; BYTE Selection; } Section; } IMAGE_AUX_SYMBOL; typedef IMAGE_AUX_SYMBOL *PIMAGE_AUX_SYMBOL; #define IMAGE_SIZEOF_AUX_SYMBOL 18 #include "poppack.h" #define IMAGE_SYM_UNDEFINED (SHORT)0 #define IMAGE_SYM_ABSOLUTE (SHORT)-1 #define IMAGE_SYM_DEBUG (SHORT)-2 #define IMAGE_SYM_TYPE_NULL 0x0000 #define IMAGE_SYM_TYPE_VOID 0x0001 #define IMAGE_SYM_TYPE_CHAR 0x0002 #define IMAGE_SYM_TYPE_SHORT 0x0003 #define IMAGE_SYM_TYPE_INT 0x0004 #define IMAGE_SYM_TYPE_LONG 0x0005 #define IMAGE_SYM_TYPE_FLOAT 0x0006 #define IMAGE_SYM_TYPE_DOUBLE 0x0007 #define IMAGE_SYM_TYPE_STRUCT 0x0008 #define IMAGE_SYM_TYPE_UNION 0x0009 #define IMAGE_SYM_TYPE_ENUM 0x000A #define IMAGE_SYM_TYPE_MOE 0x000B #define IMAGE_SYM_TYPE_BYTE 0x000C #define IMAGE_SYM_TYPE_WORD 0x000D #define IMAGE_SYM_TYPE_UINT 0x000E #define IMAGE_SYM_TYPE_DWORD 0x000F #define IMAGE_SYM_TYPE_PCODE 0x8000 #define IMAGE_SYM_DTYPE_NULL 0 #define IMAGE_SYM_DTYPE_POINTER 1 #define IMAGE_SYM_DTYPE_FUNCTION 2 #define IMAGE_SYM_DTYPE_ARRAY 3 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1 #define IMAGE_SYM_CLASS_NULL 0x0000 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002 #define IMAGE_SYM_CLASS_STATIC 0x0003 #define IMAGE_SYM_CLASS_REGISTER 0x0004 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005 #define IMAGE_SYM_CLASS_LABEL 0x0006 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B #define IMAGE_SYM_CLASS_UNION_TAG 0x000C #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044 #define IMAGE_SYM_CLASS_BLOCK 0x0064 #define IMAGE_SYM_CLASS_FUNCTION 0x0065 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066 #define IMAGE_SYM_CLASS_FILE 0x0067 #define IMAGE_SYM_CLASS_SECTION 0x0068 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069 #define N_BTMASK 0x000F #define N_TMASK 0x0030 #define N_TMASK1 0x00C0 #define N_TMASK2 0x00F0 #define N_BTSHFT 4 #define N_TSHIFT 2 #define BTYPE(x) ((x) & N_BTMASK) #ifndef ISPTR #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT)) #endif #ifndef ISFCN #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT)) #endif #ifndef ISARY #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT)) #endif #ifndef ISTAG #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG) #endif #ifndef INCREF #define INCREF(x) ((((x)&~N_BTMASK)<>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) #endif #define IMAGE_COMDAT_SELECT_NODUPLICATES 1 #define IMAGE_COMDAT_SELECT_ANY 2 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5 #define IMAGE_COMDAT_SELECT_LARGEST 6 #define IMAGE_COMDAT_SELECT_NEWEST 7 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3 /* Export module directory */ typedef struct _IMAGE_EXPORT_DIRECTORY { DWORD Characteristics; DWORD TimeDateStamp; WORD MajorVersion; WORD MinorVersion; DWORD Name; DWORD Base; DWORD NumberOfFunctions; DWORD NumberOfNames; LPDWORD *AddressOfFunctions; LPDWORD *AddressOfNames; LPWORD *AddressOfNameOrdinals; } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY; /* Import name entry */ typedef struct _IMAGE_IMPORT_BY_NAME { WORD Hint; BYTE Name[1]; } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME; /* Import thunk */ typedef struct _IMAGE_THUNK_DATA { union { LPBYTE ForwarderString; FARPROC Function; DWORD Ordinal; PIMAGE_IMPORT_BY_NAME AddressOfData; } u1; } IMAGE_THUNK_DATA,*PIMAGE_THUNK_DATA; /* Import module directory */ typedef struct _IMAGE_IMPORT_DESCRIPTOR { union { DWORD Characteristics; /* 0 for terminating null import descriptor */ PIMAGE_THUNK_DATA OriginalFirstThunk; /* RVA to original unbound IAT */ } u; DWORD TimeDateStamp; /* 0 if not bound, * -1 if bound, and real date\time stamp * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT * (new BIND) * otherwise date/time stamp of DLL bound to * (Old BIND) */ DWORD ForwarderChain; /* -1 if no forwarders */ DWORD Name; /* RVA to IAT (if bound this IAT has actual addresses) */ PIMAGE_THUNK_DATA FirstThunk; } IMAGE_IMPORT_DESCRIPTOR,*PIMAGE_IMPORT_DESCRIPTOR; #define IMAGE_ORDINAL_FLAG 0x80000000 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0) #define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff) typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR { DWORD TimeDateStamp; WORD OffsetModuleName; WORD NumberOfModuleForwarderRefs; /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */ } IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR; typedef struct _IMAGE_BOUND_FORWARDER_REF { DWORD TimeDateStamp; WORD OffsetModuleName; WORD Reserved; } IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF; typedef struct _IMAGE_BASE_RELOCATION { DWORD VirtualAddress; DWORD SizeOfBlock; WORD TypeOffset[1]; } IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION; typedef struct _IMAGE_RELOCATION { union { DWORD VirtualAddress; DWORD RelocCount; } u; DWORD SymbolTableIndex; WORD Type; } IMAGE_RELOCATION; typedef IMAGE_RELOCATION *PIMAGE_RELOCATION; #define IMAGE_SIZEOF_RELOCATION 10 /* generic relocation types */ #define IMAGE_REL_BASED_ABSOLUTE 0 #define IMAGE_REL_BASED_HIGH 1 #define IMAGE_REL_BASED_LOW 2 #define IMAGE_REL_BASED_HIGHLOW 3 #define IMAGE_REL_BASED_HIGHADJ 4 #define IMAGE_REL_BASED_MIPS_JMPADDR 5 #define IMAGE_REL_BASED_SECTION 6 #define IMAGE_REL_BASED_REL 7 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */ #define IMAGE_REL_BASED_DIR64 10 #define IMAGE_REL_BASED_HIGH3ADJ 11 /* I386 relocation types */ #define IMAGE_REL_I386_ABSOLUTE 0 #define IMAGE_REL_I386_DIR16 1 #define IMAGE_REL_I386_REL16 2 #define IMAGE_REL_I386_DIR32 6 #define IMAGE_REL_I386_DIR32NB 7 #define IMAGE_REL_I386_SEG12 9 #define IMAGE_REL_I386_SECTION 10 #define IMAGE_REL_I386_SECREL 11 #define IMAGE_REL_I386_REL32 20 /* MIPS relocation types */ #define IMAGE_REL_MIPS_ABSOLUTE 0x0000 #define IMAGE_REL_MIPS_REFHALF 0x0001 #define IMAGE_REL_MIPS_REFWORD 0x0002 #define IMAGE_REL_MIPS_JMPADDR 0x0003 #define IMAGE_REL_MIPS_REFHI 0x0004 #define IMAGE_REL_MIPS_REFLO 0x0005 #define IMAGE_REL_MIPS_GPREL 0x0006 #define IMAGE_REL_MIPS_LITERAL 0x0007 #define IMAGE_REL_MIPS_SECTION 0x000A #define IMAGE_REL_MIPS_SECREL 0x000B #define IMAGE_REL_MIPS_SECRELLO 0x000C #define IMAGE_REL_MIPS_SECRELHI 0x000D #define IMAGE_REL_MIPS_JMPADDR16 0x0010 #define IMAGE_REL_MIPS_REFWORDNB 0x0022 #define IMAGE_REL_MIPS_PAIR 0x0025 /* ALPHA relocation types */ #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000 #define IMAGE_REL_ALPHA_REFLONG 0x0001 #define IMAGE_REL_ALPHA_REFQUAD 0x0002 #define IMAGE_REL_ALPHA_GPREL 0x0003 #define IMAGE_REL_ALPHA_LITERAL 0x0004 #define IMAGE_REL_ALPHA_LITUSE 0x0005 #define IMAGE_REL_ALPHA_GPDISP 0x0006 #define IMAGE_REL_ALPHA_BRADDR 0x0007 #define IMAGE_REL_ALPHA_HINT 0x0008 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009 #define IMAGE_REL_ALPHA_REFHI 0x000A #define IMAGE_REL_ALPHA_REFLO 0x000B #define IMAGE_REL_ALPHA_PAIR 0x000C #define IMAGE_REL_ALPHA_MATCH 0x000D #define IMAGE_REL_ALPHA_SECTION 0x000E #define IMAGE_REL_ALPHA_SECREL 0x000F #define IMAGE_REL_ALPHA_REFLONGNB 0x0010 #define IMAGE_REL_ALPHA_SECRELLO 0x0011 #define IMAGE_REL_ALPHA_SECRELHI 0x0012 #define IMAGE_REL_ALPHA_REFQ3 0x0013 #define IMAGE_REL_ALPHA_REFQ2 0x0014 #define IMAGE_REL_ALPHA_REFQ1 0x0015 #define IMAGE_REL_ALPHA_GPRELLO 0x0016 #define IMAGE_REL_ALPHA_GPRELHI 0x0017 /* PowerPC relocation types */ #define IMAGE_REL_PPC_ABSOLUTE 0x0000 #define IMAGE_REL_PPC_ADDR64 0x0001 #define IMAGE_REL_PPC_ADDR 0x0002 #define IMAGE_REL_PPC_ADDR24 0x0003 #define IMAGE_REL_PPC_ADDR16 0x0004 #define IMAGE_REL_PPC_ADDR14 0x0005 #define IMAGE_REL_PPC_REL24 0x0006 #define IMAGE_REL_PPC_REL14 0x0007 #define IMAGE_REL_PPC_TOCREL16 0x0008 #define IMAGE_REL_PPC_TOCREL14 0x0009 #define IMAGE_REL_PPC_ADDR32NB 0x000A #define IMAGE_REL_PPC_SECREL 0x000B #define IMAGE_REL_PPC_SECTION 0x000C #define IMAGE_REL_PPC_IFGLUE 0x000D #define IMAGE_REL_PPC_IMGLUE 0x000E #define IMAGE_REL_PPC_SECREL16 0x000F #define IMAGE_REL_PPC_REFHI 0x0010 #define IMAGE_REL_PPC_REFLO 0x0011 #define IMAGE_REL_PPC_PAIR 0x0012 #define IMAGE_REL_PPC_SECRELLO 0x0013 #define IMAGE_REL_PPC_SECRELHI 0x0014 #define IMAGE_REL_PPC_GPREL 0x0015 #define IMAGE_REL_PPC_TYPEMASK 0x00FF /* modifier bits */ #define IMAGE_REL_PPC_NEG 0x0100 #define IMAGE_REL_PPC_BRTAKEN 0x0200 #define IMAGE_REL_PPC_BRNTAKEN 0x0400 #define IMAGE_REL_PPC_TOCDEFN 0x0800 /* SH3 ? relocation type */ #define IMAGE_REL_SH3_ABSOLUTE 0x0000 #define IMAGE_REL_SH3_DIRECT16 0x0001 #define IMAGE_REL_SH3_DIRECT 0x0002 #define IMAGE_REL_SH3_DIRECT8 0x0003 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005 #define IMAGE_REL_SH3_DIRECT4 0x0006 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A #define IMAGE_REL_SH3_PCREL12_WORD 0x000B #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D #define IMAGE_REL_SH3_SECTION 0x000E #define IMAGE_REL_SH3_SECREL 0x000F #define IMAGE_REL_SH3_DIRECT32_NB 0x0010 /* ARM (Archimedes?) relocation types */ #define IMAGE_REL_ARM_ABSOLUTE 0x0000 #define IMAGE_REL_ARM_ADDR 0x0001 #define IMAGE_REL_ARM_ADDR32NB 0x0002 #define IMAGE_REL_ARM_BRANCH24 0x0003 #define IMAGE_REL_ARM_BRANCH11 0x0004 #define IMAGE_REL_ARM_SECTION 0x000E #define IMAGE_REL_ARM_SECREL 0x000F /* IA64 relocation types */ #define IMAGE_REL_IA64_ABSOLUTE 0x0000 #define IMAGE_REL_IA64_IMM14 0x0001 #define IMAGE_REL_IA64_IMM22 0x0002 #define IMAGE_REL_IA64_IMM64 0x0003 #define IMAGE_REL_IA64_DIR 0x0004 #define IMAGE_REL_IA64_DIR64 0x0005 #define IMAGE_REL_IA64_PCREL21B 0x0006 #define IMAGE_REL_IA64_PCREL21M 0x0007 #define IMAGE_REL_IA64_PCREL21F 0x0008 #define IMAGE_REL_IA64_GPREL22 0x0009 #define IMAGE_REL_IA64_LTOFF22 0x000A #define IMAGE_REL_IA64_SECTION 0x000B #define IMAGE_REL_IA64_SECREL22 0x000C #define IMAGE_REL_IA64_SECREL64I 0x000D #define IMAGE_REL_IA64_SECREL 0x000E #define IMAGE_REL_IA64_LTOFF64 0x000F #define IMAGE_REL_IA64_DIR32NB 0x0010 #define IMAGE_REL_IA64_RESERVED_11 0x0011 #define IMAGE_REL_IA64_RESERVED_12 0x0012 #define IMAGE_REL_IA64_RESERVED_13 0x0013 #define IMAGE_REL_IA64_RESERVED_14 0x0014 #define IMAGE_REL_IA64_RESERVED_15 0x0015 #define IMAGE_REL_IA64_RESERVED_16 0x0016 #define IMAGE_REL_IA64_ADDEND 0x001F /* archive format */ #define IMAGE_ARCHIVE_START_SIZE 8 #define IMAGE_ARCHIVE_START "!\n" #define IMAGE_ARCHIVE_END "`\n" #define IMAGE_ARCHIVE_PAD "\n" #define IMAGE_ARCHIVE_LINKER_MEMBER "/ " #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// " typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER { BYTE Name[16]; BYTE Date[12]; BYTE UserID[6]; BYTE GroupID[6]; BYTE Mode[8]; BYTE Size[10]; BYTE EndHeader[2]; } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER; #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60 /* * Resource directory stuff */ typedef struct _IMAGE_RESOURCE_DIRECTORY { DWORD Characteristics; DWORD TimeDateStamp; WORD MajorVersion; WORD MinorVersion; WORD NumberOfNamedEntries; WORD NumberOfIdEntries; /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */ } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY; #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY { union { struct { unsigned NameOffset:31; unsigned NameIsString:1; } s; DWORD Name; WORD Id; } u1; union { DWORD OffsetToData; struct { unsigned OffsetToDirectory:31; unsigned DataIsDirectory:1; } s; } u2; } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY; typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING { WORD Length; CHAR NameString[ 1 ]; } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING; typedef struct _IMAGE_RESOURCE_DIR_STRING_U { WORD Length; WCHAR NameString[ 1 ]; } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U; typedef struct _IMAGE_RESOURCE_DATA_ENTRY { DWORD OffsetToData; DWORD Size; DWORD CodePage; DWORD ResourceHandle; } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY; typedef VOID CALLBACK (*PIMAGE_TLS_CALLBACK)( LPVOID DllHandle,DWORD Reason,LPVOID Reserved ); typedef struct _IMAGE_TLS_DIRECTORY { DWORD StartAddressOfRawData; DWORD EndAddressOfRawData; LPDWORD AddressOfIndex; PIMAGE_TLS_CALLBACK *AddressOfCallBacks; DWORD SizeOfZeroFill; DWORD Characteristics; } IMAGE_TLS_DIRECTORY,*PIMAGE_TLS_DIRECTORY; typedef struct _IMAGE_DEBUG_DIRECTORY { DWORD Characteristics; DWORD TimeDateStamp; WORD MajorVersion; WORD MinorVersion; DWORD Type; DWORD SizeOfData; DWORD AddressOfRawData; DWORD PointerToRawData; } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY; #define IMAGE_DEBUG_TYPE_UNKNOWN 0 #define IMAGE_DEBUG_TYPE_COFF 1 #define IMAGE_DEBUG_TYPE_CODEVIEW 2 #define IMAGE_DEBUG_TYPE_FPO 3 #define IMAGE_DEBUG_TYPE_MISC 4 #define IMAGE_DEBUG_TYPE_EXCEPTION 5 #define IMAGE_DEBUG_TYPE_FIXUP 6 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8 #define IMAGE_DEBUG_TYPE_BORLAND 9 #define IMAGE_DEBUG_TYPE_RESERVED10 10 typedef struct _IMAGE_COFF_SYMBOLS_HEADER { DWORD NumberOfSymbols; DWORD LvaToFirstSymbol; DWORD NumberOfLinenumbers; DWORD LvaToFirstLinenumber; DWORD RvaToFirstByteOfCode; DWORD RvaToLastByteOfCode; DWORD RvaToFirstByteOfData; DWORD RvaToLastByteOfData; } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER; #define FRAME_FPO 0 #define FRAME_TRAP 1 #define FRAME_TSS 2 #define FRAME_NONFPO 3 typedef struct _FPO_DATA { DWORD ulOffStart; DWORD cbProcSize; DWORD cdwLocals; WORD cdwParams; unsigned cbProlog : 8; unsigned cbRegs : 3; unsigned fHasSEH : 1; unsigned fUseBP : 1; unsigned reserved : 1; unsigned cbFrame : 2; } FPO_DATA, *PFPO_DATA; typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY { DWORD Characteristics; DWORD TimeDateStamp; WORD MajorVersion; WORD MinorVersion; DWORD GlobalFlagsClear; DWORD GlobalFlagsSet; DWORD CriticalSectionDefaultTimeout; DWORD DeCommitFreeBlockThreshold; DWORD DeCommitTotalFreeThreshold; PVOID LockPrefixTable; DWORD MaximumAllocationSize; DWORD VirtualMemoryThreshold; DWORD ProcessHeapFlags; DWORD ProcessAffinityMask; WORD CSDVersion; WORD Reserved1; PVOID EditList; DWORD Reserved[1]; } IMAGE_LOAD_CONFIG_DIRECTORY, *PIMAGE_LOAD_CONFIG_DIRECTORY; typedef struct _IMAGE_FUNCTION_ENTRY { DWORD StartingAddress; DWORD EndingAddress; DWORD EndOfPrologue; } IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY; /* This is the structure that appears at the very start of a .DBG file. */ typedef struct _IMAGE_SEPARATE_DEBUG_HEADER { WORD Signature; WORD Flags; WORD Machine; WORD Characteristics; DWORD TimeDateStamp; DWORD CheckSum; DWORD ImageBase; DWORD SizeOfImage; DWORD NumberOfSections; DWORD ExportedNamesSize; DWORD DebugDirectorySize; DWORD SectionAlignment; DWORD Reserved[ 2 ]; } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER; #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944 typedef struct tagMESSAGE_RESOURCE_ENTRY { WORD Length; WORD Flags; BYTE Text[1]; } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY; #define MESSAGE_RESOURCE_UNICODE 0x0001 typedef struct tagMESSAGE_RESOURCE_BLOCK { DWORD LowId; DWORD HighId; DWORD OffsetToEntries; } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK; typedef struct tagMESSAGE_RESOURCE_DATA { DWORD NumberOfBlocks; MESSAGE_RESOURCE_BLOCK Blocks[ 1 ]; } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA; /* * Here follows typedefs for security and tokens. */ /* * First a constant for the following typdefs. */ #define ANYSIZE_ARRAY 1 /* FIXME: Orphan. What does it point to? */ typedef PVOID PACCESS_TOKEN; /* * TOKEN_INFORMATION_CLASS */ typedef enum _TOKEN_INFORMATION_CLASS { TokenUser = 1, TokenGroups, TokenPrivileges, TokenOwner, TokenPrimaryGroup, TokenDefaultDacl, TokenSource, TokenType, TokenImpersonationLevel, TokenStatistics } TOKEN_INFORMATION_CLASS; #ifndef _SECURITY_DEFINED #define _SECURITY_DEFINED #include "pshpack1.h" typedef DWORD ACCESS_MASK, *PACCESS_MASK; typedef struct _GENERIC_MAPPING { ACCESS_MASK GenericRead; ACCESS_MASK GenericWrite; ACCESS_MASK GenericExecute; ACCESS_MASK GenericAll; } GENERIC_MAPPING, *PGENERIC_MAPPING; #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED #define SID_IDENTIFIER_AUTHORITY_DEFINED typedef struct { BYTE Value[6]; } SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY,*LPSID_IDENTIFIER_AUTHORITY; #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */ #ifndef SID_DEFINED #define SID_DEFINED typedef struct _SID { BYTE Revision; BYTE SubAuthorityCount; SID_IDENTIFIER_AUTHORITY IdentifierAuthority; DWORD SubAuthority[1]; } SID,*PSID; #endif /* !defined(SID_DEFINED) */ #define SID_REVISION (1) /* Current revision */ #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */ #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */ /* * ACL */ #define ACL_REVISION1 1 #define ACL_REVISION2 2 #define ACL_REVISION3 3 #define ACL_REVISION4 4 #define MIN_ACL_REVISION ACL_REVISION2 #define MAX_ACL_REVISION ACL_REVISION4 typedef struct _ACL { BYTE AclRevision; BYTE Sbz1; WORD AclSize; WORD AceCount; WORD Sbz2; } ACL, *PACL; /* SECURITY_DESCRIPTOR */ #define SECURITY_DESCRIPTOR_REVISION 1 #define SECURITY_DESCRIPTOR_REVISION1 1 #define SE_OWNER_DEFAULTED 0x0001 #define SE_GROUP_DEFAULTED 0x0002 #define SE_DACL_PRESENT 0x0004 #define SE_DACL_DEFAULTED 0x0008 #define SE_SACL_PRESENT 0x0010 #define SE_SACL_DEFAULTED 0x0020 #define SE_SELF_RELATIVE 0x8000 typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION; typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL; /* The security descriptor structure */ typedef struct { BYTE Revision; BYTE Sbz1; SECURITY_DESCRIPTOR_CONTROL Control; DWORD Owner; DWORD Group; DWORD Sacl; DWORD Dacl; } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE; typedef struct { BYTE Revision; BYTE Sbz1; SECURITY_DESCRIPTOR_CONTROL Control; PSID Owner; PSID Group; PACL Sacl; PACL Dacl; } SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR; #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR)) #include "poppack.h" #endif /* _SECURITY_DEFINED */ #include "pshpack1.h" /* * SID_AND_ATTRIBUTES */ typedef struct _SID_AND_ATTRIBUTES { PSID Sid; DWORD Attributes; } SID_AND_ATTRIBUTES ; /* security entities */ #define SECURITY_NULL_RID (0x00000000L) #define SECURITY_WORLD_RID (0x00000000L) #define SECURITY_LOCAL_RID (0X00000000L) #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0} /* S-1-1 */ #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1} /* S-1-2 */ #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2} /* S-1-3 */ #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3} #define SECURITY_CREATOR_OWNER_RID (0x00000000L) #define SECURITY_CREATOR_GROUP_RID (0x00000001L) #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L) #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L) /* S-1-4 */ #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4} /* S-1-5 */ #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5} #define SECURITY_DIALUP_RID 0x00000001L #define SECURITY_NETWORK_RID 0x00000002L #define SECURITY_BATCH_RID 0x00000003L #define SECURITY_INTERACTIVE_RID 0x00000004L #define SECURITY_LOGON_IDS_RID 0x00000005L #define SECURITY_SERVICE_RID 0x00000006L #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L #define SECURITY_PROXY_RID 0x00000008L #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L #define SECURITY_NT_NON_UNIQUE 0x00000015L #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L #define DOMAIN_GROUP_RID_ADMINS 0x00000200L #define DOMAIN_GROUP_RID_USERS 0x00000201L #define DOMAIN_GROUP_RID_GUESTS 0x00000202L #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L #define DOMAIN_ALIAS_RID_USERS 0x00000221L #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID #define SECURITY_LOGON_IDS_RID_COUNT (3L) /* * TOKEN_USER */ typedef struct _TOKEN_USER { SID_AND_ATTRIBUTES User; } TOKEN_USER; /* * TOKEN_GROUPS */ typedef struct _TOKEN_GROUPS { DWORD GroupCount; SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY]; } TOKEN_GROUPS; /* * LUID_AND_ATTRIBUTES */ typedef union _LARGE_INTEGER { struct { DWORD LowPart; LONG HighPart; } DUMMYSTRUCTNAME; LONGLONG QuadPart; } LARGE_INTEGER, *LPLARGE_INTEGER, *PLARGE_INTEGER; typedef union _ULARGE_INTEGER { struct { DWORD LowPart; LONG HighPart; } DUMMYSTRUCTNAME; LONGLONG QuadPart; } ULARGE_INTEGER, *LPULARGE_INTEGER, *PULARGE_INTEGER; /* * Locally Unique Identifier */ typedef LARGE_INTEGER LUID,*PLUID; typedef struct _LUID_AND_ATTRIBUTES { LUID Luid; DWORD Attributes; } LUID_AND_ATTRIBUTES; /* * PRIVILEGE_SET */ typedef struct _PRIVILEGE_SET { DWORD PrivilegeCount; DWORD Control; LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY]; } PRIVILEGE_SET, *PPRIVILEGE_SET; /* * TOKEN_PRIVILEGES */ typedef struct _TOKEN_PRIVILEGES { DWORD PrivilegeCount; LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]; } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES; /* * TOKEN_OWNER */ typedef struct _TOKEN_OWNER { PSID Owner; } TOKEN_OWNER; /* * TOKEN_PRIMARY_GROUP */ typedef struct _TOKEN_PRIMARY_GROUP { PSID PrimaryGroup; } TOKEN_PRIMARY_GROUP; /* * TOKEN_DEFAULT_DACL */ typedef struct _TOKEN_DEFAULT_DACL { PACL DefaultDacl; } TOKEN_DEFAULT_DACL; /* * TOKEN_SOURCEL */ typedef struct _TOKEN_SOURCE { char Sourcename[8]; LUID SourceIdentifier; } TOKEN_SOURCE; /* * TOKEN_TYPE */ typedef enum tagTOKEN_TYPE { TokenPrimary = 1, TokenImpersonation } TOKEN_TYPE; /* * SECURITY_IMPERSONATION_LEVEL */ typedef enum _SECURITY_IMPERSONATION_LEVEL { SecurityAnonymous, SecurityIdentification, SecurityImpersonation, SecurityDelegation } SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL; typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE, * PSECURITY_CONTEXT_TRACKING_MODE; /* * Quality of Service */ typedef struct _SECURITY_QUALITY_OF_SERVICE { DWORD Length; SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode; WIN_BOOL EffectiveOnly; } SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE; /* * TOKEN_STATISTICS */ typedef struct _TOKEN_STATISTICS { LUID TokenId; LUID AuthenticationId; LARGE_INTEGER ExpirationTime; TOKEN_TYPE TokenType; SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; DWORD DynamicCharged; DWORD DynamicAvailable; DWORD GroupCount; DWORD PrivilegeCount; LUID ModifiedId; } TOKEN_STATISTICS; /* * ACLs of NT */ #define ACL_REVISION 2 #define ACL_REVISION1 1 #define ACL_REVISION2 2 /* ACEs, directly starting after an ACL */ typedef struct _ACE_HEADER { BYTE AceType; BYTE AceFlags; WORD AceSize; } ACE_HEADER,*PACE_HEADER; /* AceType */ #define ACCESS_ALLOWED_ACE_TYPE 0 #define ACCESS_DENIED_ACE_TYPE 1 #define SYSTEM_AUDIT_ACE_TYPE 2 #define SYSTEM_ALARM_ACE_TYPE 3 /* inherit AceFlags */ #define OBJECT_INHERIT_ACE 0x01 #define CONTAINER_INHERIT_ACE 0x02 #define NO_PROPAGATE_INHERIT_ACE 0x04 #define INHERIT_ONLY_ACE 0x08 #define VALID_INHERIT_FLAGS 0x0F /* AceFlags mask for what events we (should) audit */ #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40 #define FAILED_ACCESS_ACE_FLAG 0x80 /* different ACEs depending on AceType * SidStart marks the begin of a SID * so the thing finally looks like this: * 0: ACE_HEADER * 4: ACCESS_MASK * 8... : SID */ typedef struct _ACCESS_ALLOWED_ACE { ACE_HEADER Header; DWORD Mask; DWORD SidStart; } ACCESS_ALLOWED_ACE,*PACCESS_ALLOWED_ACE; typedef struct _ACCESS_DENIED_ACE { ACE_HEADER Header; DWORD Mask; DWORD SidStart; } ACCESS_DENIED_ACE,*PACCESS_DENIED_ACE; typedef struct _SYSTEM_AUDIT_ACE { ACE_HEADER Header; DWORD Mask; DWORD SidStart; } SYSTEM_AUDIT_ACE,*PSYSTEM_AUDIT_ACE; typedef struct _SYSTEM_ALARM_ACE { ACE_HEADER Header; DWORD Mask; DWORD SidStart; } SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE; typedef enum tagSID_NAME_USE { SidTypeUser = 1, SidTypeGroup, SidTypeDomain, SidTypeAlias, SidTypeWellKnownGroup, SidTypeDeletedAccount, SidTypeInvalid, SidTypeUnknown } SID_NAME_USE,*PSID_NAME_USE; /* Access rights */ #define DELETE 0x00010000 #define READ_CONTROL 0x00020000 #define WRITE_DAC 0x00040000 #define WRITE_OWNER 0x00080000 #define SYNCHRONIZE 0x00100000 #define STANDARD_RIGHTS_REQUIRED 0x000f0000 #define STANDARD_RIGHTS_READ READ_CONTROL #define STANDARD_RIGHTS_WRITE READ_CONTROL #define STANDARD_RIGHTS_EXECUTE READ_CONTROL #define STANDARD_RIGHTS_ALL 0x001f0000 #define SPECIFIC_RIGHTS_ALL 0x0000ffff #define GENERIC_READ 0x80000000 #define GENERIC_WRITE 0x40000000 #define GENERIC_EXECUTE 0x20000000 #define GENERIC_ALL 0x10000000 #define MAXIMUM_ALLOWED 0x02000000 #define ACCESS_SYSTEM_SECURITY 0x01000000 #define EVENT_MODIFY_STATE 0x0002 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) #define SEMAPHORE_MODIFY_STATE 0x0002 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) #define MUTEX_MODIFY_STATE 0x0001 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1) #define PROCESS_TERMINATE 0x0001 #define PROCESS_CREATE_THREAD 0x0002 #define PROCESS_VM_OPERATION 0x0008 #define PROCESS_VM_READ 0x0010 #define PROCESS_VM_WRITE 0x0020 #define PROCESS_DUP_HANDLE 0x0040 #define PROCESS_CREATE_PROCESS 0x0080 #define PROCESS_SET_QUOTA 0x0100 #define PROCESS_SET_INFORMATION 0x0200 #define PROCESS_QUERY_INFORMATION 0x0400 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff) #define THREAD_TERMINATE 0x0001 #define THREAD_SUSPEND_RESUME 0x0002 #define THREAD_GET_CONTEXT 0x0008 #define THREAD_SET_CONTEXT 0x0010 #define THREAD_SET_INFORMATION 0x0020 #define THREAD_QUERY_INFORMATION 0x0040 #define THREAD_SET_THREAD_TOKEN 0x0080 #define THREAD_IMPERSONATE 0x0100 #define THREAD_DIRECT_IMPERSONATION 0x0200 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff) #define THREAD_BASE_PRIORITY_LOWRT 15 #define THREAD_BASE_PRIORITY_MAX 2 #define THREAD_BASE_PRIORITY_MIN -2 #define THREAD_BASE_PRIORITY_IDLE -15 #define FILE_READ_DATA 0x0001 /* file & pipe */ #define FILE_LIST_DIRECTORY 0x0001 /* directory */ #define FILE_WRITE_DATA 0x0002 /* file & pipe */ #define FILE_ADD_FILE 0x0002 /* directory */ #define FILE_APPEND_DATA 0x0004 /* file */ #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */ #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */ #define FILE_READ_EA 0x0008 /* file & directory */ #define FILE_READ_PROPERTIES FILE_READ_EA #define FILE_WRITE_EA 0x0010 /* file & directory */ #define FILE_WRITE_PROPERTIES FILE_WRITE_EA #define FILE_EXECUTE 0x0020 /* file */ #define FILE_TRAVERSE 0x0020 /* directory */ #define FILE_DELETE_CHILD 0x0040 /* directory */ #define FILE_READ_ATTRIBUTES 0x0080 /* all */ #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */ #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff) #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \ FILE_READ_ATTRIBUTES | FILE_READ_EA | \ SYNCHRONIZE) #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \ FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \ FILE_APPEND_DATA | SYNCHRONIZE) #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \ FILE_READ_ATTRIBUTES | SYNCHRONIZE) /* File attribute flags */ #define FILE_SHARE_READ 0x00000001L #define FILE_SHARE_WRITE 0x00000002L #define FILE_SHARE_DELETE 0x00000004L #define FILE_ATTRIBUTE_READONLY 0x00000001L #define FILE_ATTRIBUTE_HIDDEN 0x00000002L #define FILE_ATTRIBUTE_SYSTEM 0x00000004L #define FILE_ATTRIBUTE_LABEL 0x00000008L /* Not in Windows API */ #define FILE_ATTRIBUTE_DIRECTORY 0x00000010L #define FILE_ATTRIBUTE_ARCHIVE 0x00000020L #define FILE_ATTRIBUTE_NORMAL 0x00000080L #define FILE_ATTRIBUTE_TEMPORARY 0x00000100L #define FILE_ATTRIBUTE_ATOMIC_WRITE 0x00000200L #define FILE_ATTRIBUTE_XACTION_WRITE 0x00000400L #define FILE_ATTRIBUTE_COMPRESSED 0x00000800L #define FILE_ATTRIBUTE_OFFLINE 0x00001000L /* File alignments (NT) */ #define FILE_BYTE_ALIGNMENT 0x00000000 #define FILE_WORD_ALIGNMENT 0x00000001 #define FILE_LONG_ALIGNMENT 0x00000003 #define FILE_QUAD_ALIGNMENT 0x00000007 #define FILE_OCTA_ALIGNMENT 0x0000000f #define FILE_32_BYTE_ALIGNMENT 0x0000001f #define FILE_64_BYTE_ALIGNMENT 0x0000003f #define FILE_128_BYTE_ALIGNMENT 0x0000007f #define FILE_256_BYTE_ALIGNMENT 0x000000ff #define FILE_512_BYTE_ALIGNMENT 0x000001ff #define REG_NONE 0 /* no type */ #define REG_SZ 1 /* string type (ASCII) */ #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */ #define REG_BINARY 3 /* binary format, callerspecific */ /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */ #define REG_DWORD 4 /* DWORD in little endian format */ #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */ #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */ #define REG_LINK 6 /* symbolic link (UNICODE) */ #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */ #define REG_RESOURCE_LIST 8 /* resource list? huh? */ #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */ #define REG_RESOURCE_REQUIREMENTS_LIST 10 /* ----------------------------- begin registry ----------------------------- */ /* Registry security values */ #define OWNER_SECURITY_INFORMATION 0x00000001 #define GROUP_SECURITY_INFORMATION 0x00000002 #define DACL_SECURITY_INFORMATION 0x00000004 #define SACL_SECURITY_INFORMATION 0x00000008 #define REG_OPTION_RESERVED 0x00000000 #define REG_OPTION_NON_VOLATILE 0x00000000 #define REG_OPTION_VOLATILE 0x00000001 #define REG_OPTION_CREATE_LINK 0x00000002 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */ #define REG_OPTION_OPEN_LINK 0x00000008 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \ REG_OPTION_NON_VOLATILE| \ REG_OPTION_VOLATILE| \ REG_OPTION_CREATE_LINK| \ REG_OPTION_BACKUP_RESTORE| \ REG_OPTION_OPEN_LINK) #define REG_CREATED_NEW_KEY 0x00000001 #define REG_OPENED_EXISTING_KEY 0x00000002 /* For RegNotifyChangeKeyValue */ #define REG_NOTIFY_CHANGE_NAME 0x1 #define KEY_QUERY_VALUE 0x00000001 #define KEY_SET_VALUE 0x00000002 #define KEY_CREATE_SUB_KEY 0x00000004 #define KEY_ENUMERATE_SUB_KEYS 0x00000008 #define KEY_NOTIFY 0x00000010 #define KEY_CREATE_LINK 0x00000020 #define KEY_READ ((STANDARD_RIGHTS_READ| \ KEY_QUERY_VALUE| \ KEY_ENUMERATE_SUB_KEYS| \ KEY_NOTIFY) \ & (~SYNCHRONIZE) \ ) #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \ KEY_SET_VALUE| \ KEY_CREATE_SUB_KEY) \ & (~SYNCHRONIZE) \ ) #define KEY_EXECUTE ((KEY_READ) \ & (~SYNCHRONIZE)) \ ) #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \ KEY_QUERY_VALUE| \ KEY_SET_VALUE| \ KEY_CREATE_SUB_KEY| \ KEY_ENUMERATE_SUB_KEYS| \ KEY_NOTIFY| \ KEY_CREATE_LINK) \ & (~SYNCHRONIZE) \ ) /* ------------------------------ end registry ------------------------------ */ #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length))) #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length)) #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length)) #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length)) #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length)) #include "poppack.h" #endif /* __WINE_WINNT_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/winreg.h0000644000175000017500000000260007233220513022722 0ustar yavoryavor/* * Win32 registry defines (see also winnt.h) */ #ifndef __WINE_WINREG_H #define __WINE_WINREG_H #include "winbase.h" #include "winnt.h" #ifdef __cplusplus extern "C" { #endif /* defined(__cplusplus) */ /* #define SHELL_ERROR_SUCCESS 0L #define SHELL_ERROR_BADDB 1L #define SHELL_ERROR_BADKEY 2L #define SHELL_ERROR_CANTOPEN 3L #define SHELL_ERROR_CANTREAD 4L #define SHELL_ERROR_CANTWRITE 5L #define SHELL_ERROR_OUTOFMEMORY 6L #define SHELL_ERROR_INVALID_PARAMETER 7L #define SHELL_ERROR_ACCESS_DENIED 8L */ #define HKEY_CLASSES_ROOT ((HKEY) 0x80000000) #define HKEY_CURRENT_USER ((HKEY) 0x80000001) #define HKEY_LOCAL_MACHINE ((HKEY) 0x80000002) #define HKEY_USERS ((HKEY) 0x80000003) #define HKEY_PERFORMANCE_DATA ((HKEY) 0x80000004) #define HKEY_CURRENT_CONFIG ((HKEY) 0x80000005) #define HKEY_DYN_DATA ((HKEY) 0x80000006) /* * registry provider structs */ typedef struct value_entA { LPSTR ve_valuename; DWORD ve_valuelen; DWORD_PTR ve_valueptr; DWORD ve_type; } VALENTA, *PVALENTA; typedef struct value_entW { LPWSTR ve_valuename; DWORD ve_valuelen; DWORD_PTR ve_valueptr; DWORD ve_type; } VALENTW, *PVALENTW; typedef ACCESS_MASK REGSAM; #ifdef __cplusplus } /* extern "C" */ #endif /* defined(__cplusplus) */ #endif /* __WINE_WINREG_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wine/winuser.h0000644000175000017500000025113707233220522023136 0ustar yavoryavor#ifndef _WINUSER_ #define _WINUSER_ #ifndef RC_INVOKED #include #endif #ifdef __cplusplus extern "C" { #endif #include "pshpack1.h" /* flags for HIGHCONTRAST dwFlags field */ #define HCF_HIGHCONTRASTON 0x00000001 #define HCF_AVAILABLE 0x00000002 #define HCF_HOTKEYACTIVE 0x00000004 #define HCF_CONFIRMHOTKEY 0x00000008 #define HCF_HOTKEYSOUND 0x00000010 #define HCF_INDICATOR 0x00000020 #define HCF_HOTKEYAVAILABLE 0x00000040 typedef struct tagHIGHCONTRASTA { UINT cbSize; DWORD dwFlags; LPSTR lpszDefaultScheme; } HIGHCONTRASTA, *LPHIGHCONTRASTA; typedef struct tagHIGHCONTRASTW { UINT cbSize; DWORD dwFlags; LPWSTR lpszDefaultScheme; } HIGHCONTRASTW, *LPHIGHCONTRASTW; DECL_WINELIB_TYPE_AW(HIGHCONTRAST) DECL_WINELIB_TYPE_AW(LPHIGHCONTRAST) typedef struct { UINT message; UINT paramL; UINT paramH; DWORD time; HWND hwnd; } EVENTMSG, *LPEVENTMSG; /* Mouse hook structure */ typedef struct { POINT pt; HWND hwnd; UINT wHitTestCode; DWORD dwExtraInfo; } MOUSEHOOKSTRUCT, *PMOUSEHOOKSTRUCT, *LPMOUSEHOOKSTRUCT; /* Hardware hook structure */ typedef struct { HWND hWnd; UINT wMessage; WPARAM wParam; LPARAM lParam; } HARDWAREHOOKSTRUCT, *LPHARDWAREHOOKSTRUCT; /* Debug hook structure */ typedef struct { DWORD idThread; DWORD idThreadInstaller; LPARAM lParam; WPARAM wParam; INT code; } DEBUGHOOKINFO, *LPDEBUGHOOKINFO; #define HKL_PREV 0 #define HKL_NEXT 1 #define KLF_ACTIVATE 0x00000001 #define KLF_SUBSTITUTE_OK 0x00000002 #define KLF_UNLOADPREVIOUS 0x00000004 #define KLF_REORDER 0x00000008 #define KLF_REPLACELANG 0x00000010 #define KLF_NOTELLSHELL 0x00000080 #define KL_NAMELENGTH 9 /***** Dialogs *****/ #ifdef FSHIFT /* Gcc on Solaris has a version of this that we don't care about. */ #undef FSHIFT #endif #define FVIRTKEY TRUE /* Assumed to be == TRUE */ #define FNOINVERT 0x02 #define FSHIFT 0x04 #define FCONTROL 0x08 #define FALT 0x10 typedef struct tagANIMATIONINFO { UINT cbSize; INT iMinAnimate; } ANIMATIONINFO, *LPANIMATIONINFO; typedef struct tagNMHDR { HWND hwndFrom; UINT idFrom; UINT code; } NMHDR, *LPNMHDR; typedef struct { UINT cbSize; INT iTabLength; INT iLeftMargin; INT iRightMargin; UINT uiLengthDrawn; } DRAWTEXTPARAMS,*LPDRAWTEXTPARAMS; #define WM_USER 0x0400 #define DT_EDITCONTROL 0x00002000 #define DT_PATH_ELLIPSIS 0x00004000 #define DT_END_ELLIPSIS 0x00008000 #define DT_MODIFYSTRING 0x00010000 #define DT_RTLREADING 0x00020000 #define DT_WORD_ELLIPSIS 0x00040000 typedef struct { LPARAM lParam; WPARAM16 wParam; UINT16 message; HWND16 hwnd; } CWPSTRUCT16, *LPCWPSTRUCT16; typedef struct { LPARAM lParam; WPARAM wParam; UINT message; HWND hwnd; } CWPSTRUCT, *LPCWPSTRUCT; typedef struct { LRESULT lResult; LPARAM lParam; WPARAM16 wParam; DWORD message; HWND16 hwnd; } CWPRETSTRUCT16, *LPCWPRETSTRUCT16; typedef struct { LRESULT lResult; LPARAM lParam; WPARAM wParam; DWORD message; HWND hwnd; } CWPRETSTRUCT, *LPCWPRETSTRUCT; typedef struct { UINT length; UINT flags; UINT showCmd; POINT ptMinPosition WINE_PACKED; POINT ptMaxPosition WINE_PACKED; RECT rcNormalPosition WINE_PACKED; } WINDOWPLACEMENT, *LPWINDOWPLACEMENT; /* WINDOWPLACEMENT flags */ #define WPF_SETMINPOSITION 0x0001 #define WPF_RESTORETOMAXIMIZED 0x0002 /***** Dialogs *****/ /* cbWndExtra bytes for dialog class */ #define DLGWINDOWEXTRA 30 /* Button control styles */ #define BS_PUSHBUTTON 0x00000000L #define BS_DEFPUSHBUTTON 0x00000001L #define BS_CHECKBOX 0x00000002L #define BS_AUTOCHECKBOX 0x00000003L #define BS_RADIOBUTTON 0x00000004L #define BS_3STATE 0x00000005L #define BS_AUTO3STATE 0x00000006L #define BS_GROUPBOX 0x00000007L #define BS_USERBUTTON 0x00000008L #define BS_AUTORADIOBUTTON 0x00000009L #define BS_OWNERDRAW 0x0000000BL #define BS_LEFTTEXT 0x00000020L #define BS_TEXT 0x00000000L #define BS_ICON 0x00000040L #define BS_BITMAP 0x00000080L #define BS_LEFT 0x00000100L #define BS_RIGHT 0x00000200L #define BS_CENTER 0x00000300L #define BS_TOP 0x00000400L #define BS_BOTTOM 0x00000800L #define BS_VCENTER 0x00000C00L #define BS_PUSHLIKE 0x00001000L #define BS_MULTILINE 0x00002000L #define BS_NOTIFY 0x00004000L #define BS_FLAT 0x00008000L /* Dialog styles */ #define DS_ABSALIGN 0x0001 #define DS_SYSMODAL 0x0002 #define DS_3DLOOK 0x0004 /* win95 */ #define DS_FIXEDSYS 0x0008 /* win95 */ #define DS_NOFAILCREATE 0x0010 /* win95 */ #define DS_LOCALEDIT 0x0020 #define DS_SETFONT 0x0040 #define DS_MODALFRAME 0x0080 #define DS_NOIDLEMSG 0x0100 #define DS_SETFOREGROUND 0x0200 /* win95 */ #define DS_CONTROL 0x0400 /* win95 */ #define DS_CENTER 0x0800 /* win95 */ #define DS_CENTERMOUSE 0x1000 /* win95 */ #define DS_CONTEXTHELP 0x2000 /* win95 */ /* Dialog messages */ #define DM_GETDEFID (WM_USER+0) #define DM_SETDEFID (WM_USER+1) #define DC_HASDEFID 0x534b /* Owner draw control types */ #define ODT_MENU 1 #define ODT_LISTBOX 2 #define ODT_COMBOBOX 3 #define ODT_BUTTON 4 #define ODT_STATIC 5 /* Owner draw actions */ #define ODA_DRAWENTIRE 0x0001 #define ODA_SELECT 0x0002 #define ODA_FOCUS 0x0004 /* Owner draw state */ #define ODS_SELECTED 0x0001 #define ODS_GRAYED 0x0002 #define ODS_DISABLED 0x0004 #define ODS_CHECKED 0x0008 #define ODS_FOCUS 0x0010 #define ODS_COMBOBOXEDIT 0x1000 #define ODS_HOTLIGHT 0x0040 #define ODS_INACTIVE 0x0080 /* Edit control styles */ #define ES_LEFT 0x00000000 #define ES_CENTER 0x00000001 #define ES_RIGHT 0x00000002 #define ES_MULTILINE 0x00000004 #define ES_UPPERCASE 0x00000008 #define ES_LOWERCASE 0x00000010 #define ES_PASSWORD 0x00000020 #define ES_AUTOVSCROLL 0x00000040 #define ES_AUTOHSCROLL 0x00000080 #define ES_NOHIDESEL 0x00000100 #define ES_OEMCONVERT 0x00000400 #define ES_READONLY 0x00000800 #define ES_WANTRETURN 0x00001000 #define ES_NUMBER 0x00002000 /* OEM Resource Ordinal Numbers */ #define OBM_CLOSED 32731 #define OBM_RADIOCHECK 32732 #define OBM_TRTYPE 32733 #define OBM_LFARROWI 32734 #define OBM_RGARROWI 32735 #define OBM_DNARROWI 32736 #define OBM_UPARROWI 32737 #define OBM_COMBO 32738 #define OBM_MNARROW 32739 #define OBM_LFARROWD 32740 #define OBM_RGARROWD 32741 #define OBM_DNARROWD 32742 #define OBM_UPARROWD 32743 #define OBM_RESTORED 32744 #define OBM_ZOOMD 32745 #define OBM_REDUCED 32746 #define OBM_RESTORE 32747 #define OBM_ZOOM 32748 #define OBM_REDUCE 32749 #define OBM_LFARROW 32750 #define OBM_RGARROW 32751 #define OBM_DNARROW 32752 #define OBM_UPARROW 32753 #define OBM_CLOSE 32754 #define OBM_OLD_RESTORE 32755 #define OBM_OLD_ZOOM 32756 #define OBM_OLD_REDUCE 32757 #define OBM_BTNCORNERS 32758 #define OBM_CHECKBOXES 32759 #define OBM_CHECK 32760 #define OBM_BTSIZE 32761 #define OBM_OLD_LFARROW 32762 #define OBM_OLD_RGARROW 32763 #define OBM_OLD_DNARROW 32764 #define OBM_OLD_UPARROW 32765 #define OBM_SIZE 32766 #define OBM_OLD_CLOSE 32767 #define OCR_BUMMER 100 #define OCR_DRAGOBJECT 101 #define OCR_NORMAL 32512 #define OCR_IBEAM 32513 #define OCR_WAIT 32514 #define OCR_CROSS 32515 #define OCR_UP 32516 #define OCR_SIZE 32640 #define OCR_ICON 32641 #define OCR_SIZENWSE 32642 #define OCR_SIZENESW 32643 #define OCR_SIZEWE 32644 #define OCR_SIZENS 32645 #define OCR_SIZEALL 32646 #define OCR_ICOCUR 32647 #define OCR_NO 32648 #define OCR_APPSTARTING 32650 #define OCR_HELP 32651 /* only defined in wine */ #define OIC_SAMPLE 32512 #define OIC_HAND 32513 #define OIC_QUES 32514 #define OIC_BANG 32515 #define OIC_NOTE 32516 #define OIC_PORTRAIT 32517 #define OIC_LANDSCAPE 32518 #define OIC_WINEICON 32519 #define OIC_FOLDER 32520 #define OIC_FOLDER2 32521 #define OIC_FLOPPY 32522 #define OIC_CDROM 32523 #define OIC_HDISK 32524 #define OIC_NETWORK 32525 #define COLOR_SCROLLBAR 0 #define COLOR_BACKGROUND 1 #define COLOR_ACTIVECAPTION 2 #define COLOR_INACTIVECAPTION 3 #define COLOR_MENU 4 #define COLOR_WINDOW 5 #define COLOR_WINDOWFRAME 6 #define COLOR_MENUTEXT 7 #define COLOR_WINDOWTEXT 8 #define COLOR_CAPTIONTEXT 9 #define COLOR_ACTIVEBORDER 10 #define COLOR_INACTIVEBORDER 11 #define COLOR_APPWORKSPACE 12 #define COLOR_HIGHLIGHT 13 #define COLOR_HIGHLIGHTTEXT 14 #define COLOR_BTNFACE 15 #define COLOR_BTNSHADOW 16 #define COLOR_GRAYTEXT 17 #define COLOR_BTNTEXT 18 #define COLOR_INACTIVECAPTIONTEXT 19 #define COLOR_BTNHIGHLIGHT 20 /* win95 colors */ #define COLOR_3DDKSHADOW 21 #define COLOR_3DLIGHT 22 #define COLOR_INFOTEXT 23 #define COLOR_INFOBK 24 #define COLOR_DESKTOP COLOR_BACKGROUND #define COLOR_3DFACE COLOR_BTNFACE #define COLOR_3DSHADOW COLOR_BTNSHADOW #define COLOR_3DHIGHLIGHT COLOR_BTNHIGHLIGHT #define COLOR_3DHILIGHT COLOR_BTNHIGHLIGHT #define COLOR_BTNHILIGHT COLOR_BTNHIGHLIGHT /* win98 colors */ #define COLOR_ALTERNATEBTNFACE 25 /* undocumented, constant's name unknown */ #define COLOR_HOTLIGHT 26 #define COLOR_GRADIENTACTIVECAPTION 27 #define COLOR_GRADIENTINACTIVECAPTION 28 /* WM_CTLCOLOR values */ #define CTLCOLOR_MSGBOX 0 #define CTLCOLOR_EDIT 1 #define CTLCOLOR_LISTBOX 2 #define CTLCOLOR_BTN 3 #define CTLCOLOR_DLG 4 #define CTLCOLOR_SCROLLBAR 5 #define CTLCOLOR_STATIC 6 /* Edit control messages */ #define EM_GETSEL 0x00b0 #define EM_SETSEL 0x00b1 #define EM_GETRECT 0x00b2 #define EM_SETRECT 0x00b3 #define EM_SETRECTNP 0x00b4 #define EM_SCROLL 0x00b5 #define EM_LINESCROLL 0x00b6 #define EM_SCROLLCARET 0x00b7 #define EM_GETMODIFY 0x00b8 #define EM_SETMODIFY 0x00b9 #define EM_GETLINECOUNT 0x00ba #define EM_LINEINDEX 0x00bb #define EM_SETHANDLE 0x00bc #define EM_GETHANDLE 0x00bd #define EM_GETTHUMB 0x00be /* FIXME : missing from specs 0x00bf and 0x00c0 */ #define EM_LINELENGTH 0x00c1 #define EM_REPLACESEL 0x00c2 /* FIXME : missing from specs 0x00c3 */ #define EM_GETLINE 0x00c4 #define EM_LIMITTEXT 0x00c5 #define EM_CANUNDO 0x00c6 #define EM_UNDO 0x00c7 #define EM_FMTLINES 0x00c8 #define EM_LINEFROMCHAR 0x00c9 /* FIXME : missing from specs 0x00ca */ #define EM_SETTABSTOPS 0x00cb #define EM_SETPASSWORDCHAR 0x00cc #define EM_EMPTYUNDOBUFFER 0x00cd #define EM_GETFIRSTVISIBLELINE 0x00ce #define EM_SETREADONLY 0x00cf #define EM_SETWORDBREAKPROC 0x00d0 #define EM_GETWORDBREAKPROC 0x00d1 #define EM_GETPASSWORDCHAR 0x00d2 #define EM_SETMARGINS 0x00d3 #define EM_GETMARGINS 0x00d4 #define EM_GETLIMITTEXT 0x00d5 #define EM_POSFROMCHAR 0x00d6 #define EM_CHARFROMPOS 0x00d7 /* a name change since win95 */ #define EM_SETLIMITTEXT EM_LIMITTEXT /* EDITWORDBREAKPROC code values */ #define WB_LEFT 0 #define WB_RIGHT 1 #define WB_ISDELIMITER 2 /* Edit control notification codes */ #define EN_SETFOCUS 0x0100 #define EN_KILLFOCUS 0x0200 #define EN_CHANGE 0x0300 #define EN_UPDATE 0x0400 #define EN_ERRSPACE 0x0500 #define EN_MAXTEXT 0x0501 #define EN_HSCROLL 0x0601 #define EN_VSCROLL 0x0602 /* New since win95 : EM_SETMARGIN parameters */ #define EC_LEFTMARGIN 0x0001 #define EC_RIGHTMARGIN 0x0002 #define EC_USEFONTINFO 0xffff /* Messages */ /* WM_GETDLGCODE values */ #define WM_NULL 0x0000 #define WM_CREATE 0x0001 #define WM_DESTROY 0x0002 #define WM_MOVE 0x0003 #define WM_SIZEWAIT 0x0004 #define WM_SIZE 0x0005 #define WM_ACTIVATE 0x0006 #define WM_SETFOCUS 0x0007 #define WM_KILLFOCUS 0x0008 #define WM_SETVISIBLE 0x0009 #define WM_ENABLE 0x000a #define WM_SETREDRAW 0x000b #define WM_SETTEXT 0x000c #define WM_GETTEXT 0x000d #define WM_GETTEXTLENGTH 0x000e #define WM_PAINT 0x000f #define WM_CLOSE 0x0010 #define WM_QUERYENDSESSION 0x0011 #define WM_QUIT 0x0012 #define WM_QUERYOPEN 0x0013 #define WM_ERASEBKGND 0x0014 #define WM_SYSCOLORCHANGE 0x0015 #define WM_ENDSESSION 0x0016 #define WM_SYSTEMERROR 0x0017 #define WM_SHOWWINDOW 0x0018 #define WM_CTLCOLOR 0x0019 #define WM_WININICHANGE 0x001a #define WM_SETTINGCHANGE WM_WININICHANGE #define WM_DEVMODECHANGE 0x001b #define WM_ACTIVATEAPP 0x001c #define WM_FONTCHANGE 0x001d #define WM_TIMECHANGE 0x001e #define WM_CANCELMODE 0x001f #define WM_SETCURSOR 0x0020 #define WM_MOUSEACTIVATE 0x0021 #define WM_CHILDACTIVATE 0x0022 #define WM_QUEUESYNC 0x0023 #define WM_GETMINMAXINFO 0x0024 #define WM_PAINTICON 0x0026 #define WM_ICONERASEBKGND 0x0027 #define WM_NEXTDLGCTL 0x0028 #define WM_ALTTABACTIVE 0x0029 #define WM_SPOOLERSTATUS 0x002a #define WM_DRAWITEM 0x002b #define WM_MEASUREITEM 0x002c #define WM_DELETEITEM 0x002d #define WM_VKEYTOITEM 0x002e #define WM_CHARTOITEM 0x002f #define WM_SETFONT 0x0030 #define WM_GETFONT 0x0031 #define WM_SETHOTKEY 0x0032 #define WM_GETHOTKEY 0x0033 #define WM_FILESYSCHANGE 0x0034 #define WM_ISACTIVEICON 0x0035 #define WM_QUERYPARKICON 0x0036 #define WM_QUERYDRAGICON 0x0037 #define WM_QUERYSAVESTATE 0x0038 #define WM_COMPAREITEM 0x0039 #define WM_TESTING 0x003a #define WM_OTHERWINDOWCREATED 0x003c #define WM_OTHERWINDOWDESTROYED 0x003d #define WM_ACTIVATESHELLWINDOW 0x003e #define WM_COMPACTING 0x0041 #define WM_COMMNOTIFY 0x0044 #define WM_WINDOWPOSCHANGING 0x0046 #define WM_WINDOWPOSCHANGED 0x0047 #define WM_POWER 0x0048 /* Win32 4.0 messages */ #define WM_COPYDATA 0x004a #define WM_CANCELJOURNAL 0x004b #define WM_NOTIFY 0x004e #define WM_HELP 0x0053 #define WM_NOTIFYFORMAT 0x0055 #define WM_CONTEXTMENU 0x007b #define WM_STYLECHANGING 0x007c #define WM_STYLECHANGED 0x007d #define WM_DISPLAYCHANGE 0x007e #define WM_GETICON 0x007f #define WM_SETICON 0x0080 /* Non-client system messages */ #define WM_NCCREATE 0x0081 #define WM_NCDESTROY 0x0082 #define WM_NCCALCSIZE 0x0083 #define WM_NCHITTEST 0x0084 #define WM_NCPAINT 0x0085 #define WM_NCACTIVATE 0x0086 #define WM_GETDLGCODE 0x0087 #define WM_SYNCPAINT 0x0088 #define WM_SYNCTASK 0x0089 /* Non-client mouse messages */ #define WM_NCMOUSEMOVE 0x00a0 #define WM_NCLBUTTONDOWN 0x00a1 #define WM_NCLBUTTONUP 0x00a2 #define WM_NCLBUTTONDBLCLK 0x00a3 #define WM_NCRBUTTONDOWN 0x00a4 #define WM_NCRBUTTONUP 0x00a5 #define WM_NCRBUTTONDBLCLK 0x00a6 #define WM_NCMBUTTONDOWN 0x00a7 #define WM_NCMBUTTONUP 0x00a8 #define WM_NCMBUTTONDBLCLK 0x00a9 /* Keyboard messages */ #define WM_KEYDOWN 0x0100 #define WM_KEYUP 0x0101 #define WM_CHAR 0x0102 #define WM_DEADCHAR 0x0103 #define WM_SYSKEYDOWN 0x0104 #define WM_SYSKEYUP 0x0105 #define WM_SYSCHAR 0x0106 #define WM_SYSDEADCHAR 0x0107 #define WM_KEYFIRST WM_KEYDOWN #define WM_KEYLAST 0x0108 /* Win32 4.0 messages for IME */ #define WM_IME_STARTCOMPOSITION 0x010d #define WM_IME_ENDCOMPOSITION 0x010e #define WM_IME_COMPOSITION 0x010f #define WM_IME_KEYLAST 0x010f #define WM_INITDIALOG 0x0110 #define WM_COMMAND 0x0111 #define WM_SYSCOMMAND 0x0112 #define WM_TIMER 0x0113 #define WM_SYSTIMER 0x0118 /* scroll messages */ #define WM_HSCROLL 0x0114 #define WM_VSCROLL 0x0115 /* Menu messages */ #define WM_INITMENU 0x0116 #define WM_INITMENUPOPUP 0x0117 #define WM_MENUSELECT 0x011F #define WM_MENUCHAR 0x0120 #define WM_ENTERIDLE 0x0121 #define WM_LBTRACKPOINT 0x0131 /* Win32 CTLCOLOR messages */ #define WM_CTLCOLORMSGBOX 0x0132 #define WM_CTLCOLOREDIT 0x0133 #define WM_CTLCOLORLISTBOX 0x0134 #define WM_CTLCOLORBTN 0x0135 #define WM_CTLCOLORDLG 0x0136 #define WM_CTLCOLORSCROLLBAR 0x0137 #define WM_CTLCOLORSTATIC 0x0138 /* Mouse messages */ #define WM_MOUSEMOVE 0x0200 #define WM_LBUTTONDOWN 0x0201 #define WM_LBUTTONUP 0x0202 #define WM_LBUTTONDBLCLK 0x0203 #define WM_RBUTTONDOWN 0x0204 #define WM_RBUTTONUP 0x0205 #define WM_RBUTTONDBLCLK 0x0206 #define WM_MBUTTONDOWN 0x0207 #define WM_MBUTTONUP 0x0208 #define WM_MBUTTONDBLCLK 0x0209 #define WM_MOUSEWHEEL 0x020A #define WM_MOUSEFIRST WM_MOUSEMOVE #define WM_MOUSELAST WM_MOUSEWHEEL #define WHEEL_DELTA 120 #define WHEEL_PAGESCROLL (UINT_MAX) #define WM_PARENTNOTIFY 0x0210 #define WM_ENTERMENULOOP 0x0211 #define WM_EXITMENULOOP 0x0212 #define WM_NEXTMENU 0x0213 /* Win32 4.0 messages */ #define WM_SIZING 0x0214 #define WM_CAPTURECHANGED 0x0215 #define WM_MOVING 0x0216 /* MDI messages */ #define WM_MDICREATE 0x0220 #define WM_MDIDESTROY 0x0221 #define WM_MDIACTIVATE 0x0222 #define WM_MDIRESTORE 0x0223 #define WM_MDINEXT 0x0224 #define WM_MDIMAXIMIZE 0x0225 #define WM_MDITILE 0x0226 #define WM_MDICASCADE 0x0227 #define WM_MDIICONARRANGE 0x0228 #define WM_MDIGETACTIVE 0x0229 #define WM_MDIREFRESHMENU 0x0234 /* D&D messages */ #define WM_DROPOBJECT 0x022A #define WM_QUERYDROPOBJECT 0x022B #define WM_BEGINDRAG 0x022C #define WM_DRAGLOOP 0x022D #define WM_DRAGSELECT 0x022E #define WM_DRAGMOVE 0x022F #define WM_MDISETMENU 0x0230 #define WM_ENTERSIZEMOVE 0x0231 #define WM_EXITSIZEMOVE 0x0232 #define WM_DROPFILES 0x0233 /* Win32 4.0 messages for IME */ #define WM_IME_SETCONTEXT 0x0281 #define WM_IME_NOTIFY 0x0282 #define WM_IME_CONTROL 0x0283 #define WM_IME_COMPOSITIONFULL 0x0284 #define WM_IME_SELECT 0x0285 #define WM_IME_CHAR 0x0286 /* Win32 5.0 messages for IME */ #define WM_IME_REQUEST 0x0288 /* Win32 4.0 messages for IME */ #define WM_IME_KEYDOWN 0x0290 #define WM_IME_KEYUP 0x0291 /* Clipboard command messages */ #define WM_CUT 0x0300 #define WM_COPY 0x0301 #define WM_PASTE 0x0302 #define WM_CLEAR 0x0303 #define WM_UNDO 0x0304 /* Clipboard owner messages */ #define WM_RENDERFORMAT 0x0305 #define WM_RENDERALLFORMATS 0x0306 #define WM_DESTROYCLIPBOARD 0x0307 /* Clipboard viewer messages */ #define WM_DRAWCLIPBOARD 0x0308 #define WM_PAINTCLIPBOARD 0x0309 #define WM_VSCROLLCLIPBOARD 0x030A #define WM_SIZECLIPBOARD 0x030B #define WM_ASKCBFORMATNAME 0x030C #define WM_CHANGECBCHAIN 0x030D #define WM_HSCROLLCLIPBOARD 0x030E #define WM_QUERYNEWPALETTE 0x030F #define WM_PALETTEISCHANGING 0x0310 #define WM_PALETTECHANGED 0x0311 #define WM_HOTKEY 0x0312 #define WM_PRINT 0x0317 #define WM_PRINTCLIENT 0x0318 /* FIXME: This does not belong to any libwine interface header */ /* MFC messages [360-38f] */ #define WM_QUERYAFXWNDPROC 0x0360 #define WM_SIZEPARENT 0x0361 #define WM_SETMESSAGESTRING 0x0362 #define WM_IDLEUPDATECMDUI 0x0363 #define WM_INITIALUPDATE 0x0364 #define WM_COMMANDHELP 0x0365 #define WM_HELPHITTEST 0x0366 #define WM_EXITHELPMODE 0x0367 #define WM_RECALCPARENT 0x0368 #define WM_SIZECHILD 0x0369 #define WM_KICKIDLE 0x036A #define WM_QUERYCENTERWND 0x036B #define WM_DISABLEMODAL 0x036C #define WM_FLOATSTATUS 0x036D #define WM_ACTIVATETOPLEVEL 0x036E #define WM_QUERY3DCONTROLS 0x036F #define WM_SOCKET_NOTIFY 0x0373 #define WM_SOCKET_DEAD 0x0374 #define WM_POPMESSAGESTRING 0x0375 #define WM_OCC_LOADFROMSTREAM 0x0376 #define WM_OCC_LOADFROMSTORAGE 0x0377 #define WM_OCC_INITNEW 0x0378 #define WM_OCC_LOADFROMSTREAM_EX 0x037A #define WM_OCC_LOADFROMSTORAGE_EX 0x037B #define WM_QUEUE_SENTINEL 0x0379 #define WM_PENWINFIRST 0x0380 #define WM_PENWINLAST 0x038F /* end of MFC messages */ /* FIXME: The following two lines do not belong to any libwine interface header */ #define WM_COALESCE_FIRST 0x0390 #define WM_COALESCE_LAST 0x039F #define WM_APP 0x8000 #define DLGC_WANTARROWS 0x0001 #define DLGC_WANTTAB 0x0002 #define DLGC_WANTALLKEYS 0x0004 #define DLGC_WANTMESSAGE 0x0004 #define DLGC_HASSETSEL 0x0008 #define DLGC_DEFPUSHBUTTON 0x0010 #define DLGC_UNDEFPUSHBUTTON 0x0020 #define DLGC_RADIOBUTTON 0x0040 #define DLGC_WANTCHARS 0x0080 #define DLGC_STATIC 0x0100 #define DLGC_BUTTON 0x2000 /* Standard dialog button IDs */ #define IDOK 1 #define IDCANCEL 2 #define IDABORT 3 #define IDRETRY 4 #define IDIGNORE 5 #define IDYES 6 #define IDNO 7 #define IDCLOSE 8 #define IDHELP 9 /****** Window classes ******/ typedef struct tagCREATESTRUCTA { LPVOID lpCreateParams; HINSTANCE hInstance; HMENU hMenu; HWND hwndParent; INT cy; INT cx; INT y; INT x; LONG style; LPCSTR lpszName; LPCSTR lpszClass; DWORD dwExStyle; } CREATESTRUCTA, *LPCREATESTRUCTA; typedef struct { LPVOID lpCreateParams; HINSTANCE hInstance; HMENU hMenu; HWND hwndParent; INT cy; INT cx; INT y; INT x; LONG style; LPCWSTR lpszName; LPCWSTR lpszClass; DWORD dwExStyle; } CREATESTRUCTW, *LPCREATESTRUCTW; DECL_WINELIB_TYPE_AW(CREATESTRUCT) DECL_WINELIB_TYPE_AW(LPCREATESTRUCT) typedef struct { HDC hdc; WIN_BOOL fErase; RECT rcPaint; WIN_BOOL fRestore; WIN_BOOL fIncUpdate; BYTE rgbReserved[32]; } PAINTSTRUCT, *PPAINTSTRUCT, *LPPAINTSTRUCT; typedef struct { HMENU hWindowMenu; UINT idFirstChild; } CLIENTCREATESTRUCT, *LPCLIENTCREATESTRUCT; typedef struct { LPCSTR szClass; LPCSTR szTitle; HINSTANCE hOwner; INT x; INT y; INT cx; INT cy; DWORD style; LPARAM lParam; } MDICREATESTRUCTA, *LPMDICREATESTRUCTA; typedef struct { LPCWSTR szClass; LPCWSTR szTitle; HINSTANCE hOwner; INT x; INT y; INT cx; INT cy; DWORD style; LPARAM lParam; } MDICREATESTRUCTW, *LPMDICREATESTRUCTW; DECL_WINELIB_TYPE_AW(MDICREATESTRUCT) DECL_WINELIB_TYPE_AW(LPMDICREATESTRUCT) #define MDITILE_VERTICAL 0x0000 #define MDITILE_HORIZONTAL 0x0001 #define MDITILE_SKIPDISABLED 0x0002 #define MDIS_ALLCHILDSTYLES 0x0001 typedef struct { DWORD styleOld; DWORD styleNew; } STYLESTRUCT, *LPSTYLESTRUCT; /* Offsets for GetWindowLong() and GetWindowWord() */ #define GWL_USERDATA (-21) #define GWL_EXSTYLE (-20) #define GWL_STYLE (-16) #define GWW_ID (-12) #define GWL_ID GWW_ID #define GWW_HWNDPARENT (-8) #define GWL_HWNDPARENT GWW_HWNDPARENT #define GWW_HINSTANCE (-6) #define GWL_HINSTANCE GWW_HINSTANCE #define GWL_WNDPROC (-4) #define DWL_MSGRESULT 0 #define DWL_DLGPROC 4 #define DWL_USER 8 /* GetWindow() constants */ #define GW_HWNDFIRST 0 #define GW_HWNDLAST 1 #define GW_HWNDNEXT 2 #define GW_HWNDPREV 3 #define GW_OWNER 4 #define GW_CHILD 5 /* WM_GETMINMAXINFO struct */ typedef struct { POINT ptReserved; POINT ptMaxSize; POINT ptMaxPosition; POINT ptMinTrackSize; POINT ptMaxTrackSize; } MINMAXINFO, *PMINMAXINFO, *LPMINMAXINFO; /* RedrawWindow() flags */ #define RDW_INVALIDATE 0x0001 #define RDW_INTERNALPAINT 0x0002 #define RDW_ERASE 0x0004 #define RDW_VALIDATE 0x0008 #define RDW_NOINTERNALPAINT 0x0010 #define RDW_NOERASE 0x0020 #define RDW_NOCHILDREN 0x0040 #define RDW_ALLCHILDREN 0x0080 #define RDW_UPDATENOW 0x0100 #define RDW_ERASENOW 0x0200 #define RDW_FRAME 0x0400 #define RDW_NOFRAME 0x0800 /* debug flags */ #define DBGFILL_ALLOC 0xfd #define DBGFILL_FREE 0xfb #define DBGFILL_BUFFER 0xf9 #define DBGFILL_STACK 0xf7 /* WM_WINDOWPOSCHANGING/CHANGED struct */ typedef struct tagWINDOWPOS { HWND hwnd; HWND hwndInsertAfter; INT x; INT y; INT cx; INT cy; UINT flags; } WINDOWPOS, *PWINDOWPOS, *LPWINDOWPOS; /* WM_MOUSEACTIVATE return values */ #define MA_ACTIVATE 1 #define MA_ACTIVATEANDEAT 2 #define MA_NOACTIVATE 3 #define MA_NOACTIVATEANDEAT 4 /* WM_ACTIVATE wParam values */ #define WA_INACTIVE 0 #define WA_ACTIVE 1 #define WA_CLICKACTIVE 2 /* WM_GETICON/WM_SETICON params values */ #define ICON_SMALL 0 #define ICON_BIG 1 /* WM_NCCALCSIZE parameter structure */ typedef struct { RECT rgrc[3]; WINDOWPOS *lppos; } NCCALCSIZE_PARAMS, *LPNCCALCSIZE_PARAMS; /* WM_NCCALCSIZE return flags */ #define WVR_ALIGNTOP 0x0010 #define WVR_ALIGNLEFT 0x0020 #define WVR_ALIGNBOTTOM 0x0040 #define WVR_ALIGNRIGHT 0x0080 #define WVR_HREDRAW 0x0100 #define WVR_VREDRAW 0x0200 #define WVR_REDRAW (WVR_HREDRAW | WVR_VREDRAW) #define WVR_VALIDRECTS 0x0400 /* WM_NCHITTEST return codes */ #define HTERROR (-2) #define HTTRANSPARENT (-1) #define HTNOWHERE 0 #define HTCLIENT 1 #define HTCAPTION 2 #define HTSYSMENU 3 #define HTSIZE 4 #define HTMENU 5 #define HTHSCROLL 6 #define HTVSCROLL 7 #define HTMINBUTTON 8 #define HTMAXBUTTON 9 #define HTLEFT 10 #define HTRIGHT 11 #define HTTOP 12 #define HTTOPLEFT 13 #define HTTOPRIGHT 14 #define HTBOTTOM 15 #define HTBOTTOMLEFT 16 #define HTBOTTOMRIGHT 17 #define HTBORDER 18 #define HTGROWBOX HTSIZE #define HTREDUCE HTMINBUTTON #define HTZOOM HTMAXBUTTON #define HTOBJECT 19 #define HTCLOSE 20 #define HTHELP 21 #define HTSIZEFIRST HTLEFT #define HTSIZELAST HTBOTTOMRIGHT /* WM_SYSCOMMAND parameters */ #ifdef SC_SIZE /* at least HP-UX: already defined in /usr/include/sys/signal.h */ #undef SC_SIZE #endif #define SC_SIZE 0xf000 #define SC_MOVE 0xf010 #define SC_MINIMIZE 0xf020 #define SC_MAXIMIZE 0xf030 #define SC_NEXTWINDOW 0xf040 #define SC_PREVWINDOW 0xf050 #define SC_CLOSE 0xf060 #define SC_VSCROLL 0xf070 #define SC_HSCROLL 0xf080 #define SC_MOUSEMENU 0xf090 #define SC_KEYMENU 0xf100 #define SC_ARRANGE 0xf110 #define SC_RESTORE 0xf120 #define SC_TASKLIST 0xf130 #define SC_SCREENSAVE 0xf140 #define SC_HOTKEY 0xf150 #define CS_VREDRAW 0x0001 #define CS_HREDRAW 0x0002 #define CS_KEYCVTWINDOW 0x0004 #define CS_DBLCLKS 0x0008 #define CS_OWNDC 0x0020 #define CS_CLASSDC 0x0040 #define CS_PARENTDC 0x0080 #define CS_NOKEYCVT 0x0100 #define CS_NOCLOSE 0x0200 #define CS_SAVEBITS 0x0800 #define CS_BYTEALIGNCLIENT 0x1000 #define CS_BYTEALIGNWINDOW 0x2000 #define CS_GLOBALCLASS 0x4000 #define CS_IME 0x00010000 #define PRF_CHECKVISIBLE 0x00000001L #define PRF_NONCLIENT 0x00000002L #define PRF_CLIENT 0x00000004L #define PRF_ERASEBKGND 0x00000008L #define PRF_CHILDREN 0x00000010L #define PRF_OWNED 0x00000020L /* Offsets for GetClassLong() and GetClassWord() */ #define GCL_MENUNAME (-8) #define GCW_HBRBACKGROUND (-10) #define GCL_HBRBACKGROUND GCW_HBRBACKGROUND #define GCW_HCURSOR (-12) #define GCL_HCURSOR GCW_HCURSOR #define GCW_HICON (-14) #define GCL_HICON GCW_HICON #define GCW_HMODULE (-16) #define GCL_HMODULE GCW_HMODULE #define GCW_CBWNDEXTRA (-18) #define GCL_CBWNDEXTRA GCW_CBWNDEXTRA #define GCW_CBCLSEXTRA (-20) #define GCL_CBCLSEXTRA GCW_CBCLSEXTRA #define GCL_WNDPROC (-24) #define GCW_STYLE (-26) #define GCL_STYLE GCW_STYLE #define GCW_ATOM (-32) #define GCW_HICONSM (-34) #define GCL_HICONSM GCW_HICONSM /***** Window hooks *****/ /* Hook values */ #define WH_MIN (-1) #define WH_MSGFILTER (-1) #define WH_JOURNALRECORD 0 #define WH_JOURNALPLAYBACK 1 #define WH_KEYBOARD 2 #define WH_GETMESSAGE 3 #define WH_CALLWNDPROC 4 #define WH_CBT 5 #define WH_SYSMSGFILTER 6 #define WH_MOUSE 7 #define WH_HARDWARE 8 #define WH_DEBUG 9 #define WH_SHELL 10 #define WH_FOREGROUNDIDLE 11 #define WH_CALLWNDPROCRET 12 #define WH_MAX 12 #define WH_MINHOOK WH_MIN #define WH_MAXHOOK WH_MAX #define WH_NB_HOOKS (WH_MAXHOOK-WH_MINHOOK+1) /* Hook action codes */ #define HC_ACTION 0 #define HC_GETNEXT 1 #define HC_SKIP 2 #define HC_NOREMOVE 3 #define HC_NOREM HC_NOREMOVE #define HC_SYSMODALON 4 #define HC_SYSMODALOFF 5 /* CallMsgFilter() values */ #define MSGF_DIALOGBOX 0 #define MSGF_MESSAGEBOX 1 #define MSGF_MENU 2 #define MSGF_MOVE 3 #define MSGF_SIZE 4 #define MSGF_SCROLLBAR 5 #define MSGF_NEXTWINDOW 6 #define MSGF_MAINLOOP 8 #define MSGF_USER 4096 typedef struct { UINT style; WNDPROC lpfnWndProc; INT cbClsExtra; INT cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCSTR lpszMenuName; LPCSTR lpszClassName; } WNDCLASSA, *LPWNDCLASSA; typedef struct { UINT style; WNDPROC lpfnWndProc; INT cbClsExtra; INT cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCWSTR lpszMenuName; LPCWSTR lpszClassName; } WNDCLASSW, *LPWNDCLASSW; DECL_WINELIB_TYPE_AW(WNDCLASS) DECL_WINELIB_TYPE_AW(LPWNDCLASS) typedef struct { DWORD dwData; DWORD cbData; LPVOID lpData; } COPYDATASTRUCT, *PCOPYDATASTRUCT, *LPCOPYDATASTRUCT; typedef struct { HMENU hmenuIn; HMENU hmenuNext; HWND hwndNext; } MDINEXTMENU, *PMDINEXTMENU, *LPMDINEXTMENU; /* WinHelp internal structure */ typedef struct { WORD size; WORD command; LONG data; LONG reserved; WORD ofsFilename; WORD ofsData; } WINHELP,*LPWINHELP; typedef struct { UINT16 mkSize; BYTE mkKeyList; BYTE szKeyphrase[1]; } MULTIKEYHELP, *LPMULTIKEYHELP; typedef struct { WORD wStructSize; WORD x; WORD y; WORD dx; WORD dy; WORD wMax; char rgchMember[2]; } HELPWININFO, *LPHELPWININFO; #define HELP_CONTEXT 0x0001 #define HELP_QUIT 0x0002 #define HELP_INDEX 0x0003 #define HELP_CONTENTS 0x0003 #define HELP_HELPONHELP 0x0004 #define HELP_SETINDEX 0x0005 #define HELP_SETCONTENTS 0x0005 #define HELP_CONTEXTPOPUP 0x0008 #define HELP_FORCEFILE 0x0009 #define HELP_KEY 0x0101 #define HELP_COMMAND 0x0102 #define HELP_PARTIALKEY 0x0105 #define HELP_MULTIKEY 0x0201 #define HELP_SETWINPOS 0x0203 #define HELP_CONTEXTMENU 0x000a #define HELP_FINDER 0x000b #define HELP_WM_HELP 0x000c #define HELP_SETPOPUP_POS 0x000d #define HELP_TCARD 0x8000 #define HELP_TCARD_DATA 0x0010 #define HELP_TCARD_OTHER_CALLER 0x0011 /* ChangeDisplaySettings return codes */ #define DISP_CHANGE_SUCCESSFUL 0 #define DISP_CHANGE_RESTART 1 #define DISP_CHANGE_FAILED (-1) #define DISP_CHANGE_BADMODE (-2) #define DISP_CHANGE_NOTUPDATED (-3) #define DISP_CHANGE_BADFLAGS (-4) #define DISP_CHANGE_BADPARAM (-5) /* ChangeDisplaySettings.dwFlags */ #define CDS_UPDATEREGISTRY 0x00000001 #define CDS_TEST 0x00000002 #define CDS_FULLSCREEN 0x00000004 #define CDS_GLOBAL 0x00000008 #define CDS_SET_PRIMARY 0x00000010 #define CDS_RESET 0x40000000 #define CDS_SETRECT 0x20000000 #define CDS_NORESET 0x10000000 /* flags to FormatMessage */ #define FORMAT_MESSAGE_ALLOCATE_BUFFER 0x00000100 #define FORMAT_MESSAGE_IGNORE_INSERTS 0x00000200 #define FORMAT_MESSAGE_FROM_STRING 0x00000400 #define FORMAT_MESSAGE_FROM_HMODULE 0x00000800 #define FORMAT_MESSAGE_FROM_SYSTEM 0x00001000 #define FORMAT_MESSAGE_ARGUMENT_ARRAY 0x00002000 #define FORMAT_MESSAGE_MAX_WIDTH_MASK 0x000000FF typedef struct { UINT cbSize; UINT style; WNDPROC lpfnWndProc; INT cbClsExtra; INT cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCSTR lpszMenuName; LPCSTR lpszClassName; HICON hIconSm; } WNDCLASSEXA, *LPWNDCLASSEXA; typedef struct { UINT cbSize; UINT style; WNDPROC lpfnWndProc; INT cbClsExtra; INT cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCWSTR lpszMenuName; LPCWSTR lpszClassName; HICON hIconSm; } WNDCLASSEXW, *LPWNDCLASSEXW; DECL_WINELIB_TYPE_AW(WNDCLASSEX) DECL_WINELIB_TYPE_AW(LPWNDCLASSEX) typedef struct tagMSG { HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; DWORD time; POINT pt; } MSG, *LPMSG; #define POINTSTOPOINT(pt, pts) \ { (pt).x = (LONG)(SHORT)LOWORD(*(LONG*)&pts); \ (pt).y = (LONG)(SHORT)HIWORD(*(LONG*)&pts); } #define POINTTOPOINTS(pt) (MAKELONG((short)((pt).x), (short)((pt).y))) /* Cursors / Icons */ typedef struct { WIN_BOOL fIcon; DWORD xHotspot; DWORD yHotspot; HBITMAP hbmMask; HBITMAP hbmColor; } ICONINFO,*LPICONINFO; /* this is the 6 byte accel struct used in Win32 when presented to the user */ typedef struct { BYTE fVirt; BYTE pad0; WORD key; WORD cmd; } ACCEL, *LPACCEL; /* this is the 8 byte accel struct used in Win32 resources (internal only) */ typedef struct { BYTE fVirt; BYTE pad0; WORD key; WORD cmd; WORD pad1; } PE_ACCEL, *LPPE_ACCEL; /* Flags for TrackPopupMenu */ #define TPM_LEFTBUTTON 0x0000 #define TPM_RIGHTBUTTON 0x0002 #define TPM_LEFTALIGN 0x0000 #define TPM_CENTERALIGN 0x0004 #define TPM_RIGHTALIGN 0x0008 #define TPM_TOPALIGN 0x0000 #define TPM_VCENTERALIGN 0x0010 #define TPM_BOTTOMALIGN 0x0020 #define TPM_HORIZONTAL 0x0000 #define TPM_VERTICAL 0x0040 #define TPM_NONOTIFY 0x0080 #define TPM_RETURNCMD 0x0100 typedef struct { UINT cbSize; RECT rcExclude; } TPMPARAMS, *LPTPMPARAMS; /* FIXME: not sure this one is correct */ typedef struct { UINT cbSize; UINT fMask; UINT fType; UINT fState; UINT wID; HMENU hSubMenu; HBITMAP hbmpChecked; HBITMAP hbmpUnchecked; DWORD dwItemData; LPSTR dwTypeData; UINT cch; HBITMAP hbmpItem; } MENUITEMINFOA, *LPMENUITEMINFOA; typedef struct { UINT cbSize; UINT fMask; UINT fType; UINT fState; UINT wID; HMENU hSubMenu; HBITMAP hbmpChecked; HBITMAP hbmpUnchecked; DWORD dwItemData; LPWSTR dwTypeData; UINT cch; HBITMAP hbmpItem; } MENUITEMINFOW, *LPMENUITEMINFOW; DECL_WINELIB_TYPE_AW(MENUITEMINFO) DECL_WINELIB_TYPE_AW(LPMENUITEMINFO) typedef struct { DWORD cbSize; DWORD fMask; DWORD dwStyle; UINT cyMax; HBRUSH hbrBack; DWORD dwContextHelpID; DWORD dwMenuData; } MENUINFO, *LPMENUINFO; typedef MENUINFO const * LPCMENUINFO; #define MIM_MAXHEIGHT 0x00000001 #define MIM_BACKGROUND 0x00000002 #define MIM_HELPID 0x00000004 #define MIM_MENUDATA 0x00000008 #define MIM_STYLE 0x00000010 #define MIM_APPLYTOSUBMENUS 0x80000000 typedef struct { WORD versionNumber; WORD offset; } MENUITEMTEMPLATEHEADER, *PMENUITEMTEMPLATEHEADER; typedef struct { WORD mtOption; WORD mtID; WCHAR mtString[1]; } MENUITEMTEMPLATE, *PMENUITEMTEMPLATE; typedef VOID MENUTEMPLATE; typedef PVOID *LPMENUTEMPLATE; /* Field specifiers for MENUITEMINFO[AW] type. */ #define MIIM_STATE 0x00000001 #define MIIM_ID 0x00000002 #define MIIM_SUBMENU 0x00000004 #define MIIM_CHECKMARKS 0x00000008 #define MIIM_TYPE 0x00000010 #define MIIM_DATA 0x00000020 #define MIIM_STRING 0x00000040 #define MIIM_BITMAP 0x00000080 #define MIIM_FTYPE 0x00000100 #define HBMMENU_CALLBACK ((HBITMAP) -1) #define HBMMENU_SYSTEM ((HBITMAP) 1) #define HBMMENU_MBAR_RESTORE ((HBITMAP) 2) #define HBMMENU_MBAR_MINIMIZE ((HBITMAP) 3) #define HBMMENU_MBAR_CLOSE ((HBITMAP) 5) #define HBMMENU_MBAR_CLOSE_D ((HBITMAP) 6) #define HBMMENU_MBAR_MINIMIZE_D ((HBITMAP) 7) #define HBMMENU_POPUP_CLOSE ((HBITMAP) 8) #define HBMMENU_POPUP_RESTORE ((HBITMAP) 9) #define HBMMENU_POPUP_MAXIMIZE ((HBITMAP) 10) #define HBMMENU_POPUP_MINIMIZE ((HBITMAP) 11) /* DrawState defines ... */ typedef WIN_BOOL CALLBACK (*DRAWSTATEPROC)(HDC,LPARAM,WPARAM,INT,INT); /* WM_H/VSCROLL commands */ #define SB_LINEUP 0 #define SB_LINELEFT 0 #define SB_LINEDOWN 1 #define SB_LINERIGHT 1 #define SB_PAGEUP 2 #define SB_PAGELEFT 2 #define SB_PAGEDOWN 3 #define SB_PAGERIGHT 3 #define SB_THUMBPOSITION 4 #define SB_THUMBTRACK 5 #define SB_TOP 6 #define SB_LEFT 6 #define SB_BOTTOM 7 #define SB_RIGHT 7 #define SB_ENDSCROLL 8 /* Scroll bar selection constants */ #define SB_HORZ 0 #define SB_VERT 1 #define SB_CTL 2 #define SB_BOTH 3 /* Scrollbar styles */ #define SBS_HORZ 0x0000L #define SBS_VERT 0x0001L #define SBS_TOPALIGN 0x0002L #define SBS_LEFTALIGN 0x0002L #define SBS_BOTTOMALIGN 0x0004L #define SBS_RIGHTALIGN 0x0004L #define SBS_SIZEBOXTOPLEFTALIGN 0x0002L #define SBS_SIZEBOXBOTTOMRIGHTALIGN 0x0004L #define SBS_SIZEBOX 0x0008L #define SBS_SIZEGRIP 0x0010L /* EnableScrollBar() flags */ #define ESB_ENABLE_BOTH 0x0000 #define ESB_DISABLE_BOTH 0x0003 #define ESB_DISABLE_LEFT 0x0001 #define ESB_DISABLE_RIGHT 0x0002 #define ESB_DISABLE_UP 0x0001 #define ESB_DISABLE_DOWN 0x0002 #define ESB_DISABLE_LTUP ESB_DISABLE_LEFT #define ESB_DISABLE_RTDN ESB_DISABLE_RIGHT /* Win32 button control messages */ #define BM_GETCHECK 0x00f0 #define BM_SETCHECK 0x00f1 #define BM_GETSTATE 0x00f2 #define BM_SETSTATE 0x00f3 #define BM_SETSTYLE 0x00f4 #define BM_CLICK 0x00f5 #define BM_GETIMAGE 0x00f6 #define BM_SETIMAGE 0x00f7 /* Winelib button control messages */ /* Button notification codes */ #define BN_CLICKED 0 #define BN_PAINT 1 #define BN_HILITE 2 #define BN_UNHILITE 3 #define BN_DISABLE 4 #define BN_DOUBLECLICKED 5 /* Button states */ #define BST_UNCHECKED 0x0000 #define BST_CHECKED 0x0001 #define BST_INDETERMINATE 0x0002 #define BST_PUSHED 0x0004 #define BST_FOCUS 0x0008 /* Static Control Styles */ #define SS_LEFT 0x00000000L #define SS_CENTER 0x00000001L #define SS_RIGHT 0x00000002L #define SS_ICON 0x00000003L #define SS_BLACKRECT 0x00000004L #define SS_GRAYRECT 0x00000005L #define SS_WHITERECT 0x00000006L #define SS_BLACKFRAME 0x00000007L #define SS_GRAYFRAME 0x00000008L #define SS_WHITEFRAME 0x00000009L #define SS_SIMPLE 0x0000000BL #define SS_LEFTNOWORDWRAP 0x0000000CL #define SS_OWNERDRAW 0x0000000DL #define SS_BITMAP 0x0000000EL #define SS_ENHMETAFILE 0x0000000FL #define SS_ETCHEDHORZ 0x00000010L #define SS_ETCHEDVERT 0x00000011L #define SS_ETCHEDFRAME 0x00000012L #define SS_TYPEMASK 0x0000001FL #define SS_NOPREFIX 0x00000080L #define SS_NOTIFY 0x00000100L #define SS_CENTERIMAGE 0x00000200L #define SS_RIGHTJUST 0x00000400L #define SS_REALSIZEIMAGE 0x00000800L #define SS_SUNKEN 0x00001000L /* Static Control Messages */ #define STM_SETICON 0x0170 #define STM_GETICON 0x0171 #define STM_SETIMAGE 0x0172 #define STM_GETIMAGE 0x0173 /* Scrollbar messages */ #define SBM_SETPOS 0x00e0 #define SBM_GETPOS 0x00e1 #define SBM_SETRANGE 0x00e2 #define SBM_GETRANGE 0x00e3 #define SBM_ENABLE_ARROWS 0x00e4 #define SBM_SETRANGEREDRAW 0x00e6 #define SBM_SETSCROLLINFO 0x00e9 #define SBM_GETSCROLLINFO 0x00ea /* Scrollbar info */ typedef struct { UINT cbSize; UINT fMask; INT nMin; INT nMax; UINT nPage; INT nPos; INT nTrackPos; } SCROLLINFO, *LPSCROLLINFO; /* GetScrollInfo() flags */ #define SIF_RANGE 0x0001 #define SIF_PAGE 0x0002 #define SIF_POS 0x0004 #define SIF_DISABLENOSCROLL 0x0008 #define SIF_TRACKPOS 0x0010 #define SIF_ALL (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS) /* Listbox styles */ #define LBS_NOTIFY 0x0001 #define LBS_SORT 0x0002 #define LBS_NOREDRAW 0x0004 #define LBS_MULTIPLESEL 0x0008 #define LBS_OWNERDRAWFIXED 0x0010 #define LBS_OWNERDRAWVARIABLE 0x0020 #define LBS_HASSTRINGS 0x0040 #define LBS_USETABSTOPS 0x0080 #define LBS_NOINTEGRALHEIGHT 0x0100 #define LBS_MULTICOLUMN 0x0200 #define LBS_WANTKEYBOARDINPUT 0x0400 #define LBS_EXTENDEDSEL 0x0800 #define LBS_DISABLENOSCROLL 0x1000 #define LBS_NODATA 0x2000 #define LBS_NOSEL 0x4000 #define LBS_STANDARD (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER) /* Listbox messages */ #define LB_ADDSTRING 0x0180 #define LB_INSERTSTRING 0x0181 #define LB_DELETESTRING 0x0182 #define LB_SELITEMRANGEEX 0x0183 #define LB_RESETCONTENT 0x0184 #define LB_SETSEL 0x0185 #define LB_SETCURSEL 0x0186 #define LB_GETSEL 0x0187 #define LB_GETCURSEL 0x0188 #define LB_GETTEXT 0x0189 #define LB_GETTEXTLEN 0x018a #define LB_GETCOUNT 0x018b #define LB_SELECTSTRING 0x018c #define LB_DIR 0x018d #define LB_GETTOPINDEX 0x018e #define LB_FINDSTRING 0x018f #define LB_GETSELCOUNT 0x0190 #define LB_GETSELITEMS 0x0191 #define LB_SETTABSTOPS 0x0192 #define LB_GETHORIZONTALEXTENT 0x0193 #define LB_SETHORIZONTALEXTENT 0x0194 #define LB_SETCOLUMNWIDTH 0x0195 #define LB_ADDFILE 0x0196 #define LB_SETTOPINDEX 0x0197 #define LB_GETITEMRECT 0x0198 #define LB_GETITEMDATA 0x0199 #define LB_SETITEMDATA 0x019a #define LB_SELITEMRANGE 0x019b #define LB_SETANCHORINDEX 0x019c #define LB_GETANCHORINDEX 0x019d #define LB_SETCARETINDEX 0x019e #define LB_GETCARETINDEX 0x019f #define LB_SETITEMHEIGHT 0x01a0 #define LB_GETITEMHEIGHT 0x01a1 #define LB_FINDSTRINGEXACT 0x01a2 #define LB_CARETON 0x01a3 #define LB_CARETOFF 0x01a4 #define LB_SETLOCALE 0x01a5 #define LB_GETLOCALE 0x01a6 #define LB_SETCOUNT 0x01a7 #define LB_INITSTORAGE 0x01a8 #define LB_ITEMFROMPOINT 0x01a9 /* Listbox notification codes */ #define LBN_ERRSPACE (-2) #define LBN_SELCHANGE 1 #define LBN_DBLCLK 2 #define LBN_SELCANCEL 3 #define LBN_SETFOCUS 4 #define LBN_KILLFOCUS 5 /* Listbox message return values */ #define LB_OKAY 0 #define LB_ERR (-1) #define LB_ERRSPACE (-2) #define LB_CTLCODE 0L /* Combo box styles */ #define CBS_SIMPLE 0x0001L #define CBS_DROPDOWN 0x0002L #define CBS_DROPDOWNLIST 0x0003L #define CBS_OWNERDRAWFIXED 0x0010L #define CBS_OWNERDRAWVARIABLE 0x0020L #define CBS_AUTOHSCROLL 0x0040L #define CBS_OEMCONVERT 0x0080L #define CBS_SORT 0x0100L #define CBS_HASSTRINGS 0x0200L #define CBS_NOINTEGRALHEIGHT 0x0400L #define CBS_DISABLENOSCROLL 0x0800L #define CBS_UPPERCASE 0x2000L #define CBS_LOWERCASE 0x4000L /* Combo box messages */ #define CB_GETEDITSEL 0x0140 #define CB_LIMITTEXT 0x0141 #define CB_SETEDITSEL 0x0142 #define CB_ADDSTRING 0x0143 #define CB_DELETESTRING 0x0144 #define CB_DIR 0x0145 #define CB_GETCOUNT 0x0146 #define CB_GETCURSEL 0x0147 #define CB_GETLBTEXT 0x0148 #define CB_GETLBTEXTLEN 0x0149 #define CB_INSERTSTRING 0x014a #define CB_RESETCONTENT 0x014b #define CB_FINDSTRING 0x014c #define CB_SELECTSTRING 0x014d #define CB_SETCURSEL 0x014e #define CB_SHOWDROPDOWN 0x014f #define CB_GETITEMDATA 0x0150 #define CB_SETITEMDATA 0x0151 #define CB_GETDROPPEDCONTROLRECT 0x0152 #define CB_SETITEMHEIGHT 0x0153 #define CB_GETITEMHEIGHT 0x0154 #define CB_SETEXTENDEDUI 0x0155 #define CB_GETEXTENDEDUI 0x0156 #define CB_GETDROPPEDSTATE 0x0157 #define CB_FINDSTRINGEXACT 0x0158 #define CB_SETLOCALE 0x0159 #define CB_GETLOCALE 0x015a #define CB_GETTOPINDEX 0x015b #define CB_SETTOPINDEX 0x015c #define CB_GETHORIZONTALEXTENT 0x015d #define CB_SETHORIZONTALEXTENT 0x015e #define CB_GETDROPPEDWIDTH 0x015f #define CB_SETDROPPEDWIDTH 0x0160 #define CB_INITSTORAGE 0x0161 /* Combo box notification codes */ #define CBN_ERRSPACE (-1) #define CBN_SELCHANGE 1 #define CBN_DBLCLK 2 #define CBN_SETFOCUS 3 #define CBN_KILLFOCUS 4 #define CBN_EDITCHANGE 5 #define CBN_EDITUPDATE 6 #define CBN_DROPDOWN 7 #define CBN_CLOSEUP 8 #define CBN_SELENDOK 9 #define CBN_SELENDCANCEL 10 /* Combo box message return values */ #define CB_OKAY 0 #define CB_ERR (-1) #define CB_ERRSPACE (-2) #define MB_OK 0x00000000 #define MB_OKCANCEL 0x00000001 #define MB_ABORTRETRYIGNORE 0x00000002 #define MB_YESNOCANCEL 0x00000003 #define MB_YESNO 0x00000004 #define MB_RETRYCANCEL 0x00000005 #define MB_TYPEMASK 0x0000000F #define MB_ICONHAND 0x00000010 #define MB_ICONQUESTION 0x00000020 #define MB_ICONEXCLAMATION 0x00000030 #define MB_ICONASTERISK 0x00000040 #define MB_USERICON 0x00000080 #define MB_ICONMASK 0x000000F0 #define MB_ICONINFORMATION MB_ICONASTERISK #define MB_ICONSTOP MB_ICONHAND #define MB_ICONWARNING MB_ICONEXCLAMATION #define MB_ICONERROR MB_ICONHAND #define MB_DEFBUTTON1 0x00000000 #define MB_DEFBUTTON2 0x00000100 #define MB_DEFBUTTON3 0x00000200 #define MB_DEFBUTTON4 0x00000300 #define MB_DEFMASK 0x00000F00 #define MB_APPLMODAL 0x00000000 #define MB_SYSTEMMODAL 0x00001000 #define MB_TASKMODAL 0x00002000 #define MB_MODEMASK 0x00003000 #define MB_HELP 0x00004000 #define MB_NOFOCUS 0x00008000 #define MB_MISCMASK 0x0000C000 #define MB_SETFOREGROUND 0x00010000 #define MB_DEFAULT_DESKTOP_ONLY 0x00020000 #define MB_SERVICE_NOTIFICATION 0x00040000 #define MB_TOPMOST 0x00040000 #define MB_RIGHT 0x00080000 #define MB_RTLREADING 0x00100000 #define HELPINFO_WINDOW 0x0001 #define HELPINFO_MENUITEM 0x0002 /* Structure pointed to by lParam of WM_HELP */ typedef struct { UINT cbSize; /* Size in bytes of this struct */ INT iContextType; /* Either HELPINFO_WINDOW or HELPINFO_MENUITEM */ INT iCtrlId; /* Control Id or a Menu item Id. */ HANDLE hItemHandle; /* hWnd of control or hMenu. */ DWORD dwContextId; /* Context Id associated with this item */ POINT MousePos; /* Mouse Position in screen co-ordinates */ } HELPINFO,*LPHELPINFO; typedef void CALLBACK (*MSGBOXCALLBACK)(LPHELPINFO lpHelpInfo); typedef struct { UINT cbSize; HWND hwndOwner; HINSTANCE hInstance; LPCSTR lpszText; LPCSTR lpszCaption; DWORD dwStyle; LPCSTR lpszIcon; DWORD dwContextHelpId; MSGBOXCALLBACK lpfnMsgBoxCallback; DWORD dwLanguageId; } MSGBOXPARAMSA,*LPMSGBOXPARAMSA; typedef struct { UINT cbSize; HWND hwndOwner; HINSTANCE hInstance; LPCWSTR lpszText; LPCWSTR lpszCaption; DWORD dwStyle; LPCWSTR lpszIcon; DWORD dwContextHelpId; MSGBOXCALLBACK lpfnMsgBoxCallback; DWORD dwLanguageId; } MSGBOXPARAMSW,*LPMSGBOXPARAMSW; DECL_WINELIB_TYPE_AW(MSGBOXPARAMS) DECL_WINELIB_TYPE_AW(LPMSGBOXPARAMS) typedef struct _numberfmt32a { UINT NumDigits; UINT LeadingZero; UINT Grouping; LPCSTR lpDecimalSep; LPCSTR lpThousandSep; UINT NegativeOrder; } NUMBERFMTA; typedef struct _numberfmt32w { UINT NumDigits; UINT LeadingZero; UINT Grouping; LPCWSTR lpDecimalSep; LPCWSTR lpThousandSep; UINT NegativeOrder; } NUMBERFMTW; typedef struct _currencyfmt32a { UINT NumDigits; UINT LeadingZero; UINT Grouping; LPCSTR lpDecimalSep; LPCSTR lpThousandSep; UINT NegativeOrder; UINT PositiveOrder; LPCSTR lpCurrencySymbol; } CURRENCYFMTA; typedef struct _currencyfmt32w { UINT NumDigits; UINT LeadingZero; UINT Grouping; LPCWSTR lpDecimalSep; LPCWSTR lpThousandSep; UINT NegativeOrder; UINT PositiveOrder; LPCWSTR lpCurrencySymbol; } CURRENCYFMTW; #define MONITOR_DEFAULTTONULL 0x00000000 #define MONITOR_DEFAULTTOPRIMARY 0x00000001 #define MONITOR_DEFAULTTONEAREST 0x00000002 #define MONITORINFOF_PRIMARY 0x00000001 typedef struct tagMONITORINFO { DWORD cbSize; RECT rcMonitor; RECT rcWork; DWORD dwFlags; } MONITORINFO, *LPMONITORINFO; typedef WIN_BOOL CALLBACK (*MONITORENUMPROC)(HMONITOR,HDC,LPRECT,LPARAM); /* FIXME: use this instead of LPCVOID for CreateDialogIndirectParam and DialogBoxIndirectParam */ typedef struct tagDLGTEMPLATE { DWORD style; DWORD dwExtendedStyle; WORD cdit; short x; short y; short cx; short cy; } DLGTEMPLATE; typedef DLGTEMPLATE *LPDLGTEMPLATEA; typedef DLGTEMPLATE *LPDLGTEMPLATEW; #define LPDLGTEMPLATE WINELIB_NAME_AW(LPDLGTEMPLATE) typedef const DLGTEMPLATE *LPCDLGTEMPLATEA; typedef const DLGTEMPLATE *LPCDLGTEMPLATEW; #define LPCDLGTEMPLATE WINELIB_NAME_AW(LPCDLGTEMPLATE) typedef struct tagDLGITEMTEMPLATE { DWORD style; DWORD dwExtendedStyle; short x; short y; short cx; short cy; WORD id; } DLGITEMTEMPLATE; typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATEA; typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATEW; #define LPDLGITEMTEMPLATE WINELIB_NAME_AW(LPDLGITEMTEMPLATE) typedef const DLGITEMTEMPLATE *LPCDLGITEMTEMPLATEA; typedef const DLGITEMTEMPLATE *LPCDLGITEMTEMPLATEW; #define LPCDLGITEMTEMPLATE WINELIB_NAME_AW(LPCDLGITEMTEMPLATE) /* CBT hook values */ #define HCBT_MOVESIZE 0 #define HCBT_MINMAX 1 #define HCBT_QS 2 #define HCBT_CREATEWND 3 #define HCBT_DESTROYWND 4 #define HCBT_ACTIVATE 5 #define HCBT_CLICKSKIPPED 6 #define HCBT_KEYSKIPPED 7 #define HCBT_SYSCOMMAND 8 #define HCBT_SETFOCUS 9 /* CBT hook structures */ typedef struct { CREATESTRUCTA *lpcs; HWND hwndInsertAfter; } CBT_CREATEWNDA, *LPCBT_CREATEWNDA; typedef struct { CREATESTRUCTW *lpcs; HWND hwndInsertAfter; } CBT_CREATEWNDW, *LPCBT_CREATEWNDW; DECL_WINELIB_TYPE_AW(CBT_CREATEWND) DECL_WINELIB_TYPE_AW(LPCBT_CREATEWND) typedef struct { WIN_BOOL fMouse; HWND hWndActive; } CBTACTIVATESTRUCT, *LPCBTACTIVATESTRUCT; /* modifiers for RegisterHotKey */ #define MOD_ALT 0x0001 #define MOD_CONTROL 0x0002 #define MOD_SHIFT 0x0004 #define MOD_WIN 0x0008 /* ids for RegisterHotKey */ #define IDHOT_SNAPWINDOW (-1) /* SHIFT-PRINTSCRN */ #define IDHOT_SNAPDESKTOP (-2) /* PRINTSCRN */ /* keybd_event flags */ #define KEYEVENTF_EXTENDEDKEY 0x0001 #define KEYEVENTF_KEYUP 0x0002 #define KEYEVENTF_WINE_FORCEEXTENDED 0x8000 /* mouse_event flags */ #define MOUSEEVENTF_MOVE 0x0001 #define MOUSEEVENTF_LEFTDOWN 0x0002 #define MOUSEEVENTF_LEFTUP 0x0004 #define MOUSEEVENTF_RIGHTDOWN 0x0008 #define MOUSEEVENTF_RIGHTUP 0x0010 #define MOUSEEVENTF_MIDDLEDOWN 0x0020 #define MOUSEEVENTF_MIDDLEUP 0x0040 #define MOUSEEVENTF_WHEEL 0x0800 #define MOUSEEVENTF_ABSOLUTE 0x8000 /* ExitWindows() flags */ #define EW_RESTARTWINDOWS 0x0042 #define EW_REBOOTSYSTEM 0x0043 #define EW_EXITANDEXECAPP 0x0044 /* ExitWindowsEx() flags */ #define EWX_LOGOFF 0 #define EWX_SHUTDOWN 1 #define EWX_REBOOT 2 #define EWX_FORCE 4 #define EWX_POWEROFF 8 /* SetLastErrorEx types */ #define SLE_ERROR 0x00000001 #define SLE_MINORERROR 0x00000002 #define SLE_WARNING 0x00000003 /* Predefined resources */ #define IDI_APPLICATIONA MAKEINTRESOURCEA(32512) #define IDI_APPLICATIONW MAKEINTRESOURCEW(32512) #define IDI_APPLICATION WINELIB_NAME_AW(IDI_APPLICATION) #define IDI_HANDA MAKEINTRESOURCEA(32513) #define IDI_HANDW MAKEINTRESOURCEW(32513) #define IDI_HAND WINELIB_NAME_AW(IDI_HAND) #define IDI_QUESTIONA MAKEINTRESOURCEA(32514) #define IDI_QUESTIONW MAKEINTRESOURCEW(32514) #define IDI_QUESTION WINELIB_NAME_AW(IDI_QUESTION) #define IDI_EXCLAMATIONA MAKEINTRESOURCEA(32515) #define IDI_EXCLAMATIONW MAKEINTRESOURCEW(32515) #define IDI_EXCLAMATION WINELIB_NAME_AW(IDI_EXCLAMATION) #define IDI_ASTERISKA MAKEINTRESOURCEA(32516) #define IDI_ASTERISKW MAKEINTRESOURCEW(32516) #define IDI_ASTERISK WINELIB_NAME_AW(IDI_ASTERISK) #define IDC_BUMMERA MAKEINTRESOURCEA(100) #define IDC_BUMMERW MAKEINTRESOURCEW(100) #define IDC_BUMMER WINELIB_NAME_AW(IDC_BUMMER) #define IDC_ARROWA MAKEINTRESOURCEA(32512) #define IDC_ARROWW MAKEINTRESOURCEW(32512) #define IDC_ARROW WINELIB_NAME_AW(IDC_ARROW) #define IDC_IBEAMA MAKEINTRESOURCEA(32513) #define IDC_IBEAMW MAKEINTRESOURCEW(32513) #define IDC_IBEAM WINELIB_NAME_AW(IDC_IBEAM) #define IDC_WAITA MAKEINTRESOURCEA(32514) #define IDC_WAITW MAKEINTRESOURCEW(32514) #define IDC_WAIT WINELIB_NAME_AW(IDC_WAIT) #define IDC_CROSSA MAKEINTRESOURCEA(32515) #define IDC_CROSSW MAKEINTRESOURCEW(32515) #define IDC_CROSS WINELIB_NAME_AW(IDC_CROSS) #define IDC_UPARROWA MAKEINTRESOURCEA(32516) #define IDC_UPARROWW MAKEINTRESOURCEW(32516) #define IDC_UPARROW WINELIB_NAME_AW(IDC_UPARROW) #define IDC_SIZEA MAKEINTRESOURCEA(32640) #define IDC_SIZEW MAKEINTRESOURCEW(32640) #define IDC_SIZE WINELIB_NAME_AW(IDC_SIZE) #define IDC_ICONA MAKEINTRESOURCEA(32641) #define IDC_ICONW MAKEINTRESOURCEW(32641) #define IDC_ICON WINELIB_NAME_AW(IDC_ICON) #define IDC_SIZENWSEA MAKEINTRESOURCEA(32642) #define IDC_SIZENWSEW MAKEINTRESOURCEW(32642) #define IDC_SIZENWSE WINELIB_NAME_AW(IDC_SIZENWSE) #define IDC_SIZENESWA MAKEINTRESOURCEA(32643) #define IDC_SIZENESWW MAKEINTRESOURCEW(32643) #define IDC_SIZENESW WINELIB_NAME_AW(IDC_SIZENESW) #define IDC_SIZEWEA MAKEINTRESOURCEA(32644) #define IDC_SIZEWEW MAKEINTRESOURCEW(32644) #define IDC_SIZEWE WINELIB_NAME_AW(IDC_SIZEWE) #define IDC_SIZENSA MAKEINTRESOURCEA(32645) #define IDC_SIZENSW MAKEINTRESOURCEW(32645) #define IDC_SIZENS WINELIB_NAME_AW(IDC_SIZENS) #define IDC_SIZEALLA MAKEINTRESOURCEA(32646) #define IDC_SIZEALLW MAKEINTRESOURCEW(32646) #define IDC_SIZEALL WINELIB_NAME_AW(IDC_SIZEALL) #define IDC_NOA MAKEINTRESOURCEA(32648) #define IDC_NOW MAKEINTRESOURCEW(32648) #define IDC_NO WINELIB_NAME_AW(IDC_NO) #define IDC_APPSTARTINGA MAKEINTRESOURCEA(32650) #define IDC_APPSTARTINGW MAKEINTRESOURCEW(32650) #define IDC_APPSTARTING WINELIB_NAME_AW(IDC_APPSTARTING) #define IDC_HELPA MAKEINTRESOURCEA(32651) #define IDC_HELPW MAKEINTRESOURCEW(32651) #define IDC_HELP WINELIB_NAME_AW(IDC_HELP) #define MNC_IGNORE 0 #define MNC_CLOSE 1 #define MNC_EXECUTE 2 #define MNC_SELECT 3 /* SystemParametersInfo */ /* defines below are for all win versions */ #define SPI_GETBEEP 1 #define SPI_SETBEEP 2 #define SPI_GETMOUSE 3 #define SPI_SETMOUSE 4 #define SPI_GETBORDER 5 #define SPI_SETBORDER 6 #define SPI_GETKEYBOARDSPEED 10 #define SPI_SETKEYBOARDSPEED 11 #define SPI_LANGDRIVER 12 #define SPI_ICONHORIZONTALSPACING 13 #define SPI_GETSCREENSAVETIMEOUT 14 #define SPI_SETSCREENSAVETIMEOUT 15 #define SPI_GETSCREENSAVEACTIVE 16 #define SPI_SETSCREENSAVEACTIVE 17 #define SPI_GETGRIDGRANULARITY 18 #define SPI_SETGRIDGRANULARITY 19 #define SPI_SETDESKWALLPAPER 20 #define SPI_SETDESKPATTERN 21 #define SPI_GETKEYBOARDDELAY 22 #define SPI_SETKEYBOARDDELAY 23 #define SPI_ICONVERTICALSPACING 24 #define SPI_GETICONTITLEWRAP 25 #define SPI_SETICONTITLEWRAP 26 #define SPI_GETMENUDROPALIGNMENT 27 #define SPI_SETMENUDROPALIGNMENT 28 #define SPI_SETDOUBLECLKWIDTH 29 #define SPI_SETDOUBLECLKHEIGHT 30 #define SPI_GETICONTITLELOGFONT 31 #define SPI_SETDOUBLECLICKTIME 32 #define SPI_SETMOUSEBUTTONSWAP 33 #define SPI_SETICONTITLELOGFONT 34 #define SPI_GETFASTTASKSWITCH 35 #define SPI_SETFASTTASKSWITCH 36 #define SPI_SETDRAGFULLWINDOWS 37 #define SPI_GETDRAGFULLWINDOWS 38 #define SPI_GETFILTERKEYS 50 #define SPI_SETFILTERKEYS 51 #define SPI_GETTOGGLEKEYS 52 #define SPI_SETTOGGLEKEYS 53 #define SPI_GETMOUSEKEYS 54 #define SPI_SETMOUSEKEYS 55 #define SPI_GETSHOWSOUNDS 56 #define SPI_SETSHOWSOUNDS 57 #define SPI_GETSTICKYKEYS 58 #define SPI_SETSTICKYKEYS 59 #define SPI_GETACCESSTIMEOUT 60 #define SPI_SETACCESSTIMEOUT 61 #define SPI_GETSOUNDSENTRY 64 #define SPI_SETSOUNDSENTRY 65 /* defines below are for all win versions WINVER >= 0x0400 */ #define SPI_SETDRAGFULLWINDOWS 37 #define SPI_GETDRAGFULLWINDOWS 38 #define SPI_GETNONCLIENTMETRICS 41 #define SPI_SETNONCLIENTMETRICS 42 #define SPI_GETMINIMIZEDMETRICS 43 #define SPI_SETMINIMIZEDMETRICS 44 #define SPI_GETICONMETRICS 45 #define SPI_SETICONMETRICS 46 #define SPI_SETWORKAREA 47 #define SPI_GETWORKAREA 48 #define SPI_SETPENWINDOWS 49 #define SPI_GETSERIALKEYS 62 #define SPI_SETSERIALKEYS 63 #define SPI_GETHIGHCONTRAST 66 #define SPI_SETHIGHCONTRAST 67 #define SPI_GETKEYBOARDPREF 68 #define SPI_SETKEYBOARDPREF 69 #define SPI_GETSCREENREADER 70 #define SPI_SETSCREENREADER 71 #define SPI_GETANIMATION 72 #define SPI_SETANIMATION 73 #define SPI_GETFONTSMOOTHING 74 #define SPI_SETFONTSMOOTHING 75 #define SPI_SETDRAGWIDTH 76 #define SPI_SETDRAGHEIGHT 77 #define SPI_SETHANDHELD 78 #define SPI_GETLOWPOWERTIMEOUT 79 #define SPI_GETPOWEROFFTIMEOUT 80 #define SPI_SETLOWPOWERTIMEOUT 81 #define SPI_SETPOWEROFFTIMEOUT 82 #define SPI_GETLOWPOWERACTIVE 83 #define SPI_GETPOWEROFFACTIVE 84 #define SPI_SETLOWPOWERACTIVE 85 #define SPI_SETPOWEROFFACTIVE 86 #define SPI_SETCURSORS 87 #define SPI_SETICONS 88 #define SPI_GETDEFAULTINPUTLANG 89 #define SPI_SETDEFAULTINPUTLANG 90 #define SPI_SETLANGTOGGLE 91 #define SPI_GETWINDOWSEXTENSION 92 #define SPI_SETMOUSETRAILS 93 #define SPI_GETMOUSETRAILS 94 #define SPI_SETSCREENSAVERRUNNING 97 #define SPI_SCREENSAVERRUNNING SPI_SETSCREENSAVERRUNNING /* defines below are for all win versions (_WIN32_WINNT >= 0x0400) || * (_WIN32_WINDOWS > 0x0400) */ #define SPI_GETMOUSEHOVERWIDTH 98 #define SPI_SETMOUSEHOVERWIDTH 99 #define SPI_GETMOUSEHOVERHEIGHT 100 #define SPI_SETMOUSEHOVERHEIGHT 101 #define SPI_GETMOUSEHOVERTIME 102 #define SPI_SETMOUSEHOVERTIME 103 #define SPI_GETWHEELSCROLLLINES 104 #define SPI_SETWHEELSCROLLLINES 105 #define SPI_GETSHOWIMEUI 110 #define SPI_SETSHOWIMEUI 111 /* defines below are for all win versions WINVER >= 0x0500 */ #define SPI_GETMOUSESPEED 112 #define SPI_SETMOUSESPEED 113 #define SPI_GETSCREENSAVERRUNNING 114 #define SPI_GETACTIVEWINDOWTRACKING 0x1000 #define SPI_SETACTIVEWINDOWTRACKING 0x1001 #define SPI_GETMENUANIMATION 0x1002 #define SPI_SETMENUANIMATION 0x1003 #define SPI_GETCOMBOBOXANIMATION 0x1004 #define SPI_SETCOMBOBOXANIMATION 0x1005 #define SPI_GETLISTBOXSMOOTHSCROLLING 0x1006 #define SPI_SETLISTBOXSMOOTHSCROLLING 0x1007 #define SPI_GETGRADIENTCAPTIONS 0x1008 #define SPI_SETGRADIENTCAPTIONS 0x1009 #define SPI_GETMENUUNDERLINES 0x100A #define SPI_SETMENUUNDERLINES 0x100B #define SPI_GETACTIVEWNDTRKZORDER 0x100C #define SPI_SETACTIVEWNDTRKZORDER 0x100D #define SPI_GETHOTTRACKING 0x100E #define SPI_SETHOTTRACKING 0x100F #define SPI_GETFOREGROUNDLOCKTIMEOUT 0x2000 #define SPI_SETFOREGROUNDLOCKTIMEOUT 0x2001 #define SPI_GETACTIVEWNDTRKTIMEOUT 0x2002 #define SPI_SETACTIVEWNDTRKTIMEOUT 0x2003 #define SPI_GETFOREGROUNDFLASHCOUNT 0x2004 #define SPI_SETFOREGROUNDFLASHCOUNT 0x2005 /* SystemParametersInfo flags */ #define SPIF_UPDATEINIFILE 1 #define SPIF_SENDWININICHANGE 2 #define SPIF_SENDCHANGE SPIF_SENDWININICHANGE /* Window Styles */ #define WS_OVERLAPPED 0x00000000L #define WS_POPUP 0x80000000L #define WS_CHILD 0x40000000L #define WS_MINIMIZE 0x20000000L #define WS_VISIBLE 0x10000000L #define WS_DISABLED 0x08000000L #define WS_CLIPSIBLINGS 0x04000000L #define WS_CLIPCHILDREN 0x02000000L #define WS_MAXIMIZE 0x01000000L #define WS_CAPTION 0x00C00000L #define WS_BORDER 0x00800000L #define WS_DLGFRAME 0x00400000L #define WS_VSCROLL 0x00200000L #define WS_HSCROLL 0x00100000L #define WS_SYSMENU 0x00080000L #define WS_THICKFRAME 0x00040000L #define WS_GROUP 0x00020000L #define WS_TABSTOP 0x00010000L #define WS_MINIMIZEBOX 0x00020000L #define WS_MAXIMIZEBOX 0x00010000L #define WS_TILED WS_OVERLAPPED #define WS_ICONIC WS_MINIMIZE #define WS_SIZEBOX WS_THICKFRAME #define WS_OVERLAPPEDWINDOW (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME| WS_MINIMIZEBOX | WS_MAXIMIZEBOX) #define WS_POPUPWINDOW (WS_POPUP | WS_BORDER | WS_SYSMENU) #define WS_CHILDWINDOW (WS_CHILD) #define WS_TILEDWINDOW (WS_OVERLAPPEDWINDOW) /* Window extended styles */ #define WS_EX_DLGMODALFRAME 0x00000001L #define WS_EX_DRAGDETECT 0x00000002L #define WS_EX_NOPARENTNOTIFY 0x00000004L #define WS_EX_TOPMOST 0x00000008L #define WS_EX_ACCEPTFILES 0x00000010L #define WS_EX_TRANSPARENT 0x00000020L /* New Win95/WinNT4 styles */ #define WS_EX_MDICHILD 0x00000040L #define WS_EX_TOOLWINDOW 0x00000080L #define WS_EX_WINDOWEDGE 0x00000100L #define WS_EX_CLIENTEDGE 0x00000200L #define WS_EX_CONTEXTHELP 0x00000400L #define WS_EX_RIGHT 0x00001000L #define WS_EX_LEFT 0x00000000L #define WS_EX_RTLREADING 0x00002000L #define WS_EX_LTRREADING 0x00000000L #define WS_EX_LEFTSCROLLBAR 0x00004000L #define WS_EX_RIGHTSCROLLBAR 0x00000000L #define WS_EX_CONTROLPARENT 0x00010000L #define WS_EX_STATICEDGE 0x00020000L #define WS_EX_APPWINDOW 0x00040000L #define WS_EX_OVERLAPPEDWINDOW (WS_EX_WINDOWEDGE|WS_EX_CLIENTEDGE) #define WS_EX_PALETTEWINDOW (WS_EX_WINDOWEDGE|WS_EX_TOOLWINDOW|WS_EX_TOPMOST) /* WINE internal... */ #define WS_EX_TRAYWINDOW 0x80000000L /* Window scrolling */ #define SW_SCROLLCHILDREN 0x0001 #define SW_INVALIDATE 0x0002 #define SW_ERASE 0x0004 /* CreateWindow() coordinates */ #define CW_USEDEFAULT ((INT)0x80000000) /* ChildWindowFromPointEx Flags */ #define CWP_ALL 0x0000 #define CWP_SKIPINVISIBLE 0x0001 #define CWP_SKIPDISABLED 0x0002 #define CWP_SKIPTRANSPARENT 0x0004 /* PeekMessage() options */ #define PM_NOREMOVE 0x0000 #define PM_REMOVE 0x0001 #define PM_NOYIELD 0x0002 /* WM_SHOWWINDOW wParam codes */ #define SW_PARENTCLOSING 1 #define SW_OTHERMAXIMIZED 2 #define SW_PARENTOPENING 3 #define SW_OTHERRESTORED 4 /* ShowWindow() codes */ #define SW_HIDE 0 #define SW_SHOWNORMAL 1 #define SW_NORMAL 1 #define SW_SHOWMINIMIZED 2 #define SW_SHOWMAXIMIZED 3 #define SW_MAXIMIZE 3 #define SW_SHOWNOACTIVATE 4 #define SW_SHOW 5 #define SW_MINIMIZE 6 #define SW_SHOWMINNOACTIVE 7 #define SW_SHOWNA 8 #define SW_RESTORE 9 #define SW_SHOWDEFAULT 10 #define SW_MAX 10 #define SW_NORMALNA 0xCC /* undoc. flag in MinMaximize */ /* WM_SIZE message wParam values */ #define SIZE_RESTORED 0 #define SIZE_MINIMIZED 1 #define SIZE_MAXIMIZED 2 #define SIZE_MAXSHOW 3 #define SIZE_MAXHIDE 4 #define SIZENORMAL SIZE_RESTORED #define SIZEICONIC SIZE_MINIMIZED #define SIZEFULLSCREEN SIZE_MAXIMIZED #define SIZEZOOMSHOW SIZE_MAXSHOW #define SIZEZOOMHIDE SIZE_MAXHIDE /* SetWindowPos() and WINDOWPOS flags */ #define SWP_NOSIZE 0x0001 #define SWP_NOMOVE 0x0002 #define SWP_NOZORDER 0x0004 #define SWP_NOREDRAW 0x0008 #define SWP_NOACTIVATE 0x0010 #define SWP_FRAMECHANGED 0x0020 /* The frame changed: send WM_NCCALCSIZE */ #define SWP_SHOWWINDOW 0x0040 #define SWP_HIDEWINDOW 0x0080 #define SWP_NOCOPYBITS 0x0100 #define SWP_NOOWNERZORDER 0x0200 /* Don't do owner Z ordering */ #define SWP_DRAWFRAME SWP_FRAMECHANGED #define SWP_NOREPOSITION SWP_NOOWNERZORDER #define SWP_NOSENDCHANGING 0x0400 #define SWP_DEFERERASE 0x2000 #define SWP_ASYNCWINDOWPOS 0x4000 #define HWND_DESKTOP ((HWND)0) #define HWND_BROADCAST ((HWND)0xffff) /* SetWindowPos() hwndInsertAfter field values */ #define HWND_TOP ((HWND)0) #define HWND_BOTTOM ((HWND)1) #define HWND_TOPMOST ((HWND)-1) #define HWND_NOTOPMOST ((HWND)-2) #define MF_INSERT 0x0000 #define MF_CHANGE 0x0080 #define MF_APPEND 0x0100 #define MF_DELETE 0x0200 #define MF_REMOVE 0x1000 #define MF_END 0x0080 #define MF_ENABLED 0x0000 #define MF_GRAYED 0x0001 #define MF_DISABLED 0x0002 #define MF_STRING 0x0000 #define MF_BITMAP 0x0004 #define MF_UNCHECKED 0x0000 #define MF_CHECKED 0x0008 #define MF_POPUP 0x0010 #define MF_MENUBARBREAK 0x0020 #define MF_MENUBREAK 0x0040 #define MF_UNHILITE 0x0000 #define MF_HILITE 0x0080 #define MF_OWNERDRAW 0x0100 #define MF_USECHECKBITMAPS 0x0200 #define MF_BYCOMMAND 0x0000 #define MF_BYPOSITION 0x0400 #define MF_SEPARATOR 0x0800 #define MF_DEFAULT 0x1000 #define MF_SYSMENU 0x2000 #define MF_HELP 0x4000 #define MF_RIGHTJUSTIFY 0x4000 #define MF_MOUSESELECT 0x8000 /* Flags for extended menu item types. */ #define MFT_STRING MF_STRING #define MFT_BITMAP MF_BITMAP #define MFT_MENUBARBREAK MF_MENUBARBREAK #define MFT_MENUBREAK MF_MENUBREAK #define MFT_OWNERDRAW MF_OWNERDRAW #define MFT_RADIOCHECK 0x00000200L #define MFT_SEPARATOR MF_SEPARATOR #define MFT_RIGHTORDER 0x00002000L #define MFT_RIGHTJUSTIFY MF_RIGHTJUSTIFY /* Flags for extended menu item states. */ #define MFS_GRAYED 0x00000003L #define MFS_DISABLED MFS_GRAYED #define MFS_CHECKED MF_CHECKED #define MFS_HILITE MF_HILITE #define MFS_ENABLED MF_ENABLED #define MFS_UNCHECKED MF_UNCHECKED #define MFS_UNHILITE MF_UNHILITE #define MFS_DEFAULT MF_DEFAULT #define MFS_MASK 0x0000108BL #define MFS_HOTTRACKDRAWN 0x10000000L #define MFS_CACHEDBMP 0x20000000L #define MFS_BOTTOMGAPDROP 0x40000000L #define MFS_TOPGAPDROP 0x80000000L #define MFS_GAPDROP 0xC0000000L /* for GetMenuDefaultItem */ #define GMDI_USEDISABLED 0x0001L #define GMDI_GOINTOPOPUPS 0x0002L #define DT_TOP 0 #define DT_LEFT 0 #define DT_CENTER 1 #define DT_RIGHT 2 #define DT_VCENTER 4 #define DT_BOTTOM 8 #define DT_WORDBREAK 16 #define DT_SINGLELINE 32 #define DT_EXPANDTABS 64 #define DT_TABSTOP 128 #define DT_NOCLIP 256 #define DT_EXTERNALLEADING 512 #define DT_CALCRECT 1024 #define DT_NOPREFIX 2048 #define DT_INTERNAL 4096 /* DrawCaption()/DrawCaptionTemp() flags */ #define DC_ACTIVE 0x0001 #define DC_SMALLCAP 0x0002 #define DC_ICON 0x0004 #define DC_TEXT 0x0008 #define DC_INBUTTON 0x0010 /* DrawEdge() flags */ #define BDR_RAISEDOUTER 0x0001 #define BDR_SUNKENOUTER 0x0002 #define BDR_RAISEDINNER 0x0004 #define BDR_SUNKENINNER 0x0008 #define BDR_OUTER 0x0003 #define BDR_INNER 0x000c #define BDR_RAISED 0x0005 #define BDR_SUNKEN 0x000a #define EDGE_RAISED (BDR_RAISEDOUTER | BDR_RAISEDINNER) #define EDGE_SUNKEN (BDR_SUNKENOUTER | BDR_SUNKENINNER) #define EDGE_ETCHED (BDR_SUNKENOUTER | BDR_RAISEDINNER) #define EDGE_BUMP (BDR_RAISEDOUTER | BDR_SUNKENINNER) /* border flags */ #define BF_LEFT 0x0001 #define BF_TOP 0x0002 #define BF_RIGHT 0x0004 #define BF_BOTTOM 0x0008 #define BF_DIAGONAL 0x0010 #define BF_MIDDLE 0x0800 /* Fill in the middle */ #define BF_SOFT 0x1000 /* For softer buttons */ #define BF_ADJUST 0x2000 /* Calculate the space left over */ #define BF_FLAT 0x4000 /* For flat rather than 3D borders */ #define BF_MONO 0x8000 /* For monochrome borders */ #define BF_TOPLEFT (BF_TOP | BF_LEFT) #define BF_TOPRIGHT (BF_TOP | BF_RIGHT) #define BF_BOTTOMLEFT (BF_BOTTOM | BF_LEFT) #define BF_BOTTOMRIGHT (BF_BOTTOM | BF_RIGHT) #define BF_RECT (BF_LEFT | BF_TOP | BF_RIGHT | BF_BOTTOM) #define BF_DIAGONAL_ENDTOPRIGHT (BF_DIAGONAL | BF_TOP | BF_RIGHT) #define BF_DIAGONAL_ENDTOPLEFT (BF_DIAGONAL | BF_TOP | BF_LEFT) #define BF_DIAGONAL_ENDBOTTOMLEFT (BF_DIAGONAL | BF_BOTTOM | BF_LEFT) #define BF_DIAGONAL_ENDBOTTOMRIGHT (BF_DIAGONAL | BF_BOTTOM | BF_RIGHT) /* DrawFrameControl() uType's */ #define DFC_CAPTION 1 #define DFC_MENU 2 #define DFC_SCROLL 3 #define DFC_BUTTON 4 /* uState's */ #define DFCS_CAPTIONCLOSE 0x0000 #define DFCS_CAPTIONMIN 0x0001 #define DFCS_CAPTIONMAX 0x0002 #define DFCS_CAPTIONRESTORE 0x0003 #define DFCS_CAPTIONHELP 0x0004 /* Windows 95 only */ #define DFCS_MENUARROW 0x0000 #define DFCS_MENUCHECK 0x0001 #define DFCS_MENUBULLET 0x0002 #define DFCS_MENUARROWRIGHT 0x0004 #define DFCS_SCROLLUP 0x0000 #define DFCS_SCROLLDOWN 0x0001 #define DFCS_SCROLLLEFT 0x0002 #define DFCS_SCROLLRIGHT 0x0003 #define DFCS_SCROLLCOMBOBOX 0x0005 #define DFCS_SCROLLSIZEGRIP 0x0008 #define DFCS_SCROLLSIZEGRIPRIGHT 0x0010 #define DFCS_BUTTONCHECK 0x0000 #define DFCS_BUTTONRADIOIMAGE 0x0001 #define DFCS_BUTTONRADIOMASK 0x0002 /* to draw nonsquare button */ #define DFCS_BUTTONRADIO 0x0004 #define DFCS_BUTTON3STATE 0x0008 #define DFCS_BUTTONPUSH 0x0010 /* additional state of the control */ #define DFCS_INACTIVE 0x0100 #define DFCS_PUSHED 0x0200 #define DFCS_CHECKED 0x0400 #define DFCS_ADJUSTRECT 0x2000 /* exclude surrounding edge */ #define DFCS_FLAT 0x4000 #define DFCS_MONO 0x8000 /* Image type */ #define DST_COMPLEX 0x0000 #define DST_TEXT 0x0001 #define DST_PREFIXTEXT 0x0002 #define DST_ICON 0x0003 #define DST_BITMAP 0x0004 /* State type */ #define DSS_NORMAL 0x0000 #define DSS_UNION 0x0010 /* Gray string appearance */ #define DSS_DISABLED 0x0020 #define DSS_DEFAULT 0x0040 /* Make it bold */ #define DSS_MONO 0x0080 #define DSS_RIGHT 0x8000 typedef struct { UINT CtlType; UINT CtlID; UINT itemID; UINT itemAction; UINT itemState; HWND hwndItem; HDC hDC; RECT rcItem WINE_PACKED; DWORD itemData WINE_PACKED; } DRAWITEMSTRUCT, *PDRAWITEMSTRUCT, *LPDRAWITEMSTRUCT; typedef struct { UINT CtlType; UINT CtlID; UINT itemID; UINT itemWidth; UINT itemHeight; DWORD itemData; } MEASUREITEMSTRUCT, *PMEASUREITEMSTRUCT, *LPMEASUREITEMSTRUCT; typedef struct { UINT CtlType; UINT CtlID; UINT itemID; HWND hwndItem; DWORD itemData; } DELETEITEMSTRUCT, *LPDELETEITEMSTRUCT; typedef struct { UINT CtlType; UINT CtlID; HWND hwndItem; UINT itemID1; DWORD itemData1; UINT itemID2; DWORD itemData2; DWORD dwLocaleId; } COMPAREITEMSTRUCT, *PCOMPAREITEMSTRUCT, *LPCOMPAREITEMSTRUCT; /* WM_KEYUP/DOWN/CHAR HIWORD(lParam) flags */ #define KF_EXTENDED 0x0100 #define KF_DLGMODE 0x0800 #define KF_MENUMODE 0x1000 #define KF_ALTDOWN 0x2000 #define KF_REPEAT 0x4000 #define KF_UP 0x8000 /* Virtual key codes */ #define VK_LBUTTON 0x01 #define VK_RBUTTON 0x02 #define VK_CANCEL 0x03 #define VK_MBUTTON 0x04 /* 0x05-0x07 Undefined */ #define VK_BACK 0x08 #define VK_TAB 0x09 /* 0x0A-0x0B Undefined */ #define VK_CLEAR 0x0C #define VK_RETURN 0x0D /* 0x0E-0x0F Undefined */ #define VK_SHIFT 0x10 #define VK_CONTROL 0x11 #define VK_MENU 0x12 #define VK_PAUSE 0x13 #define VK_CAPITAL 0x14 /* 0x15-0x19 Reserved for Kanji systems */ /* 0x1A Undefined */ #define VK_ESCAPE 0x1B /* 0x1C-0x1F Reserved for Kanji systems */ #define VK_SPACE 0x20 #define VK_PRIOR 0x21 #define VK_NEXT 0x22 #define VK_END 0x23 #define VK_HOME 0x24 #define VK_LEFT 0x25 #define VK_UP 0x26 #define VK_RIGHT 0x27 #define VK_DOWN 0x28 #define VK_SELECT 0x29 #define VK_PRINT 0x2A /* OEM specific in Windows 3.1 SDK */ #define VK_EXECUTE 0x2B #define VK_SNAPSHOT 0x2C #define VK_INSERT 0x2D #define VK_DELETE 0x2E #define VK_HELP 0x2F #define VK_0 0x30 #define VK_1 0x31 #define VK_2 0x32 #define VK_3 0x33 #define VK_4 0x34 #define VK_5 0x35 #define VK_6 0x36 #define VK_7 0x37 #define VK_8 0x38 #define VK_9 0x39 /* 0x3A-0x40 Undefined */ #define VK_A 0x41 #define VK_B 0x42 #define VK_C 0x43 #define VK_D 0x44 #define VK_E 0x45 #define VK_F 0x46 #define VK_G 0x47 #define VK_H 0x48 #define VK_I 0x49 #define VK_J 0x4A #define VK_K 0x4B #define VK_L 0x4C #define VK_M 0x4D #define VK_N 0x4E #define VK_O 0x4F #define VK_P 0x50 #define VK_Q 0x51 #define VK_R 0x52 #define VK_S 0x53 #define VK_T 0x54 #define VK_U 0x55 #define VK_V 0x56 #define VK_W 0x57 #define VK_X 0x58 #define VK_Y 0x59 #define VK_Z 0x5A #define VK_LWIN 0x5B #define VK_RWIN 0x5C #define VK_APPS 0x5D /* 0x5E-0x5F Unassigned */ #define VK_NUMPAD0 0x60 #define VK_NUMPAD1 0x61 #define VK_NUMPAD2 0x62 #define VK_NUMPAD3 0x63 #define VK_NUMPAD4 0x64 #define VK_NUMPAD5 0x65 #define VK_NUMPAD6 0x66 #define VK_NUMPAD7 0x67 #define VK_NUMPAD8 0x68 #define VK_NUMPAD9 0x69 #define VK_MULTIPLY 0x6A #define VK_ADD 0x6B #define VK_SEPARATOR 0x6C #define VK_SUBTRACT 0x6D #define VK_DECIMAL 0x6E #define VK_DIVIDE 0x6F #define VK_F1 0x70 #define VK_F2 0x71 #define VK_F3 0x72 #define VK_F4 0x73 #define VK_F5 0x74 #define VK_F6 0x75 #define VK_F7 0x76 #define VK_F8 0x77 #define VK_F9 0x78 #define VK_F10 0x79 #define VK_F11 0x7A #define VK_F12 0x7B #define VK_F13 0x7C #define VK_F14 0x7D #define VK_F15 0x7E #define VK_F16 0x7F #define VK_F17 0x80 #define VK_F18 0x81 #define VK_F19 0x82 #define VK_F20 0x83 #define VK_F21 0x84 #define VK_F22 0x85 #define VK_F23 0x86 #define VK_F24 0x87 /* 0x88-0x8F Unassigned */ #define VK_NUMLOCK 0x90 #define VK_SCROLL 0x91 /* 0x92-0x9F Unassigned */ /* * differencing between right and left shift/control/alt key. * Used only by GetAsyncKeyState() and GetKeyState(). */ #define VK_LSHIFT 0xA0 #define VK_RSHIFT 0xA1 #define VK_LCONTROL 0xA2 #define VK_RCONTROL 0xA3 #define VK_LMENU 0xA4 #define VK_RMENU 0xA5 /* 0xA6-0xB9 Unassigned */ #define VK_OEM_1 0xBA #define VK_OEM_PLUS 0xBB #define VK_OEM_COMMA 0xBC #define VK_OEM_MINUS 0xBD #define VK_OEM_PERIOD 0xBE #define VK_OEM_2 0xBF #define VK_OEM_3 0xC0 /* 0xC1-0xDA Unassigned */ #define VK_OEM_4 0xDB #define VK_OEM_5 0xDC #define VK_OEM_6 0xDD #define VK_OEM_7 0xDE /* 0xDF-0xE4 OEM specific */ #define VK_PROCESSKEY 0xE5 /* 0xE6 OEM specific */ /* 0xE7-0xE8 Unassigned */ /* 0xE9-0xF5 OEM specific */ #define VK_ATTN 0xF6 #define VK_CRSEL 0xF7 #define VK_EXSEL 0xF8 #define VK_EREOF 0xF9 #define VK_PLAY 0xFA #define VK_ZOOM 0xFB #define VK_NONAME 0xFC #define VK_PA1 0xFD #define VK_OEM_CLEAR 0xFE /* Key status flags for mouse events */ #define MK_LBUTTON 0x0001 #define MK_RBUTTON 0x0002 #define MK_SHIFT 0x0004 #define MK_CONTROL 0x0008 #define MK_MBUTTON 0x0010 /* Queue status flags */ #define QS_KEY 0x0001 #define QS_MOUSEMOVE 0x0002 #define QS_MOUSEBUTTON 0x0004 #define QS_MOUSE (QS_MOUSEMOVE | QS_MOUSEBUTTON) #define QS_POSTMESSAGE 0x0008 #define QS_TIMER 0x0010 #define QS_PAINT 0x0020 #define QS_SENDMESSAGE 0x0040 #define QS_HOTKEY 0x0080 #define QS_INPUT (QS_MOUSE | QS_KEY) #define QS_ALLEVENTS (QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY) #define QS_ALLINPUT (QS_ALLEVENTS | QS_SENDMESSAGE) #define DDL_READWRITE 0x0000 #define DDL_READONLY 0x0001 #define DDL_HIDDEN 0x0002 #define DDL_SYSTEM 0x0004 #define DDL_DIRECTORY 0x0010 #define DDL_ARCHIVE 0x0020 #define DDL_POSTMSGS 0x2000 #define DDL_DRIVES 0x4000 #define DDL_EXCLUSIVE 0x8000 /* Shell hook values */ #define HSHELL_WINDOWCREATED 1 #define HSHELL_WINDOWDESTROYED 2 #define HSHELL_ACTIVATESHELLWINDOW 3 /* Predefined Clipboard Formats */ #define CF_TEXT 1 #define CF_BITMAP 2 #define CF_METAFILEPICT 3 #define CF_SYLK 4 #define CF_DIF 5 #define CF_TIFF 6 #define CF_OEMTEXT 7 #define CF_DIB 8 #define CF_PALETTE 9 #define CF_PENDATA 10 #define CF_RIFF 11 #define CF_WAVE 12 #define CF_ENHMETAFILE 14 #define CF_HDROP 15 #define CF_LOCALE 16 #define CF_MAX 17 #define CF_OWNERDISPLAY 0x0080 #define CF_DSPTEXT 0x0081 #define CF_DSPBITMAP 0x0082 #define CF_DSPMETAFILEPICT 0x0083 /* "Private" formats don't get GlobalFree()'d */ #define CF_PRIVATEFIRST 0x0200 #define CF_PRIVATELAST 0x02FF /* "GDIOBJ" formats do get DeleteObject()'d */ #define CF_GDIOBJFIRST 0x0300 #define CF_GDIOBJLAST 0x03FF /* DragObject stuff */ typedef struct { HWND16 hWnd; HANDLE16 hScope; WORD wFlags; HANDLE16 hList; HANDLE16 hOfStruct; POINT16 pt WINE_PACKED; LONG l WINE_PACKED; } DRAGINFO, *LPDRAGINFO; #define DRAGOBJ_PROGRAM 0x0001 #define DRAGOBJ_DATA 0x0002 #define DRAGOBJ_DIRECTORY 0x0004 #define DRAGOBJ_MULTIPLE 0x0008 #define DRAGOBJ_EXTERNAL 0x8000 #define DRAG_PRINT 0x544E5250 #define DRAG_FILE 0x454C4946 /* types of LoadImage */ #define IMAGE_BITMAP 0 #define IMAGE_ICON 1 #define IMAGE_CURSOR 2 #define IMAGE_ENHMETAFILE 3 /* loadflags to LoadImage */ #define LR_DEFAULTCOLOR 0x0000 #define LR_MONOCHROME 0x0001 #define LR_COLOR 0x0002 #define LR_COPYRETURNORG 0x0004 #define LR_COPYDELETEORG 0x0008 #define LR_LOADFROMFILE 0x0010 #define LR_LOADTRANSPARENT 0x0020 #define LR_DEFAULTSIZE 0x0040 #define LR_VGA_COLOR 0x0080 #define LR_LOADMAP3DCOLORS 0x1000 #define LR_CREATEDIBSECTION 0x2000 #define LR_COPYFROMRESOURCE 0x4000 #define LR_SHARED 0x8000 /* Flags for DrawIconEx. */ #define DI_MASK 1 #define DI_IMAGE 2 #define DI_NORMAL (DI_MASK | DI_IMAGE) #define DI_COMPAT 4 #define DI_DEFAULTSIZE 8 /* misc messages */ #define WM_CPL_LAUNCH (WM_USER + 1000) #define WM_CPL_LAUNCHED (WM_USER + 1001) /* WM_NOTIFYFORMAT commands and return values */ #define NFR_ANSI 1 #define NFR_UNICODE 2 #define NF_QUERY 3 #define NF_REQUERY 4 #include "poppack.h" #define EnumTaskWindows(handle,proc,lparam) \ EnumThreadWindows(handle,proc,lparam) #define OemToAnsiA OemToCharA #define OemToAnsiW OemToCharW #define OemToAnsi WINELIB_NAME_AW(OemToAnsi) #define OemToAnsiBuffA OemToCharBuffA #define OemToAnsiBuffW OemToCharBuffW #define OemToAnsiBuff WINELIB_NAME_AW(OemToAnsiBuff) #define AnsiToOemA CharToOemA #define AnsiToOemW CharToOemW #define AnsiToOem WINELIB_NAME_AW(AnsiToOem) #define AnsiToOemBuffA CharToOemBuffA #define AnsiToOemBuffW CharToOemBuffW #define AnsiToOemBuff WINELIB_NAME_AW(AnsiToOemBuff) /* NOTE: This is SYSTEM.3, not USER.182, which is also named KillSystemTimer */ WORD WINAPI SYSTEM_KillSystemTimer( WORD ); /* Extra functions that don't exist in the Windows API */ HPEN WINAPI GetSysColorPen(INT); INT WINAPI LoadMessageA(HMODULE,UINT,WORD,LPSTR,INT); INT WINAPI LoadMessageW(HMODULE,UINT,WORD,LPWSTR,INT); VOID WINAPI ScreenSwitchEnable16(WORD); #define WC_DIALOG (LPSTR)((DWORD)((WORD)( 0x8002))) #ifdef __cplusplus } #endif #endif /* _WINUSER_ */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/Makefile.am0000644000175000017500000000350410642715704022365 0ustar yavoryavorSUBDIRS = dmo dshow wine if AMM_USE_WIN32 noinst_LTLIBRARIES = libloader.la endif noinst_HEADERS = \ com.h \ driver.h \ ext.h \ ldt_keeper.h \ loader.h \ registry.h \ win32.h \ wineacm.h libloader_la_SOURCES = \ afl.c \ driver.c \ elfdll.c \ ext.c \ ldt_keeper.c \ module.c \ pe_image.c \ pe_resource.c \ registry.c \ resource.c \ vfl.c \ win32.c libloader_la_LIBADD = \ dmo/libdmo.la \ dshow/libdshow.la # gcc-3.0 produces buggy code for acmStreamOpen() with # "-O3 -fomit-frame-pointer" or "-O2 -fomit-frame-pointer # -finline-functions -frename-registers" (code is OK with sole -O2), # the bad code accesses parameters via %ebp without setting up a # propper %ebp first! # -fno-omit-frame-pointer works around this gcc-3.0 bug. gcc-2.95.2 is OK. # # See "view problem report" #3480 here: http://gcc.gnu.org/cgi-bin/gnatsweb.pl WINFLAGS = -DWIN32_PATH=\"$(WIN32_PATH)\" -D__WINE__ -DUNICODE \ -Ddbg_printf=__vprintf -DTRACE=__vprintf # -D__NO_STRING_INLINES # to help detect missing/inconsistent __stdcall function attributes in # avifile's wine code: AM_CPPFLAGS = $(LTNOPIC) -DAVIFILE $(WINFLAGS) -Wmissing-prototypes -Wimplicit-function-declaration # -mno-omit-leaf-frame-pointer added to workaround bug with WMV8 and gcc-3.2 AM_CFLAGS = -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffast-math #CFLAGS = $(WIN32_CFLAGS) #-O2 #-fno-omit-frame-pointer #-O3 -fomit-frame-pointer # #AS = gcc #ASFLAGS = -g -O2 LIBS = # not needed anymore EXTRA_DIST = stubs.s # .text section has been changed to .data section # so we eliminate .rel.text section from library # it works this way too # we actually don't need this line #stubs.lo: stubs.s # $(CC) -c $(srcdir)/stubs.s -o stubs.lo #win32.lo: win32.c # $(CC) -O2 -fno-inline -fno-strict-aliasing $(DEFS) $(WINFLAGS) -c $< -o $@ MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libwin32/loader/afl.c0000644000175000017500000005306307506610025021237 0ustar yavoryavor/************************************************************************** This file will contain an interface to ACM drivers. Its content will be based mainly on wine/dlls/msacm32 actually, for audio decompression only the following functions are needed: acmStreamOpen ( takes formats of src and dest, returns stream handle ) acmStreamPrepareHeader ( takes stream handler and info on data ) acmStreamConvert ( the same as PrepareHeader ) acmStreamUnprepareHeader acmStreamClose acmStreamSize maybe acmStreamReset In future I'll also add functions for format enumeration, but not right now. ***************************************************************************/ #include "config.h" #include "wine/winbase.h" #include "wine/windef.h" #include "wine/winuser.h" #include "wine/vfw.h" #include "wine/winestring.h" #include "wine/driver.h" #include "wine/winerror.h" #include "wine/msacm.h" #include "wine/msacmdrv.h" #include "wineacm.h" #include "ext.h" #include "driver.h" #include #include #include #pragma pack(1) #define OpenDriverA DrvOpen #define CloseDriver DrvClose static inline PWINE_ACMSTREAM ACM_GetStream(HACMSTREAM has) { return (PWINE_ACMSTREAM)has; } /*********************************************************************** * acmDriverAddA (MSACM32.2) */ MMRESULT WINAPI acmDriverAddA(PHACMDRIVERID phadid, HINSTANCE hinstModule, LPARAM lParam, DWORD dwPriority, DWORD fdwAdd) { if (!phadid) return MMSYSERR_INVALPARAM; /* Check if any unknown flags */ if (fdwAdd & ~(ACM_DRIVERADDF_FUNCTION|ACM_DRIVERADDF_NOTIFYHWND| ACM_DRIVERADDF_GLOBAL)) return MMSYSERR_INVALFLAG; /* Check if any incompatible flags */ if ((fdwAdd & ACM_DRIVERADDF_FUNCTION) && (fdwAdd & ACM_DRIVERADDF_NOTIFYHWND)) return MMSYSERR_INVALFLAG; /* FIXME: in fact, should GetModuleFileName(hinstModule) and do a * LoadDriver on it, to be sure we can call SendDriverMessage on the * hDrvr handle. */ *phadid = (HACMDRIVERID) MSACM_RegisterDriver(NULL, 0, hinstModule); /* FIXME: lParam, dwPriority and fdwAdd ignored */ return MMSYSERR_NOERROR; } /*********************************************************************** * acmDriverClose (MSACM32.4) */ MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose) { PWINE_ACMDRIVER p; PWINE_ACMDRIVER* tp; if (fdwClose) return MMSYSERR_INVALFLAG; p = MSACM_GetDriver(had); if (!p) return MMSYSERR_INVALHANDLE; for (tp = &(p->obj.pACMDriverID->pACMDriverList); *tp; *tp = (*tp)->pNextACMDriver) { if (*tp == p) { *tp = (*tp)->pNextACMDriver; break; } } if (p->hDrvr && !p->obj.pACMDriverID->pACMDriverList) CloseDriver(p->hDrvr); HeapFree(MSACM_hHeap, 0, p); return MMSYSERR_NOERROR; } /*********************************************************************** * acmDriverEnum (MSACM32.7) */ MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWORD fdwEnum) { PWINE_ACMDRIVERID p; DWORD fdwSupport; if (!fnCallback) { return MMSYSERR_INVALPARAM; } if (fdwEnum && ~(ACM_DRIVERENUMF_NOLOCAL|ACM_DRIVERENUMF_DISABLED)) { return MMSYSERR_INVALFLAG; } for (p = MSACM_pFirstACMDriverID; p; p = p->pNextACMDriverID) { fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC; if (!p->bEnabled) { if (fdwEnum & ACM_DRIVERENUMF_DISABLED) fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED; else continue; } (*fnCallback)((HACMDRIVERID) p, dwInstance, fdwSupport); } return MMSYSERR_NOERROR; } /*********************************************************************** * acmDriverID (MSACM32.8) */ MMRESULT WINAPI acmDriverID(HACMOBJ hao, PHACMDRIVERID phadid, DWORD fdwDriverID) { PWINE_ACMOBJ pao; pao = MSACM_GetObj(hao); if (!pao) return MMSYSERR_INVALHANDLE; if (!phadid) return MMSYSERR_INVALPARAM; if (fdwDriverID) return MMSYSERR_INVALFLAG; *phadid = (HACMDRIVERID) pao->pACMDriverID; return MMSYSERR_NOERROR; } /*********************************************************************** * acmDriverMessage (MSACM32.9) * FIXME * Not implemented */ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2) { PWINE_ACMDRIVER pad = MSACM_GetDriver(had); if (!pad) return MMSYSERR_INVALPARAM; /* FIXME: Check if uMsg legal */ if (!SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2)) return MMSYSERR_NOTSUPPORTED; return MMSYSERR_NOERROR; } /*********************************************************************** * acmDriverOpen (MSACM32.10) */ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen) { PWINE_ACMDRIVERID padid; PWINE_ACMDRIVER pad; ICOPEN icopen; HDRVR hdrv; TRACE("(%p, %x, %08lu)\n", phad, hadid, fdwOpen); if (!phad) return MMSYSERR_INVALPARAM; padid = MSACM_GetDriverID(hadid); if (!padid) return MMSYSERR_INVALHANDLE; if (fdwOpen) return MMSYSERR_INVALFLAG; pad = (PWINE_ACMDRIVER) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER)); if (!pad) return MMSYSERR_NOMEM; pad->obj.pACMDriverID = padid; icopen.fccType = mmioFOURCC('a', 'u', 'd', 'c'); icopen.fccHandler = (long)padid->pszFileName; icopen.dwSize = sizeof(ICOPEN); icopen.dwFlags = 0; icopen.pV1Reserved = padid->pszFileName; if (!padid->hInstModule) pad->hDrvr = OpenDriverA((long)&icopen); else pad->hDrvr = padid->hInstModule; if (!pad->hDrvr) { HeapFree(MSACM_hHeap, 0, pad); return MMSYSERR_ERROR; } pad->pfnDriverProc = GetProcAddress(pad->hDrvr, "DriverProc"); /* insert new pad at beg of list */ pad->pNextACMDriver = padid->pACMDriverList; padid->pACMDriverList = pad; /* FIXME: Create a WINE_ACMDRIVER32 */ *phad = (HACMDRIVER)pad; return MMSYSERR_NOERROR; } /*********************************************************************** * acmDriverRemove (MSACM32.12) */ MMRESULT WINAPI acmDriverRemove(HACMDRIVERID hadid, DWORD fdwRemove) { PWINE_ACMDRIVERID padid; padid = MSACM_GetDriverID(hadid); if (!padid) return MMSYSERR_INVALHANDLE; if (fdwRemove) return MMSYSERR_INVALFLAG; MSACM_UnregisterDriver(padid); return MMSYSERR_NOERROR; } /**********************************************************************/ HANDLE MSACM_hHeap = (HANDLE) NULL; PWINE_ACMDRIVERID MSACM_pFirstACMDriverID = NULL; PWINE_ACMDRIVERID MSACM_pLastACMDriverID = NULL; /*********************************************************************** * MSACM_RegisterDriver32() */ PWINE_ACMDRIVERID MSACM_RegisterDriver(const char* pszFileName, WORD wFormatTag, HINSTANCE hinstModule) { PWINE_ACMDRIVERID padid; TRACE("('%s', '%x', 0x%08x)\n", pszFileName, wFormatTag, hinstModule); padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID)); padid->pszFileName = (char*)malloc(strlen(pszFileName)+1); strcpy(padid->pszFileName, pszFileName); // 1~strdup(pszDriverAlias); padid->wFormatTag = wFormatTag; padid->hInstModule = hinstModule; padid->bEnabled = TRUE; padid->pACMDriverList = NULL; padid->pNextACMDriverID = NULL; padid->pPrevACMDriverID = MSACM_pLastACMDriverID; if (MSACM_pLastACMDriverID) MSACM_pLastACMDriverID->pNextACMDriverID = padid; MSACM_pLastACMDriverID = padid; if (!MSACM_pFirstACMDriverID) MSACM_pFirstACMDriverID = padid; return padid; } /*********************************************************************** * MSACM_UnregisterDriver32() */ PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p) { PWINE_ACMDRIVERID pNextACMDriverID; while (p->pACMDriverList) acmDriverClose((HACMDRIVER) p->pACMDriverList, 0); if (p->pszFileName) free(p->pszFileName); if (p == MSACM_pFirstACMDriverID) MSACM_pFirstACMDriverID = p->pNextACMDriverID; if (p == MSACM_pLastACMDriverID) MSACM_pLastACMDriverID = p->pPrevACMDriverID; if (p->pPrevACMDriverID) p->pPrevACMDriverID->pNextACMDriverID = p->pNextACMDriverID; if (p->pNextACMDriverID) p->pNextACMDriverID->pPrevACMDriverID = p->pPrevACMDriverID; pNextACMDriverID = p->pNextACMDriverID; HeapFree(MSACM_hHeap, 0, p); return pNextACMDriverID; } /*********************************************************************** * MSACM_UnregisterAllDrivers32() * FIXME * Where should this function be called? */ void MSACM_UnregisterAllDrivers(void) { PWINE_ACMDRIVERID p; for (p = MSACM_pFirstACMDriverID; p; p = MSACM_UnregisterDriver(p)); } /*********************************************************************** * MSACM_GetDriverID32() */ PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID) { return (PWINE_ACMDRIVERID)hDriverID; } /*********************************************************************** * MSACM_GetDriver32() */ PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver) { return (PWINE_ACMDRIVER)hDriver; } /*********************************************************************** * MSACM_GetObj32() */ PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj) { return (PWINE_ACMOBJ)hObj; } /*********************************************************************** * acmStreamOpen (MSACM32.40) */ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc, PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD dwCallback, DWORD dwInstance, DWORD fdwOpen) { PWINE_ACMSTREAM was; PWINE_ACMDRIVER wad; MMRESULT ret; int wfxSrcSize; int wfxDstSize; TRACE("(%p, 0x%08x, %p, %p, %p, %ld, %ld, %ld)\n", phas, had, pwfxSrc, pwfxDst, pwfltr, dwCallback, dwInstance, fdwOpen); TRACE("src [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", pwfxSrc->wFormatTag, pwfxSrc->nChannels, pwfxSrc->nSamplesPerSec, pwfxSrc->nAvgBytesPerSec, pwfxSrc->nBlockAlign, pwfxSrc->wBitsPerSample, pwfxSrc->cbSize); TRACE("dst [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", pwfxDst->wFormatTag, pwfxDst->nChannels, pwfxDst->nSamplesPerSec, pwfxDst->nAvgBytesPerSec, pwfxDst->nBlockAlign, pwfxDst->wBitsPerSample, pwfxDst->cbSize); #define SIZEOF_WFX(wfx) (sizeof(WAVEFORMATEX) + ((wfx->wFormatTag == WAVE_FORMAT_PCM) ? 0 : wfx->cbSize)) wfxSrcSize = SIZEOF_WFX(pwfxSrc); wfxDstSize = SIZEOF_WFX(pwfxDst); #undef SIZEOF_WFX was = (PWINE_ACMSTREAM) HeapAlloc(MSACM_hHeap, 0, sizeof(*was) + wfxSrcSize + wfxDstSize + ((pwfltr) ? sizeof(WAVEFILTER) : 0)); if (was == NULL) return MMSYSERR_NOMEM; was->drvInst.cbStruct = sizeof(was->drvInst); was->drvInst.pwfxSrc = (PWAVEFORMATEX)((LPSTR)was + sizeof(*was)); memcpy(was->drvInst.pwfxSrc, pwfxSrc, wfxSrcSize); // LHACM is checking for 0x1 // but if this will not help // was->drvInst.pwfxSrc->wFormatTag = 1; was->drvInst.pwfxDst = (PWAVEFORMATEX)((LPSTR)was + sizeof(*was) + wfxSrcSize); memcpy(was->drvInst.pwfxDst, pwfxDst, wfxDstSize); if (pwfltr) { was->drvInst.pwfltr = (PWAVEFILTER)((LPSTR)was + sizeof(*was) + wfxSrcSize + wfxDstSize); memcpy(was->drvInst.pwfltr, pwfltr, sizeof(WAVEFILTER)); } else { was->drvInst.pwfltr = NULL; } was->drvInst.dwCallback = dwCallback; was->drvInst.dwInstance = dwInstance; was->drvInst.fdwOpen = fdwOpen; was->drvInst.fdwDriver = 0L; was->drvInst.dwDriver = 0L; was->drvInst.has = (HACMSTREAM)was; if (had) { if (!(wad = MSACM_GetDriver(had))) { ret = MMSYSERR_INVALPARAM; goto errCleanUp; } was->obj.pACMDriverID = wad->obj.pACMDriverID; was->pDrv = wad; was->hAcmDriver = 0; /* not to close it in acmStreamClose */ ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L); if (ret != MMSYSERR_NOERROR) goto errCleanUp; } else { PWINE_ACMDRIVERID wadi; short drv_tag; ret = ACMERR_NOTPOSSIBLE; /* if(pwfxSrc->wFormatTag==1)//compression drv_tag=pwfxDst->wFormatTag; else if(pwfxDst->wFormatTag==1)//decompression drv_tag=pwfxSrc->wFormatTag; else goto errCleanUp; ret=acmDriverOpen2(drv_tag); if (ret == MMSYSERR_NOERROR) { if ((wad = MSACM_GetDriver(had)) != 0) { was->obj.pACMDriverID = wad->obj.pACMDriverID; was->pDrv = wad; was->hAcmDriver = had; ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L); if (ret == MMSYSERR_NOERROR) { if (fdwOpen & ACM_STREAMOPENF_QUERY) { acmDriverClose(had, 0L); } break; } } acmDriverClose(had, 0L);*/ //if(MSACM_pFirstACMDriverID==NULL) // MSACM_RegisterAllDrivers(); for (wadi = MSACM_pFirstACMDriverID; wadi; wadi = wadi->pNextACMDriverID) { /* Check Format */ if ((int)wadi->wFormatTag != (int)pwfxSrc->wFormatTag) continue; ret = acmDriverOpen(&had, (HACMDRIVERID)wadi, 0L); if (ret == MMSYSERR_NOERROR) { if ((wad = MSACM_GetDriver(had)) != 0) { was->obj.pACMDriverID = wad->obj.pACMDriverID; was->pDrv = wad; was->hAcmDriver = had; ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L); //lhacm - crash printf("RETOPEN %d\n", ret); //ret = 0; if (ret == MMSYSERR_NOERROR) { if (fdwOpen & ACM_STREAMOPENF_QUERY) { acmDriverClose(had, 0L); } break; } } // no match, close this acm driver and try next one acmDriverClose(had, 0L); } } if (ret != MMSYSERR_NOERROR) { ret = ACMERR_NOTPOSSIBLE; goto errCleanUp; } } ret = MMSYSERR_NOERROR; if (!(fdwOpen & ACM_STREAMOPENF_QUERY)) { if (phas) *phas = (HACMSTREAM)was; TRACE("=> (%d)\n", ret); CodecAlloc(); return ret; } errCleanUp: if (phas) *phas = (HACMSTREAM)0; HeapFree(MSACM_hHeap, 0, was); TRACE("=> (%d)\n", ret); return ret; } MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose) { PWINE_ACMSTREAM was; MMRESULT ret; TRACE("(0x%08x, %ld)\n", has, fdwClose); if ((was = ACM_GetStream(has)) == NULL) { return MMSYSERR_INVALHANDLE; } ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_CLOSE, (DWORD)&was->drvInst, 0); if (ret == MMSYSERR_NOERROR) { if (was->hAcmDriver) acmDriverClose(was->hAcmDriver, 0L); HeapFree(MSACM_hHeap, 0, was); CodecRelease(); } TRACE("=> (%d)\n", ret); return ret; } /*********************************************************************** * acmStreamConvert (MSACM32.38) */ MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwConvert) { PWINE_ACMSTREAM was; MMRESULT ret = MMSYSERR_NOERROR; PACMDRVSTREAMHEADER padsh; TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwConvert); if ((was = ACM_GetStream(has)) == NULL) return MMSYSERR_INVALHANDLE; if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER)) return MMSYSERR_INVALPARAM; if (!(pash->fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED)) return ACMERR_UNPREPARED; /* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same * size. some fields are private to msacm internals, and are exposed * in ACMSTREAMHEADER in the dwReservedDriver array */ padsh = (PACMDRVSTREAMHEADER)pash; /* check that pointers have not been modified */ if (padsh->pbPreparedSrc != padsh->pbSrc || padsh->cbPreparedSrcLength < padsh->cbSrcLength || padsh->pbPreparedDst != padsh->pbDst || padsh->cbPreparedDstLength < padsh->cbDstLength) { return MMSYSERR_INVALPARAM; } padsh->fdwConvert = fdwConvert; ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_CONVERT, (DWORD)&was->drvInst, (DWORD)padsh); if (ret == MMSYSERR_NOERROR) { padsh->fdwStatus |= ACMSTREAMHEADER_STATUSF_DONE; } TRACE("=> (%d)\n", ret); return ret; } /*********************************************************************** * acmStreamPrepareHeader (MSACM32.41) */ MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwPrepare) { PWINE_ACMSTREAM was; MMRESULT ret = MMSYSERR_NOERROR; PACMDRVSTREAMHEADER padsh; TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwPrepare); if ((was = ACM_GetStream(has)) == NULL) return MMSYSERR_INVALHANDLE; if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER)) return MMSYSERR_INVALPARAM; if (fdwPrepare) ret = MMSYSERR_INVALFLAG; if (pash->fdwStatus & ACMSTREAMHEADER_STATUSF_DONE) return MMSYSERR_NOERROR; /* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same * size. some fields are private to msacm internals, and are exposed * in ACMSTREAMHEADER in the dwReservedDriver array */ padsh = (PACMDRVSTREAMHEADER)pash; padsh->fdwConvert = fdwPrepare; padsh->padshNext = NULL; padsh->fdwDriver = padsh->dwDriver = 0L; padsh->fdwPrepared = 0; padsh->dwPrepared = 0; padsh->pbPreparedSrc = 0; padsh->cbPreparedSrcLength = 0; padsh->pbPreparedDst = 0; padsh->cbPreparedDstLength = 0; ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_PREPARE, (DWORD)&was->drvInst, (DWORD)padsh); if (ret == MMSYSERR_NOERROR || ret == MMSYSERR_NOTSUPPORTED) { ret = MMSYSERR_NOERROR; padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE); padsh->fdwStatus |= ACMSTREAMHEADER_STATUSF_PREPARED; padsh->fdwPrepared = padsh->fdwStatus; padsh->dwPrepared = 0; padsh->pbPreparedSrc = padsh->pbSrc; padsh->cbPreparedSrcLength = padsh->cbSrcLength; padsh->pbPreparedDst = padsh->pbDst; padsh->cbPreparedDstLength = padsh->cbDstLength; } else { padsh->fdwPrepared = 0; padsh->dwPrepared = 0; padsh->pbPreparedSrc = 0; padsh->cbPreparedSrcLength = 0; padsh->pbPreparedDst = 0; padsh->cbPreparedDstLength = 0; } TRACE("=> (%d)\n", ret); return ret; } /*********************************************************************** * acmStreamReset (MSACM32.42) */ MMRESULT WINAPI acmStreamReset(HACMSTREAM has, DWORD fdwReset) { PWINE_ACMSTREAM was; MMRESULT ret = MMSYSERR_NOERROR; TRACE("(0x%08x, %ld)\n", has, fdwReset); if (fdwReset) { ret = MMSYSERR_INVALFLAG; } else if ((was = ACM_GetStream(has)) == NULL) { return MMSYSERR_INVALHANDLE; } else if (was->drvInst.fdwOpen & ACM_STREAMOPENF_ASYNC) { ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_RESET, (DWORD)&was->drvInst, 0); } TRACE("=> (%d)\n", ret); return ret; } /*********************************************************************** * acmStreamSize (MSACM32.43) */ MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput, LPDWORD pdwOutputBytes, DWORD fdwSize) { PWINE_ACMSTREAM was; ACMDRVSTREAMSIZE adss; MMRESULT ret; TRACE("(0x%08x, %ld, %p, %ld)\n", has, cbInput, pdwOutputBytes, fdwSize); if ((was = ACM_GetStream(has)) == NULL) { return MMSYSERR_INVALHANDLE; } if ((fdwSize & ~ACM_STREAMSIZEF_QUERYMASK) != 0) { return MMSYSERR_INVALFLAG; } *pdwOutputBytes = 0L; switch (fdwSize & ACM_STREAMSIZEF_QUERYMASK) { case ACM_STREAMSIZEF_DESTINATION: adss.cbDstLength = cbInput; adss.cbSrcLength = 0; break; case ACM_STREAMSIZEF_SOURCE: adss.cbSrcLength = cbInput; adss.cbDstLength = 0; break; default: return MMSYSERR_INVALFLAG; } adss.cbStruct = sizeof(adss); adss.fdwSize = fdwSize; ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_SIZE, (DWORD)&was->drvInst, (DWORD)&adss); if (ret == MMSYSERR_NOERROR) { switch (fdwSize & ACM_STREAMSIZEF_QUERYMASK) { case ACM_STREAMSIZEF_DESTINATION: *pdwOutputBytes = adss.cbSrcLength; break; case ACM_STREAMSIZEF_SOURCE: *pdwOutputBytes = adss.cbDstLength; break; } } TRACE("=> (%d) [%lu]\n", ret, *pdwOutputBytes); return ret; } /*********************************************************************** * acmStreamUnprepareHeader (MSACM32.44) */ MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwUnprepare) { PWINE_ACMSTREAM was; MMRESULT ret = MMSYSERR_NOERROR; PACMDRVSTREAMHEADER padsh; TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwUnprepare); if ((was = ACM_GetStream(has)) == NULL) return MMSYSERR_INVALHANDLE; if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER)) return MMSYSERR_INVALPARAM; if (!(pash->fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED)) return ACMERR_UNPREPARED; /* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same * size. some fields are private to msacm internals, and are exposed * in ACMSTREAMHEADER in the dwReservedDriver array */ padsh = (PACMDRVSTREAMHEADER)pash; /* check that pointers have not been modified */ if (padsh->pbPreparedSrc != padsh->pbSrc || padsh->cbPreparedSrcLength < padsh->cbSrcLength || padsh->pbPreparedDst != padsh->pbDst || padsh->cbPreparedDstLength < padsh->cbDstLength) { return MMSYSERR_INVALPARAM; } padsh->fdwConvert = fdwUnprepare; ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_UNPREPARE, (DWORD)&was->drvInst, (DWORD)padsh); if (ret == MMSYSERR_NOERROR || ret == MMSYSERR_NOTSUPPORTED) { ret = MMSYSERR_NOERROR; padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE|ACMSTREAMHEADER_STATUSF_PREPARED); } TRACE("=> (%d)\n", ret); return ret; } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/com.h0000644000175000017500000000341707540130662021260 0ustar yavoryavor#ifndef AVIFILE_COM_H #define AVIFILE_COM_H #ifdef HAVE_CONFIG_H #include #endif #ifdef HAVE_STDINT_H #include #else #include #endif /** * Internal functions and structures for COM emulation code. */ #ifndef WIN32 #ifdef __cplusplus extern "C" { #endif void* CoTaskMemAlloc(unsigned long cb); void CoTaskMemFree(void* cb); #ifndef GUID_TYPE #define GUID_TYPE typedef struct { uint32_t f1; uint16_t f2; uint16_t f3; uint8_t f4[8]; } GUID; #endif extern const GUID IID_IUnknown; extern const GUID IID_IClassFactory; typedef long (*GETCLASSOBJECT) (GUID* clsid, const GUID* iid, void** ppv); int RegisterComClass(const GUID* clsid, GETCLASSOBJECT gcs); int UnregisterComClass(const GUID* clsid, GETCLASSOBJECT gcs); #ifndef STDCALL #define STDCALL __attribute__((__stdcall__)) #endif struct IUnknown; struct IClassFactory; struct IUnknown_vt { long STDCALL (*QueryInterface)(struct IUnknown* _this, const GUID* iid, void** ppv); long STDCALL (*AddRef)(struct IUnknown* _this) ; long STDCALL (*Release)(struct IUnknown* _this) ; } ; typedef struct IUnknown { struct IUnknown_vt* vt; } IUnknown; struct IClassFactory_vt { long STDCALL (*QueryInterface)(struct IUnknown* _this, const GUID* iid, void** ppv); long STDCALL (*AddRef)(struct IUnknown* _this) ; long STDCALL (*Release)(struct IUnknown* _this) ; long STDCALL (*CreateInstance)(struct IClassFactory* _this, struct IUnknown* pUnkOuter, const GUID* riid, void** ppvObject); }; struct IClassFactory { struct IClassFactory_vt* vt; }; long CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter, long dwClsContext, const GUID* riid, void** ppv); #ifdef __cplusplus }; #endif /* __cplusplus */ #endif /* WIN32 */ #endif /* AVIFILE_COM_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/driver.c0000644000175000017500000000761407506634615022004 0ustar yavoryavor#include "config.h" #include "wine/driver.h" #include "wine/pe_image.h" #include "wine/winreg.h" #include "wine/vfw.h" #include "registry.h" #include "ldt_keeper.h" #include "ext.h" #include "driver.h" #include #include "win32.h" #include #ifdef HAVE_MALLOC_H #include #endif extern char* def_path; #if 1 /* * STORE_ALL/REST_ALL seems like an attempt to workaround problems due to * WINAPI/no-WINAPI bustage. * * There should be no need for the STORE_ALL/REST_ALL hack once all * function definitions agree with their prototypes (WINAPI-wise) and * we make sure, that we do not call these functions without a proper * prototype in scope. */ #define STORE_ALL #define REST_ALL #else // this asm code is no longer needed #define STORE_ALL \ __asm__ __volatile__ ( \ "push %%ebx\n\t" \ "push %%ecx\n\t" \ "push %%edx\n\t" \ "push %%esi\n\t" \ "push %%edi\n\t"::) #define REST_ALL \ __asm__ __volatile__ ( \ "pop %%edi\n\t" \ "pop %%esi\n\t" \ "pop %%edx\n\t" \ "pop %%ecx\n\t" \ "pop %%ebx\n\t"::) #endif static int needs_free=0; void SetCodecPath(const char* path) { if(needs_free)free(def_path); if(path==0) { def_path=WIN32_PATH; needs_free=0; return; } def_path = (char*) malloc(strlen(path)+1); strcpy(def_path, path); needs_free=1; } static DWORD dwDrvID = 0; LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT message, LPARAM lParam1, LPARAM lParam2) { DRVR* module=(DRVR*)hDriver; int result; #ifndef __svr4__ char qw[300]; #endif #ifdef DETAILED_OUT printf("SendDriverMessage: driver %X, message %X, arg1 %X, arg2 %X\n", hDriver, message, lParam1, lParam2); #endif if (!module || !module->hDriverModule || !module->DriverProc) return -1; #ifndef __svr4__ __asm__ __volatile__ ("fsave (%0)\n\t": :"r"(&qw)); #endif Setup_FS_Segment(); STORE_ALL; result=module->DriverProc(module->dwDriverID, hDriver, message, lParam1, lParam2); REST_ALL; #ifndef __svr4__ __asm__ __volatile__ ("frstor (%0)\n\t": :"r"(&qw)); #endif #ifdef DETAILED_OUT printf("\t\tResult: %X\n", result); #endif return result; } void DrvClose(HDRVR hDriver) { if (hDriver) { DRVR* d = (DRVR*)hDriver; if (d->hDriverModule) { Setup_FS_Segment(); if (d->DriverProc) { SendDriverMessage(hDriver, DRV_CLOSE, 0, 0); d->dwDriverID = 0; SendDriverMessage(hDriver, DRV_FREE, 0, 0); } FreeLibrary(d->hDriverModule); } free(d); } CodecRelease(); } //DrvOpen(LPCSTR lpszDriverName, LPCSTR lpszSectionName, LPARAM lParam2) HDRVR DrvOpen(LPARAM lParam2) { NPDRVR hDriver; int i; char unknown[0x124]; const char* filename = (const char*) ((ICOPEN*) lParam2)->pV1Reserved; hDriver = (NPDRVR) malloc(sizeof(DRVR)); if (!hDriver) return ((HDRVR) 0); memset((void*)hDriver, 0, sizeof(DRVR)); CodecAlloc(); Setup_FS_Segment(); hDriver->hDriverModule = LoadLibraryA(filename); if (!hDriver->hDriverModule) { printf("Can't open library %s\n", filename); DrvClose((HDRVR)hDriver); return ((HDRVR) 0); } hDriver->DriverProc = (DRIVERPROC) GetProcAddress(hDriver->hDriverModule, "DriverProc"); if (!hDriver->DriverProc) { printf("Library %s is not a valid VfW/ACM codec\n", filename); DrvClose((HDRVR)hDriver); return ((HDRVR) 0); } TRACE("DriverProc == %X\n", hDriver->DriverProc); SendDriverMessage((HDRVR)hDriver, DRV_LOAD, 0, 0); TRACE("DRV_LOAD Ok!\n"); SendDriverMessage((HDRVR)hDriver, DRV_ENABLE, 0, 0); TRACE("DRV_ENABLE Ok!\n"); hDriver->dwDriverID = ++dwDrvID; // generate new id // open driver and remmeber proper DriverID hDriver->dwDriverID = SendDriverMessage((HDRVR)hDriver, DRV_OPEN, (LPARAM) unknown, lParam2); TRACE("DRV_OPEN Ok!(%X)\n", hDriver->dwDriverID); printf("Loaded DLL driver %s\n", filename); return (HDRVR)hDriver; } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/driver.h0000644000175000017500000000050207506344015021766 0ustar yavoryavor#ifndef loader_driver_h #define loader_driver_h #ifdef __cplusplus extern "C" { #endif #include #include void SetCodecPath(const char* path); void CodecAlloc(void); void CodecRelease(void); HDRVR DrvOpen(LPARAM lParam2); void DrvClose(HDRVR hdrvr); #ifdef __cplusplus } #endif #endif avifile-0.7.48~20090503.ds/plugins/libwin32/loader/elfdll.c0000644000175000017500000001516607506610025021741 0ustar yavoryavor/* * Elf-dll loader functions * * Copyright 1999 Bertho A. Stultiens */ #include #ifdef HAVE_LIBDL #include #include #include #include #include #include //DEFAULT_DEBUG_CHANNEL(elfdll) #include #include #include #include #include //WINE_MODREF *local_wm=NULL; extern modref_list* local_wm; /*------------------ HACKS -----------------*/ extern DWORD fixup_imports(WINE_MODREF *wm); extern void dump_exports(HMODULE hModule); /*---------------- END HACKS ---------------*/ //char *extra_ld_library_path = "/usr/lib/win32"; extern char* def_path; struct elfdll_image { HMODULE pe_module_start; DWORD pe_module_size; }; /**************************************************************************** * ELFDLL_dlopen * * Wrapper for dlopen to search the EXTRA_LD_LIBRARY_PATH from wine.conf * manually because libdl.so caches the environment and does not accept our * changes. */ void *ELFDLL_dlopen(const char *libname, int flags) { char buffer[256]; int namelen; void *handle; char *ldpath; /* First try the default path search of dlopen() */ handle = dlopen(libname, flags); if(handle) return handle; /* Now try to construct searches through our extra search-path */ namelen = strlen(libname); ldpath = def_path; while(ldpath && *ldpath) { int len; char *cptr; char *from; from = ldpath; cptr = strchr(ldpath, ':'); if(!cptr) { len = strlen(ldpath); ldpath = NULL; } else { len = cptr - ldpath; ldpath = cptr + 1; } if(len + namelen + 1 >= sizeof(buffer)) { ERR("Buffer overflow! Check EXTRA_LD_LIBRARY_PATH or increase buffer size.\n"); return NULL; } strncpy(buffer, from, len); if(len) { buffer[len] = '/'; strcpy(buffer + len + 1, libname); } else strcpy(buffer + len, libname); TRACE("Trying dlopen('%s', %d)\n", buffer, flags); handle = dlopen(buffer, flags); if(handle) return handle; } return NULL; } /**************************************************************************** * get_sobasename (internal) * */ static LPSTR get_sobasename(LPCSTR path, LPSTR name) { char *cptr; /* Strip the path from the library name */ if((cptr = strrchr(path, '/'))) { char *cp = strrchr(cptr+1, '\\'); if(cp && cp > cptr) cptr = cp; } else cptr = strrchr(path, '\\'); if(!cptr) cptr = (char *)path; /* No '/' nor '\\' in path */ else cptr++; strcpy(name, cptr); cptr = strrchr(name, '.'); if(cptr) *cptr = '\0'; /* Strip extension */ /* Convert to lower case. * This must be done manually because it is not sure that * other modules are accessible. */ for(cptr = name; *cptr; cptr++) *cptr = tolower(*cptr); return name; } /**************************************************************************** * ELFDLL_CreateModref (internal) * * INPUT * hModule - the header from the elf-dll's data-segment * path - requested path from original call * * OUTPUT * A WINE_MODREF pointer to the new object * * BUGS * - Does not handle errors due to dependencies correctly * - path can be wrong */ #define RVA(base, va) (((DWORD)base) + ((DWORD)va)) static WINE_MODREF *ELFDLL_CreateModref(HMODULE hModule, LPCSTR path) { // IMAGE_NT_HEADERS *nt = PE_HEADER(hModule); IMAGE_DATA_DIRECTORY *dir; IMAGE_IMPORT_DESCRIPTOR *pe_import = NULL; WINE_MODREF *wm; int len; HANDLE procheap = GetProcessHeap(); wm = (WINE_MODREF *)HeapAlloc(procheap, HEAP_ZERO_MEMORY, sizeof(*wm)); if(!wm) return NULL; wm->module = hModule; wm->type = MODULE32_ELF; /* FIXME */ // dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_EXPORT; // if(dir->Size) // wm->binfmt.pe.pe_export = (PIMAGE_EXPORT_DIRECTORY)RVA(hModule, dir->VirtualAddress); // dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_IMPORT; // if(dir->Size) // pe_import = wm->binfmt.pe.pe_import = (PIMAGE_IMPORT_DESCRIPTOR)RVA(hModule, dir->VirtualAddress); // dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_RESOURCE; // if(dir->Size) // wm->binfmt.pe.pe_resource = (PIMAGE_RESOURCE_DIRECTORY)RVA(hModule, dir->VirtualAddress); wm->filename = (char*) malloc(strlen(path)+1); strcpy(wm->filename, path); wm->modname = strrchr( wm->filename, '\\' ); if (!wm->modname) wm->modname = wm->filename; else wm->modname++; /* len = GetShortPathNameA( wm->filename, NULL, 0 ); wm->short_filename = (char *)HeapAlloc( procheap, 0, len+1 ); GetShortPathNameA( wm->filename, wm->short_filename, len+1 ); wm->short_modname = strrchr( wm->short_filename, '\\' ); if (!wm->short_modname) wm->short_modname = wm->short_filename; else wm->short_modname++; */ /* Link MODREF into process list */ // EnterCriticalSection( &PROCESS_Current()->crit_section ); if(local_wm) { local_wm->next = (modref_list*) malloc(sizeof(modref_list)); local_wm->next->prev=local_wm; local_wm->next->next=NULL; local_wm->next->wm=wm; local_wm=local_wm->next; } else { local_wm = (modref_list*) malloc(sizeof(modref_list)); local_wm->next=local_wm->prev=NULL; local_wm->wm=wm; } // LeaveCriticalSection( &PROCESS_Current()->crit_section ); return wm; } /**************************************************************************** * ELFDLL_LoadLibraryExA (internal) * * Implementation of elf-dll loading for PE modules */ WINE_MODREF *ELFDLL_LoadLibraryExA(LPCSTR path, DWORD flags) { LPVOID dlhandle; struct elfdll_image *image; char name[129]; char soname[129]; WINE_MODREF *wm; get_sobasename(path, name); strcpy(soname, name); strcat(soname, ".so"); /* Try to open the elf-dll */ dlhandle = ELFDLL_dlopen(soname, RTLD_LAZY); if(!dlhandle) { WARN("Could not load %s (%s)\n", soname, dlerror()); SetLastError( ERROR_FILE_NOT_FOUND ); return NULL; } /* Get the 'dllname_elfdll_image' variable */ /* strcpy(soname, name); strcat(soname, "_elfdll_image"); image = (struct elfdll_image *)dlsym(dlhandle, soname); if(!image) { ERR("Could not get elfdll image descriptor %s (%s)\n", soname, dlerror()); dlclose(dlhandle); SetLastError( ERROR_BAD_FORMAT ); return NULL; } */ wm = ELFDLL_CreateModref((int)dlhandle, path); if(!wm) { ERR("Could not create WINE_MODREF for %s\n", path); dlclose(dlhandle); SetLastError( ERROR_OUTOFMEMORY ); return NULL; } return wm; } /**************************************************************************** * ELFDLL_UnloadLibrary (internal) * * Unload an elf-dll completely from memory and deallocate the modref */ void ELFDLL_UnloadLibrary(WINE_MODREF *wm) { } #endif /*HAVE_LIBDL*/ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/ext.c0000644000175000017500000003173007506610025021272 0ustar yavoryavor/******************************************************** * * * Stub functions for Wine module * * ********************************************************/ #include "config.h" #include #include #ifdef HAVE_MALLOC_H #include #endif #include #include #include #include #include #include #include #include #include #include #include #include "ext.h" #if 0 //REMOVE SIMPLIFY static void* mymalloc(unsigned int size) { printf("malloc %d\n", size); return malloc(size); } #undef malloc #define malloc mymalloc #endif int dbg_header_err( const char *dbg_channel, const char *func ) { return 0; } int dbg_header_warn( const char *dbg_channel, const char *func ) { return 0; } int dbg_header_fixme( const char *dbg_channel, const char *func ) { return 0; } int dbg_header_trace( const char *dbg_channel, const char *func ) { return 0; } int dbg_vprintf( const char *format, va_list args ) { return 0; } int __vprintf( const char *format, ... ) { #ifdef DETAILED_OUT va_list va; va_start(va, format); vprintf(format, va); va_end(va); #endif return 0; } HANDLE WINAPI GetProcessHeap(void) { return 1; } LPVOID WINAPI HeapAlloc(HANDLE heap, DWORD flags, DWORD size) { static int i = 5; void* m = (flags & 0x8) ? calloc(size, 1) : malloc(size); //printf("HeapAlloc %p %d (%d)\n", m, size, flags); //if (--i == 0) // abort(); return m; } WIN_BOOL WINAPI HeapFree(HANDLE heap, DWORD flags, LPVOID mem) { if (mem) free(mem); //printf("HeapFree %p\n", mem); //if (!mem) // abort(); return 1; } static int last_error; DWORD WINAPI GetLastError(void) { return last_error; } VOID WINAPI SetLastError(DWORD error) { last_error=error; } WIN_BOOL WINAPI ReadFile(HANDLE handle, LPVOID mem, DWORD size, LPDWORD result, LPOVERLAPPED flags) { *result=read(handle, mem, size); return *result; } INT WINAPI lstrcmpiA(LPCSTR c1, LPCSTR c2) { return strcasecmp(c1,c2); } LPSTR WINAPI lstrcpynA(LPSTR dest, LPCSTR src, INT num) { return strncpy(dest,src,num); } INT WINAPI lstrlenA(LPCSTR s) { return strlen(s); } INT WINAPI lstrlenW(LPCWSTR s) { int l; if(!s) return 0; l=0; while(s[l]) l++; return l; } LPSTR WINAPI lstrcpynWtoA(LPSTR dest, LPCWSTR src, INT count) { LPSTR result = dest; int moved=0; if((dest==0) || (src==0)) return 0; while(moved0) { if (((*s1 | *s2) & 0xff00) || toupper((char)*s1) != toupper((char)*s2)) { if(*s1<*s2) return -1; else if(*s1>*s2) return 1; else if(*s1==0) return 0; } s1++; s2++; n--; } return 0; } WIN_BOOL WINAPI IsBadReadPtr(LPCVOID data, UINT size) { if(size==0) return 0; if(data==NULL) return 1; return 0; } LPSTR HEAP_strdupA(HANDLE heap, DWORD flags, LPCSTR string) { // return strdup(string); char* answ = (char*) malloc(strlen(string) + 1); strcpy(answ, string); return answ; } LPWSTR HEAP_strdupAtoW(HANDLE heap, DWORD flags, LPCSTR string) { int size, i; WCHAR* answer; if(string==0) return 0; size=strlen(string); answer = (WCHAR*) malloc(sizeof(WCHAR) * (size + 1)); for(i=0; i<=size; i++) answer[i]=(short)string[i]; return answer; } LPSTR HEAP_strdupWtoA(HANDLE heap, DWORD flags, LPCWSTR string) { int size, i; char* answer; if(string==0) return 0; size=0; while(string[size]) size++; answer = (char*) malloc(size + 2); for(i=0; i<=size; i++) answer[i]=(char)string[i]; return answer; } /*********************************************************************** * FILE_dommap */ //#define MAP_PRIVATE //#define MAP_SHARED #undef MAP_ANON LPVOID FILE_dommap( int unix_handle, LPVOID start, DWORD size_high, DWORD size_low, DWORD offset_high, DWORD offset_low, int prot, int flags ) { int fd = -1; int pos; LPVOID ret; if (size_high || offset_high) printf("offsets larger than 4Gb not supported\n"); if (unix_handle == -1) { #ifdef MAP_ANON // printf("Anonymous\n"); flags |= MAP_ANON; #else static int fdzero = -1; if (fdzero == -1) { if ((fdzero = open( "/dev/zero", O_RDONLY )) == -1) { perror( "Cannot open /dev/zero for READ. Check permissions! error: " ); exit(1); } } fd = fdzero; #endif /* MAP_ANON */ /* Linux EINVAL's on us if we don't pass MAP_PRIVATE to an anon mmap */ #ifdef MAP_SHARED flags &= ~MAP_SHARED; #endif #ifdef MAP_PRIVATE flags |= MAP_PRIVATE; #endif } else fd = unix_handle; // printf("fd %x, start %x, size %x, pos %x, prot %x\n",fd,start,size_low, offset_low, prot); // if ((ret = mmap( start, size_low, prot, // flags, fd, offset_low )) != (LPVOID)-1) if ((ret = mmap( start, size_low, prot, MAP_PRIVATE | MAP_FIXED, fd, offset_low )) != (LPVOID)-1) { // printf("address %08x\n", *(int*)ret); // printf("%x\n", ret); return ret; } // printf("mmap %d\n", errno); /* mmap() failed; if this is because the file offset is not */ /* page-aligned (EINVAL), or because the underlying filesystem */ /* does not support mmap() (ENOEXEC), we do it by hand. */ if (unix_handle == -1) return ret; if ((errno != ENOEXEC) && (errno != EINVAL)) return ret; if (prot & PROT_WRITE) { /* We cannot fake shared write mappings */ #ifdef MAP_SHARED if (flags & MAP_SHARED) return ret; #endif #ifdef MAP_PRIVATE if (!(flags & MAP_PRIVATE)) return ret; #endif } /* printf( "FILE_mmap: mmap failed (%d), faking it\n", errno );*/ /* Reserve the memory with an anonymous mmap */ ret = FILE_dommap( -1, start, size_high, size_low, 0, 0, PROT_READ | PROT_WRITE, flags ); if (ret == (LPVOID)-1) // { // perror( return ret; /* Now read in the file */ if ((pos = lseek( fd, offset_low, SEEK_SET )) == -1) { FILE_munmap( ret, size_high, size_low ); // printf("lseek\n"); return (LPVOID)-1; } read( fd, ret, size_low ); lseek( fd, pos, SEEK_SET ); /* Restore the file pointer */ mprotect( ret, size_low, prot ); /* Set the right protection */ // printf("address %08x\n", *(int*)ret); return ret; } /*********************************************************************** * FILE_munmap */ int FILE_munmap( LPVOID start, DWORD size_high, DWORD size_low ) { if (size_high) printf("offsets larger than 4Gb not supported\n"); return munmap( start, size_low ); } static int mapping_size=0; struct file_mapping_s; typedef struct file_mapping_s { int mapping_size; char* name; LPVOID handle; struct file_mapping_s* next; struct file_mapping_s* prev; }file_mapping; static file_mapping* fm=0; #define PAGE_NOACCESS 0x01 #define PAGE_READONLY 0x02 #define PAGE_READWRITE 0x04 #define PAGE_WRITECOPY 0x08 #define PAGE_EXECUTE 0x10 #define PAGE_EXECUTE_READ 0x20 #define PAGE_EXECUTE_READWRITE 0x40 #define PAGE_EXECUTE_WRITECOPY 0x80 #define PAGE_GUARD 0x100 #define PAGE_NOCACHE 0x200 HANDLE WINAPI CreateFileMappingA(HANDLE handle, LPSECURITY_ATTRIBUTES lpAttr, DWORD flProtect, DWORD dwMaxHigh, DWORD dwMaxLow, LPCSTR name) { int hFile = (int)handle; unsigned int len; LPVOID answer; int anon=0; int mmap_access=0; if(hFile<0) { anon=1; hFile=open("/dev/zero", O_RDWR); if(hFile<0){ perror( "Cannot open /dev/zero for READ+WRITE. Check permissions! error: " ); return 0; } } if(!anon) { len=lseek(hFile, 0, SEEK_END); lseek(hFile, 0, SEEK_SET); } else len=dwMaxLow; if(flProtect & PAGE_READONLY) mmap_access |=PROT_READ; else mmap_access |=PROT_READ|PROT_WRITE; answer=mmap(NULL, len, mmap_access, MAP_PRIVATE, hFile, 0); if(anon) close(hFile); if(answer!=(LPVOID)-1) { if(fm==0) { fm = (file_mapping*) malloc(sizeof(file_mapping)); fm->prev=NULL; } else { fm->next = (file_mapping*) malloc(sizeof(file_mapping)); fm->next->prev=fm; fm=fm->next; } fm->next=NULL; fm->handle=answer; if(name) { fm->name = (char*) malloc(strlen(name)+1); strcpy(fm->name, name); } else fm->name=NULL; fm->mapping_size=len; if(anon) close(hFile); return (HANDLE)answer; } return (HANDLE)0; } WIN_BOOL WINAPI UnmapViewOfFile(LPVOID handle) { file_mapping* p; int result; if(fm==0) return 0; for(p=fm; p; p=p->next) { if(p->handle==handle) { result=munmap((void*)handle, p->mapping_size); if(p->next)p->next->prev=p->prev; if(p->prev)p->prev->next=p->next; if(p->name) free(p->name); if(p==fm) fm=p->prev; free(p); return result; } } return 0; } //static int va_size=0; struct virt_alloc_s; typedef struct virt_alloc_s { int mapping_size; char* address; struct virt_alloc_s* next; struct virt_alloc_s* prev; int state; }virt_alloc; static virt_alloc* vm=0; #define MEM_COMMIT 0x00001000 #define MEM_RESERVE 0x00002000 LPVOID WINAPI VirtualAlloc(LPVOID address, DWORD size, DWORD type, DWORD protection) { void* answer; int fd=open("/dev/zero", O_RDWR); if(fd<0){ perror( "Cannot open /dev/zero for READ+WRITE. Check permissions! error: " ); return NULL; } size=(size+0xffff)&(~0xffff); //printf("VirtualAlloc(0x%08X, %d)\n", address, size); if(address!=0) { //check whether we can allow to allocate this virt_alloc* str=vm; while(str) { if((unsigned)address>=(unsigned)str->address+str->mapping_size) { str=str->prev; continue; } if((unsigned)address+size<(unsigned)str->address) { str=str->prev; continue; } if(str->state==0) { #warning FIXME if(((unsigned)address+size<(unsigned)str->address+str->mapping_size) && (type & MEM_COMMIT)) { close(fd); return address; //returning previously reserved memory } return NULL; } close(fd); return NULL; } answer=mmap(address, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_FIXED | MAP_PRIVATE, fd, 0); } else answer=mmap(address, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0); // answer=FILE_dommap(-1, address, 0, size, 0, 0, // PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE); close(fd); if(answer==(void*)-1) { printf("Error no %d\n", errno); printf("VirtualAlloc(0x%p, %ld) failed\n", address, size); return NULL; } else { virt_alloc *new_vm = (virt_alloc*) malloc(sizeof(virt_alloc)); new_vm->mapping_size=size; new_vm->address=(char*)answer; new_vm->prev=vm; if(type == MEM_RESERVE) new_vm->state=0; else new_vm->state=1; if(vm) vm->next=new_vm; vm=new_vm; vm->next=0; //if(va_size!=0) // printf("Multiple VirtualAlloc!\n"); //printf("answer=0x%08x\n", answer); return answer; } } WIN_BOOL WINAPI VirtualFree(LPVOID address, SIZE_T dwSize, DWORD dwFreeType)//not sure { virt_alloc* str=vm; int answer; while(str) { if(address!=str->address) { str=str->prev; continue; } //printf("VirtualFree(0x%08X, %d - %d)\n", str->address, dwSize, str->mapping_size); answer=munmap(str->address, str->mapping_size); if(str->next)str->next->prev=str->prev; if(str->prev)str->prev->next=str->next; if(vm==str)vm=str->prev; free(str); return 0; } return -1; } INT WINAPI WideCharToMultiByte(UINT codepage, DWORD flags, LPCWSTR src, INT srclen,LPSTR dest, INT destlen, LPCSTR defch, WIN_BOOL* used_defch) { int i; if(src==0) return 0; if ((srclen==-1)&&(dest==0)) return 0; if(srclen==-1){srclen=0; while(src[srclen++]);} // for(i=0; iprev) { if(p->name==0) continue; if(strcmp(p->name, name)==0) return (HANDLE)p->handle; } return 0; } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/ext.h0000644000175000017500000000070007360352015021270 0ustar yavoryavor#ifndef loader_ext_h #define loader_ext_h #include extern LPVOID FILE_dommap( int unix_handle, LPVOID start, DWORD size_high, DWORD size_low, DWORD offset_high, DWORD offset_low, int prot, int flags ); extern int FILE_munmap( LPVOID start, DWORD size_high, DWORD size_low ); extern int wcsnicmp(const unsigned short* s1, const unsigned short* s2, int n); extern int __vprintf( const char *format, ... ); #endif avifile-0.7.48~20090503.ds/plugins/libwin32/loader/ldt_keeper.c0000644000175000017500000001535310036764207022617 0ustar yavoryavor/** * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * This file MUST be in main library because LDT must * be modified before program creates first thread * - avifile includes this file from C++ code * and initializes it at the start of player! * it might sound like a hack and it really is - but * as aviplay is deconding video with more than just one * thread currently it's necessary to do it this way * this might change in the future */ /* applied some modification to make make our xine friend more happy */ #include "ldt_keeper.h" #include #include #include #include #include #include #include #include #ifdef __linux__ #include #include // 2.5.xx+ calls this user_desc: #include #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,47) #define modify_ldt_ldt_s user_desc #endif /* prototype it here, so we won't depend on kernel headers */ #ifdef __cplusplus extern "C" { #endif int modify_ldt(int func, void *ptr, unsigned long bytecount); #ifdef __cplusplus } #endif #else #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) #include #include #endif #ifdef __svr4__ #include #include /* solaris x86: add missing prototype for sysi86() */ #ifdef __cplusplus extern "C" { #endif int sysi86(int, void*); #ifdef __cplusplus } #endif #ifndef NUMSYSLDTS /* SunOS 2.5.1 does not define NUMSYSLDTS */ #define NUMSYSLDTS 6 /* Let's hope the SunOS 5.8 value is OK */ #endif #define TEB_SEL_IDX NUMSYSLDTS #endif #define LDT_ENTRIES 8192 #define LDT_ENTRY_SIZE 8 #pragma pack(4) struct modify_ldt_ldt_s { unsigned int entry_number; unsigned long base_addr; unsigned int limit; unsigned int seg_32bit:1; unsigned int contents:2; unsigned int read_exec_only:1; unsigned int limit_in_pages:1; unsigned int seg_not_present:1; unsigned int useable:1; }; #define MODIFY_LDT_CONTENTS_DATA 0 #define MODIFY_LDT_CONTENTS_STACK 1 #define MODIFY_LDT_CONTENTS_CODE 2 #endif /* user level (privilege level: 3) ldt (1<<2) segment selector */ #define LDT_SEL(idx) ((idx) << 3 | 1 << 2 | 3) /* i got this value from wine sources, it's the first free LDT entry */ #ifndef TEB_SEL_IDX #define TEB_SEL_IDX 17 #endif #define TEB_SEL LDT_SEL(TEB_SEL_IDX) /** * here is a small logical problem with Restore for multithreaded programs - * in C++ we use static class for this... */ #ifdef __cplusplus extern "C" #endif void Setup_FS_Segment(void) { __asm__ __volatile__( "movl %0,%%eax; movw %%ax, %%fs" : : "i" (TEB_SEL) ); } /* we don't need this - use modify_ldt instead */ #if 0 #ifdef __linux__ /* XXX: why is this routine from libc redefined here? */ /* NOTE: the redefined version ignores the count param, count is hardcoded as 16 */ static int LDT_Modify( int func, struct modify_ldt_ldt_s *ptr, unsigned long count ) { int res; #ifdef __PIC__ __asm__ __volatile__( "pushl %%ebx\n\t" "movl %2,%%ebx\n\t" "int $0x80\n\t" "popl %%ebx" : "=a" (res) : "0" (__NR_modify_ldt), "r" (func), "c" (ptr), "d"(16)//sizeof(*ptr) from kernel point of view :"esi" ); #else __asm__ __volatile__("int $0x80" : "=a" (res) : "0" (__NR_modify_ldt), "b" (func), "c" (ptr), "d"(16) :"esi"); #endif /* __PIC__ */ if (res >= 0) return res; errno = -res; return -1; } #endif #endif #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) static void LDT_EntryToBytes( unsigned long *buffer, const struct modify_ldt_ldt_s *content ) { *buffer++ = ((content->base_addr & 0x0000ffff) << 16) | (content->limit & 0x0ffff); *buffer = (content->base_addr & 0xff000000) | ((content->base_addr & 0x00ff0000)>>16) | (content->limit & 0xf0000) | (content->contents << 10) | ((content->read_exec_only == 0) << 9) | ((content->seg_32bit != 0) << 22) | ((content->limit_in_pages != 0) << 23) | 0xf000; } #endif ldt_fs_t* Setup_LDT_Keeper(void) { struct modify_ldt_ldt_s array; int ret; ldt_fs_t* ldt_fs = (ldt_fs_t*) malloc(sizeof(ldt_fs_t)); if (!ldt_fs) return NULL; ldt_fs->fd = open("/dev/zero", O_RDWR); if(ldt_fs->fd<0){ perror( "Cannot open /dev/zero for READ+WRITE. Check permissions! error: "); return NULL; } ldt_fs->fs_seg = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE, ldt_fs->fd, 0); if (ldt_fs->fs_seg == (void*)-1) { perror("ERROR: Couldn't allocate memory for fs segment"); close(ldt_fs->fd); free(ldt_fs); return NULL; } memset(&array, 0, sizeof(array)); *(void**)((char*)ldt_fs->fs_seg+0x18) = ldt_fs->fs_seg; array.base_addr=(int)ldt_fs->fs_seg; array.entry_number=TEB_SEL_IDX; array.limit=array.base_addr+getpagesize()-1; array.seg_32bit=1; array.read_exec_only=0; array.seg_not_present=0; array.contents=MODIFY_LDT_CONTENTS_DATA; array.limit_in_pages=0; #ifdef __linux__ //ret=LDT_Modify(0x1, &array, sizeof(struct modify_ldt_ldt_s)); ret=modify_ldt(0x1, &array, sizeof(struct modify_ldt_ldt_s)); if(ret<0) { perror("install_fs"); printf("Couldn't install fs segment, expect segfault\n"); } #endif /*linux*/ #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) { unsigned long d[2]; LDT_EntryToBytes( d, &array ); ret = i386_set_ldt(array.entry_number, (union descriptor *)d, 1); if (ret < 0) { perror("install_fs"); printf("Couldn't install fs segment, expect segfault\n"); printf("Did you reconfigure the kernel with \"options USER_LDT\"?\n"); } } #endif /* __NetBSD__ || __FreeBSD__ || __OpenBSD__ */ #if defined(__svr4__) { struct ssd ssd; ssd.sel = TEB_SEL; ssd.bo = array.base_addr; ssd.ls = array.limit - array.base_addr; ssd.acc1 = ((array.read_exec_only == 0) << 1) | (array.contents << 2) | 0xf0; /* P(resent) | DPL3 | S */ ssd.acc2 = 0x4; /* byte limit, 32-bit segment */ if (sysi86(SI86DSCR, &ssd) < 0) { perror("sysi86(SI86DSCR)"); printf("Couldn't install fs segment, expect segfault\n"); } } #endif Setup_FS_Segment(); ldt_fs->prev_struct = (char*)malloc(sizeof(char) * 8); *(void**)array.base_addr = ldt_fs->prev_struct; return ldt_fs; } void Restore_LDT_Keeper(ldt_fs_t* ldt_fs) { if (ldt_fs == NULL || ldt_fs->fs_seg == 0) return; if (ldt_fs->prev_struct) free(ldt_fs->prev_struct); munmap((char*)ldt_fs->fs_seg, getpagesize()); ldt_fs->fs_seg = 0; close(ldt_fs->fd); free(ldt_fs); } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/ldt_keeper.h0000644000175000017500000000050107446066563022624 0ustar yavoryavor#ifndef LDT_KEEPER_H #define LDT_KEEPER_H #ifdef __cplusplus extern "C" { #endif typedef struct { void* fs_seg; char* prev_struct; int fd; } ldt_fs_t; void Setup_FS_Segment(void); ldt_fs_t* Setup_LDT_Keeper(void); void Restore_LDT_Keeper(ldt_fs_t* ldt_fs); #ifdef __cplusplus } #endif #endif /* LDT_KEEPER_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/loader.h0000644000175000017500000000414507512250762021752 0ustar yavoryavor/******************************************************** Win32 binary loader interface Copyright 2000 Eugene Kuznetsov (divx@euro.ru) Shamelessly stolen from Wine project *********************************************************/ #ifndef _LOADER_H #define _LOADER_H #ifdef __cplusplus extern "C" { #endif #include #include #include #include #include #define ICSendMessage SendDriverMessage unsigned int _GetPrivateProfileIntA(const char* appname, const char* keyname, int default_value, const char* filename); int _GetPrivateProfileStringA(const char* appname, const char* keyname, const char* def_val, char* dest, unsigned int len, const char* filename); int _WritePrivateProfileStringA(const char* appname, const char* keyname, const char* string, const char* filename); /********************************************** extra MS VFW ( Video For Windows ) interface **********************************************/ long VFWAPIV ICUniversalEx(HIC hic, int command, long dwFlags, LPBITMAPINFOHEADER lpbiFormat, const void* lpData, LPBITMAPINFOHEADER lpbi, void* lpBits); WIN_BOOL VFWAPI ICInfo(long fccType, long fccHandler, ICINFO * lpicinfo); HIC VFWAPI ICOpen(long fccType, long fccHandler, UINT wMode); HIC VFWAPI ICOpenFunction(long fccType, long fccHandler, unsigned int wMode, void* lpfnHandler); HIC VFWAPI ICLocate(long fccType, long fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, short wFlags); INT WINAPI LoadStringA( HINSTANCE instance, UINT resource_id, LPSTR buffer, INT buflen ); #define ICGetInfo(hic, picinfo) \ ICSendMessage(hic, ICM_GETINFO, (long)picinfo, sizeof(*picinfo)) #define ICGetState(hic, pcstate, cb) \ ICSendMessage(hic, ICM_GETSTATE, (long)pcstate, cb) #define ICSetState(hic, pcstate, cb) \ ICSendMessage(hic, ICM_SETSTATE, (long)pcstate, cb) #define ICCompressFramesInfo(hic, picf) \ ICSendMessage(hic, ICM_COMPRESS_FRAMES_INFO, (long)picf, sizeof(*picf)) #ifdef __cplusplus } #endif #endif /* __LOADER_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/module.c0000644000175000017500000003241507506610025021760 0ustar yavoryavor/* * Modules * * Copyright 1995 Alexandre Julliard */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_LIBDL #include #include #endif #include "win32.h" #include "driver.h" //#undef TRACE //#define TRACE printf //WINE_MODREF *local_wm=NULL; modref_list* local_wm=NULL; HANDLE SegptrHeap; WINE_MODREF* MODULE_FindModule(LPCSTR m) { modref_list* list=local_wm; TRACE("Module %s request\n", m); if(list==NULL) return NULL; while(strcmp(m, list->wm->filename)) { TRACE("%s: %x\n", list->wm->filename, list->wm->module); list=list->prev; if(list==NULL) return NULL; } TRACE("Resolved to %s\n", list->wm->filename); return list->wm; } static void MODULE_RemoveFromList(WINE_MODREF *mod) { modref_list* list=local_wm; if(list==0) return; if(mod==0) return; if((list->prev==NULL)&&(list->next==NULL)) { free(list); local_wm=NULL; // uninstall_fs(); return; } for(;list;list=list->prev) { if(list->wm==mod) { if(list->prev) list->prev->next=list->next; if(list->next) list->next->prev=list->prev; if(list==local_wm) local_wm=list->prev; free(list); return; } } } WINE_MODREF *MODULE32_LookupHMODULE(HMODULE m) { modref_list* list=local_wm; TRACE("Module %X request\n", m); if(list==NULL) return NULL; while(m!=list->wm->module) { // printf("Checking list %X wm %X module %X\n", // list, list->wm, list->wm->module); list=list->prev; if(list==NULL) return NULL; } TRACE("LookupHMODULE hit %p\n", list->wm); return list->wm; } /************************************************************************* * MODULE_InitDll */ static WIN_BOOL MODULE_InitDll( WINE_MODREF *wm, DWORD type, LPVOID lpReserved ) { WIN_BOOL retv = TRUE; static LPCSTR typeName[] = { "PROCESS_DETACH", "PROCESS_ATTACH", "THREAD_ATTACH", "THREAD_DETACH" }; assert( wm ); /* Skip calls for modules loaded with special load flags */ if ( ( wm->flags & WINE_MODREF_DONT_RESOLVE_REFS ) || ( wm->flags & WINE_MODREF_LOAD_AS_DATAFILE ) ) return TRUE; TRACE("(%s,%s,%p) - CALL\n", wm->modname, typeName[type], lpReserved ); /* Call the initialization routine */ switch ( wm->type ) { case MODULE32_PE: retv = PE_InitDLL( wm, type, lpReserved ); break; case MODULE32_ELF: /* no need to do that, dlopen() already does */ break; default: ERR("wine_modref type %d not handled.\n", wm->type ); retv = FALSE; break; } /* The state of the module list may have changed due to the call to PE_InitDLL. We cannot assume that this module has not been deleted. */ TRACE("(%p,%s,%p) - RETURN %d\n", wm, typeName[type], lpReserved, retv ); return retv; } /************************************************************************* * MODULE_DllProcessAttach * * Send the process attach notification to all DLLs the given module * depends on (recursively). This is somewhat complicated due to the fact that * * - we have to respect the module dependencies, i.e. modules implicitly * referenced by another module have to be initialized before the module * itself can be initialized * * - the initialization routine of a DLL can itself call LoadLibrary, * thereby introducing a whole new set of dependencies (even involving * the 'old' modules) at any time during the whole process * * (Note that this routine can be recursively entered not only directly * from itself, but also via LoadLibrary from one of the called initialization * routines.) * * Furthermore, we need to rearrange the main WINE_MODREF list to allow * the process *detach* notifications to be sent in the correct order. * This must not only take into account module dependencies, but also * 'hidden' dependencies created by modules calling LoadLibrary in their * attach notification routine. * * The strategy is rather simple: we move a WINE_MODREF to the head of the * list after the attach notification has returned. This implies that the * detach notifications are called in the reverse of the sequence the attach * notifications *returned*. * * NOTE: Assumes that the process critical section is held! * */ static WIN_BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved ) { WIN_BOOL retv = TRUE; int i; assert( wm ); /* prevent infinite recursion in case of cyclical dependencies */ if ( ( wm->flags & WINE_MODREF_MARKER ) || ( wm->flags & WINE_MODREF_PROCESS_ATTACHED ) ) return retv; TRACE("(%s,%p) - START\n", wm->modname, lpReserved ); /* Tag current MODREF to prevent recursive loop */ wm->flags |= WINE_MODREF_MARKER; /* Recursively attach all DLLs this one depends on */ /* for ( i = 0; retv && i < wm->nDeps; i++ ) if ( wm->deps[i] ) retv = MODULE_DllProcessAttach( wm->deps[i], lpReserved ); */ /* Call DLL entry point */ //local_wm=wm; if(local_wm) { local_wm->next = (modref_list*) malloc(sizeof(modref_list)); local_wm->next->prev=local_wm; local_wm->next->next=NULL; local_wm->next->wm=wm; local_wm=local_wm->next; } else { local_wm = (modref_list*)malloc(sizeof(modref_list)); local_wm->next=local_wm->prev=NULL; local_wm->wm=wm; } /* Remove recursion flag */ wm->flags &= ~WINE_MODREF_MARKER; if ( retv ) { retv = MODULE_InitDll( wm, DLL_PROCESS_ATTACH, lpReserved ); if ( retv ) wm->flags |= WINE_MODREF_PROCESS_ATTACHED; } TRACE("(%s,%p) - END\n", wm->modname, lpReserved ); return retv; } /************************************************************************* * MODULE_DllProcessDetach * * Send DLL process detach notifications. See the comment about calling * sequence at MODULE_DllProcessAttach. Unless the bForceDetach flag * is set, only DLLs with zero refcount are notified. */ static void MODULE_DllProcessDetach( WINE_MODREF* wm, WIN_BOOL bForceDetach, LPVOID lpReserved ) { // WINE_MODREF *wm=local_wm; modref_list* l = local_wm; wm->flags &= ~WINE_MODREF_PROCESS_ATTACHED; MODULE_InitDll( wm, DLL_PROCESS_DETACH, lpReserved ); /* while (l) { modref_list* f = l; l = l->next; free(f); } local_wm = 0;*/ } /*********************************************************************** * MODULE_LoadLibraryExA (internal) * * Load a PE style module according to the load order. * * The HFILE parameter is not used and marked reserved in the SDK. I can * only guess that it should force a file to be mapped, but I rather * ignore the parameter because it would be extremely difficult to * integrate this with different types of module represenations. * */ static WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags ) { DWORD err = GetLastError(); WINE_MODREF *pwm; int i; // module_loadorder_t *plo; SetLastError( ERROR_FILE_NOT_FOUND ); TRACE("Trying native dll '%s'\n", libname); pwm = PE_LoadLibraryExA(libname, flags); #ifdef HAVE_LIBDL if(!pwm) { TRACE("Trying ELF dll '%s'\n", libname); pwm=(WINE_MODREF*)ELFDLL_LoadLibraryExA(libname, flags); } #endif // printf("0x%08x\n", pwm); // break; if(pwm) { /* Initialize DLL just loaded */ TRACE("Loaded module '%s' at 0x%08x, \n", libname, pwm->module); /* Set the refCount here so that an attach failure will */ /* decrement the dependencies through the MODULE_FreeLibrary call. */ pwm->refCount++; SetLastError( err ); /* restore last error */ return pwm; } WARN("Failed to load module '%s'; error=0x%08lx, \n", libname, GetLastError()); return NULL; } /*********************************************************************** * MODULE_FreeLibrary * * NOTE: Assumes that the process critical section is held! */ static WIN_BOOL MODULE_FreeLibrary( WINE_MODREF *wm ) { TRACE("(%s) - START\n", wm->modname ); /* Recursively decrement reference counts */ //MODULE_DecRefCount( wm ); /* Call process detach notifications */ MODULE_DllProcessDetach( wm, FALSE, NULL ); PE_UnloadLibrary(wm); TRACE("END\n"); return TRUE; } /*********************************************************************** * LoadLibraryExA (KERNEL32) */ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) { WINE_MODREF *wm = 0; char* listpath[] = { "", "", "/usr/lib/win32", "/usr/local/lib/win32", 0 }; extern char* def_path; char path[512]; char checked[2000]; int i = -1; checked[0] = 0; if(!libname) { SetLastError(ERROR_INVALID_PARAMETER); return 0; } // if(fs_installed==0) // install_fs(); while (wm == 0 && listpath[++i]) { if (i < 2) { if (i == 0) /* check just original file name */ strncpy(path, libname, 511); else /* check default user path */ strncpy(path, def_path, 300); } else if (strcmp(def_path, listpath[i])) /* path from the list */ strncpy(path, listpath[i], 300); else continue; if (i > 0) { strcat(path, "/"); strncat(path, libname, 100); } path[511] = 0; wm = MODULE_LoadLibraryExA( path, hfile, flags ); if (!wm) { if (checked[0]) strcat(checked, ", "); strcat(checked, path); checked[1500] = 0; } } if ( wm ) { if ( !MODULE_DllProcessAttach( wm, NULL ) ) { WARN_(module)("Attach failed for module '%s', \n", libname); MODULE_FreeLibrary(wm); SetLastError(ERROR_DLL_INIT_FAILED); MODULE_RemoveFromList(wm); wm = NULL; } } if (!wm) printf("Win32 LoadLibrary failed to load: %s\n", checked); return wm ? wm->module : 0; } /*********************************************************************** * LoadLibraryA (KERNEL32) */ HMODULE WINAPI LoadLibraryA(LPCSTR libname) { return LoadLibraryExA(libname,0,0); } /*********************************************************************** * FreeLibrary */ WIN_BOOL WINAPI FreeLibrary(HINSTANCE hLibModule) { WIN_BOOL retv = FALSE; WINE_MODREF *wm; wm=MODULE32_LookupHMODULE(hLibModule); if ( !wm || !hLibModule ) { SetLastError( ERROR_INVALID_HANDLE ); return 0; } else retv = MODULE_FreeLibrary( wm ); MODULE_RemoveFromList(wm); /* garbage... */ if (local_wm == NULL) my_garbagecollection(); return retv; } /*********************************************************************** * MODULE_DecRefCount * * NOTE: Assumes that the process critical section is held! */ static void MODULE_DecRefCount( WINE_MODREF *wm ) { int i; if ( wm->flags & WINE_MODREF_MARKER ) return; if ( wm->refCount <= 0 ) return; --wm->refCount; TRACE("(%s) refCount: %d\n", wm->modname, wm->refCount ); if ( wm->refCount == 0 ) { wm->flags |= WINE_MODREF_MARKER; for ( i = 0; i < wm->nDeps; i++ ) if ( wm->deps[i] ) MODULE_DecRefCount( wm->deps[i] ); wm->flags &= ~WINE_MODREF_MARKER; } } /*********************************************************************** * GetProcAddress (KERNEL32.257) */ FARPROC WINAPI GetProcAddress( HMODULE hModule, LPCSTR function ) { return MODULE_GetProcAddress( hModule, function, TRUE ); } /*********************************************************************** * MODULE_GetProcAddress (internal) */ FARPROC MODULE_GetProcAddress( HMODULE hModule, /* [in] current module handle */ LPCSTR function, /* [in] function to be looked up */ WIN_BOOL snoop ) { WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule ); // WINE_MODREF *wm=local_wm; FARPROC retproc; if (HIWORD(function)) TRACE_(win32)("(%08lx,%s)\n",(DWORD)hModule,function); else TRACE_(win32)("(%08lx,%p)\n",(DWORD)hModule,function); if (!wm) { SetLastError(ERROR_INVALID_HANDLE); return (FARPROC)0; } switch (wm->type) { case MODULE32_PE: retproc = PE_FindExportedFunction( wm, function, snoop ); if (!retproc) SetLastError(ERROR_PROC_NOT_FOUND); return retproc; #ifdef HAVE_LIBDL case MODULE32_ELF: retproc = (FARPROC) dlsym( (void*) wm->module, function); if (!retproc) SetLastError(ERROR_PROC_NOT_FOUND); return retproc; #endif default: ERR("wine_modref type %d not handled.\n",wm->type); SetLastError(ERROR_INVALID_HANDLE); return (FARPROC)0; } } static int acounter = 0; void CodecAlloc(void) { acounter++; //printf("**************CODEC ALLOC %d\n", acounter); } void CodecRelease(void) { acounter--; //printf("**************CODEC RELEASE %d\n", acounter); if (acounter == 0) { for (;;) { modref_list* list = local_wm; if (!local_wm) break; //printf("CODECRELEASE %p\n", list); MODULE_FreeLibrary(list->wm); MODULE_RemoveFromList(list->wm); if (local_wm == NULL) my_garbagecollection(); } } } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/pe_image.c0000644000175000017500000007617607560467647022301 0ustar yavoryavor/* * Copyright 1994 Eric Youndale & Erik Bos * Copyright 1995 Martin von Löwis * Copyright 1996-98 Marcus Meissner * * based on Eric Youndale's pe-test and: * * ftp.microsoft.com:/pub/developer/MSDN/CD8/PEFILE.ZIP * make that: * ftp.microsoft.com:/developr/MSDN/OctCD/PEFILE.ZIP */ /* Notes: * Before you start changing something in this file be aware of the following: * * - There are several functions called recursively. In a very subtle and * obscure way. DLLs can reference each other recursively etc. * - If you want to enhance, speed up or clean up something in here, think * twice WHY it is implemented in that strange way. There is usually a reason. * Though sometimes it might just be lazyness ;) * - In PE_MapImage, right before fixup_imports() all external and internal * state MUST be correct since this function can be called with the SAME image * AGAIN. (Thats recursion for you.) That means MODREF.module and * NE_MODULE.module32. * - Sometimes, we can't use Linux mmap() to mmap() the images directly. * * The problem is, that there is not direct 1:1 mapping from a diskimage and * a memoryimage. The headers at the start are mapped linear, but the sections * are not. Older x86 pe binaries are 512 byte aligned in file and 4096 byte * aligned in memory. Linux likes them 4096 byte aligned in memory (due to * x86 pagesize, this cannot be fixed without a rather large kernel rewrite) * and 'blocksize' file-aligned (offsets). Since we have 512/1024/2048 (CDROM) * and other byte blocksizes, we can't always do this. We *can* do this for * newer pe binaries produced by MSVC 5 and later, since they are also aligned * to 4096 byte boundaries on disk. */ #include "config.h" //#include #include #include #include #include #include #include #include #include #include #ifdef HAVE_SYS_MMAN_H #include #endif #include #include #include #include #include #include #include #include "ext.h" #include "win32.h" #define RVA(x) ((void *)((char *)load_addr+(unsigned int)(x))) #define AdjustPtr(ptr,delta) ((char *)(ptr) + (delta)) static void dump_exports( HMODULE hModule ) { char *Module; unsigned int i, j; u_short *ordinal; u_long *function,*functions; u_char **name; unsigned int load_addr = hModule; DWORD rva_start = PE_HEADER(hModule)->OptionalHeader .DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress; DWORD rva_end = rva_start + PE_HEADER(hModule)->OptionalHeader .DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size; IMAGE_EXPORT_DIRECTORY *pe_exports = (IMAGE_EXPORT_DIRECTORY*)RVA(rva_start); Module = (char*)RVA(pe_exports->Name); TRACE("*******EXPORT DATA*******\n"); TRACE("Module name is %s, %ld functions, %ld names\n", Module, pe_exports->NumberOfFunctions, pe_exports->NumberOfNames); ordinal=(u_short*) RVA(pe_exports->AddressOfNameOrdinals); functions=function=(u_long*) RVA(pe_exports->AddressOfFunctions); name=(u_char**) RVA(pe_exports->AddressOfNames); TRACE(" Ord RVA Addr Name\n" ); for (i=0;iNumberOfFunctions;i++, function++) { if (!*function) continue; if (TRACE_ON(win32)) { DPRINTF( "%4ld %08lx %p", i + pe_exports->Base, *function, RVA(*function) ); for (j = 0; j < pe_exports->NumberOfNames; j++) if (ordinal[j] == i) { DPRINTF( " %s", (char*)RVA(name[j]) ); break; } if ((*function >= rva_start) && (*function <= rva_end)) DPRINTF(" (forwarded -> %s)", (char *)RVA(*function)); DPRINTF("\n"); } } } /* Look up the specified function or ordinal in the exportlist: * If it is a string: * - look up the name in the Name list. * - look up the ordinal with that index. * - use the ordinal as offset into the functionlist * If it is a ordinal: * - use ordinal-pe_export->Base as offset into the functionlist */ FARPROC PE_FindExportedFunction( WINE_MODREF *wm, LPCSTR funcName, WIN_BOOL snoop ) { u_short * ordinals; u_long * function; u_char ** name; const char *ename = NULL; int i, ordinal; PE_MODREF *pem = &(wm->binfmt.pe); IMAGE_EXPORT_DIRECTORY *exports = pem->pe_export; unsigned int load_addr = wm->module; u_long rva_start, rva_end, addr; char * forward; if (HIWORD(funcName)) TRACE("(%s)\n",funcName); else TRACE("(%d)\n",(int)funcName); if (!exports) { /* Not a fatal problem, some apps do * GetProcAddress(0,"RegisterPenApp") which triggers this * case. */ WARN("Module %08x(%s)/MODREF %p doesn't have a exports table.\n",wm->module,wm->modname,pem); return NULL; } ordinals= (u_short*) RVA(exports->AddressOfNameOrdinals); function= (u_long*) RVA(exports->AddressOfFunctions); name = (u_char **) RVA(exports->AddressOfNames); forward = NULL; rva_start = PE_HEADER(wm->module)->OptionalHeader .DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress; rva_end = rva_start + PE_HEADER(wm->module)->OptionalHeader .DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size; if (HIWORD(funcName)) { int min = 0, max = exports->NumberOfNames - 1; while (min <= max) { int res, pos = (min + max) / 2; ename = (const char*) RVA(name[pos]); if (!(res = strcmp( ename, funcName ))) { ordinal = ordinals[pos]; goto found; } if (res > 0) max = pos - 1; else min = pos + 1; } for (i = 0; i < exports->NumberOfNames; i++) { ename = (const char*) RVA(name[i]); if (!strcmp( ename, funcName )) { ERR( "%s.%s required a linear search\n", wm->modname, funcName ); ordinal = ordinals[i]; goto found; } } return NULL; } else { ordinal = LOWORD(funcName) - exports->Base; if (snoop && name) { for (i = 0; i < exports->NumberOfNames; i++) if (ordinals[i] == ordinal) { ename = RVA(name[i]); break; } } } found: if (ordinal >= exports->NumberOfFunctions) { TRACE(" ordinal %ld out of range!\n", ordinal + exports->Base ); return NULL; } addr = function[ordinal]; if (!addr) return NULL; if ((addr < rva_start) || (addr >= rva_end)) { FARPROC proc = RVA(addr); if (snoop) { if (!ename) ename = "@"; // proc = SNOOP_GetProcAddress(wm->module,ename,ordinal,proc); TRACE("SNOOP_GetProcAddress n/a\n"); } return proc; } else { WINE_MODREF *wm; char *forward = RVA(addr); char module[256]; char *end = strchr(forward, '.'); if (!end) return NULL; if (end - forward >= sizeof(module)) return NULL; memcpy( module, forward, end - forward ); module[end-forward] = 0; if (!(wm = MODULE_FindModule( module ))) { ERR("module not found for forward '%s'\n", forward ); return NULL; } return MODULE_GetProcAddress( wm->module, end + 1, snoop ); } } static DWORD fixup_imports( WINE_MODREF *wm ) { IMAGE_IMPORT_DESCRIPTOR *pe_imp; PE_MODREF *pem; unsigned int load_addr = wm->module; int i,characteristics_detection=1; char *modname; assert(wm->type==MODULE32_PE); pem = &(wm->binfmt.pe); if (pem->pe_export) modname = (char*) RVA(pem->pe_export->Name); else modname = ""; TRACE("Dumping imports list\n"); pe_imp = pem->pe_import; if (!pe_imp) return 0; /* We assume that we have at least one import with !0 characteristics and * detect broken imports with all characteristsics 0 (notably Borland) and * switch the detection off for them. */ for (i = 0; pe_imp->Name ; pe_imp++) { if (!i && !pe_imp->u.Characteristics) characteristics_detection = 0; if (characteristics_detection && !pe_imp->u.Characteristics) break; i++; } if (!i) return 0; wm->nDeps = i; wm->deps = HeapAlloc( GetProcessHeap(), 0, i*sizeof(WINE_MODREF *) ); /* load the imported modules. They are automatically * added to the modref list of the process. */ for (i = 0, pe_imp = pem->pe_import; pe_imp->Name ; pe_imp++) { WINE_MODREF *wmImp; IMAGE_IMPORT_BY_NAME *pe_name; PIMAGE_THUNK_DATA import_list,thunk_list; char *name = (char *) RVA(pe_imp->Name); if (characteristics_detection && !pe_imp->u.Characteristics) break; //#warning FIXME: here we should fill imports TRACE("Loading imports for %s.dll\n", name); if (pe_imp->u.OriginalFirstThunk != 0) { TRACE("Microsoft style imports used\n"); import_list =(PIMAGE_THUNK_DATA) RVA(pe_imp->u.OriginalFirstThunk); thunk_list = (PIMAGE_THUNK_DATA) RVA(pe_imp->FirstThunk); while (import_list->u1.Ordinal) { if (IMAGE_SNAP_BY_ORDINAL(import_list->u1.Ordinal)) { int ordinal = IMAGE_ORDINAL(import_list->u1.Ordinal); // TRACE("--- Ordinal %s,%d\n", name, ordinal); thunk_list->u1.Function=LookupExternal(name, ordinal); } else { pe_name = (PIMAGE_IMPORT_BY_NAME)RVA(import_list->u1.AddressOfData); // TRACE("--- %s %s.%d\n", pe_name->Name, name, pe_name->Hint); thunk_list->u1.Function=LookupExternalByName(name, pe_name->Name); } import_list++; thunk_list++; } } else { TRACE("Borland style imports used\n"); thunk_list = (PIMAGE_THUNK_DATA) RVA(pe_imp->FirstThunk); while (thunk_list->u1.Ordinal) { if (IMAGE_SNAP_BY_ORDINAL(thunk_list->u1.Ordinal)) { int ordinal = IMAGE_ORDINAL(thunk_list->u1.Ordinal); TRACE("--- Ordinal %s.%d\n",name,ordinal); thunk_list->u1.Function=LookupExternal( name, ordinal); } else { pe_name=(PIMAGE_IMPORT_BY_NAME) RVA(thunk_list->u1.AddressOfData); TRACE("--- %s %s.%d\n", pe_name->Name,name,pe_name->Hint); thunk_list->u1.Function=LookupExternalByName( name, pe_name->Name); } thunk_list++; } } } return 0; } static int calc_vma_size( HMODULE hModule ) { int i,vma_size = 0; IMAGE_SECTION_HEADER *pe_seg = PE_SECTIONS(hModule); TRACE("Dump of segment table\n"); TRACE(" Name VSz Vaddr SzRaw Fileadr *Reloc *Lineum #Reloc #Linum Char\n"); for (i = 0; i< PE_HEADER(hModule)->FileHeader.NumberOfSections; i++) { TRACE("%8s: %4.4lx %8.8lx %8.8lx %8.8lx %8.8lx %8.8lx %4.4x %4.4x %8.8lx\n", pe_seg->Name, pe_seg->Misc.VirtualSize, pe_seg->VirtualAddress, pe_seg->SizeOfRawData, pe_seg->PointerToRawData, pe_seg->PointerToRelocations, pe_seg->PointerToLinenumbers, pe_seg->NumberOfRelocations, pe_seg->NumberOfLinenumbers, pe_seg->Characteristics); vma_size=max(vma_size, pe_seg->VirtualAddress+pe_seg->SizeOfRawData); vma_size=max(vma_size, pe_seg->VirtualAddress+pe_seg->Misc.VirtualSize); pe_seg++; } return vma_size; } static void do_relocations( unsigned int load_addr, IMAGE_BASE_RELOCATION *r ) { int delta = load_addr - PE_HEADER(load_addr)->OptionalHeader.ImageBase; int hdelta = (delta >> 16) & 0xFFFF; int ldelta = delta & 0xFFFF; if(delta == 0) return; while(r->VirtualAddress) { char *page = (char*) RVA(r->VirtualAddress); int count = (r->SizeOfBlock - 8)/2; int i; TRACE_(fixup)("%x relocations for page %lx\n", count, r->VirtualAddress); for(i=0;iTypeOffset[i] & 0xFFF; int type = r->TypeOffset[i] >> 12; // TRACE_(fixup)("patching %x type %x\n", offset, type); switch(type) { case IMAGE_REL_BASED_ABSOLUTE: break; case IMAGE_REL_BASED_HIGH: *(short*)(page+offset) += hdelta; break; case IMAGE_REL_BASED_LOW: *(short*)(page+offset) += ldelta; break; case IMAGE_REL_BASED_HIGHLOW: *(int*)(page+offset) += delta; break; case IMAGE_REL_BASED_HIGHADJ: FIXME("Don't know what to do with IMAGE_REL_BASED_HIGHADJ\n"); break; case IMAGE_REL_BASED_MIPS_JMPADDR: FIXME("Is this a MIPS machine ???\n"); break; default: FIXME("Unknown fixup type\n"); break; } } r = (IMAGE_BASE_RELOCATION*)((char*)r + r->SizeOfBlock); } } /********************************************************************** * PE_LoadImage * Load one PE format DLL/EXE into memory * * Unluckily we can't just mmap the sections where we want them, for * (at least) Linux does only support offsets which are page-aligned. * * BUT we have to map the whole image anyway, for Win32 programs sometimes * want to access them. (HMODULE32 point to the start of it) */ HMODULE PE_LoadImage( int handle, LPCSTR filename, WORD *version ) { HMODULE hModule; HANDLE mapping; IMAGE_NT_HEADERS *nt; IMAGE_SECTION_HEADER *pe_sec; IMAGE_DATA_DIRECTORY *dir; BY_HANDLE_FILE_INFORMATION bhfi; int i, rawsize, lowest_va, vma_size, file_size = 0; DWORD load_addr = 0, aoep, reloc = 0; // struct get_read_fd_request *req = get_req_buffer(); int unix_handle = handle; int page_size = getpagesize(); // if ( GetFileInformationByHandle( hFile, &bhfi ) ) // file_size = bhfi.nFileSizeLow; file_size=lseek(handle, 0, SEEK_END); lseek(handle, 0, SEEK_SET); //#warning fix CreateFileMappingA mapping = CreateFileMappingA( handle, NULL, PAGE_READONLY | SEC_COMMIT, 0, 0, NULL ); if (!mapping) { WARN("CreateFileMapping error %ld\n", GetLastError() ); return 0; } // hModule = (HMODULE)MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 ); hModule=(HMODULE)mapping; // CloseHandle( mapping ); if (!hModule) { WARN("MapViewOfFile error %ld\n", GetLastError() ); return 0; } if ( *(WORD*)hModule !=IMAGE_DOS_SIGNATURE) { WARN("%s image doesn't have DOS signature, but 0x%04x\n", filename,*(WORD*)hModule); goto error; } nt = PE_HEADER( hModule ); if ( nt->Signature != IMAGE_NT_SIGNATURE ) { WARN("%s image doesn't have PE signature, but 0x%08lx\n", filename, nt->Signature ); goto error; } if ( nt->FileHeader.Machine != IMAGE_FILE_MACHINE_I386 ) { MESSAGE("Trying to load PE image for unsupported architecture ("); switch (nt->FileHeader.Machine) { case IMAGE_FILE_MACHINE_UNKNOWN: MESSAGE("Unknown"); break; case IMAGE_FILE_MACHINE_I860: MESSAGE("I860"); break; case IMAGE_FILE_MACHINE_R3000: MESSAGE("R3000"); break; case IMAGE_FILE_MACHINE_R4000: MESSAGE("R4000"); break; case IMAGE_FILE_MACHINE_R10000: MESSAGE("R10000"); break; case IMAGE_FILE_MACHINE_ALPHA: MESSAGE("Alpha"); break; case IMAGE_FILE_MACHINE_POWERPC: MESSAGE("PowerPC"); break; default: MESSAGE("Unknown-%04x", nt->FileHeader.Machine); break; } MESSAGE(")\n"); goto error; } pe_sec = PE_SECTIONS( hModule ); rawsize = 0; lowest_va = 0x10000; for (i = 0; i < nt->FileHeader.NumberOfSections; i++) { if (lowest_va > pe_sec[i].VirtualAddress) lowest_va = pe_sec[i].VirtualAddress; if (pe_sec[i].Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA) continue; if (pe_sec[i].PointerToRawData+pe_sec[i].SizeOfRawData > rawsize) rawsize = pe_sec[i].PointerToRawData+pe_sec[i].SizeOfRawData; } if ( file_size && file_size < rawsize ) { ERR("PE module is too small (header: %d, filesize: %d), " "probably truncated download?\n", rawsize, file_size ); goto error; } aoep = nt->OptionalHeader.AddressOfEntryPoint; if (aoep && (aoep < lowest_va)) FIXME("VIRUS WARNING: '%s' has an invalid entrypoint (0x%08lx) " "below the first virtual address (0x%08x) " "(possibly infected by Tchernobyl/SpaceFiller virus)!\n", filename, aoep, lowest_va ); /* FIXME: Hack! While we don't really support shared sections yet, * this checks for those special cases where the whole DLL * consists only of shared sections and is mapped into the * shared address space > 2GB. In this case, we assume that * the module got mapped at its base address. Thus we simply * check whether the module has actually been mapped there * and use it, if so. This is needed to get Win95 USER32.DLL * to work (until we support shared sections properly). */ if ( nt->OptionalHeader.ImageBase & 0x80000000 ) { HMODULE sharedMod = (HMODULE)nt->OptionalHeader.ImageBase; IMAGE_NT_HEADERS *sharedNt = (PIMAGE_NT_HEADERS) ( (LPBYTE)sharedMod + ((LPBYTE)nt - (LPBYTE)hModule) ); /* Well, this check is not really comprehensive, but should be good enough for now ... */ if ( !IsBadReadPtr( (LPBYTE)sharedMod, sizeof(IMAGE_DOS_HEADER) ) && memcmp( (LPBYTE)sharedMod, (LPBYTE)hModule, sizeof(IMAGE_DOS_HEADER) ) == 0 && !IsBadReadPtr( sharedNt, sizeof(IMAGE_NT_HEADERS) ) && memcmp( sharedNt, nt, sizeof(IMAGE_NT_HEADERS) ) == 0 ) { UnmapViewOfFile( (LPVOID)hModule ); return sharedMod; } } load_addr = nt->OptionalHeader.ImageBase; vma_size = calc_vma_size( hModule ); load_addr = (DWORD)VirtualAlloc( (void*)load_addr, vma_size, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE ); if (load_addr == 0) { FIXME("We need to perform base relocations for %s\n", filename); dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_BASERELOC; if (dir->Size) reloc = dir->VirtualAddress; else { FIXME( "FATAL: Need to relocate %s, but no relocation records present (%s). Try to run that file directly !\n", filename, (nt->FileHeader.Characteristics&IMAGE_FILE_RELOCS_STRIPPED)? "stripped during link" : "unknown reason" ); goto error; } /* FIXME: If we need to relocate a system DLL (base > 2GB) we should * really make sure that the *new* base address is also > 2GB. * Some DLLs really check the MSB of the module handle :-/ */ if ( nt->OptionalHeader.ImageBase & 0x80000000 ) ERR( "Forced to relocate system DLL (base > 2GB). This is not good.\n" ); load_addr = (DWORD)VirtualAlloc( NULL, vma_size, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE ); if (!load_addr) { FIXME_(win32)( "FATAL: Couldn't load module %s (out of memory, %d needed)!\n", filename, vma_size); goto error; } } TRACE("Load addr is %lx (base %lx), range %x\n", load_addr, nt->OptionalHeader.ImageBase, vma_size ); TRACE_(segment)("Loading %s at %lx, range %x\n", filename, load_addr, vma_size ); #if 0 *(PIMAGE_DOS_HEADER)load_addr = *(PIMAGE_DOS_HEADER)hModule; *PE_HEADER( load_addr ) = *nt; memcpy( PE_SECTIONS(load_addr), PE_SECTIONS(hModule), sizeof(IMAGE_SECTION_HEADER) * nt->FileHeader.NumberOfSections ); memcpy( load_addr, hModule, lowest_fa ); #endif if ((void*)FILE_dommap( handle, (void *)load_addr, 0, nt->OptionalHeader.SizeOfHeaders, 0, 0, PROT_EXEC | PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_FIXED ) != (void*)load_addr) { ERR_(win32)( "Critical Error: failed to map PE header to necessary address.\n"); goto error; } pe_sec = PE_SECTIONS( hModule ); for (i = 0; i < nt->FileHeader.NumberOfSections; i++, pe_sec++) { if (!pe_sec->SizeOfRawData || !pe_sec->PointerToRawData) continue; TRACE("%s: mmaping section %s at %p off %lx size %lx/%lx\n", filename, pe_sec->Name, (void*)RVA(pe_sec->VirtualAddress), pe_sec->PointerToRawData, pe_sec->SizeOfRawData, pe_sec->Misc.VirtualSize ); if ((void*)FILE_dommap( unix_handle, (void*)RVA(pe_sec->VirtualAddress), 0, pe_sec->SizeOfRawData, 0, pe_sec->PointerToRawData, PROT_EXEC | PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_FIXED ) != (void*)RVA(pe_sec->VirtualAddress)) { ERR_(win32)( "Critical Error: failed to map PE section to necessary address.\n"); goto error; } if ((pe_sec->SizeOfRawData < pe_sec->Misc.VirtualSize) && (pe_sec->SizeOfRawData & (page_size-1))) { DWORD end = (pe_sec->SizeOfRawData & ~(page_size-1)) + page_size; if (end > pe_sec->Misc.VirtualSize) end = pe_sec->Misc.VirtualSize; TRACE("clearing %p - %p\n", RVA(pe_sec->VirtualAddress) + pe_sec->SizeOfRawData, RVA(pe_sec->VirtualAddress) + end ); memset( (char*)RVA(pe_sec->VirtualAddress) + pe_sec->SizeOfRawData, 0, end - pe_sec->SizeOfRawData ); } } if ( reloc ) do_relocations( load_addr, (IMAGE_BASE_RELOCATION *)RVA(reloc) ); *version = ( (nt->OptionalHeader.MajorSubsystemVersion & 0xff) << 8 ) | (nt->OptionalHeader.MinorSubsystemVersion & 0xff); UnmapViewOfFile( (LPVOID)hModule ); return (HMODULE)load_addr; error: if (unix_handle != -1) close( unix_handle ); if (load_addr) VirtualFree( (LPVOID)load_addr, 0, MEM_RELEASE ); UnmapViewOfFile( (LPVOID)hModule ); return 0; } /********************************************************************** * PE_CreateModule * * Create WINE_MODREF structure for loaded HMODULE32, link it into * process modref_list, and fixup all imports. * * Note: hModule must point to a correctly allocated PE image, * with base relocations applied; the 16-bit dummy module * associated to hModule must already exist. * * Note: This routine must always be called in the context of the * process that is to own the module to be created. */ WINE_MODREF *PE_CreateModule( HMODULE hModule, LPCSTR filename, DWORD flags, WIN_BOOL builtin ) { DWORD load_addr = (DWORD)hModule; IMAGE_NT_HEADERS *nt = PE_HEADER(hModule); IMAGE_DATA_DIRECTORY *dir; IMAGE_IMPORT_DESCRIPTOR *pe_import = NULL; IMAGE_EXPORT_DIRECTORY *pe_export = NULL; IMAGE_RESOURCE_DIRECTORY *pe_resource = NULL; WINE_MODREF *wm; int result; dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_EXPORT; if (dir->Size) pe_export = (PIMAGE_EXPORT_DIRECTORY)RVA(dir->VirtualAddress); dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_IMPORT; if (dir->Size) pe_import = (PIMAGE_IMPORT_DESCRIPTOR)RVA(dir->VirtualAddress); dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_RESOURCE; if (dir->Size) pe_resource = (PIMAGE_RESOURCE_DIRECTORY)RVA(dir->VirtualAddress); dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_EXCEPTION; if (dir->Size) FIXME("Exception directory ignored\n" ); dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_SECURITY; if (dir->Size) FIXME("Security directory ignored\n" ); dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_DEBUG; if (dir->Size) TRACE("Debug directory ignored\n" ); dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_COPYRIGHT; if (dir->Size) FIXME("Copyright string ignored\n" ); dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_GLOBALPTR; if (dir->Size) FIXME("Global Pointer (MIPS) ignored\n" ); dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG; if (dir->Size) FIXME("Load Configuration directory ignored\n" ); dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT; if (dir->Size) TRACE("Bound Import directory ignored\n" ); dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_IAT; if (dir->Size) TRACE("Import Address Table directory ignored\n" ); dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT; if (dir->Size) { TRACE("Delayed import, stub calls LoadLibrary\n" ); /* * Nothing to do here. */ #ifdef ImgDelayDescr /* * This code is useful to observe what the heck is going on. */ { ImgDelayDescr *pe_delay = NULL; pe_delay = (PImgDelayDescr)RVA(dir->VirtualAddress); TRACE_(delayhlp)("pe_delay->grAttrs = %08x\n", pe_delay->grAttrs); TRACE_(delayhlp)("pe_delay->szName = %s\n", pe_delay->szName); TRACE_(delayhlp)("pe_delay->phmod = %08x\n", pe_delay->phmod); TRACE_(delayhlp)("pe_delay->pIAT = %08x\n", pe_delay->pIAT); TRACE_(delayhlp)("pe_delay->pINT = %08x\n", pe_delay->pINT); TRACE_(delayhlp)("pe_delay->pBoundIAT = %08x\n", pe_delay->pBoundIAT); TRACE_(delayhlp)("pe_delay->pUnloadIAT = %08x\n", pe_delay->pUnloadIAT); TRACE_(delayhlp)("pe_delay->dwTimeStamp = %08x\n", pe_delay->dwTimeStamp); } #endif } dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR; if (dir->Size) FIXME("Unknown directory 14 ignored\n" ); dir = nt->OptionalHeader.DataDirectory+15; if (dir->Size) FIXME("Unknown directory 15 ignored\n" ); wm = (WINE_MODREF *)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*wm) ); wm->module = hModule; if ( builtin ) wm->flags |= WINE_MODREF_INTERNAL; if ( flags & DONT_RESOLVE_DLL_REFERENCES ) wm->flags |= WINE_MODREF_DONT_RESOLVE_REFS; if ( flags & LOAD_LIBRARY_AS_DATAFILE ) wm->flags |= WINE_MODREF_LOAD_AS_DATAFILE; wm->type = MODULE32_PE; wm->binfmt.pe.pe_export = pe_export; wm->binfmt.pe.pe_import = pe_import; wm->binfmt.pe.pe_resource = pe_resource; wm->binfmt.pe.tlsindex = -1; wm->filename = malloc(strlen(filename)+1); strcpy(wm->filename, filename ); wm->modname = strrchr( wm->filename, '\\' ); if (!wm->modname) wm->modname = wm->filename; else wm->modname++; if ( pe_export ) dump_exports( hModule ); /* Fixup Imports */ if ( pe_import && !( wm->flags & WINE_MODREF_LOAD_AS_DATAFILE ) && !( wm->flags & WINE_MODREF_DONT_RESOLVE_REFS ) && fixup_imports( wm ) ) { /* remove entry from modref chain */ return NULL; } return wm; return wm; } /****************************************************************************** * The PE Library Loader frontend. * FIXME: handle the flags. */ WINE_MODREF *PE_LoadLibraryExA (LPCSTR name, DWORD flags) { HMODULE hModule32; WINE_MODREF *wm; char filename[256]; int hFile; WORD version = 0; strncpy(filename, name, sizeof(filename)); hFile=open(filename, O_RDONLY); if(hFile==-1) return NULL; hModule32 = PE_LoadImage( hFile, filename, &version ); if (!hModule32) { SetLastError( ERROR_OUTOFMEMORY ); return NULL; } if ( !(wm = PE_CreateModule( hModule32, filename, flags, FALSE )) ) { ERR( "can't load %s\n", filename ); SetLastError( ERROR_OUTOFMEMORY ); return NULL; } close(hFile); //printf("^^^^^^^^^^^^^^^^Alloc VM1 %p\n", wm); return wm; } /***************************************************************************** * PE_UnloadLibrary * * Unload the library unmapping the image and freeing the modref structure. */ void PE_UnloadLibrary(WINE_MODREF *wm) { TRACE(" unloading %s\n", wm->filename); if (wm->filename) free(wm->filename); if (wm->short_filename) free(wm->short_filename); HeapFree( GetProcessHeap(), 0, wm->deps ); VirtualFree( (LPVOID)wm->module, 0, MEM_RELEASE ); HeapFree( GetProcessHeap(), 0, wm ); //printf("^^^^^^^^^^^^^^^^Free VM1 %p\n", wm); } /***************************************************************************** * Load the PE main .EXE. All other loading is done by PE_LoadLibraryExA * FIXME: this function should use PE_LoadLibraryExA, but currently can't * due to the PROCESS_Create stuff. */ /* * This is a dirty hack. * The win32 DLLs contain an alloca routine, that first probes the soon * to be allocated new memory *below* the current stack pointer in 4KByte * increments. After the mem probing below the current %esp, the stack * pointer is finally decremented to make room for the "alloca"ed memory. * Maybe the probing code is intended to extend the stack on a windows box. * Anyway, the linux kernel does *not* extend the stack by simply accessing * memory below %esp; it segfaults. * The extend_stack_for_dll_alloca() routine just preallocates a big chunk * of memory on the stack, for use by the DLLs alloca routine. */ static void extend_stack_for_dll_alloca(void) { #ifndef __FreeBSD__ void* mem=alloca(0x20000); *(int*)mem=0x1234; #endif } /* Called if the library is loaded or freed. * NOTE: if a thread attaches a DLL, the current thread will only do * DLL_PROCESS_ATTACH. Only new created threads do DLL_THREAD_ATTACH * (SDK) */ WIN_BOOL PE_InitDLL( WINE_MODREF *wm, DWORD type, LPVOID lpReserved ) { WIN_BOOL retv = TRUE; assert( wm->type == MODULE32_PE ); if ((PE_HEADER(wm->module)->FileHeader.Characteristics & IMAGE_FILE_DLL) && (PE_HEADER(wm->module)->OptionalHeader.AddressOfEntryPoint) ) { DLLENTRYPROC entry ; entry = (void*)PE_FindExportedFunction(wm, "DllMain", 0); if(entry==NULL) entry = (void*)RVA_PTR( wm->module,OptionalHeader.AddressOfEntryPoint ); TRACE_(relay)("CallTo32(entryproc=%p,module=%08x,type=%ld,res=%p)\n", entry, wm->module, type, lpReserved ); TRACE("Entering DllMain("); switch(type) { case DLL_PROCESS_DETACH: TRACE("DLL_PROCESS_DETACH) "); break; case DLL_PROCESS_ATTACH: TRACE("DLL_PROCESS_ATTACH) "); break; case DLL_THREAD_DETACH: TRACE("DLL_THREAD_DETACH) "); break; case DLL_THREAD_ATTACH: TRACE("DLL_THREAD_ATTACH) "); break; } TRACE("for %s\n", wm->filename); extend_stack_for_dll_alloca(); retv = entry( wm->module, type, lpReserved ); } return retv; } static LPVOID _fixup_address(PIMAGE_OPTIONAL_HEADER opt,int delta,LPVOID addr) { if ( ((DWORD)addr>opt->ImageBase) && ((DWORD)addrImageBase+opt->SizeOfImage) ) return (LPVOID)(((DWORD)addr)+delta); else return addr; } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/pe_resource.c0000644000175000017500000002607307321166272023016 0ustar yavoryavor/* * PE (Portable Execute) File Resources * * Copyright 1995 Thomas Sandford * Copyright 1996 Martin von Loewis * * Based on the Win16 resource handling code in loader/resource.c * Copyright 1993 Robert J. Amstadt * Copyright 1995 Alexandre Julliard * Copyright 1997 Marcus Meissner */ #include #include #include #include #include #include #include #include //#include "task.h" //#include "process.h" //#include "stackframe.h" #include #include /********************************************************************** * HMODULE32toPE_MODREF * * small helper function to get a PE_MODREF from a passed HMODULE32 */ static PE_MODREF* HMODULE32toPE_MODREF(HMODULE hmod) { WINE_MODREF *wm; wm = MODULE32_LookupHMODULE( hmod ); if (!wm || wm->type!=MODULE32_PE) return NULL; return &(wm->binfmt.pe); } /********************************************************************** * GetResDirEntryW * * Helper function - goes down one level of PE resource tree * */ PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY resdirptr, LPCWSTR name,DWORD root, WIN_BOOL allowdefault) { int entrynum; PIMAGE_RESOURCE_DIRECTORY_ENTRY entryTable; int namelen; if (HIWORD(name)) { if (name[0]=='#') { char buf[10]; lstrcpynWtoA(buf,name+1,10); return GetResDirEntryW(resdirptr,(LPCWSTR)atoi(buf),root,allowdefault); } entryTable = (PIMAGE_RESOURCE_DIRECTORY_ENTRY) ( (BYTE *) resdirptr + sizeof(IMAGE_RESOURCE_DIRECTORY)); namelen = lstrlenW(name); for (entrynum = 0; entrynum < resdirptr->NumberOfNamedEntries; entrynum++) { PIMAGE_RESOURCE_DIR_STRING_U str = (PIMAGE_RESOURCE_DIR_STRING_U) (root + entryTable[entrynum].u1.s.NameOffset); if(namelen != str->Length) continue; if(wcsnicmp(name,str->NameString,str->Length)==0) return (PIMAGE_RESOURCE_DIRECTORY) ( root + entryTable[entrynum].u2.s.OffsetToDirectory); } return NULL; } else { entryTable = (PIMAGE_RESOURCE_DIRECTORY_ENTRY) ( (BYTE *) resdirptr + sizeof(IMAGE_RESOURCE_DIRECTORY) + resdirptr->NumberOfNamedEntries * sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)); for (entrynum = 0; entrynum < resdirptr->NumberOfIdEntries; entrynum++) if ((DWORD)entryTable[entrynum].u1.Name == (DWORD)name) return (PIMAGE_RESOURCE_DIRECTORY) ( root + entryTable[entrynum].u2.s.OffsetToDirectory); /* just use first entry if no default can be found */ if (allowdefault && !name && resdirptr->NumberOfIdEntries) return (PIMAGE_RESOURCE_DIRECTORY) ( root + entryTable[0].u2.s.OffsetToDirectory); return NULL; } } /********************************************************************** * GetResDirEntryA */ PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA( PIMAGE_RESOURCE_DIRECTORY resdirptr, LPCSTR name, DWORD root, WIN_BOOL allowdefault ) { PIMAGE_RESOURCE_DIRECTORY retv; LPWSTR nameW = HIWORD(name)? HEAP_strdupAtoW( GetProcessHeap(), 0, name ) : (LPWSTR)name; retv = GetResDirEntryW( resdirptr, nameW, root, allowdefault ); if ( HIWORD(name) ) HeapFree( GetProcessHeap(), 0, nameW ); return retv; } /********************************************************************** * PE_FindResourceEx32W */ HANDLE PE_FindResourceExW( WINE_MODREF *wm,LPCWSTR name,LPCWSTR type,WORD lang ) { PIMAGE_RESOURCE_DIRECTORY resdirptr; DWORD root; HANDLE result; PE_MODREF *pem = &(wm->binfmt.pe); if (!pem || !pem->pe_resource) return 0; resdirptr = pem->pe_resource; root = (DWORD) resdirptr; if ((resdirptr = GetResDirEntryW(resdirptr, type, root, FALSE)) == NULL) return 0; if ((resdirptr = GetResDirEntryW(resdirptr, name, root, FALSE)) == NULL) return 0; result = (HANDLE)GetResDirEntryW(resdirptr, (LPCWSTR)(UINT)lang, root, FALSE); /* Try LANG_NEUTRAL, too */ if(!result) return (HANDLE)GetResDirEntryW(resdirptr, (LPCWSTR)0, root, TRUE); return result; } /********************************************************************** * PE_LoadResource32 */ HANDLE PE_LoadResource( WINE_MODREF *wm, HANDLE hRsrc ) { if (!hRsrc || !wm || wm->type!=MODULE32_PE) return 0; return (HANDLE) (wm->module + ((PIMAGE_RESOURCE_DATA_ENTRY)hRsrc)->OffsetToData); } /********************************************************************** * PE_SizeofResource32 */ DWORD PE_SizeofResource( HINSTANCE hModule, HANDLE hRsrc ) { /* we don't need hModule */ if (!hRsrc) return 0; return ((PIMAGE_RESOURCE_DATA_ENTRY)hRsrc)->Size; } /********************************************************************** * PE_EnumResourceTypes32A */ WIN_BOOL PE_EnumResourceTypesA(HMODULE hmod,ENUMRESTYPEPROCA lpfun,LONG lparam) { PE_MODREF *pem = HMODULE32toPE_MODREF(hmod); int i; PIMAGE_RESOURCE_DIRECTORY resdir; PIMAGE_RESOURCE_DIRECTORY_ENTRY et; WIN_BOOL ret; HANDLE heap = GetProcessHeap(); if (!pem || !pem->pe_resource) return FALSE; resdir = (PIMAGE_RESOURCE_DIRECTORY)pem->pe_resource; et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY)); ret = FALSE; for (i=0;iNumberOfNamedEntries+resdir->NumberOfIdEntries;i++) { LPSTR name; if (et[i].u1.s.NameIsString) name = HEAP_strdupWtoA(heap,0,(LPWSTR)((LPBYTE)pem->pe_resource+et[i].u1.s.NameOffset)); else name = (LPSTR)(int)et[i].u1.Id; ret = lpfun(hmod,name,lparam); if (HIWORD(name)) HeapFree(heap,0,name); if (!ret) break; } return ret; } /********************************************************************** * PE_EnumResourceTypes32W */ WIN_BOOL PE_EnumResourceTypesW(HMODULE hmod,ENUMRESTYPEPROCW lpfun,LONG lparam) { PE_MODREF *pem = HMODULE32toPE_MODREF(hmod); int i; PIMAGE_RESOURCE_DIRECTORY resdir; PIMAGE_RESOURCE_DIRECTORY_ENTRY et; WIN_BOOL ret; if (!pem || !pem->pe_resource) return FALSE; resdir = (PIMAGE_RESOURCE_DIRECTORY)pem->pe_resource; et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY)); ret = FALSE; for (i=0;iNumberOfNamedEntries+resdir->NumberOfIdEntries;i++) { LPWSTR type; if (et[i].u1.s.NameIsString) type = (LPWSTR)((LPBYTE)pem->pe_resource+et[i].u1.s.NameOffset); else type = (LPWSTR)(int)et[i].u1.Id; ret = lpfun(hmod,type,lparam); if (!ret) break; } return ret; } /********************************************************************** * PE_EnumResourceNames32A */ WIN_BOOL PE_EnumResourceNamesA( HMODULE hmod,LPCSTR type,ENUMRESNAMEPROCA lpfun,LONG lparam ) { PE_MODREF *pem = HMODULE32toPE_MODREF(hmod); int i; PIMAGE_RESOURCE_DIRECTORY resdir; PIMAGE_RESOURCE_DIRECTORY_ENTRY et; WIN_BOOL ret; HANDLE heap = GetProcessHeap(); LPWSTR typeW; if (!pem || !pem->pe_resource) return FALSE; resdir = (PIMAGE_RESOURCE_DIRECTORY)pem->pe_resource; if (HIWORD(type)) typeW = HEAP_strdupAtoW(heap,0,type); else typeW = (LPWSTR)type; resdir = GetResDirEntryW(resdir,typeW,(DWORD)pem->pe_resource,FALSE); if (HIWORD(typeW)) HeapFree(heap,0,typeW); if (!resdir) return FALSE; et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY)); ret = FALSE; for (i=0;iNumberOfNamedEntries+resdir->NumberOfIdEntries;i++) { LPSTR name; if (et[i].u1.s.NameIsString) name = HEAP_strdupWtoA(heap,0,(LPWSTR)((LPBYTE)pem->pe_resource+et[i].u1.s.NameOffset)); else name = (LPSTR)(int)et[i].u1.Id; ret = lpfun(hmod,type,name,lparam); if (HIWORD(name)) HeapFree(heap,0,name); if (!ret) break; } return ret; } /********************************************************************** * PE_EnumResourceNames32W */ WIN_BOOL PE_EnumResourceNamesW( HMODULE hmod,LPCWSTR type,ENUMRESNAMEPROCW lpfun,LONG lparam ) { PE_MODREF *pem = HMODULE32toPE_MODREF(hmod); int i; PIMAGE_RESOURCE_DIRECTORY resdir; PIMAGE_RESOURCE_DIRECTORY_ENTRY et; WIN_BOOL ret; if (!pem || !pem->pe_resource) return FALSE; resdir = (PIMAGE_RESOURCE_DIRECTORY)pem->pe_resource; resdir = GetResDirEntryW(resdir,type,(DWORD)pem->pe_resource,FALSE); if (!resdir) return FALSE; et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY)); ret = FALSE; for (i=0;iNumberOfNamedEntries+resdir->NumberOfIdEntries;i++) { LPWSTR name; if (et[i].u1.s.NameIsString) name = (LPWSTR)((LPBYTE)pem->pe_resource+et[i].u1.s.NameOffset); else name = (LPWSTR)(int)et[i].u1.Id; ret = lpfun(hmod,type,name,lparam); if (!ret) break; } return ret; } /********************************************************************** * PE_EnumResourceNames32A */ WIN_BOOL PE_EnumResourceLanguagesA( HMODULE hmod,LPCSTR name,LPCSTR type,ENUMRESLANGPROCA lpfun, LONG lparam ) { PE_MODREF *pem = HMODULE32toPE_MODREF(hmod); int i; PIMAGE_RESOURCE_DIRECTORY resdir; PIMAGE_RESOURCE_DIRECTORY_ENTRY et; WIN_BOOL ret; HANDLE heap = GetProcessHeap(); LPWSTR nameW,typeW; if (!pem || !pem->pe_resource) return FALSE; resdir = (PIMAGE_RESOURCE_DIRECTORY)pem->pe_resource; if (HIWORD(name)) nameW = HEAP_strdupAtoW(heap,0,name); else nameW = (LPWSTR)name; resdir = GetResDirEntryW(resdir,nameW,(DWORD)pem->pe_resource,FALSE); if (HIWORD(nameW)) HeapFree(heap,0,nameW); if (!resdir) return FALSE; if (HIWORD(type)) typeW = HEAP_strdupAtoW(heap,0,type); else typeW = (LPWSTR)type; resdir = GetResDirEntryW(resdir,typeW,(DWORD)pem->pe_resource,FALSE); if (HIWORD(typeW)) HeapFree(heap,0,typeW); if (!resdir) return FALSE; et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY)); ret = FALSE; for (i=0;iNumberOfNamedEntries+resdir->NumberOfIdEntries;i++) { /* languages are just ids... I hopem */ ret = lpfun(hmod,name,type,et[i].u1.Id,lparam); if (!ret) break; } return ret; } /********************************************************************** * PE_EnumResourceLanguages32W */ WIN_BOOL PE_EnumResourceLanguagesW( HMODULE hmod,LPCWSTR name,LPCWSTR type,ENUMRESLANGPROCW lpfun, LONG lparam ) { PE_MODREF *pem = HMODULE32toPE_MODREF(hmod); int i; PIMAGE_RESOURCE_DIRECTORY resdir; PIMAGE_RESOURCE_DIRECTORY_ENTRY et; WIN_BOOL ret; if (!pem || !pem->pe_resource) return FALSE; resdir = (PIMAGE_RESOURCE_DIRECTORY)pem->pe_resource; resdir = GetResDirEntryW(resdir,name,(DWORD)pem->pe_resource,FALSE); if (!resdir) return FALSE; resdir = GetResDirEntryW(resdir,type,(DWORD)pem->pe_resource,FALSE); if (!resdir) return FALSE; et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY)); ret = FALSE; for (i=0;iNumberOfNamedEntries+resdir->NumberOfIdEntries;i++) { ret = lpfun(hmod,name,type,et[i].u1.Id,lparam); if (!ret) break; } return ret; } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/registry.c0000644000175000017500000002566407506610025022353 0ustar yavoryavor#include "config.h" #include #include #include #include #include #include #include #include #include #include #include "ext.h" #include "registry.h" //#undef TRACE //#define TRACE printf // ...can be set before init_registry() call char* regpathname = 0; static char* localregpathname = 0; typedef struct reg_handle_s { int handle; char* name; struct reg_handle_s* next; struct reg_handle_s* prev; } reg_handle_t; struct reg_value { int type; char* name; int len; char* value; }; static struct reg_value* regs = NULL; static int reg_size; static reg_handle_t* head = NULL; #define DIR -25 static void create_registry(void); static void open_registry(void); static void save_registry(void); static void init_registry(void); static void create_registry(void){ if(regs) { printf("Logic error: create_registry() called with existing registry\n"); save_registry(); return; } regs=(struct reg_value*)malloc(3*sizeof(struct reg_value)); regs[0].type=regs[1].type=DIR; regs[0].name=(char*)malloc(5); strcpy(regs[0].name, "HKLM"); regs[1].name=(char*)malloc(5); strcpy(regs[1].name, "HKCU"); regs[0].value=regs[1].value=NULL; regs[0].len=regs[1].len=0; reg_size=2; head = 0; save_registry(); } static void open_registry(void) { int fd; int i; unsigned int len; if(regs) { printf("Multiple open_registry(>\n"); return; } fd = open(localregpathname, O_RDONLY); if (fd == -1) { printf("Creating new registry\n"); create_registry(); return; } read(fd, ®_size, 4); regs=(struct reg_value*)malloc(reg_size*sizeof(struct reg_value)); head = 0; for(i=0; iname) free(t->name); t=t->prev; free(f); } head = 0; if (regs) { int i; for(i=0; iprev) { if(!strcmp(t->name, name)) { return t; } } return 0; } static struct reg_value* find_value_by_name(const char* name) { int i; for(i=0; iprev) { if(t->handle==handle) { return t; } } return 0; } static int generate_handle() { static unsigned int zz=249; zz++; while((zz==HKEY_LOCAL_MACHINE) || (zz==HKEY_CURRENT_USER)) zz++; return zz; } static reg_handle_t* insert_handle(long handle, const char* name) { reg_handle_t* t; t=(reg_handle_t*)malloc(sizeof(reg_handle_t)); if(head==0) { t->prev=0; } else { head->next=t; t->prev=head; } t->next=0; t->name=(char*)malloc(strlen(name)+1); strcpy(t->name, name); t->handle=handle; head=t; return t; } static char* build_keyname(long key, const char* subkey) { char* full_name; reg_handle_t* t; if((t=find_handle(key))==0) { TRACE("Invalid key\n"); return NULL; } if(subkey==NULL) subkey=""; full_name=(char*)malloc(strlen(t->name)+strlen(subkey)+10); strcpy(full_name, t->name); strcat(full_name, "\\"); strcat(full_name, subkey); return full_name; } static struct reg_value* insert_reg_value(int handle, const char* name, int type, const void* value, int len) { reg_handle_t* t; struct reg_value* v; char* fullname; if((fullname=build_keyname(handle, name))==NULL) { TRACE("Invalid handle\n"); return NULL; } if((v=find_value_by_name(fullname))==0) //creating new value in registry { if(regs==0) create_registry(); regs=(struct reg_value*)realloc(regs, sizeof(struct reg_value)*(reg_size+1)); //regs=(struct reg_value*)my_realloc(regs, sizeof(struct reg_value)*(reg_size+1)); v=regs+reg_size; reg_size++; } else //replacing old one { free(v->value); free(v->name); } TRACE("RegInsert '%s' %p v:%d len:%d\n", name, value, *(int*)value, len); v->type=type; v->len=len; v->value=(char*)malloc(len); memcpy(v->value, value, len); v->name=(char*)malloc(strlen(fullname)+1); strcpy(v->name, fullname); free(fullname); save_registry(); return v; } static void init_registry(void) { TRACE("Initializing registry\n"); // can't be free-ed - it's static and probably thread // unsafe structure which is stored in glibc #ifdef USE_WIN32DLL // MPlayer: // how about #ifdef MPLAYER ??? regpathname = get_path("registry"); localregpathname = regpathname; #else // regpathname is an external pointer // // registry.c is holding it's own internal pointer // localregpathname - which is being allocate/deallocated if (localregpathname == 0) { const char* pthn = regpathname; if (!regpathname) { // avifile - for now reading data from user's home struct passwd* pwent; pwent = getpwuid(geteuid()); pthn = pwent->pw_dir; } localregpathname = (char*)malloc(strlen(pthn)+20); strcpy(localregpathname, pthn); strcat(localregpathname, "/.registry"); } #endif open_registry(); insert_handle(HKEY_LOCAL_MACHINE, "HKLM"); insert_handle(HKEY_CURRENT_USER, "HKCU"); } static reg_handle_t* find_handle_2(long key, const char* subkey) { char* full_name; reg_handle_t* t; if((t=find_handle(key))==0) { TRACE("Invalid key\n"); return (reg_handle_t*)-1; } if(subkey==NULL) return t; full_name=(char*)malloc(strlen(t->name)+strlen(subkey)+10); strcpy(full_name, t->name); strcat(full_name, "\\"); strcat(full_name, subkey); t=find_handle_by_name(full_name); free(full_name); return t; } long RegOpenKeyExA(long key, const char* subkey, long reserved, long access, int* newkey) { char* full_name; reg_handle_t* t; struct reg_value* v; TRACE("Opening key %s\n", subkey); if(!regs) init_registry() ; /* t=find_handle_2(key, subkey); if(t==0) return -1; if(t==(reg_handle_t*)-1) return -1; */ full_name=build_keyname(key, subkey); if(!full_name) return -1; TRACE("Opening key Fullname %s\n", full_name); v=find_value_by_name(full_name); t=insert_handle(generate_handle(), full_name); *newkey=t->handle; free(full_name); return 0; } long RegCloseKey(long key) { reg_handle_t *handle; if(key==(long)HKEY_LOCAL_MACHINE) return 0; if(key==(long)HKEY_CURRENT_USER) return 0; handle=find_handle(key); if(handle==0) return 0; if(handle->prev) handle->prev->next=handle->next; if(handle->next) handle->next->prev=handle->prev; if(handle->name) free(handle->name); if(handle==head) head=head->prev; free(handle); return 1; } long RegQueryValueExA(long key, const char* value, int* reserved, int* type, int* data, int* count) { struct reg_value* t; char* c; TRACE("Querying value %s\n", value); if(!regs) init_registry(); c=build_keyname(key, value); if (!c) return 1; t=find_value_by_name(c); free(c); if (t==0) return 2; if (type) *type=t->type; if (data) { memcpy(data, t->value, (t->len<*count)?t->len:*count); TRACE("returning %d bytes: %d\n", t->len, *(int*)data); } if(*countlen) { *count=t->len; return ERROR_MORE_DATA; } else { *count=t->len; } return 0; } long RegCreateKeyExA(long key, const char* name, long reserved, void* classs, long options, long security, void* sec_attr, int* newkey, int* status) { reg_handle_t* t; char* fullname; struct reg_value* v; // TRACE("Creating/Opening key %s\n", name); if(!regs) init_registry(); fullname=build_keyname(key, name); if (!fullname) return 1; TRACE("Creating/Opening key %s\n", fullname); v=find_value_by_name(fullname); if(v==0) { int qw=45708; v=insert_reg_value(key, name, DIR, &qw, 4); if (status) *status=REG_CREATED_NEW_KEY; // return 0; } t=insert_handle(generate_handle(), fullname); *newkey=t->handle; free(fullname); return 0; } /* LONG RegEnumValue( HKEY hKey, // handle to key to query DWORD dwIndex, // index of value to query LPTSTR lpValueName, // address of buffer for value string LPDWORD lpcbValueName, // address for size of value buffer LPDWORD lpReserved, // reserved LPDWORD lpType, // address of buffer for type code LPBYTE lpData, // address of buffer for value data LPDWORD lpcbData // address for size of data buffer ); */ long RegEnumValueA(HKEY hkey, DWORD index, LPSTR value, LPDWORD val_count, LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count) { // currenly just made to support MSZH & ZLIB //printf("Reg Enum 0x%x %d %s %d data: %p %d %d >%s<\n", hkey, index, // value, *val_count, data, *count, reg_size, data); reg_handle_t* t = find_handle(hkey); if (t && index < 10) { struct reg_value* v=find_value_by_name(t->name); if (v) { memcpy(data, v->value, (v->len < *count) ? v->len : *count); if(*count < v->len) *count = v->len; if (type) *type = v->type; //printf("Found handle %s\n", v->name); return 0; } } return ERROR_NO_MORE_ITEMS; } long RegSetValueExA(long key, const char* name, long v1, long v2, const void* data, long size) { struct reg_value* t; char* c; TRACE("Request to set value %s %d\n", name, *(const int*)data); if(!regs) init_registry(); c=build_keyname(key, name); if(c==NULL) return 1; insert_reg_value(key, name, v2, data, size); free(c); return 0; } long RegEnumKeyExA(HKEY hKey, DWORD dwIndex, LPSTR lpName, LPDWORD lpcbName, LPDWORD lpReserved, LPSTR lpClass, LPDWORD lpcbClass, LPFILETIME lpftLastWriteTime) { return ERROR_NO_MORE_ITEMS; } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/registry.h0000644000175000017500000000235007560323465022354 0ustar yavoryavor#ifndef AVIFILE_REGISTRY_H #define AVIFILE_REGISTRY_H /******************************************************** * * Declaration of registry access functions * Copyright 2000 Eugene Kuznetsov (divx@euro.ru) * ********************************************************/ #ifdef __cplusplus extern "C" { #endif void free_registry(void); long RegOpenKeyExA(long key, const char* subkey, long reserved, long access, int* newkey); long RegCloseKey(long key); long RegQueryValueExA(long key, const char* value, int* reserved, int* type, int* data, int* count); long RegCreateKeyExA(long key, const char* name, long reserved, void* classs, long options, long security, void* sec_attr, int* newkey, int* status); long RegSetValueExA(long key, const char* name, long v1, long v2, const void* data, long size); #ifdef __WINE_WINERROR_H long RegEnumKeyExA(HKEY hKey, DWORD dwIndex, LPSTR lpName, LPDWORD lpcbName, LPDWORD lpReserved, LPSTR lpClass, LPDWORD lpcbClass, LPFILETIME lpftLastWriteTime); long RegEnumValueA(HKEY hkey, DWORD idx, LPSTR value, LPDWORD val_count, LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count); #endif #ifdef __cplusplus }; #endif #endif // AVIFILE_REGISTRY_H avifile-0.7.48~20090503.ds/plugins/libwin32/loader/resource.c0000644000175000017500000003065707506610025022330 0ustar yavoryavor/* * Resources * * Copyright 1993 Robert J. Amstadt * Copyright 1995 Alexandre Julliard */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define CP_ACP 0 WORD WINE_LanguageId=0x409;//english #define HRSRC_MAP_BLOCKSIZE 16 typedef struct _HRSRC_ELEM { HANDLE hRsrc; WORD type; } HRSRC_ELEM; typedef struct _HRSRC_MAP { int nAlloc; int nUsed; HRSRC_ELEM *elem; } HRSRC_MAP; static HRSRC RES_FindResource2( HMODULE hModule, LPCSTR type, LPCSTR name, WORD lang, int unicode) { HRSRC hRsrc = 0; LPWSTR typeStr, nameStr; WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule ); if(!wm) return 0; /* 32-bit PE module */ if ( HIWORD( type ) && (!unicode)) typeStr = HEAP_strdupAtoW( GetProcessHeap(), 0, type ); else typeStr = (LPWSTR)type; if ( HIWORD( name ) && (!unicode)) nameStr = HEAP_strdupAtoW( GetProcessHeap(), 0, name ); else nameStr = (LPWSTR)name; hRsrc = PE_FindResourceExW( wm, nameStr, typeStr, lang ); if ( HIWORD( type ) && (!unicode)) HeapFree( GetProcessHeap(), 0, typeStr ); if ( HIWORD( name ) && (!unicode)) HeapFree( GetProcessHeap(), 0, nameStr ); return hRsrc; } /********************************************************************** * RES_FindResource */ static HRSRC RES_FindResource( HMODULE hModule, LPCSTR type, LPCSTR name, WORD lang, int unicode ) { HRSRC hRsrc; // __TRY // { hRsrc = RES_FindResource2(hModule, type, name, lang, unicode); // } // __EXCEPT(page_fault) // { // WARN("page fault\n"); // SetLastError(ERROR_INVALID_PARAMETER); // return 0; // } // __ENDTRY return hRsrc; } /********************************************************************** * RES_SizeofResource */ static DWORD RES_SizeofResource( HMODULE hModule, HRSRC hRsrc) { DWORD size = 0; HRSRC hRsrc32; // HMODULE16 hMod16 = MapHModuleLS( hModule ); // NE_MODULE *pModule = NE_GetPtr( hMod16 ); // WINE_MODREF *wm = pModule && pModule->module32? // MODULE32_LookupHMODULE( pModule->module32 ) : NULL; WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule ); if ( !hModule || !hRsrc ) return 0; /* 32-bit PE module */ /* If we got a 16-bit hRsrc, convert it */ // hRsrc32 = HIWORD(hRsrc)? hRsrc : MapHRsrc16To32( pModule, hRsrc ); if(!HIWORD(hRsrc)) { printf("16-bit hRsrcs not supported\n"); return 0; } size = PE_SizeofResource( hModule, hRsrc ); return size; } /********************************************************************** * RES_AccessResource */ static HFILE RES_AccessResource( HMODULE hModule, HRSRC hRsrc ) { HFILE hFile = HFILE_ERROR; WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule ); if ( !hModule || !hRsrc ) return HFILE_ERROR; /* 32-bit PE module */ FIXME("32-bit modules not yet supported.\n" ); hFile = HFILE_ERROR; return hFile; } /********************************************************************** * RES_LoadResource */ static HGLOBAL RES_LoadResource( HMODULE hModule, HRSRC hRsrc) { HGLOBAL hMem = 0; HRSRC hRsrc32; WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule ); if ( !hModule || !hRsrc ) return 0; /* 32-bit PE module */ /* If we got a 16-bit hRsrc, convert it */ // hRsrc32 = HIWORD(hRsrc)? hRsrc : MapHRsrc16To32( pModule, hRsrc ); if(!HIWORD(hRsrc)) { printf("16-bit hRsrcs not supported\n"); return 0; } hMem = PE_LoadResource( wm, hRsrc ); return hMem; } /********************************************************************** * RES_LockResource */ static LPVOID RES_LockResource( HGLOBAL handle ) { LPVOID bits = NULL; TRACE("(%08x, %s)\n", handle, "PE" ); bits = (LPVOID)handle; return bits; } /********************************************************************** * RES_FreeResource */ static WIN_BOOL RES_FreeResource( HGLOBAL handle ) { HGLOBAL retv = handle; return (WIN_BOOL)retv; } /********************************************************************** * FindResourceA (KERNEL32.128) */ HANDLE WINAPI FindResourceA( HMODULE hModule, LPCSTR name, LPCSTR type ) { return RES_FindResource( hModule, type, name, WINE_LanguageId, 0); } HANDLE WINAPI FindResourceW( HMODULE hModule, LPCWSTR name, LPCWSTR type ) { return RES_FindResource( hModule, (LPCSTR)type, (LPCSTR)name, WINE_LanguageId, 1); } /********************************************************************** * FindResourceExA (KERNEL32.129) */ HANDLE WINAPI FindResourceExA( HMODULE hModule, LPCSTR type, LPCSTR name, WORD lang ) { return RES_FindResource( hModule, type, name, lang, 0 ); } HANDLE WINAPI FindResourceExW( HMODULE hModule, LPCWSTR type, LPCWSTR name, WORD lang ) { return RES_FindResource( hModule, (LPCSTR)type, (LPCSTR)name, lang, 1 ); } /********************************************************************** * LockResource (KERNEL32.384) */ LPVOID WINAPI LockResource( HGLOBAL handle ) { return RES_LockResource( handle ); } /********************************************************************** * FreeResource (KERNEL32.145) */ WIN_BOOL WINAPI FreeResource( HGLOBAL handle ) { return RES_FreeResource( handle ); } /********************************************************************** * AccessResource (KERNEL32.64) */ INT WINAPI AccessResource( HMODULE hModule, HRSRC hRsrc ) { return RES_AccessResource( hModule, hRsrc ); } /********************************************************************** * SizeofResource (KERNEL32.522) */ DWORD WINAPI SizeofResource( HINSTANCE hModule, HRSRC hRsrc ) { return RES_SizeofResource( hModule, hRsrc ); } INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id, LPWSTR buffer, INT buflen ); /********************************************************************** * LoadStringA (USER32.375) */ INT WINAPI LoadStringA( HINSTANCE instance, UINT resource_id, LPSTR buffer, INT buflen ) { INT retval; INT wbuflen; INT abuflen; LPWSTR wbuf = NULL; LPSTR abuf = NULL; if ( buffer != NULL && buflen > 0 ) *buffer = 0; wbuflen = LoadStringW(instance,resource_id,NULL,0); if ( !wbuflen ) return 0; wbuflen ++; retval = 0; wbuf = (LPWSTR) HeapAlloc( GetProcessHeap(), 0, wbuflen * sizeof(WCHAR) ); wbuflen = LoadStringW(instance,resource_id,wbuf,wbuflen); if ( wbuflen > 0 ) { abuflen = WideCharToMultiByte(CP_ACP,0,wbuf,wbuflen,NULL,0,NULL,NULL); if ( abuflen > 0 ) { if ( buffer == NULL || buflen == 0 ) retval = abuflen; else { abuf = (LPSTR) HeapAlloc( GetProcessHeap(), 0, abuflen * sizeof(CHAR) ); abuflen = WideCharToMultiByte(CP_ACP,0,wbuf,wbuflen,abuf,abuflen,NULL,NULL); if ( abuflen > 0 ) { abuflen = min(abuflen,buflen - 1); memcpy( buffer, abuf, abuflen ); buffer[abuflen] = 0; retval = abuflen; } HeapFree( GetProcessHeap(), 0, abuf ); } } } HeapFree( GetProcessHeap(), 0, wbuf ); return retval; } /********************************************************************** * LoadStringW (USER32.376) */ INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id, LPWSTR buffer, INT buflen ) { HGLOBAL hmem; HRSRC hrsrc; WCHAR *p; int string_num; int i; if (HIWORD(resource_id)==0xFFFF) /* netscape 3 passes this */ resource_id = (UINT)(-((INT)resource_id)); TRACE("instance = %04x, id = %04x, buffer = %08x, " "length = %d\n", instance, (int)resource_id, (int) buffer, buflen); /* Use bits 4 - 19 (incremented by 1) as resourceid, mask out * 20 - 31. */ hrsrc = FindResourceW( instance, (LPCWSTR)(((resource_id>>4)&0xffff)+1), RT_STRINGW ); if (!hrsrc) return 0; hmem = LoadResource( instance, hrsrc ); if (!hmem) return 0; p = (WCHAR*) LockResource(hmem); string_num = resource_id & 0x000f; for (i = 0; i < string_num; i++) p += *p + 1; TRACE("strlen = %d\n", (int)*p ); if (buffer == NULL) return *p; i = min(buflen - 1, *p); if (i > 0) { memcpy(buffer, p + 1, i * sizeof (WCHAR)); buffer[i] = (WCHAR) 0; } else { if (buflen > 1) { buffer[0] = (WCHAR) 0; return 0; } #if 0 WARN("Dont know why caller give buflen=%d *p=%d trying to obtain string '%s'\n", buflen, *p, p + 1); #endif } TRACE("String loaded !\n"); return i; } /* Messages...used by FormatMessage32* (KERNEL32.something) * * They can be specified either directly or using a message ID and * loading them from the resource. * * The resourcedata has following format: * start: * 0: DWORD nrofentries * nrofentries * subentry: * 0: DWORD firstentry * 4: DWORD lastentry * 8: DWORD offset from start to the stringentries * * (lastentry-firstentry) * stringentry: * 0: WORD len (0 marks end) * 2: WORD flags * 4: CHAR[len-4] * (stringentry i of a subentry refers to the ID 'firstentry+i') * * Yes, ANSI strings in win32 resources. Go figure. */ /********************************************************************** * LoadMessageA (internal) */ INT WINAPI LoadMessageA( HMODULE instance, UINT id, WORD lang, LPSTR buffer, INT buflen ) { HGLOBAL hmem; HRSRC hrsrc; PMESSAGE_RESOURCE_DATA mrd; PMESSAGE_RESOURCE_BLOCK mrb; PMESSAGE_RESOURCE_ENTRY mre; int i,slen; TRACE("instance = %08lx, id = %08lx, buffer = %p, length = %ld\n", (DWORD)instance, (DWORD)id, buffer, (DWORD)buflen); /*FIXME: I am not sure about the '1' ... But I've only seen those entries*/ hrsrc = FindResourceExW(instance,RT_MESSAGELISTW,(LPWSTR)1,lang); if (!hrsrc) return 0; hmem = LoadResource( instance, hrsrc ); if (!hmem) return 0; mrd = (PMESSAGE_RESOURCE_DATA)LockResource(hmem); mre = NULL; mrb = &(mrd->Blocks[0]); for (i=mrd->NumberOfBlocks;i--;) { if ((id>=mrb->LowId) && (id<=mrb->HighId)) { mre = (PMESSAGE_RESOURCE_ENTRY)(((char*)mrd)+mrb->OffsetToEntries); id -= mrb->LowId; break; } mrb++; } if (!mre) return 0; for (i=id;i--;) { if (!mre->Length) return 0; mre = (PMESSAGE_RESOURCE_ENTRY)(((char*)mre)+(mre->Length)); } slen=mre->Length; TRACE(" - strlen=%d\n",slen); i = min(buflen - 1, slen); if (buffer == NULL) return slen; if (i>0) { lstrcpynA(buffer,(char*)mre->Text,i); buffer[i]=0; } else { if (buflen>1) { buffer[0]=0; return 0; } } if (buffer) TRACE("'%s' copied !\n", buffer); return i; } /********************************************************************** * EnumResourceTypesA (KERNEL32.90) */ WIN_BOOL WINAPI EnumResourceTypesA( HMODULE hmodule,ENUMRESTYPEPROCA lpfun, LONG lParam) { /* FIXME: move WINE_MODREF stuff here */ return PE_EnumResourceTypesA(hmodule,lpfun,lParam); } /********************************************************************** * EnumResourceNamesA (KERNEL32.88) */ WIN_BOOL WINAPI EnumResourceNamesA( HMODULE hmodule, LPCSTR type, ENUMRESNAMEPROCA lpfun, LONG lParam ) { /* FIXME: move WINE_MODREF stuff here */ return PE_EnumResourceNamesA(hmodule,type,lpfun,lParam); } /********************************************************************** * EnumResourceLanguagesA (KERNEL32.86) */ WIN_BOOL WINAPI EnumResourceLanguagesA( HMODULE hmodule, LPCSTR type, LPCSTR name, ENUMRESLANGPROCA lpfun, LONG lParam) { /* FIXME: move WINE_MODREF stuff here */ return PE_EnumResourceLanguagesA(hmodule,type,name,lpfun,lParam); } /********************************************************************** * LoadResource (KERNEL32.370) */ HGLOBAL WINAPI LoadResource( HINSTANCE hModule, HRSRC hRsrc ) { return RES_LoadResource( hModule, hRsrc); } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/stubs.s0000644000175000017500000000055007360352116021650 0ustar yavoryavor .data .LC0: .string "Called unk_%s\n" .align 4 .globl unk_exp1 unk_exp1: pushl %ebp movl %esp,%ebp subl $4,%esp movl $1,-4(%ebp) movl -4(%ebp),%eax movl %eax,%ecx movl %ecx,%edx sall $4,%edx subl %eax,%edx leal 0(,%edx,2),%eax movl %eax,%edx addl $export_names,%edx pushl %edx pushl $.LC0 call printf addl $8,%esp xorl %eax,%eax leave ret avifile-0.7.48~20090503.ds/plugins/libwin32/loader/vfl.c0000644000175000017500000001023307506406051021256 0ustar yavoryavor#include "config.h" #include "loader.h" #include "driver.h" #include #include #include #if 0 #define STORE_ALL #define REST_ALL HIC ICOpen(int compressor, unsigned int mode) /// >0 compress 0 == decomp { ICOPEN icopen; icopen.fccType = mmioFOURCC('v', 'i', 'd', 'c'); icopen.fccHandler = compressor; icopen.dwSize = sizeof(ICOPEN); icopen.dwFlags = mode ? ICMODE_COMPRESS : ICMODE_DECOMPRESS; driver.dwDriverID = ++_refcount; DRVR* hDriver = new DRVR(driver); //printf("Creating new handle for %s _refcount %d, driver %d\n", Name(), _refcount,(int)hDriver); //printf("fcc: 0x%lx, handler: 0x%lx (%.4s)\n", icopen.fccType, icopen.fccHandler, (char*) &icopen.fccHandler); STORE_ALL; hDriver->dwDriverID = driver.DriverProc((int)_refcount, (int)hDriver, DRV_OPEN, 0, (int) &icopen); REST_ALL; if (!hDriver->dwDriverID) { AVM_WRITE("Win32 loader", "WARNING DRV_OPEN failed (0x%lx)\n", icopen.fccHandler); return 0; } return (HIC) hDriver; } int ICClose(HIC hic) { WINE_HIC *whic = (WINE_HIC*)hic; /* FIXME: correct? */ // CloseDriver(whic->hdrv,0,0); DrvClose(whic->hdrv); //#warning FIXME: DrvClose free(whic); return 0; } int Module::CloseHandle(int handle) { DRVR* hDriver = (DRVR*) handle; Setup_FS_Segment(); //printf("CLOSE HANDLE %s\n", Name()); STORE_ALL; driver.DriverProc(hDriver->dwDriverID, (int)hDriver, DRV_CLOSE, 0, 0); REST_ALL; //printf("decrefoucount %d\n", _refcount); _refcount--; if (_refcount==0) delete this; delete hDriver; return 0; } #endif long VFWAPIV ICCompress(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiOutput, void* lpData, LPBITMAPINFOHEADER lpbiInput, void* lpBits, long* lpckid, long* lpdwFlags, long lFrameNum,long dwFrameSize,long dwQuality, LPBITMAPINFOHEADER lpbiPrev,void* lpPrev) { // dwFlags Equal to ICCOMPRESS_KEYFRAME if a keyframe is // required, and zero otherwise. // lpckid Always points to zero. // lpdwFlags Points to AVIIF_KEYFRAME if a keyframe is required, // and zero otherwise. // lFrameNum Ascending from zero. // dwFrameSize Always set to 7FFFFFFF (Win9x) or 00FFFFFF (WinNT) // for first frame. Set to zero for subsequent frames // if data rate control is not active or not supported, // and to the desired frame size in bytes if it is. // dwQuality Set to quality factor from 0-10000 if quality is // supported. Otherwise, it is zero. // lpbiPrev Set to NULL if not required. // lpPrev Set to NULL if not required. ICCOMPRESS iccmp; iccmp.dwFlags = dwFlags; iccmp.lpbiOutput = lpbiOutput; iccmp.lpOutput = lpData; iccmp.lpbiInput = lpbiInput; iccmp.lpInput = lpBits; iccmp.lpckid = lpckid; iccmp.lpdwFlags = lpdwFlags; iccmp.lFrameNum = lFrameNum; iccmp.dwFrameSize = dwFrameSize; iccmp.dwQuality = dwQuality; iccmp.lpbiPrev = lpbiPrev; iccmp.lpPrev = lpPrev; return ICSendMessage(hic, ICM_COMPRESS, (long)&iccmp, sizeof(iccmp)); } long VFWAPIV ICDecompress(HIC hic, long dwFlags, LPBITMAPINFOHEADER lpbiFormat, void* lpData, LPBITMAPINFOHEADER lpbi, void* lpBits) { ICDECOMPRESS icd; icd.dwFlags = dwFlags; icd.lpbiInput = lpbiFormat; icd.lpInput = lpData; icd.lpbiOutput = lpbi; icd.lpOutput = lpBits; icd.ckid = 0; return ICSendMessage(hic, ICM_DECOMPRESS, (long)&icd, sizeof(icd)); } long VFWAPIV ICUniversalEx(HIC hic, int command, long dwFlags, LPBITMAPINFOHEADER lpbiFormat, const void* lpData, LPBITMAPINFOHEADER lpbi, void* lpBits) { ICDECOMPRESSEX icd; icd.dwFlags = dwFlags; icd.lpbiSrc = lpbiFormat; icd.lpSrc = lpData; icd.lpbiDst = lpbi; icd.lpDst = lpBits; icd.xSrc = icd.ySrc = 0; icd.dxSrc = lpbiFormat->biWidth; icd.dySrc = labs(lpbiFormat->biHeight); icd.xDst = icd.yDst = 0; icd.dxDst = lpbi->biWidth; icd.dyDst = labs(lpbi->biHeight); return ICSendMessage(hic, command, (long)&icd, sizeof(icd)); } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/win32.c0000644000175000017500000034553510041227611021440 0ustar yavoryavor/*********************************************************** Win32 emulation code. Functions that emulate responses from corresponding Win32 API calls. Since we are not going to be able to load virtually any DLL, we can only implement this much, adding needed functions with each new codec. Basic principle of implementation: it's not good for DLL to know too much about its environment. ************************************************************/ #include "config.h" #include "wine/winbase.h" #include "wine/winreg.h" #include "wine/winnt.h" #include "wine/winerror.h" #include "wine/debugtools.h" #include "wine/module.h" #include #include "win32.h" #include "registry.h" #include "loader.h" #include "com.h" #include #include #include #include #include #include #ifdef HAVE_MALLOC_H #include #endif #include #include #include #include #include #include #ifdef HAVE_KSTAT #include #endif #if HAVE_VSSCANF int vsscanf( const char *str, const char *format, va_list ap); #else /* system has no vsscanf. try to provide one */ static int vsscanf( const char *str, const char *format, va_list ap) { long p1 = va_arg(ap, long); long p2 = va_arg(ap, long); long p3 = va_arg(ap, long); long p4 = va_arg(ap, long); long p5 = va_arg(ap, long); return sscanf(str, format, p1, p2, p3, p4, p5); } #endif char* def_path = WIN32_PATH; static void do_cpuid(unsigned int ax, unsigned int *regs) { __asm__ __volatile__ ( "pushl %%ebx; pushl %%ecx; pushl %%edx;" ".byte 0x0f, 0xa2;" "movl %%eax, (%2);" "movl %%ebx, 4(%2);" "movl %%ecx, 8(%2);" "movl %%edx, 12(%2);" "popl %%edx; popl %%ecx; popl %%ebx;" : "=a" (ax) : "0" (ax), "S" (regs) ); } static unsigned int c_localcount_tsc(void) { int a; __asm__ __volatile__ ( "rdtsc\n\t" :"=a"(a) : :"edx" ); return a; } static void c_longcount_tsc(long long* z) { __asm__ __volatile__ ( "pushl %%ebx\n\t" "movl %%eax, %%ebx\n\t" "rdtsc\n\t" "movl %%eax, 0(%%ebx)\n\t" "movl %%edx, 4(%%ebx)\n\t" "popl %%ebx\n\t" ::"a"(z) ); } static unsigned int c_localcount_notsc() { struct timeval tv; unsigned limit=~0; limit/=1000000; gettimeofday(&tv, 0); return limit*tv.tv_usec; } static void c_longcount_notsc(long long* z) { struct timeval tv; unsigned long long result; unsigned limit=~0; if(!z)return; limit/=1000000; gettimeofday(&tv, 0); result=tv.tv_sec; result<<=32; result+=limit*tv.tv_usec; *z=result; } static unsigned int localcount_stub(void); static void longcount_stub(long long*); static unsigned int (*localcount)()=localcount_stub; static void (*longcount)(long long*)=longcount_stub; static pthread_mutex_t memmut; static unsigned int localcount_stub(void) { unsigned int regs[4]; do_cpuid(1, regs); if ((regs[3] & 0x00000010) != 0) { localcount=c_localcount_tsc; longcount=c_longcount_tsc; } else { localcount=c_localcount_notsc; longcount=c_longcount_notsc; } return localcount(); } static void longcount_stub(long long* z) { unsigned int regs[4]; do_cpuid(1, regs); if ((regs[3] & 0x00000010) != 0) { localcount=c_localcount_tsc; longcount=c_longcount_tsc; } else { localcount=c_localcount_notsc; longcount=c_longcount_notsc; } longcount(z); } //#define DETAILED_OUT #ifdef DETAILED_OUT static int shdebug = 1; static inline void dbgprintf(const char* fmt, ...) { #ifndef MPLAYER FILE* f; va_list va; if (!shdebug) return; va_start(va, fmt); f=fopen("./log", "a"); vprintf(fmt, va); fflush(stdout); if(f) { vfprintf(f, fmt, va); fsync(fileno(f)); fclose(f); } va_end(va); #else /* MPLAYER */ #include "../mp_msg.h" if (verbose > 2) { va_list va; va_start(va, fmt); // vprintf(fmt, va); mp_dbg(MSGT_WIN32, MSGL_DBG3, fmt, va); va_end(va); } #endif } #else //#define dbgprintf if (0) printf // gcc only ?? #define dbgprintf(A,...) #endif char export_names[300][32]={ "name1", //"name2", //"name3" }; //#define min(x,y) ((x)<(y)?(x):(y)) void destroy_event(void* event); struct th_list_t; typedef struct th_list_t{ int id; void* thread; struct th_list_t* next; struct th_list_t* prev; } th_list; // have to be cleared by GARBAGE COLLECTOR static unsigned char* heap=NULL; static int heap_counter=0; static th_list* list=NULL; static void test_heap(void) { int offset=0; if(heap==0) return; while(offset20000000) { printf("No enough memory\n"); return 0; } *(int*)(heap+heap_counter)=0x433476; heap_counter+=4; *(int*)(heap+heap_counter)=size; heap_counter+=4; printf("Allocated %d bytes of memory: sys %d, user %d-%d\n", size, heap_counter-8, heap_counter, heap_counter+size); if(to_zero) memset(heap+heap_counter, 0, size); else memset(heap+heap_counter, 0xcc, size); // make crash reproducable heap_counter+=size; return heap+heap_counter-size; } static int my_release(char* memory) { // test_heap(); if(memory==NULL) { printf("ERROR: free(0)\n"); return 0; } if(*(int*)(memory-8)!=0x433476) { printf("MEMORY CORRUPTION !!!!!!!!!!!!!!!!!!!\n"); return 0; } printf("Freed %d bytes of memory\n", *(int*)(memory-4)); // memset(memory-8, *(int*)(memory-4), 0xCC); return 0; } #else #define GARBAGE typedef struct alloc_header_t alloc_header; struct alloc_header_t { // let's keep allocated data 16 byte aligned alloc_header* prev; alloc_header* next; long deadbeef; long size; long type; long reserved1; long reserved2; long reserved3; }; #ifdef GARBAGE static alloc_header* last_alloc = NULL; static int alccnt = 0; #endif #define AREATYPE_CLIENT 0 #define AREATYPE_EVENT 1 #define AREATYPE_MUTEX 2 #define AREATYPE_COND 3 #define AREATYPE_CRITSECT 4 /* -- critical sections -- */ struct CRITSECT { pthread_t id; pthread_mutex_t mutex; int locked; long deadbeef; }; void* mreq_private(int size, int to_zero, int type); void* mreq_private(int size, int to_zero, int type) { int nsize = size + sizeof(alloc_header); alloc_header* header = (alloc_header* ) malloc(nsize); if (!header) return 0; if (to_zero) memset(header, 0, nsize); #ifdef GARBAGE if (!last_alloc) { pthread_mutex_init(&memmut, NULL); pthread_mutex_lock(&memmut); } else { pthread_mutex_lock(&memmut); last_alloc->next = header; /* set next */ } header->prev = last_alloc; header->next = 0; last_alloc = header; alccnt++; pthread_mutex_unlock(&memmut); #endif header->deadbeef = 0xdeadbeef; header->size = size; header->type = type; //if (alccnt < 40000) printf("MY_REQ: %p\t%d t:%d (cnt:%d)\n", header, size, type, alccnt); return header + 1; } static int my_release(void* memory) { alloc_header* header = (alloc_header*) memory - 1; #ifdef GARBAGE alloc_header* prevmem; alloc_header* nextmem; if (memory == 0) return 0; pthread_mutex_lock(&memmut); if (header->deadbeef != (long) 0xdeadbeef) { printf("FATAL releasing corrupted memory! %p 0x%lx (%d)\n", header, header->deadbeef, alccnt); pthread_mutex_unlock(&memmut); return 0; } switch(header->type) { case AREATYPE_EVENT: destroy_event(memory); break; case AREATYPE_COND: pthread_cond_destroy((pthread_cond_t*)memory); break; case AREATYPE_MUTEX: pthread_mutex_destroy((pthread_mutex_t*)memory); break; case AREATYPE_CRITSECT: pthread_mutex_destroy(&((struct CRITSECT*)memory)->mutex); break; default: //memset(memory, 0xcc, header->size); ; } header->deadbeef = 0; prevmem = header->prev; nextmem = header->next; if (prevmem) prevmem->next = nextmem; if (nextmem) nextmem->prev = prevmem; if (header == last_alloc) last_alloc = prevmem; alccnt--; pthread_mutex_unlock(&memmut); if (!last_alloc) pthread_mutex_destroy(&memmut); //if (alccnt < 40000) printf("MY_RELEASE: %p\t%ld (%d)\n", header, header->size, alccnt); #else if (memory == 0) return 0; #endif //memset(header + 1, 0xcc, header->size); free(header); return 0; } #endif static inline void* my_mreq(int size, int to_zero) { return mreq_private(size, to_zero, AREATYPE_CLIENT); } static int my_size(void* memory) { if(!memory) return 0; return ((alloc_header*)memory)[-1].size; } static void* my_realloc(void* memory, int size) { void *ans = memory; int osize; if (memory == NULL) return my_mreq(size, 0); osize = my_size(memory); if (osize < size) { ans = my_mreq(size, 0); memcpy(ans, memory, osize); my_release(memory); } return ans; } /* * * WINE API - native implementation for several win32 libraries * */ static int WINAPI ext_unknown() { printf("Unknown func called\n"); return 0; } static int WINAPI expIsBadWritePtr(void* ptr, unsigned int count) { int result = (count == 0 || ptr != 0) ? 0 : 1; dbgprintf("IsBadWritePtr(0x%x, 0x%x) => %d\n", ptr, count, result); return result; } static int WINAPI expIsBadReadPtr(void* ptr, unsigned int count) { int result = (count == 0 || ptr != 0) ? 0 : 1; dbgprintf("IsBadReadPtr(0x%x, 0x%x) => %d\n", ptr, count, result); return result; } static int WINAPI expDisableThreadLibraryCalls(int module) { dbgprintf("DisableThreadLibraryCalls(0x%x) => 0\n", module); return 0; } static HMODULE WINAPI expGetDriverModuleHandle(DRVR* pdrv) { HMODULE result; if (pdrv==NULL) result=0; else result=pdrv->hDriverModule; dbgprintf("GetDriverModuleHandle(%p) => %p\n", pdrv, result); return result; } #define MODULE_HANDLE_kernel32 ((HMODULE)0x120) #define MODULE_HANDLE_user32 ((HMODULE)0x121) static HMODULE WINAPI expGetModuleHandleA(const char* name) { WINE_MODREF* wm; HMODULE result; if(!name) result=0; else { wm=MODULE_FindModule(name); if(wm==0)result=0; else result=(HMODULE)(wm->module); } if(!result) { if(name && strcasecmp(name, "kernel32")==0) result=MODULE_HANDLE_kernel32; } dbgprintf("GetModuleHandleA('%s') => 0x%x\n", name, result); return result; } static void* WINAPI expCreateThread(void* pSecAttr, long dwStackSize, void* lpStartAddress, void* lpParameter, long dwFlags, long* dwThreadId) { pthread_t *pth; // printf("CreateThread:"); pth = (pthread_t*) my_mreq(sizeof(pthread_t), 0); pthread_create(pth, NULL, (void*(*)(void*))lpStartAddress, lpParameter); if(dwFlags) printf( "WARNING: CreateThread flags not supported\n"); if(dwThreadId) *dwThreadId=(long)pth; if(list==NULL) { list=my_mreq(sizeof(th_list), 1); list->next=list->prev=NULL; } else { list->next=my_mreq(sizeof(th_list), 0); list->next->prev=list; list->next->next=NULL; list=list->next; } list->thread=pth; dbgprintf("CreateThread(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x) => 0x%x\n", pSecAttr, dwStackSize, lpStartAddress, lpParameter, dwFlags, dwThreadId, pth); return pth; } struct mutex_list_t; struct mutex_list_t { char type; pthread_mutex_t *pm; pthread_cond_t *pc; char state; char reset; char name[128]; int semaphore; struct mutex_list_t* next; struct mutex_list_t* prev; }; typedef struct mutex_list_t mutex_list; static mutex_list* mlist=NULL; void destroy_event(void* event) { mutex_list* pp=mlist; // printf("garbage collector: destroy_event(%x)\n", event); while(pp) { if(pp==(mutex_list*)event) { if(pp->next) pp->next->prev=pp->prev; if(pp->prev) pp->prev->next=pp->next; if(mlist==(mutex_list*)event) mlist=mlist->prev; /* pp=mlist; while(pp) { printf("%x => ", pp); pp=pp->prev; } printf("0\n"); */ return; } pp=pp->prev; } } static void* WINAPI expCreateEventA(void* pSecAttr, char bManualReset, char bInitialState, const char* name) { pthread_mutex_t *pm; pthread_cond_t *pc; /* mutex_list* pp; pp=mlist; while(pp) { printf("%x => ", pp); pp=pp->prev; } printf("0\n"); */ if(mlist!=NULL) { mutex_list* pp=mlist; if(name!=NULL) do { if((strcmp(pp->name, name)==0) && (pp->type==0)) { dbgprintf("CreateEventA(0x%x, 0x%x, 0x%x, 0x%x='%s') => 0x%x\n", pSecAttr, bManualReset, bInitialState, name, name, pp->pm); return pp->pm; } }while((pp=pp->prev) != NULL); } pm=mreq_private(sizeof(pthread_mutex_t), 0, AREATYPE_MUTEX); pthread_mutex_init(pm, NULL); pc=mreq_private(sizeof(pthread_cond_t), 0, AREATYPE_COND); pthread_cond_init(pc, NULL); if(mlist==NULL) { mlist=mreq_private(sizeof(mutex_list), 00, AREATYPE_EVENT); mlist->next=mlist->prev=NULL; } else { mlist->next=mreq_private(sizeof(mutex_list), 00, AREATYPE_EVENT); mlist->next->prev=mlist; mlist->next->next=NULL; mlist=mlist->next; } mlist->type=0; /* Type Event */ mlist->pm=pm; mlist->pc=pc; mlist->state=bInitialState; mlist->reset=bManualReset; if(name) strncpy(mlist->name, name, 127); else mlist->name[0]=0; if(pm==NULL) dbgprintf("ERROR::: CreateEventA failure\n"); /* if(bInitialState) pthread_mutex_lock(pm); */ if(name) dbgprintf("CreateEventA(0x%x, 0x%x, 0x%x, 0x%x='%s') => 0x%x\n", pSecAttr, bManualReset, bInitialState, name, name, mlist); else dbgprintf("CreateEventA(0x%x, 0x%x, 0x%x, NULL) => 0x%x\n", pSecAttr, bManualReset, bInitialState, mlist); return mlist; } static void* WINAPI expSetEvent(void* event) { mutex_list *ml = (mutex_list *)event; dbgprintf("SetEvent(%x) => 0x1\n", event); pthread_mutex_lock(ml->pm); if (ml->state == 0) { ml->state = 1; pthread_cond_signal(ml->pc); } pthread_mutex_unlock(ml->pm); return (void *)1; } static void* WINAPI expResetEvent(void* event) { mutex_list *ml = (mutex_list *)event; dbgprintf("ResetEvent(0x%x) => 0x1\n", event); pthread_mutex_lock(ml->pm); ml->state = 0; pthread_mutex_unlock(ml->pm); return (void *)1; } static void* WINAPI expWaitForSingleObject(void* object, int duration) { mutex_list *ml = (mutex_list *)object; // FIXME FIXME FIXME - this value is sometime unititialize !!! int ret = WAIT_FAILED; mutex_list* pp=mlist; if(object == (void*)0xcfcf9898) { /** From GetCurrentThread() documentation: A pseudo handle is a special constant that is interpreted as the current thread handle. The calling thread can use this handle to specify itself whenever a thread handle is required. Pseudo handles are not inherited by child processes. This handle has the maximum possible access to the thread object. For systems that support security descriptors, this is the maximum access allowed by the security descriptor for the calling process. For systems that do not support security descriptors, this is THREAD_ALL_ACCESS. The function cannot be used by one thread to create a handle that can be used by other threads to refer to the first thread. The handle is always interpreted as referring to the thread that is using it. A thread can create a "real" handle to itself that can be used by other threads, or inherited by other processes, by specifying the pseudo handle as the source handle in a call to the DuplicateHandle function. **/ dbgprintf("WaitForSingleObject(thread_handle) called\n"); return (void*)WAIT_FAILED; } dbgprintf("WaitForSingleObject(0x%x, duration %d) =>\n",object, duration); // loop below was slightly fixed - its used just for checking if // this object really exists in our list if (!ml) return (void*) ret; while (pp && (pp->pm != ml->pm)) pp = pp->prev; if (!pp) { dbgprintf("WaitForSingleObject: NotFound\n"); return (void*)ret; } pthread_mutex_lock(ml->pm); switch(ml->type) { case 0: /* Event */ if (duration == 0) { /* Check Only */ if (ml->state == 1) ret = WAIT_FAILED; else ret = WAIT_OBJECT_0; } if (duration == -1) { /* INFINITE */ if (ml->state == 0) pthread_cond_wait(ml->pc,ml->pm); if (ml->reset) ml->state = 0; ret = WAIT_OBJECT_0; } if (duration > 0) { /* Timed Wait */ struct timespec abstime; struct timeval now; gettimeofday(&now, 0); abstime.tv_sec = now.tv_sec + (now.tv_usec+duration)/1000000; abstime.tv_nsec = ((now.tv_usec+duration)%1000000)*1000; if (ml->state == 0) ret=pthread_cond_timedwait(ml->pc,ml->pm,&abstime); if (ret == ETIMEDOUT) ret = WAIT_TIMEOUT; else ret = WAIT_OBJECT_0; if (ml->reset) ml->state = 0; } break; case 1: /* Semaphore */ if (duration == 0) { if(ml->semaphore==0) ret = WAIT_FAILED; else { ml->semaphore++; ret = WAIT_OBJECT_0; } } if (duration == -1) { if (ml->semaphore==0) pthread_cond_wait(ml->pc,ml->pm); ml->semaphore--; } break; } pthread_mutex_unlock(ml->pm); dbgprintf("WaitForSingleObject(0x%x, %d): 0x%x => 0x%x \n",object,duration,ml,ret); return (void *)ret; } static int pf_set = 0; static BYTE PF[64] = {0,}; static void DumpSystemInfo(const SYSTEM_INFO* si) { dbgprintf(" Processor architecture %d\n", si->u.s.wProcessorArchitecture); dbgprintf(" Page size: %d\n", si->dwPageSize); dbgprintf(" Minimum app address: %d\n", si->lpMinimumApplicationAddress); dbgprintf(" Maximum app address: %d\n", si->lpMaximumApplicationAddress); dbgprintf(" Active processor mask: 0x%x\n", si->dwActiveProcessorMask); dbgprintf(" Number of processors: %d\n", si->dwNumberOfProcessors); dbgprintf(" Processor type: 0x%x\n", si->dwProcessorType); dbgprintf(" Allocation granularity: 0x%x\n", si->dwAllocationGranularity); dbgprintf(" Processor level: 0x%x\n", si->wProcessorLevel); dbgprintf(" Processor revision: 0x%x\n", si->wProcessorRevision); } static void WINAPI expGetSystemInfo(SYSTEM_INFO* si) { /* FIXME: better values for the two entries below... */ static int cache = 0; static SYSTEM_INFO cachedsi; unsigned int regs[4]; dbgprintf("GetSystemInfo(%p) =>\n", si); if (cache) { memcpy(si,&cachedsi,sizeof(*si)); DumpSystemInfo(si); return; } memset(PF,0,sizeof(PF)); pf_set = 1; cachedsi.u.s.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL; cachedsi.dwPageSize = getpagesize(); /* FIXME: better values for the two entries below... */ cachedsi.lpMinimumApplicationAddress = (void *)0x00000000; cachedsi.lpMaximumApplicationAddress = (void *)0x7FFFFFFF; cachedsi.dwActiveProcessorMask = 1; cachedsi.dwNumberOfProcessors = 1; cachedsi.dwProcessorType = PROCESSOR_INTEL_386; cachedsi.dwAllocationGranularity = 0x10000; cachedsi.wProcessorLevel = 5; /* pentium */ cachedsi.wProcessorRevision = 0x0101; #ifdef MPLAYER /* mplayer's way to detect PF's */ { #include "../cpudetect.h" extern CpuCaps gCpuCaps; if (gCpuCaps.hasMMX) PF[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE; if (gCpuCaps.hasSSE) PF[PF_XMMI_INSTRUCTIONS_AVAILABLE] = TRUE; if (gCpuCaps.has3DNow) PF[PF_AMD3D_INSTRUCTIONS_AVAILABLE] = TRUE; switch(gCpuCaps.cpuType) { case CPUTYPE_I686: case CPUTYPE_I586: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; cachedsi.wProcessorLevel = 5; break; case CPUTYPE_I486: cachedsi.dwProcessorType = PROCESSOR_INTEL_486; cachedsi.wProcessorLevel = 4; break; case CPUTYPE_I386: default: cachedsi.dwProcessorType = PROCESSOR_INTEL_386; cachedsi.wProcessorLevel = 3; break; } cachedsi.wProcessorRevision = gCpuCaps.cpuStepping; cachedsi.dwNumberOfProcessors = 1; /* hardcoded */ } #endif /* disable cpuid based detection (mplayer's cpudetect.c does this - see above) */ #ifndef MPLAYER #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__svr4__) do_cpuid(1, regs); switch ((regs[0] >> 8) & 0xf) { // cpu family case 3: cachedsi.dwProcessorType = PROCESSOR_INTEL_386; cachedsi.wProcessorLevel= 3; break; case 4: cachedsi.dwProcessorType = PROCESSOR_INTEL_486; cachedsi.wProcessorLevel= 4; break; case 5: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; cachedsi.wProcessorLevel= 5; break; case 6: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; cachedsi.wProcessorLevel= 5; break; default:cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; cachedsi.wProcessorLevel= 5; break; } cachedsi.wProcessorRevision = regs[0] & 0xf; // stepping if (regs[3] & (1 << 8)) PF[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE; if (regs[3] & (1 << 23)) PF[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE; if (regs[3] & (1 << 25)) PF[PF_XMMI_INSTRUCTIONS_AVAILABLE] = TRUE; if (regs[3] & (1 << 31)) PF[PF_AMD3D_INSTRUCTIONS_AVAILABLE] = TRUE; cachedsi.dwNumberOfProcessors=1; #endif #endif /* MPLAYER */ /* MPlayer: linux detection enabled (based on proc/cpuinfo) for checking fdiv_bug and fpu emulation flags -- alex/MPlayer */ #ifdef __linux__ { char buf[20]; char line[200]; FILE *f = fopen ("/proc/cpuinfo", "r"); if (!f) return; while (fgets(line,200,f)!=NULL) { char *s,*value; /* NOTE: the ':' is the only character we can rely on */ if (!(value = strchr(line,':'))) continue; /* terminate the valuename */ *value++ = '\0'; /* skip any leading spaces */ while (*value==' ') value++; if ((s=strchr(value,'\n'))) *s='\0'; /* 2.1 method */ if (!lstrncmpiA(line, "cpu family",strlen("cpu family"))) { if (isdigit (value[0])) { switch (value[0] - '0') { case 3: cachedsi.dwProcessorType = PROCESSOR_INTEL_386; cachedsi.wProcessorLevel= 3; break; case 4: cachedsi.dwProcessorType = PROCESSOR_INTEL_486; cachedsi.wProcessorLevel= 4; break; case 5: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; cachedsi.wProcessorLevel= 5; break; case 6: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; cachedsi.wProcessorLevel= 5; break; default:cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; cachedsi.wProcessorLevel= 5; break; } } /* set the CPU type of the current processor */ sprintf(buf,"CPU %ld",cachedsi.dwProcessorType); continue; } /* old 2.0 method */ if (!lstrncmpiA(line, "cpu",strlen("cpu"))) { if ( isdigit (value[0]) && value[1] == '8' && value[2] == '6' && value[3] == 0 ) { switch (value[0] - '0') { case 3: cachedsi.dwProcessorType = PROCESSOR_INTEL_386; cachedsi.wProcessorLevel= 3; break; case 4: cachedsi.dwProcessorType = PROCESSOR_INTEL_486; cachedsi.wProcessorLevel= 4; break; case 5: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; cachedsi.wProcessorLevel= 5; break; case 6: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; cachedsi.wProcessorLevel= 5; break; default:cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; cachedsi.wProcessorLevel= 5; break; } } /* set the CPU type of the current processor */ sprintf(buf,"CPU %ld",cachedsi.dwProcessorType); continue; } if (!lstrncmpiA(line,"fdiv_bug",strlen("fdiv_bug"))) { if (!lstrncmpiA(value,"yes",3)) PF[PF_FLOATING_POINT_PRECISION_ERRATA] = TRUE; continue; } if (!lstrncmpiA(line,"fpu",strlen("fpu"))) { if (!lstrncmpiA(value,"no",2)) PF[PF_FLOATING_POINT_EMULATED] = TRUE; continue; } if (!lstrncmpiA(line,"processor",strlen("processor"))) { /* processor number counts up...*/ unsigned int x; if (sscanf(value,"%d",&x)) if (x+1>cachedsi.dwNumberOfProcessors) cachedsi.dwNumberOfProcessors=x+1; /* Create a new processor subkey on a multiprocessor * system */ sprintf(buf,"%d",x); } if (!lstrncmpiA(line,"stepping",strlen("stepping"))) { int x; if (sscanf(value,"%d",&x)) cachedsi.wProcessorRevision = x; } if ( (!lstrncmpiA(line,"flags",strlen("flags"))) || (!lstrncmpiA(line,"features",strlen("features"))) ) { if (strstr(value,"cx8")) PF[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE; if (strstr(value,"mmx")) PF[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE; if (strstr(value,"tsc")) PF[PF_RDTSC_INSTRUCTION_AVAILABLE] = TRUE; if (strstr(value,"xmm")) PF[PF_XMMI_INSTRUCTIONS_AVAILABLE] = TRUE; if (strstr(value,"3dnow")) PF[PF_AMD3D_INSTRUCTIONS_AVAILABLE] = TRUE; } } fclose (f); /* * ad hoc fix for smp machines. * some problems on WaitForSingleObject,CreateEvent,SetEvent * CreateThread ...etc.. * */ cachedsi.dwNumberOfProcessors=1; } #endif /* __linux__ */ cache = 1; memcpy(si,&cachedsi,sizeof(*si)); DumpSystemInfo(si); } // avoid undefined expGetSystemInfo static WIN_BOOL WINAPI expIsProcessorFeaturePresent(DWORD v) { WIN_BOOL result = 0; if (!pf_set) { SYSTEM_INFO si; expGetSystemInfo(&si); } else result=PF[v]; dbgprintf("IsProcessorFeaturePresent(0x%x) => 0x%x\n", v, result); return result; } static long WINAPI expGetVersion() { dbgprintf("GetVersion() => 0xC0000004\n"); return 0xC0000004;//Windows 95 } static HANDLE WINAPI expHeapCreate(long flags, long init_size, long max_size) { // printf("HeapCreate:"); HANDLE result; if(init_size==0) result=(HANDLE)my_mreq(0x110000, 0); else result=(HANDLE)my_mreq((init_size + 0xfff) & 0x7ffff000 , 0); dbgprintf("HeapCreate(flags 0x%x, initial size %d, maximum size %d) => 0x%x\n", flags, init_size, max_size, result); return result; } // this is another dirty hack // VP31 is releasing one allocated Heap chunk twice // we will silently ignore this second call... static void* heapfreehack = 0; static int heapfreehackshown = 0; void trapbug(void); static void* WINAPI expHeapAlloc(HANDLE heap, int flags, int size) { void* z; /** Morgan's m3jpeg32.dll v. 2.0 encoder expects that request for HeapAlloc returns area larger than size argument :-/ actually according to M$ Doc HeapCreate size should be rounded to page boundaries thus we should simulate this **/ //if (size == 22276) trapbug(); z=my_mreq((size + 0xfff) & 0x7ffff000, (flags & HEAP_ZERO_MEMORY)); if(z==0) printf("HeapAlloc failure\n"); dbgprintf("HeapAlloc(heap 0x%x, flags 0x%x, size %d) => 0x%x\n", heap, flags, size, z); heapfreehack = 0; // reset return z; } static long WINAPI expHeapDestroy(void* heap) { dbgprintf("HeapDestroy(heap 0x%x) => 1\n", heap); my_release(heap); return 1; } static long WINAPI expHeapFree(HANDLE heap, DWORD dwFlags, LPVOID lpMem) { dbgprintf("HeapFree(0x%x, 0x%x, pointer 0x%x) => 1\n", heap, dwFlags, lpMem); if (heapfreehack != lpMem && lpMem != (void*)0xffffffff && lpMem != (void*)0xbdbdbdbd) // 0xbdbdbdbd is for i263_drv.drv && libefence // it seems to be reading from relased memory // EF_PROTECT_FREE doens't show any probleme my_release(lpMem); else { if (!heapfreehackshown++) printf("Info: HeapFree deallocating same memory twice! (%p)\n", lpMem); } heapfreehack = lpMem; return 1; } static long WINAPI expHeapSize(int heap, int flags, void* pointer) { long result=my_size(pointer); dbgprintf("HeapSize(heap 0x%x, flags 0x%x, pointer 0x%x) => %d\n", heap, flags, pointer, result); return result; } static void* WINAPI expHeapReAlloc(HANDLE heap,int flags,void *lpMem,int size) { long orgsize = my_size(lpMem); dbgprintf("HeapReAlloc() Size %ld org %d\n",orgsize,size); return my_realloc(lpMem, size); } static long WINAPI expGetProcessHeap(void) { dbgprintf("GetProcessHeap() => 1\n"); return 1; } static void* WINAPI expVirtualAlloc(void* v1, long v2, long v3, long v4) { void* z = VirtualAlloc(v1, v2, v3, v4); if(z==0) printf("VirtualAlloc failure\n"); dbgprintf("VirtualAlloc(0x%x, %d, %d, %d) => 0x%x \n",v1,v2,v3,v4, z); return z; } static int WINAPI expVirtualFree(void* v1, int v2, int v3) { int result = VirtualFree(v1,v2,v3); dbgprintf("VirtualFree(0x%x, %d, %d) => %d\n",v1,v2,v3, result); return result; } /* we're building a table of critical sections. cs_win pointer uses the DLL cs_unix is the real structure, we're using cs_win only to identifying cs_unix */ struct critsecs_list_t { CRITICAL_SECTION *cs_win; struct CRITSECT *cs_unix; }; /* 'NEWTYPE' is working with VIVO and 3ivX dll (no more segfaults) -- alex */ #undef CRITSECS_NEWTYPE //#define CRITSECS_NEWTYPE 1 #ifdef CRITSECS_NEWTYPE #define CRITSECS_LIST_MAX 20 static struct critsecs_list_t critsecs_list[CRITSECS_LIST_MAX]; static int critsecs_get_pos(CRITICAL_SECTION *cs_win) { int i; for (i=0; i < CRITSECS_LIST_MAX; i++) if (critsecs_list[i].cs_win == cs_win) return(i); return(-1); } static int critsecs_get_unused(void) { int i; for (i=0; i < CRITSECS_LIST_MAX; i++) if (critsecs_list[i].cs_win == NULL) return(i); return(-1); } #if 0 #define critsecs_get_unix(cs_win) (critsecs_list[critsecs_get_pos(cs_win)].cs_win) #else struct CRITSECT *critsecs_get_unix(CRITICAL_SECTION *cs_win) { int i; for (i=0; i < CRITSECS_LIST_MAX; i++) if (critsecs_list[i].cs_win == cs_win && critsecs_list[i].cs_unix) return(critsecs_list[i].cs_unix); return(NULL); } #endif #endif static void WINAPI expInitializeCriticalSection(CRITICAL_SECTION* c) { dbgprintf("InitializeCriticalSection(0x%x)\n", c); /* if(sizeof(pthread_mutex_t)>sizeof(CRITICAL_SECTION)) { printf(" ERROR:::: sizeof(pthread_mutex_t) is %d, expected <=%d!\n", sizeof(pthread_mutex_t), sizeof(CRITICAL_SECTION)); return; }*/ /* pthread_mutex_init((pthread_mutex_t*)c, NULL); */ #ifdef CRITSECS_NEWTYPE { struct CRITSECT *cs; int i = critsecs_get_unused(); if (i < 0) { printf("InitializeCriticalSection(%p) - no more space in list\n", c); return; } dbgprintf("got unused space at %d\n", i); cs = malloc(sizeof(struct CRITSECT)); if (!cs) { printf("InitializeCriticalSection(%p) - out of memory\n", c); return; } pthread_mutex_init(&cs->mutex, NULL); cs->locked = 0; critsecs_list[i].cs_win = c; critsecs_list[i].cs_unix = cs; dbgprintf("InitializeCriticalSection -> itemno=%d, cs_win=%p, cs_unix=%p\n", i, c, cs); } #else { struct CRITSECT* cs = mreq_private(sizeof(struct CRITSECT) + sizeof(CRITICAL_SECTION), 0, AREATYPE_CRITSECT); pthread_mutex_init(&cs->mutex, NULL); cs->locked=0; cs->deadbeef = 0xdeadbeef; *(void**)c = cs + 1; } #endif } static void WINAPI expEnterCriticalSection(CRITICAL_SECTION* c) { #ifdef CRITSECS_NEWTYPE struct CRITSECT* cs = critsecs_get_unix(c); #else struct CRITSECT* cs = (*(struct CRITSECT**)c); #endif dbgprintf("EnterCriticalSection(0x%x) %p\n", c, cs); if (!cs) { dbgprintf("Win32 Warning: entered uninitialized Critical Section!\n"); expInitializeCriticalSection(c); #ifdef CRITSECS_NEWTYPE cs = critsecs_get_unix(c); #else cs = (*(struct CRITSECT**)c); #endif } #ifndef CRITSECS_NEWTYPE cs -= 1; #endif if(cs->locked) if(cs->id==pthread_self()) return; pthread_mutex_lock(&(cs->mutex)); cs->locked=1; cs->id=pthread_self(); } static void WINAPI expLeaveCriticalSection(CRITICAL_SECTION* c) { #ifdef CRITSECS_NEWTYPE struct CRITSECT* cs = critsecs_get_unix(c); #else struct CRITSECT* cs = (*(struct CRITSECT**)c); #endif // struct CRITSECT* cs=(struct CRITSECT*)c; dbgprintf("LeaveCriticalSection(0x%x)\n", c); if (!cs) { printf("Win32 Warning: Leaving uninitialized Critical Section %p!!\n", c); return; } #ifndef CRITSECS_NEWTYPE cs -= 1; #endif if (cs->locked) { cs->locked = 0; pthread_mutex_unlock(&(cs->mutex)); } } static void WINAPI expDeleteCriticalSection(CRITICAL_SECTION *c) { #ifdef CRITSECS_NEWTYPE struct CRITSECT* cs = critsecs_get_unix(c); #else struct CRITSECT* cs= (*(struct CRITSECT**)c) - 1; #endif // struct CRITSECT* cs=(struct CRITSECT*)c; dbgprintf("DeleteCriticalSection(0x%x)\n",c); #ifndef GARBAGE pthread_mutex_destroy(&(cs->mutex)); // released by GarbageCollector in my_relase otherwise #endif my_release(cs); #ifdef CRITSECS_NEWTYPE { int i = critsecs_get_pos(c); if (i < 0) { printf("DeleteCriticalSection(%p) error (critsec not found)\n", c); return; } critsecs_list[i].cs_win = NULL; expfree(critsecs_list[i].cs_unix); critsecs_list[i].cs_unix = NULL; dbgprintf("DeleteCriticalSection -> itemno=%d\n", i); } #endif } static int WINAPI expGetCurrentThreadId() { dbgprintf("GetCurrentThreadId() => %d\n", getpid()); return getpid(); } static int WINAPI expGetCurrentProcess() { dbgprintf("GetCurrentProcess() => %d\n", getpid()); return getpid(); } #if 0 extern void* fs_seg; // this version is required for Quicktime codecs (.qtx/.qts) to work. // (they assume some pointers at FS: segment) //static int tls_count; static int tls_use_map[64]; static int WINAPI expTlsAlloc() { int i; for(i=0; i<64; i++) if(tls_use_map[i]==0) { tls_use_map[i]=1; dbgprintf("TlsAlloc() => %d\n",i); return i; } dbgprintf("TlsAlloc() => -1 (ERROR)\n"); return -1; } static int WINAPI expTlsSetValue(DWORD index, void* value) { dbgprintf("TlsSetValue(%d,%p)\n",index,value); // if((index<0) || (index>64)) if((index>=64)) return 0; *(void**)((char*)fs_seg+0x88+4*index) = value; return 1; } static void* WINAPI expTlsGetValue(DWORD index) { dbgprintf("TlsGetValue(%d)\n",index); // if((index<0) || (index>64)) if((index>=64)) return NULL; return *(void**)((char*)fs_seg+0x88+4*index); } static int WINAPI expTlsFree(int idx) { int index = (int) idx; dbgprintf("TlsFree(%d)\n",index); if((index<0) || (index>64)) return 0; tls_use_map[index]=0; return 1; } #else struct tls_s { void* value; int used; struct tls_s* prev; struct tls_s* next; }; static void* WINAPI expTlsAlloc() { tls_t* t = my_mreq(sizeof(tls_t), 0); dbgprintf("TlsAlloc() => 0x%x\n", t); if (t) t->value = 0; /* XXX For Divx.dll */ return t; } static int WINAPI expTlsSetValue(void* idx, void* value) { tls_t* t = (tls_t*) idx; int result = 0; if (t) { t->value = value; result = 1; } dbgprintf("TlsSetValue(index 0x%x, value 0x%x) => %d \n", index, value, result ); return result; } static void* WINAPI expTlsGetValue(void* idx) { static int i = 0; tls_t* t = (tls_t*) idx; void* result = (t) ? t->value : 0; if (i > 156) trapbug(); dbgprintf("TlsGetValue(index 0x%x) => 0x%x %d\n", index, result, i++); return result; } static int WINAPI expTlsFree(void* idx) { tls_t* t = (tls_t*) idx; int result = 0; if (t) { my_release(t); result = 1; } dbgprintf("TlsFree(index 0x%x) => %d\n", index, result); return result; } #endif static void* WINAPI expLocalAlloc(int flags, int size) { void* z = my_mreq(size, (flags & GMEM_ZEROINIT)); if (z == 0) printf("LocalAlloc() failed\n"); dbgprintf("LocalAlloc(%d, flags 0x%x) => 0x%x\n", size, flags, z); return z; } static void* WINAPI expLocalReAlloc(int handle,int size, int flags) { void *newpointer; int oldsize; newpointer=NULL; if (flags & LMEM_MODIFY) { dbgprintf("LocalReAlloc MODIFY\n"); return (void *)handle; } oldsize = my_size((void *)handle); newpointer = my_realloc((void *)handle,size); dbgprintf("LocalReAlloc(%x %d(old %d), flags 0x%x) => 0x%x\n", handle,size,oldsize, flags,newpointer); return newpointer; } static void* WINAPI expLocalLock(void* z) { dbgprintf("LocalLock(0x%x) => 0x%x\n", z, z); return z; } static void* WINAPI expGlobalAlloc(int flags, int size) { void* z; dbgprintf("GlobalAlloc(%d, flags 0x%X)\n", size, flags); z=my_mreq(size, (flags & GMEM_ZEROINIT)); //z=calloc(size, 1); //z=malloc(size); if(z==0) printf("GlobalAlloc() failed\n"); dbgprintf("GlobalAlloc(%d, flags 0x%x) => 0x%x\n", size, flags, z); return z; } static void* WINAPI expGlobalLock(void* z) { dbgprintf("GlobalLock(0x%x) => 0x%x\n", z, z); return z; } // pvmjpg20 - but doesn't work anyway static int WINAPI expGlobalSize(void* amem) { int size = 100000; #ifdef GARBAGE alloc_header* header = last_alloc; alloc_header* mem = (alloc_header*) amem - 1; if (amem == 0) return 0; pthread_mutex_lock(&memmut); while (header) { if (header->deadbeef != 0xdeadbeef) { printf("FATAL found corrupted memory! %p 0x%lx (%d)\n", header, header->deadbeef, alccnt); break; } if (header == mem) { size = header->size; break; } header = header->prev; } pthread_mutex_unlock(&memmut); #endif dbgprintf("GlobalSize(0x%x)\n", amem); return size; } static int WINAPI expLoadStringA(long instance, long id, void* buf, long size) { int result=LoadStringA(instance, id, buf, size); // if(buf) dbgprintf("LoadStringA(instance 0x%x, id 0x%x, buffer 0x%x, size %d) => %d ( %s )\n", instance, id, buf, size, result, buf); // else // dbgprintf("LoadStringA(instance 0x%x, id 0x%x, buffer 0x%x, size %d) => %d\n", // instance, id, buf, size, result); return result; } static long WINAPI expMultiByteToWideChar(long v1, long v2, char* s1, long siz1, short* s2, int siz2) { #warning FIXME int i; int result; if(s2==0) result=1; else { if(siz1>siz2/2)siz1=siz2/2; for(i=1; i<=siz1; i++) { *s2=*s1; if(!*s1)break; s2++; s1++; } result=i; } if(s1) dbgprintf("MultiByteToWideChar(codepage %d, flags 0x%x, string 0x%x='%s'," "size %d, dest buffer 0x%x, dest size %d) => %d\n", v1, v2, s1, s1, siz1, s2, siz2, result); else dbgprintf("MultiByteToWideChar(codepage %d, flags 0x%x, string NULL," "size %d, dest buffer 0x%x, dest size %d) =>\n", v1, v2, siz1, s2, siz2, result); return result; } static void wch_print(const short* str) { dbgprintf(" src: "); while(*str)dbgprintf("%c", *str++); dbgprintf("\n"); } static long WINAPI expWideCharToMultiByte(long v1, long v2, short* s1, long siz1, char* s2, int siz2, char* c3, int* siz3) { int result; dbgprintf("WideCharToMultiByte(codepage %d, flags 0x%x, src 0x%x, src size %d, " "dest 0x%x, dest size %d, defch 0x%x, used_defch 0x%x)", v1, v2, s1, siz1, s2, siz2, c3, siz3); result=WideCharToMultiByte(v1, v2, s1, siz1, s2, siz2, c3, siz3); dbgprintf("=> %d\n", result); //if(s1)wch_print(s1); if(s2)dbgprintf(" dest: %s\n", s2); return result; } static long WINAPI expGetVersionExA(OSVERSIONINFOA* c) { dbgprintf("GetVersionExA(0x%x) => 1\n"); c->dwOSVersionInfoSize=sizeof(*c); c->dwMajorVersion=4; c->dwMinorVersion=0; c->dwBuildNumber=0x4000457; #if 1 // leave it here for testing win9x-only codecs c->dwPlatformId=VER_PLATFORM_WIN32_WINDOWS; strcpy(c->szCSDVersion, " B"); #else c->dwPlatformId=VER_PLATFORM_WIN32_NT; // let's not make DLL assume that it can read CR* registers strcpy(c->szCSDVersion, "Service Pack 3"); #endif dbgprintf(" Major version: 4\n Minor version: 0\n Build number: 0x4000457\n" " Platform Id: VER_PLATFORM_WIN32_NT\n Version string: 'Service Pack 3'\n"); return 1; } static HANDLE WINAPI expCreateSemaphoreA(char* v1, long init_count, long max_count, char* name) { pthread_mutex_t *pm; pthread_cond_t *pc; mutex_list* pp; /* printf("CreateSemaphoreA(%p = %s)\n", name, (name ? name : "")); pp=mlist; while(pp) { printf("%p => ", pp); pp=pp->prev; } printf("0\n"); */ if(mlist!=NULL) { mutex_list* pp=mlist; if(name!=NULL) do { if((strcmp(pp->name, name)==0) && (pp->type==1)) { dbgprintf("CreateSemaphoreA(0x%x, init_count %d, max_count %d, name 0x%x='%s') => 0x%x\n", v1, init_count, max_count, name, name, mlist); return (HANDLE)mlist; } }while((pp=pp->prev) != NULL); } pm=mreq_private(sizeof(pthread_mutex_t), 0, AREATYPE_MUTEX); pthread_mutex_init(pm, NULL); pc=mreq_private(sizeof(pthread_cond_t), 0, AREATYPE_COND); pthread_cond_init(pc, NULL); if(mlist==NULL) { mlist=mreq_private(sizeof(mutex_list), 00, AREATYPE_EVENT); mlist->next=mlist->prev=NULL; } else { mlist->next=mreq_private(sizeof(mutex_list), 00, AREATYPE_EVENT); mlist->next->prev=mlist; mlist->next->next=NULL; mlist=mlist->next; // printf("new semaphore %p\n", mlist); } mlist->type=1; /* Type Semaphore */ mlist->pm=pm; mlist->pc=pc; mlist->state=0; mlist->reset=0; mlist->semaphore=init_count; if(name!=NULL) strncpy(mlist->name, name, 64); else mlist->name[0]=0; if(pm==NULL) dbgprintf("ERROR::: CreateSemaphoreA failure\n"); if(name) dbgprintf("CreateSemaphoreA(0x%x, init_count %d, max_count %d, name 0x%x='%s') => 0x%x\n", v1, init_count, max_count, name, name, mlist); else dbgprintf("CreateSemaphoreA(0x%x, init_count %d, max_count %d, name 0) => 0x%x\n", v1, init_count, max_count, mlist); return (HANDLE)mlist; } static long WINAPI expReleaseSemaphore(long hsem, long increment, long* prev_count) { // The state of a semaphore object is signaled when its count // is greater than zero and nonsignaled when its count is equal to zero // Each time a waiting thread is released because of the semaphore's signaled // state, the count of the semaphore is decreased by one. mutex_list *ml = (mutex_list *)hsem; pthread_mutex_lock(ml->pm); if (prev_count != 0) *prev_count = ml->semaphore; if (ml->semaphore == 0) pthread_cond_signal(ml->pc); ml->semaphore += increment; pthread_mutex_unlock(ml->pm); dbgprintf("ReleaseSemaphore(semaphore 0x%x, increment %d, prev_count 0x%x) => 1\n", hsem, increment, prev_count); return 1; } static long WINAPI expRegOpenKeyExA(long key, const char* subkey, long reserved, long access, int* newkey) { long result=RegOpenKeyExA(key, subkey, reserved, access, newkey); dbgprintf("RegOpenKeyExA(key 0x%x, subkey %s, reserved %d, access 0x%x, pnewkey 0x%x) => %d\n", key, subkey, reserved, access, newkey, result); if(newkey)dbgprintf(" New key: 0x%x\n", *newkey); return result; } static long WINAPI expRegCloseKey(long key) { long result=RegCloseKey(key); dbgprintf("RegCloseKey(0x%x) => %d\n", key, result); return result; } static long WINAPI expRegQueryValueExA(long key, const char* value, int* reserved, int* type, int* data, int* count) { long result=RegQueryValueExA(key, value, reserved, type, data, count); dbgprintf("RegQueryValueExA(key 0x%x, value %s, reserved 0x%x, data 0x%x, count 0x%x)" " => 0x%x\n", key, value, reserved, data, count, result); if(data && count)dbgprintf(" read %d bytes: '%s'\n", *count, data); return result; } static long WINAPI expRegCreateKeyExA(long key, const char* name, long reserved, void* classs, long options, long security, void* sec_attr, int* newkey, int* status) { long result=RegCreateKeyExA(key, name, reserved, classs, options, security, sec_attr, newkey, status); dbgprintf("RegCreateKeyExA(key 0x%x, name 0x%x='%s', reserved=0x%x," " 0x%x, 0x%x, 0x%x, newkey=0x%x, status=0x%x) => %d\n", key, name, name, reserved, classs, options, security, sec_attr, newkey, status, result); if(!result && newkey) dbgprintf(" New key: 0x%x\n", *newkey); if(!result && status) dbgprintf(" New key status: 0x%x\n", *status); return result; } static long WINAPI expRegSetValueExA(long key, const char* name, long v1, long v2, void* data, long size) { long result=RegSetValueExA(key, name, v1, v2, data, size); dbgprintf("RegSetValueExA(key 0x%x, name '%s', 0x%x, 0x%x, data 0x%x -> 0x%x '%s', size=%d) => %d", key, name, v1, v2, data, *(int*)data, data, size, result); return result; } static long WINAPI expRegOpenKeyA (long hKey, LPCSTR lpSubKey, int* phkResult) { long result=RegOpenKeyExA(hKey, lpSubKey, 0, 0, phkResult); dbgprintf("RegOpenKeyExA(key 0x%x, subkey '%s', 0x%x) => %d\n", hKey, lpSubKey, phkResult, result); if(!result && phkResult) dbgprintf(" New key: 0x%x\n", *phkResult); return result; } static DWORD WINAPI expRegEnumValueA(HKEY hkey, DWORD index, LPSTR value, LPDWORD val_count, LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count) { return RegEnumValueA(hkey, index, value, val_count, reserved, type, data, count); } static DWORD WINAPI expRegEnumKeyExA(HKEY hKey, DWORD dwIndex, LPSTR lpName, LPDWORD lpcbName, LPDWORD lpReserved, LPSTR lpClass, LPDWORD lpcbClass, LPFILETIME lpftLastWriteTime) { return RegEnumKeyExA(hKey, dwIndex, lpName, lpcbName, lpReserved, lpClass, lpcbClass, lpftLastWriteTime); } static long WINAPI expQueryPerformanceCounter(long long* z) { longcount(z); dbgprintf("QueryPerformanceCounter(0x%x) => 1 ( %Ld )\n", z, *z); return 1; } /* * return CPU clock (in kHz), using linux's /proc filesystem (/proc/cpuinfo) */ static double linux_cpuinfo_freq() { double freq=-1; FILE *f; char line[200]; char *s,*value; f = fopen ("/proc/cpuinfo", "r"); if (f != NULL) { while (fgets(line,sizeof(line),f)!=NULL) { /* NOTE: the ':' is the only character we can rely on */ if (!(value = strchr(line,':'))) continue; /* terminate the valuename */ *value++ = '\0'; /* skip any leading spaces */ while (*value==' ') value++; if ((s=strchr(value,'\n'))) *s='\0'; if (!strncasecmp(line, "cpu MHz",strlen("cpu MHz")) && sscanf(value, "%lf", &freq) == 1) { freq*=1000; break; } } fclose(f); } return freq; } static double solaris_kstat_freq() { #if defined(HAVE_LIBKSTAT) && defined(KSTAT_DATA_INT32) /* * try to extract the CPU speed from the solaris kernel's kstat data */ kstat_ctl_t *kc; kstat_t *ksp; kstat_named_t *kdata; int mhz = 0; kc = kstat_open(); if (kc != NULL) { ksp = kstat_lookup(kc, "cpu_info", 0, "cpu_info0"); /* kstat found and name/value pairs? */ if (ksp != NULL && ksp->ks_type == KSTAT_TYPE_NAMED) { /* read the kstat data from the kernel */ if (kstat_read(kc, ksp, NULL) != -1) { /* * lookup desired "clock_MHz" entry, check the expected * data type */ kdata = (kstat_named_t *)kstat_data_lookup(ksp, "clock_MHz"); if (kdata != NULL && kdata->data_type == KSTAT_DATA_INT32) mhz = kdata->value.i32; } } kstat_close(kc); } if (mhz > 0) return mhz * 1000.; #endif /* HAVE_LIBKSTAT */ return -1; // kstat stuff is not available, CPU freq is unknown } /* * Measure CPU freq using the pentium's time stamp counter register (TSC) */ static double tsc_freq() { static double ofreq=0.0; int i; int x,y; i=time(NULL); if (ofreq != 0.0) return ofreq; while(i==time(NULL)); x=localcount(); i++; while(i==time(NULL)); y=localcount(); ofreq = (double)(y-x)/1000.; return ofreq; } static double CPU_Freq() { double freq; if ((freq = linux_cpuinfo_freq()) > 0) return freq; if ((freq = solaris_kstat_freq()) > 0) return freq; return tsc_freq(); } static long WINAPI expQueryPerformanceFrequency(long long* z) { *z=(long long)CPU_Freq(); dbgprintf("QueryPerformanceFrequency(0x%x) => 1 ( %Ld )\n", z, *z); return 1; } static long WINAPI exptimeGetTime() { struct timeval t; long result; gettimeofday(&t, 0); result=1000*t.tv_sec+t.tv_usec/1000; dbgprintf("timeGetTime() => %d\n", result); return result; } static void* WINAPI expLocalHandle(void* v) { dbgprintf("LocalHandle(0x%x) => 0x%x\n", v, v); return v; } static void* WINAPI expGlobalHandle(void* v) { dbgprintf("GlobalHandle(0x%x) => 0x%x\n", v, v); return v; } static int WINAPI expGlobalUnlock(void* v) { dbgprintf("GlobalUnlock(0x%x) => 1\n", v); return 1; } static void* WINAPI expGlobalFree(void* v) { dbgprintf("GlobalFree(0x%x) => 0\n", v); my_release(v); //free(v); return 0; } static void* WINAPI expGlobalReAlloc(void* v, int size, int flags) { void* result=my_realloc(v, size); //void* result=realloc(v, size); dbgprintf("GlobalReAlloc(0x%x, size %d, flags 0x%x) => 0x%x\n", v,size,flags,result); return result; } static int WINAPI expLocalUnlock(void* v) { dbgprintf("LocalUnlock(0x%x) => 1\n", v); return 1; } // static void* WINAPI expLocalFree(void* v) { dbgprintf("LocalFree(0x%x) => 0\n", v); my_release(v); return 0; } static HRSRC WINAPI expFindResourceA(HMODULE module, char* name, char* type) { HRSRC result; result=FindResourceA(module, name, type); dbgprintf("FindResourceA(module 0x%x, name 0x%x(%s), type 0x%x(%s)) => 0x%x\n", module, name, HIWORD(name) ? name : "UNICODE", type, HIWORD(type) ? type : "UNICODE", result); return result; } extern HRSRC WINAPI LoadResource(HMODULE, HRSRC); static HGLOBAL WINAPI expLoadResource(HMODULE module, HRSRC res) { HGLOBAL result=LoadResource(module, res); dbgprintf("LoadResource(module 0x%x, resource 0x%x) => 0x%x\n", module, res, result); return result; } static void* WINAPI expLockResource(long res) { void* result=LockResource(res); dbgprintf("LockResource(0x%x) => 0x%x\n", res, result); return result; } static int WINAPI expFreeResource(long res) { int result=FreeResource(res); dbgprintf("FreeResource(0x%x) => %d\n", res, result); return result; } //bool fun(HANDLE) //!0 on success static int WINAPI expCloseHandle(long v1) { dbgprintf("CloseHandle(0x%x) => 1\n", v1); /* do not close stdin,stdout and stderr */ if (v1 > 2) if (!close(v1)) return 0; return 1; } static const char* WINAPI expGetCommandLineA() { dbgprintf("GetCommandLineA() => \"c:\\aviplay.exe\"\n"); return "c:\\aviplay.exe"; } static short envs[]={'p', 'a', 't', 'h', ' ', 'c', ':', '\\', 0, 0}; static LPWSTR WINAPI expGetEnvironmentStringsW() { dbgprintf("GetEnvironmentStringsW() => 0\n", envs); return 0; } static void * WINAPI expRtlZeroMemory(void *p, size_t len) { void* result=memset(p,0,len); dbgprintf("RtlZeroMemory(0x%x, len %d) => 0x%x\n",p,len,result); return result; } static void * WINAPI expRtlMoveMemory(void *dst, void *src, size_t len) { void* result=memmove(dst,src,len); dbgprintf("RtlMoveMemory (dest 0x%x, src 0x%x, len %d) => 0x%x\n",dst,src,len,result); return result; } static void * WINAPI expRtlFillMemory(void *p, int ch, size_t len) { void* result=memset(p,ch,len); dbgprintf("RtlFillMemory(0x%x, char 0x%x, len %d) => 0x%x\n",p,ch,len,result); return result; } static int WINAPI expFreeEnvironmentStringsW(short* strings) { dbgprintf("FreeEnvironmentStringsW(0x%x) => 1\n", strings); return 1; } static int WINAPI expFreeEnvironmentStringsA(char* strings) { dbgprintf("FreeEnvironmentStringsA(0x%x) => 1\n", strings); return 1; } static const char ch_envs[]= "__MSVCRT_HEAP_SELECT=__GLOBAL_HEAP_SELECTED,1\r\n" "PATH=C:\\;C:\\windows\\;C:\\windows\\system\r\n"; static LPCSTR WINAPI expGetEnvironmentStrings() { dbgprintf("GetEnvironmentStrings() => 0x%x\n", ch_envs); return (LPCSTR)ch_envs; // dbgprintf("GetEnvironmentStrings() => 0\n"); // return 0; } static int WINAPI expGetStartupInfoA(STARTUPINFOA *s) { int i; dbgprintf("GetStartupInfoA(0x%x) => 1\n"); memset(s, 0, sizeof(*s)); s->cb=sizeof(*s); // s->lpReserved="Reserved"; // s->lpDesktop="Desktop"; // s->lpTitle="Title"; // s->dwX=s->dwY=0; // s->dwXSize=s->dwYSize=200; s->dwFlags=s->wShowWindow=1; // s->hStdInput=s->hStdOutput=s->hStdError=0x1234; dbgprintf(" cb=%d\n", s->cb); dbgprintf(" lpReserved='%s'\n", s->lpReserved); dbgprintf(" lpDesktop='%s'\n", s->lpDesktop); dbgprintf(" lpTitle='%s'\n", s->lpTitle); dbgprintf(" dwX=%d dwY=%d dwXSize=%d dwYSize=%d\n", s->dwX, s->dwY, s->dwXSize, s->dwYSize); dbgprintf(" dwXCountChars=%d dwYCountChars=%d dwFillAttribute=%d\n", s->dwXCountChars, s->dwYCountChars, s->dwFillAttribute); dbgprintf(" dwFlags=0x%x wShowWindow=0x%x cbReserved2=0x%x\n", s->dwFlags, s->wShowWindow, s->cbReserved2); dbgprintf(" lpReserved2=0x%x hStdInput=0x%x hStdOutput=0x%x hStdError=0x%x\n", s->lpReserved2, s->hStdInput, s->hStdOutput, s->hStdError); return 1; } static int WINAPI expGetStdHandle(int z) { dbgprintf("GetStdHandle(0x%x) => 0x%x\n", z+0x1234); return z+0x1234; } static int WINAPI expGetFileType(int handle) { dbgprintf("GetFileType(0x%x) => 0x3 = pipe\n", handle); return 0x3; } static int WINAPI expSetHandleCount(int count) { dbgprintf("SetHandleCount(0x%x) => 1\n", count); return 1; } static int WINAPI expGetACP() { dbgprintf("GetACP() => 0\n"); return 0; } extern WINE_MODREF *MODULE32_LookupHMODULE(HMODULE m); static int WINAPI expGetModuleFileNameA(int module, char* s, int len) { WINE_MODREF *mr; int result; // printf("File name of module %X requested\n", module); if(s==0) result=0; else if(len<35) result=0; else { result=1; strcpy(s, "c:\\windows\\system\\"); mr=MODULE32_LookupHMODULE(module); if(mr==0)//oops strcat(s, "aviplay.dll"); else if(strrchr(mr->filename, '/')==NULL) strcat(s, mr->filename); else strcat(s, strrchr(mr->filename, '/')+1); } if(!s) dbgprintf("GetModuleFileNameA(0x%x, 0x%x, %d) => %d\n", module, s, len, result); else dbgprintf("GetModuleFileNameA(0x%x, 0x%x, %d) => %d ( '%s' )\n", module, s, len, result, s); return result; } static int WINAPI expSetUnhandledExceptionFilter(void* filter) { dbgprintf("SetUnhandledExceptionFilter(0x%x) => 1\n", filter); return 1;//unsupported and probably won't ever be supported } static int WINAPI expLoadLibraryA(char* name) { int result = 0; char* lastbc; if (!name) return -1; // we skip to the last backslash // this is effectively eliminating weird characters in // the text output windows lastbc = strrchr(name, '\\'); if (lastbc) { int i; lastbc++; for (i = 0; 1 ;i++) { name[i] = *lastbc++; if (!name[i]) break; } } if(strncmp(name, "c:\\windows\\", 11)==0) name += 11; if(strncmp(name, ".\\", 2)==0) name += 2; dbgprintf("Entering LoadLibraryA(%s)\n", name); // PIMJ and VIVO audio are loading kernel32.dll if (strcasecmp(name, "kernel32.dll") == 0 || strcasecmp(name, "kernel32") == 0) return MODULE_HANDLE_kernel32; // return ERROR_SUCCESS; /* yeah, we have also the kernel32 calls */ /* exported -> do not return failed! */ if (strcasecmp(name, "user32.dll") == 0 || strcasecmp(name, "user32") == 0) // return MODULE_HANDLE_kernel32; return MODULE_HANDLE_user32; result=LoadLibraryA(name); dbgprintf("Returned LoadLibraryA(0x%x='%s'), def_path=%s => 0x%x\n", name, name, def_path, result); return result; } static int WINAPI expFreeLibrary(int module) { int result=FreeLibrary(module); dbgprintf("FreeLibrary(0x%x) => %d\n", module, result); return result; } static const void* WINAPI expGetProcAddress(HMODULE mod, char* name) { const void* result; switch(mod){ case MODULE_HANDLE_kernel32: result=LookupExternalByName("kernel32.dll", name); break; case MODULE_HANDLE_user32: result=LookupExternalByName("user32.dll", name); break; default: result=GetProcAddress(mod, name); } dbgprintf("GetProcAddress(0x%x, '%s') => 0x%x\n", mod, name, result); return result; } static long WINAPI expCreateFileMappingA(int hFile, void* lpAttr, long flProtect, long dwMaxHigh, long dwMaxLow, const char* name) { long result=CreateFileMappingA(hFile, lpAttr, flProtect, dwMaxHigh, dwMaxLow, name); if(!name) dbgprintf("CreateFileMappingA(file 0x%x, lpAttr 0x%x," "flProtect 0x%x, dwMaxHigh 0x%x, dwMaxLow 0x%x, name 0) => %d\n", hFile, lpAttr, flProtect, dwMaxHigh, dwMaxLow, result); else dbgprintf("CreateFileMappingA(file 0x%x, lpAttr 0x%x," "flProtect 0x%x, dwMaxHigh 0x%x, dwMaxLow 0x%x, name 0x%x='%s') => %d\n", hFile, lpAttr, flProtect, dwMaxHigh, dwMaxLow, name, name, result); return result; } static long WINAPI expOpenFileMappingA(long hFile, long hz, const char* name) { long result=OpenFileMappingA(hFile, hz, name); if(!name) dbgprintf("OpenFileMappingA(0x%x, 0x%x, 0) => %d\n", hFile, hz, result); else dbgprintf("OpenFileMappingA(0x%x, 0x%x, 0x%x='%s') => %d\n", hFile, hz, name, name, result); return result; } static void* WINAPI expMapViewOfFile(HANDLE file, DWORD mode, DWORD offHigh, DWORD offLow, DWORD size) { dbgprintf("MapViewOfFile(0x%x, 0x%x, 0x%x, 0x%x, size %d) => 0x%x\n", file,mode,offHigh,offLow,size,(char*)file+offLow); return (char*)file+offLow; } static void* WINAPI expUnmapViewOfFile(void* view) { dbgprintf("UnmapViewOfFile(0x%x) => 0\n", view); return 0; } static void* WINAPI expSleep(int time) { #if HAVE_NANOSLEEP /* solaris doesn't have thread safe usleep */ struct timespec tsp; tsp.tv_sec = time / 1000000; tsp.tv_nsec = (time % 1000000) * 1000; nanosleep(&tsp, NULL); #else usleep(time); #endif dbgprintf("Sleep(%d) => 0\n", time); return 0; } // why does IV32 codec want to call this? I don't know ... static int WINAPI expCreateCompatibleDC(int hdc) { int dc = 0;//0x81; //dbgprintf("CreateCompatibleDC(%d) => 0x81\n", hdc); dbgprintf("CreateCompatibleDC(%d) => %d\n", hdc, dc); return dc; } static int WINAPI expGetDeviceCaps(int hdc, int unk) { dbgprintf("GetDeviceCaps(0x%x, %d) => 0\n", hdc, unk); return 0; } static WIN_BOOL WINAPI expDeleteDC(int hdc) { dbgprintf("DeleteDC(0x%x) => 0\n", hdc); if (hdc == 0x81) return 1; return 0; } static WIN_BOOL WINAPI expDeleteObject(int hdc) { dbgprintf("DeleteObject(0x%x) => 1\n", hdc); /* FIXME - implement code here */ return 1; } /* btvvc32.drv wants this one */ static void* WINAPI expGetWindowDC(int hdc) { dbgprintf("GetWindowDC(%d) => 0x0\n", hdc); return 0; } /* * Returns the number of milliseconds, modulo 2^32, since the start * of the wineserver. */ static int WINAPI expGetTickCount(void) { static int tcstart = 0; struct timeval t; int tc; gettimeofday( &t, NULL ); tc = ((t.tv_sec * 1000) + (t.tv_usec / 1000)) - tcstart; if (tcstart == 0) { tcstart = 0; tc = 0; } dbgprintf("GetTickCount() => %d\n", tc); return tc; } static int WINAPI expCreateFontA(void) { dbgprintf("CreateFontA() => 0x0\n"); return 1; } /* tried to get pvmjpg work in a different way - no success */ static int WINAPI expDrawTextA(int hDC, char* lpString, int nCount, LPRECT lpRect, unsigned int uFormat) { dbgprintf("expDrawTextA(%p,...) => 8\n", hDC); return 8; } static int WINAPI expGetPrivateProfileIntA(const char* appname, const char* keyname, int default_value, const char* filename) { int size=255; char buffer[256]; char* fullname; int result; buffer[255]=0; if(!(appname && keyname && filename) ) { dbgprintf("GetPrivateProfileIntA('%s', '%s', %d, '%s') => %d\n", appname, keyname, default_value, filename, default_value ); return default_value; } fullname=(char*)malloc(50+strlen(appname)+strlen(keyname)+strlen(filename)); strcpy(fullname, "Software\\IniFileMapping\\"); strcat(fullname, appname); strcat(fullname, "\\"); strcat(fullname, keyname); strcat(fullname, "\\"); strcat(fullname, filename); result=RegQueryValueExA(HKEY_LOCAL_MACHINE, fullname, NULL, NULL, (int*)buffer, &size); if((size>=0)&&(size<256)) buffer[size]=0; // printf("GetPrivateProfileIntA(%s, %s, %s) -> %s\n", appname, keyname, filename, buffer); free(fullname); if(result) result=default_value; else result=atoi(buffer); dbgprintf("GetPrivateProfileIntA('%s', '%s', %d, '%s') => %d\n", appname, keyname, default_value, filename, result); return result; } static int WINAPI expGetProfileIntA(const char* appname, const char* keyname, int default_value) { dbgprintf("GetProfileIntA -> "); return expGetPrivateProfileIntA(appname, keyname, default_value, "default"); } static int WINAPI expGetPrivateProfileStringA(const char* appname, const char* keyname, const char* def_val, char* dest, unsigned int len, const char* filename) { int result; int size; char* fullname; dbgprintf("GetPrivateProfileStringA('%s', '%s', def_val '%s', 0x%x, 0x%x, '%s')", appname, keyname, def_val, dest, len, filename ); if(!(appname && keyname && filename) ) return 0; fullname=(char*)malloc(50+strlen(appname)+strlen(keyname)+strlen(filename)); strcpy(fullname, "Software\\IniFileMapping\\"); strcat(fullname, appname); strcat(fullname, "\\"); strcat(fullname, keyname); strcat(fullname, "\\"); strcat(fullname, filename); size=len; result=RegQueryValueExA(HKEY_LOCAL_MACHINE, fullname, NULL, NULL, (int*)dest, &size); free(fullname); if(result) { strncpy(dest, def_val, size); if (strlen(def_val)< size) size = strlen(def_val); } dbgprintf(" => %d ( '%s' )\n", size, dest); return size; } static int WINAPI expWritePrivateProfileStringA(const char* appname, const char* keyname, const char* string, const char* filename) { int size=256; char* fullname; dbgprintf("WritePrivateProfileStringA('%s', '%s', '%s', '%s')", appname, keyname, string, filename ); if(!(appname && keyname && filename) ) { dbgprintf(" => -1\n"); return -1; } fullname=(char*)malloc(50+strlen(appname)+strlen(keyname)+strlen(filename)); strcpy(fullname, "Software\\IniFileMapping\\"); strcat(fullname, appname); strcat(fullname, "\\"); strcat(fullname, keyname); strcat(fullname, "\\"); strcat(fullname, filename); RegSetValueExA(HKEY_LOCAL_MACHINE, fullname, 0, REG_SZ, (int*)string, strlen(string)); // printf("RegSetValueExA(%s,%d)\n", string, strlen(string)); // printf("WritePrivateProfileStringA(%s, %s, %s, %s)\n", appname, keyname, string, filename ); free(fullname); dbgprintf(" => 0\n"); return 0; } unsigned int _GetPrivateProfileIntA(const char* appname, const char* keyname, INT default_value, const char* filename) { return expGetPrivateProfileIntA(appname, keyname, default_value, filename); } int _GetPrivateProfileStringA(const char* appname, const char* keyname, const char* def_val, char* dest, unsigned int len, const char* filename) { return expGetPrivateProfileStringA(appname, keyname, def_val, dest, len, filename); } int _WritePrivateProfileStringA(const char* appname, const char* keyname, const char* string, const char* filename) { return expWritePrivateProfileStringA(appname, keyname, string, filename); } static int WINAPI expDefDriverProc(int _private, int id, int msg, int arg1, int arg2) { dbgprintf("DefDriverProc(0x%x, 0x%x, 0x%x, 0x%x, 0x%x) => 0\n", _private, id, msg, arg1, arg2); return 0; } static int WINAPI expSizeofResource(int v1, int v2) { int result=SizeofResource(v1, v2); dbgprintf("SizeofResource(0x%x, 0x%x) => %d\n", v1, v2, result); return result; } static int WINAPI expGetLastError() { int result=GetLastError(); dbgprintf("GetLastError() => 0x%x\n", result); return result; } static void WINAPI expSetLastError(int error) { dbgprintf("SetLastError(0x%x)\n", error); SetLastError(error); } static int WINAPI expStringFromGUID2(GUID* guid, char* str, int cbMax) { int result=snprintf(str, cbMax, "%.8x-%.4x-%.4x-%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x", guid->f1, guid->f2, guid->f3, (unsigned char)guid->f4[0], (unsigned char)guid->f4[1], (unsigned char)guid->f4[2], (unsigned char)guid->f4[3], (unsigned char)guid->f4[4], (unsigned char)guid->f4[5], (unsigned char)guid->f4[6], (unsigned char)guid->f4[7]); dbgprintf("StringFromGUID2(0x%x, 0x%x='%s', %d) => %d\n", guid, str, str, cbMax, result); return result; } static int WINAPI expGetFileVersionInfoSizeA(const char* name, int* lpHandle) { dbgprintf("GetFileVersionInfoSizeA(0x%x='%s', 0x%X) => 0\n", name, name, lpHandle); return 0; } static int WINAPI expIsBadStringPtrW(const short* string, int nchars) { int result; if(string==0)result=1; else result=0; dbgprintf("IsBadStringPtrW(0x%x, %d) => %d", string, nchars, result); if(string)wch_print(string); return result; } static int WINAPI expIsBadStringPtrA(const char* string, int nchars) { return expIsBadStringPtrW((const short*)string, nchars); } static long WINAPI expInterlockedExchangeAdd( long* dest, long incr ) { long ret; __asm__ __volatile__ ( "lock; xaddl %0,(%1)" : "=r" (ret) : "r" (dest), "0" (incr) : "memory" ); return ret; } static long WINAPI expInterlockedCompareExchange( unsigned long* dest, unsigned long exchange, unsigned long comperand) { unsigned long retval = *dest; if(*dest == comperand) *dest = exchange; return retval; } static long WINAPI expInterlockedIncrement( long* dest ) { long result=expInterlockedExchangeAdd( dest, 1 ) + 1; dbgprintf("InterlockedIncrement(0x%x => %d) => %d\n", dest, *dest, result); return result; } static long WINAPI expInterlockedDecrement( long* dest ) { long result=expInterlockedExchangeAdd( dest, -1 ) - 1; dbgprintf("InterlockedDecrement(0x%x => %d) => %d\n", dest, *dest, result); return result; } static void WINAPI expOutputDebugStringA( const char* string ) { dbgprintf("OutputDebugStringA(0x%x='%s')\n", string); fprintf(stderr, "DEBUG: %s\n", string); } static int WINAPI expGetDC(int hwnd) { dbgprintf("GetDC(0x%x) => 0\n", hwnd); return 0; } static int WINAPI expReleaseDC(int hwnd, int hdc) { dbgprintf("ReleaseDC(0x%x, 0x%x) => 0\n", hwnd, hdc); return 0; } static int WINAPI expGetDesktopWindow() { dbgprintf("GetDesktopWindow() => 0\n"); return 0; } static int cursor[100]; static int WINAPI expLoadCursorA(int handle,LPCSTR name) { dbgprintf("LoadCursorA(%d, 0x%x='%s') => 0x%x\n", handle, name, (int)&cursor[0]); return (int)&cursor[0]; } static int WINAPI expSetCursor(void *cursor) { dbgprintf("SetCursor(0x%x) => 0x%x\n", cursor, cursor); return (int)cursor; } static int WINAPI expGetCursorPos(void *cursor) { dbgprintf("GetCursorPos(0x%x) => 0x%x\n", cursor, cursor); return 1; } static int WINAPI expRegisterWindowMessageA(char *message) { dbgprintf("RegisterWindowMessageA(%s)\n", message); return 1; } static int WINAPI expGetProcessVersion(int pid) { dbgprintf("GetProcessVersion(%d)\n", pid); return 1; } static int WINAPI expGetCurrentThread(void) { #warning FIXME! dbgprintf("GetCurrentThread() => %x\n", 0xcfcf9898); return 0xcfcf9898; } static int WINAPI expGetOEMCP(void) { dbgprintf("GetOEMCP()\n"); return 1; } static int WINAPI expGetCPInfo(int cp,void *info) { dbgprintf("GetCPInfo()\n"); return 0; } static int WINAPI expGetSystemMetrics(int index) { dbgprintf("GetSystemMetrics(%d)\n", index); return 1; } static int WINAPI expGetSysColor(int index) { dbgprintf("GetSysColor(%d)\n", index); return 1; } static int WINAPI expGetSysColorBrush(int index) { dbgprintf("GetSysColorBrush(%d)\n", index); return 1; } static int WINAPI expGetSystemPaletteEntries(int hdc, int iStartIndex, int nEntries, void* lppe) { dbgprintf("GetSystemPaletteEntries(0x%x, 0x%x, 0x%x, 0x%x) => 0\n", hdc, iStartIndex, nEntries, lppe); return 0; } /* typedef struct _TIME_ZONE_INFORMATION { long Bias; char StandardName[32]; SYSTEMTIME StandardDate; long StandardBias; char DaylightName[32]; SYSTEMTIME DaylightDate; long DaylightBias; } TIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION; */ static int WINAPI expGetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation) { const short name[]={'C', 'e', 'n', 't', 'r', 'a', 'l', ' ', 'S', 't', 'a', 'n', 'd', 'a', 'r', 'd', ' ', 'T', 'i', 'm', 'e', 0}; const short pname[]={'C', 'e', 'n', 't', 'r', 'a', 'l', ' ', 'D', 'a', 'y', 'l', 'i', 'g', 'h', 't', ' ', 'T', 'i', 'm', 'e', 0}; dbgprintf("GetTimeZoneInformation(0x%x) => TIME_ZONE_ID_STANDARD\n"); memset(lpTimeZoneInformation, 0, sizeof(TIME_ZONE_INFORMATION)); lpTimeZoneInformation->Bias=360;//GMT-6 memcpy(lpTimeZoneInformation->StandardName, name, sizeof(name)); lpTimeZoneInformation->StandardDate.wMonth=10; lpTimeZoneInformation->StandardDate.wDay=5; lpTimeZoneInformation->StandardDate.wHour=2; lpTimeZoneInformation->StandardBias=0; memcpy(lpTimeZoneInformation->DaylightName, pname, sizeof(pname)); lpTimeZoneInformation->DaylightDate.wMonth=4; lpTimeZoneInformation->DaylightDate.wDay=1; lpTimeZoneInformation->DaylightDate.wHour=2; lpTimeZoneInformation->DaylightBias=-60; return TIME_ZONE_ID_STANDARD; } static void WINAPI expGetLocalTime(SYSTEMTIME* systime) { time_t local_time; struct tm *local_tm; struct timeval tv; dbgprintf("GetLocalTime(0x%x)\n"); gettimeofday(&tv, NULL); local_time=tv.tv_sec; local_tm=localtime(&local_time); systime->wYear = local_tm->tm_year + 1900; systime->wMonth = local_tm->tm_mon + 1; systime->wDayOfWeek = local_tm->tm_wday; systime->wDay = local_tm->tm_mday; systime->wHour = local_tm->tm_hour; systime->wMinute = local_tm->tm_min; systime->wSecond = local_tm->tm_sec; systime->wMilliseconds = (tv.tv_usec / 1000) % 1000; dbgprintf(" Year: %d\n Month: %d\n Day of week: %d\n" " Day: %d\n Hour: %d\n Minute: %d\n Second: %d\n" " Milliseconds: %d\n", systime->wYear, systime->wMonth, systime->wDayOfWeek, systime->wDay, systime->wHour, systime->wMinute, systime->wSecond, systime->wMilliseconds); } static int WINAPI expGetSystemTime(SYSTEMTIME* systime) { time_t local_time; struct tm *local_tm; struct timeval tv; dbgprintf("GetSystemTime(0x%x)\n", systime); gettimeofday(&tv, NULL); local_time=tv.tv_sec; local_tm=gmtime(&local_time); systime->wYear = local_tm->tm_year + 1900; systime->wMonth = local_tm->tm_mon + 1; systime->wDayOfWeek = local_tm->tm_wday; systime->wDay = local_tm->tm_mday; systime->wHour = local_tm->tm_hour; systime->wMinute = local_tm->tm_min; systime->wSecond = local_tm->tm_sec; systime->wMilliseconds = (tv.tv_usec / 1000) % 1000; dbgprintf(" Year: %d\n Month: %d\n Day of week: %d\n" " Day: %d\n Hour: %d\n Minute: %d\n Second: %d\n" " Milliseconds: %d\n", systime->wYear, systime->wMonth, systime->wDayOfWeek, systime->wDay, systime->wHour, systime->wMinute, systime->wSecond, systime->wMilliseconds); return 0; } #define SECS_1601_TO_1970 ((369 * 365 + 89) * 86400ULL) static void WINAPI expGetSystemTimeAsFileTime(FILETIME* systime) { struct tm *local_tm; struct timeval tv; unsigned long long secs; dbgprintf("GetSystemTime(0x%x)\n", systime); gettimeofday(&tv, NULL); secs = (tv.tv_sec + SECS_1601_TO_1970) * 10000000; secs += tv.tv_usec * 10; systime->dwLowDateTime = secs & 0xffffffff; systime->dwHighDateTime = (secs >> 32); } static int WINAPI expGetEnvironmentVariableA(const char* name, char* field, int size) { char *p; // printf("%s %x %x\n", name, field, size); if(field)field[0]=0; /* p = getenv(name); if (p) strncpy(field,p,size); */ if (strcmp(name,"__MSVCRT_HEAP_SELECT")==0) strcpy(field,"__GLOBAL_HEAP_SELECTED,1"); dbgprintf("GetEnvironmentVariableA(0x%x='%s', 0x%x, %d) => %d\n", name, name, field, size, strlen(field)); return strlen(field); } static int WINAPI expSetEnvironmentVariableA(const char *name, const char *value) { dbgprintf("SetEnvironmentVariableA(%s, %s)\n", name, value); return 0; } static void* WINAPI expCoTaskMemAlloc(ULONG cb) { return my_mreq(cb, 0); } static void WINAPI expCoTaskMemFree(void* cb) { my_release(cb); } void* CoTaskMemAlloc(unsigned long cb) { return expCoTaskMemAlloc(cb); } void CoTaskMemFree(void* cb) { expCoTaskMemFree(cb); } struct COM_OBJECT_INFO { GUID clsid; long (*GetClassObject) (GUID* clsid, const GUID* iid, void** ppv); }; static struct COM_OBJECT_INFO* com_object_table=0; static int com_object_size=0; int RegisterComClass(const GUID* clsid, GETCLASSOBJECT gcs) { if(!clsid || !gcs) return -1; com_object_table=realloc(com_object_table, sizeof(struct COM_OBJECT_INFO)*(++com_object_size)); com_object_table[com_object_size-1].clsid=*clsid; com_object_table[com_object_size-1].GetClassObject=gcs; return 0; } int UnregisterComClass(const GUID* clsid, GETCLASSOBJECT gcs) { int found = 0; int i = 0; if(!clsid || !gcs) return -1; if (com_object_table == 0) printf("Warning: UnregisterComClass() called without any registered class\n"); while (i < com_object_size) { if (found && i > 0) { memcpy(&com_object_table[i - 1].clsid, &com_object_table[i].clsid, sizeof(GUID)); com_object_table[i - 1].GetClassObject = com_object_table[i].GetClassObject; } else if (memcmp(&com_object_table[i].clsid, clsid, sizeof(GUID)) == 0 && com_object_table[i].GetClassObject == gcs) { found++; } i++; } if (found) { if (--com_object_size == 0) { free(com_object_table); com_object_table = 0; } } return 0; } const GUID IID_IUnknown = { 0x00000000, 0x0000, 0x0000, {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} }; const GUID IID_IClassFactory = { 0x00000001, 0x0000, 0x0000, {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} }; static long WINAPI expCoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter, long dwClsContext, const GUID* riid, void** ppv) { int i; for(i=0; iright - lprc->left; h = lprc->bottom - lprc->top; if (w <= 0 || h <= 0) r = 1; } else r = 1; dbgprintf("IsRectEmpty(%p) => %s\n", lprc, (r) ? "TRUE" : "FALSE"); //printf("Rect: left: %d, top: %d, right: %d, bottom: %d\n", lprc->left, lprc->top, lprc->right, lprc->bottom); return r; } static int _adjust_fdiv=0; //what's this? - used to adjust division static unsigned int WINAPI expGetTempPathA(unsigned int len, char* path) { dbgprintf("GetTempPathA(%d, 0x%x)", len, path); if(len<5) { dbgprintf(" => 0\n"); return 0; } strcpy(path, "/tmp"); dbgprintf(" => 5 ( '/tmp' )\n"); return 5; } /* FYI: typedef struct { DWORD dwFileAttributes; FILETIME ftCreationTime; FILETIME ftLastAccessTime; FILETIME ftLastWriteTime; DWORD nFileSizeHigh; DWORD nFileSizeLow; DWORD dwReserved0; DWORD dwReserved1; CHAR cFileName[260]; CHAR cAlternateFileName[14]; } WIN32_FIND_DATAA, *LPWIN32_FIND_DATAA; */ static HANDLE WINAPI expFindFirstFileA(LPCSTR s, LPWIN32_FIND_DATAA lpfd) { dbgprintf("FindFirstFileA(0x%x='%s', 0x%x) => 0\n", s, s, lpfd); strcpy(lpfd->cFileName, "msms001.vwp"); strcpy(lpfd->cAlternateFileName, "msms001.vwp"); return (HANDLE)0; } static WIN_BOOL WINAPI expFindNextFileA(HANDLE h,LPWIN32_FIND_DATAA p) { dbgprintf("FindNextFileA(0x%x, 0x%x) => 0\n", h, p); return 0; } static WIN_BOOL WINAPI expFindClose(HANDLE h) { dbgprintf("FindClose(0x%x) => 0\n", h); return 0; } static UINT WINAPI expSetErrorMode(UINT i) { dbgprintf("SetErrorMode(%d) => 0\n", i); return 0; } static UINT WINAPI expGetWindowsDirectoryA(LPSTR s,UINT c) { char windir[]="c:\\windows"; int result; strncpy(s, windir, c); result=1+((c %d\n", s, c, result); return result; } static WIN_BOOL WINAPI expDeleteFileA(LPCSTR s) { dbgprintf("DeleteFileA(0x%x='%s') => 0\n", s, s); return 0; } static WIN_BOOL WINAPI expFileTimeToLocalFileTime(const FILETIME* cpf, LPFILETIME pf) { dbgprintf("FileTimeToLocalFileTime(0x%x, 0x%x) => 0\n", cpf, pf); return 0; } static UINT WINAPI expGetTempFileNameA(LPCSTR cs1,LPCSTR cs2,UINT i,LPSTR ps) { char mask[16]="/tmp/AP_XXXXXX"; int result; dbgprintf("GetTempFileNameA(0x%x='%s', 0x%x='%s', %d, 0x%x)", cs1, cs1, cs2, cs2, i, ps); if(i && i<10) { dbgprintf(" => -1\n"); return -1; } result=mkstemp(mask); sprintf(ps, "AP%d", result); dbgprintf(" => %d\n", strlen(ps)); return strlen(ps); } // // This func might need proper implementation if we want AngelPotion codec. // They try to open APmpeg4v1.apl with it. // DLL will close opened file with CloseHandle(). // static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2, LPSECURITY_ATTRIBUTES p1, DWORD i3,DWORD i4,HANDLE i5) { dbgprintf("CreateFileA(0x%x='%s', %d, %d, 0x%x, %d, %d, 0x%x)\n", cs1, cs1, i1, i2, p1, i3, i4, i5); if((!cs1) || (strlen(cs1)<2))return -1; if(strncmp(cs1, "AP", 2) == 0) { int result; char* tmp=(char*)malloc(strlen(def_path)+50); strcpy(tmp, def_path); strcat(tmp, "/"); strcat(tmp, "APmpg4v1.apl"); result=open(tmp, O_RDONLY); free(tmp); return result; } if (strstr(cs1, "vp3")) { int r; int flg = 0; char* tmp=(char*)malloc(20 + strlen(cs1)); strcpy(tmp, "/tmp/"); strcat(tmp, cs1); r = 4; while (tmp[r]) { if (tmp[r] == ':' || tmp[r] == '\\') tmp[r] = '_'; r++; } if (GENERIC_READ & i1) flg |= O_RDONLY; else if (GENERIC_WRITE & i1) { flg |= O_WRONLY; printf("Warning: openning filename %s %d (flags; 0x%x) for write\n", tmp, r, flg); } r=open(tmp, flg); free(tmp); return r; } #if 0 /* we need this for some virtualdub filters */ { int r; int flg = 0; if (GENERIC_READ & i1) flg |= O_RDONLY; else if (GENERIC_WRITE & i1) { flg |= O_WRONLY; printf("Warning: openning filename %s %d (flags; 0x%x) for write\n", cs1, r, flg); } r=open(cs1, flg); return r; } #endif return atoi(cs1+2); } static UINT WINAPI expGetSystemDirectoryA( char* lpBuffer, // address of buffer for system directory UINT uSize // size of directory buffer ){ dbgprintf("GetSystemDirectoryA(%p,%d)\n", lpBuffer,uSize); if(!lpBuffer) strcpy(lpBuffer,"."); return 1; } /* static char sysdir[]="."; static LPCSTR WINAPI expGetSystemDirectoryA() { dbgprintf("GetSystemDirectoryA() => 0x%x='%s'\n", sysdir, sysdir); return sysdir; } */ static DWORD WINAPI expGetFullPathNameA ( LPCTSTR lpFileName, DWORD nBufferLength, LPTSTR lpBuffer, LPTSTR lpFilePart ){ if(!lpFileName) return 0; dbgprintf("GetFullPathNameA('%s',%d,%p,%p)\n",lpFileName,nBufferLength, lpBuffer, lpFilePart); strcpy(lpFilePart, lpFileName); strcpy(lpBuffer, lpFileName); // strncpy(lpBuffer, lpFileName, rindex(lpFileName, '\\')-lpFileName); return strlen(lpBuffer); } static DWORD WINAPI expGetShortPathNameA ( LPCSTR longpath, LPSTR shortpath, DWORD shortlen ){ if(!longpath) return 0; dbgprintf("GetShortPathNameA('%s',%p,%d)\n",longpath,shortpath,shortlen); strcpy(shortpath,longpath); return strlen(shortpath); } static WIN_BOOL WINAPI expReadFile(HANDLE h,LPVOID pv,DWORD size,LPDWORD rd,LPOVERLAPPED unused) { int result; dbgprintf("ReadFile(%d, 0x%x, %d -> 0x%x)\n", h, pv, size, rd); result=read(h, pv, size); if(rd)*rd=result; if(!result)return 0; return 1; } static WIN_BOOL WINAPI expWriteFile(HANDLE h,LPCVOID pv,DWORD size,LPDWORD wr,LPOVERLAPPED unused) { int result; dbgprintf("WriteFile(%d, 0x%x, %d -> 0x%x)\n", h, pv, size, wr); if(h==1234)h=1; result=write(h, pv, size); if(wr)*wr=result; if(!result)return 0; return 1; } static DWORD WINAPI expSetFilePointer(HANDLE h, LONG val, LPLONG ext, DWORD whence) { int wh; dbgprintf("SetFilePointer(%d, %d, 0x%x, %d)\n", h, val, ext, whence); //why would DLL want temporary file with >2Gb size? switch(whence) { case FILE_BEGIN: wh=SEEK_SET;break; case FILE_END: wh=SEEK_END;break; case FILE_CURRENT: wh=SEEK_CUR;break; default: return -1; } return lseek(h, val, wh); } static HDRVR WINAPI expOpenDriverA(LPCSTR szDriverName, LPCSTR szSectionName, LPARAM lParam2) { dbgprintf("OpenDriverA(0x%x='%s', 0x%x='%s', 0x%x) => -1\n", szDriverName, szDriverName, szSectionName, szSectionName, lParam2); return -1; } static HDRVR WINAPI expOpenDriver(LPCSTR szDriverName, LPCSTR szSectionName, LPARAM lParam2) { dbgprintf("OpenDriver(0x%x='%s', 0x%x='%s', 0x%x) => -1\n", szDriverName, szDriverName, szSectionName, szSectionName, lParam2); return -1; } static WIN_BOOL WINAPI expGetProcessAffinityMask(HANDLE hProcess, LPDWORD lpProcessAffinityMask, LPDWORD lpSystemAffinityMask) { dbgprintf("GetProcessAffinityMask(0x%x, 0x%x, 0x%x) => 1\n", hProcess, lpProcessAffinityMask, lpSystemAffinityMask); if(lpProcessAffinityMask)*lpProcessAffinityMask=1; if(lpSystemAffinityMask)*lpSystemAffinityMask=1; return 1; } static int WINAPI expMulDiv(int nNumber, int nNumerator, int nDenominator) { static const long long max_int=0x7FFFFFFFLL; static const long long min_int=-0x80000000LL; long long tmp=(long long)nNumber*(long long)nNumerator; dbgprintf("expMulDiv %d * %d / %d\n", nNumber, nNumerator, nDenominator); if(!nDenominator)return 1; tmp/=nDenominator; if(tmpmax_int) return 1; return (int)tmp; } static LONG WINAPI explstrcmpiA(const char* str1, const char* str2) { LONG result=strcasecmp(str1, str2); dbgprintf("strcmpi(0x%x='%s', 0x%x='%s') => %d\n", str1, str1, str2, str2, result); return result; } static LONG WINAPI explstrlenA(const char* str1) { LONG result=strlen(str1); dbgprintf("strlen(0x%x='%.50s') => %d\n", str1, str1, result); return result; } static LONG WINAPI explstrcpyA(char* str1, const char* str2) { int result= (int) strcpy(str1, str2); dbgprintf("strcpy(0x%.50x, 0x%.50x='%.50s') => %d\n", str1, str2, str2, result); return result; } static LONG WINAPI explstrcpynA(char* str1, const char* str2,int len) { int result; if (strlen(str2)>len) result = (int) strncpy(str1, str2,len); else result = (int) strcpy(str1,str2); dbgprintf("strncpy(0x%x, 0x%x='%s' len %d strlen %d) => %x\n", str1, str2, str2,len, strlen(str2),result); return result; } static LONG WINAPI explstrcatA(char* str1, const char* str2) { int result= (int) strcat(str1, str2); dbgprintf("strcat(0x%x, 0x%x='%s') => %d\n", str1, str2, str2, result); return result; } static LONG WINAPI expInterlockedExchange(long *dest, long l) { long retval = *dest; *dest = l; return retval; } static void WINAPI expInitCommonControls(void) { dbgprintf("InitCommonControls called!\n"); return; } /* alex: implement this call! needed for 3ivx */ static HRESULT WINAPI expCoCreateFreeThreadedMarshaler(void *pUnkOuter, void **ppUnkInner) { dbgprintf("CoCreateFreeThreadedMarshaler(%p, %p) called!\n", pUnkOuter, ppUnkInner); // return 0; return ERROR_CALL_NOT_IMPLEMENTED; } static int WINAPI expDuplicateHandle(HANDLE hSourceProcessHandle, // handle to source process HANDLE hSourceHandle, // handle to duplicate HANDLE hTargetProcessHandle, // handle to target process HANDLE* lpTargetHandle, // duplicate handle DWORD dwDesiredAccess, // requested access int bInheritHandle, // handle inheritance option DWORD dwOptions // optional actions ) { dbgprintf("DuplicateHandle(%p, %p, %p, %p, 0x%x, %d, %d) called\n", hSourceProcessHandle, hSourceHandle, hTargetProcessHandle, lpTargetHandle, dwDesiredAccess, bInheritHandle, dwOptions); *lpTargetHandle = hSourceHandle; return 1; } // required by PIM1 codec (used by win98 PCTV Studio capture sw) static HRESULT WINAPI expCoInitialize( LPVOID lpReserved /* [in] pointer to win32 malloc interface (obsolete, should be NULL) */ ) { /* * Just delegate to the newer method. */ return 0; //CoInitializeEx(lpReserved, COINIT_APARTMENTTHREADED); } static DWORD WINAPI expSetThreadAffinityMask ( HANDLE hThread, DWORD dwThreadAffinityMask ){ return 0; }; /* * no WINAPI functions - CDECL */ static void* expmalloc(int size) { //printf("malloc"); // return malloc(size); void* result=my_mreq(size,0); dbgprintf("malloc(0x%x) => 0x%x\n", size,result); if(result==0) printf("WARNING: malloc() failed\n"); return result; } static void expfree(void* mem) { // return free(mem); dbgprintf("free(%p)\n", mem); my_release(mem); } /* needed by atrac3.acm */ static void *expcalloc(int num, int size) { void* result=my_mreq(num*size,1); dbgprintf("calloc(%d,%d) => %p\n", num,size,result); if(result==0) printf("WARNING: calloc() failed\n"); return result; } static void* expnew(int size) { // printf("NEW:: Call from address %08x\n STACK DUMP:\n", *(-1+(int*)&size)); // printf("%08x %08x %08x %08x\n", // size, *(1+(int*)&size), // *(2+(int*)&size),*(3+(int*)&size)); void* result; assert(size >= 0); result=my_mreq(size,0); dbgprintf("new(%d) => %p\n", size, result); if (result==0) printf("WARNING: new() failed\n"); return result; } static int expdelete(void* memory) { dbgprintf("delete(%p)\n", memory); my_release(memory); return 0; } /* * local definition - we need only the last two members at this point * otherwice we would have to introduce here GUIDs and some more types.. */ typedef struct __attribute__((__packed__)) { char hay[0x40]; unsigned long cbFormat; //0x40 char* pbFormat; //0x44 } MY_MEDIA_TYPE; static HRESULT WINAPI expMoCopyMediaType(MY_MEDIA_TYPE* dest, const MY_MEDIA_TYPE* src) { if (!dest || !src) return E_POINTER; memcpy(dest, src, sizeof(MY_MEDIA_TYPE)); if (dest->cbFormat) { dest->pbFormat = (char*) my_mreq(dest->cbFormat, 0); if (!dest->pbFormat) return E_OUTOFMEMORY; memcpy(dest->pbFormat, src->pbFormat, dest->cbFormat); } return S_OK; } static HRESULT WINAPI expMoInitMediaType(MY_MEDIA_TYPE* dest, DWORD cbFormat) { if (!dest) return E_POINTER; memset(dest, 0, sizeof(MY_MEDIA_TYPE)); if (cbFormat) { dest->pbFormat = (char*) my_mreq(cbFormat, 0); if (!dest->pbFormat) return E_OUTOFMEMORY; } return S_OK; } static HRESULT WINAPI expMoCreateMediaType(MY_MEDIA_TYPE** dest, DWORD cbFormat) { if (!dest) return E_POINTER; *dest = my_mreq(sizeof(MY_MEDIA_TYPE), 0); return expMoInitMediaType(*dest, cbFormat); } static HRESULT WINAPI expMoDuplicateMediaType(MY_MEDIA_TYPE** dest, const void* src) { if (!dest) return E_POINTER; *dest = my_mreq(sizeof(MY_MEDIA_TYPE), 0); return expMoCopyMediaType(*dest, src); } static HRESULT WINAPI expMoFreeMediaType(MY_MEDIA_TYPE* dest) { if (!dest) return E_POINTER; if (dest->pbFormat) { my_release(dest->pbFormat); dest->pbFormat = 0; dest->cbFormat = 0; } return S_OK; } static HRESULT WINAPI expMoDeleteMediaType(MY_MEDIA_TYPE* dest) { if (!dest) return E_POINTER; expMoFreeMediaType(dest); my_release(dest); return S_OK; } #if 0 static int exp_initterm(int v1, int v2) { dbgprintf("_initterm(0x%x, 0x%x) => 0\n", v1, v2); return 0; } #else /* merged from wine - 2002.04.21 */ typedef void (*_INITTERMFUNC)(); static int exp_initterm(_INITTERMFUNC *start, _INITTERMFUNC *end) { dbgprintf("_initterm(0x%x, 0x%x) %p\n", start, end, *start); while (start < end) { if (*start) { //printf("call _initfunc: from: %p %d\n", *start); // ok this trick with push/pop is necessary as otherwice // edi/esi registers are being trashed void* p = *start; __asm__ __volatile__ ( "pushl %%ebx \n\t" "pushl %%ecx \n\t" "pushl %%edx \n\t" "pushl %%edi \n\t" "pushl %%esi \n\t" "call *%%eax \n\t" "popl %%esi \n\t" "popl %%edi \n\t" "popl %%edx \n\t" "popl %%ecx \n\t" "popl %%ebx \n\t" : : "a"(p) : "memory" ); //printf("done %p %d:%d\n", end); } start++; } return 0; } #endif static void* exp__dllonexit() { // FIXME extract from WINE return NULL; } static int expwsprintfA(char* string, char* format, ...) { va_list va; int result; va_start(va, format); result = vsprintf(string, format, va); dbgprintf("wsprintfA(0x%x, '%s', ...) => %d\n", string, format, result); va_end(va); return result; } static int expsprintf(char* str, const char* format, ...) { va_list args; int r; dbgprintf("sprintf(%s, %s)\n", str, format); va_start(args, format); r = vsprintf(str, format, args); va_end(args); return r; } static int expsscanf(const char* str, const char* format, ...) { va_list args; int r; dbgprintf("sscanf(%s, %s)\n", str, format); va_start(args, format); r = vsscanf(str, format, args); va_end(args); return r; } static void* expfopen(const char* path, const char* mode) { printf("fopen: \"%s\" mode:%s\n", path, mode); //return fopen(path, mode); return fdopen(0, mode); // everything on screen } static int expfprintf(void* stream, const char* format, ...) { va_list args; int r = 0; dbgprintf("fprintf(%p, %s, ...)\n", stream, format); #if 1 va_start(args, format); r = vfprintf((FILE*) stream, format, args); va_end(args); #endif return r; } static int expprintf(const char* format, ...) { va_list args; int r; dbgprintf("printf(%s, ...)\n", format); va_start(args, format); r = vprintf(format, args); va_end(args); return r; } static char* expgetenv(const char* varname) { char* v = getenv(varname); dbgprintf("getenv(%s) => %s\n", varname, v); return v; } static void* expwcscpy(WCHAR* dst, const WCHAR* src) { WCHAR* p = dst; while ((*p++ = *src++)) ; return dst; } static char* expstrrchr(char* string, int value) { char* result=strrchr(string, value); if(result) dbgprintf("strrchr(0x%x='%s', %d) => 0x%x='%s'", string, string, value, result, result); else dbgprintf("strrchr(0x%x='%s', %d) => 0", string, string, value); return result; } static char* expstrchr(char* string, int value) { char* result=strchr(string, value); if(result) dbgprintf("strchr(0x%x='%s', %d) => 0x%x='%s'", string, string, value, result, result); else dbgprintf("strchr(0x%x='%s', %d) => 0", string, string, value); return result; } static int expstrlen(char* str) { int result=strlen(str); dbgprintf("strlen(0x%x='%s') => %d\n", str, str, result); return result; } static char* expstrcpy(char* str1, const char* str2) { char* result= strcpy(str1, str2); dbgprintf("strcpy(0x%x, 0x%x='%s') => %p\n", str1, str2, str2, result); return result; } static int expstrcmp(const char* str1, const char* str2) { int result=strcmp(str1, str2); dbgprintf("strcmp(0x%x='%s', 0x%x='%s') => %d\n", str1, str1, str2, str2, result); return result; } static int expstrncmp(const char* str1, const char* str2,int x) { int result=strncmp(str1, str2,x); dbgprintf("strcmp(0x%x='%s', 0x%x='%s') => %d\n", str1, str1, str2, str2, result); return result; } static char* expstrcat(char* str1, const char* str2) { char* result = strcat(str1, str2); dbgprintf("strcat(0x%x='%s', 0x%x='%s') => %p\n", str1, str1, str2, str2, result); return result; } static char* exp_strdup(const char* str1) { int l = strlen(str1); char* result = (char*) my_mreq(l + 1,0); if (result) strcpy(result, str1); dbgprintf("_strdup(0x%x='%s') => %p\n", str1, str1, result); return result; } static int expisalnum(int c) { int result= (int) isalnum(c); dbgprintf("isalnum(0x%x='%c' => %d\n", c, c, result); return result; } static int expisspace(int c) { int result= (int) isspace(c); dbgprintf("isspace(0x%x='%c' => %d\n", c, c, result); return result; } static int expisalpha(int c) { int result= (int) isalpha(c); dbgprintf("isalpha(0x%x='%c' => %d\n", c, c, result); return result; } static int expisdigit(int c) { int result= (int) isdigit(c); dbgprintf("isdigit(0x%x='%c' => %d\n", c, c, result); return result; } static void* expmemmove(void* dest, void* src, int n) { void* result = memmove(dest, src, n); dbgprintf("memmove(0x%x, 0x%x, %d) => %p\n", dest, src, n, result); return result; } static int expmemcmp(void* dest, void* src, int n) { int result = memcmp(dest, src, n); dbgprintf("memcmp(0x%x, 0x%x, %d) => %d\n", dest, src, n, result); return result; } static void* expmemcpy(void* dest, void* src, int n) { void *result = memcpy(dest, src, n); dbgprintf("memcpy(0x%x, 0x%x, %d) => %p\n", dest, src, n, result); return result; } static void* expmemset(void* dest, int c, size_t n) { void *result = memset(dest, c, n); dbgprintf("memset(0x%x, %d, %d) => %p\n", dest, c, n, result); return result; } static time_t exptime(time_t* t) { time_t result = time(t); dbgprintf("time(0x%x) => %d\n", t, result); return result; } static int exprand(void) { return rand(); } static void expsrand(int seed) { srand(seed); } #if 1 // prefered compilation with -O2 -ffast-math ! static double explog10(double x) { /*printf("Log10 %f => %f 0x%Lx\n", x, log10(x), *((int64_t*)&x));*/ return log10(x); } static double expcos(double x) { /*printf("Cos %f => %f 0x%Lx\n", x, cos(x), *((int64_t*)&x));*/ return cos(x); } /* doens't work */ static long exp_ftol_wrong(double x) { return (long) x; } #else static void explog10(void) { __asm__ __volatile__ ( "fldl 8(%esp) \n\t" "fldln2 \n\t" "fxch %st(1) \n\t" "fyl2x \n\t" ); } static void expcos(void) { __asm__ __volatile__ ( "fldl 8(%esp) \n\t" "fcos \n\t" ); } #endif // this seem to be the only how to make this function working properly // ok - I've spent tremendous amount of time (many many many hours // of debuging fixing & testing - it's almost unimaginable - kabi // _ftol - operated on the float value which is already on the FPU stack static void exp_ftol(void) { __asm__ __volatile__ ( "sub $12, %esp \n\t" "fstcw -2(%ebp) \n\t" "wait \n\t" "movw -2(%ebp), %ax \n\t" "orb $0x0C, %ah \n\t" "movw %ax, -4(%ebp) \n\t" "fldcw -4(%ebp) \n\t" "fistpl -12(%ebp) \n\t" "fldcw -2(%ebp) \n\t" "movl -12(%ebp), %eax \n\t" //Note: gcc 3.03 does not do the following op if it // knows that ebp=esp "movl %ebp, %esp \n\t" ); } #warning check for _CIpow static double exp_CIpow(double x, double y) { /*printf("Pow %f %f 0x%Lx 0x%Lx => %f\n", x, y, *((int64_t*)&x), *((int64_t*)&y), pow(x, y));*/ return pow(x, y); } static double exppow(double x, double y) { /*printf("Pow %f %f 0x%Lx 0x%Lx => %f\n", x, y, *((int64_t*)&x), *((int64_t*)&y), pow(x, y));*/ return pow(x, y); } static double expldexp(double x, int expo) { /*printf("Cos %f => %f 0x%Lx\n", x, cos(x), *((int64_t*)&x));*/ return ldexp(x, expo); } static double expfrexp(double x, int* expo) { /*printf("Cos %f => %f 0x%Lx\n", x, cos(x), *((int64_t*)&x));*/ return frexp(x, expo); } static int exp_stricmp(const char* s1, const char* s2) { return strcasecmp(s1, s2); } /* from declaration taken from Wine sources - this fountion seems to be * undocumented in any M$ doc */ static int exp_setjmp3(void* jmpbuf, int x) { //dbgprintf("!!!!UNIMPLEMENTED: setjmp3(%p, %d) => 0\n", jmpbuf, x); //return 0; __asm__ __volatile__ ( //"mov 4(%%esp), %%edx \n\t" "mov (%%esp), %%eax \n\t" "mov %%eax, (%%edx) \n\t" // store ebp //"mov %%ebp, (%%edx) \n\t" "mov %%ebx, 4(%%edx) \n\t" "mov %%edi, 8(%%edx) \n\t" "mov %%esi, 12(%%edx) \n\t" "mov %%esp, 16(%%edx) \n\t" "mov 4(%%esp), %%eax \n\t" "mov %%eax, 20(%%edx) \n\t" "movl $0x56433230, 32(%%edx) \n\t" // VC20 ?? "movl $0, 36(%%edx) \n\t" : // output : "d"(jmpbuf) // input : "eax" ); #if 1 __asm__ __volatile__ ( "mov %%fs:0, %%eax \n\t" // unsure "mov %%eax, 24(%%edx) \n\t" "cmp $0xffffffff, %%eax \n\t" "jnz l1 \n\t" "mov %%eax, 28(%%edx) \n\t" "l1: \n\t" : : : "eax" ); #endif return 0; } static DWORD WINAPI expGetCurrentProcessId(void) { dbgprintf("GetCurrentProcessId() => %d\n", getpid()); return getpid(); //(DWORD)NtCurrentTeb()->pid; } static HANDLE WINAPI expCreateMutexA( SECURITY_ATTRIBUTES *sa, WIN_BOOL owner, LPCSTR name ){ static int x=0xcfcf9898; //++x; dbgprintf("CreateMutexA(%p,%d,'%s') => %d\n",sa,owner,name,x); return x; } typedef struct { UINT wPeriodMin; UINT wPeriodMax; } TIMECAPS, *LPTIMECAPS; static MMRESULT WINAPI exptimeGetDevCaps(LPTIMECAPS lpCaps, UINT wSize) { dbgprintf("timeGetDevCaps(%p, %u) !\n", lpCaps, wSize); lpCaps->wPeriodMin = 1; lpCaps->wPeriodMax = 65535; return 0; } static MMRESULT WINAPI exptimeBeginPeriod(UINT wPeriod) { dbgprintf("timeBeginPeriod(%u) !\n", wPeriod); if (wPeriod < 1 || wPeriod > 65535) return 96+1; //TIMERR_NOCANDO; return 0; } static void WINAPI expGlobalMemoryStatus( LPMEMORYSTATUS lpmem ) { static MEMORYSTATUS cached_memstatus; static int cache_lastchecked = 0; SYSTEM_INFO si; FILE *f; if (time(NULL)==cache_lastchecked) { memcpy(lpmem,&cached_memstatus,sizeof(MEMORYSTATUS)); return; } #if 1 f = fopen( "/proc/meminfo", "r" ); if (f) { char buffer[256]; int total, used, free, shared, buffers, cached; lpmem->dwLength = sizeof(MEMORYSTATUS); lpmem->dwTotalPhys = lpmem->dwAvailPhys = 0; lpmem->dwTotalPageFile = lpmem->dwAvailPageFile = 0; while (fgets( buffer, sizeof(buffer), f )) { /* old style /proc/meminfo ... */ if (sscanf( buffer, "Mem: %d %d %d %d %d %d", &total, &used, &free, &shared, &buffers, &cached )) { lpmem->dwTotalPhys += total; lpmem->dwAvailPhys += free + buffers + cached; } if (sscanf( buffer, "Swap: %d %d %d", &total, &used, &free )) { lpmem->dwTotalPageFile += total; lpmem->dwAvailPageFile += free; } /* new style /proc/meminfo ... */ if (sscanf(buffer, "MemTotal: %d", &total)) lpmem->dwTotalPhys = total*1024; if (sscanf(buffer, "MemFree: %d", &free)) lpmem->dwAvailPhys = free*1024; if (sscanf(buffer, "SwapTotal: %d", &total)) lpmem->dwTotalPageFile = total*1024; if (sscanf(buffer, "SwapFree: %d", &free)) lpmem->dwAvailPageFile = free*1024; if (sscanf(buffer, "Buffers: %d", &buffers)) lpmem->dwAvailPhys += buffers*1024; if (sscanf(buffer, "Cached: %d", &cached)) lpmem->dwAvailPhys += cached*1024; } fclose( f ); if (lpmem->dwTotalPhys) { DWORD TotalPhysical = lpmem->dwTotalPhys+lpmem->dwTotalPageFile; DWORD AvailPhysical = lpmem->dwAvailPhys+lpmem->dwAvailPageFile; lpmem->dwMemoryLoad = (TotalPhysical-AvailPhysical) / (TotalPhysical / 100); } } else #endif { /* FIXME: should do something for other systems */ lpmem->dwMemoryLoad = 0; lpmem->dwTotalPhys = 16*1024*1024; lpmem->dwAvailPhys = 16*1024*1024; lpmem->dwTotalPageFile = 16*1024*1024; lpmem->dwAvailPageFile = 16*1024*1024; } expGetSystemInfo(&si); lpmem->dwTotalVirtual = si.lpMaximumApplicationAddress-si.lpMinimumApplicationAddress; /* FIXME: we should track down all the already allocated VM pages and substract them, for now arbitrarily remove 64KB so that it matches NT */ lpmem->dwAvailVirtual = lpmem->dwTotalVirtual-64*1024; memcpy(&cached_memstatus,lpmem,sizeof(MEMORYSTATUS)); cache_lastchecked = time(NULL); /* it appears some memory display programs want to divide by these values */ if(lpmem->dwTotalPageFile==0) lpmem->dwTotalPageFile++; if(lpmem->dwAvailPageFile==0) lpmem->dwAvailPageFile++; } /********************************************************************** * SetThreadPriority [KERNEL32.@] Sets priority for thread. * * RETURNS * Success: TRUE * Failure: FALSE */ static WIN_BOOL WINAPI expSetThreadPriority( HANDLE hthread, /* [in] Handle to thread */ INT priority) /* [in] Thread priority level */ { dbgprintf("SetThreadPriority(%p,%d)\n",hthread,priority); return TRUE; } static void WINAPI expExitProcess( DWORD status ) { dbgprintf("ExitProcess - code %d\n",status); exit(status); } static INT WINAPI expMessageBoxA(HWND hWnd, LPCSTR text, LPCSTR title, UINT type){ dbgprintf("MessageBoxA '%s' '%s' (%d)\n",text,title,type); return 1; } /* these are needed for mss1 */ /* defined in stubs.s */ void exp_EH_prolog(void); #include static WINAPI inline unsigned long int exphtonl(unsigned long int hostlong) { // dbgprintf("htonl(%x) => %x\n", hostlong, htonl(hostlong)); return htonl(hostlong); } static WINAPI inline unsigned long int expntohl(unsigned long int netlong) { // dbgprintf("ntohl(%x) => %x\n", netlong, ntohl(netlong)); return ntohl(netlong); } static void WINAPI expVariantInit(void* p) { dbgprintf("InitCommonControls called!\n"); return; } static int expRegisterClassA(const void/*WNDCLASSA*/ *wc) { dbgprintf("RegisterClassA(%p) => random id\n", wc); return time(NULL); /* be precise ! */ } static int expUnregisterClassA(const char *className, HINSTANCE hInstance) { dbgprintf("UnregisterClassA(%s, %p) => 0\n", className, hInstance); return 0; } struct exports { const char* name; int id; const void* func; }; struct libs { const char* name; int length; const struct exports* exps; }; #define FF(X,Y) \ {#X, Y, (const void*)exp##X}, static const struct exports exp_kernel32[]= { FF(IsBadWritePtr, 357) FF(IsBadReadPtr, 354) FF(IsBadStringPtrW, -1) FF(IsBadStringPtrA, -1) FF(DisableThreadLibraryCalls, -1) FF(CreateThread, -1) FF(CreateEventA, -1) FF(SetEvent, -1) FF(ResetEvent, -1) FF(WaitForSingleObject, -1) FF(GetSystemInfo, -1) FF(GetVersion, 332) FF(HeapCreate, 461) FF(HeapAlloc, -1) FF(HeapDestroy, -1) FF(HeapFree, -1) FF(HeapSize, -1) FF(HeapReAlloc,-1) FF(GetProcessHeap, -1) FF(VirtualAlloc, -1) FF(VirtualFree, -1) FF(InitializeCriticalSection, -1) FF(EnterCriticalSection, -1) FF(LeaveCriticalSection, -1) FF(DeleteCriticalSection, -1) FF(TlsAlloc, -1) FF(TlsFree, -1) FF(TlsGetValue, -1) FF(TlsSetValue, -1) FF(GetCurrentThreadId, -1) FF(GetCurrentProcess, -1) FF(LocalAlloc, -1) FF(LocalReAlloc,-1) FF(LocalLock, -1) FF(GlobalAlloc, -1) FF(GlobalReAlloc, -1) FF(GlobalLock, -1) FF(GlobalSize, -1) FF(MultiByteToWideChar, 427) FF(WideCharToMultiByte, -1) FF(GetVersionExA, -1) FF(CreateSemaphoreA, -1) FF(QueryPerformanceCounter, -1) FF(QueryPerformanceFrequency, -1) FF(LocalHandle, -1) FF(LocalUnlock, -1) FF(LocalFree, -1) FF(GlobalHandle, -1) FF(GlobalUnlock, -1) FF(GlobalFree, -1) FF(LoadResource, -1) FF(ReleaseSemaphore, -1) FF(FindResourceA, -1) FF(LockResource, -1) FF(FreeResource, -1) FF(SizeofResource, -1) FF(CloseHandle, -1) FF(GetCommandLineA, -1) FF(GetEnvironmentStringsW, -1) FF(FreeEnvironmentStringsW, -1) FF(FreeEnvironmentStringsA, -1) FF(GetEnvironmentStrings, -1) FF(GetStartupInfoA, -1) FF(GetStdHandle, -1) FF(GetFileType, -1) FF(SetHandleCount, -1) FF(GetACP, -1) FF(GetModuleFileNameA, -1) FF(SetUnhandledExceptionFilter, -1) FF(LoadLibraryA, -1) FF(GetProcAddress, -1) FF(FreeLibrary, -1) FF(CreateFileMappingA, -1) FF(OpenFileMappingA, -1) FF(MapViewOfFile, -1) FF(UnmapViewOfFile, -1) FF(Sleep, -1) FF(GetModuleHandleA, -1) FF(GetProfileIntA, -1) FF(GetPrivateProfileIntA, -1) FF(GetPrivateProfileStringA, -1) FF(WritePrivateProfileStringA, -1) FF(GetLastError, -1) FF(SetLastError, -1) FF(InterlockedIncrement, -1) FF(InterlockedDecrement, -1) FF(GetTimeZoneInformation, -1) FF(OutputDebugStringA, -1) FF(GetLocalTime, -1) FF(GetSystemTime, -1) FF(GetSystemTimeAsFileTime, -1) FF(GetEnvironmentVariableA, -1) FF(SetEnvironmentVariableA, -1) FF(RtlZeroMemory,-1) FF(RtlMoveMemory,-1) FF(RtlFillMemory,-1) FF(GetTempPathA,-1) FF(FindFirstFileA,-1) FF(FindNextFileA,-1) FF(FindClose,-1) FF(FileTimeToLocalFileTime,-1) FF(DeleteFileA,-1) FF(ReadFile,-1) FF(WriteFile,-1) FF(SetFilePointer,-1) FF(GetTempFileNameA,-1) FF(CreateFileA,-1) FF(GetSystemDirectoryA,-1) FF(GetWindowsDirectoryA,-1) FF(GetShortPathNameA,-1) FF(GetFullPathNameA,-1) FF(SetErrorMode, -1) FF(IsProcessorFeaturePresent, -1) FF(GetProcessAffinityMask, -1) FF(InterlockedExchange, -1) FF(InterlockedCompareExchange, -1) FF(MulDiv, -1) FF(lstrcmpiA, -1) FF(lstrlenA, -1) FF(lstrcpyA, -1) FF(lstrcatA, -1) FF(lstrcpynA,-1) FF(GetProcessVersion,-1) FF(GetCurrentThread,-1) FF(GetOEMCP,-1) FF(GetCPInfo,-1) FF(DuplicateHandle,-1) FF(GetTickCount, -1) FF(SetThreadAffinityMask,-1) FF(GetCurrentProcessId,-1) FF(CreateMutexA,-1) FF(GlobalMemoryStatus,-1) FF(SetThreadPriority,-1) FF(ExitProcess,-1) {"LoadLibraryExA", -1, (void*)&LoadLibraryExA}, }; static const struct exports exp_msvcrt[]={ FF(malloc, -1) FF(_initterm, -1) FF(__dllonexit, -1) FF(free, -1) {"??3@YAXPAX@Z", -1, expdelete}, {"??2@YAPAXI@Z", -1, expnew}, {"_adjust_fdiv", -1, (void*)&_adjust_fdiv}, FF(strrchr, -1) FF(strchr, -1) FF(strlen, -1) FF(strcpy, -1) FF(wcscpy, -1) FF(strcmp, -1) FF(strncmp, -1) FF(strcat, -1) FF(_stricmp,-1) FF(_strdup,-1) FF(_setjmp3,-1) FF(isalnum, -1) FF(isspace, -1) FF(isalpha, -1) FF(isdigit, -1) FF(memmove, -1) FF(memcmp, -1) FF(memset, -1) FF(memcpy, -1) FF(time, -1) FF(rand, -1) FF(srand, -1) FF(log10, -1) FF(pow, -1) FF(cos, -1) FF(_ftol,-1) FF(_CIpow,-1) FF(ldexp,-1) FF(frexp,-1) FF(sprintf,-1) FF(sscanf,-1) FF(fopen,-1) FF(fprintf,-1) FF(printf,-1) FF(getenv,-1) #ifdef MPLAYER FF(_EH_prolog,-1) #endif FF(calloc,-1) {"ceil",-1,(void*)&ceil} }; static const struct exports exp_winmm[]={ FF(GetDriverModuleHandle, -1) FF(timeGetTime, -1) FF(DefDriverProc, -1) FF(OpenDriverA, -1) FF(OpenDriver, -1) FF(timeGetDevCaps, -1) FF(timeBeginPeriod, -1) }; static const struct exports exp_user32[]={ FF(LoadStringA, -1) FF(wsprintfA, -1) FF(GetDC, -1) FF(GetDesktopWindow, -1) FF(ReleaseDC, -1) FF(IsRectEmpty, -1) FF(LoadCursorA,-1) FF(SetCursor,-1) FF(GetCursorPos,-1) FF(GetCursorPos,-1) FF(RegisterWindowMessageA,-1) FF(GetSystemMetrics,-1) FF(GetSysColor,-1) FF(GetSysColorBrush,-1) FF(GetWindowDC, -1) FF(DrawTextA, -1) FF(MessageBoxA, -1) FF(RegisterClassA, -1) FF(UnregisterClassA, -1) }; static const struct exports exp_advapi32[]={ FF(RegCloseKey, -1) FF(RegCreateKeyExA, -1) FF(RegEnumKeyExA, -1) FF(RegEnumValueA, -1) FF(RegOpenKeyA, -1) FF(RegOpenKeyExA, -1) FF(RegQueryValueExA, -1) FF(RegSetValueExA, -1) }; static const struct exports exp_gdi32[]={ FF(CreateCompatibleDC, -1) FF(CreateFontA, -1) FF(DeleteDC, -1) FF(DeleteObject, -1) FF(GetDeviceCaps, -1) FF(GetSystemPaletteEntries, -1) }; static const struct exports exp_version[]={ FF(GetFileVersionInfoSizeA, -1) }; static const struct exports exp_ole32[]={ FF(CoCreateFreeThreadedMarshaler,-1) FF(CoCreateInstance, -1) FF(CoInitialize, -1) FF(CoTaskMemAlloc, -1) FF(CoTaskMemFree, -1) FF(StringFromGUID2, -1) }; // do we really need crtdll ??? // msvcrt is the correct place probably... static const struct exports exp_crtdll[]={ FF(memcpy, -1) FF(wcscpy, -1) }; static const struct exports exp_comctl32[]={ FF(StringFromGUID2, -1) FF(InitCommonControls, 17) }; static const struct exports exp_wsock32[]={ FF(htonl,8) FF(ntohl,14) }; static const struct exports exp_msdmo[]={ FF(memcpy, -1) // just test FF(MoCopyMediaType, -1) FF(MoCreateMediaType, -1) FF(MoDeleteMediaType, -1) FF(MoDuplicateMediaType, -1) FF(MoFreeMediaType, -1) FF(MoInitMediaType, -1) }; static const struct exports exp_oleaut32[]={ FF(VariantInit, 8) }; /* realplayer8: DLL Name: PNCRT.dll vma: Hint/Ord Member-Name 22ff4 615 free 2302e 250 _ftol 22fea 666 malloc 2303e 609 fprintf 2305e 167 _adjust_fdiv 23052 280 _initterm 22ffc 176 _beginthreadex 23036 284 _iob 2300e 85 __CxxFrameHandler 23022 411 _purecall */ #ifdef MPLAYER struct exports exp_pncrt[]={ FF(malloc, -1) // just test FF(free, -1) // just test FF(fprintf, -1) // just test {"_adjust_fdiv", -1, (void*)&_adjust_fdiv}, FF(_ftol,-1) FF(_initterm, -1) }; /* needed for Morgand MJPEG */ struct exports exp_msvfw32[]={ {"ICOpen", -1, (void *)&ICOpen}, {"ICClose", -1, (void *)&ICClose}, {"ICDecompress", -1, (void *)&ICDecompress}, {"ICSendMessage", -1, (void *)&ICSendMessage} }; #endif #define LL(X) \ {#X".dll", sizeof(exp_##X)/sizeof(struct exports), exp_##X}, static const struct libs libraries[]={ LL(kernel32) LL(msvcrt) LL(winmm) LL(user32) LL(advapi32) LL(gdi32) LL(version) LL(ole32) LL(oleaut32) LL(crtdll) LL(comctl32) LL(wsock32) LL(msdmo) #ifdef MPLAYER LL(msvfw32) LL(pncrt) #endif }; static void ext_stubs(void) { // expects: // ax position index // cx address of printf function #if 1 __asm__ __volatile__ ( "push %%edx \n\t" "movl $0xdeadbeef, %%eax \n\t" "movl $0xdeadbeef, %%edx \n\t" "shl $5, %%eax \n\t" // ax * 32 "addl $0xdeadbeef, %%eax \n\t" // overwrite export_names "pushl %%eax \n\t" "pushl $0xdeadbeef \n\t" // overwrite called_unk "call *%%edx \n\t" // printf (via dx) "addl $8, %%esp \n\t" "xorl %%eax, %%eax \n\t" "pop %%edx \n\t" : : : "eax" ); #else __asm__ __volatile__ ( "push %%edx \n\t" "movl $0, %%eax \n\t" "movl $0, %%edx \n\t" "shl $5, %%eax \n\t" // ax * 32 "addl %0, %%eax \n\t" "pushl %%eax \n\t" "pushl %1 \n\t" "call *%%edx \n\t" // printf (via dx) "addl $8, %%esp \n\t" "xorl %%eax, %%eax \n\t" "pop %%edx \n\t" ::"m"(*export_names), "m"(*called_unk) : "memory", "edx", "eax" ); #endif } //static void add_stub(int pos) extern int unk_exp1; static int pos=0; static char extcode[20000];// place for 200 unresolved exports static const char* called_unk = "Called unk_%s\n"; static void* add_stub(void) { // generated code in runtime! char* answ = (char*)extcode+pos*0x30; #if 0 memcpy(answ, &unk_exp1, 0x64); *(int*)(answ+9)=pos; *(int*)(answ+47)-=((int)answ-(int)&unk_exp1); #endif memcpy(answ, ext_stubs, 0x2f); // 0x2c is current size //answ[4] = 0xb8; // movl $0, eax (0xb8 0x00000000) *((int*) (answ + 5)) = pos; //answ[9] = 0xba; // movl $0, edx (0xba 0x00000000) *((long*) (answ + 10)) = (long)printf; //answ[17] = 0x05; // addl $0, eax (0x05 0x00000000) *((long*) (answ + 18)) = (long)export_names; //answ[23] = 0x68; // pushl $0 (0x68 0x00000000) *((long*) (answ + 24)) = (long)called_unk; pos++; return (void*)answ; } const void* LookupExternal(const char* library, int ordinal) { int i,j; if(library==0) { printf("ERROR: library=0\n"); return (void*)ext_unknown; } // printf("%x %x\n", &unk_exp1, &unk_exp2); printf("External func %s:%d\n", library, ordinal); for(i=0; i150)return 0; sprintf(export_names[pos], "%s:%d", library, ordinal); return add_stub(); } const void* LookupExternalByName(const char* library, const char* name) { char* answ; int i,j; // return (void*)ext_unknown; if(library==0) { printf("ERROR: library=0\n"); return (void*)ext_unknown; } if(name==0) { printf("ERROR: name=0\n"); return (void*)ext_unknown; } //printf("External func %s:%s\n", library, name); for(i=0; i150)return 0;// to many symbols strcpy(export_names[pos], name); return add_stub(); } void my_garbagecollection(void) { #ifdef GARBAGE int unfree = 0, unfreecnt = 0; int max_fatal = 8; free_registry(); while (last_alloc) { alloc_header* mem = last_alloc + 1; unfree += my_size(mem); unfreecnt++; if (my_release(mem) != 0) // avoid endless loop when memory is trashed if (--max_fatal < 0) break; } printf("Total Unfree %d bytes cnt %d [%p,%d]\n",unfree, unfreecnt, last_alloc, alccnt); #endif list = NULL; } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/win32.h0000644000175000017500000000153410472612056021442 0ustar yavoryavor#ifndef loader_win32_h #define loader_win32_h #include #include #include #include #ifdef AVIFILE #ifdef __GNUC__ #include "avm_output.h" #ifndef __cplusplus #ifdef __GNUC__ #define printf(args...) avm_printf("Win32 plugin", ## args) #else // not GNU C #define printf(...) avm_printf("Win32 plugin", __VA_ARGS__) #endif #endif #endif #endif extern void my_garbagecollection(void); typedef struct { UINT uDriverSignature; HINSTANCE hDriverModule; DRIVERPROC DriverProc; DWORD dwDriverID; } DRVR; typedef DRVR *PDRVR; typedef DRVR *NPDRVR; typedef DRVR *LPDRVR; typedef struct tls_s tls_t; extern const void* LookupExternal(const char* library, int ordinal); extern const void* LookupExternalByName(const char* library, const char* name); #endif avifile-0.7.48~20090503.ds/plugins/libwin32/loader/wineacm.h0000644000175000017500000000356007362507312022126 0ustar yavoryavor#ifndef WINEACM_H #define WINEACM_H /* -*- tab-width: 8; c-basic-offset: 4 -*- */ /*********************************************************************** * Wine specific - Win32 */ #include "wine/msacmdrv.h" #ifdef __cplusplus extern "C" { #endif /* defined(__cplusplus) */ typedef struct _WINE_ACMDRIVERID *PWINE_ACMDRIVERID; typedef struct _WINE_ACMDRIVER *PWINE_ACMDRIVER; typedef struct _WINE_ACMOBJ { PWINE_ACMDRIVERID pACMDriverID; } WINE_ACMOBJ, *PWINE_ACMOBJ; typedef struct _WINE_ACMDRIVER { WINE_ACMOBJ obj; HDRVR hDrvr; DRIVERPROC pfnDriverProc; PWINE_ACMDRIVER pNextACMDriver; int iUsage; } WINE_ACMDRIVER; typedef struct _WINE_ACMSTREAM { WINE_ACMOBJ obj; PWINE_ACMDRIVER pDrv; ACMDRVSTREAMINSTANCE drvInst; HACMDRIVER hAcmDriver; } WINE_ACMSTREAM, *PWINE_ACMSTREAM; typedef struct _WINE_ACMDRIVERID { LPSTR pszFileName; WORD wFormatTag; HINSTANCE hInstModule; /* NULL if global */ DWORD dwProcessID; /* ID of process which installed a local driver */ WIN_BOOL bEnabled; PWINE_ACMDRIVER pACMDriverList; PWINE_ACMDRIVERID pNextACMDriverID; PWINE_ACMDRIVERID pPrevACMDriverID; } WINE_ACMDRIVERID; /* From internal.c */ extern HANDLE MSACM_hHeap; extern PWINE_ACMDRIVERID MSACM_pFirstACMDriverID; extern PWINE_ACMDRIVERID MSACM_pLastACMDriverID; PWINE_ACMDRIVERID MSACM_RegisterDriver(const char* pszFileName, WORD wFormatTag, HINSTANCE hinstModule); PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p); void MSACM_UnregisterAllDrivers(void); PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID); PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver); PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj); #ifdef __cplusplus } /* extern "C" */ #endif /* defined(__cplusplus) */ #endif /* WINEACM_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dshow/0000755000175000017500000000000011267646347021465 5ustar yavoryavoravifile-0.7.48~20090503.ds/plugins/libwin32/loader/dshow/DS_Filter.c0000644000175000017500000001444110041227612023423 0ustar yavoryavor#include "DS_Filter.h" #include "driver.h" #include "com.h" #include #include #include #include "win32.h" // printf macro typedef long STDCALL (*GETCLASS) (const GUID*, const GUID*, void**); //void trapbug(); static void DS_Filter_Start(DS_Filter* This) { HRESULT hr; if (This->m_pAll) return; //Debug printf("DS_Filter_Start(%p)\n", This); hr = This->m_pFilter->vt->Run(This->m_pFilter, (REFERENCE_TIME)0); if (hr != 0) { Debug printf("WARNING: m_Filter->Run() failed, error code %x\n", (int)hr); } hr = This->m_pImp->vt->GetAllocator(This->m_pImp, &This->m_pAll); if (hr || !This->m_pAll) { Debug printf("WARNING: error getting IMemAllocator interface %x\n", (int)hr); This->m_pImp->vt->Release((IUnknown*)This->m_pImp); return; } This->m_pImp->vt->NotifyAllocator(This->m_pImp, This->m_pAll, 0); } static void DS_Filter_Stop(DS_Filter* This) { if (This->m_pAll) { //Debug printf("DS_Filter_Stop(%p)\n", This); This->m_pFilter->vt->Stop(This->m_pFilter); // causes weird crash ??? FIXME This->m_pAll->vt->Release((IUnknown*)This->m_pAll); This->m_pAll = 0; } } void DS_Filter_Destroy(DS_Filter* This) { This->Stop(This); if (This->m_pOurInput) This->m_pOurInput->vt->Release((IUnknown*)This->m_pOurInput); if (This->m_pInputPin) This->m_pInputPin->vt->Disconnect(This->m_pInputPin); if (This->m_pOutputPin) This->m_pOutputPin->vt->Disconnect(This->m_pOutputPin); if (This->m_pFilter) This->m_pFilter->vt->Release((IUnknown*)This->m_pFilter); if (This->m_pOutputPin) This->m_pOutputPin->vt->Release((IUnknown*)This->m_pOutputPin); if (This->m_pInputPin) This->m_pInputPin->vt->Release((IUnknown*)This->m_pInputPin); if (This->m_pImp) This->m_pImp->vt->Release((IUnknown*)This->m_pImp); if (This->m_pOurOutput) This->m_pOurOutput->vt->Release((IUnknown*)This->m_pOurOutput); if (This->m_pParentFilter) This->m_pParentFilter->vt->Release((IUnknown*)This->m_pParentFilter); if (This->m_pSrcFilter) This->m_pSrcFilter->vt->Release((IUnknown*)This->m_pSrcFilter); // FIXME - we are still leaving few things allocated! if (This->m_iHandle) FreeLibrary((unsigned)This->m_iHandle); free(This); CodecRelease(); } DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id, AM_MEDIA_TYPE* in_fmt, AM_MEDIA_TYPE* out_fmt) { HRESULT result = 0; char eb[250]; const char* em = NULL; DS_Filter* This = (DS_Filter*) malloc(sizeof(DS_Filter)); if (!This) return NULL; CodecAlloc(); This->m_pFilter = NULL; This->m_pInputPin = NULL; This->m_pOutputPin = NULL; This->m_pSrcFilter = NULL; This->m_pParentFilter = NULL; This->m_pOurInput = NULL; This->m_pOurOutput = NULL; This->m_pAll = NULL; This->m_pImp = NULL; This->Start = DS_Filter_Start; This->Stop = DS_Filter_Stop; do { GETCLASS func; struct IClassFactory* factory = NULL; struct IUnknown* object = NULL; IEnumPins* enum_pins = 0; IPin* array[256]; ULONG fetched; unsigned int i; This->m_iHandle = LoadLibraryA(dllname); if (!This->m_iHandle) { em = "could not open DirectShow DLL"; break; } func = (GETCLASS)GetProcAddress((unsigned)This->m_iHandle, "DllGetClassObject"); if (!func) { em = "illegal or corrupt DirectShow DLL"; break; } result = func(id, &IID_IClassFactory, (void**)&factory); if (result || !factory) { em = "no such class object"; break; } result = factory->vt->CreateInstance(factory, 0, &IID_IUnknown, (void**)&object); factory->vt->Release((IUnknown*)factory); if (result || !object) { em = "class factory failure"; break; } result = object->vt->QueryInterface(object, &IID_IBaseFilter, (void**)&This->m_pFilter); object->vt->Release((IUnknown*)object); if (result || !This->m_pFilter) { em = "object does not provide IBaseFilter interface"; break; } // enumerate pins result = This->m_pFilter->vt->EnumPins(This->m_pFilter, &enum_pins); if (result || !enum_pins) { em = "could not enumerate pins"; break; } enum_pins->vt->Reset(enum_pins); result = enum_pins->vt->Next(enum_pins, (ULONG)256, (IPin**)array, &fetched); Debug printf("Pins enumeration returned %ld pins, error is %x\n", fetched, (int)result); for (i = 0; i < fetched; i++) { int direction = -1; array[i]->vt->QueryDirection(array[i], (PIN_DIRECTION*)&direction); if (!This->m_pInputPin && direction == 0) { This->m_pInputPin = array[i]; This->m_pInputPin->vt->AddRef((IUnknown*)This->m_pInputPin); } if (!This->m_pOutputPin && direction == 1) { This->m_pOutputPin = array[i]; This->m_pOutputPin->vt->AddRef((IUnknown*)This->m_pOutputPin); } array[i]->vt->Release((IUnknown*)(array[i])); } if (!This->m_pInputPin) { em = "could not find input pin"; break; } if (!This->m_pOutputPin) { em = "could not find output pin"; break; } result = This->m_pInputPin->vt->QueryInterface((IUnknown*)This->m_pInputPin, &IID_IMemInputPin, (void**)&This->m_pImp); if (result) { em = "could not get IMemInputPin interface"; break; } This->m_pOurType = in_fmt; This->m_pDestType = out_fmt; result = This->m_pInputPin->vt->QueryAccept(This->m_pInputPin, This->m_pOurType); if (result) { em = "source format is not accepted"; break; } This->m_pParentFilter = CBaseFilter2Create(); This->m_pSrcFilter = CBaseFilterCreate(This->m_pOurType, This->m_pParentFilter); This->m_pOurInput = This->m_pSrcFilter->GetPin(This->m_pSrcFilter); This->m_pOurInput->vt->AddRef((IUnknown*)This->m_pOurInput); result = This->m_pInputPin->vt->ReceiveConnection(This->m_pInputPin, This->m_pOurInput, This->m_pOurType); if (result) { em = "could not connect to input pin"; break; } This->m_pOurOutput = COutputPinCreate(This->m_pDestType); result = This->m_pOutputPin->vt->ReceiveConnection(This->m_pOutputPin, (IPin*) This->m_pOurOutput, This->m_pDestType); if (result) em = "could not connect to output pin"; } while(0); if (em) { DS_Filter_Destroy(This); printf("Warning: DS_Filter() %s. (DLL=%.200s, r=0x%x)\n", em, dllname, result); This = 0; } return This; } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dshow/DS_Filter.h0000644000175000017500000000157707474366576023473 0ustar yavoryavor#ifndef DS_FILTER_H #define DS_FILTER_H #include "inputpin.h" #include "outputpin.h" #if defined(__cplusplus) extern "C" { #endif /** User will allocate and fill format structures, call Create(), and then set up m_pAll. **/ typedef struct _DS_Filter DS_Filter; struct _DS_Filter { int m_iHandle; IBaseFilter* m_pFilter; IPin* m_pInputPin; IPin* m_pOutputPin; CBaseFilter* m_pSrcFilter; CBaseFilter2* m_pParentFilter; IPin* m_pOurInput; COutputPin* m_pOurOutput; AM_MEDIA_TYPE *m_pOurType, *m_pDestType; IMemAllocator* m_pAll; IMemInputPin* m_pImp; void ( *Start )(DS_Filter*); void ( *Stop )(DS_Filter*); }; DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id, AM_MEDIA_TYPE* in_fmt, AM_MEDIA_TYPE* out_fmt); void DS_Filter_Destroy(DS_Filter* This); #if defined(__cplusplus) } #endif #endif /* DS_FILTER_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dshow/Makefile.am0000644000175000017500000000063310041227612023476 0ustar yavoryavorif AMM_USE_WIN32 noinst_LTLIBRARIES = libdshow.la endif noinst_HEADERS = \ allocator.h \ cmediasample.h \ DS_Filter.h \ guids.h \ inputpin.h \ interfaces.h \ iunk.h \ outputpin.h libdshow_la_SOURCES = \ allocator.c \ cmediasample.c \ DS_Filter.c \ guids.c \ inputpin.c \ outputpin.c AM_CPPFLAGS = $(LTNOPIC) -DAVIFILE -I$(srcdir)/.. CFLAGS = $(WIN32_CFLAGS) MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dshow/allocator.c0000644000175000017500000002117007651166772023613 0ustar yavoryavor#include "allocator.h" #include "com.h" #include "wine/winerror.h" #include #include static int AllocatorKeeper = 0; struct _avm_list_t { struct _avm_list_t* next; struct _avm_list_t* prev; void* member; }; static inline int avm_list_size(avm_list_t* head) { avm_list_t* it = head; int i = 0; if (it) { for (;;) { i++; it = it->next; if (it == head) break; } } return i; } static inline int avm_list_print(avm_list_t* head) { avm_list_t* it = head; int i = 0; printf("Head: %p\n", head); if (it) { for (;;) { i++; printf("%d: member: %p next: %p prev: %p\n", i, it->member, it->next, it->prev); it = it->next; if (it == head) break; } } return i; } static inline avm_list_t* avm_list_add_head(avm_list_t* head, void* member) { avm_list_t* n = (avm_list_t*) malloc(sizeof(avm_list_t)); n->member = member; if (!head) { head = n; head->prev = head; } n->prev = head->prev; head->prev = n; n->next = head; return n; } static inline avm_list_t* avm_list_add_tail(avm_list_t* head, void* member) { avm_list_t* n = avm_list_add_head(head, member); return (!head) ? n : head; } static inline avm_list_t* avm_list_del_head(avm_list_t* head) { avm_list_t* n = 0; if (head) { if (head->next != head) { n = head->next; head->prev->next = head->next; head->next->prev = head->prev; } free(head); } return n; } static inline avm_list_t* avm_list_find(avm_list_t* head, void* member) { avm_list_t* it = head; if (it) { for (;;) { if (it->member == member) return it; it = it->next; if (it == head) break; } } return NULL; } static long MemAllocator_CreateAllocator(GUID* clsid, const GUID* iid, void** ppv) { IMemAllocator* p; int result; if (!ppv) return -1; *ppv = 0; if (memcmp(clsid, &CLSID_MemoryAllocator, sizeof(GUID))) return -1; p = (IMemAllocator*) MemAllocatorCreate(); result = p->vt->QueryInterface((IUnknown*)p, iid, ppv); p->vt->Release((IUnknown*)p); return result; } static HRESULT STDCALL MemAllocator_SetProperties(IMemAllocator * This, /* [in] */ ALLOCATOR_PROPERTIES *pRequest, /* [out] */ ALLOCATOR_PROPERTIES *pActual) { MemAllocator* me = (MemAllocator*)This; Debug printf("MemAllocator_SetProperties(%p) called\n", This); if (!pRequest || !pActual) return E_INVALIDARG; if (pRequest->cBuffers<=0 || pRequest->cbBuffer<=0) return E_FAIL; if (me->used_list != 0 || me->free_list != 0) return E_FAIL; *pActual = *pRequest; //if (pActual->cbBuffer == 2) // pActual->cbBuffer = 576; me->props = *pActual; return 0; } static HRESULT STDCALL MemAllocator_GetProperties(IMemAllocator * This, /* [out] */ ALLOCATOR_PROPERTIES *pProps) { Debug printf("MemAllocator_GetProperties(%p) called\n", This); if (!pProps) return E_INVALIDARG; if (((MemAllocator*)This)->props.cbBuffer<0) return E_FAIL; *pProps=((MemAllocator*)This)->props; return 0; } static HRESULT STDCALL MemAllocator_Commit(IMemAllocator * This) { MemAllocator* me = (MemAllocator*)This; int i; Debug printf("MemAllocator_Commit(%p) called\n", This); if (((MemAllocator*)This)->props.cbBuffer < 0) return E_FAIL; if (me->used_list || me->free_list) return E_INVALIDARG; for (i = 0; i < me->props.cBuffers; i++) { CMediaSample* sample = CMediaSampleCreate((IMemAllocator*)me, me->props.cbBuffer); if (!sample) return E_OUTOFMEMORY; //printf("FREEEEEEEEEEEE ADDED %p\n", sample); me->free_list = avm_list_add_tail(me->free_list, sample); //avm_list_print(me->free_list); } //printf("Added mem %p: lsz: %d %d size: %d\n", me, avm_list_size(me->free_list), me->props.cBuffers, me->props.cbBuffer); return 0; } static HRESULT STDCALL MemAllocator_Decommit(IMemAllocator * This) { MemAllocator* me=(MemAllocator*)This; Debug printf("MemAllocator_Decommit(%p) called\n", This); //printf("Deleted mem %p: %d %d\n", me, me->free_list.size(), me->used_list.size()); while (me->used_list) { me->free_list = avm_list_add_tail(me->free_list, (CMediaSample*) me->used_list->member); me->used_list = avm_list_del_head(me->used_list); } while (me->free_list) { CMediaSample* sample = (CMediaSample*) me->free_list->member; //printf("****************** Decommiting FREE %p\n", sample); //sample->vt->Release((IUnknown*)sample); CMediaSample_Destroy((CMediaSample*)sample); me->free_list = avm_list_del_head(me->free_list); } return 0; } static HRESULT STDCALL MemAllocator_GetBuffer(IMemAllocator * This, /* [out] */ IMediaSample **ppBuffer, /* [in] */ REFERENCE_TIME *pStartTime, /* [in] */ REFERENCE_TIME *pEndTime, /* [in] */ DWORD dwFlags) { MemAllocator* me = (MemAllocator*)This; CMediaSample* sample; Debug printf("MemAllocator_ReleaseBuffer(%p) called %d %d\n", This, avm_list_size(me->used_list), avm_list_size(me->free_list)); if (!me->free_list) { Debug printf("No samples available\n"); return E_FAIL;//should block here if no samples are available } sample = (CMediaSample*) me->free_list->member; me->free_list = avm_list_del_head(me->free_list); me->used_list = avm_list_add_tail(me->used_list, sample); *ppBuffer = (IMediaSample*) sample; sample->vt->AddRef((IUnknown*) sample); if (me->new_pointer) { if (me->modified_sample) me->modified_sample->ResetPointer(me->modified_sample); sample->SetPointer(sample, me->new_pointer); me->modified_sample = sample; me->new_pointer = 0; } return 0; } static HRESULT STDCALL MemAllocator_ReleaseBuffer(IMemAllocator* This, /* [in] */ IMediaSample* pBuffer) { avm_list_t* l; MemAllocator* me = (MemAllocator*)This; Debug printf("MemAllocator_ReleaseBuffer(%p) called %d %d\n", This, avm_list_size(me->used_list), avm_list_size(me->free_list)); l = avm_list_find(me->used_list, pBuffer); if (l) { CMediaSample* sample = (CMediaSample*) l->member; if (me->modified_sample == sample) { me->modified_sample->ResetPointer(me->modified_sample); me->modified_sample = 0; } me->used_list = avm_list_del_head(me->used_list); me->free_list = avm_list_add_head(me->free_list, sample); //printf("****************** RELEASED OK %p %p\n", me->used_list, me->free_list); return 0; } Debug printf("MemAllocator_ReleaseBuffer(%p) releasing unknown buffer!!!! %p\n", This, pBuffer); return E_FAIL; } static void MemAllocator_SetPointer(MemAllocator* This, char* pointer) { This->new_pointer = pointer; } static void MemAllocator_ResetPointer(MemAllocator* This) { if (This->modified_sample) { This->modified_sample->ResetPointer(This->modified_sample); This->modified_sample = 0; } } static void MemAllocator_Destroy(MemAllocator* This) { Debug printf("MemAllocator_Destroy(%p) called (%d, %d)\n", This, This->refcount, AllocatorKeeper); if (--AllocatorKeeper == 0) UnregisterComClass(&CLSID_MemoryAllocator, MemAllocator_CreateAllocator); free(This->vt); free(This); } IMPLEMENT_IUNKNOWN(MemAllocator) MemAllocator* MemAllocatorCreate() { MemAllocator* This = (MemAllocator*) malloc(sizeof(MemAllocator)); if (!This) return NULL; Debug printf("MemAllocatorCreate() called -> %p\n", This); This->refcount = 1; This->props.cBuffers = 1; This->props.cbBuffer = 65536; /* :/ */ This->props.cbAlign = 1; This->props.cbPrefix = 0; This->vt = (IMemAllocator_vt*) malloc(sizeof(IMemAllocator_vt)); if (!This->vt) { free(This); return NULL; } This->vt->QueryInterface = MemAllocator_QueryInterface; This->vt->AddRef = MemAllocator_AddRef; This->vt->Release = MemAllocator_Release; This->vt->SetProperties = MemAllocator_SetProperties; This->vt->GetProperties = MemAllocator_GetProperties; This->vt->Commit = MemAllocator_Commit; This->vt->Decommit = MemAllocator_Decommit; This->vt->GetBuffer = MemAllocator_GetBuffer; This->vt->ReleaseBuffer = MemAllocator_ReleaseBuffer; This->SetPointer = MemAllocator_SetPointer; This->ResetPointer = MemAllocator_ResetPointer; This->modified_sample = 0; This->new_pointer = 0; This->used_list = 0; This->free_list = 0; This->interfaces[0]=IID_IUnknown; This->interfaces[1]=IID_IMemAllocator; if (AllocatorKeeper++ == 0) RegisterComClass(&CLSID_MemoryAllocator, MemAllocator_CreateAllocator); return This; } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dshow/allocator.h0000644000175000017500000000113507560320255023602 0ustar yavoryavor#ifndef DS_ALLOCATOR_H #define DS_ALLOCATOR_H #include "interfaces.h" #include "cmediasample.h" typedef struct _avm_list_t avm_list_t; typedef struct _MemAllocator MemAllocator; struct _MemAllocator { IMemAllocator_vt* vt; DECLARE_IUNKNOWN(); ALLOCATOR_PROPERTIES props; avm_list_t* used_list; avm_list_t* free_list; char* new_pointer; CMediaSample* modified_sample; GUID interfaces[2]; void ( *SetPointer )(MemAllocator* This, char* pointer); void ( *ResetPointer )(MemAllocator* This); }; MemAllocator* MemAllocatorCreate(void); #endif /* DS_ALLOCATOR_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dshow/cmediasample.c0000644000175000017500000002360207566255144024256 0ustar yavoryavor#include "cmediasample.h" #include "wine/winerror.h" #include #include #include /* * currently hack to make some extra room for DS Acel codec which * seems to overwrite allocated memory - FIXME better later * check the buffer allocation */ static const int SAFETY_ACEL = 1024; static long STDCALL CMediaSample_QueryInterface(IUnknown* This, /* [in] */ const GUID* iid, /* [iid_is][out] */ void **ppv) { Debug printf("CMediaSample_QueryInterface(%p) called\n", This); if (!ppv) return E_INVALIDARG; if (memcmp(iid, &IID_IUnknown, sizeof(*iid)) == 0) { *ppv = (void*)This; ((IMediaSample*) This)->vt->AddRef(This); return 0; } if (memcmp(iid, &IID_IMediaSample, sizeof(*iid)) == 0) { *ppv = (void*)This; ((IMediaSample*) This)->vt->AddRef(This); return 0; } return E_NOINTERFACE; } static long STDCALL CMediaSample_AddRef(IUnknown* This) { Debug printf("CMediaSample_AddRef(%p) called\n", This); ((CMediaSample*)This)->refcount++; return 0; } void CMediaSample_Destroy(CMediaSample* This) { Debug printf("CMediaSample_Destroy(%p) called (ref:%d)\n", This, This->refcount); free(This->vt); free(This->own_block); if (This->media_type.pbFormat) CoTaskMemFree(This->media_type.pbFormat); free(This); } static long STDCALL CMediaSample_Release(IUnknown* This) { CMediaSample* parent = (CMediaSample*)This; Debug printf("CMediaSample_Release(%p) called (new ref:%d)\n", This, ((CMediaSample*)This)->refcount-1); if (--((CMediaSample*) This)->refcount == 0) { parent->all->vt->ReleaseBuffer((IMemAllocator*)(parent->all), (IMediaSample*)This); } return 0; } static HRESULT STDCALL CMediaSample_GetPointer(IMediaSample* This, /* [out] */ BYTE** ppBuffer) { Debug printf("CMediaSample_GetPointer(%p) called -> %p, size: %d %d\n", This, ((CMediaSample*) This)->block, ((CMediaSample*)This)->actual_size, ((CMediaSample*)This)->size); if (!ppBuffer) return E_INVALIDARG; *ppBuffer = (BYTE*) ((CMediaSample*) This)->block; return 0; } static long STDCALL CMediaSample_GetSize(IMediaSample * This) { Debug printf("CMediaSample_GetSize(%p) called -> %d\n", This, ((CMediaSample*) This)->size); return ((CMediaSample*) This)->size; } static HRESULT STDCALL CMediaSample_GetTime(IMediaSample * This, /* [out] */ REFERENCE_TIME *pTimeStart, /* [out] */ REFERENCE_TIME *pTimeEnd) { Debug printf("CMediaSample_GetTime(%p) called (UNIMPLEMENTED)\n", This); return E_NOTIMPL; } static HRESULT STDCALL CMediaSample_SetTime(IMediaSample * This, /* [in] */ REFERENCE_TIME *pTimeStart, /* [in] */ REFERENCE_TIME *pTimeEnd) { Debug printf("CMediaSample_SetTime(%p) called (UNIMPLEMENTED)\n", This); return E_NOTIMPL; } static HRESULT STDCALL CMediaSample_IsSyncPoint(IMediaSample * This) { Debug printf("CMediaSample_IsSyncPoint(%p) called\n", This); if (((CMediaSample*)This)->isSyncPoint) return 0; return 1; } static HRESULT STDCALL CMediaSample_SetSyncPoint(IMediaSample * This, long bIsSyncPoint) { Debug printf("CMediaSample_SetSyncPoint(%p) called\n", This); ((CMediaSample*)This)->isSyncPoint = bIsSyncPoint; return 0; } static HRESULT STDCALL CMediaSample_IsPreroll(IMediaSample * This) { Debug printf("CMediaSample_IsPreroll(%p) called\n", This); if (((CMediaSample*)This)->isPreroll) return 0;//S_OK return 1;//S_FALSE } static HRESULT STDCALL CMediaSample_SetPreroll(IMediaSample * This, long bIsPreroll) { Debug printf("CMediaSample_SetPreroll(%p) called\n", This); ((CMediaSample*)This)->isPreroll=bIsPreroll; return 0; } static long STDCALL CMediaSample_GetActualDataLength(IMediaSample* This) { Debug printf("CMediaSample_GetActualDataLength(%p) called -> %d\n", This, ((CMediaSample*)This)->actual_size); return ((CMediaSample*)This)->actual_size; } static HRESULT STDCALL CMediaSample_SetActualDataLength(IMediaSample* This, long __MIDL_0010) { CMediaSample* cms = (CMediaSample*)This; Debug printf("CMediaSample_SetActualDataLength(%p, %ld) called\n", This, __MIDL_0010); if (__MIDL_0010 > cms->size) { char* c = cms->own_block; Debug printf("CMediaSample - buffer overflow %ld %d %p %p\n", __MIDL_0010, ((CMediaSample*)This)->size, cms->own_block, cms->block); cms->own_block = (char*) realloc(cms->own_block, (size_t) __MIDL_0010 + SAFETY_ACEL); if (c == cms->block) cms->block = cms->own_block; cms->size = __MIDL_0010; } cms->actual_size = __MIDL_0010; return 0; } static HRESULT STDCALL CMediaSample_GetMediaType(IMediaSample* This, AM_MEDIA_TYPE** ppMediaType) { AM_MEDIA_TYPE* t; Debug printf("CMediaSample_GetMediaType(%p) called\n", This); if(!ppMediaType) return E_INVALIDARG; if(!((CMediaSample*)This)->type_valid) { *ppMediaType=0; return 1; } t = &((CMediaSample*)This)->media_type; // if(t.pbFormat)CoTaskMemFree(t.pbFormat); (*ppMediaType) = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); **ppMediaType = *t; (*ppMediaType)->pbFormat = (char*)CoTaskMemAlloc(t->cbFormat); memcpy((*ppMediaType)->pbFormat, t->pbFormat, t->cbFormat); // *ppMediaType=0; //media type was not changed return 0; } static HRESULT STDCALL CMediaSample_SetMediaType(IMediaSample * This, AM_MEDIA_TYPE *pMediaType) { AM_MEDIA_TYPE* t; Debug printf("CMediaSample_SetMediaType(%p) called\n", This); if (!pMediaType) return E_INVALIDARG; t = &((CMediaSample*)This)->media_type; if (t->pbFormat) CoTaskMemFree(t->pbFormat); t = pMediaType; if (t->cbFormat) { t->pbFormat = (char*)CoTaskMemAlloc(t->cbFormat); memcpy(t->pbFormat, pMediaType->pbFormat, t->cbFormat); } else t->pbFormat = 0; ((CMediaSample*) This)->type_valid=1; return 0; } static HRESULT STDCALL CMediaSample_IsDiscontinuity(IMediaSample * This) { Debug printf("CMediaSample_IsDiscontinuity(%p) called\n", This); return ((CMediaSample*) This)->isDiscontinuity; } static HRESULT STDCALL CMediaSample_SetDiscontinuity(IMediaSample * This, long bDiscontinuity) { Debug printf("CMediaSample_SetDiscontinuity(%p) called (%ld)\n", This, bDiscontinuity); ((CMediaSample*) This)->isDiscontinuity = bDiscontinuity; return 0; } static HRESULT STDCALL CMediaSample_GetMediaTime(IMediaSample * This, /* [out] */ LONGLONG *pTimeStart, /* [out] */ LONGLONG *pTimeEnd) { Debug printf("CMediaSample_GetMediaTime(%p) called\n", This); if (pTimeStart) *pTimeStart = ((CMediaSample*) This)->time_start; if (pTimeEnd) *pTimeEnd = ((CMediaSample*) This)->time_end; return 0; } static HRESULT STDCALL CMediaSample_SetMediaTime(IMediaSample * This, /* [in] */ LONGLONG *pTimeStart, /* [in] */ LONGLONG *pTimeEnd) { Debug printf("CMediaSample_SetMediaTime(%p) called\n", This); if (pTimeStart) ((CMediaSample*) This)->time_start = *pTimeStart; if (pTimeEnd) ((CMediaSample*) This)->time_end = *pTimeEnd; return 0; } // extension for direct memory write or decompressed data static void CMediaSample_SetPointer(CMediaSample* This, char* pointer) { Debug printf("CMediaSample_SetPointer(%p) called -> %p\n", This, pointer); if (pointer) This->block = pointer; else This->block = This->own_block; } static void CMediaSample_ResetPointer(CMediaSample* This) { Debug printf("CMediaSample_ResetPointer(%p) called\n", This); This->block = This->own_block; } CMediaSample* CMediaSampleCreate(IMemAllocator* allocator, int _size) { CMediaSample* This = (CMediaSample*) malloc(sizeof(CMediaSample)); if (!This) return NULL; // some hack here! // it looks like Acelp decoder is actually accessing // the allocated memory before it sets the new size for it ??? // -- maybe it's being initialized with wrong parameters // anyway this is fixes the problem somehow with some reserves // // using different trick for now - in DS_Audio modify sample size //if (_size < 0x1000) // _size = (_size + 0xfff) & ~0xfff; This->vt = (IMediaSample_vt*) malloc(sizeof(IMediaSample_vt)); This->own_block = (char*) malloc((size_t)_size + SAFETY_ACEL); This->media_type.pbFormat = 0; if (!This->vt || !This->own_block) { CMediaSample_Destroy(This); return NULL; } This->vt->QueryInterface = CMediaSample_QueryInterface; This->vt->AddRef = CMediaSample_AddRef; This->vt->Release = CMediaSample_Release; This->vt->GetPointer = CMediaSample_GetPointer; This->vt->GetSize = CMediaSample_GetSize; This->vt->GetTime = CMediaSample_GetTime; This->vt->SetTime = CMediaSample_SetTime; This->vt->IsSyncPoint = CMediaSample_IsSyncPoint; This->vt->SetSyncPoint = CMediaSample_SetSyncPoint; This->vt->IsPreroll = CMediaSample_IsPreroll; This->vt->SetPreroll = CMediaSample_SetPreroll; This->vt->GetActualDataLength = CMediaSample_GetActualDataLength; This->vt->SetActualDataLength = CMediaSample_SetActualDataLength; This->vt->GetMediaType = CMediaSample_GetMediaType; This->vt->SetMediaType = CMediaSample_SetMediaType; This->vt->IsDiscontinuity = CMediaSample_IsDiscontinuity; This->vt->SetDiscontinuity = CMediaSample_SetDiscontinuity; This->vt->GetMediaTime = CMediaSample_GetMediaTime; This->vt->SetMediaTime = CMediaSample_SetMediaTime; This->all = allocator; This->size = _size; This->refcount = 0; // increased by MemAllocator This->actual_size = 0; This->isPreroll = 0; This->isDiscontinuity = 1; This->time_start = 0; This->time_end = 0; This->type_valid = 0; This->block = This->own_block; This->SetPointer = CMediaSample_SetPointer; This->ResetPointer = CMediaSample_ResetPointer; Debug printf("CMediaSample_Create(%p) called - sample size %d, buffer %p\n", This, This->size, This->block); return This; } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dshow/cmediasample.h0000644000175000017500000000142607400375167024256 0ustar yavoryavor#ifndef DS_CMEDIASAMPLE_H #define DS_CMEDIASAMPLE_H #include "interfaces.h" #include "guids.h" typedef struct _CMediaSample CMediaSample; struct _CMediaSample { IMediaSample_vt* vt; DECLARE_IUNKNOWN(); IMemAllocator* all; int size; int actual_size; char* block; char* own_block; int isPreroll; int isSyncPoint; int isDiscontinuity; LONGLONG time_start; LONGLONG time_end; AM_MEDIA_TYPE media_type; int type_valid; void ( *SetPointer) (CMediaSample* This, char* pointer); void ( *ResetPointer) (CMediaSample* This); // FIXME replace with Set & 0 }; CMediaSample* CMediaSampleCreate(IMemAllocator* allocator, int _size); // called from allocator void CMediaSample_Destroy(CMediaSample* This); #endif /* DS_CMEDIASAMPLE_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dshow/guids.c0000644000175000017500000001013707570366142022740 0ustar yavoryavor#include "guids.h" const GUID CLSID_DivxDecompressorCF={0x82CCd3E0, 0xF71A, 0x11D0, { 0x9f, 0xe5, 0x00, 0x60, 0x97, 0x78, 0xaa, 0xaa}}; const GUID IID_IDivxFilterInterface={0xd132ee97, 0x3e38, 0x4030, {0x8b, 0x17, 0x59, 0x16, 0x3b, 0x30, 0xa1, 0xf5}}; const GUID CLSID_IV50_Decoder={0x30355649, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; const GUID IID_IBaseFilter={0x56a86895, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; const GUID IID_IEnumPins={0x56a86892, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; const GUID IID_IEnumMediaTypes={0x89c31040, 0x846b, 0x11ce, {0x97, 0xd3, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}}; const GUID IID_IMemInputPin={0x56a8689d, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; const GUID IID_IMemAllocator={0x56a8689c, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; const GUID IID_IMediaSample={0x56a8689a, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; const GUID MEDIATYPE_Video={0x73646976, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; const GUID GUID_NULL={0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}; const GUID FORMAT_VideoInfo={0x05589f80, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}}; const GUID MEDIASUBTYPE_RGB1={0xe436eb78, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; const GUID MEDIASUBTYPE_RGB4={0xe436eb79, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; const GUID MEDIASUBTYPE_RGB8={0xe436eb7a, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; const GUID MEDIASUBTYPE_RGB565={0xe436eb7b, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; const GUID MEDIASUBTYPE_RGB555={0xe436eb7c, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; const GUID MEDIASUBTYPE_RGB24={0xe436eb7d, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; const GUID MEDIASUBTYPE_RGB32={0xe436eb7e, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; const GUID MEDIASUBTYPE_YUYV={0x56595559, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; const GUID MEDIASUBTYPE_IYUV={0x56555949, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; const GUID MEDIASUBTYPE_YVU9={0x39555659, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; const GUID MEDIASUBTYPE_Y411={0x31313459, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; const GUID MEDIASUBTYPE_Y41P={0x50313459, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; const GUID MEDIASUBTYPE_YUY2={0x32595559, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; const GUID MEDIASUBTYPE_YVYU={0x55595659, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; const GUID MEDIASUBTYPE_UYVY={0x59565955, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; const GUID MEDIASUBTYPE_Y211={0x31313259, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; const GUID MEDIASUBTYPE_YV12={0x32315659, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; const GUID MEDIASUBTYPE_I420={0x30323449, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; const GUID MEDIASUBTYPE_IF09={0x39304649, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; const GUID CLSID_MemoryAllocator={0x1e651cc0, 0xb199, 0x11d0, {0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45}}; const GUID IID_DivxHidden={0x598eba01, 0xb49a, 0x11d2, {0xa1, 0xc1, 0x00, 0x60, 0x97, 0x78, 0xaa, 0xaa}}; const GUID IID_Iv50Hidden={0x665a4442, 0xd905, 0x11d0, {0xa3, 0x0e, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}; const GUID FORMAT_WaveFormatEx = {0x05589f81, 0xc356, 0x11CE, {0xBF, 0x01, 0x00, 0xAA, 0x00, 0x55, 0x59, 0x5A}}; const GUID MEDIATYPE_Audio = {0x73647561, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71}}; const GUID MEDIASUBTYPE_PCM = {0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71}}; avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dshow/guids.h0000644000175000017500000000510007570366142022737 0ustar yavoryavor#ifndef DS_GUIDS_H #define DS_GUIDS_H #include "com.h" #include "wine/module.h" #include "wine/windef.h" #include "wine/vfw.h" //#define Debug if(1) #define Debug if(0) typedef struct __attribute__((__packed__)) _MediaType { GUID majortype; //0x0 GUID subtype; //0x10 int bFixedSizeSamples; //0x20 int bTemporalCompression; //0x24 unsigned long lSampleSize; //0x28 GUID formattype; //0x2c IUnknown* pUnk; //0x3c unsigned long cbFormat; //0x40 char* pbFormat; //0x44 } AM_MEDIA_TYPE; typedef long long REFERENCE_TIME; typedef struct __attribute__((__packed__)) RECT32 { int left, top, right, bottom; } RECT32; typedef struct __attribute__((__packed__)) tagVIDEOINFOHEADER { RECT32 rcSource; // The bit we really want to use RECT32 rcTarget; // Where the video should go unsigned long dwBitRate; // Approximate bit data rate unsigned long dwBitErrorRate; // Bit error rate for this stream REFERENCE_TIME AvgTimePerFrame; // Average time per frame (100ns units) BITMAPINFOHEADER bmiHeader; //int reserved[3]; } VIDEOINFOHEADER; typedef GUID CLSID; typedef GUID IID; extern const GUID IID_IBaseFilter; extern const GUID IID_IEnumPins; extern const GUID IID_IEnumMediaTypes; extern const GUID IID_IMemInputPin; extern const GUID IID_IMemAllocator; extern const GUID IID_IMediaSample; extern const GUID IID_DivxHidden; extern const GUID IID_Iv50Hidden; extern const GUID CLSID_DivxDecompressorCF; extern const GUID IID_IDivxFilterInterface; extern const GUID CLSID_IV50_Decoder; extern const GUID CLSID_MemoryAllocator; extern const GUID MEDIATYPE_Video; extern const GUID GUID_NULL; extern const GUID FORMAT_VideoInfo; extern const GUID MEDIASUBTYPE_RGB1; extern const GUID MEDIASUBTYPE_RGB4; extern const GUID MEDIASUBTYPE_RGB8; extern const GUID MEDIASUBTYPE_RGB565; extern const GUID MEDIASUBTYPE_RGB555; extern const GUID MEDIASUBTYPE_RGB24; extern const GUID MEDIASUBTYPE_RGB32; extern const GUID MEDIASUBTYPE_YUYV; extern const GUID MEDIASUBTYPE_IYUV; extern const GUID MEDIASUBTYPE_YVU9; extern const GUID MEDIASUBTYPE_Y411; extern const GUID MEDIASUBTYPE_Y41P; extern const GUID MEDIASUBTYPE_YUY2; extern const GUID MEDIASUBTYPE_YVYU; extern const GUID MEDIASUBTYPE_UYVY; extern const GUID MEDIASUBTYPE_Y211; extern const GUID MEDIASUBTYPE_YV12; extern const GUID MEDIASUBTYPE_I420; extern const GUID MEDIASUBTYPE_IF09; extern const GUID FORMAT_WaveFormatEx; extern const GUID MEDIATYPE_Audio; extern const GUID MEDIASUBTYPE_PCM; #endif /* DS_GUIDS_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dshow/inputpin.c0000644000175000017500000004744507474366576023525 0ustar yavoryavor#include "inputpin.h" #include "wine/winerror.h" #include #include #include static inline int unimplemented(const char* s, void* p) { Debug printf("%s(%p) called (UNIMPLEMENTED)", s, p); return E_NOTIMPL; } /*********** * EnumPins ***********/ typedef struct { IEnumPins_vt* vt; DECLARE_IUNKNOWN(); IPin* pin1; IPin* pin2; int counter; GUID interfaces[2]; } CEnumPins; static long STDCALL CEnumPins_Next(IEnumPins* This, /* [in] */ unsigned long cMediaTypes, /* [size_is][out] */ IPin** ppMediaTypes, /* [out] */ unsigned long* pcFetched) { CEnumPins* pin = (CEnumPins*)This; Debug printf("CEnumPins_Next(%p) called\n", This); if (!ppMediaTypes) return E_INVALIDARG; if (!pcFetched && (cMediaTypes!=1)) return E_INVALIDARG; if (cMediaTypes<=0) return 0; //lcounter = ((CEnumPins*)This)->counter; //lpin1 = ((CEnumPins*)This)->pin1; //lpin2 = ((CEnumPins*)This)->pin2; if (((pin->counter == 2) && pin->pin2) || ((pin->counter == 1) && !pin->pin2)) { if (pcFetched) *pcFetched=0; return 1; } if (pcFetched) *pcFetched=1; if (pin->counter==0) { *ppMediaTypes = pin->pin1; pin->pin1->vt->AddRef((IUnknown*)pin->pin1); } else { *ppMediaTypes = pin->pin2; pin->pin2->vt->AddRef((IUnknown*)pin->pin2); } pin->counter++; if (cMediaTypes == 1) return 0; return 1; } static long STDCALL CEnumPins_Skip(IEnumPins* This, /* [in] */ unsigned long cMediaTypes) { Debug unimplemented("CEnumPins_Skip", This); return E_NOTIMPL; } static long STDCALL CEnumPins_Reset(IEnumPins* This) { Debug printf("CEnumPins_Reset(%p) called\n", This); ((CEnumPins*)This)->counter = 0; return 0; } static long STDCALL CEnumPins_Clone(IEnumPins* This, /* [out] */ IEnumPins** ppEnum) { Debug unimplemented("CEnumPins_Clone", This); return E_NOTIMPL; } static void CEnumPins_Destroy(CEnumPins* This) { free(This->vt); free(This); } IMPLEMENT_IUNKNOWN(CEnumPins) static CEnumPins* CEnumPinsCreate(IPin* p, IPin* pp) { CEnumPins* This = (CEnumPins*) malloc(sizeof(CEnumPins)); if (!This) return NULL; This->refcount = 1; This->pin1 = p; This->pin2 = pp; This->counter = 0; This->vt = (IEnumPins_vt*) malloc(sizeof(IEnumPins_vt)); if (!This->vt) { free(This); return NULL; } This->vt->QueryInterface = CEnumPins_QueryInterface; This->vt->AddRef = CEnumPins_AddRef; This->vt->Release = CEnumPins_Release; This->vt->Next = CEnumPins_Next; This->vt->Skip = CEnumPins_Skip; This->vt->Reset = CEnumPins_Reset; This->vt->Clone = CEnumPins_Clone; This->interfaces[0] = IID_IUnknown; This->interfaces[1] = IID_IEnumPins; return This; } /*********** * InputPin ***********/ static long STDCALL CInputPin_Connect(IPin* This, /* [in] */ IPin* pReceivePin, /* [in] */ AM_MEDIA_TYPE* pmt) { Debug unimplemented("CInputPin_Connect", This); return E_NOTIMPL; } static long STDCALL CInputPin_ReceiveConnection(IPin* This, /* [in] */ IPin* pConnector, /* [in] */ const AM_MEDIA_TYPE *pmt) { Debug unimplemented("CInputPin_ReceiveConnection", This); return E_NOTIMPL; } static long STDCALL CInputPin_Disconnect(IPin* This) { Debug unimplemented("CInputPin_Disconnect", This); return E_NOTIMPL; } static long STDCALL CInputPin_ConnectedTo(IPin* This, /* [out] */ IPin** pPin) { Debug unimplemented("CInputPin_ConnectedTo", This); return E_NOTIMPL; } static long STDCALL CInputPin_ConnectionMediaType(IPin* This, /* [out] */ AM_MEDIA_TYPE *pmt) { Debug printf("CInputPin_ConnectionMediaType(%p) called\n", This); if (!pmt) return E_INVALIDARG; *pmt=((CInputPin*)This)->type; if (pmt->cbFormat > 0) { pmt->pbFormat=(char *)CoTaskMemAlloc(pmt->cbFormat); memcpy(pmt->pbFormat, ((CInputPin*)This)->type.pbFormat, pmt->cbFormat); } return 0; } static long STDCALL CInputPin_QueryPinInfo(IPin* This, /* [out] */ PIN_INFO *pInfo) { CBaseFilter* lparent=((CInputPin*)This)->parent; Debug printf("CInputPin_QueryPinInfo(%p) called\n", This); pInfo->dir = PINDIR_OUTPUT; pInfo->pFilter = (IBaseFilter*) lparent; lparent->vt->AddRef((IUnknown*)lparent); pInfo->achName[0] = 0; return 0; } static long STDCALL CInputPin_QueryDirection(IPin* This, /* [out] */ PIN_DIRECTION *pPinDir) { *pPinDir = PINDIR_OUTPUT; Debug printf("CInputPin_QueryDirection(%p) called\n", This); return 0; } static long STDCALL CInputPin_QueryId(IPin* This, /* [out] */ unsigned short* *Id) { Debug unimplemented("CInputPin_QueryId", This); return E_NOTIMPL; } static long STDCALL CInputPin_QueryAccept(IPin* This, /* [in] */ const AM_MEDIA_TYPE* pmt) { Debug unimplemented("CInputPin_QueryAccept", This); return E_NOTIMPL; } static long STDCALL CInputPin_EnumMediaTypes(IPin* This, /* [out] */ IEnumMediaTypes** ppEnum) { Debug unimplemented("CInputPin_EnumMediaTypes", This); return E_NOTIMPL; } static long STDCALL CInputPin_QueryInternalConnections(IPin* This, /* [out] */ IPin** apPin, /* [out][in] */ unsigned long *nPin) { Debug unimplemented("CInputPin_QueryInternalConnections", This); return E_NOTIMPL; } static long STDCALL CInputPin_EndOfStream(IPin * This) { Debug unimplemented("CInputPin_EndOfStream", This); return E_NOTIMPL; } static long STDCALL CInputPin_BeginFlush(IPin * This) { Debug unimplemented("CInputPin_BeginFlush", This); return E_NOTIMPL; } static long STDCALL CInputPin_EndFlush(IPin* This) { Debug unimplemented("CInputPin_EndFlush", This); return E_NOTIMPL; } static long STDCALL CInputPin_NewSegment(IPin* This, /* [in] */ REFERENCE_TIME tStart, /* [in] */ REFERENCE_TIME tStop, /* [in] */ double dRate) { Debug unimplemented("CInputPin_NewSegment", This); return E_NOTIMPL; } static void CInputPin_Destroy(CInputPin* This) { free(This->vt); free(This); } IMPLEMENT_IUNKNOWN(CInputPin) CInputPin* CInputPinCreate(CBaseFilter* p, const AM_MEDIA_TYPE* amt) { CInputPin* This = (CInputPin*) malloc(sizeof(CInputPin)); if (!This) return NULL; This->refcount = 1; This->parent = p; This->type = *amt; This->vt= (IPin_vt*) malloc(sizeof(IPin_vt)); if (!This->vt) { free(This); return NULL; } This->vt->QueryInterface = CInputPin_QueryInterface; This->vt->AddRef = CInputPin_AddRef; This->vt->Release = CInputPin_Release; This->vt->Connect = CInputPin_Connect; This->vt->ReceiveConnection = CInputPin_ReceiveConnection; This->vt->Disconnect = CInputPin_Disconnect; This->vt->ConnectedTo = CInputPin_ConnectedTo; This->vt->ConnectionMediaType = CInputPin_ConnectionMediaType; This->vt->QueryPinInfo = CInputPin_QueryPinInfo; This->vt->QueryDirection = CInputPin_QueryDirection; This->vt->QueryId = CInputPin_QueryId; This->vt->QueryAccept = CInputPin_QueryAccept; This->vt->EnumMediaTypes = CInputPin_EnumMediaTypes; This->vt->QueryInternalConnections = CInputPin_QueryInternalConnections; This->vt->EndOfStream = CInputPin_EndOfStream; This->vt->BeginFlush = CInputPin_BeginFlush; This->vt->EndFlush = CInputPin_EndFlush; This->vt->NewSegment = CInputPin_NewSegment; This->interfaces[0]=IID_IUnknown; return This; } /************* * BaseFilter *************/ static long STDCALL CBaseFilter_GetClassID(IBaseFilter * This, /* [out] */ CLSID *pClassID) { Debug unimplemented("CBaseFilter_GetClassID", This); return E_NOTIMPL; } static long STDCALL CBaseFilter_Stop(IBaseFilter* This) { Debug unimplemented("CBaseFilter_Stop", This); return E_NOTIMPL; } static long STDCALL CBaseFilter_Pause(IBaseFilter* This) { Debug unimplemented("CBaseFilter_Pause", This); return E_NOTIMPL; } static long STDCALL CBaseFilter_Run(IBaseFilter* This, REFERENCE_TIME tStart) { Debug unimplemented("CBaseFilter_Run", This); return E_NOTIMPL; } static long STDCALL CBaseFilter_GetState(IBaseFilter* This, /* [in] */ unsigned long dwMilliSecsTimeout, // /* [out] */ FILTER_STATE *State) void* State) { Debug unimplemented("CBaseFilter_GetState", This); return E_NOTIMPL; } static long STDCALL CBaseFilter_SetSyncSource(IBaseFilter* This, /* [in] */ IReferenceClock *pClock) { Debug unimplemented("CBaseFilter_SetSyncSource", This); return E_NOTIMPL; } static long STDCALL CBaseFilter_GetSyncSource(IBaseFilter* This, /* [out] */ IReferenceClock **pClock) { Debug unimplemented("CBaseFilter_GetSyncSource", This); return E_NOTIMPL; } static long STDCALL CBaseFilter_EnumPins(IBaseFilter* This, /* [out] */ IEnumPins **ppEnum) { Debug printf("CBaseFilter_EnumPins(%p) called\n", This); *ppEnum = (IEnumPins*) CEnumPinsCreate(((CBaseFilter*)This)->pin, ((CBaseFilter*)This)->unused_pin); return 0; } static long STDCALL CBaseFilter_FindPin(IBaseFilter* This, /* [string][in] */ const unsigned short* Id, /* [out] */ IPin **ppPin) { Debug unimplemented("CBaseFilter_FindPin\n", This); return E_NOTIMPL; } static long STDCALL CBaseFilter_QueryFilterInfo(IBaseFilter* This, // /* [out] */ FILTER_INFO *pInfo) void* pInfo) { Debug unimplemented("CBaseFilter_QueryFilterInfo", This); return E_NOTIMPL; } static long STDCALL CBaseFilter_JoinFilterGraph(IBaseFilter* This, /* [in] */ IFilterGraph* pGraph, /* [string][in] */ const unsigned short* pName) { Debug unimplemented("CBaseFilter_JoinFilterGraph", This); return E_NOTIMPL; } static long STDCALL CBaseFilter_QueryVendorInfo(IBaseFilter* This, /* [string][out] */ unsigned short** pVendorInfo) { Debug unimplemented("CBaseFilter_QueryVendorInfo", This); return E_NOTIMPL; } static IPin* CBaseFilter_GetPin(CBaseFilter* This) { return This->pin; } static IPin* CBaseFilter_GetUnusedPin(CBaseFilter* This) { return This->unused_pin; } static void CBaseFilter_Destroy(CBaseFilter* This) { if (This->vt) free(This->vt); if (This->pin) This->pin->vt->Release((IUnknown*)This->pin); if (This->unused_pin) This->unused_pin->vt->Release((IUnknown*)This->unused_pin); free(This); } IMPLEMENT_IUNKNOWN(CBaseFilter) CBaseFilter* CBaseFilterCreate(const AM_MEDIA_TYPE* type, CBaseFilter2* parent) { CBaseFilter* This = (CBaseFilter*) malloc(sizeof(CBaseFilter)); if (!This) return NULL; This->refcount = 1; This->pin = (IPin*) CInputPinCreate(This, type); This->unused_pin = (IPin*) CRemotePinCreate(This, parent->GetPin(parent)); This->vt = (IBaseFilter_vt*) malloc(sizeof(IBaseFilter_vt)); if (!This->vt || !This->pin || !This->unused_pin) { CBaseFilter_Destroy(This); return NULL; } This->vt->QueryInterface = CBaseFilter_QueryInterface; This->vt->AddRef = CBaseFilter_AddRef; This->vt->Release = CBaseFilter_Release; This->vt->GetClassID = CBaseFilter_GetClassID; This->vt->Stop = CBaseFilter_Stop; This->vt->Pause = CBaseFilter_Pause; This->vt->Run = CBaseFilter_Run; This->vt->GetState = CBaseFilter_GetState; This->vt->SetSyncSource = CBaseFilter_SetSyncSource; This->vt->GetSyncSource = CBaseFilter_GetSyncSource; This->vt->EnumPins = CBaseFilter_EnumPins; This->vt->FindPin = CBaseFilter_FindPin; This->vt->QueryFilterInfo = CBaseFilter_QueryFilterInfo; This->vt->JoinFilterGraph = CBaseFilter_JoinFilterGraph; This->vt->QueryVendorInfo = CBaseFilter_QueryVendorInfo; This->interfaces[0] = IID_IUnknown; This->interfaces[1] = IID_IBaseFilter; This->GetPin = CBaseFilter_GetPin; This->GetUnusedPin = CBaseFilter_GetUnusedPin; return This; } /************** * BaseFilter2 **************/ static long STDCALL CBaseFilter2_GetClassID(IBaseFilter* This, /* [out] */ CLSID* pClassID) { Debug unimplemented("CBaseFilter2_GetClassID", This); return E_NOTIMPL; } static long STDCALL CBaseFilter2_Stop(IBaseFilter* This) { Debug unimplemented("CBaseFilter2_Stop", This); return E_NOTIMPL; } static long STDCALL CBaseFilter2_Pause(IBaseFilter* This) { Debug unimplemented("CBaseFilter2_Pause", This); return E_NOTIMPL; } static long STDCALL CBaseFilter2_Run(IBaseFilter* This, REFERENCE_TIME tStart) { Debug unimplemented("CBaseFilter2_Run", This); return E_NOTIMPL; } static long STDCALL CBaseFilter2_GetState(IBaseFilter* This, /* [in] */ unsigned long dwMilliSecsTimeout, // /* [out] */ FILTER_STATE *State) void* State) { Debug unimplemented("CBaseFilter2_GetState", This); return E_NOTIMPL; } static long STDCALL CBaseFilter2_SetSyncSource(IBaseFilter* This, /* [in] */ IReferenceClock* pClock) { Debug unimplemented("CBaseFilter2_SetSyncSource", This); return E_NOTIMPL; } static long STDCALL CBaseFilter2_GetSyncSource(IBaseFilter* This, /* [out] */ IReferenceClock** pClock) { Debug unimplemented("CBaseFilter2_GetSyncSource", This); return E_NOTIMPL; } static long STDCALL CBaseFilter2_EnumPins(IBaseFilter* This, /* [out] */ IEnumPins** ppEnum) { Debug printf("CBaseFilter2_EnumPins(%p) called\n", This); *ppEnum = (IEnumPins*) CEnumPinsCreate(((CBaseFilter2*)This)->pin, 0); return 0; } static long STDCALL CBaseFilter2_FindPin(IBaseFilter* This, /* [string][in] */ const unsigned short* Id, /* [out] */ IPin** ppPin) { Debug unimplemented("CBaseFilter2_FindPin", This); return E_NOTIMPL; } static long STDCALL CBaseFilter2_QueryFilterInfo(IBaseFilter* This, // /* [out] */ FILTER_INFO *pInfo) void* pInfo) { Debug unimplemented("CBaseFilter2_QueryFilterInfo", This); return E_NOTIMPL; } static long STDCALL CBaseFilter2_JoinFilterGraph(IBaseFilter* This, /* [in] */ IFilterGraph* pGraph, /* [string][in] */ const unsigned short* pName) { Debug unimplemented("CBaseFilter2_JoinFilterGraph", This); return E_NOTIMPL; } static long STDCALL CBaseFilter2_QueryVendorInfo(IBaseFilter* This, /* [string][out] */ unsigned short** pVendorInfo) { Debug unimplemented("CBaseFilter2_QueryVendorInfo", This); return E_NOTIMPL; } static IPin* CBaseFilter2_GetPin(CBaseFilter2* This) { return This->pin; } static void CBaseFilter2_Destroy(CBaseFilter2* This) { Debug printf("CBaseFilter2_Destroy(%p) called\n", This); if (This->pin) This->pin->vt->Release((IUnknown*) This->pin); if (This->vt) free(This->vt); free(This); } IMPLEMENT_IUNKNOWN(CBaseFilter2) static GUID CBaseFilter2_interf1 = {0x76c61a30, 0xebe1, 0x11cf, {0x89, 0xf9, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb}}; static GUID CBaseFilter2_interf2 = {0xaae7e4e2, 0x6388, 0x11d1, {0x8d, 0x93, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2}}; static GUID CBaseFilter2_interf3 = {0x02ef04dd, 0x7580, 0x11d1, {0xbe, 0xce, 0x00, 0xc0, 0x4f, 0xb6, 0xe9, 0x37}}; CBaseFilter2* CBaseFilter2Create() { CBaseFilter2* This = (CBaseFilter2*) malloc(sizeof(CBaseFilter2)); if (!This) return NULL; This->refcount = 1; This->pin = (IPin*) CRemotePin2Create(This); This->vt = (IBaseFilter_vt*) malloc(sizeof(IBaseFilter_vt)); if (!This->pin || !This->vt) { CBaseFilter2_Destroy(This); return NULL; } memset(This->vt, 0, sizeof(IBaseFilter_vt)); This->vt->QueryInterface = CBaseFilter2_QueryInterface; This->vt->AddRef = CBaseFilter2_AddRef; This->vt->Release = CBaseFilter2_Release; This->vt->GetClassID = CBaseFilter2_GetClassID; This->vt->Stop = CBaseFilter2_Stop; This->vt->Pause = CBaseFilter2_Pause; This->vt->Run = CBaseFilter2_Run; This->vt->GetState = CBaseFilter2_GetState; This->vt->SetSyncSource = CBaseFilter2_SetSyncSource; This->vt->GetSyncSource = CBaseFilter2_GetSyncSource; This->vt->EnumPins = CBaseFilter2_EnumPins; This->vt->FindPin = CBaseFilter2_FindPin; This->vt->QueryFilterInfo = CBaseFilter2_QueryFilterInfo; This->vt->JoinFilterGraph = CBaseFilter2_JoinFilterGraph; This->vt->QueryVendorInfo = CBaseFilter2_QueryVendorInfo; This->GetPin = CBaseFilter2_GetPin; This->interfaces[0] = IID_IUnknown; This->interfaces[1] = IID_IBaseFilter; This->interfaces[2] = CBaseFilter2_interf1; This->interfaces[3] = CBaseFilter2_interf2; This->interfaces[4] = CBaseFilter2_interf3; return This; } /************* * CRemotePin *************/ static long STDCALL CRemotePin_ConnectedTo(IPin* This, /* [out] */ IPin** pPin) { Debug printf("CRemotePin_ConnectedTo(%p) called\n", This); if (!pPin) return E_INVALIDARG; *pPin = ((CRemotePin*)This)->remote_pin; (*pPin)->vt->AddRef((IUnknown*)(*pPin)); return 0; } static long STDCALL CRemotePin_QueryDirection(IPin* This, /* [out] */ PIN_DIRECTION* pPinDir) { Debug printf("CRemotePin_QueryDirection(%p) called\n", This); if (!pPinDir) return E_INVALIDARG; *pPinDir=PINDIR_INPUT; return 0; } static long STDCALL CRemotePin_ConnectionMediaType(IPin* This, /* [out] */ AM_MEDIA_TYPE* pmt) { Debug unimplemented("CRemotePin_ConnectionMediaType", This); return E_NOTIMPL; } static long STDCALL CRemotePin_QueryPinInfo(IPin* This, /* [out] */ PIN_INFO* pInfo) { CBaseFilter* lparent = ((CRemotePin*)This)->parent; Debug printf("CRemotePin_QueryPinInfo(%p) called\n", This); pInfo->dir= PINDIR_INPUT; pInfo->pFilter = (IBaseFilter*) lparent; lparent->vt->AddRef((IUnknown*)lparent); pInfo->achName[0]=0; return 0; } static void CRemotePin_Destroy(CRemotePin* This) { Debug printf("CRemotePin_Destroy(%p) called\n", This); free(This->vt); free(This); } IMPLEMENT_IUNKNOWN(CRemotePin) CRemotePin* CRemotePinCreate(CBaseFilter* pt, IPin* rpin) { CRemotePin* This = (CRemotePin*) malloc(sizeof(CRemotePin)); if (!This) return NULL; Debug printf("CRemotePinCreate() called -> %p\n", This); This->parent = pt; This->remote_pin = rpin; This->refcount = 1; This->vt = (IPin_vt*) malloc(sizeof(IPin_vt)); if (!This->vt) { free(This); return NULL; } memset(This->vt, 0, sizeof(IPin_vt)); This->vt->QueryInterface = CRemotePin_QueryInterface; This->vt->AddRef = CRemotePin_AddRef; This->vt->Release = CRemotePin_Release; This->vt->QueryDirection = CRemotePin_QueryDirection; This->vt->ConnectedTo = CRemotePin_ConnectedTo; This->vt->ConnectionMediaType = CRemotePin_ConnectionMediaType; This->vt->QueryPinInfo = CRemotePin_QueryPinInfo; This->interfaces[0] = IID_IUnknown; return This; } /************* * CRemotePin2 *************/ static long STDCALL CRemotePin2_QueryPinInfo(IPin* This, /* [out] */ PIN_INFO* pInfo) { CBaseFilter2* lparent=((CRemotePin2*)This)->parent; Debug printf("CRemotePin2_QueryPinInfo(%p) called\n", This); pInfo->pFilter=(IBaseFilter*)lparent; lparent->vt->AddRef((IUnknown*)lparent); pInfo->dir=PINDIR_OUTPUT; pInfo->achName[0]=0; return 0; } // FIXME - not being released! static void CRemotePin2_Destroy(CRemotePin2* This) { Debug printf("CRemotePin2_Destroy(%p) called\n", This); free(This->vt); free(This); } IMPLEMENT_IUNKNOWN(CRemotePin2) CRemotePin2* CRemotePin2Create(CBaseFilter2* p) { CRemotePin2* This = (CRemotePin2*) malloc(sizeof(CRemotePin2)); if (!This) return NULL; Debug printf("CRemotePin2Create() called -> %p\n", This); This->parent = p; This->refcount = 1; This->vt = (IPin_vt*) malloc(sizeof(IPin_vt)); if (!This->vt) { free(This); return NULL; } memset(This->vt, 0, sizeof(IPin_vt)); This->vt->QueryInterface = CRemotePin2_QueryInterface; This->vt->AddRef = CRemotePin2_AddRef; This->vt->Release = CRemotePin2_Release; This->vt->QueryPinInfo = CRemotePin2_QueryPinInfo; This->interfaces[0] = IID_IUnknown; return This; } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dshow/inputpin.h0000644000175000017500000000247707560320255023502 0ustar yavoryavor#ifndef DS_INPUTPIN_H #define DS_INPUTPIN_H #include "interfaces.h" typedef struct _CBaseFilter2 CBaseFilter2; struct _CBaseFilter2 { IBaseFilter_vt* vt; DECLARE_IUNKNOWN(); IPin* pin; GUID interfaces[5]; IPin* ( *GetPin )(CBaseFilter2* This); }; CBaseFilter2* CBaseFilter2Create(void); typedef struct _CBaseFilter CBaseFilter; struct _CBaseFilter { IBaseFilter_vt* vt; DECLARE_IUNKNOWN(); // has to match CBaseFilter2 - INHERITANCE!! IPin* pin; IPin* unused_pin; GUID interfaces[2]; IPin* ( *GetPin )(CBaseFilter* This); IPin* ( *GetUnusedPin )(CBaseFilter* This); }; CBaseFilter* CBaseFilterCreate(const AM_MEDIA_TYPE* vhdr, CBaseFilter2* parent); typedef struct { IPin_vt* vt; DECLARE_IUNKNOWN(); CBaseFilter* parent; AM_MEDIA_TYPE type; GUID interfaces[1]; } CInputPin; CInputPin* CInputPinCreate(CBaseFilter* parent, const AM_MEDIA_TYPE* vhdr); typedef struct { IPin_vt* vt; DECLARE_IUNKNOWN(); CBaseFilter* parent; GUID interfaces[1]; IPin* remote_pin; } CRemotePin; CRemotePin* CRemotePinCreate(CBaseFilter* pt, IPin* rpin); typedef struct { IPin_vt* vt; DECLARE_IUNKNOWN(); CBaseFilter2* parent; GUID interfaces[1]; } CRemotePin2; CRemotePin2* CRemotePin2Create(CBaseFilter2* parent); #endif /* DS_INPUTPIN_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dshow/interfaces.h0000644000175000017500000003070307540130610023740 0ustar yavoryavor#ifndef DS_INTERFACES_H #define DS_INTERFACES_H /* * Definition of important DirectShow interfaces. * Created using freely-available DirectX 8.0 SDK * ( http://msdn.microsoft.com ) */ #include "iunk.h" #include "com.h" /* Sh*t. MSVC++ and g++ use different methods of storing vtables. */ typedef struct _IReferenceClock IReferenceClock; typedef struct _IFilterGraph IFilterGraph; typedef struct _IBaseFilter IBaseFilter; typedef enum { PINDIR_INPUT = 0, PINDIR_OUTPUT } PIN_DIRECTION; typedef struct _PinInfo { IBaseFilter* pFilter; PIN_DIRECTION dir; unsigned short achName[128]; } PIN_INFO; typedef struct _AllocatorProperties { long cBuffers; long cbBuffer; long cbAlign; long cbPrefix; } ALLOCATOR_PROPERTIES; typedef struct _IEnumMediaTypes IEnumMediaTypes; typedef struct IEnumMediaTypes_vt { INHERIT_IUNKNOWN(); HRESULT STDCALL ( *Next )(IEnumMediaTypes* This, /* [in] */ unsigned long cMediaTypes, /* [size_is][out] */ AM_MEDIA_TYPE** ppMediaTypes, /* [out] */ unsigned long* pcFetched); HRESULT STDCALL ( *Skip )(IEnumMediaTypes* This, /* [in] */ unsigned long cMediaTypes); HRESULT STDCALL ( *Reset )(IEnumMediaTypes* This); HRESULT STDCALL ( *Clone )(IEnumMediaTypes* This, /* [out] */ IEnumMediaTypes** ppEnum); } IEnumMediaTypes_vt; struct _IEnumMediaTypes { IEnumMediaTypes_vt* vt; }; typedef struct _IPin IPin; typedef struct IPin_vt { INHERIT_IUNKNOWN(); HRESULT STDCALL ( *Connect )(IPin * This, /* [in] */ IPin *pReceivePin, /* [in] */ /*const*/ AM_MEDIA_TYPE *pmt); HRESULT STDCALL ( *ReceiveConnection )(IPin * This, /* [in] */ IPin *pConnector, /* [in] */ const AM_MEDIA_TYPE *pmt); HRESULT STDCALL ( *Disconnect )(IPin * This); HRESULT STDCALL ( *ConnectedTo )(IPin * This, /* [out] */ IPin **pPin); HRESULT STDCALL ( *ConnectionMediaType )(IPin * This, /* [out] */ AM_MEDIA_TYPE *pmt); HRESULT STDCALL ( *QueryPinInfo )(IPin * This, /* [out] */ PIN_INFO *pInfo); HRESULT STDCALL ( *QueryDirection )(IPin * This, /* [out] */ PIN_DIRECTION *pPinDir); HRESULT STDCALL ( *QueryId )(IPin * This, /* [out] */ unsigned short* *Id); HRESULT STDCALL ( *QueryAccept )(IPin * This, /* [in] */ const AM_MEDIA_TYPE *pmt); HRESULT STDCALL ( *EnumMediaTypes )(IPin * This, /* [out] */ IEnumMediaTypes **ppEnum); HRESULT STDCALL ( *QueryInternalConnections )(IPin * This, /* [out] */ IPin **apPin, /* [out][in] */ unsigned long *nPin); HRESULT STDCALL ( *EndOfStream )(IPin * This); HRESULT STDCALL ( *BeginFlush )(IPin * This); HRESULT STDCALL ( *EndFlush )(IPin * This); HRESULT STDCALL ( *NewSegment )(IPin * This, /* [in] */ REFERENCE_TIME tStart, /* [in] */ REFERENCE_TIME tStop, /* [in] */ double dRate); } IPin_vt; struct _IPin { IPin_vt *vt; }; typedef struct _IEnumPins IEnumPins; typedef struct IEnumPins_vt { INHERIT_IUNKNOWN(); // retrieves a specified number of pins in the enumeration sequence.. HRESULT STDCALL ( *Next )(IEnumPins* This, /* [in] */ unsigned long cPins, /* [size_is][out] */ IPin** ppPins, /* [out] */ unsigned long* pcFetched); // skips over a specified number of pins. HRESULT STDCALL ( *Skip )(IEnumPins* This, /* [in] */ unsigned long cPins); // resets the enumeration sequence to the beginning. HRESULT STDCALL ( *Reset )(IEnumPins* This); // makes a copy of the enumerator with the same enumeration state. HRESULT STDCALL ( *Clone )(IEnumPins* This, /* [out] */ IEnumPins** ppEnum); } IEnumPins_vt; struct _IEnumPins { struct IEnumPins_vt* vt; }; typedef struct _IMediaSample IMediaSample; typedef struct IMediaSample_vt { INHERIT_IUNKNOWN(); HRESULT STDCALL ( *GetPointer )(IMediaSample* This, /* [out] */ unsigned char** ppBuffer); LONG STDCALL ( *GetSize )(IMediaSample* This); HRESULT STDCALL ( *GetTime )(IMediaSample* This, /* [out] */ REFERENCE_TIME* pTimeStart, /* [out] */ REFERENCE_TIME* pTimeEnd); HRESULT STDCALL ( *SetTime )(IMediaSample* This, /* [in] */ REFERENCE_TIME* pTimeStart, /* [in] */ REFERENCE_TIME* pTimeEnd); // sync-point property. If true, then the beginning of this // sample is a sync-point. (note that if AM_MEDIA_TYPE.bTemporalCompression // is false then all samples are sync points). A filter can start // a stream at any sync point. S_FALSE if not sync-point, S_OK if true. HRESULT STDCALL ( *IsSyncPoint )(IMediaSample* This); HRESULT STDCALL ( *SetSyncPoint )(IMediaSample* This, long bIsSyncPoint); // preroll property. If true, this sample is for preroll only and // shouldn't be displayed. HRESULT STDCALL ( *IsPreroll )(IMediaSample* This); HRESULT STDCALL ( *SetPreroll )(IMediaSample* This, long bIsPreroll); LONG STDCALL ( *GetActualDataLength )(IMediaSample* This); HRESULT STDCALL ( *SetActualDataLength )(IMediaSample* This, long __MIDL_0010); // these allow for limited format changes in band - if no format change // has been made when you receive a sample GetMediaType will return S_FALSE HRESULT STDCALL ( *GetMediaType )(IMediaSample* This, AM_MEDIA_TYPE** ppMediaType); HRESULT STDCALL ( *SetMediaType )(IMediaSample* This, AM_MEDIA_TYPE* pMediaType); // returns S_OK if there is a discontinuity in the data (this frame is // not a continuation of the previous stream of data // - there has been a seek or some dropped samples). HRESULT STDCALL ( *IsDiscontinuity )(IMediaSample* This); HRESULT STDCALL ( *SetDiscontinuity )(IMediaSample* This, long bDiscontinuity); // get the media times for this sample HRESULT STDCALL ( *GetMediaTime )(IMediaSample* This, /* [out] */ long long* pTimeStart, /* [out] */ long long* pTimeEnd); // Set the media times for this sample // pTimeStart==pTimeEnd==NULL will invalidate the media time stamps in // this sample HRESULT STDCALL ( *SetMediaTime )(IMediaSample* This, /* [in] */ long long* pTimeStart, /* [in] */ long long* pTimeEnd); } IMediaSample_vt; struct _IMediaSample { struct IMediaSample_vt* vt; }; //typedef struct _IBaseFilter IBaseFilter; typedef struct IBaseFilter_vt { INHERIT_IUNKNOWN(); HRESULT STDCALL ( *GetClassID )(IBaseFilter * This, /* [out] */ CLSID *pClassID); HRESULT STDCALL ( *Stop )(IBaseFilter * This); HRESULT STDCALL ( *Pause )(IBaseFilter * This); HRESULT STDCALL ( *Run )(IBaseFilter * This, REFERENCE_TIME tStart); HRESULT STDCALL ( *GetState )(IBaseFilter * This, /* [in] */ unsigned long dwMilliSecsTimeout, ///* [out] */ FILTER_STATE *State); void* State); HRESULT STDCALL ( *SetSyncSource )(IBaseFilter* This, /* [in] */ IReferenceClock *pClock); HRESULT STDCALL ( *GetSyncSource )(IBaseFilter* This, /* [out] */ IReferenceClock **pClock); HRESULT STDCALL ( *EnumPins )(IBaseFilter* This, /* [out] */ IEnumPins **ppEnum); HRESULT STDCALL ( *FindPin )(IBaseFilter* This, /* [string][in] */ const unsigned short* Id, /* [out] */ IPin** ppPin); HRESULT STDCALL ( *QueryFilterInfo )(IBaseFilter* This, // /* [out] */ FILTER_INFO *pInfo); void* pInfo); HRESULT STDCALL ( *JoinFilterGraph )(IBaseFilter* This, /* [in] */ IFilterGraph* pGraph, /* [string][in] */ const unsigned short* pName); HRESULT STDCALL ( *QueryVendorInfo )(IBaseFilter* This, /* [string][out] */ unsigned short** pVendorInfo); } IBaseFilter_vt; struct _IBaseFilter { struct IBaseFilter_vt* vt; }; typedef struct _IMemAllocator IMemAllocator; typedef struct IMemAllocator_vt { INHERIT_IUNKNOWN(); // specifies the number of buffers to allocate and the size of each buffer. HRESULT STDCALL ( *SetProperties )(IMemAllocator* This, /* [in] */ ALLOCATOR_PROPERTIES *pRequest, /* [out] */ ALLOCATOR_PROPERTIES *pActual); // retrieves the number of buffers that the allocator will create, and the buffer properties. HRESULT STDCALL ( *GetProperties )(IMemAllocator* This, /* [out] */ ALLOCATOR_PROPERTIES *pProps); // allocates the buffer memory. HRESULT STDCALL ( *Commit )(IMemAllocator* This); // releases the memory for the buffers. HRESULT STDCALL ( *Decommit )(IMemAllocator* This); // retrieves a media sample that contains an empty buffer. HRESULT STDCALL ( *GetBuffer )(IMemAllocator* This, /* [out] */ IMediaSample** ppBuffer, /* [in] */ REFERENCE_TIME* pStartTime, /* [in] */ REFERENCE_TIME* pEndTime, /* [in] */ unsigned long dwFlags); // releases a media sample. HRESULT STDCALL ( *ReleaseBuffer )(IMemAllocator* This, /* [in] */ IMediaSample* pBuffer); } IMemAllocator_vt; struct _IMemAllocator { IMemAllocator_vt* vt; }; typedef struct _IMemInputPin IMemInputPin; typedef struct IMemInputPin_vt { INHERIT_IUNKNOWN(); HRESULT STDCALL ( *GetAllocator )(IMemInputPin * This, /* [out] */ IMemAllocator **ppAllocator); HRESULT STDCALL ( *NotifyAllocator )(IMemInputPin * This, /* [in] */ IMemAllocator *pAllocator, /* [in] */ int bReadOnly); HRESULT STDCALL ( *GetAllocatorRequirements )(IMemInputPin * This, /* [out] */ ALLOCATOR_PROPERTIES *pProps); HRESULT STDCALL ( *Receive )(IMemInputPin * This, /* [in] */ IMediaSample *pSample); HRESULT STDCALL ( *ReceiveMultiple )(IMemInputPin * This, /* [size_is][in] */ IMediaSample **pSamples, /* [in] */ long nSamples, /* [out] */ long *nSamplesProcessed); HRESULT STDCALL ( *ReceiveCanBlock )(IMemInputPin * This); } IMemInputPin_vt; struct _IMemInputPin { IMemInputPin_vt* vt; }; typedef struct _IHidden IHidden; typedef struct IHidden_vt { INHERIT_IUNKNOWN(); HRESULT STDCALL ( *GetSmth )(IHidden* This, int* pv); HRESULT STDCALL ( *SetSmth )(IHidden* This, int v1, int v2); HRESULT STDCALL ( *GetSmth2 )(IHidden* This, int* pv); HRESULT STDCALL ( *SetSmth2 )(IHidden* This, int v1, int v2); HRESULT STDCALL ( *GetSmth3 )(IHidden* This, int* pv); HRESULT STDCALL ( *SetSmth3 )(IHidden* This, int v1, int v2); HRESULT STDCALL ( *GetSmth4 )(IHidden* This, int* pv); HRESULT STDCALL ( *SetSmth4 )(IHidden* This, int v1, int v2); HRESULT STDCALL ( *GetSmth5 )(IHidden* This, int* pv); HRESULT STDCALL ( *SetSmth5 )(IHidden* This, int v1, int v2); HRESULT STDCALL ( *GetSmth6 )(IHidden* This, int* pv); } IHidden_vt; struct _IHidden { struct IHidden_vt* vt; }; typedef struct _IHidden2 IHidden2; typedef struct IHidden2_vt { INHERIT_IUNKNOWN(); HRESULT STDCALL ( *unk1 )(void); HRESULT STDCALL ( *unk2 )(void); HRESULT STDCALL ( *unk3 )(void); HRESULT STDCALL ( *DecodeGet )(IHidden2* This, int* region); HRESULT STDCALL ( *unk5 )(void); HRESULT STDCALL ( *DecodeSet )(IHidden2* This, int* region); HRESULT STDCALL ( *unk7 )(void); HRESULT STDCALL ( *unk8 )(void); } IHidden2_vt; struct _IHidden2 { struct IHidden2_vt* vt; }; // fixme typedef struct IDivxFilterInterface { struct IDivxFilterInterface_vt* vt; } IDivxFilterInterface; struct IDivxFilterInterface_vt { INHERIT_IUNKNOWN(); HRESULT STDCALL ( *get_PPLevel )(IDivxFilterInterface* This, int* PPLevel); // current postprocessing level HRESULT STDCALL ( *put_PPLevel )(IDivxFilterInterface* This, int PPLevel); // new postprocessing level HRESULT STDCALL ( *put_DefaultPPLevel )(IDivxFilterInterface* This); HRESULT STDCALL ( *put_MaxDelayAllowed )(IDivxFilterInterface* This, int maxdelayallowed); HRESULT STDCALL ( *put_Brightness )(IDivxFilterInterface* This, int brightness); HRESULT STDCALL ( *put_Contrast )(IDivxFilterInterface* This, int contrast); HRESULT STDCALL ( *put_Saturation )(IDivxFilterInterface* This, int saturation); HRESULT STDCALL ( *get_MaxDelayAllowed )(IDivxFilterInterface* This, int* maxdelayallowed); HRESULT STDCALL ( *get_Brightness)(IDivxFilterInterface* This, int* brightness); HRESULT STDCALL ( *get_Contrast)(IDivxFilterInterface* This, int* contrast); HRESULT STDCALL ( *get_Saturation )(IDivxFilterInterface* This, int* saturation); HRESULT STDCALL ( *put_AspectRatio )(IDivxFilterInterface* This, int x, IDivxFilterInterface* Thisit, int y); HRESULT STDCALL ( *get_AspectRatio )(IDivxFilterInterface* This, int* x, IDivxFilterInterface* Thisit, int* y); }; #endif /* DS_INTERFACES_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dshow/iunk.h0000644000175000017500000000311407571667366022612 0ustar yavoryavor#ifndef DS_IUNK_H #define DS_IUNK_H #include "guids.h" #define INHERIT_IUNKNOWN() \ long STDCALL ( *QueryInterface )(IUnknown * This, const GUID* riid, void **ppvObject); \ long STDCALL ( *AddRef )(IUnknown * This); \ long STDCALL ( *Release )(IUnknown * This); #define DECLARE_IUNKNOWN() \ int refcount; #define IMPLEMENT_IUNKNOWN(CLASSNAME) \ static long STDCALL CLASSNAME ## _QueryInterface(IUnknown * This, \ const GUID* riid, void **ppvObject) \ { \ CLASSNAME * me = (CLASSNAME *)This; \ const GUID* r; unsigned int i = 0; \ Debug printf(#CLASSNAME "_QueryInterface(%p) called\n", This);\ if (!ppvObject) return E_POINTER; \ for(r=me->interfaces; iinterfaces)/sizeof(me->interfaces[0]); r++, i++) \ if(!memcmp(r, riid, sizeof(*r))) \ { \ me->vt->AddRef((IUnknown*)This); \ *ppvObject=This; \ return 0; \ } \ Debug printf("Query failed! (GUID: 0x%x)\n", *(const unsigned int*)riid); \ return E_NOINTERFACE; \ } \ \ static long STDCALL CLASSNAME ## _AddRef(IUnknown * This) \ { \ CLASSNAME * me=( CLASSNAME *)This; \ Debug printf(#CLASSNAME "_AddRef(%p) called (ref:%d)\n", This, me->refcount); \ return ++(me->refcount); \ } \ \ static long STDCALL CLASSNAME ## _Release(IUnknown * This) \ { \ CLASSNAME* me=( CLASSNAME *)This; \ Debug printf(#CLASSNAME "_Release(%p) called (new ref:%d)\n", This, me->refcount - 1); \ if(--(me->refcount) == 0) \ CLASSNAME ## _Destroy(me); \ return 0; \ } #endif /* DS_IUNK_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dshow/outputpin.c0000644000175000017500000003605007560320255023670 0ustar yavoryavor #include "wine/winerror.h" #include "wine/windef.h" #include "outputpin.h" #include #include #include /* An object beyond interface IEnumMediaTypes. Returned by COutputPin through call IPin::EnumMediaTypes(). */ static inline int output_unimplemented(const char* s, void* p) { Debug printf("%s(%p) called (UNIMPLEMENTED)", s, p); return E_NOTIMPL; } typedef struct CEnumMediaTypes { IEnumMediaTypes_vt* vt; DECLARE_IUNKNOWN(); AM_MEDIA_TYPE type; GUID interfaces[2]; } CEnumMediaTypes; struct _COutputMemPin { IMemInputPin_vt* vt; DECLARE_IUNKNOWN(); char** frame_pointer; long* frame_size_pointer; MemAllocator* pAllocator; COutputPin* parent; }; static HRESULT STDCALL CEnumMediaTypes_Next(IEnumMediaTypes * This, /* [in] */ ULONG cMediaTypes, /* [size_is][out] */ AM_MEDIA_TYPE **ppMediaTypes, /* [out] */ ULONG *pcFetched) { AM_MEDIA_TYPE* type = &((CEnumMediaTypes*)This)->type; Debug printf("CEnumMediaTypes::Next(%p) called\n", This); if (!ppMediaTypes) return E_INVALIDARG; if (!pcFetched && (cMediaTypes!=1)) return E_INVALIDARG; if (cMediaTypes <= 0) return 0; if (pcFetched) *pcFetched=1; ppMediaTypes[0] = (AM_MEDIA_TYPE *)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); // copy structures - C can handle this... **ppMediaTypes = *type; if (ppMediaTypes[0]->pbFormat) { ppMediaTypes[0]->pbFormat=(char *)CoTaskMemAlloc(ppMediaTypes[0]->cbFormat); memcpy(ppMediaTypes[0]->pbFormat, type->pbFormat, ppMediaTypes[0]->cbFormat); } if (cMediaTypes == 1) return 0; return 1; } /* I expect that these methods are unused. */ static HRESULT STDCALL CEnumMediaTypes_Skip(IEnumMediaTypes * This, /* [in] */ ULONG cMediaTypes) { return output_unimplemented("CEnumMediaTypes::Skip", This); } static HRESULT STDCALL CEnumMediaTypes_Reset(IEnumMediaTypes * This) { Debug printf("CEnumMediaTypes::Reset(%p) called\n", This); return 0; } static HRESULT STDCALL CEnumMediaTypes_Clone(IEnumMediaTypes * This, /* [out] */ IEnumMediaTypes **ppEnum) { Debug printf("CEnumMediaTypes::Clone(%p) called\n", This); return E_NOTIMPL; } static void CEnumMediaTypes_Destroy(CEnumMediaTypes* This) { free(This->vt); free(This); } // IPin->IUnknown methods IMPLEMENT_IUNKNOWN(CEnumMediaTypes) static CEnumMediaTypes* CEnumMediaTypesCreate(const AM_MEDIA_TYPE* amt) { CEnumMediaTypes *This = (CEnumMediaTypes*) malloc(sizeof(CEnumMediaTypes)) ; if (!This) return NULL; This->vt = (IEnumMediaTypes_vt*) malloc(sizeof(IEnumMediaTypes_vt)); if (!This->vt) { free(This); return NULL; } This->refcount = 1; This->type = *amt; This->vt->QueryInterface = CEnumMediaTypes_QueryInterface; This->vt->AddRef = CEnumMediaTypes_AddRef; This->vt->Release = CEnumMediaTypes_Release; This->vt->Next = CEnumMediaTypes_Next; This->vt->Skip = CEnumMediaTypes_Skip; This->vt->Reset = CEnumMediaTypes_Reset; This->vt->Clone = CEnumMediaTypes_Clone; This->interfaces[0] = IID_IUnknown; This->interfaces[1] = IID_IEnumMediaTypes; return This; } /************* * COutputPin *************/ static HRESULT STDCALL COutputPin_QueryInterface(IUnknown* This, const GUID* iid, void** ppv) { COutputPin* p = (COutputPin*) This; Debug printf("COutputPin_QueryInterface(%p) called\n", This); if (!ppv) return E_INVALIDARG; if (memcmp(iid, &IID_IUnknown, 16) == 0) { *ppv = p; p->vt->AddRef(This); return 0; } if (memcmp(iid, &IID_IMemInputPin, 16) == 0) { *ppv = p->mempin; p->mempin->vt->AddRef((IUnknown*)*ppv); return 0; } Debug printf("Unknown interface : %08x-%04x-%04x-%02x%02x-" "%02x%02x%02x%02x%02x%02x\n", iid->f1, iid->f2, iid->f3, (unsigned char)iid->f4[1], (unsigned char)iid->f4[0], (unsigned char)iid->f4[2], (unsigned char)iid->f4[3], (unsigned char)iid->f4[4], (unsigned char)iid->f4[5], (unsigned char)iid->f4[6], (unsigned char)iid->f4[7]); return E_NOINTERFACE; } // IPin methods static HRESULT STDCALL COutputPin_Connect(IPin * This, /* [in] */ IPin *pReceivePin, /* [in] */ /* const */ AM_MEDIA_TYPE *pmt) { Debug printf("COutputPin_Connect() called\n"); /* *pmt=((COutputPin*)This)->type; if(pmt->cbFormat>0) { pmt->pbFormat=CoTaskMemAlloc(pmt->cbFormat); memcpy(pmt->pbFormat, ((COutputPin*)This)->type.pbFormat, pmt->cbFormat); } */ //return E_NOTIMPL; return 0;// XXXXXXXXXXXXX CHECKME XXXXXXXXXXXXXXX // if I put return 0; here, it crashes } static HRESULT STDCALL COutputPin_ReceiveConnection(IPin * This, /* [in] */ IPin *pConnector, /* [in] */ const AM_MEDIA_TYPE *pmt) { Debug printf("COutputPin_ReceiveConnection(%p) called\n", This); ((COutputPin*)This)->remote = pConnector; return 0; } static HRESULT STDCALL COutputPin_Disconnect(IPin * This) { Debug printf("COutputPin_Disconnect(%p) called\n", This); return 1; } static HRESULT STDCALL COutputPin_ConnectedTo(IPin * This, /* [out] */ IPin **pPin) { Debug printf("COutputPin_ConnectedTo(%p) called\n", This); if (!pPin) return E_INVALIDARG; *pPin = ((COutputPin*)This)->remote; return 0; } static HRESULT STDCALL COutputPin_ConnectionMediaType(IPin * This, /* [out] */ AM_MEDIA_TYPE *pmt) { Debug printf("CInputPin::ConnectionMediaType() called\n"); if (!pmt) return E_INVALIDARG; *pmt = ((COutputPin*)This)->type; if (pmt->cbFormat>0) { pmt->pbFormat=(char *)CoTaskMemAlloc(pmt->cbFormat); memcpy(pmt->pbFormat, ((COutputPin*)This)->type.pbFormat, pmt->cbFormat); } return 0; } static HRESULT STDCALL COutputPin_QueryPinInfo(IPin * This, /* [out] */ PIN_INFO *pInfo) { return output_unimplemented("COutputPin_QueryPinInfo", This); } static HRESULT STDCALL COutputPin_QueryDirection(IPin * This, /* [out] */ PIN_DIRECTION *pPinDir) { Debug printf("COutputPin_QueryDirection(%p) called\n", This); if (!pPinDir) return E_INVALIDARG; *pPinDir = PINDIR_INPUT; return 0; } static HRESULT STDCALL COutputPin_QueryId(IPin * This, /* [out] */ LPWSTR *Id) { return output_unimplemented("COutputPin_QueryId", This); } static HRESULT STDCALL COutputPin_QueryAccept(IPin * This, /* [in] */ const AM_MEDIA_TYPE *pmt) { return output_unimplemented("COutputPin_QueryAccept", This); } static HRESULT STDCALL COutputPin_EnumMediaTypes(IPin * This, /* [out] */ IEnumMediaTypes **ppEnum) { Debug printf("COutputPin_EnumMediaTypes() called\n"); if (!ppEnum) return E_INVALIDARG; *ppEnum = (IEnumMediaTypes*) CEnumMediaTypesCreate(&((COutputPin*)This)->type); return 0; } static HRESULT STDCALL COutputPin_QueryInternalConnections(IPin * This, /* [out] */ IPin **apPin, /* [out][in] */ ULONG *nPin) { return output_unimplemented("COutputPin_QueryInternalConnections", This); } static HRESULT STDCALL COutputPin_EndOfStream(IPin * This) { return output_unimplemented("COutputPin_EndOfStream", This); } static HRESULT STDCALL COutputPin_BeginFlush(IPin * This) { return output_unimplemented("COutputPin_BeginFlush", This); } static HRESULT STDCALL COutputPin_EndFlush(IPin * This) { return output_unimplemented("COutputPin_EndFlush", This); } static HRESULT STDCALL COutputPin_NewSegment(IPin * This, /* [in] */ REFERENCE_TIME tStart, /* [in] */ REFERENCE_TIME tStop, /* [in] */ double dRate) { Debug printf("COutputPin_NewSegment(%Ld,%Ld,%f) called\n", tStart, tStop, dRate); return 0; } // IMemInputPin->IUnknown methods static HRESULT STDCALL COutputPin_M_QueryInterface(IUnknown* This, const GUID* iid, void** ppv) { COutputPin* p = (COutputPin*)This; Debug printf("COutputPin_M_QueryInterface(%p) called\n", This); if (!ppv) return E_INVALIDARG; if(!memcmp(iid, &IID_IUnknown, 16)) { *ppv = p; p->vt->AddRef(This); return 0; } /*if(!memcmp(iid, &IID_IPin, 16)) { COutputPin* ptr=(COutputPin*)(This-1); *ppv=(void*)ptr; AddRef((IUnknown*)ptr); return 0; }*/ if(!memcmp(iid, &IID_IMemInputPin, 16)) { *ppv = p->mempin; p->mempin->vt->AddRef(This); return 0; } Debug printf("Unknown interface : %08x-%04x-%04x-%02x%02x-" \ "%02x%02x%02x%02x%02x%02x\n", iid->f1, iid->f2, iid->f3, (unsigned char)iid->f4[1], (unsigned char)iid->f4[0], (unsigned char)iid->f4[2], (unsigned char)iid->f4[3], (unsigned char)iid->f4[4], (unsigned char)iid->f4[5], (unsigned char)iid->f4[6], (unsigned char)iid->f4[7]); return E_NOINTERFACE; } // IMemInputPin methods static HRESULT STDCALL COutputPin_GetAllocator(IMemInputPin* This, /* [out] */ IMemAllocator** ppAllocator) { Debug printf("COutputPin_GetAllocator(%p, %p) called\n", This->vt, ppAllocator); *ppAllocator = (IMemAllocator*) MemAllocatorCreate(); return 0; } static HRESULT STDCALL COutputPin_NotifyAllocator(IMemInputPin* This, /* [in] */ IMemAllocator* pAllocator, /* [in] */ int bReadOnly) { Debug printf("COutputPin_NotifyAllocator(%p, %p) called\n", This, pAllocator); ((COutputMemPin*)This)->pAllocator = (MemAllocator*) pAllocator; return 0; } static HRESULT STDCALL COutputPin_GetAllocatorRequirements(IMemInputPin* This, /* [out] */ ALLOCATOR_PROPERTIES* pProps) { return output_unimplemented("COutputPin_GetAllocatorRequirements", This); } static HRESULT STDCALL COutputPin_Receive(IMemInputPin* This, /* [in] */ IMediaSample* pSample) { COutputMemPin* mp = (COutputMemPin*)This; char* pointer; int len; Debug printf("COutputPin_Receive(%p) called\n", This); if (!pSample) return E_INVALIDARG; if (pSample->vt->GetPointer(pSample, (BYTE**) &pointer)) return -1; len = pSample->vt->GetActualDataLength(pSample); if (len == 0) len = pSample->vt->GetSize(pSample);//for iv50 //if(me.frame_pointer)memcpy(me.frame_pointer, pointer, len); if (mp->frame_pointer) *(mp->frame_pointer) = pointer; if (mp->frame_size_pointer) *(mp->frame_size_pointer) = len; /* FILE* file=fopen("./uncompr.bmp", "wb"); char head[14]={0x42, 0x4D, 0x36, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00}; *(int*)(&head[2])=len+0x36; fwrite(head, 14, 1, file); fwrite(&((VIDEOINFOHEADER*)me.type.pbFormat)->bmiHeader, sizeof(BITMAPINFOHEADER), 1, file); fwrite(pointer, len, 1, file); fclose(file); */ // pSample->vt->Release((IUnknown*)pSample); return 0; } static HRESULT STDCALL COutputPin_ReceiveMultiple(IMemInputPin * This, /* [size_is][in] */ IMediaSample **pSamples, /* [in] */ long nSamples, /* [out] */ long *nSamplesProcessed) { return output_unimplemented("COutputPin_ReceiveMultiple", This); } static HRESULT STDCALL COutputPin_ReceiveCanBlock(IMemInputPin * This) { return output_unimplemented("COutputPin_ReceiveCanBlock", This); } static void COutputPin_SetFramePointer(COutputPin* This, char** z) { This->mempin->frame_pointer = z; } static void COutputPin_SetPointer2(COutputPin* This, char* p) { if (This->mempin->pAllocator) // fixme This->mempin->pAllocator->SetPointer(This->mempin->pAllocator, p); } static void COutputPin_SetFrameSizePointer(COutputPin* This, long* z) { This->mempin->frame_size_pointer = z; } static void COutputPin_SetNewFormat(COutputPin* This, const AM_MEDIA_TYPE* amt) { This->type = *amt; } static void COutputPin_Destroy(COutputPin* This) { if (This->mempin->vt) free(This->mempin->vt); if (This->mempin) free(This->mempin); if (This->vt) free(This->vt); free(This); } static HRESULT STDCALL COutputPin_AddRef(IUnknown* This) { Debug printf("COutputPin_AddRef(%p) called (%d)\n", This, ((COutputPin*)This)->refcount); ((COutputPin*)This)->refcount++; return 0; } static HRESULT STDCALL COutputPin_Release(IUnknown* This) { Debug printf("COutputPin_Release(%p) called (%d)\n", This, ((COutputPin*)This)->refcount); if (--((COutputPin*)This)->refcount <= 0) COutputPin_Destroy((COutputPin*)This); return 0; } static HRESULT STDCALL COutputPin_M_AddRef(IUnknown* This) { COutputMemPin* p = (COutputMemPin*) This; Debug printf("COutputPin_MAddRef(%p) called (%p, %d)\n", p, p->parent, p->parent->refcount); p->parent->refcount++; return 0; } static HRESULT STDCALL COutputPin_M_Release(IUnknown* This) { COutputMemPin* p = (COutputMemPin*) This; Debug printf("COutputPin_MRelease(%p) called (%p, %d)\n", p, p->parent, p->parent->refcount); if (--p->parent->refcount <= 0) COutputPin_Destroy(p->parent); return 0; } COutputPin* COutputPinCreate(const AM_MEDIA_TYPE* amt) { COutputPin* This = (COutputPin*) malloc(sizeof(COutputPin)); IMemInputPin_vt* ivt; if (!This) return NULL; This->vt = (IPin_vt*) malloc(sizeof(IPin_vt)); This->mempin = (COutputMemPin*) malloc(sizeof(COutputMemPin)); ivt = (IMemInputPin_vt*) malloc(sizeof(IMemInputPin_vt)); if (!This->vt || !This->mempin || !ivt) { COutputPin_Destroy(This); return NULL; } This->mempin->vt = ivt; This->refcount = 1; This->remote = 0; This->type = *amt; This->vt->QueryInterface = COutputPin_QueryInterface; This->vt->AddRef = COutputPin_AddRef; This->vt->Release = COutputPin_Release; This->vt->Connect = COutputPin_Connect; This->vt->ReceiveConnection = COutputPin_ReceiveConnection; This->vt->Disconnect = COutputPin_Disconnect; This->vt->ConnectedTo = COutputPin_ConnectedTo; This->vt->ConnectionMediaType = COutputPin_ConnectionMediaType; This->vt->QueryPinInfo = COutputPin_QueryPinInfo; This->vt->QueryDirection = COutputPin_QueryDirection; This->vt->QueryId = COutputPin_QueryId; This->vt->QueryAccept = COutputPin_QueryAccept; This->vt->EnumMediaTypes = COutputPin_EnumMediaTypes; This->vt->QueryInternalConnections = COutputPin_QueryInternalConnections; This->vt->EndOfStream = COutputPin_EndOfStream; This->vt->BeginFlush = COutputPin_BeginFlush; This->vt->EndFlush = COutputPin_EndFlush; This->vt->NewSegment = COutputPin_NewSegment; This->mempin->vt->QueryInterface = COutputPin_M_QueryInterface; This->mempin->vt->AddRef = COutputPin_M_AddRef; This->mempin->vt->Release = COutputPin_M_Release; This->mempin->vt->GetAllocator = COutputPin_GetAllocator; This->mempin->vt->NotifyAllocator = COutputPin_NotifyAllocator; This->mempin->vt->GetAllocatorRequirements = COutputPin_GetAllocatorRequirements; This->mempin->vt->Receive = COutputPin_Receive; This->mempin->vt->ReceiveMultiple = COutputPin_ReceiveMultiple; This->mempin->vt->ReceiveCanBlock = COutputPin_ReceiveCanBlock; This->mempin->frame_size_pointer = 0; This->mempin->frame_pointer = 0; This->mempin->pAllocator = 0; This->mempin->refcount = 1; This->mempin->parent = This; This->SetPointer2 = COutputPin_SetPointer2; This->SetFramePointer = COutputPin_SetFramePointer; This->SetFrameSizePointer = COutputPin_SetFrameSizePointer; This->SetNewFormat = COutputPin_SetNewFormat; return This; } avifile-0.7.48~20090503.ds/plugins/libwin32/loader/dshow/outputpin.h0000644000175000017500000000123307537720700023673 0ustar yavoryavor#ifndef DS_OUTPUTPIN_H #define DS_OUTPUTPIN_H /* "output pin" - the one that connects to output of filter. */ #include "allocator.h" typedef struct _COutputMemPin COutputMemPin; typedef struct _COutputPin COutputPin; struct _COutputPin { IPin_vt* vt; DECLARE_IUNKNOWN(); COutputMemPin* mempin; AM_MEDIA_TYPE type; IPin* remote; void ( *SetFramePointer )(COutputPin*, char** z); void ( *SetPointer2 )(COutputPin*, char* p); void ( *SetFrameSizePointer )(COutputPin*, long* z); void ( *SetNewFormat )(COutputPin*, const AM_MEDIA_TYPE* a); }; COutputPin* COutputPinCreate(const AM_MEDIA_TYPE* vhdr); #endif /* DS_OUTPUTPIN_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/videocodec/0000755000175000017500000000000011267646347021177 5ustar yavoryavoravifile-0.7.48~20090503.ds/plugins/libwin32/videocodec/DMO_VideoDecoder.cpp0000644000175000017500000003065511171057001024720 0ustar yavoryavor/** * DMO Video decoder implementation * Copyright 2002 Zdenek Kabelac (kabi@users.sf.net) * Eugene Kuznetsov (divx@euro.ru) */ #include "dshow/guids.h" #include "dshow/interfaces.h" #include "avm_output.h" #include "DMO_VideoDecoder.h" #include "ldt_keeper.h" #include "configfile.h" #include "avm_cpuinfo.h" #include "wine/winerror.h" #include "wine/windef.h" #include "wine/winreg.h" #include "wine/vfw.h" #include "registry.h" #ifndef NOAVIFILE_HEADERS #define VFW_E_NOT_RUNNING 0x80040226 #include "avm_fourcc.h" #endif #include #include #include #include #include #include #include // labs extern "C" void trapbug(); AVM_BEGIN_NAMESPACE; static const struct fcc2gc_s { fourcc_t fcc; unsigned int bits; GUID subtype; DMO_VideoDecoder::CAPS cap; } fcc2gctab[] = { { fccI420, 12, MEDIASUBTYPE_I420, IVideoDecoder::CAP_I420 }, { fccYV12, 12, MEDIASUBTYPE_YV12, IVideoDecoder::CAP_YV12 }, { fccYUY2, 16, MEDIASUBTYPE_YUY2, IVideoDecoder::CAP_YUY2 }, { fccUYVY, 16, MEDIASUBTYPE_UYVY, IVideoDecoder::CAP_UYVY }, { fccYVYU, 16, MEDIASUBTYPE_YVYU, IVideoDecoder::CAP_YVYU }, { fccIYUV, 24, MEDIASUBTYPE_IYUV, IVideoDecoder::CAP_IYUV }, { 8, 8, MEDIASUBTYPE_RGB8, IVideoDecoder::CAP_NONE }, { 15, 16, MEDIASUBTYPE_RGB555, IVideoDecoder::CAP_NONE }, { 16, 16, MEDIASUBTYPE_RGB565, IVideoDecoder::CAP_NONE }, { 24, 24, MEDIASUBTYPE_RGB24, IVideoDecoder::CAP_NONE }, { 32, 32, MEDIASUBTYPE_RGB32, IVideoDecoder::CAP_NONE }, { 0 }, }; static const struct fcc2gc_s* fcc2gc(uint_t fcc) { const struct fcc2gc_s* c; for (c = fcc2gctab; c->fcc; c++) if (c->fcc == fcc) return c; return 0; } DMO_VideoDecoder::DMO_VideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& format, int flip) :IVideoDecoder(info, format), m_iStatus(0), m_iLastPPMode(0), m_iLastBrightness(0), m_iLastContrast(0), m_iLastSaturation(0), m_iLastHue(0), m_bHaveUpsideDownRGB(true), m_bFlip(flip) { unsigned bihs = (m_pFormat->biSize < (int) sizeof(BITMAPINFOHEADER)) ? sizeof(BITMAPINFOHEADER) : m_pFormat->biSize; bihs = sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER) + bihs; m_pDMO_Filter = 0; //int ss = 0;for (unsigned i = 0; i < m_pFormat->biSize; i++) { ss += ((unsigned char*) m_pFormat)[i]; printf(" %2x", ((unsigned char*) m_pFormat)[i]); if (!(i%16)) printf("\n"); } //printf("\nBITMAPINFOHEADER %d %d %d\n", m_pFormat->biSize, bihs, ss); //m_Dest.SetSpace(IMG_FMT_YV12); //m_Dest = *m_pFormat; //m_Dest.biHeight = labs(m_Dest.biHeight); //m_Dest.Print(); m_sVhdr = (VIDEOINFOHEADER*) malloc(bihs); memset(m_sVhdr, 0, bihs); memcpy(&m_sVhdr->bmiHeader, m_pFormat, m_pFormat->biSize); m_sVhdr->rcSource.left = m_sVhdr->rcSource.top = 0; m_sVhdr->rcSource.right = m_sVhdr->bmiHeader.biWidth; m_sVhdr->rcSource.bottom = m_sVhdr->bmiHeader.biHeight; m_sVhdr->rcTarget = m_sVhdr->rcSource; m_sOurType.majortype = MEDIATYPE_Video; m_sOurType.subtype = MEDIATYPE_Video; m_sOurType.subtype.f1 = m_sVhdr->bmiHeader.biCompression; m_sOurType.formattype = FORMAT_VideoInfo; m_sOurType.bFixedSizeSamples = false; m_sOurType.bTemporalCompression = true; m_sOurType.pUnk = 0; m_sOurType.cbFormat = bihs; m_sOurType.pbFormat = (char*)m_sVhdr; m_sVhdr2 = (VIDEOINFOHEADER*) malloc(sizeof(VIDEOINFOHEADER) + 12); memset(m_sVhdr2, 0, sizeof(VIDEOINFOHEADER) + 12); m_sVhdr2->rcTarget = m_sVhdr->rcTarget; m_sVhdr2->rcSource = m_sVhdr->rcSource; memset(&m_sDestType, 0, sizeof(m_sDestType)); m_sDestType.majortype = MEDIATYPE_Video; m_sDestType.formattype = FORMAT_VideoInfo; m_sDestType.bFixedSizeSamples = true; m_sDestType.bTemporalCompression = false; m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); m_sDestType.pbFormat = (char*)m_sVhdr2; SetDestFmt(24, 0); //SetDestFmt(0, IMG_FMT_YV12); } // this is cruel hack to avoid problems with throws - // could anyone explain me why GNU people can't build reliable // C++ compiler int DMO_VideoDecoder::init() { const struct fcc2gc_s* c; int r; int bbc; int bic; GUID sbt; Setup_FS_Segment(); m_pDMO_Filter = DMO_FilterCreate(m_Info.dll.c_str(), &m_Info.guid, &m_sOurType, &m_sDestType); if (!m_pDMO_Filter) { AVM_WRITE("Win32 DMO video decoder", "WARNING: format not accepted!\n"); return -1; } AVM_WRITE("Win32 DMO video decoder", "opened dll: %s\n", m_Info.dll.c_str()); if (m_Dest.biHeight < 0) { r = m_pDMO_Filter->m_pMedia->vt->SetOutputType(m_pDMO_Filter->m_pMedia, 0, &m_sDestType, DMO_SET_TYPEF_TEST_ONLY); if (r) { AVM_WRITE("Win32 DMO video decoder", "WARNING: decoder does not support upside-down RGB frames!\n"); m_Dest.biHeight = -m_Dest.biHeight; m_sVhdr2->bmiHeader.biHeight = m_Dest.biHeight; m_bHaveUpsideDownRGB = false; } } m_Caps = CAP_NONE; bbc = m_sVhdr2->bmiHeader.biBitCount; bic = m_sVhdr2->bmiHeader.biCompression; sbt = m_sDestType.subtype; for (c = fcc2gctab; c->bits && (c->cap != CAP_NONE); c++) { // check only for YUV m_sVhdr2->bmiHeader.biBitCount = c->bits; m_sVhdr2->bmiHeader.biCompression = c->fcc; m_sDestType.subtype = c->subtype; r = m_pDMO_Filter->m_pMedia->vt->SetOutputType(m_pDMO_Filter->m_pMedia, 0, &m_sDestType, DMO_SET_TYPEF_TEST_ONLY); if (!r) m_Caps = (CAPS)(m_Caps | c->cap); //printf("Testing CSP err: %x %x %.4s\n", r, c->fcc, (char*)&c->fcc); } //m_Caps = CAP_YV12; m_sVhdr2->bmiHeader.biBitCount = bbc; m_sVhdr2->bmiHeader.biCompression = bic; m_sDestType.subtype = sbt; SetDirection(m_bFlip); //m_Dest.Print(); //r = m_pDMO_Filter->m_pMedia->vt->Flush(m_pDMO_Filter->m_pMedia); return 0; } DMO_VideoDecoder::~DMO_VideoDecoder() { Stop(); if (m_sVhdr) free(m_sVhdr); if (m_sVhdr2) free(m_sVhdr2); if (m_pDMO_Filter) DMO_Filter_Destroy(m_pDMO_Filter); } int DMO_VideoDecoder::Start() { if (!m_iStatus) { //AVM_WRITE("Win32 video decoder", "DSSTART %p %d\n", this, m_sVhdr2->bmiHeader.biHeight); m_iStatus = 1; Flush(); } return 0; } int DMO_VideoDecoder::Stop() { if (m_iStatus) { m_iStatus = 0; //AVM_WRITE("Win32 video decoder", "DSSTOP %p\n", this); } return 0; } int DMO_VideoDecoder::DecodeFrame(CImage* dest, const void* src, size_t size, int is_keyframe, bool render, CImage** pOut) { unsigned long status; // to be ignored by M$ specs DMO_OUTPUT_DATA_BUFFER db; CMediaBuffer* bufferin; uint8_t* imdata = dest ? dest->Data() : 0; if (!m_iStatus) { AVM_WRITE("Win32 DMO video decoder", "not started!\n"); return -1; } Setup_FS_Segment(); //if (!dest->IsFmt(&m_Dest)) { dest->GetFmt()->Print(); m_Dest.Print(); printf("\n\nERRRRRRRRR\n\n"); } //unsigned long dwf = 0; //int rr1 = m_pDMO_Filter->m_pMedia->vt->GetInputStatus(m_pDMO_Filter->m_pMedia, 0, &dwf); //printf("PROCESSTESTINPUT %d %x\n", rr1, dwf); //rr1 = m_pDMO_Filter->m_pMedia->vt->GetInputStreamInfo(m_pDMO_Filter->m_pMedia, 0, &dwf); //printf("PROCESSTESTINPUTSTREAM %d %x\n", rr1, dwf); //trapbug(); bufferin = CMediaBufferCreate(size, (void*)src, size, 0); int r = m_pDMO_Filter->m_pMedia->vt->ProcessInput(m_pDMO_Filter->m_pMedia, 0, (IMediaBuffer*)bufferin, (is_keyframe) ? DMO_INPUT_DATA_BUFFERF_SYNCPOINT : 0, 0, 0); ((IMediaBuffer*)bufferin)->vt->Release((IUnknown*)bufferin); if (r != S_OK) { /* something for process */ if (r != S_FALSE) printf("ProcessInputError r:0x%x=%d (keyframe: %d)\n", r, r, is_keyframe); else printf("ProcessInputError FALSE ?? (keyframe: %d)\n", is_keyframe); return size; } db.rtTimestamp = 0; db.rtTimelength = 0; db.dwStatus = 0; db.pBuffer = (IMediaBuffer*) CMediaBufferCreate(m_sDestType.lSampleSize, imdata, 0, 0); r = m_pDMO_Filter->m_pMedia->vt->ProcessOutput(m_pDMO_Filter->m_pMedia, (imdata) ? 0 : DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER, 1, &db, &status); //m_pDMO_Filter->m_pMedia->vt->Lock(m_pDMO_Filter->m_pMedia, 0); if ((unsigned)r == DMO_E_NOTACCEPTING) printf("ProcessOutputError: Not accepting\n"); else if (r) printf("ProcessOutputError: r:0x%x=%d %ld stat:%ld\n", r, r, status, db.dwStatus); ((IMediaBuffer*)db.pBuffer)->vt->Release((IUnknown*)db.pBuffer); //int r = m_pDMO_Filter->m_pMedia->vt->Flush(m_pDMO_Filter->m_pMedia); //printf("FLUSH %d\n", r); int check = 0; if (m_bSetFlg) { //printf("SETFLG %d \n", m_iLastPPMode); if (m_iLastPPMode >= 0 && m_iLastHue != -1) { m_bSetFlg = false; setCodecValues(); } check++; } if (check) getCodecValues(); return size;//hr; } /* * bits == 0 - leave unchanged */ int DMO_VideoDecoder::SetDestFmt(int bits, fourcc_t csp) { const struct fcc2gc_s* t; int r; if ((bits || csp) && !CImage::Supported(csp, bits)) return -1; AVM_WRITE("Win32 DMO video decoder", 1, "SetDestFmt %d %.4s\n", bits, (char*)&csp); if (bits == 0) bits = csp; BitmapInfo temp = m_Dest; // rememeber current setting Setup_FS_Segment(); t = fcc2gc(bits); if (t) { m_sDestType.subtype = t->subtype; if (!t->cap) { m_Dest.SetBits(bits); if (!m_bHaveUpsideDownRGB) m_Dest.biHeight = labs(m_Dest.biHeight); } else m_Dest.SetSpace(bits); } // else reset what we already have (dir change) //m_Dest.Print(); m_sDestType.lSampleSize = m_Dest.biSizeImage; memcpy(&m_sVhdr2->bmiHeader, &m_Dest, sizeof(m_sVhdr2->bmiHeader)); m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); if (m_sVhdr2->bmiHeader.biCompression == 3) m_sDestType.cbFormat += 12; if (!m_pDMO_Filter) return 0; // test accept r = m_pDMO_Filter->m_pMedia->vt->SetOutputType(m_pDMO_Filter->m_pMedia, 0, &m_sDestType, DMO_SET_TYPEF_TEST_ONLY); if (r != 0) { if (csp) AVM_WRITE("Win32 video decoder", "Warning: unsupported color space\n"); else AVM_WRITE("Win32 video decoder", "Warning: unsupported bit depth\n"); m_Dest = temp; m_sDestType.lSampleSize = m_Dest.biSizeImage; memcpy(&(m_sVhdr2->bmiHeader), &m_Dest, sizeof(temp)); m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); if (m_sVhdr2->bmiHeader.biCompression == 3) m_sDestType.cbFormat += 12; return -1; } m_pDMO_Filter->m_pMedia->vt->SetOutputType(m_pDMO_Filter->m_pMedia, 0, &m_sDestType, 0); return 0; } int DMO_VideoDecoder::SetDirection(int d) { if (m_Dest.biHeight < 0) m_Dest.biHeight = -m_Dest.biHeight; if (!d && m_bHaveUpsideDownRGB) m_Dest.biHeight = -m_Dest.biHeight; m_sVhdr2->bmiHeader.biHeight = m_Dest.biHeight; //printf("SETDIRECTION %d\n", m_sVhdr2->bmiHeader.biHeight); m_Dest.Print(); if (m_pDMO_Filter) SetDestFmt(0, 0); return 0; } int DMO_VideoDecoder::GetValue(const char* name, int* value) const { if (strcmp(name, "postprocessing") == 0) // Pp *value = m_iLastPPMode; else if (strcmp(name, "Brightness") == 0) *value = m_iLastBrightness; else if (strcmp(name, "Contrast") == 0) *value = m_iLastContrast; else if (strcmp(name, "Saturation") == 0) *value = m_iLastSaturation; else if (strcmp(name, "Hue") == 0) *value = m_iLastHue; else if (strcmp(name, "maxauto") == 0) *value = m_iMaxAuto; else return -1; //printf("BR %d C %d S %d H %d PP: %d (%s)\n", m_iLastBrightness, // m_iLastContrast, m_iLastSaturation, m_iLastHue, m_iLastPPMode, name); return 0; } int DMO_VideoDecoder::getCodecValues() { return 0; } int DMO_VideoDecoder::SetValue(const char* name, int value) { m_bSetFlg = true; if (strcmp(name, "postprocessing") == 0) // Pp m_iLastPPMode = value; else if (strcmp(name, "Brightness") == 0) m_iLastBrightness = value; else if (strcmp(name, "Contrast") == 0) m_iLastContrast = value; else if (strcmp(name, "Saturation") == 0) m_iLastSaturation = value; else if (strcmp(name, "Hue") == 0) m_iLastHue = value; else if (strcmp(name, "maxauto") == 0) m_iMaxAuto = value; //printf("SETVAL B %d C %d S %d H %d \n", m_iLastBrightness, // m_iLastContrast, m_iLastSaturation, m_iLastHue); //else AVM_WRITE("Win32 video decoder", "Set %s %d\n", name, value); return 0; } int DMO_VideoDecoder::setCodecValues() { if (!m_iStatus) return -1; return 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/plugins/libwin32/videocodec/DMO_VideoDecoder.h0000644000175000017500000000304511167204733024371 0ustar yavoryavor#ifndef AVIFILE_DMO_VIDEODECODER_H #define AVIFILE_DMO_VIDEODECODER_H #include "dmo/DMO_Filter.h" #include "videodecoder.h" AVM_BEGIN_NAMESPACE; class DMO_VideoDecoder: public IVideoDecoder, public IRtConfig { public: DMO_VideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& format, int flip); virtual ~DMO_VideoDecoder(); virtual int DecodeFrame(CImage* dest, const void* src, size_t size, int is_keyframe, bool render = true, CImage** pOut = 0); virtual CAPS GetCapabilities() const { return m_Caps; } //virtual IRtConfig* GetRtConfig() { return (IRtConfig*) this; } virtual int SetDestFmt(int bits = 24, fourcc_t csp = 0); virtual int SetDirection(int d); virtual int Start(); virtual int Stop(); // IRtConfig interface virtual const avm::vector& GetAttrs() const { return m_Info.decoder_info; } virtual int GetValue(const char*, int*) const; virtual int SetValue(const char*, int); int init(); protected: int setCodecValues(); int getCodecValues(); DMO_Filter* m_pDMO_Filter; AM_MEDIA_TYPE m_sOurType, m_sDestType; VIDEOINFOHEADER* m_sVhdr; VIDEOINFOHEADER* m_sVhdr2; CAPS m_Caps; // capabilities of DirectShow decoder int m_iStatus; int m_iMaxAuto; int m_iLastPPMode; int m_iLastBrightness; int m_iLastContrast; int m_iLastSaturation; int m_iLastHue; bool m_bHaveUpsideDownRGB; bool m_bSetFlg; bool m_bFlip; }; AVM_END_NAMESPACE; #endif /* AVIFILE_DMO_VIDEODECODER_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/videocodec/DS_VideoDecoder.cpp0000644000175000017500000004504011171057001024601 0ustar yavoryavor/******************************************************** DirectShow Video decoder implementation Copyright 2000 Eugene Kuznetsov (divx@euro.ru) *********************************************************/ #include "dshow/guids.h" #include "dshow/interfaces.h" #include "avm_output.h" #include "DS_VideoDecoder.h" #include "ldt_keeper.h" #include "configfile.h" #include "avm_cpuinfo.h" #include "wine/windef.h" #include "wine/winreg.h" #include "wine/vfw.h" #include "registry.h" #ifndef NOAVIFILE_HEADERS #define VFW_E_NOT_RUNNING 0x80040226 #include "avm_fourcc.h" #endif #include #include #include #include #include #include #include // labs AVM_BEGIN_NAMESPACE; DS_VideoDecoder::DS_VideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& format, int flip) :IVideoDecoder(info, format), m_sVhdr2(0), m_pIDivx4(0), m_iStatus(0), m_iLastPPMode(0), m_iLastBrightness(0), m_iLastContrast(0), m_iLastSaturation(0), m_iLastHue(0), m_CType(CT_NONE), m_bHaveUpsideDownRGB(true), m_bSetFlg(false), m_bFlip(flip) { unsigned bihs = (m_pFormat->biSize < (int) sizeof(BITMAPINFOHEADER)) ? sizeof(BITMAPINFOHEADER) : m_pFormat->biSize; bihs = sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER) + bihs; //int ss = 0;for (unsigned i = 0; i < m_pFormat->biSize; i++) { ss += ((unsigned char*) m_pFormat)[i]; printf(" %2x", ((unsigned char*) m_pFormat)[i]); if (!(i%16)) printf("\n"); } //printf("\nBITMAPINFOHEADER %d %d %d\n", m_pFormat->biSize, bihs, ss); //m_Dest.biHeight = labs(m_Dest.biHeight); // parent: //m_Dest = *m_pFormat; //m_Dest.SetBits(24); m_sVhdr = (VIDEOINFOHEADER*) malloc(bihs); memset(m_sVhdr, 0, bihs); memcpy(&m_sVhdr->bmiHeader, m_pFormat, m_pFormat->biSize); m_sVhdr->rcSource.left = m_sVhdr->rcSource.top = 0; m_sVhdr->rcSource.right = m_sVhdr->bmiHeader.biWidth; m_sVhdr->rcSource.bottom = m_sVhdr->bmiHeader.biHeight; m_sVhdr->rcTarget = m_sVhdr->rcSource; m_sOurType.majortype = MEDIATYPE_Video; m_sOurType.subtype = MEDIATYPE_Video; m_sOurType.subtype.f1 = m_sVhdr->bmiHeader.biCompression; m_sOurType.formattype = FORMAT_VideoInfo; m_sOurType.bFixedSizeSamples = false; m_sOurType.bTemporalCompression = true; m_sOurType.pUnk = 0; m_sOurType.cbFormat = bihs; m_sOurType.pbFormat = (char*)m_sVhdr; m_sVhdr2 = (VIDEOINFOHEADER*) malloc(sizeof(VIDEOINFOHEADER) + 12); // basicaly copy of m_Dest - but staying friendly to other players.. memset(m_sVhdr2, 0, sizeof(VIDEOINFOHEADER) + 12); m_sVhdr2->bmiHeader.biBitCount = 24; m_sVhdr2->bmiHeader.biWidth = m_Dest.biWidth; m_sVhdr2->bmiHeader.biHeight = m_Dest.biHeight; m_sVhdr2->bmiHeader.biSizeImage = m_sVhdr2->bmiHeader.biWidth * labs(m_sVhdr2->bmiHeader.biHeight) * m_sVhdr2->bmiHeader.biBitCount / 8; m_sVhdr2->rcSource = m_sVhdr->rcSource; m_sVhdr2->rcTarget = m_sVhdr->rcTarget; memset(&m_sDestType, 0, sizeof(m_sDestType)); m_sDestType.majortype = MEDIATYPE_Video; m_sDestType.formattype = FORMAT_VideoInfo; m_sDestType.subtype = MEDIASUBTYPE_RGB24; m_sDestType.bFixedSizeSamples = true; m_sDestType.bTemporalCompression = false; m_sDestType.lSampleSize = m_sVhdr2->bmiHeader.biSizeImage; m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); m_sDestType.pbFormat = (char*)m_sVhdr2; } // this is cruel hack to avoid problems with throws - // could anyone explain me why GNU people can't build reliable // C++ compiler int DS_VideoDecoder::init() { Setup_FS_Segment(); m_pDS_Filter = DS_FilterCreate(m_Info.dll.c_str(), &m_Info.guid, &m_sOurType, &m_sDestType); if (!m_pDS_Filter) { AVM_WRITE("Win32 DS video decoder", "WARNING: format not accepted!\n"); return -1; } if (m_Dest.biHeight < 0) { int r = m_pDS_Filter->m_pOutputPin->vt->QueryAccept(m_pDS_Filter->m_pOutputPin, &m_sDestType); if (r) { AVM_WRITE("Win32 DS video decoder", "WARNING: decoder does not support upside-down RGB frames!\n"); m_Dest.biHeight = -m_Dest.biHeight; m_sVhdr2->bmiHeader.biHeight = m_Dest.biHeight; m_bHaveUpsideDownRGB = false; } } switch (m_Info.fourcc) { //case fccIV50: works normaly with YV12 (kabi) // IV50 doesn't support I420 case fccTM20: m_Caps = CAP_NONE; break; case fccDIV3: case fccDIV4: case fccDIV5: case fccDIV6: case fccMP42: //YV12 seems to be broken for DivX :-) codec //produces incorrect picture //m_Caps = (CAPS) (m_Caps & ~CAP_YV12); //m_Caps = CAP_UYVY;//CAP_YUY2; // | CAP_I420; //m_Caps = CAP_I420; m_Caps = (CAPS) (CAP_YUY2 | CAP_UYVY); break; default: { static const struct ct { unsigned int bits; fourcc_t fcc; GUID subtype; CAPS cap; } check[] = { {16, fccYUY2, MEDIASUBTYPE_YUY2, CAP_YUY2}, {12, fccIYUV, MEDIASUBTYPE_IYUV, CAP_IYUV}, {16, fccUYVY, MEDIASUBTYPE_UYVY, CAP_UYVY}, {12, fccYV12, MEDIASUBTYPE_YV12, CAP_YV12}, {16, fccYV12, MEDIASUBTYPE_YV12, CAP_YV12}, {16, fccYVYU, MEDIASUBTYPE_YVYU, CAP_YVYU}, //{12, fccI420, MEDIASUBTYPE_I420, CAP_I420}, {0}, }; m_Caps = CAP_NONE; for (const ct* c = check; c->bits; c++) { m_sVhdr2->bmiHeader.biBitCount = c->bits; m_sVhdr2->bmiHeader.biCompression = c->fcc; m_sDestType.subtype = c->subtype; if (0 == m_pDS_Filter->m_pOutputPin->vt->QueryAccept(m_pDS_Filter->m_pOutputPin, &m_sDestType)) m_Caps = (CAPS)(m_Caps | c->cap); } m_sVhdr2->bmiHeader.biBitCount = 24; m_sVhdr2->bmiHeader.biCompression = 0; m_sDestType.subtype = MEDIASUBTYPE_RGB24; } } const char* dll = m_Info.dll.c_str(); if (strcmp(dll, "divxcvki.ax") == 0 || strcmp(dll, "divx_c32.ax") == 0 || strcmp(dll, "wmvds32.ax") == 0 || strcmp(dll, "wmv8ds32.ax") == 0) { m_CType = CT_DIVX3; m_iMaxAuto = RegReadInt("win32", "maxauto", 4); } else if (strcmp(dll, "divxdec.ax") == 0) { m_CType = CT_DIVX4; m_iMaxAuto = RegReadInt("win32DivX4", "maxauto", 6); if (m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)m_pDS_Filter->m_pFilter, &IID_IDivxFilterInterface, (void**)&m_pIDivx4)) { AVM_WRITE("Win32 video decoder", 1, "No such interface\n"); m_CType = CT_NONE; } } else if (strcmp(dll, "ir50_32.dll") == 0) m_CType = CT_IV50; getCodecValues(); if (m_Caps != CAP_NONE) AVM_WRITE("Win32 DS video decoder", "Decoder is capable of YUV output ( flags 0x%x )\n", (int)m_Caps); SetDirection(m_bFlip); //m_Dest.Print(); return 0; } DS_VideoDecoder::~DS_VideoDecoder() { Stop(); if (m_pIDivx4) m_pIDivx4->vt->Release((IUnknown*)m_pIDivx4); if (m_sVhdr) free(m_sVhdr); if (m_sVhdr2) free(m_sVhdr2); if (m_pDS_Filter) DS_Filter_Destroy(m_pDS_Filter); } int DS_VideoDecoder::Start() { if (!m_iStatus) { Setup_FS_Segment(); //AVM_WRITE("Win32 video decoder", "DSSTART %p %d\n", this, m_sVhdr2->bmiHeader.biHeight); m_iStatus = 1; m_pDS_Filter->Start(m_pDS_Filter); ALLOCATOR_PROPERTIES props, props1; props.cBuffers = 1; props.cbBuffer = m_sDestType.lSampleSize; //don't know how to do this correctly props.cbAlign = 1; // Sascha Sommer thinks this is the right value props.cbPrefix = 0; m_pDS_Filter->m_pAll->vt->SetProperties(m_pDS_Filter->m_pAll, &props, &props1); m_pDS_Filter->m_pAll->vt->Commit(m_pDS_Filter->m_pAll); } return 0; } int DS_VideoDecoder::Stop() { if (m_iStatus) { Setup_FS_Segment(); m_pDS_Filter->Stop(m_pDS_Filter); m_iStatus = 0; //AVM_WRITE("Win32 video decoder", "DSSTOP %p\n", this); } return 0; } int DS_VideoDecoder::DecodeFrame(CImage* dest, const void* src, size_t size, int is_keyframe, bool render, CImage** pOut) { IMediaSample* sample = 0; if (!m_iStatus) { AVM_WRITE("Win32 DS video decoder", "not started!\n"); return -1; } Setup_FS_Segment(); if (!dest->IsFmt(&m_Dest)) printf("\n\nERRRRRRRRR\n\n"); m_pDS_Filter->m_pAll->vt->GetBuffer(m_pDS_Filter->m_pAll, &sample, 0, 0, 0); if (!sample) { AVM_WRITE("Win32 video decoder", 1, "ERROR: null sample\n"); return -1; } //printf("DECODE this:%p img: %p\n", this, dest); if (dest) { if (!(dest->Data())) { AVM_WRITE("Win32 DS video decoder", 1, "no m_outFrame??\n"); } else m_pDS_Filter->m_pOurOutput->SetPointer2(m_pDS_Filter->m_pOurOutput, (char*)dest->Data()); } //printf("W32 from -> to\n"); m_Dest.Print(); dest->GetFmt()->Print(); char* ptr; sample->vt->SetActualDataLength(sample, size); sample->vt->GetPointer(sample, (BYTE **)&ptr); memcpy(ptr, src, size); sample->vt->SetSyncPoint(sample, is_keyframe); sample->vt->SetPreroll(sample, dest ? 0 : 1); // sample->vt->SetMediaType(sample, &m_sOurType); int check = 0; if (m_bSetFlg) { //printf("SETFLG %d \n", m_iLastPPMode); if (m_iLastPPMode >= 0 && m_iLastHue != -1) { m_bSetFlg = false; setCodecValues(); } check++; } int hr = m_pDS_Filter->m_pImp->vt->Receive(m_pDS_Filter->m_pImp, sample); if (hr) { AVM_WRITE("Win32 DS video encoder", 1, "DS_VideoDecoder::DecodeInternal() error putting data into input pin %x\n", hr); hr = -1; } sample->vt->Release((IUnknown*)sample); if (check) getCodecValues(); switch (m_CType) { case CT_DIVX4: dest->SetQuality(m_iLastPPMode / 6.0); break; case CT_DIVX3: dest->SetQuality(m_iLastPPMode / 4.0); break; default: ; } return hr; } /* * bits == 0 - leave unchanged */ int DS_VideoDecoder::SetDestFmt(int bits, fourcc_t csp) { if ((bits || csp) && !CImage::Supported(csp, bits)) return -1; AVM_WRITE("Win32 DS video decoder", 1, "SetDestFmt %d %.4s\n", bits, (char*)&csp); BitmapInfo temp = m_Dest; if (bits != 0) { bool ok = true; switch (bits) { case 15: m_sDestType.subtype = MEDIASUBTYPE_RGB555; break; case 16: m_sDestType.subtype = MEDIASUBTYPE_RGB565; break; case 24: m_sDestType.subtype = MEDIASUBTYPE_RGB24; break; case 32: m_sDestType.subtype = MEDIASUBTYPE_RGB32; break; default: ok = false; break; } if (ok) { m_Dest.SetBits(bits); if (!m_bHaveUpsideDownRGB) m_Dest.biHeight = labs(m_Dest.biHeight); //m_Dest.biHeight = labs(m_Dest.biHeight); } } else if (csp != 0) { bool ok = true; switch (csp) { case fccYUY2: m_sDestType.subtype = MEDIASUBTYPE_YUY2; break; case fccYV12: m_sDestType.subtype = MEDIASUBTYPE_YV12; break; case fccIYUV: m_sDestType.subtype = MEDIASUBTYPE_IYUV; break; case fccUYVY: m_sDestType.subtype = MEDIASUBTYPE_UYVY; break; case fccYVYU: m_sDestType.subtype = MEDIASUBTYPE_YVYU; break; default: ok = false; break; } if (ok) m_Dest.SetSpace(csp); } Setup_FS_Segment(); m_sDestType.lSampleSize = m_Dest.biSizeImage; memcpy(&(m_sVhdr2->bmiHeader), &m_Dest, sizeof(m_Dest)); m_sVhdr2->bmiHeader.biHeight = m_Dest.biHeight; m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); if (m_sVhdr2->bmiHeader.biCompression == 3) m_sDestType.cbFormat += 12; static const struct ct { fourcc_t fcc; CAPS cap; } map[] = { { fccYUY2, CAP_YUY2 }, { fccYV12, CAP_YV12 }, { fccIYUV, CAP_IYUV }, { fccUYVY, CAP_UYVY }, { fccYVYU, CAP_YVYU }, { 0 } }; int result; bool should_test = true; for (const ct* c = map; c->fcc; c++) { if (c->fcc == csp) { if (!(m_Caps & c->cap)) should_test = false; break; } } result = (should_test) ? m_pDS_Filter->m_pOutputPin->vt->QueryAccept(m_pDS_Filter->m_pOutputPin, &m_sDestType) : 0; if (result != 0) { if (csp) AVM_WRITE("Win32 video decoder", "Warning: unsupported color space\n"); else AVM_WRITE("Win32 video decoder", "Warning: unsupported bit depth\n"); m_Dest = temp; m_sDestType.lSampleSize = m_Dest.biSizeImage; memcpy(&(m_sVhdr2->bmiHeader), &m_Dest, sizeof(temp)); m_sVhdr2->bmiHeader.biHeight = m_Dest.biHeight; m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); if (m_sVhdr2->bmiHeader.biCompression == 3) m_sDestType.cbFormat += 12; return -1; } m_pFormat->biBitCount = bits; //Restart(); bool stoped = false; if (m_iStatus) { Stop(); stoped = true; } m_pDS_Filter->m_pInputPin->vt->Disconnect(m_pDS_Filter->m_pInputPin); m_pDS_Filter->m_pOutputPin->vt->Disconnect(m_pDS_Filter->m_pOutputPin); m_pDS_Filter->m_pOurOutput->SetNewFormat(m_pDS_Filter->m_pOurOutput, &m_sDestType); result = m_pDS_Filter->m_pInputPin->vt->ReceiveConnection(m_pDS_Filter->m_pInputPin, m_pDS_Filter->m_pOurInput, &m_sOurType); if (result) { AVM_WRITE("Win32 video decoder", "Error reconnecting input pin 0x%x\n", (int)result); return -1; } result = m_pDS_Filter->m_pOutputPin->vt->ReceiveConnection(m_pDS_Filter->m_pOutputPin, (IPin*)m_pDS_Filter->m_pOurOutput, &m_sDestType); if (result) { AVM_WRITE("Win32 video decoder", "Error reconnecting output pin 0x%x\n", (int)result); return -1; } if (stoped) Start(); return 0; } int DS_VideoDecoder::SetDirection(int d) { if (m_Dest.biHeight < 0) m_Dest.biHeight = -m_Dest.biHeight; if (!d && m_bHaveUpsideDownRGB) m_Dest.biHeight = -m_Dest.biHeight; m_sVhdr2->bmiHeader.biHeight = m_Dest.biHeight; //printf("SETDIRECTION %d\n", m_sVhdr2->bmiHeader.biHeight); m_Dest.Print(); if (m_pDS_Filter) SetDestFmt(0, 0); return 0; } int DS_VideoDecoder::GetValue(const char* name, int* value) const { if (strcmp(name, "postprocessing") == 0) // Pp *value = m_iLastPPMode; else if (strcmp(name, "Brightness") == 0) *value = m_iLastBrightness; else if (strcmp(name, "Contrast") == 0) *value = m_iLastContrast; else if (strcmp(name, "Saturation") == 0) *value = m_iLastSaturation; else if (strcmp(name, "Hue") == 0) *value = m_iLastHue; else if (strcmp(name, "maxauto") == 0) *value = m_iMaxAuto; else return -1; //printf("BR %d C %d S %d H %d PP: %d (%s)\n", m_iLastBrightness, // m_iLastContrast, m_iLastSaturation, m_iLastHue, m_iLastPPMode, name); return 0; } int DS_VideoDecoder::getCodecValues() { switch (m_CType) { case CT_DIVX4: m_pIDivx4->vt->get_PPLevel(m_pIDivx4, &m_iLastPPMode); m_iLastPPMode /= 10; m_pIDivx4->vt->get_Brightness(m_pIDivx4, &m_iLastBrightness); m_pIDivx4->vt->get_Contrast(m_pIDivx4, &m_iLastContrast); m_pIDivx4->vt->get_Saturation(m_pIDivx4, &m_iLastSaturation); break; case CT_DIVX3: { // brightness 87 // contrast 74 // hue 23 // saturation 20 // post process mode 0 // get1 0x01 // get2 10 // get3=set2 86 // get4=set3 73 // get5=set4 19 // get6=set5 23 IHidden* hidden = (IHidden*)((int)m_pDS_Filter->m_pFilter + 0xb8); //#warning NOT SURE hidden->vt->GetSmth2(hidden, &m_iLastPPMode); if (m_iLastPPMode >= 10) m_iLastPPMode -= 10; if (m_iLastPPMode < 0 || m_iLastHue < 0) { hidden->vt->GetSmth3(hidden, &m_iLastBrightness); //printf("BRGET %d\n", m_iLastBrightness); hidden->vt->GetSmth4(hidden, &m_iLastContrast); hidden->vt->GetSmth5(hidden, &m_iLastSaturation); hidden->vt->GetSmth6(hidden, &m_iLastHue); } break; } case CT_IV50: { IHidden2* hidden = 0; if (m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)m_pDS_Filter->m_pFilter, &IID_Iv50Hidden, (void**)&hidden)) { AVM_WRITE("Win32 video decoder", 0, "No such interface\n"); return -1; } else { int recordpar[30]; memset(&recordpar, 0, sizeof(recordpar)); recordpar[0]=0x7c; recordpar[1]=fccIV50; recordpar[2]=0x10005; recordpar[3]=2; recordpar[4]=1; recordpar[5]=0x80000000 | 0x20 | 0x40 | 0x80; hidden->vt->DecodeGet(hidden, recordpar); m_iLastBrightness = recordpar[18]; m_iLastSaturation = recordpar[19]; m_iLastContrast = recordpar[20]; hidden->vt->Release((IUnknown*)hidden); } } default: ; } return 0; } int DS_VideoDecoder::SetValue(const char* name, int value) { m_bSetFlg = true; if (strcmp(name, "postprocessing") == 0) // Pp m_iLastPPMode = value; else if (strcmp(name, "Brightness") == 0) m_iLastBrightness = value; else if (strcmp(name, "Contrast") == 0) m_iLastContrast = value; else if (strcmp(name, "Saturation") == 0) m_iLastSaturation = value; else if (strcmp(name, "Hue") == 0) m_iLastHue = value; else if (strcmp(name, "maxauto") == 0) m_iMaxAuto = value; //printf("SETVAL B %d C %d S %d H %d \n", m_iLastBrightness, // m_iLastContrast, m_iLastSaturation, m_iLastHue); //else AVM_WRITE("Win32 video decoder", "Set %s %d\n", name, value); return 0; } int DS_VideoDecoder::setCodecValues() { if (!m_iStatus) return -1; switch (m_CType) { case CT_DIVX4: m_pIDivx4->vt->put_PPLevel(m_pIDivx4, m_iLastPPMode * 10); m_pIDivx4->vt->put_Brightness(m_pIDivx4, m_iLastBrightness); m_pIDivx4->vt->put_Contrast(m_pIDivx4, m_iLastContrast); m_pIDivx4->vt->put_Saturation(m_pIDivx4, m_iLastSaturation); break; case CT_DIVX3: { // brightness 87 // contrast 74 // hue 23 // saturation 20 // post process mode 0 // get1 0x01 // get2 10 // get3=set2 86 // get4=set3 73 // get5=set4 19 // get6=set5 23 IHidden* hidden = (IHidden*)((int)m_pDS_Filter->m_pFilter + 0xb8); hidden->vt->SetSmth(hidden, m_iLastPPMode, 0); hidden->vt->SetSmth2(hidden, m_iLastBrightness, 0); hidden->vt->SetSmth3(hidden, m_iLastContrast, 0); hidden->vt->SetSmth4(hidden, m_iLastSaturation, 0); hidden->vt->SetSmth5(hidden, m_iLastHue, 0); } break; case CT_IV50: { IHidden2* hidden = 0; if (m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)m_pDS_Filter->m_pFilter, &IID_Iv50Hidden, (void**)&hidden)) { AVM_WRITE("Win32 video decoder", 1, "No such interface\n"); return -1; } int recordpar[30]; memset(&recordpar, 0, sizeof(recordpar)); recordpar[0]=0x7c; recordpar[1]=fccIV50; recordpar[2]=0x10005; recordpar[3]=2; recordpar[4]=1; recordpar[5]=0x80000000 | 0x20 | 0x40 | 0x80; recordpar[18] = m_iLastBrightness; recordpar[19] = m_iLastSaturation; recordpar[20] = m_iLastContrast; int hr = hidden->vt->DecodeSet(hidden, recordpar); hidden->vt->Release((IUnknown*)hidden); return hr; } default: ; } return 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/plugins/libwin32/videocodec/DS_VideoDecoder.h0000644000175000017500000000321411167204733024256 0ustar yavoryavor#ifndef AVIFILE_DS_VIDEODECODER_H #define AVIFILE_DS_VIDEODECODER_H #include "dshow/DS_Filter.h" #include "videodecoder.h" AVM_BEGIN_NAMESPACE; class DS_VideoDecoder: public IVideoDecoder, public IRtConfig { public: DS_VideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& format, int flip); virtual ~DS_VideoDecoder(); virtual int DecodeFrame(CImage* dest, const void* src, size_t size, int is_keyframe, bool render = true, CImage** pOut = 0); virtual CAPS GetCapabilities() const { return m_Caps; } virtual IRtConfig* GetRtConfig() { return (IRtConfig*) this; } virtual int SetDestFmt(int bits = 24, fourcc_t csp = 0); virtual int SetDirection(int d); virtual int Start(); virtual int Stop(); // IRtConfig interface virtual const avm::vector& GetAttrs() const { return m_Info.decoder_info; } virtual int GetValue(const char*, int*) const; virtual int SetValue(const char*, int); int init(); // avoid throws protected: int setCodecValues(); int getCodecValues(); DS_Filter* m_pDS_Filter; AM_MEDIA_TYPE m_sOurType, m_sDestType; VIDEOINFOHEADER* m_sVhdr; VIDEOINFOHEADER* m_sVhdr2; IDivxFilterInterface* m_pIDivx4; CAPS m_Caps; // capabilities of DirectShow decoder int m_iStatus; int m_iMaxAuto; int m_iLastPPMode; int m_iLastBrightness; int m_iLastContrast; int m_iLastSaturation; int m_iLastHue; enum { CT_NONE, CT_DIVX3, CT_DIVX4, CT_IV50 } m_CType; bool m_bHaveUpsideDownRGB; bool m_bSetFlg; bool m_bFlip; }; AVM_END_NAMESPACE; #endif /* AVIFILE_DS_VIDEODECODER_H */ avifile-0.7.48~20090503.ds/plugins/libwin32/videocodec/Makefile.am0000644000175000017500000000063607564673746023250 0ustar yavoryavorif AMM_USE_WIN32 noinst_LTLIBRARIES = libvideocodec.la endif noinst_HEADERS = \ DMO_VideoDecoder.h \ DS_VideoDecoder.h \ Module.h \ VideoDecoder.h \ VideoEncoder.h libvideocodec_la_SOURCES = \ DMO_VideoDecoder.cpp \ DS_VideoDecoder.cpp \ VideoEncoder.cpp \ VideoDecoder.cpp \ Module.cpp AM_CPPFLAGS = $(LTNOPIC) -I$(srcdir)/../loader AM_CXXFLAGS = $(CXXRTTIEXCEPT) MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libwin32/videocodec/Module.cpp0000644000175000017500000001001611171057001023077 0ustar yavoryavor#include "Module.h" extern "C" { #include "wine/winreg.h" #include "driver.h" } #include "avm_output.h" #include #include AVM_BEGIN_NAMESPACE; VideoCodecControl control; VideoCodecControl::~VideoCodecControl() { printf("DELETE VIDEO %d\n", _modules.size()); while (_modules.size()) { Module* m = _modules.back(); _modules.pop_back(); m->ForgetParent(); // at this time player using this codec has to be stopped // currently this is partial responsibility of user task // FIXME !!! - destroy codec thread if necessary } } Module* VideoCodecControl::Create(const CodecInfo& info) { //printf("VideoCodecControl::Create %s\n", info.dll.c_str()); for (unsigned i = 0; i < _modules.size(); i++) { if (info.dll == _modules[i]->GetName()) { //printf("VideoCodecControl::Create cache %d\n", i); return _modules[i]; } } Module* module = new Module(info.dll.c_str(), *this); if (module && module->init() < 0) { delete module; return 0; } _modules.push_back(module); return module; } void VideoCodecControl::Erase(Module* mod) { //printf("VideoCodecControl::Erase module %p\n", mod); for (unsigned i = 0; i < _modules.size(); i++) if (_modules[i] == mod) { // remove this member (swap with last one) Module* m = _modules.back(); _modules.pop_back(); if (_modules.size() > i) _modules[i] = m; //printf("VideoCodecControl::Erase success - new _modules size %d %p\n", _modules.size(), m); //if (_modules.size() > 0) printf("VideoCodecControl::Erase last %s\n", _modules[_modules.size() - 1]->GetName()); break; } } Module::Module(const char* name, VideoCodecControl& parent) :_parent(parent), m_pName(name), forgotten(0), m_iRefCount(0) { } int Module::init() { m_pHandle = LoadLibraryA(m_pName.c_str()); if (!m_pHandle) { AVM_WRITE("Win32 plugin", "Could not load Win32 dll library: %s\n", m_pName.c_str()); return -1; } CodecAlloc(); driver.uDriverSignature = 0; driver.hDriverModule = m_pHandle; driver.dwDriverID = 0; driver.DriverProc = (DRIVERPROC) GetProcAddress(m_pHandle, "DriverProc"); if (!driver.DriverProc) { AVM_WRITE("Win32 plugin", "Not a valid Win32 dll library: %s\n", m_pName.c_str()); return -1; } ICSendMessage((int)&driver, DRV_LOAD, 0, 0); ICSendMessage((int)&driver, DRV_ENABLE, 0, 0); AVM_WRITE("Win32 plugin", "Using Win32 dll library: %s\n", m_pName.c_str()); return 0; } Module::~Module() { if (m_pHandle) { if (driver.DriverProc) ICSendMessage((int)&driver, DRV_FREE, 0, 0); // 0 drivreid FreeLibrary(m_pHandle); CodecRelease(); } if (!forgotten) _parent.Erase(this); } HIC Module::CreateHandle(unsigned int compressor, Mode mode) { ICOPEN icopen; icopen.fccType = mmioFOURCC('v', 'i', 'd', 'c'); icopen.fccHandler = compressor; icopen.dwSize = sizeof(ICOPEN); icopen.dwFlags = (mode == Compress) ? ICMODE_COMPRESS : ICMODE_DECOMPRESS; driver.dwDriverID = m_iRefCount; DRVR* hDriver = new DRVR(driver); if (!hDriver) return 0; //printf("Creating new handle for m_iRefCount %d, driver %d\n", m_iRefCount,(int)hDriver); //printf("fcc: 0x%lx, handler: 0x%lx (%.4s)\n", icopen.fccType, icopen.fccHandler, (char*) &icopen.fccHandler); hDriver->dwDriverID = ICSendMessage((int)hDriver, DRV_OPEN, 0, (int) &icopen); if (!hDriver->dwDriverID) { AVM_WRITE("Win32 plugin", "WARNING DRV_OPEN failed (0x%lx/%d)\n", icopen.fccHandler, m_iRefCount); return 0; } //else printf("New ID: %ld\n", hDriver->dwDriverID); m_iRefCount++; //printf("CREATE HANDLE %p %d\n", hDriver, m_iRefCount); return (HIC) hDriver; } int Module::CloseHandle(HIC handle) { DRVR* hDriver = (DRVR*) handle; //printf("DELETE HANDLE %p %d\n", hDriver, m_iRefCount); if (hDriver) ICSendMessage((int)hDriver, DRV_CLOSE, 0, 0); if (--m_iRefCount < 1) delete this; delete hDriver; return 0; } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/plugins/libwin32/videocodec/Module.h0000644000175000017500000000217311171057001022551 0ustar yavoryavor#ifndef AVIFILE_MODULE_H #define AVIFILE_MODULE_H #include "infotypes.h" #include "videoencoder.h" #include "loader.h" AVM_BEGIN_NAMESPACE; struct DRVR { unsigned int uDriverSignature; int hDriverModule; DRIVERPROC DriverProc; unsigned long dwDriverID; }; class Module; class VideoCodecControl { friend class Module; avm::vector _modules; public: VideoCodecControl() {} Module* Create(const CodecInfo& info); ~VideoCodecControl(); protected: void Erase(Module*); }; class Module { public: enum Mode {Compress, Decompress}; Module(const char* name, VideoCodecControl& parent); //loads module ~Module(); const char* GetName() const { return m_pName.c_str(); } HIC CreateHandle(unsigned int compressor, Mode mode); int CloseHandle(HIC); int GetLibHandle() { return m_pHandle; } void ForgetParent() { forgotten = 1; } int init(); protected: VideoCodecControl& _parent; avm::string m_pName; DRVR driver; int forgotten; int m_iRefCount; int m_pHandle; }; extern VideoCodecControl control; AVM_END_NAMESPACE; #endif // AVIFILE_MODULE_H avifile-0.7.48~20090503.ds/plugins/libwin32/videocodec/VideoDecoder.cpp0000644000175000017500000002635011171057001024216 0ustar yavoryavor/******************************************************** Video decoder implementation Copyright 2000 Eugene Kuznetsov (divx@euro.ru) *********************************************************/ #include "wine/windef.h" #include "avm_fourcc.h" #include "avm_cpuinfo.h" #include "avm_output.h" #include "VideoDecoder.h" #include "VideoEncoder.h" #include "dshow/DS_Filter.h" #include #include #include #include #include #include #include // labs #include #define ICDECOMPRESS_HURRYUP 0x80000000 /* don't draw just buffer (hurry up!) */ #define ICDECOMPRESS_UPDATE 0x40000000 /* don't draw just update screen */ #define ICDECOMPRESS_PREROL 0x20000000 /* this frame is before real start */ #define ICDECOMPRESS_NOTKEYFRAME 0x08000000 /* this frame is not a key frame */ AVM_BEGIN_NAMESPACE; VideoDecoder::VideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& bh, int flip) :IVideoDecoder(info, bh), m_pModule(0), m_HIC(0), m_iStatus(0), m_pLastImage(0), m_bitrick(0), m_divx_trick(false), m_bUseEx((info.kind == CodecInfo::Win32Ex)), m_bFlip(flip) { } int VideoDecoder::init() { /* On2 Truemotion VP3.x support */ ICINFO ici; // // MPEG-4 format has changed during development. Package // binaries.zip includes mpg4c32.dll - old MPEG-4 codec // with unlocked compression - and divxc32.dll, // which differs from current MPEG-4 only by FOURCC's. // The problem is to identify which is needed to us, // because 'old' codec doesn't work with 'new' clips and // vice versa. Unfortunately, they may simulate correct // work until the moment of actual decompression. Then, // you'll receive garbled picture and lots of warnings about // hr=-100. // // I've got old video with fccHandler mp43 and biCompression MPG4. // Dirk Vornheider sent me old video with both values MP42. //AVM_WRITE("Win32 video decoder", "BI %d %.4s\n", m_pFormat->biBitCount, (char*)&m_pFormat->biBitCount); m_pModule = control.Create(m_Info); if (!m_pModule) { AVM_WRITE("Win32 video decoder", "Can't create module\n"); return -1; } m_HIC = m_pModule->CreateHandle(m_pFormat->biCompression, Module::Decompress); if (!m_HIC) { AVM_WRITE("Win32 video decoder", "ICOpen failed\n"); return -1; } int hr = ICDecompressGetFormat(m_HIC, m_pFormat, 0); if (hr <= 0) { AVM_WRITE("Win32 video decoder", "ICDecompressGetFormatSize failed\n"); return -1; } if (hr < (int)sizeof(BitmapInfo)) hr = sizeof(BitmapInfo); m_Dest.SetBits(24); m_bitrick = (BITMAPINFOHEADER*) malloc(hr); // ok I guess Xvid people brinks here another interesting // aspect - we are asking for some format but we already // have to pass one here!!! memset(m_bitrick, 0, hr); memcpy(m_bitrick, &m_Dest, sizeof(BITMAPINFOHEADER)); m_bitrick->biHeight = labs(m_Dest.biHeight); // xvid trick hr = ICDecompressGetFormat(m_HIC, m_pFormat, m_bitrick); if (hr != 0) { AVM_WRITE("Win32 video decoder", "Declined format dump:\n"); BitmapInfo(*m_pFormat).Print(); m_Dest.Print(); AVM_WRITE("Win32 video decoder", " ICDecompressGetFormat failed Error %d\n", hr); return -1; } switch (m_Info.fourcc) { case fccCRAM: //if (m_pFormat->biCompression != fccMSVC) // break; case fccCVID: case fccIV31: case fccIV32: case fccTSCC: m_bLastNeeded = true; break; default: m_bLastNeeded = false; } hr = ICGetInfo(m_HIC, &ici); // this might be good to use but many codecs returns false info here //if (hr && !(ici.dwFlags & VIDCF_FASTTEMPORALD)) m_bLastNeeded = true; switch (m_Info.fourcc) { case fccIV31: case fccIV32: m_Dest.SetBits(16); // doesn't support 24bit RGB break; case fccTSCC: m_Dest.SetBits(15); // doesn't support 24bit RGB break; case fccZLIB: case fccMSZH: case fccASV1: case fccASV2: case mmioFOURCC('A', 'V', 'R', 'n'): m_bFlip = 1; // these codecs are using always top-down RGB /* fall through */ default: m_Dest.SetBits(24); } if (m_bFlip) m_Dest.biHeight = labs(m_Dest.biHeight); else { setDecoder(m_Dest); hr = (m_bUseEx) ? ICUniversalEx(m_HIC, ICM_DECOMPRESSEX_QUERY, 0, m_pFormat, 0, m_bitrick, 0) : ICDecompressQuery(m_HIC, m_pFormat, m_bitrick); if (hr) { m_Dest.biHeight = labs(m_Dest.biHeight); AVM_WRITE("Win32 video decoder", "Decoder does not support upside-down RGB frames\n"); } } setDecoder(m_Dest); m_Caps = CAP_NONE; switch (m_Info.fourcc) { case fccDIV3: case fccDIV4: case fccDIV5: case fccDIV6: case fccMP42: // only needed for some older codecs m_Caps = (CAPS) (CAP_YUY2 | CAP_UYVY | CAP_YVYU); //planar formats broken, others untested m_divx_trick = true; break; case fccHFYU: if (m_pFormat->biSize == 232) { m_Caps = CAP_YUY2; //m_Dest.SetSpace(fccYUY2); break; } // fall through for RGB mode default: { static const struct ct { fourcc_t fcc; CAPS cap; } check[] = { { fccIYUV, CAP_IYUV }, { fccUYVY, CAP_UYVY }, { fccYV12, CAP_YV12 }, { fccYVYU, CAP_YVYU }, { fccYUY2, CAP_YUY2 }, { fccI420, CAP_I420 }, { fccYVU9, CAP_YVU9 }, // anyone heard about MTX6 ?? { 0, CAP_NONE } }; BitmapInfo mbi(m_Dest); for (const ct* c = check; c->fcc; c++) { mbi.SetSpace(c->fcc); setDecoder(mbi); hr = (m_bUseEx) ? ICUniversalEx(m_HIC, ICM_DECOMPRESSEX_QUERY, 0, m_pFormat, 0, m_bitrick, 0) : ICDecompressQuery(m_HIC, m_pFormat, m_bitrick); //printf ("TEST %.4s %d\n", (char*)&(c->fcc), h); if (hr == 0) m_Caps = (CAPS)(m_Caps | c->cap); } // exceptions if (m_Info.fourcc == fccMJPG && strcmp(m_Info.dll.c_str(), "m3jpeg32.dll") == 0) { // YV12 works but incorrectly - it's I420 m_Caps = (CAPS) (m_Caps & ~CAP_YV12); } setDecoder(m_Dest); } } if (m_Caps) AVM_WRITE("Win32 video decoder", "Decoder is capable of YUV output ( flags 0x%x)\n", (int)m_Caps); return 0; } VideoDecoder::~VideoDecoder() { Stop(); if (m_bitrick) free(m_bitrick); if (m_pModule) m_pModule->CloseHandle(m_HIC); } int VideoDecoder::Start() { if (m_iStatus == 1) return 0; #if 0 AVM_WRITE("Win32 video decoder", "Starting decompression, format: \n"); BitmapInfo(m_Dest).Print(); //AVM_WRITE("Win32 video decoder", "Dest fmt:\n"); //BitmapInfo(m_decoder).Print(); #endif int tmpcomp = m_bitrick->biCompression; if (m_divx_trick) m_bitrick->biCompression = 0; /* On2 Truemotion VP3.x support */ int hr = (m_bUseEx) ? ICUniversalEx(m_HIC, ICM_DECOMPRESSEX_BEGIN, 0, m_pFormat, 0, m_bitrick, 0) : ICDecompressBegin(m_HIC, m_pFormat, m_bitrick); m_bitrick->biCompression = tmpcomp; //AVM_WRITE("Win32 video decoder", "DECODER COMPRESSSION %.4s\n", (char*)&m_decoder.biCompression); if (hr != 0 && (hr != -2 || m_Info.fourcc != fccMJPG)) { // FIXME MJPG decoder (m3jpeg32.dll) returns -2 // if anyone knows why - please fix it.... //BitmapInfo(*m_pFormat).Print(); //AVM_WRITE("Win32 video decoder", "Dest fmt:\n"); //BitmapInfo(m_decoder).Print(); AVM_WRITE("Win32 video decoder", "WARNING: ICDecompressBegin() failed ( shouldn't happen ), hr=%d (%s)\n", (int)hr, ((hr == ICERR_BADFORMAT) ? "Bad Format)" : "?)")); return -1; } m_iStatus = 1; return 0; } int VideoDecoder::Stop() { if (m_iStatus) { int r = ICDecompressEnd(m_HIC); if (r != 0) AVM_WRITE("Win32 video decoder", "WARNING: ICDecompressEnd() failed ( shouldn't happen ), hr=%d\n", r); m_iStatus = 0; } return 0; } int VideoDecoder::DecodeFrame(CImage* dest, const void* src, size_t size, int is_keyframe, bool render, CImage** pOut) { CImage* tmp = 0; int hr; //printf("DECODERNOMAR\n"); m_Dest.Print(); dest->GetFmt()->Print(); uint8_t* d = (dest) ? dest->Data() : 0; int flg = ((is_keyframe) ? 0 : ICDECOMPRESS_NOTKEYFRAME) | ((dest && render) ? 0 : ICDECOMPRESS_HURRYUP/*|ICDECOMPRESS_PREROL*/); if (!m_iStatus) return -1; if (m_bLastNeeded) { if (!dest || !dest->IsFmt(&m_Dest)) { if (!m_pLastImage) m_pLastImage = new CImage(&m_Dest); if (dest) d = m_pLastImage->Data(); } else { if (m_pLastImage) { if (1 || !is_keyframe) { // unfortunately for reconstructed files // we can't recognize keyframes for them //printf("Copy prev last %p %p\n", dest, m_pLastImage); dest->Convert(m_pLastImage); } m_pLastImage->Release(); } dest->AddRef(); m_pLastImage = dest; } } //AVM_WRITE("Win32 video decoder", "PTR %p src: %p size: %d kf: %d\n", dest->Data(), src, size, is_keyframe); setDecoder(m_Dest); m_pFormat->biSizeImage = size; hr = (m_bUseEx) ? ICUniversalEx(m_HIC, ICM_DECOMPRESSEX, flg, m_pFormat, (void*) src, m_bitrick, d) : ICDecompress(m_HIC, flg, m_pFormat, (void*) src, m_bitrick, d); if (dest) { if (hr) AVM_WRITE("Win32 video decoder", "VideoDecoder: warning: hr=%d\n", hr); else if (m_bLastNeeded && dest && d != dest->Data()) dest->Convert(m_pLastImage); } return hr; } int VideoDecoder::SetDestFmt(int bits, fourcc_t csp) { if (!CImage::Supported(csp, bits)) return -1; switch (m_Info.fourcc) { case fccIV31: case fccIV32: return -1; } BitmapInfo tmpbi(m_Dest); AVM_WRITE("Win32 video decoder", 1, "SetDestFmt bits: %d csp: %.4s\n", bits, (const char*)&csp); if (bits) { switch (bits) { case 15: case 16: case 24: case 32: // 16bit ??? if (m_Info.fourcc_array[0] == fccMJPG) // m_Dest.biSize=0x28; // FIXME - use one routine to setup biHeight!!! m_Dest.SetBits(bits); switch (m_Info.fourcc) { case fccASV1: case fccASV2: m_Dest.biHeight = labs(m_Dest.biHeight); // these codecs produce upside down RGB images break; } break; default: return -1; } } else m_Dest.SetSpace(csp); Stop(); // note i263 is able to produce downside-up down image for YUY2 setDecoder(m_Dest); int tmpcomp = m_bitrick->biCompression; if (m_divx_trick) m_bitrick->biCompression = 0; int hr = (m_bUseEx) ? ICUniversalEx(m_HIC, ICM_DECOMPRESSEX_QUERY, 0, m_pFormat, 0, m_bitrick, 0) : ICDecompressQuery(m_HIC, m_pFormat, m_bitrick); //m_bitrick.Print(); //BitmapInfo tmx((BitmapInfo*)m_pFormat); m_bitrick->biCompression = tmpcomp; if (hr != 0) { if (csp) { AVM_WRITE("Win32 video decoder", "WARNING: Unsupported color space 0x%x (%.4s)\n", csp, (char*)&csp); } else AVM_WRITE("Win32 video decoder", "WARNING: Unsupported bit depth: %d\n", bits); m_Dest = tmpbi; m_Dest.Print(); setDecoder(m_Dest); } Start(); return (hr == 0) ? 0 : -1; } void VideoDecoder::setDecoder(BitmapInfo& bi) { // persistent biSize memcpy((char*)m_bitrick + 4, (char*)&bi + 4, sizeof(BitmapInfo) - 4); m_bitrick->biSize = 40; switch (m_Info.fourcc) { case fccXVID: //if (m_bitrick->biCompression == 0 || m_bitrick->biCompression == 3) // break; // XviD doesn't like biHeight < 0 even for YUV surfaces break; } } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/plugins/libwin32/videocodec/VideoDecoder.h0000644000175000017500000000216211167204733023671 0ustar yavoryavor#ifndef AVIFILE_VIDEODECODER_H #define AVIFILE_VIDEODECODER_H /******************************************************** Video decoder interface Copyright 2000 Eugene Kuznetsov (divx@euro.ru) *********************************************************/ #include "videodecoder.h" #include "Module.h" AVM_BEGIN_NAMESPACE; class VideoDecoder: public IVideoDecoder { public: VideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& format, int flip); virtual ~VideoDecoder(); virtual int DecodeFrame(CImage* dest, const void* src, size_t size, int is_keyframe, bool render = true, CImage** pOut = 0); virtual CAPS GetCapabilities() const { return m_Caps; } virtual int SetDestFmt(int bits = 24, fourcc_t csp = 0); virtual int Start(); virtual int Stop(); int init(); protected: Module* m_pModule; HIC m_HIC; CAPS m_Caps; int m_iStatus; CImage* m_pLastImage; BITMAPINFOHEADER* m_bitrick; bool m_bLastNeeded; bool m_divx_trick; bool m_bUseEx; bool m_bFlip; void setDecoder(BitmapInfo& bi); }; AVM_END_NAMESPACE; #endif //AVIFILE_VIDEODECODER_H avifile-0.7.48~20090503.ds/plugins/libwin32/videocodec/VideoEncoder.cpp0000644000175000017500000003513311171057001024227 0ustar yavoryavor/******************************************************** Video encoder implementation Copyright 2000 Eugene Kuznetsov (divx@euro.ru) *********************************************************/ #include "wine/windef.h" #include "wine/winreg.h" #include "image.h" #include "avm_fourcc.h" //#define TIMING #include "avm_output.h" //#undef TIMING #ifdef TIMING #include "cpuinfo.h" #endif #include "VideoEncoder.h" #include "registry.h" #if 0 struct ICINFO { long dwSize; /* 00: */ long fccType; /* 04:compressor type 'vidc' 'audc' */ long fccHandler; /* 08:compressor sub-type 'rle ' 'jpeg' 'pcm '*/ long dwFlags; /* 0c:flags LOshort is type specific */ long dwVersion; /* 10:version of the driver */ long dwVersionICM; /* 14:version of the ICM used */ /* * under Win32, the driver always returns UNICODE strings. */ short szName[16]; /* 18:short name */ short szDescription[128]; /* 38:long name */ short szDriver[128]; /* 138:driver that contains compressor*/ /* 238: */ /* Applicable flags. Zero or more of the following flags can be set: VIDCF_COMPRESSFRAMES Driver is requesting to compress all frames. For information about compressing all frames, see the ICM_COMPRESS_FRAMES_INFO message. VIDCF_CRUNCH Driver supports compressing to a frame size. VIDCF_DRAW Driver supports drawing. VIDCF_FASTTEMPORALC Driver can perform temporal compression and maintains its own copy of the current frame. When compressing a stream of frame data, the driver doesn't need image data from the previous frame. VIDCF_FASTTEMPORALD Driver can perform temporal decompression and maintains its own copy of the current frame. When decompressing a stream of frame data, the driver doesn't need image data from the previous frame. VIDCF_QUALITY Driver supports quality values. VIDCF_TEMPORAL Driver supports inter-frame compression */ }; #endif #include #include #include #include #include AVM_BEGIN_NAMESPACE; VideoEncoder::VideoEncoder(const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& format) :IVideoEncoder(info), m_pModule(0), m_HIC(0), m_bh(0), m_bhorig(0), m_obh(0), m_prev(0), m_pConfigData(0), m_iConfigDataSize(0), m_iState(0), m_iBitrate(910000), m_fFps(25.0) { unsigned bihs = (format.biSize < (int) sizeof(BITMAPINFO)) ? sizeof(BITMAPINFO) : format.biSize; m_bh = (BitmapInfo*) malloc(bihs); memcpy(m_bh, &format, bihs); m_bhorig = (BitmapInfo*) malloc(bihs); memcpy(m_bhorig, &format, bihs); m_bh->biHeight = labs(m_bh->biHeight); if (m_bhorig->biCompression == BI_RGB || m_bhorig->biCompression == BI_BITFIELDS) // only bottom-up RGB images m_bhorig->biHeight = labs(m_bhorig->biHeight); switch (compressor) { case fccMP41: case fccMP43: compressor = fccDIV3; break; } m_comp_id = compressor; } int VideoEncoder::init() { m_pModule = control.Create(m_Info); if (!m_pModule) return -1; m_HIC = m_pModule->CreateHandle(m_comp_id, Module::Compress); if (!m_HIC) return -1; int r = ICCompressGetFormat(m_HIC, m_bh, 0); if (r < 0) { AVM_WRITE("VideoEncoder", "Can't handle this format\n"); return -1; } //printf("Format size %d\n", r); m_obh = (BITMAPINFOHEADER*) malloc(r); memset(m_obh, 0, r); m_obh->biSize = r; r = ICCompressGetFormat(m_HIC, m_bh, m_obh); if (r != 0) { AVM_WRITE("VideoEncoder", "Can't handle this format\n"); return -1; } m_obh->biHeight = labs(m_obh->biHeight); m_obh->biBitCount = m_bh->biBitCount; m_iState = 1; // test if it really works if (Start() != 0) { AVM_WRITE("VideoEncoder", "WARNING: CompressBegin failed ( probably unsupported input format %d )\n", r); return -1; } Stop(); // Save configuration state. // // Ordinarily, we wouldn't do this, but there seems to be a bug in // the Microsoft MPEG-4 compressor that causes it to reset its // configuration data after a compression session. This occurs // in all versions from V1 through V3. // // Stupid fscking Matrox driver returns -1!!! m_iConfigDataSize = ICGetState(m_HIC, 0, 0); if (m_iConfigDataSize > 0) { m_pConfigData = (char*) malloc(m_iConfigDataSize); //printf("****************** %d\n", m_iConfigDataSize); m_iConfigDataSize = ICGetState(m_HIC, m_pConfigData, m_iConfigDataSize); // As odd as this may seem, if this isn't done, then the Indeo5 // compressor won't allow data rate control until the next // compression operation! if (m_iConfigDataSize) ICSetState(m_HIC, m_pConfigData, m_iConfigDataSize); } return 0; } VideoEncoder::~VideoEncoder() { if (m_iState != 1) Stop(); if (m_pModule) m_pModule->CloseHandle(m_HIC); if (m_bh) free(m_bh); if (m_bhorig) free(m_bhorig); if (m_obh) free(m_obh); if (m_prev) free(m_prev); if (m_pConfigData) free(m_pConfigData); } int VideoEncoder::EncodeFrame(const CImage* src, void* dest, int* is_keyframe, size_t* size, int* lpckid) { if (m_iState != 2) return -1; #ifdef TIMING st1=localcount(); #endif CImage* temp = (src->IsFmt(m_bhorig)) ? 0 : new CImage(src, m_bhorig); *is_keyframe = 0; if (m_iKeyRate && (m_iFrameNum - m_iLastKF) > m_iKeyRate) { *is_keyframe = ICCOMPRESS_KEYFRAME; // force KF if too long there wasn't one //printf("FORCING KEFRAME %d %d\n", m_iFrameNum, m_iLastKF); } int r = ICCompress(m_HIC, *is_keyframe, m_obh, dest, m_bh, temp ? (void*)temp->Data() : (void*)src->Data(), (long*)lpckid, (long*)is_keyframe, m_iFrameNum, m_iFrameNum ? 0 : 0x7fffffff, m_iQuality, (is_keyframe) ? 0 : m_bh, (is_keyframe) ? 0 : m_prev); printf("==> hr:%d rest:%d fnum:%d 0x%x\n", r, m_iFrameNum%m_iKeyRate, m_iFrameNum, *is_keyframe); if (temp) temp->Release(); *is_keyframe &= 0x10; if (*is_keyframe) m_iLastKF = m_iFrameNum; if (r == 0) { //if(m_prev==0)m_prev=new char[m_bh->biSizeImage]; //memcpy(m_prev, src, m_bh->biSizeImage); if (!m_prev) m_prev = (char*) malloc(ICCompressGetSize(m_HIC, m_bh, m_obh)); memcpy(m_prev, dest, m_obh->biSizeImage); #if 0 // If we're using a compressor with a stupid algorithm (Microsoft Video 1), // we have to decompress the frame again to compress the next one.... if (res==ICERR_OK && pPrevBuffer && (!lKeyRate || lKeyRateCounter>1)) { res = ICDecompress(hic, dwFlags & AVIIF_KEYFRAME ? 0 : ICDECOMPRESS_NOTKEYFRAME, (LPBITMAPINFOHEADER)pbiOutput, pOutputBuffer, (LPBITMAPINFOHEADER)pbiInput, pPrevBuffer); } #endif } m_iFrameNum++; if (size) *size = m_obh->biSizeImage; return r; } int VideoEncoder::Start() { if (m_iState != 1) return -1;//wrong state //HRESULT hr=ICCompressBegin(hic, m_bh, m_obh); ICINFO ici; int r = ICGetInfo(m_HIC, &ici); if (!r) { AVM_WRITE("Win32 video encoder", "Unable to retrieve video compressor info!"); } if (!(ici.dwFlags & VIDCF_QUALITY)) m_iQuality = 0; else ICGetDefaultQuality(m_HIC, &m_iQuality); if (ICGetDefaultKeyFrameRate(m_HIC, &m_iKeyRate) != 0) m_iKeyRate = 0xFFFF; printf("KEYRATE %d\n", m_iKeyRate); m_iKeyRate = 100; #if 0 AVM_WRITE("Win32 video encoder", "ICINFO dwSize:%ld fccType:%.4s fccHandler:%.4s\n" " dwFlags:0x%lx version:%d versionICM:%d\n", //" name:%s descrition:%s driver:%s\n", ici.dwSize, (char*)&ici.fccType, (char*)&ici.fccHandler, ici.dwFlags, ici.dwVersion, ici.dwVersionICM //,ici.szName, ici.szDescription, ici.szDriver ); #endif if (ici.dwFlags & VIDCF_TEMPORAL) { if (!(ici.dwFlags & VIDCF_FASTTEMPORALC)) { // Allocate backbuffer //throw FATAL("BACKBUFFER needed - implement me!!"); //if (!(pPrevBuffer = new char[pbiInput->bmiHeader.biSizeImage])) // throw MyMemoryError(); } } if (m_bh->biSizeImage == 0) m_bh->biSizeImage = m_bh->biWidth*labs(m_bh->biHeight)*((m_bh->biBitCount+7)/8); // Make sure that we can work with this format! AVM_WRITE("Win32 video encoder", "W32 Quality %d KeyFrames: %d BitRate: %d\n", m_iQuality, m_iKeyRate, m_iBitrate); setDivXRegs(); ICCOMPRESSFRAMES icf; memset(&icf, 0, sizeof icf); // ICM_COMPRESS_FRAMES_INFO: // // dwFlags Trashed with address of lKeyRate in tests. Something // might be looking for a non-zero value here, so better // set it. // lpbiOutput NULL. // lOutput 0. // lpbiInput NULL. // lInput 0. (reserved) // lStartFrame 0. // lFrameCount Number of frames. // lQuality Set to quality factor, or zero if not supported. // lDataRate Set to data rate in 1024*kilobytes, or zero if not // supported. // lKeyRate Set to the desired maximum keyframe interval. For // all keyframes, set to 1. icf.dwFlags = (long)&icf.lKeyRate; icf.lStartFrame = 0; icf.lFrameCount = 0x0FFFFFFF; icf.lQuality = m_iQuality; icf.lDataRate = m_iBitrate * 1000 / 1024; icf.lKeyRate = (m_iKeyRate > 0) ? 0 * m_iKeyRate : 0; icf.dwRate = 1000000; icf.dwScale = (int) (icf.dwRate / m_fFps); //printf("SETTING BITRATE B:%ld K:%ld Q:%d %ld / %f s:%ld\n", icf.lDataRate, m_iKeyRate, m_iQuality, icf.dwRate, m_fFps, icf.dwScale); ICCompressFramesInfo(m_HIC, &icf); r = ICCompressBegin(m_HIC, m_bh, m_obh); if (r != 0) { AVM_WRITE("Win32 video encoder", "ICCompressBegin() failed ( shouldn't happen ), error code %d\n", (int)r); return -1; } m_iLastKF = m_iFrameNum = 0; m_iState = 2; //AVM_WRITE("Win32 video encoder", "START done\n"); return 0; } int VideoEncoder::Stop() { if (m_iState == 2) { //AVM_WRITE("Win32 video encoder", "STOP\n"); int r = ICCompressEnd(m_HIC); if (r != 0) AVM_WRITE("Win32 video encoder", "ICCompressEnd() failed ( shouldn't happen ), error code %d\n", (int)r); m_iState = 1; // Reset MPEG-4 compressor if (m_pConfigData && m_iConfigDataSize) ICSetState(m_HIC, m_pConfigData, m_iConfigDataSize); } return 0; } const BITMAPINFOHEADER& VideoEncoder::GetOutputFormat() const { return *m_obh; // maybe this is correct } size_t VideoEncoder::GetOutputSize() const { int lMaxPackedSize = ICCompressGetSize(m_HIC, m_bh, m_obh); // Work around a bug in Huffyuv. Ben tried to save some memory // and specified a "near-worst-case" bound in the codec instead // of the actual worst case bound. Unfortunately, it's actually // not that hard to exceed the m_HIC's estimate with noisy // captures -- the most common way is accidentally capturing // static from a non-existent channel. // // According to the 2.1.1 comments, Huffyuv uses worst-case // values of 24-bpp for YUY2/UYVY and 40-bpp for RGB, while the // actual worst case values are 43 and 51. We'll compute the // 43/51 value, and use the higher of the two. if (m_Info.fourcc == fccHFYU) { int lRealMaxPackedSize = m_obh->biWidth * m_obh->biHeight; if (m_bh->biCompression == 0)//BI_RGB lRealMaxPackedSize = (lRealMaxPackedSize * 51) >> 3; else lRealMaxPackedSize = (lRealMaxPackedSize * 43) >> 3; if (lRealMaxPackedSize > lMaxPackedSize) lMaxPackedSize = lRealMaxPackedSize; } //printf("VideoEncoder::GetOutputSize() %d\n", lMaxPackedSize); return lMaxPackedSize; } int VideoEncoder::SetQuality(int quality) { int newkey; if (quality < 0 || quality >10000) return -1; m_iQuality = quality; //printf("SETQUALITY %d\n", m_iQuality); #if 0 if (RegCreateKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Scrunch\\Video", 0, 0, 0, 0, 0, &newkey, 0) == 0) { RegSetValueExA(newkey, "Quality", 0, REG_DWORD, &quality, 4); } #endif return 0; } int VideoEncoder::SetKeyFrame(int freq) { if (freq <= 0) return -1; m_iKeyRate = freq; //printf("SETKeyFrame %d\n", m_iKeyRate); return 0; } int VideoEncoder::SetFps(float fps) { if (fps <= 0. || fps > 100.) return -1; m_fFps = fps; return 0; } void VideoEncoder::setDivXRegs(void) { const char* keyname; const char* name = m_Info.dll.c_str(); int newkey; int bitrate; int keyframes = 100; int crispness = 100; int count = 4; if (strcmp(name, "divxc32.dll") == 0) keyname = "Software\\LinuxLoader\\div3"; else if (strcmp(name, "divxc32f.dll") == 0) keyname = "Software\\LinuxLoader\\div4"; else if (strcmp(name, "divxcvki.dll") == 0) keyname = "Software\\LinuxLoader\\div5"; else if (strcmp(name, "divxcfvk.dll") == 0) keyname = "Software\\LinuxLoader\\div6"; else return; printf("KEYNAME %s %s\n", name, keyname); if (RegOpenKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, &newkey) == 0) { // location in original win32 codec //The Bit Rate at AC6 //The Quality/Cripness at 1EA8 //The Keyframes at 1EAF //printf("sethandle %s\n", keyname); char* handle = (char*) m_pModule->GetLibHandle(); if (RegQueryValueExA(newkey, "BitRate", 0, 0, &m_iBitrate, &count) == 0) { if (handle) { double d = *(double*)(handle + 0x14c0); *(double*)(handle + 0x14c0) = m_iBitrate; AVM_WRITE("Win32 video encoder", "BitRate %d (old: %d)\n", m_iBitrate, (int) d); } bitrate = m_iBitrate; m_iBitrate *= 1000; } else AVM_WRITE("Win32 video encoder", "No 'BitRate' value present\n"); if (RegQueryValueExA(newkey, "Crispness", 0, 0, &crispness, &count) == 0) { if (handle) { int a = *(char*)(handle + 0x28a8); // *(long*)(handle + 0x28a8) = crispness; } //printf("Crispness %d (%d)\n", crispness, a); } if (RegQueryValueExA(newkey, "KeyFrames", 0, 0, &keyframes, &count) == 0) { if (handle) { int a = *(char*)(handle + 0x28af); //0x28af *(long*)(handle + 0x28af) = keyframes; printf("KeyFrames %d (%d)\n", keyframes, a); } m_iKeyRate = keyframes; } RegCloseKey(newkey); } else AVM_WRITE("Win32 video encoder", "Could not open key %s\n", keyname); #if 0 if (RegCreateKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Scrunch\\Video", 0, 0, 0, 0, 0, &newkey, 0) == 0) { RegSetValueExA(newkey, "BitRate", 0, REG_DWORD, &bitrate, 4); RegSetValueExA(newkey, "KeyFrames", 0, REG_DWORD, &keyframes, 4); //RegSetValueExA(newkey, "Quality", 0, REG_DWORD, &crispness, 4); } RegCloseKey(newkey); #endif } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/plugins/libwin32/videocodec/VideoEncoder.h0000644000175000017500000000365411167340246023712 0ustar yavoryavor#ifndef __VIDEOENCODER_H #define __VIDEOENCODER_H /******************************************************** Video encoder interface Copyright 2000 Eugene Kuznetsov (divx@euro.ru) *********************************************************/ #include "videoencoder.h" #include "Module.h" AVM_BEGIN_NAMESPACE; class VideoEncoder: public IVideoEncoder { public: VideoEncoder(const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& header); ~VideoEncoder(); // // Encodes single frame // On success, is_keyframe contains 0 if frame was encoded into delta frame, otherwise AVIIF_KEYFRAME (?) // size receives size of compressed frame // virtual int EncodeFrame(const CImage* src, void* dest, int* is_keyframe, size_t* size, int* lpckid = 0); // // Queries encoder about desired buffer size for compression // You should allocate at least this much bytes for dest ( arg for EncodeFrame ) // virtual const BITMAPINFOHEADER& GetOutputFormat() const; virtual size_t GetOutputSize() const; virtual int Start(); virtual int Stop(); // // Quality takes values from 0 to 10000, 10000 the best // virtual int GetQuality() const { return m_iQuality; } virtual int SetQuality(int quality); virtual int GetKeyFrame() const { return m_iKeyRate; } virtual int SetKeyFrame(int frequency); virtual float GetFps() const { return m_fFps; } virtual int SetFps(float fps); int init(); // avoid throws protected: void setDivXRegs(void); Module* m_pModule; HIC m_HIC; BitmapInfo* m_bh; BitmapInfo* m_bhorig; BITMAPINFOHEADER* m_obh; BITMAPINFOHEADER* m_obhformat; char* m_prev; char* m_pConfigData; int m_iConfigDataSize; int m_comp_id; int m_iState; int m_iFrameNum; int m_iQuality; int m_iKeyRate; int m_iBitrate; int m_iLastKF; float m_fFps; }; AVM_END_NAMESPACE; #endif // __VIDEOENCODER_H avifile-0.7.48~20090503.ds/plugins/libxvid/0000755000175000017500000000000011267646347017103 5ustar yavoryavoravifile-0.7.48~20090503.ds/plugins/libxvid/Makefile.am0000644000175000017500000000045711110406017021114 0ustar yavoryavorif AMM_USE_XVID pkglib_LTLIBRARIES = xvid.la endif noinst_HEADERS = fillplugins.h xvid_la_SOURCES = xvid.cpp xvid_la_LDFLAGS = -avoid-version -module xvid_la_LIBADD = ../../lib/libaviplay.la $(XVID_LIBS) AM_CPPFLAGS = $(XVID_CFLAGS) AM_CXXFLAGS = $(CXXRTTIEXCEPT) MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libxvid/fillplugins.h0000644000175000017500000001163010746721716021600 0ustar yavoryavor#ifndef XVID_FILLPLUGINS_H #define XVID_FILLPLUGINS_H #include "infotypes.h" #include "avm_fourcc.h" #ifdef HAVE_LIBXVIDCORE #include "xvid.h" #endif AVM_BEGIN_NAMESPACE; #define XVIDCSTR(name) \ static const char* xvidstr_ ## name = #name XVIDCSTR(mode); XVIDCSTR(rc_bitrate); XVIDCSTR(rc_period); XVIDCSTR(rc_reaction_period); XVIDCSTR(rc_reaction_ratio); XVIDCSTR(rc_buffer); XVIDCSTR(min_quantizer); XVIDCSTR(max_quantizer); XVIDCSTR(max_key_interval); XVIDCSTR(motion_search); XVIDCSTR(halfpel); XVIDCSTR(lum_masking); XVIDCSTR(interlacing); XVIDCSTR(quant_type); #if API_VERSION >= ((2 << 16) | (1)) XVIDCSTR(inter4v); XVIDCSTR(diamond_search); XVIDCSTR(adaptive_quant); #endif #if 0 XVIDCSTR(me_zero); XVIDCSTR(me_logarithmic); XVIDCSTR(me_fullsearch); #endif XVIDCSTR(me_pmvfast); XVIDCSTR(me_epzs); XVIDCSTR(postprocessing); XVIDCSTR(maxauto); static void xvid_FillPlugins(avm::vector& ci) { const char* xvid_about = "XviD MPEG-4 video codec"; const fourcc_t xvid_codecs[] = { fccDIVX, fccdivx, RIFFINFO_XVID, RIFFINFO_XviD, RIFFINFO_xvid, 4, fccDX50, fccdx50, 0 }; const char* const xvid_passopt[] = { "1Pass-CBR", "1Pass-quality", "1Pass-quantizer", "2Pass-1stPass", "2Pass-2ndPassExt", "2Pass-2ndPassInt", 0 }; const char* const xvid_quantopt[] = { "H.263", "MPEG-4", // not used in source "Adaptive", 0 }; // it looks like XviD doesn't support postprocessing for now avm::vector ds; //ds.push_back(AttributeInfo(xvidstr_maxauto, "Maxauto - unsupported", // AttributeInfo::Integer, -1, -1)); // FIFO order is important - if this will ever change - few things // would have to be repaired avm::vector vs; vs.push_back(AttributeInfo(xvidstr_mode, "Mode", xvid_passopt)); vs.push_back(AttributeInfo(xvidstr_rc_bitrate, "Desired stream bitrate in bits/second", AttributeInfo::Integer, 0, 10000000, 800000)); vs.push_back(AttributeInfo(xvidstr_motion_search, "Motion search ( 6 - Ultra high )", AttributeInfo::Integer, 0, 6, 6)); vs.push_back(AttributeInfo(xvidstr_quant_type, "Quantization type", xvid_quantopt)); #if API_VERSION >= ((2 << 16) | (1)) vs.push_back(AttributeInfo(xvidstr_inter4v, "4 vectors per 16x16 block", AttributeInfo::Integer, 0, 1)); vs.push_back(AttributeInfo(xvidstr_diamond_search, "Diamond search", AttributeInfo::Integer, 0, 1)); vs.push_back(AttributeInfo(xvidstr_adaptive_quant, "Adaptive quantisation", AttributeInfo::Integer, 0, 1)); #endif #if API_VERSION >= (2 << 16) vs.push_back(AttributeInfo(xvidstr_halfpel, "Halfpel interpolation", AttributeInfo::Integer, 0, 1)); vs.push_back(AttributeInfo(xvidstr_rc_buffer, "Rate control buffer size", AttributeInfo::Integer, 0, 10000, 20)); vs.push_back(AttributeInfo(xvidstr_interlacing, "Interlacing", AttributeInfo::Integer, 0, 1)); #if 0 // one day they might be enabled vs.push_back(AttributeInfo(xvidstr_me_zero, "Motion estimation ZERO", AttributeInfo::Integer, 0, 1)); vs.push_back(AttributeInfo(xvidstr_me_logarithmic, "Motion estimation LOGARITHMIC", AttributeInfo::Integer, 0, 1)); vs.push_back(AttributeInfo(xvidstr_me_fullsearch, "Motion estimation FULLSEARCH", AttributeInfo::Integer, 0, 1)); #endif // undefined vs.push_back(AttributeInfo(xvidstr_me_pmvfast, "Motion estimation PMVFAST", AttributeInfo::Integer, 0, 1)); #ifdef XVID_ME_EPZS vs.push_back(AttributeInfo(xvidstr_me_epzs, "Motion estimation EPZS", AttributeInfo::Integer, 0, 1)); #endif #else vs.push_back(AttributeInfo(xvidstr_rc_period, "Rate control averaging period", AttributeInfo::Integer, 0, 10000, 2000)); vs.push_back(AttributeInfo(xvidstr_rc_reaction_period, "Rate control reaction period", AttributeInfo::Integer, 0, 100, 10)); vs.push_back(AttributeInfo(xvidstr_rc_reaction_ratio, "Rate control motion sensitivity", AttributeInfo::Integer, 0, 100, 20)); #endif vs.push_back(AttributeInfo(xvidstr_min_quantizer, "Minimum quantizer", AttributeInfo::Integer, 1, 31, 1)); vs.push_back(AttributeInfo(xvidstr_max_quantizer, "Maximum quantizer", AttributeInfo::Integer, 1, 31, 16)); vs.push_back(AttributeInfo(xvidstr_max_key_interval, "Maximum keyframe interval", AttributeInfo::Integer, 1, 500, 100)); vs.push_back(AttributeInfo(xvidstr_lum_masking, "Luminance masking", AttributeInfo::Integer, 0, 1)); ci.push_back(CodecInfo(xvid_codecs, "XviD", "", xvid_about, CodecInfo::Plugin, "xvid", CodecInfo::Video, CodecInfo::Both, 0, vs, ds)); } AVM_END_NAMESPACE; #endif // XVID_FILLPLUGINS_H avifile-0.7.48~20090503.ds/plugins/libxvid/xvid.cpp0000644000175000017500000003042211167340246020546 0ustar yavoryavor#include "fillplugins.h" #include "xvid.h" #include "videodecoder.h" #include "videoencoder.h" #include "configfile.h" #include "plugin.h" #include "avm_output.h" #include #include #include AVM_BEGIN_NAMESPACE; #define MAX_QUALITY 6 static const char* strDebug = "XviD plugin"; PLUGIN_TEMP(xvid) class XVID_VideoDecoder: public IVideoDecoder //, public IRtConfig { void* m_pHandle; int m_iLastPPMode; int m_iMaxAuto; int m_iLastBrightness; int m_iLastContrast; int m_iLastSaturation; public: XVID_VideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& bh, int flip) :IVideoDecoder(info, bh), m_pHandle(0), m_iLastPPMode(0), m_iLastBrightness(0), m_iLastContrast(0), m_iLastSaturation(0) { m_Dest.SetSpace(fccYV12); if (flip) m_Dest.biHeight *= -1; AVM_WRITE(strDebug, "XviD linux decoder\n"); } virtual ~XVID_VideoDecoder() { Stop(); } virtual CAPS GetCapabilities() const { //return CAPS(CAP_YV12|CAP_YUY2|CAP_UYVY|CAP_I420); return CAPS(CAP_YV12); //return CAPS(CAP_NONE); } //virtual IRtConfig* GetRtConfig() { return (IRtConfig*) this; } virtual int Start() { int xerr; if (m_pHandle) return -1; XVID_INIT_PARAM init; XVID_DEC_PARAM param; init.cpu_flags = 0; //init.cpu_flags = XVID_CPU_FORCE;// | XVID_CPU_MMX; xvid_init(NULL, 0, &init, NULL); param.width = m_Dest.biWidth; param.height = labs(m_Dest.biHeight); xerr = xvid_decore(NULL, XVID_DEC_CREATE, ¶m, NULL); if (xerr != 0) { AVM_WRITE(strDebug, "XviD start failed!\n"); return -1; } m_pHandle = param.handle; return 0; } virtual int Stop() { if (!m_pHandle) return -1; xvid_decore(m_pHandle, XVID_DEC_DESTROY, 0, 0); m_pHandle = 0; return 0; } virtual int DecodeFrame(CImage* pImage, const void* src, size_t size, int is_keyframe, bool render = true, CImage** pOut = 0) { XVID_DEC_FRAME param; if (!size || !m_pHandle) return 0; //AVM_WRITE(strDebug, "csp: 0x%x bitcount: %d height: %d\n", csp, m_Dest.biBitCount, m_Dest.biHeight); param.bitstream = (void*) src; param.length = size; if (pImage) { int csp = pImage->GetFmt()->biCompression; switch (csp) { case 0: case 3: switch (m_Dest.biBitCount) { case 16: if (csp == 3) { param.colorspace = XVID_CSP_RGB565; break; } // 16 bit with csp == 0 is 15bit /* fall through */ case 15: param.colorspace = XVID_CSP_RGB555; break; case 24: param.colorspace = XVID_CSP_RGB24; break; case 32: param.colorspace = XVID_CSP_RGB32; break; default: return -1; } if (pImage->GetFmt()->biHeight > 0) param.colorspace |= XVID_CSP_VFLIP; // RGB also doesn't seems work; param.colorspace = XVID_CSP_USER; break; case fccYV12: //param.colorspace = XVID_CSP_YV12; param.colorspace = XVID_CSP_USER; break; case fccI420: param.colorspace = XVID_CSP_I420; // untested break; case fccYUY2: param.colorspace = XVID_CSP_YUY2; break; case fccYVYU: param.colorspace = XVID_CSP_YVYU; break; case fccUYVY: param.colorspace = XVID_CSP_UYVY; break; default: return -1; } //printf("XXXXXXXXXX %d %d %d\n", size, m_Dest.biWidth, param.colorspace); param.stride = pImage->Width(); //+6; param.image = pImage->Data(); pImage->SetQuality((float) m_iLastPPMode / MAX_QUALITY); } else param.colorspace = XVID_CSP_NULL; if (xvid_decore(m_pHandle, XVID_DEC_DECODE, ¶m, NULL) != 0) return -1; if (param.colorspace == XVID_CSP_USER) { // internal format of XVID data - using for YV12 // for some reason I couldn't read YV12 with CSP setting struct dp { const uint8_t *y; const uint8_t *u; const uint8_t *v; int stride_y; int stride_uv; }; const struct dp* d = (const struct dp*) param.image; const uint8_t* p[3] = { d->y, d->v, d->u }; int s[3] = { d->stride_y, d->stride_uv, d->stride_uv }; BitmapInfo bi(m_Dest); bi.SetSpace(fccYV12); CImage ci(&bi, (const uint8_t**) p, s, false); pImage->Convert(&ci); } return size; } virtual int SetDestFmt(int bits = 24, fourcc_t csp = 0) { if (csp) bits = csp; switch (bits) { case 15: case 16: case 24: case 32: m_Dest.SetBits(bits); break; case fccYV12: case fccYUY2: m_Dest.SetSpace(bits); break; default: return -1; } if (m_pHandle) Restart(); return 0; } virtual int GetValue(const char* name, int& value) const { /* if (strcmp(name, strPostProcessing) == 0) value = m_iLastPPMode; else if (strcmp(name, strMaxAuto) == 0) value = m_iMaxAuto; else if (strcmp(name, strBrightness) == 0) value = m_iLastBrightness; else if (strcmp(name, strContrast) == 0) value = m_iLastContrast; else if (strcmp(name, strSaturation) == 0) value = m_iLastSaturation; else */ return -1; return 0; } virtual int SetValue(const char* name, int value) { return -1; } }; class XVID_VideoEncoder: public IVideoEncoder { BITMAPINFOHEADER m_bh; BITMAPINFOHEADER m_obh; unsigned int m_uiFrames; void* m_pHandle; int m_iQuant; bool m_bRtMode; int general; int motion; public: XVID_VideoEncoder(const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& bh) :IVideoEncoder(info), m_bh(bh), m_obh(bh), m_pHandle(0), m_bRtMode(false) { m_obh.biCompression = fccDIVX; m_obh.biHeight = labs(m_obh.biHeight); AVM_WRITE(strDebug, "XviD linux encoder\n"); } virtual ~XVID_VideoEncoder() { Stop(); } virtual int EncodeFrame(const CImage* src, void* dest, int* is_keyframe, size_t* size, int* lpckid=0) { int xerr; XVID_ENC_FRAME param; XVID_ENC_STATS result; param.bitstream = dest; switch (m_bh.biCompression) { case 0: param.colorspace = XVID_CSP_RGB24; break; case fccYUY2: param.colorspace = XVID_CSP_YUY2; break; case fccYV12: param.colorspace = XVID_CSP_YV12; break; case fccI420: param.colorspace = XVID_CSP_I420; break; } param.image = (void*) src->Data(); param.length = -1; // this is written by the routine param.quant = 0; param.intra = (!m_uiFrames++) ? 1 : -1; #if API_VERSION >= (2 << 16) param.general = general; param.motion = motion; #endif if (m_bRtMode) { param.quant=m_iQuant; // let encoder decide if frame is INTER/INTRA param.intra=-1; xerr = xvid_encore(m_pHandle, XVID_ENC_ENCODE, ¶m, &result); } else { xerr = xvid_encore(m_pHandle, XVID_ENC_ENCODE, ¶m, &result); } //printf("%d %d %d\n", param.intra, param.colorspace, param.length); // xframe.quant = QUANTI; // is quant != 0, use a fixed quant (and ignore bitrate) if (is_keyframe) *is_keyframe = param.intra ? 16 : 0; if (size) *size = param.length; return 0; } virtual size_t GetOutputSize() const { return m_bh.biWidth * labs(m_bh.biHeight) * 4; } virtual const BITMAPINFOHEADER& GetOutputFormat() const { return m_obh; } virtual int GetQuality() const { return 0;//RegReadInt(strXviDplugin, "quality2", 8500); } virtual int SetQuality(int quality) { AVM_WRITE(strDebug, "quality: %d\n", quality); //RegWriteInt(strXviDplugin, "quality2", quality); return 0; } virtual int Start() { int xerr; XVID_INIT_PARAM xinit; XVID_ENC_PARAM param; m_uiFrames = 0; xinit.cpu_flags = 0; xvid_init(NULL, 0, &xinit, NULL); memset(¶m, 0, sizeof(param)); param.width = m_bh.biWidth; param.height = labs(m_bh.biHeight); param.fincr = 100000; param.fbase = 2500000; int t; PluginGetAttrInt(m_Info, xvidstr_rc_bitrate, &t); #if API_VERSION >= ((2 << 16) | (1)) param.rc_bitrate = t; // such API change are not funny at all #else param.bitrate = t; #endif #if API_VERSION >= (2 << 16) PluginGetAttrInt(m_Info, xvidstr_rc_buffer, &t); #if API_VERSION >= ((2 << 16) | (1)) param.rc_buffer = t; #else param.rc_buffersize = t; #endif PluginGetAttrInt(m_Info, xvidstr_quant_type, &t); switch (t) { default: case 0: general = XVID_H263QUANT; break; case 1: general = XVID_MPEGQUANT; break; } #if API_VERSION >= ((2 << 16) | (1)) PluginGetAttrInt(m_Info, xvidstr_inter4v, &t); if (t) general |= XVID_INTER4V; PluginGetAttrInt(m_Info, xvidstr_diamond_search, &t); if (t) general |= PMV_HALFPELDIAMOND16 | PMV_HALFPELDIAMOND8; PluginGetAttrInt(m_Info, xvidstr_adaptive_quant, &t); if (t) general |= XVID_ADAPTIVEQUANT; #endif PluginGetAttrInt(m_Info, xvidstr_halfpel, &t); if (t) general |= XVID_HALFPEL; #ifdef XVID_INTERLACING PluginGetAttrInt(m_Info, xvidstr_interlacing, &t); if (t) general |= XVID_INTERLACING; #endif PluginGetAttrInt(m_Info, xvidstr_lum_masking, &t); if (t) general |= XVID_LUMIMASKING; // table from the xvid sample source code static const int motion_presets[7] = { 0, PMV_EARLYSTOP16, PMV_EARLYSTOP16, PMV_EARLYSTOP16 | PMV_HALFPELREFINE16, PMV_EARLYSTOP16 | PMV_HALFPELREFINE16, PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EARLYSTOP8 | PMV_HALFPELREFINE8, PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EXTSEARCH16 | PMV_EARLYSTOP8 | PMV_HALFPELREFINE8 | PMV_EXTSEARCH8 #ifdef XVID_INTERLACING | PMV_USESQUARES16 | PMV_USESQUARES8 #endif }; PluginGetAttrInt(m_Info, xvidstr_motion_search, &t); motion = (t >= 0 && t < 7) ? motion_presets[t] : 0; #if 0 // Motion estimation options PluginGetAttrInt(m_Info, xvidstr_me_zero, &t); if (t) motion |= XVID_ME_ZERO; PluginGetAttrInt(m_Info, xvidstr_me_logarithmic, &t); if (t) motion |= XVID_ME_LOGARITHMIC; PluginGetAttrInt(m_Info, xvidstr_me_fullsearch, &t); if (t) motion |= XVID_ME_FULLSEARCH; #endif // undef #ifdef XVID_ME_EPZS PluginGetAttrInt(m_Info, xvidstr_me_pmvfast, &t); if (t) motion |= XVID_ME_PMVFAST; PluginGetAttrInt(m_Info, xvidstr_me_epzs, &t); if (t) motion |= XVID_ME_EPZS; #endif #else PluginGetAttrInt(m_Info, xvidstr_rc_period, ¶m.rc_period); PluginGetAttrInt(m_Info, xvidstr_rc_reaction_period, ¶m.rc_reaction_period); PluginGetAttrInt(m_Info, xvidstr_rc_reaction_ratio, ¶m.rc_reaction_ratio); PluginGetAttrInt(m_Info, xvidstr_motion_search, ¶m.motion_search); #endif PluginGetAttrInt(m_Info, xvidstr_max_quantizer, ¶m.max_quantizer); PluginGetAttrInt(m_Info, xvidstr_min_quantizer, ¶m.min_quantizer); PluginGetAttrInt(m_Info, xvidstr_max_key_interval, ¶m.max_key_interval); // fast deinterlace // use bidirectional coding // flag to enable overlapped block motion compensation mode #if 0 if (param.quality == 1) { m_bRtMode=true; int quality=GetQuality(); m_iQuant=int(1+.003*(10000-quality)); AVM_WRITE(strDebug, "New quant: %d\n", m_iQuant); if(m_iQuant>31) m_iQuant=31; if(m_iQuant<1) m_iQuant=1; } else m_bRtMode=false; #endif xerr = xvid_encore(NULL, XVID_ENC_CREATE, ¶m, NULL); m_pHandle = param.handle; return xerr; } virtual int Stop() { if (!m_pHandle) return -1; int err = xvid_encore(m_pHandle, XVID_ENC_DESTROY, NULL, NULL); m_pHandle = 0; return err; } }; static IVideoEncoder* xvid_CreateVideoEncoder(const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& bh) { if (bh.biCompression == 0 && bh.biBitCount != 24) { xvid_error_set("unsupported input bit depth"); return 0; } switch (bh.biCompression) { case 0: case fccYUY2: case fccYV12: case fccI420: case fccDIVX: case fccXVID: break; default: xvid_error_set("unsupported input format"); return 0; } return new XVID_VideoEncoder(info, compressor, bh); } static IVideoDecoder* xvid_CreateVideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& bh, int flip) { if (bh.biSize < 40) { xvid_error_set("unsupported biSize"); return 0; } return new XVID_VideoDecoder(info, bh, flip); } AVM_END_NAMESPACE; extern "C" avm::codec_plugin_t avm_codec_plugin_xvid; avm::codec_plugin_t avm_codec_plugin_xvid = { PLUGIN_API_VERSION, 0, 0, 0, avm::PluginGetAttrInt, avm::PluginSetAttrInt, 0, 0, // attrs avm::xvid_FillPlugins, 0, 0, // audio avm::xvid_CreateVideoDecoder, avm::xvid_CreateVideoEncoder, }; avifile-0.7.48~20090503.ds/plugins/libxvid4/0000755000175000017500000000000011267646347017167 5ustar yavoryavoravifile-0.7.48~20090503.ds/plugins/libxvid4/Makefile.am0000644000175000017500000000046711110406017021201 0ustar yavoryavorif AMM_USE_XVID4 pkglib_LTLIBRARIES = xvid4.la endif noinst_HEADERS = fillplugins.h xvid4_la_SOURCES = xvid4.cpp xvid4_la_LDFLAGS = -avoid-version -module xvid4_la_LIBADD = ../../lib/libaviplay.la $(XVID4_LIBS) AM_CPPFLAGS = $(XVID4_CFLAGS) AM_CXXFLAGS = $(CXXRTTIEXCEPT) MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/plugins/libxvid4/fillplugins.h0000644000175000017500000001012111050120602021626 0ustar yavoryavor#ifndef XVID4_FILLPLUGINS_H #define XVID4_FILLPLUGINS_H #include "infotypes.h" #include "avm_fourcc.h" #ifdef HAVE_LIBXVIDCORE4 #include "xvid.h" #endif AVM_BEGIN_NAMESPACE; #define XVID4CSTR(name) \ static const char* xvid4str_ ## name = #name XVID4CSTR(debug); // decoding options XVID4CSTR(deblocking_y); XVID4CSTR(deblocking_uv); //XVID4CSTR(deringing); XVID4CSTR(film_effect); //XVID4CSTR(postprocessing); //XVID4CSTR(maxauto); // encoding options XVID4CSTR(mode); XVID4CSTR(bitrate); XVID4CSTR(motion_search); XVID4CSTR(chroma_motion); XVID4CSTR(inter4v); XVID4CSTR(trellisquant); XVID4CSTR(diamond_search); XVID4CSTR(adaptive_quant); #if 0 XVID4CSTR(me_zero); XVID4CSTR(me_logarithmic); XVID4CSTR(me_fullsearch); #endif XVID4CSTR(me_pmvfast); XVID4CSTR(me_epzs); static void xvid4_FillPlugins(avm::vector& ci) { const char xvid_about[] = "XviD4 MPEG-4 video codec"; const fourcc_t xvid_codecs[] = { fccDIVX, fccdivx, RIFFINFO_XVID, RIFFINFO_XviD, RIFFINFO_xvid, 4, fccDX50, fccdx50, 0 }; const char* const xvid_passopt[] = { "1Pass-CBR", "1Pass-quality", "1Pass-quantizer", "2Pass-1stPass", "2Pass-2ndPassExt", "2Pass-2ndPassInt", 0 }; const char* const xvid_quantopt[] = { "H.263", "MPEG-4", // not used in source "Adaptive", 0 }; avm::vector ds; ds.push_back(AttributeInfo(xvid4str_deblocking_y, "Deblocking Y", AttributeInfo::Integer, 0, 1)); ds.push_back(AttributeInfo(xvid4str_deblocking_uv, "Deblocking UV", AttributeInfo::Integer, 0, 1)); //ds.push_back(AttributeInfo(xvid4str_deringing, "Deringing", // AttributeInfo::Integer, 0, 1)); ds.push_back(AttributeInfo(xvid4str_film_effect, "Film Effect", AttributeInfo::Integer, 0, 1)); //ds.push_back(AttributeInfo(xvid4str_maxauto, "Maxauto - unsupported", // AttributeInfo::Integer, -1, -1)); // FIFO order is important - if this will ever change - few things // would have to be repaired avm::vector vs; vs.push_back(AttributeInfo(xvid4str_debug, "Debug", AttributeInfo::Integer, 0, 1)); vs.push_back(AttributeInfo(xvid4str_mode, "Mode", xvid_passopt)); vs.push_back(AttributeInfo(xvid4str_bitrate, "Desired stream bitrate in bits/second", AttributeInfo::Integer, 0, 10000000, 800000)); vs.push_back(AttributeInfo(xvid4str_motion_search, "Motion search ( 6 - Ultra high )", AttributeInfo::Integer, 0, 6, 6)); #if 0 vs.push_back(AttributeInfo(xvid4str_quant_type, "Quantization type", xvid_quantopt)); vs.push_back(AttributeInfo(xvid4str_chroma_motion, "Use Chroma Motion", AttributeInfo::Integer, 0, 1)); vs.push_back(AttributeInfo(xvid4str_diamond_search, "Diamond search", AttributeInfo::Integer, 0, 1)); vs.push_back(AttributeInfo(xvid4str_adaptive_quant, "Adaptive quantisation", AttributeInfo::Integer, 0, 1)); vs.push_back(AttributeInfo(xvid4str_halfpel, "Halfpel interpolation", AttributeInfo::Integer, 0, 1)); vs.push_back(AttributeInfo(xvid4str_rc_buffer, "Rate control buffer size", AttributeInfo::Integer, 0, 10000, 20)); vs.push_back(AttributeInfo(xvid4str_interlacing, "Interlacing", AttributeInfo::Integer, 0, 1)); vs.push_back(AttributeInfo(xvid4str_min_quantizer, "Minimum quantizer", AttributeInfo::Integer, 1, 31, 1)); vs.push_back(AttributeInfo(xvid4str_max_quantizer, "Maximum quantizer", AttributeInfo::Integer, 1, 31, 16)); vs.push_back(AttributeInfo(xvid4str_max_key_interval, "Maximum keyframe interval", AttributeInfo::Integer, 1, 500, 100)); vs.push_back(AttributeInfo(xvid4str_lum_masking, "Luminance masking", AttributeInfo::Integer, 0, 1)); #endif ci.push_back(CodecInfo(xvid_codecs, "XviD4", "", xvid_about, CodecInfo::Plugin, "xvid4", CodecInfo::Video, CodecInfo::Both, 0, vs, ds)); } AVM_END_NAMESPACE; #endif // XVID4_FILLPLUGINS_H avifile-0.7.48~20090503.ds/plugins/libxvid4/xvid4.cpp0000644000175000017500000003431011167340246020716 0ustar yavoryavor#include "fillplugins.h" #include "xvid.h" #include "videodecoder.h" #include "videoencoder.h" #include "configfile.h" #include "plugin.h" #include "avm_output.h" #include #include #include AVM_BEGIN_NAMESPACE; #define MAX_QUALITY 6 static const char strDebug[] = "XviD4 plugin"; PLUGIN_TEMP(xvid4); static const char* getError(int xviderr) { switch (xviderr) { case XVID_ERR_FAIL: return "general fault"; case XVID_ERR_MEMORY: return "memory allocation error"; case XVID_ERR_FORMAT: return "file format error"; case XVID_ERR_VERSION: return "structure version not supported"; case XVID_ERR_END: return "end of stream reached"; default: return "unknown"; } } class XVID4_VideoDecoder: public IVideoDecoder, public IRtConfig { void* m_pHandle; int m_iLastPPMode; int m_iMaxAuto; int m_iDeblockingY; int m_iDeblockingUV; int m_iFilmEffect; int m_General; public: XVID4_VideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& bh, int flip) :IVideoDecoder(info, bh), m_pHandle(0), m_General(0) { m_Dest.SetSpace(fccYV12); if (flip) m_Dest.biHeight *= -1; } virtual ~XVID4_VideoDecoder() { Stop(); } virtual CAPS GetCapabilities() const { //return CAPS(CAP_YV12|CAP_YUY2|CAP_UYVY|CAP_I420); return CAPS(CAP_YV12); //return CAPS(CAP_NONE); } virtual IRtConfig* GetRtConfig() { return (IRtConfig*) this; } virtual int Start() { xvid_gbl_init_t xinit; xvid_dec_create_t param; int cs; if (m_pHandle) return -1; memset(&xinit, 0, sizeof(xinit)); xinit.version = XVID_VERSION; //xinit.cpu_flags = 0; //init.cpu_flags = XVID_CPU_FORCE;// | XVID_CPU_MMX; xvid_global(NULL, XVID_GBL_INIT, &xinit, NULL); memset(¶m, 0, sizeof(param)); param.version = XVID_VERSION; param.width = m_Dest.biWidth; param.height = labs(m_Dest.biHeight); if (xvid_decore(NULL, XVID_DEC_CREATE, ¶m, NULL) != 0) { AVM_WRITE(strDebug, "start failed!\n"); return -1; } m_pHandle = param.handle; SetValue(0, 0); return 0; } virtual int Stop() { if (!m_pHandle) return -1; xvid_decore(m_pHandle, XVID_DEC_DESTROY, 0, 0); m_pHandle = 0; return 0; } virtual int DecodeFrame(CImage* pImage, const void* src, size_t size, int is_keyframe, bool render = true, CImage** pOut = 0) { xvid_dec_frame_t param; if (!size || !m_pHandle) return 0; //AVM_WRITE(strDebug, "csp: 0x%x bitcount: %d height: %d\n", csp, m_Dest.biBitCount, m_Dest.biHeight); memset(¶m, 0, sizeof(param)); param.version = XVID_VERSION; param.bitstream = (void*) src; param.length = size; if (pImage) { int csp = pImage->GetFmt()->biCompression; switch (csp) { case 0: case 3: switch (m_Dest.biBitCount) { case 16: if (csp == 3) { csp = XVID_CSP_RGB565; break; } // 16 bit with csp == 0 is 15bit /* fall through */ case 15: csp = XVID_CSP_RGB555; break; case 24: csp = XVID_CSP_BGR; break; case 32: csp = XVID_CSP_BGRA; break; default: return -1; } if (pImage->GetFmt()->biHeight > 0) csp |= XVID_CSP_VFLIP; // RGB also doesn't seems work; csp = XVID_CSP_USER; break; case fccYV12: //param.colorspace = XVID_CSP_YV12; csp = XVID_CSP_USER; break; case fccI420: csp = XVID_CSP_I420; // untested break; case fccYUY2: csp = XVID_CSP_YUY2; break; case fccYVYU: csp = XVID_CSP_YVYU; break; case fccUYVY: csp = XVID_CSP_UYVY; break; default: return -1; } //printf("XXXXXXXXXX %d %d %d\n", size, m_Dest.biWidth, param.colorspace); param.output.csp = csp; param.output.plane[0] = pImage->Data(0); param.output.plane[1] = pImage->Data(2); param.output.plane[2] = pImage->Data(1); param.output.stride[0] = pImage->Stride(0); param.output.stride[1] = pImage->Stride(2); param.output.stride[2] = pImage->Stride(1); //pImage->SetQuality((float) m_iLastPPMode / MAX_QUALITY); } else param.output.csp = XVID_CSP_NULL; param.general = m_General; int xerr = xvid_decore(m_pHandle, XVID_DEC_DECODE, ¶m, NULL); if (xerr < 0) { xvid4_error_set(getError(xerr)); return -1; } if (param.output.csp == XVID_CSP_INTERNAL) { // internal format of XVID data - using for YV12 // for some reason I couldn't read YV12 with CSP setting struct dp { const uint8_t *y; const uint8_t *u; const uint8_t *v; int stride_y; int stride_uv; }; const struct dp* d = (const struct dp*) param.output.plane; const uint8_t* p[3] = { d->y, d->v, d->u }; int s[3] = { d->stride_y, d->stride_uv, d->stride_uv }; BitmapInfo bi(m_Dest); bi.SetSpace(fccYV12); CImage ci(&bi, (const uint8_t**) p, s, false); pImage->Convert(&ci); } return size; } virtual int SetDestFmt(int bits = 24, fourcc_t csp = 0) { if (csp) bits = csp; switch (bits) { case 15: case 16: case 24: case 32: m_Dest.SetBits(bits); break; case fccYV12: case fccYUY2: m_Dest.SetSpace(bits); break; default: return -1; } if (m_pHandle) Restart(); return 0; } virtual const avm::vector& GetAttrs() const { return m_Info.decoder_info; } virtual int GetValue(const char* name, int* value) const { return PluginGetAttrInt(m_Info, name, value); } virtual int SetValue(const char* name, int value) { int v; if (name && PluginSetAttrInt(m_Info, name, value) != 0) return -1; m_General = XVID_LOWDELAY; PluginGetAttrInt(m_Info, xvid4str_deblocking_y, &v); if (v) m_General |= XVID_DEBLOCKY; PluginGetAttrInt(m_Info, xvid4str_deblocking_uv, &v); if (v) m_General |= XVID_DEBLOCKUV; PluginGetAttrInt(m_Info, xvid4str_film_effect, &v); if (v) m_General |= XVID_FILMEFFECT; return 0; } }; class XVID4_VideoEncoder: public IVideoEncoder { static const uint_t MAX_ZONES = 64; BITMAPINFOHEADER m_bh; BITMAPINFOHEADER m_obh; xvid_enc_frame_t m_Frame; xvid_enc_zone_t m_Zones[MAX_ZONES]; xvid_enc_plugin_t m_Plugins[7]; unsigned int m_uiFrames; void* m_pHandle; int m_iQuant; bool m_bRtMode; int general; int motion; uint_t m_uiZones; uint_t m_uiPlugins; public: XVID4_VideoEncoder(const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& bh) :IVideoEncoder(info), m_bh(bh), m_obh(bh), m_pHandle(0), m_bRtMode(false), m_uiZones(0), m_uiPlugins(0) { m_obh.biCompression = fccDIVX; m_obh.biHeight = labs(m_obh.biHeight); xvid_gbl_info_t xinfo; memset(&xinfo, 0, sizeof(xinfo)); xinfo.version = XVID_VERSION; if (xvid_global(NULL, XVID_GBL_INFO, &xinfo, NULL) < 0) { AVM_WRITE(strDebug, "Information about the library unavailable\n"); } else { AVM_WRITE(strDebug, "Using library version %d.%d.%d (build %s)\n", XVID_VERSION_MAJOR(xinfo.actual_version), XVID_VERSION_MINOR(xinfo.actual_version), XVID_VERSION_PATCH(xinfo.actual_version), xinfo.build); } } virtual ~XVID4_VideoEncoder() { Stop(); } virtual int EncodeFrame(const CImage* src, void* dest, int* is_keyframe, size_t* size, int* lpckid=0) { int length; int csp; xvid_enc_stats_t stats; memset(&stats, 0, sizeof(stats)); stats.version = XVID_VERSION; switch (m_bh.biCompression) { case fccYUY2: csp = XVID_CSP_YUY2; break; case fccYV12: csp = XVID_CSP_YV12; break; case fccI420: csp = XVID_CSP_I420; break; case 0: default: csp = XVID_CSP_BGR; break; } m_Frame.version = XVID_VERSION; m_Frame.type = XVID_TYPE_AUTO; m_Frame.input.csp = csp; m_Frame.input.plane[0] = (void*) src->Data(0); m_Frame.input.plane[2] = (void*) src->Data(2); m_Frame.input.plane[1] = (void*) src->Data(1); m_Frame.input.stride[0] = src->Stride(0); m_Frame.input.stride[2] = src->Stride(2); m_Frame.input.stride[1] = src->Stride(1); m_Frame.bitstream = dest; m_Frame.length = -1; // this is written by the routine m_Frame.quant = 0; //m_Frame.intra = (!m_uiFrames++) ? 1 : -1; m_Frame.motion = motion; //if (m_bRtMode) length = xvid_encore(m_pHandle, XVID_ENC_ENCODE, &m_Frame, &stats); //printf("%d %d %d\n", m_Frame.intra, m_Frame.colorspace, m_Frame.length); // xframe.quant = QUANTI; // is quant != 0, use a fixed quant (and ignore bitrate) if (is_keyframe) *is_keyframe = (m_Frame.out_flags & XVID_KEYFRAME) ? 16 : 0; if (size) *size = length; return 0; } virtual size_t GetOutputSize() const { return m_bh.biWidth * labs(m_bh.biHeight) * 4; } virtual const BITMAPINFOHEADER& GetOutputFormat() const { return m_obh; } virtual int GetQuality() const { return 0;//RegReadInt(strXviDplugin, "quality2", 8500); } virtual int SetQuality(int quality) { AVM_WRITE(strDebug, "quality: %d\n", quality); //RegWriteInt(strXviDplugin, "quality2", quality); return 0; } virtual int Start() { // table from the xvid sample source code static const int motion_presets[7] = { /* quality 0 */ 0, /* quality 1 */ XVID_ME_ADVANCEDDIAMOND16, /* quality 2 */ XVID_ME_ADVANCEDDIAMOND16 | XVID_ME_HALFPELREFINE16, /* quality 3 */ XVID_ME_ADVANCEDDIAMOND16 | XVID_ME_HALFPELREFINE16 | XVID_ME_ADVANCEDDIAMOND8 | XVID_ME_HALFPELREFINE8, /* quality 4 */ XVID_ME_ADVANCEDDIAMOND16 | XVID_ME_HALFPELREFINE16 | XVID_ME_ADVANCEDDIAMOND8 | XVID_ME_HALFPELREFINE8 | XVID_ME_CHROMA_PVOP | XVID_ME_CHROMA_BVOP, /* quality 5 */ XVID_ME_ADVANCEDDIAMOND16 | XVID_ME_HALFPELREFINE16 | XVID_ME_ADVANCEDDIAMOND8 | XVID_ME_HALFPELREFINE8 | XVID_ME_CHROMA_PVOP | XVID_ME_CHROMA_BVOP, /* quality 6 */ XVID_ME_ADVANCEDDIAMOND16 | XVID_ME_HALFPELREFINE16 | XVID_ME_EXTSEARCH16 | XVID_ME_ADVANCEDDIAMOND8 | XVID_ME_HALFPELREFINE8 | XVID_ME_EXTSEARCH8 | XVID_ME_CHROMA_PVOP | XVID_ME_CHROMA_BVOP, }; static const int vop_presets[] = { /* quality 0 */ 0, /* quality 1 */ 0, /* quality 2 */ XVID_VOP_HALFPEL, /* quality 3 */ XVID_VOP_HALFPEL | XVID_VOP_INTER4V, /* quality 4 */ XVID_VOP_HALFPEL | XVID_VOP_INTER4V, /* quality 5 */ XVID_VOP_HALFPEL | XVID_VOP_INTER4V | XVID_VOP_TRELLISQUANT, /* quality 6 */ XVID_VOP_HALFPEL | XVID_VOP_INTER4V | XVID_VOP_TRELLISQUANT | XVID_VOP_HQACPRED, }; int xerr; int t; xvid_gbl_init_t init; xvid_enc_create_t create; xvid_plugin_single_t single; xvid_plugin_2pass1_t rc2pass1; xvid_plugin_2pass2_t rc2pass2; m_uiFrames = 0; memset(&init, 0, sizeof(init)); init.version = XVID_VERSION; init.cpu_flags = 0; PluginGetAttrInt(m_Info, xvid4str_debug, &init.debug); xvid_global(NULL, XVID_GBL_INIT, &init, NULL); memset(&create, 0, sizeof(create)); create.version = XVID_VERSION; create.width = m_bh.biWidth; create.height = labs(m_bh.biHeight); create.fincr = 100000; create.fbase = 2500000; create.zones = m_Zones; create.num_zones = m_uiZones; create.plugins = m_Plugins; create.num_plugins = 0; memset(&single, 0, sizeof(single)); single.version = XVID_VERSION; // single pass m_Plugins[create.num_plugins].func = xvid_plugin_single; m_Plugins[create.num_plugins].param = &single; create.num_plugins++; memset(&m_Frame, 0, sizeof(m_Frame)); PluginGetAttrInt(m_Info, xvid4str_bitrate, &single.bitrate); PluginGetAttrInt(m_Info, xvid4str_motion_search, &t); motion = (t >= 0 && t < 7) ? motion_presets[t] : 0; #if 0 // Motion estimation options PluginGetAttrInt(m_Info, xvid4str_me_zero, &t); if (t) motion |= XVID_ME_ZERO; PluginGetAttrInt(m_Info, xvid4str_me_logarithmic, &t); if (t) motion |= XVID_ME_LOGARITHMIC; PluginGetAttrInt(m_Info, xvid4str_me_fullsearch, &t); if (t) motion |= XVID_ME_FULLSEARCH; PluginGetAttrInt(m_Info, xvid4str_max_quantizer, ¶m.max_quantizer); PluginGetAttrInt(m_Info, xvid4str_min_quantizer, ¶m.min_quantizer); PluginGetAttrInt(m_Info, xvid4str_max_key_interval, ¶m.max_key_interval); // fast deinterlace // use bidirectional coding // flag to enable overlapped block motion compensation mode if (param.quality == 1) { m_bRtMode=true; int quality=GetQuality(); m_iQuant=int(1+.003*(10000-quality)); AVM_WRITE(strDebug, "New quant: %d\n", m_iQuant); if(m_iQuant>31) m_iQuant=31; if(m_iQuant<1) m_iQuant=1; } else m_bRtMode=false; #endif xerr = xvid_encore(NULL, XVID_ENC_CREATE, &create, NULL); if (xerr < 0) { xvid4_error_set(getError(xerr)); return -1; } m_pHandle = create.handle; return 0; } virtual int Stop() { if (!m_pHandle) return -1; xvid_encore(m_pHandle, XVID_ENC_DESTROY, NULL, NULL); m_pHandle = 0; return 0; } private: char type2Char(int type) const { switch (type) { case XVID_TYPE_IVOP: return 'I'; case XVID_TYPE_PVOP: return 'P'; case XVID_TYPE_BVOP: return 'B'; default: return 'S'; } } }; static IVideoEncoder* xvid4_CreateVideoEncoder(const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& bh) { switch (bh.biCompression) { case 0: if (bh.biBitCount != 24) { xvid4_error_set("unsupported input bit depth"); return 0; } /* fall through */ case fccYUY2: case fccYV12: case fccI420: case fccDIVX: case fccXVID: break; default: xvid4_error_set("unsupported input format"); return 0; } return new XVID4_VideoEncoder(info, compressor, bh); } static IVideoDecoder* xvid4_CreateVideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& bh, int flip) { if (bh.biSize < 40) { xvid4_error_set("unsupported bitmap info size"); return 0; } return new XVID4_VideoDecoder(info, bh, flip); } AVM_END_NAMESPACE; extern "C" avm::codec_plugin_t avm_codec_plugin_xvid4; avm::codec_plugin_t avm_codec_plugin_xvid4 = { PLUGIN_API_VERSION, 0, 0, 0, avm::PluginGetAttrInt, avm::PluginSetAttrInt, 0, 0, // attrs avm::xvid4_FillPlugins, 0, 0, // audio avm::xvid4_CreateVideoDecoder, avm::xvid4_CreateVideoEncoder, }; avifile-0.7.48~20090503.ds/samples/0000755000175000017500000000000011267646347015425 5ustar yavoryavoravifile-0.7.48~20090503.ds/samples/misc/0000755000175000017500000000000011267646347016360 5ustar yavoryavoravifile-0.7.48~20090503.ds/samples/misc/Makefile.am0000644000175000017500000000253211107552521020375 0ustar yavoryavorLIBRARY = ../../lib/libaviplay.la #plustest qualtest # ae test plustest imtest qualtest #asfdump_SOURCES=asfdump.cpp #asftest_SOURCES=asftest.cpp avibench_LDADD = $(LIBRARY) avibench_SOURCES = benchmark.cpp avicat_LDADD = $(LIBRARY) avicat_SOURCES = avicat.cpp avitest_LDADD = $(LIBRARY) avitest_SOURCES = avitest.cpp avitype_LDADD = $(LIBRARY) avitype_SOURCES = avitype.cpp extractor_LDADD = $(LIBRARY) extractor_SOURCES = extractor.cpp test_SOURCES=test.cpp test_LDADD = $(LIBRARY) #plustest_SOURCES=plustest.cpp #imtest_SOURCES=imtest.cpp #qualtest_SOURCES=qualtest.cpp #ae_SOURCES=ae.cpp #asftest_LDADD = $(LIBRARY) AsfReadHandler.o AsfStreamSeekInfo.o #$(LIBSOCKET) $(LIBNSL) if AMM_USE_JPEGLIB avimake_SOURCES = avimake.cpp avimake_LDADD = $(LIBRARY) -ljpeg PROG_AVIMAKE = avimake else PROG_AVIMAKE = endif bin_PROGRAMS = avibench avicat avitype $(PROG_AVIMAKE) check_PROGRAMS = avitest extractor test #asfdump asftest EXTRA_DIST = imtest.cpp plustest.cpp qualtest.cpp test.cpp #plustest_LDADD=$(LIBRARY) #imtest_LDADD=$(LIBRARY) #qualtest_LDADD=$(LIBRARY) #ae_LDADD=$(LIBRARY) AM_CPPFLAGS = $(X_CFLAGS) -I$(srcdir)/../../lib/aviread AsfReadHandler.o: $(top_srcdir)/lib/aviread/AsfReadHandler.cpp $(CXXCOMPILE) -c $< -o $@ AsfStreamSeekInfo.o: $(top_srcdir)/lib/aviread/AsfStreamSeekInfo.cpp $(CXXCOMPILE) -c $< -o $@ MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/samples/misc/asfdump.cpp0000644000175000017500000003345007304502661020513 0ustar yavoryavor/* This program dumps contents of ASF movie file, creating very long readable log which is useful when analyzing unknown aspects of ASF format. It is not linked against libaviplay.la. */ #include #include #include #include #include #include using namespace std; #pragma pack(1) //const char prefix[]="0x"; const char prefix[]=""; struct GUID { unsigned long v1; unsigned short v2; unsigned short v3; unsigned char v4[8]; int operator==(const GUID& guid) const{return !memcmp(this, &guid, sizeof(GUID));} int LookupChunkType(); }; struct ASFFileHeader { //0x0 GUID guid; //generated by client computer //0x10 TOTAL_SIZE_8 long long file_size; //in bytes //0x18 long long file_time; //time of creation, in 100-nanosecond units since 1.1.1601 //0x20 NUM_PACKETS long long num_packets; //how many packets are there in the file //0x28 FINE_TOTALTIME long long total_time; //end timestamp, in 100-nanosecond units //0x30 FINE_PLAYTIME long long play_time; //file duration, in 100-nanosecond units //0x38 PLAYTIME_OFFSET long play_start_time; //timestamp of first packet, in milliseconds //0x3C long unk3; //unknown, maybe reserved ( usually contain 0 ) //0x40 FLAGS long flags; //unknown flags, usually contain 0x02 ( seekable? ) //0x44 CHUNKLENGTH long pktsize; //size of a data packet //0x48 CHUNKLENGTH_CONFIRM long pktsize_confirm; // the same long frame_size; //uncompressed frame size }; union ASFStreamHeader { char buf[1024]; struct { GUID uid_type; //audio or video stream GUID uid_conceal; //is audio data error concealment used long long unk1; //usually 0 long data_len; //size of fixed data long edata_len; //data that follows unsigned short stream; //number ( 1, 2 ... ) long unk2; //usually the same in both streams // Eyes on me.asf: 0x62dffd4 // Alsou - Solo.asf: 0x10 // Baby one more time.asf: 0x10 // Cure_LastDayOfSummer.wma: 0x818f900c // Windows Movie Maker Sample File.wmv: 0x3f // KellssyV_500VBR.wmv: 0x0 union { struct { long width; long height; char c; short biSize; long biSize2; long biWidth; long biHeight; short biPlanes; short biBitCount; long biCompression; long biSizeImage; long biXPelsPerMeter; long biYPelsPerMeter; long biClrUsed; long biClrImportant; } vid; struct {; // WAVEFORMATEX wfex; char wfex[14]; // audio scramble data follows } aud; }; } h; }; struct ASFAudioScrambleDef { unsigned char block_size; // total number of audio blocks in each scramble group unsigned short chunk_size; // byte size of each scrambling chunk unsigned short block_align_1; // usually = nBlockAlign unsigned short block_align_2; // usually = nBlockAlign unsigned char unk; }; ASFFileHeader fh; ASFStreamHeader sh[2]; int streams_found=0; off_t data_chunk=-1; ostream& operator<<(ostream& e, const GUID& guid) { return e<0) { unsigned char tmp; lseek(fd, pos, SEEK_SET); read(fd, &tmp, 1); cout<<" Stream "<block_size<<" "<chunk_size <<" "<block_align_1<<" "<block_align_2 <<" "<<(int)asd->unk< #include using namespace avm; int main(int argc, char** argv) { // IMediaReadHandler* h=new ASFReadHandler("/d/movies/Eyes on me.asf"); // IMediaReadHandler* h=new ASFReadHandler("/d/movies/Baby one more time.asf"); const char* filename="/d/test-movies/smth.asf"; if(argc>1)filename=argv[1]; IMediaReadHandler* h=new ASFReadHandler(filename); // sleep(20); char ttt[100000]; IMediaReadStream* s=h->GetStream(mmioFOURCC('a', 'u', 'd', 's'), 0); uint_t samp_read, bytes_read; s->Read(&ttt, 10000U, 5U, &bytes_read, &samp_read); std::cout<<"Now video"<GetStream(mmioFOURCC('v', 'i', 'd', 's'), 0); for(int i=0; i<100; i++) { s1->Read(0, 0, 1, &bytes_read, &samp_read); std::cout<Read(&ttt, bytes_read, 1, &bytes_read, &samp_read); } return 0; } avifile-0.7.48~20090503.ds/samples/misc/avicat.cpp0000644000175000017500000003042011165365736020327 0ustar yavoryavor/* $Id: avicat.cpp,v 1.27 2009/04/03 10:58:38 kabi Exp $ */ /* avicut Copyright (C) 2002 Oliver Kurth This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU 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. */ /* Large chunks of code copied from avifile-0.6.0-20011109/samples/misc/avicat.cpp Thanks to Tom Pavel */ #include "avifile.h" #include "aviplay.h" #include "videoencoder.h" #include "avm_creators.h" #include "avm_except.h" #include "version.h" #include #include // exit #include // for getopt() //#include #include template struct pair { First first; Second second; pair(){}; pair(First f, Second s) : first(f), second(s) {}; }; // hold on to audio samples until we have a chunk at least this big: const int MinAudChunk = 128; uint_t findAttrInfo(const avm::CodecInfo& cinfo, const avm::string& name, avm::CodecInfo::Direction direction = avm::CodecInfo::Encode) { uint_t i; const avm::vector& list = (direction == avm::CodecInfo::Encode) ? cinfo.encoder_info : cinfo.decoder_info; for(i = 0; i < list.size(); i++) { if(list[i].GetName() == name) return i; } return avm::vector::invalid; } uint_t findCodecInfo(fourcc_t fourcc, avm::CodecInfo::Direction direction = avm::CodecInfo::Encode) { uint_t i; const avm::vector& list = video_codecs; for(i = 0; i < list.size(); i++){ if(list[i].direction & direction){ if(list[i].fourcc == fourcc) return i; } } return avm::vector::invalid; } #if 0 IAviWriteStream* createVidOutStream(const IAviReadStream* inStr, IAviWriteFile* outFile) { BITMAPINFOHEADER bh; inStr->GetVideoFormatInfo((uint8_t*)&bh, sizeof(bh)); int ftm = (int) (1000000. * inStr->GetFrameTime()); ftm = 41708; IAviWriteStream* outStr = outFile->AddStream(AviStream::Video, (uint8_t*)&bh, sizeof(bh), bh.biCompression, ftm); return outStr; } IAviWriteStream* createAudOutStream (const IAviReadStream* inStr, IAviWriteFile* outFile) { WAVEFORMATEX wf; inStr->GetAudioFormatInfo((uint8_t*)&wf, 0); IAviWriteStream* outStr = outFile->AddStream(AviStream::Audio, (uint8_t*)&wf, 18, wf.wFormatTag, wf.nAvgBytesPerSec, wf.nBlockAlign); return outStr; } #endif class AviCutter { protected: static const size_t AUDIO_BUFFER_SIZE = 512000; avm::vector > boundaries; avm::vector attributes; avm::IReadFile* inFile; avm::IWriteFile* outFile; avm::IReadStream* inVidStr; avm::vector inAudStreams; avm::IWriteStream* outVideo; avm::vector > outAudStreams; int64_t written_audio; int64_t written_frames; size_t buf_size; uint8_t *buf; uint8_t *aud_buf; double bpf; BITMAPINFOHEADER bh; avm::IVideoEncoder *vidEnc; void copyAudioFrames(int, int, bool); void createVideoEncoder(fourcc_t); void writeVideoFrame(avm::CImage *image); void copyVideoFrame(); public: AviCutter(avm::IWriteFile* outF, avm::vector >& bounds, avm::vector&attrs) : boundaries(bounds), attributes(attrs), outFile(outF), outVideo(NULL), written_audio(0), written_frames(0), buf_size(512000), vidEnc(NULL) { buf = new uint8_t[buf_size]; aud_buf = new uint8_t[AUDIO_BUFFER_SIZE]; if (bounds.size() == 0) { pair all(0, INT_MAX-1); boundaries.push_back(all); } } ~AviCutter() { delete[] buf; delete[] aud_buf; if (vidEnc) delete vidEnc; } int Open(avm::string& filename) { unsigned int i; inFile = avm::CreateReadFile(filename.c_str()); if (!inFile) return -1; inVidStr = inFile->GetStream(0, avm::IStream::Video); if(outVideo == NULL && inVidStr) { inVidStr->GetVideoFormat(&bh, sizeof(bh)); uint_t maxis = bh.biWidth * bh.biHeight * 4; if (maxis > buf_size) { buf_size = maxis; delete[] buf; buf = new uint8_t[buf_size]; } outVideo = outFile->AddStream(inVidStr); } for(i = 0; i < inFile->AudioStreamCount(); i++) { inAudStreams.push_back(inFile->GetStream(i, avm::IStream::Audio)); printf("detected %" PRIsz " audio streams\n", inAudStreams.size()); if (outAudStreams.size() <= i) { avm::IReadStream* inAudStr = inAudStreams[i]; size_t s = inAudStr->GetAudioFormat(); WAVEFORMATEX* wf = (WAVEFORMATEX*) new char[s]; inAudStr->GetAudioFormat(wf, s); bpf = inVidStr->GetFrameTime() * wf->nAvgBytesPerSec; pair p(wf, outFile->AddStream(inAudStr)); outAudStreams.push_back(p); } else { /* check if formats match */ } } return 0; } void Close() { delete inFile; inVidStr = 0; inAudStreams.clear(); } void Copy(); }; /* life would be much easier if we could create the encoder and then set the attribute... */ void AviCutter::createVideoEncoder(fourcc_t fourcc) { if (vidEnc == NULL) { const avm::CodecInfo& info = video_codecs[findCodecInfo(fourcc)]; avm::vector::iterator it; for(it = attributes.begin(); it != attributes.end(); it++){ char name[21], val[21]; sscanf(it->c_str(), "%20[^=]=%s", name, val); printf("setting '%s' = '%s'\n", name, val); uint_t index = findAttrInfo(info, name); if(index != avm::vector::invalid){ const avm::AttributeInfo& ainfo = info.encoder_info[index]; switch(ainfo.kind){ case avm::AttributeInfo::Integer: avm::CodecSetAttr(info, name, atoi(val)); break; case avm::AttributeInfo::String: avm::CodecSetAttr(info, name, val); break; case avm::AttributeInfo::Select: avm::CodecSetAttr(info, name, val); break; default: ; } } } avm::BitmapInfo bh1(bh.biWidth, bh.biHeight, 24); vidEnc = avm::CreateEncoderVideo(fourcc, bh1, NULL); } } void AviCutter::copyAudioFrames(int frame, int max_frame, bool reseek) { for (unsigned i = 0; i < inAudStreams.size(); i++) { avm::IReadStream* inAudStr = inAudStreams[i]; if (reseek) { double time = inVidStr->GetTime(); inAudStr->SeekTime(time); } if (!inAudStr->Eof()) { int64_t excess = int64_t(bpf * double(written_frames+1) - double(written_audio)); int64_t to_read = int64_t(bpf * double(max_frame - frame)); if (to_read > (int64_t)AUDIO_BUFFER_SIZE) to_read = AUDIO_BUFFER_SIZE; to_read = to_read - (to_read%outAudStreams[i].first->nBlockAlign); while ((excess>0) && (!inAudStr->Eof())) { int flags = 0; size_t bytes_read, samp_read; inAudStr->ReadDirect(aud_buf, (excess > to_read) ? excess : to_read, to_read, samp_read, bytes_read, &flags); written_audio += bytes_read; excess -= bytes_read; //printf("ADDSAMP %d\n", bytes_read); outAudStreams[i].second->AddChunk(aud_buf, bytes_read, flags); } } } } void AviCutter::writeVideoFrame(avm::CImage *image) { int is_kf; size_t size; int hr = vidEnc->EncodeFrame(image, buf, &is_kf, &size); if(hr == 0) outVideo->AddChunk(buf, size, is_kf); else fprintf(stderr, "hr != 0\n"); written_frames++; } void AviCutter::copyVideoFrame() { int flags = 0; size_t bytes_read, samp_read; inVidStr->ReadDirect(buf, buf_size, 1, samp_read, bytes_read, &flags); outVideo->AddChunk(buf, bytes_read, flags); written_frames++; } void AviCutter::Copy() { if (inVidStr == 0) return; avm::vector >::iterator it_bound = boundaries.begin(); //printf("INVIDEOF %d\n", inVidStr->Eof()); while (!inVidStr->Eof() && it_bound != boundaries.end()) { //printf("SEEEK %d %d\n", it_bound->first, it_bound->second); inVidStr->SeekToKeyFrame(it_bound->first); framepos_t next_kf_pos = inVidStr->GetNextKeyFrame(it_bound->first); bool need_aud_resync = true; bool have_encoder = false; for(framepos_t frame = inVidStr->GetPos(); frame < it_bound->second; frame++) { if (! inVidStr->Eof()) { if (frame < next_kf_pos){ if (!have_encoder){ if (vidEnc == NULL) createVideoEncoder(bh.biCompression); if (vidEnc) { inVidStr->SetDirection(1); inVidStr->StartStreaming(); vidEnc->Start(); have_encoder = true; } } avm::CImage *image = inVidStr->GetFrame(true); if (frame >= it_bound->first){ copyAudioFrames(frame, next_kf_pos, need_aud_resync); need_aud_resync = false; if (vidEnc) { writeVideoFrame(image); printf("\rreencoded frame %d (%d)", frame, (int)written_frames); fflush(stdout); } } }else{ copyAudioFrames(frame, it_bound->second, need_aud_resync); need_aud_resync = false; copyVideoFrame(); printf("\rcopied frame %d (%d)", frame, (int)written_frames); fflush(stdout); } if((frame+1 == next_kf_pos) || (frame+1 == it_bound->second)){ if(have_encoder){ inVidStr->StopStreaming(); vidEnc->Stop(); } } } else break; } it_bound++; } } void Usage(const char *arg0) { printf("Usage: %s [-o outfile] [-a codec-attribute] [-b start,end " "[-b start,end] ...] file1 [file2] ...\n", arg0); printf("Warning: Do not use with VBR audio streams.\n"); printf("Warning: Do not mix concatenating and cutting at once.\n"); } void parseBounds(avm::vector >& boundaries, avm::vector& bound_args) { for(unsigned i = 0; i < bound_args.size(); i++){ avm::string str = bound_args[i]; avm::string::size_type pos = str.find(','); if (pos != avm::string::npos) { pair pr; pr.first = atoi(str.substr(0, pos).c_str()); pr.second = atoi(str.substr(pos+1).c_str()); if(pr.second > pr.first){ boundaries.push_back(pr); }else{ fprintf(stderr, "second value must be greater than first: %s\n", str.c_str()); } }else{ fprintf(stderr, "need a comma between bounds: %s\n", str.c_str()); } } } int main (int argc, char* argv[]) try { unsigned int i; int debug = 0; const char* outFn = "out.avi"; avm::vector > boundaries; avm::vectorbound_args; avm::vectorattributes; avm::vectorinFiles; int seg_size = 0x7F000000; // Standard AVIlib sanity check: if (GetAvifileVersion() != AVIFILE_VERSION) { fprintf(stderr, "This binary was compiled for Avifile ver. %d, , but the library is ver. %d.\nAborting\n", AVIFILE_VERSION, GetAvifileVersion() ); return 0; } int ch; while ((ch = getopt(argc, argv, "a:b:dho:s:7")) != EOF) { switch ((char)ch) { case 'a': attributes.push_back(optarg); break; case 'b': bound_args.push_back(optarg); break; case 'd': ++debug; break; case 'o': outFn = optarg; break; case 's': seg_size = atoi(optarg); break; case '7': seg_size = 700L*1024L*1024L; // 700MB for a CD break; case 'h': case '?': default: Usage(argv[0]); exit(0); } } argc -= optind; argv += optind; if (argc < 1) Usage(argv[0]); int arg; for(arg = 0; arg < argc; arg++) inFiles.push_back(argv[arg]); parseBounds(boundaries, bound_args); // Do the real work avm::IWriteFile* outFile = avm::CreateWriteFile(outFn, seg_size); AviCutter cutter(outFile, boundaries, attributes); //printf("FILESIZE %d\n", inFiles.size()); for(i = 0; i < inFiles.size(); i++) if (cutter.Open(inFiles[i]) == 0) { cutter.Copy(); cutter.Close(); } delete outFile; } catch(avm::FatalError& error) { error.Print(); } avifile-0.7.48~20090503.ds/samples/misc/avimake.cpp0000644000175000017500000001171410474075273020476 0ustar yavoryavor// -*- Mode: C++ -*- // avimake.cc -- create a DIVX movie out of a slew of JPEGs // // $Id: avimake.cpp,v 1.12 2006/08/26 16:45:47 kabi Exp $ // // Copyright (C) 2001 Tom Pavel // // Creator : Tom Pavel Sun Feb 4 01:23:17 2001 // Modifier : Tom Pavel Sun May 13 00:35:21 2001 // Update Count : 45 // Status : Unknown, Use with caution! // #include #include #include #include #include #include // for getopt() #include // for memset() #include // atoi() #include #include #include #include extern "C" { #undef HAVE_STDLIB_H // prevents warning... #include } #include using namespace std; void fillInfo(const char* fname, BITMAPINFOHEADER* bi) { // open and read fname as JPG file // use jpg lib... struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; cinfo.err = jpeg_std_error(&jerr); jpeg_create_decompress(&cinfo); FILE* infile = fopen(fname, "rb"); if (infile == NULL) { cerr << "can't open " << fname << ": " << strerror(errno) << endl; exit(1); } jpeg_stdio_src(&cinfo, infile); jpeg_read_header(&cinfo, TRUE); memset(bi, 0, sizeof(*bi)); bi->biSize = sizeof(*bi); bi->biWidth = cinfo.image_width; bi->biHeight = cinfo.image_height; bi->biSizeImage = bi->biWidth * bi->biHeight * 3; bi->biPlanes = 1; bi->biBitCount = 24; jpeg_destroy_decompress(&cinfo); fclose(infile); } void addFrame(const char* fname, avm::IVideoWriteStream* outVidStr) { // open and read fname as JPG file // use jpg lib... struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; cinfo.err = jpeg_std_error(&jerr); jpeg_create_decompress(&cinfo); FILE * infile = fopen(fname, "rb"); if (infile == NULL) { cerr << "can't open " << fname << ": " << strerror(errno) << endl; exit(1); } jpeg_stdio_src(&cinfo, infile); jpeg_read_header(&cinfo, TRUE); cinfo.out_color_space = JCS_RGB; cinfo.quantize_colors = FALSE; unsigned int line_size = 3 * cinfo.image_width; JSAMPLE* line = new JSAMPLE[line_size]; JSAMPLE* data = new JSAMPLE[line_size*cinfo.image_height]; jpeg_start_decompress(&cinfo); while (cinfo.output_scanline < cinfo.output_height) { // The damn BMP files are backwards! // (first row at bottom of image, and BGR instead of RGB): int lines = jpeg_read_scanlines(&cinfo, &line, 1); assert (lines == 1); JSAMPLE* ptr = & data[line_size * (cinfo.image_height-cinfo.output_scanline - 1)]; for (JSAMPLE* src = line; src < &line[line_size]; src += 3, ptr += 3) { ptr[0] = src[2]; ptr[1] = src[1]; ptr[2] = src[0]; } } delete [] line; jpeg_finish_decompress(&cinfo); // create frame from 24-bit image array. avm::CImage frame(data, cinfo.output_width, cinfo.output_height); outVidStr->AddFrame(&frame); jpeg_destroy_decompress(&cinfo); fclose(infile); delete [] data; } void Usage (const char* progname) { cerr << "usage: " << progname << " [-h] [-o outfile] [-r fr] [-q quality]" << endl; exit(1); } int main (int argc, char* argv[]) try { int debug = 0; const char* outFn = "out.avi"; int fr = 5; // default to 5 fps int quality = 10000; // units = .01 percent int ch; while ((ch = getopt(argc, argv, "dho:r:q:")) != EOF) { switch ((char)ch) { case 'd': ++debug; break; case 'o': outFn = optarg; break; case 'r': fr = atoi (optarg); if (fr == 0) Usage (argv[0]); break; case 'q': quality = atoi (optarg); if (quality == 0) Usage (argv[0]); break; case 'h': case '?': default: Usage (argv[0]); } } argc -= optind; argv += optind; if (argc < 1) Usage (argv[0]); // Standard AVIlib sanity check: if ( GetAvifileVersion() != AVIFILE_VERSION) { cout << "This binary was compiled for Avifile ver. " << AVIFILE_VERSION << ", but the library is ver. " << GetAvifileVersion() << ". Aborting." << endl; return 0; } // Do the real work avm::IWriteFile* outFile = avm::CreateWriteFile(outFn); BITMAPINFOHEADER bi; //FOURCC codec = fccDIV3; fourcc_t codec = fccMP42; //FOURCC codec = fccIV32; //FOURCC codec = fccCVID; // Use the first file to pick the image sizes: fillInfo (*argv, &bi); avm::IVideoWriteStream* vidStr = outFile->AddVideoStream(codec, &bi, 1000000/fr); vidStr->Start(); while (argc > 0) { addFrame (*argv, vidStr); --argc; ++argv; } vidStr->Stop(); // Close the outFile and write out the header, etc. delete outFile; } catch(avm::FatalError& error) { error.Print(); } avifile-0.7.48~20090503.ds/samples/misc/avitest.cpp0000644000175000017500000000477510474275203020544 0ustar yavoryavor/************************************************************************** Example of IAviWriteFile & IAviVideoWriteStream interface usage. **************************************************************************/ #include "avifile.h" #include "aviplay.h" #include "avm_cpuinfo.h" #include "avm_except.h" #include "avm_fourcc.h" #include "videoencoder.h" #include "utils.h" #include "version.h" #include #define __MODULE__ "avitest" #include #include using namespace std; int main(int argc, char** argv) { // int fccHandler=mmioFOURCC('m','j','p','g'); int fccHandler = fccdiv1; // int fccHandler=mmioFOURCC('A', 'P', '4', '1'); // int fccHandler=fccDIV3; // IVideoEncoder::SetExtendedAttr(fccHandler, "QuickCompress", 0); avm::IWriteFile* file = 0; FILE* f1 = 0; if(GetAvifileVersion()!=AVIFILE_VERSION) { cout<<"This binary was compiled for Avifile ver. "<\n", argv[0]); return 0; } try { file=avm::CreateWriteFile(argv[1]); // file=CreateSegmentedFile(argv[1], 400000); f1=fopen("./uncompr.bmp", "rb"); if(f1==0)throw FATAL("Can't open file ./uncompr.bmp"); fseek(f1, 14, SEEK_SET);//BITMAPFILEHEADER BITMAPINFOHEADER bh; fread(&bh, 0x28, 1, f1); // bh.biWidth=0x80; // bh.biHeight=0x80; // bh.biBitCount=32; // VideoEncoder::SetExtendedAttr(fccDIV3, "BitRate", 4500);//before we initialize decoder // IVideoEncoder::SetExtendedAttr(fccIV50, "QuickCompress", 1); avm::IVideoWriteStream* stream=file->AddVideoStream(fccHandler, &bh, 100000); unsigned char pic[384*288*3]; fread(pic, 384*288*3, 1, f1); avm::CImage im((avm::BitmapInfo*)&bh, pic, false); // stream->SetHeader(40000);//mks/frame stream->Start(); long long t1=avm_get_time_us(); for(int i=0; i<144; i++) { stream->AddFrame(&im); memset(pic+384*i*3, 0, 384*3); memset(pic+384*(287-i)*3, 0, 384*3); if(i%10==0) printf("%d frames written\n", i); } long long t2=avm_get_time_us(); cerr<Stop(); delete file;//here all headers are actually written fclose(f1); return 0; } catch(FatalError& error) { error.Print(); if(file)delete file; if(f1)fclose(f1); } catch(...) { cout<<"ERROR: Caught unknown exception!"< // // Creator : Tom Pavel Sat Feb 3 01:27:20 2001 // Modifier : Tom Pavel Sun May 13 00:56:10 2001 // Update Count : 34 // Status : Unknown, Use with caution! // #include #include #include #include #include #include #include // for getopt() #include #include static void Usage(const char* progname) { fprintf(stderr, "Usage: %s [-h] file1 file2 ...\n", progname); exit(1); } static void printFile(const char* fname) { avm::IReadFile* aviFile = avm::CreateReadFile(fname); if (aviFile == 0) return; #if 0 MainAVIHeader hdr; if (aviFile->GetHeader(&hdr, sizeof(hdr)) != 0) return; cout << endl; cout << "AVI file: " << fname << endl; cout << " Frames: " << hdr.dwTotalFrames << " of " << hdr.dwWidth << "x" << hdr.dwHeight << endl; cout << " Rate: " << setprecision(4) << 1e6/(double)hdr.dwMicroSecPerFrame << " frame/sec" << " or " << hdr.dwMaxBytesPerSec/1000.0 << " kB/sec" << endl; cout << " Streams: " << hdr.dwStreams << " (" << aviFile->VideoStreamCount() << "V + " << aviFile->AudioStreamCount() << "A)" << endl; IAviReadStream* vidStream = aviFile->GetStream (0, AviStream::Video); if (vidStream == 0) { cout << "Bad Video Stream" << endl; return; } AVIStreamHeader header; vidStream->GetHeader(&header, sizeof(header)); cout << " Video: " << avm_fccToString(header.fccType) << " " << avm_fcc_name(header.fccHandler) << endl; IAviReadStream* audStream = aviFile->GetStream (0, AviStream::Audio); if (audStream == 0) { cout << "Bad Audio Stream" << endl; return; } WAVEFORMATEX wvFmt; if (audStream->GetAudioFormatInfo(&wvFmt, 0) != 0) { cout << "Failed to decode Audio Format" << endl; return; } cout << " Audio: " << avm_wave_format_name(wvFmt.wFormatTag) << " " << wvFmt.wBitsPerSample << "-bit " << wvFmt.nChannels << "-chan " << wvFmt.nSamplesPerSec << " Hz" << endl; #endif } int main(int argc, char* argv[]) try { int debug = 0; int ch; while ((ch = getopt(argc, argv, "dhl:")) != EOF) { switch ((char)ch) { case 'd': ++debug; break; case 'h': case '?': default: Usage (argv[0]); } } argc -= optind; argv += optind; if (argc < 1) Usage (argv[0]); // Standard AVIlib sanity check: if ( GetAvifileVersion() != AVIFILE_VERSION) { printf("This binary was compiled for Avifile ver. %x" ", but the library is ver. %x. Aborting.\n", AVIFILE_VERSION, GetAvifileVersion()); return 0; } while (argc > 0) { printFile (*argv); --argc; ++argv; } } catch(avm::FatalError& error) { error.Print(); } avifile-0.7.48~20090503.ds/samples/misc/benchmark.cpp0000644000175000017500000002441611164474310021006 0ustar yavoryavor/******************************************************** Benchmarking tool Copyright 2000 Eugene Kuznetsov (divx@euro.ru) *********************************************************/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef X_DISPLAY_MISSING #include #endif #define __MODULE__ "benchmark" const char* g_pcProgramName = "benchmark"; volatile int sig_int_seen = 0; static void sig_int(int) { sig_int_seen = 1; } int main(int argc, char **argv) { if (GetAvifileVersion()!=AVIFILE_VERSION) { printf("This binary was compiled for Avifile ver. %d, " "but the library is ver. %d - Aborting.\n", AVIFILE_VERSION, GetAvifileVersion()); return 0; } #ifdef SMARTMEMCPY int size = 630*300*2 & ~128; int caches = 0*1024; int cnt = 1000; //char* a = (char*)malloc(size + 10); //char* b = (char*)malloc(size + 10); char* a = (char*)memalign(128, size + 10); char* b = (char*)memalign(128, size + 10); int64_t t1 = avm_get_time_us(); for (int i = 0; i < cnt/2; i++) { memcpy(a, b, size); #if 0 memcpy(a, b, size); #else memcpy(a, b + size - testm, caches); memcpy(a, b, size - caches); #endif } int64_t t2 = avm_get_time_us(); float d = avm_get_time_diff(t2, t1); cout << "Time " << d << " " << cnt*size / d / 1024 / 1024 << " MB/s" << endl; cout << "HEX " << (void*) a << " " << (void*)b << endl; exit(0); #endif char* fn = 0; avm::IVideoRenderer* renderer=0; int use_buffers = 4; int width = 0, height = 0; int quality; int status; unsigned int measureLength = 100; framepos_t framepos = 0; bool use_yuv = false; bool use_yv12 = false; bool hurry = false; bool direct = false; bool real_mode = false; bool video = true; bool draw = true; double seekTime = 0.0; const avm::Args::Option sizesubopts[] = { avm::ARGSOPTION("i", "width", "w", "window width", &width, -8192, 8192), avm::ARGSOPTION("i", "height", "h", "window height", &height, -8192, 8192), avm::ARGSOPTION("#", "", "", "") }; const avm::Args::Option opts[] = { avm::ARGSOPTION("b", "", "yuv", "use hardware acceleration if it is available. Assumes -sdl", &use_yuv), avm::ARGSOPTION("b", "", "yv12", "use YV12 hardware acceleration if it is available. Assumes -sdl.", &use_yv12), avm::ARGSOPTION("b", "", "real", "", &real_mode), avm::ARGSOPTION("b", "", "hurry", "test decoder for ability to 'hurry up'", &hurry), avm::ARGSOPTION("b", "", "direct", "use direct video memory buffers", &direct), avm::ARGSOPTION("b", "", "video", "render video (disable with off)", &video), avm::ARGSOPTION("b", "", "draw", "draw video (disable with off)", &draw), avm::ARGSOPTION("o", "size", "s", "set windows size", &sizesubopts), avm::ARGSOPTION("i", "", "frame", "seek to the given #frame in the movie", &framepos), avm::ARGSOPTION("i", "", "length", "measure #frames (100 defauls, 0 - full movie)", &measureLength), avm::ARGSOPTION("i", "", "buffers", "use # buffers (<2 - disable)", &use_buffers), avm::ARGSOPTION("i", "", "pp", "postprocessing", &quality), avm::ARGSOPTION("d", "", "seek", "seek to the given time in the movie", &seekTime), avm::ARGSOPTION("h", "", "", ""), avm::ARGSOPTION("O", "", "", "", avm::IAviPlayer::getOptions()), avm::ARGSOPTION("#", "", "", "") }; avm::Args(opts, &argc, argv, " [options] []\n" " Performs a measurement of Avifile performance for given file.\n" //" -size x y Zoom picture to dimensions x*y\n" " Description of result:\n" " \'Decompression\': Time spent on reading one video frame from file\n" " and its decompression.\n" " \'Drawing\' : Time spent on X server request.\n" " \'Sync\' : Time spent by X server on drawing the frame.\n" " Options:\n", g_pcProgramName); for (int i = 1; i < argc; i++) if (argv[i][0] != '-') { fn = argv[i]; printf("Detected filename: %s\n", fn); break; } /* else if (!strcmp(argv[i], "-size")) { use_zoom=1; xs=atoi(argv[i+1]); ys=atoi(argv[i+2]); if((xs<0)||(ys<0))use_zoom=0; } */ if (use_yv12) use_yuv = true; int64_t total_time_begin = avm_get_time_us(); double read_times=0, draw_times=0, sync_times=0, hurry_times=0; unsigned int frames=0; avm::IReadFile *file=0; Display* dpy=0; try { //char a[2023]; file = avm::CreateReadFile(fn); if (!file) throw FATAL("Cannot open video stream"); avm::IReadStream *stream = file->GetStream(0, avm::IStream::Video); //printf("TIME %f %d\n", stream->GetTime(), stream->GetPos()); if (!stream || stream->StartStreaming() != 0) throw FATAL("Cannot decode this video stream"); //printf("TIME %f %d\n", stream->GetTime(), stream->GetPos()); #ifndef X_DISPLAY_MISSING if (video) { dpy=XOpenDisplay(0); if(!dpy)throw FATAL("Cannot open X display"); stream->GetVideoDecoder()->SetDestFmt(avm::GetPhysicalDepth(dpy)); } #endif BITMAPINFOHEADER bh; stream->GetOutputFormat(&bh, sizeof(bh)); if (seekTime) { if (seekTime < 0 || seekTime > stream->GetLengthTime()) //if (stream->SeekTimeToKeyFrame(seekTime) < 0) throw FATAL("Bad seek location"); stream->SeekTimeToKeyFrame(seekTime); while (stream->GetTime()GetTime() << " " << seekTime << endl; if (stream->ReadFrame(false) < 0) throw FATAL("Bad seek location"); } } else if (framepos) { stream->SeekToKeyFrame(framepos); // throw FATAL("Bad seek location"); while (stream->GetPos()ReadFrame(false) != 0) throw FATAL("Bad seek location"); } bh.biHeight = (int32_t)labs(bh.biHeight); printf("Movie size: %dx%d [%.4s]\n", bh.biWidth, bh.biHeight, (char*) &bh.biCompression); if (measureLength && (stream->GetLength() - stream->GetPos()) < measureLength) throw FATAL("Movie too short for given length"); try { if (!use_yuv) throw FATAL("YUV renderer not requested"); BITMAPINFOHEADER bhy; stream->GetVideoFormat(&bhy, sizeof(bhy)); fourcc_t fcc; avm::IVideoDecoder::CAPS caps = stream->GetVideoDecoder()->GetCapabilities(); printf("Decoder YUV capabilities: 0%x\n", caps); if (caps & avm::IVideoDecoder::CAP_YUY2) fcc = fccYUY2; else if (caps & avm::IVideoDecoder::CAP_YV12) fcc = fccYV12; else if (caps & avm::IVideoDecoder::CAP_UYVY) fcc = fccUYVY; else throw FATAL("YUV format unsupported by decoder"); if (use_yv12 && caps & avm::IVideoDecoder::CAP_YV12) fcc = fccYV12; #ifndef X_DISPLAY_MISSING if (video) renderer = avm::CreateYUVRenderer(0, dpy, bhy.biWidth, bhy.biHeight, fcc); printf("Decoder YUV 0%x -> %p\n", fcc, renderer); #endif if (fcc) { if (stream->GetVideoDecoder()->SetDestFmt(0, fcc)) //shouldn't happen throw FATAL("Error setting YUV decoder output"); } } catch (avm::FatalError& e) { e.Print(); delete renderer; #ifndef X_DISPLAY_MISSING if (video) renderer = avm::CreateFullscreenRenderer(0, dpy, bh.biWidth, bh.biHeight); #endif } // m->move(100,100); // m->resize(20,20); if (width > 0 && height > 0 && renderer) renderer->Resize(width, height); else { width = bh.biWidth; height = bh.biHeight; } stream->SetBuffering(use_buffers, direct ? renderer : 0); frames = 0; int read_counts = 0, hurry_counts = 0; sig_t old_int = signal(SIGINT, sig_int); while (!sig_int_seen && !stream->Eof() && (!measureLength || frames < measureLength)) { int64_t t1 = avm_get_time_us(); //printf("TIME %f %d\n", stream->GetTime(), stream->GetPos()); stream->ReadFrame(hurry?(frames%5?false:true):draw); //stream->ReadFrame(hurry?(frames%5?false:true):true); //cout << "GetPos " << stream->GetPos() << endl; avm::CImage* im = stream->GetFrame(); if (im) { int64_t t2 = avm_get_time_us(); if (renderer) renderer->Draw(im); int64_t t3 = avm_get_time_us(); if (renderer) renderer->Sync(); int64_t t4 = avm_get_time_us(); im->Release(); if (hurry) { if (frames % 5) { hurry_counts++; hurry_times += avm_get_time_diff(t2,t1); } else { read_counts++; read_times += avm_get_time_diff(t2,t1); } } else { read_times += avm_get_time_diff(t2,t1); read_counts++; } draw_times += avm_get_time_diff(t3,t2); sync_times += avm_get_time_diff(t4,t3); frames++; } else printf("Zero image! - benchmark invalid\n"); } if (sig_int_seen) printf("*** BREAK ***\n"); signal(SIGINT, old_int); float total_time = avm_get_time_diff(avm_get_time_us(), total_time_begin); printf("Played %d frames in %.3f (t: %.3f) seconds ( avg frame rate %.3f fps )\n", frames, (hurry_times+read_times+draw_times+sync_times), total_time, frames/(read_times+draw_times+sync_times+hurry_times)); if (frames) { if (!hurry) printf("Average (Total) results:\n" "\tDecompression %f ms\t(%.3fs)\n" "\tDrawing %f ms\t\t(%.3fs)\n" "\tSync %f ms\t\t(%.3fs)\n", read_times/frames * 1000., read_times, draw_times/frames * 1000., draw_times, sync_times/frames * 1000., sync_times); else printf("Average results:\n\t" " Hurry decompression %f ms\n\t" " Normal decompression %f ms\n\t" " Drawing %f ms\n\t" " Sync %f ms\n", hurry_times/hurry_counts * 1000., read_times/read_counts * 1000., draw_times/frames * 1000., sync_times/frames * 1000.); } #ifndef X_DISPLAY_MISSING if (!use_yuv && sync_times > 0) { printf("Average video output speed: %f Mb/s\n", avm::GetPhysicalDepth(dpy)/8*width*height*frames/sync_times/(1024*1024)); } #endif } catch (avm::FatalError& error) { error.Print(); } delete file; delete renderer; #ifndef X_DISPLAY_MISSING if (dpy) XCloseDisplay(dpy); #endif //delete m; return 0; } avifile-0.7.48~20090503.ds/samples/misc/extractor.cpp0000644000175000017500000000310411164662634021066 0ustar yavoryavor/************************************************************************** Example of IAviReadFile & IAviReadStream interface usage. Copyright 2000 Eugene Kuznetsov (divx@euro.ru) **************************************************************************/ #include #include #include #include #include #include #include // exit #define __MODULE__ "extractor" int main(int argc, char** argv) { const size_t buffer_size = 20000; const char* outname = "./extractor.mp3"; FILE* f = 0; avm::IReadFile* ac = 0; avm::IReadStream* as = 0; uint8_t* zz = 0; if (GetAvifileVersion() != AVIFILE_VERSION) { fprintf(stderr, "This binary was compiled for Avifile ver. %d " ", but the library is ver. %d. Aborting.\n", AVIFILE_VERSION, GetAvifileVersion()); return 0; } if (argc == 0) { fprintf(stderr, "Missing argument: filename\n"); exit(0); } try { if (!(f = fopen(outname, "wb"))) throw FATAL("Can't open %s for writing", outname); if (!(ac = avm::CreateReadFile(argv[1]))) throw FATAL("Can't read given file"); if (!(as = ac->GetStream(0, avm::IStream::Audio))) throw FATAL("Stream doesn't contain audio stream"); zz = new uint8_t[buffer_size]; while (!as->Eof()) { size_t samp_read, bytes_read; as->ReadDirect(zz, buffer_size, buffer_size, samp_read, bytes_read); fwrite(zz, bytes_read, 1, f); } } catch (FatalError& error) { error.Print(); } delete ac; delete zz; if (f) fclose(f); } avifile-0.7.48~20090503.ds/samples/misc/imtest.cpp0000644000175000017500000000470610023627400020352 0ustar yavoryavor#include #include #include #include static const int WIDTH=640; static const int HEIGHT=480; static const char* names[]={"RGB15", "RGB16", "RGB24", "RGB32", "YUY2", "YV12"}; static BitmapInfo formats[6]; int main() { formats[0]=BitmapInfo(WIDTH, HEIGHT, 15); formats[1]=BitmapInfo(WIDTH, HEIGHT, 16); formats[2]=BitmapInfo(WIDTH, HEIGHT, 24); formats[3]=BitmapInfo(WIDTH, HEIGHT, 32); formats[4]=BitmapInfo(WIDTH, HEIGHT, 24); formats[4].SetSpace(fccYUY2); formats[5]=BitmapInfo(WIDTH, HEIGHT, 24); formats[5].SetSpace(fccYV12); long t1, t2; printf("Quality of conversion ( 0 ideal, 255 worst ):\n"); printf("\tRGB15\tRGB16\tRGB24\tRGB32\tYUY2\tYV12\n"); for(int i=0; i<6; i++) { printf("%s\t", names[i]); CImage* im=new CImage(&formats[i]); CImage* im2; CImage* im3; int j; unsigned char* p=im->Data(); for(j=0; jBytes(); j++)p[j]=(((j*64377)^8529)%200)+20; for(int j=0; j<6; j++) { double sum=0; im2=new CImage(im, &formats[j]); im3=new CImage(im2, &formats[2]); CImage* im4=new CImage(im, &formats[2]); for(int k=0; kBytes(); k++) sum+=abs(im4->Data()[k]-im3->Data()[k]); printf("%.2f\t", sum/im4->Bytes()); delete im4; delete im3; delete im2; } printf("\n"); delete im; } printf("Without flipping:\n"); printf("\tRGB15\tRGB16\tRGB24\tRGB32\tYUY2\tYV12\n"); for(int i=0; i<6; i++) { printf("%s\t", names[i]); CImage* im=new CImage(&formats[i]); CImage* im2; int j; unsigned char* p=im->Data(); for(j=0; jBytes(); j++)p[j]=(((j*64377)^8529)%200)+20; for(int j=0; j<6; j++) { t1=localcount(); im2=new CImage(im, &formats[j]); t2=localcount(); printf("%.2f\t", double(t2-t1)/(WIDTH*HEIGHT)); delete im2; } printf("\n"); delete im; } printf("With flipping:\n"); printf("\tRGB15\tRGB16\tRGB24\tRGB32\tYUY2\tYV12\n"); for(int i=0; i<6; i++) { printf("%s\t", names[i]); CImage* im=new CImage(&formats[i]); CImage* im2; int j; unsigned char* p=im->Data(); for(j=0; jBytes(); j++)p[j]=(((j*64377)^8529)%200)+20; for(int j=0; j<6; j++) { // printf("%d->%d\n", i, j); formats[j].biHeight*=-1; t1=localcount(); im2=new CImage(im, &formats[j]); t2=localcount(); formats[j].biHeight*=-1; printf("%.2f\t", double(t2-t1)/(WIDTH*HEIGHT)); delete im2; } printf("\n"); delete im; } return 0; } avifile-0.7.48~20090503.ds/samples/misc/plustest.cpp0000644000175000017500000000475407646564172020762 0ustar yavoryavor#include #include #include using namespace std; using namespace Creators; #define __MODULE__ "plustest" int main() { IVideoEncoder* enc=0; FILE* f1=0, *f2=0; char* compressed=0; try { f1=fopen("./uncompr.bmp", "rb"); if(f1==0) throw FATAL("This program expects to find 384x288x24 file ./uncompr.bmp"); char h[14]; fread(h, 14, 1, f1); //char bh[0x28]; BITMAPINFOHEADER bh; BITMAPINFOHEADER obh; fread(&bh, 0x28, 1, f1); char pic[384*288*3]; fread(pic, 384*288*3, 1, f1); // bh.biWidth=bh.biHeight=200; CImage im((BitmapInfo*)&bh, (unsigned char*)pic, false); // enc=CreateVideoEncoder(mmioFOURCC('d', 'v', 'x', '1'), bh); // enc=CreateVideoEncoder(mmioFOURCC('M', 'P', '0', '1'), bh); const CodecInfo* ci=CodecInfo::match(mmioFOURCC('D', 'I', 'V', '3')); if(ci) { SetCodecAttr(*ci, "KeyFrames", 1) ; SetCodecAttr(*ci, "BitRate", 1000); SetCodecAttr(*ci, "Crispness", 0); } enc=CreateVideoEncoder(mmioFOURCC('D', 'I', 'V', '3'), bh); if(!enc)throw FATAL(GetError().c_str()); // enc->SetKeyFrame(10); // enc->SetQuality(8000); int size=enc->GetOutputSize(); if(size<=0) throw FATAL("GetOutputSize() failed"); else printf("Driver reported %d as a maximum output size\n", size); compressed=new char[size]; enc->Start(); obh=enc->QueryOutputFormat(); int keyf; for(int i=0; i<30; i++) { if(enc->EncodeFrame(&im, compressed, &keyf, &size)!=0) { printf("EncodeFrame() failed\n"); } else printf("Frame %d encoded as %d ( %s ) into %d bytes\n", i, keyf, keyf&16?"Key frame":"Delta frame", size); } enc->Stop(); f2=fopen("./compr.qw", "wb"); fwrite(&obh, sizeof(BITMAPINFOHEADER), 1, f2); fwrite(compressed, size, 1, f2); fclose(f1); fclose(f2);f2=0; f1=fopen("./decompr.bmp", "wb"); fwrite(h, 14, 1, f1); fwrite(&bh, sizeof(BITMAPINFOHEADER), 1, f1); IVideoDecoder* dc=CreateVideoDecoder(obh); if(!dc)throw FATAL(GetError().c_str()); dc->SetDirection(true); dc->Start(); // dc->SetDestFmt(0, fccYUY2); // dc->SetDestFmt(16); dc->DecodeFrame(compressed, size, keyf); CImage* img=dc->GetFrame(); fwrite(img->Data(), img->Bytes(), 1, f1); img->Release(); dc->Stop(); FreeVideoDecoder(dc); } catch(FatalError& error) { error.PrintAll(); } if(f1)fclose(f1); if(f2)fclose(f2); FreeVideoEncoder(enc); if(compressed)delete compressed; return 0; } avifile-0.7.48~20090503.ds/samples/misc/qualtest.cpp0000644000175000017500000003507107367226463020733 0ustar yavoryavor/** * Quick & dirty way to compare quality of different video encoders. * Example: * qualtest -f your-movie-file.avi -t 20. -div3 600 * recompresses one second of movie, starting from 20 second position, * into divx low-motion with bitrate 600 kbps, dumps two screenshots: * 'reference.bmp' for uncompressed pix and 'div3_600.bmp' for result of * recompression, and tells you about actual achieved bitrate. * Supported formats: DivX low-motion, OpenDivX & Sparky. */ #include #include #include #include #include #include #include #include using namespace std; #define fccDIVX mmioFOURCC('d', 'i', 'v', 'x') const int FRAMES=25; struct Result { int quality; int bitrate; }; inline short clamp(short t) { return((t<0)?0:((t>255)?255:t)); } ostream& operator<<(ostream& o, Result r) { return o<<" error level "<Bytes(); i++) s+=abs((int)im->Data()[i]-(int)im2->Data()[i]); return s; } CImage* filter(CImage* image) { static int call=0; call++; int addition=5*sin(call/10.); CImage* result=new CImage(image); for(int i=1; iWidth()-1; i++) for(int j=1; jHeight()-1; j++) { col* pc1=(col*)(image->Data()+i*3+j*3*image->Width()-3); col* pc=(col*)(image->Data()+i*3+j*3*image->Width()); col* pc2=(col*)(image->Data()+i*3+j*3*image->Width()+3); col* dst=(col*)(result->Data()+i*3+j*3*image->Width()); dst->r=clamp(((short)pc1->r+3*(short)pc->r+(short)pc2->r)*0.27+addition); dst->g=clamp(((short)pc1->g+3*(short)pc->g+(short)pc2->g)*0.27+addition); dst->b=clamp(((short)pc1->b+3*(short)pc->b+(short)pc2->b)*0.27+addition); } return result; } int get_im_color(int i, int j) { return ((i/2)*123+(j/2)*459)%32;// + 3*(i%2) + 3*(j%2); } //yuy2 /* int diff(CImage* im1, CImage* im2, int x1, int y1, int x2, int y2) { int sum=0; unsigned char* ptr1=im1->Data()+2*(x1+y1*im1->Width()); unsigned char* ptr2=im2->Data()+2*(x2+y2*im2->Width()); for(int i=0; i<8; i++) { for(int j=0; j<8; j++) sum+=abs((short)ptr1[2*j]-(short)ptr2[2*j]); ptr1+=2*im1->Width(); ptr2+=2*im2->Width(); } return sum; } */ void InitVectorImage(CImage* vec_im) { memset(vec_im->Data(), 128, vec_im->Bytes()); int i,j; for(i=0; iWidth()/8; i++) for(j=0; jHeight()/8; j++) { int im_color=get_im_color(i,j); for(int k=0; k<8; k++) for(int l=0; l<8; l++) vec_im->Data()[2*((i*8+l)+(j*8+k)*vec_im->Width())] =im_color+128+32*cos(k*3.14159/8.)*(i%2) +32*cos(l*3.14159/8.)*(j%2); } } void match(CImage* orig, CImage* tmp_im2, int i, int j, int& x_opt, int& y_opt) { x_opt=y_opt=0; int bestval=4096*256; const int width=tmp_im2->Width(); for(int x=-8; x<=8; x++) for(int y=-8; y<=8; y++) { int sum=0; unsigned char* ptr1=orig->Data()+2*((i*8+x)+(j*8+y)*width); unsigned char* ptr2=tmp_im2->Data()+2*(i*8+j*8*width); for(int k=0; k<8; k++) { for(int l=0; l<8; l++) { short dif=(short)ptr1[2*l]-(short)ptr2[2*l]; if(dif<0) sum-=dif; else sum+=dif; } if(sum>bestval) goto next; ptr1+=2*width; ptr2+=2*width; } if(sumStart(); dc->DecodeFrame(vec_buffer, vec_size, 16); CImage* im=dc->GetFrame(); BitmapInfo bi(im->Width(), im->Height(), fccYUY2); CImage* orig=new CImage(im, &bi); orig->Dump("orig.bmp"); im->Release(); dc->DecodeFrame(buf, size, 0); im=dc->GetFrame(); im->Dump("vec_diff.bmp"); CImage* tmp_im2=new CImage(im, &bi); im->Release(); dc->Stop(); dc->Start(); dc->DecodeFrame(gray_buffer, gray_size, 16); dc->DecodeFrame(buf, size, 0); im=dc->GetFrame(); CImage* tmp_im3=new CImage(im, &bi); im->Release(); dc->Stop(); int sum=0; yuv y(col(128,128,128)); int i,j; for(i=0; iBytes(); i++) tmp_im2->Data()[i]+=((i%2)?y.Cr:y.Y)-(short)tmp_im3->Data()[i]; tmp_im2->Dump("vec_diff2.bmp"); // CImage* orig=new CImage(tmp_im2); // InitVectorImage(orig); bi.SetSpace(fccYV12); CImage* vectors=new CImage(&bi); memset(vectors->Data(), 128, vectors->Width()*vectors->Height()); for(i=16; iWidth()-16; i+=8) for(j=16; jHeight()-16; j+=8) { int x_opt, y_opt; match(orig, tmp_im2, i/8, j/8, x_opt, y_opt); for(int k=0; k<4; k++) { memset(vectors->Data()+vectors->Width()*vectors->Height() +i/2+(j/2+k)*vectors->Width()/2, 128+x_opt*4, 4); memset(vectors->Data()+5*vectors->Width()*vectors->Height()/4 +i/2+(j/2+k)*vectors->Width()/2, 128+y_opt*4, 4); } } orig->Release(); vectors->Dump("vectors-pred.bmp"); vectors->Release(); tmp_im2->Release(); dc->Stop(); } void dump_gray(CImage* unc, char* buf, int size, char* gray_buffer, int gray_size, IVideoDecoder* dc) { BitmapInfo bi(unc->Width(), unc->Height(), fccYUY2); CImage* tmp_im=new CImage(unc, &bi); dc->Start(); dc->DecodeFrame(gray_buffer, gray_size, 16); dc->DecodeFrame(buf, size, 0); CImage* im=dc->GetFrame(); im->Dump("diff.bmp"); CImage* tmp_im2=new CImage(im, &bi); int sum=0; yuv y(col(128,128,128)); for(int i=0; iBytes(); i++) { tmp_im->Data()[i]+=0x80-(short)tmp_im2->Data()[i]; if(i%2) sum+=abs(y.Cr-(short)tmp_im2->Data()[i]); else sum+=abs(y.Y-(short)tmp_im2->Data()[i]); } printf("/%d ", sum); tmp_im->Dump("compens-pred.bmp"); tmp_im2->Release(); tmp_im->Release(); im->Release(); dc->Stop(); } IAviReadStream* stream; double startpos=297.; bool exact=true; Result measure(int compressor, const char* filename) { // stream->SeekTimeToKeyframe(599.0); // stream->SeekTimeToKeyframe(55.0); stream->SeekTimeToKeyFrame(startpos); stream->SetDirection(true); stream->StartStreaming(); // stream->GetDecoder()->SetDestFmt(0, fccYUY2); if(exact) while(stream->GetTime()ReadFrame(); IRtConfig* rtc=dynamic_cast(stream->GetDecoder()); if(rtc)rtc->SetValue("Quality", 4); stream->ReadFrame(); CImage* im=stream->GetFrame(); // CImage* filtered=filter(im); // im->Release(); // im=filtered; char gray_buffer[100000]; int gray_size; char vec_buffer[100000]; int vec_size; IVideoEncoder* enc=Creators::CreateVideoEncoder(compressor, *(im->GetFmt())); if(!enc){im->Release();return Result();} IVideoDecoder* dc=Creators::CreateVideoDecoder(enc->GetOutputFormat()); if(!dc){im->Release();Creators::FreeVideoEncoder(enc);return Result();} // IVideoDecoder* dc2=Creators::CreateVideoDecoder(enc->GetOutputFormat()); char* buf=new char[enc->GetOutputSize()]; dc->SetDirection(true); // dc2->SetDirection(true); dc->Start(); // enc->Start(); int size=0, read_size=0, is_keyframe=0; int qual=0; // CImage* gray=new CImage(im); // memset(gray->Data(), 128, gray->Bytes()); // enc->EncodeFrame(gray, gray_buffer, &is_keyframe, &gray_size); // enc->Stop(); BitmapInfo bi(im->Width(), im->Height(), fccYUY2); // CImage* vec_im=new CImage(&bi); // InitVectorImage(vec_im); // enc->Start(); // enc->EncodeFrame(vec_im, vec_buffer, &is_keyframe, &vec_size); // vec_im->Release(); // enc->Stop(); enc->Start(); enc->EncodeFrame(im, buf, &is_keyframe, &size); read_size+=size; dc->DecodeFrame(buf, size, is_keyframe); CImage* im2=dc->GetFrame(); qual+=diff(im, im2); im->Release(); im2->Release(); for(int i=0; iReadFrame(); im=stream->GetFrame(); // filtered=filter(im); // im->Release(); // im=filtered; im->Dump("reference.bmp"); enc->EncodeFrame(im, buf, &is_keyframe, &size); if(compressor!=fccDIV3) cout<>1)&31)<<")"<DecodeFrame(buf, size, is_keyframe); im2=dc->GetFrame(); // dump_gray(im2, buf, size, gray_buffer, gray_size, dc2); // dump_vectors(buf, size, gray_buffer, gray_size, vec_buffer, vec_size, dc2); cout<<" "<Dump(filename); im->Release(); im2->Release(); } Result res; res.bitrate=read_size; res.quality=qual; cout<StopStreaming(); // Creators::FreeVideoDecoder(dc2); Creators::FreeVideoDecoder(dc); Creators::FreeVideoEncoder(enc); delete[] buf; return res; } void measure_sparky(int intraq, int interq) { char outfn[256]; if(interq==intraq) sprintf(outfn, "spark_%d.bmp", intraq); else sprintf(outfn, "spark_%d_%d.bmp", intraq, interq); int fcc=mmioFOURCC('S', 'P', '0', '1'); const CodecInfo* info=CodecInfo::match(fcc); Creators::SetCodecAttr(*info, "IntraQ", intraq); Creators::SetCodecAttr(*info, "InterQ", interq); measure(fcc, outfn); } void measure_div3(int bitrate) { char outfn[256]; sprintf(outfn, "div3_%d.bmp", bitrate); const CodecInfo* info=CodecInfo::match(fccDIV3); Creators::SetCodecAttr(*info, "BitRate", bitrate); Creators::SetCodecAttr(*info, "Crispness", 0); measure(fccDIV3, outfn); } void measure_divx(int quant) { char outfn[256]; sprintf(outfn, "divx_%d.bmp", quant); const CodecInfo* info=CodecInfo::match(fccDIVX); Creators::SetCodecAttr(*info, "min_quantizer", quant); Creators::SetCodecAttr(*info, "max_quantizer", quant); measure(fccDIVX, outfn); } int main(int argc, char** argv) { startpos=297.; exact=true; char* fn="/d/drafts/movie.avi"; int i; for(i=1; iGetStream(0, AviStream::Video); const CodecInfo* info=CodecInfo::match(fccIV50); Creators::SetCodecAttr(*info, "QuickCompress", 0); info=CodecInfo::match(fccDIV3); Creators::SetCodecAttr(*info, "Hue", 50); Creators::SetCodecAttr(*info, "Saturation", 50); for(i=1; i #include #include #include #include #include #include extern int ASF_DEBUG; //extern int DSHOW_DEBUG; #define __MODULE__ "test" using namespace std; int main(int argc, char** argv) { try { avm::vector t(1000000000); printf("OK %p\n", t.begin()); } catch (...) { printf("exe\n"); } avm::IWriteFile* avi_file = avm::CreateWriteFile("test.avi"); WAVEFORMATEX wfm; wfm.wFormatTag=WAVE_FORMAT_PCM; wfm.nChannels=1; wfm.nSamplesPerSec=44100*1; // frequency x channels wfm.nAvgBytesPerSec=2*44100; wfm.nBlockAlign=2; // 2 byte per sample ? what value should I give here ? wfm.wBitsPerSample=16; wfm.cbSize=0; avm::IAudioWriteStream *stream; // ( the object "avi_file" has already been created elsewhere) stream=avi_file->AddAudioStream(WAVE_FORMAT_MPEGLAYER3, &wfm, 8000); //mp3, 8000ko/s (128kbits/s) stream->Start(); char tmp[100]; // stream->AddData(tmp, 6); // stream->Stop(); // delete avi_file; // Load Win32 DLL and get address of one of its exports. // HMODULE lib=LoadLibrary("/usr/lib/win32/acelpdec.ax"); // HMODULE lib=LoadLibrary("/usr/lib/win32/ir50_32.dll"); // void* addr=(void*)GetProcAddress(lib, "DllGetClassObject"); // Open WMV file, read some data ( with implicit decompression ) // from its streams. // DSHOW_DEBUG=1; // LOADER_DEBUG=1; // ASF_DEBUG=1; // IAviReadFile* file=CreateIAviReadFile("/d/test-movies/kelssyV_500VBR.wmv"); // IAviReadFile* file=CreateIAviReadFile("/d/test-movies/iv5.avi"); // IAviReadFile* file=CreateIAviReadFile("/d/movies/Eyes on me.asf"); // IAviReadFile* file=CreateIAviReadFile("/d/movies/Baby one more time.asf"); // IAviReadFile* file=CreateIAviReadFile("/d/movies/mission2mars.avi"); // IAviReadFile* file=CreateIAviReadFile("/d/test-movies/dest2.avi"); // IAviReadFile* file=CreateIAviReadFile("/d/movies/Lucky - Britney Spears.avi"); // IAviReadFile* file=CreateIAviReadFile("/d/test-movies/smth.asf"); // IAviReadFile* file=CreateIAviReadFile("/d/movies/Windows Movie Maker Sample File.wmv"); /* const char* s="/d/test-movies/i263.avi"; if(argc>1)s=argv[1]; IAviReadFile* file=CreateIAviReadFile(s); IAviReadStream* ss=file->GetStream(0, AviStream::Audio); char qwe[100000]; ss->StartStreaming(); // ss->Seek((unsigned int)12); unsigned int samp_read, b_read; const int size=19530; ss->ReadFrames(qwe, size, size, samp_read, b_read); printf("%d/%d\n", samp_read, b_read); IAviReadStream* stream=file->GetStream(0, AviStream::Video); stream->StartStreaming(); // stream->GetDecoder()->SetDestFmt(16); // stream->StopStreaming(); // stream->StartStreaming(); // unsigned int prev_kf=stream->GetPrevKeyFrame(240); // printf("prev_kf: %d\n", prev_kf); // stream->Seek(prev_kf); // while(stream->GetPos()<240 && !stream->Eof()) // stream->ReadFrame(); stream->ReadFrame(); // IRtConfig* cf=dynamic_cast(stream->GetDecoder()); // if(cf)cf->SetValue("Brightness", 123); // if(cf)cf->SetValue("Contrast", -78); stream->ReadFrame(); stream->ReadFrame(); stream->ReadFrame(); stream->ReadFrame(); stream->ReadFrame(); stream->ReadFrame(); stream->ReadFrame(); stream->ReadFrame(); CImage* zz=stream->GetFrame(); unsigned char* qq=(unsigned char*)(zz->data()); qq+=10*zz->bpl(); printf("%02x %02x %02x %02x %02x %02x\n", qq[0], qq[1], qq[2], qq[3], qq[4], qq[5], qq[6]); zz->release(); delete file; */ // Create an AVI player object for MMS URL and play it for some time. // char* fn="mms://208.184.229.156/vidnet0200/pp/bspears2pp.asf"; // mms://netshow.warnerbros.com/asfroot2/wbmovies/plutonash/teaser_56.wmv // mms://208.184.229.153/launch/video/music/000/000/248/248651.asf /* char* fn="mms://netshow.mp.intervu.net/rfvir_guiltypleasures_56"; if(argc>1)fn=argv[1]; Display* _dpy=XOpenDisplay(0);//0 returned here is just fine IAviPlayer2* player=CreateAviPlayer2(0, _dpy, fn, 0); while(!player->IsOpened())sleep(1); if(!player->IsValid()) { printf("Failed to open\n"); delete player; } else { player->Start(); sleep(2); // player->reseek(120.); sleep(1500); delete player; } if(_dpy)XCloseDisplay(_dpy); */ /* // Decompress a compressed image. int fd=open("./compr.zzz", O_RDONLY); char header[0x28]; read(fd, header, 0x28); IVideoDecoder* dc=CreateVideoDecoder(*(BITMAPINFOHEADER*)(&header[0])); if(!dc)throw FATAL(GetError().c_str()); // dc->SetDestFmt(0, fccYUY2); dc->Start(); char* pix=new char[100000]; int size=read(fd, pix, 100000); dc->DecodeFrame(pix, size, 16); CImage* im=dc->GetFrame(); close(fd); fd=open("./decompr.raw", O_WRONLY | O_CREAT); write(fd, im->data(), im->bytes()); close(fd); dc->Stop(); delete dc; return 0; */ } avifile-0.7.48~20090503.ds/samples/Makefile.am0000644000175000017500000000012511107051670017435 0ustar yavoryavorSUBDIRS = misc qtvidcap qtrecompress mjpeg_plugin MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/samples/README0000644000175000017500000000223507316170064016273 0ustar yavoryavorMISC: A few short examples of using library. QTVIDCAP: Video capture program. QTRECOMPRESS: Video recompression program. AVI tools The Avifile package (http://divx.euro.ru/) provides a library of primitives for reading/parsing .AVI (Windows Media Player) video files. There are a few obvious things (like displaying file info and concatenating files) that I wanted to do and which are pretty easy to do using this library. Hence this package... There are currently 3 programs: avitype - For a set of .avi files, print a little display for each with the video/audio codecs, frame size, frame rate, etc. This display is not currently very clean or well organized. Somebody could enhance this quite a bit. avicat - Take a set of .avi files and combine them into one single .avi file. Specify output with a -o option or else "out.avi". Assumes inputs are same format, otherwise bad things might happen... avimake - Take a set of .jpg images and turn them into a div3 movie. Output specified with -o, frame rate with -r. Hope this is useful to other folks. Do with this code whatever you wish (i.e. public domain). Tom Pavel avifile-0.7.48~20090503.ds/samples/mjpeg_plugin/0000755000175000017500000000000011267646347020105 5ustar yavoryavoravifile-0.7.48~20090503.ds/samples/mjpeg_plugin/Makefile.am0000644000175000017500000000053311110407242022112 0ustar yavoryavorif AMM_USE_JPEGLIB pkglib_LTLIBRARIES = osmjpeg.la endif noinst_HEADERS =\ colorspace.h\ mjpeg.h\ fillplugins.h osmjpeg_la_SOURCES =\ main.cpp\ mjpeg.c osmjpeg_la_LIBADD = ../../lib/libaviplay.la $(JPEG_LIBS) osmjpeg_la_LDFLAGS = -avoid-version -module AM_CXXFLAGS = $(CXXRTTIEXCEPT) $(VISIBILITYFLAG) MAINTAINERCLEANFILES = Makefile.in avifile-0.7.48~20090503.ds/samples/mjpeg_plugin/colorspace.h0000644000175000017500000000415307427455516022412 0ustar yavoryavortypedef int (*color_conv)(unsigned char *d, unsigned char *s, int p); void lut_init(unsigned long red_mask, unsigned long green_mask, unsigned long blue_mask, int depth, int swap); int rgb24_to_lut2(unsigned char *dest, unsigned char *src, int p); int bgr24_to_lut2(unsigned char *dest, unsigned char *src, int p); int rgb32_to_lut2(unsigned char *dest, unsigned char *src, int p); int bgr32_to_lut2(unsigned char *dest, unsigned char *src, int p); int gray_to_lut2(unsigned char *dest, unsigned char *src, int p); int rgb24_to_lut4(unsigned char *dest, unsigned char *src, int p); int bgr24_to_lut4(unsigned char *dest, unsigned char *src, int p); int rgb32_to_lut4(unsigned char *dest, unsigned char *src, int p); int bgr32_to_lut4(unsigned char *dest, unsigned char *src, int p); int gray_to_lut4(unsigned char *dest, unsigned char *src, int p); /* ------------------------------------------------------------------- */ /* RGB conversions */ int rgb24_to_bgr24(unsigned char *dest, unsigned char *src, int p); int bgr24_to_bgr32(unsigned char *dest, unsigned char *src, int p); int bgr24_to_rgb32(unsigned char *dest, unsigned char *src, int p); int rgb32_to_rgb24(unsigned char *dest, unsigned char *src, int p); int rgb32_to_bgr24(unsigned char *dest, unsigned char *src, int p); int byteswap_short(unsigned char *dest, unsigned char *src, int p); /* ------------------------------------------------------------------- */ /* color => grayscale */ int rgb15_native_gray(unsigned char *dest, unsigned char *src, int p); int rgb15_be_gray(unsigned char *dest, unsigned char *src, int p); int rgb15_le_gray(unsigned char *dest, unsigned char *src, int p); /* ------------------------------------------------------------------- */ /* YUV conversions */ int packed422_to_planar422(unsigned char *d, unsigned char *s, int p); int packed422_to_planar420(unsigned char *d, unsigned char *s, int p); #if 0 int packed422_to_planar411(unsigned char *d, unsigned char *s, int w, int h); #endif avifile-0.7.48~20090503.ds/samples/mjpeg_plugin/fillplugins.h0000644000175000017500000000314011165741544022574 0ustar yavoryavor#ifndef OSMJPEG_FILLPLUGINS_H #define OSMJPEG_FILLPLUGINS_H #include "infotypes.h" #include "avm_fourcc.h" AVM_BEGIN_NAMESPACE; static void ijpg_FillPlugins(avm::vector& ci) { const char ijpg_about[] = "OpenSource Motion JPEG codec, based on libjpeg."; const char* const dctm[] = { "IntSlow", "IntFast", "Float", 0 }; const fourcc_t ijpg_codecs[] = { fccmjpg, fccMJPG, mmioFOURCC('A', 'V', 'R', 'n'), mmioFOURCC('A', 'V', 'D', 'J'), 0 }; avm::vector vs; avm::vector ds; vs.push_back(AttributeInfo("h_samp", "Horizontal sampling (kbps)", AttributeInfo::Integer, 1, 4)); vs.push_back(AttributeInfo("v_samp", "Vertical sampling (kbps)", AttributeInfo::Integer, 1, 4)); vs.push_back(AttributeInfo("quant_tbl", "Quantization table", AttributeInfo::Integer, 0, 1)); vs.push_back(AttributeInfo("smoothing", "Smoothing (0..100)", AttributeInfo::Integer, 0, 100)); vs.push_back(AttributeInfo("dct", "DCT Method", dctm )); static const char* dm[] = { "None", "Ordered", "Floyd-Steinberg", 0 }; ds.push_back(AttributeInfo("dither", "Dither mode", dm)); ds.push_back(AttributeInfo("dct", "DCT Method", dctm )); ds.push_back(AttributeInfo("upsampling", "Fancy upsampling", AttributeInfo::Integer, 0, 1)); ds.push_back(AttributeInfo("smoothing", "Block smoothing", AttributeInfo::Integer, 0, 1)); ci.push_back(CodecInfo(ijpg_codecs, "OS Motion JPEG", "", ijpg_about, CodecInfo::Plugin, "ijpg", CodecInfo::Video, CodecInfo::Both, 0, vs, ds)); } AVM_END_NAMESPACE; #endif // OSMJPEG_FILLPLUGINS_H avifile-0.7.48~20090503.ds/samples/mjpeg_plugin/main.cpp0000644000175000017500000001050411164474365021530 0ustar yavoryavor#include "fillplugins.h" #include "mjpeg.h" #include #include #include #include #include #include #include #include AVM_BEGIN_NAMESPACE; // FIXME mjpeg -> ijpg - with 0.6 PLUGIN_TEMP(mjpeg) class MJPEG_VideoDecoder: public IVideoDecoder { struct jpeg_decompress_struct* mjpg_dinfo; CImage* tci; public: MJPEG_VideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& format, int flip) :IVideoDecoder(info, format), mjpg_dinfo(0), tci(0) { m_Dest = format; m_Dest.SetBits(24); if (flip) m_Dest.biHeight = (int32_t)labs(m_Dest.biHeight); } ~MJPEG_VideoDecoder() { Stop(); if (tci) tci->Release(); } virtual int SetDestFmt(int bits = 24, fourcc_t csp = 0) { if (!CImage::Supported(csp, bits)) return -1; if (!csp) switch (bits) { case 15: case 16: case 24: case 32: m_Dest.SetBits(bits); Restart(); return 0; } else m_Dest.SetSpace(csp); if (tci) tci->Release(); tci = 0; return 0; } virtual int DecodeFrame(CImage* dest, const void* src, size_t size, int is_keyframe, bool render = true, CImage** pOut = 0) { if (mjpg_dinfo) { BitmapInfo bi(dest->GetFmt()); bi.SetBits(24); if (tci && !tci->IsFmt(&bi)) { tci->Release(); tci = 0; } if (!tci) tci = new CImage(&bi); mjpg_bgr_decompress(mjpg_dinfo, tci->Data(), (unsigned char*)src, (int)size); dest->Convert(tci); return 0; } return -1; } virtual int Start() { if (!mjpg_dinfo) { mjpg_dinfo = mjpg_dec_bgr_init(m_Dest.biWidth, m_Dest.biHeight); } return 0; } virtual int Stop() { if (mjpg_dinfo) { mjpg_dec_cleanup(mjpg_dinfo); mjpg_dinfo = 0; } return 0; } }; class MJPEG_VideoEncoder: public IVideoEncoder { BitmapInfo header; BitmapInfo of; struct jpeg_compress_struct* mjpg_cinfo; int quality; public: MJPEG_VideoEncoder(const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& bh) :IVideoEncoder(info), mjpg_cinfo(0) { //if (!CImage::Supported(bh)) // throw FATAL("Unsupported video format"); of = bh; header = bh; of.biCompression = compressor; //of.biHeight = labs(of.biHeight); } ~MJPEG_VideoEncoder() { Stop(); } virtual size_t GetOutputSize() const { return (int)header.biWidth * (int)labs(header.biHeight + 1) * 4; } const BITMAPINFOHEADER& GetOutputFormat() const { return of; } virtual int EncodeFrame(const CImage* src, void* dest, int* is_keyframe, size_t* size, int* lpckid=0) { if ((dest == 0) || (src == 0)) { if (size) *size = 0; return 0; } const CImage* tmp; if (header.biBitCount != 24 || header.biCompression) { BitmapInfo supp(header); supp.SetBits(24); supp.biBitCount=24; supp.biCompression=0; tmp = new CImage(src, &supp); } else { tmp = src;//new CImage(src); } int sz = mjpg_bgr_compress(mjpg_cinfo, (unsigned char*)dest, tmp->Data(), tmp->Pixels()); if (size) *size = sz; if (is_keyframe) *is_keyframe = 16;//AVIIF_KEYFRAME if (src != tmp) delete tmp; return 0; } virtual int Start() { mjpg_cinfo = mjpg_bgr_init(header.biWidth, header.biHeight, quality); //printf("Create %p\n", mjpg_cinfo); return 0; } virtual int Stop() { if (mjpg_cinfo) { mjpg_cleanup(mjpg_cinfo); mjpg_cinfo = 0; } return 0; } virtual int SetQuality(int q) { quality = q / 100; return 0; } virtual int GetQuality() const { return quality * 100;; } }; IVideoEncoder* ijpg_CreateVideoEncoder(const CodecInfo& info, fourcc_t compressor, const BITMAPINFOHEADER& bh) { return new MJPEG_VideoEncoder(info, compressor, bh); } IVideoDecoder* ijpg_CreateVideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& bh, int flip) { return new MJPEG_VideoDecoder(info, bh, flip); } AVM_END_NAMESPACE; extern "C" AVMEXPORT avm::codec_plugin_t avm_codec_plugin_mjpeg; avm::codec_plugin_t avm_codec_plugin_mjpeg = { PLUGIN_API_VERSION, 0, 0, 0, 0, //avm::mjpeg_GetAttrInt, 0, //avm::mjpeg_SetAttrInt, 0, 0, // attrs avm::ijpg_FillPlugins, 0, 0, // audio avm::ijpg_CreateVideoDecoder, avm::ijpg_CreateVideoEncoder, }; avifile-0.7.48~20090503.ds/samples/mjpeg_plugin/mjpeg.c0000644000175000017500000003007310745745421021347 0ustar yavoryavor#include "config.h" #include #include #include #include "mjpeg.h" //#include "colorspace.h" /* ---------------------------------------------------------------------- */ static int debug=0; static inline void bgr2rgb(unsigned char* out, const unsigned char* in, unsigned int n) { unsigned char* oute = out + 3 * n; while (out < oute) { unsigned char c = in[0]; out[1] = in[1]; out[0] = in[2]; out[2] = c; c = in[3]; out[4] = in[4]; out[3] = in[5]; out[5] = c; out += 6; in += 6; } } /* ---------------------------------------------------------------------- */ static void mjpg_dest_init(struct jpeg_compress_struct* cinfo) { mjpg_client* mc = (mjpg_client*)cinfo->client_data; cinfo->dest->next_output_byte = mc->mjpg_buffer; cinfo->dest->free_in_buffer = mc->mjpg_bufsize; } static boolean mjpg_dest_flush(struct jpeg_compress_struct* cinfo) { fprintf(stderr,"mjpg: panic: output buffer too small\n"); exit(1); } static void mjpg_dest_term(struct jpeg_compress_struct* cinfo) { mjpg_client* mc = (mjpg_client*)cinfo->client_data; mc->mjpg_bufused = mc->mjpg_bufsize - cinfo->dest->free_in_buffer; } static void mjpg_src_init(struct jpeg_decompress_struct* dinfo) { mjpg_client* mc = (mjpg_client*) dinfo->client_data; //printf("Init %p %d\n", mc->mjpg_buffer, mc->mjpg_datasize); dinfo->src->next_input_byte = mc->mjpg_buffer; dinfo->src->bytes_in_buffer = mc->mjpg_datasize; } static boolean mjpg_src_fill(struct jpeg_decompress_struct* dinfo) { printf("Fill\n"); return -1; } static void mjpg_src_skip(struct jpeg_decompress_struct* dinfo, long bytes) { //printf("Skip %ld\n", bytes); dinfo->src->next_input_byte += bytes; dinfo->src->bytes_in_buffer -= bytes; } static boolean mjpg_src_resync(struct jpeg_decompress_struct *dinfo, int desired) { printf("Resync\n"); return -1; } static void mjpg_src_term(struct jpeg_decompress_struct* dinfo) { //printf("SrcTerm\n"); } static void mjpg_init_client(mjpg_client* mc) { memset(mc, 0, sizeof(mjpg_client)); mc->mjpg_dest.empty_output_buffer = mjpg_dest_flush; mc->mjpg_dest.init_destination = mjpg_dest_init; mc->mjpg_dest.term_destination = mjpg_dest_term; mc->mjpg_src.fill_input_buffer = mjpg_src_fill; mc->mjpg_src.init_source = mjpg_src_init; mc->mjpg_src.resync_to_restart = mjpg_src_resync; mc->mjpg_src.skip_input_data = mjpg_src_skip; mc->mjpg_src.term_source = mjpg_src_term; mc->mjpg_src.bytes_in_buffer = 0; mc->mjpg_src.next_input_byte = NULL; jpeg_std_error(&mc->mjpg_jerr); } /* ---------------------------------------------------------------------- */ static struct jpeg_compress_struct* mjpg_init(int width, int height) { mjpg_client* mc; struct jpeg_compress_struct* mjpg_cinfo = malloc(sizeof(struct jpeg_compress_struct)); if (!mjpg_cinfo) return 0; mc = malloc(sizeof(mjpg_client)); if (!mc) { free(mjpg_cinfo); return 0; } memset(mjpg_cinfo, 0, sizeof(struct jpeg_compress_struct)); mjpg_init_client(mc); mjpg_cinfo->client_data = mc; mjpg_cinfo->err = &mc->mjpg_jerr; jpeg_create_compress(mjpg_cinfo); mjpg_cinfo->dest = &mc->mjpg_dest; if (height < 0) { height *= -1; mc->invert_direction = 0; } else mc->invert_direction = 1; mjpg_cinfo->image_width = width; mjpg_cinfo->image_height = height; mc->mjpg_tables = TRUE; return mjpg_cinfo; } static struct jpeg_decompress_struct* mjpg_dec_init(int width, int height) { mjpg_client* mc; struct jpeg_decompress_struct* mjpg_dinfo = malloc(sizeof(struct jpeg_decompress_struct)); if (!mjpg_dinfo) return 0; mc = malloc(sizeof(mjpg_client)); if (!mc) { free(mjpg_dinfo); return 0; } memset(mjpg_dinfo, 0, sizeof(struct jpeg_decompress_struct)); mjpg_init_client(mc); mjpg_dinfo->client_data = mc; mjpg_dinfo->err = &mc->mjpg_jerr; jpeg_create_decompress(mjpg_dinfo); mjpg_dinfo->src = &mc->mjpg_src; if (height < 0) { height *= -1; mc->invert_direction = 0; } else mc->invert_direction = 1; mc->width = width; mc->height = height; mc->mjpg_tables = TRUE; return mjpg_dinfo; } /* ---------------------------------------------------------------------- */ struct jpeg_compress_struct* mjpg_bgr_init(int width, int height, int quality) { struct jpeg_compress_struct* mjpg_cinfo; if (debug > 1) fprintf(stderr,"mjpg_rgb_init\n"); mjpg_cinfo = mjpg_init(width, height); if (mjpg_cinfo) { mjpg_cinfo->input_components = 3; mjpg_cinfo->in_color_space = JCS_RGB; jpeg_set_defaults(mjpg_cinfo); mjpg_cinfo->dct_method = JDCT_FASTEST; jpeg_set_quality(mjpg_cinfo, quality, TRUE); jpeg_suppress_tables(mjpg_cinfo, TRUE); } return mjpg_cinfo; } void mjpg_cleanup(struct jpeg_compress_struct* mjpg_cinfo) { if (debug > 1) fprintf(stderr,"mjpg_cleanup\n"); jpeg_destroy_compress(mjpg_cinfo); free(mjpg_cinfo->client_data); free(mjpg_cinfo); } /* ---------------------------------------------------------------------- */ struct jpeg_decompress_struct* mjpg_dec_bgr_init(int width, int height) { struct jpeg_decompress_struct* mjpg_dinfo; if (debug > 1) fprintf(stderr,"mjpg_dec_rgb_init\n"); mjpg_dinfo = mjpg_dec_init(width, height); if (mjpg_dinfo) { mjpg_dinfo->num_components = 3; mjpg_dinfo->jpeg_color_space = JCS_RGB; mjpg_dinfo->out_color_space = JCS_RGB; mjpg_dinfo->scale_num = 1; mjpg_dinfo->scale_denom = 1; mjpg_dinfo->output_gamma = 0; mjpg_dinfo->dct_method = JDCT_FASTEST; //jpeg_set_defaults(&mjpg_dinfo); // mjpg_cinfo.dct_method = JDCT_FASTEST; // jpeg_set_quality(&mjpg_cinfo, mjpeg_quality, TRUE); // jpeg_suppress_tables(&mjpg_cinfo, TRUE); } return mjpg_dinfo; } void mjpg_dec_cleanup(struct jpeg_decompress_struct* mjpg_dinfo) { if (debug > 1) fprintf(stderr,"mjpg_cleanup\n"); jpeg_destroy_decompress(mjpg_dinfo); free(mjpg_dinfo->client_data); free(mjpg_dinfo); } int mjpg_bgr_compress(struct jpeg_compress_struct* mjpg_cinfo, unsigned char *d, const unsigned char *s, int p) { int i; const unsigned char *line; unsigned char* hb; mjpg_client* mc = (mjpg_client*) mjpg_cinfo->client_data; if (debug > 1) fprintf(stderr,"mjpg_rgb_compress\n"); mc->mjpg_buffer = d; mc->mjpg_bufsize = 3*mjpg_cinfo->image_width*mjpg_cinfo->image_height; hb = d + mc->mjpg_bufsize; jpeg_start_compress(mjpg_cinfo, mc->mjpg_tables); if (!mc->invert_direction) for (i = 0, line = s; i < mjpg_cinfo->image_height; i++, line += 3*mjpg_cinfo->image_width) { //bgr2rgb(hb, line, mjpg_cinfo->image_width); //jpeg_write_scanlines(mjpg_cinfo, &hb, 1); memcpy(hb, line, mjpg_cinfo->image_width * 3); jpeg_write_scanlines(mjpg_cinfo, &hb, 1); } else for (i = 0, line = s + mc->mjpg_bufsize-3*mjpg_cinfo->image_width; i < mjpg_cinfo->image_height; i++, line -= 3*mjpg_cinfo->image_width) { bgr2rgb(hb, line, mjpg_cinfo->image_width); jpeg_write_scanlines(mjpg_cinfo, &hb, 1); } jpeg_finish_compress(mjpg_cinfo); mc->mjpg_tables = FALSE; return mc->mjpg_bufused; } int mjpg_bgr_decompress(struct jpeg_decompress_struct* mjpg_dinfo, unsigned char *d, unsigned char *s, int size) { int i; unsigned char *line; mjpg_client* mc = (mjpg_client*)mjpg_dinfo->client_data; static int ix = 0; char bx[100]; FILE* fx; #if 0 sprintf(bx, "file%d.jpg", ix++); fx = fopen(bx, "w+"); fwrite(s, size, 1, fx); fclose(fx); #endif if (debug > 1) fprintf(stderr,"mjpg_rgb_decompress\n"); mc->mjpg_datasize = size; mc->mjpg_buffer = s; if (jpeg_read_header(mjpg_dinfo, 1) != JPEG_HEADER_OK) return -1; if ((mc->width != mjpg_dinfo->image_width || mc->height != mjpg_dinfo->image_height) && !mc->warn_shown) { fprintf(stderr, "WARNING: incompatible headers! (AVI: %d x %d JPEG: %d x %d)\n", mc->width, mc->height, mjpg_dinfo->image_width, mjpg_dinfo->image_height); mc->warn_shown++; } //fprintf(stderr,"mjpg_rgb_decompress1 %d %d %p skip:%d\n", i, size, mc, mc->mjpg_skip); jpeg_start_decompress(mjpg_dinfo); if(!mc->invert_direction) { unsigned char buf[5000]; for (i = 0, line = d; i < mc->height; i++, line += 3 * mc->width) { jpeg_read_scanlines(mjpg_dinfo, &line, 1); bgr2rgb(line, line, mc->width); } line = buf; for (; i < mjpg_dinfo->image_height; i++) jpeg_read_scanlines(mjpg_dinfo, &line, 1); } else for (i = 0, line = d + 3 * mc->width * (mc->height - 1); i < mc->height; i++, line -= 3 * mc->width) { jpeg_read_scanlines(mjpg_dinfo, &line, 1); bgr2rgb(line, line, mjpg_dinfo->image_width); } jpeg_finish_decompress(mjpg_dinfo); mc->mjpg_tables = FALSE; return 0; } /* ---------------------------------------------------------------------- */ #if 0 static int rwidth,rheight; unsigned char **mjpg_ptrs[3]; unsigned char **mjpg_run[3]; void mjpg_yuv_init(int width, int height) { if (debug > 1) fprintf(stderr,"mjpg_yuv_init\n"); // save real size rwidth = width; rheight = height; // fix size to match DCT blocks (I'm not going to copy around // data to pad stuff, so we'll simplay cut off edges) width &= ~(2*DCTSIZE-1); height &= ~(2*DCTSIZE-1); mjpg_init(width, height); mjpg_cinfo.input_components = 3; mjpg_cinfo.in_color_space = JCS_YCbCr; jpeg_set_defaults(&mjpg_cinfo); mjpg_cinfo.dct_method = JDCT_FASTEST; jpeg_set_quality(&mjpg_cinfo, mjpeg_quality, TRUE); mjpg_cinfo.raw_data_in = TRUE; jpeg_set_colorspace(&mjpg_cinfo,JCS_YCbCr); mjpg_cinfo.comp_info[0].h_samp_factor = 2; mjpg_cinfo.comp_info[0].v_samp_factor = 2; mjpg_cinfo.comp_info[1].h_samp_factor = 1; mjpg_cinfo.comp_info[1].v_samp_factor = 1; mjpg_cinfo.comp_info[2].h_samp_factor = 1; mjpg_cinfo.comp_info[2].v_samp_factor = 1; mjpg_ptrs[0] = malloc(height*sizeof(char*)); mjpg_ptrs[1] = malloc(height*sizeof(char*)/2); mjpg_ptrs[2] = malloc(height*sizeof(char*)/2); jpeg_suppress_tables(&mjpg_cinfo, TRUE); } static int mjpg_yuv_compress(void) { int y; mjpg_run[0] = mjpg_ptrs[0]; mjpg_run[1] = mjpg_ptrs[1]; mjpg_run[2] = mjpg_ptrs[2]; // mjpg_cinfo.write_JFIF_header = FALSE; jpeg_start_compress(&mjpg_cinfo, mjpg_tables); // jpeg_write_marker(&mjpg_cinfo, JPEG_APP0, "AVI1\0\0\0\0", 8); for (y = 0; y < mjpg_cinfo.image_height; y += 2*DCTSIZE) { jpeg_write_raw_data(&mjpg_cinfo, mjpg_run,2*DCTSIZE); mjpg_run[0] += 2*DCTSIZE; mjpg_run[1] += DCTSIZE; mjpg_run[2] += DCTSIZE; } jpeg_finish_compress(&(mjpg_cinfo)); // mjpg_tables = FALSE; return mjpg_bufused; } int mjpg_yuv422_compress(unsigned char *d, unsigned char *s, int p) { unsigned char *line; int i; if (debug > 1) fprintf(stderr,"mjpg_yuv422_compress\n"); mjpg_buffer = d; mjpg_bufsize = 3*mjpg_cinfo.image_width*mjpg_cinfo.image_height; line = s; for (i = 0; i < mjpg_cinfo.image_height; i++, line += rwidth) mjpg_ptrs[0][i] = line; line = s + rwidth*rheight; for (i = 0; i < mjpg_cinfo.image_height; i+=2, line += rwidth) mjpg_ptrs[1][i/2] = line; line = s + rwidth*rheight*3/2; for (i = 0; i < mjpg_cinfo.image_height; i+=2, line += rwidth) mjpg_ptrs[2][i/2] = line; return mjpg_yuv_compress(); } int mjpg_yuv420_compress(unsigned char *d, unsigned char *s, int p) { unsigned char *line; int i; if (debug > 1) fprintf(stderr,"mjpg_yuv420_compress\n"); mjpg_buffer = d; mjpg_bufsize = 3*mjpg_cinfo.image_width*mjpg_cinfo.image_height; line = s; for (i = 0; i < mjpg_cinfo.image_height; i++, line += rwidth) mjpg_ptrs[0][i] = line; line = s + rwidth*rheight; for (i = 0; i < mjpg_cinfo.image_height; i+=2, line += rwidth/2) mjpg_ptrs[1][i/2] = line; line = s + rwidth*rheight*5/4; for (i = 0; i < mjpg_cinfo.image_height; i+=2, line += rwidth/2) mjpg_ptrs[2][i/2] = line; return mjpg_yuv_compress(); } #endif avifile-0.7.48~20090503.ds/samples/mjpeg_plugin/mjpeg.h0000644000175000017500000000251410746743004021347 0ustar yavoryavor#ifndef AVIFILE_MJPEG_H #define AVIFILE_MJPEG_H #include // jpeglibs needs FILE #include // it's stupid bug jpeglib is including it's own jconfig.h #undef HAVE_STDLIB_H #include #if defined(__cplusplus) extern "C" { #endif typedef struct { unsigned int width; unsigned int height; int invert_direction; JOCTET* mjpg_buffer; size_t mjpg_bufsize; size_t mjpg_datasize; size_t mjpg_bufused; int mjpg_tables; int warn_shown; struct jpeg_error_mgr mjpg_jerr; struct jpeg_destination_mgr mjpg_dest; struct jpeg_source_mgr mjpg_src; } mjpg_client; struct jpeg_compress_struct* mjpg_bgr_init(int width, int height, int quality); int mjpg_bgr_compress(struct jpeg_compress_struct* mjpg_cinfo, unsigned char* d, const unsigned char *s, int p); //void mjpg_yuv_init(int width, int height); //int mjpg_yuv422_compress(unsigned char *d, unsigned char *s, int p); //int mjpg_yuv420_compress(unsigned char *d, unsigned char *s, int p); void mjpg_cleanup(struct jpeg_compress_struct*); void mjpg_dec_cleanup(struct jpeg_decompress_struct*); struct jpeg_decompress_struct* mjpg_dec_bgr_init(int width, int height); int mjpg_bgr_decompress(struct jpeg_decompress_struct* mjpg_dinfo, unsigned char *d, unsigned char *s, int p); #if defined(__cplusplus) } #endif #endif avifile-0.7.48~20090503.ds/samples/qtrecompress/0000755000175000017500000000000011267646347020154 5ustar yavoryavoravifile-0.7.48~20090503.ds/samples/qtrecompress/Makefile.am0000644000175000017500000000246211110536760022174 0ustar yavoryavorif AMM_USE_QT bin_PROGRAMS = avirecompress endif noinst_HEADERS =\ audc.h\ audc_p.h\ conf.h\ filters.h\ genctl.h\ genctl_p.h\ imagecontrol.h\ qimagecontrol.h\ recompressor.h\ recwnd.h\ recwnd_p.h\ rec_cb.h\ rgn.h\ srcctl.h\ srcctl_p.h avirecompress_SOURCES =\ audc.cpp\ audc_p.cpp\ conf.cpp\ filters.cpp\ genctl.cpp\ genctl_p.cpp\ main.cpp\ qimagecontrol.cpp\ recompressor.cpp\ recwnd.cpp\ recwnd_p.cpp\ rgn.cpp\ srcctl.cpp\ srcctl_p.cpp\ thread.cpp avirecompress_LDADD =\ ../../libavqt/libqavm.la\ $(QT_LIBS)\ ../../lib/libaviplay.la AM_CPPFLAGS =\ $(QT_CFLAGS) $(X_CFLAGS)\ -I$(top_srcdir)/libavqt #SUFFIXES = .moc .ui #%.moc: %.h # $(MOC) < $< > $@ .h.moc: $(MOC) < $< > $@ $(srcdir)/audc.cpp: audc.moc $(srcdir)/filters.cpp: filters.moc $(srcdir)/genctl_p.cpp: genctl_p.moc $(srcdir)/recwnd_p.cpp: recwnd_p.moc $(srcdir)/srcctl_p.cpp: srcctl_p.moc $(srcdir)/audc_p.cpp: audc_p.moc $(srcdir)/genctl.cpp: genctl.moc $(srcdir)/recwnd.cpp: recwnd.moc $(srcdir)/srcctl.cpp: srcctl.moc CLEANFILES = *.moc MAINTAINERCLEANFILES = Makefile.in ui: $(UIC) ./genctl.ui -o ./genctl_p.h $(UIC) -impl ./genctl_p.h ./genctl.ui -o ./genctl_p.cpp # $(UIC) -subdecl QtRecompressorCtl ./genctl_p.h ./genctl.ui -o ./genctl.h # $(UIC) -subimpl QtRecompressorCtl ./genctl.h ./genctl.ui -o ./genctl.cpp avifile-0.7.48~20090503.ds/samples/qtrecompress/audc.cpp0000644000175000017500000000125107664353554021574 0ustar yavoryavor#include "audc.h" #include "audc.moc" #include /* * Constructs a AudioCodecConfig which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ AudioCodecConfig::AudioCodecConfig( QWidget* parent, const AudioEncoderInfo& fmt) : AudioCompress( 0, "Audio codec config", TRUE, 0 ), info(fmt) { } void AudioCodecConfig::accept() { if (m_pComboBox->currentItem()==1) { info.fmt = 0x55; info.bitrate = 128000; } return QDialog::accept(); } AudioEncoderInfo AudioCodecConfig::GetInfo() { return info; } avifile-0.7.48~20090503.ds/samples/qtrecompress/audc.h0000644000175000017500000000056007664353554021243 0ustar yavoryavor#ifndef AUDIOCOMP_H #define AUDIOCOMP_H #include "audc_p.h" #include "recompressor.h" #include "audioencoder.h" class AudioCodecConfig : public AudioCompress { Q_OBJECT; AudioEncoderInfo info; public: AudioCodecConfig( QWidget* parent, const AudioEncoderInfo& fmt ); AudioEncoderInfo GetInfo(); virtual void accept(); }; #endif // AUDIOCOMP_H avifile-0.7.48~20090503.ds/samples/qtrecompress/audc_p.cpp0000644000175000017500000000206607672113071022103 0ustar yavoryavor#include "audc_p.h" #include "audc_p.moc" #include #include #include #include #include #include #include /* * Constructs a AudioCompress which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ AudioCompress::AudioCompress( QWidget* parent, const char* name, bool modal, WFlags fl ) : QavmOkDialog( parent, name, modal, fl ) { if ( !name ) setName( "AudioCompress" ); resize( 256, 102 ); setCaption( tr( "Audio compression format" ) ); QGridLayout* gl = gridLayout(); gl->setMargin( 5 ); gl->setSpacing( 4 ); QGroupBox* vbl = new QVGroupBox( this ); vbl->setTitle( tr( "Audio compression:" ) ); m_pComboBox = new QComboBox( FALSE, vbl ); m_pComboBox->insertItem( tr( "PCM Uncompressed" ) ); m_pComboBox->insertItem( tr( "MP3" ) ); gl->addMultiCellWidget( vbl, 0, 0, 0, 0); } avifile-0.7.48~20090503.ds/samples/qtrecompress/audc_p.h0000644000175000017500000000047307664353554021565 0ustar yavoryavor#ifndef AUDIOCOMPRESS_H #define AUDIOCOMPRESS_H #include "okdialog.h" class QComboBox; class AudioCompress : public QavmOkDialog { Q_OBJECT; public: QComboBox* m_pComboBox; AudioCompress( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); }; #endif // AUDIOCOMPRESS_H avifile-0.7.48~20090503.ds/samples/qtrecompress/conf.cpp0000644000175000017500000000400211171070742021561 0ustar yavoryavor#include "conf.h" #include #include #include #include #define __MODULE__ "Read config" using namespace avm; ReadConfig::ReadConfig(const char* fn) { FILE *is = fopen(fn, "r"); string s; if (!is) throw FATAL("Could not open file"); while (!feof(is)) { char z[500]; z[499]=0; //is.gets(&z); if (!fgets(z, 499, is)) { fprintf(stderr,"Z=0!\n"); break; } int endpos=strlen(z)-1; while((endpos>=0) && (z[endpos]=='\n')) { z[endpos]=0; endpos--; } s=string(z); // cerr<c_str()); } int ReadConfig::getInt(const avm::string& key) const { return strtol(_map.find_default(key)->c_str(), 0, 16); } const char* ReadConfig::getString(const avm::string& key) const { return _map.find_default(key)->c_str(); } #undef __MODULE__ #define __MODULE__ "Write config" WriteConfig::WriteConfig(const char* fn) { fh = fopen(fn, "w"); if (!fh) throw FATAL("Could not open file"); } WriteConfig::~WriteConfig() { avm::avm_map::const_iterator it; for (it = _map.begin(); it != _map.end(); it++) if (it->key != "") fprintf((FILE*)fh, "%s:%s", it->key.c_str(), it->value.c_str()); fclose((FILE*)fh); } void WriteConfig::add(const avm::string& key, const avm::string& value) { _map.insert(key, value); } void WriteConfig::add(const avm::string& key, int value) { char s[64]; sprintf(s, "%d", value); _map.insert(key, string(s)); } void WriteConfig::add(const avm::string& key, double value) { char s[128]; sprintf(s, "%f", value); _map.insert(key, string(s)); } avifile-0.7.48~20090503.ds/samples/qtrecompress/conf.h0000644000175000017500000000131007547603652021243 0ustar yavoryavor#ifndef CONF_H #define CONF_H #include "avm_stl.h" #include "avm_map.h" #include class ReadConfig { avm::avm_map _map; public: ReadConfig(const char* fn); ~ReadConfig(){} double getDouble(const avm::string& key) const; int getInt(const avm::string& key) const; const char* getString(const avm::string& key) const; }; class WriteConfig { avm::avm_map _map; void* fh; public: WriteConfig(const char* fn); ~WriteConfig(); void add(const avm::string& key, const avm::string& value); void add(const avm::string& key, int value); void add(const avm::string& key, double value); }; #endif // CONF_H avifile-0.7.48~20090503.ds/samples/qtrecompress/filters.cpp0000644000175000017500000005361011165212350022311 0ustar yavoryavor#include "filters.h" #include "filters.moc" #include "rgn.h" #include "recompressor.h" #include "okdialog.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if QT_VERSION <= 220 #define LAYOUTCOL 1 #else #define LAYOUTCOL 0 #endif // simple fullresizable dialog which handles sliders class MySliderDialog : public QavmOkDialog { public: MySliderDialog(const char* title) :QavmOkDialog( 0, title, true ), m_iRow(0) {} QSlider* addSlider( const char* param, const char* left = 0, const char* right = 0 ); protected: int m_iRow; }; QSlider* MySliderDialog::addSlider(const char* param, const char* left, const char* right) { QGroupBox* gb = new QGroupBox( this ); gb->setTitle( param ); gb->setColumnLayout( LAYOUTCOL, Qt::Vertical ); QGridLayout* qvl = new QGridLayout( gb->layout(), 1, 1 ); QSlider* s = new QSlider( gb ); qvl->addMultiCellWidget(s, 0, 0, 0, 4); s->setTracking(false); s->setOrientation(QSlider::Horizontal); s->setTickmarks(QSlider::Below); if (left) { QLabel *l1 = new QLabel( gb ); l1->setText( left ); qvl->addWidget( l1, 1, 1 ); } if (right) { QLabel *l2 = new QLabel( gb ); l2->setText( right ); qvl->addWidget( l2, 1, 3 ); } qvl->setColStretch( 0, 1 ); qvl->setColStretch( 2, 10 ); qvl->setColStretch( 4, 1 ); gridLayout()->addMultiCellWidget( gb, m_iRow, m_iRow, 0, 2 ); m_iRow++; return s; } void Filter::redraw() { if (kernel) kernel->redraw(); } //////////// // GAMMA //////////// QString GammaFilter::fullname() { QString s; s.sprintf(tr("Adjust gamma by: %.2f"), _gamma); return s; } avm::CImage* GammaFilter::process(avm::CImage* sim, int pos) { avm::CImage* im = 0; if (sim->Format() == 0 && sim->Depth() == 24) { im = sim; im->AddRef(); } else { sim->GetFmt()->Print(); avm::BitmapInfo bi(sim->GetFmt()); bi.SetBits(24); //bi.SetDirection(true); im = new avm::CImage(sim, &bi); } for(int i=0; iHeight(); i++) for(int j=0; jWidth(); j++) { unsigned char* c=im->At(j,i); int z=c[0]; z=int(z*_gamma); if(z>255)z=255; c[0]=z; z=c[1]; z=int(z*_gamma); if(z>255)z=255; c[1]=z; z=c[2]; z=int(z*_gamma); if(z>255)z=255; c[2]=z; } return im; } void GammaFilter::about() { QMessageBox::about(0, tr("About Gamma adjustment Filter"), tr("This is a sample filter")); } void GammaFilter::config() { MySliderDialog d( tr( "Gamma adjustment" ) ); QSlider* s = d.addSlider( tr( "Gamma:" ), "0", "5" ); float old_gamma = _gamma; s->setRange(0, 50); s->setValue(int(_gamma * 10)); connect( s, SIGNAL( valueChanged( int ) ), this, SLOT( valueChanged( int ) ) ); if (d.exec() == QDialog::Rejected) _gamma = old_gamma; redraw(); } void GammaFilter::valueChanged(int new_val) { _gamma = (float)new_val / 10.f; redraw(); } QString GammaFilter::save() { QString b; b.sprintf("%f", _gamma); return b; } void GammaFilter::load(const QString& str) { sscanf(str.ascii(), "%f", &_gamma); } /////////// // BLUR /////////// QString BlurFilter::fullname() { QString s; s.sprintf(tr("Blur - radius: %d"), _range); return s; } avm::CImage* BlurFilter::process(avm::CImage* sim, int pos) { avm::CImage* im; if (sim->Format() == IMG_FMT_YUV) { im = sim; im->AddRef(); } else im = new avm::CImage(sim, IMG_FMT_YUV); im->Blur(_range); return im; } void BlurFilter::about() { QMessageBox::about(0, tr("About Blur Filter"), tr("This is a sample MMX filter")); } void BlurFilter::config() { MySliderDialog d(tr("Blur adjustment")); QSlider* s = d.addSlider(tr("Radius:"), "1", "8"); int old_range=_range; s->setRange(1, 8); s->setValue(_range); //s->setLineStep(1); #if QT_VERSION > 220 s->setPageStep(1); #endif connect(s, SIGNAL(valueChanged(int)), this, SLOT(valueChanged(int))); if(d.exec()==QDialog::Rejected) _range=old_range; redraw(); } void BlurFilter::valueChanged(int new_val) { _range=new_val; redraw(); } QString BlurFilter::save() { QString b; b.sprintf("%d", _range); return b; } void BlurFilter::load(const QString& s) { sscanf(s.ascii(), "%d", &_range); } ///////////// // REFRACT ///////////// QString RefractFilter::fullname() { QString s; s.sprintf(tr("Compensate refraction - distance: %d, power: %.3f"), _dist, _power); return s; } void RefractFilter::about() { QMessageBox::about(0, tr("About Refraction Filter"), tr("This is a sample filter")); } void RefractFilter::config() { MySliderDialog d(tr("Refraction compensation")); QSlider* s = d.addSlider(tr("Distance:")); int old_dist = _dist; double old_power = _power; s->setRange(1, 50); s->setValue(_dist); connect(s, SIGNAL(valueChanged(int)), this, SLOT(valueChanged1(int))); s = d.addSlider(tr("Power:")); s->setRange(1, 50); s->setValue(int(_power * 100)); connect(s, SIGNAL(valueChanged(int)), this, SLOT(valueChanged2(int))); if (d.exec() == QDialog::Rejected) { _dist = old_dist; _power = old_power; } redraw(); } void RefractFilter::valueChanged1(int new_val) { _dist = new_val; redraw(); } void RefractFilter::valueChanged2(int new_val) { _power = new_val / 100.f; redraw(); } avm::CImage* RefractFilter::process(avm::CImage* sim, int pos) { avm::CImage* im; if (sim->Format() == IMG_FMT_YUV) { im = sim; im->AddRef(); } else im = new avm::CImage(sim, IMG_FMT_YUV); avm::CImage* refractor = new avm::CImage(im); //refractor->Blur(2); int xd=im->Width(); int yd=im->Height(); uint8_t* data = im->Data(); uint8_t* refdata = refractor->Data(); for (unsigned int i=xd*yd*3-3; i>=3*_dist+9+9*xd; i-=3) { unsigned char* p = data+i; unsigned char* refp = refdata+i-3-3*xd; int brightness; if (((i-3*_dist)%(3*xd)<(unsigned int)(2.6*xd)) || ((i%(3*xd)>(unsigned int)xd))) //brightness=(refp[-3*dist+0]+refp[-3*dist+1]+refp[-3*dist+2])/3; //brightness=(.114*refp[-3*dist+0]+.586*refp[-3*dist+1]+.300*refp[-3*dist+2]); //brightness=((col*)(refp-3*dist))->Y(); brightness=refp[-3*_dist]; else brightness=0; brightness=int(brightness*_power); //int y=(*p+power*p[-3*dist])/(1+power); /*if(y<0x10)y=0x10; if(y>0xef)y=0xef;*/ /*p[0]=max(0, unsigned char((p[0]+brightness)/(1+power))); p[1]=max(0, unsigned char((p[1]+brightness)/(1+power))); p[2]=max(0, unsigned char((p[2]+brightness)/(1+power)));*/ p[0]=(unsigned char)((p[0]+brightness)/(1+_power)); //p[1]=unsigned char((p[1]+brightness)/(1+power)); //p[2]=unsigned char((p[2]+brightness)/(1+power)); //*p=y; } refractor->Release(); return im; } QString RefractFilter::save() { QString b; b.sprintf("%d %f", _dist, _power); return b; } void RefractFilter::load(const QString& s) { sscanf(s.ascii(), "%d %f", &_dist, &_power); } //////////// // NOISE //////////// QString NoiseFilter::fullname() { QString s; s.sprintf(tr( "Reduce noise - quality: %d, edge radius: %d" ), _qual, _edge); return s; } void NoiseFilter::about() { QMessageBox::about(0, tr("About Noise reduction Filter"), tr("This is a sample filter")); } void NoiseFilter::config() { MySliderDialog d( tr( "Noise reduction" ) ); QSlider* s = d.addSlider( tr( "Quality:" ), "850", "1000" ); int old_qual=_qual; s->setRange(850,1000); s->setValue(_qual); connect(s, SIGNAL(valueChanged(int)), this, SLOT(valueChanged1(int))); s = d.addSlider( tr( "Radius:" ), "1", "6" ); int old_edge=_edge; s->setRange(1,6); s->setValue(_edge); #if QT_VERSION > 220 s->setPageStep(1); #endif connect(s, SIGNAL(valueChanged(int)), this, SLOT(valueChanged2(int))); s = d.addSlider( tr(""), "1", "6" ); // FIXME: name of this parameter ???? int old_zz=_zz; s->setRange(1,6); s->setValue(_zz); #if QT_VERSION > 220 s->setPageStep(1); #endif connect(s, SIGNAL(valueChanged(int)), this, SLOT(valueChanged3(int))); if (d.exec() == QDialog::Rejected) { _qual = old_qual; _edge = old_edge; _zz = old_zz; } redraw(); } void NoiseFilter::valueChanged1(int new_val) { _qual=new_val; redraw(); } void NoiseFilter::valueChanged2(int new_val) { _edge=new_val; redraw(); } void NoiseFilter::valueChanged3(int new_val) { _zz=new_val; redraw(); } avm::CImage* NoiseFilter::process(avm::CImage* sim, int pos) { avm::CImage* im; if (sim->Format() == IMG_FMT_YUV) { im = sim; im->AddRef(); } else im = new avm::CImage(sim, IMG_FMT_YUV); // Move(move); double m_dQual=_qual/1000.; avm::CImage* result=new avm::CImage(im); // result->Enhance(256/m_dEnhQual);//128 ms // result->Move(move); CEdgeRgn* edges=new CEdgeRgn(im, int(256/m_dQual), _edge, false, _zz); avm::CImage* blurred=new avm::CImage(result); blurred->Blur(1);//53 ms avm::CImage* blurred3=new avm::CImage(blurred); blurred3->Blur(2,1); CEdgeRgn* v2=new CEdgeRgn(edges); v2->Normalize();//17 ms v2->Blur(1); CEdgeRgn* v3=new CEdgeRgn(v2); v3->Blur(2,1); /* struct yuv* yptr=(struct yuv*)result->Data(); for(int i=0; iWidth(); i++) for(int j=0; jHeight(); j++) { yptr[i+j*im->Width()].Cb=yptr[i+j*im->Width()].Cr=128; // if((*v2.at(i,j))<0) // yptr[i+j*im->Width()].Y=128; // else yptr[i+j*im->Width()].Y=*(v2.at(i,j)); } */ const int _xd=im->Width(); const int _yd=im->Height(); //const int OFF1=-1-1*_xd; const int OFF2=-2-2*_xd; const int OFF4=-4-4*_xd; for(int i=4; i<_xd-4; i++) { for(int j=i+_xd*4; jData()+j; avm::yuv* v; if((*v3->Offset(j+OFF4))==0) { v=(avm::yuv*)blurred3->Data()+j+OFF4; src->Y=v->Y; } else if((*v2->Offset(j+OFF2))==0) { v=(avm::yuv*)blurred3->Data()+j+OFF4; src->Y=v->Y; } // else // if((*edges->Offset(j))>128) // { // v=(yuv*)result->Data()+j; // src->Y=128; // src->Cr=64; // src->Cb=96; // continue; // } // else // { // src->Y=128; // src->Cr=96; // src->Cb=64; // continue; // } // src->Cr=v->Cr; // src->Cb=v->Cb; else if((*v2->Offset(j+OFF2))==0) { v=(avm::yuv*)blurred->Data()+j+OFF2; src->Y=v->Y; } // else // if((*edges->Offset(j))>128) // { // v=(yuv*)result->Data()+j; // src->Y=128; // src->Cr=64; // src->Cb=96; // continue; // } // else // { // src->Y=128; // src->Cr=96; // src->Cb=64; // continue; // } // src->Cr=v->Cr; // src->Cb=v->Cb; } } delete edges; delete blurred; delete blurred3; delete v2; delete v3; return result; } QString NoiseFilter::save() { QString b; b.sprintf("%d %d %d", _qual, _edge, _zz); return b; } void NoiseFilter::load(const QString& s) { sscanf(s.ascii(), "%d %d %d", &_qual, &_edge, &_zz); } /////////// // MOVE ////////// QString MoveFilter::fullname() { QString s; s.sprintf(tr("Move colors by %d"), _delta); return s; } avm::CImage* MoveFilter::process(avm::CImage* im, int pos) { im->AddRef(); if (im->Depth() != 24) return im; if(_delta==0) return im; if(!im->GetFmt()->IsRGB())im->ToYUV(); avm::yuv* ptr=(avm::yuv*)im->Data(); int csize=im->Width()*im->Height(); if(_delta<0) { for(int i=0; i=_delta; i--) { ptr[i].Cb=ptr[i-_delta].Cb; ptr[i].Cr=ptr[i-_delta].Cr; } } return im; } void MoveFilter::about() { QMessageBox::about(0, tr( "About Color move Filter" ), tr( "This is a sample filter" )); } void MoveFilter::config() { MySliderDialog d( tr( "Color move adjustment" ) ); QSlider* s = d.addSlider( tr( "Color move:" ), "-20", "20"); int old_delta=_delta; s->setRange(-20, 20); s->setValue(_delta); connect(s, SIGNAL(valueChanged(int)), this, SLOT(valueChanged(int))); if (d.exec() == QDialog::Rejected) _delta = old_delta; redraw(); } void MoveFilter::valueChanged(int new_val) { _delta=new_val; redraw(); } QString MoveFilter::save() { QString b; b.sprintf("%d", _delta); return b; } void MoveFilter::load(const QString& s) { sscanf(s.ascii(), "%d", &_delta); } /* avm::CImage* SwapFilter::process(avm::CImage* im, int pos) { // if(im->yuv())im->ToRGB(); if(!im->yuv())im->ToYUV(); int csize=im->Width()*im->Height(); yuv* ptr=(yuv*)im->Data(); for(int i=0; iaddref(); return im; } void SwapFilter::config() { QDialog d(0, "Noise reduction", true); d.setFixedSize(300,200); QSlider* slider1=new QSlider(&d, ""); QSlider* slider2=new QSlider(&d, ""); QSlider* slider3=new QSlider(&d, ""); QSlider* slider4=new QSlider(&d, ""); // slider1->setTracking(false); // slider2->setTracking(false); // slider3->setTracking(false); // slider4->setTracking(false); QLabel* label1=new QLabel(&d, ""); label1->setText("Adjust qual:"); label1->resize(70,15); label1->move(10,15); QLabel* label2=new QLabel(&d, ""); label2->setText("Adjust radius:"); label2->resize(70,15); label2->move(10,50); slider1->setOrientation(QSlider::Horizontal); slider1->setTickmarks(QSlider::Below); slider2->setOrientation(QSlider::Horizontal); slider2->setTickmarks(QSlider::Below); slider3->setOrientation(QSlider::Horizontal); slider3->setTickmarks(QSlider::Below); slider4->setOrientation(QSlider::Horizontal); slider4->setTickmarks(QSlider::Below); slider1->move(90,15); slider1->resize(200,25); slider1->setRange(-200,200); slider1->setValue(int(_c1*100)); slider2->move(90,50); slider2->resize(200,25); slider2->setRange(-200,200); slider2->setValue(int(_c2*100)); slider3->move(90,85); slider3->resize(200,25); slider3->setRange(-200,200); slider3->setValue(int(_c3*100)); slider4->move(90,135); slider4->resize(200,25); slider4->setRange(-200,200); slider4->setValue(int(_c4*100)); connect(slider1, SIGNAL(valueChanged(int)), this, SLOT(valueChanged1(int))); connect(slider2, SIGNAL(valueChanged(int)), this, SLOT(valueChanged2(int))); connect(slider3, SIGNAL(valueChanged(int)), this, SLOT(valueChanged3(int))); connect(slider4, SIGNAL(valueChanged(int)), this, SLOT(valueChanged4(int))); QPushButton* b_ok=new QPushButton("Ok", &d); b_ok->resize(40,20); b_ok->move(200,160); QPushButton* b_cancel=new QPushButton("Cancel", &d); b_cancel->resize(40,20); b_cancel->move(250,160); connect(b_ok, SIGNAL(clicked()), &d, SLOT(accept())); connect(b_cancel, SIGNAL(clicked()), &d, SLOT(reject())); d.exec(); kernel->redraw(); } void SwapFilter::valueChanged1(int new_val) { _c1=double(new_val)/100.; kernel->redraw(); } void SwapFilter::valueChanged2(int new_val) { _c2=double(new_val)/100.; kernel->redraw(); } void SwapFilter::valueChanged3(int new_val) { _c3=double(new_val)/100.; kernel->redraw(); } void SwapFilter::valueChanged4(int new_val) { _c4=double(new_val)/100.; kernel->redraw(); } */ namespace { typedef int myGLint; typedef unsigned int myGLuint; typedef unsigned short int myGLushort; typedef char myGLbyte; typedef unsigned char myGLubyte; void halveImage(myGLint components, myGLuint width, myGLuint height, const myGLubyte *datain, myGLubyte *dataout) { int i, j, k; int newwidth, newheight; int delta; myGLubyte *s; const myGLubyte *t; newwidth = width / 2; newheight = height / 2; delta = width * components; s = dataout; t = datain; /* Piece o' cake! */ for (i = 0; i < newheight; ++i) { for (j = 0; j < newwidth; ++j) { for (k = 0; k < components; ++k) { s[0] = (t[0] + t[components] + t[delta] + t[delta+components] + 2) / 4; ++s; ++t; } t += components; } t += delta; } } void scale_internal(myGLint components, myGLint widthin, myGLint heightin, const myGLubyte *datain, myGLint widthout, myGLint heightout, myGLubyte *dataout) { float x, lowx, highx, convx, halfconvx; float y, lowy, highy, convy, halfconvy; float xpercent,ypercent; float percent; /* Max components in a format is 4, so... */ float totals[4]; float area; int i,j,k,yint,xint,xindex,yindex; int temp; if (widthin == widthout*2 && heightin == heightout*2) { halveImage(components, widthin, heightin, datain, dataout); return; } convy = (float)heightin/(float)heightout; convx = (float)widthin/(float)widthout; halfconvx = convx/2; halfconvy = convy/2; for (i = 0; i < heightout; i++) { y = convy * (i+0.5f); if (heightin > heightout) { highy = y + halfconvy; lowy = y - halfconvy; } else { highy = y + 0.5f; lowy = y - 0.5f; } for (j = 0; j < widthout; j++) { x = convx * (j + 0.5f); if (widthin > widthout) { highx = x + halfconvx; lowx = x - halfconvx; } else { highx = x + 0.5f; lowx = x - 0.5f; } /* ** Ok, now apply box filter to box that goes from (lowx, lowy) ** to (highx, highy) on input data into this pixel on output ** data. */ totals[0] = totals[1] = totals[2] = totals[3] = 0.0; area = 0.0; y = lowy; yint = (int)floor(y); while (y < highy) { yindex = (yint + heightin) % heightin; if (highy < yint+1) { ypercent = highy - y; } else { ypercent = yint+1 - y; } x = lowx; xint = (int)floor(x); while (x < highx) { xindex = (xint + widthin) % widthin; if (highx < xint+1) { xpercent = highx - x; } else { xpercent = xint+1 - x; } percent = xpercent * ypercent; area += percent; temp = (xindex + (yindex * widthin)) * components; for (k = 0; k < components; k++) { totals[k] += datain[temp + k] * percent; } xint++; x = xint; } yint++; y = yint; } temp = (j + (i * widthout)) * components; for (k = 0; k < components; k++) { /* totals[] should be rounded in the case of enlarging an RGB * ramp when the type is 332 or 4444 */ dataout[temp + k] = (short unsigned int)((totals[k]+0.5)/area); } } } } }; QString ScaleFilter::fullname() { QString s; s.sprintf(tr( "Scale to %.2f x %.2f" ), m_dWidth, m_dHeight); return s; } void ScaleFilter::about() { QMessageBox::about( 0, tr( "About Scal Filter" ), tr( "Universal scale filter" ) ); } void ScaleFilter::config() { bool old_aspect = m_bAspect; bool old_percent = m_bPercent; double old_width = m_dWidth; double old_height = m_dHeight; QString s; QavmOkDialog d(0, tr( "Scale filter" ), true ); QCheckBox* chb1 = new QCheckBox( tr( "Preserve aspect ratio" ), &d ); chb1->setChecked(m_bAspect); d.gridLayout()->addWidget(chb1, 0, 0); connect(chb1, SIGNAL(clicked()), this, SLOT(onAspectToggle())); QCheckBox* chb2 = new QCheckBox( tr( "Use as percentage" ), &d ); chb2->setChecked(m_bPercent); d.gridLayout()->addWidget(chb2, 1, 0); connect(chb2, SIGNAL(clicked()), this, SLOT(onPercentToggle())); QDoubleValidator qv( 0.0, 1000.0, 3, &d ); m_pLew = new QLineEdit( &d, "scale_width" ); m_pLew->setValidator( &qv ); m_pLew->setText( s.sprintf("%.2f", m_dWidth) ); d.gridLayout()->addMultiCellWidget( m_pLew, 2, 2, 0, 0 ); connect(m_pLew, SIGNAL(returnPressed()), this, SLOT(valueChanged())); m_pLeh = new QLineEdit( &d, "scale_height" ); m_pLeh->setValidator( &qv ); m_pLeh->setText( s.sprintf("%.2f",m_dHeight) ); d.gridLayout()->addMultiCellWidget( m_pLeh, 3, 3, 0, 0 ); connect(m_pLeh, SIGNAL(returnPressed()), this, SLOT(valueChanged())); if (d.exec() == QDialog::Rejected) { fprintf(stderr, "tb:config> QDialog::Rejected\n"); m_bAspect = old_aspect; m_bPercent = old_percent; m_dWidth = old_width; m_dHeight = old_height; } else { valueChanged(); valueChanged(); } redraw(); } avm::CImage* ScaleFilter::process(avm::CImage* im, int pos) { if (im->Depth()!=24) { im->AddRef(); return im; } avm::BitmapInfo info = *(im->GetFmt()); adjust(info); avm::CImage* result = new avm::CImage(&info); scale_internal(3,im->Width(),im->Height(),(myGLubyte *)(im->Data()), result->Width(),result->Height(),(myGLubyte *)(result->Data())); return result; } void ScaleFilter::adjust(BITMAPINFOHEADER& bh) { double r = bh.biWidth / (double) bh.biHeight; if (m_bPercent) { bh.biWidth = int(bh.biWidth * (m_dWidth / 100.0)); bh.biHeight = int(bh.biHeight * (m_dHeight / 100.0)); } else { bh.biWidth = (int)m_dWidth; bh.biHeight = (int)m_dHeight; } if (m_bAspect) bh.biHeight = int(bh.biWidth / r); bh.biSizeImage = bh.biWidth * bh.biHeight * (bh.biBitCount / 8); } void ScaleFilter::onAspectToggle() { m_bAspect = !m_bAspect; redraw(); } void ScaleFilter::onPercentToggle() { m_bPercent = !m_bPercent; redraw(); } void ScaleFilter::valueChanged() { m_dWidth = m_pLeh->text().toFloat(); m_dHeight = m_pLeh->text().toFloat(); redraw(); } class FilterSelectionDialog : public QDialog { public: QGridLayout* m_pGl; FilterSelectionDialog(const char* title); int exec(); }; avifile-0.7.48~20090503.ds/samples/qtrecompress/filters.h0000644000175000017500000001211211165212351021747 0ustar yavoryavor#ifndef FILTERS_H #define FILTERS_H #include #include #include class RecKernel; class Filter { int counter; public: Filter(RecKernel* k = 0) : counter(1), kernel(k) {} virtual ~Filter(){} virtual void about() =0; virtual void config() =0; virtual const char* name() const =0; //for list of all filters virtual QString fullname() =0; //includes config options virtual avm::CImage* process(avm::CImage* im, int pos) =0; //filters may affect only a part of stream virtual void addref() { counter++; } virtual void release() { counter--; if (!counter) delete this; } virtual QString save() =0; virtual void load(const QString&) =0; virtual int id() const { return -1; } virtual void adjust(BITMAPINFOHEADER&) {}; protected: virtual void redraw(); RecKernel* kernel; }; class GammaFilter: public QObject, public Filter { Q_OBJECT; float _gamma; public: GammaFilter(RecKernel* k) : Filter(k), _gamma(1) {} virtual const char* name() const { return "Gamma adjustment"; } virtual QString fullname(); virtual avm::CImage* process(avm::CImage* im, int pos); virtual void about(); virtual void config(); virtual QString save(); virtual void load(const QString&); virtual int id() const {return 0;} public slots: void valueChanged(int new_val); }; class BlurFilter: public QObject, public Filter { Q_OBJECT; int _range; public: BlurFilter(RecKernel* k) : Filter(k), _range(3) {} virtual const char* name() const { return "Blur filter"; } virtual QString fullname(); virtual avm::CImage* process(avm::CImage* im, int pos); virtual void about(); virtual void config(); virtual QString save(); virtual void load(const QString&); virtual int id() const { return 1; } public slots: void valueChanged(int new_val); }; class RefractFilter: public QObject, public Filter { Q_OBJECT; unsigned int _dist; float _power; public: RefractFilter(RecKernel* k) : Filter(k), _dist(5), _power(.1f) {} virtual const char* name() const { return "Refraction compensation"; } virtual QString fullname(); virtual avm::CImage* process(avm::CImage* im, int pos); virtual void about(); virtual void config(); virtual QString save(); virtual void load(const QString&); virtual int id() const { return 2; } public slots: void valueChanged1(int new_val); void valueChanged2(int new_val); }; class NoiseFilter: public QObject, public Filter { Q_OBJECT; int _qual; int _edge; int _zz; public: NoiseFilter(RecKernel* k) : Filter(k), _qual(940), _edge(2), _zz(4) {} virtual const char* name() const { return "Noise reduction"; } virtual QString fullname(); virtual avm::CImage* process(avm::CImage* im, int pos); virtual void about(); virtual void config(); virtual QString save(); virtual void load(const QString&); virtual int id() const { return 3; } public slots: void valueChanged1(int new_val); void valueChanged2(int new_val); void valueChanged3(int new_val); }; class MoveFilter: public QObject, public Filter { Q_OBJECT; int _delta; public: MoveFilter(RecKernel* k) : Filter(k), _delta(0) {} virtual const char* name() const { return "Color move"; } virtual QString fullname(); virtual avm::CImage* process(avm::CImage* im, int pos); virtual void about(); virtual void config(); virtual QString save(); virtual void load(const QString&); virtual int id() const {return 4;} public slots: void valueChanged(int new_val); }; /* class SwapFilter: public QObject, public Filter { RecKernel* kernel; Q_OBJECT double _c1, _c2, _c3, _c4; public: SwapFilter(RecKernel* k):kernel(k), _c1(1), _c2(0), _c3(0), _c4(1){} virtual string name(){return "Swap";} virtual string fullname(){return "Swap";} virtual CImage* process(CImage* im, int pos); virtual void about(){} virtual void config(); virtual string save(){} virtual void load(string){} virtual int id() const {return 5;} public slots: void valueChanged1(int new_val); void valueChanged2(int new_val); void valueChanged3(int new_val); void valueChanged4(int new_val); }; */ class QLineEdit; class ScaleFilter: public QObject, public Filter { Q_OBJECT; float m_dWidth, m_dHeight; bool m_bAspect; bool m_bPercent; enum ScaleType { FAST, RESAMPLE } type; QLineEdit* m_pLew; QLineEdit* m_pLeh; public: ScaleFilter(RecKernel* k) : Filter(k), m_dWidth(256), m_dHeight(256), m_bAspect(false), m_bPercent(false) {} virtual const char* name() const { return "Scale"; } virtual QString fullname(); virtual avm::CImage* process(avm::CImage* im, int pos); virtual void about(); virtual void config(); virtual QString save() { return ""; } virtual void load(const QString&){} virtual int id() const { return 5; } virtual void adjust(BITMAPINFOHEADER&); public slots: void onAspectToggle(); void onPercentToggle(); void valueChanged(); }; #endif // FILTERS_H avifile-0.7.48~20090503.ds/samples/qtrecompress/genctl.cpp0000644000175000017500000003224611165212351022120 0ustar yavoryavor #include "genctl.h" #include "genctl.moc" #include "recwnd.h" #include "codecdialog.h" #include "audc.h" #include "conf.h" #include #include #include #include #include #include #include #include #include #include #define DECLARE_REGISTRY_SHORTCUT #include /* * Constructs a QtRecompressorCtl which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ QtRecompressorCtl::QtRecompressorCtl( QWidget* parent ) : QtRecompressor( parent, "Avi Recompressor" ) { kernel=new RecKernel; wnd=0; ictl=0; no_recurs=0; m_pListAllFilters->clear(); for(int i=0;;i++) { Filter* fi=kernel->getFilter(i); if(!fi)break; //printf("FULLNAMEA %s\n", fi->fullname().c_str()); m_pListAllFilters->insertItem( tr( fi->name() ) ); fi->release(); } connect(_lbFilters, SIGNAL(doubleClicked( QListBoxItem * )), this, SLOT(configFilterClicked())); connect(m_pLineLowFrames, SIGNAL(textChanged(const QString&)), this, SLOT(lo_fr_changed(const QString&))); connect(m_pLineHighFrames, SIGNAL(textChanged(const QString&)), this, SLOT(hi_fr_changed(const QString&))); connect(m_pLineLowSec, SIGNAL(textChanged(const QString&)), this, SLOT(lo_sec_changed(const QString&))); connect(m_pLineHighSec, SIGNAL(textChanged(const QString&)), this, SLOT(hi_sec_changed(const QString&))); updateFilters(); } /* * Destroys the object and frees any allocated resources */ QtRecompressorCtl::~QtRecompressorCtl() { //cout << "QtRecompressorCtl::~QtRecompressorCtl()" << endl; delete kernel; delete wnd; // no need to delete child widgets, Qt does it all for us } /* * public slot */ void QtRecompressorCtl::aboutFilterClicked() { Filter* fi=kernel->getFilter(m_pListAllFilters->currentItem()); if(!fi)return; fi->about(); fi->release(); } void QtRecompressorCtl::updateFilters() { m_pListAllFilters->clearSelection(); _lbFilters->clear(); for (int i = 0; ; i++) { Filter* fi = kernel->getFilterAt(i); if (!fi) break; //printf("FULLNAMEB %s\n", fi->fullname().c_str()); _lbFilters->insertItem(fi->fullname().ascii()); fi->release(); } } void QtRecompressorCtl::addFilterClicked() { Filter* fi=kernel->getFilter(m_pListAllFilters->currentItem()); if(!fi)return; int id=kernel->addFilter(fi); fi->release(); updateFilters(); } void QtRecompressorCtl::configFilterClicked() { Filter* fi= kernel->getFilterAt(_lbFilters->currentItem()); if(!fi)return; fi->config(); fi->release(); updateFilters(); } void QtRecompressorCtl::fileOpenVideo() { QString result=QFileDialog::getOpenFileName(RS("OpenFile", "./movie.avi"), 0, 0, 0 #if QT_VERSION > 220 , tr( "Open source file" ) #endif ); if (result.isNull()) return; if (kernel->openFile(result.ascii())!=0) return; WS("OpenFile", result.ascii()); m_pLabelSrc->setText(result); m_pComboStreams->clear(); for (unsigned i = 0; i < kernel->getStreamCount(); i++) m_pComboStreams->insertItem(kernel->getStreamName(i).c_str()); streamSelected(0); m_pComboStreams->setCurrentItem(0); m_pRadioCopy->setChecked(true); m_pRadioSeconds->setChecked(true); m_pRadioFrames->setChecked(false); streamLimitModeChanged(0); streamModeChanged(2); if(!wnd) { ictl=new QImageControl(0); ictl->show(); kernel->setImageControl(ictl); wnd = new SourceControl(0, kernel); wnd->show(); } else { kernel->setImageControl(ictl); wnd->updateSize(); } } void QtRecompressorCtl::fileAppendVideo() { QString result=QFileDialog::getOpenFileName(avm::RegReadString(g_pcProgramName, "AppendFile", "./movie.avi"), 0, 0, 0 #if QT_VERSION > 220 , tr( "Append source file" ) #endif ); if (result.isNull()) return; if (kernel->openFile(result.ascii())!=0) return; } void QtRecompressorCtl::fileSaveAvi() { QString result=QFileDialog::getSaveFileName(avm::RegReadString(g_pcProgramName, "SaveFile", "./dest.avi"), 0, 0, 0 #if QT_VERSION > 220 , tr( "Save destination file" ) #endif ); if(result.isNull()) return; if(kernel->setDestFile(result.ascii())!=0) return; avm::RegWriteString(g_pcProgramName, "SaveFile", result.ascii()); m_pLabelDst->setText(result); } void QtRecompressorCtl::fileQuit() { close(); } void QtRecompressorCtl::detailsClicked() { avm::string details = kernel->aboutStream(m_pComboStreams->currentItem()); QMessageBox::information( this, tr( "About stream" ), details.c_str()); } void QtRecompressorCtl::downFilterClicked() { uint_t c = _lbFilters->currentItem(); kernel->moveDownFilter(c); updateFilters(); uint d = c + ((c + 1) < _lbFilters->count()); _lbFilters->setCurrentItem( d ); _lbFilters->setSelected( d, TRUE ); } void QtRecompressorCtl::upFilterSelected() { uint_t c = _lbFilters->currentItem(); kernel->moveUpFilter(_lbFilters->currentItem()); updateFilters(); uint_t d = c - (c > 0); _lbFilters->setCurrentItem( d ); _lbFilters->setSelected( d, TRUE ); } void QtRecompressorCtl::fileLoadConfig() { QString result = QFileDialog::getOpenFileName(avm::RegReadString(g_pcProgramName, "OpenConf", "./test.conf"), 0, 0, 0 #if QT_VERSION > 220 , tr( "Open configuration" ) #endif ); if(result.isNull())return; try { kernel->loadConfig(result.ascii()); avm::RegWriteString(g_pcProgramName, "OpenConf", result.ascii()); m_pLabelSrc->setText(kernel->getSrcFile()); m_pLabelDst->setText(kernel->getDestFile()); m_pLabelConfig->setText(result.ascii()); m_pComboStreams->clear(); for(unsigned i = 0; i < kernel->getStreamCount(); i++) m_pComboStreams->insertItem(kernel->getStreamName(i).c_str()); streamSelected(0); // kernel->setStreamMode( m_pComboStreams->setCurrentItem(0); RecKernel::KernelMode mode; if (kernel->getStreamMode(0, mode) == 0) streamModeChanged(mode); updateFilters(); /* switch(mode) { case Ignore: m_pRadioRemove->setChecked(true); break; case Copy: m_pRadioCopy->setChecked(true); break; case Recompress: m_pRadioRecompress->setChecked(true); break; } } */ m_pRadioSeconds->setChecked(true); streamLimitModeChanged(0); // streamModeChanged(0); if(!wnd) { ictl=new QImageControl(0); ictl->show(); kernel->setImageControl(ictl); wnd = new SourceControl(0, kernel); wnd->show(); } else { kernel->setImageControl(ictl); wnd->updateSize(); } } catch (avm::FatalError& e) { QMessageBox::information(this, e.GetModule(), e.GetDesc()); } } void QtRecompressorCtl::removeFilterClicked() { kernel->removeFilter(_lbFilters->currentItem()); updateFilters(); } void QtRecompressorCtl::fileSaveConfig() { QString result = QFileDialog::getSaveFileName(avm::RegReadString(g_pcProgramName, "OpenConf", "./test.conf"), 0, 0, 0 #if QT_VERSION > 220 , tr( "Save configuration as" ) #endif ); if (result.isNull())return; try { kernel->saveConfig(result.ascii()); avm::RegWriteString(g_pcProgramName, "OpenConf", result.ascii()); m_pLabelConfig->setText(result.ascii()); } catch (avm::FatalError& e) { QMessageBox::information(this, e.GetModule(), e.GetDesc()); } } void QtRecompressorCtl::streamFormatClicked() { int stream = m_pComboStreams->currentItem(); avm::VideoEncoderInfo info; AudioEncoderInfo ainfo; WAVEFORMATEX wfmtx; QavmCodecDialog* config; AudioCodecConfig* ac; if(!kernel->isStream(stream)) return; switch(kernel->getStreamType(stream)) { case avm::IStream::Video: if (kernel->getCompress(stream, info) <= 0) return;//shouldn't happen. else { int sel = 0; int i = 0; avm::vector codecs; avm::CodecInfo::Get(codecs, avm::CodecInfo::Video, avm::CodecInfo::Encode, info.compressor); /* avm::vector::iterator it; for (it=video_codecs.begin(); it!=video_codecs.end(); it++) { if(!(it->direction & avm::CodecInfo::Encode)) continue; //printf("inserting: %x, %s\n", it->fourcc, it->GetName()); codecs.push_back(*it); if((it->fourcc==info.compressor) && (info.cname==it->GetName())) sel=i; i++; } */ config = new QavmCodecDialog(this, codecs); config->setCurrent(sel); if (config->exec() == QDialog::Accepted) kernel->setCompress(stream, config->getInfo()); delete config; } break; case avm::IStream::Audio: if (kernel->getAudioCompress(stream, ainfo) != 0) return;//shouldn't happen. ac = new AudioCodecConfig(this, ainfo); if (ac->exec() == QDialog::Accepted) kernel->setAudioCompress(stream, ac->GetInfo()); delete ac; break; default: printf("QtRecompressorCtl::streamFormatClicked() unsupported stream type\n"); } } void QtRecompressorCtl::streamLimitModeChanged(int) { if(m_pRadioSeconds->isChecked()) { m_pLineLowSec->setEnabled(true); m_pLineHighSec->setEnabled(true); m_pLineLowFrames->setEnabled(false); m_pLineHighFrames->setEnabled(false); } else { m_pLineLowSec->setEnabled(false); m_pLineHighSec->setEnabled(false); m_pLineLowFrames->setEnabled(true); m_pLineHighFrames->setEnabled(true); } } void QtRecompressorCtl::streamModeChanged(int) { int stream=m_pComboStreams->currentItem(); if (!kernel->isStream(stream)) return; if (m_pRadioRemove->isChecked()) { m_pButtonFormat->setEnabled(false); kernel->setStreamMode(stream, RecKernel::Remove); m_pRadioSeconds->setEnabled(false); m_pRadioFrames->setEnabled(false); m_pLineLowSec->setEnabled(false); m_pLineHighSec->setEnabled(false); m_pLineLowFrames->setEnabled(false); m_pLineHighFrames->setEnabled(false); } else if (m_pRadioCopy->isChecked()) { m_pButtonFormat->setEnabled(false); kernel->setStreamMode(stream, RecKernel::Copy); m_pRadioSeconds->setEnabled(true); m_pRadioFrames->setEnabled(true); streamLimitModeChanged(0); } else { m_pButtonFormat->setEnabled(true); kernel->setStreamMode(stream, RecKernel::Recompress); m_pRadioSeconds->setEnabled(true); m_pRadioFrames->setEnabled(true); streamLimitModeChanged(0); } } void QtRecompressorCtl::streamSelected(int s) { RecKernel::KernelMode mode; if(kernel->getStreamMode(s, mode)!=0) return; framepos_t start, end; switch(mode) { case RecKernel::Remove: m_pRadioRemove->setChecked(true); break; case RecKernel::Copy: m_pRadioCopy->setChecked(true); break; case RecKernel::Recompress: m_pRadioRecompress->setChecked(true); break; } streamModeChanged(/*unused*/0); kernel->getSelection(s, start, end); char str[256]; sprintf(str, "%.3f", start * kernel->getFrameTime(s)); m_pLineLowSec->setText(str); sprintf(str, "%.3f", end * kernel->getFrameTime(s)); m_pLineHighSec->setText(str); sprintf(str, "%d", int(start)); m_pLineLowFrames->setText(str); sprintf(str, "%d", int(end)); m_pLineHighFrames->setText(str); } void QtRecompressorCtl::startRecompress() { if (!wnd) return; wnd->hide(); hide(); RecWindow w(this, kernel); w.update(); w.exec(); fprintf(stderr, "Recompress finished"); wnd->show(); show(); } void QtRecompressorCtl::lo_sec_changed(const QString& s) { if(no_recurs)return; int stream=m_pComboStreams->currentItem(); if(!kernel->isStream(stream)) return; if(kernel->getFrameTime(stream)==0)return; int start = int(atof(s.ascii())/kernel->getFrameTime(stream)); char q[128]; sprintf(q, "%d", start); no_recurs=1; m_pLineLowFrames->setText(q); no_recurs=0; kernel->setSelectionStart(stream, start); } void QtRecompressorCtl::hi_sec_changed(const QString& s) { if(no_recurs)return; int stream=m_pComboStreams->currentItem(); if(!kernel->isStream(stream)) return; if(kernel->getFrameTime(stream)==0)return; int end = int(atof(s.ascii())/kernel->getFrameTime(stream)); char q[128]; sprintf(q, "%d", end); no_recurs=1; m_pLineHighFrames->setText(q); no_recurs=0; kernel->setSelectionEnd(stream, end); } void QtRecompressorCtl::lo_fr_changed(const QString& s) { if(no_recurs)return; int stream=m_pComboStreams->currentItem(); if(!kernel->isStream(stream)) return; char q[128]; sprintf(q, "%.3f", atoi(s.ascii())*kernel->getFrameTime(stream)); no_recurs=1; m_pLineLowSec->setText(q); no_recurs=0; kernel->setSelectionStart(stream, atoi(s.ascii())); } void QtRecompressorCtl::hi_fr_changed(const QString& s) { if(no_recurs)return; int stream=m_pComboStreams->currentItem(); if(!kernel->isStream(stream)) return; char q[128]; sprintf(q, "%.3f", atoi(s.ascii())*kernel->getFrameTime(stream)); no_recurs=1; m_pLineHighSec->setText(q); no_recurs=0; kernel->setSelectionEnd(stream, atoi(s.ascii())); } void QtRecompressorCtl::videoFilters() { } void QtRecompressorCtl::optionsPreferences() { } void QtRecompressorCtl::helpContents() { } void QtRecompressorCtl::helpChangelog() { } avifile-0.7.48~20090503.ds/samples/qtrecompress/genctl.h0000644000175000017500000000265107664353554021606 0ustar yavoryavor#ifndef QTRECOMPRESSORCTL_H #define QTRECOMPRESSORCTL_H #include "genctl_p.h" #include "recompressor.h" #include "qimagecontrol.h" #include "srcctl.h" class QtRecompressorCtl : public QtRecompressor { Q_OBJECT; public: QtRecompressorCtl( QWidget* parent = 0 ); ~QtRecompressorCtl(); public slots: virtual void fileOpenVideo(); virtual void fileAppendVideo(); virtual void fileSaveAvi(); virtual void fileLoadConfig(); virtual void fileSaveConfig(); virtual void fileQuit(); virtual void videoFilters(); virtual void optionsPreferences(); virtual void helpContents(); virtual void helpChangelog(); virtual void startRecompress(); virtual void aboutFilterClicked(); virtual void addFilterClicked(); virtual void configFilterClicked(); virtual void detailsClicked(); virtual void downFilterClicked(); virtual void removeFilterClicked(); virtual void streamFormatClicked(); virtual void streamLimitModeChanged(int); virtual void streamModeChanged(int); virtual void streamSelected(int); virtual void upFilterSelected(); void lo_fr_changed(const QString&); void hi_fr_changed(const QString&); void lo_sec_changed(const QString&); void hi_sec_changed(const QString&); protected: void updateFilters(); RecKernel* kernel; int no_recurs; SourceControl* wnd; QImageControl* ictl; }; #endif // QTRECOMPRESSORCTL_H avifile-0.7.48~20090503.ds/samples/qtrecompress/genctl_p.cpp0000644000175000017500000002267007664353554022463 0ustar yavoryavor#include "genctl_p.h" #include "genctl_p.moc" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if QT_VERSION <= 220 #define LAYOUTCOL 1 #else #define LAYOUTCOL 0 #endif /* * Constructs a QtRecompressor which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ QtRecompressor::QtRecompressor( QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) { QLabel* lb; QGridLayout* gl; QHBox* hb; QVBox* vb; if ( !name ) setName( "AviRecompressor" ); setCaption( tr( "AviRecompressor" ) ); //setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, sizePolicy().hasHeightForWidth() ) ); QPopupMenu *file = new QPopupMenu( this ); CHECK_PTR( file ); file->insertItem( "&Open video file", this, SLOT( fileOpenVideo() ), CTRL+Key_O ); file->insertItem( "&Append video file", this, SLOT( fileAppendVideo() ), CTRL+Key_A ); file->insertItem( "&Save AVI As", this, SLOT( fileSaveAvi() ), CTRL+Key_S ); //file->insertItem( "Save WAV ", this, SLOT( fileSaveAvi() ) ); //file->insertItem( "Save audio ", this, SLOT( fileSaveAvi() ) ); file->insertSeparator(); file->insertItem( "&Read Config", this, SLOT( fileLoadConfig() ), CTRL+Key_R ); file->insertItem( "&Write Config", this, SLOT( fileSaveConfig() ), CTRL+Key_W ); file->insertSeparator(); file->insertItem( "&Quit", this, SLOT( fileQuit() ), CTRL+Key_Q ); QPopupMenu *edit = new QPopupMenu( this ); CHECK_PTR( edit ); QPopupMenu *video = new QPopupMenu( this ); CHECK_PTR( video ); video->insertItem( "&Filters", this, SLOT( videoFilters() ), CTRL+Key_F ); QPopupMenu *audio = new QPopupMenu( this ); CHECK_PTR( audio ); QPopupMenu *options = new QPopupMenu( this ); CHECK_PTR( options ); options->insertItem( "&Preferences", this, SLOT( optionsPreferences() ) ); QPopupMenu *help = new QPopupMenu( this ); CHECK_PTR( help ); help->insertItem( "&Contents", this, SLOT( helpContents() ), CTRL+Key_H ); help->insertSeparator(); help->insertItem( "Changelog", this, SLOT( helpChangelog() ) ); QMenuBar* menu = menuBar(); // new QMenuBar( this ); statusBar(); CHECK_PTR( menu ); menu->insertItem( "&File", file ); menu->insertItem( "&Edit", edit ); menu->insertItem( "&Video", video ); menu->insertItem( "&Audio", audio ); menu->insertItem( "&Options", options ); menu->insertSeparator(); menu->insertItem( "&Help", help ); menu->setSeparator( QMenuBar::InWindowsStyle ); //QToolBar* qtb = new QToolBar( this ); //centralWidget() QVBox* bg = new QVBox( this ); bg->setMargin(10); setCentralWidget(bg); QGroupBox* g = new QGroupBox( tr( "Source and destination" ), bg ); g->setColumnLayout( LAYOUTCOL, Qt::Vertical ); gl = new QGridLayout( g->layout(), 1, 1 ); gl->setSpacing( 5 ); m_pButtonSrc = new QPushButton( tr( "&Source:" ), g ); //m_pButtonSrc->setAlignment( AlignRight | AlignVCenter ); gl->addWidget( m_pButtonSrc, 0, 0 ); m_pButtonDst = new QPushButton( tr( "&Destination:" ), g ); //m_pButtonDst->setAlignment( AlignRight | AlignVCenter ); gl->addWidget( m_pButtonDst, 1, 0 ); m_pButtonCfg = new QPushButton( tr( "Configuration:" ), g ); //m_pButtonCfg->setAlignment( AlignRight | AlignVCenter ); gl->addWidget( m_pButtonCfg, 2, 0 ); m_pLabelSrc = new QLabel( g ); m_pLabelSrc->setFrameShadow( QLabel::Sunken ); m_pLabelSrc->setFrameShape( QLabel::Box ); gl->addWidget( m_pLabelSrc, 0, 1 ); m_pLabelDst = new QLabel( g ); m_pLabelDst->setFrameShadow( QLabel::Sunken ); m_pLabelDst->setFrameShape( QLabel::Box ); gl->addWidget( m_pLabelDst, 1, 1 ); m_pLabelConfig = new QLabel( g ); m_pLabelConfig->setFrameShadow( QLabel::Sunken ); m_pLabelConfig->setFrameShape( QLabel::Box ); gl->addWidget( m_pLabelConfig, 2, 1 ); m_pButtonStart = new QPushButton( tr( "&Go!" ), g ); gl->addMultiCellWidget( m_pButtonStart, 0, 2, 2, 2 ); gl->setColStretch( 1, 1 ); g = new QGroupBox( tr( "Recompress options" ), bg ); g->setMargin( 5 ); g->setFrameShadow( QGroupBox::Sunken ); g->setFrameShape( QGroupBox::Box ); g->setColumnLayout( LAYOUTCOL , Qt::Vertical ); gl = new QGridLayout( g->layout(), 1, 1 ); hb = new QHBox( g ); hb->setSpacing( 5 ); gl->addMultiCellWidget( hb, 0, 0, 0, 1 ); lb = new QLabel( tr( "Stream:" ), hb ); m_pComboStreams = new QComboBox( FALSE, hb ); m_pButtonStreamDetails = new QPushButton( tr( "Details..." ), hb ); m_pButtonFormat = new QPushButton( tr( "Format..." ), hb ); m_pButtonFormat->setEnabled( FALSE ); /////////// m_pButtonGroupLimits = new QVButtonGroup( g ); m_pButtonGroupLimits->setLineWidth( 0 ); m_pRadioSeconds = new QRadioButton( tr( "seconds" ), m_pButtonGroupLimits ); m_pRadioFrames = new QRadioButton( tr( "frames" ), m_pButtonGroupLimits ); gl->addWidget( m_pButtonGroupLimits, 1, 0 ); QWidget* Layout27 = new QWidget( g ); gl->addWidget( Layout27, 1, 1, 1 ); QGridLayout* sgl = new QGridLayout( Layout27, 1, 1 ); sgl->setSpacing( 5 ); sgl->setMargin( 0 ); // first row m_pLineLowSec = new QLineEdit( Layout27 ); sgl->addWidget( m_pLineLowSec, 0, 0 ); lb = new QLabel( tr( "to" ), Layout27 ); sgl->addWidget( lb, 0, 1 ); m_pLineHighSec = new QLineEdit( Layout27 ); sgl->addWidget( m_pLineHighSec, 0, 2 ); // second row m_pLineLowFrames = new QLineEdit( Layout27 ); sgl->addWidget( m_pLineLowFrames, 1, 0 ); lb = new QLabel( tr( "to" ), Layout27 ); sgl->addWidget( lb, 1, 1 ); m_pLineHighFrames = new QLineEdit( Layout27 ); sgl->addWidget( m_pLineHighFrames, 1, 2 ); ///////////// m_pButtonGroupStreamMode = new QVButtonGroup( g ); m_pButtonGroupStreamMode->setTitle( tr( "" ) ); m_pButtonGroupStreamMode->setLineWidth( 0 ); gl->addMultiCellWidget( m_pButtonGroupStreamMode, 0, 1, 2, 2 ); m_pRadioRemove = new QRadioButton( tr( "Remove" ), m_pButtonGroupStreamMode ); m_pRadioCopy = new QRadioButton( tr( "Copy" ), m_pButtonGroupStreamMode ); m_pRadioRecompress = new QRadioButton( tr( "Recompress" ), m_pButtonGroupStreamMode ); ///////////// g = new QGroupBox( bg ); g->setTitle( tr( "Filters" ) ); g->setColumnLayout( LAYOUTCOL, Qt::Vertical ); gl = new QGridLayout( g->layout(), 1, 1 ); gl->setSpacing( 5 ); gl->setColStretch( 0, 4 ); gl->setColStretch( 2, 2 ); _lbFilters = new QListBox( g ); _lbFilters->insertItem( tr( "New Item" ) ); gl->addMultiCellWidget( _lbFilters, 0, 1, 0, 0 ); vb = new QVBox( g ); vb->setSpacing( 5 ); gl->addMultiCellWidget( vb, 0, 1, 1, 1 ); m_pButtonConfigFilter = new QPushButton( tr( "Configure" ), vb ); m_pButtonAddFilter = new QPushButton( tr( "Add" ), vb ); m_pButtonRemoveFilter = new QPushButton( tr( "Remove" ), vb ); m_pButtonUpFilter = new QPushButton( tr( "Up" ), vb ); m_pButtonUpFilter->setAutoRepeat( TRUE ); m_pButtonDownFilter = new QPushButton( tr( "Down" ) , vb ); m_pButtonDownFilter->setAutoRepeat( TRUE ); hb = new QHBox( g ); hb->setSpacing( 5 ); m_pButtonAboutFilter = new QPushButton( tr( "About" ), hb ); lb = new QLabel( tr( "Available filters" ), hb ); lb->setAlignment( AlignRight | AlignVCenter ); gl->addWidget( hb, 0, 2 ); hb = new QHBox(); m_pListAllFilters = new QListBox( g ); m_pListAllFilters->insertItem( tr( "New Item" ) ); gl->addWidget( m_pListAllFilters, 1, 2 ); // signals and slots connections connect( m_pButtonStreamDetails, SIGNAL( clicked() ), this, SLOT( detailsClicked() ) ); connect( m_pButtonAboutFilter, SIGNAL( clicked() ), this, SLOT( aboutFilterClicked() ) ); connect( m_pButtonAddFilter, SIGNAL( clicked() ), this, SLOT( addFilterClicked() ) ); connect( m_pButtonRemoveFilter, SIGNAL( clicked() ), this, SLOT( removeFilterClicked() ) ); connect( m_pButtonConfigFilter, SIGNAL( clicked() ), this, SLOT( configFilterClicked() ) ); connect( m_pButtonUpFilter, SIGNAL( clicked() ), this, SLOT( upFilterSelected() ) ); connect( m_pButtonDownFilter, SIGNAL( clicked() ), this, SLOT( downFilterClicked() ) ); connect( m_pButtonGroupStreamMode, SIGNAL( clicked(int) ), this, SLOT( streamModeChanged(int) ) ); connect( m_pButtonGroupLimits, SIGNAL( clicked(int) ), this, SLOT( streamLimitModeChanged(int) ) ); connect( m_pButtonFormat, SIGNAL( clicked() ), this, SLOT( streamFormatClicked() ) ); connect( m_pComboStreams, SIGNAL( activated(int) ), this, SLOT( streamSelected(int) ) ); connect( m_pButtonStart, SIGNAL( clicked() ), this, SLOT( startRecompress() ) ); connect( m_pButtonSrc, SIGNAL( clicked() ), this, SLOT( fileOpenVideo() ) ); connect( m_pButtonDst, SIGNAL( clicked() ), this, SLOT( fileSaveAvi() ) ); connect( m_pButtonCfg, SIGNAL( clicked() ), this, SLOT( fileLoadConfig() ) ); } /* * Destroys the object and frees any allocated resources */ QtRecompressor::~QtRecompressor() { // no need to delete child widgets, Qt does it all for us } avifile-0.7.48~20090503.ds/samples/qtrecompress/genctl_p.h0000644000175000017500000000460607664353554022127 0ustar yavoryavor#ifndef QTRECOMPRESSOR_H #define QTRECOMPRESSOR_H #include class QButtonGroup; class QComboBox; class QLabel; class QLineEdit; class QListBox; class QPushButton; class QRadioButton; class QtRecompressor : public QMainWindow { Q_OBJECT; public: QtRecompressor( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~QtRecompressor(); QButtonGroup* m_pButtonGroupLimits; QButtonGroup* m_pButtonGroupStreamMode; QComboBox* m_pComboStreams; QLabel* m_pLabelConfig; QLabel* m_pLabelDst; QLabel* m_pLabelSrc; QLineEdit* m_pLineHighFrames; QLineEdit* m_pLineHighSec; QLineEdit* m_pLineLowFrames; QLineEdit* m_pLineLowSec; QListBox* m_pListAllFilters; QListBox* _lbFilters; QPushButton* m_pButtonSrc; QPushButton* m_pButtonDst; QPushButton* m_pButtonCfg; QPushButton* m_pButtonAboutFilter; QPushButton* m_pButtonAddFilter; QPushButton* m_pButtonConfigFilter; QPushButton* m_pButtonDownFilter; QPushButton* m_pButtonFormat; QPushButton* m_pButtonLoadCfg; QPushButton* m_pButtonOpen; QPushButton* m_pButtonRemoveFilter; QPushButton* m_pButtonSaveAs; QPushButton* m_pButtonSaveCfg; QPushButton* m_pButtonStart; QPushButton* m_pButtonStreamDetails; QPushButton* m_pButtonUpFilter; QRadioButton* m_pRadioRemove; QRadioButton* m_pRadioCopy; QRadioButton* m_pRadioRecompress; QRadioButton* m_pRadioSeconds; QRadioButton* m_pRadioFrames; public slots: virtual void fileOpenVideo() = 0; virtual void fileAppendVideo() = 0; virtual void fileSaveAvi() = 0; virtual void fileLoadConfig() = 0; virtual void fileSaveConfig() = 0; virtual void fileQuit() = 0; virtual void videoFilters() = 0; virtual void optionsPreferences() = 0; virtual void helpContents() = 0; virtual void helpChangelog() = 0; virtual void startRecompress() = 0; virtual void aboutFilterClicked() = 0; virtual void addFilterClicked() = 0; virtual void configFilterClicked() = 0; virtual void detailsClicked() = 0; virtual void downFilterClicked() = 0; virtual void removeFilterClicked() = 0; virtual void streamFormatClicked() = 0; virtual void streamLimitModeChanged(int) = 0; virtual void streamModeChanged(int) = 0; virtual void streamSelected(int) = 0; virtual void upFilterSelected() = 0; }; #endif // QTRECOMPRESSOR_H avifile-0.7.48~20090503.ds/samples/qtrecompress/imagecontrol.h0000644000175000017500000000046407547603652023012 0ustar yavoryavor#ifndef IIMAGECONTROL_H #define IIMAGECONTROL_H #include class IImageControl { public: virtual ~IImageControl(){} virtual void setSize(int width, int height) =0; virtual void setSourcePicture(const avm::CImage*) =0; virtual void setDestPicture(const avm::CImage*) =0; }; #endif avifile-0.7.48~20090503.ds/samples/qtrecompress/main.cpp0000644000175000017500000000357310747177714021613 0ustar yavoryavor#include "genctl.h" #include "recwnd.h" #include #include #include #include #include #include #ifdef __FreeBSD__ #include #endif #ifdef __NetBSD__ #include #endif void Usage() { printf("Usage: avirecompress [config-file-name]\n" " Without options: interactive mode\n" " With one option: batch mode ( processes one file according to config options and exits )\n"); } struct ConsoleCallback: public IRecompressCallback { int state; ConsoleCallback():state(0){} virtual void setNewState(double progress, double elapsed, int64_t filesize) { printf("percent: %3.1f elapsed: %f size: %" PRId64 "\n", progress * 100, elapsed, filesize); } virtual void setTotal(framepos_t vtotal, framepos_t atotal, double vtime, double atime) {} virtual void addVideo(framepos_t vframe, unsigned int vsize, double vtime, bool keyframe) {} virtual void addAudio(framepos_t asample, unsigned int asize, double atime) {} virtual void finished() { state=1; } }; int main(int argc, char** argv) { #if defined(__FreeBSD__) || defined(__NetBSD__) fpsetmask(fpgetmask() & ~(FP_X_DZ|FP_X_INV)); #endif if (argc == 1) { try { QApplication app(argc, argv); QtRecompressorCtl ctl; ctl.show(); app.setMainWidget(&ctl); app.exec(); } catch (avm::FatalError& e) { e.PrintAll(); } } else if (argc == 2) { if (strcmp(argv[1], "--help")!=0) { ConsoleCallback ck; RecKernel kernel; kernel.loadConfig(argv[1]); kernel.setCallback(&ck); kernel.startRecompress(); while (!ck.state) sleep(1); // RecWindow* wnd=new RecWindow(0, &kernel); // wnd->show(); // app.setMainWidget(wnd); // wnd->exec(); } else Usage(); } else Usage(); return 0; } avifile-0.7.48~20090503.ds/samples/qtrecompress/qimagecontrol.cpp0000644000175000017500000000606107664353554023530 0ustar yavoryavor#include "qimagecontrol.h" #include #include #include #include #include #include // abort() #include const QEvent::Type Type_LeftPix=QEvent::Type(QEvent::User); const QEvent::Type Type_RightPix=QEvent::Type(QEvent::User+1); QImageControl::QImageControl(QWidget* parent, const char* name):QWidget(parent,name),_il(0), _ir(0) { _left = new QFrame( this ); _right = new QFrame( this ); _left->setFrameShadow( QFrame::Sunken ); _left->setFrameShape( QFrame::Box ); _right->setFrameShadow( QFrame::Sunken ); _right->setFrameShape( QFrame::Box ); _il = _ir = 0; //setSize( 192,144 ); } QImageControl::~QImageControl() { delete _il; delete _ir; } void QImageControl::setSize(int width, int height) { if (height<0) height=-height; _left->resize( width, height ); _right->resize( width, height ); int nw = width + 10; int nh = 5; if (height < 400) { nw = 5; nh = height + 10; } _left->move( 5, 5 ); _right->move( nw, nh ); resize( width + 5 + nw, height + 5 + nh ); } QImage* QImageControl::getQImage(const avm::CImage* im) const { int w = im->Width(); int h = im->Height(); int bitdepth = 32; //printf("HEI %d\n", _h); QImage* qi = new QImage( w, h, bitdepth ); avm::BitmapInfo bi(w, h, bitdepth); avm::CImage ci(&bi, qi->scanLine(0), false); ci.Convert(im); return qi; } void QImageControl::setSourcePicture(const avm::CImage* src) { //printf("SRC:\n"); src->GetFmt()->Print(); m_Mutex.Lock(); QImage* s32 = getQImage(src); delete _il; _il = s32; QEvent* e = new QEvent(Type_LeftPix); qApp->postEvent(this, e); m_Mutex.Unlock(); //qApp->sendPostedEvents(); } void QImageControl::setDestPicture(const avm::CImage* src) { //printf("DST:\n"); src->GetFmt()->Print(); m_Mutex.Lock(); QImage* s32 = getQImage(src); delete _ir; _ir = s32; QEvent* e = new QEvent(Type_RightPix); qApp->postEvent(this, e); m_Mutex.Unlock(); } void QImageControl::setPicture(const QImage* qi, QFrame* frame) { if (qi) { QPainter p(frame); p.drawImage( 0, 0, *qi ); } } void QImageControl::paintEvent(QPaintEvent* e) { avm::Locker locker(m_Mutex); setPicture(_il, _left); setPicture(_ir, _right); } bool QImageControl::event(QEvent* ev) { static int lastWidth=0, lastHeight=0; if (ev->type()==Type_LeftPix) { avm::Locker locker(m_Mutex); setPicture(_il, _left); return true; } else if (ev->type()==Type_RightPix) { avm::Locker locker(m_Mutex); // first clear the destination frame if the picture size has changed if(_ir->width()!=lastWidth || _ir->height()!=lastHeight){ lastWidth=_ir->width(); lastHeight=_ir->height(); QPainter p(_right); p.eraseRect(0,0,_il->width(),_il->height()); } // then set the new picture setPicture(_ir, _right); return true; } if (ev->type() == QEvent::Paint) return QWidget::event(ev); // this seems to help with flickering return false; } avifile-0.7.48~20090503.ds/samples/qtrecompress/qimagecontrol.h0000644000175000017500000000136007664353555023173 0ustar yavoryavor#include "imagecontrol.h" #include #include class QFrame; class QImage; class QImageControl: public QWidget, public IImageControl { public: QImageControl(QWidget* parent, const char* name="Image control"); virtual ~QImageControl(); virtual void setSize(int width, int height); virtual void setSourcePicture(const avm::CImage*); virtual void setDestPicture(const avm::CImage*); bool close(bool) { return false; } virtual void paintEvent(QPaintEvent*); protected: void setPicture(const QImage*, QFrame*); bool event(QEvent* ev); QImage* getQImage(const avm::CImage*) const; avm::PthreadMutex m_Mutex; QFrame* _left; QFrame* _right; QImage* _il; QImage* _ir; }; avifile-0.7.48~20090503.ds/samples/qtrecompress/rec_cb.h0000644000175000017500000000107310316245242021522 0ustar yavoryavor#ifndef IRecompressCallback_H #define IRecompressCallback_H #include class IRecompressCallback { public: virtual ~IRecompressCallback() {} virtual void addAudio(framepos_t asample, unsigned int asize, double atime) = 0; virtual void addVideo(framepos_t vframe, unsigned int vsize, double vtime, bool keyframe) =0; virtual void setTotal(framepos_t vtotal, framepos_t atotal, double vtime, double atime) =0; virtual void setNewState(double progress, double elapsed, int64_t filesize) =0; virtual void finished() =0; }; #endif avifile-0.7.48~20090503.ds/samples/qtrecompress/recompressor.cpp0000644000175000017500000004757111165212351023376 0ustar yavoryavor#include "recompressor.h" #include "filters.h" #include "conf.h" #include #include #include #include #include #include #include #include #include #include #define DECLARE_REGISTRY_SHORTCUT #include const char* g_pcProgramName = "avirecompress"; #define Debug if(0) #define __MODULE__ "RecompressFilter" /************************* Work with filters. *************************/ RecompressFilter::RecompressFilter(const avm::VideoEncoderInfo& in) :info(in) { ve = 0; vd = 0; comp_frame = 0; //info.header.biHeight = -1; printf("RecompressFilter: Create: 0x%x \"%.4s\" name: %s\n", in.compressor, (const char*)&in.compressor, info.cname.c_str()); //lazy init - in process } RecompressFilter::~RecompressFilter() { Debug printf("RecompressFilter::~RecompressFilter()\n"); avm::FreeEncoderVideo(ve); avm::FreeDecoderVideo(vd); delete[] comp_frame; } avm::CImage* RecompressFilter::process(avm::CImage* im, int pos) { avm::BitmapInfo bm(*(im->GetFmt())); //printf("***--- PROCESS %d\n", info.header.biHeight); bm.Print(); BitmapInfo(info.header).Print(); if (labs(bm.biHeight) != labs(info.header.biHeight) || bm.biWidth != info.header.biWidth || bm.biBitCount != info.header.biBitCount || bm.biCompression != info.header.biCompression) { try { //bm.biCompression = 0; //bm.SetSpace(IMG_FMT_YV12); bm.SetBits(24); bm.SetDirection(true); //avm::BitmapInfo bh1(info.header); //bh1.Print(); info.header = bm; avm::BitmapInfo bh(bm); bh.Print(); printf("RecompressFilter: Decompress: 0x%x \"%.4s\" Compressor: 0x%x \"%.4s\" %s\n", info.header.biCompression, (char*)&info.header.biCompression, info.compressor, (char*)&info.compressor, info.cname.c_str()); avm::FreeDecoderVideo(vd); vd = 0; avm::FreeEncoderVideo(ve); ve = avm::CreateEncoderVideo(info); if (!ve) throw FATAL(avm::CodecGetError().c_str()); ve->SetKeyFrame(1); const BITMAPINFOHEADER& obh = ve->GetOutputFormat(); //printf("OPBEH\n"); BitmapInfo(obh).Print(); //vd = CreateVideoDecoder(obh, 24, 1); vd = avm::CreateDecoderVideo(obh); if (!vd) throw FATAL(avm::CodecGetError().c_str()); delete[] comp_frame; comp_frame = new char[obh.biWidth * labs(obh.biHeight) * 4]; vd->Start(); } catch (avm::FatalError& e) { avm::FreeDecoderVideo(vd); avm::FreeEncoderVideo(ve); delete[] comp_frame; vd = 0; ve = 0; comp_frame = 0; e.PrintAll(); throw; } } Debug printf("RecompressFilter::process() start\n"); if(!ve || !vd) { // we tried to start encoding into this format, but failed im->AddRef(); return im; } ve->Start(); int is_keyframe; size_t size = 0; int r = ve->EncodeFrame(im, comp_frame, &is_keyframe, &size); ve->Stop(); fprintf(stderr, "Encoded to %" PRIsz " bytes, error %d\n", size, r); if (r == 0) { avm::BitmapInfo bi(vd->GetDestFmt()); im = new avm::CImage(&bi); //printf("DECOMPRESS\n"); bm.Print(); r = vd->DecodeFrame(im, comp_frame, size, 0, 16); //vd->Stop(); if (r != 0) fprintf(stderr, "Decoded result: %d\n", r); Debug printf("RecompressFilter::process() stop\n"); return im; } im->AddRef(); return im; } QString RecompressFilter::save() { return ""; } void RecompressFilter::load(const QString&) { } //creates filter registered under id RecKernel::RecKernel() :_ctl(0), m_pRecFilter(0), m_pRecCb(0), m_pWriteFile(0), vs(0), as(0), rec_status(0), pause_status(0) { } RecKernel::~RecKernel() { delete m_pRecFilter; _destruct(); } Filter* RecKernel::getFilter(uint_t id) { switch(id) { case 0: return new GammaFilter(this); case 1: return new BlurFilter(this); case 2: return new RefractFilter(this); case 3: return new NoiseFilter(this); case 4: return new MoveFilter(this); case 5: return new ScaleFilter(this); /* case 5: return new SwapFilter(this);*/ default: return 0; } } //returns filter at pos id in current list Filter* RecKernel::getFilterAt(uint_t id) { if (id >= m_FilterList.size()) return 0; Filter* fi = m_FilterList[id]; fi->addref(); return fi; } //size of current list unsigned int RecKernel::getFilterCount() const { return m_FilterList.size(); } //adds filter in the end of list int RecKernel::addFilter(Filter* fi) { m_FilterList.push_back(fi); fi->addref(); redraw(); return 0; } int RecKernel::removeFilter(uint_t id) { if (id >= m_FilterList.size()) { printf("removeFilter: weird id %d\n", id); return -1; } else if (!m_FilterList.size()) return 0; Filter* fi = m_FilterList[id]; swap(id, m_FilterList.size() - 1); m_FilterList.pop_back(); delete fi; redraw(); return 0; } int RecKernel::moveUpFilter(uint_t id) { if (id >= m_FilterList.size() || id == 0) return 0; swap(id, id - 1); return 0; } int RecKernel::moveDownFilter(uint_t id) { if (m_FilterList.size() < 1 || id >= (m_FilterList.size()-1)) return 0; swap(id, id + 1); return 0; } /* * Work with files. */ int RecKernel::openFile(const char* fn) { if (m_ReadFiles.size()) _destruct(); try { avm::IReadFile* rf = avm::CreateReadFile(fn); if (!rf) return -1; m_ReadFiles.push_back(rf); m_ReadFn = fn; int i; vs = as = 0; for(i = 0; i < 16; i++) { avm::IReadStream* s = rf->GetStream(i, avm::IStream::Video); if (!s) break; /** IV32 has serious problems without this line Since we can draw upside-down pictures, who cares. **/ s->SetDirection(true); full_stream fs; fs.stream = s; fs.startpos = 0; fs.endpos = s->GetLength(); fs.mode = Copy; BITMAPINFOHEADER bh; s->GetVideoFormat(&bh, sizeof(bh)); fs.vi.compressor = bh.biCompression; fs.vi.quality = 9500; fs.vi.keyfreq = 15; avm::StreamInfo* info = s->GetStreamInfo(); if (info) { fs.vi.quality = info->GetQuality(); delete info; } m_Streams.push_back(fs); vs++; } for (i = 0; i < 16; i++) { avm::IReadStream* s = rf->GetStream(i, avm::IStream::Audio); if (!s) break; full_stream fs; fs.stream = s; fs.startpos = 0; fs.endpos = s->GetLength(); fs.mode = Copy; WAVEFORMATEX wf; s->GetAudioFormat(&wf, sizeof(wf)); fs.ai.fmt = 1; if (wf.wFormatTag == 0x55) { fs.ai.fmt = 0x55; fs.ai.bitrate = wf.nAvgBytesPerSec; } m_Streams.push_back(fs); as++; } return 0; } catch (avm::FatalError& e) { strLastError = avm::string(e.GetModule()) + avm::string(": ") + e.GetDesc(); return -1; } } int RecKernel::setDestFile(const char* fn) { avm::IWriteFile* wf; try { wf = avm::CreateWriteFile(fn); m_Filename = fn; delete wf; wf = 0; return 0; } catch (avm::FatalError& e) { e.Print(); return -1; } } //first all video streams, then audio avm::string RecKernel::aboutStream(uint_t id) const { if (!isStream(id)) return ""; char s[1024]; avm::IReadStream* stream = m_Streams[id].stream; if (isAudioStream(id)) { WAVEFORMATEX wf; stream->GetAudioFormat(&wf, sizeof(wf)); const char* enc; char dummy[128]; const avm::CodecInfo* ci = avm::CodecInfo::match(wf.wFormatTag, avm::CodecInfo::Audio, 0, avm::CodecInfo::Encode); if (ci) enc = ci->GetName(); else { sprintf(dummy, "ID %d (%x) (unsupported) ", wf.wFormatTag, wf.wFormatTag); enc = dummy; } avm::StreamInfo* info = stream->GetStreamInfo(); if (info) { sprintf(s, "Audio stream #%d. Average rate: %dkbps (%d bytes/s)\n" "Length: %d samples (Sample size %d bytes)\n" "Encoding: %s. ( %.2f seconds )", (int)id - vs, ((wf.nAvgBytesPerSec * 8 + 500) / 1000), wf.nAvgBytesPerSec, info->GetStreamFrames(), wf.nBlockAlign, enc, info->GetLengthTime()); delete info; } return avm::string(s); } if (isVideoStream(id)) { BITMAPINFOHEADER bh; stream->GetVideoFormat(&bh, sizeof(bh)); const avm::CodecInfo* ci = avm::CodecInfo::match(bh.biCompression); avm::string encoding; if (ci) encoding = ci->GetName(); else { char dummy[128]; char ft[4]; sprintf(dummy, "unsupported %X='%.4s'", bh.biCompression, avm_set_le32(ft, bh.biCompression)); encoding = dummy; } avm::StreamInfo* info = stream->GetStreamInfo(); if (info) { sprintf(s, "Video stream #%d. %dx%d %.2f fps.\n" "Length: %d frames ( %.2f seconds ).\nEncoding: %s.", (int)id, bh.biWidth, bh.biHeight, info->GetFps(), info->GetStreamFrames(), info->GetLengthTime(), encoding.c_str()); delete info; } return avm::string(s); } return avm::string(""); } avm::string RecKernel::lastError() const { return strLastError; } bool RecKernel::isVideoStream(uint_t id) const { if (id < m_Streams.size()) return (m_Streams[id].stream->GetType() == avm::IStream::Video); return false; } bool RecKernel::isAudioStream(uint_t id) const { if (id < m_Streams.size()) return (m_Streams[id].stream->GetType() == avm::IStream::Audio); return false; } avm::IStream::StreamType RecKernel::getStreamType(uint_t id) const { if (id < m_Streams.size()) return m_Streams[id].stream->GetType(); return avm::IStream::Other; } int RecKernel::getCompress(uint_t id, avm::VideoEncoderInfo& vi) const { if (!isVideoStream(id)) return -1; vi = m_Streams[id].vi; return m_Streams[id].stream->GetOutputFormat(&vi.header, sizeof(vi.header)); } int RecKernel::getAudioCompress(uint_t id, AudioEncoderInfo& ai) const { if (!isAudioStream(id)) return -1; ai = m_Streams[id-vs].ai; return 0; } int RecKernel::setCompress(uint_t id, const avm::VideoEncoderInfo& vi) { if (!isVideoStream(id)) return -1; m_Streams[id].vi = vi; try { avm::VideoEncoderInfo vinfo; RecompressFilter* nrecf = (getCompress(0, vinfo) < 0) ? 0 : new RecompressFilter(vi); if (nrecf) { delete m_pRecFilter; m_pRecFilter = nrecf; } } catch (avm::FatalError& e) { e.Print(); } redraw(); return 0; } int RecKernel::setAudioCompress(uint_t id, const AudioEncoderInfo& ai) { if (!isAudioStream(id)) return -1; m_Streams[id - vs].ai = ai; return 0; } //nonzero if stream bool RecKernel::isStream(uint_t id) const { return (id < m_Streams.size()); } int RecKernel::setStreamMode(uint_t id, KernelMode mode) { if (!isStream(id)) return -1; m_Streams[id].mode = mode; redraw(); return 0; } int RecKernel::getStreamMode(uint_t id, KernelMode& mode) const { if (!isStream(id)) return -1; mode = m_Streams[id].mode; return 0; } int RecKernel::getSelection(uint_t id, framepos_t& start, framepos_t& end) const { if (!isStream(id)) return -1; start = m_Streams[id].startpos; end = m_Streams[id].endpos; return 0; } int RecKernel::setSelection(uint_t id, framepos_t start, framepos_t end) { if (!isStream(id)) return -1; m_Streams[id].startpos = start; m_Streams[id].endpos = end; return 0; } int RecKernel::setSelectionStart(uint_t id, framepos_t start) { if (!isStream(id)) return -1; m_Streams[id].startpos = start; return 0; } int RecKernel::setSelectionEnd(uint_t id, framepos_t end) { if (!isStream(id)) return -1; m_Streams[id].endpos = end; return 0; } double RecKernel::getFrameTime(uint_t id) const { if (!isStream(id)) return 0; return m_Streams[id].stream->GetFrameTime(); } double RecKernel::getTime(uint_t id) const { if (!isStream(id)) return 0; return m_Streams[id].stream->GetTime(); } //should set size & pictures if ctl!=0 & file is opened void RecKernel::setImageControl(IImageControl* ctl) { if (vs) { try { m_Streams[0].stream->StopStreaming(); m_Streams[0].stream->StartStreaming(); m_Streams[0].stream->Seek((framepos_t) 0); BITMAPINFOHEADER bh; m_Streams[0].stream->GetVideoFormat(&bh, sizeof(bh)); _ctl = ctl; _ctl->setSize(bh.biWidth, bh.biHeight); delete m_pRecFilter; avm::VideoEncoderInfo info; m_pRecFilter = (getCompress(0, info) < 0) ? 0 : new RecompressFilter(info); redraw(true); } catch (avm::FatalError& e) { e.Print(); } } return; } avm::string RecKernel::getStreamName(uint_t id) const { avm::string s; if (isStream(id)) { if (isAudioStream(id)) { s = "Audio"; id -= vs; } else s = "Video"; char q[64]; sprintf(q, " #%d", id); s += q; } return s; } unsigned int RecKernel::getStreamCount() const { return m_Streams.size(); } //in frames //negative seeks are very slow // FIXME: implement frame caching : store frame every second framepos_t RecKernel::seek(int delta) { if (!vs) return 0; avm::IReadStream* stream = m_Streams[0].stream; framepos_t cur_pos = stream->GetPos(); framepos_t endpos = stream->GetLength(); framepos_t newpos = cur_pos + delta; if (delta < 0 && cur_pos < (unsigned) -delta) newpos = 0; if (newpos >= endpos) newpos = endpos; if (newpos == cur_pos) return cur_pos; framepos_t next_kern = stream->GetPrevKeyFrame(newpos); //cout << "pos:" << cur_pos << " prev_keyfr:" << next_kern << " d:" << delta << " newpos:" << newpos << endl; if (delta < 0 || next_kern > cur_pos) stream->Seek(next_kern); framepos_t lpos = ~0U, prevp = ~0U; int i = 5; while (i > 0) // avoid deadlock if can't seek { lpos = stream->GetPos(); //printf("pos: %d newpos: %d %d %d del:%d\n", lpos, newpos, prevp, cur_pos, delta); if ((lpos + 1) >= newpos || lpos == stream->ERR) break; stream->ReadFrame(false); // some error could happen - prevent deadlock loop // we are checking if the position is changing if (prevp == lpos) i--; prevp = lpos; } redraw(true); return lpos; } //seek to nearest keyframe, return its position framepos_t RecKernel::seekPos(framepos_t fpos) { if (!vs) return fpos; if (fpos >= m_Streams[0].stream->GetLength()) fpos = m_Streams[0].stream->GetLength() - 1; framepos_t r = m_Streams[0].stream->SeekToKeyFrame(fpos); redraw(true); return m_Streams[0].stream->GetPos(); /* if(m_Streams.size()==0)return fpos; if(vs==0) { for(int i=0; iSeek(fpos); return fpos; } else { fpos=m_Streams[0].stream->SeekToKeyframe(fpos); for(int i=1; iSeek(fpos); redraw(); return fpos; } */ } framepos_t RecKernel::seekNextKeyFrame() { if (!vs) return 0; avm::IReadStream* stream = m_Streams[0].stream; framepos_t op = pos(); //cout << "POS1 " << pos() << endl; if (stream->SeekToNextKeyFrame() != stream->ERR) redraw(true); return pos(); } framepos_t RecKernel::seekPrevKeyFrame() { if (!vs) return 0; avm::IReadStream* stream = m_Streams[0].stream; framepos_t op = pos(); if (stream->SeekToPrevKeyFrame() != stream->ERR) redraw(true); return pos(); } framepos_t RecKernel::pos() const { return (vs) ? m_Streams[0].stream->GetPos() : 0; } unsigned int RecKernel::getVideoLength() const { if (!vs) return 0; return (unsigned int) m_Streams[0].stream->GetLength(); } /*********************************** Actual recompression ************************************/ int RecKernel::setCallback(IRecompressCallback* pRecCallback) { m_pRecCb = pRecCallback; return 0; } void RecKernel::_destruct() { //cout << "RecKernel::_destruct()" << endl; m_Streams.clear(); while (m_ReadFiles.size()) { delete m_ReadFiles.back(); m_ReadFiles.pop_back(); } delete m_pWriteFile; m_pWriteFile = 0; } void RecKernel::redraw(bool readFrame) { if (!vs || !_ctl) return; avm::CImage* pix = m_Streams[0].stream->GetFrame(readFrame); if (!pix) { ///printf("ERROR: zero frame\n"); return; } _ctl->setSourcePicture(pix); avm::CImage* im = pix; if (m_pRecFilter) { KernelMode m; if (getStreamMode(0, m) == 0) { // show compressed image only when recompress is enabled if (m == RecKernel::Recompress) { im = new avm::CImage(pix); for (unsigned i = 0; i < getFilterCount(); i++) { Filter* fi = getFilterAt(i); avm::CImage* new_im = fi->process(im, m_Streams[0].stream->GetPos()); im->Release(); im = new_im; } im->ToRGB(); try { avm::CImage* new_im = m_pRecFilter->process(im, 0); if (new_im) { im->Release(); im = new_im; } } catch (avm::FatalError& e) { QMessageBox::information(0, "Error", "Cannot recompress into this format"); } } } } //printf("BEFORE SETDEST\n"); im->GetFmt()->Print(); _ctl->setDestPicture(im); im->Release(); if (pix != im) pix->Release(); } int RecKernel::loadConfig(const char* fn) { ReadConfig cfg(fn); // cfg.Add("SrcFile", m_ReadFn); avm::string src = cfg.getString("SrcFile"); printf("src: %s\n", src.c_str()); openFile(src.c_str()); avm::string dest = cfg.getString("DestFile"); setDestFile(dest.c_str()); // cfg.Add("VideoStreams", vs); // cfg.Add("AudioStreams", as); char s[128]; for (unsigned i=0; iGetOutputFormat(&m_VideoFmt[i].header, sizeof m_VideoFmt[i].header); } else { sprintf(s, "Stream %d fmt", i); m_Streams[i - vs].ai.fmt = cfg.getInt(s); sprintf(s, "Stream %d bitrate", i); m_Streams[i - vs].ai.bitrate = cfg.getInt(s); } } int filters = cfg.getInt("Filters"); // cfg.Add("Filters", m_FilterList.size()); for(int i=0; iload(cfg.getString(s)); addFilter(f); } return 0; } int RecKernel::saveConfig(const char* fn) { if (!m_ReadFiles.size()) return 0; WriteConfig cfg(fn); cfg.add("SrcFile", m_ReadFn); cfg.add("DestFile", m_Filename); cfg.add("VideoStreams", (int)vs); cfg.add("AudioStreams", (int)as); char s[128]; for (unsigned i = 0; i < m_Streams.size(); i++) { sprintf(s, "Stream %d start", i); cfg.add(s, (int)m_Streams[i].startpos); sprintf(s, "Stream %d end", i); cfg.add(s, (int)m_Streams[i].endpos); sprintf(s, "Stream %d mode", i); cfg.add(s, (int)m_Streams[i].mode); if(i < vs) { sprintf(s, "Stream %d quality", i); cfg.add(s, m_Streams[i].vi.quality); sprintf(s, "Stream %d keyfreq", i); cfg.add(s, m_Streams[i].vi.keyfreq); sprintf(s, "Stream %d compressor", i); cfg.add(s, (int)m_Streams[i].vi.compressor); sprintf(s, "Stream %d compressor name", i); cfg.add(s, m_Streams[i].vi.cname.c_str()); } else { sprintf(s, "Stream %d fmt", i); cfg.add(s, m_Streams[i-vs].ai.fmt); sprintf(s, "Stream %d bitrate", i); cfg.add(s, m_Streams[i-vs].ai.bitrate); } } cfg.add("Filters", (int)m_FilterList.size()); for (unsigned i = 0; i < m_FilterList.size(); i++) { sprintf(s, "Filter %d", i); cfg.add(s, m_FilterList[i]->id()); sprintf(s, "Filter %d info", i); cfg.add(s, m_FilterList[i]->save().ascii()); } return 0; } avifile-0.7.48~20090503.ds/samples/qtrecompress/recompressor.h0000644000175000017500000001066711165212351023037 0ustar yavoryavor#ifndef RECOMPRESSOR_H #define RECOMPRESSOR_H /******************************************************* GUI-independent section of recompressor *******************************************************/ #include "filters.h" #include "imagecontrol.h" #include "rec_cb.h" #include #include #include #include #include struct AudioEncoderInfo { int fmt; int bitrate; }; class RecompressFilter: public Filter { friend class RecKernel; public: RecompressFilter(const avm::VideoEncoderInfo& in); ~RecompressFilter(); const char* name() const { return "Recompress filter"; } QString fullname() { return name(); } avm::CImage* process(avm::CImage* im, int pos); void about() {} void config() {} QString save(); void load(const QString&); private: avm::VideoEncoderInfo info; char* comp_frame; avm::IVideoDecoder* vd; avm::IVideoEncoder* ve; }; class RecKernel { friend class Filter; public: enum KernelMode { Remove = 0, Copy, Recompress }; RecKernel(); ~RecKernel(); Filter* getFilter(uint_t id); //creates filter registered under id Filter* getFilterAt(uint_t id); //returns filter at pos id in current list unsigned int getFilterCount() const; //size of current list int addFilter(Filter* fi); //adds filter in the end of list int removeFilter(uint_t id); int moveUpFilter(uint_t id); int moveDownFilter(uint_t id); int openFile(const char* fn); const char* getSrcFile() {return m_ReadFn.c_str();} int setDestFile(const char* fn); const char* getDestFile() {return m_Filename.c_str();} avm::string aboutStream(uint_t id) const; //first all video streams, then audio avm::string lastError() const; bool isVideoStream(uint_t id) const; bool isAudioStream(uint_t id) const; avm::IStream::StreamType getStreamType(uint_t id) const; // // int getVideoInfo(int id, VideoEncoderInfo& vi) const; // int getAudioInfo(int id, WAVEFORMATEX& wfmtx) const; // bool isStream(uint_t id) const;//nonzero if stream int setStreamMode(uint_t id, KernelMode mode); int getStreamMode(uint_t id, KernelMode& mode) const; int getSelection(uint_t id, framepos_t& start, framepos_t& end) const; int setSelection(uint_t id, framepos_t start, framepos_t end); int setSelectionStart(uint_t id, framepos_t start); int setSelectionEnd(uint_t id, framepos_t end); double getFrameTime(uint_t id) const; double getTime(uint_t id) const; void setImageControl(IImageControl* ctl);//should set size & pictures if ctl!=0 & file is opened avm::string getStreamName(uint_t id) const; unsigned int getStreamCount() const; framepos_t seek(int delta);//in frames //negative seeks are very slow framepos_t seekPos(framepos_t pos);//seek to nearest keyframe, return its position framepos_t seekNextKeyFrame(); framepos_t seekPrevKeyFrame(); framepos_t pos() const; int setCompress(uint_t id, const avm::VideoEncoderInfo& vi); int setAudioCompress(uint_t id, const AudioEncoderInfo& wf); int getCompress(uint_t id, avm::VideoEncoderInfo& vi) const; int getAudioCompress(uint_t id, AudioEncoderInfo& wf) const; unsigned int getVideoLength() const; int setCallback(IRecompressCallback* pRecCallback); int startRecompress(); int pauseRecompress(); int stopRecompress(); void redraw(bool readFrame = false); int loadConfig(const char*); int saveConfig(const char*); private: static void* recompressThreadStart(void* arg); void* recompressThread(); void _destruct(); void swap(int x, int y) { Filter* t = m_FilterList[x]; m_FilterList[x] = m_FilterList[y]; m_FilterList[y] = t; } avm::string m_Filename; avm::string m_ReadFn; avm::string strLastError; IImageControl* _ctl; RecompressFilter* m_pRecFilter; IRecompressCallback* m_pRecCb; avm::IWriteFile* m_pWriteFile; avm::vector m_ReadFiles; uint_t vs, as; struct full_stream { avm::IReadStream* stream; KernelMode mode; framepos_t startpos; framepos_t endpos; AudioEncoderInfo ai; avm::VideoEncoderInfo vi; int audiosz; }; avm::vector m_Streams; avm::vector m_FilterList; int rec_status; int pause_status; avm::PthreadTask* rec_thread; avm::PthreadMutex m_Mutex; avm::PthreadCond m_Cond; }; #endif // RECOMPRESSOR_H avifile-0.7.48~20090503.ds/samples/qtrecompress/recwnd.cpp0000644000175000017500000001762410747177714022153 0ustar yavoryavor#include "recwnd.h" #include "recwnd.moc" #include "recompressor.h" #include #include #include #include #if QT_VERSION > 220 //#include #endif #include Progress::Progress(unsigned int size) :m_pValues(0), m_pValuesFlags(0), m_uiPos(0), m_uiSize(size), m_bValidMax(false) { } Progress::~Progress() { delete[] m_pValues; delete[] m_pValuesFlags; } void Progress::insert(unsigned int v, int flags) { if (!m_pValues) { m_pValues = new unsigned int[m_uiSize]; m_pValuesFlags = new int[m_uiSize]; memset(m_pValues, 0, sizeof(unsigned int) * m_uiSize); } if (m_pValues[m_uiPos] == m_uiMax) m_bValidMax = false; m_pValues[m_uiPos] = v; m_pValuesFlags[m_uiPos] = flags; m_uiPos = (m_uiPos + 1) % m_uiSize; // cout << "Insert " << v << ", " << flags << " p: " << m_uiPos << endl; } unsigned int Progress::getMax() { if (!m_bValidMax) { m_uiMax = 0; for (unsigned i = 0; i < m_uiSize; i++) if (m_pValues[i] > m_uiMax) m_uiMax = m_pValues[i]; m_bValidMax = true; } return m_uiMax; } /* * Constructs a RecWindow which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ RecWindow::RecWindow( QWidget* parent, RecKernel* kern ) : RecWnd_p( parent, "Record window", true, 0 ), kernel(kern), m_Progress(PROGRESS_SIZE) { progress = 1; elapsed = estimated = 1; fsize = 0; curVideoFrame = 0; curAudioSample = 0; estimated = 0; fsize = 0; videoSize = audioSize = 0; totalAudioSamples = totalVideoFrames = 0; kernel->setCallback(this); if (kernel->startRecompress()) accept(); } /* * Destroys the object and frees any allocated resources */ RecWindow::~RecWindow() { // no need to delete child widgets, Qt does it all for us } /* * public slot */ void RecWindow::cancelProcess() { kernel->stopRecompress(); accept(); } /* * public slot */ void RecWindow::pauseProcess() { if (kernel->pauseRecompress() != 0) m_pPause->setText( tr( "&Resume" ) ); else m_pPause->setText( tr( "&Pause" ) ); } /* * public slot */ void RecWindow::currentChanged(QWidget* w) { #if QT_VERSION >= 300 //cout << "INDEX " << m_pTabWidget->indexOf(w) << endl; #endif } void RecWindow::finished() { //QThread::postEvent(this, new QEvent(QEvent::Type(QEvent::User+1))); qApp->postEvent(this, new QEvent(QEvent::Type(QEvent::User+1))); #if QT_VERSION > 220 qApp->wakeUpGuiThread(); #endif } void RecWindow::setNewState(double progress, double elapsed, int64_t fsize) { this->progress=progress; this->elapsed=elapsed; this->estimated = (progress > 0.0001) ? elapsed / progress : 0.0; this->fsize=fsize; //QThread::postEvent(this, new QEvent(QEvent::User)); qApp->postEvent(this, new QEvent(QEvent::User)); #if QT_VERSION > 220 qApp->wakeUpGuiThread(); #endif //printf("seupdate2\n"); /* if (progress > 0) qApp->sendPostedEvents(); #if QT_VERSION >= 300 qApp->flush(); #else qApp->flushX(); #endif */ } void RecWindow::setTotal(framepos_t vtotal, framepos_t atotal, double vtm, double atm) { //printf("SETTOTAL vt:%d at:%d vtm:%f atm%f\n", vtotal, atotal, vtm, atm); totalVideoFrames = vtotal; totalAudioSamples = atotal; startVideoTime = vtm - 1.0; startAudioTime = vtm - 1.0; } void RecWindow::addVideo(framepos_t vframe, unsigned int vsize, double vtm, bool keyframe) { curVideoFrame = vframe; curVideoTime = vtm; videoSize += vsize; m_Progress.insert(vsize, keyframe); } void RecWindow::addAudio(framepos_t asample, unsigned int asize, double atime) { curAudioSample = asample; audioSize += asize; curAudioTime = atime; } bool RecWindow::event(QEvent* e) { if (e->type()==QEvent::User) { //printf("update1\n"); return update(); } if (e->type()==QEvent::Type(QEvent::User+1)) { m_pPause->hide(); m_pStop->setText( tr( "&Close" ) ); update(); //accept(); #if QT_VERSION > 220 qApp->wakeUpGuiThread(); #endif //return true; } return QWidget::event(e); } static inline char* sprintfTimeString(char* buf, double tm) { sprintf(buf, "%d:%.02d:%.02d", int(tm/3600), int(tm/60)%60, int(tm)%60); return buf; } bool RecWindow::update() { m_pProgress->setProgress(int(progress*1000)); #if QT_VERSION > 220 if (m_pTabWidget->currentPageIndex() == 1) return updateGraphs(); #endif char s[256]; char buf[20]; double proj = fsize / progress; for (int i = 0; i < LAST_LABEL; i++) { switch (i) { case CURRENT_VIDEO_FRAME: sprintf(s, "%d/%d", curVideoFrame, totalVideoFrames); break; case CURRENT_AUDIO_SAMPLE: sprintf(s, "%d/%d", curAudioSample, totalAudioSamples); break; case VIDEO_DATA: sprintf(s, "%d KB (%d kbps)", int(videoSize/1024LL), int(videoSize * 8 / 1000LL/(curVideoTime - startVideoTime))); break; case AUDIO_DATA: //printf("SURA %f SA %f lsize %lld\n", curAudioTime, startAudioTime, audioSize); sprintf(s, "%d KB (%d kbps)", int(audioSize/1024LL), int(audioSize * 8 / 1000LL/(curAudioTime - startAudioTime))); break; case CURRENT_FILE_SIZE: sprintf(s, "%" PRId64, fsize); break; case PROJECTED_FILE_SIZE: if (proj > (10 * 1024 * 1024)) sprintf(s, "%.3f MB", proj/(1024*1024LL)); else sprintf(s, "%d KB", int(proj/1024LL)); break; case VIDEO_RENDERING_RATE: sprintf(s, "%.3f fps", curVideoFrame / elapsed); break; case TIME_ELAPSED: sprintfTimeString(s, elapsed); break; case TOTAL_TIME_ESTIMATED: sprintfTimeString(s, estimated); break; } m_pText[i]->setText(s); } return true; } bool RecWindow::updateGraphs() { // for this moment just some experimental code //cout << "******MAX " << m_Progress.getMax() << endl; char pcElapsed[20]; char pcEstimated[20]; sprintfTimeString(pcElapsed, elapsed); sprintfTimeString(pcEstimated, estimated); printf("%3.2f\%%, elapsed: %s, remaining: %s, " "estimated file size: %d KB\n", progress*100, pcElapsed, pcEstimated, int(fsize/progress/1024LL)); #if 0 char s[1024]; static int call=0; int iHeight; int iWidth; int iMaxFrame=0; int i; call+=10; m_pProgress->lock(); // 2 because we have buffer of 50 frames 2*m_pProgress->buffer_occupancies[(m_pProgress->buffer_head+m_pProgress->history_size-1)%m_pProgress->history_size] ); QPainter* qp = new QPainter(Frame3_2); iHeight=Frame3_2->height(); iWidth=Frame3_2->width(); iMaxFrame= m_pProgress->getMax() if (iMaxFrame<10) iMaxFrame=10; else if (iMaxFrame<100) iMaxFrame=100; else if (iMaxFrame<1000) iMaxFrame=1000; else if (iMaxFrame<10000) iMaxFrame=10000; else if (iMaxFrame<100000) iMaxFrame=100000; else iMaxFrame=1000000; if(iMaxFrame<1000) sprintf(s, tr( "%d bytes" ), iMaxFrame); else if(iMaxFrame<1000000) sprintf(s, tr( "%d KB" ), iMaxFrame/1000); else sprintf(s, tr( "%d MB" ), iMaxFrame/1000000); MaxFrameSizeText->setText(s); for(i=iWidth; i>=0; i--) { int index = i-iWidth; if(index<-m_pProgress->video_frame_len) { qp->setPen(QColor(0,0,0)); qp->moveTo(i, iHeight); qp->lineTo(i, 0); continue; } index += m_pProgress->video_frame_head; while(index<0) index += m_pProgress->history_size; index %= m_pProgress->history_size; float t=(m_pProgress->video_frame_sizes[index] & ~0x40000000)/(float)iMaxFrame; if(t>1)t=1; if(m_pProgress->video_frame_sizes[index] & 0x40000000) qp->setPen(QColor(255, 0, 0)); else qp->setPen(QColor(0, 255, 0)); qp->moveTo(i, iHeight); qp->lineTo(i, iHeight*(1-t)); if(t<1) { qp->setPen(QColor(0, 0, 0)); qp->lineTo(i, 0); } } finish: m_pProgress->unlock(); #endif return true; } avifile-0.7.48~20090503.ds/samples/qtrecompress/recwnd.h0000644000175000017500000000340407664353555021612 0ustar yavoryavor#ifndef RECWINDOW_H #define RECWINDOW_H #include "recwnd_p.h" #include "rec_cb.h" class RecKernel; class Progress { unsigned int* m_pValues; int* m_pValuesFlags; unsigned int m_uiPos; unsigned int m_uiSize; unsigned int m_uiMax; bool m_bValidMax; public: Progress(unsigned int size); ~Progress(); void insert(unsigned int v, int flags); unsigned int getMax(); unsigned int get(int idx) { return m_pValues[idx]; } int getFlags(int idx) { return m_pValuesFlags[idx]; } }; class RecWindow : public RecWnd_p, public IRecompressCallback { Q_OBJECT RecKernel* kernel; double progress, elapsed, estimated; int64_t fsize; static const int PROGRESS_SIZE = 200; Progress m_Progress; framepos_t totalVideoFrames; unsigned int totalAudioSamples; framepos_t curVideoFrame; framepos_t curAudioSample; double startVideoTime; double startAudioTime; double curVideoTime; double curAudioTime; int64_t videoSize; int64_t audioSize; int64_t lasttime; public: RecWindow( QWidget* parent, RecKernel* kern); ~RecWindow(); virtual void setNewState(double progress, double elapsed, int64_t fsize); virtual void setTotal(framepos_t vtotal, framepos_t atotal, double videoTime, double audioTime); virtual void addVideo(framepos_t vframe, unsigned int vsize, double videoTime, bool keyframe); virtual void addAudio(framepos_t asample, unsigned int asize, double atime); virtual void finished(); bool update(); public slots: virtual void cancelProcess(); virtual void pauseProcess(); virtual void currentChanged(QWidget*); protected: bool event(QEvent*); bool updateGraphs(); // bool close(bool){return false;} }; #endif // RECWINDOW_H avifile-0.7.48~20090503.ds/samples/qtrecompress/recwnd_p.cpp0000644000175000017500000000700507664353555022465 0ustar yavoryavor#include "recwnd_p.h" #include "recwnd_p.moc" #include #include #include #include #include #include #include #include #include #include class MainTabWidget: public QWidget { public: MainTabWidget(RecWnd_p& rec, QWidget* parent) : QWidget(parent) { static const char* labels[] = { "Current video frame:", "Current audio sample:", "Video data:", "Audio data:", "Current file size:", "Projected file size:", "Video rendering rate:", "Time elapsed:", "Total time (estimated):" }; QGridLayout* qgbl = new QGridLayout( this, 1, 1 ); qgbl->setMargin(5); qgbl->setSpacing(5); int i = -1; QLabel* l; while (++i < RecWnd_p::LAST_LABEL) { l = new QLabel( this ); l->setText( tr( labels[i] )); qgbl->addWidget( l, i, 0 ); l = rec.m_pText[i] = new QLabel( this ); l->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); l->setLineWidth( 1 ); l->setIndent( 5 ); l->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); l->setMinimumWidth( 180 ); qgbl->addWidget( l, i, 1 ); } } }; /* * Constructs a RecWnd_p which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ RecWnd_p::RecWnd_p( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { setCaption( tr( "Recompression progress" ) ); #if QT_VERSION > 220 setSizeGripEnabled( TRUE ); #endif QVBoxLayout* vbl = new QVBoxLayout( this ); vbl->setMargin(5); vbl->setSpacing(5); m_pTabWidget = new QTabWidget( this ); m_pTabWidget->insertTab(new MainTabWidget(*this, m_pTabWidget), tr( "&Main" ) ); m_pTabWidget->insertTab(new QWidget(m_pTabWidget), tr( "&Video" ) ); vbl->addWidget( m_pTabWidget ); QHBoxLayout* hbl = new QHBoxLayout( vbl ); QLabel* l = new QLabel( this ); l->setText( tr( "Progress:" ) ); hbl->addWidget( l ); m_pProgress = new QProgressBar( this ); m_pProgress->setProgress( -1 ); m_pProgress->setTotalSteps( 1000 ); m_pProgress->setFrameShadow( QProgressBar::Sunken ); m_pProgress->setFrameShape( QProgressBar::StyledPanel ); m_pProgress->setIndicatorFollowsStyle( TRUE ); hbl->addWidget( m_pProgress ); hbl = new QHBoxLayout( vbl ); hbl->addStretch( 1 ); m_pPause = new QPushButton( this ); m_pPause->setText( tr( "&Pause" ) ); hbl->addWidget( m_pPause ); m_pStop = new QPushButton( this ); m_pStop->setText( tr( "&Stop" ) ); hbl->addWidget( m_pStop ); // signals and slots connections connect( m_pPause, SIGNAL( clicked() ), this, SLOT( pauseProcess() ) ); connect( m_pStop, SIGNAL( clicked() ), this, SLOT( cancelProcess() ) ); connect( m_pTabWidget, SIGNAL( currentChanged( QWidget* ) ), this, SLOT( currentChanged( QWidget* ) ) ); } /* * Destroys the object and frees any allocated resources */ RecWnd_p::~RecWnd_p() { // no need to delete child widgets, Qt does it all for us } void RecWnd_p::cancelProcess() { qWarning( "RecWnd_p::cancelProcess(): Not implemented yet!" ); } void RecWnd_p::pauseProcess() { qWarning( "RecWnd_p::pauseProcess(): Not implemented yet!" ); } void RecWnd_p::currentChanged(QWidget* w) { qWarning( "RecWnd_p::currentWidget(): Not implemented yet!" ); } avifile-0.7.48~20090503.ds/samples/qtrecompress/recwnd_p.h0000644000175000017500000000230707334013202022102 0ustar yavoryavor/**************************************************************************** ** Form interface generated from reading ui file './recwnd.ui' ** ** Created: Sun Sep 24 03:34:28 2000 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ #ifndef RECWND_P_H #define RECWND_P_H #include class QVBoxLayout; class QHBoxLayout; class QGridLayout; class QLabel; class QTabWidget; class QProgressBar; class QPushButton; class RecWnd_p : public QDialog { Q_OBJECT public: RecWnd_p( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~RecWnd_p(); enum { CURRENT_VIDEO_FRAME, CURRENT_AUDIO_SAMPLE, VIDEO_DATA, AUDIO_DATA, CURRENT_FILE_SIZE, PROJECTED_FILE_SIZE, VIDEO_RENDERING_RATE, TIME_ELAPSED, TOTAL_TIME_ESTIMATED, LAST_LABEL }; QTabWidget* m_pTabWidget; QPushButton* m_pPause; QPushButton* m_pStop; QProgressBar* m_pProgress; QLabel* m_pText[LAST_LABEL]; public slots: virtual void cancelProcess(); virtual void pauseProcess(); virtual void currentChanged(QWidget*); }; #endif // RECWND_P_H avifile-0.7.48~20090503.ds/samples/qtrecompress/rgn.cpp0000644000175000017500000001436610647455713021454 0ustar yavoryavor#include "rgn.h" #include #include #include #include template T mymin(const T x, const T y) {return (xWidth(), im->Height(), 8)) { if(im->GetFmt()->IsRGB()) { fprintf(stderr, "Edge detection with non-YUV image\n"); return; } if (zz == 0) zz = 1; if (edge== 0) edge = 1; const int avs = ((1<Blur(edge); for (i = 0; i < upl; i++) res[i]=((avm::yuv*)src->Data())[i].Y; Maximize(res, Width(), Height(), zz); memset(data, 0, upl); // for(i=0; idata())[i].Y); upl -= (Width() * avs + avs); int dist = avs * (Width() + 1); for (i = avs + Width() * avs; i < upl; i++) { max = res[i-dist]; int val = max - ((avm::yuv*)src->Data())[i].Y; data[i] = (val < (_qual-256)) ? 255 : 128 - mymin((val-_qual + 256) * 2, 128); } delete src; delete res; } void CEdgeRgn::Normalize() { for (unsigned char* ch = Data() + Pixels() - 1; ch >= Data(); ch--) *ch = (*ch > 128) ? 0 : 255; } void CEdgeRgn::Blur(int depth, int src) { #ifdef ARCH_X86_32 const int limit = Pixels(); unsigned lim = 1 << depth; unsigned ach = 1 << src; unsigned char* p = Data(); while (ach < lim) { __asm__ __volatile__ ( "pushl %%eax\n\t" "pushl %%ebx\n\t" "pushl %%ecx\n\t" "pushl %%edx\n\t" "pushl %%edi\n\t" "movl %0, %%ebx\n\t" "mov %0, %%ecx\n\t" "add %1, %%ecx\n\t" "mov %0, %%ebx\n\t" "mov %1, %%ecx\n\t" "mov %0, %%edx\n\t" "add %2, %%edx\n\t" "sub %1, %%edx\n\t" "movl %%edx, %%edi\n\t" // %%ebx = p // %%ecx = ach // %%edi = p + limit - ach "xor %%eax, %%eax\n\t" "xor %%edx, %%edx\n\t" "0:\n\t" "movb (%%ebx), %%al\n\t" "movb (%%ebx, %%ecx), %%dl\n\t" "addw %%dx, %%ax\n\t" "shr $1, %%eax\n\t" "movb %%al, (%%ebx)\n\t" "incl %%ebx\n\t" "cmpl %%edi, %%ebx\n\t" "jb 0b\n\t" "popl %%edi\n\t" "popl %%edx\n\t" "popl %%ecx\n\t" "popl %%ebx\n\t" "popl %%eax\n\t" : :"r"(p), "r"(ach), "r"(limit) ); ach *= Width(); __asm__ __volatile__ ( "pushl %%eax\n\t" "pushl %%ebx\n\t" "pushl %%ecx\n\t" "pushl %%edx\n\t" "pushl %%edi\n\t" "movl %0, %%ebx\n\t" "mov %0, %%ecx\n\t" "add %1, %%ecx\n\t" "mov %0, %%ebx\n\t" "mov %1, %%ecx\n\t" "mov %0, %%edx\n\t" "add %2, %%edx\n\t" "sub %1, %%edx\n\t" "movl %%edx, %%edi\n\t" // %%ebx = p // %%ecx = ach // %%edi = p + limit - ach "xor %%eax, %%eax\n\t" "xor %%edx, %%edx\n\t" "1:\n\t" "movb (%%ebx), %%al\n\t" "movb (%%ebx, %%ecx), %%dl\n\t" "addw %%dx, %%ax\n\t" "shr $1, %%eax\n\t" "movb %%al, (%%ebx)\n\t" "incl %%ebx\n\t" "cmpl %%edi, %%ebx\n\t" "jb 1b\n\t" "popl %%edi\n\t" "popl %%edx\n\t" "popl %%ecx\n\t" "popl %%ebx\n\t" "popl %%eax\n\t" : :"r"(p), "r"(ach), "r"(limit) ); ach /= Width(); ach*=2; } #else #warning Blur x86 version only - FIXME #endif } avifile-0.7.48~20090503.ds/samples/qtrecompress/rgn.h0000644000175000017500000000055410166030224021071 0ustar yavoryavor#ifndef IMAGE_H #define IMAGE_H #include class CEdgeRgn: public avm::CImage { public: CEdgeRgn(avm::CImage* im, int _qual, int _edge, bool flag, int mxm); CEdgeRgn(CEdgeRgn* im) :avm::CImage(im) {} static void Maximize(unsigned char* data, int xd, int yd, int depth=3); void Normalize(); void Blur(int depth, int src=0); }; #endif avifile-0.7.48~20090503.ds/samples/qtrecompress/srcctl.cpp0000644000175000017500000000451307664353555022157 0ustar yavoryavor#include "srcctl.h" #include "srcctl.moc" #include #include #include /* * Constructs a SourceControl which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ SourceControl::SourceControl( QWidget* parent, RecKernel* kern ) : SourceControlDialog( parent, "Source control", false, 0 ), m_pKernel(kern), scale(1), btn_press(0) { updateSize(); //Slider1->setTracking(false); m_pSlider->setTracking( true ); } /* * Destroys the object and frees any allocated resources */ SourceControl::~SourceControl() { // no need to delete child widgets, Qt does it all for us } void SourceControl::prevFrame() { m_pKernel->seek(-1); updateLabel(); } void SourceControl::prevFiveFrames() { m_pKernel->seek(-5); updateLabel(); } void SourceControl::prevTwentyFrames() { m_pKernel->seek(-20); updateLabel(); } void SourceControl::prevKeyFrame() { m_pKernel->seekPrevKeyFrame(); updateLabel(); } void SourceControl::nextFrame() { m_pKernel->seek(1); updateLabel(); } void SourceControl::nextFiveFrames() { m_pKernel->seek(5); updateLabel(); } void SourceControl::nextTwentyFrames() { m_pKernel->seek(20); updateLabel(); } void SourceControl::nextKeyFrame() { m_pKernel->seekNextKeyFrame(); updateLabel(); } void SourceControl::valueChanged() { framepos_t pos = m_pSlider->value() * scale; framepos_t c = m_pKernel->pos(); //cout << "poschane " << c << " " << pos << endl; //if (!btn_press) if (pos != c) { pos = m_pKernel->seekPos(pos); } updateLabel(); } void SourceControl::sliderMoved( int value ) { valueChanged(); } void SourceControl::sliderReleased( int value ) { } void SourceControl::updateLabel() { char s[256]; double t = m_pKernel->getTime((uint_t)0); int sti = int(t); //m_pSlider-> sprintf(s, "frame %6d %.2d:%.2d:%.2d.%.3d", m_pKernel->pos(), sti/3600, (sti/60) % 60, sti % 60, int((t - sti) * 1000)); m_pLabel->setText( s ); } void SourceControl::updateSize() { int len = m_pKernel->getVideoLength(); scale = len / 500 + 1; m_pSlider->setRange( 0, len / scale ); m_pSlider->setValue( 0 ); updateLabel(); } avifile-0.7.48~20090503.ds/samples/qtrecompress/srcctl.h0000644000175000017500000000163607664353555021627 0ustar yavoryavor#ifndef SOURCECONTROLWND_H #define SOURCECONTROLWND_H #include "srcctl_p.h" #include "recompressor.h" class SourceControl : public SourceControlDialog { Q_OBJECT; public: SourceControl( QWidget* parent, RecKernel* kern ); // SourceControlWnd( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~SourceControl(); void updateSize(); public slots: virtual void prevFrame(); virtual void prevFiveFrames(); virtual void prevTwentyFrames(); virtual void prevKeyFrame(); virtual void nextFrame(); virtual void nextFiveFrames(); virtual void nextTwentyFrames(); virtual void nextKeyFrame(); void valueChanged(); void sliderMoved( int ); void sliderReleased( int ); protected: bool close( bool ) { return false; } void updateLabel(); RecKernel* m_pKernel; int scale; int btn_press; }; #endif // SOURCECONTROLWND_H avifile-0.7.48~20090503.ds/samples/qtrecompress/srcctl_p.cpp0000644000175000017500000000670707664353555022505 0ustar yavoryavor#include "srcctl_p.h" #include "srcctl_p.moc" #include #include #include #include #include #include #include /* * Constructs a SourceControl which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ SourceControlDialog::SourceControlDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "SourceControl" ); setCaption( tr( "Source control" ) ); QGridLayout* gl = new QGridLayout( this, 1, 1 ); gl->setSpacing( 5 ); gl->setMargin( 5 ); m_pSlider = new QSlider( this ); m_pSlider->setOrientation( QSlider::Horizontal ); m_pSlider->setTickmarks( QSlider::Right); gl->addMultiCellWidget( m_pSlider, 0, 0, 0, 9 ); m_pButtonPF = new QToolButton( this ); m_pButtonPF->setAutoRepeat( TRUE ); m_pButtonPF->setText( tr( "<" ) ); gl->addWidget( m_pButtonPF, 1, 0 ); m_pButtonNF = new QToolButton( this ); m_pButtonNF->setAutoRepeat( TRUE ); m_pButtonNF->setText( tr( ">" ) ); gl->addWidget( m_pButtonNF, 1, 1 ); m_pButtonPFF = new QToolButton( this ); m_pButtonPFF->setText( tr( "<<" ) ); gl->addWidget( m_pButtonPFF, 1, 2 ); m_pButtonNFF = new QToolButton( this ); m_pButtonNFF->setAutoRepeat( TRUE ); m_pButtonNFF->setText( tr( ">>" ) ); gl->addWidget( m_pButtonNFF, 1, 3 ); m_pButtonPTF = new QToolButton( this ); m_pButtonPTF->setText( tr( "<<<" ) ); gl->addWidget( m_pButtonPTF, 1, 4 ); m_pButtonNTF = new QToolButton( this ); m_pButtonNTF->setAutoRepeat( TRUE ); m_pButtonNTF->setText( tr( ">>>" ) ); gl->addWidget( m_pButtonNTF, 1, 5 ); m_pButtonPKF = new QToolButton( this ); m_pButtonPKF->setAutoRepeat( TRUE ); m_pButtonPKF->setText( tr( "KF<" ) ); gl->addWidget( m_pButtonPKF, 1, 6 ); m_pButtonNKF = new QToolButton( this ); m_pButtonNKF->setAutoRepeat( TRUE ); m_pButtonNKF->setText( tr( ">KF" ) ); gl->addWidget( m_pButtonNKF, 1, 7 ); gl->setColStretch(8, 1); m_pLabel = new QLabel( this ); gl->addWidget( m_pLabel, 1, 9 ); //gl->setRowStretch(2, 1); // signals and slots connections connect( m_pSlider, SIGNAL( sliderMoved( int ) ), this, SLOT( sliderMoved( int ) ) ); #if QT_VERSION > 220 // connect( m_pSlider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); // connect( m_pSlider, SIGNAL( valueChanged( int ) ), this, SLOT( valueChanged( int ) ) ); #endif connect( m_pButtonPF, SIGNAL( clicked() ), this, SLOT( prevFrame() ) ); connect( m_pButtonPFF, SIGNAL( clicked() ), this, SLOT( prevFiveFrames() ) ); connect( m_pButtonPTF, SIGNAL( clicked() ), this, SLOT( prevTwentyFrames() ) ); connect( m_pButtonPKF, SIGNAL( clicked() ), this, SLOT( prevKeyFrame() ) ); connect( m_pButtonNF, SIGNAL( clicked() ), this, SLOT( nextFrame() ) ); connect( m_pButtonNFF, SIGNAL( clicked() ), this, SLOT( nextFiveFrames() ) ); connect( m_pButtonNTF, SIGNAL( clicked() ), this, SLOT( nextTwentyFrames() ) ); connect( m_pButtonNKF, SIGNAL( clicked() ), this, SLOT( nextKeyFrame() ) ); } /* * Destroys the object and frees any allocated resources */ SourceControlDialog::~SourceControlDialog() { // no need to delete child widgets, Qt does it all for us } avifile-0.7.48~20090503.ds/samples/qtrecompress/srcctl_p.h0000644000175000017500000000207507664353555022144 0ustar yavoryavor#ifndef SOURCECONTROL_H #define SOURCECONTROL_H #include class QLabel; class QSlider; class QToolButton; class SourceControlDialog : public QDialog { Q_OBJECT; public: QSlider* m_pSlider; QLabel* m_pLabel; QToolButton* m_pButtonPF; QToolButton* m_pButtonPFF; QToolButton* m_pButtonPTF; QToolButton* m_pButtonPKF; QToolButton* m_pButtonNF; QToolButton* m_pButtonNFF; QToolButton* m_pButtonNTF; QToolButton* m_pButtonNKF; SourceControlDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~SourceControlDialog(); public slots: virtual void prevFrame() = 0; virtual void prevFiveFrames() = 0; virtual void prevTwentyFrames() = 0; virtual void prevKeyFrame() = 0; virtual void nextFrame() = 0; virtual void nextFiveFrames() = 0; virtual void nextTwentyFrames() = 0; virtual void nextKeyFrame() = 0; virtual void valueChanged() = 0; virtual void sliderReleased(int) = 0; virtual void sliderMoved(int) = 0; }; #endif // SOURCECONTROL_H avifile-0.7.48~20090503.ds/samples/qtrecompress/thread.cpp0000644000175000017500000002574411171070742022123 0ustar yavoryavor#include "recompressor.h" #include "filters.h" #include #include #include #include #include #include #include #include // abs void* RecKernel::recompressThreadStart(void* arg) { return ((RecKernel*) arg)->recompressThread(); } void* RecKernel::recompressThread() { try { m_Mutex.Lock(); m_Cond.Broadcast(); m_Mutex.Unlock(); avm::IWriteFile* wf = avm::CreateWriteFile(m_Filename.c_str()); avm::IWriteStream* a_rws = 0; //audio raw write stream avm::IWriteStream* v_rws = 0; //video raw write stream avm::IAudioWriteStream* aws = 0; avm::IVideoWriteStream* vws = 0; avm::IReadStream* ars = 0; avm::IReadStream* vrs = 0; /* append - next stream add next audio channel */ if (as && m_Streams[as].mode != Remove) { ars = m_Streams[as].stream; if (m_Streams[as].mode == Recompress) { ars->StopStreaming(); ars->StartStreaming(); //printf("NONREMOVE %d %d\n", as, m_Streams[as].startpos); } ars->Seek(m_Streams[as].startpos); } if (vs && m_Streams[0].mode != Remove) { vrs = m_Streams[0].stream; vrs->Seek(m_Streams[0].startpos); } if (!vrs && !ars) return 0; // nothing to do if (vrs && m_Streams[0].mode == Recompress) { vrs->StopStreaming(); vrs->StartStreaming(); vrs->Seek(vrs->GetPrevKeyFrame(m_Streams[0].startpos)); while (vrs->GetPos()Eof()) vrs->ReadFrame(); } BITMAPINFOHEADER bh; unsigned int videoFrames = 0; double videoStartTime = 0.0; if (vrs) { videoFrames = vrs->GetLength(); videoStartTime = vrs->GetTime(); unsigned int sz; switch (m_Streams[0].mode) { case Recompress: vrs->GetOutputFormat(&bh, sizeof(bh)); try { avm::VideoEncoderInfo vi = m_Streams[0].vi; for (unsigned i = 0; i < getFilterCount(); i++) { Filter* fi = getFilterAt(i); fi->adjust(bh); } vi.header = bh; printf("Compresor start fourcc: %.4s\n",(char*)& vi.compressor); vws = wf->AddVideoStream(&vi, (unsigned int) (1000000.*vrs->GetFrameTime())); if (vws) vws->Start(); } catch (avm::FatalError& e) { e.Print(); vws = 0; } break; case Copy: sz = vrs->GetVideoFormat(); if (sz > 0) { char* f = new char[sz]; vrs->GetVideoFormat(f, sz); v_rws = wf->AddStream(avm::IStream::Video, f, sz, ((BITMAPINFOHEADER*)f)->biCompression, (unsigned int) (1000000.*vrs->GetFrameTime())); memcpy(&bh, f, sizeof(bh)); delete[] f; } break; case Remove: break; } } WAVEFORMATEX wfmtx; char* ext = 0; unsigned int audioSamples = 0; double audioStartTime = 0.0; memset(&wfmtx, 0, sizeof(wfmtx)); uint_t avsz; if (ars) { audioSamples = ars->GetLength(); audioStartTime = ars->GetTime(); switch(m_Streams[as].mode) { case Recompress: ars->GetOutputFormat(&wfmtx, sizeof(wfmtx)); aws = wf->AddAudioStream(m_Streams[as].ai.fmt, &wfmtx, m_Streams[as].ai.bitrate); if (aws) aws->Start(); //a_rws=wf->AddStream(AviStream::Audio, (char*)&wfmtx, 18, wfmtx.wFormatTag, // wfmtx.nAvgBytesPerSec, wfmtx.nBlockAlign); break; case Copy: avsz = ars->GetAudioFormat(); ext = new char[avsz]; ars->GetAudioFormat(ext, avsz); memcpy(&wfmtx, ext, sizeof(wfmtx)); if (wfmtx.nBlockAlign < 1) wfmtx.nBlockAlign = 1; a_rws = wf->AddStream(avm::IStream::Audio, ext, 18 + wfmtx.cbSize, wfmtx.wFormatTag, wfmtx.nAvgBytesPerSec, wfmtx.nBlockAlign); printf("COPY audio stream %p %d\n", a_rws, wfmtx.nBlockAlign); delete[] ext; break; case Remove: printf("COPY remove stream\n"); break; } } int comp_frame_size = bh.biWidth * labs(bh.biHeight) * 4; uint8_t* comp_frame=0; if (m_Streams[0].mode != Remove) comp_frame = new uint8_t[comp_frame_size]; double bpf = 0; uint_t zzsize = 44100; if(vrs) { if(aws) bpf=vrs->GetFrameTime()*(wfmtx.nSamplesPerSec*wfmtx.nChannels*wfmtx.wBitsPerSample)/8; else bpf=vrs->GetFrameTime()*wfmtx.nAvgBytesPerSec; zzsize = (uint_t)((1.0/vrs->GetFrameTime()) / 2 * bpf); } char* zz = new char[zzsize * 2]; //printf("VWS %p %d %d\n", vws, m_Streams[0].endpos, m_Streams[0].startpos); m_pRecCb->setTotal(m_Streams[0].endpos - m_Streams[0].startpos, audioSamples, videoStartTime, audioStartTime); int64_t time_start = avm_get_time_us(); int64_t last_progress = 0; int64_t time_current = 0; framepos_t written_frames = 0; size_t written_audio = 0; bool nodata = false; while (!nodata && rec_status) { if (pause_status) { int64_t ts = avm_get_time_us(); avm_usleep(100000); time_start += (avm_get_time_us() - ts); continue; } nodata = true; for (unsigned i = as; i < m_Streams.size(); i++) { avm::IReadStream* ars = m_Streams[i].stream; if (!ars || ars->Eof() || ars->GetPos() >= m_Streams[as].endpos) continue; nodata = false; /* if (vrs && (vrs->Eof() || vrs->GetPos() >= m_Streams[0].endpos)) { vrs = 0; continue; } */ size_t samples_read, bytes_read; size_t awritten = 0; if (aws) { awritten = aws->GetLength(); int64_t excess = (int64_t) (bpf * (written_frames + 1) - written_audio); //printf("ExcessA %lld, written audio %d, written frames %d, bpf %f\n", excess, written_audio, written_frames, bpf); if (vrs) { while ((excess>0) && (!ars->Eof())) { ars->ReadFrames(zz, (excess>zzsize) ? excess : zzsize, zzsize, samples_read, bytes_read); written_audio+=bytes_read; excess-=bytes_read; aws->AddData(zz, bytes_read); } } else { ars->ReadFrames(zz, zzsize, zzsize, samples_read, bytes_read); written_audio+=bytes_read; aws->AddData(zz, bytes_read); } awritten = aws->GetLength() - awritten; } else if (a_rws) { // preload 1 frames int64_t excess = (int64_t) (bpf*(written_frames + 1) - written_audio); //printf("ExcessB %lld, written audio %d, written frames %d, bpf %f\n", excess, written_audio, written_frames, bpf); size_t wa = 0; if (excess > 0) { awritten = a_rws->GetLength(); if (vrs) { int flags=0; while (wa < zzsize && !ars->Eof()) { ars->ReadDirect(zz + wa, zzsize - wa, zzsize - wa, samples_read, bytes_read, &flags); written_audio += bytes_read; wa += bytes_read; } a_rws->AddChunk(zz, wa, flags); //printf("ADDCHUNK %d exc %d\n", wa, excess); } else { // excess=m_Streams[vs].endpos-ars->GetTime(); // if(excess>sizeof zz)excess=sizeof zz; if (m_Streams[as].endpos <= ars->GetPos()) excess=0; else excess=zzsize; if (excess < wfmtx.nBlockAlign) { ars = 0; continue; } if (excess < wfmtx.nBlockAlign) { ars = 0; continue; } int flags=0; ars->ReadDirect(zz, excess, (excess/wfmtx.nBlockAlign)*wfmtx.nBlockAlign, samples_read, bytes_read, &flags); written_audio += bytes_read; excess -= bytes_read; a_rws->AddChunk(zz, bytes_read, flags); } awritten = a_rws->GetLength() - awritten; //printf("AWRITTEN %d\n", awritten); } } m_pRecCb->addAudio(ars->GetPos(), awritten, ars->GetTime()); } if (vrs) { size_t vsize; int iskeyframe; bool show_progress = false; time_current = avm_get_time_us(); if (avm_get_time_diff(time_current, last_progress) > 1.0) { last_progress = time_current; show_progress = true; } if (vws) { vrs->ReadFrame(); avm::CImage* ptr = vrs->GetFrame(); if (!ptr) { printf("WARNING: zero frame\n"); vws->AddFrame(0); } else { avm::CImage* im = new avm::CImage(ptr); for (unsigned i = 0; i < getFilterCount(); i++) { Filter* fi = getFilterAt(i); avm::CImage* new_im = fi->process(im, vrs->GetPos()); im->Release(); im = new_im; } im->ToRGB(); char *b; vws->AddFrame(im, &vsize, &iskeyframe, &b); if (show_progress && !iskeyframe) { show_progress = false; last_progress = 0; } if (_ctl && show_progress) { _ctl->setSourcePicture(ptr); avm::CImage* new_im = new avm::CImage(im); if (new_im) { if (m_pRecFilter && m_pRecFilter->vd) m_pRecFilter->vd->DecodeFrame(new_im, b, vsize, 0, iskeyframe); _ctl->setDestPicture(new_im); new_im->Release(); } } im->Release(); ptr->Release(); } } else { size_t samples_read; vrs->ReadDirect(comp_frame, comp_frame_size, 1, samples_read, vsize, &iskeyframe); //printf("SAMP %d %d %d\n", vrs->GetPos(), samples_read, iskeyframe); if (!samples_read) { printf("ERROR: Failed to read video frame\n"); vrs = 0; continue; } else if (v_rws) v_rws->AddChunk(comp_frame, vsize, iskeyframe); } written_frames++; m_pRecCb->addVideo(written_frames, vsize, vrs->GetTime(), iskeyframe); if (show_progress) { framepos_t mint = vrs->GetLength(); if (mint > m_Streams[0].endpos) mint = m_Streams[0].endpos; double percent=(vrs->GetPos()-m_Streams[0].startpos)/double(mint - m_Streams[0].startpos); m_pRecCb->setNewState(percent, avm_get_time_diff(time_current, time_start), wf->GetFileSize()); } } if (!vrs) { time_current = avm_get_time_us(); if (avm_get_time_diff(time_current, last_progress) > 1.0) { last_progress = time_current; framepos_t mint = ars->GetLength(); if (mint > m_Streams[as].endpos) mint = m_Streams[as].endpos; double percent=(ars->GetPos()-m_Streams[as].startpos)/double(mint - m_Streams[as].startpos); m_pRecCb->setNewState(percent, avm_get_time_diff(time_current, time_start), wf->GetFileSize()); } } } m_pRecCb->setNewState(1.0, avm_get_time_diff(time_current, time_start), wf->GetFileSize()); m_pRecCb->finished(); delete[] zz; delete wf; return 0; } catch (avm::FatalError& e) { e.PrintAll(); return 0; } } int RecKernel::startRecompress() { m_Mutex.Lock(); rec_status=1; pause_status=0; rec_thread = new avm::PthreadTask(0, recompressThreadStart, this); /* waiting for recompress thread startup */ m_Cond.Wait(m_Mutex); m_Mutex.Unlock(); return 0; } int RecKernel::pauseRecompress() { pause_status = !pause_status; return pause_status; } int RecKernel::stopRecompress() { rec_status = 0; delete rec_thread; return 0; } avifile-0.7.48~20090503.ds/samples/qtvidcap/0000755000175000017500000000000011267646347017240 5ustar yavoryavoravifile-0.7.48~20090503.ds/samples/qtvidcap/scripts/0000755000175000017500000000000011267637447020730 5ustar yavoryavoravifile-0.7.48~20090503.ds/samples/qtvidcap/scripts/avicap-boot0000755000175000017500000000572307643144776023072 0ustar yavoryavor#!/bin/bash # edit these to match your system USERNAME=alex LOGFILE=/var/log/avicap-boot.log AVICAP_DIR=/etc/avicap # runlevel startup routine taken from Suse's startup scripts . /etc/rc.status rc_reset echo "avicap-boot: started in runlevel : " ${RUNLEVEL} check_avicap() { if [ "$RUNLEVEL" == "" ] ; then RUNLEVEL=3 fi echo "avicap-boot: checking for start or power-off" mkdir -p $AVICAP_DIR if test ${RUNLEVEL} == S ; then # shutdown again in runlevel S/boot time - no need to boot further if test -e $AVICAP_DIR/first_shutdown ; then echo "avicp-boot: this system was booted to halt" echo "avicap-boot: shutdown system" echo "avicap-boot: mounting / rw, removing $AVICAP_DIR/first_shutdown" mount -o remount,rw / sleep 2s rm -f $AVICAP_DIR/first_shutdown sync sleep 2s mount -o remount,ro / echo "avicap-boot: shutdown to soft-off" for i in 10 9 8 7 6 5 4 3 2 1 0 ; do echo "countdown $i for avicap-boot to power-off system" sleep 1s done sync echo "avicap-boot: umounting filesystems" sleep 1s umount /proc sleep 1s umount / echo "avicap-boot: now doing actual poweroff.." sleep 1s halt -p -f echo "avicap-boot: you should never see me, power-off failed" fi elif test ${RUNLEVEL} -eq 3 ; then # || test ${RUNLEVEL} == "" ; then # check if we've to start avicap if test -e $AVICAP_DIR/next_recording ; then echo "avicap-boot will startup X and avicap -timer" echo "==============================" >>$LOGFILE ( date ; echo "avicap-boot: starting X/avicap" ) >>$LOGFILE ( for i in 10 9 8 7 6 5 4 3 2 1 0 ; do echo "avicap-boot: countdown $i for Avicap start" sleep 1s done ( date ; echo "avicap-boot: startx" ) >>$LOGFILE ( su -l $USERNAME -c "startx" ) 2>&1 >>$LOGFILE & sleep 1m ( date ; echo "avicap-boot: kv4lsetup" ) >>$LOGFILE export DISPLAY=:0.0 chmod u+s /usr/local/bin/kv4lsetup /usr/local/bin/kv4lsetup -t=2 2>>$LOGFILE 3>>$LOGFILE 4>>$LOGFILE >>$LOGFILE sync sleep 10s ( date ; echo "avicap-boot: avicap -timer" ) >>$LOGFILE ( su -l $USERNAME -c "DISPLAY=:0.0 avicap -timer 2>&1 >>$LOGFILE" ) 2>&1 >>$LOGFILE & sleep 5s rm -f $AVICAP_DIR/next_recording sleep 20s ( date ; echo "avicap-boot: avicap-renicer" ) >>$LOGFILE /home/alex/sbin/avicap-renicer 2>&1 >>$LOGFILE unset DISPLAY ( date ; echo "avicap-boot: done" ) >>$LOGFILE echo "---------------------------" >>$LOGFILE ) & else echo "avicap-boot: normal booting, no pending recordings" fi fi } case "$1" in start) echo "avicap-boot: starting..." check_avicap rc_status -v ;; stop) echo -n "Nothing to stop for Avicap" rc_status -v ;; restart) ## If first returns OK call the second, if first or ## second command fails, set echo return value. $0 stop $0 start # Remember status and be quiet rc_status ;; status) echo -n "No status for Avicap" rc_status -v ;; *) echo "Usage: $0 {start|stop|status|restart|reload|force-reload}" exit 1 ;; esac rc_exit avifile-0.7.48~20090503.ds/samples/qtvidcap/scripts/avicap-setnvram0000755000175000017500000000071507642072350023745 0ustar yavoryavor#!/bin/bash DATESTR=$1 AVICAP_DIR=/etc/avicap echo "avicap-setnvram: timestamp=$DATESTR" mkdir -p $AVICAP_DIR # edit this to suit your configuration! /usr/local/bin/nvram-wakeup -C /etc/nvram-wakeup-k7m.config -s $DATESTR if test $DATESTR == 0 ; then echo "avicap-setnvram: Wakeup per RTC alarm has been disabled" rm -f $AVICAP_DIR/next_recording else echo "avicap-setnvram: Wakeup per RTC alarm enabled" echo $DATESTR >$AVICAP_DIR/next_recording fi avifile-0.7.48~20090503.ds/samples/qtvidcap/scripts/avicap-shutdown0000755000175000017500000000033607642072350023760 0ustar yavoryavor#!/bin/bash AVICAP_DIR=/etc/avicap echo $UID $EUID echo "the system will be going to reboot NOW" sleep 5s mkdir -p $AVICAP_DIR touch $AVICAP_DIR/first_shutdown /sbin/shutdown -t 10 -r now "Avicap shuts down system" avifile-0.7.48~20090503.ds/samples/qtvidcap/Makefile.am0000644000175000017500000000466111110536760021263 0ustar yavoryavorLIBRARY = ../../lib/libaviplay.la pkgdatadir= $(datadir)/$(PACKAGE)/i18 pkgdata_DATA =\ avicap_de.qm pkgscriptdir = $(datadir)/$(PACKAGE)/scripts pkgscript_DATA =\ scripts/avicap-shutdown\ scripts/avicap-setnvram\ scripts/avicap-boot EXTRA_DIST = $(pkgdata_DATA) $(pkgscript_DATA) if AMM_USE_V4L bin_PROGRAMS = kv4lsetup avirec if AMM_USE_QT bin_PROGRAMS += avicap endif else bin_PROGRAMS = endif noinst_HEADERS =\ avicapwnd.h\ avicapwnd_p.h\ capproc.h\ ccap.h\ dsp.h\ picprop.h\ picprop_p.h\ qtrenderer.h\ qt_visual.h\ v4lwindow.h\ v4lxif.h\ vidconf.h\ vidconf_p.h\ wintv.h\ deinterlace-yuv.h\ timertable.h\ epgwindow.h\ fullscreen_renderer.h\ frequencies.h # epgbrowser_SOURCES = epgbrowser.cpp epgwindow.cpp # epgbrowser_LDADD = $(QT_LIBS) avicap_SOURCES =\ avicapwnd.cpp\ avicapwnd_p.cpp\ capproc.cpp\ ccap.cpp\ dsp.cpp\ main.cpp\ picprop.cpp\ picprop_p.cpp\ qtrenderer.cpp\ qt_visual.c\ v4lwindow.cpp\ v4lxif.cpp\ vidconf.cpp\ vidconf_p.cpp\ deinterlace-rgb.cpp\ deinterlace-yuv.c\ timertable.cpp\ epgwindow.cpp\ fullscreen_renderer.cpp\ frequencies.c avicap_LDADD =\ ../../libavqt/libqavm.la\ $(QT_LIBS) $(LIBRARY) avirec_SOURCES =\ deinterlace-rgb.cpp\ deinterlace-yuv.c\ deinterlace-yuv.h\ capproc.cpp\ capproc.h\ ccap.cpp\ ccap.h\ dsp.cpp\ dsp.h\ avirec.cpp\ v4lxif.cpp\ v4lxif.h\ wintv.h\ qt_visual.c avirec_LDADD = $(LIBRARY) kv4lsetup_SOURCES = kv4lsetup.cpp kv4lsetup_LDADD = $(LIBRARY) #install-exec-local: # @INSTALL@ -m4755 ./kv4lsetup $(DESTDIR)@bindir@ AM_CPPFLAGS =\ $(QT_CFLAGS) $(X_CFLAGS)\ -I$(top_srcdir)/libavqt\ -DI18N_PATH=\"$(pkgdatadir)\" #SUFFIXES = .moc .ui #%.moc: %.h # $(MOC) < $< > $@ .h.moc: $(MOC) < $< > $@ $(srcdir)/avicapwnd.cpp: avicapwnd.moc $(srcdir)/picprop.cpp: picprop.moc $(srcdir)/v4lwindow.cpp: v4lwindow.moc $(srcdir)/vidconf_p.cpp: vidconf_p.moc $(srcdir)/avicapwnd_p.cpp: avicapwnd_p.moc $(srcdir)/picprop_p.cpp: picprop_p.moc $(srcdir)/vidconf.cpp: vidconf.moc $(srcdir)/timertable.cpp: timertable.moc $(srcdir)/epgwindow.cpp: epgwindow.moc $(srcdir)/fullscreen_renderer.cpp: epgwindow.moc CLEANFILES = *.moc MAINTAINERCLEANFILES = Makefile.in ui: $(UIC) ./capwindow.ui -o ./capwindow_p.h $(UIC) -impl ./capwindow_p.h ./capwindow.ui -o ./capwindow_p.cpp # $(UIC) -subdecl CapWindow ./capwindow_p.h ./config.ui -o ./capwindow.h # $(UIC) -subimpl CapWindow ./capwindow.h ./capwindow.ui -o ./capwindow.cpp #METASOURCES = AUTO #KDE_OPTIONS = qtonly avifile-0.7.48~20090503.ds/samples/qtvidcap/TODO0000644000175000017500000001262107664476474017742 0ustar yavoryavorconfigure.in:941 profiling known bugs or problems or misbehaviour of avicap: * general: sometimes avicap freezes X at startup (alex,0.7.x) * recording: A/V-delay in written files (alex,0.7.x) * recording: segments not at keyframe * codecs: - divx 3.11 : can't set bitrate, he records with 910kbps - divx 3.11 VKI: can't set bitrate, he records with 1500kbps - ffmpeg: does not record any video - strong colors 'flicker' when recording in yv12 and divx3.11 * general: overlay is often on top of other windows * timertable: problem when recording is around datechange * epg: drawing bugs bug:when picture properties come up with timertable recording video recording stops? bug:if recording goes on to the next day, it isnt stopped bug: the first recording in every day&channel doesnt get added bug: avicap crashes after timertable recording with mini-window, when miniwindow gets closed fix: Qt2.0/3 compatible fix: re-layout timertable/config feature: zapping mode feature: zapping while recording option: set channel at startup when untuned feature: web interface fix: zapping breaks recording fix: window close breaks recording feature: asymmetrical rec. sizes/custom sizes fix? compare get_clips with mplayer/xawtv fix? overlay mode fix? is get_clips() called every time it would be necessary? option: beep on framedrop feature: epg interface fix: stop using char buf[] in timertable fix: every day should be automatic fix: more filename-completion modes fix: segment() should respect dirpool too never overwrite existing files: lib/aviwrite/AviWrite.cpp Segment() init() capproc.cpp:614 segment() a/v-delay: CVS capproc.cpp :538 timestamp_shift :738 audio_error 0.6.0 capproc.cpp:570 audio_error dsp.cpp:sync() v4lxif.cpp:559 gsync, VIDIOCSYNC ---------------- aviplay_impl.h: class AviPlayer: public IAviPlayer2 static void* constructThread(void* arg); void* constructThreadfunc(); void construct(); int lockThreads(const char *name = 0); void unlockThreads(void); int checkSync(ThreadId); int drawFrame(bool aseek = true); void syncFrame(); void changePriority(const char* taskName, int add, int schedt = 0); float getVideoAsync(); bool dropFrame(); void setQuality(); void* videoThread(); void* audioThread(); void* decoderThread(); static void* startVideoThread(void* arg); static void* startAudioThread(void* arg); static void* startDecoderThread(void* arg); avm::vector m_VideoRenderers; // we could draw image to more places PthreadTask* m_pVideoThread; // performs video output and sync PthreadTask* m_pAudioThread; // performs audio output and sync PthreadTask* m_pDecoderThread; // performs video decompression and cachi aviplay.h: class IAviPlayer class IAviPlayer2: public IAviPlayer { IAviPlayer* CreateAviPlayer(const char* filename, int bitdepth, const char* subfile = 0, unsigned int flags = 0, // vcodec & acodec are going to be supported const char* vcodec = 0, const char* acodec = 0); IAviPlayer2* CreateAviPlayer2(IPlayerWidget*, void* dpy, const char* filename, const char* subname, unsigned int flags = 0, // vcodec & acodec are going to be supported const char* vcodec = 0, const char* acodec = 0); class IVideoRenderer : public IImageAllocator { /** * Issues the request to draw the image in the window memory * might be empty when direct rendering is being used */ virtual int Draw(const CImage* data) = 0; IVideoRenderer* CreateFullscreenRenderer(IPlayerWidget*, void* dpy, int width, int height, bool sub = false); /** * Creates SDL video renderer for YUV data in format yuv_fmt. * If it fails ( e.g. because yuv_fmt is not supported by X server * and VideoRenderer::allow_sw_yuv==false ), returns pointer to * 'ordinary' fullscreen renderer and puts 0 into yuv_fmt. */ IVideoRenderer* CreateYUVRenderer(IPlayerWidget*, void* dpy, int width, int height, fourcc_t yuv_fmt, bool sub = false); /* VideoRenderer* CreateXvYUVRenderer(PlayerWidget*, void* dpy, int width, int height, fourcc_t yuv_fmt, bool sub = false); */ static inline VideoRenderer* CreateFullscreenRenderer(avm::IPlayerWidget* pw, void* dpy, int width, int height, bool sub = false) { return avm::CreateFullscreenRenderer(pw, dpy, width, height, sub); } static inline VideoRenderer* CreateYUVRenderer(avm::IPlayerWidget* pw, void* dpy, int width, int height, fourcc_t yuv_fmt, bool sub = false) { return avm::CreateYUVRenderer(pw, dpy, width, height, yuv_fmt, sub); } #endif // X_DISPLAY_MISSING aviplay.cpp: IAviPlayer* CreateAviPlayer(const char* filename, int bitdepth, const char* subname, unsigned long flags, const char* vcodec, const char* acodec) { return new AviPlayer(filename, bitdepth, subname, flags, vcodec, acodec); } class AviPlayer2: public AviPlayer, public IPlayerWidget { IPlayerWidget* m_pPW; void* m_pDpy; int m_iResizeCount; int zx, zy, zw, zh; public: AviPlayer2(IPlayerWidget* pw, void* _dpy, const char* filename, const char* subname, unsigned int flags, const char* vcodec, const char* acodec) : AviPlayer(filename, GetPhysicalDepth(_dpy), subname, flags, vcodec, acodec) ,m_pPW(pw), m_pDpy(_dpy), m_iResizeCount(1), zx(0), zy(0), zw(0), zh(0) avifile-0.7.48~20090503.ds/samples/qtvidcap/avicap.pro0000644000175000017500000000111007653352237021212 0ustar yavoryavorHEADERS = \ avicapwnd.h \ avicapwnd_p.h \ capproc.h \ ccap.h \ dsp.h \ picprop.h \ picprop_p.h \ qtrenderer.h \ qt_visual.h \ v4lwindow.h \ v4lxif.h \ vidconf.h \ vidconf_p.h \ wintv.h \ deinterlace-yuv.h \ timertable.h \ epgwindow.h SOURCES = \ avicapwnd.cpp \ avicapwnd_p.cpp \ capproc.cpp \ ccap.cpp \ dsp.cpp \ main.cpp \ picprop.cpp \ picprop_p.cpp \ qtrenderer.cpp \ qt_visual.c \ v4lwindow.cpp \ v4lxif.cpp \ vidconf.cpp \ vidconf_p.cpp \ deinterlace-rgb.cpp \ deinterlace-yuv.c \ timertable.cpp \ epgwindow.cpp TRANSLATIONS = avicap_de.ts avifile-0.7.48~20090503.ds/samples/qtvidcap/avicap_de.qm0000644000175000017500000002417207654341633021513 0ustar yavoryavor<¸dÊÍ!¿`¡½ÝBh+[OµOµ=g¤Vj‰utdžÊ—h¨Ì«`õLô d•%*Ð%<+ŒS+°5l,Då3MžžJ6•ÃJcbâV®Â÷Zi™[ %%lÌ™:¢»îOÔBs€ÔRi©Þ‚>ØÄ@Q7 z@‚λQ&êXf&¤‰äÛ#ªéXªéÞ  [Z‰1]C”Haˆej°ˆol“«ph@Æwøªó¤•¨ºÿ9¼ú¿LÄNŠcâWª‚ú j¥þ®W“ %’PzNÍjmÂÊî4<#:9ê ØHê ÷®* 4¢èg ™¨é3 Æ«þ¥ Ϧå Nè s÷… ¤0€5 ×}5 ¸À Y䘕 vkR ™kR ßaþ  3$ò n-&Š F × êZÏÊ[Œ t0Š;‹úêx–ßå™Ì9¾ÏûÐÙÙíãôÝ,Õ%å$ÚNåÌEƒõÊœ)Q%Ï/yMð5¡”'CÂJBE¯Ùz™ª–ŒFÅÑŒFÅþŒÍw ]j8«3—¸Ò.²#ÊM'ž5~I=î³P ÒU Š f;ý"wkW™¢À¤À’ ÏË}'ìô0Ú# ¼l >ÛŒ§ MgþÔ Mgþ Mgþ> Yƒ*a ^‰Ó~ a%Ÿ 7õ ºdà ¾< Áå9 Ü ‚\ èTü} 5ç^’ ¬ÏµÅ îš:Ü ó­J "; ` 0@““ 4:¸ Ñ{c÷ Ó{c$ m³Q É#” ÖþÏ &©$ FXóE PŒzb V€ª± ^tì rî3 8ît 8î¦ ŸÉÅ ¾;ê ÎÁ% ÎÂJ “ðo $G 6ÃäO hØ$v ÎZ‡µ ïü/ úé9 ÿÔSz ÿÔS¬6êË!Õ "Upjo„#¸…OjÛ™›ô››'Ø'5`ðg/ÄêEë,ª Bj‡ 7L?ã VdŸE —{Ãu ¾ƒ8 Ó´Ž!i!-&OK+[FarbtonPicPropDialogOµFarbtonOµHinzufügeng¤Tagj‰NeutÇ*geschriebenes Audio: ÊVerzeichnispfadh¨ Stopp«`nächsterLô einmald• &Datei*Ð%Beenden+Œ &Zeit+°5Dateiname,DåSegmentierung3MžSchliessenJ6• FarbeJcbAnderesV®Â sorryZi™ Titel[ % jedenlÌ™&Niemals ausschalten¢»îAndere OptionenÔBs$Anzeige umschaltenÔRinAuflösungen höher als 384x288 werden nicht unterstützt.Þ‚>Tag startet um Ä@6Avicap - unbekannter Sender7 ’Ändere nicht die Vorgabe ( /dev/video ) wenn Du nicht weisst was Du tust.@‚Î&Aufnahmebegrenzung:Q&êVerkleinernf&¤4Ausschalt/Aufweck OptionenäÛ#Videoquelle:éXªTag endet um Þ  Heute[Z‰Tonformat]C”Xawtv Senderaˆfrei lassen j° Stundenol“"Aufnahme beginnt ph@Tongerät:wøªnicht verfügbar¤•&Ton¨ºÿ &Video¼ú¿Dateiname:ÄNŠSamplegröße:âWªPnaechste Aufnahme: %s #%d %s nach %s ú jAufnahmestartþ®WAufnahme endet “ Auflösung:’Pzvmomentane Aufnahme: %s #%d %s nach %s endet um %s in %s Íj*geschriebenes Video: ÂʪSegmentierung erlaubt mehr als 2GB Daten ( Grenze für AVI Dateien ) in einer Aufnahme. Wenn eingeschaltet, wird das Programm eine Sequenz von Dateien schreiben wenn ihre Größen den eingegebenen Wert überschreiten.4<Farbmodus::9ê2Audio: %d Hz, %d bit, %s HêZBilder verloren im Aufnahmethread: %d Bilder ®*"EPF Konfiguration¢èg@Zuordnung EPF Provider zu Avicap¨é32Notiere Aktionen in Datei«þ¥KonfigurationϦå&BTTV Aufnahmegerät:è(Avicap Aufnahmeliste÷…2Aufnahmepuffer-Auslastung0€5:Elektronischer Programmführer}5Kontrast:¸ÀOK/Speichern䘕Timer starten Start Timer TimerTablekRTimer starten TimerTablekRVergrößernaþ0Aufnahmeliste gestarted Datum Ende$òRmomentane Zeit: %s Timer nicht aktiviert -&Š morgenF ×Ende Zeit:ZÏÊKontrast[Œ2Aufnahme nach Datei: %s t0Škein Audio ‹úêmomentan frei–ßå&OverlayÌ9ProviderÏûÐ&Untertitel anzeigenÙíãWähle ZieldateiÝ,Õ*Eingestelltes Format:å$ÚDetailsåÌE(momentane Zeit : %s õÊ&Dateigröße)Q%, Minuten nach Aufnahme/yMgesperrt5¡”2keine momentane Aufnahme CÂJ ÄndernE¯Ù0Segmentgröße ( KBytes ):z™ªEntfernen TimerTableŒFÅEntfernenŒFÅ&VorschauŒÍwTSynch fix: %d Bilder A:%.4f V:%.4f S:%.4f  ]jAktionen«3Ändere nicht die Vorgabe ( /dev/dsp ), wenn Du nicht weisst was Du tust.¸Ò.&Bilder pro Sekunde:#Ê*Ausschalten/Aufwecken'ž5&Ändern...I=î,Ton KompressionsformatP Kanäle:U Š* Minuten vor Aufnahmef;ýBNach letzter Aufnahme ausschaltenwk Titel markieren ™¢ÀFrequenz:À’ ,Bildformat beschneidenË}'>Dateigroesse: %d KB (%.1f MB) ô0Ú0Video Kompressionsformat ¼"Zielverzeichnisse >ÛŒBeschreibungEpgChannelStrip MgþBeschreibung EpgWindow MgþBeschreibung MgþFarbraum: Yƒ*Fortschritt ^‰ÓDatum Beginn a%8&Schreibe segmentierte Datei 7õSekunden ºdÃSchnitt ¾<AVI-Aufnahme ÁåEPF Browser Ü ‚ Kanal èTü(Avicap Konfiguration 5ç^ &Gerät ¬Ïµ(startet am %s in %s  îš:FVideo Bilderwechsel: %.2f Bilder/s  ó­J(druecken zum oeffnen "; Beg&renzungen 0@“4 verstrichen: %s (%.2f s)  4:"Bildeinstellungen Ñ{c"Bildeinstellungen Ó{c8Bearbeite EPF reg. Ausdrücke m³0Bearbeite reg. Ausdrücke É#JKarenzzeit für Ausschalten in Minuten Öþfrei lassen &©Aufn.Ende FXóDSicherheits-Check fehlgeschlagen:  PŒz0Video Aufloesung: %dx%d  V€ª<zwischen Aufnahmen ausschalten ^t6minimale Auszeit in Minuten rîSaettigungPicPropDialog 8îSaettigung 8îAufnahmeliste ŸÉ0keine naechste Aufnahme  ¾;nehme AVI auf ÎÁnehme BMP auf ÎÂŒEPF xml Dateinamenwechsel wirkt sich erst nach Neustart von avicap aus “ð>drücke Start für Aufnahmebeginn $GSetze Passwort 6Ãä4ausschalten wenn gestattet hØ$@n Minuten vor Aufnahme aufwecken ÎZ‡.Erzwinge 4:3 Verhältnis ïü/6zu Aufnahmeliste hinzufügen úéHelligkeitPicPropDialog ÿÔSHelligkeit ÿÔSLBilder verloren im Encoder: %d Bilder 6êBAufnahmepuffer Auslastung: %d %% !Õ >Freier Platz auf Geraet: %d MB UpjBlock Titel „#Sender:…Oj(Drücke um zu sperren™›.druecken zum schliessen››2Erneut von Datei einlesenØ'5PasswortsperreT&on aufnehmenðg/ZieldateiêE$Beginn Datum/Zeit:,ªübermorgenBj‡6Dateien nicht überschreibenL?ãVideo BildratedŸE Kanal{Ãu$Noch nicht fertig!ƒ8 wann ausschalten´Ž/Æ— %,5;A PicPropDialog TimerTable VidConfig EpgWindowVidcapConfigDialog AviCapDialogEpgChannelStrip AviCapDlg V4LWindowPicturePropDialogavifile-0.7.48~20090503.ds/samples/qtvidcap/avicap_de.ts0000644000175000017500000006611107654341633021523 0ustar yavoryavor AviCapDialog Press START to begin capturing drücke Start für Aufnahmebeginn Stop Stopp Start Capturing into file: %s Aufnahme nach Datei: %s Video frame rate: %.2f frames/s Video Bilderwechsel: %.2f Bilder/s Video resolution: %dx%d Video Aufloesung: %dx%d Audio: %d Hz, %d bit, %s Audio: %d Hz, %d bit, %s No audio kein Audio Elapsed: %s (%.2f s) verstrichen: %s (%.2f s) Written video: geschriebenes Video: Written audio: geschriebenes Audio: Synch fix: %d frames A:%.4f V:%.4f S:%.4f Synch fix: %d Bilder A:%.4f V:%.4f S:%.4f File size: %d KB (%.1f MB) Dateigroesse: %d KB (%.1f MB) Free space on device: %d MB Freier Platz auf Geraet: %d MB Frame drop in capture thread: %d frames Bilder verloren im Aufnahmethread: %d Bilder Frame drop in encoder: %d frames Bilder verloren im Encoder: %d Bilder Capture buffer usage: %d %% Aufnahmepuffer Auslastung: %d %% %d bytes %d KB %d MB %d KB (%dkbps) %.2f s %d KB %d frames (%d kbps) %.2f s AviCapDlg AVI capture AVI-Aufnahme Progress Fortschritt Performance Details Video capture buffer usage Aufnahmepuffer-Auslastung 0 % 100 % 100 kb 0 kb Start Segment Schnitt Mini Close Schliessen EpgChannelStrip block title Block Titel highlight title Titel markieren add to recordings zu Aufnahmeliste hinzufügen Description Beschreibung EpgWindow Provider Provider not available nicht verfügbar Color Farbe EPG Browser EPF Browser Channel Kanal ZoomIn Vergrößern ZoomOut Verkleinern toggle display Anzeige umschalten EPG Config EPF Konfiguration Edit Regexps Bearbeite reg. Ausdrücke Title Titel Start Date Datum Beginn Stop Date Datum Ende Description Beschreibung Today Heute EPG xml filename changes take effect only after restart of avicap EPF xml Dateinamenwechsel wirkt sich erst nach Neustart von avicap aus day starts at Tag startet um hours Stunden day ends at Tag endet um recording starts Aufnahme beginnt mins before program Minuten vor Aufnahme recording ends Aufnahme endet mins after program Minuten nach Aufnahme EPG Provider to Avicap channel mappings Zuordnung EPF Provider zu Avicap EPG Edit Regexps Bearbeite EPF reg. Ausdrücke actions Aktionen Ok/Save OK/Speichern Re-read from file Erneut von Datei einlesen PicPropDialog Picture Properties Bildeinstellungen &Ok &OK Brightness Helligkeit Contrast Kontrast Saturation Saettigung Hue Farbton PicturePropDialog Brightness Helligkeit Contrast: Kontrast: Hue Farbton Saturation Saettigung TimerTable TimerTable started Aufnahmeliste gestarted AviCap Timertable Avicap Aufnahmeliste once einmal tomorrow morgen day after tomorrow übermorgen every jeden next nächster Start Date/Time: Beginn Datum/Zeit: End Time: Ende Zeit: Channel: Sender: Filename: Dateiname: Description Beschreibung new Neu modify Ändern remove Entfernen start timer Timer starten shutdown when allowed ausschalten wenn gestattet Start Timer Timer starten Sanity Check failed: Sicherheits-Check fehlgeschlagen: Current Time : %s momentane Zeit : %s Next Recording: %s #%d %s to %s naechste Aufnahme: %s #%d %s nach %s starts at %s in %s startet am %s in %s No Next Recording keine naechste Aufnahme No Current Recording keine momentane Aufnahme from Current Time: %s Timer not activated momentane Zeit: %s Timer nicht aktiviert Current Recording: %s #%d %s to %s stops at %s in %s momentane Aufnahme: %s #%d %s nach %s endet um %s in %s Channel Name Kanal Start Recording Aufnahmestart End Rec Aufn.Ende Filename Dateiname day Tag V4LWindow Sorry sorry Not implemented yet! Noch nicht fertig! Configure Konfiguration Xawtv stations Xawtv Sender Picture properties Bildeinstellungen Timertable Aufnahmeliste Electronic Program Guide Elektronischer Programmführer Capture AVI nehme AVI auf Capture BMP nehme BMP auf Force 4x3 ratio Erzwinge 4:3 Verhältnis Show subtitles Untertitel anzeigen &Overlay &Overlay &Preview &Vorschau Deinterlace &Quit Beenden Avicap - unknown channel Avicap - unbekannter Sender locked gesperrt VidConfig *.avi;*.AVI Select destination file Wähle Zieldatei press to unlock druecken zum oeffnen press to lock druecken zum schliessen VidcapConfigDialog Avicap configuration Avicap Konfiguration BTTV capture device: BTTV Aufnahmegerät: Do not change default value ( /dev/video ) unless you exactly know what you're doing. Ändere nicht die Vorgabe ( /dev/video ) wenn Du nicht weisst was Du tust. Audio device: Tongerät: Do not change default value ( /dev/dsp ) unless you exactly know what you're doing. Ändere nicht die Vorgabe ( /dev/dsp ), wenn Du nicht weisst was Du tust. Video channel: Videoquelle: &Device &Gerät Color mode: Farbmodus: PAL NTSC SECAM Auto Resolution: Auflösung: Resolutions higher than 384x288 aren't supported. Auflösungen höher als 384x288 werden nicht unterstützt. Capture color space: Farbraum: YV12 YUY2 RGB15LE RGB24 RGB32 Destination file Zieldatei C&hange... &Ändern... Directory Pool Zielverzeichnisse Segmentation Segmentierung Segmentation allows to write more than 2 Gb of data ( limit for an AVI file ) during one session. When it's turned on, program will create a sequence of AVI files, automatically switching them when their sizes become larger than user-specified value. Segmentierung erlaubt mehr als 2GB Daten ( Grenze für AVI Dateien ) in einer Aufnahme. Wenn eingeschaltet, wird das Programm eine Sequenz von Dateien schreiben wenn ihre Größen den eingegebenen Wert überschreiten. Segment size ( KBytes ): Segmentgröße ( KBytes ): &Write segmented file &Schreibe segmentierte Datei &File &Datei Video compression format Video Kompressionsformat Current format: Eingestelltes Format: Video frame rate Video Bildrate Frames per second: Bilder pro Sekunde: 12 15 18 20 23.975 24 25 29.970 30 Video cropping Bildformat beschneiden &Video &Video Audio compression format Ton Kompressionsformat Audio format Tonformat Frequency: Frequenz: Sample size: Samplegröße: Channels: Kanäle: 16 bit 8 bit Capture audi&o T&on aufnehmen 48000 Hz 44100 Hz 32000 Hz 22050 Hz 16000 Hz 12000 Hz 11025 Hz 8000 Hz Mono Stereo Lang1 Lang2 &Audio &Ton Limit capture process by: Aufnahmebegrenzung: &Time &Zeit seconds Sekunden File &size &Dateigröße KBytes &Limits Beg&renzungen Shutdown/Resume Options Ausschalt/Aufweck Optionen never overwrite existing files Dateien nicht überschreiben Path Verzeichnispfad keep free frei lassen now free momentan frei add Hinzufügen remove Entfernen keep free frei lassen when to shutdown wann ausschalten never shut down Niemals ausschalten shutdown after last recording Nach letzter Aufnahme ausschalten shutdown in-between recordings zwischen Aufnahmen ausschalten minimum downtime in min minimale Auszeit in Minuten boot n mins before recording n Minuten vor Aufnahme aufwecken gracetime for shutdown in min Karenzzeit für Ausschalten in Minuten Shutdown/Resume Ausschalten/Aufwecken other options Andere Optionen Log actions to file Notiere Aktionen in Datei Password Lock Passwortsperre Set Password Setze Passwort press to Lock Drücke um zu sperren Other Anderes avifile-0.7.48~20090503.ds/samples/qtvidcap/avicapwnd.cpp0000644000175000017500000003373411164657653021730 0ustar yavoryavor #include "avicapwnd.h" #include "avicapwnd.moc" #include "v4lwindow.h" #include "ccap.h" #include "capproc.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #define DECLARE_REGISTRY_SHORTCUT #include #undef DECLARE_REGISTRY_SHORTCUT #include #include #include #include //#include extern int free_diskspace(avm::string path); extern QString find_best_dir(); extern int find_keepfree(QString dirname); /* * Constructs a AviCapDialog which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ AviCapDialog::AviCapDialog( V4LWindow* pWnd ,CaptureConfig *conf) : AviCapDlg( 0 ), m_pWnd(pWnd), m_pProgress(0), m_bStarted(false) { my_config=conf; last_dropped_enc=0; last_dropped_cap=0; last_synchfix=0; last_synchfix_time=0; use_dirpool=false; i_am_mini=false; connect(m_pMiniButton, SIGNAL(clicked()), this, SLOT(mini())); connect(MiniButton, SIGNAL(clicked()), this, SLOT(mini())); connect(CloseButton, SIGNAL(clicked()), this, SLOT(close())); connect(StartButton, SIGNAL(clicked()), this, SLOT(start())); connect(SegmentButton, SIGNAL(clicked()), this, SLOT(segment())); SegmentButton->setEnabled(false); ProgressText->setText( tr( "Press START to begin capturing" ) ); m_pTimer = new QTimer; m_pCapproc = 0; m_pCC = pWnd->getcc(); if (m_pCC) m_pCC->addref(); } /* * Destroys the object and frees any allocated resources */ AviCapDialog::~AviCapDialog() { delete my_config; delete miniwidget; // thats not a child of avicapdialog } QString make_dirpool_file(QString filename) { QDate cdate=QDate::currentDate(); QTime ctime=QTime::currentTime(); QString timestr=QString().sprintf("-%02d%02d%02d-%02d%02d%02d.avi", \ cdate.year()%1000,cdate.month(),cdate.day(), \ ctime.hour(),ctime.minute(),ctime.second()); if(filename==""){ filename="avicap"+timestr; } else if(filename.length()>4 && filename.right(4)!=".avi"){ //doesnt end on .avi filename=filename+timestr; } else{ // no change in filename } QString fullname; QString pathname=find_best_dir(); if(pathname==""){ fullname=""; } else{ // make it easy for now fullname=pathname+"/"+filename; } return fullname; } void AviCapDialog::start() { m_eOldMode = (int)m_pWnd->getMode(); if (m_eOldMode != V4LWindow::Overlay) { printf("setting overlay mode\n"); m_pWnd->setMode(V4LWindow::Overlay); avm_usleep(50000); } disconnect(StartButton, SIGNAL(clicked()), this, SLOT(start())); StartButton->setText( tr( "Stop" ) ); connect(StartButton, SIGNAL(clicked()), this, SLOT(stop())); if (!my_config) { my_config = new CaptureConfig(); my_config->load(); } if (my_config->filename[0]=='/' || my_config->filename[0]=='.'){ // relative or absolute path, no modifications use_dirpool=false; } else{ use_dirpool=true; QString filename=QString(my_config->filename.c_str()); QString fullname=make_dirpool_file(filename); if (!fullname.length()) { AVMOUT(AVML_WARN, "No more free space - not recording"); m_pCapproc=0; return; } my_config->setFilename(fullname.latin1()); }//else of absolute/rel path try { m_pCapproc = new CaptureProcess(m_pWnd->m_pDev, my_config, m_pCC); AVMOUT(AVML_DEBUG, "capture process started"); } catch (FatalError& e) { QMessageBox::critical(this, "Error", e.GetDesc()); disconnect(StartButton, SIGNAL(clicked()), this, SLOT(stop())); connect(StartButton, SIGNAL(clicked()), this, SLOT(start())); m_pCapproc = 0; AVMOUT(AVML_ERROR, "Critical error when starting capture"); return; } connect(m_pTimer, SIGNAL(timeout()), this, SLOT(updateGraphs())); m_pTimer->start(500); if (RI("IsSegmented", 1)) SegmentButton->setEnabled(true); m_pProgress=new CaptureProgress; ProgressText->setAlignment( Qt::AlignVCenter ); m_pCapproc->setMessenger(m_pProgress); m_bStarted=true; } void AviCapDialog::segment() { if (m_pCapproc){ AVMOUT(AVML_INFO, "Segmenting capture"); m_pCapproc->segment(); } } void AviCapDialog::stop() { m_pTimer->stop(); m_bStarted=false; delete m_pCapproc; delete m_pProgress; m_pCapproc=0; m_pProgress=0; disconnect(StartButton, SIGNAL(clicked()), this, SLOT(stop())); connect(StartButton, SIGNAL(clicked()), this, SLOT(start())); SegmentButton->setEnabled( false ); StartButton->setText( tr( "Start" ) ); m_pWnd->setMode((V4LWindow::Modes)m_eOldMode); AVMOUT(AVML_INFO, "Capture stopped"); } void AviCapDialog::updateGraphs() { QPainter* qp; int iHeight; int iWidth; int iMaxFrame=0; int i; m_pProgress->lock(); QString s = QString(). sprintf(tr("Capturing into file:\n %s\n") + tr("Video frame rate: %.2f frames/s\n") + tr("Video resolution: %dx%d\n"), m_pProgress->filename, m_pProgress->framerate, m_pProgress->xdim, m_pProgress->ydim); if (m_pProgress->audio_freq) s += QString().sprintf(tr("Audio: %d Hz, %d bit, %s\n"), m_pProgress->audio_freq, m_pProgress->audio_ssize, (m_pProgress->audio_channels==1)?"mono":"stereo"); else s += QString().sprintf(tr("No audio\n")); float elapsed_float=m_pProgress->enc_time/1000000.0; QTime elapsed = QTime(0,0,0,0); elapsed = elapsed.addSecs((int)elapsed_float); #if QT_VERSION>=300 QString elapsedstr = elapsed.toString("hh:mm:ss"); #else QString elapsedstr = elapsed.toString(); #endif int free_space = free_diskspace(m_pProgress->filename); if (use_dirpool && (((int)elapsed_float)%60==0)){ char buffer[100]; strcpy(buffer,m_pProgress->filename); char *dname=dirname(buffer); QString dirname=QString(dname); strcpy(buffer,m_pProgress->filename); char *bname=basename(buffer); QString filename=QString(bname); #if 0 printf("new segmenting name: %s\n",new_segmenting_name.latin1()); m_pCapproc->setSegmentName(new_segmenting_name.latin1()); //UserLog(QString().sprintf("new segmenting name %s\n",new_segmenting_name.latin1())); int keepfree=find_keepfree(dirname); printf("keepfree=%d freespace=%d\n",keepfree,free_space); if(keepfree==0 || keepfree>free_space){ printf("out of free space - segmenting to another dir\n"); segment(); } #else QString fullname=make_dirpool_file(filename); if(fullname==""){ AVMOUT(AVML_WARN, "error - no more free space in dirpool\n" "stopping recording\n"); //stop recording stop(); return; } QString new_segmenting_name=fullname; AVMOUT(AVML_DEBUG, "New segmenting name: %s", new_segmenting_name.latin1()); m_pCapproc->setSegmentName(new_segmenting_name.latin1()); AVMOUT(AVML_DEBUG, "New segmenting name: %s", new_segmenting_name.latin1()); int keepfree=find_keepfree(dirname); AVMOUT(AVML_DEBUG, "keepfree=%d freespace=%d", keepfree, free_space); if (keepfree == 0 || keepfree > free_space) { AVMOUT(AVML_WARN, "Out of free space - segmenting to another dir"); segment(); } #endif } s+=QString().sprintf( tr("\nElapsed: %s (%.2f s)\n")+ tr("Written video: \n")+ tr(" %d KB %d frames (%d kbps) %.2f s\n")+ tr("Written audio: \n")+ tr(" %d KB (%dkbps) %.2f s\n")+ tr("Synch fix: %d frames A:%.4f V:%.4f S:%.4f\n")+ tr("File size: %d KB (%.1f MB)\n")+ tr("Free space on device: %d MB\n")+ tr("Frame drop in capture thread: %d frames\n")+ tr("Frame drop in encoder: %d frames\n")+ tr("Capture buffer usage: %d %%\n"), elapsedstr.latin1(), elapsed_float, (int)(m_pProgress->video_bytes/1024), (int) m_pProgress->video_frames, (int)(m_pProgress->video_bytes * 8 / m_pProgress->video_time / 1000), (double)m_pProgress->video_time, (int)(m_pProgress->audio_bytes/1024), int(m_pProgress->audio_bytes * 8 / m_pProgress->audio_time / 1000),(float) m_pProgress->audio_time, m_pProgress->synch_fix, (float)m_pProgress->audio_error, (float)m_pProgress->video_error, (float)m_pProgress->timestamp_shift, (int)(m_pProgress->file_size/1024), (int)((float)m_pProgress->file_size)/(1024.0*1024.0), free_space, m_pProgress->dropped_cap, m_pProgress->dropped_enc, int(100.*m_pProgress->buffer_occupancies[(m_pProgress->buffer_head+m_pProgress->HISTORY_SIZE-1)%m_pProgress->HISTORY_SIZE]/m_pProgress->max_frames) ); ProgressText->setText(s); #if 0 struct rusage rus; int res1=getrusage(RUSAGE_SELF,&rus); long usertime=rus.ru_utime.tv_sec; long systime=rus.ru_stime.tv_sec; #endif if ((((int)elapsed_float)%60)==0) AVMOUT(AVML_DEBUG, "Capture is alive since %s", elapsedstr.latin1()); if (last_dropped_enc != m_pProgress->dropped_enc) AVMOUT(AVML_DEBUG, "Dropped frames %s %s encoder=%3d (+%2d)\n", m_pProgress->filename,elapsedstr.latin1(), m_pProgress->dropped_enc,m_pProgress->dropped_enc-last_dropped_enc); if (last_dropped_cap != m_pProgress->dropped_cap) AVMOUT(AVML_DEBUG, "Dropped frames %s %s capture=%3d (+%2d)\n", m_pProgress->filename, elapsedstr.latin1(), m_pProgress->dropped_cap,m_pProgress->dropped_cap-last_dropped_cap); if (last_synchfix!=m_pProgress->synch_fix) { long timediff=((long)elapsed_float)-last_synchfix_time; QTime timed = QTime(0,0,0,0); timed = timed.addSecs((int)timediff); QString diffstr=timed.toString(); AVMOUT(AVML_DEBUG, "synchfix %s %s synchfix=%3d (+%2d +%s)\n", m_pProgress->filename,elapsedstr.latin1(), m_pProgress->synch_fix, m_pProgress->synch_fix-last_synchfix,diffstr.latin1()); last_synchfix_time=(long)elapsed_float; } last_dropped_enc=m_pProgress->dropped_enc; last_dropped_cap=m_pProgress->dropped_cap; last_synchfix=m_pProgress->synch_fix; QString shorttext = QString(). sprintf("%s %.fM %d+%d %d%%", elapsedstr.latin1(), ((float)m_pProgress->file_size)/(1024.0*1024.0), m_pProgress->dropped_cap, m_pProgress->dropped_enc, int(100.*m_pProgress->buffer_occupancies[(m_pProgress->buffer_head+m_pProgress->HISTORY_SIZE-1)%m_pProgress->HISTORY_SIZE]/m_pProgress->max_frames)); m_pMiniButton->setText(shorttext); miniwidget->setCaption(shorttext); #if QT_VERSION > 220 if(CaptureTab->currentPageIndex()!=1) goto finish; #endif qp = new QPainter(Frame3_2); iHeight=Frame3_2->height(); iWidth=Frame3_2->width(); for(i=0; ivideo_frame_len; i++) { int index = m_pProgress->video_frame_head - i - 1; while(index<0) index += m_pProgress->HISTORY_SIZE; index %= m_pProgress->HISTORY_SIZE; if((m_pProgress->video_frame_sizes[index] & ~0x40000000)>iMaxFrame) iMaxFrame=m_pProgress->video_frame_sizes[index] & ~0x40000000; } if (iMaxFrame<10) iMaxFrame=10; else if (iMaxFrame<100) iMaxFrame=100; else if (iMaxFrame<3000) iMaxFrame=3000; else if (iMaxFrame<10000) iMaxFrame=10000; else if (iMaxFrame<30000) iMaxFrame=30000; else if (iMaxFrame<100000) iMaxFrame=100000; else iMaxFrame=1000000; if (iMaxFrame<1000) s=QString().sprintf(tr("%d bytes"), iMaxFrame); else if(iMaxFrame<1000000) s=QString().sprintf(tr("%d KB"), iMaxFrame/1024); else s=QString().sprintf(tr("%d MB"), iMaxFrame/(1024*1024)); MaxFrameSizeText->setText(s); for (i=iWidth; i>=0; i--) { int index = i-iWidth; if(index<-m_pProgress->video_frame_len) { qp->setPen(QColor(0,0,0)); qp->moveTo(i, iHeight); qp->lineTo(i, 0); continue; } index += m_pProgress->video_frame_head; while(index<0) index += m_pProgress->HISTORY_SIZE; index %= m_pProgress->HISTORY_SIZE; float t=(m_pProgress->video_frame_sizes[index] & ~0x40000000)/(float)iMaxFrame; if (t>1)t=1; if (m_pProgress->video_frame_sizes[index] & 0x40000000){ //printf("avicapwnd keyframe\n"); qp->setPen(QColor(255, 0, 0)); } else qp->setPen(QColor(0, 255, 0)); qp->moveTo(i, iHeight); qp->lineTo(i, (int) (iHeight*(1-t))); if (t<1) { qp->setPen(QColor(0, 0, 0)); qp->lineTo(i, 0); } } delete qp; qp=new QPainter(Frame3); iHeight=Frame3->height(); iWidth=Frame3->width(); for(i=0; ibuffer_len) { qp->setPen(QColor(0,0,0)); qp->moveTo(i, iHeight); qp->lineTo(i, 0); continue; } index += m_pProgress->buffer_head; while(index<0) index += m_pProgress->HISTORY_SIZE; index %= m_pProgress->HISTORY_SIZE; float t=m_pProgress->buffer_occupancies[index]/(double)m_pProgress->max_frames; if(t>1)t=1; qp->setPen(QColor(0, 255, 0)); qp->moveTo(i, iHeight); qp->lineTo(i, (int) (iHeight*(1-t))); if(t<1) { qp->setPen(QColor(0, 0, 0)); qp->lineTo(i, 0); } } delete qp; finish: m_pProgress->unlock(); int finished; avm::string error; m_pCapproc->getState(finished, error); if(finished) { printf("Finished\n"); stop(); if(error.size()) QMessageBox::critical(this, "Error", error.c_str()); } } bool AviCapDialog::close() { m_pWnd->unregisterCapDialog(); // no need to delete child widgets, Qt does it all for us if (m_bStarted) stop(); delete m_pTimer; delete m_pCapproc; delete m_pProgress; if (m_pCC) m_pCC->release(); return QWidget::close(); } void AviCapDialog::mini() { i_am_mini=!i_am_mini; if(i_am_mini){ this->hide(); miniwidget->show(); } else{ this->show(); miniwidget->hide(); } #if 0 setMaximumSize(80,40); setBaseSize(80,40); setGeometry(x(),y(),80,40); //QSizePolicy pol(QSizePolicy::Minimum,QSizePolicy::Minimum,false); //setSizePolicy(pol); //m_pMiniButton->setSizePolicy(pol); m_pMiniButton->setMaximumSize(50,20); //miniwidget->setSizePolicy(pol); miniwidget->setMaximumSize(60,30); m_pMiniButton->adjustSize(); miniwidget->adjustSize(); adjustSize(); showNormal(); updateGeometry(); #endif } avifile-0.7.48~20090503.ds/samples/qtvidcap/avicapwnd.h0000644000175000017500000000171107664356170021363 0ustar yavoryavor#ifndef AVICAPDIALOG_H #define AVICAPDIALOG_H #include "avicapwnd_p.h" class V4LWindow; class QTimer; class CaptureProcess; class CaptureProgress; class ClosedCaption; struct CaptureConfig; class AviCapDialog : public AviCapDlg { Q_OBJECT; V4LWindow* m_pWnd; QTimer* m_pTimer; CaptureProcess* m_pCapproc; CaptureProgress* m_pProgress; CaptureConfig *my_config; ClosedCaption* m_pCC; int m_eOldMode; bool m_bStarted; bool i_am_mini; bool use_dirpool; int last_dropped_enc,last_dropped_cap,last_synchfix; long last_synchfix_time; public: AviCapDialog(V4LWindow* pWnd,CaptureConfig *conf); // QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~AviCapDialog(); CaptureProcess *getCaptureProcess() { return m_pCapproc; }; public slots: void start(); void mini(); void segment(); void stop(); void updateGraphs(); bool close(); }; #endif // AVICAPDIALOG_H avifile-0.7.48~20090503.ds/samples/qtvidcap/avicapwnd_p.cpp0000644000175000017500000001217510473335640022232 0ustar yavoryavor#include "avicapwnd_p.h" #include "avicapwnd_p.moc" #include #include #include #include #include #include #include #include /* * Constructs a AviCapDlg which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ AviCapDlg::AviCapDlg( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ), avm::AvmOutputLog("AviCap") { resize( 299, 422 ); setCaption( tr( "AVI capture" ) ); QVBoxLayout *vbmain=new QVBoxLayout(this); bigwidget=new QWidget(this); vbmain->addWidget(bigwidget); //bigwidget=this; QGridLayout* gl = new QGridLayout( bigwidget, 1, 1 ); gl->setSpacing( 5 ); gl->setMargin( 5 ); CaptureTab = new QTabWidget( bigwidget, "CaptureTab" ); #if QT_VERSION > 220 CaptureTab->setTabShape( QTabWidget::Rounded ); #endif //CaptureTab->setTabPosition( QTabWidget::Top ); gl->addWidget( CaptureTab, 0, 0 ); // first tab QWidget* w = new QWidget( CaptureTab ); CaptureTab->insertTab( w, tr( "Progress" ) ); QGridLayout* glt = new QGridLayout( w, 1, 1 ); glt->setSpacing( 5 ); glt->setMargin( 5 ); /* Frame34 = new QFrame( w ); glt->addWidget( Frame34, 0, 0 ); Frame34->setFrameShadow( QFrame::Sunken ); Frame34->setFrameShape( QFrame::StyledPanel ); QVBoxLayout* vl = new QVBoxLayout( Frame34 );*/ ProgressText = new QLabel( w ); glt->addWidget( ProgressText, 0, 0 ); //vl->addWidget( ProgressText ); //ProgressText->setBackgroundColor( QColor(255,255,0) ); ProgressText->setAlignment( Qt::AlignCenter ); // second tab w = new QWidget( CaptureTab ); CaptureTab->insertTab( w, tr( "Performance" ) ); glt = new QGridLayout( w, 1, 1 ); CaptureBufferText = new QLabel( tr( "Video capture buffer usage" ), w ); CaptureBufferText->setAlignment( int( QLabel::AlignCenter ) ); glt->addWidget( CaptureBufferText, 0, 0 ); glt->setSpacing( 5 ); glt->setMargin( 5 ); #if QT_VERSION > 220 Frame3 = new QFrame( w ); Frame3->setMinimumSize( QSize( 184, 94 ) ); Frame3->setFrameShadow( QFrame::Sunken ); Frame3->setFrameShape( QFrame::StyledPanel ); QPalette pal; QColorGroup cg1; QColorGroup cg2; cg1.setColor( QColorGroup::Foreground, black ); cg1.setColor( QColorGroup::Button, QColor( 192, 192, 192) ); cg1.setColor( QColorGroup::Light, white ); cg1.setColor( QColorGroup::Midlight, QColor( 223, 223, 223) ); cg1.setColor( QColorGroup::Dark, QColor( 96, 96, 96) ); cg1.setColor( QColorGroup::Mid, QColor( 128, 128, 128) ); cg1.setColor( QColorGroup::Text, black ); cg1.setColor( QColorGroup::BrightText, white ); cg1.setColor( QColorGroup::ButtonText, black ); cg1.setColor( QColorGroup::Base, white ); cg1.setColor( QColorGroup::Background, black ); cg1.setColor( QColorGroup::Shadow, black ); cg1.setColor( QColorGroup::Highlight, black ); cg1.setColor( QColorGroup::HighlightedText, white ); pal.setActive( cg1 ); pal.setInactive( cg1 ); cg2 = cg1; cg2.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) ); cg2.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) ); pal.setDisabled( cg2 ); Frame3->setPalette( pal ); //Frame3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, Frame3->sizePolicy().hasHeightForWidth() ) ); TextLabel3 = new QLabel( tr( "0 %" ), w ); TextLabel3_2 = new QLabel( tr( " 100 % " ), w ); glt->addMultiCellWidget( Frame3, 1, 3, 0, 0 ); glt->addWidget( TextLabel3_2, 1, 1 ); glt->addWidget( TextLabel3, 3, 1 ); Frame3_2 = new QFrame( w ); Frame3_2->setMinimumSize( QSize( 184, 94 ) ); Frame3_2->setFrameShadow( QFrame::Sunken ); Frame3_2->setFrameShape( QFrame::StyledPanel ); Frame3_2->setPalette( pal ); MaxFrameSizeText = new QLabel( tr( "100 kb" ), w ); TextLabel3_3 = new QLabel( tr( "0 kb" ), w ); glt->addMultiCellWidget( Frame3_2, 4, 6, 0, 0 ); glt->addWidget( MaxFrameSizeText, 4, 1 ); glt->addWidget( TextLabel3_3, 6, 1 ); //QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); //glt->addItem( spacer, 1, 1 ); #endif QHBoxLayout* hbl = new QHBoxLayout( gl ); StartButton = new QPushButton( tr( "Start" ), bigwidget ); hbl->addWidget( StartButton ); SegmentButton = new QPushButton( tr( "Segment" ), bigwidget ); hbl->addWidget( SegmentButton ); MiniButton = new QPushButton( tr( "Mini" ), bigwidget ); hbl->addWidget( MiniButton ); CloseButton = new QPushButton( tr( "Close" ), bigwidget ); hbl->addWidget( CloseButton ); miniwidget = new QWidget(); //vbmain->addWidget(miniwidget); QVBoxLayout *vbmini = new QVBoxLayout(miniwidget); //minilabel=new QLabel("text",miniwidget); m_pMiniButton=new QPushButton("pressme",miniwidget); vbmini->addWidget(m_pMiniButton); miniwidget->hide(); } /* * Destroys the object and frees any allocated resources */ AviCapDlg::~AviCapDlg() { // no need to delete child widgets, Qt does it all for us } avifile-0.7.48~20090503.ds/samples/qtvidcap/avicapwnd_p.h0000644000175000017500000000240410473335640021671 0ustar yavoryavor/**************************************************************************** ** Form interface generated from reading ui file 'capture.ui' ** ** Created: Sat May 19 20:42:24 2001 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ #ifndef AVICAPDLG_H #define AVICAPDLG_H #include #include class QVBoxLayout; class QHBoxLayout; class QGridLayout; class QFrame; class QLabel; class QPushButton; class QTabWidget; class AviCapDlg : public QWidget, public avm::AvmOutputLog { Q_OBJECT; public: AviCapDlg( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~AviCapDlg(); QTabWidget* CaptureTab; QFrame* Frame34; QLabel* ProgressText; QLabel* FrameSizeText; QFrame* Frame3_2; QLabel* TextLabel3_3; QLabel* MaxFrameSizeText; QLabel* TextLabel3; QFrame* Frame3; QLabel* TextLabel3_2; QLabel* CaptureBufferText; QPushButton* StartButton; QPushButton* SegmentButton; QPushButton* CloseButton; QPushButton* MiniButton; QWidget* bigwidget; QWidget* miniwidget; QLabel* minilabel; QPushButton *m_pMiniButton; }; #endif // AVICAPDLG_H avifile-0.7.48~20090503.ds/samples/qtvidcap/avirec.cpp0000644000175000017500000003560011164474473021214 0ustar yavoryavor/* avirec Copyright (C) 1999-2001 Oliver Kurth This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU 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. */ /* $Id: avirec.cpp,v 1.31 2009/03/31 20:12:43 kabi Exp $ */ #include #include #include #include #include #include "v4lxif.h" #include "capproc.h" #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include // sighandler_t #include #include #include #include #include #ifdef HAVE_SYSINFO #include #endif using namespace std; // for now same name as avicap to share settings const char* g_pcProgramName = "AviCap"; //"AviRec"; unsigned int m_iMemory; struct VRConf { avm::string codec_string; int attr_count; char *attributes[10]; int width; int height; int over_l; int over_r; int over_t; int over_b; int quality; int keyframes; int audio_channels; int audio_compressor; int audio_bitrate; int timelimit; float fps; bool deinterlace; bool rgb; int norm; int input; const char *device; const char *audio_device; }; static const struct STRTAB norms_bttv[] = { { 0, "PAL" }, { 1, "NTSC" }, { 2, "SECAM" }, { 3, "PAL-NC" }, { 4, "PAL-M" }, { 5, "PAL-N" }, { 6, "NTSC-JP" }, { -1, NULL } }; static struct VRConf conf = { "", 0, { 0 }, 384, 288, 0, 0, 0, 0, 95, 15, 2, 1, // PCM 0, 60, 25, false, false, -1, 0, V4L_DEVICE, "/dev/dsp", }; volatile int sig_int_seen = 0; static void sig_int(int) { sig_int_seen = 1; } avm::vector::iterator GetCodecID(const avm::string& name) { avm::vector::iterator it; int i=0; int sel=0; for (it = video_codecs.begin(); it != video_codecs.end(); it++) { if(!(it->direction & avm::CodecInfo::Encode)) continue; if(name == it->GetName()) break; } return it; } void ListCodecs(avm::vector& codec_list) { avm::vector::iterator it; int i=0; int sel=0; for (it = codec_list.begin(); it != codec_list.end(); it++) { if ( it->kind == avm::CodecInfo::DShow_Dec) continue; //probably not a usable codec.. if(!(it->direction & avm::CodecInfo::Encode)) continue; printf("%s\n", it->GetName()); avm::vector encinfo = it->encoder_info; avm::vector::const_iterator inf_it; for(inf_it = encinfo.begin(); inf_it != encinfo.end(); inf_it++) { switch(inf_it->kind) { case avm::AttributeInfo::Integer: { int defval; if (avm::CodecGetAttr(*it, inf_it->GetName(), &defval) == 0) printf(" %s=%d\n", inf_it->GetName(), defval); else printf(" %s=(no default)\n", inf_it->GetName()); } break; case avm::AttributeInfo::Select: { int defval; avm::vector::const_iterator sit; avm::CodecGetAttr(*it, inf_it->GetName(), &defval); printf(" %s = ", inf_it->GetName()); printf(" %s ", (defval < (int)inf_it->options.size()) ? inf_it->options[defval].c_str() : "unknown"); printf(" ("); for (sit = (inf_it->options).begin(); sit != (inf_it->options).end(); sit++) printf("%s ", sit->c_str()); printf(")\n"); } break; case avm::AttributeInfo::String: { const char* def_str; avm::CodecGetAttr(*it, it->GetName(), &def_str); printf(" %s = '%s'\n", inf_it->GetName(), def_str); } break; } } i++; } } void Usage(const char *arg0) { printf("Usage: %s [options] [filename]\n" "Options:\n" "opt | long option arg default\n" "-----+--------------------------------------------------\n" " -h | --help display usage\n" " -l | --list list available video codecs\n" //" -L | --list-audio list available audio codecs\n"; " -a | --codec-attribute attr set a codec attribute\n" " -b | --audiobitrate rate 0 set audio bitrate (for mp3)\n" " -c | --codec codec set video codec\n" " -d | --deinterlace off deinterlace picture\n" " -F | --fps rate 25 set framerate\n" " -g | --grabdevice device "V4L_DEVICE" set video device\n" " -G | --audiodevice device /dev/dsp set audio device\n" " -i | --input input 0 set v4l input\n" " -k | --keyframes rate 15 set key frame rate\n" " -m | --audiomode val s audio mode (n=none, m=mono, s=stereo)\n" " -n | --norm norm (none) set tuner norm (pal,ntsc,secam,pal-nc,pal-m,ntsc-jp)\n" " -q | --quality val 95 set quality 1..100\n" " -r | --rgb off capture in rgb color space\n" " -t | --rectime time 60s set time limit (s,m,h,d,w)\n" " -x | --width cols 384 set capture width\n" " -y | --height rows 288 set capture height\n" " -L | --over-l cols 0 set left overscan\n" " -R | --over-r cols 0 set right overscan\n" " -T | --over-t rows 0 set top overscan\n" " -B | --over-b rows 0 set bottom overscan\n" , arg0); } int time_interval(char *str) { char buf[16]; char *p = str, *q = buf; int factor = 1, val; while(*p && isdigit(*p)) *(q++) = *(p++); *q = 0; val = atoi(buf); /* fall through: */ switch(*p) { case 'w': factor *= 7; case 'd': factor *=24; case 'h': factor *= 60; case 'm': factor *= 60; case 's': case 0: break; default: return -1; } return val * factor; } static void iMemory() { #ifdef HAVE_SYSINFO struct sysinfo s_info; sysinfo(&s_info); m_iMemory=s_info.totalram; if(m_iMemory<2*1048576) m_iMemory=1048576; else m_iMemory/=2; #else m_iMemory = 16 * 1024 * 1024; #endif printf("Using %d Mb of memory for frame caching\n", m_iMemory/1048576); } struct CaptureConfig *CreateCapConf(VRConf *pconf, const avm::string& filename) { CaptureConfig *pcc = new CaptureConfig; if(pcc) { pcc->filename = filename; pcc->segment_size = -1; avm::vector::iterator it = GetCodecID(pconf->codec_string); if(it != video_codecs.end()) { pcc->codec.compressor = it->fourcc; pcc->codec.cname=it->GetName(); printf("using codec '%s' (%u)\n", it->GetName(), it->fourcc); } else { fprintf(stderr, "invalid codec: %s\nuse -l for a list\n", pconf->codec_string.c_str()); return NULL; } int i; for(i = 0; i < conf.attr_count; i++) { char name[21], val[21]; sscanf(conf.attributes[i], "%20[^=]=%s", name, val); printf("setting '%s' = '%s'\n", name, val); avm::CodecSetAttr(*it, name, atoi(val)); // FIXME: do not assume integer attribute... } pcc->codec.quality = pconf->quality * 100; pcc->codec.keyfreq = pconf->keyframes; pcc->frequency = 44100; // make configurable pcc->chan = pconf->audio_channels; if(pcc->chan > 0) { if(pconf->audio_bitrate) { pcc->audio_bitrate = pconf->audio_bitrate; pcc->audio_compressor = 0x55; // MP3 } else pcc->audio_compressor = 1; // PCM }else pcc->frequency = 0; // tells CaptureProcess to not use audio pcc->samplesize = 16; // make configurable pcc->res_w = pconf->width; pcc->res_h = pconf->height; pcc->over_l = pconf->over_l; pcc->over_r = pconf->over_r; pcc->over_t = pconf->over_t; pcc->over_b = pconf->over_b; pcc->timelimit = pconf->timelimit; pcc->sizelimit = -1; // make configurable pcc->fps = pconf->fps; if(pconf->rgb) pcc->colorspace = cspRGB24; else pcc->colorspace = cspYUY2; pcc->deinterlace = pconf->deinterlace; pcc->audio_device = pconf->audio_device; } return pcc; } void ReadEnv() { char *val; val = getenv("AVIREC_CODEC"); if (val) conf.codec_string = val; val = getenv("AVIREC_ATTRIBUTES"); if (val) conf.attributes[conf.attr_count++] = strdup(val); val = getenv("AVIREC_WIDTH"); if (val) conf.width = atoi(val); val = getenv("AVIREC_HEIGHT"); if (val) conf.height = atoi(val); val = getenv("AVIREC_QUALITY"); if (val) conf.quality = atoi(val); val = getenv("AVIREC_KEYFRAMES"); if (val) conf.keyframes = atoi(val); val = getenv("AVIREC_AUDIOBITRATE"); if (val) conf.audio_bitrate = atoi(val); val = getenv("AVIREC_TIMELIMIT"); if (val) conf.timelimit = atoi(val); val = getenv("AVIREC_FPS"); if (val) conf.fps = atof(val); val = getenv("AVIREC_DEINTERLACE"); if (val && strncasecmp(val, "true", 4) == 0) conf.deinterlace = true; val = getenv("AVIREC_RGB"); if (val && strncasecmp(val, "true", 4) == 0) conf.rgb = true; val = getenv("AVIREC_NORM"); if(val) { int i = 0; while(norms_bttv[i].str){ if(strcasecmp(norms_bttv[i].str, val) == 0) break; i++; } if(norms_bttv[i].str) conf.norm = norms_bttv[i].nr; } val = getenv("AVIREC_DEVICE"); if (val) conf.device = strdup(getenv("AVIREC_DEVICE")); val = getenv("AVIREC_AUDIODEVICE"); if (val) conf.audio_device = strdup(getenv("AVIREC_AUDIODEVICE")); } int main(int argc, char *argv[]) { int c; int digit_optind = 0; int do_rec = 1; { BITMAPINFOHEADER bih; bih.biCompression = 0xffffffff; // just to fill video_codecs list avm::CreateDecoderVideo(bih, 0, 0); } ReadEnv(); while (1) { static const struct option long_options[] = { {"codec-attribute", 0, NULL, 'a'}, {"audiobitrate", 0, NULL, 'b'}, {"codec", 0, NULL, 'c'}, {"deinterlace", 0, NULL, 'd'}, {"framerate", 0, NULL, 'F'}, {"fps", 0, NULL, 'F'}, {"grabdevice", 0, NULL, 'g'}, {"audiodevice", 0, NULL, 'G'}, {"help", 0, NULL, 'h'}, {"input", 0, NULL, 'i'}, {"keyframes", 0, NULL, 'k'}, {"list", 0, NULL, 'l'}, {"list-audio", 0, NULL, 'C'}, {"audiomode", 0, NULL, 'm'}, {"quality", 0, NULL, 'q'}, {"rgb", 0, NULL, 'r'}, {"rectime", 0, NULL, 't'}, {"width", 0, NULL, 'x'}, {"height", 0, NULL, 'y'}, // -h already given for help... {"over-l", 0, NULL, 'L'}, {"over-r", 0, NULL, 'R'}, {"over-t", 0, NULL, 'T'}, {"over-b", 0, NULL, 'B'}, {NULL, 0, NULL, 0 } }; int this_option_optind = optind ? optind : 1; int option_index = 0; c = getopt_long (argc, argv, "a:b:Cc:dF:g:G:hi:k:lm:n:q:rt:x:y:L:R:T:B:", long_options, &option_index); if (c == -1) break; switch (c) { case 'a': conf.attributes[conf.attr_count++] = strdup(optarg); break; case 'b': conf.audio_bitrate = atoi(optarg); break; case 'c': conf.codec_string = optarg; break; case 'd': conf.deinterlace = true; break; case 'F': conf.fps = atof(optarg); break; case 'g': conf.device = strdup(optarg); break; case 'G': conf.audio_device = strdup(optarg); break; case '?': case 'h': Usage(argv[0]); do_rec = 0; break; case 'k': conf.keyframes = atoi(optarg); break; case 'l': ListCodecs(video_codecs); do_rec = 0; break; case 'C': ListCodecs(audio_codecs); do_rec = 0; break; case 'm': switch (optarg[0]){ case 'n': conf.audio_channels = 0; break; case 'm': conf.audio_channels = 1; break; case 's': conf.audio_channels = 2; break; } break; case 'n': { int i = 0; while(norms_bttv[i].str) { if(strcasecmp(norms_bttv[i].str, optarg) == 0) break; i++; } if(norms_bttv[i].str) conf.norm = norms_bttv[i].nr; } break; case 'i': conf.input = atoi(optarg); break; case 'q': conf.quality = atoi(optarg); break; case 'r': conf.rgb = true; break; case 't': conf.timelimit = time_interval(optarg); break; case 'x': conf.width = atoi(optarg); break; case 'y': conf.height = atoi(optarg); break; case 'L': conf.over_l = atoi(optarg); break; case 'R': conf.over_r = atoi(optarg); break; case 'T': conf.over_t = atoi(optarg); break; case 'B': conf.over_b = atoi(optarg); break; } } if (optind < argc) { if(do_rec) { iMemory(); avm::string filename = argv[optind++]; CaptureConfig *capconf = CreateCapConf(&conf, filename); if(!capconf) exit(EXIT_FAILURE); v4lxif* v4l; try { v4l = new v4l1baseif(0, conf.device); if(conf.audio_channels > 0) { v4l->setAudioMode(conf.audio_channels == 2 ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO); v4l->setAudioMute(false); v4l->setAudioVolume(65535); }else v4l->setAudioMute(true); if(conf.norm > 0) { // twice? don't ask me why... v4l->setChannelNorm(conf.norm); v4l->setChannelNorm(conf.norm); } if(conf.input > 0) v4l->setChannel(conf.input); } catch(BaseError &e) { e.Print(); exit(EXIT_FAILURE); } CaptureProcess *capproc; try { capproc = new CaptureProcess(v4l, capconf, NULL); } catch(FatalError& e) { fprintf(stderr, "Error: %s\n", e.GetDesc()); exit(EXIT_FAILURE); } sighandler_t old_int = signal(SIGINT, sig_int); CaptureProgress *progress = new CaptureProgress(); capproc->setMessenger(progress); // now sleep until it's over... int i = 0; while(1) { int finished; avm::string error; capproc->getState(finished, error); if(finished) break; if(sig_int_seen) { fprintf(stderr, "Ctrl-C from keyboard -- please wait\n"); break; } if(isatty(1)) { progress->lock(); int drop_enc = progress->dropped_enc; int drop_cap = progress->dropped_cap; progress->unlock(); double elapsed_float=progress->enc_time/1000000.0; printf("\r time: %d frames: %d cap drop: %d enc drop: %d", (int)elapsed_float, progress->video_frames, progress->dropped_cap, progress->dropped_enc); fflush(stdout); } sleep(1); i++; } delete capproc; signal(SIGINT, old_int); if(conf.audio_channels > 0) { v4l->setAudioMute(true); } } } } avifile-0.7.48~20090503.ds/samples/qtvidcap/capproc.cpp0000644000175000017500000005626111172600160021357 0ustar yavoryavor#define USE_REGISTRY #include "capproc.h" #include "dsp.h" #include "ccap.h" #include #include #include #include #include #include #include #include #include #define DECLARE_REGISTRY_SHORTCUT #include #undef DECLARE_REGISTRY_SHORTCUT #include #include #include #include "v4lxif.h" //#include "v4lwindow.h" extern unsigned int m_iMemory; #define __MODULE__ "Capture Config" void copy_deinterlace_24(void* outpic, const void* inpic, int xdim, int height); extern "C"{ void deinterlace_bob_yuv_mmx(void* outpic, const void* inpic, int xdim, int height); } static struct restable_s { enum Resolutions res; int width; int height; } restable[] = { { W768, 768, 576 }, { W640, 640, 480 }, { W576, 576, 432 }, { W400, 400, 300 }, { W384, 384, 288 }, { W320, 320, 240 }, { W192, 192, 144 }, { W160, 160, 120 }, { W512, 512, 384 }, { WNONE, 0, 0 } }; #ifdef USE_REGISTRY void CaptureConfig::setNamedCodec(avm::string named_codec){ if(named_codec==""){ return; } //search the regnumber of our codec int regnumber=0; char regbuf[300]; sprintf(regbuf,"NamedCodecs-%02d-Savename",regnumber); avm::string nc_savename=RS(regbuf,"NONE"); while(!(named_codec==nc_savename || nc_savename=="NONE")){ regnumber++; sprintf(regbuf,"NamedCodecs-%02d-Savename",regnumber); nc_savename=RS(regbuf,"NONE"); } if(nc_savename!="NONE"){ sprintf(regbuf,"NamedCodecs-%02d-Compressor",regnumber); codec.compressor=RI(regbuf,fccIV50); sprintf(regbuf,"NamedCodecs-%02d-Quality",regnumber); codec.quality=RI(regbuf,9500); sprintf(regbuf,"NamedCodecs-%02d-Keyframe",regnumber); codec.keyfreq=RI(regbuf,15); printf("capconf: setting named codec to %s/%d\n",named_codec.c_str(), codec.compressor); //avm::codecSetSaveName(named_codec); } } void CaptureConfig::load() { audio_compressor = 1; deinterlace = false; audio_device = RS("AudioDevice", "/dev/dsp"); filename = RS("FileName", "./movie.avi"); never_overwrite = RI("NeverOverwriteFiles", 0); segment_size = RI("IsSegmented", 1)?RI("SegmentSize", 1000*1000):-1; codec.compressor = RI("Compressor", fccIV50); codec.cname = RS("Codec", "odivx"); codec.quality = RI("Quality", 9500); codec.keyfreq = RI("Keyframe", 15); timelimit = RI("LimitTime", 0)?RI("TimeLimit", 3600):-1; sizelimit = RI("LimitSize", 0)?RI("SizLimit", 2000000):-1; fps = (float)RI("FPS", 25000) / 1000.f; colorspace = (enum Colorspaces)RI("Colorspace", 0); //avm::codecSetSaveName(""); avm::string named_codec=RS("NamedCodecsCurrent",""); setNamedCodec(named_codec); setDimensions((enum Resolutions)RI("Resolution", 0)); setFrequency((enum Sound_Freqs)(RI("HaveAudio", 1)?RI("Frequency", 0):NoAudio)); if (frequency>0) { setSamplesize((enum Sample_Sizes)RI("SampleSize", 0)); setChannels((enum Sound_Chans)RI("SndChannels", 0)); } } void CaptureConfig::setDimensions(Resolutions res) { int i = 0; while (restable[i].res != res && restable[i].res != WNONE) i++; if (restable[i].res == res) { over_l = 0; over_r = 0; over_t = 0; over_b = 0; res_w = restable[i].width; res_h = restable[i].height; //cout<<"Resolution: "<= _limit) return 0; frame f; f.data=new char[_w*_h*3+4]; f.status=1; frames.push_back(f); used_frames++; *(int*)(f.data)=i; return f.data+4; */ } void free(char* mem) { if (!mem) { fprintf(stderr,"ERROR: Freeing 0!\n"); return; } int id=*(int*)(mem-4); if (id < 0 || id >= (int)frames.size() || frames[id].data != (mem-4)) { fprintf(stderr,"ERROR: Freeing unknown memory!\n"); return; } if (frames[id].status == 0) { fprintf(stderr, "ERROR: Duplicate free()!\n"); return; } used_frames--; frames[id].status=0; } private: struct frame { char* data; int status; }; avm::vector frames; int _w; int _h; int _limit; int refs; }; CaptureProcess::CaptureProcess(v4lxif* v4l, // v4lx interface pointer CaptureConfig* conf, ClosedCaption* ccap) : m_v4l(v4l), m_qvid(64), m_qaud(64), m_quit(0), m_pProgress(0), m_ccap(ccap), m_pAllocator(0), m_conf(*conf), error(""), segment_flag(0), vid_clear(0), aud_clear(0) { segmenting_name=""; starttime=avm_get_time_us(); if(ccap) { avm::string ccname; if (m_conf.filename.size() >= 4 && (strncasecmp(m_conf.filename.c_str() + m_conf.filename.size() - 4, ".avi", 4) == 0)) ccname=m_conf.filename.substr(0, m_conf.filename.size()-4)+".sub"; else { ccname=m_conf.filename; ccname+=".sub"; } ccfd=open(ccname.c_str(), O_WRONLY|O_CREAT|O_TRUNC, 00666); lastcctime=starttime; ccap->add_callback(capwriter, (void*)this); } else ccfd=-1; int bpp; switch(m_conf.colorspace) { case cspRGB24: default: m_v4l->grabSetParams(m_conf.res_w+m_conf.over_l+m_conf.over_r, m_conf.res_h+m_conf.over_t+m_conf.over_b, VIDEO_PALETTE_RGB24); bpp=24; break; case cspRGB15: m_v4l->grabSetParams(m_conf.res_w+m_conf.over_l+m_conf.over_r, m_conf.res_h+m_conf.over_t+m_conf.over_b, VIDEO_PALETTE_RGB555); bpp=16; break; case cspRGB32: m_v4l->grabSetParams(m_conf.res_w+m_conf.over_l+m_conf.over_r, m_conf.res_h+m_conf.over_t+m_conf.over_b, VIDEO_PALETTE_RGB32); bpp=32; break; case cspYUY2: m_v4l->grabSetParams(m_conf.res_w+m_conf.over_l+m_conf.over_r, m_conf.res_h+m_conf.over_t+m_conf.over_b, VIDEO_PALETTE_YUV422); bpp=16; break; case cspYV12: case cspI420: m_v4l->grabSetParams(m_conf.res_w+m_conf.over_l+m_conf.over_r, m_conf.res_h+m_conf.over_t+m_conf.over_b, VIDEO_PALETTE_YUV420P); bpp=12; break; } int maxframes = m_iMemory/(m_conf.res_w * m_conf.res_h * bpp / 8); if (maxframes < 5) maxframes = 5; m_v4l->setAudioMode(m_conf.chan); if (m_conf.frequency > 0) { m_pDsp = new dsp(); if (m_pDsp->open(m_conf.samplesize, m_conf.chan, m_conf.frequency, m_conf.audio_device.c_str()) < 0)//returns file descriptor throw FATAL("Failed to open audio device"); m_pAudc = new avm::PthreadTask(0, CaptureProcess::audcap_starter, this); } try { m_pAllocator=new frame_allocator(m_conf.res_w,m_conf.res_h,maxframes,bpp); } catch(...) { throw FATAL("Out of memory"); } m_pVidc = new avm::PthreadTask(0, CaptureProcess::vidcap_starter, this); m_pWriter = new avm::PthreadTask(0, CaptureProcess::writer_starter, this); } CaptureProcess::~CaptureProcess() { m_quit=1; fprintf(stderr, "waiting for threads to exit...\n"); delete m_pWriter; fprintf(stderr, "writer has exited...\n"); if(m_conf.frequency>0) delete m_pAudc; fprintf(stderr, "audio capture has exited...\n"); delete m_pVidc; fprintf(stderr, "video capture has...\n"); if(m_ccap) m_ccap->remove_callback(capwriter, (void*)this); if(ccfd) close(ccfd); fprintf(stderr, "All threads exited\n"); while (m_qaud.size()) { chunk& z = m_qaud.front(); if (z.data) delete z.data; m_qaud.pop(); } } void CaptureProcess::capwriter(void* arg, const char* data) { CaptureProcess& a=*(CaptureProcess*)arg; // printf("%s\n", data); if(a.ccfd<0) return; if(a.lastccstring == data) return; char s[4096]; int64_t curtime=avm_get_time_us(); int frame1=(int) ((a.lastcctime-a.starttime)*a.m_conf.fps/(1000000.)); int frame2=(int) ((curtime-a.starttime)*a.m_conf.fps/(1000000.)); if(a.lastccstring.size()==0) { a.lastcctime=curtime; a.lastccstring=data; return; } sprintf(s, "{%d}{%d}", frame1, frame2-1); char* ptr=&s[strlen(s)]; const char* pp=a.lastccstring.c_str(); while(*pp) { if(*pp==0xa) { *ptr++='|'; pp++; } else *ptr++=*pp++; } *ptr++=0xa; *ptr++=0; write(a.ccfd, s, strlen(s)); // printf("%s", s); a.lastccstring=data; a.lastcctime=curtime; } void* CaptureProcess::vidcap() { const float fps = m_conf.fps; cnt=0; cap_drop=0; int w = m_conf.res_w; int h = m_conf.res_h; int line_stride = w + m_conf.over_l + m_conf.over_r; int bpp; switch (m_conf.colorspace) { case cspRGB15: bpp = 2; break; case cspRGB24: bpp = 3; break; case cspRGB32: bpp = 4; break; default: bpp = 1; break; } int start_pad = bpp * (w * m_conf.over_t + m_conf.over_l); int end_pad = bpp * (w * m_conf.over_b + m_conf.over_r); line_stride *= bpp; w *= bpp; //printf("W: %d Stride %d %d %d %d\n", w, line_stride, bpp, start_pad, m_conf.colorspace); while (!m_quit) { int64_t currenttime = avm_get_time_us(); // cerr<= (m_qvid.capacity() - 1)) { avm_usleep(10000); // std::cerr<<"Sleeping"<grabCapture(false); //4lw->avicap_renderer_display(); char* tmpframe = m_pAllocator->alloc(); char* zptr, *fptr; // printf("%f %x %x\n", dist, z, tmpframe); if (tmpframe) { int i; switch (m_conf.colorspace) { case cspRGB15: case cspRGB24: case cspRGB32: default: zptr = z + start_pad + (h - 1) * line_stride; fptr = tmpframe; for (i = 0; i < h; i++) { memcpy(fptr, zptr, w); fptr += w; zptr -= line_stride; } break; case cspYUY2: zptr = z + start_pad*2; fptr = tmpframe; for(i=0; irelease(); fprintf(stderr, "Capture thread exiting\n"); return 0; } void* CaptureProcess::audcap() { float abps=m_conf.samplesize*m_conf.chan*m_conf.frequency/8; int bufsize=0; int blocksize=m_pDsp->getBufSize(); m_pDsp->synch(); audioblock=blocksize; while (!m_quit) { chunk ch; ch.data = new char[audioblock]; //printf("ACT %d %d %f\n", audioblock, m_pDsp->getSize(), abps); double timestamp_shift=(audioblock+m_pDsp->getSize())/abps; if(m_pProgress){ m_pProgress->setTimestampShift(timestamp_shift); } ch.size = m_pDsp->read(ch.data, audioblock); int64_t ct = avm_get_time_us(); //double freq=550000.; //printf("ACT %d %d %f %f\n", audioblock, m_pDsp->getSize(), abps, timestamp_shift); #if 0 if(starttime) ch.timestamp=double(ct-starttime)/(freq*1000.)-timestamp_shift; else ch.timestamp=0; #else #warning "compiling without synchfix!" ch.timestamp = bufsize / abps; #endif #ifdef AVICAP_PARANOIA1 #if 0 char tbuf[300]; sprintf(tbuf,"TIME %f %f %f\n", avm_get_time_diff(ct, starttime) - ch.timestamp, ch.timestamp, timestamp_shift); ParanoiaLog(tbuf); sprintf(tbuf,"ch.timestamp=%f bufsize/abps=%f\n",ch.timestamp,bufsize / abps); ParanoiaLog(tbuf); #endif #endif if (m_qaud.size() < m_qaud.capacity() - 1) { m_qaud.push(ch); bufsize += ch.size; //printf("Blocksze %d %d\n", bufsize, blocksize); if(blocksize/abps>.1) { avm_usleep(10000); } } //else printf("AUDIO qdrop???\n"); //avm_usleep(20000); } delete m_pDsp; m_pDsp = 0; return 0; } void* CaptureProcess::writer() { avm::IWriteFile* file=0; avm::IWriteFile* sfile=0; const avm::CodecInfo* ci=0; // const CodecInfo* ci=0; //use this, if it does not compile... // int p = getpriority(PRIO_PROCESS, 0); //attention: only root is allowed to lower priority // setpriority(PRIO_PROCESS, 0, (p - 3 > -20) ? p - 3 : -20); avm::IVideoWriteStream* stream; avm::IWriteStream* audioStream=0; avm::IAudioWriteStream* audioCompStream=0; uint_t cs; switch (m_conf.colorspace) { case cspRGB24: default: cs=24; break; case cspRGB15: cs=15; break; case cspYUY2: cs=fccYUY2; break; case cspYV12: cs=fccYV12; break; } avm::BitmapInfo bh(m_conf.res_w, m_conf.res_h, cs); if (cs <= 32) bh.SetDirection(1); // upside down image m_conf.codec.header = bh; printf("colorspace = %d 0x%x\n", m_conf.colorspace, cs); uint8_t *buf = NULL; // if(m_conf.deinterlace && ((m_conf.colorspace == cspRGB24) || (m_conf.colorspace == cspYUY2))) if (m_conf.deinterlace) buf = new uint8_t[m_conf.res_w * m_conf.res_h * 3]; const double fps=m_conf.fps; //m_conf.filename=find_filename(m_conf.filename); if(m_conf.never_overwrite) usedname=find_filename(m_conf.filename); else usedname=m_conf.filename; try { if (m_conf.segment_size == -1) //file = avm::CreateWriteFile(m_conf.filename.c_str()); file = avm::CreateWriteFile(usedname.c_str()); else { //sfile = avm::CreateWriteFile(m_conf.filename.c_str(), m_conf.segment_size*1024LL); sfile = avm::CreateWriteFile(usedname.c_str(), m_conf.segment_size*1024LL); file = sfile; } // FILE* zz=fopen("bin/uncompr.bmp", "rb"); stream = file->AddVideoStream(&m_conf.codec, int(1000000./m_conf.fps)); // stream=file->AddStream(AviStream::Video); // ve.Init(fccIV50, (const char*)&bh); } catch (avm::FatalError& e) { e.Print(); error=e.GetDesc(); m_quit=1; return 0; } float abps=(m_conf.samplesize*m_conf.frequency*m_conf.chan)/8; WAVEFORMATEX wfm; wfm.wFormatTag = (uint16_t)m_conf.audio_compressor;//PCM or MP3 wfm.nChannels = (uint16_t)m_conf.chan; wfm.nSamplesPerSec=m_conf.frequency; //wfm.nSamplesPerSec=frequency * chan; CHECK THIS wfm.nAvgBytesPerSec=(int)abps; wfm.nBlockAlign = (uint16_t)((m_conf.samplesize*m_conf.chan)/8); wfm.wBitsPerSample = (uint16_t)m_conf.samplesize; wfm.cbSize=0; // ve.SetQuality(9500); // ve.Start(); stream->SetQuality(m_conf.codec.quality); stream->Start(); fprintf(stderr, "Entering loop\n"); // BITMAPINFOHEADER obh=ve.GetOutputFormat(); // stream->SetFormat((const char*)&obh, sizeof obh); int cnt=0; int64_t audiodata=0LL; int videodata=0; double video_error=0; int hide_video=0; int dup_video=0; double aud_time = 0., vid_time = 0.; comp_drop=0; for (;;) { //printf("SIZE v: %d a: %d %d %f %f\n", m_qvid.size(), m_qaud.size(), m_pAllocator->get_limit(), vid_time, aud_time); while (m_qvid.size() > m_qvid.capacity() - 2) { chunk& ch = m_qvid.front(); vid_time = ch.timestamp; cnt++; if(ch.data) { m_pAllocator->free(ch.data); ch.data = 0; } stream->AddFrame(0); videodata++; comp_drop++; if(m_pProgress) m_pProgress->update(avm_get_time_us()-starttime, vid_time, aud_time, audiodata, file->GetFileSize(), videodata-cnt, 0, m_pAllocator->used_frames, cap_drop, comp_drop, file->GetFileName()); m_qvid.pop(); } if ((m_qvid.size()==0) && (m_qaud.size()==0)) { if (m_quit) break; avm_usleep(10000); continue; } if (m_qaud.size()) { if (!audioStream && !audioCompStream) { if(m_conf.audio_compressor == 0x55) { audioCompStream = file->AddAudioStream(m_conf.audio_compressor, &wfm, m_conf.audio_bitrate*1000/8 ); audioCompStream->Start(); } else { audioStream=file->AddStream(avm::IStream::Audio, &wfm, sizeof(wfm), 1, //uncompressed PCM data (int)abps, //bytes/sec (m_conf.samplesize*m_conf.chan)/8 //bytes/sample ); } } chunk& ch = m_qaud.front(); aud_time = ch.timestamp; audiodata += ch.size; if(m_conf.audio_compressor == 0x55){ audioCompStream->AddData(ch.data, ch.size); }else{ audioStream->AddChunk(ch.data, ch.size, audioStream->KEYFRAME); } double audio_error=audiodata/abps-ch.timestamp; if(m_pProgress){ m_pProgress->update(avm_get_time_us()-starttime, vid_time, aud_time, audiodata, file->GetFileSize(), videodata-cnt, -1, m_pAllocator->used_frames, cap_drop, comp_drop, file->GetFileName()); m_pProgress->setAudioError(audio_error); } //double audio_error=audiodata/abps-ch.timestamp; if(audio_errorvideo_error+5./fps){ dup_video=1; #ifdef AVICAP_PARANOIA1 ParanoiaLog("duplicating frame\n"); #endif } delete[] ch.data; ch.data = 0; m_qaud.pop(); } if(m_qvid.size()) { chunk& ch = m_qvid.front(); vid_time = ch.timestamp; if (m_qaud.size() && vid_time < m_qaud.front().timestamp) continue; cnt++; if(!hide_video) { videodata++; avm::CImage* im = 0; size_t uiSize; int iKeyframe; if (ch.data) { if (buf) { if (m_conf.colorspace == cspRGB24) copy_deinterlace_24(buf, ch.data, 3* m_conf.res_w, m_conf.res_h); else if(m_conf.colorspace == cspYUY2) deinterlace_bob_yuv_mmx(buf, ch.data, 2 * m_conf.res_w, m_conf.res_h); else fprintf(stderr, "wrong colorspace\n"); im = new avm::CImage(&bh, buf, false); }else im = new avm::CImage(&bh, (unsigned char*)ch.data, false); } int result = stream->AddFrame(im, &uiSize, &iKeyframe); //printf("ADDFRAME %d %d %d\n", cnt, uiSize, iKeyframe); // fixme - handle errors if (result == 0) { uiSize &= ~0x40000000; if (iKeyframe) uiSize |= 0x40000000; } if(m_pProgress) m_pProgress->update(avm_get_time_us()-starttime, vid_time, aud_time, audiodata, file->GetFileSize(), videodata-cnt, uiSize, m_pAllocator->used_frames, cap_drop, comp_drop, file->GetFileName()); if (dup_video) { videodata++; stream->AddFrame(im, &uiSize); if(m_pProgress) m_pProgress->update(avm_get_time_us()-starttime, vid_time, aud_time, audiodata, file->GetFileSize(), videodata-cnt, uiSize, m_pAllocator->used_frames, cap_drop, comp_drop, file->GetFileName()); video_error+=1./fps; } if (im) im->Release(); } else video_error-=1./fps; dup_video=hide_video=0; if (m_pProgress) m_pProgress->setVideoError(video_error); if(ch.data) { m_pAllocator->free(ch.data); ch.data = 0; } m_qvid.pop(); } if (segment_flag && sfile) { segment_flag = 0; sfile->SegmentAtKeyframe(); // vid_clear=aud_clear=0; } if (segmenting_name!=""){ sfile->SetSegmentName(segmenting_name); segmenting_name=""; } if (m_conf.timelimit!=-1 && (aud_time>m_conf.timelimit || vid_time>m_conf.timelimit)) m_quit = 1; if (m_conf.sizelimit!=-1 && (file->GetFileSize() > m_conf.sizelimit*1024LL)) m_quit = 1; } delete[] buf; delete file; m_pAllocator->release(); // if(stream) delete stream; // if(audioStream) delete audioStream; // if(audioCompStream) delete audioCompStream; printf("RETURN FROM WRITER\n"); return 0; } void CaptureProcess::setMessenger(CaptureProgress* pProgress) { m_pProgress = pProgress; m_pProgress->init(m_conf.filename.c_str(), m_conf.fps, m_conf.res_w, m_conf.res_h, m_conf.frequency, m_conf.samplesize, m_conf.chan, m_pAllocator->get_limit()); } avm::string CaptureProcess::find_filename(avm::string checkname) { FILE *checkfile = fopen(checkname.c_str(),"r"); printf("checkfile %s\n",checkname.c_str()); if(checkfile!=NULL){ fclose(checkfile); avm::string::size_type st=checkname.find(".avi"); if (st == avm::string::npos){ checkname += ".avi"; } else{ checkname.insert(st,"_"); } return find_filename(checkname); } else return checkname; } avifile-0.7.48~20090503.ds/samples/qtvidcap/capproc.h0000644000175000017500000001403407671120556021033 0ustar yavoryavor#ifndef CAPPROC_H #define CAPPROC_H #include #include #include #include class ClosedCaption; class frame_allocator; class dsp; class v4lxif; enum Sound_Freqs { NoAudio = -1, F48, F44, F32, F22, F16, F12, F11, F8 }; enum Sample_Sizes { S16, S8 }; enum Sound_Chans { Mono, Stereo, Lang1, Lang2 }; enum Colorspaces { cspYV12, cspYUY2, cspRGB15, cspRGB24, cspRGB32, cspI420 }; enum Resolutions { WNONE =-1, W160 =0, W192 =1, W320 =2, W384 =3, W400 =4, W512 =5, W576 =6, W640 =7, W768 =8, }; struct chunk { char* data; double timestamp; int size; }; struct CaptureProgress { static const int HISTORY_SIZE = 256; avm::PthreadMutex mutex; int video_frame_len; int buffer_len; int max_frames; int64_t file_size; int64_t enc_time; int64_t video_bytes; int64_t audio_bytes; double video_time; double audio_time; int video_frames; int synch_fix; int video_frame_sizes[HISTORY_SIZE]; int video_frame_head; int buffer_occupancies[HISTORY_SIZE]; int buffer_head; int dropped_cap; int dropped_enc; const char* filename; float framerate; int xdim; int ydim; int audio_freq; int audio_ssize; int audio_channels; double audio_error,video_error,timestamp_shift; CaptureProgress() : video_frame_len(0), buffer_len(0), max_frames(0), file_size(0), enc_time(0), video_bytes(0), audio_bytes(0), video_time(0), audio_time(0), video_frames(0), synch_fix(0), video_frame_head(0), buffer_head(0), dropped_cap(0), dropped_enc(0), audio_error(0),video_error(0), timestamp_shift(0) { } ~CaptureProgress() {} void lock() { mutex.Lock(); } void unlock() { mutex.Unlock(); } void init(const char* fn, float fps, int xd, int yd, int freq, int ssize, int channels, int frames) { lock(); filename=fn; framerate=fps; xdim=xd; ydim=yd; audio_freq=freq; audio_ssize=ssize; audio_channels=channels; max_frames=frames; memset(video_frame_sizes, 0, sizeof(video_frame_sizes)); unlock(); } void update(long long etime, double vidtime, double audtime, long long audbytes, long long fsize, int synchfix, int vframe, int bufstatus, int drop_cap, int drop_enc, const char* fn) { lock(); enc_time = etime; video_time = vidtime; audio_time = audtime; if (vframe > 0) video_bytes += (vframe & ~0x40000000); audio_bytes = audbytes; file_size = fsize; synch_fix = synchfix; if (vframe >= 0) { video_frames++; video_frame_sizes[video_frame_head]=vframe; video_frame_head++; video_frame_head %= HISTORY_SIZE; if (video_frame_len < HISTORY_SIZE) video_frame_len++; buffer_occupancies[buffer_head]=bufstatus; buffer_head++; buffer_head %= HISTORY_SIZE; if (buffer_len < HISTORY_SIZE) buffer_len++; dropped_cap = drop_cap; dropped_enc = drop_enc; } filename = fn; unlock(); } void setVideoError(double val){ lock(); video_error=val; unlock(); } void setAudioError(double val){ lock(); audio_error=val; unlock(); } void setTimestampShift(double val){ lock(); timestamp_shift=val; unlock(); } }; struct CaptureConfig { avm::string filename; bool never_overwrite; int segment_size; // Segmentation is implicit finishing one // file and starting next one when old file // grows to specified size //Kbytes //-1 for no segmentation avm::VideoEncoderInfo codec; // compressor-dependent // for IV 5.0 Quick it's ignored int frequency; // frequency ID //-1 for no audio avm::string audio_device; int audio_compressor; int audio_bitrate; int samplesize; int chan; int res_w; int res_h; int over_t, over_b, over_l, over_r; int timelimit; //in seconds. -1 if no limit int sizelimit; //in Kbytes. -1 if no limit float fps; bool deinterlace; Colorspaces colorspace; void load(); void setNamedCodec(avm::string named_codec); void setDimensions(Resolutions res); void setChannels(Sound_Chans c); void setSamplesize(Sample_Sizes ss); void setFrequency(Sound_Freqs freq); void setFilename(avm::string fname) { filename=fname; }; }; template class lockqring : public avm::qring { avm::PthreadMutex mutex; public: lockqring(uint_t cap) : avm::qring(cap) {} void push(const Type& m) { avm::Locker locker(mutex); avm::qring::push(m); } void pop() { avm::Locker locker(mutex); avm::qring::pop(); } }; class CaptureProcess { public: CaptureProcess(v4lxif* v4l, CaptureConfig* conf, ClosedCaption* ccap); ~CaptureProcess(); void getState(int& finished, avm::string& e) { finished = m_quit; e = error; } void setMessenger(CaptureProgress* pProgress); void segment() { segment_flag = 1; } void setSegmentName(avm::string name) { segmenting_name=name; } protected: void* vidcap(); void* audcap(); void* writer(); static void* vidcap_starter(void* arg) { return ((CaptureProcess*)arg)->vidcap(); } static void* audcap_starter(void* arg) { return ((CaptureProcess*)arg)->audcap(); } static void* writer_starter(void* arg) { return ((CaptureProcess*)arg)->writer(); } static void capwriter(void*, const char*); v4lxif* m_v4l; avm::PthreadTask* m_pVidc; avm::PthreadTask* m_pAudc; avm::PthreadTask* m_pWriter; avm::PthreadTask* m_pSub; lockqring m_qvid; lockqring m_qaud; int m_quit; int cnt; int cap_drop; int comp_drop; int ccfd; int64_t starttime; int64_t lastcctime; avm::string lastccstring; CaptureProgress* m_pProgress; ClosedCaption* m_ccap; frame_allocator* m_pAllocator; CaptureConfig m_conf; dsp* m_pDsp; avm::string error; avm::string segmenting_name; int segment_flag; int vid_clear; int aud_clear; int audioblock; private: avm::string usedname; avm::string find_filename(avm::string checkname); }; #endif /* CAPPROC_H */ avifile-0.7.48~20090503.ds/samples/qtvidcap/ccap.cpp0000644000175000017500000002063707516750561020656 0ustar yavoryavor/** * NTSC closed caption decoder * Based on cc.c from xawtv distribution, written by Mike Baker (mbm@linux.com) * (based on code by timecop@japan.co.jp) **/ #include "ccap.h" #include #include #include #include #include #include #include #include #include #include #include #include "v4lxif.h" const char* const ClosedCaption::specialchar[] = {"®","°","½","¿","(TM)","¢","£","o/~ ","à"," ","è","â","ê","î","ô","û"}; const int ClosedCaption::rowdata[] = {11,-1,1,2,3,4,12,13,14,15,5,6,7,8,9,10}; const char* const ClosedCaption::ratings[] = {"(NOT RATED)","TV-Y","TV-Y7","TV-G","TV-PG","TV-14","TV-MA","(NOT RATED)"}; const char* const ClosedCaption::modes[]={"current","future","channel","miscellaneous","public service","reserved","invalid","invalid","invalid","invalid"}; static inline int parityok(int n) /* check parity for 2 bytes packed in n */ { int mask=0; int j, k; for (k = 1, j = 0; j < 7; j++) { if (n & (1<>7)&1)) mask|=0x00FF; for (k = 1, j = 8; j < 15; j++) { if (n & (1<>15)&1)) mask|=0xFF00; return mask; } static inline int decodebit(unsigned char *data, int threshold) { int i, sum = 0; for (i = 0; i < 23; i++) sum += data[i]; return (sum > threshold*23); } int ClosedCaption::decode(unsigned char *vbiline) { int max[7], min[7], val[7], i, clk, tmp, sample, packedbits = 0; for (clk=0; clk<7; clk++) max[clk] = min[clk] = val[clk] = -1; clk = tmp = 0; i=30; while (i < 600 && clk < 7) { /* find and lock all 7 clocks */ sample = vbiline[i]; if (max[clk] < 0) { /* find maximum value before drop */ if (sample > 85 && sample > val[clk]) (val[clk] = sample, tmp = i); /* mark new maximum found */ else if (val[clk] - sample > 30) /* far enough */ (max[clk] = tmp, i = tmp + 10); } else { /* find minimum value after drop */ if (sample < 85 && sample < val[clk]) (val[clk] = sample, tmp = i); /* mark new minimum found */ else if (sample - val[clk] > 30) /* searched far enough */ (min[clk++] = tmp, i = tmp + 10); } i++; } i=min[6]=min[5]-max[5]+max[6]; if (clk != 7 || vbiline[max[3]] - vbiline[min[5]] < 45) /* failure to locate clock lead-in */ return -1; /* calculate threshold */ for (i=0,sample=0;i<7;i++) sample=(sample + vbiline[min[i]] + vbiline[max[i]])/3; for(i=min[6];vbiline[i] 6) //search for the start { buf++; len--; } if (len == 6) //failure to find start return 0; while (nbytes+6 <= len) { //look for end of object checksum, it's enclosed in []'s and there shouldn't be any [' after if (buf[nbytes] == '[' && buf[nbytes+5] == ']' && buf[nbytes+6] != '[') break; else nbytes++; } if (nbytes+6>len) //failure to find end return 0; nwords = nbytes >> 1; sum = 0; //add up all two byte words while (nwords-- > 0) { sum += *buf++ << 8; sum += *buf++; } if (nbytes & 1) { sum += *buf << 8; } csum = (unsigned short)(sum >> 16); while(csum !=0) { sum = csum + (sum & 0xffff); csum = (unsigned short)(sum >> 16); } sprintf(temp,"%04X\n",(int)~sum&0xffff); buf++; if(!strncmp(buf,temp,4)) { buf[5]=0; printf("\33[35mWEBTV: %s\33[0m\n",buf-nbytes-1); fflush(stdout); } return 0; } int ClosedCaption::CCdecode(int data) { int b1, b2, row, len, x,y; if (data == -1) //invalid data. flush buffers to be safe. { memset(ccbuf[1],0,255); memset(ccbuf[2],0,255); return -1; } b1 = data & 0x7f; b2 = (data>>8) & 0x7f; len = strlen(ccbuf[ccmode]); if (b1&0x60 && data != lastcode) // text { ccbuf[ccmode][len++]=b1; if (b2&0x60) ccbuf[ccmode][len++]=b2; if (b1 == ']' || b2 == ']') webtv_check(ccbuf[ccmode],len); } else if ((b1&0x10) && (b2>0x1F) && (data != lastcode)) //codes are always transmitted twice (apparently not, ignore the second occurance) { ccmode=((b1>>3)&1)+1; len = strlen(ccbuf[ccmode]); if (b2 & 0x40) //preamble address code (row & indent) { row=rowdata[((b1<<1)&14)|((b2>>5)&1)]; if (len!=0) ccbuf[ccmode][len++]='\n'; if (b2&0x10) //row contains indent flag for (x=0;x<(b2&0x0F)<<1;x++) ccbuf[ccmode][len++]=' '; } else { switch (b1 & 0x07) { case 0x00: //attribute printf("\n",b1,b2); fflush(stdout); break; case 0x01: //midrow or char switch (b2&0x70) { case 0x20: //midrow attribute change switch (b2&0x0e) { case 0x00: //italics off if (!plain) // strcat(ccbuf[ccmode],"\33[0m "); strcat(ccbuf[ccmode]," "); break; case 0x0e: //italics on if (!plain) // strcat(ccbuf[ccmode],"\33[36m "); strcat(ccbuf[ccmode]," "); break; } if (b2&0x01) { //underline if (!plain) // strcat(ccbuf[ccmode],"\33[4m"); strcat(ccbuf[ccmode],""); } else { if (!plain) strcat(ccbuf[ccmode],""); // strcat(ccbuf[ccmode],"\33[24m"); } break; case 0x30: //special character.. strcat(ccbuf[ccmode],specialchar[b2&0x0f]); break; } break; case 0x04: //misc case 0x05: //misc + F // printf("ccmode %d cmd %02x\n",ccmode,b2); switch (b2) { case 0x21: //backspace ccbuf[ccmode][len--]=0; break; /* these codes are insignifigant if we're ignoring positioning */ case 0x25: //2 row caption case 0x26: //3 row caption case 0x27: //4 row caption case 0x29: //resume direct caption case 0x2B: //resume text display case 0x2C: //erase displayed memory break; case 0x2D: //carriage return if (ccmode==2) break; case 0x2F: //end caption + swap memory case 0x20: //resume caption (new caption) if (!strlen(ccbuf[ccmode])) break; /* for (x=0;xgetvbidev(); storage[0]=0; if (m_iDev>=0) m_pThread = new avm::PthreadTask(0, threadstarter, (void*)this); } void* ClosedCaption::threadstarter(void* pArg) { ClosedCaption* pObject = (ClosedCaption*)pArg; return pObject->mainloop(); } ClosedCaption::~ClosedCaption() { if (m_iDev>=0) { m_iQuit = 1; delete m_pThread; // close(m_iDev); } } void* ClosedCaption::mainloop() { fd_set rfds; unsigned char buf[65536]; while (!m_iQuit) { timeval tv; tv.tv_sec=5; tv.tv_usec=0; FD_ZERO(&rfds); FD_SET(m_iDev, &rfds); select(m_iDev+1, &rfds, NULL, NULL, &tv); if (FD_ISSET(m_iDev, &rfds)) { if (m_pV4l->readvbi(buf , 65536)!=65536) printf("read error\n"); CCdecode(decode(&buf[2048 * 11])); } else { lock(); storage[0]=0; unlock(); } } return 0; } void ClosedCaption::add_callback(callbackproc p, void* arg) { callback_info ci; ci.proc=p; ci.arg=arg; m_callbacks.push_back(ci); } void ClosedCaption::remove_callback(callbackproc p, void* arg) { for(avm::vector::iterator it=m_callbacks.begin(); it!=m_callbacks.end(); it++) { if(it->proc!=p) continue; if(it->arg!=arg) continue; m_callbacks.erase(it); return; } } avifile-0.7.48~20090503.ds/samples/qtvidcap/ccap.h0000644000175000017500000000266207671120556020316 0ustar yavoryavor#ifndef CCAP_H #define CCAP_H #include #include class v4lxif; class ClosedCaption { public: typedef void (*callbackproc) (void*, const char*); //ClosedCaption(const char* pcDevName="/dev/vbi"); ClosedCaption(v4lxif* pv4l); ~ClosedCaption(); const char* getBuffer() { return storage; } void add_callback(callbackproc p, void* arg); void remove_callback(callbackproc p, void* arg); void addref() { m_iRefcnt++; } void release() { m_iRefcnt--; if (m_iRefcnt==0) delete this; } void lock() { m_mutex.Lock(); } void unlock() { m_mutex.Unlock(); } private: int CCdecode(int data); int decode(unsigned char *vbiline); void* mainloop(); static void* threadstarter(void*); int m_iRefcnt; struct callback_info { callbackproc proc; void* arg; void exec(const char* p) { return proc(arg, p); } }; avm::vector m_callbacks; // Member variables v4lxif* m_pV4l; avm::PthreadTask* m_pThread; avm::PthreadMutex m_mutex; int m_iDev; int m_iQuit; int lastcode; int ccmode; //cc1 or cc2 char plain; char ccbuf[3][256]; //cc is 32 columns per row, this allows for extra characters char storage[256]; // Global constants static const char* const ratings[]; static const int rowdata[]; static const char* const specialchar[]; static const char* const modes[]; }; #endif // CCAP_H avifile-0.7.48~20090503.ds/samples/qtvidcap/deinterlace-rgb.cpp0000644000175000017500000000214010647424672022764 0ustar yavoryavor/* $Id: deinterlace-rgb.cpp,v 1.7 2007/07/18 14:54:50 kabi Exp $ */ #include #include /* copied from qtrenderer.c in avifile package samples/qtvidcap */ void copy_deinterlace_24(void* outpic, const void* inpic, int xdim, int height) { #ifdef ARCH_X86_32 for(int i=0; i #include #include #include #include "deinterlace-yuv.h" /* DeinterlaceFieldBob algorithm Based on Virtual Dub plugin by Gunnar Thalin MMX asm version from dscaler project (deinterlace.sourceforge.net) Linux version for Xine player by Miguel Freitas Todo: use a MMX optimized memcpy */ void deinterlace_bob_yuv_mmx( uint8_t *pdst, uint8_t *psrc, int width, int height ) { #ifdef i386 int Line; long long* YVal1; long long* YVal2; long long* YVal3; long long* Dest; uint8_t* pEvenLines = psrc; uint8_t* pOddLines = psrc+width; unsigned int LineLength = width; int Pitch = width * 2; int IsOdd = 1; long EdgeDetect = 625; long JaggieThreshold = 73; int n; unsigned long long qwEdgeDetect; unsigned long long qwThreshold; const unsigned long long Mask = (unsigned long long)(0xfefefefefefefefeLL); const unsigned long long YMask = (unsigned long long)(0x00ff00ff00ff00ffLL); qwEdgeDetect = EdgeDetect; qwEdgeDetect += (qwEdgeDetect << 48) + (qwEdgeDetect << 32) + (qwEdgeDetect << 16); qwThreshold = JaggieThreshold; qwThreshold += (qwThreshold << 48) + (qwThreshold << 32) + (qwThreshold << 16); // copy first even line no matter what, and the first odd line if we're // processing an odd field. memcpy(pdst, pEvenLines, LineLength); if (IsOdd) memcpy(pdst + LineLength, pOddLines, LineLength); height = height / 2; for (Line = 0; Line < height - 1; ++Line) { if (IsOdd) { YVal1 = (long long *)(pOddLines + Line * Pitch); YVal2 = (long long *)(pEvenLines + (Line + 1) * Pitch); YVal3 = (long long *)(pOddLines + (Line + 1) * Pitch); Dest = (long long *)(pdst + (Line * 2 + 2) * LineLength); } else { YVal1 = (long long *)(pEvenLines + Line * Pitch); YVal2 = (long long *)(pOddLines + Line * Pitch); YVal3 = (long long *)(pEvenLines + (Line + 1) * Pitch); Dest = (long long *)(pdst + (Line * 2 + 1) * LineLength); } // For ease of reading, the comments below assume that we're operating on an odd // field (i.e., that bIsOdd is true). The exact same processing is done when we // operate on an even field, but the roles of the odd and even fields are reversed. // It's just too cumbersome to explain the algorithm in terms of "the next odd // line if we're doing an odd field, or the next even line if we're doing an // even field" etc. So wherever you see "odd" or "even" below, keep in mind that // half the time this function is called, those words' meanings will invert. // Copy the odd line to the overlay verbatim. memcpy((char *)Dest + LineLength, YVal3, LineLength); n = LineLength >> 3; while( n-- ) { movq_m2r (*YVal1++, mm0); movq_m2r (*YVal2++, mm1); movq_m2r (*YVal3++, mm2); // get intensities in mm3 - 4 movq_r2r ( mm0, mm3 ); movq_r2r ( mm1, mm4 ); movq_r2r ( mm2, mm5 ); pand_m2r ( *&YMask, mm3 ); pand_m2r ( *&YMask, mm4 ); pand_m2r ( *&YMask, mm5 ); // get average in mm0 pand_m2r ( *&Mask, mm0 ); pand_m2r ( *&Mask, mm2 ); psrlw_i2r ( 01, mm0 ); psrlw_i2r ( 01, mm2 ); paddw_r2r ( mm2, mm0 ); // work out (O1 - E) * (O2 - E) / 2 - EdgeDetect * (O1 - O2) ^ 2 >> 12 // result will be in mm6 psrlw_i2r ( 01, mm3 ); psrlw_i2r ( 01, mm4 ); psrlw_i2r ( 01, mm5 ); movq_r2r ( mm3, mm6 ); psubw_r2r ( mm4, mm6 ); //mm6 = O1 - E movq_r2r ( mm5, mm7 ); psubw_r2r ( mm4, mm7 ); //mm7 = O2 - E pmullw_r2r ( mm7, mm6 ); // mm6 = (O1 - E) * (O2 - E) movq_r2r ( mm3, mm7 ); psubw_r2r ( mm5, mm7 ); // mm7 = (O1 - O2) pmullw_r2r ( mm7, mm7 ); // mm7 = (O1 - O2) ^ 2 psrlw_i2r ( 12, mm7 ); // mm7 = (O1 - O2) ^ 2 >> 12 pmullw_m2r ( *&qwEdgeDetect, mm7 );// mm7 = EdgeDetect * (O1 - O2) ^ 2 >> 12 psubw_r2r ( mm7, mm6 ); // mm6 is what we want pcmpgtw_m2r ( *&qwThreshold, mm6 ); movq_r2r ( mm6, mm7 ); pand_r2r ( mm6, mm0 ); pandn_r2r ( mm1, mm7 ); por_r2r ( mm0, mm7 ); movq_r2m ( mm7, *Dest++ ); } } // Copy last odd line if we're processing an even field. if (! IsOdd) { memcpy(pdst + (height * 2 - 1) * LineLength, pOddLines + (height - 1) * Pitch, LineLength); } // clear out the MMX registers ready for doing floating point // again emms(); #else #warning missing deinterlace_bob_yuv_mmx #endif } avifile-0.7.48~20090503.ds/samples/qtvidcap/deinterlace-yuv.h0000644000175000017500000002531707433170237022507 0ustar yavoryavor/* * Copyright (C) Thomas Östreich - June 2001 * * This file is part of transcode, a linux video stream processing tool * * --> deinterlace code taken from the xine project: * Copyright (C) 2001 the xine project * * --> mmx.h definitions * Copyright (C) 1997-2001 H. Dietz and R. Fisher * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * xine 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 General Public License for more details. * * You should have received a copy of the GNU 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 * * Deinterlace routines by Miguel Freitas * based of DScaler project sources (deinterlace.sourceforge.net) * * Currently only available for Xv driver and MMX extensions * */ #ifndef __DEINTERLACE_H__ #define __DEINTERLACE_H__ void deinterlace_bob_yuv_mmx( uint8_t *pdst, uint8_t *psrc, int width, int height ); /* * The type of an value that fits in an MMX register (note that long * long constant values MUST be suffixed by LL and unsigned long long * values by ULL, lest they be truncated by the compiler) */ #ifdef ATTRIBUTE_ALIGNED_MAX #define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX // config.h by configure #endif #include "dsp.h" #include #include #include #include #include #include #include #include dsp::dsp() : buffer(0) { } dsp::~dsp() { close(); } static void dump_buf_info(audio_buf_info& z) { printf("%d/%d fragments available\n", z.fragments, z.fragstotal); printf("%d bytes each fragment\n", z.fragsize); printf("%d bytes available\n", z.bytes); } int dsp::open(int bits, int channels, int rate, const char* dev) { int afmt, trigger; fd = ::open(dev, O_RDONLY); if (fd == -1) { fprintf(stderr, "open: %s: %s\n", dev, strerror(errno)); return -1; } ioctl(fd, SNDCTL_DSP_RESET, 0); int frag = (8<<16)|(10); //8 buffers, 1024 bytes each ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &frag); /* format */ switch (bits) { case 16: afmt = AFMT_S16_LE; ioctl(fd, SNDCTL_DSP_SETFMT, &afmt); if (afmt == AFMT_S16_LE) break; /* fall back*/ fprintf(stderr,"no 16 bit sound, trying 8 bit...\n"); bits = 8; case 8: afmt = AFMT_U8; ioctl(fd, SNDCTL_DSP_SETFMT, &afmt); if (afmt != AFMT_U8) { fprintf(stderr,"Oops: no 8 bit sound ?\n"); goto err; } break; default: fprintf(stderr,"%d bit sound not supported\n", bits); goto err; } ioctl(fd, SNDCTL_DSP_CHANNELS, &channels); /* channels */ ioctl(fd, SNDCTL_DSP_SPEED, &rate); /* sample rate */ if (ioctl(fd, SNDCTL_DSP_GETBLKSIZE, &blocksize) == -1) goto err; printf("blocksize: %d\n",blocksize); blocksize *= 4; buffer = (char*)malloc(blocksize); /* trigger record */ trigger = ~PCM_ENABLE_INPUT; ioctl(fd, SNDCTL_DSP_SETTRIGGER, &trigger); trigger = PCM_ENABLE_INPUT; ioctl(fd, SNDCTL_DSP_SETTRIGGER, &trigger); #if 0 struct audio_buf_info z; ioctl(fd, SNDCTL_DSP_GETISPACE, &z); dump_buf_info(z); #endif return fd; err: return -1; } int dsp::close() { if (fd != -1) ::close(fd); if (buffer) free(buffer); buffer = 0; fd = -1; return 0; } int dsp::read(char* rbuffer, int bsize) { int r = ::read(fd, rbuffer, bsize); if (r <= 0) { perror("read /dev/dsp"); return r; } return r; } int dsp::synch() { struct audio_buf_info z; ioctl(fd, SNDCTL_DSP_GETISPACE, &z); dump_buf_info(z); // usleep(100000); // ioctl(fd, SNDCTL_DSP_GETISPACE, &z); // dump_buf_info(z); int bytes_read = 0; while (z.bytes) { int bytes_to_read = z.bytes > blocksize ? blocksize : z.bytes; bytes_to_read = ::read(fd, buffer, bytes_to_read); if (bytes_to_read < 0 && errno != EINTR) break; //printf("Bread %d\n", bytes_to_read); bytes_read += bytes_to_read; z.bytes -= bytes_to_read; } printf("Flushed %d bytes of data from audio buffers\n", bytes_read); return 0; } int dsp::getSize() { struct audio_buf_info z; ioctl(fd, SNDCTL_DSP_GETISPACE, &z); return z.bytes; } avifile-0.7.48~20090503.ds/samples/qtvidcap/dsp.h0000644000175000017500000000057307516750561020200 0ustar yavoryavor#ifndef DSP_H #define DSP_H class dsp { public: dsp(); ~dsp(); int open(int bits, int channels, int rate, const char* dev = "/dev/dsp"); int close(); int getBufSize() { return blocksize; } int getSize(); int read(char* buffer, int size); int synch(); private: dsp(const dsp & ); int fd, blocksize; char *buffer; }; #endif // DSP_H avifile-0.7.48~20090503.ds/samples/qtvidcap/epgbrowser.cpp0000644000175000017500000000067107645155240022117 0ustar yavoryavor#include #include #include #if 0 #if QT_VERSION>=300 #include "epgwindow.h" #endif #endif int main(int argc, char** argv){ #if 0 #if QT_VERSION>=300 QApplication a(argc,argv); EpgWindow *epg=new EpgWindow(); a.setMainWidget(epg); a.exec(); #else printf("no epg with qt2.3.2 yet\n"); #endif #else printf("standalone epg-browser currently disabled\n"); #endif return 0; } avifile-0.7.48~20090503.ds/samples/qtvidcap/epgwindow.cpp0000644000175000017500000012713710474270251021744 0ustar yavoryavor/* EPG (Electronic Program Guide) window for AviCap written 2003 by Alexander Rawass (alexannika@users.sourceforge.net) */ #include #ifndef WIN32 #include #endif #include "vidconf.h" #include "v4lwindow.h" #include "capproc.h" #include "codecdialog.h" #include #include #include #include #include #define DECLARE_REGISTRY_SHORTCUT #include #undef DECLARE_REGISTRY_SHORTCUT #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // atof #include #include #include // atof #include //statfs #include #if QT_VERSION>=300 #include #endif #if 1 //#include #include "epgwindow.h" #include "timertable.h" #include int calcTimeDiff(){ struct tm local; time_t absolute; time(&absolute); localtime_r(&absolute,&local); //printf("gmtoff=%ld \n",local.tm_gmtoff); return local.tm_gmtoff; } EpgWindow::EpgWindow(V4LWindow *v4l,TimerTable *timer) : QWidget(0), avm::AvmOutputLog("EPGWindow") { v4lwin=v4l; timertable=timer; channel_row=0; today_item=-1; regexp_dirty=true; current_recording=NULL; next_recording=NULL; zoom_step=0; strip_y_size=strip_y_default; AVMOUT(AVML_DEBUG, "EPGWindow started"); local_timediff=calcTimeDiff(); //printf("timediff is %ld\n",local_timediff); initWidgets(); makeConfigWidget(0); load(); makeChannelStrips(); conf_channel_view->updateGeometry(); conf_channel_scroll->updateGeometry(); conf_channel_view->adjustSize(); current_date_item=-1; day_selected(today_item); // config_widget->show(); epg_timer=new QTimer(this); connect(epg_timer,SIGNAL(timeout()),SLOT(timer())); epg_timer->start(1000*60); //every minute } EpgWindow::~EpgWindow() { } void EpgWindow::lock(bool lock) { conf_dir_edit->setReadOnly(lock); regexp_edit->setReadOnly(lock); if(lock){ conf_channel_view->hide(); } else{ conf_channel_view->show(); } } void EpgWindow::addEntry(QDateTime start_date,QDateTime stop_date,QString channel_str,QString title,QString desc){ // printf("addEntry %s\n",title.latin1()); EpgTableItem *item=new EpgTableItem(ptable,this,start_date,stop_date,channel_str, title, desc); QDate sdate=start_date.date(); EpgProgram *new_program=new EpgProgram(); new_program->start=start_date; new_program->stop=stop_date; new_program->title=title; new_program->desc=desc; new_program->blockmode=regexp_unset; bool stored_program=false; while(!stored_program){ bool found_day=false; //iterate over dates //EpgDayList::iterator id; QValueListIterator id; for(id=epglist.begin();!found_day && id!=epglist.end();id++){ EpgDay *day=*id; if(sdate==day->date){ found_day=true; //we iterate over channels bool found_channel=false; //EpgChannelList::iterator ic; EpgChannelListIterator ic; for(ic=day->channels.begin();!found_channel && ic!=day->channels.end();ic++){ EpgChannel *ch=*ic; if(ch->chid==channel_str){ found_channel=true; new_program->channelnr=ch->channelnr; ch->programs.append(new_program); stored_program=true; //found=true; } } if(!found_channel){ // add a new channel //printf("creating new channel %s (%s) in day %s\n",channel_str.latin1(),findNameToId(channel_str).latin1(),day->date.toString().latin1()); EpgChannel *newch=new EpgChannel(); newch->chid=channel_str; day->channels.append(newch); //search for the EpgChannelId EpgChIdListIterator icht; bool found_chid=false; for(icht=epgChannels.begin();!found_chid && icht!=epgChannels.end();icht++){ EpgIdChannel *epgidch=*icht; if(epgidch->epgid==newch->chid){ found_chid=true; newch->channelnr=epgidch->chnr; newch->idchannel=epgidch; } } } } } if(!found_day){ // add a new day //printf("creating a new day %s\n",sdate.toString().latin1()); EpgDay *newday=new EpgDay(); newday->date=sdate; epglist.append(newday); QString daydesc=sdate.toString(epg_dateformat); if(QDate::currentDate()==sdate){ daydesc=daydesc+tr(" Today"); } day_selector->insertItem(daydesc); int itemnr=day_selector->count()-1; //printf("day got nr %d\n",itemnr); newday->itemnr=itemnr; if(QDate::currentDate()==sdate){ today_item=itemnr; } // day_selector->changeItem(QString().sprintf("%d",itemnr)+daydesc,itemnr); } }//end while !stored_program } void EpgWindow::doChannel(QDomElement &elem){ // printElem(elem); EpgIdChannel *new_channel=new EpgIdChannel(); new_channel->epgid=elem.attribute("id"); if(new_channel->epgid.isNull()){ printf("didnt get attribute in channel\n"); delete new_channel; return; } QDomNode n=elem.firstChild(); while(!n.isNull()){ QDomElement e=n.toElement(); if(!e.isNull()){ if(e.tagName()=="display-name"){ new_channel->epgname=e.text(); } else{ //ignore } } n=n.nextSibling(); } epgChannels.append(new_channel); QCheckListItem *item=new QCheckListItem(ctable,"test",QCheckListItem::CheckBox); item->setText(0,new_channel->epgname); #if 0 EpgChannelStrip *newstrip=new EpgChannelStrip(gridview,this,new_channel); gridlayout->addWidget(newstrip); // newstrip->repaint(); #endif new_channel->strip=NULL; QHBox *hbox=new QHBox(conf_channel_view); #if 0 new_channel->conf_channel_label=new QLabel(tr("Provider ")+provider+" EPGid "+new_channel->epgid+" "+new_channel->epgname+" is ",hbox); #endif new_channel->conf_channel_label=new QLabel("EPGid "+new_channel->epgid+" ("+new_channel->epgname+") is ",hbox); // conf_channel_lay->addWidget(new_channel->conf_channel_label,channel_row,0); new_channel->conf_channel_box=new QComboBox(hbox); // conf_channel_lay->addWidget(new_channel->conf_channel_box,channel_row,1); new_channel->conf_channel_box->insertItem(tr("not available")); for(int i=0;iconf_channel_box->insertItem(QString().sprintf("%02d - %s",i+1,ACchannelName(i).latin1())); } #if 0 int chnr=RI(QString().sprintf("Epg-%s-%s",provider.latin1(),new_channel->epgid.latin1()),0); #endif int chnr=RI(QString().sprintf("Epg-%s-%s","Provider",new_channel->epgid.latin1()),0); new_channel->conf_channel_box->setCurrentItem(chnr); new_channel->chnr=chnr; //connect(new_channel->conf_channel_box,SIGNAL(activated(int)),this,channelMappingChanged(int)); QPushButton *color_button=new QPushButton(tr("Color"),hbox); // color_button->setToggleButton(false); new_channel->color_button=color_button; QString colstr=RS(QString().sprintf("Epg-%s-%s-Color","Provider",new_channel->epgid.latin1()),"#DDDDDD"); QColor color=QColor(colstr); new_channel->color=color; #if QT_VERSION>=300 color_button->setBackgroundMode(Qt::PaletteBackground); //color_button->setBackgroundMode(Qt::FixedColor); color_button->setPaletteBackgroundColor(color); #else #warning "no color_button->setBackgroundMode(Qt::PaletteBackground)" #endif connect(color_button,SIGNAL(pressed()),this,SLOT(colorSelector())); channel_row++; } #if 0 void EpgWindow::channelMappingChanged(int nr){ } #endif QDateTime EpgWindow::parseDate(QString datestr){ QString yearstr=datestr.mid(0,4); QString monstr=datestr.mid(4,2); QString daystr=datestr.mid(6,2); QString hourstr=datestr.mid(8,2); QString minstr=datestr.mid(10,2); QString secstr=datestr.mid(12,2); QDateTime datetime; datetime.setDate(QDate(yearstr.toInt(),monstr.toInt(),daystr.toInt())); datetime.setTime(QTime(hourstr.toInt(),minstr.toInt(),secstr.toInt())); //allow for localtime datetime=datetime.addSecs(local_timediff); // printf("parsed %s to %s\n",datestr.latin1(),datetime.toString().latin1()); return datetime; } void EpgWindow::doProgramme(QDomElement &elem){ // printElem(elem); QString start_str=elem.attribute("start"); QString stop_str=elem.attribute("stop"); QString channel_str=elem.attribute("channel"); if(start_str.isNull() || stop_str.isNull() || channel_str.isNull()){ printf("didnt get attribute in programme\n"); return; } QDateTime start_date=parseDate(start_str); QDateTime stop_date=parseDate(stop_str); QString title; QString desc; QDomNode n=elem.firstChild(); while(!n.isNull()){ QDomElement e=n.toElement(); if(!e.isNull()){ if(e.tagName()=="title"){ title=e.text(); } else if(e.tagName()=="desc"){ desc=e.text(); } else{ //ignore } } n=n.nextSibling(); } addEntry(start_date,stop_date,channel_str,title,desc); } void EpgWindow::printElem(QDomElement &elem){ printf("tagname=%s ",elem.tagName().latin1()); QDomNamedNodeMap attrmap=elem.attributes(); for(uint i=0; ilayout()); QHBoxLayout *lay1=new QHBoxLayout(topwin); ctable=new QListView(topwin); lay1->addWidget(ctable); ctable->addColumn(tr("Channel")); ctable->setMaximumSize(150,1000); ctable->setAllColumnsShowFocus(true); ctable->setShowSortIndicator(true); ctable->setSorting(0,true); ctable->sort(); centralw=new QWidget(topwin); lay1->addWidget(centralw); QVBoxLayout *lay4=new QVBoxLayout(centralw); QWidget *topstrip=new QWidget(centralw); lay4->addWidget(topstrip); QHBoxLayout *lay6=new QHBoxLayout(topstrip); lay6->setMargin(5); lay6->setSpacing(5); day_selector=new QComboBox(topstrip); lay6->addWidget(day_selector); zoom_in_button=new QPushButton(topstrip); zoom_in_button->setText(tr("ZoomIn")); lay6->addWidget(zoom_in_button); zoom_out_button=new QPushButton(topstrip); zoom_out_button->setText(tr("ZoomOut")); lay6->addWidget(zoom_out_button); display_toggle=new QPushButton(topstrip); display_toggle->setText(tr("toggle display")); lay6->addWidget(display_toggle); config_button=new QPushButton(topstrip); config_button->setText(tr("EPG Config")); lay6->addWidget(config_button); regexp_button=new QPushButton(topstrip); regexp_button->setText(tr("Edit Regexps")); lay6->addWidget(regexp_button); // QVBoxLayout *lay5=new QVBoxLayout(centralw); gridtable=new QTable(centralw); lay4->addWidget(gridtable); #if 0 gridscroll=new QScrollView(centralw); lay4->addWidget(gridscroll); QHBoxLayout *lay3=new QHBoxLayout(gridscroll->viewport()); gridheader=new QHeader(gridscroll); gridheader->setOrientation(Qt::Horizontal); // gridscroll->addChild(gridheader); lay3->addWidget(gridheader); gridview=new QWidget(gridscroll->viewport()); gridscroll->addChild(gridview); lay3->addWidget(gridview); //gridview->setMinimumSize(300,strip_y); //gridscroll->setMaximumSize(600,strip_y); //gridscroll->resizeContents(2000,strip_y); //gridscroll->viewport()->resize(1000,strip_y); gridscroll->setResizePolicy(QScrollView::AutoOneFit); gridscroll->setVScrollBarMode(QScrollView::AlwaysOn); gridscroll->setHScrollBarMode(QScrollView::AlwaysOn); gridlayout=new QHBoxLayout(gridview); gridlayout->setMargin(5); gridlayout->setSpacing(5); #endif ptable=new QListView(centralw); lay4->addWidget(ptable); ptable->addColumn(tr("Title")); ptable->addColumn(tr("Channel")); ptable->addColumn(tr("Start Date")); ptable->addColumn(tr("Stop Date")); ptable->addColumn(tr("Description")); ptable->setAllColumnsShowFocus(true); ptable->setShowSortIndicator(true); ptable->setSorting(2,true); ptable->sort(); ptable->hide(); #if 0 bottom_label=new QLabel("Title\nDescription\n",centralw); bottom_label->setAlignment(Qt::WordBreak); lay4->addWidget(bottom_label); #endif bottom_text=new QTextEdit(centralw); #if QT_VERSION>=300 bottom_text->setTextFormat(Qt::PlainText); #endif bottom_text->setReadOnly(TRUE); lay4->addWidget(bottom_text); //show(); // resizeStrips(); connect(day_selector,SIGNAL(activated(int)),this,SLOT(day_selected(int))); connect(display_toggle,SIGNAL(pressed()),this,SLOT(display_toggled())); connect(config_button,SIGNAL(pressed()),this,SLOT(show_config())); connect(regexp_button,SIGNAL(pressed()),this,SLOT(show_regexps())); connect(timertable,SIGNAL(currentRecordingChanged(TimerTableItem *)),this,SLOT(setCurrentRecording(TimerTableItem *))); connect(timertable,SIGNAL(nextRecordingChanged(TimerTableItem *)),this,SLOT(setNextRecording(TimerTableItem *))); connect(timertable,SIGNAL(timertableChanged()),this,SLOT(timertableModified())); connect(zoom_in_button,SIGNAL(pressed()),this,SLOT(zoomIn())); connect(zoom_out_button,SIGNAL(pressed()),this,SLOT(zoomOut())); display_mode=0; } void EpgWindow::show_config(){ config_widget->show(); } void EpgWindow::show_regexps(){ printf("showing regexps\n"); regexp_box->show(); } void EpgWindow::display_toggled(){ if(display_mode==0){ ptable->show(); gridtable->hide(); display_mode=1; } else if(display_mode==1){ ptable->hide(); gridtable->show(); display_mode=0; } } void EpgWindow::day_selected(int nr){ if(current_date_item!=nr){ //a new day selected regexp_dirty=true; } else{ //just a normal redraw } current_date_item=nr; //printf("selected day %d\n",nr); day_selector->setCurrentItem(nr); #if 0 gridview->repaint(); gridview->update(); #endif // gridtable->repaint(); //gridtable->update(); resizeStrips(); regexp_dirty=false; } void EpgWindow::resizeStrips(){ calcStripSize(); // int strip_y=strip_y_size; EpgChIdListIterator it; for(it=epgChannels.begin();it!=epgChannels.end();it++){ EpgIdChannel *idch=*it; if(idch->strip!=NULL){ //printf("check1\n"); gridtable->setColumnWidth(idch->chnr-1,strip_x); //printf("check2\n"); gridtable->setRowHeight(idch->chnr-1,strip_y_size); //printf("check3\n"); idch->strip->setFixedSize(strip_x,strip_y_size); //printf("check4\n"); //idch->strip->resize(strip_x,strip_y_size); //idch->strip->updateGeometry(); idch->strip->repaint(); } } } void EpgWindow::makeChannelStrips(){ gridtable->setNumRows(1); gridtable->setNumCols(ACnumChannels()); gridtable->setVScrollBarMode(QScrollView::AlwaysOn); gridtable->setHScrollBarMode(QScrollView::AlwaysOn); gridtable->setRowHeight(0,strip_y_default); for(int i=1;ihorizontalHeader()->setLabel(i-1,ACchannelName(i-1)); EpgChIdListIterator ic; bool found_channel=false; for(ic=epgChannels.begin();!found_channel && ic!=epgChannels.end();ic++){ EpgIdChannel *channelid=*ic; if(channelid->chnr==i){ found_channel=true; #if 0 EpgChannelStrip *newstrip=new EpgChannelStrip(gridview,this,channelid); gridlayout->addWidget(newstrip); #endif EpgChannelStrip *newstrip=new EpgChannelStrip(gridtable,this,channelid); gridtable->setCellWidget(0,i-1,newstrip); gridtable->setColumnWidth(i-1,strip_x_default); channelid->strip=newstrip; //,strip_x); } } } } void EpgWindow::addRecording(EpgProgram *prog){ if(prog){ emit emitAddRecording(prog); } } void EpgWindow::timertableModified(){ day_selected(current_date_item); } void EpgWindow::setNextRecording(TimerTableItem *titem){ next_recording=titem; day_selected(current_date_item); } void EpgWindow::setCurrentRecording(TimerTableItem *titem){ current_recording=titem; day_selected(current_date_item); } void EpgWindow::zoomIn(){ zoom_step++; day_selected(current_date_item); } void EpgWindow::zoomOut(){ zoom_step--; day_selected(current_date_item); } void EpgWindow::timer(){ day_selected(current_date_item); } bool EpgWindow::isBlocked(int channelnr){ EpgDay *day=NULL; EpgDayListIterator id; QDateTime currentdatetime=QDateTime::currentDateTime(); for(id=epglist.begin(); id!=epglist.end();id++){ day=*id; bool found_channel=false; EpgChannelListIterator ic; for(ic=day->channels.begin();!found_channel && ic!=day->channels.end();ic++){ EpgChannel *ch=*ic; if(ch->channelnr==channelnr){ found_channel=true; bool found_prog=false; EpgProgramListIterator ip; for(ip=ch->programs.begin();!found_prog && ip!=ch->programs.end();ip++){ EpgProgram *prog=*ip; if(prog->startstop){ //current program if(ch->idchannel->strip->blockMode(prog)== regexp_block){ return true; } } }//for programs }//if channel }//for channels }//for all days return false; } QString EpgWindow::findNameToId(QString channel){ EpgChIdListIterator it; for(it=epgChannels.begin();it!=epgChannels.end();it++){ EpgIdChannel *idch=*it; if(idch->epgid==channel){ return idch->epgname; } } return "noname"; } EpgTableItem::~EpgTableItem() { } EpgTableItem::EpgTableItem(QListView *parent,EpgWindow *epgwindow,QDateTime start,QDateTime stop,QString channelstr,QString titlestr,QString descstr) : QCheckListItem(parent,"test",QCheckListItem::CheckBox){ start_date=start; stop_date=stop; channel=channelstr; title=titlestr; desc=descstr; epgwin=epgwindow; QString startstr=start_date.toString(epg_startdateformat); QString stopstr=stop_date.toString(epg_stopdateformat); chname=epgwin->findNameToId(channel); setText(0,title); setText(1,chname); setText(2,startstr); setText(3,stopstr); setText(4,desc); } int EpgTableItem::compare(QListViewItem *other,int col, bool ascend) const { if(other==NULL){ return 0; } EpgTableItem *other_tti=(EpgTableItem *)other; int result=0; if(col==2){ //start time if(getStartTime()==other_tti->getStartTime()){ result=0; } else{ result=(getStartTime()>other_tti->getStartTime()) ? -1 : 1 ; } } else if(col==3){ //stop time if(getStopDateTime()==other_tti->getStopDateTime()){ result=0; } else{ result=(getStopDateTime()>other_tti->getStopDateTime()) ? -1 : 1; } } else{ #if QT_VERSION>=300 result=QListViewItem::compare(other,col,ascend); #else #warning "no QListViewItem::compare" #endif } return result; } EpgChannelStrip::EpgChannelStrip(QWidget *parent,EpgWindow *win,EpgIdChannel *new_channel) : QWidget(parent){ // printf("strip created for %s\n",new_channel->epgname.latin1()); //setMinimumSize(strip_x,strip_y); //setBaseSize(strip_x,strip_y); setFixedSize(strip_x_default,strip_y_default); setBackgroundColor(white); resize(strip_x_default,strip_y_default); updateGeometry(); setMouseTracking(true); chid=new_channel; epgwin=win; last_mouse_program=NULL; popmenu=NULL; mid_move=false; // QVBoxLayout *lay1=new QVBoxLayout(this); //QHeader *head=new QHeader(this); //lay1->addWidget(head); //head->addLabel(new_channel->epgname); show(); } int EpgChannelStrip::blockMode(EpgProgram *prog){ int j=0; EpgRegexpListIterator it; #if QT_VERSION<300 #define exactMatch(str) match(str) #endif for(it=epgwin->regexpList.begin();it!=epgwin->regexpList.end();it++){ EpgRegexp *epgreg=*it; if(epgreg->blockmode==regexp_errorblock || epgreg->wheremode==regexp_errorwhere){ return regexp_block; } if(epgreg->wheremode==regexp_both){ if(epgreg->regexp.exactMatch(prog->title) || epgreg->regexp.exactMatch(prog->desc)){ return epgreg->blockmode; } } else if(epgreg->wheremode==regexp_title){ if(epgreg->regexp.exactMatch(prog->title)){ return epgreg->blockmode; } } else if(epgreg->wheremode==regexp_desc){ if(epgreg->regexp.exactMatch(prog->desc)){ return epgreg->blockmode; } } } return regexp_nomatch; #if QT_VERSION<300 #undef exactMatch #endif } void EpgWindow::calcStripSize(){ strip_x=strip_x_default+(int)(((float)strip_x_default)*(zoom_increment*zoom_step)); strip_y=strip_y_default+(int)(((float)strip_y_default)*(zoom_increment*zoom_step)); int pixel_per_hour=strip_y_default/24; hours_before=RI("EpgHoursBeforeDay",0); hours_after=RI("EpgHoursAfterDay",0); strip_y_before=0; strip_y_after=0; strip_y_today=strip_y_default; if(hours_before<0){ strip_y_before=-hours_before*60; } else{ strip_y_today-=hours_before*60; } if(hours_after>0){ strip_y_after=hours_after*60; } else{ strip_y_today-=-hours_after*60; } strip_y_alldays=strip_y_before+strip_y_today+strip_y_after; y_subtract=0; if(hours_before>0){ y_subtract=hours_before*60; } strip_y_size=strip_y_alldays; } void EpgChannelStrip::calcYfromTime(int &y_start,int &y_stop,QTime starttime,QTime stoptime){ y_start=(starttime.hour()*60)+starttime.minute(); y_stop=(stoptime.hour()*60)+stoptime.minute(); if(y_stopcalcStripSize(); int strip_x=epgwin->strip_x; int strip_y=epgwin->strip_y; int hours_after=epgwin->hours_after; int hours_before=epgwin->hours_before; int strip_y_before=epgwin->strip_y_before; int strip_y_today=epgwin->strip_y_today; int strip_y_after=epgwin->strip_y_after; int strip_y_alldays=epgwin->strip_y_alldays; int strip_y_size=epgwin->strip_y_size; int y_subtract=epgwin->y_subtract; if(my!=-1){ if(last_mouse_program){ if(last_mouse_program->y_start<=my && my<=last_mouse_program->y_stop-1){ // printf("returned early\n"); return; } } } QPainter paint(this); paint.setWindow(0,0,strip_x,strip_y_alldays); if(my==-1){ paint.eraseRect(0,-20,strip_x,strip_y_alldays); paint.setPen(Qt::black); //paint.drawText(0,20,chid->epgname); paint.lineTo(0,0); paint.lineTo(strip_x,strip_y_alldays); paint.lineTo(0,strip_y_alldays); paint.lineTo(strip_x,0); } EpgProgram *mouse_program=NULL; int today=epgwin->current_date_item; int yesterday=today-1; int tomorrow=today+1; int startday=yesterday; int stopday=tomorrow; if(hours_before>0){ startday=today; } if(hours_after<0){ stopday=today; } //printf("yesterday=%d today=%d tomorrow=%d\n",yesterday,today,tomorrow); //printf("hours_before=%d hours_after=%d\n",hours_before,hours_after); //printf("startday=%d stopday=%d\n",startday,stopday); //printf("strip_y_before=%d strip_y_today=%d strip_y_after=%d\n" // strip_y_before,strip_y_today,strip_y_after); //printf("strip_y_alldays=%d\n",strip_y_alldays); for(int daynr=startday;daynr<=stopday;daynr++){ bool found_day=false; EpgDay *day=NULL; //printf("drawing strip %s for day %d\n",chid->epgname.latin1(),daynr); EpgDayListIterator id; for(id=epgwin->epglist.begin();!found_day && id!=epgwin->epglist.end();id++){ day=*id; if(day->itemnr==daynr){ found_day=true; } } if(!found_day){ printf("ERROR: day not found\n"); return; } bool found_channel=false; int row=0; printf("drawing day %s nr=%d channel %s\n",day->date.toString().latin1(),day->itemnr,chid->epgname.latin1()); EpgChannelListIterator ic; for(ic=day->channels.begin();!found_channel && ic!=day->channels.end();ic++){ EpgChannel *ch=*ic; if(ch->chid==chid->epgid){ found_channel=true; //printf("found my channel\n"); //paint.drawText(0,0,chid->epgname); //we iterate over programs bool found_prog=false; EpgProgramListIterator ip; for(ip=ch->programs.begin();!found_prog && ip!=ch->programs.end();ip++){ EpgProgram *prog=*ip; QColor color=chid->color; QTime starttime=prog->start.time(); QTime stoptime=prog->stop.time(); int y_start,y_stop; calcYfromTime(y_start,y_stop,starttime,stoptime); int drawit=false; if(daynr==yesterday && starttime.hour()>(24+hours_before)){ y_start=y_start-(strip_y_default-strip_y_before); y_stop=y_stop-(strip_y_default-strip_y_before); drawit=true; } else if(daynr==tomorrow && starttime.hour()=0) || \ (hours_before>0 && starttime.hour()>hours_before) || (hours_after<0 && starttime.hour()>(24+hours_after))){ drawit=true; } #endif drawit=true; } if(drawit){ //printf("start=%s (%d) stop=%s (%d)\n",starttime.toString().latin1(),y_start,stoptime.toString().latin1(),y_stop); prog->y_start=y_start; prog->y_stop=y_stop; int ydiff=y_stop-y_start; int y_currenttime=-1; QDateTime currentdatetime=QDateTime::currentDateTime(); if(prog->startstop){ color=colorNow; y_currenttime=strip_y_before+(currentdatetime.time().hour()*60)+currentdatetime.time().minute()-y_subtract; //printf("current prog %s yc=%d\n",prog->title.latin1(),y_currenttime); //printf("strip_y_before=%d y_subtract=%d\n",strip_y_before,y_subtract); } QString startstr=starttime.toString(epg_timeformat); QString stopstr=stoptime.toString(epg_timeformat); QFont font; bool repaint_prog=false; if(prog==last_mouse_program){ if(my!=-2 && (y_start<=my && my<=y_stop-1)){ repaint_prog=false; } else{ repaint_prog=true; } } if(my!=-2 && (y_start<=my && my<=y_stop-1) && prog!=last_mouse_program){ printf("%s %d < %d < %d %s-%s\n",prog->title.latin1(),y_start,my,y_stop,startstr.latin1(),stopstr.latin1()); QString datestr=prog->start.date().toString(); QString fulltext=datestr+" / "+startstr+"-"+stopstr+" "+prog->title+prog->desc; epgwin->bottom_text->setText(fulltext); //color=color.dark(130); color=colorMouse; mouse_program=prog; repaint_prog=true; //found_prog=true; } if(my==-1 || repaint_prog){ //true){ //my==-1 || (y_startregexp_dirty || prog->blockmode==regexp_unset){ //printf("\nre-evaluating blockmode for %s\n",prog->title.latin1()); bmode=blockMode(prog); } else{ bmode=prog->blockmode; } //printf("bmode is %d\n",bmode); if(bmode==regexp_block){ //block color=colorBlock; } else if(bmode==regexp_highlight){ //highlight color=colorHigh; } prog->blockmode=bmode; if(row==0){ color=color.dark(110); row=1; } else{ row=0; } TimerTableItem *titem=epgwin->timertable->firstTableItem(); int by_start=y_start; int by_stop=y_stop; int by_diff=by_stop-by_start; QColor timercol=colorTimer; //const QBrush tbrush(timercol,Qt::BDiagPattern); QBrush tbrush(timercol,Qt::Dense6Pattern); QBrush pbrush(color,Qt::SolidPattern); QBrush xbrush; while(titem!=NULL){ if((titem->getChannel()+1)==prog->channelnr){ if(titem==epgwin->next_recording){ xbrush=QBrush(colorNextRec,Qt::Dense5Pattern); } else if(titem==epgwin->current_recording){ xbrush=QBrush(colorCurRec,Qt::Dense5Pattern); } else{ xbrush=tbrush; } if(titem->getStopDateTime()>prog->start && titem->getStopDateTime()stop){ //titem ends at the start of my block QDateTime tidatetime=titem->getStopDateTime(); QDateTime mydatetime=prog->start; int timediff_secs=mydatetime.secsTo(tidatetime); int timediff_mins=timediff_secs/60; #if 0 QTime titime=titem->getStopDateTime().time(); int t_end=(titime.hour()*60)+titime.minute(); if(t_endtitle.latin1(),y_start,t_end); } if(titem->getStartTime()>prog->start && titem->getStartTime()stop){ //titem begins at the end of my block QDateTime tidatetime=titem->getStartTime(); QDateTime mydatetime=prog->stop; int timediff_mins=(tidatetime.secsTo(mydatetime)/60); //printf("%s begins at end of my block\n",prog->title.latin1()); #if 0 QTime titime=titem->getStartTime().time(); int t_begin=(titime.hour()*60)+titime.minute(); #endif int t_begin=y_stop-timediff_mins; paint.fillRect(0,t_begin,strip_x,y_stop-t_begin,pbrush); paint.fillRect(0,t_begin,strip_x,y_stop-t_begin,xbrush); by_stop=t_begin; } if(titem->getStartTime()start && titem->getStopDateTime()>prog->stop){ //we are completely recorded paint.fillRect(0,by_start,strip_x,by_diff,pbrush); pbrush=xbrush; } } titem=(TimerTableItem *)titem->nextSibling(); } by_diff=by_stop-by_start; if(ydiff>=24){ paint.fillRect(0,by_start,strip_x,by_diff,pbrush); font=QFont("Times",12); paint.setFont(font); paint.drawText(0,y_start+12,prog->title); paint.drawText(0,y_start+24,startstr+"-"+stopstr); } else if(ydiff>=10){ paint.fillRect(0,by_start,strip_x,by_diff,pbrush); font=QFont("Times",10); paint.setFont(font); paint.drawText(0,y_start+10,prog->title); //paint.drawText(0,y_start+20,startstr+"-"+stopstr); } else if(ydiff>=5){ paint.fillRect(0,by_start-2,strip_x,by_diff+2,pbrush); font=QFont("Times",10); paint.setFont(font); paint.drawText(0,y_start+5,prog->title); } else{ //no text, too small } if(y_currenttime!=-1){ QPen oldpen=paint.pen(); QColor newcolor=color.light(110); paint.setPen(newcolor); paint.drawLine(0,y_currenttime,strip_x,y_currenttime); paint.setPen(oldpen); } } }//end if drawit }//iter programs }//end we have found our channel }//iter channels }//end for day if(mouse_program){ last_mouse_program=mouse_program; } paint.end(); // epgwin->regexp_dirty=false; } void EpgChannelStrip::resizeEvent(QResizeEvent *event){ //printf("strip: resizeEvent()\n"); //resize(strip_x,strip_y); // updateGeometry(); // drawStrip(-1,-1); } void EpgChannelStrip::paintEvent(QPaintEvent *event){ //printf("strip: paintEvent()\n"); //resize(strip_x,strip_y); //setFixedSize(strip_x,strip_y); //adjustSize(); // epgwin->gridtable->adjustSize(); drawStrip(-1,-1); } void EpgChannelStrip::leaveEvent(QEvent *e){ //printf("leaveevent\n"); drawStrip(-1,-2); last_mouse_program=NULL; } void EpgChannelStrip::mouseReleaseEvent(QMouseEvent *e){ if(e->button()==Qt::MidButton){ //printf("mid released while moving mouse\n"); mid_move=false; } } void EpgChannelStrip::mouseMoveEvent(QMouseEvent *e){ // return; // printf("mousemove\n"); drawStrip(-1,e->y()); if(mid_move){ int x=e->globalX(); int y=e->globalY(); int dx=x-mid_move_x; int dy=y-mid_move_y; // printf("mid pressed while moving mouse x=%d y=%d mx=%d my=%d dx=%d dy=%d\n",x,y,mid_move_x,mid_move_y,dx,dy); //epgwin->gridtable->scrollBy(dx,dy); //dx=(dx>=0)?1:-1; //dy=(dy>=0)?1:-1; epgwin->gridtable->scrollBy(-dx,-dy); mid_move_x=x; mid_move_y=y; } } void EpgChannelStrip::addrecording(){ if(popmenu && pop_program){ epgwin->addRecording(pop_program); } } void EpgChannelStrip::addblock(){ if(popmenu && pop_program){ epgwin->regexp_edit->append("title:block:^"+pop_program->title+"$"); epgwin->okSettings(); } } void EpgChannelStrip::addhighlight(){ if(popmenu && pop_program){ epgwin->regexp_edit->append("title:high:^"+pop_program->title+"$"); epgwin->okSettings(); } } void EpgChannelStrip::mousePressEvent(QMouseEvent *e){ if(e->button()==Qt::MidButton){ //printf("midbutton press\n"); mid_move=true; mid_move_x=e->globalX(); mid_move_y=e->globalY(); } else if(e->button()==Qt::RightButton){ if(popmenu){ delete popmenu; popmenu=NULL; pop_program=NULL; } if(last_mouse_program){ pop_program=last_mouse_program; popmenu=new QPopupMenu(); QString startstr=last_mouse_program->start.time().toString(epg_timeformat); QString stopstr=last_mouse_program->stop.time().toString(epg_timeformat); QString header=startstr+"-"+stopstr+" "+last_mouse_program->title; popmenu->insertItem(header); QString regstr="^"+last_mouse_program->title+"$"; popmenu->insertItem(tr("block title ")+regstr,this,SLOT(addblock())); popmenu->insertItem(tr("highlight title ")+regstr,this,SLOT(addhighlight())); popmenu->insertItem(tr("add to recordings"),this,SLOT(addrecording())); popmenu->insertItem(tr("Description")); //popmenu->insertItem(last_mouse_program->desc); popmenu->popup(mapToGlobal(e->pos())); } }//rightbutton } void EpgWindow::makeConfigWidget(QWidget *parent){ config_widget=new QVGroupBox("EPG Settings",parent); config_widget->setBaseSize(600,400); config_widget->setCaption("EPG Config"); QHBoxLayout *lay1=new QHBoxLayout(config_widget); QLabel *l1=new QLabel(tr("EPG xml filename\nchanges take effect only after restart of avicap"),config_widget); lay1->addWidget(l1); conf_dir_edit=new QLineEdit(config_widget); lay1->addWidget(conf_dir_edit); conf_dir_edit->setText(RS("Epg-ProviderFilename","/tmp/epg.xml")); QHBox *hbox_hours=new QHBox(config_widget); hours_before_spinbox=new QSpinBox(-24,24,1,hbox_hours); hours_before_spinbox->setPrefix(tr("day starts at ")); hours_before_spinbox->setSuffix(tr(" hours")); hours_before_spinbox->setValue(RI("EpgHoursBeforeDay",0)); hours_after_spinbox=new QSpinBox(-24,24,1,hbox_hours); hours_after_spinbox->setPrefix(tr("day ends at ")); hours_after_spinbox->setSuffix(tr(" hours")); hours_after_spinbox->setValue(RI("EpgHoursAfterDay",0)); QHBox *hbox_mins=new QHBox(config_widget); mins_before_spinbox=new QSpinBox(0,60,1,hbox_mins); mins_before_spinbox->setPrefix(tr("recording starts ")); mins_before_spinbox->setSuffix(tr(" mins before program")); int minbefore=RI("EpgMinBeforeProgram",5); mins_before_spinbox->setValue(minbefore); mins_after_spinbox=new QSpinBox(0,60,1,hbox_mins); mins_after_spinbox->setPrefix(tr("recording ends ")); mins_after_spinbox->setSuffix(tr(" mins after program")); mins_after_spinbox->setValue(RI("EpgMinAfterProgram",5)); QVBoxLayout *lay2=new QVBoxLayout(config_widget); QVGroupBox *sbox=new QVGroupBox(tr("EPG Provider to Avicap channel mappings"),config_widget); conf_channel_scroll=new QScrollView(sbox); // lay2->addWidget(conf_channel_scroll); //QHBoxLayout *lay20=new QHBoxLayout(conf_channel_scroll->viewport()); conf_channel_view=new QVBox(conf_channel_scroll->viewport()); conf_channel_scroll->addChild(conf_channel_view); //lay20->addWidget(conf_channel_view); conf_channel_scroll->setResizePolicy(QScrollView::AutoOneFit); conf_channel_scroll->setVScrollBarMode(QScrollView::AlwaysOn); conf_channel_scroll->setHScrollBarMode(QScrollView::AlwaysOn); conf_channel_scroll->setBaseSize(400,300); //conf_channel_lay=new QGridLayout(conf_channel_view,1,1); //conf_channel_lay->setSpacing(5); //conf_channel_lay->setMargin(5); regexp_box=new QVGroupBox(tr("Edit Regexps"),0); regexp_box->setCaption(tr("EPG Edit Regexps")); regexp_box->setBaseSize(400,600); regexp_edit=new QTextEdit(regexp_box); #if QT_VERSION>=300 regexp_edit->setTextFormat(Qt::PlainText); #endif regexp_edit->setReadOnly(false); QHGroupBox *regexp_abox=new QHGroupBox(tr("actions"),regexp_box); reg_ok_button=new QPushButton(tr("Ok/Save"),regexp_abox); reg_reread_button=new QPushButton(tr("Re-read from file"),regexp_abox); connect(reg_ok_button,SIGNAL(pressed()),this,SLOT(okSettings())); connect(reg_reread_button,SIGNAL(pressed()),this,SLOT(rereadRegexps())); QHGroupBox *bbox=new QHGroupBox(tr("actions"),config_widget); ok_button=new QPushButton(tr("Ok/Save"),bbox); connect(ok_button,SIGNAL(pressed()),this,SLOT(okSettings())); rereadRegexps(); //okSettings(); } void EpgWindow::colorSelector(){ EpgChIdListIterator ic; int i=0; bool found_button=false; for(ic=epgChannels.begin();!found_button && ic!=epgChannels.end();ic++){ EpgIdChannel *channelid=*ic; if(channelid->color_button->isDown()){ found_button=true; //this button was pressed #if QT_VERSION>=300 channelid->color=QColorDialog::getColor(); //channelid->color_button->setPaletteForegroundColor(channelid->color); channelid->color_button->setPaletteBackgroundColor(channelid->color); #else channelid->color=QColorDialog::getColor(channelid->color); #endif channelid->color_button->setOn(false); channelid->color_button->setDown(false); } } } void EpgWindow::rereadRegexps(){ struct passwd* pwent = getpwuid(getuid()); QString homedir = pwent->pw_dir; QString filename=homedir+"/.avm/avicap-regexps"; QFile file(filename); bool ok=file.open(IO_ReadOnly); if(ok){ QTextStream stream(&file); regexp_edit->setText(stream.read()); file.close(); } else{ printf("cannot read regexp file\n"); } okSettings(); } void EpgWindow::okSettings(){ EpgChIdListIterator ic; int i=0; WS("Epg-ProviderFilename",conf_dir_edit->text()); for(ic=epgChannels.begin();ic!=epgChannels.end();ic++){ EpgIdChannel *channelid=*ic; int channelnum=channelid->conf_channel_box->currentItem(); channelid->chnr=channelnum; #define WS_CH(sub,str,count) { \ WS(QString().sprintf("EpgChMap-%02d-%s",count,sub),str); \ } //WS_CH("EpgId",channelid->epgid,i); //WS_CH("Provider",provider,i); //WS_CH("ChannelNum",QString::number(channelnum),i); #if 0 WI(QString().sprintf("Epg-%s-%s",provider.latin1(),channelid->epgid.latin1()),QString::number(channelnum)); WS(QString().sprintf("Epg-%s-%s-Color",provider.latin1(),channelid->epgid.latin1()),channelid->color.name()); #endif WI(QString().sprintf("Epg-%s-%s","Provider",channelid->epgid.latin1()),QString::number(channelnum)); WS(QString().sprintf("Epg-%s-%s-Color","Provider",channelid->epgid.latin1()),channelid->color.name()); i++; } WI("EpgHoursBeforeDay",hours_before_spinbox->value()); WI("EpgHoursAfterDay",hours_after_spinbox->value()); WI("EpgMinBeforeProgram",mins_before_spinbox->value()); WI("EpgMinAfterProgram",mins_after_spinbox->value()); //write regexps to plain file struct passwd* pwent = getpwuid(getuid()); QString homedir = pwent->pw_dir; QString filename=homedir+"/.avm/avicap-regexps"; QFile file(filename); bool ok=file.open(IO_WriteOnly); if(ok){ QTextStream stream(&file); stream << regexp_edit->text(); file.close(); } else{ printf("cannot write regexp file\n"); } QStringList strlist=QStringList::split("\n",regexp_edit->text(),false); #if 0 //delete old regexps for(uint k=0;k0){ QValueListIterator it; it=regexpList.begin(); regexpList.remove(it); } //create new regexps int j=0; for (QStringList::Iterator it=strlist.begin(); it != strlist.end();it++ ) { QString str=*it; //printf("+%s+\n",str.latin1()); //WS(QString().sprintf("Epg-Regexp-%02d",j),str); EpgRegexp *epgreg=new EpgRegexp(); QString regexp0=str; if(regexp0[0]!='#'){ QString regexp; int mode=regexp_errorwhere;; if(regexp0.left(both_string.length())==both_string){ mode=regexp_both; regexp=regexp0.right(regexp0.length()-both_string.length()); //printf("both!\n"); } else if(regexp0.left(title_string.length())==title_string){ mode=regexp_title; regexp=regexp0.right(regexp0.length()-title_string.length()); } else if(regexp0.left(desc_string.length())==desc_string){ mode=regexp_desc; regexp=regexp0.right(regexp0.length()-desc_string.length()); } else{ printf("error in regexp: %s\n",regexp0.latin1()); mode=regexp_errorwhere; } int bmode=regexp_block; if(regexp.left(block_string.length())==block_string){ //printf("checking block for %s\n",regexp.latin1()); epgreg->regstr=regexp.right(regexp.length()-block_string.length()); //printf("regexp is +%s+\n",reg.latin1()); bmode=regexp_block; } else if(regexp.left(high_string.length())==high_string){ //printf("checking high for %s\n",regexp.latin1()); epgreg->regstr=regexp.right(regexp.length()-high_string.length()); //printf("regexp is +%s+\n",reg.latin1()); bmode=regexp_highlight; } else{ printf("error in regexp: %s\n",regexp.latin1()); bmode=regexp_errorblock; } epgreg->regexp=QRegExp(epgreg->regstr,false,false); epgreg->wheremode=mode; epgreg->blockmode=bmode; regexpList.append(epgreg); } j++; } // WS(QString().sprintf("Epg-Regexp-%02d",j),"NONE"); avm::RegSave(); regexp_dirty=true; day_selected(current_date_item); // WS_CH("EpgId","NONE",i); } #include "epgwindow.moc" #else #warning "no epgwindow" #endif avifile-0.7.48~20090503.ds/samples/qtvidcap/epgwindow.h0000644000175000017500000001615511110410364021373 0ustar yavoryavor/* EPG window for AviCap written 2003 by Alexander Rawass (alexannika@users.sourceforge.net) */ #ifndef EPGWINDOW_H #define EPGWINDOW_H #include #include #include #include #include #include #include #include #include #include class v4lxif; class V4LWindow; class QPopupMenu; class QLabel; class QListView; class QComboBox; class QDateTimeEdit; class QTimeEdit; class QSplitter; class QGroupBox; class QPushButton; class QButtonGroup; class QLineEdit; class QListViewItem; class QFrame; class QMessageBox; class QHBoxLayout; class QVGroupBox; class QHGroupBox; class QHBox; class QVBox; class QTable; class QSpinBox; #if QT_VERSION >=300 class QTextEdit; #else #include #define QTextEdit QMultiLineEdit #endif class TimerTable; class TimerTableItem; #if QT_VERSION>=300 static const QString epg_timeformat="hh:mm"; static const QString epg_dateformat="dd MMM yyyy (ddd)"; static const QString epg_startdateformat=("dd MMM yyyy "+epg_timeformat+" ddd"); static const QString epg_stopdateformat=epg_timeformat; #else #define epg_timeformat #define epg_dateformat #define epg_startdateformat #define epg_stopdateformat #endif static const QString block_string="block:"; static const QString high_string="high:"; static const QString both_string="both:"; static const QString title_string="title:"; static const QString desc_string="desc:"; static int strip_x_default=100; static int strip_y_default=60*24; static float zoom_increment=0.5f; class EpgProgram { public: QDateTime start; QDateTime stop; QString title; QString desc; int blockmode; int y_stop,y_start; int channelnr; }; typedef QValueList EpgProgramList; typedef QValueListIterator EpgProgramListIterator; class EpgIdChannel; class EpgChannel { public: QString chid; int channelnr; EpgIdChannel *idchannel; EpgProgramList programs; }; typedef QValueList EpgChannelList; typedef QValueListIterator EpgChannelListIterator; class EpgDay { public: QDate date; int itemnr; EpgChannelList channels; }; typedef QValueList EpgDayList; typedef QValueListIterator EpgDayListIterator; class EpgChannelStrip; class EpgIdChannel { public: QString epgid; QString epgname; QString username; int chnr; EpgChannelStrip *strip; QLabel *conf_channel_label; QComboBox *conf_channel_box; QPushButton *color_button; QColor color; }; typedef QValueList EpgChIdList; typedef QValueListIterator EpgChIdListIterator; class EpgWindow; class EpgRegexp { public: QRegExp regexp; QString regstr; int blockmode; int wheremode; }; typedef QValueList EpgRegexpList; typedef QValueListIterator EpgRegexpListIterator; enum blockmode_t { regexp_errorblock,regexp_unset,regexp_nomatch,regexp_highlight,regexp_block }; enum wheremode_t { regexp_errorwhere,regexp_title,regexp_desc,regexp_both }; class EpgChannelStrip : public QWidget { Q_OBJECT public: EpgChannelStrip(QWidget *parent,EpgWindow *win,EpgIdChannel *new_channel); ~EpgChannelStrip() { return ; }; void paintEvent(QPaintEvent *event); void resizeEvent(QResizeEvent *event); void drawStrip(int x,int y); void mouseMoveEvent(QMouseEvent *e); void leaveEvent(QEvent *e); int blockMode(EpgProgram *prog); void mousePressEvent(QMouseEvent *e); void mouseReleaseEvent(QMouseEvent *e); public slots: void addblock(); void addhighlight(); void addrecording(); private: void calcYfromTime(int &y_start,int &y_stop,QTime starttime,QTime stoptime); EpgIdChannel *chid; EpgWindow *epgwin; EpgProgram *last_mouse_program; QPopupMenu *popmenu; EpgProgram *pop_program; bool mid_move; int mid_move_x,mid_move_y; }; class EpgTableItem : public QCheckListItem { public: EpgTableItem(QListView *parent,EpgWindow *epgwin,QDateTime start_date,QDateTime stop_date,QString channel_str,QString title,QString desc); ~EpgTableItem(); int compare(QListViewItem *other,int col, bool ascend) const ; QDateTime getStartTime() const { return start_date; }; QDateTime getStopDateTime() const { return stop_date; }; QDateTime start_date,stop_date; QString channel,title,desc,chname; EpgWindow *epgwin; }; class EpgWindow : public QWidget, public avm::AvmOutputLog { Q_OBJECT; public: EpgWindow(V4LWindow *v4l,TimerTable *timer); ~EpgWindow(); QString findNameToId(QString channel); void makeConfigWidget(QWidget *parent); void addRecording(EpgProgram *prog); bool isBlocked(int chnr); void lock(bool lock); void calcStripSize(); void resizeStrips(); EpgDayList epglist; EpgChIdList epgChannels; int current_date_item; bool regexp_dirty; TimerTable *timertable; EpgRegexpList regexpList; TimerTableItem *next_recording,*current_recording; QLabel *bottom_label; QTextEdit *bottom_text; QWidget *gridview; QScrollView *gridscroll; QHeader *gridheader; QTable *gridtable; QTextEdit *regexp_edit; int zoom_step; int strip_y_size,strip_x,strip_y,hours_before,hours_after; int strip_y_before,strip_y_after,strip_y_today; int strip_y_alldays,y_subtract; signals: void emitAddRecording(EpgProgram *prog); public slots: void display_toggled(); void day_selected(int nr); void okSettings(); void colorSelector(); void rereadRegexps(); void show_config(); void show_regexps(); void setCurrentRecording(TimerTableItem *titem); void setNextRecording(TimerTableItem *titem); void timertableModified(); void timer(); void zoomIn(); void zoomOut(); private: void load(); void load(QString fname); void parse(QDomDocument &dom); void printElem(QDomElement &elem); void doProgramme(QDomElement &elem); void doChannel(QDomElement &elem); QDateTime parseDate(QString datestr); void initWidgets(); void makeChannelStrips(); void addEntry(QDateTime start_date,QDateTime stop_date,QString channel_str,QString title,QString desc); QTimer *epg_timer; QListView *ctable,*ptable; QComboBox *day_selector; QPushButton *display_toggle; QPushButton *config_button,*regexp_button; QWidget *centralw; QVGroupBox *regexp_box; QPushButton *zoom_in_button,*zoom_out_button; QHBoxLayout *gridlayout; QString provider; int channel_row; QLineEdit *conf_dir_edit; QScrollView *conf_channel_scroll; QGridLayout *conf_channel_lay; QVBox *conf_channel_view; QVGroupBox *config_widget; QPushButton *ok_button; QSpinBox *hours_before_spinbox,*hours_after_spinbox; QSpinBox *mins_before_spinbox,*mins_after_spinbox; QPushButton *reg_ok_button,*reg_reread_button; int display_mode; int today_item; V4LWindow *v4lwin; long local_timediff; int ACnumChannels(){ return v4lwin->getStations(); }; QString ACchannelName(int i) { return QString(v4lwin->getXawtvStation(i).c_str()); }; }; #endif avifile-0.7.48~20090503.ds/samples/qtvidcap/frequencies.c0000644000175000017500000007046610473077715021725 0ustar yavoryavor#include #include #include struct STRTAB { long nr; const char *str; }; #include "frequencies.h" //#include "grab-ng.h" /* --------------------------------------------------------------------- */ /* US broadcast */ static struct CHANLIST ntsc_bcast[] = { { "2", 55250 }, { "3", 61250 }, { "4", 67250 }, { "5", 77250 }, { "6", 83250 }, { "7", 175250 }, { "8", 181250 }, { "9", 187250 }, { "10", 193250 }, { "11", 199250 }, { "12", 205250 }, { "13", 211250 }, { "14", 471250 }, { "15", 477250 }, { "16", 483250 }, { "17", 489250 }, { "18", 495250 }, { "19", 501250 }, { "20", 507250 }, { "21", 513250 }, { "22", 519250 }, { "23", 525250 }, { "24", 531250 }, { "25", 537250 }, { "26", 543250 }, { "27", 549250 }, { "28", 555250 }, { "29", 561250 }, { "30", 567250 }, { "31", 573250 }, { "32", 579250 }, { "33", 585250 }, { "34", 591250 }, { "35", 597250 }, { "36", 603250 }, { "37", 609250 }, { "38", 615250 }, { "39", 621250 }, { "40", 627250 }, { "41", 633250 }, { "42", 639250 }, { "43", 645250 }, { "44", 651250 }, { "45", 657250 }, { "46", 663250 }, { "47", 669250 }, { "48", 675250 }, { "49", 681250 }, { "50", 687250 }, { "51", 693250 }, { "52", 699250 }, { "53", 705250 }, { "54", 711250 }, { "55", 717250 }, { "56", 723250 }, { "57", 729250 }, { "58", 735250 }, { "59", 741250 }, { "60", 747250 }, { "61", 753250 }, { "62", 759250 }, { "63", 765250 }, { "64", 771250 }, { "65", 777250 }, { "66", 783250 }, { "67", 789250 }, { "68", 795250 }, { "69", 801250 }, { "70", 807250 }, { "71", 813250 }, { "72", 819250 }, { "73", 825250 }, { "74", 831250 }, { "75", 837250 }, { "76", 843250 }, { "77", 849250 }, { "78", 855250 }, { "79", 861250 }, { "80", 867250 }, { "81", 873250 }, { "82", 879250 }, { "83", 885250 }, }; /* US cable */ static struct CHANLIST ntsc_cable[] = { { "1", 73250 }, { "2", 55250 }, { "3", 61250 }, { "4", 67250 }, { "5", 77250 }, { "6", 83250 }, { "7", 175250 }, { "8", 181250 }, { "9", 187250 }, { "10", 193250 }, { "11", 199250 }, { "12", 205250 }, { "13", 211250 }, { "14", 121250 }, { "15", 127250 }, { "16", 133250 }, { "17", 139250 }, { "18", 145250 }, { "19", 151250 }, { "20", 157250 }, { "21", 163250 }, { "22", 169250 }, { "23", 217250 }, { "24", 223250 }, { "25", 229250 }, { "26", 235250 }, { "27", 241250 }, { "28", 247250 }, { "29", 253250 }, { "30", 259250 }, { "31", 265250 }, { "32", 271250 }, { "33", 277250 }, { "34", 283250 }, { "35", 289250 }, { "36", 295250 }, { "37", 301250 }, { "38", 307250 }, { "39", 313250 }, { "40", 319250 }, { "41", 325250 }, { "42", 331250 }, { "43", 337250 }, { "44", 343250 }, { "45", 349250 }, { "46", 355250 }, { "47", 361250 }, { "48", 367250 }, { "49", 373250 }, { "50", 379250 }, { "51", 385250 }, { "52", 391250 }, { "53", 397250 }, { "54", 403250 }, { "55", 409250 }, { "56", 415250 }, { "57", 421250 }, { "58", 427250 }, { "59", 433250 }, { "60", 439250 }, { "61", 445250 }, { "62", 451250 }, { "63", 457250 }, { "64", 463250 }, { "65", 469250 }, { "66", 475250 }, { "67", 481250 }, { "68", 487250 }, { "69", 493250 }, { "70", 499250 }, { "71", 505250 }, { "72", 511250 }, { "73", 517250 }, { "74", 523250 }, { "75", 529250 }, { "76", 535250 }, { "77", 541250 }, { "78", 547250 }, { "79", 553250 }, { "80", 559250 }, { "81", 565250 }, { "82", 571250 }, { "83", 577250 }, { "84", 583250 }, { "85", 589250 }, { "86", 595250 }, { "87", 601250 }, { "88", 607250 }, { "89", 613250 }, { "90", 619250 }, { "91", 625250 }, { "92", 631250 }, { "93", 637250 }, { "94", 643250 }, { "95", 91250 }, { "96", 97250 }, { "97", 103250 }, { "98", 109250 }, { "99", 115250 }, { "100", 649250 }, { "101", 655250 }, { "102", 661250 }, { "103", 667250 }, { "104", 673250 }, { "105", 679250 }, { "106", 685250 }, { "107", 691250 }, { "108", 697250 }, { "109", 703250 }, { "110", 709250 }, { "111", 715250 }, { "112", 721250 }, { "113", 727250 }, { "114", 733250 }, { "115", 739250 }, { "116", 745250 }, { "117", 751250 }, { "118", 757250 }, { "119", 763250 }, { "120", 769250 }, { "121", 775250 }, { "122", 781250 }, { "123", 787250 }, { "124", 793250 }, { "125", 799250 }, { "T7", 8250 }, { "T8", 14250 }, { "T9", 20250 }, { "T10", 26250 }, { "T11", 32250 }, { "T12", 38250 }, { "T13", 44250 }, { "T14", 50250 } }; /* US HRC */ static struct CHANLIST ntsc_hrc[] = { { "1", 72000 }, { "2", 54000 }, { "3", 60000 }, { "4", 66000 }, { "5", 78000 }, { "6", 84000 }, { "7", 174000 }, { "8", 180000 }, { "9", 186000 }, { "10", 192000 }, { "11", 198000 }, { "12", 204000 }, { "13", 210000 }, { "14", 120000 }, { "15", 126000 }, { "16", 132000 }, { "17", 138000 }, { "18", 144000 }, { "19", 150000 }, { "20", 156000 }, { "21", 162000 }, { "22", 168000 }, { "23", 216000 }, { "24", 222000 }, { "25", 228000 }, { "26", 234000 }, { "27", 240000 }, { "28", 246000 }, { "29", 252000 }, { "30", 258000 }, { "31", 264000 }, { "32", 270000 }, { "33", 276000 }, { "34", 282000 }, { "35", 288000 }, { "36", 294000 }, { "37", 300000 }, { "38", 306000 }, { "39", 312000 }, { "40", 318000 }, { "41", 324000 }, { "42", 330000 }, { "43", 336000 }, { "44", 342000 }, { "45", 348000 }, { "46", 354000 }, { "47", 360000 }, { "48", 366000 }, { "49", 372000 }, { "50", 378000 }, { "51", 384000 }, { "52", 390000 }, { "53", 396000 }, { "54", 402000 }, { "55", 408000 }, { "56", 414000 }, { "57", 420000 }, { "58", 426000 }, { "59", 432000 }, { "60", 438000 }, { "61", 444000 }, { "62", 450000 }, { "63", 456000 }, { "64", 462000 }, { "65", 468000 }, { "66", 474000 }, { "67", 480000 }, { "68", 486000 }, { "69", 492000 }, { "70", 498000 }, { "71", 504000 }, { "72", 510000 }, { "73", 516000 }, { "74", 522000 }, { "75", 528000 }, { "76", 534000 }, { "77", 540000 }, { "78", 546000 }, { "79", 552000 }, { "80", 558000 }, { "81", 564000 }, { "82", 570000 }, { "83", 576000 }, { "84", 582000 }, { "85", 588000 }, { "86", 594000 }, { "87", 600000 }, { "88", 606000 }, { "89", 612000 }, { "90", 618000 }, { "91", 624000 }, { "92", 630000 }, { "93", 636000 }, { "94", 642000 }, { "95", 900000 }, { "96", 960000 }, { "97", 102000 }, { "98", 108000 }, { "99", 114000 }, { "100", 648000 }, { "101", 654000 }, { "102", 660000 }, { "103", 666000 }, { "104", 672000 }, { "105", 678000 }, { "106", 684000 }, { "107", 690000 }, { "108", 696000 }, { "109", 702000 }, { "110", 708000 }, { "111", 714000 }, { "112", 720000 }, { "113", 726000 }, { "114", 732000 }, { "115", 738000 }, { "116", 744000 }, { "117", 750000 }, { "118", 756000 }, { "119", 762000 }, { "120", 768000 }, { "121", 774000 }, { "122", 780000 }, { "123", 786000 }, { "124", 792000 }, { "125", 798000 }, { "T7", 7000 }, { "T8", 13000 }, { "T9", 19000 }, { "T10", 25000 }, { "T11", 31000 }, { "T12", 37000 }, { "T13", 43000 }, { "T14", 49000 }, }; /* --------------------------------------------------------------------- */ /* Canada cable */ static struct CHANLIST ntsc_cable_ca[] = { { "2", 61750 }, { "3", 67750 }, { "4", 73750 }, { "5", 83750 }, { "6", 89750 }, { "7", 181750 }, { "8", 187750 }, { "9", 193750 }, { "10", 199750 }, { "11", 205750 }, { "12", 211750 }, { "13", 217750 }, { "14", 127750 }, { "15", 133750 }, { "16", 139750 }, { "17", 145750 }, { "18", 151750 }, { "19", 157750 }, { "20", 163750 }, { "21", 169750 }, { "22", 175750 }, { "23", 223750 }, { "24", 229750 }, { "25", 235750 }, { "26", 241750 }, { "27", 247750 }, { "28", 253750 }, { "29", 259750 }, { "30", 265750 }, { "31", 271750 }, { "32", 277750 }, { "33", 283750 }, { "34", 289750 }, { "35", 295750 }, { "36", 301750 }, { "37", 307750 }, { "38", 313750 }, { "39", 319750 }, { "40", 325750 }, { "41", 331750 }, { "42", 337750 }, { "43", 343750 }, { "44", 349750 }, { "45", 355750 }, { "46", 361750 }, { "47", 367750 }, { "48", 373750 }, { "49", 379750 }, { "50", 385750 }, { "51", 391750 }, { "52", 397750 }, { "53", 403750 }, { "54", 409750 }, { "55", 415750 }, { "56", 421750 }, { "57", 427750 }, { "58", 433750 }, { "59", 439750 }, { "60", 445750 }, { "61", 451750 }, { "62", 457750 }, { "63", 463750 }, { "64", 469750 }, { "65", 475750 }, { "66", 481750 }, { "67", 487750 }, { "68", 493750 }, { "69", 499750 }, { "70", 505750 }, { "71", 511750 }, { "72", 517750 }, { "73", 523750 }, { "74", 529750 }, { "75", 535750 }, { "76", 541750 }, { "77", 547750 }, { "78", 553750 }, { "79", 559750 }, { "80", 565750 }, { "81", 571750 }, { "82", 577750 }, { "83", 583750 }, { "84", 589750 }, { "85", 595750 }, { "86", 601750 }, { "87", 607750 }, { "88", 613750 }, { "89", 619750 }, { "90", 625750 }, { "91", 631750 }, { "92", 637750 }, { "93", 643750 }, { "94", 649750 }, { "95", 97750 }, { "96", 103750 }, { "97", 109750 }, { "98", 115750 }, { "99", 121750 }, { "100", 655750 }, { "101", 661750 }, { "102", 667750 }, { "103", 673750 }, { "104", 679750 }, { "105", 685750 }, { "106", 691750 }, { "107", 697750 }, { "108", 703750 }, { "109", 709750 }, { "110", 715750 }, { "111", 721750 }, { "112", 727750 }, { "113", 733750 }, { "114", 739750 }, { "115", 745750 }, { "116", 751750 }, { "117", 757750 }, { "118", 763750 }, { "119", 769750 }, { "120", 775750 }, { "121", 781750 }, { "122", 787750 }, { "123", 793750 }, { "124", 799750 }, { "125", 805750 } }; /* --------------------------------------------------------------------- */ /* JP broadcast */ static struct CHANLIST ntsc_bcast_jp[] = { { "1", 91250 }, { "2", 97250 }, { "3", 103250 }, { "4", 171250 }, { "5", 177250 }, { "6", 183250 }, { "7", 189250 }, { "8", 193250 }, { "9", 199250 }, { "10", 205250 }, { "11", 211250 }, { "12", 217250 }, { "13", 471250 }, { "14", 477250 }, { "15", 483250 }, { "16", 489250 }, { "17", 495250 }, { "18", 501250 }, { "19", 507250 }, { "20", 513250 }, { "21", 519250 }, { "22", 525250 }, { "23", 531250 }, { "24", 537250 }, { "25", 543250 }, { "26", 549250 }, { "27", 555250 }, { "28", 561250 }, { "29", 567250 }, { "30", 573250 }, { "31", 579250 }, { "32", 585250 }, { "33", 591250 }, { "34", 597250 }, { "35", 603250 }, { "36", 609250 }, { "37", 615250 }, { "38", 621250 }, { "39", 627250 }, { "40", 633250 }, { "41", 639250 }, { "42", 645250 }, { "43", 651250 }, { "44", 657250 }, { "45", 663250 }, { "46", 669250 }, { "47", 675250 }, { "48", 681250 }, { "49", 687250 }, { "50", 693250 }, { "51", 699250 }, { "52", 705250 }, { "53", 711250 }, { "54", 717250 }, { "55", 723250 }, { "56", 729250 }, { "57", 735250 }, { "58", 741250 }, { "59", 747250 }, { "60", 753250 }, { "61", 759250 }, { "62", 765250 }, }; /* JP cable */ static struct CHANLIST ntsc_cable_jp[] = { { "13", 109250 }, { "14", 115250 }, { "15", 121250 }, { "16", 127250 }, { "17", 133250 }, { "18", 139250 }, { "19", 145250 }, { "20", 151250 }, { "21", 157250 }, { "22", 165250 }, { "23", 223250 }, { "24", 231250 }, { "25", 237250 }, { "26", 243250 }, { "27", 249250 }, { "28", 253250 }, { "29", 259250 }, { "30", 265250 }, { "31", 271250 }, { "32", 277250 }, { "33", 283250 }, { "34", 289250 }, { "35", 295250 }, { "36", 301250 }, { "37", 307250 }, { "38", 313250 }, { "39", 319250 }, { "40", 325250 }, { "41", 331250 }, { "42", 337250 }, { "43", 343250 }, { "44", 349250 }, { "45", 355250 }, { "46", 361250 }, { "47", 367250 }, { "48", 373250 }, { "49", 379250 }, { "50", 385250 }, { "51", 391250 }, { "52", 397250 }, { "53", 403250 }, { "54", 409250 }, { "55", 415250 }, { "56", 421250 }, { "57", 427250 }, { "58", 433250 }, { "59", 439250 }, { "60", 445250 }, { "61", 451250 }, { "62", 457250 }, { "63", 463250 }, }; /* --------------------------------------------------------------------- */ /* australia */ static struct CHANLIST pal_australia[] = { { "0", 46250 }, { "1", 57250 }, { "2", 64250 }, { "3", 86250 }, { "4", 95250 }, { "5", 102250 }, { "5A", 138250 }, { "6", 175250 }, { "7", 182250 }, { "8", 189250 }, { "9", 196250 }, { "10", 209250 }, { "11", 216250 }, { "28", 527250 }, { "29", 534250 }, { "30", 541250 }, { "31", 548250 }, { "32", 555250 }, { "33", 562250 }, { "34", 569250 }, { "35", 576250 }, { "36", 591250 }, { "39", 604250 }, { "40", 611250 }, { "41", 618250 }, { "42", 625250 }, { "43", 632250 }, { "44", 639250 }, { "45", 646250 }, { "46", 653250 }, { "47", 660250 }, { "48", 667250 }, { "49", 674250 }, { "50", 681250 }, { "51", 688250 }, { "52", 695250 }, { "53", 702250 }, { "54", 709250 }, { "55", 716250 }, { "56", 723250 }, { "57", 730250 }, { "58", 737250 }, { "59", 744250 }, { "60", 751250 }, { "61", 758250 }, { "62", 765250 }, { "63", 772250 }, { "64", 779250 }, { "65", 786250 }, { "66", 793250 }, { "67", 800250 }, { "68", 807250 }, { "69", 814250 }, }; /* --------------------------------------------------------------------- */ /* europe */ /* CCIR frequencies */ #define FREQ_CCIR_I_III \ { "E2", 48250 }, \ { "E3", 55250 }, \ { "E4", 62250 }, \ \ { "S01", 69250 }, \ { "S02", 76250 }, \ { "S03", 83250 }, \ \ { "E5", 175250 }, \ { "E6", 182250 }, \ { "E7", 189250 }, \ { "E8", 196250 }, \ { "E9", 203250 }, \ { "E10", 210250 }, \ { "E11", 217250 }, \ { "E12", 224250 } #define FREQ_CCIR_SL_SH \ { "SE1", 105250 }, \ { "SE2", 112250 }, \ { "SE3", 119250 }, \ { "SE4", 126250 }, \ { "SE5", 133250 }, \ { "SE6", 140250 }, \ { "SE7", 147250 }, \ { "SE8", 154250 }, \ { "SE9", 161250 }, \ { "SE10", 168250 }, \ \ { "SE11", 231250 }, \ { "SE12", 238250 }, \ { "SE13", 245250 }, \ { "SE14", 252250 }, \ { "SE15", 259250 }, \ { "SE16", 266250 }, \ { "SE17", 273250 }, \ { "SE18", 280250 }, \ { "SE19", 287250 }, \ { "SE20", 294250 } #define FREQ_CCIR_H \ { "S21", 303250 }, \ { "S22", 311250 }, \ { "S23", 319250 }, \ { "S24", 327250 }, \ { "S25", 335250 }, \ { "S26", 343250 }, \ { "S27", 351250 }, \ { "S28", 359250 }, \ { "S29", 367250 }, \ { "S30", 375250 }, \ { "S31", 383250 }, \ { "S32", 391250 }, \ { "S33", 399250 }, \ { "S34", 407250 }, \ { "S35", 415250 }, \ { "S36", 423250 }, \ { "S37", 431250 }, \ { "S38", 439250 }, \ { "S39", 447250 }, \ { "S40", 455250 }, \ { "S41", 463250 } /* OIRT frequencies */ #define FREQ_OIRT_I_III \ { "R1", 49750 }, \ { "R2", 59250 }, \ \ { "R3", 77250 }, \ { "R4", 85250 }, \ { "R5", 93250 }, \ \ { "R6", 175250 }, \ { "R7", 183250 }, \ { "R8", 191250 }, \ { "R9", 199250 }, \ { "R10", 207250 }, \ { "R11", 215250 }, \ { "R12", 223250 } #define FREQ_OIRT_SL_SH \ { "SR1", 111250 }, \ { "SR2", 119250 }, \ { "SR3", 127250 }, \ { "SR4", 135250 }, \ { "SR5", 143250 }, \ { "SR6", 151250 }, \ { "SR7", 159250 }, \ { "SR8", 167250 }, \ \ { "SR11", 231250 }, \ { "SR12", 239250 }, \ { "SR13", 247250 }, \ { "SR14", 255250 }, \ { "SR15", 263250 }, \ { "SR16", 271250 }, \ { "SR17", 279250 }, \ { "SR18", 287250 }, \ { "SR19", 295250 } #define FREQ_UHF \ { "21", 471250 }, \ { "22", 479250 }, \ { "23", 487250 }, \ { "24", 495250 }, \ { "25", 503250 }, \ { "26", 511250 }, \ { "27", 519250 }, \ { "28", 527250 }, \ { "29", 535250 }, \ { "30", 543250 }, \ { "31", 551250 }, \ { "32", 559250 }, \ { "33", 567250 }, \ { "34", 575250 }, \ { "35", 583250 }, \ { "36", 591250 }, \ { "37", 599250 }, \ { "38", 607250 }, \ { "39", 615250 }, \ { "40", 623250 }, \ { "41", 631250 }, \ { "42", 639250 }, \ { "43", 647250 }, \ { "44", 655250 }, \ { "45", 663250 }, \ { "46", 671250 }, \ { "47", 679250 }, \ { "48", 687250 }, \ { "49", 695250 }, \ { "50", 703250 }, \ { "51", 711250 }, \ { "52", 719250 }, \ { "53", 727250 }, \ { "54", 735250 }, \ { "55", 743250 }, \ { "56", 751250 }, \ { "57", 759250 }, \ { "58", 767250 }, \ { "59", 775250 }, \ { "60", 783250 }, \ { "61", 791250 }, \ { "62", 799250 }, \ { "63", 807250 }, \ { "64", 815250 }, \ { "65", 823250 }, \ { "66", 831250 }, \ { "67", 839250 }, \ { "68", 847250 }, \ { "69", 855250 } static struct CHANLIST europe_west[] = { FREQ_CCIR_I_III, FREQ_CCIR_SL_SH, FREQ_CCIR_H, FREQ_UHF }; static struct CHANLIST europe_east[] = { FREQ_OIRT_I_III, FREQ_OIRT_SL_SH, FREQ_CCIR_I_III, FREQ_CCIR_SL_SH, FREQ_CCIR_H, FREQ_UHF }; static struct CHANLIST pal_italy[] = { { "A", 53750 }, { "B", 62250 }, { "C", 82250 }, { "D", 175250 }, { "E", 183750 }, { "F", 192250 }, { "G", 201250 }, { "H", 210250 }, { "H1", 217250 }, { "H2", 224250 }, FREQ_UHF }; static struct CHANLIST pal_ireland[] = { { "A0", 45750 }, { "A1", 48000 }, { "A2", 53750 }, { "A3", 56000 }, { "A4", 61750 }, { "A5", 64000 }, { "A6", 175250 }, { "A7", 176000 }, { "A8", 183250 }, { "A9", 184000 }, { "A10", 191250 }, { "A11", 192000 }, { "A12", 199250 }, { "A13", 200000 }, { "A14", 207250 }, { "A15", 208000 }, { "A16", 215250 }, { "A17", 216000 }, { "A18", 224000 }, { "A19", 232000 }, { "A20", 248000 }, { "A21", 256000 }, { "A22", 264000 }, { "A23", 272000 }, { "A24", 280000 }, { "A25", 288000 }, { "A26", 296000 }, { "A27", 304000 }, { "A28", 312000 }, { "A29", 320000 }, { "A30", 344000 }, { "A31", 352000 }, { "A32", 408000 }, { "A33", 416000 }, { "A34", 448000 }, { "A35", 480000 }, { "A36", 520000 }, FREQ_UHF, }; static struct CHANLIST secam_france[] = { { "K01", 47750 }, { "K02", 55750 }, { "K03", 60500 }, { "K04", 63750 }, { "K05", 176000 }, { "K06", 184000 }, { "K07", 192000 }, { "K08", 200000 }, { "K09", 208000 }, { "K10", 216000 }, { "KB", 116750 }, { "KC", 128750 }, { "KD", 140750 }, { "KE", 159750 }, { "KF", 164750 }, { "KG", 176750 }, { "KH", 188750 }, { "KI", 200750 }, { "KJ", 212750 }, { "KK", 224750 }, { "KL", 236750 }, { "KM", 248750 }, { "KN", 260750 }, { "KO", 272750 }, { "KP", 284750 }, { "KQ", 296750 }, { "H01", 303250 }, { "H02", 311250 }, { "H03", 319250 }, { "H04", 327250 }, { "H05", 335250 }, { "H06", 343250 }, { "H07", 351250 }, { "H08", 359250 }, { "H09", 367250 }, { "H10", 375250 }, { "H11", 383250 }, { "H12", 391250 }, { "H13", 399250 }, { "H14", 407250 }, { "H15", 415250 }, { "H16", 423250 }, { "H17", 431250 }, { "H18", 439250 }, { "H19", 447250 }, FREQ_UHF, }; /* --------------------------------------------------------------------- */ static struct CHANLIST pal_newzealand[] = { { "1", 45250 }, { "2", 55250 }, { "3", 62250 }, { "4", 175250 }, { "5", 182250 }, { "6", 189250 }, { "7", 196250 }, { "8", 203250 }, { "9", 210250 }, { "10", 217250 }, { "11", 224250 }, FREQ_UHF, }; /* --------------------------------------------------------------------- */ /* China broadcast */ static struct CHANLIST pal_bcast_cn[] = { { "1", 49750 }, { "2", 57750 }, { "3", 65750 }, { "4", 77250 }, { "5", 85250 }, { "6", 112250 }, { "7", 120250 }, { "8", 128250 }, { "9", 136250 }, { "10", 144250 }, { "11", 152250 }, { "12", 160250 }, { "13", 168250 }, { "14", 176250 }, { "15", 184250 }, { "16", 192250 }, { "17", 200250 }, { "18", 208250 }, { "19", 216250 }, { "20", 224250 }, { "21", 232250 }, { "22", 240250 }, { "23", 248250 }, { "24", 256250 }, { "25", 264250 }, { "26", 272250 }, { "27", 280250 }, { "28", 288250 }, { "29", 296250 }, { "30", 304250 }, { "31", 312250 }, { "32", 320250 }, { "33", 328250 }, { "34", 336250 }, { "35", 344250 }, { "36", 352250 }, { "37", 360250 }, { "38", 368250 }, { "39", 376250 }, { "40", 384250 }, { "41", 392250 }, { "42", 400250 }, { "43", 408250 }, { "44", 416250 }, { "45", 424250 }, { "46", 432250 }, { "47", 440250 }, { "48", 448250 }, { "49", 456250 }, { "50", 463250 }, { "51", 471250 }, { "52", 479250 }, { "53", 487250 }, { "54", 495250 }, { "55", 503250 }, { "56", 511250 }, { "57", 519250 }, { "58", 527250 }, { "59", 535250 }, { "60", 543250 }, { "61", 551250 }, { "62", 559250 }, { "63", 607250 }, { "64", 615250 }, { "65", 623250 }, { "66", 631250 }, { "67", 639250 }, { "68", 647250 }, { "69", 655250 }, { "70", 663250 }, { "71", 671250 }, { "72", 679250 }, { "73", 687250 }, { "74", 695250 }, { "75", 703250 }, { "76", 711250 }, { "77", 719250 }, { "78", 727250 }, { "79", 735250 }, { "80", 743250 }, { "81", 751250 }, { "82", 759250 }, { "83", 767250 }, { "84", 775250 }, { "85", 783250 }, { "86", 791250 }, { "87", 799250 }, { "88", 807250 }, { "89", 815250 }, { "90", 823250 }, { "91", 831250 }, { "92", 839250 }, { "93", 847250 }, { "94", 855250 }, }; /* --------------------------------------------------------------------- */ /* South Africa Broadcast */ static struct CHANLIST pal_bcast_za[] ={ { "1", 175250 }, { "2", 183250 }, { "3", 191250 }, { "4", 199250 }, { "5", 207250 }, { "6", 215250 }, { "7", 223250 }, { "8", 231250 }, FREQ_UHF }; /* --------------------------------------------------------------------- */ static struct CHANLIST argentina[] = { { "001", 56250 }, { "002", 62250 }, { "003", 68250 }, { "004", 78250 }, { "005", 84250 }, { "006", 176250 }, { "007", 182250 }, { "008", 188250 }, { "009", 194250 }, { "010", 200250 }, { "011", 206250 }, { "012", 212250 }, { "013", 122250 }, { "014", 128250 }, { "015", 134250 }, { "016", 140250 }, { "017", 146250 }, { "018", 152250 }, { "019", 158250 }, { "020", 164250 }, { "021", 170250 }, { "022", 218250 }, { "023", 224250 }, { "024", 230250 }, { "025", 236250 }, { "026", 242250 }, { "027", 248250 }, { "028", 254250 }, { "029", 260250 }, { "030", 266250 }, { "031", 272250 }, { "032", 278250 }, { "033", 284250 }, { "034", 290250 }, { "035", 296250 }, { "036", 302250 }, { "037", 308250 }, { "038", 314250 }, { "039", 320250 }, { "040", 326250 }, { "041", 332250 }, { "042", 338250 }, { "043", 344250 }, { "044", 350250 }, { "045", 356250 }, { "046", 362250 }, { "047", 368250 }, { "048", 374250 }, { "049", 380250 }, { "050", 386250 }, { "051", 392250 }, { "052", 398250 }, { "053", 404250 }, { "054", 410250 }, { "055", 416250 }, { "056", 422250 }, { "057", 428250 }, { "058", 434250 }, { "059", 440250 }, { "060", 446250 }, { "061", 452250 }, { "062", 458250 }, { "063", 464250 }, { "064", 470250 }, { "065", 476250 }, { "066", 482250 }, { "067", 488250 }, { "068", 494250 }, { "069", 500250 }, { "070", 506250 }, { "071", 512250 }, { "072", 518250 }, { "073", 524250 }, { "074", 530250 }, { "075", 536250 }, { "076", 542250 }, { "077", 548250 }, { "078", 554250 }, { "079", 560250 }, { "080", 566250 }, { "081", 572250 }, { "082", 578250 }, { "083", 584250 }, { "084", 590250 }, { "085", 596250 }, { "086", 602250 }, { "087", 608250 }, { "088", 614250 }, { "089", 620250 }, { "090", 626250 }, { "091", 632250 }, { "092", 638250 }, { "093", 644250 }, }; /* --------------------------------------------------------------------- */ struct CHANLISTS chanlists[] = { { "us-bcast", ntsc_bcast, CHAN_COUNT(ntsc_bcast) }, { "us-cable", ntsc_cable, CHAN_COUNT(ntsc_cable) }, { "us-cable-hrc", ntsc_hrc, CHAN_COUNT(ntsc_hrc) }, { "japan-bcast", ntsc_bcast_jp, CHAN_COUNT(ntsc_bcast_jp) }, { "japan-cable", ntsc_cable_jp, CHAN_COUNT(ntsc_cable_jp) }, { "europe-west", europe_west, CHAN_COUNT(europe_west) }, { "europe-east", europe_east, CHAN_COUNT(europe_east) }, { "italy", pal_italy, CHAN_COUNT(pal_italy) }, { "newzealand", pal_newzealand, CHAN_COUNT(pal_newzealand) }, { "australia", pal_australia, CHAN_COUNT(pal_australia) }, { "ireland", pal_ireland, CHAN_COUNT(pal_ireland) }, { "france", secam_france, CHAN_COUNT(secam_france) }, { "china-bcast", pal_bcast_cn, CHAN_COUNT(pal_bcast_cn) }, { "southafrica", pal_bcast_za, CHAN_COUNT(pal_bcast_za) }, { "argentina", argentina, CHAN_COUNT(argentina) }, { "canada-cable", ntsc_cable_ca, CHAN_COUNT(ntsc_cable_ca) }, { NULL, NULL, 0 } /* EOF */ }; struct STRTAB chanlist_names[] = { { 0, "us-bcast" }, { 1, "us-cable" }, { 2, "us-cable-hrc" }, { 3, "japan-bcast" }, { 4, "japan-cable" }, { 5, "europe-west" }, { 6, "europe-east" }, { 7, "italy" }, { 8, "newzealand" }, { 9, "australia" }, { 10, "ireland" }, { 11, "france" }, { 12, "china-bcast" }, { 13, "southafrica" }, { 14, "argentina" }, { 15, "canada-cable" }, { -1, NULL } }; int chantab = 5; struct CHANLIST* chanlist = europe_west; int chancount = CHAN_COUNT(europe_west); avifile-0.7.48~20090503.ds/samples/qtvidcap/frequencies.h0000644000175000017500000001110110130743025021667 0ustar yavoryavor #if 0 struct STRTAB { long nr; const char *str; }; #endif /* * Worldwide channel/frequency list * * Nathan Laredo (laredo@broked.net) * * Frequencies are given in kHz */ #define NTSC_AUDIO_CARRIER 4500 #define PAL_AUDIO_CARRIER_I 6000 #define PAL_AUDIO_CARRIER_BGHN 5500 #define PAL_AUDIO_CARRIER_MN 4500 #define PAL_AUDIO_CARRIER_D 6500 #define SEACAM_AUDIO_DKK1L 6500 #define SEACAM_AUDIO_BG 5500 /* NICAM 728 32-kHz, 14-bit digital stereo audio is transmitted in 1ms frames containing 8 bits frame sync, 5 bits control, 11 bits additional data, and 704 bits audio data. The bit rate is reduced by transmitting only 10 bits plus parity of each 14 bit sample, the largest sample in a frame determines which 10 bits are transmitted. The parity bits for audio samples also specify the scaling factor used for that channel during that frame. The companeded audio data is interleaved to reduce the influence of dropouts and the whole frame except for sync bits is scrambled for spectrum shaping. Data is modulated using QPSK, at below following subcarrier freqs */ #define NICAM728_PAL_BGH 5850 #define NICAM728_PAL_I 6552 /* COMPREHENSIVE LIST OF FORMAT BY COUNTRY (M) NTSC used in: Antigua, Aruba, Bahamas, Barbados, Belize, Bermuda, Bolivia, Burma, Canada, Chile, Colombia, Costa Rica, Cuba, Curacao, Dominican Republic, Ecuador, El Salvador, Guam Guatemala, Honduras, Jamaica, Japan, South Korea, Mexico, Montserrat, Myanmar, Nicaragua, Panama, Peru, Philippines, Puerto Rico, St Christopher and Nevis, Samoa, Suriname, Taiwan, Trinidad/Tobago, United States, Venezuela, Virgin Islands (B) PAL used in: Albania, Algeria, Australia, Austria, Bahrain, Bangladesh, Belgium, Bosnia-Herzegovinia, Brunei Darussalam, Cambodia, Cameroon, Croatia, Cyprus, Denmark, Egypt, Ethiopia, Equatorial Guinea, Finland, Germany, Ghana, Gibraltar, Greenland, Iceland, India, Indonesia, Israel, Italy, Jordan, Kenya, Kuwait, Liberia, Libya, Luxembourg, Malaysa, Maldives, Malta, Nepal, Netherlands, New Zeland, Nigeria, Norway, Oman, Pakistan, Papua New Guinea, Portugal, Qatar, Sao Tome and Principe, Saudi Arabia, Seychelles, Sierra Leone, Singapore, Slovenia, Somali, Spain, Sri Lanka, Sudan, Swaziland, Sweden, Switzeland, Syria, Thailand, Tunisia, Turkey, Uganda, United Arab Emirates, Yemen (N) PAL used in: (Combination N = 4.5MHz audio carrier, 3.58MHz burst) Argentina (Combination N), Paraguay, Uruguay (M) PAL (525/60, 3.57MHz burst) used in: Brazil (G) PAL used in: Albania, Algeria, Austria, Bahrain, Bosnia/Herzegovinia, Cambodia, Cameroon, Croatia, Cyprus, Denmark, Egypt, Ethiopia, Equatorial Guinea, Finland, Germany, Gibraltar, Greenland, Iceland, Israel, Italy, Jordan, Kenya, Kuwait, Liberia, Libya, Luxembourg, Malaysia, Monaco, Mozambique, Netherlands, New Zealand, Norway, Oman, Pakistan, Papa New Guinea, Portugal, Qatar, Romania, Sierra Leone, Singapore, Slovenia, Somalia, Spain, Sri Lanka, Sudan, Swaziland, Sweeden, Switzerland, Syria, Thailand, Tunisia, Turkey, United Arab Emirates, Yemen, Zambia, Zimbabwe (D) PAL used in: China, North Korea, Romania, Czech Republic (H) PAL used in: Belgium (I) PAL used in: Angola, Botswana, Gambia, Guinea-Bissau, Hong Kong, Ireland, Lesotho, Malawi, Nambia, Nigeria, South Africa, Tanzania, United Kingdom, Zanzibar (B) SECAM used in: Djibouti, Greece, Iran, Iraq, Lebanon, Mali, Mauritania, Mauritus, Morocco (D) SECAM used in: Afghanistan, Armenia, Azerbaijan, Belarus, Bulgaria, Estonia, Georgia, Hungary, Zazakhstan, Lithuania, Mongolia, Moldova, Russia, Slovak Republic, Ukraine, Vietnam (G) SECAM used in: Greecem Iran, Iraq, Mali, Mauritus, Morocco, Saudi Arabia (K) SECAM used in: Armenia, Azerbaijan, Bulgaria, Estonia, Georgia, Hungary, Kazakhstan, Lithuania, Madagascar, Moldova, Poland, Russia, Slovak Republic, Ukraine, Vietnam (K1) SECAM used in: Benin, Burkina Faso, Burundi, Chad, Cape Verde, Central African Republic, Comoros, Congo, Gabon, Madagascar, Niger, Rwanda, Senegal, Togo, Zaire (L) SECAM used in: France */ /* --------------------------------------------------------------------- */ struct CHANLIST { const char *name; int freq; }; struct CHANLISTS { const char *name; const struct CHANLIST *list; int count; }; #define CHAN_COUNT(x) (sizeof(x)/sizeof(struct CHANLIST)) /* --------------------------------------------------------------------- */ extern struct CHANLISTS chanlists[]; extern struct STRTAB chanlist_names[]; extern int chantab; extern struct CHANLIST *chanlist; extern int chancount; avifile-0.7.48~20090503.ds/samples/qtvidcap/fullscreen_renderer.cpp0000644000175000017500000001454711165741502023771 0ustar yavoryavor#include "avm_fourcc.h" #include "avm_cpuinfo.h" #include "avm_except.h" #include "avm_creators.h" #include "avm_output.h" #include "utils.h" #include // geteuid #include // memcpy #include // getenv, free() #include #include "fullscreen_renderer.h" AVM_BEGIN_NAMESPACE; #define __MODULE__ "AvicapRenderer" AvicapRenderer::AvicapRenderer(void *dpy){ m_pPW=this; m_pDpy=dpy; // m_bQuit=false; zx = zy = zw = zh = 0; } void AvicapRenderer::setSize(int w,int h){ m_iWidth=w; m_iHeight=h; } AvicapRenderer::~AvicapRenderer(){ while (m_VideoRenderers.size() > 0) { delete m_VideoRenderers.back(); m_VideoRenderers.pop_back(); } } void AvicapRenderer::setCaption(avm::string capstr){ for(uint i=0;iSetCaption(capstr.c_str(),NULL); } } void AvicapRenderer::setRecordingColorSpace(Colorspaces colorspace) { recording_csp=colorspace; } bool AvicapRenderer::checkColorSpace(fourcc_t csp) { if(csp==fccYUY2 && recording_csp==cspYUY2){ return true; } else if(csp==fccYV12 && recording_csp==cspYV12){ return true; } return false; } // used when we are in pause mode or the player is not playing int AvicapRenderer::drawFrame(CImage *im) { #if 1 // printf("c1\n"); if (true) { //printf("c2\n"); //CImage* im = m_pVideostream->GetFrame(true); // ReadFrame // m_fLastDiff = 0.0; // setQuality(); // printf("c2.1\n"); if (im) { // printf("c3\n"); //const subtitle_line_t* sl = GetCurrentSubtitles(); for (unsigned i = 0; i < m_VideoRenderers.size(); i++) { // printf("drawing on vr %d\n",i); m_VideoRenderers[i]->Draw(im); //if (HasSubtitles()) // m_VideoRenderers[i]->DrawSubtitles(sl); m_VideoRenderers[i]->Sync(); } //printf("c4\n"); // m_Quality.insert(im->GetQuality() * 100.0); im->Release(); // m_iFramesVideo++; } return 0; } #endif return -1; } //from aviplay2 int AvicapRenderer::Refresh() { printf("avicaprenderer-refresh\n"); for (unsigned i = 0; i < m_VideoRenderers.size(); i++){ printf("avicaprenderer-refresh %d\n",i); m_VideoRenderers[i]->Refresh(); } return 0; } // should be redesigned - only first one will get resize event for now int AvicapRenderer::Resize(int& new_w, int& new_h) { printf("resize %d %d\n",new_w,new_h); if (m_VideoRenderers.size() > 0) { bool pres; //Get(VIDEO_PRESERVE_ASPECT, &pres, 0); pres=false; if (pres) { //StreamInfo* si = m_pVideostream->GetStreamInfo(); //float a = si->GetAspectRatio(); float a=0.0; //delete si; if (a == 0) a = GetWidth() / (float) GetHeight(); new_w = (int) (new_h * a + 0.5); if (zw) new_w = new_h * zw / zh; } printf("new w/h %d %d\n",new_w,new_h); return m_VideoRenderers.front()->Resize(new_w, new_h); } return 0; } int AvicapRenderer::Zoom(int x, int y, int w, int h) { zx = zy = zw = zh = 0; for (unsigned i = 0; i < m_VideoRenderers.size(); i++) if (m_VideoRenderers[i]->Zoom(x, y, w, h) == 0) { zx = x; zy = y; zw = w; zh = h; } return 0; } int AvicapRenderer::ToggleFullscreen(bool maximize) //int AvicapRenderer::ToggleFullscreen(bool maximize=false) { for (unsigned i = 0; i < m_VideoRenderers.size(); i++) if (m_VideoRenderers[i]->ToggleFullscreen(maximize) != 0) return -1; return 0; } #if 0 void AvicapRenderer::updateResize() { int w, h; switch(m_iResizeCount % 3) { case 0: w=GetWidth()/2; h=GetHeight()/2; break; case 1: w=GetWidth(); h=GetHeight(); break; case 2: w=GetWidth()*2; h=GetHeight()*2; break; } Resize(w, h); } #endif void AvicapRenderer::createVideoRenderer() { int pos = -1, wx, wy, ww, wh; while (m_VideoRenderers.size() > 0) { if (pos < 0) pos = m_VideoRenderers.back()->GetPosition(wx, wy); if (pos == 0) pos = m_VideoRenderers.back()->GetSize(ww, wh); delete m_VideoRenderers.back(); m_VideoRenderers.pop_back(); } printf("WX %d WY %d WW %d WH %d\n", wx, wy, ww, wh); #ifndef X_DISPLAY_MISSING if (m_pDpy && GetWidth() > 0 && GetHeight() > 0) { bool sub = false; IVideoRenderer* renderer = 0; bool useyuv; // Get(USE_YUV, &useyuv, 0); useyuv=my_useyuv; if (useyuv && !renderer) { // checking for YUY2 first static const fourcc_t tryFcc[] = { fccYUY2, // looks like YV12 is not supported for Color changes //fccYUY2, fccYV12, // fastest fccUYVY, fccI420, // forced //fccYUY2, fccYV12, //fccUYVY, 0 }; int i = 0; while (!renderer && tryFcc[i]) { try { // we always allow to use last entry when HW acceleration // is requested - it is giving hw scalable picture m_CSP = tryFcc[i]; if (!tryFcc[i + 1] || checkColorSpace(m_CSP) == true) { printf("yuvrenderer %d\n",m_CSP); renderer = CreateYUVRenderer(m_pPW, m_pDpy, GetWidth(), GetHeight(), m_CSP, sub); } } catch (FatalError& e) { e.PrintAll(); delete renderer; renderer=0; } i++; } } if (!renderer) { printf("creating rgb renderer\n"); renderer = CreateFullscreenRenderer(m_pPW, m_pDpy, GetWidth(), GetHeight(), sub); //m_CSP = m_iDepth; //int result = m_pVideostream->GetVideoDecoder()->SetDestFmt(m_iDepth); } if (renderer) { //StreamInfo* si = m_pVideostream->GetStreamInfo(); //float a = si->GetAspectRatio(); float a = 0.1f; if (a > 1.f) { int w = (int) (GetHeight() * a + 0.5f); int h = GetHeight(); renderer->Resize(w, h); } //delete si; #if 0 if (pos == 0) { renderer->Resize(ww, wh); renderer->SetPosition(wx, wy); } #endif renderer->SetCaption("avicap: unknown", 0); m_VideoRenderers.push_back(renderer); printf("pushback renderer\n"); //char* fs; //Get(SUBTITLE_FONT, &fs, 0); //renderer->SetFont(sub ? fs : 0); //if (fs) free(fs); } //setVideoBuffering(); //SetColorSpace(IMG_FMT_I420, false); //m_pVideostream->GetVideoDecoder()->SetDestFmt(IMG_FMT_I420); } #endif } AVM_END_NAMESPACE; avifile-0.7.48~20090503.ds/samples/qtvidcap/fullscreen_renderer.h0000644000175000017500000000347307671120557023442 0ustar yavoryavor#ifndef AVICAP_RENDERER_H #define AVICAP_RENDERER_H #include "avm_stl.h" #include "image.h" #include "subtitle.h" #include "renderer.h" #include "playerwidget.h" #include #include #include #include #include "capproc.h" #include "v4lwindow.h" class V4LWindow; AVM_BEGIN_NAMESPACE; class AvicapRenderer : public IPlayerWidget { IPlayerWidget* m_pPW; void* m_pDpy; //int m_iResizeCount; int zx, zy, zw, zh; Colorspaces recording_csp; V4LWindow *v4lw; bool my_useyuv; int m_iWidth,m_iHeight; avm::vector m_VideoRenderers; // we could draw image to more places int GetWidth() const {return m_iWidth;} int GetHeight() const {return m_iHeight;} uint_t m_CSP; // used colorspace by renderer public: AvicapRenderer(void *dpy); virtual ~AvicapRenderer(); virtual void createVideoRenderer(); virtual int Refresh(); virtual int Resize(int& new_w, int& new_h); virtual int Zoom(int x, int y, int w, int h); virtual void PW_resize(int w, int h) { Resize(w,h); } // resize event virtual void PW_menu_slot() { v4lw->avicap_renderer_popup(); } virtual void PW_quit_func() { v4lw->avicap_renderer_close(); } virtual void PW_key_func(int sym, int mod) { v4lw->avicap_renderer_keypress(sym,mod); } virtual int ToggleFullscreen(bool maximize=false); void updateResize(); bool checkColorSpace(fourcc_t csp); int drawFrame(avm::CImage* im); void setSize(int w,int h); void setV4LWindow(V4LWindow *v4lwindow) { v4lw=v4lwindow; }; void setYUVrendering(bool mode) { my_useyuv=mode; }; // void PopupMenu(); void setRecordingColorSpace(Colorspaces colorspace); void setCaption(avm::string capstr); }; AVM_END_NAMESPACE; #endif // AVICAP_RENDERER_H avifile-0.7.48~20090503.ds/samples/qtvidcap/kv4lsetup.cpp0000644000175000017500000002343711164471310021674 0ustar yavoryavor/* kv4lSetup using Bt848 frame grabber driver Copyright (C) 1998 Moritz Wenk (wenk@mathematik.uni-kl.de) Original v4l-setup (C) by Gerd Knorr This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ // need this to avoid conflicting type declarations in Xmd.h and qglobal.h //#define QT_CLEAN_NAMESPACE #include #include #include #include #include #include #include #include #include #include #include #include /* XXX glibc */ /* Necessary to prevent collisions between and when V4L2 is installed. */ #define _LINUX_TIME_H #include #ifndef X_DISPLAY_MISSING #include #include #ifdef HAVE_LIBXXF86DGA #include #endif #ifdef HAVE_LIBXXF86VM #include #include #endif #endif /* X_DISPLAY_MISSING */ #ifndef major #define major(dev) (((dev) >> 8) & 0xff) #endif #define V4L_DEVICE "/dev/video" static int dev_open(const char *device, int major) { int fd; #if 0 if (!strncmp(device, "/dev/", 5) || strchr(device + 5, '/')) { fprintf(stderr, "warning: %s is not a /dev file\n", device); exit(1); } #endif /* open & check v4l device */ fd = open(device,O_RDWR); if (fd != -1) { struct stat stb; if (fstat(fd,&stb) != -1) { if (S_ISCHR(stb.st_mode) && (int(major(stb.st_rdev)) == major)) return fd; else fprintf(stderr, "%s: wrong device\n", device); } else fprintf(stderr, "fstat(%s): %s\n", device, strerror(errno)); close(fd); } else fprintf(stderr, "can't open %s: %s\n", device, strerror(errno)); exit(1); } int main(int argc, char* argv[]) { int bpp = 0; int shift = 0; int verbose = 0; int bequiet = false; const char* display = ":0.0"; const char* device = V4L_DEVICE; char* h; int depth; struct video_capability capability; struct video_buffer fbuf; int fd, c; int i, n, v, found; int set_width, set_height, set_bpl; int set_bpp = 0; void* set_base = NULL; #ifndef X_DISPLAY_MISSING Display* dpy; Screen* scr; Window root; XVisualInfo* info, xvtemplate; XWindowAttributes wts; XPixmapFormatValues* pf; #if defined(HAVE_LIBXXF86DGA) || defined(HAVE_LIBXXF86VM) int bar,foo,ma,mi; #endif #ifdef HAVE_LIBXXF86DGA int width,flags; void* base = 0; #endif #ifdef HAVE_LIBXXF86VM int vm_count; XF86VidModeModeInfo** vm_modelines; #endif #endif /* X_DISPLAY_MISSING */ h = getenv("DISPLAY"); if (h != NULL) display = h; static const avm::Args::Option opts[] = { avm::ARGSOPTION("i", "bpp", "b", "color depth of the display is <%d>", &bpp, 0, 32), avm::ARGSOPTION("i", "palette", "p", "set palette of display (see help for details)"), avm::ARGSOPTION("s", "device", "l", "use <%s> as video4linux device", &device), avm::ARGSOPTION("s", "display", "d", "use X11 display <%s>", &display), avm::ARGSOPTION("i", "shift", "s", "shift frame buffer by <%d> bytes [%d, %d]", &shift, -8192, 8192), avm::ARGSOPTION("b", "quiet", "q", "be quiet", &bequiet), avm::ARGSOPTION("i", "verbose", "t", "be verbose", &verbose), avm::ARGSOPTION("b", "version", "v", "show version"), avm::ARGSOPTION("h", "", "", ""), avm::ARGSOPTION("c", "codec", "c", "use with help for more info"), avm::ARGSOPTION("#", "", "", "") }; avm::Args(opts, &argc, argv, "[ options ]\n" " Helper tool to figure out video mode and\n" " configures a video4linux driver like bttv"); /* verbose = pcl.getSwitch('q', false) ? 0 : 1; verbose = pcl.getSwitch('v', false) ? 2 : verbose; shift = pcl.getInt('s', shift, -8192, 8192); */ // check display if (display[0] != ':') { const char* od = display; display = strchr(display,':'); if (!display) exit(1); fprintf(stderr,"non-local display `%s' not allowed, using `%s' instead\n",od,display); } // open display #ifndef X_DISPLAY_MISSING dpy = XOpenDisplay(display); if (dpy == NULL) { if (verbose) fprintf(stderr,"can't open display %s\n",display); exit(1); } if (verbose) fprintf(stderr,"using X11 display %s\n",display); // and get params scr = DefaultScreenOfDisplay(dpy); root = DefaultRootWindow(dpy); XGetWindowAttributes(dpy, root, &wts); if (verbose) fprintf(stderr,"x11: mode=%dx%dx%d\n",wts.width,wts.height,wts.depth); /* look for a usable visual */ xvtemplate.screen = XDefaultScreen(dpy); info = XGetVisualInfo(dpy, VisualScreenMask, &xvtemplate, &found); /* v = -1; for (i = 0; v == -1 && i < found; i++) if (info[i].class == TrueColor && info[i].depth >= 15) v = i; for (i = 0; v == -1 && i < found; i++) if (info[i].class == StaticGray && info[i].depth == 8) v = i; if (-1 == v) { fprintf(stderr,"no approximate visual available\n"); exit(1); } */ depth = 0; pf = XListPixmapFormats(dpy,&n); for (i = 0; i < n; i++) { for ( v= 0; v < found; v++ ) { if (pf[i].depth == info[v].depth) { depth = pf[i].bits_per_pixel; break; } } } if (0 == depth && 0 == bpp) { fprintf(stderr,"can't autodetect framebuffer depth\n"); exit(1); } if (verbose) fprintf(stderr,"x11: detected framebuffer depth: %d bpp\n",depth); if ( bpp == 8 || bpp == 15 || bpp == 16 || bpp == 24 || bpp == 32 ) depth = bpp; set_bpp = (depth+7) & 0xf8; if (verbose) fprintf(stderr,"x11: set depth to %d bpp\n", depth); #ifdef HAVE_LIBXXF86DGA if (XF86DGAQueryExtension(dpy, &foo, &bar)) { XF86DGAQueryDirectVideo(dpy, XDefaultScreen(dpy),&flags); if (flags & XF86DGADirectPresent) { XF86DGAGetVideoLL(dpy,XDefaultScreen(dpy),(CAST_DGALL int*)&base,&width,&foo,&bar); set_bpl = width * set_bpp/8; set_base = base; if (verbose == 2) { XF86DGAQueryVersion(dpy,&ma,&mi); fprintf(stderr,"x11: X-Server supports DGA extention (version %d.%d)\n",ma,mi); } if (verbose) fprintf(stderr,"dga: base=%p, width=%d\n",base, width); } } #else if (verbose) fprintf(stderr,"no dga available...\n"); #endif #ifdef HAVE_LIBXXF86VM if (verbose==2) { foo=bar=0; if (XF86VidModeQueryExtension(dpy,&foo,&bar)) { XF86VidModeQueryVersion(dpy,&ma,&mi); fprintf(stderr,"x11: X-Server supports VidMode extention (version %d.%d)\n", ma,mi); if (ma == 0 && mi < 8) { fprintf(stderr,"x11: VidMode v0.8 or newer required\n"); } else if ((ma != XF86VIDMODE_MAJOR_VERSION) || (mi != XF86VIDMODE_MINOR_VERSION)) { fprintf(stderr,"main: VidMode server extention version mismatch, disabled"); fprintf(stderr,"main: server version %d.%d != included version %d.%d",ma,mi, XF86VIDMODE_MAJOR_VERSION,XF86VIDMODE_MINOR_VERSION); } else { vm_modelines=(XF86VidModeModeInfo **) malloc( sizeof( XF86VidModeModeInfo * ) ); fprintf(stderr,"\t available video mode(s):"); XF86VidModeGetAllModeLines(dpy,XDefaultScreen(dpy), &vm_count,&vm_modelines); fprintf(stderr," %d ",vm_count); for (i = 0; i < vm_count; i++) { fprintf(stderr," %dx%d", vm_modelines[i]->hdisplay, vm_modelines[i]->vdisplay); } fprintf(stderr,"\n"); } } } #endif set_width = wts.width; set_height = wts.height; #else set_width = 384; set_height = 288; #endif /* X_DISPLAY_MISSING */ set_bpl = set_width * set_bpp / 8; /* Open device file, with security checks */ fd = dev_open(device, 81 /* VIDEO_MAJOR */); if (-1 == ioctl(fd, VIDIOCGCAP, &capability)) { fprintf(stderr,"%s: ioctl VIDIOCGCAP: %s\n",device,strerror(errno)); exit(1); } if (-1 == ioctl(fd, VIDIOCGCAP, &capability)) { fprintf(stderr,"%s: ioctl VIDIOC_G_CAP: %s\n",device,strerror(errno)); exit(1); } if (!(capability.type & VID_TYPE_OVERLAY)) { fprintf(stderr,"%s: no overlay support\n",device); exit(1); } /* read-modify-write v4l screen parameters */ if (ioctl(fd, VIDIOCGFBUF, &fbuf) == -1) { fprintf(stderr,"%s: ioctl VIDIOC_G_FBUF: %s\n",device,strerror(errno)); exit(1); } /* set values */ fbuf.width = set_width; fbuf.height = set_height; fbuf.depth = set_bpp; fbuf.bytesperline = set_bpl; if (set_base != NULL) fbuf.base = (void*)((char*)set_base + shift); /* XXX bttv confuses color depth and bits/pixel */ #ifndef X_DISPLAY_MISSING if (wts.depth == 15) fbuf.depth = 15; if ((bpp == 15 || bpp == 16) && (depth == 16)) fbuf.depth = bpp; #endif /* X_DISPLAY_MISSING */ if (verbose) { fprintf(stderr,"set video mode: %dx%d, %d bit/pixel, %d byte/scanline\n", fbuf.width,fbuf.height,fbuf.depth,fbuf.bytesperline); if (set_base != NULL) fprintf(stderr,"set framebuffer at %p\n",set_base); } if (ioctl(fd,VIDIOCSFBUF,&fbuf) == -1) { fprintf(stderr,"%s: ioctl VIDIOC_S_FBUF: %s\n",device,strerror(errno)); fprintf(stderr,"error: framebuffer address could not be set\n"); fprintf(stderr," kv4lsetup needs root permissions\n"); fprintf(stderr," kv4lsetup not correctly installed\n"); exit(1); } if (verbose) fprintf(stderr,"ok\n"); close(fd); return 0; } avifile-0.7.48~20090503.ds/samples/qtvidcap/main.cpp0000644000175000017500000000723311143351532020653 0ustar yavoryavor #include "v4lwindow.h" #include "vidconf.h" #include #include "v4lxif.h" #include #include #include #include #include #define DECLARE_REGISTRY_SHORTCUT #include #undef DECLARE_REGISTRY_SHORTCUT #include #include #ifdef HAVE_SYSINFO #include // is this standard for all linux boxes ? #endif #include #include #include #include #include #include #include unsigned int m_iMemory; const char* g_pcProgramName = "AviCap"; static v4lxif* createDevice() { v4lxif* v4l = new v4l1if(0, RS("CaptureDevice", "/dev/video")); if (v4l->init() == 0) return v4l; delete v4l; return 0; } #if 0 // We do not need this ugly CPU hungry busy loop hack anymore // kabi@users.sf.net class QMyApp: public QApplication { V4LWindow* m_pWin; public: QMyApp(int argc, char** argv): QApplication(argc, argv), m_pWin(0){} void setWindow(V4LWindow* pWin) { m_pWin=pWin; } virtual bool x11EventFilter( XEvent * e ) { if(m_pWin) m_pWin->get_clips(); return QApplication::x11EventFilter(e); } }; #endif static const QString trans_path[] = { ".", I18N_PATH, "" }; int main(int argc, char** argv) { if (GetAvifileVersion() != AVIFILE_VERSION) { printf("This binary was compiled for Avifile ver. %x, " "but the library is ver. %x. Aborting.\n", AVIFILE_VERSION, GetAvifileVersion()); return 0; } // Registry::ReadString("QtVidcap", "CapDev", "/dev/video"); QApplication a(argc,argv); #if 0 QTranslator qtrans( 0 ); qtrans.load( QString( "qt_" ) + QTextCodec::locale(), "." ); a.installTranslator( &qtrans ); #endif // translation file for application strings QTranslator mytrans( 0 ); int i=0; bool res=false; do{ res=mytrans.load( QString( "avicap_" ) + QTextCodec::locale(), trans_path[i] ); if(res){ printf("translation loaded from %s\n",trans_path[i].latin1()); } i++; }while(!(res || trans_path[i]=="")); a.installTranslator( &mytrans ); bool bNow=false; bool bTimer=false; if(argc==2){ if(!strcmp(argv[1], "-now")){ bNow=true; } else if(!strcmp(argv[1], "-timer")){ bTimer=true; } } avm::string cmd = avm::string("kv4lsetup -t=2 -l ") + RS("CaptureDevice", "/dev/video"); if ((cmd.find(':')!=avm::string::npos) || (cmd.find('|')!=avm::string::npos) || (cmd.find(';')!=avm::string::npos)) { system("kv4lsetup -t=2"); // printf("Retval: %d errno: %d\n", val, errno); } else { system(cmd.c_str()); // printf("str: %s\n", cmd.c_str()); // printf("Retval: %d errno: %d\n", val, errno); } #ifdef HAVE_SYSINFO struct sysinfo s_info; sysinfo(&s_info); m_iMemory=s_info.totalram; if (m_iMemory < 2*1048576) m_iMemory=1048576; else m_iMemory/=2; printf("Using %dMb of memory for frame caching\n", m_iMemory/1048576); #else m_iMemory = 16 * 1024 * 1024; #endif int p = getpriority(PRIO_PROCESS, 0); //attention: only root is allowed to lower priority setpriority(PRIO_PROCESS, 0, (p + 3 < 20) ? p + 3 : 20); for (;;) { v4lxif* pV4L = createDevice(); if (pV4L) { V4LWindow m(pV4L); avm::VideoDPMS dp(m.x11Display()); if (bNow) m.setAutoRecord(); m.show(); m.setupDevice(); //a.setWindow(&m); if (bTimer) m.startTimer(); a.setMainWidget(&m); a.exec(); break; } else { VidConfig conf(0, pV4L, 0); if (conf.exec()==QDialog::Rejected) return -1; } } return 0; } avifile-0.7.48~20090503.ds/samples/qtvidcap/parsecl.cpp0000644000175000017500000000543107547603656021402 0ustar yavoryavor/* kwintv, Video4Linux based TV application Copyright (C) 1998,1999 Moritz Wenk (wenk@mathematik.uni-kl.de) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifdef myDEBUG #define pDEBUG #endif #include #include #include #include #include "parsecl.h" parsecl::parsecl(int _argc, char** _argv, const struct parse_option* o, const char* help) { argc = _argc; argv = _argv; opt = o; const char* f = find('h'); if (f) { printf("\nUsage: %s %s\n\n", argv[0], help); int i = 0; while (opt[i].oshort) { printf(" %c%c %s%s %s %s\n", (opt[i].oshort != ' ') ? '-' : ' ', (opt[i].oshort != ' ') ? opt[i].oshort : ' ', opt[i].olong ? "--" : "", opt[i].olong ? opt[i].olong : "", opt[i].options ? opt[i].options : "", opt[i].help ? opt[i].help : ""); i++; } printf("\n"); exit(1); } } parsecl::~parsecl() { } int parsecl::getInt(int oid, int odefault, int min, int max) const { const char* p = find(oid); if (p) { int i = atoi(p); if (i >= min && i <= max) return i; } return odefault; } const char * parsecl::getString(int oid, const char* odefault, const char* options[]) const { const char* p = find(oid); if (p) return p; return odefault; } bool parsecl::getSwitch(int oid, bool odefault) const { if (find(oid)) return true; return odefault; } const char* parsecl::find(int oid) const { int f = 0; while (opt[f].oshort && opt[f].oshort != oid) f++; if (opt[f].oshort) { int i = 0; while (i < argc) { if (argv[i][0] == '-') { int x = 2; if (argv[i][1] != '-') { if (argv[i][1] == opt[f].oshort && argv[i][2] == 0) break; // find } else if (argv[i][2] == 0) { i = argc; break; // end of args } else x++; if (strcmp(&argv[i][x], opt[f].olong) == 0) break; // find } i++; } if (opt[f].options) { if (i < argc) { const char* p = strchr(argv[i], '='); if (p) p++; else if (i + 1 < argc) p = argv[i++]; return p; } } return argv[i]; } return 0; } avifile-0.7.48~20090503.ds/samples/qtvidcap/parsecl.h0000644000175000017500000000314207547603656021044 0ustar yavoryavor/* kwintv, Video4Linux based TV application Copyright (C) 1998,1999 Moritz Wenk (wenk@mathematik.uni-kl.de) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef PARSECL_H #define PARSECL_H #include #include struct parse_option { int oshort; const char* olong; const char* help; void* val; enum { BOOL, INT, STRING, ANYSTRING, CODECINFO } type; int maxval; int minval; const char* arr[]; }; class parsecl { public: parsecl(int _argc = 0, char *_argv[] = 0, const struct parse_option* opt = 0, const char* help = 0); ~parsecl(); int getInt(int oid, int odefault, int min, int max) const; const char * getString(int oid, const char* odefault, const char* opt[] = 0) const; bool getSwitch(int oid, bool odefault) const; protected: const char* find(int oid) const; int argc; char** argv; const struct parse_option* opt; }; #endif /* PARSECL_H */ avifile-0.7.48~20090503.ds/samples/qtvidcap/picprop.cpp0000644000175000017500000000521007657673663021427 0ustar yavoryavor#include "picprop.h" #include "picprop.moc" #include "v4lxif.h" #define DECLARE_REGISTRY_SHORTCUT #include "configfile.h" #undef DECLARE_REGISTRY_SHORTCUT #include #include #include /* * Constructs a PicturePropDialog which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ PicturePropDialog::PicturePropDialog(v4lxif* pDev) : PicPropDialog( 0, 0, FALSE, 0), m_pDev(pDev) { connect(m_pSlider[PROP_BRIGHTNESS], SIGNAL(valueChanged(int)), this, SLOT(changeBrightness(int))); connect(m_pSlider[PROP_SATURATION], SIGNAL(valueChanged(int)), this, SLOT(changeSaturation(int))); connect(m_pSlider[PROP_CONTRAST], SIGNAL(valueChanged(int)), this, SLOT(changeContrast(int))); connect(m_pSlider[PROP_HUE], SIGNAL(valueChanged(int)), this, SLOT(changeHue(int))); m_pSlider[PROP_BRIGHTNESS]->setValue( RI("Image\\Brightness", 0) ); m_pSlider[PROP_SATURATION]->setValue( (RI("Image\\Color", 255)-255)/2 ); m_pSlider[PROP_CONTRAST]->setValue( (RI("Image\\Contrast", 255)-255)/2 ); m_pSlider[PROP_HUE]->setValue( RI("Image\\Hue", 0) ); } /* * Destroys the object and frees any allocated resources */ PicturePropDialog::~PicturePropDialog() { // no need to delete child widgets, Qt does it all for us } void PicturePropDialog::changeBrightness(int val) { QString s = QString().sprintf( tr("Brightness")+": %d", val ); m_pLabel[PROP_BRIGHTNESS]->setText( s ); m_pDev->setPicBrightness( val ); } void PicturePropDialog::changeContrast(int val) { QString s = QString().sprintf( tr("Contrast:")+": %d", val ); m_pLabel[PROP_CONTRAST]->setText( s ); m_pDev->setPicConstrast( 2 * (val + 128) ); } void PicturePropDialog::changeHue(int val) { QString s = QString().sprintf( tr("Hue")+": %d", val ); m_pLabel[PROP_HUE]->setText( s ); m_pDev->setPicHue( val ); } void PicturePropDialog::changeSaturation(int val) { QString s = QString().sprintf( tr("Saturation")+": %d", val ); m_pLabel[PROP_SATURATION]->setText( s ); m_pDev->setPicColor( 2 * (val + 128) ); } void PicturePropDialog::accept() { WI("Image\\Brightness", m_pSlider[PROP_BRIGHTNESS]->value()); WI("Image\\Color", 256+2*m_pSlider[PROP_SATURATION]->value()); WI("Image\\Contrast", 256+2*m_pSlider[PROP_CONTRAST]->value()); WI("Image\\Hue", m_pSlider[PROP_HUE]->value()); // printf("Writing: %d %d %d %d\n", // m_pSBrightness->value(), // 256+2*m_pSConstrast->value(), // 256+2*m_pSSaturation->value(), // m_pSHue->value() // ); return QDialog::accept(); } avifile-0.7.48~20090503.ds/samples/qtvidcap/picprop.h0000644000175000017500000000106507657673710021071 0ustar yavoryavor#ifndef PICTUREPROPDIALOG_H #define PICTUREPROPDIALOG_H #include "picprop_p.h" class v4lxif; class PicturePropDialog : public PicPropDialog { Q_OBJECT; v4lxif* m_pDev; static const char* labels[PROP_LAST]; public: PicturePropDialog(v4lxif* pDev); //QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~PicturePropDialog(); public slots: void changeBrightness(int); void changeContrast(int); void changeHue(int); void changeSaturation(int); void accept(); }; #endif // PICTUREPROPDIALOG_H avifile-0.7.48~20090503.ds/samples/qtvidcap/picprop_p.cpp0000644000175000017500000000372507671120557021740 0ustar yavoryavor#include "picprop_p.h" #include "picprop_p.moc" #include #include #include #include #include #include /* * Constructs a PicPropDialog which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ PicPropDialog::PicPropDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "PicPropDialog" ); setCaption( tr( "Picture Properties" ) ); #if QT_VERSION > 220 setSizeGripEnabled( TRUE ); #endif //setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, sizePolicy().hasHeightForWidth() ) ); //setMouseTracking( TRUE ); QVBoxLayout* vb = new QVBoxLayout( this, 5 ); QFrame* pFrame = new QFrame( this ); pFrame->setFrameShadow( QFrame::Raised ); //pFrame->setFrameShadow( QFrame::Sunken ); //pFrame->setFrameShape( QFrame::Box ); pFrame->setFrameShape( QFrame::WinPanel ); vb->addWidget( pFrame ); QGridLayout* gl = new QGridLayout( pFrame, 1, 1 ); gl->setMargin( 10 ); gl->setSpacing( 5 ); for (unsigned i = 0; i < PROP_LAST; i++) { m_pSlider[i] = new QSlider( -128, 127, 16, 0, QSlider::Horizontal, pFrame ); m_pSlider[i]->setTickmarks( QSlider::Right ); m_pSlider[i]->setMinimumWidth( 150 ); m_pSlider[i]->setValue( -128 ); m_pLabel[i] = new QLabel( "", pFrame ); m_pLabel[i]->setMinimumWidth( 110 ); gl->addWidget( m_pSlider[i], i, 0 ); gl->addWidget( m_pLabel[i], i, 1 ); } QHBoxLayout* hb = new QHBoxLayout( vb ); hb->addStretch( 1 ); QPushButton* pButton = new QPushButton( tr( "&Ok" ), this ); pButton->setDefault( TRUE ); hb->addWidget( pButton ); hb->addStretch( 1 ); // signals and slots connections connect( pButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); } avifile-0.7.48~20090503.ds/samples/qtvidcap/picprop_p.h0000644000175000017500000000072707671120557021404 0ustar yavoryavor#ifndef PICPROPDIALOG_H #define PICPROPDIALOG_H #include class QLabel; class QSlider; class PicPropDialog : public QDialog { Q_OBJECT; protected: enum { PROP_BRIGHTNESS, PROP_CONTRAST, PROP_SATURATION, PROP_HUE, PROP_LAST, }; public: PicPropDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); QSlider* m_pSlider[PROP_LAST]; QLabel* m_pLabel[PROP_LAST]; }; #endif // PICPROPDIALOG_H avifile-0.7.48~20090503.ds/samples/qtvidcap/qt_visual.c0000644000175000017500000001271707671120557021415 0ustar yavoryavor/* visual.c for Bt848 frame grabber driver Copyright (C) 1996,97 Marcus Metzler (mocm@thp.uni-koeln.de) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #ifndef X_DISPLAY_MISSING #include #include #include #include #include #include #include "qt_visual.h" #define MAX_VISUAL_CLASS 6 #define MAX_VISUAL_NAME 6 char visualName[MAX_VISUAL_NAME]; /* * Visual names. */ static const struct visual_class_name { int visual_class; const char *visual_name; } visual_class_names[MAX_VISUAL_CLASS] = { { StaticGray, "StaticGray" }, { GrayScale, "GrayScale" }, { StaticColor, "StaticColor" }, { PseudoColor, "PseudoColor" }, { TrueColor, "TrueColor" }, { DirectColor, "DirectColor" } }; /* * Convert a visual class to its name. */ const char *Vis_name(int vis) { int i; for (i = 0; i < MAX_VISUAL_CLASS; i++) { if (visual_class_names[i].visual_class == vis) { return visual_class_names[i].visual_name; } } return "UnknownVisual"; } /* * List the available visuals for the default screen. */ void List_visuals(Display *dpy) { int i,num,c; XVisualInfo *vinfo_ptr,my_vinfo; long mask; //Display *dpy=XtDisplay(wid); num = 0; mask = 0; my_vinfo.screen = DefaultScreen(dpy); mask |= VisualScreenMask; vinfo_ptr = XGetVisualInfo(dpy, mask, &my_vinfo, &num); printf("Listing all visuals:\n"); for (i = 0; i < num; i++) { c=vinfo_ptr[i].class; printf("Visual class %12s ( %d ) \n",Vis_name(c),c); printf(" id 0x%02x\n", (unsigned)vinfo_ptr[i].visualid); printf(" screen %8d\n", vinfo_ptr[i].screen); printf(" depth %8d\n", vinfo_ptr[i].depth); printf(" red_mask 0x%06x\n", (unsigned)vinfo_ptr[i].red_mask); printf(" green_mask 0x%06x\n", (unsigned)vinfo_ptr[i].green_mask); printf(" blue_mask 0x%06x\n", (unsigned)vinfo_ptr[i].blue_mask); printf(" colormap_size %8d\n", vinfo_ptr[i].colormap_size); printf(" bits_per_rgb %8d\n", vinfo_ptr[i].bits_per_rgb); } XFree((void *) vinfo_ptr); } /* * Use suitable visual */ int find_visual(Display *dpy, char *visualName,Visual **v,int *visual_class) { int i,num,best_depth,c_depth,visual_id,dispDepth = 0; XVisualInfo *vinfo_ptr,my_vinfo,*best_vinfo; long mask; char cdummy; //Display *dpy; // Colormap colormap ; Boolean dual=False; //dpy=XtDisplay(w); visual_id = -1; *visual_class = -1; if (visualName) { if (strncmp(visualName, "0x", 2) == 0) { if (sscanf(visualName, "%x", &visual_id) < 1) { printf("fatal: qt_visual: Bad visual id \"%s\", using default\n", visualName); List_visuals(dpy); visual_id = -1; } } else if (strncmp(visualName, "c", 1) == 0) { if (sscanf(visualName, "%s%d",&cdummy, visual_class) < 1) { printf("fatal: qt_visual: Bad visual id \"%s\", using default\n", visualName); List_visuals(dpy); visual_id = -1; } } else { for (i = 0; i < MAX_VISUAL_CLASS; i++) { if (strncasecmp(visualName, visual_class_names[i].visual_name, strlen(visual_class_names[i].visual_name)) == 0) { *visual_class = visual_class_names[i].visual_class; break; } } if (*visual_class == -1) { printf("fatal: qt_visual: Unknown visual class named \"%s\", using default\n", visualName); List_visuals(dpy); } } } mask = 0; my_vinfo.screen = DefaultScreen(dpy); mask |= VisualScreenMask; if (*visual_class >= 0) { my_vinfo.class = *visual_class; mask |= VisualClassMask; } if (visual_id >= 0) { my_vinfo.visualid = visual_id; mask |= VisualIDMask; } num = 0; if ((vinfo_ptr = XGetVisualInfo(dpy, mask, &my_vinfo, &num)) == NULL || num <= 0) { printf("fatal: qt_visual: No visuals available with class name \"%s\", using default\n", visualName); *visual_class = -1; } else { best_vinfo = vinfo_ptr; if (best_vinfo->depth < 16) dual=True; for (i = 1; i < num; i++) { best_depth = best_vinfo->depth; c_depth = vinfo_ptr[i].depth; if (c_depth < 16) dual=True; if (c_depth > best_depth) best_vinfo = &vinfo_ptr[i]; } *v = best_vinfo->visual; *visual_class = best_vinfo->class; dispDepth = best_vinfo->depth; XFree((void *) vinfo_ptr); } if (dispDepth<16 && dual) dual=False; if(dual){ /* colormap= XCreateColormap(dpy, DefaultRootWindow(dpy), *v, AllocNone); */ #ifdef myDEBUG printf ("Debug: qt_visual: found Dual Visual Mode using %s\n",Vis_name(*visual_class)); #endif } else { #ifdef myDEBUG printf ("Debug: qt_visual:using Visual %s\n",Vis_name(*visual_class)); #endif //w->core.colormap=XDefaultColormapOfScreen(XtScreen(w)); } return dispDepth; } #else void List_visuals(Display *dpy) {} #endif avifile-0.7.48~20090503.ds/samples/qtvidcap/qt_visual.h0000644000175000017500000000210107516750561021406 0ustar yavoryavor/* visual.h for Bt848 frame grabber driver Copyright (C) 1996,97 Marcus Metzler (mocm@thp.uni-koeln.de) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef QT_VISUAL_H #define QT_VISUAL_H #ifdef __cplusplus extern "C" { #endif void List_visuals(Display *dpy); const char *Vis_name(int vis); int find_visual(Display *dpy, char *visualName,Visual **v,int *); #ifdef __cplusplus } #endif #endif /* QT_VISUAL_H */ avifile-0.7.48~20090503.ds/samples/qtvidcap/qtrenderer.cpp0000644000175000017500000001300110647424672022106 0ustar yavoryavor #include #include #include #include "qtrenderer.h" #include #include #include //#define QT_CLEAN_NAMESPACE #include #ifdef __FreeBSD__ #include #include #endif #include #include #include #include #include #include #define __MODULE__ "Shm renderer" inline static void qSafeXDestroyImage( XImage *x ) { if ( x->data ) { free( x->data ); x->data = 0; } XDestroyImage( x ); } ShmRenderer::ShmRenderer(QWidget* w, int x, int y, int _xpos, int _ypos) : xshmimg(0), xshmpm(0), xpos(_xpos), ypos(_ypos), m_w(x), m_h(y), pic_w(x), pic_h(y), dev((QPaintDevice*)w), xshminit(false) { alloc(); } ShmRenderer::~ShmRenderer() { free(); } void ShmRenderer::alloc() { int major, minor; Bool pixmaps_ok; Display *dpy = dev->x11Display(); int dd = dev->x11Depth(); Visual *vis = (Visual*)dev->x11Visual(); // printf("Creating SHM renderer, width %d, height %d\n", pic_w, pic_h); // printf("Server vendor %s, release %d\n", ServerVendor(dpy), VendorRelease(dpy)); try { XGCValues xcg; xcg.graphics_exposures=false; gc=XCreateGC(dpy, dev->handle(), GCGraphicsExposures, &xcg); if ( !XShmQueryVersion(dpy, &major, &minor, &pixmaps_ok) ) throw FATAL("MIT SHM extension not supported"); bool ok; int _pic_w=((pic_w+m_w-1)/m_w)*m_w; int _pic_h=((pic_h+m_h-1)/m_h)*m_h; xshminfo.shmid = shmget( IPC_PRIVATE, _pic_w*_pic_h*4, IPC_CREAT | 0777 ); ok = xshminfo.shmid != -1; if(!ok) throw FATAL("Can't get shared memory segment"); xshminfo.shmaddr = (char*)shmat( xshminfo.shmid, 0, 0 ); ok = xshminfo.shmaddr != 0; xshminfo.readOnly = FALSE; if ( !ok ) throw FATAL("Can't attach shared memory segment"); ok = XShmAttach( dpy, &xshminfo ); if ( !ok ) throw FATAL("XShmAttach failed"); xshmimg = XShmCreateImage( dpy, vis, dd, ZPixmap, xshminfo.shmaddr, &xshminfo, _pic_w, _pic_h ); if ( !xshmimg ) throw FATAL("Can't create shared image"); } catch(...) { xshmimg = 0; if ( xshminfo.shmaddr ) shmdt( xshminfo.shmaddr ); if ( xshminfo.shmid != -1 ) shmctl( xshminfo.shmid, IPC_RMID, 0 ); throw; } } int ShmRenderer::free() { printf("Free()\n"); if ( xshmimg == 0 ) return 0; Display *dpy = dev->x11Display(); XSync(dpy, false); if ( xshmpm ) { XFreePixmap( dpy, xshmpm ); xshmpm = 0; } XShmDetach( dpy, &xshminfo ); xshmimg->data = 0; qSafeXDestroyImage( xshmimg ); xshmimg = 0; shmdt( xshminfo.shmaddr ); shmctl( xshminfo.shmid, IPC_RMID, 0 ); XFreeGC(dpy, gc); xshminfo.shmaddr=0; xshminfo.shmid=0; return 0; } int ShmRenderer::resize(int& new_w, int& new_h) { if(new_w<0)return -1; if(new_h<0)return -1; new_w&=(~7); new_h&=(~7); int xratio=(new_w+m_w-1)/m_w; int yratio=(new_h+m_h-1)/m_h; int old_xratio=(pic_w+m_w-1)/m_w; int old_yratio=(pic_h+m_h-1)/m_h; printf("New size: %d %d\n", new_w, new_h); pic_w=new_w; pic_h=new_h; if((xratio!=old_xratio)||(yratio!=old_yratio)) { mutex.Lock(); free(); alloc(); mutex.Unlock(); } return 0; } static void copy_deinterlace_24(void* outpic, const void* inpic, int xdim, int height) { #ifdef ARCH_X86_32 for(int i=0; idata; if(outpic==0) return 0; if(data==0) return 0; Display *dpy = dev->x11Display(); Visual *vis = (Visual*)dev->x11Visual(); int bit_depth = avm::GetPhysicalDepth(dpy); if (mutex.TryLock() != 0) return -1; // pthread_mutex_lock(&mutex); sync(); const char* src; // if((pic_h==m_h) && (pic_w==m_w)) if(!deinterlace) memcpy(outpic, data, m_w*m_h*((bit_depth+7)/8)); else switch(bit_depth) { // case 15: // copy_deinterlace_555(outpic, data, m_w, m_h); // break; // case 16: // copy_deinterlace_565(outpic, data, m_w, m_h); // break; case 24: case 32: copy_deinterlace_24(outpic, data, m_w*bit_depth/8, m_h); break; default: memcpy(outpic, data, m_w*m_h*((bit_depth+7)/8)); break; } // else // { // printf("Zooming\n"); // zoom((unsigned short*)outpic, (unsigned short*)data, pic_w, pic_h, m_w, m_h, bit_depth, m_w*((pic_w+m_w-1)/m_w)); // } XShmPutImage(dpy, dev->handle(), gc, xshmimg, 0, 0, xpos, ypos, pic_w, pic_h, true); mutex.Unlock(); return 0; } int ShmRenderer::sync() { Display *dpy = dev->x11Display(); XSync(dpy, false); return 0; } avifile-0.7.48~20090503.ds/samples/qtvidcap/qtrenderer.h0000644000175000017500000000150207671120557021554 0ustar yavoryavor#ifndef QTRENDER_H #define QTRENDER_H #include #include #include #include #include class QPaintDevice; class QPainter; class QWidget; class ShmRenderer { XImage* xshmimg; Pixmap xshmpm; XShmSegmentInfo xshminfo; GC gc; avm::PthreadMutex mutex; int xpos, ypos; int m_w, m_h, pic_w, pic_h; QPaintDevice* dev; bool xshminit; void alloc(); int free(); public: ShmRenderer(QWidget* w, int x, int y, int xpos = 0, int ypos = 0); ~ShmRenderer(); int resize(int& new_w, int& new_h); int draw(QPainter* pm, const void* data, bool deinterlace = false); int getWidth() const {return m_w;} int getHeight() const {return m_h;} void move(int x, int y); int sync(); }; #endif // QTRENDER_H avifile-0.7.48~20090503.ds/samples/qtvidcap/timertable.cpp0000644000175000017500000012350110474270251022060 0ustar yavoryavor/* TimerTable window for AviCap written 2003 by Alexander Rawass (alexannika@users.sourceforge.net) */ #include "timertable.h" #include "timertable.moc" #include "vidconf.h" #include "v4lwindow.h" #include "capproc.h" #include "codecdialog.h" #include "avicapwnd.h" #include #include #include #include #include #define DECLARE_REGISTRY_SHORTCUT #include #undef DECLARE_REGISTRY_SHORTCUT #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if QT_VERSION>=300 #include #endif #include #include #include #include // atof #include //statfs TimerTableItem::TimerTableItem(QListView *parent,TimerTable *timer_win,V4LWindow *v4lw,int ch,QDateTime start,QTime stop,QString fname,QString desc,int whentime,int whatday,QString codec) : QCheckListItem(parent,"test",QCheckListItem::CheckBox), avm::AvmOutputLog("TimerTableItem") { timer_window=timer_win; my_v4lwin=v4lw; setTable(ch,start,stop,fname,desc,whentime,whatday,codec); } /* **************************************** */ TimerTableItem::~TimerTableItem(){ } void TimerTable::setEpgWindow(EpgWindow *win){ epgwin=win; connect((const QObject *)win,SIGNAL(emitAddRecording(EpgProgram *)),this,SLOT(addEpgRecording(EpgProgram *))); } void TimerTableItem::checkWhen(){ QDateTime currentdatetime=QDateTime::currentDateTime(); QDate currentdate=QDate::currentDate(); QTime currenttime=currentdatetime.time(); QTime start_timeonly=start_time.time(); QTime stop_timeonly=stop_datetime.time(); if(when==0){ //once, do nothing } else if(when==1){ //tomorrow start_time=currentdatetime.addDays(1); when=0; //set back to once } else if(when==2){ //day after tomorrow start_time=currentdatetime.addDays(2); when=0; } else if(when==3){ //every if(day==0){ //every day if(start_timeonlycurrenttime){ // it is NOW start_time.setDate(currentdate); } else if(start_timeonlycurrenttime){ // it is NOW start_time.setDate(currentdate); } else if(start_timeonlycurrenttime){ textcol=QColor(0,0,0); } if(this==timer_window->getNextRecording()){ textcol=QColor(0,0,0); new_cg.setColor(QColorGroup::Highlight,QColor(0,150,0)); new_cg.setColor(QColorGroup::Base,QColor(180,255,180)); } if(this==timer_window->getCurrentRecording()){ textcol=QColor(0,0,0); new_cg.setColor(QColorGroup::Highlight,QColor(150,0,0)); new_cg.setColor(QColorGroup::Base,QColor(255,160,160)); } new_cg.setColor(QColorGroup::Text,textcol); //new_cg.setColor(QColorGroup::Foreground,QColor(255,0,0)); //new_cg.setColor(QColorGroup::Background,QColor(0,255,0)); //new_cg.setColor(QColorGroup::Button,QColor(255,0,255)); //new_cg.setColor(QColorGroup::ButtonText,QColor(255,0,255)); //new_cg.setColor(QColorGroup::Highlight,QColor(100,0,255)); //new_cg.setColor(QColorGroup::HighlightedText,QColor(255,100,255)); QCheckListItem::paintCell(p,new_cg,column,width,align); } int TimerTableItem::compare(QListViewItem *other,int col, bool ascend) const { if(other==NULL){ return 0; } TimerTableItem *other_tti=(TimerTableItem *)other; int result=0; if(col==2){ //start time if(getStartTime()==other_tti->getStartTime()){ result=0; } else{ result=(getStartTime()>other_tti->getStartTime()) ? -1 : 1 ; } } else if(col==3){ //stop time if(getStopDateTime()==other_tti->getStopDateTime()){ result=0; } else{ result=(getStopDateTime()>other_tti->getStopDateTime()) ? -1 : 1; } } else{ #if QT_VERSION>=300 result=QListViewItem::compare(other,col,ascend); #else #warning "fixme: QListViewItem::compare" printf("fixme: QListViewItem::compare for QT23\n"); result=0; #endif } return result; } /* **************************************** */ // sets an entry in the table to new values void TimerTableItem::setTable(int ch,QDateTime start,QTime stop,QString fname,QString desc,int whentime,int whatday,QString codec) { channel_nr=ch; start_time=start; stop_time=stop; filename=fname; description=desc; when=whentime; day=whatday; named_codec=codec; stop_datetime=timer_window->calc_stopDateTime(start_time,stop_time); #if QT_VERSION>=300 QString start_timestr=start_time.toString(my_dateformat); #else QString weekday=start_time.date().dayName(start_time.date().dayOfWeek()); QString start_timestr=dateTimeToString(start_time)+QString(" ")+weekday; #endif QString stop_timestr=stop_time.toString(my_timeformat); QString numstr; //setText(0,QString::number(channel_nr)); setText(0,description); //setText(1,QString::number(channel_nr+1)+" - "+QString(my_v4lwin->getXawtvStation(channel_nr).c_str())); setText(1,numstr.sprintf("%02d",channel_nr+1)+" - "+QString(my_v4lwin->getXawtvStation(channel_nr).c_str())); setText(2,start_timestr); setText(3,stop_timestr); setText(4,named_codec); setText(5,filename); } /* **************************************** */ void TimerTable::addEpgRecording(EpgProgram *prog){ printf("signal got\n"); QDateTime start=prog->start; QDateTime stop=prog->stop; start=start.addSecs(-RI("EpgMinBeforeProgram",5)*60); stop=stop.addSecs(RI("EpgMinBeforeProgram",5)*60); TimerTableItem *item=new TimerTableItem(table,this,my_v4lw,prog->channelnr-1,start,stop.time(),"epgprogram.avi",prog->title,0,0,RS("NamedCodecsCurrent","-Default-")); AVMOUT(AVML_DEBUG, "Added recording from EPG: %s from %s to %s", prog->title.latin1(),start.toString().latin1(), stop.toString().latin1()); } /* **************************************** */ // creates the timertable TimerTable::TimerTable(QWidget* parent, v4lxif* v4l, V4LWindow* w) : QDialog( NULL, "Avicap Timertable", false), avm::AvmOutputLog("TimerTable") { my_v4lxif=v4l; my_v4lw=w; AVMOUT(AVML_DEBUG, tr("TimerTable started")); setMinimumSize(600,700); //setMaximumSize(800,800); setCaption( tr("AviCap Timertable") ); timer_mode=TimerOff; next_recording=NULL; current_recording=NULL; last_item_clicked=NULL; shutdown_message=NULL; epgwin=NULL; splitter1=new QSplitter(QSplitter::Vertical,this); splitter1->setOpaqueResize(true); table=new QListView(splitter1); table->setBaseSize(600,200); table->setMinimumSize(600,200); // table->setMaximumSize(800,800); table->setSelectionMode(QListView::Single); connect(table,SIGNAL(pressed(QListViewItem *)),this,SLOT(item_clicked(QListViewItem *))); //table->addColumn("ChNr"); table->addColumn(tr("Description")); table->addColumn(tr("Channel Name")); table->addColumn(tr("Start Recording")); table->addColumn(tr("End Rec")); table->addColumn(tr("Codec")); //table->setColumnAlignment(3,Qt::AlignRight); table->setColumnAlignment(3,Qt::AlignHCenter); table->addColumn(tr("Filename")); //table->setItemMargin(5); table->setAllColumnsShowFocus(true); table->setShowSortIndicator(true); table->setSorting(2,true); table->sort(); all_box=new QGroupBox(1,Qt::Horizontal,splitter1); all_box->setBaseSize(600,600); all_box->setMinimumSize(600,600); // all_box->setMaximumSize(600,800); splitter1->setResizeMode(all_box,QSplitter::Stretch); splitter1->setResizeMode(table,QSplitter::Stretch); //edit_box=new QGroupBox(2,Qt::Horizontal,all_box); edit_box=new QWidget(all_box); //edit_box=new QGroupBox(splitter1); edit_box->setBaseSize(600,200); QGridLayout* gl = new QGridLayout( edit_box, 1, 1 ); gl->setSpacing( 5 ); gl->setMargin( 5 ); int row=0; when_combobox=new QComboBox(edit_box); gl->addWidget(when_combobox,row,0); when_combobox->insertItem(tr("once")); when_combobox->insertItem(tr("tomorrow")); when_combobox->insertItem(tr("day after tomorrow")); when_combobox->insertItem(tr("every")); when_combobox->insertItem(tr("next")); day_combobox=new QComboBox(edit_box); gl->addWidget(day_combobox,row,1); day_combobox->insertItem(tr("day")); for(int i=1; i<=7;i++){ #if QT_VERSION>=300 day_combobox->insertItem(QDate::longDayName(i)); #else QDate bogus; day_combobox->insertItem(bogus.dayName(i)); #endif } row++; QLabel *l=new QLabel(tr("Start Date/Time:"),edit_box); gl->addWidget(l,row,0); begin_timeedit=new QDateTimeEdit(edit_box,"start_time"); gl->addWidget(begin_timeedit,row,1); row++; QLabel *l2=new QLabel(tr("End Time:"),edit_box); gl->addWidget(l2,row,0); end_timeedit=new QTimeEdit(edit_box,"end_time"); gl->addWidget(end_timeedit,row,1); row++; QLabel *l3=new QLabel(tr("Channel:"),edit_box); gl->addWidget(l3,row,0); channelbox=new QComboBox(edit_box,"channel"); gl->addWidget(channelbox,row,1); if (my_v4lw->getStations()) { char cbuf[100]; for (int i = 0; i < my_v4lw->getStations(); i++){ sprintf(cbuf,"%-2d %s",i+1,my_v4lw->getXawtvStation(i).c_str()); channelbox->insertItem(cbuf); } } row++; QLabel *l444=new QLabel(tr("Codec:"),edit_box); gl->addWidget(l444,row,0); codecbox=new QComboBox(edit_box,"codec"); gl->addWidget(codecbox,row,1); QString named_codecs_current=RS("NamedCodecsCurrent","-Default-"); recreateCodecBox(named_codecs_current); row++; QLabel *l4=new QLabel(tr("Filename:"),edit_box); gl->addWidget(l4,row,0); filename_edit=new QLineEdit(edit_box,"filename"); gl->addWidget(filename_edit,row,1); row++; QLabel *l5=new QLabel(tr("Description"),edit_box); gl->addWidget(l5,row,0); description_edit=new QLineEdit(edit_box,"description"); gl->addWidget(description_edit,row,1); edit_box->hide(); edit_buttons=new QButtonGroup(3,Qt::Horizontal,all_box); new_button=new QPushButton(tr("new"),edit_buttons); modify_button=new QPushButton(tr("modify"),edit_buttons); remove_button=new QPushButton(tr("remove"),edit_buttons); rec_buttons=new QButtonGroup(2,Qt::Horizontal,all_box); rec_start_button=new QPushButton(tr("start timer"),rec_buttons); shutdown_checkbox=new QCheckBox(tr("shutdown when allowed"),rec_buttons); connect(new_button,SIGNAL(pressed()),this,SLOT(button_new_pressed())); connect(modify_button,SIGNAL(pressed()),this,SLOT(button_modify_pressed())); connect(remove_button,SIGNAL(pressed()),this,SLOT(button_remove_pressed())); connect(rec_start_button,SIGNAL(pressed()),this,SLOT(button_start_pressed())); QWidget *wi=new QWidget(all_box); QVBoxLayout *lo=new QVBoxLayout(wi); status_label=new QLabel(wi); lo->addWidget(status_label); init_entry_widgets(); load(); if(table->childCount()>0){ edit_box->show(); TimerTableItem *first_item=(TimerTableItem *)table->firstChild(); table->setCurrentItem(first_item); table->setSelected(first_item,true); last_item_clicked=first_item; item_clicked(first_item); } set_status_label(); next_recording=find_first_recording(); if(next_recording){ table->ensureItemVisible(next_recording); table->setCurrentItem(next_recording); table->setSelected(next_recording,true); last_item_clicked=next_recording; item_clicked(next_recording); } else{ printf("no next recording at startup\n"); } my_timer=new QTimer(this); connect(my_timer,SIGNAL(timeout()),SLOT(timer())); my_timer->start(1000); } /* **************************************** */ TimerTable::~TimerTable(){ printf("TimerTable has been exited\n"); my_timer->stop(); save(); } /* **************************************** */ QString TimerTable::add_current_time_info(){ QString result; result=QString().sprintf(tr("Current Time : %s\n"),QDateTime::currentDateTime().toString(my_dateformat).latin1()); return result; } /* **************************************** */ QString TimerTable::add_next_recording_info(){ QString result; QDateTime currenttime=QDateTime::currentDateTime(); if(next_recording){ int chnr=next_recording->getChannel(); avm::string chname=my_v4lw->getXawtvStation(chnr); QString fname=next_recording->getFilename(); QString desc=next_recording->getDescription(); QDateTime starttime=next_recording->getStartTime(); int diff_in_secs=currenttime.secsTo(starttime); //printf("%d secs to wait\n",diff_in_secs); QString etastring; if(diff_in_secs>60*60*24){ // more than a day int days=diff_in_secs/(60*60*24); etastring.sprintf("more than %d days",days); } else{ QTime notime=QTime(); QTime eta=notime.addSecs(diff_in_secs); etastring=eta.toString(my_timeformat); } result=QString().sprintf(tr("Next Recording: %s #%d %s to %s\n")+ tr("\tstarts at %s in %s\n"), desc.latin1(),chnr+1,chname.c_str(),fname.latin1(), starttime.toString(my_dateformat).latin1(),etastring.latin1()); } else{ result=QString().sprintf(tr("No Next Recording\n")); } return result; } /* **************************************** */ QString TimerTable::add_current_recording_info(){ QString result; QDateTime currenttime=QDateTime::currentDateTime(); if(current_recording){ QDateTime stoptime=current_recording->getStopDateTime(); int diff_in_secs=currenttime.secsTo(stoptime); //printf("%d secs to go\n",diff_in_secs); QTime notime=QTime(); QTime eta=notime.addSecs(diff_in_secs); int chnr=current_recording->getChannel(); avm::string chname=my_v4lw->getXawtvStation(chnr); QString fname=current_recording->getFilename(); QString desc=current_recording->getDescription(); // sprintf(sbuf,tr("Currently Recording: stops at %s in %s\nChannel Nr %d %s %s\nFilename %s\n"),stoptime.toString(my_dateformat).latin1(),eta.toString(my_timeformat).latin1(),chnr+1,chname.c_str(),desc.latin1(),fname.latin1()); result=QString().sprintf(tr("Current Recording: %s #%d %s to %s\n\tstops at %s in %s\n"), desc.latin1(),chnr+1,chname.c_str(),fname.latin1(), stoptime.toString(my_dateformat).latin1(),eta.toString(my_timeformat).latin1()); } else{ result=QString().sprintf(tr("No Current Recording\n")); } return result; } /* **************************************** */ QString TimerTable::add_sanity_check_info(){ QString result; TimerTableItem *item1=(TimerTableItem *)table->firstChild(); bool insane=false; while(!insane && item1!=NULL){ if(item1->isOn()){ TimerTableItem *item2=(TimerTableItem *)table->firstChild(); while(!insane && item2!=NULL){ if(item2!=item1 && item2->isOn()){ QDateTime start1=item1->getStartTime(); QDateTime stop1=item1->getStopDateTime(); QDateTime start2=item2->getStartTime(); QDateTime stop2=item2->getStopDateTime(); if((start1getXawtvStation(item1->getChannel()); avm::string chn2=my_v4lw->getXawtvStation(item2->getChannel()); result=QString().sprintf(tr("Sanity Check failed:\n")+ \ "a) %-10s\t#%d %-10s " +tr("from")+" %s to %s\n" + \ "b) %-10s\t#%d %-10s "+tr("from")+" %s to %s\n", item1->getDescription().latin1(),item1->getChannel()+1,chn1.c_str(), \ item1->getStartTime().toString(my_dateformat).latin1(), \ item1->getStopDateTime().toString(my_dateformat).latin1(), item2->getDescription().latin1(),item2->getChannel()+1,chn2.c_str(), \ item2->getStartTime().toString(my_dateformat).latin1(), \ item2->getStopDateTime().toString(my_dateformat).latin1()); //strcat(bigbuf,sbuf); insane=true; } } item2=(TimerTableItem *)item2->nextSibling(); } } item1=(TimerTableItem *)item1->nextSibling(); } return result; } /* **************************************** */ void TimerTable::set_status_label(){ QDateTime currenttime=QDateTime::currentDateTime(); if(timer_mode==TimerOff){ QString curtim=QString().sprintf(tr("Current Time: %s\nTimer not activated\n"),currenttime.toString(my_dateformat).latin1()); //add_next_recording_info(bigbuf); //add_sanity_check_info(bigbuf); status_label->setText(curtim); } else if(timer_mode==TimerWaiting){ QString label; label=add_current_time_info(); label+=add_next_recording_info(); label+=add_sanity_check_info(); status_label->setText(label); } else if(timer_mode==TimerRecording){ QString label; label=add_current_time_info(); label+=add_current_recording_info(); label+=add_next_recording_info(); label+=add_sanity_check_info(); status_label->setText(label); } } /* **************************************** */ // initializes the entry widgets with default values void TimerTable::init_entry_widgets(){ QDateTime current=QDateTime::currentDateTime(); begin_timeedit->setDateTime(current); end_timeedit->setTime(QTime::currentTime()); filename_edit->setText("./movie.avi"); channelbox->setCurrentItem(0); codecbox->setCurrentItem(0); description_edit->setText("untitled"); when_combobox->setCurrentItem(0); day_combobox->setCurrentItem(0); } /* **************************************** */ void TimerTable::item_clicked(QListViewItem *lvitem){ TimerTableItem *item=(TimerTableItem *)lvitem; if(item!=NULL){ if(item==next_recording){ printf("next recording clicked\n"); description_edit->setBackgroundColor(QColor(150,0,0)); //description_edit->setBackgroundMode(Qt::PaletteDark); //description_edit->setPaletteBackgroundColor(QColor(150,0,0)); //description_edit->setPaletteForegroundColor(QColor(150,0,0)); //description_edit->setEraseColor(QColor(150,0,0)); //QPalette pal(QColor(150,0,0),QColor(0,150,0)); //QPalette pal; //description_edit->setPalette(pal); } begin_timeedit->setDateTime(item->getStartTime()); end_timeedit->setTime(item->getStopTime()); filename_edit->setText(item->getFilename()); channelbox->setCurrentItem(item->getChannel()); description_edit->setText(item->getDescription()); when_combobox->setCurrentItem(item->getWhen()); day_combobox->setCurrentItem(item->getDay()); recreateCodecBox(item->getNamedCodec()); last_item_clicked=item; } } void TimerTable::recreateCodecBox(QString set_name){ while(codecbox->count()>0){ codecbox->removeItem(0); } codecbox->insertItem("-Default-"); codecbox->setEditable(false); codecbox->setCurrentItem(0); { int i=0; QString regname=QString().sprintf("NamedCodecs-%02d-Savename",i); QString nc_savename=RS(regname,"NONE"); while(nc_savename!="NONE"){ regname=QString().sprintf("NamedCodecs-%02d-Codec",i); QString nc_codec=RS(regname,"NONE"); //codecbox->insertItem(nc_savename); i++; regname=QString().sprintf("NamedCodecs-%02d-Savename",i); nc_savename=RS(regname,"NONE"); } for(int j=0;jcount();j++){ if(codecbox->text(j)==set_name){ codecbox->setCurrentItem(j); } } } } /* **************************************** */ void TimerTable::button_new_pressed(){ edit_box->show(); init_entry_widgets(); TimerTableItem *newitem=set_tableitem(NULL); table->setCurrentItem(newitem); table->setSelected(newitem,true); last_item_clicked=newitem; } /* **************************************** */ // helper routine to either // create a new TimerTableItem or // modify an existing one TimerTableItem * TimerTable::set_tableitem(TimerTableItem *item){ QDateTime start_datetime=begin_timeedit->dateTime(); QTime stop_time=end_timeedit->time(); int channel_nr=channelbox->currentItem(); QString filename=filename_edit->text(); QString desc=description_edit->text(); QString stationname=my_v4lw->getXawtvStation(channel_nr).c_str(); int when=when_combobox->currentItem(); int day=day_combobox->currentItem(); QString codec=codecbox->currentText(); QDateTime currentdatetime=QDateTime::currentDateTime(); QDate currentdate=QDate::currentDate(); QTime currenttime=currentdatetime.time(); QTime start_time=start_datetime.time(); //QString start_timestr=start_datetime.toString(my_dateformat); //QString stop_timestr=stop_time.toString(my_timeformat); if(item!=NULL){ item->setTable(channel_nr,start_datetime,stop_time,filename,desc,when,day,codec); AVMOUT(AVML_DEBUG, "Modified item %s from %s to %s", desc.latin1(),start_datetime.toString().latin1(), stop_time.toString().latin1()); } else{ item=new TimerTableItem(table,this,my_v4lw,channel_nr,start_datetime,stop_time,filename,desc,when,day,codec); AVMOUT(AVML_DEBUG, "New item %s from %s to %s", desc.latin1(),start_datetime.toString().latin1(), stop_time.toString().latin1()); } table->sort(); table->ensureItemVisible(item); return item; } /* **************************************** */ void TimerTable::button_modify_pressed(){ // TimerTableItem *item=(TimerTableItem *)table->currentItem(); TimerTableItem *item=last_item_clicked; if(item!=NULL){ AVMOUT(AVML_DEBUG, "Item modified"); set_tableitem(item); } save(); emit timertableChanged(); } /* **************************************** */ void TimerTable::button_remove_pressed(){ TimerTableItem *item=(TimerTableItem *)table->currentItem(); if (item==current_recording){ AVMOUT(AVML_WARN, "Can't remove - it's the current recording"); } else{ if(item==next_recording){ next_recording=NULL; } if(item==last_item_clicked){ last_item_clicked=NULL; } table->takeItem(item); AVMOUT(AVML_DEBUG, "Removed item %s",item->getDescription().latin1()); delete item; save(); emit timertableChanged(); } } /* **************************************** */ // gives back the first recording that should be done, // starting from this time // old recordings and disabled recordings are ignored TimerTableItem *TimerTable::find_first_recording(){ TimerTableItem *item=(TimerTableItem *)table->firstChild(); QDateTime currenttime=QDateTime::currentDateTime(); QDateTime found_date=currenttime; TimerTableItem *found_item=NULL; while(item!=NULL){ if(item->isOn()){ QDateTime new_date=item->getStartTime(); if(new_date>=currenttime){ // this recordings starts in the future //if(new_dategetDescription().latin1()); } } else{ // this recording starts in the past // but it might still end in the future QDateTime stop_date=item->getStopDateTime(); if(stop_date>currenttime && item!=current_recording){ //&& current_recording==NULL){ // the stop date is in the future and // it's not the current recording found_date=new_date; found_item=item; //printf("we found at present: %s %s\n",found_date.toString().latin1(),found_item->getDescription().latin1()); } else{ // no, it also ended in the past //make sure that items in the past can never be enabled item->setOn(false); } }//end else newdate>=currenttime }//end if item(ison) if(item!=current_recording && item->getStopDateTime()checkWhen(); table->sort(); } item=(TimerTableItem *)item->nextSibling(); } return found_item; } /* **************************************** */ // helper routine // gets called when user presses 'start timer' // or by automatic 'avicap -timer' void TimerTable::startTimer(bool set_shutdown){ if (set_shutdown) { //we have been started automatically AVMOUT(AVML_DEBUG, "Timertable started with -timer"); #if 0 int fd=open(WATCHDOG_TIMERTABLE,O_WRONLY|O_CREAT); if (fd==-1) { AVMOUT(AVM_WARNNO, "Can't create watchdog file"); } else{ char wbuf[100]; strcpy(wbuf,"ok\n"); write(fd,wbuf,strlen(wbuf)); } #endif shutdown_checkbox->setChecked(true); } if(table->childCount()>0){ TimerTableItem *first_item=find_first_recording(); if(first_item!=NULL){ next_recording=first_item; timer_mode=TimerWaiting; rec_start_button->setText("Stop Timer"); } } else{ printf("no programs, timer not started\n"); } } /* **************************************** */ void TimerTable::button_start_pressed(){ save(); if(timer_mode==TimerOff){ AVMOUT(AVML_DEBUG, "Started timer"); startTimer(false); } else if(timer_mode==TimerRecording){ AVMOUT(AVML_WARN, "Can't switch off timer while recording with timer"); } else if(timer_mode==TimerWaiting){ timer_mode=TimerOff; rec_start_button->setText(tr("Start Timer")); next_recording=NULL; AVMOUT(AVML_DEBUG, "Stopped timer"); } set_status_label(); } int find_keepfree(QString dirname){ int i=0; QString regname; QString fullname; regname=QString().sprintf("DirPool-%02d-Path",i); QString path=RS(regname,"NONE"); while(path!="NONE"){ regname=QString().sprintf("DirPool-%02d-Active",i); int act=RI(regname,1); if(act){ regname=QString().sprintf("DirPool-%02d-KeepFree",i); int keepfree=RI(regname,500); if(path==dirname){ return keepfree; } } i++; regname=QString().sprintf("DirPool-%02d-Path",i); path=RS(regname,"NONE"); } return 0; } QString find_best_dir(){ int i=0; QString regname; QString fullname; regname=QString().sprintf("DirPool-%02d-Path",i); QString path=RS(regname,"NONE"); long found_free_space=0; QString found_path; while(path!="NONE"){ regname=QString().sprintf("DirPool-%02d-Active",i); int act=RI(regname,1); regname=QString().sprintf("DirPool-%02d-KeepFree",i); int keepfree=RI(regname,500); //printf("path=%s active=%d keepfree=%d\n",path.latin1(),act,keepfree); if(act){ //evaluate int free_space=free_diskspace(path.latin1()); free_space-=keepfree; //printf("free space for avicap %dMB on %s\n",free_space,path.latin1()); if(free_space>found_free_space){ //printf("found free space for avicap %dMB on %s\n",free_space,path.latin1()); found_free_space=free_space; found_path=path; } }// end of 'if act' i++; regname=QString().sprintf("DirPool-%02d-Path",i); path=RS(regname,"NONE"); } if(found_free_space<=0){ return ""; } return found_path; } /* **************************************** */ // gets called every second // check if the state has changed and what we've got to do next void TimerTable::timer(){ static long timer_counter=0; if (timer_counter%60==0) AVMOUT(AVML_DEBUG, "Timer is alive"); timer_counter++; next_recording=find_first_recording(); if(next_recording){ // printf("next_recording: %s\n",next_recording->getDescription().latin1()); } if (next_recording && timer_mode==TimerWaiting) { // we have a pending recording and the timer is waiting for // pending recordings // now check if it's time to start this recording QDateTime start_time=next_recording->getStartTime(); QDateTime currenttime=QDateTime::currentDateTime(); int secs_to_go=currenttime.secsTo(start_time); int secs_in_poweroff=secs_to_go \ - RI("ShutdownRebootTimespan",5)*60 \ - RI("ShutdownGraceTime",3)*60; // if(secs_to_go<10){ if(start_timesetXawtv(next_recording->getChannel()); QString savename=next_recording->getNamedCodec(); if(savename=="-Default-"){ savename=""; } //what now? CaptureConfig *conf=new CaptureConfig(); conf->load(); conf->setNamedCodec(savename.latin1()); QString filename=next_recording->getFilename(); conf->setFilename(filename.latin1()); my_v4lw->captureAVI(conf); //make the new capture window AviCapDialog *dialog=my_v4lw->getCaptureDialog(); if(dialog!=NULL){ dialog->start(); // run the thing timer_mode=TimerRecording; current_recording=next_recording; } else{ AVMOUT(AVML_WARN, "Recording could not be started!"); } }// 10 secs to go else if(secs_in_poweroff > RI("ShutdownMinTimespan",20)*60){ // if the computer would be in off-state for the allowed time // we check if we should do a shutdown check_for_shutdown(); } } else if(timer_mode==TimerRecording && current_recording){ //we are currently recording //check if we have to switch off current recording // check if there is still a recording actually running // (user might have pressed stop or close) AviCapDialog *dialog=my_v4lw->getCaptureDialog(); CaptureProcess *capproc=NULL; if(dialog){ capproc=dialog->getCaptureProcess(); } if(dialog==NULL || capproc==NULL){ // no recording, so nothing to switch off // we disable the timertable item, so that the recording // won't start again, or stop unwanted recordings current_recording->setOn(false); } QDateTime stop_time=current_recording->getStopDateTime(); QDateTime currenttime=QDateTime::currentDateTime(); //int secs_to_go=currenttime.secsTo(stop_time); //printf("%d secs to go to stop recording\n",secs_to_go); if(dialog==NULL || capproc==NULL || currenttime > stop_time || \ (next_recording && next_recording!=current_recording && next_recording->getStartTime()repaint(); QListViewItem *item=table->firstChild(); while(item!=NULL){ table->repaintItem(item); item=item->nextSibling(); } if (last_current_recording!=current_recording) { emit currentRecordingChanged(current_recording); AVMOUT(AVML_DEBUG, "Current recording changed"); } if (last_next_recording!=next_recording) { emit nextRecordingChanged(next_recording); AVMOUT(AVML_DEBUG, "Next recording changed"); } last_current_recording=current_recording; last_next_recording=next_recording; } /* **************************************** */ void TimerTable::check_for_shutdown(){ int shutdown_mode=RI("ShutdownMode",0); if(shutdown_mode==0){ // never shut down return; } bool shutdown=shutdown_checkbox->isChecked(); if(shutdown){ if(!shutdown_message){ // open up a new message AVMOUT(AVML_DEBUG, "Shutdown procedure started"); shutdown_message=new QMessageBox( tr( "AviCap Shutdown warning" ), "System is going to shutdown\n\nin some seconds\n", QMessageBox::Critical,QMessageBox::Abort, QMessageBox::NoButton,QMessageBox::NoButton,this); shutdown_message->show(); shutdown_time=QDateTime::currentDateTime(); shutdown_time=shutdown_time.addSecs(RI("ShutdownGraceTime",3)*60); } else{ // there is already a shutdown message open QDateTime currenttime=QDateTime::currentDateTime(); int secsto=currenttime.secsTo(shutdown_time); AVMOUT(AVML_DEBUG, "Secs to shutdown: %d res=%d", secsto,shutdown_message->result()); if(shutdown_message->result()==5){ AVMOUT(AVML_DEBUG, "Shutdown aborted by user"); // the user has aborted shutdown delete shutdown_message; shutdown_message=NULL; shutdown_checkbox->setChecked(0); } else if (secsto>0) { // we still have grace time before shutdown char buf[300]; sprintf(buf,"System is going to shutdown\n\n in %d seconds\n",secsto); shutdown_message->setText(buf); shutdown_message->show(); } else { // it's time to do the shutdown AVMOUT(AVML_DEBUG, "shutdown T=0 secs"); save(); sleep(5); if(shutdown_mode==2){ // with nvram-wakeup long timestamp=0; if(next_recording){ QDateTime nextdate=next_recording->getStartTime(); //int timediff=calcTimeDiff(nextdate); // argl - you cant get a timestamp from a QDateTime // we have to calculate it ourselves QDateTime bigbang=QDateTime(); bigbang.setTime_t(0); timestamp=bigbang.secsTo(nextdate); // check if system is running localtime different from UTC QDateTime checktime=QDateTime(); checktime.setTime_t(timestamp); long timestamp2=bigbang.secsTo(checktime); // if timediff!=0, we're in localtime int timediff=timestamp-timestamp2; // I have no idea if this works on systems that their hw/rtc/system-clock with UTC AVMOUT(AVML_DEBUG, "timestamp=%ld timestamp2=%ld diffsecs=%d diffmin=%d nextdate=%s bigbang=%s checktime=%s", timestamp,timestamp2,timediff,timediff/60, nextdate.toString(my_dateformat).latin1(), bigbang.toString(my_dateformat).latin1(), checktime.toString(my_dateformat).latin1()); timestamp+=timediff; timestamp-=RI("ShutdownRebootTimespan",5)*60; QDateTime reboot_time=QDateTime(); reboot_time.setTime_t(timestamp); AVMOUT(AVML_DEBUG, "system will reboot at timestamp %ld (%s)", timestamp, reboot_time.toString(my_dateformat).latin1()); // printf( }//end of 'we have a next recording' // set nvram timer with nvram-wakeup // if no next recording, timestamp wil be 0 // and nvram-setup will disable RTC alarm wakeup AVMOUT(AVML_DEBUG, "Setting nvram"); char cbuf[300]; sprintf(cbuf,"sudo avicap-setnvram %ld",timestamp); system(cbuf); sleep(10); }// end of 'shutdown mode 2' // we do this in shutdown mode 1 and 2 // SHUTDOWN NOW system("sudo avicap-shutdown &"); //exit avicap exit(0); }// end of 'its time do shutdown now' }// end of 'we have shutdown message open' }// end of 'shutdown is checked' } /* **************************************** */ void TimerTable::stop_current_recording(){ // stop old recording AviCapDialog *dialog_old=my_v4lw->getCaptureDialog(); if(dialog_old!=NULL){ // there is a recording dialog open CaptureProcess *capproc=dialog_old->getCaptureProcess(); if(capproc!=NULL){ // there's a recording running AVMOUT(AVML_DEBUG, "Current recording has been stopped"); dialog_old->stop(); dialog_old->close(); } } // the dialog itself doesn't get closed //reset the codec // global_savename=RS("NamedCodecsCurrent","-Default-"); } /* **************************************** */ // helper routine to calc the stop DateTime from the given // start DateTime and stop Time QDateTime TimerTable::calc_stopDateTime(QDateTime start_datetime,QTime stop_time){ QTime start_time=start_datetime.time(); QDate start_date=start_datetime.date(); QDateTime stop_datetime(start_date,stop_time); if(start_time > stop_time ){ // the recording ends the next day stop_datetime=stop_datetime.addDays(1); } return stop_datetime; } /* **************************************** */ // loads settings from registry void TimerTable::load(){ int i=0; char buf[300]; // QDateTime currenttime= sprintf(buf,"TT-%02d-StartTime",i); avm::string starttimestr=RS(buf,"NONE"); while(starttimestr!="NONE"){ sprintf(buf,"TT-%02d-StopTime",i); avm::string stoptimestr=RS(buf,"NONE"); QDateTime starttime; QTime stoptime; //starttime=QDateTime::fromString(starttimestr.c_str()); //stoptime=QTime::fromString(stoptimestr.c_str()); starttime=dateTimeFromString(starttimestr.c_str()); stoptime=dateTimeFromString(stoptimestr.c_str()).time(); sprintf(buf,"TT-%02d-Channel",i); int channel=RI(buf,0); sprintf(buf,"TT-%02d-When",i); int when=RI(buf,0); sprintf(buf,"TT-%02d-WhenDay",i); int day=RI(buf,0); sprintf(buf,"TT-%02d-Filename",i); avm::string filename=RS(buf,"./movie.avi"); sprintf(buf,"TT-%02d-Description",i); avm::string desc=RS(buf,"untitled"); sprintf(buf,"TT-%02d-NamedCodec",i); avm::string codec=RS(buf,"-Default-"); TimerTableItem *item; item=new TimerTableItem(table,this,my_v4lw,channel,starttime,stoptime,QString(filename.c_str()),QString(desc.c_str()),when,day,QString(codec.c_str())); sprintf(buf,"TT-%02d-Active",i); int ison=RI(buf,1); item->setOn(ison); i++; sprintf(buf,"TT-%02d-StartTime",i); starttimestr=RS(buf,"NONE"); } } /* **************************************** */ // saves settings into registry void TimerTable::save(){ int i=0; char buf[200]; TimerTableItem *item=(TimerTableItem *)table->firstChild(); while(item!=NULL){ sprintf(buf,"TT-%02d-StartTime",i); //WS(buf,item->getStartTime().toString(my_dateformat).latin1()); //WS(buf,item->getStartTime().toString().latin1()); WS(buf,dateTimeToString(item->getStartTime())); sprintf(buf,"TT-%02d-StopTime",i); WS(buf,dateTimeToString(item->getStopDateTime())); sprintf(buf,"TT-%02d-Channel",i); WI(buf,item->getChannel()); sprintf(buf,"TT-%02d-When",i); WI(buf,item->getWhen()); sprintf(buf,"TT-%02d-WhenDay",i); WI(buf,item->getDay()); sprintf(buf,"TT-%02d-Filename",i); WS(buf,item->getFilename().latin1()); sprintf(buf,"TT-%02d-Description",i); WS(buf,item->getDescription().latin1()); sprintf(buf,"TT-%02d-NamedCodec",i); WS(buf,item->getNamedCodec().latin1()); sprintf(buf,"TT-%02d-Active",i); WI(buf,item->isOn()); item=(TimerTableItem *)item->nextSibling(); i++; } // make sure that's the last one... sprintf(buf,"TT-%02d-StartTime",i); WS(buf,"NONE"); // actually save to file avm::RegSave(); AVMOUT(AVML_DEBUG, "Registry saved to file"); } int free_diskspace(avm::string path){ int free_space=0; struct statfs statbuf; int res=statfs(path.c_str(),&statbuf); if(res==-1){ printf("cannot statfs: %s\n",path.c_str()); free_space=0; } else{ double long free_bytes=statbuf.f_bsize*statbuf.f_bavail; free_space=(int)(free_bytes/(1024*1024)); } return free_space; } QString dateTimeToString(QDateTime dt) { QString str; int year=dt.date().year(); int month=dt.date().month(); int day=dt.date().day(); str=QString().sprintf("%04d-%02d-%02d/",year,month,day)+dt.time().toString(); return str; } QDateTime dateTimeFromString(QString datestr) { // str has to be like this: 2003-04-06/18:14:11 QString yearstr=datestr.mid(0,4); QString monstr=datestr.mid(5,2); QString daystr=datestr.mid(8,2); QString hourstr=datestr.mid(11,2); QString minstr=datestr.mid(14,2); QString secstr=datestr.mid(17,2); QDateTime datetime; datetime.setDate(QDate(yearstr.toInt(),monstr.toInt(),daystr.toInt())); datetime.setTime(QTime(hourstr.toInt(),minstr.toInt(),secstr.toInt())); // printf("strings %s %s %s %s %s %s\n", // yearstr.latin1(),monstr.latin1(),daystr.latin1(), // hourstr.latin1(),minstr.latin1(),secstr.latin1()); //printf("parsed %s to %s\n",datestr.latin1(),datetime.toString().latin1()); return datetime; } #if QT_VERSION<300 ADateTimeEdit::ADateTimeEdit(QWidget *w,QString name) : QLineEdit(w) { datetime=QDateTime::currentDateTime(); } void ADateTimeEdit::updateFromWidget() { QString wstr=text(); datetime=dateTimeFromString(wstr); } QString ADateTimeEdit::toString(QDateTime dt) { return dateTimeToString(dt); } void ADateTimeEdit::setTime(QTime newtime) { datetime.setTime(newtime); setText(toString(datetime)); } void ADateTimeEdit::setDateTime(QDateTime newdatetime) { datetime=newdatetime; QString helper=toString(datetime); setText(helper); } #endif avifile-0.7.48~20090503.ds/samples/qtvidcap/timertable.h0000644000175000017500000001300410473335641021525 0ustar yavoryavor/* TimerTable window for AviCap written 2003 by Alexander Rawass (alexannika@users.sourceforge.net) */ #ifndef TIMERTABLE_H #define TIMERTABLE_H #include #include #include #include #include #include #include class v4lxif; class V4LWindow; class QPopupMenu; class QLabel; class QListView; class QComboBox; class QCheckBox; class QDateTimeEdit; class QTimeEdit; class QSplitter; class QGroupBox; class QPushButton; class QButtonGroup; class QLineEdit; class QListViewItem; class QFrame; class QMessageBox; class TimerTable; class EpgWindow; class EpgProgram; #define WATCHDOG_TIMERTABLE "/tmp/avicap-watchdog/timertable" QDateTime dateTimeFromString(QString datestr); QString dateTimeToString(QDateTime dt); #if QT_VERSION<300 class ADateTimeEdit : public QLineEdit { public: ADateTimeEdit(QWidget *w,QString name); void setDateTime(QDateTime datetime); void setTime(QTime time); void updateFromWidget(); QDateTime dateTime() { updateFromWidget(); printf("datetime: %s\n",datetime.toString().latin1()); return datetime; }; QTime time() { updateFromWidget(); return datetime.time(); }; QString toString(QDateTime dt); private: QDateTime datetime; #define QDateTimeEdit ADateTimeEdit #define ATimeEdit ADateTimeEdit #define QTimeEdit ATimeEdit }; #endif #if QT_VERSION>=300 static QString my_timeformat="hh:mm:ss"; static QString my_dateformat=("dd MMM yyyy "+my_timeformat+" ddd"); #else #define my_timeformat #define my_dateformat #endif enum TimerMode { TimerOff,TimerWaiting,TimerRecording }; //#define my_tabletype QListView //#define my_tableitemtype QListViewItem class TimerTableItem: public QCheckListItem, public avm::AvmOutputLog { public: TimerTableItem(QListView *parent,TimerTable *timer_win,V4LWindow *v4lw,int ch,QDateTime start,QTime stop,QString fname,QString description,int when,int day,QString codec); //TimerTableItem(QWidget *parent); ~TimerTableItem(); void setTable(int ch,QDateTime start,QTime stop,QString fname,QString description,int when,int day,QString codec); void checkWhen(); int compare(QListViewItem *other,int col, bool ascend) const; void paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align ); private: QDateTime start_time; QTime stop_time; QDateTime stop_datetime; int channel_nr; QString filename; QString description; int when,day; QString named_codec; TimerTable *timer_window; V4LWindow *my_v4lwin; public: QDateTime getStartTime() const { return start_time; }; QTime getStopTime() const { return stop_time; }; QDateTime getStopDateTime() const { return stop_datetime; }; QString getFilename() const { return filename; }; int getWhen() const { return when; }; int getDay() const { return day; }; int getChannel() const { return channel_nr; }; QString getNamedCodec() const { return named_codec; }; QString getDescription() const { return description; }; }; class TimerTable: public QDialog, public avm::AvmOutputLog { Q_OBJECT; public: TimerTable( QWidget* parent, v4lxif* v4l, V4LWindow* w); ~TimerTable(); void save(); void load(); void startTimer(bool set_shutdown); QDateTime calc_stopDateTime(QDateTime start_datetime,QTime stop_time); void setEpgWindow(EpgWindow *win); TimerTableItem *firstTableItem() { return (TimerTableItem *)table->firstChild(); }; public slots: void addEpgRecording(EpgProgram *prog); void button_new_pressed(); void button_remove_pressed(); void button_modify_pressed(); void button_start_pressed(); void item_clicked(QListViewItem *item); void timer(); signals: void nextRecordingChanged(TimerTableItem *next_recording); void currentRecordingChanged(TimerTableItem *current_recording); void timertableChanged(); protected: private: void recreateCodecBox(QString set_name); void init_entry_widgets(); void set_status_label(); TimerTableItem* find_first_recording(); TimerTableItem* set_tableitem(TimerTableItem *item); void stop_current_recording(); QString add_current_time_info(); QString add_current_recording_info(); QString add_next_recording_info(); QString add_sanity_check_info(); void check_for_shutdown(); QString find_filename(QString filename); TimerMode timer_mode; v4lxif *my_v4lxif; V4LWindow *my_v4lw; EpgWindow *epgwin; QSplitter *splitter1; //QGroupBox *edit_box; QWidget *edit_box; QGroupBox *all_box; QListView *table; QComboBox *channelbox; QComboBox *codecbox; QDateTimeEdit *begin_timeedit; QTimeEdit *end_timeedit; QLineEdit *filename_edit; QLineEdit *description_edit; QButtonGroup *edit_buttons; QPushButton *new_button; QPushButton *modify_button; QPushButton *remove_button; QButtonGroup *rec_buttons; QPushButton *rec_start_button; QPushButton *rec_stop_button; QCheckBox *shutdown_checkbox; QFrame *status_frame; QLabel *status_label; QComboBox *when_combobox; QComboBox *day_combobox; QMessageBox *shutdown_message; QDateTime shutdown_time; TimerTableItem *next_recording,*last_next_recording; TimerTableItem *current_recording,*last_current_recording; TimerTableItem *last_item_clicked; QTimer *my_timer; public: TimerTableItem *getCurrentRecording() { return current_recording; }; TimerTableItem *getNextRecording() { return next_recording; }; }; #endif avifile-0.7.48~20090503.ds/samples/qtvidcap/v4lwindow.cpp0000644000175000017500000012433110642775752021704 0ustar yavoryavor #include "v4lwindow.h" #include "v4lwindow.moc" #include "avicapwnd.h" #include "ccap.h" #include "epgwindow.h" #include "frequencies.h" #include "picprop.h" #include "timertable.h" #include "vidconf.h" #include #include "v4lxif.h" #include #include #include #include #include #include #include #include #define DECLARE_REGISTRY_SHORTCUT #include #undef DECLARE_REGISTRY_SHORTCUT //#ifdef QT_VERSION #include "fullscreen_renderer.h" #include //#include #include #include #include #include #include #include #include #include #include #include //#endif #include "qtrenderer.h" #ifndef WIN32 #include #endif #include #include #include #include #include // auto_ptr static int rgb_method=0; static inline void default_dimensions(int& w, int& h) { if (RI("ColorMode", 0) == 1) { w = 320; h = 240; } else { w = 384; h = 288; } } V4LWindow::V4LWindow(v4lxif* pDev, QWidget* pParent) : QWidget(pParent, 0, 0), avm::AvmOutputLog("V4LWindow"), m_pDev(pDev), m_pRenderer(0), visibility(VisibilityFullyObscured), oc_count(0), m_eMode(Overlay), m_iPainter(0), m_pPicConfig(0), m_pTimerTable(0),m_pEpgWindow(0), m_pCapDialog(0), m_pCC(0), m_pPopup(0), m_pLabel(0), m_bForce4x3(true), m_bSubtitles(false), known_pos(false), m_bAutoRecord(false), m_bMoved(false), mc_switch(10), mc_tiles(3) { AVMOUT(AVML_DEBUG, "opened"); assert(m_pDev); m_pDev->setCapture(0); AVMOUT(AVML_DEBUG, "after setcapture"); fs_renderer=NULL; m_eMode = (Modes)RI("DisplayMode", 0); setMode(m_eMode); int norm = RI("ColorMode", 0); if (((norm==1) || (norm==3)) && m_pDev->hasvbi())//NTSC or AUTO m_bSubtitles = RI("Subtitles", 0); else m_bSubtitles = false; setupSubtitles(); AVMOUT(AVML_DEBUG, "after setupSubtitles"); int w, h; default_dimensions(w, h); connect(&m_timer, SIGNAL(timeout()), this, SLOT(timerStop())); connect(&m_cctimer, SIGNAL(timeout()), this, SLOT(updatesub())); //connect(&m_RatioTimer, SIGNAL(timeout()), this, SLOT(ratioTimerStop())); m_RatioTimer.start(200, FALSE); setBackgroundColor(QColor(0,0,0)); AVMOUT(AVML_DEBUG, "before setupDevice()"); setupDevice(); AVMOUT(AVML_DEBUG, "after setupDevice()"); scanXawtv(); resize(w, h); last_station=-1; QString capstr=tr("Avicap - unknown channel"); setCaption(capstr); if (fs_renderer) fs_renderer->setCaption(capstr.latin1()); int plock=RI("Password-Locked",0); lock(plock); AVMOUT(AVML_DEBUG, "end of constructor"); } V4LWindow::~V4LWindow() { AVMOUT(AVML_DEBUG, "Exiting"); refresh_timer(); if (m_eMode==AvicapRend || m_eMode==MultiChannel) m_eMode=Overlay; avicap_renderer_stop(); multichannel_stop(); WI("DisplayMode", m_eMode); WI("Subtitles", m_bSubtitles); delete m_pEpgWindow; delete m_pTimerTable; delete m_pDev; delete m_pPicConfig; #if 0 UserLog("exiting V4lwindow\n"); if(user_logfh){ fclose(user_logfh); } } void V4LWindow::UserLog(QString str){ if(!RI("LogToFile",0)){ return; } if(!user_logfh){ struct passwd* pwent = getpwuid(getuid()); QString homedir = pwent->pw_dir; QString filename=homedir+"/.avm/avicap-userlog.log"; user_logfh=fopen(filename.latin1(),"a+"); fputs("\n=============Logging started==============\n",user_logfh); } #if QT_VERSION>=300 fputs(QDateTime::currentDateTime().toString("yy/MM/dd hh:mm:ss ").latin1(),user_logfh); #else fputs(QDateTime::currentDateTime().toString().latin1(),user_logfh); #endif fputs(str.latin1(),user_logfh); fflush(user_logfh); } void V4LWindow::pLog(avm::string str){ #ifdef AVICAP_PARANOIA ParanoiaLog(str); #endif #endif AVMOUT(AVML_DEBUG, "Exiting"); } void V4LWindow::postResizeEvent(int w, int h) { QEvent* e = new QResizeEvent(QSize(w, h), size()); qApp->postEvent(this, e); } // Xawtv DGA refresh trick // makes complete screen refresh by mapping unmapping fullscreen window void V4LWindow::refresh_timer() { #if 0 static long refresh_counter=0; if (refresh_counter%(25*60)==0) avml(AVML_DEBUG1, "V4lwindow: refresh timer\n"); refresh_counter++; #endif Display* dpy = x11Display(); Window win = DefaultRootWindow(dpy); Screen* scr = DefaultScreenOfDisplay(dpy); int swidth = scr->width; int sheight = scr->height; XSetWindowAttributes xswa; unsigned long mask; Window tmp; xswa.override_redirect = True; xswa.backing_store = NotUseful; xswa.save_under = False; mask = (CWSaveUnder | CWBackingStore| CWOverrideRedirect ); tmp = XCreateWindow(dpy, win, 0,0, swidth, sheight, 0, CopyFromParent, InputOutput, CopyFromParent, mask, &xswa); XMapWindow(dpy, tmp); XUnmapWindow(dpy, tmp); XDestroyWindow(dpy, tmp); } void V4LWindow::hidePopup() { if (m_pPopup) m_pPopup->hide(); // m_pDev->setCapture(1); get_clips(); } void V4LWindow::timerStop() { if(m_eMode==Overlay) { //printf("SETCAPTURE\n"); if (m_bMoved) { m_bMoved = false; refresh_timer(); get_clips(); } m_pDev->setCapture(1); } } void V4LWindow::setMode(Modes m) { AVMOUT(AVML_DEBUG, "Changed display mode to %d", m); if ((m == DeinterlacedPreview) && !freq.HaveMMXEXT()) m = Preview; switch(m) { case Overlay: overlay(); break; case Preview: preview(); break; case DeinterlacedPreview: deinterlaced_preview(); break; case AvicapRend: avicap_renderer(); break; case MultiChannel: multichannel(); break; } } void V4LWindow::moveEvent( QMoveEvent * e) { if (m_eMode != Overlay || !isVisible()) return; m_pDev->setCapture(0); int norm = RI("ColorMode", 0); // QPoint pnt=mapToGlobal(QPoint(0,0)); // int field_width, field_height; // default_dimensions(field_width, field_height); // m_pDev->setCapAClip(pnt.x()+(384-field_width)/2, pnt.y()+(288-field_height)/2, // field_width, field_height); // m_pDev->setCapAClip(pnt.x(), pnt.y(), width(), height()); setupPicDimensions(); m_pDev->applyCapAClip(0); m_bMoved = true; if(m_timer.isActive()) m_timer.stop(); m_timer.start(200, TRUE); // if(!known_pos) // m_pDev->setCapture(1); known_pos=true; if(m_bAutoRecord) { captureAVI(); m_bAutoRecord=false; } } void V4LWindow::setXawtv(int st) { AVMOUT(AVML_DEBUG, "setXawtv %d:%s", st, xawtvstations[st].input.c_str()); if (st < 0 || st >= getStations()) return; #if 0 if (m_pCapDialog) { m_pCapDialog->stop(); delete m_pCapDialog; m_pCapDialog = 0; } #endif if (m_eMode == AvicapRend) m_CaptureTimer.stop(); // delete fs_renderer; //fs_renderer=NULL; #if 0 // old style channel-change delete m_pDev; delete m_pPicConfig; m_pPicConfig = 0; avm::string s = avm::string("v4lctl setstation \""); s += xawtvstations[st].sname.c_str(); s += "\""; system(s.c_str()); #else //new channel change avm::string channelstr=xawtvstations[st].channel; int cl=0; while(!( chanlists[cl].name==NULL || chanlists[cl].name==freqtable )){ cl++; } if(chanlists[cl].name==NULL){ printf("not found\n"); } else{ //printf("found channellist %d\n",cl); const struct CHANLIST *myclist=chanlists[cl].list; int myccount=chanlists[cl].count; int scount=0; while(!(scount>=myccount || myclist[scount].name==channelstr )){ scount++; } if(scount>=myccount){ printf("channel %s not found\n",channelstr.c_str()); } else{ m_pDev->setAudioMute(true); //m_pDev->setAudioVolume(0); int freq=myclist[scount].freq; //printf("channel %s freq %d\n",channelstr.c_str(),freq); //m_pDev->setCapture(0); //sleep(1); unsigned long lfreq=(unsigned long) freq*16/1000; lfreq+=xawtvstations[st].finetune; m_pDev->setFreq(lfreq); //sleep(1); //m_pDev->setCapture(1); } } #endif try { //m_pDev = new v4l1if(0, RS("CapDev", "/dev/video")); m_pDev->setChannelName(xawtvstations[st].input.c_str()); get_clips(); if(m_eMode!=MultiChannel){ //m_pDev->setAudioVolume(st*5); m_pDev->setAudioMute(false); } last_station=st; QString locked; if (RI("Password-Locked",0)) locked=tr(" locked"); QString capstr = tr( "Avicap: " ) + QString::number(st+1)+" - "+QString(xawtvstations[st].sname.c_str()) + locked; setCaption( capstr ); if (fs_renderer) fs_renderer->setCaption( capstr.latin1() ); AVMOUT(AVML_DEBUG, "Channel change -> %d", st); } catch (FatalError& e) { e.PrintAll(); m_pDev = 0; } if (m_eMode == AvicapRend){ // avicap_renderer(); m_CaptureTimer.start(40); } } static avm::string get_keyword(const char* s) { const char* e = strchr(s, '='); if (e) { e++; while (*e && isspace(*e)) e++; s = e; while (*e && !isspace(*e)) e++; } else e = s; return avm::string(s, e - s); } /* * * * Simple parser of Xawtv configure file * */ void V4LWindow::scanXawtv() { AVMOUT(AVML_DEBUG, "reading Xawtv file\n"); struct passwd* pwent = getpwuid(getuid()); avm::string xawtvcnf = pwent->pw_dir; xawtvcnf += "/.xawtv"; FILE* fl = fopen(xawtvcnf.c_str(), "rb"); int x = 0; xawtvstations.clear(); if (fl != NULL) { xawtvstation xawdefaults; xawtvstation xs; while (!feof(fl)) { char b[500]; fgets(b, sizeof(b) - 1, fl); b[sizeof(b) - 1] = 0; char* s = strchr(b, '#'); if (s) *s = 0; if ((s = strchr(b, '['))) { s++; char* e = strchr(s, ']'); avm::string sname = avm::string(s, e - s); if (strcasecmp(sname.c_str(), "global") == 0 || strcasecmp(sname.c_str(), "launch") == 0) continue; //printf("stname %s\n", sname.c_str()); xs.sname = sname; if (strcasecmp(sname.c_str(), "defaults") == 0) { xawdefaults = xs; continue; } if (!getStations()) // assumption - default comes in the begining xawdefaults = xs; xawtvstations.push_back(xs); xs = xawdefaults; } else if ((s = strstr(b, "key"))) { avm::string k = get_keyword(s); if (k.size()) { xs.key = toupper(k[0]); if (getStations()) xawtvstations.back().key = xs.key; } } else if ((s = strstr(b, "input"))) { xs.input = get_keyword(s); if (xs.input.size()) { if (getStations()) xawtvstations.back().input = xs.input; } } else if ((s = strstr(b, "freqtab"))) { freqtable = get_keyword(s); printf("freqtab is %s\n", freqtable.c_str()); } else if ((s = strstr(b, "channel"))) { avm::string channelstr = get_keyword(s); if (channelstr.size()) { int ss = getStations(); xawtvstations[ss-1].channel = channelstr; //printf("channel %s for %s\n", channelstr.c_str(), xawtvstations[ss-1].sname.c_str()); } } else if ((s = strstr(b, "fine"))) { avm::string finestr = get_keyword(s); if (finestr.size()) { int ss = getStations(); xawtvstations[ss-1].finetune = atoi(finestr.c_str());; printf("finetune %d for %s\n", xawtvstations[ss-1].finetune, xawtvstations[ss-1].sname.c_str()); } } } } } bool V4LWindow::event(QEvent* e) { // printf("EVENT %d\n", e->type()); switch (e->type()) { case Q_MyCloseEvent: emit overlay(); break; default: return QWidget::event(e); // parent call } return true; } void V4LWindow::sendQt(QEvent* e) { qApp->postEvent(this, e); // event deleted by Qt #if QT_VERSION > 220 // qApp->wakeUpGuiThread(); #endif } void V4LWindow::makePopup() { // avm::Locker lock(m_Mutex); if (m_pPopup && m_pPopup->isVisible()) { m_pPopup->hide(); return; } delete m_pPopup; m_pPopup = new QPopupMenu; int norm = RI("ColorMode", 0); m_pPopup->insertItem(tr("Configure"), this, SLOT(config())); if (getStations()) { QPopupMenu* p = new QPopupMenu(); connect(p, SIGNAL(activated(int)), this, SLOT(changeChannel(int))); char cbuf[100]; for (unsigned i = 0; i < xawtvstations.size(); i++){ sprintf(cbuf,"%-2d %s",i+1,xawtvstations[i].sname.c_str()); p->insertItem(cbuf, i); } m_pPopup->insertItem(tr("Xawtv stations"), p); } m_pPopup->insertItem(tr("Picture properties"), this, SLOT(picprop())); m_pPopup->insertItem(tr("Timertable"), this, SLOT(timertable())); m_pPopup->insertItem(tr("Electronic Program Guide"), this, SLOT(epgwindow())); m_pPopup->insertItem(tr("Capture AVI"), this, SLOT(captureAVI())); m_pPopup->insertItem(tr("Capture BMP"), this, SLOT(captureBMP())); // m_pPopup->insertItem("Capture JPG", this, SLOT(captureJPG())); m_pPopup->insertSeparator(); int iItem=m_pPopup->insertItem(tr("Force 4x3 ratio"), this, SLOT(force4x3())); m_pPopup->setCheckable(true); m_pPopup->setItemChecked(iItem, m_bForce4x3); if(((norm==1) || (norm==3)) && m_pDev->hasvbi())//NTSC or AUTO { iItem=m_pPopup->insertItem(tr("Show subtitles"), this, SLOT(showsub())); m_pPopup->setCheckable(true); m_pPopup->setItemChecked(iItem, m_bSubtitles); } else m_bSubtitles=false; // m_pPopup->setChecked(m_bForce4x3); m_pPopup->insertSeparator(); int iModeItems[5]; iModeItems[0]=m_pPopup->insertItem(tr("&Overlay"), this, SLOT(overlay())); m_pPopup->setCheckable(true); m_pPopup->setItemChecked(iModeItems[0], false); iModeItems[1]=m_pPopup->insertItem(tr("&Preview"), this, SLOT(preview())); m_pPopup->setCheckable(true); m_pPopup->setItemChecked(iModeItems[1], false); if(freq.HaveMMXEXT()) { iModeItems[2]=m_pPopup->insertItem(tr("Deinterlace"), this, SLOT(deinterlaced_preview())); m_pPopup->setCheckable(true); m_pPopup->setItemChecked(iModeItems[2], false); } else iModeItems[2]=-1; iModeItems[3]=m_pPopup->insertItem(tr("exp. SDL/FS renderer"), this, SLOT(avicap_renderer())); m_pPopup->setCheckable(true); m_pPopup->setItemChecked(iModeItems[3], false); iModeItems[4]=m_pPopup->insertItem(tr("MultiChannel"), this, SLOT(multichannel())); m_pPopup->setCheckable(true); m_pPopup->setItemChecked(iModeItems[3], false); switch(getMode()) { case Overlay: m_pPopup->setItemChecked(iModeItems[0], true); break; case Preview: m_pPopup->setItemChecked(iModeItems[1], true); break; case DeinterlacedPreview: // if(iModeItems[2]>=0) m_pPopup->setItemChecked(iModeItems[2], true); break; case AvicapRend: m_pPopup->setItemChecked(iModeItems[3], true); break; case MultiChannel: m_pPopup->setItemChecked(iModeItems[4], true); break; } #if 0 m_pPopup->insertSeparator(); m_pPopup->insertItem(tr("Fullscreen"), this, SLOT(fullscreen())); //#ifdef HAVE_LIBXXF86VM m_pPopup->insertItem("Maximize", this, SLOT(maximize())); //#endif //#endif #endif m_pPopup->insertSeparator(); m_pPopup->insertItem(tr("&Quit"), this, SLOT(close())); #if 0 Window root_return, child_return; int root_x_return, root_y_return; int win_x_return, win_y_return; unsigned int mask_return; XQueryPointer(x11Display(), handle(), &root_return, &child_return, &root_x_return, &root_y_return, &win_x_return, &win_y_return, &mask_return); #endif QPoint cpos=QCursor::pos(); //popup(QPoint(root_x_return, root_y_return)); m_pPopup->exec(cpos); } void V4LWindow::avicap_renderer_stop() { m_avicapTimer.stop(); delete fs_renderer; fs_renderer=NULL; } void V4LWindow::avicap_renderer_close() { QEvent *me=new QEvent(Q_MyCloseEvent); sendQt(me); } void V4LWindow::avicap_renderer_popup() { QMouseEvent *me=new QMouseEvent(QEvent::MouseButtonRelease,QCursor::pos(),Qt::RightButton,Qt::RightButton); sendQt(me); // makePopup(); } void V4LWindow::mouseReleaseEvent( QMouseEvent * e) { if (!(e->button() & Qt::RightButton)) return; makePopup(); } void V4LWindow::config() { AVMOUT(AVML_DEBUG, "configure"); //m_pPopup=0; m_pDev->setCapture(0); if (m_timer.isActive()) m_timer.stop(); m_timer.start(100, TRUE); VidConfig conf(this, m_pDev, this); //QPoint pnt = mapToGlobal(QPoint(0,0)); //conf.move(pnt.x() + width() / 2, pnt.y() + height() / 4); conf.move(QCursor::pos()); conf.exec(); setupPicDimensions(); setupDevice(); } void V4LWindow::lock(bool lock){ //locked or not? if (lock) { AVMOUT(AVML_DEBUG, "locking system"); //we have to lock system //make shure the epg info is available epgwindow(); m_pEpgWindow->lock(true); changeChannel(last_station); } else { //unlock AVMOUT(AVML_DEBUG, "unlock system"); if (m_pEpgWindow) m_pEpgWindow->lock(false); //changeChannel(last_station); } } void V4LWindow::force4x3() { hidePopup(); m_bForce4x3 = !m_bForce4x3; if (m_bForce4x3) postResizeEvent(width(), height()); } void V4LWindow::getOverlaySizeAndOffset(int *pw, int *ph, int* pdx, int* pdy) { int dxpos, dypos; int max_w, max_h; *pw=width(); *ph=height(); if(m_bSubtitles) *ph-=80; if(*ph<=0) { printf("Oops: ph<0\n"); return; } default_dimensions(max_w, max_h); max_w*=2; max_h*=2; dxpos=dypos=0; if(*pw>max_w) { dxpos=(*pw-max_w)/2; *pw=max_w; } if(*ph>max_h) { dypos=(*ph-max_h)/2; *ph=max_h; } if(pdx)*pdx=dxpos; if(pdy)*pdy=dypos; } static int get_palette(Display * dpy) { int r; switch (avm::GetPhysicalDepth(dpy)) { case 15: r = VIDEO_PALETTE_RGB555; break; case 16: r = VIDEO_PALETTE_RGB565; break; case 24: r = VIDEO_PALETTE_RGB24; break; case 32: default: r = VIDEO_PALETTE_RGB32; break; } return r; } void V4LWindow::setupPicDimensions(int* pdx, int* pdy) { AVMOUT(AVML_DEBUG, "setting pic dimensions"); avm::Locker lock(m_Mutex); int dxpos, dypos, pw, ph; QPoint pnt = mapToGlobal(QPoint(0,0)); getOverlaySizeAndOffset(&pw, &ph, &dxpos, &dypos); if(m_eMode == Overlay) m_pDev->setCapAClip(pnt.x()+dxpos, pnt.y()+dypos, pw, ph); else if(m_eMode==AvicapRend){ } else { if (m_pRenderer && (pw != m_pRenderer->getWidth() || (ph!=m_pRenderer->getHeight()))) { delete m_pRenderer; m_pRenderer=0; } if (!m_pRenderer) { m_pRenderer = new ShmRenderer(this, pw, ph, dxpos, dypos); } else m_pRenderer->move(dxpos, dypos); m_pDev->grabSetParams(pw, ph, get_palette(x11Display())); } if(pdx)*pdx=dxpos; if(pdy)*pdy=dypos; } void V4LWindow::resizeEvent( QResizeEvent * e) { QWidget::resizeEvent(e); int w=e->size().width(); int h=e->size().height(); if(m_eMode==MultiChannel){ mc_curw=w; mc_curh=h; multichannel(); return; } // printf("received resize event to %d,%d\n", w, h); // printf("resizeEvent: %d,%d -> %d,%d ( %d,%d )\n", // e->oldSize().width(), e->oldSize().height(), // e->size().width(), e->size().height(), // width(), height()); // if(!isVisible()) // { // printf("!visible\n"); // return; // } // if(!known_pos) // { // printf("!known\n"); // return; // } // if(m_bForce4x3 && w!=4*(h-(m_bSubtitles?80:0))/3) // { // printf("Recalc %d,%d\n", 4*(h-(m_bSubtitles?80:0))/3, h); // postResizeEvent(4*(h-(m_bSubtitles?80:0))/3, h); // resize(4*(h-(m_bSubtitles?80:0))/3, h); // return; // } if (m_pLabel) { m_pLabel->move(0, h-80); m_pLabel->resize(w, 80); } m_pDev->setCapture(0); setupPicDimensions(); m_pDev->applyCapAClip(0); // m_pDev->setCapture(1); if (m_timer.isActive()) m_timer.stop(); if(m_eMode==AvicapRend){ avicap_renderer_resize_input(w,h); } m_timer.start(100, TRUE); } void V4LWindow::showEvent( QShowEvent * ) { if(m_eMode!=Overlay) return; if(!known_pos) return; // avm_usleep(100000); // QPoint pnt=mapToGlobal(QPoint(0,0)); // m_pDev->setCapAClip(pnt.x(), pnt.y(), width(), height()); setupPicDimensions(); m_pDev->applyCapAClip(0); m_pDev->setCapture(1); get_clips(); //printf("showEvent()\n"); } void V4LWindow::hideEvent( QHideEvent * qhe ) { //printf("hideEvent()\n"); m_pDev->setCapture(0); } void V4LWindow::focusInEvent( QFocusEvent * ) { //if(!known_pos)return; //printf("focusInEvent()\n"); get_clips(); } void V4LWindow::focusOutEvent( QFocusEvent * ) { //printf("focusOutEvent()\n"); get_clips(); } void V4LWindow::paintEvent( QPaintEvent * qpe ) { //printf("paintEvent() %d %p %d\n", m_bMoved, m_pRenderer, m_iPainter); if (--m_iPainter < 0) { m_bMoved = true; m_pDev->setCapture(0); if (m_timer.isActive()) m_timer.stop(); m_timer.start(100, TRUE); m_iPainter = 1; } } void V4LWindow::captureAVI() { AVMOUT(AVML_INFO, "captureAVI (manual)"); captureAVI(NULL); } void V4LWindow::captureAVI(CaptureConfig *capconf) { AVMOUT(AVML_INFO, "captureAVI (timertable)"); if (m_pCapDialog) return; m_pCapDialog = new AviCapDialog(this,capconf); // QPoint pnt=mapToGlobal(QPoint(0,0)); // m_pCapDialog->move(pnt.x(), pnt.y()+height()+40); m_pDev->setCapture(0); if(m_timer.isActive()) m_timer.stop(); m_timer.start(100, TRUE); m_pCapDialog->show(); if(m_bAutoRecord) m_pCapDialog->start(); // m_pDev->setCapture(0); // QMessageBox::information(this, "Sorry", "Not implemented yet!"); // m_pDev->setCapture(1); } void V4LWindow::captureBMP() { // int w=width(); // int h=height(); Modes eMode = m_eMode; overlay(); unsigned int w, h; int x, y; m_pDev->getCapAClip(&x, &y, &w, &h); w &= ~3; m_pDev->grabSetParams(w, h, VIDEO_PALETTE_RGB24); unsigned char* cp = (unsigned char*)m_pDev->grabCapture(true); std::auto_ptr im(new avm::CImage(cp, w, -h)); m_pDev->setCapture(0); if (m_timer.isActive()) m_timer.stop(); m_timer.start(100, TRUE); QString qs=QFileDialog::getSaveFileName(QString::null, "*.bmp", this, "Save as BMP file"); if (!qs.isNull()) im->Dump(qs); setMode(eMode); } void V4LWindow::captureJPG() { // m_pDev->setCapture(0); QMessageBox::information(0, tr( "Sorry" ), tr( "Not implemented yet!" )); // m_pDev->setCapture(1); } void V4LWindow::changeChannel(int ch) { if (ch == -1) ch = 0; if (m_pEpgWindow==NULL || !m_pEpgWindow->isBlocked(ch+1)) setXawtv(ch); else AVMOUT(AVML_DEBUG, "Channel %d blocked", ch); } void V4LWindow::avicap_renderer_keypress(int sym,int mod) { //printf("sym=%d mod=%d\n",sym,mod); int key=0; if(sym==273){ key=Qt::Key_Up; } else if(sym==274){ key=Qt::Key_Down; } //printf("a1\n"); keyPress(sym,key); //printf("a2\n"); } void V4LWindow::keyPress(int k,int key) { //avm::Locker lock(m_Mutex); switch(k) { case 'B': captureBMP(); break; case 'C': config(); break; case 'Q': close(); break; case ']': multichannel_increase_tiles(true); break; case '[': multichannel_increase_tiles(false); break; case '+': multichannel_increase_speed(true); break; case '-': multichannel_increase_speed(false); break; } bool xawtv_key=false; for (unsigned i = 0; i < xawtvstations.size(); i++) { //printf("key %d %d\n", xawtvstations[i].key, k); if (xawtvstations[i].key == k){ if(m_pEpgWindow==NULL || !m_pEpgWindow->isBlocked(i+1)){ setXawtv(i); } xawtv_key=true; } } //alternate keybindings if(!xawtv_key){ if(k>='1' && k<='9'){ int chnr=k-48; if(m_pEpgWindow==NULL || !m_pEpgWindow->isBlocked(chnr)){ setXawtv(chnr-1); } } } if(key==Qt::Key_Down){ int station=last_station; do{ station--; if(station<0){ station=xawtvstations.size()-1; } }while(station!=last_station && (m_pEpgWindow && m_pEpgWindow->isBlocked(station+1))); setXawtv(station); } else if(key==Qt::Key_Up){ int station=last_station; do{ station++; if(station>(int)xawtvstations.size()-1){ station=0; } }while(station!=last_station && (m_pEpgWindow && m_pEpgWindow->isBlocked(station+1))); setXawtv(station); } } void V4LWindow::keyPressEvent( QKeyEvent * e ) { int k = toupper(e->ascii()); int key=e->key(); keyPress(k,key); } void V4LWindow::setupDevice() { // int field_width, field_height; // default_dimensions(field_width, field_height); // v4l->setCapAClip(102,110,field_width,field_height); // v4l->addCapAClip(0,248,384,288); // v4l->applyCapAClip(0); AVMOUT(AVML_DEBUG, "setupDevice()"); // I'm not sure why - but apply has to call this // method twice to get apllied Norm & Channel change // at the same time - if anyone knows how to fix this // let us know - avifile@prak.org FIXME int i = 2; while (i--) { m_pDev->setChannelNorm(RI("ColorMode", 0)); m_pDev->setChannel(RI("Channel", 1)); } AVMOUT(AVML_DEBUG, "setupDevice() - channel is set"); m_pDev->setAudioMute(0); m_pDev->setAudioVolume(65535);//? m_pDev->setAudioBalance(100); int amode; switch (RI("SndChannels", 0)) { default: case 0: amode = VIDEO_SOUND_MONO; break; case 1: amode = VIDEO_SOUND_STEREO; break; case 2: amode = VIDEO_SOUND_LANG1; break; case 3: amode = VIDEO_SOUND_LANG2; break; } m_pDev->setAudioMode(amode); m_pDev->setPicBrightness(RI("Image\\Brightness", 0)); m_pDev->setPicConstrast(RI("Image\\Contrast", 255)); m_pDev->setPicColor(RI("Image\\Color", 255)); m_pDev->setPicHue(RI("Image\\Hue", 0)); int r = RI("Resolution", 0); AVMOUT(AVML_DEBUG, "setupDevice() starting capture"); if (m_eMode == Overlay) m_pDev->setCapture(1); get_clips(); AVMOUT(AVML_DEBUG, "setupDevice() done"); } void V4LWindow::showsub() { hidePopup(); m_bSubtitles=!m_bSubtitles; AVMOUT(AVML_DEBUG, "showsub() size %dx%d, set m_bSubtitles to %d", width(), height(), (int)m_bSubtitles); setupSubtitles(); } void V4LWindow::setupSubtitles() { if(m_bSubtitles) { m_pCC=new ClosedCaption(m_pDev); m_pLabel=new QLabel(this); int w=width(); int h=height(); // if(!m_bForce4x3) resize(w, h+80); m_pLabel->move(0, h); m_pLabel->resize(w, 80); m_pLabel->setAlignment(Qt::AlignCenter); m_pLabel->show(); m_cctimer.start(500); } else { m_cctimer.stop(); delete m_pCC; delete m_pLabel; m_pCC=0; m_pLabel=0; resize(width(), height() - 80); } } void V4LWindow::startTimer() { timertable(); m_pTimerTable->startTimer(true); } void V4LWindow::timertable() { if (!m_pTimerTable) { AVMOUT(AVML_DEBUG, "Timertable started"); m_pTimerTable=new TimerTable(this,m_pDev,this); QPoint pnt=mapToGlobal(QPoint(0,0)); m_pTimerTable->move(pnt.x(), pnt.y()+height()+20); } if (m_pTimerTable->isVisible()) m_pTimerTable->hide(); else m_pTimerTable->show(); } void V4LWindow::epgwindow() { if (!m_pEpgWindow) { AVMOUT(AVML_DEBUG, "EPGWindow started"); timertable(); m_pEpgWindow=new EpgWindow(this,m_pTimerTable); QPoint pnt=mapToGlobal(QPoint(0,0)); m_pEpgWindow->move(pnt.x(), pnt.y()+height()+20); m_pTimerTable->setEpgWindow(m_pEpgWindow); } if (m_pEpgWindow->isVisible()) m_pEpgWindow->hide(); else m_pEpgWindow->show(); } void V4LWindow::picprop() { AVMOUT(AVML_DEBUG, "picprop()"); if (!m_pPicConfig) { m_pPicConfig = new PicturePropDialog(m_pDev); QPoint pnt = mapToGlobal(QPoint(0,0)); m_pPicConfig->move(pnt.x(), pnt.y()+height()+20); } if (m_pPicConfig->isVisible()) m_pPicConfig->hide(); else m_pPicConfig->show(); } static int x11_error = 0; typedef int (*handlerproc) (Display*, XErrorEvent*); static int x11_error_dev_null(Display * dpy, XErrorEvent * event) { x11_error++; // if (debug > 1) // fprintf(stderr," x11-error\n"); return 0; } void V4LWindow::add_clip(int x1, int y1, int x2, int y2) { if (oc_count >= (int) (sizeof(oc)/sizeof(oc[0]))) return; if (oc[oc_count].x1 != x1 || oc[oc_count].y1 != y1 || oc[oc_count].x2 != x2 || oc[oc_count].y2 != y2) { conf = 1; } oc[oc_count].x1 = x1; oc[oc_count].y1 = y1; oc[oc_count].x2 = x2; oc[oc_count].y2 = y2; oc_count++; } bool V4LWindow::x11Event( XEvent * e) { #if 0 switch(e->type) { case VisibilityNotify: printf("VisibilityNotify\n"); if (e->xvisibility.window == handle()) { visibility = e->xvisibility.state; // get_clips(); } break; case MapNotify: printf("MapNotify\n"); wmap=1; break; case UnmapNotify: printf("UnmapNotify\n"); wmap=0; break; case KeyPress: case KeyRelease: case ButtonPress: case ButtonRelease: case MotionNotify: case EnterNotify: case LeaveNotify: case FocusIn: case FocusOut: case KeymapNotify: case Expose: case GraphicsExpose: case NoExpose: case CreateNotify: case DestroyNotify: case MapRequest: case ReparentNotify: case ConfigureNotify: case ConfigureRequest: case GravityNotify: case ResizeRequest: case CirculateNotify: case CirculateRequest: case PropertyNotify: case SelectionClear: case SelectionRequest: case SelectionNotify: case ColormapNotify: case ClientMessage: case MappingNotify: // printf("Event %d\n", e->type); break; } get_clips(); #endif return QWidget::x11Event(e); } void V4LWindow::get_clips() { if (m_eMode != Overlay || !isVisible()) return; //printf("GETCLIPS\n"); int x1,y1,x2,y2,lastcount; XWindowAttributes wts; Window root, me, rroot, parent, *children; uint nchildren, i; int wx, wy; conf=0; QPoint pnt=mapToGlobal(QPoint(0,0)); wx=pnt.x(); wy=pnt.y(); Display * dpy=x11Display(); root=DefaultRootWindow(dpy); me = (Window)handle(); m_pDev->setCapture(0); XSelectInput(dpy, me, ~0); XSelectInput(dpy, root, VisibilityChangeMask | ExposureMask); /* XGetWindowAttributes(dpy, me, &wts); wts.your_event_mask=~0; */ // XSetWindowAttributes xsw; // xsw.event_mask=~0; // XChangeWindowAttributes(dpy, me, CWEventMask, &xsw); // GC gc=qt_xget_readonly_gc(false); // XSetGraphicsExposures( dpy, gc, TRUE ); // XGCValues xcg; // xcg.graphics_exposures=true; // gc=XDefaultGC(dpy, me, GCGraphicsExposures, &xcg); /* if (wmap && visibility != VisibilityFullyObscured && visibility != VisibilityPartiallyObscured) { oc_count = 0; return; } */ handlerproc old_handler = XSetErrorHandler(x11_error_dev_null); // if (debug > 1) // fprintf(stderr," getclips"); lastcount = oc_count; oc_count = 0; if (wx<0) add_clip(0, 0, (uint)(-wx), height()); if (wy<0) add_clip(0, 0, width(), (uint)(-wy)); // if ((wx+width()) > swidth) // add_clip(swidth-wx, 0, width(), height()); // if ((wy+height()) > sheight) // add_clip(0, sheight-wy, width(), height()); // find parent for (;;) { XQueryTree(dpy, me, &rroot, &parent, &children, &nchildren); if (children) XFree((char *) children); /* fprintf(stderr,"me=0x%x, parent=0x%x\n",me,parent); */ if (root == parent || me == parent) break; me = parent; } // now find all clippping parts XQueryTree(dpy, root, &rroot, &parent, &children, &nchildren); // printf("%d children to check\n", nchildren); for (i = 0; i < nchildren && children[i] != me; i++) ;/* empty */ for (i++; i (int)width()) || (y2 < 0) || (y1 > (int)height())) { // printf("child %d, (%d,%d)x(%d,%d): not overlapping\n", // i, wts.x, wts.y, wts.width, wts.height); continue; } if (x1<0) x1=0; if (y1<0) y1=0; if (x2>(int)width()) x2=width(); if (y2>(int)height()) y2=height(); add_clip(x1, y1, x2, y2); } XFree((char *) children); if (lastcount != oc_count) conf=1; if(conf) { m_pDev->resetCapAClip(); int dx, dy; setupPicDimensions(&dx, &dy); for(int i=0; iaddCapAClip(-dx+oc[i].x1, -dy+oc[i].y1, -dx+oc[i].x2, -dy+oc[i].y2); } // printf("Applying %d clips\n", oc_count); m_pDev->applyCapAClip(oc_count); m_pDev->setCapture(1); // if(m_timer.isActive()) // m_timer.stop(); // m_timer.start(100, TRUE); } else m_pDev->setCapture(1); XSetErrorHandler(old_handler); } void V4LWindow::updatesub() { // printf("updatesub()\n"); if(!m_pCC) return; m_pCC->lock(); char buf[256]; strncpy(buf, m_pCC->getBuffer(), sizeof(buf) - 1); m_pCC->unlock(); // printf("%s\n", buf); assert(m_pLabel); assert(m_bSubtitles); m_pLabel->setText(buf); } void V4LWindow::overlay() { show(); avm::Locker lock(m_Mutex); printf("overlay()\n"); m_eMode=Overlay; m_pDev->setCapture(1); //stop shm renderer m_CaptureTimer.stop(); delete m_pRenderer; m_pRenderer=0; avicap_renderer_stop(); multichannel_stop(); } void V4LWindow::preview() { int pw, ph, dx, dy; show(); avm::Locker lock(m_Mutex); printf("preview()\n"); getOverlaySizeAndOffset(&pw, &ph, &dx, &dy); m_eMode=Preview; avicap_renderer_stop(); multichannel_stop(); m_pDev->setCapture(0); m_pDev->grabSetParams(pw, ph, get_palette(x11Display())); connect(&m_CaptureTimer, SIGNAL(timeout()), this, SLOT(preview_display())); m_CaptureTimer.start(30); m_eMode=Preview; m_pDev->setCapture(0); delete m_pRenderer; printf("new shm renderer %d %d\n",pw,ph); m_pRenderer=new ShmRenderer(this, pw, ph, dx, dy); connect(&m_CaptureTimer, SIGNAL(timeout()), this, SLOT(preview_display())); m_CaptureTimer.start(40); } void V4LWindow::deinterlaced_preview() { if(!freq.HaveMMXEXT()) return preview(); printf("deint_preview()\n"); show(); avm::Locker lock(m_Mutex); int pw, ph, dx, dy; getOverlaySizeAndOffset(&pw, &ph, &dx, &dy); avicap_renderer_stop(); multichannel_stop(); m_eMode=DeinterlacedPreview; m_pDev->setCapture(0); m_pDev->grabSetParams(pw, ph, get_palette(x11Display())); delete m_pRenderer; m_pRenderer = new ShmRenderer(this, pw, ph, dx, dy); connect(&m_CaptureTimer, SIGNAL(timeout()), this, SLOT(preview_display())); m_CaptureTimer.start(30); } void V4LWindow::avicap_renderer() { int pw, ph, dx, dy; avm::Locker lock(m_Mutex); printf("avicap-renderer()\n"); m_eMode=AvicapRend; //stop shm renderer m_CaptureTimer.stop(); delete m_pRenderer; m_pRenderer=0; multichannel_stop(); getOverlaySizeAndOffset(&pw, &ph, &dx, &dy); fsr_width=pw; fsr_height=ph; printf("New avicap- renderer %d %d\n",pw,ph); delete fs_renderer; fs_renderer = 0; void *dpy = XOpenDisplay(0); fs_renderer = new avm::AvicapRenderer(dpy); fs_renderer->setV4LWindow(this); fs_renderer->setSize(pw,ph); fs_renderer->setYUVrendering(true); m_pDev->setCapture(0); //m_pDev->grabSetParams(pw, ph, get_palette(x11Display())); Colorspaces colorspace=(enum Colorspaces)RI("Colorspace", 0); colorspace=cspYUY2; Colorspaces recording_colorspace=colorspace; if (colorspace==cspRGB24 && rgb_method==0){ printf("rgb24 renderer - rgb24 to rgb24\n"); m_pDev->grabSetParams(pw, ph, VIDEO_PALETTE_RGB24); fs_renderer->setYUVrendering(false); } else if(colorspace==cspRGB24 && rgb_method==1){ printf("rgb24 renderer - grab rgb24 to yuv overlay,automatic conv.\n"); m_pDev->grabSetParams(pw, ph, VIDEO_PALETTE_RGB24); // recording_colorspace=cspYUY2; } else if(colorspace==cspRGB24 && rgb_method==2){ printf("rgb24 renderer - grab rgb24 to yuv overlay, I do conv.\n"); m_pDev->grabSetParams(pw, ph, VIDEO_PALETTE_RGB24); recording_colorspace=cspYUY2; } else if(colorspace==cspYV12){ printf("yv12 renderer\n"); m_pDev->grabSetParams(pw, ph, VIDEO_PALETTE_YUV420P); } else if(colorspace==cspYUY2){ printf("yuy2 renderer\n"); m_pDev->grabSetParams(pw, ph, VIDEO_PALETTE_YUV422); } else{ printf("error - not this mode\n"); return; } //connect(&m_CaptureTimer, SIGNAL(timeout()), this, SLOT(avicap_renderer_display())); //m_CaptureTimer.start(30); m_eMode=AvicapRend; // m_pDev->setCapture(0); fs_renderer->setRecordingColorSpace(recording_colorspace); fs_renderer->createVideoRenderer(); printf("after fsrend\n"); connect(&m_avicapTimer, SIGNAL(timeout()), this, SLOT(avicap_renderer_display())); m_avicapTimer.start(40); hide(); } void V4LWindow::multichannel_increase_speed(bool inc) { if(inc) mc_switch/=2; else mc_switch*=2; if(mc_switch<1) mc_switch=1; multichannel(); } void V4LWindow::multichannel_increase_tiles(bool inc) { if(inc) mc_tiles++; else mc_tiles--; if(mc_tiles<1) mc_tiles=1; multichannel(); } void V4LWindow::multichannel_stop() { m_multichannelTimer.stop(); } void V4LWindow::multichannel() { int pw, ph, dx, dy; avm::Locker lock(m_Mutex); printf("multichannel()\n"); if(m_eMode!=MultiChannel){ m_eMode=MultiChannel; //stop shm renderer m_CaptureTimer.stop(); delete m_pRenderer; m_pRenderer=0; avicap_renderer_stop(); getOverlaySizeAndOffset(&pw, &ph, &dx, &dy); mc_oldw=pw; mc_oldh=ph; mc_curw=pw; mc_curh=ph; if(last_station<0){ changeChannel(0); } mc_startchannel=last_station; mc_curchannel=0; mc_count=0; } mc_grabw=mc_curw/mc_tiles; mc_grabh=mc_curh/mc_tiles; printf("tiles=%d speed=%d\n",mc_tiles,mc_switch); m_pDev->setCapture(0); m_pDev->grabSetParams(mc_grabw, mc_grabh, get_palette(x11Display())); m_eMode=MultiChannel; connect(&m_multichannelTimer, SIGNAL(timeout()), this, SLOT(multichannel_display())); m_multichannelTimer.start(40); } void V4LWindow::maximize() { } void V4LWindow::fullscreen() { } void V4LWindow::avicap_renderer_resize_input(int w,int h) { int pw, ph, dx, dy; getOverlaySizeAndOffset(&pw, &ph, &dx, &dy); printf("avicap-renderer resize input w=%d h=%d pw=%d ph=%d()\n",w,h,pw,ph); avicap_renderer(); } void V4LWindow::avicap_renderer_display() { avm::Locker lock(m_Mutex); // printf("avicap_renderer_display()\n"); const char* z=m_pDev->grabCapture(false); int pw, ph, dx, dy; //getOverlaySizeAndOffset(&pw, &ph, &dx, &dy); pw=fsr_width; ph=fsr_height; // printf("pw=%d ph=%d\n",pw,ph); avm::CImage *im; //Colorspaces colorspace=(enum Colorspaces)RI("Colorspace", 0); Colorspaces colorspace=cspYUY2; BitmapInfo bi; if(colorspace==cspRGB24 && rgb_method==0){ im=new avm::CImage((const uint8_t *)z,pw,ph); } else if(colorspace==cspRGB24 && rgb_method==1){ //convert rgb24 to yuv automatic im=new avm::CImage((const uint8_t *)z,pw,ph); } else if(colorspace==cspRGB24 && rgb_method==2){ //convert rgb24 to yuv, do-it-yourself const avm::CImage *im0=new avm::CImage((const uint8_t *)z,pw,ph); bi=BitmapInfo(pw,ph,fccYUY2); im=new avm::CImage(im0,&bi); } else if(colorspace==cspYV12){ // printf("yuv renderer\n"); bi=BitmapInfo(pw,ph,fccYV12); im=new avm::CImage(&bi,(const uint8_t *)z,false); } else if(colorspace==cspYUY2){ // printf("yuv renderer\n"); bi=BitmapInfo(pw,ph,fccYUY2); im=new avm::CImage(&bi,(const uint8_t *)z,false); } else{ printf("error - not this mode\n"); return; } fs_renderer->drawFrame(im); } void V4LWindow::preview_display() { avm::Locker lock(m_Mutex); // printf("preview_display()\n"); const char* z=m_pDev->grabCapture(false); QPainter qp(this); m_pRenderer->draw(&qp, z, (m_eMode==DeinterlacedPreview)); #if 0 //little bit of osd if(last_station>=0 && last_stationsync(); /* int pw, ph, dx, dy; getOverlaySizeAndOffset(&pw, &ph, &dx, &dy); int bpl=pw*4; QImage* i=new QImage(pw, ph, 32); for(int y=0; yscanLine(y); memcpy(line, z+bpl*y, bpl); } QPainter p(this); p.drawImage(dx, dy, *i); delete i; */ } void V4LWindow::multichannel_display() { avm::Locker lock(m_Mutex); // printf("preview_display()\n"); char* z=m_pDev->grabCapture(false); QPainter qp(this); int pw, ph, dx, dy; getOverlaySizeAndOffset(&pw, &ph, &dx, &dy); Display *dpy = x11Display(); //Visual *vis = (Visual*)dev->x11Visual(); int bit_depth = avm::GetPhysicalDepth(dpy); const QImage pix=QImage((uchar *)z,mc_grabw,mc_grabh,bit_depth,NULL,0,QImage::IgnoreEndian); int max_channels=mc_tiles*mc_tiles; int ys=mc_curchannel/mc_tiles; int xs=mc_curchannel%mc_tiles; int xo=xs*mc_grabw; int yo=ys*mc_grabh; qp.drawImage(xo,yo,pix); mc_count++; if(mc_count>mc_switch){ mc_count=0; mc_curchannel++; if(mc_curchannel>=max_channels){ mc_curchannel=0; } // printf("multichannel: %d\n",mc_startchannel+mc_curchannel); changeChannel(mc_startchannel+mc_curchannel); m_pDev->setAudioMute(true); //m_pDev->setAudioVolume(0); } } void V4LWindow::ratioTimerStop() { if(!m_bForce4x3) return; int w = width(); int h = height()-(m_bSubtitles ? 80 : 0); if(w != 4*h/3) { printf("ratio time: subtitles %d, resizing %d,%d -> %d,%d\n", (int)m_bSubtitles, w, h, 4*h/3, h); resize(4*h/3, h + (m_bSubtitles ? 80 : 0)); } // if(m_bForce4x3 && w!=4*(h-(m_bSubtitles?80:0))/3) // { // printf("Recalc %d,%d\n", 4*(h-(m_bSubtitles?80:0))/3, h); // postResizeEvent(4*(h-(m_bSubtitles?80:0))/3, h); // resize(4*(h-(m_bSubtitles?80:0))/3, h); // return; // } } avifile-0.7.48~20090503.ds/samples/qtvidcap/v4lwindow.h0000644000175000017500000001045710473335641021343 0ustar yavoryavor#ifndef V4LWINDOW_H #define V4LWINDOW_H #include #include #include #include #include AVM_BEGIN_NAMESPACE; class AvicapRenderer; AVM_END_NAMESPACE; class v4lxif; class AviCapDialog; class ClosedCaption; class PicturePropDialog; class ShmRenderer; class TimerTable; class EpgWindow; struct CaptureConfig; class QPopupMenu; class QLabel; #define Q_MyCloseEvent QEvent::Type(QEvent::User+2) class V4LWindow: public QWidget, public avm::AvmOutputLog { Q_OBJECT; friend class AviCapDialog; public: enum Modes { Overlay, Preview, DeinterlacedPreview,AvicapRend,MultiChannel }; V4LWindow(v4lxif* pDev, QWidget* pParent=0); ~V4LWindow(); void setupDevice(); void setAutoRecord() { m_bAutoRecord = true; } void unregisterCapDialog() { m_pCapDialog = 0; } void scanXawtv(); void get_clips(); ClosedCaption* getcc() { return m_pCC; } Modes getMode() const { return m_eMode; } void setMode(Modes m); AviCapDialog *getCaptureDialog() { return m_pCapDialog; } void captureAVI(CaptureConfig *capconf); void startTimer(); void lock(bool lock); void avicap_renderer_popup(); void avicap_renderer_close(); void avicap_renderer_stop(); void avicap_renderer_keypress(int sym,int mod); void makePopup(); void keyPress(int k,int key); virtual bool event(QEvent* e); void multichannel_increase_tiles(bool inc); void multichannel_increase_speed(bool inc); public slots: void captureAVI(); void captureBMP(); void captureJPG(); void config(); void deinterlaced_preview(); void force4x3(); void hidePopup(); void overlay(); void picprop(); void timertable(); void epgwindow(); void fullscreen(); void maximize(); void avicap_renderer(); void avicap_renderer_display(); void multichannel(); void multichannel_display(); void multichannel_stop(); void preview(); void preview_display(); void setXawtv(int); void changeChannel(int); void showsub(); void timerStop(); void updatesub(); void ratioTimerStop(); protected: // x11 stuff for handling overlay clipping void postResizeEvent(int w, int h); void sendQt(QEvent *e); void setupSubtitles(); void setupPicDimensions(int* =0, int* =0); void getOverlaySizeAndOffset(int *pw, int *ph, int* pdx=0, int* pdy=0); void avicap_renderer_resize_input(int w,int h); virtual bool x11Event( XEvent * ); virtual void focusInEvent( QFocusEvent * ); virtual void focusOutEvent( QFocusEvent * ); virtual void hideEvent( QHideEvent * ); virtual void keyPressEvent( QKeyEvent * ); virtual void mouseReleaseEvent( QMouseEvent * ); virtual void moveEvent( QMoveEvent * ); virtual void paintEvent( QPaintEvent * ); virtual void resizeEvent( QResizeEvent * ); virtual void showEvent( QShowEvent * ); void add_clip(int x1, int y1, int x2, int y2); void refresh_timer(); v4lxif* m_pDev; ShmRenderer* m_pRenderer; int wmap; int visibility; int conf; int oc_count; struct OVERLAY_CLIP { int x1, y1, x2, y2; } oc[64]; Modes m_eMode; private: int m_iPainter; avm::PthreadMutex m_Mutex; PicturePropDialog* m_pPicConfig; TimerTable *m_pTimerTable; EpgWindow *m_pEpgWindow; AviCapDialog* m_pCapDialog; ClosedCaption* m_pCC; QPopupMenu* m_pPopup; QLabel* m_pLabel; QTimer m_timer; QTimer m_cctimer; QTimer m_CaptureTimer; QTimer m_avicapTimer; QTimer m_multichannelTimer; QTimer m_RatioTimer; struct xawtvstation { avm::string sname; avm::string input; avm::string channel; int finetune; int key; }; avm::string freqtable; avm::vector xawtvstations; bool m_bForce4x3; bool m_bSubtitles; bool known_pos; bool m_bAutoRecord; bool m_bMoved; int last_station; //avicap/sdl/yuv/fs-renderer avm::AvicapRenderer *fs_renderer; int fsr_width,fsr_height; //multichannel int mc_oldw,mc_oldh,mc_curw,mc_curh,mc_grabw,mc_grabh; int mc_startchannel,mc_curchannel,mc_count; int mc_switch,mc_tiles; public: avm::string getXawtvStation(int i) { return xawtvstations[i].sname; } int getStations() { return xawtvstations.size(); } }; #endif // V4LWINDOW_H avifile-0.7.48~20090503.ds/samples/qtvidcap/v4lxif.cpp0000644000175000017500000010113110746464441021147 0ustar yavoryavor/* video4linux interface wrapper for kwintv Copyright (C) 1998,1999 Moritz Wenk (wenk@mathematik.uni-kl.de) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* $Id: v4lxif.cpp,v 1.37 2008/01/25 22:56:33 kabi Exp $ */ #include "v4lxif.h" #include #include #include #include #include #include #include #include #include //#include #include #include #include #ifndef BTTV_VERSION #define BTTV_VERSION _IOR('v', BASE_VIDIOCPRIVATE+6, int) #endif #include #ifndef X_DISPLAY_MISSING #include #include #include "qt_visual.h" #ifdef HAVE_LIBXXF86DGA #include #include #include // Support deprecated XFree86 symbol names #ifndef XDGA_MINOR_VERSION #define XDGA_MINOR_VERSION XF86DGA_MINOR_VERSION #endif #ifndef XDGA_MAJOR_VERSION #define XDGA_MAJOR_VERSION XF86DGA_MAJOR_VERSION #endif #endif /* HAVE_LIBXXF86DGA */ #endif /* X_DISPLAY_MISSING */ /* PAL NTSC SECAM */ static const int maxwidth[] = { 768, 640, 768 }; static const int maxheight[] = { 576, 480, 576 }; static const int one = 1; static const int zero = 0; static const struct STRTAB norms[] = { { 0, "PAL" }, { 1, "NTSC" }, { 2, "SECAM" }, { 3, "AUTO" }, { -1, NULL } }; static const struct STRTAB ifname[] = { { 0, "no interface" }, { 1, "Video4Linux" }, { 2, "Video4Linux 2" }, { -1, NULL }, }; static const struct STRSTRTAB { int nr; const char* str; const char* description; } device_cap[] = { { VID_TYPE_CAPTURE, "capture","Can capture to memory" }, { VID_TYPE_TUNER, "tuner","Has a tuner of some form" }, { VID_TYPE_TELETEXT, "teletext","Has teletext capability" }, { VID_TYPE_OVERLAY, "overlay", "Can overlay its image onto the frame buffer" }, { VID_TYPE_CHROMAKEY, "chromakey", "Overlay is Chromakeyed" }, { VID_TYPE_CLIPPING, "clipping", "Overlay clipping is supported" }, { VID_TYPE_FRAMERAM, "frameram","Overlay overwrites frame buffer memory" }, { VID_TYPE_SCALES, "scales", "The hardware supports image scaling" }, { VID_TYPE_MONOCHROME, "monochrome", "Image capture is grey scale only" }, { VID_TYPE_SUBCAPTURE, "subcapture", "Capture can be of only part of the image" }, { -1, NULL, NULL } }; static const char* unknown = "???"; static const char* audiodescr[] = { "autodetection", "mono", "stereo", unknown, "language 1", unknown, unknown, unknown, "language 2" }; static const char *device_pal[] = { "-", "grey", "hi240", "rgb16", "rgb24", "rgb32", "rgb15", "yuv422", "yuyv", "uyvy", "yuv420", "yuv411", "raw", "yuv422p", "yuv411p", NULL }; //#define v4lDEBUG #define VIF_FATAL(a) avml(AVML_WARN, a) #define VIF_WARN(a) avml(AVML_WARN, a) static const unsigned short format2palette[] = { 0, /* unused */ VIDEO_PALETTE_HI240, /* RGB8 */ VIDEO_PALETTE_GREY, /* GRAY8 */ #if __BYTE_ORDER == __BIG_ENDIAN 0, 0, VIDEO_PALETTE_RGB555, /* RGB15_BE */ VIDEO_PALETTE_RGB565, /* RGB16_BE */ 0, 0, VIDEO_PALETTE_RGB24, /* RGB24 */ VIDEO_PALETTE_RGB32, /* RGB32 */ #else // little endian (intel) VIDEO_PALETTE_RGB555, /* RGB15_LE */ VIDEO_PALETTE_RGB565, /* RGB16_LE */ 0, 0, VIDEO_PALETTE_RGB24, /* BGR24 */ VIDEO_PALETTE_RGB32, /* BGR32 */ 0, 0, #endif }; #define VIDEO_RGB08 1 /* bt848 dithered */ #define VIDEO_GRAY 2 #define VIDEO_RGB15_LE 3 /* 15 bpp little endian */ #define VIDEO_RGB16_LE 4 /* 16 bpp little endian */ #define VIDEO_RGB15_BE 5 /* 15 bpp big endian */ #define VIDEO_RGB16_BE 6 /* 16 bpp big endian */ #define VIDEO_BGR24 7 /* bgrbgrbgrbgr (LE) */ #define VIDEO_BGR32 8 /* bgr-bgr-bgr- (LE) */ #define VIDEO_RGB24 9 /* rgbrgbrgbrgb (BE)*/ #define VIDEO_RGB32 10 /* -rgb-rgb-rgb (BE)*/ #define VIDEO_LUT2 11 /* lookup-table 2 byte depth */ #define VIDEO_LUT4 12 /* lookup-table 4 byte depth */ #define VIDEO_YUYV 13 /* YUV 4:2:2 */ #define VIDEO_YUV420 14 /* YUV 4:2:0 */ static const unsigned int format2depth[] = { 0, /* unused */ 8, /* RGB8 */ 8, /* GRAY8 */ 16, /* RGB15 LE */ 16, /* RGB16 LE */ 16, /* RGB15 BE */ 16, /* RGB16 BE */ 24, /* BGR24 */ 32, /* BGR32 */ 24, /* RGB24 */ 32, /* RGB32 */ 16, /* LUT2 */ 32, /* LUT4 */ 16, /* YUV422 */ 12, /* YUV420 */ }; static const char* format_desc[] = { "", "8 bit PseudoColor (dithering)", "8 bit StaticGray", "15 bit TrueColor (LE)", "16 bit TrueColor (LE)", "15 bit TrueColor (BE)", "16 bit TrueColor (BE)", "24 bit TrueColor (LE: bgr)", "32 bit TrueColor (LE: bgr-)", "24 bit TrueColor (BE: rgb)", "32 bit TrueColor (BE: -rgb)", "16 bit TrueColor (lut)", "32 bit TrueColor (lut)", "16 bit YUV 4:2:2", "12 bit YUV 4:2:0", "12 bit YUV 4:1:1" }; //#define v4lDEBUG static bool vbishown = false; int avm_debug_level = 0; //============================================================================== v4lxif::v4lxif(const char* _device, const char* _vbidev, v4lxif_version _ifv) : AvmOutputLog("v4lxif"), ifv(_ifv), m_sDevice(_device), m_sDeviceVBI(_vbidev) { // validate the name of device const char* p = _device; while (*p) { if (((*p>0) && (*p<32)) || (*p<0)) { AVMOUT(AVML_WARN, "Invalid video device filename %s suspected", _device); AVMOUT(AVML_WARN, "Setting to default value ( /dev/video )"); m_sDevice = "/dev/video"; break; } p++; } AVMOUT(AVML_DEBUG, "Using interface: %s", ifname[ifv].str); } v4lxif::~v4lxif() { AVMOUT(AVML_DEBUG, "Close device"); if (::close(m_iDevV4L) == -1) AVMOUT(AVML_WARNNO, "Error closing the v4lx device %s", m_sDevice); } int v4lxif::init() { AVMOUT(AVML_DEBUG, "Open video4linux device %s", m_sDevice); m_iDevV4L = ::open(m_sDevice, O_RDWR); if (m_iDevV4L < 0) { AVMOUT((AVML_ERROR | AVML_STRERROR), "Opening device %s", m_sDevice); return -1; } int tmp; int driver = ioctl(m_iDevV4L, BTTV_VERSION, &tmp); if (driver >= 0) { AVMOUT(AVML_INFO, "BTTV driver version %d.%d.%d detected", driver>>16, (driver & 0xff00) >>8, driver & 0xff); } else AVMOUT((AVML_WARN | AVML_STRERROR), "Querying BTTV driver version: %d", driver); if ((driver<0) || ((driver>>16)>0) || (((driver&0xff00)>>8)>=8)) /** Versions of bttv before 0.8.x behave strangely when program opens /dev/video and /dev/vbi simultaneously. We assume that non-bttv video4windows devices do it correctly ( does it work at all with non-bttv hardware? ) **/ { m_iDevVBI = ::open(m_sDeviceVBI, O_RDONLY); if (m_iDevVBI < 0) { AVMOUT(AVML_WARNNO, "Failed to open %s device", m_sDeviceVBI); AVMOUT(AVML_WARN, "Closed captioning won't be available"); } } else { m_iDevVBI = -1; if (!vbishown) AVMOUT(AVML_INFO, "Broken VBI implementation; disabling closed captioning"); vbishown = true; } AVMOUT(AVML_DEBUG, "end constructor"); return 0; } int v4lxif::readvbi(void* buf, unsigned int cnt) { if (m_iDevVBI < 0) return -1; Locker locker(m_Mutex); int r = ::read(m_iDevVBI, buf, cnt); return r; } //============================================================================== v4l1baseif::v4l1baseif( int fd ) { m_iDevV4L=fd; } v4l1baseif::v4l1baseif(const char* mem, const char * _device, int _bpp, int _palette ) : v4lxif(_device, "/dev/vbi", v4lxif::v4l1), vchan(0), vaudio(0), grabbermem(0), m_iBpp(_bpp), m_iPalette(_palette), _state(1) { setOutputMode("v4l1baseif"); } v4l1baseif::~v4l1baseif() { AVMOUT(AVML_DEBUG, "destructor"); // mute all if(vaudio) { for (int i = 0; i < vcap.audios; i++) if (vaudio[i].flags & VIDEO_AUDIO_MUTABLE) { vaudio[i].flags |= VIDEO_AUDIO_MUTE; if (ioctl(m_iDevV4L, VIDIOCSAUDIO, &vaudio[i]) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_S_AUDIO"); } smute= true; } #if 1 if (ggrab > gsync) { if (ioctl(m_iDevV4L,VIDIOCSYNC,0) == -1) AVMOUT(AVML_WARNNO, "VIDIOCSYNC"); else gsync++; } #endif // capture off if (ioctl(m_iDevV4L, VIDIOCCAPTURE, &zero) == -1) AVMOUT(AVML_WARNNO, "VIDIOCCAPTURE"); if (grabbermem) munmap(grabbermem,msize); if (vchan) free(vchan); if (vaudio) free(vaudio); } int v4l1baseif::init() { if (v4lxif::init() < 0) return -1; setupok = true; // capture off if (ioctl(m_iDevV4L, VIDIOCCAPTURE, &zero) == -1) { if (errno != EINVAL && errno !=EBUSY) { AVMOUT(AVML_ERRORNO, "VIDIOCCAPTURE"); return -1; } } AVMOUT(AVML_DEBUG, "Before capabilities"); // get capabilities if (ioctl(m_iDevV4L, VIDIOCGCAP, &vcap) == -1) { AVMOUT(AVML_ERRORNO, "VIDIOC_G_CAP"); return -1; } // get input sources (channels) if (vcap.channels) vchan = (struct video_channel*)calloc(vcap.channels, sizeof(struct video_channel)); // get audios if (vcap.audios) vaudio = (struct video_audio*)calloc(vcap.audios, sizeof(struct video_audio)); AVMOUT(AVML_DEBUG, "Grabber name: %s", vcap.name); for (unsigned i = 0; device_cap[i].str != NULL; i++) if (vcap.type & (1 << i)) AVMOUT(AVML_DEBUG, "\t %s: %s", device_cap[i].str, device_cap[i].description); AVMOUT(AVML_DEBUG, "Range of tv size : %dx%d => %dx%d", vcap.minwidth, vcap.minheight, vcap.maxwidth, vcap.maxheight); AVMOUT(AVML_DEBUG, "Input channels: %d", vcap.channels); // get information about each channel for (int i = 0; i < vcap.channels; i++) { vchan[i].channel = i; if (ioctl(m_iDevV4L,VIDIOCGCHAN,&vchan[i]) == -1) { AVMOUT(AVML_ERRORNO, "VIDIOC_G_CHAN"); return -1; } } achan= 0; for (int i = 0; i < vcap.channels; i++) { AVMOUT(AVML_DEBUG, "\t [%d] %s: %s [%d], %s%s%s%s", i + 1, vchan[i].name, (vchan[i].flags & VIDEO_VC_TUNER) ? "has tuner" : "no tuner", vchan[i].tuners, (vchan[i].flags & VIDEO_VC_AUDIO) ? "audio, " : "", "",//(vchan[i].flags & VIDEO_VC_NORM) ? "norm, " : "", (vchan[i].type & VIDEO_TYPE_TV) ? "tv" : "", (vchan[i].type & VIDEO_TYPE_CAMERA) ? "camera" : ""); } AVMOUT(AVML_DEBUG, "Set input source"); // set v4l to the first available input source, also set first norm vchan[0].norm= 0; if (ioctl(m_iDevV4L, VIDIOCSCHAN, &vchan[0]) == -1) { AVMOUT(AVML_WARNNO, "You need a newer bttv version (>= 0.5.14)!"); //return -1; } // get information for each audio for (int i = 0; i < vcap.audios; i++) { vaudio[i].audio = i; if (ioctl(m_iDevV4L, VIDIOCGAUDIO, &vaudio[i]) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_G_AUDIO"); } aaudio= 0; // mute them all for (int i = 0; i < vcap.audios; i++) if (vaudio[i].flags & VIDEO_AUDIO_MUTABLE) { vaudio[i].flags |= VIDEO_AUDIO_MUTE; if (ioctl(m_iDevV4L,VIDIOCSAUDIO,&vaudio[i]) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_S_AUDIO"); } smute = true; AVMOUT(AVML_DEBUG, "Input audios: %d",vcap.audios); for (int i = 0; i < vcap.audios; i++) { AVMOUT(AVML_DEBUG, "\t [%d] %s: %s%s vol=%d, bass=%d, ter=%d",i+1,vaudio[i].name, (vaudio[i].flags & VIDEO_AUDIO_MUTABLE)?"mutable":"not mutable", (vaudio[i].flags & VIDEO_AUDIO_MUTE)?"[unmuted]":"[muted]", (vaudio[i].flags & VIDEO_AUDIO_VOLUME)?vaudio[i].volume:-1, (vaudio[i].flags & VIDEO_AUDIO_BASS)?vaudio[i].bass:-1, (vaudio[i].flags & VIDEO_AUDIO_TREBLE)?vaudio[i].treble:-1); } AVMOUT(AVML_DEBUG, "check tuner"); // check tuner ( are there any tv cards with more than one ??? ) for (int i = 0; i < vcap.channels; i++) { if ( vchan[i].tuners > 1 ) { AVMOUT(AVML_WARN, "Found more than one [%d] tuner for source channel %s", vchan[i].tuners, vchan[i].name); AVMOUT(AVML_WARN, "Only the first tuner of channel %s will be supported!", vchan[i].name); AVMOUT(AVML_WARN, "This warning can be ignored..."); } } atuner= 0; memset(&vtuner,0,sizeof(struct video_tuner)); // vtuner.tuner=atuner; if (vcap.type & VID_TYPE_TUNER) { if (ioctl(m_iDevV4L, VIDIOCGTUNER, &vtuner) == -1) { AVMOUT(AVML_ERRORNO, "VIDIOC_G_TUNER"); return -1; } #ifdef v4lDEBUG debug("v4l1: tuner: %s %lu-%lu",vtuner.name,vtuner.rangelow,vtuner.rangehigh); debug("v4l1: tuner sees stereo: %s",vtuner.flags & VIDEO_TUNER_STEREO_ON?"yes":"no"); //if ( vtuner.flags & VIDEO_TUNER_NORM ) { debug("v4l1: tuner supports modes (active: %s): ",norms[vtuner.mode].str); for (int i = 0; norms[i].str != NULL; i++) { if (vtuner.flags & (1<= vcap.channels)) { AVMOUT(AVML_WARN, "No such channel %d!", source); return; } if (ioctl(m_iDevV4L, VIDIOCSCHAN, &vchan[source]) == -1) { AVMOUT(AVML_WARNNO, "VIDIOC_S_CHAN in ::setChannel"); return; } achan = source; if (source < vcap.audios) aaudio = source; } void v4l1baseif::setChannelName(const char* name) { int source = 0; while (source < vcap.channels) { //printf("name %s\n", capChannelName(source)); if (strcasecmp(capChannelName(source), name) == 0) break; source++; } if (source >= vcap.channels) return; AVMOUT(AVML_DEBUG, "setChannel %d", source); if (ioctl(m_iDevV4L, VIDIOCSCHAN, &vchan[source]) == -1) { AVMOUT(AVML_WARNNO, "VIDIOC_S_CHAN in ::setChannel"); return; } achan = source; if(source= vcap.audios) { AVMOUT(AVML_WARN, "No such audio channel %d!", aaudio); return; } if ( vaudio[aaudio].flags & VIDEO_AUDIO_MUTABLE ) { if (ioctl(m_iDevV4L,VIDIOCGAUDIO,&vaudio[aaudio]) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_G_AUDIO"); if ( on ) vaudio[aaudio].flags |= VIDEO_AUDIO_MUTE; else vaudio[aaudio].flags &= ~VIDEO_AUDIO_MUTE; if (ioctl(m_iDevV4L,VIDIOCSAUDIO,&vaudio[aaudio]) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_S_AUDIO"); smute= on; } AVMOUT(AVML_DEBUG, "setAudioMute [%d] %s", aaudio, smute ? "muted" : "unmuted"); } void v4l1baseif::setAudioVolume(int vol) { if (!vaudio || aaudio>=vcap.audios) { AVMOUT(AVML_WARN, "No such audio channel %d!", aaudio); return; } #ifdef PREREAD if (ioctl(m_iDevV4L, VIDIOCGAUDIO, &vaudio[aaudio]) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_G_AUDIO setVolume"); #endif vaudio[aaudio].volume = vol; if (ioctl(m_iDevV4L, VIDIOCSAUDIO, &vaudio[aaudio]) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_S_AUDIO setVolume"); } void v4l1baseif::setAudioMode(int mode) { if (!vaudio || aaudio >= vcap.audios) { AVMOUT(AVML_WARN, "setAudioMode() No such audio channel %d!", aaudio); return; } #ifdef PREREAD if (ioctl(m_iDevV4L,VIDIOCGAUDIO,&vaudio[aaudio]) == -1) AVMOUT(AVML_WARNNO, "setAudioMode() VIDIOC_G_AUDIO"); #endif AVMOUT(AVML_DEBUG, "setAudioMode=%d [%s]", mode, audiodescr[mode]); vaudio[aaudio].mode = mode; if (ioctl(m_iDevV4L,VIDIOCSAUDIO,&vaudio[aaudio]) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_S_AUDIO setAudioMode"); } void v4l1baseif::setPalette(int pal) { vpic.palette = VIDEO_RGB15_LE; if (ioctl(m_iDevV4L, VIDIOCSPICT, &vpic) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_S_PICT setPalette"); } bool v4l1baseif::getAudioMute() { if (ioctl(m_iDevV4L,VIDIOCGAUDIO,&vaudio[aaudio]) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_G_AUDIO getAudioMute"); AVMOUT(AVML_DEBUG, "getAudioMute %s, %d", (vaudio[aaudio].flags & VIDEO_AUDIO_MUTE)?"true":"false", vaudio[aaudio].flags); return (vaudio[aaudio].flags & VIDEO_AUDIO_MUTE); } int v4l1baseif::getAudioVolume() { if (ioctl(m_iDevV4L,VIDIOCGAUDIO,&vaudio[aaudio]) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_G_AUDIO in ::getVolume"); return vaudio[aaudio].volume; } int v4l1baseif::getAudioMode() { if (ioctl(m_iDevV4L,VIDIOCGAUDIO,&vaudio[aaudio]) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_G_AUDIO in ::getAudioMode"); AVMOUT(AVML_DEBUG, "getAudioMode=%d", vaudio[aaudio].mode); return vaudio[aaudio].mode; } unsigned long v4l1baseif::getTunerSignal() { vtuner.tuner= atuner; if (ioctl(m_iDevV4L, VIDIOCGTUNER, &vtuner) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_G_TUNER in ::getTunerSignal"); return vtuner.signal; } int v4l1baseif::getTunerMode() { vtuner.tuner = atuner; if (ioctl(m_iDevV4L, VIDIOCGTUNER, &vtuner) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_G_TUNER in ::getTunerMode"); return vtuner.mode; } int v4l1baseif::getTunerFlags() { vtuner.tuner = atuner; if (ioctl(m_iDevV4L, VIDIOCGTUNER, &vtuner) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_G_TUNER in ::getTunerFlags"); return vtuner.flags; } bool v4l1baseif::capAudioVolume() { if (ioctl(m_iDevV4L,VIDIOCGAUDIO,&vaudio[aaudio]) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_G_AUDIO in ::capAudioVolume"); return ( vaudio[aaudio].flags & VIDEO_AUDIO_VOLUME ); } bool v4l1baseif::capAudioMutable() { if (ioctl(m_iDevV4L,VIDIOCGAUDIO,&vaudio[aaudio]) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_G_AUDIO in ::capAudioMutable"); return vaudio[aaudio].flags & VIDEO_AUDIO_MUTABLE; } bool v4l1baseif::capTunerStereo() { vtuner.tuner= atuner; if (ioctl(m_iDevV4L, VIDIOCGTUNER, &vtuner) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_G_TUNER in ::getTunerMode"); return vtuner.flags & VIDEO_TUNER_STEREO_ON; } bool v4l1baseif::capTunerNorm() { vtuner.tuner = atuner; if (ioctl(m_iDevV4L, VIDIOCGTUNER, &vtuner) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_G_TUNER in ::getTunerMode"); return vtuner.flags & VIDEO_TUNER_NORM; } void v4l1baseif::capCapSize( unsigned int *minw, unsigned int *minh, unsigned int *maxw, unsigned int *maxh ) { #if 0 *minw= vcap.minwidth; *minh= vcap.minheight; *maxw= vcap.maxwidth; *maxh= vcap.maxheight; #else *minw= vcap.minwidth; *minh= vcap.minheight; *maxw= maxwidth[vchan[achan].norm]; *maxh= maxheight[vchan[achan].norm]; #endif #ifdef v4lDEBUG debug("v4l1: minw %d, maxw %d, minh %d, maxh %d in ::capCapSize",*minw,*maxw,*minh,*maxh); #endif } int v4l1baseif::addCapAClip( int x1, int y1, unsigned int x2, unsigned int y2, int xadj, int yadj ) { // return 0; if ( vcap.type & VID_TYPE_CLIPPING ) { #ifdef v4lDEBUG debug("v4l1: addCapAClip: [%d] %dx%d+%d+%d",nrofclips,x2-x1,y2-y1,x1-xadj,y1-yadj); #endif if (cliprecs[nrofclips].x != x1 - xadj || cliprecs[nrofclips].y != y1 - yadj || cliprecs[nrofclips].width != (int)x2 - x1 || cliprecs[nrofclips].height != (int)y2 - y1 ) clipTabChanged= true; cliprecs[nrofclips].x = x1 - xadj; cliprecs[nrofclips].y = y1 - yadj; cliprecs[nrofclips].width = x2 - x1; cliprecs[nrofclips].height = y2 - y1; nrofclips++; } return nrofclips; } int v4l1baseif::setCapAClip( int x, int y, unsigned int width, unsigned int height ) { // return 0; x &= ~1; y &= ~1; width &= ~1; height &= ~1; #if 0 if (ioctl(m_iDevV4L, VIDIOCGWIN, &vwin) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_G_WIN in ::setCapAClip"); #endif AVMOUT(AVML_DEBUG, "setCapAClip: flags %d, chromakey %d", vwin.flags, vwin.chromakey); Locker locker(m_Mutex); if (vcap.type & VID_TYPE_CHROMAKEY) vwin.chromakey = 0; /* XXX */ vwin.flags = 0; if (vcap.type & VID_TYPE_CLIPPING) { vwin.clips = cliprecs; vwin.clipcount = nrofclips; } vwin.x = x; vwin.y = y; vwin.height = height; vwin.width = width; AVMOUT(AVML_DEBUG, "setCapAClip new values: %d, %d, %d, %d", x, y, width, height); return nrofclips; } int v4l1baseif::applyCapAClip(int n) { // save old values int ox = vwin.x; int oy = vwin.y; int ow = vwin.width; int oh = vwin.height; AVMOUT(AVML_DEBUG, "applyCapAClip given %d, %d, %d, %d [%d]", ox, oy, ow, oh, nrofclips); vwin.clipcount = n; Locker locker(m_Mutex); if (ioctl(m_iDevV4L, VIDIOCSWIN, &vwin) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_S_WIN"); #if 1 #if 0 if (ioctl(m_iDevV4L, VIDIOCGWIN, &vwin) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_G_WIN"); if ( vwin.x != x ) vwin.x = x; if ( vwin.y != y ) vwin.y = y; if ( vwin.height != height ) vwin.height = height; if ( vwin.width != width ) vwin.width = width; #else // set old values vwin.x = ox; vwin.y = oy; vwin.height = oh; vwin.width = ow; #endif #endif #if 0 vpic.palette = x11_format; #ifdef v4lDEBUG //debug("v4l1: palette=%s",PALETTE(vpic.palette)); #endif if (ioctl(m_iDevV4L, VIDIOCSPICT, &vpic) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_S_PICT"); if (ioctl(m_iDevV4L, VIDIOCGPICT, &vpic) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_G_PICT"); #endif return n; } void v4l1baseif::getCapAClip(int* x, int* y, unsigned int* width, unsigned int* height) { #if 0 if (ioctl(m_iDevV4L, VIDIOCGWIN, &vwin) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_G_WIN in ::getCapAClip"); #endif *x = vwin.x; *y = vwin.y; *width = vwin.width; *height = vwin.height; AVMOUT(AVML_DEBUG, "getCapAClip: %d, %d, %d, %d",*x,*y,*width,*height); } bool v4l1baseif::grabSetParams( int width, int height, int palette ) { AVMOUT(AVML_DEBUG, "grabSetParams(%d, %d, %d)", width, height, palette); vgrab[0].width= width; vgrab[0].height= height; vgrab[0].frame=0; vgrab[0].format=palette; memcpy(vgrab + 1, vgrab, sizeof(struct video_mmap)); vgrab[1].frame=1; grabCapture( true ); return true; } char * v4l1baseif::grabCapture(bool single) { // even frame: 0 // odd frame: 1 //printf("v4lxif::grabCapture(%s)\n", single ? "true" : "false"); //printf("v4lxif::grabCapture %d %d %d\n", ggrab, gsync, geven); char * rmem; if (!single && (ggrab == gsync)) if (!grabOne( geven ? 0 : 1 )) return NULL; if (!grabOne( geven ? 1 : 0 )) return NULL; if (ggrab > gsync+1 ) { grabWait( geven ? 0 : 1 ); rmem = (grabbermem + vmbuf.offsets[ geven ? 0 : 1 ]); } else { grabWait( geven ? 1 : 0 ); rmem = (grabbermem + vmbuf.offsets[ geven ? 1 : 0 ]); } geven = !geven; return rmem; } bool v4l1baseif::grabOne( int frame ) { if (ioctl(m_iDevV4L, VIDIOCMCAPTURE, &(vgrab[frame])) == -1) { if (errno == EAGAIN) { AVMOUT(AVML_WARN, "Grabber chip can't sync"); return false; } AVMOUT(AVML_WARNNO, "VIDIOCMCAPTURE"); } ggrab++; return true; } void v4l1baseif::grabWait( int frame ) { if (ioctl(m_iDevV4L,VIDIOCSYNC,&(vgrab[frame].frame)) == -1) AVMOUT(AVML_WARNNO, "VIDIOCSYNC (frame %d)", frame); else gsync++; } v4l1if::v4l1if(const char* mem, const char * _device, int _bpp, int _palette) : v4l1baseif(mem, _device, _bpp, _palette) { setOutputMode("v4l1if"); AVMOUT(AVML_DEBUG, "constructor"); } int v4l1if::init() { if (v4l1baseif::init() < 0) return -1; int visual_class; #ifndef X_DISPLAY_MISSING const char* xdname = XDisplayName(0); Display* disp= XOpenDisplay(xdname); Visual *myvisual; #ifdef v4lDEBUG List_visuals(disp); #endif // get the visual int display_bits= find_visual(disp,NULL,&myvisual,&visual_class); // do some checks for color depth, size and buffer pos // first, guess the color depth of the screen int n, pixmap_bytes = 0; XPixmapFormatValues *pf = XListPixmapFormats(disp, &n); int planes = DefaultDepth(disp, DefaultScreen(disp)); for (int i = 0; i < n; i++) { if (pf[i].depth == planes) pixmap_bytes = pf[i].bits_per_pixel / 8; } /* guess physical screen format */ bool be = (ImageByteOrder(disp) == MSBFirst); switch (pixmap_bytes) { case 1: x11_format = VIDEO_RGB08; break; case 2: x11_format = (display_bits==15) ? ((be) ? VIDEO_RGB15_BE : VIDEO_RGB15_LE) : ((be) ? VIDEO_RGB16_BE : VIDEO_RGB16_LE) ; break; case 3: x11_format = (be) ? VIDEO_RGB24 : VIDEO_BGR24; break; case 4: x11_format = (be) ? VIDEO_RGB32 : VIDEO_BGR32; break; default: AVMOUT(AVML_WARN, "Unknown color depth found: %d", pixmap_bytes); } #ifdef v4lDEBUG AVMOUT(AVML_INFO, "Hope physical screen format is <%s>", format_desc[x11_format]); #endif #endif /* X_DISPLAY_MISSING */ if ( m_iPalette > 0 && m_iPalette < 11 ) { x11_format = m_iPalette; } vpic.palette = (x11_format < sizeof(format2palette)/sizeof(unsigned short)) ? format2palette[x11_format] : 0; if ( vpic.palette == 0 ) { AVMOUT(AVML_WARN, "Unsupported overlay video format <%d-%s>", x11_format,format_desc[x11_format]); vpic.palette = VIDEO_RGB08; } if (ioctl(m_iDevV4L, VIDIOCSPICT, &vpic) == -1) { AVMOUT(AVML_ERRORNO, "VIDIOC_S_PIC"); return -1; } // reread palette if (ioctl(m_iDevV4L, VIDIOCGPICT, &vpic) == -1) { AVMOUT(AVML_ERRORNO, "VIDIOC_G_PICT"); return -1; } AVMOUT(AVML_DEBUG, "Palette is %d", vpic.palette); AVMOUT(AVML_DEBUG, "test dga"); #ifdef HAVE_LIBXXF86DGA // do some strange things with dga int major, minor, width, bank, ram; int flags; void *base = NULL; bool have_dga= false; #ifndef XDGA_MAJOR_VERSION #define XDGA_MAJOR_VERSION XF86DGA_MAJOR_VERSION #endif #ifndef XDGA_MINOR_VERSION #define XDGA_MINOR_VERSION XF86DGA_MINOR_VERSION #endif if (XF86DGAQueryExtension(disp, &major, &minor)) { XF86DGAQueryDirectVideo(disp,XDefaultScreen(disp),&flags); if (flags & XF86DGADirectPresent) { have_dga = true; XF86DGAQueryVersion(disp,&major,&minor); if ((major != XDGA_MAJOR_VERSION) || (minor != XDGA_MINOR_VERSION)) { AVMOUT(AVML_HINT, "X-Server DGA extension version mismatch, disabled"); AVMOUT(AVML_HINT, "server version %d.%d != included version %d.%d", major, minor, XDGA_MAJOR_VERSION, XDGA_MINOR_VERSION); have_dga = false; } else { XF86DGAGetVideoLL(disp, DefaultScreen(disp), (CAST_DGALL int*)&base, &width, &bank, &ram); if (!base) AVMOUT(AVML_WARN, "Can not allocate frame buffer base!"); } } } if (have_dga) { AVMOUT(AVML_DEBUG, "have dga"); // check framebuffer if (((unsigned long)vbuf.base & 0xfffff000) != ((unsigned long)base & 0xfffff000) ) { AVMOUT(AVML_HINT, "Video4Linux and DGA disagree about the framebuffer base"); AVMOUT(AVML_HINT, "Video4Linux: %p, dga: %p!", vbuf.base, base); AVMOUT(AVML_HINT, "You probably want to insmod the bttv module with " "\"vidmem=0x%03lx\"", (unsigned long)base >> 20); setupok=false; } if (m_iBpp == 0 && m_iPalette == 0) { // check color depth if ((unsigned int)((vbuf.depth+7)&0xf8) != format2depth[x11_format]) { AVMOUT(AVML_HINT, "Video4Linux and DGA disagree about the color depth"); AVMOUT(AVML_HINT, "Video4Linux: %d, DGA: %d.", (vbuf.depth + 7) & 0xf8, format2depth[x11_format]); AVMOUT(AVML_HINT, "Is kv4lsetup installed correctly?"); setupok=false; } } else AVMOUT(AVML_DEBUG, "Forced bpp %d, palette %d", m_iBpp, m_iPalette); } // have_dga #endif /* HAVE_LIBXXF86DGA */ return 0; } void v4l1if::setPalette(int pal) { x11_format = ((unsigned int)pal < sizeof(format2palette)/sizeof(unsigned short))?format2palette[pal]:0; vpic.palette= x11_format; if (vpic.palette == 0) AVMOUT(AVML_WARN, "Unsupported overlay video format <%s>", format_desc[x11_format]); if (ioctl(m_iDevV4L, VIDIOCSPICT, &vpic) == -1) AVMOUT(AVML_WARNNO, "VIDIOC_S_PICT"); } avifile-0.7.48~20090503.ds/samples/qtvidcap/v4lxif.h0000644000175000017500000002711310473111240020602 0ustar yavoryavor/* kwintv, Video4Linux compatible KDE application Copyright (C) 1998 Moritz Wenk (wenk@mathematik.uni-kl.de) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef V4LIF_H #define V4LIF_H /* GUILESS should be defined if this interface will be used for a text-console application - define it in config.h (using autoconf) */ #include #include #include #include "wintv.h" #include /* Necessary to prevent collisions between and when V4L2 is installed. */ #define _LINUX_TIME_H #include #define V4L_DEVICE "/dev/video" #define V4L_VBI_DEVICE "/dev/vbi" /* WANT_V4L_DEBUG should be set in config.h/autoconf */ #define MAXCLIPRECS 100 #define PALETTE(x) ((x < sizeof(device_pal)/sizeof(char*)) ? device_pal[x] : "UNKNOWN") struct STRTAB { int nr; const char* str; }; //-------------------------------------------------------------------------------- //--------------------- the virtual interface ------------------------------------ //-------------------------------------------------------------------------------- class v4lxif : public avm::AvmOutputLog { public: enum v4lxif_version { none, v4l1, v4l2 }; v4lxif(const char* _device = V4L_DEVICE, const char* _vbi_dev=V4L_VBI_DEVICE, v4lxif_version _ifv = v4l1); virtual ~v4lxif(); v4lxif_version interface() { return ifv; } bool hasvbi() { return (m_iDevVBI>=0); } int getvbidev() { return m_iDevVBI; } int readvbi(void* buf, unsigned int cnt); // rest is virtual virtual int init(); // set virtual void setCapture( bool on) = 0; // de/activate overlay capturing virtual void setFreq(unsigned long freq) = 0; // in 1/16th MHz virtual void setPicBrightness(int bri) = 0; // -127 .. 127 virtual void setPicConstrast(int contr) = 0; // 0 .. 511 virtual void setPicColor(int color) = 0; // 0 .. 511 virtual void setPicHue(int hue) = 0; // -127 .. 127 virtual void setChannel(int source) = 0; // input source like Tuner, Camera virtual void setChannelName(const char* name) = 0; // input channel, Tuner, virtual void setChannelNorm(int norm) = 0; // VIDEO_TUNER_PAL, _NTSC, _SECAM, _AUTO virtual void setTuner(int no) = 0; // Nr of Tuner (any card aviable with more than one ??) virtual void setTunerMode(int norm) = 0; // (VIDEO_TUNER_PAL, _NTSC, _SECAM, _AUTO) virtual void setAudioMute(bool on) = 0; // toggle mute virtual void setAudioVolume(int vol) = 0; // set volume of TV card virtual void setAudioBalance(int bal) = 0; // set balance virtual void setAudioMode(int mode) = 0; // VIDEO_SOUND_MONO, _STEREO, _LANG1, _LANG2 virtual void setPalette(int pal) = 0; // set the pallette // get virtual bool getCapture() = 0; // overlay captureing enabled? virtual int getChannelActive() = 0; // get active input source virtual int getTunerActive() = 0; // get active tuner virtual int getTunerMode() = 0; // VIDEO_MODE_PAL, _NTSC, _SECAM, _AUTO virtual unsigned long getTunerSignal() = 0; // Signal strength if known - between 0-65535 virtual int getTunerFlags() = 0; // VIDEO_TUNER_* virtual int getAudioActive() = 0; // get active audio virtual bool getAudioMute() = 0; // get mute state virtual int getAudioVolume() = 0; // get vol virtual int getAudioBalance() = 0; // virtual int getAudioMode() = 0; // VIDEO_SOUND_MONO, _STEREO, _LANG1, _LANG2 // getChannel virtual int getChannelType() = 0; // VIDEO_TYPE_TV, _CAMERA virtual int getChannelNorm() = 0; // norm set for this channel // capAutio virtual bool capAudioVolume() = 0; // tv card capable to set volume? virtual bool capAudioMutable() = 0; // tv card capable to mute/unmute? // capTuner virtual bool capTunerStereo() = 0; // tuner sees stereo? virtual bool capTunerNorm() = 0; // tuner has settable norm // capChannel virtual bool capChannelAudio(int no) = 0; // active channel has audio virtual bool capChannelNorm(int no) = 0; // " has setable norm virtual bool capChannelTuner(int no ) = 0; // " has a tv tuner virtual char * capChannelName(int no) = 0; // name of channel // capCap virtual int capCapChannelC() = 0; // number of channels (= input devices) virtual int capCapAudioC() = 0; // " of audios virtual char * capCapName() = 0; // name of interface virtual int capCapType() = 0; // type ", VID_TYPE_* virtual void capCapSize(unsigned int *minw, /* TV screen min/max size */ unsigned int *minh, unsigned int *maxw, unsigned int *maxh) = 0; // clipping stuff for capture area setup virtual void resetCapAClip() = 0; virtual int addCapAClip(int x1, int y1, unsigned int x2, unsigned int y2, int xadj=0, int yadj=0) = 0; virtual int setCapAClip(int x,int y, unsigned int width, unsigned int height) = 0; virtual void getCapAClip(int *x,int *y, unsigned int *width, unsigned int *height) = 0; virtual int applyCapAClip(int nclips) = 0; virtual bool changedCapAClip() = 0; // additional virtual int getWWidth() = 0; virtual int getWHeight() = 0; // frame buffer virtual unsigned int getFBheight() = 0; virtual unsigned int getFBwidth() = 0; virtual unsigned int getFBdepth() = 0; virtual unsigned int getFBbpl() = 0; // capture image stuff virtual bool grabSetParams(int width, int height, int palette) = 0; virtual char * grabCapture(bool single) = 0; // single=false for stream captureing virtual int isOk() =0; protected: v4lxif_version ifv; avm::PthreadMutex m_Mutex; const char* m_sDevice; // name of the video4linux-device const char* m_sDeviceVBI; // name of the video4linux VBI device int m_iDevVBI; int m_iDevV4L; // the video4linux-device }; //-------------------------------------------------------------------------------- //--------------------- the video 4 linux interface ------------------------------- //-------------------------------------------------------------------------------- class v4l1baseif : public v4lxif { public: v4l1baseif(const char* mem=0, const char * _device = V4L_DEVICE, int _bpp = 0, int _palette = 0); v4l1baseif(int); ~v4l1baseif(); virtual int init(); void setCapture(bool on); void setFreq(unsigned long freq); void setPicBrightness(int bri); // -127 .. 127 void setPicConstrast(int contr); // 0 .. 511 void setPicColor(int color); // 0 .. 511 void setPicHue(int hue); // -127 .. 127 void setChannel(int source); // input channel, Tuner, void setChannelName(const char* name); // input channel, Tuner, void setChannelNorm(int norm); void setTuner(int no); // tuner, if more than one exists void setTunerMode(int norm); // PAL, NTSC, SECAM, AUTO void setAudio(int source); void setAudioMute(bool on); void setAudioVolume(int vol); void setAudioBalance(int bal) {} void setAudioMode(int mode); virtual void setPalette(int pal); bool getCapture() { return scapture; } // getTuner int getTunerActive() { return atuner; } int getTunerMode(); unsigned long getTunerSignal(); int getTunerFlags(); // getAudio int getAudioActive() { return aaudio; } bool getAudioMute(); int getAudioVolume(); int getAudioBalance() { return 0; } int getAudioMode(); // getChannel int getChannelType() { return vchan[achan].type; } int getChannelNorm() { return vchan[achan].norm; } int getChannelActive() { return achan; } // capAudio bool capAudioVolume(); bool capAudioMutable(); // capTuner bool capTunerStereo(); bool capTunerNorm(); // capChannel bool capChannelAudio(int no) { return (vchan[no].flags & VIDEO_VC_AUDIO); } bool capChannelNorm(int no) { return true; /*return vchan[no].flags & VIDEO_VC_NORM;*/ } bool capChannelTuner(int no) { return (vchan[no].flags & VIDEO_VC_TUNER); } char * capChannelName(int no) { return vchan[no].name; } // capCap int capCapChannelC() { return vcap.channels; } int capCapAudioC() { return vcap.audios; } char * capCapName() { return &(vcap.name[0]); } int capCapType() { return vcap.type; } void capCapSize(unsigned int *minw, unsigned int *minh, unsigned int *maxw, unsigned int *maxh); // clipping stuff void resetCapAClip() { nrofclips= 0; clipTabChanged= false; } int addCapAClip(int x1, int y1, unsigned int x2, unsigned int y2, int xadj=0, int yadj=0); int setCapAClip(int x, int y, unsigned int width, unsigned int height); void getCapAClip(int *x, int *y, unsigned int *width, unsigned int *height); int applyCapAClip(int nclips); bool changedCapAClip() { return clipTabChanged; } // additional int getWWidth() { return vwin.width; } int getWHeight() { return vwin.height; } // frame buffer unsigned int getFBheight() { return vbuf.height; } unsigned int getFBwidth() { return vbuf.width; } unsigned int getFBdepth() { return vbuf.depth; } unsigned int getFBbpl() { return vbuf.bytesperline; } // capture image stuff bool grabSetParams(int width, int height, int palette); char * grabCapture(bool single); int isOk() {return _state;} protected: bool grabOne(int frame); void grabWait(int frame); // video 4 linux // frame buffer struct video_buffer vbuf; // capabilities struct video_capability vcap; struct video_channel *vchan; struct video_tuner vtuner; struct video_picture vpic; struct video_audio *vaudio; // grabbing stuff struct video_mmap vgrab[2]; struct video_mbuf vmbuf; char * grabbermem; // memory for snapshot (was: unchar) int msize; // size of memory for grabbermem // capture area stuff struct video_window vwin; struct video_clip cliprecs[MAXCLIPRECS]; // list of clips int nrofclips; int m_iBpp; int m_iPalette; // additional int achan; // the active channel set by setChannel() int aaudio; // the active audio set by setAudio() int atuner; // active tuner set by setTuner() bool scapture, smute; int gsync,ggrab; bool geven; bool setupok; bool clipTabChanged; int _state; }; class v4l1if : public v4l1baseif { public: v4l1if(const char* mem = 0, const char * _device = V4L_DEVICE, int _bpp = 0, int _palette = 0); virtual int init(); virtual void setPalette(int pal); private: unsigned int pixmap_bytes, x11_format; }; #endif avifile-0.7.48~20090503.ds/samples/qtvidcap/vidconf.cpp0000644000175000017500000004516311171070742021365 0ustar yavoryavor#include "vidconf.h" #include "vidconf.moc" #include "v4lwindow.h" #include "capproc.h" #include "codecdialog.h" #include #include #include #include #define DECLARE_REGISTRY_SHORTCUT #include #undef DECLARE_REGISTRY_SHORTCUT #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // atof #include "v4lxif.h" static const struct restab { int id; int w,h; const char* lname; const char* sname; } cv_dimensions[] = { { 0, 160, 120, "160 x 120 (1/4 NTSC)", "160 x 120" }, { 1, 192, 144, "192 x 144 (1/4 PAL)" , "192 x 144" }, { 2, 320, 240, "320 x 240 (1/2 NTSC)", "320 x 240" }, { 3, 384, 288, "384 x 288 (1/2 PAL)" , "384 x 288" }, { 4, 400, 300, "400 x 300 (default)" , "400 x 300" }, { 5, 512, 384, "512 x 384 (3/4 NTSC)", "512 x 384" }, { 6, 576, 432, "576 x 432 (3/4 PAL)" , "576 x 432" }, { 7, 640, 480, "640 x 480 (NTSC)" , "640 x 480" }, { 8, 768, 576, "768 x 576 (PAL)" , "768 x 576" }, { -1, 0, 5, NULL }, /* do not channge anything below */ { -1, 0, 5, NULL }, { -1, 0, 5, NULL }, }; /* * Constructs a VidConfig which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ VidConfig::VidConfig( QWidget* parent, v4lxif* v4l, V4LWindow* w) : VidcapConfigDialog( parent, "Configure QtVidcap", true, 0 ), m_pV4lWin(w) { _savename=""; _regnumber=-1; _CapDevice->setText( RS("CaptureDevice", "/dev/video") ); _AudDevice->setText( RS("AudioDevice", "/dev/dsp") ); //ask hw //fixme for (int i = 0; cv_dimensions[i].id >= 0; i++) _Resolution->insertItem(cv_dimensions[i].lname); _Resolution->setCurrentItem( RI("Resolution", 0) ); _VideoColorMode->setCurrentItem( RI("ColorMode", 0) ); _VideoChannel->clear(); if (v4l) for(int j = 0; j < v4l->capCapChannelC(); j++) _VideoChannel->insertItem(v4l->capChannelName(j)); _VideoChannel->setCurrentItem( RI("Channel", 1) ); _Colorspace->setCurrentItem( RI("Colorspace", 0) ); _FileName->setText( RS("FileName", "./movie.avi") ); cb_never_overwrite->setChecked(RI("NeverOverwriteFiles",0)); QString regname = QString().sprintf("DirPool-%02d-Path", 0); QString pathname=RS(regname,"NONE"); for (int i = 0; pathname!="NONE";) { regname=QString().sprintf("DirPool-%02d-KeepFree",i); int keepfree=RI(regname,500); regname=QString().sprintf("DirPool-%02d-Active",i); int ison=RI(regname,1); DirPoolItem *new_item=new DirPoolItem(lv_dirpool,pathname,keepfree); new_item->setOn(ison); new_item->updateSpaceLeft(); i++; regname=QString().sprintf("DirPool-%02d-Path",i); pathname=RS(regname,"NONE"); } _SegmentSize->setText( QString().sprintf("%d", RI("SegmentSize", 1000*1000)) ); _HaveSegmented->setChecked( RI("IsSegmented", 1) ); _HaveAudio->setChecked( RI("HaveAudio", 1) ); _listChan->setCurrentItem( RI("SndChannels", 0) ); _listFreq->setCurrentItem( RI("Frequency", 0) ); _listSamp->setCurrentItem( RI("SampleSize", 0) ); _info.compressor = RI("Compressor", fccDIV3); _info.cname = RS("Codec", "select"); _info.quality = RI("Quality", 9500); _info.keyfreq = RI("Keyframe", 250); named_codecs_cb->setEditable(false); { int i=0; QString regname=QString().sprintf("NamedCodecs-%02d-Savename",i); QString nc_savename=RS(regname,"NONE"); while(nc_savename!="NONE"){ //named_codecs_cb->insertItem(nc_savename); i++; regname=QString().sprintf("NamedCodecs-%02d-Savename",i); nc_savename=RS(regname,"NONE"); } QString named_codecs_current=RS("NamedCodecsCurrent",""); if(named_codecs_current==""){ _savename=""; _regnumber=-1; } else{ for(int j=0;jcount();j++){ if(named_codecs_cb->text(j)==named_codecs_current){ named_codecs_cb->setCurrentItem(j); _regnumber=j-1; _savename=named_codecs_current; } } printf("regnumber=%d, named_codecs_current=%s\n",_regnumber,named_codecs_current.latin1()); } } updateCodecName(); _chkTime->setChecked( RI("LimitTime", 0) ); _chkFileSize->setChecked( RI("LimitSize", 0) ); _sizeLimit->setText( QString().sprintf("%d", RI("SizeLimit", 2000000)) ); _timeLimit->setText( QString().sprintf("%d", RI("TimeLimit", 3600)) ); _fps->setEditText( QString().sprintf("%2.3f", RI("FPS", 25000) / 1000.0) ); int shutdown_mode = RI("ShutdownMode",0); //cb_allow_shutdown->setChecked(RI("ShutdownAllow",0)); switch (shutdown_mode) { case 0: rb_shutdown_never->setChecked(true); break; case 1: rb_shutdown_last->setChecked(true); break; case 2: rb_shutdown_inbetween->setChecked(true); break; default: printf("ShutdownMode invalid value\n"); rb_shutdown_never->setChecked(true); break; } sb_min_timespan->setValue( RI("ShutdownMinTimespan",20) ); sb_reboot_timespan->setValue( RI("ShutdownRebootTimespan",5) ); sb_shutdown_grace->setValue( RI("ShutdownGraceTime",5) ); cb_log->setChecked( RI("LogToFile",0) ); if (RI("Password-Locked",0)) bt_password_lock->setText(tr("press to unlock")); else bt_password_lock->setText(tr("press to lock")); connect(bt_password_set,SIGNAL(pressed()),this,SLOT(set_password())); connect(bt_password_lock,SIGNAL(pressed()),this,SLOT(lock_password())); connect(named_codecs_cb,SIGNAL(activated(int)),this,SLOT(changed_named_codec(int))); } /* * Destroys the object and frees any allocated resources */ VidConfig::~VidConfig() { // no need to delete child widgets, Qt does it all for us } void VidConfig::accept() { savePage(0); savePage(1); savePage(2); savePage(3); savePage(4); savePage(5); // save only when OK, not APPLY avm::RegSave(); if (m_pV4lWin) m_pV4lWin->setupDevice(); QDialog::accept(); } void VidConfig::apply() { #if QT_VERSION>=219 savePage(tabWidget->currentPageIndex()); #else savePage(0); savePage(1); savePage(2); savePage(3); savePage(4); savePage(5); #endif if (m_pV4lWin) m_pV4lWin->setupDevice(); } void VidConfig::savePage(int page) { switch(page) { case 0: WS("CaptureDevice", _CapDevice->text()); WS("AudioDevice", _AudDevice->text()); WI("Resolution", _Resolution->currentItem()); WI("Channel", _VideoChannel->currentItem()); WI("ColorMode", _VideoColorMode->currentItem()); WI("Colorspace", _Colorspace->currentItem()); break; case 1: WS("FileName", _FileName->text()); WI("NeverOverwriteFiles",cb_never_overwrite->isChecked()); WI("SegmentSize", _SegmentSize->text()); WI("IsSegmented", _HaveSegmented->isChecked()); WI("FPS", int(atof(_fps->currentText()) * 1000)); { DirPoolItem *item=(DirPoolItem *)lv_dirpool->firstChild(); int i=0; QString regname; while(item!=NULL){ regname=QString().sprintf("DirPool-%02d-Path",i); WS(regname,item->getPath()); regname=QString().sprintf("DirPool-%02d-KeepFree",i); WI(regname,item->getKeepFree()); regname=QString().sprintf("DirPool-%02d-Active",i); WI(regname,item->isOn()); i++; item=(DirPoolItem *)item->nextSibling(); } regname=QString().sprintf("DirPool-%02d-Path",i); WS(regname,"NONE"); } break; case 2: WI("Compressor", _info.compressor); WS("Codec", _info.cname.c_str()); WI("Quality", _info.quality); WI("Keyframe", _info.keyfreq); WI("HaveAudio", _HaveAudio->isChecked()); WI("SampleSize", _listSamp->currentItem()); WI("Frequency", _listFreq->currentItem()); WI("SndChannels", _listChan->currentItem()); { WS("NamedCodecsCurrent",_savename.c_str()); //WS("NamedCodecsCurrent-Compressor",_ } break; case 3: WI("TimeLimit", _timeLimit->text()); WI("SizeLimit", _sizeLimit->text()); WI("LimitTime", _chkTime->isChecked()); WI("LimitSize", _chkFileSize->isChecked()); break; case 4: { int shutdown_mode=rb_buttons->id(rb_buttons->selected()); printf("shutdown_mode =%d\n",shutdown_mode); WI("ShutdownMode",shutdown_mode); WI("ShutdownMinTimespan",sb_min_timespan->value()); WI("ShutdownRebootTimespan",sb_reboot_timespan->value()); WI("ShutdownGraceTime",sb_shutdown_grace->value()); } break; case 5: WI("LogToFile",cb_log->isChecked()); break; } } /* * public slot */ void VidConfig::change_filename() { QString str = QFileDialog::getOpenFileName( _FileName->text(), tr( "*.avi;*.AVI" ), 0, 0 #if QT_VERSION > 220 , tr( "Select destination file" ) #endif ); if (!str.isNull()) _FileName->setText(str); } /* * public slot */ void VidConfig::change_codec() { int bpp; int w = 768; int h = 576; switch(_Colorspace->currentItem()) { case cspYV12: bpp = fccYV12; break; case cspYUY2: bpp = fccYUY2; break; case cspI420: bpp = fccI420; break; case cspRGB15: bpp = 15; break; case cspRGB24: bpp = 24; break; case cspRGB32: bpp = 32; break; default: bpp = 0; } int i = _Resolution->currentItem(); if (i >= 0 && i < 9) { w = cv_dimensions[i++].w; h = cv_dimensions[i++].h; } QString savename=named_codecs_cb->currentText(); int cin=named_codecs_cb->currentItem(); printf("current item nr is %d\n",cin); // if(named_codecs_cb->text(cin)!=savename){ //printf("new???\n"); int regnumber=-1; if(cin>0){ regnumber=0; { QString regname=QString().sprintf("NamedCodecs-%02d-Savename",regnumber); QString nc_savename=RS(regname,"NONE"); while(!(savename==nc_savename || nc_savename=="NONE")){ regnumber++; regname=QString().sprintf("NamedCodecs-%02d-Savename",regnumber); nc_savename=RS(regname,"NONE"); } if(nc_savename=="NONE"){ WS(regname,savename); //WS("NamedCodecsCurrent",savename); named_codecs_cb->insertItem(savename); int newcount=named_codecs_cb->count(); named_codecs_cb->setCurrentItem(newcount-1); } } } avm::string mycname; if(savename=="-Default-"){ _savename=""; mycname=_info.cname; } else{ _savename=savename; mycname=RS(QString().sprintf("NamedCodecs-%02d-Codec",regnumber),"select"); } printf("vidconfig: regnum=%d savename=%s mycname=%s\n",regnumber,_savename.c_str(),mycname.c_str()); BITMAPINFOHEADER bih; bih.biCompression = 0xffffffff; // just to fill video_codecs list avm::CreateDecoderVideo(bih, 0, 0); // Select those codecs which accepts give format avm::BitmapInfo bi(w, h, bpp); avm::vector codecs; avm::vector::const_iterator it; int sel = 0; i = 0; for (it = video_codecs.begin(); it != video_codecs.end(); it++) { //printf("CHECKING %s %x\n", it->GetName(), bpp); if (!(it->direction & avm::CodecInfo::Encode)) continue; avm::IVideoEncoder* enc = avm::CreateEncoderVideo(*it, bi); if (!enc) continue; // checking if this code is the one we have asked for... bool ok = (strcmp(it->GetName(), enc->GetCodecInfo().GetName()) == 0); //printf("OK CHEK %d %s %s\n", ok, it->GetName(), enc->GetCodecInfo().GetName()); avm::FreeEncoderVideo(enc); if (!ok) continue; codecs.push_back(it); if (mycname == it->GetName()) sel = i; i++; } // ListCodecs(codecs); //printf("SEL %d\n", sel); QavmCodecDialog conf(this, codecs); conf.setCurrent(sel); int gx = RI("CodecGeometryX", conf.x()); int gy = RI("CodecGeometryY", conf.y()); int gw = RI("CodecGeometryWidth", conf.width()); int gh = RI("CodecGeometryHeight", conf.height()); int gm = RI("CodecGeometryMaximized", 0); conf.resize( gw, gh ); conf.move( gx, gy); if (gm) conf.showMaximized(); if (conf.exec() == QDialog::Accepted) { WI("CodecGeometryX", conf.x()); WI("CodecGeometryY", conf.y()); WI("CodecGeometryWidth", conf.width()); WI("CodecGeometryHeight", conf.height()); #if QT_VERSION > 220 WI("CodecGeometryMaximized", conf.isMaximized()); #endif if(regnumber>=0){ _named_info=conf.getInfo(); QString regname=QString().sprintf("NamedCodecs-%02d-Compressor",regnumber); WI(regname,_named_info.compressor); regname=QString().sprintf("NamedCodecs-%02d-Codec",regnumber); WS(regname,_named_info.cname.c_str()); regname=QString().sprintf("NamedCodecs-%02d-Quality",regnumber); WI(regname,_named_info.quality); regname=QString().sprintf("NamedCodecs-%02d-Keyframe",regnumber); WI(regname,_named_info.keyfreq); _regnumber=regnumber; printf("setting named compressor regnumber=%d to %s\n",regnumber,_named_info.cname.c_str()); // _savename= } else{ _info = conf.getInfo(); printf("normal\n"); //_savename=""; } updateCodecName(); } } void VidConfig::updateCodecName() { char ft[4]; char str[256]; printf("_savename=%s\n",_savename.c_str()); if(_savename==""){ sprintf(str, "%s: %.4s", _info.cname.c_str(), avm_set_le32(ft, _info.compressor)); } else{ int regnumber=0; QString regname=QString().sprintf("NamedCodecs-%02d-Savename",regnumber); QString nc_savename=RS(regname,"NONE"); while(!(QString(_savename.c_str())==nc_savename || nc_savename=="NONE")){ regnumber++; regname=QString().sprintf("NamedCodecs-%02d-Savename",regnumber); nc_savename=RS(regname,"NONE"); } if(nc_savename=="NONE"){ sprintf(str,"error - unknown"); } else{ printf("found regnumber: %d\n",regnumber); avm::string cname=RS(QString().sprintf("NamedCodecs-%02d-Codec",regnumber),"select"); int compressor=RI(QString().sprintf("NamedCodecs-%02d-Compressor",regnumber),fccDIV3); sprintf(str, "%s: %.4s", cname.c_str(), avm_set_le32(ft, compressor)); } } _codecName->setText(str); } /* * public slot */ void VidConfig::toggle_audio(bool res) { _listSamp->setEnabled(res); _listFreq->setEnabled(res); _listChan->setEnabled(res); } /* * public slot */ void VidConfig::toggle_segmented(bool res) { _SegmentSize->setEnabled(res); } void VidConfig::toggle_limitsize(bool res) { _sizeLimit->setEnabled(res); } void VidConfig::toggle_limittime(bool res) { _timeLimit->setEnabled(res); } void VidConfig::dirpool_add(){ QString path=le_dirpool_name->text(); int keepfree=qs_dirpool_minfree->value(); if(path[0]=='/'){ DirPoolItem *new_item=new DirPoolItem(lv_dirpool,path,keepfree); int df=new_item->updateSpaceLeft(); } else{ printf("only absolute paths"); } } void VidConfig::dirpool_rem(){ DirPoolItem *item=(DirPoolItem *)lv_dirpool->selectedItem(); if(item){ lv_dirpool->takeItem(item); delete item; } } void VidConfig::lock_password(){ QString password = RS("Password-Password","NONE"); if (password == "NONE") return; int locked = RI("Password-Locked",0); if (locked) { //unlock now QMessageBox *pwd_dia=new QMessageBox(0); QVBoxLayout *lay=new QVBoxLayout(pwd_dia); lay->setAutoAdd(true); QVGroupBox *pwd_win=new QVGroupBox("Get Password",pwd_dia); QLineEdit *pwd_edit1=new QLineEdit(pwd_win); pwd_edit1->setEchoMode(QLineEdit::Password); pwd_dia->show(); int res=pwd_dia->exec(); if(pwd_edit1->text()==RS("Password-Password","NONE")){ //now unlock WI("Password-Locked",0); bt_password_lock->setText("press to lock"); } delete pwd_edit1; delete pwd_win; delete pwd_dia; } else { //now lock WI("Password-Locked",1); bt_password_lock->setText("press to unlock"); } m_pV4lWin->lock(RI("Password-Locked",0)); bt_password_lock->setOn(false); bt_password_lock->setDown(false); } void VidConfig::set_password() { QMessageBox *pwd_dia=new QMessageBox(0); QVBoxLayout *lay=new QVBoxLayout(pwd_dia); lay->setAutoAdd(true); QVGroupBox *pwd_win=new QVGroupBox("Set Password",pwd_dia); // pwd_dia->setExtension(pwd_win); //lay->addWidget(pwd_dia); QLineEdit *pwd_edit1=new QLineEdit(pwd_win); QLineEdit *pwd_edit2=new QLineEdit(pwd_win); pwd_edit1->setEchoMode(QLineEdit::Password); pwd_edit2->setEchoMode(QLineEdit::Password); do{ pwd_dia->show(); int res=pwd_dia->exec(); }while(pwd_edit1->text()!=pwd_edit2->text()); WS("Password-Password",pwd_edit1->text()); delete pwd_edit1; delete pwd_edit2; delete pwd_win; delete pwd_dia; bt_password_set->setOn(false); bt_password_set->setDown(false); } void VidConfig::changed_named_codec(int nr){ _savename=named_codecs_cb->text(nr); if(_savename=="-Default-"){ _savename=""; } else{ _savename=QString(_savename.c_str()); } _regnumber=nr-1; updateCodecName(); // printf("changed codec to %s\n",global_savename.c_str()); } void VidConfig::ListCodecs(avm::vector& codec_list) { avm::vector::iterator it; int i=0; int sel=0; for (it = codec_list.begin(); it != codec_list.end(); it++) { if ( it->kind == avm::CodecInfo::DShow_Dec) continue; //probably not a usable codec.. if(!(it->direction & avm::CodecInfo::Encode)) continue; printf("%s\n", it->GetName()); avm::vector encinfo = it->encoder_info; avm::vector::const_iterator inf_it; for(inf_it = encinfo.begin(); inf_it != encinfo.end(); inf_it++) { switch(inf_it->kind) { case avm::AttributeInfo::Integer: { int defval=0; if (avm::CodecGetAttr(*it, inf_it->GetName(), &defval) == 0) printf(" %s=%d\n", inf_it->GetName(), defval); else printf(" %s=(no default)\n", inf_it->GetName()); //avm::RegWriteInt("trala-"+_savename,inf_it->GetName(),defval); } break; case avm::AttributeInfo::Select: { int defval; avm::vector::const_iterator sit; avm::CodecGetAttr(*it, inf_it->GetName(), &defval); printf(" %s = ", inf_it->GetName()); printf(" %s ", (defval < (int)inf_it->options.size()) ? inf_it->options[defval].c_str() : "unknown"); printf(" ("); for (sit = (inf_it->options).begin(); sit != (inf_it->options).end(); sit++) printf("%s ", sit->c_str()); printf(")\n"); } break; case avm::AttributeInfo::String: { const char* def_str; avm::CodecGetAttr(*it, it->GetName(), &def_str); printf(" %s = '%s'\n", inf_it->GetName(), def_str); } break; } } i++; } } avifile-0.7.48~20090503.ds/samples/qtvidcap/vidconf.h0000644000175000017500000000335607671120560021034 0ustar yavoryavor#ifndef VIDCONFIG_H #define VIDCONFIG_H //#include #include "vidconf_p.h" #include #include class v4lxif; class V4LWindow; extern int free_diskspace(avm::string path); class DirPoolItem : public QCheckListItem { int keep_free; // in MB QString pathname; public: DirPoolItem(QListView *li, QString path, int keepfree) : QCheckListItem( li, "test", QCheckListItem::CheckBox ) { pathname=path; keep_free=keepfree; setText(0,pathname); setText(1, QString().sprintf("%5d MB",keep_free)); } const QString& getPath() const { return pathname; }; int getKeepFree() const { return keep_free; }; int updateSpaceLeft() { int free_mb=free_diskspace(pathname.latin1()); setText(2, QString().sprintf("%5d MB",free_mb)); return free_mb; } }; class VidConfig : public VidcapConfigDialog { Q_OBJECT; avm::VideoEncoderInfo _info; avm::VideoEncoderInfo _named_info; avm::string _savename; int _regnumber; V4LWindow* m_pV4lWin; public: VidConfig( QWidget* parent, v4lxif* v4l, V4LWindow* w ); ~VidConfig(); void savePage(int); QListView *getDirPool() { return lv_dirpool; }; public slots: virtual void change_filename(); virtual void change_codec(); virtual void toggle_audio(bool); virtual void toggle_segmented(bool); virtual void toggle_limitsize(bool); virtual void toggle_limittime(bool); virtual void updateCodecName(); virtual void accept(); virtual void apply(); virtual void dirpool_add(); virtual void dirpool_rem(); void set_password(); void lock_password(); void changed_named_codec(int nr); void ListCodecs(avm::vector& codec_list); }; #endif // VIDCONFIG_H avifile-0.7.48~20090503.ds/samples/qtvidcap/vidconf_p.cpp0000644000175000017500000003374210473335641021712 0ustar yavoryavor#include "vidconf_p.h" #include "vidconf_p.moc" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* * Constructs a VidcapConfigDialog which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ VidcapConfigDialog::VidcapConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QavmOkDialog( parent, name, modal, fl ) { setCaption( tr( "Avicap configuration" ) ); #if QT_VERSION > 220 setSizeGripEnabled( TRUE ); #endif tabWidget = new QTabWidget( this ); QWidget* w = new QWidget( tabWidget ); QGridLayout* gl = new QGridLayout( w, 1, 1 ); gl->setSpacing( 5 ); gl->setMargin( 5 ); // capture device int row = 0; QLabel* l = new QLabel( tr( "Capture device:" ), w ); l->setAlignment( QLabel::AlignRight | QLabel::AlignVCenter ); gl->addWidget( l, row, 0 ); _CapDevice = new QLineEdit( w ); QWhatsThis::add( _CapDevice, tr( "Do not change default value ( /dev/video ) unless you exactly know what you're doing." ) ); gl->addWidget( _CapDevice, row++, 1 ); // audio device l = new QLabel( tr( "Audio device:" ), w ); l->setAlignment( QLabel::AlignRight | QLabel::AlignVCenter ); gl->addWidget( l, row, 0 ); _AudDevice = new QLineEdit( w ); QWhatsThis::add( _AudDevice, tr( "Do not change default value ( /dev/dsp ) unless you exactly know what you're doing." ) ); gl->addWidget( _AudDevice, row++, 1 ); // channel l = new QLabel( tr( "Video channel:" ), w ); l->setAlignment( QLabel::AlignRight | QLabel::AlignVCenter ); gl->addWidget( l, row, 0 ); _VideoChannel = new QComboBox( FALSE, w ); gl->addWidget( _VideoChannel, row++, 1 ); tabWidget->insertTab( w, tr( "&Device" ) ); // color mode l = new QLabel( tr( "Color mode:" ), w ); l->setAlignment( QLabel::AlignRight | QLabel::AlignVCenter ); gl->addWidget( l, row, 0 ); _VideoColorMode = new QComboBox( FALSE, w ); _VideoColorMode->insertItem( tr( "PAL" ) ); _VideoColorMode->insertItem( tr( "NTSC" ) ); _VideoColorMode->insertItem( tr( "SECAM" ) ); _VideoColorMode->insertItem( tr( "Auto" ) ); gl->addWidget( _VideoColorMode, row++, 1 ); // resolution l = new QLabel( tr( "Resolution:" ), w ); l->setAlignment( QLabel::AlignRight | QLabel::AlignVCenter ); gl->addWidget( l, row, 0 ); _Resolution = new QComboBox( FALSE, w ); QWhatsThis::add( _Resolution, tr( "Resolutions higher than 384x288 aren't supported." ) ); gl->addWidget( _Resolution, row++, 1 ); // color space l = new QLabel( tr( "Capture color space:" ), w ); l->setAlignment( QLabel::AlignRight | QLabel::AlignVCenter ); gl->addWidget( l, row, 0 ); _Colorspace = new QComboBox( FALSE, w ); _Colorspace->insertItem( tr( "YV12" ) ); _Colorspace->insertItem( tr( "YUY2" ) ); _Colorspace->insertItem( tr( "RGB15LE" ) ); _Colorspace->insertItem( tr( "RGB24" ) ); _Colorspace->insertItem( tr( "RGB32" ) ); gl->addWidget( _Colorspace, row, 1 ); w = new QWidget( tabWidget ); QVBoxLayout* vbl36 = new QVBoxLayout( w ); vbl36->setMargin( 5 ); QGroupBox* gb = new QGroupBox( tr( "Destination file" ), w ); vbl36->addWidget( gb ); gb->setColumnLayout( 0, Qt::Vertical ); QHBoxLayout* hbl = new QHBoxLayout( gb->layout() ); hbl->setSpacing( 5 ); _ChangeFile = new QPushButton( tr( "C&hange..." ), gb ); hbl->addWidget( _ChangeFile ); _FileName = new QLineEdit( gb ); hbl->addWidget( _FileName ); cb_never_overwrite=new QCheckBox(tr("never overwrite existing files"),gb); QVBoxLayout* vblnvo = new QVBoxLayout( gb->layout() ); vblnvo->setSpacing( 5 ); vblnvo->addWidget(cb_never_overwrite); gb_dirpool=new QGroupBox(tr("Directory Pool"),w); gb_dirpool->setColumnLayout( 0, Qt::Vertical ); vbl36->addWidget(gb_dirpool); QVBoxLayout * lay_pool1=new QVBoxLayout( gb_dirpool->layout() ); lv_dirpool=new QListView(gb_dirpool); lv_dirpool->setBaseSize(50,20); lay_pool1->addWidget(lv_dirpool); lv_dirpool->setSelectionMode(QListView::Single); lv_dirpool->addColumn(tr("Path")); lv_dirpool->addColumn(tr("keep free")); lv_dirpool->addColumn(tr("now free")); lv_dirpool->setAllColumnsShowFocus(true); lv_dirpool->setShowSortIndicator(true); QHBoxLayout * lay_pool2=new QHBoxLayout( gb_dirpool->layout() ); bt_add_dirpool=new QPushButton(tr("add"),gb_dirpool); lay_pool2->addWidget(bt_add_dirpool); lay_pool2->setSpacing(3); lay_pool2->setMargin(3); bt_rem_dirpool=new QPushButton(tr("remove"),gb_dirpool); lay_pool2->addWidget(bt_rem_dirpool); QHBoxLayout * lay_pool3=new QHBoxLayout( gb_dirpool->layout() ); connect(bt_add_dirpool,SIGNAL(pressed()),this,SLOT(dirpool_add())); connect(bt_rem_dirpool,SIGNAL(pressed()),this,SLOT(dirpool_rem())); le_dirpool_name=new QLineEdit(gb_dirpool); lay_pool3->addWidget(le_dirpool_name); lay_pool3->setSpacing(3); lay_pool3->setMargin(3); qs_dirpool_minfree=new QSpinBox(100,320*1000,100,gb_dirpool); qs_dirpool_minfree->setPrefix(tr("keep free ")); qs_dirpool_minfree->setSuffix(" MB"); lay_pool3->addWidget(qs_dirpool_minfree); ; gb = new QGroupBox( tr( "Segmentation" ), w ); vbl36->addWidget( gb ); gb->setColumnLayout( 0, Qt::Vertical ); QToolTip::add( gb, tr( "" ) ); QWhatsThis::add( gb, tr( "Segmentation allows to write more than 2 Gb" " of data ( limit for an AVI file ) during one" " session. When it's turned on, program will" " create a sequence of AVI files, automatically" " switching them when their sizes become larger" " than user-specified value." ) ); gl = new QGridLayout( gb->layout(), 1, 1 ); gl->setSpacing( 5 ); l = new QLabel( tr( "Segment size ( KBytes ):" ), gb ); gl->addWidget( l, 1, 0 ); _HaveSegmented = new QCheckBox( tr( "&Write segmented file" ), gb ); gl->addWidget( _HaveSegmented, 0, 0 ); _SegmentSize = new QLineEdit( gb ); _SegmentSize->setEnabled( FALSE ); gl->addWidget( _SegmentSize, 1, 1 ); tabWidget->insertTab( w, tr( "&File" ) ); w = new QWidget( tabWidget ); QVBoxLayout* vbl37 = new QVBoxLayout( w ); vbl37->setMargin( 5 ); gb = new QGroupBox( tr( "Video compression format" ), w ); vbl37->addWidget( gb ); gb->setColumnLayout( 0, Qt::Vertical ); hbl = new QHBoxLayout( gb->layout() ); hbl->setSpacing( 5 ); l = new QLabel( tr( "Current format:" ), gb ); hbl->addWidget( l ); _codecName = new QLabel( gb ); _codecName->setText( tr( "" ) ); _codecName->setFrameShadow( QLabel::Sunken ); _codecName->setFrameShape( QLabel::Panel ); _codecName->setAlignment( QLabel::AlignCenter ); hbl->addWidget( _codecName ); _ChangeCodec = new QPushButton( gb ); _ChangeCodec->setText( tr( "C&hange..." ) ); hbl->addWidget( _ChangeCodec ); QHBoxLayout *vblnc = new QHBoxLayout( gb->layout() ); vblnc->setSpacing( 5 ); named_codecs_cb=new QComboBox(true,gb); vblnc->addWidget( named_codecs_cb); named_codecs_cb->insertItem(tr("-Default-")); gb = new QGroupBox( tr( "Video frame rate" ), w ); vbl37->addWidget( gb ); gb->setColumnLayout(0, Qt::Vertical); gl = new QGridLayout( gb->layout(), 1, 1 ); gl->setSpacing( 5 ); l = new QLabel( tr( "Frames per second:" ), gb ); gl->addWidget( l, 0, 0 ); _fps = new QComboBox( gb ); _fps->insertItem( tr( "12" ) ); _fps->insertItem( tr( "15" ) ); _fps->insertItem( tr( "18" ) ); _fps->insertItem( tr( "20" ) ); _fps->insertItem( tr( "23.975" ) ); _fps->insertItem( tr( "24" ) ); _fps->insertItem( tr( "25" ) ); _fps->insertItem( tr( "29.970" ) ); _fps->insertItem( tr( "30" ) ); #if QT_VERSION > 220 _fps->setEditable( true ); #endif QValidator* qv = new QDoubleValidator( 1, 30, 3, gb ); _fps->setValidator( qv ); _fps->setEditText( "25" ); gl->addWidget( _fps, 0, 1 ); gb = new QGroupBox( tr( "Video cropping" ), w ); vbl37->addWidget( gb ); gb->setColumnLayout(0, Qt::Vertical); tabWidget->insertTab( w, tr( "&Video" ) ); w = new QWidget( tabWidget ); vbl37 = new QVBoxLayout( w ); vbl37->setMargin( 5 ); gb = new QGroupBox( tr( "Audio compression format" ), w ); vbl37->addWidget( gb ); gb->setColumnLayout( 0, Qt::Vertical ); gb = new QGroupBox( tr( "Audio format" ), w ); vbl37->addWidget( gb ); gb->setColumnLayout( 0, Qt::Vertical ); gl = new QGridLayout( gb->layout(), 1, 1 ); gl->setSpacing( 5 ); l = new QLabel( tr( "Frequency:" ), gb ); l->setAlignment( QLabel::AlignRight | QLabel::AlignVCenter ); gl->addWidget( l, 1, 0 ); l = new QLabel( tr( "Sample size:" ), gb ); l->setAlignment( QLabel::AlignRight | QLabel::AlignVCenter ); gl->addWidget( l, 1, 2 ); l = new QLabel( tr( "Channels:" ), gb ); l->setAlignment( QLabel::AlignRight | QLabel::AlignVCenter ); gl->addWidget( l, 0, 2 ); _listSamp = new QComboBox( FALSE, gb ); _listSamp->insertItem( tr( "16 bit" ) ); _listSamp->insertItem( tr( "8 bit" ) ); _listSamp->setEnabled( FALSE ); gl->addWidget( _listSamp, 1, 3 ); _HaveAudio = new QCheckBox( tr( "Capture audi&o" ), gb ); gl->addMultiCellWidget( _HaveAudio, 0, 0, 0, 1 ); _listFreq = new QComboBox( FALSE, gb ); _listFreq->insertItem( tr( "48000 Hz" ) ); _listFreq->insertItem( tr( "44100 Hz" ) ); _listFreq->insertItem( tr( "32000 Hz" ) ); _listFreq->insertItem( tr( "22050 Hz" ) ); _listFreq->insertItem( tr( "16000 Hz" ) ); _listFreq->insertItem( tr( "12000 Hz" ) ); _listFreq->insertItem( tr( "11025 Hz" ) ); _listFreq->insertItem( tr( " 8000 Hz" ) ); _listFreq->setEnabled( FALSE ); gl->addWidget( _listFreq, 1, 1 ); _listChan = new QComboBox( FALSE, gb ); _listChan->insertItem( tr( "Mono" ) ); _listChan->insertItem( tr( "Stereo" ) ); _listChan->insertItem( tr( "Lang1" ) ); _listChan->insertItem( tr( "Lang2" ) ); _listChan->setEnabled( FALSE ); gl->addWidget( _listChan, 0, 3 ); tabWidget->insertTab( w, tr( "&Audio" ) ); w = new QWidget( tabWidget ); QVBoxLayout* vbl38 = new QVBoxLayout( w ); vbl38->setMargin( 5 ); gb = new QGroupBox( tr( "Limit capture process by:" ), w ); vbl38->addWidget( gb ); gb->setColumnLayout( 0, Qt::Vertical ); gl = new QGridLayout( gb->layout(), 1, 1 ); gl->setSpacing( 5 ); _chkTime = new QCheckBox( tr( "&Time" ), gb ); gl->addWidget( _chkTime, 0, 0 ); _timeLimit = new QLineEdit( gb ); _timeLimit->setEnabled( FALSE ); gl->addWidget( _timeLimit, 0, 1 ); l = new QLabel( tr( "seconds" ), gb ); gl->addWidget( l, 0, 2 ); _chkFileSize = new QCheckBox( tr( "File &size" ), gb ); gl->addWidget( _chkFileSize, 1, 0 ); _sizeLimit = new QLineEdit( gb ); _sizeLimit->setEnabled( FALSE ); gl->addWidget( _sizeLimit, 1, 1 ); l = new QLabel( tr( "KBytes" ), gb ); gl->addWidget( l, 1, 2 ); tabWidget->insertTab( w, tr( "&Limits" ) ); // shutdown tab/widgets w = new QWidget( tabWidget ); QVBoxLayout* vblshut = new QVBoxLayout( w ); vblshut->setMargin( 1 ); rb_buttons=new QVButtonGroup(tr("when to shutdown"),w); rb_shutdown_never=new QRadioButton(tr("never shut down"),rb_buttons); rb_shutdown_last=new QRadioButton(tr("shutdown after last recording"),rb_buttons); rb_shutdown_inbetween=new QRadioButton(tr("shutdown in-between recordings"),rb_buttons); vblshut->addWidget(rb_buttons); gb = new QGroupBox( tr( "Shutdown/Resume Options" ), w ); vblshut->addWidget( gb ); gb->setColumnLayout( 0, Qt::Vertical ); gl = new QGridLayout( gb->layout(), 1, 1 ); gl->setSpacing( 1 ); l=new QLabel(tr("minimum downtime in min"),gb); gl->addWidget(l,1,0); sb_min_timespan=new QSpinBox(5,60,1,gb); gl->addWidget(sb_min_timespan,1,1); l=new QLabel(tr("boot n mins before recording"),gb); gl->addWidget(l,2,0); sb_reboot_timespan=new QSpinBox(1,20,1,gb); gl->addWidget(sb_reboot_timespan,2,1); l=new QLabel(tr("gracetime for shutdown in min"),gb); gl->addWidget(l,3,0); sb_shutdown_grace=new QSpinBox(1,10,1,gb); gl->addWidget(sb_shutdown_grace,3,1); tabWidget->insertTab(w,tr("Shutdown/Resume")); //end of shutdown widgets // other tab/widgets QVGroupBox *gb_other = new QVGroupBox(tr("other options"), tabWidget); cb_log=new QCheckBox(tr("Log actions to file"),gb_other); QHGroupBox *gb_password=new QHGroupBox(tr("Password Lock"),gb_other); bt_password_set=new QPushButton(tr("Set Password"),gb_password); bt_password_lock=new QPushButton(tr("press to Lock"),gb_password); tabWidget->insertTab(gb_other,tr("Other")); //end of other tab widgets gridLayout()->addWidget( tabWidget, 0, 0 ); setApplyEnabled( TRUE ); // signals and slots connections connect( _HaveAudio, SIGNAL( toggled(bool) ), this, SLOT( toggle_audio(bool) ) ); connect( _HaveSegmented, SIGNAL( toggled(bool) ), this, SLOT( toggle_segmented(bool) ) ); connect( _ChangeFile, SIGNAL( clicked() ), this, SLOT( change_filename() ) ); connect( _ChangeCodec, SIGNAL( clicked() ), this, SLOT( change_codec() ) ); connect( _chkTime, SIGNAL( toggled(bool) ), this, SLOT( toggle_limittime(bool) ) ); connect( _chkFileSize, SIGNAL( toggled(bool) ), this, SLOT( toggle_limitsize(bool) ) ); } /* * Destroys the object and frees any allocated resources */ VidcapConfigDialog::~VidcapConfigDialog() { // no need to delete child widgets, Qt does it all for us } avifile-0.7.48~20090503.ds/samples/qtvidcap/vidconf_p.h0000644000175000017500000000417507671120561021354 0ustar yavoryavor#ifndef VIDCAPCONFIGDIALOG_H #define VIDCAPCONFIGDIALOG_H #include "okdialog.h" class QVButtonGroup; class QButtonGroup; class QCheckBox; class QComboBox; class QLabel; class QLineEdit; class QPushButton; class QRadioButton; class QSpinBox; class QTabWidget; class QWidget; class QGroupBox; class QListView; class VidcapConfigDialog : public QavmOkDialog { Q_OBJECT; public: VidcapConfigDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~VidcapConfigDialog(); QTabWidget* tabWidget; QComboBox* _Colorspace; QComboBox* _Resolution; QLineEdit* _CapDevice; QLineEdit* _AudDevice; QComboBox* _VideoColorMode; QComboBox* _VideoChannel; QLineEdit* _FileName; QPushButton* _ChangeFile; QComboBox* _fps; QCheckBox* _HaveSegmented; QLineEdit* _SegmentSize; QComboBox* _listSamp; QCheckBox* _HaveAudio; QComboBox* _listFreq; QComboBox* _listChan; QLabel* _codecName; QPushButton* _ChangeCodec; QButtonGroup* ButtonGroup1; QCheckBox* _chkFileSize; QLineEdit* _timeLimit; QLineEdit* _sizeLimit; QCheckBox* _chkTime; //shutdown //QCheckBox *cb_allow_shutdown; QVButtonGroup *rb_buttons; QRadioButton *rb_shutdown_never; QRadioButton *rb_shutdown_last; QRadioButton *rb_shutdown_inbetween; QSpinBox *sb_min_timespan; QSpinBox *sb_reboot_timespan; QSpinBox *sb_shutdown_grace; QCheckBox *cb_never_overwrite; QGroupBox *gb_dirpool; QListView *lv_dirpool; QPushButton *bt_add_dirpool,*bt_rem_dirpool; QLineEdit *le_dirpool_name; QSpinBox *qs_dirpool_minfree; QCheckBox *cb_log; QPushButton *bt_password_set,*bt_password_lock; QComboBox *named_codecs_cb; public slots: virtual void apply() = 0; virtual void change_codec() = 0; virtual void change_filename() = 0; virtual void toggle_audio(bool) = 0; virtual void toggle_limitsize(bool) = 0; virtual void toggle_limittime(bool) = 0; virtual void toggle_segmented(bool) = 0; virtual void dirpool_add() = 0; virtual void dirpool_rem() = 0; }; #endif // VIDCAPCONFIGDIALOG_H avifile-0.7.48~20090503.ds/samples/qtvidcap/wintv.h0000644000175000017500000000613007671120561020545 0ustar yavoryavor/* xWinTV using Bt848 frame grabber driver Copyright (C) 1998 Moritz Wenk (wenk@mathematik.uni-kl.de) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef WINTV_H #define WINTV_H // for debugging // // myDEBUG to debug all // sDEBUG mixer // tvDEBUG winTVScreen // rcDEBUG rcfile // vtxDEBUG vtx // X11DEBUG x11-events //#define X11DEBUG // debug everything // #define myDEBUG // this can be defined with ./configure --enable-debug // need this to avoid conflicting type declarations in Xmd.h and qglobal.h #define QT_CLEAN_NAMESPACE // this is obsolete and should be removed in later versions! #define withTVscreen // change this values to adjust range and step of mixer slider #define MIXER_MAX_VALUE 100 #define MIXER_STEP 3 // range is -FINETUNERANGE*4 ... FINETUNERANGE*4 #define FINETUNERANGE 16 // signal quality must be better than this value to detect a vaild channel #define SIGQUALITY 0 #define TIMEWAIT 500 #define OP_CAP 1 #define OP_BPP 2 #define OP_VME 3 #define OP_DEV 4 #define OP_SHI 5 #define OP_REF 6 #define OP_PAL 7 #define OP_DOK 8 /* ------------------- some definitions ---------------------------------*/ // aspect ratio #define ASPECT_NONE 0 #define ASPECT_16_9 1 #define ASPECT_4_3 2 #define ASPECT_FIX_BOTH 0 #define ASPECT_FIX_HOR 1 #define ASPECT_FIX_VER 2 // some defaults #define DCOL 254 #define DBRI 0 #define DHUE 0 #define DCONTRAST 216 #define DNORM 0 #define DIN 0 #define DFREQ 772 #define DCHANNEL 1 #define PICNAME "image" #define VIDNAME "video" #define NONE 0 #define DEFAULT_WIDTH 320 #define DEFAULT_HEIGHT 240 #define PAL_WIDTH 768 #define PAL_WIDE_WIDTH 922 #define PAL_HEIGHT 576 #define NTSC_WIDTH 640 #define NTSC_HEIGHT 480 // several delay times #define DEFAULT_DELAY 200 // 0.2 sec #define AUDIOMODE_DELAY 1000 // 1 sec. #define INFO_DELAY 3000 // 3 sec. // audio #define AUDIOMODE_AUTODETECT 256 #define CAN_AUDIO_VOLUME 1 // supported video clip formats #define VIDEOCLIP_AVI 0 #define VIDEOCLIP_PPM 1 #define VIDEOCLIP_RAW 2 #define VIDEOCLIP_IV5 3 // supported shap shot formats #define SNAPSHOT_PNM 0 #define SNAPSHOT_JPEG 1 #define SNAPSHOT_TIFF 2 #define SNAPSHOT_PNG 3 #define SNAPSHOT_GIF 4 #define CHINFO_NODISPVAL -1024 #define OSD_LEVEL_OFF 0 #define OSD_LEVEL_1 1 #define OSD_LEVEL_2 2 #define VIEWREFRESH_ALLOW 1 #define VIEWREFRESH_VISIBILITY 2 #endif // WINTV_H