Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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);
00042
00043 ippsZero_8u(m_raw,sizeof(m_raw));
00044 ippsZero_8u((Ipp8u*)m_qnt,sizeof(m_qnt));
00045
00046 return;
00047 }
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 }
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 }
00088