[FFmpeg-devel] [PATCH v4 1/2] vaapi_encode: Add ROI support

Mark Thompson sw at jkqxz.net
Mon Jul 29 01:24:03 EEST 2019


On 16/07/2019 08:19, Guo, Yejun wrote:>> -----Original Message-----
>> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf Of
>> Mark Thompson
>> Sent: Monday, July 08, 2019 3:27 AM
>> To: ffmpeg-devel at ffmpeg.org
>> Subject: [FFmpeg-devel] [PATCH v4 1/2] vaapi_encode: Add ROI support
>>
>> ---
>>  libavcodec/vaapi_encode.c       | 118
>> ++++++++++++++++++++++++++++++++
>>  libavcodec/vaapi_encode.h       |  18 +++++
>>  libavcodec/vaapi_encode_h264.c  |   2 +
>>  libavcodec/vaapi_encode_h265.c  |   2 +
>>  libavcodec/vaapi_encode_mpeg2.c |   2 +
>>  libavcodec/vaapi_encode_vp8.c   |   2 +
>>  libavcodec/vaapi_encode_vp9.c   |   2 +
>>  7 files changed, 146 insertions(+)
>>
>> ...
>> @@ -948,6 +1016,19 @@ static int
>> vaapi_encode_check_frame(AVCodecContext *avctx,
>>          ctx->crop_warned = 1;
>>      }
>>
>> +    if (!ctx->roi_allowed) {
>> +        AVFrameSideData *sd =
>> +            av_frame_get_side_data(frame,
>> AV_FRAME_DATA_REGIONS_OF_INTEREST);
>> +
>> +        if (sd && !ctx->roi_warned) {
>> +            if (sd && !ctx->roi_warned) {
> 
> looks good except this duplicate code

Good catch, fixed.

>> +                av_log(avctx, AV_LOG_WARNING, "ROI side data on input
>> "
>> +                       "frames ignored due to lack of driver
>> support.\n");
>> +                ctx->roi_warned = 1;
>> +            }
>> +        }
>> +    }
>> +
>>      return 0;
>>  }

And set applied with that.

Thank you for reviewing!

- Mark


More information about the ffmpeg-devel mailing list