Saturday, January 31, 2009

I am a HINDU

Sometimes back I got this in my mail and after reading this; I felt that I should shares this with others too. It's story but gives actual backbone thinking of Hinduism. It will take your few minutes but worth to spend it. There is no offense for any Religion, as every religion says the same things "God is everywhere "; only the way is different.

Four years ago, I was flying from JFK NY Airport to SFO to attend a meeting at Monterey, CA. An American girl was sitting on the right side, near window seat. It indeed was a long journey - it would take nearly seven hours!

I was surprised to see the young girl reading a Bible - unusual of young Americans! (Later I came to know that September 11 has changed mind-set of lot of US citizens. They suddenly turned religious, it seemed.)

After some time she smiled and we had few acquaintances talk. I told her that I am from India. Then suddenly the girl asked: 'What's your faith?'

'What?' I didn't understand the question.

'I mean, what's your religion? Are you a Christian? Or a Muslim?'

'No!' I replied, 'I am neither Christian nor Muslim'.

Apparently she appeared shocked to listen to that. 'Then who are you…?'

'I am a Hindu', I said.

She looked at me as if she is seeing a caged animal. She could not understand what I was talking about.

A common man in Europe or US know about Christianity and Islam, as they are the leading religions of the world today. But a Hindu, what?

I explained to her - I am born to a Hindu father and Hindu mother. Therefore, I am a Hindu by birth.

'Who is your prophet?' she asked.

'We don't have a prophet,' I replied.

'What's your Holy Book?'

'We don't have a single Holy Book, but we have hundreds and thousands of philosophical and sacred scriptures,' I replied.

'Oh, come on…at least tell me who is your God?' Girl said.

'What do you mean by that?' I asked.

'Like we have Yahweh and Muslims have Allah - don't you have a God?' Again girl asked me.

