[FFmpeg-trac] #3204(avcodec:open): VC1 Intensity Compensation is always used once encountered

FFmpeg trac at avcodec.org
Sun Dec 8 07:27:47 CET 2013

#3204: VC1 Intensity Compensation is always used once encountered
             Reporter:  mcarter      |                    Owner:
                 Type:  defect       |                   Status:  open
             Priority:  important    |                Component:  avcodec
              Version:  git-master   |               Resolution:
             Keywords:  vc1          |               Blocked By:
  regression                         |  Reproduced by developer:  1
             Blocking:               |
Analyzed by developer:  0            |

Comment (by mcarter):

 Here is a (probably suboptimal) naive patch that might solve the issue:

 In `vc1.c`, in `rotate_luts()` after `v->curr_use_ic = 0`, apply this

 ROTATE(int tmp,             v->last_use_ic, v->next_use_ic,
 v->curr_use_ic, v->aux_use_ic);
 ROTATE(uint8_t tmp[2][256], v->last_luty,   v->next_luty,   v->curr_luty,
 ROTATE(uint8_t tmp[2][256], v->last_lutuv,  v->next_lutuv,  v->curr_lutuv,

 INIT_LUT(32, 0, v->curr_luty[0], v->curr_lutuv[0], 0);
 INIT_LUT(32, 0, v->curr_luty[1], v->curr_lutuv[1], 0);
 v->curr_use_ic = 0;

 +if (v->curr_luty == v->next_luty) {
 +    v->next_use_ic = 0;

 Here's why this makes sense: the previous lines call `INIT_LUT(32, 0,
 v->curr_luty...` which sets `v->curr_lut{y,uv}[0,1]` to the identity
 mapping. But note that due to the `ROTATE()` calls, `v->curr_luty` points
 to either `v->next_luty` or `v->aux_luty`. If `v->curr_luty` points to
 `v->next_luty`, then the `INIT_LUT()` calls just set `v->next_luty` to the
 identity mapping. If `v->next_luty` is set to the identity mapping, then
 `v->next_use_ic` should be set to 0, just as `v->curr_use_ic` has already
 been set to 0. (We don't need to set `v->aux_use_ic` since it is never
 read by any code.)

 An alternative patch would be to use the same test that ROTATE() uses: `if
 (!(v->s.pict_type == AV_PICTURE_TYPE_BI || v->s.pict_type ==
 AV_PICTURE_TYPE_B)) { v->next_use_ic = 0; }`

 I'm not 100% sure if either of these are a good fix, but I hope it gives
 some insight into the problem.

Ticket URL: <https://trac.ffmpeg.org/ticket/3204#comment:2>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list