dos386
2009-Dec-07 00:31 UTC
[theora] Bunch of bugs in LibTheora, FFMPEG2THEORA, PNG2THEORA
1. "dump_video.c" got reverted back by 5 years into 2004: https://trac.xiph.org/browser/trunk/theora/examples/dump_video.c https://trac.xiph.org/log/trunk/theora/examples/dump_video.c 2. "png2theora.c" (subminor) https://trac.xiph.org/browser/trunk/theora/examples/png2theora.c 207 /* Must hold: yuv_w >= w */ 208 yuv_w = (w + 15) & ~15; 209 210 /* Must hold: yuv_h >= h */ 211 yuv_h = (h + 15) & ~15; 699 ti.frame_width = ((w + 15) >>4)<<4; 700 ti.frame_height = ((h + 15)>>4)<<4; Same thing ^^^ done 2 x differently ;-) 3. "png2theora.c" Win32 binary doesn't work https://trac.xiph.org/browser/trunk/theora/examples/png2theora.c http://firefogg.org/nightly/ 97 "The input argument uses C printf format to represent a list of files,\n" 98 " i.e. file-%%06d.png to look for files file000001.png to file9999999.png \n\n" very ^^^ strange ... 678 snprintf(input_png, 1023,"%s/%s", input_directory, png_files[0]->d_name); 679 if(png_read(input_png, &w, &h, &yuv)) { 680 fprintf(stderr, "could not read %s\n", input_png); 681 exit(1); 682 } here ^^^ ... 146 #ifdef WIN32 147 int 148 alphasort (const void *a, const void *b) 149 { 150 return strcoll ((*(const struct dirent **) a)->d_name, 151 (*(const struct dirent **) b)->d_name); 152 } 153 154 int 155 scandir (const char *dir, struct dirent ***namelist, 156 int (*select)(const struct dirent *), int (*compar)(const void *, const void *)) 157 { 158 DIR *d; 159 struct dirent *entry; 160 register int i=0; 161 size_t entrysize; 162 163 if ((d=opendir(dir)) == NULL) 164 return(-1); 165 166 *namelist=NULL; 167 while ((entry=readdir(d)) != NULL) 168 { 169 if (select == NULL || (select != NULL && (*select)(entry))) 170 { 171 *namelist=(struct dirent **)realloc((void *)(*namelist), 172 (size_t)((i+1)*sizeof(struct dirent *))); 173 if (*namelist == NULL) return(-1); 174 entrysize=sizeof(struct dirent)-sizeof(entry->d_name)+strlen(entry->d_name)+1; 175 (*namelist)[i]=(struct dirent *)malloc(entrysize); 176 if ((*namelist)[i] == NULL) return(-1); 177 memcpy((*namelist)[i], entry, entrysize); 178 i++; 179 } 180 } 181 if (closedir(d)) return(-1); 182 if (i == 0) return(-1); 183 if (compar != NULL) 184 qsort((void *)(*namelist), (size_t)i, sizeof(struct dirent *), compar); 185 186 return(i); 187 } 188 #endif What's the goal ^^^ of this code ??? I'm getting Page Faults, "can't read \." or 1-frame movies at best ... 4. FFMPEG2THEORA Win32 encoding from frames doesn't work It does find my PNG frames and reads them all (unlike PNG2THEORA), also has an "interesting" algo finding amount of them: 0-1-2-4-8-16-32-64-128-256(not found)-129-130-132-136-144(not found)-137..., output movie looks promising but is garbage (some residual similarity to the original, though). No problem with encoding from YUV4MPEG. 5. (suggestion) Upgrade the frame picking algo in both FFMPEG2THEORA and PNG2THEORA: "blah(4,0).png" would mean "blah0000.png" to "blah9999.png" (as long as frame available) "frame(3,77).png" would run from 077 to 999 at most. Counter syntax: (digits, start) Using percent "%" in commandline is bad since some OS'es do use it for enviro var expansion: "SET PATH=C:\XIPH\;%PATH%"