encqtbl.cpp
Go to the documentation of this file.
00001 /*
00002 //
00003 //               INTEL CORPORATION PROPRIETARY INFORMATION
00004 //  This software is supplied under the terms of a license agreement or
00005 //  nondisclosure agreement with Intel Corporation and may not be copied
00006 //  or disclosed except in accordance with the terms of that agreement.
00007 //    Copyright (c) 2001-2004 Intel Corporation. All Rights Reserved.
00008 //
00009 //  Intel® Integrated Performance Primitives JPEG Viewer Sample for Windows*
00010 //
00011 //  By downloading and installing this sample, you hereby agree that the
00012 //  accompanying Materials are being provided to you under the terms and
00013 //  conditions of the End User License Agreement for the Intel® Integrated
00014 //  Performance Primitives product previously accepted by you. Please refer
00015 //  to the file ipplic.htm located in the root directory of your Intel® IPP product
00016 //  installation for more information.
00017 //
00018 //  JPEG is an international standard promoted by ISO/IEC and other organizations.
00019 //  Implementations of these standards, or the standard enabled platforms may
00020 //  require licenses from various entities, including Intel Corporation.
00021 //
00022 //
00023 */
00024 
00025 #include "precomp.h"
00026 
00027 #ifndef __ENCQTBL_H__
00028 #include "encqtbl.h"
00029 #endif
00030 
00031 
00032 
00033 
00034 CJPEGEncoderQuantTable::CJPEGEncoderQuantTable(void)
00035 {
00036   m_id          = 0;
00037   m_precision   = 0;
00038   m_initialized = 0;
00039 
00040   m_raw = (Ipp8u*)OWN_ALIGN_PTR(m_rbf,32);
00041   m_qnt = (Ipp16u*)OWN_ALIGN_PTR(m_qbf,32); // align for max performance
00042 
00043   ippsZero_8u(m_raw,sizeof(m_raw));
00044   ippsZero_8u((Ipp8u*)m_qnt,sizeof(m_qnt));
00045 
00046   return;
00047 } // ctor
00048 
00049 
00050 CJPEGEncoderQuantTable::~CJPEGEncoderQuantTable(void)
00051 {
00052   m_initialized = 0;
00053 
00054   ippsZero_8u(m_raw,sizeof(m_raw));
00055   ippsZero_8u((Ipp8u*)m_qnt,sizeof(m_qnt));
00056 
00057   return;
00058 } // dtor
00059 
00060 
00061 JERRCODE CJPEGEncoderQuantTable::Init(int id,int quality,Ipp8u raw[64])
00062 {
00063   IppStatus status;
00064 
00065   m_id        = id  & 0x0f;
00066   m_precision = (id & 0xf0) >> 4;
00067 
00068   ippsCopy_8u(raw,m_raw,DCTSIZE2);
00069 
00070   status = ippiQuantFwdRawTableInit_JPEG_8u(m_raw,quality);
00071   if(ippStsNoErr != status)
00072   {
00073     LOG1("IPP Error: ippiQuantFwdRawTableInit_JPEG_8u() failed - ",status);
00074     return JPEG_INTERNAL_ERROR;
00075   }
00076 
00077   status = ippiQuantFwdTableInit_JPEG_8u16u(m_raw,m_qnt);
00078   if(ippStsNoErr != status)
00079   {
00080     LOG1("IPP Error: ippiQuantFwdTableInit_JPEG_8u() failed - ",status);
00081     return JPEG_INTERNAL_ERROR;
00082   }
00083 
00084   m_initialized = 1;
00085 
00086   return JPEG_OK;
00087 } // CJPEGEncoderQuantTable::Init()
00088 


canon_vbc50i
Author(s): Cedric Pradalier
autogenerated on Sun Oct 5 2014 23:47:45