[FFmpeg-devel] [PATCH 02/26] vaapi_encode_h265: Move options and common structures into context
Mark Thompson
sw at jkqxz.net
Thu Apr 26 01:09:51 EEST 2018
On 25/04/18 08:35, Xiang, Haihao wrote:>> Matching previous commit for H.264.
>> ---
>> libavcodec/vaapi_encode_h265.c | 114 +++++++++++++++++++---------------------
>> -
>> 1 file changed, 54 insertions(+), 60 deletions(-)
>>
>> diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
>> index 5203c6871d..ba6b426eed 100644
>> --- a/libavcodec/vaapi_encode_h265.c
>> +++ b/libavcodec/vaapi_encode_h265.c
>> ...
>> @@ -953,17 +951,14 @@ static av_cold int vaapi_encode_h265_init(AVCodecContext
>> *avctx)
>>
>> static av_cold int vaapi_encode_h265_close(AVCodecContext *avctx)
>> {
>> - VAAPIEncodeContext *ctx = avctx->priv_data;
>> - VAAPIEncodeH265Context *priv = ctx->priv_data;
>> + VAAPIEncodeH265Context *priv = avctx->priv_data;
>>
>> - if (priv)
>> - ff_cbs_close(&priv->cbc);
>> + ff_cbs_close(&priv->cbc);
>>
>
> I see the NULL check is still used in vaapi_encode_h264_close(), it would be
> better to remove the NULL check in vaapi_encode_h264_close() too if this check
> is unnecessary.
On 25/04/18 08:43, Xiang, Haihao wrote:
>> ---
>> libavcodec/vaapi_encode_mpeg2.c | 50 ++++++++++++++++++++------------------
>> ---
>> 1 file changed, 24 insertions(+), 26 deletions(-)
>>
>> diff --git a/libavcodec/vaapi_encode_mpeg2.c b/libavcodec/vaapi_encode_mpeg2.c
>> index 42df77ea49..5dd1f39cbc 100644
>> --- a/libavcodec/vaapi_encode_mpeg2.c
>> +++ b/libavcodec/vaapi_encode_mpeg2.c
>> ...
>> @@ -638,8 +637,7 @@ static av_cold int vaapi_encode_mpeg2_init(AVCodecContext
>> *avctx)
>>
>> static av_cold int vaapi_encode_mpeg2_close(AVCodecContext *avctx)
>> {
>> - VAAPIEncodeContext *ctx = avctx->priv_data;
>> - VAAPIEncodeMPEG2Context *priv = ctx->priv_data;
>> + VAAPIEncodeMPEG2Context *priv = avctx->priv_data;
>>
>> if (priv)
>
> Is this check necessary?
Right; I've removed both of these (leftover from the codec-private part not being present if common init hadn't been called), and also the one in MJPEG.
Thanks,
- Mark
More information about the ffmpeg-devel
mailing list