[x264-devel] [Git][videolan/x264][master] Fix use of nalu_process callback
Anton Mitrofanov
gitlab at videolan.org
Sun Jan 24 14:07:34 UTC 2021
Anton Mitrofanov pushed to branch master at VideoLAN / x264
Commits:
544c61f0 by Anton Mitrofanov at 2021-01-24T15:04:39+01:00
Fix use of nalu_process callback
Broke after unifying of 8-bit and 10-bit libraries.
- - - - -
3 changed files:
- common/common.h
- encoder/api.c
- encoder/encoder.c
Changes:
=====================================
common/common.h
=====================================
@@ -271,6 +271,8 @@ struct x264_t
{
/* encoder parameters */
x264_param_t param;
+ /* opaque pointer to bit depth independent interface */
+ void *api;
x264_t *thread[X264_THREAD_MAX+1];
x264_t *lookahead_thread[X264_LOOKAHEAD_THREAD_MAX];
=====================================
encoder/api.c
=====================================
@@ -31,7 +31,7 @@
****************************************************************************/
const int x264_chroma_format = X264_CHROMA_FORMAT;
-x264_t *x264_8_encoder_open( x264_param_t * );
+x264_t *x264_8_encoder_open( x264_param_t *, void * );
void x264_8_nal_encode( x264_t *h, uint8_t *dst, x264_nal_t *nal );
int x264_8_encoder_reconfig( x264_t *, x264_param_t * );
void x264_8_encoder_parameters( x264_t *, x264_param_t * );
@@ -43,7 +43,7 @@ int x264_8_encoder_maximum_delayed_frames( x264_t * );
void x264_8_encoder_intra_refresh( x264_t * );
int x264_8_encoder_invalidate_reference( x264_t *, int64_t pts );
-x264_t *x264_10_encoder_open( x264_param_t * );
+x264_t *x264_10_encoder_open( x264_param_t *, void * );
void x264_10_nal_encode( x264_t *h, uint8_t *dst, x264_nal_t *nal );
int x264_10_encoder_reconfig( x264_t *, x264_param_t * );
void x264_10_encoder_parameters( x264_t *, x264_param_t * );
@@ -92,7 +92,7 @@ REALIGN_STACK x264_t *x264_encoder_open( x264_param_t *param )
api->encoder_intra_refresh = x264_8_encoder_intra_refresh;
api->encoder_invalidate_reference = x264_8_encoder_invalidate_reference;
- api->x264 = x264_8_encoder_open( param );
+ api->x264 = x264_8_encoder_open( param, api );
}
else if( HAVE_BITDEPTH10 && param->i_bitdepth == 10 )
{
@@ -107,7 +107,7 @@ REALIGN_STACK x264_t *x264_encoder_open( x264_param_t *param )
api->encoder_intra_refresh = x264_10_encoder_intra_refresh;
api->encoder_invalidate_reference = x264_10_encoder_invalidate_reference;
- api->x264 = x264_10_encoder_open( param );
+ api->x264 = x264_10_encoder_open( param, api );
}
else
x264_log_internal( X264_LOG_ERROR, "not compiled with %d bit depth support\n", param->i_bitdepth );
=====================================
encoder/encoder.c
=====================================
@@ -1450,7 +1450,7 @@ static void set_aspect_ratio( x264_t *h, x264_param_t *param, int initial )
/****************************************************************************
* x264_encoder_open:
****************************************************************************/
-x264_t *x264_encoder_open( x264_param_t *param )
+x264_t *x264_encoder_open( x264_param_t *param, void *api )
{
x264_t *h;
char buf[1000], *p;
@@ -1482,6 +1482,9 @@ x264_t *x264_encoder_open( x264_param_t *param )
param->param_free( param );
}
+ /* Save pointer to bit depth independent interface */
+ h->api = api;
+
#if HAVE_INTEL_DISPATCHER
x264_intel_dispatcher_override();
#endif
@@ -1955,7 +1958,7 @@ static int nal_end( x264_t *h )
* While undefined padding wouldn't actually affect the output, it makes valgrind unhappy. */
memset( end, 0xff, 64 );
if( h->param.nalu_process )
- h->param.nalu_process( h, nal, h->fenc->opaque );
+ h->param.nalu_process( (x264_t *)h->api, nal, h->fenc->opaque );
h->out.i_nal++;
return nal_check_buffer( h );
View it on GitLab: https://code.videolan.org/videolan/x264/-/commit/544c61f082194728d0391fb280a6e138ba320a96
--
View it on GitLab: https://code.videolan.org/videolan/x264/-/commit/544c61f082194728d0391fb280a6e138ba320a96
You're receiving this email because of your account on code.videolan.org.
More information about the x264-devel
mailing list