Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: source/libvpx/vpx_scale/generic/vpx_scale.c

Issue 1124333011: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: only update to last nights LKGR Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 line_src = source_base; 372 line_src = source_base;
373 373
374 horiz_line_scale(line_src, source_width, 374 horiz_line_scale(line_src, source_width,
375 temp_area + (i + 1)*dest_pitch, dest_width); 375 temp_area + (i + 1)*dest_pitch, dest_width);
376 } 376 }
377 377
378 /* Vertical scaling is in place */ 378 /* Vertical scaling is in place */
379 vert_band_scale(temp_area + dest_pitch, dest_pitch, dest, dest_pitch, dest _width); 379 vert_band_scale(temp_area + dest_pitch, dest_pitch, dest, dest_pitch, dest _width);
380 380
381 if (interpolation) 381 if (interpolation)
382 vpx_memcpy(temp_area, temp_area + source_band_height * dest_pitch, dest_ width); 382 memcpy(temp_area, temp_area + source_band_height * dest_pitch, dest_widt h);
383 383
384 /* Next band... */ 384 /* Next band... */
385 source += (unsigned long) source_band_height * source_pitch; 385 source += (unsigned long) source_band_height * source_pitch;
386 dest += (unsigned long) dest_band_height * dest_pitch; 386 dest += (unsigned long) dest_band_height * dest_pitch;
387 } 387 }
388 388
389 return; 389 return;
390 } 390 }
391 391
392 if (hscale == 2 && hratio == 1) 392 if (hscale == 2 && hratio == 1)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 bands = (dest_height + dest_band_height - 1) / dest_band_height; 425 bands = (dest_height + dest_band_height - 1) / dest_band_height;
426 426
427 for (k = 0; k < bands; k++) { 427 for (k = 0; k < bands; k++) {
428 /* scale one band horizontally */ 428 /* scale one band horizontally */
429 for (i = 1; i < source_band_height + 1; i++) { 429 for (i = 1; i < source_band_height + 1; i++) {
430 if (k * source_band_height + i < (int) source_height) { 430 if (k * source_band_height + i < (int) source_height) {
431 Scale1Dh(source + i * source_pitch, 1, hscale, source_width + 1, 431 Scale1Dh(source + i * source_pitch, 1, hscale, source_width + 1,
432 temp_area + i * dest_pitch, 1, hratio, dest_width); 432 temp_area + i * dest_pitch, 1, hratio, dest_width);
433 } else { /* Duplicate the last row */ 433 } else { /* Duplicate the last row */
434 /* copy temp_area row 0 over from last row in the past */ 434 /* copy temp_area row 0 over from last row in the past */
435 vpx_memcpy(temp_area + i * dest_pitch, temp_area + (i - 1)*dest_pitch, d est_pitch); 435 memcpy(temp_area + i * dest_pitch, temp_area + (i - 1)*dest_pitch, dest_ pitch);
436 } 436 }
437 } 437 }
438 438
439 /* scale one band vertically */ 439 /* scale one band vertically */
440 for (j = 0; j < (int)dest_width; j++) { 440 for (j = 0; j < (int)dest_width; j++) {
441 Scale1Dv(&temp_area[j], dest_pitch, vscale, source_band_height + 1, 441 Scale1Dv(&temp_area[j], dest_pitch, vscale, source_band_height + 1,
442 &dest[j], dest_pitch, vratio, dest_band_height); 442 &dest[j], dest_pitch, vratio, dest_band_height);
443 } 443 }
444 444
445 /* copy temp_area row 0 over from last row in the past */ 445 /* copy temp_area row 0 over from last row in the past */
446 vpx_memcpy(temp_area, temp_area + source_band_height * dest_pitch, dest_pitc h); 446 memcpy(temp_area, temp_area + source_band_height * dest_pitch, dest_pitch);
447 447
448 /* move to the next band */ 448 /* move to the next band */
449 source += source_band_height * source_pitch; 449 source += source_band_height * source_pitch;
450 dest += dest_band_height * dest_pitch; 450 dest += dest_band_height * dest_pitch;
451 } 451 }
452 } 452 }
453 453
454 /**************************************************************************** 454 /****************************************************************************
455 * 455 *
456 * ROUTINE : vpx_scale_frame 456 * ROUTINE : vpx_scale_frame
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 int dw = (hscale - 1 + src->y_width * hratio) / hscale; 491 int dw = (hscale - 1 + src->y_width * hratio) / hscale;
492 int dh = (vscale - 1 + src->y_height * vratio) / vscale; 492 int dh = (vscale - 1 + src->y_height * vratio) / vscale;
493 493
494 /* call our internal scaling routines!! */ 494 /* call our internal scaling routines!! */
495 Scale2D((unsigned char *) src->y_buffer, src->y_stride, src->y_width, src->y_h eight, 495 Scale2D((unsigned char *) src->y_buffer, src->y_stride, src->y_width, src->y_h eight,
496 (unsigned char *) dst->y_buffer, dst->y_stride, dw, dh, 496 (unsigned char *) dst->y_buffer, dst->y_stride, dw, dh,
497 temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced); 497 temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced);
498 498
499 if (dw < (int)dst->y_width) 499 if (dw < (int)dst->y_width)
500 for (i = 0; i < dh; i++) 500 for (i = 0; i < dh; i++)
501 vpx_memset(dst->y_buffer + i * dst->y_stride + dw - 1, dst->y_buffer[i * d st->y_stride + dw - 2], dst->y_width - dw + 1); 501 memset(dst->y_buffer + i * dst->y_stride + dw - 1, dst->y_buffer[i * dst-> y_stride + dw - 2], dst->y_width - dw + 1);
502 502
503 if (dh < (int)dst->y_height) 503 if (dh < (int)dst->y_height)
504 for (i = dh - 1; i < (int)dst->y_height; i++) 504 for (i = dh - 1; i < (int)dst->y_height; i++)
505 vpx_memcpy(dst->y_buffer + i * dst->y_stride, dst->y_buffer + (dh - 2) * d st->y_stride, dst->y_width + 1); 505 memcpy(dst->y_buffer + i * dst->y_stride, dst->y_buffer + (dh - 2) * dst-> y_stride, dst->y_width + 1);
506 506
507 Scale2D((unsigned char *) src->u_buffer, src->uv_stride, src->uv_width, src->u v_height, 507 Scale2D((unsigned char *) src->u_buffer, src->uv_stride, src->uv_width, src->u v_height,
508 (unsigned char *) dst->u_buffer, dst->uv_stride, dw / 2, dh / 2, 508 (unsigned char *) dst->u_buffer, dst->uv_stride, dw / 2, dh / 2,
509 temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced); 509 temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced);
510 510
511 if (dw / 2 < (int)dst->uv_width) 511 if (dw / 2 < (int)dst->uv_width)
512 for (i = 0; i < dst->uv_height; i++) 512 for (i = 0; i < dst->uv_height; i++)
513 vpx_memset(dst->u_buffer + i * dst->uv_stride + dw / 2 - 1, dst->u_buffer[ i * dst->uv_stride + dw / 2 - 2], dst->uv_width - dw / 2 + 1); 513 memset(dst->u_buffer + i * dst->uv_stride + dw / 2 - 1, dst->u_buffer[i * dst->uv_stride + dw / 2 - 2], dst->uv_width - dw / 2 + 1);
514 514
515 if (dh / 2 < (int)dst->uv_height) 515 if (dh / 2 < (int)dst->uv_height)
516 for (i = dh / 2 - 1; i < (int)dst->y_height / 2; i++) 516 for (i = dh / 2 - 1; i < (int)dst->y_height / 2; i++)
517 vpx_memcpy(dst->u_buffer + i * dst->uv_stride, dst->u_buffer + (dh / 2 - 2 )*dst->uv_stride, dst->uv_width); 517 memcpy(dst->u_buffer + i * dst->uv_stride, dst->u_buffer + (dh / 2 - 2)*ds t->uv_stride, dst->uv_width);
518 518
519 Scale2D((unsigned char *) src->v_buffer, src->uv_stride, src->uv_width, src->u v_height, 519 Scale2D((unsigned char *) src->v_buffer, src->uv_stride, src->uv_width, src->u v_height,
520 (unsigned char *) dst->v_buffer, dst->uv_stride, dw / 2, dh / 2, 520 (unsigned char *) dst->v_buffer, dst->uv_stride, dw / 2, dh / 2,
521 temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced); 521 temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced);
522 522
523 if (dw / 2 < (int)dst->uv_width) 523 if (dw / 2 < (int)dst->uv_width)
524 for (i = 0; i < dst->uv_height; i++) 524 for (i = 0; i < dst->uv_height; i++)
525 vpx_memset(dst->v_buffer + i * dst->uv_stride + dw / 2 - 1, dst->v_buffer[ i * dst->uv_stride + dw / 2 - 2], dst->uv_width - dw / 2 + 1); 525 memset(dst->v_buffer + i * dst->uv_stride + dw / 2 - 1, dst->v_buffer[i * dst->uv_stride + dw / 2 - 2], dst->uv_width - dw / 2 + 1);
526 526
527 if (dh / 2 < (int) dst->uv_height) 527 if (dh / 2 < (int) dst->uv_height)
528 for (i = dh / 2 - 1; i < (int)dst->y_height / 2; i++) 528 for (i = dh / 2 - 1; i < (int)dst->y_height / 2; i++)
529 vpx_memcpy(dst->v_buffer + i * dst->uv_stride, dst->v_buffer + (dh / 2 - 2 )*dst->uv_stride, dst->uv_width); 529 memcpy(dst->v_buffer + i * dst->uv_stride, dst->v_buffer + (dh / 2 - 2)*ds t->uv_stride, dst->uv_width);
530 } 530 }
OLDNEW
« no previous file with comments | « source/libvpx/vpx_scale/generic/gen_scalers.c ('k') | source/libvpx/vpx_scale/generic/yv12config.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698