Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
aom-rav1e
Commits
54e66767
Commit
54e66767
authored
Mar 29, 2016
by
Adrian Grange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace "VPx" by "AVx"
Change-Id: If363eccaa8be7fb9f8cf41488bf3f5e6d4c00645
parent
5082a369
Changes
21
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
118 additions
and
118 deletions
+118
-118
aom/aom_encoder.h
aom/aom_encoder.h
+5
-5
aom/aomcx.h
aom/aomcx.h
+2
-2
aom_util/aom_thread.c
aom_util/aom_thread.c
+14
-14
aom_util/aom_thread.h
aom_util/aom_thread.h
+17
-17
av1/av1_dx_iface.c
av1/av1_dx_iface.c
+25
-25
av1/common/onyxc_int.h
av1/common/onyxc_int.h
+1
-1
av1/common/thread_common.c
av1/common/thread_common.c
+5
-5
av1/common/thread_common.h
av1/common/thread_common.h
+1
-1
av1/decoder/decodeframe.c
av1/decoder/decodeframe.c
+9
-9
av1/decoder/decoder.c
av1/decoder/decoder.c
+4
-4
av1/decoder/decoder.h
av1/decoder/decoder.h
+3
-3
av1/decoder/dthread.c
av1/decoder/dthread.c
+8
-8
av1/decoder/dthread.h
av1/decoder/dthread.h
+6
-6
av1/encoder/encoder.c
av1/encoder/encoder.c
+1
-1
av1/encoder/encoder.h
av1/encoder/encoder.h
+1
-1
av1/encoder/ethread.c
av1/encoder/ethread.c
+7
-7
build/make/iosbuild.sh
build/make/iosbuild.sh
+1
-1
examples/aom_temporal_svc_encoder.c
examples/aom_temporal_svc_encoder.c
+1
-1
examples/simple_decoder.c
examples/simple_decoder.c
+1
-1
libs.mk
libs.mk
+1
-1
test/ethread_test.cc
test/ethread_test.cc
+5
-5
No files found.
aom/aom_encoder.h
View file @
54e66767
...
...
@@ -406,7 +406,7 @@ typedef struct aom_codec_enc_cfg {
* trade-off is often acceptable, but for many applications is not. It can
* be disabled in these cases.
*
* Note that not all codecs support this feature. All aom V
P
x codecs do.
* Note that not all codecs support this feature. All aom
A
Vx codecs do.
* For other codecs, consult the documentation for that algorithm.
*
* This threshold is described as a percentage of the target data buffer.
...
...
@@ -842,11 +842,11 @@ aom_codec_err_t aom_codec_enc_config_set(aom_codec_ctx_t *ctx,
aom_fixed_buf_t
*
aom_codec_get_global_headers
(
aom_codec_ctx_t
*
ctx
);
#define AOM_DL_REALTIME (1)
/**< deadline parameter analogous to V
P
x REALTIME mode. */
/**< deadline parameter analogous to
A
Vx REALTIME mode. */
#define AOM_DL_GOOD_QUALITY (1000000)
/**< deadline parameter analogous to V
P
x GOOD QUALITY mode. */
/**< deadline parameter analogous to
A
Vx GOOD QUALITY mode. */
#define AOM_DL_BEST_QUALITY (0)
/**< deadline parameter analogous to V
P
x BEST QUALITY mode. */
/**< deadline parameter analogous to
A
Vx BEST QUALITY mode. */
/*!\brief Encode a frame
*
* Encodes a video frame at the given "presentation time." The presentation
...
...
@@ -858,7 +858,7 @@ aom_fixed_buf_t *aom_codec_get_global_headers(aom_codec_ctx_t *ctx);
* implicit that limiting the available time to encode will degrade the
* output quality. The encoder can be given an unlimited time to produce the
* best possible frame by specifying a deadline of '0'. This deadline
* supercedes the V
P
x notion of "best quality, good quality, realtime".
* supercedes the
A
Vx notion of "best quality, good quality, realtime".
* Applications that wish to map these former settings to the new deadline
* based system can use the symbols #AOM_DL_REALTIME, #AOM_DL_GOOD_QUALITY,
* and #AOM_DL_BEST_QUALITY.
...
...
aom/aomcx.h
View file @
54e66767
...
...
@@ -107,9 +107,9 @@ extern aom_codec_iface_t *aom_codec_av1_cx(void);
*/
#define AOM_EFLAG_NO_UPD_ENTROPY (1 << 20)
/*!\brief V
P
x encoder control functions
/*!\brief
A
Vx encoder control functions
*
* This set of macros define the control functions available for V
P
x
* This set of macros define the control functions available for
A
Vx
* encoder interface.
*
* \sa #aom_codec_control
...
...
aom_util/aom_thread.c
View file @
54e66767
...
...
@@ -22,7 +22,7 @@
#if CONFIG_MULTITHREAD
struct
V
P
xWorkerImpl
{
struct
A
VxWorkerImpl
{
pthread_mutex_t
mutex_
;
pthread_cond_t
condition_
;
pthread_t
thread_
;
...
...
@@ -30,10 +30,10 @@ struct VPxWorkerImpl {
//------------------------------------------------------------------------------
static
void
execute
(
V
P
xWorker
*
const
worker
);
// Forward declaration.
static
void
execute
(
A
VxWorker
*
const
worker
);
// Forward declaration.
static
THREADFN
thread_loop
(
void
*
ptr
)
{
V
P
xWorker
*
const
worker
=
(
V
P
xWorker
*
)
ptr
;
A
VxWorker
*
const
worker
=
(
A
VxWorker
*
)
ptr
;
int
done
=
0
;
while
(
!
done
)
{
pthread_mutex_lock
(
&
worker
->
impl_
->
mutex_
);
...
...
@@ -54,7 +54,7 @@ static THREADFN thread_loop(void *ptr) {
}
// main thread state control
static
void
change_state
(
V
P
xWorker
*
const
worker
,
V
P
xWorkerStatus
new_status
)
{
static
void
change_state
(
A
VxWorker
*
const
worker
,
A
VxWorkerStatus
new_status
)
{
// No-op when attempting to change state on a thread that didn't come up.
// Checking status_ without acquiring the lock first would result in a data
// race.
...
...
@@ -79,12 +79,12 @@ static void change_state(VPxWorker *const worker, VPxWorkerStatus new_status) {
//------------------------------------------------------------------------------
static
void
init
(
V
P
xWorker
*
const
worker
)
{
static
void
init
(
A
VxWorker
*
const
worker
)
{
memset
(
worker
,
0
,
sizeof
(
*
worker
));
worker
->
status_
=
NOT_OK
;
}
static
int
sync
(
V
P
xWorker
*
const
worker
)
{
static
int
sync
(
A
VxWorker
*
const
worker
)
{
#if CONFIG_MULTITHREAD
change_state
(
worker
,
OK
);
#endif
...
...
@@ -92,12 +92,12 @@ static int sync(VPxWorker *const worker) {
return
!
worker
->
had_error
;
}
static
int
reset
(
V
P
xWorker
*
const
worker
)
{
static
int
reset
(
A
VxWorker
*
const
worker
)
{
int
ok
=
1
;
worker
->
had_error
=
0
;
if
(
worker
->
status_
<
OK
)
{
#if CONFIG_MULTITHREAD
worker
->
impl_
=
(
V
P
xWorkerImpl
*
)
aom_calloc
(
1
,
sizeof
(
*
worker
->
impl_
));
worker
->
impl_
=
(
A
VxWorkerImpl
*
)
aom_calloc
(
1
,
sizeof
(
*
worker
->
impl_
));
if
(
worker
->
impl_
==
NULL
)
{
return
0
;
}
...
...
@@ -130,13 +130,13 @@ static int reset(VPxWorker *const worker) {
return
ok
;
}
static
void
execute
(
V
P
xWorker
*
const
worker
)
{
static
void
execute
(
A
VxWorker
*
const
worker
)
{
if
(
worker
->
hook
!=
NULL
)
{
worker
->
had_error
|=
!
worker
->
hook
(
worker
->
data1
,
worker
->
data2
);
}
}
static
void
launch
(
V
P
xWorker
*
const
worker
)
{
static
void
launch
(
A
VxWorker
*
const
worker
)
{
#if CONFIG_MULTITHREAD
change_state
(
worker
,
WORK
);
#else
...
...
@@ -144,7 +144,7 @@ static void launch(VPxWorker *const worker) {
#endif
}
static
void
end
(
V
P
xWorker
*
const
worker
)
{
static
void
end
(
A
VxWorker
*
const
worker
)
{
#if CONFIG_MULTITHREAD
if
(
worker
->
impl_
!=
NULL
)
{
change_state
(
worker
,
NOT_OK
);
...
...
@@ -163,10 +163,10 @@ static void end(VPxWorker *const worker) {
//------------------------------------------------------------------------------
static
V
P
xWorkerInterface
g_worker_interface
=
{
init
,
reset
,
sync
,
static
A
VxWorkerInterface
g_worker_interface
=
{
init
,
reset
,
sync
,
launch
,
execute
,
end
};
int
aom_set_worker_interface
(
const
V
P
xWorkerInterface
*
const
winterface
)
{
int
aom_set_worker_interface
(
const
A
VxWorkerInterface
*
const
winterface
)
{
if
(
winterface
==
NULL
||
winterface
->
init
==
NULL
||
winterface
->
reset
==
NULL
||
winterface
->
sync
==
NULL
||
winterface
->
launch
==
NULL
||
winterface
->
execute
==
NULL
||
...
...
@@ -177,7 +177,7 @@ int aom_set_worker_interface(const VPxWorkerInterface *const winterface) {
return
1
;
}
const
V
P
xWorkerInterface
*
aom_get_worker_interface
(
void
)
{
const
A
VxWorkerInterface
*
aom_get_worker_interface
(
void
)
{
return
&
g_worker_interface
;
}
...
...
aom_util/aom_thread.h
View file @
54e66767
...
...
@@ -158,59 +158,59 @@ typedef enum {
NOT_OK
=
0
,
// object is unusable
OK
,
// ready to work
WORK
// busy finishing the current task
}
V
P
xWorkerStatus
;
}
A
VxWorkerStatus
;
// Function to be called by the worker thread. Takes two opaque pointers as
// arguments (data1 and data2), and should return false in case of error.
typedef
int
(
*
V
P
xWorkerHook
)(
void
*
,
void
*
);
typedef
int
(
*
A
VxWorkerHook
)(
void
*
,
void
*
);
// Platform-dependent implementation details for the worker.
typedef
struct
V
P
xWorkerImpl
V
P
xWorkerImpl
;
typedef
struct
A
VxWorkerImpl
A
VxWorkerImpl
;
// Synchronization object used to launch job in the worker thread
typedef
struct
{
V
P
xWorkerImpl
*
impl_
;
V
P
xWorkerStatus
status_
;
V
P
xWorkerHook
hook
;
// hook to call
A
VxWorkerImpl
*
impl_
;
A
VxWorkerStatus
status_
;
A
VxWorkerHook
hook
;
// hook to call
void
*
data1
;
// first argument passed to 'hook'
void
*
data2
;
// second argument passed to 'hook'
int
had_error
;
// return value of the last call to 'hook'
}
V
P
xWorker
;
}
A
VxWorker
;
// The interface for all thread-worker related functions. All these functions
// must be implemented.
typedef
struct
{
// Must be called first, before any other method.
void
(
*
init
)(
V
P
xWorker
*
const
worker
);
void
(
*
init
)(
A
VxWorker
*
const
worker
);
// Must be called to initialize the object and spawn the thread. Re-entrant.
// Will potentially launch the thread. Returns false in case of error.
int
(
*
reset
)(
V
P
xWorker
*
const
worker
);
int
(
*
reset
)(
A
VxWorker
*
const
worker
);
// Makes sure the previous work is finished. Returns true if worker->had_error
// was not set and no error condition was triggered by the working thread.
int
(
*
sync
)(
V
P
xWorker
*
const
worker
);
int
(
*
sync
)(
A
VxWorker
*
const
worker
);
// Triggers the thread to call hook() with data1 and data2 arguments. These
// hook/data1/data2 values can be changed at any time before calling this
// function, but not be changed afterward until the next call to Sync().
void
(
*
launch
)(
V
P
xWorker
*
const
worker
);
void
(
*
launch
)(
A
VxWorker
*
const
worker
);
// This function is similar to launch() except that it calls the
// hook directly instead of using a thread. Convenient to bypass the thread
// mechanism while still using the V
P
xWorker structs. sync() must
// mechanism while still using the
A
VxWorker structs. sync() must
// still be called afterward (for error reporting).
void
(
*
execute
)(
V
P
xWorker
*
const
worker
);
void
(
*
execute
)(
A
VxWorker
*
const
worker
);
// Kill the thread and terminate the object. To use the object again, one
// must call reset() again.
void
(
*
end
)(
V
P
xWorker
*
const
worker
);
}
V
P
xWorkerInterface
;
void
(
*
end
)(
A
VxWorker
*
const
worker
);
}
A
VxWorkerInterface
;
// Install a new set of threading functions, overriding the defaults. This
// should be done before any workers are started, i.e., before any encoding or
// decoding takes place. The contents of the interface struct are copied, it
// is safe to free the corresponding memory after this call. This function is
// not thread-safe. Return false in case of invalid pointer or methods.
int
aom_set_worker_interface
(
const
V
P
xWorkerInterface
*
const
winterface
);
int
aom_set_worker_interface
(
const
A
VxWorkerInterface
*
const
winterface
);
// Retrieve the currently set thread worker interface.
const
V
P
xWorkerInterface
*
aom_get_worker_interface
(
void
);
const
A
VxWorkerInterface
*
aom_get_worker_interface
(
void
);
//------------------------------------------------------------------------------
...
...
av1/av1_dx_iface.c
View file @
54e66767
...
...
@@ -59,7 +59,7 @@ struct aom_codec_alg_priv {
// Frame parallel related.
int
frame_parallel_decode
;
// frame-based threading.
V
P
xWorker
*
frame_workers
;
A
VxWorker
*
frame_workers
;
int
num_frame_workers
;
int
next_submit_worker_id
;
int
last_submit_worker_id
;
...
...
@@ -114,7 +114,7 @@ static aom_codec_err_t decoder_destroy(aom_codec_alg_priv_t *ctx) {
if
(
ctx
->
frame_workers
!=
NULL
)
{
int
i
;
for
(
i
=
0
;
i
<
ctx
->
num_frame_workers
;
++
i
)
{
V
P
xWorker
*
const
worker
=
&
ctx
->
frame_workers
[
i
];
A
VxWorker
*
const
worker
=
&
ctx
->
frame_workers
[
i
];
FrameWorkerData
*
const
frame_worker_data
=
(
FrameWorkerData
*
)
worker
->
data1
;
aom_get_worker_interface
()
->
end
(
worker
);
...
...
@@ -267,7 +267,7 @@ static void init_buffer_callbacks(aom_codec_alg_priv_t *ctx) {
int
i
;
for
(
i
=
0
;
i
<
ctx
->
num_frame_workers
;
++
i
)
{
V
P
xWorker
*
const
worker
=
&
ctx
->
frame_workers
[
i
];
A
VxWorker
*
const
worker
=
&
ctx
->
frame_workers
[
i
];
FrameWorkerData
*
const
frame_worker_data
=
(
FrameWorkerData
*
)
worker
->
data1
;
AV1_COMMON
*
const
cm
=
&
frame_worker_data
->
pbi
->
common
;
BufferPool
*
const
pool
=
cm
->
buffer_pool
;
...
...
@@ -313,7 +313,7 @@ static int frame_worker_hook(void *arg1, void *arg2) {
// the compressed data.
if
(
frame_worker_data
->
result
!=
0
||
frame_worker_data
->
data
+
frame_worker_data
->
data_size
-
1
>
data
)
{
V
P
xWorker
*
const
worker
=
frame_worker_data
->
pbi
->
frame_worker_owner
;
A
VxWorker
*
const
worker
=
frame_worker_data
->
pbi
->
frame_worker_owner
;
BufferPool
*
const
pool
=
frame_worker_data
->
pbi
->
common
.
buffer_pool
;
// Signal all the other threads that are waiting for this frame.
av1_frameworker_lock_stats
(
worker
);
...
...
@@ -336,7 +336,7 @@ static int frame_worker_hook(void *arg1, void *arg2) {
static
aom_codec_err_t
init_decoder
(
aom_codec_alg_priv_t
*
ctx
)
{
int
i
;
const
V
P
xWorkerInterface
*
const
winterface
=
aom_get_worker_interface
();
const
A
VxWorkerInterface
*
const
winterface
=
aom_get_worker_interface
();
ctx
->
last_show_frame
=
-
1
;
ctx
->
next_submit_worker_id
=
0
;
...
...
@@ -363,7 +363,7 @@ static aom_codec_err_t init_decoder(aom_codec_alg_priv_t *ctx) {
}
#endif
ctx
->
frame_workers
=
(
V
P
xWorker
*
)
aom_malloc
(
ctx
->
num_frame_workers
*
ctx
->
frame_workers
=
(
A
VxWorker
*
)
aom_malloc
(
ctx
->
num_frame_workers
*
sizeof
(
*
ctx
->
frame_workers
));
if
(
ctx
->
frame_workers
==
NULL
)
{
set_error_detail
(
ctx
,
"Failed to allocate frame_workers"
);
...
...
@@ -371,7 +371,7 @@ static aom_codec_err_t init_decoder(aom_codec_alg_priv_t *ctx) {
}
for
(
i
=
0
;
i
<
ctx
->
num_frame_workers
;
++
i
)
{
V
P
xWorker
*
const
worker
=
&
ctx
->
frame_workers
[
i
];
A
VxWorker
*
const
worker
=
&
ctx
->
frame_workers
[
i
];
FrameWorkerData
*
frame_worker_data
=
NULL
;
winterface
->
init
(
worker
);
worker
->
data1
=
aom_memalign
(
32
,
sizeof
(
FrameWorkerData
));
...
...
@@ -410,7 +410,7 @@ static aom_codec_err_t init_decoder(aom_codec_alg_priv_t *ctx) {
frame_worker_data
->
pbi
->
inv_tile_order
=
ctx
->
invert_tile_order
;
frame_worker_data
->
pbi
->
common
.
frame_parallel_decode
=
ctx
->
frame_parallel_decode
;
worker
->
hook
=
(
V
P
xWorkerHook
)
frame_worker_hook
;
worker
->
hook
=
(
A
VxWorkerHook
)
frame_worker_hook
;
if
(
!
winterface
->
reset
(
worker
))
{
set_error_detail
(
ctx
,
"Frame Worker thread creation failed"
);
return
AOM_CODEC_MEM_ERROR
;
...
...
@@ -438,7 +438,7 @@ static INLINE void check_resync(aom_codec_alg_priv_t *const ctx,
static
aom_codec_err_t
decode_one
(
aom_codec_alg_priv_t
*
ctx
,
const
uint8_t
**
data
,
unsigned
int
data_sz
,
void
*
user_priv
,
int64_t
deadline
)
{
const
V
P
xWorkerInterface
*
const
winterface
=
aom_get_worker_interface
();
const
A
VxWorkerInterface
*
const
winterface
=
aom_get_worker_interface
();
(
void
)
deadline
;
// Determine the stream parameters. Note that we rely on peek_si to
...
...
@@ -455,7 +455,7 @@ static aom_codec_err_t decode_one(aom_codec_alg_priv_t *ctx,
}
if
(
!
ctx
->
frame_parallel_decode
)
{
V
P
xWorker
*
const
worker
=
ctx
->
frame_workers
;
A
VxWorker
*
const
worker
=
ctx
->
frame_workers
;
FrameWorkerData
*
const
frame_worker_data
=
(
FrameWorkerData
*
)
worker
->
data1
;
frame_worker_data
->
data
=
*
data
;
frame_worker_data
->
data_size
=
data_sz
;
...
...
@@ -478,7 +478,7 @@ static aom_codec_err_t decode_one(aom_codec_alg_priv_t *ctx,
check_resync
(
ctx
,
frame_worker_data
->
pbi
);
}
else
{
V
P
xWorker
*
const
worker
=
&
ctx
->
frame_workers
[
ctx
->
next_submit_worker_id
];
A
VxWorker
*
const
worker
=
&
ctx
->
frame_workers
[
ctx
->
next_submit_worker_id
];
FrameWorkerData
*
const
frame_worker_data
=
(
FrameWorkerData
*
)
worker
->
data1
;
// Copy context from last worker thread to next worker thread.
if
(
ctx
->
next_submit_worker_id
!=
ctx
->
last_submit_worker_id
)
...
...
@@ -525,8 +525,8 @@ static aom_codec_err_t decode_one(aom_codec_alg_priv_t *ctx,
static
void
wait_worker_and_cache_frame
(
aom_codec_alg_priv_t
*
ctx
)
{
YV12_BUFFER_CONFIG
sd
;
const
V
P
xWorkerInterface
*
const
winterface
=
aom_get_worker_interface
();
V
P
xWorker
*
const
worker
=
&
ctx
->
frame_workers
[
ctx
->
next_output_worker_id
];
const
A
VxWorkerInterface
*
const
winterface
=
aom_get_worker_interface
();
A
VxWorker
*
const
worker
=
&
ctx
->
frame_workers
[
ctx
->
next_output_worker_id
];
FrameWorkerData
*
const
frame_worker_data
=
(
FrameWorkerData
*
)
worker
->
data1
;
ctx
->
next_output_worker_id
=
(
ctx
->
next_output_worker_id
+
1
)
%
ctx
->
num_frame_workers
;
...
...
@@ -707,8 +707,8 @@ static aom_image_t *decoder_get_frame(aom_codec_alg_priv_t *ctx,
if
(
*
iter
==
NULL
&&
ctx
->
frame_workers
!=
NULL
)
{
do
{
YV12_BUFFER_CONFIG
sd
;
const
V
P
xWorkerInterface
*
const
winterface
=
aom_get_worker_interface
();
V
P
xWorker
*
const
worker
=
&
ctx
->
frame_workers
[
ctx
->
next_output_worker_id
];
const
A
VxWorkerInterface
*
const
winterface
=
aom_get_worker_interface
();
A
VxWorker
*
const
worker
=
&
ctx
->
frame_workers
[
ctx
->
next_output_worker_id
];
FrameWorkerData
*
const
frame_worker_data
=
(
FrameWorkerData
*
)
worker
->
data1
;
ctx
->
next_output_worker_id
=
...
...
@@ -774,7 +774,7 @@ static aom_codec_err_t ctrl_set_reference(aom_codec_alg_priv_t *ctx,
if
(
data
)
{
aom_ref_frame_t
*
const
frame
=
(
aom_ref_frame_t
*
)
data
;
YV12_BUFFER_CONFIG
sd
;
V
P
xWorker
*
const
worker
=
ctx
->
frame_workers
;
A
VxWorker
*
const
worker
=
ctx
->
frame_workers
;
FrameWorkerData
*
const
frame_worker_data
=
(
FrameWorkerData
*
)
worker
->
data1
;
image2yuvconfig
(
&
frame
->
img
,
&
sd
);
return
av1_set_reference_dec
(
&
frame_worker_data
->
pbi
->
common
,
...
...
@@ -797,7 +797,7 @@ static aom_codec_err_t ctrl_copy_reference(aom_codec_alg_priv_t *ctx,
if
(
data
)
{
aom_ref_frame_t
*
frame
=
(
aom_ref_frame_t
*
)
data
;
YV12_BUFFER_CONFIG
sd
;
V
P
xWorker
*
const
worker
=
ctx
->
frame_workers
;
A
VxWorker
*
const
worker
=
ctx
->
frame_workers
;
FrameWorkerData
*
const
frame_worker_data
=
(
FrameWorkerData
*
)
worker
->
data1
;
image2yuvconfig
(
&
frame
->
img
,
&
sd
);
return
av1_copy_reference_dec
(
frame_worker_data
->
pbi
,
...
...
@@ -819,7 +819,7 @@ static aom_codec_err_t ctrl_get_reference(aom_codec_alg_priv_t *ctx,
if
(
data
)
{
YV12_BUFFER_CONFIG
*
fb
;
V
P
xWorker
*
const
worker
=
ctx
->
frame_workers
;
A
VxWorker
*
const
worker
=
ctx
->
frame_workers
;
FrameWorkerData
*
const
frame_worker_data
=
(
FrameWorkerData
*
)
worker
->
data1
;
fb
=
get_ref_frame
(
&
frame_worker_data
->
pbi
->
common
,
data
->
idx
);
if
(
fb
==
NULL
)
return
AOM_CODEC_ERROR
;
...
...
@@ -856,7 +856,7 @@ static aom_codec_err_t ctrl_get_last_ref_updates(aom_codec_alg_priv_t *ctx,
if
(
update_info
)
{
if
(
ctx
->
frame_workers
)
{
V
P
xWorker
*
const
worker
=
ctx
->
frame_workers
;
A
VxWorker
*
const
worker
=
ctx
->
frame_workers
;
FrameWorkerData
*
const
frame_worker_data
=
(
FrameWorkerData
*
)
worker
->
data1
;
*
update_info
=
frame_worker_data
->
pbi
->
refresh_frame_flags
;
...
...
@@ -875,7 +875,7 @@ static aom_codec_err_t ctrl_get_frame_corrupted(aom_codec_alg_priv_t *ctx,
if
(
corrupted
)
{
if
(
ctx
->
frame_workers
)
{
V
P
xWorker
*
const
worker
=
ctx
->
frame_workers
;
A
VxWorker
*
const
worker
=
ctx
->
frame_workers
;
FrameWorkerData
*
const
frame_worker_data
=
(
FrameWorkerData
*
)
worker
->
data1
;
RefCntBuffer
*
const
frame_bufs
=
...
...
@@ -905,7 +905,7 @@ static aom_codec_err_t ctrl_get_frame_size(aom_codec_alg_priv_t *ctx,
if
(
frame_size
)
{
if
(
ctx
->
frame_workers
)
{
V
P
xWorker
*
const
worker
=
ctx
->
frame_workers
;
A
VxWorker
*
const
worker
=
ctx
->
frame_workers
;
FrameWorkerData
*
const
frame_worker_data
=
(
FrameWorkerData
*
)
worker
->
data1
;
const
AV1_COMMON
*
const
cm
=
&
frame_worker_data
->
pbi
->
common
;
...
...
@@ -932,7 +932,7 @@ static aom_codec_err_t ctrl_get_render_size(aom_codec_alg_priv_t *ctx,
if
(
render_size
)
{
if
(
ctx
->
frame_workers
)
{
V
P
xWorker
*
const
worker
=
ctx
->
frame_workers
;
A
VxWorker
*
const
worker
=
ctx
->
frame_workers
;
FrameWorkerData
*
const
frame_worker_data
=
(
FrameWorkerData
*
)
worker
->
data1
;
const
AV1_COMMON
*
const
cm
=
&
frame_worker_data
->
pbi
->
common
;
...
...
@@ -950,7 +950,7 @@ static aom_codec_err_t ctrl_get_render_size(aom_codec_alg_priv_t *ctx,
static
aom_codec_err_t
ctrl_get_bit_depth
(
aom_codec_alg_priv_t
*
ctx
,
va_list
args
)
{
unsigned
int
*
const
bit_depth
=
va_arg
(
args
,
unsigned
int
*
);
V
P
xWorker
*
const
worker
=
&
ctx
->
frame_workers
[
ctx
->
next_output_worker_id
];
A
VxWorker
*
const
worker
=
&
ctx
->
frame_workers
[
ctx
->
next_output_worker_id
];
if
(
bit_depth
)
{
if
(
worker
)
{
...
...
@@ -996,7 +996,7 @@ static aom_codec_err_t ctrl_set_byte_alignment(aom_codec_alg_priv_t *ctx,
ctx
->
byte_alignment
=
byte_alignment
;
if
(
ctx
->
frame_workers
)
{
V
P
xWorker
*
const
worker
=
ctx
->
frame_workers
;
A
VxWorker
*
const
worker
=
ctx
->
frame_workers
;
FrameWorkerData
*
const
frame_worker_data
=
(
FrameWorkerData
*
)
worker
->
data1
;
frame_worker_data
->
pbi
->
common
.
byte_alignment
=
byte_alignment
;
}
...
...
@@ -1008,7 +1008,7 @@ static aom_codec_err_t ctrl_set_skip_loop_filter(aom_codec_alg_priv_t *ctx,
ctx
->
skip_loop_filter
=
va_arg
(
args
,
int
);
if
(
ctx
->
frame_workers
)
{
V
P
xWorker
*
const
worker
=
ctx
->
frame_workers
;
A
VxWorker
*
const
worker
=
ctx
->
frame_workers
;
FrameWorkerData
*
const
frame_worker_data
=
(
FrameWorkerData
*
)
worker
->
data1
;
frame_worker_data
->
pbi
->
common
.
skip_loop_filter
=
ctx
->
skip_loop_filter
;
}
...
...
av1/common/onyxc_int.h
View file @
54e66767
...
...
@@ -93,7 +93,7 @@ typedef struct {
// frame_worker_owner indicates which FrameWorker owns this buffer. NULL means
// that no FrameWorker owns, or is decoding, this buffer.
V
P
xWorker
*
frame_worker_owner
;
A
VxWorker
*
frame_worker_owner
;
// row and col indicate which position frame has been decoded to in real
// pixel unit. They are reset to -1 when decoding begins and set to INT_MAX
...
...
av1/common/thread_common.c
View file @
54e66767
...
...
@@ -153,9 +153,9 @@ static int loop_filter_row_worker(AV1LfSync *const lf_sync,
static
void
loop_filter_rows_mt
(
YV12_BUFFER_CONFIG
*
frame
,
AV1_COMMON
*
cm
,
struct
macroblockd_plane
planes
[
MAX_MB_PLANE
],
int
start
,
int
stop
,
int
y_only
,
V
P
xWorker
*
workers
,
int
nworkers
,
A
VxWorker
*
workers
,
int
nworkers
,
AV1LfSync
*
lf_sync
)
{
const
V
P
xWorkerInterface
*
const
winterface
=
aom_get_worker_interface
();
const
A
VxWorkerInterface
*
const
winterface
=
aom_get_worker_interface
();
// Number of superblock rows and cols
const
int
sb_rows
=
mi_cols_aligned_to_sb
(
cm
->
mi_rows
)
>>
MI_BLOCK_SIZE_LOG2
;
// Decoder may allocate more threads than number of tiles based on user's
...
...
@@ -182,10 +182,10 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
// because of contention. If the multithreading code changes in the future
// then the number of workers used by the loopfilter should be revisited.
for
(
i
=
0
;
i
<
num_workers
;
++
i
)
{
V
P
xWorker
*
const
worker
=
&
workers
[
i
];
A
VxWorker
*
const
worker
=
&
workers
[
i
];
LFWorkerData
*
const
lf_data
=
&
lf_sync
->
lfdata
[
i
];
worker
->
hook
=
(
V
P
xWorkerHook
)
loop_filter_row_worker
;
worker
->
hook
=
(
A
VxWorkerHook
)
loop_filter_row_worker
;
worker
->
data1
=
lf_sync
;
worker
->
data2
=
lf_data
;
...
...
@@ -212,7 +212,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
void
av1_loop_filter_frame_mt
(
YV12_BUFFER_CONFIG
*
frame
,
AV1_COMMON
*
cm
,
struct
macroblockd_plane
planes
[
MAX_MB_PLANE
],
int
frame_filter_level
,
int
y_only
,
int
partial_frame
,
V
P
xWorker
*
workers
,
int
partial_frame
,
A
VxWorker
*
workers
,
int
num_workers
,
AV1LfSync
*
lf_sync
)
{
int
start_mi_row
,
end_mi_row
,
mi_rows_to_filter
;
...
...
av1/common/thread_common.h
View file @
54e66767
...
...
@@ -51,7 +51,7 @@ void av1_loop_filter_dealloc(AV1LfSync *lf_sync);
void
av1_loop_filter_frame_mt
(
YV12_BUFFER_CONFIG
*
frame
,
struct
AV1Common
*
cm
,
struct
macroblockd_plane
planes
[
MAX_MB_PLANE
],
int
frame_filter_level
,
int
y_only
,
int
partial_frame
,
V
P
xWorker
*
workers
,
int
partial_frame
,
A
VxWorker
*
workers
,
int
num_workers
,
AV1LfSync
*
lf_sync
);
void
av1_accumulate_frame_counts
(
struct
AV1Common
*
cm
,
...
...
av1/decoder/decodeframe.c
View file @
54e66767
...
...
@@ -1491,7 +1491,7 @@ static void get_tile_buffers(AV1Decoder *pbi, const uint8_t *data,
static
const
uint8_t
*
decode_tiles
(
AV1Decoder
*
pbi
,
const
uint8_t
*
data
,
const
uint8_t
*
data_end
)
{
AV1_COMMON
*
const
cm
=
&
pbi
->
common
;
const
V
P
xWorkerInterface
*
const
winterface
=
aom_get_worker_interface
();
const
A
VxWorkerInterface
*
const
winterface
=
aom_get_worker_interface
();
const
int
aligned_cols
=
mi_cols_aligned_to_sb
(
cm
->
mi_cols
);
const
int
tile_cols
=
1
<<
cm
->
log2_tile_cols
;
const
int
tile_rows
=
1
<<
cm
->
log2_tile_rows
;
...
...
@@ -1504,7 +1504,7 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
pbi
->
lf_worker
.
data1
==
NULL
)
{
CHECK_MEM_ERROR
(
cm
,
pbi
->
lf_worker
.
data1
,
aom_memalign
(
32
,
sizeof
(
LFWorkerData
)));
pbi
->
lf_worker
.
hook
=
(
V
P
xWorkerHook
)
av1_loop_filter_worker
;
pbi
->
lf_worker
.
hook
=
(
A
VxWorkerHook
)
av1_loop_filter_worker
;
if
(
pbi
->
max_threads
>
1
&&
!
winterface
->
reset
(
&
pbi
->
lf_worker
))
{
aom_internal_error
(
&
cm
->
error
,
AOM_CODEC_ERROR
,
"Loop filter thread creation failed"
);
...
...
@@ -1675,7 +1675,7 @@ static int compare_tile_buffers(const void *a, const void *b) {
static
const
uint8_t
*
decode_tiles_mt
(
AV1Decoder
*
pbi
,
const
uint8_t
*
data
,
const
uint8_t
*
data_end
)
{
AV1_COMMON
*
const
cm
=
&
pbi
->
common
;
const
V
P
xWorkerInterface
*
const
winterface
=
aom_get_worker_interface
();
const
A
VxWorkerInterface
*
const
winterface
=
aom_get_worker_interface
();
const
uint8_t
*
bit_reader_end
=
NULL
;
const
int
aligned_mi_cols
=
mi_cols_aligned_to_sb
(
cm
->
mi_cols
);
const
int
tile_cols
=
1
<<
cm
->
log2_tile_cols
;
...
...
@@ -1705,7 +1705,7 @@ static const uint8_t *decode_tiles_mt(AV1Decoder *pbi, const uint8_t *data,
CHECK_MEM_ERROR
(
cm
,
pbi
->
tile_worker_info
,
aom_malloc
(
num_threads
*
sizeof
(
*
pbi
->
tile_worker_info
)));
for
(
i
=
0
;
i
<
num_threads
;
++
i
)
{
V
P
xWorker
*
const
worker
=
&
pbi
->
tile_workers
[
i
];
A
VxWorker
*
const
worker
=
&
pbi
->
tile_workers
[
i
];
++
pbi
->
num_tile_workers
;
winterface
->
init
(
worker
);
...
...
@@ -1718,9 +1718,9 @@ static const uint8_t *decode_tiles_mt(AV1Decoder *pbi, const uint8_t *data,
// Reset tile decoding hook
for
(
n
=
0
;
n
<
num_workers
;
++
n
)
{
V
P
xWorker
*
const
worker
=
&
pbi
->
tile_workers
[
n
];
A
VxWorker
*
const
worker
=
&
pbi
->
tile_workers
[
n
];
winterface
->
sync
(
worker
);
worker
->
hook
=
(
V
P
xWorkerHook
)
tile_worker_hook
;
worker
->
hook
=
(
A
VxWorkerHook
)
tile_worker_hook
;
worker
->
data1
=
&
pbi
->
tile_worker_data
[
n
];
worker
->
data2
=
&
pbi
->
tile_worker_info
[
n
];
}
...
...
@@ -1770,7 +1770,7 @@ static const uint8_t *decode_tiles_mt(AV1Decoder *pbi, const uint8_t *data,
while
(
n
<
tile_cols
)
{
int
i
;
for
(
i
=
0
;
i
<
num_workers
&&
n
<
tile_cols
;
++
i
)
{
V
P
xWorker
*
const
worker
=
&
pbi
->
tile_workers
[
i
];
A
VxWorker
*
const
worker
=
&
pbi
->
tile_workers
[
i
];
TileWorkerData
*
const
tile_data
=
(
TileWorkerData
*
)
worker
->
data1
;
TileInfo
*
const
tile
=
(
TileInfo
*
)
worker
->
data2
;
TileBuffer
*
const
buf
=
&
tile_buffers
[
0
][
n
];
...
...
@@ -1807,7 +1807,7 @@ static const uint8_t *decode_tiles_mt(AV1Decoder *pbi, const uint8_t *data,
}
for
(;
i
>
0
;
--
i
)
{
V
P
xWorker
*
const
worker
=
&
pbi
->
tile_workers
[
i
-
1
];
A
VxWorker
*
const
worker
=
&
pbi
->
tile_workers
[
i
-
1
];
// TODO(jzern): The tile may have specific error data associated with
// its aom_internal_error_info which could be propagated to the main info
// in cm. Additionally once the threads have been synced and an error is
...
...
@@ -2389,7 +2389,7 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
// the frame header.
if
(
cm
->
frame_parallel_decode
&&
cm
->
refresh_frame_context
!=
REFRESH_FRAME_CONTEXT_BACKWARD
)
{
V
P
xWorker
*
const
worker
=
pbi
->
frame_worker_owner
;
A
VxWorker
*
const
worker
=
pbi
->
frame_worker_owner
;
FrameWorkerData
*
const
frame_worker_data
=
worker
->
data1
;
if
(
cm
->
refresh_frame_context
==
REFRESH_FRAME_CONTEXT_FORWARD
)
{
context_updated
=
1
;
...
...
av1/decoder/decoder.c
View file @
54e66767
...
...
@@ -130,7 +130,7 @@ void av1_decoder_remove(AV1Decoder *pbi) {
aom_free
(
pbi
->
lf_worker
.
data1
);
aom_free
(
pbi
->
tile_data
);
for
(
i
=
0
;
i
<
pbi
->
num_tile_workers
;
++
i
)
{
V
P
xWorker
*
const
worker
=
&
pbi
->
tile_workers
[
i
];
A
VxWorker
*
const
worker
=
&
pbi
->
tile_workers
[
i
];
aom_get_worker_interface
()
->
end
(
worker
);
}
aom_free
(
pbi
->
tile_worker_data
);
...
...
@@ -306,7 +306,7 @@ int av1_receive_compressed_data(AV1Decoder *pbi, size_t size,
pbi
->
hold_ref_buf
=
0
;
if
(
cm
->
frame_parallel_decode
)
{
V
P
xWorker
*
const
worker
=
pbi
->
frame_worker_owner
;
A
VxWorker
*
const
worker
=
pbi
->
frame_worker_owner
;
av1_frameworker_lock_stats
(
worker
);
frame_bufs
[
cm
->
new_fb_idx
].
frame_worker_owner
=
worker
;
// Reset decoding progress.
...
...
@@ -319,7 +319,7 @@ int av1_receive_compressed_data(AV1Decoder *pbi, size_t size,
}
if
(
setjmp
(
cm
->
error
.
jmp
))
{
const
V
P
xWorkerInterface
*
const
winterface
=
aom_get_worker_interface
();
const
A
VxWorkerInterface
*
const
winterface
=
aom_get_worker_interface
();
int
i
;
cm
->
error
.
setjmp
=
0
;
...
...
@@ -381,7 +381,7 @@ int av1_receive_compressed_data(AV1Decoder *pbi, size_t size,
if
(
cm
->
frame_parallel_decode
)
{
// Need to lock the mutex here as another thread may
// be accessing this buffer.
V
P
xWorker
*
const
worker
=
pbi
->
frame_worker_owner
;
A
VxWorker
*
const
worker
=
pbi
->
frame_worker_owner
;
FrameWorkerData
*
const
frame_worker_data
=
worker
->
data1
;
av1_frameworker_lock_stats
(
worker
);
...
...
av1/decoder/decoder.h
View file @
54e66767
...
...
@@ -61,9 +61,9 @@ typedef struct AV1Decoder {
// the same.
RefCntBuffer
*
cur_buf
;
// Current decoding frame buffer.
V
P
xWorker
*
frame_worker_owner
;
// frame_worker that owns this pbi.
V
P
xWorker
lf_worker
;
V
P
xWorker
*
tile_workers
;
A
VxWorker
*
frame_worker_owner
;
// frame_worker that owns this pbi.
A
VxWorker
lf_worker
;
A
VxWorker
*
tile_workers
;
TileWorkerData
*
tile_worker_data
;
TileInfo
*
tile_worker_info
;
int
num_tile_workers
;
...
...
av1/decoder/dthread.c
View file @
54e66767
...
...
@@ -18,7 +18,7 @@
// #define DEBUG_THREAD
// TODO(hkuang): Clean up all the #ifdef in this file.
void
av1_frameworker_lock_stats
(
V
P
xWorker
*
const
worker
)
{