[FFmpeg-trac] #5955(undetermined:new): ffmpeg3.2 watermark is opaque

FFmpeg trac at avcodec.org
Thu Nov 17 05:52:36 EET 2016


#5955: ffmpeg3.2 watermark is opaque
-------------------------------------+-------------------------------------
             Reporter:  wzw200       |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
              Version:  unspecified  |  undetermined
             Keywords:               |               Resolution:
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  0
-------------------------------------+-------------------------------------

Comment (by wzw200):

 The same code, FFMPEG2.8 library, runs on iPhone is transparent,
 After that, I will upgrade to FFMPEG3.2 out of the question, and then I
 will compile the MAC 3.2 on the run command, found out the video is
 transparent white, I follow the FFMPEG code, is mainly related with alpha,

 *d = FAST_DIV255 (*d * (255 - alpha) + *s * alpha);
 If main_has_alpha is equal to 0, only the picture of the alpha, there is a
 black background,
 If main_has_alpha is equal to 1, alpha = UNPREMULTIPLY_ALPHA (alpha,
 alpha_d) is performed;

 {{{
 const int main_has_alpha = s->main_has_alpha;

 // if the main channel has an alpha channel, alpha has to be calculated
 // to create an un-premultiplied (straight) alpha value
 if (main_has_alpha && alpha != 0 && alpha != 255) {
     // average alpha for color components, improve quality
     uint8_t alpha_d;
     if (hsub && vsub && j+1 < src_hp && k+1 < src_wp) {
         alpha_d = (d[0] + d[src->linesize[3]] +
                    d[1] + d[src->linesize[3]+1]) >> 2;
     } else if (hsub || vsub) {
         alpha_h = hsub && k+1 < src_wp ?
             (d[0] + d[1]) >> 1 : d[0];
         alpha_v = vsub && j+1 < src_hp ?
             (d[0] + d[src->linesize[3]]) >> 1 : d[0];
         alpha_d = (alpha_v + alpha_h) >> 1;
     } else
         alpha_d = d[0];
     alpha = UNPREMULTIPLY_ALPHA(alpha, alpha_d);
 }
 *d = FAST_DIV255(*d * (255 - alpha) + *s * alpha);

 {{{

--
Ticket URL: <https://trac.ffmpeg.org/ticket/5955#comment:4>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list