Skip to content
GitLab
Menu
Projects
Groups
Snippets
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
ce2c3372
Commit
ce2c3372
authored
Oct 24, 2013
by
James Zern
Browse files
vp9: add above/left_context to encoder
Change-Id: If5cea3d389bb1135ee490d273e57cc2c43325d01
parent
d72dfab2
Changes
3
Hide whitespace changes
Inline
Side-by-side
vp9/encoder/vp9_encodeframe.c
View file @
ce2c3372
...
...
@@ -499,7 +499,7 @@ static void set_offsets(VP9_COMP *cpi, int mi_row, int mi_col,
const
int
idx_map
=
mb_row
*
cm
->
mb_cols
+
mb_col
;
const
struct
segmentation
*
const
seg
=
&
cm
->
seg
;
set_skip_context
(
xd
,
c
m
->
above_context
,
c
m
->
left_context
,
mi_row
,
mi_col
);
set_skip_context
(
xd
,
c
pi
->
above_context
,
c
pi
->
left_context
,
mi_row
,
mi_col
);
// Activity map pointer
x
->
mb_activity_ptr
=
&
cpi
->
mb_activity_map
[
idx_map
];
...
...
@@ -711,7 +711,6 @@ static void restore_context(VP9_COMP *cpi, int mi_row, int mi_col,
ENTROPY_CONTEXT
l
[
16
*
MAX_MB_PLANE
],
PARTITION_CONTEXT
sa
[
8
],
PARTITION_CONTEXT
sl
[
8
],
BLOCK_SIZE
bsize
)
{
VP9_COMMON
*
const
cm
=
&
cpi
->
common
;
MACROBLOCK
*
const
x
=
&
cpi
->
mb
;
MACROBLOCKD
*
const
xd
=
&
x
->
e_mbd
;
int
p
;
...
...
@@ -721,12 +720,12 @@ static void restore_context(VP9_COMP *cpi, int mi_row, int mi_col,
int
mi_height
=
num_8x8_blocks_high_lookup
[
bsize
];
for
(
p
=
0
;
p
<
MAX_MB_PLANE
;
p
++
)
{
vpx_memcpy
(
c
m
->
above_context
[
p
]
+
((
mi_col
*
2
)
>>
xd
->
plane
[
p
].
subsampling_x
),
c
pi
->
above_context
[
p
]
+
((
mi_col
*
2
)
>>
xd
->
plane
[
p
].
subsampling_x
),
a
+
num_4x4_blocks_wide
*
p
,
(
sizeof
(
ENTROPY_CONTEXT
)
*
num_4x4_blocks_wide
)
>>
xd
->
plane
[
p
].
subsampling_x
);
vpx_memcpy
(
c
m
->
left_context
[
p
]
c
pi
->
left_context
[
p
]
+
((
mi_row
&
MI_MASK
)
*
2
>>
xd
->
plane
[
p
].
subsampling_y
),
l
+
num_4x4_blocks_high
*
p
,
(
sizeof
(
ENTROPY_CONTEXT
)
*
num_4x4_blocks_high
)
>>
...
...
@@ -742,7 +741,6 @@ static void save_context(VP9_COMP *cpi, int mi_row, int mi_col,
ENTROPY_CONTEXT
l
[
16
*
MAX_MB_PLANE
],
PARTITION_CONTEXT
sa
[
8
],
PARTITION_CONTEXT
sl
[
8
],
BLOCK_SIZE
bsize
)
{
const
VP9_COMMON
*
const
cm
=
&
cpi
->
common
;
const
MACROBLOCK
*
const
x
=
&
cpi
->
mb
;
const
MACROBLOCKD
*
const
xd
=
&
x
->
e_mbd
;
int
p
;
...
...
@@ -755,12 +753,12 @@ static void save_context(VP9_COMP *cpi, int mi_row, int mi_col,
for
(
p
=
0
;
p
<
MAX_MB_PLANE
;
++
p
)
{
vpx_memcpy
(
a
+
num_4x4_blocks_wide
*
p
,
c
m
->
above_context
[
p
]
+
(
mi_col
*
2
>>
xd
->
plane
[
p
].
subsampling_x
),
c
pi
->
above_context
[
p
]
+
(
mi_col
*
2
>>
xd
->
plane
[
p
].
subsampling_x
),
(
sizeof
(
ENTROPY_CONTEXT
)
*
num_4x4_blocks_wide
)
>>
xd
->
plane
[
p
].
subsampling_x
);
vpx_memcpy
(
l
+
num_4x4_blocks_high
*
p
,
c
m
->
left_context
[
p
]
c
pi
->
left_context
[
p
]
+
((
mi_row
&
MI_MASK
)
*
2
>>
xd
->
plane
[
p
].
subsampling_y
),
(
sizeof
(
ENTROPY_CONTEXT
)
*
num_4x4_blocks_high
)
>>
xd
->
plane
[
p
].
subsampling_y
);
...
...
@@ -1767,7 +1765,7 @@ static void encode_sb_row(VP9_COMP *cpi, int mi_row, TOKENEXTRA **tp,
int
mi_col
;
// Initialize the left context for the new SB row
vpx_memset
(
&
c
m
->
left_context
,
0
,
sizeof
(
c
m
->
left_context
));
vpx_memset
(
&
c
pi
->
left_context
,
0
,
sizeof
(
c
pi
->
left_context
));
vpx_memset
(
cpi
->
left_seg_context
,
0
,
sizeof
(
cpi
->
left_seg_context
));
// Code each SB in the row
...
...
@@ -1873,8 +1871,9 @@ static void init_encode_frame_mb_context(VP9_COMP *cpi) {
// Note: this memset assumes above_context[0], [1] and [2]
// are allocated as part of the same buffer.
vpx_memset
(
cm
->
above_context
[
0
],
0
,
sizeof
(
ENTROPY_CONTEXT
)
*
2
*
MAX_MB_PLANE
*
aligned_mi_cols
);
vpx_memset
(
cpi
->
above_context
[
0
],
0
,
sizeof
(
*
cpi
->
above_context
[
0
])
*
2
*
aligned_mi_cols
*
MAX_MB_PLANE
);
vpx_memset
(
cpi
->
above_seg_context
,
0
,
sizeof
(
*
cpi
->
above_seg_context
)
*
aligned_mi_cols
);
}
...
...
vp9/encoder/vp9_onyx_if.c
View file @
ce2c3372
...
...
@@ -313,6 +313,9 @@ static void dealloc_compressor_data(VP9_COMP *cpi) {
vpx_free
(
cpi
->
mb_norm_activity_map
);
cpi
->
mb_norm_activity_map
=
0
;
vpx_free
(
cpi
->
above_context
[
0
]);
cpi
->
above_context
[
0
]
=
NULL
;
vpx_free
(
cpi
->
above_seg_context
);
cpi
->
above_seg_context
=
NULL
;
}
...
...
@@ -1044,6 +1047,14 @@ void vp9_alloc_compressor_data(VP9_COMP *cpi) {
vpx_calloc
(
sizeof
(
unsigned
int
),
cm
->
mb_rows
*
cm
->
mb_cols
));
// 2 contexts per 'mi unit', so that we have one context per 4x4 txfm
// block where mi unit size is 8x8.
vpx_free
(
cpi
->
above_context
[
0
]);
CHECK_MEM_ERROR
(
cm
,
cpi
->
above_context
[
0
],
vpx_calloc
(
2
*
mi_cols_aligned_to_sb
(
cm
->
mi_cols
)
*
MAX_MB_PLANE
,
sizeof
(
*
cpi
->
above_context
[
0
])));
vpx_free
(
cpi
->
above_seg_context
);
CHECK_MEM_ERROR
(
cm
,
cpi
->
above_seg_context
,
vpx_calloc
(
mi_cols_aligned_to_sb
(
cm
->
mi_cols
),
...
...
@@ -1080,6 +1091,15 @@ static void update_frame_size(VP9_COMP *cpi) {
vp9_init_dsmotion_compensation
(
&
cpi
->
mb
,
y_stride
);
}
}
{
int
i
;
for
(
i
=
1
;
i
<
MAX_MB_PLANE
;
++
i
)
{
cpi
->
above_context
[
i
]
=
cpi
->
above_context
[
0
]
+
i
*
sizeof
(
*
cpi
->
above_context
[
0
])
*
2
*
mi_cols_aligned_to_sb
(
cm
->
mi_cols
);
}
}
}
...
...
vp9/encoder/vp9_onyx_int.h
View file @
ce2c3372
...
...
@@ -676,6 +676,10 @@ typedef struct VP9_COMP {
int64_t
mode_test_hits
[
BLOCK_SIZES
];
#endif
/* Y,U,V,(A) */
ENTROPY_CONTEXT
*
above_context
[
MAX_MB_PLANE
];
ENTROPY_CONTEXT
left_context
[
MAX_MB_PLANE
][
16
];
PARTITION_CONTEXT
*
above_seg_context
;
PARTITION_CONTEXT
left_seg_context
[
8
];
}
VP9_COMP
;
...
...
Write
Preview
Supports
Markdown
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