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

Side by Side Diff: source/libvpx/vp8/encoder/encodemb.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/encoder/encodemb.h ('k') | source/libvpx/vp8/encoder/encodemv.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 "vpx_ports/config.h" 12 #include "vpx_ports/config.h"
13 #include "encodemb.h" 13 #include "encodemb.h"
14 #include "vp8/common/reconinter.h" 14 #include "vp8/common/reconinter.h"
15 #include "quantize.h" 15 #include "quantize.h"
16 #include "tokenize.h" 16 #include "tokenize.h"
17 #include "vp8/common/invtrans.h" 17 #include "vp8/common/invtrans.h"
18 #include "vp8/common/recon.h" 18 #include "vp8/common/recon.h"
19 #include "vp8/common/reconintra.h" 19 #include "vp8/common/reconintra.h"
20 #include "dct.h" 20 #include "dct.h"
21 #include "vpx_mem/vpx_mem.h" 21 #include "vpx_mem/vpx_mem.h"
22 #include "rdopt.h"
22 23
23 #if CONFIG_RUNTIME_CPU_DETECT 24 #if CONFIG_RUNTIME_CPU_DETECT
24 #define IF_RTCD(x) (x) 25 #define IF_RTCD(x) (x)
25 #else 26 #else
26 #define IF_RTCD(x) NULL 27 #define IF_RTCD(x) NULL
27 #endif 28 #endif
28 void vp8_subtract_b_c(BLOCK *be, BLOCKD *bd, int pitch) 29 void vp8_subtract_b_c(BLOCK *be, BLOCKD *bd, int pitch)
29 { 30 {
30 unsigned char *src_ptr = (*(be->base_src) + be->src); 31 unsigned char *src_ptr = (*(be->base_src) + be->src);
31 short *diff_ptr = be->src_diff; 32 short *diff_ptr = be->src_diff;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 94 }
94 95
95 diff += 16; 96 diff += 16;
96 pred += 16; 97 pred += 16;
97 src += stride; 98 src += stride;
98 } 99 }
99 } 100 }
100 101
101 static void vp8_subtract_mb(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) 102 static void vp8_subtract_mb(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
102 { 103 {
103 ENCODEMB_INVOKE(&rtcd->encodemb, submby)(x->src_diff, x->src.y_buffer, x->e_ mbd.predictor, x->src.y_stride); 104 BLOCK *b = &x->block[0];
105
106 ENCODEMB_INVOKE(&rtcd->encodemb, submby)(x->src_diff, *(b->base_src), x->e_m bd.predictor, b->src_stride);
104 ENCODEMB_INVOKE(&rtcd->encodemb, submbuv)(x->src_diff, x->src.u_buffer, x->s rc.v_buffer, x->e_mbd.predictor, x->src.uv_stride); 107 ENCODEMB_INVOKE(&rtcd->encodemb, submbuv)(x->src_diff, x->src.u_buffer, x->s rc.v_buffer, x->e_mbd.predictor, x->src.uv_stride);
105 } 108 }
106 109
107 static void build_dcblock(MACROBLOCK *x) 110 static void build_dcblock(MACROBLOCK *x)
108 { 111 {
109 short *src_diff_ptr = &x->src_diff[384]; 112 short *src_diff_ptr = &x->src_diff[384];
110 int i; 113 int i;
111 114
112 for (i = 0; i < 16; i++) 115 for (i = 0; i < 16; i++)
113 { 116 {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // build dc block from 16 y dc values 191 // build dc block from 16 y dc values
189 if (x->e_mbd.mode_info_context->mbmi.mode != SPLITMV) 192 if (x->e_mbd.mode_info_context->mbmi.mode != SPLITMV)
190 { 193 {
191 build_dcblock(x); 194 build_dcblock(x);
192 x->short_walsh4x4(&x->block[24].src_diff[0], 195 x->short_walsh4x4(&x->block[24].src_diff[0],
193 &x->block[24].coeff[0], 8); 196 &x->block[24].coeff[0], 8);
194 } 197 }
195 } 198 }
196 199
197 200
198 void vp8_stuff_inter16x16(MACROBLOCK *x)
199 {
200 vp8_build_inter_predictors_mb_s(&x->e_mbd);
201 /*
202 // recon = copy from predictors to destination
203 {
204 BLOCKD *b = &x->e_mbd.block[0];
205 unsigned char *pred_ptr = b->predictor;
206 unsigned char *dst_ptr = *(b->base_dst) + b->dst;
207 int stride = b->dst_stride;
208 201
209 int i;
210 for(i=0;i<16;i++)
211 vpx_memcpy(dst_ptr+i*stride,pred_ptr+16*i,16);
212
213 b = &x->e_mbd.block[16];
214 pred_ptr = b->predictor;
215 dst_ptr = *(b->base_dst) + b->dst;
216 stride = b->dst_stride;
217
218 for(i=0;i<8;i++)
219 vpx_memcpy(dst_ptr+i*stride,pred_ptr+8*i,8);
220
221 b = &x->e_mbd.block[20];
222 pred_ptr = b->predictor;
223 dst_ptr = *(b->base_dst) + b->dst;
224 stride = b->dst_stride;
225
226 for(i=0;i<8;i++)
227 vpx_memcpy(dst_ptr+i*stride,pred_ptr+8*i,8);
228 }
229 */
230 }
231
232 #if !(CONFIG_REALTIME_ONLY)
233 #define RDCOST(RM,DM,R,D) ( ((128+(R)*(RM)) >> 8) + (DM)*(D) )
234 #define RDTRUNC(RM,DM,R,D) ( (128+(R)*(RM)) & 0xFF ) 202 #define RDTRUNC(RM,DM,R,D) ( (128+(R)*(RM)) & 0xFF )
235 203
236 typedef struct vp8_token_state vp8_token_state; 204 typedef struct vp8_token_state vp8_token_state;
237 205
238 struct vp8_token_state{ 206 struct vp8_token_state{
239 int rate; 207 int rate;
240 int error; 208 int error;
241 signed char next; 209 signed char next;
242 signed char token; 210 signed char token;
243 short qc; 211 short qc;
(...skipping 21 matching lines...) Expand all
265 vp8_token_state tokens[17][2]; 233 vp8_token_state tokens[17][2];
266 unsigned best_mask[2]; 234 unsigned best_mask[2];
267 const short *dequant_ptr; 235 const short *dequant_ptr;
268 const short *coeff_ptr; 236 const short *coeff_ptr;
269 short *qcoeff_ptr; 237 short *qcoeff_ptr;
270 short *dqcoeff_ptr; 238 short *dqcoeff_ptr;
271 int eob; 239 int eob;
272 int i0; 240 int i0;
273 int rc; 241 int rc;
274 int x; 242 int x;
275 int sz; 243 int sz = 0;
276 int next; 244 int next;
277 int rdmult; 245 int rdmult;
278 int rddiv; 246 int rddiv;
279 int final_eob; 247 int final_eob;
280 int rd_cost0; 248 int rd_cost0;
281 int rd_cost1; 249 int rd_cost1;
282 int rate0; 250 int rate0;
283 int rate1; 251 int rate1;
284 int error0; 252 int error0;
285 int error1; 253 int error1;
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 569
602 ta = (ENTROPY_CONTEXT *)&t_above; 570 ta = (ENTROPY_CONTEXT *)&t_above;
603 tl = (ENTROPY_CONTEXT *)&t_left; 571 tl = (ENTROPY_CONTEXT *)&t_left;
604 572
605 for (b = 16; b < 24; b++) 573 for (b = 16; b < 24; b++)
606 { 574 {
607 optimize_b(x, b, PLANE_TYPE_UV, 575 optimize_b(x, b, PLANE_TYPE_UV,
608 ta + vp8_block2above[b], tl + vp8_block2left[b], rtcd); 576 ta + vp8_block2above[b], tl + vp8_block2left[b], rtcd);
609 } 577 }
610 } 578 }
611 #endif
612 579
613 void vp8_encode_inter16x16(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) 580 void vp8_encode_inter16x16(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
614 { 581 {
615 vp8_build_inter_predictors_mb(&x->e_mbd); 582 vp8_build_inter_predictors_mb(&x->e_mbd);
616 583
617 vp8_subtract_mb(rtcd, x); 584 vp8_subtract_mb(rtcd, x);
618 585
619 transform_mb(x); 586 transform_mb(x);
620 587
621 vp8_quantize_mb(x); 588 vp8_quantize_mb(x);
622 589
623 #if !(CONFIG_REALTIME_ONLY)
624 if (x->optimize) 590 if (x->optimize)
625 optimize_mb(x, rtcd); 591 optimize_mb(x, rtcd);
626 #endif
627 592
628 vp8_inverse_transform_mb(IF_RTCD(&rtcd->common->idct), &x->e_mbd); 593 vp8_inverse_transform_mb(IF_RTCD(&rtcd->common->idct), &x->e_mbd);
629 594
630 RECON_INVOKE(&rtcd->common->recon, recon_mb) 595 RECON_INVOKE(&rtcd->common->recon, recon_mb)
631 (IF_RTCD(&rtcd->common->recon), &x->e_mbd); 596 (IF_RTCD(&rtcd->common->recon), &x->e_mbd);
632 } 597 }
633 598
634 599
635 /* this funciton is used by first pass only */ 600 /* this funciton is used by first pass only */
636 void vp8_encode_inter16x16y(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) 601 void vp8_encode_inter16x16y(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
637 { 602 {
638 vp8_build_inter_predictors_mby(&x->e_mbd); 603 BLOCK *b = &x->block[0];
639 604
640 ENCODEMB_INVOKE(&rtcd->encodemb, submby)(x->src_diff, x->src.y_buffer, x->e_ mbd.predictor, x->src.y_stride); 605 vp8_build_inter16x16_predictors_mby(&x->e_mbd);
606
607 ENCODEMB_INVOKE(&rtcd->encodemb, submby)(x->src_diff, *(b->base_src), x->e_m bd.predictor, b->src_stride);
641 608
642 transform_mby(x); 609 transform_mby(x);
643 610
644 vp8_quantize_mby(x); 611 vp8_quantize_mby(x);
645 612
646 vp8_inverse_transform_mby(IF_RTCD(&rtcd->common->idct), &x->e_mbd); 613 vp8_inverse_transform_mby(IF_RTCD(&rtcd->common->idct), &x->e_mbd);
647 614
648 RECON_INVOKE(&rtcd->common->recon, recon_mby) 615 RECON_INVOKE(&rtcd->common->recon, recon_mby)
649 (IF_RTCD(&rtcd->common->recon), &x->e_mbd); 616 (IF_RTCD(&rtcd->common->recon), &x->e_mbd);
650 } 617 }
651 618
652 619
653 void vp8_encode_inter16x16uvrd(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) 620 void vp8_encode_inter16x16uvrd(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
654 { 621 {
655 vp8_build_inter_predictors_mbuv(&x->e_mbd); 622 vp8_build_inter_predictors_mbuv(&x->e_mbd);
656 ENCODEMB_INVOKE(&rtcd->encodemb, submbuv)(x->src_diff, x->src.u_buffer, x->s rc.v_buffer, x->e_mbd.predictor, x->src.uv_stride); 623 ENCODEMB_INVOKE(&rtcd->encodemb, submbuv)(x->src_diff, x->src.u_buffer, x->s rc.v_buffer, x->e_mbd.predictor, x->src.uv_stride);
657 624
658 vp8_transform_mbuv(x); 625 vp8_transform_mbuv(x);
659 626
660 vp8_quantize_mbuv(x); 627 vp8_quantize_mbuv(x);
661 628
662 } 629 }
OLDNEW
« no previous file with comments | « source/libvpx/vp8/encoder/encodemb.h ('k') | source/libvpx/vp8/encoder/encodemv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698