Changeset 334
- Timestamp:
- 02/08/07 18:42:07 (2 years ago)
- Files:
-
- trunk/ColorConversions.c (modified) (6 diffs)
- trunk/MatroskaImport.cpp (modified) (1 diff)
- trunk/SSATagParsing.m.rl (modified) (1 diff)
- trunk/SubImport.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ColorConversions.c
r290 r334 63 63 //also, big-endian only 64 64 65 static void Y420 _ppc_scalar(UInt8* baseAddr, int outRB, int width, int height, AVFrame * picture)65 static void Y420toY422_ppc_scalar(UInt8* baseAddr, int outRB, int width, int height, AVFrame * picture) 66 66 { 67 67 int y = height >> 1; … … 106 106 } 107 107 108 static void Y420 _ppc_altivec(UInt8 * o, int outRB, int width, int height, AVFrame * picture)108 static void Y420toY422_ppc_altivec(UInt8 * o, int outRB, int width, int height, AVFrame * picture) 109 109 { 110 110 UInt8 *yc = picture->data[0], *uc = picture->data[1], *vc = picture->data[2]; … … 164 164 size_t length = sizeof(vType); 165 165 int error = sysctl(sels, 2, &vType, &length, NULL, 0); 166 if( 0 == error && vType ) y420_function = Y420 _ppc_altivec;166 if( 0 == error && vType ) y420_function = Y420toY422_ppc_altivec; 167 167 else 168 y420_function = Y420 _ppc_scalar;168 y420_function = Y420toY422_ppc_scalar; 169 169 } 170 170 … … 174 174 #include <emmintrin.h> 175 175 176 void Y420toY422(UInt8 * o, int outRB, int width, int height, AVFrame * picture)176 static void Y420toY422_sse2(UInt8 * o, int outRB, int width, int height, AVFrame * picture) 177 177 { 178 178 UInt8 *yc = picture->data[0], *uc = picture->data[1], *vc = picture->data[2]; 179 179 int rY = picture->linesize[0], rU = picture->linesize[1], rV = picture->linesize[2]; 180 int y,x, vWidth = width >> 4, halfheight = height >> 1 ;180 int y,x, vWidth = width >> 4, halfheight = height >> 1, halfwidth = width >> 1; 181 181 182 182 for (y = 0; y < halfheight; y ++) { … … 206 206 } 207 207 208 if (__builtin_expect(width % 16, FALSE)) { //spill to scalar for the end if the row isn't a multiple of 16208 if (__builtin_expect(width & 15, FALSE)) { //spill to scalar for the end if the row isn't a multiple of 16 209 209 UInt8 *o2 = o + outRB, *yc2 = yc + rY; 210 for (x = vWidth * 16; x < width; x += 2) {210 for (x = vWidth * 16; x < halfwidth; x ++) { 211 211 int hx = x>>1, x2 = x*2; 212 212 o2[x2] = o[x2] = uc[hx]; … … 224 224 vc += rV; 225 225 } 226 _mm_sfence(); // complete all writes 226 _mm_sfence(); // complete all writes (probably not really needed) 227 } 228 229 230 static void Y420toY422_x86_scalar(UInt8 * o, int outRB, int width, int height, AVFrame * picture) 231 { 232 UInt8 *yc = picture->data[0], *u = picture->data[1], *v = picture->data[2]; 233 int rY = picture->linesize[0], rU = picture->linesize[1], rV = picture->linesize[2], halfheight = height >> 1, halfwidth = width >> 1; 234 int y, x; 235 236 for (y = 0; y < halfheight; y ++) { 237 UInt8 *o2 = o + outRB, *yc2 = yc + rY; 238 239 for (x = 0; x < halfwidth; x ++) { 240 int hx = x>>1, x2 = x*2; 241 o2[x2] = o[x2] = u[hx]; 242 o[x2 + 1] = yc[x]; 243 o2[x2 + 1] = yc2[x]; 244 o2[x2 + 2] = o[x2 + 2] = v[hx]; 245 o[x2 + 3] = yc[x + 1]; 246 o2[x2 + 3] = yc2[x + 1]; 247 } 248 249 o += outRB*2; 250 yc += rY*2; 251 u += rU; 252 v += rV; 253 } 254 } 255 256 void Y420toY422(UInt8 * o, int outRB, int width, int height, AVFrame * picture) 257 { 258 uintptr_t yc = (uintptr_t)picture->data[0]; 259 260 //make sure the ffmpeg picture buffers are aligned enough, they're only guaranteed to be 8-byte for some reason... 261 //if input y isn't 16 byte aligned, sse2 crashes 262 263 if (__builtin_expect((yc % 16) == 0 && (picture->linesize[0] % 16) == 0, TRUE)) Y420toY422_sse2(o, outRB, width, height, picture); 264 else Y420toY422_x86_scalar(o, outRB, width, height, picture); 227 265 } 228 266 #endif trunk/MatroskaImport.cpp
r333 r334 276 276 } 277 277 278 } 279 278 } else 280 279 do { 281 280 if (EbmlId(*el_l1) == KaxCluster::ClassInfos.GlobalId) { trunk/SSATagParsing.m.rl
r332 r334 266 266 267 267 action fsize { 268 num *= (72./96.); // scale from Windows 96dpi 268 269 fixv = FloatToFixed(num); 269 270 SetATSUStyleOther(cur_style, kATSUSizeTag, sizeof(fixv), &fixv); trunk/SubImport.mm
r333 r334 387 387 if (num == 0) return; 388 388 unsigned times[num*2+1]; 389 SubLine *slines[num] ;389 SubLine *slines[num], *last=nil; 390 390 [lines sortUsingFunction:cmp_line context:nil]; 391 391 [lines getObjects:slines]; 392 //NSLog(@"pre - %@",lines);392 // NSLog(@"pre - %@",lines); 393 393 for (int i=0;i < num;i++) { 394 394 times[i*2] = slines[i]->begin_time; … … 412 412 for (int j=0; j < num; j++) { 413 413 if (isinrange(times[i], slines[j]->begin_time, slines[j]->end_time)) { 414 end = slines[j]->end_time; 414 unsigned next_start = (j == num-1)?slines[j]->end_time:slines[j+1]->begin_time; 415 end = MIN(slines[j]->end_time, next_start); 415 416 [accum appendString:slines[j]->line]; 416 417 startedOutput = true; … … 421 422 if (finishedOutput && startedOutput) { 422 423 [accum deleteCharactersInRange:NSMakeRange([accum length] - 1, 1)]; // delete last newline 424 425 if (last) { // ensure the last packet's end time isn't after this one's begin time 426 if (last->end_time > start) last->end_time = start; 427 } 428 423 429 SubLine *event = [[SubLine alloc] initWithLine:accum start:start end:end]; 430 431 [outpackets addObject:event]; 424 432 425 [outpackets addObject:event];433 last = event; 426 434 } 427 435 } 428 436 429 // NSLog(@" %@",outpackets);437 // NSLog(@"out - %@",outpackets); 430 438 431 439 if (finished) [lines removeAllObjects];