I thought for a moment. Muslims and Christians believe one God (Male God) who created the world and takes an interest in the humans who inhabit it. Her mind is conditioned with that kind of belief. According to her (or anybody who doesn't know about Hinduism), a religion need to have one Prophet, one Holy book and one God. The mind is so conditioned and rigidly narrowed down to such a notion that anything else is not acceptable. I understood her perception and concept about faith. You can't compare Hinduism with any of the present leading religions where you have to believe in one concept of god.

I tried to explain to her “You can believe in one god and you can be a Hindu. You may believe in multiple deities and still you can be a Hindu. What's more - you may not believe in god at all, still you can be a Hindu. An atheist can also be a Hindu.”

This sounded very crazy to her. She couldn't imagine a religion so unorganized, still surviving for thousands of years, even after onslaught from foreign forces.

'I don't understand…but it seems very interesting. Are you religious?' Girl asked.

What can I tell to this American girl? I thought. I said: “I do not go to temple regularly. I do not make any regular rituals. I have learned some of the rituals in my younger days. I still enjoy doing it sometimes.”

'Enjoy? Are you not afraid of God?'

'God is a friend. No- I am not afraid of God. Nobody has made any compulsions on me to perform these rituals regularly.'

She thought for a while and then asked: 'Have you ever thought of converting to any other religion?'

“Why should I? Even if I challenge some of the rituals and faith in Hinduism, nobody can convert me from Hinduism. Because, being a Hindu allows me to think independently and objectively, without conditioning… I remain as a Hindu never by force, but choice.” I told her .

I told her that Hinduism is not a religion, but a set of beliefs and practices. It is not a religion like Christianity or Islam because it is not founded by any one person or does not have an organized controlling body like the Church or the Order, I added. There is no institution or authority.

'So, you don't believe in God?' she wanted everything in black and white.

“I didn't say that. I do not discard the divine reality. Our scripture, or Sruthis or Smrithis - Vedas and Upanishads or the Gita - say God might be there or he might not be there. But we pray to that supreme abstract authority (Para Brahma) that is the creator of this universe.” I explained to her.

After few moments thought again girl asked me, 'Why can't you believe in one personal God?'

“We have a concept - abstract - not a personal god. The concept or notion of a personal God, hiding behind the clouds of secrecy, telling us irrational stories through few men whom he sends as messengers, demanding us to worship him or punish us, does not make sense. I don't think that God is as silly as an autocratic emperor who wants others to respect him or fear him.' I told her that such notions are just fancies of less educated human imagination and fallacies, adding that generally ethnic religious practitioners in Hinduism believe in personal gods. The entry level Hinduism has over-whelming superstitions too. The philosophical side of Hinduism negates all superstitions” I explained her a bit more.

'Good that you agree God might exist. You told that you pray. What is your prayer then?'

'Loka Samastha Sukino Bhavantu. Om Shanti, Shanti, Shanti,'

'Funny,' she laughed, 'What does it mean?'

“May all the beings in all the worlds be happy. Om Peace, Peace, Peace.”

“Hmm…very interesting. I want to learn more about this religion. It is so democratic, broad-minded and free…' she exclaimed.

'The fact is Hinduism is a religion of the individual, for the individual and by the individual with its roots in the Vedas and the Bhagavad-Gita. It is all about an individual approaching a personal God in an individual way according to his temperament and inner evolution - it is as simple as that.'

“How does anybody convert to Hinduism?”

“'Nobody can convert you to Hinduism, because it is not a religion, but a set of beliefs and practices. Everything is acceptable in Hinduism because there is no single authority or organization either to accept it or to reject it or to oppose it on behalf of Hinduism. If you look for meaning in life, don't look for it in religions; don't go from one cult to another or from one guru to the next.

For a real seeker, I told her, Bible itself gives guidelines when it says 'Kingdom of God is within you.' I reminded her of Christ's teaching about the love that we have for each other. That is where you can find the meaning of life. Loving each and every creation of the God is absolute and real. 'Isavasyam idam sarvam' Isam (the God) is present (inhabits) here everywhere - nothing exists separate from the God, because God is present everywhere. Respect every living being and non-living things as God. That's what Hinduism teaches you.

Hinduism is referred to as Sanathana Dharma, the eternal faith. It is based on the practice of Dharma, the code of life. The most important aspect of Hinduism is being truthful to oneself. Hinduism has no monopoly on ideas. It is open to all. Hindus believe in one God (not a personal one) expressed in different forms. For them, God is timeless and formless entity.

Ancestors of today's Hindus believe in eternal truths and cosmic laws and these truths are opened to anyone who seeks them. But there is a section of Hindus who are either superstitious or turned fanatic to make this an organized religion like others. The British coin the word 'Hindu' and considered it as a religion.

I said: 'Religions have become an MLM (multi-level-marketing) industry that has been trying to expand the market share by conversion. The biggest business in today's world is Spirituality. Hinduism is no exception…

And I am a Hindu because it doesn't condition my mind with any faith system............. '


These are some photos taken by me from my Nokia 6535 mobile which has VGA camera. Old memories of my Post graduation days.

Thursday, January 29, 2009

H264:How to do conversion from 8 bits to 14 bit support

There are lots of professional applications which require higher bit depth support like studio application, HD application. In H.264 out of 11 profiles there are 7 profiles which supports more than 8 bits bit depth starting from High10 which supports 10 bits bit depth. There are High 444 Predictive and some related profiles which support upto 14 bits. Anyway the conversion procedure wise both are pretty much same except the specific values.

One more things we should keep in mind that bit depth may be different for Luma and Chroma components(both Cb and Cr will be of same bit depth).

So here I am describing the process conversion of encoder/decoder for than 8 bits, lets say specific to 14 bits support. For simplification I am taking both Luma and Chomra compo nets are of equal bit depth of BitDepth =14.So for this case BitDepthY = BitDepthC = BitDepth.

Note:For standardization reason, before that you must support at least main profile.I will put corresponding equation with equation number from the standard version ITU-T Rec. H.264 (11/2007) .

1)Generally for pixel variables we use 'char', first thing is convert this to 'short'

2)Change all your variables related to pixel/samples for 'short' like arrays, pointers, file read , file write , memcpy etc.

