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

Side by Side Diff: source/libvpx/vp8/common/extend.c

Issue 7671004: Update libvpx snapshot to v0.9.7-p1 (Cayuga). (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: '' Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp8/common/extend.h ('k') | source/libvpx/vp8/common/findnearmv.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 11
12 #include "extend.h" 12 #include "extend.h"
13 #include "vpx_mem/vpx_mem.h" 13 #include "vpx_mem/vpx_mem.h"
14 14
15 15
16 static void extend_plane_borders 16 static void copy_and_extend_plane
17 ( 17 (
18 unsigned char *s, /* source */ 18 unsigned char *s, /* source */
19 int sp, /* pitch */ 19 int sp, /* source pitch */
20 unsigned char *d, /* destination */
21 int dp, /* destination pitch */
20 int h, /* height */ 22 int h, /* height */
21 int w, /* width */ 23 int w, /* width */
22 int et, /* extend top border */ 24 int et, /* extend top border */
23 int el, /* extend left border */ 25 int el, /* extend left border */
24 int eb, /* extend bottom border */ 26 int eb, /* extend bottom border */
25 int er /* extend right border */ 27 int er /* extend right border */
26 ) 28 )
27 { 29 {
28
29 int i; 30 int i;
30 unsigned char *src_ptr1, *src_ptr2; 31 unsigned char *src_ptr1, *src_ptr2;
31 unsigned char *dest_ptr1, *dest_ptr2; 32 unsigned char *dest_ptr1, *dest_ptr2;
32 int linesize; 33 int linesize;
33 34
34 /* copy the left and right most columns out */ 35 /* copy the left and right most columns out */
35 src_ptr1 = s; 36 src_ptr1 = s;
36 src_ptr2 = s + w - 1; 37 src_ptr2 = s + w - 1;
37 dest_ptr1 = s - el; 38 dest_ptr1 = d - el;
38 dest_ptr2 = s + w; 39 dest_ptr2 = d + w;
39 40
40 for (i = 0; i < h - 0 + 1; i++) 41 for (i = 0; i < h; i++)
41 { 42 {
42 /* Some linkers will complain if we call vpx_memset with el set to a 43 vpx_memset(dest_ptr1, src_ptr1[0], el);
43 * constant 0. 44 vpx_memcpy(dest_ptr1 + el, src_ptr1, w);
44 */
45 if (el)
46 vpx_memset(dest_ptr1, src_ptr1[0], el);
47 vpx_memset(dest_ptr2, src_ptr2[0], er); 45 vpx_memset(dest_ptr2, src_ptr2[0], er);
48 src_ptr1 += sp; 46 src_ptr1 += sp;
49 src_ptr2 += sp; 47 src_ptr2 += sp;
50 dest_ptr1 += sp; 48 dest_ptr1 += dp;
51 dest_ptr2 += sp; 49 dest_ptr2 += dp;
52 } 50 }
53 51
54 /* Now copy the top and bottom source lines into each line of the respective borders */ 52 /* Now copy the top and bottom lines into each line of the respective
55 src_ptr1 = s - el; 53 * borders
56 src_ptr2 = s + sp * (h - 1) - el; 54 */
57 dest_ptr1 = s + sp * (-et) - el; 55 src_ptr1 = d - el;
58 dest_ptr2 = s + sp * (h) - el; 56 src_ptr2 = d + dp * (h - 1) - el;
59 linesize = el + er + w + 1; 57 dest_ptr1 = d + dp * (-et) - el;
58 dest_ptr2 = d + dp * (h) - el;
59 linesize = el + er + w;
60 60
61 for (i = 0; i < (int)et; i++) 61 for (i = 0; i < et; i++)
62 { 62 {
63 vpx_memcpy(dest_ptr1, src_ptr1, linesize); 63 vpx_memcpy(dest_ptr1, src_ptr1, linesize);
64 dest_ptr1 += sp; 64 dest_ptr1 += dp;
65 } 65 }
66 66
67 for (i = 0; i < (int)eb; i++) 67 for (i = 0; i < eb; i++)
68 { 68 {
69 vpx_memcpy(dest_ptr2, src_ptr2, linesize); 69 vpx_memcpy(dest_ptr2, src_ptr2, linesize);
70 dest_ptr2 += sp; 70 dest_ptr2 += dp;
71 } 71 }
72 } 72 }
73 73
74 74
75 void vp8_extend_to_multiple_of16(YV12_BUFFER_CONFIG *ybf, int width, int height) 75 void vp8_copy_and_extend_frame(YV12_BUFFER_CONFIG *src,
76 YV12_BUFFER_CONFIG *dst)
76 { 77 {
77 int er = 0xf & (16 - (width & 0xf)); 78 int et = dst->border;
78 int eb = 0xf & (16 - (height & 0xf)); 79 int el = dst->border;
80 int eb = dst->border + dst->y_height - src->y_height;
81 int er = dst->border + dst->y_width - src->y_width;
79 82
80 /* check for non multiples of 16 */ 83 copy_and_extend_plane(src->y_buffer, src->y_stride,
81 if (er != 0 || eb != 0) 84 dst->y_buffer, dst->y_stride,
82 { 85 src->y_height, src->y_width,
83 extend_plane_borders(ybf->y_buffer, ybf->y_stride, height, width, 0, 0, eb, er); 86 et, el, eb, er);
84 87
85 /* adjust for uv */ 88 et = dst->border >> 1;
86 height = (height + 1) >> 1; 89 el = dst->border >> 1;
87 width = (width + 1) >> 1; 90 eb = (dst->border >> 1) + dst->uv_height - src->uv_height;
88 er = 0x7 & (8 - (width & 0x7)); 91 er = (dst->border >> 1) + dst->uv_width - src->uv_width;
89 eb = 0x7 & (8 - (height & 0x7));
90 92
91 if (er || eb) 93 copy_and_extend_plane(src->u_buffer, src->uv_stride,
92 { 94 dst->u_buffer, dst->uv_stride,
93 extend_plane_borders(ybf->u_buffer, ybf->uv_stride, height, width, 0 , 0, eb, er); 95 src->uv_height, src->uv_width,
94 extend_plane_borders(ybf->v_buffer, ybf->uv_stride, height, width, 0 , 0, eb, er); 96 et, el, eb, er);
95 } 97
96 } 98 copy_and_extend_plane(src->v_buffer, src->uv_stride,
99 dst->v_buffer, dst->uv_stride,
100 src->uv_height, src->uv_width,
101 et, el, eb, er);
97 } 102 }
98 103
104
99 /* note the extension is only for the last row, for intra prediction purpose */ 105 /* note the extension is only for the last row, for intra prediction purpose */
100 void vp8_extend_mb_row(YV12_BUFFER_CONFIG *ybf, unsigned char *YPtr, unsigned ch ar *UPtr, unsigned char *VPtr) 106 void vp8_extend_mb_row(YV12_BUFFER_CONFIG *ybf, unsigned char *YPtr, unsigned ch ar *UPtr, unsigned char *VPtr)
101 { 107 {
102 int i; 108 int i;
103 109
104 YPtr += ybf->y_stride * 14; 110 YPtr += ybf->y_stride * 14;
105 UPtr += ybf->uv_stride * 6; 111 UPtr += ybf->uv_stride * 6;
106 VPtr += ybf->uv_stride * 6; 112 VPtr += ybf->uv_stride * 6;
107 113
108 for (i = 0; i < 4; i++) 114 for (i = 0; i < 4; i++)
109 { 115 {
110 YPtr[i] = YPtr[-1]; 116 YPtr[i] = YPtr[-1];
111 UPtr[i] = UPtr[-1]; 117 UPtr[i] = UPtr[-1];
112 VPtr[i] = VPtr[-1]; 118 VPtr[i] = VPtr[-1];
113 } 119 }
114 120
115 YPtr += ybf->y_stride; 121 YPtr += ybf->y_stride;
116 UPtr += ybf->uv_stride; 122 UPtr += ybf->uv_stride;
117 VPtr += ybf->uv_stride; 123 VPtr += ybf->uv_stride;
118 124
119 for (i = 0; i < 4; i++) 125 for (i = 0; i < 4; i++)
120 { 126 {
121 YPtr[i] = YPtr[-1]; 127 YPtr[i] = YPtr[-1];
122 UPtr[i] = UPtr[-1]; 128 UPtr[i] = UPtr[-1];
123 VPtr[i] = VPtr[-1]; 129 VPtr[i] = VPtr[-1];
124 } 130 }
125 } 131 }
OLDNEW
« no previous file with comments | « source/libvpx/vp8/common/extend.h ('k') | source/libvpx/vp8/common/findnearmv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698