예제 #1
0
파일: Lossless.cs 프로젝트: Casidi/GARbro
        public void Init(int width, int height, VP8Io io,
                          byte[] data, int data_i, int data_size, byte[] output)
        {
            width_ = width;
            height_ = height;
            status_ = VP8StatusCode.Ok;
            io_ = io;

            io_.opaque = output;
            io_.width = width_;
            io_.height = height_;

            br_.Init (data, data_i, (uint)data_size);
        }
예제 #2
0
파일: Decoder.cs 프로젝트: Casidi/GARbro
 public WebPDecoder(Stream input, WebPMetaData info)
 {
     m_input = new ArcView.Reader (input);
     m_info = info;
     m_stride = (int)info.Width * 4;
     m_output = new byte[m_stride * (int)info.Height];
     m_io = new VP8Io();
     if (0 != m_info.AlphaOffset)
     {
         m_input.BaseStream.Position = m_info.AlphaOffset;
         m_alpha_data = m_input.ReadBytes (m_info.AlphaSize);
         m_alpha_plane = new byte[info.Width * info.Height];
         Format = PixelFormats.Bgra32;
     }
     else
     {
         Format = PixelFormats.Bgr32;
     }
 }
예제 #3
0
파일: Alpha.cs 프로젝트: Casidi/GARbro
        public bool Init(byte[] data, VP8Io src_io, byte[] output)
        {
            m_io = new VP8Io();
            int alpha_data = HeaderLen;
            int alpha_data_size = data.Length - HeaderLen;

            width_ = src_io.width;
            height_ = src_io.height;

            if (data.Length <= HeaderLen)
                return false;

            method_ = (data[0] >> 0) & 3;
            filter_ = (data[0] >> 2) & 3;
            pre_processing_ = (data[0] >> 4) & 3;
            int rsrv = (data[0] >> 6) & 3;
            if (method_ < NoCompression
                || method_ > LosslessCompression
                || filter_ >= WebpFilter.Last
                || pre_processing_ > PreprocessedLevels
                || rsrv != 0)
            {
                return false;
            }

            bool ok = false;
            if (NoCompression == method_)
            {
                int alpha_decoded_size = width_ * height_;
                ok = (alpha_data_size >= alpha_decoded_size);
            }
            else
            {
                ok = DecodeAlphaHeader (data, alpha_data, alpha_data_size, output);
            }
            FiltersInit();

            // Copy the necessary parameters from src_io to io
            //            m_io.Init();
            m_io.opaque = output;      // output plane
            m_io.width = src_io.width;
            m_io.height = src_io.height;

            return ok;
        }