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

Side by Side Diff: source/libvpx/vp8/encoder/denoising.c

Issue 11974002: libvpx: Pull from upstream (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years, 11 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/encoder/block.h ('k') | source/libvpx/vp8/encoder/encodeframe.c » ('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) 2012 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 vp8_copy_mem16x16(running_avg->y_buffer + y_offset, avg_y_stride, 133 vp8_copy_mem16x16(running_avg->y_buffer + y_offset, avg_y_stride,
134 signal->thismb, sig_stride); 134 signal->thismb, sig_stride);
135 return FILTER_BLOCK; 135 return FILTER_BLOCK;
136 } 136 }
137 137
138 int vp8_denoiser_allocate(VP8_DENOISER *denoiser, int width, int height) 138 int vp8_denoiser_allocate(VP8_DENOISER *denoiser, int width, int height)
139 { 139 {
140 int i; 140 int i;
141 assert(denoiser); 141 assert(denoiser);
142 142
143 /* don't need one for intra start at 1 */ 143 for (i = 0; i < MAX_REF_FRAMES; i++)
144 for (i = 1; i < MAX_REF_FRAMES; i++)
145 { 144 {
146 denoiser->yv12_running_avg[i].flags = 0; 145 denoiser->yv12_running_avg[i].flags = 0;
147 146
148 if (vp8_yv12_alloc_frame_buffer(&(denoiser->yv12_running_avg[i]), width, 147 if (vp8_yv12_alloc_frame_buffer(&(denoiser->yv12_running_avg[i]), width,
149 height, VP8BORDERINPIXELS) 148 height, VP8BORDERINPIXELS)
150 < 0) 149 < 0)
151 { 150 {
152 vp8_denoiser_free(denoiser); 151 vp8_denoiser_free(denoiser);
153 return 1; 152 return 1;
154 } 153 }
(...skipping 13 matching lines...) Expand all
168 vpx_memset(denoiser->yv12_mc_running_avg.buffer_alloc, 0, 167 vpx_memset(denoiser->yv12_mc_running_avg.buffer_alloc, 0,
169 denoiser->yv12_mc_running_avg.frame_size); 168 denoiser->yv12_mc_running_avg.frame_size);
170 return 0; 169 return 0;
171 } 170 }
172 171
173 void vp8_denoiser_free(VP8_DENOISER *denoiser) 172 void vp8_denoiser_free(VP8_DENOISER *denoiser)
174 { 173 {
175 int i; 174 int i;
176 assert(denoiser); 175 assert(denoiser);
177 176
178 /* we don't have one for intra ref frame */ 177 for (i = 0; i < MAX_REF_FRAMES ; i++)
179 for (i = 1; i < MAX_REF_FRAMES ; i++)
180 { 178 {
181 vp8_yv12_de_alloc_frame_buffer(&denoiser->yv12_running_avg[i]); 179 vp8_yv12_de_alloc_frame_buffer(&denoiser->yv12_running_avg[i]);
182 } 180 }
183 vp8_yv12_de_alloc_frame_buffer(&denoiser->yv12_mc_running_avg); 181 vp8_yv12_de_alloc_frame_buffer(&denoiser->yv12_mc_running_avg);
184 } 182 }
185 183
186 184
187 void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser, 185 void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser,
188 MACROBLOCK *x, 186 MACROBLOCK *x,
189 unsigned int best_sse, 187 unsigned int best_sse,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 if (best_sse > SSE_THRESHOLD || motion_magnitude2 282 if (best_sse > SSE_THRESHOLD || motion_magnitude2
285 > 8 * NOISE_MOTION_THRESHOLD) 283 > 8 * NOISE_MOTION_THRESHOLD)
286 { 284 {
287 decision = COPY_BLOCK; 285 decision = COPY_BLOCK;
288 } 286 }
289 287
290 if (decision == FILTER_BLOCK) 288 if (decision == FILTER_BLOCK)
291 { 289 {
292 /* Filter. */ 290 /* Filter. */
293 decision = vp8_denoiser_filter(&denoiser->yv12_mc_running_avg, 291 decision = vp8_denoiser_filter(&denoiser->yv12_mc_running_avg,
294 &denoiser->yv12_running_avg[LAST_FRAME], 292 &denoiser->yv12_running_avg[INTRA_FRAME],
295 x, 293 x,
296 motion_magnitude2, 294 motion_magnitude2,
297 recon_yoffset, recon_uvoffset); 295 recon_yoffset, recon_uvoffset);
298 } 296 }
299 if (decision == COPY_BLOCK) 297 if (decision == COPY_BLOCK)
300 { 298 {
301 /* No filtering of this block; it differs too much from the predictor, 299 /* No filtering of this block; it differs too much from the predictor,
302 * or the motion vector magnitude is considered too big. 300 * or the motion vector magnitude is considered too big.
303 */ 301 */
304 vp8_copy_mem16x16( 302 vp8_copy_mem16x16(
305 x->thismb, 16, 303 x->thismb, 16,
306 denoiser->yv12_running_avg[LAST_FRAME].y_buffer + recon_yoffset, 304 denoiser->yv12_running_avg[INTRA_FRAME].y_buffer + recon_yoffset ,
307 denoiser->yv12_running_avg[LAST_FRAME].y_stride); 305 denoiser->yv12_running_avg[INTRA_FRAME].y_stride);
308 } 306 }
309 } 307 }
OLDNEW
« no previous file with comments | « source/libvpx/vp8/encoder/block.h ('k') | source/libvpx/vp8/encoder/encodeframe.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698