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

Side by Side Diff: source/libvpx/vp9/common/vp9_tapify.py

Issue 11555023: libvpx: Add VP9 decoder. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 8 years 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 """
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 """
10 #!/usr/bin/env python
11 import sys,string,os,re,math,numpy
12 scale = 2**16
13 def dist(p1,p2):
14 x1,y1 = p1
15 x2,y2 = p2
16 if x1==x2 and y1==y2 :
17 return 1.0
18 return 1/ math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
19
20 def gettaps(p):
21 def l(b):
22 return int(math.floor(b))
23 def h(b):
24 return int(math.ceil(b))
25 def t(b,p,s):
26 return int((scale*dist(b,p)+s/2)/s)
27 r,c = p
28 ul=[l(r),l(c)]
29 ur=[l(r),h(c)]
30 ll=[h(r),l(c)]
31 lr=[h(r),h(c)]
32 sum = dist(ul,p)+dist(ur,p)+dist(ll,p)+dist(lr,p)
33 t4 = scale - t(ul,p,sum) - t(ur,p,sum) - t(ll,p,sum);
34 return [[ul,t(ul,p,sum)],[ur,t(ur,p,sum)],
35 [ll,t(ll,p,sum)],[lr,t4]]
36
37 def print_mb_taps(angle,blocksize):
38 theta = angle / 57.2957795;
39 affine = [[math.cos(theta),-math.sin(theta)],
40 [math.sin(theta),math.cos(theta)]]
41 radius = (float(blocksize)-1)/2
42 print " // angle of",angle,"degrees"
43 for y in range(blocksize) :
44 for x in range(blocksize) :
45 r,c = numpy.dot(affine,[y-radius, x-radius])
46 tps = gettaps([r+radius,c+radius])
47 for t in tps :
48 p,t = t
49 tr,tc = p
50 print " %2d, %2d, %5d, " % (tr,tc,t,),
51 print " // %2d,%2d " % (y,x)
52
53 i=float(sys.argv[1])
54 while i <= float(sys.argv[2]) :
55 print_mb_taps(i,float(sys.argv[4]))
56 i=i+float(sys.argv[3])
57 """
58
59 taps = []
60 pt=dict()
61 ptr=dict()
62 for y in range(16) :
63 for x in range(16) :
64 r,c = numpy.dot(affine,[y-7.5, x-7.5])
65 tps = gettaps([r+7.5,c+7.5])
66 j=0
67 for tp in tps :
68 p,i = tp
69 r,c = p
70 pt[y,x,j]= [p,i]
71 try:
72 ptr[r,j,c].append([y,x])
73 except:
74 ptr[r,j,c]=[[y,x]]
75 j = j+1
76
77 for key in sorted(pt.keys()) :
78 print key,pt[key]
79
80 lr = -99
81 lj = -99
82 lc = 0
83
84 shuf=""
85 mask=""
86 for r,j,c in sorted(ptr.keys()) :
87 for y,x in ptr[r,j,c] :
88 if lr != r or lj != j :
89 print "shuf_"+str(lr)+"_"+str(lj)+"_"+shuf.ljust(16,"0"), lc
90 shuf=""
91 lc = 0
92 for i in range(lc,c-1) :
93 shuf = shuf +"0"
94 shuf = shuf + hex(x)[2]
95 lc =c
96 break
97 lr = r
98 lj = j
99 # print r,j,c,ptr[r,j,c]
100 # print
101
102 for r,j,c in sorted(ptr.keys()) :
103 for y,x in ptr[r,j,c] :
104 print r,j,c,y,x
105 break
106 """
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698