3)Change your 'clip' functions for pixels according bit depth for both Luma and Chroma components.
Clip1Y( x ) = Clip3( 0, ( 1 << BitDepthY ) – 1, x ) (5-3)
Clip1C( x ) = Clip3( 0, ( 1 << BitDepthC ) – 1, x ) (5-4)

4)Now decoder has to know the bit depth of the pixels so it has to read 'bit_depth_luma_minus8 ' and 'bit_depth_chroma_minus8 ' in the SPS header. With these parameters find out 'BitDepthY ' and 'QpBdOffsetY ' and similarly for chroma components.
BitDepthY = 8 + bit_depth_luma_minus8 (7-2)
QpBdOffsetY = 6 * bit_depth_luma_minus8 (7-3)

BitDepthC = 8 + bit_depth_chroma_minus8 (7-4)
QpBdOffsetC = 6 * ( bit_depth_chroma_minus8 + residual_colour_transform_flag ) (7-5)

In the encoder side the 'bit_depth_luma_minus8 ' and 'bit_depth_chroma_minus8 ' should be send in the SPS header to .264 bitstream.

5)As now each sample has bit depth of BitDepthY for luma and BitDepthC for chroma components , the PCM samples of I_PCM should be accordingly modified.

6)For intra prediction DC prediction mode value will change according to BitDepth.
pred4x4L[ x, y ] = ( 1 << ( BitDepthY – 1 ) ) (8-52)
pred8x8L[ x, y ] = ( 1 << ( BitDepthY – 1 ) ) (8-96)
predL[ x, y ] = ( 1 << ( BitDepthY – 1 ) ), with x, y = 0..15 (8-123)

And as well as Chroma components
predC[ x + xO, y + yO ] = ( 1 << ( BitDepthC – 1 ) ), with x, y = 0..3. (8-139)
predC[ x + xO, y + yO ] = ( 1 << ( BitDepthC – 1 ) ), with x, y = 0..3. (8-142)
predC[ x + xO, y + yO ] = ( 1 << ( BitDepthC – 1 ) ), with x, y = 0..3. (8-145)

7)If you are using prediction weights then some work we have to do here also.
o0C = luma_offset_l0[ refIdxL0WP ] * ( 1 << ( BitDepthY – 8 ) ) (8-295)
o1C = luma_offset_l1[ refIdxL1WP ] * ( 1 << ( BitDepthY – 8 ) ) (8-296)

And for chroma components
o0C = chroma_offset_l0[ refIdxL0WP ][ iCbCr ] * ( 1 << ( BitDepthC – 8 ) ) (8-300)
o1C = chroma_offset_l1[ refIdxL1WP ][ iCbCr ] * ( 1 << ( BitDepthC – 8 ) ) (8-301)

8)As bit depth of pixels has changed so it will affect a lot to quantization.

1.'pic_init_qp_minus26' range will be now -(26 + QpBdOffsetY ) to +25, inclusive.

2.SliceQPY will be in the range of -QpBdOffsetY to +51, inclusive.
SliceQPY = 26 + pic_init_qp_minus26 + slice_qp_delta (7-28)

So if we have bit depth of 14 so our SliceQPY will be in the range of -36 to +51.

3.'mb_qp_delta' will be in the range of –( 26 + QpBdOffsetY / 2) to +( 25 + QpBdOffsetY / 2 )
The value of QPY is derived as
QPY = ( ( QPY,PREV + mb_qp_delta + 52 + 2 * QpBdOffsetY ) % ( 52 + QpBdOffsetY ) ) - QpBdOffsetY (7-35)

And the working QP for luma components will be QP'Y , which is derived as
QP'Y = QPY + QpBdOffsetY (7-36)

Remember QP quantisation parameter values QPY is always in the range of –QpBdOffsetY to 51, inclusive. QP quantisation parameter values QPC is always in the range of –QpBdOffsetC to 51, inclusive.

