diff mbox

[FFmpeg-devel] hevc: Fix scaling list prediction delta for the 32x32 inter matrix

Message ID 595f926a-c283-5b52-d98f-ba38da16ec15@jkqxz.net
State Accepted
Commit 88a2e4504d1820e717730ff5f5dc0cf4d90cdd6e
Headers show

Commit Message

Mark Thompson April 30, 2017, 12:34 p.m. UTC
Fixes ticket #6356.
---
This was broken in 627c044f50da3046809314f7cc742b8a10cf26a1, which changed the array index of the 32x32 inter matrix but missed this case.

Sample at <https://trac.ffmpeg.org/ticket/6356> - with this change the output for that sample matches the reference decoder.


 libavcodec/hevc_ps.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mark Thompson May 15, 2017, 8:29 p.m. UTC | #1
On 30/04/17 13:34, Mark Thompson wrote:
> Fixes ticket #6356.
> ---
> This was broken in 627c044f50da3046809314f7cc742b8a10cf26a1, which changed the array index of the 32x32 inter matrix but missed this case.
> 
> Sample at <https://trac.ffmpeg.org/ticket/6356> - with this change the output for that sample matches the reference decoder.
> 
> 
>  libavcodec/hevc_ps.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
> index 6d67dd9c69..3e00e4b3f3 100644
> --- a/libavcodec/hevc_ps.c
> +++ b/libavcodec/hevc_ps.c
> @@ -719,6 +719,7 @@ static int scaling_list_data(GetBitContext *gb, AVCodecContext *avctx, ScalingLi
>                   * which should already be in the arrays. */
>                  if (delta) {
>                      // Copy from previous array.
> +                    delta *= (size_id == 3) ? 3 : 1;
>                      if (matrix_id < delta) {
>                          av_log(avctx, AV_LOG_ERROR,
>                                 "Invalid delta in scaling list data: %d.\n", delta);
> 

Ping.
James Almer May 15, 2017, 9:46 p.m. UTC | #2
On 5/15/2017 5:29 PM, Mark Thompson wrote:
> On 30/04/17 13:34, Mark Thompson wrote:
>> Fixes ticket #6356.
>> ---
>> This was broken in 627c044f50da3046809314f7cc742b8a10cf26a1, which changed the array index of the 32x32 inter matrix but missed this case.
>>
>> Sample at <https://trac.ffmpeg.org/ticket/6356> - with this change the output for that sample matches the reference decoder.
>>
>>
>>  libavcodec/hevc_ps.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
>> index 6d67dd9c69..3e00e4b3f3 100644
>> --- a/libavcodec/hevc_ps.c
>> +++ b/libavcodec/hevc_ps.c
>> @@ -719,6 +719,7 @@ static int scaling_list_data(GetBitContext *gb, AVCodecContext *avctx, ScalingLi
>>                   * which should already be in the arrays. */
>>                  if (delta) {
>>                      // Copy from previous array.
>> +                    delta *= (size_id == 3) ? 3 : 1;
>>                      if (matrix_id < delta) {
>>                          av_log(avctx, AV_LOG_ERROR,
>>                                 "Invalid delta in scaling list data: %d.\n", delta);
>>
> 
> Ping.

Should be ok.

Can you add a fate test with this sample as well?
Mark Thompson May 15, 2017, 10:44 p.m. UTC | #3
On 15/05/17 22:46, James Almer wrote:
> On 5/15/2017 5:29 PM, Mark Thompson wrote:
>> On 30/04/17 13:34, Mark Thompson wrote:
>>> Fixes ticket #6356.
>>> ---
>>> This was broken in 627c044f50da3046809314f7cc742b8a10cf26a1, which changed the array index of the 32x32 inter matrix but missed this case.
>>>
>>> Sample at <https://trac.ffmpeg.org/ticket/6356> - with this change the output for that sample matches the reference decoder.
>>>
>>>
>>>  libavcodec/hevc_ps.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
>>> index 6d67dd9c69..3e00e4b3f3 100644
>>> --- a/libavcodec/hevc_ps.c
>>> +++ b/libavcodec/hevc_ps.c
>>> @@ -719,6 +719,7 @@ static int scaling_list_data(GetBitContext *gb, AVCodecContext *avctx, ScalingLi
>>>                   * which should already be in the arrays. */
>>>                  if (delta) {
>>>                      // Copy from previous array.
>>> +                    delta *= (size_id == 3) ? 3 : 1;
>>>                      if (matrix_id < delta) {
>>>                          av_log(avctx, AV_LOG_ERROR,
>>>                                 "Invalid delta in scaling list data: %d.\n", delta);
>>>
>>
>> Ping.
> 
> Should be ok.
> 
> Can you add a fate test with this sample as well?

Sure.  I've asked the reporter whether their file can be used for this.

Thanks,

- Mark
Mark Thompson June 14, 2017, 10:10 p.m. UTC | #4
On 15/05/17 23:44, Mark Thompson wrote:
> On 15/05/17 22:46, James Almer wrote:
>> On 5/15/2017 5:29 PM, Mark Thompson wrote:
>>> On 30/04/17 13:34, Mark Thompson wrote:
>>>> Fixes ticket #6356.
>>>> ---
>>>> This was broken in 627c044f50da3046809314f7cc742b8a10cf26a1, which changed the array index of the 32x32 inter matrix but missed this case.
>>>>
>>>> Sample at <https://trac.ffmpeg.org/ticket/6356> - with this change the output for that sample matches the reference decoder.
>>>>
>>>>
>>>>  libavcodec/hevc_ps.c | 1 +
>>>>  1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
>>>> index 6d67dd9c69..3e00e4b3f3 100644
>>>> --- a/libavcodec/hevc_ps.c
>>>> +++ b/libavcodec/hevc_ps.c
>>>> @@ -719,6 +719,7 @@ static int scaling_list_data(GetBitContext *gb, AVCodecContext *avctx, ScalingLi
>>>>                   * which should already be in the arrays. */
>>>>                  if (delta) {
>>>>                      // Copy from previous array.
>>>> +                    delta *= (size_id == 3) ? 3 : 1;
>>>>                      if (matrix_id < delta) {
>>>>                          av_log(avctx, AV_LOG_ERROR,
>>>>                                 "Invalid delta in scaling list data: %d.\n", delta);
>>>>
>>>
>>> Ping.
>>
>> Should be ok.
>>
>> Can you add a fate test with this sample as well?
> 
> Sure.  I've asked the reporter whether their file can be used for this.

Reporter didn't reply, so applied with no test.

Thanks,

- Mark
diff mbox

Patch

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index 6d67dd9c69..3e00e4b3f3 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -719,6 +719,7 @@  static int scaling_list_data(GetBitContext *gb, AVCodecContext *avctx, ScalingLi
                  * which should already be in the arrays. */
                 if (delta) {
                     // Copy from previous array.
+                    delta *= (size_id == 3) ? 3 : 1;
                     if (matrix_id < delta) {
                         av_log(avctx, AV_LOG_ERROR,
                                "Invalid delta in scaling list data: %d.\n", delta);