Weird feature length sci fi cartoon of the 80s with giants and smaller people.
There was a feature length cartoon in the 80s about two groups of people. Some were giants and some were small people. There were traps to kill the small people. There was a scene about a mating ritual in which their bodies danced, and the heads were flying globes.
I think if I remember correctly, the small people then created a poison for the big ones. In the end, there was a girl in a kind of futuristic library. She was petting one of the small ones, as the two groups had learned to live in peace.
Does anybody know what is the name of this cartoon?