4.For the chroma quantization parameters the value of QPC is determined from the current value of QPY (NOT QP'Y)and the value of 'chroma_qp_index_offset' (for Cb) or 'second_chroma_qp_index_offset' (for Cr).

If the chroma component is the Cb component, qPOffset is
qPOffset = chroma_qp_index_offset (8-315)

Otherwise (the chroma component is the Cr component), qPOffset is
qPOffset = second_chroma_qp_index_offset (8-316)

The value of qPI for each chroma component is derived as
qPI = Clip3( –QpBdOffsetC, 51, QPY + qPOffset ) (8-317)

And QPC = Chroma Quantization table[qPI]

The value of QP'C for the chroma components will be
QP'C = QPC + QpBdOffsetC (8-318)

5.The variable qP for quantization wil be QP'Y for luma components and QP'C for chorma components.

9)The bit depth also affect in deblocking process.

1.For average quantization parameter qPav the qPp and qPq will be correspond to QPY for chromaEdgeFlag equal to 0 (luma components) and QPC for chromaEdgeFlag equal to 1 (choma components).

2.Threshold variables a and ß will vary as
If chromaEdgeFlag is equal to 0,
a = a' * (1 << ( BitDepthY – 8 ) ) (8-466)
ß = ß' * (1 << ( BitDepthY – 8 ) ) (8-467)

Otherwise (chromaEdgeFlag is equal to 1),
a = a' * (1 << ( BitDepthC – 8 ) ) (8-468)
ß = ß' * (1 << ( BitDepthC – 8 ) ) (8-469)

3.Threshold variable tC0 will vary as
If chromaEdgeFlag is equal to 0,
tC0 = t'C0 * (1 << ( BitDepthY – 8 ) ) (8-476)

Otherwise (chromaEdgeFlag is equal to 1),
tC0 = t'C0 * (1 << ( BitDepthC – 8 ) ) (8-477)

So now we are ready for professional applications with 14 bits bit depth support for higher quality and by providing best compression with the power of H.264.

Tip for the topic: As you changed all pixel related data types to 'short' to support mote than 8 bits bit depth, just check for input which has 8 bits bit depth only. Is your code working fine???

I guess you dont want two different code base for 8 bits and more than 8 bits.Think hard and think definitely dont need two different code base... ;)

Tuesday, January 20, 2009

Wow!!!! YouTube Video with HD quality and download option

Good news guys...YouTube (google video site) is proving HD quality video on their site and now you can download those video too (without using any third party application). And if you want to know how they are able to transfer HD quality video through internet, the answer is ....they are using H.264 video compression format (my favorite one), which gives highest compression with better quality till date.The power of H.264 !!!!

But before rushing to Youtube site, here is the information for you.
Not all the clips are available in HD quality or with download option.It doesn't yet involve commercial content such as music videos otherwise who will buy it.. :)
Specially you will get Obama related stuff or home-made movies etc.
Here is one sample for you. From Barack Obama

If you want to read more information on it. here is the link for you.
* YouTube adds downloads, VUDU HD viewing

Friday, January 16, 2009

Add Icon to .exe using visual studio .net 2003

Since long time working with C/C++ project, I was almost fed of getting Blue border of .exe file view. So I decided to make my own icon and add that to my application.So after some hours of googling and almost same amount of my own testing of making .ico and adding to my application finally succeeded.

So here is the way....

Ok the way I am describing here is for "visual studio .net 2003", my googling says if you are working on DevC++ or VC6 kind of editor, there it is very easy just open "Project Option" or "Application" and you 'll find the option to use ICon either default one or you can import/browse also.

But if you are using "visual studio .net 2003" things are slightly different here.
Here in each project you have tree structure of Source, header and Resource.

so go to 'Resource files'folder and add Resource, you 'll get this kind of window..

So here select 'Icon' and click o 'New'.Once you would make .ico, you can just import it also(Keep your .ico on the same folder with .sln).ICon window will open with Image menu and Paint tool.

Now paint your dream to make your icon.

Just make sure after making this icon, click right click and check "current image type" if you see 32x32, 16 color then select "new image type" on the right click property page only and select 16x16 ,16 color or vice versa and paint it too.Just save and rebuild the complete solution. You will see 'resource is also getting compiled and linked.So the job has been done...just check your .exe icon now. It should be something like ......

So now enjoy icons in your .exe.

Wednesday, January 14, 2009

I read these books...

Hi these are some books I read and I recommend for others too. I remember my pre-final year of B.E. when I forcefully made my hobby "Reading novels", but now it becomes natural for me. I started with hindi novel. Actually i was inspired by one of my senior to read hindi novels and even while leaving college he gave me his Library ID also, so that I could continue this hobby...thanks a million to him.

So I started with Hindi novels, I like much Premchand and Bhagwati Sharan Verma although I read Mahadevi verma, Amrita Pritam.... then gradually I shifted to English novels and I am enjoying it a lot. Novels are the only thing which can take me away from my laptop...till now ;)

So here are the some of my Favorite books...
1) Thake paon (Hindi)
2) KarmaBhumi(Hinid)
3) The monk who sold his Ferrari
4) The Alchemist
5) Lord Of The Rings
6) The Vinci Code
7) Angels and Demons
8) Animal Form
9) Stranger in the mirror
10) If tomorrow comes..
11) Train to Pakistan

Enjoy reading.....

Monday, January 12, 2009

I use Vista but Microsoft says Vista sucks!....

I have been using Vista since I purchased my laptop.I dont have much Charm for this as I am basically a XP user and sometime play with Ubuntu...

There are the times when I seriously faced issue with my fav. software NOT compatible with Vista or sometimes works but not as good as with XP. So here is the latest news from Microsoft.
I wish they should have agreed to this point long back..."Vista sucks!"

Now Microsoft itself telling that Vista is bad is Security specially "System Admin Privilege", They are thinking to replace 'Vista' with "Window 7" that too free for customer, imagine the reality.

Here are the links for more information...


Keep Enjoying....

Friday, January 02, 2009

1st evening of Year 2009

This is start of another new year (I assume it's according to scientific calender which apply world wide as every culture has different new year too). Suddenly after seeing all this new year celebration, parties I m realizing ohhh one year is over... and I dont remember much how it just has passed. Is one year duration so short... that I didnt even realize when this year 2008 was ended.

I feel apart from all that calculation/maths of years number like 2008 or 2009 for individual human being it is like milestones of life to remember like when I born, when I graduated, when I got married bla bla...

Many people take resolutions for the upcoming year like I 'll quit smoking or I'll read novel or magazine at least 2 hours daily, or so so.....I dont know how much they could maintain or remember their resolutions after one week of new year celebration but truly saying I couldn't. So this time I didn't take any resolution. Actually the thing is when the years ends i.e around 30 -31 st dec. I used to remember that I at the start of that year I took that resolution and that is still pending or not worked out properly, so I used to feel cheated by me only... so this year forget it. ;)

But ya I do have some plans not very specific but in skeleton format. And in spite of telling my heart secretly those plans and trying to make sure to store in mind, I want to publicize it. So at the end of the year I wont be the only person who is scolding me for unfinished tasks.. ;)

Just for summery of last year....

Let's start with technical life as last year I joined new job. I learned a lot in video codec domain. This years I worked on H.264,, AAC, AC-3, Mpeg1Layer2, code porting to ARM even to PDA/PPC, some touch of direct show, transform filters and RTP streaming of video. So I can technically this year was OK for me. OK because other than these I wanted to learn some other things personally for my development like 'Python', 'Symbian programming but couldn't.'

Personal life; truly saying after march-April this year was NOT at all good. I m still bachelor; the same status as it was for last 28 years, hey but dont think that's why I m saying this year was NOT good.... ;). I cant say but something is there which is dragging me away from my enthusiasm or josh to do some other things. I wasted my most of the time while watching movies. Ya if you watch movie once I would say it's good , it's not waste of time but if you watch the movie even you have already watched that and you also know that it 's not that worth to watch again but still watching as you are just not in mood to do anything else so what should we say it.... wastage of time right?

One good thing I did this year was I read lots of novels like Lord of the rings, Angels and Demons, The Vinci code, False impression, If tomorrow comes .... and so on.

Now Plans for this year...

1. Read a lot of novels.
2. Learn Direct Show and make interface with media player.
3. If direct show work over learn GStreamer interface.
4. Learn linux/ubuntu properly
5. Update blog regulary ;one month gap is NOT accepted at all (Seems most difficult one)