- Timestamp:
- Sep 1, 2014 4:03:31 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-videodev/ios_dev.m
r4902 r4909 403 403 frame.size = stream->frame_size; 404 404 frame.timestamp.u64 = stream->frame_ts.u64; 405 405 406 406 if (stream->is_planar && stream->capture_buf) { 407 407 if (stream->param.fmt.id == PJMEDIA_FORMAT_I420) { … … 409 409 pj_uint8_t *p, *p_end, *Y, *U, *V; 410 410 pj_size_t p_len; 411 /* Image stride is not always equal to the image width. I.e on Ipad 412 * air, at 352*288 the image stride is 384. 413 */ 414 pj_size_t stride = CVPixelBufferGetBytesPerRowOfPlane(img, 0); 415 pj_bool_t need_clip = (stride != stream->size.w); 411 416 412 417 p = (pj_uint8_t*)CVPixelBufferGetBaseAddressOfPlane(img, 0); … … 415 420 U = Y + p_len; 416 421 V = U + p_len/4; 417 pj_memcpy(Y, p, p_len); 418 422 423 if (!need_clip) { 424 pj_memcpy(Y, p, p_len); 425 } else { 426 int i = 0; 427 for (;i<stream->size.h;++i) { 428 pj_memcpy(Y+(i*stream->size.w), p+(i*stride), 429 stream->size.w); 430 } 431 } 432 419 433 p = (pj_uint8_t*)CVPixelBufferGetBaseAddressOfPlane(img, 1); 420 p_len >>= 1; 421 p_end = p + p_len; 422 while (p < p_end) { 423 *U++ = *p++; 424 *V++ = *p++; 434 if (!need_clip) { 435 p_len >>= 1; 436 p_end = p + p_len; 437 438 while (p < p_end) { 439 *U++ = *p++; 440 *V++ = *p++; 441 } 442 } else { 443 int i = 0; 444 for (;i<(stream->size.h)/2;++i) { 445 int y=0; 446 for (;y<(stream->size.w)/2;++y) { 447 *U++ = *p++; 448 *V++ = *p++; 449 } 450 p += (stride - stream->size.w); 451 } 425 452 } 426 453
Note: See TracChangeset
for help on using the changeset viewer.