Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
aom-rav1e
Commits
9451e8d3
Commit
9451e8d3
authored
Aug 15, 2013
by
Dmitry Kovalev
Committed by
Gerrit Code Review
Aug 15, 2013
Browse files
Merge "Converting code from using ss_txfrm_size to tx_size."
parents
939b1e4a
bb3b817c
Changes
5
Hide whitespace changes
Inline
Side-by-side
vp9/common/vp9_blockd.h
View file @
9451e8d3
...
...
@@ -540,52 +540,55 @@ static int raster_block_offset(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize,
return
y
*
stride
+
x
;
}
static
int16_t
*
raster_block_offset_int16
(
MACROBLOCKD
*
xd
,
BLOCK_SIZE_TYPE
bsize
,
int
plane
,
int
block
,
int16_t
*
base
)
{
BLOCK_SIZE_TYPE
bsize
,
int
plane
,
int
block
,
int16_t
*
base
)
{
const
int
stride
=
plane_block_width
(
bsize
,
&
xd
->
plane
[
plane
]);
return
base
+
raster_block_offset
(
xd
,
bsize
,
plane
,
block
,
stride
);
}
static
uint8_t
*
raster_block_offset_uint8
(
MACROBLOCKD
*
xd
,
BLOCK_SIZE_TYPE
bsize
,
int
plane
,
int
block
,
uint8_t
*
base
,
int
stride
)
{
BLOCK_SIZE_TYPE
bsize
,
int
plane
,
int
block
,
uint8_t
*
base
,
int
stride
)
{
return
base
+
raster_block_offset
(
xd
,
bsize
,
plane
,
block
,
stride
);
}
static
int
txfrm_block_to_raster_block
(
MACROBLOCKD
*
xd
,
BLOCK_SIZE_TYPE
bsize
,
int
plane
,
int
block
,
int
ss_txfrm
_size
)
{
TX_SIZE
tx
_size
)
{
const
int
bwl
=
b_width_log2
(
bsize
)
-
xd
->
plane
[
plane
].
subsampling_x
;
const
int
txwl
=
ss_txfrm_size
>>
1
;
const
int
tx_cols_log2
=
bwl
-
tx
wl
;
const
int
ss_txfrm_size
=
tx_size
<<
1
;
const
int
tx_cols_log2
=
bwl
-
tx
_size
;
const
int
tx_cols
=
1
<<
tx_cols_log2
;
const
int
raster_mb
=
block
>>
ss_txfrm_size
;
const
int
x
=
(
raster_mb
&
(
tx_cols
-
1
))
<<
(
tx
wl
)
;
const
int
y
=
raster_mb
>>
tx_cols_log2
<<
(
tx
wl
)
;
const
int
x
=
(
raster_mb
&
(
tx_cols
-
1
))
<<
tx
_size
;
const
int
y
=
raster_mb
>>
tx_cols_log2
<<
tx
_size
;
return
x
+
(
y
<<
bwl
);
}
static
void
txfrm_block_to_raster_xy
(
MACROBLOCKD
*
xd
,
BLOCK_SIZE_TYPE
bsize
,
int
plane
,
int
block
,
int
ss_txfrm
_size
,
TX_SIZE
tx
_size
,
int
*
x
,
int
*
y
)
{
const
int
bwl
=
b_width_log2
(
bsize
)
-
xd
->
plane
[
plane
].
subsampling_x
;
const
int
txwl
=
ss_txfrm_size
>>
1
;
const
int
tx_cols_log2
=
bwl
-
tx
wl
;
const
int
ss_txfrm_size
=
tx_size
<<
1
;
const
int
tx_cols_log2
=
bwl
-
tx
_size
;
const
int
tx_cols
=
1
<<
tx_cols_log2
;
const
int
raster_mb
=
block
>>
ss_txfrm_size
;
*
x
=
(
raster_mb
&
(
tx_cols
-
1
))
<<
(
tx
wl
)
;
*
y
=
raster_mb
>>
tx_cols_log2
<<
(
tx
wl
)
;
*
x
=
(
raster_mb
&
(
tx_cols
-
1
))
<<
tx
_size
;
*
y
=
raster_mb
>>
tx_cols_log2
<<
tx
_size
;
}
static
void
extend_for_intra
(
MACROBLOCKD
*
const
xd
,
int
plane
,
int
block
,
BLOCK_SIZE_TYPE
bsize
,
int
ss_txfrm_size
)
{
const
int
bw
=
plane_block_width
(
bsize
,
&
xd
->
plane
[
plane
]);
const
int
bh
=
plane_block_height
(
bsize
,
&
xd
->
plane
[
plane
]);
static
void
extend_for_intra
(
MACROBLOCKD
*
const
xd
,
BLOCK_SIZE_TYPE
bsize
,
int
plane
,
int
block
,
TX_SIZE
tx_size
)
{
struct
macroblockd_plane
*
const
pd
=
&
xd
->
plane
[
plane
];
uint8_t
*
const
buf
=
pd
->
dst
.
buf
;
const
int
stride
=
pd
->
dst
.
stride
;
const
int
bw
=
plane_block_width
(
bsize
,
pd
);
const
int
bh
=
plane_block_height
(
bsize
,
pd
);
int
x
,
y
;
txfrm_block_to_raster_xy
(
xd
,
bsize
,
plane
,
block
,
ss_txfrm
_size
,
&
x
,
&
y
);
txfrm_block_to_raster_xy
(
xd
,
bsize
,
plane
,
block
,
tx
_size
,
&
x
,
&
y
);
x
=
x
*
4
-
1
;
y
=
y
*
4
-
1
;
// Copy a pixel into the umv if we are in a situation where the block size
...
...
@@ -593,29 +596,23 @@ static void extend_for_intra(MACROBLOCKD* const xd, int plane, int block,
// TODO(JBB): Should be able to do the full extend in place so we don't have
// to do this multiple times.
if
(
xd
->
mb_to_right_edge
<
0
)
{
int
umv_border_start
=
bw
+
(
xd
->
mb_to_right_edge
>>
(
3
+
x
d
->
plane
[
plane
].
subsampling_x
));
const
int
umv_border_start
=
bw
+
(
xd
->
mb_to_right_edge
>>
(
3
+
p
d
->
subsampling_x
));
if
(
x
+
bw
>
umv_border_start
)
vpx_memset
(
xd
->
plane
[
plane
].
dst
.
buf
+
y
*
xd
->
plane
[
plane
].
dst
.
stride
+
umv_border_start
,
*
(
xd
->
plane
[
plane
].
dst
.
buf
+
y
*
xd
->
plane
[
plane
].
dst
.
stride
+
umv_border_start
-
1
),
bw
);
vpx_memset
(
&
buf
[
y
*
stride
+
umv_border_start
],
buf
[
y
*
stride
+
umv_border_start
-
1
],
bw
);
}
if
(
xd
->
mb_to_bottom_edge
<
0
)
{
int
umv_border_start
=
bh
+
(
xd
->
mb_to_bottom_edge
>>
(
3
+
x
d
->
plane
[
plane
].
subsampling_y
));
const
int
umv_border_start
=
bh
+
(
xd
->
mb_to_bottom_edge
>>
(
3
+
p
d
->
subsampling_y
));
int
i
;
uint8_t
c
=
*
(
xd
->
plane
[
plane
].
dst
.
buf
+
(
umv_border_start
-
1
)
*
xd
->
plane
[
plane
].
dst
.
stride
+
x
);
uint8_t
*
d
=
xd
->
plane
[
plane
].
dst
.
buf
+
umv_border_start
*
xd
->
plane
[
plane
].
dst
.
stride
+
x
;
const
uint8_t
c
=
buf
[(
umv_border_start
-
1
)
*
stride
+
x
];
uint8_t
*
d
=
&
buf
[
umv_border_start
*
stride
+
x
];
if
(
y
+
bh
>
umv_border_start
)
for
(
i
=
0
;
i
<
bh
;
i
++
,
d
+=
xd
->
plane
[
plane
].
dst
.
stride
)
for
(
i
=
0
;
i
<
bh
;
++
i
,
d
+=
stride
)
*
d
=
c
;
}
}
...
...
vp9/decoder/vp9_decodframe.c
View file @
9451e8d3
...
...
@@ -90,17 +90,16 @@ static void init_dequantizer(VP9_COMMON *cm, MACROBLOCKD *xd) {
static
void
decode_block
(
int
plane
,
int
block
,
BLOCK_SIZE_TYPE
bsize
,
int
ss_txfrm_size
,
void
*
arg
)
{
MACROBLOCKD
*
const
xd
=
arg
;
struct
macroblockd_plane
*
pd
=
&
xd
->
plane
[
plane
];
struct
macroblockd_plane
*
const
pd
=
&
xd
->
plane
[
plane
];
int16_t
*
const
qcoeff
=
BLOCK_OFFSET
(
pd
->
qcoeff
,
block
);
const
int
stride
=
pd
->
dst
.
stride
;
const
int
eob
=
pd
->
eobs
[
block
];
const
TX_SIZE
tx_size
=
(
TX_SIZE
)(
ss_txfrm_size
>>
1
);
const
int
raster_block
=
txfrm_block_to_raster_block
(
xd
,
bsize
,
plane
,
block
,
ss_txfrm
_size
);
block
,
tx
_size
);
uint8_t
*
const
dst
=
raster_block_offset_uint8
(
xd
,
bsize
,
plane
,
raster_block
,
pd
->
dst
.
buf
,
stride
);
const
TX_SIZE
tx_size
=
(
TX_SIZE
)(
ss_txfrm_size
>>
1
);
switch
(
tx_size
)
{
case
TX_4X4
:
{
const
TX_TYPE
tx_type
=
get_tx_type_4x4
(
pd
->
plane_type
,
xd
,
raster_block
);
...
...
@@ -129,20 +128,18 @@ static void decode_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
static
void
decode_block_intra
(
int
plane
,
int
block
,
BLOCK_SIZE_TYPE
bsize
,
int
ss_txfrm_size
,
void
*
arg
)
{
MACROBLOCKD
*
const
xd
=
arg
;
struct
macroblockd_plane
*
pd
=
&
xd
->
plane
[
plane
];
struct
macroblockd_plane
*
const
pd
=
&
xd
->
plane
[
plane
];
MODE_INFO
*
const
mi
=
xd
->
mode_info_context
;
const
TX_SIZE
tx_size
=
(
TX_SIZE
)(
ss_txfrm_size
>>
1
);
const
int
raster_block
=
txfrm_block_to_raster_block
(
xd
,
bsize
,
plane
,
block
,
ss_txfrm
_size
);
block
,
tx
_size
);
uint8_t
*
const
dst
=
raster_block_offset_uint8
(
xd
,
bsize
,
plane
,
raster_block
,
pd
->
dst
.
buf
,
pd
->
dst
.
stride
);
const
TX_SIZE
tx_size
=
(
TX_SIZE
)(
ss_txfrm_size
>>
1
);
int
b_mode
;
int
plane_b_size
;
const
int
tx_ib
=
raster_block
>>
tx_size
;
const
int
mode
=
plane
==
0
?
mi
->
mbmi
.
mode
:
mi
->
mbmi
.
uv_mode
;
const
int
mode
=
(
plane
==
0
)
?
mi
->
mbmi
.
mode
:
mi
->
mbmi
.
uv_mode
;
if
(
plane
==
0
&&
mi
->
mbmi
.
sb_type
<
BLOCK_8X8
)
{
assert
(
bsize
==
BLOCK_8X8
);
...
...
@@ -152,7 +149,7 @@ static void decode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize,
}
if
(
xd
->
mb_to_right_edge
<
0
||
xd
->
mb_to_bottom_edge
<
0
)
extend_for_intra
(
xd
,
plane
,
block
,
bsize
,
ss_txfrm
_size
);
extend_for_intra
(
xd
,
bsize
,
plane
,
block
,
tx
_size
);
plane_b_size
=
b_width_log2
(
bsize
)
-
pd
->
subsampling_x
;
vp9_predict_intra_block
(
xd
,
tx_ib
,
plane_b_size
,
tx_size
,
b_mode
,
...
...
vp9/encoder/vp9_encodemb.c
View file @
9451e8d3
...
...
@@ -164,8 +164,7 @@ static void optimize_b(MACROBLOCK *mb,
const
int16_t
*
scan
,
*
nb
;
const
int
mul
=
1
+
(
tx_size
==
TX_32X32
);
uint8_t
token_cache
[
1024
];
const
int
ib
=
txfrm_block_to_raster_block
(
xd
,
bsize
,
plane
,
block
,
2
*
tx_size
);
const
int
ib
=
txfrm_block_to_raster_block
(
xd
,
bsize
,
plane
,
block
,
tx_size
);
const
int16_t
*
dequant_ptr
=
xd
->
plane
[
plane
].
dequant
;
const
uint8_t
*
band_translate
;
...
...
@@ -371,14 +370,12 @@ static void optimize_b(MACROBLOCK *mb,
}
void
vp9_optimize_b
(
int
plane
,
int
block
,
BLOCK_SIZE_TYPE
bsize
,
int
ss_txfrm_size
,
MACROBLOCK
*
mb
,
struct
optimize_ctx
*
ctx
)
{
TX_SIZE
tx_size
,
MACROBLOCK
*
mb
,
struct
optimize_ctx
*
ctx
)
{
MACROBLOCKD
*
const
xd
=
&
mb
->
e_mbd
;
const
TX_SIZE
tx_size
=
(
TX_SIZE
)(
ss_txfrm_size
>>
1
);
int
x
,
y
;
// find current entropy context
txfrm_block_to_raster_xy
(
xd
,
bsize
,
plane
,
block
,
ss_txfrm
_size
,
&
x
,
&
y
);
txfrm_block_to_raster_xy
(
xd
,
bsize
,
plane
,
block
,
tx
_size
,
&
x
,
&
y
);
optimize_b
(
mb
,
plane
,
block
,
bsize
,
&
ctx
->
ta
[
plane
][
x
],
&
ctx
->
tl
[
plane
][
y
],
tx_size
);
...
...
@@ -387,7 +384,7 @@ void vp9_optimize_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
static
void
optimize_block
(
int
plane
,
int
block
,
BLOCK_SIZE_TYPE
bsize
,
int
ss_txfrm_size
,
void
*
arg
)
{
const
struct
encode_b_args
*
const
args
=
arg
;
vp9_optimize_b
(
plane
,
block
,
bsize
,
ss_txfrm_size
,
args
->
x
,
args
->
ctx
);
vp9_optimize_b
(
plane
,
block
,
bsize
,
ss_txfrm_size
>>
1
,
args
->
x
,
args
->
ctx
);
}
void
optimize_init_b
(
int
plane
,
BLOCK_SIZE_TYPE
bsize
,
void
*
arg
)
{
...
...
@@ -528,19 +525,18 @@ static void encode_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
struct
encode_b_args
*
const
args
=
arg
;
MACROBLOCK
*
const
x
=
args
->
x
;
MACROBLOCKD
*
const
xd
=
&
x
->
e_mbd
;
const
TX_SIZE
tx_size
=
(
TX_SIZE
)(
ss_txfrm_size
>>
1
);
const
int
raster_block
=
txfrm_block_to_raster_block
(
xd
,
bsize
,
plane
,
block
,
ss_txfrm
_size
);
block
,
tx
_size
);
struct
macroblockd_plane
*
const
pd
=
&
xd
->
plane
[
plane
];
int16_t
*
const
dqcoeff
=
BLOCK_OFFSET
(
pd
->
dqcoeff
,
block
);
uint8_t
*
const
dst
=
raster_block_offset_uint8
(
xd
,
bsize
,
plane
,
raster_block
,
pd
->
dst
.
buf
,
pd
->
dst
.
stride
);
const
TX_SIZE
tx_size
=
(
TX_SIZE
)(
ss_txfrm_size
>>
1
);
xform_quant
(
plane
,
block
,
bsize
,
ss_txfrm_size
,
arg
);
if
(
x
->
optimize
)
vp9_optimize_b
(
plane
,
block
,
bsize
,
ss_txfrm
_size
,
x
,
args
->
ctx
);
vp9_optimize_b
(
plane
,
block
,
bsize
,
tx
_size
,
x
,
args
->
ctx
);
if
(
x
->
skip_encode
||
pd
->
eobs
[
block
]
==
0
)
return
;
...
...
@@ -650,12 +646,11 @@ void encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize,
uint16_t
*
eob
=
&
pd
->
eobs
[
block
];
if
(
xd
->
mb_to_right_edge
<
0
||
xd
->
mb_to_bottom_edge
<
0
)
{
extend_for_intra
(
xd
,
plane
,
block
,
bsize
,
ss_txfrm
_size
);
extend_for_intra
(
xd
,
bsize
,
plane
,
block
,
tx
_size
);
}
// if (x->optimize)
// vp9_optimize_b(plane, block, bsize, ss_txfrm_size,
// x, args->ctx);
// vp9_optimize_b(plane, block, bsize, tx_size, x, args->ctx);
switch
(
tx_size
)
{
case
TX_32X32
:
...
...
vp9/encoder/vp9_encodemb.h
View file @
9451e8d3
...
...
@@ -34,8 +34,7 @@ struct encode_b_args {
};
void
vp9_optimize_b
(
int
plane
,
int
block
,
BLOCK_SIZE_TYPE
bsize
,
int
ss_txfrm_size
,
MACROBLOCK
*
x
,
struct
optimize_ctx
*
ctx
);
TX_SIZE
tx_size
,
MACROBLOCK
*
x
,
struct
optimize_ctx
*
ctx
);
void
vp9_optimize_sby
(
VP9_COMMON
*
cm
,
MACROBLOCK
*
x
,
BLOCK_SIZE_TYPE
bsize
);
void
vp9_optimize_sbuv
(
VP9_COMMON
*
cm
,
MACROBLOCK
*
x
,
BLOCK_SIZE_TYPE
bsize
);
...
...
vp9/encoder/vp9_rdopt.c
View file @
9451e8d3
...
...
@@ -599,11 +599,10 @@ static void dist_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
static
void
rate_block
(
int
plane
,
int
block
,
BLOCK_SIZE_TYPE
bsize
,
int
ss_txfrm_size
,
void
*
arg
)
{
struct
rdcost_block_args
*
args
=
arg
;
MACROBLOCKD
*
const
xd
=
&
args
->
x
->
e_mbd
;
int
x_idx
,
y_idx
;
MACROBLOCKD
*
const
xd
=
&
args
->
x
->
e_mbd
;
txfrm_block_to_raster_xy
(
xd
,
bsize
,
plane
,
block
,
args
->
tx_size
*
2
,
&
x_idx
,
&
y_idx
);
txfrm_block_to_raster_xy
(
xd
,
bsize
,
plane
,
block
,
args
->
tx_size
,
&
x_idx
,
&
y_idx
);
args
->
rate
+=
cost_coeffs
(
args
->
x
,
plane
,
block
,
xd
->
plane
[
plane
].
plane_type
,
args
->
t_above
+
x_idx
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment